Compare commits

...

12 Commits

Author SHA1 Message Date
Landon Curt Noll
63d9b22067 Release calc version 2.11.5t1.0 2017-05-21 15:38:39 -07:00
Landon Curt Noll
fc85ac3791 Release calc version 2.11.5t0 2017-05-21 15:38:39 -07:00
Landon Curt Noll
3d55811205 Release calc version 2.11.4t2 2017-05-21 15:38:39 -07:00
Landon Curt Noll
296aa50ac7 Release calc version 2.11.2t1 2017-05-21 15:38:38 -07:00
Landon Curt Noll
5e098d2adf Release calc version 2.11.4t1 2017-05-21 15:38:38 -07:00
Landon Curt Noll
ae2a752314 Release calc version 2.11.3t0 2017-05-21 15:38:38 -07:00
Landon Curt Noll
61dd47526f Release calc version 2.11.2t1.0 2017-05-21 15:38:38 -07:00
Landon Curt Noll
417ffb6ab5 Release calc version 2.11.1t2.1 2017-05-21 15:38:37 -07:00
Landon Curt Noll
121b8f72c6 Release calc version 2.11.1t3.0 2017-05-21 15:38:37 -07:00
Landon Curt Noll
9968a69f50 Release calc version 2.11.1t3 2017-05-21 15:38:37 -07:00
Landon Curt Noll
1ea579d929 Release calc version 2.11.1t2.2 2017-05-21 15:38:37 -07:00
Landon Curt Noll
0521ed202f Release calc version 2.11.1t2 2017-05-21 15:38:37 -07:00
509 changed files with 9216 additions and 4568 deletions

67
BUGS
View File

@@ -20,20 +20,21 @@ configuration, try backing them out and see if things get better.
To be sure that your version of calc is up to date, check out: To be sure that your version of calc is up to date, check out:
http://reality.sgi.com/chongo/tech/comp/calc/calc-download.html http://www.isthe.com/chongo/tech/comp/calc/calc-download.html
The calc web site is located at: The calc web site is located at:
http://reality.sgi.com/chongo/tech/comp/calc/index.html http://www.isthe.com/chongo/tech/comp/calc/index.html
=-= =-=
If you have tried all of the above and things still are not right, If you have tried all of the above and things still are not right,
then it may be time to send in a bug report. You can send bug reports to: then it may be time to send in a bug report. You can send bug reports to:
calc-bugs at postofc dot corp dot sgi dot com calc-bugs at asthe dot com
[[ Replace 'at' with @, 'dot' is with . and remove the spaces ]] [[ NOTE: Replace 'at' with @, 'dot' is with . and remove the spaces ]]
[[ NOTE: The EMail address uses 'asthe', the web site URL uses 'isthe' ]]
When you send your report, please include the following information: When you send your report, please include the following information:
@@ -58,9 +59,10 @@ Stack traces from core dumps are useful to send as well.
Send any comments, compiler warning messages, suggestions and most Send any comments, compiler warning messages, suggestions and most
importantly, fixes (in the form of a context diff patch) to: importantly, fixes (in the form of a context diff patch) to:
calc-tester at postofc dot corp dot sgi dot com calc-bugs at asthe dot com
[[ Replace 'at' with @, 'dot' is with . and remove the spaces ]] [[ NOTE: Replace 'at' with @, 'dot' is with . and remove the spaces ]]
[[ NOTE: The EMail address uses 'asthe', the web site URL uses 'isthe' ]]
You should use the above calc-bugs address for bug reports, if you are You should use the above calc-bugs address for bug reports, if you are
not currently a member of the calc-tester mailing list. not currently a member of the calc-tester mailing list.
@@ -81,6 +83,51 @@ Problems with known work-a-rounds:
to fail the regression test. The work-a-round is to compile with -O to fail the regression test. The work-a-round is to compile with -O
or to use gcc-2.96 or later. or to use gcc-2.96 or later.
This bug has been observed on the Sparc and the PowerPC machine.
On the PowerPC with gcc-2.95 when compiled with -O2, the following
patch seems to help:
*** zfunc.c.orig Fri Feb 23 18:18:39 2001
--- zfunc.c Fri Feb 23 18:39:33 2001
***************
*** 1481,1487 ****
{
HALF *a, *A, *b, *a0, u;
int i, j, j1, j2, k, k1, m, m0, m1, n, n0, o;
! FULL d, e, f, g, h, s, t, x, topbit;
int remsign;
BOOL up, onebit;
ZVALUE sqrt;
--- 1481,1488 ----
{
HALF *a, *A, *b, *a0, u;
int i, j, j1, j2, k, k1, m, m0, m1, n, n0, o;
! volatile FULL d;
! FULL e, f, g, h, s, t, x, topbit;
int remsign;
BOOL up, onebit;
ZVALUE sqrt;
*** zmath.c 2000/06/07 14:02:13 29.2
--- zmath.c 2001/03/13 19:47:03
***************
*** 1608,1614 ****
void
zbitvalue(long n, ZVALUE *res)
{
! ZVALUE z;
if (n < 0) n = 0;
z.sign = 0;
--- 1608,1614 ----
void
zbitvalue(long n, ZVALUE *res)
{
! volatile ZVALUE z;
if (n < 0) n = 0;
z.sign = 0;
* Solaris cc somtimes barfs while compiling zrand.c. In particular, calc * Solaris cc somtimes barfs while compiling zrand.c. In particular, calc
barfs on on the SVAL macro. The work-a-round is to use the Solaric cc barfs on on the SVAL macro. The work-a-round is to use the Solaric cc
Makefile set sets -DFORCE_STDC. I.e,: Makefile set sets -DFORCE_STDC. I.e,:
@@ -177,12 +224,12 @@ Problems with known work-a-rounds:
## 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. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## ##
## @(#) $Revision: 29.4 $ ## @(#) $Revision: 29.9 $
## @(#) $Id: BUGS,v 29.4 1999/12/15 09:13:29 chongo Exp $ ## @(#) $Id: BUGS,v 29.9 2001/03/18 03:34:41 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
## File existed as early as: 1994 ## File existed as early as: 1994
## ##
## chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ ## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/

682
CHANGES

File diff suppressed because it is too large Load Diff

49
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.1 $ # @(#) $Revision: 29.5 $
# @(#) $Id: COPYING,v 29.1 1999/12/14 09:15:29 chongo Exp $ # @(#) $Id: COPYING,v 29.5 2000/12/18 10:22:55 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/COPYING,v $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/COPYING,v $
=-= =-=
@@ -55,16 +55,28 @@ Calc is covered by the GNU Lesser General Public License
The contact addresses for calc is as follows: The contact addresses for calc is as follows:
Web: http://reality.sgi.com/chongo/tech/comp/calc/index.html Web: http://www.isthe.com/chongo/tech/comp/calc/index.html
http://www.isthe.com/chongo/tech/comp/calc/index.html EMail: calc-contrib at asthe dot com
EMail: calc-tester at postofc dot corp dot sgi dot com To join the calc-tester mailing list. Send a request to:
calc-tester at isthe dot com
[[ Replace 'at' with @, 'dot' is with . and remove spaces ]] calc-tester-request at asthe dot com
The 2nd address set is provided in case the 1st address set no Your message body (not the subject) should consist of:
longer functions.
subscribe calc-tester address
end
name your_full_name
where ``address'' is your EMail address and ``your_full_name'' is
your full name.
Calc bug reports, however should be sent to:
calc-bugs at asthe dot com
[[ NOTE: Replace 'at' with @, 'dot' is with . and remove the spaces ]]
[[ NOTE: The EMail address uses 'asthe' and the web site URL uses 'isthe' ]]
=-= =-=
@@ -128,7 +140,7 @@ Calc copyrights and exception files
----------------------------------- -----------------------------------
With the exception of the files listed below, Calc is covered under With the exception of the files listed below, Calc is covered under
the following Copyrights: the following GNU Lesser General Public License Copyrights:
Copyright (C) year David I. Bell Copyright (C) year David I. Bell
Copyright (C) year David I. Bell and Landon Curt Noll Copyright (C) year David I. Bell and Landon Curt Noll
@@ -138,12 +150,11 @@ Calc copyrights and exception files
Copyright (C) year Ernest Bowen and Landon Curt Noll Copyright (C) year Ernest Bowen and Landon Curt Noll
Copyright (C) year Ernest Bowen Copyright (C) year Ernest Bowen
A few files are not covered under the GNU Lesser General Public These files are not covered under one of the Copyrights listed above:
License. The source files not covered are:
shs1.c shs1.h shs.c shs.h shs1.c shs1.h shs.c shs.h
md5.c md5.h lib/qtime.cal COPYING md5.c md5.h COPYING COPYING-LGPL
COPYING-LGPL cal/qtime.cal
The file COPYING-LGPL, which contains a copy of the version 2.1 The file COPYING-LGPL, which contains a copy of the version 2.1
GNU Lesser General Public License, is itself Copyrighted by the GNU Lesser General Public License, is itself Copyrighted by the
@@ -155,6 +166,14 @@ Calc copyrights and exception files
top of this file. It is important to note that you may distribute top of this file. It is important to note that you may distribute
verbatim copies of this file but you may not modify this file. verbatim copies of this file but you may not modify this file.
Some of these exception files are in the public domain. Other
exception files have non-LGPL Copyrights. Other files are under a
LGPL Copyright but have different authors.
In all cases one may use and distribute these exception files freely.
And because one may freely distribute the LGPL covered files, the
entire calc source may be freely used and distributed.
=-= =-=
General Copyleft and License info General Copyleft and License info

View File

@@ -65,12 +65,12 @@ the calc help subsystem. See the README file for details.
## 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. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## ##
## @(#) $Revision: 29.1 $ ## @(#) $Revision: 29.2 $
## @(#) $Id: HOWTO.INSTALL,v 29.1 1999/12/14 09:15:29 chongo Exp $ ## @(#) $Id: HOWTO.INSTALL,v 29.2 2000/06/07 14:02:13 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
## File existed as early as: 1999 ## File existed as early as: 1999
## ##
## chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ ## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/

View File

@@ -471,12 +471,12 @@ need call libcalc_call_me_last() only once.
## 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. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## ##
## @(#) $Revision: 29.1 $ ## @(#) $Revision: 29.2 $
## @(#) $Id: LIBRARY,v 29.1 1999/12/14 09:15:29 chongo Exp $ ## @(#) $Id: LIBRARY,v 29.2 2000/06/07 14:02:13 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
## File existed as early as: 1993 ## File existed as early as: 1993
## ##
## chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ ## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/

846
Makefile

File diff suppressed because it is too large Load Diff

22
README
View File

@@ -4,7 +4,7 @@ See the HOWTO.INSTALL file for information on how to build and install calc.
To be sure that your version of calc is up to date, check out: To be sure that your version of calc is up to date, check out:
http://reality.sgi.com/chongo/tech/comp/calc/calc-download.html http://www.isthe.com/chongo/tech/comp/calc/calc-download.html
We are interested in any/all feedback on recent versions of calc. We are interested in any/all feedback on recent versions of calc.
In particular we would like to hear about: In particular we would like to hear about:
@@ -75,9 +75,10 @@ for a wish/todo list. Code contributions are welcome.
To join the calc-tester mailing list. Send a request to: To join the calc-tester mailing list. Send a request to:
calc-tester-request at postofc dot corp dot sgi dot com calc-tester-request at asthe dot com
[[ Replace 'at' with @, 'dot' is with . and remove the spaces ]] [[ NOTE: Replace 'at' with @, 'dot' is with . and remove the spaces ]]
[[ NOTE: The EMail address uses 'asthe' and the web site URL uses 'isthe' ]]
Your message body (not the subject) should consist of: Your message body (not the subject) should consist of:
@@ -90,15 +91,16 @@ your full name.
Calc bug reports, however should be sent to: Calc bug reports, however should be sent to:
calc-bugs at postofc dot corp dot sgi dot com calc-bugs at asthe dot com
[[ Replace 'at' with @, 'dot' is with . and remove the spaces ]] [[ NOTE: Replace 'at' with @, 'dot' is with . and remove the spaces ]]
[[ NOTE: The EMail address uses 'asthe' and the web site URL uses 'isthe' ]]
but see the BUGS file first. but see the BUGS file first.
The calc web site is located at: The calc web site is located at:
http://reality.sgi.com/chongo/tech/comp/calc/ http://www.isthe.com/chongo/tech/comp/calc/
## Copyright (C) 1999 Landon Curt Noll ## Copyright (C) 1999 Landon Curt Noll
## ##
@@ -116,12 +118,12 @@ The calc web site is located at:
## 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. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## ##
## @(#) $Revision: 29.1 $ ## @(#) $Revision: 29.2 $
## @(#) $Id: README,v 29.1 1999/12/14 09:15:29 chongo Exp $ ## @(#) $Id: README,v 29.2 2000/06/07 14:02:13 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
## File existed as early as: 1995 ## File existed as early as: 1995
## ##
## chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ ## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/

113
README.WINDOWS Normal file
View File

@@ -0,0 +1,113 @@
Dear calc user on a Windoz based system,
See the HOWTO.INSTALL file for information on how to build and install calc.
See also the README file.
NOTE: The Windoz port is extremely experimental, untested and perhaps
incomplete. We are in the process of making it easier. The
following should help anyone who is trying to make a go of this
under the current code conditions.
NOTE: We are currently ONLY making an effort to support building under
Windoz using the Cygwin project (http://sources.redhat.com/cygwin/)
with the GCC compiler and Un*x tools for Windows.
NOTE: The main developers do not have access to a Windoz based platform.
While we will make an effort to not break calc Windoz based system,
our lack of a Windoz test environment will mean we will make mistakes
from time to time. Hopefully Windowz users can overcome these mistakes.
Of course you are welcome to send us any patches that fix your
Windoz build environment.
=-=
An effort is being made to allow windows users to compile calc using the
Cygwin project (http://sources.redhat.com/cygwin/) with the GCC compiler
and Un*x tools for Windows.
The major porting work was performed by Thomas Jones-Low
(tjoneslo at softstart dot com). He said:
I had previous stated to this group that I have successfully managed
to port a version of Calc to Windows, and promised some point to
post what was required, so here it is.
One obvious manner of doing this port is to get the latest version
of the Cygwin project (http://sources.redhat.com/cygwin/) with the
GCC compiler and Un*x tools for Windows and recompile.
I built my working version using Calc ... I am using Visual C++
version 7.0, which is an older version of the Microsoft development
tools. The make file provided with Calc is not compatible with
NMAKE, so I used the Visual Studio tools to generate another one
(not included). Calc is built in two parts, calc.dll, which is the
library, and calcexe.exe which is the command line interface.
He recommends that you generate by hand all of the header files generated
by the make file:
align32.h args.h calcerr.h conf.h endian_calc.h
fposval.h have_const.h have_fpos.h have_fpos_pos.h have_malloc.h
have_memmv.h have_newstr.h have_offscl.h have_posscl.h
have_stdlib.h have_string.h have_times.h have_uid_t.h
have_unistd.h longbits.h longlong.h terminal.h
have_ustat.h have_getsid.h have_getpgid.h
have_gettime.h have_getprid.h have_urandom.h have_rusage.h
have_strdup.h
NOTE: In a future release, a tarball of these files will be shipped with
calc so that you do not have to do much other than inspect them.
=-=
People who maintain calc need to keep in mind the following:
The following was added to opcodes.h, config.h, zmath.h and value.h:
#if defined(_WIN32)
#ifdef _EXPORTING
#define DLL __declspec(dllexport)
#else
#define DLL __declspec(dllimport)
#endif
#else /* Windoz free systems */
#define DLL
#endif /* Windoz free systems */
Then DLL was added in front of all the exported functions. For example:
extern int configtype(char*);
was changed to:
DLL extern int configtype(char*);
## Copyright (C) 2001 Landon Curt Noll and Thomas Jones-Low
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License
## as published by the Free Software Foundation.
##
## Calc is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
## Public License for more details.
##
## A copy of version 2.1 of the GNU Lesser General Public License is
## distributed with calc under the filename COPYING-LGPL. You should have
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.3 $
## @(#) $Id: README.WINDOWS,v 29.3 2001/03/17 21:31:47 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/README.WINDOWS,v $
##
## Under source code control: 2001/02/25 14:00:05
## File existed as early as: 2001
##
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/

10
addop.c
View File

@@ -19,14 +19,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.3 $
* @(#) $Id: addop.c,v 29.1 1999/12/14 09:15:29 chongo Exp $ * @(#) $Id: addop.c,v 29.3 2000/07/17 15:35:49 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
* File existed as early as: before 1990 * File existed as early as: before 1990
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
@@ -208,7 +208,7 @@ endfunc(void)
memcpy((char *) fp, (char *) curfunc, size); memcpy((char *) fp, (char *) curfunc, size);
if (curfunc != functemplate) if (curfunc != functemplate)
free(curfunc); free(curfunc);
if (conf->traceflags & TRACE_FNCODES) { if (newname[0] != '*' && (conf->traceflags & TRACE_FNCODES)) {
dumpnames = TRUE; dumpnames = TRUE;
for (size = 0; size < fp->f_opcodecount; ) { for (size = 0; size < fp->f_opcodecount; ) {
printf("%ld: ", (long)size); printf("%ld: ", (long)size);
@@ -318,7 +318,7 @@ freefunc(FUNC *fp)
/*NOTREACHED*/ /*NOTREACHED*/
} }
} }
if (conf->traceflags & TRACE_FNCODES) { if (newname[0] != '*' && (conf->traceflags & TRACE_FNCODES)) {
printf("Freeing function \"%s\"\n",namestr(&funcnames,index)); printf("Freeing function \"%s\"\n",namestr(&funcnames,index));
dumpnames = FALSE; dumpnames = FALSE;
for (i = 0; i < fp->f_opcodecount; ) { for (i = 0; i < fp->f_opcodecount; ) {

View File

@@ -17,15 +17,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: align32.c,v 29.1 1999/12/14 09:15:29 chongo Exp $ * @(#) $Id: align32.c,v 29.2 2000/06/07 14:02:13 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
* File existed as early as: 1995 * File existed as early as: 1995
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: alloc.h,v 29.1 1999/12/14 09:15:29 chongo Exp $ * @(#) $Id: alloc.h,v 29.2 2000/06/07 14:02:13 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
* File existed as early as: before 1990 * File existed as early as: before 1990
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: assocfunc.c,v 29.1 1999/12/14 09:15:29 chongo Exp $ * @(#) $Id: assocfunc.c,v 29.2 2000/06/07 14:02:13 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
* File existed as early as: 1993 * File existed as early as: 1993
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -19,14 +19,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: blkcpy.c,v 29.1 1999/12/14 09:15:29 chongo Exp $ * @(#) $Id: blkcpy.c,v 29.2 2000/06/07 14:02:13 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
* File existed as early as: 1997 * File existed as early as: 1997
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -19,14 +19,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: blkcpy.h,v 29.1 1999/12/14 09:15:29 chongo Exp $ * @(#) $Id: blkcpy.h,v 29.2 2000/06/07 14:02:13 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
* File existed as early as: 1997 * File existed as early as: 1997
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -19,15 +19,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: block.c,v 29.1 1999/12/14 09:15:29 chongo Exp $ * @(#) $Id: block.c,v 29.2 2000/06/07 14:02:13 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
* File existed as early as: 1997 * File existed as early as: 1997
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -19,15 +19,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: block.h,v 29.1 1999/12/14 09:15:30 chongo Exp $ * @(#) $Id: block.h,v 29.2 2000/06/07 14:02:13 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
* File existed as early as: 1997 * File existed as early as: 1997
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -17,15 +17,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: byteswap.c,v 29.1 1999/12/14 09:15:30 chongo Exp $ * @(#) $Id: byteswap.c,v 29.2 2000/06/07 14:02:13 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
* File existed as early as: 1995 * File existed as early as: 1995
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -17,15 +17,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: byteswap.h,v 29.1 1999/12/14 09:15:30 chongo Exp $ * @(#) $Id: byteswap.h,v 29.2 2000/06/07 14:02:13 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
* File existed as early as: 1995 * File existed as early as: 1995
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -18,15 +18,15 @@
# 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. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.1 $ # @(#) $Revision: 29.3 $
# @(#) $Id: Makefile,v 29.1 1999/12/14 09:15:30 chongo Exp $ # @(#) $Id: Makefile,v 29.3 2000/12/15 14:42:52 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
# File existed as early as: 1991 # File existed as early as: 1991
# #
# chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ # chongo <was here> /\oo/\ http://www.isthe.com/chongo/
# Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ # Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
# #
# calculator by David I. Bell with help/mods from others # calculator by David I. Bell with help/mods from others
# Makefile by Landon Curt Noll # Makefile by Landon Curt Noll
@@ -70,7 +70,7 @@ CALC_FILES= README bigprime.cal deg.cal ellip.cal lucas.cal lucas_chk.cal \
test3500.cal seedrandom.cal test4000.cal test4100.cal test4600.cal \ test3500.cal seedrandom.cal test4000.cal test4100.cal test4600.cal \
beer.cal hello.cal test5100.cal test5200.cal randombitrun.cal \ beer.cal hello.cal test5100.cal test5200.cal randombitrun.cal \
randomrun.cal xx_print.cal natnumset.cal qtime.cal test8400.cal \ randomrun.cal xx_print.cal natnumset.cal qtime.cal test8400.cal \
test8500.cal test8500.cal test8600.cal
# These files are found (but not built) in the distribution # These files are found (but not built) in the distribution
# #

View File

@@ -1,7 +1,7 @@
Calc standard resource files Calc standard resource files
---------------------------- ----------------------------
To load a reosurce file, try: To load a resource file, try:
read filename read filename
@@ -37,9 +37,10 @@ be useful!
If you write something that you think is useful, please send it to: If you write something that you think is useful, please send it to:
calc-tester at postofc dot corp dot sgi dot com calc-contrib at asthe dot com
[[ Replace 'at' with @, 'dot' is with . and remove the spaces ]] [[ NOTE: Replace 'at' with @, 'dot' is with . and remove the spaces ]]
[[ NOTE: The EMail address uses 'asthe' and the web site URL uses 'isthe' ]]
By convention, a resource file only defines and/or initializes functions, By convention, a resource file only defines and/or initializes functions,
objects and variables. (The regress.cal and testxxx.cal regression test objects and variables. (The regress.cal and testxxx.cal regression test
@@ -58,7 +59,7 @@ files have already been read, the read -once will act as a noop.
The "resource_debug" parameter is intended for controlling the possible The "resource_debug" parameter is intended for controlling the possible
display of special information relating to functions, objects, and display of special information relating to functions, objects, and
other structures created by instructions in calc resoure files. other structures created by instructions in calc resource files.
Zero value of config("resource_debug") means that no such information Zero value of config("resource_debug") means that no such information
is displayed. For other values, the non-zero bits which currently is displayed. For other values, the non-zero bits which currently
have meanings are as follows: have meanings are as follows:
@@ -115,6 +116,10 @@ bernoulli.cal
Calculate the nth Bernoulli number. Calculate the nth Bernoulli number.
NOTE: There is now a bernoulli() builtin function. This file is
left here for backward compatibility and now simply returns
the buildin function.
bigprime.cal bigprime.cal
@@ -273,7 +278,7 @@ pell.cal
pell(D) pell(D)
Solve Pell's equation; Returns the solution X to: X^2 - D * Y^2 = 1. Solve Pell's equation; Returns the solution X to: X^2 - D * Y^2 = 1.
Type the solution to pells equation for a particular D. Type the solution to Pell's equation for a particular D.
pi.cal pi.cal
@@ -287,7 +292,7 @@ pi.cal
The piforever() prints digits of pi, nicely formatted, for as long The piforever() prints digits of pi, nicely formatted, for as long
as your free memory space and system up time allows. as your free memory space and system up time allows.
The piforever() funcion (written by Klaus Alexander Seistrup The piforever() function (written by Klaus Alexander Seistrup
<klaus@seistrup.dk>) was inspired by an algorithm conceived by <klaus@seistrup.dk>) was inspired by an algorithm conceived by
Lambert Meertens. See also the ABC Programmer's Handbook, by Geurts, Lambert Meertens. See also the ABC Programmer's Handbook, by Geurts,
Meertens & Pemberton, published by Prentice-Hall (UK) Ltd., 1990. Meertens & Pemberton, published by Prentice-Hall (UK) Ltd., 1990.
@@ -355,7 +360,7 @@ quat.cal
quat_shift(a, b) quat_shift(a, b)
Calculate using quaternions of the form: a + bi + cj + dk. In these Calculate using quaternions of the form: a + bi + cj + dk. In these
functions, quaternians are manipulated in the form: s + v, where functions, quaternions are manipulated in the form: s + v, where
s is a scalar and v is a vector of size 3. s is a scalar and v is a vector of size 3.
@@ -385,7 +390,7 @@ randombitrun.cal
randombitrun([run_cnt]) randombitrun([run_cnt])
Using randombit(1) to generate a sequence of random bits, determine if Using randombit(1) to generate a sequence of random bits, determine if
the number and kength of identical bits runs match what is expected. the number and length of identical bits runs match what is expected.
By default, run_cnt is to test the next 65536 random values. By default, run_cnt is to test the next 65536 random values.
This tests the Blum-Blum-Shub generator. This tests the Blum-Blum-Shub generator.
@@ -488,7 +493,7 @@ test1700.cal
value value
This resoure files is used by regress.cal to test the read and use keywords. This resource files is used by regress.cal to test the read and use keywords.
test2600.cal test2600.cal
@@ -513,7 +518,7 @@ test2600.cal
checkresult(x, y, z, a) checkresult(x, y, z, a)
test2600(verbose, tnum) test2600(verbose, tnum)
This resoure files is used by regress.cal to test some of builtin functions This resource files is used by regress.cal to test some of builtin functions
in terms of accuracy and roundoff. in terms of accuracy and roundoff.
@@ -536,7 +541,7 @@ test2700.cal
iscomsq(x) iscomsq(x)
test2700(verbose, tnum) test2700(verbose, tnum)
This resoure files is used by regress.cal to test sqrt() for real and This resource files is used by regress.cal to test sqrt() for real and
complex values. complex values.
@@ -624,7 +629,7 @@ test4000.cal
test4000(verbose, tnum) defined test4000(verbose, tnum) defined
This resource file is used by regress.cal to test ptest, nextcand and This resource file is used by regress.cal to test ptest, nextcand and
prevcand buildins. prevcand builtins.
test4100.cal test4100.cal
@@ -676,6 +681,35 @@ test5200.cal
This resource file is used by regress.cal to test the fix of a This resource file is used by regress.cal to test the fix of a
global/static bug. global/static bug.
test8400.cal
test8400() defined
This resource file is used by regress.cal to check for quit-based
memory leaks.
test8500.cal
global err_8500
global L_8500
global ver_8500
global old_seed_8500
global cfg_8500
onetest_8500(a,b,rnd) defined
divmod_8500(N, M1, M2, testnum) defined
This resource file is used by regress.cal to the // and % operators.
test8600.cal
global min_8600
global max_8600
global hash_8600
global hmean_8600
This resource file is used by regress.cal to test a change of
allowing up to 1024 args to be passed to a builtin function.
unitfrac.cal unitfrac.cal
unitfrac(x) unitfrac(x)
@@ -704,7 +738,7 @@ xx_print.cal
Demo for the xx_print object routines. Demo for the xx_print object routines.
## Copyright (C) 1999 David I. Bell and Landon Curt Noll ## Copyright (C) 2000 David I. Bell and Landon Curt Noll
## ##
## Primary author: Landon Curt Noll ## Primary author: Landon Curt Noll
## ##
@@ -722,12 +756,12 @@ xx_print.cal
## 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. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## ##
## @(#) $Revision: 29.1 $ ## @(#) $Revision: 29.4 $
## @(#) $Id: README,v 29.1 1999/12/14 09:15:30 chongo Exp $ ## @(#) $Id: README,v 29.4 2000/12/17 12:26:04 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
## File existed as early as: before 1990 ## File existed as early as: before 1990
## ##
## chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ ## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/

View File

@@ -17,15 +17,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: beer.cal,v 29.1 1999/12/14 09:15:30 chongo Exp $ * @(#) $Id: beer.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1996 * File existed as early as: 1996
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -1,7 +1,7 @@
/* /*
* bernoulli - clculate the Nth Bernoulli number B(n) * bernoulli - clculate the Nth Bernoulli number B(n)
* *
* Copyright (C) 1999 David I. Bell * Copyright (C) 2000 David I. Bell 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
@@ -17,24 +17,28 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.3 $
* @(#) $Id: bernoulli.cal,v 29.1 1999/12/14 09:15:30 chongo Exp $ * @(#) $Id: bernoulli.cal,v 29.3 2000/12/17 12:26:04 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
* File existed as early as: 1991 * File existed as early as: 1991
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*
* Calculate the Nth Bernoulli number B(n). * Calculate the Nth Bernoulli number B(n).
* This uses the following symbolic formula to calculate B(n): *
* NOTE: This is now a bulitin function.
*
* The non-buildin code used the following symbolic formula to calculate B(n):
* *
* (b+1)^(n+1) - b^(n+1) = 0 * (b+1)^(n+1) - b^(n+1) = 0
* *
* where b is a dummy value, and each power b^i gets replaced by B(i). * where b is a dummy value, and each power b^i gets replaced by B(i).
* For example, for n = 3: * For example, for n = 3:
*
* (b+1)^4 - b^4 = 0 * (b+1)^4 - b^4 = 0
* b^4 + 4*b^3 + 6*b^2 + 4*b + 1 - b^4 = 0 * b^4 + 4*b^3 + 6*b^2 + 4*b + 1 - b^4 = 0
* 4*b^3 + 6*b^2 + 4*b + 1 = 0 * 4*b^3 + 6*b^2 + 4*b + 1 = 0
@@ -48,11 +52,14 @@
*/ */
/*
static Bnmax; static Bnmax;
static mat Bn[1001]; static mat Bn[1001];
*/
define B(n) define B(n)
{ {
/*
local nn, np1, i, sum, mulval, divval, combval; local nn, np1, i, sum, mulval, divval, combval;
if (!isint(n) || (n < 0)) if (!isint(n) || (n < 0))
@@ -85,4 +92,6 @@ define B(n)
} }
Bnmax = n; Bnmax = n;
return Bn[n]; return Bn[n];
*/
return bernoulli(n);
} }

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: bigprime.cal,v 29.1 1999/12/14 09:15:30 chongo Exp $ * @(#) $Id: bigprime.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1991 * File existed as early as: 1991
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -16,14 +16,14 @@
# 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. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.1 $ # @(#) $Revision: 29.2 $
# @(#) $Id: bindings,v 29.1 1999/12/14 09:15:30 chongo Exp $ # @(#) $Id: bindings,v 29.2 2000/06/07 14:02:25 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
# File existed as early as: 1993 # File existed as early as: 1993
# #
# Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ # Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
# NOTE: This facility is ignored if calc was compiled with GNU-readline. # NOTE: This facility is ignored if calc was compiled with GNU-readline.
# In that case, the standard readline mechanisms (see readline(3)) # In that case, the standard readline mechanisms (see readline(3))

View File

@@ -19,14 +19,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: chrem.cal,v 29.1 1999/12/14 09:15:31 chongo Exp $ * @(#) $Id: chrem.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1992 * File existed as early as: 1992
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: deg.cal,v 29.1 1999/12/14 09:15:31 chongo Exp $ * @(#) $Id: deg.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: before 1990 * File existed as early as: before 1990
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: ellip.cal,v 29.1 1999/12/14 09:15:31 chongo Exp $ * @(#) $Id: ellip.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: before 1990 * File existed as early as: before 1990
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,15 +17,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: hello.cal,v 29.1 1999/12/14 09:15:31 chongo Exp $ * @(#) $Id: hello.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1996 * File existed as early as: 1996
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,15 +17,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: lucas.cal,v 29.1 1999/12/14 09:15:31 chongo Exp $ * @(#) $Id: lucas.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1990 * File existed as early as: 1990
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,15 +17,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: lucas_chk.cal,v 29.1 1999/12/14 09:15:31 chongo Exp $ * @(#) $Id: lucas_chk.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1991 * File existed as early as: 1991
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,15 +17,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: lucas_tbl.cal,v 29.1 1999/12/14 09:15:31 chongo Exp $ * @(#) $Id: lucas_tbl.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1991 * File existed as early as: 1991
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -19,14 +19,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: mersenne.cal,v 29.1 1999/12/14 09:15:31 chongo Exp $ * @(#) $Id: mersenne.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1991 * File existed as early as: 1991
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,15 +17,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: mfactor.cal,v 29.1 1999/12/14 09:15:31 chongo Exp $ * @(#) $Id: mfactor.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1996 * File existed as early as: 1996
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: mod.cal,v 29.1 1999/12/14 09:15:31 chongo Exp $ * @(#) $Id: mod.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: before 1990 * File existed as early as: before 1990
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: natnumset.cal,v 29.1 1999/12/14 09:15:31 chongo Exp $ * @(#) $Id: natnumset.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1997 * File existed as early as: 1997
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: pell.cal,v 29.1 1999/12/14 09:15:31 chongo Exp $ * @(#) $Id: pell.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: before 1990 * File existed as early as: before 1990
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: pi.cal,v 29.1 1999/12/14 09:15:31 chongo Exp $ * @(#) $Id: pi.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1991 * File existed as early as: 1991
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,15 +17,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: pix.cal,v 29.1 1999/12/14 09:15:31 chongo Exp $ * @(#) $Id: pix.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1996 * File existed as early as: 1996
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: pollard.cal,v 29.1 1999/12/14 09:15:31 chongo Exp $ * @(#) $Id: pollard.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1991 * File existed as early as: 1991
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: poly.cal,v 29.1 1999/12/14 09:15:31 chongo Exp $ * @(#) $Id: poly.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: before 1990 * File existed as early as: before 1990
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: prompt.cal,v 29.1 1999/12/14 09:15:32 chongo Exp $ * @(#) $Id: prompt.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1995 * File existed as early as: 1995
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: psqrt.cal,v 29.1 1999/12/14 09:15:32 chongo Exp $ * @(#) $Id: psqrt.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: before 1990 * File existed as early as: before 1990
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -1,24 +1,46 @@
/* /*
* qtime - Display time as English sentence * qtime - Display time as English sentence
* *
* Copyright (C) 1999 Klaus Alexander Seistrup and Landon Curt Noll
*
* Written by: Klaus Alexander Seistrup <kseis@magnetic-ink.dk>
* With mods by: Landon Curt Noll <http://www.isthe.com/chongo/>
*
* Calc is open software; you can redistribute it and/or modify it under
* the terms of the version 2.1 of the GNU Lesser General Public License
* as published by the Free Software Foundation.
*
* Calc is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
* Public License for more details.
*
* A copy of version 2.1 of the GNU Lesser General Public License is
* distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.4 $
* @(#) $Id: qtime.cal,v 29.4 2000/12/18 10:18:40 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/qtime.cal,v $
*
* Under source code control: 1999/10/13 04:10:33
* File existed as early as: 1999
*
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/
/*
* usage: * usage:
* qtime(utc_hr_offset) * qtime(utc_hr_offset)
* *
* utc_hr_offset Offset from UTC in hours. * utc_hr_offset Offset from UTC in hours.
* *
* Written by: Klaus Alexander Seistrup <kseis@magnetic-ink.dk>
* With minor mods by: Landon Curt Noll <http://reality.sgi.com/chongo/>
*
* See: * See:
* http://www.magnetic-ink.dk/download/qtime.html * http://www.magnetic-ink.dk/download/qtime.html
* *
* for examples of qtime() written on other languages. * for examples of qtime() written on other languages.
*
* @(#) $Revision: 29.1 $
* @(#) $Id: qtime.cal,v 29.1 1999/12/14 09:15:32 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/qtime.cal,v $
*
* This file is not covered under version 2.1 of the GNU LGPL.
*/ */

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: quat.cal,v 29.1 1999/12/14 09:15:32 chongo Exp $ * @(#) $Id: quat.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: before 1990 * File existed as early as: before 1990
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,15 +17,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: randbitrun.cal,v 29.1 1999/12/14 09:15:32 chongo Exp $ * @(#) $Id: randbitrun.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1995 * File existed as early as: 1995
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,15 +17,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: randmprime.cal,v 29.1 1999/12/14 09:15:32 chongo Exp $ * @(#) $Id: randmprime.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1994 * File existed as early as: 1994
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -17,15 +17,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: randombitrun.cal,v 29.1 1999/12/14 09:15:32 chongo Exp $ * @(#) $Id: randombitrun.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1995 * File existed as early as: 1995
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,15 +17,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: randomrun.cal,v 29.1 1999/12/14 09:15:32 chongo Exp $ * @(#) $Id: randomrun.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1997 * File existed as early as: 1997
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: randrun.cal,v 29.1 1999/12/14 09:15:32 chongo Exp $ * @(#) $Id: randrun.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1995 * File existed as early as: 1995
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.6 $
* @(#) $Id: regress.cal,v 29.1 1999/12/14 09:15:32 chongo Exp $ * @(#) $Id: regress.cal,v 29.6 2000/12/17 12:26:42 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
* File existed as early as: before 1990 * File existed as early as: before 1990
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*
@@ -755,7 +755,7 @@ define test_functions()
vrfy(den(17) == 1, '712: den(17) == 1'); vrfy(den(17) == 1, '712: den(17) == 1');
vrfy(den(3/7) == 7, '713: den(3/7) == 7'); vrfy(den(3/7) == 7, '713: den(3/7) == 7');
vrfy(den(-2/3) == 3, '714: den(-2/3) == 3'); vrfy(den(-2/3) == 3, '714: den(-2/3) == 3');
vrfy(digits(0) == 1, '715: digits(0) == 1'); vrfy(digits(0) == 0, '715: digits(0) == 0');
vrfy(digits(9) == 1, '716: digits(9) == 1'); vrfy(digits(9) == 1, '716: digits(9) == 1');
vrfy(digits(10) == 2, '717: digits(10) == 2'); vrfy(digits(10) == 2, '717: digits(10) == 2');
vrfy(digits(-691) == 3, '718: digits(-691) == 3'); vrfy(digits(-691) == 3, '718: digits(-691) == 3');
@@ -1029,8 +1029,8 @@ define test_functions()
vrfy(digit(a,-1) == 4, '974: digit(a,-1) == 4'); vrfy(digit(a,-1) == 4, '974: digit(a,-1) == 4');
vrfy(digit(a,-2) == 2, '975: digit(a,-2) == 2'); vrfy(digit(a,-2) == 2, '975: digit(a,-2) == 2');
vrfy(digit(a,-3) == 8, '976: digit(a,-3) == 8'); vrfy(digit(a,-3) == 8, '976: digit(a,-3) == 8');
vrfy(digits(0) == 1, '977: digits(0) == 1'); vrfy(digits(0) == 0, '977: digits(0) == 0');
vrfy(digits(0.0123) == 1, '978: digits(0.0123) == 1'); vrfy(digits(0.0123) == 0, '978: digits(0.0123) == 0');
vrfy(digits(3.7) == 1, '979: digits(3.7) == 1'); vrfy(digits(3.7) == 1, '979: digits(3.7) == 1');
vrfy(digits(-27) == 2, '980: digits(-27) == 2'); vrfy(digits(-27) == 2, '980: digits(-27) == 2');
vrfy(digits(-99.7) == 2, '981: digits(-99.7) == 2'); vrfy(digits(-99.7) == 2, '981: digits(-99.7) == 2');
@@ -1223,7 +1223,85 @@ define test_functions()
vrfy(hnrmod(21<<500+7,3,500,-1) == (21<<500+7)%(3<<500-1), vrfy(hnrmod(21<<500+7,3,500,-1) == (21<<500+7)%(3<<500-1),
'1112: hnrmod(21<<500+7,3,500,-1) == (21<<500+7)%(3<<500-1)'); '1112: hnrmod(21<<500+7,3,500,-1) == (21<<500+7)%(3<<500-1)');
print '1113: Ending test_functions'; /*
* catalan testing
*/
vrfy(catalan(2) == 2, '1113: catalan(2) == 2');
vrfy(catalan(3) == 5, '1114: catalan(3) == 5');
vrfy(catalan(4) == 14, '1115: catalan(4) == 14');
vrfy(catalan(20) == 6564120420, '1116: catalan(20) == 6564120420');
/*
* bernoulli builtin function testing
*/
vrfy(bernoulli(0) == 1, '1117: bernoulli(0) == 1');
vrfy(bernoulli(1) == -1/2, '1118: bernoulli(1) == -1/2');
vrfy(bernoulli(2) == 1/6, '1119: bernoulli(2) == 1/6');
vrfy(bernoulli(3) == 0, '1120: bernoulli(3) == 0');
vrfy(bernoulli(4) == -1/30, '1121: bernoulli(4) == -1/30');
vrfy(bernoulli(5) == 0, '1122: bernoulli(5) == 0');
vrfy(bernoulli(6) == 1/42, '1123: bernoulli(6) == 1/42');
vrfy(bernoulli(32) == -7709321041217/510,
'1124: bernoulli(32) == -7709321041217/510');
/*
* euler function testing
*/
vrfy(euler(0) == 1, '1125: euler(0) == 1');
vrfy(euler(1) == 0, '1126: euler(1) == 0');
vrfy(euler(2) == -1, '1127: euler(2) == -1');
vrfy(euler(3) == 0, '1128: euler(3) == 0');
vrfy(freeeuler() == null(), '1129: freeeuler() == null()');
vrfy(euler(4) == 5, '1130: euler(4) == 5');
vrfy(euler(5) == 0, '1131: euler(5) == 0');
vrfy(euler(6) == -61, '1132: euler(6) == -61');
vrfy(euler(32) == 177519391579539289436664789665,
'1130: euler(32) == 177519391579539289436664789665');
vrfy(freeeuler() == null(), '1133: freeeuler() == null()');
/*
* digit with non-10 base
*/
a = 123456.789;
print '1134: a = 123456.789';
vrfy(digit(a, 6, 100) == 0, '1135: digit(a, 6, 100) == 0');
vrfy(digit(a, 5, 100) == 0, '1136: digit(a, 5, 100) == 0');
vrfy(digit(a, 4, 100) == 0, '1137: digit(a, 4, 100) == 0');
vrfy(digit(a, 3, 100) == 0, '1138: digit(a, 3, 100) == 0');
vrfy(digit(a, 2, 100) == 12, '1139: digit(a, 2, 100) == 12');
vrfy(digit(a, 1, 100) == 34, '1140: digit(a, 1, 100) == 34');
vrfy(digit(a, 0, 100) == 56, '1141: digit(a, 0, 100) == 56');
vrfy(digit(a, -1, 100) == 78, '1142: digit(a, -1, 100) == 78');
vrfy(digit(a, -2, 100) == 90, '1143: digit(a, -2, 100) == 90');
vrfy(digit(a, -3, 100) == 0, '1144: digit(a, -3, 100) == 0');
vrfy(digit(a, -4, 100) == 0, '1145: digit(a, -4, 100) == 0');
vrfy(digit(a, -5, 100) == 0, '1146: digit(a, -5, 100) == 0');
vrfy(digit(a, -6, 100) == 0, '1146: digit(a, -6, 100) == 0');
/*
* digits with a non-10 base
*/
vrfy(digits(a, 100) == 3, '1147: digits(a, 100) == 3');
vrfy(digits(2^256-1, 256) == 32,'1148: digits(2^256-1, 256) == 32');
/*
* places with a non-10 base
*/
vrfy(places(0.0123, 2) == -1, '1149: places(0.0123, 2) == -1');
vrfy(places(0.625, 2) == 3, '1150: places(0.625, 2) == 3');
vrfy(places(0.625, 8) == 1, '1151: places(0.625, 8) == 1');
vrfy(places(171/2^712, 2) == 712,
'1152: places(171/2^7120.625, 2) == 712');
vrfy(places(171/2^712, 64) == 119,
'1152: places(171/2^7120.625, 64) == 119');
/*
* verify sleep
*/
vrfy(sleep(1/5) == null(), '1153: sleep(1/5) == null()');
vrfy(sleep(1) == null(), '1154: sleep(1) == null()');
print '1155: Ending test_functions';
} }
print '017: parsed test_functions()'; print '017: parsed test_functions()';
@@ -2987,7 +3065,7 @@ define test_error()
vrfy(root(3,2,0) == error(10029), vrfy(root(3,2,0) == error(10029),
'3644: root(3,2,0) == error(10029)'); '3644: root(3,2,0) == error(10029)');
vrfy(norm("x") == error(10030), '3645: norm("x") == error(10030)'); vrfy(norm("x") == error(10030), '3645: norm("x") == error(10030)');
vrfy(null() << 2 == error(10031),'3646: null() << 2 == error(10031)'); vrfy(list() << 2 == error(10031),'3646: list() << 2 == error(10031)');
vrfy(1.5 << 2 == error(10031), '3647: 1.5 << 2 == error(10031)'); vrfy(1.5 << 2 == error(10031), '3647: 1.5 << 2 == error(10031)');
vrfy(3 << "x" == error(10032), '3648: 3 << "x" == error(10032)'); vrfy(3 << "x" == error(10032), '3648: 3 << "x" == error(10032)');
vrfy(3 << 1.5 == error(10032), '3649: 3 << 1.5 == error(10032)'); vrfy(3 << 1.5 == error(10032), '3649: 3 << 1.5 == error(10032)');
@@ -3085,8 +3163,7 @@ define test_error()
print '3712: e9999 = error(9999)'; print '3712: e9999 = error(9999)';
vrfy(errno() == 9999, '3713: errno() == 9999'); vrfy(errno() == 9999, '3713: errno() == 9999');
vrfy(error() == e9999, '3714: error() == e9999'); vrfy(error() == e9999, '3714: error() == e9999');
vrfy(substr(strerror(), strpos(strerror(),"9999"), 4) == "9999", /* test 3715 removed due to non-portable strerror() output */
'3715: substr(strerror(), strpos(strerror(),"9999"), 4) == "9999"');
x = newerror("Alpha"); x = newerror("Alpha");
print '3716: x = newerror("Alpha")'; print '3716: x = newerror("Alpha")';
n = iserror(x); n = iserror(x);
@@ -3097,16 +3174,14 @@ define test_error()
vrfy(errno(9999) == n, '3721: errno() == n'); vrfy(errno(9999) == n, '3721: errno() == n');
vrfy(errno() == 9999, '3722: errno() == 9999'); vrfy(errno() == 9999, '3722: errno() == 9999');
vrfy(error() == e9999, '3723: error() == e9999'); vrfy(error() == e9999, '3723: error() == e9999');
vrfy(substr(strerror(), strpos(strerror(),"9999"), 4) == "9999", /* test 3724 removed due to non-portable strerror() output */
'3724: substr(strerror(), strpos(strerror(),"9999"), 4) == "9999"');
a = 1/0; a = 1/0;
print '3725: a = 1/0'; print '3725: a = 1/0';
vrfy(strerror() == "Division by zero", vrfy(strerror() == "Division by zero",
'3726: strerror() == "Division by zero"'); '3726: strerror() == "Division by zero"');
n = 8191; n = 8191;
print '3727: n = 8191'; print '3727: n = 8191';
vrfy(substr(strerror(8191),strpos(strerror(n),"8191"), 4) == "8191", /* test 3728 removed due to non-portable strerror() output */
'3728: substr(strerror(n),strpos(strerror(n),"8191"),4) == "8191"');
/* errmax and errcount should be bumped up the 148 errors above */ /* errmax and errcount should be bumped up the 148 errors above */
vrfy(errcount() == ecnt, '3729: errcount() == ecnt'); vrfy(errcount() == ecnt, '3729: errcount() == ecnt');
@@ -7541,6 +7616,15 @@ read -once "test8500";
/* 85xx: Ending test_divmod is printed by test8500.cal */ /* 85xx: Ending test_divmod is printed by test8500.cal */
/*
* test_maxargs - test up to 1024 args being passed to a builtin function
*/
print;
print '8600: Starting test_1024args'
read -once "test8600";
/* 86xx: Ending test_1024args is printed by test8600.cal */
/* /*
* read various calc resource files * read various calc resource files
* *

View File

@@ -17,15 +17,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: seedrandom.cal,v 29.1 1999/12/14 09:15:33 chongo Exp $ * @(#) $Id: seedrandom.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1996 * File existed as early as: 1996
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: solve.cal,v 29.1 1999/12/14 09:15:33 chongo Exp $ * @(#) $Id: solve.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: before 1990 * File existed as early as: before 1990
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: sumsq.cal,v 29.1 1999/12/14 09:15:33 chongo Exp $ * @(#) $Id: sumsq.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: before 1990 * File existed as early as: before 1990
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: surd.cal,v 29.1 1999/12/14 09:15:33 chongo Exp $ * @(#) $Id: surd.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: before 1990 * File existed as early as: before 1990
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -17,15 +17,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: test1700.cal,v 29.1 1999/12/14 09:15:33 chongo Exp $ * @(#) $Id: test1700.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1994 * File existed as early as: 1994
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -17,15 +17,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: test2300.cal,v 29.1 1999/12/14 09:15:33 chongo Exp $ * @(#) $Id: test2300.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1995 * File existed as early as: 1995
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -19,14 +19,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: test2600.cal,v 29.1 1999/12/14 09:15:33 chongo Exp $ * @(#) $Id: test2600.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1995 * File existed as early as: 1995
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -19,14 +19,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: test2700.cal,v 29.1 1999/12/14 09:15:33 chongo Exp $ * @(#) $Id: test2700.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1995 * File existed as early as: 1995
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -19,14 +19,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: test3100.cal,v 29.1 1999/12/14 09:15:33 chongo Exp $ * @(#) $Id: test3100.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1995 * File existed as early as: 1995
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -19,14 +19,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: test3300.cal,v 29.1 1999/12/14 09:15:33 chongo Exp $ * @(#) $Id: test3300.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1995 * File existed as early as: 1995
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -19,14 +19,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: test3400.cal,v 29.1 1999/12/14 09:15:34 chongo Exp $ * @(#) $Id: test3400.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1995 * File existed as early as: 1995
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -19,14 +19,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: test3500.cal,v 29.1 1999/12/14 09:15:34 chongo Exp $ * @(#) $Id: test3500.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1995 * File existed as early as: 1995
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -19,14 +19,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: test4000.cal,v 29.1 1999/12/14 09:15:34 chongo Exp $ * @(#) $Id: test4000.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1996 * File existed as early as: 1996
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -19,14 +19,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: test4100.cal,v 29.1 1999/12/14 09:15:34 chongo Exp $ * @(#) $Id: test4100.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1996 * File existed as early as: 1996
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -19,14 +19,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: test4600.cal,v 29.1 1999/12/14 09:15:34 chongo Exp $ * @(#) $Id: test4600.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1996 * File existed as early as: 1996
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -19,14 +19,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: test5100.cal,v 29.1 1999/12/14 09:15:34 chongo Exp $ * @(#) $Id: test5100.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1996 * File existed as early as: 1996
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -19,14 +19,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: test5200.cal,v 29.1 1999/12/14 09:15:34 chongo Exp $ * @(#) $Id: test5200.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1997 * File existed as early as: 1997
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -17,15 +17,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: test8400.cal,v 29.1 1999/12/14 09:15:34 chongo Exp $ * @(#) $Id: test8400.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1999 * File existed as early as: 1999
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -19,14 +19,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: test8500.cal,v 29.1 1999/12/14 09:15:34 chongo Exp $ * @(#) $Id: test8500.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1999 * File existed as early as: 1999
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

1406
cal/test8600.cal Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: unitfrac.cal,v 29.1 1999/12/14 09:15:34 chongo Exp $ * @(#) $Id: unitfrac.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: before 1990 * File existed as early as: before 1990
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: varargs.cal,v 29.1 1999/12/14 09:15:34 chongo Exp $ * @(#) $Id: varargs.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1991 * File existed as early as: 1991
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: xx_print.cal,v 29.1 1999/12/14 09:15:34 chongo Exp $ * @(#) $Id: xx_print.cal,v 29.2 2000/06/07 14:02:25 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
* File existed as early as: 1997 * File existed as early as: 1997
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

919
calc.c

File diff suppressed because it is too large Load Diff

253
calc.h
View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 29.6 $
* @(#) $Id: calc.h,v 29.2 1999/12/14 19:37:46 chongo Exp $ * @(#) $Id: calc.h,v 29.6 2001/03/17 21:31:47 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
* File existed as early as: before 1990 * File existed as early as: before 1990
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
@@ -32,9 +32,8 @@
#define __CALC_H__ #define __CALC_H__
#include <setjmp.h> #include <setjmp.h>
#include "win32dll.h"
#include "value.h" #include "value.h"
#include "have_const.h" #include "have_const.h"
@@ -60,10 +59,9 @@
#define MAXERROR 512 /* maximum length of error message string */ #define MAXERROR 512 /* maximum length of error message string */
#define SYMBOLSIZE 256 /* maximum symbol name size */ #define SYMBOLSIZE 256 /* maximum symbol name size */
#define MAXINDICES 20 /* maximum number of indices for objects */
#define MAXLABELS 100 /* maximum number of user labels in function */ #define MAXLABELS 100 /* maximum number of user labels in function */
#define MAXSTRING 1024 /* maximum size of string constant */ #define MAXSTRING 1024 /* maximum size of string constant */
#define MAXSTACK 1000 /* maximum depth of evaluation stack */ #define MAXSTACK 2048 /* maximum depth of evaluation stack */
#define MAXFILES 20 /* maximum number of opened files */ #define MAXFILES 20 /* maximum number of opened files */
#define PROMPT1 "> " /* default normal prompt*/ #define PROMPT1 "> " /* default normal prompt*/
#define PROMPT2 ">> " /* default prompt inside multi-line input */ #define PROMPT2 ">> " /* default prompt inside multi-line input */
@@ -95,152 +93,157 @@
/* /*
* File I/O routines. * File I/O routines.
*/ */
extern FILEID openid(char *name, char *mode); extern DLL FILEID openid(char *name, char *mode);
extern FILEID indexid(long index); extern DLL FILEID indexid(long index);
extern BOOL validid(FILEID id); extern DLL BOOL validid(FILEID id);
extern BOOL errorid(FILEID id); extern DLL BOOL errorid(FILEID id);
extern BOOL eofid(FILEID id); extern DLL BOOL eofid(FILEID id);
extern int closeid(FILEID id); extern DLL int closeid(FILEID id);
extern int getcharid(FILEID id); extern DLL int getcharid(FILEID id);
extern int idprintf(FILEID id, char *fmt, int count, VALUE **vals); extern DLL int idprintf(FILEID id, char *fmt, int count, VALUE **vals);
extern int idfputc(FILEID id, int ch); extern DLL int idfputc(FILEID id, int ch);
extern int idfputs(FILEID id, char *str); extern DLL int idfputs(FILEID id, char *str);
extern int printid(FILEID id, int flags); extern DLL int printid(FILEID id, int flags);
extern int flushid(FILEID id); extern DLL int flushid(FILEID id);
extern int readid(FILEID id, int flags, char **retptr); extern DLL int readid(FILEID id, int flags, char **retptr);
extern int getloc(FILEID id, ZVALUE *loc); extern DLL int getloc(FILEID id, ZVALUE *loc);
extern int setloc(FILEID id, ZVALUE zpos); extern DLL int setloc(FILEID id, ZVALUE zpos);
extern int getsize(FILEID id, ZVALUE *size); extern DLL int getsize(FILEID id, ZVALUE *size);
extern int get_device(FILEID id, ZVALUE *dev); extern DLL int get_device(FILEID id, ZVALUE *dev);
extern int get_inode(FILEID id, ZVALUE *ino); extern DLL int get_inode(FILEID id, ZVALUE *ino);
extern FILEID reopenid(FILEID id, char *mode, char *name); extern DLL FILEID reopenid(FILEID id, char *mode, char *name);
extern int closeall(void); extern DLL int closeall(void);
extern int flushall(void);
extern int idfputstr(FILEID id, char *str); #if !defined(_WIN32)
extern int rewindid(FILEID id); extern DLL int flushall(void);
extern void rewindall(void); #endif
extern ZVALUE zfilesize(FILEID id);
extern void showfiles(void); extern DLL int idfputstr(FILEID id, char *str);
extern int fscanfid(FILEID id, char *fmt, int count, VALUE **vals); extern DLL int rewindid(FILEID id);
extern int scanfstr(char *str, char *fmt, int count, VALUE **vals); extern DLL void rewindall(void);
extern int ftellid(FILEID id, ZVALUE *res); extern DLL ZVALUE zfilesize(FILEID id);
extern int fseekid(FILEID id, ZVALUE offset, int whence); extern DLL void showfiles(void);
extern int isattyid(FILEID id); extern DLL int fscanfid(FILEID id, char *fmt, int count, VALUE **vals);
extern int fsearch(FILEID id, char *str, ZVALUE start, ZVALUE end, ZVALUE *res); extern DLL int scanfstr(char *str, char *fmt, int count, VALUE **vals);
extern int frsearch(FILEID id, char *str, ZVALUE first, ZVALUE last, ZVALUE *res); extern DLL int ftellid(FILEID id, ZVALUE *res);
extern void showconstants(void); extern DLL int fseekid(FILEID id, ZVALUE offset, int whence);
extern void freeconstant(unsigned long); extern DLL int isattyid(FILEID id);
extern void freestringconstant(long); extern DLL int fsearch(FILEID id, char *str, ZVALUE start, ZVALUE end, ZVALUE *res);
extern void trimconstants(void); extern DLL int frsearch(FILEID id, char *str, ZVALUE first, ZVALUE last, ZVALUE *res);
extern DLL void showconstants(void);
extern DLL void freeconstant(unsigned long);
extern DLL void freestringconstant(long);
extern DLL void trimconstants(void);
/* /*
* Input routines. * Input routines.
*/ */
extern int openstring(char *str, long num); extern DLL int openstring(char *str, long num);
extern int openterminal(void); extern DLL int openterminal(void);
extern int opensearchfile(char *name, char *pathlist, char *exten, int reopen_ok); extern DLL int opensearchfile(char *name, char *pathlist, char *exten, int reopen_ok);
extern char *nextline(void); extern DLL char *nextline(void);
extern int nextchar(void); extern DLL int nextchar(void);
extern void reread(void); extern DLL void reread(void);
extern void resetinput(void); extern DLL void resetinput(void);
extern void setprompt(char *); extern DLL void setprompt(char *);
extern BOOL inputisterminal(void); extern DLL BOOL inputisterminal(void);
extern int inputlevel(void); extern DLL int inputlevel(void);
extern long calclevel(void); extern DLL long calclevel(void);
extern char *inputname(void); extern DLL char *inputname(void);
extern long linenumber(void); extern DLL long linenumber(void);
extern void runrcfiles(void); extern DLL void runrcfiles(void);
extern void closeinput(void); extern DLL void closeinput(void);
/* /*
* Other routines. * Other routines.
*/ */
extern NUMBER *constvalue(unsigned long index); extern DLL NUMBER *constvalue(unsigned long index);
extern long addnumber(char *str); extern DLL long addnumber(char *str);
extern long addqconstant(NUMBER *q); extern DLL long addqconstant(NUMBER *q);
extern void initstack(void); extern DLL void initstack(void);
extern void getcommands(BOOL toplevel); extern DLL void getcommands(BOOL toplevel);
extern void givehelp(char *type); extern DLL void givehelp(char *type);
extern void libcalc_call_me_first(void); extern DLL void libcalc_call_me_first(void);
extern void libcalc_call_me_last(void); extern DLL void libcalc_call_me_last(void);
extern BOOL calc_tty(int fd); extern DLL BOOL calc_tty(int fd);
extern BOOL orig_tty(int fd); extern DLL BOOL orig_tty(int fd);
extern void showerrors(void); extern DLL void showerrors(void);
extern char *calc_strdup(CONST char *); extern DLL char *calc_strdup(CONST char *);
extern void getshellfile(char *shellfile);
/* /*
* Initialization * Initialization
*/ */
extern void initialize(void); extern DLL void initialize(void);
extern void reinitialize(void); extern DLL void reinitialize(void);
extern int isatty(int tty); /* TRUE if fd is a tty */ #if !defined (_WIN32)
extern char *version(void); /* return version string */ extern DLL int isatty(int tty); /* TRUE if fd is a tty */
extern int post_init; /* TRUE => setjmp for math_error is ready */ #endif
extern DLL char *version(void); /* return version string */
extern DLL 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 DLL int abortlevel; /* current level of aborts */
extern BOOL inputwait; /* TRUE if in a terminal input wait */ extern DLL BOOL inputwait; /* TRUE if in a terminal input wait */
extern jmp_buf jmpbuf; /* for errors */ extern DLL jmp_buf jmpbuf; /* for errors */
extern int p_flag; /* TRUE => pipe mode */ extern DLL int p_flag; /* TRUE => pipe mode */
extern int q_flag; /* TRUE => don't execute rc files */ extern DLL int q_flag; /* TRUE => don't execute rc files */
extern int u_flag; /* TRUE => unbuffer stdin and stdout */ extern DLL int u_flag; /* TRUE => unbuffer stdin and stdout */
extern int d_flag; /* TRUE => disable heading, resource_debug */ extern DLL int d_flag; /* TRUE => disable heading, resource_debug */
extern int c_flag; /* TRUE => continue after error if permitted */ extern DLL int c_flag; /* TRUE => continue after error if permitted */
extern int i_flag; /* TRUE => try to go interactive after error */ extern DLL int i_flag; /* TRUE => try to go interactive after error */
extern int s_flag; /* TRUE => keep args as strings for argv() */ extern DLL int s_flag; /* TRUE => keep args as strings for argv() */
extern int stoponerror; /* >0 => stop, <0 => continue, ==0 => use -c */ extern DLL int stoponerror; /* >0 => stop, <0 => continue, ==0 => use -c */
extern BOOL abort_now; /* TRUE => try to go interactive */ extern DLL BOOL abort_now; /* TRUE => try to go interactive */
extern int argc_value; /* count of argv[] strings for argv() builtin */ extern DLL int argc_value; /* count of argv[] strings for argv() builtin */
extern char **argv_value; /* argv[] strings for argv() builtin */ extern DLL char **argv_value; /* argv[] strings for argv() builtin */
extern char *pager; /* $PAGER or default */ extern DLL char *pager; /* $PAGER or default */
extern int stdin_tty; /* TRUE if stdin is a tty */ extern DLL int stdin_tty; /* TRUE if stdin is a tty */
extern int havecommands; /* TRUE if have cmd args) */ extern DLL int havecommands; /* TRUE if have cmd args) */
extern char *program; /* our name */ extern DLL char *program; /* our name */
extern char *base_name; /* basename of our name */ extern DLL char *base_name; /* basename of our name */
extern char cmdbuf[]; /* command line expression */ extern DLL char cmdbuf[]; /* command line expression */
extern int abortlevel; /* current level of aborts */ extern DLL int abortlevel; /* current level of aborts */
extern BOOL inputwait; /* TRUE if in a terminal input wait */ extern DLL BOOL inputwait; /* TRUE if in a terminal input wait */
extern VALUE *stack; /* execution stack */ extern DLL VALUE *stack; /* execution stack */
extern int dumpnames; /* TRUE => dump names rather than indices */ extern DLL int dumpnames; /* TRUE => dump names rather than indices */
extern char *calcpath; /* $CALCPATH or default */ extern DLL char *calcpath; /* $CALCPATH or default */
extern char *calcrc; /* $CALCRC or default */ extern DLL char *calcrc; /* $CALCRC or default */
extern char *calcbindings; /* $CALCBINDINGS or default */ extern DLL char *calcbindings; /* $CALCBINDINGS or default */
extern char *home; /* $HOME or default */ extern DLL char *home; /* $HOME or default */
extern char *shell; /* $SHELL or default */ extern DLL char *shell; /* $SHELL or default */
extern char *program; /* our name (argv[0]) */ extern DLL char *program; /* our name (argv[0]) */
extern int no_env; /* TRUE (-e) => ignore env vars on startup */ extern DLL int no_env; /* TRUE (-e) => ignore env vars on startup */
extern int errmax; /* if >= 0, error when errcount exceeds errmax */ extern DLL int errmax; /* if >= 0, error when errcount exceeds errmax */
extern int new_std; /* TRUE (-n) => use newstd configuration */ extern DLL int new_std; /* TRUE (-n) => use newstd configuration */
extern int allow_read; /* FALSE => may not open any files for reading */ extern DLL int allow_read; /* FALSE => dont open any files for reading */
extern int allow_write; /* FALSE => may not open any files for writing */ extern DLL int allow_write; /* FALSE => dont open any files for writing */
extern int allow_exec; /* FALSE => may not execute any commands */ extern DLL int allow_exec; /* FALSE => may not execute any commands */
/* /*
* calc startup and run state * calc startup and run state
*/ */
typedef enum { typedef enum {
RUN_UNKNOWN = -1, /* unknown or unset start state */ RUN_ZERO, /* unknown or unset start state */
RUN_BEGIN = 0, /* calc execution starts */ RUN_BEGIN, /* calc execution starts */
RUN_RCFILES = 1, /* rc files being evaluated */ RUN_RCFILES, /* rc files being evaluated */
RUN_PRE_CMD_ARGS = 2, /* prepare to evaluate cmd args */ RUN_PRE_CMD_ARGS, /* prepare to evaluate cmd args */
RUN_CMD_ARGS = 3, /* cmd args being evaluated */ RUN_CMD_ARGS, /* cmd args being evaluated */
RUN_PRE_TOP_LEVEL = 4, /* prepare to start top level activity */ RUN_PRE_TOP_LEVEL, /* prepare to start top level activity */
RUN_TOP_LEVEL = 5, /* running at top level */ RUN_TOP_LEVEL, /* running at top level */
RUN_EXIT = 6, /* normal exit from calc */ RUN_EXIT, /* normal exit from calc */
RUN_EXIT_WITH_ERROR = 7 /* exit with error */ RUN_EXIT_WITH_ERROR /* exit with error */
} run; } run;
extern run run_state; extern DLL run run_state;
extern char *run_state_name(run state); extern DLL char *run_state_name(run state);
/* /*
* calc version information * calc version information
@@ -251,7 +254,7 @@ extern int calc_minor_ver;
extern int calc_major_patch; extern int calc_major_patch;
extern char *calc_minor_patch; extern char *calc_minor_patch;
extern char *Copyright; extern char *Copyright;
extern char *version(void); extern DLL char *version(void);
#endif /* !__CALC_H__ */ #endif /* !__CALC_H__ */

270
calc.man
View File

@@ -15,15 +15,15 @@
.\" 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. .\" 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
.\" .\"
.\" @(#) $Revision: 29.1 $ .\" @(#) $Revision: 29.5 $
.\" @(#) $Id: calc.man,v 29.1 1999/12/14 09:15:35 chongo Exp $ .\" @(#) $Id: calc.man,v 29.5 2000/06/07 14:02:13 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
.\" File existed as early as: 1991 .\" File existed as early as: 1991
.\" .\"
.\" chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ .\" chongo <was here> /\oo/\ http://www.isthe.com/chongo/
.\" Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ .\" Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
.\" .\"
.\" calculator by David I. Bell .\" calculator by David I. Bell
.\" man page by Landon Noll .\" man page by Landon Noll
@@ -36,7 +36,7 @@ calc \- arbitrary precision calculator
.RB [ \-c ] .RB [ \-c ]
.RB [ \-C ] .RB [ \-C ]
.RB [ \-d ] .RB [ \-d ]
.RB [ -D\ \&calc_debug[:resource_debug:[user_debug]] ] .RB [ -D\ \&calc_debug[:resource_debug[:user_debug]] ]
.br .br
.in +5n .in +5n
.RB [ \-e ] .RB [ \-e ]
@@ -53,7 +53,7 @@ calc \- arbitrary precision calculator
.RB [ calc_cmd\ \&.\|.\|. ] .RB [ calc_cmd\ \&.\|.\|. ]
.in -5n .in -5n
.sp .sp
\fI#!${BINDIR}/calc\fP\ \fB\-S\fP\ [\-other_flags\ \&...] \fI#!${BINDIR}/calc\fP\ \fB\-S\fP\ [other_flags\ \&...]
.SH DESCRIPTION .SH DESCRIPTION
\& \&
.br .br
@@ -89,7 +89,7 @@ cause
to try to process each line being read to try to process each line being read
despite the errors that it encounters. despite the errors that it encounters.
.sp 1 .sp 1
By default, calc startup resource files ($CALCRC) are silently By default, calc startup resource files are silently
ignored if not found. ignored if not found.
This flag will report missing This flag will report missing
startup resource files unless startup resource files unless
@@ -103,10 +103,10 @@ Without
this flag, calling the custom() builtin function will this flag, calling the custom() builtin function will
simply generate an error. simply generate an error.
.sp 1 .sp 1
Use if this flag may cause Use of this flag may cause
.B calc .B calc
to execute functions that to execute functions
are non-standard and that are not portable. Custom builtin that are non-standard and that are not portable. Custom builtin
functions are disabled by default for this reason. functions are disabled by default for this reason.
.TP .TP
@@ -147,14 +147,14 @@ It's nearly ten past six.
.in -5n .in -5n
.sp 1 .sp 1
This flag disables the reporting of missing calc This flag disables the reporting of missing calc
startup resource files ($CALCRC). startup resource files.
.TP .TP
.BR -D " calc_debug[:resource_debug:[user_debug]]" .BR -D " calc_debug[:resource_debug[:user_debug]]"
Force the initial value of config("calc_debug"), Force the initial value of config("calc_debug"),
config("resource_debug") and config("user_debug"). config("resource_debug") and config("user_debug").
.sp 1 .sp 1
The : separated strings are interpreted as signed 32 bit values. The : separated strings are interpreted as signed 32 bit integers.
After an optional leading sign a leading zero indicates octal After an optional leading sign a leading zero indicates octal
conversion, and a leading ``0x'' or ``0X'' hexadecimal conversion, and a leading ``0x'' or ``0X'' hexadecimal
conversion. Otherwise, decimal conversion is assumed. conversion. Otherwise, decimal conversion is assumed.
@@ -197,14 +197,14 @@ See
.TP .TP
.B \-i .B \-i
Become interactive if possible. Become interactive if possible.
Be default, if If
.I calc_cmd .I calc_cmd
args are given, args are given,
.B calc .B calc
will execute them and exit. by default, calc will execute them and exit.
This flag args are given, This flag causes
.B calc .B calc
will execute them and exit. 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
@@ -294,7 +294,7 @@ unknown mode.
will attempt to read or write them if directed. will attempt to read or write them if directed.
.sp 1 .sp 1
If the mode disables opening of files for reading, then If the mode disables opening of files for reading, then
the startup resource files are disabled as of the startup resource files are disabled as if
.B \-q .B \-q
was given. was given.
The reading of key bindings is also disabled The reading of key bindings is also disabled
@@ -330,7 +330,7 @@ flag overrides
.TP .TP
.B \-q .B \-q
Disable the use of the $CALCRC startup resource files. Disable the reading of the startup scripts.
.TP .TP
.B \-s .B \-s
@@ -355,26 +355,20 @@ version number and exit.
.br .br
CALC COMMAND LINE CALC COMMAND LINE
.PP .PP
Without With no
.IR calc_cmd , .I calc_cmd
arguments,
.B calc .B calc
operates interactively. operates interactively.
If one or more If one or more
.I calc_cmd arguments are given on the command line and
are given on the command line and
.B \-s .B \-s
is NOT given, then is NOT given, then
.B calc .B calc
will evaluate and execute them and then exit. will read and execute them and either attempt
.sp to go interactive according as the
If
.B \-i .B \-i
is given, flag was present or absent.
.B calc
will attempt to become interactive
even of one or more
.I calc_cmd
are given on the command line.
.sp .sp
If If
.B \-s .B \-s
@@ -384,32 +378,157 @@ will not evaluate any
.I calc_cmd .I calc_cmd
arguments but instead make them available arguments but instead make them available
as strings to the argv() builtin function. as strings to the argv() builtin function.
Sufficiently simple commands with no no characters like
parentheses, brackets, semicolons, '*', which have special
interpretations in UNIX shells may be entered, possibly with
spaces, until the terminating newline.
For example:
.sp 1
.in +5n
.nf
calc 23 + 47
.fi
.in -5n
.sp 1
should respond with display of 70, but
.sp 1
.in +5n
.nf
calc 23 * 47
.fi
.in -5n
.sp 1
may fail.
Such cases can usually be made to work as expected by
enclosing the command between single marks as in:
.sp 1
.in +5n
.nf
calc '23 * 47'
.fi
.in -5n
.sp 1
and
.sp 1
.in +5n
.nf
calc 'print sqrt(2), exp(1)'
.fi
.in -5n
.sp
If '!' is to be used to indicate the factorial function, for
shells like
.BI csh (1)
for which '!' followed by a non-space character
is used for history substitution, it may be necessary to
include a space or use a backslash to escape the special
meaning of '!'.
For example, the command:
.sp 1
.in +5n
.nf
print 27!^2
.fi
.in -5n
.sp 1
may have to be replaced by:
.sp 1
.in +5n
.nf
print 27! ^2 or print 27\!^2
.fi
.in -5n
\&
.br
CALC STARTUP FILES
.PP .PP
Normally on startup, Normally on startup,
if the environment variable
.B $CALCRC
is undefined and
.B calc .B calc
attempts to execute a collection of is invoked without the
startup resource files.
The environment variable $CALCRC (if non-existent
then a compiled in value) contains a : separated list of startup
resource files.
No error conditions are produced if these startup
resource files are not found.
.PP
If the mode disables opening of files for reading, then the startup
resource files are disabled as of
.B \-q .B \-q
was given and $CALCRC as well flag, or if
as the default compiled in value are ignored. .B $CALCRC
is defined and calc is invoked with
.BR \-e ,
.B calc
looks for a file "startup" in the calc resource directory
.B .calcrc
in the user's home directory, and
.B .calcinit in the current directory.
If one or more of these are found, they are read in succession as
.B calc
scripts and their commands executed.
When defined,
.B $CALCRC
is to contain a ':' separated list of names of files,
and if calc is then invoked without either the
.B \-q
or
.B \-e
flags, these files are read in succession and their commands executed.
No error condition is produced if a listed file is not found.
.sp
If the mode specified by
.B \-m
disables opening of files for reading, then the reading of startup
files is also disabled as if
.B \-q
was given.
\&
.br
CALC FILE SEARCH PATH
.PP .PP
Filenames are subject to ``~'' expansion (see below). If the environment variable
The .B $CALCPATH
environment variable $CALCPATH (if non-existent then a compiled in is undefined, or if it
value) contains a : separated list of search directories. is defined and
If a .B calc
file does not begin with /, ~ or ./, then it is searched for under is invoked with the
each directory listed in the $CALCPATH. .B \-e
It is an error if no such flag, when a file name not beginning with
readable file is found. .BR / ,
.B ~
or
.BR ./ ,
is specified as in:
.sp 1
.in +5n
.nf
calc read myfile
.fi
.in -5n
.sp 1
.B calc
searches in succession:
.sp 1
.in +5n
.nf
./myfile
./myfile.cal
${LIBDIR}/myfile
${LIBDIR}/myfile.cal
${CUSTOMLIBDIR}/myfile
${CUSTOMLIBDIR}/myfile.cal
.fi
.in -5n
.sp 1
If the file is found, the
search stops and the commands in the file are executed.
It is an error if no readable file with the specified name is found.
An alternative search path can be specified by defining
.B $CALCPATH
in the same way as PATH is defined, as a ':' separated
list of directories, and then invoking
.B calc
without the
.B \-e
flag.
.PP .PP
.B Calc .B Calc
treats all open files, other than stdin, stdout and treats all open files, other than stdin, stdout and
@@ -447,11 +566,17 @@ help config
.br .br
SHELL SCRIPT MODE SHELL SCRIPT MODE
.PP .PP
If an executable file begins with: If first line of an executable file begins
.B #!
followed by the absolute pathname of the
.B calc
program and the flag
.B \-S
as in:
.sp 1 .sp 1
.in +5n .in +5n
.nf .nf
\fI#!${BINDIR}/calc\fP\ \fB\-S\fP\ [\-other_flags\ \&...] \fI#!${BINDIR}/calc\fP\ \fB\-S\fP\ [other_flags\ \&...]
.fi .fi
.in -5n .in -5n
.sp 1 .sp 1
@@ -462,19 +587,22 @@ Note that
(UPPER CASE (UPPER CASE
.BR \-S ) .BR \-S )
must be the first \-flag on the ``#!'' line. must be the first \-flag on the ``#!'' line.
Any other optional ``\-other_flags'' must come after Any other optional
.B "other_flags"
must come after
the the
.BR \-S . .BR \-S .
.sp 1 .sp 1
In In
.B "shell script mode" .B "shell script mode"
the contents of the file the contents of the file are read and
are evaluated and executed as if they were processed executed as if they were in a file being processed by a read
by the command, except that a "command" beginning with '#' followed by
.B read whitespace and ending at the next newline is treated as a comment.
command. Any optional
Any optional ``\-other_flags'' will by parsed first .B "other_flags"
followed by any arguments given shell script itself. will be parsed first followed by
the later lines within the script itself.
.sp 1 .sp 1
In In
.BR "shell script mode" , .BR "shell script mode" ,
@@ -879,9 +1007,7 @@ in future distributions to:
.sp .sp
.in +0.5i .in +0.5i
.nf .nf
calc-tester at postofc dot corp dot sgi dot com calc-contrib at asthe dot com
[[ Replace 'at' with @, 'dot' is with . and remove the spaces ]]
.fi .fi
.in -0.5i .in -0.5i
.sp .sp
@@ -889,9 +1015,10 @@ Bug reports are sent to:
.sp .sp
.in +0.5i .in +0.5i
.nf .nf
calc-bugs at postofc dot corp dot sgi dot com calc-bugs at asthe dot com
[[ Replace 'at' with @, 'dot' is with . and remove the spaces ]] [[ NOTE: Replace 'at' with @, 'dot' is with . and remove the spaces ]]
[[ NOTE: The EMail address uses 'asthe' and the web site URL uses 'isthe' ]]
.fi .fi
.in -0.5i .in -0.5i
.sp .sp
@@ -917,7 +1044,7 @@ Landon Noll maintains the the
web site is located at: web site is located at:
.sp .sp
.in +0.5i .in +0.5i
http://reality.sgi.com/chongo/tech/comp/calc/ http://www.isthe.com/chongo/tech/comp/calc/
.in -0.5i .in -0.5i
.sp .sp
One may join the One may join the
@@ -926,9 +1053,10 @@ testing group by sending a request to:
.sp .sp
.in +0.5i .in +0.5i
.nf .nf
calc-tester-request at postofc dot corp dot sgi dot com calc-tester-request at asthe dot com
[[ Replace 'at' with @, 'dot' is with . and remove the spaces ]] [[ NOTE: Replace 'at' with @, 'dot' is with . and remove the spaces ]]
[[ NOTE: The EMail address uses 'asthe' and the web site URL uses 'isthe' ]]
.fi .fi
.in -0.5i .in -0.5i
.sp .sp

View File

@@ -17,14 +17,14 @@
# 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. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.1 $ # @(#) $Revision: 29.3 $
# @(#) $Id: calcerr.tbl,v 29.1 1999/12/14 09:15:35 chongo Exp $ # @(#) $Id: calcerr.tbl,v 29.3 2000/07/17 15:35:49 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
# File existed as early as: 1996 # File existed as early as: 1996
# #
# Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ # Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
# This file is used to build calcerr.h include file. # This file is used to build calcerr.h include file.
# #
@@ -375,3 +375,21 @@ E_GD3 Infinite or too-large result for gd
E_AGD3 Infinite or too-large result for agd E_AGD3 Infinite or too-large result for agd
E_POWER4 Too-large value for power E_POWER4 Too-large value for power
E_ROOT4 Too-large value for root E_ROOT4 Too-large value for root
E_DGT1 Non-real first arg for digit
E_DGT2 Non-integral second arg for digit
E_DGT3 Bad third arg for digit
E_PLCS1 Bad first argument for places
E_PLCS2 Bad second argument for places
E_DGTS1 Bad first argument for digits
E_DGTS2 Bad second argument for digits
E_ILOG Bad first argument for ilog
E_ILOGB Bad second argument for ilog
E_ILOG10 Bad argument for ilog10
E_ILOG2 Bad argument for ilog2
E_COMB1 Non-integer second arg for comb
E_COMB2 Too-large second arg for comb
E_CTLN Bad argument for catalan
E_BERN Bad argument for bern
E_EULER Bad argument for euler
E_SLEEP Bad argument for sleep
E_TTY calc_tty failure

View File

@@ -18,15 +18,15 @@
# 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. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.1 $ # @(#) $Revision: 29.2 $
# @(#) $Id: calcerr_c.awk,v 29.1 1999/12/14 09:15:35 chongo Exp $ # @(#) $Id: calcerr_c.awk,v 29.2 2000/06/07 14:02:13 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
# File existed as early as: 1996 # File existed as early as: 1996
# #
# chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ # chongo <was here> /\oo/\ http://www.isthe.com/chongo/
# Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ # Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
# #
BEGIN { BEGIN {
printf("#include <stdio.h>\n"); printf("#include <stdio.h>\n");

View File

@@ -18,15 +18,15 @@
# 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. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.1 $ # @(#) $Revision: 29.2 $
# @(#) $Id: calcerr_c.sed,v 29.1 1999/12/14 09:15:35 chongo Exp $ # @(#) $Id: calcerr_c.sed,v 29.2 2000/06/07 14:02:13 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
# File existed as early as: 1996 # File existed as early as: 1996
# #
# chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ # chongo <was here> /\oo/\ http://www.isthe.com/chongo/
# Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ # Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
# #
s/#.*// s/#.*//
s/[ ][ ]*$// s/[ ][ ]*$//

View File

@@ -18,15 +18,15 @@
# 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. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.1 $ # @(#) $Revision: 29.2 $
# @(#) $Id: calcerr_h.awk,v 29.1 1999/12/14 09:15:35 chongo Exp $ # @(#) $Id: calcerr_h.awk,v 29.2 2000/06/07 14:02:13 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
# File existed as early as: 1996 # File existed as early as: 1996
# #
# chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ # chongo <was here> /\oo/\ http://www.isthe.com/chongo/
# Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ # Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
# #
BEGIN { BEGIN {
ebase = 10000; ebase = 10000;

View File

@@ -18,15 +18,15 @@
# 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. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.1 $ # @(#) $Revision: 29.2 $
# @(#) $Id: calcerr_h.sed,v 29.1 1999/12/14 09:15:35 chongo Exp $ # @(#) $Id: calcerr_h.sed,v 29.2 2000/06/07 14:02:13 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
# File existed as early as: 1996 # File existed as early as: 1996
# #
# chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ # chongo <was here> /\oo/\ http://www.isthe.com/chongo/
# Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ # Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
# #
s/#.*// s/#.*//
s/[ ][ ]*$// s/[ ][ ]*$//

View File

@@ -18,15 +18,15 @@
# 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. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.1 $ # @(#) $Revision: 29.2 $
# @(#) $Id: check.awk,v 29.1 1999/12/14 09:15:35 chongo Exp $ # @(#) $Id: check.awk,v 29.2 2000/06/07 14:02:13 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
# File existed as early as: 1996 # File existed as early as: 1996
# #
# chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ # chongo <was here> /\oo/\ http://www.isthe.com/chongo/
# Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ # Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
# #
# This awk script will print 3 lines before and after any non-blank line that # This awk script will print 3 lines before and after any non-blank line that
# does not begin with a number. This allows the 'make debug' rule to remove # does not begin with a number. This allows the 'make debug' rule to remove

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.3 $
* @(#) $Id: cmath.h,v 29.1 1999/12/14 09:15:35 chongo Exp $ * @(#) $Id: cmath.h,v 29.3 2000/07/17 15:35:49 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
* File existed as early as: 1993 * File existed as early as: 1993
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
@@ -83,6 +83,7 @@ extern BOOL ccmp(COMPLEX *c1, COMPLEX *c2);
* More complicated functions. * More complicated functions.
*/ */
extern COMPLEX *cpowi(COMPLEX *c, NUMBER *q); extern COMPLEX *cpowi(COMPLEX *c, NUMBER *q);
extern NUMBER *cilog(COMPLEX *c, ZVALUE base);
/* /*

427
codegen.c
View File

@@ -19,14 +19,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.4 $
* @(#) $Id: codegen.c,v 29.1 1999/12/14 09:15:35 chongo Exp $ * @(#) $Id: codegen.c,v 29.4 2001/03/17 21:31:47 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
* File existed as early as: before 1990 * File existed as early as: before 1990
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
@@ -45,11 +45,15 @@
#include "func.h" #include "func.h"
#include "conf.h" #include "conf.h"
#if defined(_WIN32)
# include <direct.h>
#endif
static BOOL rdonce; /* TRUE => do not reread this file */ static BOOL rdonce; /* TRUE => do not reread this file */
FUNC *curfunc; FUNC *curfunc;
static BOOL getfilename(char *name, BOOL msg_ok, BOOL *once); static int getfilename(char *name, BOOL *once);
static BOOL getid(char *buf); static BOOL getid(char *buf);
static void getshowstatement(void); static void getshowstatement(void);
static void getfunction(void); static void getfunction(void);
@@ -71,7 +75,7 @@ static void getsimplebody(void);
static void getcondition(void); static void getcondition(void);
static void getmatargs(void); static void getmatargs(void);
static void getelement(void); static void getelement(void);
static void usesymbol(char *name, BOOL autodef); static void usesymbol(char *name, int autodef);
static void definesymbol(char *name, int symtype); static void definesymbol(char *name, int symtype);
static void getcallargs(char *name); static void getcallargs(char *name);
static void do_changedir(void); static void do_changedir(void);
@@ -90,9 +94,16 @@ static int getshiftexpr(void);
static int getreference(void); static int getreference(void);
static int getincdecexpr(void); static int getincdecexpr(void);
static int getterm(void); static int getterm(void);
static int getidexpr(BOOL okmat, BOOL autodef); static int getidexpr(BOOL okmat, int autodef);
static long getinitlist(void); static long getinitlist(void);
#define INDICALLOC 8
static int quickindices[INDICALLOC];
static int * newindices;
static int * indices;
static int maxindices;
/* /*
* Read all the commands from an input file. * Read all the commands from an input file.
@@ -133,49 +144,63 @@ getcommands(BOOL toplevel)
return; return;
case T_HELP: case T_HELP:
if (!getfilename(name, FALSE, NULL)) { for (;;) {
strcpy(name, DEFAULTCALCHELP); switch(getfilename(name, NULL)) {
case 1:
strcpy(name, DEFAULTCALCHELP);
case 0:
givehelp(name);
continue;
default:
break;
}
break;
} }
givehelp(name);
break; break;
case T_READ: case T_READ:
if (!getfilename(name, TRUE, &rdonce))
break;
if (!allow_read) { if (!allow_read) {
scanerror(T_NULL, scanerror(T_NULL,
"read command disallowed by -m mode\n"); "read command disallowed by -m mode\n");
break; break;
} }
switch (opensearchfile(name,calcpath,CALCEXT,rdonce)) { for (;;) {
case 0: if (getfilename(name, &rdonce))
getcommands(FALSE); break;
closeinput(); switch (opensearchfile(name,calcpath,
break; CALCEXT,rdonce)) {
case 1: case 0:
/* previously read and -once was given */ getcommands(FALSE);
break; closeinput();
case -2: continue;
scanerror(T_NULL, case 1:
"Maximum input depth reached"); /* prev read and -once was given */
break; continue;
default: case -2:
scanerror(T_NULL, "Cannot open \"%s\"\n", name); scanerror(T_NULL,
"Maximum input depth reached");
break;
default:
scanerror(T_NULL,
"Cannot open \"%s\"", name);
continue;
}
break; break;
} }
break; break;
case T_WRITE: case T_WRITE:
if (!getfilename(name, TRUE, NULL))
break;
if (!allow_write) { if (!allow_write) {
scanerror(T_NULL, scanerror(T_NULL,
"write command disallowed by -m mode\n"); "write command disallowed by -m mode\n");
break; break;
} }
if (writeglobals(name)) if (getfilename(name, NULL))
break;
if (writeglobals(name)) {
scanerror(T_NULL, scanerror(T_NULL,
"Error writing \"%s\"\n", name); "Error writing \"%s\"\n", name);
}
break; break;
case T_CD: case T_CD:
@@ -529,7 +554,7 @@ getonevariable(int symtype)
res = getonevariable(symtype); res = getonevariable(symtype);
definesymbol(name, symtype); definesymbol(name, symtype);
if (res) { if (res) {
usesymbol(name, FALSE); usesymbol(name, 0);
addop(OP_ASSIGNBACK); addop(OP_ASSIGNBACK);
} }
return res; return res;
@@ -892,7 +917,7 @@ getstatement(LABEL *contlabel, LABEL *breaklabel, LABEL *nextcaselabel, LABEL *d
return; return;
case T_ELSE: case T_ELSE:
scanerror(T_SEMICOLON, "ELSE without preceeding IF"); scanerror(T_SEMICOLON, "ELSE without preceding IF");
return; return;
case T_SHOW: case T_SHOW:
@@ -1021,7 +1046,6 @@ getobjdeclaration(int symtype)
int count; /* number of elements */ int count; /* number of elements */
int index; /* current index */ int index; /* current index */
int i; /* loop counter */ int i; /* loop counter */
int indices[MAXINDICES]; /* indices for elements */
int oldmode; int oldmode;
if (gettoken() != T_SYMBOL) { if (gettoken() != T_SYMBOL) {
@@ -1038,58 +1062,89 @@ getobjdeclaration(int symtype)
* Read in the definition of the elements of the object. * Read in the definition of the elements of the object.
*/ */
count = 0; count = 0;
indices = quickindices;
maxindices = INDICALLOC;
oldmode = tokenmode(TM_DEFAULT); oldmode = tokenmode(TM_DEFAULT);
for (;;) { for (;;) {
switch (gettoken()) { switch (gettoken()) {
case T_SYMBOL: case T_SYMBOL:
if (count == MAXINDICES) { if (count == maxindices) {
scanerror(T_SEMICOLON, if (maxindices == INDICALLOC) {
"Too many elements in OBJ " maxindices += INDICALLOC;
"statement"); newindices = (int *) malloc(maxindices *
(void) tokenmode(oldmode); sizeof(int));
return; if (newindices == NULL) {
} scanerror(T_SEMICOLON, "Out of memory for indices malloc");
index = addelement(tokensymbol());
for (i = 0; i < count; i++) {
if (indices[i] == index) {
scanerror(T_SEMICOLON,
"Duplicate element name "
"\"%s\"", tokensymbol());
(void) tokenmode(oldmode); (void) tokenmode(oldmode);
return; return;
} }
memcpy(newindices, quickindices,
INDICALLOC * sizeof(int));
indices = newindices;
} else {
maxindices += INDICALLOC;
newindices = (int *) realloc(indices,
maxindices * sizeof(int));
if (newindices == NULL) {
free(indices);
scanerror(T_SEMICOLON, "Out of memory for indices realloc");
(void) tokenmode(oldmode);
return;
}
indices = newindices;
} }
indices[count++] = index; }
if (gettoken() == T_COMMA) index = addelement(tokensymbol());
continue; for (i = 0; i < count; i++) {
rescantoken(); if (indices[i] == index) {
if (gettoken() != T_RIGHTBRACE) { if (indices != quickindices)
scanerror(T_SEMICOLON, free(indices);
"Bad object type definition"); scanerror(T_SEMICOLON, "Duplicate element name \"%s\"", tokensymbol());
(void) tokenmode(oldmode); (void) tokenmode(oldmode);
return; return;
} }
/*FALLTHRU*/ }
case T_RIGHTBRACE: indices[count++] = index;
(void) tokenmode(oldmode); if (gettoken() == T_COMMA)
if (defineobject(name, indices, count)) {
scanerror(T_NULL,
"Object type \"%s\" is already defined", name);
return;
}
getobjvars(name, symtype);
return;
case T_NEWLINE:
continue; continue;
default: rescantoken();
scanerror(T_SEMICOLON, if (gettoken() != T_RIGHTBRACE) {
"Bad object type definition"); if (indices != quickindices)
free(indices);
scanerror(T_SEMICOLON, "Bad object type definition");
(void) tokenmode(oldmode); (void) tokenmode(oldmode);
return; return;
}
/*FALLTHRU*/
case T_RIGHTBRACE:
(void) tokenmode(oldmode);
if (defineobject(name, indices, count)) {
if (indices != quickindices)
free(indices);
scanerror(T_NULL,
"Object type \"%s\" is already defined", name);
return;
}
if (indices != quickindices)
free(indices);
getobjvars(name, symtype);
return;
case T_NEWLINE:
continue;
default:
if (indices != quickindices)
free(indices);
scanerror(T_SEMICOLON, "Bad object type definition");
(void) tokenmode(oldmode);
return;
} }
} }
} }
static void static void
getoneobj(long index, int symtype) getoneobj(long index, int symtype)
{ {
@@ -1098,11 +1153,11 @@ getoneobj(long index, int symtype)
if (gettoken() == T_SYMBOL) { if (gettoken() == T_SYMBOL) {
if (symtype == SYM_UNDEFINED) { if (symtype == SYM_UNDEFINED) {
rescantoken(); rescantoken();
(void) getidexpr(TRUE, TRUE); (void) getidexpr(TRUE, 1);
} else { } else {
symname = tokensymbol(); symname = tokensymbol();
definesymbol(symname, symtype); definesymbol(symname, symtype);
usesymbol(symname, FALSE); usesymbol(symname, 0);
} }
getoneobj(index, symtype); getoneobj(index, symtype);
addop(OP_ASSIGN); addop(OP_ASSIGN);
@@ -1181,11 +1236,11 @@ getonematrix(int symtype)
if (gettoken() == T_SYMBOL) { if (gettoken() == T_SYMBOL) {
if (symtype == SYM_UNDEFINED) { if (symtype == SYM_UNDEFINED) {
rescantoken(); rescantoken();
(void) getidexpr(FALSE, TRUE); (void) getidexpr(FALSE, 1);
} else { } else {
name = tokensymbol(); name = tokensymbol();
definesymbol(name, symtype); definesymbol(name, symtype);
usesymbol(name, FALSE); usesymbol(name, 0);
} }
while (gettoken() == T_COMMA); while (gettoken() == T_COMMA);
rescantoken(); rescantoken();
@@ -2028,7 +2083,25 @@ getterm(void)
case T_SYMBOL: case T_SYMBOL:
rescantoken(); rescantoken();
type = getidexpr(TRUE, FALSE); type = getidexpr(TRUE, 0);
break;
case T_GLOBAL:
if (gettoken() != T_SYMBOL) {
scanerror(T_NULL, "Global id expected");
break;
}
rescantoken();
type = getidexpr(TRUE, T_GLOBAL);
break;
case T_LOCAL:
if (gettoken() != T_SYMBOL) {
scanerror(T_NULL, "Local id expected");
break;
}
rescantoken();
type = getidexpr(TRUE, T_LOCAL);
break; break;
case T_LEFTBRACKET: case T_LEFTBRACKET:
@@ -2077,11 +2150,11 @@ getterm(void)
/* /*
* Read in an identifier expressions. * Read in an identifier expressions.
* This is a symbol name followed by parenthesis, or by square brackets or * This is a symbol name followed by parenthesis, or by square brackets or
* element refernces. The symbol can be a global or a local variable name. * element references. The symbol can be a global or a local variable name.
* Returns the type of expression found. * Returns the type of expression found.
*/ */
static int static int
getidexpr(BOOL okmat, BOOL autodef) getidexpr(BOOL okmat, int autodef)
{ {
int type; int type;
char name[SYMBOLSIZE+1]; /* symbol name */ char name[SYMBOLSIZE+1]; /* symbol name */
@@ -2091,18 +2164,19 @@ getidexpr(BOOL okmat, BOOL autodef)
if (!getid(name)) if (!getid(name))
return type; return type;
switch (gettoken()) { switch (gettoken()) {
case T_LEFTPAREN: case T_LEFTPAREN:
oldmode = tokenmode(TM_DEFAULT); oldmode = tokenmode(TM_DEFAULT);
getcallargs(name); getcallargs(name);
(void) tokenmode(oldmode); (void) tokenmode(oldmode);
type = 0; type = 0;
break; break;
case T_ASSIGN: case T_ASSIGN:
autodef = TRUE; if (autodef != T_GLOBAL && autodef != T_LOCAL)
/* fall into default case */ autodef = 1;
default: /* fall into default case */
rescantoken(); default:
usesymbol(name, autodef); rescantoken();
usesymbol(name, autodef);
} }
/* /*
* Now collect as many element references and matrix index operations * Now collect as many element references and matrix index operations
@@ -2110,27 +2184,27 @@ getidexpr(BOOL okmat, BOOL autodef)
*/ */
for (;;) { for (;;) {
switch (gettoken()) { switch (gettoken()) {
case T_LEFTBRACKET: case T_LEFTBRACKET:
rescantoken(); rescantoken();
if (!okmat) if (!okmat)
return type;
getmatargs();
type = 0;
break;
case T_ARROW:
addop(OP_DEREF);
/*FALLTHRU*/
case T_PERIOD:
getelement();
type = 0;
break;
case T_LEFTPAREN:
scanerror(T_NULL,
"Function calls not allowed "
"as expressions");
default:
rescantoken();
return type; return type;
getmatargs();
type = 0;
break;
case T_ARROW:
addop(OP_DEREF);
/*FALLTHRU*/
case T_PERIOD:
getelement();
type = 0;
break;
case T_LEFTPAREN:
scanerror(T_NULL,
"Function calls not allowed "
"as expressions");
default:
rescantoken();
return type;
} }
} }
} }
@@ -2144,71 +2218,37 @@ getidexpr(BOOL okmat, BOOL autodef)
* *
* given: * given:
* name filename to read * name filename to read
* msg_ok TRUE => ok to print error messages
* once non-NULL => set to TRUE of -once read * once non-NULL => set to TRUE of -once read
*/ */
static BOOL static int
getfilename(char *name, BOOL msg_ok, BOOL *once) getfilename(char *name, BOOL *once)
{ {
STRING *s; STRING *s;
int i;
/* look at the next token */
(void) tokenmode(TM_NEWLINES | TM_ALLSYMS); (void) tokenmode(TM_NEWLINES | TM_ALLSYMS);
switch (gettoken()) { for (i = 2; i > 0; i--) {
case T_STRING: switch (gettoken()) {
s = findstring(tokenstring()); case T_STRING:
strcpy(name, s->s_str); s = findstring(tokenstring());
sfree(s); strcpy(name, s->s_str);
break; sfree(s);
case T_SYMBOL: break;
strcpy(name, tokensymbol()); case T_SYMBOL:
break; strcpy(name, tokensymbol());
default: break;
if (msg_ok) default:
scanerror(T_SEMICOLON, "Filename expected"); rescantoken();
return FALSE; return -1;
}
/* determine if we care about a possible -once option */
if (once != NULL) {
/* we care about a possible -once option */
if (strcmp(name, "-once") == 0) {
/* -once option found */
*once = TRUE;
/* look for the filename */
switch (gettoken()) {
case T_STRING:
s = findstring(tokenstring());
strcpy(name, s->s_str);
sfree(s);
break;
case T_SYMBOL:
strcpy(name, tokensymbol());
break;
default:
if (msg_ok)
scanerror(T_SEMICOLON,
"Filename expected");
return FALSE;
}
} else {
*once = FALSE;
} }
}
/* look at the next token */ if (i == 2 && once != NULL) {
switch (gettoken()) { if ((*once = !strcmp(name, "-once")))
case T_SEMICOLON: continue;
case T_NEWLINE: }
case T_EOF: break;
break;
default:
if (msg_ok)
scanerror(T_SEMICOLON,
"Missing semicolon after filename");
return FALSE;
} }
return TRUE; return 0;
} }
@@ -2433,11 +2473,26 @@ definesymbol(char *name, int symtype)
* *
* given: * given:
* name symbol name to be checked * name symbol name to be checked
* autodef TRUE => define is symbol is not known * autodef 1 => define if symbol is not known
* T_GLOBAL => get global, define if necessary
*/ */
static void static void
usesymbol(char *name, BOOL autodef) usesymbol(char *name, int autodef)
{ {
if (autodef == T_GLOBAL) {
addopptr(OP_GLOBALADDR, (char *) addglobal(name, FALSE));
return;
}
if (autodef == T_LOCAL) {
if (symboltype(name) == SYM_PARAM) {
scanerror(T_COMMA,
"Variable \"%s\" is already defined", name);
return;
}
addopone(OP_LOCALADDR, addlocal(name));
return;
}
switch (symboltype(name)) { switch (symboltype(name)) {
case SYM_LOCAL: case SYM_LOCAL:
addopone(OP_LOCALADDR, (long) findlocal(name)); addopone(OP_LOCALADDR, (long) findlocal(name));
@@ -2544,24 +2599,25 @@ static void
do_changedir(void) do_changedir(void)
{ {
char *p; char *p;
STRING *s;
/* look at the next token */ /* look at the next token */
(void) tokenmode(TM_NEWLINES | TM_ALLSYMS); (void) tokenmode(TM_NEWLINES | TM_ALLSYMS);
/* determine the new directory */ /* determine the new directory */
s = NULL;
switch (gettoken()) { switch (gettoken()) {
case T_NULL: case T_STRING:
case T_NEWLINE: s = findstring(tokenstring());
case T_SEMICOLON: p = s->s_str;
p = home; break;
break; case T_SYMBOL:
default: p = tokensymbol();
p = tokensymbol(); /* This is not enough XXX */ break;
if (p == NULL) { default:
p = home; p = home;
}
break;
} }
if (p == NULL) { if (p == NULL) {
fprintf(stderr, "Cannot determine HOME directory\n"); fprintf(stderr, "Cannot determine HOME directory\n");
} }
@@ -2570,29 +2626,8 @@ do_changedir(void)
if (chdir(p)) { if (chdir(p)) {
perror(p); perror(p);
} }
return; if (s != NULL)
sfree(s);
} }
/*
* getshellfile - process the contents of a shellfile
*/
void
getshellfile(char *shellfile)
{
/*
* treat the calc shell script as if we were reading it
*/
if (!allow_read) {
scanerror(T_NULL,
"reading of calc shell script \"%s\" "
"dislloaed by -m mode\n", shellfile);
} else if (opensearchfile(shellfile, NULL, NULL, FALSE) == 0) {
getcommands(FALSE);
closeinput();
} else {
scanerror(T_NULL,
"Cannot open calc shell script \"%s\"\n", shellfile);
}
return;
}

View File

@@ -19,14 +19,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.3 $
* @(#) $Id: comfunc.c,v 29.1 1999/12/14 09:15:35 chongo Exp $ * @(#) $Id: comfunc.c,v 29.3 2000/07/17 15:35: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
* File existed as early as: before 1990 * File existed as early as: before 1990
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
@@ -1007,7 +1007,7 @@ cpolar(NUMBER *q1, NUMBER *q2, NUMBER *epsilon)
long m, n; long m, n;
if (qiszero(epsilon)) { if (qiszero(epsilon)) {
math_error("Zero epsilson for cpolar"); math_error("Zero epsilon for cpolar");
/*NOTREACHED*/ /*NOTREACHED*/
} }
if (qiszero(q1)) if (qiszero(q1))
@@ -1162,3 +1162,27 @@ cprintfr(COMPLEX *c)
zprintval(i->den, 0L, 0L); zprintval(i->den, 0L, 0L);
} }
} }
NUMBER *
cilog(COMPLEX *c, ZVALUE base)
{
NUMBER *qr, *qi;
qr = qilog(c->real, base);
qi = qilog(c->imag, base);
if (qr == NULL) {
if (qi == NULL)
return NULL;
return qi;
}
if (qi == NULL)
return qr;
if (qrel(qr, qi) >= 0) {
qfree(qi);
return qr;
}
qfree(qr);
return qi;
}

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: commath.c,v 29.1 1999/12/14 09:15:35 chongo Exp $ * @(#) $Id: commath.c,v 29.2 2000/06/07 14:02:13 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
* File existed as early as: before 1990 * File existed as early as: before 1990
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

246
config.c
View File

@@ -19,14 +19,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 29.4 $
* @(#) $Id: config.c,v 29.2 1999/12/14 19:37:46 chongo Exp $ * @(#) $Id: config.c,v 29.4 2000/07/17 15:35:49 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
* File existed as early as: 1991 * File existed as early as: 1991
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
@@ -109,10 +109,10 @@ CONFIG oldstd = { /* backward compatible standard configuration */
SQ_ALG2, /* size of number to use square alg 2 */ SQ_ALG2, /* size of number to use square alg 2 */
POW_ALG2, /* size of modulus to use REDC for powers */ POW_ALG2, /* size of modulus to use REDC for powers */
REDC_ALG2, /* size of modulus to use REDC algorithm 2 */ REDC_ALG2, /* size of modulus to use REDC algorithm 2 */
TRUE, /* ok to print a tilde on aproximations */ TRUE, /* ok to print a tilde on approximations */
TRUE, /* ok to print tab before numeric values */ TRUE, /* ok to print tab before numeric values */
0, /* quomod() default rounding mode */ 0, /* quomod() default rounding mode */
2, /* quotent // default rounding mode */ 2, /* quotient // default rounding mode */
0, /* mod % default rounding mode */ 0, /* mod % default rounding mode */
24, /* sqrt() default rounding mode */ 24, /* sqrt() default rounding mode */
24, /* appr() default rounding mode */ 24, /* appr() default rounding mode */
@@ -149,10 +149,10 @@ CONFIG newstd = { /* new non-backward compatible configuration */
SQ_ALG2, /* size of number to use square alg 2 */ SQ_ALG2, /* size of number to use square alg 2 */
POW_ALG2, /* size of modulus to use REDC for powers */ POW_ALG2, /* size of modulus to use REDC for powers */
REDC_ALG2, /* size of modulus to use REDC algorithm 2 */ REDC_ALG2, /* size of modulus to use REDC algorithm 2 */
TRUE, /* ok to print a tilde on aproximations */ TRUE, /* ok to print a tilde on approximations */
TRUE, /* ok to print tab before numeric values */ TRUE, /* ok to print tab before numeric values */
0, /* quomod() default rounding mode */ 0, /* quomod() default rounding mode */
0, /* quotent // default rounding mode */ 0, /* quotient // default rounding mode */
0, /* mod % default rounding mode */ 0, /* mod % default rounding mode */
24, /* sqrt() default rounding mode */ 24, /* sqrt() default rounding mode */
24, /* appr() default rounding mode */ 24, /* appr() default rounding mode */
@@ -287,10 +287,11 @@ static NAMETYPE truth[] = {
/* /*
* declate static functions * declare static functions
*/ */
static long lookup_long(NAMETYPE *set, char *name); static long lookup_long(NAMETYPE *set, char *name);
static char *lookup_name(NAMETYPE *set, long val); static char *lookup_name(NAMETYPE *set, long val);
static int getlen(VALUE *vp, LEN *lp);
/* /*
@@ -360,6 +361,26 @@ lookup_name(NAMETYPE *set, long val)
} }
/*
* Check whether VALUE at vp is a LEN (32-bit signed integer) and if so,
* copy that integer to lp.
* Return: 1, 2, 0, or -1 XXX
*/
static int
getlen(VALUE *vp, LEN *lp)
{
if (vp->v_type != V_NUM || !qisint(vp->v_num))
return 1;
if (zge31b(vp->v_num->num))
return 2;
*lp = ztoi(vp->v_num->num);
if (*lp < 0)
return -1;
return 0;
}
/* /*
* Set the specified configuration type to the specified value. * Set the specified configuration type to the specified value.
* An error is generated if the type number or value is illegal. * An error is generated if the type number or value is illegal.
@@ -370,6 +391,7 @@ setconfig(int type, VALUE *vp)
NUMBER *q; NUMBER *q;
CONFIG *newconf; /* new configuration to set */ CONFIG *newconf; /* new configuration to set */
long temp; long temp;
LEN len;
char *p; char *p;
switch (type) { switch (type) {
@@ -414,15 +436,11 @@ setconfig(int type, VALUE *vp)
break; break;
case CONFIG_DISPLAY: case CONFIG_DISPLAY:
if (vp->v_type != V_NUM) { if (getlen(vp, &len)) {
math_error("Non-numeric for display"); math_error("Bad value for display");
/*NOTREACHED*/ /*NOTREACHED*/
} }
q = vp->v_num; math_setdigits(len);
temp = qtoi(q);
if (qisfrac(q) || qisneg(q) || !zistiny(q->num))
temp = -1;
math_setdigits(temp);
break; break;
case CONFIG_MODE: case CONFIG_MODE:
@@ -447,91 +465,51 @@ setconfig(int type, VALUE *vp)
break; break;
case CONFIG_MAXPRINT: case CONFIG_MAXPRINT:
if (vp->v_type != V_NUM) { if (getlen(vp, &len)) {
math_error("Non-numeric for maxprint"); math_error("Bad value for maxprint");
/*NOTREACHED*/ /*NOTREACHED*/
} }
q = vp->v_num; conf->maxprint = len;
temp = qtoi(q);
if (qisfrac(q) || qisneg(q) || !zistiny(q->num))
temp = -1;
if (temp < 0) {
math_error("Maxprint value is out of range");
/*NOTREACHED*/
}
conf->maxprint = temp;
break; break;
case CONFIG_MUL2: case CONFIG_MUL2:
if (vp->v_type != V_NUM) { if (getlen(vp, &len)) {
math_error("Non-numeric for mul2"); math_error("Bad value for mul2");
/*NOTREACHED*/ /*NOTREACHED*/
} }
q = vp->v_num; if (len == 0)
temp = qtoi(q); len = MUL_ALG2;
if (qisfrac(q) || qisneg(q)) conf->mul2 = len;
temp = -1;
if (temp == 0)
temp = MUL_ALG2;
if (temp < 2) {
math_error("Illegal mul2 value");
/*NOTREACHED*/
}
conf->mul2 = (int)temp;
break; break;
case CONFIG_SQ2: case CONFIG_SQ2:
if (vp->v_type != V_NUM) { if (getlen(vp, &len)) {
math_error("Non-numeric for sq2"); math_error("Bad value for sq2");
/*NOTREACHED*/ /*NOTREACHED*/
} }
q = vp->v_num; if (len == 0)
temp = qtoi(q); len = SQ_ALG2;
if (qisfrac(q) || qisneg(q)) conf->sq2 = len;
temp = -1;
if (temp == 0)
temp = SQ_ALG2;
if (temp < 2) {
math_error("Illegal sq2 value");
/*NOTREACHED*/
}
conf->sq2 = (int)temp;
break; break;
case CONFIG_POW2: case CONFIG_POW2:
if (vp->v_type != V_NUM) { if (getlen(vp, &len)) {
math_error("Non-numeric for pow2"); math_error("Bad value for pow2");
/*NOTREACHED*/ /*NOTREACHED*/
} }
q = vp->v_num; if (len == 0)
temp = qtoi(q); len = POW_ALG2;
if (qisfrac(q) || qisneg(q)) conf->pow2 = len;
temp = -1;
if (temp == 0)
temp = POW_ALG2;
if (temp < 1) {
math_error("Illegal pow2 value");
/*NOTREACHED*/
}
conf->pow2 = (int)temp;
break; break;
case CONFIG_REDC2: case CONFIG_REDC2:
if (vp->v_type != V_NUM) { if (getlen(vp, &len)) {
math_error("Non-numeric for redc2"); math_error("Bad value for redc2");
/*NOTREACHED*/ /*NOTREACHED*/
} }
q = vp->v_num; if (len == 0)
temp = qtoi(q); len = REDC_ALG2;
if (qisfrac(q) || qisneg(q)) conf->redc2 = len;
temp = -1;
if (temp == 0)
temp = REDC_ALG2;
if (temp < 1) {
math_error("Illegal redc2 value");
/*NOTREACHED*/
}
conf->redc2 = (int)temp;
break; break;
case CONFIG_TILDE: case CONFIG_TILDE:
@@ -563,129 +541,75 @@ setconfig(int type, VALUE *vp)
break; break;
case CONFIG_QUOMOD: case CONFIG_QUOMOD:
if (vp->v_type != V_NUM) { if (getlen(vp, &len)) {
math_error("Non numeric for quomod"); math_error("Illegal value for quomod");
/*NOTREACHED*/ /*NOTREACHED*/
} }
q = vp->v_num; conf->quomod = len;
temp = qtoi(q);
if (qisfrac(q) || qisneg(q) || !zistiny(q->num)) {
math_error("Illegal quomod parameter value");
/*NOTREACHED*/
}
conf->quomod = temp;
break; break;
case CONFIG_QUO: case CONFIG_QUO:
if (vp->v_type != V_NUM) { if (getlen(vp, &len)) {
math_error("Non numeric for quo"); math_error("Illegal value for quo");
/*NOTREACHED*/ /*NOTREACHED*/
} }
q = vp->v_num; conf->quo = len;
temp = qtoi(q);
if (qisfrac(q) || qisneg(q) || !zistiny(q->num)) {
math_error("Illegal quo parameter value");
/*NOTREACHED*/
}
conf->quo = temp;
break; break;
case CONFIG_MOD: case CONFIG_MOD:
if (vp->v_type != V_NUM) { if (getlen(vp, &len)) {
math_error("Non numeric for mod"); math_error("Illegal value for mod");
/*NOTREACHED*/ /*NOTREACHED*/
} }
q = vp->v_num; conf->mod = len;
temp = qtoi(q);
if (qisfrac(q) || qisneg(q) || !zistiny(q->num)) {
math_error("Illegal mod parameter value");
/*NOTREACHED*/
}
conf->mod = temp;
break; break;
case CONFIG_SQRT: case CONFIG_SQRT:
if (vp->v_type != V_NUM) { if (getlen(vp, &len)) {
math_error("Non numeric for sqrt"); math_error("Illegal value for sqrt");
/*NOTREACHED*/ /*NOTREACHED*/
} }
q = vp->v_num; conf->sqrt = len;
temp = qtoi(q);
if (qisfrac(q) || qisneg(q) || !zistiny(q->num)) {
math_error("Illegal sqrt parameter value");
/*NOTREACHED*/
}
conf->sqrt = temp;
break; break;
case CONFIG_APPR: case CONFIG_APPR:
if (vp->v_type != V_NUM) { if (getlen(vp, &len)) {
math_error("Non numeric for appr"); math_error("Illegal value for appr");
/*NOTREACHED*/ /*NOTREACHED*/
} }
q = vp->v_num; conf->appr = len;
temp = qtoi(q);
if (qisfrac(q) || qisneg(q) || !zistiny(q->num)) {
math_error("Illegal appr parameter value");
/*NOTREACHED*/
}
conf->appr = temp;
break; break;
case CONFIG_CFAPPR: case CONFIG_CFAPPR:
if (vp->v_type != V_NUM) { if (getlen(vp, &len)) {
math_error("Non numeric for cfappr"); math_error("Illegal value for cfappr");
/*NOTREACHED*/ /*NOTREACHED*/
} }
q = vp->v_num; conf->cfappr = len;
temp = qtoi(q);
if (qisfrac(q) || qisneg(q) || !zistiny(q->num)) {
math_error("Illegal cfappr parameter value");
/*NOTREACHED*/
}
conf->cfappr = temp;
break; break;
case CONFIG_CFSIM: case CONFIG_CFSIM:
if (vp->v_type != V_NUM) { if (getlen(vp, &len)) {
math_error("Non numeric for cfsim"); math_error("Illegal value for cfsim");
/*NOTREACHED*/ /*NOTREACHED*/
} }
q = vp->v_num; conf->cfsim = len;
temp = qtoi(q);
if (qisfrac(q) || qisneg(q) || !zistiny(q->num)) {
math_error("Illegal cfsim parameter value");
/*NOTREACHED*/
}
conf->cfsim = temp;
break; break;
case CONFIG_OUTROUND: case CONFIG_OUTROUND:
if (vp->v_type != V_NUM) { if (getlen(vp, &len)) {
math_error("Non numeric for outround"); math_error("Illegal value for outround");
/*NOTREACHED*/ /*NOTREACHED*/
} }
q = vp->v_num; conf->outround = len;
temp = qtoi(q);
if (qisfrac(q) || qisneg(q) || !zistiny(q->num)) {
math_error("Illegal output parameter value");
/*NOTREACHED*/
}
conf->outround = temp;
break; break;
case CONFIG_ROUND: case CONFIG_ROUND:
if (vp->v_type != V_NUM) { if (getlen(vp, &len)) {
math_error("Non numeric for round"); math_error("Illegal value for round");
/*NOTREACHED*/ /*NOTREACHED*/
} }
q = vp->v_num; conf->round = len;
temp = qtoi(q);
if (qisfrac(q) || qisneg(q) || !zistiny(q->num)) {
math_error("Illegal output parameter value");
/*NOTREACHED*/
}
conf->round = temp;
break; break;
case CONFIG_LEADZERO: case CONFIG_LEADZERO:
@@ -1311,12 +1235,12 @@ config_cmp(CONFIG *cfg1, CONFIG *cfg2)
*/ */
if (cfg1 == NULL || cfg1->epsilon == NULL || cfg1->prompt1 == NULL || if (cfg1 == NULL || cfg1->epsilon == NULL || cfg1->prompt1 == NULL ||
cfg1->prompt2 == NULL) { cfg1->prompt2 == NULL) {
math_error("CONFIG #1 value is invaid"); math_error("CONFIG #1 value is invalid");
/*NOTREACHED*/ /*NOTREACHED*/
} }
if (cfg2 == NULL || cfg2->epsilon == NULL || cfg2->prompt1 == NULL || if (cfg2 == NULL || cfg2->epsilon == NULL || cfg2->prompt1 == NULL ||
cfg2->prompt2 == NULL) { cfg2->prompt2 == NULL) {
math_error("CONFIG #2 value is invaid"); math_error("CONFIG #2 value is invalid");
/*NOTREACHED*/ /*NOTREACHED*/
} }

View File

@@ -19,15 +19,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 29.6 $
* @(#) $Id: config.h,v 29.2 1999/12/14 19:37:46 chongo Exp $ * @(#) $Id: config.h,v 29.6 2001/03/17 21:31:47 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $
* *
* Under source code control: 1995/11/01 22:20:17 * Under source code control: 1995/11/01 22:20:17
* File existed as early as: 1995 * File existed as early as: 1995
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
@@ -35,6 +35,7 @@
#define __CONFIG_H__ #define __CONFIG_H__
#include "win32dll.h"
#include "nametype.h" #include "nametype.h"
#include "qmath.h" #include "qmath.h"
@@ -110,26 +111,26 @@
*/ */
struct config { struct config {
int outmode; /* current output mode */ int outmode; /* current output mode */
long outdigits; /* current output digits for float or exp */ LEN outdigits; /* current output digits for float or exp */
NUMBER *epsilon; /* default error for real functions */ NUMBER *epsilon; /* default error for real functions */
long epsilonprec; /* epsilon binary precision (tied to epsilon) */ long epsilonprec; /* epsilon binary precision (tied to epsilon) */
FLAG traceflags; /* tracing flags */ FLAG traceflags; /* tracing flags */
long maxprint; /* number of elements to print */ LEN maxprint; /* number of elements to print */
LEN mul2; /* size of number to use multiply algorithm 2 */ LEN mul2; /* size of number to use multiply algorithm 2 */
LEN sq2; /* size of number to use square algorithm 2 */ LEN sq2; /* size of number to use square algorithm 2 */
LEN pow2; /* size of modulus to use REDC for powers */ LEN pow2; /* size of modulus to use REDC for powers */
LEN redc2; /* size of modulus to use REDC algorithm 2 */ LEN redc2; /* size of modulus to use REDC algorithm 2 */
BOOL tilde_ok; /* ok to print a tilde on aproximations */ BOOL tilde_ok; /* ok to print a tilde on aproximations */
BOOL tab_ok; /* ok to print tab before numeric values */ BOOL tab_ok; /* ok to print tab before numeric values */
long quomod; /* quomod() default rounding mode */ LEN quomod; /* quomod() default rounding mode */
long quo; /* quotent // default rounding mode */ LEN quo; /* quotient // default rounding mode */
long mod; /* mod % default rounding mode */ LEN mod; /* mod % default rounding mode */
long sqrt; /* sqrt() default rounding mode */ LEN sqrt; /* sqrt() default rounding mode */
long appr; /* appr() default rounding mode */ LEN appr; /* appr() default rounding mode */
long cfappr; /* cfappr() default rounding mode */ LEN cfappr; /* cfappr() default rounding mode */
long cfsim; /* cfsim() default rounding mode */ LEN cfsim; /* cfsim() default rounding mode */
long outround; /* output default rounding mode */ LEN outround; /* output default rounding mode */
long round; /* round()/bround() default rounding mode */ LEN round; /* round()/bround() default rounding mode */
BOOL leadzero; /* ok to print leading 0 before decimal pt */ BOOL leadzero; /* ok to print leading 0 before decimal pt */
BOOL fullzero; /* ok to print trailing 0's */ BOOL fullzero; /* ok to print trailing 0's */
long maxscancount; /* max scan errors before abort */ long maxscancount; /* max scan errors before abort */
@@ -182,23 +183,23 @@ typedef struct config CONFIG;
/* /*
* global configuration states and aliases * global configuration states and aliases
*/ */
extern CONFIG *conf; /* current configuration */ extern DLL CONFIG *conf; /* current configuration */
extern CONFIG oldstd; /* backward compatible standard configuration */ extern DLL CONFIG oldstd; /* backward compatible standard configuration */
extern CONFIG newstd; /* new non-backward compatible configuration */ extern DLL CONFIG newstd; /* new non-backward compatible configuration */
extern char *calc_debug; /* !=NULL => value of config("calc_debug") */ extern DLL char *calc_debug; /* !=NULL => value of config("calc_debug") */
extern char *resource_debug; /* !=NULL => config("resource_debug") value */ extern DLL char *resource_debug; /* !=NULL => config("resource_debug") value */
extern char *user_debug; /* !=NULL => value of config("user_debug") */ extern DLL char *user_debug; /* !=NULL => value of config("user_debug") */
/* /*
* configuration externals * configuration externals
*/ */
extern CONFIG *config_copy(CONFIG *src); extern DLL CONFIG *config_copy(CONFIG *src);
extern void config_free(CONFIG *cfg); extern DLL void config_free(CONFIG *cfg);
extern void config_print(CONFIG *cfg); extern DLL void config_print(CONFIG *cfg);
extern int configtype(char*); extern DLL int configtype(char*);
extern void config_print(CONFIG*); extern DLL void config_print(CONFIG*);
extern BOOL config_cmp(CONFIG*, CONFIG*); extern DLL BOOL config_cmp(CONFIG*, CONFIG*);
#endif /* !__CONFIG_H__ */ #endif /* !__CONFIG_H__ */

View File

@@ -17,14 +17,14 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: const.c,v 29.1 1999/12/14 09:15:35 chongo Exp $ * @(#) $Id: const.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/const.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/const.c,v $
* *
* Under source code control: 1990/02/15 01:48:14 * Under source code control: 1990/02/15 01:48:14
* File existed as early as: before 1990 * File existed as early as: before 1990
* *
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */

View File

@@ -17,15 +17,15 @@
# 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. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.3 $ # @(#) $Revision: 29.6 $
# @(#) $Id: Makefile,v 29.3 1999/12/14 19:30:19 chongo Exp $ # @(#) $Id: Makefile,v 29.6 2000/12/15 14:56:14 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/Makefile,v $ # @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/Makefile,v $
# #
# Under source code control: 1999/11/29 11:10:26 # Under source code control: 1999/11/29 11:10:26
# File existed as early as: 1999 # File existed as early as: 1999
# #
# chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ # chongo <was here> /\oo/\ http://www.isthe.com/chongo/
# Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ # Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
# #
# calculator by David I. Bell with help/mods from others # calculator by David I. Bell with help/mods from others
# Makefile by Landon Curt Noll # Makefile by Landon Curt Noll
@@ -65,7 +65,7 @@ FMT= fmt
# #
# The ${SCRIPT_SRC} is built from ${SCRIPT} and has the .calc extensions. # The ${SCRIPT_SRC} is built from ${SCRIPT} and has the .calc extensions.
# #
# This list is prodiced by the detaillist rule when no WARNINGS are detected. # This list is produced by the detaillist rule when no WARNINGS are detected.
# To add a script: # To add a script:
# #
# 1) Name the file with a .calc filename extension # 1) Name the file with a .calc filename extension
@@ -76,15 +76,15 @@ FMT= fmt
# #
# make detaillist # make detaillist
# #
SCRIPT= mersenne piforever plus simple SCRIPT= mersenne piforever plus simple square
SCRIPT_SRC= mersenne.calc piforever.calc plus.calc simple.calc SCRIPT_SRC= mersenne.calc piforever.calc plus.calc simple.calc square.calc
# These files are found (but not built) in the distribution # These files are found (but not built) in the distribution
# #
DISTLIST= ${SCRIPT_SRC} ${MAKE_FILE} DISTLIST= ${SCRIPT_SRC} ${MAKE_FILE} README
# These files are used to make (but not built) a calc .a library # These files are used to make (but not build) a calc .a library
# #
CALCLIBLIST= CALCLIBLIST=
@@ -92,10 +92,10 @@ CALCLIBLIST=
# #
all: ${SCRIPT} ${SCRIPT_SRC} .all all: ${SCRIPT} ${SCRIPT_SRC} .all
# used by the upper level Makefile to determine of we have done all # used by the upper level Makefile to determine if we have done all
# #
# NOTE: Due to bogus shells found on one common system we must have # NOTE: Due to bogus shells found on one common system we must have
# an non-emoty else clause for every if condition. *sigh* # a non-empty else clause for every if condition. *sigh*
# #
.all: .all:
rm -f .all rm -f .all
@@ -245,3 +245,7 @@ simple: simple.calc
rm -f $@ rm -f $@
${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@ ${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
${CHMOD} +x $@ ${CHMOD} +x $@
square: square.calc
rm -f $@
${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
${CHMOD} +x $@

65
cscript/README Normal file
View File

@@ -0,0 +1,65 @@
calc shell script examples
--------------------------
These calc shell scripts are provided because they serve as examples of
how use the calc language, and/or because the authors thought them to
be useful!
If you write something that you think is useful, please send it to:
calc-contrib at asthe dot com
[[ NOTE: Replace 'at' with @, 'dot' is with . and remove the spaces ]]
[[ NOTE: The EMail address uses 'asthe' and the web site URL uses 'isthe' ]]
For more info, see:
help script
help cscript
=-=
mersenne exp
Print the value of 2^exp-1.
piforever
Print the value of pi forever, or as long as you cpu / memory allows.
plus arg ...
Print the sum of 1 or more arguments.
simple
A trivial example of a calc shell script.
## Copyright (C) 1999 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License
## as published by the Free Software Foundation.
##
## Calc is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
## Public License for more details.
##
## A copy of version 2.1 of the GNU Lesser General Public License is
## distributed with calc under the filename COPYING-LGPL. You should have
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.4 $
## @(#) $Id: README,v 29.4 2000/06/07 14:02:59 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/README,v $
##
## Under source code control: 1999/12/17 10:23:40
## File existed as early as: 1999
##
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/

View File

@@ -1,4 +1,4 @@
#!/usr/local/src/cmd/calc/calc -S #!/usr/local/src/cmd/calc/calc -q -s -f
# #
# mersenne - print the value of a mersenne number # mersenne - print the value of a mersenne number
# #
@@ -18,15 +18,15 @@
# 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. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.1 $ # @(#) $Revision: 29.3 $
# @(#) $Id: mersenne.calc,v 29.1 1999/12/14 09:15:35 chongo Exp $ # @(#) $Id: mersenne.calc,v 29.3 2000/12/15 14:56:54 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/mersenne.calc,v $ # @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/mersenne.calc,v $
# #
# Under source code control: 1999/11/30 00:09:01; # Under source code control: 1999/11/30 00:09:01;
# File existed as early as: 1999 # File existed as early as: 1999
# #
# chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ # chongo <was here> /\oo/\ http://www.isthe.com/chongo/
# Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ # Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
# usage: # usage:
# mersenne exp # mersenne exp
@@ -35,13 +35,19 @@
/* /*
* parse args * parse args
*/ */
if (argv() != 1) { if (argv() != 2) {
/* we include the name of this script in the error message */ /* we include the name of this script in the error message */
fprintf(files(2), "usage: %s exp\n", config("program")); fprintf(files(2), "usage: %s exp\n", config("program"));
abort "wrong number of args"; abort "wrong number of args";
} }
global n = eval(argv(1));
if (!isint(n) || n <= 0) {
quit "Argument to be a positive integer";
}
/* /*
* print the decimal value of 2^n-1 * print the decimal value of 2^n-1
*/ */
print "2^": argv(0) : "-1 =", 2^eval(argv(0))-1; print "2^": n : "-1 =", 2^n-1;

View File

@@ -1,4 +1,4 @@
#!/usr/local/src/cmd/calc/calc -S #!/usr/local/src/cmd/calc/calc -q -f
# #
# piforever - print digits of pi forever (or as long as your mem/cpu allow) # piforever - print digits of pi forever (or as long as your mem/cpu allow)
# #
@@ -18,15 +18,15 @@
# 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. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.1 $ # @(#) $Revision: 29.3 $
# @(#) $Id: piforever.calc,v 29.1 1999/12/14 09:15:36 chongo Exp $ # @(#) $Id: piforever.calc,v 29.3 2000/12/15 14:56:54 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/piforever.calc,v $ # @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/piforever.calc,v $
# #
# Under source code control: 1999/11/30 00:11:36 # Under source code control: 1999/11/30 00:11:36
# File existed as early as: 1999 # File existed as early as: 1999
# #
# chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ # chongo <was here> /\oo/\ http://www.isthe.com/chongo/
# Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ # Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
# usage: # usage:
# piforever # piforever

View File

@@ -1,4 +1,4 @@
#!/usr/local/src/cmd/calc/calc -S #!/usr/local/src/cmd/calc/calc -q -s -f
# #
# plus - add two or more arguments together # plus - add two or more arguments together
# #
@@ -18,15 +18,15 @@
# 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. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.1 $ # @(#) $Revision: 29.3 $
# @(#) $Id: plus.calc,v 29.1 1999/12/14 09:15:36 chongo Exp $ # @(#) $Id: plus.calc,v 29.3 2000/12/15 14:56:54 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/plus.calc,v $ # @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/plus.calc,v $
# #
# Under source code control: 1999/11/29 10:22:37 # Under source code control: 1999/11/29 10:22:37
# File existed as early as: 1999 # File existed as early as: 1999
# #
# chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ # chongo <was here> /\oo/\ http://www.isthe.com/chongo/
# Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ # Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
# usage: # usage:
# plus val ... # plus val ...
@@ -35,19 +35,19 @@
/* /*
* parse args * parse args
*/ */
if (argv() < 1) { if (argv() < 2) {
/* we include the name of this script in the error message */ /* we include the name of this script in the error message */
fprintf(files(2), "usage: %s value ...\n", config("program")); fprintf(files(2), "usage: %s value ...\n", config("program"));
abort "not enough args"; abort "not enough args";
} }
/* /*
* print the sum of the 2 args * print the sum of the args
* *
* Since args are strings, we must eval them before using them numerically. * Since args are strings, we must eval them before using them numerically.
*/ */
sum = 0; sum = 0;
for (i=0; i < argv(); ++i) { for (i=1; i < argv(); ++i) {
sum += eval(argv(i)); sum += eval(argv(i));
} }
print sum; print sum;

View File

@@ -1,4 +1,4 @@
#!/usr/local/src/cmd/calc/calc -S #!/usr/local/src/cmd/calc/calc -q -f
# #
# simple - an example of a simple calc shell script # simple - an example of a simple calc shell script
# #
@@ -18,18 +18,18 @@
# 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. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.1 $ # @(#) $Revision: 29.3 $
# @(#) $Id: simple.calc,v 29.1 1999/12/14 09:15:36 chongo Exp $ # @(#) $Id: simple.calc,v 29.3 2000/12/15 14:56:54 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/simple.calc,v $ # @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/simple.calc,v $
# #
# Under source code control: 1999/11/29 10:22:37 # Under source code control: 1999/11/29 10:22:37
# File existed as early as: 1999 # File existed as early as: 1999
# #
# chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ # chongo <was here> /\oo/\ http://www.isthe.com/chongo/
# Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ # Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
/* /*
* This is an example of a simple calc shell script. * This is an example of a simple calc shell script.
*/ */
print "The simple calc shell script works!" print "This simple calc shell script works!"

65
cscript/square.calc Normal file
View File

@@ -0,0 +1,65 @@
#!/usr/local/src/cmd/calc/calc -q -f
#
# sqaure - print the squares of input values
#
# Copyright (C) 2000 Ernest Bowen
#
# Calc is open software; you can redistribute it and/or modify it under
# the terms of the version 2.1 of the GNU Lesser General Public License
# as published by the Free Software Foundation.
#
# Calc is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
# Public License for more details.
#
# A copy of version 2.1 of the GNU Lesser General Public License is
# distributed with calc under the filename COPYING-LGPL. You should have
# received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
# @(#) $Revision: 29.3 $
# @(#) $Id: square.calc,v 29.3 2000/12/17 14:31:58 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/square.calc,v $
#
# Under source code control: 2000/12/15 06:52:01
# File existed as early as: 2000
#
# Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
# Usage:
#
# From the shell:
#
# ./square
# cat file | ./square
# echo "123" | ./square
#
# Within calc:
#
# > read square
#
# With input from a terminal, there is no prompt but each non-empty
# line of input is evaluated as a calc expression and if it can be
# calculated, the square of the value of that expression is displayed.
# Execution stops when an empty line is input.
#
# From the shell:
#
# ./square
#
# The following shows lines of input followed by output:
#
# 1234
# 1522756
# ln(2)
# ~.48045301391820142467
# config("mode","frac"), bernoulli(10)
# 25/4356
# config("mode", "hex"), 0xff
# 0xfe01
#
global s;
while ((s = prompt("")))
print "\t":eval(s)^2;

View File

@@ -17,15 +17,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.3 $
* @(#) $Id: custom.c,v 29.1 1999/12/14 09:15:36 chongo Exp $ * @(#) $Id: custom.c,v 29.3 2001/03/17 21:31:47 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/custom.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/custom.c,v $
* *
* Under source code control: 1997/03/03 04:53:08 * Under source code control: 1997/03/03 04:53:08
* File existed as early as: 1997 * File existed as early as: 1997
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
@@ -34,11 +34,10 @@
#include "value.h" #include "value.h"
#include "custom.h" #include "custom.h"
#include <stdio.h>
#if defined(CUSTOM) #if defined(CUSTOM)
#include <stdio.h>
#include "calc.h" #include "calc.h"
#include "have_string.h" #include "have_string.h"

View File

@@ -17,15 +17,15 @@
* 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. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.1 $ * @(#) $Revision: 29.2 $
* @(#) $Id: custom.h,v 29.1 1999/12/14 09:15:36 chongo Exp $ * @(#) $Id: custom.h,v 29.2 2000/06/07 14:02:13 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/custom.h,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/custom.h,v $
* *
* Under source code control: 1997/03/03 04:53:08 * Under source code control: 1997/03/03 04:53:08
* File existed as early as: 1997 * File existed as early as: 1997
* *
* chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ * chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/ */
/* /*

View File

@@ -57,12 +57,12 @@ pzasusb8.cal
## 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. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## ##
## @(#) $Revision: 29.1 $ ## @(#) $Revision: 29.2 $
## @(#) $Id: CUSTOM_CAL,v 29.1 1999/12/14 09:15:36 chongo Exp $ ## @(#) $Id: CUSTOM_CAL,v 29.2 2000/06/07 14:03:03 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/CUSTOM_CAL,v $ ## @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/CUSTOM_CAL,v $
## ##
## Under source code control: 1997/03/08 20:51:32 ## Under source code control: 1997/03/08 20:51:32
## File existed as early as: 1997 ## File existed as early as: 1997
## ##
## chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ ## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/

View File

@@ -635,12 +635,12 @@ Step 12: Contribute
## 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. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## ##
## @(#) $Revision: 29.1 $ ## @(#) $Revision: 29.2 $
## @(#) $Id: HOW_TO_ADD,v 29.1 1999/12/14 09:15:36 chongo Exp $ ## @(#) $Id: HOW_TO_ADD,v 29.2 2000/06/07 14:03:03 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/HOW_TO_ADD,v $ ## @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/HOW_TO_ADD,v $
## ##
## Under source code control: 1997/03/10 03:03:21 ## Under source code control: 1997/03/10 03:03:21
## File existed as early as: 1997 ## File existed as early as: 1997
## ##
## chongo <was here> /\oo/\ http://reality.sgi.com/chongo/ ## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/ ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/

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