From: Bruno Haible Date: Fri, 16 Jun 2000 18:35:02 +0000 (+0000) Subject: Keep the ngettext, dngettext, dcngettext, dcgettext declarations in synch X-Git-Tag: v0.10.36~278 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e638edc87d705d6b24e402a292e7d0dee9d297f;p=thirdparty%2Fgettext.git Keep the ngettext, dngettext, dcngettext, dcgettext declarations in synch with libintl.glibc. --- diff --git a/intl/ChangeLog b/intl/ChangeLog index 64e88b082..64ae2205c 100644 --- a/intl/ChangeLog +++ b/intl/ChangeLog @@ -1,5 +1,13 @@ 2000-06-16 Bruno Haible + * libgettext.h (ngettext, dngettext, dcngettext): New + declarations. + (dcgettext): Remove macro definition. + (textdomain, bindtextdomain) [!ENABLE_NLS]: Parenthesize argument. + * intlh.inst.in (ngettext, dngettext, dcngettext): New + declarations. + (dcgettext): Remove macro definition. + * *.h, *.c, *.y: Change copyright notice from LGPL to GPL. 2000-05-21 Ulrich Drepper diff --git a/intl/intlh.inst.in b/intl/intlh.inst.in index e666b49c9..d2630243e 100644 --- a/intl/intlh.inst.in +++ b/intl/intlh.inst.in @@ -1,5 +1,5 @@ /* Message catalogs for internationalization. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 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 @@ -51,6 +51,23 @@ extern char *dcgettext PARAMS ((const char *__domainname, const char *__msgid, int __category)); +/* Similar to `gettext' but select the plural form corresponding to the + number N. */ +extern char *ngettext PARAMS ((const char *__msgid1, const char *__msgid2, + unsigned long int __n)); + +/* Similar to `dgettext' but select the plural form corresponding to the + number N. */ +extern char *dngettext PARAMS ((const char *__domainname, const char *__msgid1, + const char *__msgid2, unsigned long int __n)); + +/* Similar to `dcgettext' but select the plural form corresponding to the + number N. */ +extern char *dcngettext PARAMS ((const char *__domainname, const char *__msgid1, + const char *__msgid2, unsigned long int __n, + int __category)); + + /* Set the current default message catalog to DOMAINNAME. If DOMAINNAME is null, return the current default. If DOMAINNAME is "", reset to the default of "messages". */ @@ -73,33 +90,12 @@ extern char *bindtextdomain PARAMS ((const char *__domainname, # define dgettext(domainname, msgid) \ dcgettext (domainname, msgid, LC_MESSAGES) -# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) -/* This global variable is defined in loadmsgcat.c. We need a sign, - whether a new catalog was loaded, which can be associated with all - translations. */ -extern int _nl_msg_cat_cntr; - -# define dcgettext(domainname, msgid, category) \ - (__extension__ \ - ({ \ - char *__result; \ - if (__builtin_constant_p (msgid)) \ - { \ - static char *__translation__; \ - static int __catalog_counter__; \ - if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr) \ - { \ - __translation__ = \ - (dcgettext) ((domainname), (msgid), (category)); \ - __catalog_counter__ = _nl_msg_cat_cntr; \ - } \ - __result = __translation__; \ - } \ - else \ - __result = (dcgettext) ((domainname), (msgid), (category)); \ - __result; \ - })) -# endif +# define ngettext(msgid, N) \ + dngettext (NULL, msgid, N) + +# define dngettext(domainname, msgid, n) \ + dcngettext (domainname, msgid, n, LC_MESSAGES) + #endif /* Optimizing. */ diff --git a/intl/libgettext.h b/intl/libgettext.h index 3a92960ae..9ed6f0dec 100644 --- a/intl/libgettext.h +++ b/intl/libgettext.h @@ -108,6 +108,23 @@ extern char *dcgettext__ PARAMS ((const char *__domainname, const char *__msgid, int __category)); +/* Similar to `gettext' but select the plural form corresponding to the + number N. */ +extern char *ngettext PARAMS ((const char *__msgid1, const char *__msgid2, + unsigned long int __n)); + +/* Similar to `dgettext' but select the plural form corresponding to the + number N. */ +extern char *dngettext PARAMS ((const char *__domainname, const char *__msgid1, + const char *__msgid2, unsigned long int __n)); + +/* Similar to `dcgettext' but select the plural form corresponding to the + number N. */ +extern char *dcngettext PARAMS ((const char *__domainname, const char *__msgid1, + const char *__msgid2, unsigned long int __n, + int __category)); + + /* Set the current default message catalog to DOMAINNAME. If DOMAINNAME is null, return the current default. If DOMAINNAME is "", reset to the default of "messages". */ @@ -134,33 +151,12 @@ extern char *bindtextdomain__ PARAMS ((const char *__domainname, # define dgettext(Domainname, Msgid) \ dcgettext (Domainname, Msgid, LC_MESSAGES) -# if defined __GNUC__ && __GNUC__ == 2 && __GNUC_MINOR__ >= 7 -/* This global variable is defined in loadmsgcat.c. We need a sign, - whether a new catalog was loaded, which can be associated with all - translations. */ -extern int _nl_msg_cat_cntr; - -# define dcgettext(Domainname, Msgid, Category) \ - (__extension__ \ - ({ \ - char *__result; \ - if (__builtin_constant_p (Msgid)) \ - { \ - static char *__translation__; \ - static int __catalog_counter__; \ - if (! __translation__ || __catalog_counter__ != _nl_msg_cat_cntr) \ - { \ - __translation__ = \ - dcgettext__ (Domainname, Msgid, Category); \ - __catalog_counter__ = _nl_msg_cat_cntr; \ - } \ - __result = __translation__; \ - } \ - else \ - __result = dcgettext__ (Domainname, Msgid, Category); \ - __result; \ - })) -# endif +# define ngettext(Msgid, N) \ + dngettext (NULL, Msgid, N) + +# define dngettext(Domainname, Msgid, N) \ + dcngettext (Domainname, Msgid, N, LC_MESSAGES) + # endif #else @@ -168,8 +164,14 @@ extern int _nl_msg_cat_cntr; # define gettext(Msgid) (Msgid) # define dgettext(Domainname, Msgid) (Msgid) # define dcgettext(Domainname, Msgid, Category) (Msgid) -# define textdomain(Domainname) ((char *) Domainname) -# define bindtextdomain(Domainname, Dirname) ((char *) Dirname) +# define ngettext(Msgid1, Msgid2, N) \ + ((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2)) +# define dngettext(Domainname, Msgid1, Msgid2, N) \ + ((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2)) +# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ + ((N) == 1 ? (char *) (Msgid1) : (char *) (Msgid2)) +# define textdomain(Domainname) ((char *) (Domainname)) +# define bindtextdomain(Domainname, Dirname) ((char *) (Dirname)) #endif