Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/machine/powerpc')
-rw-r--r--newlib/libc/machine/powerpc/Makefile.am25
-rw-r--r--newlib/libc/machine/powerpc/Makefile.in340
-rw-r--r--newlib/libc/machine/powerpc/aclocal.m4324
-rw-r--r--newlib/libc/machine/powerpc/atosfix16.c102
-rw-r--r--newlib/libc/machine/powerpc/atosfix32.c25
-rw-r--r--newlib/libc/machine/powerpc/atosfix64.c25
-rw-r--r--newlib/libc/machine/powerpc/atoufix16.c102
-rw-r--r--newlib/libc/machine/powerpc/atoufix32.c25
-rw-r--r--newlib/libc/machine/powerpc/atoufix64.c25
-rwxr-xr-xnewlib/libc/machine/powerpc/configure1880
-rw-r--r--newlib/libc/machine/powerpc/configure.in27
-rw-r--r--newlib/libc/machine/powerpc/fix64.h80
-rw-r--r--newlib/libc/machine/powerpc/machine/malloc.h20
-rw-r--r--newlib/libc/machine/powerpc/machine/stdlib.h65
-rw-r--r--newlib/libc/machine/powerpc/setjmp.S190
-rw-r--r--newlib/libc/machine/powerpc/simdldtoa.c3715
-rw-r--r--newlib/libc/machine/powerpc/strtosfix16.c206
-rw-r--r--newlib/libc/machine/powerpc/strtosfix32.c100
-rw-r--r--newlib/libc/machine/powerpc/strtosfix64.c113
-rw-r--r--newlib/libc/machine/powerpc/strtoufix16.c197
-rw-r--r--newlib/libc/machine/powerpc/strtoufix32.c97
-rw-r--r--newlib/libc/machine/powerpc/strtoufix64.c115
-rw-r--r--newlib/libc/machine/powerpc/times.c36
-rw-r--r--newlib/libc/machine/powerpc/ufix64toa.c88
-rw-r--r--newlib/libc/machine/powerpc/vec_calloc.c66
-rw-r--r--newlib/libc/machine/powerpc/vec_free.c15
-rw-r--r--newlib/libc/machine/powerpc/vec_malloc.c132
-rw-r--r--newlib/libc/machine/powerpc/vec_mallocr.c424
-rw-r--r--newlib/libc/machine/powerpc/vec_realloc.c17
-rw-r--r--newlib/libc/machine/powerpc/vfprintf.c1430
-rw-r--r--newlib/libc/machine/powerpc/vfscanf.c1336
31 files changed, 0 insertions, 11342 deletions
diff --git a/newlib/libc/machine/powerpc/Makefile.am b/newlib/libc/machine/powerpc/Makefile.am
deleted file mode 100644
index 917f79e8e..000000000
--- a/newlib/libc/machine/powerpc/Makefile.am
+++ /dev/null
@@ -1,25 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-AUTOMAKE_OPTIONS = cygnus
-
-INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S times.c
-lib_a_LIBADD = @extra_objs@
-EXTRA_lib_a_SOURCES = @extra_sources@
-lib_a_DEPENDENCIES = @extra_objs@
-
-ACLOCAL_AMFLAGS = -I ../../..
-AM_CFLAGS = -I $(srcdir)/../../stdio -I $(srcdir)/../../stdlib
-CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
-
-VEC_MALLOC_COMPILE = $(COMPILE) -DINTERNAL_NEWLIB
-
-vec_reallocr.o: vec_mallocr.c
- $(VEC_MALLOC_COMPILE) -DDEFINE_VECREALLOC -c $(srcdir)/vec_mallocr.c -o $@
-
-vec_callocr.o: vec_mallocr.c
- $(VEC_MALLOC_COMPILE) -DDEFINE_VECCALLOC -c $(srcdir)/vec_mallocr.c -o $@
-
diff --git a/newlib/libc/machine/powerpc/Makefile.in b/newlib/libc/machine/powerpc/Makefile.in
deleted file mode 100644
index 5da27f71e..000000000
--- a/newlib/libc/machine/powerpc/Makefile.in
+++ /dev/null
@@ -1,340 +0,0 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
-
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-
-SHELL = @SHELL@
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
-
-DESTDIR =
-
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-
-top_builddir = .
-
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_alias = @build_alias@
-build_triplet = @build@
-host_alias = @host_alias@
-host_triplet = @host@
-target_alias = @target_alias@
-target_triplet = @target@
-AR = @AR@
-AS = @AS@
-CC = @CC@
-CPP = @CPP@
-EXEEXT = @EXEEXT@
-LDFLAGS = @LDFLAGS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-NEWLIB_CFLAGS = @NEWLIB_CFLAGS@
-OBJEXT = @OBJEXT@
-PACKAGE = @PACKAGE@
-RANLIB = @RANLIB@
-VERSION = @VERSION@
-aext = @aext@
-extra_objs = @extra_objs@
-extra_sources = @extra_sources@
-libm_machine_dir = @libm_machine_dir@
-machine_dir = @machine_dir@
-newlib_basedir = @newlib_basedir@
-oext = @oext@
-sys_dir = @sys_dir@
-
-AUTOMAKE_OPTIONS = cygnus
-
-INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
-
-noinst_LIBRARIES = lib.a
-
-lib_a_SOURCES = setjmp.S times.c
-lib_a_LIBADD = @extra_objs@
-EXTRA_lib_a_SOURCES = @extra_sources@
-lib_a_DEPENDENCIES = @extra_objs@
-
-ACLOCAL_AMFLAGS = -I ../../..
-AM_CFLAGS = -I $(srcdir)/../../stdio -I $(srcdir)/../../stdlib
-CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
-
-VEC_MALLOC_COMPILE = $(COMPILE) -DINTERNAL_NEWLIB
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../mkinstalldirs
-CONFIG_CLEAN_FILES =
-LIBRARIES = $(noinst_LIBRARIES)
-
-
-DEFS = @DEFS@ -I. -I$(srcdir)
-CPPFLAGS = @CPPFLAGS@
-LIBS = @LIBS@
-lib_a_OBJECTS = setjmp.o times.o
-CFLAGS = @CFLAGS@
-COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
-DIST_COMMON = Makefile.am Makefile.in aclocal.m4 configure configure.in
-
-
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-
-TAR = gtar
-GZIP_ENV = --best
-SOURCES = $(lib_a_SOURCES) $(EXTRA_lib_a_SOURCES)
-OBJECTS = $(lib_a_OBJECTS)
-
-all: all-redirect
-.SUFFIXES:
-.SUFFIXES: .S .c .o .s
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && $(AUTOMAKE) --cygnus Makefile
-
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- cd $(top_builddir) \
- && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in \
- ../../../acinclude.m4 ../../../aclocal.m4 \
- ../../../libtool.m4
- cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
-
-config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- $(SHELL) ./config.status --recheck
-$(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
- cd $(srcdir) && $(AUTOCONF)
-
-mostlyclean-noinstLIBRARIES:
-
-clean-noinstLIBRARIES:
- -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
-
-distclean-noinstLIBRARIES:
-
-maintainer-clean-noinstLIBRARIES:
-
-.c.o:
- $(COMPILE) -c $<
-
-.s.o:
- $(COMPILE) -c $<
-
-.S.o:
- $(COMPILE) -c $<
-
-mostlyclean-compile:
- -rm -f *.o core *.core
-
-clean-compile:
-
-distclean-compile:
- -rm -f *.tab.c
-
-maintainer-clean-compile:
-
-lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES)
- -rm -f lib.a
- $(AR) cru lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD)
- $(RANLIB) lib.a
-
-tags: TAGS
-
-ID: $(HEADERS) $(SOURCES) $(LISP)
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- here=`pwd` && cd $(srcdir) \
- && mkid -f$$here/ID $$unique $(LISP)
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
- tags=; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS)'; \
- unique=`for i in $$list; do echo $$i; done | \
- awk ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
-
-mostlyclean-tags:
-
-clean-tags:
-
-distclean-tags:
- -rm -f TAGS ID
-
-maintainer-clean-tags:
-
-distdir = $(PACKAGE)-$(VERSION)
-top_distdir = $(distdir)
-
-# This target untars the dist file and tries a VPATH configuration. Then
-# it guarantees that the distribution is self-contained by making another
-# tarfile.
-distcheck: dist
- -rm -rf $(distdir)
- GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
- mkdir $(distdir)/=build
- mkdir $(distdir)/=inst
- dc_install_base=`cd $(distdir)/=inst && pwd`; \
- cd $(distdir)/=build \
- && ../configure --srcdir=.. --prefix=$$dc_install_base \
- && $(MAKE) $(AM_MAKEFLAGS) \
- && $(MAKE) $(AM_MAKEFLAGS) dvi \
- && $(MAKE) $(AM_MAKEFLAGS) check \
- && $(MAKE) $(AM_MAKEFLAGS) install \
- && $(MAKE) $(AM_MAKEFLAGS) installcheck \
- && $(MAKE) $(AM_MAKEFLAGS) dist
- -rm -rf $(distdir)
- @banner="$(distdir).tar.gz is ready for distribution"; \
- dashes=`echo "$$banner" | sed s/./=/g`; \
- echo "$$dashes"; \
- echo "$$banner"; \
- echo "$$dashes"
-dist: distdir
- -chmod -R a+r $(distdir)
- GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
- -rm -rf $(distdir)
-dist-all: distdir
- -chmod -R a+r $(distdir)
- GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
- -rm -rf $(distdir)
-distdir: $(DISTFILES)
- -rm -rf $(distdir)
- mkdir $(distdir)
- -chmod 777 $(distdir)
- @for file in $(DISTFILES); do \
- if test -f $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- cp -pr $$d/$$file $(distdir)/$$file; \
- else \
- test -f $(distdir)/$$file \
- || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
- || cp -p $$d/$$file $(distdir)/$$file || :; \
- fi; \
- done
-info-am:
-info: info-am
-dvi-am:
-dvi: dvi-am
-check-am:
-check: check-am
-installcheck-am:
-installcheck: installcheck-am
-install-info-am:
-install-info: install-info-am
-install-exec-am:
-install-exec: install-exec-am
-
-install-data-am:
-install-data: install-data-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-install: install-am
-uninstall-am:
-uninstall: uninstall-am
-all-am: Makefile $(LIBRARIES)
-all-redirect: all-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
-installdirs:
-
-
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -rm -f Makefile $(CONFIG_CLEAN_FILES)
- -rm -f config.cache config.log stamp-h stamp-h[0-9]*
-
-maintainer-clean-generic:
-mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \
- mostlyclean-tags mostlyclean-generic
-
-mostlyclean: mostlyclean-am
-
-clean-am: clean-noinstLIBRARIES clean-compile clean-tags clean-generic \
- mostlyclean-am
-
-clean: clean-am
-
-distclean-am: distclean-noinstLIBRARIES distclean-compile \
- distclean-tags distclean-generic clean-am
-
-distclean: distclean-am
- -rm -f config.status
-
-maintainer-clean-am: maintainer-clean-noinstLIBRARIES \
- maintainer-clean-compile maintainer-clean-tags \
- maintainer-clean-generic distclean-am
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
-
-maintainer-clean: maintainer-clean-am
- -rm -f config.status
-
-.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
-clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
-mostlyclean-compile distclean-compile clean-compile \
-maintainer-clean-compile tags mostlyclean-tags distclean-tags \
-clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
-check-am installcheck-am installcheck install-info-am install-info \
-install-exec-am install-exec install-data-am install-data install-am \
-install uninstall-am uninstall all-redirect all-am all installdirs \
-mostlyclean-generic distclean-generic clean-generic \
-maintainer-clean-generic clean mostlyclean distclean maintainer-clean
-
-
-vec_reallocr.o: vec_mallocr.c
- $(VEC_MALLOC_COMPILE) -DDEFINE_VECREALLOC -c $(srcdir)/vec_mallocr.c -o $@
-
-vec_callocr.o: vec_mallocr.c
- $(VEC_MALLOC_COMPILE) -DDEFINE_VECCALLOC -c $(srcdir)/vec_mallocr.c -o $@
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/newlib/libc/machine/powerpc/aclocal.m4 b/newlib/libc/machine/powerpc/aclocal.m4
deleted file mode 100644
index 60622e841..000000000
--- a/newlib/libc/machine/powerpc/aclocal.m4
+++ /dev/null
@@ -1,324 +0,0 @@
-dnl aclocal.m4 generated automatically by aclocal 1.4
-
-dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-dnl PARTICULAR PURPOSE.
-
-dnl This provides configure definitions used by all the newlib
-dnl configure.in files.
-
-dnl Basic newlib configury. This calls basic introductory stuff,
-dnl including AM_INIT_AUTOMAKE and AC_CANONICAL_HOST. It also runs
-dnl configure.host. The only argument is the relative path to the top
-dnl newlib directory.
-
-AC_DEFUN(NEWLIB_CONFIGURE,
-[
-dnl Default to --enable-multilib
-AC_ARG_ENABLE(multilib,
-[ --enable-multilib build many library versions (default)],
-[case "${enableval}" in
- yes) multilib=yes ;;
- no) multilib=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
- esac], [multilib=yes])dnl
-
-dnl Support --enable-target-optspace
-AC_ARG_ENABLE(target-optspace,
-[ --enable-target-optspace optimize for space],
-[case "${enableval}" in
- yes) target_optspace=yes ;;
- no) target_optspace=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for target-optspace option) ;;
- esac], [target_optspace=])dnl
-
-dnl Support --enable-malloc-debugging - currently only supported for Cygwin
-AC_ARG_ENABLE(malloc-debugging,
-[ --enable-malloc-debugging indicate malloc debugging requested],
-[case "${enableval}" in
- yes) malloc_debugging=yes ;;
- no) malloc_debugging=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for malloc-debugging option) ;;
- esac], [malloc_debugging=])dnl
-
-dnl Support --enable-newlib-mb
-AC_ARG_ENABLE(newlib-mb,
-[ --enable-newlib-mb enable multibyte support],
-[case "${enableval}" in
- yes) newlib_mb=yes ;;
- no) newlib_mb=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for newlib-mb option) ;;
- esac], [newlib_mb=])dnl
-
-dnl Support --enable-newlib-multithread
-AC_ARG_ENABLE(newlib-multithread,
-[ --enable-newlib-multithread enable support for multiple threads],
-[case "${enableval}" in
- yes) newlib_multithread=yes ;;
- no) newlib_multithread=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for newlib-multithread option) ;;
- esac], [newlib_multithread=yes])dnl
-
-dnl Support --enable-newlib-elix-level
-AC_ARG_ENABLE(newlib-elix-level,
-[ --enable-newlib-elix-level supply desired elix library level (1-4)],
-[case "${enableval}" in
- 0) newlib_elix_level=0 ;;
- 1) newlib_elix_level=1 ;;
- 2) newlib_elix_level=2 ;;
- 3) newlib_elix_level=3 ;;
- 4) newlib_elix_level=4 ;;
- *) AC_MSG_ERROR(bad value ${enableval} for newlib-elix-level option) ;;
- esac], [newlib_elix_level=0])dnl
-
-dnl Support --disable-newlib-io-float
-AC_ARG_ENABLE(newlib-io-float,
-[ --disable-newlib-io-float disable printf/scanf family float support],
-[case "${enableval}" in
- yes) newlib_io_float=yes ;;
- no) newlib_io_float=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for newlib-io-float option) ;;
- esac], [newlib_io_float=yes])dnl
-
-
-dnl We may get other options which we don't document:
-dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
-
-test -z "[$]{with_target_subdir}" && with_target_subdir=.
-
-if test "[$]{srcdir}" = "."; then
- if test "[$]{with_target_subdir}" != "."; then
- newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
- else
- newlib_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
- fi
-else
- newlib_basedir="[$]{srcdir}/$1"
-fi
-AC_SUBST(newlib_basedir)
-
-AC_CANONICAL_SYSTEM
-
-AM_INIT_AUTOMAKE(newlib, 1.10.0)
-
-# FIXME: We temporarily define our own version of AC_PROG_CC. This is
-# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
-# are probably using a cross compiler, which will not be able to fully
-# link an executable. This should really be fixed in autoconf
-# itself.
-
-AC_DEFUN(LIB_AC_PROG_CC,
-[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-AC_CHECK_PROG(CC, gcc, gcc)
-if test -z "$CC"; then
- AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
- test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
-fi
-
-AC_PROG_CC_GNU
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-dnl Check whether -g works, even if CFLAGS is set, in case the package
-dnl plays around with CFLAGS (such as to build both debugging and
-dnl normal versions of a library), tasteless as that idea is.
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- AC_PROG_CC_G
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-O2"
- fi
-else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-])
-
-LIB_AC_PROG_CC
-
-AC_CHECK_TOOL(AS, as)
-AC_CHECK_TOOL(AR, ar)
-AC_CHECK_TOOL(RANLIB, ranlib, :)
-
-AC_PROG_INSTALL
-
-AM_MAINTAINER_MODE
-
-# We need AC_EXEEXT to keep automake happy in cygnus mode. However,
-# at least currently, we never actually build a program, so we never
-# need to use $(EXEEXT). Moreover, the test for EXEEXT normally
-# fails, because we are probably configuring with a cross compiler
-# which can't create executables. So we include AC_EXEEXT to keep
-# automake happy, but we don't execute it, since we don't care about
-# the result.
-if false; then
- AC_EXEEXT
-fi
-
-. [$]{newlib_basedir}/configure.host
-
-newlib_cflags="[$]{newlib_cflags} -fno-builtin"
-
-NEWLIB_CFLAGS=${newlib_cflags}
-AC_SUBST(NEWLIB_CFLAGS)
-
-LDFLAGS=${ldflags}
-AC_SUBST(LDFLAGS)
-
-AM_CONDITIONAL(ELIX_LEVEL_0, test x[$]{newlib_elix_level} = x0)
-AM_CONDITIONAL(ELIX_LEVEL_1, test x[$]{newlib_elix_level} = x1)
-AM_CONDITIONAL(ELIX_LEVEL_2, test x[$]{newlib_elix_level} = x2)
-AM_CONDITIONAL(ELIX_LEVEL_3, test x[$]{newlib_elix_level} = x3)
-AM_CONDITIONAL(ELIX_LEVEL_4, test x[$]{newlib_elix_level} = x4)
-
-AM_CONDITIONAL(USE_LIBTOOL, test x[$]{use_libtool} = xyes)
-
-# Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we
-# use oext, which is set in configure.host based on the target platform.
-OBJEXT=${oext}
-
-AC_SUBST(OBJEXT)
-AC_SUBST(oext)
-AC_SUBST(aext)
-
-AC_SUBST(libm_machine_dir)
-AC_SUBST(machine_dir)
-AC_SUBST(sys_dir)
-])
-
-# Do all the work for Automake. This macro actually does too much --
-# some checks are only needed if your package does certain things.
-# But this isn't really a big deal.
-
-# serial 1
-
-dnl Usage:
-dnl AM_INIT_AUTOMAKE(package,version, [no-define])
-
-AC_DEFUN(AM_INIT_AUTOMAKE,
-[AC_REQUIRE([AC_PROG_INSTALL])
-PACKAGE=[$1]
-AC_SUBST(PACKAGE)
-VERSION=[$2]
-AC_SUBST(VERSION)
-dnl test to see if srcdir already configured
-if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
- AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
-fi
-ifelse([$3],,
-AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
-AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
-AC_REQUIRE([AM_SANITY_CHECK])
-AC_REQUIRE([AC_ARG_PROGRAM])
-dnl FIXME This is truly gross.
-missing_dir=`cd $ac_aux_dir && pwd`
-AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
-AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
-AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
-AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
-AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
-AC_REQUIRE([AC_PROG_MAKE_SET])])
-
-#
-# Check to make sure that the build environment is sane.
-#
-
-AC_DEFUN(AM_SANITY_CHECK,
-[AC_MSG_CHECKING([whether build environment is sane])
-# Just in case
-sleep 1
-echo timestamp > conftestfile
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments. Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
- set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
- if test "[$]*" = "X"; then
- # -L didn't work.
- set X `ls -t $srcdir/configure conftestfile`
- fi
- if test "[$]*" != "X $srcdir/configure conftestfile" \
- && test "[$]*" != "X conftestfile $srcdir/configure"; then
-
- # If neither matched, then we have a broken ls. This can happen
- # if, for instance, CONFIG_SHELL is bash and it inherits a
- # broken ls alias from the environment. This has actually
- # happened. Such a system could not be considered "sane".
- AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
-alias in your environment])
- fi
-
- test "[$]2" = conftestfile
- )
-then
- # Ok.
- :
-else
- AC_MSG_ERROR([newly created file is older than distributed files!
-Check your system clock])
-fi
-rm -f conftest*
-AC_MSG_RESULT(yes)])
-
-dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
-dnl The program must properly implement --version.
-AC_DEFUN(AM_MISSING_PROG,
-[AC_MSG_CHECKING(for working $2)
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if ($2 --version) < /dev/null > /dev/null 2>&1; then
- $1=$2
- AC_MSG_RESULT(found)
-else
- $1="$3/missing $2"
- AC_MSG_RESULT(missing)
-fi
-AC_SUBST($1)])
-
-# Add --enable-maintainer-mode option to configure.
-# From Jim Meyering
-
-# serial 1
-
-AC_DEFUN(AM_MAINTAINER_MODE,
-[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
- dnl maintainer-mode is disabled by default
- AC_ARG_ENABLE(maintainer-mode,
-[ --enable-maintainer-mode enable make rules and dependencies not useful
- (and sometimes confusing) to the casual installer],
- USE_MAINTAINER_MODE=$enableval,
- USE_MAINTAINER_MODE=no)
- AC_MSG_RESULT($USE_MAINTAINER_MODE)
- AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
- MAINT=$MAINTAINER_MODE_TRUE
- AC_SUBST(MAINT)dnl
-]
-)
-
-# Define a conditional.
-
-AC_DEFUN(AM_CONDITIONAL,
-[AC_SUBST($1_TRUE)
-AC_SUBST($1_FALSE)
-if $2; then
- $1_TRUE=
- $1_FALSE='#'
-else
- $1_TRUE='#'
- $1_FALSE=
-fi])
-
diff --git a/newlib/libc/machine/powerpc/atosfix16.c b/newlib/libc/machine/powerpc/atosfix16.c
deleted file mode 100644
index 819c2f068..000000000
--- a/newlib/libc/machine/powerpc/atosfix16.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-FUNCTION
- <<atosfix16>>, <<atosfix32>>, <<atosfix64>>---string to signed fixed-point
-
-INDEX
- atosfix16
-INDEX
- atosfix32
-INDEX
- atosfix64
-INDEX
- _atosfix16_r
-INDEX
- _atosfix32_r
-INDEX
- _atosfix64_r
-
-ANSI_SYNOPSIS
- #include <stdlib.h>
- __int16_t atosfix16(const char *<[s]>);
- __int32_t atosfix32(const char *<[s]>);
- __int64_t atosfix32(const char *<[s]>);
-
- __int16_t _atosfix16_r(struct __reent *, const char *<[s]>);
- __int32_t _atosfix32_r(struct __reent *, const char *<[s]>);
- __int64_t _atosfix32_r(struct __reent *, const char *<[s]>);
-
-TRAD_SYNOPSIS
- #include <stdlib.h>
- __int16_t atosfix16(<[s]>)
- const char *<[s]>;
-
- __int32_t atosfix32(<[s]>)
- const char *<[s]>;
-
- __int64_t atosfix64(<[s]>)
- const char *<[s]>;
-
- __int16_t _atosfix16_r(<reent>, <[s]>)
- struct _reent *<[reent]>;
- const char *<[s]>;
-
- __int32_t _atosfix32_r(<reent>, <[s]>)
- struct _reent *<[reent]>;
- const char *<[s]>;
-
- __int64_t _atosfix64_r(<reent>, <[s]>)
- struct _reent *<[reent]>;
- const char *<[s]>;
-
-DESCRIPTION
- <<atosfix16>> converts the initial portion of a string to a sign
- + 15-bit fraction fixed point value.
- <<atosfix32>> converts the initial portion of a string to a sign
- + 31-bit fraction fixed point value.
- <<atosfix64>> converts the initial portion of a string to a sign
- + 63-bit fraction fixed point value.
- <<atosfix16(s)>> is implemented as <<strtosfix16(s, NULL).>>
- <<atosfix32(s)>> is implemented as <<strtosfix32(s, NULL).>>
- <<atosfix64(s)>> is implemented as <<strtosfix64(s, NULL).>>
-
- The alternate functions <<_atosfix16_r>>, <<_atosfix32_r>>,
- and <<_atosfix64_r>> are reentrant versions.
- The extra argument <[reent]> is a pointer to a reentrancy structure.
-
-RETURNS
- The functions return the converted value, if any. If no conversion was
- made, <<0>> is returned. If saturation occurs, <<ERANGE>> is stored
- in errno.
-
-PORTABILITY
- <<atosfix16>>, <<atosfix32>>, and <<atosfix64>> are non-standard.
-
- No supporting OS subroutines are directly required. The
- OS subroutines required by <<strtod>> are used.
-*/
-
-/*
- * Jeff Johnston - 02/13/2002
- */
-
-#include <stdlib.h>
-#include <_ansi.h>
-
-__int16_t
-_DEFUN (_atosfix16_r, (reent, s),
- struct _reent *reent _AND
- _CONST char *s)
-{
- return _strtosfix16_r (reent, s, NULL);
-}
-
-#ifndef _REENT_ONLY
-__int16_t
-_DEFUN (atosfix16, (s),
- _CONST char *s)
-{
- return strtosfix16 (s, NULL);
-}
-
-#endif /* !_REENT_ONLY */
-
diff --git a/newlib/libc/machine/powerpc/atosfix32.c b/newlib/libc/machine/powerpc/atosfix32.c
deleted file mode 100644
index 5d55e4580..000000000
--- a/newlib/libc/machine/powerpc/atosfix32.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Jeff Johnston - 02/13/2002
- */
-
-#include <stdlib.h>
-#include <_ansi.h>
-
-__int32_t
-_DEFUN (_atosfix32_r, (reent, s),
- struct _reent *reent _AND
- _CONST char *s)
-{
- return _strtosfix32_r (reent, s, NULL);
-}
-
-#ifndef _REENT_ONLY
-__int32_t
-_DEFUN (atosfix32, (s),
- _CONST char *s)
-{
- return strtosfix32 (s, NULL);
-}
-
-#endif /* !_REENT_ONLY */
-
diff --git a/newlib/libc/machine/powerpc/atosfix64.c b/newlib/libc/machine/powerpc/atosfix64.c
deleted file mode 100644
index b720d3824..000000000
--- a/newlib/libc/machine/powerpc/atosfix64.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Jeff Johnston - 02/13/2002
- */
-
-#include <stdlib.h>
-#include <_ansi.h>
-
-__int64_t
-_DEFUN (_atosfix64_r, (reent, s),
- struct _reent *reent _AND
- _CONST char *s)
-{
- return _strtosfix64_r (reent, s, NULL);
-}
-
-#ifndef _REENT_ONLY
-__int64_t
-_DEFUN (atosfix64, (s),
- _CONST char *s)
-{
- return strtosfix64 (s, NULL);
-}
-
-#endif /* !_REENT_ONLY */
-
diff --git a/newlib/libc/machine/powerpc/atoufix16.c b/newlib/libc/machine/powerpc/atoufix16.c
deleted file mode 100644
index a84c4c7e1..000000000
--- a/newlib/libc/machine/powerpc/atoufix16.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-FUNCTION
- <<atoufix16>>, <<atoufix32>>, <<atoufix64>>---string to unsigned fixed-point
-
-INDEX
- atoufix16
-INDEX
- atoufix32
-INDEX
- atoufix64
-INDEX
- _atoufix16_r
-INDEX
- _atoufix32_r
-INDEX
- _atoufix64_r
-
-ANSI_SYNOPSIS
- #include <stdlib.h>
- __uint16_t atoufix16(const char *<[s]>);
- __uint32_t atoufix32(const char *<[s]>);
- __uint64_t atoufix32(const char *<[s]>);
-
- __uint16_t _atoufix16_r(struct __reent *, const char *<[s]>);
- __uint32_t _atoufix32_r(struct __reent *, const char *<[s]>);
- __uint64_t _atoufix32_r(struct __reent *, const char *<[s]>);
-
-TRAD_SYNOPSIS
- #include <stdlib.h>
- __uint16_t atoufix16(<[s]>)
- const char *<[s]>;
-
- __uint32_t atoufix32(<[s]>)
- const char *<[s]>;
-
- __uint64_t atoufix64(<[s]>)
- const char *<[s]>;
-
- __uint16_t _atoufix16_r(<reent>, <[s]>)
- struct _reent *<[reent]>;
- const char *<[s]>;
-
- __uint32_t _atoufix32_r(<reent>, <[s]>)
- struct _reent *<[reent]>;
- const char *<[s]>;
-
- __uint64_t _atoufix64_r(<reent>, <[s]>)
- struct _reent *<[reent]>;
- const char *<[s]>;
-
-DESCRIPTION
- <<atoufix16>> converts the initial portion of a string to a
- 16-bit fraction unsigned fixed point value.
- <<atoufix32>> converts the initial portion of a string to a
- 32-bit fraction unsigned fixed point value.
- <<atoufix64>> converts the initial portion of a string to a
- 64-bit fraction unsigned fixed point value.
- <<atoufix16(s)>> is implemented as <<strtoufix16(s, NULL).>>
- <<atoufix32(s)>> is implemented as <<strtoufix32(s, NULL).>>
- <<atoufix64(s)>> is implemented as <<strtoufix64(s, NULL).>>
-
- The alternate functions <<_atoufix16_r>>, <<_atoufix32_r>>,
- and <<_atoufix64_r>> are reentrant versions.
- The extra argument <[reent]> is a pointer to a reentrancy structure.
-
-RETURNS
- The functions return the converted value, if any. If no conversion was
- made, <<0>> is returned. If saturation occurs, <<ERANGE>> is stored
- in errno.
-
-PORTABILITY
- <<atoufix16>>, <<atoufix32>>, and <<atoufix64>> are non-standard.
-
- No supporting OS subroutines are directly required. The
- OS subroutines required by <<strtod>> are used.
-*/
-
-/*
- * Jeff Johnston - 02/13/2002
- */
-
-#include <stdlib.h>
-#include <_ansi.h>
-
-__uint16_t
-_DEFUN (_atoufix16_r, (reent, s),
- struct _reent *reent _AND
- _CONST char *s)
-{
- return _strtoufix16_r (reent, s, NULL);
-}
-
-#ifndef _REENT_ONLY
-__uint16_t
-_DEFUN (atoufix16, (s),
- _CONST char *s)
-{
- return strtoufix16 (s, NULL);
-}
-
-#endif /* !_REENT_ONLY */
-
diff --git a/newlib/libc/machine/powerpc/atoufix32.c b/newlib/libc/machine/powerpc/atoufix32.c
deleted file mode 100644
index f3ef1d43a..000000000
--- a/newlib/libc/machine/powerpc/atoufix32.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Jeff Johnston - 02/13/2002
- */
-
-#include <stdlib.h>
-#include <_ansi.h>
-
-__uint32_t
-_DEFUN (_atoufix32_r, (reent, s),
- struct _reent *reent _AND
- _CONST char *s)
-{
- return _strtoufix32_r (reent, s, NULL);
-}
-
-#ifndef _REENT_ONLY
-__uint32_t
-_DEFUN (atoufix32, (s),
- _CONST char *s)
-{
- return strtoufix32 (s, NULL);
-}
-
-#endif /* !_REENT_ONLY */
-
diff --git a/newlib/libc/machine/powerpc/atoufix64.c b/newlib/libc/machine/powerpc/atoufix64.c
deleted file mode 100644
index c2a7eded7..000000000
--- a/newlib/libc/machine/powerpc/atoufix64.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Jeff Johnston - 02/13/2002
- */
-
-#include <stdlib.h>
-#include <_ansi.h>
-
-__uint64_t
-_DEFUN (_atoufix64_r, (reent, s),
- struct _reent *reent _AND
- _CONST char *s)
-{
- return _strtoufix64_r (reent, s, NULL);
-}
-
-#ifndef _REENT_ONLY
-__uint64_t
-_DEFUN (atoufix64, (s),
- _CONST char *s)
-{
- return strtoufix64 (s, NULL);
-}
-
-#endif /* !_REENT_ONLY */
-
diff --git a/newlib/libc/machine/powerpc/configure b/newlib/libc/machine/powerpc/configure
deleted file mode 100755
index ae87f9184..000000000
--- a/newlib/libc/machine/powerpc/configure
+++ /dev/null
@@ -1,1880 +0,0 @@
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-ac_help="$ac_help
- --enable-multilib build many library versions (default)"
-ac_help="$ac_help
- --enable-target-optspace optimize for space"
-ac_help="$ac_help
- --enable-malloc-debugging indicate malloc debugging requested"
-ac_help="$ac_help
- --enable-newlib-mb enable multibyte support"
-ac_help="$ac_help
- --enable-newlib-multithread enable support for multiple threads"
-ac_help="$ac_help
- --enable-newlib-elix-level supply desired elix library level (1-4)"
-ac_help="$ac_help
- --disable-newlib-io-float disable printf/scanf family float support"
-ac_help="$ac_help
- --enable-maintainer-mode enable make rules and dependencies not useful
- (and sometimes confusing) to the casual installer"
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-sitefile=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-for ac_option
-do
-
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
- ac_prev=
- continue
- fi
-
- case "$ac_option" in
- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case "$ac_option" in
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir="$ac_optarg" ;;
-
- -build | --build | --buil | --bui | --bu)
- ac_prev=build ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$ac_optarg" ;;
-
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file="$ac_optarg" ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir="$ac_optarg" ;;
-
- -disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_${ac_feature}='$ac_optarg'" ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- | --exec | --exe | --ex)
- ac_prev=exec_prefix ;;
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
- exec_prefix="$ac_optarg" ;;
-
- -gas | --gas | --ga | --g)
- # Obsolete; use --with-gas.
- with_gas=yes ;;
-
- -help | --help | --hel | --he)
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --site-file=FILE use FILE as the site file
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --program-prefix=PREFIX prepend PREFIX to installed program names
- --program-suffix=SUFFIX append SUFFIX to installed program names
- --program-transform-name=PROGRAM
- run sed PROGRAM on installed program names
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host="$ac_optarg" ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir="$ac_optarg" ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir="$ac_optarg" ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir="$ac_optarg" ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
- libexecdir="$ac_optarg" ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir="$ac_optarg" ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir="$ac_optarg" ;;
-
- -nfp | --nfp | --nf)
- # Obsolete; use --without-fp.
- with_fp=no ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c)
- no_create=yes ;;
-
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- no_recursion=yes ;;
-
- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
- | --oldin | --oldi | --old | --ol | --o)
- ac_prev=oldincludedir ;;
- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir="$ac_optarg" ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix="$ac_optarg" ;;
-
- -program-prefix | --program-prefix | --program-prefi | --program-pref \
- | --program-pre | --program-pr | --program-p)
- ac_prev=program_prefix ;;
- -program-prefix=* | --program-prefix=* | --program-prefi=* \
- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix="$ac_optarg" ;;
-
- -program-suffix | --program-suffix | --program-suffi | --program-suff \
- | --program-suf | --program-su | --program-s)
- ac_prev=program_suffix ;;
- -program-suffix=* | --program-suffix=* | --program-suffi=* \
- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix="$ac_optarg" ;;
-
- -program-transform-name | --program-transform-name \
- | --program-transform-nam | --program-transform-na \
- | --program-transform-n | --program-transform- \
- | --program-transform | --program-transfor \
- | --program-transfo | --program-transf \
- | --program-trans | --program-tran \
- | --progr-tra | --program-tr | --program-t)
- ac_prev=program_transform_name ;;
- -program-transform-name=* | --program-transform-name=* \
- | --program-transform-nam=* | --program-transform-na=* \
- | --program-transform-n=* | --program-transform-=* \
- | --program-transform=* | --program-transfor=* \
- | --program-transfo=* | --program-transf=* \
- | --program-trans=* | --program-tran=* \
- | --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name="$ac_optarg" ;;
-
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- silent=yes ;;
-
- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
- sbindir="$ac_optarg" ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
- | --sharedst | --shareds | --shared | --share | --shar \
- | --sha | --sh)
- ac_prev=sharedstatedir ;;
- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
- sharedstatedir="$ac_optarg" ;;
-
- -site | --site | --sit)
- ac_prev=site ;;
- -site=* | --site=* | --sit=*)
- site="$ac_optarg" ;;
-
- -site-file | --site-file | --site-fil | --site-fi | --site-f)
- ac_prev=sitefile ;;
- -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*)
- sitefile="$ac_optarg" ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir="$ac_optarg" ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir="$ac_optarg" ;;
-
- -target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
-
- -with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "with_${ac_package}='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=no" ;;
-
- --x)
- # Obsolete; use --with-x.
- with_x=yes ;;
-
- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
- | --x-incl | --x-inc | --x-in | --x-i)
- ac_prev=x_includes ;;
- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes="$ac_optarg" ;;
-
- -x-libraries | --x-libraries | --x-librarie | --x-librari \
- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- ac_prev=x_libraries ;;
- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries="$ac_optarg" ;;
-
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
- ;;
-
- *)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
- esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=setjmp.S
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
- ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
- srcdir=..
- fi
-else
- ac_srcdir_defaulted=no
-fi
-if test ! -r $srcdir/$ac_unique_file; then
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
- else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
- fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$sitefile"; then
- if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
- fi
-else
- CONFIG_SITE="$sitefile"
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
-else
- echo "creating cache $cache_file"
- > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-
-
-ac_aux_dir=
-for ac_dir in ../../../.. $srcdir/../../../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in ../../../.. $srcdir/../../../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-
-# Find a good install program. We prefer a C program (faster),
-# so one script is as good as another. But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:586: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # by default.
- for ac_prog in ginstall scoinst install; do
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
-
-fi
- if test "${ac_cv_path_install+set}" = set; then
- INSTALL="$ac_cv_path_install"
- else
- # As a last resort, use the slow shell script. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&6
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:639: checking whether build environment is sane" >&5
-# Just in case
-sleep 1
-echo timestamp > conftestfile
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments. Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
- set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
- if test "$*" = "X"; then
- # -L didn't work.
- set X `ls -t $srcdir/configure conftestfile`
- fi
- if test "$*" != "X $srcdir/configure conftestfile" \
- && test "$*" != "X conftestfile $srcdir/configure"; then
-
- # If neither matched, then we have a broken ls. This can happen
- # if, for instance, CONFIG_SHELL is bash and it inherits a
- # broken ls alias from the environment. This has actually
- # happened. Such a system could not be considered "sane".
- { echo "configure: error: ls -t appears to fail. Make sure there is not a broken
-alias in your environment" 1>&2; exit 1; }
- fi
-
- test "$2" = conftestfile
- )
-then
- # Ok.
- :
-else
- { echo "configure: error: newly created file is older than distributed files!
-Check your system clock" 1>&2; exit 1; }
-fi
-rm -f conftest*
-echo "$ac_t""yes" 1>&6
-if test "$program_transform_name" = s,x,x,; then
- program_transform_name=
-else
- # Double any \ or $. echo might interpret backslashes.
- cat <<\EOF_SED > conftestsed
-s,\\,\\\\,g; s,\$,$$,g
-EOF_SED
- program_transform_name="`echo $program_transform_name|sed -f conftestsed`"
- rm -f conftestsed
-fi
-test "$program_prefix" != NONE &&
- program_transform_name="s,^,${program_prefix},; $program_transform_name"
-# Use a double $ so make ignores it.
-test "$program_suffix" != NONE &&
- program_transform_name="s,\$\$,${program_suffix},; $program_transform_name"
-
-# sed with no file args requires a program.
-test "$program_transform_name" = "" && program_transform_name="s,x,x,"
-
-echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:696: checking whether ${MAKE-make} sets \${MAKE}" >&5
-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftestmake <<\EOF
-all:
- @echo 'ac_maketemp="${MAKE}"'
-EOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
-if test -n "$ac_maketemp"; then
- eval ac_cv_prog_make_${ac_make}_set=yes
-else
- eval ac_cv_prog_make_${ac_make}_set=no
-fi
-rm -f conftestmake
-fi
-if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- SET_MAKE=
-else
- echo "$ac_t""no" 1>&6
- SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-if test $host != $build; then
- ac_tool_prefix=${host_alias}-
-else
- ac_tool_prefix=
-fi
-
-echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
-echo "configure:729: checking for Cygwin environment" >&5
-if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 734 "configure"
-#include "confdefs.h"
-
-int main() {
-
-#ifndef __CYGWIN__
-#define __CYGWIN__ __CYGWIN32__
-#endif
-return __CYGWIN__;
-; return 0; }
-EOF
-if { (eval echo configure:745: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_cygwin=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_cygwin=no
-fi
-rm -f conftest*
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_cygwin" 1>&6
-CYGWIN=
-test "$ac_cv_cygwin" = yes && CYGWIN=yes
-echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:762: checking for mingw32 environment" >&5
-if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 767 "configure"
-#include "confdefs.h"
-
-int main() {
-return __MINGW32__;
-; return 0; }
-EOF
-if { (eval echo configure:774: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_mingw32=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_cv_mingw32=no
-fi
-rm -f conftest*
-rm -f conftest*
-fi
-
-echo "$ac_t""$ac_cv_mingw32" 1>&6
-MINGW32=
-test "$ac_cv_mingw32" = yes && MINGW32=yes
-
-# Check whether --enable-multilib or --disable-multilib was given.
-if test "${enable_multilib+set}" = set; then
- enableval="$enable_multilib"
- case "${enableval}" in
- yes) multilib=yes ;;
- no) multilib=no ;;
- *) { echo "configure: error: bad value ${enableval} for multilib option" 1>&2; exit 1; } ;;
- esac
-else
- multilib=yes
-fi
-
-# Check whether --enable-target-optspace or --disable-target-optspace was given.
-if test "${enable_target_optspace+set}" = set; then
- enableval="$enable_target_optspace"
- case "${enableval}" in
- yes) target_optspace=yes ;;
- no) target_optspace=no ;;
- *) { echo "configure: error: bad value ${enableval} for target-optspace option" 1>&2; exit 1; } ;;
- esac
-else
- target_optspace=
-fi
-
-# Check whether --enable-malloc-debugging or --disable-malloc-debugging was given.
-if test "${enable_malloc_debugging+set}" = set; then
- enableval="$enable_malloc_debugging"
- case "${enableval}" in
- yes) malloc_debugging=yes ;;
- no) malloc_debugging=no ;;
- *) { echo "configure: error: bad value ${enableval} for malloc-debugging option" 1>&2; exit 1; } ;;
- esac
-else
- malloc_debugging=
-fi
-
-# Check whether --enable-newlib-mb or --disable-newlib-mb was given.
-if test "${enable_newlib_mb+set}" = set; then
- enableval="$enable_newlib_mb"
- case "${enableval}" in
- yes) newlib_mb=yes ;;
- no) newlib_mb=no ;;
- *) { echo "configure: error: bad value ${enableval} for newlib-mb option" 1>&2; exit 1; } ;;
- esac
-else
- newlib_mb=
-fi
-
-# Check whether --enable-newlib-multithread or --disable-newlib-multithread was given.
-if test "${enable_newlib_multithread+set}" = set; then
- enableval="$enable_newlib_multithread"
- case "${enableval}" in
- yes) newlib_multithread=yes ;;
- no) newlib_multithread=no ;;
- *) { echo "configure: error: bad value ${enableval} for newlib-multithread option" 1>&2; exit 1; } ;;
- esac
-else
- newlib_multithread=yes
-fi
-
-# Check whether --enable-newlib-elix-level or --disable-newlib-elix-level was given.
-if test "${enable_newlib_elix_level+set}" = set; then
- enableval="$enable_newlib_elix_level"
- case "${enableval}" in
- 0) newlib_elix_level=0 ;;
- 1) newlib_elix_level=1 ;;
- 2) newlib_elix_level=2 ;;
- 3) newlib_elix_level=3 ;;
- 4) newlib_elix_level=4 ;;
- *) { echo "configure: error: bad value ${enableval} for newlib-elix-level option" 1>&2; exit 1; } ;;
- esac
-else
- newlib_elix_level=0
-fi
-
-# Check whether --enable-newlib-io-float or --disable-newlib-io-float was given.
-if test "${enable_newlib_io_float+set}" = set; then
- enableval="$enable_newlib_io_float"
- case "${enableval}" in
- yes) newlib_io_float=yes ;;
- no) newlib_io_float=no ;;
- *) { echo "configure: error: bad value ${enableval} for newlib-io-float option" 1>&2; exit 1; } ;;
- esac
-else
- newlib_io_float=yes
-fi
-
-
-
-test -z "${with_target_subdir}" && with_target_subdir=.
-
-if test "${srcdir}" = "."; then
- if test "${with_target_subdir}" != "."; then
- newlib_basedir="${srcdir}/${with_multisrctop}../../../.."
- else
- newlib_basedir="${srcdir}/${with_multisrctop}../../.."
- fi
-else
- newlib_basedir="${srcdir}/../../.."
-fi
-
-
-
-# Do some error checking and defaulting for the host and target type.
-# The inputs are:
-# configure --host=HOST --target=TARGET --build=BUILD NONOPT
-#
-# The rules are:
-# 1. You are not allowed to specify --host, --target, and nonopt at the
-# same time.
-# 2. Host defaults to nonopt.
-# 3. If nonopt is not specified, then host defaults to the current host,
-# as determined by config.guess.
-# 4. Target and build default to nonopt.
-# 5. If nonopt is not specified, then target and build default to host.
-
-# The aliases save the names the user supplied, while $host etc.
-# will get canonicalized.
-case $host---$target---$nonopt in
-NONE---*---* | *---NONE---* | *---*---NONE) ;;
-*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
-esac
-
-
-# Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:921: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
- case $nonopt in
- NONE)
- if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
- else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
- fi ;;
- *) host_alias=$nonopt ;;
- esac ;;
-esac
-
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
-
-echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:942: checking target system type" >&5
-
-target_alias=$target
-case "$target_alias" in
-NONE)
- case $nonopt in
- NONE) target_alias=$host_alias ;;
- *) target_alias=$nonopt ;;
- esac ;;
-esac
-
-target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`
-target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$target" 1>&6
-
-echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:960: checking build system type" >&5
-
-build_alias=$build
-case "$build_alias" in
-NONE)
- case $nonopt in
- NONE) build_alias=$host_alias ;;
- *) build_alias=$nonopt ;;
- esac ;;
-esac
-
-build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
-build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$build" 1>&6
-
-test "$host_alias" != "$target_alias" &&
- test "$program_prefix$program_suffix$program_transform_name" = \
- NONENONEs,x,x, &&
- program_prefix=${target_alias}-
-
-
-
-PACKAGE=newlib
-
-VERSION=1.10.0
-
-if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
- { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; }
-fi
-cat >> confdefs.h <<EOF
-#define PACKAGE "$PACKAGE"
-EOF
-
-cat >> confdefs.h <<EOF
-#define VERSION "$VERSION"
-EOF
-
-
-
-missing_dir=`cd $ac_aux_dir && pwd`
-echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:1003: checking for working aclocal" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (aclocal --version) < /dev/null > /dev/null 2>&1; then
- ACLOCAL=aclocal
- echo "$ac_t""found" 1>&6
-else
- ACLOCAL="$missing_dir/missing aclocal"
- echo "$ac_t""missing" 1>&6
-fi
-
-echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:1016: checking for working autoconf" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (autoconf --version) < /dev/null > /dev/null 2>&1; then
- AUTOCONF=autoconf
- echo "$ac_t""found" 1>&6
-else
- AUTOCONF="$missing_dir/missing autoconf"
- echo "$ac_t""missing" 1>&6
-fi
-
-echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:1029: checking for working automake" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (automake --version) < /dev/null > /dev/null 2>&1; then
- AUTOMAKE=automake
- echo "$ac_t""found" 1>&6
-else
- AUTOMAKE="$missing_dir/missing automake"
- echo "$ac_t""missing" 1>&6
-fi
-
-echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:1042: checking for working autoheader" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (autoheader --version) < /dev/null > /dev/null 2>&1; then
- AUTOHEADER=autoheader
- echo "$ac_t""found" 1>&6
-else
- AUTOHEADER="$missing_dir/missing autoheader"
- echo "$ac_t""missing" 1>&6
-fi
-
-echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:1055: checking for working makeinfo" >&5
-# Run test in a subshell; some versions of sh will print an error if
-# an executable is not found, even if stderr is redirected.
-# Redirect stdin to placate older versions of autoconf. Sigh.
-if (makeinfo --version) < /dev/null > /dev/null 2>&1; then
- MAKEINFO=makeinfo
- echo "$ac_t""found" 1>&6
-else
- MAKEINFO="$missing_dir/missing makeinfo"
- echo "$ac_t""missing" 1>&6
-fi
-
-
-
-# FIXME: We temporarily define our own version of AC_PROG_CC. This is
-# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
-# are probably using a cross compiler, which will not be able to fully
-# link an executable. This should really be fixed in autoconf
-# itself.
-
-
-
-# Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1080: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1110: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# -gt 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1159: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1168: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1183: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-O2"
- fi
-else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
-fi
-
-
-# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
-set dummy ${ac_tool_prefix}as; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1214: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$AS"; then
- ac_cv_prog_AS="$AS" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AS="${ac_tool_prefix}as"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="as"
-fi
-fi
-AS="$ac_cv_prog_AS"
-if test -n "$AS"; then
- echo "$ac_t""$AS" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-
-# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ar; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1246: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$AR"; then
- ac_cv_prog_AR="$AR" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_AR="${ac_tool_prefix}ar"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
-fi
-fi
-AR="$ac_cv_prog_AR"
-if test -n "$AR"; then
- echo "$ac_t""$AR" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-
-# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1278: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-
-if test -z "$ac_cv_prog_RANLIB"; then
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1310: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-else
- RANLIB=":"
-fi
-fi
-
-
-# Find a good install program. We prefer a C program (faster),
-# so one script is as good as another. But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1355: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # by default.
- for ac_prog in ginstall scoinst install; do
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
- break 2
- fi
- fi
- done
- ;;
- esac
- done
- IFS="$ac_save_IFS"
-
-fi
- if test "${ac_cv_path_install+set}" = set; then
- INSTALL="$ac_cv_path_install"
- else
- # As a last resort, use the slow shell script. We don't cache a
- # path for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the path is relative.
- INSTALL="$ac_install_sh"
- fi
-fi
-echo "$ac_t""$INSTALL" 1>&6
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-
-echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:1409: checking whether to enable maintainer-specific portions of Makefiles" >&5
- # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
-if test "${enable_maintainer_mode+set}" = set; then
- enableval="$enable_maintainer_mode"
- USE_MAINTAINER_MODE=$enableval
-else
- USE_MAINTAINER_MODE=no
-fi
-
- echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6
-
-
-if test $USE_MAINTAINER_MODE = yes; then
- MAINTAINER_MODE_TRUE=
- MAINTAINER_MODE_FALSE='#'
-else
- MAINTAINER_MODE_TRUE='#'
- MAINTAINER_MODE_FALSE=
-fi
- MAINT=$MAINTAINER_MODE_TRUE
-
-
-
-# We need AC_EXEEXT to keep automake happy in cygnus mode. However,
-# at least currently, we never actually build a program, so we never
-# need to use $(EXEEXT). Moreover, the test for EXEEXT normally
-# fails, because we are probably configuring with a cross compiler
-# which can't create executables. So we include AC_EXEEXT to keep
-# automake happy, but we don't execute it, since we don't care about
-# the result.
-if false; then
-
-
-echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1443: checking for executable suffix" >&5
-if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
- ac_cv_exeext=.exe
-else
- rm -f conftest*
- echo 'int main () { return 0; }' > conftest.$ac_ext
- ac_cv_exeext=
- if { (eval echo configure:1453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
- for file in conftest.*; do
- case $file in
- *.c | *.o | *.obj | *.ilk | *.pdb) ;;
- *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
- esac
- done
- else
- { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
- fi
- rm -f conftest*
- test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
-fi
-fi
-
-EXEEXT=""
-test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
-echo "$ac_t""${ac_cv_exeext}" 1>&6
-ac_exeext=$EXEEXT
-
-fi
-
-. ${newlib_basedir}/configure.host
-
-newlib_cflags="${newlib_cflags} -fno-builtin"
-
-NEWLIB_CFLAGS=${newlib_cflags}
-
-
-LDFLAGS=${ldflags}
-
-
-
-
-if test x${newlib_elix_level} = x0; then
- ELIX_LEVEL_0_TRUE=
- ELIX_LEVEL_0_FALSE='#'
-else
- ELIX_LEVEL_0_TRUE='#'
- ELIX_LEVEL_0_FALSE=
-fi
-
-
-if test x${newlib_elix_level} = x1; then
- ELIX_LEVEL_1_TRUE=
- ELIX_LEVEL_1_FALSE='#'
-else
- ELIX_LEVEL_1_TRUE='#'
- ELIX_LEVEL_1_FALSE=
-fi
-
-
-if test x${newlib_elix_level} = x2; then
- ELIX_LEVEL_2_TRUE=
- ELIX_LEVEL_2_FALSE='#'
-else
- ELIX_LEVEL_2_TRUE='#'
- ELIX_LEVEL_2_FALSE=
-fi
-
-
-if test x${newlib_elix_level} = x3; then
- ELIX_LEVEL_3_TRUE=
- ELIX_LEVEL_3_FALSE='#'
-else
- ELIX_LEVEL_3_TRUE='#'
- ELIX_LEVEL_3_FALSE=
-fi
-
-
-if test x${newlib_elix_level} = x4; then
- ELIX_LEVEL_4_TRUE=
- ELIX_LEVEL_4_FALSE='#'
-else
- ELIX_LEVEL_4_TRUE='#'
- ELIX_LEVEL_4_FALSE=
-fi
-
-
-
-if test x${use_libtool} = xyes; then
- USE_LIBTOOL_TRUE=
- USE_LIBTOOL_FALSE='#'
-else
- USE_LIBTOOL_TRUE='#'
- USE_LIBTOOL_FALSE=
-fi
-
-# Hard-code OBJEXT. Normally it is set by AC_OBJEXT, but we
-# use oext, which is set in configure.host based on the target platform.
-OBJEXT=${oext}
-
-
-
-
-
-
-
-
-
-
-extra_objs=
-extra_sources=
-case $host in
- powerpc*-*altivec*)
- extra_objs="vfprintf.o vfscanf.o vec_malloc.o vec_calloc.o vec_free.o vec_realloc.o vec_reallocr.o vec_callocr.o"
- extra_sources="vfprintf.c vfscanf.c vec_malloc.c vec_calloc.c vec_free.c vec_realloc.c vec_mallocr.c"
- ;;
- powerpc*-*spe*)
- extra_objs="atosfix16.o atosfix32.o atosfix64.o atoufix16.o atoufix32.o atoufix64.o simdldtoa.o strtosfix16.o strtosfix32.o strtosfix64.o strtoufix16.o strtoufix32.o strtoufix64.o ufix64toa.o vfprintf.o vfscanf.o"
- extra_sources="atosfix16.c atosfix32.c atosfix64.c atoufix16.c atoufix32.c atoufix64.c simdldtoa.c strtosfix16.c strtosfix32.c strtosfix64.c strtoufix16.c strtoufix32.c strtoufix64.c ufix64toa.c vfprintf.c vfscanf.c"
- ;;
-esac
-
-
-
-trap '' 1 2 15
-cat > confcache <<\EOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
-
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
-# Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
-done
-
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
-
-trap 'rm -fr `echo "Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@newlib_basedir@%$newlib_basedir%g
-s%@host@%$host%g
-s%@host_alias@%$host_alias%g
-s%@host_cpu@%$host_cpu%g
-s%@host_vendor@%$host_vendor%g
-s%@host_os@%$host_os%g
-s%@target@%$target%g
-s%@target_alias@%$target_alias%g
-s%@target_cpu@%$target_cpu%g
-s%@target_vendor@%$target_vendor%g
-s%@target_os@%$target_os%g
-s%@build@%$build%g
-s%@build_alias@%$build_alias%g
-s%@build_cpu@%$build_cpu%g
-s%@build_vendor@%$build_vendor%g
-s%@build_os@%$build_os%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
-s%@PACKAGE@%$PACKAGE%g
-s%@VERSION@%$VERSION%g
-s%@ACLOCAL@%$ACLOCAL%g
-s%@AUTOCONF@%$AUTOCONF%g
-s%@AUTOMAKE@%$AUTOMAKE%g
-s%@AUTOHEADER@%$AUTOHEADER%g
-s%@MAKEINFO@%$MAKEINFO%g
-s%@SET_MAKE@%$SET_MAKE%g
-s%@CC@%$CC%g
-s%@AS@%$AS%g
-s%@AR@%$AR%g
-s%@RANLIB@%$RANLIB%g
-s%@MAINTAINER_MODE_TRUE@%$MAINTAINER_MODE_TRUE%g
-s%@MAINTAINER_MODE_FALSE@%$MAINTAINER_MODE_FALSE%g
-s%@MAINT@%$MAINT%g
-s%@EXEEXT@%$EXEEXT%g
-s%@NEWLIB_CFLAGS@%$NEWLIB_CFLAGS%g
-s%@ELIX_LEVEL_0_TRUE@%$ELIX_LEVEL_0_TRUE%g
-s%@ELIX_LEVEL_0_FALSE@%$ELIX_LEVEL_0_FALSE%g
-s%@ELIX_LEVEL_1_TRUE@%$ELIX_LEVEL_1_TRUE%g
-s%@ELIX_LEVEL_1_FALSE@%$ELIX_LEVEL_1_FALSE%g
-s%@ELIX_LEVEL_2_TRUE@%$ELIX_LEVEL_2_TRUE%g
-s%@ELIX_LEVEL_2_FALSE@%$ELIX_LEVEL_2_FALSE%g
-s%@ELIX_LEVEL_3_TRUE@%$ELIX_LEVEL_3_TRUE%g
-s%@ELIX_LEVEL_3_FALSE@%$ELIX_LEVEL_3_FALSE%g
-s%@ELIX_LEVEL_4_TRUE@%$ELIX_LEVEL_4_TRUE%g
-s%@ELIX_LEVEL_4_FALSE@%$ELIX_LEVEL_4_FALSE%g
-s%@USE_LIBTOOL_TRUE@%$USE_LIBTOOL_TRUE%g
-s%@USE_LIBTOOL_FALSE@%$USE_LIBTOOL_FALSE%g
-s%@OBJEXT@%$OBJEXT%g
-s%@oext@%$oext%g
-s%@aext@%$aext%g
-s%@libm_machine_dir@%$libm_machine_dir%g
-s%@machine_dir@%$machine_dir%g
-s%@sys_dir@%$sys_dir%g
-s%@extra_objs@%$extra_objs%g
-s%@extra_sources@%$extra_sources%g
-
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=60 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
- else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
- fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
- else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
- fi
-done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
- fi
-
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
-
- case "$ac_given_INSTALL" in
- [/$]*) INSTALL="$ac_given_INSTALL" ;;
- *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
- esac
-
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
-
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
diff --git a/newlib/libc/machine/powerpc/configure.in b/newlib/libc/machine/powerpc/configure.in
deleted file mode 100644
index b1c4734ca..000000000
--- a/newlib/libc/machine/powerpc/configure.in
+++ /dev/null
@@ -1,27 +0,0 @@
-dnl This is the newlib/libc/machine/powerpc configure.in file.
-dnl Process this file with autoconf to produce a configure script.
-
-AC_PREREQ(2.5)
-AC_INIT(setjmp.S)
-
-dnl Can't be done in NEWLIB_CONFIGURE because that confuses automake.
-AC_CONFIG_AUX_DIR(../../../..)
-
-NEWLIB_CONFIGURE(../../..)
-
-extra_objs=
-extra_sources=
-case $host in
- powerpc*-*altivec*)
- extra_objs="vfprintf.o vfscanf.o vec_malloc.o vec_calloc.o vec_free.o vec_realloc.o vec_reallocr.o vec_callocr.o"
- extra_sources="vfprintf.c vfscanf.c vec_malloc.c vec_calloc.c vec_free.c vec_realloc.c vec_mallocr.c"
- ;;
- powerpc*-*spe*)
- extra_objs="atosfix16.o atosfix32.o atosfix64.o atoufix16.o atoufix32.o atoufix64.o simdldtoa.o strtosfix16.o strtosfix32.o strtosfix64.o strtoufix16.o strtoufix32.o strtoufix64.o ufix64toa.o vfprintf.o vfscanf.o"
- extra_sources="atosfix16.c atosfix32.c atosfix64.c atoufix16.c atoufix32.c atoufix64.c simdldtoa.c strtosfix16.c strtosfix32.c strtosfix64.c strtoufix16.c strtoufix32.c strtoufix64.c ufix64toa.c vfprintf.c vfscanf.c"
- ;;
-esac
-AC_SUBST(extra_objs)
-AC_SUBST(extra_sources)
-
-AC_OUTPUT(Makefile)
diff --git a/newlib/libc/machine/powerpc/fix64.h b/newlib/libc/machine/powerpc/fix64.h
deleted file mode 100644
index 3423d3d56..000000000
--- a/newlib/libc/machine/powerpc/fix64.h
+++ /dev/null
@@ -1,80 +0,0 @@
-#ifndef _FIX64_H_
-
-#define _FIX64_H_
-
-#include <ieeefp.h>
-#include <math.h>
-#include <float.h>
-#include <errno.h>
-#include <sys/config.h>
-
-#ifdef __IEEE_LITTLE_ENDIAN
-#define IEEE_8087
-#endif
-
-#ifdef __IEEE_BIG_ENDIAN
-#define IEEE_MC68k
-#endif
-
-#ifdef __Z8000__
-#define Just_16
-#endif
-
-#if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(VAX) + defined(IBM) != 1
-Exactly one of IEEE_8087, IEEE_MC68k, VAX, or IBM should be defined.
-#endif
-
-union long_double_union
-{
- long double ld;
- __uint32_t i[4];
-};
-
-typedef union long_double_union LONG_DOUBLE_UNION;
-
-extern void _simdstrtold (char *, char **, LONG_DOUBLE_UNION *);
-extern int _simdldchk (LONG_DOUBLE_UNION *);
-
-#define SIMD_LDBL_MANT_DIG 113
-
-#ifdef IEEE_8087
-# define word0(x) (x.i[3])
-# define word1(x) (x.i[2])
-# define word2(x) (x.i[1])
-# define word3(x) (x.i[0])
-#else /* !IEEE_8087 */
-# define word0(x) (x.i[0])
-# define word1(x) (x.i[1])
-# define word2(x) (x.i[2])
-# define word3(x) (x.i[3])
-#endif /* !IEEE_8087 */
-
-#undef Exp_shift
-#define Exp_shift 16
-#undef Exp_mask
-#define Exp_mask ((__uint32_t)0x7fff0000L)
-#undef Exp_msk1
-#define Exp_msk1 ((__uint32_t)0x00010000L)
-#undef Bias
-#define Bias 16383
-#undef Ebits
-#define Ebits 15
-#undef Sign_bit
-#define Sign_bit ((__uint32_t)0x80000000L)
-#define init(x) {}
-
-union fix64_union
-{
- __uint64_t ll;
- __uint32_t j[2];
-};
-
-#ifdef __LITTLE_ENDIAN__
-# define hiword(y) (y.j[1])
-# define loword(y) (y.j[0])
-#else /* __BIG_ENDIAN__ */
-# define hiword(y) (y.j[0])
-# define loword(y) (y.j[1])
-#endif /* __BIG_ENDIAN__ */
-
-#endif /* _FIX64_H_ */
diff --git a/newlib/libc/machine/powerpc/machine/malloc.h b/newlib/libc/machine/powerpc/machine/malloc.h
deleted file mode 100644
index 945a9651a..000000000
--- a/newlib/libc/machine/powerpc/machine/malloc.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _MACHMALLOC_H_
-#define _MACHMALLOC_H_
-
-# if defined(__ALTIVEC__)
-
-_PTR _EXFUN(vec_calloc,(size_t __nmemb, size_t __size));
-_PTR _EXFUN(_vec_calloc_r,(struct _reent *, size_t __nmemb, size_t __size));
-_VOID _EXFUN(vec_free,(_PTR));
-#define _vec_freer _freer
-_PTR _EXFUN(vec_malloc,(size_t __size));
-#define _vec_mallocr _memalign_r
-_PTR _EXFUN(vec_realloc,(_PTR __r, size_t __size));
-_PTR _EXFUN(_vec_realloc_r,(struct _reent *, _PTR __r, size_t __size));
-
-# endif /* __ALTIVEC__ */
-
-
-#endif /* _MACHMALLOC_H_ */
-
-
diff --git a/newlib/libc/machine/powerpc/machine/stdlib.h b/newlib/libc/machine/powerpc/machine/stdlib.h
deleted file mode 100644
index 03a5319fd..000000000
--- a/newlib/libc/machine/powerpc/machine/stdlib.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef _MACHSTDLIB_H_
-#define _MACHSTDLIB_H_
-
-#ifndef __STRICT_ANSI__
-
-# if defined(__ALTIVEC__)
-
-_PTR _EXFUN(vec_calloc,(size_t __nmemb, size_t __size));
-_PTR _EXFUN(_vec_calloc_r,(struct _reent *, size_t __nmemb, size_t __size));
-_VOID _EXFUN(vec_free,(_PTR));
-#define _vec_freer _freer
-_PTR _EXFUN(vec_malloc,(size_t __size));
-#define _vec_mallocr _memalign_r
-_PTR _EXFUN(vec_realloc,(_PTR __r, size_t __size));
-_PTR _EXFUN(_vec_realloc_r,(struct _reent *, _PTR __r, size_t __size));
-
-# endif /* __ALTIVEC__ */
-
-# if defined(__SPE__)
-
-#define __need_inttypes
-#include <sys/types.h>
-
-__int16_t _EXFUN(atosfix16,(const char *__str));
-__int16_t _EXFUN(_atosfix16_r,(struct _reent *, const char *__str));
-__int32_t _EXFUN(atosfix32,(const char *__str));
-__int32_t _EXFUN(_atosfix32_r,(struct _reent *, const char *__str));
-__int64_t _EXFUN(atosfix64,(const char *__str));
-__int64_t _EXFUN(_atosfix64_r,(struct _reent *, const char *__str));
-
-__uint16_t _EXFUN(atoufix16,(const char *__str));
-__uint16_t _EXFUN(_atoufix16_r,(struct _reent *, const char *__str));
-__uint32_t _EXFUN(atoufix32,(const char *__str));
-__uint32_t _EXFUN(_atoufix32_r,(struct _reent *, const char *__str));
-__uint64_t _EXFUN(atoufix64,(const char *__str));
-__uint64_t _EXFUN(_atoufix64_r,(struct _reent *, const char *__str));
-
-__int16_t _EXFUN(strtosfix16,(const char *__str, char **__endptr));
-__int16_t _EXFUN(_strtosfix16_r,(struct _reent *, const char *__str,
- char **__endptr));
-__int32_t _EXFUN(strtosfix32,(const char *__str, char **__endptr));
-__int32_t _EXFUN(_strtosfix32_r,(struct _reent *, const char *__str,
- char **__endptr));
-__int64_t _EXFUN(strtosfix64,(const char *__str, char **__endptr));
-__int64_t _EXFUN(_strtosfix64_r,(struct _reent *, const char *__str,
- char **__endptr));
-
-__uint16_t _EXFUN(strtoufix16,(const char *__str, char **__endptr));
-__uint16_t _EXFUN(_strtoufix16_r,(struct _reent *, const char *__str,
- char **__endptr));
-__uint32_t _EXFUN(strtoufix32,(const char *__str, char **__endptr));
-__uint32_t _EXFUN(_strtoufix32_r,(struct _reent *, const char *__str,
- char **__endptr));
-__uint64_t _EXFUN(strtoufix64,(const char *__str, char **__endptr));
-__uint64_t _EXFUN(_strtoufix64_r,(struct _reent *, const char *__str,
- char **__endptr));
-
-# endif /* __SPE__ */
-
-#endif /* !__STRICT_ANSI__ */
-
-
-#endif /* _MACHSTDLIB_H_ */
-
-
diff --git a/newlib/libc/machine/powerpc/setjmp.S b/newlib/libc/machine/powerpc/setjmp.S
deleted file mode 100644
index ec3a443d7..000000000
--- a/newlib/libc/machine/powerpc/setjmp.S
+++ /dev/null
@@ -1,190 +0,0 @@
-/* This is a simple version of setjmp and longjmp for the PowerPC.
- Ian Lance Taylor, Cygnus Support, 9 Feb 1994.
- Modified by Jeff Johnston, Red Hat Inc. 2 Oct 2001. */
-
-#include "ppc-asm.h"
-
-FUNC_START(setjmp)
-#ifdef __ALTIVEC__
- addi 3,3,15 # align Altivec to 16 byte boundary
- rlwinm 3,3,0,0,27
-#else
- addi 3,3,7 # align to 8 byte boundary
- rlwinm 3,3,0,0,28
-#endif
- stw 1,0(3) # offset 0
- stwu 2,4(3) # offset 4
- stwu 13,4(3) # offset 8
- stwu 14,4(3) # offset 12
- stwu 15,4(3) # offset 16
- stwu 16,4(3) # offset 20
- stwu 17,4(3) # offset 24
- stwu 18,4(3) # offset 28
- stwu 19,4(3) # offset 32
- stwu 20,4(3) # offset 36
- stwu 21,4(3) # offset 40
- stwu 22,4(3) # offset 44
- stwu 23,4(3) # offset 48
- stwu 24,4(3) # offset 52
- stwu 25,4(3) # offset 56
- stwu 26,4(3) # offset 60
- stwu 27,4(3) # offset 64
- stwu 28,4(3) # offset 68
- stwu 29,4(3) # offset 72
- stwu 30,4(3) # offset 76
- stwu 31,4(3) # offset 80
- mflr 4
- stwu 4,4(3) # offset 84
- mfcr 4
- stwu 4,4(3) # offset 88
- # one word pad to get floating point aligned on 8 byte boundary
-#ifndef _SOFT_FLOAT
- stfdu 14,8(3) # offset 96
- stfdu 15,8(3) # offset 104
- stfdu 16,8(3) # offset 112
- stfdu 17,8(3) # offset 120
- stfdu 18,8(3) # offset 128
- stfdu 19,8(3) # offset 136
- stfdu 20,8(3) # offset 144
- stfdu 21,8(3) # offset 152
- stfdu 22,8(3) # offset 160
- stfdu 23,8(3) # offset 168
- stfdu 24,8(3) # offset 176
- stfdu 25,8(3) # offset 184
- stfdu 26,8(3) # offset 192
- stfdu 27,8(3) # offset 200
- stfdu 28,8(3) # offset 208
- stfdu 29,8(3) # offset 216
- stfdu 30,8(3) # offset 224
- stfdu 31,8(3) # offset 232
-#endif
-
- /* This requires a total of 21 * 4 + 18 * 8 + 4 + 4 + 4
- bytes == 60 * 4 bytes == 240 bytes. */
-
-#ifdef __ALTIVEC__
- /* save Altivec vrsave and vr20-vr31 registers */
- mfspr 4,256 # vrsave register
- stwu 4,16(3) # offset 248
- addi 3,3,8
- stvx 20,0,3 # offset 256
- addi 3,3,16
- stvx 21,0,3 # offset 272
- addi 3,3,16
- stvx 22,0,3 # offset 288
- addi 3,3,16
- stvx 23,0,3 # offset 304
- addi 3,3,16
- stvx 24,0,3 # offset 320
- addi 3,3,16
- stvx 25,0,3 # offset 336
- addi 3,3,16
- stvx 26,0,3 # offset 352
- addi 3,3,16
- stvx 27,0,3 # offset 368
- addi 3,3,16
- stvx 28,0,3 # offset 384
- addi 3,3,16
- stvx 29,0,3 # offset 400
- addi 3,3,16
- stvx 30,0,3 # offset 416
- addi 3,3,16
- stvx 31,0,3 # offset 432
-
- /* This requires a total of 240 + 8 + 8 + 12 * 16 == 448 bytes. */
-#endif
- li 3,0
- blr
-FUNC_END(setjmp)
-
-
-FUNC_START(longjmp)
-#ifdef __ALTIVEC__
- addi 3,3,15 # align Altivec to 16 byte boundary
- rlwinm 3,3,0,0,27
-#else
- addi 3,3,7 # align to 8 byte boundary
- rlwinm 3,3,0,0,28
-#endif
- lwz 1,0(3) # offset 0
- lwzu 2,4(3) # offset 4
- lwzu 13,4(3) # offset 8
- lwzu 14,4(3) # offset 12
- lwzu 15,4(3) # offset 16
- lwzu 16,4(3) # offset 20
- lwzu 17,4(3) # offset 24
- lwzu 18,4(3) # offset 28
- lwzu 19,4(3) # offset 32
- lwzu 20,4(3) # offset 36
- lwzu 21,4(3) # offset 40
- lwzu 22,4(3) # offset 44
- lwzu 23,4(3) # offset 48
- lwzu 24,4(3) # offset 52
- lwzu 25,4(3) # offset 56
- lwzu 26,4(3) # offset 60
- lwzu 27,4(3) # offset 64
- lwzu 28,4(3) # offset 68
- lwzu 29,4(3) # offset 72
- lwzu 30,4(3) # offset 76
- lwzu 31,4(3) # offset 80
- lwzu 5,4(3) # offset 84
- mtlr 5
- lwzu 5,4(3) # offset 88
- mtcrf 255,5
- # one word pad to get floating point aligned on 8 byte boundary
-#ifndef _SOFT_FLOAT
- lfdu 14,8(3) # offset 96
- lfdu 15,8(3) # offset 104
- lfdu 16,8(3) # offset 112
- lfdu 17,8(3) # offset 120
- lfdu 18,8(3) # offset 128
- lfdu 19,8(3) # offset 136
- lfdu 20,8(3) # offset 144
- lfdu 21,8(3) # offset 152
- lfdu 22,8(3) # offset 160
- lfdu 23,8(3) # offset 168
- lfdu 24,8(3) # offset 176
- lfdu 25,8(3) # offset 184
- lfdu 26,8(3) # offset 192
- lfdu 27,8(3) # offset 200
- lfdu 28,8(3) # offset 208
- lfdu 29,8(3) # offset 216
- lfdu 30,8(3) # offset 224
- lfdu 31,8(3) # offset 232
-#endif
-
-#ifdef __ALTIVEC__
- /* restore Altivec vrsave and v20-v31 registers */
- lwzu 5,16(3) # offset 248
- mtspr 256,5 # vrsave
- addi 3,3,8
- lvx 20,0,3 # offset 256
- addi 3,3,16
- lvx 21,0,3 # offset 272
- addi 3,3,16
- lvx 22,0,3 # offset 288
- addi 3,3,16
- lvx 23,0,3 # offset 304
- addi 3,3,16
- lvx 24,0,3 # offset 320
- addi 3,3,16
- lvx 25,0,3 # offset 336
- addi 3,3,16
- lvx 26,0,3 # offset 352
- addi 3,3,16
- lvx 27,0,3 # offset 368
- addi 3,3,16
- lvx 28,0,3 # offset 384
- addi 3,3,16
- lvx 29,0,3 # offset 400
- addi 3,3,16
- lvx 30,0,3 # offset 416
- addi 3,3,16
- lvx 31,0,3 # offset 432
-#endif
-
- mr. 3,4
- bclr+ 4,2
- li 3,1
- blr
-FUNC_END(longjmp)
diff --git a/newlib/libc/machine/powerpc/simdldtoa.c b/newlib/libc/machine/powerpc/simdldtoa.c
deleted file mode 100644
index d4299186d..000000000
--- a/newlib/libc/machine/powerpc/simdldtoa.c
+++ /dev/null
@@ -1,3715 +0,0 @@
-
- /* Extended precision arithmetic functions for long double I/O.
- * This program has been placed in the public domain.
- */
-
-#include <_ansi.h>
-#include <reent.h>
-#include <string.h>
-#include <stdlib.h>
-#include "mprec.h"
-#include "fix64.h"
-
-/* These are the externally visible entries. */
-/* linux name: long double _IO_strtold (char *, char **); */
-void _simdstrtold (char *, char **, LONG_DOUBLE_UNION *);
-char * _simdldtoa_r (struct _reent *, LONG_DOUBLE_UNION *, int, int, int *, int *, char **);
-int _simdldcheck (LONG_DOUBLE_UNION *);
-
- /* Number of 16 bit words in external x type format */
- #define NE 10
-
- /* Number of 16 bit words in internal format */
- #define NI (NE+3)
-
- /* Array offset to exponent */
- #define E 1
-
- /* Array offset to high guard word */
- #define M 2
-
- /* Number of bits of precision */
- #define NBITS ((NI-4)*16)
-
- /* Maximum number of decimal digits in ASCII conversion
- * = NBITS*log10(2)
- */
- #define NDEC (NBITS*8/27)
-
- /* The exponent of 1.0 */
- #define EXONE (0x3fff)
-
-/* Control structure for long doublue conversion including rounding precision values.
- * rndprc can be set to 80 (if NE=6), 64, 56, 53, or 24 bits.
- */
-typedef struct
-{
- int rlast;
- int rndprc;
- int rw;
- int re;
- int outexpon;
- unsigned short rmsk;
- unsigned short rmbit;
- unsigned short rebit;
- unsigned short rbit[NI];
- unsigned short equot[NI];
-} LDPARMS;
-
-static void esub(short unsigned int *a, short unsigned int *b, short unsigned int *c, LDPARMS *ldp);
-static void emul(short unsigned int *a, short unsigned int *b, short unsigned int *c, LDPARMS *ldp);
-static void ediv(short unsigned int *a, short unsigned int *b, short unsigned int *c, LDPARMS *ldp);
-static int ecmp(short unsigned int *a, short unsigned int *b);
-static int enormlz(short unsigned int *x);
-static int eshift(short unsigned int *x, int sc);
-static void eshup1(register short unsigned int *x);
-static void eshup8(register short unsigned int *x);
-static void eshup6(register short unsigned int *x);
-static void eshdn1(register short unsigned int *x);
-static void eshdn8(register short unsigned int *x);
-static void eshdn6(register short unsigned int *x);
-static void eneg(short unsigned int *x);
-static void emov(register short unsigned int *a, register short unsigned int *b);
-static void eclear(register short unsigned int *x);
-static void einfin(register short unsigned int *x, register LDPARMS *ldp);
-static void efloor(short unsigned int *x, short unsigned int *y, LDPARMS *ldp);
-static void etoasc(short unsigned int *x, char *string, int ndigs, int outformat, LDPARMS *ldp);
-
-#if SIMD_LDBL_MANT_DIG == 24
-static void e24toe(short unsigned int *pe, short unsigned int *y, LDPARMS *ldp);
-#elif SIMD_LDBL_MANT_DIG == 53
-static void e53toe(short unsigned int *pe, short unsigned int *y, LDPARMS *ldp);
-#elif SIMD_LDBL_MANT_DIG == 64
-static void e64toe(short unsigned int *pe, short unsigned int *y, LDPARMS *ldp);
-#else
-static void e113toe(short unsigned int *pe, short unsigned int *y, LDPARMS *ldp);
-#endif
-
-/* econst.c */
-/* e type constants used by high precision check routines */
-
-#if NE == 10
-/* 0.0 */
-static unsigned short ezero[NE] =
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,};
-
-/* 1.0E0 */
-static unsigned short eone[NE] =
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x3fff,};
-
-#else
-
-/* 0.0 */
-static unsigned short ezero[NE] = {
-0, 0000000,0000000,0000000,0000000,0000000,};
-/* 1.0E0 */
-static unsigned short eone[NE] = {
-0, 0000000,0000000,0000000,0100000,0x3fff,};
-
-#endif
-
-/* Debugging routine for displaying errors */
-#ifdef DEBUG
-/* Notice: the order of appearance of the following
- * messages is bound to the error codes defined
- * in mconf.h.
- */
-static char *ermsg[7] = {
-"unknown", /* error code 0 */
-"domain", /* error code 1 */
-"singularity", /* et seq. */
-"overflow",
-"underflow",
-"total loss of precision",
-"partial loss of precision"
-};
-#define mtherr(name, code) printf( "\n%s %s error\n", name, ermsg[code] );
-#else
-#define mtherr(name, code)
-#endif
-
-/* ieee.c
- *
- * Extended precision IEEE binary floating point arithmetic routines
- *
- * Numbers are stored in C language as arrays of 16-bit unsigned
- * short integers. The arguments of the routines are pointers to
- * the arrays.
- *
- *
- * External e type data structure, simulates Intel 8087 chip
- * temporary real format but possibly with a larger significand:
- *
- * NE-1 significand words (least significant word first,
- * most significant bit is normally set)
- * exponent (value = EXONE for 1.0,
- * top bit is the sign)
- *
- *
- * Internal data structure of a number (a "word" is 16 bits):
- *
- * ei[0] sign word (0 for positive, 0xffff for negative)
- * ei[1] biased exponent (value = EXONE for the number 1.0)
- * ei[2] high guard word (always zero after normalization)
- * ei[3]
- * to ei[NI-2] significand (NI-4 significand words,
- * most significant word first,
- * most significant bit is set)
- * ei[NI-1] low guard word (0x8000 bit is rounding place)
- *
- *
- *
- * Routines for external format numbers
- *
- * asctoe( string, e ) ASCII string to extended double e type
- * asctoe64( string, &d ) ASCII string to long double
- * asctoe53( string, &d ) ASCII string to double
- * asctoe24( string, &f ) ASCII string to single
- * asctoeg( string, e, prec, ldp ) ASCII string to specified precision
- * e24toe( &f, e, ldp ) IEEE single precision to e type
- * e53toe( &d, e, ldp ) IEEE double precision to e type
- * e64toe( &d, e, ldp ) IEEE long double precision to e type
- * e113toe( &d, e, ldp ) IEEE long double precision to e type
- * eabs(e) absolute value
- * eadd( a, b, c ) c = b + a
- * eclear(e) e = 0
- * ecmp (a, b) Returns 1 if a > b, 0 if a == b,
- * -1 if a < b, -2 if either a or b is a NaN.
- * ediv( a, b, c, ldp ) c = b / a
- * efloor( a, b, ldp ) truncate to integer, toward -infinity
- * efrexp( a, exp, s ) extract exponent and significand
- * eifrac( e, &l, frac ) e to long integer and e type fraction
- * euifrac( e, &l, frac ) e to unsigned long integer and e type fraction
- * einfin( e, ldp ) set e to infinity, leaving its sign alone
- * eldexp( a, n, b ) multiply by 2**n
- * emov( a, b ) b = a
- * emul( a, b, c, ldp ) c = b * a
- * eneg(e) e = -e
- * eround( a, b ) b = nearest integer value to a
- * esub( a, b, c, ldp ) c = b - a
- * e24toasc( &f, str, n ) single to ASCII string, n digits after decimal
- * e53toasc( &d, str, n ) double to ASCII string, n digits after decimal
- * e64toasc( &d, str, n ) long double to ASCII string
- * etoasc(e,str,n,fmt,ldp)e to ASCII string, n digits after decimal
- * etoe24( e, &f ) convert e type to IEEE single precision
- * etoe53( e, &d ) convert e type to IEEE double precision
- * etoe64( e, &d ) convert e type to IEEE long double precision
- * ltoe( &l, e ) long (32 bit) integer to e type
- * ultoe( &l, e ) unsigned long (32 bit) integer to e type
- * eisneg( e ) 1 if sign bit of e != 0, else 0
- * eisinf( e ) 1 if e has maximum exponent (non-IEEE)
- * or is infinite (IEEE)
- * eisnan( e ) 1 if e is a NaN
- * esqrt( a, b ) b = square root of a
- *
- *
- * Routines for internal format numbers
- *
- * eaddm( ai, bi ) add significands, bi = bi + ai
- * ecleaz(ei) ei = 0
- * ecleazs(ei) set ei = 0 but leave its sign alone
- * ecmpm( ai, bi ) compare significands, return 1, 0, or -1
- * edivm( ai, bi, ldp ) divide significands, bi = bi / ai
- * emdnorm(ai,l,s,exp,ldp) normalize and round off
- * emovi( a, ai ) convert external a to internal ai
- * emovo( ai, a, ldp ) convert internal ai to external a
- * emovz( ai, bi ) bi = ai, low guard word of bi = 0
- * emulm( ai, bi, ldp ) multiply significands, bi = bi * ai
- * enormlz(ei) left-justify the significand
- * eshdn1( ai ) shift significand and guards down 1 bit
- * eshdn8( ai ) shift down 8 bits
- * eshdn6( ai ) shift down 16 bits
- * eshift( ai, n ) shift ai n bits up (or down if n < 0)
- * eshup1( ai ) shift significand and guards up 1 bit
- * eshup8( ai ) shift up 8 bits
- * eshup6( ai ) shift up 16 bits
- * esubm( ai, bi ) subtract significands, bi = bi - ai
- *
- *
- * The result is always normalized and rounded to NI-4 word precision
- * after each arithmetic operation.
- *
- * Exception flags are NOT fully supported.
- *
- * Define INFINITY in mconf.h for support of infinity; otherwise a
- * saturation arithmetic is implemented.
- *
- * Define NANS for support of Not-a-Number items; otherwise the
- * arithmetic will never produce a NaN output, and might be confused
- * by a NaN input.
- * If NaN's are supported, the output of ecmp(a,b) is -2 if
- * either a or b is a NaN. This means asking if(ecmp(a,b) < 0)
- * may not be legitimate. Use if(ecmp(a,b) == -1) for less-than
- * if in doubt.
- * Signaling NaN's are NOT supported; they are treated the same
- * as quiet NaN's.
- *
- * Denormals are always supported here where appropriate (e.g., not
- * for conversion to DEC numbers).
- */
-
-/*
- * Revision history:
- *
- * 5 Jan 84 PDP-11 assembly language version
- * 6 Dec 86 C language version
- * 30 Aug 88 100 digit version, improved rounding
- * 15 May 92 80-bit long double support
- * 22 Nov 00 Revised to fit into newlib by Jeff Johnston <jjohnstn@redhat.com>
- *
- * Author: S. L. Moshier.
- *
- * Copyright (c) 1984,2000 S.L. Moshier
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose without fee is hereby granted, provided that this entire notice
- * is included in all copies of any software which is or includes a copy
- * or modification of this software and in all copies of the supporting
- * documentation for such software.
- *
- * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION
- * OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
- * SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
- *
- */
-
-#include <stdio.h>
-/* #include "\usr\include\stdio.h" */
-/*#include "ehead.h"*/
-/*#include "mconf.h"*/
-/* mconf.h
- *
- * Common include file for math routines
- *
- *
- *
- * SYNOPSIS:
- *
- * #include "mconf.h"
- *
- *
- *
- * DESCRIPTION:
- *
- * This file contains definitions for error codes that are
- * passed to the common error handling routine mtherr()
- * (which see).
- *
- * The file also includes a conditional assembly definition
- * for the type of computer arithmetic (IEEE, DEC, Motorola
- * IEEE, or UNKnown).
- *
- * For Digital Equipment PDP-11 and VAX computers, certain
- * IBM systems, and others that use numbers with a 56-bit
- * significand, the symbol DEC should be defined. In this
- * mode, most floating point constants are given as arrays
- * of octal integers to eliminate decimal to binary conversion
- * errors that might be introduced by the compiler.
- *
- * For computers, such as IBM PC, that follow the IEEE
- * Standard for Binary Floating Point Arithmetic (ANSI/IEEE
- * Std 754-1985), the symbol IBMPC should be defined. These
- * numbers have 53-bit significands. In this mode, constants
- * are provided as arrays of hexadecimal 16 bit integers.
- *
- * To accommodate other types of computer arithmetic, all
- * constants are also provided in a normal decimal radix
- * which one can hope are correctly converted to a suitable
- * format by the available C language compiler. To invoke
- * this mode, the symbol UNK is defined.
- *
- * An important difference among these modes is a predefined
- * set of machine arithmetic constants for each. The numbers
- * MACHEP (the machine roundoff error), MAXNUM (largest number
- * represented), and several other parameters are preset by
- * the configuration symbol. Check the file const.c to
- * ensure that these values are correct for your computer.
- *
- * For ANSI C compatibility, define ANSIC equal to 1. Currently
- * this affects only the atan2() function and others that use it.
- */
-
-/* Constant definitions for math error conditions
- */
-
-#define DOMAIN 1 /* argument domain error */
-#define SING 2 /* argument singularity */
-#define OVERFLOW 3 /* overflow range error */
-#define UNDERFLOW 4 /* underflow range error */
-#define TLOSS 5 /* total loss of precision */
-#define PLOSS 6 /* partial loss of precision */
-
-#define EDOM 33
-#define ERANGE 34
-
-typedef struct
- {
- double r;
- double i;
- }cmplx;
-
-/* Type of computer arithmetic */
-
-#ifndef DEC
-#ifdef __IEEE_LITTLE_ENDIAN
-#define IBMPC 1
-#else /* !__IEEE_LITTLE_ENDIAN */
-#define MIEEE 1
-#endif /* !__IEEE_LITTLE_ENDIAN */
-#endif /* !DEC */
-
-/* Define 1 for ANSI C atan2() function
- * See atan.c and clog.c.
- */
-#define ANSIC 1
-
-/*define VOLATILE volatile*/
-#define VOLATILE
-
-#define NANS
-#define INFINITY
-
-/* NaN's require infinity support. */
-#ifdef NANS
-#ifndef INFINITY
-#define INFINITY
-#endif
-#endif
-
-/* This handles 64-bit long ints. */
-#define LONGBITS (8 * sizeof(long))
-
-
-static void eaddm(short unsigned int *x, short unsigned int *y);
-static void esubm(short unsigned int *x, short unsigned int *y);
-static void emdnorm(short unsigned int *s, int lost, int subflg, long int exp, int rcntrl, LDPARMS *ldp);
-static int asctoeg(char *ss, short unsigned int *y, int oprec, LDPARMS *ldp);
-static void enan(short unsigned int *nan, int size);
-#if SIMD_LDBL_MANT_DIG == 24
-static void toe24(short unsigned int *x, short unsigned int *y);
-#elif SIMD_LDBL_MANT_DIG == 53
-static void toe53(short unsigned int *x, short unsigned int *y);
-#elif SIMD_LDBL_MANT_DIG == 64
-static void toe64(short unsigned int *a, short unsigned int *b);
-#else
-static void toe113(short unsigned int *a, short unsigned int *b);
-#endif
-static void eiremain(short unsigned int *den, short unsigned int *num, LDPARMS *ldp);
-static int ecmpm(register short unsigned int *a, register short unsigned int *b);
-static int edivm(short unsigned int *den, short unsigned int *num, LDPARMS *ldp);
-static int emulm(short unsigned int *a, short unsigned int *b, LDPARMS *ldp);
-static int eisneg(short unsigned int *x);
-static int eisinf(short unsigned int *x);
-static void emovi(short unsigned int *a, short unsigned int *b);
-static void emovo(short unsigned int *a, short unsigned int *b, LDPARMS *ldp);
-static void emovz(register short unsigned int *a, register short unsigned int *b);
-static void ecleaz(register short unsigned int *xi);
-static void eadd1(short unsigned int *a, short unsigned int *b, short unsigned int *c, int subflg, LDPARMS *ldp);
-static int eisnan(short unsigned int *x);
-static int eiisnan(short unsigned int *x);
-
-#ifdef DEC
-static void etodec(), todec(), dectoe();
-#endif
-
-/*
-; Clear out entire external format number.
-;
-; unsigned short x[];
-; eclear( x );
-*/
-
-static void eclear(register short unsigned int *x)
-{
-register int i;
-
-for( i=0; i<NE; i++ )
- *x++ = 0;
-}
-
-
-
-/* Move external format number from a to b.
- *
- * emov( a, b );
- */
-
-static void emov(register short unsigned int *a, register short unsigned int *b)
-{
-register int i;
-
-for( i=0; i<NE; i++ )
- *b++ = *a++;
-}
-
-
-/*
-; Negate external format number
-;
-; unsigned short x[NE];
-; eneg( x );
-*/
-
-static void eneg(short unsigned int *x)
-{
-
-#ifdef NANS
-if( eisnan(x) )
- return;
-#endif
-x[NE-1] ^= 0x8000; /* Toggle the sign bit */
-}
-
-
-
-/* Return 1 if external format number is negative,
- * else return zero.
- */
-static int eisneg(short unsigned int *x)
-{
-
-#ifdef NANS
-if( eisnan(x) )
- return( 0 );
-#endif
-if( x[NE-1] & 0x8000 )
- return( 1 );
-else
- return( 0 );
-}
-
-
-/* Return 1 if external format number has maximum possible exponent,
- * else return zero.
- */
-static int eisinf(short unsigned int *x)
-{
-
-if( (x[NE-1] & 0x7fff) == 0x7fff )
- {
-#ifdef NANS
- if( eisnan(x) )
- return( 0 );
-#endif
- return( 1 );
- }
-else
- return( 0 );
-}
-
-/* Check if e-type number is not a number.
- */
-static int eisnan(short unsigned int *x)
-{
-
-#ifdef NANS
-int i;
-/* NaN has maximum exponent */
-if( (x[NE-1] & 0x7fff) != 0x7fff )
- return (0);
-/* ... and non-zero significand field. */
-for( i=0; i<NE-1; i++ )
- {
- if( *x++ != 0 )
- return (1);
- }
-#endif
-return (0);
-}
-
-/*
-; Fill entire number, including exponent and significand, with
-; largest possible number. These programs implement a saturation
-; value that is an ordinary, legal number. A special value
-; "infinity" may also be implemented; this would require tests
-; for that value and implementation of special rules for arithmetic
-; operations involving inifinity.
-*/
-
-static void einfin(register short unsigned int *x, register LDPARMS *ldp)
-{
-register int i;
-
-#ifdef INFINITY
-for( i=0; i<NE-1; i++ )
- *x++ = 0;
-*x |= 32767;
-ldp = ldp;
-#else
-for( i=0; i<NE-1; i++ )
- *x++ = 0xffff;
-*x |= 32766;
-if( ldp->rndprc < NBITS )
- {
- if (ldp->rndprc == 113)
- {
- *(x - 9) = 0;
- *(x - 8) = 0;
- }
- if( ldp->rndprc == 64 )
- {
- *(x-5) = 0;
- }
- if( ldp->rndprc == 53 )
- {
- *(x-4) = 0xf800;
- }
- else
- {
- *(x-4) = 0;
- *(x-3) = 0;
- *(x-2) = 0xff00;
- }
- }
-#endif
-}
-
-/* Move in external format number,
- * converting it to internal format.
- */
-static void emovi(short unsigned int *a, short unsigned int *b)
-{
-register unsigned short *p, *q;
-int i;
-
-q = b;
-p = a + (NE-1); /* point to last word of external number */
-/* get the sign bit */
-if( *p & 0x8000 )
- *q++ = 0xffff;
-else
- *q++ = 0;
-/* get the exponent */
-*q = *p--;
-*q++ &= 0x7fff; /* delete the sign bit */
-#ifdef INFINITY
-if( (*(q-1) & 0x7fff) == 0x7fff )
- {
-#ifdef NANS
- if( eisnan(a) )
- {
- *q++ = 0;
- for( i=3; i<NI; i++ )
- *q++ = *p--;
- return;
- }
-#endif
- for( i=2; i<NI; i++ )
- *q++ = 0;
- return;
- }
-#endif
-/* clear high guard word */
-*q++ = 0;
-/* move in the significand */
-for( i=0; i<NE-1; i++ )
- *q++ = *p--;
-/* clear low guard word */
-*q = 0;
-}
-
-
-/* Move internal format number out,
- * converting it to external format.
- */
-static void emovo(short unsigned int *a, short unsigned int *b, LDPARMS *ldp)
-{
-register unsigned short *p, *q;
-unsigned short i;
-
-p = a;
-q = b + (NE-1); /* point to output exponent */
-/* combine sign and exponent */
-i = *p++;
-if( i )
- *q-- = *p++ | 0x8000;
-else
- *q-- = *p++;
-#ifdef INFINITY
-if( *(p-1) == 0x7fff )
- {
-#ifdef NANS
- if( eiisnan(a) )
- {
- enan( b, NBITS );
- return;
- }
-#endif
- einfin(b, ldp);
- return;
- }
-#endif
-/* skip over guard word */
-++p;
-/* move the significand */
-for( i=0; i<NE-1; i++ )
- *q-- = *p++;
-}
-
-
-/* Clear out internal format number.
- */
-
-static void ecleaz(register short unsigned int *xi)
-{
-register int i;
-
-for( i=0; i<NI; i++ )
- *xi++ = 0;
-}
-
-/* same, but don't touch the sign. */
-
-static void ecleazs(register short unsigned int *xi)
-{
-register int i;
-
-++xi;
-for(i=0; i<NI-1; i++)
- *xi++ = 0;
-}
-
-
-
-
-/* Move internal format number from a to b.
- */
-static void emovz(register short unsigned int *a, register short unsigned int *b)
-{
-register int i;
-
-for( i=0; i<NI-1; i++ )
- *b++ = *a++;
-/* clear low guard word */
-*b = 0;
-}
-
-/* Return nonzero if internal format number is a NaN.
- */
-
-static int eiisnan (short unsigned int *x)
-{
-int i;
-
-if( (x[E] & 0x7fff) == 0x7fff )
- {
- for( i=M+1; i<NI; i++ )
- {
- if( x[i] != 0 )
- return(1);
- }
- }
-return(0);
-}
-
-#if SIMD_LDBL_MANT_DIG == 64
-
-/* Return nonzero if internal format number is infinite. */
-static int
-eiisinf (x)
- unsigned short x[];
-{
-
-#ifdef NANS
- if (eiisnan (x))
- return (0);
-#endif
- if ((x[E] & 0x7fff) == 0x7fff)
- return (1);
- return (0);
-}
-#endif /* SIMD_LDBL_MANT_DIG == 64 */
-
-/*
-; Compare significands of numbers in internal format.
-; Guard words are included in the comparison.
-;
-; unsigned short a[NI], b[NI];
-; cmpm( a, b );
-;
-; for the significands:
-; returns +1 if a > b
-; 0 if a == b
-; -1 if a < b
-*/
-static int ecmpm(register short unsigned int *a, register short unsigned int *b)
-{
-int i;
-
-a += M; /* skip up to significand area */
-b += M;
-for( i=M; i<NI; i++ )
- {
- if( *a++ != *b++ )
- goto difrnt;
- }
-return(0);
-
-difrnt:
-if( *(--a) > *(--b) )
- return(1);
-else
- return(-1);
-}
-
-
-/*
-; Shift significand down by 1 bit
-*/
-
-static void eshdn1(register short unsigned int *x)
-{
-register unsigned short bits;
-int i;
-
-x += M; /* point to significand area */
-
-bits = 0;
-for( i=M; i<NI; i++ )
- {
- if( *x & 1 )
- bits |= 1;
- *x >>= 1;
- if( bits & 2 )
- *x |= 0x8000;
- bits <<= 1;
- ++x;
- }
-}
-
-
-
-/*
-; Shift significand up by 1 bit
-*/
-
-static void eshup1(register short unsigned int *x)
-{
-register unsigned short bits;
-int i;
-
-x += NI-1;
-bits = 0;
-
-for( i=M; i<NI; i++ )
- {
- if( *x & 0x8000 )
- bits |= 1;
- *x <<= 1;
- if( bits & 2 )
- *x |= 1;
- bits <<= 1;
- --x;
- }
-}
-
-
-
-/*
-; Shift significand down by 8 bits
-*/
-
-static void eshdn8(register short unsigned int *x)
-{
-register unsigned short newbyt, oldbyt;
-int i;
-
-x += M;
-oldbyt = 0;
-for( i=M; i<NI; i++ )
- {
- newbyt = *x << 8;
- *x >>= 8;
- *x |= oldbyt;
- oldbyt = newbyt;
- ++x;
- }
-}
-
-/*
-; Shift significand up by 8 bits
-*/
-
-static void eshup8(register short unsigned int *x)
-{
-int i;
-register unsigned short newbyt, oldbyt;
-
-x += NI-1;
-oldbyt = 0;
-
-for( i=M; i<NI; i++ )
- {
- newbyt = *x >> 8;
- *x <<= 8;
- *x |= oldbyt;
- oldbyt = newbyt;
- --x;
- }
-}
-
-/*
-; Shift significand up by 16 bits
-*/
-
-static void eshup6(register short unsigned int *x)
-{
-int i;
-register unsigned short *p;
-
-p = x + M;
-x += M + 1;
-
-for( i=M; i<NI-1; i++ )
- *p++ = *x++;
-
-*p = 0;
-}
-
-/*
-; Shift significand down by 16 bits
-*/
-
-static void eshdn6(register short unsigned int *x)
-{
-int i;
-register unsigned short *p;
-
-x += NI-1;
-p = x + 1;
-
-for( i=M; i<NI-1; i++ )
- *(--p) = *(--x);
-
-*(--p) = 0;
-}
-
-/*
-; Add significands
-; x + y replaces y
-*/
-
-static void eaddm(short unsigned int *x, short unsigned int *y)
-{
-register unsigned long a;
-int i;
-unsigned int carry;
-
-x += NI-1;
-y += NI-1;
-carry = 0;
-for( i=M; i<NI; i++ )
- {
- a = (unsigned long )(*x) + (unsigned long )(*y) + carry;
- if( a & 0x10000 )
- carry = 1;
- else
- carry = 0;
- *y = (unsigned short )a;
- --x;
- --y;
- }
-}
-
-/*
-; Subtract significands
-; y - x replaces y
-*/
-
-static void esubm(short unsigned int *x, short unsigned int *y)
-{
-unsigned long a;
-int i;
-unsigned int carry;
-
-x += NI-1;
-y += NI-1;
-carry = 0;
-for( i=M; i<NI; i++ )
- {
- a = (unsigned long )(*y) - (unsigned long )(*x) - carry;
- if( a & 0x10000 )
- carry = 1;
- else
- carry = 0;
- *y = (unsigned short )a;
- --x;
- --y;
- }
-}
-
-
-/* Divide significands */
-
-
-/* Multiply significand of e-type number b
-by 16-bit quantity a, e-type result to c. */
-
-static void m16m(short unsigned int a, short unsigned int *b, short unsigned int *c)
-{
-register unsigned short *pp;
-register unsigned long carry;
-unsigned short *ps;
-unsigned short p[NI];
-unsigned long aa, m;
-int i;
-
-aa = a;
-pp = &p[NI-2];
-*pp++ = 0;
-*pp = 0;
-ps = &b[NI-1];
-
-for( i=M+1; i<NI; i++ )
- {
- if( *ps == 0 )
- {
- --ps;
- --pp;
- *(pp-1) = 0;
- }
- else
- {
- m = (unsigned long) aa * *ps--;
- carry = (m & 0xffff) + *pp;
- *pp-- = (unsigned short )carry;
- carry = (carry >> 16) + (m >> 16) + *pp;
- *pp = (unsigned short )carry;
- *(pp-1) = carry >> 16;
- }
- }
-for( i=M; i<NI; i++ )
- c[i] = p[i];
-}
-
-
-/* Divide significands. Neither the numerator nor the denominator
-is permitted to have its high guard word nonzero. */
-
-
-static int edivm(short unsigned int *den, short unsigned int *num, LDPARMS *ldp)
-{
-int i;
-register unsigned short *p;
-unsigned long tnum;
-unsigned short j, tdenm, tquot;
-unsigned short tprod[NI+1];
-unsigned short *equot = ldp->equot;
-
-p = &equot[0];
-*p++ = num[0];
-*p++ = num[1];
-
-for( i=M; i<NI; i++ )
- {
- *p++ = 0;
- }
-eshdn1( num );
-tdenm = den[M+1];
-for( i=M; i<NI; i++ )
- {
- /* Find trial quotient digit (the radix is 65536). */
- tnum = (((unsigned long) num[M]) << 16) + num[M+1];
-
- /* Do not execute the divide instruction if it will overflow. */
- if( (tdenm * 0xffffUL) < tnum )
- tquot = 0xffff;
- else
- tquot = tnum / tdenm;
-
- /* Prove that the divide worked. */
-/*
- tcheck = (unsigned long )tquot * tdenm;
- if( tnum - tcheck > tdenm )
- tquot = 0xffff;
-*/
- /* Multiply denominator by trial quotient digit. */
- m16m( tquot, den, tprod );
- /* The quotient digit may have been overestimated. */
- if( ecmpm( tprod, num ) > 0 )
- {
- tquot -= 1;
- esubm( den, tprod );
- if( ecmpm( tprod, num ) > 0 )
- {
- tquot -= 1;
- esubm( den, tprod );
- }
- }
-/*
- if( ecmpm( tprod, num ) > 0 )
- {
- eshow( "tprod", tprod );
- eshow( "num ", num );
- printf( "tnum = %08lx, tden = %04x, tquot = %04x\n",
- tnum, den[M+1], tquot );
- }
-*/
- esubm( tprod, num );
-/*
- if( ecmpm( num, den ) >= 0 )
- {
- eshow( "num ", num );
- eshow( "den ", den );
- printf( "tnum = %08lx, tden = %04x, tquot = %04x\n",
- tnum, den[M+1], tquot );
- }
-*/
- equot[i] = tquot;
- eshup6(num);
- }
-/* test for nonzero remainder after roundoff bit */
-p = &num[M];
-j = 0;
-for( i=M; i<NI; i++ )
- {
- j |= *p++;
- }
-if( j )
- j = 1;
-
-for( i=0; i<NI; i++ )
- num[i] = equot[i];
-
-return( (int )j );
-}
-
-
-
-/* Multiply significands */
-static int emulm(short unsigned int *a, short unsigned int *b, LDPARMS *ldp)
-{
-unsigned short *p, *q;
-unsigned short pprod[NI];
-unsigned short j;
-int i;
-unsigned short *equot = ldp->equot;
-
-equot[0] = b[0];
-equot[1] = b[1];
-for( i=M; i<NI; i++ )
- equot[i] = 0;
-
-j = 0;
-p = &a[NI-1];
-q = &equot[NI-1];
-for( i=M+1; i<NI; i++ )
- {
- if( *p == 0 )
- {
- --p;
- }
- else
- {
- m16m( *p--, b, pprod );
- eaddm(pprod, equot);
- }
- j |= *q;
- eshdn6(equot);
- }
-
-for( i=0; i<NI; i++ )
- b[i] = equot[i];
-
-/* return flag for lost nonzero bits */
-return( (int)j );
-}
-
-
-/*
-static void eshow(str, x)
-char *str;
-unsigned short *x;
-{
-int i;
-
-printf( "%s ", str );
-for( i=0; i<NI; i++ )
- printf( "%04x ", *x++ );
-printf( "\n" );
-}
-*/
-
-
-/*
- * Normalize and round off.
- *
- * The internal format number to be rounded is "s".
- * Input "lost" indicates whether the number is exact.
- * This is the so-called sticky bit.
- *
- * Input "subflg" indicates whether the number was obtained
- * by a subtraction operation. In that case if lost is nonzero
- * then the number is slightly smaller than indicated.
- *
- * Input "exp" is the biased exponent, which may be negative.
- * the exponent field of "s" is ignored but is replaced by
- * "exp" as adjusted by normalization and rounding.
- *
- * Input "rcntrl" is the rounding control.
- */
-
-
-static void emdnorm(short unsigned int *s, int lost, int subflg, long int exp, int rcntrl, LDPARMS *ldp)
-{
-int i, j;
-unsigned short r;
-
-/* Normalize */
-j = enormlz( s );
-
-/* a blank significand could mean either zero or infinity. */
-#ifndef INFINITY
-if( j > NBITS )
- {
- ecleazs( s );
- return;
- }
-#endif
-exp -= j;
-#ifndef INFINITY
-if( exp >= 32767L )
- goto overf;
-#else
-if( (j > NBITS) && (exp < 32767L) )
- {
- ecleazs( s );
- return;
- }
-#endif
-if( exp < 0L )
- {
- if( exp > (long )(-NBITS-1) )
- {
- j = (int )exp;
- i = eshift( s, j );
- if( i )
- lost = 1;
- }
- else
- {
- ecleazs( s );
- return;
- }
- }
-/* Round off, unless told not to by rcntrl. */
-if( rcntrl == 0 )
- goto mdfin;
-/* Set up rounding parameters if the control register changed. */
-if( ldp->rndprc != ldp->rlast )
- {
- ecleaz( ldp->rbit );
- switch( ldp->rndprc )
- {
- default:
- case NBITS:
- ldp->rw = NI-1; /* low guard word */
- ldp->rmsk = 0xffff;
- ldp->rmbit = 0x8000;
- ldp->rebit = 1;
- ldp->re = ldp->rw - 1;
- break;
- case 113:
- ldp->rw = 10;
- ldp->rmsk = 0x7fff;
- ldp->rmbit = 0x4000;
- ldp->rebit = 0x8000;
- ldp->re = ldp->rw;
- break;
- case 64:
- ldp->rw = 7;
- ldp->rmsk = 0xffff;
- ldp->rmbit = 0x8000;
- ldp->rebit = 1;
- ldp->re = ldp->rw-1;
- break;
-/* For DEC arithmetic */
- case 56:
- ldp->rw = 6;
- ldp->rmsk = 0xff;
- ldp->rmbit = 0x80;
- ldp->rebit = 0x100;
- ldp->re = ldp->rw;
- break;
- case 53:
- ldp->rw = 6;
- ldp->rmsk = 0x7ff;
- ldp->rmbit = 0x0400;
- ldp->rebit = 0x800;
- ldp->re = ldp->rw;
- break;
- case 24:
- ldp->rw = 4;
- ldp->rmsk = 0xff;
- ldp->rmbit = 0x80;
- ldp->rebit = 0x100;
- ldp->re = ldp->rw;
- break;
- }
- ldp->rbit[ldp->re] = ldp->rebit;
- ldp->rlast = ldp->rndprc;
- }
-
-/* Shift down 1 temporarily if the data structure has an implied
- * most significant bit and the number is denormal.
- * For rndprc = 64 or NBITS, there is no implied bit.
- * But Intel long double denormals lose one bit of significance even so.
- */
-#if IBMPC
-if( (exp <= 0) && (ldp->rndprc != NBITS) )
-#else
-if( (exp <= 0) && (ldp->rndprc != 64) && (ldp->rndprc != NBITS) )
-#endif
- {
- lost |= s[NI-1] & 1;
- eshdn1(s);
- }
-/* Clear out all bits below the rounding bit,
- * remembering in r if any were nonzero.
- */
-r = s[ldp->rw] & ldp->rmsk;
-if( ldp->rndprc < NBITS )
- {
- i = ldp->rw + 1;
- while( i < NI )
- {
- if( s[i] )
- r |= 1;
- s[i] = 0;
- ++i;
- }
- }
-s[ldp->rw] &= ~ldp->rmsk;
-if( (r & ldp->rmbit) != 0 )
- {
- if( r == ldp->rmbit )
- {
- if( lost == 0 )
- { /* round to even */
- if( (s[ldp->re] & ldp->rebit) == 0 )
- goto mddone;
- }
- else
- {
- if( subflg != 0 )
- goto mddone;
- }
- }
- eaddm( ldp->rbit, s );
- }
-mddone:
-#if IBMPC
-if( (exp <= 0) && (ldp->rndprc != NBITS) )
-#else
-if( (exp <= 0) && (ldp->rndprc != 64) && (ldp->rndprc != NBITS) )
-#endif
- {
- eshup1(s);
- }
-if( s[2] != 0 )
- { /* overflow on roundoff */
- eshdn1(s);
- exp += 1;
- }
-mdfin:
-s[NI-1] = 0;
-if( exp >= 32767L )
- {
-#ifndef INFINITY
-overf:
-#endif
-#ifdef INFINITY
- s[1] = 32767;
- for( i=2; i<NI-1; i++ )
- s[i] = 0;
-#else
- s[1] = 32766;
- s[2] = 0;
- for( i=M+1; i<NI-1; i++ )
- s[i] = 0xffff;
- s[NI-1] = 0;
- if( (ldp->rndprc < 64) || (ldp->rndprc == 113) )
- {
- s[ldp->rw] &= ~ldp->rmsk;
- if( ldp->rndprc == 24 )
- {
- s[5] = 0;
- s[6] = 0;
- }
- }
-#endif
- return;
- }
-if( exp < 0 )
- s[1] = 0;
-else
- s[1] = (unsigned short )exp;
-}
-
-
-
-/*
-; Subtract external format numbers.
-;
-; unsigned short a[NE], b[NE], c[NE];
-; LDPARMS *ldp;
-; esub( a, b, c, ldp ); c = b - a
-*/
-
-static void esub(short unsigned int *a, short unsigned int *b, short unsigned int *c, LDPARMS *ldp)
-{
-
-#ifdef NANS
-if( eisnan(a) )
- {
- emov (a, c);
- return;
- }
-if( eisnan(b) )
- {
- emov(b,c);
- return;
- }
-/* Infinity minus infinity is a NaN.
- * Test for subtracting infinities of the same sign.
- */
-if( eisinf(a) && eisinf(b) && ((eisneg (a) ^ eisneg (b)) == 0))
- {
- mtherr( "esub", DOMAIN );
- enan( c, NBITS );
- return;
- }
-#endif
-eadd1( a, b, c, 1, ldp );
-}
-
-
-
-static void eadd1(short unsigned int *a, short unsigned int *b, short unsigned int *c, int subflg, LDPARMS *ldp)
-{
-unsigned short ai[NI], bi[NI], ci[NI];
-int i, lost, j, k;
-long lt, lta, ltb;
-
-#ifdef INFINITY
-if( eisinf(a) )
- {
- emov(a,c);
- if( subflg )
- eneg(c);
- return;
- }
-if( eisinf(b) )
- {
- emov(b,c);
- return;
- }
-#endif
-emovi( a, ai );
-emovi( b, bi );
-if( subflg )
- ai[0] = ~ai[0];
-
-/* compare exponents */
-lta = ai[E];
-ltb = bi[E];
-lt = lta - ltb;
-if( lt > 0L )
- { /* put the larger number in bi */
- emovz( bi, ci );
- emovz( ai, bi );
- emovz( ci, ai );
- ltb = bi[E];
- lt = -lt;
- }
-lost = 0;
-if( lt != 0L )
- {
- if( lt < (long )(-NBITS-1) )
- goto done; /* answer same as larger addend */
- k = (int )lt;
- lost = eshift( ai, k ); /* shift the smaller number down */
- }
-else
- {
-/* exponents were the same, so must compare significands */
- i = ecmpm( ai, bi );
- if( i == 0 )
- { /* the numbers are identical in magnitude */
- /* if different signs, result is zero */
- if( ai[0] != bi[0] )
- {
- eclear(c);
- return;
- }
- /* if same sign, result is double */
- /* double denomalized tiny number */
- if( (bi[E] == 0) && ((bi[3] & 0x8000) == 0) )
- {
- eshup1( bi );
- goto done;
- }
- /* add 1 to exponent unless both are zero! */
- for( j=1; j<NI-1; j++ )
- {
- if( bi[j] != 0 )
- {
-/* This could overflow, but let emovo take care of that. */
- ltb += 1;
- break;
- }
- }
- bi[E] = (unsigned short )ltb;
- goto done;
- }
- if( i > 0 )
- { /* put the larger number in bi */
- emovz( bi, ci );
- emovz( ai, bi );
- emovz( ci, ai );
- }
- }
-if( ai[0] == bi[0] )
- {
- eaddm( ai, bi );
- subflg = 0;
- }
-else
- {
- esubm( ai, bi );
- subflg = 1;
- }
-emdnorm( bi, lost, subflg, ltb, 64, ldp );
-
-done:
-emovo( bi, c, ldp );
-}
-
-
-
-/*
-; Divide.
-;
-; unsigned short a[NE], b[NE], c[NE];
-; LDPARMS *ldp;
-; ediv( a, b, c, ldp ); c = b / a
-*/
-static void ediv(short unsigned int *a, short unsigned int *b, short unsigned int *c, LDPARMS *ldp)
-{
-unsigned short ai[NI], bi[NI];
-int i;
-long lt, lta, ltb;
-
-#ifdef NANS
-/* Return any NaN input. */
-if( eisnan(a) )
- {
- emov(a,c);
- return;
- }
-if( eisnan(b) )
- {
- emov(b,c);
- return;
- }
-/* Zero over zero, or infinity over infinity, is a NaN. */
-if( ((ecmp(a,ezero) == 0) && (ecmp(b,ezero) == 0))
- || (eisinf (a) && eisinf (b)) )
- {
- mtherr( "ediv", DOMAIN );
- enan( c, NBITS );
- return;
- }
-#endif
-/* Infinity over anything else is infinity. */
-#ifdef INFINITY
-if( eisinf(b) )
- {
- if( eisneg(a) ^ eisneg(b) )
- *(c+(NE-1)) = 0x8000;
- else
- *(c+(NE-1)) = 0;
- einfin(c, ldp);
- return;
- }
-if( eisinf(a) )
- {
- eclear(c);
- return;
- }
-#endif
-emovi( a, ai );
-emovi( b, bi );
-lta = ai[E];
-ltb = bi[E];
-if( bi[E] == 0 )
- { /* See if numerator is zero. */
- for( i=1; i<NI-1; i++ )
- {
- if( bi[i] != 0 )
- {
- ltb -= enormlz( bi );
- goto dnzro1;
- }
- }
- eclear(c);
- return;
- }
-dnzro1:
-
-if( ai[E] == 0 )
- { /* possible divide by zero */
- for( i=1; i<NI-1; i++ )
- {
- if( ai[i] != 0 )
- {
- lta -= enormlz( ai );
- goto dnzro2;
- }
- }
- if( ai[0] == bi[0] )
- *(c+(NE-1)) = 0;
- else
- *(c+(NE-1)) = 0x8000;
- einfin(c, ldp);
- mtherr( "ediv", SING );
- return;
- }
-dnzro2:
-
-i = edivm( ai, bi, ldp );
-/* calculate exponent */
-lt = ltb - lta + EXONE;
-emdnorm( bi, i, 0, lt, 64, ldp );
-/* set the sign */
-if( ai[0] == bi[0] )
- bi[0] = 0;
-else
- bi[0] = 0Xffff;
-emovo( bi, c, ldp );
-}
-
-
-
-/*
-; Multiply.
-;
-; unsigned short a[NE], b[NE], c[NE];
-; LDPARMS *ldp
-; emul( a, b, c, ldp ); c = b * a
-*/
-static void emul(short unsigned int *a, short unsigned int *b, short unsigned int *c, LDPARMS *ldp)
-{
-unsigned short ai[NI], bi[NI];
-int i, j;
-long lt, lta, ltb;
-
-#ifdef NANS
-/* NaN times anything is the same NaN. */
-if( eisnan(a) )
- {
- emov(a,c);
- return;
- }
-if( eisnan(b) )
- {
- emov(b,c);
- return;
- }
-/* Zero times infinity is a NaN. */
-if( (eisinf(a) && (ecmp(b,ezero) == 0))
- || (eisinf(b) && (ecmp(a,ezero) == 0)) )
- {
- mtherr( "emul", DOMAIN );
- enan( c, NBITS );
- return;
- }
-#endif
-/* Infinity times anything else is infinity. */
-#ifdef INFINITY
-if( eisinf(a) || eisinf(b) )
- {
- if( eisneg(a) ^ eisneg(b) )
- *(c+(NE-1)) = 0x8000;
- else
- *(c+(NE-1)) = 0;
- einfin(c, ldp);
- return;
- }
-#endif
-emovi( a, ai );
-emovi( b, bi );
-lta = ai[E];
-ltb = bi[E];
-if( ai[E] == 0 )
- {
- for( i=1; i<NI-1; i++ )
- {
- if( ai[i] != 0 )
- {
- lta -= enormlz( ai );
- goto mnzer1;
- }
- }
- eclear(c);
- return;
- }
-mnzer1:
-
-if( bi[E] == 0 )
- {
- for( i=1; i<NI-1; i++ )
- {
- if( bi[i] != 0 )
- {
- ltb -= enormlz( bi );
- goto mnzer2;
- }
- }
- eclear(c);
- return;
- }
-mnzer2:
-
-/* Multiply significands */
-j = emulm( ai, bi, ldp );
-/* calculate exponent */
-lt = lta + ltb - (EXONE - 1);
-emdnorm( bi, j, 0, lt, 64, ldp );
-/* calculate sign of product */
-if( ai[0] == bi[0] )
- bi[0] = 0;
-else
- bi[0] = 0xffff;
-emovo( bi, c, ldp );
-}
-
-
-
-#if SIMD_LDBL_MANT_DIG > 64
-static void e113toe(short unsigned int *pe, short unsigned int *y, LDPARMS *ldp)
-{
-register unsigned short r;
-unsigned short *e, *p;
-unsigned short yy[NI];
-int denorm, i;
-
-e = pe;
-denorm = 0;
-ecleaz(yy);
-#ifdef IBMPC
-e += 7;
-#endif
-r = *e;
-yy[0] = 0;
-if( r & 0x8000 )
- yy[0] = 0xffff;
-r &= 0x7fff;
-#ifdef INFINITY
-if( r == 0x7fff )
- {
-#ifdef NANS
-#ifdef IBMPC
- for( i=0; i<7; i++ )
- {
- if( pe[i] != 0 )
- {
- enan( y, NBITS );
- return;
- }
- }
-#else /* !IBMPC */
- for( i=1; i<8; i++ )
- {
- if( pe[i] != 0 )
- {
- enan( y, NBITS );
- return;
- }
- }
-#endif /* !IBMPC */
-#endif /* NANS */
- eclear( y );
- einfin( y, ldp );
- if( *e & 0x8000 )
- eneg(y);
- return;
- }
-#endif /* INFINITY */
-yy[E] = r;
-p = &yy[M + 1];
-#ifdef IBMPC
-for( i=0; i<7; i++ )
- *p++ = *(--e);
-#else /* IBMPC */
-++e;
-for( i=0; i<7; i++ )
- *p++ = *e++;
-#endif /* IBMPC */
-/* If denormal, remove the implied bit; else shift down 1. */
-if( r == 0 )
- {
- yy[M] = 0;
- }
-else
- {
- yy[M] = 1;
- eshift( yy, -1 );
- }
-emovo(yy,y,ldp);
-}
-
-/* move out internal format to ieee long double */
-static void toe113(short unsigned int *a, short unsigned int *b)
-{
-register unsigned short *p, *q;
-unsigned short i;
-
-#ifdef NANS
-if( eiisnan(a) )
- {
- enan( b, 113 );
- return;
- }
-#endif
-p = a;
-#ifdef MIEEE
-q = b;
-#else
-q = b + 7; /* point to output exponent */
-#endif
-
-/* If not denormal, delete the implied bit. */
-if( a[E] != 0 )
- {
- eshup1 (a);
- }
-/* combine sign and exponent */
-i = *p++;
-#ifdef MIEEE
-if( i )
- *q++ = *p++ | 0x8000;
-else
- *q++ = *p++;
-#else
-if( i )
- *q-- = *p++ | 0x8000;
-else
- *q-- = *p++;
-#endif
-/* skip over guard word */
-++p;
-/* move the significand */
-#ifdef MIEEE
-for (i = 0; i < 7; i++)
- *q++ = *p++;
-#else
-for (i = 0; i < 7; i++)
- *q-- = *p++;
-#endif
-}
-#endif /* SIMD_LDBL_MANT_DIG > 64 */
-
-
-#if SIMD_LDBL_MANT_DIG == 64
-static void e64toe(short unsigned int *pe, short unsigned int *y, LDPARMS *ldp)
-{
-unsigned short yy[NI];
-unsigned short *p, *q, *e;
-int i;
-
-e = pe;
-p = yy;
-
-for( i=0; i<NE-5; i++ )
- *p++ = 0;
-#ifdef IBMPC
-for( i=0; i<5; i++ )
- *p++ = *e++;
-#endif
-#ifdef DEC
-for( i=0; i<5; i++ )
- *p++ = *e++;
-#endif
-#ifdef MIEEE
-p = &yy[0] + (NE-1);
-*p-- = *e++;
-++e; /* MIEEE skips over 2nd short */
-for( i=0; i<4; i++ )
- *p-- = *e++;
-#endif
-
-#ifdef IBMPC
-/* For Intel long double, shift denormal significand up 1
- -- but only if the top significand bit is zero. */
-if((yy[NE-1] & 0x7fff) == 0 && (yy[NE-2] & 0x8000) == 0)
- {
- unsigned short temp[NI+1];
- emovi(yy, temp);
- eshup1(temp);
- emovo(temp,y,ldp);
- return;
- }
-#endif
-#ifdef INFINITY
-/* Point to the exponent field. */
-p = &yy[NE-1];
-if( *p == 0x7fff )
- {
-#ifdef NANS
-#ifdef IBMPC
- for( i=0; i<4; i++ )
- {
- if((i != 3 && pe[i] != 0)
- /* Check for Intel long double infinity pattern. */
- || (i == 3 && pe[i] != 0x8000))
- {
- enan( y, NBITS );
- return;
- }
- }
-#endif
-#ifdef MIEEE
- for( i=2; i<=5; i++ )
- {
- if( pe[i] != 0 )
- {
- enan( y, NBITS );
- return;
- }
- }
-#endif
-#endif /* NANS */
- eclear( y );
- einfin( y, ldp );
- if( *p & 0x8000 )
- eneg(y);
- return;
- }
-#endif /* INFINITY */
-p = yy;
-q = y;
-for( i=0; i<NE; i++ )
- *q++ = *p++;
-}
-
-/* move out internal format to ieee long double */
-static void toe64(short unsigned int *a, short unsigned int *b)
-{
-register unsigned short *p, *q;
-unsigned short i;
-
-#ifdef NANS
-if( eiisnan(a) )
- {
- enan( b, 64 );
- return;
- }
-#endif
-#ifdef IBMPC
-/* Shift Intel denormal significand down 1. */
-if( a[E] == 0 )
- eshdn1(a);
-#endif
-p = a;
-#ifdef MIEEE
-q = b;
-#else
-q = b + 4; /* point to output exponent */
-/* NOTE: Intel data type is 96 bits wide, clear the last word here. */
-*(q+1)= 0;
-#endif
-
-/* combine sign and exponent */
-i = *p++;
-#ifdef MIEEE
-if( i )
- *q++ = *p++ | 0x8000;
-else
- *q++ = *p++;
-*q++ = 0; /* leave 2nd short blank */
-#else
-if( i )
- *q-- = *p++ | 0x8000;
-else
- *q-- = *p++;
-#endif
-/* skip over guard word */
-++p;
-/* move the significand */
-#ifdef MIEEE
-for( i=0; i<4; i++ )
- *q++ = *p++;
-#else
-#ifdef INFINITY
-#ifdef IBMPC
-if (eiisinf (a))
- {
- /* Intel long double infinity. */
- *q-- = 0x8000;
- *q-- = 0;
- *q-- = 0;
- *q = 0;
- return;
- }
-#endif /* IBMPC */
-#endif /* INFINITY */
-for( i=0; i<4; i++ )
- *q-- = *p++;
-#endif
-}
-
-#endif /* SIMD_LDBL_MANT_DIG == 64 */
-
-#if SIMD_LDBL_MANT_DIG == 53
-/*
-; Convert IEEE double precision to e type
-; double d;
-; unsigned short x[N+2];
-; e53toe( &d, x );
-*/
-static void e53toe(short unsigned int *pe, short unsigned int *y, LDPARMS *ldp)
-{
-#ifdef DEC
-
-dectoe( pe, y ); /* see etodec.c */
-
-#else
-
-register unsigned short r;
-register unsigned short *p, *e;
-unsigned short yy[NI];
-int denorm, k;
-
-e = pe;
-denorm = 0; /* flag if denormalized number */
-ecleaz(yy);
-#ifdef IBMPC
-e += 3;
-#endif
-#ifdef DEC
-e += 3;
-#endif
-r = *e;
-yy[0] = 0;
-if( r & 0x8000 )
- yy[0] = 0xffff;
-yy[M] = (r & 0x0f) | 0x10;
-r &= ~0x800f; /* strip sign and 4 significand bits */
-#ifdef INFINITY
-if( r == 0x7ff0 )
- {
-#ifdef NANS
-#ifdef IBMPC
- if( ((pe[3] & 0xf) != 0) || (pe[2] != 0)
- || (pe[1] != 0) || (pe[0] != 0) )
- {
- enan( y, NBITS );
- return;
- }
-#else /* !IBMPC */
- if( ((pe[0] & 0xf) != 0) || (pe[1] != 0)
- || (pe[2] != 0) || (pe[3] != 0) )
- {
- enan( y, NBITS );
- return;
- }
-#endif /* !IBMPC */
-#endif /* NANS */
- eclear( y );
- einfin( y, ldp );
- if( yy[0] )
- eneg(y);
- return;
- }
-#endif
-r >>= 4;
-/* If zero exponent, then the significand is denormalized.
- * So, take back the understood high significand bit. */
-if( r == 0 )
- {
- denorm = 1;
- yy[M] &= ~0x10;
- }
-r += EXONE - 01777;
-yy[E] = r;
-p = &yy[M+1];
-#ifdef IBMPC
-*p++ = *(--e);
-*p++ = *(--e);
-*p++ = *(--e);
-#else /* !IBMPC */
-++e;
-*p++ = *e++;
-*p++ = *e++;
-*p++ = *e++;
-#endif /* !IBMPC */
-(void )eshift( yy, -5 );
-if( denorm )
- { /* if zero exponent, then normalize the significand */
- if( (k = enormlz(yy)) > NBITS )
- ecleazs(yy);
- else
- yy[E] -= (unsigned short )(k-1);
- }
-emovo( yy, y, ldp );
-#endif /* !DEC */
-}
-
-/*
-; e type to IEEE double precision
-; double d;
-; unsigned short x[NE];
-; etoe53( x, &d );
-*/
-
-#ifdef DEC
-
-static void etoe53( x, e )
-unsigned short *x, *e;
-{
-etodec( x, e ); /* see etodec.c */
-}
-
-static void toe53( x, y )
-unsigned short *x, *y;
-{
-todec( x, y );
-}
-
-#else
-
-static void toe53(short unsigned int *x, short unsigned int *y)
-{
-unsigned short i;
-unsigned short *p;
-
-
-#ifdef NANS
-if( eiisnan(x) )
- {
- enan( y, 53 );
- return;
- }
-#endif
-p = &x[0];
-#ifdef IBMPC
-y += 3;
-#endif
-#ifdef DEC
-y += 3;
-#endif
-*y = 0; /* output high order */
-if( *p++ )
- *y = 0x8000; /* output sign bit */
-
-i = *p++;
-if( i >= (unsigned int )2047 )
- { /* Saturate at largest number less than infinity. */
-#ifdef INFINITY
- *y |= 0x7ff0;
-#ifdef IBMPC
- *(--y) = 0;
- *(--y) = 0;
- *(--y) = 0;
-#else /* !IBMPC */
- ++y;
- *y++ = 0;
- *y++ = 0;
- *y++ = 0;
-#endif /* IBMPC */
-#else /* !INFINITY */
- *y |= (unsigned short )0x7fef;
-#ifdef IBMPC
- *(--y) = 0xffff;
- *(--y) = 0xffff;
- *(--y) = 0xffff;
-#else /* !IBMPC */
- ++y;
- *y++ = 0xffff;
- *y++ = 0xffff;
- *y++ = 0xffff;
-#endif
-#endif /* !INFINITY */
- return;
- }
-if( i == 0 )
- {
- (void )eshift( x, 4 );
- }
-else
- {
- i <<= 4;
- (void )eshift( x, 5 );
- }
-i |= *p++ & (unsigned short )0x0f; /* *p = xi[M] */
-*y |= (unsigned short )i; /* high order output already has sign bit set */
-#ifdef IBMPC
-*(--y) = *p++;
-*(--y) = *p++;
-*(--y) = *p;
-#else /* !IBMPC */
-++y;
-*y++ = *p++;
-*y++ = *p++;
-*y++ = *p++;
-#endif /* !IBMPC */
-}
-
-#endif /* not DEC */
-#endif /* SIMD_LDBL_MANT_DIG == 53 */
-
-#if SIMD_LDBL_MANT_DIG == 24
-/*
-; Convert IEEE single precision to e type
-; float d;
-; unsigned short x[N+2];
-; dtox( &d, x );
-*/
-void e24toe( short unsigned int *pe, short unsigned int *y, LDPARMS *ldp )
-{
-register unsigned short r;
-register unsigned short *p, *e;
-unsigned short yy[NI];
-int denorm, k;
-
-e = pe;
-denorm = 0; /* flag if denormalized number */
-ecleaz(yy);
-#ifdef IBMPC
-e += 1;
-#endif
-#ifdef DEC
-e += 1;
-#endif
-r = *e;
-yy[0] = 0;
-if( r & 0x8000 )
- yy[0] = 0xffff;
-yy[M] = (r & 0x7f) | 0200;
-r &= ~0x807f; /* strip sign and 7 significand bits */
-#ifdef INFINITY
-if( r == 0x7f80 )
- {
-#ifdef NANS
-#ifdef MIEEE
- if( ((pe[0] & 0x7f) != 0) || (pe[1] != 0) )
- {
- enan( y, NBITS );
- return;
- }
-#else /* !MIEEE */
- if( ((pe[1] & 0x7f) != 0) || (pe[0] != 0) )
- {
- enan( y, NBITS );
- return;
- }
-#endif /* !MIEEE */
-#endif /* NANS */
- eclear( y );
- einfin( y, ldp );
- if( yy[0] )
- eneg(y);
- return;
- }
-#endif
-r >>= 7;
-/* If zero exponent, then the significand is denormalized.
- * So, take back the understood high significand bit. */
-if( r == 0 )
- {
- denorm = 1;
- yy[M] &= ~0200;
- }
-r += EXONE - 0177;
-yy[E] = r;
-p = &yy[M+1];
-#ifdef IBMPC
-*p++ = *(--e);
-#endif
-#ifdef DEC
-*p++ = *(--e);
-#endif
-#ifdef MIEEE
-++e;
-*p++ = *e++;
-#endif
-(void )eshift( yy, -8 );
-if( denorm )
- { /* if zero exponent, then normalize the significand */
- if( (k = enormlz(yy)) > NBITS )
- ecleazs(yy);
- else
- yy[E] -= (unsigned short )(k-1);
- }
-emovo( yy, y, ldp );
-}
-
-static void toe24(short unsigned int *x, short unsigned int *y)
-{
-unsigned short i;
-unsigned short *p;
-
-#ifdef NANS
-if( eiisnan(x) )
- {
- enan( y, 24 );
- return;
- }
-#endif
-p = &x[0];
-#ifdef IBMPC
-y += 1;
-#endif
-#ifdef DEC
-y += 1;
-#endif
-*y = 0; /* output high order */
-if( *p++ )
- *y = 0x8000; /* output sign bit */
-
-i = *p++;
-if( i >= 255 )
- { /* Saturate at largest number less than infinity. */
-#ifdef INFINITY
- *y |= (unsigned short )0x7f80;
-#ifdef IBMPC
- *(--y) = 0;
-#endif
-#ifdef DEC
- *(--y) = 0;
-#endif
-#ifdef MIEEE
- ++y;
- *y = 0;
-#endif
-#else /* !INFINITY */
- *y |= (unsigned short )0x7f7f;
-#ifdef IBMPC
- *(--y) = 0xffff;
-#endif
-#ifdef DEC
- *(--y) = 0xffff;
-#endif
-#ifdef MIEEE
- ++y;
- *y = 0xffff;
-#endif
-#endif /* !INFINITY */
- return;
- }
-if( i == 0 )
- {
- (void )eshift( x, 7 );
- }
-else
- {
- i <<= 7;
- (void )eshift( x, 8 );
- }
-i |= *p++ & (unsigned short )0x7f; /* *p = xi[M] */
-*y |= i; /* high order output already has sign bit set */
-#ifdef IBMPC
-*(--y) = *p;
-#endif
-#ifdef DEC
-*(--y) = *p;
-#endif
-#ifdef MIEEE
-++y;
-*y = *p;
-#endif
-}
-#endif /* SIMD_LDBL_MANT_DIG == 24 */
-
-/* Compare two e type numbers.
- *
- * unsigned short a[NE], b[NE];
- * ecmp( a, b );
- *
- * returns +1 if a > b
- * 0 if a == b
- * -1 if a < b
- * -2 if either a or b is a NaN.
- */
-static int ecmp(short unsigned int *a, short unsigned int *b)
-{
-unsigned short ai[NI], bi[NI];
-register unsigned short *p, *q;
-register int i;
-int msign;
-
-#ifdef NANS
-if (eisnan (a) || eisnan (b))
- return( -2 );
-#endif
-emovi( a, ai );
-p = ai;
-emovi( b, bi );
-q = bi;
-
-if( *p != *q )
- { /* the signs are different */
-/* -0 equals + 0 */
- for( i=1; i<NI-1; i++ )
- {
- if( ai[i] != 0 )
- goto nzro;
- if( bi[i] != 0 )
- goto nzro;
- }
- return(0);
-nzro:
- if( *p == 0 )
- return( 1 );
- else
- return( -1 );
- }
-/* both are the same sign */
-if( *p == 0 )
- msign = 1;
-else
- msign = -1;
-i = NI-1;
-do
- {
- if( *p++ != *q++ )
- {
- goto diff;
- }
- }
-while( --i > 0 );
-
-return(0); /* equality */
-
-
-
-diff:
-
-if( *(--p) > *(--q) )
- return( msign ); /* p is bigger */
-else
- return( -msign ); /* p is littler */
-}
-
-
-/*
-; Shift significand
-;
-; Shifts significand area up or down by the number of bits
-; given by the variable sc.
-*/
-static int eshift(short unsigned int *x, int sc)
-{
-unsigned short lost;
-unsigned short *p;
-
-if( sc == 0 )
- return( 0 );
-
-lost = 0;
-p = x + NI-1;
-
-if( sc < 0 )
- {
- sc = -sc;
- while( sc >= 16 )
- {
- lost |= *p; /* remember lost bits */
- eshdn6(x);
- sc -= 16;
- }
-
- while( sc >= 8 )
- {
- lost |= *p & 0xff;
- eshdn8(x);
- sc -= 8;
- }
-
- while( sc > 0 )
- {
- lost |= *p & 1;
- eshdn1(x);
- sc -= 1;
- }
- }
-else
- {
- while( sc >= 16 )
- {
- eshup6(x);
- sc -= 16;
- }
-
- while( sc >= 8 )
- {
- eshup8(x);
- sc -= 8;
- }
-
- while( sc > 0 )
- {
- eshup1(x);
- sc -= 1;
- }
- }
-if( lost )
- lost = 1;
-return( (int )lost );
-}
-
-
-
-/*
-; normalize
-;
-; Shift normalizes the significand area pointed to by argument
-; shift count (up = positive) is returned.
-*/
-static int enormlz(short unsigned int *x)
-{
-register unsigned short *p;
-int sc;
-
-sc = 0;
-p = &x[M];
-if( *p != 0 )
- goto normdn;
-++p;
-if( *p & 0x8000 )
- return( 0 ); /* already normalized */
-while( *p == 0 )
- {
- eshup6(x);
- sc += 16;
-/* With guard word, there are NBITS+16 bits available.
- * return true if all are zero.
- */
- if( sc > NBITS )
- return( sc );
- }
-/* see if high byte is zero */
-while( (*p & 0xff00) == 0 )
- {
- eshup8(x);
- sc += 8;
- }
-/* now shift 1 bit at a time */
-while( (*p & 0x8000) == 0)
- {
- eshup1(x);
- sc += 1;
- if( sc > (NBITS+16) )
- {
- mtherr( "enormlz", UNDERFLOW );
- return( sc );
- }
- }
-return( sc );
-
-/* Normalize by shifting down out of the high guard word
- of the significand */
-normdn:
-
-if( *p & 0xff00 )
- {
- eshdn8(x);
- sc -= 8;
- }
-while( *p != 0 )
- {
- eshdn1(x);
- sc -= 1;
-
- if( sc < -NBITS )
- {
- mtherr( "enormlz", OVERFLOW );
- return( sc );
- }
- }
-return( sc );
-}
-
-
-
-
-/* Convert e type number to decimal format ASCII string.
- * The constants are for 64 bit precision.
- */
-
-#define NTEN 12
-#define MAXP 4096
-
-#if NE == 10
-static unsigned short etens[NTEN + 1][NE] =
-{
- {0x6576, 0x4a92, 0x804a, 0x153f,
- 0xc94c, 0x979a, 0x8a20, 0x5202, 0xc460, 0x7525,}, /* 10**4096 */
- {0x6a32, 0xce52, 0x329a, 0x28ce,
- 0xa74d, 0x5de4, 0xc53d, 0x3b5d, 0x9e8b, 0x5a92,}, /* 10**2048 */
- {0x526c, 0x50ce, 0xf18b, 0x3d28,
- 0x650d, 0x0c17, 0x8175, 0x7586, 0xc976, 0x4d48,},
- {0x9c66, 0x58f8, 0xbc50, 0x5c54,
- 0xcc65, 0x91c6, 0xa60e, 0xa0ae, 0xe319, 0x46a3,},
- {0x851e, 0xeab7, 0x98fe, 0x901b,
- 0xddbb, 0xde8d, 0x9df9, 0xebfb, 0xaa7e, 0x4351,},
- {0x0235, 0x0137, 0x36b1, 0x336c,
- 0xc66f, 0x8cdf, 0x80e9, 0x47c9, 0x93ba, 0x41a8,},
- {0x50f8, 0x25fb, 0xc76b, 0x6b71,
- 0x3cbf, 0xa6d5, 0xffcf, 0x1f49, 0xc278, 0x40d3,},
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0xf020, 0xb59d, 0x2b70, 0xada8, 0x9dc5, 0x4069,},
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0400, 0xc9bf, 0x8e1b, 0x4034,},
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x2000, 0xbebc, 0x4019,},
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0x9c40, 0x400c,},
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0xc800, 0x4005,},
- {0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000, 0xa000, 0x4002,}, /* 10**1 */
-};
-
-static unsigned short emtens[NTEN + 1][NE] =
-{
- {0x2030, 0xcffc, 0xa1c3, 0x8123,
- 0x2de3, 0x9fde, 0xd2ce, 0x04c8, 0xa6dd, 0x0ad8,}, /* 10**-4096 */
- {0x8264, 0xd2cb, 0xf2ea, 0x12d4,
- 0x4925, 0x2de4, 0x3436, 0x534f, 0xceae, 0x256b,}, /* 10**-2048 */
- {0xf53f, 0xf698, 0x6bd3, 0x0158,
- 0x87a6, 0xc0bd, 0xda57, 0x82a5, 0xa2a6, 0x32b5,},
- {0xe731, 0x04d4, 0xe3f2, 0xd332,
- 0x7132, 0xd21c, 0xdb23, 0xee32, 0x9049, 0x395a,},
- {0xa23e, 0x5308, 0xfefb, 0x1155,
- 0xfa91, 0x1939, 0x637a, 0x4325, 0xc031, 0x3cac,},
- {0xe26d, 0xdbde, 0xd05d, 0xb3f6,
- 0xac7c, 0xe4a0, 0x64bc, 0x467c, 0xddd0, 0x3e55,},
- {0x2a20, 0x6224, 0x47b3, 0x98d7,
- 0x3f23, 0xe9a5, 0xa539, 0xea27, 0xa87f, 0x3f2a,},
- {0x0b5b, 0x4af2, 0xa581, 0x18ed,
- 0x67de, 0x94ba, 0x4539, 0x1ead, 0xcfb1, 0x3f94,},
- {0xbf71, 0xa9b3, 0x7989, 0xbe68,
- 0x4c2e, 0xe15b, 0xc44d, 0x94be, 0xe695, 0x3fc9,},
- {0x3d4d, 0x7c3d, 0x36ba, 0x0d2b,
- 0xfdc2, 0xcefc, 0x8461, 0x7711, 0xabcc, 0x3fe4,},
- {0xc155, 0xa4a8, 0x404e, 0x6113,
- 0xd3c3, 0x652b, 0xe219, 0x1758, 0xd1b7, 0x3ff1,},
- {0xd70a, 0x70a3, 0x0a3d, 0xa3d7,
- 0x3d70, 0xd70a, 0x70a3, 0x0a3d, 0xa3d7, 0x3ff8,},
- {0xcccd, 0xcccc, 0xcccc, 0xcccc,
- 0xcccc, 0xcccc, 0xcccc, 0xcccc, 0xcccc, 0x3ffb,}, /* 10**-1 */
-};
-#else
-static unsigned short etens[NTEN+1][NE] = {
-{0xc94c,0x979a,0x8a20,0x5202,0xc460,0x7525,},/* 10**4096 */
-{0xa74d,0x5de4,0xc53d,0x3b5d,0x9e8b,0x5a92,},/* 10**2048 */
-{0x650d,0x0c17,0x8175,0x7586,0xc976,0x4d48,},
-{0xcc65,0x91c6,0xa60e,0xa0ae,0xe319,0x46a3,},
-{0xddbc,0xde8d,0x9df9,0xebfb,0xaa7e,0x4351,},
-{0xc66f,0x8cdf,0x80e9,0x47c9,0x93ba,0x41a8,},
-{0x3cbf,0xa6d5,0xffcf,0x1f49,0xc278,0x40d3,},
-{0xf020,0xb59d,0x2b70,0xada8,0x9dc5,0x4069,},
-{0x0000,0x0000,0x0400,0xc9bf,0x8e1b,0x4034,},
-{0x0000,0x0000,0x0000,0x2000,0xbebc,0x4019,},
-{0x0000,0x0000,0x0000,0x0000,0x9c40,0x400c,},
-{0x0000,0x0000,0x0000,0x0000,0xc800,0x4005,},
-{0x0000,0x0000,0x0000,0x0000,0xa000,0x4002,}, /* 10**1 */
-};
-
-static unsigned short emtens[NTEN+1][NE] = {
-{0x2de4,0x9fde,0xd2ce,0x04c8,0xa6dd,0x0ad8,}, /* 10**-4096 */
-{0x4925,0x2de4,0x3436,0x534f,0xceae,0x256b,}, /* 10**-2048 */
-{0x87a6,0xc0bd,0xda57,0x82a5,0xa2a6,0x32b5,},
-{0x7133,0xd21c,0xdb23,0xee32,0x9049,0x395a,},
-{0xfa91,0x1939,0x637a,0x4325,0xc031,0x3cac,},
-{0xac7d,0xe4a0,0x64bc,0x467c,0xddd0,0x3e55,},
-{0x3f24,0xe9a5,0xa539,0xea27,0xa87f,0x3f2a,},
-{0x67de,0x94ba,0x4539,0x1ead,0xcfb1,0x3f94,},
-{0x4c2f,0xe15b,0xc44d,0x94be,0xe695,0x3fc9,},
-{0xfdc2,0xcefc,0x8461,0x7711,0xabcc,0x3fe4,},
-{0xd3c3,0x652b,0xe219,0x1758,0xd1b7,0x3ff1,},
-{0x3d71,0xd70a,0x70a3,0x0a3d,0xa3d7,0x3ff8,},
-{0xcccd,0xcccc,0xcccc,0xcccc,0xcccc,0x3ffb,}, /* 10**-1 */
-};
-#endif
-
-
-
-/* ASCII string outputs for unix */
-
-
-#if 0
-void _IO_ldtostr(x, string, ndigs, flags, fmt)
-long double *x;
-char *string;
-int ndigs;
-int flags;
-char fmt;
-{
-unsigned short w[NI];
-char *t, *u;
-LDPARMS rnd;
-LDPARMS *ldp = &rnd;
-
-rnd.rlast = -1;
-rnd.rndprc = NBITS;
-
-if (sizeof(long double) == 16)
- e113toe( (unsigned short *)x, w, ldp );
-else
- e64toe( (unsigned short *)x, w, ldp );
-
-etoasc( w, string, ndigs, -1, ldp );
-if( ndigs == 0 && flags == 0 )
- {
- /* Delete the decimal point unless alternate format. */
- t = string;
- while( *t != '.' )
- ++t;
- u = t + 1;
- while( *t != '\0' )
- *t++ = *u++;
- }
-if (*string == ' ')
- {
- t = string;
- u = t + 1;
- while( *t != '\0' )
- *t++ = *u++;
- }
-if (fmt == 'E')
- {
- t = string;
- while( *t != 'e' )
- ++t;
- *t = 'E';
- }
-}
-
-#endif
-
-/* This routine will not return more than NDEC+1 digits. */
-
-char *
-_simdldtoa_r (struct _reent *ptr, LONG_DOUBLE_UNION *d, int mode, int ndigits, int *decpt,
- int *sign, char **rve)
-{
-unsigned short e[NI];
-char *s, *p;
-int k;
-LDPARMS rnd;
-LDPARMS *ldp = &rnd;
-char *outstr;
-
-rnd.rlast = -1;
-rnd.rndprc = NBITS;
-
- _REENT_CHECK_MP(ptr);
-
-/* reentrancy addition to use mprec storage pool */
-if (_REENT_MP_RESULT(ptr))
- {
- _REENT_MP_RESULT(ptr)->_k = _REENT_MP_RESULT_K(ptr);
- _REENT_MP_RESULT(ptr)->_maxwds = 1 << _REENT_MP_RESULT_K(ptr);
- Bfree (ptr, _REENT_MP_RESULT(ptr));
- _REENT_MP_RESULT(ptr) = 0;
- }
-
-#if SIMD_LDBL_MANT_DIG == 24
-e24toe( (unsigned short *)d, e, ldp );
-#elif SIMD_LDBL_MANT_DIG == 53
-e53toe( (unsigned short *)d, e, ldp );
-#elif SIMD_LDBL_MANT_DIG == 64
-e64toe( (unsigned short *)d, e, ldp );
-#else
-e113toe( (unsigned short *)d, e, ldp );
-#endif
-
-if( eisneg(e) )
- *sign = 1;
-else
- *sign = 0;
-/* Mode 3 is "f" format. */
-if( mode != 3 )
- ndigits -= 1;
-/* Mode 0 is for %.999 format, which is supposed to give a
- minimum length string that will convert back to the same binary value.
- For now, just ask for 20 digits which is enough but sometimes too many. */
-if( mode == 0 )
- ndigits = 20;
-/* This sanity limit must agree with the corresponding one in etoasc, to
- keep straight the returned value of outexpon. */
-if( ndigits > NDEC )
- ndigits = NDEC;
-
-/* reentrancy addition to use mprec storage pool */
-_REENT_MP_RESULT(ptr) = Balloc (ptr, 3);
-_REENT_MP_RESULT_K(ptr) = 3;
-outstr = (char *)_REENT_MP_RESULT(ptr);
-
-etoasc( e, outstr, ndigits, mode, ldp );
-s = outstr;
-if( eisinf(e) || eisnan(e) )
- {
- *decpt = 9999;
- goto stripspaces;
- }
-*decpt = ldp->outexpon + 1;
-
-/* Transform the string returned by etoasc into what the caller wants. */
-
-/* Look for decimal point and delete it from the string. */
-s = outstr;
-while( *s != '\0' )
- {
- if( *s == '.' )
- goto yesdecpt;
- ++s;
- }
-goto nodecpt;
-
-yesdecpt:
-
-/* Delete the decimal point. */
-while( *s != '\0' )
- {
- *s = *(s+1);
- ++s;
- }
-
-nodecpt:
-
-/* Back up over the exponent field. */
-while( *s != 'E' && s > outstr)
- --s;
-*s = '\0';
-
-stripspaces:
-
-/* Strip leading spaces and sign. */
-p = outstr;
-while( *p == ' ' || *p == '-')
- ++p;
-
-/* Find new end of string. */
-s = outstr;
-while( (*s++ = *p++) != '\0' )
- ;
---s;
-
-/* Strip trailing zeros. */
-if( mode == 2 )
- k = 1;
-else if( ndigits > ldp->outexpon )
- k = ndigits;
-else
- k = ldp->outexpon;
-
-while( *(s-1) == '0' && ((s - outstr) > k))
- *(--s) = '\0';
-
-/* In f format, flush small off-scale values to zero.
- Rounding has been taken care of by etoasc. */
-if( mode == 3 && ((ndigits + ldp->outexpon) < 0))
- {
- s = outstr;
- *s = '\0';
- *decpt = 0;
- }
-
-if( rve )
- *rve = s;
-return outstr;
-}
-
-/* Routine used to tell if long double is NaN or Infinity or regular number.
- Returns: 0 = regular number
- 1 = Nan
- 2 = Infinity
-*/
-int
-_simdldcheck (LONG_DOUBLE_UNION *d)
-{
-unsigned short e[NI];
-LDPARMS rnd;
-LDPARMS *ldp = &rnd;
-
-rnd.rlast = -1;
-rnd.rndprc = NBITS;
-
-#if SIMD_LDBL_MANT_DIG == 24
-e24toe( (unsigned short *)d, e, ldp );
-#elif SIMD_LDBL_MANT_DIG == 53
-e53toe( (unsigned short *)d, e, ldp );
-#elif SIMD_LDBL_MANT_DIG == 64
-e64toe( (unsigned short *)d, e, ldp );
-#else
-e113toe( (unsigned short *)d, e, ldp );
-#endif
-
-if( (e[NE-1] & 0x7fff) == 0x7fff )
- {
-#ifdef NANS
- if( eisnan(e) )
- return( 1 );
-#endif
- return( 2 );
- }
-else
- return( 0 );
-} /* _ldcheck */
-
-static void etoasc(short unsigned int *x, char *string, int ndigits, int outformat, LDPARMS *ldp)
-{
-long digit;
-unsigned short y[NI], t[NI], u[NI], w[NI];
-unsigned short *p, *r, *ten;
-unsigned short sign;
-int i, j, k, expon, rndsav, ndigs;
-char *s, *ss;
-unsigned short m;
-unsigned short *equot = ldp->equot;
-
-ndigs = ndigits;
-rndsav = ldp->rndprc;
-#ifdef NANS
-if( eisnan(x) )
- {
- sprintf( string, " NaN " );
- expon = 9999;
- goto bxit;
- }
-#endif
-ldp->rndprc = NBITS; /* set to full precision */
-emov( x, y ); /* retain external format */
-if( y[NE-1] & 0x8000 )
- {
- sign = 0xffff;
- y[NE-1] &= 0x7fff;
- }
-else
- {
- sign = 0;
- }
-expon = 0;
-ten = &etens[NTEN][0];
-emov( eone, t );
-/* Test for zero exponent */
-if( y[NE-1] == 0 )
- {
- for( k=0; k<NE-1; k++ )
- {
- if( y[k] != 0 )
- goto tnzro; /* denormalized number */
- }
- goto isone; /* legal all zeros */
- }
-tnzro:
-
-/* Test for infinity.
- */
-if( y[NE-1] == 0x7fff )
- {
- if( sign )
- sprintf( string, " -Infinity " );
- else
- sprintf( string, " Infinity " );
- expon = 9999;
- goto bxit;
- }
-
-/* Test for exponent nonzero but significand denormalized.
- * This is an error condition.
- */
-if( (y[NE-1] != 0) && ((y[NE-2] & 0x8000) == 0) )
- {
- mtherr( "etoasc", DOMAIN );
- sprintf( string, "NaN" );
- expon = 9999;
- goto bxit;
- }
-
-/* Compare to 1.0 */
-i = ecmp( eone, y );
-if( i == 0 )
- goto isone;
-
-if( i < 0 )
- { /* Number is greater than 1 */
-/* Convert significand to an integer and strip trailing decimal zeros. */
- emov( y, u );
- u[NE-1] = EXONE + NBITS - 1;
-
- p = &etens[NTEN-4][0];
- m = 16;
-do
- {
- ediv( p, u, t, ldp );
- efloor( t, w, ldp );
- for( j=0; j<NE-1; j++ )
- {
- if( t[j] != w[j] )
- goto noint;
- }
- emov( t, u );
- expon += (int )m;
-noint:
- p += NE;
- m >>= 1;
- }
-while( m != 0 );
-
-/* Rescale from integer significand */
- u[NE-1] += y[NE-1] - (unsigned int )(EXONE + NBITS - 1);
- emov( u, y );
-/* Find power of 10 */
- emov( eone, t );
- m = MAXP;
- p = &etens[0][0];
- while( ecmp( ten, u ) <= 0 )
- {
- if( ecmp( p, u ) <= 0 )
- {
- ediv( p, u, u, ldp );
- emul( p, t, t, ldp );
- expon += (int )m;
- }
- m >>= 1;
- if( m == 0 )
- break;
- p += NE;
- }
- }
-else
- { /* Number is less than 1.0 */
-/* Pad significand with trailing decimal zeros. */
- if( y[NE-1] == 0 )
- {
- while( (y[NE-2] & 0x8000) == 0 )
- {
- emul( ten, y, y, ldp );
- expon -= 1;
- }
- }
- else
- {
- emovi( y, w );
- for( i=0; i<NDEC+1; i++ )
- {
- if( (w[NI-1] & 0x7) != 0 )
- break;
-/* multiply by 10 */
- emovz( w, u );
- eshdn1( u );
- eshdn1( u );
- eaddm( w, u );
- u[1] += 3;
- while( u[2] != 0 )
- {
- eshdn1(u);
- u[1] += 1;
- }
- if( u[NI-1] != 0 )
- break;
- if( eone[NE-1] <= u[1] )
- break;
- emovz( u, w );
- expon -= 1;
- }
- emovo( w, y, ldp );
- }
- k = -MAXP;
- p = &emtens[0][0];
- r = &etens[0][0];
- emov( y, w );
- emov( eone, t );
- while( ecmp( eone, w ) > 0 )
- {
- if( ecmp( p, w ) >= 0 )
- {
- emul( r, w, w, ldp );
- emul( r, t, t, ldp );
- expon += k;
- }
- k /= 2;
- if( k == 0 )
- break;
- p += NE;
- r += NE;
- }
- ediv( t, eone, t, ldp );
- }
-isone:
-/* Find the first (leading) digit. */
-emovi( t, w );
-emovz( w, t );
-emovi( y, w );
-emovz( w, y );
-eiremain( t, y, ldp );
-digit = equot[NI-1];
-while( (digit == 0) && (ecmp(y,ezero) != 0) )
- {
- eshup1( y );
- emovz( y, u );
- eshup1( u );
- eshup1( u );
- eaddm( u, y );
- eiremain( t, y, ldp );
- digit = equot[NI-1];
- expon -= 1;
- }
-s = string;
-if( sign )
- *s++ = '-';
-else
- *s++ = ' ';
-/* Examine number of digits requested by caller. */
-if( outformat == 3 )
- ndigs += expon;
-/*
-else if( ndigs < 0 )
- ndigs = 0;
-*/
-if( ndigs > NDEC )
- ndigs = NDEC;
-if( digit == 10 )
- {
- *s++ = '1';
- *s++ = '.';
- if( ndigs > 0 )
- {
- *s++ = '0';
- ndigs -= 1;
- }
- expon += 1;
- if( ndigs < 0 )
- {
- ss = s;
- goto doexp;
- }
- }
-else
- {
- *s++ = (char )digit + '0';
- *s++ = '.';
- }
-/* Generate digits after the decimal point. */
-for( k=0; k<=ndigs; k++ )
- {
-/* multiply current number by 10, without normalizing */
- eshup1( y );
- emovz( y, u );
- eshup1( u );
- eshup1( u );
- eaddm( u, y );
- eiremain( t, y, ldp );
- *s++ = (char )equot[NI-1] + '0';
- }
-digit = equot[NI-1];
---s;
-ss = s;
-/* round off the ASCII string */
-if( digit > 4 )
- {
-/* Test for critical rounding case in ASCII output. */
- if( digit == 5 )
- {
- emovo( y, t, ldp );
- if( ecmp(t,ezero) != 0 )
- goto roun; /* round to nearest */
- if( (*(s-1) & 1) == 0 )
- goto doexp; /* round to even */
- }
-/* Round up and propagate carry-outs */
-roun:
- --s;
- k = *s & 0x7f;
-/* Carry out to most significant digit? */
- if( ndigs < 0 )
- {
- /* This will print like "1E-6". */
- *s = '1';
- expon += 1;
- goto doexp;
- }
- else if( k == '.' )
- {
- --s;
- k = *s;
- k += 1;
- *s = (char )k;
-/* Most significant digit carries to 10? */
- if( k > '9' )
- {
- expon += 1;
- *s = '1';
- }
- goto doexp;
- }
-/* Round up and carry out from less significant digits */
- k += 1;
- *s = (char )k;
- if( k > '9' )
- {
- *s = '0';
- goto roun;
- }
- }
-doexp:
-#ifdef __GO32__
-if( expon >= 0 )
- sprintf( ss, "e+%02d", expon );
-else
- sprintf( ss, "e-%02d", -expon );
-#else
- sprintf( ss, "E%d", expon );
-#endif
-bxit:
-ldp->rndprc = rndsav;
-ldp->outexpon = expon;
-}
-
-
-
-
-/*
-; ASCTOQ
-; ASCTOQ.MAC LATEST REV: 11 JAN 84
-; SLM, 3 JAN 78
-;
-; Convert ASCII string to quadruple precision floating point
-;
-; Numeric input is free field decimal number
-; with max of 15 digits with or without
-; decimal point entered as ASCII from teletype.
-; Entering E after the number followed by a second
-; number causes the second number to be interpreted
-; as a power of 10 to be multiplied by the first number
-; (i.e., "scientific" notation).
-;
-; Usage:
-; asctoq( string, q );
-*/
-
-void _simdstrtold (char *s, char **se, LONG_DOUBLE_UNION *x)
-{
- LDPARMS rnd;
- LDPARMS *ldp = &rnd;
- int lenldstr;
-
- rnd.rlast = -1;
- rnd.rndprc = NBITS;
-
- lenldstr = asctoeg( s, (unsigned short *)x, SIMD_LDBL_MANT_DIG, ldp );
- if (se)
- *se = s + lenldstr;
-}
-
-#define REASONABLE_LEN 200
-
-static int
-asctoeg(char *ss, short unsigned int *y, int oprec, LDPARMS *ldp)
-{
-unsigned short yy[NI], xt[NI], tt[NI];
-int esign, decflg, sgnflg, nexp, exp, prec, lost;
-int k, trail, c, rndsav;
-long lexp;
-unsigned short nsign, *p;
-char *sp, *s, *lstr;
-int lenldstr;
-int mflag = 0;
-char tmpstr[REASONABLE_LEN];
-
-/* Copy the input string. */
-c = strlen (ss) + 2;
-if (c <= REASONABLE_LEN)
- lstr = tmpstr;
-else
- {
- lstr = (char *) calloc (c, 1);
- mflag = 1;
- }
-s = ss;
-lenldstr = 0;
-while( *s == ' ' ) /* skip leading spaces */
- {
- ++s;
- ++lenldstr;
- }
-sp = lstr;
-for( k=0; k<c; k++ )
- {
- if( (*sp++ = *s++) == '\0' )
- break;
- }
-*sp = '\0';
-s = lstr;
-
-rndsav = ldp->rndprc;
-ldp->rndprc = NBITS; /* Set to full precision */
-lost = 0;
-nsign = 0;
-decflg = 0;
-sgnflg = 0;
-nexp = 0;
-exp = 0;
-prec = 0;
-ecleaz( yy );
-trail = 0;
-
-nxtcom:
-k = *s - '0';
-if( (k >= 0) && (k <= 9) )
- {
-/* Ignore leading zeros */
- if( (prec == 0) && (decflg == 0) && (k == 0) )
- goto donchr;
-/* Identify and strip trailing zeros after the decimal point. */
- if( (trail == 0) && (decflg != 0) )
- {
- sp = s;
- while( (*sp >= '0') && (*sp <= '9') )
- ++sp;
-/* Check for syntax error */
- c = *sp & 0x7f;
- if( (c != 'e') && (c != 'E') && (c != '\0')
- && (c != '\n') && (c != '\r') && (c != ' ')
- && (c != ',') )
- goto error;
- --sp;
- while( *sp == '0' )
- *sp-- = 'z';
- trail = 1;
- if( *s == 'z' )
- goto donchr;
- }
-/* If enough digits were given to more than fill up the yy register,
- * continuing until overflow into the high guard word yy[2]
- * guarantees that there will be a roundoff bit at the top
- * of the low guard word after normalization.
- */
- if( yy[2] == 0 )
- {
- if( decflg )
- nexp += 1; /* count digits after decimal point */
- eshup1( yy ); /* multiply current number by 10 */
- emovz( yy, xt );
- eshup1( xt );
- eshup1( xt );
- eaddm( xt, yy );
- ecleaz( xt );
- xt[NI-2] = (unsigned short )k;
- eaddm( xt, yy );
- }
- else
- {
- /* Mark any lost non-zero digit. */
- lost |= k;
- /* Count lost digits before the decimal point. */
- if (decflg == 0)
- nexp -= 1;
- }
- prec += 1;
- goto donchr;
- }
-
-switch( *s )
- {
- case 'z':
- break;
- case 'E':
- case 'e':
- goto expnt;
- case '.': /* decimal point */
- if( decflg )
- goto error;
- ++decflg;
- break;
- case '-':
- nsign = 0xffff;
- if( sgnflg )
- goto error;
- ++sgnflg;
- break;
- case '+':
- if( sgnflg )
- goto error;
- ++sgnflg;
- break;
- case ',':
- case ' ':
- case '\0':
- case '\n':
- case '\r':
- goto daldone;
- case 'i':
- case 'I':
- goto infinite;
- default:
- error:
-#ifdef NANS
- enan( yy, NI*16 );
-#else
- mtherr( "asctoe", DOMAIN );
- ecleaz(yy);
-#endif
- goto aexit;
- }
-donchr:
-++s;
-goto nxtcom;
-
-/* Exponent interpretation */
-expnt:
-
-esign = 1;
-exp = 0;
-++s;
-/* check for + or - */
-if( *s == '-' )
- {
- esign = -1;
- ++s;
- }
-if( *s == '+' )
- ++s;
-while( (*s >= '0') && (*s <= '9') )
- {
- exp *= 10;
- exp += *s++ - '0';
- if (exp > 4977)
- {
- if (esign < 0)
- goto zero;
- else
- goto infinite;
- }
- }
-if( esign < 0 )
- exp = -exp;
-if( exp > 4932 )
- {
-infinite:
- ecleaz(yy);
- yy[E] = 0x7fff; /* infinity */
- goto aexit;
- }
-if( exp < -4977 )
- {
-zero:
- ecleaz(yy);
- goto aexit;
- }
-
-daldone:
-nexp = exp - nexp;
-/* Pad trailing zeros to minimize power of 10, per IEEE spec. */
-while( (nexp > 0) && (yy[2] == 0) )
- {
- emovz( yy, xt );
- eshup1( xt );
- eshup1( xt );
- eaddm( yy, xt );
- eshup1( xt );
- if( xt[2] != 0 )
- break;
- nexp -= 1;
- emovz( xt, yy );
- }
-if( (k = enormlz(yy)) > NBITS )
- {
- ecleaz(yy);
- goto aexit;
- }
-lexp = (EXONE - 1 + NBITS) - k;
-emdnorm( yy, lost, 0, lexp, 64, ldp );
-/* convert to external format */
-
-
-/* Multiply by 10**nexp. If precision is 64 bits,
- * the maximum relative error incurred in forming 10**n
- * for 0 <= n <= 324 is 8.2e-20, at 10**180.
- * For 0 <= n <= 999, the peak relative error is 1.4e-19 at 10**947.
- * For 0 >= n >= -999, it is -1.55e-19 at 10**-435.
- */
-lexp = yy[E];
-if( nexp == 0 )
- {
- k = 0;
- goto expdon;
- }
-esign = 1;
-if( nexp < 0 )
- {
- nexp = -nexp;
- esign = -1;
- if( nexp > 4096 )
- { /* Punt. Can't handle this without 2 divides. */
- emovi( etens[0], tt );
- lexp -= tt[E];
- k = edivm( tt, yy, ldp );
- lexp += EXONE;
- nexp -= 4096;
- }
- }
-p = &etens[NTEN][0];
-emov( eone, xt );
-exp = 1;
-do
- {
- if( exp & nexp )
- emul( p, xt, xt, ldp );
- p -= NE;
- exp = exp + exp;
- }
-while( exp <= MAXP );
-
-emovi( xt, tt );
-if( esign < 0 )
- {
- lexp -= tt[E];
- k = edivm( tt, yy, ldp );
- lexp += EXONE;
- }
-else
- {
- lexp += tt[E];
- k = emulm( tt, yy, ldp );
- lexp -= EXONE - 1;
- }
-
-expdon:
-
-/* Round and convert directly to the destination type */
-if( oprec == 53 )
- lexp -= EXONE - 0x3ff;
-else if( oprec == 24 )
- lexp -= EXONE - 0177;
-#ifdef DEC
-else if( oprec == 56 )
- lexp -= EXONE - 0201;
-#endif
-ldp->rndprc = oprec;
-emdnorm( yy, k, 0, lexp, 64, ldp );
-
-aexit:
-
-ldp->rndprc = rndsav;
-yy[0] = nsign;
-switch( oprec )
- {
-#ifdef DEC
- case 56:
- todec( yy, y ); /* see etodec.c */
- break;
-#endif
-#if SIMD_LDBL_MANT_DIG == 53
- case 53:
- toe53( yy, y );
- break;
-#elif SIMD_LDBL_MANT_DIG == 24
- case 24:
- toe24( yy, y );
- break;
-#elif SIMD_LDBL_MANT_DIG == 64
- case 64:
- toe64( yy, y );
- break;
-#elif SIMD_LDBL_MANT_DIG == 113
- case 113:
- toe113( yy, y );
- break;
-#else
- case NBITS:
- emovo( yy, y, ldp );
- break;
-#endif
- }
-lenldstr += s - lstr;
-if (mflag)
- free (lstr);
-return lenldstr;
-}
-
-
-
-/* y = largest integer not greater than x
- * (truncated toward minus infinity)
- *
- * unsigned short x[NE], y[NE]
- * LDPARMS *ldp
- *
- * efloor( x, y, ldp );
- */
-static unsigned short bmask[] = {
-0xffff,
-0xfffe,
-0xfffc,
-0xfff8,
-0xfff0,
-0xffe0,
-0xffc0,
-0xff80,
-0xff00,
-0xfe00,
-0xfc00,
-0xf800,
-0xf000,
-0xe000,
-0xc000,
-0x8000,
-0x0000,
-};
-
-static void efloor(short unsigned int *x, short unsigned int *y, LDPARMS *ldp)
-{
-register unsigned short *p;
-int e, expon, i;
-unsigned short f[NE];
-
-emov( x, f ); /* leave in external format */
-expon = (int )f[NE-1];
-e = (expon & 0x7fff) - (EXONE - 1);
-if( e <= 0 )
- {
- eclear(y);
- goto isitneg;
- }
-/* number of bits to clear out */
-e = NBITS - e;
-emov( f, y );
-if( e <= 0 )
- return;
-
-p = &y[0];
-while( e >= 16 )
- {
- *p++ = 0;
- e -= 16;
- }
-/* clear the remaining bits */
-*p &= bmask[e];
-/* truncate negatives toward minus infinity */
-isitneg:
-
-if( (unsigned short )expon & (unsigned short )0x8000 )
- {
- for( i=0; i<NE-1; i++ )
- {
- if( f[i] != y[i] )
- {
- esub( eone, y, y, ldp );
- break;
- }
- }
- }
-}
-
-
-
-static void eiremain(short unsigned int *den, short unsigned int *num, LDPARMS *ldp)
-{
-long ld, ln;
-unsigned short j;
- unsigned short *equot = ldp->equot;
-
-ld = den[E];
-ld -= enormlz( den );
-ln = num[E];
-ln -= enormlz( num );
-ecleaz( equot );
-while( ln >= ld )
- {
- if( ecmpm(den,num) <= 0 )
- {
- esubm(den, num);
- j = 1;
- }
- else
- {
- j = 0;
- }
- eshup1(equot);
- equot[NI-1] |= j;
- eshup1(num);
- ln -= 1;
- }
-emdnorm( num, 0, 0, ln, 0, ldp );
-}
-
-/* NaN bit patterns
- */
-#ifdef MIEEE
-static unsigned short nan113[8] = {
- 0x7fff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff};
-static unsigned short nan64[6] = {0x7fff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff};
-static unsigned short nan53[4] = {0x7fff, 0xffff, 0xffff, 0xffff};
-static unsigned short nan24[2] = {0x7fff, 0xffff};
-#else /* !MIEEE */
-static unsigned short nan113[8] = {0, 0, 0, 0, 0, 0, 0x8000, 0x7fff};
-static unsigned short nan64[6] = {0, 0, 0, 0, 0xc000, 0x7fff};
-static unsigned short nan53[4] = {0, 0, 0, 0x7ff8};
-static unsigned short nan24[2] = {0, 0x7fc0};
-#endif /* !MIEEE */
-
-
-static void enan (short unsigned int *nan, int size)
-{
-int i, n;
-unsigned short *p;
-
-switch( size )
- {
-#ifndef DEC
- case 113:
- n = 8;
- p = nan113;
- break;
-
- case 64:
- n = 6;
- p = nan64;
- break;
-
- case 53:
- n = 4;
- p = nan53;
- break;
-
- case 24:
- n = 2;
- p = nan24;
- break;
-
- case NBITS:
- for( i=0; i<NE-2; i++ )
- *nan++ = 0;
- *nan++ = 0xc000;
- *nan++ = 0x7fff;
- return;
-
- case NI*16:
- *nan++ = 0;
- *nan++ = 0x7fff;
- *nan++ = 0;
- *nan++ = 0xc000;
- for( i=4; i<NI; i++ )
- *nan++ = 0;
- return;
-#endif
- default:
- mtherr( "enan", DOMAIN );
- return;
- }
-for (i=0; i < n; i++)
- *nan++ = *p++;
-}
-
-
-
-
diff --git a/newlib/libc/machine/powerpc/strtosfix16.c b/newlib/libc/machine/powerpc/strtosfix16.c
deleted file mode 100644
index ad629978c..000000000
--- a/newlib/libc/machine/powerpc/strtosfix16.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
-FUNCTION
- <<strtosfix16>>, <<strtosfix32>>, <<strtosfix64>>---string to signed fixed point
-
-INDEX
- strtosfix16
-INDEX
- strtosfix32
-INDEX
- strtosfix64
-INDEX
- _strtosfix16_r
-INDEX
- _strtosfix32_r
-INDEX
- _strtosfix64_r
-
-ANSI_SYNOPSIS
- #include <stdlib.h>
- __int16 strtosfix16 (const char *<[s]>, char **<[ptr]>);
-
- __int32 strtosfix32 (const char *<[s]>, char **<[ptr]>);
-
- __int64 strtosfix64 (const char *<[s]>, char **<[ptr]>);
-
- __int16 _strtosfix16_r (void *<[reent]>,
- const char *<[s]>, char **<[ptr]>);
-
- __int32 _strtosfix32_r (void *<[reent]>,
- const char *<[s]>, char **<[ptr]>);
-
- __int64 _strtosfix64_r (void *<[reent]>,
- const char *<[s]>, char **<[ptr]>);
-
-TRAD_SYNOPSIS
- #include <stdlib.h>
- __int16 strtosfix16 (<[s]>, <[ptr]>)
- char *<[s]>;
- char **<[ptr]>;
-
- __int32 strtosfix32 (<[s]>, <[ptr]>)
- char *<[s]>;
- char **<[ptr]>;
-
- __int64 strtosfix64 (<[s]>, <[ptr]>)
- char *<[s]>;
- char **<[ptr]>;
-
- __int16 _strtosfix16_r (<[reent]>, <[s]>, <[ptr]>)
- char *<[reent]>;
- char *<[s]>;
- char **<[ptr]>;
-
- __int32 _strtosfix32_r (<[reent]>, <[s]>, <[ptr]>)
- char *<[reent]>;
- char *<[s]>;
- char **<[ptr]>;
-
- __int64 _strtosfix64_r (<[reent]>, <[s]>, <[ptr]>)
- char *<[reent]>;
- char *<[s]>;
- char **<[ptr]>;
-
-DESCRIPTION
- The function <<strtosfix16>> converts the string <<*<[s]>>> to
- a fixed-point sign + 15-bits fraction representation. The function
- follows the same rules as <<strtod>>.
-
- The substring converted is the longest initial
- subsequence of <[s]>, beginning with the first
- non-whitespace character, that has the format:
- .[+|-]<[digits]>[.][<[digits]>][(e|E)[+|-]<[digits]>]
- The substring contains no characters if <[s]> is empty, consists
- entirely of whitespace, or if the first non-whitespace
- character is something other than <<+>>, <<->>, <<.>>, or a
- digit. If the substring is empty, no conversion is done, and
- the value of <[s]> is stored in <<*<[ptr]>>>. Otherwise,
- the substring is converted, and a pointer to the final string
- (which will contain at least the terminating null character of
- <[s]>) is stored in <<*<[ptr]>>>. If you want no
- assignment to <<*<[ptr]>>>, pass a null pointer as <[ptr]>.
-
- <<strtosfix32>> is identical to <<strtosfix16>> except that it
- converts to fixed-point sign + 31-bits fraction representation.
- <<strtosfix64>> is also similar, except that it converts
- to fixed-point sign + 63-bit fraction format.
-
- The alternate functions <<_strtosfix16_r>>, <<_strtosfix32_r>>,
- and <<_strtosfix64_r>> are reentrant versions.
- The extra argument <[reent]> is a pointer to a reentrancy structure.
-
-RETURNS
- The functions return the converted substring value, if any. If
- no conversion can be performed, then 0 is returned. If the converted
- value is a NaN, 0 is returned and errno is set to <<EDOM>>.
- If the converted value exceeds the maximum positive fixed-point value,
- the output value is saturated to the maximum value and <<ERANGE>> is stored in
- errno. If the converted value is less than the minimum fixed-point negative
- value, then the output is saturated to the minimum value and <<ERANGE>> is stored
- in errno. Otherwise, the converted value is returned in the
- specified fixed-point format.
-
-PORTABILITY
- <<strtosfix16>>, <<strtosfix32>>, and <<strtosfix64>> are non-standard.
-
- The OS subroutines of <<strtod>> are required.
-*/
-
-#include <_ansi.h>
-#include <limits.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <reent.h>
-#include "vfieeefp.h"
-
-/*
- * Convert a string to a fixed-point (sign + 15-bits) value.
- *
- * Ignores `locale' stuff.
- */
-__int16_t
-_DEFUN (_strtosfix16_r, (rptr, nptr, endptr),
- struct _reent *rptr _AND
- _CONST char *nptr _AND
- char **endptr)
-{
- union double_union dbl;
- unsigned long tmp, tmp2;
- int exp, negexp, sign;
- __int16_t result;
-
- dbl.d = _strtod_r (rptr, nptr, endptr);
-
- /* treat NAN as domain error, +/- infinity as saturation */
- if (!finite(dbl.d))
- {
- if (isnan (dbl.d))
- {
- rptr->_errno = EDOM;
- return 0;
- }
- rptr->_errno = ERANGE;
- if (word0(dbl) & Sign_bit)
- return SHRT_MIN;
- return SHRT_MAX;
- }
-
- /* check for normal saturation */
- if (dbl.d >= 1.0)
- {
- rptr->_errno = ERANGE;
- return SHRT_MAX;
- }
- else if (dbl.d < -1.0)
- {
- rptr->_errno = ERANGE;
- return SHRT_MIN;
- }
-
- /* otherwise we have normal number in range */
-
- /* strip off sign and exponent */
- sign = word0(dbl) & Sign_bit;
- exp = ((word0(dbl) & Exp_mask) >> Exp_shift) - Bias;
- negexp = -exp;
- if (negexp > 15)
- return 0;
- /* add in implicit normalized bit */
- tmp = word0(dbl) | Exp_msk1;
- /* remove exponent and sign */
- tmp <<= Ebits;
- if (negexp != 0)
- {
- /* perform rounding */
- tmp2 = tmp + (1 << (negexp - 1));
- result = (short)(tmp2 >> (negexp + 16));
- /* check if rounding caused carry bit which must be added into result */
- if (tmp2 < tmp)
- result |= (1 << (16 - negexp));
- /* check if positive saturation has occurred because of rounding */
- if (!sign && result < 0)
- {
- rptr->_errno = ERANGE;
- return SHRT_MAX;
- }
- }
- else
- {
- /* we have -1.0, no rounding necessary */
- return SHRT_MIN;
- }
-
- return sign ? -result : result;
-}
-
-#ifndef _REENT_ONLY
-
-__int16_t
-_DEFUN (strtosfix16, (s, ptr, base),
- _CONST char *s _AND
- char **ptr)
-{
- return _strtosfix16_r (_REENT, s, ptr);
-}
-
-#endif
diff --git a/newlib/libc/machine/powerpc/strtosfix32.c b/newlib/libc/machine/powerpc/strtosfix32.c
deleted file mode 100644
index 0f2ded6f7..000000000
--- a/newlib/libc/machine/powerpc/strtosfix32.c
+++ /dev/null
@@ -1,100 +0,0 @@
-#include <_ansi.h>
-#include <limits.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <reent.h>
-#include "vfieeefp.h"
-
-/*
- * Convert a string to a fixed-point (sign + 31-bits) value.
- *
- * Ignores `locale' stuff.
- */
-__int32_t
-_DEFUN (_strtosfix32_r, (rptr, nptr, endptr),
- struct _reent *rptr _AND
- _CONST char *nptr _AND
- char **endptr)
-{
- union double_union dbl;
- int exp, negexp, sign;
- unsigned long tmp, tmp2;
- long result = 0;
-
- dbl.d = _strtod_r (rptr, nptr, endptr);
-
- /* treat NAN as domain error, +/- infinity as saturation */
- if (!finite(dbl.d))
- {
- if (isnan (dbl.d))
- {
- rptr->_errno = EDOM;
- return 0;
- }
- rptr->_errno = ERANGE;
- if (word0(dbl) & Sign_bit)
- return LONG_MIN;
- return LONG_MAX;
- }
-
- /* check for normal saturation */
- if (dbl.d >= 1.0)
- {
- rptr->_errno = ERANGE;
- return LONG_MAX;
- }
- else if (dbl.d < -1.0)
- {
- rptr->_errno = ERANGE;
- return LONG_MIN;
- }
-
- /* otherwise we have normal number in range */
-
- /* strip off sign and exponent */
- sign = word0(dbl) & Sign_bit;
- exp = ((word0(dbl) & Exp_mask) >> Exp_shift) - Bias;
- negexp = -exp;
- if (negexp > 31)
- return 0;
- word0(dbl) &= ~(Exp_mask | Sign_bit);
- /* add in implicit normalized bit */
- word0(dbl) |= Exp_msk1;
- /* shift so result is contained in single word */
- tmp = word0(dbl) << Ebits;
- tmp |= ((unsigned long)word1(dbl) >> (32 - Ebits));
- if (negexp != 0)
- {
- /* perform rounding */
- tmp2 = tmp + (1 << (negexp - 1));
- result = (long)(tmp2 >> negexp);
- /* check if rounding caused carry bit which must be added into result */
- if (tmp2 < tmp)
- result |= (1 << (32 - negexp));
- /* check if positive saturation has occurred because of rounding */
- if (!sign && result < 0)
- {
- rptr->_errno = ERANGE;
- return LONG_MAX;
- }
- }
- else
- {
- /* we have -1.0, no rounding necessary */
- return LONG_MIN;
- }
-
- return sign ? -result : result;
-}
-
-#ifndef _REENT_ONLY
-
-__int32_t
-_DEFUN (strtosfix32, (s, ptr, base),
- _CONST char *s _AND
- char **ptr)
-{
- return _strtosfix32_r (_REENT, s, ptr);
-}
-
-#endif
diff --git a/newlib/libc/machine/powerpc/strtosfix64.c b/newlib/libc/machine/powerpc/strtosfix64.c
deleted file mode 100644
index d0fa769d9..000000000
--- a/newlib/libc/machine/powerpc/strtosfix64.c
+++ /dev/null
@@ -1,113 +0,0 @@
-#include <_ansi.h>
-#include <limits.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <reent.h>
-#include "fix64.h"
-
-/*
- * Convert a string to a fixed-point (sign + 63-bits) value.
- *
- * Ignores `locale' stuff.
- */
-__int64_t
-_DEFUN (_strtosfix64_r, (rptr, nptr, endptr),
- struct _reent *rptr _AND
- _CONST char *nptr _AND
- char **endptr)
-{
- union long_double_union ldbl;
- int exp, negexp, sign, ld_type;
- __uint64_t tmp, tmp2;
- __int64_t result = 0;
-
- init(ldbl);
-
- _simdstrtold ((char *)nptr, endptr, &ldbl);
-
- /* treat NAN as domain error, +/- infinity as saturation */
- ld_type = _simdldcheck (&ldbl.ld);
- if (ld_type != 0)
- {
- if (ld_type == 1)
- {
- rptr->_errno = EDOM;
- return 0;
- }
- rptr->_errno = ERANGE;
- if (word0(ldbl) & Sign_bit)
- return LONG_LONG_MIN;
- return LONG_LONG_MAX;
- }
-
- /* strip off sign and exponent */
- sign = word0(ldbl) & Sign_bit;
- exp = ((word0(ldbl) & Exp_mask) >> Exp_shift) - Bias;
- negexp = -exp;
- if (negexp > 63)
- return 0;
- word0(ldbl) &= ~(Exp_mask | Sign_bit);
- /* add in implicit normalized bit */
- word0(ldbl) |= Exp_msk1;
- /* shift so result is contained in single word */
- tmp = word0(ldbl) << Ebits;
- tmp |= ((unsigned long)word1(ldbl) >> (32 - Ebits));
- tmp <<= 32;
- if (Ebits < 32)
- tmp |= ((unsigned long)word1(ldbl) << Ebits);
- tmp |= ((unsigned long)word2(ldbl) >> (32 - Ebits));
-
- /* check for saturation */
- if (sign)
- {
- if (exp > 0 || (exp == 0 && tmp != 0x8000000000000000LL))
- {
- rptr->_errno = ERANGE;
- return LONG_LONG_MIN;
- }
- }
- else
- {
- if (exp >= 0)
- {
- rptr->_errno = ERANGE;
- return LONG_LONG_MAX;
- }
- }
-
- /* otherwise we have normal number in range */
- if (negexp != 0)
- {
- /* perform rounding */
- tmp2 = tmp + (1 << (negexp - 1));
- result = (long long)(tmp2 >> negexp);
- /* check if rounding caused carry bit which must be added into result */
- if (tmp2 < tmp)
- result |= (1 << (64 - negexp));
- /* check if positive saturation has occurred because of rounding */
- if (!sign && result < 0)
- {
- rptr->_errno = ERANGE;
- return LONG_LONG_MAX;
- }
- }
- else
- {
- /* we have -1.0, no rounding necessary */
- return LONG_LONG_MIN;
- }
-
- return sign ? -result : result;
-}
-
-#ifndef _REENT_ONLY
-
-__int64_t
-_DEFUN (strtosfix64, (s, ptr, base),
- _CONST char *s _AND
- char **ptr)
-{
- return _strtosfix64_r (_REENT, s, ptr);
-}
-
-#endif
diff --git a/newlib/libc/machine/powerpc/strtoufix16.c b/newlib/libc/machine/powerpc/strtoufix16.c
deleted file mode 100644
index 0c1fad30f..000000000
--- a/newlib/libc/machine/powerpc/strtoufix16.c
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
-FUNCTION
- <<strtoufix16>>, <<strtoufix32>>, <<strtoufix64>>---string to signed fixed point
-
-INDEX
- strtoufix16
-INDEX
- strtoufix32
-INDEX
- strtoufix64
-INDEX
- _strtoufix16_r
-INDEX
- _strtoufix32_r
-INDEX
- _strtoufix64_r
-
-ANSI_SYNOPSIS
- #include <stdlib.h>
- __uint16_t strtoufix16 (const char *<[s]>, char **<[ptr]>);
-
- __uint32_t strtoufix32 (const char *<[s]>, char **<[ptr]>);
-
- __uint64_t strtoufix64 (const char *<[s]>, char **<[ptr]>);
-
- __uint16_t _strtoufix16_r (void *<[reent]>,
- const char *<[s]>, char **<[ptr]>);
-
- __uint32_t _strtoufix32_r (void *<[reent]>,
- const char *<[s]>, char **<[ptr]>);
-
- __uint64_t _strtoufix64_r (void *<[reent]>,
- const char *<[s]>, char **<[ptr]>);
-
-TRAD_SYNOPSIS
- #include <stdlib.h>
- __uint16_t strtoufix16 (<[s]>, <[ptr]>)
- char *<[s]>;
- char **<[ptr]>;
-
- __uint32_t strtoufix32 (<[s]>, <[ptr]>)
- char *<[s]>;
- char **<[ptr]>;
-
- __uint64_t strtoufix64 (<[s]>, <[ptr]>)
- char *<[s]>;
- char **<[ptr]>;
-
- __uint16_t _strtoufix16_r (<[reent]>, <[s]>, <[ptr]>)
- char *<[reent]>;
- char *<[s]>;
- char **<[ptr]>;
-
- __uint32_t _strtoufix32_r (<[reent]>, <[s]>, <[ptr]>)
- char *<[reent]>;
- char *<[s]>;
- char **<[ptr]>;
-
- __uint64_t _strtoufix64_r (<[reent]>, <[s]>, <[ptr]>)
- char *<[reent]>;
- char *<[s]>;
- char **<[ptr]>;
-
-DESCRIPTION
- The function <<strtoufix16>> converts the string <<*<[s]>>> to
- a fixed-point 16-bits fraction representation. The function
- follows the same rules as <<strtod>>.
-
- The substring converted is the longest initial
- subsequence of <[s]>, beginning with the first
- non-whitespace character, that has the format:
- .[+|-]<[digits]>[.][<[digits]>][(e|E)[+|-]<[digits]>]
- The substring contains no characters if <[s]> is empty, consists
- entirely of whitespace, or if the first non-whitespace
- character is something other than <<+>>, <<->>, <<.>>, or a
- digit. If the substring is empty, no conversion is done, and
- the value of <[s]> is stored in <<*<[ptr]>>>. Otherwise,
- the substring is converted, and a pointer to the final string
- (which will contain at least the terminating null character of
- <[s]>) is stored in <<*<[ptr]>>>. If you want no
- assignment to <<*<[ptr]>>>, pass a null pointer as <[ptr]>.
-
- <<strtoufix32>> is identical to <<strtoufix16>> except that it
- converts to fixed-point 32-bit fraction representation.
- <<strtoufix64>> is also similar, except that it converts
- to fixed-point 64-bit fraction.
-
- The alternate functions <<_strtoufix16_r>>, <<_strtoufix32_r>>,
- and <<_strtoufix64_r>> are reentrant versions.
- The extra argument <[reent]> is a pointer to a reentrancy structure.
-
-RETURNS
- The functions return the converted substring value, if any. If
- no conversion can be performed, then 0 is returned. If the converted
- value is a NaN, 0 is returned and errno is set to <<EDOM>>.
- If the converted value exceeds the maximum positive unsigned fixed-point value,
- the output value is saturated to the maximum value and <<ERANGE>> is stored in
- errno. If the converted value is less than 0, then the output is saturated to 0
- and <<ERANGE>> is stored in errno. Otherwise, the converted value is returned in the
- specified fixed-point format.
-
-PORTABILITY
- <<strtoufix16>>, <<strtoufix32>>, and <<strtoufix64>> are non-standard.
-
- The OS subroutines of <<strtod>> are required.
-*/
-
-#include <_ansi.h>
-#include <limits.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <reent.h>
-#include "vfieeefp.h"
-
-/*
- * Convert a string to a fixed-point 16-bit value.
- *
- * Ignores `locale' stuff.
- */
-__uint16_t
-_DEFUN (_strtoufix16_r, (rptr, nptr, endptr),
- struct _reent *rptr _AND
- _CONST char *nptr _AND
- char **endptr)
-{
- union double_union dbl;
- unsigned long tmp, tmp2, result;
- int exp, negexp;
-
- dbl.d = _strtod_r (rptr, nptr, endptr);
-
- /* treat NAN as domain error, +/- infinity as saturation */
- if (!finite(dbl.d))
- {
- if (isnan (dbl.d))
- {
- rptr->_errno = EDOM;
- return 0;
- }
- rptr->_errno = ERANGE;
- if (word0(dbl) & Sign_bit)
- return 0;
- return USHRT_MAX;
- }
-
- /* check for normal saturation */
- if (dbl.d >= 1.0)
- {
- rptr->_errno = ERANGE;
- return USHRT_MAX;
- }
- else if (dbl.d < 0)
- {
- rptr->_errno = ERANGE;
- return 0;
- }
-
- /* otherwise we have normal postive number in range */
-
- /* strip off exponent */
- exp = ((word0(dbl) & Exp_mask) >> Exp_shift) - Bias;
- negexp = -exp;
- if (negexp > 16)
- return 0;
- /* add in implicit normalized bit */
- tmp = word0(dbl) | Exp_msk1;
- /* remove exponent and sign */
- tmp <<= Ebits;
- /* perform rounding */
- tmp2 = tmp + (1 << (negexp + 14));
- result = tmp2 >> (negexp + 15);
- /* if rounding causes carry, must add carry bit in */
- if (tmp2 < tmp)
- {
- if (negexp == 0)
- {
- /* we have overflow which means saturation */
- rptr->_errno = ERANGE;
- return USHRT_MAX;
- }
- result |= (1 << (16 - negexp));
- }
-
- return (__uint16_t)result;
-}
-
-#ifndef _REENT_ONLY
-
-__uint16_t
-_DEFUN (strtoufix16, (s, ptr, base),
- _CONST char *s _AND
- char **ptr)
-{
- return _strtoufix16_r (_REENT, s, ptr);
-}
-
-#endif
diff --git a/newlib/libc/machine/powerpc/strtoufix32.c b/newlib/libc/machine/powerpc/strtoufix32.c
deleted file mode 100644
index 141c6278f..000000000
--- a/newlib/libc/machine/powerpc/strtoufix32.c
+++ /dev/null
@@ -1,97 +0,0 @@
-#include <_ansi.h>
-#include <limits.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <reent.h>
-#include "vfieeefp.h"
-
-/*
- * Convert a string to a fixed-point 32-bit value.
- *
- * Ignores `locale' stuff.
- */
-__uint32_t
-_DEFUN (_strtoufix32_r, (rptr, nptr, endptr),
- struct _reent *rptr _AND
- _CONST char *nptr _AND
- char **endptr)
-{
- union double_union dbl;
- int exp, negexp, sign;
- __uint32_t tmp, tmp2, result = 0;
-
- dbl.d = _strtod_r (rptr, nptr, endptr);
-
- /* treat NAN as domain error, +/- infinity as saturation */
- if (!finite(dbl.d))
- {
- if (isnan (dbl.d))
- {
- rptr->_errno = EDOM;
- return 0;
- }
- rptr->_errno = ERANGE;
- if (word0(dbl) & Sign_bit)
- return 0;
- return ULONG_MAX;
- }
-
- /* check for normal saturation */
- if (dbl.d >= 1.0)
- {
- rptr->_errno = ERANGE;
- return ULONG_MAX;
- }
- else if (dbl.d < 0)
- {
- rptr->_errno = ERANGE;
- return 0;
- }
-
- /* otherwise we have normal positive number in range */
-
- /* strip off exponent */
- exp = ((word0(dbl) & Exp_mask) >> Exp_shift) - Bias;
- negexp = -exp;
- if (negexp > 32)
- return 0;
- word0(dbl) &= ~(Exp_mask | Sign_bit);
- /* add in implicit normalized bit */
- word0(dbl) |= Exp_msk1;
- /* shift so result is contained left-justified in word */
- tmp = word0(dbl) << Ebits;
- tmp |= ((unsigned long)word1(dbl) >> (32 - Ebits));
- /* perform rounding */
- if (negexp > 1)
- {
- tmp2 = tmp + (1 << (negexp - 2));
- result = (tmp2 >> (negexp - 1));
- /* if rounding causes carry, add carry bit in */
- if (tmp2 < tmp)
- result += 1 << (32 - negexp);
- }
- else
- {
- result = tmp + ((word1(dbl) & (1 << (32 - Ebits - 1))) != 0);
- /* if rounding causes carry, then saturation has occurred */
- if (result < tmp)
- {
- rptr->_errno = ERANGE;
- return ULONG_MAX;
- }
- }
-
- return result;
-}
-
-#ifndef _REENT_ONLY
-
-__uint32_t
-_DEFUN (strtoufix32, (s, ptr, base),
- _CONST char *s _AND
- char **ptr)
-{
- return _strtoufix32_r (_REENT, s, ptr);
-}
-
-#endif
diff --git a/newlib/libc/machine/powerpc/strtoufix64.c b/newlib/libc/machine/powerpc/strtoufix64.c
deleted file mode 100644
index e06f4db6c..000000000
--- a/newlib/libc/machine/powerpc/strtoufix64.c
+++ /dev/null
@@ -1,115 +0,0 @@
-#include <_ansi.h>
-#include <limits.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <reent.h>
-#include "fix64.h"
-
-/*
- * Convert a string to a fixed-point 64-bit unsigned value.
- *
- * Ignores `locale' stuff.
- */
-__uint64_t
-_DEFUN (_strtoufix64_r, (rptr, nptr, endptr),
- struct _reent *rptr _AND
- _CONST char *nptr _AND
- char **endptr)
-{
- union long_double_union ldbl;
- int exp, sign, negexp, ld_type;
- __uint64_t tmp, tmp2, result = 0;
-
- init(ldbl);
-
- _simdstrtold ((char *)nptr, endptr, &ldbl);
-
- /* treat NAN as domain error, +/- infinity as saturation */
- ld_type = _simdldcheck (&ldbl.ld);
- if (ld_type != 0)
- {
- if (ld_type == 1)
- {
- rptr->_errno = EDOM;
- return 0;
- }
- rptr->_errno = ERANGE;
- if (word0(ldbl) & Sign_bit)
- return 0;
- return ULONG_LONG_MAX;
- }
-
- /* strip off sign and exponent */
- sign = word0(ldbl) & Sign_bit;
- exp = ((word0(ldbl) & Exp_mask) >> Exp_shift) - Bias;
- negexp = -exp;
- if (negexp > 63)
- return 0;
- word0(ldbl) &= ~(Exp_mask | Sign_bit);
- /* add in implicit normalized bit */
- word0(ldbl) |= Exp_msk1;
- /* shift so result is contained in single word */
- tmp = word0(ldbl) << Ebits;
- tmp |= ((unsigned long)word1(ldbl) >> (32 - Ebits));
- tmp <<= 32;
- if (Ebits < 32)
- tmp |= ((unsigned long)word1(ldbl) << Ebits);
- tmp |= ((unsigned long)word2(ldbl) >> (32 - Ebits));
-
- /* check for saturation */
- if (sign)
- {
- rptr->_errno = ERANGE;
- return 0;
- }
- else
- {
- if (exp > 0 || (exp == 0 && tmp >= 0x8000000000000000LL))
- {
- rptr->_errno = ERANGE;
- return ULONG_LONG_MAX;
- }
- }
-
- /* otherwise we have normal number in range */
- if (negexp > 1)
- {
- tmp2 = tmp + (1 << (negexp - 2));
- result = (tmp2 >> (negexp - 1));
- /* if rounding causes carry, add carry bit in */
- if (tmp2 < tmp)
- result += 1 << (64 - negexp);
- }
- else
- {
- if (Ebits < 32)
- {
- result = tmp + ((word2(ldbl) & (1 << (64 - Ebits - 1))) != 0);
- /* if rounding causes carry, then saturation has occurred */
- if (result < tmp)
- {
- rptr->_errno = ERANGE;
- return ULONG_LONG_MAX;
- }
- }
- else
- result = tmp;
- }
-
- return result;
-}
-
-#ifndef _REENT_ONLY
-
-__uint64_t
-_DEFUN (strtoufix64, (s, ptr, base),
- _CONST char *s _AND
- char **ptr)
-{
- return _strtoufix64_r (_REENT, s, ptr);
-}
-
-#endif
-
-
-
diff --git a/newlib/libc/machine/powerpc/times.c b/newlib/libc/machine/powerpc/times.c
deleted file mode 100644
index 64f4ddcb8..000000000
--- a/newlib/libc/machine/powerpc/times.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Time support routines for PowerPC.
- *
- * Written by Aldy Hernandez.
- */
-
-#include <_ansi.h>
-#include <reent.h>
-#include <sys/time.h>
-#include <sys/times.h>
-#include <sys/resource.h>
-
-clock_t
-times (struct tms *tp)
-{
- struct rusage usage;
- union {
- struct rusage r;
- /* Newlib's rusage has only 2 fields. We need to make room for
- when we call the system's rusage. This should be enough. */
- int filler[32];
- } host_ru;
-
- getrusage (RUSAGE_SELF, (void *)&host_ru);
-
- if (tp)
- {
- tp->tms_utime = host_ru.r.ru_utime.tv_sec * 1000
- + host_ru.r.ru_utime.tv_usec;
- tp->tms_stime = host_ru.r.ru_stime.tv_sec * 1000
- + host_ru.r.ru_stime.tv_usec;
- tp->tms_cutime = 0; /* user time, children */
- tp->tms_cstime = 0; /* system time, children */
- }
-
- return tp->tms_utime;
-}
diff --git a/newlib/libc/machine/powerpc/ufix64toa.c b/newlib/libc/machine/powerpc/ufix64toa.c
deleted file mode 100644
index 4d3d0a885..000000000
--- a/newlib/libc/machine/powerpc/ufix64toa.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* _ufix64toa_r: convert unsigned 64-bit fixed point to ASCII string.
- *
- * This routine converts an unsigned fixed-point number to long double format and
- * then calls _ldtoa_r to do the conversion.
- *
- * Written by Jeff Johnston.
- */
-
-#include <_ansi.h>
-#include <limits.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <reent.h>
-#include "fix64.h"
-
-extern char *_simdldtoa_r _PARAMS((struct _reent *, LONG_DOUBLE_UNION *, int,
- int, int *, int *, char **));
-
-/*
- * Convert an unsigned fixed-point 64-bit value to string.
- *
- * Ignores `locale' stuff.
- */
-
-char *
-_DEFUN (_ufix64toa_r, (rptr, value, mode, ndigits, decpt, sign, rve),
- struct _reent *rptr _AND
- __uint64_t value _AND
- int mode _AND
- int ndigits _AND
- int *decpt _AND
- int *sign _AND
- char **rve)
-{
- union long_double_union ldbl;
- union fix64_union fix64;
- unsigned long tmp;
- int exp, negexp;
-
- /* if input is 0, no additional work is needed */
- if (value == 0)
- {
- ldbl.i[0] = ldbl.i[1] = ldbl.i[2] = ldbl.i[3] = 0;
- }
- else /* otherwise, we calculate long double equivalent of value */
- {
- /* find exponent by locating most-significant one-bit */
- fix64.ll = value;
- negexp = 1;
- if (hiword(fix64) == 0)
- {
- tmp = loword(fix64);
- negexp = 33;
- }
- else
- {
- tmp = hiword(fix64);
- negexp = 1;
- }
-
- while (negexp < 65)
- {
- if (tmp & 0x80000000)
- break;
- ++negexp;
- tmp <<= 1;
- }
-
- /* shift input appropriately */
- fix64.ll = value << (negexp - 1 + (Exp_msk1 != 0));
-
- /* build long double */
- exp = -negexp + Bias;
- word0(ldbl) = (exp << Exp_shift);
- word1(ldbl) = hiword(fix64) << (32-Ebits);
- word2(ldbl) = loword(fix64) << (32-Ebits);
- word3(ldbl) = 0;
- if (Ebits < 32)
- {
- word0(ldbl) |= hiword(fix64) >> Ebits;
- word1(ldbl) |= loword(fix64) >> Ebits;
- }
- }
-
- /* convert long double to character */
- return _simdldtoa_r (rptr, &ldbl, mode, ndigits, decpt, sign, rve);
-}
-
diff --git a/newlib/libc/machine/powerpc/vec_calloc.c b/newlib/libc/machine/powerpc/vec_calloc.c
deleted file mode 100644
index 5efe91049..000000000
--- a/newlib/libc/machine/powerpc/vec_calloc.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-FUNCTION
-<<vec_calloc>>---allocate space for arrays
-
-INDEX
- vec_calloc
-
-INDEX
- _vec_calloc_r
-
-ANSI_SYNOPSIS
- #include <stdlib.h>
- void *vec_calloc(size_t <[n]>, size_t <[s]>);
- void *vec_calloc_r(void *<[reent]>, size_t <n>, <size_t> <[s]>);
-
-TRAD_SYNOPSIS
- #include <stdlib.h>
- char *vec_calloc(<[n]>, <[s]>)
- size_t <[n]>, <[s]>;
-
- char *_vec_calloc_r(<[reent]>, <[n]>, <[s]>)
- char *<[reent]>;
- size_t <[n]>;
- size_t <[s]>;
-
-
-
-DESCRIPTION
-Use <<vec_calloc>> to request a block of memory sufficient to hold an
-array of <[n]> elements, each of which has size <[s]>.
-
-The memory allocated by <<vec_calloc>> comes out of the same memory pool
-used by <<vec_malloc>>, but the memory block is initialized to all zero
-bytes. (To avoid the overhead of initializing the space, use
-<<vec_malloc>> instead.)
-
-The alternate function <<_vec_calloc_r>> is reentrant.
-The extra argument <[reent]> is a pointer to a reentrancy structure.
-
-RETURNS
-If successful, a pointer to the newly allocated space.
-
-If unsuccessful, <<NULL>>.
-
-PORTABILITY
-<<vec_calloc>> is an non-ANSI extension described in the AltiVec Programming
-Interface Manual.
-
-Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
-<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
-*/
-
-#include <string.h>
-#include <stdlib.h>
-
-#ifndef _REENT_ONLY
-
-_PTR
-_DEFUN (vec_calloc, (n, size),
- size_t n _AND
- size_t size)
-{
- return _vec_calloc_r (_REENT, n, size);
-}
-
-#endif
diff --git a/newlib/libc/machine/powerpc/vec_free.c b/newlib/libc/machine/powerpc/vec_free.c
deleted file mode 100644
index b55c52dde..000000000
--- a/newlib/libc/machine/powerpc/vec_free.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* vec_free.c - a wrapper for _free_r */
-#include <_ansi.h>
-#include <reent.h>
-#include <stdlib.h>
-
-#ifndef _REENT_ONLY
-
-void
-_DEFUN (vec_free, (aptr),
- _PTR aptr)
-{
- _free_r (_REENT, aptr);
-}
-
-#endif /* !_REENT_ONLY */
diff --git a/newlib/libc/machine/powerpc/vec_malloc.c b/newlib/libc/machine/powerpc/vec_malloc.c
deleted file mode 100644
index 6bcad59b6..000000000
--- a/newlib/libc/machine/powerpc/vec_malloc.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
-FUNCTION
-<<vec_malloc>>, <<vec_realloc>>, <<vec_free>>---manage vector memory
-
-INDEX
- vec_malloc
-INDEX
- vec_realloc
-INDEX
- vec_free
-INDEX
- _vec_malloc_r
-INDEX
- _vec_realloc_r
-INDEX
- _vec_free_r
-
-ANSI_SYNOPSIS
- #include <stdlib.h>
- void *vec_malloc(size_t <[nbytes]>);
- void *vec_realloc(void *<[aptr]>, size_t <[nbytes]>);
- void vec_free(void *<[aptr]>);
-
-
- void *_vec_malloc_r(void *<[reent]>, size_t <[nbytes]>);
- void *_vec_realloc_r(void *<[reent]>,
- void *<[aptr]>, size_t <[nbytes]>);
- void _vec_free_r(void *<[reent]>, void *<[aptr]>);
-
-
-TRAD_SYNOPSIS
- #include <stdlib.h>
- char *vec_malloc(<[nbytes]>)
- size_t <[nbytes]>;
-
- char *vec_realloc(<[aptr]>, <[nbytes]>)
- char *<[aptr]>;
- size_t <[nbytes]>;
-
- void vec_free(<[aptr]>)
- char *<[aptr]>;
-
- char *_vec_malloc_r(<[reent]>,<[nbytes]>)
- char *<[reent]>;
- size_t <[nbytes]>;
-
- char *_vec_realloc_r(<[reent]>, <[aptr]>, <[nbytes]>)
- char *<[reent]>;
- char *<[aptr]>;
- size_t <[nbytes]>;
-
- void _vec_free_r(<[reent]>, <[aptr]>)
- char *<[reent]>;
- char *<[aptr]>;
-
-DESCRIPTION
-These functions manage a pool of system memory that is 16-byte aligned..
-
-Use <<vec_malloc>> to request allocation of an object with at least
-<[nbytes]> bytes of storage available and is 16-byte aligned. If the space is
-available, <<vec_malloc>> returns a pointer to a newly allocated block as its result.
-
-If you already have a block of storage allocated by <<vec_malloc>>, but
-you no longer need all the space allocated to it, you can make it
-smaller by calling <<vec_realloc>> with both the object pointer and the
-new desired size as arguments. <<vec_realloc>> guarantees that the
-contents of the smaller object match the beginning of the original object.
-
-Similarly, if you need more space for an object, use <<vec_realloc>> to
-request the larger size; again, <<vec_realloc>> guarantees that the
-beginning of the new, larger object matches the contents of the
-original object.
-
-When you no longer need an object originally allocated by <<vec_malloc>>
-or <<vec_realloc>> (or the related function <<vec_calloc>>), return it to the
-memory storage pool by calling <<vec_free>> with the address of the object
-as the argument. You can also use <<vec_realloc>> for this purpose by
-calling it with <<0>> as the <[nbytes]> argument.
-
-The alternate functions <<_vec_malloc_r>>, <<_vec_realloc_r>>, <<_vec_free_r>>,
-are reentrant versions. The extra argument <[reent]> is a pointer to a reentrancy
-structure.
-
-If you have multiple threads of execution which may call any of these
-routines, or if any of these routines may be called reentrantly, then
-you must provide implementations of the <<__vec_malloc_lock>> and
-<<__vec_malloc_unlock>> functions for your system. See the documentation
-for those functions.
-
-These functions operate by calling the function <<_sbrk_r>> or
-<<sbrk>>, which allocates space. You may need to provide one of these
-functions for your system. <<_sbrk_r>> is called with a positive
-value to allocate more space, and with a negative value to release
-previously allocated space if it is no longer required.
-@xref{Stubs}.
-
-RETURNS
-<<vec_malloc>> returns a pointer to the newly allocated space, if
-successful; otherwise it returns <<NULL>>. If your application needs
-to generate empty objects, you may use <<vec_malloc(0)>> for this purpose.
-
-<<vec_realloc>> returns a pointer to the new block of memory, or <<NULL>>
-if a new block could not be allocated. <<NULL>> is also the result
-when you use `<<vec_realloc(<[aptr]>,0)>>' (which has the same effect as
-`<<vec_free(<[aptr]>)>>'). You should always check the result of
-<<vec_realloc>>; successful vec_reallocation is not guaranteed even when
-you request a smaller object.
-
-<<vec_free>> does not return a result.
-
-PORTABILITY
-<<vec_malloc>>, <<vec_realloc>>, and <<vec_free>> are all extensions
-specified in the AltiVec Programming Interface Manual.
-
-Supporting OS subroutines required: <<sbrk>>. */
-
-#include <_ansi.h>
-#include <reent.h>
-#include <stdlib.h>
-#include <malloc.h>
-
-#ifndef _REENT_ONLY
-
-_PTR
-_DEFUN (vec_malloc, (nbytes),
- size_t nbytes) /* get a block */
-{
- return _memalign_r (_REENT, 16, nbytes);
-}
-
-#endif
-
diff --git a/newlib/libc/machine/powerpc/vec_mallocr.c b/newlib/libc/machine/powerpc/vec_mallocr.c
deleted file mode 100644
index c375c8be2..000000000
--- a/newlib/libc/machine/powerpc/vec_mallocr.c
+++ /dev/null
@@ -1,424 +0,0 @@
-/* This code is based on mallocr.c written by Doug Lea which is released
- to the public domain. Any changes to libc/stdlib/mallocr.c
- should be reflected here as well. */
-
-/* Preliminaries */
-
-#ifndef __STD_C
-#ifdef __STDC__
-#define __STD_C 1
-#else
-#if __cplusplus
-#define __STD_C 1
-#else
-#define __STD_C 0
-#endif /*__cplusplus*/
-#endif /*__STDC__*/
-#endif /*__STD_C*/
-
-#ifndef Void_t
-#if __STD_C
-#define Void_t void
-#else
-#define Void_t char
-#endif
-#endif /*Void_t*/
-
-#if __STD_C
-#include <stddef.h> /* for size_t */
-#else
-#include <sys/types.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <sys/config.h>
-
-/*
- In newlib, all the publically visible routines take a reentrancy
- pointer. We don't currently do anything much with it, but we do
- pass it to the lock routine.
- */
-
-#include <reent.h>
-#include <string.h>
-#include <malloc.h>
-
-#define MALLOC_LOCK __malloc_lock(reent_ptr)
-#define MALLOC_UNLOCK __malloc_unlock(reent_ptr)
-
-#ifdef SMALL_MEMORY
-#define malloc_getpagesize (128)
-#else
-#define malloc_getpagesize (4096)
-#endif
-
-#if __STD_C
-extern void __malloc_lock(struct _reent *);
-extern void __malloc_unlock(struct _reent *);
-#else
-extern void __malloc_lock();
-extern void __malloc_unlock();
-#endif
-
-#if __STD_C
-#define RARG struct _reent *reent_ptr,
-#define RONEARG struct _reent *reent_ptr
-#else
-#define RARG reent_ptr
-#define RONEARG reent_ptr
-#define RDECL struct _reent *reent_ptr;
-#endif
-
-#define RCALL reent_ptr,
-#define RONECALL reent_ptr
-
-/*
- Define MALLOC_LOCK and MALLOC_UNLOCK to C expressions to run to
- lock and unlock the malloc data structures. MALLOC_LOCK may be
- called recursively.
- */
-
-#ifndef MALLOC_LOCK
-#define MALLOC_LOCK
-#endif
-
-#ifndef MALLOC_UNLOCK
-#define MALLOC_UNLOCK
-#endif
-
-/*
- INTERNAL_SIZE_T is the word-size used for internal bookkeeping
- of chunk sizes. On a 64-bit machine, you can reduce malloc
- overhead by defining INTERNAL_SIZE_T to be a 32 bit `unsigned int'
- at the expense of not being able to handle requests greater than
- 2^31. This limitation is hardly ever a concern; you are encouraged
- to set this. However, the default version is the same as size_t.
-*/
-
-#ifndef INTERNAL_SIZE_T
-#define INTERNAL_SIZE_T size_t
-#endif
-
-/*
- Following is needed on implementations whereby long > size_t.
- The problem is caused because the code performs subtractions of
- size_t values and stores the result in long values. In the case
- where long > size_t and the first value is actually less than
- the second value, the resultant value is positive. For example,
- (long)(x - y) where x = 0 and y is 1 ends up being 0x00000000FFFFFFFF
- which is 2*31 - 1 instead of 0xFFFFFFFFFFFFFFFF. This is due to the
- fact that assignment from unsigned to signed won't sign extend.
-*/
-
-#ifdef SIZE_T_SMALLER_THAN_LONG
-#define long_sub_size_t(x, y) ( (x < y) ? -((long)(y - x)) : (x - y) );
-#else
-#define long_sub_size_t(x, y) ( (long)(x - y) )
-#endif
-
-/*
- REALLOC_ZERO_BYTES_FREES should be set if a call to
- realloc with zero bytes should be the same as a call to free.
- Some people think it should. Otherwise, since this malloc
- returns a unique pointer for malloc(0), so does realloc(p, 0).
-*/
-
-/* The following macros are only invoked with (2n+1)-multiples of
- INTERNAL_SIZE_T units, with a positive integer n. This is exploited
- for fast inline execution when n is small. */
-
-#define MALLOC_ZERO(charp, nbytes) \
-do { \
- INTERNAL_SIZE_T mzsz = (nbytes); \
- if(mzsz <= 9*sizeof(mzsz)) { \
- INTERNAL_SIZE_T* mz = (INTERNAL_SIZE_T*) (charp); \
- if(mzsz >= 5*sizeof(mzsz)) { *mz++ = 0; \
- *mz++ = 0; \
- if(mzsz >= 7*sizeof(mzsz)) { *mz++ = 0; \
- *mz++ = 0; \
- if(mzsz >= 9*sizeof(mzsz)) { *mz++ = 0; \
- *mz++ = 0; }}} \
- *mz++ = 0; \
- *mz++ = 0; \
- *mz = 0; \
- } else memset((charp), 0, mzsz); \
-} while(0)
-
-#define MALLOC_COPY(dest,src,nbytes) \
-do { \
- INTERNAL_SIZE_T mcsz = (nbytes); \
- if(mcsz <= 9*sizeof(mcsz)) { \
- INTERNAL_SIZE_T* mcsrc = (INTERNAL_SIZE_T*) (src); \
- INTERNAL_SIZE_T* mcdst = (INTERNAL_SIZE_T*) (dest); \
- if(mcsz >= 5*sizeof(mcsz)) { *mcdst++ = *mcsrc++; \
- *mcdst++ = *mcsrc++; \
- if(mcsz >= 7*sizeof(mcsz)) { *mcdst++ = *mcsrc++; \
- *mcdst++ = *mcsrc++; \
- if(mcsz >= 9*sizeof(mcsz)) { *mcdst++ = *mcsrc++; \
- *mcdst++ = *mcsrc++; }}} \
- *mcdst++ = *mcsrc++; \
- *mcdst++ = *mcsrc++; \
- *mcdst = *mcsrc ; \
- } else memcpy(dest, src, mcsz); \
-} while(0)
-
-#define vECCALLOc _vec_calloc_r
-#define fREe _free_r
-#define mEMALIGn _memalign_r
-#define vECREALLOc _vec_realloc_r
-#
-#if __STD_C
-
-Void_t* vECREALLOc(RARG Void_t*, size_t);
-Void_t* vECCALLOc(RARG size_t, size_t);
-#else
-Void_t* vECREALLOc();
-Void_t* vECCALLOc();
-#endif
-
-
-#ifdef __cplusplus
-}; /* end of extern "C" */
-#endif
-
-/*
- Type declarations
-*/
-
-struct malloc_chunk
-{
- INTERNAL_SIZE_T prev_size; /* Size of previous chunk (if free). */
- INTERNAL_SIZE_T size; /* Size in bytes, including overhead. */
- struct malloc_chunk* fd; /* double links -- used only if free. */
- struct malloc_chunk* bk;
-};
-
-typedef struct malloc_chunk* mchunkptr;
-
-/* sizes, alignments */
-
-#define SIZE_SZ (sizeof(INTERNAL_SIZE_T))
-#define MALLOC_ALIGN 16
-#define MALLOC_ALIGNMENT 16
-#define MALLOC_ALIGN_MASK (MALLOC_ALIGNMENT - 1)
-#define MINSIZE (sizeof(struct malloc_chunk))
-
-/* conversion from malloc headers to user pointers, and back */
-
-#define chunk2mem(p) ((Void_t*)((char*)(p) + 2*SIZE_SZ))
-#define mem2chunk(mem) ((mchunkptr)((char*)(mem) - 2*SIZE_SZ))
-/* pad request bytes into a usable size */
-
-#define request2size(req) \
- (((long)((req) + (SIZE_SZ + MALLOC_ALIGN_MASK)) < \
- (long)(MINSIZE + MALLOC_ALIGN_MASK)) ? ((MINSIZE + MALLOC_ALIGN_MASK) & ~(MALLOC_ALIGN_MASK)) : \
- (((req) + (SIZE_SZ + MALLOC_ALIGN_MASK)) & ~(MALLOC_ALIGN_MASK)))
-
-
-/* Check if m has acceptable alignment */
-
-#define aligned_OK(m) (((unsigned long)((m)) & (MALLOC_ALIGN_MASK)) == 0)
-
-/*
- Physical chunk operations
-*/
-
-
-/* size field is or'ed with PREV_INUSE when previous adjacent chunk in use */
-
-#define PREV_INUSE 0x1
-
-/* size field is or'ed with IS_MMAPPED if the chunk was obtained with mmap() */
-
-#define IS_MMAPPED 0x2
-
-/* Bits to mask off when extracting size */
-
-#define SIZE_BITS (PREV_INUSE|IS_MMAPPED)
-
-
-/* Ptr to next physical malloc_chunk. */
-
-#define next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->size & ~PREV_INUSE) ))
-
-/* Ptr to previous physical malloc_chunk */
-
-#define prev_chunk(p)\
- ((mchunkptr)( ((char*)(p)) - ((p)->prev_size) ))
-
-
-/* Treat space at ptr + offset as a chunk */
-
-#define chunk_at_offset(p, s) ((mchunkptr)(((char*)(p)) + (s)))
-
-
-
-
-/*
- Dealing with use bits
-*/
-
-/* extract p's inuse bit */
-
-#define inuse(p)\
-((((mchunkptr)(((char*)(p))+((p)->size & ~PREV_INUSE)))->size) & PREV_INUSE)
-
-/* extract inuse bit of previous chunk */
-
-#define prev_inuse(p) ((p)->size & PREV_INUSE)
-
-/* check for mmap()'ed chunk */
-
-#define chunk_is_mmapped(p) ((p)->size & IS_MMAPPED)
-
-/* set/clear chunk as in use without otherwise disturbing */
-
-#define set_inuse(p)\
-((mchunkptr)(((char*)(p)) + ((p)->size & ~PREV_INUSE)))->size |= PREV_INUSE
-
-#define clear_inuse(p)\
-((mchunkptr)(((char*)(p)) + ((p)->size & ~PREV_INUSE)))->size &= ~(PREV_INUSE)
-
-/* check/set/clear inuse bits in known places */
-
-#define inuse_bit_at_offset(p, s)\
- (((mchunkptr)(((char*)(p)) + (s)))->size & PREV_INUSE)
-
-#define set_inuse_bit_at_offset(p, s)\
- (((mchunkptr)(((char*)(p)) + (s)))->size |= PREV_INUSE)
-
-#define clear_inuse_bit_at_offset(p, s)\
- (((mchunkptr)(((char*)(p)) + (s)))->size &= ~(PREV_INUSE))
-
-
-
-/*
- Dealing with size fields
-*/
-
-/* Get size, ignoring use bits */
-
-#define chunksize(p) ((p)->size & ~(SIZE_BITS))
-
-/* Set size at head, without disturbing its use bit */
-
-#define set_head_size(p, s) ((p)->size = (((p)->size & PREV_INUSE) | (s)))
-
-/* Set size/use ignoring previous bits in header */
-
-#define set_head(p, s) ((p)->size = (s))
-
-
-
-#ifdef DEFINE_VECREALLOC
-
-
-#if __STD_C
-Void_t* vECREALLOc(RARG Void_t* oldmem, size_t bytes)
-#else
-Void_t* vECREALLOc(RARG oldmem, bytes) RDECL Void_t* oldmem; size_t bytes;
-#endif
-{
- INTERNAL_SIZE_T nb; /* padded request size */
-
- mchunkptr oldp; /* chunk corresponding to oldmem */
- INTERNAL_SIZE_T oldsize; /* its size */
-
- mchunkptr newp; /* chunk to return */
- INTERNAL_SIZE_T newsize; /* its size */
- Void_t* newmem; /* corresponding user mem */
-
- mchunkptr remainder; /* holds split off extra space from newp */
- INTERNAL_SIZE_T remainder_size; /* its size */
-
-#ifdef REALLOC_ZERO_BYTES_FREES
- if (bytes == 0) { fREe(RCALL oldmem); return 0; }
-#endif
-
-
- /* realloc of null is supposed to be same as malloc */
- if (oldmem == 0) return mEMALIGn(RCALL 16, bytes);
-
- MALLOC_LOCK;
-
- newp = oldp = mem2chunk(oldmem);
- newsize = oldsize = chunksize(oldp);
-
- nb = request2size(bytes);
-
- if ((long)(oldsize) < (long)(nb))
- {
- /* Must allocate */
-
- newmem = mEMALIGn (RCALL 16, bytes);
-
- if (newmem == 0) /* propagate failure */
- {
- MALLOC_UNLOCK;
- return 0;
- }
-
- /* copy, free, and exit */
- MALLOC_COPY(newmem, oldmem, oldsize - SIZE_SZ);
- fREe(RCALL oldmem);
- MALLOC_UNLOCK;
- return newmem;
- }
-
- remainder_size = long_sub_size_t(newsize, nb);
-
- if (remainder_size >= (long)MINSIZE) /* split off remainder */
- {
- remainder = chunk_at_offset(newp, nb);
- set_head_size(newp, nb);
- set_head(remainder, remainder_size | PREV_INUSE);
- set_inuse_bit_at_offset(remainder, remainder_size);
- fREe(RCALL chunk2mem(remainder)); /* let free() deal with it */
- }
- else
- {
- set_head_size(newp, newsize);
- set_inuse_bit_at_offset(newp, newsize);
- }
-
- MALLOC_UNLOCK;
- return chunk2mem(newp);
-}
-
-#endif /* DEFINE_VECREALLOC */
-
-
-#ifdef DEFINE_VECCALLOC
-
-/*
-
- calloc calls malloc, then zeroes out the allocated chunk.
-
-*/
-
-#if __STD_C
-Void_t* vECCALLOc(RARG size_t n, size_t elem_size)
-#else
-Void_t* vECCALLOc(RARG n, elem_size) RDECL size_t n; size_t elem_size;
-#endif
-{
- INTERNAL_SIZE_T sz = n * elem_size;
-
- Void_t* mem;
-
- mem = mEMALIGn (RCALL 16, sz);
-
- if (mem == 0)
- {
- return 0;
- }
-
- MALLOC_ZERO(mem, sz);
- return mem;
-}
-
-#endif /* DEFINE_VECCALLOC */
-
diff --git a/newlib/libc/machine/powerpc/vec_realloc.c b/newlib/libc/machine/powerpc/vec_realloc.c
deleted file mode 100644
index e192e399d..000000000
--- a/newlib/libc/machine/powerpc/vec_realloc.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* vec_realloc.c -- a wrapper for _vec_realloc_r. */
-
-#include <_ansi.h>
-#include <reent.h>
-#include <stdlib.h>
-
-#ifndef _REENT_ONLY
-
-_PTR
-_DEFUN (vec_realloc, (ap, nbytes),
- _PTR ap _AND
- size_t nbytes)
-{
- return _vec_realloc_r (_REENT, ap, nbytes);
-}
-
-#endif
diff --git a/newlib/libc/machine/powerpc/vfprintf.c b/newlib/libc/machine/powerpc/vfprintf.c
deleted file mode 100644
index ff3a4f66b..000000000
--- a/newlib/libc/machine/powerpc/vfprintf.c
+++ /dev/null
@@ -1,1430 +0,0 @@
-/*
-FUNCTION
-<<vprintf>>, <<vfprintf>>, <<vsprintf>>---format argument list
-
-INDEX
- vprintf
-INDEX
- vfprintf
-INDEX
- vsprintf
-INDEX
- vsnprintf
-
-ANSI_SYNOPSIS
- #include <stdio.h>
- #include <stdarg.h>
- int vprintf(const char *<[fmt]>, va_list <[list]>);
- int vfprintf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
- int vsprintf(char *<[str]>, const char *<[fmt]>, va_list <[list]>);
- int vsnprintf(char *<[str]>, size_t <[size]>, const char *<[fmt]>, va_list <[list]>);
-
- int _vprintf_r(void *<[reent]>, const char *<[fmt]>,
- va_list <[list]>);
- int _vfprintf_r(void *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
- va_list <[list]>);
- int _vsprintf_r(void *<[reent]>, char *<[str]>, const char *<[fmt]>,
- va_list <[list]>);
- int _vsnprintf_r(void *<[reent]>, char *<[str]>, size_t <[size]>, const char *<[fmt]>,
- va_list <[list]>);
-
-TRAD_SYNOPSIS
- #include <stdio.h>
- #include <varargs.h>
- int vprintf( <[fmt]>, <[list]>)
- char *<[fmt]>;
- va_list <[list]>;
-
- int vfprintf(<[fp]>, <[fmt]>, <[list]>)
- FILE *<[fp]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int vsprintf(<[str]>, <[fmt]>, <[list]>)
- char *<[str]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int vsnprintf(<[str]>, <[size]>, <[fmt]>, <[list]>)
- char *<[str]>;
- size_t <[size]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int _vprintf_r(<[reent]>, <[fmt]>, <[list]>)
- char *<[reent]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int _vfprintf_r(<[reent]>, <[fp]>, <[fmt]>, <[list]>)
- char *<[reent]>;
- FILE *<[fp]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int _vsprintf_r(<[reent]>, <[str]>, <[fmt]>, <[list]>)
- char *<[reent]>;
- char *<[str]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int _vsnprintf_r(<[reent]>, <[str]>, <[size]>, <[fmt]>, <[list]>)
- char *<[reent]>;
- char *<[str]>;
- size_t <[size]>;
- char *<[fmt]>;
- va_list <[list]>;
-
-DESCRIPTION
-<<vprintf>>, <<vfprintf>>, <<vsprintf>> and <<vsnprintf>> are (respectively)
-variants of <<printf>>, <<fprintf>>, <<sprintf>> and <<snprintf>>. They differ
-only in allowing their caller to pass the variable argument list as a
-<<va_list>> object (initialized by <<va_start>>) rather than directly
-accepting a variable number of arguments.
-
-RETURNS
-The return values are consistent with the corresponding functions:
-<<vsprintf>> returns the number of bytes in the output string,
-save that the concluding <<NULL>> is not counted.
-<<vprintf>> and <<vfprintf>> return the number of characters transmitted.
-If an error occurs, <<vprintf>> and <<vfprintf>> return <<EOF>>. No
-error returns occur for <<vsprintf>>.
-
-PORTABILITY
-ANSI C requires all three functions.
-
-Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
-<<lseek>>, <<read>>, <<sbrk>>, <<write>>.
-*/
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-/*static char *sccsid = "from: @(#)vfprintf.c 5.50 (Berkeley) 12/16/92";*/
-static char *rcsid = "$Id$";
-#endif /* LIBC_SCCS and not lint */
-
-/*
- * Actual printf innards.
- *
- * This code is large and complicated...
- */
-
-#ifdef INTEGER_ONLY
-#define VFPRINTF vfiprintf
-#define _VFPRINTF_R _vfiprintf_r
-#else
-#define VFPRINTF vfprintf
-#define _VFPRINTF_R _vfprintf_r
-#ifndef NO_FLOATING_POINT
-#define FLOATING_POINT
-#endif
-#endif
-
-#define _NO_LONGLONG
-#if defined WANT_PRINTF_LONG_LONG && defined __GNUC__
-# undef _NO_LONGLONG
-#endif
-
-#include <_ansi.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <reent.h>
-#include <wchar.h>
-#include <string.h>
-#ifdef __ALTIVEC__
-#include <altivec.h>
-#endif
-
-#ifdef _HAVE_STDC
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-#include "local.h"
-#include "fvwrite.h"
-#include "vfieeefp.h"
-
-/* Currently a test is made to see if long double processing is warranted.
- This could be changed in the future should the _ldtoa_r code be
- preferred over _dtoa_r. */
-#define _NO_LONGDBL
-#if defined WANT_IO_LONG_DBL && (LDBL_MANT_DIG > DBL_MANT_DIG)
-#undef _NO_LONGDBL
-#endif
-
-#ifdef __ALTIVEC__
-typedef union
-{
- vector int v;
- float f[4];
- int i[16 / sizeof(int)];
- long l[4];
- short s[8];
- signed char c[16];
-} vec_16_byte_union;
-#endif /* __ALTIVEC__ */
-
-/*
- * Flush out all the vectors defined by the given uio,
- * then reset it so that it can be reused.
- */
-static int
-__sprint(fp, uio)
- FILE *fp;
- register struct __suio *uio;
-{
- register int err;
-
- if (uio->uio_resid == 0) {
- uio->uio_iovcnt = 0;
- return (0);
- }
- err = __sfvwrite(fp, uio);
- uio->uio_resid = 0;
- uio->uio_iovcnt = 0;
- return (err);
-}
-
-/*
- * Helper function for `fprintf to unbuffered unix file': creates a
- * temporary buffer. We only work on write-only files; this avoids
- * worries about ungetc buffers and so forth.
- */
-static int
-__sbprintf(fp, fmt, ap)
- register FILE *fp;
- const char *fmt;
- va_list ap;
-{
- int ret;
- FILE fake;
- unsigned char buf[BUFSIZ];
-
- /* copy the important variables */
- fake._data = fp->_data;
- fake._flags = fp->_flags & ~__SNBF;
- fake._file = fp->_file;
- fake._cookie = fp->_cookie;
- fake._write = fp->_write;
-
- /* set up the buffer */
- fake._bf._base = fake._p = buf;
- fake._bf._size = fake._w = sizeof(buf);
- fake._lbfsize = 0; /* not actually used, but Just In Case */
-
- /* do the work, then copy any error status */
- ret = VFPRINTF(&fake, fmt, ap);
- if (ret >= 0 && fflush(&fake))
- ret = EOF;
- if (fake._flags & __SERR)
- fp->_flags |= __SERR;
- return (ret);
-}
-
-
-#ifdef FLOATING_POINT
-#include <locale.h>
-#include <math.h>
-#include "floatio.h"
-
-#define BUF (MAXEXP+MAXFRACT+1) /* + decimal point */
-#define DEFPREC 6
-
-#ifdef _NO_LONGDBL
-static char *cvt _PARAMS((struct _reent *, double, int, int, char *, int *, int, int *));
-#else
-static char *cvt _PARAMS((struct _reent *, _LONG_DOUBLE, int, int, char *, int *, int, int *));
-extern int _ldcheck _PARAMS((_LONG_DOUBLE *));
-#endif
-
-static int exponent _PARAMS((char *, int, int));
-
-#ifdef __SPE__
-static char *cvt_ufix64 _PARAMS((struct _reent *, unsigned long long, int, int *, int *));
-#endif /* __SPE__ */
-
-#else /* no FLOATING_POINT */
-
-#define BUF 40
-
-#endif /* FLOATING_POINT */
-
-
-/*
- * Macros for converting digits to letters and vice versa
- */
-#define to_digit(c) ((c) - '0')
-#define is_digit(c) ((unsigned)to_digit(c) <= 9)
-#define to_char(n) ((n) + '0')
-
-/*
- * 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 */
-#ifndef _NO_LONGLONG
-#define QUADINT 0x020 /* quad integer */
-#else /* ifdef _NO_LONGLONG, make QUADINT equivalent to LONGINT, so
- that %lld behaves the same as %ld, not as %d, as expected if:
- sizeof (long long) = sizeof long > sizeof int */
-#define QUADINT LONGINT
-#endif
-#define SHORTINT 0x040 /* short integer */
-#define ZEROPAD 0x080 /* zero (as opposed to blank) pad */
-#define FPT 0x100 /* Floating point number */
-#define VECTOR 0x200 /* vector */
-#define FIXEDPOINT 0x400 /* fixed-point */
-
-int
-_DEFUN (VFPRINTF, (fp, fmt0, ap),
- FILE * fp _AND
- _CONST char *fmt0 _AND
- va_list ap)
-{
- CHECK_INIT (fp);
- return _VFPRINTF_R (fp->_data, fp, fmt0, ap);
-}
-
-int
-_DEFUN (_VFPRINTF_R, (data, fp, fmt0, ap),
- struct _reent *data _AND
- FILE * fp _AND
- _CONST char *fmt0 _AND
- va_list ap)
-{
- register char *fmt; /* format string */
- register int ch; /* character from fmt */
- register int n, m; /* handy integers (short term usage) */
- register char *cp; /* handy char pointer (short term usage) */
- register struct __siov *iovp;/* for PRINT macro */
- register 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 */
- char sign; /* sign prefix (' ', '+', '-', or \0) */
- char old_sign; /* saved value of sign when looping for vectors */
- int old_ch; /* saved value of ch when looping for vectors */
- char *format_anchor; /* start of format to process */
- wchar_t wc;
-#ifdef FLOATING_POINT
- char *decimal_point = localeconv()->decimal_point;
- char softsign; /* temporary negative sign for floats */
-#ifdef _NO_LONGDBL
- union { int i; double d; } _double_ = {0};
- #define _fpvalue (_double_.d)
-#else
- union { int i; _LONG_DOUBLE ld; } _long_double_ = {0};
- #define _fpvalue (_long_double_.ld)
- int tmp;
-#endif
- int expt; /* integer value of exponent */
- int expsize = 0; /* character count for expstr */
- int ndig; /* actual number of digits returned by cvt */
- char expstr[7]; /* buffer for exponent string */
-#endif
-
-#ifndef _NO_LONGLONG
-#define quad_t long long
-#define u_quad_t unsigned long long
-#endif
-
-#ifndef _NO_LONGLONG
- u_quad_t _uquad; /* integer arguments %[diouxX] */
-#else
- u_long _uquad;
-#endif
- enum { OCT, DEC, HEX } base;/* base for [diouxX] conversion */
- int dprec; /* a copy of prec if [diouxX], 0 otherwise */
- int realsz; /* field size expanded by dprec */
- int size; /* size of converted field or string */
- char *xdigs = NULL; /* 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], %[eEfgG] */
- char ox[2]; /* space for 0x hex-prefix */
-#ifdef __ALTIVEC__
- char vec_sep; /* vector separator char */
- int vec_print_count; /* number of vector chunks remaining */
- vec_16_byte_union vec_tmp;
-#endif /* __ALTIVEC__ */
- mbstate_t state; /* mbtowc calls from library must not change state */
-
- /*
- * Choose PADSIZE to trade efficiency vs. size. If larger printf
- * fields occur frequently, increase PADSIZE and make the initialisers
- * below longer.
- */
-#define PADSIZE 16 /* pad chunk size */
- static _CONST char blanks[PADSIZE] =
- {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '};
- static _CONST char zeroes[PADSIZE] =
- {'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'};
-
- /*
- * BEWARE, these `goto error' on error, and PAD uses `n'.
- */
-#define PRINT(ptr, len) { \
- iovp->iov_base = (ptr); \
- iovp->iov_len = (len); \
- uio.uio_resid += (len); \
- iovp++; \
- if (++uio.uio_iovcnt >= NIOV) { \
- if (__sprint(fp, &uio)) \
- goto error; \
- iovp = iov; \
- } \
-}
-#define PAD(howmany, with) { \
- if ((n = (howmany)) > 0) { \
- while (n > PADSIZE) { \
- PRINT(with, PADSIZE); \
- n -= PADSIZE; \
- } \
- PRINT(with, n); \
- } \
-}
-#define FLUSH() { \
- if (uio.uio_resid && __sprint(fp, &uio)) \
- goto error; \
- uio.uio_iovcnt = 0; \
- iovp = iov; \
-}
-
-#ifdef __ALTIVEC__
-#define GET_SHORT(ap) \
- (flags&VECTOR ? \
- (vec_print_count < 8 ? (short)vec_tmp.s[8 - vec_print_count] : \
- (vec_tmp.v = va_arg(ap, vector int), (short)vec_tmp.s[0])) : \
- (short)va_arg(ap, int))
-#define GET_USHORT(ap) \
- (flags&VECTOR ? \
- (vec_print_count < 8 ? (u_short)vec_tmp.s[8 - vec_print_count] : \
- (vec_tmp.v = va_arg(ap, vector int), (u_short)vec_tmp.s[0])) : \
- (u_short)va_arg(ap, int))
-
-#define GET_LONG(ap) \
- (flags&VECTOR ? \
- (vec_print_count < 4 ? (long)vec_tmp.l[4 - vec_print_count] : \
- (vec_tmp.v = va_arg(ap, vector int), vec_tmp.l[0])) : \
- va_arg(ap, long int))
-#define GET_ULONG(ap) \
- (flags&VECTOR ? \
- (vec_print_count < 4 ? (u_long)vec_tmp.l[4 - vec_print_count] : \
- (vec_tmp.v = va_arg(ap, vector int), (u_long)vec_tmp.l[0])) : \
- (u_long)va_arg(ap, unsigned long int))
-
-#define GET_INT(ap) \
- (flags&VECTOR ? \
- (vec_print_count < 16 ? \
- vec_tmp.c[16 - vec_print_count] : \
- (vec_tmp.v = va_arg(ap, vector int), (int)vec_tmp.c[0])) : \
- va_arg(ap, int))
-#define GET_UINT(ap) \
- (flags&VECTOR ? \
- (vec_print_count < 16 ? \
- (u_int)((unsigned char)vec_tmp.c[16 - vec_print_count]) : \
- (vec_tmp.v = va_arg(ap, vector int), (u_int)((unsigned char)vec_tmp.c[0]))) : \
- (u_int)va_arg(ap, unsigned int))
-#else /* !__ALTIVEC__ */
-#define GET_SHORT(ap) ((short)va_arg(ap, int))
-#define GET_USHORT(ap) ((u_short)va_arg(ap, int))
-#define GET_LONG(ap) (va_arg(ap, long int))
-#define GET_ULONG(ap) ((u_long)va_arg(ap, unsigned long int))
-#define GET_INT(ap) ((int)va_arg(ap, int))
-#define GET_UINT(ap) ((u_int)va_arg(ap, unsigned int))
-#endif /* !__ALTIVEC__ */
-
-#ifndef _NO_LONGLONG
-#define SARG() \
- (flags&QUADINT ? va_arg(ap, quad_t) : \
- flags&LONGINT ? GET_LONG(ap) : \
- flags&SHORTINT ? (long)GET_SHORT(ap) : \
- (long)GET_INT(ap))
-#define UARG() \
- (flags&QUADINT ? va_arg(ap, u_quad_t) : \
- flags&LONGINT ? GET_ULONG(ap) : \
- flags&SHORTINT ? (u_long)GET_USHORT(ap) : \
- (u_long)GET_UINT(ap))
-#ifdef __SPE__
-#define SFPARG() \
- (flags&LONGINT ? va_arg(ap, quad_t) : \
- flags&SHORTINT ? (long)GET_SHORT(ap) : \
- (long)va_arg(ap, int))
-#define UFPARG() \
- (flags&LONGINT ? va_arg(ap, u_quad_t) : \
- flags&SHORTINT ? (u_long)GET_USHORT(ap) : \
- (u_long)va_arg(ap, u_int))
-#endif /* __SPE__ */
-#else
-#define SARG() \
- (flags&LONGINT ? GET_LONG(ap) : \
- flags&SHORTINT ? (long)GET_SHORT(ap) : \
- (long)GET_INT(ap))
-#define UARG() \
- (flags&LONGINT ? GET_ULONG(ap) : \
- flags&SHORTINT ? (u_long)GET_USHORT(ap) : \
- (u_long)GET_UINT(ap))
-#ifdef __SPE__
-#define SFPARG() \
- (flags&LONGINT ? (va_arg(ap, long) << 32) : \
- flags&SHORTINT ? (long)GET_SHORT(ap) : \
- (long)va_arg(ap, int))
-#define UFPARG() \
- (flags&LONGINT ? (va_arg(ap, u_long) <<32) : \
- flags&SHORTINT ? (u_long)GET_USHORT(ap) : \
- (u_long)va_arg(ap, u_int))
-#endif /* __SPE__ */
-#endif
-
- memset (&state, '\0', sizeof (state));
-
- /* sorry, fprintf(read_only_file, "") returns EOF, not 0 */
- if (cantwrite(fp))
- return (EOF);
-
- /* optimise fprintf(stderr) (and other unbuffered Unix files) */
- if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) &&
- fp->_file >= 0)
- return (__sbprintf(fp, fmt0, ap));
-
- fmt = (char *)fmt0;
- uio.uio_iov = iovp = iov;
- uio.uio_resid = 0;
- uio.uio_iovcnt = 0;
- ret = 0;
-
- /*
- * Scan the format for conversions (`%' character).
- */
- for (;;) {
- cp = fmt;
- while ((n = _mbtowc_r(_REENT, &wc, fmt, MB_CUR_MAX, &state)) > 0) {
- fmt += n;
- if (wc == '%') {
- fmt--;
- break;
- }
- }
- if ((m = fmt - cp) != 0) {
- PRINT(cp, m);
- ret += m;
- }
- if (n <= 0)
- goto done;
- fmt++; /* skip over '%' */
-
- flags = 0;
- dprec = 0;
- width = 0;
- prec = -1;
- sign = '\0';
- old_sign = '\0';
-#ifdef __ALTIVEC__
- vec_print_count = 0;
- vec_sep = ' ';
-#endif /* __ALTIVEC__ */
-
- format_anchor = fmt;
-rflag: ch = *fmt++;
- old_ch = ch;
-reswitch: switch (ch) {
- case ' ':
- /*
- * ``If the space and + flags both appear, the space
- * flag will be ignored.''
- * -- ANSI X3J11
- */
- if (!sign)
- sign = ' ';
- goto rflag;
- case '#':
- flags |= ALT;
- goto rflag;
- case '*':
- /*
- * ``A negative field width argument is taken as a
- * - flag followed by a positive field width.''
- * -- ANSI X3J11
- * They don't exclude field widths read from args.
- */
- if ((width = va_arg(ap, int)) >= 0)
- goto rflag;
- width = -width;
- /* FALLTHROUGH */
- case '-':
- flags |= LADJUST;
- goto rflag;
- case '+':
- sign = '+';
- goto rflag;
-#ifdef __ALTIVEC__
- case ',':
- case ';':
- case ':':
- case '_':
- if (vec_sep != ' ')
- {
- fmt = format_anchor;
- continue;
- }
- vec_sep = ch;
- goto rflag;
-#endif /* __ALTIVEC__ */
- case '.':
- if ((ch = *fmt++) == '*') {
- n = va_arg(ap, int);
- prec = n < 0 ? -1 : n;
- goto rflag;
- }
- n = 0;
- while (is_digit(ch)) {
- n = 10 * n + to_digit(ch);
- ch = *fmt++;
- }
- prec = n < 0 ? -1 : n;
- goto reswitch;
- case '0':
- /*
- * ``Note that 0 is taken as a flag, not as the
- * beginning of a field width.''
- * -- ANSI X3J11
- */
- flags |= ZEROPAD;
- goto rflag;
- case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- n = 0;
- do {
- n = 10 * n + to_digit(ch);
- ch = *fmt++;
- } while (is_digit(ch));
- width = n;
- goto reswitch;
-#ifdef FLOATING_POINT
- case 'L':
-#ifdef __ALTIVEC__
- if (flags & VECTOR)
- {
- fmt = format_anchor;
- continue;
- }
-#endif /* __ALTIVEC__ */
- flags |= LONGDBL;
- goto rflag;
-#endif
- case 'h':
- if (flags & LONGINT)
- {
- fmt = format_anchor;
- continue;
- }
- flags |= SHORTINT;
-#ifdef __ALTIVEC__
- if (flags & VECTOR)
- vec_print_count = 8;
-#endif
- goto rflag;
- case 'l':
- if (flags & SHORTINT)
- {
- fmt = format_anchor;
- continue;
- }
- if (*fmt == 'l') {
- fmt++;
- flags |= QUADINT;
- flags &= ~VECTOR;
- } else {
- flags |= LONGINT;
-#ifdef __ALTIVEC__
- if (flags & VECTOR)
- vec_print_count = 4;
-#endif
- }
- goto rflag;
-#ifdef __ALTIVEC__
- case 'v':
- if (flags & VECTOR)
- {
- fmt = format_anchor;
- continue;
- }
- flags |= VECTOR;
- vec_print_count = (flags & SHORTINT) ? 8 :
- ((flags & LONGINT) ? 4 : 16);
- goto rflag;
-#endif
- case 'q':
-#ifdef __ALTIVEC__
- if (flags & VECTOR)
- {
- fmt = format_anchor;
- continue;
- }
-#endif /* __ALTIVEC__ */
- flags |= QUADINT;
- goto rflag;
- case 'c':
-#ifdef __ALTIVEC__
- if (flags & VECTOR)
- {
- int k;
- vec_16_byte_union tmp;
- if (flags & (SHORTINT | LONGINT))
- {
- fmt = format_anchor;
- continue;
- }
- tmp.v = va_arg(ap, vector int);
- cp = buf;
- for (k = 0; k < 15; ++k)
- {
- *cp++ = tmp.c[k];
- if (vec_sep != ' ')
- *cp++ = vec_sep;
- }
- *cp++ = tmp.c[15];
- size = cp - buf;
- cp = buf;
- vec_print_count = 0;
- }
- else
-#endif /* __ALTIVEC__ */
- {
- *(cp = buf) = va_arg(ap, int);
- size = 1;
- }
- sign = '\0';
- break;
- case 'D':
- flags |= LONGINT;
- /*FALLTHROUGH*/
- case 'd':
- case 'i':
-#ifdef __ALTIVEC__
- if (!(flags & VECTOR) && vec_sep != ' ')
- {
- fmt = format_anchor;
- continue;
- }
-#endif /* __ALTIVEC__ */
- _uquad = SARG();
-#ifndef _NO_LONGLONG
- if ((quad_t)_uquad < 0)
-#else
- if ((long) _uquad < 0)
-#endif
- {
-
- _uquad = -_uquad;
- old_sign = sign;
- sign = '-';
- }
- base = DEC;
- goto number;
-#ifdef FLOATING_POINT
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- case 'G':
- if (prec == -1) {
- prec = DEFPREC;
- } else if ((ch == 'g' || ch == 'G') && prec == 0) {
- prec = 1;
- }
-
-#ifdef _NO_LONGDBL
- if (flags & LONGDBL) {
- _fpvalue = (double) va_arg(ap, _LONG_DOUBLE);
-#ifdef __ALTIVEC__
- } else if (flags & VECTOR) {
- if (vec_print_count >= 4)
- {
- vec_print_count = 4;
- vec_tmp.v = va_arg(ap, vector int);
- }
- _fpvalue = (double)vec_tmp.f[4 - vec_print_count];
- } else if (vec_sep != ' ') {
- fmt = format_anchor;
- continue;
-
-#endif /* __ALTIVEC__ */
- } else {
- _fpvalue = va_arg(ap, double);
- }
-
- /* do this before tricky precision changes */
- if (isinf(_fpvalue)) {
- if (_fpvalue < 0)
- {
- old_sign = sign;
- sign = '-';
- }
-
- cp = "Inf";
- size = 3;
- break;
- }
- if (isnan(_fpvalue)) {
- cp = "NaN";
- size = 3;
- break;
- }
-
-#else /* !_NO_LONGDBL */
-
- if (flags & LONGDBL) {
- _fpvalue = va_arg(ap, _LONG_DOUBLE);
-#ifdef __ALTIVEC__
- } else if (flags & VECTOR) {
- if (vec_print_count >= 4)
- {
- vec_print_count = 4;
- vec_tmp.v = va_arg(ap, vector int);
- }
- _fpvalue = (_LONG_DOUBLE)k.f[4 - vec_print_count];
-#endif /* __ALTIVEC__ */
- } else {
- _fpvalue = (_LONG_DOUBLE)va_arg(ap, double);
- }
-
- /* do this before tricky precision changes */
- tmp = _ldcheck (&_fpvalue);
- if (tmp == 2) {
- if (_fpvalue < 0)
- {
- old_sign = sign;
- sign = '-';
- }
- cp = "Inf";
- size = 3;
- break;
- }
- if (tmp == 1) {
- cp = "NaN";
- size = 3;
- break;
- }
-#endif /* !_NO_LONGDBL */
-
- flags |= FPT;
-
- cp = cvt(data, _fpvalue, prec, flags, &softsign,
- &expt, ch, &ndig);
-
- if (ch == 'g' || ch == 'G') {
- if (expt <= -4 || expt > prec)
- {
- old_ch = ch;
- ch = (ch == 'g') ? 'e' : 'E';
- }
- else
- ch = 'g';
- }
- if (ch <= 'e') { /* 'e' or 'E' fmt */
- --expt;
- expsize = exponent(expstr, expt, ch);
- size = expsize + ndig;
- if (ndig > 1 || flags & ALT)
- ++size;
- } else if (ch == 'f') { /* f fmt */
- 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)
- {
- old_sign = sign;
- sign = '-';
- }
- break;
-#endif /* FLOATING_POINT */
-#ifdef __SPE__
- case 'r':
- flags |= FIXEDPOINT;
- _uquad = SFPARG();
- if ((quad_t)_uquad < 0)
- {
- sign = '-';
- _uquad = -(quad_t)_uquad;
- }
- if (flags & SHORTINT)
- _uquad <<= 49;
- else if (flags & LONGINT)
- _uquad <<= 1;
- else
- _uquad <<= 33;
-
- if (_uquad == 0 && sign)
- {
- /* we have -1.0 which has to be handled special */
- cp = "100000";
- expt = 1;
- ndig = 6;
- break;
- }
-
- goto fixed_nosign;
- case 'R':
- flags |= FIXEDPOINT;
- _uquad = UFPARG();
- if (flags & SHORTINT)
- _uquad <<= 48;
- else if (!(flags & LONGINT))
- _uquad <<= 32;
-
-fixed_nosign:
- if (prec == -1)
- prec = DEFPREC;
-
- cp = cvt_ufix64 (data, _uquad, prec, &expt, &ndig);
-
- /* act like %f of format "0.X" */
- size = prec + 2;
-
- break;
-#endif /* __SPE__ */
- case 'n':
-#ifdef __ALTIVEC__
- if (flags & VECTOR)
- {
- fmt = format_anchor;
- continue;
- }
-#endif /* __ALTIVEC__ */
-#ifndef _NO_LONGLONG
- if (flags & QUADINT)
- *va_arg(ap, quad_t *) = ret;
- else
-#endif
- if (flags & LONGINT)
- *va_arg(ap, long *) = ret;
- else if (flags & SHORTINT)
- *va_arg(ap, short *) = ret;
- else
- *va_arg(ap, int *) = ret;
- continue; /* no output */
- case 'O':
- flags |= LONGINT;
- /*FALLTHROUGH*/
- case 'o':
-#ifdef __ALTIVEC__
- if (!(flags & VECTOR) && vec_sep != ' ')
- {
- fmt = format_anchor;
- continue;
- }
-#endif /* __ALTIVEC__ */
- _uquad = UARG();
- base = OCT;
- goto nosign;
- case 'p':
- /*
- * ``The argument shall be a pointer to void. The
- * value of the pointer is converted to a sequence
- * of printable characters, in an implementation-
- * defined manner.''
- * -- ANSI X3J11
- */
- /* NOSTRICT */
-#ifdef __ALTIVEC__
- if (flags & VECTOR)
- _uquad = UARG();
- else if (vec_sep != ' ')
- {
- fmt = format_anchor;
- continue;
- }
- else
-#endif /* __ALTIVEC__ */
- _uquad = (u_long)(unsigned _POINTER_INT)va_arg(ap, void *);
- base = HEX;
- xdigs = "0123456789abcdef";
- flags |= HEXPREFIX;
- ch = 'x';
- goto nosign;
- case 's':
-#ifdef __ALTIVEC__
- if (flags & VECTOR)
- {
- fmt = format_anchor;
- continue;
- }
-#endif /* __ALTIVEC__ */
- if ((cp = va_arg(ap, char *)) == NULL)
- cp = "(null)";
- if (prec >= 0) {
- /*
- * can't use strlen; can only look for the
- * NUL in the first `prec' characters, and
- * strlen() will go further.
- */
- char *p = memchr(cp, 0, prec);
-
- if (p != NULL) {
- size = p - cp;
- if (size > prec)
- size = prec;
- } else
- size = prec;
- } else
- size = strlen(cp);
- sign = '\0';
- break;
- case 'U':
- flags |= LONGINT;
- /*FALLTHROUGH*/
- case 'u':
-#ifdef __ALTIVEC__
- if (!(flags & VECTOR) && vec_sep != ' ')
- {
- fmt = format_anchor;
- continue;
- }
-#endif /* __ALTIVEC__ */
- _uquad = UARG();
- base = DEC;
- goto nosign;
- case 'X':
- xdigs = "0123456789ABCDEF";
- goto hex;
- case 'x':
- xdigs = "0123456789abcdef";
-#ifdef __ALTIVEC__
- if (!(flags & VECTOR) && vec_sep != ' ')
- {
- fmt = format_anchor;
- continue;
- }
-#endif /* __ALTIVEC__ */
-hex: _uquad = UARG();
- base = HEX;
- /* leading 0x/X only if non-zero */
- if (flags & ALT && _uquad != 0)
- flags |= HEXPREFIX;
-
- /* unsigned conversions */
-nosign: sign = '\0';
- /*
- * ``... diouXx conversions ... if a precision is
- * specified, the 0 flag will be ignored.''
- * -- ANSI X3J11
- */
-number: if ((dprec = prec) >= 0)
- flags &= ~ZEROPAD;
-
- /*
- * ``The result of converting a zero value with an
- * explicit precision of zero is no characters.''
- * -- ANSI X3J11
- */
- cp = buf + BUF;
- if (_uquad != 0 || prec != 0) {
- /*
- * Unsigned mod is hard, and unsigned mod
- * by a constant is easier than that by
- * a variable; hence this switch.
- */
- switch (base) {
- case OCT:
- do {
- *--cp = to_char(_uquad & 7);
- _uquad >>= 3;
- } while (_uquad);
- /* handle octal leading 0 */
- if (flags & ALT && *cp != '0')
- *--cp = '0';
- break;
-
- case DEC:
- /* many numbers are 1 digit */
- while (_uquad >= 10) {
- *--cp = to_char(_uquad % 10);
- _uquad /= 10;
- }
- *--cp = to_char(_uquad);
- break;
-
- case HEX:
- do {
- *--cp = xdigs[_uquad & 15];
- _uquad >>= 4;
- } while (_uquad);
- break;
-
- default:
- cp = "bug in vfprintf: bad base";
- size = strlen(cp);
- goto skipsize;
- }
- }
- /*
- * ...result is to be converted to an 'alternate form'.
- * For o conversion, it increases the precision to force
- * the first digit of the result to be a zero."
- * -- ANSI X3J11
- *
- * To demonstrate this case, compile and run:
- * printf ("%#.0o",0);
- */
- else if (base == OCT && (flags & ALT))
- *--cp = '0';
-
- size = buf + BUF - cp;
- skipsize:
- break;
- default: /* "%?" prints ?, unless ? is NUL */
- flags &= ~VECTOR;
- if (ch == '\0')
- goto done;
- /* pretend it was %c with argument ch */
- cp = buf;
- *cp = ch;
- size = 1;
- sign = '\0';
- break;
- }
-
- /*
- * All reasonable formats wind up here. At this point, `cp'
- * points to a string which (if not flags&LADJUST) should be
- * padded out to `width' places. If flags&ZEROPAD, it should
- * first be prefixed by any sign or other prefix; otherwise,
- * it should be blank padded before the prefix is emitted.
- * After any left-hand padding and prefixing, emit zeroes
- * required by a decimal [diouxX] precision, then print the
- * string proper, then emit zeroes required by any leftover
- * floating precision; finally, if LADJUST, pad with blanks.
- *
- * Compute actual size, so we know how much to pad.
- * size excludes decimal prec; realsz includes it.
- */
- realsz = dprec > size ? dprec : size;
- if (sign)
- realsz++;
- else if (flags & HEXPREFIX)
- realsz+= 2;
-
- /* right-adjusting blank padding */
- if ((flags & (LADJUST|ZEROPAD)) == 0)
- PAD(width - realsz, blanks);
-
- /* prefix */
- if (sign) {
- PRINT(&sign, 1);
- } else if (flags & HEXPREFIX) {
- ox[0] = '0';
- ox[1] = ch;
- PRINT(ox, 2);
- }
-
- /* right-adjusting zero padding */
- if ((flags & (LADJUST|ZEROPAD)) == ZEROPAD)
- PAD(width - realsz, zeroes);
-
- /* leading zeroes from decimal precision */
- PAD(dprec - size, zeroes);
-
- /* the string or number proper */
-#ifdef FLOATING_POINT
- if ((flags & FPT) == 0) {
-#ifdef __SPE__
- if (flags & FIXEDPOINT) {
- if (_uquad == 0 && !sign) {
- /* 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);
- if(expt || ndig) {
- PRINT(decimal_point, 1);
- PAD(-expt, zeroes);
- PRINT(cp, ndig);
- }
- } else if (expt >= ndig) {
- PRINT(cp, ndig);
- PAD(expt - ndig, zeroes);
- if (flags & ALT)
- PRINT(".", 1);
- } else {
- PRINT(cp, expt);
- cp += expt;
- PRINT(".", 1);
- PRINT(cp, ndig-expt);
- }
- } else
-#endif /* __SPE__ */
- PRINT(cp, size);
- } else { /* glue together f_p fragments */
- if (ch >= 'f') { /* 'f' or 'g' */
- if (_fpvalue == 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);
- if(expt || ndig) {
- PRINT(decimal_point, 1);
- PAD(-expt, zeroes);
- PRINT(cp, ndig);
- }
- } else if (expt >= ndig) {
- PRINT(cp, ndig);
- PAD(expt - ndig, zeroes);
- if (flags & ALT)
- PRINT(".", 1);
- } else {
- PRINT(cp, expt);
- cp += expt;
- PRINT(".", 1);
- PRINT(cp, ndig-expt);
- }
- } else { /* 'e' or 'E' */
- if (ndig > 1 || flags & ALT) {
- ox[0] = *cp++;
- ox[1] = '.';
- PRINT(ox, 2);
- if (_fpvalue) {
- PRINT(cp, ndig-1);
- } else /* 0.[0..] */
- /* __dtoa irregularity */
- PAD(ndig - 1, zeroes);
- } else /* XeYYY */
- PRINT(cp, 1);
- PRINT(expstr, expsize);
- }
- }
-#else
- PRINT(cp, size);
-#endif
- /* left-adjusting padding (always blank) */
- if (flags & LADJUST)
- PAD(width - realsz, blanks);
-
- /* finally, adjust ret */
- ret += width > realsz ? width : realsz;
-
-#ifdef __ALTIVEC__
- if ((flags & VECTOR) && vec_print_count-- > 1)
- {
- /* add vector separator */
- if (ch != 'c' || vec_sep != ' ')
- {
- PRINT(&vec_sep, 1);
- ret += 1;
- }
- FLUSH();
- sign = old_sign;
- ch = old_ch;
- goto reswitch;
- }
-#endif /* __ALTIVEC__ */
- FLUSH(); /* copy out the I/O vectors */
- }
-done:
- FLUSH();
-error:
- return (__sferror(fp) ? EOF : ret);
- /* NOTREACHED */
-}
-
-#ifdef FLOATING_POINT
-
-#ifdef _NO_LONGDBL
-extern char *_dtoa_r _PARAMS((struct _reent *, double, int,
- int, int *, int *, char **));
-#else
-extern char *_ldtoa_r _PARAMS((struct _reent *, _LONG_DOUBLE, int,
- int, int *, int *, char **));
-#undef word0
-#define word0(x) ldword0(x)
-#endif
-
-static char *
-cvt(data, value, ndigits, flags, sign, decpt, ch, length)
- struct _reent *data;
-#ifdef _NO_LONGDBL
- double value;
-#else
- _LONG_DOUBLE value;
-#endif
- int ndigits, flags, *decpt, ch, *length;
- char *sign;
-{
- int mode, dsgn;
- char *digits, *bp, *rve;
-#ifdef _NO_LONGDBL
- union double_union tmp;
-#else
- struct ldieee *ldptr;
-#endif
-
- if (ch == 'f') {
- mode = 3; /* ndigits after the decimal point */
- } else {
- /* To obtain ndigits after the decimal point for the 'e'
- * and 'E' formats, round to ndigits + 1 significant
- * figures.
- */
- if (ch == 'e' || ch == 'E') {
- ndigits++;
- }
- mode = 2; /* ndigits significant digits */
- }
-
-#ifdef _NO_LONGDBL
- tmp.d = value;
-
- if (word0(tmp) & Sign_bit) { /* this will check for < 0 and -0.0 */
- value = -value;
- *sign = '-';
- } else
- *sign = '\000';
-
- digits = _dtoa_r(data, value, mode, ndigits, decpt, &dsgn, &rve);
-#else /* !_NO_LONGDBL */
- ldptr = (struct ldieee *)&value;
- if (ldptr->sign) { /* this will check for < 0 and -0.0 */
- value = -value;
- *sign = '-';
- } else
- *sign = '\000';
-
- digits = _ldtoa_r(data, value, mode, ndigits, decpt, &dsgn, &rve);
-#endif /* !_NO_LONGDBL */
-
- if ((ch != 'g' && ch != 'G') || flags & ALT) { /* Print trailing zeros */
- bp = digits + ndigits;
- if (ch == 'f') {
- if (*digits == '0' && value)
- *decpt = -ndigits + 1;
- bp += *decpt;
- }
- if (value == 0) /* kludge for __dtoa irregularity */
- rve = bp;
- while (rve < bp)
- *rve++ = '0';
- }
- *length = rve - digits;
- return (digits);
-}
-
-static int
-exponent(p0, exp, fmtch)
- char *p0;
- int exp, fmtch;
-{
- register char *p, *t;
- char expbuf[40];
-
- p = p0;
- *p++ = fmtch;
- if (exp < 0) {
- exp = -exp;
- *p++ = '-';
- }
- else
- *p++ = '+';
- t = expbuf + 40;
- if (exp > 9) {
- do {
- *--t = to_char(exp % 10);
- } while ((exp /= 10) > 9);
- *--t = to_char(exp);
- for (; t < expbuf + 40; *p++ = *t++);
- }
- else {
- *p++ = '0';
- *p++ = to_char(exp);
- }
- return (p - p0);
-}
-#endif /* FLOATING_POINT */
-
-#ifdef __SPE__
-extern char *_ufix64toa_r _PARAMS((struct _reent *, unsigned long long, int,
- int, int *, int *, char **));
-static char *
-cvt_ufix64 (data, value, ndigits, decpt, length)
- struct _reent *data;
- unsigned long long value;
- int ndigits, *decpt, *length;
-{
- int dsgn;
- char *digits, *bp, *rve;
-
- /* treat the same as %f format and use mode=3 */
- digits = _ufix64toa_r (data, value, 3, ndigits, decpt, &dsgn, &rve);
-
- /* print trailing zeroes */
- bp = digits + ndigits;
- if (*digits == '0' && value)
- *decpt = -ndigits + 1;
- bp += *decpt;
- if (value == 0) /* kludge for __dtoa irregularity */
- rve = bp;
- while (rve < bp)
- *rve++ = '0';
- *length = rve - digits;
- return (digits);
-}
-#endif /* __SPE__ */
diff --git a/newlib/libc/machine/powerpc/vfscanf.c b/newlib/libc/machine/powerpc/vfscanf.c
deleted file mode 100644
index f4481efb7..000000000
--- a/newlib/libc/machine/powerpc/vfscanf.c
+++ /dev/null
@@ -1,1336 +0,0 @@
-/*
-FUNCTION
-<<vscanf>>, <<vfscanf>>, <<vsscanf>>---format argument list
-
-INDEX
- vscanf
-INDEX
- vfscanf
-INDEX
- vsscanf
-
-ANSI_SYNOPSIS
- #include <stdio.h>
- #include <stdarg.h>
- int vscanf(const char *<[fmt]>, va_list <[list]>);
- int vfscanf(FILE *<[fp]>, const char *<[fmt]>, va_list <[list]>);
- int vsscanf(const char *<[str]>, const char *<[fmt]>, va_list <[list]>);
-
- int _vscanf_r(void *<[reent]>, const char *<[fmt]>,
- va_list <[list]>);
- int _vfscanf_r(void *<[reent]>, FILE *<[fp]>, const char *<[fmt]>,
- va_list <[list]>);
- int _vsscanf_r(void *<[reent]>, const char *<[str]>, const char *<[fmt]>,
- va_list <[list]>);
-
-TRAD_SYNOPSIS
- #include <stdio.h>
- #include <varargs.h>
- int vscanf( <[fmt]>, <[ist]>)
- char *<[fmt]>;
- va_list <[list]>;
-
- int vfscanf( <[fp]>, <[fmt]>, <[list]>)
- FILE *<[fp]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int vsscanf( <[str]>, <[fmt]>, <[list]>)
- char *<[str]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int _vscanf_r( <[reent]>, <[fmt]>, <[ist]>)
- char *<[reent]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int _vfscanf_r( <[reent]>, <[fp]>, <[fmt]>, <[list]>)
- char *<[reent]>;
- FILE *<[fp]>;
- char *<[fmt]>;
- va_list <[list]>;
-
- int _vsscanf_r( <[reent]>, <[str]>, <[fmt]>, <[list]>)
- char *<[reent]>;
- char *<[str]>;
- char *<[fmt]>;
- va_list <[list]>;
-
-DESCRIPTION
-<<vscanf>>, <<vfscanf>>, and <<vsscanf>> are (respectively) variants
-of <<scanf>>, <<fscanf>>, and <<sscanf>>. They differ only in
-allowing their caller to pass the variable argument list as a
-<<va_list>> object (initialized by <<va_start>>) rather than
-directly accepting a variable number of arguments.
-
-RETURNS
-The return values are consistent with the corresponding functions:
-<<vscanf>> returns the number of input fields successfully scanned,
-converted, and stored; the return value does not include scanned
-fields which were not stored.
-
-If <<vscanf>> attempts to read at end-of-file, the return value
-is <<EOF>>.
-
-If no fields were stored, the return value is <<0>>.
-
-The routines <<_vscanf_r>>, <<_vfscanf_f>>, and <<_vsscanf_r>> are
-reentrant versions which take an additional first parameter which points to the
-reentrancy structure.
-
-PORTABILITY
-These are GNU extensions.
-
-Supporting OS subroutines required:
-*/
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley. The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#include <_ansi.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <wchar.h>
-#include <string.h>
-#ifdef _HAVE_STDC
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include "local.h"
-
-#ifndef NO_FLOATING_POINT
-#define FLOATING_POINT
-#endif
-
-#ifdef FLOATING_POINT
-#include <float.h>
-
-/* Currently a test is made to see if long double processing is warranted.
- This could be changed in the future should the _ldtoa_r code be
- preferred over _dtoa_r. */
-#define _NO_LONGDBL
-#if defined WANT_IO_LONG_DBL && (LDBL_MANT_DIG > DBL_MANT_DIG)
-#undef _NO_LONGDBL
-extern _LONG_DOUBLE _strtold _PARAMS((char *s, char **sptr));
-#endif
-
-#define _NO_LONGLONG
-#if defined WANT_PRINTF_LONG_LONG && defined __GNUC__
-# undef _NO_LONGLONG
-#endif
-
-#include "floatio.h"
-#define BUF (MAXEXP+MAXFRACT+3) /* 3 = sign + decimal point + NUL */
-/* An upper bound for how long a long prints in decimal. 4 / 13 approximates
- log (2). Add one char for roundoff compensation and one for the sign. */
-#define MAX_LONG_LEN ((CHAR_BIT * sizeof (long) - 1) * 4 / 13 + 2)
-#else
-#define BUF 40
-#endif
-
-/*
- * Flags used during conversion.
- */
-
-#define LONG 0x01 /* l: long or double */
-#define LONGDBL 0x02 /* L: long double or long long */
-#define SHORT 0x04 /* h: short */
-#define SUPPRESS 0x08 /* suppress assignment */
-#define POINTER 0x10 /* weird %p pointer (`fake hex') */
-#define NOSKIP 0x20 /* do not skip blanks */
-
-/*
- * The following are used in numeric conversions only:
- * SIGNOK, NDIGITS, DPTOK, and EXPOK are for floating point;
- * SIGNOK, NDIGITS, PFXOK, and NZDIGITS are for integral.
- */
-
-#define SIGNOK 0x40 /* +/- is (still) legal */
-#define NDIGITS 0x80 /* no digits detected */
-
-#define DPTOK 0x100 /* (float) decimal point is still legal */
-#define EXPOK 0x200 /* (float) exponent (e+3, etc) still legal */
-
-#define PFXOK 0x100 /* 0x prefix is (still) legal */
-#define NZDIGITS 0x200 /* no zero digits detected */
-
-#define VECTOR 0x400 /* v: vector */
-#define FIXEDPOINT 0x800 /* r/R: fixed-point */
-#define SIGNED 0x1000 /* r: signed fixed-point */
-
-/*
- * Conversion types.
- */
-
-#define CT_CHAR 0 /* %c conversion */
-#define CT_CCL 1 /* %[...] conversion */
-#define CT_STRING 2 /* %s conversion */
-#define CT_INT 3 /* integer, i.e., strtol or strtoul */
-#define CT_FLOAT 4 /* floating, i.e., strtod */
-
-#if 0
-#define u_char unsigned char
-#endif
-#define u_char char
-#define u_long unsigned long
-
-#ifndef _NO_LONGLONG
-typedef unsigned long long u_long_long;
-#endif
-
-typedef union
-{
- char c[16] __attribute__ ((__aligned__ (16)));
- short h[8];
- long l[4];
- int i[4];
- float f[4];
-} vec_union;
-
-/*static*/ u_char *__sccl ();
-
-/*
- * vfscanf
- */
-
-#define BufferEmpty (fp->_r <= 0 && __srefill(fp))
-
-#ifndef _REENT_ONLY
-
-int
-_DEFUN (vfscanf, (fp, fmt, ap),
- register FILE *fp _AND
- _CONST char *fmt _AND
- va_list ap)
-{
- CHECK_INIT(fp);
- return __svfscanf_r (fp->_data, fp, fmt, ap);
-}
-
-int
-__svfscanf (fp, fmt0, ap)
- register FILE *fp;
- char _CONST *fmt0;
- va_list ap;
-{
- return __svfscanf_r (_REENT, fp, fmt0, ap);
-}
-
-#endif /* !_REENT_ONLY */
-
-int
-_DEFUN (_vfscanf_r, (data, fp, fmt, ap),
- struct _reent *data _AND
- register FILE *fp _AND
- _CONST char *fmt _AND
- va_list ap)
-{
- return __svfscanf_r (data, fp, fmt, ap);
-}
-
-
-int
-__svfscanf_r (rptr, fp, fmt0, ap)
- struct _reent *rptr;
- register FILE *fp;
- char _CONST *fmt0;
- va_list ap;
-{
- register u_char *fmt = (u_char *) fmt0;
- register int c; /* character from format, or conversion */
- register int type; /* conversion type */
- register size_t width; /* field width, or 0 */
- register char *p; /* points into all kinds of strings */
- register int n; /* handy integer */
- register int flags; /* flags as defined above */
- register char *p0; /* saves original value of p when necessary */
- int orig_flags; /* saved flags used when processing vector */
- int int_width; /* tmp area to store width when processing int */
- int nassigned; /* number of fields assigned */
- int nread; /* number of characters consumed from fp */
- int base = 0; /* base argument to strtol/strtoul */
- int nbytes = 1; /* number of bytes read from fmt string */
- wchar_t wc; /* wchar to use to read format string */
- char vec_sep; /* vector separator char */
- char last_space_char; /* last white-space char eaten - needed for vec support */
- int vec_read_count; /* number of vector items to read separately */
- int looped; /* has vector processing looped */
- u_long (*ccfn) () = 0; /* conversion function (strtol/strtoul) */
- char ccltab[256]; /* character class table for %[...] */
- char buf[BUF]; /* buffer for numeric conversions */
- vec_union vec_buf;
- char *lptr; /* literal pointer */
-#ifdef MB_CAPABLE
- mbstate_t state; /* value to keep track of multibyte state */
-#endif
-
- char *ch_dest;
- short *sp;
- int *ip;
- float *flp;
- _LONG_DOUBLE *ldp;
- double *dp;
- long *lp;
-#ifndef _NO_LONGLONG
- long long *llp;
-#else
- u_long _uquad;
-#endif
-
- /* `basefix' is used to avoid `if' tests in the integer scanner */
- static _CONST short basefix[17] =
- {10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
-
- nassigned = 0;
- nread = 0;
- for (;;)
- {
-#ifndef MB_CAPABLE
- wc = *fmt;
-#else
- memset (&state, '\0', sizeof (state));
- nbytes = _mbtowc_r (rptr, &wc, fmt, MB_CUR_MAX, &state);
-#endif
- fmt += nbytes;
- if (wc == 0)
- return nassigned;
- if (nbytes == 1 && isspace (wc))
- {
- for (;;)
- {
- if (BufferEmpty)
- return nassigned;
- if (!isspace (*fp->_p))
- break;
- nread++, fp->_r--, fp->_p++;
- }
- continue;
- }
- if (wc != '%')
- goto literal;
- width = 0;
- flags = 0;
- vec_sep = ' ';
- vec_read_count = 0;
- looped = 0;
-
- /*
- * switch on the format. continue if done; break once format
- * type is derived.
- */
-
- again:
- c = *fmt++;
-
- switch (c)
- {
- case '%':
- literal:
- lptr = fmt - nbytes;
- for (n = 0; n < nbytes; ++n)
- {
- if (BufferEmpty)
- goto input_failure;
- if (*fp->_p != *lptr)
- goto match_failure;
- fp->_r--, fp->_p++;
- nread++;
- ++lptr;
- }
- continue;
-
- case '*':
- flags |= SUPPRESS;
- goto again;
- case ',':
- case ';':
- case ':':
- case '_':
- if (flags == SUPPRESS || flags == 0)
- vec_sep = c;
- goto again;
- case 'l':
- if (flags & SHORT)
- continue; /* invalid format, don't process any further */
- if (flags & LONG)
- {
- flags &= ~LONG;
- flags &= ~VECTOR;
- flags |= LONGDBL;
- }
- else
- {
- flags |= LONG;
- if (flags & VECTOR)
- vec_read_count = 4;
- }
- goto again;
- case 'L':
- flags |= LONGDBL;
- flags &= ~VECTOR;
- goto again;
- case 'h':
- flags |= SHORT;
- if (flags & LONG)
- continue; /* invalid format, don't process any further */
- if (flags & VECTOR)
- vec_read_count = 8;
- goto again;
-#ifdef __ALTIVEC__
- case 'v':
- flags |= VECTOR;
- vec_read_count = (flags & SHORT) ? 8 : ((flags & LONG) ? 4 : 16);
- goto again;
-#endif
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- width = width * 10 + c - '0';
- goto again;
-
- /*
- * Conversions. Those marked `compat' are for
- * 4.[123]BSD compatibility.
- *
- * (According to ANSI, E and X formats are supposed to
- * the same as e and x. Sorry about that.)
- */
-
- case 'D': /* compat */
- flags |= LONG;
- /* FALLTHROUGH */
- case 'd':
- type = CT_INT;
- ccfn = (u_long (*)())_strtol_r;
- base = 10;
- break;
-
- case 'i':
- type = CT_INT;
- ccfn = (u_long (*)())_strtol_r;
- base = 0;
- break;
-
- case 'O': /* compat */
- flags |= LONG;
- /* FALLTHROUGH */
- case 'o':
- type = CT_INT;
- ccfn = _strtoul_r;
- base = 8;
- break;
-
- case 'u':
- type = CT_INT;
- ccfn = _strtoul_r;
- base = 10;
- break;
-
- case 'X': /* compat XXX */
- case 'x':
- flags |= PFXOK; /* enable 0x prefixing */
- type = CT_INT;
- ccfn = _strtoul_r;
- base = 16;
- break;
-
-#ifdef FLOATING_POINT
- case 'E': /* compat XXX */
- case 'G': /* compat XXX */
-/* ANSI says that E,G and X behave the same way as e,g,x */
- /* FALLTHROUGH */
- case 'e':
- case 'f':
- case 'g':
- type = CT_FLOAT;
- if (flags & VECTOR)
- vec_read_count = 4;
- break;
-
-# ifdef __SPE__
- /* treat fixed-point like %f floating point */
- case 'r':
- flags |= SIGNED;
- /* fallthrough */
- case 'R':
- flags |= FIXEDPOINT;
- type = CT_FLOAT;
- break;
-# endif
-#endif
-
- case 's':
- flags &= ~VECTOR;
- type = CT_STRING;
- break;
-
- case '[':
- fmt = __sccl (ccltab, fmt);
- flags |= NOSKIP;
- flags &= ~VECTOR;
- type = CT_CCL;
- break;
-
- case 'c':
- flags |= NOSKIP;
- type = CT_CHAR;
- if (flags & VECTOR)
- {
- /* not allowed to have h or l with c specifier */
- if (flags & (LONG | SHORT))
- continue; /* invalid format don't process any further */
- width = 0;
- vec_read_count = 16;
- }
- break;
-
- case 'p': /* pointer format is like hex */
- flags |= POINTER | PFXOK;
- type = CT_INT;
- ccfn = _strtoul_r;
- base = 16;
- break;
-
- case 'n':
- if (flags & SUPPRESS) /* ??? */
- continue;
- flags &= ~VECTOR;
- if (flags & SHORT)
- {
- sp = va_arg (ap, short *);
- *sp = nread;
- }
- else if (flags & LONG)
- {
- lp = va_arg (ap, long *);
- *lp = nread;
- }
-#ifndef _NO_LONGLONG
- else if (flags & LONGDBL)
- {
- llp = va_arg (ap, long long*);
- *llp = nread;
- }
-#endif
- else
- {
- ip = va_arg (ap, int *);
- *ip = nread;
- }
- continue;
-
- /*
- * Disgusting backwards compatibility hacks. XXX
- */
- case '\0': /* compat */
- return EOF;
-
- default: /* compat */
- if (isupper (c))
- flags |= LONG;
- type = CT_INT;
- ccfn = (u_long (*)())_strtol_r;
- base = 10;
- break;
- }
-
- process:
- /*
- * We have a conversion that requires input.
- */
- if (BufferEmpty)
- goto input_failure;
-
- /*
- * Consume leading white space, except for formats that
- * suppress this.
- */
- last_space_char = '\0';
-
- if ((flags & NOSKIP) == 0)
- {
- while (isspace (*fp->_p))
- {
- last_space_char = *fp->_p;
- nread++;
- if (--fp->_r > 0)
- fp->_p++;
- else
-#ifndef CYGNUS_NEC
- if (__srefill (fp))
-#endif
- goto input_failure;
- }
- /*
- * Note that there is at least one character in the
- * buffer, so conversions that do not set NOSKIP ca
- * no longer result in an input failure.
- */
- }
-
- /* for vector formats process separator characters after first loop */
- if (looped && (flags & VECTOR))
- {
- flags = orig_flags;
- /* all formats other than default char have a separator char */
- if (vec_sep != ' ' || type != CT_CHAR)
- {
- if (vec_sep == ' ' && last_space_char != ' ' ||
- vec_sep != ' ' && *fp->_p != vec_sep)
- goto match_failure;
- if (vec_sep != ' ')
- {
- nread++;
- if (--fp->_r > 0)
- fp->_p++;
- else
-#ifndef CYGNUS_NEC
- if (__srefill (fp))
-#endif
- goto input_failure;
- }
- }
- /* after eating the separator char, we must eat any white-space
- after the separator char that precedes the data to convert */
- if ((flags & NOSKIP) == 0)
- {
- while (isspace (*fp->_p))
- {
- last_space_char = *fp->_p;
- nread++;
- if (--fp->_r > 0)
- fp->_p++;
- else
-#ifndef CYGNUS_NEC
- if (__srefill (fp))
-#endif
- goto input_failure;
- }
- }
-
- }
- else /* save to counter-act changes made to flags when processing */
- orig_flags = flags;
-
- /*
- * Do the conversion.
- */
- switch (type)
- {
-
- case CT_CHAR:
- /* scan arbitrary characters (sets NOSKIP) */
- if (width == 0)
- width = 1;
- if (flags & SUPPRESS)
- {
- size_t sum = 0;
-
- for (;;)
- {
- if ((n = fp->_r) < (int)width)
- {
- sum += n;
- width -= n;
- fp->_p += n;
-#ifndef CYGNUS_NEC
- if (__srefill (fp))
- {
-#endif
- if (sum == 0)
- goto input_failure;
- break;
-#ifndef CYGNUS_NEC
- }
-#endif
- }
- else
- {
- sum += width;
- fp->_r -= width;
- fp->_p += width;
- break;
- }
- }
- nread += sum;
- }
- else
- {
- int n = width;
- if (!looped)
- {
- if (flags & VECTOR)
- ch_dest = vec_buf.c;
- else
- ch_dest = va_arg (ap, char *);
- }
-#ifdef CYGNUS_NEC
- /* Kludge city for the moment */
- if (fp->_r == 0)
- goto input_failure;
-
- while (n && fp->_r)
- {
- *ch_dest++ = *(fp->_p++);
- n--;
- fp->_r--;
- nread++;
- }
-#else
- size_t r = fread (ch_dest, 1, width, fp);
-
- if (r == 0)
- goto input_failure;
- nread += r;
- ch_dest += r;
-#endif
- if (!(flags & VECTOR))
- nassigned++;
- }
- break;
-
- case CT_CCL:
- /* scan a (nonempty) character class (sets NOSKIP) */
- if (width == 0)
- width = ~0; /* `infinity' */
- /* take only those things in the class */
- if (flags & SUPPRESS)
- {
- n = 0;
- while (ccltab[*fp->_p])
- {
- n++, fp->_r--, fp->_p++;
- if (--width == 0)
- break;
- if (BufferEmpty)
- {
- if (n == 0)
- goto input_failure;
- break;
- }
- }
- if (n == 0)
- goto match_failure;
- }
- else
- {
- p0 = p = va_arg (ap, char *);
- while (ccltab[*fp->_p])
- {
- fp->_r--;
- *p++ = *fp->_p++;
- if (--width == 0)
- break;
- if (BufferEmpty)
- {
- if (p == p0)
- goto input_failure;
- break;
- }
- }
- n = p - p0;
- if (n == 0)
- goto match_failure;
- *p = 0;
- nassigned++;
- }
- nread += n;
- break;
-
- case CT_STRING:
- /* like CCL, but zero-length string OK, & no NOSKIP */
- if (width == 0)
- width = ~0;
- if (flags & SUPPRESS)
- {
- n = 0;
- while (!isspace (*fp->_p))
- {
- n++, fp->_r--, fp->_p++;
- if (--width == 0)
- break;
- if (BufferEmpty)
- break;
- }
- nread += n;
- }
- else
- {
- p0 = p = va_arg (ap, char *);
- while (!isspace (*fp->_p))
- {
- fp->_r--;
- *p++ = *fp->_p++;
- if (--width == 0)
- break;
- if (BufferEmpty)
- break;
- }
- *p = 0;
- nread += p - p0;
- nassigned++;
- }
- continue;
-
- case CT_INT:
- /* scan an integer as if by strtol/strtoul */
- int_width = width;
-#ifdef hardway
- if (int_width == 0 || int_width > sizeof (buf) - 1)
- int_width = sizeof (buf) - 1;
-#else
- /* size_t is unsigned, hence this optimisation */
- if (--int_width > sizeof (buf) - 2)
- int_width = sizeof (buf) - 2;
- int_width++;
-#endif
- flags |= SIGNOK | NDIGITS | NZDIGITS;
- for (p = buf; int_width; int_width--)
- {
- c = *fp->_p;
- /*
- * Switch on the character; `goto ok' if we
- * accept it as a part of number.
- */
- switch (c)
- {
- /*
- * The digit 0 is always legal, but is special.
- * For %i conversions, if no digits (zero or nonzero)
- * have been scanned (only signs), we will have base==0.
- * In that case, we should set it to 8 and enable 0x
- * prefixing. Also, if we have not scanned zero digits
- * before this, do not turn off prefixing (someone else
- * will turn it off if we have scanned any nonzero digits).
- */
- case '0':
- if (base == 0)
- {
- base = 8;
- flags |= PFXOK;
- }
- if (flags & NZDIGITS)
- flags &= ~(SIGNOK | NZDIGITS | NDIGITS);
- else
- flags &= ~(SIGNOK | PFXOK | NDIGITS);
- goto ok;
-
- /* 1 through 7 always legal */
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- base = basefix[base];
- flags &= ~(SIGNOK | PFXOK | NDIGITS);
- goto ok;
-
- /* digits 8 and 9 ok iff decimal or hex */
- case '8':
- case '9':
- base = basefix[base];
- if (base <= 8)
- break; /* not legal here */
- flags &= ~(SIGNOK | PFXOK | NDIGITS);
- goto ok;
-
- /* letters ok iff hex */
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- /* no need to fix base here */
- if (base <= 10)
- break; /* not legal here */
- flags &= ~(SIGNOK | PFXOK | NDIGITS);
- goto ok;
-
- /* sign ok only as first character */
- case '+':
- case '-':
- if (flags & SIGNOK)
- {
- flags &= ~SIGNOK;
- goto ok;
- }
- break;
-
- /* x ok iff flag still set & 2nd char */
- case 'x':
- case 'X':
- if (flags & PFXOK && p == buf + 1)
- {
- base = 16;/* if %i */
- flags &= ~PFXOK;
- goto ok;
- }
- break;
- }
-
- /*
- * If we got here, c is not a legal character
- * for a number. Stop accumulating digits.
- */
- break;
- ok:
- /*
- * c is legal: store it and look at the next.
- */
- *p++ = c;
- if (--fp->_r > 0)
- fp->_p++;
- else
-#ifndef CYGNUS_NEC
- if (__srefill (fp))
-#endif
- break; /* EOF */
- }
- /*
- * If we had only a sign, it is no good; push back the sign.
- * If the number ends in `x', it was [sign] '0' 'x', so push back
- * the x and treat it as [sign] '0'.
- */
- if (flags & NDIGITS)
- {
- if (p > buf)
- _CAST_VOID ungetc (*(u_char *)-- p, fp);
- goto match_failure;
- }
- c = ((u_char *) p)[-1];
- if (c == 'x' || c == 'X')
- {
- --p;
- /*(void)*/ ungetc (c, fp);
- }
- if ((flags & SUPPRESS) == 0)
- {
- u_long res;
-
- *p = 0;
- res = (*ccfn) (rptr, buf, (char **) NULL, base);
- if ((flags & POINTER) && !(flags & VECTOR))
- *(va_arg (ap, _PTR *)) = (_PTR) (unsigned _POINTER_INT) res;
- else if (flags & SHORT)
- {
- if (!(flags & VECTOR))
- sp = va_arg (ap, short *);
- else if (!looped)
- sp = vec_buf.h;
- *sp++ = res;
- }
- else if (flags & LONG)
- {
- if (!(flags & VECTOR))
- lp = va_arg (ap, long *);
- else if (!looped)
- lp = vec_buf.l;
- *lp++ = res;
- }
-#ifndef _NO_LONGLONG
- else if (flags & LONGDBL)
- {
- u_long_long resll;
- if (ccfn == _strtoul_r)
- resll = _strtoull_r (rptr, buf, (char **) NULL, base);
- else
- resll = _strtoll_r (rptr, buf, (char **) NULL, base);
- llp = va_arg (ap, long long*);
- *llp = resll;
- }
-#endif
- else
- {
- if (!(flags & VECTOR))
- {
- ip = va_arg (ap, int *);
- *ip++ = res;
- }
- else
- {
- if (!looped)
- ch_dest = vec_buf.c;
- *ch_dest++ = (char)res;
- }
- }
- if (!(flags & VECTOR))
- nassigned++;
- }
- nread += p - buf;
- break;
-
-#ifdef FLOATING_POINT
- case CT_FLOAT:
- {
- /* scan a floating point number as if by strtod */
- /* This code used to assume that the number of digits is reasonable.
- However, ANSI / ISO C makes no such stipulation; we have to get
- exact results even when there is an unreasonable amount of
- leading zeroes. */
- long leading_zeroes = 0;
- long zeroes, exp_adjust;
- char *exp_start = NULL;
- int fl_width = width;
-#ifdef hardway
- if (fl_width == 0 || fl_width > sizeof (buf) - 1)
- fl_width = sizeof (buf) - 1;
-#else
- /* size_t is unsigned, hence this optimisation */
- if (--fl_width > sizeof (buf) - 2)
- fl_width = sizeof (buf) - 2;
- fl_width++;
-#endif
- flags |= SIGNOK | NDIGITS | DPTOK | EXPOK;
- zeroes = 0;
- exp_adjust = 0;
- for (p = buf; fl_width; )
- {
- c = *fp->_p;
- /*
- * This code mimicks the integer conversion
- * code, but is much simpler.
- */
- switch (c)
- {
-
- case '0':
- if (flags & NDIGITS)
- {
- flags &= ~SIGNOK;
- zeroes++;
- goto fskip;
- }
- /* Fall through. */
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- flags &= ~(SIGNOK | NDIGITS);
- goto fok;
-
- case '+':
- case '-':
- if (flags & SIGNOK)
- {
- flags &= ~SIGNOK;
- goto fok;
- }
- break;
- case '.':
- if (flags & DPTOK)
- {
- flags &= ~(SIGNOK | DPTOK);
- leading_zeroes = zeroes;
- goto fok;
- }
- break;
- case 'e':
- case 'E':
- /* no exponent without some digits */
- if ((flags & (NDIGITS | EXPOK)) == EXPOK
- || ((flags & EXPOK) && zeroes))
- {
- if (! (flags & DPTOK))
- {
- exp_adjust = zeroes - leading_zeroes;
- exp_start = p;
- }
- flags =
- (flags & ~(EXPOK | DPTOK)) |
- SIGNOK | NDIGITS;
- zeroes = 0;
- goto fok;
- }
- break;
- }
- break;
- fok:
- *p++ = c;
- fl_width--;
- fskip:
- ++nread;
- if (--fp->_r > 0)
- fp->_p++;
- else
-#ifndef CYGNUS_NEC
- if (__srefill (fp))
-#endif
- break; /* EOF */
- }
- if (zeroes)
- flags &= ~NDIGITS;
- /*
- * If no digits, might be missing exponent digits
- * (just give back the exponent) or might be missing
- * regular digits, but had sign and/or decimal point.
- */
- if (flags & NDIGITS)
- {
- if (flags & EXPOK)
- {
- /* no digits at all */
- while (p > buf)
- {
- ungetc (*(u_char *)-- p, fp);
- --nread;
- }
- goto match_failure;
- }
- /* just a bad exponent (e and maybe sign) */
- c = *(u_char *)-- p;
- --nread;
- if (c != 'e' && c != 'E')
- {
- _CAST_VOID ungetc (c, fp); /* sign */
- c = *(u_char *)-- p;
- --nread;
- }
- _CAST_VOID ungetc (c, fp);
- }
- if ((flags & SUPPRESS) == 0)
- {
-#ifdef _NO_LONGDBL
- double res;
-#else /* !_NO_LONG_DBL */
- long double res;
-#endif /* !_NO_LONG_DBL */
- long new_exp = 0;
-
- *p = 0;
- if ((flags & (DPTOK | EXPOK)) == EXPOK)
- {
- exp_adjust = zeroes - leading_zeroes;
- new_exp = -exp_adjust;
- exp_start = p;
- }
- else if (exp_adjust)
- new_exp = _strtol_r (rptr, (exp_start + 1), NULL, 10) - exp_adjust;
- if (exp_adjust)
- {
-
- /* If there might not be enough space for the new exponent,
- truncate some trailing digits to make room. */
- if (exp_start >= buf + sizeof (buf) - MAX_LONG_LEN)
- exp_start = buf + sizeof (buf) - MAX_LONG_LEN - 1;
- sprintf (exp_start, "e%ld", new_exp);
- }
-#ifdef __SPE__
- if (flags & FIXEDPOINT)
- {
- __uint64_t ufix64;
- if (flags & SIGNED)
- ufix64 = (__uint64_t)_strtosfix64_r (rptr, buf, NULL);
- else
- ufix64 = _strtoufix64_r (rptr, buf, NULL);
- if (flags & SHORT)
- {
- __uint16_t *sp = va_arg (ap, __uint16_t *);
- *sp = (__uint16_t)(ufix64 >> 48);
- }
- else if (flags & LONG)
- {
- __uint64_t *llp = va_arg (ap, __uint64_t *);
- *llp = ufix64;
- }
- else
- {
- __uint32_t *lp = va_arg (ap, __uint32_t *);
- *lp = (__uint32_t)(ufix64 >> 32);
- }
- nassigned++;
- break;
- }
-
-#endif /* __SPE__ */
-#ifdef _NO_LONGDBL
- res = _strtod_r (rptr, buf, NULL);
-#else /* !_NO_LONGDBL */
- res = _strtold (buf, NULL);
-#endif /* !_NO_LONGDBL */
- if (flags & LONG)
- {
- dp = va_arg (ap, double *);
- *dp = res;
- }
- else if (flags & LONGDBL)
- {
- ldp = va_arg (ap, _LONG_DOUBLE *);
- *ldp = res;
- }
- else
- {
- if (!(flags & VECTOR))
- flp = va_arg (ap, float *);
- else if (!looped)
- flp = vec_buf.f;
- *flp++ = res;
- }
- if (!(flags & VECTOR))
- nassigned++;
- }
- break;
- }
-#endif /* FLOATING_POINT */
- }
- if (vec_read_count-- > 1)
- {
- looped = 1;
- goto process;
- }
- if (flags & VECTOR)
- {
- int i;
- unsigned long *vp = va_arg (ap, unsigned long *);
- for (i = 0; i < 4; ++i)
- *vp++ = vec_buf.l[i];
- nassigned++;
- }
- }
-input_failure:
- return nassigned ? nassigned : -1;
-match_failure:
- return nassigned;
-}
-
-/*
- * Fill in the given table from the scanset at the given format
- * (just after `['). Return a pointer to the character past the
- * closing `]'. The table has a 1 wherever characters should be
- * considered part of the scanset.
- */
-
-/*static*/
-u_char *
-__sccl (tab, fmt)
- register char *tab;
- register u_char *fmt;
-{
- register int c, n, v;
-
- /* first `clear' the whole table */
- c = *fmt++; /* first char hat => negated scanset */
- if (c == '^')
- {
- v = 1; /* default => accept */
- c = *fmt++; /* get new first char */
- }
- else
- v = 0; /* default => reject */
- /* should probably use memset here */
- for (n = 0; n < 256; n++)
- tab[n] = v;
- if (c == 0)
- return fmt - 1; /* format ended before closing ] */
-
- /*
- * Now set the entries corresponding to the actual scanset to the
- * opposite of the above.
- *
- * The first character may be ']' (or '-') without being special; the
- * last character may be '-'.
- */
-
- v = 1 - v;
- for (;;)
- {
- tab[c] = v; /* take character c */
- doswitch:
- n = *fmt++; /* and examine the next */
- switch (n)
- {
-
- case 0: /* format ended too soon */
- return fmt - 1;
-
- case '-':
- /*
- * A scanset of the form [01+-] is defined as `the digit 0, the
- * digit 1, the character +, the character -', but the effect of a
- * scanset such as [a-zA-Z0-9] is implementation defined. The V7
- * Unix scanf treats `a-z' as `the letters a through z', but treats
- * `a-a' as `the letter a, the character -, and the letter a'.
- *
- * For compatibility, the `-' is not considerd to define a range if
- * the character following it is either a close bracket (required by
- * ANSI) or is not numerically greater than the character we just
- * stored in the table (c).
- */
- n = *fmt;
- if (n == ']' || n < c)
- {
- c = '-';
- break; /* resume the for(;;) */
- }
- fmt++;
- do
- { /* fill in the range */
- tab[++c] = v;
- }
- while (c < n);
-#if 1 /* XXX another disgusting compatibility hack */
- /*
- * Alas, the V7 Unix scanf also treats formats such
- * as [a-c-e] as `the letters a through e'. This too
- * is permitted by the standard....
- */
- goto doswitch;
-#else
- c = *fmt++;
- if (c == 0)
- return fmt - 1;
- if (c == ']')
- return fmt;
-#endif
-
- break;
-
-
- case ']': /* end of scanset */
- return fmt;
-
- default: /* just another character */
- c = n;
- break;
- }
- }
- /* NOTREACHED */
-}