Setlocale.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: Setlocale.h /main/3 1995/10/26 15:27:34 rswiston $ */
  24. /*
  25. * (c) Copyright 1993, 1994 Hewlett-Packard Company *
  26. * (c) Copyright 1993, 1994 International Business Machines Corp. *
  27. * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
  28. * (c) Copyright 1993, 1994 Novell, Inc. *
  29. */
  30. /* Hp DT's version of an 8.0 include file; needed for Fnmatch */
  31. #ifndef DtSETLOCALE_INCLUDED /* allow multiple inclusions */
  32. #define DtSETLOCALE_INCLUDED
  33. #ifdef _NAMESPACE_CLEAN
  34. #define _1kanji __1kanji
  35. #define _2kanji __2kanji
  36. #define _downshift __downshift
  37. #define _upshift __upshift
  38. #endif /* _NAMESPACE_CLEAN */
  39. #include <locale.h>
  40. #include <limits.h>
  41. #include <Dt/MsgCatP.h>
  42. #include <langinfo.h>
  43. #include <Dt/Collate.h>
  44. #ifndef _NL_ORDER
  45. #define _NL_ORDER
  46. typedef int nl_order;
  47. #endif
  48. #ifndef _NL_MODE
  49. #define _NL_MODE
  50. typedef int nl_mode;
  51. #endif
  52. #ifndef _NL_OUTDGT
  53. #define _NL_OUTDGT
  54. typedef int nl_outdgt;
  55. #endif
  56. #ifndef MAXLNAMELEN
  57. #define MAXLNAMELEN 14
  58. #endif
  59. #endif
  60. struct _era_data { /* defines an Emperor/Era time period */
  61. short start_year; /* starting date of era */
  62. unsigned short start_month;
  63. unsigned short start_day;
  64. short end_year; /* ending date of era */
  65. unsigned short end_month;
  66. unsigned short end_day;
  67. short origin_year; /* time axis origin for era (one of start_year or end_year) */
  68. short offset; /* offset from 0 for 1st year of era */
  69. short signflag; /* adjusts sign of (year - origin_year) value */
  70. unsigned short reserved;
  71. unsigned char *name; /* name of era */
  72. unsigned char *format; /* instead of nl_langinfo(ERA_FMT) */
  73. };
  74. extern int __nl_langid[]; /* langid of currently loaded language */
  75. extern unsigned char *__ctype; /* pointer to ctype table */
  76. extern unsigned char *_1kanji; /* pointer to 1st of 2 kanji table */
  77. extern unsigned char *_2kanji; /* pointer to 2nd of 2 kanji table */
  78. extern unsigned char *_upshift; /* pointer to up shift table */
  79. extern unsigned char *_downshift; /* pointer to down shift table */
  80. #ifdef EUC
  81. extern unsigned char *__e_cset; /* pointer to expanded char set table */
  82. extern unsigned char *__ein_csize; /* pointer to expanded in_csize table */
  83. extern unsigned char *__eout_csize; /* pointer to expanded out_csize table*/
  84. #endif /* EUC */
  85. extern struct _era_data *_nl_era[]; /* array of era info str pointer */
  86. extern int _nl_radix; /* radix character */
  87. extern int _sh_low; /* lowest char in shift table domain */
  88. extern int _sh_high; /* highest char in shift table domain */
  89. extern int __nl_char_size; /* size of characters */
  90. #ifdef EUC
  91. extern int __nl_code_scheme;/* flag for char code scheme */
  92. extern int __cs_SBYTE; /* flag for 1 byte char code scheme */
  93. extern int __cs_HP15; /* flag for HP15 char code scheme */
  94. extern int __cs_EUC; /* flag for EUC char code scheme */
  95. extern unsigned char __in_csize[]; /* input char size */
  96. extern unsigned char __out_csize[]; /* output char size */
  97. extern unsigned int __euc_template[]; /* euc process code template */
  98. #endif /* EUC */
  99. extern nl_direct _nl_direct; /* direction flag */
  100. extern int _nl_context; /* directionality context flag */
  101. extern nl_order _nl_order; /* order flag */
  102. extern nl_mode _nl_mode; /* mode flag; Latin or non-Latin */
  103. extern nl_outdgt _nl_outdigit; /* digit output : ascii or alt digit */
  104. extern int _nl_space_alt; /* value of alternative space */
  105. extern unsigned char *_nl_dgt_alt; /* buffer for alt digit string */
  106. extern unsigned char *_nl_punct_alt; /* buffer for alt punctuation string */
  107. extern unsigned char *_nl_pascii; /* buffer for ascii punctuation string */
  108. extern unsigned char *_nl_dascii; /* buffer for ascii digits string */
  109. extern int _nl_map21; /* non-zero if 2-to-1 mappings */
  110. extern int _nl_onlyseq; /* true if only 1-to-1 char w no pri */
  111. extern int _nl_collate_on; /* true if collation table loaded */
  112. extern int _nl_mb_collate; /* true if collation is multibyte */
  113. extern unsigned char *_seqtab; /* dictionary sequence number table */
  114. extern unsigned char *_pritab; /* 1to2/2to1 flag + priority table */
  115. extern struct col_21tab *_tab21; /* 2-to-1 mapping table */
  116. extern struct col_12tab *_tab12; /* 1-to-2 mapping table */
  117. extern unsigned char *__errptr; /* pointer to an area _errlocale() can use as a buffer */
  118. extern struct lconv *_lconv;
  119. extern unsigned char *__category_name[];
  120. extern unsigned char **__nl_info; /* pointers to locale langinfo strings */
  121. extern unsigned char *__C_langinfo[];/* default langinfo strings for the C locale */
  122. #define _NL_MAX_MSG ERA_FMT /* last nl_langinfo item */
  123. /***************************************************************************
  124. The remainder of this file includes structures for the language files.
  125. The files are built by buildlang(1M).
  126. The structure of the files is as follows :
  127. ----------------------------------
  128. | Table Header (A) |
  129. ----------------------------------
  130. | Category/Modifier Structures(B)|
  131. ==================================
  132. | LC_ALL Table Header (C) |
  133. - - - - - - - - -
  134. | LC_ALL Data |
  135. ----------------------------------
  136. | LC_COLLATE Table Header (D) |
  137. - - - - - - - - -
  138. | LC_COLLATE Data |
  139. ----------------------------------
  140. | LC_CTYPE Table Header (E) |
  141. - - - - - - - - -
  142. | LC_CTYPE Data |
  143. ----------------------------------
  144. | LC_MONETARY Table Header (F)
  145. - - - - - - - - -
  146. | LC_MONETARY Data |
  147. ----------------------------------
  148. | LC_NUMERIC Table Header (G) |
  149. - - - - - - - - -
  150. | LC_NUMERIC Data |
  151. ----------------------------------
  152. | LC_TIME Table Header (H) |
  153. - - - - - - - - -
  154. | LC_TIME Data |
  155. ----------------------------------
  156. *****************************************************************************/
  157. /* Category Id's */
  158. /* Table Header (A) */
  159. struct table_header {
  160. unsigned int size; /* size of table header and category
  161. structure. (A) + (B) */
  162. unsigned short nl_langid; /* _nl_langid */
  163. unsigned char lang[3*MAXLNAMELEN+2+1]; /* language name */
  164. unsigned short cat_no; /* number of categories defined */
  165. unsigned short mod_no; /* number of modifiers defined */
  166. unsigned short rev_flag; /* true if HP defined */
  167. unsigned char rev_str[36]; /* Revision String */
  168. unsigned short codeset; /* 0 if 1 byte, 1 if 2 byte */
  169. unsigned int reserved1;
  170. unsigned int reserved2;
  171. unsigned int reserved3;
  172. };
  173. /* Category/Modifier Structure (B)
  174. Catinfotype structure describes a category/modifier table
  175. There is one structure for each category and modifier defined.
  176. These entries follow the table header */
  177. struct catinfotype
  178. {
  179. int size; /* size of category table */
  180. int address; /* address of category table -
  181. offset from the beginning of
  182. the category tables () */
  183. short catid; /* category id */
  184. unsigned char mod_name[MAXLNAMELEN+1]; /* name of modifier */
  185. short mod_addr; /* address of category table
  186. for modifier - offset from
  187. beginning of file */
  188. };
  189. /* Below are the category headers for each of the defined categories
  190. All addresses are offset from the beginning of the category information */
  191. /* LC_ALL Table (C) */
  192. struct all_header {
  193. unsigned short yes_addr; /* msg_index[YESSTR] */
  194. unsigned short no_addr; /* msg_index[NOSTR] */
  195. unsigned short direct_addr; /* msg_index[DIRECTION] */
  196. /* _nl_direct */
  197. unsigned short context_addr; /* _nl_context */
  198. };
  199. /* LC_COLLATE Tables (D) */
  200. struct col_header {
  201. unsigned int seqtab_addr; /* _seqtab */
  202. unsigned int pritab_addr; /* _pritab */
  203. unsigned short nl_map21; /* not an address */
  204. unsigned short nl_onlyseq; /* not an address */
  205. unsigned int tab21_addr;
  206. unsigned int tab12_addr;
  207. };
  208. /* LC_CTYPE Tables (E) */
  209. struct ctype_header {
  210. unsigned int _sh_high; /* _sh_high */
  211. int _sh_low; /* _sh_low */
  212. unsigned int _ctype_addr; /* __ctype */
  213. unsigned int kanji1_addr; /* _1kanji */
  214. unsigned int kanji2_addr; /* _2kanji */
  215. unsigned int upshift_addr; /* _upshift */
  216. unsigned int downshift_addr; /* _downshift */
  217. unsigned short byte_char_addr; /* msg_index[BYTES_CHAR] */
  218. unsigned short alt_punct_addr; /* msg_index[ALT_PUNCT] */
  219. /* _nl_punct_alt[] */
  220. /* _nl_space_alt */
  221. #ifdef EUC
  222. unsigned int io_csize_addr; /* __io_csize[] */
  223. unsigned int e_cset_addr; /* __e_cset */
  224. unsigned int ein_csize_addr; /* __ein_csize */
  225. unsigned int eout_csize_addr; /* __eout_csize */
  226. #endif /* EUC */
  227. };
  228. /* LC_MONETARY Tables (F) */
  229. struct monetary_header {
  230. unsigned short int_frac_digits; /* _lconv->short_frac_digits */
  231. unsigned short frac_digits; /* _lconv->frac_digits */
  232. unsigned short p_cs_precedes; /* _lconv->p_cs_precedes */
  233. unsigned short p_sep_by_space; /* _lconv->p_sep_by_space */
  234. unsigned short n_cs_precedes; /* _lconv->n_cs_precedes */
  235. unsigned short n_sep_by_space; /* _lconv->n_sep_by_space */
  236. unsigned short p_sign_posn; /* _lconv->p_sign_posn */
  237. unsigned short n_sign_posn; /* _lconv->n_sign_posn */
  238. unsigned short curr_symbol_lconv; /* _lconv->currency_symbol */
  239. unsigned short curr_symbol_li; /* msg_index[CRNCYSTR] */
  240. unsigned short mon_decimal_point; /* _lconv->mon_decimal_point */
  241. unsigned short int_curr_symbol; /* _lconv->short_curr_symbol */
  242. unsigned short mon_thousands_sep; /* _lconv->mon_thousands_sep */
  243. unsigned short mon_grouping; /* _lconv->mon_grouping */
  244. unsigned short positive_sign; /* _lconv->positive_sign */
  245. unsigned short negative_sign; /* _lconv->negative_sign */
  246. };
  247. /* LC_NUMERIC Tables (G) */
  248. struct numeric_header {
  249. unsigned short grouping; /* _lconv->grouping */
  250. unsigned short decimal_point; /* _lconv->decimal_point */
  251. /* msg_index[RADIXCHAR] */
  252. /* _nl_radix */
  253. unsigned short thousands_sep; /* _lconv->thousands_sep */
  254. /* msg_index[THOUSEP] */
  255. unsigned short alt_digit_addr; /* msg_index[ALT_DIGIT] */
  256. };
  257. /* LC_TIME Tables (H) */
  258. struct time_header {
  259. unsigned short d_t_fmt; /* msg_index[D_T_FMT] */
  260. unsigned short d_fmt; /* msg_index[D_FMT] */
  261. unsigned short t_fmt; /* msg_index[T_FMT] */
  262. unsigned short day_1; /* msg_index[DAY_1] */
  263. unsigned short day_2; /* msg_index[DAY_2] */
  264. unsigned short day_3; /* msg_index[DAY_3] */
  265. unsigned short day_4; /* msg_index[DAY_4] */
  266. unsigned short day_5; /* msg_index[DAY_5] */
  267. unsigned short day_6; /* msg_index[DAY_6] */
  268. unsigned short day_7; /* msg_index[DAY_7] */
  269. unsigned short abday_1; /* msg_index[ABDAY_1] */
  270. unsigned short abday_2; /* msg_index[ABDAY_2] */
  271. unsigned short abday_3; /* msg_index[ABDAY_3] */
  272. unsigned short abday_4; /* msg_index[ABDAY_4] */
  273. unsigned short abday_5; /* msg_index[ABDAY_5] */
  274. unsigned short abday_6; /* msg_index[ABDAY_6] */
  275. unsigned short abday_7; /* msg_index[ABDAY_7] */
  276. unsigned short mon_1; /* msg_index[MON_1] */
  277. unsigned short mon_2; /* msg_index[MON_2] */
  278. unsigned short mon_3; /* msg_index[MON_3] */
  279. unsigned short mon_4; /* msg_index[MON_4] */
  280. unsigned short mon_5; /* msg_index[MON_5] */
  281. unsigned short mon_6; /* msg_index[MON_6] */
  282. unsigned short mon_7; /* msg_index[MON_7] */
  283. unsigned short mon_8; /* msg_index[MON_8] */
  284. unsigned short mon_9; /* msg_index[MON_9] */
  285. unsigned short mon_10; /* msg_index[MON_10] */
  286. unsigned short mon_11; /* msg_index[MON_11] */
  287. unsigned short mon_12; /* msg_index[MON_12] */
  288. unsigned short abmon_1; /* msg_index[ABMON_1] */
  289. unsigned short abmon_2; /* msg_index[ABMON_2] */
  290. unsigned short abmon_3; /* msg_index[ABMON_3] */
  291. unsigned short abmon_4; /* msg_index[ABMON_4] */
  292. unsigned short abmon_5; /* msg_index[ABMON_5] */
  293. unsigned short abmon_6; /* msg_index[ABMON_6] */
  294. unsigned short abmon_7; /* msg_index[ABMON_7] */
  295. unsigned short abmon_8; /* msg_index[ABMON_8] */
  296. unsigned short abmon_9; /* msg_index[ABMON_9] */
  297. unsigned short abmon_10; /* msg_index[ABMON_10] */
  298. unsigned short abmon_11; /* msg_index[ABMON_11] */
  299. unsigned short abmon_12; /* msg_index[ABMON_12] */
  300. unsigned short am_str; /* msg_index[AM_STR] */
  301. unsigned short pm_str; /* msg_index[PM_STR] */
  302. unsigned short year_unit; /* msg_index[YEAR_UNIT] */
  303. unsigned short mon_unit; /* msg_index[MON_UNIT] */
  304. unsigned short day_unit; /* msg_index[DAY_UNIT] */
  305. unsigned short hour_unit; /* msg_index[HOUR_UNIT] */
  306. unsigned short min_unit; /* msg_index[MIN_UNIT] */
  307. unsigned short sec_unit; /* msg_index[SEC_UNIT] */
  308. unsigned short era_fmt; /* msg_index[ERA_FMT] */
  309. unsigned short era_count; /* number of era entries */
  310. unsigned short era_names; /* address of era name and format strings */
  311. unsigned short era_addr; /* address of era data structure entries */
  312. unsigned short reserved; /* address of era data structure entries */
  313. };
  314. #endif /* DtSETLOCALE_INCLUDED */