Products Support Documentation Download
psptypes.h
Go to the documentation of this file.
1 /*
2  * Raima Database Manager
3  *
4  * Copyright (C) 2016 Raims Inc., All rights reserved.
5  *
6  * Use of this software, whether in source code format, or in executable,
7  * binary object code form, is governed by the Raima LICENSE which
8  * is fully described in the LICENSE.TXT file, included within this
9  * distribution of files.
10  */
11 
15 #if !defined(PSPTYPES_H_INCLUDED_)
16 #define PSPTYPES_H_INCLUDED_
17 
18 #include "pspplat.h"
19 
20 #if defined(_lint)
21 #include "psptypes-lint.h"
22 #endif
23 
24 #if defined(RDM_DOXYGEN)
25 #include "psptypes-doxygen.h"
26 #else
27 #if defined(RDM_WINDOWS)
28 #include "psptypes-win.h"
29 #elif defined(RDM_VXWORKS)
30 #include "psptypes-vxworks.h"
31 #elif defined(RDM_INTEGRITY)
32 #include "psptypes-integrity.h"
33 #elif defined(RDM_UNIX)
34 #include "psptypes-unix.h"
35 #elif defined(RDM_NO_OS)
36 #include "psptypes-noos.h"
37 #endif
38 
39 #include <stddef.h>
40 #include <stdio.h>
41 #include <stdlib.h>
42 #include <stdarg.h>
43 #include <string.h>
44 #include <limits.h>
45 #include <ctype.h>
46 #include <setjmp.h>
47 #endif
48 
49 #ifndef RDM_UNREF
50 #define RDM_UNREF(a) ((void) a)
51 #endif
52 
53 #ifndef RDM_UNSET
54 #define RDM_UNSET(a) = a
55 #endif
56 
62 typedef enum
63 {
64  RDM_FALSE = 0,
65  RDM_TRUE = 1
66 } RDM_BOOL_T;
67 
70 typedef enum
71 {
72  RDM_LT = -1,
73  RDM_EQ = 0,
74  RDM_GT = 1
75 } RDM_COMPARE;
76 
77 typedef struct RDM_ENCRYPT_S *RDM_ENCRYPT;
86 typedef enum
87 {
94 } RDM_ENC_TYPE;
95 
96 #define EXTERNAL_FCN_PTR EXTERNAL_FCN *
97 
98 #if !defined(RDM_STARTUP_HOOK)
99 
103 #define RDM_STARTUP_HOOK
104 #endif
105 #if !defined(RDM_SHUTDOWN_HOOK)
106 
110 #define RDM_SHUTDOWN_HOOK
111 #endif
112 
113 #if defined(RDM_DOXYGEN)
114 
119 #define RDM_CHAR_T RDM_CHAR_T
120 #else
121 #define RDM_CHAR_T char
122 #endif
123 
124 #if defined(_UNICODE) && defined(RDM_UNICODE)
125 #define RDM_T(text) L##text
126 #define RDM_TCHAR_T wchar_t
127 #define RDM_TSTR_FMT "%ls"
128 #else
129 
130 #define RDM_T(text) text
131 #if defined(RDM_DOXYGEN)
132 
134 #define RDM_TCHAR_T RDM_TCHAR_T
135 #else
136 #define RDM_TCHAR_T char
137 #endif
138 #define RDM_TSTR_FMT "%s"
139 #endif
140 
141 #if !defined(RDM_UNICODE)
142 #define RDM_T_FUNC(func) func
143 #else
144 #if defined(_UNICODE)
145 #define RDM_T_FUNC(func) func##W
146 #else
147 #define RDM_T_FUNC(func) func##A
148 #endif
149 #endif
150 
151 #if !defined(RDM_STARTUP_EXAMPLE)
152 
159 #define RDM_STARTUP_EXAMPLE(name) \
160  int32_t name##_main (int32_t argc, const RDM_TCHAR_T *const *argv); \
161  int main (int argc, const RDM_TCHAR_T *const *argv) \
162  { \
163  int32_t status; \
164  \
165  RDM_STARTUP_HOOK \
166  status = name##_main (argc, argv); \
167  RDM_SHUTDOWN_HOOK \
168  return status; \
169  }
170 #endif
171 
172 #if !defined(RDM_DOXYGEN)
173 #if !defined(RDM_STARTUP_TEST)
174 #define RDM_STARTUP_TEST(name) \
175  int32_t name##_main (int32_t argc, const char *const *argv); \
176  int main (int argc, const char *const *argv) \
177  { \
178  int32_t status; \
179  \
180  RDM_STARTUP_HOOK \
181  status = name##_main (argc, argv); \
182  RDM_SHUTDOWN_HOOK \
183  return status; \
184  }
185 #endif
186 #endif
187 
190 #define RDM_LEN(x) (sizeof (x) / sizeof (x[0]))
191 
192 #if defined(NDEBUG) || defined(RDM_NO_ASSERT)
193 #define RDM_ASSERT(x)
194 #elif defined(RDM_ASSERT_INFINITE_LOOP)
195 #define RDM_ASSERT(x) \
196  { \
197  if (!(x)) \
198  { \
199  int asserted = 1; \
200  while (asserted) \
201  ; \
202  } \
203  }
204 #define RDM_ASSERT_ENABLED
205 #else
206 #include <assert.h>
208 #define RDM_ASSERT(x) assert (x)
209 #define RDM_ASSERT_ENABLED
210 #endif
211 
212 #if defined(RDM_ASSERT_ENABLED)
213 #define RDM_EVAL_ASSERT(x, y) RDM_ASSERT (x == y)
214 #else
215 
217 #define RDM_EVAL_ASSERT(x, y) x
218 #endif
219 
221 #define RDM_MIN(a, b) ((a) < (b) ? (a) : (b))
222 
223 #define RDM_MAX(a, b) ((a) > (b) ? (a) : (b))
224 
226 #define RDM_INT8_MIN ((int8_t) 0x80U)
227 
228 #define RDM_INT8_MAX ((int8_t) 0x7FU)
229 
230 #define RDM_UINT8_MAX ((uint8_t) 0xFFU)
231 
232 #define RDM_INT16_MIN ((int16_t) 0x8000U)
233 
234 #define RDM_INT16_MAX ((int16_t) 0x7FFFU)
235 
236 #define RDM_UINT16_MAX ((uint16_t) 0xFFFFU)
237 
238 #define RDM_INT32_MIN ((int32_t) 0x80000000U)
239 
240 #define RDM_INT32_MAX ((int32_t) 0x7FFFFFFFU)
241 
242 #define RDM_UINT32_MAX ((uint32_t) 0xFFFFFFFFU)
243 
244 #define RDM_INT64_MIN (-9223372036854775807LL - 1)
245 
246 #define RDM_INT64_MAX (9223372036854775807LL)
247 
248 #define RDM_UINT64_MAX (18446744073709551615ULL)
249 
251 #define RDM_INT64_FMT RDM_T ("%") RDM_64BIT_CODE RDM_T ("d")
252 
253 #define RDM_UINT64_FMT RDM_T ("%") RDM_64BIT_CODE RDM_T ("u")
254 
255 #define RDM_INT64_FMT_HEX RDM_T ("%") RDM_64BIT_CODE RDM_T ("X")
256 
257 #define RDM_UINT64_FMT_HEX RDM_T ("%") RDM_64BIT_CODE RDM_T ("X")
258 
259 #define RDM_INT64_FMT_SIZE(size) RDM_T ("%") #size RDM_64BIT_CODE RDM_T ("d")
260 
261 #define RDM_UINT64_FMT_SIZE(size) RDM_T ("%") #size RDM_64BIT_CODE RDM_T ("u")
262 
263 #define RDM_INT64_FMT_SIZE_HEX(size) \
264  RDM_T ("%") #size RDM_64BIT_CODE RDM_T ("X")
265 
266 #define RDM_UINT64_FMT_SIZE_HEX(size) \
267  RDM_T ("%") #size RDM_64BIT_CODE RDM_T ("X")
268 
269 #if !defined(RDM_DOXYGEN)
270 #define RDM_INT64_FMT_A "%" RDM_64BIT_CODE_A "d"
271 #define RDM_UINT64_FMT_A "%" RDM_64BIT_CODE_A "u"
272 #define RDM_INT64_FMT_HEX_A "%" RDM_64BIT_CODE_A "X"
273 #define RDM_UINT64_FMT_HEX_A "%" RDM_64BIT_CODE_A "X"
274 #define RDM_INT64_FMT_SIZE_A(size) "%" #size RDM_64BIT_CODE_A "d"
275 #define RDM_UINT64_FMT_SIZE_A(size) "%" #size RDM_64BIT_CODE_A "u"
276 #define RDM_INT64_FMT_SIZE_HEX_A(size) "%" #size RDM_64BIT_CODE_A "X"
277 #define RDM_UINT64_FMT_SIZE_HEX_A(size) "%" #size RDM_64BIT_CODE_A "X"
278 #endif
279 
280 /* Two levels of macros are needed to stringify the result of expansion
281  * of a macro argumen */
282 #define RDM_STRINGIFY_(data) #data
283 #define RDM_STRINGIFY(data) RDM_STRINGIFY_ (data)
284 
285 #if !defined(RDM_BYTES_PER_UTF8_CHAR)
286 #define RDM_BYTES_PER_UTF8_CHAR 4
287 #else
288 #if RDM_BYTES_PER_UTF8_CHAR < 1 || RDM_BYTES_PER_UTF8_CHAR > 4
289 #error "RDM_BYTES_PER_UTF8_CHAR must be between 1 and 4 (inclusive)"
290 #endif
291 #endif
292 
293 #define RDM_BYTES_PER_UTF8_CHAR_OPTION \
294  ("bytes_per_utf8_char=" RDM_STRINGIFY (RDM_BYTES_PER_UTF8_CHAR))
295 #define RDM_BYTES_PER_UTF8_CHAR_OPTION_VALUE \
296  RDM_STRINGIFY (RDM_BYTES_PER_UTF8_CHAR)
297 
298 #endif /* PSPTYPES_H_INCLUDED_ */
Header for the Platform Support Package - Platform dependent types for INTEGRITY. ...
RDM_BOOL_T
Definition: psptypes.h:62
Header for the Platform Support Package - Platform dependent types for no operating systems...
Header for the Platform Support Package - Platform dependent types for VxWorks.
Header for the Platform Support Package - Platform dependent types used by Doxygen instead of the pla...
RDM_COMPARE
Definition: psptypes.h:70
Header for the Platform Support Package - Main defines for the ABI.
Header for the Platform Support Package - Platform dependent types for Windows.
RDM_ENC_TYPE
Definition: psptypes.h:86
Header for the Platform Support Package - Platform dependent types for Unix.
struct RDM_ENCRYPT_S * RDM_ENCRYPT
Definition: psptypes.h:77
Header for the Platform Support Package - PC-Lint.