Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 1 | /* intl-compat.c - Stub functions to call gettext functions from GNU gettext library. */ |
Jari Aalto | b80f644 | 2004-07-27 13:29:18 +0000 | [diff] [blame] | 2 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 3 | /* Copyright (C) 1995, 2000-2003, 2005-2009 Free Software Foundation, Inc. |
Jari Aalto | b80f644 | 2004-07-27 13:29:18 +0000 | [diff] [blame] | 4 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 5 | This file is part of GNU Bash. |
| 6 | |
| 7 | Bash is free software: you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation, either version 3 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | Bash is distributed in the hope that it will be useful, |
Jari Aalto | b80f644 | 2004-07-27 13:29:18 +0000 | [diff] [blame] | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
Jari Aalto | b80f644 | 2004-07-27 13:29:18 +0000 | [diff] [blame] | 16 | |
Jari Aalto | 3185942 | 2009-01-12 13:36:28 +0000 | [diff] [blame] | 17 | You should have received a copy of the GNU General Public License |
| 18 | along with Bash. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
Jari Aalto | b80f644 | 2004-07-27 13:29:18 +0000 | [diff] [blame] | 20 | |
| 21 | #ifdef HAVE_CONFIG_H |
| 22 | # include <config.h> |
| 23 | #endif |
| 24 | |
| 25 | #include "gettextP.h" |
| 26 | |
| 27 | /* @@ end of prolog @@ */ |
| 28 | |
| 29 | /* This file redirects the gettext functions (without prefix) to those |
| 30 | defined in the included GNU libintl library (with "libintl_" prefix). |
| 31 | It is compiled into libintl in order to make the AM_GNU_GETTEXT test |
| 32 | of gettext <= 0.11.2 work with the libintl library >= 0.11.3 which |
| 33 | has the redirections primarily in the <libintl.h> include file. |
| 34 | It is also compiled into libgnuintl so that libgnuintl.so can be used |
| 35 | as LD_PRELOADable library on glibc systems, to provide the extra |
| 36 | features that the functions in the libc don't have (namely, logging). */ |
| 37 | |
| 38 | |
| 39 | #undef gettext |
| 40 | #undef dgettext |
| 41 | #undef dcgettext |
| 42 | #undef ngettext |
| 43 | #undef dngettext |
| 44 | #undef dcngettext |
| 45 | #undef textdomain |
| 46 | #undef bindtextdomain |
| 47 | #undef bind_textdomain_codeset |
| 48 | |
| 49 | |
| 50 | /* When building a DLL, we must export some functions. Note that because |
| 51 | the functions are only defined for binary backward compatibility, we |
| 52 | don't need to use __declspec(dllimport) in any case. */ |
| 53 | #if defined _MSC_VER && BUILDING_DLL |
| 54 | # define DLL_EXPORTED __declspec(dllexport) |
| 55 | #else |
| 56 | # define DLL_EXPORTED |
| 57 | #endif |
| 58 | |
| 59 | |
| 60 | DLL_EXPORTED |
| 61 | char * |
| 62 | gettext (msgid) |
| 63 | const char *msgid; |
| 64 | { |
| 65 | return libintl_gettext (msgid); |
| 66 | } |
| 67 | |
| 68 | |
| 69 | DLL_EXPORTED |
| 70 | char * |
| 71 | dgettext (domainname, msgid) |
| 72 | const char *domainname; |
| 73 | const char *msgid; |
| 74 | { |
| 75 | return libintl_dgettext (domainname, msgid); |
| 76 | } |
| 77 | |
| 78 | |
| 79 | DLL_EXPORTED |
| 80 | char * |
| 81 | dcgettext (domainname, msgid, category) |
| 82 | const char *domainname; |
| 83 | const char *msgid; |
| 84 | int category; |
| 85 | { |
| 86 | return libintl_dcgettext (domainname, msgid, category); |
| 87 | } |
| 88 | |
| 89 | |
| 90 | DLL_EXPORTED |
| 91 | char * |
| 92 | ngettext (msgid1, msgid2, n) |
| 93 | const char *msgid1; |
| 94 | const char *msgid2; |
| 95 | unsigned long int n; |
| 96 | { |
| 97 | return libintl_ngettext (msgid1, msgid2, n); |
| 98 | } |
| 99 | |
| 100 | |
| 101 | DLL_EXPORTED |
| 102 | char * |
| 103 | dngettext (domainname, msgid1, msgid2, n) |
| 104 | const char *domainname; |
| 105 | const char *msgid1; |
| 106 | const char *msgid2; |
| 107 | unsigned long int n; |
| 108 | { |
| 109 | return libintl_dngettext (domainname, msgid1, msgid2, n); |
| 110 | } |
| 111 | |
| 112 | |
| 113 | DLL_EXPORTED |
| 114 | char * |
| 115 | dcngettext (domainname, msgid1, msgid2, n, category) |
| 116 | const char *domainname; |
| 117 | const char *msgid1; |
| 118 | const char *msgid2; |
| 119 | unsigned long int n; |
| 120 | int category; |
| 121 | { |
| 122 | return libintl_dcngettext (domainname, msgid1, msgid2, n, category); |
| 123 | } |
| 124 | |
| 125 | |
| 126 | DLL_EXPORTED |
| 127 | char * |
| 128 | textdomain (domainname) |
| 129 | const char *domainname; |
| 130 | { |
| 131 | return libintl_textdomain (domainname); |
| 132 | } |
| 133 | |
| 134 | |
| 135 | DLL_EXPORTED |
| 136 | char * |
| 137 | bindtextdomain (domainname, dirname) |
| 138 | const char *domainname; |
| 139 | const char *dirname; |
| 140 | { |
| 141 | return libintl_bindtextdomain (domainname, dirname); |
| 142 | } |
| 143 | |
| 144 | |
| 145 | DLL_EXPORTED |
| 146 | char * |
| 147 | bind_textdomain_codeset (domainname, codeset) |
| 148 | const char *domainname; |
| 149 | const char *codeset; |
| 150 | { |
| 151 | return libintl_bind_textdomain_codeset (domainname, codeset); |
| 152 | } |