1 /*-
2  * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  * $FreeBSD: src/include/langinfo.h,v 1.5 2002/03/23 17:24:53 imp Exp $
27  */
28 
29 #ifndef _LANGINFO_H_
30 #define	_LANGINFO_H_
31 
32 #include <sys/cdefs.h>
33 #include <sys/_types.h>
34 #if __POSIX_VISIBLE >= 200809
35 #include <sys/_locale.h>
36 #endif
37 
38 #ifndef _NL_ITEM_DECLARED
39 typedef __nl_item nl_item;
40 #define _NL_ITEM_DECLARED
41 #endif
42 
43 enum
44 {
45   /* POSIX and BSD defined items have to stick to the original values
46      to maintain backward compatibility. */
47   _NL_CTYPE_CODESET_NAME = 0,	/* codeset name */
48 #define CODESET _NL_CTYPE_CODESET_NAME
49   D_T_FMT,			/* string for formatting date and time */
50 #define D_T_FMT D_T_FMT
51   D_FMT,			/* date format string */
52 #define D_FMT D_FMT
53   T_FMT,			/* time format string */
54 #define T_FMT T_FMT
55   T_FMT_AMPM,			/* a.m. or p.m. time formatting string */
56 #define T_FMT_AMPM T_FMT_AMPM
57   AM_STR,			/* Ante Meridian affix */
58 #define AM_STR AM_STR
59   PM_STR,			/* Post Meridian affix */
60 #define PM_STR PM_STR
61 
62 /* week day names */
63   DAY_1,
64 #define DAY_1 DAY_1
65   DAY_2,
66 #define DAY_2 DAY_2
67   DAY_3,
68 #define DAY_3 DAY_3
69   DAY_4,
70 #define DAY_4 DAY_4
71   DAY_5,
72 #define DAY_5 DAY_5
73   DAY_6,
74 #define DAY_6 DAY_6
75   DAY_7,
76 #define DAY_7 DAY_7
77 
78 /* abbreviated week day names */
79   ABDAY_1,
80 #define ABDAY_1 ABDAY_1
81   ABDAY_2,
82 #define ABDAY_2 ABDAY_2
83   ABDAY_3,
84 #define ABDAY_3 ABDAY_3
85   ABDAY_4,
86 #define ABDAY_4 ABDAY_4
87   ABDAY_5,
88 #define ABDAY_5 ABDAY_5
89   ABDAY_6,
90 #define ABDAY_6 ABDAY_6
91   ABDAY_7,
92 #define ABDAY_7 ABDAY_7
93 
94 /* month names */
95   MON_1,
96 #define MON_1 MON_1
97   MON_2,
98 #define MON_2 MON_2
99   MON_3,
100 #define MON_3 MON_3
101   MON_4,
102 #define MON_4 MON_4
103   MON_5,
104 #define MON_5 MON_5
105   MON_6,
106 #define MON_6 MON_6
107   MON_7,
108 #define MON_7 MON_7
109   MON_8,
110 #define MON_8 MON_8
111   MON_9,
112 #define MON_9 MON_9
113   MON_10,
114 #define MON_10 MON_10
115   MON_11,
116 #define MON_11 MON_11
117   MON_12,
118 #define MON_12 MON_12
119 
120 /* abbreviated month names */
121   ABMON_1,
122 #define ABMON_1 ABMON_1
123   ABMON_2,
124 #define ABMON_2 ABMON_2
125   ABMON_3,
126 #define ABMON_3 ABMON_3
127   ABMON_4,
128 #define ABMON_4 ABMON_4
129   ABMON_5,
130 #define ABMON_5 ABMON_5
131   ABMON_6,
132 #define ABMON_6 ABMON_6
133   ABMON_7,
134 #define ABMON_7 ABMON_7
135   ABMON_8,
136 #define ABMON_8 ABMON_8
137   ABMON_9,
138 #define ABMON_9 ABMON_9
139   ABMON_10,
140 #define ABMON_10 ABMON_10
141   ABMON_11,
142 #define ABMON_11 ABMON_11
143   ABMON_12,
144 #define ABMON_12 ABMON_12
145 
146   ERA,				/* era description segments */
147 #define ERA ERA
148   ERA_D_FMT,			/* era date format string */
149 #define ERA_D_FMT ERA_D_FMT
150   ERA_D_T_FMT,			/* era date and time format string */
151 #define ERA_D_T_FMT ERA_D_T_FMT
152   ERA_T_FMT,			/* era time format string */
153 #define ERA_T_FMT ERA_T_FMT
154   ALT_DIGITS,			/* alternative symbols for digits */
155 #define ALT_DIGITS ALT_DIGITS
156 
157   RADIXCHAR,			/* radix char */
158 #define RADIXCHAR RADIXCHAR
159   THOUSEP,			/* separator for thousands */
160 #define THOUSEP THOUSEP
161 
162   YESEXPR,			/* affirmative response expression */
163 #define YESEXPR YESEXPR
164   NOEXPR,			/* negative response expression */
165 #define NOEXPR NOEXPR
166   YESSTR,			/* affirmative response for yes/no queries */
167 #define YESSTR YESSTR
168   NOSTR,			/* negative response for yes/no queries */
169 #define NOSTR NOSTR
170 
171   CRNCYSTR,			/* currency symbol */
172 #define CRNCYSTR CRNCYSTR
173 
174   D_MD_ORDER,			/* month/day order (BSD extension) */
175 #define D_MD_ORDER D_MD_ORDER
176 
177   _NL_TIME_DATE_FMT = 84,	/* date fmt used by date(1) (GNU extension) */
178 #define _DATE_FMT _NL_TIME_DATE_FMT
179 
180 #ifdef __HAVE_LOCALE_INFO__
181   _NL_CTYPE_MB_CUR_MAX,
182   _NL_MESSAGES_CODESET,
183 
184 #ifdef __HAVE_LOCALE_INFO_EXTENDED__
185 
186   /* NOTE:
187 
188      Always maintain the order and position of existing entries!
189      Always append new entry to the list, prior to the definition
190      of _NL_LOCALE_EXTENDED_LAST_ENTRY. */
191 
192   _NL_LOCALE_EXTENDED_FIRST_ENTRY,
193 
194   _NL_CTYPE_OUTDIGITS0_MB,
195   _NL_CTYPE_OUTDIGITS1_MB,
196   _NL_CTYPE_OUTDIGITS2_MB,
197   _NL_CTYPE_OUTDIGITS3_MB,
198   _NL_CTYPE_OUTDIGITS4_MB,
199   _NL_CTYPE_OUTDIGITS5_MB,
200   _NL_CTYPE_OUTDIGITS6_MB,
201   _NL_CTYPE_OUTDIGITS7_MB,
202   _NL_CTYPE_OUTDIGITS8_MB,
203   _NL_CTYPE_OUTDIGITS9_MB,
204   _NL_CTYPE_OUTDIGITS0_WC,
205   _NL_CTYPE_OUTDIGITS1_WC,
206   _NL_CTYPE_OUTDIGITS2_WC,
207   _NL_CTYPE_OUTDIGITS3_WC,
208   _NL_CTYPE_OUTDIGITS4_WC,
209   _NL_CTYPE_OUTDIGITS5_WC,
210   _NL_CTYPE_OUTDIGITS6_WC,
211   _NL_CTYPE_OUTDIGITS7_WC,
212   _NL_CTYPE_OUTDIGITS8_WC,
213   _NL_CTYPE_OUTDIGITS9_WC,
214 
215   _NL_TIME_CODESET,
216   _NL_TIME_WMON_1,
217   _NL_TIME_WMON_2,
218   _NL_TIME_WMON_3,
219   _NL_TIME_WMON_4,
220   _NL_TIME_WMON_5,
221   _NL_TIME_WMON_6,
222   _NL_TIME_WMON_7,
223   _NL_TIME_WMON_8,
224   _NL_TIME_WMON_9,
225   _NL_TIME_WMON_10,
226   _NL_TIME_WMON_11,
227   _NL_TIME_WMON_12,
228   _NL_TIME_WMONTH_1,
229   _NL_TIME_WMONTH_2,
230   _NL_TIME_WMONTH_3,
231   _NL_TIME_WMONTH_4,
232   _NL_TIME_WMONTH_5,
233   _NL_TIME_WMONTH_6,
234   _NL_TIME_WMONTH_7,
235   _NL_TIME_WMONTH_8,
236   _NL_TIME_WMONTH_9,
237   _NL_TIME_WMONTH_10,
238   _NL_TIME_WMONTH_11,
239   _NL_TIME_WMONTH_12,
240   _NL_TIME_WWDAY_1,
241   _NL_TIME_WWDAY_2,
242   _NL_TIME_WWDAY_3,
243   _NL_TIME_WWDAY_4,
244   _NL_TIME_WWDAY_5,
245   _NL_TIME_WWDAY_6,
246   _NL_TIME_WWDAY_7,
247   _NL_TIME_WWEEKDAY_1,
248   _NL_TIME_WWEEKDAY_2,
249   _NL_TIME_WWEEKDAY_3,
250   _NL_TIME_WWEEKDAY_4,
251   _NL_TIME_WWEEKDAY_5,
252   _NL_TIME_WWEEKDAY_6,
253   _NL_TIME_WWEEKDAY_7,
254   _NL_TIME_WT_FMT,
255   _NL_TIME_WD_FMT,
256   _NL_TIME_WD_T_FMT,
257   _NL_TIME_WAM_STR,
258   _NL_TIME_WPM_STR,
259   _NL_TIME_WDATE_FMT,
260   _NL_TIME_WT_FMT_AMPM,
261   _NL_TIME_WERA,
262   _NL_TIME_WERA_D_FMT,
263   _NL_TIME_WERA_D_T_FMT,
264   _NL_TIME_WERA_T_FMT,
265   _NL_TIME_WALT_DIGITS,
266 
267   _NL_NUMERIC_CODESET,
268   _NL_NUMERIC_GROUPING,
269   _NL_NUMERIC_DECIMAL_POINT_WC,
270   _NL_NUMERIC_THOUSANDS_SEP_WC,
271 
272   _NL_MONETARY_INT_CURR_SYMBOL,
273   _NL_MONETARY_CURRENCY_SYMBOL,
274   _NL_MONETARY_MON_DECIMAL_POINT,
275   _NL_MONETARY_MON_THOUSANDS_SEP,
276   _NL_MONETARY_MON_GROUPING,
277   _NL_MONETARY_POSITIVE_SIGN,
278   _NL_MONETARY_NEGATIVE_SIGN,
279   _NL_MONETARY_INT_FRAC_DIGITS,
280   _NL_MONETARY_FRAC_DIGITS,
281   _NL_MONETARY_P_CS_PRECEDES,
282   _NL_MONETARY_P_SEP_BY_SPACE,
283   _NL_MONETARY_N_CS_PRECEDES,
284   _NL_MONETARY_N_SEP_BY_SPACE,
285   _NL_MONETARY_P_SIGN_POSN,
286   _NL_MONETARY_N_SIGN_POSN,
287   _NL_MONETARY_INT_P_CS_PRECEDES,
288   _NL_MONETARY_INT_P_SEP_BY_SPACE,
289   _NL_MONETARY_INT_N_CS_PRECEDES,
290   _NL_MONETARY_INT_N_SEP_BY_SPACE,
291   _NL_MONETARY_INT_P_SIGN_POSN,
292   _NL_MONETARY_INT_N_SIGN_POSN,
293   _NL_MONETARY_CODESET,
294   _NL_MONETARY_WINT_CURR_SYMBOL,
295   _NL_MONETARY_WCURRENCY_SYMBOL,
296   _NL_MONETARY_WMON_DECIMAL_POINT,
297   _NL_MONETARY_WMON_THOUSANDS_SEP,
298   _NL_MONETARY_WPOSITIVE_SIGN,
299   _NL_MONETARY_WNEGATIVE_SIGN,
300 
301   _NL_MESSAGES_WYESEXPR,
302   _NL_MESSAGES_WNOEXPR,
303   _NL_MESSAGES_WYESSTR,
304   _NL_MESSAGES_WNOSTR,
305 
306   _NL_COLLATE_CODESET,
307 
308   /* This MUST be the last entry since it's used to check for an array
309      index in nl_langinfo(). It also must not exceed _NL_LOCALE_NAME_BASE. */
310   _NL_LOCALE_EXTENDED_LAST_ENTRY
311 
312 #endif /* __HAVE_LOCALE_INFO_EXTENDED__ */
313 #endif /* __HAVE_LOCALE_INFO__ */
314 
315 };
316 
317 /* As an extension, nl_langinfo can retrive the name of a locale
318    category, with this mapping from setlocale() category (other than
319    LC_ALL) to nl_item. */
320 #define _NL_LOCALE_NAME_BASE ((nl_item) 100000)
321 #if __GNU_VISIBLE
322 #define NL_LOCALE_NAME(category) (_NL_LOCALE_NAME_BASE + (category))
323 #endif
324 
325 __BEGIN_DECLS
326 char	*nl_langinfo (nl_item);
327 #if __POSIX_VISIBLE >= 200809
328 char	*nl_langinfo_l (nl_item, locale_t);
329 #endif
330 __END_DECLS
331 
332 #endif /* !_LANGINFO_H_ */
333