123df7a526e4f4defa8a62e68cce2d02e7cc6b1a
[platform/upstream/diffutils.git] / lib / locale.in.h
1 /* A POSIX <locale.h>.
2    Copyright (C) 2007-2018 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 /* Bionic libc's 'struct lconv' is just a dummy.  */
68 #if @REPLACE_STRUCT_LCONV@
69 # define lconv rpl_lconv
70 struct lconv
71 {
72   /* All 'char *' are actually 'const char *'.  */
73
74   /* Members that depend on the LC_NUMERIC category of the locale.  See
75      <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_04> */
76
77   /* Symbol used as decimal point.  */
78   char *decimal_point;
79   /* Symbol used to separate groups of digits to the left of the decimal
80      point.  */
81   char *thousands_sep;
82   /* Definition of the size of groups of digits to the left of the decimal
83      point.  */
84   char *grouping;
85
86   /* Members that depend on the LC_MONETARY category of the locale.  See
87      <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_03> */
88
89   /* Symbol used as decimal point.  */
90   char *mon_decimal_point;
91   /* Symbol used to separate groups of digits to the left of the decimal
92      point.  */
93   char *mon_thousands_sep;
94   /* Definition of the size of groups of digits to the left of the decimal
95      point.  */
96   char *mon_grouping;
97   /* Sign used to indicate a value >= 0.  */
98   char *positive_sign;
99   /* Sign used to indicate a value < 0.  */
100   char *negative_sign;
101
102   /* For formatting local currency.  */
103   /* Currency symbol (3 characters) followed by separator (1 character).  */
104   char *currency_symbol;
105   /* Number of digits after the decimal point.  */
106   char frac_digits;
107   /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
108      comes after the number.  */
109   char p_cs_precedes;
110   /* For values >= 0: Position of the sign.  */
111   char p_sign_posn;
112   /* For values >= 0: Placement of spaces between currency symbol, sign, and
113      number.  */
114   char p_sep_by_space;
115   /* For values < 0: 1 if the currency symbol precedes the number, 0 if it
116      comes after the number.  */
117   char n_cs_precedes;
118   /* For values < 0: Position of the sign.  */
119   char n_sign_posn;
120   /* For values < 0: Placement of spaces between currency symbol, sign, and
121      number.  */
122   char n_sep_by_space;
123
124   /* For formatting international currency.  */
125   /* Currency symbol (3 characters) followed by separator (1 character).  */
126   char *int_curr_symbol;
127   /* Number of digits after the decimal point.  */
128   char int_frac_digits;
129   /* For values >= 0: 1 if the currency symbol precedes the number, 0 if it
130      comes after the number.  */
131   char int_p_cs_precedes;
132   /* For values >= 0: Position of the sign.  */
133   char int_p_sign_posn;
134   /* For values >= 0: Placement of spaces between currency symbol, sign, and
135      number.  */
136   char int_p_sep_by_space;
137   /* For values < 0: 1 if the currency symbol precedes the number, 0 if it
138      comes after the number.  */
139   char int_n_cs_precedes;
140   /* For values < 0: Position of the sign.  */
141   char int_n_sign_posn;
142   /* For values < 0: Placement of spaces between currency symbol, sign, and
143      number.  */
144   char int_n_sep_by_space;
145 };
146 #endif
147
148 #if @GNULIB_LOCALECONV@
149 # if @REPLACE_LOCALECONV@
150 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
151 #   undef localeconv
152 #   define localeconv rpl_localeconv
153 #  endif
154 _GL_FUNCDECL_RPL (localeconv, struct lconv *, (void));
155 _GL_CXXALIAS_RPL (localeconv, struct lconv *, (void));
156 # else
157 _GL_CXXALIAS_SYS (localeconv, struct lconv *, (void));
158 # endif
159 _GL_CXXALIASWARN (localeconv);
160 #elif @REPLACE_STRUCT_LCONV@
161 # undef localeconv
162 # define localeconv localeconv_used_without_requesting_gnulib_module_localeconv
163 #elif defined GNULIB_POSIXCHECK
164 # undef localeconv
165 # if HAVE_RAW_DECL_LOCALECONV
166 _GL_WARN_ON_USE (localeconv,
167                  "localeconv returns too few information on some platforms - "
168                  "use gnulib module localeconv for portability");
169 # endif
170 #endif
171
172 #if @GNULIB_SETLOCALE@
173 # if @REPLACE_SETLOCALE@
174 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
175 #   undef setlocale
176 #   define setlocale rpl_setlocale
177 #   define GNULIB_defined_setlocale 1
178 #  endif
179 _GL_FUNCDECL_RPL (setlocale, char *, (int category, const char *locale));
180 _GL_CXXALIAS_RPL (setlocale, char *, (int category, const char *locale));
181 # else
182 _GL_CXXALIAS_SYS (setlocale, char *, (int category, const char *locale));
183 # endif
184 _GL_CXXALIASWARN (setlocale);
185 #elif defined GNULIB_POSIXCHECK
186 # undef setlocale
187 # if HAVE_RAW_DECL_SETLOCALE
188 _GL_WARN_ON_USE (setlocale, "setlocale works differently on native Windows - "
189                  "use gnulib module setlocale for portability");
190 # endif
191 #endif
192
193 #if /*@GNULIB_NEWLOCALE@ ||*/ (@GNULIB_LOCALENAME@ && @HAVE_NEWLOCALE@)
194 # if @REPLACE_NEWLOCALE@
195 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
196 #   undef newlocale
197 #   define newlocale rpl_newlocale
198 #   define GNULIB_defined_newlocale 1
199 #  endif
200 _GL_FUNCDECL_RPL (newlocale, locale_t,
201                   (int category_mask, const char *name, locale_t base)
202                   _GL_ARG_NONNULL ((2)));
203 _GL_CXXALIAS_RPL (newlocale, locale_t,
204                   (int category_mask, const char *name, locale_t base));
205 # else
206 #  if @HAVE_NEWLOCALE@
207 _GL_CXXALIAS_SYS (newlocale, locale_t,
208                   (int category_mask, const char *name, locale_t base));
209 #  endif
210 # endif
211 # if @HAVE_NEWLOCALE@
212 _GL_CXXALIASWARN (newlocale);
213 # endif
214 #elif defined GNULIB_POSIXCHECK
215 # undef newlocale
216 # if HAVE_RAW_DECL_NEWLOCALE
217 _GL_WARN_ON_USE (newlocale, "newlocale is not portable");
218 # endif
219 #endif
220
221 #if @GNULIB_DUPLOCALE@ || (@GNULIB_LOCALENAME@ && @HAVE_DUPLOCALE@)
222 # if @REPLACE_DUPLOCALE@
223 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
224 #   undef duplocale
225 #   define duplocale rpl_duplocale
226 #   define GNULIB_defined_duplocale 1
227 #  endif
228 _GL_FUNCDECL_RPL (duplocale, locale_t, (locale_t locale) _GL_ARG_NONNULL ((1)));
229 _GL_CXXALIAS_RPL (duplocale, locale_t, (locale_t locale));
230 # else
231 #  if @HAVE_DUPLOCALE@
232 _GL_CXXALIAS_SYS (duplocale, locale_t, (locale_t locale));
233 #  endif
234 # endif
235 # if @HAVE_DUPLOCALE@
236 _GL_CXXALIASWARN (duplocale);
237 # endif
238 #elif defined GNULIB_POSIXCHECK
239 # undef duplocale
240 # if HAVE_RAW_DECL_DUPLOCALE
241 _GL_WARN_ON_USE (duplocale, "duplocale is buggy on some glibc systems - "
242                  "use gnulib module duplocale for portability");
243 # endif
244 #endif
245
246 #if /*@GNULIB_FREELOCALE@ ||*/ (@GNULIB_LOCALENAME@ && @HAVE_FREELOCALE@)
247 # if @REPLACE_FREELOCALE@
248 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
249 #   undef freelocale
250 #   define freelocale rpl_freelocale
251 #   define GNULIB_defined_freelocale 1
252 #  endif
253 _GL_FUNCDECL_RPL (freelocale, void, (locale_t locale) _GL_ARG_NONNULL ((1)));
254 _GL_CXXALIAS_RPL (freelocale, void, (locale_t locale));
255 # else
256 #  if @HAVE_FREELOCALE@
257 _GL_CXXALIAS_SYS (freelocale, void, (locale_t locale));
258 #  endif
259 # endif
260 # if @HAVE_FREELOCALE@
261 _GL_CXXALIASWARN (freelocale);
262 # endif
263 #elif defined GNULIB_POSIXCHECK
264 # undef freelocale
265 # if HAVE_RAW_DECL_FREELOCALE
266 _GL_WARN_ON_USE (freelocale, "freelocale is not portable");
267 # endif
268 #endif
269
270 #endif /* _@GUARD_PREFIX@_LOCALE_H */
271 #endif /* _@GUARD_PREFIX@_LOCALE_H */
272 #endif /* !(__need_locale_t || _GL_ALREADY_INCLUDING_LOCALE_H) */