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