* keyedit.c (menu_clean): Show "already minimized" rather than
[gnupg.git] / intl / gettextP.h
blob8be38d2d7fba1bbde9d8e33093ffb504aa57860f
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)
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 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
18 USA. */
20 #ifndef _GETTEXTP_H
21 #define _GETTEXTP_H
23 #include <stddef.h> /* Get size_t. */
25 #ifdef _LIBC
26 # include "../iconv/gconv_int.h"
27 #else
28 # if HAVE_ICONV
29 # include <iconv.h>
30 # endif
31 #endif
33 #ifdef _LIBC
34 extern char *__gettext (const char *__msgid);
35 extern char *__dgettext (const char *__domainname, const char *__msgid);
36 extern char *__dcgettext (const char *__domainname, const char *__msgid,
37 int __category);
38 extern char *__ngettext (const char *__msgid1, const char *__msgid2,
39 unsigned long int __n);
40 extern char *__dngettext (const char *__domainname,
41 const char *__msgid1, const char *__msgid2,
42 unsigned long int n);
43 extern char *__dcngettext (const char *__domainname,
44 const char *__msgid1, const char *__msgid2,
45 unsigned long int __n, int __category);
46 extern char *__dcigettext (const char *__domainname,
47 const char *__msgid1, const char *__msgid2,
48 int __plural, unsigned long int __n,
49 int __category);
50 extern char *__textdomain (const char *__domainname);
51 extern char *__bindtextdomain (const char *__domainname,
52 const char *__dirname);
53 extern char *__bind_textdomain_codeset (const char *__domainname,
54 const char *__codeset);
55 extern void _nl_finddomain_subfreeres (void) attribute_hidden;
56 extern void _nl_unload_domain (struct loaded_domain *__domain)
57 internal_function attribute_hidden;
58 #else
59 /* Declare the exported libintl_* functions, in a way that allows us to
60 call them under their real name. */
61 # undef _INTL_REDIRECT_INLINE
62 # undef _INTL_REDIRECT_MACROS
63 # define _INTL_REDIRECT_MACROS
64 # include "libgnuintl.h"
65 # ifdef IN_LIBGLOCALE
66 extern char *gl_dcigettext (const char *__domainname,
67 const char *__msgid1, const char *__msgid2,
68 int __plural, unsigned long int __n,
69 int __category,
70 const char *__localename, const char *__encoding);
71 # else
72 extern char *libintl_dcigettext (const char *__domainname,
73 const char *__msgid1, const char *__msgid2,
74 int __plural, unsigned long int __n,
75 int __category);
76 # endif
77 #endif
79 #include "loadinfo.h"
81 #include "gmo.h" /* Get nls_uint32. */
83 /* @@ end of prolog @@ */
85 #ifndef internal_function
86 # define internal_function
87 #endif
89 #ifndef attribute_hidden
90 # define attribute_hidden
91 #endif
93 /* Tell the compiler when a conditional or integer expression is
94 almost always true or almost always false. */
95 #ifndef HAVE_BUILTIN_EXPECT
96 # define __builtin_expect(expr, val) (expr)
97 #endif
99 #ifndef W
100 # define W(flag, data) ((flag) ? SWAP (data) : (data))
101 #endif
104 #ifdef _LIBC
105 # include <byteswap.h>
106 # define SWAP(i) bswap_32 (i)
107 #else
108 static inline nls_uint32
109 SWAP (i)
110 nls_uint32 i;
112 return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
114 #endif
117 /* In-memory representation of system dependent string. */
118 struct sysdep_string_desc
120 /* Length of addressed string, including the trailing NUL. */
121 size_t length;
122 /* Pointer to addressed string. */
123 const char *pointer;
126 /* Cache of translated strings after charset conversion.
127 Note: The strings are converted to the target encoding only on an as-needed
128 basis. */
129 struct converted_domain
131 /* The target encoding name. */
132 const char *encoding;
133 /* The descriptor for conversion from the message catalog's encoding to
134 this target encoding. */
135 #ifdef _LIBC
136 __gconv_t conv;
137 #else
138 # if HAVE_ICONV
139 iconv_t conv;
140 # endif
141 #endif
142 /* The table of translated strings after charset conversion. */
143 char **conv_tab;
146 /* The representation of an opened message catalog. */
147 struct loaded_domain
149 /* Pointer to memory containing the .mo file. */
150 const char *data;
151 /* 1 if the memory is mmap()ed, 0 if the memory is malloc()ed. */
152 int use_mmap;
153 /* Size of mmap()ed memory. */
154 size_t mmap_size;
155 /* 1 if the .mo file uses a different endianness than this machine. */
156 int must_swap;
157 /* Pointer to additional malloc()ed memory. */
158 void *malloced;
160 /* Number of static strings pairs. */
161 nls_uint32 nstrings;
162 /* Pointer to descriptors of original strings in the file. */
163 const struct string_desc *orig_tab;
164 /* Pointer to descriptors of translated strings in the file. */
165 const struct string_desc *trans_tab;
167 /* Number of system dependent strings pairs. */
168 nls_uint32 n_sysdep_strings;
169 /* Pointer to descriptors of original sysdep strings. */
170 const struct sysdep_string_desc *orig_sysdep_tab;
171 /* Pointer to descriptors of translated sysdep strings. */
172 const struct sysdep_string_desc *trans_sysdep_tab;
174 /* Size of hash table. */
175 nls_uint32 hash_size;
176 /* Pointer to hash table. */
177 const nls_uint32 *hash_tab;
178 /* 1 if the hash table uses a different endianness than this machine. */
179 int must_swap_hash_tab;
181 /* Cache of charset conversions of the translated strings. */
182 struct converted_domain *conversions;
183 size_t nconversions;
185 struct expression *plural;
186 unsigned long int nplurals;
189 /* We want to allocate a string at the end of the struct. But ISO C
190 doesn't allow zero sized arrays. */
191 #ifdef __GNUC__
192 # define ZERO 0
193 #else
194 # define ZERO 1
195 #endif
197 /* A set of settings bound to a message domain. Used to store settings
198 from bindtextdomain() and bind_textdomain_codeset(). */
199 struct binding
201 struct binding *next;
202 char *dirname;
203 char *codeset;
204 char domainname[ZERO];
207 /* A counter which is incremented each time some previous translations
208 become invalid.
209 This variable is part of the external ABI of the GNU libintl. */
210 #ifdef IN_LIBGLOCALE
211 # include <glocale/config.h>
212 extern LIBGLOCALE_DLL_EXPORTED int _nl_msg_cat_cntr;
213 #else
214 extern LIBINTL_DLL_EXPORTED int _nl_msg_cat_cntr;
215 #endif
217 #ifndef _LIBC
218 const char *_nl_language_preferences_default (void);
219 const char *_nl_locale_name_posix (int category, const char *categoryname);
220 const char *_nl_locale_name_default (void);
221 const char *_nl_locale_name (int category, const char *categoryname);
222 #endif
224 struct loaded_l10nfile *_nl_find_domain (const char *__dirname, char *__locale,
225 const char *__domainname,
226 struct binding *__domainbinding)
227 internal_function;
228 void _nl_load_domain (struct loaded_l10nfile *__domain,
229 struct binding *__domainbinding)
230 internal_function;
232 #ifdef IN_LIBGLOCALE
233 char *_nl_find_msg (struct loaded_l10nfile *domain_file,
234 struct binding *domainbinding, const char *encoding,
235 const char *msgid,
236 size_t *lengthp)
237 internal_function;
238 #else
239 char *_nl_find_msg (struct loaded_l10nfile *domain_file,
240 struct binding *domainbinding, const char *msgid,
241 int convert, size_t *lengthp)
242 internal_function;
243 #endif
245 /* @@ begin of epilog @@ */
247 #endif /* gettextP.h */