Retry only for https protocol
[elinks.git] / src / intl / gettext / gettextP.h
blob088671dfd29d7a37d5fab1fcc618f7cb307e199e
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)
8 any later version.
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. */
19 #ifndef _GETTEXTP_H
20 #define _GETTEXTP_H
22 #include <stddef.h> /* Get size_t. */
24 #include "util/string.h" /* Get possible stubs. */
26 #ifdef HAVE_ICONV
27 #include <iconv.h>
28 #endif
30 #include "intl/gettext/loadinfo.h"
31 #include "intl/gettext/gettext.h" /* Get nls_uint32. */
33 #ifndef W
34 #define W(flag, data) ((flag) ? SWAP (data) : (data))
35 #endif
37 static inline nls_uint32
38 SWAP(nls_uint32 i)
40 return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >>
41 24);
44 enum operator_ {
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. */
54 plus, /* Addition. */
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
69 plural form. */
70 struct expression {
71 int nargs; /* Number of arguments. */
72 enum operator_ operation;
73 union {
74 unsigned long int num; /* Number value for `num'. */
75 struct expression *args[3]; /* Up to three arguments. */
76 } val;
79 /* This is the data structure to pass information to the parser and get
80 the result in a thread-safe way. */
81 struct parse_args {
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;
89 int use_mmap;
90 size_t mmap_size;
91 int must_swap;
92 nls_uint32 nstrings;
93 struct string_desc *orig_tab;
94 struct string_desc *trans_tab;
95 nls_uint32 hash_size;
96 nls_uint32 *hash_tab;
97 int codeset_cntr;
98 #if HAVE_ICONV
99 iconv_t conv;
100 #endif
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(). */
109 struct binding {
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
120 become invalid.
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,
127 struct binding *
128 __domainbinding);
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,
156 int __category);
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 */