Release calc version 2.11.5t4

This commit is contained in:
Landon Curt Noll
2001-05-28 15:51:54 -07:00
parent a0aba073a6
commit d2cb9c81d5
20 changed files with 1365 additions and 428 deletions

79
CHANGES
View File

@@ -1,4 +1,71 @@
The following are the changes from calc version 2.11.5t2 to date: The following are the changes from calc version 2.11.5t3 to date:
The Makefile will now send both stdout and sterr to /dev/null
when compiling hsrc intermeriates.
The config("verbose_quit") value was restored to a default
value of FALSE.
Added the cscript:
powerterm [base_limit] value
to write the value as the sum (or difference) of powers <= base_limit
where base_limit by default is 10000.
Applied a bug fix by Dr.D.J.Picton <dave at aps5.ph.bham.ac.uk>
to have help with no args print the default help file.
Renamed lavarand to LavaRnd.
Added rules to build a calc rpm.
All installed files are first formed as foo.new, and then moved
into place as foo via a atomic rename.
During installation, only files that are different are installed.
If the built file and the installed file are the same, no
installation is performed.
Calc has new default installation locations:
Makefile var old location new location
------------ ------------ ------------
TOPDIR /usr/local/lib <<no longer used>>
BINDIR /usr/local/bin /usr/bin
SHAREDIR <<not set>> /usr/share
INCDIR /usr/local/include /usr/include
LIBDIR /usr/local/lib/calc /usr/lib
CSHAREDIR <<not set>> /usr/share/calc
HELPDIR /usr/local/lib/calc/help /usr/share/calc/help
INCDIRCALC /usr/local/include/calc /usr/include/calc
CUSTOMLIBDIR /usr/local/lib/calc/custom /usr/share/calc/custom
CUSTOMHELPDIR /usr/local/lib/calc/help/custhelp /usr/share/calc/custhelp
CUSTOMINCDIR <<not set>> /usr/include/calc/custom
SCRIPTDIR /usr/local/bin/cscript /usr/bin/cscript
MANDIR <<not set>> /usr/share/man/man1
CATDIR <<not set>> <<not set>>
The Makefile variable ${TOPDIR} is no longer used. In some places
it has been replaced by a new Makefile variable ${SHAREDIR}. Some
of the old TOPDIR functionality has beenn replaced by ${CSHAREDIR}.
The install rules no longer remove old obsolete files. We assume
that these old files have long since vanished! :-)
Reduced the amount of output when doing a make all where nothing
needs to be made.
Reduced the amount of output when doing a make install where nothing
needs to be installed.
If you install using the new default locations, you can remove
old calc files installed in the old default location by doing:
make olduninstall
The following are the changes from calc version 2.11.5t2 to 2.11.5t2.1:
Fixed a bug, reported by Ernest Bowen <ernie at turing dot Fixed a bug, reported by Ernest Bowen <ernie at turing dot
une dot edu dot au> that caused command lines to be echoed in une dot edu dot au> that caused command lines to be echoed in
@@ -48,7 +115,7 @@ The following are the changes from calc version 2.11.5t2 to date:
Added regression test 8310 to test for the static bug fix. Added regression test 8310 to test for the static bug fix.
The following are the changes from calc version 2.11.5t0 to date: The following are the changes from calc version 2.11.5t0 to 2.11.5t1.1:
Fixed a compile problem with Linux 2.4 / Debian. Thanks goes Fixed a compile problem with Linux 2.4 / Debian. Thanks goes
to Martin Buck <m at rtin-buck dot de> for help with this issue. to Martin Buck <m at rtin-buck dot de> for help with this issue.
@@ -171,7 +238,7 @@ The following are the changes from calc version 2.11.5t0 to date:
that have been attempted to be built for windoz. that have been attempted to be built for windoz.
The following are the changes from calc version 2.11.4t1 to date: The following are the changes from calc version 2.11.4t1 to 2.11.4t2:
Added missing test8600.cal test file. Added missing test8600.cal test file.
@@ -5198,7 +5265,7 @@ Following is a list of visible changes to calc from version 1.24.7 to 1.26.1:
A small bug in the library file regress.cal was fixed. A small bug in the library file regress.cal was fixed.
## Copyright (C) 1999 Landon Curt Noll ## Copyright (C) 2001 Landon Curt Noll
## ##
## Calc is open software; you can redistribute it and/or modify it under ## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License ## the terms of the version 2.1 of the GNU Lesser General Public License
@@ -5214,8 +5281,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. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## ##
## @(#) $Revision: 29.29 $ ## @(#) $Revision: 29.32 $
## @(#) $Id: CHANGES,v 29.29 2001/04/14 22:56:46 chongo Exp $ ## @(#) $Id: CHANGES,v 29.32 2001/05/28 21:59:59 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $ ## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
## ##
## Under source code control: 1993/06/02 18:12:57 ## Under source code control: 1993/06/02 18:12:57

739
Makefile

File diff suppressed because it is too large Load Diff

View File

@@ -18,8 +18,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.5 $ # @(#) $Revision: 29.9 $
# @(#) $Id: Makefile,v 29.5 2001/03/31 16:24:17 chongo Exp $ # @(#) $Id: Makefile,v 29.9 2001/05/28 21:56:08 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/Makefile,v $ # @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/Makefile,v $
# #
# Under source code control: 1991/07/21 05:00:54 # Under source code control: 1991/07/21 05:00:54
@@ -40,11 +40,12 @@ MAKE_FILE = Makefile
# a default here just in case you want to build from this directory. # a default here just in case you want to build from this directory.
# #
# where to install things # where to install things
TOPDIR= /usr/local/lib #SHAREDIR= /usr/local/lib
#TOPDIR= /usr/lib #SHAREDIR= /usr/lib
#TOPDIR= /usr/libdata SHAREDIR= /usr/share
#SHAREDIR= /usr/libdata
LIBDIR= ${TOPDIR}/calc CSHAREDIR= ${SHAREDIR}/calc
# Makefile debug # Makefile debug
# #
@@ -57,6 +58,7 @@ Q=@
# standard tools # standard tools
# #
CHMOD= chmod CHMOD= chmod
CMP= cmp
# The calc files to install # The calc files to install
# #
@@ -116,34 +118,56 @@ calcliblist:
fi; \ fi; \
done done
##
#
# rpm rules
#
##
echo_CALC_FILES: ${MAKE_FILE}
@echo ${CALC_FILES}
echo_install.list: ${MAKE_FILE}
@for i in ${CALC_FILES}; do \
echo ${CSHAREDIR}/$$i; \
done
##
#
# Utility rules
#
##
clean: clean:
clobber: clobber:
rm -f .all rm -f .all
install: all install: all
-${Q}if [ ! -d ${TOPDIR} ]; then \ -${Q}if [ ! -d ${SHAREDIR} ]; then \
echo mkdir ${TOPDIR}; \ echo mkdir ${SHAREDIR}; \
mkdir ${TOPDIR}; \ mkdir ${SHAREDIR}; \
echo ${CHMOD} 0755 ${SHAREDIR}; \
${CHMOD} 0755 ${SHAREDIR}; \
else \ else \
true; \ true; \
fi fi
-${Q}if [ ! -d ${LIBDIR} ]; then \ -${Q}if [ ! -d ${CSHAREDIR} ]; then \
echo mkdir ${LIBDIR}; \ echo mkdir ${CSHAREDIR}; \
mkdir ${LIBDIR}; \ mkdir ${CSHAREDIR}; \
echo ${CHMOD} 0755 ${CSHAREDIR}; \
${CHMOD} 0755 ${CSHAREDIR}; \
else \ else \
true; \ true; \
fi fi
${Q}for i in ${CALC_FILES}; do \ ${Q}for i in ${CALC_FILES}; do \
echo rm -f ${LIBDIR}/$$i; \ if ${CMP} -s $$i ${CSHAREDIR}/$$i; then \
rm -f ${LIBDIR}/$$i; \ true; \
echo cp $$i ${LIBDIR}; \ else \
cp $$i ${LIBDIR}; \ rm -f ${CSHAREDIR}/$$i.new; \
echo ${CHMOD} 0444 ${LIBDIR}/$$i; \ cp -f $$i ${CSHAREDIR}/$$i.new; \
${CHMOD} 0444 ${LIBDIR}/$$i; \ ${CHMOD} 0444 ${CSHAREDIR}/$$i.new; \
mv -f ${CSHAREDIR}/$$i.new ${CSHAREDIR}/$$i; \
echo "installed ${CSHAREDIR}/$$i"; \
fi; \
done done
${Q}echo remove files that are obsolete
-rm -f nextprime.cal nextprim.cal
-rm -f test1000.cal test2000.cal ${LIBDIR}/test2000.cal
-rm -f ${LIBDIR}/nextprime.cal ${LIBDIR}/nextprim.cal
-rm -f ${LIBDIR}/test1000.cal ${LIBDIR}/cryrand.cal

View File

@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.5 $ * @(#) $Revision: 29.6 $
* @(#) $Id: codegen.c,v 29.5 2001/04/14 22:55:39 chongo Exp $ * @(#) $Id: codegen.c,v 29.6 2001/05/08 06:29:24 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/codegen.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/codegen.c,v $
* *
* Under source code control: 1990/02/15 01:48:13 * Under source code control: 1990/02/15 01:48:13
@@ -127,6 +127,7 @@ getcommands(BOOL toplevel)
if (!toplevel) if (!toplevel)
enterfilescope(); enterfilescope();
for (;;) { for (;;) {
int i;
(void) tokenmode(TM_NEWLINES); (void) tokenmode(TM_NEWLINES);
switch (gettoken()) { switch (gettoken()) {
@@ -144,10 +145,14 @@ getcommands(BOOL toplevel)
return; return;
case T_HELP: case T_HELP:
for (;;) { for (i=1;;i++) {
switch(getfilename(name, NULL)) { switch(getfilename(name, NULL)) {
case 1: case -1:
strcpy(name, DEFAULTCALCHELP); if(i == 1) {
strcpy(name, DEFAULTCALCHELP);
givehelp(name);
}
break;
case 0: case 0:
givehelp(name); givehelp(name);
continue; continue;

View File

@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.6 $ * @(#) $Revision: 29.7 $
* @(#) $Id: config.c,v 29.6 2001/04/08 10:07:19 chongo Exp $ * @(#) $Id: config.c,v 29.7 2001/04/25 07:15:22 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/config.c,v $
* *
* Under source code control: 1991/07/20 00:21:56 * Under source code control: 1991/07/20 00:21:56
@@ -133,7 +133,7 @@ CONFIG oldstd = { /* backward compatible standard configuration */
0, /* internal calc debug level */ 0, /* internal calc debug level */
3, /* calc resource file debug level */ 3, /* calc resource file debug level */
0, /* user defined debug level */ 0, /* user defined debug level */
TRUE, /* print Quit or abort executed messages */ FALSE, /* print Quit or abort executed messages */
CTRL_D_VIRGIN_EOF, /* ^D only exits on virgin lines */ CTRL_D_VIRGIN_EOF, /* ^D only exits on virgin lines */
NULL, /* our name */ NULL, /* our name */
NULL, /* basename of our name */ NULL, /* basename of our name */
@@ -178,7 +178,7 @@ CONFIG newstd = { /* new non-backward compatible configuration */
0, /* internal calc debug level */ 0, /* internal calc debug level */
3, /* calc resource file debug level */ 3, /* calc resource file debug level */
0, /* user defined debug level */ 0, /* user defined debug level */
TRUE, /* print Quit or abort executed messages */ FALSE, /* print Quit or abort executed messages */
CTRL_D_VIRGIN_EOF, /* ^D only exits on virgin lines */ CTRL_D_VIRGIN_EOF, /* ^D only exits on virgin lines */
NULL, /* our name */ NULL, /* our name */
NULL, /* basename of our name */ NULL, /* basename of our name */

View File

@@ -17,8 +17,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.9 $ # @(#) $Revision: 29.13 $
# @(#) $Id: Makefile,v 29.9 2001/04/08 10:53:52 chongo Exp $ # @(#) $Id: Makefile,v 29.13 2001/05/13 14:43:56 chongo Exp chongo $
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/Makefile,v $ # @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/Makefile,v $
# #
# Under source code control: 1999/11/29 11:10:26 # Under source code control: 1999/11/29 11:10:26
@@ -39,8 +39,8 @@ MAKE_FILE = Makefile
# Normally, the upper level makefile will set these values. We provide # Normally, the upper level makefile will set these values. We provide
# a default here just in case you want to build from this directory. # a default here just in case you want to build from this directory.
# #
BINDIR= /usr/local/bin #BINDIR= /usr/local/bin
#BINDIR= /usr/bin BINDIR= /usr/bin
#BINDIR= /usr/contrib/bin #BINDIR= /usr/contrib/bin
# #
SCRIPTDIR= ${BINDIR}/cscript SCRIPTDIR= ${BINDIR}/cscript
@@ -59,6 +59,7 @@ CHMOD= chmod
SED= sed SED= sed
SORT= sort SORT= sort
FMT= fmt FMT= fmt
CMP= cmp
# The ${SCRIPT} list is the list of calc shell script files (without the .calc # The ${SCRIPT} list is the list of calc shell script files (without the .calc
# extension) which will be installed. # extension) which will be installed.
@@ -76,10 +77,10 @@ FMT= fmt
# #
# make detaillist # make detaillist
# #
SCRIPT= mersenne piforever plus simple square fproduct SCRIPT= mersenne piforever plus simple square fproduct powerterm
SCRIPT_SRC= mersenne.calc piforever.calc plus.calc simple.calc square.calc \ SCRIPT_SRC= mersenne.calc piforever.calc plus.calc simple.calc square.calc \
fproduct.calc fproduct.calc powerterm.calc
# These files are found (but not built) in the distribution # These files are found (but not built) in the distribution
# #
@@ -89,9 +90,17 @@ DISTLIST= ${SCRIPT_SRC} ${MAKE_FILE} README
# #
CALCLIBLIST= CALCLIBLIST=
# complete list of targets
#
# NOTE: This list MUST be co-ordinated with the ${CSCRIPT_TARGETS} variable
# in the upper level ../Makefile
#
CSCRIPT_TARGETS= ${SCRIPT}
TARGETS= ${CSCRIPT_TARGETS}
# The reason for this Makefile # The reason for this Makefile
# #
all: ${SCRIPT} ${SCRIPT_SRC} .all all: ${TARGETS} .all
# used by the upper level Makefile to determine if we have done all # used by the upper level Makefile to determine if we have done all
# #
@@ -185,7 +194,7 @@ depend:
${Q}echo "" >> Makefile ${Q}echo "" >> Makefile
${Q}${SED} -n '3,$$p' makedep.out >> Makefile ${Q}${SED} -n '3,$$p' makedep.out >> Makefile
-${Q}rm -f makedep.out -${Q}rm -f makedep.out
-${Q}if cmp -s Makefile.bak Makefile; then \ -${Q}if ${CMP} -s Makefile.bak Makefile; then \
echo 'sample Makefile was already up to date'; \ echo 'sample Makefile was already up to date'; \
mv -f Makefile.bak Makefile; \ mv -f Makefile.bak Makefile; \
else \ else \
@@ -200,32 +209,59 @@ depend:
fi; \ fi; \
fi fi
##
#
# rpm rules
#
##
echo_SCRIPT: ${MAKE_FILE}
@echo ${SCRIPT}
echo_install.list: ${MAKE_FILE}
@for i in ${SCRIPT}; do \
echo ${SCRIPTDIR}/$$i; \
done
##
#
# Utility rules
#
##
clean: clean:
-rm -f makedep.out -rm -f makedep.out
clobber: clobber:
-rm -f ${SCRIPT} -rm -f ${TARGETS}
install: all install: all
-${Q}if [ ! -d ${BINDIR} ]; then \ -${Q}if [ ! -d ${BINDIR} ]; then \
echo mkdir ${BINDIR}; \ echo mkdir ${BINDIR}; \
mkdir ${BINDIR}; \ mkdir ${BINDIR}; \
echo ${CHMOD} 0755 ${BINDIR}; \
${CHMOD} 0755 ${BINDIR}; \
else \ else \
true; \ true; \
fi fi
-${Q}if [ ! -d ${SCRIPTDIR} ]; then \ -${Q}if [ ! -d ${SCRIPTDIR} ]; then \
echo mkdir ${SCRIPTDIR}; \ echo mkdir ${SCRIPTDIR}; \
mkdir ${SCRIPTDIR}; \ mkdir ${SCRIPTDIR}; \
echo ${CHMOD} 0755 ${SCRIPTDIR}; \
${CHMOD} 0755 ${SCRIPTDIR}; \
else \ else \
true; \ true; \
fi fi
${Q}for i in ${SCRIPT}; do \ ${Q}for i in ${SCRIPT}; do \
echo rm -f ${SCRIPTDIR}/$$i; \ if ${CMP} -s $$i ${SCRIPTDIR}/$$i; then \
rm -f ${SCRIPTDIR}/$$i; \ true; \
echo cp $$i ${SCRIPTDIR}; \ else \
cp $$i ${SCRIPTDIR}; \ rm -f ${SCRIPTDIR}/$$i.new; \
echo ${CHMOD} 0555 ${SCRIPTDIR}/$$i; \ cp -f $$i ${SCRIPTDIR}/$$i.new; \
${CHMOD} 0555 ${SCRIPTDIR}/$$i; \ ${CHMOD} 0555 ${SCRIPTDIR}/$$i; \
mv -f ${SCRIPTDIR}/$$i.new ${SCRIPTDIR}/$$i; \
echo "installed ${SCRIPTDIR}/$$i"; \
fi; \
done done
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.
@@ -254,3 +290,7 @@ fproduct: fproduct.calc
rm -f $@ rm -f $@
${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@ ${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
${CHMOD} +x $@ ${CHMOD} +x $@
powerterm: powerterm.calc
rm -f $@
${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
${CHMOD} +x $@

View File

@@ -39,6 +39,12 @@ plus arg ...
Print the sum of 1 or more arguments. Print the sum of 1 or more arguments.
powerterm [base_limit] value
Print the value as a sum (or difference) of powers of integers up
to and including powers <= base_limit. By default, base_limit is 10000.
simple simple
A trivial example of a calc shell script. A trivial example of a calc shell script.
@@ -59,8 +65,8 @@ simple
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## ##
## @(#) $Revision: 29.5 $ ## @(#) $Revision: 29.6 $
## @(#) $Id: README,v 29.5 2001/04/08 08:24:40 chongo Exp $ ## @(#) $Id: README,v 29.6 2001/04/25 07:26:12 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/README,v $ ## @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/README,v $
## ##
## Under source code control: 1999/12/17 10:23:40 ## Under source code control: 1999/12/17 10:23:40

185
cscript/powerterm.calc Normal file
View File

@@ -0,0 +1,185 @@
#!/usr/local/bin/calc -q -s -f
/*
* powerterm - print the argument as a sum of powers of integers
*
* usage:
* powerterm [base_limit] value
*
* base_limit largest base we will consider (def: 10000)
* value value to convert into sums of powers of integers
*
* Copyright (C) 2001 Landon Curt Noll
*
* Calc is open software; you can redistribute it and/or modify it under
* the powerterm 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.5 $
* @(#) $Id: powerterm.calc,v 29.5 2001/04/25 08:41:36 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/powerterm.calc,v $
*
* Under source code control: 2001/04/24 23:49:11
* File existed as early as: 2001
*
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/
/*
* parse args
*/
config("verbose_quit", 0),;
base_lim = 10000; /* default: highest base we will consider */
if (argv() < 2 || argv() > 3) {
fprintf(files(2), "usage: %s [base_limit] value\n", argv(0));
exit;
}
if (argv() == 3) {
x = eval(argv(2));
base_lim = eval(argv(1));
} else {
x = eval(argv(1));
}
if (! isint(x)) {
fprintf(files(2), "%s: value must be an integer\n");
exit;
}
if (! isint(base_lim)) {
fprintf(files(2), "%s: base limit must be an integer\n");
exit;
}
if (base_lim <= 1) {
fprintf(files(2), "%s: base limit is too small\n");
exit;
}
++base_lim;
/*
* setup loop variables
*/
term = 0; /* number of powerterm found */
/*
* log constants
*/
if (base_lim <= 2^20+1) { /* 2^20 requires ~96 Megs of memory */
mat lni[base_lim]; /* log of integers */
for (i=2; i < base_lim; ++i) {
lni[i] = ln(i);
}
have_lni = 1; /* have lni[x] array */
} else {
mat lni[1]; /* not used */
have_lni = 0; /* base_lim too large for array */
}
/*
* remove nestest powers
*/
while (abs(x) >= base_lim) {
/*
* look for the nearest power
*/
lnx = ln(abs(x)); /* log of the remaining co-factor */
closest = 0.5;
base = 1;
exponent = 0;
if (have_lni) {
/*
* use pre-calculated log array when looking for the nearest power
*/
for (i = 2; i < base_lim; ++i) {
/*
* determine exponent closeness to an integer
*/
ex = lnx / lni[i];
power = int(ex + 0.5);
diff = ex - power;
/*
* look for a closer power
*/
if (abs(diff) < closest) {
closest = abs(diff);
base = i;
exponent = power;
}
}
} else {
/*
* re-calculate logs when looking for the nearest power
*/
for (i = 2; i < base_lim; ++i) {
/*
* determine exponent closeness to an integer
*/
ex = lnx / ln(i);
power = int(ex + 0.5);
diff = ex - power;
/*
* look for a closer power
*/
if (abs(diff) < closest) {
closest = abs(diff);
base = i;
exponent = power;
}
}
}
/*
* output current term and then subtract it
*/
if (x != 0) {
if (x < 0) {
print "-",;
} else if (term > 0) {
print "+",;
}
if (exponent > 1) {
print base: "^": exponent,;
} else {
print base,;
}
}
/*
* subtract (or add) this near power
*/
if (x < 0) {
x = x + base^exponent;
} else {
x = x - base^exponent;
}
++term;
}
/*
* print the final term
*/
if (x < 0) {
print "-", -x;
} else if (x > 0) {
print "+", x;
} else {
print "";
}
exit;

View File

@@ -18,8 +18,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.6 $ # @(#) $Revision: 29.11 $
# @(#) $Id: Makefile,v 29.6 2001/04/08 10:53:52 chongo Exp $ # @(#) $Id: Makefile,v 29.11 2001/05/28 22:23:56 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile,v $ # @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile,v $
# #
# Under source code control: 1997/03/09 02:28:54 # Under source code control: 1997/03/09 02:28:54
@@ -93,21 +93,28 @@ Q=@
# #
# where to install things # where to install things
# #
# ${TOPDIR} is the directory under which the calc directory will be placed. # ${SHAREDIR} where most common shared files are kept
# ${LIBDIR} is where the *.cal, *.h, *.a, bindings and help dir are installed. # ${INCDIR} where most .h files are kept
# ${HELPDIR} is where the help directory is installed.
# ${CUSTOMLIBDIR} is where custom lib files are installed.
# ${CUSTOMHELPDIR} is where custom help files are installed.
# #
TOPDIR= /usr/local/lib # ${CSHAREDIR} where most common shared calc files are kept
#TOPDIR= /usr/lib # ${HELPDIR} where the help directory is installed.
#TOPDIR= /usr/libdata # ${INCDIRCALC} where the calc include files are installed
#TOPDIR= /usr/contrib/lib # ${CUSTOMLIBDIR} where custom *.cal files & libcustcalc.a are installed.
# ${CUSTOMHELPDIR} where custom help files are installed.
# ${CUSTOMINCPDIR} where custom .h files are installed.
# #
LIBDIR= ${TOPDIR}/calc #SHAREDIR= /usr/local/lib
HELPDIR= ${LIBDIR}/help SHAREDIR= /usr/share
CUSTOMLIBDIR= ${LIBDIR}/custom #
CUSTOMHELPDIR= ${HELPDIR}/custhelp #INCDIR= /usr/local/include
INCDIR= /usr/include
#
CSHAREDIR= ${SHAREDIR}/calc
HELPDIR= ${CSHAREDIR}/help
INCDIRCALC= ${INCDIR}/calc
CUSTOMLIBDIR= ${CSHAREDIR}/custom
CUSTOMHELPDIR= ${CSHAREDIR}/custhelp
CUSTOMINCDIR= ${INCDIRCALC}/custom
# Normally, the upper level makefile will set these values. We provide # Normally, the upper level makefile will set these values. We provide
# a default here just in case you want to build from this directory. # a default here just in case you want to build from this directory.
@@ -288,9 +295,13 @@ DISTLIST= ${CUSTCALC_SRC} ${CUSTOM_CALC_FILES} ${CUSTOM_HELP} \
# #
CALCLIBLIST= ${CUSTCALC_SRC} ${INSTALL_H_SRC} ${MAKE_FILE} HOW_TO_ADD CALCLIBLIST= ${CUSTCALC_SRC} ${INSTALL_H_SRC} ${MAKE_FILE} HOW_TO_ADD
# This is the custom .a link library that is build
#
CALC_LIBCUSTOM= libcustcalc.a
# complete list of targets # complete list of targets
# #
TARGETS= libcustcalc.a ${CUSTCALC_OBJ} TARGETS= ${CALC_LIBCUSTOM} ${CUSTCALC_OBJ}
# required vars # required vars
# #
@@ -303,6 +314,7 @@ SED= sed
MAKEDEPEND= makedepend MAKEDEPEND= makedepend
CHMOD= chmod CHMOD= chmod
SORT= sort SORT= sort
CMP= cmp
## ##
# #
@@ -313,7 +325,7 @@ SORT= sort
all: ${TARGETS} ${INSTALL_H_SRC} ${CUSTOM_CALC_FILES} \ all: ${TARGETS} ${INSTALL_H_SRC} ${CUSTOM_CALC_FILES} \
${CUSTOM_HELP} ${MAKE_FILE} .all ${CUSTOM_HELP} ${MAKE_FILE} .all
libcustcalc.a: ${CUSTCALC_OBJ} ${MAKE_FILE} ../Makefile libcustcalc.a: ${CUSTCALC_OBJ} ${MAKE_FILE} ../${MAKE_FILE}
-rm -f libcustcalc.a -rm -f libcustcalc.a
ar qc libcustcalc.a ${CUSTCALC_OBJ} ar qc libcustcalc.a ${CUSTCALC_OBJ}
${RANLIB} libcustcalc.a ${RANLIB} libcustcalc.a
@@ -435,7 +447,7 @@ depend:
${Q}${SED} -n '3,$$p' skel/custom/makedep.out | \ ${Q}${SED} -n '3,$$p' skel/custom/makedep.out | \
LANG=C ${SORT} -u >> Makefile LANG=C ${SORT} -u >> Makefile
-${Q}rm -rf skel -${Q}rm -rf skel
-${Q}if cmp -s Makefile.bak Makefile; then \ -${Q}if ${CMP} -s Makefile.bak Makefile; then \
echo 'custom Makefile was already up to date'; \ echo 'custom Makefile was already up to date'; \
mv -f Makefile.bak Makefile; \ mv -f Makefile.bak Makefile; \
else \ else \
@@ -450,6 +462,35 @@ depend:
fi; \ fi; \
fi fi
##
#
# rpm rules
#
##
echo_INSTALL_H_SRC: ${MAKE_FILE}
@echo ${INSTALL_H_SRC}
echo_CUSTOM_CALC_FILES: ${MAKE_FILE}
@echo ${CUSTOM_CALC_FILES}
echo_CUSTOM_HELP: ${MAKE_FILE}
@echo ${CUSTOM_HELP}
echo_install.list: ${MAKE_FILE}
@for i in ${INSTALL_H_SRC}; do \
echo ${CUSTOMINCDIR}/$$i; \
done
@for i in ${CUSTOM_HELP}; do \
echo ${CUSTOMHELPDIR}/$$i; \
done
@for i in ${CUSTOM_CALC_FILES}; do \
echo ${CUSTOMLIBDIR}/$$i; \
done
@for i in ${CALC_LIBCUSTOM}; do \
echo ${CUSTOMLIBDIR}/$$i; \
done
## ##
# #
# Utility rules # Utility rules
@@ -464,70 +505,119 @@ clobber:
rm -f .all Makefile.tmp Makefile.bak rm -f .all Makefile.tmp Makefile.bak
install: all install: all
-${Q}if [ ! -d ${TOPDIR} ]; then \ -${Q}if [ ! -d ${SHAREDIR} ]; then \
echo mkdir ${TOPDIR}; \ echo mkdir ${SHAREDIR}; \
mkdir ${TOPDIR}; \ mkdir ${SHAREDIR}; \
echo ${CHMOD} 0755 ${SHAREDIR}; \
${CHMOD} 0755 ${SHAREDIR}; \
else \ else \
true; \ true; \
fi fi
-${Q}if [ ! -d ${LIBDIR} ]; then \ -${Q}if [ ! -d ${INCDIR} ]; then \
echo mkdir ${LIBDIR}; \ echo mkdir ${INCDIR}; \
mkdir ${LIBDIR}; \ mkdir ${INCDIR}; \
echo ${CHMOD} 0755 ${INCDIR}; \
${CHMOD} 0755 ${INCDIR}; \
else \
true; \
fi
-${Q}if [ ! -d ${CSHAREDIR} ]; then \
echo mkdir ${CSHAREDIR}; \
mkdir ${CSHAREDIR}; \
echo ${CHMOD} 0755 ${CSHAREDIR}; \
${CHMOD} 0755 ${CSHAREDIR}; \
else \
true; \
fi
-${Q}if [ ! -d ${INCDIRCALC} ]; then \
echo mkdir ${INCDIRCALC}; \
mkdir ${INCDIRCALC}; \
echo ${CHMOD} 0755 ${INCDIRCALC}; \
${CHMOD} 0755 ${INCDIRCALC}; \
else \ else \
true; \ true; \
fi fi
-${Q}if [ ! -d ${HELPDIR} ]; then \ -${Q}if [ ! -d ${HELPDIR} ]; then \
echo mkdir ${HELPDIR}; \ echo mkdir ${HELPDIR}; \
mkdir ${HELPDIR}; \ mkdir ${HELPDIR}; \
echo ${CHMOD} 0755 ${HELPDIR}; \
${CHMOD} 0755 ${HELPDIR}; \
else \ else \
true; \ true; \
fi fi
-${Q}if [ ! -d ${CUSTOMLIBDIR} ]; then \ -${Q}if [ ! -d ${CUSTOMLIBDIR} ]; then \
echo mkdir ${CUSTOMLIBDIR}; \ echo mkdir ${CUSTOMLIBDIR}; \
mkdir ${CUSTOMLIBDIR}; \ mkdir ${CUSTOMLIBDIR}; \
echo ${CHMOD} 0755 ${CUSTOMLIBDIR}; \
${CHMOD} 0755 ${CUSTOMLIBDIR}; \
else \ else \
true; \ true; \
fi fi
-${Q}if [ ! -d ${CUSTOMHELPDIR} ]; then \ -${Q}if [ ! -d ${CUSTOMHELPDIR} ]; then \
echo mkdir ${CUSTOMHELPDIR}; \ echo mkdir ${CUSTOMHELPDIR}; \
mkdir ${CUSTOMHELPDIR}; \ mkdir ${CUSTOMHELPDIR}; \
echo ${CHMOD} 0755 ${CUSTOMHELPDIR}; \
${CHMOD} 0755 ${CUSTOMHELPDIR}; \
else \ else \
true; \ true; \
fi fi
${Q}for i in ${INSTALL_H_SRC} /dev/null; do \ -${Q}if [ ! -d ${CUSTOMINCDIR} ]; then \
if [ X$$i = X/dev/null ]; then continue; fi; \ echo mkdir ${CUSTOMINCDIR}; \
echo rm -f ${CUSTOMLIBDIR}/$$i; \ mkdir ${CUSTOMINCDIR}; \
rm -f ${CUSTOMLIBDIR}/$$i; \ echo ${CHMOD} 0755 ${CUSTOMINCDIR}; \
echo cp $$i ${CUSTOMLIBDIR}; \ ${CHMOD} 0755 ${CUSTOMINCDIR}; \
cp $$i ${CUSTOMLIBDIR}; \ else \
echo ${CHMOD} 0444 ${CUSTOMLIBDIR}/$$i; \ true; \
${CHMOD} 0444 ${CUSTOMLIBDIR}/$$i; \ fi
-${Q}for i in ${INSTALL_H_SRC}; do \
rm -f tmp; \
${SED} -e 's/^\(#[ ]*include[ ][ ]*\)"/\1"calc\//' $$i > tmp; \
if ${CMP} -s tmp ${CUSTOMINCDIR}/$$i; then \
true; \
else \
rm -f ${CUSTOMINCDIR}/$$i; \
cp -f tmp ${INCDIRCALC}/$$i.new; \
cp -f $$i ${CUSTOMINCDIR}/$$i.new; \
${CHMOD} 0444 ${CUSTOMINCDIR}/$$i.new; \
mv -f ${CUSTOMINCDIR}/$$i.new ${CUSTOMINCDIR}/$$i; \
echo "installed ${CUSTOMINCDIR}/$$i"; \
fi; \
done done
${Q}for i in ${CUSTOM_CALC_FILES}; do \ -${Q}rm -f tmp
echo rm -f ${CUSTOMLIBDIR}/$$i; \ -${Q}for i in ${CUSTOM_CALC_FILES}; do \
if ${CMP} -s $$i ${CUSTOMLIBDIR}/$$i; then \
true; \
else \
rm -f ${CUSTOMLIBDIR}/$$i; \ rm -f ${CUSTOMLIBDIR}/$$i; \
echo cp $$i ${CUSTOMLIBDIR}; \ cp -f $$i ${CUSTOMLIBDIR}/$$i; \
cp $$i ${CUSTOMLIBDIR}; \ ${CHMOD} 0444 ${CUSTOMLIBDIR}/$$i.new; \
echo ${CHMOD} 0444 ${CUSTOMLIBDIR}/$$i; \ mv -f ${CUSTOMLIBDIR}/$$i.new ${CUSTOMLIBDIR}/$$i; \
${CHMOD} 0444 ${CUSTOMLIBDIR}/$$i; \ echo "installed ${CUSTOMLIBDIR}/$$i"; \
fi; \
done done
${Q}for i in ${CUSTOM_HELP}; do \ -${Q}for i in ${CUSTOM_HELP}; do \
echo rm -f ${CUSTOMHELPDIR}/$$i; \ if ${CMP} -s $$i ${CUSTOMHELPDIR}/$$i; then \
true; \
else \
rm -f ${CUSTOMHELPDIR}/$$i; \ rm -f ${CUSTOMHELPDIR}/$$i; \
echo cp $$i ${CUSTOMHELPDIR}; \ cp -f $$i ${CUSTOMHELPDIR}/$$i.new; \
cp $$i ${CUSTOMHELPDIR}; \ ${CHMOD} 0444 ${CUSTOMHELPDIR}/$$i.new; \
echo ${CHMOD} 0444 ${CUSTOMHELPDIR}/$$i; \ mv -f ${CUSTOMHELPDIR}/$$i.new ${CUSTOMHELPDIR}/$$i; \
${CHMOD} 0444 ${CUSTOMHELPDIR}/$$i; \ echo "installed ${CUSTOMHELPDIR}/$$i"; \
fi; \
done done
-${Q}if [ ! -z ${ALLOW_CUSTOM} ]; then \ -${Q}if [ ! -z ${ALLOW_CUSTOM} ]; then \
echo "rm -f ${CUSTOMLIBDIR}/libcustcalc.a"; \ if ${CMP} -s libcustcalc.a ${CUSTOMLIBDIR}/libcustcalc.a; then \
rm -f ${CUSTOMLIBDIR}/libcustcalc.a; \ true; \
echo "cp libcustcalc.a ${CUSTOMLIBDIR}/libcustcalc.a"; \ else \
cp libcustcalc.a ${CUSTOMLIBDIR}/libcustcalc.a; \ rm -f ${CUSTOMLIBDIR}/libcustcalc.a.new; \
echo "${CHMOD} 0644 ${CUSTOMLIBDIR}/libcustcalc.a"; \ cp -f libcustcalc.a ${CUSTOMLIBDIR}/libcustcalc.a.new; \
${CHMOD} 0644 ${CUSTOMLIBDIR}/libcustcalc.a; \ ${CHMOD} 0644 ${CUSTOMLIBDIR}/libcustcalc.a; \
echo "${RANLIB} ${CUSTOMLIBDIR}/libcustcalc.a"; \ mv -f ${CUSTOMLIBDIR}/libcustcalc.a.new \
${CUSTOMLIBDIR}/libcustcalc.a; \
${RANLIB} ${CUSTOMLIBDIR}/libcustcalc.a; \ ${RANLIB} ${CUSTOMLIBDIR}/libcustcalc.a; \
echo "installed ${CUSTOMLIBDIR}/libcustcalc.a"; \
fi; \
fi fi
## ##

View File

@@ -18,8 +18,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.6 $ # @(#) $Revision: 29.12 $
# @(#) $Id: Makefile,v 29.6 2001/04/08 10:53:52 chongo Exp $ # @(#) $Id: Makefile,v 29.12 2001/05/28 22:36:28 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/help/RCS/Makefile,v $ # @(#) $Source: /usr/local/src/cmd/calc/help/RCS/Makefile,v $
# #
# Under source code control: 1991/07/23 06:47:57 # Under source code control: 1991/07/23 06:47:57
@@ -36,15 +36,16 @@
SHELL= /bin/sh SHELL= /bin/sh
MAKE_FILE = Makefile MAKE_FILE = Makefile
# Normally, the upper level makefile will set these values. We provide # ${SHAREDIR} where most common shared files are kept
# a default here just in case you want to build from this directory.
# #
TOPDIR= /usr/local/lib # ${CSHAREDIR} where most common shared calc files are kept
#TOPDIR= /usr/lib # ${HELPDIR} where the help directory is installed.
#TOPDIR= /usr/libdata #
#SHAREDIR= /usr/local/lib
SHAREDIR= /usr/share
LIBDIR= ${TOPDIR}/calc CSHAREDIR= ${SHAREDIR}/calc
HELPDIR= ${LIBDIR}/help HELPDIR= ${CSHAREDIR}/help
# Makefile debug # Makefile debug
# #
@@ -63,6 +64,7 @@ CHMOD= chmod
SED= sed SED= sed
SORT= sort SORT= sort
FMT= fmt FMT= fmt
CMP= cmp
# Standard and Builtin help files # Standard and Builtin help files
# #
@@ -489,6 +491,37 @@ detaillist:
${SED} -e '1s/xxxxx/DETAIL_HELP=/' -e '2,$$s/^/ /' \ ${SED} -e '1s/xxxxx/DETAIL_HELP=/' -e '2,$$s/^/ /' \
-e 's/$$/ \\/' -e '$$s/ \\$$//' -e 's/$$/ \\/' -e '$$s/ \\$$//'
##
#
# rpm rules
#
##
echo_STD_HELP_FILES: ${MAKE_FILE}
@echo ${STD_HELP_FILES}
echo_BLT_HELP_FILES: ${MAKE_FILE}
@echo ${BLT_HELP_FILES}
echo_DETAIL_HELP: ${MAKE_FILE}
@echo ${DETAIL_HELP}
echo_SINGULAR_FILES: ${MAKE_FILE}
@echo ${SINGULAR_FILES}
echo_install.list: ${MAKE_FILE}
@for i in ${STD_HELP_FILES} full ${BLT_HELP_FILES} \
builtin ${DETAIL_HELP} ${SINGULAR_FILES}; do \
echo ${HELPDIR}/$$i; \
done
@echo ${HELPDIR}/obj
##
#
# Utility rules
#
##
clean: clean:
rm -f obj mkbuiltin funclist.c funclist.o funclist rm -f obj mkbuiltin funclist.c funclist.o funclist
rm -f COPYING COPYING-LGPL rm -f COPYING COPYING-LGPL
@@ -500,36 +533,48 @@ clobber:
rm -f ${SINGULAR_FILES} ${DETAIL_CLONE} rm -f ${SINGULAR_FILES} ${DETAIL_CLONE}
install: all install: all
-${Q}if [ ! -d ${TOPDIR} ]; then \ -${Q}if [ ! -d ${SHAREDIR} ]; then \
echo mkdir ${TOPDIR}; \ echo mkdir ${SHAREDIR}; \
mkdir ${TOPDIR}; \ mkdir ${SHAREDIR}; \
echo ${CHMOD} 0755 ${SHAREDIR}; \
${CHMOD} 0755 ${SHAREDIR}; \
else \ else \
true; \ true; \
fi fi
-${Q}if [ ! -d ${LIBDIR} ]; then \ -${Q}if [ ! -d ${CSHAREDIR} ]; then \
echo mkdir ${LIBDIR}; \ echo mkdir ${CSHAREDIR}; \
mkdir ${LIBDIR}; \ mkdir ${CSHAREDIR}; \
echo ${CHMOD} 0755 ${CSHAREDIR}; \
${CHMOD} 0755 ${CSHAREDIR}; \
else \ else \
true; \ true; \
fi fi
-${Q}if [ ! -d ${HELPDIR} ]; then \ -${Q}if [ ! -d ${HELPDIR} ]; then \
echo mkdir ${HELPDIR}; \ echo mkdir ${HELPDIR}; \
mkdir ${HELPDIR}; \ mkdir ${HELPDIR}; \
echo ${CHMOD} 0755 ${HELPDIR}; \
${CHMOD} 0755 ${HELPDIR}; \
else \ else \
true; \ true; \
fi fi
${Q}for i in ${STD_HELP_FILES} ${BLT_HELP_FILES} builtin \ -${Q}for i in ${STD_HELP_FILES} ${BLT_HELP_FILES} builtin \
full ${DETAIL_HELP} ${SINGULAR_FILES}; do \ full ${DETAIL_HELP} ${SINGULAR_FILES}; do \
echo rm -f ${HELPDIR}/$$i; \ if ${CMP} -s $$i ${HELPDIR}/$$i; then \
rm -f ${HELPDIR}/$$i; \ true; \
echo cp $$i ${HELPDIR}; \ else \
cp $$i ${HELPDIR}; \ rm -f ${HELPDIR}/$$i.new; \
echo ${CHMOD} 0444 ${HELPDIR}/$$i; \ cp -f $$i ${HELPDIR}/$$i.new; \
${CHMOD} 0444 ${HELPDIR}/$$i; \ ${CHMOD} 0444 ${HELPDIR}/$$i.new; \
mv -f ${HELPDIR}/$$i.new ${HELPDIR}/$$i; \
echo "installed ${HELPDIR}/$$i"; \
fi; \
done done
rm -f ${HELPDIR}/obj -${Q}if ${CMP} -s obj.file ${HELPDIR}/obj; then \
cp obj.file ${HELPDIR}/obj true; \
${CHMOD} 0444 ${HELPDIR}/obj else \
${Q}echo remove files that are obsolete rm -f ${HELPDIR}/obj.new; \
-rm -f rmblk block stdlib cp -f obj.file ${HELPDIR}/obj.new; \
-rm -f ${HELPDIR}/rmblk ${HELPDIR}/block ${HELPDIR}/stdlib ${CHMOD} 0444 ${HELPDIR}/obj.new; \
mv -f ${HELPDIR}/obj.new ${HELPDIR}/obj; \
echo "installed ${HELPDIR}/obj"; \
fi

View File

@@ -580,12 +580,14 @@ Detailed config descriptions
The "verbose_quit" controls the print of the message: The "verbose_quit" controls the print of the message:
Quit or abort executed quit or abort executed
when a non-interactive quit or abort without an argument is encountered. when a non-interactive quit or abort without an argument is encountered.
A quit of abort without an argument does not display a message when A quit of abort without an argument does not display a message when
invoked at the interactive level. invoked at the interactive level.
By deafult, "verbose_quit" is false.
=-= =-=
config("ctrl_d", "ctrl_d_string") config("ctrl_d", "ctrl_d_string")
@@ -711,8 +713,8 @@ Detailed config descriptions
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## ##
## @(#) $Revision: 29.5 $ ## @(#) $Revision: 29.6 $
## @(#) $Id: config,v 29.5 2001/04/14 22:46:33 chongo Exp $ ## @(#) $Id: config,v 29.6 2001/04/25 07:17:38 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/config,v $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/config,v $
## ##
## Under source code control: 1991/07/21 04:37:17 ## Under source code control: 1991/07/21 04:37:17

View File

@@ -19,9 +19,9 @@ DESCRIPTION
is almost certainly non-chaotic. This function is likely not is almost certainly non-chaotic. This function is likely not
suitable for applications (such as cryptographic applications) suitable for applications (such as cryptographic applications)
where the unpredictability of seeds is critical. For such critical where the unpredictability of seeds is critical. For such critical
applications, lavarand should be used. See the URL: applications, LavaRnd should be used. See the URL:
http://lavarand.sgi.com/index.html http://www.LavaRnd.org/
for information about seeding a pseudo-random number generator for information about seeding a pseudo-random number generator
(such as rand() or random()) with the cryptographic hash of the (such as rand() or random()) with the cryptographic hash of the
@@ -67,8 +67,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## ##
## @(#) $Revision: 29.2 $ ## @(#) $Revision: 29.3 $
## @(#) $Id: seed,v 29.2 2000/06/07 14:02:33 chongo Exp $ ## @(#) $Id: seed,v 29.3 2001/05/13 13:26:26 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/seed,v $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/seed,v $
## ##
## Under source code control: 1999/10/03 10:04:29 ## Under source code control: 1999/10/03 10:04:29

View File

@@ -220,11 +220,11 @@ DESCRIPTION
Blum moduli. Blum moduli.
The pre-defined Blum moduli and quadratic residues were selected The pre-defined Blum moduli and quadratic residues were selected
by lavarand, a hardware random number generator. See the URL: by LavaRnd, a hardware random number generator. See the URL:
http://lavarand.sgi.com/index.html http://www.LavaRnd.org/
for an explanation of how the lavarand random number generator works. for an explanation of how the LavaRnd random number generator works.
For more information, see the comments at the top of the calc For more information, see the comments at the top of the calc
source file, zrandom.c. source file, zrandom.c.
@@ -354,8 +354,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## ##
## @(#) $Revision: 29.2 $ ## @(#) $Revision: 29.3 $
## @(#) $Id: srandom,v 29.2 2000/06/07 14:02:33 chongo Exp $ ## @(#) $Id: srandom,v 29.3 2001/05/13 13:26:26 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/srandom,v $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/srandom,v $
## ##
## Under source code control: 1997/02/17 01:18:22 ## Under source code control: 1997/02/17 01:18:22

View File

@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.3 $ * @(#) $Revision: 29.4 $
* @(#) $Id: opcodes.c,v 29.3 2000/07/17 15:35:49 chongo Exp $ * @(#) $Id: opcodes.c,v 29.4 2001/04/25 07:16:26 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/opcodes.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/opcodes.c,v $
* *
* Under source code control: 1990/02/15 01:48:19 * Under source code control: 1990/02/15 01:48:19
@@ -3234,7 +3234,7 @@ o_quit(FUNC *fp, long index)
if (cp) if (cp)
printf("%s\n", cp); printf("%s\n", cp);
else if (conf->verbose_quit) else if (conf->verbose_quit)
printf("Quit or abort executed\n"); printf("quit or abort executed\n");
if (!inputisterminal() && !strcmp(fp->f_name, "*")) if (!inputisterminal() && !strcmp(fp->f_name, "*"))
closeinput(); closeinput();
go = FALSE; go = FALSE;

View File

@@ -17,8 +17,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.5 $ # @(#) $Revision: 29.9 $
# @(#) $Id: Makefile,v 29.5 2001/04/08 10:53:52 chongo Exp $ # @(#) $Id: Makefile,v 29.9 2001/05/28 22:27:15 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/sample/RCS/Makefile,v $ # @(#) $Source: /usr/local/src/cmd/calc/sample/RCS/Makefile,v $
# #
# Under source code control: 1997/04/19 22:46:49 # Under source code control: 1997/04/19 22:46:49
@@ -78,18 +78,30 @@ Q=@
# Normally, the upper level makefile will set these values. We provide # Normally, the upper level makefile will set these values. We provide
# a default here just in case you want to build from this directory. # a default here just in case you want to build from this directory.
# #
# where to install things # where things go
# #
# ${TOPDIR} is the directory under which the calc directory will be placed. # ${BINDIR} where to install binary files
# ${LIBDIR} is where the *.cal, *.h, *.a, bindings and help dir are installed. # ${SHAREDIR} where most common shared files are kept
# ${HELPDIR} is where the help directory is installed. # ${INCDIR} where most .h files are kept
# ${LIBDIR} where *.a files are installed
# #
TOPDIR= /usr/local/lib # ${CSHAREDIR} where most common shared calc files are kept
#TOPDIR= /usr/lib # ${HELPDIR} where the help directory is installed.
#TOPDIR= /usr/libdata
#TOPDIR= /usr/contrib/lib
# #
LIBDIR= ${TOPDIR}/calc #BINDIR= /usr/local/bin
BINDIR= /usr/bin
#BINDIR= /usr/contrib/bin
#
#SHAREDIR= /usr/local/lib
SHAREDIR= /usr/share
#
#INCDIR= /usr/local/include
INCDIR= /usr/include
#
#LIBDIR= /usr/local/lib
LIBDIR= /usr/lib
CSHAREDIR= ${SHAREDIR}/calc
HELPDIR= ${LIBDIR}/help HELPDIR= ${LIBDIR}/help
# Normally, the upper level makefile will set these values. We provide # Normally, the upper level makefile will set these values. We provide
@@ -266,12 +278,15 @@ CALCLIBLIST= ${C_SRC} ${H_SRC} ${MAKE_FILE} README_SAMPLE
# complete list of targets # complete list of targets
# #
TARGETS= many_random test_random # NOTE: This list MUST be co-ordinated with the ${SAMPLE_TARGETS} variable
# in the upper level ../Makefile
#
SAMPLE_TARGETS= many_random test_random
TARGETS= ${SAMPLE_TARGETS}
# required vars # required vars
# #
SHELL= /bin/sh SHELL= /bin/sh
MAKE_FILE= Makefile
# standard tools # standard tools
# #
@@ -279,6 +294,7 @@ SED= sed
MAKEDEPEND= makedepend MAKEDEPEND= makedepend
CHMOD= chmod CHMOD= chmod
SORT= sort SORT= sort
CMP= cmp
## ##
# #
@@ -287,6 +303,7 @@ SORT= sort
## ##
all: ${TARGETS} .all all: ${TARGETS} .all
@true
test_random.o: test_random.c test_random.o: test_random.c
${CC} ${CFLAGS} ${ALLOW_CUSTOM} test_random.c -c ${CC} ${CFLAGS} ${ALLOW_CUSTOM} test_random.c -c
@@ -407,7 +424,7 @@ depend:
${Q}${SED} -n '3,$$p' skel/sample/makedep.out | \ ${Q}${SED} -n '3,$$p' skel/sample/makedep.out | \
LANG=C ${SORT} -u >> Makefile LANG=C ${SORT} -u >> Makefile
-${Q}rm -rf skel -${Q}rm -rf skel
-${Q}if cmp -s Makefile.bak Makefile; then \ -${Q}if ${CMP} -s Makefile.bak Makefile; then \
echo 'sample Makefile was already up to date'; \ echo 'sample Makefile was already up to date'; \
mv -f Makefile.bak Makefile; \ mv -f Makefile.bak Makefile; \
else \ else \
@@ -422,6 +439,15 @@ depend:
fi; \ fi; \
fi fi
##
#
# rpm rules
#
##
echo_install.list: Makefile
## ##
# #
# Utility rules # Utility rules
@@ -437,7 +463,9 @@ clobber:
rm -f .all Makefile.tmp sample rm -f .all Makefile.tmp sample
# for right now we will not install anything # for right now we will not install anything
#
install: all install: all
@true
## ##
# #

12
seed.c
View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.4 $ * @(#) $Revision: 29.5 $
* @(#) $Id: seed.c,v 29.4 2001/03/17 21:31:47 chongo Exp $ * @(#) $Id: seed.c,v 29.5 2001/05/08 06:44:29 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/seed.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/seed.c,v $
* *
* Under source code control: 1999/10/03 10:06:53 * Under source code control: 1999/10/03 10:06:53
@@ -31,10 +31,10 @@
/* /*
* Generate a quasi-random seed based on system and process information. * Generate a quasi-random seed based on system and process information.
* *
* NOTE: This is not a good source of chaotic data. The lavarand * NOTE: This is not a good source of chaotic data. The LavaRnd
* system does a much better job of that. See: * system does a much better job of that. See:
* *
* http://lavarand.sgi.com/index.html * http://www.LavaRnd.org/
*/ */
@@ -270,10 +270,10 @@ hash_buf(char *buf, unsigned len)
* *
* Generate a quasi-random seed based on system and process information. * Generate a quasi-random seed based on system and process information.
* *
* NOTE: This is not a good source of chaotic data. The lavarand * NOTE: This is not a good source of chaotic data. The LavaRnd
* system does a much better job of that. See: * system does a much better job of that. See:
* *
* http://lavarand.sgi.com/index.html * http://www.LavaRnd.org/
* *
* PORTING NOTE: * PORTING NOTE:
* If when porting this code to your system and something * If when porting this code to your system and something

98
spec-template Normal file
View File

@@ -0,0 +1,98 @@
Summary: C-style arbitrary precision calculator
Name: calc
Version: ${VERSION}
Release: ${RELEASE}
Copyright: LGPL
Group: Applications/Engineering
Source: http://www.isthe.com/chongo/src/calc/calc-${VER_CALC}.tar.gz
BuildRoot: /var/tmp/%{name}-buildroot
%description
Calc is an interactive calculator which provides for easy large numeric
calculations, but which also can be easily programmed for difficult or
long calculations.
All numbers are represented as fractions with arbitrarily large numerators
and denominators which are always reduced to lowest terms. Real or
exponential format numbers are converted to the equivalent fraction.
One use enter decinal, hex, octal, binary and complex values.
Commands are statements in a C-like language, where each input line is
treated as the body of a procedure. You can define your own functions
by using the 'define' keyword, followed by a function declaration very
similar to C. Calc also comes with a rich set of builtin functions
and calc shell commands.
In addition to numeric global, local and static variables, Calc as
lists, associated arrays, matrices, byte blocks, dymanic strings and
user defined objects.
%prep
%setup -q
%build
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT${BINDIR}
mkdir -p $RPM_BUILD_ROOT${SHAREDIR}
mkdir -p $RPM_BUILD_ROOT${INCDIR}
mkdir -p $RPM_BUILD_ROOT${LIBDIR}
mkdir -p $RPM_BUILD_ROOT${CSHAREDIR}
mkdir -p $RPM_BUILD_ROOT${HELPDIR}
mkdir -p $RPM_BUILD_ROOT${INCDIRCALC}
mkdir -p $RPM_BUILD_ROOT${CUSTOMLIBDIR}
mkdir -p $RPM_BUILD_ROOT${CUSTOMHELPDIR}
mkdir -p $RPM_BUILD_ROOT${CUSTOMINCDIR}
mkdir -p $RPM_BUILD_ROOT${SCRIPTDIR}
mkdir -p $RPM_BUILD_ROOT${MANDIR}
install -m 0555 calc $RPM_BUILD_ROOT${BINDIR}
(cd help
install -m 0444 ${STD_HELP_FILES} $RPM_BUILD_ROOT${HELPDIR}
install -m 0444 ${BLT_HELP_FILES} $RPM_BUILD_ROOT${HELPDIR}
install -m 0444 builtin full $RPM_BUILD_ROOT${HELPDIR}
install -m 0444 ${DETAIL_HELP} $RPM_BUILD_ROOT${HELPDIR}
install -m 0444 ${SINGULAR_FILES} $RPM_BUILD_ROOT${HELPDIR}
install -m 0444 obj.file $RPM_BUILD_ROOT${HELPDIR}/obj
)
(cd cal; install -m 0444 ${CALC_FILES} $RPM_BUILD_ROOT${LIBDIR})
(cd custom
if [ ! -z "${INSTALL_H_SRC}" ]; then
install -m 0444 ${INSTALL_H_SRC} $RPM_BUILD_ROOT${CUSTOMINCDIR}
fi
install -m 0444 ${CUSTOM_CALC_FILES} $RPM_BUILD_ROOT${CUSTOMLIBDIR}
install -m 0444 ${CUSTOM_HELP} $RPM_BUILD_ROOT${CUSTOMHELPDIR}
if [ ! -z "${ALLOW_CUSTOM}" ]; then
install -m 0644 libcustcalc.a $RPM_BUILD_ROOT${CUSTOMLIBDIR}
${RANLIB} $RPM_BUILD_ROOT${CUSTOMLIBDIR}
fi
)
(cd cscript
install -m 0555 ${SCRIPT} $RPM_BUILD_ROOT${SCRIPTDIR}
)
install -m 0444 libcalc.a $RPM_BUILD_ROOT${LIBDIR}
${RANLIB} $RPM_BUILD_ROOT${LIBDIR}
install -m 0444 ${LIB_H_SRC} $RPM_BUILD_ROOT${INCDIRCALC}
install -m 0444 ${BUILD_H_SRC} $RPM_BUILD_ROOT${INCDIRCALC}
install -m 0444 calc.1 $RPM_BUILD_ROOT${MANDIR}.${MANEXT}
%clean
rm -rf $RPM_BUILD_ROOT
%files -f install.list
%defattr(-,root,root)
%doc BUGS README COPYING COPYING-LGPL HOWTO.INSTALL
%doc README LIBRARY README.WINDOWS calc.1
%doc help/resource help/errorcodes help/custom_cal help/new_custom
%doc help/cscript help/full
%changelog
* ${DATE} Landon Curt Noll <http://www.isthe.com/chongo/index.html>
- calc version ${VER_CALC}

View File

@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.24 $ * @(#) $Revision: 29.26 $
* @(#) $Id: version.c,v 29.24 2001/04/14 22:56:46 chongo Exp $ * @(#) $Id: version.c,v 29.26 2001/05/28 22:00:22 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $
* *
* Under source code control: 1990/05/22 11:00:58 * Under source code control: 1990/05/22 11:00:58
@@ -43,7 +43,7 @@ static char *program;
#define MAJOR_VER 2 /* major version */ #define MAJOR_VER 2 /* major version */
#define MINOR_VER 11 /* minor version */ #define MINOR_VER 11 /* minor version */
#define MAJOR_PATCH 5 /* patch level or 0 if no patch */ #define MAJOR_PATCH 5 /* patch level or 0 if no patch */
#define MINOR_PATCH "3" /* test number or empty string if no patch */ #define MINOR_PATCH "4" /* test number or empty string if no patch */
/* /*
* calc version constants * calc version constants
@@ -144,6 +144,82 @@ version(void)
#if defined(CALC_VER) #if defined(CALC_VER)
/*
* print_rpm_version_release - print the rpm style version-release
*
* This function prints a version-release string, rpm style:
*
* x.y.z-w
* x.y.z-0
* x.y-0
*/
void
print_rpm_version_release(void)
{
/*
* form the version buffer
*/
if (sizeof(MINOR_PATCH) > 1) {
printf("%d.%d.%d-%s\n", calc_major_ver, calc_minor_ver,
calc_major_patch, calc_minor_patch);
} else if (MAJOR_PATCH > 0) {
printf("%d.%d.%d-0\n", calc_major_ver, calc_minor_ver,
calc_major_patch);
} else {
printf("%d.%d-0\n", calc_major_ver, calc_minor_ver);
}
return;
}
/*
* print_rpm_version - print just the version string, rpm style
*
* This function prints a version string, rpm style:
*
* x.y.z
* x.y
*/
void
print_rpm_version(void)
{
/*
* form the version buffer
*/
if (MAJOR_PATCH > 0) {
printf("%d.%d.%d\n", calc_major_ver, calc_minor_ver,
calc_major_patch);
} else {
printf("%d.%d\n", calc_major_ver, calc_minor_ver);
}
return;
}
/*
* print_rpm_release - print just the release string, rpm style
*
* This function prints a release string, rpm style:
*
* w
* 0
*/
void
print_rpm_release(void)
{
/*
* form the version buffer
*/
if (sizeof(MINOR_PATCH) > 1) {
printf("%s\n", calc_minor_patch);
} else {
printf("0\n");
}
return;
}
/* /*
* version - print the calc version * version - print the calc version
*/ */
@@ -152,7 +228,15 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
program = argv[0]; program = argv[0];
printf("%s\n", version()); if (argc == 2 && strcmp(argv[1], "-R") == 0) {
print_rpm_version_release();
} else if (argc == 2 && strcmp(argv[1], "-v") == 0) {
print_rpm_version();
} else if (argc == 2 && strcmp(argv[1], "-r") == 0) {
print_rpm_release();
} else {
printf("%s\n", version());
}
return 0; return 0;
} }

View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.3 $ * @(#) $Revision: 29.4 $
* @(#) $Id: zrand.c,v 29.3 2001/04/14 22:47:21 chongo Exp $ * @(#) $Id: zrand.c,v 29.4 2001/05/08 06:44:29 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zrand.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zrand.c,v $
* *
* Under source code control: 1995/01/07 09:45:25 * Under source code control: 1995/01/07 09:45:25
@@ -284,7 +284,7 @@
* SOURCE OF MAGIC NUMBERS: * SOURCE OF MAGIC NUMBERS:
* *
* Most of the magic constants used on this file ultimately are * Most of the magic constants used on this file ultimately are
* based on SGI Lavarand. SGI Lavarand produced a 5-way cryprographic * based on LavaRnd. LavaRnd produced them via a cryprographic
* of the digitization of chaotic system that consisted of a noisy * of the digitization of chaotic system that consisted of a noisy
* digital camera and 6 Lava Lite(R) lamps. * digital camera and 6 Lava Lite(R) lamps.
* *
@@ -568,7 +568,7 @@ static CONST RAND init_s100 = {
* *
* The subtractive 100 table in init_s100 has been processed 256 times in order * The subtractive 100 table in init_s100 has been processed 256 times in order
* to preload the shuffle table. The array below is the table before * to preload the shuffle table. The array below is the table before
* this processing. These values have came from Lavarand. * this processing. These values have came from LavaRnd.
* *
* This array is never changed, only copied. * This array is never changed, only copied.
*/ */

View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 29.3 $
* @(#) $Id: zrandom.c,v 29.2 2000/06/07 14:02:13 chongo Exp $ * @(#) $Id: zrandom.c,v 29.3 2001/05/08 06:44:29 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zrandom.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zrandom.c,v $
* *
* Under source code control: 1997/02/15 04:01:56 * Under source code control: 1997/02/15 04:01:56
@@ -356,33 +356,33 @@
* *
* The pre-defined Blum moduli was computed by searching for Blum * The pre-defined Blum moduli was computed by searching for Blum
* primes (primes == 3 mod 4) starting from new values that * primes (primes == 3 mod 4) starting from new values that
* were selected by lavarand, a hardware random number generator. * were selected by LavaRnd, a hardware random number generator.
* See the URL: * See the URL:
* *
* http://lavarand.sgi.com/index.html * http://www.LavaRnd.org/
* *
* for an explination of how the lavarand random number generator works. * for an explination of how the LavaRnd random number generator works.
* *
* For a given newn, we select a given bit length. For 0 < newn <= 20, * For a given newn, we select a given bit length. For 0 < newn <= 20,
* the bit length selected was by: * the bit length selected was by:
* *
* bitlen = 2^(int((newn-1)/4)+7) + small_random_value; * bitlen = 2^(int((newn-1)/4)+7) + small_random_value;
* *
* where small_random_value is also generated by lavarand. For * where small_random_value is also generated by LavaRnd. For
* 1 <= newn <= 16, small_random_value is a random value in [0,40). * 1 <= newn <= 16, small_random_value is a random value in [0,40).
* For 17 < newn <= 20, small_random_value is a random value in [0,120). * For 17 < newn <= 20, small_random_value is a random value in [0,120).
* Given two random integers generated by lavarand, we used the following * Given two random integers generated by LavaRnd, we used the following
* to compute Blum primes: * to compute Blum primes:
* *
* (* find the first Blum prime *) * (* find the first Blum prime *)
* fp = int((ip-1)/2); (* ip was generated by lavarand *) * fp = int((ip-1)/2); (* ip was generated by LavaRnd *)
* do { * do {
* fp = nextcand(fp+2, 25, 0, 3, 4); * fp = nextcand(fp+2, 25, 0, 3, 4);
* p = 2*fp+1; * p = 2*fp+1;
* } while (ptest(p, 25) == 0); * } while (ptest(p, 25) == 0);
* *
* (* find the 2nd Blum prime *) * (* find the 2nd Blum prime *)
* fq = int((iq-1)/2); (* iq was generated by lavarand *) * fq = int((iq-1)/2); (* iq was generated by LavaRnd *)
* do { * do {
* fq = nextcand(fq+2, 25, 0, 3, 4); * fq = nextcand(fq+2, 25, 0, 3, 4);
* q = 2*fq+1; * q = 2*fq+1;
@@ -391,8 +391,8 @@
* (* compute the Blum modulus *) * (* compute the Blum modulus *)
* n[newn] = p * q; * n[newn] = p * q;
* *
* The pre-defined quadratic residues was also generated by lavarand. * The pre-defined quadratic residues was also generated by LavaRnd.
* The value produced by lavarand was squared mod the Blum moduli * The value produced by LavaRnd was squared mod the Blum moduli
* that was previously computed. * that was previously computed.
* *
* The purpose of these pre-defined Blum moduli is to provide users with * The purpose of these pre-defined Blum moduli is to provide users with