| 1 | /* libgettext.h -- Message catalogs for internationalization. | 
|---|
| 2 | Copyright (C) 1995 Free Software Foundation, Inc. | 
|---|
| 3 | This file is part of the GNU C Library. | 
|---|
| 4 | Contributed by Ulrich Drepper. | 
|---|
| 5 | This file is derived from the file libgettext.h in the GNU gettext package. | 
|---|
| 6 |  | 
|---|
| 7 | The GNU C Library is free software; you can redistribute it and/or | 
|---|
| 8 | modify it under the terms of the GNU Library General Public License as | 
|---|
| 9 | published by the Free Software Foundation; either version 2 of the | 
|---|
| 10 | License, or (at your option) any later version. | 
|---|
| 11 |  | 
|---|
| 12 | The GNU C Library is distributed in the hope that it will be useful, | 
|---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
|---|
| 15 | Library General Public License for more details. | 
|---|
| 16 |  | 
|---|
| 17 | You should have received a copy of the GNU Library General Public | 
|---|
| 18 | License along with the GNU C Library; see the file COPYING.LIB.  If | 
|---|
| 19 | not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 
|---|
| 20 | Boston, MA 02111-1307, USA.  */ | 
|---|
| 21 |  | 
|---|
| 22 | #ifndef _LIBINTL_H | 
|---|
| 23 | #define _LIBINTL_H      1 | 
|---|
| 24 | #include <features.h> | 
|---|
| 25 |  | 
|---|
| 26 | #include <locale.h> | 
|---|
| 27 |  | 
|---|
| 28 | #define __need_NULL | 
|---|
| 29 | #include <stddef.h> | 
|---|
| 30 |  | 
|---|
| 31 | /* We define an additional symbol to signal that we use the GNU | 
|---|
| 32 | implementation of gettext.  */ | 
|---|
| 33 | #define __USE_GNU_GETTEXT 1 | 
|---|
| 34 |  | 
|---|
| 35 | __BEGIN_DECLS | 
|---|
| 36 |  | 
|---|
| 37 | /* Look up MSGID in the current default message catalog for the current | 
|---|
| 38 | LC_MESSAGES locale.  If not found, returns MSGID itself (the default | 
|---|
| 39 | text).  */ | 
|---|
| 40 | extern char *gettext __P ((__const char *__msgid)); | 
|---|
| 41 | extern char *__gettext __P ((__const char *__msgid)); | 
|---|
| 42 |  | 
|---|
| 43 | /* Look up MSGID in the DOMAINNAME message catalog for the current | 
|---|
| 44 | LC_MESSAGES locale.  */ | 
|---|
| 45 | extern char *dgettext __P ((__const char *__domainname, | 
|---|
| 46 | __const char *__msgid)); | 
|---|
| 47 | extern char *__dgettext __P ((__const char *__domainname, | 
|---|
| 48 | __const char *__msgid)); | 
|---|
| 49 |  | 
|---|
| 50 | /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY | 
|---|
| 51 | locale.  */ | 
|---|
| 52 | extern char *dcgettext __P ((__const char *__domainname, | 
|---|
| 53 | __const char *__msgid, int __category)); | 
|---|
| 54 | extern char *__dcgettext __P ((__const char *__domainname, | 
|---|
| 55 | __const char *__msgid, int __category)); | 
|---|
| 56 |  | 
|---|
| 57 |  | 
|---|
| 58 | /* Set the current default message catalog to DOMAINNAME. | 
|---|
| 59 | If DOMAINNAME is null, return the current default. | 
|---|
| 60 | If DOMAINNAME is "", reset to the default of "messages".  */ | 
|---|
| 61 | extern char *textdomain __P ((__const char *__domainname)); | 
|---|
| 62 | extern char *__textdomain __P ((__const char *__domainname)); | 
|---|
| 63 |  | 
|---|
| 64 | /* Specify that the DOMAINNAME message catalog will be found | 
|---|
| 65 | in DIRNAME rather than in the system locale data base.  */ | 
|---|
| 66 | extern char *bindtextdomain __P ((__const char *__domainname, | 
|---|
| 67 | __const char *__dirname)); | 
|---|
| 68 | extern char *__bindtextdomain __P ((__const char *__domainname, | 
|---|
| 69 | __const char *__dirname)); | 
|---|
| 70 |  | 
|---|
| 71 |  | 
|---|
| 72 | /* Optimized version of the function above.  */ | 
|---|
| 73 | #if defined __OPTIMIZED | 
|---|
| 74 | /* These must be a macro.  Inlined functions are useless because the | 
|---|
| 75 | `__builtin_constant_p' predicate in dcgettext would always return | 
|---|
| 76 | false.  */ | 
|---|
| 77 |  | 
|---|
| 78 | # define gettext(msgid) dgettext (NULL, msgid) | 
|---|
| 79 |  | 
|---|
| 80 | # define dgettext(domainname, msgid)                                          \ | 
|---|
| 81 | dcgettext (domainname, msgid, LC_MESSAGES) | 
|---|
| 82 |  | 
|---|
| 83 | # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) | 
|---|
| 84 | #  define dcgettext(domainname, msgid, category)                              \ | 
|---|
| 85 | (__extension__                                                              \ | 
|---|
| 86 | ({                                                                         \ | 
|---|
| 87 | char *result;                                                            \ | 
|---|
| 88 | if (__builtin_constant_p (msgid))                                        \ | 
|---|
| 89 | {                                                                      \ | 
|---|
| 90 | extern int _nl_msg_cat_cntr;                                         \ | 
|---|
| 91 | static char *__translation__;                                        \ | 
|---|
| 92 | static int __catalog_counter__;                                      \ | 
|---|
| 93 | if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr)    \ | 
|---|
| 94 | {                                                                  \ | 
|---|
| 95 | __translation__ =                                                \ | 
|---|
| 96 | __dcgettext ((domainname), (msgid), (category));               \ | 
|---|
| 97 | __catalog_counter__ = _nl_msg_cat_cntr;                          \ | 
|---|
| 98 | }                                                                  \ | 
|---|
| 99 | result = __translation__;                                            \ | 
|---|
| 100 | }                                                                      \ | 
|---|
| 101 | else                                                                     \ | 
|---|
| 102 | result = __dcgettext ((domainname), (msgid), (category));              \ | 
|---|
| 103 | result;                                                                  \ | 
|---|
| 104 | })) | 
|---|
| 105 | # endif | 
|---|
| 106 | #endif /* Optimizing. */ | 
|---|
| 107 |  | 
|---|
| 108 |  | 
|---|
| 109 | __END_DECLS | 
|---|
| 110 |  | 
|---|
| 111 | #endif /* libintl.h */ | 
|---|