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