| 1 |
/* A POSIX <locale.h>. |
| 2 |
Copyright (C) 2007-2024 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 |
#if __GNUC__ >= 3 |
| 18 |
@PRAGMA_SYSTEM_HEADER@ |
| 19 |
#endif |
| 20 |
@PRAGMA_COLUMNS@ |
| 21 |
|
| 22 |
#if (defined _WIN32 && !defined __CYGWIN__ && defined __need_locale_t) \ |
| 23 |
|| defined _GL_ALREADY_INCLUDING_LOCALE_H |
| 24 |
|
| 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. */ |
| 29 |
|
| 30 |
#@INCLUDE_NEXT@ @NEXT_LOCALE_H@ |
| 31 |
|
| 32 |
#else |
| 33 |
/* Normal invocation convention. */ |
| 34 |
|
| 35 |
#ifndef _@GUARD_PREFIX@_LOCALE_H |
| 36 |
|
| 37 |
#define _GL_ALREADY_INCLUDING_LOCALE_H |
| 38 |
|
| 39 |
/* The include_next requires a split double-inclusion guard. */ |
| 40 |
#@INCLUDE_NEXT@ @NEXT_LOCALE_H@ |
| 41 |
|
| 42 |
#undef _GL_ALREADY_INCLUDING_LOCALE_H |
| 43 |
|
| 44 |
#ifndef _@GUARD_PREFIX@_LOCALE_H |
| 45 |
#define _@GUARD_PREFIX@_LOCALE_H |
| 46 |
|
| 47 |
/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ |
| 48 |
#if !_GL_CONFIG_H_INCLUDED |
| 49 |
#error "Please include config.h first." |
| 50 |
#endif |
| 51 |
|
| 52 |
/* NetBSD 5.0 mis-defines NULL. */ |
| 53 |
#include <stddef.h> |
| 54 |
|
| 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 |
| 59 |
|
| 60 |
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
| 61 |
|
| 62 |
/* The definition of _GL_ARG_NONNULL is copied here. */ |
| 63 |
|
| 64 |
/* The definition of _GL_WARN_ON_USE is copied here. */ |
| 65 |
|
| 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 |
| 71 |
|
| 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 |
| 83 |
|
| 84 |
/* Bionic libc's 'struct lconv' is just a dummy. */ |
| 85 |
#if @REPLACE_STRUCT_LCONV@ |
| 86 |
# define lconv rpl_lconv |
| 87 |
struct lconv |
| 88 |
{ |
| 89 |
/* All 'char *' are actually 'const char *'. */ |
| 90 |
|
| 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> */ |
| 93 |
|
| 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; |
| 102 |
|
| 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> */ |
| 105 |
|
| 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; |
| 118 |
|
| 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; |
| 140 |
|
| 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; |
| 162 |
}; |
| 163 |
#endif |
| 164 |
|
| 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 |
# if !GNULIB_LOCALECONV |
| 181 |
# undef localeconv |
| 182 |
# define localeconv localeconv_used_without_requesting_gnulib_module_localeconv |
| 183 |
# endif |
| 184 |
#elif defined GNULIB_POSIXCHECK |
| 185 |
# undef localeconv |
| 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"); |
| 190 |
# endif |
| 191 |
#endif |
| 192 |
|
| 193 |
#if @GNULIB_SETLOCALE@ |
| 194 |
# if @REPLACE_SETLOCALE@ |
| 195 |
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 196 |
# undef setlocale |
| 197 |
# define setlocale rpl_setlocale |
| 198 |
# define GNULIB_defined_setlocale 1 |
| 199 |
# endif |
| 200 |
_GL_FUNCDECL_RPL (setlocale, char *, (int category, const char *locale), ); |
| 201 |
_GL_CXXALIAS_RPL (setlocale, char *, (int category, const char *locale)); |
| 202 |
# else |
| 203 |
_GL_CXXALIAS_SYS (setlocale, char *, (int category, const char *locale)); |
| 204 |
# endif |
| 205 |
# if __GLIBC__ >= 2 |
| 206 |
_GL_CXXALIASWARN (setlocale); |
| 207 |
# endif |
| 208 |
#elif defined GNULIB_POSIXCHECK |
| 209 |
# undef setlocale |
| 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"); |
| 213 |
# endif |
| 214 |
#endif |
| 215 |
|
| 216 |
#if @GNULIB_SETLOCALE_NULL@ |
| 217 |
/* Included here for convenience. */ |
| 218 |
# include "setlocale_null.h" |
| 219 |
#endif |
| 220 |
|
| 221 |
#if /*@GNULIB_NEWLOCALE@ ||*/ (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_NEWLOCALE@) |
| 222 |
# if @REPLACE_NEWLOCALE@ |
| 223 |
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 224 |
# undef newlocale |
| 225 |
# define newlocale rpl_newlocale |
| 226 |
# define GNULIB_defined_newlocale 1 |
| 227 |
# endif |
| 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)); |
| 233 |
# else |
| 234 |
# if @HAVE_NEWLOCALE@ |
| 235 |
_GL_CXXALIAS_SYS (newlocale, locale_t, |
| 236 |
(int category_mask, const char *name, locale_t base)); |
| 237 |
# endif |
| 238 |
# endif |
| 239 |
# if __GLIBC__ >= 2 && @HAVE_NEWLOCALE@ |
| 240 |
_GL_CXXALIASWARN (newlocale); |
| 241 |
# endif |
| 242 |
# if @HAVE_NEWLOCALE@ || @REPLACE_NEWLOCALE@ |
| 243 |
# ifndef HAVE_WORKING_NEWLOCALE |
| 244 |
# define HAVE_WORKING_NEWLOCALE 1 |
| 245 |
# endif |
| 246 |
# endif |
| 247 |
#elif defined GNULIB_POSIXCHECK |
| 248 |
# undef newlocale |
| 249 |
# if HAVE_RAW_DECL_NEWLOCALE |
| 250 |
_GL_WARN_ON_USE (newlocale, "newlocale is not portable"); |
| 251 |
# endif |
| 252 |
#endif |
| 253 |
|
| 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) |
| 258 |
# undef duplocale |
| 259 |
# define duplocale rpl_duplocale |
| 260 |
# define GNULIB_defined_duplocale 1 |
| 261 |
# endif |
| 262 |
_GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale), _GL_ARG_NONNULL ((1))); |
| 263 |
_GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale)); |
| 264 |
# else |
| 265 |
_GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale)); |
| 266 |
# endif |
| 267 |
# endif |
| 268 |
# if __GLIBC__ >= 2 && @HAVE_DUPLOCALE@ |
| 269 |
_GL_CXXALIASWARN (duplocale); |
| 270 |
# endif |
| 271 |
# if @HAVE_DUPLOCALE@ |
| 272 |
# ifndef HAVE_WORKING_DUPLOCALE |
| 273 |
# define HAVE_WORKING_DUPLOCALE 1 |
| 274 |
# endif |
| 275 |
# endif |
| 276 |
#elif defined GNULIB_POSIXCHECK |
| 277 |
# undef duplocale |
| 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"); |
| 281 |
# endif |
| 282 |
#endif |
| 283 |
|
| 284 |
#if /*@GNULIB_FREELOCALE@ ||*/ (@GNULIB_LOCALENAME_UNSAFE@ && @LOCALENAME_ENHANCE_LOCALE_FUNCS@ && @HAVE_FREELOCALE@) |
| 285 |
# if @REPLACE_FREELOCALE@ |
| 286 |
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 287 |
# undef freelocale |
| 288 |
# define freelocale rpl_freelocale |
| 289 |
# define GNULIB_defined_freelocale 1 |
| 290 |
# endif |
| 291 |
_GL_FUNCDECL_RPL (freelocale, void, (locale_t locale), _GL_ARG_NONNULL ((1))); |
| 292 |
_GL_CXXALIAS_RPL (freelocale, void, (locale_t locale)); |
| 293 |
# else |
| 294 |
# if @HAVE_FREELOCALE@ |
| 295 |
/* Need to cast, because on FreeBSD and Mac OS X 10.13, the return type is |
| 296 |
int. */ |
| 297 |
_GL_CXXALIAS_SYS_CAST (freelocale, void, (locale_t locale)); |
| 298 |
# endif |
| 299 |
# endif |
| 300 |
# if __GLIBC__ >= 2 && @HAVE_FREELOCALE@ |
| 301 |
_GL_CXXALIASWARN (freelocale); |
| 302 |
# endif |
| 303 |
#elif defined GNULIB_POSIXCHECK |
| 304 |
# undef freelocale |
| 305 |
# if HAVE_RAW_DECL_FREELOCALE |
| 306 |
_GL_WARN_ON_USE (freelocale, "freelocale is not portable"); |
| 307 |
# endif |
| 308 |
#endif |
| 309 |
|
| 310 |
#endif /* _@GUARD_PREFIX@_LOCALE_H */ |
| 311 |
#endif /* _@GUARD_PREFIX@_LOCALE_H */ |
| 312 |
#endif /* !(__need_locale_t || _GL_ALREADY_INCLUDING_LOCALE_H) */ |