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