Release calc version 2.11.4t2

This commit is contained in:
Landon Curt Noll
2000-12-17 05:12:29 -08:00
parent 296aa50ac7
commit 3d55811205
59 changed files with 5084 additions and 1727 deletions

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: Makefile,v 29.5 2000/06/07 14:02:59 chongo Exp $
# @(#) $Revision: 29.6 $
# @(#) $Id: Makefile,v 29.6 2000/12/15 14:56:14 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/Makefile,v $
#
# Under source code control: 1999/11/29 11:10:26
@@ -65,7 +65,7 @@ FMT= fmt
#
# The ${SCRIPT_SRC} is built from ${SCRIPT} and has the .calc extensions.
#
# This list is prodiced by the detaillist rule when no WARNINGS are detected.
# This list is produced by the detaillist rule when no WARNINGS are detected.
# To add a script:
#
# 1) Name the file with a .calc filename extension
@@ -76,15 +76,15 @@ FMT= fmt
#
# make detaillist
#
SCRIPT= mersenne piforever plus simple
SCRIPT= mersenne piforever plus simple square
SCRIPT_SRC= mersenne.calc piforever.calc plus.calc simple.calc
SCRIPT_SRC= mersenne.calc piforever.calc plus.calc simple.calc square.calc
# These files are found (but not built) in the distribution
#
DISTLIST= ${SCRIPT_SRC} ${MAKE_FILE} README
# These files are used to make (but not built) a calc .a library
# These files are used to make (but not build) a calc .a library
#
CALCLIBLIST=
@@ -92,10 +92,10 @@ CALCLIBLIST=
#
all: ${SCRIPT} ${SCRIPT_SRC} .all
# used by the upper level Makefile to determine of we have done all
# used by the upper level Makefile to determine if we have done all
#
# NOTE: Due to bogus shells found on one common system we must have
# an non-emoty else clause for every if condition. *sigh*
# a non-empty else clause for every if condition. *sigh*
#
.all:
rm -f .all
@@ -245,3 +245,7 @@ simple: simple.calc
rm -f $@
${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
${CHMOD} +x $@
square: square.calc
rm -f $@
${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
${CHMOD} +x $@

View File

@@ -1,4 +1,4 @@
#!/usr/local/src/cmd/calc/calc -S
#!/usr/local/src/cmd/calc/calc -q -s -f
#
# mersenne - print the value of a mersenne number
#
@@ -18,8 +18,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
# @(#) $Revision: 29.2 $
# @(#) $Id: mersenne.calc,v 29.2 2000/06/07 14:02:59 chongo Exp $
# @(#) $Revision: 29.3 $
# @(#) $Id: mersenne.calc,v 29.3 2000/12/15 14:56:54 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/mersenne.calc,v $
#
# Under source code control: 1999/11/30 00:09:01;
@@ -35,13 +35,19 @@
/*
* parse args
*/
if (argv() != 1) {
if (argv() != 2) {
/* we include the name of this script in the error message */
fprintf(files(2), "usage: %s exp\n", config("program"));
abort "wrong number of args";
}
global n = eval(argv(1));
if (!isint(n) || n <= 0) {
quit "Argument to be a positive integer";
}
/*
* print the decimal value of 2^n-1
*/
print "2^": argv(0) : "-1 =", 2^eval(argv(0))-1;
print "2^": n : "-1 =", 2^n-1;

View File

@@ -1,4 +1,4 @@
#!/usr/local/src/cmd/calc/calc -S
#!/usr/local/src/cmd/calc/calc -q -f
#
# piforever - print digits of pi forever (or as long as your mem/cpu allow)
#
@@ -18,8 +18,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
# @(#) $Revision: 29.2 $
# @(#) $Id: piforever.calc,v 29.2 2000/06/07 14:02:59 chongo Exp $
# @(#) $Revision: 29.3 $
# @(#) $Id: piforever.calc,v 29.3 2000/12/15 14:56:54 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/piforever.calc,v $
#
# Under source code control: 1999/11/30 00:11:36

View File

@@ -1,4 +1,4 @@
#!/usr/local/src/cmd/calc/calc -S
#!/usr/local/src/cmd/calc/calc -q -s -f
#
# plus - add two or more arguments together
#
@@ -18,8 +18,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
# @(#) $Revision: 29.2 $
# @(#) $Id: plus.calc,v 29.2 2000/06/07 14:02:59 chongo Exp $
# @(#) $Revision: 29.3 $
# @(#) $Id: plus.calc,v 29.3 2000/12/15 14:56:54 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/plus.calc,v $
#
# Under source code control: 1999/11/29 10:22:37
@@ -35,19 +35,19 @@
/*
* parse args
*/
if (argv() < 1) {
if (argv() < 2) {
/* we include the name of this script in the error message */
fprintf(files(2), "usage: %s value ...\n", config("program"));
abort "not enough args";
}
/*
* print the sum of the 2 args
* print the sum of the args
*
* Since args are strings, we must eval them before using them numerically.
*/
sum = 0;
for (i=0; i < argv(); ++i) {
for (i=1; i < argv(); ++i) {
sum += eval(argv(i));
}
print sum;

View File

@@ -1,4 +1,4 @@
#!/usr/local/src/cmd/calc/calc -S
#!/usr/local/src/cmd/calc/calc -q -f
#
# simple - an example of a simple calc shell script
#
@@ -18,8 +18,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
# @(#) $Revision: 29.2 $
# @(#) $Id: simple.calc,v 29.2 2000/06/07 14:02:59 chongo Exp $
# @(#) $Revision: 29.3 $
# @(#) $Id: simple.calc,v 29.3 2000/12/15 14:56:54 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/simple.calc,v $
#
# Under source code control: 1999/11/29 10:22:37
@@ -32,4 +32,4 @@
/*
* This is an example of a simple calc shell script.
*/
print "The simple calc shell script works!"
print "This simple calc shell script works!"

35
cscript/square.calc Normal file
View File

@@ -0,0 +1,35 @@
#!/usr/local/src/cmd/calc/calc -q -f
#
# sqaure - print the squares of input values
#
# Copyright (C) 2000 Landon Curt Noll
#
# Calc is open software; you can redistribute it and/or modify it under
# the terms of the version 2.1 of the GNU Lesser General Public License
# as published by the Free Software Foundation.
#
# Calc is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
# Public License for more details.
#
# A copy of version 2.1 of the GNU Lesser General Public License is
# distributed with calc under the filename COPYING-LGPL. You should have
# received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
# @(#) $Revision: 29.1 $
# @(#) $Id: square.calc,v 29.1 2000/12/15 14:55:59 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/square.calc,v $
#
# Under source code control: 2000/12/15 06:52:01
# File existed as early as: 2000
#
# Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
# usage:
# mersenne exp
global s;
while ((s = prompt("")))
print "\t":eval(s)^2;