~ubuntu-branches/ubuntu/hardy/minicom/hardy

« back to all changes in this revision

Viewing changes to intl/gettextP.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin A. Godisch
  • Date: 2006-10-27 05:41:23 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061027054123-9cyfsdx649zetdrv
Tags: 2.2-3
* Added upstream NEWS file, closes: #394827.
* Fixed spelling errors, closes: #395449.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
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 "gettext.h"            /* Get nls_uint32.  */
36
 
 
37
 
/* @@ end of prolog @@ */
38
 
 
39
 
#ifndef PARAMS
40
 
# if __STDC__
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
 
/* This is the representation of the expressions to determine the
76
 
   plural form.  */
77
 
struct expression
78
 
{
79
 
  int nargs;                    /* Number of arguments.  */
80
 
  enum operator
81
 
  {
82
 
    /* Without arguments:  */
83
 
    var,                        /* The variable "n".  */
84
 
    num,                        /* Decimal number.  */
85
 
    /* Unary operators:  */
86
 
    lnot,                       /* Logical NOT.  */
87
 
    /* Binary operators:  */
88
 
    mult,                       /* Multiplication.  */
89
 
    divide,                     /* Division.  */
90
 
    module,                     /* Module operation.  */
91
 
    plus,                       /* Addition.  */
92
 
    minus,                      /* Subtraction.  */
93
 
    less_than,                  /* Comparison.  */
94
 
    greater_than,               /* Comparison.  */
95
 
    less_or_equal,              /* Comparison.  */
96
 
    greater_or_equal,           /* Comparison.  */
97
 
    equal,                      /* Comparision for equality.  */
98
 
    not_equal,                  /* Comparision for inequality.  */
99
 
    land,                       /* Logical AND.  */
100
 
    lor,                        /* Logical OR.  */
101
 
    /* Ternary operators:  */
102
 
    qmop                        /* Question mark operator.  */
103
 
  } operation;
104
 
  union
105
 
  {
106
 
    unsigned long int num;      /* Number value for `num'.  */
107
 
    struct expression *args[3]; /* Up to three arguments.  */
108
 
  } val;
109
 
};
110
 
 
111
 
/* This is the data structure to pass information to the parser and get
112
 
   the result in a thread-safe way.  */
113
 
struct parse_args
114
 
{
115
 
  const char *cp;
116
 
  struct expression *res;
117
 
};
118
 
 
119
 
 
120
 
/* The representation of an opened message catalog.  */
121
 
struct loaded_domain
122
 
{
123
 
  const char *data;
124
 
  int use_mmap;
125
 
  size_t mmap_size;
126
 
  int must_swap;
127
 
  nls_uint32 nstrings;
128
 
  struct string_desc *orig_tab;
129
 
  struct string_desc *trans_tab;
130
 
  nls_uint32 hash_size;
131
 
  nls_uint32 *hash_tab;
132
 
  int codeset_cntr;
133
 
#ifdef _LIBC
134
 
  __gconv_t conv;
135
 
#else
136
 
# if HAVE_ICONV
137
 
  iconv_t conv;
138
 
# endif
139
 
#endif
140
 
  char **conv_tab;
141
 
 
142
 
  struct expression *plural;
143
 
  unsigned long int nplurals;
144
 
};
145
 
 
146
 
/* We want to allocate a string at the end of the struct.  But ISO C
147
 
   doesn't allow zero sized arrays.  */
148
 
#ifdef __GNUC__
149
 
# define ZERO 0
150
 
#else
151
 
# define ZERO 1
152
 
#endif
153
 
 
154
 
/* A set of settings bound to a message domain.  Used to store settings
155
 
   from bindtextdomain() and bind_textdomain_codeset().  */
156
 
struct binding
157
 
{
158
 
  struct binding *next;
159
 
  char *dirname;
160
 
  int codeset_cntr;     /* Incremented each time codeset changes.  */
161
 
  char *codeset;
162
 
  char domainname[ZERO];
163
 
};
164
 
 
165
 
/* A counter which is incremented each time some previous translations
166
 
   become invalid.
167
 
   This variable is part of the external ABI of the GNU libintl.  */
168
 
extern int _nl_msg_cat_cntr;
169
 
 
170
 
struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
171
 
                                                 char *__locale,
172
 
                                                 const char *__domainname,
173
 
                                              struct binding *__domainbinding))
174
 
     internal_function;
175
 
void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain,
176
 
                              struct binding *__domainbinding))
177
 
     internal_function;
178
 
void _nl_unload_domain PARAMS ((struct loaded_domain *__domain))
179
 
     internal_function;
180
 
const char *_nl_init_domain_conv PARAMS ((struct loaded_l10nfile *__domain_file,
181
 
                                          struct loaded_domain *__domain,
182
 
                                          struct binding *__domainbinding))
183
 
     internal_function;
184
 
void _nl_free_domain_conv PARAMS ((struct loaded_domain *__domain))
185
 
     internal_function;
186
 
 
187
 
char *_nl_find_msg PARAMS ((struct loaded_l10nfile *domain_file,
188
 
                            struct binding *domainbinding,
189
 
                            const char *msgid, size_t *lengthp))
190
 
     internal_function;
191
 
 
192
 
#ifdef _LIBC
193
 
extern char *__gettext PARAMS ((const char *__msgid));
194
 
extern char *__dgettext PARAMS ((const char *__domainname,
195
 
                                 const char *__msgid));
196
 
extern char *__dcgettext PARAMS ((const char *__domainname,
197
 
                                  const char *__msgid, int __category));
198
 
extern char *__ngettext PARAMS ((const char *__msgid1, const char *__msgid2,
199
 
                                 unsigned long int __n));
200
 
extern char *__dngettext PARAMS ((const char *__domainname,
201
 
                                  const char *__msgid1, const char *__msgid2,
202
 
                                  unsigned long int n));
203
 
extern char *__dcngettext PARAMS ((const char *__domainname,
204
 
                                   const char *__msgid1, const char *__msgid2,
205
 
                                   unsigned long int __n, int __category));
206
 
extern char *__dcigettext PARAMS ((const char *__domainname,
207
 
                                   const char *__msgid1, const char *__msgid2,
208
 
                                   int __plural, unsigned long int __n,
209
 
                                   int __category));
210
 
extern char *__textdomain PARAMS ((const char *__domainname));
211
 
extern char *__bindtextdomain PARAMS ((const char *__domainname,
212
 
                                       const char *__dirname));
213
 
extern char *__bind_textdomain_codeset PARAMS ((const char *__domainname,
214
 
                                                const char *__codeset));
215
 
#else
216
 
extern char *gettext__ PARAMS ((const char *__msgid));
217
 
extern char *dgettext__ PARAMS ((const char *__domainname,
218
 
                                 const char *__msgid));
219
 
extern char *dcgettext__ PARAMS ((const char *__domainname,
220
 
                                  const char *__msgid, int __category));
221
 
extern char *ngettext__ PARAMS ((const char *__msgid1, const char *__msgid2,
222
 
                                 unsigned long int __n));
223
 
extern char *dngettext__ PARAMS ((const char *__domainname,
224
 
                                  const char *__msgid1, const char *__msgid2,
225
 
                                  unsigned long int __n));
226
 
extern char *dcngettext__ PARAMS ((const char *__domainname,
227
 
                                   const char *__msgid1, const char *__msgid2,
228
 
                                   unsigned long int __n, int __category));
229
 
extern char *dcigettext__ PARAMS ((const char *__domainname,
230
 
                                   const char *__msgid1, const char *__msgid2,
231
 
                                   int __plural, unsigned long int __n,
232
 
                                   int __category));
233
 
extern char *textdomain__ PARAMS ((const char *__domainname));
234
 
extern char *bindtextdomain__ PARAMS ((const char *__domainname,
235
 
                                       const char *__dirname));
236
 
extern char *bind_textdomain_codeset__ PARAMS ((const char *__domainname,
237
 
                                                const char *__codeset));
238
 
#endif
239
 
 
240
 
#ifdef _LIBC
241
 
extern void __gettext_free_exp PARAMS ((struct expression *exp))
242
 
     internal_function;
243
 
extern int __gettextparse PARAMS ((void *arg));
244
 
#else
245
 
extern void gettext_free_exp__ PARAMS ((struct expression *exp))
246
 
     internal_function;
247
 
extern int gettextparse__ PARAMS ((void *arg));
248
 
#endif
249
 
 
250
 
/* @@ begin of epilog @@ */
251
 
 
252
 
#endif /* gettextP.h  */