mutt_*mktemp--
[apps/madmutt.git] / intl / loadinfo.h
1 /* Copyright (C) 1996-1999, 2000-2003, 2005-2006 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
4
5    This program is free software; you can redistribute it and/or modify it
6    under the terms of the GNU Library General Public License as published
7    by the Free Software Foundation; either version 2, or (at your option)
8    any later version.
9
10    This program 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 this program; if not, write to the Free Software
17    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
18    USA.  */
19
20 #ifndef _LOADINFO_H
21 #define _LOADINFO_H     1
22
23 /* Declarations of locale dependent catalog lookup functions.
24    Implemented in
25
26      localealias.c    Possibly replace a locale name by another.
27      explodename.c    Split a locale name into its various fields.
28      l10nflist.c      Generate a list of filenames of possible message catalogs.
29      finddomain.c     Find and open the relevant message catalogs.
30
31    The main function _nl_find_domain() in finddomain.c is declared
32    in gettextP.h.
33  */
34
35 #ifndef internal_function
36 # define internal_function
37 #endif
38
39 #ifndef LIBINTL_DLL_EXPORTED
40 # define LIBINTL_DLL_EXPORTED
41 #endif
42
43 /* Tell the compiler when a conditional or integer expression is
44    almost always true or almost always false.  */
45 #ifndef HAVE_BUILTIN_EXPECT
46 # define __builtin_expect(expr, val) (expr)
47 #endif
48
49 /* Separator in PATH like lists of pathnames.  */
50 #if ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) || defined __EMX__ || defined __DJGPP__
51   /* Win32, OS/2, DOS */
52 # define PATH_SEPARATOR ';'
53 #else
54   /* Unix */
55 # define PATH_SEPARATOR ':'
56 #endif
57
58 /* Encoding of locale name parts.  */
59 #define XPG_NORM_CODESET        1
60 #define XPG_CODESET             2
61 #define XPG_TERRITORY           4
62 #define XPG_MODIFIER            8
63
64
65 struct loaded_l10nfile
66 {
67   const char *filename;
68   int decided;
69
70   const void *data;
71
72   struct loaded_l10nfile *next;
73   struct loaded_l10nfile *successor[1];
74 };
75
76
77 /* Normalize codeset name.  There is no standard for the codeset
78    names.  Normalization allows the user to use any of the common
79    names.  The return value is dynamically allocated and has to be
80    freed by the caller.  */
81 extern const char *_nl_normalize_codeset (const char *codeset,
82                                           size_t name_len);
83
84 /* Lookup a locale dependent file.
85    *L10NFILE_LIST denotes a pool of lookup results of locale dependent
86    files of the same kind, sorted in decreasing order of ->filename.
87    DIRLIST and DIRLIST_LEN are an argz list of directories in which to
88    look, containing at least one directory (i.e. DIRLIST_LEN > 0).
89    MASK, LANGUAGE, TERRITORY, CODESET, NORMALIZED_CODESET, MODIFIER
90    are the pieces of the locale name, as produced by _nl_explode_name().
91    FILENAME is the filename suffix.
92    The return value is the lookup result, either found in *L10NFILE_LIST,
93    or - if DO_ALLOCATE is nonzero - freshly allocated, or possibly NULL.
94    If the return value is non-NULL, it is added to *L10NFILE_LIST, and
95    its ->next field denotes the chaining inside *L10NFILE_LIST, and
96    furthermore its ->successor[] field contains a list of other lookup
97    results from which this lookup result inherits.  */
98 extern struct loaded_l10nfile *
99 _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
100                     const char *dirlist, size_t dirlist_len, int mask,
101                     const char *language, const char *territory,
102                     const char *codeset, const char *normalized_codeset,
103                     const char *modifier,
104                     const char *filename, int do_allocate);
105
106 /* Lookup the real locale name for a locale alias NAME, or NULL if
107    NAME is not a locale alias (but possibly a real locale name).
108    The return value is statically allocated and must not be freed.  */
109 /* Part of the libintl ABI only for the sake of the gettext.m4 macro.  */
110 extern LIBINTL_DLL_EXPORTED const char *_nl_expand_alias (const char *name);
111
112 /* Split a locale name NAME into its pieces: language, modifier,
113    territory, codeset.
114    NAME gets destructively modified: NUL bytes are inserted here and
115    there.  *LANGUAGE gets assigned NAME.  Each of *MODIFIER, *TERRITORY,
116    *CODESET gets assigned either a pointer into the old NAME string, or
117    NULL.  *NORMALIZED_CODESET gets assigned the expanded *CODESET, if it
118    is different from *CODESET; this one is dynamically allocated and has
119    to be freed by the caller.
120    The return value is a bitmask, where each bit corresponds to one
121    filled-in value:
122      XPG_MODIFIER                for *MODIFIER,
123      XPG_TERRITORY               for *TERRITORY,
124      XPG_CODESET                 for *CODESET,
125      XPG_NORM_CODESET            for *NORMALIZED_CODESET.
126  */
127 extern int _nl_explode_name (char *name, const char **language,
128                              const char **modifier, const char **territory,
129                              const char **codeset,
130                              const char **normalized_codeset);
131
132 #endif  /* loadinfo.h */