1 /* gettextP.h - Header describing internals of libintl library. */
3 /* Copyright (C) 1995-1999, 2000-2003, 2005-2009 Free Software Foundation, Inc.
4 Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
6 This file is part of GNU Bash.
8 Bash is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 Bash is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with Bash. If not, see <http://www.gnu.org/licenses/>.
25 #include <stddef.h> /* Get size_t. */
28 # include "../iconv/gconv_int.h"
37 #include "gmo.h" /* Get nls_uint32. */
39 /* @@ end of prolog @@ */
42 # if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
43 # define PARAMS(args) args
45 # define PARAMS(args) ()
49 #ifndef internal_function
50 # define internal_function
53 #ifndef attribute_hidden
54 # define attribute_hidden
57 /* Tell the compiler when a conditional or integer expression is
58 almost always true or almost always false. */
59 #ifndef HAVE_BUILTIN_EXPECT
60 # define __builtin_expect(expr, val) (expr)
64 # define W(flag, data) ((flag) ? SWAP (data) : (data))
69 # include <byteswap.h>
70 # define SWAP(i) bswap_32 (i)
72 static inline nls_uint32
76 return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
81 /* In-memory representation of system dependent string. */
82 struct sysdep_string_desc
84 /* Length of addressed string, including the trailing NUL. */
86 /* Pointer to addressed string. */
90 /* The representation of an opened message catalog. */
93 /* Pointer to memory containing the .mo file. */
95 /* 1 if the memory is mmap()ed, 0 if the memory is malloc()ed. */
97 /* Size of mmap()ed memory. */
99 /* 1 if the .mo file uses a different endianness than this machine. */
101 /* Pointer to additional malloc()ed memory. */
104 /* Number of static strings pairs. */
106 /* Pointer to descriptors of original strings in the file. */
107 const struct string_desc *orig_tab;
108 /* Pointer to descriptors of translated strings in the file. */
109 const struct string_desc *trans_tab;
111 /* Number of system dependent strings pairs. */
112 nls_uint32 n_sysdep_strings;
113 /* Pointer to descriptors of original sysdep strings. */
114 const struct sysdep_string_desc *orig_sysdep_tab;
115 /* Pointer to descriptors of translated sysdep strings. */
116 const struct sysdep_string_desc *trans_sysdep_tab;
118 /* Size of hash table. */
119 nls_uint32 hash_size;
120 /* Pointer to hash table. */
121 const nls_uint32 *hash_tab;
122 /* 1 if the hash table uses a different endianness than this machine. */
123 int must_swap_hash_tab;
135 struct expression *plural;
136 unsigned long int nplurals;
139 /* We want to allocate a string at the end of the struct. But ISO C
140 doesn't allow zero sized arrays. */
147 /* A set of settings bound to a message domain. Used to store settings
148 from bindtextdomain() and bind_textdomain_codeset(). */
151 struct binding *next;
153 int codeset_cntr; /* Incremented each time codeset changes. */
155 char domainname[ZERO];
158 /* A counter which is incremented each time some previous translations
160 This variable is part of the external ABI of the GNU libintl. */
161 extern int _nl_msg_cat_cntr;
164 const char *_nl_locale_name PARAMS ((int category, const char *categoryname));
167 struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
169 const char *__domainname,
170 struct binding *__domainbinding))
172 void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain,
173 struct binding *__domainbinding))
175 void _nl_unload_domain PARAMS ((struct loaded_domain *__domain))
177 const char *_nl_init_domain_conv PARAMS ((struct loaded_l10nfile *__domain_file,
178 struct loaded_domain *__domain,
179 struct binding *__domainbinding))
181 void _nl_free_domain_conv PARAMS ((struct loaded_domain *__domain))
184 char *_nl_find_msg PARAMS ((struct loaded_l10nfile *domain_file,
185 struct binding *domainbinding,
186 const char *msgid, size_t *lengthp))
190 extern char *__gettext PARAMS ((const char *__msgid));
191 extern char *__dgettext PARAMS ((const char *__domainname,
192 const char *__msgid));
193 extern char *__dcgettext PARAMS ((const char *__domainname,
194 const char *__msgid, int __category));
195 extern char *__ngettext PARAMS ((const char *__msgid1, const char *__msgid2,
196 unsigned long int __n));
197 extern char *__dngettext PARAMS ((const char *__domainname,
198 const char *__msgid1, const char *__msgid2,
199 unsigned long int n));
200 extern char *__dcngettext PARAMS ((const char *__domainname,
201 const char *__msgid1, const char *__msgid2,
202 unsigned long int __n, int __category));
203 extern char *__dcigettext PARAMS ((const char *__domainname,
204 const char *__msgid1, const char *__msgid2,
205 int __plural, unsigned long int __n,
207 extern char *__textdomain PARAMS ((const char *__domainname));
208 extern char *__bindtextdomain PARAMS ((const char *__domainname,
209 const char *__dirname));
210 extern char *__bind_textdomain_codeset PARAMS ((const char *__domainname,
211 const char *__codeset));
213 /* Declare the exported libintl_* functions, in a way that allows us to
214 call them under their real name. */
215 # define _INTL_REDIRECT_MACROS
216 # include "libgnuintl.h"
217 extern char *libintl_dcigettext PARAMS ((const char *__domainname,
218 const char *__msgid1,
219 const char *__msgid2,
220 int __plural, unsigned long int __n,
224 /* @@ begin of epilog @@ */
226 #endif /* gettextP.h */