PERFORCE change 28387 for review
Juli Mallett
jmallett at FreeBSD.org
Sun Apr 6 19:48:18 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=28387
Change 28387 by jmallett at jmallett_dalek on 2003/04/06 19:48:08
IFC.
Affected files ...
.. //depot/projects/mips/Makefile.inc1#14 integrate
.. //depot/projects/mips/contrib/gdtoa/gdtoaimp.h#3 integrate
.. //depot/projects/mips/contrib/ipfilter/man/ipmon.8#3 integrate
.. //depot/projects/mips/gnu/usr.bin/binutils/ld/Makefile#2 integrate
.. //depot/projects/mips/gnu/usr.bin/binutils/libiberty/Makefile#4 integrate
.. //depot/projects/mips/kerberos5/lib/libasn1/Makefile#3 integrate
.. //depot/projects/mips/kerberos5/lib/libhdb/Makefile#3 integrate
.. //depot/projects/mips/lib/libc/alpha/_fpmath.h#3 integrate
.. //depot/projects/mips/lib/libc/gdtoa/Makefile.inc#2 integrate
.. //depot/projects/mips/lib/libc/gdtoa/_ldtoa.c#1 branch
.. //depot/projects/mips/lib/libc/i386/_fpmath.h#2 integrate
.. //depot/projects/mips/lib/libc/ia64/_fpmath.h#3 integrate
.. //depot/projects/mips/lib/libc/powerpc/_fpmath.h#2 integrate
.. //depot/projects/mips/lib/libc/sparc64/_fpmath.h#2 integrate
.. //depot/projects/mips/lib/libc/stdio/floatio.h#2 integrate
.. //depot/projects/mips/lib/libc/stdio/vfprintf.c#5 integrate
.. //depot/projects/mips/lib/libc/stdio/vfwprintf.c#5 integrate
.. //depot/projects/mips/lib/libncurses/Makefile#4 integrate
.. //depot/projects/mips/lib/libstand/printf.c#2 integrate
.. //depot/projects/mips/lib/libusbhid/libusbhid.h#2 integrate
.. //depot/projects/mips/lib/libusbhid/parse.c#2 integrate
.. //depot/projects/mips/lib/libusbhid/usage.c#2 integrate
.. //depot/projects/mips/share/man/man4/Makefile#13 integrate
.. //depot/projects/mips/share/man/man4/man4.i386/Makefile#3 integrate
.. //depot/projects/mips/share/man/man4/man4.i386/smapi.4#1 branch
.. //depot/projects/mips/share/man/man4/wlan.4#1 branch
.. //depot/projects/mips/share/mk/bsd.sys.mk#4 integrate
.. //depot/projects/mips/share/termcap/termcap.src#3 integrate
.. //depot/projects/mips/sys/boot/common/bootstrap.h#2 integrate
.. //depot/projects/mips/sys/cam/cam_periph.c#6 integrate
.. //depot/projects/mips/sys/dev/fxp/if_fxp.c#10 integrate
.. //depot/projects/mips/sys/dev/fxp/if_fxpreg.h#4 integrate
.. //depot/projects/mips/sys/dev/usb/usbdevs#9 integrate
.. //depot/projects/mips/sys/dev/usb/usbdevs.h#8 integrate
.. //depot/projects/mips/sys/dev/usb/usbdevs_data.h#8 integrate
.. //depot/projects/mips/sys/dev/usb/uvisor.c#5 integrate
.. //depot/projects/mips/sys/i386/i386/mp_clock.c#3 integrate
.. //depot/projects/mips/sys/i386/i386/swtch.s#4 integrate
.. //depot/projects/mips/sys/i386/isa/mca_machdep.c#3 delete
.. //depot/projects/mips/sys/i386/isa/mca_machdep.h#2 delete
.. //depot/projects/mips/sys/ia64/ia64/exception.s#6 integrate
.. //depot/projects/mips/sys/ia64/ia64/locore.s#4 integrate
.. //depot/projects/mips/sys/ia64/ia64/sscdisk.c#8 integrate
.. //depot/projects/mips/sys/kern/kern_physio.c#5 integrate
.. //depot/projects/mips/sys/kern/link_elf.c#7 integrate
.. //depot/projects/mips/sys/kern/vfs_aio.c#10 integrate
.. //depot/projects/mips/sys/kern/vfs_bio.c#14 integrate
.. //depot/projects/mips/sys/pci/if_xl.c#10 integrate
.. //depot/projects/mips/sys/sparc64/include/cpufunc.h#3 integrate
.. //depot/projects/mips/sys/sparc64/include/md_var.h#2 integrate
.. //depot/projects/mips/sys/sparc64/include/pmap.h#6 integrate
.. //depot/projects/mips/sys/sparc64/sparc64/machdep.c#9 integrate
.. //depot/projects/mips/sys/sparc64/sparc64/pmap.c#10 integrate
.. //depot/projects/mips/sys/ufs/ffs/ffs_rawread.c#2 integrate
.. //depot/projects/mips/sys/vm/vm_pager.c#3 integrate
.. //depot/projects/mips/tools/build/Makefile#1 branch
.. //depot/projects/mips/tools/build/Makefile.boot#1 branch
.. //depot/projects/mips/tools/build/dummy.c#1 branch
.. //depot/projects/mips/tools/build/endian.h#1 branch
.. //depot/projects/mips/tools/build/langinfo.h#1 branch
.. //depot/projects/mips/tools/build/progname.c#1 branch
.. //depot/projects/mips/tools/regression/lib/libc/stdio/Makefile#2 integrate
.. //depot/projects/mips/tools/regression/lib/libc/stdio/test-printfloat.c#1 branch
.. //depot/projects/mips/usr.bin/tip/libacu/courier.c#2 integrate
.. //depot/projects/mips/usr.bin/tip/libacu/df.c#2 integrate
.. //depot/projects/mips/usr.bin/tip/libacu/hayes.c#2 integrate
.. //depot/projects/mips/usr.bin/tip/libacu/t3000.c#2 integrate
.. //depot/projects/mips/usr.bin/tip/tip/cmds.c#2 integrate
.. //depot/projects/mips/usr.bin/tip/tip/cmdtab.c#2 integrate
.. //depot/projects/mips/usr.bin/tip/tip/tip.c#2 integrate
.. //depot/projects/mips/usr.bin/tip/tip/tip.h#2 integrate
.. //depot/projects/mips/usr.bin/tip/tip/value.c#2 integrate
.. //depot/projects/mips/usr.bin/xargs/xargs.c#7 integrate
.. //depot/projects/mips/usr.bin/xinstall/Makefile#3 integrate
.. //depot/projects/mips/usr.sbin/rtadvd/config.c#4 integrate
.. //depot/projects/mips/usr.sbin/wicontrol/wicontrol.8#6 integrate
.. //depot/projects/mips/usr.sbin/wicontrol/wicontrol.c#5 integrate
Differences ...
==== //depot/projects/mips/Makefile.inc1#14 (text+ko) ====
@@ -1,5 +1,5 @@
#
-# $FreeBSD: src/Makefile.inc1,v 1.331 2003/04/04 22:46:08 imp Exp $
+# $FreeBSD: src/Makefile.inc1,v 1.339 2003/04/07 00:01:33 ru Exp $
#
# Make command line options:
# -DMAKE_KERBEROS5 to build Kerberos5
@@ -159,15 +159,19 @@
#
# Building a world goes through the following stages
#
-# 1. bootstrap-tool stage [BMAKE]
+# 1. legacy stage [BMAKE]
+# This stage is responsible for creating compatibility
+# shims that are needed by the bootstrap-tools,
+# build-tools and cross-tools stages.
+# 1. bootstrap-tools stage [BMAKE]
# This stage is responsible for creating programs that
# are needed for backward compatibility reasons. They
# are not built as cross-tools.
-# 2. build-tool stage [TMAKE]
+# 2. build-tools stage [TMAKE]
# This stage is responsible for creating the object
# tree and building any tools that are needed during
# the build process.
-# 3. cross-tool stage [XMAKE]
+# 3. cross-tools stage [XMAKE]
# This stage is responsible for creating any tools that
# are needed for cross-builds. A cross-compiler is one
# of them.
@@ -186,23 +190,24 @@
GROFF_FONT_PATH=${WORLDTMP}/usr/share/groff_font \
GROFF_TMAC_PATH=${WORLDTMP}/usr/share/tmac
-# bootstrap-tool stage
-BMAKEENV= MAKEOBJDIRPREFIX=${WORLDTMP} \
- DESTDIR= \
- INSTALL="sh ${.CURDIR}/tools/install.sh"
-BMAKE= ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
+# bootstrap-tools stage
+BMAKEENV= DESTDIR= \
+ INSTALL="sh ${.CURDIR}/tools/install.sh" \
+ __MAKE_CONF=${.CURDIR}/tools/build/Makefile.boot \
+ OLD_MAKE_CONF=${__MAKE_CONF} \
+ WORLDTMP=${WORLDTMP}
+BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
+ ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
BOOTSTRAPPING=${OSRELDATE} \
-DNOHTML -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \
-DNO_CPU_CFLAGS -DNO_WARNS
-# build-tool stage
-TMAKEENV= MAKEOBJDIRPREFIX=${OBJTREE} \
- DESTDIR= \
- INSTALL="sh ${.CURDIR}/tools/install.sh"
-TMAKE= ${TMAKEENV} ${MAKE} -f Makefile.inc1 \
+# build-tools stage
+TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
+ ${BMAKEENV} ${MAKE} -f Makefile.inc1 \
BOOTSTRAPPING=${OSRELDATE} -DNO_CPU_CFLAGS -DNO_WARNS
-# cross-tool stage
+# cross-tools stage
XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} -DNO_FORTRAN -DNO_GDB
# world stage
@@ -264,6 +269,7 @@
.if !defined(NOCLEAN)
rm -rf ${WORLDTMP}
.else
+ rm -rf ${WORLDTMP}/legacy/usr/include
# XXX - These two can depend on any header file.
rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c
rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c
@@ -275,6 +281,15 @@
mkdir -p ${WORLDTMP}/usr/include/${_dir}
.endfor
ln -sf ${.CURDIR}/sys ${WORLDTMP}
+.for _dir in lib include/sys
+ mkdir -p ${WORLDTMP}/legacy/usr/${_dir}
+.endfor
+_legacy:
+ @echo
+ @echo "--------------------------------------------------------------"
+ @echo ">>> stage 1: legacy release compatibility shims"
+ @echo "--------------------------------------------------------------"
+ cd ${.CURDIR}; ${BMAKE} legacy
_bootstrap-tools:
@echo
@echo "--------------------------------------------------------------"
@@ -335,7 +350,7 @@
WMAKE_TGTS=
.if !defined(SUBDIR_OVERRIDE)
-WMAKE_TGTS+= _worldtmp _bootstrap-tools
+WMAKE_TGTS+= _worldtmp _legacy _bootstrap-tools
.endif
WMAKE_TGTS+= _cleanobj _obj _build-tools
.if !defined(SUBDIR_OVERRIDE)
@@ -607,6 +622,19 @@
#
#
+# legacy: Build compatibility shims for the next three targets
+#
+legacy:
+.for _tool in tools/build
+ @${ECHODIR} "===> ${_tool}"; \
+ cd ${.CURDIR}/${_tool}; \
+ ${MAKE} DIRPRFX=${_tool}/ obj; \
+ ${MAKE} DIRPRFX=${_tool}/ depend; \
+ ${MAKE} DIRPRFX=${_tool}/ all; \
+ ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
+.endfor
+
+#
# bootstrap-tools: Build tools needed for compatibility
#
.if exists(${.CURDIR}/games) && !defined(NOGAMES)
==== //depot/projects/mips/contrib/gdtoa/gdtoaimp.h#3 (text+ko) ====
@@ -26,7 +26,7 @@
****************************************************************/
-/* $FreeBSD: src/contrib/gdtoa/gdtoaimp.h,v 1.3 2003/03/19 20:25:45 das Exp $ */
+/* $FreeBSD: src/contrib/gdtoa/gdtoaimp.h,v 1.4 2003/04/05 22:09:26 das Exp $ */
/* This is a variation on dtoa.c that converts arbitary binary
floating-point formats to and from decimal notation. It uses
@@ -600,6 +600,8 @@
extern Bigint *diff ANSI((Bigint*, Bigint*));
extern char *dtoa ANSI((double d, int mode, int ndigits,
int *decpt, int *sign, char **rve));
+ extern char *gdtoa ANSI((FPI *fpi, int be, ULong *bits, int *kindp,
+ int mode, int ndigits, int *decpt, char **rve));
extern char *g__fmt ANSI((char*, char*, char*, int, ULong));
extern int gethex ANSI((CONST char**, FPI*, Long*, Bigint**, int));
extern void hexdig_init_D2A(Void);
==== //depot/projects/mips/contrib/ipfilter/man/ipmon.8#3 (text+ko) ====
@@ -1,4 +1,4 @@
-.\" $FreeBSD: src/contrib/ipfilter/man/ipmon.8,v 1.12 2003/02/15 06:32:48 darrenr Exp $
+.\" $FreeBSD: src/contrib/ipfilter/man/ipmon.8,v 1.13 2003/04/05 21:12:58 darrenr Exp $
.TH ipmon 8
.SH NAME
ipmon \- monitors /dev/ipl for logged packets
@@ -126,7 +126,7 @@
.B \-s
Packet information read in will be sent through syslogd rather than
saved to a file. The default facility when compiled and installed is
-\fBlocal0\fP. The following levels are used:
+\fBsecurity\fP. The following levels are used:
.IP
.B LOG_INFO
\- packets logged using the "log" keyword as the action rather
==== //depot/projects/mips/gnu/usr.bin/binutils/ld/Makefile#2 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/gnu/usr.bin/binutils/ld/Makefile,v 1.23 2002/07/29 09:40:08 ru Exp $
+# $FreeBSD: src/gnu/usr.bin/binutils/ld/Makefile,v 1.24 2003/04/05 20:30:29 imp Exp $
.include "../Makefile.inc0"
@@ -10,20 +10,12 @@
ldgram.y ldlang.c ldlex.l ldmain.c ldmisc.c \
ldver.c ldwrite.c lexsup.c mri.c
-.if defined(BOOTSTRAPPING) && !exists(/usr/include/elf-hints.h)
-SRCS+= elf-hints.h
-CLEANFILES+= elf-hints.h
-
-elf-hints.h:
- ln -sf ${.CURDIR}/../../../../include/${.TARGET} .
-.endif
-
WARNS= 1
CFLAGS+= -DSCRIPTDIR=\"${TOOLS_PREFIX}/usr/libdata\"
CFLAGS+= -DBFD_VERSION_STRING=\"${VERSION}\"
CFLAGS+= -I${SRCDIR}/ld -I${SRCDIR}/bfd
NOSHARED?= yes
-DPADD= ${RELTOP}/libbfd/libbfd.a
+DPADD+= ${RELTOP}/libbfd/libbfd.a
DPADD+= ${RELTOP}/libiberty/libiberty.a
LDADD= ${DPADD}
CLEANDIRS+= ldscripts
==== //depot/projects/mips/gnu/usr.bin/binutils/libiberty/Makefile#4 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/gnu/usr.bin/binutils/libiberty/Makefile,v 1.17 2002/11/13 13:49:29 ru Exp $
+# $FreeBSD: src/gnu/usr.bin/binutils/libiberty/Makefile,v 1.18 2003/04/05 20:30:29 imp Exp $
.include "../Makefile.inc0"
@@ -10,12 +10,7 @@
hex.c floatformat.c hashtab.c lbasename.c make-temp-file.c \
objalloc.c obstack.c safe-ctype.c xatexit.c xexit.c xmalloc.c \
xstrdup.c xstrerror.c
-.if defined(BOOTSTRAPPING) && \
- ( ${BOOTSTRAPPING} < 440000 || \
- ( ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500022 ))
-SRCS+= basename.c
-.endif
-WARNS?= 1
+WARNS= 1
CFLAGS+= -DHAVE_CONFIG_H
INTERNALLIB= true
==== //depot/projects/mips/kerberos5/lib/libasn1/Makefile#3 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/kerberos5/lib/libasn1/Makefile,v 1.17 2002/11/13 13:49:29 ru Exp $
+# $FreeBSD: src/kerberos5/lib/libasn1/Makefile,v 1.18 2003/04/05 20:30:29 imp Exp $
LIB= asn1
CFLAGS+=-I${KRB5DIR}/include \
@@ -104,13 +104,7 @@
print_version.o \
get_window_size.c \
strupr.c
- ${CC} ${CFLAGS} ${.OODATE} -o ${.TARGET}
-
-.if defined(BOOTSTRAPPING) && \
- ( ${BOOTSTRAPPING} < 440001 || \
- ( ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500023 ))
-asn1_compile: getprogname.c setprogname.c
-.endif
+ ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.OODATE} ${LDADD}
parse.o: parse.c roken.h
==== //depot/projects/mips/kerberos5/lib/libhdb/Makefile#3 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/kerberos5/lib/libhdb/Makefile,v 1.10 2002/11/13 13:49:29 ru Exp $
+# $FreeBSD: src/kerberos5/lib/libhdb/Makefile,v 1.11 2003/04/05 20:30:29 imp Exp $
LIB= hdb
CFLAGS+=-I${KRB5DIR}/include \
@@ -59,13 +59,7 @@
gen_encode.c gen_decode.c gen_free.c gen_length.c \
gen_copy.c gen_glue.c getarg.c warnerr.c print_version.o \
get_window_size.c strupr.c
- ${CC} ${CFLAGS} ${.OODATE} -o ${.TARGET}
-
-.if defined(BOOTSTRAPPING) && \
- ( ${BOOTSTRAPPING} < 440001 || \
- ( ${BOOTSTRAPPING} >= 500000 && ${BOOTSTRAPPING} < 500023 ))
-asn1_compile: getprogname.c setprogname.c
-.endif
+ ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.OODATE} ${LDADD}
parse.o: parse.c
==== //depot/projects/mips/lib/libc/alpha/_fpmath.h#3 (text+ko) ====
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libc/alpha/_fpmath.h,v 1.2 2003/02/11 15:19:31 des Exp $
+ * $FreeBSD: src/lib/libc/alpha/_fpmath.h,v 1.3 2003/04/05 22:10:13 das Exp $
*/
union IEEEl2bits {
@@ -37,3 +37,9 @@
};
#define mask_nbit_l(u) ((void)0)
+#define LDBL_IMPLICIT_NBIT
+
+#define LDBL_TO_ARRAY32(u, a) do { \
+ (a)[0] = (uint32_t)(u).bits.manl; \
+ (a)[1] = (uint32_t)(u).bits.manh; \
+} while(0)
==== //depot/projects/mips/lib/libc/gdtoa/Makefile.inc#2 (text+ko) ====
@@ -1,9 +1,9 @@
-# $FreeBSD: src/lib/libc/gdtoa/Makefile.inc,v 1.2 2003/03/13 18:55:14 obrien Exp $
+# $FreeBSD: src/lib/libc/gdtoa/Makefile.inc,v 1.3 2003/04/05 22:10:13 das Exp $
# netlib gdtoa sources
.PATH: ${.CURDIR}/gdtoa
-MISRCS+=glue.c
+MISRCS+=_ldtoa.c glue.c
GDTOASRCS=dmisc.c dtoa.c gdtoa.c gethex.c gmisc.c \
hd_init.c hexnan.c misc.c smisc.c \
strtoIg.c strtod.c strtodg.c strtof.c strtord.c sum.c ulp.c
==== //depot/projects/mips/lib/libc/i386/_fpmath.h#2 (text+ko) ====
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libc/i386/_fpmath.h,v 1.1 2003/02/08 20:37:52 mike Exp $
+ * $FreeBSD: src/lib/libc/i386/_fpmath.h,v 1.2 2003/04/05 22:10:13 das Exp $
*/
union IEEEl2bits {
@@ -38,3 +38,8 @@
};
#define mask_nbit_l(u) ((u).bits.manh &= 0x7fffffff)
+
+#define LDBL_TO_ARRAY32(u, a) do { \
+ (a)[0] = (uint32_t)(u).bits.manl; \
+ (a)[1] = (uint32_t)(u).bits.manh; \
+} while(0)
==== //depot/projects/mips/lib/libc/ia64/_fpmath.h#3 (text+ko) ====
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libc/ia64/_fpmath.h,v 1.2 2003/02/26 16:04:34 mike Exp $
+ * $FreeBSD: src/lib/libc/ia64/_fpmath.h,v 1.3 2003/04/05 22:10:13 das Exp $
*/
#include <sys/endian.h>
@@ -53,3 +53,8 @@
#else /* _BIG_ENDIAN */
#define mask_nbit_l(u) ((u).bits.manh &= 0xffffff7f)
#endif
+
+#define LDBL_TO_ARRAY32(u, a) do { \
+ (a)[0] = (uint32_t)(u).bits.manl; \
+ (a)[1] = (uint32_t)(u).bits.manh; \
+} while(0)
==== //depot/projects/mips/lib/libc/powerpc/_fpmath.h#2 (text+ko) ====
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libc/powerpc/_fpmath.h,v 1.1 2003/02/08 20:37:53 mike Exp $
+ * $FreeBSD: src/lib/libc/powerpc/_fpmath.h,v 1.2 2003/04/05 22:10:13 das Exp $
*/
union IEEEl2bits {
@@ -38,3 +38,11 @@
/* XXX does powerpc have a normalization bit? */
#define mask_nbit_l(u) ((void)0)
+#define LDBL_IMPLICIT_NBIT
+
+#define LDBL_TO_ARRAY32(u, a) do { \
+ (a)[0] = (uint32_t)(u).bits.manl; \
+ (a)[1] = (uint32_t)((u).bits.manl >> 32); \
+ (a)[2] = (uint32_t)(u).bits.manh; \
+ (a)[3] = (uint32_t)((u).bits.manh >> 32); \
+} while(0)
==== //depot/projects/mips/lib/libc/sparc64/_fpmath.h#2 (text+ko) ====
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libc/sparc64/_fpmath.h,v 1.1 2003/02/08 20:37:54 mike Exp $
+ * $FreeBSD: src/lib/libc/sparc64/_fpmath.h,v 1.2 2003/04/05 22:10:13 das Exp $
*/
union IEEEl2bits {
@@ -38,3 +38,11 @@
};
#define mask_nbit_l(u) ((void)0)
+#define LDBL_IMPLICIT_NBIT
+
+#define LDBL_TO_ARRAY32(u, a) do { \
+ (a)[0] = (uint32_t)(u).bits.manl; \
+ (a)[1] = (uint32_t)((u).bits.manl >> 32); \
+ (a)[2] = (uint32_t)(u).bits.manh; \
+ (a)[3] = (uint32_t)((u).bits.manh >> 32); \
+} while(0)
==== //depot/projects/mips/lib/libc/stdio/floatio.h#2 (text+ko) ====
@@ -34,14 +34,23 @@
* SUCH DAMAGE.
*
* @(#)floatio.h 8.1 (Berkeley) 6/4/93
- * $FreeBSD: src/lib/libc/stdio/floatio.h,v 1.2 2002/03/22 23:42:01 obrien Exp $
+ * $FreeBSD: src/lib/libc/stdio/floatio.h,v 1.4 2003/04/05 22:11:42 das Exp $
*/
/*
* Floating point scanf/printf (input/output) definitions.
*/
-/* 11-bit exponent (VAX G floating point) is 308 decimal digits */
-#define MAXEXP 308
-/* 128 bit fraction takes up 39 decimal digits; max reasonable precision */
-#define MAXFRACT 39
+/*
+ * MAXEXPDIG is the maximum number of decimal digits needed to store a
+ * floating point exponent in the largest supported format. It should
+ * be ceil(log10(LDBL_MAX_10_EXP)) or, if hexadecimal floating point
+ * conversions are supported, ceil(log10(LDBL_MAX_EXP)). But since it
+ * is presently never greater than 5 in practice, we fudge it.
+ */
+#define MAXEXPDIG 6
+#if LDBL_MAX_EXP > 999999
+#error "floating point buffers too small"
+#endif
+
+char *__ldtoa(long double *, int, int, int *, int *, char **);
==== //depot/projects/mips/lib/libc/stdio/vfprintf.c#5 (text+ko) ====
@@ -38,7 +38,7 @@
static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/vfprintf.c,v 1.52 2003/03/14 04:48:09 das Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdio/vfprintf.c,v 1.56 2003/04/07 01:07:48 das Exp $");
/*
* Actual printf innards.
@@ -111,9 +111,9 @@
static int __sprint(FILE *, struct __suio *);
static int __sbprintf(FILE *, const char *, va_list) __printflike(2, 0);
-static char *__ujtoa(uintmax_t, char *, int, int, char *, int, char,
+static char *__ujtoa(uintmax_t, char *, int, int, const char *, int, char,
const char *);
-static char *__ultoa(u_long, char *, int, int, char *, int, char,
+static char *__ultoa(u_long, char *, int, int, const char *, int, char,
const char *);
static char *__wcsconv(wchar_t *, int);
static void __find_arguments(const char *, va_list, union arg **);
@@ -185,7 +185,7 @@
* use the given digits.
*/
static char *
-__ultoa(u_long val, char *endp, int base, int octzero, char *xdigs,
+__ultoa(u_long val, char *endp, int base, int octzero, const char *xdigs,
int needgrp, char thousep, const char *grp)
{
char *cp = endp;
@@ -262,7 +262,7 @@
/* Identical to __ultoa, but for intmax_t. */
static char *
-__ujtoa(uintmax_t val, char *endp, int base, int octzero, char *xdigs,
+__ujtoa(uintmax_t val, char *endp, int base, int octzero, const char *xdigs,
int needgrp, char thousep, const char *grp)
{
char *cp = endp;
@@ -407,23 +407,29 @@
}
#ifdef FLOATING_POINT
+
+#define dtoa __dtoa
+#define freedtoa __freedtoa
+
+#include <float.h>
#include <math.h>
#include "floatio.h"
+#include "gdtoa.h"
-#define BUF ((MAXEXP*2)+MAXFRACT+1) /* + decimal point */
#define DEFPREC 6
-extern char *__dtoa(double, int, int, int *, int *, char **);
-extern void __freedtoa(char *s);
-
-static char *cvt(double, int, int, char *, int *, int, int *);
static int exponent(char *, int, int);
-#else /* no FLOATING_POINT */
+#endif /* FLOATING_POINT */
-#define BUF 136
-
-#endif /* FLOATING_POINT */
+/*
+ * The size of the buffer we use as scratch space for integer
+ * conversions, among other things. Technically, we would need the
+ * most space for base 10 conversions with thousands' grouping
+ * characters between each pair of digits. 100 bytes is a
+ * conservative overestimate even for a 128-bit uintmax_t.
+ */
+#define BUF 100
#define STATIC_ARG_TBL_SIZE 8 /* Size of static argument table. */
@@ -431,7 +437,6 @@
* Flags used during conversion.
*/
#define ALT 0x001 /* alternate form */
-#define HEXPREFIX 0x002 /* add 0x or 0X prefix */
#define LADJUST 0x004 /* left adjustment */
#define LONGDBL 0x008 /* long double */
#define LONGINT 0x010 /* long integer */
@@ -460,19 +465,41 @@
int flags; /* flags as above */
int ret; /* return value accumulator */
int width; /* width from format (%8d), or 0 */
- int prec; /* precision from format (%.3d), or -1 */
+ int prec; /* precision from format; <0 for N/A */
char sign; /* sign prefix (' ', '+', '-', or \0) */
char thousands_sep; /* locale specific thousands separator */
const char *grouping; /* locale specific numeric grouping rules */
#ifdef FLOATING_POINT
+ /*
+ * We can decompose the printed representation of floating
+ * point numbers into several parts, some of which may be empty:
+ *
+ * [+|-| ] [0x|0X] MMM . NNN [e|E|p|P] [+|-] ZZ
+ * A B ---C--- D E F
+ *
+ * A: 'sign' holds this value if present; '\0' otherwise
+ * B: ox[1] holds the 'x' or 'X'; '\0' if not hexadecimal
+ * C: cp points to the string MMMNNN. Leading and trailing
+ * zeros are not in the string and must be added.
+ * D: expchar holds this character; '\0' if no exponent, e.g. %f
+ * F: at least two digits for decimal, at least one digit for hex
+ */
char *decimal_point; /* locale specific decimal point */
- char softsign; /* temporary negative sign for floats */
- double _double; /* double precision arguments %[eEfgG] */
+ int signflag; /* true if float is negative */
+ union { /* floating point arguments %[aAeEfFgG] */
+ double dbl;
+ long double ldbl;
+ } fparg;
int expt; /* integer value of exponent */
+ char expchar; /* exponent character: [eEpP\0] */
+ char *dtoaend; /* pointer to end of converted digits */
int expsize; /* character count for expstr */
- int ndig; /* actual number of digits returned by cvt */
- char expstr[7]; /* buffer for exponent string */
+ int lead; /* sig figs before decimal or group sep */
+ int ndig; /* actual number of digits returned by dtoa */
+ char expstr[MAXEXPDIG+2]; /* buffer for exponent string: e+ZZZ */
char *dtoaresult; /* buffer allocated by dtoa */
+ int nseps; /* number of group separators with ' */
+ int nrepeats; /* number of repeats of the last group */
#endif
u_long ulval; /* integer arguments %[diouxX] */
uintmax_t ujval; /* %j, %ll, %q, %t, %z integers */
@@ -481,12 +508,12 @@
int realsz; /* field size expanded by dprec, sign, etc */
int size; /* size of converted field or string */
int prsize; /* max size of printed field */
- char *xdigs; /* digits for [xX] conversion */
+ const char *xdigs; /* digits for %[xX] conversion */
#define NIOV 8
struct __suio uio; /* output information: summary */
struct __siov iov[NIOV];/* ... and individual io vectors */
- char buf[BUF]; /* space for %c, %[diouxX], %[eEfFgG] */
- char ox[2]; /* space for 0x hex-prefix */
+ char buf[BUF]; /* buffer with space for digits of uintmax_t */
+ char ox[2]; /* space for 0x; ox[1] is either x, X, or \0 */
union arg *argtable; /* args, built due to positional arg */
union arg statargtable [STATIC_ARG_TBL_SIZE];
int nextarg; /* 1-based argument index */
@@ -504,6 +531,9 @@
static char zeroes[PADSIZE] =
{'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'};
+ static const char xdigs_lower[16] = "0123456789abcdef";
+ static const char xdigs_upper[16] = "0123456789ABCDEF";
+
/*
* BEWARE, these `goto error' on error, and PAD uses `n'.
*/
@@ -527,6 +557,14 @@
PRINT(with, n); \
} \
}
+#define PRINTANDPAD(p, ep, len, with) do { \
+ n2 = (ep) - (p); \
+ if (n2 > (len)) \
+ n2 = (len); \
+ if (n2 > 0) \
+ PRINT((p), n2); \
+ PAD((len) - (n2 > 0 ? n2 : 0), (with)); \
+} while(0)
#define FLUSH() { \
if (uio.uio_resid && __sprint(fp, &uio)) \
goto error; \
@@ -643,6 +681,7 @@
width = 0;
prec = -1;
sign = '\0';
+ ox[1] = '\0';
rflag: ch = *fmt++;
reswitch: switch (ch) {
@@ -683,16 +722,14 @@
goto rflag;
case '.':
if ((ch = *fmt++) == '*') {
- GETASTER (n);
- prec = n < 0 ? -1 : n;
+ GETASTER (prec);
goto rflag;
}
- n = 0;
+ prec = 0;
while (is_digit(ch)) {
- n = 10 * n + to_digit(ch);
+ prec = 10 * prec + to_digit(ch);
ch = *fmt++;
}
- prec = n < 0 ? -1 : n;
goto reswitch;
case '0':
/*-
@@ -797,86 +834,122 @@
#ifdef HEXFLOAT
case 'a':
case 'A':
+ if (ch == 'a') {
+ ox[1] = 'x';
+ xdigs = xdigs_lower;
+ expchar = 'p';
+ } else {
+ ox[1] = 'X';
+ xdigs = xdigs_upper;
+ expchar = 'P';
+ }
+ /*
+ * XXX We don't actually have a conversion
+ * XXX routine for this yet.
+ */
+ if (flags & LONGDBL) {
+ fparg.ldbl = (double)GETARG(long double);
+ dtoaresult = cp =
+ __hldtoa(fparg.ldbl, xdigs, prec,
+ &expt, &signflag, &dtoaend);
+ } else {
+ fparg.dbl = GETARG(double);
+ dtoaresult = cp =
+ __hdtoa(fparg.dbl, xdigs, prec,
+ &expt, &signflag, &dtoaend);
+ }
+ goto fp_begin;
#endif
case 'e':
case 'E':
- /*-
- * Grouping apply to %i, %d, %u, %f, %F, %g, %G
- * conversion specifiers only. For other conversions
- * behavior is undefined.
- * -- POSIX
- */
- flags &= ~GROUPING;
- /*FALLTHROUGH*/
+ expchar = ch;
+ if (prec < 0) /* account for digit before decpt */
+ prec = DEFPREC + 1;
+ else
+ prec++;
+ goto fp_begin;
case 'f':
case 'F':
+ expchar = '\0';
goto fp_begin;
case 'g':
case 'G':
+ expchar = ch - ('g' - 'e');
if (prec == 0)
prec = 1;
-fp_begin: if (prec == -1)
+fp_begin:
+ if (prec < 0)
prec = DEFPREC;
- if (flags & LONGDBL)
- /* XXX this loses precision. */
- _double = (double)GETARG(long double);
- else
- _double = GETARG(double);
- /* do this before tricky precision changes */
- if (isinf(_double)) {
- if (_double < 0)
- sign = '-';
- if (isupper(ch))
- cp = "INF";
- else
- cp = "inf";
- size = 3;
- break;
+ if (dtoaresult != NULL)
+ freedtoa(dtoaresult);
+ if (flags & LONGDBL) {
+ fparg.ldbl = GETARG(long double);
+ dtoaresult = cp =
+ __ldtoa(&fparg.ldbl, expchar ? 2 : 3, prec,
+ &expt, &signflag, &dtoaend);
+ } else {
+ fparg.dbl = GETARG(double);
+ dtoaresult = cp =
+ dtoa(fparg.dbl, expchar ? 2 : 3, prec,
+ &expt, &signflag, &dtoaend);
+ if (expt == 9999)
+ expt = INT_MAX;
}
- if (isnan(_double)) {
- if (isupper(ch))
- cp = "NAN";
- else
- cp = "nan";
+ if (signflag)
+ sign = '-';
+ if (expt == INT_MAX) { /* inf or nan */
+ if (*cp == 'N') {
+ cp = (ch >= 'a') ? "nan" : "NAN";
+ sign = '\0';
+ } else
+ cp = (ch >= 'a') ? "inf" : "INF";
size = 3;
break;
}
flags |= FPT;
- if (dtoaresult != NULL) {
- __freedtoa(dtoaresult);
- dtoaresult = NULL;
- }
- dtoaresult = cp = cvt(_double, prec, flags, &softsign,
- &expt, ch, &ndig);
+ ndig = dtoaend - cp;
if (ch == 'g' || ch == 'G') {
- if (expt <= -4 || expt > prec)
- ch = (ch == 'g') ? 'e' : 'E';
- else
- ch = 'g';
+ if (expt > -4 && expt <= prec) {
+ /* Make %[gG] smell like %[fF] */
+ expchar = '\0';
+ if (flags & ALT)
+ prec -= expt;
+ else
+ prec = ndig - expt;
+ if (prec < 0)
+ prec = 0;
+ }
}
- if (ch == 'e' || ch == 'E') {
- --expt;
- expsize = exponent(expstr, expt, ch);
- size = expsize + ndig;
- if (ndig > 1 || flags & ALT)
+ if (expchar) {
+ expsize = exponent(expstr, expt - 1, expchar);
+ size = expsize + prec;
+ if (prec > 1 || flags & ALT)
++size;
- } else if (ch == 'f' || ch == 'F') {
+ } else {
if (expt > 0) {
size = expt;
if (prec || flags & ALT)
size += prec + 1;
} else /* "0.X" */
size = prec + 2;
- } else if (expt >= ndig) { /* fixed g fmt */
- size = expt;
- if (flags & ALT)
- ++size;
- } else
- size = ndig + (expt > 0 ?
- 1 : 2 - expt);
-
- if (softsign)
- sign = '-';
+ if (grouping && expt > 0) {
+ /* space for thousands' grouping */
+ nseps = nrepeats = 0;
+ lead = expt;
+ while (*grouping != CHAR_MAX) {
+ if (lead <= *grouping)
+ break;
+ lead -= *grouping;
+ if (*(grouping+1)) {
+ nseps++;
+ grouping++;
+ } else
+ nrepeats++;
+ }
+ size += nseps + nrepeats;
+ } else
+ lead = expt;
+ }
break;
#endif /* FLOATING_POINT */
case 'n':
@@ -922,9 +995,9 @@
*/
ujval = (uintmax_t)(uintptr_t)GETARG(void *);
base = 16;
- xdigs = "0123456789abcdef";
- flags = flags | INTMAXT | HEXPREFIX;
- ch = 'x';
+ xdigs = xdigs_lower;
+ flags = flags | INTMAXT;
+ ox[1] = 'x';
goto nosign;
case 'S':
flags |= LONGINT;
@@ -976,10 +1049,10 @@
base = 10;
goto nosign;
case 'X':
- xdigs = "0123456789ABCDEF";
+ xdigs = xdigs_upper;
goto hex;
case 'x':
- xdigs = "0123456789abcdef";
+ xdigs = xdigs_lower;
hex:
if (flags & INTMAX_SIZE)
ujval = UJARG();
@@ -989,7 +1062,7 @@
/* leading 0x/X only if non-zero */
if (flags & ALT &&
(flags & INTMAX_SIZE ? ujval != 0 : ulval != 0))
- flags |= HEXPREFIX;
+ ox[1] = ch;
flags &= ~GROUPING;
/* unsigned conversions */
@@ -1022,6 +1095,8 @@
grouping);
}
size = buf + BUF - cp;
+ if (size > BUF) /* should never happen */
+ abort();
break;
default: /* "%?" prints ?, unless ? is NUL */
if (ch == '\0')
@@ -1051,7 +1126,7 @@
realsz = dprec > size ? dprec : size;
if (sign)
realsz++;
- else if (flags & HEXPREFIX)
+ else if (ox[1])
realsz += 2;
prsize = width > realsz ? width : realsz;
@@ -1067,9 +1142,8 @@
/* prefix */
if (sign) {
PRINT(&sign, 1);
- } else if (flags & HEXPREFIX) {
+ } else if (ox[1]) { /* ox[1] is either x, X, or \0 */
ox[0] = '0';
- ox[1] = ch;
PRINT(ox, 2);
}
@@ -1085,40 +1159,45 @@
if ((flags & FPT) == 0) {
PRINT(cp, size);
} else { /* glue together f_p fragments */
- if (ch >= 'f') { /* 'f' or 'g' */
- if (_double == 0) {
- /* kludge for __dtoa irregularity */
- PRINT("0", 1);
- if (expt < ndig || (flags & ALT) != 0) {
- PRINT(decimal_point, 1);
- PAD(ndig - 1, zeroes);
- }
- } else if (expt <= 0) {
- PRINT("0", 1);
- PRINT(decimal_point, 1);
+ if (!expchar) { /* %[fF] or sufficiently short %[gG] */
+ if (expt <= 0) {
+ buf[0] = '0';
+ buf[1] = *decimal_point;
+ PRINT(buf, 2);
PAD(-expt, zeroes);
- PRINT(cp, ndig);
- } else if (expt >= ndig) {
- PRINT(cp, ndig);
- PAD(expt - ndig, zeroes);
- if (flags & ALT)
- PRINT(decimal_point, 1);
+ /* already handled initial 0's */
+ prec += expt;
} else {
- PRINT(cp, expt);
- cp += expt;
- PRINT(decimal_point, 1);
- PRINT(cp, ndig-expt);
+ PRINTANDPAD(cp, dtoaend, lead, zeroes);
+ cp += lead;
+ if (grouping) {
+ while (nseps>0 || nrepeats>0) {
+ if (nrepeats > 0)
+ nrepeats--;
+ else {
+ grouping--;
+ nseps--;
+ }
+ PRINT(&thousands_sep,
+ 1);
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list