exp2l: Work around a NetBSD 10.0/i386 bug.
[gnulib.git] / lib / locale.in.h
blob1b11a41c4df3bd42cc20e83d4ddcb34c3674afe6
1 /* A POSIX <locale.h>.
2 Copyright (C) 2007-2024 Free Software Foundation, Inc.
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.
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.
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/>. */
17 #if __GNUC__ >= 3
18 @PRAGMA_SYSTEM_HEADER@
19 #endif
20 @PRAGMA_COLUMNS@
22 #if (defined _WIN32 && !defined __CYGWIN__ && defined __need_locale_t) \
23 || defined _GL_ALREADY_INCLUDING_LOCALE_H
25 /* Special invocation convention:
26 - Inside mingw header files,
27 - To handle Solaris header files (through Solaris 10) when combined
28 with gettext's libintl.h. */
30 #@INCLUDE_NEXT@ @NEXT_LOCALE_H@
32 #else
33 /* Normal invocation convention. */
35 #ifndef _@GUARD_PREFIX@_LOCALE_H
37 #define _GL_ALREADY_INCLUDING_LOCALE_H
39 /* The include_next requires a split double-inclusion guard. */
40 #@INCLUDE_NEXT@ @NEXT_LOCALE_H@
42 #undef _GL_ALREADY_INCLUDING_LOCALE_H
44 #ifndef _@GUARD_PREFIX@_LOCALE_H
45 #define _@GUARD_PREFIX@_LOCALE_H
47 /* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */
48 #if !_GL_CONFIG_H_INCLUDED
49 #error "Please include config.h first."
50 #endif
52 /* NetBSD 5.0 mis-defines NULL. */
53 #include <stddef.h>
55 /* Mac OS X 10.5 defines the locale_t type in <xlocale.h>. */
56 #if @HAVE_XLOCALE_H@
57 # include <xlocale.h>
58 #endif
60 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
62 /* The definition of _GL_ARG_NONNULL is copied here. */
64 /* The definition of _GL_WARN_ON_USE is copied here. */
66 /* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C.
67 On systems that don't define it, use the same value as GNU libintl. */
68 #if !defined LC_MESSAGES
69 # define LC_MESSAGES 1729
70 #endif
72 /* On native Windows with MSVC, 'struct lconv' lacks the members int_p_* and
73 int_n_*. Instead of overriding 'struct lconv', merely define these member
74 names as macros. This avoids trouble in C++ mode. */
75 #if defined _MSC_VER
76 # define int_p_cs_precedes p_cs_precedes
77 # define int_p_sign_posn p_sign_posn
78 # define int_p_sep_by_space p_sep_by_space
79 # define int_n_cs_precedes n_cs_precedes
80 # define int_n_sign_posn n_sign_posn
81 # define int_n_sep_by_space n_sep_by_space
82 #endif
84 /* Bionic libc's 'struct lconv' is just a dummy. */
85 #if @REPLACE_STRUCT_LCONV@
86 # define lconv rpl_lconv
87 struct lconv
89 /* All 'char *' are actually 'const char *'. */
91 /* Members that depend on the LC_NUMERIC category of the locale. See
92 <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_04> */
94 /* Symbol used as decimal point. */
95 char *decimal_point;
96 /* Symbol used to separate groups of digits to the left of the decimal
97 point. */
98 char *thousands_sep;
99 /* Definition of the size of groups of digits to the left of the decimal
100 point. */
101 char *grouping;
103 /* Members that depend on the LC_MONETARY category of the locale. See
104 <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_03> */
106 /* Symbol used as decimal point. */
107 char *mon_decimal_point;
108 /* Symbol used to separate groups of digits to the left of the decimal
109 point. */
110 char *mon_thousands_sep;
111 /* Definition of the size of groups of digits to the left of the decimal
112 point. */
113 char *mon_grouping;
114 /* Sign used to indicate a value >= 0. */
115 char *positive_sign;
116 /* Sign used to indicate a value < 0. */
117 char *negative_sign;
119 /* For formatting local currency. */
120 /* Currency symbol (3 characters) followed by separator (1 character). */
121 char *currency_symbol;
122 /* Number of digits after the decimal point. */
123 char frac_digits;
124 /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
125 comes after the number. */
126 char p_cs_precedes;
127 /* For values >= 0: Position of the sign. */
128 char p_sign_posn;
129 /* For values >= 0: Placement of spaces between currency symbol, sign, and
130 number. */
131 char p_sep_by_space;
132 /* For values < 0: 1 if the currency symbol precedes the number, 0 if it
133 comes after the number. */
134 char n_cs_precedes;
135 /* For values < 0: Position of the sign. */
136 char n_sign_posn;
137 /* For values < 0: Placement of spaces between currency symbol, sign, and
138 number. */
139 char n_sep_by_space;
141 /* For formatting international currency. */
142 /* Currency symbol (3 characters) followed by separator (1 character). */
143 char *int_curr_symbol;
144 /* Number of digits after the decimal point. */
145 char int_frac_digits;
146 /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
147 comes after the number. */
148 char int_p_cs_precedes;
149 /* For values >= 0: Position of the sign. */
150 char int_p_sign_posn;
151 /* For values >= 0: Placement of spaces between currency symbol, sign, and
152 number. */
153 char int_p_sep_by_space;
154 /* For values < 0: 1 if the currency symbol precedes the number, 0 if it
155 comes after the number. */
156 char int_n_cs_precedes;
157 /* For values < 0: Position of the sign. */
158 char int_n_sign_posn;
159 /* For values < 0: Placement of spaces between currency symbol, sign, and
160 number. */
161 char int_n_sep_by_space;
163 #endif
165 #if @GNULIB_LOCALECONV@
166 # if @REPLACE_LOCALECONV@
167 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
168 # undef localeconv
169 # define localeconv rpl_localeconv
170 # endif
171 _GL_FUNCDECL_RPL (localeconv, struct lconv *, (void));
172 _GL_CXXALIAS_RPL (localeconv, struct lconv *, (void));
173 # else
174 _GL_CXXALIAS_SYS (localeconv, struct lconv *, (void));
175 # endif
176 # if __GLIBC__ >= 2
177 _GL_CXXALIASWARN (localeconv);
178 # endif
179 #elif @REPLACE_STRUCT_LCONV@
180 # undef localeconv
181 # define localeconv localeconv_used_without_requesting_gnulib_module_localeconv
182 #elif defined GNULIB_POSIXCHECK
183 # undef localeconv
184 # if HAVE_RAW_DECL_LOCALECONV
185 _GL_WARN_ON_USE (localeconv,
186 "localeconv returns too few information on some platforms - "
187 "use gnulib module localeconv for portability");
188 # endif
189 #endif
191 #if @GNULIB_SETLOCALE@
192 # if @REPLACE_SETLOCALE@
193 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
194 # undef setlocale
195 # define setlocale rpl_setlocale
196 # define GNULIB_defined_setlocale 1
197 # endif
198 _GL_FUNCDECL_RPL (setlocale, char *, (int category, const char *locale));
199 _GL_CXXALIAS_RPL (setlocale, char *, (int category, const char *locale));
200 # else
201 _GL_CXXALIAS_SYS (setlocale, char *, (int category, const char *locale));
202 # endif
203 # if __GLIBC__ >= 2
204 _GL_CXXALIASWARN (setlocale);
205 # endif
206 #elif defined GNULIB_POSIXCHECK
207 # undef setlocale
208 # if HAVE_RAW_DECL_SETLOCALE
209 _GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - "
210 "use gnulib module setlocale for portability");
211 # endif
212 #endif
214 #if @GNULIB_SETLOCALE_NULL@
215 /* Included here for convenience. */
216 # include "setlocale_null.h"
217 #endif
219 #if /*@GNULIB_NEWLOCALE@ ||*/ (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_NEWLOCALE@)
220 # if @REPLACE_NEWLOCALE@
221 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
222 # undef newlocale
223 # define newlocale rpl_newlocale
224 # define GNULIB_defined_newlocale 1
225 # endif
226 _GL_FUNCDECL_RPL (newlocale, locale_t,
227 (int category_mask, const char *name, locale_t base)
228 _GL_ARG_NONNULL ((2)));
229 _GL_CXXALIAS_RPL (newlocale, locale_t,
230 (int category_mask, const char *name, locale_t base));
231 # else
232 # if @HAVE_NEWLOCALE@
233 _GL_CXXALIAS_SYS (newlocale, locale_t,
234 (int category_mask, const char *name, locale_t base));
235 # endif
236 # endif
237 # if __GLIBC__ >= 2 && @HAVE_NEWLOCALE@
238 _GL_CXXALIASWARN (newlocale);
239 # endif
240 # if @HAVE_NEWLOCALE@ || @REPLACE_NEWLOCALE@
241 # ifndef HAVE_WORKING_NEWLOCALE
242 # define HAVE_WORKING_NEWLOCALE 1
243 # endif
244 # endif
245 #elif defined GNULIB_POSIXCHECK
246 # undef newlocale
247 # if HAVE_RAW_DECL_NEWLOCALE
248 _GL_WARN_ON_USE (newlocale, "newlocale is not portable");
249 # endif
250 #endif
252 #if @GNULIB_DUPLOCALE@ || (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_DUPLOCALE@)
253 # if @HAVE_DUPLOCALE@ /* locale_t may be undefined if !@HAVE_DUPLOCALE@. */
254 # if @REPLACE_DUPLOCALE@
255 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
256 # undef duplocale
257 # define duplocale rpl_duplocale
258 # define GNULIB_defined_duplocale 1
259 # endif
260 _GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale) _GL_ARG_NONNULL ((1)));
261 _GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale));
262 # else
263 _GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale));
264 # endif
265 # endif
266 # if __GLIBC__ >= 2 && @HAVE_DUPLOCALE@
267 _GL_CXXALIASWARN (duplocale);
268 # endif
269 # if @HAVE_DUPLOCALE@
270 # ifndef HAVE_WORKING_DUPLOCALE
271 # define HAVE_WORKING_DUPLOCALE 1
272 # endif
273 # endif
274 #elif defined GNULIB_POSIXCHECK
275 # undef duplocale
276 # if HAVE_RAW_DECL_DUPLOCALE
277 _GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - "
278 "use gnulib module duplocale for portability");
279 # endif
280 #endif
282 #if /*@GNULIB_FREELOCALE@ ||*/ (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_FREELOCALE@)
283 # if @REPLACE_FREELOCALE@
284 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
285 # undef freelocale
286 # define freelocale rpl_freelocale
287 # define GNULIB_defined_freelocale 1
288 # endif
289 _GL_FUNCDECL_RPL (freelocale, void, (locale_t locale) _GL_ARG_NONNULL ((1)));
290 _GL_CXXALIAS_RPL (freelocale, void, (locale_t locale));
291 # else
292 # if @HAVE_FREELOCALE@
293 /* Need to cast, because on FreeBSD and Mac OS X 10.13, the return type is
294 int. */
295 _GL_CXXALIAS_SYS_CAST (freelocale, void, (locale_t locale));
296 # endif
297 # endif
298 # if __GLIBC__ >= 2 && @HAVE_FREELOCALE@
299 _GL_CXXALIASWARN (freelocale);
300 # endif
301 #elif defined GNULIB_POSIXCHECK
302 # undef freelocale
303 # if HAVE_RAW_DECL_FREELOCALE
304 _GL_WARN_ON_USE (freelocale, "freelocale is not portable");
305 # endif
306 #endif
308 #endif /* _@GUARD_PREFIX@_LOCALE_H */
309 #endif /* _@GUARD_PREFIX@_LOCALE_H */
310 #endif /* !(__need_locale_t || _GL_ALREADY_INCLUDING_LOCALE_H) */