mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
Release calc version 2.11.5t1.1
This commit is contained in:
@@ -17,8 +17,8 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# @(#) $Revision: 29.6 $
|
||||
# @(#) $Id: Makefile,v 29.6 2000/12/15 14:56:14 chongo Exp $
|
||||
# @(#) $Revision: 29.9 $
|
||||
# @(#) $Id: Makefile,v 29.9 2001/04/08 10:53:52 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1999/11/29 11:10:26
|
||||
@@ -76,9 +76,10 @@ FMT= fmt
|
||||
#
|
||||
# make detaillist
|
||||
#
|
||||
SCRIPT= mersenne piforever plus simple square
|
||||
SCRIPT= mersenne piforever plus simple square fproduct
|
||||
|
||||
SCRIPT_SRC= mersenne.calc piforever.calc plus.calc simple.calc square.calc
|
||||
SCRIPT_SRC= mersenne.calc piforever.calc plus.calc simple.calc square.calc \
|
||||
fproduct.calc
|
||||
|
||||
# These files are found (but not built) in the distribution
|
||||
#
|
||||
@@ -114,7 +115,7 @@ all: ${SCRIPT} ${SCRIPT_SRC} .all
|
||||
distlist: ${DISTLIST}
|
||||
${Q}for i in ${DISTLIST}; do \
|
||||
echo cscript/$$i; \
|
||||
done | ${SORT}
|
||||
done | LANG=C ${SORT}
|
||||
|
||||
distdir:
|
||||
${Q}echo cscript
|
||||
@@ -131,7 +132,7 @@ detaillist:
|
||||
else \
|
||||
echo $$i; \
|
||||
fi; \
|
||||
done | ${SORT}) | ${FMT} -70 | \
|
||||
done | LANG=C ${SORT}) | ${FMT} -70 | \
|
||||
${SED} -e '1s/xxxxxxx/SCRIPT=/' -e '2,$$s/^/ /' \
|
||||
-e 's/$$/ \\/' -e '$$s/ \\$$//'
|
||||
${Q}echo
|
||||
@@ -142,7 +143,7 @@ detaillist:
|
||||
else \
|
||||
echo $$i.calc; \
|
||||
fi; \
|
||||
done | ${SORT}) | ${FMT} -70 | \
|
||||
done | LANG=C ${SORT}) | ${FMT} -70 | \
|
||||
${SED} -e '1s/xxxxxxxxxxx/SCRIPT_SRC=/' -e '2,$$s/^/ /' \
|
||||
-e 's/$$/ \\/' -e '$$s/ \\$$//'
|
||||
|
||||
@@ -249,3 +250,7 @@ square: square.calc
|
||||
rm -f $@
|
||||
${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
${CHMOD} +x $@
|
||||
fproduct: fproduct.calc
|
||||
rm -f $@
|
||||
${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
${CHMOD} +x $@
|
||||
|
@@ -19,6 +19,11 @@ For more info, see:
|
||||
|
||||
=-=
|
||||
|
||||
fproduct filename term ...
|
||||
|
||||
Write the big Endian product of terms to a file. Use - for stdout.
|
||||
|
||||
|
||||
mersenne exp
|
||||
|
||||
Print the value of 2^exp-1.
|
||||
@@ -54,8 +59,8 @@ simple
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.4 $
|
||||
## @(#) $Id: README,v 29.4 2000/06/07 14:02:59 chongo Exp $
|
||||
## @(#) $Revision: 29.5 $
|
||||
## @(#) $Id: README,v 29.5 2001/04/08 08:24:40 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/README,v $
|
||||
##
|
||||
## Under source code control: 1999/12/17 10:23:40
|
||||
|
88
cscript/fproduct.calc
Normal file
88
cscript/fproduct.calc
Normal file
@@ -0,0 +1,88 @@
|
||||
#!/usr/local/bin/calc -q -s -f
|
||||
/*
|
||||
* fproduct - write the big Endian product of terms to a file
|
||||
*
|
||||
* usage:
|
||||
* fproduct filename term [term ...]
|
||||
*
|
||||
* filename where to write the product, use - for stdout
|
||||
* term ... terms to multiply
|
||||
*
|
||||
* Copyright (C) 2001 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* Calc is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
* Public License for more details.
|
||||
*
|
||||
* A copy of version 2.1 of the GNU Lesser General Public License is
|
||||
* distributed with calc under the filename COPYING-LGPL. You should have
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.1 $
|
||||
* @(#) $Id: fproduct.calc,v 29.1 2001/04/08 08:25:15 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/fproduct.calc,v $
|
||||
*
|
||||
* Under source code control: 2001/04/07 20:13:11
|
||||
* File existed as early as: 2001
|
||||
*
|
||||
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
*/
|
||||
|
||||
/*
|
||||
* parse args
|
||||
*/
|
||||
argc = argv();
|
||||
if (argc < 2) {
|
||||
fprintf(files(2), "usage: %s term [term ...]\n", argv(0));
|
||||
exit;
|
||||
}
|
||||
filename = argv(1);
|
||||
|
||||
|
||||
/*
|
||||
* build the product
|
||||
*/
|
||||
product = 1;
|
||||
for (i=2; i < argc; ++i) {
|
||||
product *= eval(argv(i));
|
||||
}
|
||||
product = abs(product);
|
||||
|
||||
|
||||
/*
|
||||
* open the file for writing, "-" is stdout
|
||||
*/
|
||||
if (filename == "-") {
|
||||
fd = files(1);
|
||||
} else {
|
||||
fd = fopen(filename, "w");
|
||||
if (!isfile(fd)) quit "be2file: cannot open file for writing";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* write the octets to the file
|
||||
*
|
||||
* The most significant bits of the integer become the first file octets.
|
||||
*/
|
||||
if (product > 0) {
|
||||
octlen = int((highbit(product)+8) / 8);
|
||||
for (i=octlen-1; i >= 0; --i) {
|
||||
fputc(fd, char(product >> (i*8)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* cleanup
|
||||
*/
|
||||
if (filename != "-") {
|
||||
fclose(fd);
|
||||
}
|
Reference in New Issue
Block a user