Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-runtime / intl / intl-compat.c
1 /* intl-compat.c - Stub functions to call gettext functions from GNU gettext
2    Library.
3    Copyright (C) 1995, 2000-2003, 2005, 2015 Free Software Foundation,
4    Inc.
5
6    This program is free software: you can redistribute it and/or modify
7    it under the terms of the GNU Lesser General Public License as published by
8    the Free Software Foundation; either version 2.1 of the License, or
9    (at your option) any later version.
10
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
14    GNU Lesser General Public License for more details.
15
16    You should have received a copy of the GNU Lesser General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
18
19 #ifdef HAVE_CONFIG_H
20 # include <config.h>
21 #endif
22
23 #include "gettextP.h"
24
25 /* @@ end of prolog @@ */
26
27 /* This file redirects the gettext functions (without prefix) to those
28    defined in the included GNU libintl library (with "libintl_" prefix).
29    It is compiled into libintl in order to make the AM_GNU_GETTEXT test
30    of gettext <= 0.11.2 work with the libintl library >= 0.11.3 which
31    has the redirections primarily in the <libintl.h> include file.
32    It is also compiled into libgnuintl so that libgnuintl.so can be used
33    as LD_PRELOADable library on glibc systems, to provide the extra
34    features that the functions in the libc don't have (namely, logging).  */
35
36
37 #undef gettext
38 #undef dgettext
39 #undef dcgettext
40 #undef ngettext
41 #undef dngettext
42 #undef dcngettext
43 #undef textdomain
44 #undef bindtextdomain
45 #undef bind_textdomain_codeset
46
47
48 /* When building a DLL, we must export some functions.  Note that because
49    the functions are only defined for binary backward compatibility, we
50    don't need to use __declspec(dllimport) in any case.  */
51 #if HAVE_VISIBILITY && BUILDING_DLL
52 # define DLL_EXPORTED __attribute__((__visibility__("default")))
53 #elif 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 (const char *msgid)
63 {
64   return libintl_gettext (msgid);
65 }
66
67
68 DLL_EXPORTED
69 char *
70 dgettext (const char *domainname, const char *msgid)
71 {
72   return libintl_dgettext (domainname, msgid);
73 }
74
75
76 DLL_EXPORTED
77 char *
78 dcgettext (const char *domainname, const char *msgid, int category)
79 {
80   return libintl_dcgettext (domainname, msgid, category);
81 }
82
83
84 DLL_EXPORTED
85 char *
86 ngettext (const char *msgid1, const char *msgid2, unsigned long int n)
87 {
88   return libintl_ngettext (msgid1, msgid2, n);
89 }
90
91
92 DLL_EXPORTED
93 char *
94 dngettext (const char *domainname,
95            const char *msgid1, const char *msgid2, unsigned long int n)
96 {
97   return libintl_dngettext (domainname, msgid1, msgid2, n);
98 }
99
100
101 DLL_EXPORTED
102 char *
103 dcngettext (const char *domainname,
104             const char *msgid1, const char *msgid2, unsigned long int n,
105             int category)
106 {
107   return libintl_dcngettext (domainname, msgid1, msgid2, n, category);
108 }
109
110
111 DLL_EXPORTED
112 char *
113 textdomain (const char *domainname)
114 {
115   return libintl_textdomain (domainname);
116 }
117
118
119 DLL_EXPORTED
120 char *
121 bindtextdomain (const char *domainname, const char *dirname)
122 {
123   return libintl_bindtextdomain (domainname, dirname);
124 }
125
126
127 DLL_EXPORTED
128 char *
129 bind_textdomain_codeset (const char *domainname, const char *codeset)
130 {
131   return libintl_bind_textdomain_codeset (domainname, codeset);
132 }