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/>. */
18 @PRAGMA_SYSTEM_HEADER@
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@
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."
52 /* NetBSD 5.0 mis-defines NULL. */
55 /* Mac OS X 10.5 defines the locale_t type in <xlocale.h>. */
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
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. */
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
84 /* Bionic libc's 'struct lconv' is just a dummy. */
85 #if @REPLACE_STRUCT_LCONV@
86 # define lconv rpl_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. */
96 /* Symbol used to separate groups of digits to the left of the decimal
99 /* Definition of the size of groups of digits to the left of the decimal
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
110 char *mon_thousands_sep
;
111 /* Definition of the size of groups of digits to the left of the decimal
114 /* Sign used to indicate a value >= 0. */
116 /* Sign used to indicate a value < 0. */
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. */
124 /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
125 comes after the number. */
127 /* For values >= 0: Position of the sign. */
129 /* For values >= 0: Placement of spaces between currency symbol, sign, and
132 /* For values < 0: 1 if the currency symbol precedes the number, 0 if it
133 comes after the number. */
135 /* For values < 0: Position of the sign. */
137 /* For values < 0: Placement of spaces between currency symbol, sign, and
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
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
161 char int_n_sep_by_space
;
165 #if @GNULIB_LOCALECONV@
166 # if @REPLACE_LOCALECONV@
167 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
169 # define localeconv rpl_localeconv
171 _GL_FUNCDECL_RPL (localeconv
, struct lconv
*, (void));
172 _GL_CXXALIAS_RPL (localeconv
, struct lconv
*, (void));
174 _GL_CXXALIAS_SYS (localeconv
, struct lconv
*, (void));
177 _GL_CXXALIASWARN (localeconv
);
179 #elif @REPLACE_STRUCT_LCONV@
180 # if !GNULIB_LOCALECONV
182 # define localeconv localeconv_used_without_requesting_gnulib_module_localeconv
184 #elif defined GNULIB_POSIXCHECK
186 # if HAVE_RAW_DECL_LOCALECONV
187 _GL_WARN_ON_USE (localeconv
,
188 "localeconv returns too few information on some platforms - "
189 "use gnulib module localeconv for portability");
193 #if @GNULIB_SETLOCALE@
194 # if @REPLACE_SETLOCALE@
195 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
197 # define setlocale rpl_setlocale
198 # define GNULIB_defined_setlocale 1
200 _GL_FUNCDECL_RPL (setlocale
, char *, (int category
, const char *locale
));
201 _GL_CXXALIAS_RPL (setlocale
, char *, (int category
, const char *locale
));
203 _GL_CXXALIAS_SYS (setlocale
, char *, (int category
, const char *locale
));
206 _GL_CXXALIASWARN (setlocale
);
208 #elif defined GNULIB_POSIXCHECK
210 # if HAVE_RAW_DECL_SETLOCALE
211 _GL_WARN_ON_USE (setlocale
, "setlocale works differently on native Windows - "
212 "use gnulib module setlocale for portability");
216 #if @GNULIB_SETLOCALE_NULL@
217 /* Included here for convenience. */
218 # include "setlocale_null.h"
221 #if /*@GNULIB_NEWLOCALE@ ||*/ (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_NEWLOCALE@)
222 # if @REPLACE_NEWLOCALE@
223 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
225 # define newlocale rpl_newlocale
226 # define GNULIB_defined_newlocale 1
228 _GL_FUNCDECL_RPL (newlocale
, locale_t
,
229 (int category_mask
, const char *name
, locale_t base
),
230 _GL_ARG_NONNULL ((2)));
231 _GL_CXXALIAS_RPL (newlocale
, locale_t
,
232 (int category_mask
, const char *name
, locale_t base
));
234 # if @HAVE_NEWLOCALE@
235 _GL_CXXALIAS_SYS (newlocale
, locale_t
,
236 (int category_mask
, const char *name
, locale_t base
));
239 # if __GLIBC__ >= 2 && @HAVE_NEWLOCALE@
240 _GL_CXXALIASWARN (newlocale
);
242 # if @HAVE_NEWLOCALE@ || @REPLACE_NEWLOCALE@
243 # ifndef HAVE_WORKING_NEWLOCALE
244 # define HAVE_WORKING_NEWLOCALE 1
247 #elif defined GNULIB_POSIXCHECK
249 # if HAVE_RAW_DECL_NEWLOCALE
250 _GL_WARN_ON_USE (newlocale
, "newlocale is not portable");
254 #if @GNULIB_DUPLOCALE@ || (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_DUPLOCALE@)
255 # if @HAVE_DUPLOCALE@ /* locale_t may be undefined if !@HAVE_DUPLOCALE@. */
256 # if @REPLACE_DUPLOCALE@
257 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
259 # define duplocale rpl_duplocale
260 # define GNULIB_defined_duplocale 1
262 _GL_FUNCDECL_RPL (duplocale
, locale_t
, (locale_t locale
), _GL_ARG_NONNULL ((1)));
263 _GL_CXXALIAS_RPL (duplocale
, locale_t
, (locale_t locale
));
265 _GL_CXXALIAS_SYS (duplocale
, locale_t
, (locale_t locale
));
268 # if __GLIBC__ >= 2 && @HAVE_DUPLOCALE@
269 _GL_CXXALIASWARN (duplocale
);
271 # if @HAVE_DUPLOCALE@
272 # ifndef HAVE_WORKING_DUPLOCALE
273 # define HAVE_WORKING_DUPLOCALE 1
276 #elif defined GNULIB_POSIXCHECK
278 # if HAVE_RAW_DECL_DUPLOCALE
279 _GL_WARN_ON_USE (duplocale
, "duplocale is buggy on some glibc systems - "
280 "use gnulib module duplocale for portability");
284 #if /*@GNULIB_FREELOCALE@ ||*/ (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_FREELOCALE@)
285 # if @REPLACE_FREELOCALE@
286 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
288 # define freelocale rpl_freelocale
289 # define GNULIB_defined_freelocale 1
291 _GL_FUNCDECL_RPL (freelocale
, void, (locale_t locale
), _GL_ARG_NONNULL ((1)));
292 _GL_CXXALIAS_RPL (freelocale
, void, (locale_t locale
));
294 # if @HAVE_FREELOCALE@
295 /* Need to cast, because on FreeBSD and Mac OS X 10.13, the return type is
297 _GL_CXXALIAS_SYS_CAST (freelocale
, void, (locale_t locale
));
300 # if __GLIBC__ >= 2 && @HAVE_FREELOCALE@
301 _GL_CXXALIASWARN (freelocale
);
303 #elif defined GNULIB_POSIXCHECK
305 # if HAVE_RAW_DECL_FREELOCALE
306 _GL_WARN_ON_USE (freelocale
, "freelocale is not portable");
310 #endif /* _@GUARD_PREFIX@_LOCALE_H */
311 #endif /* _@GUARD_PREFIX@_LOCALE_H */
312 #endif /* !(__need_locale_t || _GL_ALREADY_INCLUDING_LOCALE_H) */