Sync usage with man page.
[netbsd-mini2440.git] / gnu / dist / texinfo / intl / gettextP.h
blob37e62d3e9b0a62c285e420a7692c7c09def93a71
1 /* $NetBSD$ */
3 /* Header describing internals of libintl library.
4 Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc.
5 Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
7 This program is free software; you can redistribute it and/or modify it
8 under the terms of the GNU Library General Public License as published
9 by the Free Software Foundation; either version 2, or (at your option)
10 any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public
18 License along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20 USA. */
22 #ifndef _GETTEXTP_H
23 #define _GETTEXTP_H
25 #include <stddef.h> /* Get size_t. */
27 #ifdef _LIBC
28 # include "../iconv/gconv_int.h"
29 #else
30 # if HAVE_ICONV
31 # include <iconv.h>
32 # endif
33 #endif
35 #include "loadinfo.h"
37 #include "gmo.h" /* Get nls_uint32. */
39 /* @@ end of prolog @@ */
41 #ifndef internal_function
42 # define internal_function
43 #endif
45 #ifndef attribute_hidden
46 # define attribute_hidden
47 #endif
49 /* Tell the compiler when a conditional or integer expression is
50 almost always true or almost always false. */
51 #ifndef HAVE_BUILTIN_EXPECT
52 # define __builtin_expect(expr, val) (expr)
53 #endif
55 #ifndef W
56 # define W(flag, data) ((flag) ? SWAP (data) : (data))
57 #endif
60 #ifdef _LIBC
61 # include <byteswap.h>
62 # define SWAP(i) bswap_32 (i)
63 #else
64 static inline nls_uint32
65 SWAP (i)
66 nls_uint32 i;
68 return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
70 #endif
73 /* In-memory representation of system dependent string. */
74 struct sysdep_string_desc
76 /* Length of addressed string, including the trailing NUL. */
77 size_t length;
78 /* Pointer to addressed string. */
79 const char *pointer;
82 /* The representation of an opened message catalog. */
83 struct loaded_domain
85 /* Pointer to memory containing the .mo file. */
86 const char *data;
87 /* 1 if the memory is mmap()ed, 0 if the memory is malloc()ed. */
88 int use_mmap;
89 /* Size of mmap()ed memory. */
90 size_t mmap_size;
91 /* 1 if the .mo file uses a different endianness than this machine. */
92 int must_swap;
93 /* Pointer to additional malloc()ed memory. */
94 void *malloced;
96 /* Number of static strings pairs. */
97 nls_uint32 nstrings;
98 /* Pointer to descriptors of original strings in the file. */
99 const struct string_desc *orig_tab;
100 /* Pointer to descriptors of translated strings in the file. */
101 const struct string_desc *trans_tab;
103 /* Number of system dependent strings pairs. */
104 nls_uint32 n_sysdep_strings;
105 /* Pointer to descriptors of original sysdep strings. */
106 const struct sysdep_string_desc *orig_sysdep_tab;
107 /* Pointer to descriptors of translated sysdep strings. */
108 const struct sysdep_string_desc *trans_sysdep_tab;
110 /* Size of hash table. */
111 nls_uint32 hash_size;
112 /* Pointer to hash table. */
113 const nls_uint32 *hash_tab;
114 /* 1 if the hash table uses a different endianness than this machine. */
115 int must_swap_hash_tab;
117 int codeset_cntr;
118 #ifdef _LIBC
119 __gconv_t conv;
120 #else
121 # if HAVE_ICONV
122 iconv_t conv;
123 # endif
124 #endif
125 char **conv_tab;
127 struct expression *plural;
128 unsigned long int nplurals;
131 /* We want to allocate a string at the end of the struct. But ISO C
132 doesn't allow zero sized arrays. */
133 #ifdef __GNUC__
134 # define ZERO 0
135 #else
136 # define ZERO 1
137 #endif
139 /* A set of settings bound to a message domain. Used to store settings
140 from bindtextdomain() and bind_textdomain_codeset(). */
141 struct binding
143 struct binding *next;
144 char *dirname;
145 int codeset_cntr; /* Incremented each time codeset changes. */
146 char *codeset;
147 char domainname[ZERO];
150 /* A counter which is incremented each time some previous translations
151 become invalid.
152 This variable is part of the external ABI of the GNU libintl. */
153 extern int _nl_msg_cat_cntr;
155 #ifndef _LIBC
156 const char *_nl_locale_name (int category, const char *categoryname);
157 #endif
159 struct loaded_l10nfile *_nl_find_domain (const char *__dirname, char *__locale,
160 const char *__domainname,
161 struct binding *__domainbinding)
162 internal_function;
163 void _nl_load_domain (struct loaded_l10nfile *__domain,
164 struct binding *__domainbinding)
165 internal_function;
166 void _nl_unload_domain (struct loaded_domain *__domain)
167 internal_function;
168 const char *_nl_init_domain_conv (struct loaded_l10nfile *__domain_file,
169 struct loaded_domain *__domain,
170 struct binding *__domainbinding)
171 internal_function;
172 void _nl_free_domain_conv (struct loaded_domain *__domain)
173 internal_function;
175 char *_nl_find_msg (struct loaded_l10nfile *domain_file,
176 struct binding *domainbinding, const char *msgid,
177 size_t *lengthp)
178 internal_function;
180 #ifdef _LIBC
181 extern char *__gettext (const char *__msgid);
182 extern char *__dgettext (const char *__domainname, const char *__msgid);
183 extern char *__dcgettext (const char *__domainname, const char *__msgid,
184 int __category);
185 extern char *__ngettext (const char *__msgid1, const char *__msgid2,
186 unsigned long int __n);
187 extern char *__dngettext (const char *__domainname,
188 const char *__msgid1, const char *__msgid2,
189 unsigned long int n);
190 extern char *__dcngettext (const char *__domainname,
191 const char *__msgid1, const char *__msgid2,
192 unsigned long int __n, int __category);
193 extern char *__dcigettext (const char *__domainname,
194 const char *__msgid1, const char *__msgid2,
195 int __plural, unsigned long int __n,
196 int __category);
197 extern char *__textdomain (const char *__domainname);
198 extern char *__bindtextdomain (const char *__domainname,
199 const char *__dirname);
200 extern char *__bind_textdomain_codeset (const char *__domainname,
201 const char *__codeset);
202 #else
203 /* Declare the exported libintl_* functions, in a way that allows us to
204 call them under their real name. */
205 # undef _INTL_REDIRECT_INLINE
206 # undef _INTL_REDIRECT_MACROS
207 # define _INTL_REDIRECT_MACROS
208 # include "libgnuintl.h"
209 extern char *libintl_dcigettext (const char *__domainname,
210 const char *__msgid1, const char *__msgid2,
211 int __plural, unsigned long int __n,
212 int __category);
213 #endif
215 /* @@ begin of epilog @@ */
217 #endif /* gettextP.h */