1 /* Header describing internals of libintl library.
2 Copyright (C) 1995-1999, 2000, 2001, 2004-2005, 2007, 2011
3 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5 Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 The GNU C Library 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 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, write to the Free
19 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
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
58 # define W(flag, data) ((flag) ? SWAP (data) : (data))
63 # include <byteswap.h>
64 # define SWAP(i) bswap_32 (i)
66 static nls_uint32 SWAP
PARAMS ((nls_uint32 i
));
68 static inline nls_uint32
72 return (i
<< 24) | ((i
& 0xff00) << 8) | ((i
>> 8) & 0xff00) | (i
>> 24);
77 /* In-memory representation of system dependent string. */
78 struct sysdep_string_desc
80 /* Length of addressed string, including the trailing NUL. */
82 /* Pointer to addressed string. */
86 /* Cache of translated strings after charset conversion.
87 Note: The strings are converted to the target encoding only on an as-needed
89 struct converted_domain
91 /* The target encoding name. */
93 /* The descriptor for conversion from the message catalog's encoding to
94 this target encoding. */
102 /* The table of translated strings after charset conversion. */
106 /* The representation of an opened message catalog. */
109 /* Pointer to memory containing the .mo file. */
111 /* 1 if the memory is mmap()ed, 0 if the memory is malloc()ed. */
113 /* Size of mmap()ed memory. */
115 /* 1 if the .mo file uses a different endianness than this machine. */
117 /* Pointer to additional malloc()ed memory. */
120 /* Number of static strings pairs. */
122 /* Pointer to descriptors of original strings in the file. */
123 const struct string_desc
*orig_tab
;
124 /* Pointer to descriptors of translated strings in the file. */
125 const struct string_desc
*trans_tab
;
127 /* Number of system dependent strings pairs. */
128 nls_uint32 n_sysdep_strings
;
129 /* Pointer to descriptors of original sysdep strings. */
130 const struct sysdep_string_desc
*orig_sysdep_tab
;
131 /* Pointer to descriptors of translated sysdep strings. */
132 const struct sysdep_string_desc
*trans_sysdep_tab
;
134 /* Size of hash table. */
135 nls_uint32 hash_size
;
136 /* Pointer to hash table. */
137 const nls_uint32
*hash_tab
;
138 /* 1 if the hash table uses a different endianness than this machine. */
139 int must_swap_hash_tab
;
141 /* Cache of charset conversions of the translated strings. */
142 struct converted_domain
*conversions
;
144 __libc_rwlock_define (, conversions_lock
);
146 const struct expression
*plural
;
147 unsigned long int nplurals
;
150 /* We want to allocate a string at the end of the struct. But ISO C
151 doesn't allow zero sized arrays. */
158 /* A set of settings bound to a message domain. Used to store settings
159 from bindtextdomain() and bind_textdomain_codeset(). */
162 struct binding
*next
;
165 char domainname
[ZERO
];
168 /* A counter which is incremented each time some previous translations
170 This variable is part of the external ABI of the GNU libintl. */
171 extern int _nl_msg_cat_cntr
;
174 const char *_nl_locale_name
PARAMS ((int category
, const char *categoryname
));
177 struct loaded_l10nfile
*_nl_find_domain
PARAMS ((const char *__dirname
,
179 const char *__domainname
,
180 struct binding
*__domainbinding
))
182 void _nl_load_domain
PARAMS ((struct loaded_l10nfile
*__domain
,
183 struct binding
*__domainbinding
))
186 char *_nl_find_msg
PARAMS ((struct loaded_l10nfile
*domain_file
,
187 struct binding
*domainbinding
, const char *msgid
,
188 int convert
, size_t *lengthp
))
192 extern char *__gettext
PARAMS ((const char *__msgid
));
193 extern char *__dgettext
PARAMS ((const char *__domainname
,
194 const char *__msgid
));
195 extern char *__dcgettext
PARAMS ((const char *__domainname
,
196 const char *__msgid
, int __category
));
197 extern char *__ngettext
PARAMS ((const char *__msgid1
, const char *__msgid2
,
198 unsigned long int __n
));
199 extern char *__dngettext
PARAMS ((const char *__domainname
,
200 const char *__msgid1
, const char *__msgid2
,
201 unsigned long int n
));
202 extern char *__dcngettext
PARAMS ((const char *__domainname
,
203 const char *__msgid1
, const char *__msgid2
,
204 unsigned long int __n
, int __category
));
205 extern char *__dcigettext
PARAMS ((const char *__domainname
,
206 const char *__msgid1
, const char *__msgid2
,
207 int __plural
, unsigned long int __n
,
209 extern char *__textdomain
PARAMS ((const char *__domainname
));
210 extern char *__bindtextdomain
PARAMS ((const char *__domainname
,
211 const char *__dirname
));
212 extern char *__bind_textdomain_codeset
PARAMS ((const char *__domainname
,
213 const char *__codeset
));
214 extern void _nl_finddomain_subfreeres
PARAMS ((void)) attribute_hidden
;
215 extern void _nl_unload_domain
PARAMS ((struct loaded_domain
*__domain
))
216 internal_function attribute_hidden
;
218 extern char *libintl_gettext
PARAMS ((const char *__msgid
));
219 extern char *libintl_dgettext
PARAMS ((const char *__domainname
,
220 const char *__msgid
));
221 extern char *libintl_dcgettext
PARAMS ((const char *__domainname
,
222 const char *__msgid
, int __category
));
223 extern char *libintl_ngettext
PARAMS ((const char *__msgid1
,
224 const char *__msgid2
,
225 unsigned long int __n
));
226 extern char *libintl_dngettext
PARAMS ((const char *__domainname
,
227 const char *__msgid1
,
228 const char *__msgid2
,
229 unsigned long int __n
));
230 extern char *libintl_dcngettext
PARAMS ((const char *__domainname
,
231 const char *__msgid1
,
232 const char *__msgid2
,
233 unsigned long int __n
,
235 extern char *libintl_dcigettext
PARAMS ((const char *__domainname
,
236 const char *__msgid1
,
237 const char *__msgid2
,
238 int __plural
, unsigned long int __n
,
240 extern char *libintl_textdomain
PARAMS ((const char *__domainname
));
241 extern char *libintl_bindtextdomain
PARAMS ((const char *__domainname
,
242 const char *__dirname
));
243 extern char *libintl_bind_textdomain_codeset
PARAMS ((const char *__domainname
,
244 const char *__codeset
));
247 /* @@ begin of epilog @@ */
249 #endif /* gettextP.h */