1 /* Header describing internals of libintl library.
2 Copyright (C) 1995-1999, 2000, 2001 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 "gettext.h" /* Get nls_uint32. */
38 /* @@ end of prolog @@ */
42 # define PARAMS(args) args
44 # define PARAMS(args) ()
48 #ifndef internal_function
49 # define internal_function
52 /* Tell the compiler when a conditional or integer expression is
53 almost always true or almost always false. */
54 #ifndef HAVE_BUILTIN_EXPECT
55 # define __builtin_expect(expr, val) (expr)
59 # define W(flag, data) ((flag) ? SWAP (data) : (data))
64 # include <byteswap.h>
65 # define SWAP(i) bswap_32 (i)
67 static nls_uint32 SWAP
PARAMS ((nls_uint32 i
));
69 static inline nls_uint32
73 return (i
<< 24) | ((i
& 0xff00) << 8) | ((i
>> 8) & 0xff00) | (i
>> 24);
78 /* In-memory representation of system dependent string. */
79 struct sysdep_string_desc
81 /* Length of addressed string, including the trailing NUL. */
83 /* Pointer to addressed string. */
87 /* The representation of an opened message catalog. */
90 /* Pointer to memory containing the .mo file. */
92 /* 1 if the memory is mmap()ed, 0 if the memory is malloc()ed. */
94 /* Size of mmap()ed memory. */
96 /* 1 if the .mo file uses a different endianness than this machine. */
98 /* Pointer to additional malloc()ed memory. */
101 /* Number of static strings pairs. */
103 /* Pointer to descriptors of original strings in the file. */
104 const struct string_desc
*orig_tab
;
105 /* Pointer to descriptors of translated strings in the file. */
106 const struct string_desc
*trans_tab
;
108 /* Number of system dependent strings pairs. */
109 nls_uint32 n_sysdep_strings
;
110 /* Pointer to descriptors of original sysdep strings. */
111 const struct sysdep_string_desc
*orig_sysdep_tab
;
112 /* Pointer to descriptors of translated sysdep strings. */
113 const struct sysdep_string_desc
*trans_sysdep_tab
;
115 /* Size of hash table. */
116 nls_uint32 hash_size
;
117 /* Pointer to hash table. */
118 const nls_uint32
*hash_tab
;
119 /* 1 if the hash table uses a different endianness than this machine. */
120 int must_swap_hash_tab
;
132 struct expression
*plural
;
133 unsigned long int nplurals
;
136 /* We want to allocate a string at the end of the struct. But ISO C
137 doesn't allow zero sized arrays. */
144 /* A set of settings bound to a message domain. Used to store settings
145 from bindtextdomain() and bind_textdomain_codeset(). */
148 struct binding
*next
;
150 int codeset_cntr
; /* Incremented each time codeset changes. */
152 char domainname
[ZERO
];
155 /* A counter which is incremented each time some previous translations
157 This variable is part of the external ABI of the GNU libintl. */
158 extern int _nl_msg_cat_cntr
;
160 struct loaded_l10nfile
*_nl_find_domain
PARAMS ((const char *__dirname
,
162 const char *__domainname
,
163 struct binding
*__domainbinding
))
165 void _nl_load_domain
PARAMS ((struct loaded_l10nfile
*__domain
,
166 struct binding
*__domainbinding
))
168 void _nl_unload_domain
PARAMS ((struct loaded_domain
*__domain
))
170 const char *_nl_init_domain_conv
PARAMS ((struct loaded_l10nfile
*__domain_file
,
171 struct loaded_domain
*__domain
,
172 struct binding
*__domainbinding
))
174 void _nl_free_domain_conv
PARAMS ((struct loaded_domain
*__domain
))
177 char *_nl_find_msg
PARAMS ((struct loaded_l10nfile
*domain_file
,
178 struct binding
*domainbinding
,
179 const char *msgid
, size_t *lengthp
))
183 extern char *__gettext
PARAMS ((const char *__msgid
));
184 extern char *__dgettext
PARAMS ((const char *__domainname
,
185 const char *__msgid
));
186 extern char *__dcgettext
PARAMS ((const char *__domainname
,
187 const char *__msgid
, int __category
));
188 extern char *__ngettext
PARAMS ((const char *__msgid1
, const char *__msgid2
,
189 unsigned long int __n
));
190 extern char *__dngettext
PARAMS ((const char *__domainname
,
191 const char *__msgid1
, const char *__msgid2
,
192 unsigned long int n
));
193 extern char *__dcngettext
PARAMS ((const char *__domainname
,
194 const char *__msgid1
, const char *__msgid2
,
195 unsigned long int __n
, int __category
));
196 extern char *__dcigettext
PARAMS ((const char *__domainname
,
197 const char *__msgid1
, const char *__msgid2
,
198 int __plural
, unsigned long int __n
,
200 extern char *__textdomain
PARAMS ((const char *__domainname
));
201 extern char *__bindtextdomain
PARAMS ((const char *__domainname
,
202 const char *__dirname
));
203 extern char *__bind_textdomain_codeset
PARAMS ((const char *__domainname
,
204 const char *__codeset
));
206 extern char *gettext__
PARAMS ((const char *__msgid
));
207 extern char *dgettext__
PARAMS ((const char *__domainname
,
208 const char *__msgid
));
209 extern char *dcgettext__
PARAMS ((const char *__domainname
,
210 const char *__msgid
, int __category
));
211 extern char *ngettext__
PARAMS ((const char *__msgid1
, const char *__msgid2
,
212 unsigned long int __n
));
213 extern char *dngettext__
PARAMS ((const char *__domainname
,
214 const char *__msgid1
, const char *__msgid2
,
215 unsigned long int __n
));
216 extern char *dcngettext__
PARAMS ((const char *__domainname
,
217 const char *__msgid1
, const char *__msgid2
,
218 unsigned long int __n
, int __category
));
219 extern char *dcigettext__
PARAMS ((const char *__domainname
,
220 const char *__msgid1
, const char *__msgid2
,
221 int __plural
, unsigned long int __n
,
223 extern char *textdomain__
PARAMS ((const char *__domainname
));
224 extern char *bindtextdomain__
PARAMS ((const char *__domainname
,
225 const char *__dirname
));
226 extern char *bind_textdomain_codeset__
PARAMS ((const char *__domainname
,
227 const char *__codeset
));
230 /* @@ begin of epilog @@ */
232 #endif /* gettextP.h */