1 | /* Substitute for and wrapper around <langinfo.h>.
|
---|
2 | Copyright (C) 2009-2022 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 | /*
|
---|
18 | * POSIX <langinfo.h> for platforms that lack it or have an incomplete one.
|
---|
19 | * <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/langinfo.h.html>
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef _@GUARD_PREFIX@_LANGINFO_H
|
---|
23 |
|
---|
24 | #if __GNUC__ >= 3
|
---|
25 | @PRAGMA_SYSTEM_HEADER@
|
---|
26 | #endif
|
---|
27 | @PRAGMA_COLUMNS@
|
---|
28 |
|
---|
29 | /* The include_next requires a split double-inclusion guard. */
|
---|
30 | #if @HAVE_LANGINFO_H@
|
---|
31 | # @INCLUDE_NEXT@ @NEXT_LANGINFO_H@
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #ifndef _@GUARD_PREFIX@_LANGINFO_H
|
---|
35 | #define _@GUARD_PREFIX@_LANGINFO_H
|
---|
36 |
|
---|
37 |
|
---|
38 | #if !@HAVE_LANGINFO_H@
|
---|
39 |
|
---|
40 | /* A platform that lacks <langinfo.h>. */
|
---|
41 |
|
---|
42 | /* Assume that it also lacks <nl_types.h> and the nl_item type. */
|
---|
43 | # if !GNULIB_defined_nl_item
|
---|
44 | typedef int nl_item;
|
---|
45 | # define GNULIB_defined_nl_item 1
|
---|
46 | # endif
|
---|
47 |
|
---|
48 | /* nl_langinfo items of the LC_CTYPE category */
|
---|
49 | # define CODESET 10000
|
---|
50 | /* nl_langinfo items of the LC_NUMERIC category */
|
---|
51 | # define RADIXCHAR 10001
|
---|
52 | # define DECIMAL_POINT RADIXCHAR
|
---|
53 | # define THOUSEP 10002
|
---|
54 | # define THOUSANDS_SEP THOUSEP
|
---|
55 | # define GROUPING 10114
|
---|
56 | /* nl_langinfo items of the LC_TIME category */
|
---|
57 | # define D_T_FMT 10003
|
---|
58 | # define D_FMT 10004
|
---|
59 | # define T_FMT 10005
|
---|
60 | # define T_FMT_AMPM 10006
|
---|
61 | # define AM_STR 10007
|
---|
62 | # define PM_STR 10008
|
---|
63 | # define DAY_1 10009
|
---|
64 | # define DAY_2 (DAY_1 + 1)
|
---|
65 | # define DAY_3 (DAY_1 + 2)
|
---|
66 | # define DAY_4 (DAY_1 + 3)
|
---|
67 | # define DAY_5 (DAY_1 + 4)
|
---|
68 | # define DAY_6 (DAY_1 + 5)
|
---|
69 | # define DAY_7 (DAY_1 + 6)
|
---|
70 | # define ABDAY_1 10016
|
---|
71 | # define ABDAY_2 (ABDAY_1 + 1)
|
---|
72 | # define ABDAY_3 (ABDAY_1 + 2)
|
---|
73 | # define ABDAY_4 (ABDAY_1 + 3)
|
---|
74 | # define ABDAY_5 (ABDAY_1 + 4)
|
---|
75 | # define ABDAY_6 (ABDAY_1 + 5)
|
---|
76 | # define ABDAY_7 (ABDAY_1 + 6)
|
---|
77 | # define MON_1 10023
|
---|
78 | # define MON_2 (MON_1 + 1)
|
---|
79 | # define MON_3 (MON_1 + 2)
|
---|
80 | # define MON_4 (MON_1 + 3)
|
---|
81 | # define MON_5 (MON_1 + 4)
|
---|
82 | # define MON_6 (MON_1 + 5)
|
---|
83 | # define MON_7 (MON_1 + 6)
|
---|
84 | # define MON_8 (MON_1 + 7)
|
---|
85 | # define MON_9 (MON_1 + 8)
|
---|
86 | # define MON_10 (MON_1 + 9)
|
---|
87 | # define MON_11 (MON_1 + 10)
|
---|
88 | # define MON_12 (MON_1 + 11)
|
---|
89 | # define ALTMON_1 10200
|
---|
90 | # define ALTMON_2 (ALTMON_1 + 1)
|
---|
91 | # define ALTMON_3 (ALTMON_1 + 2)
|
---|
92 | # define ALTMON_4 (ALTMON_1 + 3)
|
---|
93 | # define ALTMON_5 (ALTMON_1 + 4)
|
---|
94 | # define ALTMON_6 (ALTMON_1 + 5)
|
---|
95 | # define ALTMON_7 (ALTMON_1 + 6)
|
---|
96 | # define ALTMON_8 (ALTMON_1 + 7)
|
---|
97 | # define ALTMON_9 (ALTMON_1 + 8)
|
---|
98 | # define ALTMON_10 (ALTMON_1 + 9)
|
---|
99 | # define ALTMON_11 (ALTMON_1 + 10)
|
---|
100 | # define ALTMON_12 (ALTMON_1 + 11)
|
---|
101 | # define ABMON_1 10035
|
---|
102 | # define ABMON_2 (ABMON_1 + 1)
|
---|
103 | # define ABMON_3 (ABMON_1 + 2)
|
---|
104 | # define ABMON_4 (ABMON_1 + 3)
|
---|
105 | # define ABMON_5 (ABMON_1 + 4)
|
---|
106 | # define ABMON_6 (ABMON_1 + 5)
|
---|
107 | # define ABMON_7 (ABMON_1 + 6)
|
---|
108 | # define ABMON_8 (ABMON_1 + 7)
|
---|
109 | # define ABMON_9 (ABMON_1 + 8)
|
---|
110 | # define ABMON_10 (ABMON_1 + 9)
|
---|
111 | # define ABMON_11 (ABMON_1 + 10)
|
---|
112 | # define ABMON_12 (ABMON_1 + 11)
|
---|
113 | # define ERA 10047
|
---|
114 | # define ERA_D_FMT 10048
|
---|
115 | # define ERA_D_T_FMT 10049
|
---|
116 | # define ERA_T_FMT 10050
|
---|
117 | # define ALT_DIGITS 10051
|
---|
118 | /* nl_langinfo items of the LC_MONETARY category */
|
---|
119 | # define CRNCYSTR 10052
|
---|
120 | # define CURRENCY_SYMBOL CRNCYSTR
|
---|
121 | # define INT_CURR_SYMBOL 10100
|
---|
122 | # define MON_DECIMAL_POINT 10101
|
---|
123 | # define MON_THOUSANDS_SEP 10102
|
---|
124 | # define MON_GROUPING 10103
|
---|
125 | # define POSITIVE_SIGN 10104
|
---|
126 | # define NEGATIVE_SIGN 10105
|
---|
127 | # define FRAC_DIGITS 10106
|
---|
128 | # define INT_FRAC_DIGITS 10107
|
---|
129 | # define P_CS_PRECEDES 10108
|
---|
130 | # define N_CS_PRECEDES 10109
|
---|
131 | # define P_SEP_BY_SPACE 10110
|
---|
132 | # define N_SEP_BY_SPACE 10111
|
---|
133 | # define P_SIGN_POSN 10112
|
---|
134 | # define N_SIGN_POSN 10113
|
---|
135 | /* nl_langinfo items of the LC_MESSAGES category */
|
---|
136 | # define YESEXPR 10053
|
---|
137 | # define NOEXPR 10054
|
---|
138 |
|
---|
139 | #else
|
---|
140 |
|
---|
141 | /* A platform that has <langinfo.h>. */
|
---|
142 |
|
---|
143 | # if !@HAVE_LANGINFO_CODESET@
|
---|
144 | # define CODESET 10000
|
---|
145 | # define GNULIB_defined_CODESET 1
|
---|
146 | # endif
|
---|
147 |
|
---|
148 | # if !@HAVE_LANGINFO_T_FMT_AMPM@
|
---|
149 | # define T_FMT_AMPM 10006
|
---|
150 | # define GNULIB_defined_T_FMT_AMPM 1
|
---|
151 | # endif
|
---|
152 |
|
---|
153 | # if !@HAVE_LANGINFO_ALTMON@
|
---|
154 | # define ALTMON_1 10200
|
---|
155 | # define ALTMON_2 (ALTMON_1 + 1)
|
---|
156 | # define ALTMON_3 (ALTMON_1 + 2)
|
---|
157 | # define ALTMON_4 (ALTMON_1 + 3)
|
---|
158 | # define ALTMON_5 (ALTMON_1 + 4)
|
---|
159 | # define ALTMON_6 (ALTMON_1 + 5)
|
---|
160 | # define ALTMON_7 (ALTMON_1 + 6)
|
---|
161 | # define ALTMON_8 (ALTMON_1 + 7)
|
---|
162 | # define ALTMON_9 (ALTMON_1 + 8)
|
---|
163 | # define ALTMON_10 (ALTMON_1 + 9)
|
---|
164 | # define ALTMON_11 (ALTMON_1 + 10)
|
---|
165 | # define ALTMON_12 (ALTMON_1 + 11)
|
---|
166 | # define GNULIB_defined_ALTMON 1
|
---|
167 | # endif
|
---|
168 |
|
---|
169 | # if !@HAVE_LANGINFO_ERA@
|
---|
170 | # define ERA 10047
|
---|
171 | # define ERA_D_FMT 10048
|
---|
172 | # define ERA_D_T_FMT 10049
|
---|
173 | # define ERA_T_FMT 10050
|
---|
174 | # define ALT_DIGITS 10051
|
---|
175 | # define GNULIB_defined_ERA 1
|
---|
176 | # endif
|
---|
177 |
|
---|
178 | # if !@HAVE_LANGINFO_YESEXPR@
|
---|
179 | # define YESEXPR 10053
|
---|
180 | # define NOEXPR 10054
|
---|
181 | # define GNULIB_defined_YESEXPR 1
|
---|
182 | # endif
|
---|
183 |
|
---|
184 | #endif
|
---|
185 |
|
---|
186 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
---|
187 |
|
---|
188 | /* The definition of _GL_WARN_ON_USE is copied here. */
|
---|
189 |
|
---|
190 | /* Declare overridden functions. */
|
---|
191 |
|
---|
192 |
|
---|
193 | /* Return a piece of locale dependent information.
|
---|
194 | Note: The difference between nl_langinfo (CODESET) and locale_charset ()
|
---|
195 | is that the latter normalizes the encoding names to GNU conventions. */
|
---|
196 |
|
---|
197 | #if @GNULIB_NL_LANGINFO@
|
---|
198 | # if @REPLACE_NL_LANGINFO@
|
---|
199 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
---|
200 | # undef nl_langinfo
|
---|
201 | # define nl_langinfo rpl_nl_langinfo
|
---|
202 | # endif
|
---|
203 | _GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item));
|
---|
204 | _GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item));
|
---|
205 | # else
|
---|
206 | # if !@HAVE_NL_LANGINFO@
|
---|
207 | _GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item));
|
---|
208 | # endif
|
---|
209 | _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item));
|
---|
210 | # endif
|
---|
211 | _GL_CXXALIASWARN (nl_langinfo);
|
---|
212 | #elif defined GNULIB_POSIXCHECK
|
---|
213 | # undef nl_langinfo
|
---|
214 | # if HAVE_RAW_DECL_NL_LANGINFO
|
---|
215 | _GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - "
|
---|
216 | "use gnulib module nl_langinfo for portability");
|
---|
217 | # endif
|
---|
218 | #endif
|
---|
219 |
|
---|
220 |
|
---|
221 | #endif /* _@GUARD_PREFIX@_LANGINFO_H */
|
---|
222 | #endif /* _@GUARD_PREFIX@_LANGINFO_H */
|
---|