Ruby: include/ruby/backward/2/inttypes.h Source File

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

inttypes.h
Go to the documentation of this file.
1#ifndef RUBY_BACKWARD2_INTTYPES_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RUBY_BACKWARD2_INTTYPES_H
23#include "ruby/internal/config.h" /* PRI_LL_PREFIX etc. are here */
24
25#ifdef HAVE_INTTYPES_H
26# include <inttypes.h>
27#endif
28
29#include "ruby/internal/value.h" /* PRI_VALUE_PREFIX is here. */
30
31#ifndef PRI_INT_PREFIX
32# define PRI_INT_PREFIX ""
33#endif
34
35#ifndef PRI_LONG_PREFIX
36# define PRI_LONG_PREFIX "l"
37#endif
38
39#ifndef PRI_SHORT_PREFIX
40# define PRI_SHORT_PREFIX "h"
41#endif
42
43#ifdef PRI_64_PREFIX
44# /* Take that. */
45#elif SIZEOF_LONG == 8
46# define PRI_64_PREFIX PRI_LONG_PREFIX
47#elif SIZEOF_LONG_LONG == 8
48# define PRI_64_PREFIX PRI_LL_PREFIX
49#endif
50
51#ifndef PRIdPTR
52# define PRIdPTR PRI_PTR_PREFIX"d"
53# define PRIiPTR PRI_PTR_PREFIX"i"
54# define PRIoPTR PRI_PTR_PREFIX"o"
55# define PRIuPTR PRI_PTR_PREFIX"u"
56# define PRIxPTR PRI_PTR_PREFIX"x"
57# define PRIXPTR PRI_PTR_PREFIX"X"
58#endif
59
60#ifndef RUBY_PRI_VALUE_MARK
61# define RUBY_PRI_VALUE_MARK "\v"
62#endif
63
64#if defined PRIdPTR && !defined PRI_VALUE_PREFIX
65# define PRIdVALUE PRIdPTR
66# define PRIoVALUE PRIoPTR
67# define PRIuVALUE PRIuPTR
68# define PRIxVALUE PRIxPTR
69# define PRIXVALUE PRIXPTR
70# define PRIsVALUE PRIiPTR"" RUBY_PRI_VALUE_MARK
71#else
72# define PRIdVALUE PRI_VALUE_PREFIX"d"
73# define PRIoVALUE PRI_VALUE_PREFIX"o"
74# define PRIuVALUE PRI_VALUE_PREFIX"u"
75# define PRIxVALUE PRI_VALUE_PREFIX"x"
76# define PRIXVALUE PRI_VALUE_PREFIX"X"
77# define PRIsVALUE PRI_VALUE_PREFIX"i" RUBY_PRI_VALUE_MARK
78#endif
79
80#ifndef PRI_VALUE_PREFIX
81# define PRI_VALUE_PREFIX ""
82#endif
83
84#ifdef PRI_TIMET_PREFIX
85# /* Take that. */
86#elif SIZEOF_TIME_T == SIZEOF_INT
87# define PRI_TIMET_PREFIX
88#elif SIZEOF_TIME_T == SIZEOF_LONG
89# define PRI_TIMET_PREFIX "l"
90#elif SIZEOF_TIME_T == SIZEOF_LONG_LONG
91# define PRI_TIMET_PREFIX PRI_LL_PREFIX
92#endif
93
94#ifdef PRI_PTRDIFF_PREFIX
95# /* Take that. */
96#elif SIZEOF_PTRDIFF_T == SIZEOF_INT
97# define PRI_PTRDIFF_PREFIX ""
98#elif SIZEOF_PTRDIFF_T == SIZEOF_LONG
99# define PRI_PTRDIFF_PREFIX "l"
100#elif SIZEOF_PTRDIFF_T == SIZEOF_LONG_LONG
101# define PRI_PTRDIFF_PREFIX PRI_LL_PREFIX
102#endif
103
104#ifndef PRIdPTRDIFF
105# define PRIdPTRDIFF PRI_PTRDIFF_PREFIX"d"
106# define PRIiPTRDIFF PRI_PTRDIFF_PREFIX"i"
107# define PRIoPTRDIFF PRI_PTRDIFF_PREFIX"o"
108# define PRIuPTRDIFF PRI_PTRDIFF_PREFIX"u"
109# define PRIxPTRDIFF PRI_PTRDIFF_PREFIX"x"
110# define PRIXPTRDIFF PRI_PTRDIFF_PREFIX"X"
111#endif
112
113#ifdef PRI_SIZE_PREFIX
114# /* Take that. */
115#elif SIZEOF_SIZE_T == SIZEOF_INT
116# define PRI_SIZE_PREFIX ""
117#elif SIZEOF_SIZE_T == SIZEOF_LONG
118# define PRI_SIZE_PREFIX "l"
119#elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG
120# define PRI_SIZE_PREFIX PRI_LL_PREFIX
121#endif
122
123#ifndef PRIdSIZE
124# define PRIdSIZE PRI_SIZE_PREFIX"d"
125# define PRIiSIZE PRI_SIZE_PREFIX"i"
126# define PRIoSIZE PRI_SIZE_PREFIX"o"
127# define PRIuSIZE PRI_SIZE_PREFIX"u"
128# define PRIxSIZE PRI_SIZE_PREFIX"x"
129# define PRIXSIZE PRI_SIZE_PREFIX"X"
130#endif
131
132#endif /* RUBY_BACKWARD2_INTTYPES_H */
config.h
Thin wrapper to ruby/config.h.
inttypes.h
C99 shim for <inttypes.h>
value.h
Defines VALUE and ID.