Release calc version 2.11.7

This commit is contained in:
Landon Curt Noll
2003-02-28 15:27:09 -08:00
parent 8db4e7af47
commit e1a3dfda0b
13 changed files with 507 additions and 206 deletions

51
CHANGES
View File

@@ -1,8 +1,55 @@
The following are the changes from calc version 2.11.7.0 to date:
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:
@@ -5514,8 +5561,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.55 $
## @(#) $Id: CHANGES,v 29.55 2003/01/21 11:14:15 chongo Exp $
## @(#) $Revision: 29.59 $
## @(#) $Id: CHANGES,v 29.59 2003/02/26 17:17:12 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
##
## Under source code control: 1993/06/02 18:12:57

View File

@@ -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:

223
Makefile
View File

@@ -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 \

View File

@@ -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: deg.cal,v 29.3 2003/01/21 11:12:37 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
@@ -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;
}

View File

@@ -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.15 $
* @(#) $Id: regress.cal,v 29.15 2003/01/26 19:42:03 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $
*
* Under source code control: 1990/02/15 01:50:36
@@ -759,7 +759,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 +1038,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');

View File

@@ -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);
}

116
calc.spec.in Normal file
View 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.11 $
# @(#) $Id: calc.spec.in,v 29.11 2003/02/26 17:59:01 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: 2
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
#****

View File

@@ -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

View File

@@ -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

View File

@@ -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

16
qfunc.c
View File

@@ -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);

202
rpm.mk Normal file
View File

@@ -0,0 +1,202 @@
#!/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.12 $$
# @(#) $Id: rpm.mk,v 29.12 2003/02/26 17:36:14 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
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
RPM386= $(PROJECT)-$(PROJECT_RELEASE).i386.rpm
RPM686= $(PROJECT)-$(PROJECT_RELEASE).i686.rpm
DRPM386= $(PROJECT_NAME)-devel-$(PROJECT_VERSION)-$(PROJECT_RELEASE).i386.rpm
DRPM686= $(PROJECT_NAME)-devel-$(PROJECT_VERSION)-$(PROJECT_RELEASE).i686.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/i386/$(RPM386)
rm -f $(RHDIR)/RPMS/i386/$(DRPM386)
rm -f $(RHDIR)/SRPMS/$(SRPM)
${RPMBUILD_TOOL} -ba $(RHDIR)/SPECS/$(SPECFILE)
@if [ ! -f "RPMS/i386/$(RPM686)" ]; then \
rm -f "$(RHDIR)/RPMS/i386/$(RPM686)"; \
echo mv -f "$(RHDIR)/RPMS/i386/$(RPM386)" \
"$(RHDIR)/RPMS/i386/$(RPM686)"; \
mv -f "$(RHDIR)/RPMS/i386/$(RPM386)" \
"$(RHDIR)/RPMS/i386/$(RPM686)"; \
else \
echo "RPMS/i386/$(RPM686) not found" 1>&2; \
exit 1; \
fi
@if [ ! -f "RPMS/i386/$(DRPM386)" ]; then \
rm -f "$(RHDIR)/RPMS/i386/$(DRPM686)"; \
echo mv -f "$(RHDIR)/RPMS/i386/$(DRPM386)" \
"$(RHDIR)/RPMS/i386/$(DRPM686)"; \
mv -f "$(RHDIR)/RPMS/i386/$(DRPM386)" \
"$(RHDIR)/RPMS/i386/$(DRPM686)"; \
else \
echo "RPMS/i386/$(DRPM386) not found" 1>&2; \
exit 2; \
fi
@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/i386/$(RPM686) \
RPMS/i386/$(DRPM686) SRPMS/$(SRPM)
@echo
@echo "RPM package md5 hashes:"
@echo
-@cd $(RHDIR); ${MD5SUM} RPMS/i386/$(RPM686) \
RPMS/i386/$(DRPM686) SRPMS/$(SRPM)
@echo
@echo "RPM package sha1 hashes:"
@echo
-@cd $(RHDIR); ${SHA1SUM} RPMS/i386/$(RPM686) \
RPMS/i386/$(DRPM686) SRPMS/$(SRPM)
@echo
@echo "RPM package locations:"
@echo
@ls -1 $(RHDIR)/RPMS/i386/$(RPM686) \
$(RHDIR)/RPMS/i386/$(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/i386/$(RPM686) $(RHDIR)/RPMS/i386/$(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/i386/$(RPM686)
${RPM_TOOL} -ivh $(RHDIR)/RPMS/i386/$(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 > $@
#****

View File

@@ -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.44 $
* @(#) $Id: version.c,v 29.44 2003/01/21 11:14:15 chongo Exp $
* @(#) $Revision: 29.46 $
* @(#) $Id: version.c,v 29.46 2003/02/25 20:28:42 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 3 /* test number or 0 if no minor patch */
#define MAJOR_PATCH 7 /* patch level or 0 if no patch */
#define MINOR_PATCH 0 /* test number or 0 if no minor patch */
/*