Main Page   Compound List   File List   Compound Members   File Members  

gettextP.h

00001 /* Header describing internals of libintl library.
00002    Copyright (C) 1995-1999, 2000, 2001 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
00006    it under the terms of the GNU General Public License as published by
00007    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
00013    GNU General Public License for more details.
00014 
00015    You should have received a copy of the GNU General Public License
00016    along with this program; if not, write to the Free Software Foundation,
00017    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
00018 
00019 #ifndef _GETTEXTP_H
00020 #define _GETTEXTP_H
00021 
00022 #include <stddef.h>             /* Get size_t.  */
00023 
00024 #ifdef _LIBC
00025 # include "../iconv/gconv_int.h"
00026 #else
00027 # if HAVE_ICONV
00028 #  include <iconv.h>
00029 # endif
00030 #endif
00031 
00032 #include "loadinfo.h"
00033 
00034 #include "gettext.h"            /* Get nls_uint32.  */
00035 
00036 /* @@ end of prolog @@ */
00037 
00038 #ifndef PARAMS
00039 # if __STDC__
00040 #  define PARAMS(args) args
00041 # else
00042 #  define PARAMS(args) ()
00043 # endif
00044 #endif
00045 
00046 #ifndef internal_function
00047 # define internal_function
00048 #endif
00049 
00050 /* Tell the compiler when a conditional or integer expression is
00051    almost always true or almost always false.  */
00052 #ifndef HAVE_BUILTIN_EXPECT
00053 # define __builtin_expect(expr, val) (expr)
00054 #endif
00055 
00056 #ifndef W
00057 # define W(flag, data) ((flag) ? SWAP (data) : (data))
00058 #endif
00059 
00060 
00061 #ifdef _LIBC
00062 # include <byteswap.h>
00063 # define SWAP(i) bswap_32 (i)
00064 #else
00065 static inline nls_uint32
00066 SWAP (i)
00067      nls_uint32 i;
00068 {
00069   return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
00070 }
00071 #endif
00072 
00073 
00074 /* This is the representation of the expressions to determine the
00075    plural form.  */
00076 struct expression
00077 {
00078   int nargs;                    /* Number of arguments.  */
00079   enum operator
00080   {
00081     /* Without arguments:  */
00082     var,                        /* The variable "n".  */
00083     num,                        /* Decimal number.  */
00084     /* Unary operators:  */
00085     lnot,                       /* Logical NOT.  */
00086     /* Binary operators:  */
00087     mult,                       /* Multiplication.  */
00088     divide,                     /* Division.  */
00089     module,                     /* Module operation.  */
00090     plus,                       /* Addition.  */
00091     minus,                      /* Subtraction.  */
00092     less_than,                  /* Comparison.  */
00093     greater_than,               /* Comparison.  */
00094     less_or_equal,              /* Comparison.  */
00095     greater_or_equal,           /* Comparison.  */
00096     equal,                      /* Comparision for equality.  */
00097     not_equal,                  /* Comparision for inequality.  */
00098     land,                       /* Logical AND.  */
00099     lor,                        /* Logical OR.  */
00100     /* Ternary operators:  */
00101     qmop                        /* Question mark operator.  */
00102   } operation;
00103   union
00104   {
00105     unsigned long int num;      /* Number value for `num'.  */
00106     struct expression *args[3]; /* Up to three arguments.  */
00107   } val;
00108 };
00109 
00110 /* This is the data structure to pass information to the parser and get
00111    the result in a thread-safe way.  */
00112 struct parse_args
00113 {
00114   const char *cp;
00115   struct expression *res;
00116 };
00117 
00118 
00119 /* The representation of an opened message catalog.  */
00120 struct loaded_domain
00121 {
00122   const char *data;
00123   int use_mmap;
00124   size_t mmap_size;
00125   int must_swap;
00126   nls_uint32 nstrings;
00127   struct string_desc *orig_tab;
00128   struct string_desc *trans_tab;
00129   nls_uint32 hash_size;
00130   nls_uint32 *hash_tab;
00131   int codeset_cntr;
00132 #ifdef _LIBC
00133   __gconv_t conv;
00134 #else
00135 # if HAVE_ICONV
00136   iconv_t conv;
00137 # endif
00138 #endif
00139   char **conv_tab;
00140 
00141   struct expression *plural;
00142   unsigned long int nplurals;
00143 };
00144 
00145 /* We want to allocate a string at the end of the struct.  But ISO C
00146    doesn't allow zero sized arrays.  */
00147 #ifdef __GNUC__
00148 # define ZERO 0
00149 #else
00150 # define ZERO 1
00151 #endif
00152 
00153 /* A set of settings bound to a message domain.  Used to store settings
00154    from bindtextdomain() and bind_textdomain_codeset().  */
00155 struct binding
00156 {
00157   struct binding *next;
00158   char *dirname;
00159   int codeset_cntr;     /* Incremented each time codeset changes.  */
00160   char *codeset;
00161   char domainname[ZERO];
00162 };
00163 
00164 /* A counter which is incremented each time some previous translations
00165    become invalid.
00166    This variable is part of the external ABI of the GNU libintl.  */
00167 extern int _nl_msg_cat_cntr;
00168 
00169 struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
00170                                                  char *__locale,
00171                                                  const char *__domainname,
00172                                               struct binding *__domainbinding))
00173      internal_function;
00174 void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain,
00175                               struct binding *__domainbinding))
00176      internal_function;
00177 void _nl_unload_domain PARAMS ((struct loaded_domain *__domain))
00178      internal_function;
00179 const char *_nl_init_domain_conv PARAMS ((struct loaded_l10nfile *__domain_file,
00180                                           struct loaded_domain *__domain,
00181                                           struct binding *__domainbinding))
00182      internal_function;
00183 void _nl_free_domain_conv PARAMS ((struct loaded_domain *__domain))
00184      internal_function;
00185 
00186 char *_nl_find_msg PARAMS ((struct loaded_l10nfile *domain_file,
00187                             struct binding *domainbinding,
00188                             const char *msgid, size_t *lengthp))
00189      internal_function;
00190 
00191 #ifdef _LIBC
00192 extern char *__gettext PARAMS ((const char *__msgid));
00193 extern char *__dgettext PARAMS ((const char *__domainname,
00194                                  const char *__msgid));
00195 extern char *__dcgettext PARAMS ((const char *__domainname,
00196                                   const char *__msgid, int __category));
00197 extern char *__ngettext PARAMS ((const char *__msgid1, const char *__msgid2,
00198                                  unsigned long int __n));
00199 extern char *__dngettext PARAMS ((const char *__domainname,
00200                                   const char *__msgid1, const char *__msgid2,
00201                                   unsigned long int n));
00202 extern char *__dcngettext PARAMS ((const char *__domainname,
00203                                    const char *__msgid1, const char *__msgid2,
00204                                    unsigned long int __n, int __category));
00205 extern char *__dcigettext PARAMS ((const char *__domainname,
00206                                    const char *__msgid1, const char *__msgid2,
00207                                    int __plural, unsigned long int __n,
00208                                    int __category));
00209 extern char *__textdomain PARAMS ((const char *__domainname));
00210 extern char *__bindtextdomain PARAMS ((const char *__domainname,
00211                                        const char *__dirname));
00212 extern char *__bind_textdomain_codeset PARAMS ((const char *__domainname,
00213                                                 const char *__codeset));
00214 #else
00215 extern char *gettext__ PARAMS ((const char *__msgid));
00216 extern char *dgettext__ PARAMS ((const char *__domainname,
00217                                  const char *__msgid));
00218 extern char *dcgettext__ PARAMS ((const char *__domainname,
00219                                   const char *__msgid, int __category));
00220 extern char *ngettext__ PARAMS ((const char *__msgid1, const char *__msgid2,
00221                                  unsigned long int __n));
00222 extern char *dngettext__ PARAMS ((const char *__domainname,
00223                                   const char *__msgid1, const char *__msgid2,
00224                                   unsigned long int __n));
00225 extern char *dcngettext__ PARAMS ((const char *__domainname,
00226                                    const char *__msgid1, const char *__msgid2,
00227                                    unsigned long int __n, int __category));
00228 extern char *dcigettext__ PARAMS ((const char *__domainname,
00229                                    const char *__msgid1, const char *__msgid2,
00230                                    int __plural, unsigned long int __n,
00231                                    int __category));
00232 extern char *textdomain__ PARAMS ((const char *__domainname));
00233 extern char *bindtextdomain__ PARAMS ((const char *__domainname,
00234                                        const char *__dirname));
00235 extern char *bind_textdomain_codeset__ PARAMS ((const char *__domainname,
00236                                                 const char *__codeset));
00237 #endif
00238 
00239 #ifdef _LIBC
00240 extern void __gettext_free_exp PARAMS ((struct expression *exp))
00241      internal_function;
00242 extern int __gettextparse PARAMS ((void *arg));
00243 #else
00244 extern void gettext_free_exp__ PARAMS ((struct expression *exp))
00245      internal_function;
00246 extern int gettextparse__ PARAMS ((void *arg));
00247 #endif
00248 
00249 /* @@ begin of epilog @@ */
00250 
00251 #endif /* gettextP.h  */

Generated at Wed Oct 12 09:59:05 2005 for libuser by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001