This commit was generated by cvs2svn to compensate for changes in r56101,
which included commits to RCS files with non-trunk default branches.
This commit is contained in:
commit
23ef7a8bc9
@ -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
|
||||
|
@ -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 \
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@for subdir in $(SUBDIRS); do \
|
||||
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 "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@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 "$$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
|
||||
-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 \
|
||||
.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 \
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
59
contrib/bc/aclocal.m4
vendored
59
contrib/bc/aclocal.m4
vendored
@ -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])
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 \
|
||||
|
@ -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
|
||||
|
||||
|
888
contrib/bc/configure
vendored
888
contrib/bc/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -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)
|
||||
|
@ -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 \
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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 *));
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
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
|
||||
|
||||
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)
|
||||
$(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
|
||||
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) install-man1
|
||||
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
|
||||
|
||||
@$(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.
|
||||
|
@ -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.
|
||||
|
@ -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>
|
||||
|
@ -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."
|
||||
|
@ -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 \
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user