inttypes.in.h 21 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003
  1. /* Copyright (C) 2006-2021 Free Software Foundation, Inc.
  2. Written by Paul Eggert, Bruno Haible, Derek Price.
  3. This file is part of gnulib.
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU Lesser General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public License
  13. along with this program. If not, see <https://www.gnu.org/licenses/>. */
  14. /*
  15. * ISO C 99 <inttypes.h> for platforms that lack it.
  16. * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/inttypes.h.html>
  17. */
  18. #if __GNUC__ >= 3
  19. @PRAGMA_SYSTEM_HEADER@
  20. #endif
  21. @PRAGMA_COLUMNS@
  22. /* Include the original <inttypes.h> if it exists, and if this file
  23. has not been included yet or if this file includes gnulib stdint.h
  24. which in turn includes this file.
  25. The include_next requires a split double-inclusion guard. */
  26. #if ! defined INTTYPES_H || defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
  27. # if @HAVE_INTTYPES_H@
  28. /* Some pre-C++11 <stdint.h> implementations need this. */
  29. # if defined __cplusplus && ! defined __STDC_FORMAT_MACROS
  30. # define __STDC_FORMAT_MACROS 1
  31. # endif
  32. # @INCLUDE_NEXT@ @NEXT_INTTYPES_H@
  33. # define _GL_FINISHED_INCLUDING_SYSTEM_INTTYPES_H
  34. # endif
  35. #endif
  36. #if ! defined INTTYPES_H && ! defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
  37. #define INTTYPES_H
  38. /* Include <stdint.h> or the gnulib replacement.
  39. But avoid namespace pollution on glibc systems. */
  40. #ifndef __GLIBC__
  41. # include <stdint.h>
  42. #endif
  43. /* Get CHAR_BIT, INT_MAX, LONG_MAX, etc. */
  44. #include <limits.h>
  45. /* On mingw, __USE_MINGW_ANSI_STDIO only works if <stdio.h> is also included */
  46. #if defined _WIN32 && ! defined __CYGWIN__
  47. # include <stdio.h>
  48. #endif
  49. #if !(INT_MAX == 0x7fffffff && INT_MIN + INT_MAX == -1)
  50. # error "This file assumes that 'int' is 32-bit two's complement. Please report your platform and compiler to <bug-gnulib@gnu.org>."
  51. #endif
  52. /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
  53. /* The definition of _GL_ARG_NONNULL is copied here. */
  54. /* The definition of _GL_WARN_ON_USE is copied here. */
  55. /* 7.8.1 Macros for format specifiers */
  56. #if defined _TNS_R_TARGET
  57. /* Tandem NonStop R series and compatible platforms released before
  58. July 2005 support %Ld but not %lld. */
  59. # define _LONG_LONG_FORMAT_PREFIX "L"
  60. #else
  61. # define _LONG_LONG_FORMAT_PREFIX "ll"
  62. #endif
  63. #if !defined PRId8
  64. # ifdef INT8_MAX
  65. # define PRId8 "d"
  66. # endif
  67. #endif
  68. #if !defined PRIi8
  69. # ifdef INT8_MAX
  70. # define PRIi8 "i"
  71. # endif
  72. #endif
  73. #if !defined PRIo8
  74. # ifdef UINT8_MAX
  75. # define PRIo8 "o"
  76. # endif
  77. #endif
  78. #if !defined PRIu8
  79. # ifdef UINT8_MAX
  80. # define PRIu8 "u"
  81. # endif
  82. #endif
  83. #if !defined PRIx8
  84. # ifdef UINT8_MAX
  85. # define PRIx8 "x"
  86. # endif
  87. #endif
  88. #if !defined PRIX8
  89. # ifdef UINT8_MAX
  90. # define PRIX8 "X"
  91. # endif
  92. #endif
  93. #if !defined PRId16
  94. # ifdef INT16_MAX
  95. # define PRId16 "d"
  96. # endif
  97. #endif
  98. #if !defined PRIi16
  99. # ifdef INT16_MAX
  100. # define PRIi16 "i"
  101. # endif
  102. #endif
  103. #if !defined PRIo16
  104. # ifdef UINT16_MAX
  105. # define PRIo16 "o"
  106. # endif
  107. #endif
  108. #if !defined PRIu16
  109. # ifdef UINT16_MAX
  110. # define PRIu16 "u"
  111. # endif
  112. #endif
  113. #if !defined PRIx16
  114. # ifdef UINT16_MAX
  115. # define PRIx16 "x"
  116. # endif
  117. #endif
  118. #if !defined PRIX16
  119. # ifdef UINT16_MAX
  120. # define PRIX16 "X"
  121. # endif
  122. #endif
  123. #if !defined PRId32
  124. # ifdef INT32_MAX
  125. # define PRId32 "d"
  126. # endif
  127. #endif
  128. #if !defined PRIi32
  129. # ifdef INT32_MAX
  130. # define PRIi32 "i"
  131. # endif
  132. #endif
  133. #if !defined PRIo32
  134. # ifdef UINT32_MAX
  135. # define PRIo32 "o"
  136. # endif
  137. #endif
  138. #if !defined PRIu32
  139. # ifdef UINT32_MAX
  140. # define PRIu32 "u"
  141. # endif
  142. #endif
  143. #if !defined PRIx32
  144. # ifdef UINT32_MAX
  145. # define PRIx32 "x"
  146. # endif
  147. #endif
  148. #if !defined PRIX32
  149. # ifdef UINT32_MAX
  150. # define PRIX32 "X"
  151. # endif
  152. #endif
  153. #ifdef INT64_MAX
  154. # if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
  155. # define _PRI64_PREFIX "l"
  156. # elif defined _MSC_VER || defined __MINGW32__
  157. # define _PRI64_PREFIX "I64"
  158. # elif LONG_MAX >> 30 == 1
  159. # define _PRI64_PREFIX _LONG_LONG_FORMAT_PREFIX
  160. # endif
  161. # if !defined PRId64
  162. # define PRId64 _PRI64_PREFIX "d"
  163. # endif
  164. # if !defined PRIi64
  165. # define PRIi64 _PRI64_PREFIX "i"
  166. # endif
  167. #endif
  168. #ifdef UINT64_MAX
  169. # if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
  170. # define _PRIu64_PREFIX "l"
  171. # elif defined _MSC_VER || defined __MINGW32__
  172. # define _PRIu64_PREFIX "I64"
  173. # elif ULONG_MAX >> 31 == 1
  174. # define _PRIu64_PREFIX _LONG_LONG_FORMAT_PREFIX
  175. # endif
  176. # if !defined PRIo64
  177. # define PRIo64 _PRIu64_PREFIX "o"
  178. # endif
  179. # if !defined PRIu64
  180. # define PRIu64 _PRIu64_PREFIX "u"
  181. # endif
  182. # if !defined PRIx64
  183. # define PRIx64 _PRIu64_PREFIX "x"
  184. # endif
  185. # if !defined PRIX64
  186. # define PRIX64 _PRIu64_PREFIX "X"
  187. # endif
  188. #endif
  189. #if !defined PRIdLEAST8
  190. # define PRIdLEAST8 "d"
  191. #endif
  192. #if !defined PRIiLEAST8
  193. # define PRIiLEAST8 "i"
  194. #endif
  195. #if !defined PRIoLEAST8
  196. # define PRIoLEAST8 "o"
  197. #endif
  198. #if !defined PRIuLEAST8
  199. # define PRIuLEAST8 "u"
  200. #endif
  201. #if !defined PRIxLEAST8
  202. # define PRIxLEAST8 "x"
  203. #endif
  204. #if !defined PRIXLEAST8
  205. # define PRIXLEAST8 "X"
  206. #endif
  207. #if !defined PRIdLEAST16
  208. # define PRIdLEAST16 "d"
  209. #endif
  210. #if !defined PRIiLEAST16
  211. # define PRIiLEAST16 "i"
  212. #endif
  213. #if !defined PRIoLEAST16
  214. # define PRIoLEAST16 "o"
  215. #endif
  216. #if !defined PRIuLEAST16
  217. # define PRIuLEAST16 "u"
  218. #endif
  219. #if !defined PRIxLEAST16
  220. # define PRIxLEAST16 "x"
  221. #endif
  222. #if !defined PRIXLEAST16
  223. # define PRIXLEAST16 "X"
  224. #endif
  225. #if !defined PRIdLEAST32
  226. # define PRIdLEAST32 "d"
  227. #endif
  228. #if !defined PRIiLEAST32
  229. # define PRIiLEAST32 "i"
  230. #endif
  231. #if !defined PRIoLEAST32
  232. # define PRIoLEAST32 "o"
  233. #endif
  234. #if !defined PRIuLEAST32
  235. # define PRIuLEAST32 "u"
  236. #endif
  237. #if !defined PRIxLEAST32
  238. # define PRIxLEAST32 "x"
  239. #endif
  240. #if !defined PRIXLEAST32
  241. # define PRIXLEAST32 "X"
  242. #endif
  243. #ifdef INT64_MAX
  244. # if !defined PRIdLEAST64
  245. # define PRIdLEAST64 PRId64
  246. # endif
  247. # if !defined PRIiLEAST64
  248. # define PRIiLEAST64 PRIi64
  249. # endif
  250. #endif
  251. #ifdef UINT64_MAX
  252. # if !defined PRIoLEAST64
  253. # define PRIoLEAST64 PRIo64
  254. # endif
  255. # if !defined PRIuLEAST64
  256. # define PRIuLEAST64 PRIu64
  257. # endif
  258. # if !defined PRIxLEAST64
  259. # define PRIxLEAST64 PRIx64
  260. # endif
  261. # if !defined PRIXLEAST64
  262. # define PRIXLEAST64 PRIX64
  263. # endif
  264. #endif
  265. #if !defined PRIdFAST8
  266. # if INT_FAST8_MAX > INT32_MAX
  267. # define PRIdFAST8 PRId64
  268. # else
  269. # define PRIdFAST8 "d"
  270. # endif
  271. #endif
  272. #if !defined PRIiFAST8
  273. # if INT_FAST8_MAX > INT32_MAX
  274. # define PRIiFAST8 PRIi64
  275. # else
  276. # define PRIiFAST8 "i"
  277. # endif
  278. #endif
  279. #if !defined PRIoFAST8
  280. # if UINT_FAST8_MAX > UINT32_MAX
  281. # define PRIoFAST8 PRIo64
  282. # else
  283. # define PRIoFAST8 "o"
  284. # endif
  285. #endif
  286. #if !defined PRIuFAST8
  287. # if UINT_FAST8_MAX > UINT32_MAX
  288. # define PRIuFAST8 PRIu64
  289. # else
  290. # define PRIuFAST8 "u"
  291. # endif
  292. #endif
  293. #if !defined PRIxFAST8
  294. # if UINT_FAST8_MAX > UINT32_MAX
  295. # define PRIxFAST8 PRIx64
  296. # else
  297. # define PRIxFAST8 "x"
  298. # endif
  299. #endif
  300. #if !defined PRIXFAST8
  301. # if UINT_FAST8_MAX > UINT32_MAX
  302. # define PRIXFAST8 PRIX64
  303. # else
  304. # define PRIXFAST8 "X"
  305. # endif
  306. #endif
  307. #if !defined PRIdFAST16
  308. # if INT_FAST16_MAX > INT32_MAX
  309. # define PRIdFAST16 PRId64
  310. # else
  311. # define PRIdFAST16 "d"
  312. # endif
  313. #endif
  314. #if !defined PRIiFAST16
  315. # if INT_FAST16_MAX > INT32_MAX
  316. # define PRIiFAST16 PRIi64
  317. # else
  318. # define PRIiFAST16 "i"
  319. # endif
  320. #endif
  321. #if !defined PRIoFAST16
  322. # if UINT_FAST16_MAX > UINT32_MAX
  323. # define PRIoFAST16 PRIo64
  324. # else
  325. # define PRIoFAST16 "o"
  326. # endif
  327. #endif
  328. #if !defined PRIuFAST16
  329. # if UINT_FAST16_MAX > UINT32_MAX
  330. # define PRIuFAST16 PRIu64
  331. # else
  332. # define PRIuFAST16 "u"
  333. # endif
  334. #endif
  335. #if !defined PRIxFAST16
  336. # if UINT_FAST16_MAX > UINT32_MAX
  337. # define PRIxFAST16 PRIx64
  338. # else
  339. # define PRIxFAST16 "x"
  340. # endif
  341. #endif
  342. #if !defined PRIXFAST16
  343. # if UINT_FAST16_MAX > UINT32_MAX
  344. # define PRIXFAST16 PRIX64
  345. # else
  346. # define PRIXFAST16 "X"
  347. # endif
  348. #endif
  349. #if !defined PRIdFAST32
  350. # if INT_FAST32_MAX > INT32_MAX
  351. # define PRIdFAST32 PRId64
  352. # else
  353. # define PRIdFAST32 "d"
  354. # endif
  355. #endif
  356. #if !defined PRIiFAST32
  357. # if INT_FAST32_MAX > INT32_MAX
  358. # define PRIiFAST32 PRIi64
  359. # else
  360. # define PRIiFAST32 "i"
  361. # endif
  362. #endif
  363. #if !defined PRIoFAST32
  364. # if UINT_FAST32_MAX > UINT32_MAX
  365. # define PRIoFAST32 PRIo64
  366. # else
  367. # define PRIoFAST32 "o"
  368. # endif
  369. #endif
  370. #if !defined PRIuFAST32
  371. # if UINT_FAST32_MAX > UINT32_MAX
  372. # define PRIuFAST32 PRIu64
  373. # else
  374. # define PRIuFAST32 "u"
  375. # endif
  376. #endif
  377. #if !defined PRIxFAST32
  378. # if UINT_FAST32_MAX > UINT32_MAX
  379. # define PRIxFAST32 PRIx64
  380. # else
  381. # define PRIxFAST32 "x"
  382. # endif
  383. #endif
  384. #if !defined PRIXFAST32
  385. # if UINT_FAST32_MAX > UINT32_MAX
  386. # define PRIXFAST32 PRIX64
  387. # else
  388. # define PRIXFAST32 "X"
  389. # endif
  390. #endif
  391. #ifdef INT64_MAX
  392. # if !defined PRIdFAST64
  393. # define PRIdFAST64 PRId64
  394. # endif
  395. # if !defined PRIiFAST64
  396. # define PRIiFAST64 PRIi64
  397. # endif
  398. #endif
  399. #ifdef UINT64_MAX
  400. # if !defined PRIoFAST64
  401. # define PRIoFAST64 PRIo64
  402. # endif
  403. # if !defined PRIuFAST64
  404. # define PRIuFAST64 PRIu64
  405. # endif
  406. # if !defined PRIxFAST64
  407. # define PRIxFAST64 PRIx64
  408. # endif
  409. # if !defined PRIXFAST64
  410. # define PRIXFAST64 PRIX64
  411. # endif
  412. #endif
  413. #if !defined PRIdMAX
  414. # if @INT32_MAX_LT_INTMAX_MAX@
  415. # define PRIdMAX PRId64
  416. # else
  417. # define PRIdMAX "ld"
  418. # endif
  419. #endif
  420. #if !defined PRIiMAX
  421. # if @INT32_MAX_LT_INTMAX_MAX@
  422. # define PRIiMAX PRIi64
  423. # else
  424. # define PRIiMAX "li"
  425. # endif
  426. #endif
  427. #if !defined PRIoMAX
  428. # if @UINT32_MAX_LT_UINTMAX_MAX@
  429. # define PRIoMAX PRIo64
  430. # else
  431. # define PRIoMAX "lo"
  432. # endif
  433. #endif
  434. #if !defined PRIuMAX
  435. # if @UINT32_MAX_LT_UINTMAX_MAX@
  436. # define PRIuMAX PRIu64
  437. # else
  438. # define PRIuMAX "lu"
  439. # endif
  440. #endif
  441. #if !defined PRIxMAX
  442. # if @UINT32_MAX_LT_UINTMAX_MAX@
  443. # define PRIxMAX PRIx64
  444. # else
  445. # define PRIxMAX "lx"
  446. # endif
  447. #endif
  448. #if !defined PRIXMAX
  449. # if @UINT32_MAX_LT_UINTMAX_MAX@
  450. # define PRIXMAX PRIX64
  451. # else
  452. # define PRIXMAX "lX"
  453. # endif
  454. #endif
  455. #if !defined PRIdPTR
  456. # ifdef INTPTR_MAX
  457. # define PRIdPTR @PRIPTR_PREFIX@ "d"
  458. # endif
  459. #endif
  460. #if !defined PRIiPTR
  461. # ifdef INTPTR_MAX
  462. # define PRIiPTR @PRIPTR_PREFIX@ "i"
  463. # endif
  464. #endif
  465. #if !defined PRIoPTR
  466. # ifdef UINTPTR_MAX
  467. # define PRIoPTR @PRIPTR_PREFIX@ "o"
  468. # endif
  469. #endif
  470. #if !defined PRIuPTR
  471. # ifdef UINTPTR_MAX
  472. # define PRIuPTR @PRIPTR_PREFIX@ "u"
  473. # endif
  474. #endif
  475. #if !defined PRIxPTR
  476. # ifdef UINTPTR_MAX
  477. # define PRIxPTR @PRIPTR_PREFIX@ "x"
  478. # endif
  479. #endif
  480. #if !defined PRIXPTR
  481. # ifdef UINTPTR_MAX
  482. # define PRIXPTR @PRIPTR_PREFIX@ "X"
  483. # endif
  484. #endif
  485. #if !defined SCNd8
  486. # ifdef INT8_MAX
  487. # define SCNd8 "hhd"
  488. # endif
  489. #endif
  490. #if !defined SCNi8
  491. # ifdef INT8_MAX
  492. # define SCNi8 "hhi"
  493. # endif
  494. #endif
  495. #if !defined SCNo8
  496. # ifdef UINT8_MAX
  497. # define SCNo8 "hho"
  498. # endif
  499. #endif
  500. #if !defined SCNu8
  501. # ifdef UINT8_MAX
  502. # define SCNu8 "hhu"
  503. # endif
  504. #endif
  505. #if !defined SCNx8
  506. # ifdef UINT8_MAX
  507. # define SCNx8 "hhx"
  508. # endif
  509. #endif
  510. #if !defined SCNd16
  511. # ifdef INT16_MAX
  512. # define SCNd16 "hd"
  513. # endif
  514. #endif
  515. #if !defined SCNi16
  516. # ifdef INT16_MAX
  517. # define SCNi16 "hi"
  518. # endif
  519. #endif
  520. #if !defined SCNo16
  521. # ifdef UINT16_MAX
  522. # define SCNo16 "ho"
  523. # endif
  524. #endif
  525. #if !defined SCNu16
  526. # ifdef UINT16_MAX
  527. # define SCNu16 "hu"
  528. # endif
  529. #endif
  530. #if !defined SCNx16
  531. # ifdef UINT16_MAX
  532. # define SCNx16 "hx"
  533. # endif
  534. #endif
  535. #if !defined SCNd32
  536. # ifdef INT32_MAX
  537. # define SCNd32 "d"
  538. # endif
  539. #endif
  540. #if !defined SCNi32
  541. # ifdef INT32_MAX
  542. # define SCNi32 "i"
  543. # endif
  544. #endif
  545. #if !defined SCNo32
  546. # ifdef UINT32_MAX
  547. # define SCNo32 "o"
  548. # endif
  549. #endif
  550. #if !defined SCNu32
  551. # ifdef UINT32_MAX
  552. # define SCNu32 "u"
  553. # endif
  554. #endif
  555. #if !defined SCNx32
  556. # ifdef UINT32_MAX
  557. # define SCNx32 "x"
  558. # endif
  559. #endif
  560. #ifdef INT64_MAX
  561. # if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
  562. # define _SCN64_PREFIX "l"
  563. # elif defined _MSC_VER || defined __MINGW32__
  564. # define _SCN64_PREFIX "I64"
  565. # elif LONG_MAX >> 30 == 1
  566. # define _SCN64_PREFIX _LONG_LONG_FORMAT_PREFIX
  567. # endif
  568. # if !defined SCNd64
  569. # define SCNd64 _SCN64_PREFIX "d"
  570. # endif
  571. # if !defined SCNi64
  572. # define SCNi64 _SCN64_PREFIX "i"
  573. # endif
  574. #endif
  575. #ifdef UINT64_MAX
  576. # if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
  577. # define _SCNu64_PREFIX "l"
  578. # elif defined _MSC_VER || defined __MINGW32__
  579. # define _SCNu64_PREFIX "I64"
  580. # elif ULONG_MAX >> 31 == 1
  581. # define _SCNu64_PREFIX _LONG_LONG_FORMAT_PREFIX
  582. # endif
  583. # if !defined SCNo64
  584. # define SCNo64 _SCNu64_PREFIX "o"
  585. # endif
  586. # if !defined SCNu64
  587. # define SCNu64 _SCNu64_PREFIX "u"
  588. # endif
  589. # if !defined SCNx64
  590. # define SCNx64 _SCNu64_PREFIX "x"
  591. # endif
  592. #endif
  593. #if !defined SCNdLEAST8
  594. # define SCNdLEAST8 "hhd"
  595. #endif
  596. #if !defined SCNiLEAST8
  597. # define SCNiLEAST8 "hhi"
  598. #endif
  599. #if !defined SCNoLEAST8
  600. # define SCNoLEAST8 "hho"
  601. #endif
  602. #if !defined SCNuLEAST8
  603. # define SCNuLEAST8 "hhu"
  604. #endif
  605. #if !defined SCNxLEAST8
  606. # define SCNxLEAST8 "hhx"
  607. #endif
  608. #if !defined SCNdLEAST16
  609. # define SCNdLEAST16 "hd"
  610. #endif
  611. #if !defined SCNiLEAST16
  612. # define SCNiLEAST16 "hi"
  613. #endif
  614. #if !defined SCNoLEAST16
  615. # define SCNoLEAST16 "ho"
  616. #endif
  617. #if !defined SCNuLEAST16
  618. # define SCNuLEAST16 "hu"
  619. #endif
  620. #if !defined SCNxLEAST16
  621. # define SCNxLEAST16 "hx"
  622. #endif
  623. #if !defined SCNdLEAST32
  624. # define SCNdLEAST32 "d"
  625. #endif
  626. #if !defined SCNiLEAST32
  627. # define SCNiLEAST32 "i"
  628. #endif
  629. #if !defined SCNoLEAST32
  630. # define SCNoLEAST32 "o"
  631. #endif
  632. #if !defined SCNuLEAST32
  633. # define SCNuLEAST32 "u"
  634. #endif
  635. #if !defined SCNxLEAST32
  636. # define SCNxLEAST32 "x"
  637. #endif
  638. #ifdef INT64_MAX
  639. # if !defined SCNdLEAST64
  640. # define SCNdLEAST64 SCNd64
  641. # endif
  642. # if !defined SCNiLEAST64
  643. # define SCNiLEAST64 SCNi64
  644. # endif
  645. #endif
  646. #ifdef UINT64_MAX
  647. # if !defined SCNoLEAST64
  648. # define SCNoLEAST64 SCNo64
  649. # endif
  650. # if !defined SCNuLEAST64
  651. # define SCNuLEAST64 SCNu64
  652. # endif
  653. # if !defined SCNxLEAST64
  654. # define SCNxLEAST64 SCNx64
  655. # endif
  656. #endif
  657. #if !defined SCNdFAST8
  658. # if INT_FAST8_MAX > INT32_MAX
  659. # define SCNdFAST8 SCNd64
  660. # elif INT_FAST8_MAX == 0x7fff
  661. # define SCNdFAST8 "hd"
  662. # elif INT_FAST8_MAX == 0x7f
  663. # define SCNdFAST8 "hhd"
  664. # else
  665. # define SCNdFAST8 "d"
  666. # endif
  667. #endif
  668. #if !defined SCNiFAST8
  669. # if INT_FAST8_MAX > INT32_MAX
  670. # define SCNiFAST8 SCNi64
  671. # elif INT_FAST8_MAX == 0x7fff
  672. # define SCNiFAST8 "hi"
  673. # elif INT_FAST8_MAX == 0x7f
  674. # define SCNiFAST8 "hhi"
  675. # else
  676. # define SCNiFAST8 "i"
  677. # endif
  678. #endif
  679. #if !defined SCNoFAST8
  680. # if UINT_FAST8_MAX > UINT32_MAX
  681. # define SCNoFAST8 SCNo64
  682. # elif UINT_FAST8_MAX == 0xffff
  683. # define SCNoFAST8 "ho"
  684. # elif UINT_FAST8_MAX == 0xff
  685. # define SCNoFAST8 "hho"
  686. # else
  687. # define SCNoFAST8 "o"
  688. # endif
  689. #endif
  690. #if !defined SCNuFAST8
  691. # if UINT_FAST8_MAX > UINT32_MAX
  692. # define SCNuFAST8 SCNu64
  693. # elif UINT_FAST8_MAX == 0xffff
  694. # define SCNuFAST8 "hu"
  695. # elif UINT_FAST8_MAX == 0xff
  696. # define SCNuFAST8 "hhu"
  697. # else
  698. # define SCNuFAST8 "u"
  699. # endif
  700. #endif
  701. #if !defined SCNxFAST8
  702. # if UINT_FAST8_MAX > UINT32_MAX
  703. # define SCNxFAST8 SCNx64
  704. # elif UINT_FAST8_MAX == 0xffff
  705. # define SCNxFAST8 "hx"
  706. # elif UINT_FAST8_MAX == 0xff
  707. # define SCNxFAST8 "hhx"
  708. # else
  709. # define SCNxFAST8 "x"
  710. # endif
  711. #endif
  712. #if !defined SCNdFAST16
  713. # if INT_FAST16_MAX > INT32_MAX
  714. # define SCNdFAST16 SCNd64
  715. # elif INT_FAST16_MAX == 0x7fff
  716. # define SCNdFAST16 "hd"
  717. # else
  718. # define SCNdFAST16 "d"
  719. # endif
  720. #endif
  721. #if !defined SCNiFAST16
  722. # if INT_FAST16_MAX > INT32_MAX
  723. # define SCNiFAST16 SCNi64
  724. # elif INT_FAST16_MAX == 0x7fff
  725. # define SCNiFAST16 "hi"
  726. # else
  727. # define SCNiFAST16 "i"
  728. # endif
  729. #endif
  730. #if !defined SCNoFAST16
  731. # if UINT_FAST16_MAX > UINT32_MAX
  732. # define SCNoFAST16 SCNo64
  733. # elif UINT_FAST16_MAX == 0xffff
  734. # define SCNoFAST16 "ho"
  735. # else
  736. # define SCNoFAST16 "o"
  737. # endif
  738. #endif
  739. #if !defined SCNuFAST16
  740. # if UINT_FAST16_MAX > UINT32_MAX
  741. # define SCNuFAST16 SCNu64
  742. # elif UINT_FAST16_MAX == 0xffff
  743. # define SCNuFAST16 "hu"
  744. # else
  745. # define SCNuFAST16 "u"
  746. # endif
  747. #endif
  748. #if !defined SCNxFAST16
  749. # if UINT_FAST16_MAX > UINT32_MAX
  750. # define SCNxFAST16 SCNx64
  751. # elif UINT_FAST16_MAX == 0xffff
  752. # define SCNxFAST16 "hx"
  753. # else
  754. # define SCNxFAST16 "x"
  755. # endif
  756. #endif
  757. #if !defined SCNdFAST32
  758. # if INT_FAST32_MAX > INT32_MAX
  759. # define SCNdFAST32 SCNd64
  760. # else
  761. # define SCNdFAST32 "d"
  762. # endif
  763. #endif
  764. #if !defined SCNiFAST32
  765. # if INT_FAST32_MAX > INT32_MAX
  766. # define SCNiFAST32 SCNi64
  767. # else
  768. # define SCNiFAST32 "i"
  769. # endif
  770. #endif
  771. #if !defined SCNoFAST32
  772. # if UINT_FAST32_MAX > UINT32_MAX
  773. # define SCNoFAST32 SCNo64
  774. # else
  775. # define SCNoFAST32 "o"
  776. # endif
  777. #endif
  778. #if !defined SCNuFAST32
  779. # if UINT_FAST32_MAX > UINT32_MAX
  780. # define SCNuFAST32 SCNu64
  781. # else
  782. # define SCNuFAST32 "u"
  783. # endif
  784. #endif
  785. #if !defined SCNxFAST32
  786. # if UINT_FAST32_MAX > UINT32_MAX
  787. # define SCNxFAST32 SCNx64
  788. # else
  789. # define SCNxFAST32 "x"
  790. # endif
  791. #endif
  792. #ifdef INT64_MAX
  793. # if !defined SCNdFAST64
  794. # define SCNdFAST64 SCNd64
  795. # endif
  796. # if !defined SCNiFAST64
  797. # define SCNiFAST64 SCNi64
  798. # endif
  799. #endif
  800. #ifdef UINT64_MAX
  801. # if !defined SCNoFAST64
  802. # define SCNoFAST64 SCNo64
  803. # endif
  804. # if !defined SCNuFAST64
  805. # define SCNuFAST64 SCNu64
  806. # endif
  807. # if !defined SCNxFAST64
  808. # define SCNxFAST64 SCNx64
  809. # endif
  810. #endif
  811. #if !defined SCNdMAX
  812. # if @INT32_MAX_LT_INTMAX_MAX@
  813. # define SCNdMAX SCNd64
  814. # else
  815. # define SCNdMAX "ld"
  816. # endif
  817. #endif
  818. #if !defined SCNiMAX
  819. # if @INT32_MAX_LT_INTMAX_MAX@
  820. # define SCNiMAX SCNi64
  821. # else
  822. # define SCNiMAX "li"
  823. # endif
  824. #endif
  825. #if !defined SCNoMAX
  826. # if @UINT32_MAX_LT_UINTMAX_MAX@
  827. # define SCNoMAX SCNo64
  828. # else
  829. # define SCNoMAX "lo"
  830. # endif
  831. #endif
  832. #if !defined SCNuMAX
  833. # if @UINT32_MAX_LT_UINTMAX_MAX@
  834. # define SCNuMAX SCNu64
  835. # else
  836. # define SCNuMAX "lu"
  837. # endif
  838. #endif
  839. #if !defined SCNxMAX
  840. # if @UINT32_MAX_LT_UINTMAX_MAX@
  841. # define SCNxMAX SCNx64
  842. # else
  843. # define SCNxMAX "lx"
  844. # endif
  845. #endif
  846. #if !defined SCNdPTR
  847. # ifdef INTPTR_MAX
  848. # define SCNdPTR @PRIPTR_PREFIX@ "d"
  849. # endif
  850. #endif
  851. #if !defined SCNiPTR
  852. # ifdef INTPTR_MAX
  853. # define SCNiPTR @PRIPTR_PREFIX@ "i"
  854. # endif
  855. #endif
  856. #if !defined SCNoPTR
  857. # ifdef UINTPTR_MAX
  858. # define SCNoPTR @PRIPTR_PREFIX@ "o"
  859. # endif
  860. #endif
  861. #if !defined SCNuPTR
  862. # ifdef UINTPTR_MAX
  863. # define SCNuPTR @PRIPTR_PREFIX@ "u"
  864. # endif
  865. #endif
  866. #if !defined SCNxPTR
  867. # ifdef UINTPTR_MAX
  868. # define SCNxPTR @PRIPTR_PREFIX@ "x"
  869. # endif
  870. #endif
  871. /* 7.8.2 Functions for greatest-width integer types */
  872. #ifdef __cplusplus
  873. extern "C" {
  874. #endif
  875. #if @GNULIB_IMAXABS@
  876. # if !@HAVE_DECL_IMAXABS@
  877. extern intmax_t imaxabs (intmax_t);
  878. # endif
  879. #elif defined GNULIB_POSIXCHECK
  880. # undef imaxabs
  881. # if HAVE_RAW_DECL_IMAXABS
  882. _GL_WARN_ON_USE (imaxabs, "imaxabs is unportable - "
  883. "use gnulib module imaxabs for portability");
  884. # endif
  885. #endif
  886. #if @GNULIB_IMAXDIV@
  887. # if !@HAVE_IMAXDIV_T@
  888. # if !GNULIB_defined_imaxdiv_t
  889. typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t;
  890. # define GNULIB_defined_imaxdiv_t 1
  891. # endif
  892. # endif
  893. # if !@HAVE_DECL_IMAXDIV@
  894. extern imaxdiv_t imaxdiv (intmax_t, intmax_t);
  895. # endif
  896. #elif defined GNULIB_POSIXCHECK
  897. # undef imaxdiv
  898. # if HAVE_RAW_DECL_IMAXDIV
  899. _GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - "
  900. "use gnulib module imaxdiv for portability");
  901. # endif
  902. #endif
  903. #if @GNULIB_STRTOIMAX@
  904. # if @REPLACE_STRTOIMAX@
  905. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  906. # undef strtoimax
  907. # define strtoimax rpl_strtoimax
  908. # endif
  909. _GL_FUNCDECL_RPL (strtoimax, intmax_t,
  910. (const char *restrict, char **restrict, int)
  911. _GL_ARG_NONNULL ((1)));
  912. _GL_CXXALIAS_RPL (strtoimax, intmax_t,
  913. (const char *restrict, char **restrict, int));
  914. # else
  915. # if !@HAVE_DECL_STRTOIMAX@
  916. # undef strtoimax
  917. _GL_FUNCDECL_SYS (strtoimax, intmax_t,
  918. (const char *restrict, char **restrict, int)
  919. _GL_ARG_NONNULL ((1)));
  920. # endif
  921. _GL_CXXALIAS_SYS (strtoimax, intmax_t,
  922. (const char *restrict, char **restrict, int));
  923. # endif
  924. _GL_CXXALIASWARN (strtoimax);
  925. #elif defined GNULIB_POSIXCHECK
  926. # undef strtoimax
  927. # if HAVE_RAW_DECL_STRTOIMAX
  928. _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
  929. "use gnulib module strtoimax for portability");
  930. # endif
  931. #endif
  932. #if @GNULIB_STRTOUMAX@
  933. # if @REPLACE_STRTOUMAX@
  934. # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
  935. # undef strtoumax
  936. # define strtoumax rpl_strtoumax
  937. # endif
  938. _GL_FUNCDECL_RPL (strtoumax, uintmax_t,
  939. (const char *restrict, char **restrict, int)
  940. _GL_ARG_NONNULL ((1)));
  941. _GL_CXXALIAS_RPL (strtoumax, uintmax_t,
  942. (const char *restrict, char **restrict, int));
  943. # else
  944. # if !@HAVE_DECL_STRTOUMAX@
  945. # undef strtoumax
  946. _GL_FUNCDECL_SYS (strtoumax, uintmax_t,
  947. (const char *restrict, char **restrict, int)
  948. _GL_ARG_NONNULL ((1)));
  949. # endif
  950. _GL_CXXALIAS_SYS (strtoumax, uintmax_t,
  951. (const char *restrict, char **restrict, int));
  952. # endif
  953. _GL_CXXALIASWARN (strtoumax);
  954. #elif defined GNULIB_POSIXCHECK
  955. # undef strtoumax
  956. # if HAVE_RAW_DECL_STRTOUMAX
  957. _GL_WARN_ON_USE (strtoumax, "strtoumax is unportable - "
  958. "use gnulib module strtoumax for portability");
  959. # endif
  960. #endif
  961. /* Don't bother defining or declaring wcstoimax and wcstoumax, since
  962. wide-character functions like this are hardly ever useful. */
  963. #ifdef __cplusplus
  964. }
  965. #endif
  966. #endif /* !defined INTTYPES_H && !defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H */