1 /* Header describing internals of libintl library.
2 Copyright (C) 1995-1999, 2000, 2001, 2004-2005 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
24 #include <stddef.h> /* Get size_t. */
27 # include "../iconv/gconv_int.h"
36 #include "gmo.h" /* Get nls_uint32. */
38 /* @@ end of prolog @@ */
41 # if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
42 # define PARAMS(args) args
44 # define PARAMS(args) ()
48 #ifndef internal_function
49 # define internal_function
52 #ifndef attribute_hidden
53 # define attribute_hidden
56 /* Tell the compiler when a conditional or integer expression is
57 almost always true or almost always false. */
58 #ifndef HAVE_BUILTIN_EXPECT
59 # define __builtin_expect(expr, val) (expr)
63 # define W(flag, data) ((flag) ? SWAP (data) : (data))
68 # include <byteswap.h>
69 # define SWAP(i) bswap_32 (i)
71 static nls_uint32 SWAP
PARAMS ((nls_uint32 i
));
73 static inline nls_uint32
77 return (i
<< 24) | ((i
& 0xff00) << 8) | ((i
>> 8) & 0xff00) | (i
>> 24);
82 /* In-memory representation of system dependent string. */
83 struct sysdep_string_desc
85 /* Length of addressed string, including the trailing NUL. */
87 /* Pointer to addressed string. */
91 /* Cache of translated strings after charset conversion.
92 Note: The strings are converted to the target encoding only on an as-needed
94 struct converted_domain
96 /* The target encoding name. */
98 /* The descriptor for conversion from the message catalog's encoding to
99 this target encoding. */
107 /* The table of translated strings after charset conversion. */
111 /* The representation of an opened message catalog. */
114 /* Pointer to memory containing the .mo file. */
116 /* 1 if the memory is mmap()ed, 0 if the memory is malloc()ed. */
118 /* Size of mmap()ed memory. */
120 /* 1 if the .mo file uses a different endianness than this machine. */
122 /* Pointer to additional malloc()ed memory. */
125 /* Number of static strings pairs. */
127 /* Pointer to descriptors of original strings in the file. */
128 const struct string_desc
*orig_tab
;
129 /* Pointer to descriptors of translated strings in the file. */
130 const struct string_desc
*trans_tab
;
132 /* Number of system dependent strings pairs. */
133 nls_uint32 n_sysdep_strings
;
134 /* Pointer to descriptors of original sysdep strings. */
135 const struct sysdep_string_desc
*orig_sysdep_tab
;
136 /* Pointer to descriptors of translated sysdep strings. */
137 const struct sysdep_string_desc
*trans_sysdep_tab
;
139 /* Size of hash table. */
140 nls_uint32 hash_size
;
141 /* Pointer to hash table. */
142 const nls_uint32
*hash_tab
;
143 /* 1 if the hash table uses a different endianness than this machine. */
144 int must_swap_hash_tab
;
146 /* Cache of charset conversions of the translated strings. */
147 struct converted_domain
*conversions
;
150 struct expression
*plural
;
151 unsigned long int nplurals
;
154 /* We want to allocate a string at the end of the struct. But ISO C
155 doesn't allow zero sized arrays. */
162 /* A set of settings bound to a message domain. Used to store settings
163 from bindtextdomain() and bind_textdomain_codeset(). */
166 struct binding
*next
;
169 char domainname
[ZERO
];
172 /* A counter which is incremented each time some previous translations
174 This variable is part of the external ABI of the GNU libintl. */
175 extern int _nl_msg_cat_cntr
;
178 const char *_nl_locale_name
PARAMS ((int category
, const char *categoryname
));
181 struct loaded_l10nfile
*_nl_find_domain
PARAMS ((const char *__dirname
,
183 const char *__domainname
,
184 struct binding
*__domainbinding
))
186 void _nl_load_domain
PARAMS ((struct loaded_l10nfile
*__domain
,
187 struct binding
*__domainbinding
))
190 char *_nl_find_msg
PARAMS ((struct loaded_l10nfile
*domain_file
,
191 struct binding
*domainbinding
, const char *msgid
,
192 int convert
, size_t *lengthp
))
196 extern char *__gettext
PARAMS ((const char *__msgid
));
197 extern char *__dgettext
PARAMS ((const char *__domainname
,
198 const char *__msgid
));
199 extern char *__dcgettext
PARAMS ((const char *__domainname
,
200 const char *__msgid
, int __category
));
201 extern char *__ngettext
PARAMS ((const char *__msgid1
, const char *__msgid2
,
202 unsigned long int __n
));
203 extern char *__dngettext
PARAMS ((const char *__domainname
,
204 const char *__msgid1
, const char *__msgid2
,
205 unsigned long int n
));
206 extern char *__dcngettext
PARAMS ((const char *__domainname
,
207 const char *__msgid1
, const char *__msgid2
,
208 unsigned long int __n
, int __category
));
209 extern char *__dcigettext
PARAMS ((const char *__domainname
,
210 const char *__msgid1
, const char *__msgid2
,
211 int __plural
, unsigned long int __n
,
213 extern char *__textdomain
PARAMS ((const char *__domainname
));
214 extern char *__bindtextdomain
PARAMS ((const char *__domainname
,
215 const char *__dirname
));
216 extern char *__bind_textdomain_codeset
PARAMS ((const char *__domainname
,
217 const char *__codeset
));
218 extern void _nl_finddomain_subfreeres
PARAMS ((void)) attribute_hidden
;
219 extern void _nl_unload_domain
PARAMS ((struct loaded_domain
*__domain
))
220 internal_function attribute_hidden
;
222 extern char *libintl_gettext
PARAMS ((const char *__msgid
));
223 extern char *libintl_dgettext
PARAMS ((const char *__domainname
,
224 const char *__msgid
));
225 extern char *libintl_dcgettext
PARAMS ((const char *__domainname
,
226 const char *__msgid
, int __category
));
227 extern char *libintl_ngettext
PARAMS ((const char *__msgid1
,
228 const char *__msgid2
,
229 unsigned long int __n
));
230 extern char *libintl_dngettext
PARAMS ((const char *__domainname
,
231 const char *__msgid1
,
232 const char *__msgid2
,
233 unsigned long int __n
));
234 extern char *libintl_dcngettext
PARAMS ((const char *__domainname
,
235 const char *__msgid1
,
236 const char *__msgid2
,
237 unsigned long int __n
,
239 extern char *libintl_dcigettext
PARAMS ((const char *__domainname
,
240 const char *__msgid1
,
241 const char *__msgid2
,
242 int __plural
, unsigned long int __n
,
244 extern char *libintl_textdomain
PARAMS ((const char *__domainname
));
245 extern char *libintl_bindtextdomain
PARAMS ((const char *__domainname
,
246 const char *__dirname
));
247 extern char *libintl_bind_textdomain_codeset
PARAMS ((const char *__domainname
,
248 const char *__codeset
));
251 /* @@ begin of epilog @@ */
253 #endif /* gettextP.h */