Merge branch 'upstream' into stable
[gnulib.git] / lib / langinfo.in.h
1 /* Substitute for and wrapper around <langinfo.h>.
2    Copyright (C) 2009-2011 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 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 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, 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 _GL_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 _GL_LANGINFO_H
36 #define _GL_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 typedef int nl_item;
45
46 /* nl_langinfo items of the LC_CTYPE category */
47 # define CODESET     10000
48 /* nl_langinfo items of the LC_NUMERIC category */
49 # define RADIXCHAR   10001
50 # define THOUSEP     10002
51 /* nl_langinfo items of the LC_TIME category */
52 # define D_T_FMT     10003
53 # define D_FMT       10004
54 # define T_FMT       10005
55 # define T_FMT_AMPM  10006
56 # define AM_STR      10007
57 # define PM_STR      10008
58 # define DAY_1       10009
59 # define DAY_2       (DAY_1 + 1)
60 # define DAY_3       (DAY_1 + 2)
61 # define DAY_4       (DAY_1 + 3)
62 # define DAY_5       (DAY_1 + 4)
63 # define DAY_6       (DAY_1 + 5)
64 # define DAY_7       (DAY_1 + 6)
65 # define ABDAY_1     10016
66 # define ABDAY_2     (ABDAY_1 + 1)
67 # define ABDAY_3     (ABDAY_1 + 2)
68 # define ABDAY_4     (ABDAY_1 + 3)
69 # define ABDAY_5     (ABDAY_1 + 4)
70 # define ABDAY_6     (ABDAY_1 + 5)
71 # define ABDAY_7     (ABDAY_1 + 6)
72 # define MON_1       10023
73 # define MON_2       (MON_1 + 1)
74 # define MON_3       (MON_1 + 2)
75 # define MON_4       (MON_1 + 3)
76 # define MON_5       (MON_1 + 4)
77 # define MON_6       (MON_1 + 5)
78 # define MON_7       (MON_1 + 6)
79 # define MON_8       (MON_1 + 7)
80 # define MON_9       (MON_1 + 8)
81 # define MON_10      (MON_1 + 9)
82 # define MON_11      (MON_1 + 10)
83 # define MON_12      (MON_1 + 11)
84 # define ABMON_1     10035
85 # define ABMON_2     (ABMON_1 + 1)
86 # define ABMON_3     (ABMON_1 + 2)
87 # define ABMON_4     (ABMON_1 + 3)
88 # define ABMON_5     (ABMON_1 + 4)
89 # define ABMON_6     (ABMON_1 + 5)
90 # define ABMON_7     (ABMON_1 + 6)
91 # define ABMON_8     (ABMON_1 + 7)
92 # define ABMON_9     (ABMON_1 + 8)
93 # define ABMON_10    (ABMON_1 + 9)
94 # define ABMON_11    (ABMON_1 + 10)
95 # define ABMON_12    (ABMON_1 + 11)
96 # define ERA         10047
97 # define ERA_D_FMT   10048
98 # define ERA_D_T_FMT 10049
99 # define ERA_T_FMT   10050
100 # define ALT_DIGITS  10051
101 /* nl_langinfo items of the LC_MONETARY category */
102 # define CRNCYSTR    10052
103 /* nl_langinfo items of the LC_MESSAGES category */
104 # define YESEXPR     10053
105 # define NOEXPR      10054
106
107 #else
108
109 /* A platform that has <langinfo.h>.  */
110
111 # if !@HAVE_LANGINFO_CODESET@
112 #  define CODESET     10000
113 #  define GNULIB_defined_CODESET 1
114 # endif
115
116 # if !@HAVE_LANGINFO_T_FMT_AMPM@
117 #  define T_FMT_AMPM  10006
118 #  define GNULIB_defined_T_FMT_AMPM 1
119 # endif
120
121 # if !@HAVE_LANGINFO_ERA@
122 #  define ERA         10047
123 #  define ERA_D_FMT   10048
124 #  define ERA_D_T_FMT 10049
125 #  define ERA_T_FMT   10050
126 #  define ALT_DIGITS  10051
127 #  define GNULIB_defined_ERA 1
128 # endif
129
130 # if !@HAVE_LANGINFO_YESEXPR@
131 #  define YESEXPR     10053
132 #  define NOEXPR      10054
133 #  define GNULIB_defined_YESEXPR 1
134 # endif
135
136 #endif
137
138 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
139
140 /* The definition of _GL_WARN_ON_USE is copied here.  */
141
142 /* Declare overridden functions.  */
143
144
145 /* Return a piece of locale dependent information.
146    Note: The difference between nl_langinfo (CODESET) and locale_charset ()
147    is that the latter normalizes the encoding names to GNU conventions.  */
148
149 #if @GNULIB_NL_LANGINFO@
150 # if @REPLACE_NL_LANGINFO@
151 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
152 #   undef nl_langinfo
153 #   define nl_langinfo rpl_nl_langinfo
154 #  endif
155 _GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item));
156 _GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item));
157 # else
158 #  if !@HAVE_NL_LANGINFO@
159 _GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item));
160 #  endif
161 _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item));
162 # endif
163 _GL_CXXALIASWARN (nl_langinfo);
164 #elif defined GNULIB_POSIXCHECK
165 # undef nl_langinfo
166 # if HAVE_RAW_DECL_NL_LANGINFO
167 _GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - "
168                  "use gnulib module nl_langinfo for portability");
169 # endif
170 #endif
171
172
173 #endif /* _GL_LANGINFO_H */
174 #endif /* _GL_LANGINFO_H */