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
6 it under the terms of the GNU General Public License as published by
7 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
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
22 #include <stddef.h> /* Get size_t. */
24 #include "util/string.h" /* Get possible stubs. */
30 #include "intl/gettext/loadinfo.h"
31 #include "intl/gettext/gettext.h" /* Get nls_uint32. */
34 #define W(flag, data) ((flag) ? SWAP (data) : (data))
37 static inline nls_uint32
40 return (i
<< 24) | ((i
& 0xff00) << 8) | ((i
>> 8) & 0xff00) | (i
>>
45 /* Without arguments: */
46 var
, /* The variable "n". */
47 num
, /* Decimal number. */
48 /* Unary operators: */
49 lnot
, /* Logical NOT. */
50 /* Binary operators: */
51 mult
, /* Multiplication. */
52 divide
, /* Division. */
53 module
, /* Module operation. */
55 minus
, /* Subtraction. */
56 less_than
, /* Comparison. */
57 greater_than
, /* Comparison. */
58 less_or_equal
, /* Comparison. */
59 greater_or_equal
, /* Comparison. */
60 equal
, /* Comparision for equality. */
61 not_equal
, /* Comparision for inequality. */
62 land
, /* Logical AND. */
63 lor
, /* Logical OR. */
64 /* Ternary operators: */
65 qmop
/* Question mark operator. */
68 /* This is the representation of the expressions to determine the
71 int nargs
; /* Number of arguments. */
72 enum operator_ operation
;
74 unsigned long int num
; /* Number value for `num'. */
75 struct expression
*args
[3]; /* Up to three arguments. */
79 /* This is the data structure to pass information to the parser and get
80 the result in a thread-safe way. */
82 const unsigned char *cp
;
83 struct expression
*res
;
86 /* The representation of an opened message catalog. */
87 struct loaded_domain
{
88 const unsigned char *data
;
93 struct string_desc
*orig_tab
;
94 struct string_desc
*trans_tab
;
101 unsigned char **conv_tab
;
103 struct expression
*plural
;
104 unsigned long int nplurals
;
107 /* A set of settings bound to a message domain. Used to store settings
108 from bindtextdomain() and bind_textdomain_codeset(). */
110 struct binding
*next
;
111 unsigned char *dirname
;
112 int codeset_cntr
; /* Incremented each time codeset changes. */
113 unsigned char *codeset
;
114 unsigned char domainname
[1];
117 extern unsigned char *LANGUAGE
;
119 /* A counter which is incremented each time some previous translations
121 This variable is part of the external ABI of the GNU libintl. */
122 extern int _nl_msg_cat_cntr
;
124 struct loaded_l10nfile
*_nl_find_domain(const unsigned char *__dirname
,
125 unsigned char *__locale
,
126 const unsigned char *__domainname
,
129 void _nl_load_domain(struct loaded_l10nfile
* __domain
,
130 struct binding
* __domainbinding
);
131 void _nl_unload_domain(struct loaded_domain
* __domain
);
132 const unsigned char *_nl_init_domain_conv(struct loaded_l10nfile
* __domain_file
,
133 struct loaded_domain
* __domain
,
134 struct binding
* __domainbinding
);
135 void _nl_free_domain_conv(struct loaded_domain
* __domain
);
137 unsigned char *_nl_find_msg(struct loaded_l10nfile
* domain_file
,
138 struct binding
* domainbinding
,
139 const unsigned char *msgid
, size_t * lengthp
);
141 extern unsigned char *gettext__(const unsigned char *__msgid
);
142 extern unsigned char *dgettext__(const unsigned char *__domainname
, const unsigned char *__msgid
);
143 extern unsigned char *dcgettext__(const unsigned char *__domainname
,
144 const unsigned char *__msgid
, int __category
);
145 extern unsigned char *ngettext__(const unsigned char *__msgid1
, const unsigned char *__msgid2
,
146 unsigned long int __n
);
147 extern unsigned char *dngettext__(const unsigned char *__domainname
,
148 const unsigned char *__msgid1
, const unsigned char *__msgid2
,
149 unsigned long int __n
);
150 extern unsigned char *dcngettext__(const unsigned char *__domainname
,
151 const unsigned char *__msgid1
, const unsigned char *__msgid2
,
152 unsigned long int __n
, int __category
);
153 extern unsigned char *dcigettext__(const unsigned char *__domainname
,
154 const unsigned char *__msgid1
, const unsigned char *__msgid2
,
155 int __plural
, unsigned long int __n
,
157 extern unsigned char *textdomain__(const unsigned char *__domainname
);
158 extern unsigned char *bindtextdomain__(const unsigned char *__domainname
,
159 const unsigned char *__dirname
);
160 extern unsigned char *bind_textdomain_codeset__(const unsigned char *__domainname
,
161 const unsigned char *__codeset
);
163 extern void gettext_free_exp__(struct expression
* exp
);
164 extern int gettext__parse(struct parse_args
*arg
);
166 #endif /* gettextP.h */