00001 /* Copyright (C) 1996-1999, 2000-2002 Free Software Foundation, Inc. 00002 This file is part of the GNU C Library. 00003 Contributed by Ulrich Drepper <[email protected]>, 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 PARAMS 00036 # if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES 00037 # define PARAMS(args) args 00038 # else 00039 # define PARAMS(args) () 00040 # endif 00041 #endif 00042 00043 #ifndef internal_function 00044 # define internal_function 00045 #endif 00046 00047 /* Tell the compiler when a conditional or integer expression is 00048 almost always true or almost always false. */ 00049 #ifndef HAVE_BUILTIN_EXPECT 00050 # define __builtin_expect(expr, val) (expr) 00051 #endif 00052 00053 /* Separator in PATH like lists of pathnames. */ 00054 #if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__ 00055 /* Win32, OS/2, DOS */ 00056 # define PATH_SEPARATOR ';' 00057 #else 00058 /* Unix */ 00059 # define PATH_SEPARATOR ':' 00060 #endif 00061 00062 /* Encoding of locale name parts. */ 00063 #define CEN_REVISION 1 00064 #define CEN_SPONSOR 2 00065 #define CEN_SPECIAL 4 00066 #define XPG_NORM_CODESET 8 00067 #define XPG_CODESET 16 00068 #define TERRITORY 32 00069 #define CEN_AUDIENCE 64 00070 #define XPG_MODIFIER 128 00071 00072 #define CEN_SPECIFIC (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE) 00073 #define XPG_SPECIFIC (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER) 00074 00075 00076 struct loaded_l10nfile 00077 { 00078 const char *filename; 00079 int decided; 00080 00081 const void *data; 00082 00083 struct loaded_l10nfile *next; 00084 struct loaded_l10nfile *successor[1]; 00085 }; 00086 00087 00088 /* Normalize codeset name. There is no standard for the codeset 00089 names. Normalization allows the user to use any of the common 00090 names. The return value is dynamically allocated and has to be 00091 freed by the caller. */ 00092 extern const char *_nl_normalize_codeset PARAMS ((const char *codeset, 00093 size_t name_len)); 00094 00095 /* Lookup a locale dependent file. 00096 *L10NFILE_LIST denotes a pool of lookup results of locale dependent 00097 files of the same kind, sorted in decreasing order of ->filename. 00098 DIRLIST and DIRLIST_LEN are an argz list of directories in which to 00099 look, containing at least one directory (i.e. DIRLIST_LEN > 0). 00100 MASK, LANGUAGE, TERRITORY, CODESET, NORMALIZED_CODESET, MODIFIER, 00101 SPECIAL, SPONSOR, REVISION are the pieces of the locale name, as 00102 produced by _nl_explode_name(). FILENAME is the filename suffix. 00103 The return value is the lookup result, either found in *L10NFILE_LIST, 00104 or - if DO_ALLOCATE is nonzero - freshly allocated, or possibly NULL. 00105 If the return value is non-NULL, it is added to *L10NFILE_LIST, and 00106 its ->next field denotes the chaining inside *L10NFILE_LIST, and 00107 furthermore its ->successor[] field contains a list of other lookup 00108 results from which this lookup result inherits. */ 00109 extern struct loaded_l10nfile * 00110 _nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list, 00111 const char *dirlist, size_t dirlist_len, int mask, 00112 const char *language, const char *territory, 00113 const char *codeset, 00114 const char *normalized_codeset, 00115 const char *modifier, const char *special, 00116 const char *sponsor, const char *revision, 00117 const char *filename, int do_allocate)); 00118 00119 /* Lookup the real locale name for a locale alias NAME, or NULL if 00120 NAME is not a locale alias (but possibly a real locale name). 00121 The return value is statically allocated and must not be freed. */ 00122 extern const char *_nl_expand_alias PARAMS ((const char *name)); 00123 00124 /* Split a locale name NAME into its pieces: language, modifier, 00125 territory, codeset, special, sponsor, revision. 00126 NAME gets destructively modified: NUL bytes are inserted here and 00127 there. *LANGUAGE gets assigned NAME. Each of *MODIFIER, *TERRITORY, 00128 *CODESET, *SPECIAL, *SPONSOR, *REVISION gets assigned either a 00129 pointer into the old NAME string, or NULL. *NORMALIZED_CODESET 00130 gets assigned the expanded *CODESET, if it is different from *CODESET; 00131 this one is dynamically allocated and has to be freed by the caller. 00132 The return value is a bitmask, where each bit corresponds to one 00133 filled-in value: 00134 XPG_MODIFIER, CEN_AUDIENCE for *MODIFIER, 00135 TERRITORY for *TERRITORY, 00136 XPG_CODESET for *CODESET, 00137 XPG_NORM_CODESET for *NORMALIZED_CODESET, 00138 CEN_SPECIAL for *SPECIAL, 00139 CEN_SPONSOR for *SPONSOR, 00140 CEN_REVISION for *REVISION. 00141 */ 00142 extern int _nl_explode_name PARAMS ((char *name, const char **language, 00143 const char **modifier, 00144 const char **territory, 00145 const char **codeset, 00146 const char **normalized_codeset, 00147 const char **special, 00148 const char **sponsor, 00149 const char **revision)); 00150 00151 /* Split a locale name NAME into a leading language part and all the 00152 rest. Return a pointer to the first character after the language, 00153 i.e. to the first byte of the rest. */ 00154 extern char *_nl_find_language PARAMS ((const char *name)); 00155 00156 #endif /* loadinfo.h */