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