Debian Codegraph @

lib/langinfo.in.h

raw
1 /* Substitute for and wrapper around <langinfo.h>.
2 Copyright (C) 2009-2025 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17 /*
18 * POSIX <langinfo.h> for platforms that lack it or have an incomplete one.
19 * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/langinfo.h.html>
20 */
21
22 #ifndef _@GUARD_PREFIX@_LANGINFO_H
23
24 #if __GNUC__ >= 3
25 @PRAGMA_SYSTEM_HEADER@
26 #endif
27 @PRAGMA_COLUMNS@
28
29 /* The include_next requires a split double-inclusion guard. */
30 #if @HAVE_LANGINFO_H@
31 # @INCLUDE_NEXT@ @NEXT_LANGINFO_H@
32 #endif
33
34 #ifndef _@GUARD_PREFIX@_LANGINFO_H
35 #define _@GUARD_PREFIX@_LANGINFO_H
36
37 /* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
38 #if !_GL_CONFIG_H_INCLUDED
39 #error "Please include config.h first."
40 #endif
41
42
43 #if !@HAVE_LANGINFO_H@
44
45 /* A platform that lacks <langinfo.h>. */
46
47 /* Assume that it also lacks <nl_types.h> and the nl_item type. */
48 # if !GNULIB_defined_nl_item
49 typedef int nl_item;
50 # define GNULIB_defined_nl_item 1
51 # endif
52
53 /* nl_langinfo items of the LC_CTYPE category */
54 # define CODESET 10000
55 /* nl_langinfo items of the LC_NUMERIC category */
56 # define RADIXCHAR 10001
57 # define DECIMAL_POINT RADIXCHAR
58 # define THOUSEP 10002
59 # define THOUSANDS_SEP THOUSEP
60 # define GROUPING 10114
61 /* nl_langinfo items of the LC_TIME category */
62 # define D_T_FMT 10003
63 # define D_FMT 10004
64 # define T_FMT 10005
65 # define T_FMT_AMPM 10006
66 # define AM_STR 10007
67 # define PM_STR 10008
68 # define DAY_1 10009
69 # define DAY_2 (DAY_1 + 1)
70 # define DAY_3 (DAY_1 + 2)
71 # define DAY_4 (DAY_1 + 3)
72 # define DAY_5 (DAY_1 + 4)
73 # define DAY_6 (DAY_1 + 5)
74 # define DAY_7 (DAY_1 + 6)
75 # define ABDAY_1 10016
76 # define ABDAY_2 (ABDAY_1 + 1)
77 # define ABDAY_3 (ABDAY_1 + 2)
78 # define ABDAY_4 (ABDAY_1 + 3)
79 # define ABDAY_5 (ABDAY_1 + 4)
80 # define ABDAY_6 (ABDAY_1 + 5)
81 # define ABDAY_7 (ABDAY_1 + 6)
82 # define MON_1 10023
83 # define MON_2 (MON_1 + 1)
84 # define MON_3 (MON_1 + 2)
85 # define MON_4 (MON_1 + 3)
86 # define MON_5 (MON_1 + 4)
87 # define MON_6 (MON_1 + 5)
88 # define MON_7 (MON_1 + 6)
89 # define MON_8 (MON_1 + 7)
90 # define MON_9 (MON_1 + 8)
91 # define MON_10 (MON_1 + 9)
92 # define MON_11 (MON_1 + 10)
93 # define MON_12 (MON_1 + 11)
94 # define ALTMON_1 10200
95 # define ALTMON_2 (ALTMON_1 + 1)
96 # define ALTMON_3 (ALTMON_1 + 2)
97 # define ALTMON_4 (ALTMON_1 + 3)
98 # define ALTMON_5 (ALTMON_1 + 4)
99 # define ALTMON_6 (ALTMON_1 + 5)
100 # define ALTMON_7 (ALTMON_1 + 6)
101 # define ALTMON_8 (ALTMON_1 + 7)
102 # define ALTMON_9 (ALTMON_1 + 8)
103 # define ALTMON_10 (ALTMON_1 + 9)
104 # define ALTMON_11 (ALTMON_1 + 10)
105 # define ALTMON_12 (ALTMON_1 + 11)
106 # define ABMON_1 10035
107 # define ABMON_2 (ABMON_1 + 1)
108 # define ABMON_3 (ABMON_1 + 2)
109 # define ABMON_4 (ABMON_1 + 3)
110 # define ABMON_5 (ABMON_1 + 4)
111 # define ABMON_6 (ABMON_1 + 5)
112 # define ABMON_7 (ABMON_1 + 6)
113 # define ABMON_8 (ABMON_1 + 7)
114 # define ABMON_9 (ABMON_1 + 8)
115 # define ABMON_10 (ABMON_1 + 9)
116 # define ABMON_11 (ABMON_1 + 10)
117 # define ABMON_12 (ABMON_1 + 11)
118 # define ABALTMON_1 10220
119 # define ABALTMON_2 (ABALTMON_1 + 1)
120 # define ABALTMON_3 (ABALTMON_1 + 2)
121 # define ABALTMON_4 (ABALTMON_1 + 3)
122 # define ABALTMON_5 (ABALTMON_1 + 4)
123 # define ABALTMON_6 (ABALTMON_1 + 5)
124 # define ABALTMON_7 (ABALTMON_1 + 6)
125 # define ABALTMON_8 (ABALTMON_1 + 7)
126 # define ABALTMON_9 (ABALTMON_1 + 8)
127 # define ABALTMON_10 (ABALTMON_1 + 9)
128 # define ABALTMON_11 (ABALTMON_1 + 10)
129 # define ABALTMON_12 (ABALTMON_1 + 11)
130 # define ERA 10047
131 # define ERA_D_FMT 10048
132 # define ERA_D_T_FMT 10049
133 # define ERA_T_FMT 10050
134 # define ALT_DIGITS 10051
135 /* nl_langinfo items of the LC_MONETARY category */
136 # define CRNCYSTR 10052
137 # define CURRENCY_SYMBOL CRNCYSTR
138 # define INT_CURR_SYMBOL 10100
139 # define MON_DECIMAL_POINT 10101
140 # define MON_THOUSANDS_SEP 10102
141 # define MON_GROUPING 10103
142 # define POSITIVE_SIGN 10104
143 # define NEGATIVE_SIGN 10105
144 # define FRAC_DIGITS 10106
145 # define INT_FRAC_DIGITS 10107
146 # define P_CS_PRECEDES 10108
147 # define N_CS_PRECEDES 10109
148 # define P_SEP_BY_SPACE 10110
149 # define N_SEP_BY_SPACE 10111
150 # define P_SIGN_POSN 10112
151 # define N_SIGN_POSN 10113
152 /* nl_langinfo items of the LC_MESSAGES category */
153 # define YESEXPR 10053
154 # define NOEXPR 10054
155
156 #else
157
158 /* A platform that has <langinfo.h>. */
159
160 # if !@HAVE_LANGINFO_CODESET@
161 # define CODESET 10000
162 # define GNULIB_defined_CODESET 1
163 # endif
164
165 # if !@HAVE_LANGINFO_T_FMT_AMPM@
166 # define T_FMT_AMPM 10006
167 # define GNULIB_defined_T_FMT_AMPM 1
168 # endif
169
170 # if !@HAVE_LANGINFO_ALTMON@
171 # define ALTMON_1 10200
172 # define ALTMON_2 (ALTMON_1 + 1)
173 # define ALTMON_3 (ALTMON_1 + 2)
174 # define ALTMON_4 (ALTMON_1 + 3)
175 # define ALTMON_5 (ALTMON_1 + 4)
176 # define ALTMON_6 (ALTMON_1 + 5)
177 # define ALTMON_7 (ALTMON_1 + 6)
178 # define ALTMON_8 (ALTMON_1 + 7)
179 # define ALTMON_9 (ALTMON_1 + 8)
180 # define ALTMON_10 (ALTMON_1 + 9)
181 # define ALTMON_11 (ALTMON_1 + 10)
182 # define ALTMON_12 (ALTMON_1 + 11)
183 # define GNULIB_defined_ALTMON 1
184 # endif
185
186 # if !@HAVE_LANGINFO_ABALTMON@
187 # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 27
188 # define ABALTMON_1 _NL_ABALTMON_1
189 # define ABALTMON_2 _NL_ABALTMON_2
190 # define ABALTMON_3 _NL_ABALTMON_3
191 # define ABALTMON_4 _NL_ABALTMON_4
192 # define ABALTMON_5 _NL_ABALTMON_5
193 # define ABALTMON_6 _NL_ABALTMON_6
194 # define ABALTMON_7 _NL_ABALTMON_7
195 # define ABALTMON_8 _NL_ABALTMON_8
196 # define ABALTMON_9 _NL_ABALTMON_9
197 # define ABALTMON_10 _NL_ABALTMON_10
198 # define ABALTMON_11 _NL_ABALTMON_11
199 # define ABALTMON_12 _NL_ABALTMON_12
200 # else
201 # define ABALTMON_1 10220
202 # define ABALTMON_2 (ABALTMON_1 + 1)
203 # define ABALTMON_3 (ABALTMON_1 + 2)
204 # define ABALTMON_4 (ABALTMON_1 + 3)
205 # define ABALTMON_5 (ABALTMON_1 + 4)
206 # define ABALTMON_6 (ABALTMON_1 + 5)
207 # define ABALTMON_7 (ABALTMON_1 + 6)
208 # define ABALTMON_8 (ABALTMON_1 + 7)
209 # define ABALTMON_9 (ABALTMON_1 + 8)
210 # define ABALTMON_10 (ABALTMON_1 + 9)
211 # define ABALTMON_11 (ABALTMON_1 + 10)
212 # define ABALTMON_12 (ABALTMON_1 + 11)
213 # define GNULIB_defined_ABALTMON 1
214 # endif
215 # endif
216
217 # if !@HAVE_LANGINFO_ERA@
218 # define ERA 10047
219 # define ERA_D_FMT 10048
220 # define ERA_D_T_FMT 10049
221 # define ERA_T_FMT 10050
222 # define ALT_DIGITS 10051
223 # define GNULIB_defined_ERA 1
224 # endif
225
226 # if !@HAVE_LANGINFO_YESEXPR@
227 # define YESEXPR 10053
228 # define NOEXPR 10054
229 # define GNULIB_defined_YESEXPR 1
230 # endif
231
232 #endif
233
234 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
235
236 /* The definition of _GL_WARN_ON_USE is copied here. */
237
238 /* Declare overridden functions. */
239
240
241 /* Return a piece of locale dependent information.
242 Note: The difference between nl_langinfo (CODESET) and locale_charset ()
243 is that the latter normalizes the encoding names to GNU conventions. */
244
245 #if @GNULIB_NL_LANGINFO@
246 # if @REPLACE_NL_LANGINFO@
247 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
248 # undef nl_langinfo
249 # define nl_langinfo rpl_nl_langinfo
250 # endif
251 _GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item), );
252 _GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item));
253 # else
254 # if !@HAVE_NL_LANGINFO@
255 _GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item), );
256 # endif
257 _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item));
258 # endif
259 # if __GLIBC__ >= 2
260 _GL_CXXALIASWARN (nl_langinfo);
261 # endif
262 #elif defined GNULIB_POSIXCHECK
263 # undef nl_langinfo
264 # if HAVE_RAW_DECL_NL_LANGINFO
265 _GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - "
266 "use gnulib module nl_langinfo for portability");
267 # endif
268 #endif
269
270
271 #endif /* _@GUARD_PREFIX@_LANGINFO_H */
272 #endif /* _@GUARD_PREFIX@_LANGINFO_H */