Back to index

tetex-bin  3.0
loadinfo.h
Go to the documentation of this file.
00001 /* Copyright (C) 1996-1999, 2000-2003 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
00004 
00005    This program is free software; you can redistribute it and/or modify it
00006    under the terms of the GNU Library General Public License as published
00007    by the Free Software Foundation; either version 2, or (at your option)
00008    any later version.
00009 
00010    This program 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 this program; if not, write to the Free Software
00017    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
00018    USA.  */
00019 
00020 #ifndef _LOADINFO_H
00021 #define _LOADINFO_H  1
00022 
00023 /* Declarations of locale dependent catalog lookup functions.
00024    Implemented in
00025 
00026      localealias.c    Possibly replace a locale name by another.
00027      explodename.c    Split a locale name into its various fields.
00028      l10nflist.c      Generate a list of filenames of possible message catalogs.
00029      finddomain.c     Find and open the relevant message catalogs.
00030 
00031    The main function _nl_find_domain() in finddomain.c is declared
00032    in gettextP.h.
00033  */
00034 
00035 #ifndef internal_function
00036 # define internal_function
00037 #endif
00038 
00039 /* Tell the compiler when a conditional or integer expression is
00040    almost always true or almost always false.  */
00041 #ifndef HAVE_BUILTIN_EXPECT
00042 # define __builtin_expect(expr, val) (expr)
00043 #endif
00044 
00045 /* Separator in PATH like lists of pathnames.  */
00046 #if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
00047   /* Win32, OS/2, DOS */
00048 # define PATH_SEPARATOR ';'
00049 #else
00050   /* Unix */
00051 # define PATH_SEPARATOR ':'
00052 #endif
00053 
00054 /* Encoding of locale name parts.  */
00055 #define CEN_REVISION        1
00056 #define CEN_SPONSOR         2
00057 #define CEN_SPECIAL         4
00058 #define XPG_NORM_CODESET    8
00059 #define XPG_CODESET         16
00060 #define TERRITORY           32
00061 #define CEN_AUDIENCE        64
00062 #define XPG_MODIFIER        128
00063 
00064 #define CEN_SPECIFIC (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE)
00065 #define XPG_SPECIFIC (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER)
00066 
00067 
00068 struct loaded_l10nfile
00069 {
00070   const char *filename;
00071   int decided;
00072 
00073   const void *data;
00074 
00075   struct loaded_l10nfile *next;
00076   struct loaded_l10nfile *successor[1];
00077 };
00078 
00079 
00080 /* Normalize codeset name.  There is no standard for the codeset
00081    names.  Normalization allows the user to use any of the common
00082    names.  The return value is dynamically allocated and has to be
00083    freed by the caller.  */
00084 extern const char *_nl_normalize_codeset (const char *codeset,
00085                                      size_t name_len);
00086 
00087 /* Lookup a locale dependent file.
00088    *L10NFILE_LIST denotes a pool of lookup results of locale dependent
00089    files of the same kind, sorted in decreasing order of ->filename.
00090    DIRLIST and DIRLIST_LEN are an argz list of directories in which to
00091    look, containing at least one directory (i.e. DIRLIST_LEN > 0).
00092    MASK, LANGUAGE, TERRITORY, CODESET, NORMALIZED_CODESET, MODIFIER,
00093    SPECIAL, SPONSOR, REVISION are the pieces of the locale name, as
00094    produced by _nl_explode_name().  FILENAME is the filename suffix.
00095    The return value is the lookup result, either found in *L10NFILE_LIST,
00096    or - if DO_ALLOCATE is nonzero - freshly allocated, or possibly NULL.
00097    If the return value is non-NULL, it is added to *L10NFILE_LIST, and
00098    its ->next field denotes the chaining inside *L10NFILE_LIST, and
00099    furthermore its ->successor[] field contains a list of other lookup
00100    results from which this lookup result inherits.  */
00101 extern struct loaded_l10nfile *
00102 _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
00103                   const char *dirlist, size_t dirlist_len, int mask,
00104                   const char *language, const char *territory,
00105                   const char *codeset, const char *normalized_codeset,
00106                   const char *modifier, const char *special,
00107                   const char *sponsor, const char *revision,
00108                   const char *filename, int do_allocate);
00109 
00110 /* Lookup the real locale name for a locale alias NAME, or NULL if
00111    NAME is not a locale alias (but possibly a real locale name).
00112    The return value is statically allocated and must not be freed.  */
00113 extern const char *_nl_expand_alias (const char *name);
00114 
00115 /* Split a locale name NAME into its pieces: language, modifier,
00116    territory, codeset, special, sponsor, revision.
00117    NAME gets destructively modified: NUL bytes are inserted here and
00118    there.  *LANGUAGE gets assigned NAME.  Each of *MODIFIER, *TERRITORY,
00119    *CODESET, *SPECIAL, *SPONSOR, *REVISION gets assigned either a
00120    pointer into the old NAME string, or NULL.  *NORMALIZED_CODESET
00121    gets assigned the expanded *CODESET, if it is different from *CODESET;
00122    this one is dynamically allocated and has to be freed by the caller.
00123    The return value is a bitmask, where each bit corresponds to one
00124    filled-in value:
00125      XPG_MODIFIER, CEN_AUDIENCE  for *MODIFIER,
00126      TERRITORY                   for *TERRITORY,
00127      XPG_CODESET                 for *CODESET,
00128      XPG_NORM_CODESET            for *NORMALIZED_CODESET,
00129      CEN_SPECIAL                 for *SPECIAL,
00130      CEN_SPONSOR                 for *SPONSOR,
00131      CEN_REVISION                for *REVISION.
00132  */
00133 extern int _nl_explode_name (char *name, const char **language,
00134                           const char **modifier, const char **territory,
00135                           const char **codeset,
00136                           const char **normalized_codeset,
00137                           const char **special, const char **sponsor,
00138                           const char **revision);
00139 
00140 /* Split a locale name NAME into a leading language part and all the
00141    rest.  Return a pointer to the first character after the language,
00142    i.e. to the first byte of the rest.  */
00143 extern char *_nl_find_language (const char *name);
00144 
00145 #endif /* loadinfo.h */