/home/ntakagi/work/STLport-5.1.5/src/c_locale_glibc/gcc_localeinfo.h

Go to the documentation of this file.
00001 /* localeinfo.h -- declarations for internal libc locale interfaces
00002    Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public License as
00007    published by the Free Software Foundation; either version 2 of the
00008    License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public
00016    License along with the GNU C Library; see the file COPYING.LIB.  If not,
00017    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA 02111-1307, USA.  */
00019 
00020 #ifndef _LOCALEINFO_H
00021 #define _LOCALEINFO_H 1
00022 
00023 #include <stddef.h>
00024 #include <langinfo.h>
00025 #include <time.h>
00026 #include <sys/types.h>
00027 
00028 
00029 /* stuff from loadinfo.h */
00030 
00031 #ifndef PARAMS
00032 # if __STDC__
00033 #  define PARAMS(args) args
00034 # else
00035 #  define PARAMS(args) ()
00036 # endif
00037 #endif
00038 
00039 /* Encoding of locale name parts.  */
00040 #define CEN_REVISION    1
00041 #define CEN_SPONSOR    2
00042 #define CEN_SPECIAL    4
00043 #define XPG_NORM_CODESET  8
00044 #define XPG_CODESET    16
00045 #define TERRITORY    32
00046 #define CEN_AUDIENCE    64
00047 #define XPG_MODIFIER    128
00048 
00049 #define CEN_SPECIFIC  (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE)
00050 #define XPG_SPECIFIC  (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER)
00051 
00052 
00053 struct loaded_l10nfile
00054 {
00055   const char *filename;
00056   int decided;
00057 
00058   const void *data;
00059 
00060   struct loaded_l10nfile *next;
00061   struct loaded_l10nfile *successor[1];
00062 };
00063 
00064 
00065 extern const char *_nl_normalize_codeset PARAMS ((const char *codeset,
00066                                                   size_t name_len));
00067 
00068 extern struct loaded_l10nfile *
00069 _nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list,
00070                             const char *dirlist, size_t dirlist_len, int mask,
00071                             const char *language, const char *territory,
00072                             const char *codeset,
00073                             const char *normalized_codeset,
00074                             const char *modifier, const char *special,
00075                             const char *sponsor, const char *revision,
00076                             const char *filename, int do_allocate));
00077 
00078 
00079 extern const char *_nl_expand_alias PARAMS ((const char *name));
00080 
00081 extern int _nl_explode_name PARAMS ((char *name, const char **language,
00082                                      const char **modifier,
00083                                      const char **territory,
00084                                      const char **codeset,
00085                                      const char **normalized_codeset,
00086                                      const char **special,
00087                                      const char **sponsor,
00088                                      const char **revision));
00089 
00090 
00091 
00092 /* Magic number at the beginning of a locale data file for CATEGORY.  */
00093 #define  LIMAGIC(category)  (0x960617de ^ (category))
00094 
00095 /* Two special weight constants for the collation data.  */
00096 #define FORWARD_CHAR ((wchar_t) 0xfffffffd)
00097 #define ELLIPSIS_CHAR ((wchar_t) 0xfffffffe)
00098 #define IGNORE_CHAR ((wchar_t) 0xffffffff)
00099 
00100 #define MAX_USAGE_COUNT (UINT_MAX - 1)
00101 #define UNDELETABLE  UINT_MAX
00102 
00103 /* Structure describing locale data in core for a category.  */
00104 struct locale_data
00105 {
00106   const char *name;
00107   const char *filedata;    /* Region mapping the file data.  */
00108   off_t filesize;    /* Size of the file (and the region).  */
00109 
00110   /*  unsigned int usage_count; */
00111   /*  int mmaped; */
00112 
00113   unsigned int nstrings;  /* Number of strings below.  */
00114   union locale_data_value
00115   {
00116     const wchar_t *wstr;
00117     const char *string;
00118     unsigned int word;
00119   }
00120   values[0];  /* Items, usually pointers into `filedata'.  */
00121 };
00122 
00123 /* We know three kinds of collation sorting rules.  */
00124 enum coll_sort_rule
00125 {
00126   illegal_0__,
00127   sort_forward,
00128   sort_backward,
00129   illegal_3__,
00130   sort_position,
00131   sort_forward_position,
00132   sort_backward_position,
00133   sort_mask
00134 };
00135 
00136 /* We can map the types of the entries into a few categories.  */
00137 enum value_type
00138 {
00139   none,
00140   string,
00141   stringarray,
00142   byte,
00143   bytearray,
00144   word
00145 };
00146 
00147 
00148 /* Structure to access `era' information from LC_TIME.  */
00149 struct era_entry
00150 {
00151   u_int32_t direction;    /* Contains '+' or '-'.  */
00152   int32_t offset;
00153   int32_t start_date[3];
00154   int32_t stop_date[3];
00155   const char name_fmt[0];
00156 };
00157 
00158 extern const char *const _nl_category_names[LC_ALL + 1];
00159 extern const size_t _nl_category_name_sizes[LC_ALL + 1];
00160 extern const struct locale_data * *const _nl_current[LC_ALL];
00161 
00162 /* Name of the standard locale.  */
00163 extern const char _nl_C_name[];
00164 
00165 /* Extract the current CATEGORY locale's string for ITEM.  */
00166 #define _NL_CURRENT(category, item) \
00167   (_nl_current_##category->values[_NL_ITEM_INDEX (item)].string)
00168 
00169 /* Extract the current CATEGORY locale's word for ITEM.  */
00170 #define _NL_CURRENT_WORD(category, item) \
00171   (_nl_current_##category->values[_NL_ITEM_INDEX (item)].word)
00172 
00173 /* This is used in lc-CATEGORY.c to define _nl_current_CATEGORY.  */
00174 #define _NL_CURRENT_DEFINE(category) \
00175   extern const struct locale_data _nl_C_##category; \
00176   const struct locale_data *_nl_current_##category = &_nl_C_##category
00177 
00178 /* Load the locale data for CATEGORY from the file specified by *NAME.
00179    If *NAME is "", use environment variables as specified by POSIX,
00180    and fill in *NAME with the actual name used.  The directories
00181    listed in LOCALE_PATH are searched for the locale files.  */
00182 extern const struct locale_data *_nl_find_locale (const char *locale_path,
00183                                                   size_t locale_path_len,
00184                                                   int category, char **name);
00185 
00186 /* Try to load the file described by FILE.  */
00187 extern void _nl_load_locale (struct loaded_l10nfile *file, int category);
00188 
00189 
00190 /* Return `era' entry which corresponds to TP.  Used in strftime.  */
00191 struct era_entry *_nl_get_era_entry (const struct tm *tp);
00192 
00193 /* Return `alt_digit' which corresponds to NUMBER.  Used in strftime.  */
00194 const char *_nl_get_alt_digit (unsigned int number);
00195 
00196 
00197 /* Global variables for LC_COLLATE category data.  */
00198 extern const u_int32_t *__collate_table;
00199 extern const u_int32_t *__collate_extra;
00200 extern const u_int32_t *__collate_element_hash;
00201 extern const char *__collate_element_strings;
00202 extern const wchar_t *__collate_element_values;
00203 extern const u_int32_t *__collate_symbol_hash;
00204 extern const char *__collate_symbol_strings;
00205 extern const u_int32_t *__collate_symbol_classes;
00206 
00207 #endif  /* localeinfo.h */



Generated on Mon Mar 10 15:32:15 2008 by  doxygen 1.5.1