langinfo.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  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. #ifndef _LANGINFO_H_
  29. #define _LANGINFO_H_
  30. #include <sys/cdefs.h>
  31. #include <sys/_types.h>
  32. #if __POSIX_VISIBLE >= 200809
  33. #include <sys/_locale.h>
  34. #endif
  35. #ifndef _NL_ITEM_DECLARED
  36. typedef __nl_item nl_item;
  37. #define _NL_ITEM_DECLARED
  38. #endif
  39. enum
  40. {
  41. /* POSIX and BSD defined items have to stick to the original values
  42. to maintain backward compatibility. */
  43. _NL_CTYPE_CODESET_NAME = 0, /* codeset name */
  44. #define CODESET _NL_CTYPE_CODESET_NAME
  45. D_T_FMT, /* string for formatting date and time */
  46. #define D_T_FMT D_T_FMT
  47. D_FMT, /* date format string */
  48. #define D_FMT D_FMT
  49. T_FMT, /* time format string */
  50. #define T_FMT T_FMT
  51. T_FMT_AMPM, /* a.m. or p.m. time formatting string */
  52. #define T_FMT_AMPM T_FMT_AMPM
  53. AM_STR, /* Ante Meridian affix */
  54. #define AM_STR AM_STR
  55. PM_STR, /* Post Meridian affix */
  56. #define PM_STR PM_STR
  57. /* week day names */
  58. DAY_1,
  59. #define DAY_1 DAY_1
  60. DAY_2,
  61. #define DAY_2 DAY_2
  62. DAY_3,
  63. #define DAY_3 DAY_3
  64. DAY_4,
  65. #define DAY_4 DAY_4
  66. DAY_5,
  67. #define DAY_5 DAY_5
  68. DAY_6,
  69. #define DAY_6 DAY_6
  70. DAY_7,
  71. #define DAY_7 DAY_7
  72. /* abbreviated week day names */
  73. ABDAY_1,
  74. #define ABDAY_1 ABDAY_1
  75. ABDAY_2,
  76. #define ABDAY_2 ABDAY_2
  77. ABDAY_3,
  78. #define ABDAY_3 ABDAY_3
  79. ABDAY_4,
  80. #define ABDAY_4 ABDAY_4
  81. ABDAY_5,
  82. #define ABDAY_5 ABDAY_5
  83. ABDAY_6,
  84. #define ABDAY_6 ABDAY_6
  85. ABDAY_7,
  86. #define ABDAY_7 ABDAY_7
  87. /* month names */
  88. MON_1,
  89. #define MON_1 MON_1
  90. MON_2,
  91. #define MON_2 MON_2
  92. MON_3,
  93. #define MON_3 MON_3
  94. MON_4,
  95. #define MON_4 MON_4
  96. MON_5,
  97. #define MON_5 MON_5
  98. MON_6,
  99. #define MON_6 MON_6
  100. MON_7,
  101. #define MON_7 MON_7
  102. MON_8,
  103. #define MON_8 MON_8
  104. MON_9,
  105. #define MON_9 MON_9
  106. MON_10,
  107. #define MON_10 MON_10
  108. MON_11,
  109. #define MON_11 MON_11
  110. MON_12,
  111. #define MON_12 MON_12
  112. /* abbreviated month names */
  113. ABMON_1,
  114. #define ABMON_1 ABMON_1
  115. ABMON_2,
  116. #define ABMON_2 ABMON_2
  117. ABMON_3,
  118. #define ABMON_3 ABMON_3
  119. ABMON_4,
  120. #define ABMON_4 ABMON_4
  121. ABMON_5,
  122. #define ABMON_5 ABMON_5
  123. ABMON_6,
  124. #define ABMON_6 ABMON_6
  125. ABMON_7,
  126. #define ABMON_7 ABMON_7
  127. ABMON_8,
  128. #define ABMON_8 ABMON_8
  129. ABMON_9,
  130. #define ABMON_9 ABMON_9
  131. ABMON_10,
  132. #define ABMON_10 ABMON_10
  133. ABMON_11,
  134. #define ABMON_11 ABMON_11
  135. ABMON_12,
  136. #define ABMON_12 ABMON_12
  137. ERA, /* era description segments */
  138. #define ERA ERA
  139. ERA_D_FMT, /* era date format string */
  140. #define ERA_D_FMT ERA_D_FMT
  141. ERA_D_T_FMT, /* era date and time format string */
  142. #define ERA_D_T_FMT ERA_D_T_FMT
  143. ERA_T_FMT, /* era time format string */
  144. #define ERA_T_FMT ERA_T_FMT
  145. ALT_DIGITS, /* alternative symbols for digits */
  146. #define ALT_DIGITS ALT_DIGITS
  147. RADIXCHAR, /* radix char */
  148. #define RADIXCHAR RADIXCHAR
  149. THOUSEP, /* separator for thousands */
  150. #define THOUSEP THOUSEP
  151. YESEXPR, /* affirmative response expression */
  152. #define YESEXPR YESEXPR
  153. NOEXPR, /* negative response expression */
  154. #define NOEXPR NOEXPR
  155. YESSTR, /* affirmative response for yes/no queries */
  156. #define YESSTR YESSTR
  157. NOSTR, /* negative response for yes/no queries */
  158. #define NOSTR NOSTR
  159. CRNCYSTR, /* currency symbol */
  160. #define CRNCYSTR CRNCYSTR
  161. D_MD_ORDER, /* month/day order (BSD extension) */
  162. #define D_MD_ORDER D_MD_ORDER
  163. _NL_TIME_DATE_FMT = 84, /* date fmt used by date(1) (GNU extension) */
  164. #define _DATE_FMT _NL_TIME_DATE_FMT
  165. #ifdef __HAVE_LOCALE_INFO__
  166. _NL_CTYPE_MB_CUR_MAX,
  167. _NL_MESSAGES_CODESET,
  168. #ifdef __HAVE_LOCALE_INFO_EXTENDED__
  169. /* NOTE:
  170. Always maintain the order and position of existing entries!
  171. Always append new entry to the list, prior to the definition
  172. of _NL_LOCALE_EXTENDED_LAST_ENTRY. */
  173. _NL_LOCALE_EXTENDED_FIRST_ENTRY,
  174. _NL_CTYPE_OUTDIGITS0_MB,
  175. _NL_CTYPE_OUTDIGITS1_MB,
  176. _NL_CTYPE_OUTDIGITS2_MB,
  177. _NL_CTYPE_OUTDIGITS3_MB,
  178. _NL_CTYPE_OUTDIGITS4_MB,
  179. _NL_CTYPE_OUTDIGITS5_MB,
  180. _NL_CTYPE_OUTDIGITS6_MB,
  181. _NL_CTYPE_OUTDIGITS7_MB,
  182. _NL_CTYPE_OUTDIGITS8_MB,
  183. _NL_CTYPE_OUTDIGITS9_MB,
  184. _NL_CTYPE_OUTDIGITS0_WC,
  185. _NL_CTYPE_OUTDIGITS1_WC,
  186. _NL_CTYPE_OUTDIGITS2_WC,
  187. _NL_CTYPE_OUTDIGITS3_WC,
  188. _NL_CTYPE_OUTDIGITS4_WC,
  189. _NL_CTYPE_OUTDIGITS5_WC,
  190. _NL_CTYPE_OUTDIGITS6_WC,
  191. _NL_CTYPE_OUTDIGITS7_WC,
  192. _NL_CTYPE_OUTDIGITS8_WC,
  193. _NL_CTYPE_OUTDIGITS9_WC,
  194. _NL_TIME_CODESET,
  195. _NL_TIME_WMON_1,
  196. _NL_TIME_WMON_2,
  197. _NL_TIME_WMON_3,
  198. _NL_TIME_WMON_4,
  199. _NL_TIME_WMON_5,
  200. _NL_TIME_WMON_6,
  201. _NL_TIME_WMON_7,
  202. _NL_TIME_WMON_8,
  203. _NL_TIME_WMON_9,
  204. _NL_TIME_WMON_10,
  205. _NL_TIME_WMON_11,
  206. _NL_TIME_WMON_12,
  207. _NL_TIME_WMONTH_1,
  208. _NL_TIME_WMONTH_2,
  209. _NL_TIME_WMONTH_3,
  210. _NL_TIME_WMONTH_4,
  211. _NL_TIME_WMONTH_5,
  212. _NL_TIME_WMONTH_6,
  213. _NL_TIME_WMONTH_7,
  214. _NL_TIME_WMONTH_8,
  215. _NL_TIME_WMONTH_9,
  216. _NL_TIME_WMONTH_10,
  217. _NL_TIME_WMONTH_11,
  218. _NL_TIME_WMONTH_12,
  219. _NL_TIME_WWDAY_1,
  220. _NL_TIME_WWDAY_2,
  221. _NL_TIME_WWDAY_3,
  222. _NL_TIME_WWDAY_4,
  223. _NL_TIME_WWDAY_5,
  224. _NL_TIME_WWDAY_6,
  225. _NL_TIME_WWDAY_7,
  226. _NL_TIME_WWEEKDAY_1,
  227. _NL_TIME_WWEEKDAY_2,
  228. _NL_TIME_WWEEKDAY_3,
  229. _NL_TIME_WWEEKDAY_4,
  230. _NL_TIME_WWEEKDAY_5,
  231. _NL_TIME_WWEEKDAY_6,
  232. _NL_TIME_WWEEKDAY_7,
  233. _NL_TIME_WT_FMT,
  234. _NL_TIME_WD_FMT,
  235. _NL_TIME_WD_T_FMT,
  236. _NL_TIME_WAM_STR,
  237. _NL_TIME_WPM_STR,
  238. _NL_TIME_WDATE_FMT,
  239. _NL_TIME_WT_FMT_AMPM,
  240. _NL_TIME_WERA,
  241. _NL_TIME_WERA_D_FMT,
  242. _NL_TIME_WERA_D_T_FMT,
  243. _NL_TIME_WERA_T_FMT,
  244. _NL_TIME_WALT_DIGITS,
  245. _NL_NUMERIC_CODESET,
  246. _NL_NUMERIC_GROUPING,
  247. _NL_NUMERIC_DECIMAL_POINT_WC,
  248. _NL_NUMERIC_THOUSANDS_SEP_WC,
  249. _NL_MONETARY_INT_CURR_SYMBOL,
  250. _NL_MONETARY_CURRENCY_SYMBOL,
  251. _NL_MONETARY_MON_DECIMAL_POINT,
  252. _NL_MONETARY_MON_THOUSANDS_SEP,
  253. _NL_MONETARY_MON_GROUPING,
  254. _NL_MONETARY_POSITIVE_SIGN,
  255. _NL_MONETARY_NEGATIVE_SIGN,
  256. _NL_MONETARY_INT_FRAC_DIGITS,
  257. _NL_MONETARY_FRAC_DIGITS,
  258. _NL_MONETARY_P_CS_PRECEDES,
  259. _NL_MONETARY_P_SEP_BY_SPACE,
  260. _NL_MONETARY_N_CS_PRECEDES,
  261. _NL_MONETARY_N_SEP_BY_SPACE,
  262. _NL_MONETARY_P_SIGN_POSN,
  263. _NL_MONETARY_N_SIGN_POSN,
  264. _NL_MONETARY_INT_P_CS_PRECEDES,
  265. _NL_MONETARY_INT_P_SEP_BY_SPACE,
  266. _NL_MONETARY_INT_N_CS_PRECEDES,
  267. _NL_MONETARY_INT_N_SEP_BY_SPACE,
  268. _NL_MONETARY_INT_P_SIGN_POSN,
  269. _NL_MONETARY_INT_N_SIGN_POSN,
  270. _NL_MONETARY_CODESET,
  271. _NL_MONETARY_WINT_CURR_SYMBOL,
  272. _NL_MONETARY_WCURRENCY_SYMBOL,
  273. _NL_MONETARY_WMON_DECIMAL_POINT,
  274. _NL_MONETARY_WMON_THOUSANDS_SEP,
  275. _NL_MONETARY_WPOSITIVE_SIGN,
  276. _NL_MONETARY_WNEGATIVE_SIGN,
  277. _NL_MESSAGES_WYESEXPR,
  278. _NL_MESSAGES_WNOEXPR,
  279. _NL_MESSAGES_WYESSTR,
  280. _NL_MESSAGES_WNOSTR,
  281. _NL_COLLATE_CODESET,
  282. /* This MUST be the last entry since it's used to check for an array
  283. index in nl_langinfo(). It also must not exceed _NL_LOCALE_NAME_BASE. */
  284. _NL_LOCALE_EXTENDED_LAST_ENTRY
  285. #endif /* __HAVE_LOCALE_INFO_EXTENDED__ */
  286. #endif /* __HAVE_LOCALE_INFO__ */
  287. };
  288. /* As an extension, nl_langinfo can retrive the name of a locale
  289. category, with this mapping from setlocale() category (other than
  290. LC_ALL) to nl_item. */
  291. #define _NL_LOCALE_NAME_BASE 100000
  292. #if __GNU_VISIBLE
  293. #define NL_LOCALE_NAME(category) (_NL_LOCALE_NAME_BASE + (category))
  294. #endif
  295. __BEGIN_DECLS
  296. char *nl_langinfo (nl_item);
  297. #if __POSIX_VISIBLE >= 200809
  298. char *nl_langinfo_l (nl_item, locale_t);
  299. #endif
  300. __END_DECLS
  301. #endif /* !_LANGINFO_H_ */