xref: /openbsd-src/gnu/usr.bin/texinfo/intl/intl-compat.c (revision a1acfa9b69ad64eb720639240c8438f11107dc85)
1840175f0Skstailey /* intl-compat.c - Stub functions to call gettext functions from GNU gettext
2840175f0Skstailey    Library.
3*a1acfa9bSespie    Copyright (C) 1995, 2000-2003 Software Foundation, Inc.
4840175f0Skstailey 
53fb98d4aSespie    This program is free software; you can redistribute it and/or modify it
63fb98d4aSespie    under the terms of the GNU Library General Public License as published
73fb98d4aSespie    by the Free Software Foundation; either version 2, or (at your option)
8840175f0Skstailey    any later version.
9840175f0Skstailey 
10840175f0Skstailey    This program is distributed in the hope that it will be useful,
11840175f0Skstailey    but WITHOUT ANY WARRANTY; without even the implied warranty of
123fb98d4aSespie    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
133fb98d4aSespie    Library General Public License for more details.
14840175f0Skstailey 
153fb98d4aSespie    You should have received a copy of the GNU Library General Public
163fb98d4aSespie    License along with this program; if not, write to the Free Software
173fb98d4aSespie    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
183fb98d4aSespie    USA.  */
19840175f0Skstailey 
20840175f0Skstailey #ifdef HAVE_CONFIG_H
21840175f0Skstailey # include <config.h>
22840175f0Skstailey #endif
23840175f0Skstailey 
243fb98d4aSespie #include "gettextP.h"
25840175f0Skstailey 
26840175f0Skstailey /* @@ end of prolog @@ */
27840175f0Skstailey 
28*a1acfa9bSespie /* This file redirects the gettext functions (without prefix) to those
29*a1acfa9bSespie    defined in the included GNU libintl library (with "libintl_" prefix).
30*a1acfa9bSespie    It is compiled into libintl in order to make the AM_GNU_GETTEXT test
31*a1acfa9bSespie    of gettext <= 0.11.2 work with the libintl library >= 0.11.3 which
32*a1acfa9bSespie    has the redirections primarily in the <libintl.h> include file.
33*a1acfa9bSespie    It is also compiled into libgnuintl so that libgnuintl.so can be used
34*a1acfa9bSespie    as LD_PRELOADable library on glibc systems, to provide the extra
35*a1acfa9bSespie    features that the functions in the libc don't have (namely, logging).  */
363fb98d4aSespie 
37840175f0Skstailey 
38840175f0Skstailey #undef gettext
39840175f0Skstailey #undef dgettext
40840175f0Skstailey #undef dcgettext
413fb98d4aSespie #undef ngettext
423fb98d4aSespie #undef dngettext
433fb98d4aSespie #undef dcngettext
44840175f0Skstailey #undef textdomain
45840175f0Skstailey #undef bindtextdomain
463fb98d4aSespie #undef bind_textdomain_codeset
47840175f0Skstailey 
48840175f0Skstailey 
49*a1acfa9bSespie /* When building a DLL, we must export some functions.  Note that because
50*a1acfa9bSespie    the functions are only defined for binary backward compatibility, we
51*a1acfa9bSespie    don't need to use __declspec(dllimport) in any case.  */
52*a1acfa9bSespie #if defined _MSC_VER && BUILDING_DLL
53*a1acfa9bSespie # define DLL_EXPORTED __declspec(dllexport)
54*a1acfa9bSespie #else
55*a1acfa9bSespie # define DLL_EXPORTED
56*a1acfa9bSespie #endif
57*a1acfa9bSespie 
58*a1acfa9bSespie 
59*a1acfa9bSespie DLL_EXPORTED
60840175f0Skstailey char *
gettext(const char * msgid)61*a1acfa9bSespie gettext (const char *msgid)
62840175f0Skstailey {
63*a1acfa9bSespie   return libintl_gettext (msgid);
643fb98d4aSespie }
653fb98d4aSespie 
663fb98d4aSespie 
67*a1acfa9bSespie DLL_EXPORTED
683fb98d4aSespie char *
dgettext(const char * domainname,const char * msgid)69*a1acfa9bSespie dgettext (const char *domainname, const char *msgid)
703fb98d4aSespie {
71*a1acfa9bSespie   return libintl_dgettext (domainname, msgid);
72840175f0Skstailey }
73840175f0Skstailey 
74840175f0Skstailey 
75*a1acfa9bSespie DLL_EXPORTED
76840175f0Skstailey char *
dcgettext(const char * domainname,const char * msgid,int category)77*a1acfa9bSespie dcgettext (const char *domainname, const char *msgid, int category)
78840175f0Skstailey {
79*a1acfa9bSespie   return libintl_dcgettext (domainname, msgid, category);
80840175f0Skstailey }
81840175f0Skstailey 
82840175f0Skstailey 
83*a1acfa9bSespie DLL_EXPORTED
84840175f0Skstailey char *
ngettext(const char * msgid1,const char * msgid2,unsigned long int n)85*a1acfa9bSespie ngettext (const char *msgid1, const char *msgid2, unsigned long int n)
86840175f0Skstailey {
87*a1acfa9bSespie   return libintl_ngettext (msgid1, msgid2, n);
88840175f0Skstailey }
89840175f0Skstailey 
90840175f0Skstailey 
91*a1acfa9bSespie DLL_EXPORTED
92840175f0Skstailey char *
dngettext(const char * domainname,const char * msgid1,const char * msgid2,unsigned long int n)93*a1acfa9bSespie dngettext (const char *domainname,
94*a1acfa9bSespie 	   const char *msgid1, const char *msgid2, unsigned long int n)
95840175f0Skstailey {
96*a1acfa9bSespie   return libintl_dngettext (domainname, msgid1, msgid2, n);
973fb98d4aSespie }
983fb98d4aSespie 
993fb98d4aSespie 
100*a1acfa9bSespie DLL_EXPORTED
1013fb98d4aSespie char *
dcngettext(const char * domainname,const char * msgid1,const char * msgid2,unsigned long int n,int category)102*a1acfa9bSespie dcngettext (const char *domainname,
103*a1acfa9bSespie 	    const char *msgid1, const char *msgid2, unsigned long int n,
104*a1acfa9bSespie 	    int category)
1053fb98d4aSespie {
106*a1acfa9bSespie   return libintl_dcngettext (domainname, msgid1, msgid2, n, category);
107840175f0Skstailey }
108840175f0Skstailey 
109840175f0Skstailey 
110*a1acfa9bSespie DLL_EXPORTED
111840175f0Skstailey char *
textdomain(const char * domainname)112*a1acfa9bSespie textdomain (const char *domainname)
113840175f0Skstailey {
114*a1acfa9bSespie   return libintl_textdomain (domainname);
115840175f0Skstailey }
1163fb98d4aSespie 
1173fb98d4aSespie 
118*a1acfa9bSespie DLL_EXPORTED
1193fb98d4aSespie char *
bindtextdomain(const char * domainname,const char * dirname)120*a1acfa9bSespie bindtextdomain (const char *domainname, const char *dirname)
1213fb98d4aSespie {
122*a1acfa9bSespie   return libintl_bindtextdomain (domainname, dirname);
1233fb98d4aSespie }
1243fb98d4aSespie 
1253fb98d4aSespie 
126*a1acfa9bSespie DLL_EXPORTED
1273fb98d4aSespie char *
bind_textdomain_codeset(const char * domainname,const char * codeset)128*a1acfa9bSespie bind_textdomain_codeset (const char *domainname, const char *codeset)
1293fb98d4aSespie {
130*a1acfa9bSespie   return libintl_bind_textdomain_codeset (domainname, codeset);
1313fb98d4aSespie }
132