1 /* Header describing internals of libintl library.
2 Copyright (C) 1995-1999, 2000-2005 Free Software Foundation, Inc.
3 Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU Library General Public License as published
7 by the Free Software Foundation; either version 2, or (at your option)
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
23 #include <stddef.h> /* Get size_t. */
26 # include "../iconv/gconv_int.h"
35 #include "gmo.h" /* Get nls_uint32. */
37 /* @@ end of prolog @@ */
39 #ifndef internal_function
40 # define internal_function
43 #ifndef attribute_hidden
44 # define attribute_hidden
47 /* Tell the compiler when a conditional or integer expression is
48 almost always true or almost always false. */
49 #ifndef HAVE_BUILTIN_EXPECT
50 # define __builtin_expect(expr, val) (expr)
54 # define W(flag, data) ((flag) ? SWAP (data) : (data))
59 # include <byteswap.h>
60 # define SWAP(i) bswap_32 (i)
62 static inline nls_uint32
66 return (i
<< 24) | ((i
& 0xff00) << 8) | ((i
>> 8) & 0xff00) | (i
>> 24);
71 /* In-memory representation of system dependent string. */
72 struct sysdep_string_desc
74 /* Length of addressed string, including the trailing NUL. */
76 /* Pointer to addressed string. */
80 /* The representation of an opened message catalog. */
83 /* Pointer to memory containing the .mo file. */
85 /* 1 if the memory is mmap()ed, 0 if the memory is malloc()ed. */
87 /* Size of mmap()ed memory. */
89 /* 1 if the .mo file uses a different endianness than this machine. */
91 /* Pointer to additional malloc()ed memory. */
94 /* Number of static strings pairs. */
96 /* Pointer to descriptors of original strings in the file. */
97 const struct string_desc
*orig_tab
;
98 /* Pointer to descriptors of translated strings in the file. */
99 const struct string_desc
*trans_tab
;
101 /* Number of system dependent strings pairs. */
102 nls_uint32 n_sysdep_strings
;
103 /* Pointer to descriptors of original sysdep strings. */
104 const struct sysdep_string_desc
*orig_sysdep_tab
;
105 /* Pointer to descriptors of translated sysdep strings. */
106 const struct sysdep_string_desc
*trans_sysdep_tab
;
108 /* Size of hash table. */
109 nls_uint32 hash_size
;
110 /* Pointer to hash table. */
111 const nls_uint32
*hash_tab
;
112 /* 1 if the hash table uses a different endianness than this machine. */
113 int must_swap_hash_tab
;
125 struct expression
*plural
;
126 unsigned long int nplurals
;
129 /* We want to allocate a string at the end of the struct. But ISO C
130 doesn't allow zero sized arrays. */
137 /* A set of settings bound to a message domain. Used to store settings
138 from bindtextdomain() and bind_textdomain_codeset(). */
141 struct binding
*next
;
143 int codeset_cntr
; /* Incremented each time codeset changes. */
145 char domainname
[ZERO
];
148 /* A counter which is incremented each time some previous translations
150 This variable is part of the external ABI of the GNU libintl. */
151 extern int _nl_msg_cat_cntr
;
154 const char *_nl_language_preferences_default (void);
155 const char *_nl_locale_name_posix (int category
, const char *categoryname
);
156 const char *_nl_locale_name_default (void);
157 const char *_nl_locale_name (int category
, const char *categoryname
);
160 struct loaded_l10nfile
*_nl_find_domain (const char *__dirname
, char *__locale
,
161 const char *__domainname
,
162 struct binding
*__domainbinding
)
164 void _nl_load_domain (struct loaded_l10nfile
*__domain
,
165 struct binding
*__domainbinding
)
167 void _nl_unload_domain (struct loaded_domain
*__domain
)
169 const char *_nl_init_domain_conv (struct loaded_l10nfile
*__domain_file
,
170 struct loaded_domain
*__domain
,
171 struct binding
*__domainbinding
)
173 void _nl_free_domain_conv (struct loaded_domain
*__domain
)
176 char *_nl_find_msg (struct loaded_l10nfile
*domain_file
,
177 struct binding
*domainbinding
, const char *msgid
,
182 extern char *__gettext (const char *__msgid
);
183 extern char *__dgettext (const char *__domainname
, const char *__msgid
);
184 extern char *__dcgettext (const char *__domainname
, const char *__msgid
,
186 extern char *__ngettext (const char *__msgid1
, const char *__msgid2
,
187 unsigned long int __n
);
188 extern char *__dngettext (const char *__domainname
,
189 const char *__msgid1
, const char *__msgid2
,
190 unsigned long int n
);
191 extern char *__dcngettext (const char *__domainname
,
192 const char *__msgid1
, const char *__msgid2
,
193 unsigned long int __n
, int __category
);
194 extern char *__dcigettext (const char *__domainname
,
195 const char *__msgid1
, const char *__msgid2
,
196 int __plural
, unsigned long int __n
,
198 extern char *__textdomain (const char *__domainname
);
199 extern char *__bindtextdomain (const char *__domainname
,
200 const char *__dirname
);
201 extern char *__bind_textdomain_codeset (const char *__domainname
,
202 const char *__codeset
);
204 /* Declare the exported libintl_* functions, in a way that allows us to
205 call them under their real name. */
206 # undef _INTL_REDIRECT_INLINE
207 # undef _INTL_REDIRECT_MACROS
208 # define _INTL_REDIRECT_MACROS
209 # include "libgnuintl.h"
210 extern char *libintl_dcigettext (const char *__domainname
,
211 const char *__msgid1
, const char *__msgid2
,
212 int __plural
, unsigned long int __n
,
216 /* @@ begin of epilog @@ */
218 #endif /* gettextP.h */