Debian Codegraph @

lib/langinfo.in.h

raw
1 /* Substitute for and wrapper around <langinfo.h>.
2 Copyright (C) 2009-2026 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_ALTMON@
166 # define ALTMON_1 10200
167 # define ALTMON_2 (ALTMON_1 + 1)
168 # define ALTMON_3 (ALTMON_1 + 2)
169 # define ALTMON_4 (ALTMON_1 + 3)
170 # define ALTMON_5 (ALTMON_1 + 4)
171 # define ALTMON_6 (ALTMON_1 + 5)
172 # define ALTMON_7 (ALTMON_1 + 6)
173 # define ALTMON_8 (ALTMON_1 + 7)
174 # define ALTMON_9 (ALTMON_1 + 8)
175 # define ALTMON_10 (ALTMON_1 + 9)
176 # define ALTMON_11 (ALTMON_1 + 10)
177 # define ALTMON_12 (ALTMON_1 + 11)
178 # define GNULIB_defined_ALTMON 1
179 # endif
180
181 # if !@HAVE_LANGINFO_ABALTMON@
182 # if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 27
183 # define ABALTMON_1 _NL_ABALTMON_1
184 # define ABALTMON_2 _NL_ABALTMON_2
185 # define ABALTMON_3 _NL_ABALTMON_3
186 # define ABALTMON_4 _NL_ABALTMON_4
187 # define ABALTMON_5 _NL_ABALTMON_5
188 # define ABALTMON_6 _NL_ABALTMON_6
189 # define ABALTMON_7 _NL_ABALTMON_7
190 # define ABALTMON_8 _NL_ABALTMON_8
191 # define ABALTMON_9 _NL_ABALTMON_9
192 # define ABALTMON_10 _NL_ABALTMON_10
193 # define ABALTMON_11 _NL_ABALTMON_11
194 # define ABALTMON_12 _NL_ABALTMON_12
195 # else
196 # define ABALTMON_1 10220
197 # define ABALTMON_2 (ABALTMON_1 + 1)
198 # define ABALTMON_3 (ABALTMON_1 + 2)
199 # define ABALTMON_4 (ABALTMON_1 + 3)
200 # define ABALTMON_5 (ABALTMON_1 + 4)
201 # define ABALTMON_6 (ABALTMON_1 + 5)
202 # define ABALTMON_7 (ABALTMON_1 + 6)
203 # define ABALTMON_8 (ABALTMON_1 + 7)
204 # define ABALTMON_9 (ABALTMON_1 + 8)
205 # define ABALTMON_10 (ABALTMON_1 + 9)
206 # define ABALTMON_11 (ABALTMON_1 + 10)
207 # define ABALTMON_12 (ABALTMON_1 + 11)
208 # define GNULIB_defined_ABALTMON 1
209 # endif
210 # endif
211
212 # if !@HAVE_LANGINFO_ERA@
213 # define ERA 10047
214 # define ERA_D_FMT 10048
215 # define ERA_D_T_FMT 10049
216 # define ERA_T_FMT 10050
217 # define ALT_DIGITS 10051
218 # define GNULIB_defined_ERA 1
219 # endif
220
221 #endif
222
223 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
224
225 /* The definition of _GL_WARN_ON_USE is copied here. */
226
227 /* Declare overridden functions. */
228
229
230 /* Return a piece of locale dependent information.
231 Note: The difference between nl_langinfo (CODESET) and locale_charset ()
232 is that the latter normalizes the encoding names to GNU conventions. */
233
234 #if @GNULIB_NL_LANGINFO@
235 # if @REPLACE_NL_LANGINFO@
236 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
237 # undef nl_langinfo
238 # define nl_langinfo rpl_nl_langinfo
239 # endif
240 _GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item), );
241 _GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item));
242 # else
243 # if !@HAVE_NL_LANGINFO@
244 _GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item), );
245 # endif
246 _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item));
247 # endif
248 # if __GLIBC__ >= 2
249 _GL_CXXALIASWARN (nl_langinfo);
250 # endif
251 #elif defined GNULIB_POSIXCHECK
252 # if HAVE_RAW_DECL_NL_LANGINFO
253 _GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - "
254 "use gnulib module nl_langinfo for portability");
255 # endif
256 #endif
257
258
259 #endif /* _@GUARD_PREFIX@_LANGINFO_H */
260 #endif /* _@GUARD_PREFIX@_LANGINFO_H */