Compare commits

...

5 Commits

Author SHA1 Message Date
Landon Curt Noll
64a732b678 Release calc version 2.11.10.1 2017-05-21 15:38:45 -07:00
Landon Curt Noll
a6a37f9cad Release calc version 2.11.10 2017-05-21 15:38:45 -07:00
Landon Curt Noll
42b089a87c Release calc version 2.11.9.3 2017-05-21 15:38:44 -07:00
Landon Curt Noll
8c5e9e62fa Release calc version 2.11.9.2 2017-05-21 15:38:44 -07:00
Landon Curt Noll
29e956819c Release calc version 2.11.9.1 2017-05-21 15:38:44 -07:00
65 changed files with 2949 additions and 1378 deletions

89
BUGS
View File

@@ -47,7 +47,7 @@ When you send your report, please include the following information:
* a description of the problem
* the version of calc you are using (if you cannot get calc
it to run, then send us the 4 #define lines from version.c)
to run, then send us the 4 #define lines from version.c)
* if you modified calc from an official patch, send me the mods you made
* the type of system you were using
* the type of compiler you were using
@@ -72,7 +72,62 @@ Known bugs:
us know! See the above for details on how to report and were to
EMail your bug reports and hopefully patches to fix them.
Problems with known work-a-rounds:
* The following command:
calc 'read ellip; efactor(13*17*19)'
will generate the following error:
efactor(iN,ia,B,force) defined
point_print(p) defined
point_mul(p1,p2) defined
point_square(p) defined
point_pow(p,pow) defined
A = 1
2 (1,1)
"point_square": line 165: Not initializing matrix, object or list
Error in commands
This is not an error in the ellip standard calc resource files.
It is a bug inside calc. Versions going back as far as version
2.11.4t2 in the year 2000 (and perhaps even further) alll have
this bug.
Anyone want to track down and fix this bug?
=-=
mis-features in calc:
Some problems are not bugs but rarther mis-features / things that could
work better. The following is a list of mis-features that should be
addressed and improved someday.
* 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.
=-=
Problems with old systems that have known work-a-rounds:
* The gcc as shipped with Redhat 7 perhaps other Linux distributions
has a bug causes calc to dump core on startup when calc is:
@@ -86,7 +141,9 @@ Problems with known work-a-rounds:
AND
when calc is compiled with readline (see USE_READLINE,
READLINE_LIB and READLINE_INCLUDE in the Makefile)
READLINE_LIB and READLINE_INCLUDE in the Makefile)
This is known as the Redhat 7 readlne problem.
On Redhat, the gcc -v which has this problem is:
@@ -250,28 +307,6 @@ 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
@@ -288,8 +323,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.17 $
## @(#) $Id: BUGS,v 29.17 2001/12/31 22:12:35 chongo Exp $
## @(#) $Revision: 29.21 $
## @(#) $Id: BUGS,v 29.21 2004/10/23 01:13:51 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/BUGS,v $
##
## Under source code control: 1994/03/18 14:06:13

130
CHANGES
View File

@@ -1,4 +1,123 @@
The following are the changes from calc version 2.11.9 to date:
The following are the changes from calc version 2.11.10.1 to date:
Fixed a bug reported by the sourceforge user: cedars where:
ln(exp(6)) == 3 /* WRONG!!! */
incorrectly returned 1. This bug was fixed by Ernest Bowen
<ernie at turing dot une dot edu dot au>. The regression test
was expanded to cover this issue.
Added minor improvements to hash regression testing of pi().
Fixed "help script" and the calc man page regarding the requirement
of -f to be the last -flag in shell script mode. Further clarified
the meaning and placement of the -f flag.
Moved issues with chi.cal intfile.cal into a "mis-features" section
of the BUGS file. See "help bugs" or the BUGS source file for details.
Added the bug about:
calc 'read ellip; efactor(13*17*19)'
to the BUGS file. See "help bugs" or the BUGS source file for details.
Anyone want to track down and fix this bug?
The following are the changes from calc version 2.11.10 to 2.11.10:
The cygwin config value is correctly tested while doing comparisons
between config states.
Added config("compile_custom") to determine if calc was compiled
with -DCUSTOM. By default, the Makefile uses ALLOW_CUSTOM= -DCUSTOM
so by default, config("compile_custom") is TRUE. If, however,
calc is compiled without -DCUSTOM, then config("compile_custom")
will be FALSE. NOTE: The config("compile_custom") value is only
affected by compile flags. The calc -D runtime command line option
does not change the config("compile_custom") value. This is a
read-only configuration value.
Added config("allow_custom") to determine if the use of custom
functions are allowed. To allow the use of custom functions, calc
must be compiled with -DCUSTOM (which it is by default) AND calc run
be run with the -D runtime command line option (which it is not by
default). If config("allow_custom") is TRUE, then custom functions
are allowed. If config("allow_custom") is FALSE, then custom
functions are not allowed. This is a read-only configuration value.
Correctly hash config state for windows and cygwin values. The value
of config("compile_custom") and config("allow_custom") also affect
the hash of the config state.
Fixed the custom/argv.cal test code to avoid use of a reserved
builtin function name.
Fixed custom/*.cal scripts to conform better with the cal/*.cal
resource files.
Removed the Makefile variables ${LONGLONG_BITS}, ${HAVE_LONGLONG},
and ${L64_FORMAT}. Removed longlong.c and longlong.h. The use
of HAVE_LONGLONG=0 was problematic. The lack of complaints about
the HAVE_LONGLONG=0 shows that the 'long long' type is wide spread
enough warrent not trying to support compilers without 'long long'.
Removed the SVAL and SHVAL macros from zrand.c, zrand.h, and zmath.h
as they were causing too many broken C pre-processors and C checkers
to become confused.
Added a 'make splint' rule to use the splint statically checking
tool on the calc source.
Removed support of the BSDI platform. The BSDI platform is no longer
directly supported and we lost our last BSDI machine on which we
could test calc. Best wishes to the former BSDI folk and thanks
for breaking important ground in the Open Source Movement!
Fixed several typos found in the documentation and buildin
function output by C Smith <smichr at hotmail dot com>.
Fixed -d so that:
calc -d 2/3
will print 0.66666666666666666667 without the leading tilde as
advertised in the man page.
Added a missing help file for the display builtin function as
requested by Igor Furlan <primorec at sbcglobal dot net>.
Changed the "help environment" file to reflect modern default
values of CALCPATH and CALCRC.
Added missing variables for printing by the "make env" rule.
Added EXT Makefile variable so that Cygwin can install calc as
calc.exe. By default, EXT is empty so that calc is calc on most
modern operating systems. Thanks goes to Ullal Devappa Kini <wmbfqj
at vsnl dot net> for helping identify this problem and testing our fix.
Added custom function:
custom("pmodm127", q)
to compute 2^(2^127-1) mod q. While currently slower than just
doing pmod(2,2^127-1,q), it is added to give an example of a
more complex custom function. Call calc with the -C flag to
use custom functions.
Made slight changes to the custom/HOW_TO_ADD documentation.
Fixed some \ formatting man page problems as reported by Keh-Cheng
Chu <kehcheng at quake dot Stanford dot edu>.
Fixed some comparison between signed and unsigned in md5.c
that was reported for the PowerMac G5 2GHz MacOS 10.3 by
Guillaume VERGNAUD <vergnaud at via dot ecp dot fr>.
The following are the changes from calc version 2.11.9 to 2.11.9.3:
Fixed calc man page examples to move -f to the end of the line.
Thanks goes to Michael Somos <somos at grail dot cba dot csuohio
@@ -45,7 +164,10 @@ The following are the changes from calc version 2.11.9 to date:
zrandom.c, custom/c_argv.c, custom/c_devnull.c, custom/c_help.c,
custom/c_sysinfo.c, addop.c and calc.c.
Fixed some typos in this CHANGES file.
Fixed some typos in this file.
By default, compile with -O3 -g3. The Makefile comments on how some
distributions might need to use -O2 -g or -O -g.
The following are the changes from calc version 2.11.8.0 to 2.11.8.1:
@@ -5663,8 +5785,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.63 $
## @(#) $Id: CHANGES,v 29.63 2004/02/23 09:23:39 chongo Exp $
## @(#) $Revision: 29.70 $
## @(#) $Id: CHANGES,v 29.70 2004/10/23 01:16:23 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
##
## Under source code control: 1993/06/02 18:12:57

483
Makefile

File diff suppressed because it is too large Load Diff

View File

@@ -27,7 +27,6 @@ recommends the following settings:
TERMCONTROL= -DUSE_TERMIOS
BYTE_ORDER= -DLITTLE_ENDIAN
LONG_BITS= 32
LONGLONG_BITS= 64
HAVE_FPOS_POS= -DHAVE_NO_FPOS_POS
FPOS_BITS= 32
OFF_T_BITS= 32
@@ -93,25 +92,29 @@ The major porting work was performed by Thomas Jones-Low
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.
library, and calc.exe which is the command line interface.
He recommends that you generate by hand all of the header files generated
by the make file:
He recommended that you generate by hand all of the header files that
by the Makefile. This has been done for you via the makefile rule:
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
make win32_hsrc
which uses the Makefile variables in win32.mkdef to form these header
files under win32 directory.
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.
needs.
In particular:
Just copy the win32/*.[ch] files up into the top level calc
source directory, edit them (if needed) and build using the
Cygwin GCC compiler and Cygwin build environment.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=-=-= calc maintenance folk =-=-=
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
People who maintain calc need to keep in mind the following:
@@ -155,8 +158,8 @@ was changed to:
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.8 $
## @(#) $Id: README.WINDOWS,v 29.8 2002/03/14 00:28:28 chongo Exp $
## @(#) $Revision: 29.12 $
## @(#) $Id: README.WINDOWS,v 29.12 2004/07/28 12:52:01 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/README.WINDOWS,v $
##
## Under source code control: 2001/02/25 14:00:05

View File

@@ -1,7 +1,7 @@
/*
* addop - add opcodes to a function being compiled
*
* Copyright (C) 1999 David I. Bell and Ernest Bowen
* Copyright (C) 1999-2004 David I. Bell and Ernest Bowen
*
* Primary author: David I. Bell
*
@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.4 $
* @(#) $Id: addop.c,v 29.4 2004/02/23 07:25:16 chongo Exp $
* @(#) $Revision: 29.5 $
* @(#) $Id: addop.c,v 29.5 2004/02/23 14:04:01 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/addop.c,v $
*
* Under source code control: 1990/02/15 01:48:10

View File

@@ -1,7 +1,7 @@
/*
* blkcpy - general values and related routines used by the calculator
*
* Copyright (C) 1999 Landon Curt Noll and Ernest Bowen
* Copyright (C) 1999-2004 Landon Curt Noll and Ernest Bowen
*
* Primary author: Landon Curt Noll
*
@@ -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: blkcpy.c,v 29.4 2004/02/23 07:47:31 chongo Exp $
* @(#) $Revision: 29.5 $
* @(#) $Id: blkcpy.c,v 29.5 2004/02/23 14:04:01 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/blkcpy.c,v $
*
* Under source code control: 1997/04/18 20:41:26

View File

@@ -1,7 +1,7 @@
/*
* pi - various routines to calculate pi
*
* Copyright (C) 1999 David I. Bell
* Copyright (C) 1999-2004 David I. Bell
*
* 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.3 $
* @(#) $Id: pi.cal,v 29.3 2004/02/23 06:06:38 chongo Exp $
* @(#) $Revision: 29.5 $
* @(#) $Id: pi.cal,v 29.5 2004/02/23 14:04:01 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/pi.cal,v $
*
* Under source code control: 1991/05/22 21:56:37
@@ -104,8 +104,7 @@ define piforever()
* Next approximation
*/
p = k * k;
q = k << 1;
++k;
q = k + ++k;
a2 = a;
b2 = b;

View File

@@ -1,7 +1,7 @@
/*
* regress - calc regression and correctness test suite
*
* Copyright (C) 1999-2003 David I. Bell and Landon Curt Noll
* Copyright (C) 1999-2004 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.18 $
* @(#) $Id: regress.cal,v 29.18 2004/02/23 05:58:45 chongo Exp $
* @(#) $Revision: 29.20 $
* @(#) $Id: regress.cal,v 29.20 2004/10/22 23:51:26 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $
*
* Under source code control: 1990/02/15 01:50:36
@@ -2571,6 +2571,33 @@ define test_2600()
i = config("sqrt", i);
print tnum++: ': i = config("sqrt", i)';
i = epsilon(1e-100),;
print tnum++: ': i = epsilon(1e-100),;';
vrfy(ln(exp(6)) == 6,
strcat(str(tnum++), ': ln(exp(6)) == 6'));
vrfy(ln(exp(4)^4) == 16,
strcat(str(tnum++), ': ln(exp(4)^4) == 16'));
vrfy(ln(exp(6.5)^8) == 52,
strcat(str(tnum++), ': ln(exp(6.5)^8) == 52'));
vrfy(ln(exp(5)^16) == 80,
strcat(str(tnum++), ': ln(exp(5)^16) == 80'));
vrfy(ln(exp(4.5)^4) == 18,
strcat(str(tnum++), ': ln(exp(4.5)^4) == 18'));
vrfy(ln(exp(4)^8) == 32,
strcat(str(tnum++), ': ln(exp(4)^8) == 32'));
vrfy(ln(exp(60/11)^11) == 60,
strcat(str(tnum++), ': ln(exp(60/11)^11) == 60'));
vrfy(ln(exp(6)^15) == 90,
strcat(str(tnum++), ': ln(exp(6)^11) == 90'));
vrfy(ln(exp(80/17)^17) == 80,
strcat(str(tnum++), ': ln(exp(80/17)^17) == 80'));
vrfy(ln(exp(6)^15) == 90,
strcat(str(tnum++), ': ln(exp(6)^15) == 90'));
vrfy(ln(exp(5)^18) == 90,
strcat(str(tnum++), ': ln(exp(5)^18) == 90'));
epsilon(i),;
print tnum++: ': epsilon(i),;';
print tnum: ': Ending extensive numeric function test';
}
print '037: parsed test_2600()';
@@ -6605,10 +6632,10 @@ define test_sha()
0x21e42319a26787046c2b28b7ae70f1b54bf0ba2a,
'7122: sha(sha("this is", 7^19-8, ..., "hash")) == 0x21e4...');
z = sha(list(1,2,3), "curds and whey", 2^21701-1, pi());
print '7123: z = sha(list(1,2,3), "curds and whey", 2^21701-1, pi());';
vrfy(sha(z) == 0x36dcca3e51865c30a2cf738023cda446f1368340,
'7124: sha(z) == 0x36dcca3e51865c30a2cf738023cda446f1368340');
z = sha(list(1,2,3), "curds and whey", 2^21701-1, pi(1e-100));
print '7123: z = sha(list(1,2,3), "curds and whey", 2^21701-1, pi(1e-100));';
vrfy(sha(z) == 257075527903934749824451356785709876382198951165,
'7124: sha(z) == 257075527903934749824451356785709876382198951165');
y = sha();
print '7125: y = sha()';
@@ -6616,8 +6643,8 @@ define test_sha()
print '7126: y = sha(y, list(1,2,3), "curds and whey")';
y = sha(y, 2^21701-1);
print '7127: y = sha(y, 2^21701-1)';
y = sha(y, pi());
print '7128: y = sha(y, pi())';
y = sha(y, pi(1e-100));
print '7128: y = sha(y, pi(1e-100))';
vrfy(y == z, '7129: y == z');
B = blk() = {"a", "b", "c"};
@@ -6676,10 +6703,10 @@ define test_sha1()
'7209: sha1(sha1("this is",7^19-8,"a composit",3i+4.5,"hash")) == ...');
z = sha1(list(1,2,3), "curds and whey", 2^21701-1, pi());
print '7210: z = sha1(list(1,2,3), "curds and whey", 2^21701-1, pi());';
vrfy(sha1(z) == 0xc19e7317675dbf71e293b4c41e117169e9da5b6f,
'7211: sha1(z) == 0xc19e7317675dbf71e293b4c41e117169e9da5b6f');
z = sha1(list(1,2,3), "curds and whey", 2^21701-1, pi(1e-100));
print '7210: z = sha1(list(1,2,3), "curds and whey", 2^21701-1, pi(1e-100));';
vrfy(sha1(z) == 0x158cc87deeb9dd478ca14e3ab359205b0fb15b83,
'7211: sha1(z) == 0x158cc87deeb9dd478ca14e3ab359205b0fb15b83');
y = sha1();
print '7212: y = sha1();';
@@ -6687,8 +6714,8 @@ define test_sha1()
print '7213: y = sha1(y, list(1,2,3), "curds and whey");';
y = sha1(y, 2^21701-1);
print '7214: y = sha1(y, 2^21701-1);';
y = sha1(y, pi());
print '7215: y = sha1(y, pi());';
y = sha1(y, pi(1e-100));
print '7215: y = sha1(y, pi(1e-100));';
vrfy(y == z, '7216: y == z');
vrfy(sha1(sha1("a"))==0x86f7e437faa5a7fce15d1ddcb9eaeaea377667b8,
@@ -6764,18 +6791,18 @@ define test_md5()
'7310: md5(md5("this is", 7^19-8, "a composit", 3i+4.5, "hash")) == ...');
z = md5(list(1,2,3), "curds and whey", 2^21701-1, pi());
print '7311: z = md5(list(1,2,3), "curds and whey", 2^21701-1, pi());';
vrfy(md5(z) == 0x63d2b2fccae2de265227c30b05abb6b5,
'7312: md5(z) == 0x63d2b2fccae2de265227c30b05abb6b5');
z = md5(list(1,2,3), "curds and whey", 2^21701-1, pi(1e-100));
print '7311: z = md5(list(1,2,3), "curds and whey", 2^21701-1, pi(1e-100));';
vrfy(md5(z) == 0x487462e577eabef0302dd13af6632546,
'7312: md5(z) == 0x487462e577eabef0302dd13af6632546');
y = md5();
print '7313: y = md5();';
y = md5(y, list(1,2,3), "curds and whey");
print '7314: y = md5(y, list(1,2,3), "curds and whey")';
y = md5(y, 2^21701-1);
print '7315: y = md5(y, 2^21701-1);';
y = md5(y, pi());
print '7316: y = md5(y, pi());';
y = md5(y, pi(1e-100));
print '7316: y = md5(y, pi(1e-100));';
vrfy(y == z, '7317: y == z');
vrfy(md5(md5("a")) == 0x0cc175b9c0f1b6a831c399e269772661,

6
calc.c
View File

@@ -1,7 +1,7 @@
/*
* calc - arbitrary precision calculator
*
* Copyright (C) 1999 David I. Bell, Landon Curt Noll and Ernest Bowen
* Copyright (C) 1999-2004 David I. Bell, Landon Curt Noll and Ernest Bowen
*
* Primary author: David I. Bell
*
@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.10 $
* @(#) $Id: calc.c,v 29.10 2004/02/23 09:21:35 chongo Exp $
* @(#) $Revision: 29.11 $
* @(#) $Id: calc.c,v 29.11 2004/02/23 14:04:01 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.c,v $
*
* Under source code control: 1990/02/15 01:48:11

104
calc.man
View File

@@ -1,5 +1,5 @@
.\"
.\" Copyright (C) 1999 Landon Curt Noll
.\" Copyright (C) 1999-2004 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
@@ -15,8 +15,8 @@
.\" received a copy with calc; if not, write to Free Software Foundation, Inc.
.\" 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
.\"
.\" @(#) $Revision: 29.12 $
.\" @(#) $Id: calc.man,v 29.12 2004/02/23 05:21:24 chongo Exp $
.\" @(#) $Revision: 29.17 $
.\" @(#) $Id: calc.man,v 29.17 2004/10/23 00:58:33 chongo Exp $
.\" @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.man,v $
.\"
.\" Under source code control: 1991/07/23 05:48:26
@@ -54,7 +54,7 @@ calc \- arbitrary precision calculator
.RB [ calc_cmd\ \&.\|.\|. ]
.in -5n
.sp
\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-f\fP\
\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-f\fP
.SH DESCRIPTION
\&
.br
@@ -119,7 +119,7 @@ as if \fBconfig("resource_debug", 0)\fP had been executed.
For example:
.sp 1
.in +5n
calc 'read qtime; qtime(2)'
calc "read qtime; qtime(2)"
.in -5n
.sp 1
will output something like:
@@ -135,7 +135,7 @@ whereas:
.sp 1
.in +5n
.nf
calc -d 'read qtime; qtime(2)'
calc -d "read qtime; qtime(2)"
.fi
.in -5n
.sp 1
@@ -183,6 +183,80 @@ help config
Ignore any environment variables on startup.
The getenv() builtin will still return values, however.
.TP
.B \-f
This flag is required when using calc in
.BR "shell script mode" .
It must be at the end of the initial
.B #!
line of the script.
.sp 1
This flag is normally only at the end of a calc shell script.
If the first line of an executable file begins
.B #!
followed by the absolute pathname of the
.B calc
program and the flag
.B \-f
as in:
.sp 1
.in +5n
.nf
\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-f\fP
.fi
.in -5n
.sp 1
the rest of the file will be processed in
.BR "shell script mode" .
See
.B "SHELL SCRIPT MODE"
section of this man page
below for details.
.sp 1
The actual form of this flag is:
.sp 1
.in +5n
.B \-f
filename
.in -5n
.sp 1
On systems that treat an executable that begins with
.B #!
as a script, the path of the execurable is appended by the kernel
as the final argument to the exec() system call.
This is why the
.B \-f
flag at the very end of the
.B #!
line.
.sp 1
It is possible use
.B \-f\ filename
on the command line:
.sp 1
.in +5n
.nf
\fIcalc\fP\ [other_flags\ \&...] \fB\-f\fP filename
.fi
.in -5n
.sp 1
This will cause calc to process lines in
.B filename
in
.BR "shell script mode" .
.sp 1
Use of
.B \-f
implies
.BR \-s .
In addition,
.B \-d
and
.B \-p
are implied if
.B \-i
is not given.
.TP
.B \-h
Print a help message. This option implies
@@ -327,7 +401,7 @@ For example:
.sp 1
.in +5n
.nf
calc -p '2^21701-1' | fizzbin
calc -p "2^21701-1" | fizzbin
.fi
.in -5n
.sp 1
@@ -417,7 +491,7 @@ enclosing the command between single marks as in:
.sp 1
.in +5n
.nf
calc '23 * 47'
calc "23 * 47"
.fi
.in -5n
.sp 1
@@ -425,7 +499,7 @@ and
.sp 1
.in +5n
.nf
calc 'print sqrt(2), exp(1)'
calc "print sqrt(2), exp(1)"
.fi
.in -5n
.sp
@@ -578,7 +652,7 @@ help config
.br
SHELL SCRIPT MODE
.PP
If first line of an executable file begins
If the first line of an executable file begins
.B #!
followed by the absolute pathname of the
.B calc
@@ -588,7 +662,7 @@ as in:
.sp 1
.in +5n
.nf
\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-f\fP\
\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-f\fP
.fi
.in -5n
.sp 1
@@ -596,10 +670,10 @@ the rest of the file will be processed in
.BR "shell script mode" .
Note that
.B \-f
must be the first \-flag on the ``#!'' line.
must at the end of the intiial ``#!'' line.
Any other optional
.B "other_flags"
must come after
must come before
the
.BR \-f .
.sp 1
@@ -617,8 +691,6 @@ the later lines within the script itself.
In
.BR "shell script mode" ,
.B \-s
(lower case
.BR \-s )
is always assumed.
In addition,
.B \-d
@@ -634,7 +706,7 @@ the file
.sp 1
.in +5n
.nf
\fI#!${BINDIR}/calc\fP\ \&\fB\-q\fP \fB\-f\fP\
\fI#!${BINDIR}/calc\fP\ \&\fB\-q\fP \fB\-f\fP
#
# mersenne - an example of a calc \fBshell script file\fP

View File

@@ -2,7 +2,7 @@
#
# calc.spec.in - template specfile for calc
#
# Copyright (C) 2003 Petteri Kettunen and Landon Curt Noll
# Copyright (C) 2003-2004 Petteri Kettunen and Landon Curt Noll
#
# Calc is open software; you can redistribute it and/or modify it under
# the terms of the version 2.1 of the GNU Lesser General Public License
@@ -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.12 $
# @(#) $Id: calc.spec.in,v 29.12 2003/04/15 03:37:59 chongo Exp $
# @(#) $Revision: 29.13 $
# @(#) $Id: calc.spec.in,v 29.13 2004/02/23 14:04:01 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.spec.in,v $
#
# Under source code control: 2003/02/16 20:21:39

View File

@@ -1,7 +1,7 @@
/*
* codegen - module to generate opcodes from the input tokens
*
* Copyright (C) 1999 David I. Bell and Ernest Bowen
* Copyright (C) 1999-2004 David I. Bell and Ernest Bowen
*
* Primary author: David I. Bell
*
@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.8 $
* @(#) $Id: codegen.c,v 29.8 2004/02/23 05:39:35 chongo Exp $
* @(#) $Revision: 29.9 $
* @(#) $Id: codegen.c,v 29.9 2004/02/23 14:04:01 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/codegen.c,v $
*
* Under source code control: 1990/02/15 01:48:13

View File

@@ -1,7 +1,7 @@
/*
* config - configuration routines
*
* Copyright (C) 1999-2002 David I. Bell and Landon Curt Noll
* Copyright (C) 1999-2004 David I. Bell and Landon Curt Noll
*
* Primary author: David I. Bell
*
@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.12 $
* @(#) $Id: config.c,v 29.12 2004/02/23 05:59:50 chongo Exp $
* @(#) $Revision: 29.14 $
* @(#) $Id: config.c,v 29.14 2004/02/25 23:56:13 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.c,v $
*
* Under source code control: 1991/07/20 00:21:56
@@ -38,6 +38,7 @@
#include "nametype.h"
#include "config.h"
#include "string.h"
#include "custom.h"
#include "have_strdup.h"
#if !defined(HAVE_STRDUP)
@@ -93,6 +94,8 @@ NAMETYPE configs[] = {
{"basename", CONFIG_BASENAME},
{"windows", CONFIG_WINDOWS},
{"cygwin", CONFIG_CYGWIN},
{"compile_custom", CONFIG_COMPILE_CUSTOM},
{"allow_custom", CONFIG_ALLOW_CUSTOM},
{"version", CONFIG_VERSION},
{NULL, 0}
};
@@ -150,6 +153,12 @@ CONFIG oldstd = { /* backward compatible standard configuration */
#else
FALSE, /* not compiled with cygwin */
#endif
#if defined(CUSTOM)
TRUE, /* compiled with -DCUSTOM */
#else
FALSE, /* compiled without -DCUSTOM */
#endif
&allow_custom, /* *TRUE=> custom functions are enabled */
NULL /* version */
};
CONFIG newstd = { /* new non-backward compatible configuration */
@@ -201,6 +210,12 @@ CONFIG newstd = { /* new non-backward compatible configuration */
#else
FALSE, /* not compiled with cygwin */
#endif
#if defined(CUSTOM)
TRUE, /* compiled with -DCUSTOM */
#else
FALSE, /* compiled without -DCUSTOM */
#endif
&allow_custom, /* *TRUE=> custom functions are enabled */
NULL /* version */
};
CONFIG *conf = NULL; /* loaded in at startup - current configuration */
@@ -872,6 +887,14 @@ setconfig(int type, VALUE *vp)
math_error("The cygwin config parameter is read-only");
/*NOTREACHED*/
case CONFIG_COMPILE_CUSTOM:
math_error("The custom config parameter is read-only");
/*NOTREACHED*/
case CONFIG_ALLOW_CUSTOM:
math_error("The allow_custom config parameter is read-only");
/*NOTREACHED*/
case CONFIG_VERSION:
math_error("The version config parameter is read-only");
/*NOTREACHED*/
@@ -936,6 +959,7 @@ config_copy(CONFIG *src)
} else {
dest->base_name = strdup(src->base_name);
}
/* NOTE: allow_custom points to a global variable, so do not clone it */
if (src->version == NULL) {
dest->version = strdup(version());
} else {
@@ -983,6 +1007,7 @@ config_free(CONFIG *cfg)
if (cfg->base_name != NULL) {
free(cfg->base_name);
}
/* NOTE: allow_custom points to a global variable, so do not free it */
if (cfg->version != NULL) {
free(cfg->version);
}
@@ -1262,6 +1287,26 @@ config_value(CONFIG *cfg, int type, VALUE *vp)
}
return;
case CONFIG_COMPILE_CUSTOM:
if (cfg->compile_custom) {
vp->v_num = itoq(1);
} else {
vp->v_num = itoq(0);
}
return;
case CONFIG_ALLOW_CUSTOM:
/* firewall */
if (cfg->allow_custom == NULL) {
cfg->allow_custom = &allow_custom;
}
if (*(cfg->allow_custom)) {
vp->v_num = itoq(1);
} else {
vp->v_num = itoq(0);
}
return;
case CONFIG_VERSION:
vp->v_type = V_STR;
if (cfg->version == NULL) {
@@ -1361,9 +1406,19 @@ config_cmp(CONFIG *cfg1, CONFIG *cfg2)
(cfg1->base_name != NULL && cfg2->base_name != NULL &&
strcmp(cfg1->base_name, cfg2->base_name) != 0) ||
cfg1->windows != cfg2->windows ||
cfg1->cygwin != cfg2->cygwin ||
cfg1->compile_custom != cfg2->compile_custom ||
(cfg1->allow_custom == NULL && cfg2->allow_custom != NULL) ||
(cfg1->allow_custom != NULL && cfg2->allow_custom == NULL) ||
(cfg1->allow_custom != NULL && cfg2->allow_custom != NULL &&
*(cfg1->allow_custom) != *(cfg2->allow_custom)) ||
(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);
}

View File

@@ -1,7 +1,7 @@
/*
* config - configuration routines
*
* Copyright (C) 1999-2002 Landon Curt Noll and David I. Bell
* Copyright (C) 1999-2004 Landon Curt Noll and David I. Bell
*
* Primary author: Landon Curt Noll
*
@@ -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.15 $
* @(#) $Id: config.h,v 29.15 2004/02/23 06:08:29 chongo Exp $
* @(#) $Revision: 29.17 $
* @(#) $Id: config.h,v 29.17 2004/02/25 23:56:13 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $
*
* Under source code control: 1995/11/01 22:20:17
@@ -92,6 +92,8 @@
#define CONFIG_WINDOWS 38
#define CONFIG_MODE2 39
#define CONFIG_CYGWIN 40
#define CONFIG_COMPILE_CUSTOM 41
#define CONFIG_ALLOW_CUSTOM 42
/*
@@ -157,6 +159,8 @@ struct config {
char *base_name; /* basename of our name */
BOOL windows; /* TRUE => running under MS windows */
BOOL cygwin; /* TRUE => compiled with cygwin */
BOOL compile_custom; /* TRUE => compiled with -DCUSTOM */
BOOL *allow_custom; /* ptr to if custom functions are allowed */
char *version; /* calc version string */
};
typedef struct config CONFIG;

View File

@@ -1,7 +1,7 @@
/*
* const - constant number storage module
*
* Copyright (C) 1999 David I. Bell
* Copyright (C) 1999-2004 David I. Bell
*
* 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.3 $
* @(#) $Id: const.c,v 29.3 2004/02/23 07:50:41 chongo Exp $
* @(#) $Revision: 29.4 $
* @(#) $Id: const.c,v 29.4 2004/02/23 14:04:01 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/const.c,v $
*
* Under source code control: 1990/02/15 01:48:14

View File

@@ -17,9 +17,9 @@
* 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: custom.c,v 29.3 2001/03/17 21:31:47 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/custom.c,v $
* @(#) $Revision: 29.4 $
* @(#) $Id: custom.c,v 29.4 2004/02/25 23:54:40 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/custom/../RCS/custom.c,v $
*
* Under source code control: 1997/03/03 04:53:08
* File existed as early as: 1997
@@ -51,7 +51,7 @@
#endif /* CUSTOM */
int allow_custom = FALSE; /* TRUE => custom builtins allowed */
BOOL allow_custom = FALSE; /* TRUE => custom builtins allowed */
/*

View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.2 $
* @(#) $Id: custom.h,v 29.2 2000/06/07 14:02:13 chongo Exp $
* @(#) $Revision: 29.3 $
* @(#) $Id: custom.h,v 29.3 2004/02/25 23:54:40 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/custom.h,v $
*
* Under source code control: 1997/03/03 04:53:08
@@ -72,7 +72,7 @@ struct custom {
* These are the required interfaces. The dummy.c stubs these interfaces too.
*/
extern VALUE custom(char*, int, VALUE**); /* master custom interface */
extern int allow_custom; /* TRUE => custom builtins allowed */
extern BOOL allow_custom; /* TRUE => custom builtins allowed */
extern void showcustom(void); /* print custom functions */
extern void customhelp(char *); /* direct custom help */
extern CONST struct custom cust[]; /* custom interface table */

View File

@@ -36,13 +36,15 @@ Step 1: Do some background work
anything in Steps 2 and beyond!
If you are not familiar with calc internals, we recommend that
you look at some examples of custom functions. Check out
you look at some examples of custom functions. Look at the
the following source files:
custom.c
custom.h
custom/custom.h
custom/custtbl.c
custom/c_*.[ch]
custom/*.cal
help/custom (or run: calc help custom)
You would be well advised to look at a more recent calc source
@@ -83,14 +85,15 @@ Step 3: Document your custom function
Take a look at one of the example custom help files:
devnull
argv
help
sysinfo
custom/devnull
custom/argv
custom/help
custom/sysinfo
You can save time by using one of the custom help files
as a template. Copy one of these files to your own help file:
cd custom
cp sysinfo curds
and edit it accordingly.
@@ -107,15 +110,16 @@ Step 4: Write your test code
test code will be an import part of your submission. Your test
code will also service as additional for your custom function.
Coops ... we said we would stop preaching, sorry about that ...
Oops ... we said we would stop preaching, sorry about that ...
You can use one of the following as a template:
argv.cal
halflen.cal
custom/argv.cal
custom/halflen.cal
Copy one of these to your own file:
cd custom
cp halflen.cal curds.cal
and exit it accordingly. In particular you will want to:
@@ -152,6 +156,7 @@ Step 5: Write your custom function
We recommend that you use one of the c_*.c files as a template.
Copy an appropriate file to your file:
cd custom
cp c_argv.c u_curds.c
Before you edit it, you should note that there are several important
@@ -179,9 +184,6 @@ Step 5: Write your custom function
VALUE
u_curds(char *name, int count, VALUE **vals)
The /*ARGSUSED*/ may be needed if you do not make use
of all 3 function parameters.
The 3 args are passed in by the custom interface
and have the following meaning:
@@ -222,6 +224,15 @@ Step 5: Write your custom function
vals[1] points to b
vals[2] points to c
NOTE: If you do not use any of the 3 function parameters,
then you should declare that function parameter to be UNUSED.
For example, if the count and vals parameters were not used
in your custom function, then your declaraction should be:
/*ARGSUSED*/
VALUE
u_curds(char *name, int UNUSED count, VALUE UNUSED **vals)
c) The return value is the function must be a VALUE.
The typical way to form a VALUE to return is by declaring
@@ -239,6 +250,8 @@ Step 5: Write your custom function
#include "../value.h"
#include "custom.h"
#include "../have_unused.h"
Typically these will be included just below any system
includes and just below the #if defined(CUSTOM) line.
@@ -362,7 +375,7 @@ Step 6: Register the function in the custom interface table
To allow the custom() builtin to transfer control to your function,
you need to add an entry into the CONST struct custom cust table
found in custtbl.c:
found in custom/custtbl.c:
/*
* custom interface table
@@ -482,10 +495,10 @@ Step 6: Register the function in the custom interface table
extern VALUE u_curds(char*, int, VALUE**);
Step 7: Add the required information to the Makefile
Step 7: Add the required information to the custom/Makefile
The calc test script, curds.cal, should be added to the
CUSTOM_CALC_FILES Makefile variable:
CUSTOM_CALC_FILES Makefile variable found in custom/Makefile:
CUSTOM_CALC_FILES= argv.cal halflen.cal curds.cal
@@ -619,7 +632,7 @@ Step 12: Contribute
and consider submitting your custom function for possible
inclusion in later versions of calc.
## Copyright (C) 1999 Landon Curt Noll
## Copyright (C) 1999-2004 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
@@ -635,8 +648,8 @@ Step 12: Contribute
## 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: HOW_TO_ADD,v 29.2 2000/06/07 14:03:03 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: HOW_TO_ADD,v 29.4 2004/07/29 08:38:05 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/HOW_TO_ADD,v $
##
## Under source code control: 1997/03/10 03:03:21

View File

@@ -2,7 +2,7 @@
#
# custom - makefile for calc custom routines
#
# Copyright (C) 1999 Landon Curt Noll
# Copyright (C) 1999,2004 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
@@ -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.21 $
# @(#) $Id: Makefile,v 29.21 2004/02/23 09:23:08 chongo Exp $
# @(#) $Revision: 29.24 $
# @(#) $Id: Makefile,v 29.24 2004/07/29 08:38:18 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile,v $
#
# Under source code control: 1997/03/09 02:28:54
@@ -40,13 +40,13 @@
#
# Put your custom calc resource files here.
#
CUSTOM_CALC_FILES= argv.cal halflen.cal pzasusb8.cal
CUSTOM_CALC_FILES= argv.cal halflen.cal pzasusb8.cal pmodm127.cal
# The custom help files to install
#
# Put your custom help files here.
#
CUSTOM_HELP= argv devnull help sysinfo pzasusb8
CUSTOM_HELP= argv devnull help sysinfo pzasusb8 pmodm127
# Any .h files that are needed by programs that use libcustcalc.a
#
@@ -62,7 +62,7 @@ CUSTOM_H_SRC=
#
# Put your custom .c files here.
#
CUSTOM_SRC= c_argv.c c_devnull.c c_help.c c_sysinfo.c c_pzasusb8.c
CUSTOM_SRC= c_argv.c c_devnull.c c_help.c c_sysinfo.c c_pzasusb8.c c_pmodm127.c
# Any .o files that are needed by program that use libcustcalc.a.
# Don't put ${REQUIRED_OBJ} files in this list.
@@ -71,7 +71,7 @@ CUSTOM_SRC= c_argv.c c_devnull.c c_help.c c_sysinfo.c c_pzasusb8.c
#
# Put your custom .o files here.
#
CUSTOM_OBJ= c_argv.o c_devnull.o c_help.o c_sysinfo.o c_pzasusb8.o
CUSTOM_OBJ= c_argv.o c_devnull.o c_help.o c_sysinfo.o c_pzasusb8.o c_pmodm127.o
##############################################################################
#-=-=-=-=-=-=- Defaults in case you want to build from this dir -=-=-=-=-=-=-#
@@ -831,6 +831,33 @@ c_help.o: ../value.h
c_help.o: ../win32dll.h
c_help.o: ../zmath.h
c_help.o: c_help.c
c_pmodm127.o: ../alloc.h
c_pmodm127.o: ../block.h
c_pmodm127.o: ../byteswap.h
c_pmodm127.o: ../calcerr.h
c_pmodm127.o: ../cmath.h
c_pmodm127.o: ../config.h
c_pmodm127.o: ../custom.h
c_pmodm127.o: ../endian_calc.h
c_pmodm127.o: ../hash.h
c_pmodm127.o: ../have_const.h
c_pmodm127.o: ../have_malloc.h
c_pmodm127.o: ../have_memmv.h
c_pmodm127.o: ../have_newstr.h
c_pmodm127.o: ../have_stdlib.h
c_pmodm127.o: ../have_string.h
c_pmodm127.o: ../have_unused.h
c_pmodm127.o: ../longbits.h
c_pmodm127.o: ../md5.h
c_pmodm127.o: ../nametype.h
c_pmodm127.o: ../qmath.h
c_pmodm127.o: ../shs.h
c_pmodm127.o: ../shs1.h
c_pmodm127.o: ../string.h
c_pmodm127.o: ../value.h
c_pmodm127.o: ../win32dll.h
c_pmodm127.o: ../zmath.h
c_pmodm127.o: c_pmodm127.c
c_pzasusb8.o: ../alloc.h
c_pzasusb8.o: ../block.h
c_pzasusb8.o: ../byteswap.h
@@ -879,7 +906,6 @@ c_sysinfo.o: ../have_string.h
c_sysinfo.o: ../have_unused.h
c_sysinfo.o: ../hist.h
c_sysinfo.o: ../longbits.h
c_sysinfo.o: ../longlong.h
c_sysinfo.o: ../md5.h
c_sysinfo.o: ../nametype.h
c_sysinfo.o: ../prime.h

View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.2 $
* @(#) $Id: argv.cal,v 29.2 2000/06/07 14:03:03 chongo Exp $
* @(#) $Revision: 29.3 $
* @(#) $Id: argv.cal,v 29.3 2004/03/31 05:03:02 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/argv.cal,v $
*
* Under source code control: 1997/03/10 00:27:17
@@ -34,9 +34,14 @@
* NOTE: You must use a calc that was compiled with ALLOW_CUSTOM= -DCUSTOM
* and run with a -C arg.
*/
if (config("compile_custom") == 0) {
quit "calc compiled without -DCUSTOM";
} else if (config("allow_custom") == 0) {
quit "calc was run without the -D command line option";
}
define argv()
define argv_test()
{
local i; /* arg number */
local junk; /* throw away value */
@@ -54,7 +59,3 @@ define argv()
}
return i-1;
}
if (config("resource_debug") >= 0) {
print "argv(var, ...) defined";
}

View File

@@ -1,7 +1,7 @@
/*
* c_argv - a custom function display info about its args
*
* Copyright (C) 1999 Landon Curt Noll
* Copyright (C) 1999-2004 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.3 $
* @(#) $Id: c_argv.c,v 29.3 2004/02/23 09:19:18 chongo Exp $
* @(#) $Revision: 29.4 $
* @(#) $Id: c_argv.c,v 29.4 2004/02/23 14:04:01 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_argv.c,v $
*
* Under source code control: 1997/03/09 20:27:37

View File

@@ -1,7 +1,7 @@
/*
* c_devnull - a custom function that does nothing
*
* Copyright (C) 1999 Landon Curt Noll
* Copyright (C) 1999-2004 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.3 $
* @(#) $Id: c_devnull.c,v 29.3 2004/02/23 09:19:18 chongo Exp $
* @(#) $Revision: 29.4 $
* @(#) $Id: c_devnull.c,v 29.4 2004/02/23 14:04:01 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_devnull.c,v $
*
* Under source code control: 1997/03/09 17:49:12

View File

@@ -1,7 +1,7 @@
/*
* c_help - custom help function
*
* Copyright (C) 1999 Landon Curt Noll
* Copyright (C) 1999-2004 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.3 $
* @(#) $Id: c_help.c,v 29.3 2004/02/23 09:19:18 chongo Exp $
* @(#) $Revision: 29.4 $
* @(#) $Id: c_help.c,v 29.4 2004/02/23 14:04:01 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_help.c,v $
*
* Under source code control: 1997/03/09 05:25:41

272
custom/c_pmodm127.c Normal file
View File

@@ -0,0 +1,272 @@
/*
* c_pmodm127 - calculate q mod 2^(2^127-1)
*
* Copyright (C) 2004 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.3 $
* @(#) $Id: c_pmodm127.c,v 29.3 2004/07/29 09:48:31 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_pmodm127.c,v $
*
* Under source code control: 2004/07/28 22:12:25
* File existed as early as: 2004
*
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/
#if defined(CUSTOM)
#include <stdio.h>
#include "../have_const.h"
#include "../value.h"
#include "../custom.h"
#include "../zmath.h"
#include "../have_unused.h"
/* 2^255 */
static HALF h255[] = {
#if BASEB == 32
(HALF)0x00000000, (HALF)0x00000000, (HALF)0x00000000, (HALF)0x00000000,
(HALF)0x00000000, (HALF)0x00000000, (HALF)0x00000000, (HALF)0x80000000
#else /* BASEB == 32 */
(HALF)0x0000, (HALF)0x0000, (HALF)0x0000, (HALF)0x0000,
(HALF)0x0000, (HALF)0x0000, (HALF)0x0000, (HALF)0x0000,
(HALF)0x0000, (HALF)0x0000, (HALF)0x0000, (HALF)0x0000,
(HALF)0x0000, (HALF)0x0000, (HALF)0x0000, (HALF)0x8000
#endif /* BASEB == 32 */
};
ZVALUE p255 = {
h255, 8, 0
};
/* static declarations */
static void zmod5_or_zmod(ZVALUE *zp);
static BOOL havelastmod = FALSE;
static ZVALUE lastmod[1];
static ZVALUE lastmodinv[1];
/*
* c_pmodm127 - calculate q mod 2^(2^127-1)
*
* given:
* count = 1;
* vals[0] real number; (q - potential factor)
*
* returns:
* result real number; (q mod 2^(2^127-1))
*/
/*ARGSUSED*/
VALUE
c_pmodm127(char UNUSED *name, int UNUSED count, VALUE **vals)
{
VALUE result; /* what we will return */
ZVALUE q; /* test factor */
ZVALUE temp; /* temp calculation value */
int i; /* exponent value */
/*
* arg check
*/
result.v_type = V_NULL;
if (vals[0]->v_type != V_NUM) {
math_error("Non-numeric argument for pmodm127");
/*NOTREACHED*/
}
if (qisfrac(vals[0]->v_num)) {
math_error("Non-integer argument for pmodm127");
/*NOTREACHED*/
}
if (qisneg(vals[0]->v_num) || qiszero(vals[0]->v_num)) {
math_error("argument for pmodm127 <= 0");
/*NOTREACHED*/
}
/*
* look at the numerator
*/
q = vals[0]->v_num->num;
/*
* setup lastmod with q
*/
if (havelastmod && zcmp(q, *lastmod)) {
zfree(*lastmod);
zfree(*lastmodinv);
havelastmod = FALSE;
}
if (!havelastmod) {
zcopy(q, lastmod);
zbitvalue(2 * q.len * BASEB, &temp);
zquo(temp, q, lastmodinv, 0);
zfree(temp);
havelastmod = TRUE;
}
/*
* start with 2^255
*/
result.v_num = qalloc();
zcopy(p255, &result.v_num->num);
result.v_type = V_NUM;
/*
* compute 2^(2^127-1) mod q by modular exponentation
*
* We implement the following calc code in C:
*
* (* given q, our test factor, as the arg to this function *)
* result = 2^255;
* for (i=8; i < 127; ++i) {
* result %= q; (* mod *)
* result *= result; (* square *)
* result <<= 1; (* times 2 *)
* }
* result %= q; (* result is now 2^(2^127-1) % q *)
*/
for (i=8; i<127; ++i) {
#if 0
/* use of zmod is a bit slower than zmod5_or_zmod */
(void) zmod(result.v_num->num, *lastmod, &temp, 0);
zfree(result.v_num->num);
result.v_num->num = temp;
#else
zmod5_or_zmod(&result.v_num->num); /* mod */
#endif
#if 0
/* use of zmul is slightly slower than zsquare */
zmul(result.v_num->num, result.v_num->num, &temp); /* square */
#else
zsquare(result.v_num->num, &temp); /* square */
#endif
/* XXX - we could manually shift to speed up a tiny bit */
zfree(result.v_num->num);
zshift(temp, 1, &result.v_num->num); /* times 2 */
zfree(temp);
}
zmod5_or_zmod(&result.v_num->num); /* result = 2^(2^127-1) % q */
/*
* cleanup and return result
*/
return result;
}
/*
* zmod5_or_zmod - fast integer modulo the modulus computation
*
* "borrowed" from ../zmod.c
*
* Given the address of a positive integer whose word count does not
* exceed twice that of the modulus stored at lastmod, to evaluate and store
* at that address the value of the integer modulo the modulus.
*
* Unlike the static routine in ../zmod.c, we will call the zmod and return
* the result of the zmod5_or_zmod conditions do not apply to the argument
* and saved mod.
*/
static void
zmod5_or_zmod(ZVALUE *zp)
{
LEN len, modlen, j;
ZVALUE tmp1, tmp2;
ZVALUE z1, z2, z3;
HALF *a, *b;
FULL f;
HALF u;
int subcount = 0;
if (zrel(*zp, *lastmod) < 0)
return;
modlen = lastmod->len;
len = zp->len;
z1.v = zp->v + modlen - 1;
z1.len = len - modlen + 1;
z1.sign = z2.sign = z3.sign = 0;
if (z1.len > modlen + 1) {
/* in ../zmod.c we did a math_error("Bad call to zmod5!!!"); */
/* here we just call the slower zmod and return the result */
(void) zmod(*zp, *lastmod, &tmp1, 0);
/* replace zp with tmp1 mod result */
zfree(*zp);
*zp = tmp1;
return;
}
z2.v = lastmodinv->v + modlen + 1 - z1.len;
z2.len = lastmodinv->len - modlen - 1 + z1.len;
zmul(z1, z2, &tmp1);
z3.v = tmp1.v + z1.len;
z3.len = tmp1.len - z1.len;
if (z3.len > 0) {
zmul(z3, *lastmod, &tmp2);
j = modlen;
a = zp->v;
b = tmp2.v;
u = 0;
len = modlen;
while (j-- > 0) {
f = (FULL) *a - (FULL) *b++ - (FULL) u;
*a++ = (HALF) f;
u = - (HALF) (f >> BASEB);
}
if (z1.len > 1) {
len++;
if (tmp2.len > modlen)
f = (FULL) *a - (FULL) *b - (FULL) u;
else
f = (FULL) *a - (FULL) u;
*a++ = (HALF) f;
}
while (len > 0 && *--a == 0)
len--;
zp->len = len;
zfree(tmp2);
}
zfree(tmp1);
while (len > 0 && zrel(*zp, *lastmod) >= 0) {
subcount++;
if (subcount > 2) {
math_error("Too many subtractions in zmod5_or_zmod");
/*NOTREACHED*/
}
j = modlen;
a = zp->v;
b = lastmod->v;
u = 0;
while (j-- > 0) {
f = (FULL) *a - (FULL) *b++ - (FULL) u;
*a++ = (HALF) f;
u = - (HALF) (f >> BASEB);
}
if (len > modlen) {
f = (FULL) *a - (FULL) u;
*a++ = (HALF) f;
}
while (len > 0 && *--a == 0)
len--;
zp->len = len;
}
if (len == 0)
zp->len = 1;
}
#endif /* CUSTOM */

View File

@@ -1,7 +1,7 @@
/*
* c_pzasusb8 - print numereator as a string of USB8s
*
* Copyright (C) 1999 Ernest Bowen
* Copyright (C) 1999-2004 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
@@ -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: c_pzasusb8.c,v 29.3 2004/02/23 09:19:18 chongo Exp $
* @(#) $Revision: 29.4 $
* @(#) $Id: c_pzasusb8.c,v 29.4 2004/02/23 14:04:01 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_pzasusb8.c,v $
*
* Under source code control: 1999/10/06 03:12:25

View File

@@ -1,7 +1,7 @@
/*
* c_sysinfo - names and values of selected #defines
*
* Copyright (C) 1999 Landon Curt Noll
* Copyright (C) 1999,2004 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.7 $
* @(#) $Id: c_sysinfo.c,v 29.7 2004/02/23 09:19:18 chongo Exp $
* @(#) $Revision: 29.10 $
* @(#) $Id: c_sysinfo.c,v 29.10 2004/03/31 05:02:10 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_sysinfo.c,v $
*
* Under source code control: 1997/03/09 23:14:40
@@ -42,7 +42,6 @@
#include "../calc.h"
#include "../longbits.h"
#define CHECK_L_FORMAT
#include "../longlong.h"
#include "../block.h"
#include "../calcerr.h"
#include "../conf.h"
@@ -104,7 +103,6 @@ static struct infoname sys_info[] = {
{"INIT_K", "initial 2nd walking a55 table index", NULL, (FULL)INIT_K},
{"INODE_BITS", "inode number size in bits", NULL, (FULL)INODE_BITS},
{"LITTLE_ENDIAN", "Least Significant Byte first symbol", NULL, (FULL)LITTLE_ENDIAN},
{"LONGLONG_BITS", "length of a long long, or 0", NULL, (FULL)LONGLONG_BITS},
{"LONG_BITS", "bit length of a long", NULL, (FULL)LONG_BITS},
{"MAP_POPCNT", "number of odd primes in pr_map", NULL, (FULL)MAP_POPCNT},
{"MAX_CALCRC", "maximum allowed length of $CALCRC", NULL, (FULL)MAX_CALCRC},
@@ -317,30 +315,16 @@ dump_name_value(void)
/* dump the entire table */
for (p = sys_info; p->name != NULL; ++p) {
if (p->str == NULL) {
#if LONG_BITS == FULL_BITS || FULL_BITS == 32 || !defined(HAVE_LONGLONG)
#if LONG_BITS == FULL_BITS || FULL_BITS == 32
printf("%s%-23s\t%-8lu\t(0x%lx)\n",
(conf->tab_ok ? "\t" : ""), p->name,
(unsigned long)p->nmbr,
(unsigned long)p->nmbr);
#else
/*
* Determine of %ld can print a 64 bit long long.
*
* Some systems that can make use of %ld to print a
* a 64 bit value do not support the %lld type.
* So we will only try %lld if %ld does not work.
*/
# if defined(L64_FORMAT)
printf("%s%-23s\t%-8lu\t(0x%lx)\n",
(conf->tab_ok ? "\t" : ""), p->name,
(unsigned long long)p->nmbr,
(unsigned long long)p->nmbr);
# else /* L64_FORMAT */
printf("%s%-23s\t%-8llu\t(0x%llx)\n",
(conf->tab_ok ? "\t" : ""), p->name,
(unsigned long long)p->nmbr,
(unsigned long long)p->nmbr);
# endif /* L64_FORMAT */
#endif
} else {
printf("%s%-23s\t\"%s\"\n",
@@ -362,25 +346,16 @@ dump_mening_value(void)
/* dump the entire table */
for (p = sys_info; p->name != NULL; ++p) {
if (p->str == NULL) {
#if LONG_BITS == FULL_BITS || FULL_BITS == 32 || !defined(HAVE_LONGLONG)
#if LONG_BITS == FULL_BITS || FULL_BITS == 32
printf("%s%-36.36s\t%-8lu\t(0x%lx)\n",
(conf->tab_ok ? "\t" : ""), p->meaning,
(unsigned long)p->nmbr,
(unsigned long)p->nmbr);
#else
# if defined(L64_FORMAT)
/* %ld prints all 64 bits, use %ld */
printf("%s%-36.36s\t%-8lu\t(0x%lx)\n",
(conf->tab_ok ? "\t" : ""), p->meaning,
(unsigned long long)p->nmbr,
(unsigned long long)p->nmbr);
# else /* L64_FORMAT */
/* %ld prints lower 32 bits only, use %lld */
printf("%s%-36.36s\t%-8llu\t(0x%llx)\n",
(conf->tab_ok ? "\t" : ""), p->meaning,
(unsigned long long)p->nmbr,
(unsigned long long)p->nmbr);
# endif /* L64_FORMAT */
#endif
} else {
printf("%s%-36.36s\t\"%s\"\n",

View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.2 $
* @(#) $Id: custtbl.c,v 29.2 2000/06/07 14:03:03 chongo Exp $
* @(#) $Revision: 29.3 $
* @(#) $Id: custtbl.c,v 29.3 2004/07/29 08:37:53 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/custtbl.c,v $
*
* Under source code control: 1997/03/09 02:28:54
@@ -56,6 +56,7 @@ extern VALUE c_devnull(char*, int, VALUE**);
extern VALUE c_help(char*, int, VALUE**);
extern VALUE c_sysinfo(char*, int, VALUE**);
extern VALUE c_pzasusb8(char*, int, VALUE**);
extern VALUE c_pmodm127(char*, int, VALUE**);
#endif /* CUSTOM */
@@ -108,6 +109,9 @@ CONST struct custom cust[] = {
{ "pzasusb8", "print ZCALUE as USB8",
0, 1, c_pzasusb8 },
{ "pmodm127", "calculate q mod 2^(2^127-1)",
1, 1, c_pmodm127 },
#endif /* CUSTOM */

View File

@@ -1,7 +1,7 @@
/*
* halflen - determine the length of numeric value in HALFs
*
* Copyright (C) 1999 Landon Curt Noll
* Copyright (C) 1999,2004 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: halflen.cal,v 29.2 2000/06/07 14:03:03 chongo Exp $
* @(#) $Revision: 29.3 $
* @(#) $Id: halflen.cal,v 29.3 2004/03/31 05:03:02 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/halflen.cal,v $
*
* Under source code control: 1997/03/08 20:51:32
@@ -34,11 +34,16 @@
* NOTE: You must use a calc that was compiled with ALLOW_CUSTOM= -DCUSTOM
* and run with a -C arg.
*/
if (config("compile_custom") == 0) {
quit "calc compiled without -DCUSTOM";
} else if (config("allow_custom") == 0) {
quit "calc was run without the -D command line option";
}
define halflen(num)
{
local baseb = custom("sysinfo","BASEB"); /* bit len of a HALF */
local baseb; /* bit len of a HALF */
/*
* firewall
@@ -47,6 +52,11 @@ define halflen(num)
return newerror("halflen only works on numeric values");
}
/*
* determine baseb
*/
baseb = custom("sysinfo","BASEB");
/*
* determine the HALF length of a numeric value
*/
@@ -63,7 +73,3 @@ define halflen(num)
return newerror("halflen only works on numeric values");
}
}
if (config("resource_debug") >= 0) {
print "halflen(num) defined";
}

78
custom/pmodm127 Normal file
View File

@@ -0,0 +1,78 @@
NAME
pmodm127 - calculate q mod 2^(2^127-1)
SYNOPSIS
custom("pmodm127", q)
TYPES
q int > 0
return int
DESCRIPTION
This custom function will return the value:
q mod 2^(2^127-1)
This custom function serves as a demonstration of how to write
a custom function. It performs the equivalent of:
pmod(2, 2^127-1, q)
The return value is integer in the half open range: [0, q).
SPECIAL NOTE:
Can you find a value, q, for which this custom function returns 1?
If you do, send the value of q to chongo using the EMail address
found at:
http://www.isthe.com/chongo/address.html
EXAMPLE
> custom("pmodm127", 65537)
32769
> custom("pmodm127", 2^31-1)
8
> custom("pmodm127", 7^51+2)
11228202966269457258557496419097462731193173
LIMITS
calc must be built with ALLOW_CUSTOM= -DCUSTOM
calc must be executed with a -C arg.
q must be an integer > 0
LIBRARY
none
SEE ALSO
custom
## Copyright (C) 2004 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: pmodm127,v 29.2 2004/07/29 09:28:58 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/pmodm127,v $
##
## Under source code control: 2004/02/25 07:13:15
## File existed as early as: 2004
##
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/

137
custom/pmodm127.cal Normal file
View File

@@ -0,0 +1,137 @@
/*
* pmodm127 - test pmodm127's ability to calculate q mod 2^(2^127-1)
*
* Copyright (C) 2004 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: pmodm127.cal,v 29.2 2004/07/29 08:35:36 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/pmodm127.cal,v $
*
* Under source code control: 2004/02/25 14:25:32
* File existed as early as: 2004
*
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/
/*
* This file is part of the custom sample calc files.
*
* NOTE: You must use a calc that was compiled with ALLOW_CUSTOM= -DCUSTOM
* and run with a -C arg.
*/
if (config("compile_custom") == 0) {
quit "calc compiled without -DCUSTOM";
} else if (config("allow_custom") == 0) {
quit "calc was run without the -D command line option";
}
define pmodm127_test1(testcnt)
{
local q; /* test factor */
local m127; /* 2^127-1 */
local i;
/*
* firewall
*/
if (!isint(testcnt) || testcnt <= 0) {
return newerror("pmodm127_test1 must have an integer count>0");
}
/*
* perform testcnt divisor tests for primes of form 2*k*(2^127-1)+1
*
* NOTE: Since this is just a test, we do not need to be optimal.
*/
m127 = 2^127 - 1;
q = 2*4949132165849*m127+1;
for (i=0; i < testcnt; ++i) {
/*
* determine next prime divisor
*/
q = nextcand(q, -1, 0, 1, 2*m127);
/* compare custom function with its pmod() equivalent */
if (config("resource_debug") & 8) {
print "testing", q;
}
if (pmod(2, m127, q) != custom("pmodm127", q)) {
print "ERROR: pmodm127 failed for ", str(q);
return newerror("pmodm127 failed for " + str(q));
}
}
/* return success count */
if (config("resource_debug") & 8) {
print "passed", testcnt, "tests";
}
return testcnt;
}
define pmodm127_test2(testcnt, seed)
{
local q; /* test factor */
local m127; /* 2^127-1 */
local i;
/*
* firewall
*/
if (!isint(testcnt) || testcnt <= 0) {
return newerror("pmodm127_test2 must have an integer count>0");
}
if (!isint(seed)) {
return newerror("pmodm127_test2 must an integer seed");
}
/*
* perform testcnt divisor tests random integers over [1e51, 1e52)
*
* NOTE: Since this is just a test, we do not need to be optimal.
*/
m127 = 2^127 - 1;
for (i=0; i < testcnt; ++i) {
/*
* determine next prime divisor
*/
q = rand(1e51, 1e52) | 0x1;
if (config("resource_debug") & 8) {
print "testing", q;
}
/* compare custom function with its pmod() equivalent */
if (pmod(2, m127, q) != custom("pmodm127", q)) {
print "ERROR: pmodm127 failed for ", str(q);
print "ERROR: ", pmod(2,m127,q), " != ", custom("pmodm127", q);
return newerror("pmodm127 failed for " + str(q));
}
}
/* return success count */
if (config("resource_debug") & 8) {
print "passed", testcnt, "tests";
}
return testcnt;
}
if ((config("resource_debug") & 3) && !(config("resource_debug") & 8)) {
print "DEBUG: use config('resource_debug',", config("resource_debug")|8:") to enable more debugging";
}

View File

@@ -1,7 +1,7 @@
/*
* pzasusb8 - print numereator as a string of USB8s
*
* Copyright (C) 1999 Ernest Bowen and Landon Curt Noll
* Copyright (C) 1999,2004 Ernest Bowen and Landon Curt Noll
*
* Primary author: Ernest Bowen
*
@@ -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: pzasusb8.cal,v 29.2 2000/06/07 14:03:03 chongo Exp $
* @(#) $Revision: 29.3 $
* @(#) $Id: pzasusb8.cal,v 29.3 2004/03/31 05:03:02 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/pzasusb8.cal,v $
*
* Under source code control: 1999/10/06 03:11:12
@@ -31,6 +31,15 @@
*/
/*
* firewall
*/
if (config("compile_custom") == 0) {
quit "calc compiled without -DCUSTOM";
} else if (config("allow_custom") == 0) {
quit "calc was run without the -D command line option";
}
print "p(n) prints array in which numerator of n is stored as a";
print "sequence of 2-hex-digits representing unsigned characters.";
print "h(n) printx n in hex notation. This should be the same as";
@@ -52,6 +61,5 @@ print "CALC_BYTE_ORDER: ", custom("sysinfo", "CALC_BYTE_ORDER");
print "BIG_ENDIAN: ", custom("sysinfo", "BIG_ENDIAN");
print "LITTLE_ENDIAN: ", custom("sysinfo", "LITTLE_ENDIAN");
print "LONG_BITS: ", custom("sysinfo", "LONG_BITS");
print "LONGLONG_BITS: ", custom("sysinfo", "LONGLONG_BITS");
print "Calc sizes:";
show sizes;

6
file.c
View File

@@ -1,7 +1,7 @@
/*
* file - file I/O routines callable by users
*
* Copyright (C) 1999 David I. Bell and Landon Curt Noll
* Copyright (C) 1999-2004 David I. Bell and Landon Curt Noll
*
* Primary author: David I. Bell
*
@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.8 $
* @(#) $Id: file.c,v 29.8 2004/02/23 07:53:12 chongo Exp $
* @(#) $Revision: 29.9 $
* @(#) $Id: file.c,v 29.9 2004/02/23 14:04:01 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/file.c,v $
*
* Under source code control: 1991/07/20 00:21:56

10
func.c
View File

@@ -1,7 +1,7 @@
/*
* func - built-in functions implemented here
*
* Copyright (C) 1999-2002 David I. Bell, Landon Curt Noll and Ernest Bowen
* Copyright (C) 1999-2004 David I. Bell, Landon Curt Noll and Ernest Bowen
*
* Primary author: David I. Bell
*
@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.13 $
* @(#) $Id: func.c,v 29.13 2004/02/23 07:25:41 chongo Exp $
* @(#) $Revision: 29.15 $
* @(#) $Id: func.c,v 29.15 2004/07/26 05:55:37 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/func.c,v $
*
* Under source code control: 1990/02/15 01:48:15
@@ -8027,7 +8027,7 @@ static CONST struct builtin builtins[] = {
{"free", 0, IN, FA, OP_NOP, 0, f_free,
"free listed or all global variables"},
{"freebernoulli", 0, 0, 0, OP_NOP, 0, f_freebern,
"free stored Benoulli numbers"},
"free stored Bernoulli numbers"},
{"freeeuler", 0, 0, 0, OP_NOP, 0, f_freeeuler,
"free stored Euler numbers"},
{"freeglobals", 0, 0, 0, OP_NOP, 0, f_freeglobals,
@@ -8345,7 +8345,7 @@ static CONST struct builtin builtins[] = {
{"sizeof", 1, 1, 0, OP_NOP, 0, f_sizeof,
"number of octets used to hold the value"},
{"sleep", 0, 1, 0, OP_NOP, 0, f_sleep,
"suspend operatioo for a seconds"},
"suspend operation for a seconds"},
{"sort", 1, 1, 0, OP_NOP, 0, f_sort,
"sort a copy of a matrix or list"},
{"sqrt", 1, 3, 0, OP_NOP, 0, f_sqrt,

13
hash.c
View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.5 $
* @(#) $Id: hash.c,v 29.5 2002/12/29 09:20:25 chongo Exp $
* @(#) $Revision: 29.6 $
* @(#) $Id: hash.c,v 29.6 2004/02/25 23:55:38 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/hash.c,v $
*
* Under source code control: 1995/11/23 05:13:11
@@ -985,6 +985,15 @@ hash_value(int type, void *v, HASH *state)
state = hash_int(type, value->v_config->ctrl_d, state);
state = hash_str(type, value->v_config->program, state);
state = hash_str(type, value->v_config->base_name, state);
state = hash_bool(type, value->v_config->windows, state);
state = hash_bool(type, value->v_config->cygwin, state);
state = hash_bool(type, value->v_config->compile_custom, state);
if (value->v_config->allow_custom != NULL &&
*(value->v_config->allow_custom)) {
state = hash_bool(type, TRUE, state);
} else {
state = hash_bool(type, FALSE, state);
}
state = hash_str(type, value->v_config->version, state);
break;

View File

@@ -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.23 $
# @(#) $Id: Makefile,v 29.23 2003/01/14 02:24:48 chongo Exp $
# @(#) $Revision: 29.25 $
# @(#) $Id: Makefile,v 29.25 2004/07/28 12:21:05 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/help/RCS/Makefile,v $
#
# Under source code control: 1991/07/23 06:47:57
@@ -170,6 +170,19 @@ SORT= sort
FMT= fmt
CMP= cmp
# Some out of date operating systems require / want an executable to
# end with a certain file extension. Some compile systems such as
# Cygwin build calc as calc.exe. The EXT variable is used to denote
# the extension required by such.
#
# EXT= # normal Un*x / Linux / GNU/Linux systems
# EXT=.exe # windoz / Cygwin
#
# If in doubt, use EXT=
#
EXT=
#EXT=.exe
# Standard and Builtin help files
#
STD_HELP_FILES_1= intro overview help
@@ -250,8 +263,8 @@ DETAIL_HELP= abs access acos acosh acot acoth acsc acsch address agd append \
avg base base2 bernoulli bit blk blkcpy blkfree blocks bround btrunc \
calc_tty calclevel catalan ceil cfappr cfsim char cmdbuf cmp comb \
conj cos cosh cot coth count cp csc csch ctime delete den dereference \
det digit digits dp epsilon errcount errmax errno error euler eval \
exp fact factor fclose fcnt feof ferror fflush fgetc fgetfield \
det digit digits display dp epsilon errcount errmax errno error euler \
eval exp fact factor fclose fcnt feof ferror fflush fgetc fgetfield \
fgetline fgets fgetstr fib files floor fopen forall fprintf fputc \
fputs fputstr frac free freebernoulli freeeuler freeglobals freeredc \
freestatics frem freopen fscan fscanf fseek fsize ftell gcd gcdrem \
@@ -534,13 +547,13 @@ builtin: builtin.top builtin.end ../func.c funclist.sed
${Q}echo "forming builtin help file"
-${Q}rm -f funclist.c
${Q}${SED} -n -f funclist.sed ../func.c > funclist.c
-${Q}rm -f funclist.o funclist
-${Q}rm -f funclist.o funclist${EXT}
${Q}${LCC} ${ICFLAGS} -DFUNCLIST -I/usr/include \
-I.. funclist.c -c 2>/dev/null
${Q}${LCC} ${ILDFLAGS} funclist.o -o funclist
${Q}${LCC} ${ILDFLAGS} funclist.o -o funclist${EXT}
-${Q}rm -f builtin
${Q}cat builtin.top > builtin
${Q}./funclist | \
${Q}./funclist${EXT} | \
${SED} -e 's/^/ /' -e 's/[ ][ ]*$$//' >> builtin
${Q}cat builtin.end >> builtin
${Q}echo "builtin help file formed"
@@ -625,12 +638,12 @@ echo_inst_files:
##
clean:
rm -f obj mkbuiltin funclist.c funclist.o funclist
rm -f obj mkbuiltin funclist.c funclist.o funclist${EXT}
rm -f COPYING COPYING-LGPL
clobber:
rm -f ${BLT_HELP_FILES} full .all calc
rm -f obj mkbuiltin funclist.c funclist.o funclist
rm -f obj mkbuiltin funclist.c funclist.o funclist${EXT}
rm -f COPYING COPYING-LGPL
rm -f ${SINGULAR_FILES} ${DETAIL_CLONE}

View File

@@ -50,6 +50,8 @@ Configuration parameters
"basename" Read-only basename of the program value
"windows" Read-only indicator of MS windows
"cygwin" TRUE=>calc compiled with cygwin, Read-only
"compile_custom" TRUE=>calc was compiled with custom functions
"allow_custom" TRUE=>custom functions are enabled
"version" Read-only calc version
The "all" config value allows one to save/restore the configuration
@@ -553,7 +555,7 @@ Detailed config descriptions
is displayed.
2 Show func will display more information about a functions
arguments as well as more argument sdummary information.
arguments and argument summary information.
3 During execution, allow calc standard resource files
to output additional debugging information.
@@ -712,6 +714,40 @@ Detailed config descriptions
=-=
config("compile_custom") <== NOTE: This is a read-only config value
Returns TRUE if you calc was compiled with -DCUSTOM. By default,
the calc Makefile uses ALLOW_CUSTOM= -DCUSTOM so by default
config("compile_custom") is TRUE. If, however, calc is compiled
without -DCUSTOM, then config("compile_custom") will be FALSE.
The config("compile_custom") value is only affected by compile
flags. The calc -D runtime command line option does not change
the config("compile_custom") value.
See also config("allow_custom").
This config parameter is read-only and cannot be set.
=-=
config("allow_custom") <== NOTE: This is a read-only config value
Returns TRUE if you custom functions are enabled. To allow the use
of custom functions, calc must be compiled with -DCUSTOM (which it
is by default) AND calc run be run with the -D runtime command line
option (which it is not by default).
If config("allow_custom") is TRUE, then custom functions are allowed.
If config("allow_custom") is FALSE, then custom functions are not
allowed.
See also config("compile_custom").
This config parameter is read-only and cannot be set.
=-=
config("version") <== NOTE: This is a read-only config value
The version string of the calc program can be obtained by:
@@ -736,8 +772,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.8 $
## @(#) $Id: config,v 29.8 2004/02/23 05:59:22 chongo Exp $
## @(#) $Revision: 29.10 $
## @(#) $Id: config,v 29.10 2004/07/27 23:45:52 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/config,v $
##
## Under source code control: 1991/07/21 04:37:17

81
help/display Normal file
View File

@@ -0,0 +1,81 @@
NAME
display - set and/or return decimal digits for displaying numbers
SYNOPSIS
display([d])
TYPES
d integer >= 0
return integer
DESCRIPTION
When given an argument, this function sets the maximum number of
digits after the decimal point to be printed in real or exponential
mode in normal unformatted printing (print, strprint, fprint) or in
formatted printing (printf, strprintf, fprintf) when precision is
not specified. The return value is the previous display digit value.
When given no arguments, this function returns the current
display digit value.
The builtin function:
display(d)
display()
is an alias for:
config("display", d)
config("display")
The display digit value does not change the stored value of a number.
It only changes how a stored value is displayed.
Where rounding is necessary to display up to d decimal places,
the type of rounding to be used is controlled by config("outround").
EXAMPLE
> print display(), 2/3
20 ~0.66666666666666666667
> print display(40), 2/3
20 ~0.6666666666666666666666666666666666666667
> print display(5), 2/3
40 ~0.66667
LIMITS
d >= 0
LINK LIBRARY
none
SEE ALSO
config
## Copyright (C) 2004 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: display,v 29.1 2004/07/26 06:54:41 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/display,v $
##
## Under source code control: 2004/07/25 23:50:40
## File existed as early as: 2004
##
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/

View File

@@ -9,11 +9,11 @@ Environment variables
If this variable does not exist, a compiled value
is used. Typically compiled in value is:
.:./cal:~/cal:${LIBDIR}/calc:${LIBDIR}/custom
.:./cal:~/cal:${CALC_SHAREDIR}:${CUSTOMCALDIR}
where ${LIBDIR} is usually:
which is usually:
/usr/local/lib/calc
.:./cal:~/cal:/usr/share/calc:/usr/share/calc/custom
This value is used by the READ command. It is an error
if no such readable file is found.
@@ -30,11 +30,11 @@ Environment variables
If this variable does not exist, a compiled value
is used. Typically compiled in value is:
${LIBDIR}/startup:~/.calcrc
${CALC_SHAREDIR}/startup:~/.calcrc:./.calcinit
where ${LIBDIR} is usually:
which is usually:
/usr/local/lib/calc
/usr/share/calc/startup:~/.calcrc:./.calcinit
Missing files along the $CALCRC path are silently ignored.
@@ -104,8 +104,8 @@ Environment variables
## 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: environment,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: environment,v 29.3 2004/07/26 07:10:43 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/environment,v $
##
## Under source code control: 1991/07/23 05:47:25

View File

@@ -1,5 +1,5 @@
NAME
freebernoulli - free stored Benoulli numbers
freebernoulli - free stored Bernoulli numbers
SYNOPSIS
freebernoulli()
@@ -39,8 +39,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.2 $
## @(#) $Id: freebernoulli,v 29.2 2000/07/17 15:36:26 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: freebernoulli,v 29.3 2004/07/26 05:54:00 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/freebernoulli,v $
##
## Under source code control: 2000/07/13

View File

@@ -146,13 +146,19 @@ Calc shell scripts
interpreter. Assuming the full path for calc is
/usr/local/bin/calc, one could use the file addall3 with contents
#!/usr/local/bin/calc -q -s -f
#!/usr/bin/calc -q -s -f
global i, n, s;
n = argv();
for (i = 1; i <= n; i++)
s += eval(argv(i));
print "sum =", s;
IMPORTANT NOTE:
The -f flag must be at the very end of the #! line.
The #! line must be the first line of the exeuctable file.
The path after the #! must be the full path to the calc executable.
After the command:
addall3 2 3 4
@@ -283,8 +289,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.5 $
## @(#) $Id: script,v 29.5 2001/04/08 07:56:32 chongo Exp $
## @(#) $Revision: 29.7 $
## @(#) $Id: script,v 29.7 2004/10/23 00:41:11 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/script,v $
##
## Under source code control: 1999/11/30 05:29:48

12
hist.c
View File

@@ -1,7 +1,7 @@
/*
* hist - interactive readline module
*
* Copyright (C) 1999 David I. Bell
* Copyright (C) 1999-2004 David I. Bell
*
* 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.4 $
* @(#) $Id: hist.c,v 29.4 2004/02/23 07:54:24 chongo Exp $
* @(#) $Revision: 29.6 $
* @(#) $Id: hist.c,v 29.6 2004/02/23 14:04:01 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/hist.c,v $
*
* Under source code control: 1993/05/02 20:09:19
@@ -195,8 +195,8 @@ static char esc_map_name[] = "esc-map";
static KEY_MAP maps[] = {
{base_map_name},
{esc_map_name}
{base_map_name, {NULL, NULL}, {NULL, NULL}},
{esc_map_name, {NULL, NULL}, {NULL, NULL}},
};
@@ -409,7 +409,7 @@ hist_term(void)
static KEY_MAP *
find_map(char *map)
{
int i;
unsigned int i;
for (i = 0; i < sizeof(maps) / sizeof(maps[0]); i++) {
if (strcmp(map, maps[i].name) == 0)

View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.9 $
* @(#) $Id: lib_calc.c,v 29.9 2003/08/26 04:36:10 chongo Exp $
* @(#) $Revision: 29.10 $
* @(#) $Id: lib_calc.c,v 29.10 2004/07/26 06:35:32 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/lib_calc.c,v $
*
* Under source code control: 1996/06/17 18:06:19
@@ -252,10 +252,11 @@ libcalc_call_me_first(void)
}
/*
* -d turns off resource_debug
* -d turns off resource_debug and tilde
*/
if (d_flag) {
conf->resource_debug = 0;
conf->tilde_ok = 0;
}
/*

View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.2 $
* @(#) $Id: longbits.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
* @(#) $Revision: 29.3 $
* @(#) $Id: longbits.c,v 29.3 2004/03/31 04:18:19 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/longbits.c,v $
*
* Under source code control: 1994/03/18 03:06:18
@@ -74,11 +74,6 @@
* L(x) form a 33 to 64 bit signed constant
* U(x) form a 33 to 64 bit unsigned constant
*
* We will also note if we have a standard 64 bit type (i.e., long). If we
* do, we will typedef it and define HAVE_B64. If we do not then if longlong.h
* says we can use long long types, we will use that. If we cannot use a
* long long type, then HAVE_B64 will not be defined.
*
* We hide the comments within strings to avoid complaints from some snitty
* compilers. We also hide 3 X's which is the calc symbol for "something bogus
* this way comes". In such error cases, we add -=*#*=- to force a syntax
@@ -101,8 +96,6 @@
# include <stdlib.h>
#endif
#include "longlong.h"
#if defined(__linux)
# if !defined(isascii)
extern int isascii(int c);
@@ -201,7 +194,6 @@ main(int argc, char **argv)
/*
* forced forming of HAVE_B64, USB64, SB64, U(x) and L(x)
*/
#if defined(HAVE_LONGLONG) && LONGLONG_BITS == 64
printf("#undef HAVE_B64\n");
printf("#define HAVE_B64\t\t/%s/\n",
"* have USB64 and SB64 types *");
@@ -218,16 +210,6 @@ main(int argc, char **argv)
printf("#define U(x) ((unsigned long long)x)\n");
printf("#define L(x) ((long long)x)\n");
#endif
#else
printf("#undef HAVE_B64\t\t\t/%s/\n",
"* we have no USB64 and no SB64 types *");
putchar('\n');
printf("/%s/\n", "* no 64 bit constants *");
printf("#define U(x) no 33 to 64 bit constants %s\n",
"- do not use this macro!");
printf("#define L(x) no 33 to 64 bit constants %s\n",
"- do not use this macro!");
#endif
/*
* all done
@@ -333,7 +315,6 @@ main(int argc, char **argv)
printf("#define L(x) ((long)x)\n");
#endif
} else {
#if defined(HAVE_LONGLONG) && LONGLONG_BITS == 64
printf("#undef HAVE_B64\n");
printf("#define HAVE_B64\t\t/%s/\n",
"* have USB64 and SB64 types *");
@@ -349,16 +330,6 @@ main(int argc, char **argv)
#else
printf("#define U(x) ((unsigned long long)x)\n");
printf("#define L(x) ((long long)x)\n");
#endif
#else
printf("#undef HAVE_B64\t\t\t/%s/\n",
"* we have no USB64 and no SB64 types *");
putchar('\n');
printf("/%s/\n", "* no 64 bit constants *");
printf("#define U(x) no 33 to 64 bit constants %s\n",
"- do not use this macro!");
printf("#define L(x) no 33 to 64 bit constants %s\n",
"- do not use this macro!");
#endif
}

View File

@@ -1,145 +0,0 @@
/*
* longlong - determine the number of bits in a long long, if is exists
*
* Copyright (C) 1999 Landon Curt Noll
*
* Calc is open software; you can redistribute it and/or modify it under
* the terms of the version 2.1 of the GNU Lesser General Public License
* as published by the Free Software Foundation.
*
* Calc is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
* Public License for more details.
*
* A copy of version 2.1 of the GNU Lesser General Public License is
* distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.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
* File existed as early as: 1994
*
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/
/*
* usage:
* longlong [bits]
*
* bits if empty or missing causes this prog to compute its length,
* if 0, this prog will output nothing
* otherwise this prog will assume it is the long long bit length
*
* Not all compilers support the long long type, so this may not compile
* on your system.
*
* This prog outputs several defines:
*
* HAVE_LONGLONG
* defined ==> ok to use long long
* undefined ==> do not use long long, even if they exist
*
* LONGLONG_BITS
* 0 ==> do not use long long, even if they exist
* != 0 ==> bits in an unsigned long long
*/
#include <stdio.h>
#include "have_stdlib.h"
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include "have_string.h"
#if defined(HAVE_STRING_H)
#include <string.h>
#endif
/*
* have the compiler try its hand with unsigned and signed long longs
*/
unsigned long long val = 0x1234567890123456ULL;
long long val2 = -1311768467284833366LL; /* -0x1234567890123456 */
int
main(int argc, char **argv)
{
int longlong_bits; /* bits in a long long, or <=0 => dont use */
char buf[BUFSIZ+1]; /* scan buffer */
/*
* parse args
*/
if (argc < 2) {
/* no arg means compute the length */
longlong_bits = sizeof(unsigned long long)*8;
} else if (strcmp(argv[1], "") == 0) {
/* empty arg means compute the length */
longlong_bits = sizeof(unsigned long long)*8;
} else {
longlong_bits = atoi(argv[1]);
}
/*
* length is preset, or 0 ==> do not use
*/
if (longlong_bits > 0) {
/*
* if size is longer than an unsigned long,
* and the negative 'long long' works, then use long long's
*/
if (longlong_bits > sizeof(unsigned long)*8 && val2 < 0) {
/* use long long length */
printf("#define HAVE_LONGLONG\n");
printf("#define LONGLONG_BITS %d /* yes */\n",
longlong_bits);
printf("\n/*\n");
printf(" * how should 64 bit values be formatted?\n");
printf(" *\n");
/* it is OK to get a printf format type warning here */
sprintf(buf, "%ld", val);
printf(" * sprintf \"%%ld\" of 0x1234567890123456ULL "
"is %s\n", buf);
printf(" *\n");
printf(" * if defined(L64_FORMAT), ok to use %%ld\n");
printf(" * if !defined(L64_FORMAT), use %%lld\n");
printf(" */\n");
if (strcmp(buf, "1311768467284833366") == 0) {
printf("#define L64_FORMAT\n");
} else {
printf("#undef L64_FORMAT\n");
}
/*
* We have no useful 64 bit values
*/
} else {
if (longlong_bits <= sizeof(unsigned long)*8) {
printf("/* long long size <= long size */\n");
} else {
printf("/* unsigned long long constants "
"don't work */\n");
}
printf("#undef HAVE_LONGLONG\n");
printf("#define LONGLONG_BITS 0\t/%s/\n", "* no *");
printf("#undef L64_FORMAT\n");
}
}
/* exit(0); */
return 0;
}

View File

@@ -1,7 +1,7 @@
/*
* matfunc - extended precision rational arithmetic matrix functions
*
* Copyright (C) 1999 David I. Bell
* Copyright (C) 1999-2004 David I. Bell
*
* 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.3 $
* @(#) $Id: matfunc.c,v 29.3 2004/02/23 07:55:54 chongo Exp $
* @(#) $Revision: 29.4 $
* @(#) $Id: matfunc.c,v 29.4 2004/02/23 14:04:01 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/matfunc.c,v $
*
* Under source code control: 1990/02/15 01:48:18

10
md5.c
View File

@@ -10,8 +10,8 @@
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* @(#) $Revision: 29.2 $
* @(#) $Id: md5.c,v 29.2 2004/02/23 07:58:06 chongo Exp $
* @(#) $Revision: 29.3 $
* @(#) $Id: md5.c,v 29.3 2004/08/03 12:28:29 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/md5.c,v $
*
* This file is not covered under version 2.1 of the GNU LGPL.
@@ -194,7 +194,7 @@ MD5Update(HASH *state, USB8 *inBuf, USB32 count)
#if CALC_BYTE_ORDER == BIG_ENDIAN
if (state->bytes) {
/* byte swap data into little endian order */
for (cnt=0; cnt < MD5_CHUNKWORDS; ++cnt) {
for (cnt=0; cnt < (int)MD5_CHUNKWORDS; ++cnt) {
SWAP_B8_IN_B32(md5Ctx->data + cnt,
md5Ctx->data + cnt);
}
@@ -255,7 +255,7 @@ MD5Final(HASH *state)
#if CALC_BYTE_ORDER == BIG_ENDIAN
if (state->bytes) {
data[count] = 0x80;
for (i=0; i < MD5_CHUNKWORDS; ++i) {
for (i=0; i < (int)MD5_CHUNKWORDS; ++i) {
SWAP_B8_IN_B32(md5Ctx->data + i,
md5Ctx->data + i);
}
@@ -400,7 +400,7 @@ MD5_chkpt(HASH *state)
#if CALC_BYTE_ORDER == BIG_ENDIAN
if (state->bytes) {
/* byte swap data into little endian order */
for (cnt=0; cnt < MD5_CHUNKWORDS; ++cnt) {
for (cnt=0; cnt < (int)MD5_CHUNKWORDS; ++cnt) {
SWAP_B8_IN_B32(dig->data + cnt,
dig->data + cnt);
}

6
obj.c
View File

@@ -1,7 +1,7 @@
/*
* obj - object handling primitives
*
* Copyright (C) 1999 David I. Bell
* Copyright (C) 1999-2004 David I. Bell
*
* 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.3 $
* @(#) $Id: obj.c,v 29.3 2004/02/23 09:13:15 chongo Exp $
* @(#) $Revision: 29.4 $
* @(#) $Id: obj.c,v 29.4 2004/02/23 14:04:01 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/obj.c,v $
*
* Under source code control: 1990/02/15 01:48:19

View File

@@ -1,7 +1,7 @@
/*
* opcodes - opcode execution module
*
* Copyright (C) 1999 David I. Bell and Ernest Bowen
* Copyright (C) 1999-2004 David I. Bell and Ernest Bowen
*
* Primary author: David I. Bell
*
@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.5 $
* @(#) $Id: opcodes.c,v 29.5 2004/02/23 07:34:08 chongo Exp $
* @(#) $Revision: 29.6 $
* @(#) $Id: opcodes.c,v 29.6 2004/02/23 14:04:01 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/opcodes.c,v $
*
* Under source code control: 1990/02/15 01:48:19

View File

@@ -1,7 +1,7 @@
/*
* qfunc - extended precision rational arithmetic non-primitive functions
*
* Copyright (C) 1999 David I. Bell and Ernest Bowen
* Copyright (C) 1999-2004 David I. Bell and Ernest Bowen
*
* Primary author: David I. Bell
*
@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.6 $
* @(#) $Id: qfunc.c,v 29.6 2004/02/23 07:59:46 chongo Exp $
* @(#) $Revision: 29.7 $
* @(#) $Id: qfunc.c,v 29.7 2004/02/23 14:04:01 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qfunc.c,v $
*
* Under source code control: 1990/02/15 01:48:20

6
qio.c
View File

@@ -1,7 +1,7 @@
/*
* qio - scanf and printf routines for arbitrary precision rational numbers
*
* Copyright (C) 1999-2002 David I. Bell
* Copyright (C) 1999-2004 David I. Bell
*
* 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.5 $
* @(#) $Id: qio.c,v 29.5 2004/02/23 09:10:59 chongo Exp $
* @(#) $Revision: 29.6 $
* @(#) $Id: qio.c,v 29.6 2004/02/23 14:04:01 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qio.c,v $
*
* Under source code control: 1993/07/30 19:42:46

View File

@@ -1,7 +1,7 @@
/*
* qmath - extended precision rational arithmetic primitive routines
*
* Copyright (C) 1999 David I. Bell and Ernest Bowen
* Copyright (C) 1999-2004 David I. Bell and Ernest Bowen
*
* Primary author: David I. Bell
*
@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.4 $
* @(#) $Id: qmath.c,v 29.4 2004/02/23 08:07:43 chongo Exp $
* @(#) $Revision: 29.5 $
* @(#) $Id: qmath.c,v 29.5 2004/02/23 14:04:01 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qmath.c,v $
*
* Under source code control: 1990/02/15 01:48:21

View File

@@ -1,7 +1,7 @@
/*
* qtrans - transcendental functions for real numbers
*
* Copyright (C) 1999 David I. Bell and Ernest Bowen
* Copyright (C) 1999-2004 David I. Bell and Ernest Bowen
*
* Primary author: David I. Bell
*
@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.4 $
* @(#) $Id: qtrans.c,v 29.4 2004/02/23 08:12:43 chongo Exp $
* @(#) $Revision: 29.6 $
* @(#) $Id: qtrans.c,v 29.6 2004/10/23 00:58:59 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qtrans.c,v $
*
* Under source code control: 1990/02/15 01:48:22
@@ -987,16 +987,20 @@ qln(NUMBER *q, NUMBER *epsilon)
}
zfree(pow);
zfree(mul);
qtmp = qalloc(); /* qtmp is to be 2^n * sum / 2^m */
k = zlowbit(sum);
qtmp = qalloc();
sum.sign = neg;
if (k) {
zshift(sum, -k, &qtmp->num);
zfree(sum);
if (k + n >= m) {
zshift(sum, n - m, &qtmp->num);
} else {
qtmp->num = sum;
if (k) {
zshift(sum, -k, &qtmp->num);
zfree(sum);
} else {
qtmp->num = sum;
}
zbitvalue(m - k - n, &qtmp->den);
}
zbitvalue(m - k - n, &qtmp->den);
res = qmappr(qtmp, epsilon, 24L);
qfree(qtmp);
return res;

View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.7 $
* @(#) $Id: quickhash.c,v 29.7 2003/03/01 01:21:12 chongo Exp $
* @(#) $Revision: 29.8 $
* @(#) $Id: quickhash.c,v 29.8 2004/02/25 23:55:38 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/quickhash.c,v $
*
* Under source code control: 1995/03/04 11:34:23
@@ -453,6 +453,14 @@ config_hash(CONFIG *cfg, QCKHASH val)
value = (((value>>5) | (value<<27)) ^ (USB32)cfg->ctrl_d);
/* program is handeled out of order */
/* basename is handeled out of order */
value = (((value>>5) | (value<<27)) ^ (USB32)cfg->windows);
value = (((value>>5) | (value<<27)) ^ (USB32)cfg->cygwin);
value = (((value>>5) | (value<<27)) ^ (USB32)cfg->compile_custom);
if (cfg->allow_custom != NULL && *(cfg->allow_custom)) {
value = (((value>>5) | (value<<27)) ^ (USB32)TRUE);
} else {
value = (((value>>5) | (value<<27)) ^ (USB32)FALSE);
}
/* version is handeled out of order */
/*
@@ -462,7 +470,7 @@ config_hash(CONFIG *cfg, QCKHASH val)
quasi_fnv(value, val);
/*
* hash the strings if possible
* hash the strings and pointers if possible
*/
if (cfg->prompt1) {
val = fnv_strhash(cfg->prompt1, val);

6
seed.c
View File

@@ -1,7 +1,7 @@
/*
* seed - produce a pseudo-random seeds
*
* Copyright (C) 1999 Landon Curt Noll
* Copyright (C) 1999-2004 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.6 $
* @(#) $Id: seed.c,v 29.6 2003/01/14 00:51:53 chongo Exp $
* @(#) $Revision: 29.7 $
* @(#) $Id: seed.c,v 29.7 2004/02/23 14:04:01 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/seed.c,v $
*
* Under source code control: 1999/10/03 10:06:53

View File

@@ -1,7 +1,7 @@
/*
* string - string list routines
*
* Copyright (C) 1999 David I. Bell and Ernest Bowen
* Copyright (C) 1999-2004 David I. Bell and Ernest Bowen
*
* Primary author: David I. Bell
*
@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.3 $
* @(#) $Id: string.c,v 29.3 2004/02/23 08:18:27 chongo Exp $
* @(#) $Revision: 29.4 $
* @(#) $Id: string.c,v 29.4 2004/02/23 14:04:01 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/string.c,v $
*
* Under source code control: 1990/02/15 01:48:10

View File

@@ -1,7 +1,7 @@
/*
* version - determine the version of calc
*
* Copyright (C) 1999-2003 David I. Bell and Landon Curt Noll
* Copyright (C) 1999-2004 David I. Bell and Landon Curt Noll
*
* Primary author: David I. Bell
*
@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.49 $
* @(#) $Id: version.c,v 29.49 2004/02/23 08:23:19 chongo Exp $
* @(#) $Revision: 29.54 $
* @(#) $Id: version.c,v 29.54 2004/10/23 01:16:23 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $
*
* Under source code control: 1990/05/22 11:00:58
@@ -47,8 +47,8 @@ static char *program;
#define MAJOR_VER 2 /* major version */
#define MINOR_VER 11 /* minor version */
#define MAJOR_PATCH 9 /* patch level or 0 if no patch */
#define MINOR_PATCH 0 /* test number or 0 if no minor patch */
#define MAJOR_PATCH 10 /* patch level or 0 if no patch */
#define MINOR_PATCH 1 /* test number or 0 if no minor patch */
/*

View File

@@ -2,7 +2,6 @@ TERMCONTROL=-DUSE_WIN32
HAVE_VSPRINTF=-UDONT_HAVE_VSPRINTF
BYTE_ORDER=-DLITTLE_ENDIAN
LONG_BITS=32
LONGLONG_BITS=0
HAVE_FPOS=-DHAVE_NO_FPOS
HAVE_FPOS_POS=-DHAVE_NO_FPOS_POS
FPOS_POS_BITS=-UFPOS_POS_BITS
@@ -24,7 +23,7 @@ HAVE_GETPRID=-DHAVE_NO_GETPRID
HAVE_URANDOM_H=NO
HAVE_GETRUSAGE=-DHAVE_NO_GETRUSAGE
HAVE_STRDUP=-UHAVE_NO_STRDUP
ALIGN32=-UMUST_ALIGN32
ALIGN32=-DMUST_ALIGN32
HAVE_MALLOC_H=YES
HAVE_STDLIB_H=YES
HAVE_STRING_H=YES
@@ -34,25 +33,28 @@ HAVE_TIME_H=YES
HAVE_SYS_TIME_H=NO
HAVE_UNISTD_H=NO
BINDIR=/usr/bin/calc
LIBDIR=/lib/calc
HELPDIR=/lib/calc/help
CALC_INCDIR=/include/calc
CUSTOMCALDIR=/lib/calc/custom
CUSTOMHELPDIR=/lib/calc/help/custhelp
SCRIPTDIR=/lib/calc/cscript
MANDIR=
CATDIR=
MANEXT=
CATEXT=
NROFF=
MANDIR=/usr/man/man1
CATDIR=/usr/man/cat1
MANEXT=1
CATEXT=1
NROFF=nroff
NROFF_ARG=
MANMAKE=
MANMODE=
CALCPATH=./cal
CALCRC='/lib/calc/startup:~/.calcrc:./.calcinit'
USE_READLINE=
USE_READLINE=-DUSE_READLINE
READLINE_LIB=
READLINE_INCLUDE=
CALCPAGER=
CALCPAGER=less.exe
EXT=.exe
ECHO=

View File

@@ -8,8 +8,8 @@
/* must we always align 32 bit accesses? */
/* forced to not require 32 bit alignment */
#undef MUST_ALIGN32
/* forced to align 32 bit values */
#define MUST_ALIGN32
#endif /* !__MUST_ALIGN32_H__ */

View File

@@ -29,7 +29,7 @@
/* the default pager to use */
#if !defined(DEFAULTCALCPAGER)
#define DEFAULTCALCPAGER ""
#define DEFAULTCALCPAGER "less.exe"
#endif /* DEFAULTCALCPAGER */
/* where the echo command is located */

View File

@@ -21,11 +21,14 @@ 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 */
#undef HAVE_B64
#define HAVE_B64 /* have USB64 and SB64 types */
typedef unsigned long long USB64; /* unsigned 64 bits */
typedef long long SB64; /* signed 64 bits */
/* 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!
/* how to form 64 bit constants */
#define U(x) x ## ULL
#define L(x) x ## LL
#endif /* !__LONGBITS_H__ */

View File

@@ -1,16 +0,0 @@
/*
* 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__ */

37
zmath.h
View File

@@ -1,7 +1,7 @@
/*
* zmath - declarations for extended precision integer arithmetic
*
* Copyright (C) 1999-2002 David I. Bell
* Copyright (C) 1999,2002,2004 David I. Bell
*
* 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.10 $
* @(#) $Id: zmath.h,v 29.10 2003/01/14 00:44:39 chongo Exp $
* @(#) $Revision: 29.12 $
* @(#) $Id: zmath.h,v 29.12 2004/03/31 04:58:40 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zmath.h,v $
*
* Under source code control: 1993/07/30 19:42:48
@@ -637,35 +637,4 @@ typedef struct {
} BITSTR;
/*
* HVAL(a,b) - form an array of HALFs given 8 hex digits
* a: up to 4 hex digits without the leading 0x (upper half)
* b: up to 4 hex digits without the leading 0x (lower half)
*
* NOTE: Due to a SunOS cc bug, don't put spaces in the HVAL call!
*/
#if FULL_BITS == 64
# if defined(FORCE_STDC) || (defined(__STDC__) && __STDC__ != 0) || defined(__cplusplus)
# define HVAL(a,b) (HALF)(0x ## a ## b)
# else
# define HVAL(a,b) (HALF)(0x/**/a/**/b)
# endif
#elif 2*FULL_BITS == 64
# if defined(FORCE_STDC) || (defined(__STDC__) && __STDC__ != 0) || defined(__cplusplus)
# define HVAL(a,b) (HALF)0x##b, (HALF)0x##a
# else
/* NOTE: Due to a SunOS cc bug, don't put spaces in the HVAL call! */
# define HVAL(a,b) (HALF)0x/**/b, (HALF)0x/**/a
# endif
#else
/\../\ FULL_BITS must be 32 or 64 /\../\ !!!
#endif
#endif /* !__ZMATH_H__*/

721
zrand.c
View File

@@ -1,7 +1,7 @@
/*
* zrand - subtractive 100 shuffle generator
*
* Copyright (C) 1999 Landon Curt Noll
* Copyright (C) 1999,2004 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.6 $
* @(#) $Id: zrand.c,v 29.6 2004/02/23 08:22:22 chongo Exp $
* @(#) $Revision: 29.9 $
* @(#) $Id: zrand.c,v 29.9 2004/03/31 04:58:40 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zrand.c,v $
*
* Under source code control: 1995/01/07 09:45:25
@@ -379,190 +379,375 @@ static CONST RAND init_s100 = {
INIT_J, /* j */
INIT_K, /* k */
RAND_CONSEQ_USE, /* use this many before skipping values */
/* NOTE: Due to a SunOS cc bug, don't put spaces in the SVAL call! */
#if FULL_BITS == SBITS
{ /* subtractive 100 table */
SVAL(c8c0370c,7db7dc19), SVAL(738e33b9,40a06fbb),
SVAL(481abb76,a859ed2b), SVAL(74106bb3,9ccdccb5),
SVAL(05a8eeb5,c3173bfc), SVAL(efd5100d,5a02e577),
SVAL(a69271f7,4030b24a), SVAL(641282fc,16fe22c5),
SVAL(7aa7267c,40438da3), SVAL(1fdf4abd,c2d878d1),
SVAL(d9899e7a,95702379), SVAL(5ea8e217,d02d7f08),
SVAL(770587fe,4d47a353), SVAL(de7d1bdd,0a33a2b8),
SVAL(4378c3c5,900e7c45), SVAL(77c94478,19a514f9),
SVAL(fc5edb22,843d1d32), SVAL(4fc42ce5,e8ee5e6e),
SVAL(c938713c,8488013e), SVAL(6a318f03,20ab0cac),
SVAL(73e6d1a3,ffc8bff3), SVAL(0cd3232a,8ca96aa7),
SVAL(605c8036,905f770d), SVAL(4d037b00,8b8d04a2),
SVAL(1ed81965,cb277294), SVAL(408d9c47,7a254ff3),
SVAL(8b68587a,e26c7377), SVAL(cff191a4,8a48832f),
SVAL(12d3df1d,8aeb6fe6), SVAL(b2bf907e,1feda37a),
SVAL(4e5f7719,3bb5f39f), SVAL(33ebcf6f,8f5d1581),
SVAL(203c8e48,d33654eb), SVAL(68d3656e,f19c8a4e),
SVAL(3ec20b04,986eb2af), SVAL(5d73a03b,062c3841),
SVAL(836ce709,5d4e49eb), SVAL(2310bc40,c3f49221),
SVAL(3868ee48,a6d0cbf6), SVAL(67578aa6,4a43deb1),
SVAL(6e3426c1,150dfc26), SVAL(c541ccaa,3131be30),
SVAL(f7e57432,cec7aab2), SVAL(2b35de99,8cb3c873),
SVAL(7b9f7764,8663a5d7), SVAL(23b00e6a,a771e5a6),
SVAL(859c775c,a9985d05), SVAL(99636ea1,6b692f1f),
SVAL(8700ac70,3730800d), SVAL(46142502,4298a753),
SVAL(ea4a411b,809e955f), SVAL(3119ad40,33709dfb),
SVAL(b76a6c6e,5f01cb7c), SVAL(6109dc8a,15984eaf),
SVAL(5d686db9,a5ca9505), SVAL(8e80d761,3b7e6add),
SVAL(79cbd718,de6f6fd3), SVAL(40e9cd15,1da0f699),
SVAL(e82158ba,b24f312d), SVAL(79a4c927,f5e5c36b),
SVAL(c25247c9,a0039333), SVAL(93687116,1766d81d),
SVAL(3c6a03b4,a6741327), SVAL(c8a7b6e8,c002f29a),
SVAL(0e2a67c6,7bbd5ea3), SVAL(0929042d,441eabc1),
SVAL(7dbe232a,25e82085), SVAL(8cfb26e5,44fbac3d),
SVAL(8e40384d,388ab983), SVAL(48dc1230,554632f8),
SVAL(ab405048,ab492397), SVAL(21c9e2f5,a118e387),
SVAL(484d1a8c,343b61b5), SVAL(d49e3dec,ab256f26),
SVAL(e615c7fd,78f2d2e3), SVAL(8442cc33,ce6cc2ed),
SVAL(0a3b93d8,44d4bbf6), SVAL(2d7e4efe,9301de77),
SVAL(33711b76,d8790d8a), SVAL(c07dc30e,44df77e7),
SVAL(b9132ed0,9ddd508f), SVAL(45d06cf8,c6fb43cc),
SVAL(22bed18a,d585dd7b), SVAL(61c6cced,10799ffa),
SVAL(d7f2393b,e4bd9aa9), SVAL(706753fb,cfd55094),
SVAL(f65a6713,ede6e446), SVAL(8bf6dfae,47c0d5c3),
SVAL(fb4dfc17,9f7927d6), SVAL(12ebbc16,e212c297),
SVAL(43c71283,a00a954c), SVAL(8957087a,e7bd40a5),
SVAL(b0859d71,08344837), SVAL(fbf4b9a3,aeb313f5),
SVAL(5e66e5be,ce81823a), SVAL(09a11c6e,58ad6da1),
SVAL(c76f4316,c608054f), SVAL(b5821361,46084099),
SVAL(4210008f,17a725ed), SVAL(e5ff8912,d347c481)
(FULL)U(0xc8c0370c7db7dc19), (FULL)U(0x738e33b940a06fbb),
(FULL)U(0x481abb76a859ed2b), (FULL)U(0x74106bb39ccdccb5),
(FULL)U(0x05a8eeb5c3173bfc), (FULL)U(0xefd5100d5a02e577),
(FULL)U(0xa69271f74030b24a), (FULL)U(0x641282fc16fe22c5),
(FULL)U(0x7aa7267c40438da3), (FULL)U(0x1fdf4abdc2d878d1),
(FULL)U(0xd9899e7a95702379), (FULL)U(0x5ea8e217d02d7f08),
(FULL)U(0x770587fe4d47a353), (FULL)U(0xde7d1bdd0a33a2b8),
(FULL)U(0x4378c3c5900e7c45), (FULL)U(0x77c9447819a514f9),
(FULL)U(0xfc5edb22843d1d32), (FULL)U(0x4fc42ce5e8ee5e6e),
(FULL)U(0xc938713c8488013e), (FULL)U(0x6a318f0320ab0cac),
(FULL)U(0x73e6d1a3ffc8bff3), (FULL)U(0x0cd3232a8ca96aa7),
(FULL)U(0x605c8036905f770d), (FULL)U(0x4d037b008b8d04a2),
(FULL)U(0x1ed81965cb277294), (FULL)U(0x408d9c477a254ff3),
(FULL)U(0x8b68587ae26c7377), (FULL)U(0xcff191a48a48832f),
(FULL)U(0x12d3df1d8aeb6fe6), (FULL)U(0xb2bf907e1feda37a),
(FULL)U(0x4e5f77193bb5f39f), (FULL)U(0x33ebcf6f8f5d1581),
(FULL)U(0x203c8e48d33654eb), (FULL)U(0x68d3656ef19c8a4e),
(FULL)U(0x3ec20b04986eb2af), (FULL)U(0x5d73a03b062c3841),
(FULL)U(0x836ce7095d4e49eb), (FULL)U(0x2310bc40c3f49221),
(FULL)U(0x3868ee48a6d0cbf6), (FULL)U(0x67578aa64a43deb1),
(FULL)U(0x6e3426c1150dfc26), (FULL)U(0xc541ccaa3131be30),
(FULL)U(0xf7e57432cec7aab2), (FULL)U(0x2b35de998cb3c873),
(FULL)U(0x7b9f77648663a5d7), (FULL)U(0x23b00e6aa771e5a6),
(FULL)U(0x859c775ca9985d05), (FULL)U(0x99636ea16b692f1f),
(FULL)U(0x8700ac703730800d), (FULL)U(0x461425024298a753),
(FULL)U(0xea4a411b809e955f), (FULL)U(0x3119ad4033709dfb),
(FULL)U(0xb76a6c6e5f01cb7c), (FULL)U(0x6109dc8a15984eaf),
(FULL)U(0x5d686db9a5ca9505), (FULL)U(0x8e80d7613b7e6add),
(FULL)U(0x79cbd718de6f6fd3), (FULL)U(0x40e9cd151da0f699),
(FULL)U(0xe82158bab24f312d), (FULL)U(0x79a4c927f5e5c36b),
(FULL)U(0xc25247c9a0039333), (FULL)U(0x936871161766d81d),
(FULL)U(0x3c6a03b4a6741327), (FULL)U(0xc8a7b6e8c002f29a),
(FULL)U(0x0e2a67c67bbd5ea3), (FULL)U(0x0929042d441eabc1),
(FULL)U(0x7dbe232a25e82085), (FULL)U(0x8cfb26e544fbac3d),
(FULL)U(0x8e40384d388ab983), (FULL)U(0x48dc1230554632f8),
(FULL)U(0xab405048ab492397), (FULL)U(0x21c9e2f5a118e387),
(FULL)U(0x484d1a8c343b61b5), (FULL)U(0xd49e3decab256f26),
(FULL)U(0xe615c7fd78f2d2e3), (FULL)U(0x8442cc33ce6cc2ed),
(FULL)U(0x0a3b93d844d4bbf6), (FULL)U(0x2d7e4efe9301de77),
(FULL)U(0x33711b76d8790d8a), (FULL)U(0xc07dc30e44df77e7),
(FULL)U(0xb9132ed09ddd508f), (FULL)U(0x45d06cf8c6fb43cc),
(FULL)U(0x22bed18ad585dd7b), (FULL)U(0x61c6cced10799ffa),
(FULL)U(0xd7f2393be4bd9aa9), (FULL)U(0x706753fbcfd55094),
(FULL)U(0xf65a6713ede6e446), (FULL)U(0x8bf6dfae47c0d5c3),
(FULL)U(0xfb4dfc179f7927d6), (FULL)U(0x12ebbc16e212c297),
(FULL)U(0x43c71283a00a954c), (FULL)U(0x8957087ae7bd40a5),
(FULL)U(0xb0859d7108344837), (FULL)U(0xfbf4b9a3aeb313f5),
(FULL)U(0x5e66e5bece81823a), (FULL)U(0x09a11c6e58ad6da1),
(FULL)U(0xc76f4316c608054f), (FULL)U(0xb582136146084099),
(FULL)U(0x4210008f17a725ed), (FULL)U(0xe5ff8912d347c481)
},
/* NOTE: Due to a SunOS cc bug, don't put spaces in the SVAL call! */
{ /* shuffle table */
SVAL(69a2296c,ec8abd57), SVAL(867e1869,99a6df81),
SVAL(c05ab96b,d849a48a), SVAL(7eb3ce0c,fa00554b),
SVAL(520d01f6,5a5a9acd), SVAL(d4ef1e33,36022d81),
SVAL(af44772b,c6f84f70), SVAL(647e85a6,a7c55173),
SVAL(26746cf1,959df8d1), SVAL(98681a90,4db28abd),
SVAL(b146c969,744c5cd2), SVAL(8ce69d1f,706f88c2),
SVAL(fd12eac4,21b4a748), SVAL(f12e70fe,2710eea5),
SVAL(0b8f7805,5901f2b5), SVAL(48860a76,4f2c115e),
SVAL(0edf6d2a,30767e2c), SVAL(8a6d7dc5,fce2713b),
SVAL(46a362ea,4e0e2346), SVAL(6c369a0a,359f5aa7),
SVAL(dfca81fe,41def54e), SVAL(4b733819,96c2bc4e),
SVAL(659e8b99,6f3f14f9), SVAL(8b97b934,93d47e6f),
SVAL(a73a8704,dfa10a55), SVAL(8d9eafe9,b06503da),
SVAL(2556fb88,f32336b0), SVAL(e71e9f75,1002a161),
SVAL(27a7be6e,200af907), SVAL(1b9b734e,d028e9a3),
SVAL(950cfeed,4c0be0d3), SVAL(f4c41694,2536d275),
SVAL(f05a58e8,5687b76e), SVAL(ba53ac01,71a62d54),
SVAL(4b14cbcb,285adc96), SVAL(fdf66edd,b00a5557),
SVAL(bb43d58d,185b6ea1), SVAL(905db9cd,f355c9a6),
SVAL(fc3a07fc,04429c8a), SVAL(65d7e365,aa3a4f7e),
SVAL(2d284c18,b243ac65), SVAL(72fba65d,44e417fd),
SVAL(422d50b4,5c934805), SVAL(b62a6053,d1587441),
SVAL(a5e71ce9,6f7ae035), SVAL(93abca2e,595c8dd8),
SVAL(534231af,e39afad5), SVAL(08d26cac,12eaad56),
SVAL(ec18bf8d,7fb1b1c2), SVAL(3d28ea16,faf6f09b),
SVAL(ea357a78,16697dd6), SVAL(51471ea1,420f3f51),
SVAL(5e051aeb,7f8946b4), SVAL(881be097,0cf0524c),
SVAL(d558b25b,1b31489e), SVAL(707d1a94,3a8b065c),
SVAL(37017e66,568ff836), SVAL(b9cd627c,24c2f747),
SVAL(1485549f,fb1d9ff6), SVAL(308d32d9,bdf2dc6f),
SVAL(4d4142ca,d543818a), SVAL(5d9c7aee,87ebba43),
SVAL(81c5bdd8,e17adb2f), SVAL(3dc9752e,c8d8677a),
SVAL(66b086e6,c34e4212), SVAL(3af7a90d,c62b25e3),
SVAL(f8349f79,35539315), SVAL(6bcfd9d5,a22917f0),
SVAL(8639bb76,5f5ee517), SVAL(d3c5e369,8095b092),
SVAL(8a33851e,7eb44748), SVAL(5e29d443,ea54bbcf),
SVAL(0f84651f,4d59a834), SVAL(85040bea,f1a5f951),
SVAL(3dba1c74,98002078), SVAL(5d70712b,f0b2cc15),
SVAL(fa3af8eb,cce8e5a7), SVAL(fb3e2237,04bba57d),
SVAL(5d3b8785,8a950434), SVAL(ce3112bd,ba3f8dcf),
SVAL(44904f55,860d3051), SVAL(cec8fed4,4ed3e98b),
SVAL(4581698d,25d01ea4), SVAL(11eb6828,9a9548e0),
SVAL(796cb4c6,e911fac8), SVAL(2164cf26,b5fd813e),
SVAL(4ac8e0f5,d5de640f), SVAL(e9e757d7,8802ab4e),
SVAL(3c97de26,f49dfcbd), SVAL(c604881b,6ee6dbe6),
SVAL(a7c22a6e,57d6154e), SVAL(234e2370,877b3cc7),
SVAL(c0bdb72b,df1f8358), SVAL(6522e0fc,a95b7b55),
SVAL(ba174c90,22344162), SVAL(712c9b2d,75d48867),
SVAL(240f7e92,e59f3700), SVAL(e83cc2d4,ad95d763),
SVAL(8509445a,4336d717), SVAL(f1e572c5,dfff1804),
SVAL(ed10eb5d,623232dd), SVAL(9205ea1b,d4f957e8),
SVAL(4973a54f,2ff062f5), SVAL(26b018f1,e8c48cd5),
SVAL(56908401,d1c7ed9f), SVAL(2e48937b,df89a247),
SVAL(9d53069b,2be47129), SVAL(98069e3b,c048a2b0),
SVAL(f25b7d65,1cd83f93), SVAL(2b004e6c,e6f886c8),
SVAL(f618442a,5c635935), SVAL(a502ab5c,7198e052),
SVAL(c14241a4,a6c41b0b), SVAL(720e845a,7db9b18e),
SVAL(2abb13e9,4b713918), SVAL(90fc0c20,7f52467d),
SVAL(799c8ccd,7868d348), SVAL(f4817ced,912a0ea4),
SVAL(d68c0f4c,c4903a57), SVAL(a3171f29,e2b7934c),
SVAL(b1158baa,0b4ccc22), SVAL(f5d85553,49a29eda),
SVAL(59d1a078,959442ef), SVAL(db9b4a96,a67fd518),
SVAL(cc7ca9ee,d2870636), SVAL(548f021c,ecf59920),
SVAL(25b7f4b6,571bc8c5), SVAL(4fa52747,3a44f536),
SVAL(b246845f,df0ebdc2), SVAL(dd8d68ae,42058793),
SVAL(3ba13328,9f6c39fb), SVAL(8bfdfbf3,7b6b42af),
SVAL(fb34c5ca,7fb2b3b0), SVAL(2345dcec,d428e32a),
SVAL(6891e850,ad42b63e), SVAL(930642c8,362c1381),
SVAL(13871e9b,1886aff5), SVAL(d0cf2407,482bda55),
SVAL(125b5fc9,5069bc31), SVAL(9b71d0a9,f07dfa5d),
SVAL(55c044cc,6712e524), SVAL(f0377358,bb601978),
SVAL(152ad5f8,7fa51e8b), SVAL(e5ebf478,9fcdd9af),
SVAL(3d78e18c,66ebce7e), SVAL(8246db72,f36aa83f),
SVAL(cc6ddc6d,2c64c0a3), SVAL(a758d687,0d91851e),
SVAL(24b20a6f,9488ee36), SVAL(be11ccdf,09798197),
SVAL(11aca015,99c1f4e3), SVAL(40e89e36,6437ac05),
SVAL(c8bfc762,5af675f8), SVAL(6367c578,b577e759),
SVAL(00380346,615f0b74), SVAL(ee964cc4,8de07d81),
SVAL(17f6ac16,859d9261), SVAL(092f4a17,3a6e2f6c),
SVAL(79981a3d,b9024b95), SVAL(36db1660,04f7f540),
SVAL(c36252cf,65a2f1c8), SVAL(705b6fde,124c9bd2),
SVAL(31e58dda,85db40ce), SVAL(6342b1a5,9f5e8d6d),
SVAL(5c2c67d0,bd6d1d4d), SVAL(1fe5b46f,ba7e069d),
SVAL(21c46c6c,ac72e13c), SVAL(b80c5fd5,9eb8f52a),
SVAL(56c3aebf,a74c92bc), SVAL(c1aff1fc,bf8c4196),
SVAL(2b1df645,754ad208), SVAL(5c734600,d46eeb50),
SVAL(e0ff1b12,6a70a765), SVAL(d5416497,7a94547c),
SVAL(67b59d7c,4ea35206), SVAL(53be7146,779203b4),
SVAL(6b589fe5,414026b8), SVAL(9e81016c,3083bfee),
SVAL(b23526b9,3b4b7671), SVAL(4fa9ffb1,7ee300ba),
SVAL(6217e212,ad05fb21), SVAL(f5b3fcd3,b294e6c2),
SVAL(ac040bbe,216beb2a), SVAL(1f8d8a54,71d0e78c),
SVAL(b6d15b41,9cfec96b), SVAL(c5477845,d0508c78),
SVAL(5b486e81,b4bba621), SVAL(90c35c94,ef4c4121),
SVAL(efce7346,f6a6bc55), SVAL(a27828d9,25bdb9bb),
SVAL(e3a53095,a1f0b205), SVAL(1bfa6093,d9f208ab),
SVAL(fb078f6a,6842cdf4), SVAL(07806d72,97133a38),
SVAL(2c6c901b,a3ce9592), SVAL(1f0ab2cf,ebc1b789),
SVAL(2ce81415,e2d03d5e), SVAL(7da45d5b,aa9f2417),
SVAL(3be4f76d,dd800682), SVAL(dbf4e4a3,364d72d3),
SVAL(b538cccf,4fc59da5), SVAL(b0aa39d5,487f66ec),
SVAL(2fd28dfd,87927d3d), SVAL(d14e77f0,5900c6b1),
SVAL(2523fad2,5330c7b4), SVAL(991b5938,d82368a4),
SVAL(b7c11443,2b9c1302), SVAL(db842db6,1394b116),
SVAL(3641548d,78ed26d8), SVAL(274fa8ef,0a61dacf),
SVAL(a554ba63,112df6f1), SVAL(7b7fe985,6b50438d),
SVAL(c9fa0042,bb63bbad), SVAL(3abf45d0,e27f00da),
SVAL(d95faa15,9f87aabb), SVAL(4a95012e,3488e7ae),
SVAL(1be2bdb9,0c642d04), SVAL(145c8881,8b4abf3e),
SVAL(7f9fb635,544cf17f), SVAL(b8ab2f62,cc78db70),
SVAL(8ee64bcd,b4242f9a), SVAL(abd52858,95dad129),
SVAL(be722c2f,ccf31141), SVAL(7c330703,575e26a9),
SVAL(45d3e3b3,361b79e4), SVAL(241163a7,54b2e6a6),
SVAL(8f678d7d,f7cacb77), SVAL(988a68a4,83211d19),
SVAL(79599598,ba7836f6), SVAL(4850c887,eeda68bf),
SVAL(afa69a71,8052ce25), SVAL(8b21efc6,bdd73573),
SVAL(89dbae18,d0972493), SVAL(560776bf,537d9454),
SVAL(3c009f78,165310f2), SVAL(a3680021,0160c3af),
SVAL(3353ec3c,a643bd40), SVAL(7e593f99,911dab02),
SVAL(72d1ddd9,4f676e89), SVAL(fd18b8bd,6b43c0ea),
SVAL(43cacef2,ddbd697d), SVAL(2868a4d0,acefe884),
SVAL(5f377b63,a506f013), SVAL(eaa0975e,05ca662b),
SVAL(3740e6b8,eb433931), SVAL(ce85df00,08557948),
SVAL(784745fb,547e33f9), SVAL(4a1fc5d4,e5c6f598),
SVAL(85fa6fec,768430a7), SVAL(990d0c24,d2332a51),
SVAL(55245c2c,33b676d5), SVAL(b1091519,e2bcfa71),
SVAL(38521478,d23a28d8), SVAL(9b794f89,9a573010),
SVAL(61d225e8,699bb486), SVAL(21476d24,1c2158b0)
(FULL)U(0x69a2296cec8abd57), (FULL)U(0x867e186999a6df81),
(FULL)U(0xc05ab96bd849a48a), (FULL)U(0x7eb3ce0cfa00554b),
(FULL)U(0x520d01f65a5a9acd), (FULL)U(0xd4ef1e3336022d81),
(FULL)U(0xaf44772bc6f84f70), (FULL)U(0x647e85a6a7c55173),
(FULL)U(0x26746cf1959df8d1), (FULL)U(0x98681a904db28abd),
(FULL)U(0xb146c969744c5cd2), (FULL)U(0x8ce69d1f706f88c2),
(FULL)U(0xfd12eac421b4a748), (FULL)U(0xf12e70fe2710eea5),
(FULL)U(0x0b8f78055901f2b5), (FULL)U(0x48860a764f2c115e),
(FULL)U(0x0edf6d2a30767e2c), (FULL)U(0x8a6d7dc5fce2713b),
(FULL)U(0x46a362ea4e0e2346), (FULL)U(0x6c369a0a359f5aa7),
(FULL)U(0xdfca81fe41def54e), (FULL)U(0x4b73381996c2bc4e),
(FULL)U(0x659e8b996f3f14f9), (FULL)U(0x8b97b93493d47e6f),
(FULL)U(0xa73a8704dfa10a55), (FULL)U(0x8d9eafe9b06503da),
(FULL)U(0x2556fb88f32336b0), (FULL)U(0xe71e9f751002a161),
(FULL)U(0x27a7be6e200af907), (FULL)U(0x1b9b734ed028e9a3),
(FULL)U(0x950cfeed4c0be0d3), (FULL)U(0xf4c416942536d275),
(FULL)U(0xf05a58e85687b76e), (FULL)U(0xba53ac0171a62d54),
(FULL)U(0x4b14cbcb285adc96), (FULL)U(0xfdf66eddb00a5557),
(FULL)U(0xbb43d58d185b6ea1), (FULL)U(0x905db9cdf355c9a6),
(FULL)U(0xfc3a07fc04429c8a), (FULL)U(0x65d7e365aa3a4f7e),
(FULL)U(0x2d284c18b243ac65), (FULL)U(0x72fba65d44e417fd),
(FULL)U(0x422d50b45c934805), (FULL)U(0xb62a6053d1587441),
(FULL)U(0xa5e71ce96f7ae035), (FULL)U(0x93abca2e595c8dd8),
(FULL)U(0x534231afe39afad5), (FULL)U(0x08d26cac12eaad56),
(FULL)U(0xec18bf8d7fb1b1c2), (FULL)U(0x3d28ea16faf6f09b),
(FULL)U(0xea357a7816697dd6), (FULL)U(0x51471ea1420f3f51),
(FULL)U(0x5e051aeb7f8946b4), (FULL)U(0x881be0970cf0524c),
(FULL)U(0xd558b25b1b31489e), (FULL)U(0x707d1a943a8b065c),
(FULL)U(0x37017e66568ff836), (FULL)U(0xb9cd627c24c2f747),
(FULL)U(0x1485549ffb1d9ff6), (FULL)U(0x308d32d9bdf2dc6f),
(FULL)U(0x4d4142cad543818a), (FULL)U(0x5d9c7aee87ebba43),
(FULL)U(0x81c5bdd8e17adb2f), (FULL)U(0x3dc9752ec8d8677a),
(FULL)U(0x66b086e6c34e4212), (FULL)U(0x3af7a90dc62b25e3),
(FULL)U(0xf8349f7935539315), (FULL)U(0x6bcfd9d5a22917f0),
(FULL)U(0x8639bb765f5ee517), (FULL)U(0xd3c5e3698095b092),
(FULL)U(0x8a33851e7eb44748), (FULL)U(0x5e29d443ea54bbcf),
(FULL)U(0x0f84651f4d59a834), (FULL)U(0x85040beaf1a5f951),
(FULL)U(0x3dba1c7498002078), (FULL)U(0x5d70712bf0b2cc15),
(FULL)U(0xfa3af8ebcce8e5a7), (FULL)U(0xfb3e223704bba57d),
(FULL)U(0x5d3b87858a950434), (FULL)U(0xce3112bdba3f8dcf),
(FULL)U(0x44904f55860d3051), (FULL)U(0xcec8fed44ed3e98b),
(FULL)U(0x4581698d25d01ea4), (FULL)U(0x11eb68289a9548e0),
(FULL)U(0x796cb4c6e911fac8), (FULL)U(0x2164cf26b5fd813e),
(FULL)U(0x4ac8e0f5d5de640f), (FULL)U(0xe9e757d78802ab4e),
(FULL)U(0x3c97de26f49dfcbd), (FULL)U(0xc604881b6ee6dbe6),
(FULL)U(0xa7c22a6e57d6154e), (FULL)U(0x234e2370877b3cc7),
(FULL)U(0xc0bdb72bdf1f8358), (FULL)U(0x6522e0fca95b7b55),
(FULL)U(0xba174c9022344162), (FULL)U(0x712c9b2d75d48867),
(FULL)U(0x240f7e92e59f3700), (FULL)U(0xe83cc2d4ad95d763),
(FULL)U(0x8509445a4336d717), (FULL)U(0xf1e572c5dfff1804),
(FULL)U(0xed10eb5d623232dd), (FULL)U(0x9205ea1bd4f957e8),
(FULL)U(0x4973a54f2ff062f5), (FULL)U(0x26b018f1e8c48cd5),
(FULL)U(0x56908401d1c7ed9f), (FULL)U(0x2e48937bdf89a247),
(FULL)U(0x9d53069b2be47129), (FULL)U(0x98069e3bc048a2b0),
(FULL)U(0xf25b7d651cd83f93), (FULL)U(0x2b004e6ce6f886c8),
(FULL)U(0xf618442a5c635935), (FULL)U(0xa502ab5c7198e052),
(FULL)U(0xc14241a4a6c41b0b), (FULL)U(0x720e845a7db9b18e),
(FULL)U(0x2abb13e94b713918), (FULL)U(0x90fc0c207f52467d),
(FULL)U(0x799c8ccd7868d348), (FULL)U(0xf4817ced912a0ea4),
(FULL)U(0xd68c0f4cc4903a57), (FULL)U(0xa3171f29e2b7934c),
(FULL)U(0xb1158baa0b4ccc22), (FULL)U(0xf5d8555349a29eda),
(FULL)U(0x59d1a078959442ef), (FULL)U(0xdb9b4a96a67fd518),
(FULL)U(0xcc7ca9eed2870636), (FULL)U(0x548f021cecf59920),
(FULL)U(0x25b7f4b6571bc8c5), (FULL)U(0x4fa527473a44f536),
(FULL)U(0xb246845fdf0ebdc2), (FULL)U(0xdd8d68ae42058793),
(FULL)U(0x3ba133289f6c39fb), (FULL)U(0x8bfdfbf37b6b42af),
(FULL)U(0xfb34c5ca7fb2b3b0), (FULL)U(0x2345dcecd428e32a),
(FULL)U(0x6891e850ad42b63e), (FULL)U(0x930642c8362c1381),
(FULL)U(0x13871e9b1886aff5), (FULL)U(0xd0cf2407482bda55),
(FULL)U(0x125b5fc95069bc31), (FULL)U(0x9b71d0a9f07dfa5d),
(FULL)U(0x55c044cc6712e524), (FULL)U(0xf0377358bb601978),
(FULL)U(0x152ad5f87fa51e8b), (FULL)U(0xe5ebf4789fcdd9af),
(FULL)U(0x3d78e18c66ebce7e), (FULL)U(0x8246db72f36aa83f),
(FULL)U(0xcc6ddc6d2c64c0a3), (FULL)U(0xa758d6870d91851e),
(FULL)U(0x24b20a6f9488ee36), (FULL)U(0xbe11ccdf09798197),
(FULL)U(0x11aca01599c1f4e3), (FULL)U(0x40e89e366437ac05),
(FULL)U(0xc8bfc7625af675f8), (FULL)U(0x6367c578b577e759),
(FULL)U(0x00380346615f0b74), (FULL)U(0xee964cc48de07d81),
(FULL)U(0x17f6ac16859d9261), (FULL)U(0x092f4a173a6e2f6c),
(FULL)U(0x79981a3db9024b95), (FULL)U(0x36db166004f7f540),
(FULL)U(0xc36252cf65a2f1c8), (FULL)U(0x705b6fde124c9bd2),
(FULL)U(0x31e58dda85db40ce), (FULL)U(0x6342b1a59f5e8d6d),
(FULL)U(0x5c2c67d0bd6d1d4d), (FULL)U(0x1fe5b46fba7e069d),
(FULL)U(0x21c46c6cac72e13c), (FULL)U(0xb80c5fd59eb8f52a),
(FULL)U(0x56c3aebfa74c92bc), (FULL)U(0xc1aff1fcbf8c4196),
(FULL)U(0x2b1df645754ad208), (FULL)U(0x5c734600d46eeb50),
(FULL)U(0xe0ff1b126a70a765), (FULL)U(0xd54164977a94547c),
(FULL)U(0x67b59d7c4ea35206), (FULL)U(0x53be7146779203b4),
(FULL)U(0x6b589fe5414026b8), (FULL)U(0x9e81016c3083bfee),
(FULL)U(0xb23526b93b4b7671), (FULL)U(0x4fa9ffb17ee300ba),
(FULL)U(0x6217e212ad05fb21), (FULL)U(0xf5b3fcd3b294e6c2),
(FULL)U(0xac040bbe216beb2a), (FULL)U(0x1f8d8a5471d0e78c),
(FULL)U(0xb6d15b419cfec96b), (FULL)U(0xc5477845d0508c78),
(FULL)U(0x5b486e81b4bba621), (FULL)U(0x90c35c94ef4c4121),
(FULL)U(0xefce7346f6a6bc55), (FULL)U(0xa27828d925bdb9bb),
(FULL)U(0xe3a53095a1f0b205), (FULL)U(0x1bfa6093d9f208ab),
(FULL)U(0xfb078f6a6842cdf4), (FULL)U(0x07806d7297133a38),
(FULL)U(0x2c6c901ba3ce9592), (FULL)U(0x1f0ab2cfebc1b789),
(FULL)U(0x2ce81415e2d03d5e), (FULL)U(0x7da45d5baa9f2417),
(FULL)U(0x3be4f76ddd800682), (FULL)U(0xdbf4e4a3364d72d3),
(FULL)U(0xb538cccf4fc59da5), (FULL)U(0xb0aa39d5487f66ec),
(FULL)U(0x2fd28dfd87927d3d), (FULL)U(0xd14e77f05900c6b1),
(FULL)U(0x2523fad25330c7b4), (FULL)U(0x991b5938d82368a4),
(FULL)U(0xb7c114432b9c1302), (FULL)U(0xdb842db61394b116),
(FULL)U(0x3641548d78ed26d8), (FULL)U(0x274fa8ef0a61dacf),
(FULL)U(0xa554ba63112df6f1), (FULL)U(0x7b7fe9856b50438d),
(FULL)U(0xc9fa0042bb63bbad), (FULL)U(0x3abf45d0e27f00da),
(FULL)U(0xd95faa159f87aabb), (FULL)U(0x4a95012e3488e7ae),
(FULL)U(0x1be2bdb90c642d04), (FULL)U(0x145c88818b4abf3e),
(FULL)U(0x7f9fb635544cf17f), (FULL)U(0xb8ab2f62cc78db70),
(FULL)U(0x8ee64bcdb4242f9a), (FULL)U(0xabd5285895dad129),
(FULL)U(0xbe722c2fccf31141), (FULL)U(0x7c330703575e26a9),
(FULL)U(0x45d3e3b3361b79e4), (FULL)U(0x241163a754b2e6a6),
(FULL)U(0x8f678d7df7cacb77), (FULL)U(0x988a68a483211d19),
(FULL)U(0x79599598ba7836f6), (FULL)U(0x4850c887eeda68bf),
(FULL)U(0xafa69a718052ce25), (FULL)U(0x8b21efc6bdd73573),
(FULL)U(0x89dbae18d0972493), (FULL)U(0x560776bf537d9454),
(FULL)U(0x3c009f78165310f2), (FULL)U(0xa36800210160c3af),
(FULL)U(0x3353ec3ca643bd40), (FULL)U(0x7e593f99911dab02),
(FULL)U(0x72d1ddd94f676e89), (FULL)U(0xfd18b8bd6b43c0ea),
(FULL)U(0x43cacef2ddbd697d), (FULL)U(0x2868a4d0acefe884),
(FULL)U(0x5f377b63a506f013), (FULL)U(0xeaa0975e05ca662b),
(FULL)U(0x3740e6b8eb433931), (FULL)U(0xce85df0008557948),
(FULL)U(0x784745fb547e33f9), (FULL)U(0x4a1fc5d4e5c6f598),
(FULL)U(0x85fa6fec768430a7), (FULL)U(0x990d0c24d2332a51),
(FULL)U(0x55245c2c33b676d5), (FULL)U(0xb1091519e2bcfa71),
(FULL)U(0x38521478d23a28d8), (FULL)U(0x9b794f899a573010),
(FULL)U(0x61d225e8699bb486), (FULL)U(0x21476d241c2158b0)
}
#elif 2*FULL_BITS == SBITS
{ /* subtractive 100 table */
(FULL)0x7db7dc19,(FULL)0xc8c0370c,(FULL)0x40a06fbb,(FULL)0x738e33b9,
(FULL)0xa859ed2b,(FULL)0x481abb76,(FULL)0x9ccdccb5,(FULL)0x74106bb3,
(FULL)0xc3173bfc,(FULL)0x05a8eeb5,(FULL)0x5a02e577,(FULL)0xefd5100d,
(FULL)0x4030b24a,(FULL)0xa69271f7,(FULL)0x16fe22c5,(FULL)0x641282fc,
(FULL)0x40438da3,(FULL)0x7aa7267c,(FULL)0xc2d878d1,(FULL)0x1fdf4abd,
(FULL)0x95702379,(FULL)0xd9899e7a,(FULL)0xd02d7f08,(FULL)0x5ea8e217,
(FULL)0x4d47a353,(FULL)0x770587fe,(FULL)0x0a33a2b8,(FULL)0xde7d1bdd,
(FULL)0x900e7c45,(FULL)0x4378c3c5,(FULL)0x19a514f9,(FULL)0x77c94478,
(FULL)0x843d1d32,(FULL)0xfc5edb22,(FULL)0xe8ee5e6e,(FULL)0x4fc42ce5,
(FULL)0x8488013e,(FULL)0xc938713c,(FULL)0x20ab0cac,(FULL)0x6a318f03,
(FULL)0xffc8bff3,(FULL)0x73e6d1a3,(FULL)0x8ca96aa7,(FULL)0x0cd3232a,
(FULL)0x905f770d,(FULL)0x605c8036,(FULL)0x8b8d04a2,(FULL)0x4d037b00,
(FULL)0xcb277294,(FULL)0x1ed81965,(FULL)0x7a254ff3,(FULL)0x408d9c47,
(FULL)0xe26c7377,(FULL)0x8b68587a,(FULL)0x8a48832f,(FULL)0xcff191a4,
(FULL)0x8aeb6fe6,(FULL)0x12d3df1d,(FULL)0x1feda37a,(FULL)0xb2bf907e,
(FULL)0x3bb5f39f,(FULL)0x4e5f7719,(FULL)0x8f5d1581,(FULL)0x33ebcf6f,
(FULL)0xd33654eb,(FULL)0x203c8e48,(FULL)0xf19c8a4e,(FULL)0x68d3656e,
(FULL)0x986eb2af,(FULL)0x3ec20b04,(FULL)0x062c3841,(FULL)0x5d73a03b,
(FULL)0x5d4e49eb,(FULL)0x836ce709,(FULL)0xc3f49221,(FULL)0x2310bc40,
(FULL)0xa6d0cbf6,(FULL)0x3868ee48,(FULL)0x4a43deb1,(FULL)0x67578aa6,
(FULL)0x150dfc26,(FULL)0x6e3426c1,(FULL)0x3131be30,(FULL)0xc541ccaa,
(FULL)0xcec7aab2,(FULL)0xf7e57432,(FULL)0x8cb3c873,(FULL)0x2b35de99,
(FULL)0x8663a5d7,(FULL)0x7b9f7764,(FULL)0xa771e5a6,(FULL)0x23b00e6a,
(FULL)0xa9985d05,(FULL)0x859c775c,(FULL)0x6b692f1f,(FULL)0x99636ea1,
(FULL)0x3730800d,(FULL)0x8700ac70,(FULL)0x4298a753,(FULL)0x46142502,
(FULL)0x809e955f,(FULL)0xea4a411b,(FULL)0x33709dfb,(FULL)0x3119ad40,
(FULL)0x5f01cb7c,(FULL)0xb76a6c6e,(FULL)0x15984eaf,(FULL)0x6109dc8a,
(FULL)0xa5ca9505,(FULL)0x5d686db9,(FULL)0x3b7e6add,(FULL)0x8e80d761,
(FULL)0xde6f6fd3,(FULL)0x79cbd718,(FULL)0x1da0f699,(FULL)0x40e9cd15,
(FULL)0xb24f312d,(FULL)0xe82158ba,(FULL)0xf5e5c36b,(FULL)0x79a4c927,
(FULL)0xa0039333,(FULL)0xc25247c9,(FULL)0x1766d81d,(FULL)0x93687116,
(FULL)0xa6741327,(FULL)0x3c6a03b4,(FULL)0xc002f29a,(FULL)0xc8a7b6e8,
(FULL)0x7bbd5ea3,(FULL)0x0e2a67c6,(FULL)0x441eabc1,(FULL)0x0929042d,
(FULL)0x25e82085,(FULL)0x7dbe232a,(FULL)0x44fbac3d,(FULL)0x8cfb26e5,
(FULL)0x388ab983,(FULL)0x8e40384d,(FULL)0x554632f8,(FULL)0x48dc1230,
(FULL)0xab492397,(FULL)0xab405048,(FULL)0xa118e387,(FULL)0x21c9e2f5,
(FULL)0x343b61b5,(FULL)0x484d1a8c,(FULL)0xab256f26,(FULL)0xd49e3dec,
(FULL)0x78f2d2e3,(FULL)0xe615c7fd,(FULL)0xce6cc2ed,(FULL)0x8442cc33,
(FULL)0x44d4bbf6,(FULL)0x0a3b93d8,(FULL)0x9301de77,(FULL)0x2d7e4efe,
(FULL)0xd8790d8a,(FULL)0x33711b76,(FULL)0x44df77e7,(FULL)0xc07dc30e,
(FULL)0x9ddd508f,(FULL)0xb9132ed0,(FULL)0xc6fb43cc,(FULL)0x45d06cf8,
(FULL)0xd585dd7b,(FULL)0x22bed18a,(FULL)0x10799ffa,(FULL)0x61c6cced,
(FULL)0xe4bd9aa9,(FULL)0xd7f2393b,(FULL)0xcfd55094,(FULL)0x706753fb,
(FULL)0xede6e446,(FULL)0xf65a6713,(FULL)0x47c0d5c3,(FULL)0x8bf6dfae,
(FULL)0x9f7927d6,(FULL)0xfb4dfc17,(FULL)0xe212c297,(FULL)0x12ebbc16,
(FULL)0xa00a954c,(FULL)0x43c71283,(FULL)0xe7bd40a5,(FULL)0x8957087a,
(FULL)0x08344837,(FULL)0xb0859d71,(FULL)0xaeb313f5,(FULL)0xfbf4b9a3,
(FULL)0xce81823a,(FULL)0x5e66e5be,(FULL)0x58ad6da1,(FULL)0x09a11c6e,
(FULL)0xc608054f,(FULL)0xc76f4316,(FULL)0x46084099,(FULL)0xb5821361,
(FULL)0x17a725ed,(FULL)0x4210008f,(FULL)0xd347c481,(FULL)0xe5ff8912
},
{ /* shuffle table */
(FULL)0xec8abd57,(FULL)0x69a2296c,(FULL)0x99a6df81,(FULL)0x867e1869,
(FULL)0xd849a48a,(FULL)0xc05ab96b,(FULL)0xfa00554b,(FULL)0x7eb3ce0c,
(FULL)0x5a5a9acd,(FULL)0x520d01f6,(FULL)0x36022d81,(FULL)0xd4ef1e33,
(FULL)0xc6f84f70,(FULL)0xaf44772b,(FULL)0xa7c55173,(FULL)0x647e85a6,
(FULL)0x959df8d1,(FULL)0x26746cf1,(FULL)0x4db28abd,(FULL)0x98681a90,
(FULL)0x744c5cd2,(FULL)0xb146c969,(FULL)0x706f88c2,(FULL)0x8ce69d1f,
(FULL)0x21b4a748,(FULL)0xfd12eac4,(FULL)0x2710eea5,(FULL)0xf12e70fe,
(FULL)0x5901f2b5,(FULL)0x0b8f7805,(FULL)0x4f2c115e,(FULL)0x48860a76,
(FULL)0x30767e2c,(FULL)0x0edf6d2a,(FULL)0xfce2713b,(FULL)0x8a6d7dc5,
(FULL)0x4e0e2346,(FULL)0x46a362ea,(FULL)0x359f5aa7,(FULL)0x6c369a0a,
(FULL)0x41def54e,(FULL)0xdfca81fe,(FULL)0x96c2bc4e,(FULL)0x4b733819,
(FULL)0x6f3f14f9,(FULL)0x659e8b99,(FULL)0x93d47e6f,(FULL)0x8b97b934,
(FULL)0xdfa10a55,(FULL)0xa73a8704,(FULL)0xb06503da,(FULL)0x8d9eafe9,
(FULL)0xf32336b0,(FULL)0x2556fb88,(FULL)0x1002a161,(FULL)0xe71e9f75,
(FULL)0x200af907,(FULL)0x27a7be6e,(FULL)0xd028e9a3,(FULL)0x1b9b734e,
(FULL)0x4c0be0d3,(FULL)0x950cfeed,(FULL)0x2536d275,(FULL)0xf4c41694,
(FULL)0x5687b76e,(FULL)0xf05a58e8,(FULL)0x71a62d54,(FULL)0xba53ac01,
(FULL)0x285adc96,(FULL)0x4b14cbcb,(FULL)0xb00a5557,(FULL)0xfdf66edd,
(FULL)0x185b6ea1,(FULL)0xbb43d58d,(FULL)0xf355c9a6,(FULL)0x905db9cd,
(FULL)0x04429c8a,(FULL)0xfc3a07fc,(FULL)0xaa3a4f7e,(FULL)0x65d7e365,
(FULL)0xb243ac65,(FULL)0x2d284c18,(FULL)0x44e417fd,(FULL)0x72fba65d,
(FULL)0x5c934805,(FULL)0x422d50b4,(FULL)0xd1587441,(FULL)0xb62a6053,
(FULL)0x6f7ae035,(FULL)0xa5e71ce9,(FULL)0x595c8dd8,(FULL)0x93abca2e,
(FULL)0xe39afad5,(FULL)0x534231af,(FULL)0x12eaad56,(FULL)0x08d26cac,
(FULL)0x7fb1b1c2,(FULL)0xec18bf8d,(FULL)0xfaf6f09b,(FULL)0x3d28ea16,
(FULL)0x16697dd6,(FULL)0xea357a78,(FULL)0x420f3f51,(FULL)0x51471ea1,
(FULL)0x7f8946b4,(FULL)0x5e051aeb,(FULL)0x0cf0524c,(FULL)0x881be097,
(FULL)0x1b31489e,(FULL)0xd558b25b,(FULL)0x3a8b065c,(FULL)0x707d1a94,
(FULL)0x568ff836,(FULL)0x37017e66,(FULL)0x24c2f747,(FULL)0xb9cd627c,
(FULL)0xfb1d9ff6,(FULL)0x1485549f,(FULL)0xbdf2dc6f,(FULL)0x308d32d9,
(FULL)0xd543818a,(FULL)0x4d4142ca,(FULL)0x87ebba43,(FULL)0x5d9c7aee,
(FULL)0xe17adb2f,(FULL)0x81c5bdd8,(FULL)0xc8d8677a,(FULL)0x3dc9752e,
(FULL)0xc34e4212,(FULL)0x66b086e6,(FULL)0xc62b25e3,(FULL)0x3af7a90d,
(FULL)0x35539315,(FULL)0xf8349f79,(FULL)0xa22917f0,(FULL)0x6bcfd9d5,
(FULL)0x5f5ee517,(FULL)0x8639bb76,(FULL)0x8095b092,(FULL)0xd3c5e369,
(FULL)0x7eb44748,(FULL)0x8a33851e,(FULL)0xea54bbcf,(FULL)0x5e29d443,
(FULL)0x4d59a834,(FULL)0x0f84651f,(FULL)0xf1a5f951,(FULL)0x85040bea,
(FULL)0x98002078,(FULL)0x3dba1c74,(FULL)0xf0b2cc15,(FULL)0x5d70712b,
(FULL)0xcce8e5a7,(FULL)0xfa3af8eb,(FULL)0x04bba57d,(FULL)0xfb3e2237,
(FULL)0x8a950434,(FULL)0x5d3b8785,(FULL)0xba3f8dcf,(FULL)0xce3112bd,
(FULL)0x860d3051,(FULL)0x44904f55,(FULL)0x4ed3e98b,(FULL)0xcec8fed4,
(FULL)0x25d01ea4,(FULL)0x4581698d,(FULL)0x9a9548e0,(FULL)0x11eb6828,
(FULL)0xe911fac8,(FULL)0x796cb4c6,(FULL)0xb5fd813e,(FULL)0x2164cf26,
(FULL)0xd5de640f,(FULL)0x4ac8e0f5,(FULL)0x8802ab4e,(FULL)0xe9e757d7,
(FULL)0xf49dfcbd,(FULL)0x3c97de26,(FULL)0x6ee6dbe6,(FULL)0xc604881b,
(FULL)0x57d6154e,(FULL)0xa7c22a6e,(FULL)0x877b3cc7,(FULL)0x234e2370,
(FULL)0xdf1f8358,(FULL)0xc0bdb72b,(FULL)0xa95b7b55,(FULL)0x6522e0fc,
(FULL)0x22344162,(FULL)0xba174c90,(FULL)0x75d48867,(FULL)0x712c9b2d,
(FULL)0xe59f3700,(FULL)0x240f7e92,(FULL)0xad95d763,(FULL)0xe83cc2d4,
(FULL)0x4336d717,(FULL)0x8509445a,(FULL)0xdfff1804,(FULL)0xf1e572c5,
(FULL)0x623232dd,(FULL)0xed10eb5d,(FULL)0xd4f957e8,(FULL)0x9205ea1b,
(FULL)0x2ff062f5,(FULL)0x4973a54f,(FULL)0xe8c48cd5,(FULL)0x26b018f1,
(FULL)0xd1c7ed9f,(FULL)0x56908401,(FULL)0xdf89a247,(FULL)0x2e48937b,
(FULL)0x2be47129,(FULL)0x9d53069b,(FULL)0xc048a2b0,(FULL)0x98069e3b,
(FULL)0x1cd83f93,(FULL)0xf25b7d65,(FULL)0xe6f886c8,(FULL)0x2b004e6c,
(FULL)0x5c635935,(FULL)0xf618442a,(FULL)0x7198e052,(FULL)0xa502ab5c,
(FULL)0xa6c41b0b,(FULL)0xc14241a4,(FULL)0x7db9b18e,(FULL)0x720e845a,
(FULL)0x4b713918,(FULL)0x2abb13e9,(FULL)0x7f52467d,(FULL)0x90fc0c20,
(FULL)0x7868d348,(FULL)0x799c8ccd,(FULL)0x912a0ea4,(FULL)0xf4817ced,
(FULL)0xc4903a57,(FULL)0xd68c0f4c,(FULL)0xe2b7934c,(FULL)0xa3171f29,
(FULL)0x0b4ccc22,(FULL)0xb1158baa,(FULL)0x49a29eda,(FULL)0xf5d85553,
(FULL)0x959442ef,(FULL)0x59d1a078,(FULL)0xa67fd518,(FULL)0xdb9b4a96,
(FULL)0xd2870636,(FULL)0xcc7ca9ee,(FULL)0xecf59920,(FULL)0x548f021c,
(FULL)0x571bc8c5,(FULL)0x25b7f4b6,(FULL)0x3a44f536,(FULL)0x4fa52747,
(FULL)0xdf0ebdc2,(FULL)0xb246845f,(FULL)0x42058793,(FULL)0xdd8d68ae,
(FULL)0x9f6c39fb,(FULL)0x3ba13328,(FULL)0x7b6b42af,(FULL)0x8bfdfbf3,
(FULL)0x7fb2b3b0,(FULL)0xfb34c5ca,(FULL)0xd428e32a,(FULL)0x2345dcec,
(FULL)0xad42b63e,(FULL)0x6891e850,(FULL)0x362c1381,(FULL)0x930642c8,
(FULL)0x1886aff5,(FULL)0x13871e9b,(FULL)0x482bda55,(FULL)0xd0cf2407,
(FULL)0x5069bc31,(FULL)0x125b5fc9,(FULL)0xf07dfa5d,(FULL)0x9b71d0a9,
(FULL)0x6712e524,(FULL)0x55c044cc,(FULL)0xbb601978,(FULL)0xf0377358,
(FULL)0x7fa51e8b,(FULL)0x152ad5f8,(FULL)0x9fcdd9af,(FULL)0xe5ebf478,
(FULL)0x66ebce7e,(FULL)0x3d78e18c,(FULL)0xf36aa83f,(FULL)0x8246db72,
(FULL)0x2c64c0a3,(FULL)0xcc6ddc6d,(FULL)0x0d91851e,(FULL)0xa758d687,
(FULL)0x9488ee36,(FULL)0x24b20a6f,(FULL)0x09798197,(FULL)0xbe11ccdf,
(FULL)0x99c1f4e3,(FULL)0x11aca015,(FULL)0x6437ac05,(FULL)0x40e89e36,
(FULL)0x5af675f8,(FULL)0xc8bfc762,(FULL)0xb577e759,(FULL)0x6367c578,
(FULL)0x615f0b74,(FULL)0x00380346,(FULL)0x8de07d81,(FULL)0xee964cc4,
(FULL)0x859d9261,(FULL)0x17f6ac16,(FULL)0x3a6e2f6c,(FULL)0x092f4a17,
(FULL)0xb9024b95,(FULL)0x79981a3d,(FULL)0x04f7f540,(FULL)0x36db1660,
(FULL)0x65a2f1c8,(FULL)0xc36252cf,(FULL)0x124c9bd2,(FULL)0x705b6fde,
(FULL)0x85db40ce,(FULL)0x31e58dda,(FULL)0x9f5e8d6d,(FULL)0x6342b1a5,
(FULL)0xbd6d1d4d,(FULL)0x5c2c67d0,(FULL)0xba7e069d,(FULL)0x1fe5b46f,
(FULL)0xac72e13c,(FULL)0x21c46c6c,(FULL)0x9eb8f52a,(FULL)0xb80c5fd5,
(FULL)0xa74c92bc,(FULL)0x56c3aebf,(FULL)0xbf8c4196,(FULL)0xc1aff1fc,
(FULL)0x754ad208,(FULL)0x2b1df645,(FULL)0xd46eeb50,(FULL)0x5c734600,
(FULL)0x6a70a765,(FULL)0xe0ff1b12,(FULL)0x7a94547c,(FULL)0xd5416497,
(FULL)0x4ea35206,(FULL)0x67b59d7c,(FULL)0x779203b4,(FULL)0x53be7146,
(FULL)0x414026b8,(FULL)0x6b589fe5,(FULL)0x3083bfee,(FULL)0x9e81016c,
(FULL)0x3b4b7671,(FULL)0xb23526b9,(FULL)0x7ee300ba,(FULL)0x4fa9ffb1,
(FULL)0xad05fb21,(FULL)0x6217e212,(FULL)0xb294e6c2,(FULL)0xf5b3fcd3,
(FULL)0x216beb2a,(FULL)0xac040bbe,(FULL)0x71d0e78c,(FULL)0x1f8d8a54,
(FULL)0x9cfec96b,(FULL)0xb6d15b41,(FULL)0xd0508c78,(FULL)0xc5477845,
(FULL)0xb4bba621,(FULL)0x5b486e81,(FULL)0xef4c4121,(FULL)0x90c35c94,
(FULL)0xf6a6bc55,(FULL)0xefce7346,(FULL)0x25bdb9bb,(FULL)0xa27828d9,
(FULL)0xa1f0b205,(FULL)0xe3a53095,(FULL)0xd9f208ab,(FULL)0x1bfa6093,
(FULL)0x6842cdf4,(FULL)0xfb078f6a,(FULL)0x97133a38,(FULL)0x07806d72,
(FULL)0xa3ce9592,(FULL)0x2c6c901b,(FULL)0xebc1b789,(FULL)0x1f0ab2cf,
(FULL)0xe2d03d5e,(FULL)0x2ce81415,(FULL)0xaa9f2417,(FULL)0x7da45d5b,
(FULL)0xdd800682,(FULL)0x3be4f76d,(FULL)0x364d72d3,(FULL)0xdbf4e4a3,
(FULL)0x4fc59da5,(FULL)0xb538cccf,(FULL)0x487f66ec,(FULL)0xb0aa39d5,
(FULL)0x87927d3d,(FULL)0x2fd28dfd,(FULL)0x5900c6b1,(FULL)0xd14e77f0,
(FULL)0x5330c7b4,(FULL)0x2523fad2,(FULL)0xd82368a4,(FULL)0x991b5938,
(FULL)0x2b9c1302,(FULL)0xb7c11443,(FULL)0x1394b116,(FULL)0xdb842db6,
(FULL)0x78ed26d8,(FULL)0x3641548d,(FULL)0x0a61dacf,(FULL)0x274fa8ef,
(FULL)0x112df6f1,(FULL)0xa554ba63,(FULL)0x6b50438d,(FULL)0x7b7fe985,
(FULL)0xbb63bbad,(FULL)0xc9fa0042,(FULL)0xe27f00da,(FULL)0x3abf45d0,
(FULL)0x9f87aabb,(FULL)0xd95faa15,(FULL)0x3488e7ae,(FULL)0x4a95012e,
(FULL)0x0c642d04,(FULL)0x1be2bdb9,(FULL)0x8b4abf3e,(FULL)0x145c8881,
(FULL)0x544cf17f,(FULL)0x7f9fb635,(FULL)0xcc78db70,(FULL)0xb8ab2f62,
(FULL)0xb4242f9a,(FULL)0x8ee64bcd,(FULL)0x95dad129,(FULL)0xabd52858,
(FULL)0xccf31141,(FULL)0xbe722c2f,(FULL)0x575e26a9,(FULL)0x7c330703,
(FULL)0x361b79e4,(FULL)0x45d3e3b3,(FULL)0x54b2e6a6,(FULL)0x241163a7,
(FULL)0xf7cacb77,(FULL)0x8f678d7d,(FULL)0x83211d19,(FULL)0x988a68a4,
(FULL)0xba7836f6,(FULL)0x79599598,(FULL)0xeeda68bf,(FULL)0x4850c887,
(FULL)0x8052ce25,(FULL)0xafa69a71,(FULL)0xbdd73573,(FULL)0x8b21efc6,
(FULL)0xd0972493,(FULL)0x89dbae18,(FULL)0x537d9454,(FULL)0x560776bf,
(FULL)0x165310f2,(FULL)0x3c009f78,(FULL)0x0160c3af,(FULL)0xa3680021,
(FULL)0xa643bd40,(FULL)0x3353ec3c,(FULL)0x911dab02,(FULL)0x7e593f99,
(FULL)0x4f676e89,(FULL)0x72d1ddd9,(FULL)0x6b43c0ea,(FULL)0xfd18b8bd,
(FULL)0xddbd697d,(FULL)0x43cacef2,(FULL)0xacefe884,(FULL)0x2868a4d0,
(FULL)0xa506f013,(FULL)0x5f377b63,(FULL)0x05ca662b,(FULL)0xeaa0975e,
(FULL)0xeb433931,(FULL)0x3740e6b8,(FULL)0x08557948,(FULL)0xce85df00,
(FULL)0x547e33f9,(FULL)0x784745fb,(FULL)0xe5c6f598,(FULL)0x4a1fc5d4,
(FULL)0x768430a7,(FULL)0x85fa6fec,(FULL)0xd2332a51,(FULL)0x990d0c24,
(FULL)0x33b676d5,(FULL)0x55245c2c,(FULL)0xe2bcfa71,(FULL)0xb1091519,
(FULL)0xd23a28d8,(FULL)0x38521478,(FULL)0x9a573010,(FULL)0x9b794f89,
(FULL)0x699bb486,(FULL)0x61d225e8,(FULL)0x1c2158b0,(FULL)0x21476d24
}
#else
/\../\ FULL_BITS must be 32 or 64 /\../\ !!!
#endif
};
/*
@@ -575,57 +760,111 @@ static CONST RAND init_s100 = {
* This array is never changed, only copied.
*/
static CONST FULL def_subtract[SCNT] = {
/* NOTE: Due to a SunOS cc bug, don't put spaces in the SVAL call! */
SVAL(c8c0370c,7db7dc19), SVAL(738e33b9,40a06fbb),
SVAL(481abb76,a859ed2b), SVAL(74106bb3,9ccdccb5),
SVAL(05a8eeb5,c3173bfc), SVAL(efd5100d,5a02e577),
SVAL(a69271f7,4030b24a), SVAL(641282fc,16fe22c5),
SVAL(7aa7267c,40438da3), SVAL(1fdf4abd,c2d878d1),
SVAL(d9899e7a,95702379), SVAL(5ea8e217,d02d7f08),
SVAL(770587fe,4d47a353), SVAL(de7d1bdd,0a33a2b8),
SVAL(4378c3c5,900e7c45), SVAL(77c94478,19a514f9),
SVAL(fc5edb22,843d1d32), SVAL(4fc42ce5,e8ee5e6e),
SVAL(c938713c,8488013e), SVAL(6a318f03,20ab0cac),
SVAL(73e6d1a3,ffc8bff3), SVAL(0cd3232a,8ca96aa7),
SVAL(605c8036,905f770d), SVAL(4d037b00,8b8d04a2),
SVAL(1ed81965,cb277294), SVAL(408d9c47,7a254ff3),
SVAL(8b68587a,e26c7377), SVAL(cff191a4,8a48832f),
SVAL(12d3df1d,8aeb6fe6), SVAL(b2bf907e,1feda37a),
SVAL(4e5f7719,3bb5f39f), SVAL(33ebcf6f,8f5d1581),
SVAL(203c8e48,d33654eb), SVAL(68d3656e,f19c8a4e),
SVAL(3ec20b04,986eb2af), SVAL(5d73a03b,062c3841),
SVAL(836ce709,5d4e49eb), SVAL(2310bc40,c3f49221),
SVAL(3868ee48,a6d0cbf6), SVAL(67578aa6,4a43deb1),
SVAL(6e3426c1,150dfc26), SVAL(c541ccaa,3131be30),
SVAL(f7e57432,cec7aab2), SVAL(2b35de99,8cb3c873),
SVAL(7b9f7764,8663a5d7), SVAL(23b00e6a,a771e5a6),
SVAL(859c775c,a9985d05), SVAL(99636ea1,6b692f1f),
SVAL(8700ac70,3730800d), SVAL(46142502,4298a753),
SVAL(ea4a411b,809e955f), SVAL(3119ad40,33709dfb),
SVAL(b76a6c6e,5f01cb7c), SVAL(6109dc8a,15984eaf),
SVAL(5d686db9,a5ca9505), SVAL(8e80d761,3b7e6add),
SVAL(79cbd718,de6f6fd3), SVAL(40e9cd15,1da0f699),
SVAL(e82158ba,b24f312d), SVAL(79a4c927,f5e5c36b),
SVAL(c25247c9,a0039333), SVAL(93687116,1766d81d),
SVAL(3c6a03b4,a6741327), SVAL(c8a7b6e8,c002f29a),
SVAL(0e2a67c6,7bbd5ea3), SVAL(0929042d,441eabc1),
SVAL(7dbe232a,25e82085), SVAL(8cfb26e5,44fbac3d),
SVAL(8e40384d,388ab983), SVAL(48dc1230,554632f8),
SVAL(ab405048,ab492397), SVAL(21c9e2f5,a118e387),
SVAL(484d1a8c,343b61b5), SVAL(d49e3dec,ab256f26),
SVAL(e615c7fd,78f2d2e3), SVAL(8442cc33,ce6cc2ed),
SVAL(0a3b93d8,44d4bbf6), SVAL(2d7e4efe,9301de77),
SVAL(33711b76,d8790d8a), SVAL(c07dc30e,44df77e7),
SVAL(b9132ed0,9ddd508f), SVAL(45d06cf8,c6fb43cc),
SVAL(22bed18a,d585dd7b), SVAL(61c6cced,10799ffa),
SVAL(d7f2393b,e4bd9aa9), SVAL(706753fb,cfd55094),
SVAL(f65a6713,ede6e446), SVAL(8bf6dfae,47c0d5c3),
SVAL(fb4dfc17,9f7927d6), SVAL(12ebbc16,e212c297),
SVAL(43c71283,a00a954c), SVAL(8957087a,e7bd40a5),
SVAL(b0859d71,08344837), SVAL(fbf4b9a3,aeb313f5),
SVAL(5e66e5be,ce81823a), SVAL(09a11c6e,58ad6da1),
SVAL(c76f4316,c608054f), SVAL(b5821361,46084099),
SVAL(4210008f,17a725ed), SVAL(e5ff8912,d347c481)
#if FULL_BITS == SBITS
(FULL)U(0xc8c0370c7db7dc19), (FULL)U(0x738e33b940a06fbb),
(FULL)U(0x481abb76a859ed2b), (FULL)U(0x74106bb39ccdccb5),
(FULL)U(0x05a8eeb5c3173bfc), (FULL)U(0xefd5100d5a02e577),
(FULL)U(0xa69271f74030b24a), (FULL)U(0x641282fc16fe22c5),
(FULL)U(0x7aa7267c40438da3), (FULL)U(0x1fdf4abdc2d878d1),
(FULL)U(0xd9899e7a95702379), (FULL)U(0x5ea8e217d02d7f08),
(FULL)U(0x770587fe4d47a353), (FULL)U(0xde7d1bdd0a33a2b8),
(FULL)U(0x4378c3c5900e7c45), (FULL)U(0x77c9447819a514f9),
(FULL)U(0xfc5edb22843d1d32), (FULL)U(0x4fc42ce5e8ee5e6e),
(FULL)U(0xc938713c8488013e), (FULL)U(0x6a318f0320ab0cac),
(FULL)U(0x73e6d1a3ffc8bff3), (FULL)U(0x0cd3232a8ca96aa7),
(FULL)U(0x605c8036905f770d), (FULL)U(0x4d037b008b8d04a2),
(FULL)U(0x1ed81965cb277294), (FULL)U(0x408d9c477a254ff3),
(FULL)U(0x8b68587ae26c7377), (FULL)U(0xcff191a48a48832f),
(FULL)U(0x12d3df1d8aeb6fe6), (FULL)U(0xb2bf907e1feda37a),
(FULL)U(0x4e5f77193bb5f39f), (FULL)U(0x33ebcf6f8f5d1581),
(FULL)U(0x203c8e48d33654eb), (FULL)U(0x68d3656ef19c8a4e),
(FULL)U(0x3ec20b04986eb2af), (FULL)U(0x5d73a03b062c3841),
(FULL)U(0x836ce7095d4e49eb), (FULL)U(0x2310bc40c3f49221),
(FULL)U(0x3868ee48a6d0cbf6), (FULL)U(0x67578aa64a43deb1),
(FULL)U(0x6e3426c1150dfc26), (FULL)U(0xc541ccaa3131be30),
(FULL)U(0xf7e57432cec7aab2), (FULL)U(0x2b35de998cb3c873),
(FULL)U(0x7b9f77648663a5d7), (FULL)U(0x23b00e6aa771e5a6),
(FULL)U(0x859c775ca9985d05), (FULL)U(0x99636ea16b692f1f),
(FULL)U(0x8700ac703730800d), (FULL)U(0x461425024298a753),
(FULL)U(0xea4a411b809e955f), (FULL)U(0x3119ad4033709dfb),
(FULL)U(0xb76a6c6e5f01cb7c), (FULL)U(0x6109dc8a15984eaf),
(FULL)U(0x5d686db9a5ca9505), (FULL)U(0x8e80d7613b7e6add),
(FULL)U(0x79cbd718de6f6fd3), (FULL)U(0x40e9cd151da0f699),
(FULL)U(0xe82158bab24f312d), (FULL)U(0x79a4c927f5e5c36b),
(FULL)U(0xc25247c9a0039333), (FULL)U(0x936871161766d81d),
(FULL)U(0x3c6a03b4a6741327), (FULL)U(0xc8a7b6e8c002f29a),
(FULL)U(0x0e2a67c67bbd5ea3), (FULL)U(0x0929042d441eabc1),
(FULL)U(0x7dbe232a25e82085), (FULL)U(0x8cfb26e544fbac3d),
(FULL)U(0x8e40384d388ab983), (FULL)U(0x48dc1230554632f8),
(FULL)U(0xab405048ab492397), (FULL)U(0x21c9e2f5a118e387),
(FULL)U(0x484d1a8c343b61b5), (FULL)U(0xd49e3decab256f26),
(FULL)U(0xe615c7fd78f2d2e3), (FULL)U(0x8442cc33ce6cc2ed),
(FULL)U(0x0a3b93d844d4bbf6), (FULL)U(0x2d7e4efe9301de77),
(FULL)U(0x33711b76d8790d8a), (FULL)U(0xc07dc30e44df77e7),
(FULL)U(0xb9132ed09ddd508f), (FULL)U(0x45d06cf8c6fb43cc),
(FULL)U(0x22bed18ad585dd7b), (FULL)U(0x61c6cced10799ffa),
(FULL)U(0xd7f2393be4bd9aa9), (FULL)U(0x706753fbcfd55094),
(FULL)U(0xf65a6713ede6e446), (FULL)U(0x8bf6dfae47c0d5c3),
(FULL)U(0xfb4dfc179f7927d6), (FULL)U(0x12ebbc16e212c297),
(FULL)U(0x43c71283a00a954c), (FULL)U(0x8957087ae7bd40a5),
(FULL)U(0xb0859d7108344837), (FULL)U(0xfbf4b9a3aeb313f5),
(FULL)U(0x5e66e5bece81823a), (FULL)U(0x09a11c6e58ad6da1),
(FULL)U(0xc76f4316c608054f), (FULL)U(0xb582136146084099),
(FULL)U(0x4210008f17a725ed), (FULL)U(0xe5ff8912d347c481)
#elif 2*FULL_BITS == SBITS
(FULL)0x7db7dc19,(FULL)0xc8c0370c,(FULL)0x40a06fbb,(FULL)0x738e33b9,
(FULL)0xa859ed2b,(FULL)0x481abb76,(FULL)0x9ccdccb5,(FULL)0x74106bb3,
(FULL)0xc3173bfc,(FULL)0x05a8eeb5,(FULL)0x5a02e577,(FULL)0xefd5100d,
(FULL)0x4030b24a,(FULL)0xa69271f7,(FULL)0x16fe22c5,(FULL)0x641282fc,
(FULL)0x40438da3,(FULL)0x7aa7267c,(FULL)0xc2d878d1,(FULL)0x1fdf4abd,
(FULL)0x95702379,(FULL)0xd9899e7a,(FULL)0xd02d7f08,(FULL)0x5ea8e217,
(FULL)0x4d47a353,(FULL)0x770587fe,(FULL)0x0a33a2b8,(FULL)0xde7d1bdd,
(FULL)0x900e7c45,(FULL)0x4378c3c5,(FULL)0x19a514f9,(FULL)0x77c94478,
(FULL)0x843d1d32,(FULL)0xfc5edb22,(FULL)0xe8ee5e6e,(FULL)0x4fc42ce5,
(FULL)0x8488013e,(FULL)0xc938713c,(FULL)0x20ab0cac,(FULL)0x6a318f03,
(FULL)0xffc8bff3,(FULL)0x73e6d1a3,(FULL)0x8ca96aa7,(FULL)0x0cd3232a,
(FULL)0x905f770d,(FULL)0x605c8036,(FULL)0x8b8d04a2,(FULL)0x4d037b00,
(FULL)0xcb277294,(FULL)0x1ed81965,(FULL)0x7a254ff3,(FULL)0x408d9c47,
(FULL)0xe26c7377,(FULL)0x8b68587a,(FULL)0x8a48832f,(FULL)0xcff191a4,
(FULL)0x8aeb6fe6,(FULL)0x12d3df1d,(FULL)0x1feda37a,(FULL)0xb2bf907e,
(FULL)0x3bb5f39f,(FULL)0x4e5f7719,(FULL)0x8f5d1581,(FULL)0x33ebcf6f,
(FULL)0xd33654eb,(FULL)0x203c8e48,(FULL)0xf19c8a4e,(FULL)0x68d3656e,
(FULL)0x986eb2af,(FULL)0x3ec20b04,(FULL)0x062c3841,(FULL)0x5d73a03b,
(FULL)0x5d4e49eb,(FULL)0x836ce709,(FULL)0xc3f49221,(FULL)0x2310bc40,
(FULL)0xa6d0cbf6,(FULL)0x3868ee48,(FULL)0x4a43deb1,(FULL)0x67578aa6,
(FULL)0x150dfc26,(FULL)0x6e3426c1,(FULL)0x3131be30,(FULL)0xc541ccaa,
(FULL)0xcec7aab2,(FULL)0xf7e57432,(FULL)0x8cb3c873,(FULL)0x2b35de99,
(FULL)0x8663a5d7,(FULL)0x7b9f7764,(FULL)0xa771e5a6,(FULL)0x23b00e6a,
(FULL)0xa9985d05,(FULL)0x859c775c,(FULL)0x6b692f1f,(FULL)0x99636ea1,
(FULL)0x3730800d,(FULL)0x8700ac70,(FULL)0x4298a753,(FULL)0x46142502,
(FULL)0x809e955f,(FULL)0xea4a411b,(FULL)0x33709dfb,(FULL)0x3119ad40,
(FULL)0x5f01cb7c,(FULL)0xb76a6c6e,(FULL)0x15984eaf,(FULL)0x6109dc8a,
(FULL)0xa5ca9505,(FULL)0x5d686db9,(FULL)0x3b7e6add,(FULL)0x8e80d761,
(FULL)0xde6f6fd3,(FULL)0x79cbd718,(FULL)0x1da0f699,(FULL)0x40e9cd15,
(FULL)0xb24f312d,(FULL)0xe82158ba,(FULL)0xf5e5c36b,(FULL)0x79a4c927,
(FULL)0xa0039333,(FULL)0xc25247c9,(FULL)0x1766d81d,(FULL)0x93687116,
(FULL)0xa6741327,(FULL)0x3c6a03b4,(FULL)0xc002f29a,(FULL)0xc8a7b6e8,
(FULL)0x7bbd5ea3,(FULL)0x0e2a67c6,(FULL)0x441eabc1,(FULL)0x0929042d,
(FULL)0x25e82085,(FULL)0x7dbe232a,(FULL)0x44fbac3d,(FULL)0x8cfb26e5,
(FULL)0x388ab983,(FULL)0x8e40384d,(FULL)0x554632f8,(FULL)0x48dc1230,
(FULL)0xab492397,(FULL)0xab405048,(FULL)0xa118e387,(FULL)0x21c9e2f5,
(FULL)0x343b61b5,(FULL)0x484d1a8c,(FULL)0xab256f26,(FULL)0xd49e3dec,
(FULL)0x78f2d2e3,(FULL)0xe615c7fd,(FULL)0xce6cc2ed,(FULL)0x8442cc33,
(FULL)0x44d4bbf6,(FULL)0x0a3b93d8,(FULL)0x9301de77,(FULL)0x2d7e4efe,
(FULL)0xd8790d8a,(FULL)0x33711b76,(FULL)0x44df77e7,(FULL)0xc07dc30e,
(FULL)0x9ddd508f,(FULL)0xb9132ed0,(FULL)0xc6fb43cc,(FULL)0x45d06cf8,
(FULL)0xd585dd7b,(FULL)0x22bed18a,(FULL)0x10799ffa,(FULL)0x61c6cced,
(FULL)0xe4bd9aa9,(FULL)0xd7f2393b,(FULL)0xcfd55094,(FULL)0x706753fb,
(FULL)0xede6e446,(FULL)0xf65a6713,(FULL)0x47c0d5c3,(FULL)0x8bf6dfae,
(FULL)0x9f7927d6,(FULL)0xfb4dfc17,(FULL)0xe212c297,(FULL)0x12ebbc16,
(FULL)0xa00a954c,(FULL)0x43c71283,(FULL)0xe7bd40a5,(FULL)0x8957087a,
(FULL)0x08344837,(FULL)0xb0859d71,(FULL)0xaeb313f5,(FULL)0xfbf4b9a3,
(FULL)0xce81823a,(FULL)0x5e66e5be,(FULL)0x58ad6da1,(FULL)0x09a11c6e,
(FULL)0xc608054f,(FULL)0xc76f4316,(FULL)0x46084099,(FULL)0xb5821361,
(FULL)0x17a725ed,(FULL)0x4210008f,(FULL)0xd347c481,(FULL)0xe5ff8912
#else
/\../\ FULL_BITS must be 32 or 64 /\../\ !!!
#endif
};
@@ -637,9 +876,17 @@ static CONST FULL def_subtract[SCNT] = {
*
* These constants are used in the randreseed64(). See below.
*/
/* NOTE: Due to a SunOS cc bug, don't put spaces in the SHVAL call! */
static CONST HALF a_vec[SHALFS] = {SHVAL(57aa,0ff4,73c0,ccbd)};
static CONST HALF c_vec[SHALFS] = {SHVAL(12ea,8057,18e0,9865)};
#if FULL_BITS == SBITS
static CONST HALF a_vec[SHALFS] = { (HALF)0x73c0ccbd, (HALF)0x57aa0ff4 };
static CONST HALF c_vec[SHALFS] = { (HALF)0x18e09865, (HALF)0x12ea8057 };
#elif 2*FULL_BITS == SBITS
static CONST HALF a_vec[SHALFS] = { (HALF)0xccbd, (HALF)0x73c0,
(HALF)0x0ff4, (HALF)0x57aa };
static CONST HALF c_vec[SHALFS] = { (HALF)0x9865, (HALF)0x18e0,
(HALF)0x8057, (HALF)0x12ea };
#else
/\../\ FULL_BITS must be 32 or 64 /\../\ !!!
#endif
static CONST ZVALUE a_val = {(HALF *)a_vec, SHALFS, 0};
static CONST ZVALUE c_val = {(HALF *)c_vec, SHALFS, 0};

38
zrand.h
View File

@@ -1,7 +1,7 @@
/*
* zrand - subtractive 100 shuffle generator
*
* Copyright (C) 1999 Landon Curt Noll
* Copyright (C) 1999,2004 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.5 $
* @(#) $Id: zrand.h,v 29.5 2001/06/08 21:00:58 chongo Exp $
* @(#) $Revision: 29.7 $
* @(#) $Id: zrand.h,v 29.7 2004/03/31 04:58:40 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zrand.h,v $
*
* Under source code control: 1995/01/07 09:45:26
@@ -81,20 +81,6 @@
*
* SLEN - length in FULLs of an subtractive 100 slot
*
* SVAL(a,b) - form a 64 bit hex slot entry in the subtractive 100 table
* a: up to 8 hex digits without the leading 0x (upper half)
* b: up to 8 hex digits without the leading 0x (lower half)
*
* NOTE: Due to a SunOS cc bug, don't put spaces in the SVAL call!
*
* SHVAL(a,b,c,d) - form an 64 bit array of HALFs
* a: up to 4 hex digits without the leading 0x (upper half)
* b: up to 4 hex digits without the leading 0x (2nd half)
* c: up to 4 hex digits without the leading 0x (3rd half)
* d: up to 4 hex digits without the leading 0x (lower half)
*
* NOTE: Due to a SunOS cc bug, don't put spaces in the SHVAL call!
*
* SLOAD(s,i,z) - load table slot i from subtractive 100 state s with zvalue z
* s: type RAND
* i: type int, s.slot[i] slot index
@@ -140,13 +126,6 @@
#if FULL_BITS == SBITS
# define SLEN 1 /* a 64 bit slot can be held in a FULL */
# if defined(FORCE_STDC) || (defined(__STDC__) && __STDC__ != 0) || defined(__cplusplus)
# define SVAL(a,b) (FULL)U(0x ## a ## b)
# define SHVAL(a,b,c,d) (HALF)0x ## c ## d, (HALF)0x ## a ## b
# else
# define SVAL(a,b) (FULL)U(0x/**/a/**/b)
# define SHVAL(a,b,c,d) (HALF)0x/**/c/**/d,(HALF)0x/**/a/**/b
# endif
#define SLOAD(s,i,z) ((s).slot[i] = ztofull(z))
#define SSUB(s,k,j) ((s).slot[k] -= (s).slot[j])
#define SINDX(s,k) ((int)((s).slot[k] >> (FULL_BITS - SHUFPOW)))
@@ -164,17 +143,6 @@
#elif 2*FULL_BITS == SBITS
# define SLEN 2 /* a 64 bit slot needs 2 FULLs */
# if defined(FORCE_STDC) || (defined(__STDC__) && __STDC__ != 0) || defined(__cplusplus)
# define SVAL(a,b) (FULL)0x##b, (FULL)0x##a
# define SHVAL(a,b,c,d) (HALF)0x##d, (HALF)0x##c, \
(HALF)0x##b, (HALF)0x##a
# else
/* NOTE: Due to a SunOS cc bug, don't put spaces in the SVAL call! */
# define SVAL(a,b) (FULL)0x/**/b, (FULL)0x/**/a
/* NOTE: Due to a SunOS cc bug, don't put spaces in the SHVAL call! */
# define SHVAL(a,b,c,d) (HALF)0x/**/d, (HALF)0x/**/c, \
(HALF)0x/**/b, (HALF)0x/**/a
# endif
#define SLOAD(s,i,z) {(s).slot[(i)<<1] = ztofull(z); \
(s).slot[1+((i)<<1)] = \
(((z).len <= 2) ? (FULL)0 : \

1220
zrandom.c

File diff suppressed because it is too large Load Diff