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@
181 # define localeconv localeconv_used_without_requesting_gnulib_module_localeconv
182 #elif defined GNULIB_POSIXCHECK
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");
191 #if @GNULIB_SETLOCALE@
192 # if @REPLACE_SETLOCALE@
193 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
195 # define setlocale rpl_setlocale
196 # define GNULIB_defined_setlocale 1
198 _GL_FUNCDECL_RPL (setlocale
, char *, (int category
, const char *locale
));
199 _GL_CXXALIAS_RPL (setlocale
, char *, (int category
, const char *locale
));
201 _GL_CXXALIAS_SYS (setlocale
, char *, (int category
, const char *locale
));
204 _GL_CXXALIASWARN (setlocale
);
206 #elif defined GNULIB_POSIXCHECK
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");
214 #if @GNULIB_SETLOCALE_NULL@
215 /* Included here for convenience. */
216 # include "setlocale_null.h"
219 #if /*@GNULIB_NEWLOCALE@ ||*/ (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_NEWLOCALE@)
220 # if @REPLACE_NEWLOCALE@
221 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
223 # define newlocale rpl_newlocale
224 # define GNULIB_defined_newlocale 1
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
));
232 # if @HAVE_NEWLOCALE@
233 _GL_CXXALIAS_SYS (newlocale
, locale_t
,
234 (int category_mask
, const char *name
, locale_t base
));
237 # if __GLIBC__ >= 2 && @HAVE_NEWLOCALE@
238 _GL_CXXALIASWARN (newlocale
);
240 # if @HAVE_NEWLOCALE@ || @REPLACE_NEWLOCALE@
241 # ifndef HAVE_WORKING_NEWLOCALE
242 # define HAVE_WORKING_NEWLOCALE 1
245 #elif defined GNULIB_POSIXCHECK
247 # if HAVE_RAW_DECL_NEWLOCALE
248 _GL_WARN_ON_USE (newlocale
, "newlocale is not portable");
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)
257 # define duplocale rpl_duplocale
258 # define GNULIB_defined_duplocale 1
260 _GL_FUNCDECL_RPL (duplocale
, locale_t
, (locale_t locale
) _GL_ARG_NONNULL ((1)));
261 _GL_CXXALIAS_RPL (duplocale
, locale_t
, (locale_t locale
));
263 _GL_CXXALIAS_SYS (duplocale
, locale_t
, (locale_t locale
));
266 # if __GLIBC__ >= 2 && @HAVE_DUPLOCALE@
267 _GL_CXXALIASWARN (duplocale
);
269 # if @HAVE_DUPLOCALE@
270 # ifndef HAVE_WORKING_DUPLOCALE
271 # define HAVE_WORKING_DUPLOCALE 1
274 #elif defined GNULIB_POSIXCHECK
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");
282 #if /*@GNULIB_FREELOCALE@ ||*/ (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_FREELOCALE@)
283 # if @REPLACE_FREELOCALE@
284 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
286 # define freelocale rpl_freelocale
287 # define GNULIB_defined_freelocale 1
289 _GL_FUNCDECL_RPL (freelocale
, void, (locale_t locale
) _GL_ARG_NONNULL ((1)));
290 _GL_CXXALIAS_RPL (freelocale
, void, (locale_t locale
));
292 # if @HAVE_FREELOCALE@
293 /* Need to cast, because on FreeBSD and Mac OS X 10.13, the return type is
295 _GL_CXXALIAS_SYS_CAST (freelocale
, void, (locale_t locale
));
298 # if __GLIBC__ >= 2 && @HAVE_FREELOCALE@
299 _GL_CXXALIASWARN (freelocale
);
301 #elif defined GNULIB_POSIXCHECK
303 # if HAVE_RAW_DECL_FREELOCALE
304 _GL_WARN_ON_USE (freelocale
, "freelocale is not portable");
308 #endif /* _@GUARD_PREFIX@_LOCALE_H */
309 #endif /* _@GUARD_PREFIX@_LOCALE_H */
310 #endif /* !(__need_locale_t || _GL_ALREADY_INCLUDING_LOCALE_H) */