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