home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stlpt453.zip / STLport-4.5.3 / src / c_locale_glibc / gcc_localeinfo.h < prev   
C/C++ Source or Header  |  2000-12-07  |  6KB  |  208 lines

  1. /* localeinfo.h -- declarations for internal libc locale interfaces
  2.    Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
  3.    This file is part of the GNU C Library.
  4.  
  5.    The GNU C Library is free software; you can redistribute it and/or
  6.    modify it under the terms of the GNU Library General Public License as
  7.    published by the Free Software Foundation; either version 2 of the
  8.    License, or (at your option) any later version.
  9.  
  10.    The GNU C Library is distributed in the hope that it will be useful,
  11.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.    Library General Public License for more details.
  14.  
  15.    You should have received a copy of the GNU Library General Public
  16.    License along with the GNU C Library; see the file COPYING.LIB.  If not,
  17.    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  18.    Boston, MA 02111-1307, USA.  */
  19.  
  20. #ifndef _LOCALEINFO_H
  21. #define _LOCALEINFO_H 1
  22.  
  23. #include <stddef.h>
  24. #include <langinfo.h>
  25. #include <time.h>
  26. #include <sys/types.h>
  27.  
  28.  
  29. /* stuff from loadinfo.h */
  30.  
  31. #ifndef PARAMS
  32. # if __STDC__
  33. #  define PARAMS(args) args
  34. # else
  35. #  define PARAMS(args) ()
  36. # endif
  37. #endif
  38.  
  39. /* Encoding of locale name parts.  */
  40. #define CEN_REVISION        1
  41. #define CEN_SPONSOR        2
  42. #define CEN_SPECIAL        4
  43. #define XPG_NORM_CODESET    8
  44. #define XPG_CODESET        16
  45. #define TERRITORY        32
  46. #define CEN_AUDIENCE        64
  47. #define XPG_MODIFIER        128
  48.  
  49. #define CEN_SPECIFIC    (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE)
  50. #define XPG_SPECIFIC    (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER)
  51.  
  52.  
  53. struct loaded_l10nfile
  54. {
  55.   const char *filename;
  56.   int decided;
  57.  
  58.   const void *data;
  59.  
  60.   struct loaded_l10nfile *next;
  61.   struct loaded_l10nfile *successor[1];
  62. };
  63.  
  64.  
  65. extern const char *_nl_normalize_codeset PARAMS ((const char *codeset,
  66.                           size_t name_len));
  67.  
  68. extern struct loaded_l10nfile *
  69. _nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list,
  70.                 const char *dirlist, size_t dirlist_len, int mask,
  71.                 const char *language, const char *territory,
  72.                 const char *codeset,
  73.                 const char *normalized_codeset,
  74.                 const char *modifier, const char *special,
  75.                 const char *sponsor, const char *revision,
  76.                 const char *filename, int do_allocate));
  77.  
  78.  
  79. extern const char *_nl_expand_alias PARAMS ((const char *name));
  80.  
  81. extern int _nl_explode_name PARAMS ((char *name, const char **language,
  82.                      const char **modifier,
  83.                      const char **territory,
  84.                      const char **codeset,
  85.                      const char **normalized_codeset,
  86.                      const char **special,
  87.                      const char **sponsor,
  88.                      const char **revision));
  89.  
  90.  
  91.  
  92. /* Magic number at the beginning of a locale data file for CATEGORY.  */
  93. #define    LIMAGIC(category)    (0x960617de ^ (category))
  94.  
  95. /* Two special weight constants for the collation data.  */
  96. #define FORWARD_CHAR ((wchar_t) 0xfffffffd)
  97. #define ELLIPSIS_CHAR ((wchar_t) 0xfffffffe)
  98. #define IGNORE_CHAR ((wchar_t) 0xffffffff)
  99.  
  100. #define MAX_USAGE_COUNT (UINT_MAX - 1)
  101. #define UNDELETABLE    UINT_MAX
  102.  
  103. /* Structure describing locale data in core for a category.  */
  104. struct locale_data
  105. {
  106.   const char *name;
  107.   const char *filedata;        /* Region mapping the file data.  */
  108.   off_t filesize;        /* Size of the file (and the region).  */
  109.  
  110.   //  unsigned int usage_count;
  111.   //  int mmaped;
  112.  
  113.   unsigned int nstrings;    /* Number of strings below.  */
  114.   union locale_data_value
  115.   {
  116.     const wchar_t *wstr;
  117.     const char *string;
  118.     unsigned int word;
  119.   }
  120.   values[0];    /* Items, usually pointers into `filedata'.  */
  121. };
  122.  
  123. /* We know three kinds of collation sorting rules.  */
  124. enum coll_sort_rule
  125. {
  126.   illegal_0__,
  127.   sort_forward,
  128.   sort_backward,
  129.   illegal_3__,
  130.   sort_position,
  131.   sort_forward_position,
  132.   sort_backward_position,
  133.   sort_mask
  134. };
  135.  
  136. /* We can map the types of the entries into a few categories.  */
  137. enum value_type
  138. {
  139.   none,
  140.   string,
  141.   stringarray,
  142.   byte,
  143.   bytearray,
  144.   word
  145. };
  146.  
  147.  
  148. /* Structure to access `era' information from LC_TIME.  */
  149. struct era_entry
  150. {
  151.   u_int32_t direction;        /* Contains '+' or '-'.  */
  152.   int32_t offset;
  153.   int32_t start_date[3];
  154.   int32_t stop_date[3];
  155.   const char name_fmt[0];
  156. };
  157.  
  158. extern const char *const _nl_category_names[LC_ALL + 1];
  159. extern const size_t _nl_category_name_sizes[LC_ALL + 1];
  160. extern const struct locale_data * *const _nl_current[LC_ALL];
  161.  
  162. /* Name of the standard locale.  */
  163. extern const char _nl_C_name[];
  164.  
  165. /* Extract the current CATEGORY locale's string for ITEM.  */
  166. #define _NL_CURRENT(category, item) \
  167.   (_nl_current_##category->values[_NL_ITEM_INDEX (item)].string)
  168.  
  169. /* Extract the current CATEGORY locale's word for ITEM.  */
  170. #define _NL_CURRENT_WORD(category, item) \
  171.   (_nl_current_##category->values[_NL_ITEM_INDEX (item)].word)
  172.  
  173. /* This is used in lc-CATEGORY.c to define _nl_current_CATEGORY.  */
  174. #define _NL_CURRENT_DEFINE(category) \
  175.   extern const struct locale_data _nl_C_##category; \
  176.   const struct locale_data *_nl_current_##category = &_nl_C_##category
  177.  
  178. /* Load the locale data for CATEGORY from the file specified by *NAME.
  179.    If *NAME is "", use environment variables as specified by POSIX,
  180.    and fill in *NAME with the actual name used.  The directories
  181.    listed in LOCALE_PATH are searched for the locale files.  */
  182. extern const struct locale_data *_nl_find_locale (const char *locale_path,
  183.                           size_t locale_path_len,
  184.                           int category, char **name);
  185.  
  186. /* Try to load the file described by FILE.  */
  187. extern void _nl_load_locale (struct loaded_l10nfile *file, int category);
  188.  
  189.  
  190. /* Return `era' entry which corresponds to TP.  Used in strftime.  */
  191. struct era_entry *_nl_get_era_entry (const struct tm *tp);
  192.  
  193. /* Return `alt_digit' which corresponds to NUMBER.  Used in strftime.  */
  194. const char *_nl_get_alt_digit (unsigned int number);
  195.  
  196.  
  197. /* Global variables for LC_COLLATE category data.  */
  198. extern const u_int32_t *__collate_table;
  199. extern const u_int32_t *__collate_extra;
  200. extern const u_int32_t *__collate_element_hash;
  201. extern const char *__collate_element_strings;
  202. extern const wchar_t *__collate_element_values;
  203. extern const u_int32_t *__collate_symbol_hash;
  204. extern const char *__collate_symbol_strings;
  205. extern const u_int32_t *__collate_symbol_classes;
  206.  
  207. #endif    /* localeinfo.h */
  208.