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