lilypond-1.3.25
[lilypond.git] / intl / libintl.h
blob4b91230f8844f2a66fae9d790ae97cb72866dca7
1 /* libintl.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 #ifndef _LIBINTL_H
19 #define _LIBINTL_H 1
21 #ifdef HAVE_LOCALE_H
22 # include <locale.h>
23 #endif
25 /* We define an additional symbol to signal that we use the GNU
26 implementation of gettext. */
27 #define __USE_GNU_GETTEXT 1
29 #ifndef __P
30 # if __STDC__
31 # define __P(args) args
32 # else
33 # define __P(args) ()
34 # endif
35 #endif
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
41 /* Look up MSGID in the current default message catalog for the current
42 LC_MESSAGES locale. If not found, returns MSGID itself (the default
43 text). */
44 extern char *gettext __P ((const char *__msgid));
46 /* Look up MSGID in the DOMAINNAME message catalog for the current
47 LC_MESSAGES locale. */
48 extern char *dgettext __P ((const char *__domainname, const char *__msgid));
50 /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
51 locale. */
52 extern char *dcgettext __P ((const char *__domainname, const char *__msgid,
53 int __category));
56 /* Set the current default message catalog to DOMAINNAME.
57 If DOMAINNAME is null, return the current default.
58 If DOMAINNAME is "", reset to the default of "messages". */
59 extern char *textdomain __P ((const char *__domainname));
61 /* Specify that the DOMAINNAME message catalog will be found
62 in DIRNAME rather than in the system locale data base. */
63 extern char *bindtextdomain __P ((const char *__domainname,
64 const char *__dirname));
67 /* Optimized version of the functions above. */
68 #if defined __OPTIMIZED
69 /* These must be a macro. Inlined functions are useless because the
70 `__builtin_constant_p' predicate in dcgettext would always return
71 false. */
73 # define gettext(msgid) dgettext ((char *) 0, msgid)
75 # define dgettext(domainname, msgid) \
76 dcgettext (domainname, msgid, LC_MESSAGES)
78 # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
79 # define dcgettext(domainname, msgid, category) \
80 (__extension__ \
81 ({ \
82 char *result; \
83 if (__builtin_constant_p (msgid)) \
84 { \
85 extern int _nl_msg_cat_cntr; \
86 static char *__translation__; \
87 static int __catalog_counter__; \
88 if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr) \
89 { \
90 __translation__ = \
91 (dcgettext) ((domainname), (msgid), (category)); \
92 __catalog_counter__ = _nl_msg_cat_cntr; \
93 } \
94 result = __translation__; \
95 } \
96 else \
97 result = (dcgettext) ((domainname), (msgid), (category)); \
98 result; \
99 }))
100 # endif
101 #endif /* Optimizing. */
104 #ifdef __cplusplus
106 #endif
108 #endif /* libintl.h */