Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

gettextP.h

00001 /* Header describing internals of libintl library.
00002    Copyright (C) 1995-1999, 2000-2002 Free Software Foundation, Inc.
00003    Written by Ulrich Drepper <[email protected]>, 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 PARAMS
00040 # if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
00041 #  define PARAMS(args) args
00042 # else
00043 #  define PARAMS(args) ()
00044 # endif
00045 #endif
00046 
00047 #ifndef internal_function
00048 # define internal_function
00049 #endif
00050 
00051 #ifndef attribute_hidden
00052 # define attribute_hidden
00053 #endif
00054 
00055 /* Tell the compiler when a conditional or integer expression is
00056    almost always true or almost always false.  */
00057 #ifndef HAVE_BUILTIN_EXPECT
00058 # define __builtin_expect(expr, val) (expr)
00059 #endif
00060 
00061 #ifndef W
00062 # define W(flag, data) ((flag) ? SWAP (data) : (data))
00063 #endif
00064 
00065 
00066 #ifdef _LIBC
00067 # include <byteswap.h>
00068 # define SWAP(i) bswap_32 (i)
00069 #else
00070 static inline nls_uint32
00071 SWAP (i)
00072      nls_uint32 i;
00073 {
00074   return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
00075 }
00076 #endif
00077 
00078 
00079 /* In-memory representation of system dependent string.  */
00080 struct sysdep_string_desc
00081 {
00082   /* Length of addressed string, including the trailing NUL.  */
00083   size_t length;
00084   /* Pointer to addressed string.  */
00085   const char *pointer;
00086 };
00087 
00088 /* The representation of an opened message catalog.  */
00089 struct loaded_domain
00090 {
00091   /* Pointer to memory containing the .mo file.  */
00092   const char *data;
00093   /* 1 if the memory is mmap()ed, 0 if the memory is malloc()ed.  */
00094   int use_mmap;
00095   /* Size of mmap()ed memory.  */
00096   size_t mmap_size;
00097   /* 1 if the .mo file uses a different endianness than this machine.  */
00098   int must_swap;
00099   /* Pointer to additional malloc()ed memory.  */
00100   void *malloced;
00101 
00102   /* Number of static strings pairs.  */
00103   nls_uint32 nstrings;
00104   /* Pointer to descriptors of original strings in the file.  */
00105   const struct string_desc *orig_tab;
00106   /* Pointer to descriptors of translated strings in the file.  */
00107   const struct string_desc *trans_tab;
00108 
00109   /* Number of system dependent strings pairs.  */
00110   nls_uint32 n_sysdep_strings;
00111   /* Pointer to descriptors of original sysdep strings.  */
00112   const struct sysdep_string_desc *orig_sysdep_tab;
00113   /* Pointer to descriptors of translated sysdep strings.  */
00114   const struct sysdep_string_desc *trans_sysdep_tab;
00115 
00116   /* Size of hash table.  */
00117   nls_uint32 hash_size;
00118   /* Pointer to hash table.  */
00119   const nls_uint32 *hash_tab;
00120   /* 1 if the hash table uses a different endianness than this machine.  */
00121   int must_swap_hash_tab;
00122 
00123   int codeset_cntr;
00124 #ifdef _LIBC
00125   __gconv_t conv;
00126 #else
00127 # if HAVE_ICONV
00128   iconv_t conv;
00129 # endif
00130 #endif
00131   char **conv_tab;
00132 
00133   struct expression *plural;
00134   unsigned long int nplurals;
00135 };
00136 
00137 /* We want to allocate a string at the end of the struct.  But ISO C
00138    doesn't allow zero sized arrays.  */
00139 #ifdef __GNUC__
00140 # define ZERO 0
00141 #else
00142 # define ZERO 1
00143 #endif
00144 
00145 /* A set of settings bound to a message domain.  Used to store settings
00146    from bindtextdomain() and bind_textdomain_codeset().  */
00147 struct binding
00148 {
00149   struct binding *next;
00150   char *dirname;
00151   int codeset_cntr;     /* Incremented each time codeset changes.  */
00152   char *codeset;
00153   char domainname[ZERO];
00154 };
00155 
00156 /* A counter which is incremented each time some previous translations
00157    become invalid.
00158    This variable is part of the external ABI of the GNU libintl.  */
00159 extern int _nl_msg_cat_cntr;
00160 
00161 #ifndef _LIBC
00162 const char *_nl_locale_name PARAMS ((int category, const char *categoryname));
00163 #endif
00164 
00165 struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
00166                                                  char *__locale,
00167                                                  const char *__domainname,
00168                                               struct binding *__domainbinding))
00169      internal_function;
00170 void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain,
00171                               struct binding *__domainbinding))
00172      internal_function;
00173 void _nl_unload_domain PARAMS ((struct loaded_domain *__domain))
00174      internal_function;
00175 const char *_nl_init_domain_conv PARAMS ((struct loaded_l10nfile *__domain_file,
00176                                           struct loaded_domain *__domain,
00177                                           struct binding *__domainbinding))
00178      internal_function;
00179 void _nl_free_domain_conv PARAMS ((struct loaded_domain *__domain))
00180      internal_function;
00181 
00182 char *_nl_find_msg PARAMS ((struct loaded_l10nfile *domain_file,
00183                             struct binding *domainbinding,
00184                             const char *msgid, size_t *lengthp))
00185      internal_function;
00186 
00187 #ifdef _LIBC
00188 extern char *__gettext PARAMS ((const char *__msgid));
00189 extern char *__dgettext PARAMS ((const char *__domainname,
00190                                  const char *__msgid));
00191 extern char *__dcgettext PARAMS ((const char *__domainname,
00192                                   const char *__msgid, int __category));
00193 extern char *__ngettext PARAMS ((const char *__msgid1, const char *__msgid2,
00194                                  unsigned long int __n));
00195 extern char *__dngettext PARAMS ((const char *__domainname,
00196                                   const char *__msgid1, const char *__msgid2,
00197                                   unsigned long int n));
00198 extern char *__dcngettext PARAMS ((const char *__domainname,
00199                                    const char *__msgid1, const char *__msgid2,
00200                                    unsigned long int __n, int __category));
00201 extern char *__dcigettext PARAMS ((const char *__domainname,
00202                                    const char *__msgid1, const char *__msgid2,
00203                                    int __plural, unsigned long int __n,
00204                                    int __category));
00205 extern char *__textdomain PARAMS ((const char *__domainname));
00206 extern char *__bindtextdomain PARAMS ((const char *__domainname,
00207                                        const char *__dirname));
00208 extern char *__bind_textdomain_codeset PARAMS ((const char *__domainname,
00209                                                 const char *__codeset));
00210 #else
00211 extern char *libintl_gettext PARAMS ((const char *__msgid));
00212 extern char *libintl_dgettext PARAMS ((const char *__domainname,
00213                                        const char *__msgid));
00214 extern char *libintl_dcgettext PARAMS ((const char *__domainname,
00215                                         const char *__msgid, int __category));
00216 extern char *libintl_ngettext PARAMS ((const char *__msgid1,
00217                                        const char *__msgid2,
00218                                        unsigned long int __n));
00219 extern char *libintl_dngettext PARAMS ((const char *__domainname,
00220                                         const char *__msgid1,
00221                                         const char *__msgid2,
00222                                         unsigned long int __n));
00223 extern char *libintl_dcngettext PARAMS ((const char *__domainname,
00224                                          const char *__msgid1,
00225                                          const char *__msgid2,
00226                                          unsigned long int __n,
00227                                          int __category));
00228 extern char *libintl_dcigettext PARAMS ((const char *__domainname,
00229                                          const char *__msgid1,
00230                                          const char *__msgid2,
00231                                          int __plural, unsigned long int __n,
00232                                          int __category));
00233 extern char *libintl_textdomain PARAMS ((const char *__domainname));
00234 extern char *libintl_bindtextdomain PARAMS ((const char *__domainname,
00235                                              const char *__dirname));
00236 extern char *libintl_bind_textdomain_codeset PARAMS ((const char *__domainname,
00237                                                       const char *__codeset));
00238 #endif
00239 
00240 /* @@ begin of epilog @@ */
00241 
00242 #endif /* gettextP.h  */

Generated on Tue Dec 20 10:14:20 2005 for vlc-0.8.4a by  doxygen 1.4.2