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 #if (defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && __WATCOMC__ >= 1250) || (defined(__GNUC__) && __GNUC__ > 2)
00194 #include <stdint.h>
00195 #endif
00196
00197 #if (defined (_STDINT_H_INCLUDED) || defined (_STDINT_H) || defined (_STDINT_H_)) && !defined (_PSTDINT_H_INCLUDED)
00198 #define _PSTDINT_H_INCLUDED
00199 # ifndef PRINTF_INT64_MODIFIER
00200 # if __WORDSIZE == 64
00201 # define PRINTF_INT64_MODIFIER "l"
00202 # else
00203 # define PRINTF_INT64_MODIFIER "ll"
00204 # endif
00205 # endif
00206 # ifndef PRINTF_INT32_MODIFIER
00207 # if (LONG_MAX == INT32_MAX)
00208 # define PRINTF_INT32_MODIFIER "l"
00209 # else
00210 # define PRINTF_INT32_MODIFIER ""
00211 # endif
00212 # endif
00213 # ifndef PRINTF_INT16_MODIFIER
00214 # define PRINTF_INT16_MODIFIER "h"
00215 # endif
00216 # ifndef PRINTF_INTMAX_MODIFIER
00217 # define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
00218 # endif
00219 # ifndef PRINTF_INT64_HEX_WIDTH
00220 # define PRINTF_INT64_HEX_WIDTH "16"
00221 # endif
00222 # ifndef PRINTF_INT32_HEX_WIDTH
00223 # define PRINTF_INT32_HEX_WIDTH "8"
00224 # endif
00225 # ifndef PRINTF_INT16_HEX_WIDTH
00226 # define PRINTF_INT16_HEX_WIDTH "4"
00227 # endif
00228 # ifndef PRINTF_INT8_HEX_WIDTH
00229 # define PRINTF_INT8_HEX_WIDTH "2"
00230 # endif
00231 # ifndef PRINTF_INT64_DEC_WIDTH
00232 # define PRINTF_INT64_DEC_WIDTH "20"
00233 # endif
00234 # ifndef PRINTF_INT32_DEC_WIDTH
00235 # define PRINTF_INT32_DEC_WIDTH "10"
00236 # endif
00237 # ifndef PRINTF_INT16_DEC_WIDTH
00238 # define PRINTF_INT16_DEC_WIDTH "5"
00239 # endif
00240 # ifndef PRINTF_INT8_DEC_WIDTH
00241 # define PRINTF_INT8_DEC_WIDTH "3"
00242 # endif
00243 # ifndef PRINTF_INTMAX_HEX_WIDTH
00244 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
00245 # endif
00246 # ifndef PRINTF_INTMAX_DEC_WIDTH
00247 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
00248 # endif
00249
00250
00251
00252
00253
00254
00255 # if defined (__WATCOMC__) && __WATCOMC__ >= 1250
00256 # if !defined (INT64_C)
00257 # define INT64_C(x) (x + (INT64_MAX - INT64_MAX))
00258 # endif
00259 # if !defined (UINT64_C)
00260 # define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX))
00261 # endif
00262 # if !defined (INT32_C)
00263 # define INT32_C(x) (x + (INT32_MAX - INT32_MAX))
00264 # endif
00265 # if !defined (UINT32_C)
00266 # define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX))
00267 # endif
00268 # if !defined (INT16_C)
00269 # define INT16_C(x) (x)
00270 # endif
00271 # if !defined (UINT16_C)
00272 # define UINT16_C(x) (x)
00273 # endif
00274 # if !defined (INT8_C)
00275 # define INT8_C(x) (x)
00276 # endif
00277 # if !defined (UINT8_C)
00278 # define UINT8_C(x) (x)
00279 # endif
00280 # if !defined (UINT64_MAX)
00281 # define UINT64_MAX 18446744073709551615ULL
00282 # endif
00283 # if !defined (INT64_MAX)
00284 # define INT64_MAX 9223372036854775807LL
00285 # endif
00286 # if !defined (UINT32_MAX)
00287 # define UINT32_MAX 4294967295UL
00288 # endif
00289 # if !defined (INT32_MAX)
00290 # define INT32_MAX 2147483647L
00291 # endif
00292 # if !defined (INTMAX_MAX)
00293 # define INTMAX_MAX INT64_MAX
00294 # endif
00295 # if !defined (INTMAX_MIN)
00296 # define INTMAX_MIN INT64_MIN
00297 # endif
00298 # endif
00299 #endif
00300
00301 #ifndef _PSTDINT_H_INCLUDED
00302 #define _PSTDINT_H_INCLUDED
00303
00304 #ifndef SIZE_MAX
00305 # define SIZE_MAX (~(size_t)0)
00306 #endif
00307
00308
00309
00310
00311
00312
00313
00314 #ifndef UINT8_MAX
00315 # define UINT8_MAX 0xff
00316 #endif
00317 #ifndef uint8_t
00318 # if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S)
00319 typedef unsigned char uint8_t;
00320 # define UINT8_C(v) ((uint8_t) v)
00321 # else
00322 # error "Platform not supported"
00323 # endif
00324 #endif
00325
00326 #ifndef INT8_MAX
00327 # define INT8_MAX 0x7f
00328 #endif
00329 #ifndef INT8_MIN
00330 # define INT8_MIN INT8_C(0x80)
00331 #endif
00332 #ifndef int8_t
00333 # if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S)
00334 typedef signed char int8_t;
00335 # define INT8_C(v) ((int8_t) v)
00336 # else
00337 # error "Platform not supported"
00338 # endif
00339 #endif
00340
00341 #ifndef UINT16_MAX
00342 # define UINT16_MAX 0xffff
00343 #endif
00344 #ifndef uint16_t
00345 #if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S)
00346 typedef unsigned int uint16_t;
00347 # ifndef PRINTF_INT16_MODIFIER
00348 # define PRINTF_INT16_MODIFIER ""
00349 # endif
00350 # define UINT16_C(v) ((uint16_t) (v))
00351 #elif (USHRT_MAX == UINT16_MAX)
00352 typedef unsigned short uint16_t;
00353 # define UINT16_C(v) ((uint16_t) (v))
00354 # ifndef PRINTF_INT16_MODIFIER
00355 # define PRINTF_INT16_MODIFIER "h"
00356 # endif
00357 #else
00358 #error "Platform not supported"
00359 #endif
00360 #endif
00361
00362 #ifndef INT16_MAX
00363 # define INT16_MAX 0x7fff
00364 #endif
00365 #ifndef INT16_MIN
00366 # define INT16_MIN INT16_C(0x8000)
00367 #endif
00368 #ifndef int16_t
00369 #if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S)
00370 typedef signed int int16_t;
00371 # define INT16_C(v) ((int16_t) (v))
00372 # ifndef PRINTF_INT16_MODIFIER
00373 # define PRINTF_INT16_MODIFIER ""
00374 # endif
00375 #elif (SHRT_MAX == INT16_MAX)
00376 typedef signed short int16_t;
00377 # define INT16_C(v) ((int16_t) (v))
00378 # ifndef PRINTF_INT16_MODIFIER
00379 # define PRINTF_INT16_MODIFIER "h"
00380 # endif
00381 #else
00382 #error "Platform not supported"
00383 #endif
00384 #endif
00385
00386 #ifndef UINT32_MAX
00387 # define UINT32_MAX (0xffffffffUL)
00388 #endif
00389 #ifndef uint32_t
00390 #if (UINT_MAX == UINT32_MAX) && defined (__GNUC__) && (__GNUC__ > 3)
00391 typedef unsigned int uint32_t;
00392 # ifndef PRINTF_INT32_MODIFIER
00393 # define PRINTF_INT32_MODIFIER ""
00394 # endif
00395 #elif (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S)
00396 typedef unsigned long uint32_t;
00397 # define UINT32_C(v) v ## UL
00398 # ifndef PRINTF_INT32_MODIFIER
00399 # define PRINTF_INT32_MODIFIER "l"
00400 # endif
00401 #elif (UINT_MAX == UINT32_MAX)
00402 typedef unsigned int uint32_t;
00403 # ifndef PRINTF_INT32_MODIFIER
00404 # define PRINTF_INT32_MODIFIER ""
00405 # endif
00406 # define UINT32_C(v) v ## U
00407 #elif (USHRT_MAX == UINT32_MAX)
00408 typedef unsigned short uint32_t;
00409 # define UINT32_C(v) ((unsigned short) (v))
00410 # ifndef PRINTF_INT32_MODIFIER
00411 # define PRINTF_INT32_MODIFIER ""
00412 # endif
00413 #else
00414 #error "Platform not supported"
00415 #endif
00416 #endif
00417
00418 #ifndef INT32_MAX
00419 # define INT32_MAX (0x7fffffffL)
00420 #endif
00421 #ifndef INT32_MIN
00422 # define INT32_MIN INT32_C(0x80000000)
00423 #endif
00424 #ifndef int32_t
00425 #if (INT_MAX == INT32_MAX) && defined (__GNUC__) && (__GNUC__ > 3)
00426 typedef signed int int32_t;
00427 # define INT32_C(v) v
00428 # ifndef PRINTF_INT32_MODIFIER
00429 # define PRINTF_INT32_MODIFIER ""
00430 # endif
00431 #elif (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S)
00432 typedef signed long int32_t;
00433 # define INT32_C(v) v ## L
00434 # ifndef PRINTF_INT32_MODIFIER
00435 # define PRINTF_INT32_MODIFIER "l"
00436 # endif
00437 #elif (INT_MAX == INT32_MAX)
00438 typedef signed int int32_t;
00439 # define INT32_C(v) v
00440 # ifndef PRINTF_INT32_MODIFIER
00441 # define PRINTF_INT32_MODIFIER ""
00442 # endif
00443 #elif (SHRT_MAX == INT32_MAX)
00444 typedef signed short int32_t;
00445 # define INT32_C(v) ((short) (v))
00446 # ifndef PRINTF_INT32_MODIFIER
00447 # define PRINTF_INT32_MODIFIER ""
00448 # endif
00449 #else
00450 #error "Platform not supported"
00451 #endif
00452 #endif
00453
00454
00455
00456
00457
00458
00459
00460
00461 #undef stdint_int64_defined
00462 #if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S)
00463 # if (__STDC__ && __STDC_VERSION >= 199901L) || defined (S_SPLINT_S)
00464 # define stdint_int64_defined
00465 typedef long long int64_t;
00466 typedef unsigned long long uint64_t;
00467 # define UINT64_C(v) v ## ULL
00468 # define INT64_C(v) v ## LL
00469 # ifndef PRINTF_INT64_MODIFIER
00470 # define PRINTF_INT64_MODIFIER "ll"
00471 # endif
00472 # endif
00473 #endif
00474
00475 #if !defined (stdint_int64_defined)
00476 # if defined(__GNUC__) && __WORDSIZE == 64
00477 # define stdint_int64_defined
00478 __extension__ typedef long int64_t;
00479 __extension__ typedef unsigned long uint64_t;
00480 # define UINT64_C(v) v ## UL
00481 # define INT64_C(v) v ## L
00482 # ifndef PRINTF_INT64_MODIFIER
00483 # define PRINTF_INT64_MODIFIER "l"
00484 # endif
00485 #elif defined(__GNUC__)
00486 # define stdint_int64_defined
00487 __extension__ typedef long long int64_t;
00488 __extension__ typedef unsigned long long uint64_t;
00489 # define UINT64_C(v) v ## ULL
00490 # define INT64_C(v) v ## LL
00491 # ifndef PRINTF_INT64_MODIFIER
00492 # define PRINTF_INT64_MODIFIER "ll"
00493 # endif
00494 # elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S)
00495 # define stdint_int64_defined
00496 typedef long long int64_t;
00497 typedef unsigned long long uint64_t;
00498 # define UINT64_C(v) v ## ULL
00499 # define INT64_C(v) v ## LL
00500 # ifndef PRINTF_INT64_MODIFIER
00501 # define PRINTF_INT64_MODIFIER "ll"
00502 # endif
00503 # elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC)
00504 # define stdint_int64_defined
00505 typedef __int64 int64_t;
00506 typedef unsigned __int64 uint64_t;
00507 # define UINT64_C(v) v ## UI64
00508 # define INT64_C(v) v ## I64
00509 # ifndef PRINTF_INT64_MODIFIER
00510 # define PRINTF_INT64_MODIFIER "I64"
00511 # endif
00512 # endif
00513 #endif
00514
00515 #if !defined (LONG_LONG_MAX) && defined (INT64_C)
00516 # define LONG_LONG_MAX INT64_C (9223372036854775807)
00517 #endif
00518 #ifndef ULONG_LONG_MAX
00519 # define ULONG_LONG_MAX UINT64_C (18446744073709551615)
00520 #endif
00521
00522 #if !defined (INT64_MAX) && defined (INT64_C)
00523 # define INT64_MAX INT64_C (9223372036854775807)
00524 #endif
00525 #if !defined (INT64_MIN) && defined (INT64_C)
00526 # define INT64_MIN INT64_C (-9223372036854775808)
00527 #endif
00528 #if !defined (UINT64_MAX) && defined (INT64_C)
00529 # define UINT64_MAX UINT64_C (18446744073709551615)
00530 #endif
00531
00532
00533
00534
00535
00536 #ifndef PRINTF_INT64_HEX_WIDTH
00537 # define PRINTF_INT64_HEX_WIDTH "16"
00538 #endif
00539 #ifndef PRINTF_INT32_HEX_WIDTH
00540 # define PRINTF_INT32_HEX_WIDTH "8"
00541 #endif
00542 #ifndef PRINTF_INT16_HEX_WIDTH
00543 # define PRINTF_INT16_HEX_WIDTH "4"
00544 #endif
00545 #ifndef PRINTF_INT8_HEX_WIDTH
00546 # define PRINTF_INT8_HEX_WIDTH "2"
00547 #endif
00548
00549 #ifndef PRINTF_INT64_DEC_WIDTH
00550 # define PRINTF_INT64_DEC_WIDTH "20"
00551 #endif
00552 #ifndef PRINTF_INT32_DEC_WIDTH
00553 # define PRINTF_INT32_DEC_WIDTH "10"
00554 #endif
00555 #ifndef PRINTF_INT16_DEC_WIDTH
00556 # define PRINTF_INT16_DEC_WIDTH "5"
00557 #endif
00558 #ifndef PRINTF_INT8_DEC_WIDTH
00559 # define PRINTF_INT8_DEC_WIDTH "3"
00560 #endif
00561
00562
00563
00564
00565
00566
00567
00568 #ifdef stdint_int64_defined
00569 typedef int64_t intmax_t;
00570 typedef uint64_t uintmax_t;
00571 # define INTMAX_MAX INT64_MAX
00572 # define INTMAX_MIN INT64_MIN
00573 # define UINTMAX_MAX UINT64_MAX
00574 # define UINTMAX_C(v) UINT64_C(v)
00575 # define INTMAX_C(v) INT64_C(v)
00576 # ifndef PRINTF_INTMAX_MODIFIER
00577 # define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER
00578 # endif
00579 # ifndef PRINTF_INTMAX_HEX_WIDTH
00580 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH
00581 # endif
00582 # ifndef PRINTF_INTMAX_DEC_WIDTH
00583 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH
00584 # endif
00585 #else
00586 typedef int32_t intmax_t;
00587 typedef uint32_t uintmax_t;
00588 # define INTMAX_MAX INT32_MAX
00589 # define UINTMAX_MAX UINT32_MAX
00590 # define UINTMAX_C(v) UINT32_C(v)
00591 # define INTMAX_C(v) INT32_C(v)
00592 # ifndef PRINTF_INTMAX_MODIFIER
00593 # define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER
00594 # endif
00595 # ifndef PRINTF_INTMAX_HEX_WIDTH
00596 # define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH
00597 # endif
00598 # ifndef PRINTF_INTMAX_DEC_WIDTH
00599 # define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH
00600 # endif
00601 #endif
00602
00603
00604
00605
00606
00607
00608
00609
00610 #ifndef stdint_least_defined
00611 typedef int8_t int_least8_t;
00612 typedef uint8_t uint_least8_t;
00613 typedef int16_t int_least16_t;
00614 typedef uint16_t uint_least16_t;
00615 typedef int32_t int_least32_t;
00616 typedef uint32_t uint_least32_t;
00617 # define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER
00618 # define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER
00619 # define UINT_LEAST8_MAX UINT8_MAX
00620 # define INT_LEAST8_MAX INT8_MAX
00621 # define UINT_LEAST16_MAX UINT16_MAX
00622 # define INT_LEAST16_MAX INT16_MAX
00623 # define UINT_LEAST32_MAX UINT32_MAX
00624 # define INT_LEAST32_MAX INT32_MAX
00625 # define INT_LEAST8_MIN INT8_MIN
00626 # define INT_LEAST16_MIN INT16_MIN
00627 # define INT_LEAST32_MIN INT32_MIN
00628 # ifdef stdint_int64_defined
00629 typedef int64_t int_least64_t;
00630 typedef uint64_t uint_least64_t;
00631 # define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER
00632 # define UINT_LEAST64_MAX UINT64_MAX
00633 # define INT_LEAST64_MAX INT64_MAX
00634 # define INT_LEAST64_MIN INT64_MIN
00635 # endif
00636 #endif
00637 #undef stdint_least_defined
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650 #ifndef int_fast8_t
00651 typedef int_least8_t int_fast8_t;
00652 #endif
00653 #ifndef uint_fast8_t
00654 typedef uint_least8_t uint_fast8_t;
00655 #endif
00656 #ifndef int_fast16_t
00657 typedef int_least16_t int_fast16_t;
00658 #endif
00659 #ifndef uint_fast16_t
00660 typedef uint_least16_t uint_fast16_t;
00661 #endif
00662 #ifndef int_fast32_t
00663 typedef int_least32_t int_fast32_t;
00664 #endif
00665 #ifndef uint_fast32_t
00666 typedef uint_least32_t uint_fast32_t;
00667 #endif
00668 #define UINT_FAST8_MAX UINT_LEAST8_MAX
00669 #define INT_FAST8_MAX INT_LEAST8_MAX
00670 #define UINT_FAST16_MAX UINT_LEAST16_MAX
00671 #define INT_FAST16_MAX INT_LEAST16_MAX
00672 #define UINT_FAST32_MAX UINT_LEAST32_MAX
00673 #define INT_FAST32_MAX INT_LEAST32_MAX
00674 #define INT_FAST8_MIN INT_LEAST8_MIN
00675 #define INT_FAST16_MIN INT_LEAST16_MIN
00676 #define INT_FAST32_MIN INT_LEAST32_MIN
00677 #ifdef stdint_int64_defined
00678 typedef int_least64_t int_fast64_t;
00679 typedef uint_least64_t uint_fast64_t;
00680 # define UINT_FAST64_MAX UINT_LEAST64_MAX
00681 # define INT_FAST64_MAX INT_LEAST64_MAX
00682 # define INT_FAST64_MIN INT_LEAST64_MIN
00683 #endif
00684
00685 #undef stdint_int64_defined
00686
00687
00688
00689
00690
00691
00692 #if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__)
00693 # include <wchar.h>
00694 # ifndef WCHAR_MIN
00695 # define WCHAR_MIN 0
00696 # endif
00697 # ifndef WCHAR_MAX
00698 # define WCHAR_MAX ((wchar_t)-1)
00699 # endif
00700 #endif
00701
00702
00703
00704
00705
00706
00707 #if defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)
00708 # define STDINT_H_UINTPTR_T_DEFINED
00709 #endif
00710
00711 #ifndef STDINT_H_UINTPTR_T_DEFINED
00712 # if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64)
00713 # define stdint_intptr_bits 64
00714 # elif defined (__WATCOMC__) || defined (__TURBOC__)
00715 # if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__)
00716 # define stdint_intptr_bits 16
00717 # else
00718 # define stdint_intptr_bits 32
00719 # endif
00720 # elif defined (__i386__) || defined (_WIN32) || defined (WIN32)
00721 # define stdint_intptr_bits 32
00722 # elif defined (__INTEL_COMPILER)
00723
00724 # endif
00725
00726 # ifdef stdint_intptr_bits
00727 # define stdint_intptr_glue3_i(a,b,c) a##b##c
00728 # define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c)
00729 # ifndef PRINTF_INTPTR_MODIFIER
00730 # define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER)
00731 # endif
00732 # ifndef PTRDIFF_MAX
00733 # define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
00734 # endif
00735 # ifndef PTRDIFF_MIN
00736 # define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
00737 # endif
00738 # ifndef UINTPTR_MAX
00739 # define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX)
00740 # endif
00741 # ifndef INTPTR_MAX
00742 # define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX)
00743 # endif
00744 # ifndef INTPTR_MIN
00745 # define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN)
00746 # endif
00747 # ifndef INTPTR_C
00748 # define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x)
00749 # endif
00750 # ifndef UINTPTR_C
00751 # define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x)
00752 # endif
00753 typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t;
00754 typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t;
00755 # else
00756
00757
00758 typedef ptrdiff_t intptr_t;
00759 # endif
00760 # define STDINT_H_UINTPTR_T_DEFINED
00761 #endif
00762
00763
00764
00765
00766
00767 #ifndef SIG_ATOMIC_MAX
00768 # define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1)
00769 #endif
00770
00771 #endif
00772
00773 #ifndef _CMT_MONOLITHIC
00774
00775 #if defined (__TEST_PSTDINT_FOR_CORRECTNESS)
00776
00777
00778
00779
00780
00781
00782 #include <stdlib.h>
00783 #include <stdio.h>
00784 #include <string.h>
00785
00786 #define glue3_aux(x,y,z) x ## y ## z
00787 #define glue3(x,y,z) glue3_aux(x,y,z)
00788
00789 #define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,=) glue3(UINT,bits,_C) (0);
00790 #define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,=) glue3(INT,bits,_C) (0);
00791
00792 #define DECL(us,bits) glue3(DECL,us,) (bits)
00793
00794 #define TESTUMAX(bits) glue3(u,bits,=) glue3(~,u,bits); if (glue3(UINT,bits,_MAX) glue3(!=,u,bits)) printf ("Something wrong with UINT%d_MAX\n", bits)
00795
00796 int main () {
00797 DECL(I,8)
00798 DECL(U,8)
00799 DECL(I,16)
00800 DECL(U,16)
00801 DECL(I,32)
00802 DECL(U,32)
00803 #ifdef INT64_MAX
00804 DECL(I,64)
00805 DECL(U,64)
00806 #endif
00807 intmax_t imax = INTMAX_C(0);
00808 uintmax_t umax = UINTMAX_C(0);
00809 char str0[256], str1[256];
00810
00811 sprintf (str0, "%d %x\n", 0, ~0);
00812
00813 sprintf (str1, "%d %x\n", i8, ~0);
00814 if (0 != strcmp (str0, str1)) printf ("Something wrong with i8 : %s\n", str1);
00815 sprintf (str1, "%u %x\n", u8, ~0);
00816 if (0 != strcmp (str0, str1)) printf ("Something wrong with u8 : %s\n", str1);
00817 sprintf (str1, "%d %x\n", i16, ~0);
00818 if (0 != strcmp (str0, str1)) printf ("Something wrong with i16 : %s\n", str1);
00819 sprintf (str1, "%u %x\n", u16, ~0);
00820 if (0 != strcmp (str0, str1)) printf ("Something wrong with u16 : %s\n", str1);
00821 sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n", i32, ~0);
00822 if (0 != strcmp (str0, str1)) printf ("Something wrong with i32 : %s\n", str1);
00823 sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n", u32, ~0);
00824 if (0 != strcmp (str0, str1)) printf ("Something wrong with u32 : %s\n", str1);
00825 #ifdef INT64_MAX
00826 sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n", i64, ~0);
00827 if (0 != strcmp (str0, str1)) printf ("Something wrong with i64 : %s\n", str1);
00828 #endif
00829 sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n", imax, ~0);
00830 if (0 != strcmp (str0, str1)) printf ("Something wrong with imax : %s\n", str1);
00831 sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n", umax, ~0);
00832 if (0 != strcmp (str0, str1)) printf ("Something wrong with umax : %s\n", str1);
00833
00834 TESTUMAX(8);
00835 TESTUMAX(16);
00836 TESTUMAX(32);
00837 #ifdef INT64_MAX
00838 TESTUMAX(64);
00839 #endif
00840
00841 return EXIT_SUCCESS;
00842 }
00843
00844 #endif
00845 #endif // #ifndef _CMT_MONOLITHIC