summary refs log tree commit diff
path: root/intl/gettextP.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-01-22 05:50:49 +0000
committerUlrich Drepper <drepper@redhat.com>2000-01-22 05:50:49 +0000
commitabbffdf981c8bb03312024107715d58902914f11 (patch)
tree168a2fd362a2c159507b4ed0d2391b6ff3f1e575 /intl/gettextP.h
parent0b9fbf003af00a2a22164333bbe709aa9abbcdc9 (diff)
downloadglibc-abbffdf981c8bb03312024107715d58902914f11.tar.gz
glibc-abbffdf981c8bb03312024107715d58902914f11.tar.xz
glibc-abbffdf981c8bb03312024107715d58902914f11.zip
Update.
2000-01-21  Ulrich Drepper  <drepper@cygnus.com>

	* intl/Makefile (routines): Add dcigettext, dcngettext, dngettxt,
	ngettext, and plural.
	(distribute): Add plural.y, po2test.sed, and tst-gettext.sh.
	(test-srcs): Add tst-gettext.
	(before-compile): Add $(objpfx)msgs.h.
	Add rules for plural.c and msgs.h generation and running tst-gettext.\
	* intl/Versions [GLIBC_2.2]: Add __dcngettext, dcngettext, dngettext,
	and ngettext.
	* intl/dcgettext.c: Move most code into dcigettext.c.  Add call
	dcigettext with appropriate parameters.
	* intl/dcigettext.c: New file.
	* intl/dcngettext.c: New file.
	* intl/dngettext.c: New file.
	* intl/ngettext.c: New file.
	* intl/gettextP.h (struct expression): Define.
	(struct loaded_domain): Add plural and nplurals members.
	Add prototypes for new internal functions.
	* intl/libintl.h: Declare new functions.  Add optimizations for them.
	* intl/loadinfo.h: Add new parameter to _nl_find_msg declaration.
	* intl/loadmsgcat.c (_nl_load_domain): Search for plural information in
	header entry and parse and store the expression.
	* intl/plural.y: New file.
	* intl/po2test.sed: New file.
	* intl/tst-gettext.c: New file.
	* intl/tst-gettext.sh: New file.

	* intl/gettext.c: Call __dcgettext directly.
Diffstat (limited to 'intl/gettextP.h')
-rw-r--r--intl/gettextP.h78
1 files changed, 77 insertions, 1 deletions
diff --git a/intl/gettextP.h b/intl/gettextP.h
index b3c8c18598..d210dc6c4e 100644
--- a/intl/gettextP.h
+++ b/intl/gettextP.h
@@ -1,5 +1,5 @@
 /* Header describing internals of gettext library
-   Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
    Written by Ulrich Drepper <drepper@cygnus.com>, 1995.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -64,6 +64,51 @@ SWAP (i)
 #endif
 
 
+/* This is the representation of the expressions to determine the
+   plural form.  */
+struct expression
+{
+  enum operator
+  {
+    var,			/* The variable "n".  */
+    num,			/* Decimal number.  */
+    mult,			/* Multiplication.  */
+    divide,			/* Division.  */
+    module,			/* Module operation.  */
+    plus,			/* Addition.  */
+    minus,			/* Subtraction.  */
+    equal,			/* Comparision for equality.  */
+    not_equal,			/* Comparision for inequality.  */
+    land,			/* Logical AND.  */
+    lor,			/* Logical OR.  */
+    qmop			/* Question mark operator.  */
+  } operation;
+  union
+  {
+    unsigned long int num;	/* Number value for `num'.  */
+    struct
+    {
+      struct expression *left;	/* Left expression in binary operation.  */
+      struct expression *right;	/* Right expression in binary operation.  */
+    } args2;
+    struct
+    {
+      struct expression *bexp;	/* Boolean expression in ?: operation.  */
+      struct expression *tbranch; /* True-branch in ?: operation.  */
+      struct expression *fbranch; /* False-branch in ?: operation.  */
+    } args3;
+  } val;
+};
+
+/* This is the data structure to pass information to the parser and get
+   the result in a thread-safe way.  */
+struct parse_args
+{
+  const char *cp;
+  struct expression *res;
+};
+
+
 struct loaded_domain
 {
   const char *data;
@@ -83,6 +128,9 @@ struct loaded_domain
 # endif
 #endif
   char **conv_tab;
+
+  struct expression *plural;
+  unsigned long int nplurals;
 };
 
 struct binding
@@ -103,6 +151,34 @@ void _nl_load_domain PARAMS ((struct loaded_l10nfile *__domain))
 void _nl_unload_domain PARAMS ((struct loaded_domain *__domain))
      internal_function;
 
+#ifdef _LIBC
+extern char *__ngettext PARAMS ((const char *msgid1, const char *msgid2,
+				 unsigned long int n));
+extern char *__dngettext PARAMS ((const char *domainname, const char *msgid1,
+				  const char *msgid2, unsigned long int n));
+extern char *__dcngettext PARAMS ((const char *domainname, const char *msgid1,
+				   const char *msgid2, unsigned long int n,
+				   int category));
+extern char *__dcigettext PARAMS ((const char *domainname, const char *msgid1,
+				   const char *msgid2, int plural,
+				   unsigned long int n, int category));
+#else
+extern char *ngettext__ PARAMS ((const char *msgid1, const char *msgid2,
+				 unsigned long int n));
+extern char *dngettext__ PARAMS ((const char *domainname, const char *msgid1,
+				  const char *msgid2, unsigned long int n));
+extern char *dcngettext__ PARAMS ((const char *domainname, const char *msgid1,
+				   const char *msgid2, unsigned long int n,
+				   int category));
+extern char *dcigettext__ PARAMS ((const char *domainname, const char *msgid1,
+				   const char *msgid2, int plural,
+				   unsigned long int n, int category));
+#endif
+
+extern int __gettextdebug;
+extern void __gettext_free_exp (struct expression *exp) internal_function;
+extern int __gettextparse (void *arg);
+
 /* @@ begin of epilog @@ */
 
 #endif /* gettextP.h  */