1 /* Begin of libgettext.h */
3 /* Message catalogs for internationalization.
4 Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software Foundation,
18 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
23 /* We define an additional symbol to signal that we use the GNU
24 implementation of gettext. */
25 #define __USE_GNU_GETTEXT 1
27 #include <sys/types.h>
38 # if __STDC__ || defined __cplusplus
39 # define PARAMS(args) args
41 # define PARAMS(args) ()
46 # if !defined __cplusplus || defined __GNUC__
47 # define NULL ((void *) 0)
54 /* This value determines the behaviour of the gettext() and dgettext()
55 function. But some system does not have this defined. Define it
56 to a default value. */
57 # define LC_MESSAGES (-1)
60 /* Declarations for gettext-using-catgets interface. Derived from
61 Jim Meyering's libintl.h. */
69 /* These two variables are defined in the automatically by po-to-tbl.sed
70 generated file `cat-id-tbl.c'. */
71 extern const struct _msg_ent _msg_tbl
[];
72 extern int _msg_tbl_length
;
75 /* Look up MSGID in the current default message catalog for the current
76 LC_MESSAGES locale. If not found, returns MSGID itself (the default
78 extern char *gettext
PARAMS ((const char *__msgid
));
79 /* static char *gettext__ PARAMS ((const char *__msgid)); */
81 /* Look up MSGID in the DOMAINNAME message catalog for the current
82 LC_MESSAGES locale. */
83 extern char *dgettext
PARAMS ((const char *__domainname
, const char *__msgid
));
84 /* static char *dgettext__ PARAMS ((const char *__domainname,
85 const char *__msgid)); */
87 /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
89 extern char *dcgettext
PARAMS ((const char *__domainname
, const char *__msgid
,
91 extern char *dcgettext__
PARAMS ((const char *__domainname
,
92 const char *__msgid
, int __category
));
94 /* Set the current default message catalog to DOMAINNAME.
95 If DOMAINNAME is null, return the current default.
96 If DOMAINNAME is "", reset to the default of "messages". */
97 extern char *textdomain
PARAMS ((const char *__domainname
));
98 /* static char *textdomain__ PARAMS ((const char *__domainname)); */
100 /* Specify that the DOMAINNAME message catalog will be found
101 in DIRNAME rather than in the system locale data base. */
102 extern char *bindtextdomain
PARAMS ((const char *__domainname
,
103 const char *__dirname
));
104 /* static char *bindtextdomain__ PARAMS ((const char *__domainname,
105 const char *__dirname)); */
109 /* Solaris 2.3 has the gettext function but dcgettext is missing.
110 So we omit this optimization for Solaris 2.3. BTW, Solaris 2.4
112 # if !HAVE_CATGETS && (!HAVE_GETTEXT || HAVE_DCGETTEXT)
114 # define gettext(Msgid) \
115 dgettext (NULL, Msgid)
117 # define dgettext(Domainname, Msgid) \
118 dcgettext (Domainname, Msgid, LC_MESSAGES)
120 # if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ >= 7
121 /* This global variable is defined in loadmsgcat.c. We need a sign,
122 whether a new catalog was loaded, which can be associated with all
124 extern int _nl_msg_cat_cntr
;
126 # define dcgettext(Domainname, Msgid, Category) \
130 if (__builtin_constant_p (Msgid)) \
132 static char *__translation__; \
133 static int __catalog_counter__; \
134 if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr) \
137 dcgettext__ (Domainname, Msgid, Category); \
138 __catalog_counter__ = _nl_msg_cat_cntr; \
140 __result = __translation__; \
143 __result = dcgettext__ (Domainname, Msgid, Category); \
151 # define gettext(Msgid) (Msgid)
152 # define dgettext(Domainname, Msgid) (Msgid)
153 # define dcgettext(Domainname, Msgid, Category) (Msgid)
154 # define textdomain(Domainname) ((char *) Domainname)
155 # define bindtextdomain(Domainname, Dirname) ((char *) Dirname)
163 #endif /* _GETTEXT_H */
165 /* End of libgettext.h */