Compare commits

...

8 Commits

Author SHA1 Message Date
Landon Curt Noll
a407c7d197 Release calc version 2.12.3.3 2017-05-21 15:38:53 -07:00
Landon Curt Noll
9ea569152a Release calc version 2.12.3.2 2017-05-21 15:38:52 -07:00
Landon Curt Noll
cbcb5801fb Release calc version 2.12.3.1 2017-05-21 15:38:52 -07:00
Landon Curt Noll
bdf495150e Release calc version 2.12.3.0 2017-05-21 15:38:52 -07:00
Landon Curt Noll
b3648f030f Release calc version 2.12.2.2 2017-05-21 15:38:51 -07:00
Landon Curt Noll
71e88bdc91 Release calc version 2.12.2.1 2017-05-21 15:38:51 -07:00
Landon Curt Noll
ca0dd4560b Release calc version 2.12.2 2017-05-21 15:38:50 -07:00
Landon Curt Noll
f62d9fa1e6 Release calc version 2.12.1.13 2017-05-21 15:38:50 -07:00
557 changed files with 14903 additions and 6526 deletions

39
BUGS
View File

@@ -74,6 +74,14 @@ Known bugs:
=-= =-=
Problems that have known work-a-rounds:
* There is a bug in gcc v4.1.0 that causes calc to fail the regression
test. The work-a-round is to compile with gcc v4.1.1 or later. This
problems was observed on Fedora 5.
=-=
mis-features in calc: mis-features in calc:
Some problems are not bugs but rarther mis-features / things that could Some problems are not bugs but rarther mis-features / things that could
@@ -121,30 +129,7 @@ mis-features in calc:
will not. will not.
=-= ## Copyright (C) 1999-2007 Landon Curt Noll
Problems with old systems that have known work-a-rounds:
* There is a bug in gcc-2.95 that causes calc, when compiled with -O2,
to fail the regression test. The work-a-round is to compile with -O
or to use gcc-2.96 or later.
* There are problems compiling calc on the sparcv9 under 64 bit
Solaris. On that platform, gcc-2.96 is able to compile calc, but
calc dumps core very early on in startup. It is said that sparcv9
support in gcc-2.96 is very unofficial and thus there is no
work-a-round for gcc-2-96.
There is a work-a-round for this architecture us one is using the
Solaris CC on the sparcv9. It has been reported that setting the
following Makefile variables will produce a working version of
calc on the sparcv9 under 64 bit Solaris:
LCC="cc -xarch=v9"
CCWARN="-DFORCE_STDC -w"
DEBUG="-fast -xarch=v9"
## Copyright (C) 1999-2006 Landon Curt Noll
## ##
## Calc is open software; you can redistribute it and/or modify it under ## 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 ## the terms of the version 2.1 of the GNU Lesser General Public License
@@ -158,10 +143,10 @@ Problems with old systems that have known work-a-rounds:
## A copy of version 2.1 of the GNU Lesser General Public License is ## 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 ## distributed with calc under the filename COPYING-LGPL. You should have
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
## ##
## @(#) $Revision: 29.26 $ ## @(#) $Revision: 30.1 $
## @(#) $Id: BUGS,v 29.26 2007/01/03 21:26:22 chongo Exp $ ## @(#) $Id: BUGS,v 30.1 2007/03/16 11:09:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/BUGS,v $ ## @(#) $Source: /usr/local/src/cmd/calc/RCS/BUGS,v $
## ##
## Under source code control: 1994/03/18 14:06:13 ## Under source code control: 1994/03/18 14:06:13

393
CHANGES
View File

@@ -1,4 +1,146 @@
The following are the changes from calc version 2.12.1.10 to date: The following are the changes from calc version 2.12.3.0 to date:
Fixed the Jacobi function where it returned 1 when it should have
returned 0. Thanks goes to Kevin Sopp (baraclese at googlemail dot com)
for discovering the problem and suggesting the nature if the fix.
Calc versions will always be of the form x.y.z.w even when the
MINOR_PATCH (w) is 0. Thus, 2.12.3.0 will be printed as 2.12.3.0
instread of just 2.12.3.
Added MINGW32_NT-5.0 compile target based on a patch from
Brian L. Angus (angus at eng dot utah dot edu).
Removed the use of rpm.release in the Makefile.
Mac OS Darwin targets no longer attempt to use ldconfig. Under the
Darwin target, the LDCONFIG make variable is redefined to be
an empty value. Thanks goes to Ralf Trinler (art at infra dot de)
for reporting this problem.
The ${CALC_INCDIR}/custom is no longer being removed at install time
if it is empty. Now when ${ALLOW_CUSTOM} make variable is empty,
an empty ${CALC_INCDIR}/custom may be left hehind.
Fixed a problem where a "make clobber" would remove custom/Makefile
and fail to rebuilt it.
The following are the changes from calc version 2.12.2.3 to 2.12.2.4:
Added OpenBSD target.
Using the -r test instead of the -e test in Makefiles because some
out of date shells still do not have the -e test.
The Makefile now avoids the use of if ! command because some out of
date shells to not support the ! construct.
The following are the changes from calc version 2.12.1.1 to 2.12.2.2:
Added an explicit Solaris target.
Fixed confusion in Makefile where some uses of ${EXT} were misnamed ${EXE}.
Added a "make strip" rule, per suggestion from Igor Furlan <primorec
at sbcglobal dot net>, to allow one to strip previously built binary
executables and libraries.
Under the Darwin / OS X target, ${DARWIN_ARCH} is left empty meaning
that calc is compiled for the native CPU type instead of Universal
Binary (Intel and PPC).
By default, the calc binary that is built for the rpm forces
${LD_SHARE} to be empty. An empty ${LD_SHARE} means that the calc
from the rpm does not set rpath. This in turn causes the default
system path to be searched when looking for libcalc and libcustcalc.
The Makefile shipped with calc still sets ${LD_SHARE} for host targets.
By default, the dynamic shared library search path for all targets
starts with the source directory. Starting the search in the source
directory is convenient for testing and debugging but is not appropriate
for installation on a production system. To get the same effect
as the calc binary in the calc rpm, try:
make clobber
make calc-dynamic-only BLD_TYPE=calc-dynamic-only LD_SHARE=
make install
The libcalc and libcustcalc shared libraries are now tied to
the 4 level calc version instead of just 3 levels. For example,
under Linux calc version 2.12.2.1 uses /usr/lib/libcalc.so.2.12.2.1
instead of just the /usr/lib/libcalc.so.2.12.2 file. This change
was made so that calc produced by 'make clobber; make all install'
is consistent with the calc rpm.
Calc is now releasing the calc-debuginfo rpm for those RPM users who
which to use non-stripped libraries and binaries for debugging
purposes. By default, the calc rpm installed stripped binaries
and libraries.
Added this high priority item to the calc help/todo list:
It is overkill to have nearly everything wind up in libcalc.
Form a libcalcmath and a libcalclang so that an application
that just wants to link with the calc math libs can use them
without dragging in all of the other calc language, I/O,
and builtin functions.
Fixed the wording for the -i flag in the calc man page.
Added some notes to the help/unexpected file regarding calc
and interactice shells.
Fixed bug where a FILEPOS was copied FPOS_POS_BITS octets instead of
FPOS_POS_LEN octets.
Split out ${READLINE_EXTRAS} Makefile variables from ${READLINE_LIB}
to better deal with Fedora rpm requirements.
Bit 8 (0x80) of calc_debug is reserved for custom debugging.
See help/config and custom/HOW_TO_ADD for details.
When the Makefile variable ${ALLOW_CUSTOM} is not defined or empty,
the libcustcalc library is not built or linked against, certain make
rules skip going into the custom sub-directory, the install
rule skips certain custom installation actions, and the common
C flags (${COMMON_CFLAGS}) is given -UCUSTOM. Other make rules such
as "make clean" and "make clobber" still work as before. Also
the Makefile.simple assumes that the Makefile variable ${ALLOW_CUSTOM}
is -DCUSTOM.
Clarified that the calc builtin functions rand() and random()
operate over a half closed interval. The help/rand and help/random
refer to the top of the interval as "beyond" instead of "max".
Releaseing source tar balls using bzip2 instead of with gzip. So
what was calc-something.tar.gz is now calc-something.tar.bz2.
To "uncompress" use:
bunzip2 calc-something.tar.bz2
On some systems, one may untar directly by:
tar -jxvf calc-something.tar.bz2
The Makefile variable ${BYTE_ORDER} was replaced by ${CALC_BYTE_ORDER}.
Changed the way the Makefile can force the calc byte order. If you set
the Makefile variable ${CALC_BYTE_ORDER} to be -DCALC_BIG_ENDIAN then
endian.h will force the CPP symbol CALC_BYTE_ORDER to be BIG_ENDIAN.
If you set ${CALC_BYTE_ORDER} to be -DCALC_LITTLE_ENDIAN then endian.h
will force the CPP symbol CALC_BYTE_ORDER to be LITTLE_ENDIAN.
If the Makefile variable ${CALC_BYTE_ORDER} is empty, then the CPP
symbol CALC_BYTE_ORDER will set to the CPP symbol BYTE_ORDER as
defined by some system include file (if the Makefile can find such
an include file), or the Makefile compiling endian.c and hopefully
using that result to set CPP symbol CALC_BYTE_ORDER. Regardless of
how it happens, the CPP symbol CALC_BYTE_ORDER should end up set in
endian_calc.h include file.
The following are the changes from calc version 2.12.1.10 to 2.12.2:
Put back the missing -s flags on the cscripts: mersenne, 4dsphere, Put back the missing -s flags on the cscripts: mersenne, 4dsphere,
fprodcut, plus, and powerterm. Thanks goes to Bradley Reed fprodcut, plus, and powerterm. Thanks goes to Bradley Reed
@@ -10,15 +152,13 @@ The following are the changes from calc version 2.12.1.10 to date:
All extern functions are now declared with the symbol E_FUNC. All extern functions are now declared with the symbol E_FUNC.
The include file decl.h defines these 4 symbols by default The include file decl.h defines these 4 symbols by default
to static, extern, static, and extern respectively. Under to static, extern, static, and extern respectively. Under
Windoz, DLL is also defined accorind to the _EXPORTING symbol Windoz, DLL is also defined according to the _EXPORTING symbol
and is prepended to the EXTERN and E_FUNC symbols. The decl.h and is prepended to the EXTERN and E_FUNC symbols. The decl.h
file has replaced the win32dll.h file. file has replaced the win32dll.h file.
Added Apple Mac OS X compiler set in the Makefile. When WITH_TLS is defined, calc attempts to compile with Thread Local
Storage. As of version 2.12.1.12 this mode is extremely experimental.
When MACOSX_TLS is defined, calc attempts to compile with OS Calc may not compile when WITH_TLS defined.
X Thread Local Storage. As of version 2.12.1.12 this mode is
extremely experimental. Calc may not compile with MACOSX_TLS defined.
Fixed E_FUNC vs EXTERN issues discovered by Mirko Viviani Fixed E_FUNC vs EXTERN issues discovered by Mirko Viviani
<mirko at objectlab dot org>. <mirko at objectlab dot org>.
@@ -29,7 +169,225 @@ The following are the changes from calc version 2.12.1.10 to date:
and contains an forced error saying that stdlib.h should be used and contains an forced error saying that stdlib.h should be used
instead. The Makefile symbol HAVE_MALLOC has been removed. instead. The Makefile symbol HAVE_MALLOC has been removed.
Fixed FreeBSD dereferencing type-punned pointer error in filepos2z(). Moved the sample code in the sample sub-directory up into the
main source level. The sample/many_random.c source file is
now sample_many.c. The sample/test_random.c source file is now
sample_rand.c. The sample Makefile and the sub-directory is no more.
Renamed the following source files:
math_error.h ==> lib_calc.h
string.c ==> str.c
string.h ==> str.h
Renamed the following variables related to calc error processing:
int calc_jmp ==> int calc_use_matherr_jmpbuf
jmp_buf calc_jmp_buf ==> jmp_buf calc_matherr_jmpbuf
int post_init ==> int calc_use_scanerr_jmpbuf
jmp_buf jmpbuf ==> jmpbuf calc_scanerr_jmpbuf
char *calc_error ==> char calc_err_msg[MAXERROR+1]
These values are now declared in the lib_calc.h include file.
The value MAXERROR is now defined in lib_calc.h instead of calc.h.
The calc_err_msg[] buffer is now used for math errors as well
as scan and parse errors.
Parse/scan errors will not be printed if calc_print_scanerr_msg
is zero. By default:
int calc_print_scanerr_msg = 1;
This variable is declared in the lib_calc.h include file. Storage
comes from libcalc.
Parse/scan warnings will not be printed if calc_print_scanwarn_msg
is zero. By default:
int calc_print_scanwarn_msg = 1;
This variable is declared in the lib_calc.h include file. Storage
comes from libcalc.
The last parse/scan error message is stored in the calc_err_msg[]
buffer. This happens even when calc_print_scanerr_msg is zero.
The last parse/scan warning message is stored in the calc_warn_msg[]
buffer. After each parse/scan warning condition is detected,
the value calc_warn_cnt is incremented. This happens even when
calc_print_scanwarn_msg is zero.
The calc_warn_msg[] buffer and calc_warn_cnt variables are declared
in the lib_calc.h include file. Storage comes from libcalc.
See the file, LIBRARY or use the calc command "help libcalc" for
more information on calc error processing. This file has been
updated to reflect the changes noted above in this section.
The make install rule removes std_arg.h, have_malloc.h, math_error.h,
string.h, and win32dll.h from ${INCDIR} if they exist. These calc
include files are no longer supported.
Do reduce the number of special case .o build rules, the
${ALLOW_CUSTOM} make flag is added to ${CFLAGS} by default. This means
that if ALLOW_CUSTOM= -DCUSTOM, then -DCUSTOM is given to the compile
line of most .c files.
Calc -v reports "w/custom functions" or "w/o custom functions" on
the version string depending on if calc was compiled with the
ALLOW_CUSTOM= -DCUSTOM or not.
Replaced the concept of compiler sets in the Makefile with
host target section in the Makefile. Initial host targets are:
Linux
Darwin
FreeBSD
(default) <<== Target does not match any previous target name
Simple
NOTE: If your target is not supported below and the default target
is not suitable for your needs, please send to the:
calc-contrib at asthe dot com
EMail address an "ifeq ($(target),YOUR_TARGET_NAME)"
... "endif" set of lines from the Makefile so that
we can consider them for the next release.
The custom/Makefile is now constructed from 3 parts: custom/Makefile.head,
the host target section in Makefile, and the custom/Makefile.tail.
The top level Makefile and the custom/Makefile require a GNU Make
(such as gmake) or an equivalently advanced make. On many targets,
the default make is sufficient. On FreeBSD for example, one must
use gmake instead of make.
If your target system does not have GNU Make (or equivalent), then
you should try using the Makefile.simple and custom/Makefile.simple
files:
mv Makefile Makefile.gmake
cp Makefile.simple Makefile
mv custom/Makefile custom/Makefile.gmake
cp custom/Makefile.simple custom/Makefile
make all
Added the ability to build calc with dynamic libraries, static
libraries or both. Many thanks goes to Matthew Miller (mattdm
at mattdm dot org) and Mirko Viviani (mirko at objectlab dot
org) for this help, encouragement, and testing of this major change!
Added BLD_TYPE Makefile variable to control how calc is
built. The BLD_TYPE value may be one of:
BLD_TYPE= calc-dynamic-only
BLD_TYPE= calc-static-only
Each host target establishes a default BLD_TYPE value. Of course
one can override the host target BLD_TYPE on the make command line:
make clobber
make calc-dynamic-only BLD_TYPE=calc-dynamic-only
make clobber
make calc-static-only BLD_TYPE=calc-static-only
NOTE: It is a very good idea to first clobber (remove) any previously
built .o, libs and executables before switching the build
between static and dynamic.
which have the same effect as make all with a given build phase set.
For Linux and Darwin, the default BLD_TYPE is calc-dynamic-only.
For the simple case, BLD_TYPE is calc-static-only. For the
default target (the target does not match any of the previous
defined targets), BLD_TYPE is calc-static-only.
Added ${CSFLAGS} make variable to hold the {$CC} flags for compiling
without shared library. By default, ${CFLAGS} is ${CSFLAGS} with
${CC_SHARE} added to it.
Added ${CC_SHARE}, ${LIBCALC_SHLIB}, ${LIBCUSTCALC_SHLIB}, and
${LD_SHARE} to the remaining compiler sets.
Fixed make depend and make uninstall rules. Performed various
makefile syntax cleanups.
Removed ${PROGS} and ${STATIC_PROGS} Makefile variables due to
the new BLD_TYPE system (see above).
Added missing help for cp, calcpath, and stoponerror.
Noted that calc fails the regression test (and will crash at
various times) when compiled with gcc v4.1.0. This problem was
first reported under Fedora Core 5 by Christian Siebert.
Set the LESSCHARSET to iso8859 so that less will not confuse or
upset the col utility with Invalid or incomplete multi-byte or wide
characters.
Updated the Free Software Foundation postal address and updated
the COPYING-LGPL from http://www.fsf.org/licensing/licenses/lgpl.txt
on 2007-Mar-14. Calc is using the same Version 2.1 of the LGPL,
only the postal address of the Free Software Foundation has
been updated. All source files were updated to RCS level 30.
Thanks goes to Martin Buck (m at rtin-buck dor de) for this patch.
Added printf arg checking for GNU C compilers that helps check
printf-style functions in calc. Thanks goes to Martin Buck (m at
rtin-buck dor de) for this patch.
Fixed issues where the argument of a printf-like did not match the
format type.
Removed build function md5(). The MD5 hash has been compromised to
such a degree that is it no longer advisable to use this function.
Removed build function sha(). The SHA hash has been compromised to
such a degree that is it no longer advisable to use this function.
Note that the SHA-1 hash has not been compromised to the same degree
and so this hash function remains.
Renamed shs1.c to sha1.c. Renamed shs1.h to sha1.h.
Added custom registers. The custom register function:
custom("register", 3)
returns the value of custom register 3. Custom registers, initialized
with 0, may take on any calc value:
custom("register", regnum, value)
Added REGNUM_MAX to the sysinfo custom function to return the maximum
register number:
custom("sysinfo", "REGNUM_MAX")
which defaults to 31. The first custom register is 0 and thus the
default number of custom registers is 32.
Added E_OK #define in calc.h to indicate no error (0).
Renamed C function powivalue() in value.c to powvalue() because it
now handles raising NUMBER or COMPLEX to a NUMBER or COMPLEX power.
The powervalue() function in value.c may be given a NULL epsilon
which will cause to the builtin epsilon value to be used.
Calc supports both real and complex exponentiation bases and exponents.
For a ^ b and a ** b, "a" and "b" can be a real value or a complex value:
2^3 3i^4
2.5 ^ 3.5 0.5i ^ 0.25
2.5 ^ 2.718i 3.13145i ^ 0.30103i
Fixed typos in the calc man page thanks to a Debian bug report
by A. Costa <agcosta at gis dot .net> that wsa kindly forwarded
to us by Martin Buck <m at rtin-buck dot de>.
The following are the changes from calc version 2.12.1.8 to 2.12.1.9: The following are the changes from calc version 2.12.1.8 to 2.12.1.9:
@@ -41,11 +399,11 @@ The following are the changes from calc version 2.12.1.8 to 2.12.1.9:
/* c style comments */ /* c style comments */
/* /*
* multi-line * multi-line
* commentts * comments
*/ */
## two or more #-signs ## two or more #-signs
### in a row ### in a row
### Note that # along is a calc uniary and binary operator ### Note that # along is a calc unary and binary operator
Added "help pound" or "help #' to document the # operator, comments, Added "help pound" or "help #' to document the # operator, comments,
and the first line of cscript files. and the first line of cscript files.
@@ -62,7 +420,7 @@ The following are the changes from calc version 2.12.1.8 to 2.12.1.9:
The usage help file is now formed from the contents of the calc man page. The usage help file is now formed from the contents of the calc man page.
So "help usage" prints the version of the calc man page. Added ${COL} So "help usage" prints the version of the calc man page. Added ${COL}
makefile symbol to support the formation of the calc.usage file from makefile symbol to support the formation of the calc.usage file from
calc.1 via the CALCPAGER (less). calc.1 via the CALCPAGER (less) or NROFF (if NROFF is non-empty).
The "help calc" command is now equivalent to "help help". The "help calc" command is now equivalent to "help help".
@@ -91,6 +449,9 @@ The following are the changes from calc version 2.12.1.8 to 2.12.1.9:
Calc and cscripts are installed mode 0755 instead of 0555 to Calc and cscripts are installed mode 0755 instead of 0555 to
make rpmlint happy. make rpmlint happy.
Make clobber cleanup as suggested by Martin Buck <m at rtin-buck dot de>.
The clobber rule now depends on the clean rule.
The following are the changes from calc version 2.12.1.6 to 2.12.1.7: The following are the changes from calc version 2.12.1.6 to 2.12.1.7:
@@ -99,7 +460,7 @@ The following are the changes from calc version 2.12.1.6 to 2.12.1.7:
builtin, the CPU time reported for long running processes will not builtin, the CPU time reported for long running processes will not
wrap around to 0 after only a few months. wrap around to 0 after only a few months.
Added the calc builtin function, systime(), to return the amount of Added the calc built0in function, systime(), to return the amount of
kernel CPU time used by the current process. kernel CPU time used by the current process.
The runtime() builtin function now returns the total amount of CPU The runtime() builtin function now returns the total amount of CPU
@@ -169,7 +530,7 @@ The following are the changes from calc version 2.12.1 to 2.12.1.5:
Removed the ECHO_PROG Makefile variable. Also removed it from Removed the ECHO_PROG Makefile variable. Also removed it from
the sysinfo() custom function. the sysinfo() custom function.
Improved the support for cross-compiled environmens by using Improved the support for cross-compiled environments by using
make symbols for all non-shell commands executed by Makefiles. make symbols for all non-shell commands executed by Makefiles.
Fixed a problem with the make chk awk script which failed under Fixed a problem with the make chk awk script which failed under
@@ -6371,10 +6732,10 @@ Following is a list of visible changes to calc from version 1.24.7 to 1.26.1:
## A copy of version 2.1 of the GNU Lesser General Public License is ## 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 ## distributed with calc under the filename COPYING-LGPL. You should have
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
## ##
## @(#) $Revision: 29.100 $ ## @(#) $Revision: 30.17 $
## @(#) $Id: CHANGES,v 29.100 2007/02/12 08:22:13 chongo Exp $ ## @(#) $Id: CHANGES,v 30.17 2008/05/10 10:53:34 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $ ## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
## ##
## Under source code control: 1993/06/02 18:12:57 ## Under source code control: 1993/06/02 18:12:57

12
COPYING
View File

@@ -12,8 +12,8 @@ This file is Copyrighted
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
# @(#) $Revision: 29.9 $ # @(#) $Revision: 30.1 $
# @(#) $Id: COPYING,v 29.9 2007/02/11 10:16:31 chongo Exp $ # @(#) $Id: COPYING,v 30.1 2007/03/16 11:09:46 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/COPYING,v $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/COPYING,v $
=-= =-=
@@ -45,12 +45,12 @@ Calc is covered by the GNU Lesser General Public License
Public License by the calc command: help copying-lgpl Public License by the calc command: help copying-lgpl
You should have received a copy of the version 2.1 GNU Lesser General You should have received a copy of the version 2.1 GNU Lesser General
Public License with calc; if not, write to: Public License with calc; if not, write to the following address:
Free Software Foundation, Inc. Free Software Foundation, Inc.
59 Temple Place 51 Franklin Street
Suite 330 Fifth Floor
Boston, MA 02111-1307 Boston, MA 02110-1301
USA USA
The contact addresses for calc is as follows: The contact addresses for calc is as follows:

View File

@@ -2,7 +2,7 @@
Version 2.1, February 1999 Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc. Copyright (C) 1991, 1999 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
@@ -476,7 +476,7 @@ convey the exclusion of warranty; and each file should have at least the
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version. version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -485,7 +485,7 @@ convey the exclusion of warranty; and each file should have at least the
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Also add information on how to contact you by electronic and paper mail. Also add information on how to contact you by electronic and paper mail.

View File

@@ -1,4 +1,4 @@
Installing calc from the gziped tarball in 4 easy steps: Installing calc from the bzip2-ed tarball in 4 easy steps:
0) If your platform supports i686 RPMs, you may want to go to: 0) If your platform supports i686 RPMs, you may want to go to:
@@ -17,16 +17,30 @@ Installing calc from the gziped tarball in 4 easy steps:
The following 4 steps apply to calc source tree that comes from either: The following 4 steps apply to calc source tree that comes from either:
gunzip -c calc-*.tar.gz | tar -xvf - bunzip2 -c calc-*.tar.bz2 | tar -xvf -
or from: or from:
rpm -ivh calc-*.src.rpm rpm -ivh calc-*.src.rpm
cd /var/tmp cd /var/tmp
gunzip -c /usr/src/redhat/SOURCES/calc-*.tar.gz | tar -xvf - bunzip2 -c /usr/src/redhat/SOURCES/calc-*.tar.bz2 | tar -xvf -
1) Look at the makefile, and adjust it to suit your needs. 1) Look at the makefile, and adjust it to suit your needs.
The top level Makefile and the custom/Makefile require a GNU
Make (such as gmake) or an equivalently advanced make. On many
targets, the default make is sufficent. On FreeBSD for example,
one must use gmake instead of make.
If your target system does not have GNU Make (or equivalent), then
you should try using the Makefile.simple and custom/Makefile.simple
files:
mv Makefile Makefile.gmake
cp Makefile.simple Makefile
mv custom/Makefile custom/Makefile.gmake
cp custom/Makefile.simple custom/Makefile
The Makefile, as shipped, is suitable for installation under The Makefile, as shipped, is suitable for installation under
Linux and Un*x-like environments. For the most part, the default Linux and Un*x-like environments. For the most part, the default
values should work. If in doubt, follow the 'When in doubt' values should work. If in doubt, follow the 'When in doubt'
@@ -126,12 +140,36 @@ Installing calc from the gziped tarball in 4 easy steps:
2) build calc: 2) build calc:
The top level Makefile and the custom/Makefile require a GNU
Make (such as gmake) or an equivalently advanced make. On many
targets, the default make is sufficent. On FreeBSD for example,
one must use gmake instead of make.
If your target system does not have GNU Make (or equivalent), then
you should try using the Makefile.simple and custom/Makefile.simple
files:
mv Makefile Makefile.gmake
cp Makefile.simple Makefile
mv custom/Makefile custom/Makefile.gmake
cp custom/Makefile.simple custom/Makefile
make all make all
==> We are interested in any compiler warnings (and errors) that ==> We are interested in any compiler warnings (and errors) that
you may find. See the BUGS file if you find any compiler you may find. See the BUGS file if you find any compiler
warning or errors. warning or errors.
NOTE: You can force calc to build with only static libs:
make clobber
make calc-static-only BLD_TYPE=calc-static-only
or force calc to build with only dynamic libs:
make clobber
make calc-dynamic-only BLD_TYPE=calc-dynamic-only
3) test calc: 3) test calc:
make check make check
@@ -139,6 +177,10 @@ Installing calc from the gziped tarball in 4 easy steps:
==> If you run into problems, read the BUGS file and follow ==> If you run into problems, read the BUGS file and follow
the instructions found in there. the instructions found in there.
NOTE: For a quiet check which only prints if something goes wrong:
make chk
4) install calc: 4) install calc:
make install make install
@@ -146,7 +188,7 @@ Installing calc from the gziped tarball in 4 easy steps:
We suggest that you might want to read the README file and look at We suggest that you might want to read the README file and look at
the calc help subsystem. See the README file for details. the calc help subsystem. See the README file for details.
## Copyright (C) 1999 Landon Curt Noll ## Copyright (C) 1999-2007 Landon Curt Noll
## ##
## Calc is open software; you can redistribute it and/or modify it under ## 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 ## the terms of the version 2.1 of the GNU Lesser General Public License
@@ -160,10 +202,10 @@ the calc help subsystem. See the README file for details.
## A copy of version 2.1 of the GNU Lesser General Public License is ## 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 ## distributed with calc under the filename COPYING-LGPL. You should have
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
## ##
## @(#) $Revision: 29.9 $ ## @(#) $Revision: 30.6 $
## @(#) $Id: HOWTO.INSTALL,v 29.9 2006/09/18 13:11:57 chongo Exp $ ## @(#) $Id: HOWTO.INSTALL,v 30.6 2007/10/16 12:22:22 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/HOWTO.INSTALL,v $ ## @(#) $Source: /usr/local/src/cmd/calc/RCS/HOWTO.INSTALL,v $
## ##
## Under source code control: 1999/09/27 20:48:44 ## Under source code control: 1999/09/27 20:48:44

251
LIBRARY
View File

@@ -58,13 +58,18 @@ External programs most likely want to use the installed calc header
files under ${INCDIRCALC}. External programs most likely NOT want files under ${INCDIRCALC}. External programs most likely NOT want
to define CALC_SRC. to define CALC_SRC.
You need to include the following file to get the symbols and variables
related to error handling:
lib_calc.h
External programs may want to compile with: External programs may want to compile with:
-L${LIBDIR} -lcalc -I${INCDIR} -L${LIBDIR} -lcalc
If custom functions are also used, they may want to compile with: If custom functions are also used, they may want to compile with:
-L${LIBDIR} -lcalc -lcustcalc -I${INCDIR} -L${LIBDIR} -lcalc -lcustcalc
The CALC_SRC symbol should NOT be defined by default. However if you are The CALC_SRC symbol should NOT be defined by default. However if you are
feeling pedantic you may want to force CALC_SRC to be undefined: feeling pedantic you may want to force CALC_SRC to be undefined:
@@ -73,71 +78,215 @@ feeling pedantic you may want to force CALC_SRC to be undefined:
as well. as well.
-------------- -------------------
ERROR HANDLING MATH ERROR HANDLING
-------------- -------------------
Your program MUST provide a function called math_error. This is called by The math_error() function is called by the math routines on an error
the math routines on an error condition, such as malloc failures or a condition, such as malloc failures, division by zero, or some form of
division by zero. The routine is called in the manner of printf, with a an internal computation error. The routine is called in the manner of
format string and optional arguments. (However, none of the low level math printf, with a format string and optional arguments:
routines currently uses formatting, so if you are lazy you can simply use
the first argument as a simple error string.) For example, one of the
error calls you might expect to receive is:
math_error("Division by zero"); void math_error(char *fmt, ...);
Your program can handle errors in basically one of two ways. Firstly, it Your program must handle math errors in one of three ways:
can simply print the error message and then exit. Secondly, you can make
use of setjmp and longjmp in your program. Use setjmp at some appropriate
level in your program, and use longjmp in the math_error routine to return
to that level and so recover from the error. This is what the calc program
does.
For convenience, the link library libcalc.a contains a math_error routine. 1) Print the error message and then exit
By default, this routine simply prints a message to stderr and then exits.
By simply linking in this link library, any calc errors will result in a
error message on stderr followed by an exit.
External programs that wish to use this math_error may want to compile with: There is a math_error() function supplied with the calc library.
By default, this routine simply prints a message to stderr and
then exits. By simply linking in this link library, any calc
errors will result in a error message on stderr followed by
an exit.
-I${LIBDIR} -L${LIBDIR} -lcalc 2) Use setjmp and longjmp in your program
If one sets up calc_jmp_buf, and then sets calc_jmp to non-zero then Use setjmp at some appropriate level in your program, and let
this routine will longjmp back (with the value of calc_jmp) instead. the longjmp in math_error() return to that level and to allow you
In addition, the last calc error message will be found in calc_error; to recover from the error. This is what the calc program does.
this error is not printed to stderr. The calc error message will
not have a trailing newline.
For example: If one sets up calc_matherr_jmpbuf, and then sets
calc_use_matherr_jmpbuf to non-zero then math_error() will
longjmp back with the return value of calc_use_matherr_jmpbuf.
In addition, the last calc error message will be found in
calc_err_msg; this error is not printed to stderr. The calc
error message will not have a trailing newline.
#include <setjmp.h> For example:
extern jmp_buf calc_jmp_buf; #include <setjmp.h>
extern int calc_jmp; #include "lib_calc.h"
extern char *calc_error;
int error;
... int error;
if ((error = setjmp(calc_jmp_buf)) != 0) { ...
/* reinitialize calc after a longjmp */ if ((error = setjmp(calc_matherr_jmpbuf)) != 0) {
reinitialize();
/* report the error */
printf("Ouch: %s\n", calc_err_msg);
/* reinitialize calc after the longjmp */
reinitialize();
}
calc_use_matherr_jmpbuf = 1;
If calc_use_matherr_jmpbuf is non-zero, then the jmp_buf value
calc_matherr_jmpbuf must be initialized by the setjmp() function
or your program will crash.
3) Supply your own math_error function:
void math_error(char *fmt, ...);
Your math_error() function may exit or transfer control to outside
of the calc library, but it must never return or calc will crash.
External programs can obtain the appropriate calc symbols by compiling with:
-I${INCDIR} -L${LIBDIR} -lcalc
-------------------------
PARSE/SCAN ERROR HANDLING
-------------------------
The scanerror() function is called when calc encounters a parse/scan
error. For example, scanerror() is called when calc is given code
with a syntax error.
The variable, calc_print_scanerr_msg, controls if calc prints to stderr,
any parse/scan errors. By default, this variable it set to 1 and so
parse/scan errors are printed to stderr. By setting this value to zero,
parse/scan errors are not printed:
#include "lib_calc.h"
/* do not print parse/scan errors to stderr */
calc_print_scanerr_msg = 0;
The last calc math error or calc parse/scan error message is kept
in the NUL terminated buffer:
char calc_err_msg[MAXERROR+1];
The value of calc_print_scanerr_msg does not change the use
of the calc_err_msg[] buffer. Messages are stored in that
buffer regardless of the calc_print_scanerr_msg value.
The calc_print_scanerr_msg and the calc_err_msg[] buffer are declared
lib_calc.h include file. The initialized storage for these variables
comes from the calc library. The MAXERROR symbol is also declared in
the lib_calc.h include file.
Your program must handle parse/scan errors in one of two ways:
1) exit on error
If you do not setup the calc_scanerr_jmpbuf, then when calc
encounters a parse/scan error, a message will be printed to
stderr and calc will exit.
2) Use setjmp and longjmp in your program
Use setjmp at some appropriate level in your program, and let
the longjmp in scanerror() return to that level and to allow you
to recover from the error. This is what the calc program does.
If one sets up calc_scanerr_jmpbuf, and then sets
calc_use_scanerr_jmpbuf to non-zero then scanerror() will longjmp
back with the return with a non-zero code. In addition, the last
calc error message will be found in calc_err_msg[]; this error is
not printed to stderr. The calc error message will not have a
trailing newline.
For example:
#include <setjmp.h>
#include "lib_calc.h"
int scan_error;
...
/* delay the printing of the parse/scan error */
calc_use_scanerr_jmpbuf = 0; /* this is optional */
if ((scan_error = setjmp(calc_scanerr_jmpbuf)) != 0) {
/* report the parse/scan */
if (calc_use_scanerr_jmpbuf == 0) {
printf("parse error: %s\n", calc_err_msg);
}
/* initialize calc after the longjmp */
initialize();
}
calc_use_scanerr_jmpbuf = 1;
If calc_use_scanerr_jmpbuf is non-zero, then the jmp_buf value
calc_scanerr_jmpbuf must be initialized by the setjmp() function
or your program will crash.
External programs can obtain the appropriate calc symbols by compiling with:
-I${INCDIR} -L${LIBDIR} -lcalc
---------------------------
PARSE/SCAN WARNING HANDLING
---------------------------
Calc parse/scan warning message are printed to stderr by the warning()
function. The routine is called in the manner of printf, with a format
string and optional arguments:
void warning(char *fmt, ...);
The variable, calc_print_scanwarn_msg, controls if calc prints to stderr,
any parse/scan warnings. By default, this variable it set to 1 and so
parse/scan warnings are printed to stderr. By setting this value to zero,
parse/scan warnings are not printed:
#include "lib_calc.h"
/* do not print parse/scan warnings to stderr */
calc_print_scanwarn_msg = 0;
The last calc calc parse/scan warning message is kept in the NUL
terminated buffer:
char calc_warn_msg[MAXERROR+1];
The value of calc_print_scanwarn_msg does not change the use
of the calc_warn_msg[] buffer. Messages are stored in that
buffer regardless of the calc_print_scanwarn_msg value.
Your program must handle parse/scan warnings in one of two ways:
1) print the warning to stderr and continue
The warning() from libcalc prints warning messages to
stderr and returns. The flow of execution is not changed.
This is what calc does by default.
2) Supply your own warning function:
void warning(char *fmt, ...);
Your warning function should simply return when it is finished.
External programs can obtain the appropriate calc symbols by compiling with:
-I${INCDIR} -L${LIBDIR} -lcalc
/* report the error */
printf("Ouch: %s\n", calc_error);
}
calc_jmp = 1;
--------------- ---------------
OUTPUT ROUTINES OUTPUT ROUTINES
--------------- ---------------
The output from the routines in the link library normally goes to stdout. You The output from the routines in the link library normally goes to stdout.
can divert that output to either another FILE handle, or else to a string. You can divert that output to either another FILE handle, or else
Read the routines in zio.c to see what is available. Diversions can be to a string. Read the routines in zio.c to see what is available.
nested. Diversions can be nested.
You use math_setfp to divert output to another FILE handle. Calling You use math_setfp to divert output to another FILE handle. Calling
math_setfp with stdout restores output to stdout. math_setfp with stdout restores output to stdout.
@@ -487,10 +636,10 @@ need call libcalc_call_me_last() only once.
## A copy of version 2.1 of the GNU Lesser General Public License is ## 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 ## distributed with calc under the filename COPYING-LGPL. You should have
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
## ##
## @(#) $Revision: 29.5 $ ## @(#) $Revision: 30.1 $
## @(#) $Id: LIBRARY,v 29.5 2001/06/08 22:57:35 chongo Exp $ ## @(#) $Id: LIBRARY,v 30.1 2007/03/16 11:09:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/LIBRARY,v $ ## @(#) $Source: /usr/local/src/cmd/calc/RCS/LIBRARY,v $
## ##
## Under source code control: 1993/07/30 19:44:49 ## Under source code control: 1993/07/30 19:44:49

3016
Makefile

File diff suppressed because it is too large Load Diff

5593
Makefile.simple Normal file

File diff suppressed because it is too large Load Diff

6
README
View File

@@ -132,10 +132,10 @@ The calc web site is located at:
## A copy of version 2.1 of the GNU Lesser General Public License is ## 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 ## distributed with calc under the filename COPYING-LGPL. You should have
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
## ##
## @(#) $Revision: 29.3 $ ## @(#) $Revision: 30.1 $
## @(#) $Id: README,v 29.3 2001/06/01 11:26:53 chongo Exp $ ## @(#) $Id: README,v 30.1 2007/03/16 11:09:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/README,v $ ## @(#) $Source: /usr/local/src/cmd/calc/RCS/README,v $
## ##
## Under source code control: 1995/10/25 05:27:59 ## Under source code control: 1995/10/25 05:27:59

View File

@@ -127,10 +127,10 @@ In particular:
## A copy of version 2.1 of the GNU Lesser General Public License is ## 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 ## distributed with calc under the filename COPYING-LGPL. You should have
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
## ##
## @(#) $Revision: 29.13 $ ## @(#) $Revision: 30.1 $
## @(#) $Id: README.WINDOWS,v 29.13 2007/02/11 10:23:28 chongo Exp $ ## @(#) $Id: README.WINDOWS,v 30.1 2007/03/16 11:09:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/README.WINDOWS,v $ ## @(#) $Source: /usr/local/src/cmd/calc/RCS/README.WINDOWS,v $
## ##
## Under source code control: 2001/02/25 14:00:05 ## Under source code control: 2001/02/25 14:00:05

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.14 $ * @(#) $Revision: 30.1 $
* @(#) $Id: addop.c,v 29.14 2007/02/11 10:19:14 chongo Exp $ * @(#) $Id: addop.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/addop.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/addop.c,v $
* *
* Under source code control: 1990/02/15 01:48:10 * Under source code control: 1990/02/15 01:48:10
@@ -33,7 +33,7 @@
#include <stdio.h> #include <stdio.h>
#include "calc.h" #include "calc.h"
#include "opcodes.h" #include "opcodes.h"
#include "string.h" #include "str.h"
#include "func.h" #include "func.h"
#include "token.h" #include "token.h"
#include "label.h" #include "label.h"

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: align32.c,v 29.2 2000/06/07 14:02:13 chongo Exp $ * @(#) $Id: align32.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/align32.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/align32.c,v $
* *
* Under source code control: 1995/11/23 05:18:06 * Under source code control: 1995/11/23 05:18:06

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.7 $ * @(#) $Revision: 30.2 $
* @(#) $Id: alloc.h,v 29.7 2007/02/12 03:57:00 chongo Exp $ * @(#) $Id: alloc.h,v 30.2 2008/04/15 21:17:57 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/alloc.h,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/alloc.h,v $
* *
* Under source code control: 1990/02/15 01:48:29 * Under source code control: 1990/02/15 01:48:29
@@ -46,6 +46,9 @@
# include <string.h> # include <string.h>
#else #else
#if defined(_WIN32) && defined(NOTCYGWIN)
#include <stdio.h>
#endif
# if defined(HAVE_NEWSTR) # if defined(HAVE_NEWSTR)
E_FUNC void *memcpy(); E_FUNC void *memcpy();

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.3 $ * @(#) $Revision: 30.1 $
* @(#) $Id: assocfunc.c,v 29.3 2007/02/11 10:19:14 chongo Exp $ * @(#) $Id: assocfunc.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/assocfunc.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/assocfunc.c,v $
* *
* Under source code control: 1993/07/20 23:04:27 * Under source code control: 1993/07/20 23:04:27

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.11 $ * @(#) $Revision: 30.1 $
* @(#) $Id: blkcpy.c,v 29.11 2007/02/11 10:19:14 chongo Exp $ * @(#) $Id: blkcpy.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/blkcpy.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/blkcpy.c,v $
* *
* Under source code control: 1997/04/18 20:41:26 * Under source code control: 1997/04/18 20:41:26
@@ -36,7 +36,7 @@
#include "value.h" #include "value.h"
#include "file.h" #include "file.h"
#include "blkcpy.h" #include "blkcpy.h"
#include "string.h" #include "str.h"
/* /*

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.3 $ * @(#) $Revision: 30.1 $
* @(#) $Id: blkcpy.h,v 29.3 2007/02/11 10:19:14 chongo Exp $ * @(#) $Id: blkcpy.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/blkcpy.h,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/blkcpy.h,v $
* *
* Under source code control: 1997/04/18 20:41:25 * Under source code control: 1997/04/18 20:41:25

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.4 $ * @(#) $Revision: 30.1 $
* @(#) $Id: block.c,v 29.4 2007/02/11 10:19:14 chongo Exp $ * @(#) $Id: block.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/block.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/block.c,v $
* *
* Under source code control: 1997/02/27 00:29:40 * Under source code control: 1997/02/27 00:29:40
@@ -37,7 +37,7 @@
#include "config.h" #include "config.h"
#include "block.h" #include "block.h"
#include "nametype.h" #include "nametype.h"
#include "string.h" #include "str.h"
#include "calcerr.h" #include "calcerr.h"
#define NBLOCKCHUNK 16 #define NBLOCKCHUNK 16

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.3 $ * @(#) $Revision: 30.1 $
* @(#) $Id: block.h,v 29.3 2007/02/11 10:19:14 chongo Exp $ * @(#) $Id: block.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/block.h,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/block.h,v $
* *
* Under source code control: 1997/02/21 05:03:39 * Under source code control: 1997/02/21 05:03:39

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: byteswap.c,v 29.2 2000/06/07 14:02:13 chongo Exp $ * @(#) $Id: byteswap.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/byteswap.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/byteswap.c,v $
* *
* Under source code control: 1995/10/11 04:44:01 * Under source code control: 1995/10/11 04:44:01

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.4 $ * @(#) $Revision: 30.1 $
* @(#) $Id: byteswap.h,v 29.4 2001/06/08 21:00:58 chongo Exp $ * @(#) $Id: byteswap.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/byteswap.h,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/byteswap.h,v $
* *
* Under source code control: 1995/10/11 04:44:01 * Under source code control: 1995/10/11 04:44:01

View File

@@ -16,10 +16,10 @@
# A copy of version 2.1 of the GNU Lesser General Public License is # 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 # distributed with calc under the filename COPYING-LGPL. You should have
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# @(#) $Revision: 29.24 $ # @(#) $Revision: 30.3 $
# @(#) $Id: Makefile,v 29.24 2006/09/18 13:13:25 chongo Exp $ # @(#) $Id: Makefile,v 30.3 2007/09/21 01:27:27 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/Makefile,v $ # @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/Makefile,v $
# #
# Under source code control: 1991/07/21 05:00:54 # Under source code control: 1991/07/21 05:00:54
@@ -34,13 +34,30 @@
# required vars # required vars
# #
SHELL= /bin/sh SHELL= /bin/sh
MAKE_FILE= Makefile
#### ####
# Normally, the upper level makefile will set these values. We provide # Normally, the upper level makefile will set these values. We provide
# a default here just in case you want to build from this directory. # a default here just in case you want to build from this directory.
#### ####
# Normally certain files depend on the Makefile. If the Makefile is
# changed, then certain steps should be redone. If MAKE_FILE is
# set to Makefile, then these files will depend on Makefile. If
# MAKE_FILE is empty, then they wont.
#
# If in doubt, set MAKE_FILE to Makefile
#
MAKE_FILE= Makefile
# Controlling file makefile basename (without the path)
#
# This is the basename same of the makefile that may/does/will drive
# this makefile.
#
# If in doubt, set TOP_MAKE_FILE to Makefile
#
TOP_MAKE_FILE= Makefile
# Where the system include (.h) files are kept # Where the system include (.h) files are kept
# #
# For DJGPP, select: # For DJGPP, select:
@@ -94,9 +111,6 @@ CALC_SHAREDIR= /usr/share/calc
# --------------------------------------------------------------- # ---------------------------------------------------------------
# ${HELPDIR} where the help directory is installed # ${HELPDIR} where the help directory is installed
# ${CALC_INCDIR} where the calc include files are installed # ${CALC_INCDIR} where the calc include files are installed
# ${CUSTOMCALDIR} where custom *.cal files are installed
# ${CUSTOMHELPDIR} where custom help files are installed
# ${CUSTOMINCDIR} where custom .h files are installed
# ${SCRIPTDIR} where calc shell scripts are installed # ${SCRIPTDIR} where calc shell scripts are installed
# #
# NOTE: The install rule prepends installation paths with ${T}, which # NOTE: The install rule prepends installation paths with ${T}, which
@@ -107,16 +121,10 @@ CALC_SHAREDIR= /usr/share/calc
# #
# HELPDIR= ${CALC_SHAREDIR}/help # HELPDIR= ${CALC_SHAREDIR}/help
# CALC_INCDIR= ${INCDIR}/calc # CALC_INCDIR= ${INCDIR}/calc
# CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
# CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
# CUSTOMINCDIR= ${CALC_INCDIR}/custom
# SCRIPTDIR= ${BINDIR}/cscript # SCRIPTDIR= ${BINDIR}/cscript
# #
HELPDIR= ${CALC_SHAREDIR}/help HELPDIR= ${CALC_SHAREDIR}/help
CALC_INCDIR= ${INCDIR}/calc CALC_INCDIR= ${INCDIR}/calc
CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
CUSTOMINCDIR= ${CALC_INCDIR}/custom
SCRIPTDIR= ${BINDIR}/cscript SCRIPTDIR= ${BINDIR}/cscript
# T - top level directory under which calc will be installed # T - top level directory under which calc will be installed
@@ -254,7 +262,7 @@ echo_inst_files:
clean: clean:
clobber: clobber: clean
${RM} -f .all ${RM} -f .all
# install everything # install everything

View File

@@ -1012,10 +1012,10 @@ xx_print.cal
## A copy of version 2.1 of the GNU Lesser General Public License is ## 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 ## distributed with calc under the filename COPYING-LGPL. You should have
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
## ##
## @(#) $Revision: 29.16 $ ## @(#) $Revision: 30.1 $
## @(#) $Id: README,v 29.16 2006/12/16 11:18:46 chongo Exp $ ## @(#) $Id: README,v 30.1 2007/03/16 11:09:54 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/README,v $ ## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/README,v $
## ##
## Under source code control: 1990/02/15 01:50:32 ## Under source code control: 1990/02/15 01:50:32

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.15 $ * @(#) $Revision: 30.1 $
* @(#) $Id: alg_config.cal,v 29.15 2006/12/16 11:18:46 chongo Exp $ * @(#) $Id: alg_config.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/alg_config.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/alg_config.cal,v $
* *
* Under source code control: 2006/06/07 14:10:11 * Under source code control: 2006/06/07 14:10:11

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: beer.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: beer.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/beer.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/beer.cal,v $
* *
* Under source code control: 1996/11/13 13:21:05 * Under source code control: 1996/11/13 13:21:05

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.3 $ * @(#) $Revision: 30.1 $
* @(#) $Id: bernoulli.cal,v 29.3 2000/12/17 12:26:04 chongo Exp $ * @(#) $Id: bernoulli.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/bernoulli.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/bernoulli.cal,v $
* *
* Under source code control: 1991/09/30 11:18:41 * Under source code control: 1991/09/30 11:18:41

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: bigprime.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: bigprime.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/bigprime.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/bigprime.cal,v $
* *
* Under source code control: 1991/05/22 21:56:32 * Under source code control: 1991/05/22 21:56:32

View File

@@ -14,10 +14,10 @@
# A copy of version 2.1 of the GNU Lesser General Public License is # 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 # distributed with calc under the filename COPYING-LGPL. You should have
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# @(#) $Revision: 29.2 $ # @(#) $Revision: 30.1 $
# @(#) $Id: bindings,v 29.2 2000/06/07 14:02:25 chongo Exp $ # @(#) $Id: bindings,v 30.1 2007/03/16 11:09:54 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/bindings,v $ # @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/bindings,v $
# #
# Under source code control: 1993/05/02 20:09:19 # Under source code control: 1993/05/02 20:09:19

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: chi.cal,v 29.2 2001/04/08 10:21:23 chongo Exp $ * @(#) $Id: chi.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/chi.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/chi.cal,v $
* *
* Under source code control: 2001/03/27 14:10:11 * Under source code control: 2001/03/27 14:10:11

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: chrem.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: chrem.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/chrem.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/chrem.cal,v $
* *
* Under source code control: 1992/09/26 01:00:47 * Under source code control: 1992/09/26 01:00:47

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.4 $ * @(#) $Revision: 30.1 $
* @(#) $Id: deg.cal,v 29.4 2003/01/26 19:32:41 chongo Exp $ * @(#) $Id: deg.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/deg.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/deg.cal,v $
* *
* Under source code control: 1990/02/15 01:50:33 * Under source code control: 1990/02/15 01:50:33

View File

@@ -16,8 +16,8 @@
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.2 $
* @(#) $Id: dotest.cal,v 29.2 2006/05/21 00:55:27 chongo Exp $ * @(#) $Id: dotest.cal,v 30.2 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/dotest.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/dotest.cal,v $
* *
* This file is not covered under version 2.1 of the GNU LGPL. * This file is not covered under version 2.1 of the GNU LGPL.

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.4 $ * @(#) $Revision: 30.1 $
* @(#) $Id: ellip.cal,v 29.4 2006/06/20 09:29:16 chongo Exp $ * @(#) $Id: ellip.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/ellip.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/ellip.cal,v $
* *
* Under source code control: 1990/02/15 01:50:33 * Under source code control: 1990/02/15 01:50:33

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: hello.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: hello.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/hello.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/hello.cal,v $
* *
* Under source code control: 1996/11/13 13:25:43 * Under source code control: 1996/11/13 13:25:43

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.5 $ * @(#) $Revision: 30.1 $
* @(#) $Id: intfile.cal,v 29.5 2001/04/10 22:09:34 chongo Exp $ * @(#) $Id: intfile.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/intfile.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/intfile.cal,v $
* *
* Under source code control: 2001/03/31 08:13:11 * Under source code control: 2001/03/31 08:13:11

View File

@@ -1,3 +1,33 @@
/*
* linear - perform a simple two point 2D linear interpolation
*
* Copyright (C) 2005-2007 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.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @(#) $Revision: 30.2 $
* @(#) $Id: linear.cal,v 30.2 2007/03/17 05:57:42 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/linear.cal,v $
*
* Under source code control: 2005/12/12 06:41:50
* File existed as early as: 2005
*
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/
/* /*
* linear - perform a simple two point 2D linear interpolation * linear - perform a simple two point 2D linear interpolation
* *

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.6 $ * @(#) $Revision: 30.1 $
* @(#) $Id: lucas.cal,v 29.6 2002/07/10 09:43:46 chongo Exp $ * @(#) $Id: lucas.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/lucas.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/lucas.cal,v $
* *
* Under source code control: 1990/05/03 16:49:51 * Under source code control: 1990/05/03 16:49:51

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.3 $ * @(#) $Revision: 30.1 $
* @(#) $Id: lucas_chk.cal,v 29.3 2001/03/31 13:31:34 chongo Exp $ * @(#) $Id: lucas_chk.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/lucas_chk.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/lucas_chk.cal,v $
* *
* Under source code control: 1991/01/11 05:41:43 * Under source code control: 1991/01/11 05:41:43

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: lucas_tbl.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: lucas_tbl.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/lucas_tbl.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/lucas_tbl.cal,v $
* *
* Under source code control: 1991/01/26 02:43:43 * Under source code control: 1991/01/26 02:43:43

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: mersenne.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: mersenne.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/mersenne.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/mersenne.cal,v $
* *
* Under source code control: 1991/05/22 21:56:36 * Under source code control: 1991/05/22 21:56:36

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.3 $ * @(#) $Revision: 30.1 $
* @(#) $Id: mfactor.cal,v 29.3 2006/12/16 11:18:46 chongo Exp $ * @(#) $Id: mfactor.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/mfactor.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/mfactor.cal,v $
* *
* Under source code control: 1996/07/06 06:09:40 * Under source code control: 1996/07/06 06:09:40

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: mod.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: mod.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/mod.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/mod.cal,v $
* *
* Under source code control: 1990/02/15 01:50:34 * Under source code control: 1990/02/15 01:50:34

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.3 $ * @(#) $Revision: 30.1 $
* @(#) $Id: natnumset.cal,v 29.3 2006/05/01 19:19:46 chongo Exp $ * @(#) $Id: natnumset.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/natnumset.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/natnumset.cal,v $
* *
* Under source code control: 1997/09/07 23:53:51 * Under source code control: 1997/09/07 23:53:51

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: pell.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: pell.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/pell.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/pell.cal,v $
* *
* Under source code control: 1990/02/15 01:50:34 * Under source code control: 1990/02/15 01:50:34

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.5 $ * @(#) $Revision: 30.1 $
* @(#) $Id: pi.cal,v 29.5 2004/02/23 14:04:01 chongo Exp $ * @(#) $Id: pi.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/pi.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/pi.cal,v $
* *
* Under source code control: 1991/05/22 21:56:37 * Under source code control: 1991/05/22 21:56:37

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: pix.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: pix.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/pix.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/pix.cal,v $
* *
* Under source code control: 1996/07/09 03:14:14 * Under source code control: 1996/07/09 03:14:14

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: pollard.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: pollard.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/pollard.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/pollard.cal,v $
* *
* Under source code control: 1991/05/22 21:56:37 * Under source code control: 1991/05/22 21:56:37

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: poly.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: poly.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/poly.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/poly.cal,v $
* *
* Under source code control: 1990/02/15 01:50:35 * Under source code control: 1990/02/15 01:50:35

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.3 $ * @(#) $Revision: 30.1 $
* @(#) $Id: prompt.cal,v 29.3 2006/06/20 09:29:16 chongo Exp $ * @(#) $Id: prompt.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/prompt.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/prompt.cal,v $
* *
* Under source code control: 1995/12/18 04:43:25 * Under source code control: 1995/12/18 04:43:25

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: psqrt.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: psqrt.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/psqrt.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/psqrt.cal,v $
* *
* Under source code control: 1990/02/15 01:50:35 * Under source code control: 1990/02/15 01:50:35

View File

@@ -18,10 +18,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.4 $ * @(#) $Revision: 30.1 $
* @(#) $Id: qtime.cal,v 29.4 2000/12/18 10:18:40 chongo Exp $ * @(#) $Id: qtime.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/qtime.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/qtime.cal,v $
* *
* Under source code control: 1999/10/13 04:10:33 * Under source code control: 1999/10/13 04:10:33

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: quat.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: quat.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/quat.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/quat.cal,v $
* *
* Under source code control: 1990/02/15 01:50:35 * Under source code control: 1990/02/15 01:50:35

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: randbitrun.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: randbitrun.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/randbitrun.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/randbitrun.cal,v $
* *
* Under source code control: 1995/02/13 03:43:11 * Under source code control: 1995/02/13 03:43:11

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.3 $ * @(#) $Revision: 30.1 $
* @(#) $Id: randmprime.cal,v 29.3 2006/12/16 11:18:46 chongo Exp $ * @(#) $Id: randmprime.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/randmprime.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/randmprime.cal,v $
* *
* Under source code control: 1994/03/14 23:11:21 * Under source code control: 1994/03/14 23:11:21

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: randombitrun.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: randombitrun.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/randombitrun.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/randombitrun.cal,v $
* *
* Under source code control: 1995/02/13 03:43:11 * Under source code control: 1995/02/13 03:43:11

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: randomrun.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: randomrun.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/randomrun.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/randomrun.cal,v $
* *
* Under source code control: 1997/02/19 03:35:59 * Under source code control: 1997/02/19 03:35:59

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: randrun.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: randrun.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/randrun.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/randrun.cal,v $
* *
* Under source code control: 1995/02/12 20:00:06 * Under source code control: 1995/02/12 20:00:06

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.36 $ * @(#) $Revision: 30.4 $
* @(#) $Id: regress.cal,v 29.36 2006/12/16 11:18:46 chongo Exp $ * @(#) $Id: regress.cal,v 30.4 2008/02/24 07:41:49 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $
* *
* Under source code control: 1990/02/15 01:50:36 * Under source code control: 1990/02/15 01:50:36
@@ -596,12 +596,18 @@ print '012: parsed squarecheck(a, b, str)';
define powercheck(a, p1, p2, str) define powercheck(a, p1, p2, str)
{ {
local a1, a2, a3; local a1, a2, a3;
local b1, b2, b3;
a1 = (a^p1)^p2; a1 = (a^p1)^p2;
a2 = (a^p2)^p1; a2 = (a^p2)^p1;
a3 = a^(p1*p2); a3 = a^(p1*p2);
b1 = (a**p1)**p2;
b2 = (a**p2)**p1;
b3 = a**(p1*p2);
if (a1 != a2) {print '**** (a^p1)^p2 != (a^p2)^p1:', str; ++prob;} if (a1 != a2) {print '**** (a^p1)^p2 != (a^p2)^p1:', str; ++prob;}
if (a1 != a3) {print '**** (a^p1)^p2 != a^(p1*p2):', str; ++prob;} if (a1 != a3) {print '**** (a^p1)^p2 != a^(p1*p2):', str; ++prob;}
if (b1 != b2) {print '**** (b^p1)^p2 != (b^p2)^p1:', str; ++prob;}
if (b1 != b3) {print '**** (b^p1)^p2 != b^(p1*p2):', str; ++prob;}
print str; print str;
} }
print '013: parsed powercheck(a, p1, p2, str)'; print '013: parsed powercheck(a, p1, p2, str)';
@@ -1406,7 +1412,39 @@ define test_functions()
vrfy(isnum(systime()), '1206: isnum(systime())'); vrfy(isnum(systime()), '1206: isnum(systime())');
vrfy(isnum(usertime()), '1207: isnum(usertime())'); vrfy(isnum(usertime()), '1207: isnum(usertime())');
print '1208: Ending test_functions'; /* more jacobi tests */
vrfy(jacobi(987897,987) == 0, '1208: jacobi(987897,987) == 0');
vrfy(jacobi(897,987) == 0, '1209: jacobi(897,987) == 0');
vrfy(jacobi(987,897) == 0, '1210: jacobi(987,897) == 0');
vrfy(jacobi(90,897) == 0, '1211: jacobi(90,897) == 0');
vrfy(jacobi(45,897) == 0, '1212: jacobi(45,897) == 0');
vrfy(jacobi(897,45) == 0, '1213: jacobi(897,45) == 0');
vrfy(jacobi(42,45) == 0, '1214: jacobi(42,45) == 0');
vrfy(jacobi(21,45) == 0, '1215: jacobi(21,45) == 0');
vrfy(jacobi(45,21) == 0, '1216: jacobi(45,21) == 0');
vrfy(jacobi(3,21) == 0, '1217: jacobi(3,21) == 0');
vrfy(jacobi(0,21) == 0, '1218: jacobi(0,21) == 0');
vrfy(jacobi(0,20003) == 0, '1219: jacobi(0,20003) == 0');
vrfy(jacobi(1,20003) == 1, '1220: jacobi(1,20003) == 1');
vrfy(jacobi(1236,20003) == 1, '1221: jacobi(1236,20003) == 1');
vrfy(jacobi(618,20003) == -1, '1222: jacobi(618,20003) == -1');
vrfy(jacobi(309,20003) == 1, '1223: jacobi(309,20003) == 1');
vrfy(jacobi(227,309) == 1, '1224: jacobi(227,309) == 1');
vrfy(jacobi(82,227) == 1, '1225: jacobi(82,227) == 1');
vrfy(jacobi(41,227) == -1, '1226: jacobi(41,227) == -1');
vrfy(jacobi(22,41) == -1, '1227: jacobi(22,41) == -1');
vrfy(jacobi(11,41) == -1, '1228: jacobi(11,41) == -1');
vrfy(jacobi(8,11) == -1, '1229: jacobi(8,11) == -1');
vrfy(jacobi(4,11) == 1, '1230: jacobi(4,11) == 1');
vrfy(jacobi(2,11) == -1, '1231: jacobi(2,11) == -1');
vrfy(jacobi(1,11) == 1, '1232: jacobi(1,11) == 1');
vrfy(jacobi(0,11) == 0, '1233: jacobi(0,11) == 0');
vrfy(jacobi(0,0) == 0, '1234: jacobi(0,0) == 0');
vrfy(jacobi(-1,0) == 0, '1235: jacobi(-1,0) == 0');
vrfy(jacobi(-1,-1) == 0, '1236: jacobi(-1,-1) == 0');
vrfy(jacobi(0,-1) == 0, '1237: jacobi(0,-1) == 0');
print '1238: Ending test_functions';
} }
print '017: parsed test_functions()'; print '017: parsed test_functions()';
@@ -3259,7 +3297,7 @@ define test_error()
'3654: scale(3,2^31) == error(10034)'); '3654: scale(3,2^31) == error(10034)');
vrfy("x" ^ 3 == error(10035), '3655: "x" ^ 3 == error(10035)'); vrfy("x" ^ 3 == error(10035), '3655: "x" ^ 3 == error(10035)');
vrfy(2 ^ "x" == error(10036), '3656: 2 ^ "x" == error(10036)'); vrfy(2 ^ "x" == error(10036), '3656: 2 ^ "x" == error(10036)');
vrfy(2 ^ 2.5 == error(10036), '3657: 2 ^ 2.5 == error(10036)'); vrfy(2 ^ "2" == error(10036), '3657: 2 ^ "2" == error(10036)');
vrfy(power("x",2.1) == error(10037), vrfy(power("x",2.1) == error(10037),
'3658: power("x",2.1) == error(10037)'); '3658: power("x",2.1) == error(10037)');
vrfy(power(2,"x") == error(10038), vrfy(power(2,"x") == error(10038),
@@ -5320,7 +5358,7 @@ define test_is()
local nerr; /* new error value */ local nerr; /* new error value */
local odd; /* odd integer */ local odd; /* odd integer */
local even; /* even integer that is 10 times odd */ local even; /* even integer that is 10 times odd */
local hash; /* sha hash value */ local hash; /* sha1 hash value */
local id; /* identity matrix */ local id; /* identity matrix */
local list; /* list value */ local list; /* list value */
local matrix; /* non-identity matrix */ local matrix; /* non-identity matrix */
@@ -5375,8 +5413,8 @@ define test_is()
print '5911: odd = 23209'; print '5911: odd = 23209';
even = odd*10; even = odd*10;
print '5912: even = odd*10'; print '5912: even = odd*10';
hash = sha(); hash = sha1();
print '5913: hash = sha()'; print '5913: hash = sha1()';
mat id[3,3] = {1,0,0,0,1,0,0,0,1}; mat id[3,3] = {1,0,0,0,1,0,0,0,1};
print '5914: id[3,3] = {1,0,0,0,1,0,0,0,1}'; print '5914: id[3,3] = {1,0,0,0,1,0,0,0,1}';
list = list(2,3,4); list = list(2,3,4);
@@ -5699,7 +5737,7 @@ define test_is()
vrfy(ishash(nerr) == 0, '6178: ishash(nerr) == 0'); vrfy(ishash(nerr) == 0, '6178: ishash(nerr) == 0');
vrfy(ishash(odd) == 0, '6179: ishash(odd) == 0'); vrfy(ishash(odd) == 0, '6179: ishash(odd) == 0');
vrfy(ishash(even) == 0, '6180: ishash(even) == 0'); vrfy(ishash(even) == 0, '6180: ishash(even) == 0');
vrfy(ishash(hash) == 1, '6181: ishash(hash) == 1'); vrfy(ishash(hash) == 2, '6181: ishash(hash) == 2');
vrfy(ishash(id) == 0, '6182: ishash(id) == 0'); vrfy(ishash(id) == 0, '6182: ishash(id) == 0');
vrfy(ishash(list) == 0, '6183: ishash(list) == 0'); vrfy(ishash(list) == 0, '6183: ishash(list) == 0');
vrfy(ishash(matrix) == 0, '6184: ishash(matrix) == 0'); vrfy(ishash(matrix) == 0, '6184: ishash(matrix) == 0');
@@ -6792,108 +6830,6 @@ define test_blkprintf()
print '172: parsed test_blkprintf()'; print '172: parsed test_blkprintf()';
/*
* test_sha - test the sha hash
*/
define test_sha()
{
local a, b, c, d, e, f, x, y, z, L, M, B1, B2, B;
print '7100: Beginning test_sha';
y = sha();
print '7101: y = sha();';
z = sha();
print '7102: z = sha();';
vrfy(y == z, '7103: y == z');
vrfy(sha("") == y, '7104: sha("") == y');
y = sha(y,1);
print '7105: y = sha(y,1);';
vrfy(y == sha(1), '7106: y == sha(1)');
vrfy(sha(y,2) == sha(1,2), '7107: sha(y,2) == sha(1,2)');
vrfy(sha(sha()) == 0xf96cea198ad1dd5617ac084a3d92c6107708c0ef,
'7108: sha(sha()) == 0xf96cea198ad1dd5617ac084a3d92c6107708c0ef');
vrfy(sha(sha("a"))==0x37f297772fae4cb1ba39b6cf9cf0381180bd62f2,
'7109: sha(sha("a"))==0x37f297772fae4cb1ba39b6cf9cf0381180bd62f2');
vrfy(sha(sha("ab"))==0x488373d362684af3d3f7a6a408b59dfe85419e09,
'7110: sha(sha("ab"))==0x488373d362684af3d3f7a6a408b59dfe85419e09');
vrfy(sha(sha("abc"))==0x0164b8a914cd2a5e74c4f7ff082c4d97f1edf880,
'7111: sha(sha("abc"))==0x0164b8a914cd2a5e74c4f7ff082c4d97f1edf880');
vrfy(sha(sha("abcd"))==0x082c73b06f71185d840fb4b28eb3abade67714bc,
'7112: sha(sha("abcd"))==0x082c73b06f71185d840fb4b28eb3abade67714bc');
vrfy(sha(sha("abcde"))==0xd624e34951bb800f0acae773001df8cffe781ba8,
'7113: sha(sha("abcde"))==0xd624e34951bb800f0acae773001df8cffe781ba8');
vrfy(sha(sha("abcdef"))==0x2a589f7750598dc0ea0a608719e04327f609279a,
'7114: sha(sha("abcdef"))==0x2a589f7750598dc0ea0a608719e04327f609279a');
vrfy(sha(sha("abcdefg"))==0x5bdf01f9298e9d19d3f8d15520fd74eed600b497,
'7115: sha(sha("abcdefg"))==0x5bdf01f9298e9d19d3f8d15520fd74eed600b497');
vrfy(sha(sha("abcdefgh"))==0x734ba8b31975d0dbae4d6e249f4e8da270796c94,
'7116: sha(sha("abcdefgh"))==0x734ba8b31975d0dbae4d6e249f4e8da270796c94');
vrfy(sha(sha(1)) == 0x864c8d09e828c7c31d62693736a5a9302c282777,
'7117: sha(sha(1)) == 0x864c8d09e828c7c31d62693736a5a9302c282777');
vrfy(sha(sha(2)) == 0x2c0b59c512cb20fad6bb0883b69c9f5a46545808,
'7118: sha(sha(2)) == 0x2c0b59c512cb20fad6bb0883b69c9f5a46545808');
vrfy(sha(sha(22/7))==0x7ddb7f8a7e9d70757f157744fddea7a6c6a6bcc6,
'7119: sha(sha(22/7)==0x7ddb7f8a7e9d70757f157744fddea7a6c6a6bcc6');
vrfy(sha(sha(isqrt(2e1000))) ==
0x6db8d9cf0b018b8f9cbbf5aa1edb8066d19e1bb0,
'7120: sha(sha(isqrt(2e1000)==0x6db8d9cf0b018b8f9cbbf5aa1edb8066d19e1bb0');
vrfy(sha("x", "y", "z") == sha("xyz"),
'7121: sha("x", "y", "z") == sha("xyz")');
vrfy(sha(sha("this is", 7^19-8, "a composit", 3i+4.5, "hash")) ==
0x21e42319a26787046c2b28b7ae70f1b54bf0ba2a,
'7122: sha(sha("this is", 7^19-8, ..., "hash")) == 0x21e4...');
z = sha(list(1,2,3), "curds and whey", 2^21701-1, pi(1e-100));
print '7123: z = sha(list(1,2,3), "curds and whey", 2^21701-1, pi(1e-100));';
vrfy(sha(z) == 257075527903934749824451356785709876382198951165,
'7124: sha(z) == 257075527903934749824451356785709876382198951165');
y = sha();
print '7125: y = sha()';
y = sha(y, list(1,2,3), "curds and whey");
print '7126: y = sha(y, list(1,2,3), "curds and whey")';
y = sha(y, 2^21701-1);
print '7127: y = sha(y, 2^21701-1)';
y = sha(y, pi(1e-100));
print '7128: y = sha(y, pi(1e-100))';
vrfy(y == z, '7129: y == z');
B = blk() = {"a", "b", "c"};
print '7130: B = blk() = {"a", "b", "c"};';
vrfy(sha(B) == sha("abc"), '7131: sha(B) == sha("abc")');
B1 = blk() = {1,2,3,4};
print '7132: B1 = blk() = {1,2,3,4};';
B2 = blk() = {5,6,7,8};
print '7133: B2 = blk() = {5,6,7,8};';
B = blk() = {1,2,3,4,5,6,7,8};
print '7134: B = blk() = {1,2,3,4,5,6,7,8};';
vrfy(sha(B1, B2) == sha(B), '7135: sha(B1, B2) == sha(B)');
vrfy(sha(B[1], B[3], B[5]) == sha("\02\04\06"),
'7136: sha(B[1], B[3], B[5]) == sha("\02\04\06")');
L = list(1,2,3);
print '7137: L = list(1,2,3)';
mat M[3] = {4,5,6};
print '7138: mat M[3] = {4,5,6}';
vrfy(sha(sha(L), M, B) == sha(L, M, B),
'7139: sha(sha(L), M, B) == sha(L, M, B)');
vrfy(sha(sha(L,M), B) == sha(L, M, B),
'7140: sha(sha(L, M), B) == sha(L, M, B)');
print '7141: Ending test_sha';
}
print '173: parsed test_sha()';
/* /*
* test_sha1 - test the sha1 hash * test_sha1 - test the sha1 hash
*/ */
@@ -6979,88 +6915,6 @@ define test_sha1()
print '174: parsed test_sha1()'; print '174: parsed test_sha1()';
/*
* test_md5 - test the md5 hash
*/
define test_md5()
{
local a, b, c, d, e, f, x, y, z, L, M, B;
print '7300: Beginning test_md5';
y = md5();
print '7301: y = md5();';
z = md5();
print '7302: z = md5();';
vrfy(y == z, '7303: y == z');
y = md5(y,1);
print '7304: y = md5(y,1);';
z = md5(1);
print '7305: z = md5(1);';
vrfy(y == z, '7306: y == z');
vrfy(md5(z,2) == md5(1,2), '7307: md5(z,2) == md5(1,2)');
vrfy(md5(md5()) == 0xd41d8cd98f00b204e9800998ecf8427e,
'7308: md5(md5()) == 0xd41d8cd98f00b204e9800998ecf8427e');
vrfy(md5("x", "y", "z") == md5("xyz"),
'7309: md5("x", "y", "z") == md5("xyz")');
vrfy(md5(md5("this is", 7^19-8, "a composit", 3i+4.5, "hash")) ==
0x39a5a8e24a2eb65a51af462c8bdd5e3,
'7310: md5(md5("this is", 7^19-8, "a composit", 3i+4.5, "hash")) == ...');
z = md5(list(1,2,3), "curds and whey", 2^21701-1, pi(1e-100));
print '7311: z = md5(list(1,2,3), "curds and whey", 2^21701-1, pi(1e-100));';
vrfy(md5(z) == 0x487462e577eabef0302dd13af6632546,
'7312: md5(z) == 0x487462e577eabef0302dd13af6632546');
y = md5();
print '7313: y = md5();';
y = md5(y, list(1,2,3), "curds and whey");
print '7314: y = md5(y, list(1,2,3), "curds and whey")';
y = md5(y, 2^21701-1);
print '7315: y = md5(y, 2^21701-1);';
y = md5(y, pi(1e-100));
print '7316: y = md5(y, pi(1e-100));';
vrfy(y == z, '7317: y == z');
vrfy(md5(md5("a")) == 0x0cc175b9c0f1b6a831c399e269772661,
'7318: md5(md5("a")) == 0x0cc175b9c0f1b6a831c399e269772661');
vrfy(md5(md5("ab")) == 0x187ef4436122d1cc2f40dc2b92f0eba0,
'7319: md5(md5("ab")) == 0x187ef4436122d1cc2f40dc2b92f0eba0');
vrfy(md5(md5("abc")) == 0x900150983cd24fb0d6963f7d28e17f72,
'7320: md5(md5("abc")) == 0x900150983cd24fb0d6963f7d28e17f72');
vrfy(md5(md5("abcd")) == 0xe2fc714c4727ee9395f324cd2e7f331f,
'7321: md5(md5("abcd")) == 0xe2fc714c4727ee9395f324cd2e7f331f');
vrfy(md5(md5("abcde")) == 0xab56b4d92b40713acc5af89985d4b786,
'7322: md5(md5("abcde")) == 0xab56b4d92b40713acc5af89985d4b786');
vrfy(md5(md5("abcdef")) == 0xe80b5017098950fc58aad83c8c14978e,
'7323: md5(md5("abcdef")) == 0xe80b5017098950fc58aad83c8c14978e');
vrfy(md5(md5("abcdefg")) == 0x7ac66c0f148de9519b8bd264312c4d64,
'7324: md5(md5("abcdefg")) == 0x7ac66c0f148de9519b8bd264312c4d64');
vrfy(md5(md5("abcdefgh")) == 0xe8dc4081b13434b45189a720b77b6818,
'7325: md5(md5("abcdefgh")) == 0xe8dc4081b13434b45189a720b77b6818');
vrfy(md5(md5(1)) == 0x44fe7987067ac45311c88772038f60d1,
'7326: md5(md5(1)) == 0x44fe7987067ac45311c88772038f60d1');
vrfy(md5(md5(22/7)) == 0x9274b951e1dfb9cba22af1c127daa8e7,
'7327: md5(md5(22/7) == 0x9274b951e1dfb9cba22af1c127daa8e7');
vrfy(md5(md5(isqrt(2e1000))) == 0xe56ac4b8cad869e738a04fedc97058f3,
'7328: md5(md5(isqrt(2e1000))) == 0xe56ac4b8cad869e738a04fedc97058f3');
L = list(1,2,3);
print '7329: L = list(1,2,3)';
mat M[3] = {4,5,6};
print '7330: mat M[3] = {4,5,6}';
B = blk() = {7,8,9};
print '7331: B = blk() = {7,8,9}';
vrfy(md5(md5(L), M, B) == md5(L, M, B),
'7332: md5(md5(L), M, B) == md5(L, M, B)');
vrfy(md5(md5(L,M), B) == md5(L, M, B),
'7333: md5(md5(L, M), B) == md5(L, M, B)');
print '7334: Ending test_md5';
}
print '175: parsed test_md5()';
/* /*
* The 7400's contain tests for saveval and dot. These tests are * The 7400's contain tests for saveval and dot. These tests are
* done inline near the bottom. * done inline near the bottom.
@@ -7593,6 +7447,85 @@ define test_somenew()
print '190: parsed test_somenew()'; print '190: parsed test_somenew()';
/*
* test_exponentiation - test new exponentiation functionaltiy
*/
define test_exponentiation()
{
local a;
print '8800: Starting test_somenew';
/* unexpected help file cases */
vrfy(2^3 == 8, '8801: 2^3 == 8');
vrfy(2.5 ^ 3.5 == power(2.5, 3.5),
'8802: 2.5 ^ 3.5 == power(2.5, 3.5)');
vrfy(2.5 ^ 2.718i == power(2.5, 2.718i),
'8803: 2.5 ^ 2.718i == power(2.5, 2.718i)');
vrfy(3i^4 == 81, '8804: 3i^4 == 81');
vrfy(0.5i ^ 0.25 == power(0.5i, 0.25),
'8804: 0.5i ^ 0.25 == power(0.5i, 0.25)');
vrfy(3.13145i^0.30103i == power(3.13145i, 0.30103i),
'8806: 3.13145i^0.30103i == power(3.13145i, 0.30103i)');
/* deal with some corner error cases */
ecnt += 12;
print '8807: ecnt += 2';
vrfy((1/0) ^ -1 == 0, '8808: (1/0) ^ -1 == 0');
vrfy((1/0) ^ -2 == 0, '8809: (1/0) ^ -2 == 0');
vrfy((1/0) ^ 0 == error(10001), '8810: (1/0) ^ 0 == error(10001)');
vrfy((1/0) ^ 3 == error(10001), '8811: (1/0) ^ 3 == error(10001)');
vrfy(0 ^ -2 == error(10001), '8812: 0 ^ -2 == error(10001)');
vrfy((1/0) ^ 1i == error(10001),'8813: (1/0) ^ 1i == error(10001)');
vrfy((1/0) ^ 0i == error(10001),'8814: (1/0) ^ 0i == error(10001)');
/* real ^ real */
vrfy(5^6 == 15625, '8815: 5^6 == 15625');
vrfy(10^31 == 1e31, '8816: 10^31 == 1e31');
vrfy(10 ^ (127/31) == power(10, 127/31),
'8817: 10 ^ (127/31) == power(10, 127/31)');
vrfy((10^31) ^ 10 == 1e310, '8818: (10^31) ^ 10 == 1e310');
/* complex ^ real */
vrfy(10i ^ 10 == -1e10, '8819: 10i ^ 10 == -1e10');
vrfy((-10i) ^ 10 == -1e10, '8820: (-10i) ^ 10 == -1e10');
vrfy((1+1i) ^ 4 == -4, '8821: (1+1i) ^ 4 == -4');
vrfy((1+1i) ^ 65536 == 2^32768, '8822: (1+1i) ^ 65536 == 2^32768');
vrfy((1+1i) ^ (2^20) == 2^(2^19),
'8823: (1+1i) ^ (2^20) == 2^(2^19)');
vrfy((31+17i) ^ pi() == power(31+17i, pi()),
'8824: (31+17i) ^ pi() == power(31+17i, pi()');
vrfy((5+7i) ^ exp(5) == power(5+7i, exp(5)),
'8825: (5+7i) ^ exp(5) == power(5+7i, exp(5))');
/* real ^ complex */
vrfy(10 ^ 1i == power(10, 1i), '8826: 10 ^ 1i == power(10, 1i)');
vrfy(10 ^ (2+3i) == power(10, 2+3i),
'8827: 10 ^ (2+3i) == power(10, 2+3i)');
vrfy(pi() ^ (2+3i) == power(pi(), 2+3i),
'8828: pi() ^ (2+3i) == power(pi(), 2+3i)');
vrfy(exp(64) ^ (2+3i) == power(exp(64), 2+3i),
'8828: exp(64) ^ (2+3i) == power(exp(64), 2+3i)');
vrfy(pi() ^ (257+127i) == power(pi(), 257+127i),
'8829: pi() ^ (257+127i) == power(pi(), 257+127i)');
vrfy(pi() ^ asin(-2) == power(pi(), asin(-2)),
'8830: pi() ^ asin(-2) == power(pi(), asin(-2)');
/* complex ^ complex */
vrfy((3+4i) ^ (2+3i) == power(3+4i, 2+3i),
'8831: (3+4i) ^ (2+3i) == power(3+4i, 2+3i)');
vrfy(ln(-10) ^ (2+3i) == power(ln(-10), 2+3i),
'8832: ln(-10) ^ (2+3i) == power(ln(-10), 2+3i)');
vrfy((pi()*1i) ^ asin(-2) == power(pi()*1i, asin(-2)),
'8833: (pi()*1i) ^ asin(-2) == power(pi()*1i, asin(-2))');
vrfy((exp(1)+pi()*1i) ^ asin(-2) == power(exp(1)+pi()*1i, asin(-2)),
'8834: (exp(1)+pi()*1i) ^ asin(-2) == power(exp(1)+pi()*1i, asin(-2))');
print '8835: Ending test_somenew';
}
print '191: parsed test_exponentiation()';
/* /*
* test_quit - test the QUIT functionality * test_quit - test the QUIT functionality
*/ */
@@ -7820,12 +7753,8 @@ return test_name();
print; print;
return test_blkprintf(); return test_blkprintf();
print; print;
return test_sha();
print;
return test_sha1(); return test_sha1();
print; print;
return test_md5();
print;
print '7400: Beginning test_savedot'; print '7400: Beginning test_savedot';
print '7401: saveval(1);'; print '7401: saveval(1);';
@@ -7964,6 +7893,14 @@ vrfy(dotest("set8700.line", 8703) == 0,
/* 87xx: Ending dotest runs is printed by set8700.test */ /* 87xx: Ending dotest runs is printed by set8700.test */
/*
* new exponentiation functionaltiy
*/
print;
return test_exponentiation();
/* 88xx: test exponentiation */
/* /*
* read various calc resource files * read various calc resource files
* *

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.4 $ * @(#) $Revision: 30.1 $
* @(#) $Id: repeat.cal,v 29.4 2003/01/26 19:42:03 chongo Exp $ * @(#) $Id: repeat.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/repeat.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/repeat.cal,v $
* *
* Under source code control: 2003/01/05 00:00:01 * Under source code control: 2003/01/05 00:00:01

View File

@@ -15,8 +15,8 @@
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.2 $
* @(#) $Id: screen.cal,v 29.2 2006/05/01 19:21:18 chongo Exp $ * @(#) $Id: screen.cal,v 30.2 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/screen.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/screen.cal,v $
* *
* This file is not covered under version 2.1 of the GNU LGPL. * This file is not covered under version 2.1 of the GNU LGPL.

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.3 $ * @(#) $Revision: 30.1 $
* @(#) $Id: seedrandom.cal,v 29.3 2001/03/31 13:31:34 chongo Exp $ * @(#) $Id: seedrandom.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/seedrandom.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/seedrandom.cal,v $
* *
* Under source code control: 1996/01/01 08:21:00 * Under source code control: 1996/01/01 08:21:00

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: set8700.cal,v 29.2 2006/08/20 16:16:11 chongo Exp $ * @(#) $Id: set8700.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/set8700.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/set8700.cal,v $
* *
* Under source code control: 2006/05/20 14:10:11 * Under source code control: 2006/05/20 14:10:11

View File

@@ -15,10 +15,10 @@
## A copy of version 2.1 of the GNU Lesser General Public License is ## 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 ## distributed with calc under the filename COPYING-LGPL. You should have
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
## ##
## @(#) $Revision: 29.4 $ ## @(#) $Revision: 30.1 $
## @(#) $Id: set8700.line,v 29.4 2006/08/20 16:16:11 chongo Exp $ ## @(#) $Id: set8700.line,v 30.1 2007/03/16 11:09:54 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/set8700.line,v $ ## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/set8700.line,v $
## ##
## Under source code control: 2006/05/20 14:10:11 ## Under source code control: 2006/05/20 14:10:11

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: solve.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: solve.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/solve.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/solve.cal,v $
* *
* Under source code control: 1990/02/15 01:50:37 * Under source code control: 1990/02/15 01:50:37

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: sumsq.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: sumsq.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/sumsq.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/sumsq.cal,v $
* *
* Under source code control: 1990/02/15 01:50:37 * Under source code control: 1990/02/15 01:50:37

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: sumtimes.cal,v 29.2 2006/12/16 11:18:46 chongo Exp $ * @(#) $Id: sumtimes.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/sumtimes.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/sumtimes.cal,v $
* *
* Under source code control: 2006/06/22 17:29 * Under source code control: 2006/06/22 17:29

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: surd.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: surd.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/surd.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/surd.cal,v $
* *
* Under source code control: 1990/02/15 01:50:38 * Under source code control: 1990/02/15 01:50:38

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: test1700.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: test1700.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test1700.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test1700.cal,v $
* *
* Under source code control: 1994/03/14 23:12:51 * Under source code control: 1994/03/14 23:12:51

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: test2300.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: test2300.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test2300.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test2300.cal,v $
* *
* Under source code control: 1995/07/09 06:12:13 * Under source code control: 1995/07/09 06:12:13

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.2 $
* @(#) $Id: test2600.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: test2600.cal,v 30.2 2007/07/11 22:57:23 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test2600.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test2600.cal,v $
* *
* Under source code control: 1995/10/13 00:13:14 * Under source code control: 1995/10/13 00:13:14
@@ -313,6 +313,102 @@ define testpower(str, n, b, eps, verbose)
} }
define testpower2(str, n, eps, verbose)
{
local i, a, c, m, min, max;
local b;
local num;
local c2;
local oldeps;
if (isnull(verbose)) verbose = 2;
if (verbose > 0) {
print str:":",:;
}
if (isnull(eps))
eps = epsilon();
oldeps = epsilon(eps);
epsilon(eps),;
if (!isnum(b))
quit "Second argument (exponent) to be a number";
min = 1000;
max = -1000;
for (i = 1; i <= n; i++) {
if (verbose > 2) print i,:;
/* real ^ real */
a = rand(1,1e20);
a = a / (int(a/2)+rand(1,1e20));
b = rand(1,1e20);
b = b / (int(b/2)+rand(1,1e20));
c = a ^ b;
c2 = power(a, b);
if (c != c2) {
m++;
if (verbose > 1) {
printf("*** real^real failure for a = %d\n", a);
}
}
/* complex ^ real */
a = rand(1,1e20);
a = a / (int(a/2)+rand(1,1e20));
b = rand(1,1e20);
b = b / (int(b/2)+rand(1,1e20));
c = (a*1i) ^ b;
c2 = power(a*1i, b);
if (c != c2) {
m++;
if (verbose > 1) {
printf("*** comp^real failure for a = %d\n", a);
}
}
/* real ^ complex */
a = rand(1,1e20);
a = a / (int(a/2)+rand(1,1e20));
b = rand(1,1e20);
b = b / (int(b/2)+rand(1,1e20));
c = a ^ (b*1i);
c2 = power(a, b*1i);
if (c != c2) {
m++;
if (verbose > 1) {
printf("*** real^comp failure for a = %d\n", a);
}
}
/* complex ^ complex */
a = rand(1,1e20);
a = a / (int(a/2)+rand(1,1e20));
b = rand(1,1e20);
b = b / (int(b/2)+rand(1,1e20));
c = (a*1i) ^ (b*1i);
c2 = power(a*1i, b*1i);
if (c != c2) {
m++;
if (verbose > 1) {
printf("*** comp^comp failure for a = %d\n", a);
}
}
}
epsilon(oldeps),;
if (verbose > 0) {
if (m) {
printf("*** %d error(s)\n", m);
printf(" %s: rem/eps min=%d, max=%d\n",
str, min, max);
} else {
printf("no errors\n");
}
}
if (verbose > 1) {
printf(" %s: rem/eps min=%0.4d, max=%0.4d\n", str, min, max);
}
return m;
}
define cpow(a, b, eps) /* Find rem/eps for power(a,b,eps) */ define cpow(a, b, eps) /* Find rem/eps for power(a,b,eps) */
{ {
local v, v1, c, n, d, h; local v, v1, c, n, d, h;
@@ -504,6 +600,7 @@ define test2600(verbose, tnum)
err += testsqrt(strcat(str(tnum++),": sqrt",str(i)), n*10, err += testsqrt(strcat(str(tnum++),": sqrt",str(i)), n*10,
ep, verbose); ep, verbose);
} }
err += testpower2(strcat(str(tnum++),": power"), n*4, ep, verbose);
if (verbose > 1) { if (verbose > 1) {
if (err) { if (err) {
print "***", err, "error(s) found in test2600"; print "***", err, "error(s) found in test2600";

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.4 $ * @(#) $Revision: 30.1 $
* @(#) $Id: test2700.cal,v 29.4 2006/06/25 22:06:23 chongo Exp $ * @(#) $Id: test2700.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test2700.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test2700.cal,v $
* *
* Under source code control: 1995/11/01 22:52:25 * Under source code control: 1995/11/01 22:52:25

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: test3100.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: test3100.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test3100.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test3100.cal,v $
* *
* Under source code control: 1995/11/28 11:56:57 * Under source code control: 1995/11/28 11:56:57

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.5 $ * @(#) $Revision: 30.1 $
* @(#) $Id: test3300.cal,v 29.5 2006/12/16 11:19:45 chongo Exp $ * @(#) $Id: test3300.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test3300.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test3300.cal,v $
* *
* Under source code control: 1995/12/02 04:27:41 * Under source code control: 1995/12/02 04:27:41

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.3 $ * @(#) $Revision: 30.1 $
* @(#) $Id: test3400.cal,v 29.3 2006/06/20 09:29:16 chongo Exp $ * @(#) $Id: test3400.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test3400.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test3400.cal,v $
* *
* Under source code control: 1995/12/02 05:20:11 * Under source code control: 1995/12/02 05:20:11

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.3 $ * @(#) $Revision: 30.1 $
* @(#) $Id: test3500.cal,v 29.3 2006/06/20 09:29:16 chongo Exp $ * @(#) $Id: test3500.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test3500.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test3500.cal,v $
* *
* Under source code control: 1995/12/18 22:50:46 * Under source code control: 1995/12/18 22:50:46

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.4 $ * @(#) $Revision: 30.1 $
* @(#) $Id: test4000.cal,v 29.4 2006/12/16 11:18:46 chongo Exp $ * @(#) $Id: test4000.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test4000.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test4000.cal,v $
* *
* Under source code control: 1996/03/13 02:38:45 * Under source code control: 1996/03/13 02:38:45

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.5 $ * @(#) $Revision: 30.1 $
* @(#) $Id: test4100.cal,v 29.5 2006/12/16 11:18:46 chongo Exp $ * @(#) $Id: test4100.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test4100.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test4100.cal,v $
* *
* Under source code control: 1996/03/13 03:53:22 * Under source code control: 1996/03/13 03:53:22

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.5 $ * @(#) $Revision: 30.1 $
* @(#) $Id: test4600.cal,v 29.5 2006/06/20 09:29:16 chongo Exp $ * @(#) $Id: test4600.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test4600.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test4600.cal,v $
* *
* Under source code control: 1996/07/02 20:04:40 * Under source code control: 1996/07/02 20:04:40

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.3 $ * @(#) $Revision: 30.1 $
* @(#) $Id: test5100.cal,v 29.3 2006/06/20 09:29:16 chongo Exp $ * @(#) $Id: test5100.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test5100.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test5100.cal,v $
* *
* Under source code control: 1996/12/02 23:57:10 * Under source code control: 1996/12/02 23:57:10

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.3 $ * @(#) $Revision: 30.1 $
* @(#) $Id: test5200.cal,v 29.3 2006/06/20 09:29:16 chongo Exp $ * @(#) $Id: test5200.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test5200.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test5200.cal,v $
* *
* Under source code control: 1997/02/07 02:48:10 * Under source code control: 1997/02/07 02:48:10

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: test8400.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: test8400.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test8400.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test8400.cal,v $
* *
* Under source code control: 1999/10/31 01:00:03 * Under source code control: 1999/10/31 01:00:03

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: test8500.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: test8500.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test8500.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test8500.cal,v $
* *
* Under source code control: 1999/11/12 20:59:59 * Under source code control: 1999/11/12 20:59:59

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 30.1 $
* @(#) $Id: test8600.cal,v 29.1 2000/12/04 19:57:02 chongo Exp $ * @(#) $Id: test8600.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test8600.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test8600.cal,v $
* *
* Under source code control: 2000/12/04 19:57:02 * Under source code control: 2000/12/04 19:57:02

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: unitfrac.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: unitfrac.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/unitfrac.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/unitfrac.cal,v $
* *
* Under source code control: 1990/02/15 01:50:38 * Under source code control: 1990/02/15 01:50:38

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: varargs.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: varargs.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/varargs.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/varargs.cal,v $
* *
* Under source code control: 1991/05/22 21:56:34 * Under source code control: 1991/05/22 21:56:34

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 30.1 $
* @(#) $Id: xx_print.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: xx_print.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/xx_print.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/xx_print.cal,v $
* *
* Under source code control: 1997/04/17 00:08:50 * Under source code control: 1997/04/17 00:08:50

88
calc.c
View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.15 $ * @(#) $Revision: 30.4 $
* @(#) $Id: calc.c,v 29.15 2007/02/11 10:19:14 chongo Exp $ * @(#) $Id: calc.c,v 30.4 2008/04/15 21:17:57 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.c,v $
* *
* Under source code control: 1990/02/15 01:48:11 * Under source code control: 1990/02/15 01:48:11
@@ -42,6 +42,7 @@
#if defined(_WIN32) #if defined(_WIN32)
# include <io.h> # include <io.h>
# if !defined(NOTCYGWIN)
/* /*
* getopt.h file is from the Cygwin GNU library * getopt.h file is from the Cygwin GNU library
* *
@@ -49,6 +50,7 @@
* http://sources.redhat.com/cygwin/ * http://sources.redhat.com/cygwin/
*/ */
# include "../getopt/getopt.h" # include "../getopt/getopt.h"
# endif
# define strdup _strdup # define strdup _strdup
# define isatty _isatty # define isatty _isatty
#endif /* Windoz */ #endif /* Windoz */
@@ -64,7 +66,7 @@
#include "have_uid_t.h" #include "have_uid_t.h"
#include "have_const.h" #include "have_const.h"
#include "custom.h" #include "custom.h"
#include "math_error.h" #include "lib_calc.h"
#include "args.h" #include "args.h"
#include "zmath.h" #include "zmath.h"
@@ -90,6 +92,7 @@
* S_FUNC definitions and functions * S_FUNC definitions and functions
*/ */
S_FUNC void intint(int arg); /* interrupt routine */ S_FUNC void intint(int arg); /* interrupt routine */
S_FUNC void calc_interrupt(char *fmt, ...);
S_FUNC int nextcp(char **cpp, int *ip, int argc, char **argv, BOOL haveendstr); S_FUNC int nextcp(char **cpp, int *ip, int argc, char **argv, BOOL haveendstr);
S_FUNC void set_run_state(run state); S_FUNC void set_run_state(run state);
@@ -188,7 +191,7 @@ main(int argc, char **argv)
fprintf(stderr, fprintf(stderr,
"-m expects" "-m expects"
" argument"); " argument");
exit (1); exit(2);
} }
cp = argv[index]; cp = argv[index];
} }
@@ -203,7 +206,7 @@ main(int argc, char **argv)
fprintf(stderr, fprintf(stderr,
"%s: unknown -m arg\n", "%s: unknown -m arg\n",
program); program);
exit(1); exit(3);
} }
allow_read = (((*cp-'0') & 04) > 0); allow_read = (((*cp-'0') & 04) > 0);
allow_write = (((*cp-'0') & 02) > 0); allow_write = (((*cp-'0') & 02) > 0);
@@ -211,7 +214,7 @@ main(int argc, char **argv)
cp++; cp++;
if (*cp != ' ' && *cp != '\0') { if (*cp != ' ' && *cp != '\0') {
fprintf(stderr, "??? m-arg"); fprintf(stderr, "??? m-arg");
exit(1); exit(4);
} }
havearg = TRUE; havearg = TRUE;
break; break;
@@ -245,8 +248,13 @@ main(int argc, char **argv)
* call libcalc_call_me_last() - * call libcalc_call_me_last() -
* nothing to cleanup * nothing to cleanup
*/ */
printf("%s (version %s)\n", fputs(CALC_TITLE, stdout);
CALC_TITLE, version()); #if defined(CUSTOM)
fputs(" w/custom functions", stdout);
#else
fputs(" w/o custom functions", stdout);
#endif /* CUSTOM */
printf(" (version %s)\n", version());
exit(0); exit(0);
case 'D': case 'D':
/* /*
@@ -262,7 +270,7 @@ main(int argc, char **argv)
FALSE)) { FALSE)) {
fprintf(stderr, fprintf(stderr,
"-D expects argument\n"); "-D expects argument\n");
exit (1); exit(5);
} }
havearg = TRUE; havearg = TRUE;
if (*cp != ':') { if (*cp != ':') {
@@ -270,7 +278,7 @@ main(int argc, char **argv)
fprintf(stderr, fprintf(stderr,
"-D expects" "-D expects"
" integer\n"); " integer\n");
exit (1); exit(6);
} }
calc_debug = cp; calc_debug = cp;
(void) strtol(cp, &endcp, 10); (void) strtol(cp, &endcp, 10);
@@ -280,7 +288,7 @@ main(int argc, char **argv)
fprintf(stderr, fprintf(stderr,
"Bad syntax im -D" "Bad syntax im -D"
" arg\n"); " arg\n");
exit (1); exit(7);
} }
if (*cp != ':') { if (*cp != ':') {
if (nextcp(&cp, &index, if (nextcp(&cp, &index,
@@ -295,14 +303,14 @@ main(int argc, char **argv)
fprintf(stderr, fprintf(stderr,
"-D : expects" "-D : expects"
" argument\n"); " argument\n");
exit (1); exit(8);
} }
if (*cp != ':') { if (*cp != ':') {
if (*cp < '0' || *cp > '9') { if (*cp < '0' || *cp > '9') {
fprintf(stderr, fprintf(stderr,
"-D : expects" "-D : expects"
" integer\n"); " integer\n");
exit (1); exit(9);
} }
resource_debug = cp; resource_debug = cp;
(void) strtol(cp, &endcp, 10); (void) strtol(cp, &endcp, 10);
@@ -312,7 +320,7 @@ main(int argc, char **argv)
fprintf(stderr, fprintf(stderr,
"Bad syntax im -D" "Bad syntax im -D"
" : arg\n"); " : arg\n");
exit (1); exit(10);
} }
if (*cp != ':') { if (*cp != ':') {
if (nextcp(&cp, &index, if (nextcp(&cp, &index,
@@ -327,12 +335,12 @@ main(int argc, char **argv)
FALSE)) { FALSE)) {
fprintf(stderr, "-D : : expects" fprintf(stderr, "-D : : expects"
" argument\n"); " argument\n");
exit (1); exit(11);
} }
if (*cp < '0' || *cp > '9') { if (*cp < '0' || *cp > '9') {
fprintf(stderr, "-D :: expects" fprintf(stderr, "-D :: expects"
" integer\n"); " integer\n");
exit (1); exit(12);
} }
user_debug = cp; user_debug = cp;
(void) strtol(cp, &endcp, 10); (void) strtol(cp, &endcp, 10);
@@ -340,7 +348,7 @@ main(int argc, char **argv)
if (*cp != '\0' && *cp != ' ') { if (*cp != '\0' && *cp != ' ') {
fprintf(stderr, "Bad syntax in" fprintf(stderr, "Bad syntax in"
" -D : : arg\n"); " -D : : arg\n");
exit (1); exit(13);
} }
break; break;
case 'f': case 'f':
@@ -349,13 +357,13 @@ main(int argc, char **argv)
haveendstr)) { haveendstr)) {
fprintf(stderr, "-f expects" fprintf(stderr, "-f expects"
" filename\n"); " filename\n");
exit (1); exit(14);
} }
if (*cp == ';') { if (*cp == ';') {
fprintf(stderr, fprintf(stderr,
"-f expects" "-f expects"
" filename\n"); " filename\n");
exit (1); exit(15);
} }
havearg = TRUE; havearg = TRUE;
if (cmdlen > 0) if (cmdlen > 0)
@@ -373,7 +381,7 @@ main(int argc, char **argv)
fprintf(stderr, "-f -once" fprintf(stderr, "-f -once"
" expects" " expects"
" filename\n"); " filename\n");
exit (1); exit(16);
} }
} }
bp = cmdbuf + cmdlen; bp = cmdbuf + cmdlen;
@@ -383,13 +391,13 @@ main(int argc, char **argv)
fprintf(stderr, fprintf(stderr,
"Null" "Null"
" filename!"); " filename!");
exit (1); exit(17);
} }
if (cmdlen + len + 2 > MAXCMD) { if (cmdlen + len + 2 > MAXCMD) {
fprintf(stderr, fprintf(stderr,
"Commands too" "Commands too"
" long"); " long");
exit (1); exit(18);
} }
/* XXX What if *cp = '\''? */ /* XXX What if *cp = '\''? */
*bp++ = '\''; *bp++ = '\'';
@@ -404,7 +412,7 @@ main(int argc, char **argv)
fprintf(stderr, fprintf(stderr,
"Commands" "Commands"
" too long"); " too long");
exit (1); exit(19);
} }
*bp++ = *cp++; *bp++ = *cp++;
cmdlen++; cmdlen++;
@@ -439,7 +447,7 @@ main(int argc, char **argv)
"usage: %s ... -f filename\n" "usage: %s ... -f filename\n"
"1st cscript line: #/path/to/calc ... -f\n", "1st cscript line: #/path/to/calc ... -f\n",
program, program); program, program);
exit(1); exit(20);
} }
if (havearg) if (havearg)
break; break;
@@ -465,7 +473,7 @@ main(int argc, char **argv)
fprintf(stderr, fprintf(stderr,
"%s: commands too long\n", "%s: commands too long\n",
program); program);
exit(1); exit(21);
} }
strncpy(cmdbuf + cmdlen, cp, cplen+1); strncpy(cmdbuf + cmdlen, cp, cplen+1);
cmdlen = newcmdlen; cmdlen = newcmdlen;
@@ -536,14 +544,13 @@ main(int argc, char **argv)
/* /*
* establish error longjump point with initial conditions * establish error longjump point with initial conditions
*/ */
if (setjmp(jmpbuf) == 0) { if (setjmp(calc_scanerr_jmpbuf) == 0) {
/* /*
* reset/initialize the computing environment * reset/initialize the computing environment
*/ */
if (post_init) initialize();
initialize(); calc_use_scanerr_jmpbuf = 1;
post_init = TRUE;
} }
/* /*
@@ -718,7 +725,7 @@ intint(int UNUSED arg)
{ {
(void) signal(SIGINT, intint); (void) signal(SIGINT, intint);
if (inputwait || (++abortlevel >= ABORT_NOW)) { if (inputwait || (++abortlevel >= ABORT_NOW)) {
math_error("\nABORT"); calc_interrupt("\nABORT");
/*NOTREACHED*/ /*NOTREACHED*/
} }
if (abortlevel >= ABORT_MATH) if (abortlevel >= ABORT_MATH)
@@ -728,14 +735,12 @@ intint(int UNUSED arg)
/* /*
* Routine called on any runtime error, to complain about it (with possible * report an interrupt
* arguments), and then longjump back to the top level command scanner.
*/ */
void static void
math_error(char *fmt, ...) calc_interrupt(char *fmt, ...)
{ {
va_list ap; va_list ap;
char buf[MAXERROR+1];
if (funcname && (*funcname != '*')) if (funcname && (*funcname != '*'))
fprintf(stderr, "\"%s\": ", funcname); fprintf(stderr, "\"%s\": ", funcname);
@@ -743,12 +748,13 @@ math_error(char *fmt, ...)
!inputisterminal())) !inputisterminal()))
fprintf(stderr, "line %ld: ", funcline); fprintf(stderr, "line %ld: ", funcline);
va_start(ap, fmt); va_start(ap, fmt);
vsprintf(buf, fmt, ap); vsnprintf(calc_err_msg, MAXERROR, fmt, ap);
va_end(ap); va_end(ap);
fprintf(stderr, "%s\n", buf); calc_err_msg[MAXERROR] = '\0';
fprintf(stderr, "%s\n\n", calc_err_msg);
funcname = NULL; funcname = NULL;
if (post_init) { if (calc_use_scanerr_jmpbuf != 0) {
longjmp(jmpbuf, 1); longjmp(calc_scanerr_jmpbuf, 22);
} else { } else {
fprintf(stderr, "It is too early provide a command line prompt " fprintf(stderr, "It is too early provide a command line prompt "
"so we must simply exit. Sorry!\n"); "so we must simply exit. Sorry!\n");
@@ -756,7 +762,7 @@ math_error(char *fmt, ...)
* don't call libcalc_call_me_last() -- we might loop * don't call libcalc_call_me_last() -- we might loop
* and besides ... this is an unusual internal error case * and besides ... this is an unusual internal error case
*/ */
exit(3); exit(22);
} }
} }

10
calc.h
View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.21 $ * @(#) $Revision: 30.2 $
* @(#) $Id: calc.h,v 29.21 2007/02/12 03:26:23 chongo Exp $ * @(#) $Id: calc.h,v 30.2 2007/07/10 17:44:52 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.h,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.h,v $
* *
* Under source code control: 1990/02/15 01:48:31 * Under source code control: 1990/02/15 01:48:31
@@ -66,7 +66,6 @@
#define LISTCHAR ':' /* char which separates paths in a list */ #define LISTCHAR ':' /* char which separates paths in a list */
#endif #endif
#define MAXCMD 16384 /* maximum length of command invocation */ #define MAXCMD 16384 /* maximum length of command invocation */
#define MAXERROR 512 /* maximum length of error message string */
#define SYMBOLSIZE 256 /* maximum symbol name size */ #define SYMBOLSIZE 256 /* maximum symbol name size */
#define MAXLABELS 100 /* maximum number of user labels in function */ #define MAXLABELS 100 /* maximum number of user labels in function */
@@ -91,6 +90,7 @@
#define ABORT_NOW 4 /* abort right away */ #define ABORT_NOW 4 /* abort right away */
#define ERRMAX 20 /* default errmax value */ #define ERRMAX 20 /* default errmax value */
#define E_OK 0 /* no error */
/* /*
* File ids corresponding to standard in, out, error, and when not in use. * File ids corresponding to standard in, out, error, and when not in use.
@@ -190,14 +190,12 @@ E_FUNC void reinitialize(void);
E_FUNC int isatty(int tty); /* TRUE if fd is a tty */ E_FUNC int isatty(int tty); /* TRUE if fd is a tty */
#endif #endif
E_FUNC char *version(void); /* return version string */ E_FUNC char *version(void); /* return version string */
EXTERN int post_init; /* TRUE => math_error setjmp is ready */
/* /*
* global flags and definitions * global flags and definitions
*/ */
EXTERN int abortlevel; /* current level of aborts */ EXTERN int abortlevel; /* current level of aborts */
EXTERN BOOL inputwait; /* TRUE if in a terminal input wait */ EXTERN BOOL inputwait; /* TRUE if in a terminal input wait */
EXTERN jmp_buf jmpbuf; /* for errors */
EXTERN int p_flag; /* TRUE => pipe mode */ EXTERN int p_flag; /* TRUE => pipe mode */
EXTERN int q_flag; /* TRUE => don't execute rc files */ EXTERN int q_flag; /* TRUE => don't execute rc files */

View File

@@ -13,10 +13,10 @@
.\" A copy of version 2.1 of the GNU Lesser General Public License is .\" 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 .\" distributed with calc under the filename COPYING-LGPL. You should have
.\" received a copy with calc; if not, write to Free Software Foundation, Inc. .\" received a copy with calc; if not, write to Free Software Foundation, Inc.
.\" 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. .\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.\" .\"
.\" @(#) $Revision: 29.21 $ .\" @(#) $Revision: 30.3 $
.\" @(#) $Id: calc.man,v 29.21 2007/02/07 00:38:43 chongo Exp $ .\" @(#) $Id: calc.man,v 30.3 2007/09/08 02:53:09 chongo Exp $
.\" @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.man,v $ .\" @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.man,v $
.\" .\"
.\" Under source code control: 1991/07/23 05:48:26 .\" Under source code control: 1991/07/23 05:48:26
@@ -63,7 +63,7 @@ CALC OPTIONS
.TP .TP
.B \-c .B \-c
Continue reading command lines even after an scan/parse Continue reading command lines even after a scan/parse
error has caused the abandonment of a line. error has caused the abandonment of a line.
Note that this option only deals with scanning and Note that this option only deals with scanning and
parsing of the calc language. parsing of the calc language.
@@ -225,7 +225,7 @@ filename
.sp 1 .sp 1
On systems that treat an executable that begins with On systems that treat an executable that begins with
.B #! .B #!
as a script, the path of the execurable is appended by the kernel as a script, the path of the executable is appended by the kernel
as the final argument to the exec() system call. as the final argument to the exec() system call.
This is why the This is why the
.B \-f .B \-f
@@ -275,18 +275,14 @@ See
.TP .TP
.B \-i .B \-i
Become interactive if possible. Become interactive if possible.
If
.I calc_cmd
args are given,
.B calc
by default, calc will execute them and exit.
This flag causes
.B calc
to drop into interactive mode after the commands are executed.
This flag will cause This flag will cause
.B calc .B calc
to drop into interactive mode after the to drop into interactive mode after the
commands are executed. .I calc_cmd
arguments on the command line are evaluated.
Without this flag,
.B calc
will exit after they are evaluated.
.sp 1 .sp 1
For example: For example:
.sp 1 .sp 1
@@ -706,7 +702,7 @@ the rest of the file will be processed in
.BR "shell script mode" . .BR "shell script mode" .
Note that Note that
.B \-f .B \-f
must at the end of the intiial ``#!'' line. must at the end of the initial ``#!'' line.
Any other optional Any other optional
.B "other_flags" .B "other_flags"
must come before must come before
@@ -1078,9 +1074,9 @@ If you do not have these files, write to:
.in +0.5i .in +0.5i
.nf .nf
Free Software Foundation, Inc. Free Software Foundation, Inc.
59 Temple Place 51 Franklin Street
Suite 330 Fifth Floor
Boston, MA 02111-1307 Boston, MA 02110-1301
USA USA
.fi .fi
.in -0.5i .in -0.5i

View File

@@ -2,7 +2,7 @@
# #
# calc.spec.in - template specfile for calc # calc.spec.in - template specfile for calc
# #
# Copyright (C) 2003-2005 Petteri Kettunen and Landon Curt Noll # Copyright (C) 2003-2007 Petteri Kettunen and Landon Curt Noll
# #
# Calc is open software; you can redistribute it and/or modify it under # 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 # the terms of the version 2.1 of the GNU Lesser General Public License
@@ -16,10 +16,10 @@
# A copy of version 2.1 of the GNU Lesser General Public License is # 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 # distributed with calc under the filename COPYING-LGPL. You should have
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# @(#) $Revision: 29.16 $ # @(#) $Revision: 30.6 $
# @(#) $Id: calc.spec.in,v 29.16 2006/06/26 05:50:44 chongo Exp $ # @(#) $Id: calc.spec.in,v 30.6 2007/10/16 12:22:22 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.spec.in,v $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.spec.in,v $
# #
# Under source code control: 2003/02/16 20:21:39 # Under source code control: 2003/02/16 20:21:39
@@ -37,10 +37,10 @@
Summary: Arbitrary precision calculator. Summary: Arbitrary precision calculator.
Name: calc Name: calc
Version: <<<PROJECT_VERSION>>> Version: <<<PROJECT_VERSION>>>
Release: 0 Release: 1.1
License: LGPL License: LGPL
Group: Applications/Engineering Group: Applications/Engineering
Source: %{name}-%{version}.tar.gz Source: %{name}-%{version}.tar.bz2
URL: http://www.isthe.com/chongo/tech/comp/calc/index.html URL: http://www.isthe.com/chongo/tech/comp/calc/index.html
Requires: ncurses >= 5.2-26, readline >= 4.2, less >= 358 Requires: ncurses >= 5.2-26, readline >= 4.2, less >= 358
BuildRequires: ncurses-devel >= 5.2-26, readline-devel >= 4.2 BuildRequires: ncurses-devel >= 5.2-26, readline-devel >= 4.2
@@ -73,12 +73,40 @@ For the latest calc release, see the project home page:
%setup -q %setup -q
%build %build
make %{?_smp_mflags} T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 all chk echo '-=- calc.spec beginning make clobber -=-'
make %{?_smp_mflags} T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ clobber
echo '-=- calc.spec ending make clobber -=-'
echo '-=- calc.spec beginning make calc-static-only -=-'
make %{?_smp_mflags} T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ calc-static-only BLD_TYPE=calc-static-only
echo '-=- calc.spec ending make calc-static-only -=-'
echo '-=- calc.spec beginning make rpm-hide-static -=-'
make %{?_smp_mflags} T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ rpm-hide-static
echo '-=- calc.spec ending make rpm-hide-static -=-'
echo '-=- calc.spec beginning make clobber (again) -=-'
make %{?_smp_mflags} T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ clobber
echo '-=- calc.spec ending make clobber (again) -=-'
echo '-=- calc.spec beginning make calc-dynamic-only -=-'
make %{?_smp_mflags} T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ calc-dynamic-only BLD_TYPE=calc-dynamic-only LD_SHARE=
echo '-=- calc.spec ending make calc-dynamic-only -=-'
echo '-=- calc.spec beginning make chk -=-'
make %{?_smp_mflags} T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ chk
echo '-=- calc.spec ending make chk -=-'
echo '-=- calc.spec beginning make rpm-unhide-static -=-'
make %{?_smp_mflags} T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ rpm-unhide-static
echo '-=- calc.spec ending make rpm-unhide-static -=-'
echo '-=- calc.spec beginning make rpm-clean-static -=-'
make %{?_smp_mflags} T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ rpm-clean-static
echo '-=- calc.spec ending make rpm-clean-static -=-'
echo '-=- calc.spec beginning make rpm-chk-static -=-'
make %{?_smp_mflags} T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ rpm-chk-static
echo '-=- calc.spec ending make rpm-chk-static -=-'
%install %install
rm -rf %{buildroot} rm -rf %{buildroot}
mkdir -p %{buildroot} mkdir -p %{buildroot}
make T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 install echo '-=- calc.spec beginning make install -=-'
make T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ install
echo '-=- calc.spec ending make install -=-'
%clean %clean
rm -rf %{buildroot} rm -rf %{buildroot}
@@ -86,21 +114,31 @@ rm -rf %{buildroot}
%files %files
%defattr(-, root, root) %defattr(-, root, root)
%doc BUGS CHANGES COPYING COPYING-LGPL %doc BUGS CHANGES COPYING COPYING-LGPL
%{_bindir}/* %attr(755, root, root) %{_bindir}/calc
%{_mandir}/man1/* %attr(755, root, root) %{_bindir}/cscript/*
%{_datadir}/%{name}/*/* %attr(644, root, root) %{_mandir}/man1/calc.1.gz
%{_datadir}/%{name}/bindings %attr(644, root, root) %{_datadir}/%{name}/README
%{_datadir}/%{name}/README %attr(644, root, root) %{_datadir}/%{name}/bindings
%{_datadir}/%{name}/*.cal %attr(644, root, root) %{_datadir}/%{name}/custhelp/*
%{_datadir}/%{name}/*.line %attr(644, root, root) %{_datadir}/%{name}/custom/*.cal
%attr(644, root, root) %{_datadir}/%{name}/help/*
%attr(644, root, root) %{_datadir}/%{name}/*.cal
%attr(644, root, root) %{_datadir}/%{name}/*.line
%attr(644, root, root) %{_libdir}/libcalc.so.%{version}
%attr(644, root, root) %{_libdir}/libcustcalc.so.%{version}
%files devel %files devel
%defattr(-, root, root) %defattr(-, root, root)
%doc BUGS COPYING COPYING-LGPL LIBRARY %doc BUGS COPYING COPYING-LGPL LIBRARY
%attr(755, root, root) %{_bindir}/calc-static
%attr(644, root, root) %{_includedir}/calc/* %attr(644, root, root) %{_includedir}/calc/*
%attr(644, root, root) %{_libdir}/*.a %attr(644, root, root) %{_libdir}/libcalc.a
%attr(644, root, root) %{_libdir}/libcustcalc.a
%changelog %changelog
* Sun Sep 01 2007 Landon Curt Noll http://www.isthe.com/chongo
- Release of calc-2.12.2
- Calc builds with shared libraries
* Sun Jun 25 2006 Landon Curt Noll http://www.isthe.com/chongo * Sun Jun 25 2006 Landon Curt Noll http://www.isthe.com/chongo
- Changed Copyright to License as per new rpm v4.4 syntax - Changed Copyright to License as per new rpm v4.4 syntax
* Sun May 20 2006 Landon Curt Noll http://www.isthe.com/chongo * Sun May 20 2006 Landon Curt Noll http://www.isthe.com/chongo

View File

@@ -15,10 +15,10 @@
# A copy of version 2.1 of the GNU Lesser General Public License is # 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 # distributed with calc under the filename COPYING-LGPL. You should have
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# @(#) $Revision: 29.10 $ # @(#) $Revision: 30.1 $
# @(#) $Id: calcerr.tbl,v 29.10 2006/08/20 15:01:30 chongo Exp $ # @(#) $Id: calcerr.tbl,v 30.1 2007/03/16 11:09:46 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr.tbl,v $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr.tbl,v $
# #
# Under source code control: 1996/05/23 17:38:44 # Under source code control: 1996/05/23 17:38:44

View File

@@ -16,10 +16,10 @@
# A copy of version 2.1 of the GNU Lesser General Public License is # 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 # distributed with calc under the filename COPYING-LGPL. You should have
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# @(#) $Revision: 29.2 $ # @(#) $Revision: 30.1 $
# @(#) $Id: calcerr_c.awk,v 29.2 2000/06/07 14:02:13 chongo Exp $ # @(#) $Id: calcerr_c.awk,v 30.1 2007/03/16 11:09:46 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr_c.awk,v $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr_c.awk,v $
# #
# Under source code control: 1996/05/24 03:15:35 # Under source code control: 1996/05/24 03:15:35

View File

@@ -16,10 +16,10 @@
# A copy of version 2.1 of the GNU Lesser General Public License is # 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 # distributed with calc under the filename COPYING-LGPL. You should have
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# @(#) $Revision: 29.2 $ # @(#) $Revision: 30.1 $
# @(#) $Id: calcerr_c.sed,v 29.2 2000/06/07 14:02:13 chongo Exp $ # @(#) $Id: calcerr_c.sed,v 30.1 2007/03/16 11:09:46 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr_c.sed,v $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr_c.sed,v $
# #
# Under source code control: 1996/05/24 03:15:35 # Under source code control: 1996/05/24 03:15:35

View File

@@ -16,10 +16,10 @@
# A copy of version 2.1 of the GNU Lesser General Public License is # 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 # distributed with calc under the filename COPYING-LGPL. You should have
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# @(#) $Revision: 29.2 $ # @(#) $Revision: 30.1 $
# @(#) $Id: calcerr_h.awk,v 29.2 2000/06/07 14:02:13 chongo Exp $ # @(#) $Id: calcerr_h.awk,v 30.1 2007/03/16 11:09:46 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr_h.awk,v $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr_h.awk,v $
# #
# Under source code control: 1996/05/23 17:38:44 # Under source code control: 1996/05/23 17:38:44

View File

@@ -16,10 +16,10 @@
# A copy of version 2.1 of the GNU Lesser General Public License is # 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 # distributed with calc under the filename COPYING-LGPL. You should have
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# @(#) $Revision: 29.2 $ # @(#) $Revision: 30.1 $
# @(#) $Id: calcerr_h.sed,v 29.2 2000/06/07 14:02:13 chongo Exp $ # @(#) $Id: calcerr_h.sed,v 30.1 2007/03/16 11:09:46 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr_h.sed,v $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr_h.sed,v $
# #
# Under source code control: 1996/05/23 17:38:44 # Under source code control: 1996/05/23 17:38:44

View File

@@ -16,10 +16,10 @@
# A copy of version 2.1 of the GNU Lesser General Public License is # 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 # distributed with calc under the filename COPYING-LGPL. You should have
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# @(#) $Revision: 29.5 $ # @(#) $Revision: 30.1 $
# @(#) $Id: check.awk,v 29.5 2006/09/18 08:01:13 chongo Exp $ # @(#) $Id: check.awk,v 30.1 2007/03/16 11:09:46 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/check.awk,v $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/check.awk,v $
# #
# Under source code control: 1996/05/25 22:07:58 # Under source code control: 1996/05/25 22:07:58

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.7 $ * @(#) $Revision: 30.1 $
* @(#) $Id: cmath.h,v 29.7 2005/10/18 10:43:49 chongo Exp $ * @(#) $Id: cmath.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/cmath.h,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/cmath.h,v $
* *
* Under source code control: 1993/07/30 19:42:45 * Under source code control: 1993/07/30 19:42:45

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.23 $ * @(#) $Revision: 30.2 $
* @(#) $Id: codegen.c,v 29.23 2007/02/11 10:19:14 chongo Exp $ * @(#) $Id: codegen.c,v 30.2 2007/07/05 13:30:38 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/codegen.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/codegen.c,v $
* *
* Under source code control: 1990/02/15 01:48:13 * Under source code control: 1990/02/15 01:48:13
@@ -36,12 +36,13 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include "lib_calc.h"
#include "calc.h" #include "calc.h"
#include "token.h" #include "token.h"
#include "symbol.h" #include "symbol.h"
#include "label.h" #include "label.h"
#include "opcodes.h" #include "opcodes.h"
#include "string.h" #include "str.h"
#include "func.h" #include "func.h"
#include "conf.h" #include "conf.h"
@@ -227,7 +228,14 @@ getcommands(BOOL toplevel)
run_state = RUN_EXIT; run_state = RUN_EXIT;
else if (run_state < RUN_PRE_TOP_LEVEL) else if (run_state < RUN_PRE_TOP_LEVEL)
run_state = RUN_PRE_TOP_LEVEL; run_state = RUN_PRE_TOP_LEVEL;
longjmp(jmpbuf, 1); if (calc_use_scanerr_jmpbuf != 0) {
longjmp(calc_scanerr_jmpbuf, 30);
} else {
fprintf(stderr,
"calc_scanerr_jmpbuf not setup, exiting code 30\n");
libcalc_call_me_last();
exit(30);
}
} }
} }
} }
@@ -1362,7 +1370,7 @@ creatematrix(void)
rescantoken(); rescantoken();
if (++dim > MAXDIM) { if (++dim > MAXDIM) {
scanerror(T_SEMICOLON, scanerror(T_SEMICOLON,
"Only %ld dimensions allowed", MAXDIM); "Only %d dimensions allowed", MAXDIM);
return; return;
} }
(void) getopassignment(); (void) getopassignment();

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.7 $ * @(#) $Revision: 30.2 $
* @(#) $Id: comfunc.c,v 29.7 2007/02/11 10:19:14 chongo Exp $ * @(#) $Id: comfunc.c,v 30.2 2007/07/11 23:05:49 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/comfunc.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/comfunc.c,v $
* *
* Under source code control: 1990/02/15 01:48:13 * Under source code control: 1990/02/15 01:48:13
@@ -1117,8 +1117,8 @@ c_power(COMPLEX *c1, COMPLEX *c2, NUMBER *epsilon)
/*NOTREACHED*/ /*NOTREACHED*/
} }
if (ciszero(c1)) { if (ciszero(c1)) {
if (qisneg(c2->real) || qiszero(c2->real)) { if (cisreal(c2) && qisneg(c2->real)) {
math_error ("Non-positive exponent of zero"); math_error ("Non-positive real exponent of zero");
/*NOTREACHED*/ /*NOTREACHED*/
} }
return clink(&_czero_); return clink(&_czero_);

View File

@@ -15,10 +15,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.5 $ * @(#) $Revision: 30.1 $
* @(#) $Id: commath.c,v 29.5 2007/02/11 10:19:14 chongo Exp $ * @(#) $Id: commath.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/commath.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/commath.c,v $
* *
* Under source code control: 1990/02/15 01:48:10 * Under source code control: 1990/02/15 01:48:10

View File

@@ -17,10 +17,10 @@
* A copy of version 2.1 of the GNU Lesser General Public License is * 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 * distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 29.24 $ * @(#) $Revision: 30.2 $
* @(#) $Id: config.c,v 29.24 2007/02/11 10:19:14 chongo Exp $ * @(#) $Id: config.c,v 30.2 2007/07/05 13:30:38 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/config.c,v $
* *
* Under source code control: 1991/07/20 00:21:56 * Under source code control: 1991/07/20 00:21:56
@@ -55,7 +55,7 @@
#include "block.h" #include "block.h"
#include "nametype.h" #include "nametype.h"
#include "config.h" #include "config.h"
#include "string.h" #include "str.h"
#include "custom.h" #include "custom.h"
#include "have_strdup.h" #include "have_strdup.h"
@@ -529,7 +529,7 @@ setconfig(int type, VALUE *vp)
} }
temp = lookup_long(modes, vp->v_str->s_str); temp = lookup_long(modes, vp->v_str->s_str);
if (temp < 0) { if (temp < 0) {
math_error("Unknown mode \"%s\"", vp->v_str); math_error("Unknown mode \"%s\"", vp->v_str->s_str);
/*NOTREACHED*/ /*NOTREACHED*/
} }
math_setmode((int) temp); math_setmode((int) temp);
@@ -542,7 +542,7 @@ setconfig(int type, VALUE *vp)
} }
temp = lookup_long(modes, vp->v_str->s_str); temp = lookup_long(modes, vp->v_str->s_str);
if (temp < 0) { if (temp < 0) {
math_error("Unknown mode \"%s\"", vp->v_str); math_error("Unknown mode \"%s\"", vp->v_str->s_str);
/*NOTREACHED*/ /*NOTREACHED*/
} }
math_setmode2((int) temp); math_setmode2((int) temp);

Some files were not shown because too many files have changed in this diff Show More