From 49e522bfb8642bb31afc2a119b2538a6a6465996 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 21 Mar 1995 07:58:50 +0000 Subject: [PATCH] Tue Mar 21 00:14:27 1995 Roland McGrath * locale/loadlocale.c (_nl_load_locale): If LOCALE/LC_* is a directory, open LOCALE/LC_*/SYS_LC_* instead. * stdio/fpioconst.c, stdio/fpioconst.h, stdio/gmp-impl.h, stdio/gmp.h, stdio/longlong.h, stdio/mp_clz_tab.c, stdio/gen-mpn-copy: Files moved to stdlib. * stdio/Makefile: All mpn stuff moved to stdlib/Makefile. * stdio/printf_fp.c: Use ../stdlib to find fpioconst.h and gmp headers. * stdlib/strtod.c: Don't use ../stdio to find fpioconst.h and gmp headers. --- ChangeLog | 14 ++++++++ NEWS | 78 +++++++++++++++++++++++++++++------------- locale/loadlocale.c | 38 +++++++++++++------- stdio/Makefile | 59 ++------------------------------ stdio/printf_fp.c | 9 +++-- {stdio => stdlib}/fpioconst.c | 0 {stdio => stdlib}/fpioconst.h | 0 {stdio => stdlib}/gen-mpn-copy | 0 {stdio => stdlib}/gmp-impl.h | 0 {stdio => stdlib}/gmp.h | 0 {stdio => stdlib}/longlong.h | 0 {stdio => stdlib}/mp_clz_tab.c | 0 stdlib/strtod.c | 8 ++--- 13 files changed, 104 insertions(+), 102 deletions(-) rename {stdio => stdlib}/fpioconst.c (100%) rename {stdio => stdlib}/fpioconst.h (100%) rename {stdio => stdlib}/gen-mpn-copy (100%) rename {stdio => stdlib}/gmp-impl.h (100%) rename {stdio => stdlib}/gmp.h (100%) rename {stdio => stdlib}/longlong.h (100%) rename {stdio => stdlib}/mp_clz_tab.c (100%) diff --git a/ChangeLog b/ChangeLog index dfaaf62..fed93d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ +Tue Mar 21 00:14:27 1995 Roland McGrath + + * locale/loadlocale.c (_nl_load_locale): If LOCALE/LC_* is a + directory, open LOCALE/LC_*/SYS_LC_* instead. + Mon Mar 20 03:19:23 1995 Roland McGrath + * stdio/fpioconst.c, stdio/fpioconst.h, stdio/gmp-impl.h, + stdio/gmp.h, stdio/longlong.h, stdio/mp_clz_tab.c, + stdio/gen-mpn-copy: Files moved to stdlib. + * stdio/Makefile: All mpn stuff moved to stdlib/Makefile. + * stdio/printf_fp.c: Use ../stdlib to find fpioconst.h and gmp + headers. + * stdlib/strtod.c: Don't use ../stdio to find fpioconst.h and gmp + headers. + * Makefile (parent-mostlyclean): Don't use $(libc.a). (parent-clean): Use $(objpfx) to find sysd-*. * Rules (generated): Append dummy.o dummy.c. diff --git a/NEWS b/NEWS index cc2b89f..0e8cea0 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -GNU C Library NEWS -- history of user-visible changes. 24 February 1995 +GNU C Library NEWS -- history of user-visible changes. 21 March 1995 Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc. See the end for copying conditions. @@ -16,6 +16,50 @@ Version 1.10 of many files which contained only symbol aliases, reducing the size of the source and the compiled library; many other files were renamed to less cryptic names previously occupied by the symbol alias files. + There is a new header file and new library `-lelf' for + programs which operate on files in the ELF format. + +* Converted to Autoconf version 2, so `configure' has more options. + Run `configure --help' to see the details. + +* The library can now be configured to build profiling, highly-optimized + (but undebuggable), and/or shared libraries (ELF with GNU ld only). + The `--enable-profile', `--enable-omitfp', and `--enable-shared' + options to `configure' enable building these extra libraries. + The shared library is built by default when using both ELF and GNU ld. + +* The new functions `strtoq' and `strtouq' parse integer values from + strings, like `strtol' and `strtoul', but they return `long long int' and + `unsigned long long int' values, respectively (64-bit quantities). + +* The new functions `strtof' and `strtold' parse floating-point values from + strings, like `strtod', but they return `float' and `long double' values, + respectively (on some machines `double' and `long double' are the same). + +* Ulrich Drepper has contributed new implementations of the floating-point + printing and reading code used in the `printf' family of functions and + `strtod', `strtof', and `strtold'. These new functions are perfectly + accurate, and much faster than the old ones. + +* The new header defines an interface for accessing + various locale-dependent data (using the locale chosen with `setlocale'). + +* You can now use positional parameter specifications in format strings + for the `printf' and `scanf' families of functions. For example, + `printf ("Number %2$d, Mr %1$s\n", "Jones", 6);'' prints + ``Number 6, Mr Jones''. This is mainly useful when providing different + format strings for different languages, whose grammar may dictate + a different ordering of the values being printed. To support this + feature, the interface for `register_printf_handler' has changed; see + the header file . + +* The `printf' and `scanf' families of functions now understand a new + formatting flag for numeric conversions: the ' flag (e.g. %'d or %'f) says + to group numbers as indicated by the locale; for `scanf' and friends, this + says to accept as valid only a number with all the proper grouping + separators in the right places. In the default "C" locale, numbers are + not grouped; but locales for specific countries will define the usual + conventions (i.e. separate thousands with `,' in the US locale). * The pgrp functions have been regularized, slightly incompatibly but much less confusingly. The core functions are now `getpgid' and `setpgid', @@ -27,23 +71,12 @@ Version 1.10 * The new header file and suite of functions simplify programs that operate on directory trees. This code comes from 4.4 BSD. -* Converted to Autoconf version 2, so `configure' has more options. - Run `configure --help' to see the details. - * The resolver code has been updated from the BIND-4.9.3-BETA14 release. * The new function `malloc_find_object_address' finds the starting address of a malloc'd block, given any address within the block. This can be useful for debugging. -* The new functions `strtoq' and `strtouq' parse integer values from - strings, like `strtol' and `strtoul', but they return `long long int' and - `unsigned long long int' values, respectively (64-bit quantities). - -* The new functions `strtof' and `strtold' parse floating-point values from - strings, like `strtod', but they return `float' and `long double' values, - respectively (on some machines `double' and `long double' are the same). - * There is a new malloc debugging hook `__memalign_hook'. * There are new typedefs `ushort' for `unsigned short int' and `uint' for @@ -53,19 +86,18 @@ Version 1.10 * The `-lmcheck' library to enable standard malloc debugging hooks is now done differently, so that it works even without GNU ld. -* Ulrich Drepper has contributed new implementations of the floating-point - printing and reading code used in the `printf' family of functions and - `strtod', `strtof', and `strtold'. These new functions are perfectly - accurate, and much faster than the old ones. - -* The `printf' family of functions now understand a new formatting flag - for numeric conversions: the ' flag (e.g. %'d or %'f) says to group - numbers as indicated by the locale. In the default "C" locale, numbers - are not grouped; but locales for specific countries will define the - usual conventions (i.e. separate thousands with `,' in the US locale). - * New function `euidaccess' checks allowed access to a file like `access', but using the effective IDs instead of the real IDs. + +* The time zone data files have been updated for the latest and greatest + local time conventions of the countries of the world. + +* The new function `dirfd' extracts the file descriptor used by a DIR stream; + see . + +* The new functions `ecvt', `fcvt', and `gcvt' provide an obsolete interface + for formatting floating-point numbers. They are provided only for + compatibility; new programs should use `sprintf' instead. Version 1.09 diff --git a/locale/loadlocale.c b/locale/loadlocale.c index 7ad7a21..a8cf7d5 100644 --- a/locale/loadlocale.c +++ b/locale/loadlocale.c @@ -38,7 +38,6 @@ const size_t _nl_category_num_items[] = struct locale_data * _nl_load_locale (int category, char **name) { - char *file; int fd; struct { @@ -69,18 +68,31 @@ _nl_load_locale (int category, char **name) *name = (char *) "local"; } -/* XXX can't use asprintf here */ - if (asprintf (&file, "%s%s/%s", - strchr (*name, '/') != NULL ? "" : "/share/locale/", /* XXX */ - *name, _nl_category_names[category]) == -1) - return NULL; - - fd = __open (file, O_RDONLY); - free (file); - if (fd < 0) - return NULL; - if (__fstat (fd, &st) < 0) - goto puntfd; + { + const char localedir[] = "/share/locale/"; /* XXX */ + const char *catname = _nl_category_names[category]; + size_t namelen = strlen (*name); + size_t catlen = strlen (catname); + char file[sizeof localedir + namelen + catlen * 2 + 4]; + sprintf (file, "%s%s/%s", + strchr (*name, '/') != NULL ? "" : localedir, *name, catname); + fd = __open (file, O_RDONLY); + if (fd < 0) + return NULL; + if (__fstat (fd, &st) < 0) + goto puntfd; + if (S_ISDIR (st.st_mode)) + { + /* LOCALE/LC_* is a directory; open LOCALE/LC_*/SYS_LC_* instead. */ + __close (fd); + memcpy (stpcpy (strchr (file, '\0'), "SYS_"), catname, catlen); + fd = __open (file, O_RDONLY); + if (fd < 0) + return NULL; + if (__fstat (fd, &st) < 0) + goto puntfd; + } + } { /* Map in the file's data. */ diff --git a/stdio/Makefile b/stdio/Makefile index 5794261..64b0598 100644 --- a/stdio/Makefile +++ b/stdio/Makefile @@ -47,17 +47,8 @@ routines := \ remove rename \ memstream obstream \ internals sysd-stdio pipestream stdio_init libc_fatal - -# Several mpn functions from GNU MP are used by the printf_fp function. -mpn-routines := add_1 add_n addmul_1 cmp divmod divmod_1 udiv_qrnnd \ - lshift rshift mod_1 mul mul_1 mul_n sub_n submul_1 -mpn-headers = longlong.h gmp.h gmp-impl.h gmp-mparam.h asm-syntax.h - -routines := $(strip $(routines) $(mpn-routines)) \ - dbl2mpn ldbl2mpn \ - mpn2flt mpn2dbl mpn2ldbl -aux := errlist siglist defs glue mp_clz_tab fpioconst -distribute = $(mpn-headers) gen-mpn-copy _itoa.h fpioconst.h +aux := errlist siglist defs glue +distribute := _itoa.h tests := tst-printf tstscanf test_rdwr test-popen tstgetln test-fseek \ temptest tst-fileno test-fwrite \ @@ -66,49 +57,3 @@ tests := tst-printf tstscanf test_rdwr test-popen tstgetln test-fseek \ include ../Rules - - -ifdef gmp-srcdir - -gmp-srcdir := $(firstword $(filter-out ..//%,$(..)$(gmp-srcdir) $(gmp-srcdir))) - -# Copy the mpn source files we use from the GNU MP source directory. -# `gmp-srcdir' is set by doing `configure --with-gmp=DIR'. -# (Do not try this at home. You need an as yet unreleased version of GNU MP.) - -mpn-sysdep := $(addsuffix .c,$(mpn-routines)) \ - $(addsuffix .S,$(mpn-routines)) \ - $(addsuffix .s,$(mpn-routines)) gmp-mparam.h asm-syntax.h - -mpn-try := $(addprefix $(gmp-srcdir)/mpn/*/,$(mpn-sysdep)) -mpn-found := $(wildcard $(mpn-try)) -mpn-found := $(filter-out $(patsubst %.S,%.s,$(filter %.s,$(mpn-found))),\ - $(mpn-found)) - -include mpn-copy.mk -%.mk: gen-%; sh $< > $@ - -mpn-copy-1 := $(patsubst $(gmp-srcdir)/mpn/%,$(sysdep_dir)/%,$(mpn-found)) -mpn-copy-sysdep := $(mpn-copy-sysdep) $(mpn-copy-1) -$(mpn-copy-1): $(sysdep_dir)/%: $(ignore gmp2glibc.sed) $(gmp-srcdir)/mpn/% - $(gmp2glibc) - -mpn-stuff = $(mpn-copy-sysdep) $(mpn-copy) - -# chmod so I don't edit them by mistake. -define gmp2glibc -$(ignore sed -f $^ > $@-tmp) -cp $< $@-tmp -chmod a-w $@-tmp -mv -f $@-tmp $@ -endef - -mpn-copy = $(filter-out $(mpn-sysdep),$(mpn-headers) mp_clz_tab.c) -$(mpn-copy): %: $(ignore gmp2glibc.sed) $(gmp-srcdir)/%; $(gmp2glibc) - -.PHONY: copy-mpn clean-mpn -copy-mpn: $(mpn-stuff) -clean-mpn: - rm -f $(mpn-stuff) - -endif diff --git a/stdio/printf_fp.c b/stdio/printf_fp.c index 33fe427..28d13d6 100644 --- a/stdio/printf_fp.c +++ b/stdio/printf_fp.c @@ -29,9 +29,10 @@ Cambridge, MA 02139, USA. */ #include #include #include -#include -#include -#include +#include "../stdlib/gmp.h" +#include "../stdlib/gmp-impl.h" +#include "../stdlib/longlong.h" +#include "../stdlib/fpioconst.h" #include "../locale/localeinfo.h" #include #include @@ -119,8 +120,6 @@ extern mp_size_t __mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size, int *expt, int *is_neg, long double value); -#include "fpioconst.h" - static unsigned int guess_grouping (unsigned int intdig_max, const char *grouping, wchar_t sepchar); diff --git a/stdio/fpioconst.c b/stdlib/fpioconst.c similarity index 100% rename from stdio/fpioconst.c rename to stdlib/fpioconst.c diff --git a/stdio/fpioconst.h b/stdlib/fpioconst.h similarity index 100% rename from stdio/fpioconst.h rename to stdlib/fpioconst.h diff --git a/stdio/gen-mpn-copy b/stdlib/gen-mpn-copy similarity index 100% rename from stdio/gen-mpn-copy rename to stdlib/gen-mpn-copy diff --git a/stdio/gmp-impl.h b/stdlib/gmp-impl.h similarity index 100% rename from stdio/gmp-impl.h rename to stdlib/gmp-impl.h diff --git a/stdio/gmp.h b/stdlib/gmp.h similarity index 100% rename from stdio/gmp.h rename to stdlib/gmp.h diff --git a/stdio/longlong.h b/stdlib/longlong.h similarity index 100% rename from stdio/longlong.h rename to stdlib/longlong.h diff --git a/stdio/mp_clz_tab.c b/stdlib/mp_clz_tab.c similarity index 100% rename from stdio/mp_clz_tab.c rename to stdlib/mp_clz_tab.c diff --git a/stdlib/strtod.c b/stdlib/strtod.c index 78f480a..94f9da3 100644 --- a/stdlib/strtod.c +++ b/stdlib/strtod.c @@ -36,11 +36,11 @@ Cambridge, MA 02139, USA. */ #include "../locale/localeinfo.h" #include #include -#include "../stdio/gmp.h" -#include "../stdio/gmp-impl.h" +#include "gmp.h" +#include "gmp-impl.h" #include -#include "../stdio/longlong.h" -#include "../stdio/fpioconst.h" +#include "longlong.h" +#include "fpioconst.h" #define NDEBUG 1 #include -- 2.7.4