3 /* Header describing internals of libintl library.
4 Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc.
5 Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
7 This program is free software; you can redistribute it and/or modify it
8 under the terms of the GNU Library General Public License as published
9 by the Free Software Foundation; either version 2, or (at your option)
12 This program 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 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public
18 License along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
25 #include <stddef.h> /* Get size_t. */
28 # include "../iconv/gconv_int.h"
37 #include "gmo.h" /* Get nls_uint32. */
39 /* @@ end of prolog @@ */
41 #ifndef internal_function
42 # define internal_function
45 #ifndef attribute_hidden
46 # define attribute_hidden
49 /* Tell the compiler when a conditional or integer expression is
50 almost always true or almost always false. */
51 #ifndef HAVE_BUILTIN_EXPECT
52 # define __builtin_expect(expr, val) (expr)
56 # define W(flag, data) ((flag) ? SWAP (data) : (data))
61 # include <byteswap.h>
62 # define SWAP(i) bswap_32 (i)
64 static inline nls_uint32
68 return (i
<< 24) | ((i
& 0xff00) << 8) | ((i
>> 8) & 0xff00) | (i
>> 24);
73 /* In-memory representation of system dependent string. */
74 struct sysdep_string_desc
76 /* Length of addressed string, including the trailing NUL. */
78 /* Pointer to addressed string. */
82 /* The representation of an opened message catalog. */
85 /* Pointer to memory containing the .mo file. */
87 /* 1 if the memory is mmap()ed, 0 if the memory is malloc()ed. */
89 /* Size of mmap()ed memory. */
91 /* 1 if the .mo file uses a different endianness than this machine. */
93 /* Pointer to additional malloc()ed memory. */
96 /* Number of static strings pairs. */
98 /* Pointer to descriptors of original strings in the file. */
99 const struct string_desc
*orig_tab
;
100 /* Pointer to descriptors of translated strings in the file. */
101 const struct string_desc
*trans_tab
;
103 /* Number of system dependent strings pairs. */
104 nls_uint32 n_sysdep_strings
;
105 /* Pointer to descriptors of original sysdep strings. */
106 const struct sysdep_string_desc
*orig_sysdep_tab
;
107 /* Pointer to descriptors of translated sysdep strings. */
108 const struct sysdep_string_desc
*trans_sysdep_tab
;
110 /* Size of hash table. */
111 nls_uint32 hash_size
;
112 /* Pointer to hash table. */
113 const nls_uint32
*hash_tab
;
114 /* 1 if the hash table uses a different endianness than this machine. */
115 int must_swap_hash_tab
;
127 struct expression
*plural
;
128 unsigned long int nplurals
;
131 /* We want to allocate a string at the end of the struct. But ISO C
132 doesn't allow zero sized arrays. */
139 /* A set of settings bound to a message domain. Used to store settings
140 from bindtextdomain() and bind_textdomain_codeset(). */
143 struct binding
*next
;
145 int codeset_cntr
; /* Incremented each time codeset changes. */
147 char domainname
[ZERO
];
150 /* A counter which is incremented each time some previous translations
152 This variable is part of the external ABI of the GNU libintl. */
153 extern int _nl_msg_cat_cntr
;
156 const char *_nl_locale_name (int category
, const char *categoryname
);
159 struct loaded_l10nfile
*_nl_find_domain (const char *__dirname
, char *__locale
,
160 const char *__domainname
,
161 struct binding
*__domainbinding
)
163 void _nl_load_domain (struct loaded_l10nfile
*__domain
,
164 struct binding
*__domainbinding
)
166 void _nl_unload_domain (struct loaded_domain
*__domain
)
168 const char *_nl_init_domain_conv (struct loaded_l10nfile
*__domain_file
,
169 struct loaded_domain
*__domain
,
170 struct binding
*__domainbinding
)
172 void _nl_free_domain_conv (struct loaded_domain
*__domain
)
175 char *_nl_find_msg (struct loaded_l10nfile
*domain_file
,
176 struct binding
*domainbinding
, const char *msgid
,
181 extern char *__gettext (const char *__msgid
);
182 extern char *__dgettext (const char *__domainname
, const char *__msgid
);
183 extern char *__dcgettext (const char *__domainname
, const char *__msgid
,
185 extern char *__ngettext (const char *__msgid1
, const char *__msgid2
,
186 unsigned long int __n
);
187 extern char *__dngettext (const char *__domainname
,
188 const char *__msgid1
, const char *__msgid2
,
189 unsigned long int n
);
190 extern char *__dcngettext (const char *__domainname
,
191 const char *__msgid1
, const char *__msgid2
,
192 unsigned long int __n
, int __category
);
193 extern char *__dcigettext (const char *__domainname
,
194 const char *__msgid1
, const char *__msgid2
,
195 int __plural
, unsigned long int __n
,
197 extern char *__textdomain (const char *__domainname
);
198 extern char *__bindtextdomain (const char *__domainname
,
199 const char *__dirname
);
200 extern char *__bind_textdomain_codeset (const char *__domainname
,
201 const char *__codeset
);
203 /* Declare the exported libintl_* functions, in a way that allows us to
204 call them under their real name. */
205 # undef _INTL_REDIRECT_INLINE
206 # undef _INTL_REDIRECT_MACROS
207 # define _INTL_REDIRECT_MACROS
208 # include "libgnuintl.h"
209 extern char *libintl_dcigettext (const char *__domainname
,
210 const char *__msgid1
, const char *__msgid2
,
211 int __plural
, unsigned long int __n
,
215 /* @@ begin of epilog @@ */
217 #endif /* gettextP.h */