lilypond-1.3.25
[lilypond.git] / intl / libgettext.h
blob4570cdf4b50baf4c5145325023d2c18ffd53b166
1 /* libgettext.h -- Message catalogs for internationalization.
2 Copyright (C) 1995 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18 /* Because on some systems (e.g. Solaris) we sometimes have to include
19 the systems libintl.h as well as this file we have more complex
20 include protection above. But the systems header might perhaps also
21 define _LIBINTL_H and therefore we have to protect the definition here. */
23 #if !defined (_LIBINTL_H) || !defined (_LIBGETTEXT_H)
24 #if !_LIBINTL_H
25 # define _LIBINTL_H 1
26 #endif
27 #define _LIBGETTEXT_H 1
29 /* We define an additional symbol to signal that we use the GNU
30 implementation of gettext. */
31 #define __USE_GNU_GETTEXT 1
33 #include <sys/types.h>
35 #if HAVE_LOCALE_H
36 # include <locale.h>
37 #endif
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
44 /* @@ end of prolog @@ */
46 #ifndef __P
47 # if __STDC__
48 # define __P(args) args
49 # else
50 # define __P(args) ()
51 # endif
52 #endif
54 #ifndef NULL
55 # if !defined __cplusplus || defined __GNUC__
56 # define NULL ((void *) 0)
57 # else
58 # define NULL (0)
59 # endif
60 #endif
62 #if !HAVE_LC_MESSAGES
63 /* This value determines the behaviour of the gettext() and dgettext()
64 function. But some system does not have this defined. Define it
65 to a default value. */
66 # define LC_MESSAGES (-1)
67 #endif
70 /* Declarations for gettext-using-catgets interface. Derived from
71 Jim Meyering's libintl.h. */
72 struct _msg_ent
74 const char *_msg;
75 int _msg_number;
79 #if HAVE_CATGETS
80 /* These two variables are defined in the automatically by po-to-tbl.sed
81 generated file `cat-id-tbl.c'. */
82 extern const struct _msg_ent _msg_tbl[];
83 extern int _msg_tbl_length;
84 #endif
87 /* For automatical extraction of messages sometimes no real
88 translation is needed. Instead the string itself is the result. */
89 #define gettext_noop(Str) (Str)
91 /* Look up MSGID in the current default message catalog for the current
92 LC_MESSAGES locale. If not found, returns MSGID itself (the default
93 text). */
94 extern char *gettext __P ((const char *__msgid));
95 extern char *gettext__ __P ((const char *__msgid));
97 /* Look up MSGID in the DOMAINNAME message catalog for the current
98 LC_MESSAGES locale. */
99 extern char *dgettext __P ((const char *__domainname, const char *__msgid));
100 extern char *dgettext__ __P ((const char *__domainname, const char *__msgid));
102 /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
103 locale. */
104 extern char *dcgettext __P ((const char *__domainname, const char *__msgid,
105 int __category));
106 extern char *dcgettext__ __P ((const char *__domainname, const char *__msgid,
107 int __category));
110 /* Set the current default message catalog to DOMAINNAME.
111 If DOMAINNAME is null, return the current default.
112 If DOMAINNAME is "", reset to the default of "messages". */
113 extern char *textdomain __P ((const char *__domainname));
114 extern char *textdomain__ __P ((const char *__domainname));
116 /* Specify that the DOMAINNAME message catalog will be found
117 in DIRNAME rather than in the system locale data base. */
118 extern char *bindtextdomain __P ((const char *__domainname,
119 const char *__dirname));
120 extern char *bindtextdomain__ __P ((const char *__domainname,
121 const char *__dirname));
123 #if ENABLE_NLS
125 /* Solaris 2.3 has the gettext function but dcgettext is missing.
126 So we omit this optimization for Solaris 2.3. BTW, Solaris 2.4
127 has dcgettext. */
128 # if !HAVE_CATGETS && (!HAVE_GETTEXT || HAVE_DCGETTEXT)
130 # define gettext(Msgid) \
131 dgettext (NULL, Msgid)
133 # define dgettext(Domainname, Msgid) \
134 dcgettext (Domainname, Msgid, LC_MESSAGES)
136 # if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ >= 7
137 # define dcgettext(Domainname, Msgid, Category) \
138 (__extension__ \
139 ({ \
140 char *result; \
141 if (__builtin_constant_p (Msgid)) \
143 extern int _nl_msg_cat_cntr; \
144 static char *__translation__; \
145 static int __catalog_counter__; \
146 if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr) \
148 __translation__ = \
149 dcgettext__ ((Domainname), (Msgid), (Category)); \
150 __catalog_counter__ = _nl_msg_cat_cntr; \
152 result = __translation__; \
154 else \
155 result = dcgettext__ ((Domainname), (Msgid), (Category)); \
156 result; \
158 # endif
159 # endif
161 #else
163 # define gettext(Msgid) (Msgid)
164 # define dgettext(Domainname, Msgid) (Msgid)
165 # define dcgettext(Domainname, Msgid, Category) (Msgid)
166 # define textdomain(Domainname) while (0) /* nothing */
167 # define bindtextdomain(Domainname, Dirname) while (0) /* nothing */
169 #endif
171 /* @@ begin of epilog @@ */
173 #ifdef __cplusplus
175 #endif
177 #endif