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; change argument to
67 unsigned int to avoid K&R type promotion errors with 64-bit "int". */
68 static inline nls_uint32 SWAP
PARAMS ((unsigned int));
69 static inline nls_uint32
74 return (i
<< 24) | ((i
& 0xff00) << 8) | ((i
>> 8) & 0xff00) | (i
>> 24);
79 /* This is the representation of the expressions to determine the
83 int nargs
; /* Number of arguments. */
86 /* Without arguments: */
87 var
, /* The variable "n". */
88 num
, /* Decimal number. */
89 /* Unary operators: */
90 lnot
, /* Logical NOT. */
91 /* Binary operators: */
92 mult
, /* Multiplication. */
93 divide
, /* Division. */
94 module
, /* Module operation. */
96 minus
, /* Subtraction. */
97 less_than
, /* Comparison. */
98 greater_than
, /* Comparison. */
99 less_or_equal
, /* Comparison. */
100 greater_or_equal
, /* Comparison. */
101 equal
, /* Comparision for equality. */
102 not_equal
, /* Comparision for inequality. */
103 land
, /* Logical AND. */
104 lor
, /* Logical OR. */
105 /* Ternary operators: */
106 qmop
/* Question mark operator. */
110 unsigned long int num
; /* Number value for `num'. */
111 struct expression
*args
[3]; /* Up to three arguments. */
115 /* This is the data structure to pass information to the parser and get
116 the result in a thread-safe way. */
120 struct expression
*res
;
124 /* The representation of an opened message catalog. */
132 struct string_desc
*orig_tab
;
133 struct string_desc
*trans_tab
;
134 nls_uint32 hash_size
;
135 nls_uint32
*hash_tab
;
146 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.
152 GCC LOCAL: Always use 1, to avoid warnings. */
159 /* A set of settings bound to a message domain. Used to store settings
160 from bindtextdomain() and bind_textdomain_codeset(). */
163 struct binding
*next
;
165 int codeset_cntr
; /* Incremented each time codeset changes. */
167 char domainname
[ZERO
];
170 /* A counter which is incremented each time some previous translations
172 This variable is part of the external ABI of the GNU libintl. */
173 extern int _nl_msg_cat_cntr
;
175 struct loaded_l10nfile
*_nl_find_domain
PARAMS ((const char *__dirname
,
177 const char *__domainname
,
178 struct binding
*__domainbinding
))
180 void _nl_load_domain
PARAMS ((struct loaded_l10nfile
*__domain
,
181 struct binding
*__domainbinding
))
183 void _nl_unload_domain
PARAMS ((struct loaded_domain
*__domain
))
185 const char *_nl_init_domain_conv
PARAMS ((struct loaded_l10nfile
*__domain_file
,
186 struct loaded_domain
*__domain
,
187 struct binding
*__domainbinding
))
189 void _nl_free_domain_conv
PARAMS ((struct loaded_domain
*__domain
))
192 char *_nl_find_msg
PARAMS ((struct loaded_l10nfile
*domain_file
,
193 struct binding
*domainbinding
,
194 const char *msgid
, size_t *lengthp
))
197 /* GCC LOCAL: This prototype moved here from next to its
198 use in loadmsgcat.c. */
199 extern const char *locale_charset
PARAMS ((void)) internal_function
;
202 extern char *__gettext
PARAMS ((const char *__msgid
));
203 extern char *__dgettext
PARAMS ((const char *__domainname
,
204 const char *__msgid
));
205 extern char *__dcgettext
PARAMS ((const char *__domainname
,
206 const char *__msgid
, int __category
));
207 extern char *__ngettext
PARAMS ((const char *__msgid1
, const char *__msgid2
,
208 unsigned long int __n
));
209 extern char *__dngettext
PARAMS ((const char *__domainname
,
210 const char *__msgid1
, const char *__msgid2
,
211 unsigned long int n
));
212 extern char *__dcngettext
PARAMS ((const char *__domainname
,
213 const char *__msgid1
, const char *__msgid2
,
214 unsigned long int __n
, int __category
));
215 extern char *__dcigettext
PARAMS ((const char *__domainname
,
216 const char *__msgid1
, const char *__msgid2
,
217 int __plural
, unsigned long int __n
,
219 extern char *__textdomain
PARAMS ((const char *__domainname
));
220 extern char *__bindtextdomain
PARAMS ((const char *__domainname
,
221 const char *__dirname
));
222 extern char *__bind_textdomain_codeset
PARAMS ((const char *__domainname
,
223 const char *__codeset
));
225 extern char *gettext__
PARAMS ((const char *__msgid
));
226 extern char *dgettext__
PARAMS ((const char *__domainname
,
227 const char *__msgid
));
228 extern char *dcgettext__
PARAMS ((const char *__domainname
,
229 const char *__msgid
, int __category
));
230 extern char *ngettext__
PARAMS ((const char *__msgid1
, const char *__msgid2
,
231 unsigned long int __n
));
232 extern char *dngettext__
PARAMS ((const char *__domainname
,
233 const char *__msgid1
, const char *__msgid2
,
234 unsigned long int __n
));
235 extern char *dcngettext__
PARAMS ((const char *__domainname
,
236 const char *__msgid1
, const char *__msgid2
,
237 unsigned long int __n
, int __category
));
238 extern char *dcigettext__
PARAMS ((const char *__domainname
,
239 const char *__msgid1
, const char *__msgid2
,
240 int __plural
, unsigned long int __n
,
242 extern char *textdomain__
PARAMS ((const char *__domainname
));
243 extern char *bindtextdomain__
PARAMS ((const char *__domainname
,
244 const char *__dirname
));
245 extern char *bind_textdomain_codeset__
PARAMS ((const char *__domainname
,
246 const char *__codeset
));
250 extern void __gettext_free_exp
PARAMS ((struct expression
*exp
))
252 extern int __gettextparse
PARAMS ((void *arg
));
254 extern void gettext_free_exp__
PARAMS ((struct expression
*exp
))
256 extern int gettextparse__
PARAMS ((void *arg
));
259 /* @@ begin of epilog @@ */
261 #endif /* gettextP.h */