Back to home page

Enduro/X

 
 

    


0001 
0002 #ifdef _PS64
0003 
0004 #ifdef _MSC_VER
0005 typedef __int64 PSInteger;
0006 typedef unsigned __int64 PSUnsignedInteger;
0007 typedef unsigned __int64 PSHash; /*should be the same size of a pointer*/
0008 #else
0009 typedef long long PSInteger;
0010 typedef unsigned long long PSUnsignedInteger;
0011 typedef unsigned long long PSHash; /*should be the same size of a pointer*/
0012 #endif
0013 typedef int PSInt32;
0014 typedef unsigned int PSUnsignedInteger32;
0015 #else
0016 typedef int PSInteger;
0017 typedef int PSInt32; /*must be 32 bits(also on 64bits processors)*/
0018 typedef unsigned int PSUnsignedInteger32; /*must be 32 bits(also on 64bits processors)*/
0019 typedef unsigned int PSUnsignedInteger;
0020 typedef unsigned int PSHash; /*should be the same size of a pointer*/
0021 #endif
0022 
0023 
0024 #ifdef PSUSEDOUBLE
0025 typedef double PSFloat;
0026 #else
0027 typedef float PSFloat;
0028 #endif
0029 
0030 #if defined(PSUSEDOUBLE) && !defined(_PS64) || !defined(PSUSEDOUBLE) && defined(_PS64)
0031 #ifdef _MSC_VER
0032 typedef __int64 PSRawObjectVal; //must be 64bits

0033 #else
0034 typedef long long PSRawObjectVal; //must be 64bits

0035 #endif
0036 #define PS_OBJECT_RAWINIT() { _unVal.raw = 0; }
0037 #else
0038 typedef PSUnsignedInteger PSRawObjectVal; //is 32 bits on 32 bits builds and 64 bits otherwise

0039 #define PS_OBJECT_RAWINIT()
0040 #endif
0041 
0042 #ifndef PS_ALIGNMENT // PS_ALIGNMENT shall be less than or equal to PS_MALLOC alignments, and its value shall be power of 2.

0043 #if defined(PSUSEDOUBLE) || defined(_PS64)
0044 #define PS_ALIGNMENT 8
0045 #else
0046 #define PS_ALIGNMENT 4
0047 #endif
0048 #endif
0049 
0050 typedef void* PSUserPointer;
0051 typedef PSUnsignedInteger PSBool;
0052 typedef PSInteger PSRESULT;
0053 
0054 #ifdef PSUNICODE
0055 #include <wchar.h>
0056 #include <wctype.h>
0057 
0058 
0059 typedef wchar_t PSChar;
0060 
0061 
0062 #define scstrcmp    wcscmp
0063 #ifdef _WIN32
0064 #define scsprintf   _snwprintf
0065 #else
0066 #define scsprintf   swprintf
0067 #endif
0068 #define scstrlen    wcslen
0069 #define scstrtod    wcstod
0070 #ifdef _PS64
0071 #define scstrtol    wcstoll
0072 #else
0073 #define scstrtol    wcstol
0074 #endif
0075 #define scstrtoul   wcstoul
0076 #define scvsprintf  vswprintf
0077 #define scstrstr    wcsstr
0078 #define scprintf    wprintf
0079 
0080 #ifdef _WIN32
0081 #define WCHAR_SIZE 2
0082 #define WCHAR_SHIFT_MUL 1
0083 #define MAX_CHAR 0xFFFF
0084 #else
0085 #define WCHAR_SIZE 4
0086 #define WCHAR_SHIFT_MUL 2
0087 #define MAX_CHAR 0xFFFFFFFF
0088 #endif
0089 
0090 #define _SC(a) L##a
0091 
0092 
0093 #define scisspace   iswspace
0094 #define scisdigit   iswdigit
0095 #define scisprint   iswprint
0096 #define scisxdigit  iswxdigit
0097 #define scisalpha   iswalpha
0098 #define sciscntrl   iswcntrl
0099 #define scisalnum   iswalnum
0100 
0101 
0102 #define ps_rsl(l) ((l)<<WCHAR_SHIFT_MUL)
0103 
0104 #else
0105 typedef char PSChar;
0106 #define _SC(a) a
0107 #define scstrcmp    strcmp
0108 #ifdef _MSC_VER
0109 #define scsprintf   _snprintf
0110 #else
0111 #define scsprintf   snprintf
0112 #endif
0113 #define scstrlen    strlen
0114 #define scstrtod    strtod
0115 #ifdef _PS64
0116 #ifdef _MSC_VER
0117 #define scstrtol    _strtoi64
0118 #else
0119 #define scstrtol    strtoll
0120 #endif
0121 #else
0122 #define scstrtol    strtol
0123 #endif
0124 #define scstrtoul   strtoul
0125 #define scvsprintf  vsnprintf
0126 #define scstrstr    strstr
0127 #define scisspace   isspace
0128 #define scisdigit   isdigit
0129 #define scisprint   isprint
0130 #define scisxdigit  isxdigit
0131 #define sciscntrl   iscntrl
0132 #define scisalpha   isalpha
0133 #define scisalnum   isalnum
0134 #define scprintf    printf
0135 #define MAX_CHAR 0xFF
0136 
0137 #define ps_rsl(l) (l)
0138 
0139 #endif
0140 
0141 #ifdef _PS64
0142 #define _PRINT_INT_PREC _SC("ll")
0143 #define _PRINT_INT_FMT _SC("%lld")
0144 #else
0145 #define _PRINT_INT_FMT _SC("%d")
0146 #endif