| 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.
|
|---|
| 4 |
|
|---|
| 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.
|
|---|
| 9 |
|
|---|
| 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.
|
|---|
| 14 |
|
|---|
| 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. */
|
|---|
| 19 |
|
|---|
| 20 | #ifndef _GETTEXTP_H
|
|---|
| 21 | #define _GETTEXTP_H
|
|---|
| 22 |
|
|---|
| 23 | #include <stddef.h> /* Get size_t. */
|
|---|
| 24 |
|
|---|
| 25 | #ifdef _LIBC
|
|---|
| 26 | # include "../iconv/gconv_int.h"
|
|---|
| 27 | #else
|
|---|
| 28 | # if HAVE_ICONV
|
|---|
| 29 | # include <iconv.h>
|
|---|
| 30 | # endif
|
|---|
| 31 | #endif
|
|---|
| 32 |
|
|---|
| 33 | #include "loadinfo.h"
|
|---|
| 34 |
|
|---|
| 35 | #include "gmo.h" /* Get nls_uint32. */
|
|---|
| 36 |
|
|---|
| 37 | /* @@ end of prolog @@ */
|
|---|
| 38 |
|
|---|
| 39 | #ifndef PARAMS
|
|---|
| 40 | # if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
|
|---|
| 41 | # define PARAMS(args) args
|
|---|
| 42 | # else
|
|---|
| 43 | # define PARAMS(args) ()
|
|---|
| 44 | # endif
|
|---|
| 45 | #endif
|
|---|
| 46 |
|
|---|
| 47 | #ifndef internal_function
|
|---|
| 48 | # define internal_function
|
|---|
| 49 | #endif
|
|---|
| 50 |
|
|---|
| 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)
|
|---|
| 55 | #endif
|
|---|
| 56 |
|
|---|
| 57 | #ifndef W
|
|---|
| 58 | # define W(flag, data) ((flag) ? SWAP (data) : (data))
|
|---|
| 59 | #endif
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 | #ifdef _LIBC
|
|---|
| 63 | # include <byteswap.h>
|
|---|
| 64 | # define SWAP(i) bswap_32 (i)
|
|---|
| 65 | #else
|
|---|
| 66 | static inline nls_uint32
|
|---|
| 67 | SWAP (i)
|
|---|
| 68 | nls_uint32 i;
|
|---|
| 69 | {
|
|---|
| 70 | return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
|
|---|
| 71 | }
|
|---|
| 72 | #endif
|
|---|
| 73 |
|
|---|
| 74 |
|
|---|
| 75 | /* The representation of an opened message catalog. */
|
|---|
| 76 | struct loaded_domain
|
|---|
| 77 | {
|
|---|
| 78 | const char *data;
|
|---|
| 79 | int use_mmap;
|
|---|
| 80 | size_t mmap_size;
|
|---|
| 81 | int must_swap;
|
|---|
| 82 | nls_uint32 nstrings;
|
|---|
| 83 | struct string_desc *orig_tab;
|
|---|
| 84 | struct string_desc *trans_tab;
|
|---|
| 85 | nls_uint32 hash_size;
|
|---|
| 86 | nls_uint32 *hash_tab;
|
|---|
| 87 | int codeset_cntr;
|
|---|
| 88 | #ifdef _LIBC
|
|---|
| 89 | __gconv_t conv;
|
|---|
| 90 | #else
|
|---|
| 91 | # if HAVE_ICONV
|
|---|
| 92 | iconv_t conv;
|
|---|
| 93 | # endif
|
|---|
| 94 | #endif
|
|---|
| 95 | char **conv_tab;
|
|---|
| 96 |
|
|---|
| 97 | struct expression *plural;
|
|---|
| 98 | unsigned long int nplurals;
|
|---|
| 99 | };
|
|---|
| 100 |
|
|---|
| 101 | /* We want to allocate a string at the end of the struct. But ISO C
|
|---|
| 102 | doesn't allow zero sized arrays. */
|
|---|
| 103 | #ifdef __GNUC__
|
|---|
| 104 | # define ZERO 0
|
|---|
| 105 | #else
|
|---|
| 106 | # define ZERO 1
|
|---|
| 107 | #endif
|
|---|
| 108 |
|
|---|
| 109 | /* A set of settings bound to a message domain. Used to store settings
|
|---|
| 110 | from bindtextdomain() and bind_textdomain_codeset(). */
|
|---|
| 111 | struct binding
|
|---|
| 112 | {
|
|---|
| 113 | struct binding *next;
|
|---|
| 114 | char *dirname;
|
|---|
| 115 | int codeset_cntr; /* Incremented each time codeset changes. */
|
|---|
| 116 | char *codeset;
|
|---|
| 117 | char domainname[ZERO];
|
|---|
| 118 | };
|
|---|
| 119 |
|
|---|
| 120 | /* A counter which is incremented each time some previous translations
|
|---|
| 121 | become invalid.
|
|---|
| 122 | This variable is part of the external ABI of the GNU libintl. */
|
|---|
| 123 | extern int _nl_msg_cat_cntr;
|
|---|
| 124 |
|
|---|
| 125 | #ifndef _LIBC
|
|---|
| 126 | const char *_nl_locale_name PARAMS ((int category, const char *categoryname));
|
|---|
| 127 | #endif
|
|---|
| 128 |
|
|---|
| 129 | struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
|
|---|
| 130 | char *__locale,
|
|---|
| 131 | const char *__domainname,
|
|---|
| 132 | struct binding *__domainbinding))
|
|---|
| 133 | internal_function;
|
|---|
| 134 | void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain,
|
|---|
| 135 | struct binding *__domainbinding))
|
|---|
| 136 | internal_function;
|
|---|
| 137 | void _nl_unload_domain PARAMS ((struct loaded_domain *__domain))
|
|---|
| 138 | internal_function;
|
|---|
| 139 | const char *_nl_init_domain_conv PARAMS ((struct loaded_l10nfile *__domain_file,
|
|---|
| 140 | struct loaded_domain *__domain,
|
|---|
| 141 | struct binding *__domainbinding))
|
|---|
| 142 | internal_function;
|
|---|
| 143 | void _nl_free_domain_conv PARAMS ((struct loaded_domain *__domain))
|
|---|
| 144 | internal_function;
|
|---|
| 145 |
|
|---|
| 146 | char *_nl_find_msg PARAMS ((struct loaded_l10nfile *domain_file,
|
|---|
| 147 | struct binding *domainbinding,
|
|---|
| 148 | const char *msgid, size_t *lengthp))
|
|---|
| 149 | internal_function;
|
|---|
| 150 |
|
|---|
| 151 | #ifdef _LIBC
|
|---|
| 152 | extern char *__gettext PARAMS ((const char *__msgid));
|
|---|
| 153 | extern char *__dgettext PARAMS ((const char *__domainname,
|
|---|
| 154 | const char *__msgid));
|
|---|
| 155 | extern char *__dcgettext PARAMS ((const char *__domainname,
|
|---|
| 156 | const char *__msgid, int __category));
|
|---|
| 157 | extern char *__ngettext PARAMS ((const char *__msgid1, const char *__msgid2,
|
|---|
| 158 | unsigned long int __n));
|
|---|
| 159 | extern char *__dngettext PARAMS ((const char *__domainname,
|
|---|
| 160 | const char *__msgid1, const char *__msgid2,
|
|---|
| 161 | unsigned long int n));
|
|---|
| 162 | extern char *__dcngettext PARAMS ((const char *__domainname,
|
|---|
| 163 | const char *__msgid1, const char *__msgid2,
|
|---|
| 164 | unsigned long int __n, int __category));
|
|---|
| 165 | extern char *__dcigettext PARAMS ((const char *__domainname,
|
|---|
| 166 | const char *__msgid1, const char *__msgid2,
|
|---|
| 167 | int __plural, unsigned long int __n,
|
|---|
| 168 | int __category));
|
|---|
| 169 | extern char *__textdomain PARAMS ((const char *__domainname));
|
|---|
| 170 | extern char *__bindtextdomain PARAMS ((const char *__domainname,
|
|---|
| 171 | const char *__dirname));
|
|---|
| 172 | extern char *__bind_textdomain_codeset PARAMS ((const char *__domainname,
|
|---|
| 173 | const char *__codeset));
|
|---|
| 174 | #else
|
|---|
| 175 | extern char *gettext__ PARAMS ((const char *__msgid));
|
|---|
| 176 | extern char *dgettext__ PARAMS ((const char *__domainname,
|
|---|
| 177 | const char *__msgid));
|
|---|
| 178 | extern char *dcgettext__ PARAMS ((const char *__domainname,
|
|---|
| 179 | const char *__msgid, int __category));
|
|---|
| 180 | extern char *ngettext__ PARAMS ((const char *__msgid1, const char *__msgid2,
|
|---|
| 181 | unsigned long int __n));
|
|---|
| 182 | extern char *dngettext__ PARAMS ((const char *__domainname,
|
|---|
| 183 | const char *__msgid1, const char *__msgid2,
|
|---|
| 184 | unsigned long int __n));
|
|---|
| 185 | extern char *dcngettext__ PARAMS ((const char *__domainname,
|
|---|
| 186 | const char *__msgid1, const char *__msgid2,
|
|---|
| 187 | unsigned long int __n, int __category));
|
|---|
| 188 | extern char *dcigettext__ PARAMS ((const char *__domainname,
|
|---|
| 189 | const char *__msgid1, const char *__msgid2,
|
|---|
| 190 | int __plural, unsigned long int __n,
|
|---|
| 191 | int __category));
|
|---|
| 192 | extern char *textdomain__ PARAMS ((const char *__domainname));
|
|---|
| 193 | extern char *bindtextdomain__ PARAMS ((const char *__domainname,
|
|---|
| 194 | const char *__dirname));
|
|---|
| 195 | extern char *bind_textdomain_codeset__ PARAMS ((const char *__domainname,
|
|---|
| 196 | const char *__codeset));
|
|---|
| 197 | #endif
|
|---|
| 198 |
|
|---|
| 199 | /* @@ begin of epilog @@ */
|
|---|
| 200 |
|
|---|
| 201 | #endif /* gettextP.h */
|
|---|