[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commits] r16156 - in /libdfp/trunk: ./ dfp/ ieee754r/ tests/



Author: ryanarn
Date: Fri Dec  9 01:11:55 2011
New Revision: 16156

Log:
Added C++ compatibility.

Added operator<< overloading for C++ DFP decimal[32|64|128] types in
<dfp/decimal> header.  Added <dfp/float.h> or _Decimal[32|64|128] types
compatibility when __cplusplus is defined.  Added C++ testcase support.


2011-12-08  Ryan S. Arnold  <rsa@xxxxxxxxxxxxxxxxxx>

	* configure: Regenerated.
	* Makefile.in:
	(@CXX@, @LLD@, @OBDJUMP@, @GDB@, @CXXFLAGS@, and @CPPFLAGS@): New
	imports.
	(header_dirs): Move dfp/ to $(system_header_dirs).
	(CXX_DEFINES CXX_WARNS): New variables.
	(.c.o): Add $(CPPFLAGS). Add -I$(system_header_dirs).
	(.c.os): Likewise
	(.S.o): Add -I$(system_headers).
	(.cpp.os) Likewise.
	(GLIBC_LIBS): Remove unnecessary libpthread.so linkage.
	(libdfp_cxx_tests): New variable.
	(libdfp_tests): Renamed to (libdfp_c_tests) and replaced with
	$(libdfp_c_tests) $(libdp_cxx_tests).
	Added new rule for $(libdfp_cxx_tests).os dependencies on float.h.
	Added new rule for $(libdfp_tests) to rely on tests/scaffold.c.
	Added new rule to link $(libdfp_cxx_tests) to their .os files.
	(.SUFFIXES): Added .cpp.
	* ieee754r/lgammad32.c: Changed <dfp/math.h> to <math.h>.
	* tests/test-printf.c: Discovered a bug in %.Ha.  If there is a '.'
	with no precision specifier it prints a bogus value.  This adds this
	failure to the test suite.
	* tests/test-ostream.cpp: New test to test operator<< header file
	additions in dfp/decimal.
	* configure.ac: Added AC_PATH_PROG for OBJDUMP, LDD, GDB.  Added
	AC_SUBST for CXXFLAGS, CPPFLAGS.
	* README.user: Added instructions for printf "a,A" Conversion
	Specifier usage.
	* README.developer: Added instructions for specifying PATH to pick up
	toolchain default programs.  Added instructions for LDD, GDB, OBJDUMP,
	CXX, CXXFLAGS, and CPPLAGS.
	* Versions.def
	* Makefile.gdb: Use configure exported 'objdump' via $(OBJDUMP). Use
	configure exported 'ldd' via $(LDD).  Use configure exported 'gdb' via
	$(GDB).
	* dfp/stdlib.h: Comment update.
	* dfp/float.h: New file adds _Decimal[32|64|128] types #ifdef
	__cplusplus and if they aren't added by the compiler.  At the time of
	this writing the compiler hasn't added them to float.h yet.
	* dfp/decimal: New file adds operator<< for decimal[32|64|128] C++
	types.  This use C++ template metaprogramming to create functions that
	call printf.
	* printf_dfp.c: Comment change for a/A spec char.
	* TODO: New item.


Added:
    libdfp/trunk/dfp/decimal
    libdfp/trunk/dfp/float.h
    libdfp/trunk/tests/test-ostream.cpp
Modified:
    libdfp/trunk/ChangeLog
    libdfp/trunk/Makefile.gdb
    libdfp/trunk/Makefile.in
    libdfp/trunk/README.developer
    libdfp/trunk/README.user
    libdfp/trunk/TODO
    libdfp/trunk/configure
    libdfp/trunk/configure.ac
    libdfp/trunk/dfp/stdlib.h
    libdfp/trunk/ieee754r/lgammad32.c
    libdfp/trunk/printf_dfp.c
    libdfp/trunk/tests/test-printf.c

Modified: libdfp/trunk/ChangeLog
==============================================================================
--- libdfp/trunk/ChangeLog (original)
+++ libdfp/trunk/ChangeLog Fri Dec  9 01:11:55 2011
@@ -1,3 +1,50 @@
+2011-12-08  Ryan S. Arnold  <rsa@xxxxxxxxxxxxxxxxxx>
+
+	* configure: Regenerated.
+	* Makefile.in:
+	(@CXX@, @LLD@, @OBDJUMP@, @GDB@, @CXXFLAGS@, and @CPPFLAGS@): New
+	imports.
+	(header_dirs): Move dfp/ to $(system_header_dirs).
+	(CXX_DEFINES CXX_WARNS): New variables.
+	(.c.o): Add $(CPPFLAGS). Add -I$(system_header_dirs).
+	(.c.os): Likewise
+	(.S.o): Add -I$(system_headers).
+	(.cpp.os) Likewise.
+	(GLIBC_LIBS): Remove unnecessary libpthread.so linkage.
+	(libdfp_cxx_tests): New variable.
+	(libdfp_tests): Renamed to (libdfp_c_tests) and replaced with
+	$(libdfp_c_tests) $(libdp_cxx_tests).
+	Added new rule for $(libdfp_cxx_tests).os dependencies on float.h.
+	Added new rule for $(libdfp_tests) to rely on tests/scaffold.c.
+	Added new rule to link $(libdfp_cxx_tests) to their .os files.
+	(.SUFFIXES): Added .cpp.
+	* ieee754r/lgammad32.c: Changed <dfp/math.h> to <math.h>.
+	* tests/test-printf.c: Discovered a bug in %.Ha.  If there is a '.'
+	with no precision specifier it prints a bogus value.  This adds this
+	failure to the test suite.
+	* tests/test-ostream.cpp: New test to test operator<< header file
+	additions in dfp/decimal.
+	* configure.ac: Added AC_PATH_PROG for OBJDUMP, LDD, GDB.  Added
+	AC_SUBST for CXXFLAGS, CPPFLAGS.
+	* README.user: Added instructions for printf "a,A" Conversion
+	Specifier usage.
+	* README.developer: Added instructions for specifying PATH to pick up
+	toolchain default programs.  Added instructions for LDD, GDB, OBJDUMP,
+	CXX, CXXFLAGS, and CPPLAGS.
+	* Versions.def
+	* Makefile.gdb: Use configure exported 'objdump' via $(OBJDUMP). Use
+	configure exported 'ldd' via $(LDD).  Use configure exported 'gdb' via
+	$(GDB).
+	* dfp/stdlib.h: Comment update.
+	* dfp/float.h: New file adds _Decimal[32|64|128] types #ifdef
+	__cplusplus and if they aren't added by the compiler.  At the time of
+	this writing the compiler hasn't added them to float.h yet.
+	* dfp/decimal: New file adds operator<< for decimal[32|64|128] C++
+	types.  This use C++ template metaprogramming to create functions that
+	call printf.
+	* printf_dfp.c: Comment change for a/A spec char.
+	* TODO: New item.
+
 2011-12-01  Ryan S. Arnold  <rsa@xxxxxxxxxxxxxxxxxx>
 
 	* Makefile.in (libdfp_tests): Add test-expd, testing

Modified: libdfp/trunk/Makefile.gdb
==============================================================================
--- libdfp/trunk/Makefile.gdb (original)
+++ libdfp/trunk/Makefile.gdb Fri Dec  9 01:11:55 2011
@@ -1,19 +1,22 @@
 # These are all used for debugging testcases.  This is sufficiently hackish so
 # it's going into it's own Makefile.
 
-# We only need to regenerated the default .conf file if the Makefile has changed.
+# We only need to regenerate the default .conf file if the Makefile has changed.
 $(top_builddir)/debug-test.conf: Makefile
 	@echo "Generating common debug configuration file $@."
 	@echo 'CC="$(CC)"' > $@
-	@echo 'DBG=$(dir $(firstword $(CC)))gdb$(cc_msize)' >> $@
-	@echo 'OBJDUMP=$(dir $(firstword $(CC)))objdump' >> $@
+	@echo 'DBG=$(GDB)' >> $@
+	@echo 'OBJDUMP=$(OBJDUMP)' >> $@
 	@echo 'GLIBC_BUILD=$(glibc_builddir)' >> $@
 	@echo 'GLIBC_HEADERS=$(glibc_headers)' >> $@
 	@echo 'LIBDFP_BUILD=$(top_builddir)/' >> $@
 	@echo 'LIBDFP_HEADERS=$(top_srcdir)/dfp' >> $@
 	@echo 'LIBDFP_SRC=$(top_srcdir)' >> $@
 	cp $(top_srcdir)/tests/debug-test.sh $(top_builddir)/
+	@chmod +x $(top_builddir)/debug-test.sh
 	@echo
+
+# @echo 'DBG=$(dir $(firstword $(CC)))gdb$(cc_msize)' >> $@
 
 # We only need to regenerated the .conf files if the Makefile has changed.
 $(addsuffix .conf,$(libdfp_tests)): Makefile
@@ -49,30 +52,29 @@
 endif
 	@echo '' >> $@
 	@echo -n 'add-symbol-file $(top_builddir)/$(patsubst %.gdb,%,$@) 0x' >> $@
-	@echo `$(dir $(firstword $(CC)))objdump -s --section=".text" $(top_builddir)/$(patsubst %.gdb,%,$@) | grep Contents -A 1 | tail -n 1 | awk -F' ' '{printf $$1}'` >> $@
+	@echo `$(OBJDUMP) -s --section=".text" $(top_builddir)/$(patsubst %.gdb,%,$@) | grep Contents -A 1 | tail -n 1 | awk -F' ' '{printf $$1}'` >> $@
 	@echo '' >> $@
 	@echo 'p/x $$start_address("libc")' >> $@
 	@echo 'set $$libc_start = $$' >> $@
 	@echo -n 'set $$libc_text = 0x' >> $@
 ifneq ($(glibc_builddir),)
-	@echo `$(dir $(firstword $(CC)))objdump -s --section=".text" $(glibc_builddir)/libc.so | grep Contents -A 1 | tail -n 1 | awk -F' ' '{printf $$1}'` >> $@
+	@echo `$(OBJDUMP) -s --section=".text" $(glibc_builddir)/libc.so | grep Contents -A 1 | tail -n 1 | awk -F' ' '{printf $$1}'` >> $@
 else
-	@$(dir $(firstword $(CC)))objdump -s --section=".text" `LD_LIBRARY_PATH=./:$$LD_LIBRARY_PATH ldd $(patsubst %.gdb,%,$@) | grep libc.so | awk -F' ' '{print $$3}'` | grep Contents -A 1 | tail -n 1 | awk -F' ' '{printf $$1}' >> $@
-	@echo >> $@
+	@echo `$(OBJDUMP) -s --section=".text" \`LD_LIBRARY_PATH=./:$$LD_LIBRARY_PATH $(LDD) $(patsubst %.gdb,%,$@) | grep libc.so | awk -F' ' '{print $$3}'\` | grep Contents -A 1 | tail -n 1 | awk -F' ' '{printf $$1}'` >> $@
 endif
 	@echo 'set $$libc_addr = $$libc_start + $$libc_text' >> $@
 	@echo -n 'add-symbol-file ' >> $@
 ifneq ($(glibc_builddir),)
 	@echo -n '$(glibc_builddir)/libc.so' >> $@
 else
-	@echo -n `LD_LIBRARY_PATH=./:$$LD_LIBRARY_PATH ldd $(patsubst %.gdb,%,$@) | grep libc.so | awk -F' ' '{print $$3}'` >> $@
+	@echo -n `LD_LIBRARY_PATH=./:$$LD_LIBRARY_PATH $(LDD) $(patsubst %.gdb,%,$@) | grep libc.so | awk -F' ' '{print $$3}'` >> $@
 endif
 	@echo ' $$libc_addr' >> $@
 	@echo '' >> $@
 	@echo 'p/x $$start_address("libdfp")' >> $@
 	@echo 'set $$libdfp_start = $$' >> $@
 	@echo -n 'set $$libdfp_text = 0x' >> $@
-	@echo `$(dir $(firstword $(CC)))objdump -s --section=".text" $(top_builddir)/libdfp.so.1 | grep Contents -A 1 | tail -n 1 | awk -F' ' '{printf $$1}'` >> $@
+	@echo `$(OBJDUMP) -s --section=".text" $(top_builddir)/libdfp.so.1 | grep Contents -A 1 | tail -n 1 | awk -F' ' '{printf $$1}'` >> $@
 	@echo 'set $$libdfp_addr = $$libdfp_start + $$libdfp_text' >> $@
 	@echo 'add-symbol-file $(top_builddir)/libdfp.so.1 $$libdfp_addr' >> $@
 	@echo

Modified: libdfp/trunk/Makefile.in
==============================================================================
--- libdfp/trunk/Makefile.in (original)
+++ libdfp/trunk/Makefile.in Fri Dec  9 01:11:55 2011
@@ -41,6 +41,12 @@
 SHARED_LINKERNAME_LIB = @PACKAGE_NAME@.so
 
 CC = @CC@
+CXX = @CXX@
+LDD = @LDD@
+OBJDUMP = @OBJDUMP@
+GDB = @GDB@
+CXXFLAGS = @CXXFLAGS@ # This may be naive
+CPPFLAGS = @CPPFLAGS@
 RANLIB = @RANLIB@
 AWK = @AWK@
 LDCONFIG = /sbin/ldconfig
@@ -148,7 +154,9 @@
 # For header files we want to search every directory that is relevant.  We
 # have to include $(top_builddir) in order to pick up the configure generated
 # config.h.
-header_dirs := $(strip include $(backend_headers) $(sysdep_dirs) dfp/ decNumberMath/ ieee754/ base-math/)
+header_dirs := $(strip include $(backend_headers) $(sysdep_dirs) decNumberMath/ ieee754/ base-math/)
+
+system_header_dirs := $(top_srcdir)/dfp/
 
 header_search_dirs := $(header_dirs:%=$(top_srcdir)/%) $(top_srcdir) $(top_builddir)
 
@@ -204,22 +212,29 @@
 WARNS := -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wmissing-format-attribute -Wno-long-long
 C_DEFINES := -D__STDC_DEC_FP__=200704L -D__STDC_WANT_DEC_FP__=1 -DOPTION_EGLIBC_LOCALE_CODE=1 -D_POSIX_C_SOURCE=200809L -std=gnu99 -D_SVID_SOURCE
 ASM_DEFINES := -D__ELF__ -D__ASSEMBLER__ -DASSEMBLER -D__STDC_DEC_FP__=200704L -D__STDC_WANT_DEC_FP__=1 -DOPTION_EGLIBC_LOCALE_CODE=1
+CXX_DEFINES := -D__STDC_DEC_FP__=200704L -D__STDC_WANT_DEC_FP__=1 -DOPTION_EGLIBC_LOCALE_CODE=1 -D_POSIX_C_SOURCE=200809L
+CXX_WARNS := -W -Wall -Wwrite-strings -Wmissing-format-attribute -Wno-long-long
 
 # Build the static object files.
 .c.o:
-	$(CC) $(CFLAGS) $(mzarch) -c $< $(C_DEFINES) $(WARNS) -include $(top_srcdir)/include/libdfp-symbols.h -include $(top_builddir)/config.h $(foreach dir, $(header_search_dirs), -I$(dir)) $(glibc_headers_dir) -o $@
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(mzarch) -c $< $(C_DEFINES) $(WARNS) -include $(top_srcdir)/include/libdfp-symbols.h -include $(top_builddir)/config.h -I$(system_header_dirs) $(foreach dir, $(header_search_dirs), -I$(dir)) $(glibc_headers_dir) -o $@
 	@echo
 .S.o:
-	$(CC) $(CFLAGS) $(ASFLAGS) $(mzarch) -c $< $(ASM_DEFINES) $(WARNS) -include $(top_srcdir)/include/libdfp-symbols.h -include $(top_builddir)/config.h $(foreach dir, $(header_search_dirs), -I$(dir)) $(glibc_headers_dir) -o $@
+	$(CC) $(CFLAGS) $(ASFLAGS) $(mzarch) -c $< $(ASM_DEFINES) $(WARNS) -include $(top_srcdir)/include/libdfp-symbols.h -include $(top_builddir)/config.h -I$(system_header_dirs) $(foreach dir, $(header_search_dirs), -I$(dir)) $(glibc_headers_dir) -o $@
 	@echo
 
 # Build the shared object files.
-#.c.os: $(if $(findstring %, $(libdfp_tests)), $(top_srcdir)/tests/scaffold.c)
 .c.os:
-	$(CC) $(CFLAGS) $(mzarch) -c $< $(C_DEFINES) $(WARNS) -include $(top_srcdir)/include/libdfp-symbols.h -include $(top_builddir)/config.h $(foreach dir, $(header_search_dirs), -I$(dir)) $(glibc_headers_dir) -o $@
-	@echo
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(mzarch) -c $< $(C_DEFINES) $(WARNS) -include $(top_srcdir)/include/libdfp-symbols.h -include $(top_builddir)/config.h -I$(system_header_dirs) $(foreach dir, $(header_search_dirs), -I$(dir)) $(glibc_headers_dir) -o $@
+	@echo
+
 .S.os:
-	$(CC) $(CFLAGS) $(ASFLAGS) $(mzarch) -c $< $(ASM_DEFINES) $(WARNS) -include $(top_srcdir)/include/libdfp-symbols.h -include $(top_builddir)/config.h $(foreach dir, $(header_search_dirs), -I$(dir)) $(glibc_headers_dir) -o $@
+	$(CC) $(CFLAGS) $(ASFLAGS) $(mzarch) -c $< $(ASM_DEFINES) $(WARNS) -include $(top_srcdir)/include/libdfp-symbols.h -include $(top_builddir)/config.h -I$(system_header_dirs) $(foreach dir, $(header_search_dirs), -I$(dir)) $(glibc_headers_dir) -o $@
+	@echo
+
+# C++ compatibility test cases.
+.cpp.os:
+	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(mzarch) -c $< $(CXX_DEFINES) $(CXX_WARNS) -include $(top_srcdir)/include/libdfp-symbols.h -include $(top_builddir)/config.h -I$(system_header_dirs) $(foreach dir, $(header_search_dirs), -I$(dir)) $(glibc_headers_dir) -o $@
 	@echo
 
 # Archive the static library and include all of the .o files from the backend
@@ -233,16 +248,11 @@
 	then $(RANLIB) $@; fi;
 	@echo
 
-# $(AR) rc $@ $(wordlist 2,$(words $?),$?) $(top_builddir)/$(dfp_backend)/*.o
-
 # Create libdfp.so -> libdfp.so.1 symlink.
 $(top_builddir)/$(SHARED_LINKERNAME_LIB): $(top_builddir)/$(SHARED_REALNAME_LIB)
 	@echo "+Creating linker .so symlink $(notdir $@) -> $(notdir $<)"
 	ln -f -s $< $@
 	@echo
-
-# @echo "+Creating linker .so symlink $(notdir $@) -> $(notdir $?)"
-#ln -f -s $? $@
 
 # Create libdfp.so.1 -> libdfp-1.0.1.so symlink.
 # The $(SHARED_SONAME_LIB) -> $(SHARED_REALNAME_LIB) symlink is supposed to
@@ -251,9 +261,6 @@
 	@echo "+Running ldconfig to create the library compat symlink $(notdir $@) -> $(notdir $<)"
 	$(LDCONFIG) -l $(notdir $<)
 	@echo
-
-# @echo "+Running ldconfig to create the library compat symlink $(notdir $@) -> $(notdir $?)"
-# $(LDCONFIG) -l $(notdir $?)
 
 # Build the version tagged 'realname' shared object.  This requires that the
 # $(dfp_name).map file be composed out of individual Versions files.  The
@@ -265,7 +272,7 @@
 	@echo
 
 # The LIBDFP version script support is strongly based upon the GLIBC version
-# script Makefile foo.  Thanks Roland and Uli!
+# script Makefile foo.  Thank you Roland McGrath and Ulrich Drepper!
 
 # Versions.def defines the package versions.
 $(top_builddir)/Versions.all: $(..)scripts/firstversions.awk \
@@ -275,8 +282,6 @@
 	mv -f $@T $@
 	@echo
 
-# @echo +Creating $@ by running $(word 1,$?) against $(word 2,$?).
-#
 # Versions.sysdeps is a concatenation of all of the sysdep directory Versions
 # files (that accompany a Makefile) and run through sed to strip comments.  We
 # use the wildcard function to verify that there actually is a Versions file
@@ -287,8 +292,6 @@
 	sed '/^[        ]*%/!s/#.*$$//;/^[      ]*$$/d;s/^[     ]*%/#/' $^ > $@T
 	mv -f $@T $@
 	@echo
-
-# sed '/^[        ]*%/!s/#.*$$//;/^[      ]*$$/d;s/^[     ]*%/#/' $? > $@T
 
 move-if-change = $(SHELL) $(top_srcdir)/scripts/move-if-change
 
@@ -312,26 +315,44 @@
 $(top_builddir)/libdfp.map: $(top_builddir)/sysd-versions
 
 ifeq ($(glibc_builddir),)
-GLIBC_LIBS := -lc -lm -lpthread
+# We might need -lpthread to test errno in TLS and to test TLS rounding mode
+# or soft-dfp versions of libdfp.
+#GLIBC_LIBS := -lc -lm -lpthread
+GLIBC_LIBS := -lc -lm
 else
-GLIBC_LIBS := $(glibc_builddir)/libc.so $(glibc_builddir)/math/libm.so $(glibc_builddir)/nptl/libpthread.so
-endif
-
-libdfp_tests = test-printf test-param test-amort test-decode test-quantize \
+#GLIBC_LIBS := $(glibc_builddir)/libc.so $(glibc_builddir)/math/libm.so $(glibc_builddir)/nptl/libpthread.so
+GLIBC_LIBS := $(glibc_builddir)/libc.so $(glibc_builddir)/math/libm.so
+endif
+
+libdfp_c_tests = test-printf test-param test-amort test-decode test-quantize \
 	       test-isnan test-isinf test-isfinite test-fpclassify test-logd \
 	       test-log10d test-strtod test-numdigits test-get_digits \
 	       test-round test-bfp-conversions test-stdlib test-wchar \
 	       test-expd
 
+libdfp_cxx_tests = test-ostream
+
+libdfp_tests = $(libdfp_c_tests) $(libdfp_cxx_tests)
+
 # Empty rule which simply makes the libdfp_tests .so's dependent on
 # tests/scaffold.c so that when the scaffold file changes all of the test .so
 # files are rebuilt since almost all of them depend on the scaffold anyway.
 $(addsuffix .os, $(libdfp_tests)): $(top_srcdir)/tests/scaffold.c
 
+# The CPP test rely on the <dfp/decimal> header.  If that changes then they
+# need to be rebuilt.
+$(addsuffix .os, $(libdfp_cxx_tests)): $(top_srcdir)/dfp/decimal $(top_srcdir)/dfp/float.h
+
 # Explicitly link against the uninstalled GLIBC and the Libdfp.so.1 we just
 # built.
-$(libdfp_tests): %:%.os $(top_builddir)/$(SHARED_SONAME_LIB)
+$(libdfp_c_tests): %:%.os $(top_builddir)/$(SHARED_SONAME_LIB)
 	$(CC) $(CFLAGS) $(mzarch) $(GLIBC_LIBS) -L$(top_builddir)/ -ldfp $(top_builddir)/$(addsuffix .os,$@) -o $@
+	@echo
+
+# Explicitly link against the uninstalled GLIBC and the Libdfp.so.1 we just
+# built.
+$(libdfp_cxx_tests): %:%.os $(top_builddir)/$(SHARED_SONAME_LIB)
+	$(CXX) $(CXXFLAGS) $(mzarch) $(GLIBC_LIBS) -L$(top_builddir)/ -ldfp $(top_builddir)/$(addsuffix .os,$@) -o $@
 	@echo
 
 LIBRARY_PATH = $(glibc_builddir)/:$(glibc_builddir)/math:$(glibc_builddir)/elf:$(glibc_builddir)/nptl
@@ -398,4 +419,4 @@
 .SUFFIXES:
 # Prioritize .S over .c when searching for target files.  The .os suffix
 # is used for shared object file and the .o suffix is for static object files.
-.SUFFIXES: .S .c .o .os
+.SUFFIXES: .S .c .cpp .o .os

Modified: libdfp/trunk/README.developer
==============================================================================
--- libdfp/trunk/README.developer (original)
+++ libdfp/trunk/README.developer Fri Dec  9 01:11:55 2011
@@ -291,14 +291,25 @@
 5.1 Configure Switches
 Environment Variables
 
+PATH
+	Set the PATH environment variable.  If this is specified and paths
+	to CC, CXX, OBJDUMP, LDD, and GDB aren't defined, libdfp configure
+	will search in $PATH for these binaries.
+
 CC
-	Select your compiler.
+	[OPTIONAL: Picked up from $PATH if not specified.]
+	Specify the C compiler to use to build libdfp and test cases.
+
+CXX
+	[OPTIONAL: Picked up from $PATH if not specified.]
+	Specify the C++ compiler to use for the Libdfp C++ compatibility
+	tests cases.
 
 CFLAGS="-m64 -O2 -g"
-	Since the default bitness of the compiler's generated binaries varies
-	between Linux distros, and on some architectures the Kernel has a
-	different bitness than the default user env it is recommended that the
-	-m[31|32|64] flags be passed.
+	Since the default bitness of the compiler's generated binaries
+	varies between Linux distros, and on some architectures the Kernel
+	has a different bitness than the default user env it is recommended
+	that the -m[31|32|64] flags be passed.
 
 	These should accompany sympathetic --build switch
 	described below, e.g.
@@ -306,14 +317,32 @@
 		powerpc-linux-gnu for -m32
 		powerpc64-linux-gnu for -m64
 
-	For System Z (s390), depending on the cpu, Libdfp's configure.ac will
-	append a -mzarch flag onto CFLAGS automatically.  This is a special
-	flag required to enable hardware DFP on some System Z cpus.
+	For System Z (s390), depending on the cpu, Libdfp's configure.ac
+	will append a -mzarch flag onto CFLAGS automatically.  This is a
+	special flag required to enable hardware DFP on some System Z cpus.
 
 ASFLAGS
-	Libdfp's Makefile.in will pull -g or -m[31|32|64] into ASFLAGS if it is
-	specified in CFLAGS.  If you need anything else, pass it in here and
-	it'll be added.
+	Libdfp's Makefile.in will pull -g or -m[31|32|64] into ASFLAGS if
+	it is specified in CFLAGS.  If you need anything else, pass it in
+	here and it'll be added.
+
+CXXFLAGS
+	[Only needed for the C++ compatibility test suite.]  This should
+	generally match the CFLAGS (for the most part).
+
+CPPFLAGS
+	Use this to pass specific flags to the C Preprocessor, e.g.,
+	CPPFLAGS="-isystem /opt/at4.0/include/c++/4.5.4/decimal/"
+
+OBJDUMP
+	[OPTIONAL: Picked up from $PATH if not specified.]
+	Specify the objdump binary to use to generate the debug scripts.
+LDD
+	[OPTIONAL: Picked up from $PATH if not specified.]
+	Specify the ldd to use to generate the debug scripts.
+GDB
+	[OPTIONAL: Picked up from $PATH if not specified.]
+	Specify the gdb to use to debug the test cases.
 
 Libdfp's default configure  will be based on whatever bitness the user
 environment is.
@@ -368,8 +397,8 @@
 
 	--prefix=/opt/foo --libdir=/opt/foo/lib64/
 
-	In otherwords, libdir REPLACES the path "<prefix>/lib" on installation
-	it doesn't concatenate onto "<prefix>"
+	In otherwords, libdir REPLACES the path "<prefix>/lib" on
+	installation it doesn't concatenate onto "<prefix>"
 
 --with-glibc-headers=/home/$USER/stage_libdfp/glibc-2.10-headers
 
@@ -379,11 +408,11 @@
 
 	[OPTIONAL]
 
-	If you want to run make check but your system GLIBC isn't version 2.10
-	you need to pass the location of a temporary GLIBC build-dir (not
-	install dir) where that GLIBC meets or exceeds version 2.10.  Not
-	passing this switch tells the make check system to simply use the
-	system GLIBC.
+	If you want to run make check but your system GLIBC isn't version
+	2.10 you need to pass the location of a temporary GLIBC build-dir
+	(not install dir) where that GLIBC meets or exceeds version 2.10.
+	Not passing this switch tells the make check system to simply use
+	the system GLIBC.
 
 	WARNING: Make sure you link to a GLIBC build that supports the same
 	configure options as how you're configuring libdfp, e.g. if you're
@@ -400,78 +429,103 @@
 	infrastructure to choose architecture specific overrides from the
 	sysdeps tree.
 
-Here are some valid configurations of Libdfp:
+Here are some easy-case configurations of libdfp using PATH:
+
+PATH=/opt/at4.0/bin:$PATH \
+  CPPFLAGS="-isystem /opt/at4.0/include/c++/4.5.4/decimal/" \
+  CXXFLAGS="-m32 -O2 -g" CFLAGS="-m32 -O2 -g" \
+  ../libdfp-decimal/configure --with-backend=libdecnumber \
+  --enable-decimal-float=dpd --build=powerpc-linux-gnu \
+  --with-cpu=power6 2>&1 | tee _configure32_power6
+
+PATH=/opt/at4.0/bin:$PATH \
+  CPPFLAGS="-isystem /opt/at4.0/include/c++/4.5.4/decimal/" \
+  CXXFLAGS="-m64 -O2 -g" CFLAGS="-m64 -O2 -g" \
+  ../libdfp-decimal/configure --with-backend=libdecnumber \
+  --enable-decimal-float=dpd --build=powerpc64-linux-gnu \
+  --with-cpu=power6 2>&1 | tee _configure64_power6
+
+Here are some more complicated configurations of libdfp linking an
+alternate GLIBC:
 
 64-bit PowerPC (soft-dfp) using the libdecnumber backend and dpd encoding:
 
 CC=/opt/at4.0/bin/gcc CFLAGS="-m64 -O2 -g" \
-/home/ryanarn/eglibc/eglibc/libdfp/trunk/configure \
-	--with-backend=libdecnumber --enable-decimal-float=dpd \
-	--libdir=/usr/lib64/ \
-	--with-glibc-headers=/home/ryanarn/ppc64-tc-utils/trunk/libdfp/include-2.10/ \
-	--build=powerpc64-linux-gnu \
-	--with-glibc-build=/home/ryanarn/glibc-2.11/build/glibc64_power5 \
-	2>&1 | tee _configure64_power5
-
-64-bit PowerPC POWER6 (hard-dfp) using libdecnumber backend and dpd encoding: We only
-need the --with-cpu=power6 flag for power6 support and hardware-dfp:
+CXX=/opt/at4.0/bin/gcc CXXFLAGS="-m64 -O2 -g" \
+~/eglibc/eglibc/libdfp/trunk/configure \
+  --with-backend=libdecnumber --enable-decimal-float=dpd \
+  --libdir=/usr/lib64/ \
+  --with-glibc-headers=~/ppc64-tc-utils/trunk/libdfp/include-2.10/ \
+  --build=powerpc64-linux-gnu \
+  --with-glibc-build=~/glibc-2.11/build/glibc64_power5 \
+  2>&1 | tee _configure64_power5
+
+64-bit PowerPC POWER6 (hard-dfp) using libdecnumber backend and dpd
+encoding: We only need the --with-cpu=power6 flag for power6 support and
+hardware-dfp:
 
 CC=/opt/at4.0/bin/gcc CFLAGS="-m64 -O2 -g" \
-/home/ryanarn/eglibc/eglibc/libdfp/trunk/configure \
-	--with-backend=libdecnumber --enable-decimal-float=dpd \
-	--libdir=/usr/lib64/ \
-	--with-glibc-headers=/home/ryanarn/ppc64-tc-utils/trunk/libdfp/include-2.10/ \
-	--build=powerpc64-linux-gnu \
-	--with-glibc-build=/home/ryanarn/glibc-2.11/build/glibc64_power6 \
-	--with-cpu=power6 2>&1 | tee _configure64_power6
-
-64-bit PowerPC POWER7 (hard-dfp) using libdecnumber backend and dpd encoding: We only
-need the --with-cpu=power7 flag for power7 support and hardware-dfp:
+CXX=/opt/at4.0/bin/gcc CXXFLAGS="-m64 -O2 -g" \
+~/eglibc/eglibc/libdfp/trunk/configure \
+  --with-backend=libdecnumber --enable-decimal-float=dpd \
+  --libdir=/usr/lib64/ \
+  --with-glibc-headers=~/ppc64-tc-utils/trunk/libdfp/include-2.10/ \
+  --build=powerpc64-linux-gnu \
+  --with-glibc-build=~/glibc-2.11/build/glibc64_power6 \
+  --with-cpu=power6 2>&1 | tee _configure64_power6
+
+64-bit PowerPC POWER7 (hard-dfp) using libdecnumber backend and dpd
+encoding: We only need the --with-cpu=power7 flag for power7 support and
+hardware-dfp:
 
 CC=/opt/at4.0/bin/gcc CFLAGS="-m64 -O2 -g" \
-/home/ryanarn/eglibc/eglibc/libdfp/trunk/configure \
-	--with-backend=libdecnumber --enable-decimal-float=dpd \
-	--libdir=/usr/lib64/ \
-	--with-glibc-headers=/home/ryanarn/ppc64-tc-utils/trunk/libdfp/include-2.10/ \
-	--build=powerpc64-linux-gnu \
-	--with-glibc-build=/home/ryanarn/glibc-2.11/build/glibc64_power7 \
-	--with-cpu=power7 2>&1 | tee _configure64_power7
+CXX=/opt/at4.0/bin/gcc CXXFLAGS="-m64 -O2 -g" \
+~/eglibc/eglibc/libdfp/trunk/configure \
+  --with-backend=libdecnumber --enable-decimal-float=dpd \
+  --libdir=/usr/lib64/ \
+  --with-glibc-headers=~/ppc64-tc-utils/trunk/libdfp/include-2.10/ \
+  --build=powerpc64-linux-gnu \
+  --with-glibc-build=~/glibc-2.11/build/glibc64_power7 \
+  --with-cpu=power7 2>&1 | tee _configure64_power7
 
 32-bit PowerPC (soft-dfp) using the libdecnumber backend and dpd encoding:
 
 CC=/opt/at4.0/bin/gcc CFLAGS="-m32 -O2 -g" \
-/home/ryanarn/eglibc/eglibc/libdfp/trunk/configure \
-	--with-backend=libdecnumber --enable-decimal-float=dpd \
-	--with-glibc-headers=/home/ryanarn/ppc64-tc-utils/trunk/libdfp/include-2.10/ \
-	--build=powerpc-linux-gnu \
-	--with-glibc-build=/home/ryanarn/glibc-2.11/build/glibc32_power5 \
-	2>&1 | tee _configure32_power5
+CXX=/opt/at4.0/bin/gcc CXXFLAGS="-m32 -O2 -g" \
+~/eglibc/eglibc/libdfp/trunk/configure \
+  --with-backend=libdecnumber --enable-decimal-float=dpd \
+  --with-glibc-headers=~/ppc64-tc-utils/trunk/libdfp/include-2.10/ \
+  --build=powerpc-linux-gnu \
+  --with-glibc-build=~/glibc-2.11/build/glibc32_power5 \
+  2>&1 | tee _configure32_power5
 
 Or 32-bit POWER6 (hard-dfp):
 
 CC=/opt/at4.0/bin/gcc CFLAGS="-m32 -O2 -g" \
-/home/ryanarn/eglibc/eglibc/libdfp/trunk/configure \
-	--with-backend=libdecnumber --enable-decimal-float=dpd \
-	--with-glibc-headers=/home/ryanarn/ppc64-tc-utils/trunk/libdfp/include-2.10/ \
-	--build=powerpc-linux-gnu \
-	--with-glibc-build=/home/ryanarn/glibc-2.11/build/glibc32_power6 \
-	--with-cpu=power6 2>&1 | tee _configure32_power6
+CXX=/opt/at4.0/bin/gcc CXXFLAGS="-m32 -O2 -g" \
+~/eglibc/eglibc/libdfp/trunk/configure \
+  --with-backend=libdecnumber --enable-decimal-float=dpd \
+  --with-glibc-headers=~/ppc64-tc-utils/trunk/libdfp/include-2.10/ \
+  --build=powerpc-linux-gnu \
+  --with-glibc-build=~/glibc-2.11/build/glibc32_power6 \
+  --with-cpu=power6 2>&1 | tee _configure32_power6
 
 Or 32-bit POWER7 (hard-dfp):
 
 CC=/opt/at4.0/bin/gcc CFLAGS="-m32 -O2 -g" \
-/home/ryanarn/eglibc/eglibc/libdfp/trunk/configure \
-	--with-backend=libdecnumber --enable-decimal-float=dpd \
-	--with-glibc-headers=/home/ryanarn/ppc64-tc-utils/trunk/libdfp/include-2.10/ \
-	--build=powerpc-linux-gnu \
-	--with-glibc-build=/home/ryanarn/glibc-2.11/build/glibc32_power7 \
-	--with-cpu=power7 2>&1 | tee _configure32_power7
+CXX=/opt/at4.0/bin/gcc CXXFLAGS="-m32 -O2 -g" \
+~/eglibc/eglibc/libdfp/trunk/configure \
+  --with-backend=libdecnumber --enable-decimal-float=dpd \
+  --with-glibc-headers=~/ppc64-tc-utils/trunk/libdfp/include-2.10/ \
+  --build=powerpc-linux-gnu \
+  --with-glibc-build=~/glibc-2.11/build/glibc32_power7 \
+  --with-cpu=power7 2>&1 | tee _configure32_power7
 
 ---------------------------------------------------------------------------
 6. Source Tree Layout
 
-The Libdfp configure script is responsible for building the search order that
-is used by the Make system for selecting files out of the source tree.
+The Libdfp configure script is responsible for building the search order
+that is used by the Make system for selecting files out of the source tree.
 
 The configure script automatically knows how to search for
 	base_machine (e.g. powerpc)
@@ -485,8 +539,8 @@
 	dfpu
 	bits
 
-It hard-searches for the following sysdep directories based upon configuration
-settings:
+It hard-searches for the following sysdep directories based upon
+configuration settings:
 	bid
 	dpd
 	soft-dfp
@@ -501,13 +555,14 @@
 
 	${srcdir}/include.
 
-Anything in these directories should be ABSOLUTELY COMMON since you can't get
-a header earlier than in the ${srcdir}/include directory.  If you need to
-override something in ${srcdir}/include then you may need to move the headers
-out of this directory and into the sysdeps tree.
-
-Header files that are used when building libdfp, but also provided by libdfp
-and installed in the prefix directory are in the following directory:
+Anything in these directories should be ABSOLUTELY COMMON since you can't
+get a header earlier than in the ${srcdir}/include directory.  If you need
+to override something in ${srcdir}/include then you may need to move the
+headers out of this directory and into the sysdeps tree.
+
+Header files that are used when building libdfp, but also provided by
+libdfp and installed in the prefix directory are in the following
+directory:
 
 	${srcdir}/dfp
 

Modified: libdfp/trunk/README.user
==============================================================================
--- libdfp/trunk/README.user (original)
+++ libdfp/trunk/README.user Fri Dec  9 01:11:55 2011
@@ -12,7 +12,7 @@
 
 		Author(s) : Ryan S. Arnold <rsa@xxxxxxxxxx>
 		      Date Created: January 27, 2010
-		      Last Changed: August 12, 2010
+		      Last Changed: December 5, 2011
 
 ---------------------------------------------------------------------------
 Table of Contents:
@@ -27,12 +27,13 @@
 	  3.2  GNU99 Compatibility
 	  3.3  scanf Support
 	  3.4  printf Support
+	    3.4.1 printf "a,A" Conversion Specifier
 	4.  Dependencies
 	  4.1  GNU/Linux OS
 	  4.2  GLIBC Minimum Version
 	  4.3  GCC With --enable-decimal-float Support
 	5.  _Decimal* Data Types
-	  5.1  C++ Interoperability
+	  5.1  C++ decimal[32|64|128] Types Compatibility
 	6.  DFP Headers
 	7.  Compile and Link
 	8.  Unsupported/Non-Standard Additions
@@ -166,15 +167,43 @@
 	%D - for _Decimal64
 	%DD - for _Decimal128
 
-It will recognize the following spec characters:
-
-	%e
-	%f
-	%g
-	%a  (as debuted in TR 24732)
+It will recognize the following conversion specifier 'spec' characters:
+
+	e,E
+	f,F
+	g,G
+	a,A  (as debuted in TR 24732)
 
 Therefore, any combination of DFP length modifiers and spec characters is
 supported.
+
+3.4.1 printf "a,A" Conversion Specifier
+---------------------------------------------------------------------------
+
+The ISO-C DFP specification adds "a/A" as a printf conversion specifier.
+This conversion specifier is unique in that when it is used the precision
+of the output string includes as many of the significant digits in the
+mantissa in the as possible unless there are fewer digits in the mantissa
+than in the specified precision.  Following are some examples to
+demonstrate the use of the a/A conversion specifier.
+
+	printf("Result: %.1HaDF\n", 6543.00DF);
+
+	Result: 7E+3DF
+
+	printf("Result: %.5HaDF\n", 6543.00DF);
+
+	Result: 6543.0DF
+
+	printf("Result: %.4HaDF\n", 6543.00DF);
+
+	Result: 6543DF
+
+	/* Example where the implicit number of digits is less than the
+	 * explicit precision.  */
+	printf("Result: %.8HaDF\n", 6543.00DF);
+
+	Result: 6543.00DF
 
 ---------------------------------------------------------------------------
 4. Dependencies
@@ -228,9 +257,9 @@
 
 	_Decimal64 d64 = 1.0;
 
-
-5.1  C++ Interoperability
----------------------------------------------------------------------------
+5.1  C++ decimal[32|64|128] Types Compatibility
+---------------------------------------------------------------------------
+
 C++ does not natively use the ISO C DFP _Decimal[32|64|128] types.
 
 Per the C++ DFP specification: ISO/IEC JTC1 SC22 WG21 N2732 "Extension for
@@ -247,7 +276,7 @@
 types.
 
 Your compiler may or may not yet have this defined in float.h.  If it is
-not defined you will need to define them yourself before including any dfp
+not defined you  need to define them yourself before including any dfp
 headers, e.g.,
 
 	#ifndef _Decimal32

Modified: libdfp/trunk/TODO
==============================================================================
--- libdfp/trunk/TODO (original)
+++ libdfp/trunk/TODO Fri Dec  9 01:11:55 2011
@@ -1,3 +1,5 @@
+Add testcase to verify soft-dfp TLS version of rounding mode functions.
+
 Add printf_dfp test which change the rounding mode.
 
 [DONE] Configure runtime test for decimal floating point support in compiler.

Modified: libdfp/trunk/configure
==============================================================================
--- libdfp/trunk/configure (original)
+++ libdfp/trunk/configure Fri Dec  9 01:11:55 2011
@@ -276,7 +276,7 @@
 ac_unique_file="printf_dfp.c"
 ac_subdirs_all="$ac_subdirs_all libdecnumber"
 ac_subdirs_all="$ac_subdirs_all libbid"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os enable_decimal_float dfp_backend mzarch with_dfp with_fp base_machine machine CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT OBJDUMP AS ASFLAGS libdfp_cv_cc_with_decimal_float glibc_headers glibc_build enable_static enable_shared picflag submachine submachine_opt sysdep_dirs RANLIB ac_ct_RANLIB AWK subdirs LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os enable_decimal_float dfp_backend mzarch with_dfp with_fp base_machine machine CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX OBJDUMP GDB LDD ASFLAGS libdfp_cv_cc_with_decimal_float glibc_headers glibc_build enable_static enable_shared picflag submachine submachine_opt sysdep_dirs RANLIB ac_ct_RANLIB AWK subdirs LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -733,6 +733,26 @@
 ac_env_CPPFLAGS_value=$CPPFLAGS
 ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
 ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CXX_set=${CXX+set}
+ac_env_CXX_value=$CXX
+ac_cv_env_CXX_set=${CXX+set}
+ac_cv_env_CXX_value=$CXX
+ac_env_CXXFLAGS_set=${CXXFLAGS+set}
+ac_env_CXXFLAGS_value=$CXXFLAGS
+ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set}
+ac_cv_env_CXXFLAGS_value=$CXXFLAGS
+ac_env_OBJDUMP_set=${OBJDUMP+set}
+ac_env_OBJDUMP_value=$OBJDUMP
+ac_cv_env_OBJDUMP_set=${OBJDUMP+set}
+ac_cv_env_OBJDUMP_value=$OBJDUMP
+ac_env_GDB_set=${GDB+set}
+ac_env_GDB_value=$GDB
+ac_cv_env_GDB_set=${GDB+set}
+ac_cv_env_GDB_value=$GDB
+ac_env_LDD_set=${LDD+set}
+ac_env_LDD_value=$LDD
+ac_cv_env_LDD_set=${LDD+set}
+ac_cv_env_LDD_value=$LDD
 
 #
 # Report the --help message.
@@ -847,6 +867,14 @@
               nonstandard directory <lib dir>
   CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
               headers in a nonstandard directory <include dir>
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
+  OBJDUMP     The path to the objdump used by the debug scripts. Defaults to
+              that found in $$PATH
+  GDB         The path to the gdb used by the debug scripts. Defaults to that
+              found in $$PATH
+  LDD         The path to the ldd used by the debug scripts. Defaults to that
+              found in $$PATH
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -1637,10 +1665,6 @@
 
 
 
-# The implication of using AC_PROG_CC is that on a biarch POWER system where
-# the toolchain defaults to 32-bit and the kernel reports a 64-bit environment
-# there is a screwy disconnect between the two.  This is OK as long as we
-# export the computed default cc_msize to the Makefile.in.
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2354,9 +2378,491 @@
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-
-OBJDUMP="$OBJDUMP"
-AS="$AS"
+#AC_PROC_CC checks $PATH for 'gcc' but doesn't prefix $CC with $PATH
+CC=`which $CC`
+echo "CC = $CC"
+
+ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in $CCC g++
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in $CCC g++
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CXX" && break
+done
+test -n "$ac_ct_CXX" || ac_ct_CXX="g++"
+
+  CXX=$ac_ct_CXX
+fi
+
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C++ compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6
+GXX=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+CXXFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cxx_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cxx_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_cxx_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+#AC_PROC_CXX checks $PATH for 'g++' but doesn't prefix $CXX with $PATH
+CXX=`which $CXX`
+echo "CXX = $CXX"
+
+# Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_OBJDUMP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $OBJDUMP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_OBJDUMP="$OBJDUMP" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_OBJDUMP="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  ;;
+esac
+fi
+OBJDUMP=$ac_cv_path_OBJDUMP
+
+if test -n "$OBJDUMP"; then
+  echo "$as_me:$LINENO: result: $OBJDUMP" >&5
+echo "${ECHO_T}$OBJDUMP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
+
+# Extract the first word of "gdb", so it can be a program name with args.
+set dummy gdb; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_GDB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $GDB in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GDB="$GDB" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_GDB="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  ;;
+esac
+fi
+GDB=$ac_cv_path_GDB
+
+if test -n "$GDB"; then
+  echo "$as_me:$LINENO: result: $GDB" >&5
+echo "${ECHO_T}$GDB" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
+
+# Extract the first word of "ldd", so it can be a program name with args.
+set dummy ldd; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_LDD+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $LDD in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_LDD="$LDD" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_LDD="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  ;;
+esac
+fi
+LDD=$ac_cv_path_LDD
+
+if test -n "$LDD"; then
+  echo "$as_me:$LINENO: result: $LDD" >&5
+echo "${ECHO_T}$LDD" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
 
 
 
@@ -3704,8 +4210,12 @@
 s,@ac_ct_CC@,$ac_ct_CC,;t t
 s,@EXEEXT@,$EXEEXT,;t t
 s,@OBJEXT@,$OBJEXT,;t t
+s,@CXX@,$CXX,;t t
+s,@CXXFLAGS@,$CXXFLAGS,;t t
+s,@ac_ct_CXX@,$ac_ct_CXX,;t t
 s,@OBJDUMP@,$OBJDUMP,;t t
-s,@AS@,$AS,;t t
+s,@GDB@,$GDB,;t t
+s,@LDD@,$LDD,;t t
 s,@ASFLAGS@,$ASFLAGS,;t t
 s,@libdfp_cv_cc_with_decimal_float@,$libdfp_cv_cc_with_decimal_float,;t t
 s,@glibc_headers@,$glibc_headers,;t t

Modified: libdfp/trunk/configure.ac
==============================================================================
--- libdfp/trunk/configure.ac (original)
+++ libdfp/trunk/configure.ac Fri Dec  9 01:11:55 2011
@@ -236,18 +236,31 @@
 AC_SUBST(base_machine)
 AC_SUBST(machine)
 
-# The implication of using AC_PROG_CC is that on a biarch POWER system where
-# the toolchain defaults to 32-bit and the kernel reports a 64-bit environment
-# there is a screwy disconnect between the two.  This is OK as long as we
-# export the computed default cc_msize to the Makefile.in.
 AC_PROG_CC(gcc)
-
-OBJDUMP="$OBJDUMP"
-AS="$AS"
-AC_SUBST(OBJDUMP)
-AC_SUBST(AS)
+#AC_PROC_CC checks $PATH for 'gcc' but doesn't prefix $CC with $PATH
+CC=`which $CC`
+echo "CC = $CC"
+
+AC_PROG_CXX(g++)
+#AC_PROC_CXX checks $PATH for 'g++' but doesn't prefix $CXX with $PATH
+CXX=`which $CXX`
+echo "CXX = $CXX"
+
+AC_PATH_PROG([OBJDUMP], [objdump])
+AC_ARG_VAR(OBJDUMP,The path to the objdump used by the debug scripts.
+	   Defaults to that found in $$PATH)
+
+AC_PATH_PROG([GDB], [gdb])
+AC_ARG_VAR(GDB,The path to the gdb used by the debug scripts.
+	   Defaults to that found in $$PATH)
+
+AC_PATH_PROG([LDD], [ldd])
+AC_ARG_VAR(LDD,The path to the ldd used by the debug scripts.
+	   Defaults to that found in $$PATH)
 
 AC_SUBST(CFLAGS)
+AC_SUBST(CXXFLAGS)
+AC_SUBST(CPPFLAGS)
 AC_SUBST(ASFLAGS)
 
 # Don't even bother configuring if the compiler can't handle Decimal

Added: libdfp/trunk/dfp/decimal
==============================================================================
--- libdfp/trunk/dfp/decimal (added)
+++ libdfp/trunk/dfp/decimal Fri Dec  9 01:11:55 2011
@@ -1,0 +1,246 @@
+/* <decimal> for libdfp and redirect to system <decimal>
+
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This file is part of the Decimal Floating Point C Library.
+
+   Author(s): Ryan S. Arnold <rsa@xxxxxxxxxx>
+
+   The Decimal Floating Point C Library is free software; you can
+   redistribute it and/or modify it under the terms of the GNU Lesser
+   General Public License version 2.1.
+
+   The Decimal Floating Point C Library is distributed in the hope that
+   it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+   the GNU Lesser General Public License version 2.1 for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License version 2.1 along with the Decimal Floating Point C Library;
+   if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+   Suite 330, Boston, MA 02111-1307 USA.
+
+   Please see libdfp/COPYING.txt for more information.  */
+
+#ifndef _LIBDFP_DECIMAL_H
+#define _LIBDFP_DECIMAL_H 1
+
+#ifdef _GLIBCXX_DECIMAL_IMPL
+# error "<dfp/decimal> should be included before the system <decimal> header."
+#endif
+
+#ifdef __cplusplus
+
+/* Pick up the system <decimal> */
+#include_next <decimal>
+
+#pragma GCC system_header
+
+using namespace std::decimal;
+
+#include <ostream>
+using std::ostream;
+
+/* Per ISO/IEC JTC1 SC22 WG21 N2732 - TR 24733: "Extension for the programming
+ * language C++ to support decimal floating point arithmetic" define the
+ * ostream and istream operators.  These are included in libdfp and NOT
+ * libstdc++ because the ostream and istream operators rely upon libdfp
+ * printf and strtod[32|64|128] support provided by libdfp.  */
+
+/* Prototypes for functions providing ostream support in libdfp.  */
+
+std::ostream &
+ostream_d32(std::ostream & os, std::decimal::decimal32 &d) __THROW;
+
+std::ostream &
+ostream_d64(std::ostream & os, std::decimal::decimal64 &d) __THROW;
+
+std::ostream &
+ostream_d128(std::ostream & os, std::decimal::decimal128 &d) __THROW;
+
+#include <stdio.h> /* pick up snprintf  */
+
+#include <float.h> /* Pick up _Decimal[32|64|128] typedefs.  */
+
+#include <string>
+using std::string;
+
+#include <iostream>
+using namespace std;
+
+template<unsigned int size>
+struct FIND_DEC_MANT_DIG
+{
+  enum {RESULT = 0};
+  static inline std::string get_fmt(char conv)
+  {
+     std::string spec = "";
+     return spec;
+  }
+};
+
+template <>
+struct FIND_DEC_MANT_DIG<4>
+{
+  enum {RESULT = (__DEC32_MANT_DIG__) };
+  static inline std::string get_fmt(char conv)
+  {
+     std::string spec = "%.*H";
+     return spec.append(1,conv);
+  }
+};
+template <>
+struct FIND_DEC_MANT_DIG<8>
+{
+  enum {RESULT = (__DEC64_MANT_DIG__) };
+  static inline std::string get_fmt(char conv)
+  {
+     std::string spec = "%.*D";
+     return spec.append(1,conv);
+  }
+
+};
+template <>
+struct FIND_DEC_MANT_DIG<16>
+{
+  enum {RESULT = (__DEC128_MANT_DIG__) };
+  static inline std::string get_fmt(char conv)
+  {
+     std::string spec = "%.*DD";
+     return spec.append(1,conv);
+  }
+};
+
+/* Template meta-programming so we only have to write this code once for use
+ * with each of the _Decimal[32|64|128] types.  */
+template<class decimal_type>
+class LIBDFP_META_PRINTF {
+private:
+public:
+  static inline ostream & decimal_to_string(std::ostream &os, decimal_type &d)
+    {
+      char strbuf[64];
+
+      ios_base::fmtflags flags = os.flags();
+      unsigned int precision = os.precision();
+
+      if (precision > DEC_MANT_DIG)
+        precision = DEC_MANT_DIG;
+
+      char conv = 'a';
+
+      if (flags & ios::fixed)
+        {
+          /* Only used for "NAN" and "INF" rather than "nan" and "inf" for
+           * "%.*Df".  */
+          if (flags & ios::uppercase)
+            conv = 'F';
+          else
+            conv = 'f';
+        }
+      else if (flags & ios::scientific)
+       {
+          if (flags & ios::uppercase)
+            conv = 'E';
+          else
+            conv = 'e';
+        }
+      else if (flags & ios::uppercase)
+        conv = 'A';
+
+      std::string fmtstr = FIND_DEC_MANT_DIG<(sizeof(decimal_type))>::get_fmt(conv);
+      sprintf (strbuf, fmtstr.c_str(), precision, d.__getval());
+      os << strbuf;
+      return os;
+    }
+
+  enum {DEC_MANT_DIG = FIND_DEC_MANT_DIG<(sizeof(decimal_type))>::RESULT};
+};
+
+namespace std
+{
+namespace decimal
+{
+//  ISO/IEC TR 27433 - 3.2.11 Formatted input:
+//  template <class charT, class traits>
+//    std::basic_istream<charT, traits> &
+//      operator>>(std::basic_istream<charT, traits> & is, decimal32 & d);
+
+//  template <class charT, class traits>
+//    std::basic_istream<charT, traits> &
+//      operator>>(std::basic_istream<charT, traits> & is, decimal64 & d);
+
+//  template <class charT, class traits>
+//    std::basic_istream<charT, traits> &
+//      operator>>(std::basic_istream<charT, traits> & is, decimal128 & d);
+
+
+  //ISO/IEC TR 24733 - 3.2.11 Formatted output:
+
+  /* ISO/IEC TR 24733 doesn't have an equivalent to the 'a/A' conversion
+   * specifier in ISO/IEC TR 24732.  This ostream implementation can take one
+   * of two approaches.  It can either use 'a/A' by default or it can allow
+   * the user to select f/F or e/E.  It'd be nice to override  */
+
+
+  template <class charT, class traits>
+  inline std::basic_ostream<charT, traits> &
+    operator<<(std::basic_ostream<charT, traits> & os, decimal32 d)
+    {
+
+      /*   1  (leading zero)
+       * + 1  (.)
+       * + 7 (__DEC32_MANT_DIG__)
+       * + 1  (e)
+       * + 1  (+/-)
+       * + 2  (digits in __DEC32_MAX_EXP__)
+       * + 1  "\n"
+       * = 14 -> round up to a power of 2 = 16.  */
+      LIBDFP_META_PRINTF<std::decimal::decimal32>::decimal_to_string(os, d);
+      return os;
+    }
+
+  template <class charT, class traits>
+  inline std::basic_ostream<charT, traits> &
+    operator<<(std::basic_ostream<charT, traits> & os, decimal64 d)
+    {
+      /*   1  (leading zero)
+       * + 1  (.)
+       * + 16 (__DEC64_MANT_DIG__)
+       * + 1  (e)
+       * + 1  (+/-)
+       * + 3  (digits in __DEC64_MAX_EXP__)
+       * + 1  "\n"
+       * = 24 -> round up to a power of 2 = 32.  */
+
+      LIBDFP_META_PRINTF<std::decimal::decimal64>::decimal_to_string(os, d);
+      return os;
+    }
+
+  /*  */
+  template <class charT, class traits>
+  inline std::basic_ostream<charT, traits> &
+    operator<<(std::basic_ostream<charT, traits> & os, decimal128 d)
+    {
+
+      return ostream_d128(os, d);
+      /*   1  (leading zero)
+       * + 1  (.)
+       * + 34 (__DEC128_MANT_DIG__)
+       * + 1  (e)
+       * + 1  (+/-)
+       * + 4  (digits in __DEC128_MAX_EXP__)
+       * + 1  "\n"
+       * = 43 -> round up to a power of 2 = 64.  */
+      LIBDFP_META_PRINTF<std::decimal::decimal128>::decimal_to_string(os, d);
+      return os;
+    }
+
+} /* namespace decimal  */
+} /* namespace std  */
+
+#else
+# warning "<dfp/decimal> should only be included by C++ programs."
+#endif /* __cplusplus  */
+
+#endif /* _LIBDFP_DECIMAL_H  */

Added: libdfp/trunk/dfp/float.h
==============================================================================
--- libdfp/trunk/dfp/float.h (added)
+++ libdfp/trunk/dfp/float.h Fri Dec  9 01:11:55 2011
@@ -1,0 +1,53 @@
+/* <float.h> for libdfp and redirect to system <float.h>
+
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This file is part of the Decimal Floating Point C Library.
+
+   Author(s): Ryan S. Arnold <rsa@xxxxxxxxxx>
+
+   The Decimal Floating Point C Library is free software; you can
+   redistribute it and/or modify it under the terms of the GNU Lesser
+   General Public License version 2.1.
+
+   The Decimal Floating Point C Library is distributed in the hope that
+   it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+   the GNU Lesser General Public License version 2.1 for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License version 2.1 along with the Decimal Floating Point C Library;
+   if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+   Suite 330, Boston, MA 02111-1307 USA.
+
+   Please see libdfp/COPYING.txt for more information.  */
+
+/* This uses a bit of circular including in order to get std::decimal defined.
+ * without error such that we can typedef _Decimal types to decimal types.  */
+#ifndef _LIBDFP_FLOAT_H
+#define _LIBDFP_FLOAT_H 1
+#include_next <float.h>
+
+#pragma GCC system_header
+
+#ifdef __cplusplus
+
+/* If _Decimal64 is defined we don't need to do any of this.  */
+#ifndef _Decimal64
+
+/* Predeclare the decimal classes so we can typedef without errors.  */
+namespace std { namespace decimal { class decimal32; }; };
+namespace std { namespace decimal { class decimal64; }; };
+namespace std { namespace decimal { class decimal128; }; };
+
+/* Per ISO/IEC TR 24733 the following typedefs SHOULD be defined in float.h
+ * but depending on the compiler version they may NOT be, so we'll define them
+ * as a service if they are not defined in the system float.h.  */
+
+typedef std::decimal::decimal32  _Decimal32;
+typedef std::decimal::decimal64  _Decimal64;
+typedef std::decimal::decimal128 _Decimal128;
+
+#endif /* _Decimal64  */
+#endif /* __cplusplus  */
+#endif /* _LIBDFP_FLOAT_H  */

Modified: libdfp/trunk/dfp/stdlib.h
==============================================================================
--- libdfp/trunk/dfp/stdlib.h (original)
+++ libdfp/trunk/dfp/stdlib.h Fri Dec  9 01:11:55 2011
@@ -52,7 +52,7 @@
 
 #endif /* __STDC_WANT_DEC_FP__  */
 
-/* Pick up the system fenv.h.  */
+/* Pick up the system stdlib.h.  */
 #include_next <stdlib.h>
 
 #endif /* _DFP_STDLIB_H  */

Modified: libdfp/trunk/ieee754r/lgammad32.c
==============================================================================
--- libdfp/trunk/ieee754r/lgammad32.c (original)
+++ libdfp/trunk/ieee754r/lgammad32.c Fri Dec  9 01:11:55 2011
@@ -31,7 +31,7 @@
 
 #include <decContext.h>
 #include <decNumber.h>
-#include <dfp/math.h>
+#include <math.h>
 #include <float.h>
 #include <errno.h>
 

Modified: libdfp/trunk/printf_dfp.c
==============================================================================
--- libdfp/trunk/printf_dfp.c (original)
+++ libdfp/trunk/printf_dfp.c Fri Dec  9 01:11:55 2011
@@ -538,8 +538,8 @@
     {
       case 'a':
 	  {
-	    /* This is totally bogus but the DFP spec addition for %a refers to
-	     * all of the significant digits in the precision.  */
+	    /* The DFP spec addition for %a refers to all of the significant
+	     * digits in the precision.  */
 	    if (exp < 0)
 	      {
 		  input_prec = nd;

Added: libdfp/trunk/tests/test-ostream.cpp
==============================================================================
--- libdfp/trunk/tests/test-ostream.cpp (added)
+++ libdfp/trunk/tests/test-ostream.cpp Fri Dec  9 01:11:55 2011
@@ -1,0 +1,86 @@
+/* Test the ostream operator in the cpp compatibility header <dfp/decimal>.
+
+   Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This file is part of the Decimal Floating Point C Library.
+
+   Author(s): Ryan S. Arnold <rsa@xxxxxxxxxx>
+
+   The Decimal Floating Point C Library is free software; you can
+   redistribute it and/or modify it under the terms of the GNU Lesser
+   General Public License version 2.1.
+
+   The Decimal Floating Point C Library is distributed in the hope that
+   it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+   the GNU Lesser General Public License version 2.1 for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License version 2.1 along with the Decimal Floating Point C Library;
+   if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+   Suite 330, Boston, MA 02111-1307 USA.
+
+   Please see libdfp/COPYING.txt for more information.  */
+
+#ifndef __STDC_WANT_DEC_FP__
+#define __STDC_WANT_DEC_FP__
+#endif
+
+/* This is a CPP compatibility testcase.  Pick up the _Decimal[32|64|128]
+ * definitions.  */
+#include <float.h>
+
+#include <decimal>
+
+#include <iomanip>
+
+/* For cout support.  */
+#include <iostream>
+
+using namespace std;
+using namespace std::decimal;
+
+//#define _WANT_PC 1 /* Pick up the _PC(x,y,...) macro.  */
+//#include "scaffold.c"
+
+/* Inspired by GLIBC stdio-common/tfformat.c  */
+typedef struct{
+  int line;
+  decimal32 d;
+  const char *expect;
+} d32_type;
+
+d32_type printf_d32s[] =
+{
+  {__LINE__, 123.456E-9DF, "1.23456e-7" },
+  {__LINE__, 123.DF, "123" },
+  {0,0,0}
+};
+
+int main(void)
+{
+  decimal32 d32 = 0.0000006E-90DF;
+  decimal64 d64 = -9.999E-3DD;
+  decimal128 d128 = -1234.56789123456789123455678DL;
+//  cout << d32 << "DF" << endl;
+//  cout << setprecision(__DEC64_MANT_DIG__) << d64 << "DD" << endl;
+//  cout << setprecision(4) << d128 << "DL" << endl;
+// cout << "**************" << endl;
+  cout << d32 << "DF" << endl;
+  cout << d64 << "DD" << endl;
+  cout.flags(ios::scientific);
+  cout << d64 << "DD" << endl;
+  //cout.flags(ios::scientific | ios::uppercase);
+  cout.flags(ios::scientific | ios::uppercase);
+  cout << d64 << "DD" << endl;
+  cout << d64 << "DD" << endl;
+  cout.flags();
+  cout.flags(ios::fixed);
+  cout << d64 << "DD" << endl;
+  d64 = (decimal64) __builtin_infd64();
+  cout.flags(ios::fixed | ios::uppercase);
+  cout << d64 << "DD" << endl;
+  cout.flags(ios::fixed);
+  cout << d64 << "DD" << endl;
+  return 0;
+}

Modified: libdfp/trunk/tests/test-printf.c
==============================================================================
--- libdfp/trunk/tests/test-printf.c (original)
+++ libdfp/trunk/tests/test-printf.c Fri Dec  9 01:11:55 2011
@@ -116,6 +116,8 @@
   {__LINE__, 123.456E-9DF, "1.23456e-7", "%Ha"},
   {__LINE__, 0.00000E-101DF, "0.000000e+00", "%He"},
 
+  /* Erroneously prints "1e+6" due to the '.' with no explicit precision.  */
+  {__LINE__, 6.0E5DF, "6e+5", "%.Ha"},
 
   {__LINE__, 0.0e10DF, "0.000000e+00", "%He"},
   {__LINE__, 0.0e10DF, "0.000000", "%Hf"},
@@ -337,6 +339,9 @@
   {__LINE__, 6.5DD, "6e+00", "%.0De"},
   {__LINE__, 6.6DD, "7e+00", "%.0De"},
 
+  /* Erroneously prints "1e+6" due to the '.' with no explicit precision.  */
+  {__LINE__, 6.0E5DD, "6e+5", "%.Da"},
+
   {__LINE__, 123.456E-9DD, "1.23456e-7", "%Da"},
   {__LINE__, 0.00000E-101DD, "0.000000e+00", "%De"},
 
@@ -558,6 +563,9 @@
   {__LINE__, 6.5DL, "6e+00", "%.0DDe"},
   {__LINE__, 6.6DL, "7e+00", "%.0DDe"},
 
+  /* Erroneously prints "1e+6" due to the '.' with no explicit precision.  */
+  {__LINE__, 6.0E5DL, "6e+5", "%.DDa"},
+
   {__LINE__, 123.456E-9DL, "1.23456e-7", "%DDa"},
   {__LINE__, 0.00000E-101DL, "0.000000e+00", "%DDe"},
 

_______________________________________________
Commits mailing list
Commits@xxxxxxxxxx
http://eglibc.org/cgi-bin/mailman/listinfo/commits