No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / texinfo / intl / loadinfo.h
blob8e66fa86c59af6842cc47a3a02614207bf0af696
1 /* $NetBSD$ */
3 /* Copyright (C) 1996-1999, 2000-2003 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5 Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
7 This program is free software; you can redistribute it and/or modify it
8 under the terms of the GNU Library General Public License as published
9 by the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public
18 License along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20 USA. */
22 #ifndef _LOADINFO_H
23 #define _LOADINFO_H 1
25 /* Declarations of locale dependent catalog lookup functions.
26 Implemented in
28 localealias.c Possibly replace a locale name by another.
29 explodename.c Split a locale name into its various fields.
30 l10nflist.c Generate a list of filenames of possible message catalogs.
31 finddomain.c Find and open the relevant message catalogs.
33 The main function _nl_find_domain() in finddomain.c is declared
34 in gettextP.h.
37 #ifndef internal_function
38 # define internal_function
39 #endif
41 /* Tell the compiler when a conditional or integer expression is
42 almost always true or almost always false. */
43 #ifndef HAVE_BUILTIN_EXPECT
44 # define __builtin_expect(expr, val) (expr)
45 #endif
47 /* Separator in PATH like lists of pathnames. */
48 #if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
49 /* Win32, OS/2, DOS */
50 # define PATH_SEPARATOR ';'
51 #else
52 /* Unix */
53 # define PATH_SEPARATOR ':'
54 #endif
56 /* Encoding of locale name parts. */
57 #define CEN_REVISION 1
58 #define CEN_SPONSOR 2
59 #define CEN_SPECIAL 4
60 #define XPG_NORM_CODESET 8
61 #define XPG_CODESET 16
62 #define TERRITORY 32
63 #define CEN_AUDIENCE 64
64 #define XPG_MODIFIER 128
66 #define CEN_SPECIFIC (CEN_REVISION|CEN_SPONSOR|CEN_SPECIAL|CEN_AUDIENCE)
67 #define XPG_SPECIFIC (XPG_CODESET|XPG_NORM_CODESET|XPG_MODIFIER)
70 struct loaded_l10nfile
72 const char *filename;
73 int decided;
75 const void *data;
77 struct loaded_l10nfile *next;
78 struct loaded_l10nfile *successor[1];
82 /* Normalize codeset name. There is no standard for the codeset
83 names. Normalization allows the user to use any of the common
84 names. The return value is dynamically allocated and has to be
85 freed by the caller. */
86 extern const char *_nl_normalize_codeset (const char *codeset,
87 size_t name_len);
89 /* Lookup a locale dependent file.
90 *L10NFILE_LIST denotes a pool of lookup results of locale dependent
91 files of the same kind, sorted in decreasing order of ->filename.
92 DIRLIST and DIRLIST_LEN are an argz list of directories in which to
93 look, containing at least one directory (i.e. DIRLIST_LEN > 0).
94 MASK, LANGUAGE, TERRITORY, CODESET, NORMALIZED_CODESET, MODIFIER,
95 SPECIAL, SPONSOR, REVISION are the pieces of the locale name, as
96 produced by _nl_explode_name(). FILENAME is the filename suffix.
97 The return value is the lookup result, either found in *L10NFILE_LIST,
98 or - if DO_ALLOCATE is nonzero - freshly allocated, or possibly NULL.
99 If the return value is non-NULL, it is added to *L10NFILE_LIST, and
100 its ->next field denotes the chaining inside *L10NFILE_LIST, and
101 furthermore its ->successor[] field contains a list of other lookup
102 results from which this lookup result inherits. */
103 extern struct loaded_l10nfile *
104 _nl_make_l10nflist (struct loaded_l10nfile **l10nfile_list,
105 const char *dirlist, size_t dirlist_len, int mask,
106 const char *language, const char *territory,
107 const char *codeset, const char *normalized_codeset,
108 const char *modifier, const char *special,
109 const char *sponsor, const char *revision,
110 const char *filename, int do_allocate);
112 /* Lookup the real locale name for a locale alias NAME, or NULL if
113 NAME is not a locale alias (but possibly a real locale name).
114 The return value is statically allocated and must not be freed. */
115 extern const char *_nl_expand_alias (const char *name);
117 /* Split a locale name NAME into its pieces: language, modifier,
118 territory, codeset, special, sponsor, revision.
119 NAME gets destructively modified: NUL bytes are inserted here and
120 there. *LANGUAGE gets assigned NAME. Each of *MODIFIER, *TERRITORY,
121 *CODESET, *SPECIAL, *SPONSOR, *REVISION gets assigned either a
122 pointer into the old NAME string, or NULL. *NORMALIZED_CODESET
123 gets assigned the expanded *CODESET, if it is different from *CODESET;
124 this one is dynamically allocated and has to be freed by the caller.
125 The return value is a bitmask, where each bit corresponds to one
126 filled-in value:
127 XPG_MODIFIER, CEN_AUDIENCE for *MODIFIER,
128 TERRITORY for *TERRITORY,
129 XPG_CODESET for *CODESET,
130 XPG_NORM_CODESET for *NORMALIZED_CODESET,
131 CEN_SPECIAL for *SPECIAL,
132 CEN_SPONSOR for *SPONSOR,
133 CEN_REVISION for *REVISION.
135 extern int _nl_explode_name (char *name, const char **language,
136 const char **modifier, const char **territory,
137 const char **codeset,
138 const char **normalized_codeset,
139 const char **special, const char **sponsor,
140 const char **revision);
142 /* Split a locale name NAME into a leading language part and all the
143 rest. Return a pointer to the first character after the language,
144 i.e. to the first byte of the rest. */
145 extern char *_nl_find_language (const char *name);
147 #endif /* loadinfo.h */