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