]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Keep the ngettext, dngettext, dcngettext, dcgettext declarations in synch
authorBruno Haible <bruno@clisp.org>
Fri, 16 Jun 2000 18:35:02 +0000 (18:35 +0000)
committerBruno Haible <bruno@clisp.org>
Fri, 16 Jun 2000 18:35:02 +0000 (18:35 +0000)
with libintl.glibc.

intl/ChangeLog
intl/intlh.inst.in
intl/libgettext.h

index 64e88b08255bcbf40e7f54927bf2271420da1cd7..64ae2205c61b547c91a9657f1b9d829889646ae0 100644 (file)
@@ -1,5 +1,13 @@
 2000-06-16  Bruno Haible  <haible@clisp.cons.org>
 
+       * 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  <drepper@redhat.com>
index e666b49c9d68947694d1f8af77619f9301fcd09c..d2630243e5645547d4e7d8fcc3d0dc7c0f378f42 100644 (file)
@@ -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. */
 
 
index 3a92960ae3ee9ff2a1376816de31c179061d390e..9ed6f0dec59488d0f9966627ecfdb6e01b3c4a6c 100644 (file)
@@ -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