Navit SVN

/work/compile/navit/src/intl/gettextP.h

00001 /* Header describing internals of libintl library.
00002    Copyright (C) 1995-1999, 2000-2003 Free Software Foundation, Inc.
00003    Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
00004 
00005    This program is free software; you can redistribute it and/or modify it
00006    under the terms of the GNU Library General Public License as published
00007    by the Free Software Foundation; either version 2, or (at your option)
00008    any later version.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public
00016    License along with this program; if not, write to the Free Software
00017    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
00018    USA.  */
00019 
00020 #ifndef _GETTEXTP_H
00021 #define _GETTEXTP_H
00022 
00023 #include <stddef.h>             /* Get size_t.  */
00024 
00025 #ifdef _LIBC
00026 # include "../iconv/gconv_int.h"
00027 #else
00028 # if HAVE_ICONV
00029 #  include <iconv.h>
00030 # endif
00031 #endif
00032 
00033 #include "loadinfo.h"
00034 
00035 #include "gmo.h"                /* Get nls_uint32.  */
00036 
00037 /* @@ end of prolog @@ */
00038 
00039 #ifndef internal_function
00040 # define internal_function
00041 #endif
00042 
00043 #ifndef attribute_hidden
00044 # define attribute_hidden
00045 #endif
00046 
00047 /* Tell the compiler when a conditional or integer expression is
00048    almost always true or almost always false.  */
00049 #ifndef HAVE_BUILTIN_EXPECT
00050 # define __builtin_expect(expr, val) (expr)
00051 #endif
00052 
00053 #ifndef W
00054 # define W(flag, data) ((flag) ? SWAP (data) : (data))
00055 #endif
00056 
00057 
00058 #ifdef _LIBC
00059 # include <byteswap.h>
00060 # define SWAP(i) bswap_32 (i)
00061 #else
00062 static inline nls_uint32
00063 SWAP (i)
00064      nls_uint32 i;
00065 {
00066   return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
00067 }
00068 #endif
00069 
00070 
00071 /* In-memory representation of system dependent string.  */
00072 struct sysdep_string_desc
00073 {
00074   /* Length of addressed string, including the trailing NUL.  */
00075   size_t length;
00076   /* Pointer to addressed string.  */
00077   const char *pointer;
00078 };
00079 
00080 /* The representation of an opened message catalog.  */
00081 struct loaded_domain
00082 {
00083   /* Pointer to memory containing the .mo file.  */
00084   const char *data;
00085   /* 1 if the memory is mmap()ed, 0 if the memory is malloc()ed.  */
00086   int use_mmap;
00087   /* Size of mmap()ed memory.  */
00088   size_t mmap_size;
00089   /* 1 if the .mo file uses a different endianness than this machine.  */
00090   int must_swap;
00091   /* Pointer to additional malloc()ed memory.  */
00092   void *malloced;
00093 
00094   /* Number of static strings pairs.  */
00095   nls_uint32 nstrings;
00096   /* Pointer to descriptors of original strings in the file.  */
00097   const struct string_desc *orig_tab;
00098   /* Pointer to descriptors of translated strings in the file.  */
00099   const struct string_desc *trans_tab;
00100 
00101   /* Number of system dependent strings pairs.  */
00102   nls_uint32 n_sysdep_strings;
00103   /* Pointer to descriptors of original sysdep strings.  */
00104   const struct sysdep_string_desc *orig_sysdep_tab;
00105   /* Pointer to descriptors of translated sysdep strings.  */
00106   const struct sysdep_string_desc *trans_sysdep_tab;
00107 
00108   /* Size of hash table.  */
00109   nls_uint32 hash_size;
00110   /* Pointer to hash table.  */
00111   const nls_uint32 *hash_tab;
00112   /* 1 if the hash table uses a different endianness than this machine.  */
00113   int must_swap_hash_tab;
00114 
00115   int codeset_cntr;
00116 #ifdef _LIBC
00117   __gconv_t conv;
00118 #else
00119 # if HAVE_ICONV
00120   iconv_t conv;
00121 # endif
00122 #endif
00123   char **conv_tab;
00124 
00125   struct expression *plural;
00126   unsigned long int nplurals;
00127 };
00128 
00129 /* We want to allocate a string at the end of the struct.  But ISO C
00130    doesn't allow zero sized arrays.  */
00131 #ifdef __GNUC__
00132 # define ZERO 0
00133 #else
00134 # define ZERO 1
00135 #endif
00136 
00137 /* A set of settings bound to a message domain.  Used to store settings
00138    from bindtextdomain() and bind_textdomain_codeset().  */
00139 struct binding
00140 {
00141   struct binding *next;
00142   char *dirname;
00143   int codeset_cntr;     /* Incremented each time codeset changes.  */
00144   char *codeset;
00145   char domainname[ZERO];
00146 };
00147 
00148 /* A counter which is incremented each time some previous translations
00149    become invalid.
00150    This variable is part of the external ABI of the GNU libintl.  */
00151 extern int _nl_msg_cat_cntr;
00152 
00153 #ifndef _LIBC
00154 const char *_nl_locale_name (int category, const char *categoryname);
00155 #endif
00156 
00157 struct loaded_l10nfile *_nl_find_domain (const char *__dirname, char *__locale,
00158                                          const char *__domainname,
00159                                          struct binding *__domainbinding)
00160      internal_function;
00161 void _nl_load_domain (struct loaded_l10nfile *__domain,
00162                       struct binding *__domainbinding)
00163      internal_function;
00164 void _nl_unload_domain (struct loaded_domain *__domain)
00165      internal_function;
00166 const char *_nl_init_domain_conv (struct loaded_l10nfile *__domain_file,
00167                                   struct loaded_domain *__domain,
00168                                   struct binding *__domainbinding)
00169      internal_function;
00170 void _nl_free_domain_conv (struct loaded_domain *__domain)
00171      internal_function;
00172 
00173 char *_nl_find_msg (struct loaded_l10nfile *domain_file,
00174                     struct binding *domainbinding, const char *msgid,
00175                     size_t *lengthp)
00176      internal_function;
00177 
00178 #ifdef _LIBC
00179 extern char *__gettext (const char *__msgid);
00180 extern char *__dgettext (const char *__domainname, const char *__msgid);
00181 extern char *__dcgettext (const char *__domainname, const char *__msgid,
00182                           int __category);
00183 extern char *__ngettext (const char *__msgid1, const char *__msgid2,
00184                          unsigned long int __n);
00185 extern char *__dngettext (const char *__domainname,
00186                           const char *__msgid1, const char *__msgid2,
00187                           unsigned long int n);
00188 extern char *__dcngettext (const char *__domainname,
00189                            const char *__msgid1, const char *__msgid2,
00190                            unsigned long int __n, int __category);
00191 extern char *__dcigettext (const char *__domainname,
00192                            const char *__msgid1, const char *__msgid2,
00193                            int __plural, unsigned long int __n,
00194                            int __category);
00195 extern char *__textdomain (const char *__domainname);
00196 extern char *__bindtextdomain (const char *__domainname,
00197                                const char *__dirname);
00198 extern char *__bind_textdomain_codeset (const char *__domainname,
00199                                         const char *__codeset);
00200 #else
00201 /* Declare the exported libintl_* functions, in a way that allows us to
00202    call them under their real name.  */
00203 # undef _INTL_REDIRECT_INLINE
00204 # undef _INTL_REDIRECT_MACROS
00205 # define _INTL_REDIRECT_MACROS
00206 # include "libgnuintl.h"
00207 extern char *libintl_dcigettext (const char *__domainname,
00208                                  const char *__msgid1, const char *__msgid2,
00209                                  int __plural, unsigned long int __n,
00210                                  int __category);
00211 #endif
00212 
00213 /* @@ begin of epilog @@ */
00214 
00215 #endif /* gettextP.h  */