Commit | Line | Data |
---|---|---|
eb4a14ed LC |
1 | /* Substitute for and wrapper around <langinfo.h>. |
2 | Copyright (C) 2009-2012 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 Lesser General Public License as published by | |
6 | the Free Software Foundation; either version 2, or (at your option) | |
7 | 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 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, write to the Free Software Foundation, | |
16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | |
17 | ||
18 | /* | |
19 | * POSIX <langinfo.h> for platforms that lack it or have an incomplete one. | |
20 | * <http://www.opengroup.org/onlinepubs/9699919799/basedefs/langinfo.h.html> | |
21 | */ | |
22 | ||
23 | #ifndef _@GUARD_PREFIX@_LANGINFO_H | |
24 | ||
25 | #if __GNUC__ >= 3 | |
26 | @PRAGMA_SYSTEM_HEADER@ | |
27 | #endif | |
28 | @PRAGMA_COLUMNS@ | |
29 | ||
30 | /* The include_next requires a split double-inclusion guard. */ | |
31 | #if @HAVE_LANGINFO_H@ | |
32 | # @INCLUDE_NEXT@ @NEXT_LANGINFO_H@ | |
33 | #endif | |
34 | ||
35 | #ifndef _@GUARD_PREFIX@_LANGINFO_H | |
36 | #define _@GUARD_PREFIX@_LANGINFO_H | |
37 | ||
38 | ||
39 | #if !@HAVE_LANGINFO_H@ | |
40 | ||
41 | /* A platform that lacks <langinfo.h>. */ | |
42 | ||
43 | /* Assume that it also lacks <nl_types.h> and the nl_item type. */ | |
44 | # if !GNULIB_defined_nl_item | |
45 | typedef int nl_item; | |
46 | # define GNULIB_defined_nl_item 1 | |
47 | # endif | |
48 | ||
49 | /* nl_langinfo items of the LC_CTYPE category */ | |
50 | # define CODESET 10000 | |
51 | /* nl_langinfo items of the LC_NUMERIC category */ | |
52 | # define RADIXCHAR 10001 | |
53 | # define THOUSEP 10002 | |
54 | /* nl_langinfo items of the LC_TIME category */ | |
55 | # define D_T_FMT 10003 | |
56 | # define D_FMT 10004 | |
57 | # define T_FMT 10005 | |
58 | # define T_FMT_AMPM 10006 | |
59 | # define AM_STR 10007 | |
60 | # define PM_STR 10008 | |
61 | # define DAY_1 10009 | |
62 | # define DAY_2 (DAY_1 + 1) | |
63 | # define DAY_3 (DAY_1 + 2) | |
64 | # define DAY_4 (DAY_1 + 3) | |
65 | # define DAY_5 (DAY_1 + 4) | |
66 | # define DAY_6 (DAY_1 + 5) | |
67 | # define DAY_7 (DAY_1 + 6) | |
68 | # define ABDAY_1 10016 | |
69 | # define ABDAY_2 (ABDAY_1 + 1) | |
70 | # define ABDAY_3 (ABDAY_1 + 2) | |
71 | # define ABDAY_4 (ABDAY_1 + 3) | |
72 | # define ABDAY_5 (ABDAY_1 + 4) | |
73 | # define ABDAY_6 (ABDAY_1 + 5) | |
74 | # define ABDAY_7 (ABDAY_1 + 6) | |
75 | # define MON_1 10023 | |
76 | # define MON_2 (MON_1 + 1) | |
77 | # define MON_3 (MON_1 + 2) | |
78 | # define MON_4 (MON_1 + 3) | |
79 | # define MON_5 (MON_1 + 4) | |
80 | # define MON_6 (MON_1 + 5) | |
81 | # define MON_7 (MON_1 + 6) | |
82 | # define MON_8 (MON_1 + 7) | |
83 | # define MON_9 (MON_1 + 8) | |
84 | # define MON_10 (MON_1 + 9) | |
85 | # define MON_11 (MON_1 + 10) | |
86 | # define MON_12 (MON_1 + 11) | |
87 | # define ABMON_1 10035 | |
88 | # define ABMON_2 (ABMON_1 + 1) | |
89 | # define ABMON_3 (ABMON_1 + 2) | |
90 | # define ABMON_4 (ABMON_1 + 3) | |
91 | # define ABMON_5 (ABMON_1 + 4) | |
92 | # define ABMON_6 (ABMON_1 + 5) | |
93 | # define ABMON_7 (ABMON_1 + 6) | |
94 | # define ABMON_8 (ABMON_1 + 7) | |
95 | # define ABMON_9 (ABMON_1 + 8) | |
96 | # define ABMON_10 (ABMON_1 + 9) | |
97 | # define ABMON_11 (ABMON_1 + 10) | |
98 | # define ABMON_12 (ABMON_1 + 11) | |
99 | # define ERA 10047 | |
100 | # define ERA_D_FMT 10048 | |
101 | # define ERA_D_T_FMT 10049 | |
102 | # define ERA_T_FMT 10050 | |
103 | # define ALT_DIGITS 10051 | |
104 | /* nl_langinfo items of the LC_MONETARY category */ | |
105 | # define CRNCYSTR 10052 | |
106 | /* nl_langinfo items of the LC_MESSAGES category */ | |
107 | # define YESEXPR 10053 | |
108 | # define NOEXPR 10054 | |
109 | ||
110 | #else | |
111 | ||
112 | /* A platform that has <langinfo.h>. */ | |
113 | ||
114 | # if !@HAVE_LANGINFO_CODESET@ | |
115 | # define CODESET 10000 | |
116 | # define GNULIB_defined_CODESET 1 | |
117 | # endif | |
118 | ||
119 | # if !@HAVE_LANGINFO_T_FMT_AMPM@ | |
120 | # define T_FMT_AMPM 10006 | |
121 | # define GNULIB_defined_T_FMT_AMPM 1 | |
122 | # endif | |
123 | ||
124 | # if !@HAVE_LANGINFO_ERA@ | |
125 | # define ERA 10047 | |
126 | # define ERA_D_FMT 10048 | |
127 | # define ERA_D_T_FMT 10049 | |
128 | # define ERA_T_FMT 10050 | |
129 | # define ALT_DIGITS 10051 | |
130 | # define GNULIB_defined_ERA 1 | |
131 | # endif | |
132 | ||
133 | # if !@HAVE_LANGINFO_YESEXPR@ | |
134 | # define YESEXPR 10053 | |
135 | # define NOEXPR 10054 | |
136 | # define GNULIB_defined_YESEXPR 1 | |
137 | # endif | |
138 | ||
139 | #endif | |
140 | ||
141 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ | |
142 | ||
143 | /* The definition of _GL_WARN_ON_USE is copied here. */ | |
144 | ||
145 | /* Declare overridden functions. */ | |
146 | ||
147 | ||
148 | /* Return a piece of locale dependent information. | |
149 | Note: The difference between nl_langinfo (CODESET) and locale_charset () | |
150 | is that the latter normalizes the encoding names to GNU conventions. */ | |
151 | ||
152 | #if @GNULIB_NL_LANGINFO@ | |
153 | # if @REPLACE_NL_LANGINFO@ | |
154 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) | |
155 | # undef nl_langinfo | |
156 | # define nl_langinfo rpl_nl_langinfo | |
157 | # endif | |
158 | _GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item)); | |
159 | _GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item)); | |
160 | # else | |
161 | # if !@HAVE_NL_LANGINFO@ | |
162 | _GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item)); | |
163 | # endif | |
164 | _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item)); | |
165 | # endif | |
166 | _GL_CXXALIASWARN (nl_langinfo); | |
167 | #elif defined GNULIB_POSIXCHECK | |
168 | # undef nl_langinfo | |
169 | # if HAVE_RAW_DECL_NL_LANGINFO | |
170 | _GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - " | |
171 | "use gnulib module nl_langinfo for portability"); | |
172 | # endif | |
173 | #endif | |
174 | ||
175 | ||
176 | #endif /* _@GUARD_PREFIX@_LANGINFO_H */ | |
177 | #endif /* _@GUARD_PREFIX@_LANGINFO_H */ |