osSysTypes.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _OSSYSTYPES_H_
00026 #define _OSSYSTYPES_H_
00027
00028
00029 #ifndef __STDC_LIMIT_MACROS
00030 #define __STDC_LIMIT_MACROS
00031 #endif
00032 #ifndef __STDC_CONSTANT_MACROS
00033 #define __STDC_CONSTANT_MACROS
00034 #endif
00035
00036 #if (!defined(BREW_MODULE) && !defined(FLAT_BREW))
00037 #include <stdlib.h>
00038 #else
00039
00040
00041 #endif
00042
00043 #if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__WATCOMC__) \
00044 && !defined(__vxworks) && !defined(__SYMBIAN32__) && !defined(NIOS2)
00045 #include <inttypes.h>
00046 #endif
00047
00048 #include <limits.h>
00049
00050 #include <float.h>
00051
00052 #ifndef FALSE
00053 #define FALSE 0
00054 #define TRUE 1
00055 #endif
00056
00057 #define NumberOf(x) (sizeof(x)/sizeof(x[0]))
00058
00059 typedef void OSVoid;
00060 typedef void* OSVoidPtr;
00061 typedef unsigned char OSBOOL;
00062 typedef signed char OSINT8;
00063 typedef unsigned char OSUINT8;
00064 typedef short OSINT16;
00065 typedef unsigned short OSUINT16;
00066 typedef OSUINT8 OSOCTET;
00067 typedef OSUINT8 OSUTF8CHAR;
00068 typedef OSUINT16 OSUNICHAR;
00069 typedef double OSREAL;
00070 typedef double OSDOUBLE;
00071 typedef float OSFLOAT;
00072 #ifdef _16BIT
00073 typedef long OSINT32;
00074 typedef unsigned long OSUINT32;
00075 #define OSINTCONST(val) val##L
00076 #define OSUINTCONST(val) val##UL
00077 #else
00078 typedef int OSINT32;
00079 typedef unsigned int OSUINT32;
00080 #define OSINTCONST(val) val
00081 #define OSUINTCONST(val) val##u
00082 #endif
00083 typedef OSUINT32 OS32BITCHAR;
00084
00085 #define OSUINT32_MAX ((OSUINT32)4294967295UL)
00086 #define OSINT32_MAX ((OSINT32)2147483647L)
00087 #define OSINT32_MIN ((OSINT32)(-OSINT32_MAX-1))
00088
00089 #define OSUINT16_MAX ((OSUINT16)65535UL)
00090 #define OSINT16_MAX ((OSINT16)32767L)
00091 #define OSINT16_MIN ((OSINT16)(-OSINT16_MAX-1))
00092
00093 #define OSUINT8_MAX ((OSUINT8)255U)
00094 #define OSINT8_MAX ((OSINT8)127L)
00095 #define OSINT8_MIN ((OSINT8)(-OSINT8_MAX-1))
00096
00097 #define OSREALMAX ((OSREAL)DBL_MAX)
00098 #define OSREALMIN ((OSREAL)-DBL_MAX)
00099
00100 #define OSU32NULLIDX OSUINT32_MAX
00101 #define OSNULLINDEX ((size_t)-1)
00102
00107 typedef struct OSNumDateTime {
00108 OSINT32 year;
00109 OSUINT8 mon;
00110 OSUINT8 day;
00111 OSUINT8 hour;
00112 OSUINT8 min;
00113 OSREAL sec;
00114 OSBOOL tz_flag;
00115 OSINT32 tzo;
00116 } OSNumDateTime;
00117
00118
00119
00120 #ifndef OSINT64_
00121 #if !defined(_NO_INT64_SUPPORT)
00122 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
00123 #define OSINT64_
00124 typedef __int64 OSINT64;
00125 typedef unsigned __int64 OSUINT64;
00126 #define OSINT64FMT "%I64d"
00127 #define OSUINT64FMT "%I64u"
00128 #define OSINT64FMTX "%I64x"
00129 #define OSINT64MAX _I64_MAX
00130 #define OSUINT64MAX _UI64_MAX
00131 #define OSINT64MIN _I64_MIN
00132 #define OSI64CONST(val) val##i64
00133 #define OSUI64CONST(val) val##ui64
00134
00135 #elif defined(INT64_MAX)
00136 #define OSINT64_
00137 typedef int64_t OSINT64;
00138 typedef uint64_t OSUINT64;
00139 #ifdef PRId64
00140 #define OSINT64FMT "%"PRId64
00141 #define OSUINT64FMT "%"PRIu64
00142 #define OSINT64FMTX "%"PRIx64
00143 #else
00144 #define OSINT64FMT "%lld"
00145 #define OSUINT64FMT "%llu"
00146 #define OSINT64FMTX "%llx"
00147 #endif
00148 #define OSINT64MAX INT64_MAX
00149 #define OSUINT64MAX UINT64_MAX
00150 #define OSINT64MIN INT64_MIN
00151 #define OSI64CONST(val) INT64_C(val)
00152 #define OSUI64CONST(val) UINT64_C(val)
00153
00154 #else
00155 #ifdef __GNUC__ // warning is a GNU compiler extension
00156 #warning "Using long long for 64-bit integers."
00157 #endif
00158 #define OSINT64_
00159 typedef long long OSINT64;
00160 typedef unsigned long long OSUINT64;
00161 #define OSINT64FMT "%lld"
00162 #define OSUINT64FMT "%llu"
00163 #define OSINT64FMTX "%llx"
00164 #define OSI64CONST(val) val##LL
00165 #define OSUI64CONST(val) val##ULL
00166
00167
00168 #ifdef LLONG_MAX
00169 #define OSINT64MAX LLONG_MAX
00170 #define OSUINT64MAX ULLONG_MAX
00171 #define OSINT64MIN LLONG_MIN
00172 #elif defined LONG_LONG_MAX
00173 #define OSINT64MAX LONG_LONG_MAX
00174 #define OSUINT64MAX ULONG_LONG_MAX
00175 #define OSINT64MIN LONG_LONG_MIN
00176 #else
00177 #warning "Using LONG_MAX for 64-bit maximum."
00178 #define OSINT64MAX LONG_MAX
00179 #define OSUINT64MAX ULONG_MAX
00180 #define OSINT64MIN LONG_MIN
00181 #endif
00182
00183 #endif
00184 #endif
00185
00186 #ifndef OSINT64_
00187
00188 #define OSINT64_
00189 typedef long OSINT64;
00190 typedef unsigned long OSUINT64;
00191 #define OSINT64FMT "%ld"
00192 #define OSUINT64FMT "%lu"
00193 #define OSINT64FMTX "%lx"
00194 #define OSINT64MAX LONG_MAX
00195 #define OSUINT64MAX ULONG_MAX
00196 #define OSINT64MIN LONG_MIN
00197 #define OSI64CONST(val) val##L
00198 #define OSUI64CONST(val) val##UL
00199 #endif
00200
00201 #define OSU64NULLIDX OSUINT64MAX
00202
00203 #endif
00204
00212 typedef struct OSDynOctStr {
00213 OSUINT32 numocts;
00214 const OSOCTET* data;
00215 } OSDynOctStr;
00216
00217 typedef OSDynOctStr OSOpenType;
00218
00223 typedef enum { OSXSDAny_binary, OSXSDAny_xmlText } OSXSDAnyAlt;
00224 typedef struct OSXSDAny {
00225 OSXSDAnyAlt t;
00226 union {
00227 OSOpenType* binary;
00228 const OSUTF8CHAR* xmlText;
00229 } u;
00230 } OSXSDAny;
00231
00232
00233
00234 typedef struct OSUTF8NVP {
00235 const OSUTF8CHAR* name;
00236 const OSUTF8CHAR* value;
00237 } OSUTF8NVP;
00238
00239 typedef OSUTF8NVP OSAnyAttr;
00240 typedef OSUTF8NVP OSAnyElement;
00241
00242
00243
00250 typedef struct OSXMLSTRING {
00251 OSBOOL cdata;
00252 const OSUTF8CHAR* value;
00253 } OSXMLSTRING;
00254
00263 typedef OSNumDateTime OSXSDDateTime;
00264
00271 typedef struct OSBitMapItem {
00272 const OSUTF8CHAR* name;
00273 OSUINT16 bitno;
00274 OSUINT16 namelen;
00275 } OSBitMapItem;
00276
00286 typedef struct OSUTF8NameAndLen {
00287 const OSUTF8CHAR* name;
00288 size_t len;
00289 } OSUTF8NameAndLen;
00290
00291 #endif