From 92f3773b4c90ee2752ff391b7b6081eea10b4bca Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 6 Jun 1996 06:05:11 +0000 Subject: Thu Jun 6 02:00:42 1996 Roland McGrath * Makerules (distinfo-vars): Don't write constant line to frob sources. * Make-dist (sources): Append $(elided-routines) and $(extra-libs) routines. --- ChangeLog | 6 +++++ Make-dist | 3 +++ Makerules | 1 - intl/dcgettext.c | 33 ++++++++++++++++---------- intl/finddomain.c | 23 +++++++++--------- intl/l10nflist.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++------- intl/loadinfo.h | 50 +++++++++++++++++++++++---------------- 7 files changed, 133 insertions(+), 53 deletions(-) diff --git a/ChangeLog b/ChangeLog index b482e8cc92..783ff05288 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Jun 6 02:00:42 1996 Roland McGrath + + * Makerules (distinfo-vars): Don't write constant line to frob sources. + * Make-dist (sources): Append $(elided-routines) and $(extra-libs) + routines. + Tue Jun 4 22:03:02 1996 Andreas Schwab * sysdeps/m68k/fpu/__math.h: Define long double versions of diff --git a/Make-dist b/Make-dist index 3f5a0e3183..bba703cb26 100644 --- a/Make-dist +++ b/Make-dist @@ -62,6 +62,9 @@ all-headers := $(sort $(headers) $(wildcard $(all-headers))) endif foo:=$(shell echo 'IS THIS WORKING??? all-headers=$(all-headers)' >&2) +sources += $(addsuffix .c,$(elided-routines) \ + $(foreach l,$(extra-libs),$($l-routines))) + # Find all sysdep sources and headers. +maybe-sysdeps := $(sources) $(sources:.c=.s) $(sources:.c=.S) $(all-headers) \ $(filter %.c %.S %.s %.h %.sub,$(distribute)) diff --git a/Makerules b/Makerules index d770957bf2..36ad9d179f 100644 --- a/Makerules +++ b/Makerules @@ -797,7 +797,6 @@ $(foreach var,subdir subdir-dirs sources elided-routines sysdep_routines \ headers sysdep_headers distribute dont_distribute generated \ others tests extra-libs $(extra-libs:%=%-routines), echo >> $@.new '$(var) := $($(var))') -echo >> $@.new 'sources += $$(addsuffix .c,$$(elided-routines))' endef ifneq (,$(strip $(gpl2lgpl))) diff --git a/intl/dcgettext.c b/intl/dcgettext.c index ba3796d5e0..958b0d4cc4 100644 --- a/intl/dcgettext.c +++ b/intl/dcgettext.c @@ -97,6 +97,9 @@ char *getwd (); # else char *getcwd (); # endif +# ifndef HAVE_STPCPY +static char *stpcpy PARAMS ((char *dest, const char *src)); +# endif #endif /* Amount to increase buffer size by in each try. */ @@ -293,12 +296,7 @@ DCGETTEXT (domainname, msgid, category) we avoid the non-standard function stpcpy. In GNU C Library this function is available, though. Also allow the symbol HAVE_STPCPY to be defined. */ -#if defined _LIBC || defined HAVE_STPCPY stpcpy (stpcpy (strchr (dirname, '\0'), "/"), binding->dirname); -#else - strcat (dirname, "/"); - strcat (dirname, binding->dirname); -#endif } /* Now determine the symbolic name of CATEGORY and its value. */ @@ -312,16 +310,9 @@ DCGETTEXT (domainname, msgid, category) avoid the non-standard function stpcpy. In GNU C Library this function is available, though. Also allow the symbol HAVE_STPCPY to be defined. */ -#if defined _LIBC || defined HAVE_STPCPY stpcpy (stpcpy (stpcpy (stpcpy (xdomainname, categoryname), "/"), domainname), ".mo"); -#else - strcpy (xdomainname, categoryname); - strcat (xdomainname, "/"); - strcat (xdomainname, domainname); - strcat (xdomainname, ".mo"); -#endif /* Creating working area. */ single_locale = (char *) alloca (strlen (categoryvalue) + 1); @@ -586,3 +577,21 @@ static const char *guess_category_value (category, categoryname) return "C"; #endif } + +/* @@ begin of epilog @@ */ + +/* We don't want libintl.a to depend on any other library. So we + avoid the non-standard function stpcpy. In GNU C Library this + function is available, though. Also allow the symbol HAVE_STPCPY + to be defined. */ +#if !_LIBC && !HAVE_STPCPY +static char * +stpcpy (dest, src) + char *dest; + const char *src; +{ + while ((*dest++ = *src++) != '\0') + /* Do nothing. */ ; + return dest - 1; +} +#endif diff --git a/intl/finddomain.c b/intl/finddomain.c index bb4609e864..47bd0ab9f7 100644 --- a/intl/finddomain.c +++ b/intl/finddomain.c @@ -1,6 +1,9 @@ /* finddomain.c -- handle list of needed message catalogs -Copyright (C) 1995, 1996 Free Software Foundation, Inc. -Written by Ulrich Drepper , 1995. + Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Written by Ulrich Drepper , 1995. + +This file is part of the GNU C Library. Its master source is NOT part of +the C library, however. The master source lives in /gd/gnu/lib. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as @@ -14,8 +17,8 @@ Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ #ifdef HAVE_CONFIG_H # include @@ -66,17 +69,15 @@ void free (); because some ANSI C functions will require linking with this object file and the name space must not be polluted. */ # define stpcpy(dest, src) __stpcpy(dest, src) +#else +# ifndef HAVE_STPCPY +static char *stpcpy PARAMS ((char *dest, const char *src)); +# endif #endif /* List of already loaded domains. */ static struct loaded_l10nfile *_nl_loaded_domains; -/* Substitution for systems lacking this function in their C library. */ -#if !_LIBC && !HAVE_STPCPY -static char *stpcpy__ PARAMS ((char *dest, const char *src)); -# define stpcpy(dest, src) stpcpy__ (dest, src) -#endif - /* Return a data structure describing the message catalog described by the DOMAINNAME and CATEGORY parameters with respect to the currently @@ -208,7 +209,7 @@ _nl_find_domain (dirname, locale, domainname) to be defined. */ #if !_LIBC && !HAVE_STPCPY static char * -stpcpy__ (dest, src) +stpcpy (dest, src) char *dest; const char *src; { diff --git a/intl/l10nflist.c b/intl/l10nflist.c index 798728c3b1..8add175601 100644 --- a/intl/l10nflist.c +++ b/intl/l10nflist.c @@ -19,20 +19,50 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#if defined _LIBC || (defined __ARGZ_COUNT && defined __ARGZ_STRINGIFY) +#ifdef HAVE_CONFIG_H +# include +#endif + +#if defined _LIBC && (defined __ARGZ_COUNT || defined __ARGZ_STRINGIFY) # include #endif #include -#include -#include + +#if defined STDC_HEADERS || defined _LIBC +# include +#endif + +#if defined HAVE_STRING_H || defined _LIBC +# include +#else +# include +#endif +#if !HAVE_STRCHR && !defined _LIBC +# ifndef strchr +# define strchr index +# endif +#endif #include "loadinfo.h" +/* @@ end of prolog @@ */ + +#ifdef _LIBC +/* Rename the non ANSI C functions. This is required by the standard + because some ANSI C functions will require linking with this object + file and the name space must not be polluted. */ +# define stpcpy(dest, src) __stpcpy(dest, src) +#else +# ifndef HAVE_STPCPY +static char *stpcpy PARAMS ((char *dest, const char *src)); +# endif +#endif + /* Define function which are usually not available. */ #if !defined _LIBC && !defined __ARGZ_COUNT /* Returns the number of strings in ARGZ. */ -static size_t __argz_count __P ((const char *argz, size_t len)); +static size_t __argz_count PARAMS ((const char *argz, size_t len)); static size_t __argz_count (argz, len) @@ -42,7 +72,7 @@ __argz_count (argz, len) size_t count = 0; while (len > 0) { - size_t part_len = strlen(argz); + size_t part_len = strlen (argz); argz += part_len + 1; len -= part_len + 1; count++; @@ -54,7 +84,7 @@ __argz_count (argz, len) #if !defined _LIBC && !defined __ARGZ_STRINGIFY /* Make '\0' separated arg vector ARGZ printable by converting all the '\0's except the last into the character SEP. */ -static void __argz_stringify __P ((char *argz, size_t len, int sep)); +static void __argz_stringify PARAMS ((char *argz, size_t len, int sep)); static void __argz_stringify (argz, len, sep) @@ -64,7 +94,7 @@ __argz_stringify (argz, len, sep) { while (len > 0) { - size_t part_len = strlen(argz); + size_t part_len = strlen (argz); argz += part_len; len -= part_len + 1; if (len > 0) @@ -75,7 +105,10 @@ __argz_stringify (argz, len, sep) #if !defined _LIBC && !defined __ARGZ_NEXT static char * -__argz_next (char *argz, size_t argz_len, const char *entry) +__argz_next (argz, argz_len, entry) + char *argz; + size_t argz_len; + const char *entry; { if (entry) { @@ -94,7 +127,7 @@ __argz_next (char *argz, size_t argz_len, const char *entry) /* Return number of bits set in X. */ -static int pop __P ((int x)); +static int pop PARAMS ((int x)); static inline int pop (x) @@ -329,3 +362,22 @@ _nl_normalize_codeset (codeset, name_len) return (const char *) retval; } + + +/* @@ begin of epilog @@ */ + +/* We don't want libintl.a to depend on any other library. So we + avoid the non-standard function stpcpy. In GNU C Library this + function is available, though. Also allow the symbol HAVE_STPCPY + to be defined. */ +#if !_LIBC && !HAVE_STPCPY +static char * +stpcpy (dest, src) + char *dest; + const char *src; +{ + while ((*dest++ = *src++) != '\0') + /* Do nothing. */ ; + return dest - 1; +} +#endif diff --git a/intl/loadinfo.h b/intl/loadinfo.h index 00aa1c9d85..c67c2eb2e8 100644 --- a/intl/loadinfo.h +++ b/intl/loadinfo.h @@ -1,3 +1,11 @@ +#ifndef PARAMS +# if __STDC__ +# define PARAMS(args) args +# else +# define PARAMS(args) () +# endif +#endif + /* Encoding of locale name parts. */ #define CEN_REVISION 1 #define CEN_SPONSOR 2 @@ -24,25 +32,27 @@ struct loaded_l10nfile }; -extern const char *_nl_normalize_codeset __P ((const char *codeset, - size_t name_len)); +extern const char *_nl_normalize_codeset PARAMS ((const char *codeset, + size_t name_len)); extern struct loaded_l10nfile * -_nl_make_l10nflist __P ((struct loaded_l10nfile **l10nfile_list, - const char *dirlist, size_t dirlist_len, int mask, - const char *language, const char *territory, - const char *codeset, const char *normalized_codeset, - const char *modifier, const char *special, - const char *sponsor, const char *revision, - const char *filename, int do_allocate)); - - -extern const char *_nl_expand_alias __P ((const char *name)); - -extern int _nl_explode_name __P ((char *name, const char **language, - const char **modifier, - const char **territory, - const char **codeset, - const char **normalized_codeset, - const char **special, const char **sponsor, - const char **revision)); +_nl_make_l10nflist PARAMS ((struct loaded_l10nfile **l10nfile_list, + const char *dirlist, size_t dirlist_len, int mask, + const char *language, const char *territory, + const char *codeset, + const char *normalized_codeset, + const char *modifier, const char *special, + const char *sponsor, const char *revision, + const char *filename, int do_allocate)); + + +extern const char *_nl_expand_alias PARAMS ((const char *name)); + +extern int _nl_explode_name PARAMS ((char *name, const char **language, + const char **modifier, + const char **territory, + const char **codeset, + const char **normalized_codeset, + const char **special, + const char **sponsor, + const char **revision)); -- cgit v1.2.3