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
00026
00027
00028
00029 #include <stddef.h>
00030 #include <limits.h>
00031 #include <signal.h>
00032
00033
00034
00035
00036
00037
00038
00039 #if (\
00040 (defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L)\
00041 || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250))\
00042 || defined(__GNUC__)\
00043 ) && !defined (_PSTDINT_H_INCLUDED)
00044
00045 #include <stdint.h>
00046 #define _PSTDINT_H_INCLUDED
00047 # ifndef PRINTF_INT64_MODIFIER
00048 # define PRINTF_INT64_MODIFIER "ll"
00049 # endif
00050 # ifndef PRINTF_INT32_MODIFIER
00051 # define PRINTF_INT32_MODIFIER "l"
00052 # endif
00053 # ifndef PRINTF_INT16_MODIFIER
00054 # define PRINTF_INT16_MODIFIER "h"
00055 # endif
00056 # ifndef PRINTF_INTMAX_MODIFIER
00057 # define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
00058 # endif
00059 # ifndef PRINTF_INT64_HEX_WIDTH
00060 # define PRINTF_INT64_HEX_WIDTH "16"
00061 # endif
00062 # ifndef PRINTF_INT32_HEX_WIDTH
00063 # define PRINTF_INT32_HEX_WIDTH "8"
00064 # endif
00065 # ifndef PRINTF_INT16_HEX_WIDTH
00066 # define PRINTF_INT16_HEX_WIDTH "4"
00067 # endif
00068 # ifndef PRINTF_INT8_HEX_WIDTH
00069 # define PRINTF_INT8_HEX_WIDTH "2"
00070 # endif
00071 # ifndef PRINTF_INT64_DEC_WIDTH
00072 # define PRINTF_INT64_DEC_WIDTH "20"
00073 # endif
00074 # ifndef PRINTF_INT32_DEC_WIDTH
00075 # define PRINTF_INT32_DEC_WIDTH "10"
00076 # endif
00077 # ifndef PRINTF_INT16_DEC_WIDTH
00078 # define PRINTF_INT16_DEC_WIDTH "5"
00079 # endif
00080 # ifndef PRINTF_INT8_DEC_WIDTH
00081 # define PRINTF_INT8_DEC_WIDTH "3"
00082 # endif
00083 # ifndef PRINTF_INTMAX_HEX_WIDTH
00084 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
00085 # endif
00086 # ifndef PRINTF_INTMAX_DEC_WIDTH
00087 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
00088 # endif
00089
00090
00091
00092
00093
00094
00095 # if defined (__WATCOMC__) && __WATCOMC__ >= 1250
00096 # if !defined (INT64_C)
00097 # define INT64_C(x) (x + (INT64_MAX - INT64_MAX))
00098 # endif
00099 # if !defined (UINT64_C)
00100 # define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX))
00101 # endif
00102 # if !defined (INT32_C)
00103 # define INT32_C(x) (x + (INT32_MAX - INT32_MAX))
00104 # endif
00105 # if !defined (UINT32_C)
00106 # define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX))
00107 # endif
00108 # if !defined (INT16_C)
00109 # define INT16_C(x) (x)
00110 # endif
00111 # if !defined (UINT16_C)
00112 # define UINT16_C(x) (x)
00113 # endif
00114 # if !defined (INT8_C)
00115 # define INT8_C(x) (x)
00116 # endif
00117 # if !defined (UINT8_C)
00118 # define UINT8_C(x) (x)
00119 # endif
00120 # if !defined (UINT64_MAX)
00121 # define UINT64_MAX 18446744073709551615ULL
00122 # endif
00123 # if !defined (INT64_MAX)
00124 # define INT64_MAX 9223372036854775807LL
00125 # endif
00126 # if !defined (UINT32_MAX)
00127 # define UINT32_MAX 4294967295UL
00128 # endif
00129 # if !defined (INT32_MAX)
00130 # define INT32_MAX 2147483647L
00131 # endif
00132 # if !defined (INTMAX_MAX)
00133 # define INTMAX_MAX INT64_MAX
00134 # endif
00135 # if !defined (INTMAX_MIN)
00136 # define INTMAX_MIN INT64_MIN
00137 # endif
00138 # endif
00139 #endif
00140
00141 #ifndef _PSTDINT_H_INCLUDED
00142 #define _PSTDINT_H_INCLUDED
00143
00144 #ifndef SIZE_MAX
00145 # define SIZE_MAX (~(size_t)0)
00146 #endif
00147
00148
00149
00150
00151
00152
00153
00154 #ifndef UINT8_MAX
00155 # define UINT8_MAX 0xff
00156 #endif
00157 #ifndef uint8_t
00158 # if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)
00159 typedef unsigned char uint8_t;
00160 # define UINT8_C(v) ((uint8_t) v)
00161 # else
00162 # error "Platform not supported"
00163 # endif
00164 #endif
00165
00166 #ifndef INT8_MAX
00167 # define INT8_MAX 0x7f
00168 #endif
00169 #ifndef INT8_MIN
00170 # define INT8_MIN INT8_C(0x80)
00171 #endif
00172 #ifndef int8_t
00173 # if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
00174 typedef signed char int8_t;
00175 # define INT8_C(v) ((int8_t) v)
00176 # else
00177 # error "Platform not supported"
00178 # endif
00179 #endif
00180
00181 #ifndef UINT16_MAX
00182 # define UINT16_MAX 0xffff
00183 #endif
00184 #ifndef uint16_t
00185 #if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)
00186 typedef unsigned int uint16_t;
00187 # ifndef PRINTF_INT16_MODIFIER
00188 # define PRINTF_INT16_MODIFIER ""
00189 # endif
00190 # define UINT16_C(v) ((uint16_t) (v))
00191 #elif (USHRT_MAX == UINT16_MAX)
00192 typedef unsigned short uint16_t;
00193 # define UINT16_C(v) ((uint16_t) (v))
00194 # ifndef PRINTF_INT16_MODIFIER
00195 # define PRINTF_INT16_MODIFIER "h"
00196 # endif
00197 #else
00198 #error "Platform not supported"
00199 #endif
00200 #endif
00201
00202 #ifndef INT16_MAX
00203 # define INT16_MAX 0x7fff
00204 #endif
00205 #ifndef INT16_MIN
00206 # define INT16_MIN INT16_C(0x8000)
00207 #endif
00208 #ifndef int16_t
00209 #if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)
00210 typedef signed int int16_t;
00211 # define INT16_C(v) ((int16_t) (v))
00212 # ifndef PRINTF_INT16_MODIFIER
00213 # define PRINTF_INT16_MODIFIER ""
00214 # endif
00215 #elif (SHRT_MAX == INT16_MAX)
00216 typedef signed short int16_t;
00217 # define INT16_C(v) ((int16_t) (v))
00218 # ifndef PRINTF_INT16_MODIFIER
00219 # define PRINTF_INT16_MODIFIER "h"
00220 # endif
00221 #else
00222 #error "Platform not supported"
00223 #endif
00224 #endif
00225
00226 #ifndef UINT32_MAX
00227 # define UINT32_MAX (0xffffffffUL)
00228 #endif
00229 #ifndef uint32_t
00230 #if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)
00231 typedef unsigned long uint32_t;
00232 # define UINT32_C(v) v ## UL
00233 # ifndef PRINTF_INT32_MODIFIER
00234 # define PRINTF_INT32_MODIFIER "l"
00235 # endif
00236 #elif (UINT_MAX == UINT32_MAX)
00237 typedef unsigned int uint32_t;
00238 # ifndef PRINTF_INT32_MODIFIER
00239 # define PRINTF_INT32_MODIFIER ""
00240 # endif
00241 # define UINT32_C(v) v ## U
00242 #elif (USHRT_MAX == UINT32_MAX)
00243 typedef unsigned short uint32_t;
00244 # define UINT32_C(v) ((unsigned short) (v))
00245 # ifndef PRINTF_INT32_MODIFIER
00246 # define PRINTF_INT32_MODIFIER ""
00247 # endif
00248 #else
00249 #error "Platform not supported"
00250 #endif
00251 #endif
00252
00253 #ifndef INT32_MAX
00254 # define INT32_MAX (0x7fffffffL)
00255 #endif
00256 #ifndef INT32_MIN
00257 # define INT32_MIN INT32_C(0x80000000)
00258 #endif
00259 #ifndef int32_t
00260 #if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)
00261 typedef signed long int32_t;
00262 # define INT32_C(v) v ## L
00263 # ifndef PRINTF_INT32_MODIFIER
00264 # define PRINTF_INT32_MODIFIER "l"
00265 # endif
00266 #elif (INT_MAX == INT32_MAX)
00267 typedef signed int int32_t;
00268 # define INT32_C(v) v
00269 # ifndef PRINTF_INT32_MODIFIER
00270 # define PRINTF_INT32_MODIFIER ""
00271 # endif
00272 #elif (SHRT_MAX == INT32_MAX)
00273 typedef signed short int32_t;
00274 # define INT32_C(v) ((short) (v))
00275 # ifndef PRINTF_INT32_MODIFIER
00276 # define PRINTF_INT32_MODIFIER ""
00277 # endif
00278 #else
00279 #error "Platform not supported"
00280 #endif
00281 #endif
00282
00283
00284
00285
00286
00287
00288
00289
00290 #undef stdint_int64_defined
00291 #if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)
00292 # if (__STDC__ && __STDC_VERSION >= 199901L) || defined (S_SPLINT_S)
00293 # define stdint_int64_defined
00294 typedef long long int64_t;
00295 typedef unsigned long long uint64_t;
00296 # define UINT64_C(v) v ## ULL
00297 # define INT64_C(v) v ## LL
00298 # ifndef PRINTF_INT64_MODIFIER
00299 # define PRINTF_INT64_MODIFIER "ll"
00300 # endif
00301 # endif
00302 #endif
00303
00304 #if !defined (stdint_int64_defined)
00305 # if defined(__GNUC__)
00306 # define stdint_int64_defined
00307 __extension__ typedef long long int64_t;
00308 __extension__ typedef unsigned long long uint64_t;
00309 # define UINT64_C(v) v ## ULL
00310 # define INT64_C(v) v ## LL
00311 # ifndef PRINTF_INT64_MODIFIER
00312 # define PRINTF_INT64_MODIFIER "ll"
00313 # endif
00314 # elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)
00315 # define stdint_int64_defined
00316 typedef long long int64_t;
00317 typedef unsigned long long uint64_t;
00318 # define UINT64_C(v) v ## ULL
00319 # define INT64_C(v) v ## LL
00320 # ifndef PRINTF_INT64_MODIFIER
00321 # define PRINTF_INT64_MODIFIER "ll"
00322 # endif
00323 # elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)
00324 # define stdint_int64_defined
00325 typedef __int64 int64_t;
00326 typedef unsigned __int64 uint64_t;
00327 # define UINT64_C(v) v ## UI64
00328 # define INT64_C(v) v ## I64
00329 # ifndef PRINTF_INT64_MODIFIER
00330 # define PRINTF_INT64_MODIFIER "I64"
00331 # endif
00332 # endif
00333 #endif
00334
00335 #if !defined (LONG_LONG_MAX) && defined (INT64_C)
00336 # define LONG_LONG_MAX INT64_C (9223372036854775807)
00337 #endif
00338 #ifndef ULONG_LONG_MAX
00339 # define ULONG_LONG_MAX UINT64_C (18446744073709551615)
00340 #endif
00341
00342 #if !defined (INT64_MAX) && defined (INT64_C)
00343 # define INT64_MAX INT64_C (9223372036854775807)
00344 #endif
00345 #if !defined (INT64_MIN) && defined (INT64_C)
00346 # define INT64_MIN INT64_C (-9223372036854775808)
00347 #endif
00348 #if !defined (UINT64_MAX) && defined (INT64_C)
00349 # define UINT64_MAX UINT64_C (18446744073709551615)
00350 #endif
00351
00352
00353
00354
00355
00356 #ifndef PRINTF_INT64_HEX_WIDTH
00357 # define PRINTF_INT64_HEX_WIDTH "16"
00358 #endif
00359 #ifndef PRINTF_INT32_HEX_WIDTH
00360 # define PRINTF_INT32_HEX_WIDTH "8"
00361 #endif
00362 #ifndef PRINTF_INT16_HEX_WIDTH
00363 # define PRINTF_INT16_HEX_WIDTH "4"
00364 #endif
00365 #ifndef PRINTF_INT8_HEX_WIDTH
00366 # define PRINTF_INT8_HEX_WIDTH "2"
00367 #endif
00368
00369 #ifndef PRINTF_INT64_DEC_WIDTH
00370 # define PRINTF_INT64_DEC_WIDTH "20"
00371 #endif
00372 #ifndef PRINTF_INT32_DEC_WIDTH
00373 # define PRINTF_INT32_DEC_WIDTH "10"
00374 #endif
00375 #ifndef PRINTF_INT16_DEC_WIDTH
00376 # define PRINTF_INT16_DEC_WIDTH "5"
00377 #endif
00378 #ifndef PRINTF_INT8_DEC_WIDTH
00379 # define PRINTF_INT8_DEC_WIDTH "3"
00380 #endif
00381
00382
00383
00384
00385
00386
00387
00388 #ifdef stdint_int64_defined
00389 typedef int64_t intmax_t;
00390 typedef uint64_t uintmax_t;
00391 # define INTMAX_MAX INT64_MAX
00392 # define INTMAX_MIN INT64_MIN
00393 # define UINTMAX_MAX UINT64_MAX
00394 # define UINTMAX_C(v) UINT64_C(v)
00395 # define INTMAX_C(v) INT64_C(v)
00396 # ifndef PRINTF_INTMAX_MODIFIER
00397 # define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
00398 # endif
00399 # ifndef PRINTF_INTMAX_HEX_WIDTH
00400 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
00401 # endif
00402 # ifndef PRINTF_INTMAX_DEC_WIDTH
00403 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
00404 # endif
00405 #else
00406 typedef int32_t intmax_t;
00407 typedef uint32_t uintmax_t;
00408 # define INTMAX_MAX INT32_MAX
00409 # define UINTMAX_MAX UINT32_MAX
00410 # define UINTMAX_C(v) UINT32_C(v)
00411 # define INTMAX_C(v) INT32_C(v)
00412 # ifndef PRINTF_INTMAX_MODIFIER
00413 # define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER
00414 # endif
00415 # ifndef PRINTF_INTMAX_HEX_WIDTH
00416 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH
00417 # endif
00418 # ifndef PRINTF_INTMAX_DEC_WIDTH
00419 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH
00420 # endif
00421 #endif
00422
00423
00424
00425
00426
00427
00428
00429
00430 #ifndef stdint_least_defined
00431 typedef int8_t int_least8_t;
00432 typedef uint8_t uint_least8_t;
00433 typedef int16_t int_least16_t;
00434 typedef uint16_t uint_least16_t;
00435 typedef int32_t int_least32_t;
00436 typedef uint32_t uint_least32_t;
00437 # define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER
00438 # define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER
00439 # define UINT_LEAST8_MAX UINT8_MAX
00440 # define INT_LEAST8_MAX INT8_MAX
00441 # define UINT_LEAST16_MAX UINT16_MAX
00442 # define INT_LEAST16_MAX INT16_MAX
00443 # define UINT_LEAST32_MAX UINT32_MAX
00444 # define INT_LEAST32_MAX INT32_MAX
00445 # define INT_LEAST8_MIN INT8_MIN
00446 # define INT_LEAST16_MIN INT16_MIN
00447 # define INT_LEAST32_MIN INT32_MIN
00448 # ifdef stdint_int64_defined
00449 typedef int64_t int_least64_t;
00450 typedef uint64_t uint_least64_t;
00451 # define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER
00452 # define UINT_LEAST64_MAX UINT64_MAX
00453 # define INT_LEAST64_MAX INT64_MAX
00454 # define INT_LEAST64_MIN INT64_MIN
00455 # endif
00456 #endif
00457 #undef stdint_least_defined
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470 typedef int_least8_t int_fast8_t;
00471 typedef uint_least8_t uint_fast8_t;
00472 typedef int_least16_t int_fast16_t;
00473 typedef uint_least16_t uint_fast16_t;
00474 typedef int_least32_t int_fast32_t;
00475 typedef uint_least32_t uint_fast32_t;
00476 #define UINT_FAST8_MAX UINT_LEAST8_MAX
00477 #define INT_FAST8_MAX INT_LEAST8_MAX
00478 #define UINT_FAST16_MAX UINT_LEAST16_MAX
00479 #define INT_FAST16_MAX INT_LEAST16_MAX
00480 #define UINT_FAST32_MAX UINT_LEAST32_MAX
00481 #define INT_FAST32_MAX INT_LEAST32_MAX
00482 #define INT_FAST8_MIN INT_LEAST8_MIN
00483 #define INT_FAST16_MIN INT_LEAST16_MIN
00484 #define INT_FAST32_MIN INT_LEAST32_MIN
00485 #ifdef stdint_int64_defined
00486 typedef int_least64_t int_fast64_t;
00487 typedef uint_least64_t uint_fast64_t;
00488 # define UINT_FAST64_MAX UINT_LEAST64_MAX
00489 # define INT_FAST64_MAX INT_LEAST64_MAX
00490 # define INT_FAST64_MIN INT_LEAST64_MIN
00491 #endif
00492
00493 #undef stdint_int64_defined
00494
00495
00496
00497
00498
00499
00500 #if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__)
00501 # include <wchar.h>
00502 # ifndef WCHAR_MIN
00503 # define WCHAR_MIN 0
00504 # endif
00505 # ifndef WCHAR_MAX
00506 # define WCHAR_MAX ((wchar_t)-1)
00507 # endif
00508 #endif
00509
00510
00511
00512
00513
00514
00515 #if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)
00516 # define STDINT_H_UINTPTR_T_DEFINED
00517 #endif
00518
00519 #ifndef STDINT_H_UINTPTR_T_DEFINED
00520 # if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64)
00521 # define stdint_intptr_bits 64
00522 # elif defined (__WATCOMC__) || defined (__TURBOC__)
00523 # if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
00524 # define stdint_intptr_bits 16
00525 # else
00526 # define stdint_intptr_bits 32
00527 # endif
00528 # elif defined (__i386__) || defined (_WIN32) || defined (WIN32)
00529 # define stdint_intptr_bits 32
00530 # elif defined (__INTEL_COMPILER)
00531
00532 # endif
00533
00534 # ifdef stdint_intptr_bits
00535 # define stdint_intptr_glue3_i(a,b,c) a##b##c
00536 # define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c)
00537 # ifndef PRINTF_INTPTR_MODIFIER
00538 # define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER)
00539 # endif
00540 # ifndef PTRDIFF_MAX
00541 # define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
00542 # endif
00543 # ifndef PTRDIFF_MIN
00544 # define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
00545 # endif
00546 # ifndef UINTPTR_MAX
00547 # define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX)
00548 # endif
00549 # ifndef INTPTR_MAX
00550 # define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
00551 # endif
00552 # ifndef INTPTR_MIN
00553 # define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
00554 # endif
00555 # ifndef INTPTR_C
00556 # define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x)
00557 # endif
00558 # ifndef UINTPTR_C
00559 # define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)
00560 # endif
00561 typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t)* uintptr_t;
00562 typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t)* intptr_t;
00563 # else
00564
00565
00566 typedef ptrdiff_t intptr_t;
00567 # endif
00568 # define STDINT_H_UINTPTR_T_DEFINED
00569 #endif
00570
00571
00572
00573
00574
00575 #ifndef SIG_ATOMIC_MAX
00576 # define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1)
00577 #endif
00578
00579 #endif