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_FREE_RTOS)
36 #include "psptypes-free_rtos.h"
37 #elif defined(RDM_NO_OS)
38 #include "psptypes-noos.h"
39 #endif
40 
41 #include <stddef.h>
42 #endif
43 
44 #ifndef RDM_UNREF
45 #define RDM_UNREF(a) ((void) a)
46 #endif
47 
48 #ifndef RDM_UNSET
49 #define RDM_UNSET(a) = a
50 #endif
51 
57 typedef enum
58 {
59  RDM_FALSE = 0,
60  RDM_TRUE = 1,
61  __RDM_BOOL_MAX = 0xffffffff
62 } RDM_BOOL_T;
63 
66 typedef enum
67 {
68  RDM_LT = -1,
69  RDM_EQ = 0,
70  RDM_GT = 1
71 } RDM_COMPARE;
72 
73 typedef struct RDM_ENCRYPT_S *RDM_ENCRYPT;
82 typedef enum
83 {
90 } RDM_ENC_TYPE;
91 
92 #define EXTERNAL_FCN_PTR EXTERNAL_FCN *
93 
94 #if !defined(RDM_STARTUP_HOOK)
95 
99 #define RDM_STARTUP_HOOK
100 #endif
101 #if !defined(RDM_SHUTDOWN_HOOK)
102 
106 #define RDM_SHUTDOWN_HOOK
107 #endif
108 
109 #if defined(RDM_DOXYGEN)
110 
115 #define RDM_CHAR_T RDM_CHAR_T
116 #else
117 #define RDM_CHAR_T char
118 #endif
119 
120 #if defined(_UNICODE) && defined(RDM_UNICODE)
121 #define RDM_T(text) L##text
122 #define RDM_TCHAR_T wchar_t
123 #define RDM_TSTR_FMT "%ls"
124 #else
125 
126 #define RDM_T(text) text
127 #if defined(RDM_DOXYGEN)
128 
130 #define RDM_TCHAR_T RDM_TCHAR_T
131 #else
132 #define RDM_TCHAR_T char
133 #endif
134 #define RDM_TSTR_FMT "%s"
135 #endif
136 
137 #if !defined(RDM_UNICODE)
138 #define RDM_T_FUNC(func) func
139 #else
140 #if defined(_UNICODE)
141 #define RDM_T_FUNC(func) func##W
142 #else
143 #define RDM_T_FUNC(func) func##A
144 #endif
145 #endif
146 
147 #if defined(__cplusplus)
148 extern "C" {
149 #endif
150 RDM_EXPORT int32_t psp_threadMain (
151  int32_t (*main) (int32_t argc, const char *const *argv),
152  int argc,
153  const RDM_TCHAR_T *const *argv
154  );
155 #if defined(__cplusplus)
156 }
157 #endif
158 
159 #if !defined(RDM_STARTUP_EXAMPLE)
160 
167 #define RDM_STARTUP_EXAMPLE(name) \
168  int32_t name##_main (int32_t argc, const RDM_TCHAR_T *const *argv); \
169  int main (int argc, const RDM_TCHAR_T *const *argv) \
170  { \
171  int32_t status; \
172  \
173  RDM_STARTUP_HOOK \
174  status = psp_threadMain (name##_main, argc, argv); \
175  RDM_SHUTDOWN_HOOK \
176  return status; \
177  }
178 #endif
179 
180 #if !defined(RDM_DOXYGEN)
181 #if !defined(RDM_STARTUP_TEST)
182 #define RDM_STARTUP_TEST(name) \
183  int32_t name##_main (int32_t argc, const char *const *argv); \
184  int main (int argc, const char *const *argv) \
185  { \
186  int32_t status; \
187  \
188  RDM_STARTUP_HOOK \
189  status = psp_threadMain (name##_main, argc, argv); \
190  RDM_SHUTDOWN_HOOK \
191  return status; \
192  }
193 #endif
194 #endif
195 
198 #define RDM_LEN(x) (sizeof (x) / sizeof (x[0]))
199 
200 #if defined(NDEBUG) || defined(RDM_NO_ASSERT)
201 #define RDM_ASSERT(x)
202 #elif defined(RDM_ASSERT_INFINITE_LOOP)
203 #define RDM_ASSERT(x) \
204  { \
205  if (!(x)) \
206  { \
207  int asserted = 1; \
208  while (asserted) \
209  ; \
210  } \
211  }
212 #define RDM_ASSERT_ENABLED
213 #else
214 #include <assert.h>
216 #define RDM_ASSERT(x) assert (x)
217 #define RDM_ASSERT_ENABLED
218 #endif
219 
220 #if defined(RDM_ASSERT_ENABLED)
221 #define RDM_EVAL_ASSERT(x, y) RDM_ASSERT (x == y)
222 #else
223 
225 #define RDM_EVAL_ASSERT(x, y) x
226 #endif
227 
229 #define RDM_MIN(a, b) ((a) < (b) ? (a) : (b))
230 
231 #define RDM_MAX(a, b) ((a) > (b) ? (a) : (b))
232 
234 #define RDM_INT8_MIN ((int8_t) 0x80U)
235 
236 #define RDM_INT8_MAX ((int8_t) 0x7FU)
237 
238 #define RDM_UINT8_MAX ((uint8_t) 0xFFU)
239 
240 #define RDM_INT16_MIN ((int16_t) 0x8000U)
241 
242 #define RDM_INT16_MAX ((int16_t) 0x7FFFU)
243 
244 #define RDM_UINT16_MAX ((uint16_t) 0xFFFFU)
245 
246 #define RDM_INT32_MIN ((int32_t) 0x80000000U)
247 
248 #define RDM_INT32_MAX ((int32_t) 0x7FFFFFFFU)
249 
250 #define RDM_UINT32_MAX ((uint32_t) 0xFFFFFFFFU)
251 
252 #define RDM_INT64_MIN (-9223372036854775807LL - 1)
253 
254 #define RDM_INT64_MAX (9223372036854775807LL)
255 
256 #define RDM_UINT64_MAX (18446744073709551615ULL)
257 
259 #define RDM_INT64_FMT RDM_T ("%") RDM_64BIT_CODE RDM_T ("d")
260 
261 #define RDM_UINT64_FMT RDM_T ("%") RDM_64BIT_CODE RDM_T ("u")
262 
263 #define RDM_INT64_FMT_HEX RDM_T ("%") RDM_64BIT_CODE RDM_T ("X")
264 
265 #define RDM_UINT64_FMT_HEX RDM_T ("%") RDM_64BIT_CODE RDM_T ("X")
266 
267 #define RDM_INT64_FMT_SIZE(size) RDM_T ("%") #size RDM_64BIT_CODE RDM_T ("d")
268 
269 #define RDM_UINT64_FMT_SIZE(size) RDM_T ("%") #size RDM_64BIT_CODE RDM_T ("u")
270 
271 #define RDM_INT64_FMT_SIZE_HEX(size) \
272  RDM_T ("%") #size RDM_64BIT_CODE RDM_T ("X")
273 
274 #define RDM_UINT64_FMT_SIZE_HEX(size) \
275  RDM_T ("%") #size RDM_64BIT_CODE RDM_T ("X")
276 
277 #if !defined(RDM_DOXYGEN)
278 #define RDM_INT64_FMT_A "%" RDM_64BIT_CODE_A "d"
279 #define RDM_UINT64_FMT_A "%" RDM_64BIT_CODE_A "u"
280 #define RDM_INT64_FMT_HEX_A "%" RDM_64BIT_CODE_A "X"
281 #define RDM_UINT64_FMT_HEX_A "%" RDM_64BIT_CODE_A "X"
282 #define RDM_INT64_FMT_SIZE_A(size) "%" #size RDM_64BIT_CODE_A "d"
283 #define RDM_UINT64_FMT_SIZE_A(size) "%" #size RDM_64BIT_CODE_A "u"
284 #define RDM_INT64_FMT_SIZE_HEX_A(size) "%" #size RDM_64BIT_CODE_A "X"
285 #define RDM_UINT64_FMT_SIZE_HEX_A(size) "%" #size RDM_64BIT_CODE_A "X"
286 #endif
287 
288 /* Two levels of macros are needed to stringify the result of expansion
289  * of a macro argumen */
290 #define RDM_STRINGIFY_(data) #data
291 #define RDM_STRINGIFY(data) RDM_STRINGIFY_ (data)
292 
293 #if !defined(RDM_BYTES_PER_UTF8_CHAR)
294 #define RDM_BYTES_PER_UTF8_CHAR 4
295 #else
296 #if RDM_BYTES_PER_UTF8_CHAR < 1 || RDM_BYTES_PER_UTF8_CHAR > 4
297 #error "RDM_BYTES_PER_UTF8_CHAR must be between 1 and 4 (inclusive)"
298 #endif
299 #endif
300 
301 #define RDM_BYTES_PER_UTF8_CHAR_OPTION \
302  ("bytes_per_utf8_char=" RDM_STRINGIFY (RDM_BYTES_PER_UTF8_CHAR))
303 #define RDM_BYTES_PER_UTF8_CHAR_OPTION_VALUE \
304  RDM_STRINGIFY (RDM_BYTES_PER_UTF8_CHAR)
305 
306 #endif /* PSPTYPES_H_INCLUDED_ */
Header for the Platform Support Package - Platform dependent types for INTEGRITY. ...
RDM_BOOL_T
Definition: psptypes.h:57
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:66
Header for the Platform Support Package - Main defines for the ABI.
int32_t psp_threadMain(int32_t(*main)(int32_t argc, const char *const *argv), int argc, const RDM_TCHAR_T *const *argv)
Header for the Platform Support Package - Platform dependent types for no operating systems...
Header for the Platform Support Package - Platform dependent types for Windows.
RDM_ENC_TYPE
Definition: psptypes.h:82
Header for the Platform Support Package - Platform dependent types for Unix.
#define RDM_TCHAR_T
Definition: psptypes.h:130
struct RDM_ENCRYPT_S * RDM_ENCRYPT
Definition: psptypes.h:73
Header for the Platform Support Package - PC-Lint.