about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1995-02-20 09:50:50 +0000
committerRoland McGrath <roland@gnu.org>1995-02-20 09:50:50 +0000
commit0923c7a543d377bae9da0ad7075c8f9664ae70dc (patch)
tree7fba8f9a64d1aa1a457537d8f08819ed8c1a6cf4
parent9c97d688c1798d080a42e024eda0fc6e681aa97f (diff)
downloadglibc-0923c7a543d377bae9da0ad7075c8f9664ae70dc.tar.gz
glibc-0923c7a543d377bae9da0ad7075c8f9664ae70dc.tar.xz
glibc-0923c7a543d377bae9da0ad7075c8f9664ae70dc.zip
Mon Feb 20 04:04:57 1995 Roland McGrath <roland@duality.gnu.ai.mit.edu>
	* config.h.in [HAVE_ELF || HAVE_GNU_LD]: Define HAVE_WEAK_SYMBOLS.

	* stdlib/strtod.c (PASTE, PASTE1): New helper macros; use these in
 	access to float.h macros.

	* misc/efgcvt.c: New file.
	* misc/Makefile (routines): Add efgcvt.
-rw-r--r--ChangeLog10
-rw-r--r--config.h.in7
-rw-r--r--misc/efgcvt.c72
-rw-r--r--stdlib/strtod.c17
-rw-r--r--sysdeps/mach/hurd/Makefile3
-rw-r--r--sysdeps/mach/hurd/errnos.awk3
6 files changed, 103 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index b056ee7ca8..959da903a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Mon Feb 20 04:04:57 1995  Roland McGrath  <roland@duality.gnu.ai.mit.edu>
+
+	* config.h.in [HAVE_ELF || HAVE_GNU_LD]: Define HAVE_WEAK_SYMBOLS.
+
+	* stdlib/strtod.c (PASTE, PASTE1): New helper macros; use these in
+ 	access to float.h macros.
+
+	* misc/efgcvt.c: New file.
+	* misc/Makefile (routines): Add efgcvt.
+
 Sun Feb 19 20:10:43 1995  Brendan Kehoe  <brendan@zen.org>
 
 	* sysdeps/sparc/mul.S: Renamed to `dotmul.S'.
diff --git a/config.h.in b/config.h.in
index 5761db2c5c..504f77021e 100644
--- a/config.h.in
+++ b/config.h.in
@@ -13,6 +13,13 @@
 
 /* Define if using the GNU assembler, gas.  */
 #undef	HAVE_GNU_AS
+
+/* ELF has weak symbols, and with GNU ld a.out does too.  */
+#ifndef HAVE_WEAK_SYMBOLS
+#if defined (HAVE_ELF) || defined (HAVE_GNU_LD)
+#define HAVE_WEAK_SYMBOLS
+#endif
+#endif
 
 /* These symbols might be defined by some sysdeps configures.  */
 
diff --git a/misc/efgcvt.c b/misc/efgcvt.c
new file mode 100644
index 0000000000..64734757e3
--- /dev/null
+++ b/misc/efgcvt.c
@@ -0,0 +1,72 @@
+/* [efg]cvt -- compatibility functions for floating point formatting
+Copyright (C) 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+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
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+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., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <math.h>
+
+char *
+fcvt (value, ndigit, decpt, sign)
+     double value;
+     int ndigit, *decpt, *sign;
+{
+  static char buf[100];
+  int n, i;
+
+  *sign = value < 0.0;
+  if (*sign)
+    value = - value;
+
+  n = snprintf (buf, sizeof buf, "%.*f", ndigit, value);
+  if (n < 0)
+    return NULL;
+
+  i = 0;
+  while (i < n && isdigit (buf[i]))
+    ++i;
+  *decpt = i;
+  do
+    ++i;
+  while (! isdigit (buf[i]));
+  memmove (&buf[i - *decpt], buf, n - (i - *decpt));
+
+  return buf;
+}
+
+char *
+ecvt (value, ndigit, decpt, sign)
+     double value;
+     int ndigit, *decpt, *sign;
+{
+  ndigit -= (int) floor (log10 (value));
+  if (ndigit < 0)
+    ndigit = 0;
+  return fcvt (value, ndigit, decpt, sign);
+}
+
+char *
+gcvt (value, ndigit, buf)
+     double value;
+     int ndigit;
+     char *buf;
+{
+  sprintf (buf, "%.*g", ndigit, value);
+  return buf;
+}
diff --git a/stdlib/strtod.c b/stdlib/strtod.c
index d647753e79..6bd2dd685a 100644
--- a/stdlib/strtod.c
+++ b/stdlib/strtod.c
@@ -47,13 +47,16 @@ Cambridge, MA 02139, USA.  */
 
 
 /* Constants we need from float.h; select the set for the FLOAT precision.  */
-#define MANT_DIG	FLT##_MANT_DIG
-#define	MAX_EXP		FLT##_MAX_EXP
-#define	MIN_EXP		FLT##_MIN_EXP
-#define MAX_10_EXP	FLT##_MAX_10_EXP
-#define MIN_10_EXP	FLT##_MIN_10_EXP
-#define	MAX_10_EXP_LOG	FLT##_MAX_10_EXP_LOG
-
+#define MANT_DIG	PASTE(FLT,_MANT_DIG)
+#define	MAX_EXP		PASTE(FLT,_MAX_EXP)
+#define	MIN_EXP		PASTE(FLT,_MIN_EXP)
+#define MAX_10_EXP	PASTE(FLT,_MAX_10_EXP)
+#define MIN_10_EXP	PASTE(FLT,_MIN_10_EXP)
+#define	MAX_10_EXP_LOG	PASTE(FLT,_MAX_10_EXP_LOG)
+
+/* Extra macros required to get FLT expanded before the pasting.  */
+#define PASTE(a,b)	PASTE1(a,b)
+#define PASTE1(a,b)	a##b
 
 /* Function to construct a floating point number from an MP integer
    containing the fraction bits, a base 2 exponent, and a sign flag.  */
diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile
index 70b6ec5d49..02430faed9 100644
--- a/sysdeps/mach/hurd/Makefile
+++ b/sysdeps/mach/hurd/Makefile
@@ -108,7 +108,8 @@ $(objpfx)stamp-errnos: $(hurd)/errnos.awk $(errno.texinfo) \
 # Make it unwritable so noone will edit it by mistake.
 	-chmod a-w $(hurd)/errnos.h-tmp
 	./$(..)move-if-change $(hurd)/errnos.h-tmp $(hurd)/errnos.h
-	test -d CVS && cvs commit -m'Regenerated from $^' $@
+	test -d CVS && \
+	  (cd $(hurd); cvs commit -m'Regenerated from $^' errnos.h)
 	touch $@
 
 $(hurd)/errlist.c: $(hurd)/errlist.awk $(errno.texinfo)
diff --git a/sysdeps/mach/hurd/errnos.awk b/sysdeps/mach/hurd/errnos.awk
index a6b251f211..a8029987b5 100644
--- a/sysdeps/mach/hurd/errnos.awk
+++ b/sysdeps/mach/hurd/errnos.awk
@@ -1,4 +1,4 @@
-# Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
+# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -20,6 +20,7 @@
 # @comment errno.h
 # @comment POSIX.1: Function not implemented
 # @deftypevr Macro int ENOSYS
+# @comment errno 123
 
 BEGIN {
     printf "/* This file generated by";