xref: /openbsd-src/gnu/usr.bin/gcc/gcc/intl/libgnuintl.h (revision c87b03e512fc05ed6e0222f6fb0ae86264b1d05b)
1*c87b03e5Sespie /* Message catalogs for internationalization.
2*c87b03e5Sespie    Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc.
3*c87b03e5Sespie 
4*c87b03e5Sespie    This program is free software; you can redistribute it and/or modify it
5*c87b03e5Sespie    under the terms of the GNU Library General Public License as published
6*c87b03e5Sespie    by the Free Software Foundation; either version 2, or (at your option)
7*c87b03e5Sespie    any later version.
8*c87b03e5Sespie 
9*c87b03e5Sespie    This program is distributed in the hope that it will be useful,
10*c87b03e5Sespie    but WITHOUT ANY WARRANTY; without even the implied warranty of
11*c87b03e5Sespie    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12*c87b03e5Sespie    Library General Public License for more details.
13*c87b03e5Sespie 
14*c87b03e5Sespie    You should have received a copy of the GNU Library General Public
15*c87b03e5Sespie    License along with this program; if not, write to the Free Software
16*c87b03e5Sespie    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17*c87b03e5Sespie    USA.  */
18*c87b03e5Sespie 
19*c87b03e5Sespie #ifndef _LIBINTL_H
20*c87b03e5Sespie #define _LIBINTL_H	1
21*c87b03e5Sespie 
22*c87b03e5Sespie #include <locale.h>
23*c87b03e5Sespie 
24*c87b03e5Sespie /* The LC_MESSAGES locale category is the category used by the functions
25*c87b03e5Sespie    gettext() and dgettext().  It is specified in POSIX, but not in ANSI C.
26*c87b03e5Sespie    On systems that don't define it, use an arbitrary value instead.
27*c87b03e5Sespie    On Solaris, <locale.h> defines __LOCALE_H then includes <libintl.h> (i.e.
28*c87b03e5Sespie    this file!) and then only defines LC_MESSAGES.  To avoid a redefinition
29*c87b03e5Sespie    warning, don't define LC_MESSAGES in this case.  */
30*c87b03e5Sespie #if !defined LC_MESSAGES && !defined __LOCALE_H
31*c87b03e5Sespie # define LC_MESSAGES 1729
32*c87b03e5Sespie #endif
33*c87b03e5Sespie 
34*c87b03e5Sespie /* We define an additional symbol to signal that we use the GNU
35*c87b03e5Sespie    implementation of gettext.  */
36*c87b03e5Sespie #define __USE_GNU_GETTEXT 1
37*c87b03e5Sespie 
38*c87b03e5Sespie /* Resolve a platform specific conflict on DJGPP.  GNU gettext takes
39*c87b03e5Sespie    precedence over _conio_gettext.  */
40*c87b03e5Sespie #ifdef __DJGPP__
41*c87b03e5Sespie # undef gettext
42*c87b03e5Sespie # define gettext gettext
43*c87b03e5Sespie #endif
44*c87b03e5Sespie 
45*c87b03e5Sespie #ifndef PARAMS
46*c87b03e5Sespie # if __STDC__ || defined __cplusplus
47*c87b03e5Sespie #  define PARAMS(args) args
48*c87b03e5Sespie # else
49*c87b03e5Sespie #  define PARAMS(args) ()
50*c87b03e5Sespie # endif
51*c87b03e5Sespie #endif
52*c87b03e5Sespie 
53*c87b03e5Sespie #ifdef __cplusplus
54*c87b03e5Sespie extern "C" {
55*c87b03e5Sespie #endif
56*c87b03e5Sespie 
57*c87b03e5Sespie /* Look up MSGID in the current default message catalog for the current
58*c87b03e5Sespie    LC_MESSAGES locale.  If not found, returns MSGID itself (the default
59*c87b03e5Sespie    text).  */
60*c87b03e5Sespie extern char *gettext PARAMS ((const char *__msgid));
61*c87b03e5Sespie 
62*c87b03e5Sespie /* Look up MSGID in the DOMAINNAME message catalog for the current
63*c87b03e5Sespie    LC_MESSAGES locale.  */
64*c87b03e5Sespie extern char *dgettext PARAMS ((const char *__domainname, const char *__msgid));
65*c87b03e5Sespie 
66*c87b03e5Sespie /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
67*c87b03e5Sespie    locale.  */
68*c87b03e5Sespie extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid,
69*c87b03e5Sespie 				int __category));
70*c87b03e5Sespie 
71*c87b03e5Sespie 
72*c87b03e5Sespie /* Similar to `gettext' but select the plural form corresponding to the
73*c87b03e5Sespie    number N.  */
74*c87b03e5Sespie extern char *ngettext PARAMS ((const char *__msgid1, const char *__msgid2,
75*c87b03e5Sespie 			       unsigned long int __n));
76*c87b03e5Sespie 
77*c87b03e5Sespie /* Similar to `dgettext' but select the plural form corresponding to the
78*c87b03e5Sespie    number N.  */
79*c87b03e5Sespie extern char *dngettext PARAMS ((const char *__domainname, const char *__msgid1,
80*c87b03e5Sespie 				const char *__msgid2, unsigned long int __n));
81*c87b03e5Sespie 
82*c87b03e5Sespie /* Similar to `dcgettext' but select the plural form corresponding to the
83*c87b03e5Sespie    number N.  */
84*c87b03e5Sespie extern char *dcngettext PARAMS ((const char *__domainname, const char *__msgid1,
85*c87b03e5Sespie 				 const char *__msgid2, unsigned long int __n,
86*c87b03e5Sespie 				 int __category));
87*c87b03e5Sespie 
88*c87b03e5Sespie 
89*c87b03e5Sespie /* Set the current default message catalog to DOMAINNAME.
90*c87b03e5Sespie    If DOMAINNAME is null, return the current default.
91*c87b03e5Sespie    If DOMAINNAME is "", reset to the default of "messages".  */
92*c87b03e5Sespie extern char *textdomain PARAMS ((const char *__domainname));
93*c87b03e5Sespie 
94*c87b03e5Sespie /* Specify that the DOMAINNAME message catalog will be found
95*c87b03e5Sespie    in DIRNAME rather than in the system locale data base.  */
96*c87b03e5Sespie extern char *bindtextdomain PARAMS ((const char *__domainname,
97*c87b03e5Sespie 				     const char *__dirname));
98*c87b03e5Sespie 
99*c87b03e5Sespie /* Specify the character encoding in which the messages from the
100*c87b03e5Sespie    DOMAINNAME message catalog will be returned.  */
101*c87b03e5Sespie extern char *bind_textdomain_codeset PARAMS ((const char *__domainname,
102*c87b03e5Sespie 					      const char *__codeset));
103*c87b03e5Sespie 
104*c87b03e5Sespie 
105*c87b03e5Sespie /* Optimized version of the functions above.  */
106*c87b03e5Sespie #if defined __OPTIMIZED
107*c87b03e5Sespie /* These are macros, but could also be inline functions.  */
108*c87b03e5Sespie 
109*c87b03e5Sespie # define gettext(msgid)							      \
110*c87b03e5Sespie   dgettext (NULL, msgid)
111*c87b03e5Sespie 
112*c87b03e5Sespie # define dgettext(domainname, msgid)					      \
113*c87b03e5Sespie   dcgettext (domainname, msgid, LC_MESSAGES)
114*c87b03e5Sespie 
115*c87b03e5Sespie # define ngettext(msgid1, msgid2, n)					      \
116*c87b03e5Sespie   dngettext (NULL, msgid1, msgid2, n)
117*c87b03e5Sespie 
118*c87b03e5Sespie # define dngettext(domainname, msgid1, msgid2, n)			      \
119*c87b03e5Sespie   dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES)
120*c87b03e5Sespie 
121*c87b03e5Sespie #endif /* Optimizing. */
122*c87b03e5Sespie 
123*c87b03e5Sespie 
124*c87b03e5Sespie #ifdef __cplusplus
125*c87b03e5Sespie }
126*c87b03e5Sespie #endif
127*c87b03e5Sespie 
128*c87b03e5Sespie #endif /* libintl.h */
129