~ldgoodridge95/ubuntu/vivid/upstart/rm-libjson0-dev

« back to all changes in this revision

Viewing changes to intl/libgnuintl.h.in

Tags: upstream-1.7
ImportĀ upstreamĀ versionĀ 1.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Message catalogs for internationalization.
 
2
   Copyright (C) 1995-1997, 2000-2007 Free Software Foundation, Inc.
 
3
 
 
4
   This program is free software; you can redistribute it and/or modify it
 
5
   under the terms of the GNU Library General Public License as published
 
6
   by the Free Software Foundation; either version 2, or (at your option)
 
7
   any later version.
 
8
 
 
9
   This program is distributed in the hope that it will be useful,
 
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
   Library General Public License for more details.
 
13
 
 
14
   You should have received a copy of the GNU Library General Public
 
15
   License along with this program; if not, write to the Free Software
 
16
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
 
17
   USA.  */
 
18
 
 
19
#ifndef _LIBINTL_H
 
20
#define _LIBINTL_H      1
 
21
 
 
22
#include <locale.h>
 
23
 
 
24
/* The LC_MESSAGES locale category is the category used by the functions
 
25
   gettext() and dgettext().  It is specified in POSIX, but not in ANSI C.
 
26
   On systems that don't define it, use an arbitrary value instead.
 
27
   On Solaris, <locale.h> defines __LOCALE_H (or _LOCALE_H in Solaris 2.5)
 
28
   then includes <libintl.h> (i.e. this file!) and then only defines
 
29
   LC_MESSAGES.  To avoid a redefinition warning, don't define LC_MESSAGES
 
30
   in this case.  */
 
31
#if !defined LC_MESSAGES && !(defined __LOCALE_H || (defined _LOCALE_H && defined __sun))
 
32
# define LC_MESSAGES 1729
 
33
#endif
 
34
 
 
35
/* We define an additional symbol to signal that we use the GNU
 
36
   implementation of gettext.  */
 
37
#define __USE_GNU_GETTEXT 1
 
38
 
 
39
/* Provide information about the supported file formats.  Returns the
 
40
   maximum minor revision number supported for a given major revision.  */
 
41
#define __GNU_GETTEXT_SUPPORTED_REVISION(major) \
 
42
  ((major) == 0 || (major) == 1 ? 1 : -1)
 
43
 
 
44
/* Resolve a platform specific conflict on DJGPP.  GNU gettext takes
 
45
   precedence over _conio_gettext.  */
 
46
#ifdef __DJGPP__
 
47
# undef gettext
 
48
#endif
 
49
 
 
50
#ifdef __cplusplus
 
51
extern "C" {
 
52
#endif
 
53
 
 
54
 
 
55
/* Version number: (major<<16) + (minor<<8) + subminor */
 
56
#define LIBINTL_VERSION 0x001100
 
57
extern int libintl_version;
 
58
 
 
59
 
 
60
/* We redirect the functions to those prefixed with "libintl_".  This is
 
61
   necessary, because some systems define gettext/textdomain/... in the C
 
62
   library (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer).
 
63
   If we used the unprefixed names, there would be cases where the
 
64
   definition in the C library would override the one in the libintl.so
 
65
   shared library.  Recall that on ELF systems, the symbols are looked
 
66
   up in the following order:
 
67
     1. in the executable,
 
68
     2. in the shared libraries specified on the link command line, in order,
 
69
     3. in the dependencies of the shared libraries specified on the link
 
70
        command line,
 
71
     4. in the dlopen()ed shared libraries, in the order in which they were
 
72
        dlopen()ed.
 
73
   The definition in the C library would override the one in libintl.so if
 
74
   either
 
75
     * -lc is given on the link command line and -lintl isn't, or
 
76
     * -lc is given on the link command line before -lintl, or
 
77
     * libintl.so is a dependency of a dlopen()ed shared library but not
 
78
       linked to the executable at link time.
 
79
   Since Solaris gettext() behaves differently than GNU gettext(), this
 
80
   would be unacceptable.
 
81
 
 
82
   The redirection happens by default through macros in C, so that &gettext
 
83
   is independent of the compilation unit, but through inline functions in
 
84
   C++, in order not to interfere with the name mangling of class fields or
 
85
   class methods called 'gettext'.  */
 
86
 
 
87
/* The user can define _INTL_REDIRECT_INLINE or _INTL_REDIRECT_MACROS.
 
88
   If he doesn't, we choose the method.  A third possible method is
 
89
   _INTL_REDIRECT_ASM, supported only by GCC.  */
 
90
#if !(defined _INTL_REDIRECT_INLINE || defined _INTL_REDIRECT_MACROS)
 
91
# if __GNUC__ >= 2 && !(__APPLE_CC__ > 1) && !defined __MINGW32__ && !(__GNUC__ == 2 && defined _AIX) && (defined __STDC__ || defined __cplusplus)
 
92
#  define _INTL_REDIRECT_ASM
 
93
# else
 
94
#  ifdef __cplusplus
 
95
#   define _INTL_REDIRECT_INLINE
 
96
#  else
 
97
#   define _INTL_REDIRECT_MACROS
 
98
#  endif
 
99
# endif
 
100
#endif
 
101
/* Auxiliary macros.  */
 
102
#ifdef _INTL_REDIRECT_ASM
 
103
# define _INTL_ASM(cname) __asm__ (_INTL_ASMNAME (__USER_LABEL_PREFIX__, #cname))
 
104
# define _INTL_ASMNAME(prefix,cnamestring) _INTL_STRINGIFY (prefix) cnamestring
 
105
# define _INTL_STRINGIFY(prefix) #prefix
 
106
#else
 
107
# define _INTL_ASM(cname)
 
108
#endif
 
109
 
 
110
/* _INTL_MAY_RETURN_STRING_ARG(n) declares that the given function may return
 
111
   its n-th argument literally.  This enables GCC to warn for example about
 
112
   printf (gettext ("foo %y")).  */
 
113
#if __GNUC__ >= 3 && !(__APPLE_CC__ > 1 && defined __cplusplus)
 
114
# define _INTL_MAY_RETURN_STRING_ARG(n) __attribute__ ((__format_arg__ (n)))
 
115
#else
 
116
# define _INTL_MAY_RETURN_STRING_ARG(n)
 
117
#endif
 
118
 
 
119
/* Look up MSGID in the current default message catalog for the current
 
120
   LC_MESSAGES locale.  If not found, returns MSGID itself (the default
 
121
   text).  */
 
122
#ifdef _INTL_REDIRECT_INLINE
 
123
extern char *libintl_gettext (const char *__msgid)
 
124
       _INTL_MAY_RETURN_STRING_ARG (1);
 
125
static inline char *gettext (const char *__msgid)
 
126
{
 
127
  return libintl_gettext (__msgid);
 
128
}
 
129
#else
 
130
#ifdef _INTL_REDIRECT_MACROS
 
131
# define gettext libintl_gettext
 
132
#endif
 
133
extern char *gettext (const char *__msgid)
 
134
       _INTL_ASM (libintl_gettext)
 
135
       _INTL_MAY_RETURN_STRING_ARG (1);
 
136
#endif
 
137
 
 
138
/* Look up MSGID in the DOMAINNAME message catalog for the current
 
139
   LC_MESSAGES locale.  */
 
140
#ifdef _INTL_REDIRECT_INLINE
 
141
extern char *libintl_dgettext (const char *__domainname, const char *__msgid)
 
142
       _INTL_MAY_RETURN_STRING_ARG (2);
 
143
static inline char *dgettext (const char *__domainname, const char *__msgid)
 
144
{
 
145
  return libintl_dgettext (__domainname, __msgid);
 
146
}
 
147
#else
 
148
#ifdef _INTL_REDIRECT_MACROS
 
149
# define dgettext libintl_dgettext
 
150
#endif
 
151
extern char *dgettext (const char *__domainname, const char *__msgid)
 
152
       _INTL_ASM (libintl_dgettext)
 
153
       _INTL_MAY_RETURN_STRING_ARG (2);
 
154
#endif
 
155
 
 
156
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
 
157
   locale.  */
 
158
#ifdef _INTL_REDIRECT_INLINE
 
159
extern char *libintl_dcgettext (const char *__domainname, const char *__msgid,
 
160
                                int __category)
 
161
       _INTL_MAY_RETURN_STRING_ARG (2);
 
162
static inline char *dcgettext (const char *__domainname, const char *__msgid,
 
163
                               int __category)
 
164
{
 
165
  return libintl_dcgettext (__domainname, __msgid, __category);
 
166
}
 
167
#else
 
168
#ifdef _INTL_REDIRECT_MACROS
 
169
# define dcgettext libintl_dcgettext
 
170
#endif
 
171
extern char *dcgettext (const char *__domainname, const char *__msgid,
 
172
                        int __category)
 
173
       _INTL_ASM (libintl_dcgettext)
 
174
       _INTL_MAY_RETURN_STRING_ARG (2);
 
175
#endif
 
176
 
 
177
 
 
178
/* Similar to `gettext' but select the plural form corresponding to the
 
179
   number N.  */
 
180
#ifdef _INTL_REDIRECT_INLINE
 
181
extern char *libintl_ngettext (const char *__msgid1, const char *__msgid2,
 
182
                               unsigned long int __n)
 
183
       _INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2);
 
184
static inline char *ngettext (const char *__msgid1, const char *__msgid2,
 
185
                              unsigned long int __n)
 
186
{
 
187
  return libintl_ngettext (__msgid1, __msgid2, __n);
 
188
}
 
189
#else
 
190
#ifdef _INTL_REDIRECT_MACROS
 
191
# define ngettext libintl_ngettext
 
192
#endif
 
193
extern char *ngettext (const char *__msgid1, const char *__msgid2,
 
194
                       unsigned long int __n)
 
195
       _INTL_ASM (libintl_ngettext)
 
196
       _INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2);
 
197
#endif
 
198
 
 
199
/* Similar to `dgettext' but select the plural form corresponding to the
 
200
   number N.  */
 
201
#ifdef _INTL_REDIRECT_INLINE
 
202
extern char *libintl_dngettext (const char *__domainname, const char *__msgid1,
 
203
                                const char *__msgid2, unsigned long int __n)
 
204
       _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
 
205
static inline char *dngettext (const char *__domainname, const char *__msgid1,
 
206
                               const char *__msgid2, unsigned long int __n)
 
207
{
 
208
  return libintl_dngettext (__domainname, __msgid1, __msgid2, __n);
 
209
}
 
210
#else
 
211
#ifdef _INTL_REDIRECT_MACROS
 
212
# define dngettext libintl_dngettext
 
213
#endif
 
214
extern char *dngettext (const char *__domainname,
 
215
                        const char *__msgid1, const char *__msgid2,
 
216
                        unsigned long int __n)
 
217
       _INTL_ASM (libintl_dngettext)
 
218
       _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
 
219
#endif
 
220
 
 
221
/* Similar to `dcgettext' but select the plural form corresponding to the
 
222
   number N.  */
 
223
#ifdef _INTL_REDIRECT_INLINE
 
224
extern char *libintl_dcngettext (const char *__domainname,
 
225
                                 const char *__msgid1, const char *__msgid2,
 
226
                                 unsigned long int __n, int __category)
 
227
       _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
 
228
static inline char *dcngettext (const char *__domainname,
 
229
                                const char *__msgid1, const char *__msgid2,
 
230
                                unsigned long int __n, int __category)
 
231
{
 
232
  return libintl_dcngettext (__domainname, __msgid1, __msgid2, __n, __category);
 
233
}
 
234
#else
 
235
#ifdef _INTL_REDIRECT_MACROS
 
236
# define dcngettext libintl_dcngettext
 
237
#endif
 
238
extern char *dcngettext (const char *__domainname,
 
239
                         const char *__msgid1, const char *__msgid2,
 
240
                         unsigned long int __n, int __category)
 
241
       _INTL_ASM (libintl_dcngettext)
 
242
       _INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
 
243
#endif
 
244
 
 
245
 
 
246
#ifndef IN_LIBGLOCALE
 
247
 
 
248
/* Set the current default message catalog to DOMAINNAME.
 
249
   If DOMAINNAME is null, return the current default.
 
250
   If DOMAINNAME is "", reset to the default of "messages".  */
 
251
#ifdef _INTL_REDIRECT_INLINE
 
252
extern char *libintl_textdomain (const char *__domainname);
 
253
static inline char *textdomain (const char *__domainname)
 
254
{
 
255
  return libintl_textdomain (__domainname);
 
256
}
 
257
#else
 
258
#ifdef _INTL_REDIRECT_MACROS
 
259
# define textdomain libintl_textdomain
 
260
#endif
 
261
extern char *textdomain (const char *__domainname)
 
262
       _INTL_ASM (libintl_textdomain);
 
263
#endif
 
264
 
 
265
/* Specify that the DOMAINNAME message catalog will be found
 
266
   in DIRNAME rather than in the system locale data base.  */
 
267
#ifdef _INTL_REDIRECT_INLINE
 
268
extern char *libintl_bindtextdomain (const char *__domainname,
 
269
                                     const char *__dirname);
 
270
static inline char *bindtextdomain (const char *__domainname,
 
271
                                    const char *__dirname)
 
272
{
 
273
  return libintl_bindtextdomain (__domainname, __dirname);
 
274
}
 
275
#else
 
276
#ifdef _INTL_REDIRECT_MACROS
 
277
# define bindtextdomain libintl_bindtextdomain
 
278
#endif
 
279
extern char *bindtextdomain (const char *__domainname, const char *__dirname)
 
280
       _INTL_ASM (libintl_bindtextdomain);
 
281
#endif
 
282
 
 
283
/* Specify the character encoding in which the messages from the
 
284
   DOMAINNAME message catalog will be returned.  */
 
285
#ifdef _INTL_REDIRECT_INLINE
 
286
extern char *libintl_bind_textdomain_codeset (const char *__domainname,
 
287
                                              const char *__codeset);
 
288
static inline char *bind_textdomain_codeset (const char *__domainname,
 
289
                                             const char *__codeset)
 
290
{
 
291
  return libintl_bind_textdomain_codeset (__domainname, __codeset);
 
292
}
 
293
#else
 
294
#ifdef _INTL_REDIRECT_MACROS
 
295
# define bind_textdomain_codeset libintl_bind_textdomain_codeset
 
296
#endif
 
297
extern char *bind_textdomain_codeset (const char *__domainname,
 
298
                                      const char *__codeset)
 
299
       _INTL_ASM (libintl_bind_textdomain_codeset);
 
300
#endif
 
301
 
 
302
#endif /* IN_LIBGLOCALE */
 
303
 
 
304
 
 
305
/* Support for format strings with positions in *printf(), following the
 
306
   POSIX/XSI specification.
 
307
   Note: These replacements for the *printf() functions are visible only
 
308
   in source files that #include <libintl.h> or #include "gettext.h".
 
309
   Packages that use *printf() in source files that don't refer to _()
 
310
   or gettext() but for which the format string could be the return value
 
311
   of _() or gettext() need to add this #include.  Oh well.  */
 
312
 
 
313
#if !@HAVE_POSIX_PRINTF@
 
314
 
 
315
#include <stdio.h>
 
316
#include <stddef.h>
 
317
 
 
318
/* Get va_list.  */
 
319
#if __STDC__ || defined __cplusplus || defined _MSC_VER
 
320
# include <stdarg.h>
 
321
#else
 
322
# include <varargs.h>
 
323
#endif
 
324
 
 
325
#undef fprintf
 
326
#define fprintf libintl_fprintf
 
327
extern int fprintf (FILE *, const char *, ...);
 
328
#undef vfprintf
 
329
#define vfprintf libintl_vfprintf
 
330
extern int vfprintf (FILE *, const char *, va_list);
 
331
 
 
332
#undef printf
 
333
#if defined __NetBSD__ || defined __BEOS__ || defined __CYGWIN__ || defined __MINGW32__
 
334
/* Don't break __attribute__((format(printf,M,N))).
 
335
   This redefinition is only possible because the libc in NetBSD, Cygwin,
 
336
   mingw does not have a function __printf__.  */
 
337
# define libintl_printf __printf__
 
338
#endif
 
339
#define printf libintl_printf
 
340
extern int printf (const char *, ...);
 
341
#undef vprintf
 
342
#define vprintf libintl_vprintf
 
343
extern int vprintf (const char *, va_list);
 
344
 
 
345
#undef sprintf
 
346
#define sprintf libintl_sprintf
 
347
extern int sprintf (char *, const char *, ...);
 
348
#undef vsprintf
 
349
#define vsprintf libintl_vsprintf
 
350
extern int vsprintf (char *, const char *, va_list);
 
351
 
 
352
#if @HAVE_SNPRINTF@
 
353
 
 
354
#undef snprintf
 
355
#define snprintf libintl_snprintf
 
356
extern int snprintf (char *, size_t, const char *, ...);
 
357
#undef vsnprintf
 
358
#define vsnprintf libintl_vsnprintf
 
359
extern int vsnprintf (char *, size_t, const char *, va_list);
 
360
 
 
361
#endif
 
362
 
 
363
#if @HAVE_ASPRINTF@
 
364
 
 
365
#undef asprintf
 
366
#define asprintf libintl_asprintf
 
367
extern int asprintf (char **, const char *, ...);
 
368
#undef vasprintf
 
369
#define vasprintf libintl_vasprintf
 
370
extern int vasprintf (char **, const char *, va_list);
 
371
 
 
372
#endif
 
373
 
 
374
#if @HAVE_WPRINTF@
 
375
 
 
376
#undef fwprintf
 
377
#define fwprintf libintl_fwprintf
 
378
extern int fwprintf (FILE *, const wchar_t *, ...);
 
379
#undef vfwprintf
 
380
#define vfwprintf libintl_vfwprintf
 
381
extern int vfwprintf (FILE *, const wchar_t *, va_list);
 
382
 
 
383
#undef wprintf
 
384
#define wprintf libintl_wprintf
 
385
extern int wprintf (const wchar_t *, ...);
 
386
#undef vwprintf
 
387
#define vwprintf libintl_vwprintf
 
388
extern int vwprintf (const wchar_t *, va_list);
 
389
 
 
390
#undef swprintf
 
391
#define swprintf libintl_swprintf
 
392
extern int swprintf (wchar_t *, size_t, const wchar_t *, ...);
 
393
#undef vswprintf
 
394
#define vswprintf libintl_vswprintf
 
395
extern int vswprintf (wchar_t *, size_t, const wchar_t *, va_list);
 
396
 
 
397
#endif
 
398
 
 
399
#endif
 
400
 
 
401
 
 
402
/* Support for relocatable packages.  */
 
403
 
 
404
/* Sets the original and the current installation prefix of the package.
 
405
   Relocation simply replaces a pathname starting with the original prefix
 
406
   by the corresponding pathname with the current prefix instead.  Both
 
407
   prefixes should be directory names without trailing slash (i.e. use ""
 
408
   instead of "/").  */
 
409
#define libintl_set_relocation_prefix libintl_set_relocation_prefix
 
410
extern void
 
411
       libintl_set_relocation_prefix (const char *orig_prefix,
 
412
                                      const char *curr_prefix);
 
413
 
 
414
 
 
415
#ifdef __cplusplus
 
416
}
 
417
#endif
 
418
 
 
419
#endif /* libintl.h */