2 Copyright (C) 2007-2023 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 /* NetBSD 5.0 mis-defines NULL. */
50 /* Mac OS X 10.5 defines the locale_t type in <xlocale.h>. */
55 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
57 /* The definition of _GL_ARG_NONNULL is copied here. */
59 /* The definition of _GL_WARN_ON_USE is copied here. */
61 /* The LC_MESSAGES locale category is specified in POSIX, but not in ISO C.
62 On systems that don't define it, use the same value as GNU libintl. */
63 #if !defined LC_MESSAGES
64 # define LC_MESSAGES 1729
67 /* On native Windows with MSVC, 'struct lconv' lacks the members int_p_* and
68 int_n_*. Instead of overriding 'struct lconv', merely define these member
69 names as macros. This avoids trouble in C++ mode. */
71 # define int_p_cs_precedes p_cs_precedes
72 # define int_p_sign_posn p_sign_posn
73 # define int_p_sep_by_space p_sep_by_space
74 # define int_n_cs_precedes n_cs_precedes
75 # define int_n_sign_posn n_sign_posn
76 # define int_n_sep_by_space n_sep_by_space
79 /* Bionic libc's 'struct lconv' is just a dummy. */
80 #if @REPLACE_STRUCT_LCONV@
81 # define lconv rpl_lconv
84 /* All 'char *' are actually 'const char *'. */
86 /* Members that depend on the LC_NUMERIC category of the locale. See
87 <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_04> */
89 /* Symbol used as decimal point. */
91 /* Symbol used to separate groups of digits to the left of the decimal
94 /* Definition of the size of groups of digits to the left of the decimal
98 /* Members that depend on the LC_MONETARY category of the locale. See
99 <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_03> */
101 /* Symbol used as decimal point. */
102 char *mon_decimal_point
;
103 /* Symbol used to separate groups of digits to the left of the decimal
105 char *mon_thousands_sep
;
106 /* Definition of the size of groups of digits to the left of the decimal
109 /* Sign used to indicate a value >= 0. */
111 /* Sign used to indicate a value < 0. */
114 /* For formatting local currency. */
115 /* Currency symbol (3 characters) followed by separator (1 character). */
116 char *currency_symbol
;
117 /* Number of digits after the decimal point. */
119 /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
120 comes after the number. */
122 /* For values >= 0: Position of the sign. */
124 /* For values >= 0: Placement of spaces between currency symbol, sign, and
127 /* For values < 0: 1 if the currency symbol precedes the number, 0 if it
128 comes after the number. */
130 /* For values < 0: Position of the sign. */
132 /* For values < 0: Placement of spaces between currency symbol, sign, and
136 /* For formatting international currency. */
137 /* Currency symbol (3 characters) followed by separator (1 character). */
138 char *int_curr_symbol
;
139 /* Number of digits after the decimal point. */
140 char int_frac_digits
;
141 /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
142 comes after the number. */
143 char int_p_cs_precedes
;
144 /* For values >= 0: Position of the sign. */
145 char int_p_sign_posn
;
146 /* For values >= 0: Placement of spaces between currency symbol, sign, and
148 char int_p_sep_by_space
;
149 /* For values < 0: 1 if the currency symbol precedes the number, 0 if it
150 comes after the number. */
151 char int_n_cs_precedes
;
152 /* For values < 0: Position of the sign. */
153 char int_n_sign_posn
;
154 /* For values < 0: Placement of spaces between currency symbol, sign, and
156 char int_n_sep_by_space
;
160 #if @GNULIB_LOCALECONV@
161 # if @REPLACE_LOCALECONV@
162 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
164 # define localeconv rpl_localeconv
166 _GL_FUNCDECL_RPL (localeconv
, struct lconv
*, (void));
167 _GL_CXXALIAS_RPL (localeconv
, struct lconv
*, (void));
169 _GL_CXXALIAS_SYS (localeconv
, struct lconv
*, (void));
172 _GL_CXXALIASWARN (localeconv
);
174 #elif @REPLACE_STRUCT_LCONV@
176 # define localeconv localeconv_used_without_requesting_gnulib_module_localeconv
177 #elif defined GNULIB_POSIXCHECK
179 # if HAVE_RAW_DECL_LOCALECONV
180 _GL_WARN_ON_USE (localeconv
,
181 "localeconv returns too few information on some platforms - "
182 "use gnulib module localeconv for portability");
186 #if @GNULIB_SETLOCALE@
187 # if @REPLACE_SETLOCALE@
188 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
190 # define setlocale rpl_setlocale
191 # define GNULIB_defined_setlocale 1
193 _GL_FUNCDECL_RPL (setlocale
, char *, (int category
, const char *locale
));
194 _GL_CXXALIAS_RPL (setlocale
, char *, (int category
, const char *locale
));
196 _GL_CXXALIAS_SYS (setlocale
, char *, (int category
, const char *locale
));
199 _GL_CXXALIASWARN (setlocale
);
201 #elif defined GNULIB_POSIXCHECK
203 # if HAVE_RAW_DECL_SETLOCALE
204 _GL_WARN_ON_USE (setlocale
, "setlocale works differently on native Windows - "
205 "use gnulib module setlocale for portability");
209 #if @GNULIB_SETLOCALE_NULL@
210 /* Included here for convenience. */
211 # include "setlocale_null.h"
214 #if /*@GNULIB_NEWLOCALE@ ||*/ (@GNULIB_LOCALENAME@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_NEWLOCALE@)
215 # if @REPLACE_NEWLOCALE@
216 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
218 # define newlocale rpl_newlocale
219 # define GNULIB_defined_newlocale 1
221 _GL_FUNCDECL_RPL (newlocale
, locale_t
,
222 (int category_mask
, const char *name
, locale_t base
)
223 _GL_ARG_NONNULL ((2)));
224 _GL_CXXALIAS_RPL (newlocale
, locale_t
,
225 (int category_mask
, const char *name
, locale_t base
));
227 # if @HAVE_NEWLOCALE@
228 _GL_CXXALIAS_SYS (newlocale
, locale_t
,
229 (int category_mask
, const char *name
, locale_t base
));
232 # if @HAVE_NEWLOCALE@
233 _GL_CXXALIASWARN (newlocale
);
235 # if @HAVE_NEWLOCALE@ || @REPLACE_NEWLOCALE@
236 # ifndef HAVE_WORKING_NEWLOCALE
237 # define HAVE_WORKING_NEWLOCALE 1
240 #elif defined GNULIB_POSIXCHECK
242 # if HAVE_RAW_DECL_NEWLOCALE
243 _GL_WARN_ON_USE (newlocale
, "newlocale is not portable");
247 #if @GNULIB_DUPLOCALE@ || (@GNULIB_LOCALENAME@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_DUPLOCALE@)
248 # if @REPLACE_DUPLOCALE@
249 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
251 # define duplocale rpl_duplocale
252 # define GNULIB_defined_duplocale 1
254 _GL_FUNCDECL_RPL (duplocale
, locale_t
, (locale_t locale
) _GL_ARG_NONNULL ((1)));
255 _GL_CXXALIAS_RPL (duplocale
, locale_t
, (locale_t locale
));
257 # if @HAVE_DUPLOCALE@
258 _GL_CXXALIAS_SYS (duplocale
, locale_t
, (locale_t locale
));
261 # if @HAVE_DUPLOCALE@
262 _GL_CXXALIASWARN (duplocale
);
264 # if @HAVE_DUPLOCALE@ || @REPLACE_DUPLOCALE@
265 # ifndef HAVE_WORKING_DUPLOCALE
266 # define HAVE_WORKING_DUPLOCALE 1
269 #elif defined GNULIB_POSIXCHECK
271 # if HAVE_RAW_DECL_DUPLOCALE
272 _GL_WARN_ON_USE (duplocale
, "duplocale is buggy on some glibc systems - "
273 "use gnulib module duplocale for portability");
277 #if /*@GNULIB_FREELOCALE@ ||*/ (@GNULIB_LOCALENAME@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_FREELOCALE@)
278 # if @REPLACE_FREELOCALE@
279 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
281 # define freelocale rpl_freelocale
282 # define GNULIB_defined_freelocale 1
284 _GL_FUNCDECL_RPL (freelocale
, void, (locale_t locale
) _GL_ARG_NONNULL ((1)));
285 _GL_CXXALIAS_RPL (freelocale
, void, (locale_t locale
));
287 # if @HAVE_FREELOCALE@
288 /* Need to cast, because on FreeBSD and Mac OS X 10.13, the return type is
290 _GL_CXXALIAS_SYS_CAST (freelocale
, void, (locale_t locale
));
293 # if @HAVE_FREELOCALE@
294 _GL_CXXALIASWARN (freelocale
);
296 #elif defined GNULIB_POSIXCHECK
298 # if HAVE_RAW_DECL_FREELOCALE
299 _GL_WARN_ON_USE (freelocale
, "freelocale is not portable");
303 #endif /* _@GUARD_PREFIX@_LOCALE_H */
304 #endif /* _@GUARD_PREFIX@_LOCALE_H */
305 #endif /* !(__need_locale_t || _GL_ALREADY_INCLUDING_LOCALE_H) */