XBinder  Version 2.6.x
osSysTypes.h
1 /*
2  * Copyright (c) 1997-2018 Objective Systems, Inc.
3  *
4  * This software is furnished under a license and may be used and copied
5  * only in accordance with the terms of such license and with the
6  * inclusion of the above copyright notice. This software or any other
7  * copies thereof may not be provided or otherwise made available to any
8  * other person. No title to and ownership of the software is hereby
9  * transferred.
10  *
11  * The information in this software is subject to change without notice
12  * and should not be construed as a commitment by Objective Systems, Inc.
13  *
14  * PROPRIETARY NOTICE
15  *
16  * This software is an unpublished work subject to a confidentiality agreement
17  * and is protected by copyright and trade secret law. Unauthorized copying,
18  * redistribution or other use of this work is prohibited.
19  *
20  * The above notice of copyright on this source code product does not indicate
21  * any actual or intended publication of such source code.
22  *
23  *****************************************************************************/
24 
25 #ifndef _OSSYSTYPES_H_
26 #define _OSSYSTYPES_H_
27 
28 /* Ensure that the appropriate limits are active. */
29 #ifndef __STDC_LIMIT_MACROS
30 #define __STDC_LIMIT_MACROS
31 #endif
32 #ifndef __STDC_CONSTANT_MACROS
33 #define __STDC_CONSTANT_MACROS
34 #endif
35 #ifndef __STDC_FORMAT_MACROS
36 #define __STDC_FORMAT_MACROS
37 #endif
38 
39 #if (!defined(BREW_MODULE) && !defined(FLAT_BREW))
40 #include <stdlib.h>
41 #else
42 /* Special include for Qualcomm BREW environment */
43 /* #include "AEEStdLib.h" */
44 #endif
45 
46 #if !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__WATCOMC__) \
47  && !defined(__vxworks) && !defined(__SYMBIAN32__) && !defined(NIOS2)
48 #include <inttypes.h> /* does not exist in windows; use builtins instead */
49 #endif /* not windows */
50 
51 #include <limits.h>
52 
53 #include <float.h>
54 
55 #ifndef FALSE
56 #define FALSE 0
57 #define TRUE 1
58 #endif
59 
60 #define NumberOf(x) (sizeof(x)/sizeof(x[0]))
61 
62 /* This macro is for prototypes of argumentless functions. For actual
63  variables of type void, use OSVoid, defined below. This OSVOIDARG
64  macro can be #ifdef'd for compilers that don't like seeing "void"
65  in prototypes. */
66 #define OSVOIDARG void
67 
68 typedef void OSVoid;
69 typedef void* OSVoidPtr;
70 typedef unsigned char OSBOOL;
71 typedef signed char OSINT8;
72 typedef unsigned char OSUINT8;
73 typedef short OSINT16;
74 typedef unsigned short OSUINT16;
75 typedef OSUINT8 OSOCTET;
76 typedef OSUINT8 OSUTF8CHAR;
77 typedef OSUINT16 OSUNICHAR;
78 typedef double OSREAL;
79 typedef double OSDOUBLE;
80 typedef float OSFLOAT;
81 #ifdef _16BIT
82 typedef long OSINT32;
83 typedef unsigned long OSUINT32;
84 #define OSINTCONST(val) val##L
85 #define OSUINTCONST(val) val##UL
86 #else
87 typedef int OSINT32;
88 typedef unsigned int OSUINT32;
89 #define OSINTCONST(val) val
90 #define OSUINTCONST(val) val##u
91 #endif /* _16BIT */
92 typedef OSUINT32 OS32BITCHAR;
93 typedef size_t OSSIZE;
94 
95 #define OSUINT32_MAX ((OSUINT32)4294967295UL)
96 #define OSINT32_MAX ((OSINT32)2147483647L)
97 #define OSINT32_MIN ((OSINT32)(-OSINT32_MAX-1))
98 
99 #define OSUINT16_MAX ((OSUINT16)65535UL)
100 #define OSINT16_MAX ((OSINT16)32767L)
101 #define OSINT16_MIN ((OSINT16)(-OSINT16_MAX-1))
102 
103 #define OSUINT8_MAX ((OSUINT8)255U)
104 #define OSINT8_MAX ((OSINT8)127L)
105 #define OSINT8_MIN ((OSINT8)(-OSINT8_MAX-1))
106 
107 #define OSREALMAX ((OSREAL)DBL_MAX)
108 #define OSREALMIN ((OSREAL)-DBL_MAX)
109 
110 #define OSU32NULLIDX OSUINT32_MAX
111 #define OSNULLINDEX ((OSSIZE)-1)
112 #define OSSIZE_MAX OSNULLINDEX
113 
118 typedef struct OSNumDateTime {
119  OSINT32 year;
120  OSUINT8 mon; /* 1 <= mon <= 12 */
121  OSUINT8 day; /* 1 <= day <= 31 */
122  OSUINT8 hour; /* 0 <= hour <= 23 */
123  OSUINT8 min; /* 0 <= min <= 59 */
124  OSREAL sec;
125  OSBOOL tz_flag; /* is tzo explicitely set? */
126  OSINT32 tzo; /* -840 <= tzo <= 840 */
127 } OSNumDateTime;
128 
129 /* Size type print format string */
130 
131 #if defined(_MSC_VER)
132 #if _MSC_VER < 1300
133 //Visual C++ 6.0 is 32 bit only. No size specifier required.
134 #define OSSIZEFMT "%u"
135 #else
136 //Visual Studio 2003+ supports I for size_t
137 #define OSSIZEFMT "%Iu"
138 #endif
139 #elif defined(__hpux) || defined(VMS) || defined(_VMS)
140 //HP-UX and VMS use %u for size_t.
141 #define OSSIZEFMT "%u"
142 #else
143 //GNU compilers support z for size_t. It is C99 standard.
144 #define OSSIZEFMT "%zu"
145 #endif
146 
147 /* 64-bit long integer type */
148 
149 #ifndef OSINT64_
150 #if !defined(_NO_INT64_SUPPORT)
151 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
152 #define OSINT64_
153 typedef __int64 OSINT64;
154 typedef unsigned __int64 OSUINT64;
155 
156 /* OSINT64FMT_TS is the type specifier for 64-bit (signed) integers. */
157 #define OSINT64FMT_TS "I64d"
158 #define OSINT64FMT "%I64d"
159 #define OSUINT64FMT "%I64u"
160 #define OSINT64FMTX "%I64x"
161 #define OSINT64MAX _I64_MAX
162 #define OSUINT64MAX _UI64_MAX
163 #define OSINT64MIN _I64_MIN
164 #define OSI64CONST(val) val##i64
165 #define OSUI64CONST(val) val##ui64
166 
167 #elif defined(INT64_MAX) /* assume have ISO C99 standard types */
168 #define OSINT64_
169 typedef int64_t OSINT64;
170 typedef uint64_t OSUINT64;
171 #ifdef PRId64 /* have C99 format macros */
172 /* C++ 2011 requires spaces here */
173 #define OSINT64FMT_TS PRId64
174 #define OSINT64FMT "%" PRId64
175 #define OSUINT64FMT "%" PRIu64
176 #define OSINT64FMTX "%" PRIx64
177 #else /* have C99 types but not format macros, assume long long format */
178 #define OSINT64FMT_TS "lld"
179 #define OSINT64FMT "%lld"
180 #define OSUINT64FMT "%llu"
181 #define OSINT64FMTX "%llx"
182 #endif /* PRId64 */
183 #define OSINT64MAX INT64_MAX
184 #define OSUINT64MAX UINT64_MAX
185 #define OSINT64MIN INT64_MIN
186 #define OSI64CONST(val) INT64_C(val)
187 #define OSUI64CONST(val) UINT64_C(val)
188 
189 #else /* ?? __WORDSIZE != 64 */
190 #define OSINT64_
191 typedef long long OSINT64;
192 typedef unsigned long long OSUINT64;
193 #define OSINT64FMT_TS "lld"
194 #define OSINT64FMT "%lld"
195 #define OSUINT64FMT "%llu"
196 #define OSINT64FMTX "%llx"
197 #define OSI64CONST(val) val##LL
198 #define OSUI64CONST(val) val##ULL
199 
200 /* May throw an error if __STDC_LIMIT_MACROS is not defined */
201 #ifdef LLONG_MAX
202 #define OSINT64MAX LLONG_MAX
203 #define OSUINT64MAX ULLONG_MAX
204 #define OSINT64MIN LLONG_MIN
205 #elif defined LONG_LONG_MAX /* special code for gcc 3.3.3 */
206 #define OSINT64MAX LONG_LONG_MAX
207 #define OSUINT64MAX ULONG_LONG_MAX
208 #define OSINT64MIN LONG_LONG_MIN
209 #elif defined __INT64_MAX /* VMS */
210 #define OSINT64MAX __INT64_MAX
211 #define OSUINT64MAX __UINT64_MAX
212 #define OSINT64MIN __INT64_MIN
213 #else
214 #warning "Using LONG_MAX for 64-bit maximum."
215 #define OSINT64MAX LONG_MAX
216 #define OSUINT64MAX ULONG_MAX
217 #define OSINT64MIN LONG_MIN
218 #endif
219 
220 #endif /* _MSC_VER ... */
221 #endif /* !defined(_NO_INT64_SUPPORT) */
222 
223 #ifndef OSINT64_
224 /* if OSINT64 is still not defined - define it as long/unsigned long */
225 #define OSINT64_
226 typedef long OSINT64;
227 typedef unsigned long OSUINT64;
228 #define OSINT64FMT_TS "ld"
229 #define OSINT64FMT "%ld"
230 #define OSUINT64FMT "%lu"
231 #define OSINT64FMTX "%lx"
232 #define OSINT64MAX LONG_MAX
233 #define OSUINT64MAX ULONG_MAX
234 #define OSINT64MIN LONG_MIN
235 #define OSI64CONST(val) val##L
236 #define OSUI64CONST(val) val##UL
237 #endif /* OSINT64 ... */
238 
239 #define OSU64NULLIDX OSUINT64MAX
240 
241 #endif /* OSINT64 */
242 
250 typedef struct OSDynOctStr {
251  OSUINT32 numocts;
252  const OSOCTET* data;
253 } OSDynOctStr;
254 
255 typedef struct OSDynOctStr64 {
256  OSSIZE numocts;
257  OSOCTET* data;
258 } OSDynOctStr64;
259 
260 typedef OSDynOctStr OSOpenType;
261 
262 typedef OSDynOctStr64 OSOpenType64;
263 
264 /* UTF-8 name/value pair */
265 
266 typedef struct OSUTF8NVP {
267  const OSUTF8CHAR* name;
268  const OSUTF8CHAR* value;
269 } OSUTF8NVP;
270 
271 typedef OSUTF8NVP OSAnyAttr;
272 typedef OSUTF8NVP OSAnyElement;
273 
274 /* XML string */
275 
282 typedef struct OSXMLSTRING {
283  OSBOOL cdata; /* encode as a CDATA section */
284  const OSUTF8CHAR* value;
285 } OSXMLSTRING;
286 
296 
303 typedef struct OSBitMapItem {
304  const OSUTF8CHAR* name;
305  OSUINT16 bitno;
306  OSUINT16 namelen;
307 } OSBitMapItem;
308 
318 typedef struct OSUTF8NameAndLen {
319  const OSUTF8CHAR* name;
320  OSSIZE len;
322 
323 
324 typedef struct OSDecimalFmt {
325  OSINT8 totalDigits; /* total significiant digits */
326  OSINT8 fractionDigits; /* maximum signficiant digits in fraction,
327  precision */
328  OSINT8 fractionMinDigits; /* minimum digits in fraction, if
329  fraction digits less than this value
330  trailing zeros will be added. */
331  OSINT8 integerMaxDigits; /* Maximum digits in integer part; if it is 0
332  and integer part is 0 then integer part
333  will be omitted, like .3, or -.3 */
334  OSINT8 integerMinDigits; /* Minimum digits in integer part, leading zeros
335  will be added if necessary. */
336  OSBOOL signPresent; /* Indicates, sign must present, even if value
337  is positive. */
338  OSBOOL pointPresent; /* Indicates, decimal point must present, even
339  if value's fraction is 0 */
340  OSUINT8 nPatterns; /* number of patterns stored in 'patterns' */
341  const char* const* patterns; /* patterns, used to verify value format is
342  correct */
343 } OSDecimalFmt;
344 
345 
346 
347 typedef struct OSDoubleFmt {
348  OSINT8 totalDigits; /* total significiant digits */
349  OSINT8 fractionDigits; /* maximum signficiant digits in fraction,
350  precision */
351  OSINT8 fractionMinDigits; /* minimum digits in fraction, if
352  fraction digits less than this value
353  trailing zeros will be added. */
354  OSINT8 integerMaxDigits; /* Maximum digits in integer part; if it is 0
355  and integer part is 0 then integer part
356  will be omitted, like .3, or -.3 */
357  OSINT8 integerMinDigits; /* Minimum digits in integer part, leading zeros
358  will be added if necessary. */
359  OSINT8 expSymbol; /* 'E' or 'e' only; 0 if no exp is expected,
360  -1 - default ('E') */
361  OSINT16 expMinValue; /* Minimum exponent value. By default - -infinity */
362  OSINT16 expMaxValue; /* Maximum exponent value. By default - infinity */
363  OSINT8 expDigits; /* Total digits in exponent part; if exponent's
364  value is not enough, trailing zeros will be
365  added */
366  OSBOOL signPresent; /* Indicates, sign must present, even if value
367  is positive. */
368  OSBOOL pointPresent; /* Indicates, decimal point must present, even
369  if value's fraction is 0 */
370  OSBOOL expPresent; /* Indicates, exponent must present, even
371  if its value is 0 */
372  OSBOOL expSignPresent; /* Indicates, exponent sign must present, even
373  if its value is > 0 */
374 } OSDoubleFmt;
375 
376 #if defined(_MSC_VER)
377 /* this disables 'unreferenced formal parameter' warning */
378 #pragma warning(disable: 4100)
379 /* this disables 'assignment operator could not be generated' warning */
380 #pragma warning(disable: 4512)
381 #endif
382 
383 #endif
UTF-8 name and length structure.
Definition: osSysTypes.h:318
XML UTF-8 character string structure.
Definition: osSysTypes.h:282
Dynamic binary string structure.
Definition: osSysTypes.h:250
Named bit in a bit map.
Definition: osSysTypes.h:303
Numeric date/time structure.
Numeric date/time structure.
Definition: osSysTypes.h:118