arm: use common ret_ERRVAL
[uclibc-ng.git] / include / libintl.h
blob0cbf758ed95e2e7a7d6f3d6dc0a8c907f143a9d2
1 /* Message catalogs for internationalization.
2 Copyright (C) 1995-2002, 2004, 2005 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 This file is derived from the file libgettext.h in the GNU gettext package.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library 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 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef _LIBINTL_H
21 #define _LIBINTL_H 1
23 #include <features.h>
25 #ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
27 /* We define an additional symbol to signal that we use the GNU
28 implementation of gettext. */
29 #define __USE_GNU_GETTEXT 1
31 /* Provide information about the supported file formats. Returns the
32 maximum minor revision number supported for a given major revision. */
33 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) \
34 ((major) == 0 ? 1 : -1)
36 __BEGIN_DECLS
38 /* Look up MSGID in the current default message catalog for the current
39 LC_MESSAGES locale. If not found, returns MSGID itself (the default
40 text). */
41 extern char *gettext (const char *__msgid)
42 __THROW __attribute_format_arg__ (1);
44 /* Look up MSGID in the DOMAINNAME message catalog for the current
45 LC_MESSAGES locale. */
46 extern char *dgettext (const char *__domainname, const char *__msgid)
47 __THROW __attribute_format_arg__ (2);
48 #if 0 /* uClibc: disabled */
49 extern char *__dgettext (const char *__domainname, const char *__msgid)
50 __THROW __attribute_format_arg__ (2);
51 #endif
53 /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
54 locale. */
55 extern char *dcgettext (const char *__domainname,
56 const char *__msgid, int __category)
57 __THROW __attribute_format_arg__ (2);
58 #if 0 /* uClibc: disabled */
59 extern char *__dcgettext (const char *__domainname,
60 const char *__msgid, int __category)
61 __THROW __attribute_format_arg__ (2);
62 #endif
65 /* Similar to `gettext' but select the plural form corresponding to the
66 number N. */
67 extern char *ngettext (const char *__msgid1, const char *__msgid2,
68 unsigned long int __n)
69 __THROW __attribute_format_arg__ (1) __attribute_format_arg__ (2);
71 /* Similar to `dgettext' but select the plural form corresponding to the
72 number N. */
73 extern char *dngettext (const char *__domainname, const char *__msgid1,
74 const char *__msgid2, unsigned long int __n)
75 __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3);
77 /* Similar to `dcgettext' but select the plural form corresponding to the
78 number N. */
79 extern char *dcngettext (const char *__domainname, const char *__msgid1,
80 const char *__msgid2, unsigned long int __n,
81 int __category)
82 __THROW __attribute_format_arg__ (2) __attribute_format_arg__ (3);
85 /* Set the current default message catalog to DOMAINNAME.
86 If DOMAINNAME is null, return the current default.
87 If DOMAINNAME is "", reset to the default of "messages". */
88 extern char *textdomain (const char *__domainname) __THROW;
90 /* Specify that the DOMAINNAME message catalog will be found
91 in DIRNAME rather than in the system locale data base. */
92 extern char *bindtextdomain (const char *__domainname,
93 const char *__dirname) __THROW;
95 /* Specify the character encoding in which the messages from the
96 DOMAINNAME message catalog will be returned. */
97 extern char *bind_textdomain_codeset (const char *__domainname,
98 const char *__codeset) __THROW;
101 /* Optimized version of the function above. */
102 #if defined __OPTIMIZE__ && !defined __cplusplus
104 /* We need NULL for `gettext'. */
105 # define __need_NULL
106 # include <stddef.h>
108 /* We need LC_MESSAGES for `dgettext'. */
109 # include <locale.h>
111 /* These must be macros. Inlined functions are useless because the
112 `__builtin_constant_p' predicate in dcgettext would always return
113 false. */
115 # define gettext(msgid) dgettext (NULL, msgid)
117 # define dgettext(domainname, msgid) \
118 dcgettext (domainname, msgid, LC_MESSAGES)
120 # define ngettext(msgid1, msgid2, n) dngettext (NULL, msgid1, msgid2, n)
122 # define dngettext(domainname, msgid1, msgid2, n) \
123 dcngettext (domainname, msgid1, msgid2, n, LC_MESSAGES)
125 #endif /* Optimizing. */
127 __END_DECLS
129 #else
131 #define gettext(msgid) ((const char *) (msgid))
133 #endif /* __UCLIBC_HAS_GETTEXT_AWARENESS__ */
135 #ifdef _LIBC
136 # define _(x) gettext(x)
137 # define N_(x) x
138 #endif
140 #endif /* libintl.h */