From: Bruno Haible Date: Fri, 16 Jun 2000 18:48:22 +0000 (+0000) Subject: Keep in sync with new bind_textdomain_codeset function in libintl.glibc. X-Git-Tag: v0.10.36~277 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d734a4c1fd58bc7522aa2ec8736526f69bfdb539;p=thirdparty%2Fgettext.git Keep in sync with new bind_textdomain_codeset function in libintl.glibc. --- diff --git a/intl/ChangeLog b/intl/ChangeLog index 64ae2205c..c58e11f59 100644 --- a/intl/ChangeLog +++ b/intl/ChangeLog @@ -1,5 +1,12 @@ 2000-06-16 Bruno Haible + * intlh.inst.in (bind_textdomain_codeset): New declaration. + * libgettext.h (bind_textdomain_codeset, bind_textdomain_codeset__): + New declarations. + (bind_textdomain_codeset) [!ENABLE_NLS]: New macro. + * cat-compat.c (bind_textdomain_codeset): New function. + * intl-compat.c (bind_textdomain_codeset): New function. + * libgettext.h (ngettext, dngettext, dcngettext): New declarations. (dcgettext): Remove macro definition. diff --git a/intl/cat-compat.c b/intl/cat-compat.c index 867d901b8..89aa0aafc 100644 --- a/intl/cat-compat.c +++ b/intl/cat-compat.c @@ -1,5 +1,5 @@ /* Compatibility code for gettext-using-catgets interface. - Copyright (C) 1995, 1997 Free Software Foundation, Inc. + Copyright (C) 1995, 1997, 2000 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,6 +37,12 @@ char *getenv (); #include "libgettext.h" +/* Tell the compiler when a conditional or integer expression is + almost always true or almost always false. */ +#ifndef HAVE_BUILTIN_EXPECT +# define __builtin_expect(expr, val) (expr) +#endif + /* @@ end of prolog @@ */ /* XPG3 defines the result of `setlocale (category, NULL)' as: @@ -206,6 +212,21 @@ bindtextdomain (domainname, dirname) return (char *) domainname; } +char * +bind_textdomain_codeset (domainname, codeset) + const char *domainname; + const char *codeset; +{ + /* This does not make much sense here but to be compatible do it. */ + if (domainname == NULL) + return NULL; + + /* catgets doesn't support character codeset conversion. We could + call iconv() ourselves in gettext, but that's outside of the scope + of this compatibility hack. */ + return (char *) codeset; +} + #undef gettext char * gettext (msg) @@ -236,7 +257,7 @@ msg_to_cat_id (msg) int cnt; for (cnt = 0; cnt < _msg_tbl_length; ++cnt) - if (strcmp (msg, _msg_tbl[cnt]._msg) == 0) + if (__builtin_expect (strcmp (msg, _msg_tbl[cnt]._msg) == 0, 0)) return _msg_tbl[cnt]._msg_number; return -1; diff --git a/intl/intl-compat.c b/intl/intl-compat.c index 503efa0fa..c6aeb4677 100644 --- a/intl/intl-compat.c +++ b/intl/intl-compat.c @@ -1,6 +1,6 @@ /* intl-compat.c - Stub functions to call gettext functions from GNU gettext Library. - Copyright (C) 1995 Software Foundation, Inc. + Copyright (C) 1995, 2000 Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #undef dcgettext #undef textdomain #undef bindtextdomain +#undef bind_textdomain_codeset char * @@ -41,6 +42,15 @@ bindtextdomain (domainname, dirname) } +char * +bind_textdomain_codeset (domainname, codeset) + const char *domainname; + const char *codeset; +{ + return bind_textdomain_codeset__ (domainname, codeset); +} + + char * dcgettext (domainname, msgid, category) const char *domainname; diff --git a/intl/intlh.inst.in b/intl/intlh.inst.in index d2630243e..8a30511f7 100644 --- a/intl/intlh.inst.in +++ b/intl/intlh.inst.in @@ -78,6 +78,11 @@ extern char *textdomain PARAMS ((const char *__domainname)); extern char *bindtextdomain PARAMS ((const char *__domainname, const char *__dirname)); +/* Specify the character encoding in which the messages from the + DOMAINNAME message catalog will be returned. */ +extern char *bind_textdomain_codeset PARAMS ((const char *__domainname, + const char *__codeset)); + /* Optimized version of the functions above. */ #if defined __OPTIMIZED diff --git a/intl/libgettext.h b/intl/libgettext.h index 9ed6f0dec..58c83e6fa 100644 --- a/intl/libgettext.h +++ b/intl/libgettext.h @@ -1,5 +1,5 @@ /* Message catalogs for internationalization. - Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -134,9 +134,16 @@ extern char *textdomain__ PARAMS ((const char *__domainname)); /* Specify that the DOMAINNAME message catalog will be found in DIRNAME rather than in the system locale data base. */ extern char *bindtextdomain PARAMS ((const char *__domainname, - const char *__dirname)); + const char *__dirname)); extern char *bindtextdomain__ PARAMS ((const char *__domainname, - const char *__dirname)); + const char *__dirname)); + +/* Specify the character encoding in which the messages from the + DOMAINNAME message catalog will be returned. */ +extern char *bind_textdomain_codeset PARAMS ((const char *__domainname, + const char *__codeset)); +extern char *bind_textdomain_codeset__ PARAMS ((const char *__domainname, + const char *__codeset)); #if ENABLE_NLS @@ -172,6 +179,7 @@ extern char *bindtextdomain__ PARAMS ((const char *__domainname, ((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2)) # define textdomain(Domainname) ((char *) (Domainname)) # define bindtextdomain(Domainname, Dirname) ((char *) (Dirname)) +# define bind_textdomain_codeset(Domainname, Codeset) ((char *) (Codeset)) #endif