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