mirror of
https://github.com/lcn2/calc.git
synced 2025-08-22 01:23:28 +03:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
bea726fc16 | ||
|
fc0a3dd183 | ||
|
63d9b22067 | ||
|
fc85ac3791 | ||
|
3d55811205 | ||
|
296aa50ac7 |
71
BUGS
71
BUGS
@@ -83,6 +83,51 @@ Problems with known work-a-rounds:
|
||||
to fail the regression test. The work-a-round is to compile with -O
|
||||
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
|
||||
barfs on on the SVAL macro. The work-a-round is to use the Solaric cc
|
||||
Makefile set sets -DFORCE_STDC. I.e,:
|
||||
@@ -163,6 +208,28 @@ Problems with known work-a-rounds:
|
||||
or performance. The work-a-round is to ignore these warnings
|
||||
under BSDI.
|
||||
|
||||
* The chi.cal resource file does not work well with odd degrees
|
||||
of freedom. Can someone improve this algorithm?
|
||||
|
||||
* The intfile.cal resource file reads and writes big or little Endian
|
||||
integers to/from files the hard way. It does NOT use blkcpy. The
|
||||
following code:
|
||||
|
||||
i = (ord("\n") << 16) | (ord("i") << 8) | ord("H")
|
||||
b = blk()
|
||||
copy(i, b)
|
||||
fd = fopen("file", "w")
|
||||
copy(b, fd);
|
||||
fclose(fd)
|
||||
|
||||
will write an extra NUL octet to the file. Where as:
|
||||
|
||||
read intfile
|
||||
i = (ord("\n") << 16) | (ord("i") << 8) | ord("H")
|
||||
be2file(i, "file2")
|
||||
|
||||
will not.
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
##
|
||||
## Calc is open software; you can redistribute it and/or modify it under
|
||||
@@ -179,8 +246,8 @@ Problems with known work-a-rounds:
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.5 $
|
||||
## @(#) $Id: BUGS,v 29.5 2000/06/07 14:02:13 chongo Exp $
|
||||
## @(#) $Revision: 29.10 $
|
||||
## @(#) $Id: BUGS,v 29.10 2001/04/08 11:32:52 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/RCS/BUGS,v $
|
||||
##
|
||||
## Under source code control: 1994/03/18 14:06:13
|
||||
|
157
CHANGES
157
CHANGES
@@ -1,3 +1,134 @@
|
||||
The following are the changes from calc version 2.11.5t2 to date:
|
||||
|
||||
Fixed a bug, reported by Ernest Bowen <ernie at turing dot
|
||||
une dot edu dot au> that caused command lines to be echoed in
|
||||
interactive mode. Fixed a bug that sometimes left the terminal
|
||||
in a non-echoing state when calc exited.
|
||||
|
||||
|
||||
The following are the changes from calc version 2.11.5t0 to date:
|
||||
|
||||
Fixed a compile problem with Linux 2.4 / Debian. Thanks goes
|
||||
to Martin Buck <m at rtin-buck dot de> for help with this issue.
|
||||
|
||||
Fixed a bug in how L64_FORMAT (it determined if "%ld" or "%lld"
|
||||
is appropriate for printing of 64 bit long longs) was determined.
|
||||
Thanks goes to Martin Buck <m at rtin-buck dot de> for reporting
|
||||
this bug and testing the fix.
|
||||
|
||||
An effort was made to make calc easier to build under Windoz
|
||||
using the Cygwin project (http://sources.redhat.com/cygwin/).
|
||||
Thanks to the work of Thomas Jones-Low (tjoneslo and softstart
|
||||
dot com), a number of #if defined(_WIN32)'s have been added
|
||||
to calc source. These changes should not effect Windoz
|
||||
free system such as GNU/Linux, Solaris, POSIX-like, etc ...
|
||||
|
||||
Added windll.h to deal with Windoz related DLL issues.
|
||||
Using the convention of 'extern DLL' instead of 'DLL extern'
|
||||
to deal with symbols that export to or import from a DLL.
|
||||
|
||||
Added HAVE_MALLOC_H, HAVE_STDLIB_H, HAVE_STRING_H, HAVE_TIMES_H,
|
||||
HAVE_SYS_TIMES_H, HAVE_TIME_H, HAVE_SYS_TIME_H, HAVE_UNISTD_H
|
||||
and HAVE_URANDOM to the Makefile. If these symcols are empty,
|
||||
then the Makefile looks for the appropriate system include file.
|
||||
If they are YES, then the Makefile will assume they exist.
|
||||
If they are NO, then the Makefile will assume they do not exist.
|
||||
|
||||
Changed HAVE_URANDOM to match the empty, YES, NO values.
|
||||
If HAVE_URANDOM is empty, then the Makefile will look for /dev/urandom.
|
||||
If HAVE_URANDOM is YES, then the Makefile will assume /dev/urandom exists.
|
||||
If HAVE_URANDOM is NO, then the Makefile will assume /dev/urandom does
|
||||
not exist.
|
||||
|
||||
If TERMCONTROL is -DUSE_WIN32, then the Windoz terminal control
|
||||
(no TERMIOS, no TERMIO, no SGTTY) will be assumed.
|
||||
|
||||
Added a win32_hsrc Makefile rule to create hsrc files appropriate
|
||||
for a Windoz system using Cygwin gcc environment. Added win32.mkdef
|
||||
which is used by the win32_hsrc rule to set the Windoz specific
|
||||
Makefile values to build hsrc files. The hsrc files are built
|
||||
under the win32 directory.
|
||||
|
||||
Added FPOS_POS_BITS, OFF_T_BITS, DEV_BITS and INODE_BITS Makefile
|
||||
symbiols to allow one to force the size of a file position, file
|
||||
offset, dev and inode value. Leaving these values blank will
|
||||
Makefile to determine their size.
|
||||
|
||||
Fixed a bug in the way file offsets, device and inode values are copied.
|
||||
|
||||
Added chi.cal for a initial stab as a Chi^2 function. The chi_prob()
|
||||
function does not work well with odd degrees of freedom, however.
|
||||
|
||||
Added big 3 to config("resource_debug"). Calc resource file scripts
|
||||
check for config("resource_debug") & 8 prior to printing internal debug
|
||||
statements. Thus by default they do not print them.
|
||||
|
||||
Added intfile.cal as a calc resource file script:
|
||||
|
||||
file2be(filename)
|
||||
|
||||
Read filename and return an integer that is built from the
|
||||
octets in that file in Big Endian order. The first octets
|
||||
of the file become the most significant bits of the integer.
|
||||
|
||||
file2le(filename)
|
||||
|
||||
Read filename and return an integer that is built from the
|
||||
octets in that file in Little Endian order. The first octets
|
||||
of the file become the most significant bits of the integer.
|
||||
|
||||
be2file(v, filename)
|
||||
|
||||
Write the absolute value of v into filename in Big Endian order.
|
||||
The v argument must be on integer. The most significant bits
|
||||
of the integer become the first octets of the file.
|
||||
|
||||
le2file(v, filename)
|
||||
|
||||
Write the absolute value of v into filename in Little Endian order.
|
||||
The v argument must be on integer. The least significant bits
|
||||
of the integer become the last octets of the file.
|
||||
|
||||
Added the following help aliases:
|
||||
|
||||
copy blkcpy
|
||||
read command
|
||||
write command
|
||||
quit command
|
||||
exit command
|
||||
abort command
|
||||
cd command
|
||||
show command
|
||||
|
||||
Added the cscript:
|
||||
|
||||
fproduct filename term ...
|
||||
|
||||
to write the big Endian product of terms to a filename. Use - for stdout.
|
||||
|
||||
Fixed calc path in help/script.
|
||||
|
||||
Added read-only parameter, config("windows") to indicate if the system
|
||||
is MS windowz WIN32 like system.
|
||||
|
||||
Configuration values that used to return "true" or "false" now return
|
||||
1 (a true value) or 0 (a false value). Thus one can do:
|
||||
|
||||
if (config("tab")) { ... } else { ... }
|
||||
|
||||
The configuration values that now return 1 or 0 are:
|
||||
|
||||
config("tilde")
|
||||
config("tab")
|
||||
config("leadzero")
|
||||
config("blkverbose")
|
||||
config("verbose_quit")
|
||||
config("windows")
|
||||
|
||||
Now shipping a win32 sub-directory that contains hsrc .h files
|
||||
that have been attempted to be built for windoz.
|
||||
|
||||
|
||||
The following are the changes from calc version 2.11.4t1 to date:
|
||||
|
||||
Added missing test8600.cal test file.
|
||||
@@ -5,6 +136,28 @@ The following are the changes from calc version 2.11.4t1 to date:
|
||||
Fixes cscript files to deal with the -S flag being replaced by
|
||||
-f and possibly other flags.
|
||||
|
||||
Added regression tests for builtin functions bernoulli, catalan,
|
||||
euler, freeeuler, and sleep. Added non-base 10 regression tests
|
||||
for digit, digits and places.
|
||||
|
||||
The bernoulli.cal script now just calls the bernoulli() builtin
|
||||
function. It remains for backward compatibility.
|
||||
|
||||
The Makefile now builds have_fpos_pos.h to determine if the
|
||||
a non-scalar FILEPOS has a __pos stucture element. If it does,
|
||||
the FILEPOS_BITS is taken to be the size of just the __pos element.
|
||||
|
||||
Misc fixes related to non-scalar (e.g., structure) FILEPOS. Fixed
|
||||
a compile problems where non-scalar FILEPOS were incorrectly assigned.
|
||||
|
||||
Fixed make depend rule.
|
||||
|
||||
Return an error on malloc / realloc failures for bernoulli and
|
||||
euler functions.
|
||||
|
||||
Added MAKEFILE_REV make variable to help determine Makefile version.
|
||||
Fixed the way the env rule reports Makefile values.
|
||||
|
||||
|
||||
The following are the changes from calc version 2.11.3t0 to 2.11.4:
|
||||
|
||||
@@ -5019,8 +5172,8 @@ Following is a list of visible changes to calc from version 1.24.7 to 1.26.1:
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.14 $
|
||||
## @(#) $Id: CHANGES,v 29.14 2000/12/15 14:58:20 chongo Exp $
|
||||
## @(#) $Revision: 29.27 $
|
||||
## @(#) $Id: CHANGES,v 29.27 2001/04/08 22:05:40 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
|
||||
##
|
||||
## Under source code control: 1993/06/02 18:12:57
|
||||
|
23
COPYING
23
COPYING
@@ -12,8 +12,8 @@ This file is Copyrighted
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
# @(#) $Revision: 29.3 $
|
||||
# @(#) $Id: COPYING,v 29.3 2000/12/14 09:18:06 chongo Exp $
|
||||
# @(#) $Revision: 29.5 $
|
||||
# @(#) $Id: COPYING,v 29.5 2000/12/18 10:22:55 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/RCS/COPYING,v $
|
||||
|
||||
=-=
|
||||
@@ -140,7 +140,7 @@ Calc copyrights and exception files
|
||||
-----------------------------------
|
||||
|
||||
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 and Landon Curt Noll
|
||||
@@ -150,12 +150,11 @@ Calc copyrights and exception files
|
||||
Copyright (C) year Ernest Bowen and Landon Curt Noll
|
||||
Copyright (C) year Ernest Bowen
|
||||
|
||||
A few files are not covered under the GNU Lesser General Public
|
||||
License. The source files not covered are:
|
||||
These files are not covered under one of the Copyrights listed above:
|
||||
|
||||
shs1.c shs1.h shs.c shs.h
|
||||
md5.c md5.h lib/qtime.cal COPYING
|
||||
COPYING-LGPL
|
||||
md5.c md5.h COPYING COPYING-LGPL
|
||||
cal/qtime.cal
|
||||
|
||||
The file COPYING-LGPL, which contains a copy of the version 2.1
|
||||
GNU Lesser General Public License, is itself Copyrighted by the
|
||||
@@ -168,10 +167,12 @@ Calc copyrights and exception files
|
||||
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. 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.
|
||||
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.
|
||||
|
||||
=-=
|
||||
|
||||
|
116
README.WINDOWS
Normal file
116
README.WINDOWS
Normal file
@@ -0,0 +1,116 @@
|
||||
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
|
||||
|
||||
You will find generated versions of these files located in the win32
|
||||
sub-directory. These files may be appropriate for your Cygwin building
|
||||
needs. Just copy the win32/*.[ch] files up into the top level calc
|
||||
source directory, edited (if needed) and build using the Cygwin GCC
|
||||
compiler.
|
||||
|
||||
=-=
|
||||
|
||||
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.6 $
|
||||
## @(#) $Id: README.WINDOWS,v 29.6 2001/04/08 22:13:38 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/
|
@@ -18,8 +18,8 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# @(#) $Revision: 29.3 $
|
||||
# @(#) $Id: Makefile,v 29.3 2000/12/15 14:42:52 chongo Exp $
|
||||
# @(#) $Revision: 29.5 $
|
||||
# @(#) $Id: Makefile,v 29.5 2001/03/31 16:24:17 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1991/07/21 05:00:54
|
||||
@@ -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 \
|
||||
beer.cal hello.cal test5100.cal test5200.cal randombitrun.cal \
|
||||
randomrun.cal xx_print.cal natnumset.cal qtime.cal test8400.cal \
|
||||
test8500.cal test8600.cal
|
||||
test8500.cal test8600.cal chi.cal intfile.cal
|
||||
|
||||
# These files are found (but not built) in the distribution
|
||||
#
|
||||
|
67
cal/README
67
cal/README
@@ -74,6 +74,12 @@ have meanings are as follows:
|
||||
the reading of a file, a message saying what has been done
|
||||
is displayed.
|
||||
|
||||
2 Show func will display more information about a functions
|
||||
arguments as well as more argument sdummary information.
|
||||
|
||||
3 During execution, allow calc standard resource files
|
||||
to output additional debugging information.
|
||||
|
||||
The value for config("resource_debug") in both oldstd and newstd is 3,
|
||||
but if calc is invoked with the -d flag, its initial value is zero.
|
||||
Thus, if calc is started without the -d flag, until config("resource_debug")
|
||||
@@ -97,6 +103,14 @@ either of the bottom 2 bits set:
|
||||
print "funcB(size, mass, ...) defined";
|
||||
}
|
||||
|
||||
If your the resource file needs to output special debugging informatin,
|
||||
we recommend that you check for bit 3 of the config("resource_debug")
|
||||
before printing the debug statement:
|
||||
|
||||
if (config("resource_debug") & 8) {
|
||||
print "DEBUG: This a sample debug statement";
|
||||
}
|
||||
|
||||
=-=
|
||||
|
||||
The following is a brief description of some of the calc resource files
|
||||
@@ -116,6 +130,10 @@ bernoulli.cal
|
||||
|
||||
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
|
||||
|
||||
@@ -124,6 +142,24 @@ bigprime.cal
|
||||
A prime test, base a, on p*2^x+1 for even x>m.
|
||||
|
||||
|
||||
chi.cal
|
||||
|
||||
Z(x[, eps])
|
||||
P(x[, eps])
|
||||
chi_prob(chi_sq, v[, eps])
|
||||
|
||||
Computes the Probability, given the Null Hypothesis, that a given
|
||||
Chi squared values >= chi_sq with v degrees of freedom.
|
||||
|
||||
The chi_prob() function does not work well with odd degrees of freedom.
|
||||
It is reasonable with even degrees of freedom, although one must give
|
||||
a sifficently small error term as the degress gets large (>100).
|
||||
|
||||
The Z(x) and P(x) are internal statistical funcions.
|
||||
|
||||
eps is an optional epsilon() like error term.
|
||||
|
||||
|
||||
chrem.cal
|
||||
|
||||
chrem(r1,m1 [,r2,m2, ...])
|
||||
@@ -159,6 +195,33 @@ hello.cal
|
||||
http://www.latech.edu/~acm/helloworld/calc.html
|
||||
|
||||
|
||||
intfile.cal
|
||||
|
||||
file2be(filename)
|
||||
|
||||
Read filename and return an integer that is built from the
|
||||
octets in that file in Big Endian order. The first octets
|
||||
of the file become the most significant bits of the integer.
|
||||
|
||||
file2le(filename)
|
||||
|
||||
Read filename and return an integer that is built from the
|
||||
octets in that file in Little Endian order. The first octets
|
||||
of the file become the most significant bits of the integer.
|
||||
|
||||
be2file(v, filename)
|
||||
|
||||
Write the absolute value of v into filename in Big Endian order.
|
||||
The v argument must be on integer. The most significant bits
|
||||
of the integer become the first octets of the file.
|
||||
|
||||
le2file(v, filename)
|
||||
|
||||
Write the absolute value of v into filename in Little Endian order.
|
||||
The v argument must be on integer. The least significant bits
|
||||
of the integer become the last octets of the file.
|
||||
|
||||
|
||||
lucas.cal
|
||||
|
||||
lucas(h, n)
|
||||
@@ -752,8 +815,8 @@ xx_print.cal
|
||||
## 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,v 29.3 2000/12/04 20:11:52 chongo Exp $
|
||||
## @(#) $Revision: 29.8 $
|
||||
## @(#) $Id: README,v 29.8 2001/03/31 16:26:23 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/README,v $
|
||||
##
|
||||
## Under source code control: 1990/02/15 01:50:32
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* 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
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.2 $
|
||||
* @(#) $Id: bernoulli.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $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 $
|
||||
*
|
||||
* Under source code control: 1991/09/30 11:18:41
|
||||
@@ -29,12 +29,16 @@
|
||||
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
* where b is a dummy value, and each power b^i gets replaced by B(i).
|
||||
* For example, for n = 3:
|
||||
*
|
||||
* (b+1)^4 - 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
|
||||
@@ -48,11 +52,14 @@
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
static Bnmax;
|
||||
static mat Bn[1001];
|
||||
*/
|
||||
|
||||
define B(n)
|
||||
{
|
||||
/*
|
||||
local nn, np1, i, sum, mulval, divval, combval;
|
||||
|
||||
if (!isint(n) || (n < 0))
|
||||
@@ -85,4 +92,6 @@ define B(n)
|
||||
}
|
||||
Bnmax = n;
|
||||
return Bn[n];
|
||||
*/
|
||||
return bernoulli(n);
|
||||
}
|
||||
|
251
cal/chi.cal
Normal file
251
cal/chi.cal
Normal file
@@ -0,0 +1,251 @@
|
||||
/*
|
||||
* chi - chi^2 probabilities with degrees of freedom for null hypothesis
|
||||
*
|
||||
* Copyright (C) 2001 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.2 $
|
||||
* @(#) $Id: chi.cal,v 29.2 2001/04/08 10:21:23 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/chi.cal,v $
|
||||
*
|
||||
* Under source code control: 2001/03/27 14:10:11
|
||||
* 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/
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Z(x)
|
||||
*
|
||||
* From Handbook of Mathematical Functions
|
||||
* 10th printing, Dec 1972 with corrections
|
||||
* National Bureau of Standards
|
||||
*
|
||||
* Section 26.2.1, p931.
|
||||
*/
|
||||
define Z(x, eps_term)
|
||||
{
|
||||
local eps; /* error term */
|
||||
|
||||
/* obtain the error term */
|
||||
if (isnull(eps_term)) {
|
||||
eps = epsilon();
|
||||
} else {
|
||||
eps = eps_term;
|
||||
}
|
||||
|
||||
/* compute Z(x) value */
|
||||
return exp(-x*x/2, eps) / sqrt(2*pi(eps), eps);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* P(x[, eps]) asymtotic P(x) expansion for x>0 to an given epsilon error term
|
||||
*
|
||||
* NOTE: If eps is omitted, the stored epsilon value is used.
|
||||
*
|
||||
* From Handbook of Mathematical Functions
|
||||
* 10th printing, Dec 1972 with corrections
|
||||
* National Bureau of Standards
|
||||
*
|
||||
* 26.2.11, p932:
|
||||
*
|
||||
* P(x) = 1/2 + Z(x) * sum(n=0; n < infinity){x^(2*n+1)/(1*3*5*...(2*n+1)};
|
||||
*
|
||||
* We continue the fraction until it is less than epsilon error term.
|
||||
*
|
||||
* Also note 26.2.5:
|
||||
*
|
||||
* P(x) + Q(x) = 1
|
||||
*/
|
||||
define P(x, eps_term)
|
||||
{
|
||||
local eps; /* error term */
|
||||
local s; /* sum */
|
||||
local x2; /* x^2 */
|
||||
local x_term; /* x^(2*r+1) */
|
||||
local odd_prod; /* 1*3*5* ... */
|
||||
local odd_term; /* next odd value to multiply into odd_prod */
|
||||
local term; /* the recent term added to the sum */
|
||||
|
||||
/* obtain the error term */
|
||||
if (isnull(eps_term)) {
|
||||
eps = epsilon();
|
||||
} else {
|
||||
eps = eps_term;
|
||||
}
|
||||
|
||||
/* firewall */
|
||||
if (x <= 0) {
|
||||
if (x == 0) {
|
||||
return 0; /* hack */
|
||||
} else {
|
||||
quit "Q(x[,eps]) 1st argument must be >= 0";
|
||||
}
|
||||
}
|
||||
if (eps <= 0) {
|
||||
quit "Q(x[,eps]) 2nd argument must be > 0";
|
||||
}
|
||||
|
||||
/*
|
||||
* aproximate sum(n=0; n < infinity){x^(2*n+1)/(1*3*5*...(2*n+1)}
|
||||
*/
|
||||
x2 = x*x;
|
||||
x_term = x;
|
||||
s = x_term; /* 1st term */
|
||||
odd_term = 1;
|
||||
odd_prod = 1;
|
||||
do {
|
||||
|
||||
/* compute the term */
|
||||
odd_term += 2;
|
||||
odd_prod *= odd_term;
|
||||
x_term *= x2;
|
||||
term = x_term / odd_prod;
|
||||
s += term;
|
||||
|
||||
} while (term >= eps);
|
||||
|
||||
/* apply term and factor */
|
||||
return 0.5 + Z(x,eps)*s;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* chi_prob(chi_sq, v[, eps]) - Prob of >= chi^2 with v degrees of freedom
|
||||
*
|
||||
* Computes the Probability, given the Null Hypothesis, that a given
|
||||
* Chi squared values >= chi_sq with v degrees of freedom.
|
||||
*
|
||||
* The chi_prob() function does not work well with odd degrees of freedom.
|
||||
* It is reasonable with even degrees of freedom, although one must give
|
||||
* a sifficently small error term as the degress gets large (>100).
|
||||
*
|
||||
* NOTE: This function does not work well with odd degrees of freedom.
|
||||
* Can somebody help / find a bug / provide a better method of
|
||||
* this odd degrees of freedom case?
|
||||
*
|
||||
* NOTE: This function works well with even degrees of freedom. However
|
||||
* when the even degrees gets large (say, as you approach 100), you
|
||||
* need to increase your error term.
|
||||
*
|
||||
* From Handbook of Mathematical Functions
|
||||
* 10th printing, Dec 1972 with corrections
|
||||
* National Bureau of Standards
|
||||
*
|
||||
* Section 26.4.4, p941:
|
||||
*
|
||||
* For odd v:
|
||||
*
|
||||
* Q(chi_sq, v) = 2*Q(chi) + 2*Z(chi) * (
|
||||
* sum(r=1, r<=(r-1)/2) {(chi_sq^r/chi) / (1*3*5*...(2*r-1)});
|
||||
*
|
||||
* chi = sqrt(chi_sq)
|
||||
*
|
||||
* NOTE: Q(x) = 1-P(x)
|
||||
*
|
||||
* Section 26.4.5, p941.
|
||||
*
|
||||
* For even v:
|
||||
*
|
||||
* Q(chi_sq, v) = sqrt(2*pi()) * Z(chi) * ( 1 +
|
||||
* sum(r=1, r=((v-2)/2)) { chi_sq^r / (2*4*...*(2r)) } );
|
||||
*
|
||||
* chi = sqrt(chi_sq)
|
||||
*
|
||||
* Observe that:
|
||||
*
|
||||
* Z(x) = exp(-x*x/2) / sqrt(2*pi()); (Section 26.2.1, p931)
|
||||
*
|
||||
* and thus:
|
||||
*
|
||||
* sqrt(2*pi()) * Z(chi) =
|
||||
* sqrt(2*pi()) * Z(sqrt(chi_sq)) =
|
||||
* sqrt(2*pi()) * exp(-sqrt(chi_sq)*sqrt(chi_sq)/2) / sqrt(2*pi()) =
|
||||
* exp(-sqrt(chi_sq)*sqrt(chi_sq)/2) =
|
||||
* exp(-sqrt(-chi_sq/2)
|
||||
*
|
||||
* So:
|
||||
*
|
||||
* Q(chi_sq, v) = exp(-sqrt(-chi_sq/2) * ( 1 + sum(....){...} );
|
||||
*/
|
||||
define chi_prob(chi_sq, v, eps_term)
|
||||
{
|
||||
local eps; /* error term */
|
||||
local r; /* index in finite sum */
|
||||
local r_lim; /* limit value for r */
|
||||
local s; /* sum */
|
||||
local d; /* demoninator (2*4*6*... or 1*3*5...) */
|
||||
local chi_term; /* chi_sq^r */
|
||||
local ret; /* return value */
|
||||
|
||||
/* obtain the error term */
|
||||
if (isnull(eps_term)) {
|
||||
eps = epsilon();
|
||||
} else {
|
||||
eps = eps_term;
|
||||
}
|
||||
|
||||
/*
|
||||
* odd degrees of freedom
|
||||
*/
|
||||
if (isodd(v)) {
|
||||
|
||||
local chi; /* sqrt(chi_sq) */
|
||||
|
||||
/* setup for sum */
|
||||
s = 1;
|
||||
d = 1;
|
||||
chi = sqrt(abs(chi_sq), eps);
|
||||
chi_term = chi;
|
||||
r_lim = (v-1)/2;
|
||||
|
||||
/* compute sum(r=1, r=((v-1)/2)) {(chi_sq^r/chi) / (1*3*5...*(2r-1))} */
|
||||
for (r=2; r <= r_lim; ++r) {
|
||||
chi_term *= chi_sq;
|
||||
d *= (2*r)-1;
|
||||
s += chi_term/d;
|
||||
}
|
||||
|
||||
/* apply term and factor, Q(x) = 1-P(x) */
|
||||
ret = 2*(1-P(chi)) + 2*Z(chi)*s;
|
||||
|
||||
/*
|
||||
* even degrees of freedom
|
||||
*/
|
||||
} else {
|
||||
|
||||
/* setup for sum */
|
||||
s =1;
|
||||
d = 1;
|
||||
chi_term = 1;
|
||||
r_lim = (v-2)/2;
|
||||
|
||||
/* compute sum(r=1, r=((v-2)/2)) { chi_sq^r / (2*4*...*(2r)) } */
|
||||
for (r=1; r <= r_lim; ++r) {
|
||||
chi_term *= chi_sq;
|
||||
d *= r*2;
|
||||
s += chi_term/d;
|
||||
}
|
||||
|
||||
/* apply factor - see observation in the main comment above */
|
||||
ret = exp(-chi_sq/2, eps) * s;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
222
cal/intfile.cal
Normal file
222
cal/intfile.cal
Normal file
@@ -0,0 +1,222 @@
|
||||
/*
|
||||
* intfile - integer to file and file to integer conversion
|
||||
*
|
||||
* Copyright (C) 2001 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: intfile.cal,v 29.4 2001/04/08 08:13:10 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/intfile.cal,v $
|
||||
*
|
||||
* Under source code control: 2001/03/31 08:13:11
|
||||
* 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/
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* NOTE: Because leading HALF values are trimmed from integer, a file
|
||||
* that begins with lots of 0 bits (in the case of big endian)
|
||||
* or that ends with lots of 0 bits (in the case of little endian)
|
||||
* will be changed when the subsequent integer is written back.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* file2be - convert a file into an big endian integer
|
||||
*
|
||||
* given:
|
||||
* filename filename to read
|
||||
*
|
||||
* returns:
|
||||
* integer read from its contents on big endian order
|
||||
*/
|
||||
define file2be(filename)
|
||||
{
|
||||
local fd; /* open file */
|
||||
local ret; /* integer to return */
|
||||
local c; /* character read from the file */
|
||||
local i;
|
||||
|
||||
/*
|
||||
* open the file for reading
|
||||
*/
|
||||
fd = fopen(filename, "r");
|
||||
if (!isfile(fd)) quit "file2be: cannot open file for reading";
|
||||
|
||||
/*
|
||||
* read the contents of the file
|
||||
*
|
||||
* The first octets become the most significant bits of the integer.
|
||||
*/
|
||||
ret = 0;
|
||||
while (! isnull(c = fgetc(fd))) {
|
||||
ret <<= 8;
|
||||
ret += ord(c);
|
||||
}
|
||||
|
||||
/*
|
||||
* cleanup and return the integer
|
||||
*/
|
||||
fclose(fd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* file2le - convert a file into an little endian integer
|
||||
*
|
||||
* given:
|
||||
* filename filename to read
|
||||
*
|
||||
* returns:
|
||||
* integer read from its contents on little endian order
|
||||
*/
|
||||
define file2le(filename)
|
||||
{
|
||||
local fd; /* open file */
|
||||
local ret; /* integer to return */
|
||||
local c; /* character read from the file */
|
||||
local shft; /* bit shift for the c value */
|
||||
local i;
|
||||
|
||||
/*
|
||||
* open the file for reading
|
||||
*/
|
||||
fd = fopen(filename, "r");
|
||||
if (!isfile(fd)) quit "file2le: cannot open file for reading";
|
||||
|
||||
/*
|
||||
* read the contents of the file into a string
|
||||
*
|
||||
* The first octets become are the least significant bits of the integer.
|
||||
*/
|
||||
ret = 0;
|
||||
shft = 0;
|
||||
while (! isnull(c = fgetc(fd))) {
|
||||
ret |= (ord(c) << shft);
|
||||
shft += 8;
|
||||
}
|
||||
|
||||
/*
|
||||
* cleanup and return the integer
|
||||
*/
|
||||
fclose(fd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* be2file - convert a big endian integer into a file
|
||||
*
|
||||
* given:
|
||||
* v integer to write to the file
|
||||
* filename filename to write
|
||||
*
|
||||
* returns:
|
||||
* The number of octets written to the file.
|
||||
*
|
||||
* NOTE: The absolute value of the integer is written to the file.
|
||||
*/
|
||||
define be2file(v, filename)
|
||||
{
|
||||
local fd; /* open file */
|
||||
local octlen; /* length of v in octets */
|
||||
local i;
|
||||
|
||||
/*
|
||||
* firewall
|
||||
*/
|
||||
if (!isint(v)) {
|
||||
quit "be2file: 1st arg not an integer";
|
||||
}
|
||||
v = abs(v);
|
||||
|
||||
/*
|
||||
* open the file for writing
|
||||
*/
|
||||
fd = fopen(filename, "w");
|
||||
if (!isfile(fd)) quit "be2file: cannot open file for writing";
|
||||
|
||||
/*
|
||||
* write the octets to the file
|
||||
*
|
||||
* The most significant bits of the integer become the first file octets.
|
||||
*/
|
||||
octlen = int((highbit(v)+8) / 8);
|
||||
for (i=octlen-1; i >= 0; --i) {
|
||||
fputc(fd, char(v >> (i*8)));
|
||||
}
|
||||
|
||||
/*
|
||||
* cleanup
|
||||
*/
|
||||
fclose(fd);
|
||||
return octlen;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* le2file - convert a little endian integer into a file
|
||||
*
|
||||
* given:
|
||||
* v integer to write to the file
|
||||
* filename filename to write
|
||||
*
|
||||
* returns:
|
||||
* The number of octets written to the file.
|
||||
*
|
||||
* NOTE: The absolute value of the integer is written to the file.
|
||||
*/
|
||||
define le2file(v, filename)
|
||||
{
|
||||
local fd; /* open file */
|
||||
local cnt; /* octets written */
|
||||
|
||||
/*
|
||||
* firewall
|
||||
*/
|
||||
if (!isint(v)) {
|
||||
quit "be2file: 1st arg not an integer";
|
||||
}
|
||||
v = abs(v);
|
||||
|
||||
/*
|
||||
* open the file for writing
|
||||
*/
|
||||
fd = fopen(filename, "w");
|
||||
if (!isfile(fd)) quit "le2file: cannot open file for writing";
|
||||
|
||||
/*
|
||||
* Write the octets to the file.
|
||||
*
|
||||
* The least significant bits of the integer become the first file octets.
|
||||
*/
|
||||
cnt = 0;
|
||||
while (v > 0) {
|
||||
fputc(fd, char(v));
|
||||
v >>= 8;
|
||||
++cnt;
|
||||
}
|
||||
|
||||
/*
|
||||
* cleanup
|
||||
*/
|
||||
fclose(fd);
|
||||
return cnt;
|
||||
}
|
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.2 $
|
||||
* @(#) $Id: lucas.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: lucas.cal,v 29.3 2001/03/31 13:31:34 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/lucas.cal,v $
|
||||
*
|
||||
* Under source code control: 1990/05/03 16:49:51
|
||||
@@ -1030,7 +1030,7 @@ gen_v1(h, n)
|
||||
define
|
||||
ldebug(funct, str)
|
||||
{
|
||||
if (config("resource_debug") & 3) {
|
||||
if (config("resource_debug") & 8) {
|
||||
print "DEBUG:", funct:":", str;
|
||||
}
|
||||
return;
|
||||
|
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.2 $
|
||||
* @(#) $Id: lucas_chk.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: lucas_chk.cal,v 29.3 2001/03/31 13:31:34 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/lucas_chk.cal,v $
|
||||
*
|
||||
* Under source code control: 1991/01/11 05:41:43
|
||||
@@ -336,7 +336,7 @@ lucas_chk(high_n, quiet)
|
||||
|
||||
/* skip primes where h>=2^n */
|
||||
if (highbit(h_p[i]) >= n_p[i]) {
|
||||
if (config("resource_debug") & 3) {
|
||||
if (config("resource_debug") & 8) {
|
||||
print "h>=2^n skip:", h_p[i]:"*2^":n_p[i]:"-1";
|
||||
}
|
||||
continue;
|
||||
|
@@ -1,24 +1,46 @@
|
||||
/*
|
||||
* 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:
|
||||
* qtime(utc_hr_offset)
|
||||
*
|
||||
* 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://www.isthe.com/chongo/>
|
||||
*
|
||||
* See:
|
||||
* http://www.magnetic-ink.dk/download/qtime.html
|
||||
*
|
||||
* for examples of qtime() written on other languages.
|
||||
*
|
||||
* @(#) $Revision: 29.2 $
|
||||
* @(#) $Id: qtime.cal,v 29.2 2000/06/07 14:02:25 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.
|
||||
*/
|
||||
|
||||
|
||||
|
128
cal/regress.cal
128
cal/regress.cal
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: regress.cal,v 29.5 2000/12/04 20:00:53 chongo Exp $
|
||||
* @(#) $Revision: 29.7 $
|
||||
* @(#) $Id: regress.cal,v 29.7 2001/04/08 10:09:39 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:50:36
|
||||
@@ -411,10 +411,10 @@ define test_config()
|
||||
'516: config("pow2") == 40');
|
||||
vrfy(config("redc2") == 50,
|
||||
'517: config("redc2") == 50');
|
||||
vrfy(config("tilde") == "true",
|
||||
'518: config("tilde") == "true"');
|
||||
vrfy(config("tab") == "true",
|
||||
'519: config("tab") == "true"');
|
||||
vrfy(config("tilde"),
|
||||
'518: config("tilde")');
|
||||
vrfy(config("tab"),
|
||||
'519: config("tab")');
|
||||
vrfy(config("quomod") == 0,
|
||||
'520: config("quomod") == 0');
|
||||
vrfy(config("quo") == 2,
|
||||
@@ -433,10 +433,10 @@ define test_config()
|
||||
'527: config("outround") == 2');
|
||||
vrfy(config("round") == 24,
|
||||
'528: config("round") == 24');
|
||||
vrfy(config("leadzero") == "false",
|
||||
'529: config("leadzero") == "false"');
|
||||
vrfy(config("fullzero") == "false",
|
||||
'530: config("fullzero") == "false"');
|
||||
vrfy(config("leadzero") == 0,
|
||||
'529: config("leadzero") == 0');
|
||||
vrfy(config("fullzero") == 0,
|
||||
'530: config("fullzero") == 0');
|
||||
vrfy(config("maxscan") == 20,
|
||||
'531: config("maxscan") == 20');
|
||||
vrfy(config("prompt") == "> ",
|
||||
@@ -452,10 +452,10 @@ define test_config()
|
||||
vrfy(config("quo", 0) == 2, '536: config("quo", 0) == 2');
|
||||
vrfy(config("outround", 24) == 2,
|
||||
'537: config("outround", 24) == 2');
|
||||
vrfy(config("leadzero","y") == "false",
|
||||
'538: config("leadzero","y") == "false"');
|
||||
vrfy(config("fullzero", 1) == "false",
|
||||
'539: config("fullzero", 1) == "false"');
|
||||
vrfy(config("leadzero","y") == 0,
|
||||
'538: config("leadzero","y") == 0');
|
||||
vrfy(config("fullzero", 1) == 0,
|
||||
'539: config("fullzero", 1) == 0');
|
||||
vrfy(config("prompt", "; ") == "> ",
|
||||
'540: config("prompt", "; ") == "> "');
|
||||
vrfy(config("more", ";; ") == ">> ",
|
||||
@@ -467,14 +467,14 @@ define test_config()
|
||||
'543: config("all",callcfg) == newcfg');
|
||||
vrfy(config("display",2) == 20,
|
||||
'544: config("display",2) == 20');
|
||||
vrfy(config("fullzero",1) == "false",
|
||||
'545: config("fullzero",1) == "false"');
|
||||
vrfy(config("fullzero",1) == 0,
|
||||
'545: config("fullzero",1) == 0');
|
||||
vrfy(strprintf("%d %d %d", 0, 1, 2) == ".00 1.00 2.00",
|
||||
'546: strprintf("%d %d %d", 0, 1, 2) == ".00 1.00 2.00"');
|
||||
vrfy(config("display",20) == 2,
|
||||
'547: config("display",20) == 2');
|
||||
vrfy(config("fullzero",0) == "true",
|
||||
'548: config("fullzero",0) == "true"');
|
||||
vrfy(config("fullzero",0),
|
||||
'548: config("fullzero",0)');
|
||||
vrfy(strprintf("%d %d %d", 0, 1, 2) == "0 1 2",
|
||||
'549: strprintf("%d %d %d", 0, 1, 2) == "0 1 2"');
|
||||
|
||||
@@ -996,8 +996,13 @@ define test_functions()
|
||||
vrfy(strpos(a, "abc") == 1, '946: strpos(a, "abc") == 1');
|
||||
vrfy(strpos(a, "xyz") == 0, '947: strpos(a, "xyz") == 0');
|
||||
vrfy(strpos(a, a) == 1, '948: strpos(a, a) == 1');
|
||||
if (config("windows")) {
|
||||
print '949: test skipped for windows systems';
|
||||
print '950: test skipped for windows systems';
|
||||
} else {
|
||||
vrfy(system("") == 0, '949: system("") == 0');
|
||||
vrfy(system("true") == 0, '950: system("true") == 0');
|
||||
}
|
||||
print '951: test disabled due to stdin dependency';
|
||||
print '952: test removed';
|
||||
print '953: test removed';
|
||||
@@ -1223,7 +1228,85 @@ define test_functions()
|
||||
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)');
|
||||
|
||||
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()';
|
||||
|
||||
@@ -5034,10 +5117,17 @@ define test_is()
|
||||
*/
|
||||
a = assoc();
|
||||
print '5901: a = assoc()';
|
||||
if (config("windows")) {
|
||||
ofd = fopen("NUL:", "r");
|
||||
print '5902: ofd = fopen("NUL:", "r")';
|
||||
cfd = fopen("NUL:", "r");
|
||||
print '5903: cfd = fopen("NUL:", "r")';
|
||||
} else {
|
||||
ofd = fopen("/dev/null", "r");
|
||||
print '5902: ofd = fopen("/dev/null", "r")';
|
||||
cfd = fopen("/dev/null", "r");
|
||||
print '5903: cfd = fopen("/dev/null", "r")';
|
||||
}
|
||||
fclose(cfd);
|
||||
print '5904: fclose(cfd)';
|
||||
blk = blk();
|
||||
|
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.2 $
|
||||
* @(#) $Id: seedrandom.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: seedrandom.cal,v 29.3 2001/03/31 13:31:34 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/seedrandom.cal,v $
|
||||
*
|
||||
* Under source code control: 1996/01/01 08:21:00
|
||||
@@ -115,7 +115,7 @@ define seedrandom(seed1, seed2, size, trials)
|
||||
p = 2*fp+1;
|
||||
} while (ptest(p,1,0) == 0);
|
||||
} while(ptest(p, trials) == 0 || ptest(fp, trials) == 0);
|
||||
if (config("resource_debug") & 3) {
|
||||
if (config("resource_debug") & 8) {
|
||||
print "/* 1st Blum prime */ p=", p;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ define seedrandom(seed1, seed2, size, trials)
|
||||
q = 2*fq+1;
|
||||
} while (ptest(q,1,0) == 0);
|
||||
} while(ptest(q, trials) == 0 || ptest(fq, trials) == 0);
|
||||
if (config("resource_debug") & 3) {
|
||||
if (config("resource_debug") & 8) {
|
||||
print "/* 2nd Blum prime */ q=", q;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ define seedrandom(seed1, seed2, size, trials)
|
||||
n = p*q; /* the Blum modulus */
|
||||
binsize = highbit(n)+1; /* smallest power of 2 > p*q */
|
||||
r = pmod(rand(1<<ceil(binsize*4/5), 1<<(binsize-2)), 2, n);
|
||||
if (config("resource_debug") & 3) {
|
||||
if (config("resource_debug") & 8) {
|
||||
print "/* seed quadratic residue */ r=", r;
|
||||
print "/* newn", binsize, "bit quadratic residue*/ newn=", n;
|
||||
}
|
||||
|
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.2 $
|
||||
* @(#) $Id: test4600.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: test4600.cal,v 29.3 2001/04/08 10:09:39 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test4600.cal,v $
|
||||
*
|
||||
* Under source code control: 1996/07/02 20:04:40
|
||||
@@ -87,6 +87,38 @@ define stest(str, verbose)
|
||||
print '**** ftell(f) != 13 failed';
|
||||
return 1;
|
||||
}
|
||||
if (config("windows")) {
|
||||
if (search(f, "and") != 110) {
|
||||
print 'failed';
|
||||
print '**** search(f, "and") != 110 failed';
|
||||
return 1;
|
||||
}
|
||||
if (ftell(f) != 113) {
|
||||
print 'failed';
|
||||
print '**** ftell(f) != 113 failed';
|
||||
return 1;
|
||||
}
|
||||
if (!isnull(search(f, "and"))) {
|
||||
print 'failed';
|
||||
print '**** !isnull(search(f, "and")) failed';
|
||||
return 1;
|
||||
}
|
||||
if (ftell(f) != 174) {
|
||||
print 'failed';
|
||||
print '**** ftell(f) != 174 failed';
|
||||
return 1;
|
||||
}
|
||||
if (rsearch(f, "and") != 110) {
|
||||
print 'failed';
|
||||
print '**** rsearch(f, "and") != 110 failed';
|
||||
return 1;
|
||||
}
|
||||
if (ftell(f) != 112) {
|
||||
print 'failed';
|
||||
print '**** ftell(f) != 112 failed';
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (search(f, "and") != 109) {
|
||||
print 'failed';
|
||||
print '**** search(f, "and") != 109 failed';
|
||||
@@ -117,6 +149,7 @@ define stest(str, verbose)
|
||||
print '**** ftell(f) != 111 failed';
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (iserror(fseek(f, -4, 1))) {
|
||||
print 'failed';
|
||||
print '**** iserror(fseek(f, -4, 1)) failed';
|
||||
|
24
calc.c
24
calc.c
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: calc.c,v 29.5 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Revision: 29.7 $
|
||||
* @(#) $Id: calc.c,v 29.7 2001/03/17 21:31:47 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:11
|
||||
@@ -32,10 +32,27 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <pwd.h>
|
||||
|
||||
#if !defined (_WIN32)
|
||||
# include <pwd.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
# include <io.h>
|
||||
/*
|
||||
* getopt.h file is from the Cygwin GNU library
|
||||
*
|
||||
* See:
|
||||
* http://sources.redhat.com/cygwin/
|
||||
*/
|
||||
# include "../getopt/getopt.h"
|
||||
# define strdup _strdup
|
||||
# define isatty _isatty
|
||||
#endif /* Windoz */
|
||||
|
||||
#define CALC_C
|
||||
#include "calc.h"
|
||||
#include "hist.h"
|
||||
@@ -49,6 +66,7 @@
|
||||
#include "custom.h"
|
||||
#include "math_error.h"
|
||||
#include "args.h"
|
||||
#include "zmath.h"
|
||||
|
||||
#include "have_unistd.h"
|
||||
#if defined(HAVE_UNISTD_H)
|
||||
|
229
calc.h
229
calc.h
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: calc.h,v 29.5 2000/12/04 19:32:33 chongo Exp $
|
||||
* @(#) $Revision: 29.6 $
|
||||
* @(#) $Id: calc.h,v 29.6 2001/03/17 21:31:47 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:31
|
||||
@@ -32,9 +32,8 @@
|
||||
#define __CALC_H__
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
#include "win32dll.h"
|
||||
#include "value.h"
|
||||
|
||||
#include "have_const.h"
|
||||
|
||||
|
||||
@@ -94,134 +93,140 @@
|
||||
/*
|
||||
* File I/O routines.
|
||||
*/
|
||||
extern FILEID openid(char *name, char *mode);
|
||||
extern FILEID indexid(long index);
|
||||
extern BOOL validid(FILEID id);
|
||||
extern BOOL errorid(FILEID id);
|
||||
extern BOOL eofid(FILEID id);
|
||||
extern int closeid(FILEID id);
|
||||
extern int getcharid(FILEID id);
|
||||
extern int idprintf(FILEID id, char *fmt, int count, VALUE **vals);
|
||||
extern int idfputc(FILEID id, int ch);
|
||||
extern int idfputs(FILEID id, char *str);
|
||||
extern int printid(FILEID id, int flags);
|
||||
extern int flushid(FILEID id);
|
||||
extern int readid(FILEID id, int flags, char **retptr);
|
||||
extern int getloc(FILEID id, ZVALUE *loc);
|
||||
extern int setloc(FILEID id, ZVALUE zpos);
|
||||
extern int getsize(FILEID id, ZVALUE *size);
|
||||
extern int get_device(FILEID id, ZVALUE *dev);
|
||||
extern int get_inode(FILEID id, ZVALUE *ino);
|
||||
extern FILEID reopenid(FILEID id, char *mode, char *name);
|
||||
extern int closeall(void);
|
||||
extern int flushall(void);
|
||||
extern int idfputstr(FILEID id, char *str);
|
||||
extern int rewindid(FILEID id);
|
||||
extern void rewindall(void);
|
||||
extern ZVALUE zfilesize(FILEID id);
|
||||
extern void showfiles(void);
|
||||
extern int fscanfid(FILEID id, char *fmt, int count, VALUE **vals);
|
||||
extern int scanfstr(char *str, char *fmt, int count, VALUE **vals);
|
||||
extern int ftellid(FILEID id, ZVALUE *res);
|
||||
extern int fseekid(FILEID id, ZVALUE offset, int whence);
|
||||
extern int isattyid(FILEID id);
|
||||
extern int fsearch(FILEID id, char *str, ZVALUE start, ZVALUE end, ZVALUE *res);
|
||||
extern int frsearch(FILEID id, char *str, ZVALUE first, ZVALUE last, ZVALUE *res);
|
||||
extern void showconstants(void);
|
||||
extern void freeconstant(unsigned long);
|
||||
extern void freestringconstant(long);
|
||||
extern void trimconstants(void);
|
||||
extern DLL FILEID openid(char *name, char *mode);
|
||||
extern DLL FILEID indexid(long index);
|
||||
extern DLL BOOL validid(FILEID id);
|
||||
extern DLL BOOL errorid(FILEID id);
|
||||
extern DLL BOOL eofid(FILEID id);
|
||||
extern DLL int closeid(FILEID id);
|
||||
extern DLL int getcharid(FILEID id);
|
||||
extern DLL int idprintf(FILEID id, char *fmt, int count, VALUE **vals);
|
||||
extern DLL int idfputc(FILEID id, int ch);
|
||||
extern DLL int idfputs(FILEID id, char *str);
|
||||
extern DLL int printid(FILEID id, int flags);
|
||||
extern DLL int flushid(FILEID id);
|
||||
extern DLL int readid(FILEID id, int flags, char **retptr);
|
||||
extern DLL int getloc(FILEID id, ZVALUE *loc);
|
||||
extern DLL int setloc(FILEID id, ZVALUE zpos);
|
||||
extern DLL int getsize(FILEID id, ZVALUE *size);
|
||||
extern DLL int get_device(FILEID id, ZVALUE *dev);
|
||||
extern DLL int get_inode(FILEID id, ZVALUE *ino);
|
||||
extern DLL FILEID reopenid(FILEID id, char *mode, char *name);
|
||||
extern DLL int closeall(void);
|
||||
|
||||
#if !defined(_WIN32)
|
||||
extern DLL int flushall(void);
|
||||
#endif
|
||||
|
||||
extern DLL int idfputstr(FILEID id, char *str);
|
||||
extern DLL int rewindid(FILEID id);
|
||||
extern DLL void rewindall(void);
|
||||
extern DLL ZVALUE zfilesize(FILEID id);
|
||||
extern DLL void showfiles(void);
|
||||
extern DLL int fscanfid(FILEID id, char *fmt, int count, VALUE **vals);
|
||||
extern DLL int scanfstr(char *str, char *fmt, int count, VALUE **vals);
|
||||
extern DLL int ftellid(FILEID id, ZVALUE *res);
|
||||
extern DLL int fseekid(FILEID id, ZVALUE offset, int whence);
|
||||
extern DLL int isattyid(FILEID id);
|
||||
extern DLL int fsearch(FILEID id, char *str, ZVALUE start, ZVALUE end, ZVALUE *res);
|
||||
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.
|
||||
*/
|
||||
extern int openstring(char *str, long num);
|
||||
extern int openterminal(void);
|
||||
extern int opensearchfile(char *name, char *pathlist, char *exten, int reopen_ok);
|
||||
extern char *nextline(void);
|
||||
extern int nextchar(void);
|
||||
extern void reread(void);
|
||||
extern void resetinput(void);
|
||||
extern void setprompt(char *);
|
||||
extern BOOL inputisterminal(void);
|
||||
extern int inputlevel(void);
|
||||
extern long calclevel(void);
|
||||
extern char *inputname(void);
|
||||
extern long linenumber(void);
|
||||
extern void runrcfiles(void);
|
||||
extern void closeinput(void);
|
||||
extern DLL int openstring(char *str, long num);
|
||||
extern DLL int openterminal(void);
|
||||
extern DLL int opensearchfile(char *name, char *pathlist, char *exten, int reopen_ok);
|
||||
extern DLL char *nextline(void);
|
||||
extern DLL int nextchar(void);
|
||||
extern DLL void reread(void);
|
||||
extern DLL void resetinput(void);
|
||||
extern DLL void setprompt(char *);
|
||||
extern DLL BOOL inputisterminal(void);
|
||||
extern DLL int inputlevel(void);
|
||||
extern DLL long calclevel(void);
|
||||
extern DLL char *inputname(void);
|
||||
extern DLL long linenumber(void);
|
||||
extern DLL void runrcfiles(void);
|
||||
extern DLL void closeinput(void);
|
||||
|
||||
/*
|
||||
* Other routines.
|
||||
*/
|
||||
extern NUMBER *constvalue(unsigned long index);
|
||||
extern long addnumber(char *str);
|
||||
extern long addqconstant(NUMBER *q);
|
||||
extern void initstack(void);
|
||||
extern void getcommands(BOOL toplevel);
|
||||
extern void givehelp(char *type);
|
||||
extern void libcalc_call_me_first(void);
|
||||
extern void libcalc_call_me_last(void);
|
||||
extern BOOL calc_tty(int fd);
|
||||
extern BOOL orig_tty(int fd);
|
||||
extern void showerrors(void);
|
||||
extern char *calc_strdup(CONST char *);
|
||||
extern DLL NUMBER *constvalue(unsigned long index);
|
||||
extern DLL long addnumber(char *str);
|
||||
extern DLL long addqconstant(NUMBER *q);
|
||||
extern DLL void initstack(void);
|
||||
extern DLL void getcommands(BOOL toplevel);
|
||||
extern DLL void givehelp(char *type);
|
||||
extern DLL void libcalc_call_me_first(void);
|
||||
extern DLL void libcalc_call_me_last(void);
|
||||
extern DLL BOOL calc_tty(int fd);
|
||||
extern DLL BOOL orig_tty(int fd);
|
||||
extern DLL void showerrors(void);
|
||||
extern DLL char *calc_strdup(CONST char *);
|
||||
|
||||
/*
|
||||
* Initialization
|
||||
*/
|
||||
extern void initialize(void);
|
||||
extern void reinitialize(void);
|
||||
extern int isatty(int tty); /* TRUE if fd is a tty */
|
||||
extern char *version(void); /* return version string */
|
||||
extern int post_init; /* TRUE => setjmp for math_error is ready */
|
||||
extern DLL void initialize(void);
|
||||
extern DLL void reinitialize(void);
|
||||
#if !defined (_WIN32)
|
||||
extern DLL int isatty(int tty); /* TRUE if fd is a tty */
|
||||
#endif
|
||||
extern DLL char *version(void); /* return version string */
|
||||
extern DLL int post_init; /* TRUE => math_error setjmp is ready */
|
||||
|
||||
/*
|
||||
* global flags and definitions
|
||||
*/
|
||||
extern int abortlevel; /* current level of aborts */
|
||||
extern BOOL inputwait; /* TRUE if in a terminal input wait */
|
||||
extern jmp_buf jmpbuf; /* for errors */
|
||||
extern DLL int abortlevel; /* current level of aborts */
|
||||
extern DLL BOOL inputwait; /* TRUE if in a terminal input wait */
|
||||
extern DLL jmp_buf jmpbuf; /* for errors */
|
||||
|
||||
extern int p_flag; /* TRUE => pipe mode */
|
||||
extern int q_flag; /* TRUE => don't execute rc files */
|
||||
extern int u_flag; /* TRUE => unbuffer stdin and stdout */
|
||||
extern int d_flag; /* TRUE => disable heading, resource_debug */
|
||||
extern int c_flag; /* TRUE => continue after error if permitted */
|
||||
extern int i_flag; /* TRUE => try to go interactive after error */
|
||||
extern int s_flag; /* TRUE => keep args as strings for argv() */
|
||||
extern int stoponerror; /* >0 => stop, <0 => continue, ==0 => use -c */
|
||||
extern BOOL abort_now; /* TRUE => try to go interactive */
|
||||
extern DLL int p_flag; /* TRUE => pipe mode */
|
||||
extern DLL int q_flag; /* TRUE => don't execute rc files */
|
||||
extern DLL int u_flag; /* TRUE => unbuffer stdin and stdout */
|
||||
extern DLL int d_flag; /* TRUE => disable heading, resource_debug */
|
||||
extern DLL int c_flag; /* TRUE => continue after error if permitted */
|
||||
extern DLL int i_flag; /* TRUE => try to go interactive after error */
|
||||
extern DLL int s_flag; /* TRUE => keep args as strings for argv() */
|
||||
extern DLL int stoponerror; /* >0 => stop, <0 => continue, ==0 => use -c */
|
||||
extern DLL BOOL abort_now; /* TRUE => try to go interactive */
|
||||
|
||||
extern int argc_value; /* count of argv[] strings for argv() builtin */
|
||||
extern char **argv_value; /* argv[] strings for argv() builtin */
|
||||
extern DLL int argc_value; /* count of argv[] strings for argv() builtin */
|
||||
extern DLL char **argv_value; /* argv[] strings for argv() builtin */
|
||||
|
||||
extern char *pager; /* $PAGER or default */
|
||||
extern int stdin_tty; /* TRUE if stdin is a tty */
|
||||
extern int havecommands; /* TRUE if have cmd args) */
|
||||
extern char *program; /* our name */
|
||||
extern char *base_name; /* basename of our name */
|
||||
extern char cmdbuf[]; /* command line expression */
|
||||
extern DLL char *pager; /* $PAGER or default */
|
||||
extern DLL int stdin_tty; /* TRUE if stdin is a tty */
|
||||
extern DLL int havecommands; /* TRUE if have cmd args) */
|
||||
extern DLL char *program; /* our name */
|
||||
extern DLL char *base_name; /* basename of our name */
|
||||
extern DLL char cmdbuf[]; /* command line expression */
|
||||
|
||||
extern int abortlevel; /* current level of aborts */
|
||||
extern BOOL inputwait; /* TRUE if in a terminal input wait */
|
||||
extern VALUE *stack; /* execution stack */
|
||||
extern int dumpnames; /* TRUE => dump names rather than indices */
|
||||
extern DLL int abortlevel; /* current level of aborts */
|
||||
extern DLL BOOL inputwait; /* TRUE if in a terminal input wait */
|
||||
extern DLL VALUE *stack; /* execution stack */
|
||||
extern DLL int dumpnames; /* TRUE => dump names rather than indices */
|
||||
|
||||
extern char *calcpath; /* $CALCPATH or default */
|
||||
extern char *calcrc; /* $CALCRC or default */
|
||||
extern char *calcbindings; /* $CALCBINDINGS or default */
|
||||
extern char *home; /* $HOME or default */
|
||||
extern char *shell; /* $SHELL or default */
|
||||
extern char *program; /* our name (argv[0]) */
|
||||
extern DLL char *calcpath; /* $CALCPATH or default */
|
||||
extern DLL char *calcrc; /* $CALCRC or default */
|
||||
extern DLL char *calcbindings; /* $CALCBINDINGS or default */
|
||||
extern DLL char *home; /* $HOME or default */
|
||||
extern DLL char *shell; /* $SHELL or default */
|
||||
extern DLL char *program; /* our name (argv[0]) */
|
||||
|
||||
extern int no_env; /* TRUE (-e) => ignore env vars on startup */
|
||||
extern int errmax; /* if >= 0, error when errcount exceeds errmax */
|
||||
extern int new_std; /* TRUE (-n) => use newstd configuration */
|
||||
extern DLL int no_env; /* TRUE (-e) => ignore env vars on startup */
|
||||
extern DLL int errmax; /* if >= 0, error when errcount exceeds errmax */
|
||||
extern DLL int new_std; /* TRUE (-n) => use newstd configuration */
|
||||
|
||||
extern int allow_read; /* FALSE => may not open any files for reading */
|
||||
extern int allow_write; /* FALSE => may not open any files for writing */
|
||||
extern int allow_exec; /* FALSE => may not execute any commands */
|
||||
extern DLL int allow_read; /* FALSE => dont open any files for reading */
|
||||
extern DLL int allow_write; /* FALSE => dont open any files for writing */
|
||||
extern DLL int allow_exec; /* FALSE => may not execute any commands */
|
||||
|
||||
/*
|
||||
* calc startup and run state
|
||||
@@ -237,8 +242,8 @@ typedef enum {
|
||||
RUN_EXIT, /* normal exit from calc */
|
||||
RUN_EXIT_WITH_ERROR /* exit with error */
|
||||
} run;
|
||||
extern run run_state;
|
||||
extern char *run_state_name(run state);
|
||||
extern DLL run run_state;
|
||||
extern DLL char *run_state_name(run state);
|
||||
|
||||
/*
|
||||
* calc version information
|
||||
@@ -249,7 +254,7 @@ extern int calc_minor_ver;
|
||||
extern int calc_major_patch;
|
||||
extern char *calc_minor_patch;
|
||||
extern char *Copyright;
|
||||
extern char *version(void);
|
||||
extern DLL char *version(void);
|
||||
|
||||
|
||||
#endif /* !__CALC_H__ */
|
||||
|
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: codegen.c,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: codegen.c,v 29.4 2001/03/17 21:31:47 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/codegen.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:13
|
||||
@@ -45,6 +45,10 @@
|
||||
#include "func.h"
|
||||
#include "conf.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
# include <direct.h>
|
||||
#endif
|
||||
|
||||
static BOOL rdonce; /* TRUE => do not reread this file */
|
||||
|
||||
FUNC *curfunc;
|
||||
|
62
config.c
62
config.c
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: config.c,v 29.4 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Revision: 29.6 $
|
||||
* @(#) $Id: config.c,v 29.6 2001/04/08 10:07:19 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.c,v $
|
||||
*
|
||||
* Under source code control: 1991/07/20 00:21:56
|
||||
@@ -90,6 +90,7 @@ NAMETYPE configs[] = {
|
||||
{"ctrl-d", CONFIG_CTRL_D}, /* alias for ctrl_d */
|
||||
{"program", CONFIG_PROGRAM},
|
||||
{"basename", CONFIG_BASENAME},
|
||||
{"windows", CONFIG_WINDOWS},
|
||||
{"version", CONFIG_VERSION},
|
||||
{NULL, 0}
|
||||
};
|
||||
@@ -136,6 +137,11 @@ CONFIG oldstd = { /* backward compatible standard configuration */
|
||||
CTRL_D_VIRGIN_EOF, /* ^D only exits on virgin lines */
|
||||
NULL, /* our name */
|
||||
NULL, /* basename of our name */
|
||||
#if defined(_WIN32)
|
||||
TRUE, /* running under windows */
|
||||
#else
|
||||
FALSE, /* congrats, you are not using windows */
|
||||
#endif
|
||||
NULL /* version */
|
||||
};
|
||||
CONFIG newstd = { /* new non-backward compatible configuration */
|
||||
@@ -176,6 +182,11 @@ CONFIG newstd = { /* new non-backward compatible configuration */
|
||||
CTRL_D_VIRGIN_EOF, /* ^D only exits on virgin lines */
|
||||
NULL, /* our name */
|
||||
NULL, /* basename of our name */
|
||||
#if defined(_WIN32)
|
||||
TRUE, /* running under windows */
|
||||
#else
|
||||
FALSE, /* congrats, you are not using windows */
|
||||
#endif
|
||||
NULL /* version */
|
||||
};
|
||||
CONFIG *conf = NULL; /* loaded in at startup - current configuration */
|
||||
@@ -822,11 +833,15 @@ setconfig(int type, VALUE *vp)
|
||||
/*NOTREACHED*/
|
||||
|
||||
case CONFIG_BASENAME:
|
||||
math_error("The program config parameter is read-only");
|
||||
math_error("The basename config parameter is read-only");
|
||||
/*NOTREACHED*/
|
||||
|
||||
case CONFIG_WINDOWS:
|
||||
math_error("The windows config parameter is read-only");
|
||||
/*NOTREACHED*/
|
||||
|
||||
case CONFIG_VERSION:
|
||||
math_error("The program config parameter is read-only");
|
||||
math_error("The version config parameter is read-only");
|
||||
/*NOTREACHED*/
|
||||
|
||||
default:
|
||||
@@ -1028,20 +1043,18 @@ config_value(CONFIG *cfg, int type, VALUE *vp)
|
||||
break;
|
||||
|
||||
case CONFIG_TILDE:
|
||||
vp->v_type = V_STR;
|
||||
if (cfg->tilde_ok) {
|
||||
vp->v_str = makenewstring(TRUE_STRING);
|
||||
vp->v_num = itoq(1);
|
||||
} else {
|
||||
vp->v_str = makenewstring(FALSE_STRING);
|
||||
vp->v_num = itoq(0);
|
||||
}
|
||||
return;
|
||||
|
||||
case CONFIG_TAB:
|
||||
vp->v_type = V_STR;
|
||||
if (cfg->tab_ok) {
|
||||
vp->v_str = makenewstring(TRUE_STRING);
|
||||
vp->v_num = itoq(1);
|
||||
} else {
|
||||
vp->v_str = makenewstring(FALSE_STRING);
|
||||
vp->v_num = itoq(0);
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -1082,20 +1095,18 @@ config_value(CONFIG *cfg, int type, VALUE *vp)
|
||||
break;
|
||||
|
||||
case CONFIG_LEADZERO:
|
||||
vp->v_type = V_STR;
|
||||
if (cfg->leadzero) {
|
||||
vp->v_str = makenewstring(TRUE_STRING);
|
||||
vp->v_num = itoq(1);
|
||||
} else {
|
||||
vp->v_str = makenewstring(FALSE_STRING);
|
||||
vp->v_num = itoq(0);
|
||||
}
|
||||
return;
|
||||
|
||||
case CONFIG_FULLZERO:
|
||||
vp->v_type = V_STR;
|
||||
if (cfg->fullzero) {
|
||||
vp->v_str = makenewstring(TRUE_STRING);
|
||||
vp->v_num = itoq(1);
|
||||
} else {
|
||||
vp->v_str = makenewstring(FALSE_STRING);
|
||||
vp->v_num = itoq(0);
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -1118,11 +1129,10 @@ config_value(CONFIG *cfg, int type, VALUE *vp)
|
||||
break;
|
||||
|
||||
case CONFIG_BLKVERBOSE:
|
||||
vp->v_type = V_STR;
|
||||
if (cfg->blkverbose) {
|
||||
vp->v_str = makenewstring(TRUE_STRING);
|
||||
vp->v_num = itoq(1);
|
||||
} else {
|
||||
vp->v_str = makenewstring(FALSE_STRING);
|
||||
vp->v_num = itoq(0);
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -1159,11 +1169,10 @@ config_value(CONFIG *cfg, int type, VALUE *vp)
|
||||
break;
|
||||
|
||||
case CONFIG_VERBOSE_QUIT:
|
||||
vp->v_type = V_STR;
|
||||
if (cfg->verbose_quit) {
|
||||
vp->v_str = makenewstring(TRUE_STRING);
|
||||
vp->v_num = itoq(1);
|
||||
} else {
|
||||
vp->v_str = makenewstring(FALSE_STRING);
|
||||
vp->v_num = itoq(0);
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -1195,6 +1204,14 @@ config_value(CONFIG *cfg, int type, VALUE *vp)
|
||||
}
|
||||
return;
|
||||
|
||||
case CONFIG_WINDOWS:
|
||||
if (cfg->windows) {
|
||||
vp->v_num = itoq(1);
|
||||
} else {
|
||||
vp->v_num = itoq(0);
|
||||
}
|
||||
return;
|
||||
|
||||
case CONFIG_VERSION:
|
||||
vp->v_type = V_STR;
|
||||
if (cfg->version == NULL) {
|
||||
@@ -1295,6 +1312,7 @@ config_cmp(CONFIG *cfg1, CONFIG *cfg2)
|
||||
|
||||
(cfg1->version == NULL && cfg2->version != NULL) ||
|
||||
(cfg1->version != NULL && cfg2->version == NULL) ||
|
||||
cfg1->windows != cfg2->windows ||
|
||||
(cfg1->version != NULL && cfg2->version != NULL &&
|
||||
strcmp(cfg1->version, cfg2->version) != 0);
|
||||
}
|
||||
|
34
config.h
34
config.h
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: config.h,v 29.4 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Revision: 29.8 $
|
||||
* @(#) $Id: config.h,v 29.8 2001/04/08 09:08:57 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $
|
||||
*
|
||||
* Under source code control: 1995/11/01 22:20:17
|
||||
@@ -35,6 +35,7 @@
|
||||
#define __CONFIG_H__
|
||||
|
||||
|
||||
#include "win32dll.h"
|
||||
#include "nametype.h"
|
||||
#include "qmath.h"
|
||||
|
||||
@@ -82,6 +83,7 @@
|
||||
#define CONFIG_PROGRAM 35
|
||||
#define CONFIG_BASENAME 36
|
||||
#define CONFIG_VERSION 37
|
||||
#define CONFIG_WINDOWS 38
|
||||
|
||||
|
||||
/*
|
||||
@@ -146,6 +148,7 @@ struct config {
|
||||
int ctrl_d; /* see CTRL_D_xyz below */
|
||||
char *program; /* our name */
|
||||
char *base_name; /* basename of our name */
|
||||
BOOL windows; /* TRUE => running under MS windows */
|
||||
char *version; /* calc version string */
|
||||
};
|
||||
typedef struct config CONFIG;
|
||||
@@ -157,7 +160,8 @@ typedef struct config CONFIG;
|
||||
#define RSCDBG_STDIN_FUNC (0x00000001) /* interactive func define debug */
|
||||
#define RSCDBG_FILE_FUNC (0x00000002) /* file read func define debug */
|
||||
#define RSCDBG_FUNC_INFO (0x00000004) /* print extra info for show func */
|
||||
#define RSCDBG_MASK (0x00000007)
|
||||
#define RSCDBG_PRINT_DBG (0x00000008) /* print debug messages */
|
||||
#define RSCDBG_MASK (0x0000000f)
|
||||
|
||||
|
||||
/*
|
||||
@@ -182,23 +186,23 @@ typedef struct config CONFIG;
|
||||
/*
|
||||
* global configuration states and aliases
|
||||
*/
|
||||
extern CONFIG *conf; /* current configuration */
|
||||
extern CONFIG oldstd; /* backward compatible standard configuration */
|
||||
extern CONFIG newstd; /* new non-backward compatible configuration */
|
||||
extern char *calc_debug; /* !=NULL => value of config("calc_debug") */
|
||||
extern char *resource_debug; /* !=NULL => config("resource_debug") value */
|
||||
extern char *user_debug; /* !=NULL => value of config("user_debug") */
|
||||
extern DLL CONFIG *conf; /* current configuration */
|
||||
extern DLL CONFIG oldstd; /* backward compatible standard configuration */
|
||||
extern DLL CONFIG newstd; /* new non-backward compatible configuration */
|
||||
extern DLL char *calc_debug; /* !=NULL => value of config("calc_debug") */
|
||||
extern DLL char *resource_debug; /* !=NULL => config("resource_debug") value */
|
||||
extern DLL char *user_debug; /* !=NULL => value of config("user_debug") */
|
||||
|
||||
|
||||
/*
|
||||
* configuration externals
|
||||
*/
|
||||
extern CONFIG *config_copy(CONFIG *src);
|
||||
extern void config_free(CONFIG *cfg);
|
||||
extern void config_print(CONFIG *cfg);
|
||||
extern int configtype(char*);
|
||||
extern void config_print(CONFIG*);
|
||||
extern BOOL config_cmp(CONFIG*, CONFIG*);
|
||||
extern DLL CONFIG *config_copy(CONFIG *src);
|
||||
extern DLL void config_free(CONFIG *cfg);
|
||||
extern DLL void config_print(CONFIG *cfg);
|
||||
extern DLL int configtype(char*);
|
||||
extern DLL void config_print(CONFIG*);
|
||||
extern DLL BOOL config_cmp(CONFIG*, CONFIG*);
|
||||
|
||||
|
||||
#endif /* !__CONFIG_H__ */
|
||||
|
@@ -17,8 +17,8 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# @(#) $Revision: 29.6 $
|
||||
# @(#) $Id: Makefile,v 29.6 2000/12/15 14:56:14 chongo Exp $
|
||||
# @(#) $Revision: 29.9 $
|
||||
# @(#) $Id: Makefile,v 29.9 2001/04/08 10:53:52 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1999/11/29 11:10:26
|
||||
@@ -76,9 +76,10 @@ FMT= fmt
|
||||
#
|
||||
# make detaillist
|
||||
#
|
||||
SCRIPT= mersenne piforever plus simple square
|
||||
SCRIPT= mersenne piforever plus simple square fproduct
|
||||
|
||||
SCRIPT_SRC= mersenne.calc piforever.calc plus.calc simple.calc square.calc
|
||||
SCRIPT_SRC= mersenne.calc piforever.calc plus.calc simple.calc square.calc \
|
||||
fproduct.calc
|
||||
|
||||
# These files are found (but not built) in the distribution
|
||||
#
|
||||
@@ -114,7 +115,7 @@ all: ${SCRIPT} ${SCRIPT_SRC} .all
|
||||
distlist: ${DISTLIST}
|
||||
${Q}for i in ${DISTLIST}; do \
|
||||
echo cscript/$$i; \
|
||||
done | ${SORT}
|
||||
done | LANG=C ${SORT}
|
||||
|
||||
distdir:
|
||||
${Q}echo cscript
|
||||
@@ -131,7 +132,7 @@ detaillist:
|
||||
else \
|
||||
echo $$i; \
|
||||
fi; \
|
||||
done | ${SORT}) | ${FMT} -70 | \
|
||||
done | LANG=C ${SORT}) | ${FMT} -70 | \
|
||||
${SED} -e '1s/xxxxxxx/SCRIPT=/' -e '2,$$s/^/ /' \
|
||||
-e 's/$$/ \\/' -e '$$s/ \\$$//'
|
||||
${Q}echo
|
||||
@@ -142,7 +143,7 @@ detaillist:
|
||||
else \
|
||||
echo $$i.calc; \
|
||||
fi; \
|
||||
done | ${SORT}) | ${FMT} -70 | \
|
||||
done | LANG=C ${SORT}) | ${FMT} -70 | \
|
||||
${SED} -e '1s/xxxxxxxxxxx/SCRIPT_SRC=/' -e '2,$$s/^/ /' \
|
||||
-e 's/$$/ \\/' -e '$$s/ \\$$//'
|
||||
|
||||
@@ -249,3 +250,7 @@ square: square.calc
|
||||
rm -f $@
|
||||
${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
${CHMOD} +x $@
|
||||
fproduct: fproduct.calc
|
||||
rm -f $@
|
||||
${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
${CHMOD} +x $@
|
||||
|
@@ -19,6 +19,11 @@ For more info, see:
|
||||
|
||||
=-=
|
||||
|
||||
fproduct filename term ...
|
||||
|
||||
Write the big Endian product of terms to a file. Use - for stdout.
|
||||
|
||||
|
||||
mersenne exp
|
||||
|
||||
Print the value of 2^exp-1.
|
||||
@@ -54,8 +59,8 @@ simple
|
||||
## 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 $
|
||||
## @(#) $Revision: 29.5 $
|
||||
## @(#) $Id: README,v 29.5 2001/04/08 08:24:40 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/README,v $
|
||||
##
|
||||
## Under source code control: 1999/12/17 10:23:40
|
||||
|
88
cscript/fproduct.calc
Normal file
88
cscript/fproduct.calc
Normal file
@@ -0,0 +1,88 @@
|
||||
#!/usr/local/bin/calc -q -s -f
|
||||
/*
|
||||
* fproduct - write the big Endian product of terms to a file
|
||||
*
|
||||
* usage:
|
||||
* fproduct filename term [term ...]
|
||||
*
|
||||
* filename where to write the product, use - for stdout
|
||||
* term ... terms to multiply
|
||||
*
|
||||
* Copyright (C) 2001 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.1 $
|
||||
* @(#) $Id: fproduct.calc,v 29.1 2001/04/08 08:25:15 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/fproduct.calc,v $
|
||||
*
|
||||
* Under source code control: 2001/04/07 20:13:11
|
||||
* 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/
|
||||
*/
|
||||
|
||||
/*
|
||||
* parse args
|
||||
*/
|
||||
argc = argv();
|
||||
if (argc < 2) {
|
||||
fprintf(files(2), "usage: %s term [term ...]\n", argv(0));
|
||||
exit;
|
||||
}
|
||||
filename = argv(1);
|
||||
|
||||
|
||||
/*
|
||||
* build the product
|
||||
*/
|
||||
product = 1;
|
||||
for (i=2; i < argc; ++i) {
|
||||
product *= eval(argv(i));
|
||||
}
|
||||
product = abs(product);
|
||||
|
||||
|
||||
/*
|
||||
* open the file for writing, "-" is stdout
|
||||
*/
|
||||
if (filename == "-") {
|
||||
fd = files(1);
|
||||
} else {
|
||||
fd = fopen(filename, "w");
|
||||
if (!isfile(fd)) quit "be2file: cannot open file for writing";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* write the octets to the file
|
||||
*
|
||||
* The most significant bits of the integer become the first file octets.
|
||||
*/
|
||||
if (product > 0) {
|
||||
octlen = int((highbit(product)+8) / 8);
|
||||
for (i=octlen-1; i >= 0; --i) {
|
||||
fputc(fd, char(product >> (i*8)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* cleanup
|
||||
*/
|
||||
if (filename != "-") {
|
||||
fclose(fd);
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# sqaure - print the squares of input values
|
||||
#
|
||||
# Copyright (C) 2000 Landon Curt Noll
|
||||
# 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
|
||||
@@ -18,8 +18,8 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# @(#) $Revision: 29.1 $
|
||||
# @(#) $Id: square.calc,v 29.1 2000/12/15 14:55:59 chongo Exp $
|
||||
# @(#) $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
|
||||
@@ -27,8 +27,38 @@
|
||||
#
|
||||
# Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
||||
# usage:
|
||||
# mersenne exp
|
||||
# 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("")))
|
||||
|
7
custom.c
7
custom.c
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.2 $
|
||||
* @(#) $Id: custom.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: custom.c,v 29.3 2001/03/17 21:31:47 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/custom.c,v $
|
||||
*
|
||||
* Under source code control: 1997/03/03 04:53:08
|
||||
@@ -34,11 +34,10 @@
|
||||
#include "value.h"
|
||||
#include "custom.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(CUSTOM)
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "calc.h"
|
||||
|
||||
#include "have_string.h"
|
||||
|
@@ -18,8 +18,8 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# @(#) $Revision: 29.2 $
|
||||
# @(#) $Id: Makefile,v 29.2 2000/06/07 14:03:03 chongo Exp $
|
||||
# @(#) $Revision: 29.6 $
|
||||
# @(#) $Id: Makefile,v 29.6 2001/04/08 10:53:52 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1997/03/09 02:28:54
|
||||
@@ -406,7 +406,10 @@ depend:
|
||||
echo '#endif /* '"$$tag"' */' >> "skel/custom/$$i"; \
|
||||
done
|
||||
${Q}(cd ..; ${MAKE} hsrc)
|
||||
${Q}for i in `cd ..; ${MAKE} h_list`; do \
|
||||
${Q}for i in `cd ..; ${MAKE} h_list 2>&1 | \
|
||||
${SED} -e '/Entering directory/d' \
|
||||
-e '/Nothing to be done/d' \
|
||||
-e '/Leaving directory/d'`; do \
|
||||
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
||||
echo "#if !defined($$tag)" > "skel/$$i"; \
|
||||
echo "#define $$tag" >> "skel/$$i"; \
|
||||
@@ -429,7 +432,8 @@ depend:
|
||||
${Q}mv Makefile Makefile.bak
|
||||
${Q}${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak > Makefile
|
||||
${Q}echo "" >> Makefile
|
||||
${Q}${SED} -n '3,$$p' skel/custom/makedep.out | ${SORT} -u >> Makefile
|
||||
${Q}${SED} -n '3,$$p' skel/custom/makedep.out | \
|
||||
LANG=C ${SORT} -u >> Makefile
|
||||
-${Q}rm -rf skel
|
||||
-${Q}if cmp -s Makefile.bak Makefile; then \
|
||||
echo 'custom Makefile was already up to date'; \
|
||||
@@ -457,7 +461,7 @@ clean:
|
||||
|
||||
clobber:
|
||||
-rm -f ${TARGETS}
|
||||
rm -f .all Makefile.tmp
|
||||
rm -f .all Makefile.tmp Makefile.bak
|
||||
|
||||
install: all
|
||||
-${Q}if [ ! -d ${TOPDIR} ]; then \
|
||||
@@ -534,11 +538,13 @@ install: all
|
||||
|
||||
# DO NOT DELETE THIS LINE
|
||||
|
||||
|
||||
c_argv.o: ../alloc.h
|
||||
c_argv.o: ../block.h
|
||||
c_argv.o: ../byteswap.h
|
||||
c_argv.o: ../calc.h
|
||||
c_argv.o: ../calcerr.h
|
||||
c_argv.o: ../calc.h
|
||||
c_argv.o: c_argv.c
|
||||
c_argv.o: ../cmath.h
|
||||
c_argv.o: ../config.h
|
||||
c_argv.o: ../custom.h
|
||||
@@ -554,16 +560,17 @@ c_argv.o: ../longbits.h
|
||||
c_argv.o: ../md5.h
|
||||
c_argv.o: ../nametype.h
|
||||
c_argv.o: ../qmath.h
|
||||
c_argv.o: ../shs.h
|
||||
c_argv.o: ../shs1.h
|
||||
c_argv.o: ../shs.h
|
||||
c_argv.o: ../string.h
|
||||
c_argv.o: ../value.h
|
||||
c_argv.o: ../win32dll.h
|
||||
c_argv.o: ../zmath.h
|
||||
c_argv.o: c_argv.c
|
||||
c_devnull.o: ../alloc.h
|
||||
c_devnull.o: ../block.h
|
||||
c_devnull.o: ../byteswap.h
|
||||
c_devnull.o: ../calcerr.h
|
||||
c_devnull.o: c_devnull.c
|
||||
c_devnull.o: ../cmath.h
|
||||
c_devnull.o: ../config.h
|
||||
c_devnull.o: ../custom.h
|
||||
@@ -579,16 +586,17 @@ c_devnull.o: ../longbits.h
|
||||
c_devnull.o: ../md5.h
|
||||
c_devnull.o: ../nametype.h
|
||||
c_devnull.o: ../qmath.h
|
||||
c_devnull.o: ../shs.h
|
||||
c_devnull.o: ../shs1.h
|
||||
c_devnull.o: ../shs.h
|
||||
c_devnull.o: ../string.h
|
||||
c_devnull.o: ../value.h
|
||||
c_devnull.o: ../win32dll.h
|
||||
c_devnull.o: ../zmath.h
|
||||
c_devnull.o: c_devnull.c
|
||||
c_help.o: ../alloc.h
|
||||
c_help.o: ../block.h
|
||||
c_help.o: ../byteswap.h
|
||||
c_help.o: ../calcerr.h
|
||||
c_help.o: c_help.c
|
||||
c_help.o: ../cmath.h
|
||||
c_help.o: ../config.h
|
||||
c_help.o: ../custom.h
|
||||
@@ -604,18 +612,19 @@ c_help.o: ../longbits.h
|
||||
c_help.o: ../md5.h
|
||||
c_help.o: ../nametype.h
|
||||
c_help.o: ../qmath.h
|
||||
c_help.o: ../shs.h
|
||||
c_help.o: ../shs1.h
|
||||
c_help.o: ../shs.h
|
||||
c_help.o: ../string.h
|
||||
c_help.o: ../value.h
|
||||
c_help.o: ../win32dll.h
|
||||
c_help.o: ../zmath.h
|
||||
c_help.o: c_help.c
|
||||
c_pzasusb8.o: ../alloc.h
|
||||
c_pzasusb8.o: ../block.h
|
||||
c_pzasusb8.o: ../byteswap.h
|
||||
c_pzasusb8.o: ../calcerr.h
|
||||
c_pzasusb8.o: ../cmath.h
|
||||
c_pzasusb8.o: ../config.h
|
||||
c_pzasusb8.o: c_pzasusb8.c
|
||||
c_pzasusb8.o: ../custom.h
|
||||
c_pzasusb8.o: ../endian_calc.h
|
||||
c_pzasusb8.o: ../hash.h
|
||||
@@ -629,20 +638,21 @@ c_pzasusb8.o: ../longbits.h
|
||||
c_pzasusb8.o: ../md5.h
|
||||
c_pzasusb8.o: ../nametype.h
|
||||
c_pzasusb8.o: ../qmath.h
|
||||
c_pzasusb8.o: ../shs.h
|
||||
c_pzasusb8.o: ../shs1.h
|
||||
c_pzasusb8.o: ../shs.h
|
||||
c_pzasusb8.o: ../string.h
|
||||
c_pzasusb8.o: ../value.h
|
||||
c_pzasusb8.o: ../win32dll.h
|
||||
c_pzasusb8.o: ../zmath.h
|
||||
c_pzasusb8.o: c_pzasusb8.c
|
||||
c_sysinfo.o: ../alloc.h
|
||||
c_sysinfo.o: ../block.h
|
||||
c_sysinfo.o: ../byteswap.h
|
||||
c_sysinfo.o: ../calc.h
|
||||
c_sysinfo.o: ../calcerr.h
|
||||
c_sysinfo.o: ../calc.h
|
||||
c_sysinfo.o: ../cmath.h
|
||||
c_sysinfo.o: ../conf.h
|
||||
c_sysinfo.o: ../config.h
|
||||
c_sysinfo.o: c_sysinfo.c
|
||||
c_sysinfo.o: ../custom.h
|
||||
c_sysinfo.o: ../endian_calc.h
|
||||
c_sysinfo.o: ../fposval.h
|
||||
@@ -660,14 +670,14 @@ c_sysinfo.o: ../md5.h
|
||||
c_sysinfo.o: ../nametype.h
|
||||
c_sysinfo.o: ../prime.h
|
||||
c_sysinfo.o: ../qmath.h
|
||||
c_sysinfo.o: ../shs.h
|
||||
c_sysinfo.o: ../shs1.h
|
||||
c_sysinfo.o: ../shs.h
|
||||
c_sysinfo.o: ../string.h
|
||||
c_sysinfo.o: ../value.h
|
||||
c_sysinfo.o: ../win32dll.h
|
||||
c_sysinfo.o: ../zmath.h
|
||||
c_sysinfo.o: ../zrand.h
|
||||
c_sysinfo.o: ../zrandom.h
|
||||
c_sysinfo.o: c_sysinfo.c
|
||||
custtbl.o: ../alloc.h
|
||||
custtbl.o: ../block.h
|
||||
custtbl.o: ../byteswap.h
|
||||
@@ -675,6 +685,7 @@ custtbl.o: ../calcerr.h
|
||||
custtbl.o: ../cmath.h
|
||||
custtbl.o: ../config.h
|
||||
custtbl.o: ../custom.h
|
||||
custtbl.o: custtbl.c
|
||||
custtbl.o: ../endian_calc.h
|
||||
custtbl.o: ../hash.h
|
||||
custtbl.o: ../have_const.h
|
||||
@@ -687,9 +698,9 @@ custtbl.o: ../longbits.h
|
||||
custtbl.o: ../md5.h
|
||||
custtbl.o: ../nametype.h
|
||||
custtbl.o: ../qmath.h
|
||||
custtbl.o: ../shs.h
|
||||
custtbl.o: ../shs1.h
|
||||
custtbl.o: ../shs.h
|
||||
custtbl.o: ../string.h
|
||||
custtbl.o: ../value.h
|
||||
custtbl.o: ../win32dll.h
|
||||
custtbl.o: ../zmath.h
|
||||
custtbl.o: custtbl.c
|
||||
|
12
endian.c
12
endian.c
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.2 $
|
||||
* @(#) $Id: endian.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: endian.c,v 29.3 2001/03/18 02:59:42 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/endian.c,v $
|
||||
*
|
||||
* Under source code control: 1993/11/15 04:32:58
|
||||
@@ -48,8 +48,10 @@ char byte[8] = { (char)0x12, (char)0x36, (char)0x48, (char)0x59,
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
#if !defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)
|
||||
/* pointers into the byte order array */
|
||||
int *intp = (int *)byte;
|
||||
#endif
|
||||
#if defined(DEBUG)
|
||||
short *shortp = (short *)byte;
|
||||
long *longp = (long *)byte;
|
||||
@@ -69,6 +71,11 @@ main(void)
|
||||
printf("#define BIG_ENDIAN\t4321\n");
|
||||
printf("#define LITTLE_ENDIAN\t1234\n");
|
||||
|
||||
#if defined(LITTLE_ENDIAN)
|
||||
printf("#define CALC_BYTE_ORDER\tLITTLE_ENDIAN\n");
|
||||
#elif defined(BIG_ENDIAN)
|
||||
printf("#define CALC_BYTE_ORDER\tBIG_ENDIAN\n");
|
||||
#else
|
||||
/* Determine byte order */
|
||||
if (intp[0] == 0x12364859) {
|
||||
/* Most Significant Byte first */
|
||||
@@ -81,6 +88,7 @@ main(void)
|
||||
"Unknown int Byte Order, set CALC_BYTE_ORDER in Makefile\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
/* exit(0); */
|
||||
return 0;
|
||||
}
|
||||
|
23
file.c
23
file.c
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.2 $
|
||||
* @(#) $Id: file.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.6 $
|
||||
* @(#) $Id: file.c,v 29.6 2001/03/17 21:31:47 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/file.c,v $
|
||||
*
|
||||
* Under source code control: 1991/07/20 00:21:56
|
||||
@@ -35,15 +35,23 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "have_unistd.h"
|
||||
#if defined(HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
#include <ctype.h>
|
||||
#include "calc.h"
|
||||
#include "longbits.h"
|
||||
#include "have_fpos.h"
|
||||
#include "have_fpos_pos.h"
|
||||
#include "fposval.h"
|
||||
#include "file.h"
|
||||
#include "calcerr.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
||||
#define READSIZE 1024 /* buffer size for reading */
|
||||
|
||||
/*
|
||||
@@ -536,6 +544,7 @@ flushid(FILEID id)
|
||||
}
|
||||
|
||||
|
||||
#if !defined(_WIN32)
|
||||
int
|
||||
flushall(void)
|
||||
{
|
||||
@@ -551,6 +560,7 @@ flushall(void)
|
||||
}
|
||||
return err;
|
||||
}
|
||||
#endif /* Windoz free systems */
|
||||
|
||||
|
||||
/*
|
||||
@@ -1178,7 +1188,7 @@ filepos2z(FILEPOS pos)
|
||||
ret.len = FILEPOS_BITS/BASEB;
|
||||
ret.v = alloc(ret.len);
|
||||
zclearval(ret);
|
||||
SWAP_HALF_IN_FILEPOS(ret.v, &pos);
|
||||
SWAP_HALF_IN_FILEPOS(ret.v, (HALF *)&pos);
|
||||
ret.sign = 0;
|
||||
ztrim(&ret);
|
||||
|
||||
@@ -1239,7 +1249,8 @@ z2filepos(ZVALUE zpos)
|
||||
if (!zgtmaxfull(zpos)) {
|
||||
/* ztofull puts the value into native byte order */
|
||||
pos = ztofull(zpos);
|
||||
ret = pos;
|
||||
memset(&ret, 0, sizeof(FILEPOS));
|
||||
memcpy((void *)&ret, (void *)&pos, sizeof(pos));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1251,7 +1262,7 @@ z2filepos(ZVALUE zpos)
|
||||
memcpy(&tmp, zpos.v, sizeof(FILEPOS));
|
||||
} else {
|
||||
/* copy what bits we can into the temp value */
|
||||
tmp = 0;
|
||||
memset(&tmp, 0, sizeof(FILEPOS));
|
||||
memcpy(&tmp, zpos.v, zpos.len*BASEB/8);
|
||||
}
|
||||
/* swap into native byte order */
|
||||
|
35
fposval.c
35
fposval.c
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.2 $
|
||||
* @(#) $Id: fposval.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.6 $
|
||||
* @(#) $Id: fposval.c,v 29.6 2001/03/18 03:01:41 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/fposval.c,v $
|
||||
*
|
||||
* Under source code control: 1994/11/05 03:19:52
|
||||
@@ -63,6 +63,7 @@
|
||||
#include "endian_calc.h"
|
||||
#include "have_offscl.h"
|
||||
#include "have_posscl.h"
|
||||
#include "have_fpos_pos.h"
|
||||
|
||||
char *program; /* our name */
|
||||
|
||||
@@ -83,7 +84,15 @@ main(int argc, char **argv)
|
||||
/*
|
||||
* print the file position information
|
||||
*/
|
||||
#if defined(HAVE_FPOS_POS)
|
||||
fileposlen = FPOS_POS_BITS;
|
||||
#else /* ! HAVE_FPOS_POS */
|
||||
# if defined(FPOS_BITS)
|
||||
fileposlen = FPOS_BITS;
|
||||
# else
|
||||
fileposlen = sizeof(FILEPOS)*8;
|
||||
# endif
|
||||
#endif /* ! HAVE_FPOS_POS */
|
||||
printf("#undef FILEPOS_BITS\n");
|
||||
printf("#define FILEPOS_BITS %d\n", fileposlen);
|
||||
#if CALC_BYTE_ORDER == BIG_ENDIAN
|
||||
@@ -113,8 +122,8 @@ main(int argc, char **argv)
|
||||
* Normally a "(*(dest) = *(src))" would do, but on some
|
||||
* systems a FILEPOS is not a scalar hince we must memcpy.
|
||||
*/
|
||||
printf("#define SWAP_HALF_IN_FILEPOS(dest, src)\t%s%d%s\n",
|
||||
"memcpy((void *)(dest), (void *)(src), sizeof(",fileposlen,"))");
|
||||
printf("#define SWAP_HALF_IN_FILEPOS(dest, src)\t%s\n",
|
||||
"memcpy((void *)(dest), (void *)(src), sizeof(FPOS_POS_BITS))");
|
||||
#endif /* HAVE_FILEPOS_SCALAR */
|
||||
#endif /* CALC_BYTE_ORDER == BIG_ENDIAN */
|
||||
putchar('\n');
|
||||
@@ -122,7 +131,11 @@ main(int argc, char **argv)
|
||||
/*
|
||||
* print the stat file size information
|
||||
*/
|
||||
#if defined(OFF_T_BITS)
|
||||
stsizelen = OFF_T_BITS;
|
||||
#else
|
||||
stsizelen = sizeof(buf.st_size)*8;
|
||||
#endif
|
||||
printf("#undef OFF_T_BITS\n");
|
||||
printf("#define OFF_T_BITS %d\n", stsizelen);
|
||||
#if CALC_BYTE_ORDER == BIG_ENDIAN
|
||||
@@ -156,7 +169,7 @@ main(int argc, char **argv)
|
||||
* systems, a off_t is not a scalar hince we must memcpy.
|
||||
*/
|
||||
printf("#define SWAP_HALF_IN_OFF_T(dest, src)\t%s%d%s\n",
|
||||
"memcpy((void *)(dest), (void *)(src), sizeof(",stsizelen,"))");
|
||||
"memcpy((void *)(dest), (void *)(src), ", stsizelen/8, ")");
|
||||
#endif /* HAVE_OFF_T_SCALAR */
|
||||
#endif /* CALC_BYTE_ORDER == BIG_ENDIAN */
|
||||
putchar('\n');
|
||||
@@ -164,7 +177,11 @@ main(int argc, char **argv)
|
||||
/*
|
||||
* print the dev_t size
|
||||
*/
|
||||
#if defined(DEV_BITS)
|
||||
devlen = DEV_BITS;
|
||||
#else
|
||||
devlen = sizeof(buf.st_dev)*8;
|
||||
#endif
|
||||
printf("#undef DEV_BITS\n");
|
||||
printf("#define DEV_BITS %d\n", devlen);
|
||||
#if CALC_BYTE_ORDER == BIG_ENDIAN
|
||||
@@ -193,14 +210,18 @@ main(int argc, char **argv)
|
||||
* systems, a DEV is not a scalar hince we must memcpy.
|
||||
*/
|
||||
printf("#define SWAP_HALF_IN_DEV(dest, src)\t%s%d%s\n",
|
||||
"memcpy((void *)(dest), (void *)(src), sizeof(",devlen,"))");
|
||||
"memcpy((void *)(dest), (void *)(src), ", devlen/8, ")");
|
||||
#endif /* CALC_BYTE_ORDER == BIG_ENDIAN */
|
||||
putchar('\n');
|
||||
|
||||
/*
|
||||
* print the ino_t size
|
||||
*/
|
||||
#if defined(INODE_BITS)
|
||||
inodelen = INODE_BITS;
|
||||
#else
|
||||
inodelen = sizeof(buf.st_ino)*8;
|
||||
#endif
|
||||
printf("#undef INODE_BITS\n");
|
||||
printf("#define INODE_BITS %d\n", inodelen);
|
||||
#if CALC_BYTE_ORDER == BIG_ENDIAN
|
||||
@@ -229,7 +250,7 @@ main(int argc, char **argv)
|
||||
* systems, a INODE is not a scalar hince we must memcpy.
|
||||
*/
|
||||
printf("#define SWAP_HALF_IN_INODE(dest, src)\t%s%d%s\n",
|
||||
"memcpy((void *)(dest), (void *)(src), sizeof(",inodelen,"))");
|
||||
"memcpy((void *)(dest), (void *)(src), ", inodelen/8, ")");
|
||||
#endif /* CALC_BYTE_ORDER == BIG_ENDIAN */
|
||||
/* exit(0); */
|
||||
return 0;
|
||||
|
44
func.c
44
func.c
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: func.c,v 29.5 2000/12/04 19:32:33 chongo Exp $
|
||||
* @(#) $Revision: 29.8 $
|
||||
* @(#) $Id: func.c,v 29.8 2001/04/08 10:06:56 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/func.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:15
|
||||
@@ -35,6 +35,11 @@
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
# include <io.h>
|
||||
# define _access access
|
||||
#endif
|
||||
|
||||
#if defined(FUNCLIST)
|
||||
|
||||
#define CONST /* disabled for FUNCLIST in case NATIVE_CC doesn't have it */
|
||||
@@ -1220,8 +1225,10 @@ f_primetest(int count, NUMBER **vals)
|
||||
{
|
||||
/* parse args */
|
||||
switch (count) {
|
||||
case 1: return itoq((long) qprimetest(vals[0], &_qone_, &_qone_));
|
||||
case 2: return itoq((long) qprimetest(vals[0], vals[1], &_qone_));
|
||||
case 1: return itoq((long) qprimetest(vals[0],
|
||||
qlink(&_qone_), qlink(&_qone_)));
|
||||
case 2: return itoq((long) qprimetest(vals[0],
|
||||
vals[1], qlink(&_qone_)));
|
||||
default: return itoq((long) qprimetest(vals[0], vals[1], vals[2]));
|
||||
}
|
||||
}
|
||||
@@ -2008,7 +2015,7 @@ f_ln(int count, VALUE **vals)
|
||||
return result;
|
||||
}
|
||||
ctmp.real = vals[0]->v_num;
|
||||
ctmp.imag = &_qzero_;
|
||||
ctmp.imag = qlink(&_qzero_);
|
||||
ctmp.links = 1;
|
||||
c = cln(&ctmp, err);
|
||||
break;
|
||||
@@ -3346,7 +3353,7 @@ f_trunc(int count, NUMBER **vals)
|
||||
{
|
||||
NUMBER *val;
|
||||
|
||||
val = &_qzero_;
|
||||
val = qlink(&_qzero_);
|
||||
if (count == 2)
|
||||
val = vals[1];
|
||||
return qtrunc(*vals, val);
|
||||
@@ -3428,7 +3435,7 @@ f_btrunc(int count, NUMBER **vals)
|
||||
{
|
||||
NUMBER *val;
|
||||
|
||||
val = &_qzero_;
|
||||
val = qlink(&_qzero_);
|
||||
if (count == 2)
|
||||
val = vals[1];
|
||||
return qbtrunc(*vals, val);
|
||||
@@ -3533,7 +3540,7 @@ f_ceil(VALUE *val)
|
||||
tmp.v_subtype = V_NOSUBTYPE;
|
||||
|
||||
tmp.v_type = V_NUM;
|
||||
tmp.v_num = &_qone_;
|
||||
tmp.v_num = qlink(&_qone_);
|
||||
apprvalue(val, &tmp, &tmp, &res);
|
||||
return res;
|
||||
}
|
||||
@@ -3550,9 +3557,9 @@ f_floor(VALUE *val)
|
||||
tmp2.v_subtype = V_NOSUBTYPE;
|
||||
|
||||
tmp1.v_type = V_NUM;
|
||||
tmp1.v_num = &_qone_;
|
||||
tmp1.v_num = qlink(&_qone_);
|
||||
tmp2.v_type = V_NUM;
|
||||
tmp2.v_num = &_qzero_;
|
||||
tmp2.v_num = qlink(&_qzero_);
|
||||
apprvalue(val, &tmp1, &tmp2, &res);
|
||||
return res;
|
||||
}
|
||||
@@ -4922,10 +4929,14 @@ f_listremove(VALUE *vp)
|
||||
static NUMBER *
|
||||
f_runtime(void)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
return qlink(&_qzero_);
|
||||
#else /* Windoz free systems */
|
||||
struct tms buf;
|
||||
|
||||
times(&buf);
|
||||
return iitoq((long) buf.tms_utime, (long) CLK_TCK);
|
||||
#endif /* Windoz free systems */
|
||||
}
|
||||
|
||||
|
||||
@@ -6885,7 +6896,16 @@ f_system(VALUE *vp)
|
||||
if (conf->calc_debug & CALCDBG_SYSTEM) {
|
||||
printf("%s\n", vp->v_str->s_str);
|
||||
}
|
||||
result.v_num = itoq((long) system(vp->v_str->s_str));
|
||||
#if defined(_WIN32)
|
||||
/* if the execute length is 0 then use NULL in system call */
|
||||
if (strlen(vp->v_str->s_str) == 0) {
|
||||
result.v_num = itoq((long)system(NULL));
|
||||
} else {
|
||||
result.v_num = itoq((long)system(vp->v_str->s_str));
|
||||
}
|
||||
#else /* Windoz free systems */
|
||||
result.v_num = itoq((long)system(vp->v_str->s_str));
|
||||
#endif /* Windoz free systems */
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -6898,6 +6918,7 @@ f_sleep(int count, VALUE **vals)
|
||||
NUMBER *q1, *q2;
|
||||
|
||||
res.v_type = V_NULL;
|
||||
#if !defined(_WIN32)
|
||||
if (count > 0) {
|
||||
if (vals[0]->v_type != V_NUM || qisneg(vals[0]->v_num))
|
||||
return error_value(E_SLEEP);
|
||||
@@ -6928,6 +6949,7 @@ f_sleep(int count, VALUE **vals)
|
||||
res.v_type = V_NUM;
|
||||
res.v_num = itoq(time);
|
||||
}
|
||||
#endif /* Windoz free systems */
|
||||
return res;
|
||||
}
|
||||
|
||||
|
68
have_fpos_pos.c
Normal file
68
have_fpos_pos.c
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* have_fpos_pos - Determine if a __pos element in FILEPOS
|
||||
*
|
||||
* Copyright (C) 2000 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.2 $
|
||||
* @(#) $Id: have_fpos_pos.c,v 29.2 2001/03/18 03:00:11 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/have_fpos_pos.c,v $
|
||||
*
|
||||
* Under source code control: 2000/12/17 01:23
|
||||
* File existed as early as: 2000
|
||||
*
|
||||
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
*/
|
||||
|
||||
/*
|
||||
* If the symbol HAVE_NO_FPOS is defined, we will output nothing.
|
||||
* If the HAVE_FILEPOS_SCALAR is defuned, we will output nothing.
|
||||
* If we are able to compile this program, then we must have the
|
||||
* __pos element in a non-scalar FILEPOS.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include "have_fpos.h"
|
||||
#include "have_posscl.h"
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
#if !defined(HAVE_NO_FPOS) && !defined(HAVE_FILEPOS_SCALAR)
|
||||
fpos_t pos; /* file position */
|
||||
|
||||
/* print a __pos element in fpos_t */
|
||||
printf("#undef HAVE_FPOS_POS\n");
|
||||
printf("#define HAVE_FPOS_POS 1 /* yes */\n\n");
|
||||
|
||||
/* determine __pos element size */
|
||||
printf("#undef FPOS_POS_BITS\t/* no */\n");
|
||||
# if defined(FPOS_POS_BITS)
|
||||
printf("#define FPOS_POS_BITS %d\n\n", FPOS_POS_BITS);
|
||||
# else
|
||||
printf("#define FPOS_POS_BITS %d\n\n", sizeof(pos.__pos)*8);
|
||||
# endif
|
||||
|
||||
#else
|
||||
/* we have no __pos element */
|
||||
printf("#undef HAVE_FPOS_POS\t/* no */\n");
|
||||
printf("#undef FPOS_POS_BITS\n");
|
||||
#endif
|
||||
/* exit(0); */
|
||||
return 0;
|
||||
}
|
21
help.c
21
help.c
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: help.c,v 29.4 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.8 $
|
||||
* @(#) $Id: help.c,v 29.8 2001/04/08 08:29:28 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/help.c,v $
|
||||
*
|
||||
* Under source code control: 1997/09/14 10:58:30
|
||||
@@ -42,6 +42,11 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
# define popen _popen
|
||||
# define pclose _pclose
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* some help topics are symbols, so we alias them to nice filenames
|
||||
@@ -57,6 +62,7 @@ static struct help_alias {
|
||||
{".", "oldvalue"},
|
||||
{"%", "mod"},
|
||||
{"//", "quo"},
|
||||
{"copy", "blkcpy"},
|
||||
{"copying", "COPYING"},
|
||||
{"copying-lgpl", "COPYING-LGPL"},
|
||||
{"copying_lgpl", "COPYING-LGPL"},
|
||||
@@ -65,6 +71,13 @@ static struct help_alias {
|
||||
{"COPYRIGHT", "copyright"},
|
||||
{"Copyleft", "copyright"},
|
||||
{"COPYLEFT", "copyright"},
|
||||
{"read", "command"},
|
||||
{"write", "command"},
|
||||
{"quit", "command"},
|
||||
{"exit", "command"},
|
||||
{"abort", "command"},
|
||||
{"cd", "command"},
|
||||
{"show", "command"},
|
||||
{"stdlib", "resource"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
@@ -105,7 +118,11 @@ page_file(FILE *stream)
|
||||
/*
|
||||
* form a write pipe to a pager
|
||||
*/
|
||||
if (pager == NULL || pager[0] == '\0') {
|
||||
cmd = stdout;
|
||||
} else {
|
||||
cmd = popen(pager, "w");
|
||||
}
|
||||
if (cmd == NULL) {
|
||||
fprintf(stderr, "unable form pipe to pager: %s", pager);
|
||||
return;
|
||||
|
@@ -18,8 +18,8 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# @(#) $Revision: 29.5 $
|
||||
# @(#) $Id: Makefile,v 29.5 2000/12/14 10:33:06 chongo Exp $
|
||||
# @(#) $Revision: 29.6 $
|
||||
# @(#) $Id: Makefile,v 29.6 2001/04/08 10:53:52 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/help/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1991/07/23 06:47:57
|
||||
@@ -455,7 +455,7 @@ builtin: builtin.top builtin.end ../func.c funclist.sed
|
||||
distlist: ${DISTLIST}
|
||||
${Q}for i in ${DISTLIST}; do \
|
||||
echo help/$$i; \
|
||||
done | ${SORT}
|
||||
done | LANG=C ${SORT}
|
||||
|
||||
distdir:
|
||||
${Q}echo help
|
||||
@@ -485,7 +485,7 @@ detaillist:
|
||||
else \
|
||||
echo $$i; \
|
||||
fi; \
|
||||
done | ${SORT}) | ${FMT} -70 | \
|
||||
done | LANG=C ${SORT}) | ${FMT} -70 | \
|
||||
${SED} -e '1s/xxxxx/DETAIL_HELP=/' -e '2,$$s/^/ /' \
|
||||
-e 's/$$/ \\/' -e '$$s/ \\$$//'
|
||||
|
||||
|
@@ -57,8 +57,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.3 $
|
||||
## @(#) $Id: bernoulli,v 29.3 2000/12/14 10:32:24 chongo Exp $
|
||||
## @(#) $Revision: 29.4 $
|
||||
## @(#) $Id: bernoulli,v 29.4 2000/12/17 12:27:58 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/bernoulli,v $
|
||||
##
|
||||
## Under source code control: 2000/07/13 01:33:00
|
||||
|
@@ -53,8 +53,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.1 $
|
||||
## @(#) $Id: catalan,v 29.1 2000/12/14 10:31:45 chongo Exp $
|
||||
## @(#) $Revision: 29.2 $
|
||||
## @(#) $Id: catalan,v 29.2 2000/12/17 12:27:58 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/catalan,v $
|
||||
##
|
||||
## Under source code control: 2000/12/14 01:33:00
|
||||
|
15
help/config
15
help/config
@@ -47,6 +47,7 @@ Configuration parameters
|
||||
"ctrl_d" The interactive meaning of ^D (Control D)
|
||||
"program" Read-only calc program or shell script path
|
||||
"basename" Read-only basename of the program value
|
||||
"windows" Read-only indicator of MS windows
|
||||
"version" Read-only calc version
|
||||
|
||||
The "all" config value allows one to save/restore the configuration
|
||||
@@ -539,6 +540,9 @@ Detailed config descriptions
|
||||
2 Show func will display more information about a functions
|
||||
arguments as well as more argument sdummary information.
|
||||
|
||||
3 During execution, allow calc standard resource files
|
||||
to output additional debugging information.
|
||||
|
||||
The value for config("resource_debug") in both oldstd and newstd is 3,
|
||||
but if calc is invoked with the -d flag, its initial value is zero.
|
||||
Thus, if calc is started without the -d flag, until config("resource_debug")
|
||||
@@ -674,6 +678,13 @@ Detailed config descriptions
|
||||
|
||||
=-=
|
||||
|
||||
config("windows") <== NOTE: This is a read-only config value
|
||||
|
||||
Returns TRUE if you are running on a MS windows system, false if you
|
||||
are running on an operating system that does not hate you.
|
||||
|
||||
=-=
|
||||
|
||||
config("version") <== NOTE: This is a read-only config value
|
||||
|
||||
The version string of the calc program can be obtained by:
|
||||
@@ -698,8 +709,8 @@ Detailed config descriptions
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.2 $
|
||||
## @(#) $Id: config,v 29.2 2000/06/07 14:02:33 chongo Exp $
|
||||
## @(#) $Revision: 29.4 $
|
||||
## @(#) $Id: config,v 29.4 2001/04/08 09:08:27 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/config,v $
|
||||
##
|
||||
## Under source code control: 1991/07/21 04:37:17
|
||||
|
@@ -108,8 +108,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.3 $
|
||||
## @(#) $Id: digit,v 29.3 2000/12/14 10:32:24 chongo Exp $
|
||||
## @(#) $Revision: 29.4 $
|
||||
## @(#) $Id: digit,v 29.4 2000/12/17 12:27:58 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/digit,v $
|
||||
##
|
||||
## Under source code control: 1995/10/03 10:40:01
|
||||
|
@@ -53,8 +53,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.1 $
|
||||
## @(#) $Id: euler,v 29.1 2000/12/14 10:31:45 chongo Exp $
|
||||
## @(#) $Revision: 29.2 $
|
||||
## @(#) $Id: euler,v 29.2 2000/12/17 12:27:58 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/euler,v $
|
||||
##
|
||||
## Under source code control: 2000/12/14 01:33:00
|
||||
|
@@ -53,8 +53,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.3 $
|
||||
## @(#) $Id: places,v 29.3 2000/12/14 10:32:24 chongo Exp $
|
||||
## @(#) $Revision: 29.4 $
|
||||
## @(#) $Id: places,v 29.4 2000/12/17 12:27:58 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/places,v $
|
||||
##
|
||||
## Under source code control: 1995/10/03 10:40:02
|
||||
|
10
help/script
10
help/script
@@ -144,9 +144,9 @@ Calc shell scripts
|
||||
For systems that support interpreter files, essentially the
|
||||
same thing may be done more efficiently by using calc as an
|
||||
interpreter. Assuming the full path for calc is
|
||||
/usr/bin/calc, one could use the file addall3 with contents
|
||||
/usr/local/bin/calc, one could use the file addall3 with contents
|
||||
|
||||
#!/usr/bin/calc -q -s -f
|
||||
#!/usr/local/bin/calc -q -s -f
|
||||
global i, n, s;
|
||||
n = argv();
|
||||
for (i = 1; i <= n; i++)
|
||||
@@ -166,7 +166,7 @@ Calc shell scripts
|
||||
|
||||
or what is essentially an interpreter equivalent sqrts2:
|
||||
|
||||
#!/usr/bin/calc -q -f
|
||||
#!/usr/local/bin/calc -q -f
|
||||
global s;
|
||||
while (scanf('%s', s) == 1)
|
||||
print sqrt(eval(s));
|
||||
@@ -283,8 +283,8 @@ For more information use the following calc commands:
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.4 $
|
||||
## @(#) $Id: script,v 29.4 2000/07/17 15:36:26 chongo Exp $
|
||||
## @(#) $Revision: 29.5 $
|
||||
## @(#) $Id: script,v 29.5 2001/04/08 07:56:32 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/script,v $
|
||||
##
|
||||
## Under source code control: 1999/11/30 05:29:48
|
||||
|
@@ -58,8 +58,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.1 $
|
||||
## @(#) $Id: sleep,v 29.1 2000/12/14 10:31:45 chongo Exp $
|
||||
## @(#) $Revision: 29.2 $
|
||||
## @(#) $Id: sleep,v 29.2 2000/12/17 12:27:58 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/sleep,v $
|
||||
##
|
||||
## Under source code control: 2000/12/14 01:33:00
|
||||
|
8
hist.c
8
hist.c
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.2 $
|
||||
* @(#) $Id: hist.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: hist.c,v 29.3 2001/03/17 21:31:47 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/hist.c,v $
|
||||
*
|
||||
* Under source code control: 1993/05/02 20:09:19
|
||||
@@ -40,7 +40,9 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <pwd.h>
|
||||
#if !defined(_WIN32)
|
||||
# include <pwd.h>
|
||||
#endif
|
||||
|
||||
#include "have_unistd.h"
|
||||
#if defined(HAVE_UNISTD_H)
|
||||
|
12
hist.h
12
hist.h
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.2 $
|
||||
* @(#) $Id: hist.h,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: hist.h,v 29.3 2001/03/17 21:31:47 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/hist.h,v $
|
||||
*
|
||||
* Under source code control: 1993/05/02 20:09:20
|
||||
@@ -64,10 +64,10 @@
|
||||
#define HIST_NOTTY 3 /* terminal modes could not be set */
|
||||
|
||||
|
||||
extern int hist_init(char *filename);
|
||||
extern void hist_term(void);
|
||||
extern int hist_getline(char *prompt, char *buf, int len);
|
||||
extern void hist_saveline(char *line, int len);
|
||||
extern DLL int hist_init(char *filename);
|
||||
extern DLL void hist_term(void);
|
||||
extern DLL int hist_getline(char *prompt, char *buf, int len);
|
||||
extern DLL void hist_saveline(char *line, int len);
|
||||
|
||||
|
||||
#endif /* !__HIST_H__ */
|
||||
|
47
input.c
47
input.c
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: input.c,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: input.c,v 29.5 2001/03/17 21:31:47 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/input.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:16
|
||||
@@ -35,7 +35,9 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <pwd.h>
|
||||
#if !defined(_WIN32)
|
||||
# include <pwd.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
@@ -257,6 +259,12 @@ opensearchfile(char *name, char *pathlist, char *extension, int rd_once)
|
||||
static char *
|
||||
homeexpand(char *name)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
|
||||
return NULL;
|
||||
|
||||
#else /* Windoz free systems */
|
||||
|
||||
struct passwd *ent; /* password entry */
|
||||
char *home2; /* fullpath of the home directory */
|
||||
char *fullpath; /* the malloced expanded path */
|
||||
@@ -323,6 +331,7 @@ homeexpand(char *name)
|
||||
}
|
||||
sprintf(fullpath, "%s%s", home2, after);
|
||||
return fullpath;
|
||||
#endif /* Windoz free systems */
|
||||
}
|
||||
|
||||
|
||||
@@ -795,6 +804,15 @@ runrcfiles(void)
|
||||
* This function returns the index of the readset element that matches
|
||||
* a given device/inode, -1 otherwise.
|
||||
*
|
||||
*
|
||||
* WIN32 NOTE:
|
||||
*
|
||||
* This function does not work under WIN32. The sbuf->st_ino is always
|
||||
* zero because the FAT and NTFS filesystems do not support inodes.
|
||||
* They also don't support links, which is why you need this function
|
||||
* under UNIX. For WIN32, use _fullpath() to determine if you have
|
||||
* already opened a file.
|
||||
*
|
||||
* given:
|
||||
* sbuf stat of the inode in question
|
||||
*/
|
||||
@@ -802,6 +820,9 @@ static int
|
||||
isinoderead(struct stat *sbuf)
|
||||
{
|
||||
int i;
|
||||
#if defined(_WIN32)
|
||||
char fullpathname[_MAX_PATH];
|
||||
#endif
|
||||
|
||||
/* deal with the empty case */
|
||||
if (readset == NULL || maxreadset <= 0) {
|
||||
@@ -811,12 +832,22 @@ isinoderead(struct stat *sbuf)
|
||||
|
||||
/* scan the entire readset */
|
||||
for (i=0; i < maxreadset; ++i) {
|
||||
#if defined(_WIN32)
|
||||
if (readset[i].active &&
|
||||
strcmp(readset[i].path,
|
||||
_fullpath(fullpathname,cip->i_name,
|
||||
_MAX_PATH)) == 0) {
|
||||
/* found a match */
|
||||
return i;
|
||||
}
|
||||
#else /* Windoz free systems */
|
||||
if (readset[i].active &&
|
||||
sbuf->st_dev == readset[i].inode.st_dev &&
|
||||
sbuf->st_ino == readset[i].inode.st_ino) {
|
||||
/* found a match */
|
||||
return i;
|
||||
}
|
||||
#endif /* Windoz free systems */
|
||||
}
|
||||
|
||||
/* no match found */
|
||||
@@ -923,11 +954,21 @@ addreadset(char *name, char *path, struct stat *sbuf)
|
||||
return -1;
|
||||
}
|
||||
strcpy(readset[ret].name, name);
|
||||
#if defined(_WIN32)
|
||||
/*
|
||||
* For WIN32, _fullpath expands the path to a fully qualified
|
||||
* path name, which under WIN32 FAT and NTFS is unique, just
|
||||
* like UNIX inodes. _fullpath also allocated the memory for
|
||||
* this new longer path name.
|
||||
*/
|
||||
readset[ret].path = _fullpath(NULL, path, 0);
|
||||
#else /* Windoz free systems */
|
||||
readset[ret].path = (char *)malloc(strlen(path)+1);
|
||||
if (readset[ret].path == NULL) {
|
||||
return -1;
|
||||
}
|
||||
strcpy(readset[ret].path, path);
|
||||
#endif /* Windoz free systems */
|
||||
readset[ret].inode = *sbuf;
|
||||
readset[ret].active = 1;
|
||||
|
||||
|
53
lib_calc.c
53
lib_calc.c
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: lib_calc.c,v 29.4 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Revision: 29.7 $
|
||||
* @(#) $Id: lib_calc.c,v 29.7 2001/04/08 22:05:40 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/lib_calc.c,v $
|
||||
*
|
||||
* Under source code control: 1996/06/17 18:06:19
|
||||
@@ -32,7 +32,10 @@
|
||||
#include <stdio.h>
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
#include <pwd.h>
|
||||
|
||||
#if !defined(_WIN32)
|
||||
# include <pwd.h>
|
||||
#endif
|
||||
|
||||
#include "calc.h"
|
||||
#include "zmath.h"
|
||||
@@ -63,18 +66,31 @@
|
||||
# include <termios.h>
|
||||
typedef struct termios ttystruct;
|
||||
|
||||
#elif defined(USE_TERMIOS)
|
||||
#elif defined(USE_TERMIO)
|
||||
|
||||
# include <termio.h>
|
||||
typedef struct termio ttystruct;
|
||||
|
||||
#else /* assume USE_SGTTY */
|
||||
#elif defined(USE_SGTTY)
|
||||
|
||||
# include <sys/ioctl.h>
|
||||
typedef struct sgttyb ttystruct;
|
||||
|
||||
#else
|
||||
|
||||
typedef struct {int fd;} ttystruct;
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32)
|
||||
# if !defined(USE_SGTTY) && !defined (USE_TERMIOS) && !defined(USE_TERMIO)
|
||||
|
||||
-=*#*=- A Windoz free system without termio, termios or sgtty!!! -=*#*=-
|
||||
-=*#*=- We do not know how to compile for such a host, sorry!!!! -=*#*=-
|
||||
|
||||
# endif
|
||||
#endif /* Windoz */
|
||||
|
||||
/*
|
||||
* in case we do not have certain .h files
|
||||
*/
|
||||
@@ -192,7 +208,9 @@ libcalc_call_me_first(void)
|
||||
* Disable SIGPIPE so that the pipe to the help file pager will
|
||||
* not stop calc.
|
||||
*/
|
||||
#if !defined(_WIN32)
|
||||
(void) signal(SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* determine the basename
|
||||
@@ -373,7 +391,9 @@ cvmalloc_error(char *message)
|
||||
static void
|
||||
initenv(void)
|
||||
{
|
||||
#if !defined(_WIN32)
|
||||
struct passwd *ent; /* our password entry */
|
||||
#endif
|
||||
char *c;
|
||||
|
||||
/* determine the $CALCPATH value */
|
||||
@@ -402,6 +422,12 @@ initenv(void)
|
||||
/* determine the $HOME value */
|
||||
c = (no_env ? NULL : getenv(HOME));
|
||||
home = (c ? strdup(c) : NULL);
|
||||
#if defined(_WIN32)
|
||||
if (home == NULL || home[0] == '\0') {
|
||||
/* just assume . is home if all else fails */
|
||||
home = ".";
|
||||
}
|
||||
#else /* Windoz free systems */
|
||||
if (home == NULL || home[0] == '\0') {
|
||||
ent = (struct passwd *)getpwuid(geteuid());
|
||||
if (ent == NULL) {
|
||||
@@ -411,6 +437,7 @@ initenv(void)
|
||||
home = (char *)malloc(strlen(ent->pw_dir)+1);
|
||||
strcpy(home, ent->pw_dir);
|
||||
}
|
||||
#endif /* Windoz free systems */
|
||||
|
||||
/* determine the $PAGER value */
|
||||
c = (no_env ? NULL : getenv(PAGER));
|
||||
@@ -726,10 +753,10 @@ calc_tty(int fd)
|
||||
printf("calc_tty: stty -ECHO -ECHOE -ECHOK -ICANON +ISTRIP "
|
||||
"VMIN=1 VTIME=0: fd %d\n", fd);
|
||||
|
||||
#else /* assume USE_SGTTY */
|
||||
#elif defined (USE_TERMIOS)
|
||||
|
||||
/*
|
||||
* assume USE_SGTTY tty state method
|
||||
* USE_TERMIOS tty state method
|
||||
*/
|
||||
if (fd_setup[slot] < 0 && tcgetattr(fd, fd_orig+slot) < 0) {
|
||||
if (conf->calc_debug & CALCDBG_TTY)
|
||||
@@ -752,6 +779,10 @@ calc_tty(int fd)
|
||||
if (conf->calc_debug & CALCDBG_TTY)
|
||||
printf("calc_tty: stty -ECHO -ECHOE -ECHOK -ICANON +ISTRIP "
|
||||
"VMIN=1 VTIME=0: fd %d\n", fd);
|
||||
|
||||
#else /* Using none of the above */
|
||||
fd_cur[slot] = fd_orig[slot];
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -817,7 +848,7 @@ orig_tty(int fd)
|
||||
if (conf->calc_debug & CALCDBG_TTY)
|
||||
printf("orig_tty: TCSETAW restored fd %d\n", fd);
|
||||
|
||||
#else /* assume USE_SGTTY */
|
||||
#elif defined (USE_TERMIOS)
|
||||
|
||||
/*
|
||||
* assume USE_SGTTY tty state method
|
||||
@@ -825,6 +856,12 @@ orig_tty(int fd)
|
||||
(void) tcsetattr(fd, TCSANOW, fd_orig+slot);
|
||||
if (conf->calc_debug & CALCDBG_TTY)
|
||||
printf("orig_tty: TCSANOW restored fd %d\n", fd);
|
||||
|
||||
#else /* nothing assigned */
|
||||
|
||||
if (conf->calc_debug & CALCDBG_TTY)
|
||||
printf ("orig_tty: nothing restored to fd %d\n", fd);
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
10
longlong.c
10
longlong.c
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.2 $
|
||||
* @(#) $Id: longlong.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: longlong.c,v 29.3 2001/02/23 20:46:38 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/longlong.c,v $
|
||||
*
|
||||
* Under source code control: 1994/08/05 01:09:19
|
||||
@@ -119,10 +119,10 @@ main(int argc, char **argv)
|
||||
printf(" * if defined(L64_FORMAT), ok to use %%ld\n");
|
||||
printf(" * if !defined(L64_FORMAT), use %%lld\n");
|
||||
printf(" */\n");
|
||||
if (buf[0] == '-') {
|
||||
printf("#undef L64_FORMAT\n");
|
||||
} else {
|
||||
if (strcmp(buf, "1311768467284833366") == 0) {
|
||||
printf("#define L64_FORMAT\n");
|
||||
} else {
|
||||
printf("#undef L64_FORMAT\n");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.2 $
|
||||
* @(#) $Id: math_error.h,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: math_error.h,v 29.3 2001/03/17 21:31:47 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/math_error.h,v $
|
||||
*
|
||||
* Under source code control: 1997/03/23 18:37:10
|
||||
@@ -33,10 +33,13 @@
|
||||
#define __MATH_ERROR_H__
|
||||
|
||||
|
||||
#include "win32dll.h"
|
||||
|
||||
|
||||
/*
|
||||
* Global data definitions.
|
||||
*/
|
||||
extern jmp_buf jmpbuf; /* for errors */
|
||||
extern DLL jmp_buf jmpbuf; /* for errors */
|
||||
|
||||
|
||||
#endif /* !__MATH_ERROR_H__ */
|
||||
|
11
opcodes.h
11
opcodes.h
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.2 $
|
||||
* @(#) $Id: opcodes.h,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: opcodes.h,v 29.4 2001/03/17 21:31:47 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/opcodes.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:35
|
||||
@@ -32,6 +32,9 @@
|
||||
#define __OPCODES_H__
|
||||
|
||||
|
||||
#include "win32dll.h"
|
||||
|
||||
|
||||
/*
|
||||
* Opcodes
|
||||
*/
|
||||
@@ -174,8 +177,8 @@
|
||||
/*
|
||||
* external declarations
|
||||
*/
|
||||
extern char *funcname; /* function being executed */
|
||||
extern long funcline; /* function line being executed */
|
||||
extern DLL char *funcname; /* function being executed */
|
||||
extern DLL long funcline; /* function line being executed */
|
||||
|
||||
|
||||
#endif /* !__OPCODES_H__ */
|
||||
|
34
qfunc.c
34
qfunc.c
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: qfunc.c,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: qfunc.c,v 29.4 2000/12/17 13:07:32 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qfunc.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:20
|
||||
@@ -976,6 +976,7 @@ qbern(ZVALUE z)
|
||||
long n, i, k, m, nn, dd;
|
||||
NUMBER **p;
|
||||
NUMBER *s, *s1, *c, *c1, *t;
|
||||
size_t sz;
|
||||
|
||||
if (zisone(z))
|
||||
return qlink(&_qneghalf_);
|
||||
@@ -999,15 +1000,15 @@ qbern(ZVALUE z)
|
||||
|
||||
if (m >= B_allocnum) {
|
||||
k = (m/QALLOCNUM + 1) * QALLOCNUM;
|
||||
sz = k * sizeof(NUMBER *);
|
||||
if (sz < (size_t) k)
|
||||
return NULL;
|
||||
if (B_allocnum == 0)
|
||||
p = (NUMBER **) malloc(k * sizeof(NUMBER *));
|
||||
p = (NUMBER **) malloc(sz);
|
||||
else
|
||||
p = (NUMBER **) realloc(B_table,
|
||||
k * sizeof(NUMBER *));
|
||||
if (p == NULL) {
|
||||
math_error("Not enough memory for Bernoulli numbers");
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
p = (NUMBER **) realloc(B_table, sz);
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
B_allocnum = k;
|
||||
B_table = p;
|
||||
}
|
||||
@@ -1069,6 +1070,7 @@ qeuler(ZVALUE z)
|
||||
long i, k, m, n, nn, dd;
|
||||
NUMBER **p;
|
||||
NUMBER *s, *s1, *c, *c1, *t;
|
||||
size_t sz;
|
||||
|
||||
|
||||
if (ziszero(z))
|
||||
@@ -1081,11 +1083,15 @@ qeuler(ZVALUE z)
|
||||
m = (n >> 1) - 1;
|
||||
if (m < E_num)
|
||||
return qlink(E_table[m]);
|
||||
p = (NUMBER **) realloc(E_table, (m + 1) * sizeof(NUMBER *));
|
||||
if (p == NULL) {
|
||||
math_error("Unable to allocate memory for Euler numbers");
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
sz = (m + 1) * sizeof(NUMBER *);
|
||||
if (sz < (size_t) m + 1)
|
||||
return NULL;
|
||||
if (E_num)
|
||||
p = (NUMBER **) realloc(E_table, sz);
|
||||
else
|
||||
p = (NUMBER **) malloc(sz);
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
E_table = p;
|
||||
for (k = E_num; k <= m; k++) {
|
||||
nn = 2 * k + 2;
|
||||
|
@@ -17,8 +17,8 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# @(#) $Revision: 29.2 $
|
||||
# @(#) $Id: Makefile,v 29.2 2000/06/07 14:02:54 chongo Exp $
|
||||
# @(#) $Revision: 29.5 $
|
||||
# @(#) $Id: Makefile,v 29.5 2001/04/08 10:53:52 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/sample/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1997/04/19 22:46:49
|
||||
@@ -378,7 +378,10 @@ depend:
|
||||
fi; \
|
||||
done
|
||||
${Q}(cd ..; ${MAKE} hsrc)
|
||||
${Q}for i in `cd ..; ${MAKE} h_list`; do \
|
||||
${Q}for i in `cd ..; ${MAKE} h_list 2>&1 | \
|
||||
${SED} -e '/Entering directory/d' \
|
||||
-e '/Nothing to be done/d' \
|
||||
-e '/Leaving directory/d'`; do \
|
||||
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
||||
echo "#if !defined($$tag)" > "skel/$$i"; \
|
||||
echo "#define $$tag" >> "skel/$$i"; \
|
||||
@@ -401,7 +404,8 @@ depend:
|
||||
${Q}mv Makefile Makefile.bak
|
||||
${Q}${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak > Makefile
|
||||
${Q}echo "" >> Makefile
|
||||
${Q}${SED} -n '3,$$p' skel/sample/makedep.out | ${SORT} -u >> Makefile
|
||||
${Q}${SED} -n '3,$$p' skel/sample/makedep.out | \
|
||||
LANG=C ${SORT} -u >> Makefile
|
||||
-${Q}rm -rf skel
|
||||
-${Q}if cmp -s Makefile.bak Makefile; then \
|
||||
echo 'sample Makefile was already up to date'; \
|
||||
@@ -443,11 +447,12 @@ install: all
|
||||
|
||||
# DO NOT DELETE THIS LINE
|
||||
|
||||
|
||||
many_random.o: ../alloc.h
|
||||
many_random.o: ../block.h
|
||||
many_random.o: ../byteswap.h
|
||||
many_random.o: ../calc.h
|
||||
many_random.o: ../calcerr.h
|
||||
many_random.o: ../calc.h
|
||||
many_random.o: ../cmath.h
|
||||
many_random.o: ../config.h
|
||||
many_random.o: ../endian_calc.h
|
||||
@@ -460,21 +465,22 @@ many_random.o: ../have_stdlib.h
|
||||
many_random.o: ../have_string.h
|
||||
many_random.o: ../lib_util.h
|
||||
many_random.o: ../longbits.h
|
||||
many_random.o: many_random.c
|
||||
many_random.o: ../md5.h
|
||||
many_random.o: ../nametype.h
|
||||
many_random.o: ../qmath.h
|
||||
many_random.o: ../shs.h
|
||||
many_random.o: ../shs1.h
|
||||
many_random.o: ../shs.h
|
||||
many_random.o: ../string.h
|
||||
many_random.o: ../value.h
|
||||
many_random.o: ../win32dll.h
|
||||
many_random.o: ../zmath.h
|
||||
many_random.o: ../zrandom.h
|
||||
many_random.o: many_random.c
|
||||
test_random.o: ../alloc.h
|
||||
test_random.o: ../block.h
|
||||
test_random.o: ../byteswap.h
|
||||
test_random.o: ../calc.h
|
||||
test_random.o: ../calcerr.h
|
||||
test_random.o: ../calc.h
|
||||
test_random.o: ../cmath.h
|
||||
test_random.o: ../config.h
|
||||
test_random.o: ../endian_calc.h
|
||||
@@ -490,10 +496,11 @@ test_random.o: ../longbits.h
|
||||
test_random.o: ../md5.h
|
||||
test_random.o: ../nametype.h
|
||||
test_random.o: ../qmath.h
|
||||
test_random.o: ../shs.h
|
||||
test_random.o: ../shs1.h
|
||||
test_random.o: ../shs.h
|
||||
test_random.o: ../string.h
|
||||
test_random.o: test_random.c
|
||||
test_random.o: ../value.h
|
||||
test_random.o: ../win32dll.h
|
||||
test_random.o: ../zmath.h
|
||||
test_random.o: ../zrandom.h
|
||||
test_random.o: test_random.c
|
||||
|
79
seed.c
79
seed.c
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.2 $
|
||||
* @(#) $Id: seed.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: seed.c,v 29.4 2001/03/17 21:31:47 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/seed.c,v $
|
||||
*
|
||||
* Under source code control: 1999/10/03 10:06:53
|
||||
@@ -40,7 +40,16 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "have_unistd.h"
|
||||
#if defined(HAVE_UNISTD_H)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
# include <process.h>
|
||||
# define pid_t int
|
||||
#endif
|
||||
|
||||
/*
|
||||
* PORTING NOTE:
|
||||
@@ -55,10 +64,19 @@
|
||||
*/
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "have_times.h"
|
||||
#if defined(HAVE_TIME_H)
|
||||
#include <time.h>
|
||||
#endif
|
||||
#if defined(HAVE_SYS_TIME_H)
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#if defined(HAVE_SYS_TIMES_H)
|
||||
#include <sys/times.h>
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
#if !defined(_WIN32)
|
||||
# include <sys/resource.h>
|
||||
#endif
|
||||
#include <setjmp.h>
|
||||
#include "qmath.h"
|
||||
#include "longbits.h"
|
||||
@@ -69,14 +87,15 @@
|
||||
#include "have_getprid.h"
|
||||
#include "have_urandom.h"
|
||||
#include "have_rusage.h"
|
||||
#include "have_uid_t.h"
|
||||
#if defined(HAVE_USTAT)
|
||||
# include <ustat.h>
|
||||
#endif /* HAVE_USTAT */
|
||||
#endif
|
||||
#if defined(HAVE_URANDOM)
|
||||
# include <fcntl.h>
|
||||
# define DEV_URANDOM "/dev/urandom"
|
||||
# define DEV_URANDOM_POOL 16
|
||||
#endif /* HAVE_URANDOM */
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
@@ -272,26 +291,32 @@ pseudo_seed(void)
|
||||
#if defined(HAVE_GETTIME)
|
||||
# if defined(CLOCK_SGI_CYCLE)
|
||||
struct timespec sgi_cycle; /* SGI hardware clock */
|
||||
# endif /* CLOCK_SGI_CYCLE */
|
||||
# endif
|
||||
# if defined(CLOCK_REALTIME)
|
||||
struct timespec realtime; /* POSIX realtime clock */
|
||||
# endif /* CLOCK_REALTIME */
|
||||
#endif /* HAVE_GETTIME */
|
||||
# endif
|
||||
#endif
|
||||
#if defined(HAVE_GETPRID)
|
||||
prid_t getprid; /* project ID */
|
||||
#endif /* HAVE_GETPRID */
|
||||
#endif
|
||||
#if defined(HAVE_URANDOM)
|
||||
int urandom_fd; /* open descriptor for /dev/urandom */
|
||||
int urandom_ret; /* read() of /dev/random */
|
||||
char urandom_pool[DEV_URANDOM_POOL]; /* /dev/urandom data pool */
|
||||
#endif /* HAVE_URANDOM */
|
||||
#endif
|
||||
#if defined(HAVE_SYS_TIME_H)
|
||||
struct timeval tp; /* time of day */
|
||||
#endif
|
||||
pid_t getpid; /* process ID */
|
||||
#if !defined(_WIN32)
|
||||
pid_t getppid; /* parent process ID */
|
||||
#endif
|
||||
#if defined(HAVE_UID_T)
|
||||
uid_t getuid; /* real user ID */
|
||||
uid_t geteuid; /* effective user ID */
|
||||
gid_t getgid; /* real group ID */
|
||||
gid_t getegid; /* effective group ID */
|
||||
#endif
|
||||
struct stat stat_dot; /* stat of "." */
|
||||
struct stat stat_dotdot; /* stat of ".." */
|
||||
struct stat stat_tmp; /* stat of "/tmp" */
|
||||
@@ -307,19 +332,21 @@ pseudo_seed(void)
|
||||
struct ustat ustat_stdin; /* usage stat of stdin */
|
||||
struct ustat ustat_stdout; /* usage stat of stdout */
|
||||
struct ustat ustat_stderr; /* usage stat of stderr */
|
||||
#endif /* HAVE_USTAT */
|
||||
#endif
|
||||
#if defined(HAVE_GETSID)
|
||||
pid_t getsid; /* session ID */
|
||||
#endif /* HAVE_GETSID */
|
||||
#endif
|
||||
#if defined(HAVE_GETPGID)
|
||||
pid_t getpgid; /* process group ID */
|
||||
#endif /* HAVE_GETPGID */
|
||||
#endif
|
||||
#if defined(HAVE_GETRUSAGE)
|
||||
struct rusage rusage; /* resource utilization */
|
||||
struct rusage rusage_chld; /* resource utilization of children */
|
||||
#endif /* HAVE_GETRUSAGE */
|
||||
#endif
|
||||
#if defined(HAVE_SYS_TIME_H)
|
||||
struct timeval tp2; /* time of day again */
|
||||
struct tms times; /* process times */
|
||||
#endif
|
||||
time_t time; /* local time */
|
||||
size_t size; /* size of this data structure */
|
||||
jmp_buf env; /* setjmp() context */
|
||||
@@ -339,14 +366,14 @@ pseudo_seed(void)
|
||||
#if defined(HAVE_GETTIME)
|
||||
# if defined(CLOCK_SGI_CYCLE)
|
||||
(void) clock_gettime(CLOCK_SGI_CYCLE, &sdata.sgi_cycle);
|
||||
# endif /* CLOCK_SGI_CYCLE */
|
||||
# endif
|
||||
# if defined(CLOCK_REALTIME)
|
||||
(void) clock_gettime(CLOCK_REALTIME, &sdata.realtime);
|
||||
# endif /* CLOCK_REALTIME */
|
||||
#endif /* HAVE_GETTIME */
|
||||
# endif
|
||||
#endif
|
||||
#if defined(HAVE_GETPRID)
|
||||
sdata.getprid = getprid();
|
||||
#endif /* HAVE_GETPRID */
|
||||
#endif
|
||||
#if defined(HAVE_URANDOM)
|
||||
sdata.urandom_fd = open(DEV_URANDOM, O_NONBLOCK|O_RDONLY);
|
||||
if (sdata.urandom_fd >= 0) {
|
||||
@@ -358,13 +385,19 @@ pseudo_seed(void)
|
||||
sdata.urandom_ret = EOF;
|
||||
}
|
||||
#endif /* HAVE_URANDOM */
|
||||
#if defined(HAVE_SYS_TIME_H)
|
||||
(void) gettimeofday(&sdata.tp, NULL);
|
||||
#endif
|
||||
sdata.getpid = getpid();
|
||||
#if !defined(_WIN32)
|
||||
sdata.getppid = getppid();
|
||||
#endif
|
||||
#if defined(HAVE_UID_T)
|
||||
sdata.getuid = getuid();
|
||||
sdata.geteuid = geteuid();
|
||||
sdata.getgid = getgid();
|
||||
sdata.getegid = getegid();
|
||||
#endif
|
||||
(void) stat(".", &sdata.stat_dot);
|
||||
(void) stat("..", &sdata.stat_dotdot);
|
||||
(void) stat("/tmp", &sdata.stat_tmp);
|
||||
@@ -380,19 +413,21 @@ pseudo_seed(void)
|
||||
(void) ustat(sdata.fstat_stdin.st_dev, &sdata.ustat_stdin);
|
||||
(void) ustat(sdata.fstat_stdout.st_dev, &sdata.ustat_stdout);
|
||||
(void) ustat(sdata.fstat_stderr.st_dev, &sdata.ustat_stderr);
|
||||
#endif /* HAVE_USTAT */
|
||||
#endif
|
||||
#if defined(HAVE_GETSID)
|
||||
sdata.getsid = getsid((pid_t)0);
|
||||
#endif /* HAVE_GETSID */
|
||||
#endif
|
||||
#if defined(HAVE_GETPGID)
|
||||
sdata.getpgid = getpgid((pid_t)0);
|
||||
#endif /* HAVE_GETPGID */
|
||||
#endif
|
||||
#if defined(HAVE_GETRUSAGE)
|
||||
(void) getrusage(RUSAGE_SELF, &sdata.rusage);
|
||||
(void) getrusage(RUSAGE_CHILDREN, &sdata.rusage_chld);
|
||||
#endif /* HAVE_GETRUSAGE */
|
||||
#endif
|
||||
#if defined(HAVE_SYS_TIME_H)
|
||||
(void) gettimeofday(&sdata.tp2, NULL);
|
||||
(void) times(&sdata.times);
|
||||
#endif
|
||||
sdata.time = time(NULL);
|
||||
sdata.size = sizeof(sdata);
|
||||
(void) setjmp(sdata.env);
|
||||
|
341
value.h
341
value.h
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: value.h,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: value.h,v 29.5 2001/03/17 21:31:47 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/value.h,v $
|
||||
*
|
||||
* Under source code control: 1993/07/30 19:42:47
|
||||
@@ -32,6 +32,7 @@
|
||||
#define __VALUE_H__
|
||||
|
||||
|
||||
#include "win32dll.h"
|
||||
#include "cmath.h"
|
||||
#include "config.h"
|
||||
#include "shs.h"
|
||||
@@ -187,59 +188,59 @@ struct value {
|
||||
/*
|
||||
* value functions
|
||||
*/
|
||||
extern void freevalue(VALUE *vp);
|
||||
extern void copyvalue(VALUE *vp, VALUE *vres);
|
||||
extern void negvalue(VALUE *vp, VALUE *vres);
|
||||
extern void addvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern void subvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern void mulvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern void orvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern void andvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern void compvalue(VALUE *vp, VALUE *vres);
|
||||
extern void xorvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern void squarevalue(VALUE *vp, VALUE *vres);
|
||||
extern void invertvalue(VALUE *vp, VALUE *vres);
|
||||
extern void roundvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern void broundvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern void setminusvalue(VALUE *, VALUE *, VALUE *);
|
||||
extern void backslashvalue(VALUE *, VALUE *);
|
||||
extern void contentvalue(VALUE *, VALUE *);
|
||||
extern void hashopvalue(VALUE *, VALUE *, VALUE *);
|
||||
extern void apprvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern void intvalue(VALUE *vp, VALUE *vres);
|
||||
extern void fracvalue(VALUE *vp, VALUE *vres);
|
||||
extern void incvalue(VALUE *vp, VALUE *vres);
|
||||
extern void decvalue(VALUE *vp, VALUE *vres);
|
||||
extern void conjvalue(VALUE *vp, VALUE *vres);
|
||||
extern void sqrtvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern void rootvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern void absvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern void normvalue(VALUE *vp, VALUE *vres);
|
||||
extern void shiftvalue(VALUE *v1, VALUE *v2, BOOL rightshift, VALUE *vres);
|
||||
extern void scalevalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern void powivalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern void powervalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern void divvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern void quovalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern void modvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern BOOL testvalue(VALUE *vp);
|
||||
extern BOOL comparevalue(VALUE *v1, VALUE *v2);
|
||||
extern BOOL acceptvalue(VALUE *v1, VALUE *v2);
|
||||
extern void relvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern void sgnvalue(VALUE *vp, VALUE *vres);
|
||||
extern QCKHASH hashvalue(VALUE *vp, QCKHASH val);
|
||||
extern void printvalue(VALUE *vp, int flags);
|
||||
extern BOOL precvalue(VALUE *v1, VALUE *v2);
|
||||
extern VALUE error_value(int e);
|
||||
extern int set_errno(int e);
|
||||
extern int set_errcount(int e);
|
||||
extern long countlistitems(LIST *lp);
|
||||
extern void addlistitems(LIST *lp, VALUE *vres);
|
||||
extern void addlistinv(LIST *lp, VALUE *vres);
|
||||
extern void copy2octet(VALUE *, OCTET *);
|
||||
extern int copystod(VALUE *, long, long, VALUE *, long);
|
||||
extern void protectall(VALUE *, int);
|
||||
extern void set_update(int);
|
||||
extern DLL void freevalue(VALUE *vp);
|
||||
extern DLL void copyvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void negvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void addvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void subvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void mulvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void orvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void andvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void compvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void xorvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void squarevalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void invertvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void roundvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern DLL void broundvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern DLL void setminusvalue(VALUE *, VALUE *, VALUE *);
|
||||
extern DLL void backslashvalue(VALUE *, VALUE *);
|
||||
extern DLL void contentvalue(VALUE *, VALUE *);
|
||||
extern DLL void hashopvalue(VALUE *, VALUE *, VALUE *);
|
||||
extern DLL void apprvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern DLL void intvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void fracvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void incvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void decvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void conjvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void sqrtvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern DLL void rootvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern DLL void absvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void normvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void shiftvalue(VALUE *v1, VALUE *v2, BOOL rightshift, VALUE *vres);
|
||||
extern DLL void scalevalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void powivalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void powervalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern DLL void divvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void quovalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern DLL void modvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern DLL BOOL testvalue(VALUE *vp);
|
||||
extern DLL BOOL comparevalue(VALUE *v1, VALUE *v2);
|
||||
extern DLL BOOL acceptvalue(VALUE *v1, VALUE *v2);
|
||||
extern DLL void relvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void sgnvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL QCKHASH hashvalue(VALUE *vp, QCKHASH val);
|
||||
extern DLL void printvalue(VALUE *vp, int flags);
|
||||
extern DLL BOOL precvalue(VALUE *v1, VALUE *v2);
|
||||
extern DLL VALUE error_value(int e);
|
||||
extern DLL int set_errno(int e);
|
||||
extern DLL int set_errcount(int e);
|
||||
extern DLL long countlistitems(LIST *lp);
|
||||
extern DLL void addlistitems(LIST *lp, VALUE *vres);
|
||||
extern DLL void addlistinv(LIST *lp, VALUE *vres);
|
||||
extern DLL void copy2octet(VALUE *, OCTET *);
|
||||
extern DLL int copystod(VALUE *, long, long, VALUE *, long);
|
||||
extern DLL void protectall(VALUE *, int);
|
||||
extern DLL void set_update(int);
|
||||
|
||||
|
||||
/*
|
||||
@@ -256,44 +257,44 @@ struct matrix {
|
||||
#define matsize(n) (sizeof(MATRIX) - sizeof(VALUE) + ((n) * sizeof(VALUE)))
|
||||
|
||||
|
||||
extern MATRIX *matadd(MATRIX *m1, MATRIX *m2);
|
||||
extern MATRIX *matsub(MATRIX *m1, MATRIX *m2);
|
||||
extern MATRIX *matmul(MATRIX *m1, MATRIX *m2);
|
||||
extern MATRIX *matneg(MATRIX *m);
|
||||
extern MATRIX *matalloc(long size);
|
||||
extern MATRIX *matcopy(MATRIX *m);
|
||||
extern MATRIX *matinit(MATRIX *m, VALUE *v1, VALUE *v2);
|
||||
extern MATRIX *matsquare(MATRIX *m);
|
||||
extern MATRIX *matinv(MATRIX *m);
|
||||
extern MATRIX *matscale(MATRIX *m, long n);
|
||||
extern MATRIX *matshift(MATRIX *m, long n);
|
||||
extern MATRIX *matmulval(MATRIX *m, VALUE *vp);
|
||||
extern MATRIX *matpowi(MATRIX *m, NUMBER *q);
|
||||
extern MATRIX *matconj(MATRIX *m);
|
||||
extern MATRIX *matquoval(MATRIX *m, VALUE *vp, VALUE *v3);
|
||||
extern MATRIX *matmodval(MATRIX *m, VALUE *vp, VALUE *v3);
|
||||
extern MATRIX *matint(MATRIX *m);
|
||||
extern MATRIX *matfrac(MATRIX *m);
|
||||
extern MATRIX *matappr(MATRIX *m, VALUE *v2, VALUE *v3);
|
||||
extern VALUE mattrace(MATRIX *m);
|
||||
extern MATRIX *mattrans(MATRIX *m);
|
||||
extern MATRIX *matcross(MATRIX *m1, MATRIX *m2);
|
||||
extern BOOL mattest(MATRIX *m);
|
||||
extern void matsum(MATRIX *m, VALUE *vres);
|
||||
extern BOOL matcmp(MATRIX *m1, MATRIX *m2);
|
||||
extern int matsearch(MATRIX *m, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
extern int matrsearch(MATRIX *m, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
extern VALUE matdet(MATRIX *m);
|
||||
extern VALUE matdot(MATRIX *m1, MATRIX *m2);
|
||||
extern void matfill(MATRIX *m, VALUE *v1, VALUE *v2);
|
||||
extern void matfree(MATRIX *m);
|
||||
extern void matprint(MATRIX *m, long max_print);
|
||||
extern VALUE *matindex(MATRIX *mp, BOOL create, long dim, VALUE *indices);
|
||||
extern void matreverse(MATRIX *m);
|
||||
extern void matsort(MATRIX *m);
|
||||
extern BOOL matisident(MATRIX *m);
|
||||
extern MATRIX *matround(MATRIX *m, VALUE *v2, VALUE *v3);
|
||||
extern MATRIX *matbround(MATRIX *m, VALUE *v2, VALUE *v3);
|
||||
extern DLL MATRIX *matadd(MATRIX *m1, MATRIX *m2);
|
||||
extern DLL MATRIX *matsub(MATRIX *m1, MATRIX *m2);
|
||||
extern DLL MATRIX *matmul(MATRIX *m1, MATRIX *m2);
|
||||
extern DLL MATRIX *matneg(MATRIX *m);
|
||||
extern DLL MATRIX *matalloc(long size);
|
||||
extern DLL MATRIX *matcopy(MATRIX *m);
|
||||
extern DLL MATRIX *matinit(MATRIX *m, VALUE *v1, VALUE *v2);
|
||||
extern DLL MATRIX *matsquare(MATRIX *m);
|
||||
extern DLL MATRIX *matinv(MATRIX *m);
|
||||
extern DLL MATRIX *matscale(MATRIX *m, long n);
|
||||
extern DLL MATRIX *matshift(MATRIX *m, long n);
|
||||
extern DLL MATRIX *matmulval(MATRIX *m, VALUE *vp);
|
||||
extern DLL MATRIX *matpowi(MATRIX *m, NUMBER *q);
|
||||
extern DLL MATRIX *matconj(MATRIX *m);
|
||||
extern DLL MATRIX *matquoval(MATRIX *m, VALUE *vp, VALUE *v3);
|
||||
extern DLL MATRIX *matmodval(MATRIX *m, VALUE *vp, VALUE *v3);
|
||||
extern DLL MATRIX *matint(MATRIX *m);
|
||||
extern DLL MATRIX *matfrac(MATRIX *m);
|
||||
extern DLL MATRIX *matappr(MATRIX *m, VALUE *v2, VALUE *v3);
|
||||
extern DLL VALUE mattrace(MATRIX *m);
|
||||
extern DLL MATRIX *mattrans(MATRIX *m);
|
||||
extern DLL MATRIX *matcross(MATRIX *m1, MATRIX *m2);
|
||||
extern DLL BOOL mattest(MATRIX *m);
|
||||
extern DLL void matsum(MATRIX *m, VALUE *vres);
|
||||
extern DLL BOOL matcmp(MATRIX *m1, MATRIX *m2);
|
||||
extern DLL int matsearch(MATRIX *m, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
extern DLL int matrsearch(MATRIX *m, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
extern DLL VALUE matdet(MATRIX *m);
|
||||
extern DLL VALUE matdot(MATRIX *m1, MATRIX *m2);
|
||||
extern DLL void matfill(MATRIX *m, VALUE *v1, VALUE *v2);
|
||||
extern DLL void matfree(MATRIX *m);
|
||||
extern DLL void matprint(MATRIX *m, long max_print);
|
||||
extern DLL VALUE *matindex(MATRIX *mp, BOOL create, long dim, VALUE *indices);
|
||||
extern DLL void matreverse(MATRIX *m);
|
||||
extern DLL void matsort(MATRIX *m);
|
||||
extern DLL BOOL matisident(MATRIX *m);
|
||||
extern DLL MATRIX *matround(MATRIX *m, VALUE *v2, VALUE *v3);
|
||||
extern DLL MATRIX *matbround(MATRIX *m, VALUE *v2, VALUE *v3);
|
||||
|
||||
|
||||
/*
|
||||
@@ -320,32 +321,32 @@ struct list {
|
||||
};
|
||||
|
||||
|
||||
extern void insertlistfirst(LIST *lp, VALUE *vp);
|
||||
extern void insertlistlast(LIST *lp, VALUE *vp);
|
||||
extern void insertlistmiddle(LIST *lp, long index, VALUE *vp);
|
||||
extern void removelistfirst(LIST *lp, VALUE *vp);
|
||||
extern void removelistlast(LIST *lp, VALUE *vp);
|
||||
extern void removelistmiddle(LIST *lp, long index, VALUE *vp);
|
||||
extern void listfree(LIST *lp);
|
||||
extern void listprint(LIST *lp, long max_print);
|
||||
extern int listsearch(LIST *lp, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
extern int listrsearch(LIST *lp, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
extern BOOL listcmp(LIST *lp1, LIST *lp2);
|
||||
extern VALUE *listfindex(LIST *lp, long index);
|
||||
extern LIST *listalloc(void);
|
||||
extern LIST *listcopy(LIST *lp);
|
||||
extern void listreverse(LIST *lp);
|
||||
extern void listsort(LIST *lp);
|
||||
extern LIST *listappr(LIST *lp, VALUE *v2, VALUE *v3);
|
||||
extern LIST *listround(LIST *m, VALUE *v2, VALUE *v3);
|
||||
extern LIST *listbround(LIST *m, VALUE *v2, VALUE *v3);
|
||||
extern LIST *listquo(LIST *lp, VALUE *v2, VALUE *v3);
|
||||
extern LIST *listmod(LIST *lp, VALUE *v2, VALUE *v3);
|
||||
extern BOOL evp(LISTELEM *cp, LISTELEM *x, VALUE *vres);
|
||||
extern BOOL evalpoly(LIST *clist, LISTELEM *x, VALUE *vres);
|
||||
extern void insertitems(LIST *lp1, LIST *lp2);
|
||||
extern LISTELEM *listelement(LIST *, long);
|
||||
extern LIST *listsegment(LIST *, long, long);
|
||||
extern DLL void insertlistfirst(LIST *lp, VALUE *vp);
|
||||
extern DLL void insertlistlast(LIST *lp, VALUE *vp);
|
||||
extern DLL void insertlistmiddle(LIST *lp, long index, VALUE *vp);
|
||||
extern DLL void removelistfirst(LIST *lp, VALUE *vp);
|
||||
extern DLL void removelistlast(LIST *lp, VALUE *vp);
|
||||
extern DLL void removelistmiddle(LIST *lp, long index, VALUE *vp);
|
||||
extern DLL void listfree(LIST *lp);
|
||||
extern DLL void listprint(LIST *lp, long max_print);
|
||||
extern DLL int listsearch(LIST *lp, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
extern DLL int listrsearch(LIST *lp, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
extern DLL BOOL listcmp(LIST *lp1, LIST *lp2);
|
||||
extern DLL VALUE *listfindex(LIST *lp, long index);
|
||||
extern DLL LIST *listalloc(void);
|
||||
extern DLL LIST *listcopy(LIST *lp);
|
||||
extern DLL void listreverse(LIST *lp);
|
||||
extern DLL void listsort(LIST *lp);
|
||||
extern DLL LIST *listappr(LIST *lp, VALUE *v2, VALUE *v3);
|
||||
extern DLL LIST *listround(LIST *m, VALUE *v2, VALUE *v3);
|
||||
extern DLL LIST *listbround(LIST *m, VALUE *v2, VALUE *v3);
|
||||
extern DLL LIST *listquo(LIST *lp, VALUE *v2, VALUE *v3);
|
||||
extern DLL LIST *listmod(LIST *lp, VALUE *v2, VALUE *v3);
|
||||
extern DLL BOOL evp(LISTELEM *cp, LISTELEM *x, VALUE *vres);
|
||||
extern DLL BOOL evalpoly(LIST *clist, LISTELEM *x, VALUE *vres);
|
||||
extern DLL void insertitems(LIST *lp1, LIST *lp2);
|
||||
extern DLL LISTELEM *listelement(LIST *, long);
|
||||
extern DLL LIST *listsegment(LIST *, long, long);
|
||||
|
||||
|
||||
/*
|
||||
@@ -370,15 +371,15 @@ struct assoc {
|
||||
};
|
||||
|
||||
|
||||
extern ASSOC *assocalloc(long initsize);
|
||||
extern ASSOC *assoccopy(ASSOC *ap);
|
||||
extern void assocfree(ASSOC *ap);
|
||||
extern void assocprint(ASSOC *ap, long max_print);
|
||||
extern int assocsearch(ASSOC *ap, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
extern int assocrsearch(ASSOC *ap, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
extern BOOL assoccmp(ASSOC *ap1, ASSOC *ap2);
|
||||
extern VALUE *assocfindex(ASSOC *ap, long index);
|
||||
extern VALUE *associndex(ASSOC *ap, BOOL create, long dim, VALUE *indices);
|
||||
extern DLL ASSOC *assocalloc(long initsize);
|
||||
extern DLL ASSOC *assoccopy(ASSOC *ap);
|
||||
extern DLL void assocfree(ASSOC *ap);
|
||||
extern DLL void assocprint(ASSOC *ap, long max_print);
|
||||
extern DLL int assocsearch(ASSOC *ap, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
extern DLL int assocrsearch(ASSOC *ap, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
extern DLL BOOL assoccmp(ASSOC *ap1, ASSOC *ap2);
|
||||
extern DLL VALUE *assocfindex(ASSOC *ap, long index);
|
||||
extern DLL VALUE *associndex(ASSOC *ap, BOOL create, long dim, VALUE *indices);
|
||||
|
||||
|
||||
/*
|
||||
@@ -460,62 +461,62 @@ struct object {
|
||||
(sizeof(OBJECT) + ((elements) - USUAL_ELEMENTS) * sizeof(VALUE))
|
||||
|
||||
|
||||
extern OBJECT *objcopy(OBJECT *op);
|
||||
extern OBJECT *objalloc(long index);
|
||||
extern VALUE objcall(int action, VALUE *v1, VALUE *v2, VALUE *v3);
|
||||
extern void objfree(OBJECT *op);
|
||||
extern int addelement(char *name);
|
||||
extern int defineobject(char *name, int indices[], int count);
|
||||
extern int checkobject(char *name);
|
||||
extern void showobjfuncs(void);
|
||||
extern void showobjtypes(void);
|
||||
extern int findelement(char *name);
|
||||
extern char *objtypename(unsigned long index);
|
||||
extern int objoffset(OBJECT *op, long index);
|
||||
extern DLL OBJECT *objcopy(OBJECT *op);
|
||||
extern DLL OBJECT *objalloc(long index);
|
||||
extern DLL VALUE objcall(int action, VALUE *v1, VALUE *v2, VALUE *v3);
|
||||
extern DLL void objfree(OBJECT *op);
|
||||
extern DLL int addelement(char *name);
|
||||
extern DLL int defineobject(char *name, int indices[], int count);
|
||||
extern DLL int checkobject(char *name);
|
||||
extern DLL void showobjfuncs(void);
|
||||
extern DLL void showobjtypes(void);
|
||||
extern DLL int findelement(char *name);
|
||||
extern DLL char *objtypename(unsigned long index);
|
||||
extern DLL int objoffset(OBJECT *op, long index);
|
||||
|
||||
|
||||
/*
|
||||
* Configuration parameter name and type.
|
||||
*/
|
||||
extern NAMETYPE configs[];
|
||||
extern void config_value(CONFIG *cfg, int type, VALUE *ret);
|
||||
extern void setconfig(int type, VALUE *vp);
|
||||
extern void config_print(CONFIG *cfg); /* the CONFIG to print */
|
||||
extern DLL void config_value(CONFIG *cfg, int type, VALUE *ret);
|
||||
extern DLL void setconfig(int type, VALUE *vp);
|
||||
extern DLL void config_print(CONFIG *cfg); /* the CONFIG to print */
|
||||
|
||||
|
||||
/*
|
||||
* size, memsize and sizeof support
|
||||
*/
|
||||
extern long elm_count(VALUE *vp);
|
||||
extern long lsizeof(VALUE *vp);
|
||||
extern long memsize(VALUE *vp);
|
||||
extern DLL long elm_count(VALUE *vp);
|
||||
extern DLL long lsizeof(VALUE *vp);
|
||||
extern DLL long memsize(VALUE *vp);
|
||||
|
||||
/*
|
||||
* String functions
|
||||
*/
|
||||
extern STRING *stringadd(STRING *, STRING *);
|
||||
extern STRING *stringcopy(STRING *);
|
||||
extern STRING *stringsub(STRING *, STRING *);
|
||||
extern STRING *stringmul(NUMBER *, STRING *);
|
||||
extern STRING *stringand(STRING *, STRING *);
|
||||
extern STRING *stringor(STRING *, STRING *);
|
||||
extern STRING *stringxor(STRING *, STRING *);
|
||||
extern STRING *stringdiff(STRING *, STRING *);
|
||||
extern STRING *stringsegment(STRING *, long, long);
|
||||
extern STRING *stringshift(STRING *, long);
|
||||
extern STRING *stringcomp(STRING *);
|
||||
extern STRING *stringneg(STRING *);
|
||||
extern STRING *stringcpy(STRING *, STRING *);
|
||||
extern STRING *stringncpy(STRING *, STRING *, long);
|
||||
extern long stringcontent(STRING *s);
|
||||
extern long stringlowbit(STRING *s);
|
||||
extern long stringhighbit(STRING *s);
|
||||
extern BOOL stringcmp(STRING *, STRING *);
|
||||
extern BOOL stringrel(STRING *, STRING *);
|
||||
extern int stringbit(STRING *, long);
|
||||
extern BOOL stringtest(STRING *);
|
||||
extern int stringsetbit(STRING *, long, BOOL);
|
||||
extern int stringsearch(STRING *, STRING *, long, long, ZVALUE *);
|
||||
extern int stringrsearch(STRING *, STRING *, long, long, ZVALUE *);
|
||||
extern DLL STRING *stringadd(STRING *, STRING *);
|
||||
extern DLL STRING *stringcopy(STRING *);
|
||||
extern DLL STRING *stringsub(STRING *, STRING *);
|
||||
extern DLL STRING *stringmul(NUMBER *, STRING *);
|
||||
extern DLL STRING *stringand(STRING *, STRING *);
|
||||
extern DLL STRING *stringor(STRING *, STRING *);
|
||||
extern DLL STRING *stringxor(STRING *, STRING *);
|
||||
extern DLL STRING *stringdiff(STRING *, STRING *);
|
||||
extern DLL STRING *stringsegment(STRING *, long, long);
|
||||
extern DLL STRING *stringshift(STRING *, long);
|
||||
extern DLL STRING *stringcomp(STRING *);
|
||||
extern DLL STRING *stringneg(STRING *);
|
||||
extern DLL STRING *stringcpy(STRING *, STRING *);
|
||||
extern DLL STRING *stringncpy(STRING *, STRING *, long);
|
||||
extern DLL long stringcontent(STRING *s);
|
||||
extern DLL long stringlowbit(STRING *s);
|
||||
extern DLL long stringhighbit(STRING *s);
|
||||
extern DLL BOOL stringcmp(STRING *, STRING *);
|
||||
extern DLL BOOL stringrel(STRING *, STRING *);
|
||||
extern DLL int stringbit(STRING *, long);
|
||||
extern DLL BOOL stringtest(STRING *);
|
||||
extern DLL int stringsetbit(STRING *, long, BOOL);
|
||||
extern DLL int stringsearch(STRING *, STRING *, long, long, ZVALUE *);
|
||||
extern DLL int stringrsearch(STRING *, STRING *, long, long, ZVALUE *);
|
||||
|
||||
#endif /* !__VALUE_H__ */
|
||||
|
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.17 $
|
||||
* @(#) $Id: version.c,v 29.17 2000/12/15 14:58:20 chongo Exp $
|
||||
* @(#) $Revision: 29.22 $
|
||||
* @(#) $Id: version.c,v 29.22 2001/04/08 22:05:40 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $
|
||||
*
|
||||
* Under source code control: 1990/05/22 11:00:58
|
||||
@@ -42,8 +42,8 @@ static char *program;
|
||||
|
||||
#define MAJOR_VER 2 /* major version */
|
||||
#define MINOR_VER 11 /* minor version */
|
||||
#define MAJOR_PATCH 4 /* patch level or 0 if no patch */
|
||||
#define MINOR_PATCH "1" /* test number or empty string if no patch */
|
||||
#define MAJOR_PATCH 5 /* patch level or 0 if no patch */
|
||||
#define MINOR_PATCH "2" /* test number or empty string if no patch */
|
||||
|
||||
/*
|
||||
* calc version constants
|
||||
|
15
win32/align32.h
Normal file
15
win32/align32.h
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__MUST_ALIGN32_H__)
|
||||
#define __MUST_ALIGN32_H__
|
||||
|
||||
|
||||
/* must we always align 32 bit accesses? */
|
||||
/* forced to not require 32 bit alignment */
|
||||
#undef MUST_ALIGN32
|
||||
|
||||
|
||||
#endif /* !__MUST_ALIGN32_H__ */
|
18
win32/args.h
Normal file
18
win32/args.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__ARGS_H__)
|
||||
#define __ARGS_H__
|
||||
|
||||
|
||||
/* what type of variable args do we have? */
|
||||
#define STDARG /* use <stdarg.h> */
|
||||
#include <stdarg.h>
|
||||
|
||||
/* should we use vsprintf()? */
|
||||
#define HAVE_VS /* yes */
|
||||
|
||||
|
||||
#endif /* !__ARGS_H__ */
|
379
win32/calcerr.c
Normal file
379
win32/calcerr.c
Normal file
@@ -0,0 +1,379 @@
|
||||
/*
|
||||
* DO NOT EDIT
|
||||
*
|
||||
* generated by calcerr.tbl via Makefile
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "calcerr.h"
|
||||
|
||||
#include "have_const.h"
|
||||
|
||||
/*
|
||||
* names of calc error values
|
||||
*/
|
||||
CONST char *error_table[E__COUNT+2] = {
|
||||
"No error",
|
||||
"Division by zero",
|
||||
"Indeterminate (0/0)",
|
||||
"Bad arguments for +",
|
||||
"Bad arguments for binary -",
|
||||
"Bad arguments for *",
|
||||
"Bad arguments for /",
|
||||
"Bad argument for unary -",
|
||||
"Bad argument for squaring",
|
||||
"Bad argument for inverse",
|
||||
"Bad argument for ++",
|
||||
"Bad argument for --",
|
||||
"Bad argument for int",
|
||||
"Bad argument for frac",
|
||||
"Bad argument for conj",
|
||||
"Bad first argument for appr",
|
||||
"Bad second argument for appr",
|
||||
"Bad third argument for appr",
|
||||
"Bad first argument for round",
|
||||
"Bad second argument for round",
|
||||
"Bad third argument for round",
|
||||
"Bad first argument for bround",
|
||||
"Bad second argument for bround",
|
||||
"Bad third argument for bround",
|
||||
"Bad first argument for sqrt",
|
||||
"Bad second argument for sqrt",
|
||||
"Bad third argument for sqrt",
|
||||
"Bad first argument for root",
|
||||
"Bad second argument for root",
|
||||
"Bad third argument for root",
|
||||
"Bad argument for norm",
|
||||
"Bad first argument for << or >>",
|
||||
"Bad second argument for << or >>",
|
||||
"Bad first argument for scale",
|
||||
"Bad second argument for scale",
|
||||
"Bad first argument for ^",
|
||||
"Bad second argument for ^",
|
||||
"Bad first argument for power",
|
||||
"Bad second argument for power",
|
||||
"Bad third argument for power",
|
||||
"Bad first argument for quo or //",
|
||||
"Bad second argument for quo or //",
|
||||
"Bad third argument for quo",
|
||||
"Bad first argument for mod or %",
|
||||
"Bad second argument for mod or %",
|
||||
"Bad third argument for mod",
|
||||
"Bad argument for sgn",
|
||||
"Bad first argument for abs",
|
||||
"Bad second argument for abs",
|
||||
"Scan error in argument for eval",
|
||||
"Non-simple type for str",
|
||||
"Non-real epsilon for exp",
|
||||
"Bad first argument for exp",
|
||||
"Non-file first argument for fputc",
|
||||
"Bad second argument for fputc",
|
||||
"File not open for writing for fputc",
|
||||
"Non-file first argument for fgetc",
|
||||
"File not open for reading for fgetc",
|
||||
"Non-string arguments for fopen",
|
||||
"Unrecognized mode for fopen",
|
||||
"Non-file first argument for freopen",
|
||||
"Non-string or unrecognized mode for freopen",
|
||||
"Non-string third argument for freopen",
|
||||
"Non-file argument for fclose",
|
||||
"Non-file argument for fflush",
|
||||
"Non-file first argument for fputs",
|
||||
"Non-string argument after first for fputs",
|
||||
"File not open for writing for fputs",
|
||||
"Non-file argument for fgets",
|
||||
"File not open for reading for fgets",
|
||||
"Non-file first argument for fputstr",
|
||||
"Non-string argument after first for fputstr",
|
||||
"File not open for writing for fputstr",
|
||||
"Non-file first argument for fgetstr",
|
||||
"File not open for reading for fgetstr",
|
||||
"Non-file argument for fgetline",
|
||||
"File not open for reading for fgetline",
|
||||
"Non-file argument for fgetword",
|
||||
"File not open for reading for fgetword",
|
||||
"Non-file argument for rewind",
|
||||
"Non-integer argument for files",
|
||||
"Non-string fmt argument for fprint",
|
||||
"Stdout not open for writing to ???",
|
||||
"Non-file first argument for fprintf",
|
||||
"Non-string second (fmt) argument for fprintf",
|
||||
"File not open for writing for fprintf",
|
||||
"Non-string first (fmt) argument for strprintf",
|
||||
"Error in attempting strprintf ???",
|
||||
"Non-file first argument for fscan",
|
||||
"File not open for reading for fscan",
|
||||
"Non-string first argument for strscan",
|
||||
"Non-file first argument for fscanf",
|
||||
"Non-string second (fmt) argument for fscanf",
|
||||
"Non-lvalue argument after second for fscanf",
|
||||
"File not open for reading or other error for fscanf",
|
||||
"Non-string first argument for strscanf",
|
||||
"Non-string second (fmt) argument for strscanf",
|
||||
"Non-lvalue argument after second for strscanf",
|
||||
"Some error in attempting strscanf ???",
|
||||
"Non-string first (fmt) argument for scanf",
|
||||
"Non-lvalue argument after first for scanf",
|
||||
"Some error in attempting scanf ???",
|
||||
"Non-file argument for ftell",
|
||||
"File not open or other error for ftell",
|
||||
"Non-file first argument for fseek",
|
||||
"Non-integer or negative second argument for fseek",
|
||||
"File not open or other error for fseek",
|
||||
"Non-file argument for fsize",
|
||||
"File not open or other error for fsize",
|
||||
"Non-file argument for feof",
|
||||
"File not open or other error for feof",
|
||||
"Non-file argument for ferror",
|
||||
"File not open or other error for ferror",
|
||||
"Non-file argument for ungetc",
|
||||
"File not open for reading for ungetc",
|
||||
"Bad second argument or other error for ungetc",
|
||||
"Exponent too big in scanning",
|
||||
"E_ISATTY1 is no longer used",
|
||||
"E_ISATTY2 is no longer used",
|
||||
"Non-string first argument for access",
|
||||
"Bad second argument for access",
|
||||
"Bad first argument for search",
|
||||
"Bad second argument for search",
|
||||
"Bad third argument for search",
|
||||
"Bad fourth argument for search",
|
||||
"Cannot find fsize or fpos for search",
|
||||
"File not readable for search",
|
||||
"Bad first argument for rsearch",
|
||||
"Bad second argument for rsearch",
|
||||
"Bad third argument for rsearch",
|
||||
"Bad fourth argument for rsearch",
|
||||
"Cannot find fsize or fpos for rsearch",
|
||||
"File not readable for rsearch",
|
||||
"Too many open files",
|
||||
"Attempt to rewind a file that is not open",
|
||||
"Bad argument type for strerror",
|
||||
"Index out of range for strerror",
|
||||
"Bad epsilon for cos",
|
||||
"Bad first argument for cos",
|
||||
"Bad epsilon for sin",
|
||||
"Bad first argument for sin",
|
||||
"Non-string argument for eval",
|
||||
"Bad epsilon for arg",
|
||||
"Bad first argument for arg",
|
||||
"Non-real argument for polar",
|
||||
"Bad epsilon for polar",
|
||||
"Non-integral argument for fcnt",
|
||||
"Non-variable first argument for matfill",
|
||||
"Non-matrix first argument-value for matfill",
|
||||
"Non-matrix argument for matdim",
|
||||
"Non-matrix argument for matsum",
|
||||
"E_ISIDENT is no longer used",
|
||||
"Non-matrix argument for mattrans",
|
||||
"Non-two-dimensional matrix for mattrans",
|
||||
"Non-matrix argument for det",
|
||||
"Matrix for det not of dimension 2",
|
||||
"Non-square matrix for det",
|
||||
"Non-matrix first argument for matmin",
|
||||
"Non-positive-integer second argument for matmin",
|
||||
"Second argument for matmin exceeds dimension",
|
||||
"Non-matrix first argument for matmin",
|
||||
"Second argument for matmax not positive integer",
|
||||
"Second argument for matmax exceeds dimension",
|
||||
"Non-matrix argument for cp",
|
||||
"Non-one-dimensional matrix for cp",
|
||||
"Matrix size not 3 for cp",
|
||||
"Non-matrix argument for dp",
|
||||
"Non-one-dimensional matrix for dp",
|
||||
"Different-size matrices for dp",
|
||||
"Non-string argument for strlen",
|
||||
"Non-string argument for strcat",
|
||||
"Non-string first argument for strcat",
|
||||
"Non-non-negative integer second argument for strcat",
|
||||
"Bad argument for char",
|
||||
"Non-string argument for ord",
|
||||
"Non-list-variable first argument for insert",
|
||||
"Non-integral second argument for insert",
|
||||
"Non-list-variable first argument for push",
|
||||
"Non-list-variable first argument for append",
|
||||
"Non-list-variable first argument for delete",
|
||||
"Non-integral second argument for delete",
|
||||
"Non-list-variable argument for pop",
|
||||
"Non-list-variable argument for remove",
|
||||
"Bad epsilon argument for ln",
|
||||
"Non-numeric first argument for ln",
|
||||
"Non-integer argument for error",
|
||||
"Argument outside range for error",
|
||||
"Attempt to eval at maximum input depth",
|
||||
"Unable to open string for reading",
|
||||
"First argument for rm is not a non-empty string",
|
||||
"Unable to remove a file",
|
||||
"Operation allowed because calc mode disallows read operations",
|
||||
"Operation allowed because calc mode disallows write operations",
|
||||
"Operation allowed because calc mode disallows exec operations",
|
||||
"Unordered arguments for min",
|
||||
"Unordered arguments for max",
|
||||
"Unordered items for minimum of list",
|
||||
"Unordered items for maximum of list",
|
||||
"Size undefined for argument type",
|
||||
"Calc must be run with a -C argument to use custom function",
|
||||
"Calc was built with custom functions disabled",
|
||||
"Custom function unknown, try: show custom",
|
||||
"Non-integral length for block",
|
||||
"Negative or too-large length for block",
|
||||
"Non-integral chunksize for block",
|
||||
"Negative or too-large chunksize for block",
|
||||
"Named block does not exist for blkfree",
|
||||
"Non-integral id specification for blkfree",
|
||||
"Block with specified id does not exist",
|
||||
"Block already freed",
|
||||
"No-realloc protection prevents blkfree",
|
||||
"Non-integer argument for blocks",
|
||||
"Non-allocated index number for blocks",
|
||||
"Non-integer or negative source index for copy",
|
||||
"Source index too large for copy",
|
||||
"E_COPY3 is no longer used",
|
||||
"Non-integer or negative number for copy",
|
||||
"Number too large for copy",
|
||||
"Non-integer or negative destination index for copy",
|
||||
"Destination index too large for copy",
|
||||
"Freed block source for copy",
|
||||
"Unsuitable source type for copy",
|
||||
"Freed block destinction for copy",
|
||||
"Unsuitable destination type for copy",
|
||||
"Incompatible source and destination for copy",
|
||||
"No-copy-from source variable",
|
||||
"No-copy-to destination variable",
|
||||
"No-copy-from source named block",
|
||||
"No-copy-to destination named block",
|
||||
"No-relocation destination for copy",
|
||||
"File not open for copy",
|
||||
"fseek or fsize failure for copy",
|
||||
"fwrite error for copy",
|
||||
"fread error for copy",
|
||||
"Non-variable first argument for protect",
|
||||
"Non-integer second argument for protect",
|
||||
"Out-of-range second argument for protect",
|
||||
"No-copy-to destination for matfill",
|
||||
"No-assign-from source for matfill",
|
||||
"Non-matrix argument for mattrace",
|
||||
"Non-two-dimensional argument for mattrace",
|
||||
"Non-square argument for mattrace",
|
||||
"Bad epsilon for tan",
|
||||
"Bad argument for tan",
|
||||
"Bad epsilon for cot",
|
||||
"Bad argument for cot",
|
||||
"Bad epsilon for sec",
|
||||
"Bad argument for sec",
|
||||
"Bad epsilon for csc",
|
||||
"Bad argument for csc",
|
||||
"Bad epsilon for sinh",
|
||||
"Bad argument for sinh",
|
||||
"Bad epsilon for cosh",
|
||||
"Bad argument for cosh",
|
||||
"Bad epsilon for tanh",
|
||||
"Bad argument for tanh",
|
||||
"Bad epsilon for coth",
|
||||
"Bad argument for coth",
|
||||
"Bad epsilon for sech",
|
||||
"Bad argument for sech",
|
||||
"Bad epsilon for csch",
|
||||
"Bad argument for csch",
|
||||
"Bad epsilon for asin",
|
||||
"Bad argument for asin",
|
||||
"Bad epsilon for acos",
|
||||
"Bad argument for acos",
|
||||
"Bad epsilon for atan",
|
||||
"Bad argument for atan",
|
||||
"Bad epsilon for acot",
|
||||
"Bad argument for acot",
|
||||
"Bad epsilon for asec",
|
||||
"Bad argument for asec",
|
||||
"Bad epsilon for acsc",
|
||||
"Bad argument for acsc",
|
||||
"Bad epsilon for asin",
|
||||
"Bad argument for asinh",
|
||||
"Bad epsilon for acosh",
|
||||
"Bad argument for acosh",
|
||||
"Bad epsilon for atanh",
|
||||
"Bad argument for atanh",
|
||||
"Bad epsilon for acoth",
|
||||
"Bad argument for acoth",
|
||||
"Bad epsilon for asech",
|
||||
"Bad argument for asech",
|
||||
"Bad epsilon for acsch",
|
||||
"Bad argument for acsch",
|
||||
"Bad epsilon for gd",
|
||||
"Bad argument for gd",
|
||||
"Bad epsilon for agd",
|
||||
"Bad argument for agd",
|
||||
"Log of zero or infinity",
|
||||
"String addition failure",
|
||||
"String multiplication failure",
|
||||
"String reversal failure",
|
||||
"String subtraction failure",
|
||||
"Bad argument type for bit",
|
||||
"Index too large for bit",
|
||||
"Non-integer second argument for setbit",
|
||||
"Out-of-range index for setbit",
|
||||
"Non-string first argument for setbit",
|
||||
"Bad argument for or",
|
||||
"Bad argument for and",
|
||||
"Allocation failure for string or",
|
||||
"Allocation failure for string and",
|
||||
"Bad argument for xorvalue",
|
||||
"Bad argument for comp",
|
||||
"Allocation failure for string diff",
|
||||
"Allocation failure for string comp",
|
||||
"Bad first argument for segment",
|
||||
"Bad second argument for segment",
|
||||
"Bad third argument for segment",
|
||||
"Failure for string segment",
|
||||
"Bad argument type for highbit",
|
||||
"Non-integer argument for highbit",
|
||||
"Bad argument type for lowbit",
|
||||
"Non-integer argument for lowbit",
|
||||
"Bad argument type for unary hash op",
|
||||
"Bad argument type for binary hash op",
|
||||
"Bad first argument for head",
|
||||
"Bad second argument for head",
|
||||
"Failure for strhead",
|
||||
"Bad first argument for tail",
|
||||
"Bad second argument for tail",
|
||||
"Failure for strtail",
|
||||
"Failure for strshift",
|
||||
"Non-string argument for strcmp",
|
||||
"Bad argument type for strncmp",
|
||||
"Varying types of argument for xor",
|
||||
"Bad argument type for xor",
|
||||
"Bad argument type for strcpy",
|
||||
"Bad argument type for strncpy",
|
||||
"Bad argument type for unary backslash",
|
||||
"Bad argument type for setminus",
|
||||
"Bad first argument type for indices",
|
||||
"Bad second argument for indices",
|
||||
"Too-large re(argument) for exp",
|
||||
"Too-large re(argument) for sinh",
|
||||
"Too-large re(argument) for cosh",
|
||||
"Too-large im(argument) for sin",
|
||||
"Too-large im(argument) for cos",
|
||||
"Infinite or too-large result for gd",
|
||||
"Infinite or too-large result for agd",
|
||||
"Too-large value for power",
|
||||
"Too-large value for root",
|
||||
"Non-real first arg for digit",
|
||||
"Non-integral second arg for digit",
|
||||
"Bad third arg for digit",
|
||||
"Bad first argument for places",
|
||||
"Bad second argument for places",
|
||||
"Bad first argument for digits",
|
||||
"Bad second argument for digits",
|
||||
"Bad first argument for ilog",
|
||||
"Bad second argument for ilog",
|
||||
"Bad argument for ilog10",
|
||||
"Bad argument for ilog2",
|
||||
"Non-integer second arg for comb",
|
||||
"Too-large second arg for comb",
|
||||
"Bad argument for catalan",
|
||||
"Bad argument for bern",
|
||||
"Bad argument for euler",
|
||||
"Bad argument for sleep",
|
||||
"calc_tty failure",
|
||||
NULL
|
||||
};
|
383
win32/calcerr.h
Normal file
383
win32/calcerr.h
Normal file
@@ -0,0 +1,383 @@
|
||||
/*
|
||||
* DO NOT EDIT
|
||||
*
|
||||
* generated by calcerr.tbl via Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__CALCERR_H__)
|
||||
#define __CALCERR_H__
|
||||
|
||||
|
||||
#define E__BASE 10000 /* calc errors start above here */
|
||||
|
||||
#define E_1OVER0 10001 /* Division by zero */
|
||||
#define E_0OVER0 10002 /* Indeterminate (0/0) */
|
||||
#define E_ADD 10003 /* Bad arguments for + */
|
||||
#define E_SUB 10004 /* Bad arguments for binary - */
|
||||
#define E_MUL 10005 /* Bad arguments for * */
|
||||
#define E_DIV 10006 /* Bad arguments for / */
|
||||
#define E_NEG 10007 /* Bad argument for unary - */
|
||||
#define E_SQUARE 10008 /* Bad argument for squaring */
|
||||
#define E_INV 10009 /* Bad argument for inverse */
|
||||
#define E_INCV 10010 /* Bad argument for ++ */
|
||||
#define E_DECV 10011 /* Bad argument for -- */
|
||||
#define E_INT 10012 /* Bad argument for int */
|
||||
#define E_FRAC 10013 /* Bad argument for frac */
|
||||
#define E_CONJ 10014 /* Bad argument for conj */
|
||||
#define E_APPR 10015 /* Bad first argument for appr */
|
||||
#define E_APPR2 10016 /* Bad second argument for appr */
|
||||
#define E_APPR3 10017 /* Bad third argument for appr */
|
||||
#define E_ROUND 10018 /* Bad first argument for round */
|
||||
#define E_ROUND2 10019 /* Bad second argument for round */
|
||||
#define E_ROUND3 10020 /* Bad third argument for round */
|
||||
#define E_BROUND 10021 /* Bad first argument for bround */
|
||||
#define E_BROUND2 10022 /* Bad second argument for bround */
|
||||
#define E_BROUND3 10023 /* Bad third argument for bround */
|
||||
#define E_SQRT 10024 /* Bad first argument for sqrt */
|
||||
#define E_SQRT2 10025 /* Bad second argument for sqrt */
|
||||
#define E_SQRT3 10026 /* Bad third argument for sqrt */
|
||||
#define E_ROOT 10027 /* Bad first argument for root */
|
||||
#define E_ROOT2 10028 /* Bad second argument for root */
|
||||
#define E_ROOT3 10029 /* Bad third argument for root */
|
||||
#define E_NORM 10030 /* Bad argument for norm */
|
||||
#define E_SHIFT 10031 /* Bad first argument for << or >> */
|
||||
#define E_SHIFT2 10032 /* Bad second argument for << or >> */
|
||||
#define E_SCALE 10033 /* Bad first argument for scale */
|
||||
#define E_SCALE2 10034 /* Bad second argument for scale */
|
||||
#define E_POWI 10035 /* Bad first argument for ^ */
|
||||
#define E_POWI2 10036 /* Bad second argument for ^ */
|
||||
#define E_POWER 10037 /* Bad first argument for power */
|
||||
#define E_POWER2 10038 /* Bad second argument for power */
|
||||
#define E_POWER3 10039 /* Bad third argument for power */
|
||||
#define E_QUO 10040 /* Bad first argument for quo or // */
|
||||
#define E_QUO2 10041 /* Bad second argument for quo or // */
|
||||
#define E_QUO3 10042 /* Bad third argument for quo */
|
||||
#define E_MOD 10043 /* Bad first argument for mod or % */
|
||||
#define E_MOD2 10044 /* Bad second argument for mod or % */
|
||||
#define E_MOD3 10045 /* Bad third argument for mod */
|
||||
#define E_SGN 10046 /* Bad argument for sgn */
|
||||
#define E_ABS 10047 /* Bad first argument for abs */
|
||||
#define E_ABS2 10048 /* Bad second argument for abs */
|
||||
#define E_EVAL 10049 /* Scan error in argument for eval */
|
||||
#define E_STR 10050 /* Non-simple type for str */
|
||||
#define E_EXP1 10051 /* Non-real epsilon for exp */
|
||||
#define E_EXP2 10052 /* Bad first argument for exp */
|
||||
#define E_FPUTC1 10053 /* Non-file first argument for fputc */
|
||||
#define E_FPUTC2 10054 /* Bad second argument for fputc */
|
||||
#define E_FPUTC3 10055 /* File not open for writing for fputc */
|
||||
#define E_FGETC1 10056 /* Non-file first argument for fgetc */
|
||||
#define E_FGETC2 10057 /* File not open for reading for fgetc */
|
||||
#define E_FOPEN1 10058 /* Non-string arguments for fopen */
|
||||
#define E_FOPEN2 10059 /* Unrecognized mode for fopen */
|
||||
#define E_FREOPEN1 10060 /* Non-file first argument for freopen */
|
||||
#define E_FREOPEN2 10061 /* Non-string or unrecognized mode for freopen */
|
||||
#define E_FREOPEN3 10062 /* Non-string third argument for freopen */
|
||||
#define E_FCLOSE1 10063 /* Non-file argument for fclose */
|
||||
#define E_FFLUSH 10064 /* Non-file argument for fflush */
|
||||
#define E_FPUTS1 10065 /* Non-file first argument for fputs */
|
||||
#define E_FPUTS2 10066 /* Non-string argument after first for fputs */
|
||||
#define E_FPUTS3 10067 /* File not open for writing for fputs */
|
||||
#define E_FGETS1 10068 /* Non-file argument for fgets */
|
||||
#define E_FGETS2 10069 /* File not open for reading for fgets */
|
||||
#define E_FPUTSTR1 10070 /* Non-file first argument for fputstr */
|
||||
#define E_FPUTSTR2 10071 /* Non-string argument after first for fputstr */
|
||||
#define E_FPUTSTR3 10072 /* File not open for writing for fputstr */
|
||||
#define E_FGETSTR1 10073 /* Non-file first argument for fgetstr */
|
||||
#define E_FGETSTR2 10074 /* File not open for reading for fgetstr */
|
||||
#define E_FGETLINE1 10075 /* Non-file argument for fgetline */
|
||||
#define E_FGETLINE2 10076 /* File not open for reading for fgetline */
|
||||
#define E_FGETWORD1 10077 /* Non-file argument for fgetword */
|
||||
#define E_FGETWORD2 10078 /* File not open for reading for fgetword */
|
||||
#define E_REWIND1 10079 /* Non-file argument for rewind */
|
||||
#define E_FILES 10080 /* Non-integer argument for files */
|
||||
#define E_PRINTF1 10081 /* Non-string fmt argument for fprint */
|
||||
#define E_PRINTF2 10082 /* Stdout not open for writing to ??? */
|
||||
#define E_FPRINTF1 10083 /* Non-file first argument for fprintf */
|
||||
#define E_FPRINTF2 10084 /* Non-string second (fmt) argument for fprintf */
|
||||
#define E_FPRINTF3 10085 /* File not open for writing for fprintf */
|
||||
#define E_STRPRINTF1 10086 /* Non-string first (fmt) argument for strprintf */
|
||||
#define E_STRPRINTF2 10087 /* Error in attempting strprintf ??? */
|
||||
#define E_FSCAN1 10088 /* Non-file first argument for fscan */
|
||||
#define E_FSCAN2 10089 /* File not open for reading for fscan */
|
||||
#define E_STRSCAN 10090 /* Non-string first argument for strscan */
|
||||
#define E_FSCANF1 10091 /* Non-file first argument for fscanf */
|
||||
#define E_FSCANF2 10092 /* Non-string second (fmt) argument for fscanf */
|
||||
#define E_FSCANF3 10093 /* Non-lvalue argument after second for fscanf */
|
||||
#define E_FSCANF4 10094 /* File not open for reading or other error for fscanf */
|
||||
#define E_STRSCANF1 10095 /* Non-string first argument for strscanf */
|
||||
#define E_STRSCANF2 10096 /* Non-string second (fmt) argument for strscanf */
|
||||
#define E_STRSCANF3 10097 /* Non-lvalue argument after second for strscanf */
|
||||
#define E_STRSCANF4 10098 /* Some error in attempting strscanf ??? */
|
||||
#define E_SCANF1 10099 /* Non-string first (fmt) argument for scanf */
|
||||
#define E_SCANF2 10100 /* Non-lvalue argument after first for scanf */
|
||||
#define E_SCANF3 10101 /* Some error in attempting scanf ??? */
|
||||
#define E_FTELL1 10102 /* Non-file argument for ftell */
|
||||
#define E_FTELL2 10103 /* File not open or other error for ftell */
|
||||
#define E_FSEEK1 10104 /* Non-file first argument for fseek */
|
||||
#define E_FSEEK2 10105 /* Non-integer or negative second argument for fseek */
|
||||
#define E_FSEEK3 10106 /* File not open or other error for fseek */
|
||||
#define E_FSIZE1 10107 /* Non-file argument for fsize */
|
||||
#define E_FSIZE2 10108 /* File not open or other error for fsize */
|
||||
#define E_FEOF1 10109 /* Non-file argument for feof */
|
||||
#define E_FEOF2 10110 /* File not open or other error for feof */
|
||||
#define E_FERROR1 10111 /* Non-file argument for ferror */
|
||||
#define E_FERROR2 10112 /* File not open or other error for ferror */
|
||||
#define E_UNGETC1 10113 /* Non-file argument for ungetc */
|
||||
#define E_UNGETC2 10114 /* File not open for reading for ungetc */
|
||||
#define E_UNGETC3 10115 /* Bad second argument or other error for ungetc */
|
||||
#define E_BIGEXP 10116 /* Exponent too big in scanning */
|
||||
#define E_ISATTY1 10117 /* E_ISATTY1 is no longer used */
|
||||
#define E_ISATTY2 10118 /* E_ISATTY2 is no longer used */
|
||||
#define E_ACCESS1 10119 /* Non-string first argument for access */
|
||||
#define E_ACCESS2 10120 /* Bad second argument for access */
|
||||
#define E_SEARCH1 10121 /* Bad first argument for search */
|
||||
#define E_SEARCH2 10122 /* Bad second argument for search */
|
||||
#define E_SEARCH3 10123 /* Bad third argument for search */
|
||||
#define E_SEARCH4 10124 /* Bad fourth argument for search */
|
||||
#define E_SEARCH5 10125 /* Cannot find fsize or fpos for search */
|
||||
#define E_SEARCH6 10126 /* File not readable for search */
|
||||
#define E_RSEARCH1 10127 /* Bad first argument for rsearch */
|
||||
#define E_RSEARCH2 10128 /* Bad second argument for rsearch */
|
||||
#define E_RSEARCH3 10129 /* Bad third argument for rsearch */
|
||||
#define E_RSEARCH4 10130 /* Bad fourth argument for rsearch */
|
||||
#define E_RSEARCH5 10131 /* Cannot find fsize or fpos for rsearch */
|
||||
#define E_RSEARCH6 10132 /* File not readable for rsearch */
|
||||
#define E_FOPEN3 10133 /* Too many open files */
|
||||
#define E_REWIND2 10134 /* Attempt to rewind a file that is not open */
|
||||
#define E_STRERROR1 10135 /* Bad argument type for strerror */
|
||||
#define E_STRERROR2 10136 /* Index out of range for strerror */
|
||||
#define E_COS1 10137 /* Bad epsilon for cos */
|
||||
#define E_COS2 10138 /* Bad first argument for cos */
|
||||
#define E_SIN1 10139 /* Bad epsilon for sin */
|
||||
#define E_SIN2 10140 /* Bad first argument for sin */
|
||||
#define E_EVAL2 10141 /* Non-string argument for eval */
|
||||
#define E_ARG1 10142 /* Bad epsilon for arg */
|
||||
#define E_ARG2 10143 /* Bad first argument for arg */
|
||||
#define E_POLAR1 10144 /* Non-real argument for polar */
|
||||
#define E_POLAR2 10145 /* Bad epsilon for polar */
|
||||
#define E_FCNT 10146 /* Non-integral argument for fcnt */
|
||||
#define E_MATFILL1 10147 /* Non-variable first argument for matfill */
|
||||
#define E_MATFILL2 10148 /* Non-matrix first argument-value for matfill */
|
||||
#define E_MATDIM 10149 /* Non-matrix argument for matdim */
|
||||
#define E_MATSUM 10150 /* Non-matrix argument for matsum */
|
||||
#define E_ISIDENT 10151 /* E_ISIDENT is no longer used */
|
||||
#define E_MATTRANS1 10152 /* Non-matrix argument for mattrans */
|
||||
#define E_MATTRANS2 10153 /* Non-two-dimensional matrix for mattrans */
|
||||
#define E_DET1 10154 /* Non-matrix argument for det */
|
||||
#define E_DET2 10155 /* Matrix for det not of dimension 2 */
|
||||
#define E_DET3 10156 /* Non-square matrix for det */
|
||||
#define E_MATMIN1 10157 /* Non-matrix first argument for matmin */
|
||||
#define E_MATMIN2 10158 /* Non-positive-integer second argument for matmin */
|
||||
#define E_MATMIN3 10159 /* Second argument for matmin exceeds dimension */
|
||||
#define E_MATMAX1 10160 /* Non-matrix first argument for matmin */
|
||||
#define E_MATMAX2 10161 /* Second argument for matmax not positive integer */
|
||||
#define E_MATMAX3 10162 /* Second argument for matmax exceeds dimension */
|
||||
#define E_CP1 10163 /* Non-matrix argument for cp */
|
||||
#define E_CP2 10164 /* Non-one-dimensional matrix for cp */
|
||||
#define E_CP3 10165 /* Matrix size not 3 for cp */
|
||||
#define E_DP1 10166 /* Non-matrix argument for dp */
|
||||
#define E_DP2 10167 /* Non-one-dimensional matrix for dp */
|
||||
#define E_DP3 10168 /* Different-size matrices for dp */
|
||||
#define E_STRLEN 10169 /* Non-string argument for strlen */
|
||||
#define E_STRCAT 10170 /* Non-string argument for strcat */
|
||||
#define E_SUBSTR1 10171 /* Non-string first argument for strcat */
|
||||
#define E_SUBSTR2 10172 /* Non-non-negative integer second argument for strcat */
|
||||
#define E_CHAR 10173 /* Bad argument for char */
|
||||
#define E_ORD 10174 /* Non-string argument for ord */
|
||||
#define E_INSERT1 10175 /* Non-list-variable first argument for insert */
|
||||
#define E_INSERT2 10176 /* Non-integral second argument for insert */
|
||||
#define E_PUSH 10177 /* Non-list-variable first argument for push */
|
||||
#define E_APPEND 10178 /* Non-list-variable first argument for append */
|
||||
#define E_DELETE1 10179 /* Non-list-variable first argument for delete */
|
||||
#define E_DELETE2 10180 /* Non-integral second argument for delete */
|
||||
#define E_POP 10181 /* Non-list-variable argument for pop */
|
||||
#define E_REMOVE 10182 /* Non-list-variable argument for remove */
|
||||
#define E_LN1 10183 /* Bad epsilon argument for ln */
|
||||
#define E_LN2 10184 /* Non-numeric first argument for ln */
|
||||
#define E_ERROR1 10185 /* Non-integer argument for error */
|
||||
#define E_ERROR2 10186 /* Argument outside range for error */
|
||||
#define E_EVAL3 10187 /* Attempt to eval at maximum input depth */
|
||||
#define E_EVAL4 10188 /* Unable to open string for reading */
|
||||
#define E_RM1 10189 /* First argument for rm is not a non-empty string */
|
||||
#define E_RM2 10190 /* Unable to remove a file */
|
||||
#define E_RDPERM 10191 /* Operation allowed because calc mode disallows read operations */
|
||||
#define E_WRPERM 10192 /* Operation allowed because calc mode disallows write operations */
|
||||
#define E_EXPERM 10193 /* Operation allowed because calc mode disallows exec operations */
|
||||
#define E_MIN 10194 /* Unordered arguments for min */
|
||||
#define E_MAX 10195 /* Unordered arguments for max */
|
||||
#define E_LISTMIN 10196 /* Unordered items for minimum of list */
|
||||
#define E_LISTMAX 10197 /* Unordered items for maximum of list */
|
||||
#define E_SIZE 10198 /* Size undefined for argument type */
|
||||
#define E_NO_C_ARG 10199 /* Calc must be run with a -C argument to use custom function */
|
||||
#define E_NO_CUSTOM 10200 /* Calc was built with custom functions disabled */
|
||||
#define E_UNK_CUSTOM 10201 /* Custom function unknown, try: show custom */
|
||||
#define E_BLK1 10202 /* Non-integral length for block */
|
||||
#define E_BLK2 10203 /* Negative or too-large length for block */
|
||||
#define E_BLK3 10204 /* Non-integral chunksize for block */
|
||||
#define E_BLK4 10205 /* Negative or too-large chunksize for block */
|
||||
#define E_BLKFREE1 10206 /* Named block does not exist for blkfree */
|
||||
#define E_BLKFREE2 10207 /* Non-integral id specification for blkfree */
|
||||
#define E_BLKFREE3 10208 /* Block with specified id does not exist */
|
||||
#define E_BLKFREE4 10209 /* Block already freed */
|
||||
#define E_BLKFREE5 10210 /* No-realloc protection prevents blkfree */
|
||||
#define E_BLOCKS1 10211 /* Non-integer argument for blocks */
|
||||
#define E_BLOCKS2 10212 /* Non-allocated index number for blocks */
|
||||
#define E_COPY1 10213 /* Non-integer or negative source index for copy */
|
||||
#define E_COPY2 10214 /* Source index too large for copy */
|
||||
#define E_COPY3 10215 /* E_COPY3 is no longer used */
|
||||
#define E_COPY4 10216 /* Non-integer or negative number for copy */
|
||||
#define E_COPY5 10217 /* Number too large for copy */
|
||||
#define E_COPY6 10218 /* Non-integer or negative destination index for copy */
|
||||
#define E_COPY7 10219 /* Destination index too large for copy */
|
||||
#define E_COPY8 10220 /* Freed block source for copy */
|
||||
#define E_COPY9 10221 /* Unsuitable source type for copy */
|
||||
#define E_COPY10 10222 /* Freed block destinction for copy */
|
||||
#define E_COPY11 10223 /* Unsuitable destination type for copy */
|
||||
#define E_COPY12 10224 /* Incompatible source and destination for copy */
|
||||
#define E_COPY13 10225 /* No-copy-from source variable */
|
||||
#define E_COPY14 10226 /* No-copy-to destination variable */
|
||||
#define E_COPY15 10227 /* No-copy-from source named block */
|
||||
#define E_COPY16 10228 /* No-copy-to destination named block */
|
||||
#define E_COPY17 10229 /* No-relocation destination for copy */
|
||||
#define E_COPYF1 10230 /* File not open for copy */
|
||||
#define E_COPYF2 10231 /* fseek or fsize failure for copy */
|
||||
#define E_COPYF3 10232 /* fwrite error for copy */
|
||||
#define E_COPYF4 10233 /* fread error for copy */
|
||||
#define E_PROTECT1 10234 /* Non-variable first argument for protect */
|
||||
#define E_PROTECT2 10235 /* Non-integer second argument for protect */
|
||||
#define E_PROTECT3 10236 /* Out-of-range second argument for protect */
|
||||
#define E_MATFILL3 10237 /* No-copy-to destination for matfill */
|
||||
#define E_MATFILL4 10238 /* No-assign-from source for matfill */
|
||||
#define E_MATTRACE1 10239 /* Non-matrix argument for mattrace */
|
||||
#define E_MATTRACE2 10240 /* Non-two-dimensional argument for mattrace */
|
||||
#define E_MATTRACE3 10241 /* Non-square argument for mattrace */
|
||||
#define E_TAN1 10242 /* Bad epsilon for tan */
|
||||
#define E_TAN2 10243 /* Bad argument for tan */
|
||||
#define E_COT1 10244 /* Bad epsilon for cot */
|
||||
#define E_COT2 10245 /* Bad argument for cot */
|
||||
#define E_SEC1 10246 /* Bad epsilon for sec */
|
||||
#define E_SEC2 10247 /* Bad argument for sec */
|
||||
#define E_CSC1 10248 /* Bad epsilon for csc */
|
||||
#define E_CSC2 10249 /* Bad argument for csc */
|
||||
#define E_SINH1 10250 /* Bad epsilon for sinh */
|
||||
#define E_SINH2 10251 /* Bad argument for sinh */
|
||||
#define E_COSH1 10252 /* Bad epsilon for cosh */
|
||||
#define E_COSH2 10253 /* Bad argument for cosh */
|
||||
#define E_TANH1 10254 /* Bad epsilon for tanh */
|
||||
#define E_TANH2 10255 /* Bad argument for tanh */
|
||||
#define E_COTH1 10256 /* Bad epsilon for coth */
|
||||
#define E_COTH2 10257 /* Bad argument for coth */
|
||||
#define E_SECH1 10258 /* Bad epsilon for sech */
|
||||
#define E_SECH2 10259 /* Bad argument for sech */
|
||||
#define E_CSCH1 10260 /* Bad epsilon for csch */
|
||||
#define E_CSCH2 10261 /* Bad argument for csch */
|
||||
#define E_ASIN1 10262 /* Bad epsilon for asin */
|
||||
#define E_ASIN2 10263 /* Bad argument for asin */
|
||||
#define E_ACOS1 10264 /* Bad epsilon for acos */
|
||||
#define E_ACOS2 10265 /* Bad argument for acos */
|
||||
#define E_ATAN1 10266 /* Bad epsilon for atan */
|
||||
#define E_ATAN2 10267 /* Bad argument for atan */
|
||||
#define E_ACOT1 10268 /* Bad epsilon for acot */
|
||||
#define E_ACOT2 10269 /* Bad argument for acot */
|
||||
#define E_ASEC1 10270 /* Bad epsilon for asec */
|
||||
#define E_ASEC2 10271 /* Bad argument for asec */
|
||||
#define E_ACSC1 10272 /* Bad epsilon for acsc */
|
||||
#define E_ACSC2 10273 /* Bad argument for acsc */
|
||||
#define E_ASINH1 10274 /* Bad epsilon for asin */
|
||||
#define E_ASINH2 10275 /* Bad argument for asinh */
|
||||
#define E_ACOSH1 10276 /* Bad epsilon for acosh */
|
||||
#define E_ACOSH2 10277 /* Bad argument for acosh */
|
||||
#define E_ATANH1 10278 /* Bad epsilon for atanh */
|
||||
#define E_ATANH2 10279 /* Bad argument for atanh */
|
||||
#define E_ACOTH1 10280 /* Bad epsilon for acoth */
|
||||
#define E_ACOTH2 10281 /* Bad argument for acoth */
|
||||
#define E_ASECH1 10282 /* Bad epsilon for asech */
|
||||
#define E_ASECH2 10283 /* Bad argument for asech */
|
||||
#define E_ACSCH1 10284 /* Bad epsilon for acsch */
|
||||
#define E_ACSCH2 10285 /* Bad argument for acsch */
|
||||
#define E_GD1 10286 /* Bad epsilon for gd */
|
||||
#define E_GD2 10287 /* Bad argument for gd */
|
||||
#define E_AGD1 10288 /* Bad epsilon for agd */
|
||||
#define E_AGD2 10289 /* Bad argument for agd */
|
||||
#define E_LOGINF 10290 /* Log of zero or infinity */
|
||||
#define E_STRADD 10291 /* String addition failure */
|
||||
#define E_STRMUL 10292 /* String multiplication failure */
|
||||
#define E_STRNEG 10293 /* String reversal failure */
|
||||
#define E_STRSUB 10294 /* String subtraction failure */
|
||||
#define E_BIT1 10295 /* Bad argument type for bit */
|
||||
#define E_BIT2 10296 /* Index too large for bit */
|
||||
#define E_SETBIT1 10297 /* Non-integer second argument for setbit */
|
||||
#define E_SETBIT2 10298 /* Out-of-range index for setbit */
|
||||
#define E_SETBIT3 10299 /* Non-string first argument for setbit */
|
||||
#define E_OR 10300 /* Bad argument for or */
|
||||
#define E_AND 10301 /* Bad argument for and */
|
||||
#define E_STROR 10302 /* Allocation failure for string or */
|
||||
#define E_STRAND 10303 /* Allocation failure for string and */
|
||||
#define E_XOR 10304 /* Bad argument for xorvalue */
|
||||
#define E_COMP 10305 /* Bad argument for comp */
|
||||
#define E_STRDIFF 10306 /* Allocation failure for string diff */
|
||||
#define E_STRCOMP 10307 /* Allocation failure for string comp */
|
||||
#define E_SEG1 10308 /* Bad first argument for segment */
|
||||
#define E_SEG2 10309 /* Bad second argument for segment */
|
||||
#define E_SEG3 10310 /* Bad third argument for segment */
|
||||
#define E_STRSEG 10311 /* Failure for string segment */
|
||||
#define E_HIGHBIT1 10312 /* Bad argument type for highbit */
|
||||
#define E_HIGHBIT2 10313 /* Non-integer argument for highbit */
|
||||
#define E_LOWBIT1 10314 /* Bad argument type for lowbit */
|
||||
#define E_LOWBIT2 10315 /* Non-integer argument for lowbit */
|
||||
#define E_CONTENT 10316 /* Bad argument type for unary hash op */
|
||||
#define E_HASHOP 10317 /* Bad argument type for binary hash op */
|
||||
#define E_HEAD1 10318 /* Bad first argument for head */
|
||||
#define E_HEAD2 10319 /* Bad second argument for head */
|
||||
#define E_STRHEAD 10320 /* Failure for strhead */
|
||||
#define E_TAIL1 10321 /* Bad first argument for tail */
|
||||
#define E_TAIL2 10322 /* Bad second argument for tail */
|
||||
#define E_STRTAIL 10323 /* Failure for strtail */
|
||||
#define E_STRSHIFT 10324 /* Failure for strshift */
|
||||
#define E_STRCMP 10325 /* Non-string argument for strcmp */
|
||||
#define E_STRNCMP 10326 /* Bad argument type for strncmp */
|
||||
#define E_XOR1 10327 /* Varying types of argument for xor */
|
||||
#define E_XOR2 10328 /* Bad argument type for xor */
|
||||
#define E_STRCPY 10329 /* Bad argument type for strcpy */
|
||||
#define E_STRNCPY 10330 /* Bad argument type for strncpy */
|
||||
#define E_BACKSLASH 10331 /* Bad argument type for unary backslash */
|
||||
#define E_SETMINUS 10332 /* Bad argument type for setminus */
|
||||
#define E_INDICES1 10333 /* Bad first argument type for indices */
|
||||
#define E_INDICES2 10334 /* Bad second argument for indices */
|
||||
#define E_EXP3 10335 /* Too-large re(argument) for exp */
|
||||
#define E_SINH3 10336 /* Too-large re(argument) for sinh */
|
||||
#define E_COSH3 10337 /* Too-large re(argument) for cosh */
|
||||
#define E_SIN3 10338 /* Too-large im(argument) for sin */
|
||||
#define E_COS3 10339 /* Too-large im(argument) for cos */
|
||||
#define E_GD3 10340 /* Infinite or too-large result for gd */
|
||||
#define E_AGD3 10341 /* Infinite or too-large result for agd */
|
||||
#define E_POWER4 10342 /* Too-large value for power */
|
||||
#define E_ROOT4 10343 /* Too-large value for root */
|
||||
#define E_DGT1 10344 /* Non-real first arg for digit */
|
||||
#define E_DGT2 10345 /* Non-integral second arg for digit */
|
||||
#define E_DGT3 10346 /* Bad third arg for digit */
|
||||
#define E_PLCS1 10347 /* Bad first argument for places */
|
||||
#define E_PLCS2 10348 /* Bad second argument for places */
|
||||
#define E_DGTS1 10349 /* Bad first argument for digits */
|
||||
#define E_DGTS2 10350 /* Bad second argument for digits */
|
||||
#define E_ILOG 10351 /* Bad first argument for ilog */
|
||||
#define E_ILOGB 10352 /* Bad second argument for ilog */
|
||||
#define E_ILOG10 10353 /* Bad argument for ilog10 */
|
||||
#define E_ILOG2 10354 /* Bad argument for ilog2 */
|
||||
#define E_COMB1 10355 /* Non-integer second arg for comb */
|
||||
#define E_COMB2 10356 /* Too-large second arg for comb */
|
||||
#define E_CTLN 10357 /* Bad argument for catalan */
|
||||
#define E_BERN 10358 /* Bad argument for bern */
|
||||
#define E_EULER 10359 /* Bad argument for euler */
|
||||
#define E_SLEEP 10360 /* Bad argument for sleep */
|
||||
#define E_TTY 10361 /* calc_tty failure */
|
||||
|
||||
#define E__HIGHEST 10361 /* highest calc error */
|
||||
#define E__COUNT 361 /* number of calc errors */
|
||||
#define E_USERDEF 20000 /* base of user defined errors */
|
||||
|
||||
/* names of calc error values */
|
||||
|
||||
|
||||
#endif /* !__CALCERR_H__ */
|
41
win32/conf.h
Normal file
41
win32/conf.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__CONF_H__)
|
||||
#define __CONF_H__
|
||||
|
||||
|
||||
/* the default :-separated search path */
|
||||
#if !defined(DEFAULTCALCPATH)
|
||||
#define DEFAULTCALCPATH "./cal"
|
||||
#endif /* DEFAULTCALCPATH */
|
||||
|
||||
/* the default :-separated startup file list */
|
||||
#if !defined(DEFAULTCALCRC)
|
||||
#define DEFAULTCALCRC "/lib/calc/startup:~/.calcrc:./.calcinit"
|
||||
#endif /* DEFAULTCALCRC */
|
||||
|
||||
/* the location of the help directory */
|
||||
#if !defined(HELPDIR)
|
||||
#define HELPDIR "/lib/calc/help"
|
||||
#endif /* HELPDIR */
|
||||
|
||||
/* the location of the custom help directory */
|
||||
#if !defined(CUSTOMHELPDIR)
|
||||
#define CUSTOMHELPDIR "/lib/calc/help/custhelp"
|
||||
#endif /* CUSTOMHELPDIR */
|
||||
|
||||
/* the default pager to use */
|
||||
#if !defined(DEFAULTCALCPAGER)
|
||||
#define DEFAULTCALCPAGER ""
|
||||
#endif /* DEFAULTCALCPAGER */
|
||||
|
||||
/* where the echo command is located */
|
||||
#if !defined(ECHO_PROG)
|
||||
#define ECHO_PROG ""
|
||||
#endif /* ECHO_PROG */
|
||||
|
||||
|
||||
#endif /* !__CONF_H__ */
|
16
win32/endian_calc.h
Normal file
16
win32/endian_calc.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__ENDIAN_CALC_H__)
|
||||
#define __ENDIAN_CALC_H__
|
||||
|
||||
|
||||
/* what byte order are we? */
|
||||
#define BIG_ENDIAN 4321
|
||||
#define LITTLE_ENDIAN 1234
|
||||
#define CALC_BYTE_ORDER LITTLE_ENDIAN
|
||||
|
||||
|
||||
#endif /* !__ENDIAN_CALC_H__ */
|
28
win32/fposval.h
Normal file
28
win32/fposval.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__FPOSVAL_H__)
|
||||
#define __FPOSVAL_H__
|
||||
|
||||
|
||||
/* what are our file position & size types? */
|
||||
#undef FILEPOS_BITS
|
||||
#define FILEPOS_BITS 64
|
||||
#define SWAP_HALF_IN_FILEPOS(dest, src) (*(dest) = *(src))
|
||||
|
||||
#undef OFF_T_BITS
|
||||
#define OFF_T_BITS 32
|
||||
#define SWAP_HALF_IN_OFF_T(dest, src) (*(dest) = *(src))
|
||||
|
||||
#undef DEV_BITS
|
||||
#define DEV_BITS 32
|
||||
#define SWAP_HALF_IN_DEV(dest, src) memcpy((void *)(dest), (void *)(src), 4)
|
||||
|
||||
#undef INODE_BITS
|
||||
#define INODE_BITS 16
|
||||
#define SWAP_HALF_IN_INODE(dest, src) memcpy((void *)(dest), (void *)(src), 2)
|
||||
|
||||
|
||||
#endif /* !__FPOSVAL_H__ */
|
16
win32/have_const.h
Normal file
16
win32/have_const.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_CONST_H__)
|
||||
#define __HAVE_CONST_H__
|
||||
|
||||
|
||||
/* do we have or want const? */
|
||||
#define HAVE_CONST /* yes */
|
||||
#undef CONST
|
||||
#define CONST const /* yes */
|
||||
|
||||
|
||||
#endif /* !__HAVE_CONST_H__ */
|
16
win32/have_fpos.h
Normal file
16
win32/have_fpos.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_FPOS_H__)
|
||||
#define __HAVE_FPOS_H__
|
||||
|
||||
|
||||
/* do we have fgetpos & fsetpos functions? */
|
||||
#undef HAVE_FPOS /* no */
|
||||
|
||||
typedef long FILEPOS;
|
||||
|
||||
|
||||
#endif /* !__HAVE_FPOS_H__ */
|
15
win32/have_fpos_pos.h
Normal file
15
win32/have_fpos_pos.h
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_FPOS_POS_H__)
|
||||
#define __HAVE_FPOS_POS_H__
|
||||
|
||||
|
||||
/* do we have fgetpos & fsetpos functions? */
|
||||
#undef HAVE_FPOS_POS /* no */
|
||||
#undef FPOS_POS_BITS
|
||||
|
||||
|
||||
#endif /* !__HAVE_FPOS_POS_H__ */
|
14
win32/have_getpgid.h
Normal file
14
win32/have_getpgid.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_GETPGID_H__)
|
||||
#define __HAVE_GETPGID_H__
|
||||
|
||||
|
||||
/* do we have or want getpgid()? */
|
||||
#undef HAVE_GETPGID /* no */
|
||||
|
||||
|
||||
#endif /* !__HAVE_GETPGID_H__ */
|
14
win32/have_getprid.h
Normal file
14
win32/have_getprid.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_GETPRID_H__)
|
||||
#define __HAVE_GETPRID_H__
|
||||
|
||||
|
||||
/* do we have or want getprid()? */
|
||||
#undef HAVE_GETPRID /* no */
|
||||
|
||||
|
||||
#endif /* !__HAVE_GETPRID_H__ */
|
14
win32/have_getsid.h
Normal file
14
win32/have_getsid.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_GETSID_H__)
|
||||
#define __HAVE_GETSID_H__
|
||||
|
||||
|
||||
/* do we have or want getsid()? */
|
||||
#undef HAVE_GETSID /* no */
|
||||
|
||||
|
||||
#endif /* !__HAVE_GETSID_H__ */
|
14
win32/have_gettime.h
Normal file
14
win32/have_gettime.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_GETTIME_H__)
|
||||
#define __HAVE_GETTIME_H__
|
||||
|
||||
|
||||
/* do we have or want clock_gettime()? */
|
||||
#undef HAVE_GETTIME /* no */
|
||||
|
||||
|
||||
#endif /* !__HAVE_GETTIME_H__ */
|
14
win32/have_malloc.h
Normal file
14
win32/have_malloc.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_MALLOC_H__)
|
||||
#define __HAVE_MALLOC_H__
|
||||
|
||||
|
||||
/* do we have /usr/include/malloc.h? */
|
||||
#define HAVE_MALLOC_H /* yes */
|
||||
|
||||
|
||||
#endif /* !__HAVE_MALLOC_H__ */
|
14
win32/have_memmv.h
Normal file
14
win32/have_memmv.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_MEMMV_H__)
|
||||
#define __HAVE_MEMMV_H__
|
||||
|
||||
|
||||
/* do we have or want memmove()? */
|
||||
#define HAVE_MEMMOVE /* yes */
|
||||
|
||||
|
||||
#endif /* !__HAVE_MEMMV_H__ */
|
14
win32/have_newstr.h
Normal file
14
win32/have_newstr.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_NEWSTR_H__)
|
||||
#define __HAVE_NEWSTR_H__
|
||||
|
||||
|
||||
/* do we have or want memcpy(), memset() & strchr()? */
|
||||
#define HAVE_NEWSTR /* yes */
|
||||
|
||||
|
||||
#endif /* !__HAVE_NEWSTR_H__ */
|
14
win32/have_offscl.h
Normal file
14
win32/have_offscl.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_OFFSCL_H__)
|
||||
#define __HAVE_OFFSCL_H__
|
||||
|
||||
|
||||
#undef HAVE_OFF_T_SCALAR
|
||||
#define HAVE_OFF_T_SCALAR /* off_t is a simple value */
|
||||
|
||||
|
||||
#endif /* !__HAVE_OFFSCL_H__ */
|
14
win32/have_posscl.h
Normal file
14
win32/have_posscl.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_POSSCL_H__)
|
||||
#define __HAVE_POSSCL_H__
|
||||
|
||||
|
||||
#undef HAVE_FILEPOS_SCALAR
|
||||
#define HAVE_FILEPOS_SCALAR /* FILEPOS is a simple value */
|
||||
|
||||
|
||||
#endif /* !__HAVE_POSSCL_H__ */
|
14
win32/have_rusage.h
Normal file
14
win32/have_rusage.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_RUSAGE_H__)
|
||||
#define __HAVE_RUSAGE_H__
|
||||
|
||||
|
||||
/* do we have or want getrusage()? */
|
||||
#undef HAVE_GETRUSAGE /* no */
|
||||
|
||||
|
||||
#endif /* !__HAVE_RUSAGE_H__ */
|
14
win32/have_stdlib.h
Normal file
14
win32/have_stdlib.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_STDLIB_H__)
|
||||
#define __HAVE_STDLIB_H__
|
||||
|
||||
|
||||
/* do we have /usr/include/stdlib.h? */
|
||||
#define HAVE_STDLIB_H /* yes */
|
||||
|
||||
|
||||
#endif /* !__HAVE_STDLIB_H__ */
|
14
win32/have_strdup.h
Normal file
14
win32/have_strdup.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_RUSAGE_H__)
|
||||
#define __HAVE_RUSAGE_H__
|
||||
|
||||
|
||||
/* do we have or want getstrdup()? */
|
||||
#define HAVE_STRDUP /* yes */
|
||||
|
||||
|
||||
#endif /* !__HAVE_RUSAGE_H__ */
|
14
win32/have_string.h
Normal file
14
win32/have_string.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_STRING_H__)
|
||||
#define __HAVE_STRING_H__
|
||||
|
||||
|
||||
/* do we have /usr/include/string.h? */
|
||||
#define HAVE_STRING_H /* yes */
|
||||
|
||||
|
||||
#endif /* !__HAVE_STRING_H__ */
|
17
win32/have_times.h
Normal file
17
win32/have_times.h
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_TIMES_H__)
|
||||
#define __HAVE_TIMES_H__
|
||||
|
||||
|
||||
/* do we have /usr/include/times.h? */
|
||||
#undef HAVE_TIMES_H /* no */
|
||||
#undef HAVE_SYS_TIMES_H /* no */
|
||||
#define HAVE_TIME_H /* yes */
|
||||
#undef HAVE_SYS_TIME_H /* no */
|
||||
|
||||
|
||||
#endif /* !__HAVE_TIMES_H__ */
|
14
win32/have_uid_t.h
Normal file
14
win32/have_uid_t.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_UID_T_H__)
|
||||
#define __HAVE_UID_T_H__
|
||||
|
||||
|
||||
/* do we have or want uid_t? */
|
||||
#undef HAVE_UID_T /* no */
|
||||
|
||||
|
||||
#endif /* !__HAVE_UID_T_H__ */
|
14
win32/have_unistd.h
Normal file
14
win32/have_unistd.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_UNISTD_H__)
|
||||
#define __HAVE_UNISTD_H__
|
||||
|
||||
|
||||
/* do we have /usr/include/unistd.h? */
|
||||
#undef HAVE_UNISTD_H /* no */
|
||||
|
||||
|
||||
#endif /* !__HAVE_UNISTD_H__ */
|
14
win32/have_urandom.h
Normal file
14
win32/have_urandom.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_URANDOM_H__)
|
||||
#define __HAVE_URANDOM_H__
|
||||
|
||||
|
||||
/* do we have /dev/urandom? */
|
||||
#undef HAVE_URANDOM_H /* no */
|
||||
|
||||
|
||||
#endif /* !__HAVE_URANDOM_H__ */
|
14
win32/have_ustat.h
Normal file
14
win32/have_ustat.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_USTAT_H__)
|
||||
#define __HAVE_USTAT_H__
|
||||
|
||||
|
||||
/* do we have or want ustat()? */
|
||||
#undef HAVE_USTAT /* no */
|
||||
|
||||
|
||||
#endif /* !__HAVE_USTAT_H__ */
|
31
win32/longbits.h
Normal file
31
win32/longbits.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__LONGBITS_H__)
|
||||
#define __LONGBITS_H__
|
||||
|
||||
|
||||
#undef LONG_BITS
|
||||
#define LONG_BITS 32 /* bit length of a long */
|
||||
|
||||
/* size of long was forced */
|
||||
|
||||
typedef unsigned char USB8; /* unsigned 8 bits */
|
||||
typedef signed char SB8; /* signed 8 bits */
|
||||
|
||||
typedef unsigned short USB16; /* unsigned 16 bits */
|
||||
typedef short SB16; /* signed 16 bits */
|
||||
|
||||
typedef unsigned long USB32; /* unsigned 32 bits */
|
||||
typedef long SB32; /* signed 32 bits */
|
||||
|
||||
#undef HAVE_B64 /* we have no USB64 and no SB64 types */
|
||||
|
||||
/* no 64 bit constants */
|
||||
#define U(x) no 33 to 64 bit constants - do not use this macro!
|
||||
#define L(x) no 33 to 64 bit constants - do not use this macro!
|
||||
|
||||
|
||||
#endif /* !__LONGBITS_H__ */
|
16
win32/longlong.h
Normal file
16
win32/longlong.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__LONGLONG_H__)
|
||||
#define __LONGLONG_H__
|
||||
|
||||
|
||||
/* do we have/want to use a long long type? */
|
||||
#undef HAVE_LONGLONG
|
||||
#define LONGLONG_BITS 0 /* no */
|
||||
#undef L64_FORMAT
|
||||
|
||||
|
||||
#endif /* !__LONGLONG_H__ */
|
23
win32/terminal.h
Normal file
23
win32/terminal.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__TERMINAL_H__)
|
||||
#define __TERMINAL_H__
|
||||
|
||||
|
||||
/* determine the type of terminal interface */
|
||||
#if !defined(USE_TERMIOS)
|
||||
#if !defined(USE_TERMIO)
|
||||
#if !defined(USE_SGTTY)
|
||||
/* windoz, use none of these modes */
|
||||
#undef USE_TERMIOS /* <termios.h> */
|
||||
#undef USE_TERMIO /* <termio.h> */
|
||||
#undef USE_SGTTY /* <sys/ioctl.h> */
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* !__TERMINAL_H__ */
|
50
win32dll.h
Normal file
50
win32dll.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* win32dll - definitions for building windoz dll files
|
||||
*
|
||||
* Copyright (C) 2001 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.1 $
|
||||
* @(#) $Id: win32dll.h,v 29.1 2001/03/18 03:03:11 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/win32dll.h,v $
|
||||
*
|
||||
* Under source code control: 2001/03/17 13:05:31
|
||||
* 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/
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__WIN32DLL_H__)
|
||||
#define __WIN32DLL_H__
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
# if defined(_EXPORTING)
|
||||
# define DLL __declspec(dllexport)
|
||||
# else
|
||||
# define DLL __declspec(dllimport)
|
||||
# endif
|
||||
|
||||
#else /* Windoz free systems */
|
||||
|
||||
# define DLL
|
||||
|
||||
#endif /* Windoz free systems */
|
||||
|
||||
|
||||
#endif /* !__WIN32DLL_H__ */
|
229
zmath.h
229
zmath.h
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: zmath.h,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: zmath.h,v 29.5 2001/03/17 21:31:47 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zmath.h,v $
|
||||
*
|
||||
* Under source code control: 1993/07/30 19:42:48
|
||||
@@ -38,6 +38,7 @@
|
||||
#define __ZMATH_H__
|
||||
|
||||
|
||||
#include "win32dll.h"
|
||||
#include "alloc.h"
|
||||
#include "endian_calc.h"
|
||||
#include "longbits.h"
|
||||
@@ -267,126 +268,126 @@ typedef struct {
|
||||
/*
|
||||
* Function prototypes for integer math routines.
|
||||
*/
|
||||
extern HALF * alloc(LEN len);
|
||||
extern DLL HALF * alloc(LEN len);
|
||||
#ifdef ALLOCTEST
|
||||
extern void freeh(HALF *);
|
||||
extern DLL void freeh(HALF *);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Input, output, and conversion routines.
|
||||
*/
|
||||
extern void zcopy(ZVALUE z, ZVALUE *res);
|
||||
extern void itoz(long i, ZVALUE *res);
|
||||
extern void utoz(FULL i, ZVALUE *res);
|
||||
extern void str2z(char *s, ZVALUE *res);
|
||||
extern long ztoi(ZVALUE z);
|
||||
extern FULL ztou(ZVALUE z);
|
||||
extern void zprintval(ZVALUE z, long decimals, long width);
|
||||
extern void zprintx(ZVALUE z, long width);
|
||||
extern void zprintb(ZVALUE z, long width);
|
||||
extern void zprinto(ZVALUE z, long width);
|
||||
extern void fitzprint(ZVALUE, long, long);
|
||||
extern DLL void zcopy(ZVALUE z, ZVALUE *res);
|
||||
extern DLL void itoz(long i, ZVALUE *res);
|
||||
extern DLL void utoz(FULL i, ZVALUE *res);
|
||||
extern DLL void str2z(char *s, ZVALUE *res);
|
||||
extern DLL long ztoi(ZVALUE z);
|
||||
extern DLL FULL ztou(ZVALUE z);
|
||||
extern DLL void zprintval(ZVALUE z, long decimals, long width);
|
||||
extern DLL void zprintx(ZVALUE z, long width);
|
||||
extern DLL void zprintb(ZVALUE z, long width);
|
||||
extern DLL void zprinto(ZVALUE z, long width);
|
||||
extern DLL void fitzprint(ZVALUE, long, long);
|
||||
|
||||
|
||||
/*
|
||||
* Basic numeric routines.
|
||||
*/
|
||||
extern void zmuli(ZVALUE z, long n, ZVALUE *res);
|
||||
extern long zdivi(ZVALUE z, long n, ZVALUE *res);
|
||||
extern long zmodi(ZVALUE z, long n);
|
||||
extern void zadd(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern void zsub(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern void zmul(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern long zdiv(ZVALUE z1, ZVALUE z2, ZVALUE *res, ZVALUE *rem, long R);
|
||||
extern long zquo(ZVALUE z1, ZVALUE z2, ZVALUE *res, long R);
|
||||
extern long zmod(ZVALUE z1, ZVALUE z2, ZVALUE *rem, long R);
|
||||
extern void zequo(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern BOOL zdivides(ZVALUE z1, ZVALUE z2);
|
||||
extern void zor(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern void zand(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern void zxor(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern void zandnot(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern long zpopcnt(ZVALUE z, int bitval);
|
||||
extern void zshift(ZVALUE z, long n, ZVALUE *res);
|
||||
extern void zsquare(ZVALUE z, ZVALUE *res);
|
||||
extern long zlowbit(ZVALUE z);
|
||||
extern LEN zhighbit(ZVALUE z);
|
||||
extern void zbitvalue(long n, ZVALUE *res);
|
||||
extern BOOL zisset(ZVALUE z, long n);
|
||||
extern BOOL zisonebit(ZVALUE z);
|
||||
extern BOOL zisallbits(ZVALUE z);
|
||||
extern FLAG ztest(ZVALUE z);
|
||||
extern FLAG zrel(ZVALUE z1, ZVALUE z2);
|
||||
extern FLAG zabsrel(ZVALUE z1, ZVALUE z2);
|
||||
extern BOOL zcmp(ZVALUE z1, ZVALUE z2);
|
||||
extern DLL void zmuli(ZVALUE z, long n, ZVALUE *res);
|
||||
extern DLL long zdivi(ZVALUE z, long n, ZVALUE *res);
|
||||
extern DLL long zmodi(ZVALUE z, long n);
|
||||
extern DLL void zadd(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL void zsub(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL void zmul(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL long zdiv(ZVALUE z1, ZVALUE z2, ZVALUE *res, ZVALUE *rem, long R);
|
||||
extern DLL long zquo(ZVALUE z1, ZVALUE z2, ZVALUE *res, long R);
|
||||
extern DLL long zmod(ZVALUE z1, ZVALUE z2, ZVALUE *rem, long R);
|
||||
extern DLL void zequo(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL BOOL zdivides(ZVALUE z1, ZVALUE z2);
|
||||
extern DLL void zor(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL void zand(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL void zxor(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL void zandnot(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL long zpopcnt(ZVALUE z, int bitval);
|
||||
extern DLL void zshift(ZVALUE z, long n, ZVALUE *res);
|
||||
extern DLL void zsquare(ZVALUE z, ZVALUE *res);
|
||||
extern DLL long zlowbit(ZVALUE z);
|
||||
extern DLL LEN zhighbit(ZVALUE z);
|
||||
extern DLL void zbitvalue(long n, ZVALUE *res);
|
||||
extern DLL BOOL zisset(ZVALUE z, long n);
|
||||
extern DLL BOOL zisonebit(ZVALUE z);
|
||||
extern DLL BOOL zisallbits(ZVALUE z);
|
||||
extern DLL FLAG ztest(ZVALUE z);
|
||||
extern DLL FLAG zrel(ZVALUE z1, ZVALUE z2);
|
||||
extern DLL FLAG zabsrel(ZVALUE z1, ZVALUE z2);
|
||||
extern DLL BOOL zcmp(ZVALUE z1, ZVALUE z2);
|
||||
|
||||
|
||||
/*
|
||||
* More complicated numeric functions.
|
||||
*/
|
||||
extern FULL uugcd(FULL i1, FULL i2);
|
||||
extern long iigcd(long i1, long i2);
|
||||
extern void zgcd(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern void zlcm(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern void zreduce(ZVALUE z1, ZVALUE z2, ZVALUE *z1res, ZVALUE *z2res);
|
||||
extern void zfact(ZVALUE z, ZVALUE *dest);
|
||||
extern void zperm(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern int zcomb(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern FLAG zjacobi(ZVALUE z1, ZVALUE z2);
|
||||
extern void zfib(ZVALUE z, ZVALUE *res);
|
||||
extern void zpowi(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern void ztenpow(long power, ZVALUE *res);
|
||||
extern void zpowermod(ZVALUE z1, ZVALUE z2, ZVALUE z3, ZVALUE *res);
|
||||
extern BOOL zmodinv(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern BOOL zrelprime(ZVALUE z1, ZVALUE z2);
|
||||
extern long zlog(ZVALUE z1, ZVALUE z2);
|
||||
extern long zlog10(ZVALUE z);
|
||||
extern long zdivcount(ZVALUE z1, ZVALUE z2);
|
||||
extern long zfacrem(ZVALUE z1, ZVALUE z2, ZVALUE *rem);
|
||||
extern long zgcdrem(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern long zdigits(ZVALUE z1);
|
||||
extern long zdigit(ZVALUE z1, long n);
|
||||
extern FLAG zsqrt(ZVALUE z1, ZVALUE *dest, long R);
|
||||
extern void zroot(ZVALUE z1, ZVALUE z2, ZVALUE *dest);
|
||||
extern BOOL zissquare(ZVALUE z);
|
||||
extern void zhnrmod(ZVALUE v, ZVALUE h, ZVALUE zn, ZVALUE zr, ZVALUE *res);
|
||||
extern DLL FULL uugcd(FULL i1, FULL i2);
|
||||
extern DLL long iigcd(long i1, long i2);
|
||||
extern DLL void zgcd(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL void zlcm(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL void zreduce(ZVALUE z1, ZVALUE z2, ZVALUE *z1res, ZVALUE *z2res);
|
||||
extern DLL void zfact(ZVALUE z, ZVALUE *dest);
|
||||
extern DLL void zperm(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL int zcomb(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL FLAG zjacobi(ZVALUE z1, ZVALUE z2);
|
||||
extern DLL void zfib(ZVALUE z, ZVALUE *res);
|
||||
extern DLL void zpowi(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL void ztenpow(long power, ZVALUE *res);
|
||||
extern DLL void zpowermod(ZVALUE z1, ZVALUE z2, ZVALUE z3, ZVALUE *res);
|
||||
extern DLL BOOL zmodinv(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL BOOL zrelprime(ZVALUE z1, ZVALUE z2);
|
||||
extern DLL long zlog(ZVALUE z1, ZVALUE z2);
|
||||
extern DLL long zlog10(ZVALUE z);
|
||||
extern DLL long zdivcount(ZVALUE z1, ZVALUE z2);
|
||||
extern DLL long zfacrem(ZVALUE z1, ZVALUE z2, ZVALUE *rem);
|
||||
extern DLL long zgcdrem(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL long zdigits(ZVALUE z1);
|
||||
extern DLL long zdigit(ZVALUE z1, long n);
|
||||
extern DLL FLAG zsqrt(ZVALUE z1, ZVALUE *dest, long R);
|
||||
extern DLL void zroot(ZVALUE z1, ZVALUE z2, ZVALUE *dest);
|
||||
extern DLL BOOL zissquare(ZVALUE z);
|
||||
extern DLL void zhnrmod(ZVALUE v, ZVALUE h, ZVALUE zn, ZVALUE zr, ZVALUE *res);
|
||||
|
||||
|
||||
/*
|
||||
* Prime related functions.
|
||||
*/
|
||||
extern FLAG zisprime(ZVALUE z);
|
||||
extern FULL znprime(ZVALUE z);
|
||||
extern FULL next_prime(FULL v);
|
||||
extern FULL zpprime(ZVALUE z);
|
||||
extern void zpfact(ZVALUE z, ZVALUE *dest);
|
||||
extern BOOL zprimetest(ZVALUE z, long count, ZVALUE skip);
|
||||
extern BOOL zredcprimetest(ZVALUE z, long count, ZVALUE skip);
|
||||
extern BOOL znextcand(ZVALUE z1, long count, ZVALUE skip, ZVALUE res, ZVALUE mod, ZVALUE *cand);
|
||||
extern BOOL zprevcand(ZVALUE z1, long count, ZVALUE skip, ZVALUE res, ZVALUE mod, ZVALUE *cand);
|
||||
extern FULL zlowfactor(ZVALUE z, long count);
|
||||
extern FLAG zfactor(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern long zpix(ZVALUE z1);
|
||||
extern void zlcmfact(ZVALUE z, ZVALUE *dest);
|
||||
extern DLL FLAG zisprime(ZVALUE z);
|
||||
extern DLL FULL znprime(ZVALUE z);
|
||||
extern DLL FULL next_prime(FULL v);
|
||||
extern DLL FULL zpprime(ZVALUE z);
|
||||
extern DLL void zpfact(ZVALUE z, ZVALUE *dest);
|
||||
extern DLL BOOL zprimetest(ZVALUE z, long count, ZVALUE skip);
|
||||
extern DLL BOOL zredcprimetest(ZVALUE z, long count, ZVALUE skip);
|
||||
extern DLL BOOL znextcand(ZVALUE z1, long count, ZVALUE skip, ZVALUE res, ZVALUE mod, ZVALUE *cand);
|
||||
extern DLL BOOL zprevcand(ZVALUE z1, long count, ZVALUE skip, ZVALUE res, ZVALUE mod, ZVALUE *cand);
|
||||
extern DLL FULL zlowfactor(ZVALUE z, long count);
|
||||
extern DLL FLAG zfactor(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL long zpix(ZVALUE z1);
|
||||
extern DLL void zlcmfact(ZVALUE z, ZVALUE *dest);
|
||||
|
||||
|
||||
/*
|
||||
* Misc misc functions. :-)
|
||||
*/
|
||||
extern void zsquaremod(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern void zminmod(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern BOOL zcmpmod(ZVALUE z1, ZVALUE z2, ZVALUE z3);
|
||||
extern void zio_init(void);
|
||||
extern DLL void zsquaremod(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL void zminmod(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL BOOL zcmpmod(ZVALUE z1, ZVALUE z2, ZVALUE z3);
|
||||
extern DLL void zio_init(void);
|
||||
|
||||
|
||||
/*
|
||||
* These functions are for internal use only.
|
||||
*/
|
||||
extern void ztrim(ZVALUE *z);
|
||||
extern void zshiftr(ZVALUE z, long n);
|
||||
extern void zshiftl(ZVALUE z, long n);
|
||||
extern HALF *zalloctemp(LEN len);
|
||||
extern DLL void ztrim(ZVALUE *z);
|
||||
extern DLL void zshiftr(ZVALUE z, long n);
|
||||
extern DLL void zshiftl(ZVALUE z, long n);
|
||||
extern DLL HALF *zalloctemp(LEN len);
|
||||
|
||||
|
||||
/*
|
||||
@@ -403,13 +404,13 @@ typedef struct {
|
||||
ZVALUE one; /* REDC format for the number 1 */
|
||||
} REDC;
|
||||
|
||||
extern REDC *zredcalloc(ZVALUE z1);
|
||||
extern void zredcfree(REDC *rp);
|
||||
extern void zredcencode(REDC *rp, ZVALUE z1, ZVALUE *res);
|
||||
extern void zredcdecode(REDC *rp, ZVALUE z1, ZVALUE *res);
|
||||
extern void zredcmul(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern void zredcsquare(REDC *rp, ZVALUE z1, ZVALUE *res);
|
||||
extern void zredcpower(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL REDC *zredcalloc(ZVALUE z1);
|
||||
extern DLL void zredcfree(REDC *rp);
|
||||
extern DLL void zredcencode(REDC *rp, ZVALUE z1, ZVALUE *res);
|
||||
extern DLL void zredcdecode(REDC *rp, ZVALUE z1, ZVALUE *res);
|
||||
extern DLL void zredcmul(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL void zredcsquare(REDC *rp, ZVALUE z1, ZVALUE *res);
|
||||
extern DLL void zredcpower(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
|
||||
|
||||
/*
|
||||
@@ -550,32 +551,32 @@ extern void zredcpower(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
/*
|
||||
* Output routines for either FILE handles or strings.
|
||||
*/
|
||||
extern void math_chr(int ch);
|
||||
extern void math_str(char *str);
|
||||
extern void math_fill(char *str, long width);
|
||||
extern void math_flush(void);
|
||||
extern void math_divertio(void);
|
||||
extern void math_cleardiversions(void);
|
||||
extern char *math_getdivertedio(void);
|
||||
extern int math_setmode(int mode);
|
||||
extern LEN math_setdigits(LEN digits);
|
||||
extern void math_fmt(char *, ...);
|
||||
extern DLL void math_chr(int ch);
|
||||
extern DLL void math_str(char *str);
|
||||
extern DLL void math_fill(char *str, long width);
|
||||
extern DLL void math_flush(void);
|
||||
extern DLL void math_divertio(void);
|
||||
extern DLL void math_cleardiversions(void);
|
||||
extern DLL char *math_getdivertedio(void);
|
||||
extern DLL int math_setmode(int mode);
|
||||
extern DLL LEN math_setdigits(LEN digits);
|
||||
extern DLL void math_fmt(char *, ...);
|
||||
|
||||
|
||||
/*
|
||||
* The error routine.
|
||||
*/
|
||||
extern void math_error(char *, ...);
|
||||
extern DLL void math_error(char *, ...);
|
||||
|
||||
|
||||
/*
|
||||
* external swap functions
|
||||
*/
|
||||
extern HALF *swap_b8_in_HALFs(HALF *dest, HALF *src, LEN len);
|
||||
extern ZVALUE *swap_b8_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all);
|
||||
extern HALF *swap_b16_in_HALFs(HALF *dest, HALF *src, LEN len);
|
||||
extern ZVALUE *swap_b16_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all);
|
||||
extern ZVALUE *swap_HALF_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all);
|
||||
extern DLL HALF *swap_b8_in_HALFs(HALF *dest, HALF *src, LEN len);
|
||||
extern DLL ZVALUE *swap_b8_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all);
|
||||
extern DLL HALF *swap_b16_in_HALFs(HALF *dest, HALF *src, LEN len);
|
||||
extern DLL ZVALUE *swap_b16_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all);
|
||||
extern DLL ZVALUE *swap_HALF_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all);
|
||||
|
||||
|
||||
/*
|
||||
@@ -595,7 +596,7 @@ extern ZVALUE _sqbase_, _pow4base_, _pow8base_;
|
||||
|
||||
extern ZVALUE _b32_, _b64_;
|
||||
|
||||
extern BOOL _math_abort_; /* nonzero to abort calculations */
|
||||
extern DLL BOOL _math_abort_; /* nonzero to abort calculations */
|
||||
extern ZVALUE _tenpowers_[]; /* table of 10^2^n */
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user