Back to index

courier  0.68.2
loadinfo.h
Go to the documentation of this file.
00001 /* Copyright (C) 1996-1999, 2000-2003, 2005-2006 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
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 #ifndef LIBINTL_DLL_EXPORTED
00040 # define LIBINTL_DLL_EXPORTED
00041 #endif
00042 
00043 /* Tell the compiler when a conditional or integer expression is
00044    almost always true or almost always false.  */
00045 #ifndef HAVE_BUILTIN_EXPECT
00046 # define __builtin_expect(expr, val) (expr)
00047 #endif
00048 
00049 /* Separator in PATH like lists of pathnames.  */
00050 #if ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) || defined __EMX__ || defined __DJGPP__
00051   /* Win32, OS/2, DOS */
00052 # define PATH_SEPARATOR ';'
00053 #else
00054   /* Unix */
00055 # define PATH_SEPARATOR ':'
00056 #endif
00057 
00058 /* Encoding of locale name parts.  */
00059 #define XPG_NORM_CODESET    1
00060 #define XPG_CODESET         2
00061 #define XPG_TERRITORY              4
00062 #define XPG_MODIFIER        8
00063 
00064 
00065 struct loaded_l10nfile
00066 {
00067   const char *filename;
00068   int decided;
00069 
00070   const void *data;
00071 
00072   struct loaded_l10nfile *next;
00073   struct loaded_l10nfile *successor[1];
00074 };
00075 
00076 
00077 /* Normalize codeset name.  There is no standard for the codeset
00078    names.  Normalization allows the user to use any of the common
00079    names.  The return value is dynamically allocated and has to be
00080    freed by the caller.  */
00081 extern const char *_nl_normalize_codeset (const char *codeset,
00082                                      size_t name_len);
00083 
00084 /* Lookup a locale dependent file.
00085    *L10NFILE_LIST denotes a pool of lookup results of locale dependent
00086    files of the same kind, sorted in decreasing order of ->filename.
00087    DIRLIST and DIRLIST_LEN are an argz list of directories in which to
00088    look, containing at least one directory (i.e. DIRLIST_LEN > 0).
00089    MASK, LANGUAGE, TERRITORY, CODESET, NORMALIZED_CODESET, MODIFIER
00090    are the pieces of the locale name, as produced by _nl_explode_name().
00091    FILENAME is the filename suffix.
00092    The return value is the lookup result, either found in *L10NFILE_LIST,
00093    or - if DO_ALLOCATE is nonzero - freshly allocated, or possibly NULL.
00094    If the return value is non-NULL, it is added to *L10NFILE_LIST, and
00095    its ->next field denotes the chaining inside *L10NFILE_LIST, and
00096    furthermore its ->successor[] field contains a list of other lookup
00097    results from which this lookup result inherits.  */
00098 extern struct loaded_l10nfile *
00099 _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
00100                   const char *dirlist, size_t dirlist_len, int mask,
00101                   const char *language, const char *territory,
00102                   const char *codeset, const char *normalized_codeset,
00103                   const char *modifier,
00104                   const char *filename, int do_allocate);
00105 
00106 /* Lookup the real locale name for a locale alias NAME, or NULL if
00107    NAME is not a locale alias (but possibly a real locale name).
00108    The return value is statically allocated and must not be freed.  */
00109 /* Part of the libintl ABI only for the sake of the gettext.m4 macro.  */
00110 extern LIBINTL_DLL_EXPORTED const char *_nl_expand_alias (const char *name);
00111 
00112 /* Split a locale name NAME into its pieces: language, modifier,
00113    territory, codeset.
00114    NAME gets destructively modified: NUL bytes are inserted here and
00115    there.  *LANGUAGE gets assigned NAME.  Each of *MODIFIER, *TERRITORY,
00116    *CODESET gets assigned either a pointer into the old NAME string, or
00117    NULL.  *NORMALIZED_CODESET gets assigned the expanded *CODESET, if it
00118    is different from *CODESET; this one is dynamically allocated and has
00119    to be freed by the caller.
00120    The return value is a bitmask, where each bit corresponds to one
00121    filled-in value:
00122      XPG_MODIFIER                for *MODIFIER,
00123      XPG_TERRITORY               for *TERRITORY,
00124      XPG_CODESET                 for *CODESET,
00125      XPG_NORM_CODESET            for *NORMALIZED_CODESET.
00126  */
00127 extern int _nl_explode_name (char *name, const char **language,
00128                           const char **modifier, const char **territory,
00129                           const char **codeset,
00130                           const char **normalized_codeset);
00131 
00132 #endif /* loadinfo.h */