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