1 /* Substitute for and wrapper around <langinfo.h>.
2 Copyright (C) 2009, 2010 Free Software Foundation, Inc.
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)
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.
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. */
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>
23 #ifndef _GL_LANGINFO_H
26 @PRAGMA_SYSTEM_HEADER@
30 /* The include_next requires a split double-inclusion guard. */
32 # @INCLUDE_NEXT@ @NEXT_LANGINFO_H@
35 #ifndef _GL_LANGINFO_H
36 #define _GL_LANGINFO_H
39 #if !@HAVE_LANGINFO_H@
41 /* A platform that lacks <langinfo.h>. */
43 /* Assume that it also lacks <nl_types.h> and the nl_item type. */
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
55 # define T_FMT_AMPM 10006
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)
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)
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
109 /* A platform that has <langinfo.h>. */
111 # if !@HAVE_LANGINFO_CODESET@
112 # define CODESET 10000
113 # define GNULIB_defined_CODESET 1
116 # if !@HAVE_LANGINFO_T_FMT_AMPM@
117 # define T_FMT_AMPM 10006
118 # define GNULIB_defined_T_FMT_AMPM 1
121 # if !@HAVE_LANGINFO_ERA@
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
130 # if !@HAVE_LANGINFO_YESEXPR@
131 # define YESEXPR 10053
132 # define NOEXPR 10054
133 # define GNULIB_defined_YESEXPR 1
138 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
140 /* The definition of _GL_WARN_ON_USE is copied here. */
142 /* Declare overridden functions. */
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. */
149 #if @GNULIB_NL_LANGINFO@
150 # if @REPLACE_NL_LANGINFO@
151 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
153 # define nl_langinfo rpl_nl_langinfo
155 _GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item));
156 _GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item));
158 # if !@HAVE_NL_LANGINFO@
159 _GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item));
161 _GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item));
163 _GL_CXXALIASWARN (nl_langinfo);
164 #elif defined GNULIB_POSIXCHECK
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");
173 #endif /* _GL_LANGINFO_H */
174 #endif /* _GL_LANGINFO_H */