mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Release calc version 2.11.0t10.5.1
This commit is contained in:
247
cscript/Makefile
247
cscript/Makefile
@@ -1,247 +0,0 @@
|
||||
#
|
||||
# cscript - makefile for calc shell script files
|
||||
#
|
||||
# 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: Makefile,v 29.3 1999/12/14 19:30:19 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1999/11/29 11:10:26
|
||||
# File existed as early as: 1999
|
||||
#
|
||||
# chongo <was here> /\oo/\ http://reality.sgi.com/chongo/
|
||||
# Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/
|
||||
#
|
||||
# calculator by David I. Bell with help/mods from others
|
||||
# Makefile by Landon Curt Noll
|
||||
|
||||
|
||||
# required vars
|
||||
#
|
||||
SHELL= /bin/sh
|
||||
MAKE_FILE = Makefile
|
||||
|
||||
# Normally, the upper level makefile will set these values. We provide
|
||||
# a default here just in case you want to build from this directory.
|
||||
#
|
||||
BINDIR= /usr/local/bin
|
||||
#BINDIR= /usr/bin
|
||||
#BINDIR= /usr/contrib/bin
|
||||
#
|
||||
SCRIPTDIR= ${BINDIR}/cscript
|
||||
|
||||
# Makefile debug
|
||||
#
|
||||
# Q=@ do not echo internal makefile actions (quiet mode)
|
||||
# Q= echo internal makefile actions (debug / verbose mode)
|
||||
#
|
||||
#Q=
|
||||
Q=@
|
||||
|
||||
# standard tools
|
||||
#
|
||||
CHMOD= chmod
|
||||
SED= sed
|
||||
SORT= sort
|
||||
FMT= fmt
|
||||
|
||||
# The ${SCRIPT} list is the list of calc shell script files (without the .calc
|
||||
# extension) which will be installed.
|
||||
#
|
||||
# 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.
|
||||
# To add a script:
|
||||
#
|
||||
# 1) Name the file with a .calc filename extension
|
||||
# 2) Place that file under RCS control
|
||||
# 3) Add the name, without the .calc extension to the ${SCRIPT} below
|
||||
# 4) Write out this Makefile
|
||||
# 5) Replace the ${SCRIPT} and ${SCRIPT_SRC} lines with the output of:
|
||||
#
|
||||
# make detaillist
|
||||
#
|
||||
SCRIPT= mersenne piforever plus simple
|
||||
|
||||
SCRIPT_SRC= mersenne.calc piforever.calc plus.calc simple.calc
|
||||
|
||||
# These files are found (but not built) in the distribution
|
||||
#
|
||||
DISTLIST= ${SCRIPT_SRC} ${MAKE_FILE}
|
||||
|
||||
# These files are used to make (but not built) a calc .a library
|
||||
#
|
||||
CALCLIBLIST=
|
||||
|
||||
# The reason for this Makefile
|
||||
#
|
||||
all: ${SCRIPT} ${SCRIPT_SRC} .all
|
||||
|
||||
# used by the upper level Makefile to determine of 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*
|
||||
#
|
||||
.all:
|
||||
rm -f .all
|
||||
touch .all
|
||||
|
||||
##
|
||||
#
|
||||
# File list generation. You can ignore this section.
|
||||
#
|
||||
#
|
||||
# We will form the names of source files as if they were in a
|
||||
# sub-directory called calc/cscript.
|
||||
#
|
||||
##
|
||||
|
||||
distlist: ${DISTLIST}
|
||||
${Q}for i in ${DISTLIST}; do \
|
||||
echo cscript/$$i; \
|
||||
done | ${SORT}
|
||||
|
||||
distdir:
|
||||
${Q}echo cscript
|
||||
|
||||
calcliblist:
|
||||
|
||||
# These next rule help me form the ${DETAIL_HELP} makefile variables above.
|
||||
#
|
||||
detaillist:
|
||||
${Q}-(echo "xxxxxxx"; \
|
||||
for i in ${SCRIPT}; do \
|
||||
if [ ! -f RCS/$$i.calc,v ]; then \
|
||||
echo "WARNING: $$i.calc not under RCS control" 1>&2; \
|
||||
else \
|
||||
echo $$i; \
|
||||
fi; \
|
||||
done | ${SORT}) | ${FMT} -70 | \
|
||||
${SED} -e '1s/xxxxxxx/SCRIPT=/' -e '2,$$s/^/ /' \
|
||||
-e 's/$$/ \\/' -e '$$s/ \\$$//'
|
||||
${Q}echo
|
||||
${Q}-(echo "xxxxxxxxxxx"; \
|
||||
for i in ${SCRIPT}; do \
|
||||
if [ ! -f RCS/$$i.calc,v ]; then \
|
||||
echo "WARNING: $$i.calc not under RCS control" 1>&2; \
|
||||
else \
|
||||
echo $$i.calc; \
|
||||
fi; \
|
||||
done | ${SORT}) | ${FMT} -70 | \
|
||||
${SED} -e '1s/xxxxxxxxxxx/SCRIPT_SRC=/' -e '2,$$s/^/ /' \
|
||||
-e 's/$$/ \\/' -e '$$s/ \\$$//'
|
||||
|
||||
##
|
||||
#
|
||||
# Home grown make dependency rules. Your system make not support
|
||||
# or have the needed tools. You can ignore this section.
|
||||
#
|
||||
# We will form a skelaton tree of *.c files containing only #include "foo.h"
|
||||
# lines and .h files containing the same lines surrounded by multiple include
|
||||
# prevention lines. This allows us to build a static depend list that will
|
||||
# satisfy all possible cpp symbol definition combinations.
|
||||
#
|
||||
##
|
||||
|
||||
depend:
|
||||
${Q}if [ -f Makefile.bak ]; then \
|
||||
echo "Makefile.bak exists, remove or move it out of the way"; \
|
||||
exit 1; \
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
-${Q}rm -f makedep.out
|
||||
${Q}echo forming cscript dependency list
|
||||
${Q}echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > \
|
||||
makedep.out
|
||||
${Q}echo "" >> makedep.out
|
||||
${Q}for i in ${SCRIPT}; do \
|
||||
echo "$$i: $$i.calc"; \
|
||||
echo ' rm -f $$@'; \
|
||||
echo ' $${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!$${BINDIR}/calc:" $$?>$$@'; \
|
||||
echo ' $${CHMOD} +x $$@'; \
|
||||
done >> makedep.out
|
||||
${Q}echo sample dependency list formed
|
||||
${Q}echo forming new cscript/Makefile
|
||||
-${Q}rm -f Makefile.bak
|
||||
${Q}mv Makefile Makefile.bak
|
||||
${Q}${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak > Makefile
|
||||
${Q}echo "" >> Makefile
|
||||
${Q}${SED} -n '3,$$p' makedep.out >> Makefile
|
||||
-${Q}rm -f makedep.out
|
||||
-${Q}if cmp -s Makefile.bak Makefile; then \
|
||||
echo 'sample Makefile was already up to date'; \
|
||||
mv -f Makefile.bak Makefile; \
|
||||
else \
|
||||
rm -f Makefile.tmp; \
|
||||
mv Makefile Makefile.tmp; \
|
||||
if [ -d RCS ]; then \
|
||||
co -l Makefile; \
|
||||
fi; \
|
||||
mv Makefile.tmp Makefile; \
|
||||
if [ -d RCS ]; then \
|
||||
echo new sample Makefile formed, you need to check it in; \
|
||||
fi; \
|
||||
fi
|
||||
|
||||
clean:
|
||||
-rm -f makedep.out
|
||||
|
||||
clobber:
|
||||
-rm -f ${SCRIPT}
|
||||
|
||||
install: all
|
||||
-${Q}if [ ! -d ${BINDIR} ]; then \
|
||||
echo mkdir ${BINDIR}; \
|
||||
mkdir ${BINDIR}; \
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
-${Q}if [ ! -d ${SCRIPTDIR} ]; then \
|
||||
echo mkdir ${SCRIPTDIR}; \
|
||||
mkdir ${SCRIPTDIR}; \
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
${Q}for i in ${SCRIPT}; do \
|
||||
echo rm -f ${SCRIPTDIR}/$$i; \
|
||||
rm -f ${SCRIPTDIR}/$$i; \
|
||||
echo cp $$i ${SCRIPTDIR}; \
|
||||
cp $$i ${SCRIPTDIR}; \
|
||||
echo ${CHMOD} 0555 ${SCRIPTDIR}/$$i; \
|
||||
${CHMOD} 0555 ${SCRIPTDIR}/$$i; \
|
||||
done
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
mersenne: mersenne.calc
|
||||
rm -f $@
|
||||
${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
${CHMOD} +x $@
|
||||
piforever: piforever.calc
|
||||
rm -f $@
|
||||
${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
${CHMOD} +x $@
|
||||
plus: plus.calc
|
||||
rm -f $@
|
||||
${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
${CHMOD} +x $@
|
||||
simple: simple.calc
|
||||
rm -f $@
|
||||
${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
${CHMOD} +x $@
|
@@ -1,47 +0,0 @@
|
||||
#!/usr/local/src/cmd/calc/calc -S
|
||||
#
|
||||
# mersenne - print the value of a mersenne number
|
||||
#
|
||||
# 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.1 $
|
||||
# @(#) $Id: mersenne.calc,v 29.1 1999/12/14 09:15:35 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/mersenne.calc,v $
|
||||
#
|
||||
# Under source code control: 1999/11/30 00:09:01;
|
||||
# File existed as early as: 1999
|
||||
#
|
||||
# chongo <was here> /\oo/\ http://reality.sgi.com/chongo/
|
||||
# Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/
|
||||
|
||||
# usage:
|
||||
# mersenne exp
|
||||
|
||||
|
||||
/*
|
||||
* parse args
|
||||
*/
|
||||
if (argv() != 1) {
|
||||
/* 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";
|
||||
}
|
||||
|
||||
/*
|
||||
* print the decimal value of 2^n-1
|
||||
*/
|
||||
print "2^": argv(0) : "-1 =", 2^eval(argv(0))-1;
|
@@ -1,37 +0,0 @@
|
||||
#!/usr/local/src/cmd/calc/calc -S
|
||||
#
|
||||
# piforever - print digits of pi forever (or as long as your mem/cpu allow)
|
||||
#
|
||||
# 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.1 $
|
||||
# @(#) $Id: piforever.calc,v 29.1 1999/12/14 09:15:36 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/piforever.calc,v $
|
||||
#
|
||||
# Under source code control: 1999/11/30 00:11:36
|
||||
# File existed as early as: 1999
|
||||
#
|
||||
# chongo <was here> /\oo/\ http://reality.sgi.com/chongo/
|
||||
# Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/
|
||||
|
||||
# usage:
|
||||
# piforever
|
||||
|
||||
|
||||
read -once pi.cal
|
||||
print "pi ~= ":;
|
||||
piforever();
|
@@ -1,53 +0,0 @@
|
||||
#!/usr/local/src/cmd/calc/calc -S
|
||||
#
|
||||
# plus - add two or more arguments together
|
||||
#
|
||||
# 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.1 $
|
||||
# @(#) $Id: plus.calc,v 29.1 1999/12/14 09:15:36 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/plus.calc,v $
|
||||
#
|
||||
# Under source code control: 1999/11/29 10:22:37
|
||||
# File existed as early as: 1999
|
||||
#
|
||||
# chongo <was here> /\oo/\ http://reality.sgi.com/chongo/
|
||||
# Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/
|
||||
|
||||
# usage:
|
||||
# plus val ...
|
||||
|
||||
|
||||
/*
|
||||
* parse args
|
||||
*/
|
||||
if (argv() < 1) {
|
||||
/* 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
|
||||
*
|
||||
* Since args are strings, we must eval them before using them numerically.
|
||||
*/
|
||||
sum = 0;
|
||||
for (i=0; i < argv(); ++i) {
|
||||
sum += eval(argv(i));
|
||||
}
|
||||
print sum;
|
@@ -1,35 +0,0 @@
|
||||
#!/usr/local/src/cmd/calc/calc -S
|
||||
#
|
||||
# simple - an example of a simple calc shell script
|
||||
#
|
||||
# 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.1 $
|
||||
# @(#) $Id: simple.calc,v 29.1 1999/12/14 09:15:36 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/simple.calc,v $
|
||||
#
|
||||
# Under source code control: 1999/11/29 10:22:37
|
||||
# File existed as early as: 1999
|
||||
#
|
||||
# chongo <was here> /\oo/\ http://reality.sgi.com/chongo/
|
||||
# Share and enjoy! :-) http://reality.sgi.com/chongo/tech/comp/calc/
|
||||
|
||||
|
||||
/*
|
||||
* This is an example of a simple calc shell script.
|
||||
*/
|
||||
print "The simple calc shell script works!"
|
Reference in New Issue
Block a user