mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
b4952bd44f | ||
|
0d06d90751 | ||
|
e1a3dfda0b | ||
|
8db4e7af47 | ||
|
bb5c624382 |
110
CHANGES
110
CHANGES
@@ -1,4 +1,108 @@
|
||||
The following are the changes from calc version 2.11.6.0 to date:
|
||||
The following are the changes from calc version 2.11.8.0 to date:
|
||||
|
||||
Updated HOWTO.INSTALL to reflect the new RPM files.
|
||||
|
||||
Clarify that the internal hash as well as the hash builtin
|
||||
function used by calc, while based on the Fowler/Noll/Vo
|
||||
hash is NOT an FNV hash.
|
||||
|
||||
Made slight performance improvements to calc by an optimization of how
|
||||
calc's internal hash is computed. The "make chk" regression test
|
||||
runs about 1.5% faster (when compiled with -O3 on an AMD Athlon)
|
||||
NO_HASH_CPU_OPTIMIZATION is not defined. Calc's internal hash values
|
||||
have not changed. By default, NO_HASH_CPU_OPTIMIZATION is NOT defined
|
||||
and the slightly faster expression is used.
|
||||
|
||||
A slight modification of what was known as the "calc new stardard"
|
||||
configuration (calc -n or config("all", "newstd")) is now the default
|
||||
calc configuration. The flag:
|
||||
|
||||
calc -O
|
||||
|
||||
was added to get the old classic calc configuration. The flag command
|
||||
line flag, -n, now does nothing. Use of -n is deprecated and may go
|
||||
away / be used for something else in the future.
|
||||
|
||||
The following table gives the summary of these changes:
|
||||
|
||||
pre v2.11.8 v2.11.8
|
||||
default pre v2.11.8 -O & oldstd v2.11.8
|
||||
and oldstd -n & newstd classic cfg default
|
||||
--------------------------------------------------------
|
||||
epsilon 1e-20 1e-10 1e-20 1e-20
|
||||
quo 2 2 2 2
|
||||
outround 2 24 2 24
|
||||
leadzero 0 1 0 1
|
||||
fullzero 0 1 0 0
|
||||
prompt > ; > ;
|
||||
more >> ;; >> ;;
|
||||
|
||||
With the exception of epsilon being 1e-20, and fullzero being unset,
|
||||
the new default calc config is like it was (pre-2.11.8) with calc -n /
|
||||
config("all", "newstd").
|
||||
|
||||
The new default config is the old classic config with outround being
|
||||
24, leadzero being set, and the prompts being ;'s.
|
||||
|
||||
Fixed a bug in the evaluation of tanh(1e-23) with an epsilon(1e-100).
|
||||
Thanks goes to Dmitry G. Baksheyev <bd at nbsp dot nsk dot su>
|
||||
for reprting the problem, and thanks goes to Ernest Bowen
|
||||
<ernie at turing dot une dot edu dot au> for the fix.
|
||||
|
||||
The following are the changes from calc version 2.11.7.0 to 2.11.7.1:
|
||||
|
||||
Added support to build calc RPMs thanks to Petteri Kettunen
|
||||
<petterik at users dot sourceforge dot net>.
|
||||
|
||||
Added rpm rule to Makefile to build rpm set. The rpm rule
|
||||
uses the rpm.mk Makefile and the calc.spec.in spec template.
|
||||
|
||||
The default Makefile is now the Makefile used during rpm
|
||||
creation. This Makefile assumes that system has readline,
|
||||
ncurses (-lreadline -lhistory -lncurses), and less.
|
||||
It compiled with a high gcc optimization level (-O3 -g3).
|
||||
The Makefile used during rpm creation is the Makefile
|
||||
that appears in the calc-src rpm as well.
|
||||
|
||||
The Makefile shipped with the old style gziped tarball
|
||||
is still the same generic Makefile.
|
||||
|
||||
The Makefile now uses ${MKDIR} ${MKDIR_ARG} when creating
|
||||
directories during installation. By default, it does
|
||||
a mkdir -p when forming directories.
|
||||
|
||||
Fixed attributes on include and lib calc-devel files.
|
||||
|
||||
Adjusted the interaction between rpm.mk, and the calc.spec.in.
|
||||
Release number now comes from calc.spec.in only.
|
||||
|
||||
Renamed calc and calc-devel RPMs to use .i686 instead of .i386.
|
||||
|
||||
|
||||
The following are the changes from calc version 2.11.6.3 to date:
|
||||
|
||||
Fixed a bug in deg.cal where fixdms() was being called with
|
||||
the wrong type of argument.
|
||||
|
||||
Changed the value of digits(1) and digits(0) to be 1. Now digits()
|
||||
returns number of digits in the standard base-b representation
|
||||
when x is truncated to an integer and the sign is ignored.
|
||||
To be more precise: when abs(int(x)) > 0, this function returns
|
||||
the value 1 + ilog(x, b). When abs(int(x)) == 0, then this
|
||||
function returns the value 1.
|
||||
|
||||
As the result of the above digits() change, the repeat.cal
|
||||
resource file script was modified to remove the special
|
||||
case for repeating a value of 1. Also the regress tests
|
||||
#715, #977 and #978 were changed.
|
||||
|
||||
Made a minor improvement to the "help places" documentation.
|
||||
|
||||
Fixed dms_neg(a) in deg.cal thanks to a bug report by kaa
|
||||
<kaa76 at pochtamt dot ru>.
|
||||
|
||||
|
||||
The following are the changes from calc version 2.11.6.0 to 2.11.6.2:
|
||||
|
||||
Clarified remark in lucas.cal about use of n mod 2^n == 0.
|
||||
|
||||
@@ -5508,8 +5612,8 @@ Following is a list of visible changes to calc from version 1.24.7 to 1.26.1:
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.54 $
|
||||
## @(#) $Id: CHANGES,v 29.54 2003/01/14 04:04:26 chongo Exp $
|
||||
## @(#) $Revision: 29.60 $
|
||||
## @(#) $Id: CHANGES,v 29.60 2003/08/26 04:35:45 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
|
||||
##
|
||||
## Under source code control: 1993/06/02 18:12:57
|
||||
|
5
COPYING
5
COPYING
@@ -12,8 +12,8 @@ This file is Copyrighted
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
# @(#) $Revision: 29.6 $
|
||||
# @(#) $Id: COPYING,v 29.6 2001/06/01 11:26:53 chongo Exp $
|
||||
# @(#) $Revision: 29.7 $
|
||||
# @(#) $Id: COPYING,v 29.7 2003/02/26 16:54:59 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/RCS/COPYING,v $
|
||||
|
||||
=-=
|
||||
@@ -164,6 +164,7 @@ Calc copyrights and exception files
|
||||
Copyright (C) year Landon Curt Noll
|
||||
Copyright (C) year Ernest Bowen and Landon Curt Noll
|
||||
Copyright (C) year Ernest Bowen
|
||||
Copyright (C) year Petteri Kettunen and Landon Curt Noll
|
||||
|
||||
These files are not covered under one of the Copyrights listed above:
|
||||
|
||||
|
@@ -1,4 +1,29 @@
|
||||
Installing calc in 4 easy steps:
|
||||
Installing calc from the gziped tarball in 4 easy steps:
|
||||
|
||||
0) If your platform supports i686 RPMs, you may want to go to:
|
||||
|
||||
http://www.isthe.com/chongo/src/calc/
|
||||
|
||||
and use these RPMs:
|
||||
|
||||
* calc*.i686.rpm
|
||||
- all that is needed if you just want to use calc
|
||||
|
||||
* calc-devel-*.i686.rpm
|
||||
- calc *.h header and *.a lib files for use in other programs
|
||||
|
||||
* calc.*.src.rpm
|
||||
- calc source in RPM package form
|
||||
|
||||
The following 4 steps apply to calc source tree that comes from either:
|
||||
|
||||
gunzip -c calc-*.tar.gz | tar -xvf -
|
||||
|
||||
or from:
|
||||
|
||||
rpm -ivh calc-*.src.rpm
|
||||
cd /var/tmp
|
||||
gunzip -c /usr/src/redhat/SOURCES/calc-*.tar.gz | tar -xvf -
|
||||
|
||||
1) Look at the makefile, and adjust it to suit your needs.
|
||||
|
||||
@@ -137,8 +162,8 @@ the calc help subsystem. See the README file for details.
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.6 $
|
||||
## @(#) $Id: HOWTO.INSTALL,v 29.6 2002/03/14 00:28:28 chongo Exp $
|
||||
## @(#) $Revision: 29.7 $
|
||||
## @(#) $Id: HOWTO.INSTALL,v 29.7 2003/04/15 03:38:34 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/RCS/HOWTO.INSTALL,v $
|
||||
##
|
||||
## Under source code control: 1999/09/27 20:48:44
|
||||
|
223
Makefile
223
Makefile
@@ -4,7 +4,13 @@
|
||||
#
|
||||
# (Generic calc makefile)
|
||||
#
|
||||
# Copyright (C) 1999 Landon Curt Noll
|
||||
# NOTE: This is NOT the calc rpm Makefile. This Makefile is a generic
|
||||
# Makefile for the people who build calc from the gziped tarball.
|
||||
# Without modification, it not assume the system has readline, ncurses
|
||||
# or less. It compiles with gcc -O2 -g as well. You can change all
|
||||
# this by modifying the Makefile variables below.
|
||||
#
|
||||
# Copyright (C) 1999-2003 Landon Curt Noll
|
||||
#
|
||||
# Calc is open software; you can redistribute it and/or modify it under
|
||||
# the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -20,8 +26,8 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
MAKEFILE_REV= $$Revision: 29.53 $$
|
||||
# @(#) $Id: Makefile.ship,v 29.53 2003/01/14 02:33:07 chongo Exp $
|
||||
MAKEFILE_REV= $$Revision: 29.62 $$
|
||||
# @(#) $Id: Makefile.ship,v 29.62 2003/02/25 17:38:22 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $
|
||||
#
|
||||
# Under source code control: 1990/02/15 01:48:41
|
||||
@@ -937,6 +943,20 @@ CALC_ENV= CALCPATH=./cal
|
||||
ALLOW_CUSTOM= -DCUSTOM
|
||||
#ALLOW_CUSTOM=
|
||||
|
||||
# The install rule uses:
|
||||
#
|
||||
# ${MKDIR} ${MKDIR_ARG}
|
||||
#
|
||||
# to create directorties. Normall this amounts to usins mkdir -p dir ...
|
||||
# Some older systems may not have mkdir -p. If you system does not
|
||||
# make mkdir -p, then set MKDIR_ARG to empty.
|
||||
#
|
||||
# MKDIR_ARG= -p # use mkdir -p when creating paths
|
||||
# MKDIR_ARG= # use if system does not understand mkdir -p
|
||||
#
|
||||
MKDIR_ARG= -p
|
||||
#MKDIR_ARG=
|
||||
|
||||
################
|
||||
# compiler set #
|
||||
################
|
||||
@@ -1166,9 +1186,9 @@ CHMOD= chmod
|
||||
FMT= fmt
|
||||
XARGS= xargs
|
||||
CMP= cmp
|
||||
MKDIR= mkdir
|
||||
# assume the X11 makedepend tool for the depend rule
|
||||
MAKEDEPEND= makedepend
|
||||
|
||||
# echo command location
|
||||
#
|
||||
# Select ECHO= echo for DJGPP.
|
||||
@@ -1446,7 +1466,8 @@ LICENSE= COPYING COPYING-LGPL
|
||||
# These files are found (but not built) in the distribution
|
||||
#
|
||||
DISTLIST= ${C_SRC} ${H_SRC} ${MAKE_FILE} BUGS CHANGES LIBRARY README \
|
||||
README.WINDOWS calc.man HOWTO.INSTALL ${UTIL_MISC_SRC} ${LICENSE}
|
||||
README.WINDOWS calc.man HOWTO.INSTALL ${UTIL_MISC_SRC} ${LICENSE} \
|
||||
calc.spec.in rpm.mk
|
||||
|
||||
# These files are used to make (but not built) a calc .a link library
|
||||
#
|
||||
@@ -1476,11 +1497,6 @@ SAMPLE_TARGETS= sample/test_random sample/many_random
|
||||
CSCRIPT_TARGETS= cscript/mersenne cscript/piforever cscript/plus \
|
||||
cscript/square cscript/fproduct cscript/powerterm
|
||||
|
||||
# List of miscellaneous files NOT shipped with calc
|
||||
#
|
||||
NO_SHIP= Makefile.linux calc.spec inst_files spec-template \
|
||||
rpm.mk.patch rpm.release
|
||||
|
||||
# complete list of progs built
|
||||
#
|
||||
PROGS= calc ${UTIL_PROGS}
|
||||
@@ -2901,7 +2917,7 @@ no_implicit.arg: no_implicit.c ${MAKE_FILE}
|
||||
win32_hsrc: ${MAKE_FILE} win32.mkdef
|
||||
${Q}echo 'forming win32 directory'
|
||||
${Q}rm -rf win32
|
||||
${Q}mkdir win32
|
||||
${Q}${MKDIR} win32
|
||||
${Q}cp ${UTIL_C_SRC} win32
|
||||
${Q}cp ${UTIL_MISC_SRC} Makefile win32
|
||||
${Q}(cd win32; \
|
||||
@@ -3032,8 +3048,8 @@ custom/libcustcalc.a:
|
||||
bsdi: ${LIB_H_SRC} ${BUILD_H_SRC} calc.1
|
||||
${V} echo '=-=-=-=-= start of $@ rule =-=-=-=-='
|
||||
-${Q}if [ ! -d gen_h ]; then \
|
||||
echo mkdir gen_h; \
|
||||
mkdir gen_h; \
|
||||
echo ${MKDIR} gen_h; \
|
||||
${MKDIR} gen_h; \
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
@@ -3077,12 +3093,12 @@ depend: hsrc
|
||||
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
|
||||
${Q}echo forming skel
|
||||
-${Q}rm -rf skel
|
||||
${Q}mkdir skel
|
||||
${Q}${MKDIR} skel
|
||||
-${Q}for i in ${C_SRC} ${BUILD_C_SRC}; do \
|
||||
${SED} -n '/^#[ ]*include[ ]*"/p' "$$i" | \
|
||||
${GREP} -v '\.\./getopt/getopt\.h' > "skel/$$i"; \
|
||||
done
|
||||
${Q}mkdir skel/custom
|
||||
${Q}${MKDIR} skel/custom
|
||||
-${Q}for i in ${H_SRC} ${BUILD_H_SRC} custom.h /dev/null; do \
|
||||
if [ X"$$i" != X"/dev/null" ]; then \
|
||||
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
||||
@@ -3382,49 +3398,23 @@ dbx:
|
||||
gdb:
|
||||
${CALC_ENV} gdb ./calc
|
||||
|
||||
|
||||
##
|
||||
#
|
||||
# rpm rules
|
||||
#
|
||||
##
|
||||
|
||||
# create an rpm spec file from the spec-template
|
||||
rpm: clobber rpm.mk calc.spec.in
|
||||
rm -rf /var/tmp/redhat
|
||||
${MAKE} -f rpm.mk RHDIR=/var/tmp/redhat TMPDIR=/var/tmp/redhat
|
||||
|
||||
|
||||
##
|
||||
#
|
||||
# This file is linked to calc-version-rel.spec before the rpm is built.
|
||||
# Utility rules
|
||||
#
|
||||
calc.spec: spec-template ${MAKE_FILE} help/Makefile cal/Makefile \
|
||||
custom/Makefile cscript/Makefile ver_calc rpm.release
|
||||
${V} echo '=-=-=-=-= start of $@ rule =-=-=-=-='
|
||||
${Q}rm -f calc.spec calc.spec.sed
|
||||
${Q}echo 's,$${BINDIR},${BINDIR},g' >> calc.spec.sed
|
||||
${Q}echo 's,$${INCDIR},${INCDIR},g' >> calc.spec.sed
|
||||
${Q}echo 's:$${LIBDIR}:${LIBDIR}:g' >> calc.spec.sed
|
||||
${Q}echo 's:$${CALC_SHAREDIR}:${CALC_SHAREDIR}:g' >> calc.spec.sed
|
||||
${Q}echo 's,$${HELPDIR},${HELPDIR},g' >> calc.spec.sed
|
||||
${Q}echo 's,$${CALC_INCDIR},${CALC_INCDIR},g' >> calc.spec.sed
|
||||
${Q}echo 's,$${CUSTOMCALDIR},${CUSTOMCALDIR},g' >> calc.spec.sed
|
||||
${Q}echo 's,$${CUSTOMINCDIR},${CUSTOMINCDIR},g' >> calc.spec.sed
|
||||
${Q}echo 's,$${CUSTOMHELPDIR},${CUSTOMHELPDIR},g' >> calc.spec.sed
|
||||
${Q}echo 's,$${SCRIPTDIR},${SCRIPTDIR},g' >> calc.spec.sed
|
||||
${Q}echo 's,$${MANDIR},${MANDIR},g' >> calc.spec.sed
|
||||
${Q}echo 's,$${LIB_H_SRC},${LIB_H_SRC},g' >> calc.spec.sed
|
||||
${Q}echo 's,$${BUILD_H_SRC},${BUILD_H_SRC},g' >> calc.spec.sed
|
||||
${Q}echo 's,$${ALLOW_CUSTOM},${ALLOW_CUSTOM},g' >> calc.spec.sed
|
||||
${Q}if [ -z "${RANLIB}" ]; then \
|
||||
echo 's,$${RANLIB},:,g' >> calc.spec.sed; \
|
||||
else \
|
||||
echo 's,$${RANLIB},${RANLIB},g' >> calc.spec.sed; \
|
||||
fi
|
||||
${Q}echo 's,$${MANMAKE},${MANMAKE},g' >> calc.spec.sed
|
||||
${Q}echo 's,$${MANMODE},${MANMODE},g' >> calc.spec.sed
|
||||
${Q}echo 's,$${MANEXT},${MANEXT},g' >> calc.spec.sed
|
||||
${Q}echo 's,$${CHMOD},${CHMOD},g' >> calc.spec.sed
|
||||
${Q}echo 's,$${DATE},'`LANG=C date +"%a %b %d %Y"`',g' >> calc.spec.sed
|
||||
${Q}echo 's,$${VERSION},'`./ver_calc`',g' >> calc.spec.sed
|
||||
${Q}echo 's,$${REL},'`./ver_calc -R rpm.release`',g' >> calc.spec.sed
|
||||
${Q}${SED} -f calc.spec.sed < spec-template > calc.spec
|
||||
${Q}rm -f calc.spec.sed
|
||||
${V} echo '=-=-=-=-= end of $@ rule =-=-=-=-='
|
||||
##
|
||||
|
||||
# Form the installed file list
|
||||
#
|
||||
@@ -3457,33 +3447,6 @@ inst_files: ${MAKE_FILE} help/Makefile cal/Makefile custom/Makefile \
|
||||
${Q}LANG=C ${SORT} -u inst_files -o inst_files
|
||||
${V} echo '=-=-=-=-= end of $@ rule =-=-=-=-='
|
||||
|
||||
# We make a small patch to effectively move Makefile.linux into Makefile.
|
||||
#
|
||||
rpm.mk.patch: Makefile.linux ${MAKE_FILE}
|
||||
${V} echo '=-=-=-=-= start of $@ rule =-=-=-=-='
|
||||
${Q}rm -f $@
|
||||
${Q}rm -rf tmp.patch
|
||||
${Q}mkdir -p tmp.patch
|
||||
${Q}if [ -e Makefile.ship ]; then \
|
||||
cp Makefile.ship tmp.patch/Makefile; \
|
||||
else \
|
||||
cp Makefile tmp.patch/Makefile; \
|
||||
fi
|
||||
${Q}cp Makefile.linux tmp.patch
|
||||
${Q}-cd tmp.patch; \
|
||||
${DIFF} -c Makefile Makefile.linux > $@; \
|
||||
true
|
||||
${Q}cp tmp.patch/$@ $@
|
||||
${Q}${CHMOD} 0444 $@
|
||||
${Q}rm -rf tmp.patch
|
||||
${V} echo '=-=-=-=-= end of $@ rule =-=-=-=-='
|
||||
|
||||
##
|
||||
#
|
||||
# Utility rules
|
||||
#
|
||||
##
|
||||
|
||||
# The olduninstall rule will remove calc files from the older, histroic
|
||||
# locations under the /usr/local directory. If you are using the
|
||||
# new default values for ${BINDIR}, ${CALC_SHAREDIR}, ${INCDIR} and ${LIBDIR}
|
||||
@@ -3583,7 +3546,7 @@ clobber:
|
||||
${V} echo remove files that are obsolete
|
||||
-rm -rf lib
|
||||
-rm -f endian.h stdarg.h libcalcerr.a cal/obj help/obj
|
||||
-rm -f have_vs.c std_arg.h try_stdarg.c fnvhash.c
|
||||
-rm -f have_vs.c std_arg.h try_stdarg.c fnvhash.c calc.spec
|
||||
-rm -rf win32
|
||||
${V} echo '=-=-=-=-= end of $@ rule =-=-=-=-='
|
||||
|
||||
@@ -3591,131 +3554,87 @@ install: calc libcalc.a ${LIB_H_SRC} ${BUILD_H_SRC} calc.1
|
||||
${V} echo '=-=-=-=-= start of $@ rule =-=-=-=-='
|
||||
-${Q}if [ ! -z "$T" ]; then \
|
||||
if [ ! -d $T ]; then \
|
||||
echo mkdir $T; \
|
||||
mkdir $T; \
|
||||
if [ ! -d "$T" ]; then \
|
||||
echo mkdir -p "$T"; \
|
||||
mkdir -p "$T"; \
|
||||
fi; \
|
||||
echo ${MKDIR} ${MKDIR_ARG} $T; \
|
||||
${MKDIR} ${MKDIR_ARG} $T; \
|
||||
echo ${CHMOD} 0755 $T; \
|
||||
${CHMOD} 0755 $T; \
|
||||
fi; \
|
||||
fi
|
||||
-${Q}if [ ! -d $T${BINDIR} ]; then \
|
||||
echo mkdir $T${BINDIR}; \
|
||||
mkdir $T${BINDIR}; \
|
||||
if [ ! -d "$T${BINDIR}" ]; then \
|
||||
echo mkdir -p "$T${BINDIR}"; \
|
||||
mkdir -p "$T${BINDIR}"; \
|
||||
fi; \
|
||||
echo ${MKDIR} ${MKDIR_ARG} $T${BINDIR}; \
|
||||
${MKDIR} ${MKDIR_ARG} $T${BINDIR}; \
|
||||
echo ${CHMOD} 0755 $T${BINDIR}; \
|
||||
${CHMOD} 0755 $T${BINDIR}; \
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
-${Q}if [ ! -d $T${INCDIR} ]; then \
|
||||
echo mkdir $T${INCDIR}; \
|
||||
mkdir $T${INCDIR}; \
|
||||
if [ ! -d "$T${INCDIR}" ]; then \
|
||||
echo mkdir -p "$T${INCDIR}"; \
|
||||
mkdir -p "$T${INCDIR}"; \
|
||||
fi; \
|
||||
echo ${MKDIR} ${MKDIR_ARG} $T${INCDIR}; \
|
||||
${MKDIR} ${MKDIR_ARG} $T${INCDIR}; \
|
||||
echo ${CHMOD} 0755 $T${INCDIR}; \
|
||||
${CHMOD} 0755 $T${INCDIR}; \
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
-${Q}if [ ! -d $T${LIBDIR} ]; then \
|
||||
echo mkdir $T${LIBDIR}; \
|
||||
mkdir $T${LIBDIR}; \
|
||||
if [ ! -d "$T${LIBDIR}" ]; then \
|
||||
echo mkdir -p "$T${LIBDIR}"; \
|
||||
mkdir -p "$T${LIBDIR}"; \
|
||||
fi; \
|
||||
echo ${MKDIR} ${MKDIR_ARG} $T${LIBDIR}; \
|
||||
${MKDIR} ${MKDIR_ARG} $T${LIBDIR}; \
|
||||
echo ${CHMOD} 0755 $T${LIBDIR}; \
|
||||
${CHMOD} 0755 $T${LIBDIR}; \
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
-${Q}if [ ! -d $T${CALC_SHAREDIR} ]; then \
|
||||
mkdir $T${CALC_SHAREDIR}; \
|
||||
echo mkdir $T${CALC_SHAREDIR}; \
|
||||
if [ ! -d "$T${CALC_SHAREDIR}" ]; then \
|
||||
echo mkdir -p "$T${CALC_SHAREDIR}"; \
|
||||
mkdir -p "$T${CALC_SHAREDIR}"; \
|
||||
fi; \
|
||||
${MKDIR} ${MKDIR_ARG} $T${CALC_SHAREDIR}; \
|
||||
echo ${MKDIR} ${MKDIR_ARG} $T${CALC_SHAREDIR}; \
|
||||
echo ${CHMOD} 0755 $T${CALC_SHAREDIR}; \
|
||||
${CHMOD} 0755 $T${CALC_SHAREDIR}; \
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
-${Q}if [ ! -d $T${HELPDIR} ]; then \
|
||||
echo mkdir $T${HELPDIR}; \
|
||||
mkdir $T${HELPDIR}; \
|
||||
if [ ! -d "$T${HELPDIR}" ]; then \
|
||||
echo mkdir -p "$T${HELPDIR}"; \
|
||||
mkdir -p "$T${HELPDIR}"; \
|
||||
fi; \
|
||||
echo ${MKDIR} ${MKDIR_ARG} $T${HELPDIR}; \
|
||||
${MKDIR} ${MKDIR_ARG} $T${HELPDIR}; \
|
||||
echo ${CHMOD} 0755 $T${HELPDIR}; \
|
||||
${CHMOD} 0755 $T${HELPDIR}; \
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
-${Q}if [ ! -d $T${CALC_INCDIR} ]; then \
|
||||
echo mkdir $T${CALC_INCDIR}; \
|
||||
mkdir $T${CALC_INCDIR}; \
|
||||
if [ ! -d "$T${CALC_INCDIR}" ]; then \
|
||||
echo mkdir -p "$T${CALC_INCDIR}"; \
|
||||
mkdir -p "$T${CALC_INCDIR}"; \
|
||||
fi; \
|
||||
echo ${MKDIR} ${MKDIR_ARG} $T${CALC_INCDIR}; \
|
||||
${MKDIR} ${MKDIR_ARG} $T${CALC_INCDIR}; \
|
||||
echo ${CHMOD} 0755 $T${CALC_INCDIR}; \
|
||||
${CHMOD} 0755 $T${CALC_INCDIR}; \
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
-${Q}if [ ! -d $T${CUSTOMCALDIR} ]; then \
|
||||
echo mkdir $T${CUSTOMCALDIR}; \
|
||||
mkdir $T${CUSTOMCALDIR}; \
|
||||
if [ ! -d "$T${CUSTOMCALDIR}" ]; then \
|
||||
echo mkdir -p "$T${CUSTOMCALDIR}"; \
|
||||
mkdir -p "$T${CUSTOMCALDIR}"; \
|
||||
fi; \
|
||||
echo ${MKDIR} ${MKDIR_ARG} $T${CUSTOMCALDIR}; \
|
||||
${MKDIR} ${MKDIR_ARG} $T${CUSTOMCALDIR}; \
|
||||
echo ${CHMOD} 0755 $T${CUSTOMCALDIR}; \
|
||||
${CHMOD} 0755 $T${CUSTOMCALDIR}; \
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
-${Q}if [ ! -d $T${CUSTOMHELPDIR} ]; then \
|
||||
echo mkdir $T${CUSTOMHELPDIR}; \
|
||||
mkdir $T${CUSTOMHELPDIR}; \
|
||||
if [ ! -d "$T${CUSTOMHELPDIR}" ]; then \
|
||||
echo mkdir -p "$T${CUSTOMHELPDIR}"; \
|
||||
mkdir -p "$T${CUSTOMHELPDIR}"; \
|
||||
fi; \
|
||||
echo ${MKDIR} ${MKDIR_ARG} $T${CUSTOMHELPDIR}; \
|
||||
${MKDIR} ${MKDIR_ARG} $T${CUSTOMHELPDIR}; \
|
||||
echo ${CHMOD} 0755 $T${CUSTOMHELPDIR}; \
|
||||
${CHMOD} 0755 $T${CUSTOMHELPDIR}; \
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
-${Q}if [ ! -d $T${CUSTOMINCDIR} ]; then \
|
||||
echo mkdir $T${CUSTOMINCDIR}; \
|
||||
mkdir $T${CUSTOMINCDIR}; \
|
||||
if [ ! -d "$T${CUSTOMINCDIR}" ]; then \
|
||||
echo mkdir -p "$T${CUSTOMINCDIR}"; \
|
||||
mkdir -p "$T${CUSTOMINCDIR}"; \
|
||||
fi; \
|
||||
echo ${MKDIR} ${MKDIR_ARG} $T${CUSTOMINCDIR}; \
|
||||
${MKDIR} ${MKDIR_ARG} $T${CUSTOMINCDIR}; \
|
||||
echo ${CHMOD} 0755 $T${CUSTOMINCDIR}; \
|
||||
${CHMOD} 0755 $T${CUSTOMINCDIR}; \
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
-${Q}if [ ! -d $T${SCRIPTDIR} ]; then \
|
||||
echo mkdir $T${SCRIPTDIR}; \
|
||||
mkdir $T${SCRIPTDIR}; \
|
||||
if [ ! -d "$T${SCRIPTDIR}" ]; then \
|
||||
echo mkdir -p "$T${SCRIPTDIR}"; \
|
||||
mkdir -p "$T${SCRIPTDIR}"; \
|
||||
fi; \
|
||||
echo ${MKDIR} ${MKDIR_ARG} $T${SCRIPTDIR}; \
|
||||
${MKDIR} ${MKDIR_ARG} $T${SCRIPTDIR}; \
|
||||
echo ${CHMOD} 0755 $T${SCRIPTDIR}; \
|
||||
${CHMOD} 0755 $T${SCRIPTDIR}; \
|
||||
else \
|
||||
@@ -3723,12 +3642,8 @@ install: calc libcalc.a ${LIB_H_SRC} ${BUILD_H_SRC} calc.1
|
||||
fi
|
||||
-${Q}if [ ! -z "${MANDIR}" ]; then \
|
||||
if [ ! -d $T${MANDIR} ]; then \
|
||||
echo mkdir $T${MANDIR}; \
|
||||
mkdir $T${MANDIR}; \
|
||||
if [ ! -d "$T${MANDIR}" ]; then \
|
||||
echo mkdir -p "$T${MANDIR}"; \
|
||||
mkdir -p "$T${MANDIR}"; \
|
||||
fi; \
|
||||
echo ${MKDIR} ${MKDIR_ARG} $T${MANDIR}; \
|
||||
${MKDIR} ${MKDIR_ARG} $T${MANDIR}; \
|
||||
echo ${CHMOD} 0755 $T${MANDIR}; \
|
||||
${CHMOD} 0755 $T${MANDIR}; \
|
||||
else \
|
||||
@@ -3739,12 +3654,8 @@ install: calc libcalc.a ${LIB_H_SRC} ${BUILD_H_SRC} calc.1
|
||||
fi
|
||||
-${Q}if [ ! -z "${CATDIR}" ]; then \
|
||||
if [ ! -d $T${CATDIR} ]; then \
|
||||
echo mkdir $T${CATDIR}; \
|
||||
mkdir $T${CATDIR}; \
|
||||
if [ ! -d "$T${CATDIR}" ]; then \
|
||||
echo mkdir -p "$T${CATDIR}"; \
|
||||
mkdir -p "$T${CATDIR}"; \
|
||||
fi; \
|
||||
echo ${MKDIR} ${MKDIR_ARG} $T${CATDIR}; \
|
||||
${MKDIR} ${MKDIR_ARG} $T${CATDIR}; \
|
||||
echo ${CHMOD} 0755 $T${CATDIR}; \
|
||||
${CHMOD} 0755 $T${CATDIR}; \
|
||||
else \
|
||||
|
16
cal/deg.cal
16
cal/deg.cal
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.2 $
|
||||
* @(#) $Id: deg.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: deg.cal,v 29.4 2003/01/26 19:32:41 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/deg.cal,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:50:33
|
||||
@@ -42,7 +42,7 @@ define dms(deg, min, sec)
|
||||
ans.deg = deg;
|
||||
ans.min = min;
|
||||
ans.sec = sec;
|
||||
fixdms(&ans);
|
||||
fixdms(ans);
|
||||
return ans;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ define dms_add(a, b)
|
||||
ans.sec += b.sec;
|
||||
} else
|
||||
ans.deg += b;
|
||||
fixdms(&ans);
|
||||
fixdms(ans);
|
||||
return ans;
|
||||
}
|
||||
|
||||
@@ -75,9 +75,9 @@ define dms_neg(a)
|
||||
{
|
||||
local obj dms ans;
|
||||
|
||||
ans.deg = -ans.deg;
|
||||
ans.min = -ans.min;
|
||||
ans.sec = -ans.sec;
|
||||
ans.deg = -a.deg;
|
||||
ans.min = -a.min;
|
||||
ans.sec = -a.sec;
|
||||
return ans;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ define dms_mul(a, b)
|
||||
ans.min = b.min * a;
|
||||
ans.sec = b.sec * a;
|
||||
}
|
||||
fixdms(&ans);
|
||||
fixdms(ans);
|
||||
return ans;
|
||||
}
|
||||
|
||||
|
106
cal/regress.cal
106
cal/regress.cal
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* regress - calc regression and correctness test suite
|
||||
*
|
||||
* Copyright (C) 1999-2002 David I. Bell and Landon Curt Noll
|
||||
* Copyright (C) 1999-2003 David I. Bell and Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.14 $
|
||||
* @(#) $Id: regress.cal,v 29.14 2002/12/29 09:16:07 chongo Exp $
|
||||
* @(#) $Revision: 29.17 $
|
||||
* @(#) $Id: regress.cal,v 29.17 2003/06/10 21:17:55 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:50:36
|
||||
@@ -52,7 +52,8 @@ errmax(-1),; /* prevent errcount from abouting */
|
||||
global ecnt; /* expected value of errcount() */
|
||||
ecnt = 0; /* clear expected errcount() value */
|
||||
|
||||
initcfg = config("all", "oldstd"); /* set config to startup default */
|
||||
initcfg = config("all", "newstd"); /* set config to startup default */
|
||||
defcfg = config("all"); /* capture the default config */
|
||||
config("resource_debug", 0),; /* disable resource startup messages */
|
||||
config("calc_debug", 0),; /* disable internal debugging */
|
||||
config("verbose_quit", 0),; /* disable quit messages */
|
||||
@@ -380,19 +381,19 @@ define test_config()
|
||||
/* check the set and return of all config */
|
||||
callcfg = config("all");
|
||||
print '501: callcfg = config("all")';
|
||||
vrfy(callcfg == startcfg, '502: callcfg == startcfg');
|
||||
|
||||
callcfg = config("all", "oldstd");
|
||||
print '502: callcfg = config("all","oldstd")';
|
||||
oldcfg = config("all", "newstd");
|
||||
print '503: oldcfg = config("all","newstd")';
|
||||
print '503: callcfg = config("all","oldstd")';
|
||||
vrfy(callcfg == startcfg, '504: callcfg == startcfg');
|
||||
newcfg = config("all");
|
||||
print '505: newcfg = config("all")';
|
||||
vrfy(config("all") == newcfg, '506: config("all") == newcfg');
|
||||
vrfy(config("all", oldcfg) == newcfg,
|
||||
'507: config("all", oldcfg) == newcfg');
|
||||
oldcfg = config("all");
|
||||
print '505: oldcfg = config("all");';
|
||||
vrfy(config("all") == oldcfg, '506: config("all") == oldcfg');
|
||||
vrfy(oldcfg==config("all","newstd"),
|
||||
'507: oldcfg==config("all","newstd")');
|
||||
vrfy(defcfg == config("all"), '508: defcfg == config("all")');
|
||||
|
||||
/* vrfy the state of the default config */
|
||||
vrfy(config("all") == oldcfg, '508: config("all") == oldcfg');
|
||||
vrfy(config("mode") == "real",
|
||||
'509: config("mode") == "real"');
|
||||
vrfy(config("display") == 20,
|
||||
@@ -429,58 +430,59 @@ define test_config()
|
||||
'525: config("cfappr") == 0');
|
||||
vrfy(config("cfsim") == 8,
|
||||
'526: config("cfsim") == 8');
|
||||
vrfy(config("outround") == 2,
|
||||
'527: config("outround") == 2');
|
||||
vrfy(config("outround") == 24,
|
||||
'527: config("outround") == 24');
|
||||
vrfy(config("round") == 24,
|
||||
'528: config("round") == 24');
|
||||
vrfy(config("leadzero") == 0,
|
||||
'529: config("leadzero") == 0');
|
||||
vrfy(config("leadzero") == 1,
|
||||
'529: config("leadzero") == 1');
|
||||
vrfy(config("fullzero") == 0,
|
||||
'530: config("fullzero") == 0');
|
||||
vrfy(config("maxscan") == 20,
|
||||
'531: config("maxscan") == 20');
|
||||
vrfy(config("prompt") == "> ",
|
||||
'532: config("prompt") == "> "');
|
||||
vrfy(config("more") == ">> ",
|
||||
'533: config("more") == ">> "');
|
||||
vrfy(config("prompt") == "; ",
|
||||
'532: config("prompt") == "; "');
|
||||
vrfy(config("more") == ";; ",
|
||||
'533: config("more") == ";; "');
|
||||
|
||||
/* convert to "newstd" config by individual changes */
|
||||
vrfy(config("display", 10) == 20,
|
||||
'534: config("display") == 20');
|
||||
vrfy(config("epsilon",1e-10)==1e-20,
|
||||
'535: config("epsilon",1e-10)==1e-20');
|
||||
vrfy(config("quo", 0) == 2, '536: config("quo", 0) == 2');
|
||||
vrfy(config("outround", 24) == 2,
|
||||
'537: config("outround", 24) == 2');
|
||||
vrfy(config("leadzero","y") == 0,
|
||||
'538: config("leadzero","y") == 0');
|
||||
vrfy(config("fullzero", 1) == 0,
|
||||
'539: config("fullzero", 1) == 0');
|
||||
vrfy(config("prompt", "; ") == "> ",
|
||||
'540: config("prompt", "; ") == "> "');
|
||||
vrfy(config("more", ";; ") == ">> ",
|
||||
'541: config("more", ";; ") == ">> "');
|
||||
vrfy(config("all") == newcfg, '542: config("all") == newcfg');
|
||||
/* convert to "oldstd" config by individual changes */
|
||||
print '534: test unused';
|
||||
vrfy(config("outround", 2) == 24,
|
||||
'535: config("outround", 2) == 24');
|
||||
vrfy(config("leadzero","n") == 1,
|
||||
'536: config("leadzero","n") == 1');
|
||||
print '537: test unused';
|
||||
vrfy(config("prompt", "> ") == "; ",
|
||||
'538: config("prompt", "> ") == "; "');
|
||||
vrfy(config("more", ">> ") == ";; ",
|
||||
'539: config("more", ">> ") == ";; "');
|
||||
vrfy(config("all") == oldcfg, '540: config("all") == oldcfg');
|
||||
|
||||
/* check on the new config("fullzero") effect */
|
||||
vrfy(config("all","oldstd") == newcfg,
|
||||
'543: config("all",callcfg) == newcfg');
|
||||
/* restore the configation at the start of this function */
|
||||
vrfy(config("all",callcfg) == oldcfg,
|
||||
'541: config("all",callcfg) == oldcfg');
|
||||
|
||||
/* display and fullzero tests */
|
||||
vrfy(config("display",2) == 20,
|
||||
'544: config("display",2) == 20');
|
||||
'542: config("display",2) == 20');
|
||||
vrfy(config("leadzero",0) == 1,
|
||||
'543: config("leadzero",0) == 1');
|
||||
vrfy(config("fullzero",1) == 0,
|
||||
'545: config("fullzero",1) == 0');
|
||||
'544: config("fullzero",1) == 0');
|
||||
vrfy(strprintf("%d %d %d", 0, 1, 2) == ".00 1.00 2.00",
|
||||
'546: strprintf("%d %d %d", 0, 1, 2) == ".00 1.00 2.00"');
|
||||
'545: strprintf("%d %d %d", 0, 1, 2) == ".00 1.00 2.00"');
|
||||
vrfy(config("display",20) == 2,
|
||||
'547: config("display",20) == 2');
|
||||
vrfy(config("fullzero",0),
|
||||
'548: config("fullzero",0)');
|
||||
'546: config("display",20) == 2');
|
||||
vrfy(config("leadzero",1) == 0,
|
||||
'547: config("leadzero",1) == 0');
|
||||
vrfy(config("fullzero",0) == 1,
|
||||
'548: config("fullzero",0) == 1');
|
||||
vrfy(strprintf("%d %d %d", 0, 1, 2) == "0 1 2",
|
||||
'549: strprintf("%d %d %d", 0, 1, 2) == "0 1 2"');
|
||||
|
||||
/* restore calling config */
|
||||
vrfy(config("all",callcfg) == oldcfg,
|
||||
'550: config("all",callcfg) == oldcfg');
|
||||
vrfy(config("all",callcfg) == startcfg,
|
||||
'550: config("all",callcfg) == startcfg');
|
||||
vrfy(config("all") == callcfg, '551: config("all") == callcfg');
|
||||
vrfy(config("all") == startcfg, '552: config("all") == startcfg');
|
||||
|
||||
@@ -759,7 +761,7 @@ define test_functions()
|
||||
vrfy(den(17) == 1, '712: den(17) == 1');
|
||||
vrfy(den(3/7) == 7, '713: den(3/7) == 7');
|
||||
vrfy(den(-2/3) == 3, '714: den(-2/3) == 3');
|
||||
vrfy(digits(0) == 0, '715: digits(0) == 0');
|
||||
vrfy(digits(0) == 1, '715: digits(0) == 1');
|
||||
vrfy(digits(9) == 1, '716: digits(9) == 1');
|
||||
vrfy(digits(10) == 2, '717: digits(10) == 2');
|
||||
vrfy(digits(-691) == 3, '718: digits(-691) == 3');
|
||||
@@ -1038,8 +1040,8 @@ define test_functions()
|
||||
vrfy(digit(a,-1) == 4, '974: digit(a,-1) == 4');
|
||||
vrfy(digit(a,-2) == 2, '975: digit(a,-2) == 2');
|
||||
vrfy(digit(a,-3) == 8, '976: digit(a,-3) == 8');
|
||||
vrfy(digits(0) == 0, '977: digits(0) == 0');
|
||||
vrfy(digits(0.0123) == 0, '978: digits(0.0123) == 0');
|
||||
vrfy(digits(0) == 1, '977: digits(0) == 1');
|
||||
vrfy(digits(0.0123) == 1, '978: digits(0.0123) == 1');
|
||||
vrfy(digits(3.7) == 1, '979: digits(3.7) == 1');
|
||||
vrfy(digits(-27) == 2, '980: digits(-27) == 2');
|
||||
vrfy(digits(-99.7) == 2, '981: digits(-99.7) == 2');
|
||||
|
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: repeat.cal,v 29.3 2003/01/14 04:03:20 chongo Exp $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: repeat.cal,v 29.4 2003/01/26 19:42:03 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/repeat.cal,v $
|
||||
*
|
||||
* Under source code control: 2003/01/05 00:00:01
|
||||
@@ -48,6 +48,6 @@ define repeat(digit_set, repeat_count)
|
||||
}
|
||||
|
||||
/* return repeated set of digits */
|
||||
digit_count = max(digits(digit_set), 1);
|
||||
digit_count = digits(digit_set);
|
||||
return digit_set * (10^(digit_count*repeat_count)-1) / (10^digit_count-1);
|
||||
}
|
||||
|
14
calc.c
14
calc.c
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.8 $
|
||||
* @(#) $Id: calc.c,v 29.8 2001/04/10 22:03:13 chongo Exp $
|
||||
* @(#) $Revision: 29.9 $
|
||||
* @(#) $Id: calc.c,v 29.9 2003/08/26 04:36:10 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:11
|
||||
@@ -214,7 +214,13 @@ main(int argc, char **argv)
|
||||
havearg = TRUE;
|
||||
break;
|
||||
case 'n':
|
||||
new_std = TRUE;
|
||||
/*
|
||||
* -n is deprecated and may be reused
|
||||
* for another purpose in the future
|
||||
*/
|
||||
break;
|
||||
case 'O':
|
||||
use_old_std = TRUE;
|
||||
break;
|
||||
case 'p':
|
||||
p_flag = TRUE;
|
||||
@@ -425,7 +431,7 @@ main(int argc, char **argv)
|
||||
fprintf(stderr,
|
||||
"usage: %s [-a] [-c] [-C] [-d] [-e] [-h] [-i] [-m mode]\n"
|
||||
"\t[-D calc_debug[:resource_debug[:user_debug]]]\n"
|
||||
"\t[-n] [-p] [-q] [-u] [-v] "
|
||||
"\t[-O] [-p] [-q] [-u] [-v] "
|
||||
"[--] [calc_cmd ...]\n",
|
||||
program);
|
||||
exit(1);
|
||||
|
6
calc.h
6
calc.h
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.10 $
|
||||
* @(#) $Id: calc.h,v 29.10 2002/03/12 09:40:57 chongo Exp $
|
||||
* @(#) $Revision: 29.11 $
|
||||
* @(#) $Id: calc.h,v 29.11 2003/08/26 04:36:10 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:31
|
||||
@@ -232,7 +232,7 @@ extern DLL char *program; /* our name (argv[0]) */
|
||||
|
||||
extern DLL int no_env; /* TRUE (-e) => ignore env vars on startup */
|
||||
extern DLL int errmax; /* if >= 0, error when errcount exceeds errmax */
|
||||
extern DLL int new_std; /* TRUE (-n) => use newstd configuration */
|
||||
extern DLL int use_old_std; /* TRUE (-O) => use classic configuration */
|
||||
|
||||
extern DLL int allow_read; /* FALSE => dont open any files for reading */
|
||||
extern DLL int allow_write; /* FALSE => dont open any files for writing */
|
||||
|
27
calc.man
27
calc.man
@@ -15,8 +15,8 @@
|
||||
.\" received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
.\" 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
.\"
|
||||
.\" @(#) $Revision: 29.9 $
|
||||
.\" @(#) $Id: calc.man,v 29.9 2002/03/14 00:28:28 chongo Exp $
|
||||
.\" @(#) $Revision: 29.11 $
|
||||
.\" @(#) $Id: calc.man,v 29.11 2003/08/26 04:36:10 chongo Exp $
|
||||
.\" @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.man,v $
|
||||
.\"
|
||||
.\" Under source code control: 1991/07/23 05:48:26
|
||||
@@ -44,7 +44,7 @@ calc \- arbitrary precision calculator
|
||||
.RB [ \-h ]
|
||||
.RB [ \-i ]
|
||||
.RB [ \-m\ \&mode ]
|
||||
.RB [ \-n ]
|
||||
.RB [ \-O ]
|
||||
.br
|
||||
.RB [ \-p ]
|
||||
.RB [ \-q ]
|
||||
@@ -302,11 +302,22 @@ The reading of key bindings is also disabled
|
||||
when the mode disables opening of files for reading.
|
||||
|
||||
.TP
|
||||
.B \-n
|
||||
Use the new configuration defaults instead of the old
|
||||
default classic defaults.
|
||||
.B \-O
|
||||
Use the old classic defaults instead of the
|
||||
default configuration.
|
||||
This flag as the same effect
|
||||
as executing \fBconfig("all", "newcfg")\fP at startup time.
|
||||
as executing \fBconfig("all", "oldcfg")\fP at startup time.
|
||||
.sp 1
|
||||
NOTE: Older versions of calc used
|
||||
.B \-n
|
||||
to setup a modified form of the default calc configuration.
|
||||
The
|
||||
.B \-n
|
||||
flag currently does nothing.
|
||||
Use of the
|
||||
.B \-n
|
||||
flag is now deprecated and may be used for
|
||||
something else in the future.
|
||||
|
||||
.TP
|
||||
.B \-p
|
||||
@@ -1086,7 +1097,7 @@ Landon Noll maintains the the
|
||||
web site is located at:
|
||||
.sp
|
||||
.in +0.5i
|
||||
http://www.isthe.com/chongo/tech/comp/calc/
|
||||
www.isthe.com/chongo/tech/comp/calc/
|
||||
.in -0.5i
|
||||
.sp
|
||||
Share and Enjoy! :\-)
|
||||
|
116
calc.spec.in
Normal file
116
calc.spec.in
Normal file
@@ -0,0 +1,116 @@
|
||||
#****h* calc/calc.spec.in
|
||||
#
|
||||
# calc.spec.in - template specfile for calc
|
||||
#
|
||||
# Copyright (C) 2003 Petteri Kettunen and Landon Curt Noll
|
||||
#
|
||||
# Calc is open software; you can redistribute it and/or modify it under
|
||||
# the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# Calc is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
# Public License for more details.
|
||||
#
|
||||
# A copy of version 2.1 of the GNU Lesser General Public License is
|
||||
# distributed with calc under the filename COPYING-LGPL. You should have
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# @(#) $Revision: 29.12 $
|
||||
# @(#) $Id: calc.spec.in,v 29.12 2003/04/15 03:37:59 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.spec.in,v $
|
||||
#
|
||||
# Under source code control: 2003/02/16 20:21:39
|
||||
# File existed as early as: 2003
|
||||
#
|
||||
# calculator by David I. Bell with help/mods from others
|
||||
# Makefile by Petteri Kettunen with modifications from Landon Curt Noll
|
||||
|
||||
# BUGS
|
||||
# - Uninstalling calc and calc-devel leaves empty dirs /usr/include/calc
|
||||
# and /usr/share/calc and its subdird. In case e.g. %{_includedir}/calc
|
||||
# is defined in `%files devel' section, then rpmbuild complains that
|
||||
# header files are defined twice - rpmbuild bug or bug in specfile conf???
|
||||
|
||||
Summary: Arbitrary precision calculator.
|
||||
Name: calc
|
||||
Version: <<<PROJECT_VERSION>>>
|
||||
Release: 0
|
||||
Copyright: LGPL
|
||||
Group: Applications/Engineering
|
||||
Source: %{name}-%{version}.tar.gz
|
||||
URL: http://www.isthe.com/chongo/tech/comp/calc/index.html
|
||||
Requires: ncurses >= 5.2-26, readline >= 4.2, less >= 358
|
||||
BuildRequires: ncurses-devel >= 5.2-26, readline-devel >= 4.2
|
||||
BuildRoot: %{_tmppath}/%{name}-root
|
||||
|
||||
%description
|
||||
Calc is arbitrary precision C-like arithmetic system that is a
|
||||
calculator, an algorithm prototyper and mathematical research
|
||||
tool. Calc comes with a rich set of builtin mathematical and
|
||||
programmatic functions.
|
||||
|
||||
For the latest calc release, see the project home page:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/index.html
|
||||
|
||||
%package devel
|
||||
Summary: Development files and documentation for calc.
|
||||
Group: Development/Libraries
|
||||
PreReq: %{name} = %{version}-%{release}
|
||||
|
||||
%description devel
|
||||
This package contains the header files and static libraries for developing
|
||||
calc (arbitrary precision calculator).
|
||||
|
||||
For the latest calc release, see the project home page:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/index.html
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
make %{?_smp_mflags} T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 all chk
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
mkdir -p %{buildroot}
|
||||
make T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 install
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%files
|
||||
%defattr(-, root, root)
|
||||
%doc BUGS CHANGES COPYING COPYING-LGPL
|
||||
%{_bindir}/*
|
||||
%{_mandir}/man1/*
|
||||
%{_datadir}/%{name}/*/*
|
||||
%{_datadir}/%{name}/bindings
|
||||
%{_datadir}/%{name}/README
|
||||
%{_datadir}/%{name}/*.cal
|
||||
|
||||
%files devel
|
||||
%defattr(-, root, root)
|
||||
%doc BUGS COPYING COPYING-LGPL LIBRARY
|
||||
%attr(644, root, root) %{_includedir}/calc/*
|
||||
%attr(644, root, root) %{_libdir}/*.a
|
||||
|
||||
%changelog
|
||||
* Wed Feb 26 2003 Landon Curt Noll http://www.isthe.com/chongo
|
||||
- Release of calc-2.11.7-2
|
||||
- Fixed attributes on include and lib calc-devel files
|
||||
- Added BUGS to calc-devel as well as calc
|
||||
* Tue Feb 25 2003 Landon Curt Noll http://www.isthe.com/chongo
|
||||
- Release of calc-2.11.7-1
|
||||
- Require ncurses, readline and less to install.
|
||||
- Require ncurses-devel and readline-devel to build.
|
||||
* Tue Feb 18 2003 Landon Curt Noll http://www.isthe.com/chongo
|
||||
- Misc changes to fit local directory setup
|
||||
* Sun Feb 16 2003 Petteri Kettunen <petterik@users.sourceforge.net>
|
||||
- initial RPM build
|
||||
|
||||
#****
|
12
config.c
12
config.c
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.8 $
|
||||
* @(#) $Id: config.c,v 29.8 2002/12/29 09:20:25 chongo Exp $
|
||||
* @(#) $Revision: 29.10 $
|
||||
* @(#) $Id: config.c,v 29.10 2003/08/26 04:36:10 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.c,v $
|
||||
*
|
||||
* Under source code control: 1991/07/20 00:21:56
|
||||
@@ -149,9 +149,9 @@ CONFIG oldstd = { /* backward compatible standard configuration */
|
||||
CONFIG newstd = { /* new non-backward compatible configuration */
|
||||
MODE_INITIAL, /* current output mode */
|
||||
MODE2_INITIAL, /* current output mode */
|
||||
10, /* current output digits for float or exp */
|
||||
20, /* current output digits for float or exp */
|
||||
NULL, /* loaded in at startup - default error for real functions */
|
||||
NEW_EPSILONPREC_DEFAULT, /* binary precision of epsilon */
|
||||
EPSILONPREC_DEFAULT, /* binary precision of epsilon */
|
||||
FALSE, /* tracing flags */
|
||||
MAXPRINT_DEFAULT, /* number of elements to print */
|
||||
MUL_ALG2, /* size of number to use multiply alg 2 */
|
||||
@@ -161,7 +161,7 @@ CONFIG newstd = { /* new non-backward compatible configuration */
|
||||
TRUE, /* ok to print a tilde on approximations */
|
||||
TRUE, /* ok to print tab before numeric values */
|
||||
0, /* quomod() default rounding mode */
|
||||
0, /* quotient // default rounding mode */
|
||||
2, /* quotient // default rounding mode */
|
||||
0, /* mod % default rounding mode */
|
||||
24, /* sqrt() default rounding mode */
|
||||
24, /* appr() default rounding mode */
|
||||
@@ -170,7 +170,7 @@ CONFIG newstd = { /* new non-backward compatible configuration */
|
||||
24, /* output default rounding mode */
|
||||
24, /* round()/bround() default rounding mode */
|
||||
TRUE, /* ok to print leading 0 before decimal pt */
|
||||
1, /* ok to print trailing 0's */
|
||||
0, /* ok to print trailing 0's */
|
||||
MAXSCANCOUNT, /* max scan errors before abort */
|
||||
"; ", /* normal prompt */
|
||||
";; ", /* prompt when inside multi-line input */
|
||||
|
10
config.h
10
config.h
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.12 $
|
||||
* @(#) $Id: config.h,v 29.12 2002/12/29 09:20:25 chongo Exp $
|
||||
* @(#) $Revision: 29.13 $
|
||||
* @(#) $Id: config.h,v 29.13 2003/08/26 04:36:10 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $
|
||||
*
|
||||
* Under source code control: 1995/11/01 22:20:17
|
||||
@@ -99,8 +99,6 @@
|
||||
#define DISPLAY_DEFAULT 20 /* default digits for float display */
|
||||
#define EPSILON_DEFAULT "1e-20" /* allowed error for float calculations */
|
||||
#define EPSILONPREC_DEFAULT 67 /* 67 ==> 2^-67 <= EPSILON_DEFAULT < 2^-66 */
|
||||
#define NEW_EPSILON_DEFAULT "1e-10" /* newstd EPSILON_DEFAULT */
|
||||
#define NEW_EPSILONPREC_DEFAULT 34 /* 34 ==> 2^-34 <= 1e-10 < 2^-33 */
|
||||
#define MAXPRINT_DEFAULT 16 /* default number of elements printed */
|
||||
#define MAXSCANCOUNT 20 /* default max scan errors before an abort */
|
||||
|
||||
@@ -196,8 +194,8 @@ typedef struct config CONFIG;
|
||||
* global configuration states and aliases
|
||||
*/
|
||||
extern DLL CONFIG *conf; /* current configuration */
|
||||
extern DLL CONFIG oldstd; /* backward compatible standard configuration */
|
||||
extern DLL CONFIG newstd; /* new non-backward compatible configuration */
|
||||
extern DLL CONFIG oldstd; /* old classic standard configuration */
|
||||
extern DLL CONFIG newstd; /* default compatible configuration */
|
||||
extern DLL char *calc_debug; /* !=NULL => value of config("calc_debug") */
|
||||
extern DLL char *resource_debug; /* !=NULL => config("resource_debug") value */
|
||||
extern DLL char *user_debug; /* !=NULL => value of config("user_debug") */
|
||||
|
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: c_sysinfo.c,v 29.5 2001/04/14 23:04:17 chongo Exp $
|
||||
* @(#) $Revision: 29.6 $
|
||||
* @(#) $Id: c_sysinfo.c,v 29.6 2003/06/10 21:44:17 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_sysinfo.c,v $
|
||||
*
|
||||
* Under source code control: 1997/03/09 23:14:40
|
||||
@@ -128,8 +128,6 @@ static struct infoname sys_info[] = {
|
||||
{"MAX_SM_PRIME", "larest 32 bit prime", NULL, (FULL)MAX_SM_PRIME},
|
||||
{"MAX_SM_VAL", "larest 32 bit value", NULL, (FULL)MAX_SM_VAL},
|
||||
{"MUL_ALG2", "default size for alternative multiply", NULL, (FULL)MUL_ALG2},
|
||||
{"NEW_EPSILONPREC_DEFAULT", "2^-EPSILON_DEFAULT <= EPSILON_DEFAULT", NULL, (FULL)NEW_EPSILONPREC_DEFAULT},
|
||||
{"NEW_EPSILON_DEFAULT", "newstd EPSILON_DEFAULT", NEW_EPSILON_DEFAULT, (FULL)0},
|
||||
{"NXT_MAP_PRIME", "smallest odd prime not in pr_map", NULL, (FULL)NXT_MAP_PRIME},
|
||||
{"NXT_PFACT_VAL", "next prime for higher pfact values", NULL, (FULL)NXT_PFACT_VAL},
|
||||
{"OFF_T_BITS", "file offset size in bits", NULL, (FULL)OFF_T_BITS},
|
||||
|
39
help/digits
39
help/digits
@@ -11,23 +11,38 @@ TYPES
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
Returns the least non-negative integer n for which abs(x) < b^n.
|
||||
Returns number of digits in the standard base-b representation
|
||||
when x is truncated to an integer and the sign is ignored.
|
||||
|
||||
digits(x, b) = 0 if and only if abs(x) <= 1.
|
||||
To be more precise: when abs(int(x)) > 0, this function returns
|
||||
the value 1 + ilog(x, b). When abs(int(x)) == 0, then this
|
||||
function returns the value 1.
|
||||
|
||||
For real x with absolute value > 1, digits(x, b) is the number
|
||||
of digits in the standard base-b "decimal" representation of int(abs(x));
|
||||
this is also given by 1 + ilog(x, b).
|
||||
If omitted, b is assumed to be 10. If given, b must be an
|
||||
integer > 1.
|
||||
|
||||
NOTE: both digits(0) and digits(1) return the value of 1.
|
||||
This is not a bug, it is a feature of the above equation. :-)
|
||||
One should remember these special cases:
|
||||
|
||||
digits(12.3456) == 2 computes with the integer part only
|
||||
digits(-1234) == 4 computes with the absolute value only
|
||||
digits(0) == 1 specical case
|
||||
digits(-0.123) == 1 combination of all of the above
|
||||
|
||||
EXAMPLE
|
||||
> print digits(0), digits(0.0123), digits(3.7), digits(-27), digits(-99.7)
|
||||
0 0 1 2 2
|
||||
> print digits(100), digits(23209), digits(2^72)
|
||||
3 5 22
|
||||
|
||||
> print digits(0), digits(1), digits(-1)
|
||||
1 1 1
|
||||
|
||||
> print digits(-1234), digits(12.3456), digits(107.207)
|
||||
4 2 3
|
||||
|
||||
> print digits(17^463-1, 17), digits(10000, 100), digits(21701, 2)
|
||||
3, 15 14
|
||||
|
||||
LIMITS
|
||||
none
|
||||
b > 1
|
||||
|
||||
LINK LIBRARY
|
||||
long qdigits(NUMBER *q, ZVALUE base)
|
||||
@@ -51,8 +66,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.4 $
|
||||
## @(#) $Id: digits,v 29.4 2003/01/14 04:09:35 chongo Exp $
|
||||
## @(#) $Revision: 29.5 $
|
||||
## @(#) $Id: digits,v 29.5 2003/01/26 19:41:35 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/digits,v $
|
||||
##
|
||||
## Under source code control: 1995/10/03 10:40:01
|
||||
|
31
help/hash
31
help/hash
@@ -1,5 +1,5 @@
|
||||
NAME
|
||||
hash - FNV-1 hash value
|
||||
hash - return the calc hash value
|
||||
|
||||
SYNOPSIS
|
||||
hash(x_1 [, x_2, x_3, ...])
|
||||
@@ -12,27 +12,16 @@ TYPES
|
||||
DESCRIPTION
|
||||
Returns a hash value for one or more values of arbitrary types.
|
||||
|
||||
The basis of this hash algorithm was taken from an idea sent
|
||||
as reviewer comments to the IEEE POSIX P1003.2 committee by:
|
||||
The calc hash value is based on the core Fowler/Noll/Vo hash
|
||||
known as FNV-1. The return value, however, cannot be used
|
||||
as an FNV hash value because calc's internal function also
|
||||
takes into account more abstract concepts such as data types.
|
||||
|
||||
Phong Vo (http://www.research.att.com/info/kpv/)
|
||||
Glenn Fowler (http://www.research.att.com/~gsf/)
|
||||
|
||||
In a subsequent ballot round:
|
||||
|
||||
Landon Curt Noll (http://www.isthe.com/chongo/)
|
||||
|
||||
improved on their algorithm. Some people tried this hash
|
||||
and found that it worked rather well. In an EMail message
|
||||
to Landon, they named it ``Fowler/Noll/Vo'' or the FNV hash.
|
||||
|
||||
FNV hashes are architected to be fast while maintaining a low
|
||||
collision rate. The FNV speed allows one to quickly hash lots
|
||||
of data while maintaining a reasonable collision rate. See:
|
||||
See:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/fnv/
|
||||
|
||||
for more details as well as other forms of the FNV hash.
|
||||
information about the Fowler/Noll/Vo (FNV) hash.
|
||||
|
||||
EXAMPLE
|
||||
> a = isqrt(2e1000); s = "xyz";
|
||||
@@ -48,7 +37,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
sha, sha1, md5
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
## Copyright (C) 1999-2003 Landon Curt Noll
|
||||
##
|
||||
## Calc is open software; you can redistribute it and/or modify it under
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -64,8 +53,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.2 $
|
||||
## @(#) $Id: hash,v 29.2 2000/06/07 14:02:33 chongo Exp $
|
||||
## @(#) $Revision: 29.3 $
|
||||
## @(#) $Id: hash,v 29.3 2003/03/01 01:16:02 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/hash,v $
|
||||
##
|
||||
## Under source code control: 1996/03/12 23:10:01
|
||||
|
11
help/places
11
help/places
@@ -16,6 +16,9 @@ DESCRIPTION
|
||||
|
||||
places(x,b) = 0 if and only if x is an integer.
|
||||
|
||||
If omitted, b is assumed to be 10. If given, b must be an
|
||||
integer > 1.
|
||||
|
||||
places(x,b) = n > 0 if and only if the fractional part of abs(x)
|
||||
has a finite base-b "decimal" representation with n digits of which
|
||||
the last digit is nonzero. This occurs if and only if every prime
|
||||
@@ -29,7 +32,7 @@ EXAMPLE
|
||||
-1 3 1
|
||||
|
||||
LIMITS
|
||||
none
|
||||
b > 1
|
||||
|
||||
LINK LIBRARY
|
||||
long qplaces(NUMBER *q, ZVALUE base)
|
||||
@@ -37,7 +40,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
digit, digits
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
## Copyright (C) 1999-2003 Landon Curt Noll
|
||||
##
|
||||
## Calc is open software; you can redistribute it and/or modify it under
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -53,8 +56,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.4 $
|
||||
## @(#) $Id: places,v 29.4 2000/12/17 12:27:58 chongo Exp $
|
||||
## @(#) $Revision: 29.5 $
|
||||
## @(#) $Id: places,v 29.5 2003/01/26 19:43:45 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/places,v $
|
||||
##
|
||||
## Under source code control: 1995/10/03 10:40:02
|
||||
|
12
help/todo
12
help/todo
@@ -66,6 +66,8 @@ Very High priority items:
|
||||
setting $LANG would allow calc to produce error messages
|
||||
and text strings in that language.
|
||||
|
||||
* Consider using GNU autoconf / configure to build the calc Makefile.
|
||||
|
||||
=-=
|
||||
|
||||
High priority items:
|
||||
@@ -83,8 +85,6 @@ High priority items:
|
||||
* Perform a code coverage analysis of the 'make check' action
|
||||
and improve the coverage (within reason) of the regress.cal suite.
|
||||
|
||||
* Create a Linux rpm (Red Hat Package Manager) package for calc.
|
||||
|
||||
* Address, if possible and reasonable, any Calc Mis-features
|
||||
as noted in the BUGS file or as displayed by 'calc help bugs'.
|
||||
|
||||
@@ -122,9 +122,7 @@ Medium priority items:
|
||||
* Add a builtin function to access the 64 bit FNV hash which
|
||||
is currently being used internally in seed.c.
|
||||
|
||||
* Consider using configure to build the calc Makefile.
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
## Copyright (C) 1999-2003 Landon Curt Noll
|
||||
##
|
||||
## Calc is open software; you can redistribute it and/or modify it under
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -140,8 +138,8 @@ Medium priority items:
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.4 $
|
||||
## @(#) $Id: todo,v 29.4 2002/07/10 17:30:28 chongo Exp $
|
||||
## @(#) $Revision: 29.5 $
|
||||
## @(#) $Id: todo,v 29.5 2003/02/25 20:26:17 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/todo,v $
|
||||
##
|
||||
## Under source code control: 1999/10/20 07:42:55
|
||||
|
14
help/usage
14
help/usage
@@ -148,10 +148,14 @@ Calc command line
|
||||
when the mode disables opening of files for reading.
|
||||
|
||||
|
||||
-n Use the new configuration defaults instead of the old
|
||||
default classic defaults. This flag as the same effect
|
||||
as executing config("all", "newcfg") at startup time.
|
||||
-O Use the old classic defaults instead of the default
|
||||
configuration. This flag as the same effect as executing
|
||||
config("all", "oldcfg") at startup time.
|
||||
|
||||
NOTE: Older versions of calc used -n to setup a modified
|
||||
form of the default calc configuration. The -n flag
|
||||
currently does nothing. Use of the -n flag is now
|
||||
deprecated and may used for something else in the future.
|
||||
|
||||
-p Pipe processing is enabled by use of -p. For example:
|
||||
|
||||
@@ -353,8 +357,8 @@ For more information use the following calc commands:
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.4 $
|
||||
## @(#) $Id: usage,v 29.4 2002/07/10 11:47:04 chongo Exp $
|
||||
## @(#) $Revision: 29.6 $
|
||||
## @(#) $Id: usage,v 29.6 2003/06/10 21:39:34 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/usage,v $
|
||||
##
|
||||
## Under source code control: 1991/07/21 04:37:25
|
||||
|
32
lib_calc.c
32
lib_calc.c
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.8 $
|
||||
* @(#) $Id: lib_calc.c,v 29.8 2002/03/12 09:40:57 chongo Exp $
|
||||
* @(#) $Revision: 29.9 $
|
||||
* @(#) $Id: lib_calc.c,v 29.9 2003/08/26 04:36:10 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/lib_calc.c,v $
|
||||
*
|
||||
* Under source code control: 1996/06/17 18:06:19
|
||||
@@ -106,10 +106,10 @@ extern uid_t geteuid();
|
||||
/*
|
||||
* Common definitions
|
||||
*/
|
||||
int new_std = FALSE; /* TRUE (-n) => use newstd configuration */
|
||||
int abortlevel; /* current level of aborts */
|
||||
BOOL inputwait; /* TRUE if in a terminal input wait */
|
||||
jmp_buf jmpbuf; /* for errors */
|
||||
int use_old_std = FALSE; /* TRUE => use old classic configuration */
|
||||
int abortlevel; /* current level of aborts */
|
||||
BOOL inputwait; /* TRUE if in a terminal input wait */
|
||||
jmp_buf jmpbuf; /* for errors */
|
||||
char *program = "calc"; /* our name */
|
||||
char *base_name = "calc"; /* basename of our name */
|
||||
char cmdbuf[MAXCMD+1+1+1]; /* command line expression + "\n\0" + guard */
|
||||
@@ -232,23 +232,23 @@ libcalc_call_me_first(void)
|
||||
/*
|
||||
* initialize old and new configuration values
|
||||
*/
|
||||
oldstd.epsilon = &_qonesqbase_; /* magic to fake early str2q() */
|
||||
oldstd.program = strdup(program);
|
||||
oldstd.base_name = strdup(base_name);
|
||||
oldstd.version = strdup(version());
|
||||
conf = config_copy(&oldstd); /* more magic to fake early str2q() */
|
||||
newstd.epsilon = &_qonesqbase_; /* magic to fake early str2q() */
|
||||
newstd.program = strdup(program);
|
||||
newstd.base_name = strdup(base_name);
|
||||
newstd.version = strdup(version());
|
||||
conf = config_copy(&newstd); /* more magic to fake early str2q() */
|
||||
conf->tab_ok = FALSE;
|
||||
newstd.epsilon = str2q(EPSILON_DEFAULT);
|
||||
oldstd.epsilon = str2q(EPSILON_DEFAULT);
|
||||
newstd.epsilon = str2q(NEW_EPSILON_DEFAULT);
|
||||
|
||||
/*
|
||||
* make oldstd our default config
|
||||
* make newstd our default config, unless -O
|
||||
*/
|
||||
config_free(conf);
|
||||
if (new_std) {
|
||||
conf = config_copy(&newstd);
|
||||
} else {
|
||||
if (use_old_std) {
|
||||
conf = config_copy(&oldstd);
|
||||
} else {
|
||||
conf = config_copy(&newstd);
|
||||
}
|
||||
|
||||
/*
|
||||
|
16
qfunc.c
16
qfunc.c
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: qfunc.c,v 29.4 2000/12/17 13:07:32 chongo Exp $
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: qfunc.c,v 29.5 2003/01/26 19:41:35 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qfunc.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:20
|
||||
@@ -623,8 +623,16 @@ qilog(NUMBER *q, ZVALUE base)
|
||||
/*
|
||||
* Return the number of digits in the representation to a specified
|
||||
* base of the integral part of a number.
|
||||
*
|
||||
* Examples: qdigits(3456,10) = 4, qdigits(-23.45, 10) = 2.
|
||||
*
|
||||
* One should remember these special cases:
|
||||
*
|
||||
* digits(12.3456) == 2 computes with the integer part only
|
||||
* digits(-1234) == 4 computes with the absolute value only
|
||||
* digits(0) == 1 specical case
|
||||
* digits(-0.123) == 1 combination of all of the above
|
||||
*
|
||||
* given:
|
||||
* q number to count digits of
|
||||
*/
|
||||
@@ -634,8 +642,8 @@ qdigits(NUMBER *q, ZVALUE base)
|
||||
long n; /* number of digits */
|
||||
ZVALUE temp; /* temporary value */
|
||||
|
||||
if (zabsrel(q->num, q->den) < 1)
|
||||
return 0;
|
||||
if (zabsrel(q->num, q->den) < 0)
|
||||
return 1;
|
||||
if (qisint(q))
|
||||
return 1 + zlog(q->num, base);
|
||||
zquo(q->num, q->den, &temp, 2);
|
||||
|
136
quickhash.c
136
quickhash.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* quickhash - quickly hash a calc value using a partial Fowler/Noll/Vo hash
|
||||
* quickhash - quickly hash a calc value using a quasi Fowler/Noll/Vo hash
|
||||
*
|
||||
* Copyright (C) 1999-2002 Landon Curt Noll
|
||||
*
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: quickhash.c,v 29.5 2002/12/29 09:20:25 chongo Exp $
|
||||
* @(#) $Revision: 29.7 $
|
||||
* @(#) $Id: quickhash.c,v 29.7 2003/03/01 01:21:12 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/quickhash.c,v $
|
||||
*
|
||||
* Under source code control: 1995/03/04 11:34:23
|
||||
@@ -31,26 +31,6 @@
|
||||
/*
|
||||
* NOTE: This file does not contain a hash interface. It is used by
|
||||
* associative arrays and other internal processes.
|
||||
*
|
||||
* We will compute a hash value for any type of calc value
|
||||
* for use in associative arrays and the hash() builtin.
|
||||
* Hash speed is of primary importance to make associative
|
||||
* arrays work at a reasonable speed. For this reason, we
|
||||
* cut corners by hashing only a small part of a calc value.
|
||||
*
|
||||
* The Fowler/Noll/Vo hash does a very good job in producing
|
||||
* a 32 bit hash from ASCII strings in a short amount of time.
|
||||
* It is not bad for hashing calc data as well. So doing a
|
||||
* quick and dirty job of hashing on a part of a calc value,
|
||||
* combined with using a reasonable hash function will result
|
||||
* acceptable associative array performance.
|
||||
*
|
||||
* See:
|
||||
* http://www.isthe.com/chongo/src/fnv/fnv_hash.tar.gz
|
||||
* http://www.isthe.com/chongo/src/fnv/hash_32.c
|
||||
* http://www.isthe.com/chongo/src/fnv/hash_64.c
|
||||
*
|
||||
* for information on 32bit and 64bit Fowler/Noll/Vo hashs.
|
||||
*/
|
||||
|
||||
|
||||
@@ -77,7 +57,7 @@ static QCKHASH blk_hash(BLOCK *blk, QCKHASH val);
|
||||
|
||||
|
||||
/*
|
||||
* FNV-0 - Fowler/Noll/Vo-0 32 bit hash
|
||||
* quasi_fnv - quasi Fowler/Noll/Vo-0 32 bit hash
|
||||
*
|
||||
* The basis of this hash algorithm was taken from an idea sent
|
||||
* as reviewer comments to the IEEE POSIX P1003.2 committee by:
|
||||
@@ -97,7 +77,7 @@ static QCKHASH blk_hash(BLOCK *blk, QCKHASH val);
|
||||
* collision rate. The FNV speed allows one to quickly hash lots
|
||||
* of data while maintaining a reasonable collision rate. See:
|
||||
*
|
||||
* http://www.isthe.com/chongo/tech/comp/fnv/
|
||||
* http://www.isthe.com/chongo/tech/comp/fnv/index.html
|
||||
*
|
||||
* for more details as well as other forms of the FNV hash.
|
||||
*
|
||||
@@ -107,8 +87,55 @@ static QCKHASH blk_hash(BLOCK *blk, QCKHASH val);
|
||||
*
|
||||
* returns:
|
||||
* the next 32 bit QCKHASH
|
||||
*
|
||||
* Example:
|
||||
* QCKHASH val;
|
||||
* int x;
|
||||
*
|
||||
* quasi_fnv(x, val);
|
||||
*
|
||||
* NOTE: The (x) argument may be an expression such as something with
|
||||
* a ++ or --. The macro must only use (x) once.
|
||||
*
|
||||
* NOTE: The (val) argument just be a lvalue / something to which
|
||||
* a value can be assigned.
|
||||
*
|
||||
* The careful observer will note that (x) need not be a simple
|
||||
* octet. This is not a bug, but a feature. The FNV hash was
|
||||
* designed to operate on octets, not abstract objects such
|
||||
* as associations, file descriptors and PRNG states.
|
||||
* You will also notice that we sometimes add values directly
|
||||
* to the (val) hash state. This is a simulation of hashing
|
||||
* a variable type.
|
||||
*
|
||||
* The Fowler/Noll/Vo hash does a very good job in producing
|
||||
* a 32 bit hash arrays of octets in a short amount of time.
|
||||
* It is not bad for hashing calc data as well. So doing a
|
||||
* quick and dirty job of hashing on a part of a calc value
|
||||
* is all that calc really needs.
|
||||
*
|
||||
* The core of the of the FNV hash has been adopted as the calc
|
||||
* quick hash with the provision that it operates on 32 bit
|
||||
* objects instead of octets. For calc's internal purposes,
|
||||
* this is sufficent. For general FNV hashing, this is not
|
||||
* recommended.
|
||||
*
|
||||
* It has been observed that gcc, when using -O, -O2, -O3 or
|
||||
* better on an AMD or AMD-like processor (such as i686) will
|
||||
* produce slightly faster code when using the shift/add
|
||||
* expression than when performing a multiply with a constant.
|
||||
*/
|
||||
#define fnv(x,val) (((QCKHASH)(val)*(QCKHASH)16777619) ^ ((QCKHASH)(x)))
|
||||
#if defined(NO_HASH_CPU_OPTIMIZATION)
|
||||
#define quasi_fnv(x,val) \
|
||||
((val) = (((QCKHASH)(val)*(QCKHASH)16777619) ^ ((QCKHASH)(x))))
|
||||
#else
|
||||
#define quasi_fnv(x,val) ( \
|
||||
((val) += (((QCKHASH)(val)<<1) + ((QCKHASH)(val)<<4) + \
|
||||
((QCKHASH)(val)<<7) + ((QCKHASH)(val)<<8) + \
|
||||
((QCKHASH)(val)<<24))), \
|
||||
((val) ^= (QCKHASH)(x)) \
|
||||
)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
@@ -159,7 +186,8 @@ hashvalue(VALUE *vp, QCKHASH val)
|
||||
{
|
||||
switch (vp->v_type) {
|
||||
case V_INT:
|
||||
return fnv(vp->v_int, V_NUM+val);
|
||||
val += V_NUM;
|
||||
return quasi_fnv(vp->v_int, val);
|
||||
case V_NUM:
|
||||
return fnv_qhash(vp->v_num, val);
|
||||
case V_COM:
|
||||
@@ -177,7 +205,8 @@ hashvalue(VALUE *vp, QCKHASH val)
|
||||
case V_MAT:
|
||||
return mathash(vp->v_mat, val);
|
||||
case V_FILE:
|
||||
return fnv(vp->v_file, V_FILE+val);
|
||||
val += V_FILE;
|
||||
return quasi_fnv(vp->v_file, val);
|
||||
case V_RAND:
|
||||
return randhash(vp->v_rand, val);
|
||||
case V_RANDOM:
|
||||
@@ -189,7 +218,8 @@ hashvalue(VALUE *vp, QCKHASH val)
|
||||
case V_BLOCK:
|
||||
return blk_hash(vp->v_block, val);
|
||||
case V_OCTET:
|
||||
return fnv((int)*vp->v_octet, V_OCTET+val);
|
||||
val += V_OCTET;
|
||||
return quasi_fnv((int)*vp->v_octet, val);
|
||||
case V_NBLOCK:
|
||||
return blk_hash(vp->v_nblock->blk, val);
|
||||
default:
|
||||
@@ -207,7 +237,8 @@ static QCKHASH
|
||||
assochash(ASSOC *ap, QCKHASH val)
|
||||
{
|
||||
/* XXX - hash the first and last values??? */
|
||||
return fnv(ap->a_count, V_ASSOC+val);
|
||||
val += V_ASSOC;
|
||||
return quasi_fnv(ap->a_count, val);
|
||||
}
|
||||
|
||||
|
||||
@@ -250,15 +281,16 @@ mathash(MATRIX *m, QCKHASH val)
|
||||
/*
|
||||
* hash size parts of the matrix
|
||||
*/
|
||||
val = fnv(m->m_dim, V_MAT+val);
|
||||
val = fnv(m->m_size, val);
|
||||
val += V_MAT;
|
||||
quasi_fnv(m->m_dim, val);
|
||||
quasi_fnv(m->m_size, val);
|
||||
|
||||
/*
|
||||
* hash the matrix index bounds
|
||||
*/
|
||||
for (i = m->m_dim - 1; i >= 0; i--) {
|
||||
val = fnv(m->m_min[i], val);
|
||||
val = fnv(m->m_max[i], val);
|
||||
quasi_fnv(m->m_min[i], val);
|
||||
quasi_fnv(m->m_max[i], val);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -294,7 +326,7 @@ objhash(OBJECT *op, QCKHASH val)
|
||||
{
|
||||
int i;
|
||||
|
||||
val = fnv(op->o_actions->oa_index, val);
|
||||
quasi_fnv(op->o_actions->oa_index, val);
|
||||
|
||||
i = op->o_actions->oa_count;
|
||||
while (--i >= 0)
|
||||
@@ -323,10 +355,11 @@ randhash(RAND *r, QCKHASH val)
|
||||
return V_RAND+val;
|
||||
} else {
|
||||
/* hash control values */
|
||||
val = fnv(r->j, V_RAND+val);
|
||||
val = fnv(r->k, val);
|
||||
val = fnv(r->bits, val);
|
||||
val = fnv(r->need_to_skip, val);
|
||||
val += V_RAND;
|
||||
quasi_fnv(r->j, val);
|
||||
quasi_fnv(r->k, val);
|
||||
quasi_fnv(r->bits, val);
|
||||
quasi_fnv(r->need_to_skip, val);
|
||||
|
||||
/* hash the state arrays */
|
||||
return fnv_fullhash(&r->buffer[0], SLEN+SCNT+SHUFLEN, val);
|
||||
@@ -356,7 +389,8 @@ randomhash(RANDOM *state, QCKHASH val)
|
||||
/*
|
||||
* hash a seeded RANDOM state
|
||||
*/
|
||||
val = fnv(state->buffer+state->bits, V_RANDOM+val);
|
||||
val += V_RANDOM;
|
||||
quasi_fnv(state->buffer+state->bits, val);
|
||||
if (state->r.v != NULL) {
|
||||
val = fnv_zhash(state->r, val);
|
||||
}
|
||||
@@ -424,7 +458,8 @@ config_hash(CONFIG *cfg, QCKHASH val)
|
||||
/*
|
||||
* hash the built up scalar
|
||||
*/
|
||||
val = fnv(value, V_CONFIG+val);
|
||||
val += V_CONFIG;
|
||||
quasi_fnv(value, val);
|
||||
|
||||
/*
|
||||
* hash the strings if possible
|
||||
@@ -472,7 +507,7 @@ fnv_strhash(char *ch, QCKHASH val)
|
||||
* hash each character in the string
|
||||
*/
|
||||
while (*ch) {
|
||||
val = fnv(*ch++, val);
|
||||
quasi_fnv(*ch++, val);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
@@ -500,7 +535,7 @@ fnv_STRhash(STRING *str, QCKHASH val)
|
||||
* hash each character in the string
|
||||
*/
|
||||
while (n-- > 0) {
|
||||
val = fnv(*ch++, val);
|
||||
quasi_fnv(*ch++, val);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
@@ -524,7 +559,7 @@ fnv_fullhash(FULL *v, LEN len, QCKHASH val)
|
||||
* hash each character in the string
|
||||
*/
|
||||
while (len-- > 0) {
|
||||
val = fnv(*v++, val);
|
||||
quasi_fnv(*v++, val);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
@@ -552,7 +587,8 @@ fnv_zhash(ZVALUE z, QCKHASH val)
|
||||
/*
|
||||
* hash the sign
|
||||
*/
|
||||
val = fnv(z.sign, val + V_NUM);
|
||||
val += V_NUM;
|
||||
quasi_fnv(z.sign, val);
|
||||
|
||||
n = z.len;
|
||||
hp = z.v;
|
||||
@@ -561,15 +597,15 @@ fnv_zhash(ZVALUE z, QCKHASH val)
|
||||
while (n > 1) {
|
||||
f = (FULL) *hp++;
|
||||
f |= (FULL) *hp++ << BASEB;
|
||||
val = fnv(f, val);
|
||||
quasi_fnv(f, val);
|
||||
n -= 2;
|
||||
}
|
||||
if (n) {
|
||||
val = fnv(*hp, val);
|
||||
quasi_fnv(*hp, val);
|
||||
}
|
||||
#else
|
||||
while (n-- > 0) {
|
||||
val = fnv(*hp, val);
|
||||
quasi_fnv(*hp, val);
|
||||
++hp;
|
||||
}
|
||||
#endif
|
||||
@@ -596,7 +632,7 @@ hash_hash(HASH *hash, QCKHASH val)
|
||||
* hash each USB8 in the BLOCK
|
||||
*/
|
||||
for (i=0; i < hash->unionsize; ++i) {
|
||||
val = fnv(hash->h_union.data[i], val);
|
||||
quasi_fnv(hash->h_union.data[i], val);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
@@ -625,7 +661,7 @@ blk_hash(BLOCK *blk, QCKHASH val)
|
||||
*/
|
||||
if (blk->datalen > 0) {
|
||||
for (i=0; i < blk->datalen; ++i) {
|
||||
val = fnv(blk->data[i], val);
|
||||
quasi_fnv(blk->data[i], val);
|
||||
}
|
||||
}
|
||||
return val;
|
||||
|
183
rpm.mk
Normal file
183
rpm.mk
Normal file
@@ -0,0 +1,183 @@
|
||||
#!/bin/make
|
||||
#****h* calc/rpm.mk
|
||||
#
|
||||
# rpm.mk - Makefile for building rpm packages for calc
|
||||
#
|
||||
# Copyright (C) 2003 Petteri Kettunen and Landon Curt Noll
|
||||
#
|
||||
# Calc is open software; you can redistribute it and/or modify it under
|
||||
# the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# Calc is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
# Public License for more details.
|
||||
#
|
||||
# A copy of version 2.1 of the GNU Lesser General Public License is
|
||||
# distributed with calc under the filename COPYING-LGPL. You should have
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
MAKEFILE_REV= $$Revision: 29.13 $$
|
||||
# @(#) $Id: rpm.mk,v 29.13 2003/04/15 03:39:17 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/RCS/rpm.mk,v $
|
||||
#
|
||||
# Under source code control: 2003/02/16 20:21:39
|
||||
# File existed as early as: 2003
|
||||
#
|
||||
# chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
# Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
#
|
||||
# calculator by David I. Bell with help/mods from others
|
||||
# Makefile by Petteri Kettunen with modifications from Landon Curt Noll
|
||||
|
||||
# setup
|
||||
#
|
||||
SHELL= /bin/sh
|
||||
RPMBUILD_TOOL= rpmbuild
|
||||
TARCH= i686
|
||||
RPMBUILD_OPTION= -ba --target=${TARCH}
|
||||
RPM_TOOL= rpm
|
||||
MD5SUM= md5sum
|
||||
SHA1SUM= sha1sum
|
||||
SED= sed
|
||||
|
||||
# rpm-related parameters
|
||||
#
|
||||
PROJECT_NAME= calc
|
||||
PROJECT_VERSION=
|
||||
PROJECT_RELEASE=
|
||||
PROJECT= $(PROJECT_NAME)-$(PROJECT_VERSION)
|
||||
SPECFILE= $(PROJECT_NAME).spec
|
||||
TARBALL= $(PROJECT).tar.gz
|
||||
RPM686= $(PROJECT)-$(PROJECT_RELEASE).${TARCH}.rpm
|
||||
DRPM686= $(PROJECT_NAME)-devel-$(PROJECT_VERSION)-$(PROJECT_RELEASE).${TARCH}.rpm
|
||||
SRPM= $(PROJECT)-$(PROJECT_RELEASE).src.rpm
|
||||
TMPDIR= /var/tmp
|
||||
RHDIR= /usr/src/redhat
|
||||
|
||||
all: calc.spec ver_calc
|
||||
$(MAKE) -f rpm.mk PROJECT_VERSION="`./ver_calc`" \
|
||||
PROJECT_RELEASE="`${SED} -n -e '/^Release:/s/^Release: *//p' \
|
||||
calc.spec.in`" rpm
|
||||
|
||||
pkgme: $(PROJECT_NAME)-spec.tar.gz
|
||||
|
||||
ver_calc:
|
||||
$(MAKE) -f Makefile ver_calc
|
||||
|
||||
.PHONY: vers
|
||||
vers:
|
||||
$(MAKE) -f Makefile ver_calc
|
||||
|
||||
calc.spec: calc.spec.in ver_calc
|
||||
rm -f calc.spec
|
||||
${SED} -e 's/<<<PROJECT_VERSION>>>/'"`./ver_calc`"/g \
|
||||
calc.spec.in > calc.spec
|
||||
|
||||
.PHONY: srcpkg
|
||||
srcpkg: make_rhdir
|
||||
find . -depth -print | egrep -v '/RCS|/CVS|/NOTES|\.gone' | \
|
||||
cpio -dumpv $(TMPDIR)/$(PROJECT)
|
||||
(cd $(TMPDIR); tar cf - $(PROJECT) | \
|
||||
gzip -c > $(RHDIR)/SOURCES/$(TARBALL))
|
||||
rm -fr $(TMPDIR)/$(PROJECT)
|
||||
|
||||
.PHONY: rpm
|
||||
rpm: srcpkg calc.spec
|
||||
$(MAKE) -f Makefile clean
|
||||
cp $(SPECFILE) $(RHDIR)/SPECS/$(SPECFILE)
|
||||
rm -f $(RHDIR)/RPMS/${TARCH}/$(RPM686)
|
||||
rm -f $(RHDIR)/RPMS/${TARCH}/$(DRPM686)
|
||||
rm -f $(RHDIR)/SRPMS/$(SRPM)
|
||||
${RPMBUILD_TOOL} ${RPMBUILD_OPTION} $(RHDIR)/SPECS/$(SPECFILE)
|
||||
@if [ ! -f "$(RHDIR)/SRPMS/$(SRPM)" ]; then \
|
||||
echo "SRPMS/$(SRPM) not found" 1>&2; \
|
||||
exit 3; \
|
||||
fi
|
||||
@echo
|
||||
@echo "RPM package sizes:"
|
||||
@echo
|
||||
@cd $(RHDIR); ls -1s RPMS/${TARCH}/$(RPM686) \
|
||||
RPMS/${TARCH}/$(DRPM686) SRPMS/$(SRPM)
|
||||
@echo
|
||||
@echo "RPM package md5 hashes:"
|
||||
@echo
|
||||
-@cd $(RHDIR); ${MD5SUM} RPMS/${TARCH}/$(RPM686) \
|
||||
RPMS/${TARCH}/$(DRPM686) SRPMS/$(SRPM)
|
||||
@echo
|
||||
@echo "RPM package sha1 hashes:"
|
||||
@echo
|
||||
-@cd $(RHDIR); ${SHA1SUM} RPMS/${TARCH}/$(RPM686) \
|
||||
RPMS/${TARCH}/$(DRPM686) SRPMS/$(SRPM)
|
||||
@echo
|
||||
@echo "RPM package locations:"
|
||||
@echo
|
||||
@ls -1 $(RHDIR)/RPMS/${TARCH}/$(RPM686) \
|
||||
$(RHDIR)/RPMS/${TARCH}/$(DRPM686) $(RHDIR)/SRPMS/$(SRPM)
|
||||
@echo
|
||||
@echo "All done! -- Jessica Noll, Age 2"
|
||||
@echo
|
||||
|
||||
.PHONY: make_rhdir
|
||||
make_rhdir:
|
||||
for i in $(RHDIR) $(RHDIR)/RPMS $(RHDIR)/SOURCES \
|
||||
$(RHDIR)/SPECS $(RHDIR)/SRPMS $(RHDIR)/BUILD; do \
|
||||
if [ ! -d $$i ] ; then \
|
||||
mkdir -p $$i; \
|
||||
fi; \
|
||||
done;
|
||||
|
||||
# date format for spec file
|
||||
.PHONY: logdate
|
||||
logdate:
|
||||
echo "`date +'* %a %b %d %Y'` `whoami`"
|
||||
|
||||
.PHONY: chkpkg
|
||||
chkpkg:
|
||||
for i in $(RHDIR)/RPMS/${TARCH}/$(RPM686) \
|
||||
$(RHDIR)/RPMS/${TARCH}/$(DRPM686) \
|
||||
$(RHDIR)/SRPMS/$(SRPM) ; do \
|
||||
echo "***** start $$i" ; \
|
||||
${RPM_TOOL} -qpi $$i ; \
|
||||
echo "***** files $$i" ; \
|
||||
${RPM_TOOL} -qpl $$i ; \
|
||||
echo "***** end $$i" ; \
|
||||
done ;
|
||||
|
||||
.PHONY: chksys
|
||||
chksys:
|
||||
${RPM_TOOL} -qa | grep $(PROJECT_NAME)
|
||||
${RPM_TOOL} -qa | grep $(PROJECT_NAME)-devel
|
||||
|
||||
.PHONY: test
|
||||
test: ver_calc
|
||||
@if [ X"`id -u`" != X"0" ]; then \
|
||||
echo "test needs to install, must be root to test" 1>&2; \
|
||||
exit 4; \
|
||||
fi
|
||||
$(MAKE) -f rpm.mk PROJECT_VERSION="`./ver_calc`" installrpm chksys
|
||||
|
||||
.PHONY: installrpm
|
||||
installrpm:
|
||||
@if [ X"`id -u`" != X"0" ]; then \
|
||||
echo "must be root to install RPMs" 1>&2; \
|
||||
exit 5; \
|
||||
fi
|
||||
${RPM_TOOL} -ivh $(RHDIR)/RPMS/${TARCH}/$(RPM686)
|
||||
${RPM_TOOL} -ivh $(RHDIR)/RPMS/${TARCH}/$(DRPM686)
|
||||
|
||||
.PHONY: uninstallrpm
|
||||
uninstallrpm:
|
||||
@if [ X"`id -u`" != X"0" ]; then \
|
||||
echo "must be root to uninstall RPMs" 1>&2; \
|
||||
exit 6; \
|
||||
fi
|
||||
${RPM_TOOL} -e $(PROJECT_NAME)-devel
|
||||
${RPM_TOOL} -e $(PROJECT_NAME)
|
||||
|
||||
$(PROJECT_NAME)-spec.tar.gz: rpm.mk $(PROJECT_NAME).spec.in
|
||||
tar cf - $^ | gzip -c > $@
|
||||
|
||||
#****
|
12
version.c
12
version.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* version - determine the version of calc
|
||||
*
|
||||
* Copyright (C) 1999-2002 David I. Bell and Landon Curt Noll
|
||||
* Copyright (C) 1999-2003 David I. Bell and Landon Curt Noll
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.43 $
|
||||
* @(#) $Id: version.c,v 29.43 2003/01/14 04:10:16 chongo Exp $
|
||||
* @(#) $Revision: 29.48 $
|
||||
* @(#) $Id: version.c,v 29.48 2003/08/26 04:35:32 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $
|
||||
*
|
||||
* Under source code control: 1990/05/22 11:00:58
|
||||
@@ -45,8 +45,8 @@ static char *program;
|
||||
|
||||
#define MAJOR_VER 2 /* major version */
|
||||
#define MINOR_VER 11 /* minor version */
|
||||
#define MAJOR_PATCH 6 /* patch level or 0 if no patch */
|
||||
#define MINOR_PATCH 2 /* test number or 0 if no minor patch */
|
||||
#define MAJOR_PATCH 8 /* patch level or 0 if no patch */
|
||||
#define MINOR_PATCH 1 /* test number or 0 if no minor patch */
|
||||
|
||||
|
||||
/*
|
||||
@@ -70,7 +70,7 @@ static char *stored_version = NULL; /* version formed if != NULL */
|
||||
char *Copyright = "\n"
|
||||
"calc - arbitrary precision calculator\n"
|
||||
"\n"
|
||||
"@(#) Copyright (C) 1999 David I. Bell, Landon Curt Noll and Ernest Bowen\n"
|
||||
"@(#) Copyright (C) 2003 David I. Bell, Landon Curt Noll and Ernest Bowen\n"
|
||||
"\n"
|
||||
"Primary author: David I. Bell\n"
|
||||
"\n"
|
||||
|
12
zfunc.c
12
zfunc.c
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: zfunc.c,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: zfunc.c,v 29.4 2003/08/26 04:35:11 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zfunc.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:27
|
||||
@@ -817,7 +817,9 @@ zgcd(ZVALUE z1, ZVALUE z2, ZVALUE *res)
|
||||
needw = TRUE;
|
||||
|
||||
w = 0;
|
||||
j = 0;
|
||||
while (m) { /* START OF MAIN LOOP */
|
||||
if (m - n < 2 || needw) {
|
||||
q = 0;
|
||||
u = *a0;
|
||||
v = 1;
|
||||
@@ -872,6 +874,8 @@ zgcd(ZVALUE z1, ZVALUE z2, ZVALUE *res)
|
||||
else g &= BASE1;
|
||||
}
|
||||
else g = 1;
|
||||
} else
|
||||
g = (HALF) *a0 * w;
|
||||
a = a0;
|
||||
b = b0;
|
||||
i = n;
|
||||
@@ -947,6 +951,10 @@ zgcd(ZVALUE z1, ZVALUE z2, ZVALUE *res)
|
||||
}
|
||||
a0 += q;
|
||||
m -= q;
|
||||
while (m && !*a0) { /* Removing trailing zeros */
|
||||
m--;
|
||||
a0++;
|
||||
}
|
||||
}
|
||||
while (m && !a0[m-1]) m--; /* Removing leading zeros */
|
||||
}
|
||||
|
Reference in New Issue
Block a user