summary refs log tree commit diff
path: root/intl
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-12-11 22:59:29 +0000
committerRoland McGrath <roland@gnu.org>2002-12-11 22:59:29 +0000
commit0f1316460cae46817ae843d0bba15c259d77d0e6 (patch)
tree8c95e9bd3a241314fc28006101879fd5bb51fc24 /intl
parent5cb5cfa2a26007b9a4a1c89d791cb5a0493bf7cd (diff)
downloadglibc-0f1316460cae46817ae843d0bba15c259d77d0e6.tar.gz
glibc-0f1316460cae46817ae843d0bba15c259d77d0e6.tar.xz
glibc-0f1316460cae46817ae843d0bba15c259d77d0e6.zip
* intl/gettext.h: Renamed to ...
	* intl/gmo.h: ... here.
	* intl/Makefile (distribute): Add gmo.h, remove gettext.h.
	* intl/gettextP.h: Update.
	* intl/loadmsgcat.c: Update.

	* intl/gettextP.h (PARAMS): Make more portable.
	(attribute_hidden): Define as empty macro if not already defined.
	* intl/hash-string.h (PARAMS): Make more portable.
	* intl/loadinfo.h (PARAMS): Likewise.
	* intl/plural-exp.h (PARAMS): Likewise.
	(attribute_hidden): Move definition near the definition of
	internal_function.

	* intl/gettextP.h (_nl_locale_name) [!_LIBC]: New declaration.
	* intl/plural-exp.h (plural_eval) [!_LIBC]: New declaration.

2002-07-13  Bruno Haible  <bruno@clisp.org>

	* intl/dcigettext.c (freea): New macro.
	(FREE_BLOCKS): Free also the registered blocks.
	(DCIGETTEXT): Free the 'search' variable.
	Reported by Andreas Fischer <a.fischer@asentics.de>.

2002-04-27  Bruno Haible  <bruno@clisp.org>

	* intl/gettextP.h [! _LIBC]: Use prefix libintl_ instead of suffix __.
	* intl/dcigettext.c: Likewise.
	* intl/dcgettext.c: Likewise.
	* intl/dgettext.c: Likewise.
	* intl/gettext.c: Likewise.
	* intl/dcngettext.c: Likewise.
	* intl/dngettext.c: Likewise.
	* intl/ngettext.c: Likewise.
	* intl/textdomain.c: Likewise.
	* intl/bindtextdom.c: Likewise.
	* intl/plural-exp.h: Likewise.

2002-01-02  Bruno Haible  <bruno@clisp.org>

	* intl/loadmsgcat.c (_nl_init_domain_conv): Use PARAMS in extern decl.

2001-04-30  Bruno Haible  <bruno@clisp.org>

	* intl/dcigettext.c (getuid, getgid, geteuid, getegid): Provide
	default macro definitions.  Needed for mingw32.
Diffstat (limited to 'intl')
-rw-r--r--intl/bindtextdom.c8
-rw-r--r--intl/dcgettext.c4
-rw-r--r--intl/dcigettext.c26
-rw-r--r--intl/dcngettext.c4
-rw-r--r--intl/dgettext.c4
-rw-r--r--intl/dngettext.c4
-rw-r--r--intl/gettext.c4
-rw-r--r--intl/gettextP.h61
-rw-r--r--intl/hash-string.h2
-rw-r--r--intl/loadinfo.h14
-rw-r--r--intl/loadmsgcat.c4
-rw-r--r--intl/ngettext.c4
-rw-r--r--intl/plural-exp.h23
-rw-r--r--intl/textdomain.c6
14 files changed, 107 insertions, 61 deletions
diff --git a/intl/bindtextdom.c b/intl/bindtextdom.c
index 56a4223270..39256ed566 100644
--- a/intl/bindtextdom.c
+++ b/intl/bindtextdom.c
@@ -46,8 +46,8 @@
    names than the internal variables in GNU libc, otherwise programs
    using libintl.a cannot be linked statically.  */
 #if !defined _LIBC
-# define _nl_default_dirname _nl_default_dirname__
-# define _nl_domain_bindings _nl_domain_bindings__
+# define _nl_default_dirname libintl_nl_default_dirname
+# define _nl_domain_bindings libintl_nl_domain_bindings
 #endif
 
 /* Some compilers, like SunOS4 cc, don't have offsetof in <stddef.h>.  */
@@ -83,8 +83,8 @@ __libc_rwlock_define (extern, _nl_state_lock attribute_hidden)
 #  define strdup(str) __strdup (str)
 # endif
 #else
-# define BINDTEXTDOMAIN bindtextdomain__
-# define BIND_TEXTDOMAIN_CODESET bind_textdomain_codeset__
+# define BINDTEXTDOMAIN libintl_bindtextdomain
+# define BIND_TEXTDOMAIN_CODESET libintl_bind_textdomain_codeset
 #endif
 
 /* Prototypes for local functions.  */
diff --git a/intl/dcgettext.c b/intl/dcgettext.c
index feea12c0ba..55f81eb887 100644
--- a/intl/dcgettext.c
+++ b/intl/dcgettext.c
@@ -38,8 +38,8 @@
 # define DCGETTEXT __dcgettext
 # define DCIGETTEXT __dcigettext
 #else
-# define DCGETTEXT dcgettext__
-# define DCIGETTEXT dcigettext__
+# define DCGETTEXT libintl_dcgettext
+# define DCIGETTEXT libintl_dcigettext
 #endif
 
 /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
diff --git a/intl/dcigettext.c b/intl/dcigettext.c
index 80c71efbc4..9118dbdda9 100644
--- a/intl/dcigettext.c
+++ b/intl/dcigettext.c
@@ -103,10 +103,10 @@ extern int errno;
    names than the internal variables in GNU libc, otherwise programs
    using libintl.a cannot be linked statically.  */
 #if !defined _LIBC
-# define _nl_default_default_domain _nl_default_default_domain__
-# define _nl_current_default_domain _nl_current_default_domain__
-# define _nl_default_dirname _nl_default_dirname__
-# define _nl_domain_bindings _nl_domain_bindings__
+# define _nl_default_default_domain libintl_nl_default_default_domain
+# define _nl_current_default_domain libintl_nl_current_default_domain
+# define _nl_default_dirname libintl_nl_default_dirname
+# define _nl_domain_bindings libintl_nl_domain_bindings
 #endif
 
 /* Some compilers, like SunOS4 cc, don't have offsetof in <stddef.h>.  */
@@ -280,6 +280,7 @@ static const char *category_to_name PARAMS ((int category)) internal_function;
    some additional code emulating it.  */
 #ifdef HAVE_ALLOCA
 /* Nothing has to be done.  */
+# define freea(p) /* nothing */
 # define ADD_BLOCK(list, address) /* nothing */
 # define FREE_BLOCKS(list) /* nothing */
 #else
@@ -304,11 +305,13 @@ struct block_list
     while (list != NULL) {						      \
       struct block_list *old = list;					      \
       list = list->next;						      \
+      free (old->address);						      \
       free (old);							      \
     }									      \
   } while (0)
 # undef alloca
 # define alloca(size) (malloc (size))
+# define freea(p) free (p)
 #endif	/* have alloca */
 
 
@@ -332,7 +335,7 @@ typedef unsigned char transmem_block_t;
 #ifdef _LIBC
 # define DCIGETTEXT __dcigettext
 #else
-# define DCIGETTEXT dcigettext__
+# define DCIGETTEXT libintl_dcigettext
 #endif
 
 /* Lock variable to protect the global data in the gettext implementation.  */
@@ -346,6 +349,18 @@ __libc_rwlock_define_initialized (, _nl_state_lock attribute_hidden)
 # define ENABLE_SECURE __libc_enable_secure
 # define DETERMINE_SECURE
 #else
+# ifndef HAVE_GETUID
+#  define getuid() 0
+# endif
+# ifndef HAVE_GETGID
+#  define getgid() 0
+# endif
+# ifndef HAVE_GETEUID
+#  define geteuid() getuid()
+# endif
+# ifndef HAVE_GETEGID
+#  define getegid() getgid()
+# endif
 static int enable_secure;
 # define ENABLE_SECURE (enable_secure == 1)
 # define DETERMINE_SECURE \
@@ -425,6 +440,7 @@ DCIGETTEXT (domainname, msgid1, msgid2, plural, n, category)
   search->category = category;
 
   foundp = (struct known_translation_t **) tfind (search, &root, transcmp);
+  freea (search);
   if (foundp != NULL && (*foundp)->counter == _nl_msg_cat_cntr)
     {
       /* Now deal with plural.  */
diff --git a/intl/dcngettext.c b/intl/dcngettext.c
index 72ffa77a02..6d95d1bc74 100644
--- a/intl/dcngettext.c
+++ b/intl/dcngettext.c
@@ -38,8 +38,8 @@
 # define DCNGETTEXT __dcngettext
 # define DCIGETTEXT __dcigettext
 #else
-# define DCNGETTEXT dcngettext__
-# define DCIGETTEXT dcigettext__
+# define DCNGETTEXT libintl_dcngettext
+# define DCIGETTEXT libintl_dcigettext
 #endif
 
 /* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
diff --git a/intl/dgettext.c b/intl/dgettext.c
index 0fa9fc2e82..c766d9508d 100644
--- a/intl/dgettext.c
+++ b/intl/dgettext.c
@@ -40,8 +40,8 @@
 # define DGETTEXT __dgettext
 # define DCGETTEXT INTUSE(__dcgettext)
 #else
-# define DGETTEXT dgettext__
-# define DCGETTEXT dcgettext__
+# define DGETTEXT libintl_dgettext
+# define DCGETTEXT libintl_dcgettext
 #endif
 
 /* Look up MSGID in the DOMAINNAME message catalog of the current
diff --git a/intl/dngettext.c b/intl/dngettext.c
index c315d7eb10..89c7b0afcf 100644
--- a/intl/dngettext.c
+++ b/intl/dngettext.c
@@ -40,8 +40,8 @@
 # define DNGETTEXT __dngettext
 # define DCNGETTEXT __dcngettext
 #else
-# define DNGETTEXT dngettext__
-# define DCNGETTEXT dcngettext__
+# define DNGETTEXT libintl_dngettext
+# define DCNGETTEXT libintl_dcngettext
 #endif
 
 /* Look up MSGID in the DOMAINNAME message catalog of the current
diff --git a/intl/gettext.c b/intl/gettext.c
index ec5fa3a84a..63abe582b5 100644
--- a/intl/gettext.c
+++ b/intl/gettext.c
@@ -45,8 +45,8 @@
 # define GETTEXT __gettext
 # define DCGETTEXT INTUSE(__dcgettext)
 #else
-# define GETTEXT gettext__
-# define DCGETTEXT dcgettext__
+# define GETTEXT libintl_gettext
+# define DCGETTEXT libintl_dcgettext
 #endif
 
 /* Look up MSGID in the current default message catalog for the current
diff --git a/intl/gettextP.h b/intl/gettextP.h
index d90e59a364..69a95cabc7 100644
--- a/intl/gettextP.h
+++ b/intl/gettextP.h
@@ -33,12 +33,12 @@
 
 #include "loadinfo.h"
 
-#include "gettext.h"		/* Get nls_uint32.  */
+#include "gmo.h"		/* Get nls_uint32.  */
 
 /* @@ end of prolog @@ */
 
 #ifndef PARAMS
-# if __STDC__
+# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
 #  define PARAMS(args) args
 # else
 #  define PARAMS(args) ()
@@ -49,6 +49,10 @@
 # define internal_function
 #endif
 
+#ifndef attribute_hidden
+# define attribute_hidden
+#endif
+
 /* Tell the compiler when a conditional or integer expression is
    almost always true or almost always false.  */
 #ifndef HAVE_BUILTIN_EXPECT
@@ -157,6 +161,10 @@ struct binding
    This variable is part of the external ABI of the GNU libintl.  */
 extern int _nl_msg_cat_cntr;
 
+#ifndef _LIBC
+const char *_nl_locale_name PARAMS ((int category, const char *categoryname));
+#endif
+
 struct loaded_l10nfile *_nl_find_domain PARAMS ((const char *__dirname,
 						 char *__locale,
 						 const char *__domainname,
@@ -203,28 +211,33 @@ extern char *__bindtextdomain PARAMS ((const char *__domainname,
 extern char *__bind_textdomain_codeset PARAMS ((const char *__domainname,
 						const char *__codeset));
 #else
-extern char *gettext__ PARAMS ((const char *__msgid));
-extern char *dgettext__ PARAMS ((const char *__domainname,
-				 const char *__msgid));
-extern char *dcgettext__ PARAMS ((const char *__domainname,
-				  const char *__msgid, int __category));
-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));
-extern char *textdomain__ PARAMS ((const char *__domainname));
-extern char *bindtextdomain__ PARAMS ((const char *__domainname,
-				       const char *__dirname));
-extern char *bind_textdomain_codeset__ PARAMS ((const char *__domainname,
-						const char *__codeset));
+extern char *libintl_gettext PARAMS ((const char *__msgid));
+extern char *libintl_dgettext PARAMS ((const char *__domainname,
+				       const char *__msgid));
+extern char *libintl_dcgettext PARAMS ((const char *__domainname,
+					const char *__msgid, int __category));
+extern char *libintl_ngettext PARAMS ((const char *__msgid1,
+				       const char *__msgid2,
+				       unsigned long int __n));
+extern char *libintl_dngettext PARAMS ((const char *__domainname,
+					const char *__msgid1,
+					const char *__msgid2,
+					unsigned long int __n));
+extern char *libintl_dcngettext PARAMS ((const char *__domainname,
+					 const char *__msgid1,
+					 const char *__msgid2,
+					 unsigned long int __n,
+					 int __category));
+extern char *libintl_dcigettext PARAMS ((const char *__domainname,
+					 const char *__msgid1,
+					 const char *__msgid2,
+					 int __plural, unsigned long int __n,
+					 int __category));
+extern char *libintl_textdomain PARAMS ((const char *__domainname));
+extern char *libintl_bindtextdomain PARAMS ((const char *__domainname,
+					     const char *__dirname));
+extern char *libintl_bind_textdomain_codeset PARAMS ((const char *__domainname,
+						      const char *__codeset));
 #endif
 
 /* @@ begin of epilog @@ */
diff --git a/intl/hash-string.h b/intl/hash-string.h
index ae4bcfb3e2..ae515a7655 100644
--- a/intl/hash-string.h
+++ b/intl/hash-string.h
@@ -20,7 +20,7 @@
 /* @@ end of prolog @@ */
 
 #ifndef PARAMS
-# if __STDC__
+# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
 #  define PARAMS(Args) Args
 # else
 #  define PARAMS(Args) ()
diff --git a/intl/loadinfo.h b/intl/loadinfo.h
index 340535a4d3..72f1b3e9f1 100644
--- a/intl/loadinfo.h
+++ b/intl/loadinfo.h
@@ -20,8 +20,20 @@
 #ifndef _LOADINFO_H
 #define _LOADINFO_H	1
 
+/* Declarations of locale dependent catalog lookup functions.
+   Implemented in
+
+     localealias.c    Possibly replace a locale name by another.
+     explodename.c    Split a locale name into its various fields.
+     l10nflist.c      Generate a list of filenames of possible message catalogs.
+     finddomain.c     Find and open the relevant message catalogs.
+
+   The main function _nl_find_domain() in finddomain.c is declared
+   in gettextP.h.
+ */
+
 #ifndef PARAMS
-# if __STDC__
+# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
 #  define PARAMS(args) args
 # else
 #  define PARAMS(args) ()
diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c
index b9e59f5682..7238ad3507 100644
--- a/intl/loadmsgcat.c
+++ b/intl/loadmsgcat.c
@@ -80,7 +80,7 @@ char *alloca ();
 # include <inttypes.h>
 #endif
 
-#include "gettext.h"
+#include "gmo.h"
 #include "gettextP.h"
 #include "hash-string.h"
 #include "plural-exp.h"
@@ -808,7 +808,7 @@ _nl_init_domain_conv (domain_file, domain, domainbinding)
 		  outcharset = _NL_CURRENT (LC_CTYPE, CODESET);
 # else
 #  if HAVE_ICONV
-		  extern const char *locale_charset (void);
+		  extern const char *locale_charset PARAMS ((void));
 		  outcharset = locale_charset ();
 #  endif
 # endif
diff --git a/intl/ngettext.c b/intl/ngettext.c
index e050924495..7118eae324 100644
--- a/intl/ngettext.c
+++ b/intl/ngettext.c
@@ -47,8 +47,8 @@
 # define NGETTEXT __ngettext
 # define DCNGETTEXT __dcngettext
 #else
-# define NGETTEXT ngettext__
-# define DCNGETTEXT dcngettext__
+# define NGETTEXT libintl_ngettext
+# define DCNGETTEXT libintl_dcngettext
 #endif
 
 /* Look up MSGID in the current default message catalog for the current
diff --git a/intl/plural-exp.h b/intl/plural-exp.h
index 25b7c8b8aa..75c702f79c 100644
--- a/intl/plural-exp.h
+++ b/intl/plural-exp.h
@@ -22,7 +22,7 @@
 #define _PLURAL_EXP_H
 
 #ifndef PARAMS
-# if __STDC__
+# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
 #  define PARAMS(args) args
 # else
 #  define PARAMS(args) ()
@@ -33,6 +33,10 @@
 # define internal_function
 #endif
 
+#ifndef attribute_hidden
+# define attribute_hidden
+#endif
+
 
 /* This is the representation of the expressions to determine the
    plural form.  */
@@ -95,10 +99,10 @@ struct parse_args
 # define GERMANIC_PLURAL __gettext_germanic_plural
 # define EXTRACT_PLURAL_EXPRESSION __gettext_extract_plural
 #elif defined (IN_LIBINTL)
-# define FREE_EXPRESSION gettext_free_exp__
-# define PLURAL_PARSE gettextparse__
-# define GERMANIC_PLURAL gettext_germanic_plural__
-# define EXTRACT_PLURAL_EXPRESSION gettext_extract_plural__
+# define FREE_EXPRESSION libintl_gettext_free_exp
+# define PLURAL_PARSE libintl_gettextparse
+# define GERMANIC_PLURAL libintl_gettext_germanic_plural
+# define EXTRACT_PLURAL_EXPRESSION libintl_gettext_extract_plural
 #else
 # define FREE_EXPRESSION free_plural_expression
 # define PLURAL_PARSE parse_plural_expression
@@ -106,10 +110,6 @@ struct parse_args
 # define EXTRACT_PLURAL_EXPRESSION extract_plural_expression
 #endif
 
-#ifndef attribute_hidden
-# define attribute_hidden
-#endif
-
 extern void FREE_EXPRESSION PARAMS ((struct expression *exp))
      internal_function;
 extern int PLURAL_PARSE PARAMS ((void *arg));
@@ -119,4 +119,9 @@ extern void EXTRACT_PLURAL_EXPRESSION PARAMS ((const char *nullentry,
 					       unsigned long int *npluralsp))
      internal_function;
 
+#if !defined (_LIBC) && !defined (IN_LIBINTL)
+extern unsigned long int plural_eval PARAMS ((struct expression *pexp,
+					      unsigned long int n));
+#endif
+
 #endif /* _PLURAL_EXP_H */
diff --git a/intl/textdomain.c b/intl/textdomain.c
index ecaafb63fa..1c23e94d76 100644
--- a/intl/textdomain.c
+++ b/intl/textdomain.c
@@ -45,8 +45,8 @@
    names than the internal variables in GNU libc, otherwise programs
    using libintl.a cannot be linked statically.  */
 #if !defined _LIBC
-# define _nl_default_default_domain _nl_default_default_domain__
-# define _nl_current_default_domain _nl_current_default_domain__
+# define _nl_default_default_domain libintl_nl_default_default_domain
+# define _nl_current_default_domain libintl_nl_current_default_domain
 #endif
 
 /* @@ end of prolog @@ */
@@ -68,7 +68,7 @@ extern const char *_nl_current_default_domain attribute_hidden;
 #  define strdup(str) __strdup (str)
 # endif
 #else
-# define TEXTDOMAIN textdomain__
+# define TEXTDOMAIN libintl_textdomain
 #endif
 
 /* Lock variable to protect the global data in the gettext implementation.  */