1/* A POSIX <locale.h>. 2 Copyright (C) 2007-2020 Free Software Foundation, Inc. 3 4 This program is free software: you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 3 of the License, or 7 (at your option) any later version. 8 9 This program 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 General Public License for more details. 13 14 You should have received a copy of the GNU 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/* NetBSD 5.0 mis-defines NULL. */ 48#include <stddef.h> 49 50/* Mac OS X 10.5 defines the locale_t type in <xlocale.h>. */ 51#if @HAVE_XLOCALE_H@ 52# include <xlocale.h> 53#endif 54 55/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ 56 57/* The definition of _GL_ARG_NONNULL is copied here. */ 58 59/* The definition of _GL_WARN_ON_USE is copied here. */ 60 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 65#endif 66 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. */ 70#if defined _MSC_VER 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 77#endif 78 79/* Bionic libc's 'struct lconv' is just a dummy. */ 80#if @REPLACE_STRUCT_LCONV@ 81# define lconv rpl_lconv 82struct lconv 83{ 84 /* All 'char *' are actually 'const char *'. */ 85 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> */ 88 89 /* Symbol used as decimal point. */ 90 char *decimal_point; 91 /* Symbol used to separate groups of digits to the left of the decimal 92 point. */ 93 char *thousands_sep; 94 /* Definition of the size of groups of digits to the left of the decimal 95 point. */ 96 char *grouping; 97 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> */ 100 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 104 point. */ 105 char *mon_thousands_sep; 106 /* Definition of the size of groups of digits to the left of the decimal 107 point. */ 108 char *mon_grouping; 109 /* Sign used to indicate a value >= 0. */ 110 char *positive_sign; 111 /* Sign used to indicate a value < 0. */ 112 char *negative_sign; 113 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. */ 118 char frac_digits; 119 /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it 120 comes after the number. */ 121 char p_cs_precedes; 122 /* For values >= 0: Position of the sign. */ 123 char p_sign_posn; 124 /* For values >= 0: Placement of spaces between currency symbol, sign, and 125 number. */ 126 char p_sep_by_space; 127 /* For values < 0: 1 if the currency symbol precedes the number, 0 if it 128 comes after the number. */ 129 char n_cs_precedes; 130 /* For values < 0: Position of the sign. */ 131 char n_sign_posn; 132 /* For values < 0: Placement of spaces between currency symbol, sign, and 133 number. */ 134 char n_sep_by_space; 135 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 147 number. */ 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 155 number. */ 156 char int_n_sep_by_space; 157}; 158#endif 159 160#if @GNULIB_LOCALECONV@ 161# if @REPLACE_LOCALECONV@ 162# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 163# undef localeconv 164# define localeconv rpl_localeconv 165# endif 166_GL_FUNCDECL_RPL (localeconv, struct lconv *, (void)); 167_GL_CXXALIAS_RPL (localeconv, struct lconv *, (void)); 168# else 169_GL_CXXALIAS_SYS (localeconv, struct lconv *, (void)); 170# endif 171# if __GLIBC__ >= 2 172_GL_CXXALIASWARN (localeconv); 173# endif 174#elif @REPLACE_STRUCT_LCONV@ 175# undef localeconv 176# define localeconv localeconv_used_without_requesting_gnulib_module_localeconv 177#elif defined GNULIB_POSIXCHECK 178# undef localeconv 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"); 183# endif 184#endif 185 186#if @GNULIB_SETLOCALE@ 187# if @REPLACE_SETLOCALE@ 188# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 189# undef setlocale 190# define setlocale rpl_setlocale 191# define GNULIB_defined_setlocale 1 192# endif 193_GL_FUNCDECL_RPL (setlocale, char *, (int category, const char *locale)); 194_GL_CXXALIAS_RPL (setlocale, char *, (int category, const char *locale)); 195# else 196_GL_CXXALIAS_SYS (setlocale, char *, (int category, const char *locale)); 197# endif 198# if __GLIBC__ >= 2 199_GL_CXXALIASWARN (setlocale); 200# endif 201#elif defined GNULIB_POSIXCHECK 202# undef setlocale 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"); 206# endif 207#endif 208 209#if @GNULIB_SETLOCALE_NULL@ 210/* Included here for convenience. */ 211# include "setlocale_null.h" 212#endif 213 214#if /*@GNULIB_NEWLOCALE@ ||*/ (@GNULIB_LOCALENAME@ && @HAVE_NEWLOCALE@) 215# if @REPLACE_NEWLOCALE@ 216# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 217# undef newlocale 218# define newlocale rpl_newlocale 219# define GNULIB_defined_newlocale 1 220# endif 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)); 226# else 227# if @HAVE_NEWLOCALE@ 228_GL_CXXALIAS_SYS (newlocale, locale_t, 229 (int category_mask, const char *name, locale_t base)); 230# endif 231# endif 232# if @HAVE_NEWLOCALE@ 233_GL_CXXALIASWARN (newlocale); 234# endif 235# if @HAVE_NEWLOCALE@ || @REPLACE_NEWLOCALE@ 236# ifndef HAVE_WORKING_NEWLOCALE 237# define HAVE_WORKING_NEWLOCALE 1 238# endif 239# endif 240#elif defined GNULIB_POSIXCHECK 241# undef newlocale 242# if HAVE_RAW_DECL_NEWLOCALE 243_GL_WARN_ON_USE (newlocale, "newlocale is not portable"); 244# endif 245#endif 246 247#if @GNULIB_DUPLOCALE@ || (@GNULIB_LOCALENAME@ && @HAVE_DUPLOCALE@) 248# if @REPLACE_DUPLOCALE@ 249# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 250# undef duplocale 251# define duplocale rpl_duplocale 252# define GNULIB_defined_duplocale 1 253# endif 254_GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale) _GL_ARG_NONNULL ((1))); 255_GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale)); 256# else 257# if @HAVE_DUPLOCALE@ 258_GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale)); 259# endif 260# endif 261# if @HAVE_DUPLOCALE@ 262_GL_CXXALIASWARN (duplocale); 263# endif 264# if @HAVE_DUPLOCALE@ || @REPLACE_DUPLOCALE@ 265# ifndef HAVE_WORKING_DUPLOCALE 266# define HAVE_WORKING_DUPLOCALE 1 267# endif 268# endif 269#elif defined GNULIB_POSIXCHECK 270# undef duplocale 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"); 274# endif 275#endif 276 277#if /*@GNULIB_FREELOCALE@ ||*/ (@GNULIB_LOCALENAME@ && @HAVE_FREELOCALE@) 278# if @REPLACE_FREELOCALE@ 279# if !(defined __cplusplus && defined GNULIB_NAMESPACE) 280# undef freelocale 281# define freelocale rpl_freelocale 282# define GNULIB_defined_freelocale 1 283# endif 284_GL_FUNCDECL_RPL (freelocale, void, (locale_t locale) _GL_ARG_NONNULL ((1))); 285_GL_CXXALIAS_RPL (freelocale, void, (locale_t locale)); 286# else 287# if @HAVE_FREELOCALE@ 288/* Need to cast, because on FreeBSD and Mac OS X 10.13, the return type is 289 int. */ 290_GL_CXXALIAS_SYS_CAST (freelocale, void, (locale_t locale)); 291# endif 292# endif 293# if @HAVE_FREELOCALE@ 294_GL_CXXALIASWARN (freelocale); 295# endif 296#elif defined GNULIB_POSIXCHECK 297# undef freelocale 298# if HAVE_RAW_DECL_FREELOCALE 299_GL_WARN_ON_USE (freelocale, "freelocale is not portable"); 300# endif 301#endif 302 303#endif /* _@GUARD_PREFIX@_LOCALE_H */ 304#endif /* _@GUARD_PREFIX@_LOCALE_H */ 305#endif /* !(__need_locale_t || _GL_ALREADY_INCLUDING_LOCALE_H) */ 306