2000-06-16 Bruno Haible <haible@clisp.cons.org>
+ * 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.
/* 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
#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:
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)
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;
/* 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
#undef dcgettext
#undef textdomain
#undef bindtextdomain
+#undef bind_textdomain_codeset
char *
}
+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;
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
/* 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
/* 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
((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