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