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