00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __PTYPES_H
00021 #define __PTYPES_H
00022
00023
00024
00025 #include <string.h>
00026 #include <ctype.h>
00027 #include "limits.h"
00028 #include "PortPrefix.h"
00029
00030 #ifndef MAX
00031 #define MAX(A,B) ((A)>(B)?(A):(B))
00032 #endif
00033 #ifndef MIN
00034 #define MIN(A,B) ((A)<(B)?(A):(B))
00035 #endif
00036
00037
00041 typedef enum ESR_BOOL
00042 {
00043 ESR_FALSE = 0,
00044 ESR_TRUE = 1
00045 } ESR_BOOL;
00046
00053 #ifdef _WIN32
00054
00055 #pragma warning (disable: 4100 4127)
00056 #pragma warning (error: 4133 4020)
00057
00058 #ifndef WIN32_LEAN_AND_MEAN
00059 #define WIN32_LEAN_AND_MEAN
00060 #endif
00061 #include <windows.h>
00062
00066 typedef unsigned int asr_uint32_t;
00067
00071 typedef int asr_int32_t;
00072
00076 typedef unsigned short asr_uint16_t;
00077
00081 typedef short asr_int16_t;
00082
00086 typedef unsigned char asr_uint8_t;
00087
00091 typedef signed char asr_int8_t;
00092
00093 #else
00094
00095
00099 typedef unsigned int asr_uint32_t;
00100
00104 typedef int asr_int32_t;
00105
00109 typedef unsigned short asr_uint16_t;
00110
00114 typedef short asr_int16_t;
00115
00119 typedef unsigned char asr_uint8_t;
00120
00124 typedef signed char asr_int8_t;
00125
00127
00128
00129
00131
00132
00133
00134
00135
00136 #ifdef _solaris_
00137 #include <sys/int_types.h>
00138 #elif defined(_decunix_)
00139 #include <inttypes.h>
00140 #elif defined(POSIX)
00141
00142 #include <time.h>
00143 #include <errno.h>
00144
00145 #if (CPU != SIMNT)
00146 typedef void * HANDLE;
00147 #endif
00148
00149 #if defined(__vxworks)
00150 #include <sys/times.h>
00151 #include <types.h>
00152
00153 #define OS_NO_RECURSIVE_MUTEX_SUPPORT
00154 #elif defined(_QNX_)
00155 #include <sys/time.h>
00156 #include <inttypes.h>
00157 #elif (OS == OS_UNIX)
00158 #include <string.h>
00159 #include <pthread.h>
00160 #else
00161 #error "New OS support here"
00162 #endif
00163
00164 #ifndef _POSIX_SOURCE
00165 #define _POSIX_SOURCE
00166 #endif
00167
00168
00169 #ifndef _POSIX_C_SOURCE
00170 #define _POSIX_C_SOURCE 199309
00171 #endif
00172
00173 #include <unistd.h>
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185 #else
00186
00187 #endif
00188 #endif
00189
00193 #define UINT16_TMIN 0
00194
00198 #define UINT16_TMAX 65535
00199
00200
00201
00202
00203
00204 #ifndef USE_NARROW_CHAR
00205 #define USE_NARROW_CHAR
00206 #endif
00207
00208 #ifdef USE_NARROW_CHAR
00209
00212 typedef char LCHAR;
00213
00217 typedef int LINT;
00218
00222 #define L(x) x
00223
00227 #define LSTRCAT strcat
00228
00232 #define LSTRCHR strchr
00233
00237 #define LSTRRCHR strrchr
00238
00242 #define LSTRCMP strcmp
00243
00247 #define LSTRNCMP strncmp
00248
00252 #define LSTRCPY strcpy
00253
00257 #define LSTRFTIME strftime
00258
00262 #define LSTRLEN strlen
00263
00267 #define LSTRNCPY strncpy
00268
00272 #define LMEMMOVE memmove
00273
00277 #define LSTRSTR strstr
00278
00282 #define LSTRLWR lstrlwr
00283
00287 #define LSTRUPR lstrupr
00288
00292 #define LSTRTOD strtod
00293
00297 #define LSTRTOL strtol
00298
00302 #define LSTRTOUL strtoul
00303
00307 #define LISSPACE(c) isspace((unsigned char) c)
00308
00312 #define LSTRCSPN strcspn
00313
00317 #define LISALPHA isalpha
00318
00322 #define LISALNUM isalnum
00323
00327 #define LISDIGIT isdigit
00328
00332 #define LSTRTOK strtok
00333
00337 #define LGETENV getenv
00338
00342 #define LTOUPPER toupper
00343
00347 #define LTOLOWER tolower
00348
00352 #define LPRINTF printf
00353
00356 #define LFPRINTF fprintf
00357
00360 #define LSPRINTF sprintf
00361
00365 #define psprintf sprintf
00366
00370 #define pvsprintf vsprintf
00371
00372 #else
00373
00374 #include <wchar.h>
00375 typedef wchar_t LCHAR;
00379 typedef wint_t LINT;
00380 #define L(x) L ## x
00381 #define LSTRCAT wcscat
00382 #define LSTRCHR wcschr
00383 #define LSTRRCHR wcsrchr
00384 #define LSTRCMP wcscmp
00385 #define LSTRNCMP wcsncmp
00386 #define LSTRCPY wcscpy
00387 #define LSTRFTIME wcsftime
00388
00389 #define LPRINTF wprintf
00390 #define LFPRINTF fwprintf
00391 #define LSPRINTF swprintf
00392
00393 #ifdef _WIN32
00394
00398 #define LGETENV wgetenv
00399
00403 #define LSTRLWR _wcslwr
00404
00408 #define LSTRTOK wcstok
00409
00413 #define LSTRUPR _wcsupr
00414 #else
00415 #define LSTRCASECMP wcscasecmp
00416 #define LSTRLWR #error LSTRLWR not defined.
00417 #define LSTRUPR #error LSTRUPR not defined.
00418 #endif
00419
00420 #define LSTRLEN wcslen
00421 #define LSTRNCPY wcsncpy
00422 #define LMEMMOVE wmemmove
00423 #define LSTRSTR wcsstr
00424 #define LSTRTOD wcstod
00425 #define LSTRTOL wcstol
00426 #define LSTRTOUL wcstoul
00427 #define LISSPACE iswspace
00428 #define LSTRCSPN wcscspn
00429 #define LISALPHA iswalpha
00430 #define LISALNUM iswalnum
00431 #define LISDIGIT iswdigit
00432
00436 #define LTOUPPER towupper
00437
00441 #define LTOLOWER towlower
00442
00446 #define psprintf sprintf
00447
00451 #define pvsprintf vsprintf
00452
00453 #endif
00454
00458 #define LOG_10_2 (0.30102999566398)
00459
00460
00466 #define MAX_UINT_DIGITS ((size_t) ((CHAR_BIT * sizeof(int) * LOG_10_2) + 1))
00467
00472 #define MAX_INT_DIGITS ((size_t) (MAX_UINT_DIGITS + 1))
00473
00480 PORTABLE_API ESR_BOOL isNumber(const LCHAR* text);
00481
00487 #include "ESR_ReturnCode.h"
00488
00489
00490 #include "pstdio.h"
00491
00492 #endif
00493
00494