1 /* Header describing internals of libintl library.
2 Copyright (C) 1995-1999, 2000, 2001 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 "gettext.h" /* Get nls_uint32. */
37 /* @@ end of prolog @@ */
41 # define PARAMS(args) args
43 # define PARAMS(args) ()
47 #ifndef internal_function
48 # define internal_function
51 /* Tell the compiler when a conditional or integer expression is
52 almost always true or almost always false. */
53 #ifndef HAVE_BUILTIN_EXPECT
54 # define __builtin_expect(expr, val) (expr)
58 # define W(flag, data) ((flag) ? SWAP (data) : (data))
63 # include <byteswap.h>
64 # define SWAP(i) bswap_32 (i)
66 /* GCC LOCAL: Prototype first to avoid warnings. */
67 static inline nls_uint32 SWAP PARAMS ((nls_uint32));
68 static inline nls_uint32
72 return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
77 /* This is the representation of the expressions to determine the
81 int nargs; /* Number of arguments. */
84 /* Without arguments: */
85 var, /* The variable "n". */
86 num, /* Decimal number. */
87 /* Unary operators: */
88 lnot, /* Logical NOT. */
89 /* Binary operators: */
90 mult, /* Multiplication. */
91 divide, /* Division. */
92 module, /* Module operation. */
94 minus, /* Subtraction. */
95 less_than, /* Comparison. */
96 greater_than, /* Comparison. */
97 less_or_equal, /* Comparison. */
98 greater_or_equal, /* Comparison. */
99 equal, /* Comparision for equality. */
100 not_equal, /* Comparision for inequality. */
101 land, /* Logical AND. */
102 lor, /* Logical OR. */
103 /* Ternary operators: */
104 qmop /* Question mark operator. */
108 unsigned long int num; /* Number value for `num'. */
109 struct expression *args[3]; /* Up to three arguments. */
113 /* This is the data structure to pass information to the parser and get
114 the result in a thread-safe way. */
118 struct expression *res;
122 /* The representation of an opened message catalog. */
130 struct string_desc *orig_tab;
131 struct string_desc *trans_tab;
132 nls_uint32 hash_size;
133 nls_uint32 *hash_tab;
144 struct expression *plural;
145 unsigned long int nplurals;
148 /* We want to allocate a string at the end of the struct. But ISO C
149 doesn't allow zero sized arrays.
150 GCC LOCAL: Always use 1, to avoid warnings. */
157 /* A set of settings bound to a message domain. Used to store settings
158 from bindtextdomain() and bind_textdomain_codeset(). */
161 struct binding *next;
163 int codeset_cntr; /* Incremented each time codeset changes. */
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;
173 struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
175 const char *__domainname,
176 struct binding *__domainbinding))
178 void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain,
179 struct binding *__domainbinding))
181 void _nl_unload_domain PARAMS ((struct loaded_domain *__domain))
183 const char *_nl_init_domain_conv PARAMS ((struct loaded_l10nfile *__domain_file,
184 struct loaded_domain *__domain,
185 struct binding *__domainbinding))
187 void _nl_free_domain_conv PARAMS ((struct loaded_domain *__domain))
190 char *_nl_find_msg PARAMS ((struct loaded_l10nfile *domain_file,
191 struct binding *domainbinding,
192 const char *msgid, size_t *lengthp))
195 /* GCC LOCAL: This prototype moved here from next to its
196 use in loadmsgcat.c. */
197 extern const char *locale_charset PARAMS ((void)) internal_function;
200 extern char *__gettext PARAMS ((const char *__msgid));
201 extern char *__dgettext PARAMS ((const char *__domainname,
202 const char *__msgid));
203 extern char *__dcgettext PARAMS ((const char *__domainname,
204 const char *__msgid, int __category));
205 extern char *__ngettext PARAMS ((const char *__msgid1, const char *__msgid2,
206 unsigned long int __n));
207 extern char *__dngettext PARAMS ((const char *__domainname,
208 const char *__msgid1, const char *__msgid2,
209 unsigned long int n));
210 extern char *__dcngettext PARAMS ((const char *__domainname,
211 const char *__msgid1, const char *__msgid2,
212 unsigned long int __n, int __category));
213 extern char *__dcigettext PARAMS ((const char *__domainname,
214 const char *__msgid1, const char *__msgid2,
215 int __plural, unsigned long int __n,
217 extern char *__textdomain PARAMS ((const char *__domainname));
218 extern char *__bindtextdomain PARAMS ((const char *__domainname,
219 const char *__dirname));
220 extern char *__bind_textdomain_codeset PARAMS ((const char *__domainname,
221 const char *__codeset));
223 extern char *gettext__ PARAMS ((const char *__msgid));
224 extern char *dgettext__ PARAMS ((const char *__domainname,
225 const char *__msgid));
226 extern char *dcgettext__ PARAMS ((const char *__domainname,
227 const char *__msgid, int __category));
228 extern char *ngettext__ PARAMS ((const char *__msgid1, const char *__msgid2,
229 unsigned long int __n));
230 extern char *dngettext__ PARAMS ((const char *__domainname,
231 const char *__msgid1, const char *__msgid2,
232 unsigned long int __n));
233 extern char *dcngettext__ PARAMS ((const char *__domainname,
234 const char *__msgid1, const char *__msgid2,
235 unsigned long int __n, int __category));
236 extern char *dcigettext__ PARAMS ((const char *__domainname,
237 const char *__msgid1, const char *__msgid2,
238 int __plural, unsigned long int __n,
240 extern char *textdomain__ PARAMS ((const char *__domainname));
241 extern char *bindtextdomain__ PARAMS ((const char *__domainname,
242 const char *__dirname));
243 extern char *bind_textdomain_codeset__ PARAMS ((const char *__domainname,
244 const char *__codeset));
248 extern void __gettext_free_exp PARAMS ((struct expression *exp))
250 extern int __gettextparse PARAMS ((void *arg));
252 extern void gettext_free_exp__ PARAMS ((struct expression *exp))
254 extern int gettextparse__ PARAMS ((void *arg));
257 /* @@ begin of epilog @@ */
259 #endif /* gettextP.h */