diff options
author | obrien <obrien@FreeBSD.org> | 2000-01-16 10:01:07 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2000-01-16 10:01:07 +0000 |
commit | 23ef7a8bc955202c448999809e972fd1fef3ec32 (patch) | |
tree | 5fcfca9f31719366c6989a72e2bc7e8df2a853fa /contrib/bc | |
parent | fae56b48f4647ca03d9d87e5aa9b399155b5b576 (diff) | |
parent | 9657c835ffcf45e0a6d46f291505b0b112f8a244 (diff) | |
download | FreeBSD-src-23ef7a8bc955202c448999809e972fd1fef3ec32.zip FreeBSD-src-23ef7a8bc955202c448999809e972fd1fef3ec32.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r56101,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/bc')
-rw-r--r-- | contrib/bc/ChangeLog | 129 | ||||
-rw-r--r-- | contrib/bc/Makefile.in | 156 | ||||
-rw-r--r-- | contrib/bc/NEWS | 24 | ||||
-rwxr-xr-x | contrib/bc/Test/timetest | 2 | ||||
-rw-r--r-- | contrib/bc/aclocal.m4 | 59 | ||||
-rw-r--r-- | contrib/bc/bc/Makefile.am | 2 | ||||
-rw-r--r-- | contrib/bc/bc/Makefile.in | 116 | ||||
-rw-r--r-- | contrib/bc/config.h.in | 3 | ||||
-rwxr-xr-x | contrib/bc/configure | 556 | ||||
-rw-r--r-- | contrib/bc/configure.in | 72 | ||||
-rw-r--r-- | contrib/bc/dc/Makefile.in | 110 | ||||
-rw-r--r-- | contrib/bc/dc/array.c | 47 | ||||
-rw-r--r-- | contrib/bc/dc/dc-proto.h | 18 | ||||
-rw-r--r-- | contrib/bc/dc/dc.c | 28 | ||||
-rw-r--r-- | contrib/bc/dc/dc.h | 5 | ||||
-rw-r--r-- | contrib/bc/dc/eval.c | 93 | ||||
-rw-r--r-- | contrib/bc/dc/misc.c | 12 | ||||
-rw-r--r-- | contrib/bc/dc/numeric.c | 95 | ||||
-rw-r--r-- | contrib/bc/dc/stack.c | 46 | ||||
-rw-r--r-- | contrib/bc/dc/string.c | 12 | ||||
-rw-r--r-- | contrib/bc/doc/Makefile.in | 201 | ||||
-rw-r--r-- | contrib/bc/doc/dc.texi | 86 | ||||
-rw-r--r-- | contrib/bc/h/bcdefs.h | 2 | ||||
-rw-r--r-- | contrib/bc/h/version.h | 11 | ||||
-rw-r--r-- | contrib/bc/lib/Makefile.in | 96 | ||||
-rw-r--r-- | contrib/bc/lib/number.c | 15 |
26 files changed, 1326 insertions, 670 deletions
diff --git a/contrib/bc/ChangeLog b/contrib/bc/ChangeLog index 24898b1..ca010b8 100644 --- a/contrib/bc/ChangeLog +++ b/contrib/bc/ChangeLog @@ -1,3 +1,132 @@ +Fri Apr 17 10:40:59 1998 Phil Nelson <phil@cs.wwu.edu> + + * bc/main.c: Enable readline only if interactive. + +Thu Apr 16 16:49:22 1998 Phil Nelson <phil@cs.wwu.edu> + + * bc/configure.in: Tweeking of AM_PROG_LEX and associated + special case goo for solaris. + +Sat Mar 28 21:43:18 1998 Phil Nelson <phil@cs.wwu.edu> + + * bc/Makefile.am: Added "YFLAGS = -d" to get bc.h to build properly. + +Mon Mar 9 12:54:42 PST 1998 Ken Pizzini <ken@halcyon.com> + + * doc/dc.texi, doc/dc.1: correct some documentation bugs. + +Sun Mar 8 23:56:24 PST 1998 Ken Pizzini <ken@halcyon.com> + + * dc/numeric.c: eliminate superfluous variable from dc_dump_num(); + annotate unused parameters in dc_add() and dc_sub(). + + * h/version.h: change dc version number to 1.2 for release. + +Sun Mar 8 21:13:50 1998 Phil Nelson <phil@cs.wwu.edu> + + * bc/main.c: Applied patch from Ken Pizzini to force line + mode buffering on stdout. + +Tue Jan 6 09:15:04 PST 1998 Ken Pizzini <ken@halcyon.com> + + * h/version.h: dc is now up to version 1.1.5. + + * dc/eval.c, dc/numeric.c, doc/dc.texi, doc/dc.1: once again + changed the behavior of the 'P' command with a numeric argument + to make it more general. It now dumps out the *whole* number + (or rather, the whole of its positive integer portion) as a + byte stream. (For small values this is still the same as 'aP'.) + + * dc/dc-proto.h, dc/dc.h, dc/eval.c, dc/misc.c, dc/numeric.c, + dc/stack.c, dc/string.c: Changed most uses of dc_boolean to + either dc_discard or dc_newline, and instances of DC_TRUE and + DC_FALSE to appropriate instances of DC_TOSS, DC_KEEP, DC_NONL, + or DC_WITHNL so that the code self-documents a little better. + +Sun Jan 4 15:39:46 PST 1998 Ken Pizzini <ken@halcyon.com> + + * dc/eval.c, doc/dc.texi, doc/dc.1: Changed the functionality + of the 'P' command, and added the 'n' command. Due to + a quirk of the implementation of traditional dc, some + people have come to expect that the 'P' command on a + numeric argument in the range of 1 to 99 should output + the corresponding character, despite the fact that this + usage can have very weird results for numbers outside + that range. This functionality is why the 'a' command + was introduced last March, but people really want it to + "just work" without needing to use the 'a' command. + Bowing to this demand, the 'P' command now does the + equivalent of "aP" if the argument is numeric, and the + 'n' command has been added to support the previous + functionality of the 'P' command. + + * dc/misc.c, dc/eval.c, dc/stack.c, dc/dc-proto.h: + Changed prototype for dc_print(). It now additionally + takes two flags, newline_p and discard_p, which it + passes through to dc_out_num() and dc_out_str() as + needed. + + * h/version.h: dc is now up to version 1.1.4. + +Sat Sep 27 13:48:53 1997 Ken Pizzini <ken@halcyon.com> + + * h/version.h: dc is now up to version 1.1.3. + + * dc/stack.c, dc/array.c, dc/dc-proto.h, doc/dc.texi, doc/dc.1: + It has come to my attention that, though undocumented, + traditional dc stacked its arrays in parallel with the + stacking of simple registers. I have now duplicated + this functionality. + + * dc/dc.c, configure.in: line-buffer dc's output if setvbuf() + is supported. This was requested to simplify using dc as + an inferior process under emacs. + +Fri Sep 26 19:56:15 1997 Ken Pizzini <ken@halcyon.com> + + * dc/dc.c: fixed bug reporting address for --help. + + * doc/dc.1, doc/dc.texi: corrected documentation of the maximum + admissible input base. + + * doc/dc.texi: corrected sample code equivalence for the | command. + + * lib/number.c: added a warning for non-zero scale in the base + for bc_raisemod(). + +Fri Sep 26 18:15:31 1997 Ken Pizzini <ken@halcyon.com> + + * dc/eval.c, doc/dc.1, doc/dc.texi: added !=, !<, and !> commands. + + * dc/eval.c: eliminated double-free in 'a' command. + + * dc/dc.c: changed placment of check for filename "-" so that + "-f -" will work. + + * h/version.h: updated dc version to 1.1.2. + +Thu Sep 18 17:41:10 1997 Ken Pizzini <ken@halcyon.com> + + * dc/eval.c: fixed off-by-one error for Q and q commands. + + * dc/dc.c: added missing f: to third argument of getopt(). + + * h/version.h: updated dc version to 1.1.1. + +Thu May 22 08:24:08 1997 Phil Nelson <phil@cs.wwu.edu> + + * lib/number.c(bc_sqrt): Fixed a bug that computed 0 for sqrt + of most numbers less than .000001. + +Thu May 1 10:41:38 1997 Phil Nelson <phil@cs.wwu.edu> + + * Test/timetest: change path to bc executable. + +Wed Apr 30 12:00:00 1997 Phil Nelson <phil@cs.wwu.edu> + + * Froze bc-1.04, started new directory for bc-1.05. + Fixes to bc-1.04 will be distributed as bc-1.05. + Mon Apr 21 14:57:14 1997 Phil Nelson <phil@cs.wwu.edu> * bc/scan.l: Changed rules for single line comment to work diff --git a/contrib/bc/Makefile.in b/contrib/bc/Makefile.in index 9a4e207..0f7ae3f 100644 --- a/contrib/bc/Makefile.in +++ b/contrib/bc/Makefile.in @@ -1,8 +1,14 @@ -# Makefile.in generated automatically by automake 1.1n from Makefile.am +# Makefile.in generated automatically by automake 1.3 from Makefile.am -# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. +# 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 = /bin/sh @@ -26,6 +32,8 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include +DISTDIR = + pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -43,14 +51,15 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ -NORMAL_INSTALL = true -PRE_INSTALL = true -POST_INSTALL = true -NORMAL_UNINSTALL = true -PRE_UNINSTALL = true -POST_UNINSTALL = true +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : CC = @CC@ LEX = @LEX@ +MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ VERSION = @VERSION@ @@ -58,8 +67,6 @@ YACC = @YACC@ SUBDIRS = lib bc dc doc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -CONFIG_HEADER_IN = config.h.in -CONFIG_HEADER_FULL = config.h mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = @@ -72,41 +79,42 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP = --best -default: all +all: all-recursive-am all-am .SUFFIXES: -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status -$(srcdir)/aclocal.m4: configure.in +$(ACLOCAL_M4): configure.in cd $(srcdir) && $(ACLOCAL) -config.status: configure +config.status: $(srcdir)/configure $(SHELL) ./config.status --recheck -$(srcdir)/configure: configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) -$(CONFIG_HEADER): stamp-h -stamp-h: $(CONFIG_HEADER_IN) $(top_builddir)/config.status +config.h: stamp-h + @: +stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status cd $(top_builddir) \ - && CONFIG_FILES= CONFIG_HEADERS=$(CONFIG_HEADER_FULL) \ + && CONFIG_FILES= CONFIG_HEADERS=config.h \ $(SHELL) ./config.status @echo timestamp > stamp-h -$(srcdir)/$(CONFIG_HEADER_IN): stamp-h.in +$(srcdir)/config.h.in: $(srcdir)/stamp-h.in $(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h cd $(top_srcdir) && $(AUTOHEADER) - echo timestamp > $(srcdir)/stamp-h.in + @echo timestamp > $(srcdir)/stamp-h.in mostlyclean-hdr: clean-hdr: distclean-hdr: - rm -f $(CONFIG_HEADER) + -rm -f config.h maintainer-clean-hdr: @@ -121,14 +129,26 @@ maintainer-clean-hdr: all-recursive install-data-recursive install-exec-recursive \ installdirs-recursive install-recursive uninstall-recursive \ -check-recursive installcheck-recursive info-recursive dvi-recursive \ +check-recursive installcheck-recursive info-recursive dvi-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + target=`echo $@ | sed s/-recursive//`; \ + echo "Making $$target in $$subdir"; \ + (cd $$subdir && $(MAKE) $$target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" + mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: - @for subdir in $(SUBDIRS); do \ + @set fnord $(MAKEFLAGS); amf=$$2; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ + done; \ + for subdir in $$rev; do \ target=`echo $@ | sed s/-recursive//`; \ echo "Making $$target in $$subdir"; \ (cd $$subdir && $(MAKE) $$target) \ - || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -137,33 +157,40 @@ tags-recursive: tags: TAGS -ID: $(HEADERS) $(SOURCES) - here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS) +ID: $(HEADERS) $(SOURCES) $(LISP) + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) -TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ done; \ - test -z "$(ETAGS_ARGS)config.h.in$(SOURCES)$(HEADERS)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $(SOURCES) $(HEADERS) -o $$here/TAGS) + 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)config.h.in$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS) mostlyclean-tags: clean-tags: distclean-tags: - rm -f TAGS ID + -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) + -rm -rf $(distdir) GZIP=$(GZIP) $(TAR) zxf $(distdir).tar.gz mkdir $(distdir)/=build mkdir $(distdir)/=inst @@ -176,43 +203,43 @@ distcheck: dist && $(MAKE) install \ && $(MAKE) installcheck \ && $(MAKE) dist - rm -rf $(distdir) + -rm -rf $(distdir) @echo "========================"; \ echo "$(distdir).tar.gz is ready for distribution"; \ echo "========================" dist: distdir -chmod -R a+r $(distdir) GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir) - rm -rf $(distdir) + -rm -rf $(distdir) dist-all: distdir -chmod -R a+r $(distdir) GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir) - rm -rf $(distdir) + -rm -rf $(distdir) distdir: $(DISTFILES) - rm -rf $(distdir) + -rm -rf $(distdir) mkdir $(distdir) - -chmod 755 $(distdir) + -chmod 777 $(distdir) @for file in $(DISTFILES); do \ d=$(srcdir); \ test -f $(distdir)/$$file \ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file; \ done - for subdir in $(SUBDIRS); do \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - chmod 755 $(distdir)/$$subdir; \ - (cd $$subdir && $(MAKE) distdir=../$(distdir)/$$subdir distdir) \ + for subdir in $(SUBDIRS); do \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ || exit 1; \ done - $(MAKE) distdir="$(distdir)" dist-hook + $(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-hook info: info-recursive dvi: dvi-recursive check: all-am $(MAKE) check-recursive installcheck: installcheck-recursive -all-recursive-am: $(CONFIG_HEADER) +all-recursive-am: config.h $(MAKE) all-recursive all-am: Makefile config.h @@ -228,27 +255,25 @@ install: install-recursive uninstall: uninstall-recursive -all: all-recursive-am all-am - install-strip: - $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install installdirs: installdirs-recursive mostlyclean-generic: - test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) clean-generic: - test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - rm -f Makefile $(DISTCLEANFILES) - rm -f config.cache config.log stamp-h - test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -rm -f Makefile $(DISTCLEANFILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: - test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) - test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic clean-am: clean-hdr clean-tags clean-generic mostlyclean-am @@ -263,19 +288,18 @@ mostlyclean: mostlyclean-recursive mostlyclean-am clean: clean-recursive clean-am distclean: distclean-recursive distclean-am - rm -f config.status + -rm -f config.status maintainer-clean: maintainer-clean-recursive maintainer-clean-am @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." - rm -f config.status - -.PHONY: default mostlyclean-hdr distclean-hdr clean-hdr \ -maintainer-clean-hdr install-data-recursive uninstall-data-recursive \ -install-exec-recursive uninstall-exec-recursive installdirs-recursive \ -uninstalldirs-recursive all-recursive check-recursive \ -installcheck-recursive info-recursive dvi-recursive \ -mostlyclean-recursive distclean-recursive clean-recursive \ + -rm -f config.status + +.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ +install-data-recursive uninstall-data-recursive install-exec-recursive \ +uninstall-exec-recursive installdirs-recursive uninstalldirs-recursive \ +all-recursive check-recursive installcheck-recursive info-recursive \ +dvi-recursive mostlyclean-recursive distclean-recursive clean-recursive \ maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ distclean-tags clean-tags maintainer-clean-tags distdir info dvi \ installcheck all-recursive-am all-am install-exec install-data install \ diff --git a/contrib/bc/NEWS b/contrib/bc/NEWS index aae74d1..105795d 100644 --- a/contrib/bc/NEWS +++ b/contrib/bc/NEWS @@ -1,4 +1,26 @@ -This is GNU bc version 1.04. (And dc version 1.0.4) +This is GNU bc version 1.05. (And dc version 1.2) + +Changes in dc from 1.1 to 1.2: + added !< != !> commands + arrays now stack + output is now line buffered, provided setvbuf() is available + fixed known bugs in 'q', 'Q', 'a' commands, '-f' command-line option, + and documentation + changed the 'P' command's behavior on a numeric argument: + due to popular demand it now does the equivalent of 'aP' + (for small values) + added new 'n' command to do what the old 'P' command did + +Changes in bc from 1.04 to 1.05: + Solaris makes work better. + bug fixes + stdout now always does line buffering. + sqrt bug fixed for small numbers. + readline (if support is compiled in) is enabled only for + interactive executions of bc. + + +This is GNU bc version 1.04. (And dc version 1.1) Changes from 1.03 diff --git a/contrib/bc/Test/timetest b/contrib/bc/Test/timetest index 90da6ab..792c591 100755 --- a/contrib/bc/Test/timetest +++ b/contrib/bc/Test/timetest @@ -2,7 +2,7 @@ # # Time the functions. # -BC=../bc +BC=../bc/bc SYSBC=/usr/bin/bc for file in exp.b ln.b sine.b atan.b jn.b mul.b div.b raise.b sqrt.b do diff --git a/contrib/bc/aclocal.m4 b/contrib/bc/aclocal.m4 index 16cedb1..8c0d9c0 100644 --- a/contrib/bc/aclocal.m4 +++ b/contrib/bc/aclocal.m4 @@ -1,4 +1,14 @@ -dnl aclocal.m4 generated automatically by aclocal 1.1n +dnl aclocal.m4 generated automatically by aclocal 1.3 + +dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +dnl This Makefile.in 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. # Do all the work for Automake. This macro actually does too much -- # some checks are only needed if your package does certain things. @@ -15,11 +25,15 @@ 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") AC_DEFINE_UNQUOTED(VERSION, "$VERSION")) -AM_SANITY_CHECK -AC_ARG_PROGRAM +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) @@ -27,7 +41,7 @@ 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_PROG_MAKE_SET]) +AC_REQUIRE([AC_PROG_MAKE_SET])]) # serial 1 @@ -54,10 +68,21 @@ echo timestamp > conftestfile # directory). if ( set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "$@" = "X"; then + 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 @@ -76,7 +101,8 @@ 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. -if ($2 --version) > /dev/null 2>&1; then +# 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 @@ -95,6 +121,25 @@ dnl This file resides in the same directory as the config header dnl that is generated. We must strip everything past the first ":", dnl and everything past the last "/". AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl -test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl +ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, +<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, +<<am_indx=1 +for am_file in <<$1>>; do + case " <<$>>CONFIG_HEADERS " in + *" <<$>>am_file "*<<)>> + echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "<<$>>am_indx" + 1` +done<<>>dnl>>) changequote([,]))]) + +dnl AM_PROG_LEX +dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT +AC_DEFUN(AM_PROG_LEX, +[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1) +AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex") +AC_PROG_LEX +AC_DECL_YYTEXT]) + diff --git a/contrib/bc/bc/Makefile.am b/contrib/bc/bc/Makefile.am index 82223d8..d02daf0 100644 --- a/contrib/bc/bc/Makefile.am +++ b/contrib/bc/bc/Makefile.am @@ -14,6 +14,8 @@ datadir = $(prefix)/@DATADIRNAME@ INCLUDES = -I$(srcdir) -I$(srcdir)/../h LDADD = ../lib/libbc.a @LEXLIB@ +YFLAGS = -d + $(PROGRAMS): $(LDADD) scan.o: bc.h diff --git a/contrib/bc/bc/Makefile.in b/contrib/bc/bc/Makefile.in index f673c0d..2398cb0 100644 --- a/contrib/bc/bc/Makefile.in +++ b/contrib/bc/bc/Makefile.in @@ -1,8 +1,14 @@ -# Makefile.in generated automatically by automake 1.1n from Makefile.am +# Makefile.in generated automatically by automake 1.3 from Makefile.am -# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. +# 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 = /bin/sh @@ -25,6 +31,8 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include +DISTDIR = + pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -42,14 +50,15 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ -NORMAL_INSTALL = true -PRE_INSTALL = true -POST_INSTALL = true -NORMAL_UNINSTALL = true -PRE_UNINSTALL = true -POST_UNINSTALL = true +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : CC = @CC@ LEX = @LEX@ +MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ VERSION = @VERSION@ @@ -70,6 +79,8 @@ datadir = $(prefix)/@DATADIRNAME@ INCLUDES = -I$(srcdir) -I$(srcdir)/../h LDADD = ../lib/libbc.a @LEXLIB@ +YFLAGS = -d + fbcOBJ = main.o bc.o scan.o execute.o global.o load.o storage.o util.o sbcOBJ = main.o sbc.o scan.o execute.o global.o load.o storage.o util.o @@ -92,7 +103,7 @@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LEXLIB = @LEXLIB@ CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -LINK = $(CC) $(LDFLAGS) -o $@ +LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ HEADERS = $(noinst_HEADERS) DIST_COMMON = Makefile.am Makefile.in bc.c scan.c @@ -105,14 +116,14 @@ GZIP = --best SOURCES = $(bc_SOURCES) OBJECTS = $(bc_OBJECTS) -default: all +all: Makefile $(PROGRAMS) $(HEADERS) .SUFFIXES: -.SUFFIXES: .c .o .y .l -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu bc/Makefile +.SUFFIXES: .S .c .l .o .s .y +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps bc/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status @@ -120,7 +131,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) mostlyclean-binPROGRAMS: clean-binPROGRAMS: - test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) distclean-binPROGRAMS: @@ -128,30 +139,36 @@ maintainer-clean-binPROGRAMS: install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(bindir) + $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ if test -f $$p; then \ - echo " $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`"; \ - $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`; \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ else :; fi; \ done uninstall-binPROGRAMS: - $(NORMAL_UNINSTALL) + @$(NORMAL_UNINSTALL) list='$(bin_PROGRAMS)'; for p in $$list; do \ - rm -f $(bindir)/`echo $$p|sed '$(transform)'`; \ + rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ done .c.o: $(COMPILE) -c $< +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + mostlyclean-compile: - rm -f *.o core + -rm -f *.o core *.core clean-compile: distclean-compile: - rm -f *.tab.c + -rm -f *.tab.c maintainer-clean-compile: @@ -159,39 +176,44 @@ bc: $(bc_OBJECTS) $(bc_DEPENDENCIES) @rm -f bc $(LINK) $(bc_LDFLAGS) $(bc_OBJECTS) $(bc_LDADD) $(LIBS) .y.c: - $(YACC) $(YFLAGS) $< && mv y.tab.c $@ + $(YACC) $(YFLAGS) $< && mv y.tab.c $*.c if test -f y.tab.h; then \ if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \ else :; fi +bc.h: bc.c + .l.c: $(LEX) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@ tags: TAGS -ID: $(HEADERS) $(SOURCES) - here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS) +ID: $(HEADERS) $(SOURCES) $(LISP) + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ - done; \ - test -z "$(ETAGS_ARGS)$(SOURCES)$(HEADERS)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $(SOURCES) $(HEADERS) -o $$here/TAGS) + 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 + -rm -f TAGS ID maintainer-clean-tags: distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) subdir = bc + distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ @@ -215,28 +237,26 @@ install: install-exec install-data all uninstall: uninstall-binPROGRAMS -all: $(PROGRAMS) $(HEADERS) Makefile - install-strip: - $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install installdirs: - $(mkinstalldirs) $(bindir) + $(mkinstalldirs) $(DATADIR)$(bindir) mostlyclean-generic: - test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) clean-generic: - test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - rm -f Makefile $(DISTCLEANFILES) - rm -f config.cache config.log stamp-h - test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -rm -f Makefile $(DISTCLEANFILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: - test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) - test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) mostlyclean: mostlyclean-binPROGRAMS mostlyclean-compile \ mostlyclean-tags mostlyclean-generic @@ -245,7 +265,7 @@ clean: clean-binPROGRAMS clean-compile clean-tags clean-generic \ distclean: distclean-binPROGRAMS distclean-compile distclean-tags \ distclean-generic clean - rm -f config.status + -rm -f config.status maintainer-clean: maintainer-clean-binPROGRAMS maintainer-clean-compile \ maintainer-clean-tags maintainer-clean-generic \ @@ -253,9 +273,9 @@ maintainer-clean: maintainer-clean-binPROGRAMS maintainer-clean-compile \ @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." -.PHONY: default mostlyclean-binPROGRAMS distclean-binPROGRAMS \ -clean-binPROGRAMS maintainer-clean-binPROGRAMS uninstall-binPROGRAMS \ -install-binPROGRAMS mostlyclean-compile distclean-compile clean-compile \ +.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ +maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ +mostlyclean-compile distclean-compile clean-compile \ maintainer-clean-compile tags mostlyclean-tags distclean-tags \ clean-tags maintainer-clean-tags distdir info dvi installcheck \ install-exec install-data install uninstall all installdirs \ diff --git a/contrib/bc/config.h.in b/contrib/bc/config.h.in index 2f3aa47..1f33161 100644 --- a/contrib/bc/config.h.in +++ b/contrib/bc/config.h.in @@ -46,6 +46,9 @@ /* Define if you have the isgraph function. */ #undef HAVE_ISGRAPH +/* Define if you have the setvbuf function. */ +#undef HAVE_SETVBUF + /* Define if you have the <lib.h> header file. */ #undef HAVE_LIB_H diff --git a/contrib/bc/configure b/contrib/bc/configure index e487ffd..dfe4aa2 100755 --- a/contrib/bc/configure +++ b/contrib/bc/configure @@ -602,21 +602,8 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' - -PACKAGE=bc - -VERSION=1.04 - -cat >> confdefs.h <<EOF -#define PACKAGE "$PACKAGE" -EOF - -cat >> confdefs.h <<EOF -#define VERSION "$VERSION" -EOF - echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:620: checking whether build environment is sane" >&5 +echo "configure:607: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -627,10 +614,21 @@ echo timestamp > conftestfile # directory). if ( set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "" = "X"; then + 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 @@ -661,12 +659,58 @@ test "$program_suffix" != NONE && # 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:664: 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 + + +PACKAGE=bc + +VERSION=1.05 + +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:667: checking for working aclocal" >&5 +echo "configure:710: 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. -if (aclocal --version) > /dev/null 2>&1; then +# 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 @@ -675,10 +719,11 @@ else fi echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 -echo "configure:679: checking for working autoconf" >&5 +echo "configure:723: 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. -if (autoconf --version) > /dev/null 2>&1; then +# 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 @@ -687,10 +732,11 @@ else fi echo $ac_n "checking for working automake""... $ac_c" 1>&6 -echo "configure:691: checking for working automake" >&5 +echo "configure:736: 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. -if (automake --version) > /dev/null 2>&1; then +# 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 @@ -699,10 +745,11 @@ else fi echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 -echo "configure:703: checking for working autoheader" >&5 +echo "configure:749: 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. -if (autoheader --version) > /dev/null 2>&1; then +# 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 @@ -711,10 +758,11 @@ else fi echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 -echo "configure:715: checking for working makeinfo" >&5 +echo "configure:762: 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. -if (makeinfo --version) > /dev/null 2>&1; then +# 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 @@ -722,32 +770,6 @@ else echo "$ac_t""missing" 1>&6 fi -echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:727: 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 @@ -756,7 +778,7 @@ fi # 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:760: checking for $ac_word" >&5 +echo "configure:782: 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 @@ -785,7 +807,7 @@ 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:789: checking for $ac_word" >&5 +echo "configure:811: 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 @@ -833,7 +855,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:837: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:859: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -843,11 +865,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <<EOF -#line 847 "configure" +#line 869 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:873: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -867,12 +889,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:871: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:893: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:876: checking whether we are using GNU C" >&5 +echo "configure:898: 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 @@ -881,7 +903,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:885: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:907: \"$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 @@ -896,7 +918,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:900: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:922: 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 @@ -924,7 +946,7 @@ else fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:928: checking how to run the C preprocessor" >&5 +echo "configure:950: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -939,13 +961,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 943 "configure" +#line 965 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:949: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:971: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -956,13 +978,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 960 "configure" +#line 982 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:966: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:988: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -986,17 +1008,17 @@ echo "$ac_t""$CPP" 1>&6 ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6 -echo "configure:990: checking for minix/config.h" >&5 +echo "configure:1012: checking for minix/config.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 995 "configure" +#line 1017 "configure" #include "confdefs.h" #include <minix/config.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1000: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1022: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1034,44 +1056,45 @@ EOF fi -for ac_prog in 'bison -y' byacc +missing_dir=`cd $ac_aux_dir && pwd` +for ac_prog in flex lex 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1043: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then +echo "configure:1066: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$YACC"; then - ac_cv_prog_YACC="$YACC" # Let the user override the test. + if test -n "$LEX"; then + ac_cv_prog_LEX="$LEX" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_YACC="$ac_prog" + ac_cv_prog_LEX="$ac_prog" break fi done IFS="$ac_save_ifs" fi fi -YACC="$ac_cv_prog_YACC" -if test -n "$YACC"; then - echo "$ac_t""$YACC" 1>&6 +LEX="$ac_cv_prog_LEX" +if test -n "$LEX"; then + echo "$ac_t""$LEX" 1>&6 else echo "$ac_t""no" 1>&6 fi -test -n "$YACC" && break +test -n "$LEX" && break done -test -n "$YACC" || YACC="yacc" +test -n "$LEX" || LEX=""$missing_dir/missing flex"" # Extract the first word of "flex", so it can be a program name with args. set dummy flex; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1075: checking for $ac_word" >&5 +echo "configure:1098: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1104,7 +1127,7 @@ then *) ac_lib=l ;; esac echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 -echo "configure:1108: checking for yywrap in -l$ac_lib" >&5 +echo "configure:1131: checking for yywrap in -l$ac_lib" >&5 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1112,7 +1135,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$ac_lib $LIBS" cat > conftest.$ac_ext <<EOF -#line 1116 "configure" +#line 1139 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1123,7 +1146,7 @@ int main() { yywrap() ; return 0; } EOF -if { (eval echo configure:1127: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1150: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1146,7 +1169,7 @@ fi fi echo $ac_n "checking lex output file root""... $ac_c" 1>&6 -echo "configure:1150: checking lex output file root" >&5 +echo "configure:1173: checking lex output file root" >&5 if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1167,7 +1190,7 @@ echo "$ac_t""$ac_cv_prog_lex_root" 1>&6 LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6 -echo "configure:1171: checking whether yytext is a pointer" >&5 +echo "configure:1194: checking whether yytext is a pointer" >&5 if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1179,14 +1202,14 @@ echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c ac_save_LIBS="$LIBS" LIBS="$LIBS $LEXLIB" cat > conftest.$ac_ext <<EOF -#line 1183 "configure" +#line 1206 "configure" #include "confdefs.h" `cat $LEX_OUTPUT_ROOT.c` int main() { ; return 0; } EOF -if { (eval echo configure:1190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_prog_lex_yytext_pointer=yes else @@ -1207,82 +1230,39 @@ EOF fi -# Extract the first word of "flex", so it can be a program name with args. -set dummy flex; ac_word=$2 +for ac_prog in 'bison -y' byacc +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 $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_LEX'+set}'`\" = set"; then +echo "configure:1239: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$LEX"; then - ac_cv_prog_LEX="$LEX" # Let the user override the test. + if test -n "$YACC"; then + ac_cv_prog_YACC="$YACC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then - ac_cv_prog_LEX="flex" + ac_cv_prog_YACC="$ac_prog" break fi done IFS="$ac_save_ifs" - test -z "$ac_cv_prog_LEX" && ac_cv_prog_LEX="lex" fi fi -LEX="$ac_cv_prog_LEX" -if test -n "$LEX"; then - echo "$ac_t""$LEX" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -if test -z "$LEXLIB" -then - case "$LEX" in - flex*) ac_lib=fl ;; - *) ac_lib=l ;; - esac - echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 -echo "configure:1247: checking for yywrap in -l$ac_lib" >&5 -ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` -if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - ac_save_LIBS="$LIBS" -LIBS="-l$ac_lib $LIBS" -cat > conftest.$ac_ext <<EOF -#line 1255 "configure" -#include "confdefs.h" -/* Override any gcc2 internal prototype to avoid an error. */ -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char yywrap(); - -int main() { -yywrap() -; return 0; } -EOF -if { (eval echo configure:1266: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=yes" -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - eval "ac_cv_lib_$ac_lib_var=no" -fi -rm -f conftest* -LIBS="$ac_save_LIBS" - -fi -if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then - echo "$ac_t""yes" 1>&6 - LEXLIB="-l$ac_lib" +YACC="$ac_cv_prog_YACC" +if test -n "$YACC"; then + echo "$ac_t""$YACC" 1>&6 else echo "$ac_t""no" 1>&6 fi -fi +test -n "$YACC" && break +done +test -n "$YACC" || YACC="yacc" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -1295,7 +1275,7 @@ fi # 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:1299: checking for a BSD compatible install" >&5 +echo "configure:1279: 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 @@ -1347,7 +1327,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # 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:1351: checking for $ac_word" >&5 +echo "configure:1331: 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 @@ -1374,7 +1354,7 @@ else fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1378: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1358: 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 @@ -1406,17 +1386,17 @@ for ac_hdr in stdarg.h stddef.h stdlib.h string.h limits.h unistd.h lib.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1410: checking for $ac_hdr" >&5 +echo "configure:1390: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1415 "configure" +#line 1395 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1420: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1400: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1443,12 +1423,12 @@ fi done echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1447: checking for working const" >&5 +echo "configure:1427: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1452 "configure" +#line 1432 "configure" #include "confdefs.h" int main() { @@ -1497,7 +1477,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:1501: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1481: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1518,12 +1498,12 @@ EOF fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1522: checking for ANSI C header files" >&5 +echo "configure:1502: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1527 "configure" +#line 1507 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -1531,7 +1511,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1535: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1515: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1548,7 +1528,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1552 "configure" +#line 1532 "configure" #include "confdefs.h" #include <string.h> EOF @@ -1566,7 +1546,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1570 "configure" +#line 1550 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -1587,7 +1567,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 1591 "configure" +#line 1571 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1598,7 +1578,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1602: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1622,12 +1602,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1626: checking for size_t" >&5 +echo "configure:1606: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1631 "configure" +#line 1611 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1655,12 +1635,12 @@ EOF fi echo $ac_n "checking for ptrdiff_t""... $ac_c" 1>&6 -echo "configure:1659: checking for ptrdiff_t" >&5 +echo "configure:1639: checking for ptrdiff_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_ptrdiff_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1664 "configure" +#line 1644 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1689,12 +1669,12 @@ fi echo $ac_n "checking for vprintf""... $ac_c" 1>&6 -echo "configure:1693: checking for vprintf" >&5 +echo "configure:1673: checking for vprintf" >&5 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1698 "configure" +#line 1678 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char vprintf(); below. */ @@ -1717,7 +1697,7 @@ vprintf(); ; return 0; } EOF -if { (eval echo configure:1721: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_vprintf=yes" else @@ -1741,12 +1721,12 @@ fi if test "$ac_cv_func_vprintf" != yes; then echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 -echo "configure:1745: checking for _doprnt" >&5 +echo "configure:1725: checking for _doprnt" >&5 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1750 "configure" +#line 1730 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char _doprnt(); below. */ @@ -1769,7 +1749,7 @@ _doprnt(); ; return 0; } EOF -if { (eval echo configure:1773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func__doprnt=yes" else @@ -1793,15 +1773,15 @@ fi fi -for ac_func in isgraph +for ac_func in isgraph setvbuf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1800: checking for $ac_func" >&5 +echo "configure:1780: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1805 "configure" +#line 1785 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1824,7 +1804,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1808: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1849,45 +1829,12 @@ fi done - -# Check whether --with-readline or --without-readline was given. -if test "${with_readline+set}" = set; then - withval="$with_readline" - -if test "$with_readline" = "yes" ; then - echo Using the readline library. - cat >> confdefs.h <<\EOF -#define READLINE 1 -EOF - - LIBS="$LIBS -lreadline -ltermcap" - bcrl=y -else - bcrl=n -fi - -else - -bcrl=n - -fi - - -if test "$LEX" = "flex" ; then - LEX="flex -I8" -else - if test "$bcrl" = "y" ; then - echo "configure: warning: readline works only with flex." 1>&2 - fi -fi - - SaveCFLAGS="$CFLAGS" CFLAGS="-g -O -I. -I$srcdir" echo $ac_n "checking if long strings are accepted by the C compiler""... $ac_c" 1>&6 -echo "configure:1889: checking if long strings are accepted by the C compiler" >&5 +echo "configure:1836: checking if long strings are accepted by the C compiler" >&5 cat > conftest.$ac_ext <<EOF -#line 1891 "configure" +#line 1838 "configure" #include "confdefs.h" char libmath[] = @@ -1898,7 +1845,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:1902: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1849: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -1922,7 +1869,192 @@ fi rm -f conftest* CFLAGS="$SaveCFLAGS" +echo $LIBS +bcrl=nA +# Check whether --with-readline or --without-readline was given. +if test "${with_readline+set}" = set; then + withval="$with_readline" + + echo $ac_n "checking for tparm in -lncurses""... $ac_c" 1>&6 +echo "configure:1880: checking for tparm in -lncurses" >&5 +ac_lib_var=`echo ncurses'_'tparm | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lncurses $LIBS" +cat > conftest.$ac_ext <<EOF +#line 1888 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tparm(); + +int main() { +tparm() +; return 0; } +EOF +if { (eval echo configure:1899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + TERMLIB=-lncurses +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6 +echo "configure:1918: checking for tgetent in -ltermcap" >&5 +ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ltermcap $LIBS" +cat > conftest.$ac_ext <<EOF +#line 1926 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char tgetent(); + +int main() { +tgetent() +; return 0; } +EOF +if { (eval echo configure:1937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + TERMLIB=-ltermcap +else + echo "$ac_t""no" 1>&6 +fi + +fi + saved_LIBS="$LIBS" + LIBS="$LIBS $TERMLIB" + echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6 +echo "configure:1962: checking for readline in -lreadline" >&5 +ac_lib_var=`echo readline'_'readline | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lreadline $LIBS" +cat > conftest.$ac_ext <<EOF +#line 1970 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char readline(); + +int main() { +readline() +; return 0; } +EOF +if { (eval echo configure:1981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_safe=`echo "readline/readline.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for readline/readline.h""... $ac_c" 1>&6 +echo "configure:1998: checking for readline/readline.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2003 "configure" +#include "confdefs.h" +#include <readline/readline.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2008: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$saved_LIBS -lreadline $TERMLIB";bcrl=y +else + echo "$ac_t""no" 1>&6 +fi + +else + echo "$ac_t""no" 1>&6 +LIBS="$saved_LIBS" +fi + + if test "$bcrl" = "y" ; then + echo Using the readline library. + cat >> confdefs.h <<\EOF +#define READLINE 1 +EOF + + fi + +fi + +echo $LIBS + + +if test "$LEX" = "flex" ; then + LEX="flex -I8" +else + if test "$bcrl" = "y" ; then + echo "configure: warning: readline works only with flex." 1>&2 + fi +fi + +if test "$LEX" = "lex" -a `uname -s` = "SunOS" ; then + LEXLIB="" + echo "SunOS using lex does not have a -ll." +fi if test "$program_transform_name" = s,x,x,; then program_transform_name= @@ -2087,10 +2219,10 @@ s%@MAKEINFO@%$MAKEINFO%g s%@SET_MAKE@%$SET_MAKE%g s%@CC@%$CC%g s%@CPP@%$CPP%g -s%@YACC@%$YACC%g s%@LEX@%$LEX%g s%@LEXLIB@%$LEXLIB%g s%@LEX_OUTPUT_ROOT@%$LEX_OUTPUT_ROOT%g +s%@YACC@%$YACC%g s%@RANLIB@%$RANLIB%g CEOF diff --git a/contrib/bc/configure.in b/contrib/bc/configure.in index 38a63e8..0068e31 100644 --- a/contrib/bc/configure.in +++ b/contrib/bc/configure.in @@ -1,15 +1,14 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(doc/bc.1) -AM_INIT_AUTOMAKE(bc, 1.04) +AM_INIT_AUTOMAKE(bc, 1.05) AM_CONFIG_HEADER(config.h) AC_PROG_CC AC_MINIX dnl AC_ISC_POSIX +AM_PROG_LEX AC_PROG_YACC -AC_DECL_YYTEXT -AC_PROG_LEX AC_PROG_INSTALL AC_PROG_RANLIB AC_PROG_MAKE_SET @@ -21,30 +20,7 @@ AC_TYPE_SIZE_T AC_CHECK_TYPE(ptrdiff_t, size_t) AC_FUNC_VPRINTF -AC_CHECK_FUNCS(isgraph) - - -AC_ARG_WITH(readline,[ --with-readline support fancy command input editing], [ -if test "$with_readline" = "yes" ; then - echo Using the readline library. - AC_DEFINE(READLINE,1) - LIBS="$LIBS -lreadline -ltermcap" - bcrl=y -else - bcrl=n -fi -], [ -bcrl=n -]) - -if test "$LEX" = "flex" ; then - LEX="flex -I8" -else - if test "$bcrl" = "y" ; then - AC_MSG_WARN(readline works only with flex.) - fi -fi - +AC_CHECK_FUNCS(isgraph setvbuf) SaveCFLAGS="$CFLAGS" CFLAGS="-g -O -I. -I$srcdir" @@ -63,7 +39,49 @@ AC_DEFINE_UNQUOTED(BC_MATH_FILE,"${prefix}/lib/libmath.b") fi) CFLAGS="$SaveCFLAGS" +echo $LIBS +bcrl=nA +AC_ARG_WITH(readline,[ --with-readline support fancy command input editing], [ + AC_CHECK_LIB(ncurses,tparm,TERMLIB=-lncurses, + AC_CHECK_LIB(termcap,tgetent,TERMLIB=-ltermcap)) + saved_LIBS="$LIBS" + LIBS="$LIBS $TERMLIB" + AC_CHECK_LIB(readline,readline, + [AC_CHECK_HEADER(readline/readline.h, + LIBS="$saved_LIBS -lreadline $TERMLIB";bcrl=y)], + LIBS="$saved_LIBS") + if test "$bcrl" = "y" ; then + echo Using the readline library. + AC_DEFINE(READLINE,1) + fi +]) +echo $LIBS + +dnl AC_ARG_WITH(readline,[ --with-readline support fancy command input editing], [ +dnl if test "$with_readline" = "yes" ; then +dnl echo Using the readline library. +dnl AC_DEFINE(READLINE,1) +dnl LIBS="$LIBS -lreadline -ltermcap" +dnl bcrl=y +dnl else +dnl bcrl=n +dnl fi +dnl ], [ +dnl bcrl=n +dnl ]) +if test "$LEX" = "flex" ; then + LEX="flex -I8" +else + if test "$bcrl" = "y" ; then + AC_MSG_WARN(readline works only with flex.) + fi +fi + +if test "$LEX" = "lex" -a `uname -s` = "SunOS" ; then + LEXLIB="" + echo "SunOS using lex does not have a -ll." +fi AC_ARG_PROGRAM AC_OUTPUT(Makefile bc/Makefile dc/Makefile doc/Makefile lib/Makefile) diff --git a/contrib/bc/dc/Makefile.in b/contrib/bc/dc/Makefile.in index 44faf94..ae4e460 100644 --- a/contrib/bc/dc/Makefile.in +++ b/contrib/bc/dc/Makefile.in @@ -1,8 +1,14 @@ -# Makefile.in generated automatically by automake 1.1n from Makefile.am +# Makefile.in generated automatically by automake 1.3 from Makefile.am -# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. +# 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 = /bin/sh @@ -26,6 +32,8 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include +DISTDIR = + pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -43,14 +51,15 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ -NORMAL_INSTALL = true -PRE_INSTALL = true -POST_INSTALL = true -NORMAL_UNINSTALL = true -PRE_UNINSTALL = true -POST_UNINSTALL = true +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : CC = @CC@ LEX = @LEX@ +MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ VERSION = @VERSION@ @@ -79,7 +88,7 @@ dc_DEPENDENCIES = ../lib/libbc.a dc_LDFLAGS = CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -LINK = $(CC) $(LDFLAGS) -o $@ +LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ HEADERS = $(noinst_HEADERS) DIST_COMMON = Makefile.am Makefile.in @@ -92,14 +101,14 @@ GZIP = --best SOURCES = $(dc_SOURCES) OBJECTS = $(dc_OBJECTS) -default: all +all: Makefile $(PROGRAMS) $(HEADERS) .SUFFIXES: -.SUFFIXES: .c .o -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu dc/Makefile +.SUFFIXES: .S .c .o .s +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps dc/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status @@ -107,7 +116,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) mostlyclean-binPROGRAMS: clean-binPROGRAMS: - test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) distclean-binPROGRAMS: @@ -115,30 +124,36 @@ maintainer-clean-binPROGRAMS: install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(bindir) + $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ if test -f $$p; then \ - echo " $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`"; \ - $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`; \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ else :; fi; \ done uninstall-binPROGRAMS: - $(NORMAL_UNINSTALL) + @$(NORMAL_UNINSTALL) list='$(bin_PROGRAMS)'; for p in $$list; do \ - rm -f $(bindir)/`echo $$p|sed '$(transform)'`; \ + rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \ done .c.o: $(COMPILE) -c $< +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + mostlyclean-compile: - rm -f *.o core + -rm -f *.o core *.core clean-compile: distclean-compile: - rm -f *.tab.c + -rm -f *.tab.c maintainer-clean-compile: @@ -148,30 +163,33 @@ dc: $(dc_OBJECTS) $(dc_DEPENDENCIES) tags: TAGS -ID: $(HEADERS) $(SOURCES) - here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS) +ID: $(HEADERS) $(SOURCES) $(LISP) + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ - done; \ - test -z "$(ETAGS_ARGS)$(SOURCES)$(HEADERS)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $(SOURCES) $(HEADERS) -o $$here/TAGS) + 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 + -rm -f TAGS ID maintainer-clean-tags: distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) subdir = dc + distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ @@ -195,28 +213,26 @@ install: install-exec install-data all uninstall: uninstall-binPROGRAMS -all: $(PROGRAMS) $(HEADERS) Makefile - install-strip: - $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install installdirs: - $(mkinstalldirs) $(bindir) + $(mkinstalldirs) $(DATADIR)$(bindir) mostlyclean-generic: - test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) clean-generic: - test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - rm -f Makefile $(DISTCLEANFILES) - rm -f config.cache config.log stamp-h - test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -rm -f Makefile $(DISTCLEANFILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: - test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) - test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) mostlyclean: mostlyclean-binPROGRAMS mostlyclean-compile \ mostlyclean-tags mostlyclean-generic @@ -225,7 +241,7 @@ clean: clean-binPROGRAMS clean-compile clean-tags clean-generic \ distclean: distclean-binPROGRAMS distclean-compile distclean-tags \ distclean-generic clean - rm -f config.status + -rm -f config.status maintainer-clean: maintainer-clean-binPROGRAMS maintainer-clean-compile \ maintainer-clean-tags maintainer-clean-generic \ @@ -233,9 +249,9 @@ maintainer-clean: maintainer-clean-binPROGRAMS maintainer-clean-compile \ @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." -.PHONY: default mostlyclean-binPROGRAMS distclean-binPROGRAMS \ -clean-binPROGRAMS maintainer-clean-binPROGRAMS uninstall-binPROGRAMS \ -install-binPROGRAMS mostlyclean-compile distclean-compile clean-compile \ +.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ +maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ +mostlyclean-compile distclean-compile clean-compile \ maintainer-clean-compile tags mostlyclean-tags distclean-tags \ clean-tags maintainer-clean-tags distdir info dvi installcheck \ install-exec install-data install uninstall all installdirs \ diff --git a/contrib/bc/dc/array.c b/contrib/bc/dc/array.c index 2fc1b7e..bc701a1 100644 --- a/contrib/bc/dc/array.c +++ b/contrib/bc/dc/array.c @@ -1,7 +1,7 @@ /* * implement arrays for dc * - * Copyright (C) 1994 Free Software Foundation, Inc. + * Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,20 +39,12 @@ struct dc_array { dc_data value; struct dc_array *next; }; -typedef struct dc_array dc_array; -/* I can find no reason not to place arrays in their own namespace... */ -static dc_array *dc_array_register[DC_REGCOUNT]; - -/* initialize the arrays to their initial values */ +/* initialize the arrays */ void dc_array_init DC_DECLVOID() { - int i; - - for (i=0; i<DC_REGCOUNT; ++i) - dc_array_register[i] = NULL; } /* store value into array_id[Index] */ @@ -62,12 +54,11 @@ dc_array_set DC_DECLARG((array_id, Index, value)) int Index DC_DECLSEP dc_data value DC_DECLEND { - dc_array *cur; - dc_array *prev=NULL; - dc_array *newentry; + struct dc_array *cur; + struct dc_array *prev=NULL; + struct dc_array *newentry; - array_id = regmap(array_id); - cur = dc_array_register[array_id]; + cur = dc_get_stacked_array(array_id); while (cur && cur->Index < Index){ prev = cur; cur = cur->next; @@ -88,7 +79,7 @@ dc_array_set DC_DECLARG((array_id, Index, value)) if (prev) prev->next = newentry; else - dc_array_register[array_id] = newentry; + dc_set_stacked_array(array_id, newentry); } } @@ -99,10 +90,30 @@ dc_array_get DC_DECLARG((array_id, Index)) int array_id DC_DECLSEP int Index DC_DECLEND { - dc_array *cur; + struct dc_array *cur; - for (cur=dc_array_register[regmap(array_id)]; cur; cur=cur->next) + for (cur=dc_get_stacked_array(array_id); cur; cur=cur->next) if (cur->Index == Index) return dc_dup(cur->value); return dc_int2data(0); } + +/* free an array chain */ +void +dc_array_free DC_DECLARG((a_head)) + struct dc_array *a_head DC_DECLEND +{ + struct dc_array *cur; + struct dc_array *next; + + for (cur=a_head; cur; cur=next) { + next = cur->next; + if (cur->value.dc_type == DC_NUMBER) + dc_free_num(&cur->value.v.number); + else if (cur->value.dc_type == DC_STRING) + dc_free_str(&cur->value.v.string); + else + dc_garbage("in stack", -1); + free(cur); + } +} diff --git a/contrib/bc/dc/dc-proto.h b/contrib/bc/dc/dc-proto.h index 5aa9bc7..1e7c52c 100644 --- a/contrib/bc/dc/dc-proto.h +++ b/contrib/bc/dc/dc-proto.h @@ -1,7 +1,7 @@ /* * prototypes of all externally visible dc functions * - * Copyright (C) 1994, 1997 Free Software Foundation, Inc. + * Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,8 +22,10 @@ extern const char *dc_str2charp DC_PROTO((dc_str)); extern const char *dc_system DC_PROTO((const char *)); extern void *dc_malloc DC_PROTO((size_t)); +extern struct dc_array *dc_get_stacked_array DC_PROTO((int)); extern void dc_array_set DC_PROTO((int, int, dc_data)); +extern void dc_array_free DC_PROTO((struct dc_array *)); extern void dc_array_init DC_PROTO((void)); extern void dc_binop DC_PROTO((int (*)(dc_num, dc_num, int, dc_num *), int)); extern void dc_binop2 DC_PROTO((int (*)(dc_num, dc_num, int, @@ -31,19 +33,21 @@ extern void dc_binop2 DC_PROTO((int (*)(dc_num, dc_num, int, extern void dc_triop DC_PROTO((int (*)(dc_num, dc_num, dc_num, int, dc_num *), int)); extern void dc_clear_stack DC_PROTO((void)); +extern void dc_dump_num(dc_num, dc_discard); extern void dc_free_num DC_PROTO((dc_num *)); extern void dc_free_str DC_PROTO((dc_str *)); extern void dc_garbage DC_PROTO((const char *, int)); extern void dc_math_init DC_PROTO((void)); extern void dc_memfail DC_PROTO((void)); -extern void dc_out_num DC_PROTO((dc_num, int, dc_boolean, dc_boolean)); -extern void dc_out_str DC_PROTO((dc_str, dc_boolean, dc_boolean)); -extern void dc_print DC_PROTO((dc_data, int)); +extern void dc_out_num DC_PROTO((dc_num, int, dc_newline, dc_discard)); +extern void dc_out_str DC_PROTO((dc_str, dc_newline, dc_discard)); +extern void dc_print DC_PROTO((dc_data, int, dc_newline, dc_discard)); extern void dc_printall DC_PROTO((int)); extern void dc_push DC_PROTO((dc_data)); extern void dc_register_init DC_PROTO((void)); extern void dc_register_push DC_PROTO((int, dc_data)); extern void dc_register_set DC_PROTO((int, dc_data)); +extern void dc_set_stacked_array DC_PROTO((int, struct dc_array *)); extern void dc_show_id DC_PROTO((FILE *, int, const char *)); extern void dc_string_init DC_PROTO((void)); @@ -51,13 +55,13 @@ extern int dc_cmpop DC_PROTO((void)); extern int dc_compare DC_PROTO((dc_num, dc_num)); extern int dc_evalfile DC_PROTO((FILE *)); extern int dc_evalstr DC_PROTO((dc_data)); -extern int dc_num2int DC_PROTO((dc_num, dc_boolean)); +extern int dc_num2int DC_PROTO((dc_num, dc_discard)); extern int dc_numlen DC_PROTO((dc_num)); extern int dc_pop DC_PROTO((dc_data *)); extern int dc_register_get DC_PROTO((int, dc_data *)); extern int dc_register_pop DC_PROTO((int, dc_data *)); -extern int dc_tell_length DC_PROTO((dc_data, dc_boolean)); -extern int dc_tell_scale DC_PROTO((dc_num, dc_boolean)); +extern int dc_tell_length DC_PROTO((dc_data, dc_discard)); +extern int dc_tell_scale DC_PROTO((dc_num, dc_discard)); extern int dc_tell_stackdepth DC_PROTO((void)); extern int dc_top_of_stack DC_PROTO((dc_data *)); diff --git a/contrib/bc/dc/dc.c b/contrib/bc/dc/dc.c index 85da40f..fa213ba 100644 --- a/contrib/bc/dc/dc.c +++ b/contrib/bc/dc/dc.c @@ -1,7 +1,7 @@ /* * implement the "dc" Desk Calculator language. * - * Copyright (C) 1994, 1997 Free Software Foundation, Inc. + * Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -65,7 +65,8 @@ Usage: %s [OPTION] [file ...]\n\ -h, --help display this help and exit\n\ -V, --version output version information and exit\n\ \n\ -Report bugs to @\n\ +Report bugs to bug-gnu-utils@prep.ai.mit.edu\n\ +Be sure to include the word ``dc'' somewhere in the ``Subject:'' field.\n\ ", progname); } @@ -94,17 +95,21 @@ r1bindex DC_DECLARG((s, c)) } static void -try_file(const char *filename) { +try_file(const char *filename) +{ FILE *input; - if ( !(input=fopen(filename, "r")) ) { + if (strcmp(filename, "-") == 0) { + input = stdin; + } else if ( !(input=fopen(filename, "r")) ) { fprintf(stderr, "Could not open file "); perror(filename); exit(EXIT_FAILURE); } if (dc_evalfile(input)) exit(EXIT_FAILURE); - fclose(input); + if (input != stdin) + fclose(input); } @@ -124,12 +129,16 @@ main DC_DECLARG((argc, argv)) int c; progname = r1bindex(*argv, '/'); +#ifdef HAVE_SETVBUF + /* attempt to simplify interaction with applications such as emacs */ + (void) setvbuf(stdout, NULL, _IOLBF, 0); +#endif dc_math_init(); dc_string_init(); dc_register_init(); dc_array_init(); - while ((c = getopt_long(argc, argv, "hVe:", long_opts, (int *)0)) != EOF) { + while ((c = getopt_long(argc, argv, "hVe:f:", long_opts, (int *)0)) != EOF) { switch (c) { case 'e': { dc_data string = dc_makestring(optarg, strlen(optarg)); @@ -156,12 +165,7 @@ main DC_DECLARG((argc, argv)) } for (; optind < argc; ++optind) { - if (strcmp(argv[optind], "-") == 0) { - if (dc_evalfile(stdin)) - return EXIT_FAILURE; - } else { - try_file(argv[optind]); - } + try_file(argv[optind]); did_eval = 1; } if (!did_eval) { diff --git a/contrib/bc/dc/dc.h b/contrib/bc/dc/dc.h index eeac77b..5e2d65a 100644 --- a/contrib/bc/dc/dc.h +++ b/contrib/bc/dc/dc.h @@ -1,7 +1,7 @@ /* * Header file for dc routines * - * Copyright (C) 1994, 1997 Free Software Foundation, Inc. + * Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,7 +47,8 @@ #endif /* __STDC__ */ -typedef enum {DC_FALSE, DC_TRUE} dc_boolean; +typedef enum {DC_TOSS, DC_KEEP} dc_discard; +typedef enum {DC_NONL, DC_WITHNL} dc_newline; /* type discriminant for dc_data */ diff --git a/contrib/bc/dc/eval.c b/contrib/bc/dc/eval.c index cac4cb1..0cb2185 100644 --- a/contrib/bc/dc/eval.c +++ b/contrib/bc/dc/eval.c @@ -1,7 +1,7 @@ /* * evaluate the dc language, from a FILE* or a string * - * Copyright (C) 1994, 1997 Free Software Foundation, Inc. + * Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,6 +38,8 @@ #include "dc.h" #include "dc-proto.h" +typedef enum {DC_FALSE, DC_TRUE} dc_boolean; + typedef enum { DC_OKAY = DC_SUCCESS, /* no further intervention needed for this command */ DC_EATONE, /* caller needs to eat the lookahead char */ @@ -50,6 +52,7 @@ typedef enum { DC_STR, /* caller needs to parse a dc_str from input stream */ DC_SYSTEM, /* caller needs to run a system() on next input line */ DC_COMMENT, /* caller needs to skip to the next input line */ + DC_NEGCMP, /* caller needs to re-call dc_func() with `negcmp' set */ DC_EOF_ERROR /* unexpected end of input; abort current eval */ } dc_status; @@ -127,11 +130,13 @@ dc_eval_and_free_str DC_DECLARG((string)) * * c -> the "current" input character under consideration * peekc -> the lookahead input character + * negcmp -> negate comparison test (for <,=,> commands) */ static dc_status -dc_func DC_DECLARG((c, peekc)) +dc_func DC_DECLARG((c, peekc, negcmp)) int c DC_DECLSEP - int peekc DC_DECLEND + int peekc DC_DECLSEP + int negcmp DC_DECLEND { /* we occasionally need these for temporary data */ /* Despite the GNU coding standards, it is much easier @@ -198,7 +203,7 @@ dc_func DC_DECLARG((c, peekc)) */ if (peekc == EOF) return DC_EOF_ERROR; - if (dc_cmpop() < 0) + if ( (dc_cmpop() < 0) == !negcmp ) if (dc_register_get(peekc, &datum) == DC_SUCCESS) if (dc_eval_and_free_str(datum) == DC_QUIT) return DC_QUIT; @@ -209,7 +214,7 @@ dc_func DC_DECLARG((c, peekc)) */ if (peekc == EOF) return DC_EOF_ERROR; - if (dc_cmpop() == 0) + if ( (dc_cmpop() == 0) == !negcmp ) if (dc_register_get(peekc, &datum) == DC_SUCCESS) if (dc_eval_and_free_str(datum) == DC_QUIT) return DC_QUIT; @@ -220,7 +225,7 @@ dc_func DC_DECLARG((c, peekc)) */ if (peekc == EOF) return DC_EOF_ERROR; - if (dc_cmpop() > 0) + if ( (dc_cmpop() > 0) == !negcmp ) if (dc_register_get(peekc, &datum) == DC_SUCCESS) if (dc_eval_and_free_str(datum) == DC_QUIT) return DC_QUIT; @@ -236,6 +241,8 @@ dc_func DC_DECLARG((c, peekc)) case '[': /* read to balancing ']' into a dc_str */ return DC_STR; case '!': /* read to newline and call system() on resulting string */ + if (peekc == '<' || peekc == '=' || peekc == '>') + return DC_NEGCMP; return DC_SYSTEM; case '#': /* comment; skip remainder of current line */ return DC_COMMENT; @@ -244,8 +251,7 @@ dc_func DC_DECLARG((c, peekc)) if (dc_pop(&datum) == DC_SUCCESS){ char tmps; if (datum.dc_type == DC_NUMBER){ - tmps = (char) dc_num2int(datum.v.number, DC_TRUE); - dc_free_num(&datum.v.number); + tmps = (char) dc_num2int(datum.v.number, DC_TOSS); }else if (datum.dc_type == DC_STRING){ tmps = *dc_str2charp(datum.v.string); dc_free_str(&datum.v.string); @@ -269,7 +275,7 @@ dc_func DC_DECLARG((c, peekc)) if (dc_pop(&datum) == DC_SUCCESS){ tmpint = 0; if (datum.dc_type == DC_NUMBER) - tmpint = dc_num2int(datum.v.number, DC_TRUE); + tmpint = dc_num2int(datum.v.number, DC_TOSS); if ( ! (2 <= tmpint && tmpint <= DC_IBASE_MAX) ) fprintf(stderr, "%s: input base must be a number \ @@ -283,7 +289,7 @@ between 2 and %d (inclusive)\n", if (dc_pop(&datum) == DC_SUCCESS){ tmpint = -1; if (datum.dc_type == DC_NUMBER) - tmpint = dc_num2int(datum.v.number, DC_TRUE); + tmpint = dc_num2int(datum.v.number, DC_TOSS); if ( ! (tmpint >= 0) ) fprintf(stderr, "%s: scale must be a nonnegative number\n", @@ -301,11 +307,17 @@ between 2 and %d (inclusive)\n", if (dc_register_get(peekc, &datum) == DC_SUCCESS) dc_push(datum); return DC_EATONE; + case 'n': /* print the value popped off of top-of-stack; + * do not add a trailing newline + */ + if (dc_pop(&datum) == DC_SUCCESS) + dc_print(datum, dc_obase, DC_NONL, DC_TOSS); + break; case 'o': /* set output base to value on top of stack */ if (dc_pop(&datum) == DC_SUCCESS){ tmpint = 0; if (datum.dc_type == DC_NUMBER) - tmpint = dc_num2int(datum.v.number, DC_TRUE); + tmpint = dc_num2int(datum.v.number, DC_TOSS); if ( ! (tmpint > 1) ) fprintf(stderr, "%s: output base must be a number greater than 1\n", @@ -314,12 +326,14 @@ between 2 and %d (inclusive)\n", dc_obase = tmpint; } break; - case 'p': /* print the datum on the top of stack */ + case 'p': /* print the datum on the top of stack, + * with a trailing newline + */ if (dc_top_of_stack(&datum) == DC_SUCCESS) - dc_print(datum, dc_obase); + dc_print(datum, dc_obase, DC_WITHNL, DC_KEEP); break; case 'q': /* quit two levels of evaluation, posibly exiting program */ - unwind_depth = 2; + unwind_depth = 1; /* the return below is the first level of returns */ unwind_noexit = DC_FALSE; return DC_QUIT; case 'r': /* rotate (swap) the top two elements on the stack @@ -389,14 +403,18 @@ between 2 and %d (inclusive)\n", case 'O': /* push the current output base onto the stack */ dc_push(dc_int2data(dc_obase)); break; - case 'P': /* print the value popped off of top-of-stack; - * do not add a trailing newline - */ + case 'P': + /* Pop the value off the top of a stack. If it is + * a number, dump out the integer portion of its + * absolute value as a "base UCHAR_MAX+1" byte stream; + * if it is a string, just print it. + * In either case, do not append a trailing newline. + */ if (dc_pop(&datum) == DC_SUCCESS){ - if (datum.dc_type == DC_STRING) - dc_out_str(datum.v.string, DC_FALSE, DC_TRUE); - else if (datum.dc_type == DC_NUMBER) - dc_out_num(datum.v.number, dc_obase, DC_FALSE, DC_TRUE); + if (datum.dc_type == DC_NUMBER) + dc_dump_num(datum.v.number, DC_TOSS); + else if (datum.dc_type == DC_STRING) + dc_out_str(datum.v.string, DC_NONL, DC_TOSS); else dc_garbage("at top of stack", -1); } @@ -409,9 +427,10 @@ between 2 and %d (inclusive)\n", unwind_depth = 0; unwind_noexit = DC_TRUE; if (datum.dc_type == DC_NUMBER) - unwind_depth = dc_num2int(datum.v.number, DC_TRUE); - if (unwind_depth > 0) + unwind_depth = dc_num2int(datum.v.number, DC_TOSS); + if (unwind_depth-- > 0) return DC_QUIT; + unwind_depth = 0; /* paranoia */ fprintf(stderr, "%s: Q command requires a number >= 1\n", progname); @@ -427,7 +446,7 @@ between 2 and %d (inclusive)\n", if (dc_pop(&datum) == DC_SUCCESS){ tmpint = 0; if (datum.dc_type == DC_NUMBER) - tmpint = dc_num2int(datum.v.number, DC_TRUE); + tmpint = dc_num2int(datum.v.number, DC_TOSS); dc_stack_rotate(tmpint); } break; @@ -444,13 +463,13 @@ between 2 and %d (inclusive)\n", if (dc_pop(&datum) == DC_SUCCESS){ tmpint = 0; if (datum.dc_type == DC_NUMBER) - tmpint = dc_tell_scale(datum.v.number, DC_TRUE); + tmpint = dc_tell_scale(datum.v.number, DC_TOSS); dc_push(dc_int2data(tmpint)); } break; case 'Z': /* replace the datum on the top-of-stack with its length */ if (dc_pop(&datum) == DC_SUCCESS) - dc_push(dc_int2data(dc_tell_length(datum, DC_TRUE))); + dc_push(dc_int2data(dc_tell_length(datum, DC_TOSS))); break; case ':': /* store into array */ @@ -459,7 +478,7 @@ between 2 and %d (inclusive)\n", if (dc_pop(&datum) == DC_SUCCESS){ tmpint = -1; if (datum.dc_type == DC_NUMBER) - tmpint = dc_num2int(datum.v.number, DC_TRUE); + tmpint = dc_num2int(datum.v.number, DC_TOSS); if (dc_pop(&datum) == DC_SUCCESS){ if (tmpint < 0) fprintf(stderr, @@ -476,7 +495,7 @@ between 2 and %d (inclusive)\n", if (dc_pop(&datum) == DC_SUCCESS){ tmpint = -1; if (datum.dc_type == DC_NUMBER) - tmpint = dc_num2int(datum.v.number, DC_TRUE); + tmpint = dc_num2int(datum.v.number, DC_TOSS); if (tmpint < 0) fprintf(stderr, "%s: array index must be a nonnegative integer\n", @@ -507,6 +526,8 @@ dc_evalstr DC_DECLARG((string)) int c; int peekc; int count; + int negcmp; + int next_negcmp = 0; if (string.dc_type != DC_STRING){ fprintf(stderr, @@ -521,7 +542,9 @@ dc_evalstr DC_DECLARG((string)) peekc = EOF; if (s < end) peekc = *(const unsigned char *)s; - switch (dc_func(c, peekc)){ + negcmp = next_negcmp; + next_negcmp = 0; + switch (dc_func(c, peekc, negcmp)){ case DC_OKAY: break; case DC_EATONE: @@ -562,6 +585,9 @@ dc_evalstr DC_DECLARG((string)) else ++s; break; + case DC_NEGCMP: + next_negcmp = 1; + break; case DC_EOF_ERROR: fprintf(stderr, "%s: unexpected EOS\n", progname); @@ -582,6 +608,8 @@ dc_evalfile DC_DECLARG((fp)) { int c; int peekc; + int negcmp; + int next_negcmp = 0; dc_data datum; stdin_lookahead = EOF; @@ -593,7 +621,9 @@ dc_evalfile DC_DECLARG((fp)) */ if (fp == stdin) stdin_lookahead = peekc; - switch (dc_func(c, peekc)){ + negcmp = next_negcmp; + next_negcmp = 0; + switch (dc_func(c, peekc, negcmp)){ case DC_OKAY: if (stdin_lookahead != peekc && fp == stdin) peekc = getc(fp); @@ -636,6 +666,9 @@ dc_evalfile DC_DECLARG((fp)) if (peekc != EOF) peekc = getc(fp); break; + case DC_NEGCMP: + next_negcmp = 1; + break; case DC_EOF_ERROR: fprintf(stderr, "%s: unexpected EOF\n", progname); diff --git a/contrib/bc/dc/misc.c b/contrib/bc/dc/misc.c index 8c360ca..65f986b 100644 --- a/contrib/bc/dc/misc.c +++ b/contrib/bc/dc/misc.c @@ -1,7 +1,7 @@ /* * misc. functions for the "dc" Desk Calculator language. * - * Copyright (C) 1994, 1997 Free Software Foundation, Inc. + * Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -150,14 +150,16 @@ dc_system DC_DECLARG((s)) /* print out the indicated value */ void -dc_print DC_DECLARG((value, obase)) +dc_print DC_DECLARG((value, obase, newline_p, discard_p)) dc_data value DC_DECLSEP - int obase DC_DECLEND + int obase DC_DECLSEP + dc_newline newline_p DC_DECLSEP + dc_discard discard_p DC_DECLEND { if (value.dc_type == DC_NUMBER) { - dc_out_num(value.v.number, obase, DC_TRUE, DC_FALSE); + dc_out_num(value.v.number, obase, newline_p, discard_p); } else if (value.dc_type == DC_STRING) { - dc_out_str(value.v.string, DC_TRUE, DC_FALSE); + dc_out_str(value.v.string, newline_p, discard_p); } else { dc_garbage("in data being printed", -1); } diff --git a/contrib/bc/dc/numeric.c b/contrib/bc/dc/numeric.c index ec19344..d5abf13 100644 --- a/contrib/bc/dc/numeric.c +++ b/contrib/bc/dc/numeric.c @@ -1,7 +1,7 @@ /* * interface dc to the bc numeric routines * - * Copyright (C) 1994, 1997 Free Software Foundation, Inc. + * Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,12 +28,23 @@ #include <stdio.h> #include <ctype.h> +#ifdef HAVE_LIMITS_H +# include <limits.h> +#else +# define UCHAR_MAX ((unsigned char)~0) +#endif #include "bcdefs.h" #include "proto.h" #include "global.h" #include "dc.h" #include "dc-proto.h" +#ifdef __GNUC__ +# define ATTRIB(x) __attribute__(x) +#else +# define ATTRIB(x) +#endif + /* there is no POSIX standard for dc, so we'll take the GNU definitions */ int std_only = FALSE; @@ -47,7 +58,7 @@ int dc_add DC_DECLARG((a, b, kscale, result)) dc_num a DC_DECLSEP dc_num b DC_DECLSEP - int kscale DC_DECLSEP + int kscale ATTRIB((unused)) DC_DECLSEP dc_num *result DC_DECLEND { init_num((bc_num *)result); @@ -62,7 +73,7 @@ int dc_sub DC_DECLARG((a, b, kscale, result)) dc_num a DC_DECLSEP dc_num b DC_DECLSEP - int kscale DC_DECLSEP + int kscale ATTRIB((unused)) DC_DECLSEP dc_num *result DC_DECLEND { init_num((bc_num *)result); @@ -211,17 +222,17 @@ dc_compare DC_DECLARG((a, b)) } /* attempt to convert a dc_num to its corresponding int value - * If discard_flag is true then deallocate the value after use. + * If discard_p is DC_TOSS then deallocate the value after use. */ int -dc_num2int DC_DECLARG((value, discard_flag)) +dc_num2int DC_DECLARG((value, discard_p)) dc_num value DC_DECLSEP - dc_boolean discard_flag DC_DECLEND + dc_discard discard_p DC_DECLEND { long result; result = num2long(CastNum(value)); - if (discard_flag) + if (discard_p == DC_TOSS) dc_free_num(&value); return (int)result; } @@ -346,17 +357,17 @@ dc_numlen DC_DECLARG((value)) } /* return the scale factor of the passed dc_num - * If discard_flag is true then deallocate the value after use. + * If discard_p is DC_TOSS then deallocate the value after use. */ int -dc_tell_scale DC_DECLARG((value, discard_flag)) +dc_tell_scale DC_DECLARG((value, discard_p)) dc_num value DC_DECLSEP - dc_boolean discard_flag DC_DECLEND + dc_discard discard_p DC_DECLEND { int kscale; kscale = CastNum(value)->n_scale; - if (discard_flag) + if (discard_p == DC_TOSS) dc_free_num(&value); return kscale; } @@ -370,23 +381,71 @@ dc_math_init DC_DECLVOID() } /* print out a dc_num in output base obase to stdout; - * if newline is true, terminate output with a '\n'; - * if discard_flag is true then deallocate the value after use + * if newline_p is DC_WITHNL, terminate output with a '\n'; + * if discard_p is DC_TOSS then deallocate the value after use */ void -dc_out_num DC_DECLARG((value, obase, newline, discard_flag)) +dc_out_num DC_DECLARG((value, obase, newline_p, discard_p)) dc_num value DC_DECLSEP int obase DC_DECLSEP - dc_boolean newline DC_DECLSEP - dc_boolean discard_flag DC_DECLEND + dc_newline newline_p DC_DECLSEP + dc_discard discard_p DC_DECLEND { out_num(CastNum(value), obase, out_char); - if (newline) + if (newline_p == DC_WITHNL) out_char('\n'); - if (discard_flag) + if (discard_p == DC_TOSS) dc_free_num(&value); } +/* dump out the absolute value of the integer part of a + * dc_num as a byte stream, without any line wrapping; + * if discard_p is DC_TOSS then deallocate the value after use + */ +void +dc_dump_num DC_DECLARG((value, discard_p)) + dc_num dcvalue DC_DECLSEP + dc_discard discard_p DC_DECLEND +{ + struct digit_stack { int digit; struct digit_stack *link;}; + struct digit_stack *top_of_stack = NULL; + struct digit_stack *cur; + struct digit_stack *next; + bc_num value; + bc_num obase; + bc_num digit; + + init_num(&value); + init_num(&obase); + init_num(&digit); + + /* we only handle the integer portion: */ + bc_divide(CastNum(dcvalue), _one_, &value, 0); + /* we only handle the absolute value: */ + value->n_sign = PLUS; + /* we're done with the dcvalue parameter: */ + if (discard_p == DC_TOSS) + dc_free_num(&dcvalue); + + int2num(&obase, 1+UCHAR_MAX); + do { + (void) bc_divmod(value, obase, &value, &digit, 0); + cur = dc_malloc(sizeof *cur); + cur->digit = (int)num2long(digit); + cur->link = top_of_stack; + top_of_stack = cur; + } while (!is_zero(value)); + + for (cur=top_of_stack; cur; cur=next) { + putchar(cur->digit); + next = cur->link; + free(cur); + } + + free_num(&digit); + free_num(&obase); + free_num(&value); +} /* deallocate an instance of a dc_num */ void diff --git a/contrib/bc/dc/stack.c b/contrib/bc/dc/stack.c index c8cd195..0268b70 100644 --- a/contrib/bc/dc/stack.c +++ b/contrib/bc/dc/stack.c @@ -1,7 +1,7 @@ /* * implement stack functions for dc * - * Copyright (C) 1994, 1997 Free Software Foundation, Inc. + * Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,6 +41,7 @@ /* simple linked-list implementaion suffices: */ struct dc_list { dc_data value; + struct dc_array *array; /* opaque */ struct dc_list *link; }; typedef struct dc_list dc_list; @@ -60,6 +61,7 @@ dc_alloc DC_DECLVOID() result = dc_malloc(sizeof *result); result->value.dc_type = DC_UNINITIALIZED; + result->array = NULL; result->link = NULL; return result; } @@ -247,6 +249,7 @@ dc_clear_stack DC_DECLVOID() dc_free_str(&n->value.v.string); else dc_garbage("in stack", -1); + dc_array_free(n->array); free(n); } dc_stack = NULL; @@ -369,6 +372,7 @@ dc_pop DC_DECLARG((result)) dc_garbage("at top of stack", -1); *result = r->value; dc_stack = r->link; + dc_array_free(r->array); free(r); return DC_SUCCESS; } @@ -396,6 +400,7 @@ dc_register_pop DC_DECLARG((stackid, result)) dc_garbage(" stack", stackid); *result = r->value; dc_register[stackid] = r->link; + dc_array_free(r->array); free(r); return DC_SUCCESS; } @@ -415,25 +420,25 @@ dc_tell_stackdepth DC_DECLVOID() /* return the length of the indicated data value; - * if discard_flag is true, the deallocate the value when done + * if discard_p is DC_TOSS, the deallocate the value when done * * The definition of a datum's length is deligated to the * appropriate module. */ int -dc_tell_length DC_DECLARG((value, discard_flag)) +dc_tell_length DC_DECLARG((value, discard_p)) dc_data value DC_DECLSEP - dc_boolean discard_flag DC_DECLEND + dc_discard discard_p DC_DECLEND { int length; if (value.dc_type == DC_NUMBER){ length = dc_numlen(value.v.number); - if (discard_flag == DC_TRUE) + if (discard_p == DC_TOSS) dc_free_num(&value.v.number); } else if (value.dc_type == DC_STRING) { length = dc_strlen(value.v.string); - if (discard_flag == DC_TRUE) + if (discard_p == DC_TOSS) dc_free_str(&value.v.string); } else { dc_garbage("in tell_length", -1); @@ -453,5 +458,32 @@ dc_printall DC_DECLARG((obase)) dc_list *n; for (n=dc_stack; n; n=n->link) - dc_print(n->value, obase); + dc_print(n->value, obase, DC_WITHNL, DC_KEEP); +} + + + + +/* get the current array head for the named array */ +struct dc_array * +dc_get_stacked_array DC_DECLARG((array_id)) + int array_id DC_DECLEND +{ + dc_list *r = dc_register[regmap(array_id)]; + return r ? r->array : NULL; +} + +/* set the current array head for the named array */ +void +dc_set_stacked_array DC_DECLARG((array_id, new_head)) + int array_id DC_DECLSEP + struct dc_array *new_head DC_DECLEND +{ + dc_list *r; + + array_id = regmap(array_id); + r = dc_register[array_id]; + if ( ! r ) + r = dc_register[array_id] = dc_alloc(); + r->array = new_head; } diff --git a/contrib/bc/dc/string.c b/contrib/bc/dc/string.c index 35bc263..6cffffd 100644 --- a/contrib/bc/dc/string.c +++ b/contrib/bc/dc/string.c @@ -1,7 +1,7 @@ /* * implement string functions for dc * - * Copyright (C) 1994, 1997 Free Software Foundation, Inc. + * Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -92,13 +92,13 @@ dc_free_str DC_DECLARG((value)) void dc_out_str DC_DECLARG((value, newline, discard_flag)) dc_str value DC_DECLSEP - dc_boolean newline DC_DECLSEP - dc_boolean discard_flag DC_DECLEND + dc_newline newline DC_DECLSEP + dc_discard discard_flag DC_DECLEND { fwrite(value->s_ptr, value->s_len, sizeof *value->s_ptr, stdout); - if (newline == DC_TRUE) - printf("\n"); - if (discard_flag == DC_TRUE) + if (newline == DC_WITHNL) + putchar('\n'); + if (discard_flag == DC_TOSS) dc_free_str(&value); } diff --git a/contrib/bc/doc/Makefile.in b/contrib/bc/doc/Makefile.in index 770e201..2593d25 100644 --- a/contrib/bc/doc/Makefile.in +++ b/contrib/bc/doc/Makefile.in @@ -1,8 +1,14 @@ -# Makefile.in generated automatically by automake 1.1n from Makefile.am +# Makefile.in generated automatically by automake 1.3 from Makefile.am -# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. +# 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 = /bin/sh @@ -26,6 +32,8 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include +DISTDIR = + pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -43,12 +51,12 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ -NORMAL_INSTALL = true -PRE_INSTALL = true -POST_INSTALL = true -NORMAL_UNINSTALL = true -PRE_UNINSTALL = true -POST_UNINSTALL = true +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : CC = @CC@ LEX = @LEX@ PACKAGE = @PACKAGE@ @@ -72,7 +80,8 @@ TEXINFO_TEX = $(srcdir)/texinfo.tex INFO_DEPS = dc.info DVIS = dc.dvi TEXINFOS = dc.texi -MANS = bc.1 dc.1 +man1dir = $(mandir)/man1 +MANS = $(man_MANS) NROFF = nroff DIST_COMMON = Makefile.am Makefile.in texinfo.tex @@ -82,14 +91,14 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) TAR = tar GZIP = --best -default: all +all: Makefile $(INFO_DEPS) $(MANS) .SUFFIXES: -.SUFFIXES: .texi .texinfo .info .dvi .ps -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile +.SUFFIXES: .dvi .info .ps .texi .texinfo .txi +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps doc/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status @@ -101,6 +110,7 @@ dc.dvi: dc.texi DVIPS = dvips .texi.info: + @cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9] cd $(srcdir) \ && $(MAKEINFO) `echo $< | sed 's,.*/,,'` @@ -109,54 +119,72 @@ DVIPS = dvips MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $< .texi: + @cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9] cd $(srcdir) \ && $(MAKEINFO) `echo $< | sed 's,.*/,,'` .texinfo.info: + @cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9] cd $(srcdir) \ && $(MAKEINFO) `echo $< | sed 's,.*/,,'` .texinfo: + @cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9] cd $(srcdir) \ && $(MAKEINFO) `echo $< | sed 's,.*/,,'` .texinfo.dvi: TEXINPUTS=$(srcdir):$$TEXINPUTS \ MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $< + +.txi.info: + @cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9] + cd $(srcdir) \ + && $(MAKEINFO) `echo $< | sed 's,.*/,,'` + +.txi.dvi: + TEXINPUTS=$(srcdir):$$TEXINPUTS \ + MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $< + +.txi: + @cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9] + cd $(srcdir) \ + && $(MAKEINFO) `echo $< | sed 's,.*/,,'` .dvi.ps: $(DVIPS) $< -o $@ install-info-am: $(INFO_DEPS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(infodir) + $(mkinstalldirs) $(DESTDIR)$(infodir) @for file in $(INFO_DEPS); do \ d=$(srcdir); \ for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \ if test -f $$d/$$ifile; then \ - echo " $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile"; \ - $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile; \ + echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \ + $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \ else : ; fi; \ done; \ done @$(POST_INSTALL) - @if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \ + @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \ for file in $(INFO_DEPS); do \ - echo " install-info --info-dir=$(infodir) $(infodir)/$$file";\ - install-info --info-dir=$(infodir) $(infodir)/$$file; :;\ + echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\ + install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\ done; \ else : ; fi uninstall-info: $(PRE_UNINSTALL) - if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \ + @if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \ ii=yes; \ else ii=; fi; \ for file in $(INFO_DEPS); do \ - test -z $ii || install-info --info-dir=$(infodir) --remove $$file; \ + test -z "$ii" \ + || install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \ done - $(NORMAL_UNINSTALL) + @$(NORMAL_UNINSTALL) for file in $(INFO_DEPS); do \ - (cd $(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \ + (cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \ done dist-info: $(INFO_DEPS) @@ -169,39 +197,61 @@ dist-info: $(INFO_DEPS) done; \ done -mostlyclean-info: - rm -f dc.aux dc.cp dc.cps dc.dvi dc.fn dc.fns dc.ky dc.log dc.pg dc.toc \ - dc.tp dc.tps dc.vr dc.vrs dc.op dc.tr dc.cv +mostlyclean-aminfo: + -rm -f dc.aux dc.cp dc.cps dc.dvi dc.fn dc.fns dc.ky dc.kys dc.ps \ + dc.log dc.pg dc.toc dc.tp dc.tps dc.vr dc.vrs dc.op dc.tr \ + dc.cv dc.cn -clean-info: +clean-aminfo: -distclean-info: +distclean-aminfo: -maintainer-clean-info: - for i in $(INFO_DEPS); do rm -f `eval echo $$i*`; done -install-man: $(MANS) - $(NORMAL_INSTALL) - $(mkinstalldirs) $(mandir)/man1 - @sect=1; \ - inst=`echo "bc" | sed '$(transform)'`.1; \ - if test -f $(srcdir)/bc.1; then file=$(srcdir)/bc.1; \ - else file=bc.1; fi; \ - echo " $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst"; \ - $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst - @sect=1; \ - inst=`echo "dc" | sed '$(transform)'`.1; \ - if test -f $(srcdir)/dc.1; then file=$(srcdir)/dc.1; \ - else file=dc.1; fi; \ - echo " $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst"; \ - $(INSTALL_DATA) $$file $(mandir)/man$$sect/$$inst +maintainer-clean-aminfo: + for i in $(INFO_DEPS); do \ + rm -f $$i; \ + if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \ + rm -f $$i-[0-9]*; \ + fi; \ + done -uninstall-man: - $(NORMAL_UNINSTALL) - inst=`echo "bc" | sed '$(transform)'`.1; \ - rm -f $(mandir)/man1/$$inst - inst=`echo "dc" | sed '$(transform)'`.1; \ - rm -f $(mandir)/man1/$$inst +install-man1: + $(mkinstalldirs) $(DESTDIR)$(man1dir) + @list='$(man1_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \ + done +uninstall-man1: + @list='$(man1_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \ + rm -f $(DESTDIR)$(man1dir)/$$inst; \ + done +install-man: $(MANS) + @$(NORMAL_INSTALL) + $(MAKE) install-man1 +uninstall-man: + @$(NORMAL_UNINSTALL) + $(MAKE) uninstall-man1 tags: TAGS TAGS: @@ -209,6 +259,7 @@ TAGS: distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) subdir = doc + distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ @@ -216,7 +267,7 @@ distdir: $(DISTFILES) || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ || cp -p $$d/$$file $(distdir)/$$file; \ done - $(MAKE) distdir="$(distdir)" dist-info + $(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info info: $(INFO_DEPS) dvi: $(DVIS) check: all @@ -233,46 +284,44 @@ install: install-exec install-data all uninstall: uninstall-info uninstall-man -all: $(INFO_DEPS) $(MANS) Makefile - install-strip: - $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install installdirs: - $(mkinstalldirs) $(infodir) $(mandir)/man1 + $(mkinstalldirs) $(DESTDIR)$(infodir) $(DESTDIR)$(mandir)/man1 mostlyclean-generic: - test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) clean-generic: - test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - rm -f Makefile $(DISTCLEANFILES) - rm -f config.cache config.log stamp-h - test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -rm -f Makefile $(DISTCLEANFILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: - test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) - test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -mostlyclean: mostlyclean-info mostlyclean-generic + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +mostlyclean: mostlyclean-aminfo mostlyclean-generic -clean: clean-info clean-generic mostlyclean +clean: clean-aminfo clean-generic mostlyclean -distclean: distclean-info distclean-generic clean - rm -f config.status +distclean: distclean-aminfo distclean-generic clean + -rm -f config.status -maintainer-clean: maintainer-clean-info maintainer-clean-generic \ +maintainer-clean: maintainer-clean-aminfo maintainer-clean-generic \ distclean @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." -.PHONY: default install-info-am uninstall-info mostlyclean-info \ -distclean-info clean-info maintainer-clean-info install-man \ -uninstall-man tags distdir info dvi installcheck install-exec \ -install-data install uninstall all installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean +.PHONY: install-info-am uninstall-info mostlyclean-aminfo \ +distclean-aminfo clean-aminfo maintainer-clean-aminfo install-man1 \ +uninstall-man1 install-man uninstall-man tags distdir info dvi \ +installcheck install-exec install-data install uninstall all \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/contrib/bc/doc/dc.texi b/contrib/bc/doc/dc.texi index e0ade80..968a819 100644 --- a/contrib/bc/doc/dc.texi +++ b/contrib/bc/doc/dc.texi @@ -27,7 +27,7 @@ Published by the Free Software Foundation, 675 Massachusetts Avenue, Cambridge, MA 02139 USA -Copyright (C) 1984 Free Software Foundation, Inc. +Copyright (C) 1984, 1994, 1997, 1998 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -60,7 +60,7 @@ by the Foundation. @author original manual by Richard Stallman @page @vskip 0pt plus 1filll -Copyright @copyright{} 1994, 1997 Free Software Foundation, Inc. +Copyright @copyright{} 1994, 1997, 1998 Free Software Foundation, Inc. @sp 2 Published by the Free Software Foundation, @* @@ -97,7 +97,7 @@ by the Foundation. * Strings:: Strings * Status Inquiry:: Status Inquiry * Miscellaneous:: Other commands -* Notes:: Notes +* Reporting bugs:: Reporting bugs @end menu @node Introduction, Invocation, Top, Top @@ -172,9 +172,23 @@ Prints the value on the top of the stack, without altering the stack. A newline is printed after the value. -@item P +@item n Prints the value on the top of the stack, popping it off, and does not print a newline after. +(This command is a GNU extension.) + +@item P +Pops off the value on top of the stack. +If it it a string, it is simply printed without a trailing newline. +Otherwise it is a number, and the integer portion of its absolute +value is printed out as a "base (UCHAR_MAX+1)" byte stream. +Assuming that (UCHAR_MAX+1) is 256 +(as it is on most machines with 8-bit bytes), +the sequence +@code{KSK 0k1/ [_1*]sx d0>x [256~aPd0<x]dsxx sxLKk} +could also accomplish this function, +except for the side-effect of clobbering the x register. +(Details of the behavior with a number are a GNU extension.) @item f Prints the entire contents of the stack @@ -199,9 +213,12 @@ from the second one popped, and pushes the result. @item * Pops two values, multiplies them, and pushes the result. -The number of fraction digits in the result is controlled -by the current precision value (see below) and does not -depend on the values being multiplied. +The number of fraction digits in the result is the largest of +the precision value, +the number of fraction digits in the multiplier, +or the number of fraction digits in the multiplicand; +but in no event exceeding the number of digits required for +an exact result. @item / Pops two values, divides the second one popped @@ -213,9 +230,8 @@ Pops two values, computes the remainder of the division that the @samp{/} command would do, and pushes that. -The division is done with as many fraction digits -as the precision value specifies, -and the remainder is also computed with that many fraction digits. +The value computed is the same as that computed by +the sequence @code{Sd dld/ Ld*-} . @item ~ Pops two values, @@ -244,11 +260,11 @@ is not an integer. The second popped is used as the exponent; this value must be a non-negative number, and any fractional part of this exponent will be ignored. -The third value popped is the base which gets exponentiated. -The precision value specifies the number of fraction -digits in the result. -For small numbers this is like the sequence @code{Sm lble^ Lm%}, +The third value popped is the base which gets exponentiated, +which should be an integer. +For small integers this is like the sequence @code{Sm^Lm%}, but, unlike @code{^}, this command will work with arbritrarily large exponents. +(This command is a GNU extension.) @item v Pops one value, computes its square root, and pushes that. @@ -262,11 +278,6 @@ The default precision value is zero, which means that all arithmetic except for addition and subtraction produces integer results. -The remainder operation (@samp{%}) requires some explanation: -applied to arguments @samp{a} and @samp{b} -it produces @samp{a - (b * (a / b))}, -where @samp{a / b} is computed in the current precision. - @node Stack Control, Registers, Arithmetic, Top @chapter Stack Control @@ -287,7 +298,8 @@ Reverses the order of (swaps) the top two values on the stack. @node Registers, Parameters, Stack Control, Top @chapter Registers -@sc{dc} provides 256 memory registers, each named by a single character. +@sc{dc} provides at least 256 memory registers, +each named by a single character. You can store a number in a register and retrieve it later. @table @samp @@ -333,7 +345,7 @@ The output radix is used for printing numbers. The input and output radices are separate parameters; you can make them unequal, which can be useful or confusing. -The input radix must be between 2 and 36 inclusive. +The input radix must be between 2 and 16 inclusive. The output radix must be at least 2. The precision must be zero or greater. The precision is always measured in decimal digits, @@ -412,13 +424,25 @@ if the original top-of-stack is greater. Thus, @samp{1 2>a} will invoke register @samp{a}'s contents and @samp{2 1>a} will not. +@item !>@var{r} +Similar but invokes the macro if the original top-of-stack is not greater +(is less than or equal to) what was the second-to-top. + @item <@var{r} Similar but invokes the macro if the original top-of-stack is less. +@item !<@var{r} +Similar but invokes the macro if the original top-of-stack is not less +(is greater than or equal to) what was the second-to-top. + @item =@var{r} Similar but invokes the macro if the two numbers popped are equal. @c This can also be validly used to compare two strings for equality. +@item !=@var{r} +Similar but invokes the macro if the two numbers popped are not equal. +@c This can also be validly used to compare two strings for equality. + @item ? Reads a line from the terminal and executes it. This command allows a macro to request input from the user. @@ -455,17 +479,20 @@ For a string, the value pushed is 0. @item z -Pushes the current stack depth; +Pushes the current stack depth: the number of objects on the stack before the execution of the @samp{z} command. @end table -@node Miscellaneous, Notes, Status Inquiry, Top +@node Miscellaneous, Reporting bugs, Status Inquiry, Top @chapter Miscellaneous @table @samp @item ! Will run the rest of the line as a system command. +Note that parsing of the !<, !=, and !> commands take precidence, +so if you want to run a command starting with <, =, or > you will +need to add a space after the !. @item # Will interpret the rest of the line as a comment. @@ -482,13 +509,14 @@ the array @var{r}. The selected value is then pushed onto the stack. @end table -@node Notes, , Miscellaneous, Top -@chapter Notes +Note that each stacked instance of a register has its own +array associated with it. +Thus @samp{1 @var{0:a} 0S@var{a} 2 @var{0:a} L@var{a} @var{0;a}p} +will print 1, because the 2 was stored in an instance of @var{0:a} +that was later popped. -The array operations @samp{:} and @samp{;} are usually -only used by traditional implementations of BC. -(The GNU implementation of BC is self contained -and does not need any version of @sc{dc} to run.) +@node Reporting bugs, , Miscellaneous, Top +@chapter Reporting bugs Email bug reports to @code{bug-gnu-utils@@prep.ai.mit.edu}. Be sure to include the word ``dc'' somewhere in the ``Subject:'' field. diff --git a/contrib/bc/h/bcdefs.h b/contrib/bc/h/bcdefs.h index 97d7c81..0e51b2b 100644 --- a/contrib/bc/h/bcdefs.h +++ b/contrib/bc/h/bcdefs.h @@ -33,7 +33,7 @@ #include <stdio.h> #include <sys/types.h> #include <ctype.h> -#ifdef STRINGS_H +#ifdef HAVE_STRINGS_H #include <strings.h> #else #include <string.h> diff --git a/contrib/bc/h/version.h b/contrib/bc/h/version.h index fd58fcd..b98222f 100644 --- a/contrib/bc/h/version.h +++ b/contrib/bc/h/version.h @@ -1,7 +1,7 @@ /* version.h: version information for GNU bc and GNU dc */ /* This file is part of GNU bc and GNU dc. - * Copyright (C) 1994, 1997 Free Software Foundation, Inc. + * Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,10 +20,9 @@ */ #define BC_VERSION \ -"bc 1.04\nCopyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc." +"bc 1.05\n\ +Copyright 1991, 1992, 1993, 1994, 1997, 1998 Free Software Foundation, Inc." #define DC_VERSION \ -"dc 1.1 (GNU bc 1.04)\nCopyright (C) 1994, 1997 Free Software Foundation, Inc." - - - +"dc 1.2 (GNU bc 1.05)\n\ +Copyright 1994, 1997, 1998 Free Software Foundation, Inc." diff --git a/contrib/bc/lib/Makefile.in b/contrib/bc/lib/Makefile.in index 2b58b3c..4d3ca83 100644 --- a/contrib/bc/lib/Makefile.in +++ b/contrib/bc/lib/Makefile.in @@ -1,8 +1,14 @@ -# Makefile.in generated automatically by automake 1.1n from Makefile.am +# Makefile.in generated automatically by automake 1.3 from Makefile.am -# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. +# 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 = /bin/sh @@ -26,6 +32,8 @@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include +DISTDIR = + pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ @@ -43,14 +51,15 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ transform = @program_transform_name@ -NORMAL_INSTALL = true -PRE_INSTALL = true -POST_INSTALL = true -NORMAL_UNINSTALL = true -PRE_UNINSTALL = true -POST_UNINSTALL = true +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : CC = @CC@ LEX = @LEX@ +MAKEINFO = @MAKEINFO@ PACKAGE = @PACKAGE@ RANLIB = @RANLIB@ VERSION = @VERSION@ @@ -76,7 +85,7 @@ libbc_a_OBJECTS = getopt.o getopt1.o vfprintf.o number.o AR = ar CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -LINK = $(CC) $(LDFLAGS) -o $@ +LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@ DIST_COMMON = Makefile.am Makefile.in @@ -87,14 +96,14 @@ GZIP = --best SOURCES = $(libbc_a_SOURCES) OBJECTS = $(libbc_a_OBJECTS) -default: all +all: Makefile $(LIBRARIES) .SUFFIXES: -.SUFFIXES: .c .o -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile +.SUFFIXES: .S .c .o .s +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps lib/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status @@ -102,7 +111,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) mostlyclean-noinstLIBRARIES: clean-noinstLIBRARIES: - test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) distclean-noinstLIBRARIES: @@ -111,47 +120,56 @@ maintainer-clean-noinstLIBRARIES: .c.o: $(COMPILE) -c $< +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + mostlyclean-compile: - rm -f *.o core + -rm -f *.o core *.core clean-compile: distclean-compile: - rm -f *.tab.c + -rm -f *.tab.c maintainer-clean-compile: libbc.a: $(libbc_a_OBJECTS) $(libbc_a_DEPENDENCIES) - rm -f libbc.a + -rm -f libbc.a $(AR) cru libbc.a $(libbc_a_OBJECTS) $(libbc_a_LIBADD) $(RANLIB) libbc.a tags: TAGS -ID: $(HEADERS) $(SOURCES) - here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS) +ID: $(HEADERS) $(SOURCES) $(LISP) + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP) -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) tags=; \ here=`pwd`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ - done; \ - test -z "$(ETAGS_ARGS)$(SOURCES)$(HEADERS)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $(SOURCES) $(HEADERS) -o $$here/TAGS) + 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 + -rm -f TAGS ID maintainer-clean-tags: distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) subdir = lib + distdir: $(DISTFILES) @for file in $(DISTFILES); do \ d=$(srcdir); \ @@ -175,27 +193,25 @@ install: install-exec install-data all uninstall: -all: $(LIBRARIES) Makefile - install-strip: - $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install installdirs: mostlyclean-generic: - test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) clean-generic: - test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - rm -f Makefile $(DISTCLEANFILES) - rm -f config.cache config.log stamp-h - test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -rm -f Makefile $(DISTCLEANFILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: - test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) - test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) mostlyclean: mostlyclean-noinstLIBRARIES mostlyclean-compile \ mostlyclean-tags mostlyclean-generic @@ -204,7 +220,7 @@ clean: clean-noinstLIBRARIES clean-compile clean-tags clean-generic \ distclean: distclean-noinstLIBRARIES distclean-compile distclean-tags \ distclean-generic clean - rm -f config.status + -rm -f config.status maintainer-clean: maintainer-clean-noinstLIBRARIES \ maintainer-clean-compile maintainer-clean-tags \ @@ -212,7 +228,7 @@ maintainer-clean: maintainer-clean-noinstLIBRARIES \ @echo "This command is intended for maintainers to use;" @echo "it deletes files that may require special tools to rebuild." -.PHONY: default mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ +.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ mostlyclean-compile distclean-compile clean-compile \ maintainer-clean-compile tags mostlyclean-tags distclean-tags \ diff --git a/contrib/bc/lib/number.c b/contrib/bc/lib/number.c index e1ada04..469d44c8b 100644 --- a/contrib/bc/lib/number.c +++ b/contrib/bc/lib/number.c @@ -1,7 +1,7 @@ /* number.c: Implements arbitrary precision numbers. */ /* This file is part of GNU bc. - Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. + Copyright (C) 1991, 1992, 1993, 1994, 1997, 1998 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1031,6 +1031,10 @@ bc_raisemod (base, expo, mod, result, scale) temp = copy_num (_one_); init_num (&parity); + /* Check the base for scale digits. */ + if (base->n_scale != 0) + rt_warn ("non-zero scale in base"); + /* Check the exponent for scale digits. */ if (exponent->n_scale != 0) { @@ -1209,8 +1213,11 @@ bc_sqrt (num, scale) /* Calculate the initial guess. */ if (cmp_res < 0) - /* The number is between 0 and 1. Guess should start at 1. */ - guess = copy_num (_one_); + { + /* The number is between 0 and 1. Guess should start at 1. */ + guess = copy_num (_one_); + cscale = (*num)->n_scale; + } else { /* The number is greater than 1. Guess should start at 10^(exp/2). */ @@ -1221,11 +1228,11 @@ bc_sqrt (num, scale) guess1->n_scale = 0; bc_raise (guess, guess1, &guess, 0); free_num (&guess1); + cscale = 3; } /* Find the square root using Newton's algorithm. */ done = FALSE; - cscale = 3; while (!done) { free_num (&guess1); |