mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
810e541281 | ||
|
ee30d787ea | ||
|
4e92927183 | ||
|
fb4a03c1f1 | ||
|
81a523043e | ||
|
2c0d0bbc1b |
23
BUGS
23
BUGS
@@ -80,6 +80,25 @@ mis-features in calc:
|
|||||||
work better. The following is a list of mis-features that should be
|
work better. The following is a list of mis-features that should be
|
||||||
addressed and improved someday.
|
addressed and improved someday.
|
||||||
|
|
||||||
|
* When statement is of the form { ... }, the leading { MUST BE ON
|
||||||
|
THE SAME LINE as the if, for, while or do keyword.
|
||||||
|
|
||||||
|
This works as expected:
|
||||||
|
|
||||||
|
if (expr) {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
However this WILL NOT WORK AS EXPECTED:
|
||||||
|
|
||||||
|
if (expr)
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
This needs to be changed. See also "help statement", "help unexpected",
|
||||||
|
and "help todo".
|
||||||
|
|
||||||
* The chi.cal resource file does not work well with odd degrees
|
* The chi.cal resource file does not work well with odd degrees
|
||||||
of freedom. Can someone improve this algorithm?
|
of freedom. Can someone improve this algorithm?
|
||||||
|
|
||||||
@@ -141,8 +160,8 @@ Problems with old systems that have known work-a-rounds:
|
|||||||
## 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.25 $
|
## @(#) $Revision: 29.26 $
|
||||||
## @(#) $Id: BUGS,v 29.25 2006/08/20 17:51:25 chongo Exp $
|
## @(#) $Id: BUGS,v 29.26 2007/01/03 21:26:22 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/RCS/BUGS,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/RCS/BUGS,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1994/03/18 14:06:13
|
## Under source code control: 1994/03/18 14:06:13
|
||||||
|
131
CHANGES
131
CHANGES
@@ -1,10 +1,131 @@
|
|||||||
The following are the changes from calc version 2.12.1 to date:
|
The following are the changes from calc version 2.12.1.7 to date:
|
||||||
|
|
||||||
|
Fixed calc cscripts that contained comments that were not valid calc
|
||||||
|
comments. Improved calc comment documentation in "help unexpected"
|
||||||
|
to help other avoid similar mistakes. Calc comments are of the form:
|
||||||
|
|
||||||
|
/* c style comments */
|
||||||
|
/*
|
||||||
|
* multi-line
|
||||||
|
* commentts
|
||||||
|
*/
|
||||||
|
## two or more #-signs
|
||||||
|
### in a row
|
||||||
|
### Note that # along is a calc uniary and binary operator
|
||||||
|
|
||||||
|
Added "help pound" or "help #' to document the # operator, comments,
|
||||||
|
and the first line of cscript files.
|
||||||
|
|
||||||
|
Documented these help commands in "help help":
|
||||||
|
|
||||||
|
help ->
|
||||||
|
help *
|
||||||
|
help .
|
||||||
|
help %
|
||||||
|
help //
|
||||||
|
help #
|
||||||
|
|
||||||
|
The usage help file is now formed from the contents of the calc man page.
|
||||||
|
So "help usage" prints the version of the calc man page. Added ${COL}
|
||||||
|
makefile symbol to support the formation of the calc.usage file from
|
||||||
|
calc.1 via the CALCPAGER (less).
|
||||||
|
|
||||||
|
The "help calc" command is now equivalent to "help help".
|
||||||
|
|
||||||
|
The "help define" command is now equivalent to "help command".
|
||||||
|
|
||||||
|
Fixed calc command line usage message.
|
||||||
|
|
||||||
|
Fixed missing README.src file in RPM src and tgz src tarball.
|
||||||
|
|
||||||
|
|
||||||
|
The following are the changes from calc version 2.12.1.6 to 2.12.1.6:
|
||||||
|
|
||||||
|
Added the calc builtin function, usertime(), to return the amount of
|
||||||
|
user CPU time used by the current process. Unlike the old runtime()
|
||||||
|
builtin, the CPU time reported for long running processes will not
|
||||||
|
wrap around to 0 after only a few months.
|
||||||
|
|
||||||
|
Added the calc builtin function, systime(), to return the amount of
|
||||||
|
kernel CPU time used by the current process.
|
||||||
|
|
||||||
|
The runtime() builtin function now returns the total amount of CPU
|
||||||
|
time used by the current process. This time includes both user mode
|
||||||
|
and kernel mode time. Unlike the old runtime() builtin, the builtin
|
||||||
|
includes time spent executing operating system code on behalf of
|
||||||
|
the current process.
|
||||||
|
|
||||||
|
Fixed runtime() so that the CPU time reported for long running
|
||||||
|
processes will wrap around to 0 for a long time.
|
||||||
|
|
||||||
|
Added config("hz") to return the clock tick rate. This is
|
||||||
|
a read-only configuration value.
|
||||||
|
|
||||||
|
Added regression tests for recently added config() parameters.
|
||||||
|
|
||||||
|
Fixed the #define symbols that were created in have_strdup.h.
|
||||||
|
Previously this file looked as if have_rusage.h has been
|
||||||
|
included already.
|
||||||
|
|
||||||
|
Restored the function of "help" (without any args) printing the
|
||||||
|
default help file. Thanks for this fix goes to Silvan Minghetti
|
||||||
|
<bullet at users dot sourceforge dot net>.
|
||||||
|
|
||||||
|
Fixed a problem where some old MS environments failed some of the
|
||||||
|
regression tests because "read -once foo.cal" was not behaving
|
||||||
|
correctly due to how the _fullpath() was being called. Thanks for
|
||||||
|
this fix goes to Anatoly <notexistent-anb at yandex dot ru>.
|
||||||
|
|
||||||
|
Documented the mis-feature about how calc parses if, for, while
|
||||||
|
and do statements in an unexpected way. For example:
|
||||||
|
|
||||||
|
This works as expected:
|
||||||
|
|
||||||
|
if (expr) {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
However this WILL NOT WORK AS EXPECTED:
|
||||||
|
|
||||||
|
if (expr)
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
because calc will parse the if being terminated by
|
||||||
|
an empty statement followed by a
|
||||||
|
|
||||||
|
if (expr) ;
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
See also "help statement", "help unexpected", "help todo", and
|
||||||
|
"help bugs".
|
||||||
|
|
||||||
|
|
||||||
|
The following are the changes from calc version 2.12.1 to 2.12.1.5:
|
||||||
|
|
||||||
Fixed minor typos in the 'version 2.12.0 to 2.12.0.8' section below.
|
Fixed minor typos in the 'version 2.12.0 to 2.12.0.8' section below.
|
||||||
Made minor formatting changes as well.
|
Made minor formatting changes as well.
|
||||||
|
|
||||||
Changed use of ${Q} in the Makefile to avoid an make "feature"
|
Changed use of ${Q} in the Makefile to avoid an make "feature"
|
||||||
related to OpenBSD.
|
related to OpenBSD. Added ${RM} make variable for make tools that
|
||||||
|
do not have builtin defined terms.
|
||||||
|
|
||||||
|
Removed the ECHO_PROG Makefile variable. Also removed it from
|
||||||
|
the sysinfo() custom function.
|
||||||
|
|
||||||
|
Improved the support for cross-compiled environmens by using
|
||||||
|
make symbols for all non-shell commands executed by Makefiles.
|
||||||
|
|
||||||
|
Fixed a problem with the make chk awk script which failed under
|
||||||
|
OS X 10.4.7.
|
||||||
|
|
||||||
|
Fixed a few minor variables that were not set to default values in
|
||||||
|
lower level Makefiles.
|
||||||
|
|
||||||
|
Fixed a reference to a non-existent make variable in HOWTO.INSTALL.
|
||||||
|
|
||||||
|
|
||||||
The following are the changes from calc version 2.12.0 to 2.12.0.8:
|
The following are the changes from calc version 2.12.0 to 2.12.0.8:
|
||||||
@@ -2566,8 +2687,6 @@ The following are the changes from calc version 2.10.3t5.38 to 2.11.3t5.46:
|
|||||||
into a single section.
|
into a single section.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
The following are the changes from calc version 2.10.3t5.34 to 2.10.3t5.37:
|
The following are the changes from calc version 2.10.3t5.34 to 2.10.3t5.37:
|
||||||
|
|
||||||
Per request from David I Bell, the README line:
|
Per request from David I Bell, the README line:
|
||||||
@@ -6201,8 +6320,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.87 $
|
## @(#) $Revision: 29.94 $
|
||||||
## @(#) $Id: CHANGES,v 29.87 2006/09/17 23:50:45 chongo Exp $
|
## @(#) $Id: CHANGES,v 29.94 2007/02/07 01:38:03 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
|
||||||
|
@@ -52,14 +52,14 @@ Installing calc from the gziped tarball in 4 easy steps:
|
|||||||
CALC_INCDIR where the calc include files are installed
|
CALC_INCDIR where the calc include files are installed
|
||||||
CUSTOMCALDIR where custom *.cal files are installed
|
CUSTOMCALDIR where custom *.cal files are installed
|
||||||
CUSTOMHELPDIR where custom help files are installed
|
CUSTOMHELPDIR where custom help files are installed
|
||||||
CUSTOMINCPDIR where custom .h files are installed
|
CUSTOMINCDIR where custom .h files are installed
|
||||||
SCRIPTDIR where calc shell scripts are installed
|
SCRIPTDIR where calc shell scripts are installed
|
||||||
|
|
||||||
If you want to install calc files under a top level directory,
|
If you want to install calc files under a top level directory,
|
||||||
then set the T value:
|
then set the T value:
|
||||||
|
|
||||||
The calc install is performed under $T, the calc build is
|
The calc install is performed under ${T}, the calc build is
|
||||||
performed under /. The purpose for $T is to allow someone
|
performed under /. The purpose for ${T} is to allow someone
|
||||||
to install calc somewhere other than into the system area.
|
to install calc somewhere other than into the system area.
|
||||||
|
|
||||||
For example, if:
|
For example, if:
|
||||||
@@ -79,10 +79,10 @@ Installing calc from the gziped tarball in 4 easy steps:
|
|||||||
calc help, .cal ...: /var/tmp/testing/usr/share/calc
|
calc help, .cal ...: /var/tmp/testing/usr/share/calc
|
||||||
... etc ... /var/tmp/testing/...
|
... etc ... /var/tmp/testing/...
|
||||||
|
|
||||||
If $T is empty, calc is installed under /, which is the same
|
If ${T} is empty, calc is installed under /, which is the same
|
||||||
top of tree for which it was built. If $T is non-empty, then
|
top of tree for which it was built. If ${T} is non-empty, then
|
||||||
calc is installed under $T, as if one had to chroot under
|
calc is installed under ${T}, as if one had to chroot under
|
||||||
$T for calc to operate.
|
${T} for calc to operate.
|
||||||
|
|
||||||
Look for the section that starts:
|
Look for the section that starts:
|
||||||
|
|
||||||
@@ -162,8 +162,8 @@ the calc help subsystem. See the README file for details.
|
|||||||
## 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.7 $
|
## @(#) $Revision: 29.9 $
|
||||||
## @(#) $Id: HOWTO.INSTALL,v 29.7 2003/04/15 03:38:34 chongo Exp $
|
## @(#) $Id: HOWTO.INSTALL,v 29.9 2006/09/18 13:11:57 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/RCS/HOWTO.INSTALL,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/RCS/HOWTO.INSTALL,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1999/09/27 20:48:44
|
## Under source code control: 1999/09/27 20:48:44
|
||||||
|
112
cal/Makefile
112
cal/Makefile
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# cal - makefile for calc standard resource files
|
# cal - makefile for calc standard resource files
|
||||||
#
|
#
|
||||||
# Copyright (C) 1999 Landon Curt Noll
|
# Copyright (C) 1999-2006 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
|
||||||
@@ -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.21 $
|
# @(#) $Revision: 29.24 $
|
||||||
# @(#) $Id: Makefile,v 29.21 2006/06/26 05:46:06 chongo Exp $
|
# @(#) $Id: Makefile,v 29.24 2006/09/18 13:13:25 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
|
||||||
@@ -33,8 +33,8 @@
|
|||||||
|
|
||||||
# required vars
|
# required vars
|
||||||
#
|
#
|
||||||
SHELL = /bin/sh
|
SHELL= /bin/sh
|
||||||
MAKE_FILE = Makefile
|
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
|
||||||
@@ -62,9 +62,9 @@ INCDIR= /usr/include
|
|||||||
# ${LIBDIR} where calc link library (*.a) files are installed
|
# ${LIBDIR} where calc link library (*.a) files are installed
|
||||||
# ${CALC_SHAREDIR} where to install calc help, .cal, startup, config files
|
# ${CALC_SHAREDIR} where to install calc help, .cal, startup, config files
|
||||||
#
|
#
|
||||||
# NOTE: The install rule prepends installation paths with $T, which
|
# NOTE: The install rule prepends installation paths with ${T}, which
|
||||||
# by default is empty. If $T is non-empty, then installation
|
# by default is empty. If ${T} is non-empty, then installation
|
||||||
# locations will be relative to the $T directory.
|
# locations will be relative to the ${T} directory.
|
||||||
#
|
#
|
||||||
# For DJGPP, select:
|
# For DJGPP, select:
|
||||||
#
|
#
|
||||||
@@ -96,12 +96,12 @@ CALC_SHAREDIR= /usr/share/calc
|
|||||||
# ${CALC_INCDIR} where the calc include files are installed
|
# ${CALC_INCDIR} where the calc include files are installed
|
||||||
# ${CUSTOMCALDIR} where custom *.cal files are installed
|
# ${CUSTOMCALDIR} where custom *.cal files are installed
|
||||||
# ${CUSTOMHELPDIR} where custom help files are installed
|
# ${CUSTOMHELPDIR} where custom help files are installed
|
||||||
# ${CUSTOMINCPDIR} where custom .h files are installed
|
# ${CUSTOMINCDIR} where custom .h files are installed
|
||||||
# ${SCRIPTDIR} where calc shell scripts are installed
|
# ${SCRIPTDIR} where calc shell scripts are installed
|
||||||
#
|
#
|
||||||
# NOTE: The install rule prepends installation paths with $T, which
|
# NOTE: The install rule prepends installation paths with ${T}, which
|
||||||
# by default is empty. If $T is non-empty, then installation
|
# by default is empty. If ${T} is non-empty, then installation
|
||||||
# locations will be relative to the $T directory.
|
# locations will be relative to the ${T} directory.
|
||||||
#
|
#
|
||||||
# If in doubt, set:
|
# If in doubt, set:
|
||||||
#
|
#
|
||||||
@@ -121,8 +121,8 @@ SCRIPTDIR= ${BINDIR}/cscript
|
|||||||
|
|
||||||
# T - top level directory under which calc will be installed
|
# T - top level directory under which calc will be installed
|
||||||
#
|
#
|
||||||
# The calc install is performed under $T, the calc build is
|
# The calc install is performed under ${T}, the calc build is
|
||||||
# performed under /. The purpose for $T is to allow someone
|
# performed under /. The purpose for ${T} is to allow someone
|
||||||
# to install calc somewhere other than into the system area.
|
# to install calc somewhere other than into the system area.
|
||||||
#
|
#
|
||||||
# For example, if:
|
# For example, if:
|
||||||
@@ -142,10 +142,10 @@ SCRIPTDIR= ${BINDIR}/cscript
|
|||||||
# calc help, .cal ...: /var/tmp/testing/usr/share/calc
|
# calc help, .cal ...: /var/tmp/testing/usr/share/calc
|
||||||
# ... etc ... /var/tmp/testing/...
|
# ... etc ... /var/tmp/testing/...
|
||||||
#
|
#
|
||||||
# If $T is empty, calc is installed under /, which is the same
|
# If ${T} is empty, calc is installed under /, which is the same
|
||||||
# top of tree for which it was built. If $T is non-empty, then
|
# top of tree for which it was built. If ${T} is non-empty, then
|
||||||
# calc is installed under $T, as if one had to chroot under
|
# calc is installed under ${T}, as if one had to chroot under
|
||||||
# $T for calc to operate.
|
# ${T} for calc to operate.
|
||||||
#
|
#
|
||||||
# If in doubt, use T=
|
# If in doubt, use T=
|
||||||
#
|
#
|
||||||
@@ -163,6 +163,14 @@ Q=@
|
|||||||
#
|
#
|
||||||
CHMOD= chmod
|
CHMOD= chmod
|
||||||
CMP= cmp
|
CMP= cmp
|
||||||
|
RM= rm
|
||||||
|
MKDIR= mkdir
|
||||||
|
RMDIR= rmdir
|
||||||
|
CP= cp
|
||||||
|
MV= mv
|
||||||
|
CO= co
|
||||||
|
TRUE= true
|
||||||
|
TOUCH= touch
|
||||||
|
|
||||||
# The calc files to install
|
# The calc files to install
|
||||||
#
|
#
|
||||||
@@ -192,8 +200,8 @@ all: ${CALC_FILES} ${MAKE_FILE} .all
|
|||||||
# used by the upper level Makefile to determine of we have done all
|
# used by the upper level Makefile to determine of we have done all
|
||||||
#
|
#
|
||||||
.all:
|
.all:
|
||||||
rm -f .all
|
${RM} -f .all
|
||||||
touch .all
|
${TOUCH} .all
|
||||||
|
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
@@ -209,17 +217,17 @@ all: ${CALC_FILES} ${MAKE_FILE} .all
|
|||||||
##
|
##
|
||||||
|
|
||||||
distlist: ${DISTLIST}
|
distlist: ${DISTLIST}
|
||||||
${Q}for i in ${DISTLIST} /dev/null; do \
|
${Q} for i in ${DISTLIST} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo cal/$$i; \
|
echo cal/$$i; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
distdir:
|
distdir:
|
||||||
${Q}echo cal
|
${Q} echo cal
|
||||||
|
|
||||||
calcliblist:
|
calcliblist:
|
||||||
${Q}for i in ${CALCLIBLIST} /dev/null; do \
|
${Q} for i in ${CALCLIBLIST} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo cal/$$i; \
|
echo cal/$$i; \
|
||||||
fi; \
|
fi; \
|
||||||
@@ -232,7 +240,7 @@ calcliblist:
|
|||||||
##
|
##
|
||||||
|
|
||||||
echo_inst_files:
|
echo_inst_files:
|
||||||
${Q}for i in ${CALC_FILES} /dev/null; do \
|
${Q} for i in ${CALC_FILES} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo __file__ ${CALC_SHAREDIR}/$$i; \
|
echo __file__ ${CALC_SHAREDIR}/$$i; \
|
||||||
fi; \
|
fi; \
|
||||||
@@ -247,37 +255,37 @@ echo_inst_files:
|
|||||||
clean:
|
clean:
|
||||||
|
|
||||||
clobber:
|
clobber:
|
||||||
rm -f .all
|
${RM} -f .all
|
||||||
|
|
||||||
# install everything
|
# install everything
|
||||||
#
|
#
|
||||||
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
||||||
#
|
#
|
||||||
install: all
|
install: all
|
||||||
-${Q}if [ ! -d $T${CALC_SHAREDIR} ]; then \
|
-${Q} if [ ! -d ${T}${CALC_SHAREDIR} ]; then \
|
||||||
echo mkdir $T${CALC_SHAREDIR}; \
|
echo ${MKDIR} ${T}${CALC_SHAREDIR}; \
|
||||||
mkdir $T${CALC_SHAREDIR}; \
|
${MKDIR} ${T}${CALC_SHAREDIR}; \
|
||||||
if [ ! -d "$T${CALC_SHAREDIR}" ]; then \
|
if [ ! -d "${T}${CALC_SHAREDIR}" ]; then \
|
||||||
echo mkdir -p "$T${CALC_SHAREDIR}"; \
|
echo ${MKDIR} -p "${T}${CALC_SHAREDIR}"; \
|
||||||
mkdir -p "$T${CALC_SHAREDIR}"; \
|
${MKDIR} -p "${T}${CALC_SHAREDIR}"; \
|
||||||
fi; \
|
fi; \
|
||||||
echo ${CHMOD} 0755 $T${CALC_SHAREDIR}; \
|
echo ${CHMOD} 0755 ${T}${CALC_SHAREDIR}; \
|
||||||
${CHMOD} 0755 $T${CALC_SHAREDIR}; \
|
${CHMOD} 0755 ${T}${CALC_SHAREDIR}; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
${Q}for i in ${CALC_FILES} /dev/null; do \
|
${Q} for i in ${CALC_FILES} /dev/null; do \
|
||||||
if [ "$$i" = "/dev/null" ]; then \
|
if [ "$$i" = "/dev/null" ]; then \
|
||||||
continue; \
|
continue; \
|
||||||
fi; \
|
fi; \
|
||||||
if ${CMP} -s $$i $T${CALC_SHAREDIR}/$$i; then \
|
if ${CMP} -s $$i ${T}${CALC_SHAREDIR}/$$i; then \
|
||||||
true; \
|
${TRUE}; \
|
||||||
else \
|
else \
|
||||||
rm -f $T${CALC_SHAREDIR}/$$i.new; \
|
${RM} -f ${T}${CALC_SHAREDIR}/$$i.new; \
|
||||||
cp -f $$i $T${CALC_SHAREDIR}/$$i.new; \
|
${CP} -f $$i ${T}${CALC_SHAREDIR}/$$i.new; \
|
||||||
${CHMOD} 0444 $T${CALC_SHAREDIR}/$$i.new; \
|
${CHMOD} 0444 ${T}${CALC_SHAREDIR}/$$i.new; \
|
||||||
mv -f $T${CALC_SHAREDIR}/$$i.new $T${CALC_SHAREDIR}/$$i; \
|
${MV} -f ${T}${CALC_SHAREDIR}/$$i.new ${T}${CALC_SHAREDIR}/$$i; \
|
||||||
echo "installed $T${CALC_SHAREDIR}/$$i"; \
|
echo "installed ${T}${CALC_SHAREDIR}/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -286,22 +294,22 @@ install: all
|
|||||||
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
||||||
#
|
#
|
||||||
uninstall:
|
uninstall:
|
||||||
-${Q}for i in ${CALC_FILES} /dev/null; do \
|
-${Q} for i in ${CALC_FILES} /dev/null; do \
|
||||||
if [ "$$i" = "/dev/null" ]; then \
|
if [ "$$i" = "/dev/null" ]; then \
|
||||||
continue; \
|
continue; \
|
||||||
fi; \
|
fi; \
|
||||||
if [ -f "$T${CALC_SHAREDIR}/$$i" ]; then \
|
if [ -f "${T}${CALC_SHAREDIR}/$$i" ]; then \
|
||||||
rm -f "$T${CALC_SHAREDIR}/$$i"; \
|
${RM} -f "${T}${CALC_SHAREDIR}/$$i"; \
|
||||||
if [ -f "$T${CALC_SHAREDIR}/$$i" ]; then \
|
if [ -f "${T}${CALC_SHAREDIR}/$$i" ]; then \
|
||||||
echo "cannot uninstall $T${CALC_SHAREDIR}/$$i"; \
|
echo "cannot uninstall ${T}${CALC_SHAREDIR}/$$i"; \
|
||||||
else \
|
else \
|
||||||
echo "uninstalled $T${CALC_SHAREDIR}/$$i"; \
|
echo "uninstalled ${T}${CALC_SHAREDIR}/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
-${Q}for i in ${CALC_SHAREDIR}; do \
|
-${Q} for i in ${CALC_SHAREDIR}; do \
|
||||||
if [ -d "$T$$i" ]; then \
|
if [ -d "${T}$$i" ]; then \
|
||||||
rmdir "$T$$i" 2>/dev/null; \
|
${RMDIR} "${T}$$i" 2>/dev/null; \
|
||||||
echo "cleaned up $T$$i"; \
|
echo "cleaned up ${T}$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
@@ -714,7 +714,7 @@ sumtimes.cal
|
|||||||
timehmean(N,M)
|
timehmean(N,M)
|
||||||
doalltimes(N)
|
doalltimes(N)
|
||||||
|
|
||||||
Give the runtimes for various ways of evaluating sums, sums of
|
Give the user CPU time for various ways of evaluating sums, sums of
|
||||||
squares, etc, for large lists and matrices. N is the size of
|
squares, etc, for large lists and matrices. N is the size of
|
||||||
the list or matrix to use. The doalltimes() function will run
|
the list or matrix to use. The doalltimes() function will run
|
||||||
all fo the sumtimes tests. For example:
|
all fo the sumtimes tests. For example:
|
||||||
@@ -1014,8 +1014,8 @@ xx_print.cal
|
|||||||
## 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.15 $
|
## @(#) $Revision: 29.16 $
|
||||||
## @(#) $Id: README,v 29.15 2006/06/23 00:34:55 chongo Exp $
|
## @(#) $Id: README,v 29.16 2006/12/16 11:18:46 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/README,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/README,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1990/02/15 01:50:32
|
## Under source code control: 1990/02/15 01:50:32
|
||||||
|
@@ -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.14 $
|
* @(#) $Revision: 29.15 $
|
||||||
* @(#) $Id: alg_config.cal,v 29.14 2006/06/11 07:22:05 chongo Exp $
|
* @(#) $Id: alg_config.cal,v 29.15 2006/12/16 11:18:46 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/alg_config.cal,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/alg_config.cal,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 2006/06/07 14:10:11
|
* Under source code control: 2006/06/07 14:10:11
|
||||||
@@ -85,7 +85,7 @@ define mul_loop(repeat, x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* multiply pairwise, all sets of a given length */
|
/* multiply pairwise, all sets of a given length */
|
||||||
start = runtime();
|
start = usertime();
|
||||||
for (i=0; i < repeat; ++i) {
|
for (i=0; i < repeat; ++i) {
|
||||||
|
|
||||||
if (len == 1) {
|
if (len == 1) {
|
||||||
@@ -130,7 +130,7 @@ define mul_loop(repeat, x)
|
|||||||
/*
|
/*
|
||||||
* return duration
|
* return duration
|
||||||
*/
|
*/
|
||||||
end = runtime();
|
end = usertime();
|
||||||
return end-start;
|
return end-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -477,7 +477,7 @@ define sq_loop(repeat, x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* square pairwise, all sets of a given length */
|
/* square pairwise, all sets of a given length */
|
||||||
start = runtime();
|
start = usertime();
|
||||||
for (i=0; i < repeat; ++i) {
|
for (i=0; i < repeat; ++i) {
|
||||||
|
|
||||||
if (len == 1) {
|
if (len == 1) {
|
||||||
@@ -524,7 +524,7 @@ define sq_loop(repeat, x)
|
|||||||
/*
|
/*
|
||||||
* return duration
|
* return duration
|
||||||
*/
|
*/
|
||||||
end = runtime();
|
end = usertime();
|
||||||
return end-start;
|
return end-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -874,7 +874,7 @@ define pow_loop(repeat, x, ex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* pmod pairwise, all sets of a given length */
|
/* pmod pairwise, all sets of a given length */
|
||||||
start = runtime();
|
start = usertime();
|
||||||
for (i=0; i < repeat; ++i) {
|
for (i=0; i < repeat; ++i) {
|
||||||
|
|
||||||
if (len == 1) {
|
if (len == 1) {
|
||||||
@@ -927,7 +927,7 @@ define pow_loop(repeat, x, ex)
|
|||||||
/*
|
/*
|
||||||
* return duration
|
* return duration
|
||||||
*/
|
*/
|
||||||
end = runtime();
|
end = usertime();
|
||||||
return end-start;
|
return end-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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: mfactor.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $
|
* @(#) $Id: mfactor.cal,v 29.3 2006/12/16 11:18:46 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/mfactor.cal,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/mfactor.cal,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1996/07/06 06:09:40
|
* Under source code control: 1996/07/06 06:09:40
|
||||||
@@ -261,7 +261,7 @@ define mfactor(n, start_k, rept_loop, p_elim)
|
|||||||
} else {
|
} else {
|
||||||
/* report this loop */
|
/* report this loop */
|
||||||
printf("at 2*%d*%d+1, cpu: %f\n",
|
printf("at 2*%d*%d+1, cpu: %f\n",
|
||||||
(q-1)/(2*n), n, runtime());
|
(q-1)/(2*n), n, usertime());
|
||||||
fflush(files(1));
|
fflush(files(1));
|
||||||
loop = 0;
|
loop = 0;
|
||||||
}
|
}
|
||||||
@@ -274,7 +274,7 @@ define mfactor(n, start_k, rept_loop, p_elim)
|
|||||||
if (rept_loop <= ++loop) {
|
if (rept_loop <= ++loop) {
|
||||||
/* report this loop */
|
/* report this loop */
|
||||||
printf("at 2*%d*%d+1, cpu: %f\n",
|
printf("at 2*%d*%d+1, cpu: %f\n",
|
||||||
(q-1)/(2*n), n, runtime());
|
(q-1)/(2*n), n, usertime());
|
||||||
fflush(files(1));
|
fflush(files(1));
|
||||||
loop = 0;
|
loop = 0;
|
||||||
}
|
}
|
||||||
|
@@ -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: randmprime.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $
|
* @(#) $Id: randmprime.cal,v 29.3 2006/12/16 11:18:46 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/randmprime.cal,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/randmprime.cal,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1994/03/14 23:11:21
|
* Under source code control: 1994/03/14 23:11:21
|
||||||
@@ -88,8 +88,8 @@ randmprime(bits, seed, dbg)
|
|||||||
* loop until we find a prime
|
* loop until we find a prime
|
||||||
*/
|
*/
|
||||||
if (dbg >= 1) {
|
if (dbg >= 1) {
|
||||||
start = runtime();
|
start = usertime();
|
||||||
init = runtime();
|
init = usertime();
|
||||||
plush = 0;
|
plush = 0;
|
||||||
print "DEBUG1: testing (h+" : plush : ")*2^" : n : "-1";
|
print "DEBUG1: testing (h+" : plush : ")*2^" : n : "-1";
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ randmprime(bits, seed, dbg)
|
|||||||
|
|
||||||
/* bump h, and n if needed */
|
/* bump h, and n if needed */
|
||||||
if (dbg >= 2) {
|
if (dbg >= 2) {
|
||||||
stop = runtime();
|
stop = usertime();
|
||||||
print "DEBUG2: last test:", stop-start, " total time:", stop-init;
|
print "DEBUG2: last test:", stop-start, " total time:", stop-init;
|
||||||
}
|
}
|
||||||
if (dbg >= 1) {
|
if (dbg >= 1) {
|
||||||
@@ -116,7 +116,7 @@ randmprime(bits, seed, dbg)
|
|||||||
|
|
||||||
/* found a prime */
|
/* found a prime */
|
||||||
if (dbg >= 2) {
|
if (dbg >= 2) {
|
||||||
stop = runtime();
|
stop = usertime();
|
||||||
print "DEBUG2: last test:", stop-start, " total time:", stop-init;
|
print "DEBUG2: last test:", stop-start, " total time:", stop-init;
|
||||||
print "DEBUG3: " : h : "*2^" : n : "-1 is prime";
|
print "DEBUG3: " : h : "*2^" : n : "-1 is prime";
|
||||||
}
|
}
|
||||||
|
@@ -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.35 $
|
* @(#) $Revision: 29.36 $
|
||||||
* @(#) $Id: regress.cal,v 29.35 2006/08/20 16:16:11 chongo Exp $
|
* @(#) $Id: regress.cal,v 29.36 2006/12/16 11:18:46 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:50:36
|
* Under source code control: 1990/02/15 01:50:36
|
||||||
@@ -497,7 +497,33 @@ define test_config()
|
|||||||
vrfy(config("mode2") == "off",
|
vrfy(config("mode2") == "off",
|
||||||
'556: config("mode2") == "off"');
|
'556: config("mode2") == "off"');
|
||||||
|
|
||||||
print '557: Ending test_config';
|
/* hz is numeric */
|
||||||
|
vrfy(isint(config("hz")), '557: isint(config("hz"))');
|
||||||
|
|
||||||
|
/* compile_custom is simple */
|
||||||
|
vrfy(issimple(config("compile_custom")),
|
||||||
|
'558: issimple(config("compile_custom"))');
|
||||||
|
|
||||||
|
/* allow_custom is simple */
|
||||||
|
vrfy(issimple(config("allow_custom")),
|
||||||
|
'559: issimple(config("allow_custom"))');
|
||||||
|
|
||||||
|
/* allow_custom is simple */
|
||||||
|
vrfy(issimple(config("allow_custom")),
|
||||||
|
'559: issimple(config("allow_custom"))');
|
||||||
|
|
||||||
|
/* baseb is numeric */
|
||||||
|
vrfy(isint(config("baseb")), '560: isint(config("baseb"))');
|
||||||
|
|
||||||
|
/* redecl_warn is simple */
|
||||||
|
vrfy(issimple(config("redecl_warn")),
|
||||||
|
'561: issimple(config("redecl_warn"))');
|
||||||
|
|
||||||
|
/* dupvar_warn is simple */
|
||||||
|
vrfy(issimple(config("dupvar_warn")),
|
||||||
|
'562: issimple(config("rdupvar_warn"))');
|
||||||
|
|
||||||
|
print '563: Ending test_config';
|
||||||
}
|
}
|
||||||
print '010: parsed test_config()';
|
print '010: parsed test_config()';
|
||||||
|
|
||||||
@@ -1375,7 +1401,12 @@ define test_functions()
|
|||||||
vrfy(a == -4, '1203: a == -4');
|
vrfy(a == -4, '1203: a == -4');
|
||||||
vrfy(b == 2, '1204: b == 2');
|
vrfy(b == 2, '1204: b == 2');
|
||||||
|
|
||||||
print '1205: Ending test_functions';
|
/* runtime(), systime(), usertime() return numeric values */
|
||||||
|
vrfy(isnum(runtime()), '1205: isnum(runtime())');
|
||||||
|
vrfy(isnum(systime()), '1206: isnum(systime())');
|
||||||
|
vrfy(isnum(usertime()), '1207: isnum(usertime())');
|
||||||
|
|
||||||
|
print '1208: Ending test_functions';
|
||||||
}
|
}
|
||||||
print '017: parsed test_functions()';
|
print '017: parsed test_functions()';
|
||||||
|
|
||||||
|
@@ -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.1 $
|
* @(#) $Revision: 29.2 $
|
||||||
* @(#) $Id: sumtimes.cal,v 29.1 2006/06/23 00:35:30 chongo Exp $
|
* @(#) $Id: sumtimes.cal,v 29.2 2006/12/16 11:18:46 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/sumtimes.cal,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/sumtimes.cal,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 2006/06/22 17:29
|
* Under source code control: 2006/06/22 17:29
|
||||||
@@ -40,13 +40,13 @@ define timematsum(N) {
|
|||||||
for (n = 0; n < N; n++) sumtimes_A[n] = rand(N);
|
for (n = 0; n < N; n++) sumtimes_A[n] = rand(N);
|
||||||
|
|
||||||
ptop = &sumtimes_A[n-1];
|
ptop = &sumtimes_A[n-1];
|
||||||
sumtimes_t0 = runtime();
|
sumtimes_t0 = usertime();
|
||||||
for (s = n = 0; n < N; n++) s += sumtimes_A[n];
|
for (s = n = 0; n < N; n++) s += sumtimes_A[n];
|
||||||
sumtimes_t1 = runtime();
|
sumtimes_t1 = usertime();
|
||||||
for (s = 0, p = &sumtimes_A[0]; p <= ptop; p++) s += *p;
|
for (s = 0, p = &sumtimes_A[0]; p <= ptop; p++) s += *p;
|
||||||
sumtimes_t2 = runtime();
|
sumtimes_t2 = usertime();
|
||||||
s = matsum(sumtimes_A);
|
s = matsum(sumtimes_A);
|
||||||
sumtimes_t3 = runtime();
|
sumtimes_t3 = usertime();
|
||||||
|
|
||||||
print "Matrix sum runtimes";
|
print "Matrix sum runtimes";
|
||||||
printf('\tStandard "for" loop:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0);
|
printf('\tStandard "for" loop:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0);
|
||||||
@@ -60,11 +60,11 @@ define timelistsum(N) {
|
|||||||
sumtimes_A = makelist(N);
|
sumtimes_A = makelist(N);
|
||||||
for (n = 0; n < N; n++) sumtimes_A[n] = rand(N);
|
for (n = 0; n < N; n++) sumtimes_A[n] = rand(N);
|
||||||
|
|
||||||
sumtimes_t0 = runtime();
|
sumtimes_t0 = usertime();
|
||||||
for (s = n = 0; n < N; n++) s += sumtimes_A[n];
|
for (s = n = 0; n < N; n++) s += sumtimes_A[n];
|
||||||
sumtimes_t1 = runtime();
|
sumtimes_t1 = usertime();
|
||||||
s = sum(sumtimes_A);
|
s = sum(sumtimes_A);
|
||||||
sumtimes_t2 = runtime();
|
sumtimes_t2 = usertime();
|
||||||
print "List sum runtimes";
|
print "List sum runtimes";
|
||||||
printf('\tStandard "for" loop:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0);
|
printf('\tStandard "for" loop:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0);
|
||||||
printf('\tUsing builtin "sum":\t\t%.4f\n', sumtimes_t2 - sumtimes_t1);
|
printf('\tUsing builtin "sum":\t\t%.4f\n', sumtimes_t2 - sumtimes_t1);
|
||||||
@@ -76,9 +76,9 @@ define timematsort(N) {
|
|||||||
|
|
||||||
sumtimes_A = mat[N];
|
sumtimes_A = mat[N];
|
||||||
for (n = 0; n < N; n++) sumtimes_A[n] = rand(N);
|
for (n = 0; n < N; n++) sumtimes_A[n] = rand(N);
|
||||||
sumtimes_t0 = runtime();
|
sumtimes_t0 = usertime();
|
||||||
sort(sumtimes_A);
|
sort(sumtimes_A);
|
||||||
sumtimes_t1 = runtime();
|
sumtimes_t1 = usertime();
|
||||||
printf('\tMatrix sort runtime:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0);
|
printf('\tMatrix sort runtime:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,9 +88,9 @@ define timelistsort(N) {
|
|||||||
|
|
||||||
sumtimes_A = makelist(N);
|
sumtimes_A = makelist(N);
|
||||||
for (n = 0; n < N; n++) sumtimes_A[n] = rand(N);
|
for (n = 0; n < N; n++) sumtimes_A[n] = rand(N);
|
||||||
sumtimes_t0 = runtime();
|
sumtimes_t0 = usertime();
|
||||||
sort(sumtimes_A);
|
sort(sumtimes_A);
|
||||||
sumtimes_t1 = runtime();
|
sumtimes_t1 = usertime();
|
||||||
printf('\tList sort runtime:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0);
|
printf('\tList sort runtime:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,9 +99,9 @@ define timematreverse(N) {
|
|||||||
|
|
||||||
sumtimes_A = mat[N];
|
sumtimes_A = mat[N];
|
||||||
for (n = 0; n < N; n++) sumtimes_A[n] = rand(N);
|
for (n = 0; n < N; n++) sumtimes_A[n] = rand(N);
|
||||||
sumtimes_t0 = runtime();
|
sumtimes_t0 = usertime();
|
||||||
reverse(sumtimes_A);
|
reverse(sumtimes_A);
|
||||||
sumtimes_t1 = runtime();
|
sumtimes_t1 = usertime();
|
||||||
printf('\tMatrix reverse runtime %.4f\n', sumtimes_t1 - sumtimes_t0);
|
printf('\tMatrix reverse runtime %.4f\n', sumtimes_t1 - sumtimes_t0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,9 +110,9 @@ define timelistreverse(N) {
|
|||||||
|
|
||||||
sumtimes_A = makelist(N);
|
sumtimes_A = makelist(N);
|
||||||
for (n = 0; n < N; n++) sumtimes_A[n] = rand(N);
|
for (n = 0; n < N; n++) sumtimes_A[n] = rand(N);
|
||||||
sumtimes_t0 = runtime();
|
sumtimes_t0 = usertime();
|
||||||
reverse(sumtimes_A);
|
reverse(sumtimes_A);
|
||||||
sumtimes_t1 = runtime();
|
sumtimes_t1 = usertime();
|
||||||
printf('\tList reverse runtime:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0);
|
printf('\tList reverse runtime:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,11 +124,11 @@ define timematssq(N) {
|
|||||||
for (n = 0; n < N; n++) sumtimes_A[n] = rand(N);
|
for (n = 0; n < N; n++) sumtimes_A[n] = rand(N);
|
||||||
|
|
||||||
ptop = &sumtimes_A[n-1];
|
ptop = &sumtimes_A[n-1];
|
||||||
sumtimes_t0 = runtime();
|
sumtimes_t0 = usertime();
|
||||||
for (s = n = 0; n < N; n++) s += sumtimes_A[n]^2;
|
for (s = n = 0; n < N; n++) s += sumtimes_A[n]^2;
|
||||||
sumtimes_t1 = runtime();
|
sumtimes_t1 = usertime();
|
||||||
for (s = 0, p = &sumtimes_A[0]; p <= ptop; p++) s += (*p)^2;
|
for (s = 0, p = &sumtimes_A[0]; p <= ptop; p++) s += (*p)^2;
|
||||||
sumtimes_t2 = runtime();
|
sumtimes_t2 = usertime();
|
||||||
|
|
||||||
print "Matrix sum of squares runtimes";
|
print "Matrix sum of squares runtimes";
|
||||||
printf('\tStandard "for" loop:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0);
|
printf('\tStandard "for" loop:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0);
|
||||||
@@ -141,11 +141,11 @@ define timelistssq(N) {
|
|||||||
sumtimes_A = makelist(N);
|
sumtimes_A = makelist(N);
|
||||||
for (n = 0; n < N; n++) sumtimes_A[n] = rand(N);
|
for (n = 0; n < N; n++) sumtimes_A[n] = rand(N);
|
||||||
|
|
||||||
sumtimes_t0 = runtime();
|
sumtimes_t0 = usertime();
|
||||||
for (s = n = 0; n < N; n++) s += sumtimes_A[n]^2;
|
for (s = n = 0; n < N; n++) s += sumtimes_A[n]^2;
|
||||||
sumtimes_t1 = runtime();
|
sumtimes_t1 = usertime();
|
||||||
s = ssq(sumtimes_A);
|
s = ssq(sumtimes_A);
|
||||||
sumtimes_t2 = runtime();
|
sumtimes_t2 = usertime();
|
||||||
print "List sum of squares runtimes";
|
print "List sum of squares runtimes";
|
||||||
printf('\tStandard "for" loop:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0);
|
printf('\tStandard "for" loop:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0);
|
||||||
printf('\tUsing builtin "ssq":\t\t%.4f\n', sumtimes_t2 - sumtimes_t1);
|
printf('\tUsing builtin "ssq":\t\t%.4f\n', sumtimes_t2 - sumtimes_t1);
|
||||||
@@ -157,12 +157,12 @@ define timehmean(N, M = 10) {
|
|||||||
sumtimes_A = makelist(N);
|
sumtimes_A = makelist(N);
|
||||||
for (n = 0; n < N; n++) sumtimes_A[n] = rand(1, M);
|
for (n = 0; n < N; n++) sumtimes_A[n] = rand(1, M);
|
||||||
|
|
||||||
sumtimes_t0 = runtime();
|
sumtimes_t0 = usertime();
|
||||||
for (s = n = 0; n < N; n++) s += 1/sumtimes_A[n];
|
for (s = n = 0; n < N; n++) s += 1/sumtimes_A[n];
|
||||||
v1 = N/s;
|
v1 = N/s;
|
||||||
sumtimes_t1 = runtime();
|
sumtimes_t1 = usertime();
|
||||||
v2 = hmean(sumtimes_A);
|
v2 = hmean(sumtimes_A);
|
||||||
sumtimes_t2 = runtime();
|
sumtimes_t2 = usertime();
|
||||||
print v1, v2;
|
print v1, v2;
|
||||||
print "List harmonic meanruntimes";
|
print "List harmonic meanruntimes";
|
||||||
printf('\tStandard "for" loop:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0);
|
printf('\tStandard "for" loop:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0);
|
||||||
|
@@ -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.5 $
|
||||||
* @(#) $Id: test3300.cal,v 29.3 2006/06/20 09:29:16 chongo Exp $
|
* @(#) $Id: test3300.cal,v 29.5 2006/12/16 11:19:45 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test3300.cal,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test3300.cal,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1995/12/02 04:27:41
|
* Under source code control: 1995/12/02 04:27:41
|
||||||
@@ -81,9 +81,9 @@ define testr(str, n, N, verbose)
|
|||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
for (j = 0; j < n; j++)
|
for (j = 0; j < n; j++)
|
||||||
A[i,j] = rand(-(N^2), N^2)/rand(1, N);
|
A[i,j] = rand(-(N^2), N^2)/rand(1, N);
|
||||||
t = runtime();
|
t = usertime();
|
||||||
d1 = det(A);
|
d1 = det(A);
|
||||||
t = runtime() - t;
|
t = usertime() - t;
|
||||||
d2 = det(A^2);
|
d2 = det(A^2);
|
||||||
if (d2 != d1^2) {
|
if (d2 != d1^2) {
|
||||||
if (verbose > 0) {
|
if (verbose > 0) {
|
||||||
|
@@ -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: test4000.cal,v 29.3 2006/06/20 09:29:16 chongo Exp $
|
* @(#) $Id: test4000.cal,v 29.4 2006/12/16 11:18:46 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test4000.cal,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test4000.cal,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1996/03/13 02:38:45
|
* Under source code control: 1996/03/13 02:38:45
|
||||||
@@ -145,7 +145,7 @@ define ptimes(str, N, n, count, skip, verbose)
|
|||||||
mat A[n];
|
mat A[n];
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
A[i] = plen(N);
|
A[i] = plen(N);
|
||||||
t = runtime();
|
t = usertime();
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
p = ptest(A[i], count, skip);
|
p = ptest(A[i], count, skip);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
@@ -159,7 +159,7 @@ define ptimes(str, N, n, count, skip, verbose)
|
|||||||
if (m) {
|
if (m) {
|
||||||
printf("*** %d error(s)\n", m);
|
printf("*** %d error(s)\n", m);
|
||||||
} else {
|
} else {
|
||||||
t = round(runtime() - t, 4);
|
t = round(usertime() - t, 4);
|
||||||
if (verbose > 1) {
|
if (verbose > 1) {
|
||||||
printf("%d probable primes: time = %d\n", n, t);
|
printf("%d probable primes: time = %d\n", n, t);
|
||||||
} else {
|
} else {
|
||||||
@@ -194,7 +194,7 @@ define ctimes(str, N, n, count, skip, verbose)
|
|||||||
mat A[n];
|
mat A[n];
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
A[i] = clen(N);
|
A[i] = clen(N);
|
||||||
t = runtime();
|
t = usertime();
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
p = ptest(A[i], count, skip);
|
p = ptest(A[i], count, skip);
|
||||||
if (p) {
|
if (p) {
|
||||||
@@ -208,7 +208,7 @@ define ctimes(str, N, n, count, skip, verbose)
|
|||||||
if (m) {
|
if (m) {
|
||||||
printf("*** %d error(s)\n", m);
|
printf("*** %d error(s)\n", m);
|
||||||
} else {
|
} else {
|
||||||
t = round(runtime() - t, 4);
|
t = round(usertime() - t, 4);
|
||||||
if (verbose > 1) {
|
if (verbose > 1) {
|
||||||
printf("%d probable primes: time = %d\n", n, t);
|
printf("%d probable primes: time = %d\n", n, t);
|
||||||
} else {
|
} else {
|
||||||
@@ -242,7 +242,7 @@ define crtimes(str, a, b, n, count, skip, verbose)
|
|||||||
A[i] = rand(a,b);
|
A[i] = rand(a,b);
|
||||||
P[i] = ptest(A[i], 20, 0);
|
P[i] = ptest(A[i], 20, 0);
|
||||||
}
|
}
|
||||||
t = runtime();
|
t = usertime();
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
p = ptest(A[i], count, skip);
|
p = ptest(A[i], count, skip);
|
||||||
if (p != P[i]) {
|
if (p != P[i]) {
|
||||||
@@ -257,7 +257,7 @@ define crtimes(str, a, b, n, count, skip, verbose)
|
|||||||
if (m) {
|
if (m) {
|
||||||
printf("*** %d error(s)?\n", m);
|
printf("*** %d error(s)?\n", m);
|
||||||
} else {
|
} else {
|
||||||
t = round(runtime() - t, 4);
|
t = round(usertime() - t, 4);
|
||||||
if (verbose > 1) {
|
if (verbose > 1) {
|
||||||
printf("%d probable primes: time = %d\n", n, t);
|
printf("%d probable primes: time = %d\n", n, t);
|
||||||
} else {
|
} else {
|
||||||
@@ -295,16 +295,16 @@ define ntimes(str, N, n, count, skip, residue, modulus, verbose)
|
|||||||
mat A[n];
|
mat A[n];
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
A[i] = rlen(N);
|
A[i] = rlen(N);
|
||||||
t = runtime();
|
t = usertime();
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
p = nextcand(A[i], count, skip, residue, modulus);
|
p = nextcand(A[i], count, skip, residue, modulus);
|
||||||
}
|
}
|
||||||
tnext = round(runtime() - t, 4);
|
tnext = round(usertime() - t, 4);
|
||||||
t = runtime();
|
t = usertime();
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
p = prevcand(A[i], count, skip, residue, modulus);
|
p = prevcand(A[i], count, skip, residue, modulus);
|
||||||
}
|
}
|
||||||
tprev = round(runtime() - t, 4);
|
tprev = round(usertime() - t, 4);
|
||||||
if (verbose > 0) {
|
if (verbose > 0) {
|
||||||
printf("%d evaluations, nextcand: %d, prevcand: %d\n", n, tnext, tprev);
|
printf("%d evaluations, nextcand: %d, prevcand: %d\n", n, tnext, tprev);
|
||||||
}
|
}
|
||||||
|
@@ -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.4 $
|
* @(#) $Revision: 29.5 $
|
||||||
* @(#) $Id: test4100.cal,v 29.4 2006/06/20 09:29:16 chongo Exp $
|
* @(#) $Id: test4100.cal,v 29.5 2006/12/16 11:18:46 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test4100.cal,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test4100.cal,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1996/03/13 03:53:22
|
* Under source code control: 1996/03/13 03:53:22
|
||||||
@@ -245,38 +245,38 @@ define times(str,N,n,verbose)
|
|||||||
C[i] = rand(m2);
|
C[i] = rand(m2);
|
||||||
}
|
}
|
||||||
z = rcin(0,m); /* to initialize redc and maybe lastmod information */
|
z = rcin(0,m); /* to initialize redc and maybe lastmod information */
|
||||||
t = runtime();
|
t = usertime();
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
z = rcin(A[i],m);
|
z = rcin(A[i],m);
|
||||||
trcin = round(runtime() - t, 3);
|
trcin = round(usertime() - t, 3);
|
||||||
t = runtime();
|
t = usertime();
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
z = rcout(A[i],m);
|
z = rcout(A[i],m);
|
||||||
trcout = round(runtime() - t, 3);
|
trcout = round(usertime() - t, 3);
|
||||||
t = runtime();
|
t = usertime();
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
z = rcmul(A[i],B[i],m);
|
z = rcmul(A[i],B[i],m);
|
||||||
trcmul = round(runtime() - t, 3);
|
trcmul = round(usertime() - t, 3);
|
||||||
t = runtime();
|
t = usertime();
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
z = rcsq(A[i],m);
|
z = rcsq(A[i],m);
|
||||||
trcsq = round(runtime() - t, 3);
|
trcsq = round(usertime() - t, 3);
|
||||||
t = runtime();
|
t = usertime();
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
z = A[i] * B[i];
|
z = A[i] * B[i];
|
||||||
tmul = round(runtime() - t, 3);
|
tmul = round(usertime() - t, 3);
|
||||||
t = runtime();
|
t = usertime();
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
z = A[i]^2;
|
z = A[i]^2;
|
||||||
tsq = round(runtime() - t, 3);
|
tsq = round(usertime() - t, 3);
|
||||||
t = runtime();
|
t = usertime();
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
z = C[i] % A[i];
|
z = C[i] % A[i];
|
||||||
tmod = round(runtime() - t, 3);
|
tmod = round(usertime() - t, 3);
|
||||||
t = runtime();
|
t = usertime();
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
quomod(C[i], A[i], x, y);
|
quomod(C[i], A[i], x, y);
|
||||||
tquomod = round(runtime() - t,3);
|
tquomod = round(usertime() - t,3);
|
||||||
|
|
||||||
if (verbose > 1) {
|
if (verbose > 1) {
|
||||||
printf("rcin: %d, rcout: %d, rcmul: %d, rcsq: %d\n",
|
printf("rcin: %d, rcout: %d, rcmul: %d, rcsq: %d\n",
|
||||||
@@ -326,29 +326,29 @@ define powtimes(str, N1, N2, n, verbose)
|
|||||||
Ar[i] = rcin(A[i], v);
|
Ar[i] = rcin(A[i], v);
|
||||||
B[i] = rlen_4100(N2);
|
B[i] = rlen_4100(N2);
|
||||||
}
|
}
|
||||||
t = runtime();
|
t = usertime();
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
z1 += pmod(A[i], B[i], v);
|
z1 += pmod(A[i], B[i], v);
|
||||||
tbignum = round(runtime() - t, 4);
|
tbignum = round(usertime() - t, 4);
|
||||||
config("pow2", 1e6);
|
config("pow2", 1e6);
|
||||||
t = runtime();
|
t = usertime();
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
z2 += pmod(A[i], B[i], v);
|
z2 += pmod(A[i], B[i], v);
|
||||||
tnormal = round(runtime() - t, 4);
|
tnormal = round(usertime() - t, 4);
|
||||||
config("redc2",1e6);
|
config("redc2",1e6);
|
||||||
t = runtime();
|
t = usertime();
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
z3 += pmod(A[i], B[i], v);
|
z3 += pmod(A[i], B[i], v);
|
||||||
tsmall = round(runtime() - t, 4);
|
tsmall = round(usertime() - t, 4);
|
||||||
t = runtime();
|
t = usertime();
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
z4 += rcpow(Ar[i], B[i], v);
|
z4 += rcpow(Ar[i], B[i], v);
|
||||||
trcsmall = round(runtime() - t, 4);
|
trcsmall = round(usertime() - t, 4);
|
||||||
config("redc2", 2);
|
config("redc2", 2);
|
||||||
t = runtime();
|
t = usertime();
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
z5 += rcpow(Ar[i], B[i], v);
|
z5 += rcpow(Ar[i], B[i], v);
|
||||||
trcbig = round(runtime() - t, 4);
|
trcbig = round(usertime() - t, 4);
|
||||||
|
|
||||||
if (z1 != z2) {
|
if (z1 != z2) {
|
||||||
++m;
|
++m;
|
||||||
@@ -419,13 +419,13 @@ define inittimes(str,N,n,verbose)
|
|||||||
M[i] = olen(N);
|
M[i] = olen(N);
|
||||||
A[i] = rand(M[i]);
|
A[i] = rand(M[i]);
|
||||||
}
|
}
|
||||||
t = runtime();
|
t = usertime();
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
R[i] = rcin(A[i], M[i]);
|
R[i] = rcin(A[i], M[i]);
|
||||||
trcin = round(runtime() - t, 4);
|
trcin = round(usertime() - t, 4);
|
||||||
for (i = 0; i < n; i++)
|
for (i = 0; i < n; i++)
|
||||||
B[i] = rcout(R[i], M[i]);
|
B[i] = rcout(R[i], M[i]);
|
||||||
trcout = round(runtime() - t, 4);
|
trcout = round(usertime() - t, 4);
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
if (B[i] != A[i]) {
|
if (B[i] != A[i]) {
|
||||||
++m;
|
++m;
|
||||||
|
15
calc.c
15
calc.c
@@ -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.13 $
|
* @(#) $Revision: 29.14 $
|
||||||
* @(#) $Id: calc.c,v 29.13 2006/05/19 15:26:10 chongo Exp $
|
* @(#) $Id: calc.c,v 29.14 2007/02/07 00:37:25 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:48:11
|
* Under source code control: 1990/02/15 01:48:11
|
||||||
@@ -416,6 +416,7 @@ main(int argc, char **argv)
|
|||||||
cp++;
|
cp++;
|
||||||
*bp++ = ';';
|
*bp++ = ';';
|
||||||
cmdlen++;
|
cmdlen++;
|
||||||
|
s_flag = TRUE; /* -f implies -s */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
@@ -431,11 +432,13 @@ main(int argc, char **argv)
|
|||||||
fprintf(stderr, "Illegal option -%c\n",
|
fprintf(stderr, "Illegal option -%c\n",
|
||||||
c);
|
c);
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"usage: %s [-a] [-c] [-C] [-d] [-e] [-h] [-i] [-m mode]\n"
|
"usage: %s [-c] [-C] [-d] [-e] [-h] [-i] [-m mode]\n"
|
||||||
"\t[-D calc_debug[:resource_debug[:user_debug]]]\n"
|
"\t[-D calc_debug[:resource_debug[:user_debug]]]\n"
|
||||||
"\t[-O] [-p] [-q] [-u] [-v] "
|
"\t[-O] [-p] [-q] [-s] [-u] [-v] "
|
||||||
"[--] [calc_cmd ...]\n",
|
"[--] [calc_cmd ...]\n"
|
||||||
program);
|
"usage: %s ... -f filename\n"
|
||||||
|
"1st cscript line: #/path/to/calc ... -f\n",
|
||||||
|
program, program);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (havearg)
|
if (havearg)
|
||||||
|
8
calc.man
8
calc.man
@@ -1,5 +1,5 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" Copyright (C) 1999-2004 Landon Curt Noll
|
.\" Copyright (C) 1999-2007 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
|
||||||
@@ -15,8 +15,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.20 $
|
.\" @(#) $Revision: 29.21 $
|
||||||
.\" @(#) $Id: calc.man,v 29.20 2006/06/01 12:04:16 chongo Exp $
|
.\" @(#) $Id: calc.man,v 29.21 2007/02/07 00:38:43 chongo Exp $
|
||||||
.\" @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.man,v $
|
.\" @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.man,v $
|
||||||
.\"
|
.\"
|
||||||
.\" Under source code control: 1991/07/23 05:48:26
|
.\" Under source code control: 1991/07/23 05:48:26
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
.\" calculator by David I. Bell
|
.\" calculator by David I. Bell
|
||||||
.\" man page by Landon Noll
|
.\" man page by Landon Noll
|
||||||
.\"
|
.\"
|
||||||
.TH calc 1 "^..^" "1999-11-30"
|
.TH calc 1 "^..^" "2007-02-06"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
calc \- arbitrary precision calculator
|
calc \- arbitrary precision calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@@ -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.4 $
|
# @(#) $Revision: 29.5 $
|
||||||
# @(#) $Id: check.awk,v 29.4 2006/08/20 16:16:31 chongo Exp $
|
# @(#) $Id: check.awk,v 29.5 2006/09/18 08:01:13 chongo Exp $
|
||||||
# @(#) $Source: /usr/local/src/cmd/calc/RCS/check.awk,v $
|
# @(#) $Source: /usr/local/src/cmd/calc/RCS/check.awk,v $
|
||||||
#
|
#
|
||||||
# Under source code control: 1996/05/25 22:07:58
|
# Under source code control: 1996/05/25 22:07:58
|
||||||
@@ -64,7 +64,7 @@ NF == 0 {
|
|||||||
end_seen = 1;
|
end_seen = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$1 ~ /^[0-9]+:/ || $1 ~ /^[0-9]+-[0-9]*:/ || $1 ~ /^"))$/ {
|
$1 ~ /^[0-9]+:/ || $1 ~ /^[0-9]+-[0-9]*:/ || $1 ~ /^"\)\)$/ {
|
||||||
if (error > 0) {
|
if (error > 0) {
|
||||||
if (havebuf2) {
|
if (havebuf2) {
|
||||||
print buf2;
|
print buf2;
|
||||||
|
@@ -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.21 $
|
* @(#) $Revision: 29.22 $
|
||||||
* @(#) $Id: codegen.c,v 29.21 2006/06/20 10:28:06 chongo Exp $
|
* @(#) $Id: codegen.c,v 29.22 2006/12/15 16:25:09 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
|
||||||
@@ -144,6 +144,7 @@ getcommands(BOOL toplevel)
|
|||||||
case T_HELP:
|
case T_HELP:
|
||||||
for (i=1;;i++) {
|
for (i=1;;i++) {
|
||||||
switch(getfilename(name, MAXCMD+1, NULL)) {
|
switch(getfilename(name, MAXCMD+1, NULL)) {
|
||||||
|
case 1:
|
||||||
case -1:
|
case -1:
|
||||||
if(i == 1) {
|
if(i == 1) {
|
||||||
strcpy(name, DEFAULTCALCHELP);
|
strcpy(name, DEFAULTCALCHELP);
|
||||||
|
40
config.c
40
config.c
@@ -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.22 $
|
* @(#) $Revision: 29.23 $
|
||||||
* @(#) $Id: config.c,v 29.22 2006/06/25 22:05:38 chongo Exp $
|
* @(#) $Id: config.c,v 29.23 2006/12/15 16:17:18 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
|
||||||
@@ -31,6 +31,24 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "have_times.h"
|
||||||
|
#if defined(HAVE_TIME_H)
|
||||||
|
#include <time.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_TIMES_H)
|
||||||
|
#include <times.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_SYS_TIME_H)
|
||||||
|
#include <sys/time.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAVE_SYS_TIMES_H)
|
||||||
|
#include <sys/times.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "calc.h"
|
#include "calc.h"
|
||||||
#include "token.h"
|
#include "token.h"
|
||||||
#include "zrand.h"
|
#include "zrand.h"
|
||||||
@@ -45,6 +63,15 @@
|
|||||||
# define strdup(x) calc_strdup((CONST char *)(x))
|
# define strdup(x) calc_strdup((CONST char *)(x))
|
||||||
#endif /* HAVE_STRDUP */
|
#endif /* HAVE_STRDUP */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* deal with systems that lack a defined CLK_TCK
|
||||||
|
*/
|
||||||
|
#if defined(CLK_TCK)
|
||||||
|
# define CALC_HZ ((long)(CLK_TCK))
|
||||||
|
#else
|
||||||
|
# define CALC_HZ (0L) /* no defined clock tick rate */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Table of configuration types that can be set or read.
|
* Table of configuration types that can be set or read.
|
||||||
@@ -100,6 +127,7 @@ NAMETYPE configs[] = {
|
|||||||
{"baseb", CONFIG_BASEB},
|
{"baseb", CONFIG_BASEB},
|
||||||
{"redecl_warn", CONFIG_REDECL_WARN},
|
{"redecl_warn", CONFIG_REDECL_WARN},
|
||||||
{"dupvar_warn", CONFIG_DUPVAR_WARN},
|
{"dupvar_warn", CONFIG_DUPVAR_WARN},
|
||||||
|
{"hz", CONFIG_HZ},
|
||||||
{NULL, 0}
|
{NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -941,6 +969,10 @@ setconfig(int type, VALUE *vp)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CONFIG_HZ:
|
||||||
|
math_error("The clock tick rate config parameter is read-only");
|
||||||
|
/*NOTREACHED*/
|
||||||
|
|
||||||
default:
|
default:
|
||||||
math_error("Setting illegal config parameter");
|
math_error("Setting illegal config parameter");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
@@ -1330,6 +1362,10 @@ config_value(CONFIG *cfg, int type, VALUE *vp)
|
|||||||
i = (cfg->dupvar_warn ? 1 : 0);
|
i = (cfg->dupvar_warn ? 1 : 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CONFIG_HZ:
|
||||||
|
i = CALC_HZ;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
math_error("Getting illegal CONFIG element");
|
math_error("Getting illegal CONFIG element");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
5
config.h
5
config.h
@@ -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.20 $
|
* @(#) $Revision: 29.21 $
|
||||||
* @(#) $Id: config.h,v 29.20 2006/06/25 22:05:38 chongo Exp $
|
* @(#) $Id: config.h,v 29.21 2006/12/15 16:16:59 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1995/11/01 22:20:17
|
* Under source code control: 1995/11/01 22:20:17
|
||||||
@@ -97,6 +97,7 @@
|
|||||||
#define CONFIG_BASEB 43
|
#define CONFIG_BASEB 43
|
||||||
#define CONFIG_REDECL_WARN 44
|
#define CONFIG_REDECL_WARN 44
|
||||||
#define CONFIG_DUPVAR_WARN 45
|
#define CONFIG_DUPVAR_WARN 45
|
||||||
|
#define CONFIG_HZ 46
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/local/src/cmd/calc/calc -q -s -f
|
#!/usr/local/src/cmd/calc/calc -q -f
|
||||||
/*
|
/*
|
||||||
* 4dsphere - determine if 6 points lie on the surface of a sphere in R^4
|
* 4dsphere - determine if 6 points lie on the surface of a sphere in R^4
|
||||||
*
|
*
|
||||||
@@ -26,8 +26,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: 1.3 $
|
* @(#) $Revision: 1.4 $
|
||||||
* @(#) $Id: 4dsphere.calc,v 1.3 2001/06/06 09:06:29 chongo Exp $
|
* @(#) $Id: 4dsphere.calc,v 1.4 2007/02/07 00:34:04 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/4dsphere.calc,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/4dsphere.calc,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 2001/05/03 19:02:03
|
* Under source code control: 2001/05/03 19:02:03
|
||||||
|
225
cscript/Makefile
225
cscript/Makefile
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# cscript - makefile for calc shell script files
|
# cscript - makefile for calc shell script files
|
||||||
#
|
#
|
||||||
# Copyright (C) 1999 Landon Curt Noll
|
# Copyright (C) 1999-2006 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
|
||||||
@@ -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.24 $
|
# @(#) $Revision: 29.31 $
|
||||||
# @(#) $Id: Makefile,v 29.24 2006/06/26 05:46:06 chongo Exp $
|
# @(#) $Id: Makefile,v 29.31 2007/02/07 01:43:56 chongo Exp $
|
||||||
# @(#) $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
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
# required vars
|
# required vars
|
||||||
#
|
#
|
||||||
SHELL= /bin/sh
|
SHELL= /bin/sh
|
||||||
MAKE_FILE = Makefile
|
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
|
||||||
@@ -62,9 +62,9 @@ INCDIR= /usr/include
|
|||||||
# ${LIBDIR} where calc link library (*.a) files are installed
|
# ${LIBDIR} where calc link library (*.a) files are installed
|
||||||
# ${CALC_SHAREDIR} where to install calc help, .cal, startup, config files
|
# ${CALC_SHAREDIR} where to install calc help, .cal, startup, config files
|
||||||
#
|
#
|
||||||
# NOTE: The install rule prepends installation paths with $T, which
|
# NOTE: The install rule prepends installation paths with ${T}, which
|
||||||
# by default is empty. If $T is non-empty, then installation
|
# by default is empty. If ${T} is non-empty, then installation
|
||||||
# locations will be relative to the $T directory.
|
# locations will be relative to the ${T} directory.
|
||||||
#
|
#
|
||||||
# For DJGPP, select:
|
# For DJGPP, select:
|
||||||
#
|
#
|
||||||
@@ -96,12 +96,12 @@ CALC_SHAREDIR= /usr/share/calc
|
|||||||
# ${CALC_INCDIR} where the calc include files are installed
|
# ${CALC_INCDIR} where the calc include files are installed
|
||||||
# ${CUSTOMCALDIR} where custom *.cal files are installed
|
# ${CUSTOMCALDIR} where custom *.cal files are installed
|
||||||
# ${CUSTOMHELPDIR} where custom help files are installed
|
# ${CUSTOMHELPDIR} where custom help files are installed
|
||||||
# ${CUSTOMINCPDIR} where custom .h files are installed
|
# ${CUSTOMINCDIR} where custom .h files are installed
|
||||||
# ${SCRIPTDIR} where calc shell scripts are installed
|
# ${SCRIPTDIR} where calc shell scripts are installed
|
||||||
#
|
#
|
||||||
# NOTE: The install rule prepends installation paths with $T, which
|
# NOTE: The install rule prepends installation paths with ${T}, which
|
||||||
# by default is empty. If $T is non-empty, then installation
|
# by default is empty. If ${T} is non-empty, then installation
|
||||||
# locations will be relative to the $T directory.
|
# locations will be relative to the ${T} directory.
|
||||||
#
|
#
|
||||||
# If in doubt, set:
|
# If in doubt, set:
|
||||||
#
|
#
|
||||||
@@ -121,8 +121,8 @@ SCRIPTDIR= ${BINDIR}/cscript
|
|||||||
|
|
||||||
# T - top level directory under which calc will be installed
|
# T - top level directory under which calc will be installed
|
||||||
#
|
#
|
||||||
# The calc install is performed under $T, the calc build is
|
# The calc install is performed under ${T}, the calc build is
|
||||||
# performed under /. The purpose for $T is to allow someone
|
# performed under /. The purpose for ${T} is to allow someone
|
||||||
# to install calc somewhere other than into the system area.
|
# to install calc somewhere other than into the system area.
|
||||||
#
|
#
|
||||||
# For example, if:
|
# For example, if:
|
||||||
@@ -142,10 +142,10 @@ SCRIPTDIR= ${BINDIR}/cscript
|
|||||||
# calc help, .cal ...: /var/tmp/testing/usr/share/calc
|
# calc help, .cal ...: /var/tmp/testing/usr/share/calc
|
||||||
# ... etc ... /var/tmp/testing/...
|
# ... etc ... /var/tmp/testing/...
|
||||||
#
|
#
|
||||||
# If $T is empty, calc is installed under /, which is the same
|
# If ${T} is empty, calc is installed under /, which is the same
|
||||||
# top of tree for which it was built. If $T is non-empty, then
|
# top of tree for which it was built. If ${T} is non-empty, then
|
||||||
# calc is installed under $T, as if one had to chroot under
|
# calc is installed under ${T}, as if one had to chroot under
|
||||||
# $T for calc to operate.
|
# ${T} for calc to operate.
|
||||||
#
|
#
|
||||||
# If in doubt, use T=
|
# If in doubt, use T=
|
||||||
#
|
#
|
||||||
@@ -166,6 +166,14 @@ SED= sed
|
|||||||
SORT= sort
|
SORT= sort
|
||||||
FMT= fmt
|
FMT= fmt
|
||||||
CMP= cmp
|
CMP= cmp
|
||||||
|
MKDIR= mkdir
|
||||||
|
RMDIR= rmdir
|
||||||
|
RM= rm
|
||||||
|
TOUCH= touch
|
||||||
|
MV= mv
|
||||||
|
CP= cp
|
||||||
|
CO= co
|
||||||
|
TRUE= true
|
||||||
|
|
||||||
# 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.
|
||||||
@@ -191,7 +199,7 @@ SCRIPT_SRC= 4dsphere.calc fproduct.calc mersenne.calc \
|
|||||||
|
|
||||||
# These files are found (but not built) in the distribution
|
# These files are found (but not built) in the distribution
|
||||||
#
|
#
|
||||||
DISTLIST= ${SCRIPT_SRC} ${MAKE_FILE} README
|
DISTLIST= ${SCRIPT_SRC} ${MAKE_FILE} README.src
|
||||||
|
|
||||||
# These files are used to make (but not build) a calc .a library
|
# These files are used to make (but not build) a calc .a library
|
||||||
#
|
#
|
||||||
@@ -199,24 +207,28 @@ CALCLIBLIST=
|
|||||||
|
|
||||||
# complete list of targets
|
# complete list of targets
|
||||||
#
|
#
|
||||||
# NOTE: This list MUST be co-ordinated with the ${CSCRIPT_TARGETS} variable
|
# NOTE: This list MUST be coordinated with the ${CSCRIPT_TARGETS} variable
|
||||||
# in the upper level ../Makefile
|
# in the upper level ../Makefile
|
||||||
#
|
#
|
||||||
CSCRIPT_TARGETS= ${SCRIPT}
|
CSCRIPT_TARGETS= ${SCRIPT}
|
||||||
TARGETS= ${CSCRIPT_TARGETS}
|
TARGETS= ${CSCRIPT_TARGETS} README
|
||||||
|
|
||||||
# The reason for this Makefile
|
# The reason for this Makefile
|
||||||
#
|
#
|
||||||
all: ${TARGETS} .all
|
all: ${TARGETS} .all
|
||||||
|
|
||||||
|
README: README.src
|
||||||
|
@${RM} -f $@
|
||||||
|
@${SED} -e "s:#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||||
|
|
||||||
# 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
|
||||||
#
|
#
|
||||||
# NOTE: Due to bogus shells found on one common system we must have
|
# NOTE: Due to bogus shells found on one common system we must have
|
||||||
# a non-empty else clause for every if condition. *sigh*
|
# a non-empty else clause for every if condition. *sigh*
|
||||||
#
|
#
|
||||||
.all:
|
.all:
|
||||||
rm -f .all
|
${RM} -f .all
|
||||||
touch .all
|
${TOUCH} .all
|
||||||
|
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
@@ -229,21 +241,22 @@ all: ${TARGETS} .all
|
|||||||
##
|
##
|
||||||
|
|
||||||
distlist: ${DISTLIST}
|
distlist: ${DISTLIST}
|
||||||
${Q}for i in ${DISTLIST} /dev/null; do \
|
${Q} for i in ${DISTLIST} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo cscript/$$i; \
|
echo cscript/$$i; \
|
||||||
fi; \
|
fi; \
|
||||||
done | LANG=C ${SORT}
|
done | LANG=C ${SORT}
|
||||||
|
|
||||||
distdir:
|
distdir:
|
||||||
${Q}echo cscript
|
${Q} echo cscript
|
||||||
|
|
||||||
calcliblist:
|
calcliblist:
|
||||||
|
|
||||||
# These next rule help me form the ${DETAIL_HELP} makefile variables above.
|
# These next rule help me form the ${SCRIPT} and ${SCRIPT_SRC} makefile
|
||||||
|
# variables above.
|
||||||
#
|
#
|
||||||
detaillist:
|
detaillist:
|
||||||
${Q}-(echo "xxxxxxx"; \
|
${Q} -(echo "xxxxxxx"; \
|
||||||
for i in ${SCRIPT} /dev/null; do \
|
for i in ${SCRIPT} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
if [ ! -f RCS/$$i.calc,v ]; then \
|
if [ ! -f RCS/$$i.calc,v ]; then \
|
||||||
@@ -255,9 +268,9 @@ detaillist:
|
|||||||
done | LANG=C ${SORT}) | ${FMT} -70 | \
|
done | LANG=C ${SORT}) | ${FMT} -70 | \
|
||||||
${SED} -e '1s/xxxxxxx/SCRIPT=/' -e '2,$$s/^/ /' \
|
${SED} -e '1s/xxxxxxx/SCRIPT=/' -e '2,$$s/^/ /' \
|
||||||
-e 's/$$/ \\/' -e '$$s/ \\$$//'
|
-e 's/$$/ \\/' -e '$$s/ \\$$//'
|
||||||
${Q}echo
|
${Q} echo
|
||||||
${Q}-(echo "xxxxxxxxxxx"; \
|
${Q} -(echo "xxxxxxxxxxx"; \
|
||||||
for i in ${SCRIPT} /dev/null; do \
|
for i in ${SCRIPT} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
if [ ! -f RCS/$$i.calc,v ]; then \
|
if [ ! -f RCS/$$i.calc,v ]; then \
|
||||||
echo "WARNING: $$i.calc not under RCS control" 1>&2; \
|
echo "WARNING: $$i.calc not under RCS control" 1>&2; \
|
||||||
@@ -282,46 +295,46 @@ detaillist:
|
|||||||
##
|
##
|
||||||
|
|
||||||
depend:
|
depend:
|
||||||
${Q}if [ -f Makefile.bak ]; then \
|
${Q} if [ -f Makefile.bak ]; then \
|
||||||
echo "Makefile.bak exists, remove or move it out of the way"; \
|
echo "Makefile.bak exists, remove or move it out of the way"; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
-${Q}rm -f makedep.out
|
-${Q} ${RM} -f makedep.out
|
||||||
${Q}echo forming cscript dependency list
|
${Q} echo forming cscript dependency list
|
||||||
${Q}echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > \
|
${Q} echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > \
|
||||||
makedep.out
|
makedep.out
|
||||||
${Q}echo "" >> makedep.out
|
${Q} echo "" >> makedep.out
|
||||||
${Q}for i in ${SCRIPT} /dev/null; do \
|
${Q} for i in ${SCRIPT} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo "$$i: $$i.calc"; \
|
echo "$$i: $$i.calc"; \
|
||||||
echo ' @rm -f $$@'; \
|
echo ' @$${RM} -f $$@'; \
|
||||||
echo ' @$${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!$${BINDIR}/calc:" $$?>$$@'; \
|
echo ' @$${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!$${BINDIR}/calc:" $$?>$$@'; \
|
||||||
echo ' @$${CHMOD} +x $$@'; \
|
echo ' @$${CHMOD} +x $$@'; \
|
||||||
fi; \
|
fi; \
|
||||||
done >> makedep.out
|
done >> makedep.out
|
||||||
${Q}echo sample dependency list formed
|
${Q} echo sample dependency list formed
|
||||||
${Q}echo forming new cscript/Makefile
|
${Q} echo forming new cscript/Makefile
|
||||||
-${Q}rm -f Makefile.bak
|
-${Q} ${RM} -f Makefile.bak
|
||||||
${Q}mv Makefile Makefile.bak
|
${Q} ${MV} Makefile Makefile.bak
|
||||||
${Q}${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak > Makefile
|
${Q} ${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak > Makefile
|
||||||
${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 \
|
||||||
rm -f Makefile.tmp; \
|
${RM} -f Makefile.tmp; \
|
||||||
mv Makefile Makefile.tmp; \
|
${MV} Makefile Makefile.tmp; \
|
||||||
if [ -d RCS ]; then \
|
if [ -d RCS ]; then \
|
||||||
co -l Makefile; \
|
${CO} -l Makefile; \
|
||||||
fi; \
|
fi; \
|
||||||
mv Makefile.tmp Makefile; \
|
${MV} Makefile.tmp Makefile; \
|
||||||
if [ -d RCS ]; then \
|
if [ -d RCS ]; then \
|
||||||
echo new sample Makefile formed, you need to check it in; \
|
echo new sample Makefile formed, you need to check it in; \
|
||||||
fi; \
|
fi; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##
|
##
|
||||||
@@ -331,7 +344,7 @@ depend:
|
|||||||
##
|
##
|
||||||
|
|
||||||
echo_inst_files:
|
echo_inst_files:
|
||||||
${Q}for i in ${SCRIPT} /dev/null; do \
|
${Q} for i in ${SCRIPT} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo __file__ ${SCRIPTDIR}/$$i; \
|
echo __file__ ${SCRIPTDIR}/$$i; \
|
||||||
fi; \
|
fi; \
|
||||||
@@ -344,52 +357,52 @@ echo_inst_files:
|
|||||||
##
|
##
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm -f makedep.out
|
-${RM} -f makedep.out
|
||||||
|
|
||||||
clobber:
|
clobber:
|
||||||
-rm -f ${TARGETS}
|
-${RM} -f ${TARGETS}
|
||||||
|
|
||||||
# install everything
|
# install everything
|
||||||
#
|
#
|
||||||
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
||||||
#
|
#
|
||||||
install: all
|
install: all
|
||||||
-${Q}if [ ! -d $T${BINDIR} ]; then \
|
-${Q} if [ ! -d ${T}${BINDIR} ]; then \
|
||||||
echo mkdir $T${BINDIR}; \
|
echo ${MKDIR} ${T}${BINDIR}; \
|
||||||
mkdir $T${BINDIR}; \
|
${MKDIR} ${T}${BINDIR}; \
|
||||||
if [ ! -d "$T${BINDIR}" ]; then \
|
if [ ! -d "${T}${BINDIR}" ]; then \
|
||||||
echo mkdir -p "$T${BINDIR}"; \
|
echo ${MKDIR} -p "${T}${BINDIR}"; \
|
||||||
mkdir -p "$T${BINDIR}"; \
|
${MKDIR} -p "${T}${BINDIR}"; \
|
||||||
fi; \
|
fi; \
|
||||||
echo ${CHMOD} 0755 $T${BINDIR}; \
|
echo ${CHMOD} 0755 ${T}${BINDIR}; \
|
||||||
${CHMOD} 0755 $T${BINDIR}; \
|
${CHMOD} 0755 ${T}${BINDIR}; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
-${Q}if [ ! -d $T${SCRIPTDIR} ]; then \
|
-${Q} if [ ! -d ${T}${SCRIPTDIR} ]; then \
|
||||||
echo mkdir $T${SCRIPTDIR}; \
|
echo ${MKDIR} ${T}${SCRIPTDIR}; \
|
||||||
mkdir $T${SCRIPTDIR}; \
|
${MKDIR} ${T}${SCRIPTDIR}; \
|
||||||
if [ ! -d "$T${SCRIPTDIR}" ]; then \
|
if [ ! -d "${T}${SCRIPTDIR}" ]; then \
|
||||||
echo mkdir -p "$T${SCRIPTDIR}"; \
|
echo ${MKDIR} -p "${T}${SCRIPTDIR}"; \
|
||||||
mkdir -p "$T${SCRIPTDIR}"; \
|
${MKDIR} -p "${T}${SCRIPTDIR}"; \
|
||||||
fi; \
|
fi; \
|
||||||
echo ${CHMOD} 0755 $T${SCRIPTDIR}; \
|
echo ${CHMOD} 0755 ${T}${SCRIPTDIR}; \
|
||||||
${CHMOD} 0755 $T${SCRIPTDIR}; \
|
${CHMOD} 0755 ${T}${SCRIPTDIR}; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
${Q}for i in ${SCRIPT} /dev/null; do \
|
${Q} for i in ${SCRIPT} /dev/null; do \
|
||||||
if [ "$$i" = "/dev/null" ]; then \
|
if [ "$$i" = "/dev/null" ]; then \
|
||||||
continue; \
|
continue; \
|
||||||
fi; \
|
fi; \
|
||||||
if ${CMP} -s $$i $T${SCRIPTDIR}/$$i; then \
|
if ${CMP} -s $$i ${T}${SCRIPTDIR}/$$i; then \
|
||||||
true; \
|
${TRUE}; \
|
||||||
else \
|
else \
|
||||||
rm -f $T${SCRIPTDIR}/$$i.new; \
|
${RM} -f ${T}${SCRIPTDIR}/$$i.new; \
|
||||||
cp -f $$i $T${SCRIPTDIR}/$$i.new; \
|
${CP} -f $$i ${T}${SCRIPTDIR}/$$i.new; \
|
||||||
${CHMOD} 0555 $T${SCRIPTDIR}/$$i.new; \
|
${CHMOD} 0555 ${T}${SCRIPTDIR}/$$i.new; \
|
||||||
mv -f $T${SCRIPTDIR}/$$i.new $T${SCRIPTDIR}/$$i; \
|
${MV} -f ${T}${SCRIPTDIR}/$$i.new ${T}${SCRIPTDIR}/$$i; \
|
||||||
echo "installed $T${SCRIPTDIR}/$$i"; \
|
echo "installed ${T}${SCRIPTDIR}/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -398,57 +411,57 @@ install: all
|
|||||||
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
||||||
#
|
#
|
||||||
uninstall:
|
uninstall:
|
||||||
-${Q}for i in ${SCRIPT} /dev/null; do \
|
-${Q} for i in ${SCRIPT} /dev/null; do \
|
||||||
if [ "$$i" = "/dev/null" ]; then \
|
if [ "$$i" = "/dev/null" ]; then \
|
||||||
continue; \
|
continue; \
|
||||||
fi; \
|
fi; \
|
||||||
if [ -f "$T${SCRIPTDIR}/$$i" ]; then \
|
if [ -f "${T}${SCRIPTDIR}/$$i" ]; then \
|
||||||
rm -f "$T${SCRIPTDIR}/$$i"; \
|
${RM} -f "${T}${SCRIPTDIR}/$$i"; \
|
||||||
if [ -f "$T${SCRIPTDIR}/$$i" ]; then \
|
if [ -f "${T}${SCRIPTDIR}/$$i" ]; then \
|
||||||
echo "cannot uninstall $T${SCRIPTDIR}/$$i"; \
|
echo "cannot uninstall ${T}${SCRIPTDIR}/$$i"; \
|
||||||
else \
|
else \
|
||||||
echo "uninstalled $T${SCRIPTDIR}/$$i"; \
|
echo "uninstalled ${T}${SCRIPTDIR}/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
-${Q}for i in ${SCRIPTDIR} ${BINDIR}; do \
|
-${Q} for i in ${SCRIPTDIR} ${BINDIR}; do \
|
||||||
if [ -d "$T$$i" ]; then \
|
if [ -d "${T}$$i" ]; then \
|
||||||
rmdir "$T$$i" 2>/dev/null; \
|
${RMDIR} "${T}$$i" 2>/dev/null; \
|
||||||
echo "cleaned up $T$$i"; \
|
echo "cleaned up ${T}$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||||
|
|
||||||
4dsphere: 4dsphere.calc
|
4dsphere: 4dsphere.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 $@
|
||||||
fproduct: fproduct.calc
|
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 $@
|
||||||
mersenne: mersenne.calc
|
mersenne: mersenne.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 $@
|
||||||
piforever: piforever.calc
|
piforever: piforever.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 $@
|
||||||
plus: plus.calc
|
plus: plus.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
|
powerterm: powerterm.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 $@
|
||||||
simple: simple.calc
|
simple: simple.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 $@
|
||||||
square: square.calc
|
square: square.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 $@
|
||||||
|
@@ -5,6 +5,46 @@ These calc shell scripts are provided because they serve as examples of
|
|||||||
how use the calc language, and/or because the authors thought them to
|
how use the calc language, and/or because the authors thought them to
|
||||||
be useful!
|
be useful!
|
||||||
|
|
||||||
|
Please note that calc shell scripts must start with the line:
|
||||||
|
|
||||||
|
#!/usr/local/src/cmd/calc/calc -q -f
|
||||||
|
|
||||||
|
The above line MUST start in column 1 of the first line. The first line
|
||||||
|
must also end in -f. The -q is optional, but is recommended to disable
|
||||||
|
the processing of calc startup scripts.
|
||||||
|
|
||||||
|
Also please note that single # shell line comments are not supported in calc.
|
||||||
|
Comments must be /* c-like comment */ or start with a double ## symbol.
|
||||||
|
|
||||||
|
This is the correct way to form a calc shell script:
|
||||||
|
|
||||||
|
#!/usr/local/src/cmd/calc/calc -q -f
|
||||||
|
|
||||||
|
/* a correct comment */
|
||||||
|
## another correct comment
|
||||||
|
### two or more together is also a comment
|
||||||
|
/*
|
||||||
|
* another correct comment
|
||||||
|
*/
|
||||||
|
print "2+2 =", 2+2; ## yet another comment
|
||||||
|
|
||||||
|
The first argument after the path to calc executable must be an -S.
|
||||||
|
The next arguments are optional. The -q is often recommended because
|
||||||
|
it will disable the processing of the startup scripts.
|
||||||
|
|
||||||
|
For more informaton about calc command lines, see "help usage".
|
||||||
|
|
||||||
|
This next example WRONG:
|
||||||
|
|
||||||
|
#!/usr/local/src/cmd/calc/calc -q
|
||||||
|
|
||||||
|
# This is not a calc calc comment because it has only a single #
|
||||||
|
# You must to start comments with ## or /*
|
||||||
|
# is is also wrong because the first line does not end in -f
|
||||||
|
print "This example has invalid comments"
|
||||||
|
|
||||||
|
#####
|
||||||
|
|
||||||
If you write something that you think is useful, please send it to:
|
If you write something that you think is useful, please send it to:
|
||||||
|
|
||||||
calc-contrib at asthe dot com
|
calc-contrib at asthe dot com
|
||||||
@@ -77,9 +117,9 @@ 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.10 $
|
## @(#) $Revision: 29.11 $
|
||||||
## @(#) $Id: README,v 29.10 2001/06/10 19:34:40 chongo Exp $
|
## @(#) $Id: README.src,v 29.11 2007/02/07 00:33:10 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/README,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/README.src,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1999/12/17 10:23:40
|
## Under source code control: 1999/12/17 10:23:40
|
||||||
## File existed as early as: 1999
|
## File existed as early as: 1999
|
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/local/src/cmd/calc/calc -q -s -f
|
#!/usr/local/src/cmd/calc/calc -q -f
|
||||||
/*
|
/*
|
||||||
* fproduct - write the big Endian product of terms to a file
|
* fproduct - write the big Endian product of terms to a file
|
||||||
*
|
*
|
||||||
@@ -24,8 +24,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: fproduct.calc,v 29.2 2001/06/06 09:06:29 chongo Exp $
|
* @(#) $Id: fproduct.calc,v 29.3 2007/02/07 00:34:04 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/fproduct.calc,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/fproduct.calc,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 2001/04/07 20:13:11
|
* Under source code control: 2001/04/07 20:13:11
|
||||||
|
@@ -1,35 +1,36 @@
|
|||||||
#!/usr/local/src/cmd/calc/calc -q -s -f
|
#!/usr/local/src/cmd/calc/calc -q -f
|
||||||
#
|
/*
|
||||||
# mersenne - print the value of a mersenne number
|
* mersenne - print the value of a mersenne number
|
||||||
#
|
*
|
||||||
# Copyright (C) 1999 Landon Curt Noll
|
* Copyright (C) 1999-2007 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
|
||||||
# as published by the Free Software Foundation.
|
* as published by the Free Software Foundation.
|
||||||
#
|
*
|
||||||
# Calc is distributed in the hope that it will be useful, but WITHOUT
|
* Calc is distributed in the hope that it will be useful, but WITHOUT
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||||
# Public License for more details.
|
* Public License for more details.
|
||||||
#
|
*
|
||||||
# A copy of version 2.1 of the GNU Lesser General Public License is
|
* 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
|
* distributed with calc under the filename COPYING-LGPL. You should have
|
||||||
# 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: mersenne.calc,v 29.3 2000/12/15 14:56:54 chongo Exp $
|
* @(#) $Id: mersenne.calc,v 29.4 2007/02/07 00:34:04 chongo Exp $
|
||||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/mersenne.calc,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/mersenne.calc,v $
|
||||||
#
|
*
|
||||||
# Under source code control: 1999/11/30 00:09:01;
|
* Under source code control: 1999/11/30 00:09:01;
|
||||||
# File existed as early as: 1999
|
* File existed as early as: 1999
|
||||||
#
|
*
|
||||||
# chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||||
# Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||||
|
*
|
||||||
# usage:
|
* usage:
|
||||||
# mersenne exp
|
* mersenne exp
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -1,35 +1,36 @@
|
|||||||
#!/usr/local/src/cmd/calc/calc -q -f
|
#!/usr/local/src/cmd/calc/calc -q -f
|
||||||
#
|
/*
|
||||||
# piforever - print digits of pi forever (or as long as your mem/cpu allow)
|
* piforever - print digits of pi forever (or as long as your mem/cpu allow)
|
||||||
#
|
*
|
||||||
# Copyright (C) 1999 Landon Curt Noll
|
* Copyright (C) 1999-2007 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
|
||||||
# as published by the Free Software Foundation.
|
* as published by the Free Software Foundation.
|
||||||
#
|
*
|
||||||
# Calc is distributed in the hope that it will be useful, but WITHOUT
|
* Calc is distributed in the hope that it will be useful, but WITHOUT
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||||
# Public License for more details.
|
* Public License for more details.
|
||||||
#
|
*
|
||||||
# A copy of version 2.1 of the GNU Lesser General Public License is
|
* 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
|
* distributed with calc under the filename COPYING-LGPL. You should have
|
||||||
# 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: piforever.calc,v 29.3 2000/12/15 14:56:54 chongo Exp $
|
* @(#) $Id: piforever.calc,v 29.4 2007/02/07 00:34:04 chongo Exp $
|
||||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/piforever.calc,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/piforever.calc,v $
|
||||||
#
|
*
|
||||||
# Under source code control: 1999/11/30 00:11:36
|
* Under source code control: 1999/11/30 00:11:36
|
||||||
# File existed as early as: 1999
|
* File existed as early as: 1999
|
||||||
#
|
*
|
||||||
# chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||||
# Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||||
|
*
|
||||||
# usage:
|
* usage:
|
||||||
# piforever
|
* piforever
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
read -once pi.cal
|
read -once pi.cal
|
||||||
|
@@ -1,35 +1,36 @@
|
|||||||
#!/usr/local/src/cmd/calc/calc -q -s -f
|
#!/usr/local/src/cmd/calc/calc -q -f
|
||||||
#
|
/*
|
||||||
# plus - add two or more arguments together
|
* plus - add two or more arguments together
|
||||||
#
|
*
|
||||||
# Copyright (C) 1999 Landon Curt Noll
|
* Copyright (C) 1999-2007 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
|
||||||
# as published by the Free Software Foundation.
|
* as published by the Free Software Foundation.
|
||||||
#
|
*
|
||||||
# Calc is distributed in the hope that it will be useful, but WITHOUT
|
* Calc is distributed in the hope that it will be useful, but WITHOUT
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||||
# Public License for more details.
|
* Public License for more details.
|
||||||
#
|
*
|
||||||
# A copy of version 2.1 of the GNU Lesser General Public License is
|
* 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
|
* distributed with calc under the filename COPYING-LGPL. You should have
|
||||||
# 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: plus.calc,v 29.3 2000/12/15 14:56:54 chongo Exp $
|
* @(#) $Id: plus.calc,v 29.4 2007/02/07 00:34:04 chongo Exp $
|
||||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/plus.calc,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/plus.calc,v $
|
||||||
#
|
*
|
||||||
# Under source code control: 1999/11/29 10:22:37
|
* Under source code control: 1999/11/29 10:22:37
|
||||||
# File existed as early as: 1999
|
* File existed as early as: 1999
|
||||||
#
|
*
|
||||||
# chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||||
# Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||||
|
*
|
||||||
# usage:
|
* usage:
|
||||||
# plus val ...
|
* plus val ...
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/local/src/cmd/calc/calc -q -s -f
|
#!/usr/local/src/cmd/calc/calc -q -f
|
||||||
/*
|
/*
|
||||||
* powerterm - print the argument as a sum of powers of integers
|
* powerterm - print the argument as a sum of powers of integers
|
||||||
*
|
*
|
||||||
@@ -24,8 +24,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: powerterm.calc,v 29.6 2001/06/06 09:06:29 chongo Exp $
|
* @(#) $Id: powerterm.calc,v 29.7 2007/02/07 00:34:04 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/powerterm.calc,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/powerterm.calc,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 2001/04/24 23:49:11
|
* Under source code control: 2001/04/24 23:49:11
|
||||||
|
@@ -1,32 +1,33 @@
|
|||||||
#!/usr/local/src/cmd/calc/calc -q -f
|
#!/usr/local/src/cmd/calc/calc -q -f
|
||||||
#
|
/*
|
||||||
# simple - an example of a simple calc shell script
|
* simple - an example of a simple calc shell script
|
||||||
#
|
*
|
||||||
# Copyright (C) 1999 Landon Curt Noll
|
* Copyright (C) 1999-2007 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
|
||||||
# as published by the Free Software Foundation.
|
* as published by the Free Software Foundation.
|
||||||
#
|
*
|
||||||
# Calc is distributed in the hope that it will be useful, but WITHOUT
|
* Calc is distributed in the hope that it will be useful, but WITHOUT
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||||
# Public License for more details.
|
* Public License for more details.
|
||||||
#
|
*
|
||||||
# A copy of version 2.1 of the GNU Lesser General Public License is
|
* 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
|
* distributed with calc under the filename COPYING-LGPL. You should have
|
||||||
# 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: simple.calc,v 29.3 2000/12/15 14:56:54 chongo Exp $
|
* @(#) $Id: simple.calc,v 29.4 2007/02/07 00:34:04 chongo Exp $
|
||||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/simple.calc,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/simple.calc,v $
|
||||||
#
|
*
|
||||||
# Under source code control: 1999/11/29 10:22:37
|
* Under source code control: 1999/11/29 10:22:37
|
||||||
# File existed as early as: 1999
|
* File existed as early as: 1999
|
||||||
#
|
*
|
||||||
# chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||||
# Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -1,64 +1,67 @@
|
|||||||
#!/usr/local/src/cmd/calc/calc -q -f
|
#!/usr/local/src/cmd/calc/calc -q -f
|
||||||
#
|
/*
|
||||||
# sqaure - print the squares of input values
|
* sqaure - print the squares of input values
|
||||||
#
|
*
|
||||||
# Copyright (C) 2000 Ernest Bowen
|
* Copyright (C) 2000-2007 Ernest Bowen
|
||||||
#
|
*
|
||||||
# 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
|
||||||
# as published by the Free Software Foundation.
|
* as published by the Free Software Foundation.
|
||||||
#
|
*
|
||||||
# Calc is distributed in the hope that it will be useful, but WITHOUT
|
* Calc is distributed in the hope that it will be useful, but WITHOUT
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||||
# Public License for more details.
|
* Public License for more details.
|
||||||
#
|
*
|
||||||
# A copy of version 2.1 of the GNU Lesser General Public License is
|
* 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
|
* distributed with calc under the filename COPYING-LGPL. You should have
|
||||||
# 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: square.calc,v 29.3 2000/12/17 14:31:58 chongo Exp $
|
* @(#) $Id: square.calc,v 29.4 2007/02/07 00:34:04 chongo Exp $
|
||||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/square.calc,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/square.calc,v $
|
||||||
#
|
*
|
||||||
# Under source code control: 2000/12/15 06:52:01
|
* Under source code control: 2000/12/15 06:52:01
|
||||||
# File existed as early as: 2000
|
* File existed as early as: 2000
|
||||||
#
|
*
|
||||||
# Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Usage:
|
||||||
|
*
|
||||||
|
* From the shell:
|
||||||
|
*
|
||||||
|
* ./square
|
||||||
|
* cat file | ./square
|
||||||
|
* echo "123" | ./square
|
||||||
|
*
|
||||||
|
* Within calc:
|
||||||
|
*
|
||||||
|
* > read square
|
||||||
|
*
|
||||||
|
* With input from a terminal, there is no prompt but each non-empty
|
||||||
|
* line of input is evaluated as a calc expression and if it can be
|
||||||
|
* calculated, the square of the value of that expression is displayed.
|
||||||
|
* Execution stops when an empty line is input.
|
||||||
|
*
|
||||||
|
* From the shell:
|
||||||
|
*
|
||||||
|
* ./square
|
||||||
|
*
|
||||||
|
* The following shows lines of input followed by output:
|
||||||
|
*
|
||||||
|
* 1234
|
||||||
|
* 1522756
|
||||||
|
* ln(2)
|
||||||
|
* ~.48045301391820142467
|
||||||
|
* config("mode","frac"), bernoulli(10)
|
||||||
|
* 25/4356
|
||||||
|
* config("mode", "hex"), 0xff
|
||||||
|
* 0xfe01
|
||||||
|
*/
|
||||||
|
|
||||||
# Usage:
|
|
||||||
#
|
|
||||||
# From the shell:
|
|
||||||
#
|
|
||||||
# ./square
|
|
||||||
# cat file | ./square
|
|
||||||
# echo "123" | ./square
|
|
||||||
#
|
|
||||||
# Within calc:
|
|
||||||
#
|
|
||||||
# > read square
|
|
||||||
#
|
|
||||||
# With input from a terminal, there is no prompt but each non-empty
|
|
||||||
# line of input is evaluated as a calc expression and if it can be
|
|
||||||
# calculated, the square of the value of that expression is displayed.
|
|
||||||
# Execution stops when an empty line is input.
|
|
||||||
#
|
|
||||||
# From the shell:
|
|
||||||
#
|
|
||||||
# ./square
|
|
||||||
#
|
|
||||||
# The following shows lines of input followed by output:
|
|
||||||
#
|
|
||||||
# 1234
|
|
||||||
# 1522756
|
|
||||||
# ln(2)
|
|
||||||
# ~.48045301391820142467
|
|
||||||
# config("mode","frac"), bernoulli(10)
|
|
||||||
# 25/4356
|
|
||||||
# config("mode", "hex"), 0xff
|
|
||||||
# 0xfe01
|
|
||||||
#
|
|
||||||
|
|
||||||
global s;
|
global s;
|
||||||
while ((s = prompt("")))
|
while ((s = prompt("")))
|
||||||
|
455
custom/Makefile
455
custom/Makefile
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# custom - makefile for calc custom routines
|
# custom - makefile for calc custom routines
|
||||||
#
|
#
|
||||||
# Copyright (C) 1999,2004 Landon Curt Noll
|
# Copyright (C) 1999-2006 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
|
||||||
@@ -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.25 $
|
# @(#) $Revision: 29.29 $
|
||||||
# @(#) $Id: Makefile,v 29.25 2006/06/26 05:46:06 chongo Exp $
|
# @(#) $Id: Makefile,v 29.29 2006/09/18 13:13:25 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
|
||||||
@@ -114,9 +114,9 @@ INCDIR= /usr/include
|
|||||||
# ${LIBDIR} where calc link library (*.a) files are installed
|
# ${LIBDIR} where calc link library (*.a) files are installed
|
||||||
# ${CALC_SHAREDIR} where to install calc help, .cal, startup, config files
|
# ${CALC_SHAREDIR} where to install calc help, .cal, startup, config files
|
||||||
#
|
#
|
||||||
# NOTE: The install rule prepends installation paths with $T, which
|
# NOTE: The install rule prepends installation paths with ${T}, which
|
||||||
# by default is empty. If $T is non-empty, then installation
|
# by default is empty. If ${T} is non-empty, then installation
|
||||||
# locations will be relative to the $T directory.
|
# locations will be relative to the ${T} directory.
|
||||||
#
|
#
|
||||||
# For DJGPP, select:
|
# For DJGPP, select:
|
||||||
#
|
#
|
||||||
@@ -148,12 +148,12 @@ CALC_SHAREDIR= /usr/share/calc
|
|||||||
# ${CALC_INCDIR} where the calc include files are installed
|
# ${CALC_INCDIR} where the calc include files are installed
|
||||||
# ${CUSTOMCALDIR} where custom *.cal files are installed
|
# ${CUSTOMCALDIR} where custom *.cal files are installed
|
||||||
# ${CUSTOMHELPDIR} where custom help files are installed
|
# ${CUSTOMHELPDIR} where custom help files are installed
|
||||||
# ${CUSTOMINCPDIR} where custom .h files are installed
|
# ${CUSTOMINCDIR} where custom .h files are installed
|
||||||
# ${SCRIPTDIR} where calc shell scripts are installed
|
# ${SCRIPTDIR} where calc shell scripts are installed
|
||||||
#
|
#
|
||||||
# NOTE: The install rule prepends installation paths with $T, which
|
# NOTE: The install rule prepends installation paths with ${T}, which
|
||||||
# by default is empty. If $T is non-empty, then installation
|
# by default is empty. If ${T} is non-empty, then installation
|
||||||
# locations will be relative to the $T directory.
|
# locations will be relative to the ${T} directory.
|
||||||
#
|
#
|
||||||
# If in doubt, set:
|
# If in doubt, set:
|
||||||
#
|
#
|
||||||
@@ -173,8 +173,8 @@ SCRIPTDIR= ${BINDIR}/cscript
|
|||||||
|
|
||||||
# T - top level directory under which calc will be installed
|
# T - top level directory under which calc will be installed
|
||||||
#
|
#
|
||||||
# The calc install is performed under $T, the calc build is
|
# The calc install is performed under ${T}, the calc build is
|
||||||
# performed under /. The purpose for $T is to allow someone
|
# performed under /. The purpose for ${T} is to allow someone
|
||||||
# to install calc somewhere other than into the system area.
|
# to install calc somewhere other than into the system area.
|
||||||
#
|
#
|
||||||
# For example, if:
|
# For example, if:
|
||||||
@@ -194,10 +194,10 @@ SCRIPTDIR= ${BINDIR}/cscript
|
|||||||
# calc help, .cal ...: /var/tmp/testing/usr/share/calc
|
# calc help, .cal ...: /var/tmp/testing/usr/share/calc
|
||||||
# ... etc ... /var/tmp/testing/...
|
# ... etc ... /var/tmp/testing/...
|
||||||
#
|
#
|
||||||
# If $T is empty, calc is installed under /, which is the same
|
# If ${T} is empty, calc is installed under /, which is the same
|
||||||
# top of tree for which it was built. If $T is non-empty, then
|
# top of tree for which it was built. If ${T} is non-empty, then
|
||||||
# calc is installed under $T, as if one had to chroot under
|
# calc is installed under ${T}, as if one had to chroot under
|
||||||
# $T for calc to operate.
|
# ${T} for calc to operate.
|
||||||
#
|
#
|
||||||
# If in doubt, use T=
|
# If in doubt, use T=
|
||||||
#
|
#
|
||||||
@@ -249,6 +249,20 @@ NO_SHARED=
|
|||||||
#NO_SHARED= -dn
|
#NO_SHARED= -dn
|
||||||
#NO_SHARED= -non_shared
|
#NO_SHARED= -non_shared
|
||||||
|
|
||||||
|
# On some systems where you are disabling dynamic shared link libs, you may
|
||||||
|
# need to pass a special flag to ${CC} and ${LCC} during linking stage.
|
||||||
|
#
|
||||||
|
# System type NO_SHARED recommendation
|
||||||
|
#
|
||||||
|
# IRIX with NO_SHARED= -non_shared LD_NO_SHARED= -Wl,-rdata_shared
|
||||||
|
# IRIX with NO_SHARED= LD_NO_SHARED=
|
||||||
|
# others LD_NO_SHARED=
|
||||||
|
#
|
||||||
|
# If in doubt, use LD_NO_SHARED=
|
||||||
|
#
|
||||||
|
LD_NO_SHARED=
|
||||||
|
#LD_NO_SHARED= -Wl,-rdata_shared
|
||||||
|
|
||||||
# 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.
|
||||||
#
|
#
|
||||||
@@ -275,12 +289,13 @@ 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.
|
||||||
#
|
#
|
||||||
# If you do not wish to use purify, leave PURIFY commented out.
|
# If you do not wish to use purify, set PURIFY to an empty string.
|
||||||
#
|
#
|
||||||
# If in doubt, leave PURIFY commented out.
|
# If in doubt, use PURIFY=
|
||||||
#
|
#
|
||||||
#PURIFY= purify -logfile=pure.out
|
#PURIFY= purify -logfile=pure.out
|
||||||
#PURIFY= purify
|
#PURIFY= purify
|
||||||
|
PURIFY=
|
||||||
|
|
||||||
# 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.
|
||||||
@@ -402,6 +417,16 @@ MAKEDEPEND= makedepend
|
|||||||
CHMOD= chmod
|
CHMOD= chmod
|
||||||
SORT= sort
|
SORT= sort
|
||||||
CMP= cmp
|
CMP= cmp
|
||||||
|
AR= ar
|
||||||
|
RM= rm
|
||||||
|
TOUCH= touch
|
||||||
|
MKDIR= mkdir
|
||||||
|
RMDIR= rmdir
|
||||||
|
MV= mv
|
||||||
|
CP= cp
|
||||||
|
CO= co
|
||||||
|
TRUE= true
|
||||||
|
MAKE= make
|
||||||
|
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
@@ -413,8 +438,8 @@ all: ${TARGETS} ${INSTALL_H_SRC} ${CUSTOM_CALC_FILES} \
|
|||||||
${CUSTOM_HELP} ${MAKE_FILE} .all
|
${CUSTOM_HELP} ${MAKE_FILE} .all
|
||||||
|
|
||||||
libcustcalc.a: ${CUSTCALC_OBJ} ${MAKE_FILE} ../${MAKE_FILE}
|
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,8 +460,8 @@ c_sysinfo.o: c_sysinfo.c ${MAKE_FILE}
|
|||||||
# to determine of we have done all
|
# to determine of we have done all
|
||||||
#
|
#
|
||||||
.all:
|
.all:
|
||||||
rm -f .all
|
${RM} -f .all
|
||||||
touch .all
|
${TOUCH} .all
|
||||||
|
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
@@ -452,17 +477,17 @@ c_sysinfo.o: c_sysinfo.c ${MAKE_FILE}
|
|||||||
##
|
##
|
||||||
|
|
||||||
distlist: ${DISTLIST}
|
distlist: ${DISTLIST}
|
||||||
${Q}for i in ${DISTLIST} /dev/null; do \
|
${Q} for i in ${DISTLIST} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo custom/$$i; \
|
echo custom/$$i; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
distdir:
|
distdir:
|
||||||
${Q}echo custom
|
${Q} echo custom
|
||||||
|
|
||||||
calcliblist: ${CALCLIBLIST}
|
calcliblist: ${CALCLIBLIST}
|
||||||
${Q}for i in ${CALCLIBLIST} /dev/null; do \
|
${Q} for i in ${CALCLIBLIST} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo custom/$$i; \
|
echo custom/$$i; \
|
||||||
fi; \
|
fi; \
|
||||||
@@ -481,81 +506,81 @@ calcliblist: ${CALCLIBLIST}
|
|||||||
##
|
##
|
||||||
|
|
||||||
depend:
|
depend:
|
||||||
${Q}if [ -f Makefile.bak ]; then \
|
${Q} if [ -f Makefile.bak ]; then \
|
||||||
echo "Makefile.bak exists, remove or move it out of the way"; \
|
echo "Makefile.bak exists, remove or move it out of the way"; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
${Q}echo forming custom/skel
|
${Q} echo forming custom/skel
|
||||||
-${Q}rm -rf skel
|
-${Q} ${RM} -rf skel
|
||||||
${Q}mkdir skel
|
${Q} ${MKDIR} skel
|
||||||
${Q}mkdir skel/custom
|
${Q} ${MKDIR} skel/custom
|
||||||
-${Q}for i in ${C_SRC} /dev/null; do \
|
-${Q} for i in ${C_SRC} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
${SED} -n '/^#[ ]*include[ ]*"/p' \
|
${SED} -n '/^#[ ]*include[ ]*"/p' \
|
||||||
"$$i" > "skel/custom/$$i"; \
|
"$$i" > "skel/custom/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
-${Q}for i in ${H_SRC} /dev/null; do \
|
-${Q} for i in ${H_SRC} /dev/null; do \
|
||||||
if [ "$$i" = "/dev/null" ]; then \
|
if [ "$$i" = "/dev/null" ]; then \
|
||||||
continue; \
|
continue; \
|
||||||
fi; \
|
fi; \
|
||||||
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
||||||
echo "#if !defined($$tag)" > "skel/custom/$$i"; \
|
echo "#if !defined($$tag)" > "skel/custom/$$i"; \
|
||||||
echo "#define $$tag" >> "skel/custom/$$i"; \
|
echo "#define $$tag" >> "skel/custom/$$i"; \
|
||||||
${SED} -n '/^#[ ]*include[ ]*"/p' "$$i" \
|
${SED} -n '/^#[ ]*include[ ]*"/p' "$$i" \
|
||||||
>> "skel/custom/$$i"; \
|
>> "skel/custom/$$i"; \
|
||||||
echo '#endif /* '"$$tag"' */' >> "skel/custom/$$i"; \
|
echo '#endif /* '"$$tag"' */' >> "skel/custom/$$i"; \
|
||||||
done
|
done
|
||||||
${Q}(cd ..; ${MAKE} hsrc)
|
${Q} (cd ..; $(MAKE) hsrc)
|
||||||
${Q}for i in `cd ..; ${MAKE} h_list 2>&1 | \
|
${Q} for i in `cd ..; $(MAKE) h_list 2>&1 | \
|
||||||
${SED} -e '/Entering directory/d' \
|
${SED} -e '/Entering directory/d' \
|
||||||
-e '/Nothing to be done/d' \
|
-e '/Nothing to be done/d' \
|
||||||
-e '/Leaving directory/d'` /dev/null; do \
|
-e '/Leaving directory/d'` /dev/null; do \
|
||||||
if [ "$$i" = "/dev/null" ]; then \
|
if [ "$$i" = "/dev/null" ]; then \
|
||||||
continue; \
|
continue; \
|
||||||
fi; \
|
fi; \
|
||||||
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
||||||
echo "#if !defined($$tag)" > "skel/$$i"; \
|
echo "#if !defined($$tag)" > "skel/$$i"; \
|
||||||
echo "#define $$tag" >> "skel/$$i"; \
|
echo "#define $$tag" >> "skel/$$i"; \
|
||||||
${SED} -n '/^#[ ]*include[ ]*"/p' "../$$i" \
|
${SED} -n '/^#[ ]*include[ ]*"/p' "../$$i" \
|
||||||
>> "skel/$$i"; \
|
>> "skel/$$i"; \
|
||||||
echo '#endif /* '"$$tag"' */' >> "skel/$$i"; \
|
echo '#endif /* '"$$tag"' */' >> "skel/$$i"; \
|
||||||
done
|
done
|
||||||
-${Q}rm -f skel/custom/makedep.out
|
-${Q} ${RM} -f skel/custom/makedep.out
|
||||||
${Q}echo custom/skel formed
|
${Q} echo custom/skel formed
|
||||||
${Q}echo forming custom dependency list
|
${Q} echo forming custom dependency list
|
||||||
${Q}echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > \
|
${Q} echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > \
|
||||||
skel/custom/makedep.out
|
skel/custom/makedep.out
|
||||||
${Q}cd skel/custom; ${MAKEDEPEND} -w 1 -f makedep.out ${C_SRC}
|
${Q} cd skel/custom; ${MAKEDEPEND} -w 1 -f makedep.out ${C_SRC}
|
||||||
-${Q}for i in ${C_SRC} /dev/null; do \
|
-${Q} for i in ${C_SRC} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo "$$i" | ${SED} 's/^\(.*\)\.c/\1.o: \1.c/'; \
|
echo "$$i" | ${SED} 's/^\(.*\)\.c/\1.o: \1.c/'; \
|
||||||
fi; \
|
fi; \
|
||||||
done >> skel/custom/makedep.out
|
done >> skel/custom/makedep.out
|
||||||
${Q}echo custom dependency list formed
|
${Q} echo custom dependency list formed
|
||||||
${Q}echo forming new custom/Makefile
|
${Q} echo forming new custom/Makefile
|
||||||
-${Q}rm -f Makefile.bak
|
-${Q} ${RM} -f Makefile.bak
|
||||||
${Q}mv Makefile Makefile.bak
|
${Q} ${MV} Makefile Makefile.bak
|
||||||
${Q}${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak > Makefile
|
${Q} ${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak > Makefile
|
||||||
${Q}echo "" >> Makefile
|
${Q} echo "" >> Makefile
|
||||||
${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 \
|
||||||
rm -f Makefile.tmp; \
|
${RM} -f Makefile.tmp; \
|
||||||
mv Makefile Makefile.tmp; \
|
${MV} Makefile Makefile.tmp; \
|
||||||
if [ -d RCS ]; then \
|
if [ -d RCS ]; then \
|
||||||
co -l Makefile; \
|
${CO} -l Makefile; \
|
||||||
fi ;\
|
fi ;\
|
||||||
mv Makefile.tmp Makefile; \
|
${MV} Makefile.tmp Makefile; \
|
||||||
if [ -d RCS ]; then \
|
if [ -d RCS ]; then \
|
||||||
echo 'new custom Makefile formed -- you need to check it in'; \
|
echo 'new custom Makefile formed -- you need to check it in'; \
|
||||||
fi; \
|
fi; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##
|
##
|
||||||
@@ -565,22 +590,22 @@ depend:
|
|||||||
##
|
##
|
||||||
|
|
||||||
echo_inst_files:
|
echo_inst_files:
|
||||||
${Q}for i in ${INSTALL_H_SRC} /dev/null; do \
|
${Q} for i in ${INSTALL_H_SRC} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo __file__ ${CUSTOMINCDIR}/$$i; \
|
echo __file__ ${CUSTOMINCDIR}/$$i; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
${Q}for i in ${CUSTOM_HELP} /dev/null; do \
|
${Q} for i in ${CUSTOM_HELP} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo __file__ ${CUSTOMHELPDIR}/$$i; \
|
echo __file__ ${CUSTOMHELPDIR}/$$i; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
${Q}for i in ${CUSTOM_CALC_FILES} /dev/null; do \
|
${Q} for i in ${CUSTOM_CALC_FILES} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo __file__ ${CUSTOMCALDIR}/$$i; \
|
echo __file__ ${CUSTOMCALDIR}/$$i; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
${Q}for i in ${CALC_LIBCUSTOM} /dev/null; do \
|
${Q} for i in ${CALC_LIBCUSTOM} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo __file__ ${CUSTOMCALDIR}/$$i; \
|
echo __file__ ${CUSTOMCALDIR}/$$i; \
|
||||||
fi; \
|
fi; \
|
||||||
@@ -593,154 +618,154 @@ echo_inst_files:
|
|||||||
##
|
##
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm -f ${CUSTCALC_OBJ}
|
-${RM} -f ${CUSTCALC_OBJ}
|
||||||
|
|
||||||
clobber:
|
clobber:
|
||||||
-rm -f ${TARGETS}
|
-${RM} -f ${TARGETS}
|
||||||
rm -f .all Makefile.tmp Makefile.bak
|
${RM} -f .all Makefile.tmp Makefile.bak
|
||||||
|
|
||||||
# install everything
|
# install everything
|
||||||
#
|
#
|
||||||
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
||||||
#
|
#
|
||||||
install: all
|
install: all
|
||||||
-${Q}if [ ! -d $T${INCDIR} ]; then \
|
-${Q} if [ ! -d ${T}${INCDIR} ]; then \
|
||||||
echo mkdir $T${INCDIR}; \
|
echo ${MKDIR} ${T}${INCDIR}; \
|
||||||
mkdir $T${INCDIR}; \
|
${MKDIR} ${T}${INCDIR}; \
|
||||||
if [ ! -d "$T${INCDIR}" ]; then \
|
if [ ! -d "${T}${INCDIR}" ]; then \
|
||||||
echo mkdir -p "$T${INCDIR}"; \
|
echo ${MKDIR} -p "${T}${INCDIR}"; \
|
||||||
mkdir -p "$T${INCDIR}"; \
|
${MKDIR} -p "${T}${INCDIR}"; \
|
||||||
fi; \
|
fi; \
|
||||||
echo ${CHMOD} 0755 $T${INCDIR}; \
|
echo ${CHMOD} 0755 ${T}${INCDIR}; \
|
||||||
${CHMOD} 0755 $T${INCDIR}; \
|
${CHMOD} 0755 ${T}${INCDIR}; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
-${Q}if [ ! -d $T${CALC_SHAREDIR} ]; then \
|
-${Q} if [ ! -d ${T}${CALC_SHAREDIR} ]; then \
|
||||||
echo mkdir $T${CALC_SHAREDIR}; \
|
echo ${MKDIR} ${T}${CALC_SHAREDIR}; \
|
||||||
mkdir $T${CALC_SHAREDIR}; \
|
${MKDIR} ${T}${CALC_SHAREDIR}; \
|
||||||
if [ ! -d "$T${CALC_SHAREDIR}" ]; then \
|
if [ ! -d "${T}${CALC_SHAREDIR}" ]; then \
|
||||||
echo mkdir -p "$T${CALC_SHAREDIR}"; \
|
echo ${MKDIR} -p "${T}${CALC_SHAREDIR}"; \
|
||||||
mkdir -p "$T${CALC_SHAREDIR}"; \
|
${MKDIR} -p "${T}${CALC_SHAREDIR}"; \
|
||||||
fi; \
|
fi; \
|
||||||
echo ${CHMOD} 0755 $T${CALC_SHAREDIR}; \
|
echo ${CHMOD} 0755 ${T}${CALC_SHAREDIR}; \
|
||||||
${CHMOD} 0755 $T${CALC_SHAREDIR}; \
|
${CHMOD} 0755 ${T}${CALC_SHAREDIR}; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
-${Q}if [ ! -d $T${CALC_INCDIR} ]; then \
|
-${Q} if [ ! -d ${T}${CALC_INCDIR} ]; then \
|
||||||
echo mkdir $T${CALC_INCDIR}; \
|
echo ${MKDIR} ${T}${CALC_INCDIR}; \
|
||||||
mkdir $T${CALC_INCDIR}; \
|
${MKDIR} ${T}${CALC_INCDIR}; \
|
||||||
if [ ! -d "$T${CALC_INCDIR}" ]; then \
|
if [ ! -d "${T}${CALC_INCDIR}" ]; then \
|
||||||
echo mkdir -p "$T${CALC_INCDIR}"; \
|
echo ${MKDIR} -p "${T}${CALC_INCDIR}"; \
|
||||||
mkdir -p "$T${CALC_INCDIR}"; \
|
${MKDIR} -p "${T}${CALC_INCDIR}"; \
|
||||||
fi; \
|
fi; \
|
||||||
echo ${CHMOD} 0755 $T${CALC_INCDIR}; \
|
echo ${CHMOD} 0755 ${T}${CALC_INCDIR}; \
|
||||||
${CHMOD} 0755 $T${CALC_INCDIR}; \
|
${CHMOD} 0755 ${T}${CALC_INCDIR}; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
-${Q}if [ ! -d $T${HELPDIR} ]; then \
|
-${Q} if [ ! -d ${T}${HELPDIR} ]; then \
|
||||||
echo mkdir $T${HELPDIR}; \
|
echo ${MKDIR} ${T}${HELPDIR}; \
|
||||||
mkdir $T${HELPDIR}; \
|
${MKDIR} ${T}${HELPDIR}; \
|
||||||
if [ ! -d "$T${HELPDIR}" ]; then \
|
if [ ! -d "${T}${HELPDIR}" ]; then \
|
||||||
echo mkdir -p "$T${HELPDIR}"; \
|
echo ${MKDIR} -p "${T}${HELPDIR}"; \
|
||||||
mkdir -p "$T${HELPDIR}"; \
|
${MKDIR} -p "${T}${HELPDIR}"; \
|
||||||
fi; \
|
fi; \
|
||||||
echo ${CHMOD} 0755 $T${HELPDIR}; \
|
echo ${CHMOD} 0755 ${T}${HELPDIR}; \
|
||||||
${CHMOD} 0755 $T${HELPDIR}; \
|
${CHMOD} 0755 ${T}${HELPDIR}; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
-${Q}if [ ! -d $T${CUSTOMCALDIR} ]; then \
|
-${Q} if [ ! -d ${T}${CUSTOMCALDIR} ]; then \
|
||||||
echo mkdir $T${CUSTOMCALDIR}; \
|
echo ${MKDIR} ${T}${CUSTOMCALDIR}; \
|
||||||
mkdir $T${CUSTOMCALDIR}; \
|
${MKDIR} ${T}${CUSTOMCALDIR}; \
|
||||||
if [ ! -d "$T${CUSTOMCALDIR}" ]; then \
|
if [ ! -d "${T}${CUSTOMCALDIR}" ]; then \
|
||||||
echo mkdir -p "$T${CUSTOMCALDIR}"; \
|
echo ${MKDIR} -p "${T}${CUSTOMCALDIR}"; \
|
||||||
mkdir -p "$T${CUSTOMCALDIR}"; \
|
${MKDIR} -p "${T}${CUSTOMCALDIR}"; \
|
||||||
fi; \
|
fi; \
|
||||||
echo ${CHMOD} 0755 $T${CUSTOMCALDIR}; \
|
echo ${CHMOD} 0755 ${T}${CUSTOMCALDIR}; \
|
||||||
${CHMOD} 0755 $T${CUSTOMCALDIR}; \
|
${CHMOD} 0755 ${T}${CUSTOMCALDIR}; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
-${Q}if [ ! -d $T${CUSTOMHELPDIR} ]; then \
|
-${Q} if [ ! -d ${T}${CUSTOMHELPDIR} ]; then \
|
||||||
echo mkdir $T${CUSTOMHELPDIR}; \
|
echo ${MKDIR} ${T}${CUSTOMHELPDIR}; \
|
||||||
mkdir $T${CUSTOMHELPDIR}; \
|
${MKDIR} ${T}${CUSTOMHELPDIR}; \
|
||||||
if [ ! -d "$T${CUSTOMHELPDIR}" ]; then \
|
if [ ! -d "${T}${CUSTOMHELPDIR}" ]; then \
|
||||||
echo mkdir -p "$T${CUSTOMHELPDIR}"; \
|
echo ${MKDIR} -p "${T}${CUSTOMHELPDIR}"; \
|
||||||
mkdir -p "$T${CUSTOMHELPDIR}"; \
|
${MKDIR} -p "${T}${CUSTOMHELPDIR}"; \
|
||||||
fi; \
|
fi; \
|
||||||
echo ${CHMOD} 0755 $T${CUSTOMHELPDIR}; \
|
echo ${CHMOD} 0755 ${T}${CUSTOMHELPDIR}; \
|
||||||
${CHMOD} 0755 $T${CUSTOMHELPDIR}; \
|
${CHMOD} 0755 ${T}${CUSTOMHELPDIR}; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
-${Q}if [ ! -d $T${CUSTOMINCDIR} ]; then \
|
-${Q} if [ ! -d ${T}${CUSTOMINCDIR} ]; then \
|
||||||
echo mkdir $T${CUSTOMINCDIR}; \
|
echo ${MKDIR} ${T}${CUSTOMINCDIR}; \
|
||||||
mkdir $T${CUSTOMINCDIR}; \
|
${MKDIR} ${T}${CUSTOMINCDIR}; \
|
||||||
if [ ! -d "$T${CUSTOMINCDIR}" ]; then \
|
if [ ! -d "${T}${CUSTOMINCDIR}" ]; then \
|
||||||
echo mkdir -p "$T${CUSTOMINCDIR}"; \
|
echo ${MKDIR} -p "${T}${CUSTOMINCDIR}"; \
|
||||||
mkdir -p "$T${CUSTOMINCDIR}"; \
|
${MKDIR} -p "${T}${CUSTOMINCDIR}"; \
|
||||||
fi; \
|
fi; \
|
||||||
echo ${CHMOD} 0755 $T${CUSTOMINCDIR}; \
|
echo ${CHMOD} 0755 ${T}${CUSTOMINCDIR}; \
|
||||||
${CHMOD} 0755 $T${CUSTOMINCDIR}; \
|
${CHMOD} 0755 ${T}${CUSTOMINCDIR}; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
-${Q}for i in ${INSTALL_H_SRC} /dev/null; do \
|
-${Q} for i in ${INSTALL_H_SRC} /dev/null; do \
|
||||||
if [ "$$i" = "/dev/null" ]; then \
|
if [ "$$i" = "/dev/null" ]; then \
|
||||||
continue; \
|
continue; \
|
||||||
fi; \
|
fi; \
|
||||||
if ${CMP} -s "$$i" $T${CUSTOMINCDIR}/$$i; then \
|
if ${CMP} -s "$$i" ${T}${CUSTOMINCDIR}/$$i; then \
|
||||||
true; \
|
${TRUE}; \
|
||||||
else \
|
else \
|
||||||
rm -f $T${CUSTOMINCDIR}/$$i.new; \
|
${RM} -f ${T}${CUSTOMINCDIR}/$$i.new; \
|
||||||
cp -f $$i $T${CUSTOMINCDIR}/$$i.new; \
|
${CP} -f $$i ${T}${CUSTOMINCDIR}/$$i.new; \
|
||||||
${CHMOD} 0444 $T${CUSTOMINCDIR}/$$i.new; \
|
${CHMOD} 0444 ${T}${CUSTOMINCDIR}/$$i.new; \
|
||||||
mv -f $T${CUSTOMINCDIR}/$$i.new $T${CUSTOMINCDIR}/$$i; \
|
${MV} -f ${T}${CUSTOMINCDIR}/$$i.new ${T}${CUSTOMINCDIR}/$$i; \
|
||||||
echo "installed $T${CUSTOMINCDIR}/$$i"; \
|
echo "installed ${T}${CUSTOMINCDIR}/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
-${Q}for i in ${CUSTOM_CALC_FILES} /dev/null; do \
|
-${Q} for i in ${CUSTOM_CALC_FILES} /dev/null; do \
|
||||||
if [ "$$i" = "/dev/null" ]; then \
|
if [ "$$i" = "/dev/null" ]; then \
|
||||||
continue; \
|
continue; \
|
||||||
fi; \
|
fi; \
|
||||||
if ${CMP} -s $$i $T${CUSTOMCALDIR}/$$i; then \
|
if ${CMP} -s $$i ${T}${CUSTOMCALDIR}/$$i; then \
|
||||||
true; \
|
${TRUE}; \
|
||||||
else \
|
else \
|
||||||
rm -f $T${CUSTOMCALDIR}/$$i.new; \
|
${RM} -f ${T}${CUSTOMCALDIR}/$$i.new; \
|
||||||
cp -f $$i $T${CUSTOMCALDIR}/$$i.new; \
|
${CP} -f $$i ${T}${CUSTOMCALDIR}/$$i.new; \
|
||||||
${CHMOD} 0444 $T${CUSTOMCALDIR}/$$i.new; \
|
${CHMOD} 0444 ${T}${CUSTOMCALDIR}/$$i.new; \
|
||||||
mv -f $T${CUSTOMCALDIR}/$$i.new $T${CUSTOMCALDIR}/$$i; \
|
${MV} -f ${T}${CUSTOMCALDIR}/$$i.new ${T}${CUSTOMCALDIR}/$$i; \
|
||||||
echo "installed $T${CUSTOMCALDIR}/$$i"; \
|
echo "installed ${T}${CUSTOMCALDIR}/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
-${Q}for i in ${CUSTOM_HELP} /dev/null; do \
|
-${Q} for i in ${CUSTOM_HELP} /dev/null; do \
|
||||||
if [ "$$i" = "/dev/null" ]; then \
|
if [ "$$i" = "/dev/null" ]; then \
|
||||||
continue; \
|
continue; \
|
||||||
fi; \
|
fi; \
|
||||||
if ${CMP} -s $$i $T${CUSTOMHELPDIR}/$$i; then \
|
if ${CMP} -s $$i ${T}${CUSTOMHELPDIR}/$$i; then \
|
||||||
true; \
|
${TRUE}; \
|
||||||
else \
|
else \
|
||||||
rm -f $T${CUSTOMHELPDIR}/$$i.new; \
|
${RM} -f ${T}${CUSTOMHELPDIR}/$$i.new; \
|
||||||
cp -f $$i $T${CUSTOMHELPDIR}/$$i.new; \
|
${CP} -f $$i ${T}${CUSTOMHELPDIR}/$$i.new; \
|
||||||
${CHMOD} 0444 $T${CUSTOMHELPDIR}/$$i.new; \
|
${CHMOD} 0444 ${T}${CUSTOMHELPDIR}/$$i.new; \
|
||||||
mv -f $T${CUSTOMHELPDIR}/$$i.new $T${CUSTOMHELPDIR}/$$i; \
|
${MV} -f ${T}${CUSTOMHELPDIR}/$$i.new ${T}${CUSTOMHELPDIR}/$$i; \
|
||||||
echo "installed $T${CUSTOMHELPDIR}/$$i"; \
|
echo "installed ${T}${CUSTOMHELPDIR}/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
-${Q}if [ ! -z ${ALLOW_CUSTOM} ]; then \
|
-${Q} if [ ! -z ${ALLOW_CUSTOM} ]; then \
|
||||||
if ${CMP} -s libcustcalc.a $T${CUSTOMCALDIR}/libcustcalc.a; then \
|
if ${CMP} -s libcustcalc.a ${T}${CUSTOMCALDIR}/libcustcalc.a; then \
|
||||||
true; \
|
${TRUE}; \
|
||||||
else \
|
else \
|
||||||
rm -f $T${CUSTOMCALDIR}/libcustcalc.a.new; \
|
${RM} -f ${T}${CUSTOMCALDIR}/libcustcalc.a.new; \
|
||||||
cp -f libcustcalc.a $T${CUSTOMCALDIR}/libcustcalc.a.new; \
|
${CP} -f libcustcalc.a ${T}${CUSTOMCALDIR}/libcustcalc.a.new; \
|
||||||
${CHMOD} 0644 $T${CUSTOMCALDIR}/libcustcalc.a.new; \
|
${CHMOD} 0644 ${T}${CUSTOMCALDIR}/libcustcalc.a.new; \
|
||||||
mv -f $T${CUSTOMCALDIR}/libcustcalc.a.new \
|
${MV} -f ${T}${CUSTOMCALDIR}/libcustcalc.a.new \
|
||||||
$T${CUSTOMCALDIR}/libcustcalc.a; \
|
${T}${CUSTOMCALDIR}/libcustcalc.a; \
|
||||||
${RANLIB} $T${CUSTOMCALDIR}/libcustcalc.a; \
|
${RANLIB} ${T}${CUSTOMCALDIR}/libcustcalc.a; \
|
||||||
echo "installed $T${CUSTOMCALDIR}/libcustcalc.a"; \
|
echo "installed ${T}${CUSTOMCALDIR}/libcustcalc.a"; \
|
||||||
fi; \
|
fi; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -749,58 +774,58 @@ install: all
|
|||||||
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
||||||
#
|
#
|
||||||
uninstall:
|
uninstall:
|
||||||
-${Q}if [ -f "$T${CUSTOMCALDIR}/libcustcalc.a" ]; then \
|
-${Q} if [ -f "${T}${CUSTOMCALDIR}/libcustcalc.a" ]; then \
|
||||||
rm -f "$T${CUSTOMCALDIR}/libcustcalc.a"; \
|
${RM} -f "${T}${CUSTOMCALDIR}/libcustcalc.a"; \
|
||||||
if [ -f "$T${CUSTOMCALDIR}/libcustcalc.a" ]; then \
|
if [ -f "${T}${CUSTOMCALDIR}/libcustcalc.a" ]; then \
|
||||||
echo "cannot uninstall $T${CUSTOMCALDIR}/libcustcalc.a"; \
|
echo "cannot uninstall ${T}${CUSTOMCALDIR}/libcustcalc.a"; \
|
||||||
else \
|
else \
|
||||||
echo "uninstalled $T${CUSTOMCALDIR}/libcustcalc.a"; \
|
echo "uninstalled ${T}${CUSTOMCALDIR}/libcustcalc.a"; \
|
||||||
fi; \
|
fi; \
|
||||||
fi
|
fi
|
||||||
-${Q}for i in ${CUSTOM_HELP} /dev/null; do \
|
-${Q} for i in ${CUSTOM_HELP} /dev/null; do \
|
||||||
if [ "$$i" = "/dev/null" ]; then \
|
if [ "$$i" = "/dev/null" ]; then \
|
||||||
continue; \
|
continue; \
|
||||||
fi; \
|
fi; \
|
||||||
if [ -f "$T${CUSTOMHELPDIR}/$$i" ]; then \
|
if [ -f "${T}${CUSTOMHELPDIR}/$$i" ]; then \
|
||||||
rm -f "$T${CUSTOMHELPDIR}/$$i"; \
|
${RM} -f "${T}${CUSTOMHELPDIR}/$$i"; \
|
||||||
if [ -f "$T${CUSTOMHELPDIR}/$$i" ]; then \
|
if [ -f "${T}${CUSTOMHELPDIR}/$$i" ]; then \
|
||||||
echo "cannot uninstall $T${CUSTOMHELPDIR}/$$i"; \
|
echo "cannot uninstall ${T}${CUSTOMHELPDIR}/$$i"; \
|
||||||
else \
|
else \
|
||||||
echo "uninstalled $T${CUSTOMHELPDIR}/$$i"; \
|
echo "uninstalled ${T}${CUSTOMHELPDIR}/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
-${Q}for i in ${CUSTOM_CALC_FILES} /dev/null; do \
|
-${Q} for i in ${CUSTOM_CALC_FILES} /dev/null; do \
|
||||||
if [ "$$i" = "/dev/null" ]; then \
|
if [ "$$i" = "/dev/null" ]; then \
|
||||||
continue; \
|
continue; \
|
||||||
fi; \
|
fi; \
|
||||||
if [ -f "$T${CUSTOMCALDIR}/$$i" ]; then \
|
if [ -f "${T}${CUSTOMCALDIR}/$$i" ]; then \
|
||||||
rm -f "$T${CUSTOMCALDIR}/$$i"; \
|
${RM} -f "${T}${CUSTOMCALDIR}/$$i"; \
|
||||||
if [ -f "$T${CUSTOMCALDIR}/$$i" ]; then \
|
if [ -f "${T}${CUSTOMCALDIR}/$$i" ]; then \
|
||||||
echo "cannot uninstall $T${CUSTOMCALDIR}/$$i"; \
|
echo "cannot uninstall ${T}${CUSTOMCALDIR}/$$i"; \
|
||||||
else \
|
else \
|
||||||
echo "uninstalled $T${CUSTOMCALDIR}/$$i"; \
|
echo "uninstalled ${T}${CUSTOMCALDIR}/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
-${Q}for i in ${INSTALL_H_SRC} /dev/null; do \
|
-${Q} for i in ${INSTALL_H_SRC} /dev/null; do \
|
||||||
if [ "$$i" = "/dev/null" ]; then \
|
if [ "$$i" = "/dev/null" ]; then \
|
||||||
continue; \
|
continue; \
|
||||||
fi; \
|
fi; \
|
||||||
if [ -f "$T${CUSTOMINCDIR}/$$i" ]; then \
|
if [ -f "${T}${CUSTOMINCDIR}/$$i" ]; then \
|
||||||
rm -f "$T${CUSTOMINCDIR}/$$i"; \
|
${RM} -f "${T}${CUSTOMINCDIR}/$$i"; \
|
||||||
if [ -f "$T${CUSTOMINCDIR}/$$i" ]; then \
|
if [ -f "${T}${CUSTOMINCDIR}/$$i" ]; then \
|
||||||
echo "cannot uninstall $T${CUSTOMINCDIR}/$$i"; \
|
echo "cannot uninstall ${T}${CUSTOMINCDIR}/$$i"; \
|
||||||
else \
|
else \
|
||||||
echo "uninstalled $T${CUSTOMINCDIR}/$$i"; \
|
echo "uninstalled ${T}${CUSTOMINCDIR}/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
-${Q}for i in ${CUSTOMINCDIR} ${CUSTOMHELPDIR} ${CUSTOMCALDIR} \
|
-${Q} for i in ${CUSTOMINCDIR} ${CUSTOMHELPDIR} ${CUSTOMCALDIR} \
|
||||||
${HELPDIR} ${CALC_INCDIR} ${CALC_SHAREDIR} ${INCDIR}; do \
|
${HELPDIR} ${CALC_INCDIR} ${CALC_SHAREDIR} ${INCDIR}; do \
|
||||||
if [ -d "$T$$i" ]; then \
|
if [ -d "${T}$$i" ]; then \
|
||||||
rmdir "$T$$i" 2>/dev/null; \
|
${RMDIR} "${T}$$i" 2>/dev/null; \
|
||||||
echo "cleaned up $T$$i"; \
|
echo "cleaned up ${T}$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@@ -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.11 $
|
* @(#) $Revision: 29.12 $
|
||||||
* @(#) $Id: c_sysinfo.c,v 29.11 2006/05/22 19:04:45 chongo Exp $
|
* @(#) $Id: c_sysinfo.c,v 29.12 2006/09/18 06:28:47 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_sysinfo.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_sysinfo.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1997/03/09 23:14:40
|
* Under source code control: 1997/03/09 23:14:40
|
||||||
@@ -85,7 +85,6 @@ static struct infoname sys_info[] = {
|
|||||||
{"DEFAULTSHELL", "default shell to use", DEFAULTSHELL, (FULL)0},
|
{"DEFAULTSHELL", "default shell to use", DEFAULTSHELL, (FULL)0},
|
||||||
{"DEV_BITS", "device number size in bits", NULL, (FULL)DEV_BITS},
|
{"DEV_BITS", "device number size in bits", NULL, (FULL)DEV_BITS},
|
||||||
{"DISPLAY_DEFAULT", "default digits for float display", NULL, (FULL)DISPLAY_DEFAULT},
|
{"DISPLAY_DEFAULT", "default digits for float display", NULL, (FULL)DISPLAY_DEFAULT},
|
||||||
{"ECHO_PROG", "where the echo command is located", ECHO_PROG, (FULL)0},
|
|
||||||
{"EPSILONPREC_DEFAULT", "2^-EPSILON_DEFAULT <= EPSILON_DEFAULT", NULL, (FULL)EPSILONPREC_DEFAULT},
|
{"EPSILONPREC_DEFAULT", "2^-EPSILON_DEFAULT <= EPSILON_DEFAULT", NULL, (FULL)EPSILONPREC_DEFAULT},
|
||||||
{"EPSILON_DEFAULT", "allowed error for float calculations", EPSILON_DEFAULT, (FULL)0},
|
{"EPSILON_DEFAULT", "allowed error for float calculations", EPSILON_DEFAULT, (FULL)0},
|
||||||
{"ERRMAX", "default errmax value", NULL, (FULL)ERRMAX},
|
{"ERRMAX", "default errmax value", NULL, (FULL)ERRMAX},
|
||||||
|
156
func.c
156
func.c
@@ -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.30 $
|
* @(#) $Revision: 29.32 $
|
||||||
* @(#) $Id: func.c,v 29.30 2006/08/20 15:01:30 chongo Exp $
|
* @(#) $Id: func.c,v 29.32 2006/12/16 10:46:07 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/func.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/func.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:48:15
|
* Under source code control: 1990/02/15 01:48:15
|
||||||
@@ -83,6 +83,11 @@
|
|||||||
# define strdup(x) calc_strdup((CONST char *)(x))
|
# define strdup(x) calc_strdup((CONST char *)(x))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "have_rusage.h"
|
||||||
|
#if defined(HAVE_GETRUSAGE)
|
||||||
|
# include <sys/resource.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "have_const.h"
|
#include "have_const.h"
|
||||||
#include "have_unused.h"
|
#include "have_unused.h"
|
||||||
#include "calc.h"
|
#include "calc.h"
|
||||||
@@ -142,18 +147,6 @@ static int env_pool_max = 0; /* number of env_pool elements allocated */
|
|||||||
static struct env_pool *e_pool = NULL; /* env_pool elements */
|
static struct env_pool *e_pool = NULL; /* env_pool elements */
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* if HZ & CLK_TCK are not defined, pick typical values, hope for the best
|
|
||||||
*/
|
|
||||||
#if !defined(HZ)
|
|
||||||
# define HZ 60
|
|
||||||
#endif
|
|
||||||
#if !defined(CLK_TCK)
|
|
||||||
# undef CLK_TCK
|
|
||||||
# define CLK_TCK HZ
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* user-defined error strings
|
* user-defined error strings
|
||||||
*/
|
*/
|
||||||
@@ -5067,20 +5060,131 @@ f_listremove(VALUE *vp)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the current runtime of calc in seconds.
|
* Return the current user time of calc in seconds.
|
||||||
* This is the user mode time only.
|
*/
|
||||||
|
static NUMBER *
|
||||||
|
f_usertime(void)
|
||||||
|
{
|
||||||
|
#if defined(HAVE_GETRUSAGE)
|
||||||
|
struct rusage usage; /* system resource usage */
|
||||||
|
int who = RUSAGE_SELF; /* obtain time for just this process */
|
||||||
|
int status; /* getrusage() return code */
|
||||||
|
NUMBER *ret; /* CPU time to return */
|
||||||
|
NUMBER *secret; /* whole sconds of CPU time to return */
|
||||||
|
NUMBER *usecret; /* microseconds of CPU time to return */
|
||||||
|
|
||||||
|
/* get the resource informaion for ourself */
|
||||||
|
status = getrusage(who, &usage);
|
||||||
|
if (status < 0) {
|
||||||
|
/* system call error, so return 0 */
|
||||||
|
return qlink(&_qzero_);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* add user time */
|
||||||
|
secret = stoq(usage.ru_utime.tv_sec);
|
||||||
|
usecret = iitoq((long)usage.ru_utime.tv_usec, 1000000L);
|
||||||
|
ret = qqadd(secret, usecret);
|
||||||
|
qfree(secret);
|
||||||
|
qfree(usecret);
|
||||||
|
|
||||||
|
/* return user CPU time */
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
#else /* HAVE_GETRUSAGE */
|
||||||
|
/* not a POSIX system */
|
||||||
|
return qlink(&_qzero_);
|
||||||
|
#endif /* HAVE_GETRUSAGE */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the current kernel time of calc in seconds.
|
||||||
|
* This is the kernel mode time only.
|
||||||
|
*/
|
||||||
|
static NUMBER *
|
||||||
|
f_systime(void)
|
||||||
|
{
|
||||||
|
#if defined(HAVE_GETRUSAGE)
|
||||||
|
struct rusage usage; /* system resource usage */
|
||||||
|
int who = RUSAGE_SELF; /* obtain time for just this process */
|
||||||
|
int status; /* getrusage() return code */
|
||||||
|
NUMBER *ret; /* CPU time to return */
|
||||||
|
NUMBER *secret; /* whole sconds of CPU time to return */
|
||||||
|
NUMBER *usecret; /* microseconds of CPU time to return */
|
||||||
|
|
||||||
|
/* get the resource informaion for ourself */
|
||||||
|
status = getrusage(who, &usage);
|
||||||
|
if (status < 0) {
|
||||||
|
/* system call error, so return 0 */
|
||||||
|
return qlink(&_qzero_);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* add kernel time */
|
||||||
|
secret = stoq(usage.ru_stime.tv_sec);
|
||||||
|
usecret = iitoq((long)usage.ru_stime.tv_usec, 1000000L);
|
||||||
|
ret = qqadd(secret, usecret);
|
||||||
|
qfree(secret);
|
||||||
|
qfree(usecret);
|
||||||
|
|
||||||
|
/* return kernel CPU time */
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
#else /* HAVE_GETRUSAGE */
|
||||||
|
/* not a POSIX system */
|
||||||
|
return qlink(&_qzero_);
|
||||||
|
#endif /* HAVE_GETRUSAGE */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return the current user and kernel time of calc in seconds.
|
||||||
*/
|
*/
|
||||||
static NUMBER *
|
static NUMBER *
|
||||||
f_runtime(void)
|
f_runtime(void)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(HAVE_GETRUSAGE)
|
||||||
return qlink(&_qzero_);
|
struct rusage usage; /* system resource usage */
|
||||||
#else /* Windoz free systems */
|
int who = RUSAGE_SELF; /* obtain time for just this process */
|
||||||
struct tms buf;
|
int status; /* getrusage() return code */
|
||||||
|
NUMBER *user; /* user CPU time to return */
|
||||||
|
NUMBER *sys; /* kernel CPU time to return */
|
||||||
|
NUMBER *ret; /* total CPU time to return */
|
||||||
|
NUMBER *secret; /* whole sconds of CPU time to return */
|
||||||
|
NUMBER *usecret; /* microseconds of CPU time to return */
|
||||||
|
|
||||||
times(&buf);
|
/* get the resource informaion for ourself */
|
||||||
return iitoq((long) buf.tms_utime, (long) CLK_TCK);
|
status = getrusage(who, &usage);
|
||||||
#endif /* Windoz free systems */
|
if (status < 0) {
|
||||||
|
/* system call error, so return 0 */
|
||||||
|
return qlink(&_qzero_);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* add kernel time */
|
||||||
|
secret = stoq(usage.ru_stime.tv_sec);
|
||||||
|
usecret = iitoq((long)usage.ru_stime.tv_usec, 1000000L);
|
||||||
|
sys = qqadd(secret, usecret);
|
||||||
|
qfree(secret);
|
||||||
|
qfree(usecret);
|
||||||
|
|
||||||
|
/* add user time */
|
||||||
|
secret = stoq(usage.ru_utime.tv_sec);
|
||||||
|
usecret = iitoq((long)usage.ru_utime.tv_usec, 1000000L);
|
||||||
|
user = qqadd(secret, usecret);
|
||||||
|
qfree(secret);
|
||||||
|
qfree(usecret);
|
||||||
|
|
||||||
|
/* total time is user + kernel */
|
||||||
|
ret = qqadd(user, sys);
|
||||||
|
qfree(user);
|
||||||
|
qfree(sys);
|
||||||
|
|
||||||
|
/* return CPU time */
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
#else /* HAVE_GETRUSAGE */
|
||||||
|
/* not a POSIX system */
|
||||||
|
return qlink(&_qzero_);
|
||||||
|
#endif /* HAVE_GETRUSAGE */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -8558,7 +8662,7 @@ static CONST struct builtin builtins[] = {
|
|||||||
{"rsearch", 2, 4, 0, OP_NOP, 0, f_rsearch,
|
{"rsearch", 2, 4, 0, OP_NOP, 0, f_rsearch,
|
||||||
"reverse search matrix or list for value b\n\t\t\tstarting at index c"},
|
"reverse search matrix or list for value b\n\t\t\tstarting at index c"},
|
||||||
{"runtime", 0, 0, 0, OP_NOP, f_runtime, 0,
|
{"runtime", 0, 0, 0, OP_NOP, f_runtime, 0,
|
||||||
"user mode cpu time in seconds"},
|
"user and kernel mode cpu time in seconds"},
|
||||||
{"saveval", 1, 1, 0, OP_SAVEVAL, 0, 0,
|
{"saveval", 1, 1, 0, OP_SAVEVAL, 0, 0,
|
||||||
"set flag for saving values"},
|
"set flag for saving values"},
|
||||||
{"scale", 2, 2, 0, OP_SCALE, 0, 0,
|
{"scale", 2, 2, 0, OP_SCALE, 0, 0,
|
||||||
@@ -8641,6 +8745,8 @@ static CONST struct builtin builtins[] = {
|
|||||||
"swap values of variables a and b (can be dangerous)"},
|
"swap values of variables a and b (can be dangerous)"},
|
||||||
{"system", 1, 1, 0, OP_NOP, 0, f_system,
|
{"system", 1, 1, 0, OP_NOP, 0, f_system,
|
||||||
"call Unix command"},
|
"call Unix command"},
|
||||||
|
{"systime", 0, 0, 0, OP_NOP, f_systime, 0,
|
||||||
|
"kernel mode cpu time in seconds"},
|
||||||
{"tail", 2, 2, 0, OP_NOP, 0, f_tail,
|
{"tail", 2, 2, 0, OP_NOP, 0, f_tail,
|
||||||
"retain list of specified number at tail of list"},
|
"retain list of specified number at tail of list"},
|
||||||
{"tan", 1, 2, 0, OP_NOP, 0, f_tan,
|
{"tan", 1, 2, 0, OP_NOP, 0, f_tan,
|
||||||
@@ -8655,6 +8761,8 @@ static CONST struct builtin builtins[] = {
|
|||||||
"truncate a to b number of decimal places"},
|
"truncate a to b number of decimal places"},
|
||||||
{"ungetc", 2, 2, 0, OP_NOP, 0, f_ungetc,
|
{"ungetc", 2, 2, 0, OP_NOP, 0, f_ungetc,
|
||||||
"unget char read from file"},
|
"unget char read from file"},
|
||||||
|
{"usertime", 0, 0, 0, OP_NOP, f_usertime, 0,
|
||||||
|
"user mode cpu time in seconds"},
|
||||||
{"version", 0, 0, 0, OP_NOP, 0, f_version,
|
{"version", 0, 0, 0, OP_NOP, 0, f_version,
|
||||||
"calc version string"},
|
"calc version string"},
|
||||||
{"xor", 1, IN, 0, OP_NOP, 0, f_xor,
|
{"xor", 1, IN, 0, OP_NOP, 0, f_xor,
|
||||||
|
7
help.c
7
help.c
@@ -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.8 $
|
* @(#) $Revision: 29.9 $
|
||||||
* @(#) $Id: help.c,v 29.8 2001/04/08 08:29:28 chongo Exp $
|
* @(#) $Id: help.c,v 29.9 2007/02/07 00:37:52 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/help.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/help.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1997/09/14 10:58:30
|
* Under source code control: 1997/09/14 10:58:30
|
||||||
@@ -62,6 +62,8 @@ static struct help_alias {
|
|||||||
{".", "oldvalue"},
|
{".", "oldvalue"},
|
||||||
{"%", "mod"},
|
{"%", "mod"},
|
||||||
{"//", "quo"},
|
{"//", "quo"},
|
||||||
|
{"#", "pound"},
|
||||||
|
{"calc", "help"},
|
||||||
{"copy", "blkcpy"},
|
{"copy", "blkcpy"},
|
||||||
{"copying", "COPYING"},
|
{"copying", "COPYING"},
|
||||||
{"copying-lgpl", "COPYING-LGPL"},
|
{"copying-lgpl", "COPYING-LGPL"},
|
||||||
@@ -71,6 +73,7 @@ static struct help_alias {
|
|||||||
{"COPYRIGHT", "copyright"},
|
{"COPYRIGHT", "copyright"},
|
||||||
{"Copyleft", "copyright"},
|
{"Copyleft", "copyright"},
|
||||||
{"COPYLEFT", "copyright"},
|
{"COPYLEFT", "copyright"},
|
||||||
|
{"define", "command"},
|
||||||
{"read", "command"},
|
{"read", "command"},
|
||||||
{"write", "command"},
|
{"write", "command"},
|
||||||
{"quit", "command"},
|
{"quit", "command"},
|
||||||
|
366
help/Makefile
366
help/Makefile
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# help - makefile for calc help files
|
# help - makefile for calc help files
|
||||||
#
|
#
|
||||||
# Copyright (C) 1999-2002 Landon Curt Noll
|
# Copyright (C) 1999-2006 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
|
||||||
@@ -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.30 $
|
# @(#) $Revision: 29.36 $
|
||||||
# @(#) $Id: Makefile,v 29.30 2006/08/20 15:01:57 chongo Exp $
|
# @(#) $Id: Makefile,v 29.36 2007/02/07 00:31:06 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
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
# required vars
|
# required vars
|
||||||
#
|
#
|
||||||
SHELL= /bin/sh
|
SHELL= /bin/sh
|
||||||
MAKE_FILE = Makefile
|
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
|
||||||
@@ -62,9 +62,9 @@ INCDIR= /usr/include
|
|||||||
# ${LIBDIR} where calc link library (*.a) files are installed
|
# ${LIBDIR} where calc link library (*.a) files are installed
|
||||||
# ${CALC_SHAREDIR} where to install calc help, .cal, startup, config files
|
# ${CALC_SHAREDIR} where to install calc help, .cal, startup, config files
|
||||||
#
|
#
|
||||||
# NOTE: The install rule prepends installation paths with $T, which
|
# NOTE: The install rule prepends installation paths with ${T}, which
|
||||||
# by default is empty. If $T is non-empty, then installation
|
# by default is empty. If ${T} is non-empty, then installation
|
||||||
# locations will be relative to the $T directory.
|
# locations will be relative to the ${T} directory.
|
||||||
#
|
#
|
||||||
# For DJGPP, select:
|
# For DJGPP, select:
|
||||||
#
|
#
|
||||||
@@ -99,9 +99,9 @@ CALC_SHAREDIR= /usr/share/calc
|
|||||||
# ${CUSTOMINCPDIR} where custom .h files are installed
|
# ${CUSTOMINCPDIR} where custom .h files are installed
|
||||||
# ${SCRIPTDIR} where calc shell scripts are installed
|
# ${SCRIPTDIR} where calc shell scripts are installed
|
||||||
#
|
#
|
||||||
# NOTE: The install rule prepends installation paths with $T, which
|
# NOTE: The install rule prepends installation paths with ${T}, which
|
||||||
# by default is empty. If $T is non-empty, then installation
|
# by default is empty. If ${T} is non-empty, then installation
|
||||||
# locations will be relative to the $T directory.
|
# locations will be relative to the ${T} directory.
|
||||||
#
|
#
|
||||||
# If in doubt, set:
|
# If in doubt, set:
|
||||||
#
|
#
|
||||||
@@ -121,8 +121,8 @@ SCRIPTDIR= ${BINDIR}/cscript
|
|||||||
|
|
||||||
# T - top level directory under which calc will be installed
|
# T - top level directory under which calc will be installed
|
||||||
#
|
#
|
||||||
# The calc install is performed under $T, the calc build is
|
# The calc install is performed under ${T}, the calc build is
|
||||||
# performed under /. The purpose for $T is to allow someone
|
# performed under /. The purpose for ${T} is to allow someone
|
||||||
# to install calc somewhere other than into the system area.
|
# to install calc somewhere other than into the system area.
|
||||||
#
|
#
|
||||||
# For example, if:
|
# For example, if:
|
||||||
@@ -142,10 +142,10 @@ SCRIPTDIR= ${BINDIR}/cscript
|
|||||||
# calc help, .cal ...: /var/tmp/testing/usr/share/calc
|
# calc help, .cal ...: /var/tmp/testing/usr/share/calc
|
||||||
# ... etc ... /var/tmp/testing/...
|
# ... etc ... /var/tmp/testing/...
|
||||||
#
|
#
|
||||||
# If $T is empty, calc is installed under /, which is the same
|
# If ${T} is empty, calc is installed under /, which is the same
|
||||||
# top of tree for which it was built. If $T is non-empty, then
|
# top of tree for which it was built. If ${T} is non-empty, then
|
||||||
# calc is installed under $T, as if one had to chroot under
|
# calc is installed under ${T}, as if one had to chroot under
|
||||||
# $T for calc to operate.
|
# ${T} for calc to operate.
|
||||||
#
|
#
|
||||||
# If in doubt, use T=
|
# If in doubt, use T=
|
||||||
#
|
#
|
||||||
@@ -169,6 +169,14 @@ SED= sed
|
|||||||
SORT= sort
|
SORT= sort
|
||||||
FMT= fmt
|
FMT= fmt
|
||||||
CMP= cmp
|
CMP= cmp
|
||||||
|
CP= cp
|
||||||
|
MV= mv
|
||||||
|
TRUE= true
|
||||||
|
RM= rm
|
||||||
|
MKDIR= mkdir
|
||||||
|
RMDIR= rmdir
|
||||||
|
TOUCH= touch
|
||||||
|
CAT= cat
|
||||||
|
|
||||||
# Some out of date operating systems require / want an executable to
|
# Some out of date operating systems require / want an executable to
|
||||||
# end with a certain file extension. Some compile systems such as
|
# end with a certain file extension. Some compile systems such as
|
||||||
@@ -206,9 +214,9 @@ STD_HELP_FILES_8= operator statement
|
|||||||
|
|
||||||
BLT_HELP_FILES_9= resource
|
BLT_HELP_FILES_9= resource
|
||||||
|
|
||||||
STD_HELP_FILES_10= types usage script
|
STD_HELP_FILES_10= types script
|
||||||
|
|
||||||
BLT_HELP_FILES_10a= cscript
|
BLT_HELP_FILES_10a= usage cscript
|
||||||
|
|
||||||
STD_HELP_FILES_10b= unexpected variable
|
STD_HELP_FILES_10b= unexpected variable
|
||||||
|
|
||||||
@@ -269,7 +277,7 @@ DETAIL_HELP= abs access acos acosh acot acoth acsc acsch address agd append \
|
|||||||
appr arg argv arrow asec asech asin asinh assign atan atan2 atanh \
|
appr arg argv arrow asec asech asin asinh assign atan atan2 atanh \
|
||||||
avg base base2 bernoulli bit blk blkcpy blkfree blocks bround \
|
avg base base2 bernoulli bit blk blkcpy blkfree blocks bround \
|
||||||
btrunc calc_tty calclevel catalan ceil cfappr cfsim char cmdbuf \
|
btrunc calc_tty calclevel catalan ceil cfappr cfsim char cmdbuf \
|
||||||
cmp comb conj cos cosh cot coth count cp csc csch ctime delete den \
|
cmp comb conj cos cosh cot coth count csc csch ctime delete den \
|
||||||
dereference det digit digits display dp epsilon errcount errmax \
|
dereference det digit digits display dp epsilon errcount errmax \
|
||||||
errno error estr euler eval exp fact factor fclose fcnt feof ferror \
|
errno error estr euler eval exp fact factor fclose fcnt feof ferror \
|
||||||
fflush fgetc fgetfield fgetfile fgetline fgets fgetstr fib files \
|
fflush fgetc fgetfield fgetfile fgetline fgets fgetstr fib files \
|
||||||
@@ -284,15 +292,15 @@ DETAIL_HELP= abs access acos acosh acot acoth acsc acsch address agd append \
|
|||||||
ln log lowbit ltol makelist matdim matfill matmax matmin matsum \
|
ln log lowbit ltol makelist matdim matfill matmax matmin matsum \
|
||||||
mattrace mattrans max md5 memsize meq min minv mmin mne mod modify \
|
mattrace mattrans max md5 memsize meq min minv mmin mne mod modify \
|
||||||
name near newerror nextcand nextprime norm null num oldvalue ord \
|
name near newerror nextcand nextprime norm null num oldvalue ord \
|
||||||
param perm pfact pi pix places pmod polar poly pop popcnt power \
|
param perm pfact pi pix places pmod polar poly pop popcnt pound \
|
||||||
prevcand prevprime printf prompt protect ptest push putenv quo \
|
power prevcand prevprime printf prompt protect ptest push putenv \
|
||||||
quomod rand randbit random randombit randperm rcin rcmul rcout \
|
quo quomod rand randbit random randombit randperm rcin rcmul rcout \
|
||||||
rcpow rcsq re remove reverse rewind rm root round rsearch runtime \
|
rcpow rcsq re remove reverse rewind rm root round rsearch runtime \
|
||||||
saveval scale scan scanf search sec sech seed segment select sgn \
|
saveval scale scan scanf search sec sech seed segment select sgn \
|
||||||
sha sha1 sin sinh size sizeof sleep sort sqrt srand srandom ssq \
|
sha sha1 sin sinh size sizeof sleep sort sqrt srand srandom ssq \
|
||||||
str strcat strcmp strcpy strerror strlen strncmp strncpy strpos \
|
str strcat strcmp strcpy strerror strlen strncmp strncpy strpos \
|
||||||
strprintf strscan strscanf substr sum swap system tail tan tanh \
|
strprintf strscan strscanf substr sum swap system systime tail tan \
|
||||||
test time trunc version xor
|
tanh test time trunc usertime version xor
|
||||||
|
|
||||||
# This list is of files that are clones of DETAIL_HELP files. They are
|
# This list is of files that are clones of DETAIL_HELP files. They are
|
||||||
# built from DETAIL_HELP files.
|
# built from DETAIL_HELP files.
|
||||||
@@ -317,7 +325,7 @@ DISTLIST= ${STD_HELP_FILES} ${DETAIL_HELP} ${MAKE_FILE} \
|
|||||||
CALCLIBLIST=
|
CALCLIBLIST=
|
||||||
|
|
||||||
all: ${FULL_HELP_FILES} full ${DETAIL_HELP} ${DETAIL_CLONE} \
|
all: ${FULL_HELP_FILES} full ${DETAIL_HELP} ${DETAIL_CLONE} \
|
||||||
${SINGULAR_FILES} calc .all
|
${SINGULAR_FILES} .all
|
||||||
|
|
||||||
# used by the upper level Makefile to determine of we have done all
|
# used by the upper level Makefile to determine of we have done all
|
||||||
#
|
#
|
||||||
@@ -325,175 +333,183 @@ all: ${FULL_HELP_FILES} full ${DETAIL_HELP} ${DETAIL_CLONE} \
|
|||||||
# an non-emoty else clause for every if condition. *sigh*
|
# an non-emoty else clause for every if condition. *sigh*
|
||||||
#
|
#
|
||||||
.all:
|
.all:
|
||||||
rm -f .all
|
${RM} -f .all
|
||||||
touch .all
|
${TOUCH} .all
|
||||||
|
|
||||||
bindings: ../cal/bindings
|
bindings: ../cal/bindings
|
||||||
rm -f $@
|
${RM} -f $@
|
||||||
cp ../cal/bindings $@
|
${CP} ../cal/bindings $@
|
||||||
${CHMOD} 0444 $@
|
${CHMOD} 0444 $@
|
||||||
-@if [ -z "${Q}" ]; then \
|
-@if [ -z "${Q}" ]; then \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
echo '=-=-= skipping the cat of help/$@ =-=-='; \
|
echo '=-=-= skipping the ${CAT} of help/$@ =-=-='; \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
resource: ../cal/README
|
resource: ../cal/README
|
||||||
rm -f $@
|
${RM} -f $@
|
||||||
cp ../cal/README $@
|
${CP} ../cal/README $@
|
||||||
${CHMOD} 0444 $@
|
${CHMOD} 0444 $@
|
||||||
-@if [ -z "${Q}" ]; then \
|
-@if [ -z "${Q}" ]; then \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
echo '=-=-= skipping the cat of help/$@ =-=-='; \
|
echo '=-=-= skipping the ${CAT} of help/$@ =-=-='; \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
changes: ../CHANGES
|
changes: ../CHANGES
|
||||||
rm -f $@
|
${RM} -f $@
|
||||||
cp ../CHANGES $@
|
${CP} ../CHANGES $@
|
||||||
${CHMOD} 0444 $@
|
${CHMOD} 0444 $@
|
||||||
-@if [ -z "${Q}" ]; then \
|
-@if [ -z "${Q}" ]; then \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
echo '=-=-= skipping the cat of help/$@ =-=-='; \
|
echo '=-=-= skipping the ${CAT} of help/$@ =-=-='; \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
libcalc: ../LIBRARY
|
libcalc: ../LIBRARY
|
||||||
rm -f $@
|
${RM} -f $@
|
||||||
${SED} -e 's:$${LIBDIR}:${LIBDIR}:g' \
|
${SED} -e 's:$${LIBDIR}:${LIBDIR}:g' \
|
||||||
-e 's:$${CALC_INCDIR}:${CALC_INCDIR}:g' < ../LIBRARY > $@
|
-e 's:$${CALC_INCDIR}:${CALC_INCDIR}:g' < ../LIBRARY > $@
|
||||||
${CHMOD} 0444 $@
|
${CHMOD} 0444 $@
|
||||||
-@if [ -z "${Q}" ]; then \
|
-@if [ -z "${Q}" ]; then \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
echo '=-=-= skipping the cat of help/$@ =-=-='; \
|
echo '=-=-= skipping the ${CAT} of help/$@ =-=-='; \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bugs: ../BUGS
|
bugs: ../BUGS
|
||||||
rm -f $@
|
${RM} -f $@
|
||||||
cp ../BUGS $@
|
${CP} ../BUGS $@
|
||||||
${CHMOD} 0444 $@
|
${CHMOD} 0444 $@
|
||||||
-@if [ -z "${Q}" ]; then \
|
-@if [ -z "${Q}" ]; then \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
echo '=-=-= skipping the cat of help/$@ =-=-='; \
|
echo '=-=-= skipping the ${CAT} of help/$@ =-=-='; \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
errorcodes: ../calcerr.h errorcodes.hdr errorcodes.sed
|
errorcodes: ../calcerr.h errorcodes.hdr errorcodes.sed
|
||||||
rm -f $@
|
${RM} -f $@
|
||||||
cat errorcodes.hdr > $@
|
${CAT} errorcodes.hdr > $@
|
||||||
${SED} -n -f errorcodes.sed < ../calcerr.h >> $@
|
${SED} -n -f errorcodes.sed < ../calcerr.h >> $@
|
||||||
${CHMOD} 0444 $@
|
${CHMOD} 0444 $@
|
||||||
-@if [ -z "${Q}" ]; then \
|
-@if [ -z "${Q}" ]; then \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
echo '=-=-= skipping the cat of help/$@ =-=-='; \
|
echo '=-=-= skipping the ${CAT} of help/$@ =-=-='; \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
calc: usage
|
usage: ../calc.usage
|
||||||
rm -f $@
|
${RM} -f $@
|
||||||
cp usage $@
|
${CP} ../calc.usage $@
|
||||||
${CHMOD} 0444 $@
|
${CHMOD} 0444 $@
|
||||||
-@if [ -z "${Q}" ]; then \
|
-@if [ -z "${Q}" ]; then \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
echo '=-=-= skipping the cat of help/$@ =-=-='; \
|
echo '=-=-= skipping the ${CAT} of help/$@ =-=-='; \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
../calc.usage:
|
||||||
|
(cd ..; $(MAKE) calc.usage)
|
||||||
|
|
||||||
custom_cal: ../custom/CUSTOM_CAL
|
custom_cal: ../custom/CUSTOM_CAL
|
||||||
rm -f $@
|
${RM} -f $@
|
||||||
cp ../custom/CUSTOM_CAL $@
|
${CP} ../custom/CUSTOM_CAL $@
|
||||||
${CHMOD} 0444 $@
|
${CHMOD} 0444 $@
|
||||||
-@if [ -z "${Q}" ]; then \
|
-@if [ -z "${Q}" ]; then \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
echo '=-=-= skipping the cat of help/$@ =-=-='; \
|
echo '=-=-= skipping the ${CAT} of help/$@ =-=-='; \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new_custom: ../custom/HOW_TO_ADD
|
new_custom: ../custom/HOW_TO_ADD
|
||||||
rm -f $@
|
${RM} -f $@
|
||||||
cp ../custom/HOW_TO_ADD $@
|
${CP} ../custom/HOW_TO_ADD $@
|
||||||
${CHMOD} 0444 $@
|
${CHMOD} 0444 $@
|
||||||
-@if [ -z "${Q}" ]; then \
|
-@if [ -z "${Q}" ]; then \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
echo '=-=-= skipping the cat of help/$@ =-=-='; \
|
echo '=-=-= skipping the ${CAT} of help/$@ =-=-='; \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
copy: blkcpy
|
copy: blkcpy
|
||||||
rm -f $@
|
${RM} -f $@
|
||||||
cp blkcpy $@
|
${CP} blkcpy $@
|
||||||
${CHMOD} 0444 $@
|
${CHMOD} 0444 $@
|
||||||
-@if [ -z "${Q}" ]; then \
|
-@if [ -z "${Q}" ]; then \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
echo '=-=-= skipping the cat of help/$@ =-=-='; \
|
echo '=-=-= skipping the ${CAT} of help/$@ =-=-='; \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
COPYING: ../COPYING
|
COPYING: ../COPYING
|
||||||
rm -f $@
|
${RM} -f $@
|
||||||
cp ../COPYING $@
|
${CP} ../COPYING $@
|
||||||
${CHMOD} 0444 $@
|
${CHMOD} 0444 $@
|
||||||
-@if [ -z "${Q}" ]; then \
|
-@if [ -z "${Q}" ]; then \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
echo '=-=-= skipping the cat of help/$@ =-=-='; \
|
echo '=-=-= skipping the ${CAT} of help/$@ =-=-='; \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
COPYING-LGPL: ../COPYING-LGPL
|
COPYING-LGPL: ../COPYING-LGPL
|
||||||
rm -f $@
|
${RM} -f $@
|
||||||
cp ../COPYING-LGPL $@
|
${CP} ../COPYING-LGPL $@
|
||||||
${CHMOD} 0444 $@
|
${CHMOD} 0444 $@
|
||||||
-@if [ -z "${Q}" ]; then \
|
-@if [ -z "${Q}" ]; then \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
echo '=-=-= skipping the cat of help/$@ =-=-='; \
|
echo '=-=-= skipping the ${CAT} of help/$@ =-=-='; \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cscript: ../cscript/README
|
cscript: ../cscript/README
|
||||||
rm -f $@
|
${RM} -f $@
|
||||||
cp ../cscript/README $@
|
${CP} ../cscript/README $@
|
||||||
${CHMOD} 0444 $@
|
${CHMOD} 0444 $@
|
||||||
-@if [ -z "${Q}" ]; then \
|
-@if [ -z "${Q}" ]; then \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
echo '=-=-= skipping the cat of help/$@ =-=-='; \
|
echo '=-=-= skipping the ${CAT} of help/$@ =-=-='; \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
../cscript/README: ../cscript/README.src
|
||||||
|
${Q} echo "forming cscript/README"
|
||||||
|
-${Q} ${RM} -f $@
|
||||||
|
(cd ../cscript; $(MAKE) README)
|
||||||
|
|
||||||
full: ${FULL_HELP_FILES} ${MAKE_FILE}
|
full: ${FULL_HELP_FILES} ${MAKE_FILE}
|
||||||
${Q}echo "forming full"
|
${Q} echo "forming full"
|
||||||
-${Q}rm -f $@
|
-${Q} ${RM} -f $@
|
||||||
-${Q}for i in ${FULL_HELP_FILES}; do \
|
-${Q} for i in ${FULL_HELP_FILES}; do \
|
||||||
if [ Xintro != X"$$i" ]; then \
|
if [ Xintro != X"$$i" ]; then \
|
||||||
echo ""; \
|
echo ""; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi; \
|
fi; \
|
||||||
if [ Xobj.file = X"$$i" ]; then \
|
if [ Xobj.file = X"$$i" ]; then \
|
||||||
j=obj; \
|
j=obj; \
|
||||||
@@ -504,34 +520,34 @@ full: ${FULL_HELP_FILES} ${MAKE_FILE}
|
|||||||
echo "* $$j"; \
|
echo "* $$j"; \
|
||||||
echo "*************"; \
|
echo "*************"; \
|
||||||
echo ""; \
|
echo ""; \
|
||||||
cat $$i; \
|
${CAT} $$i; \
|
||||||
done > $@
|
done > $@
|
||||||
${Q}echo "full formed"
|
${Q} echo "full formed"
|
||||||
-@if [ -z "${Q}" ]; then \
|
-@if [ -z "${Q}" ]; then \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
echo '=-=-= skipping the cat of help/$@ =-=-='; \
|
echo '=-=-= skipping the ${CAT} of help/$@ =-=-='; \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Singular files are the same files as their plural form.
|
# Singular files are the same files as their plural form.
|
||||||
#
|
#
|
||||||
${SINGULAR_FILES}: ${PLURAL_FILES}
|
${SINGULAR_FILES}: ${PLURAL_FILES}
|
||||||
${Q}for i in ${SINGULAR_FILES} /dev/null; do \
|
${Q} for i in ${SINGULAR_FILES} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo "rm -f $${i}"; \
|
echo "${RM} -f $${i}"; \
|
||||||
rm -f $${i}; \
|
${RM} -f $${i}; \
|
||||||
echo "cp $${i}s $${i}"; \
|
echo "${CP} $${i}s $${i}"; \
|
||||||
cp $${i}s $${i}; \
|
${CP} $${i}s $${i}; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
-@if [ -z "${Q}" ]; then \
|
-@if [ -z "${Q}" ]; then \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
echo '=-=-= skipping the cat of help/SINGULAR_FILES =-=-='; \
|
echo '=-=-= skipping the ${CAT} of help/SINGULAR_FILES =-=-='; \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Form the builtin file
|
# Form the builtin file
|
||||||
@@ -553,25 +569,25 @@ ${SINGULAR_FILES}: ${PLURAL_FILES}
|
|||||||
# do not treat -I.. correctly!
|
# do not treat -I.. correctly!
|
||||||
#
|
#
|
||||||
builtin: builtin.top builtin.end ../func.c funclist.sed
|
builtin: builtin.top builtin.end ../func.c funclist.sed
|
||||||
${Q}echo "forming builtin help file"
|
${Q} echo "forming builtin help file"
|
||||||
-${Q}rm -f funclist.c
|
-${Q} ${RM} -f funclist.c
|
||||||
${Q}${SED} -n -f funclist.sed ../func.c > funclist.c
|
${Q} ${SED} -n -f funclist.sed ../func.c > funclist.c
|
||||||
-${Q}rm -f funclist.o funclist${EXT}
|
-${Q} ${RM} -f funclist.o funclist${EXT}
|
||||||
${Q}${LCC} ${ICFLAGS} -DFUNCLIST -I/usr/include \
|
${Q} ${LCC} ${ICFLAGS} -DFUNCLIST -I/usr/include \
|
||||||
-I.. funclist.c -c 2>/dev/null
|
-I.. funclist.c -c 2>/dev/null
|
||||||
${Q}${LCC} ${ILDFLAGS} funclist.o -o funclist${EXT}
|
${Q} ${LCC} ${ILDFLAGS} funclist.o -o funclist${EXT}
|
||||||
-${Q}rm -f builtin
|
-${Q} ${RM} -f builtin
|
||||||
${Q}cat builtin.top > builtin
|
${Q} ${CAT} builtin.top > builtin
|
||||||
${Q}./funclist${EXT} | \
|
${Q} ./funclist${EXT} | \
|
||||||
${SED} -e 's/^/ /' -e 's/[ ][ ]*$$//' >> builtin
|
${SED} -e 's/^/ /' -e 's/[ ][ ]*$$//' >> builtin
|
||||||
${Q}cat builtin.end >> builtin
|
${Q} ${CAT} builtin.end >> builtin
|
||||||
${Q}echo "builtin help file formed"
|
${Q} echo "builtin help file formed"
|
||||||
-@if [ -z "${Q}" ]; then \
|
-@if [ -z "${Q}" ]; then \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
echo '=-=-= skipping the cat of help/$@ =-=-='; \
|
echo '=-=-= skipping the ${CAT} of help/$@ =-=-='; \
|
||||||
echo ''; \
|
echo ''; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##
|
##
|
||||||
@@ -585,17 +601,17 @@ builtin: builtin.top builtin.end ../func.c funclist.sed
|
|||||||
##
|
##
|
||||||
|
|
||||||
distlist: ${DISTLIST}
|
distlist: ${DISTLIST}
|
||||||
${Q}for i in ${DISTLIST} /dev/null; do \
|
${Q} for i in ${DISTLIST} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo help/$$i; \
|
echo help/$$i; \
|
||||||
fi; \
|
fi; \
|
||||||
done | LANG=C ${SORT}
|
done | LANG=C ${SORT}
|
||||||
|
|
||||||
distdir:
|
distdir:
|
||||||
${Q}echo help
|
${Q} echo help
|
||||||
|
|
||||||
calcliblist:
|
calcliblist:
|
||||||
${Q}for i in ${CALCLIBLIST} /dev/null; do \
|
${Q} for i in ${CALCLIBLIST} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo help/$$i; \
|
echo help/$$i; \
|
||||||
fi; \
|
fi; \
|
||||||
@@ -606,21 +622,21 @@ calcliblist:
|
|||||||
# ignore this rule.
|
# ignore this rule.
|
||||||
#
|
#
|
||||||
bsdi: all
|
bsdi: all
|
||||||
rm -f obj
|
${RM} -f obj
|
||||||
cp obj.file obj
|
${CP} obj.file obj
|
||||||
|
|
||||||
# These next rule help me form the ${DETAIL_HELP} makefile variables above.
|
# These next rule help me form the ${DETAIL_HELP} makefile variables above.
|
||||||
#
|
#
|
||||||
detaillist:
|
detaillist:
|
||||||
${Q}-(echo "xxxxx"; \
|
${Q} -(echo "xxxxx"; \
|
||||||
for i in ${DETAIL_HELP} /dev/null; do \
|
for i in ${DETAIL_HELP} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
if [ ! -f RCS/$$i,v ]; then \
|
if [ ! -f RCS/$$i,v ]; then \
|
||||||
echo "WARNING: $$i not under RCS control" 1>&2; \
|
echo "WARNING: $$i not under RCS control" 1>&2; \
|
||||||
else \
|
else \
|
||||||
echo $$i; \
|
echo $$i; \
|
||||||
|
fi; \
|
||||||
fi; \
|
fi; \
|
||||||
fi; \
|
|
||||||
done | LANG=C ${SORT}) | ${FMT} -70 | \
|
done | LANG=C ${SORT}) | ${FMT} -70 | \
|
||||||
${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/ \\$$//'
|
||||||
@@ -632,13 +648,13 @@ detaillist:
|
|||||||
##
|
##
|
||||||
|
|
||||||
echo_inst_files:
|
echo_inst_files:
|
||||||
${Q}for i in ${STD_HELP_FILES} full ${BLT_HELP_FILES} \
|
${Q} for i in ${STD_HELP_FILES} full ${BLT_HELP_FILES} \
|
||||||
builtin ${DETAIL_HELP} ${SINGULAR_FILES} /dev/null; do \
|
builtin ${DETAIL_HELP} ${SINGULAR_FILES} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo __file__ ${HELPDIR}/$$i; \
|
echo __file__ ${HELPDIR}/$$i; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
${Q}echo __file__ ${HELPDIR}/obj
|
${Q} echo __file__ ${HELPDIR}/obj
|
||||||
|
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
@@ -647,67 +663,67 @@ echo_inst_files:
|
|||||||
##
|
##
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f obj mkbuiltin funclist.c funclist.o funclist${EXT}
|
${RM} -f obj mkbuiltin funclist.c funclist.o funclist${EXT}
|
||||||
rm -f COPYING COPYING-LGPL
|
${RM} -f COPYING COPYING-LGPL
|
||||||
|
|
||||||
clobber:
|
clobber:
|
||||||
rm -f ${BLT_HELP_FILES} full .all calc
|
${RM} -f ${BLT_HELP_FILES} full .all calc
|
||||||
rm -f obj mkbuiltin funclist.c funclist.o funclist${EXT}
|
${RM} -f obj mkbuiltin funclist.c funclist.o funclist${EXT}
|
||||||
rm -f COPYING COPYING-LGPL
|
${RM} -f COPYING COPYING-LGPL
|
||||||
rm -f ${SINGULAR_FILES} ${DETAIL_CLONE}
|
${RM} -f ${SINGULAR_FILES} ${DETAIL_CLONE}
|
||||||
|
|
||||||
# install everything
|
# install everything
|
||||||
#
|
#
|
||||||
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
||||||
#
|
#
|
||||||
install: all
|
install: all
|
||||||
-${Q}if [ ! -d $T${CALC_SHAREDIR} ]; then \
|
-${Q} if [ ! -d ${T}${CALC_SHAREDIR} ]; then \
|
||||||
echo mkdir $T${CALC_SHAREDIR}; \
|
echo ${MKDIR} ${T}${CALC_SHAREDIR}; \
|
||||||
mkdir $T${CALC_SHAREDIR}; \
|
${MKDIR} ${T}${CALC_SHAREDIR}; \
|
||||||
if [ ! -d "$T${CALC_SHAREDIR}" ]; then \
|
if [ ! -d "${T}${CALC_SHAREDIR}" ]; then \
|
||||||
echo mkdir -p "$T${CALC_SHAREDIR}"; \
|
echo ${MKDIR} -p "${T}${CALC_SHAREDIR}"; \
|
||||||
mkdir -p "$T${CALC_SHAREDIR}"; \
|
${MKDIR} -p "${T}${CALC_SHAREDIR}"; \
|
||||||
fi; \
|
fi; \
|
||||||
echo ${CHMOD} 0755 $T${CALC_SHAREDIR}; \
|
echo ${CHMOD} 0755 ${T}${CALC_SHAREDIR}; \
|
||||||
${CHMOD} 0755 $T${CALC_SHAREDIR}; \
|
${CHMOD} 0755 ${T}${CALC_SHAREDIR}; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
-${Q}if [ ! -d $T${HELPDIR} ]; then \
|
-${Q} if [ ! -d ${T}${HELPDIR} ]; then \
|
||||||
echo mkdir $T${HELPDIR}; \
|
echo ${MKDIR} ${T}${HELPDIR}; \
|
||||||
mkdir $T${HELPDIR}; \
|
${MKDIR} ${T}${HELPDIR}; \
|
||||||
if [ ! -d "$T${HELPDIR}" ]; then \
|
if [ ! -d "${T}${HELPDIR}" ]; then \
|
||||||
echo mkdir -p "$T${HELPDIR}"; \
|
echo ${MKDIR} -p "${T}${HELPDIR}"; \
|
||||||
mkdir -p "$T${HELPDIR}"; \
|
${MKDIR} -p "${T}${HELPDIR}"; \
|
||||||
fi; \
|
fi; \
|
||||||
echo ${CHMOD} 0755 $T${HELPDIR}; \
|
echo ${CHMOD} 0755 ${T}${HELPDIR}; \
|
||||||
${CHMOD} 0755 $T${HELPDIR}; \
|
${CHMOD} 0755 ${T}${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} /dev/null; do \
|
full ${DETAIL_HELP} ${SINGULAR_FILES} /dev/null; do \
|
||||||
if [ "$$i" = "/dev/null" ]; then \
|
if [ "$$i" = "/dev/null" ]; then \
|
||||||
continue; \
|
continue; \
|
||||||
fi; \
|
fi; \
|
||||||
if ${CMP} -s $$i $T${HELPDIR}/$$i; then \
|
if ${CMP} -s $$i ${T}${HELPDIR}/$$i; then \
|
||||||
true; \
|
${TRUE}; \
|
||||||
else \
|
else \
|
||||||
rm -f $T${HELPDIR}/$$i.new; \
|
${RM} -f ${T}${HELPDIR}/$$i.new; \
|
||||||
cp -f $$i $T${HELPDIR}/$$i.new; \
|
${CP} -f $$i ${T}${HELPDIR}/$$i.new; \
|
||||||
${CHMOD} 0444 $T${HELPDIR}/$$i.new; \
|
${CHMOD} 0444 ${T}${HELPDIR}/$$i.new; \
|
||||||
mv -f $T${HELPDIR}/$$i.new $T${HELPDIR}/$$i; \
|
${MV} -f ${T}${HELPDIR}/$$i.new ${T}${HELPDIR}/$$i; \
|
||||||
echo "installed $T${HELPDIR}/$$i"; \
|
echo "installed ${T}${HELPDIR}/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
-${Q}if ${CMP} -s obj.file $T${HELPDIR}/obj; then \
|
-${Q} if ${CMP} -s obj.file ${T}${HELPDIR}/obj; then \
|
||||||
true; \
|
${TRUE}; \
|
||||||
else \
|
else \
|
||||||
rm -f $T${HELPDIR}/obj.new; \
|
${RM} -f ${T}${HELPDIR}/obj.new; \
|
||||||
cp -f obj.file $T${HELPDIR}/obj.new; \
|
${CP} -f obj.file ${T}${HELPDIR}/obj.new; \
|
||||||
${CHMOD} 0444 $T${HELPDIR}/obj.new; \
|
${CHMOD} 0444 ${T}${HELPDIR}/obj.new; \
|
||||||
mv -f $T${HELPDIR}/obj.new $T${HELPDIR}/obj; \
|
${MV} -f ${T}${HELPDIR}/obj.new ${T}${HELPDIR}/obj; \
|
||||||
echo "installed $T${HELPDIR}/obj"; \
|
echo "installed ${T}${HELPDIR}/obj"; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Try to remove everything that was installed
|
# Try to remove everything that was installed
|
||||||
@@ -715,31 +731,31 @@ install: all
|
|||||||
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
||||||
#
|
#
|
||||||
uninstall:
|
uninstall:
|
||||||
-${Q}if [ -f "$T${HELPDIR}/obj" ]; then \
|
-${Q} if [ -f "${T}${HELPDIR}/obj" ]; then \
|
||||||
rm -f "$T${HELPDIR}/obj"; \
|
${RM} -f "${T}${HELPDIR}/obj"; \
|
||||||
if [ -f "$T${HELPDIR}/obj" ]; then \
|
if [ -f "${T}${HELPDIR}/obj" ]; then \
|
||||||
echo "cannot uninstall $T${HELPDIR}/obj"; \
|
echo "cannot uninstall ${T}${HELPDIR}/obj"; \
|
||||||
else \
|
else \
|
||||||
echo "uninstalled $T${HELPDIR}/obj"; \
|
echo "uninstalled ${T}${HELPDIR}/obj"; \
|
||||||
fi; \
|
fi; \
|
||||||
fi
|
fi
|
||||||
-${Q}for i in ${SINGULAR_FILES} ${DETAIL_HELP} full builtin \
|
-${Q} for i in ${SINGULAR_FILES} ${DETAIL_HELP} full builtin \
|
||||||
${BLT_HELP_FILES} ${STD_HELP_FILES} /dev/null; do \
|
${BLT_HELP_FILES} ${STD_HELP_FILES} /dev/null; do \
|
||||||
if [ "$$i" = "/dev/null" ]; then \
|
if [ "$$i" = "/dev/null" ]; then \
|
||||||
continue; \
|
continue; \
|
||||||
fi; \
|
fi; \
|
||||||
if [ -f "$T${HELPDIR}/$$i" ]; then \
|
if [ -f "${T}${HELPDIR}/$$i" ]; then \
|
||||||
rm -f "$T${HELPDIR}/$$i"; \
|
${RM} -f "${T}${HELPDIR}/$$i"; \
|
||||||
if [ -f "$T${HELPDIR}/$$i" ]; then \
|
if [ -f "${T}${HELPDIR}/$$i" ]; then \
|
||||||
echo "cannot uninstall $T${HELPDIR}/$$i"; \
|
echo "cannot uninstall ${T}${HELPDIR}/$$i"; \
|
||||||
else \
|
else \
|
||||||
echo "uninstalled $T${HELPDIR}/$$i"; \
|
echo "uninstalled ${T}${HELPDIR}/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
-${Q}for i in ${HELPDIR} ${CALC_SHAREDIR}; do \
|
-${Q} for i in ${HELPDIR} ${CALC_SHAREDIR}; do \
|
||||||
if [ -d "$T$$i" ]; then \
|
if [ -d "${T}$$i" ]; then \
|
||||||
rmdir "$T$$i" 2>/dev/null; \
|
${RMDIR} "${T}$$i" 2>/dev/null; \
|
||||||
echo "cleaned up $T$$i"; \
|
echo "cleaned up ${T}$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
16
help/config
16
help/config
@@ -68,6 +68,7 @@ DESCRIPTION
|
|||||||
"baseb" bits in calculation base, a read-only value
|
"baseb" bits in calculation base, a read-only value
|
||||||
"redecl_warn" TRUE => warn when redeclaring
|
"redecl_warn" TRUE => warn when redeclaring
|
||||||
"dupvar_warn" TRUE => warn when variable names collide
|
"dupvar_warn" TRUE => warn when variable names collide
|
||||||
|
"hz" Read-only operating system tick rate or 0
|
||||||
|
|
||||||
The "all" config value allows one to save/restore the configuration
|
The "all" config value allows one to save/restore the configuration
|
||||||
set of values. The return of:
|
set of values. The return of:
|
||||||
@@ -867,6 +868,16 @@ DESCRIPTION
|
|||||||
|
|
||||||
The initial "redecl_warn" value is 1.
|
The initial "redecl_warn" value is 1.
|
||||||
|
|
||||||
|
=-=
|
||||||
|
|
||||||
|
config("hz") <== NOTE: This is a read-only config value
|
||||||
|
|
||||||
|
Returns the rate at which the operating system advances the clock
|
||||||
|
on POSIX based systems. Returns 0 on non-POSIX based systems.
|
||||||
|
The non-zero value returned is in Hetrz.
|
||||||
|
|
||||||
|
This config parameter is read-only and cannot be set.
|
||||||
|
|
||||||
|
|
||||||
EXAMPLE
|
EXAMPLE
|
||||||
; current_cfg = config("all");
|
; current_cfg = config("all");
|
||||||
@@ -928,6 +939,7 @@ EXAMPLE
|
|||||||
baseb 32
|
baseb 32
|
||||||
redecl_warn 1
|
redecl_warn 1
|
||||||
dupvar_warn 1
|
dupvar_warn 1
|
||||||
|
hz 100
|
||||||
|
|
||||||
; display()
|
; display()
|
||||||
20
|
20
|
||||||
@@ -960,8 +972,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.17 $
|
## @(#) $Revision: 29.18 $
|
||||||
## @(#) $Id: config,v 29.17 2006/06/24 19:06:58 chongo Exp $
|
## @(#) $Id: config,v 29.18 2006/12/16 11:14:28 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
|
||||||
|
63
help/cp
63
help/cp
@@ -1,63 +0,0 @@
|
|||||||
NAME
|
|
||||||
cp - cross product of two 3 element vectors
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
cp(x, y)
|
|
||||||
|
|
||||||
TYPES
|
|
||||||
x, y 1-dimensional matrices with 3 elements
|
|
||||||
|
|
||||||
return 1-dimensional matrix with 3 elements
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
Calculate the product of two 3 1-dimensional matrices.
|
|
||||||
If x has elements (x0, x1, x2), and y has elements (y0, y1, y2),
|
|
||||||
cp(x,y) returns the matrix of type [0:2] with elements:
|
|
||||||
|
|
||||||
{x1 * y2 - x2 * y1, x3 * y1 - x1 * y3, x1 * y2 - x2 * y1}
|
|
||||||
|
|
||||||
EXAMPLE
|
|
||||||
; mat x[3] = {2,3,4}
|
|
||||||
; mat y[3] = {3,4,5}
|
|
||||||
; print cp(x,y)
|
|
||||||
|
|
||||||
mat [3] (3 elements, 3 nonzero):
|
|
||||||
[0] = -1
|
|
||||||
[1] = 2
|
|
||||||
[2] = -1
|
|
||||||
|
|
||||||
LIMITS
|
|
||||||
The components of the matrices are to be of types for which the
|
|
||||||
required algebraic operations have been defined.
|
|
||||||
|
|
||||||
LINK LIBRARY
|
|
||||||
MATRIX *matcross(MATRIX *x, MATRIX *y)
|
|
||||||
|
|
||||||
SEE ALSO
|
|
||||||
dp
|
|
||||||
|
|
||||||
## 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: cp,v 29.3 2006/05/07 07:25:46 chongo Exp $
|
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/cp,v $
|
|
||||||
##
|
|
||||||
## Under source code control: 1995/10/05 04:52:26
|
|
||||||
## File existed as early as: 1995
|
|
||||||
##
|
|
||||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
|
||||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
|
36
help/help
36
help/help
@@ -51,15 +51,6 @@ following topics:
|
|||||||
|
|
||||||
full all of the above (in the above order)
|
full all of the above (in the above order)
|
||||||
|
|
||||||
You can also ask for help on a particular function name. For example,
|
|
||||||
|
|
||||||
help asinh
|
|
||||||
help round
|
|
||||||
|
|
||||||
or on a particular symbol such as:
|
|
||||||
|
|
||||||
help =
|
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
help usage
|
help usage
|
||||||
@@ -71,6 +62,27 @@ without invoking any startup code by running calc as follows:
|
|||||||
|
|
||||||
where 'topic' is one of the topics listed above.
|
where 'topic' is one of the topics listed above.
|
||||||
|
|
||||||
|
You can also ask for help on a particular builtin function name. For example:
|
||||||
|
|
||||||
|
help asinh
|
||||||
|
help round
|
||||||
|
|
||||||
|
See:
|
||||||
|
|
||||||
|
help builtin
|
||||||
|
|
||||||
|
for a list of builtin functions.
|
||||||
|
|
||||||
|
Some calc operators have their own help pages:
|
||||||
|
|
||||||
|
help =
|
||||||
|
help ->
|
||||||
|
help *
|
||||||
|
help .
|
||||||
|
help %
|
||||||
|
help //
|
||||||
|
help #
|
||||||
|
|
||||||
If the -m mode disallows opening files for reading or execution of programs,
|
If the -m mode disallows opening files for reading or execution of programs,
|
||||||
then the help facility will be disabled. See:
|
then the help facility will be disabled. See:
|
||||||
|
|
||||||
@@ -103,7 +115,7 @@ as the same effect as:
|
|||||||
|
|
||||||
custom("help", "anything");
|
custom("help", "anything");
|
||||||
|
|
||||||
## Copyright (C) 1999 Landon Curt Noll
|
## Copyright (C) 1999-2007 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
|
||||||
@@ -119,8 +131,8 @@ as the same effect as:
|
|||||||
## 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: help,v 29.3 2000/06/07 14:02:33 chongo Exp $
|
## @(#) $Id: help,v 29.4 2007/02/07 00:30:04 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/help,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/help,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1991/07/21 04:37:20
|
## Under source code control: 1991/07/21 04:37:20
|
||||||
|
127
help/pound
Normal file
127
help/pound
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
NAME
|
||||||
|
#
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
#!/usr/local/src/cmd/calc/calc -q -f
|
||||||
|
# x
|
||||||
|
x # y
|
||||||
|
## comment
|
||||||
|
|
||||||
|
TYPES
|
||||||
|
x, y integer or real
|
||||||
|
|
||||||
|
return integer (uniary operator case)
|
||||||
|
integer or real (binary operator case)
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
The pound sign or sharp sign "#" has special meaning in calc.
|
||||||
|
|
||||||
|
As a uniary operator:
|
||||||
|
|
||||||
|
# value
|
||||||
|
|
||||||
|
returns the number of 1 bits, or pop-count of the absolute value of
|
||||||
|
the numerator (abs(num(value))). Therefore when x is a non-negative
|
||||||
|
integer , # x is the pop-count of x. And thus when x is a negative
|
||||||
|
integer, # x returns the pop-count of abs(x). And in the general
|
||||||
|
case when x is a real, # x returns the pop-count of abs(num(x)).
|
||||||
|
|
||||||
|
As a binary operator:
|
||||||
|
|
||||||
|
x # y
|
||||||
|
|
||||||
|
returns abs(x-y), the absolute value of the difference.
|
||||||
|
|
||||||
|
When two or more pound signs in a row start a comment:
|
||||||
|
|
||||||
|
## this is a comment
|
||||||
|
### this is also a comment
|
||||||
|
print "this will print"; ## but this will not because it is a comment
|
||||||
|
|
||||||
|
A pound sign followed by a bang also starts a comment:
|
||||||
|
|
||||||
|
#! strictly speaking, this is a comment
|
||||||
|
print "this is correct but not recommended" #! acts like ##
|
||||||
|
|
||||||
|
On POSIX / Un*X / Linux / BSD conforming systems, when an executable
|
||||||
|
starts with the two bytes # and !, the remainder of the 1st line
|
||||||
|
(up to an operating system imposed limit) is taken to be the path
|
||||||
|
to the shell (plus shell arguments) that is to be executed. The
|
||||||
|
kernel appends the filename of the executable as a final argument
|
||||||
|
to the shell.
|
||||||
|
|
||||||
|
For example, of an executable file contains:
|
||||||
|
|
||||||
|
#!/usr/local/src/cmd/calc/calc -q -f
|
||||||
|
/* NOTE: The #! above must start in column 1 of the 1st line */
|
||||||
|
/* The 1st line must end with -f */
|
||||||
|
## Single # shell comments don't work, use two or more
|
||||||
|
print "2+2 =", 2+2;
|
||||||
|
|
||||||
|
When the above file it is executed by the kernel, it will print:
|
||||||
|
|
||||||
|
2+2 = 4
|
||||||
|
|
||||||
|
Such files are known to calc as cscripts. See "help cscript"
|
||||||
|
for examples.
|
||||||
|
|
||||||
|
It is suggested that the -q be added to the first line to
|
||||||
|
disable the reading of the startup scripts. It is not mandatory.
|
||||||
|
|
||||||
|
The last argument of the first line must be -f without the filename
|
||||||
|
because the kernel will supply the cscript filename as a final
|
||||||
|
argument. The final -f also implies -s. See "help usage" for
|
||||||
|
more information.
|
||||||
|
|
||||||
|
|
||||||
|
EXAMPLE
|
||||||
|
; #3
|
||||||
|
2
|
||||||
|
; #3.5
|
||||||
|
3
|
||||||
|
; 4 # 5
|
||||||
|
1
|
||||||
|
; 5 # 4
|
||||||
|
1
|
||||||
|
|
||||||
|
; pi() # exp(1)
|
||||||
|
0.4233108251307480031
|
||||||
|
; exp(1) # pi()
|
||||||
|
0.4233108251307480031
|
||||||
|
|
||||||
|
; ## this is a comment
|
||||||
|
|
||||||
|
LIMITS
|
||||||
|
none
|
||||||
|
|
||||||
|
LINK LIBRARY
|
||||||
|
none
|
||||||
|
|
||||||
|
SEE ALSO
|
||||||
|
cscript, unexpected, usage
|
||||||
|
|
||||||
|
## Copyright (C) 2007 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: pound,v 29.1 2007/02/06 23:48:15 chongo Exp $
|
||||||
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/pound,v $
|
||||||
|
##
|
||||||
|
## Under source code control: 2007/02/06 14:09
|
||||||
|
## File existed as early as: 2007
|
||||||
|
##
|
||||||
|
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||||
|
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
30
help/runtime
30
help/runtime
@@ -1,5 +1,5 @@
|
|||||||
NAME
|
NAME
|
||||||
runtime - user runtime
|
runtime - CPU time used by the current process in both user and kernel modes
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
runtime()
|
runtime()
|
||||||
@@ -8,27 +8,33 @@ TYPES
|
|||||||
return nonnegative real
|
return nonnegative real
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Returns the current user mode cpu runtime in seconds.
|
In POSIX based systems, this function will return the CPU seconds
|
||||||
|
used by the current process in both user and kernel mode. Time
|
||||||
|
spent in the kernel executing system calls and time spend executing
|
||||||
|
user code (such as performing computation on behalf of calc) are
|
||||||
|
both included.
|
||||||
|
|
||||||
|
On non-POSIX based systems, this function will always return 0.
|
||||||
|
In particular, most MS windows based systems do not have the required
|
||||||
|
POSIX system call and so this function will always return 0.
|
||||||
|
|
||||||
EXAMPLE
|
EXAMPLE
|
||||||
|
The result for this example will depend on the speed of the CPU
|
||||||
The result for this example will depend on the speed and number of
|
and precision of the operating CPU time accounting sub-system:
|
||||||
of clock-ticks per second for the computer being used. The result
|
|
||||||
is a multiple of 1/CLK_TCK, where CLK_TCK is usually 60, 100, or 1000.
|
|
||||||
|
|
||||||
; t = runtime();
|
; t = runtime();
|
||||||
; pi = pi(1e-1000);
|
; x = ptest(2^4253-1);
|
||||||
; runtime() - t;
|
; runtime() - t;
|
||||||
.2
|
1.288804
|
||||||
|
|
||||||
LIMITS
|
LIMITS
|
||||||
none
|
On non-POSIX based systems, this function always returns 0.
|
||||||
|
|
||||||
LINK LIBRARY
|
LINK LIBRARY
|
||||||
none
|
none
|
||||||
|
|
||||||
SEE ALSO
|
SEE ALSO
|
||||||
ctime, time
|
config, ctime, systime, time, usertime
|
||||||
|
|
||||||
## Copyright (C) 1999-2006 Landon Curt Noll
|
## Copyright (C) 1999-2006 Landon Curt Noll
|
||||||
##
|
##
|
||||||
@@ -46,8 +52,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.5 $
|
## @(#) $Revision: 29.7 $
|
||||||
## @(#) $Id: runtime,v 29.5 2006/06/25 22:16:55 chongo Exp $
|
## @(#) $Id: runtime,v 29.7 2006/12/16 10:52:27 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/runtime,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/runtime,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1996/03/12 23:10:01
|
## Under source code control: 1996/03/12 23:10:01
|
||||||
|
109
help/statement
109
help/statement
@@ -3,22 +3,76 @@ Statements
|
|||||||
Statements are very much like C statements. Most statements act
|
Statements are very much like C statements. Most statements act
|
||||||
identically to those in C, but there are minor differences and
|
identically to those in C, but there are minor differences and
|
||||||
some additions. The following is a list of the statement types,
|
some additions. The following is a list of the statement types,
|
||||||
with explanation of the non-C statements. In this list, upper
|
with explanation of the non-C statements.
|
||||||
case words identify the keywords which are actually in lower case.
|
|
||||||
Statements are generally terminated with semicolons, except if the
|
|
||||||
statement is the compound one formed by matching braces. Various
|
|
||||||
expressions are optional and may be omitted (as in RETURN).
|
|
||||||
|
|
||||||
|
Statements are generally terminated with semicolons or { ... }.
|
||||||
|
|
||||||
C-like statements
|
C-like statements
|
||||||
-----------------
|
-----------------
|
||||||
{ statement }
|
{ statement }
|
||||||
{ statement; ... statement }
|
{ statement; ... statement }
|
||||||
|
|
||||||
|
|
||||||
|
C-like flow control
|
||||||
|
-------------------
|
||||||
if (expr) statement
|
if (expr) statement
|
||||||
if (expr) statement ELSE statement
|
if (expr) statement else statement
|
||||||
for (optionalexpr ; optionalexpr ; optionalexpr) statement
|
for (optionalexpr ; optionalexpr ; optionalexpr) statement
|
||||||
while (expr) statement
|
while (expr) statement
|
||||||
do statement while (expr)
|
do statement while (expr)
|
||||||
|
|
||||||
|
These all work like in normal C.
|
||||||
|
|
||||||
|
IMPORTANT NOTE: When statement is of the form { ... },
|
||||||
|
the leading { must be on the same line as the if, for,
|
||||||
|
while or do keyword.
|
||||||
|
|
||||||
|
This works as expected:
|
||||||
|
|
||||||
|
if (expr) {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
However this WILL NOT WORK AS EXPECTED:
|
||||||
|
|
||||||
|
if (expr)
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
because calc will parse the if being terminated by
|
||||||
|
an empty statement followed by a
|
||||||
|
|
||||||
|
if (expr) ;
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
In the same way, use these forms:
|
||||||
|
|
||||||
|
for (optionalexpr ; optionalexpr ; optionalexpr) {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
while (expr) {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
...
|
||||||
|
while (expr);
|
||||||
|
|
||||||
|
where the initial { is on the SAME LINE as the if, while,
|
||||||
|
for or do.
|
||||||
|
|
||||||
|
See 'help expression' for details on expressions.
|
||||||
|
See 'help builtin' for details on calc builtin functions.
|
||||||
|
See 'help unexpanded' for things C programmers do not expect.
|
||||||
|
See also 'help todo' and 'help bugs'.
|
||||||
|
|
||||||
|
|
||||||
|
C-like flow breaks
|
||||||
|
------------------
|
||||||
continue
|
continue
|
||||||
break
|
break
|
||||||
goto label
|
goto label
|
||||||
@@ -30,8 +84,9 @@ Statements
|
|||||||
|
|
||||||
return
|
return
|
||||||
------
|
------
|
||||||
return optionalexpr
|
return
|
||||||
return ( optionalexpr )
|
return expr
|
||||||
|
return ( expr )
|
||||||
This returns a value from a function. Functions always
|
This returns a value from a function. Functions always
|
||||||
have a return value, even if this statement is not used.
|
have a return value, even if this statement is not used.
|
||||||
If no return statement is executed, or if no expression
|
If no return statement is executed, or if no expression
|
||||||
@@ -236,12 +291,36 @@ Statements
|
|||||||
|
|
||||||
Also see the help topic:
|
Also see the help topic:
|
||||||
|
|
||||||
command top level commands
|
help command top level commands
|
||||||
expression calc expression syntax
|
help expression calc expression syntax
|
||||||
builtin calc builtin functions
|
help builtin calc builtin functions
|
||||||
usage how to invoke the calc command and calc -options
|
help usage how to invoke the calc command and calc -options
|
||||||
|
|
||||||
## Copyright (C) 1999 Landon Curt Noll
|
You may obtain help on individual builtin functions. For example:
|
||||||
|
|
||||||
|
help asinh
|
||||||
|
help round
|
||||||
|
|
||||||
|
See:
|
||||||
|
help builtin
|
||||||
|
|
||||||
|
for a list of builtin functions.
|
||||||
|
|
||||||
|
Some calc operators have their own help pages:
|
||||||
|
|
||||||
|
help ->
|
||||||
|
help *
|
||||||
|
help .
|
||||||
|
help %
|
||||||
|
help //
|
||||||
|
help #
|
||||||
|
|
||||||
|
See also:
|
||||||
|
|
||||||
|
help help
|
||||||
|
|
||||||
|
|
||||||
|
## Copyright (C) 1999-2007 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
|
||||||
@@ -257,8 +336,8 @@ Statements
|
|||||||
## 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.4 $
|
||||||
## @(#) $Id: statement,v 29.2 2000/06/07 14:02:33 chongo Exp $
|
## @(#) $Id: statement,v 29.4 2007/02/07 00:29:06 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/statement,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/statement,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1991/07/21 04:37:23
|
## Under source code control: 1991/07/21 04:37:23
|
||||||
|
63
help/systime
Normal file
63
help/systime
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
NAME
|
||||||
|
systime - kernel CPU time used by the current process
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
systime()
|
||||||
|
|
||||||
|
TYPES
|
||||||
|
return nonnegative real
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
In POSIX based systems, this function will return the CPU seconds
|
||||||
|
used by the current process while in kernel mode executing kernel
|
||||||
|
code on behalf of the current process. Time spent by the current
|
||||||
|
process executing user code (such as performing computation on
|
||||||
|
behalf of calc) is not counted.
|
||||||
|
|
||||||
|
On non-POSIX based systems, this function will always return 0.
|
||||||
|
In particular, most MS windows based systems do not have the required
|
||||||
|
POSIX system call and so this function will always return 0.
|
||||||
|
|
||||||
|
EXAMPLE
|
||||||
|
The result for this example will depend on the speed of the CPU
|
||||||
|
and precision of the operating CPU time accounting sub-system:
|
||||||
|
|
||||||
|
; t = systime();
|
||||||
|
; system("true"),
|
||||||
|
; systime() - t;
|
||||||
|
.001
|
||||||
|
|
||||||
|
LIMITS
|
||||||
|
On non-POSIX based systems, this function always returns 0.
|
||||||
|
|
||||||
|
LINK LIBRARY
|
||||||
|
none
|
||||||
|
|
||||||
|
SEE ALSO
|
||||||
|
config, ctime, runtime, systime, time
|
||||||
|
|
||||||
|
## Copyright (C) 2006 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: systime,v 29.3 2006/12/16 10:53:01 chongo Exp $
|
||||||
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/systime,v $
|
||||||
|
##
|
||||||
|
## Under source code control: 2006/12/16 10:31:08
|
||||||
|
## File existed as early as: 2006
|
||||||
|
##
|
||||||
|
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||||
|
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
43
help/todo
43
help/todo
@@ -24,14 +24,32 @@ Calc Todo Items:
|
|||||||
|
|
||||||
Very High priority items:
|
Very High priority items:
|
||||||
|
|
||||||
* Consider using GNU autoconf / configure to build calc.
|
* Improve the way that calc parses statements such as if, for, while
|
||||||
|
and do so that when a C programmer does. This works as expected:
|
||||||
|
|
||||||
* Internationalize calc by converting calc error messages and
|
if (expr) {
|
||||||
text strings (e.g., calc startup banner, show output, etc.)
|
...
|
||||||
into calls to the GNU gettext internationalization facility.
|
}
|
||||||
If somebody translated these strings into another language,
|
|
||||||
setting $LANG would allow calc to produce error messages
|
However this WILL NOT WORK AS EXPECTED:
|
||||||
and text strings in that language.
|
|
||||||
|
if (expr)
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
because calc will parse the if being terminated by
|
||||||
|
an empty statement followed by a
|
||||||
|
|
||||||
|
if (expr) ;
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
See also "help statement", "help unexpected", "help todo", and
|
||||||
|
"help bugs".
|
||||||
|
|
||||||
|
* Consider using GNU autoconf / configure to build calc.
|
||||||
|
|
||||||
* Fix any 'Known bugs' as noted in the BUGS file or as
|
* Fix any 'Known bugs' as noted in the BUGS file or as
|
||||||
displayed by 'calc help bugs'.
|
displayed by 'calc help bugs'.
|
||||||
@@ -54,6 +72,13 @@ High priority items:
|
|||||||
* Address, if possible and reasonable, any Calc Mis-features
|
* Address, if possible and reasonable, any Calc Mis-features
|
||||||
as noted in the BUGS file or as displayed by 'calc help bugs'.
|
as noted in the BUGS file or as displayed by 'calc help bugs'.
|
||||||
|
|
||||||
|
* Internationalize calc by converting calc error messages and
|
||||||
|
text strings (e.g., calc startup banner, show output, etc.)
|
||||||
|
into calls to the GNU gettext internationalization facility.
|
||||||
|
If somebody translated these strings into another language,
|
||||||
|
setting $LANG would allow calc to produce error messages
|
||||||
|
and text strings in that language.
|
||||||
|
|
||||||
=-=
|
=-=
|
||||||
|
|
||||||
Medium priority items:
|
Medium priority items:
|
||||||
@@ -104,8 +129,8 @@ Medium priority items:
|
|||||||
## 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.10 $
|
||||||
## @(#) $Id: todo,v 29.9 2006/09/17 20:54:07 chongo Exp $
|
## @(#) $Id: todo,v 29.10 2007/01/03 21:26:22 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/todo,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/todo,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1999/10/20 07:42:55
|
## Under source code control: 1999/10/20 07:42:55
|
||||||
|
@@ -248,7 +248,78 @@ Unexpected
|
|||||||
In addition to the C style /* comment lines */, lines that begin with
|
In addition to the C style /* comment lines */, lines that begin with
|
||||||
#! are treated as comments.
|
#! are treated as comments.
|
||||||
|
|
||||||
## Copyright (C) 1999 Landon Curt Noll
|
A single # is an calc operator, not a comment. However two or more
|
||||||
|
##'s in a row is a comment. See "help pound" for more information.
|
||||||
|
|
||||||
|
#!/usr/local/src/cmd/calc/calc -q -f
|
||||||
|
|
||||||
|
/* a correct comment */
|
||||||
|
## another correct comment
|
||||||
|
### two or more together is also a comment
|
||||||
|
/*
|
||||||
|
* another correct comment
|
||||||
|
*/
|
||||||
|
print "2+2 =", 2+2; ## yet another comment
|
||||||
|
|
||||||
|
This next example is WRONG:
|
||||||
|
|
||||||
|
#!/usr/local/src/cmd/calc/calc -q -f
|
||||||
|
|
||||||
|
# This is not a calc calc comment because it has only a single #
|
||||||
|
# You must to start comments with ## or /*
|
||||||
|
print "This example has invalid comments"
|
||||||
|
|
||||||
|
See "help cscript" and "help usage" for more information.
|
||||||
|
|
||||||
|
|
||||||
|
The { must be on the same line as an if, for, while or do
|
||||||
|
=========================================================
|
||||||
|
|
||||||
|
When statement is of the form { ... }, the leading { MUST BE ON
|
||||||
|
THE SAME LINE as the if, for, while or do keyword.
|
||||||
|
|
||||||
|
This works as expected:
|
||||||
|
|
||||||
|
if (expr) {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
However this WILL NOT WORK AS EXPECTED:
|
||||||
|
|
||||||
|
if (expr)
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
because calc will parse the if being terminated by
|
||||||
|
an empty statement followed by a
|
||||||
|
|
||||||
|
if (expr) ;
|
||||||
|
{
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
In the same way, use these forms:
|
||||||
|
|
||||||
|
for (optionalexpr ; optionalexpr ; optionalexpr) {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
while (expr) {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
...
|
||||||
|
while (expr);
|
||||||
|
|
||||||
|
where the initial { is on the SAME LINE as the if, while,
|
||||||
|
for or do keyword.
|
||||||
|
|
||||||
|
NOTE: See "help statement", "help todo", and "help bugs".
|
||||||
|
|
||||||
|
|
||||||
|
## Copyright (C) 1999-2006 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
|
||||||
@@ -264,8 +335,8 @@ Unexpected
|
|||||||
## 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.4 $
|
||||||
## @(#) $Id: unexpected,v 29.2 2000/06/07 14:02:33 chongo Exp $
|
## @(#) $Id: unexpected,v 29.4 2007/02/07 00:30:33 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/unexpected,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/unexpected,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1997/03/21 13:15:18
|
## Under source code control: 1997/03/21 13:15:18
|
||||||
|
370
help/usage
370
help/usage
@@ -1,370 +0,0 @@
|
|||||||
Calc command line
|
|
||||||
|
|
||||||
Calc has the following command line:
|
|
||||||
|
|
||||||
calc [-c] [-C] [-d] [-D calc_debug[:resource_debug[:user_debug]]]
|
|
||||||
[-e] [-h] [-i] [-m mode] [-n] [-p] [-q] [-s] [-u] [-v]
|
|
||||||
[calc_cmd ...]
|
|
||||||
|
|
||||||
#!/usr/local/bin/calc -S [other_flags]
|
|
||||||
|
|
||||||
-c Continue reading command lines even after an scan/parse
|
|
||||||
error has caused the abandonment of a line. Note that this
|
|
||||||
option only deals with scanning and parsing of the calc
|
|
||||||
language. It does not deal with execution or run-time errors.
|
|
||||||
|
|
||||||
For example:
|
|
||||||
|
|
||||||
calc read many_errors.cal
|
|
||||||
|
|
||||||
will cause calc to abort on the first syntax error, whereas:
|
|
||||||
|
|
||||||
calc -c read many_errors.cal
|
|
||||||
|
|
||||||
will cause calc to try to process each line being read
|
|
||||||
despite the scan/parse errors that it encounters.
|
|
||||||
|
|
||||||
By default, calc startup resource files are
|
|
||||||
silently ignored if not found. This flag will report
|
|
||||||
missing startup scripts unless -d is also given.
|
|
||||||
|
|
||||||
|
|
||||||
-C Permit the execution of custom builtin functions.
|
|
||||||
Without this flag, calling the custom() builtin
|
|
||||||
function will simply generate an error.
|
|
||||||
|
|
||||||
Use of this flag may cause calc to execute functions
|
|
||||||
that are non-standard and that are not portable.
|
|
||||||
Custom builtin functions are disabled by default for
|
|
||||||
this reason.
|
|
||||||
|
|
||||||
|
|
||||||
-d Disable the printing of the opening title. The
|
|
||||||
printing of resource file debug and informational messages is
|
|
||||||
also disabled as if config("resource_debug", 0) had been
|
|
||||||
executed.
|
|
||||||
|
|
||||||
For example:
|
|
||||||
|
|
||||||
calc 'read qtime; qtime(2)'
|
|
||||||
|
|
||||||
will output something like:
|
|
||||||
|
|
||||||
qtime(utc_hr_offset) defined
|
|
||||||
It's nearly ten past six.
|
|
||||||
|
|
||||||
whereas:
|
|
||||||
|
|
||||||
calc -d 'read qtime; qtime(2)'
|
|
||||||
|
|
||||||
will just say:
|
|
||||||
|
|
||||||
It's nearly ten past six.
|
|
||||||
|
|
||||||
This flag disables the reporting of missing calc
|
|
||||||
startup scripts.
|
|
||||||
|
|
||||||
|
|
||||||
-D calc_debug[:resource_debug:[user_debug]]
|
|
||||||
Force the initial value of config("calc_debug"),
|
|
||||||
config("resource_debug") and config("user_debug").
|
|
||||||
|
|
||||||
The : separated strings are interpreted as signed 32
|
|
||||||
bit integers. After an optional leading sign a leading
|
|
||||||
zero indicates octal conversion, and a leading ``0x''
|
|
||||||
or ``0X'' hexadecimal conversion. Otherwise, decimal
|
|
||||||
conversion is assumed.
|
|
||||||
|
|
||||||
By default, calc_debug is 0, resource_debug is 3 and
|
|
||||||
user_debug is 0.
|
|
||||||
|
|
||||||
For more information use the following calc command:
|
|
||||||
|
|
||||||
help config
|
|
||||||
|
|
||||||
|
|
||||||
-e Ignore any environment variables on startup. The
|
|
||||||
getenv() builtin will still return values, however.
|
|
||||||
|
|
||||||
|
|
||||||
-h Print a help message. This option implies -q. This is
|
|
||||||
equivalent to the calc command help help. The help
|
|
||||||
facility is disabled unless the mode is 5 or 7. See
|
|
||||||
-m.
|
|
||||||
|
|
||||||
|
|
||||||
-i Become interactive if possible. If calc_cmd args are given,
|
|
||||||
by default, calc will execute them and exit. This flag causes
|
|
||||||
calc to drop into interactive mode after the commands are
|
|
||||||
executed.
|
|
||||||
|
|
||||||
For example:
|
|
||||||
|
|
||||||
calc 2+5
|
|
||||||
|
|
||||||
will print the value 7 and exit whereas:
|
|
||||||
|
|
||||||
calc -i 2+5
|
|
||||||
|
|
||||||
will print the value 7 and prompt the user for more
|
|
||||||
calc commands.
|
|
||||||
|
|
||||||
|
|
||||||
-m mode
|
|
||||||
This flag sets the permission mode of calc. It
|
|
||||||
controls the ability for calc to open files and execute
|
|
||||||
programs. Mode may be a number from 0 to 7.
|
|
||||||
|
|
||||||
The mode value is interpreted in a way similar to that
|
|
||||||
of the chmod(1) octal mode:
|
|
||||||
|
|
||||||
0 do not open any file, do not execute progs
|
|
||||||
1 do not open any file
|
|
||||||
2 do not open files for reading, do not execute progs
|
|
||||||
3 do not open files for reading
|
|
||||||
4 do not open files for writing, do not execute progs
|
|
||||||
5 do not open files for writing
|
|
||||||
6 do not execute any program
|
|
||||||
7 allow everything (default mode)
|
|
||||||
|
|
||||||
If one wished to run calc from a privileged user, one
|
|
||||||
might want to use -m 0 in an effort to make calc
|
|
||||||
somewhat more secure.
|
|
||||||
|
|
||||||
Mode bits for reading and writing apply only on an
|
|
||||||
open. Files already open are not effected. Thus if
|
|
||||||
one wanted to use the -m 0 in an effort to make calc
|
|
||||||
somewhat more secure, but still wanted to read and
|
|
||||||
write a specific file, one might want to do in sh(1),
|
|
||||||
ksh(1), bash(1)-like shells:
|
|
||||||
|
|
||||||
calc -m 0 3<a.file
|
|
||||||
|
|
||||||
Files presented to calc in this way are opened in an
|
|
||||||
unknown mode. Calc will attempt to read or write them
|
|
||||||
if directed.
|
|
||||||
|
|
||||||
If the mode disables opening of files for reading, then
|
|
||||||
the startup resource files are disabled as if -q was
|
|
||||||
given. The reading of key bindings is also disabled
|
|
||||||
when the mode disables opening of files for reading.
|
|
||||||
|
|
||||||
|
|
||||||
-O Use the old classic defaults instead of the default
|
|
||||||
configuration. This flag as the same effect as executing
|
|
||||||
config("all", "oldcfg") at startup time.
|
|
||||||
|
|
||||||
NOTE: Older versions of calc used -n to setup a modified
|
|
||||||
form of the default calc configuration. The -n flag
|
|
||||||
currently does nothing. Use of the -n flag is now
|
|
||||||
deprecated and may used for something else in the future.
|
|
||||||
|
|
||||||
-p Pipe processing is enabled by use of -p. For example:
|
|
||||||
|
|
||||||
calc -p '2^21701-1' | fizzbin
|
|
||||||
|
|
||||||
In pipe mode, calc does not prompt, does not print
|
|
||||||
leading tabs and does not print the initial header.
|
|
||||||
The -p flag overrides -i.
|
|
||||||
|
|
||||||
|
|
||||||
-q Disable the reading of the startup scripts.
|
|
||||||
|
|
||||||
|
|
||||||
-s By default, all calc_cmd args are evaluated and
|
|
||||||
executed. This flag will disable their evaluation and
|
|
||||||
instead make them available as strings for the argv()
|
|
||||||
builtin function.
|
|
||||||
|
|
||||||
|
|
||||||
-u Disable buffering of stdin and stdout.
|
|
||||||
|
|
||||||
|
|
||||||
-v Print the calc version number and exit.
|
|
||||||
|
|
||||||
|
|
||||||
CALC COMMAND ARGUMENTS
|
|
||||||
|
|
||||||
With no calc_cmd arguments, calc operates interactively. If one
|
|
||||||
or more arguments are given on the command line and -s is NOT
|
|
||||||
given, then calc will read and execute them and either attempt
|
|
||||||
to go interactive according as the -i flag was present or absent.
|
|
||||||
|
|
||||||
If -s is given, calc will not evaluate any calc_cmd
|
|
||||||
arguments but instead make them available as strings to the
|
|
||||||
argv() builtin function.
|
|
||||||
|
|
||||||
Sufficiently simple commands with no no characters like
|
|
||||||
parentheses, brackets, semicolons, '*', which have special
|
|
||||||
interpretations in UNIX commands may be entered, possibly with
|
|
||||||
spaces, until the terminating newline. For example:
|
|
||||||
|
|
||||||
calc 23 + 47
|
|
||||||
|
|
||||||
should respond with display of 70, but:
|
|
||||||
|
|
||||||
calc 23 * 47
|
|
||||||
|
|
||||||
may fail. Such cases can usually be made to work as expected by
|
|
||||||
enclosing the command between single quotation marks as in:
|
|
||||||
|
|
||||||
calc '23 * 47'
|
|
||||||
|
|
||||||
and
|
|
||||||
|
|
||||||
calc 'print sqrt(2), exp(1)'
|
|
||||||
|
|
||||||
If '!' is to be used to indicate the factorial function, for
|
|
||||||
shells like csh for which '!' followed by a non-space character
|
|
||||||
is used for history substitution, it may be necessary to
|
|
||||||
include a space or use a backslash to escape the special
|
|
||||||
meaning of '!'. For example, the command "print 27!^2" may have
|
|
||||||
to be replaced by "print 27! ^2" or "print 27\!^2".
|
|
||||||
|
|
||||||
|
|
||||||
CALC STARTUP FILES
|
|
||||||
|
|
||||||
Normally on startup, if the environment variable $CALCRC is
|
|
||||||
undefined and calc is invoked without the -q flag, or if
|
|
||||||
$CALCRC is defined and calc is invoked with -e, calc looks
|
|
||||||
for a file "startup" in the calc resource directory, .calcrc in
|
|
||||||
the user's home directory, and .calcinit in the current directory.
|
|
||||||
If one or more of these are found, they are read in succession
|
|
||||||
as calc scripts and their commands executed. When defined,
|
|
||||||
$CALCRC is to contain a ':' separated list of names of files,
|
|
||||||
and if calc is then invoked without either the -q or -e flags,
|
|
||||||
these files are read in succession and their commands executed.
|
|
||||||
No error condition is produced if a listed file is not found.
|
|
||||||
|
|
||||||
If the mode specified by -m disables opening of files for
|
|
||||||
reading, then the reading of startup files is also disabled
|
|
||||||
as if -q was given.
|
|
||||||
|
|
||||||
|
|
||||||
CALC FILE SEARCH PATH
|
|
||||||
|
|
||||||
If the environment variable $CALCPATH is undefined, or if it
|
|
||||||
is defined and calc is invoked with the -e flag, when a file
|
|
||||||
name not beginning with /, ~ or ./, is specified as in:
|
|
||||||
|
|
||||||
calc read myfile
|
|
||||||
|
|
||||||
calc searches in succession:
|
|
||||||
|
|
||||||
./myfile
|
|
||||||
./myfile.cal
|
|
||||||
${LIBDIR}/myfile
|
|
||||||
${LIBDIR}/myfile.cal
|
|
||||||
${CUSTOMCALDIR}/myfile
|
|
||||||
${CUSTOMCALDIR}/myfile.cal
|
|
||||||
|
|
||||||
If the file is found, the search stops and the commands in
|
|
||||||
the file are executed. It is an error if no readable file
|
|
||||||
with the specified name is found. An alternative search
|
|
||||||
path can be specified by defining $CALCPATH in the same way
|
|
||||||
as PATH is defined, as a ':' separated list of directories,
|
|
||||||
and then invoking calc without the -e flag.
|
|
||||||
|
|
||||||
Calc treats all open files, other than stdin, stdout and
|
|
||||||
stderr as files available for reading and writing. One may
|
|
||||||
present calc with an already open file using sh(1), ksh(1),
|
|
||||||
bash(1)-like shells is to:
|
|
||||||
|
|
||||||
calc 3<open_file 4<open_file2
|
|
||||||
|
|
||||||
|
|
||||||
SHELL SCRIPT MODE
|
|
||||||
|
|
||||||
If first line of an executable file begins #! followed by the
|
|
||||||
absolute pathname of the calc program and the flag -S as in
|
|
||||||
|
|
||||||
#!/usr/local/bin/calc -S [other_flags]
|
|
||||||
|
|
||||||
the rest of the file will be processed in shell script mode.
|
|
||||||
Note that -S (UPPER CASE S) must be the first -flag on the
|
|
||||||
``#!'' line. Any optional ``other_flags'' must come after
|
|
||||||
the -S.
|
|
||||||
|
|
||||||
In shell script mode the contents of the file are read and
|
|
||||||
executed as if they were in a file being processed by a read
|
|
||||||
command, except that a "command" beginning with '#' followed by
|
|
||||||
whitespace and ending at the next newline is treated as a comment.
|
|
||||||
Any optional ``other_flags'' will be parsed first followed by
|
|
||||||
the later lines within the script itself.
|
|
||||||
|
|
||||||
In shell script mode, -s (lower case s) is always assumed.
|
|
||||||
In addition, -d and -p are automatically set if -i is not
|
|
||||||
given.
|
|
||||||
|
|
||||||
For example, if the file /tmp/mersenne:
|
|
||||||
|
|
||||||
#!/usr/local/bin/calc -S -q
|
|
||||||
#
|
|
||||||
# mersenne - an example of a calc shell script file
|
|
||||||
|
|
||||||
/* parse args */
|
|
||||||
if (argv() != 1) {
|
|
||||||
fprintf(files(2), "usage: %s exp\n", config("program"));
|
|
||||||
abort "must give one exponent arg";
|
|
||||||
}
|
|
||||||
|
|
||||||
/* print the mersenne number */
|
|
||||||
print "2^": argv(0) : "-1 =", 2^eval(argv(0))-1;
|
|
||||||
|
|
||||||
is made an executable file by:
|
|
||||||
|
|
||||||
chmod +x /tmp/mersenne
|
|
||||||
|
|
||||||
then the command line:
|
|
||||||
|
|
||||||
/tmp/mersenne 127
|
|
||||||
|
|
||||||
will print:
|
|
||||||
|
|
||||||
2^127-1 = 170141183460469231731687303715884105727
|
|
||||||
|
|
||||||
Note that because -s is assumed in shell script mode and
|
|
||||||
non-dashed args are made available as strings via the argv()
|
|
||||||
builtin function. Therefore:
|
|
||||||
|
|
||||||
2^eval(argv(0))-1
|
|
||||||
|
|
||||||
will print the decimal value of 2^n-1 but
|
|
||||||
|
|
||||||
2^argv(0)-1
|
|
||||||
|
|
||||||
will not.
|
|
||||||
|
|
||||||
For more information use the following calc commands:
|
|
||||||
|
|
||||||
help help
|
|
||||||
help overview
|
|
||||||
help config
|
|
||||||
help argv
|
|
||||||
help environment
|
|
||||||
|
|
||||||
## 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.8 $
|
|
||||||
## @(#) $Id: usage,v 29.8 2006/06/01 12:04:16 chongo Exp $
|
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/usage,v $
|
|
||||||
##
|
|
||||||
## Under source code control: 1991/07/21 04:37:25
|
|
||||||
## File existed as early as: 1991
|
|
||||||
##
|
|
||||||
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
|
||||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
|
61
help/usertime
Normal file
61
help/usertime
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
NAME
|
||||||
|
usertime - user CPU time used by the current process
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
usertime()
|
||||||
|
|
||||||
|
TYPES
|
||||||
|
return nonnegative real
|
||||||
|
|
||||||
|
DESCRIPTION
|
||||||
|
In POSIX based systems, this function will return the CPU seconds
|
||||||
|
used by the current process while in user mode. Time spent in the
|
||||||
|
kernel executing system calls is not included.
|
||||||
|
|
||||||
|
On non-POSIX based systems, this function will always return 0.
|
||||||
|
In particular, most MS windows based systems do not have the required
|
||||||
|
POSIX system call and so this function will always return 0.
|
||||||
|
|
||||||
|
EXAMPLE
|
||||||
|
The result for this example will depend on the speed of the CPU
|
||||||
|
and precision of the operating CPU time accounting sub-system:
|
||||||
|
|
||||||
|
; t = usertime();
|
||||||
|
; x = ptest(2^4253-1);
|
||||||
|
; usertime() - t;
|
||||||
|
1.287804
|
||||||
|
|
||||||
|
LIMITS
|
||||||
|
On non-POSIX based systems, this function always returns 0.
|
||||||
|
|
||||||
|
LINK LIBRARY
|
||||||
|
none
|
||||||
|
|
||||||
|
SEE ALSO
|
||||||
|
config, ctime, usertime, systime, time
|
||||||
|
|
||||||
|
## Copyright (C) 2006 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: usertime,v 29.2 2006/12/16 10:50:19 chongo Exp $
|
||||||
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/usertime,v $
|
||||||
|
##
|
||||||
|
## Under source code control: 2006/12/16 10:31:08
|
||||||
|
## File existed as early as: 2006
|
||||||
|
##
|
||||||
|
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||||
|
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
24
input.c
24
input.c
@@ -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.11 $
|
* @(#) $Revision: 29.12 $
|
||||||
* @(#) $Id: input.c,v 29.11 2006/05/19 15:26:10 chongo Exp $
|
* @(#) $Id: input.c,v 29.12 2006/12/15 17:02:49 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/input.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/input.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:48:16
|
* Under source code control: 1990/02/15 01:48:16
|
||||||
@@ -961,9 +961,6 @@ static int
|
|||||||
isinoderead(struct stat *sbuf)
|
isinoderead(struct stat *sbuf)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
#if defined(_WIN32) || defined(__MSDOS__)
|
|
||||||
char fullpathname[_MAX_PATH];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* deal with the empty case */
|
/* deal with the empty case */
|
||||||
if (readset == NULL || maxreadset <= 0) {
|
if (readset == NULL || maxreadset <= 0) {
|
||||||
@@ -974,13 +971,17 @@ isinoderead(struct stat *sbuf)
|
|||||||
/* scan the entire readset */
|
/* scan the entire readset */
|
||||||
for (i=0; i < maxreadset; ++i) {
|
for (i=0; i < maxreadset; ++i) {
|
||||||
#if defined(_WIN32) || defined(__MSDOS__)
|
#if defined(_WIN32) || defined(__MSDOS__)
|
||||||
|
tmp = _fullpath(NULL, cip->i_name, _MAX_PATH);
|
||||||
if (readset[i].active &&
|
if (readset[i].active &&
|
||||||
strcasecmp(readset[i].path,
|
tmp != NULL &&
|
||||||
_fullpath(fullpathname,cip->i_name,
|
strcasecmp(readset[i].path, tmp) == 0) {
|
||||||
_MAX_PATH)) == 0) {
|
|
||||||
/* found a match */
|
/* found a match */
|
||||||
|
free(tmp);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
if (tmp != NULL) {
|
||||||
|
free(tmp);
|
||||||
|
}
|
||||||
#else /* Windoz free systems */
|
#else /* Windoz free systems */
|
||||||
if (readset[i].active &&
|
if (readset[i].active &&
|
||||||
sbuf->st_dev == readset[i].inode.st_dev &&
|
sbuf->st_dev == readset[i].inode.st_dev &&
|
||||||
@@ -1106,9 +1107,10 @@ addreadset(char *name, char *path, struct stat *sbuf)
|
|||||||
* this new longer path name.
|
* this new longer path name.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
char fullpathname[_MAX_PATH];
|
readset[ret].path = _fullpath(NULL, path, _MAX_PATH);
|
||||||
|
if (readset[ret].path == NULL) {
|
||||||
readset[ret].path = _fullpath(fullpathname, path, _MAX_PATH);
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else /* Windoz free systems */
|
#else /* Windoz free systems */
|
||||||
path_len = strlen(path);
|
path_len = strlen(path);
|
||||||
|
49
qmath.c
49
qmath.c
@@ -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: qmath.c,v 29.6 2006/05/20 08:43:55 chongo Exp $
|
* @(#) $Id: qmath.c,v 29.7 2006/12/15 16:18:10 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qmath.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qmath.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:48:21
|
* Under source code control: 1990/02/15 01:48:21
|
||||||
@@ -140,6 +140,25 @@ qtou(NUMBER *q)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convert a number to a normal signed integer.
|
||||||
|
* s = qtos(q);
|
||||||
|
*/
|
||||||
|
SFULL
|
||||||
|
qtos(NUMBER *q)
|
||||||
|
{
|
||||||
|
SFULL i;
|
||||||
|
ZVALUE res;
|
||||||
|
|
||||||
|
if (qisint(q))
|
||||||
|
return ztos(q->num);
|
||||||
|
zquo(q->num, q->den, &res, 0);
|
||||||
|
i = ztos(res);
|
||||||
|
zfree(res);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert a normal unsigned integer into a number.
|
* Convert a normal unsigned integer into a number.
|
||||||
* q = utoq(i);
|
* q = utoq(i);
|
||||||
@@ -166,6 +185,32 @@ utoq(FULL i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convert a normal signed integer into a number.
|
||||||
|
* q = stoq(s);
|
||||||
|
*/
|
||||||
|
NUMBER *
|
||||||
|
stoq(SFULL i)
|
||||||
|
{
|
||||||
|
register NUMBER *q;
|
||||||
|
|
||||||
|
if (i <= 10) {
|
||||||
|
switch ((int) i) {
|
||||||
|
case 0: q = &_qzero_; break;
|
||||||
|
case 1: q = &_qone_; break;
|
||||||
|
case 2: q = &_qtwo_; break;
|
||||||
|
case 10: q = &_qten_; break;
|
||||||
|
default: q = NULL;
|
||||||
|
}
|
||||||
|
if (q)
|
||||||
|
return qlink(q);
|
||||||
|
}
|
||||||
|
q = qalloc();
|
||||||
|
stoz(i, &q->num);
|
||||||
|
return q;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create a number from the given FULL numerator and denominator.
|
* Create a number from the given FULL numerator and denominator.
|
||||||
* q = uutoq(inum, iden);
|
* q = uutoq(inum, iden);
|
||||||
|
6
qmath.h
6
qmath.h
@@ -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.7 $
|
* @(#) $Revision: 29.8 $
|
||||||
* @(#) $Id: qmath.h,v 29.7 2006/06/25 20:33:26 chongo Exp $
|
* @(#) $Id: qmath.h,v 29.8 2006/12/15 16:18:10 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qmath.h,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qmath.h,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1993/07/30 19:42:47
|
* Under source code control: 1993/07/30 19:42:47
|
||||||
@@ -65,8 +65,10 @@ extern NUMBER *iitoq(long i1, long i2);
|
|||||||
extern NUMBER *str2q(char *str);
|
extern NUMBER *str2q(char *str);
|
||||||
extern NUMBER *itoq(long i);
|
extern NUMBER *itoq(long i);
|
||||||
extern NUMBER *utoq(FULL i);
|
extern NUMBER *utoq(FULL i);
|
||||||
|
extern NUMBER *stoq(SFULL i);
|
||||||
extern long qtoi(NUMBER *q);
|
extern long qtoi(NUMBER *q);
|
||||||
extern FULL qtou(NUMBER *q);
|
extern FULL qtou(NUMBER *q);
|
||||||
|
extern SFULL qtos(NUMBER *q);
|
||||||
extern long qparse(char *str, int flags);
|
extern long qparse(char *str, int flags);
|
||||||
extern void qfreenum(NUMBER *q);
|
extern void qfreenum(NUMBER *q);
|
||||||
extern void qprintnum(NUMBER *q, int mode);
|
extern void qprintnum(NUMBER *q, int mode);
|
||||||
|
93
rpm.mk
93
rpm.mk
@@ -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.
|
||||||
#
|
#
|
||||||
MAKEFILE_REV= $$Revision: 29.14 $$
|
MAKEFILE_REV= $$Revision: 29.16 $$
|
||||||
# @(#) $Id: rpm.mk,v 29.14 2006/08/20 16:47:51 chongo Exp $
|
# @(#) $Id: rpm.mk,v 29.16 2006/09/18 06:33:50 chongo Exp $
|
||||||
# @(#) $Source: /usr/local/src/cmd/calc/RCS/rpm.mk,v $
|
# @(#) $Source: /usr/local/src/cmd/calc/RCS/rpm.mk,v $
|
||||||
#
|
#
|
||||||
# Under source code control: 2003/02/16 20:21:39
|
# Under source code control: 2003/02/16 20:21:39
|
||||||
@@ -42,6 +42,16 @@ RPM_TOOL= rpm
|
|||||||
MD5SUM= md5sum
|
MD5SUM= md5sum
|
||||||
SHA1SUM= sha1sum
|
SHA1SUM= sha1sum
|
||||||
SED= sed
|
SED= sed
|
||||||
|
FIND= find
|
||||||
|
GZIP_PROG= gzip
|
||||||
|
TAR= tar
|
||||||
|
RM= rm
|
||||||
|
LS= ls
|
||||||
|
CPIO= cpio
|
||||||
|
CP= cp
|
||||||
|
EGREP= egrep
|
||||||
|
MKDIR= mkdir
|
||||||
|
GREP= GREP
|
||||||
|
|
||||||
# rpm-related parameters
|
# rpm-related parameters
|
||||||
#
|
#
|
||||||
@@ -50,7 +60,7 @@ PROJECT_VERSION=
|
|||||||
PROJECT_RELEASE=
|
PROJECT_RELEASE=
|
||||||
PROJECT= $(PROJECT_NAME)-$(PROJECT_VERSION)
|
PROJECT= $(PROJECT_NAME)-$(PROJECT_VERSION)
|
||||||
SPECFILE= $(PROJECT_NAME).spec
|
SPECFILE= $(PROJECT_NAME).spec
|
||||||
TARBALL= $(PROJECT).tar.gz
|
TARBALL= $(PROJECT).${TAR}.gz
|
||||||
RPM686= $(PROJECT)-$(PROJECT_RELEASE).${TARCH}.rpm
|
RPM686= $(PROJECT)-$(PROJECT_RELEASE).${TARCH}.rpm
|
||||||
DRPM686= $(PROJECT_NAME)-devel-$(PROJECT_VERSION)-$(PROJECT_RELEASE).${TARCH}.rpm
|
DRPM686= $(PROJECT_NAME)-devel-$(PROJECT_VERSION)-$(PROJECT_RELEASE).${TARCH}.rpm
|
||||||
SRPM= $(PROJECT)-$(PROJECT_RELEASE).src.rpm
|
SRPM= $(PROJECT)-$(PROJECT_RELEASE).src.rpm
|
||||||
@@ -62,7 +72,7 @@ all: calc.spec ver_calc
|
|||||||
PROJECT_RELEASE="`${SED} -n -e '/^Release:/s/^Release: *//p' \
|
PROJECT_RELEASE="`${SED} -n -e '/^Release:/s/^Release: *//p' \
|
||||||
calc.spec.in`" rpm
|
calc.spec.in`" rpm
|
||||||
|
|
||||||
pkgme: $(PROJECT_NAME)-spec.tar.gz
|
pkgme: $(PROJECT_NAME)-spec.${TAR}.gz
|
||||||
|
|
||||||
ver_calc:
|
ver_calc:
|
||||||
$(MAKE) -f Makefile ver_calc
|
$(MAKE) -f Makefile ver_calc
|
||||||
@@ -72,26 +82,26 @@ vers:
|
|||||||
$(MAKE) -f Makefile ver_calc
|
$(MAKE) -f Makefile ver_calc
|
||||||
|
|
||||||
calc.spec: calc.spec.in ver_calc
|
calc.spec: calc.spec.in ver_calc
|
||||||
rm -f calc.spec
|
${RM} -f calc.spec
|
||||||
${SED} -e 's/<<<PROJECT_VERSION>>>/'"`./ver_calc`"/g \
|
${SED} -e 's/<<<PROJECT_VERSION>>>/'"`./ver_calc`"/g \
|
||||||
calc.spec.in > calc.spec
|
calc.spec.in > calc.spec
|
||||||
|
|
||||||
.PHONY: srcpkg
|
.PHONY: srcpkg
|
||||||
srcpkg: make_rhdir
|
srcpkg: make_rhdir
|
||||||
find . -depth -print | egrep -v '/RCS|/CVS|/NOTES|\.gone' | \
|
${FIND} . -depth -print | ${EGREP} -v '/RCS|/CVS|/NOTES|\.gone' | \
|
||||||
cpio -dumpv $(TMPDIR)/$(PROJECT)
|
${CPIO} -dumpv "$(TMPDIR)/$(PROJECT)"
|
||||||
(cd $(TMPDIR); tar cf - $(PROJECT)) | \
|
(cd "$(TMPDIR)"; ${TAR} cf - "$(PROJECT)") | \
|
||||||
gzip -c > $(RPMDIR)/SOURCES/$(TARBALL)
|
${GZIP_PROG} -c > "$(RPMDIR)/SOURCES/$(TARBALL)"
|
||||||
rm -fr $(TMPDIR)/$(PROJECT)
|
${RM} -fr "$(TMPDIR)/$(PROJECT)"
|
||||||
|
|
||||||
.PHONY: rpm
|
.PHONY: rpm
|
||||||
rpm: srcpkg calc.spec
|
rpm: srcpkg calc.spec
|
||||||
$(MAKE) -f Makefile clean
|
$(MAKE) -f Makefile clean
|
||||||
cp $(SPECFILE) $(RPMDIR)/SPECS/$(SPECFILE)
|
${CP} "$(SPECFILE)" "$(RPMDIR)/SPECS/$(SPECFILE)"
|
||||||
rm -f $(RPMDIR)/RPMS/${TARCH}/$(RPM686)
|
${RM} -f "$(RPMDIR)/RPMS/${TARCH}/$(RPM686)"
|
||||||
rm -f $(RPMDIR)/RPMS/${TARCH}/$(DRPM686)
|
${RM} -f "$(RPMDIR)/RPMS/${TARCH}/$(DRPM686)"
|
||||||
rm -f $(RPMDIR)/SRPMS/$(SRPM)
|
${RM} -f "$(RPMDIR)/SRPMS/$(SRPM)"
|
||||||
${RPMBUILD_TOOL} ${RPMBUILD_OPTION} $(RPMDIR)/SPECS/$(SPECFILE)
|
${RPMBUILD_TOOL} ${RPMBUILD_OPTION} "$(RPMDIR)/SPECS/$(SPECFILE)"
|
||||||
@if [ ! -f "$(RPMDIR)/SRPMS/$(SRPM)" ]; then \
|
@if [ ! -f "$(RPMDIR)/SRPMS/$(SRPM)" ]; then \
|
||||||
echo "SRPMS/$(SRPM) not found" 1>&2; \
|
echo "SRPMS/$(SRPM) not found" 1>&2; \
|
||||||
exit 3; \
|
exit 3; \
|
||||||
@@ -99,33 +109,33 @@ rpm: srcpkg calc.spec
|
|||||||
@echo
|
@echo
|
||||||
@echo "RPM package sizes:"
|
@echo "RPM package sizes:"
|
||||||
@echo
|
@echo
|
||||||
@cd $(RPMDIR); ls -1s RPMS/${TARCH}/$(RPM686) \
|
@cd $(RPMDIR); ${LS} -1s "RPMS/${TARCH}/$(RPM686)" \
|
||||||
RPMS/${TARCH}/$(DRPM686) SRPMS/$(SRPM)
|
"RPMS/${TARCH}/$(DRPM686)" "SRPMS/$(SRPM)"
|
||||||
@echo
|
@echo
|
||||||
@echo "RPM package md5 hashes:"
|
@echo "RPM package md5 hashes:"
|
||||||
@echo
|
@echo
|
||||||
-@cd $(RPMDIR); ${MD5SUM} RPMS/${TARCH}/$(RPM686) \
|
-@cd $(RPMDIR); ${MD5SUM} "RPMS/${TARCH}/$(RPM686)" \
|
||||||
RPMS/${TARCH}/$(DRPM686) SRPMS/$(SRPM)
|
"RPMS/${TARCH}/$(DRPM686)" "SRPMS/$(SRPM)"
|
||||||
@echo
|
@echo
|
||||||
@echo "RPM package sha1 hashes:"
|
@echo "RPM package sha1 hashes:"
|
||||||
@echo
|
@echo
|
||||||
-@cd $(RPMDIR); ${SHA1SUM} RPMS/${TARCH}/$(RPM686) \
|
-@cd $(RPMDIR); ${SHA1SUM} "RPMS/${TARCH}/$(RPM686)" \
|
||||||
RPMS/${TARCH}/$(DRPM686) SRPMS/$(SRPM)
|
"RPMS/${TARCH}/$(DRPM686)" "SRPMS/$(SRPM)"
|
||||||
@echo
|
@echo
|
||||||
@echo "RPM package locations:"
|
@echo "RPM package locations:"
|
||||||
@echo
|
@echo
|
||||||
@ls -1 $(RPMDIR)/RPMS/${TARCH}/$(RPM686) \
|
@${LS} -1 "$(RPMDIR)/RPMS/${TARCH}/$(RPM686)" \
|
||||||
$(RPMDIR)/RPMS/${TARCH}/$(DRPM686) $(RPMDIR)/SRPMS/$(SRPM)
|
"$(RPMDIR)/RPMS/${TARCH}/$(DRPM686)" "$(RPMDIR)/SRPMS/$(SRPM)"
|
||||||
@echo
|
@echo
|
||||||
@echo "All done! -- Jessica Noll, Age 2"
|
@echo "All done! -- Jessica Noll, Age 2"
|
||||||
@echo
|
@echo
|
||||||
|
|
||||||
.PHONY: make_rhdir
|
.PHONY: make_rhdir
|
||||||
make_rhdir:
|
make_rhdir:
|
||||||
for i in $(RPMDIR) $(RPMDIR)/RPMS $(RPMDIR)/SOURCES \
|
for i in "$(RPMDIR)" "$(RPMDIR)/RPMS" "$(RPMDIR)/SOURCES" \
|
||||||
$(RPMDIR)/SPECS $(RPMDIR)/SRPMS $(RPMDIR)/BUILD; do \
|
"$(RPMDIR)/SPECS" "$(RPMDIR)/SRPMS" "$(RPMDIR)/BUILD"; do \
|
||||||
if [ ! -d $$i ] ; then \
|
if [ ! -d "$$i" ] ; then \
|
||||||
mkdir -p $$i; \
|
${MKDIR} -p "$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
done;
|
done;
|
||||||
|
|
||||||
@@ -136,20 +146,20 @@ logdate:
|
|||||||
|
|
||||||
.PHONY: chkpkg
|
.PHONY: chkpkg
|
||||||
chkpkg:
|
chkpkg:
|
||||||
for i in $(RPMDIR)/RPMS/${TARCH}/$(RPM686) \
|
for i in "$(RPMDIR)/RPMS/${TARCH}/$(RPM686)" \
|
||||||
$(RPMDIR)/RPMS/${TARCH}/$(DRPM686) \
|
"$(RPMDIR)/RPMS/${TARCH}/$(DRPM686)" \
|
||||||
$(RPMDIR)/SRPMS/$(SRPM) ; do \
|
"$(RPMDIR)/SRPMS/$(SRPM)" ; do \
|
||||||
echo "***** start $$i" ; \
|
echo "***** start $$i" ; \
|
||||||
${RPM_TOOL} -qpi $$i ; \
|
${RPM_TOOL} -qpi "$$"i ; \
|
||||||
echo "***** files $$i" ; \
|
echo "***** files $$i" ; \
|
||||||
${RPM_TOOL} -qpl $$i ; \
|
${RPM_TOOL} -qpl "$$i" ; \
|
||||||
echo "***** end $$i" ; \
|
echo "***** end $$i" ; \
|
||||||
done ;
|
done ;
|
||||||
|
|
||||||
.PHONY: chksys
|
.PHONY: chksys
|
||||||
chksys:
|
chksys:
|
||||||
${RPM_TOOL} -qa | grep $(PROJECT_NAME)
|
${RPM_TOOL} -qa | ${GREP} "$(PROJECT_NAME)"
|
||||||
${RPM_TOOL} -qa | grep $(PROJECT_NAME)-devel
|
${RPM_TOOL} -qa | ${GREP} "$(PROJECT_NAME)-devel"
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: ver_calc
|
test: ver_calc
|
||||||
@@ -165,8 +175,8 @@ installrpm:
|
|||||||
echo "must be root to install RPMs" 1>&2; \
|
echo "must be root to install RPMs" 1>&2; \
|
||||||
exit 5; \
|
exit 5; \
|
||||||
fi
|
fi
|
||||||
${RPM_TOOL} -ivh $(RPMDIR)/RPMS/${TARCH}/$(RPM686)
|
${RPM_TOOL} -ivh "$(RPMDIR)/RPMS/${TARCH}/$(RPM686)"
|
||||||
${RPM_TOOL} -ivh $(RPMDIR)/RPMS/${TARCH}/$(DRPM686)
|
${RPM_TOOL} -ivh "$(RPMDIR)/RPMS/${TARCH}/$(DRPM686)"
|
||||||
|
|
||||||
.PHONY: uninstallrpm
|
.PHONY: uninstallrpm
|
||||||
uninstallrpm:
|
uninstallrpm:
|
||||||
@@ -174,10 +184,11 @@ uninstallrpm:
|
|||||||
echo "must be root to uninstall RPMs" 1>&2; \
|
echo "must be root to uninstall RPMs" 1>&2; \
|
||||||
exit 6; \
|
exit 6; \
|
||||||
fi
|
fi
|
||||||
${RPM_TOOL} -e $(PROJECT_NAME)-devel
|
${RPM_TOOL} -e "$(PROJECT_NAME)-devel"
|
||||||
${RPM_TOOL} -e $(PROJECT_NAME)
|
${RPM_TOOL} -e "$(PROJECT_NAME)"
|
||||||
|
|
||||||
$(PROJECT_NAME)-spec.tar.gz: rpm.mk $(PROJECT_NAME).spec.in
|
$(PROJECT_NAME)-spec.${TAR}.gz: rpm.mk $(PROJECT_NAME).spec.in
|
||||||
tar cf - $^ | gzip -c > $@
|
${RM} -f "$@"
|
||||||
|
${TAR} cf - "$^" | ${GZIP_PROG} -c > "$@"
|
||||||
|
|
||||||
#****
|
#****
|
||||||
|
173
sample/Makefile
173
sample/Makefile
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# sample - makefile for calc sample programs
|
# sample - makefile for calc sample programs
|
||||||
#
|
#
|
||||||
# Copyright (C) 1999 Landon Curt Noll
|
# Copyright (C) 1999-2006 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
|
||||||
@@ -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.18 $
|
# @(#) $Revision: 29.23 $
|
||||||
# @(#) $Id: Makefile,v 29.18 2006/06/26 05:46:06 chongo Exp $
|
# @(#) $Id: Makefile,v 29.23 2006/09/18 13:13:25 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
|
||||||
@@ -35,7 +35,6 @@
|
|||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
# Any .h files that are needed by programs that use libcustcalc.a
|
# Any .h files that are needed by programs that use libcustcalc.a
|
||||||
# Don't put ${REQUIRED_H_SRC} files in this list.
|
|
||||||
#
|
#
|
||||||
# Put any .h files that you add which might be useful to other
|
# Put any .h files that you add which might be useful to other
|
||||||
# programs here.
|
# programs here.
|
||||||
@@ -43,7 +42,6 @@
|
|||||||
SAMPLE_H_SRC=
|
SAMPLE_H_SRC=
|
||||||
|
|
||||||
# Any .c files that are needed to build libcustcalc.a.
|
# Any .c files that are needed to build libcustcalc.a.
|
||||||
# Don't put ${REQUIRED_SRC} files in this list.
|
|
||||||
#
|
#
|
||||||
# There MUST be a .c in SAMPLE_SRC for every .o in SAMPLE_OBJ.
|
# There MUST be a .c in SAMPLE_SRC for every .o in SAMPLE_OBJ.
|
||||||
#
|
#
|
||||||
@@ -52,7 +50,6 @@ SAMPLE_H_SRC=
|
|||||||
SAMPLE_SRC= many_random.c test_random.c
|
SAMPLE_SRC= many_random.c test_random.c
|
||||||
|
|
||||||
# Any .o files that are needed by program that use libcustcalc.a.
|
# Any .o files that are needed by program that use libcustcalc.a.
|
||||||
# Don't put ${REQUIRED_OBJ} files in this list.
|
|
||||||
#
|
#
|
||||||
# There MUST be a .c in SAMPLE_SRC for every .o in SAMPLE_OBJ.
|
# There MUST be a .c in SAMPLE_SRC for every .o in SAMPLE_OBJ.
|
||||||
#
|
#
|
||||||
@@ -101,9 +98,9 @@ INCDIR= /usr/include
|
|||||||
# ${LIBDIR} where calc link library (*.a) files are installed
|
# ${LIBDIR} where calc link library (*.a) files are installed
|
||||||
# ${CALC_SHAREDIR} where to install calc help, .cal, startup, config files
|
# ${CALC_SHAREDIR} where to install calc help, .cal, startup, config files
|
||||||
#
|
#
|
||||||
# NOTE: The install rule prepends installation paths with $T, which
|
# NOTE: The install rule prepends installation paths with ${T}, which
|
||||||
# by default is empty. If $T is non-empty, then installation
|
# by default is empty. If ${T} is non-empty, then installation
|
||||||
# locations will be relative to the $T directory.
|
# locations will be relative to the ${T} directory.
|
||||||
#
|
#
|
||||||
# For DJGPP, select:
|
# For DJGPP, select:
|
||||||
#
|
#
|
||||||
@@ -135,12 +132,12 @@ CALC_SHAREDIR= /usr/share/calc
|
|||||||
# ${CALC_INCDIR} where the calc include files are installed
|
# ${CALC_INCDIR} where the calc include files are installed
|
||||||
# ${CUSTOMCALDIR} where custom *.cal files are installed
|
# ${CUSTOMCALDIR} where custom *.cal files are installed
|
||||||
# ${CUSTOMHELPDIR} where custom help files are installed
|
# ${CUSTOMHELPDIR} where custom help files are installed
|
||||||
# ${CUSTOMINCPDIR} where custom .h files are installed
|
# ${CUSTOMINCDIR} where custom .h files are installed
|
||||||
# ${SCRIPTDIR} where calc shell scripts are installed
|
# ${SCRIPTDIR} where calc shell scripts are installed
|
||||||
#
|
#
|
||||||
# NOTE: The install rule prepends installation paths with $T, which
|
# NOTE: The install rule prepends installation paths with ${T}, which
|
||||||
# by default is empty. If $T is non-empty, then installation
|
# by default is empty. If ${T} is non-empty, then installation
|
||||||
# locations will be relative to the $T directory.
|
# locations will be relative to the ${T} directory.
|
||||||
#
|
#
|
||||||
# If in doubt, set:
|
# If in doubt, set:
|
||||||
#
|
#
|
||||||
@@ -160,8 +157,8 @@ SCRIPTDIR= ${BINDIR}/cscript
|
|||||||
|
|
||||||
# T - top level directory under which calc will be installed
|
# T - top level directory under which calc will be installed
|
||||||
#
|
#
|
||||||
# The calc install is performed under $T, the calc build is
|
# The calc install is performed under ${T}, the calc build is
|
||||||
# performed under /. The purpose for $T is to allow someone
|
# performed under /. The purpose for ${T} is to allow someone
|
||||||
# to install calc somewhere other than into the system area.
|
# to install calc somewhere other than into the system area.
|
||||||
#
|
#
|
||||||
# For example, if:
|
# For example, if:
|
||||||
@@ -181,10 +178,10 @@ SCRIPTDIR= ${BINDIR}/cscript
|
|||||||
# calc help, .cal ...: /var/tmp/testing/usr/share/calc
|
# calc help, .cal ...: /var/tmp/testing/usr/share/calc
|
||||||
# ... etc ... /var/tmp/testing/...
|
# ... etc ... /var/tmp/testing/...
|
||||||
#
|
#
|
||||||
# If $T is empty, calc is installed under /, which is the same
|
# If ${T} is empty, calc is installed under /, which is the same
|
||||||
# top of tree for which it was built. If $T is non-empty, then
|
# top of tree for which it was built. If ${T} is non-empty, then
|
||||||
# calc is installed under $T, as if one had to chroot under
|
# calc is installed under ${T}, as if one had to chroot under
|
||||||
# $T for calc to operate.
|
# ${T} for calc to operate.
|
||||||
#
|
#
|
||||||
# If in doubt, use T=
|
# If in doubt, use T=
|
||||||
#
|
#
|
||||||
@@ -236,6 +233,20 @@ NO_SHARED=
|
|||||||
#NO_SHARED= -dn
|
#NO_SHARED= -dn
|
||||||
#NO_SHARED= -non_shared
|
#NO_SHARED= -non_shared
|
||||||
|
|
||||||
|
# On some systems where you are disabling dynamic shared link libs, you may
|
||||||
|
# need to pass a special flag to ${CC} and ${LCC} during linking stage.
|
||||||
|
#
|
||||||
|
# System type NO_SHARED recommendation
|
||||||
|
#
|
||||||
|
# IRIX with NO_SHARED= -non_shared LD_NO_SHARED= -Wl,-rdata_shared
|
||||||
|
# IRIX with NO_SHARED= LD_NO_SHARED=
|
||||||
|
# others LD_NO_SHARED=
|
||||||
|
#
|
||||||
|
# If in doubt, use LD_NO_SHARED=
|
||||||
|
#
|
||||||
|
LD_NO_SHARED=
|
||||||
|
#LD_NO_SHARED= -Wl,-rdata_shared
|
||||||
|
|
||||||
# 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.
|
||||||
#
|
#
|
||||||
@@ -262,12 +273,22 @@ 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.
|
||||||
#
|
#
|
||||||
# If you do not wish to use purify, leave PURIFY commented out.
|
# If you do not wish to use purify, set PURIFY to an empty string.
|
||||||
#
|
#
|
||||||
# If in doubt, leave PURIFY commented out.
|
# If in doubt, use PURIFY=
|
||||||
#
|
#
|
||||||
#PURIFY= purify -logfile=pure.out
|
#PURIFY= purify -logfile=pure.out
|
||||||
#PURIFY= purify
|
#PURIFY= purify
|
||||||
|
PURIFY=
|
||||||
|
|
||||||
|
# If you want to use a debugging link library such as a malloc debug link
|
||||||
|
# library, or need to add special ld flags after the calc link libraries
|
||||||
|
# are included, set ${LD_DEBUG} below.
|
||||||
|
#
|
||||||
|
# If in doubt, set LD_DEBUG to empty.
|
||||||
|
#
|
||||||
|
#LD_DEBUG= -lmalloc_cv
|
||||||
|
LD_DEBUG=
|
||||||
|
|
||||||
# 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.
|
||||||
@@ -364,7 +385,7 @@ CALCLIBLIST= ${C_SRC} ${H_SRC} ${MAKE_FILE} README_SAMPLE
|
|||||||
|
|
||||||
# complete list of targets
|
# complete list of targets
|
||||||
#
|
#
|
||||||
# NOTE: This list MUST be co-ordinated with the ${SAMPLE_TARGETS} variable
|
# NOTE: This list MUST be coordinated with the ${SAMPLE_TARGETS} variable
|
||||||
# in the upper level ../Makefile
|
# in the upper level ../Makefile
|
||||||
#
|
#
|
||||||
SAMPLE_TARGETS= many_random test_random
|
SAMPLE_TARGETS= many_random test_random
|
||||||
@@ -381,6 +402,12 @@ MAKEDEPEND= makedepend
|
|||||||
CHMOD= chmod
|
CHMOD= chmod
|
||||||
SORT= sort
|
SORT= sort
|
||||||
CMP= cmp
|
CMP= cmp
|
||||||
|
TRUE= true
|
||||||
|
RM= rm
|
||||||
|
TOUCH= touch
|
||||||
|
MKDIR= mkdir
|
||||||
|
MV= mv
|
||||||
|
CO= co
|
||||||
|
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
@@ -389,7 +416,7 @@ CMP= cmp
|
|||||||
##
|
##
|
||||||
|
|
||||||
all: ${TARGETS} .all
|
all: ${TARGETS} .all
|
||||||
@true
|
@${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
|
||||||
@@ -412,8 +439,8 @@ many_random: many_random.o ../libcalc.a
|
|||||||
# to determine of we have done all
|
# to determine of we have done all
|
||||||
#
|
#
|
||||||
.all:
|
.all:
|
||||||
rm -f .all
|
${RM} -f .all
|
||||||
touch .all
|
${TOUCH} .all
|
||||||
|
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
@@ -429,17 +456,17 @@ many_random: many_random.o ../libcalc.a
|
|||||||
##
|
##
|
||||||
|
|
||||||
distlist: ${DISTLIST}
|
distlist: ${DISTLIST}
|
||||||
${Q}for i in ${DISTLIST} /dev/null; do \
|
${Q} for i in ${DISTLIST} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo sample/$$i; \
|
echo sample/$$i; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
distdir:
|
distdir:
|
||||||
${Q}echo sample
|
${Q} echo sample
|
||||||
|
|
||||||
calcliblist:
|
calcliblist:
|
||||||
${Q}for i in ${CALCLIBLIST} /dev/null; do \
|
${Q} for i in ${CALCLIBLIST} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo sample/$$i; \
|
echo sample/$$i; \
|
||||||
fi; \
|
fi; \
|
||||||
@@ -458,23 +485,23 @@ calcliblist:
|
|||||||
##
|
##
|
||||||
|
|
||||||
depend:
|
depend:
|
||||||
${Q}if [ -f Makefile.bak ]; then \
|
${Q} if [ -f Makefile.bak ]; then \
|
||||||
echo "Makefile.bak exists, remove or move it out of the way"; \
|
echo "Makefile.bak exists, remove or move it out of the way"; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
else \
|
else \
|
||||||
true; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
${Q}echo forming sample/skel
|
${Q} echo forming sample/skel
|
||||||
-${Q}rm -rf skel
|
-${Q} ${RM} -rf skel
|
||||||
${Q}mkdir skel
|
${Q} ${MKDIR} skel
|
||||||
${Q}mkdir skel/sample
|
${Q} ${MKDIR} skel/sample
|
||||||
-${Q}for i in ${C_SRC} /dev/null; do \
|
-${Q} for i in ${C_SRC} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
${SED} -n '/^#[ ]*include[ ]*"/p' \
|
${SED} -n '/^#[ ]*include[ ]*"/p' \
|
||||||
"$$i" > "skel/sample/$$i"; \
|
"$$i" > "skel/sample/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
-${Q}for i in ${H_SRC} /dev/null; do \
|
-${Q} for i in ${H_SRC} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
||||||
@@ -486,11 +513,11 @@ depend:
|
|||||||
fi; \
|
fi; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
${Q}(cd ..; ${MAKE} hsrc)
|
${Q} (cd ..; $(MAKE) hsrc)
|
||||||
${Q}for i in `cd ..; ${MAKE} h_list 2>&1 | \
|
${Q} for i in `cd ..; $(MAKE) h_list 2>&1 | \
|
||||||
${SED} -e '/Entering directory/d' \
|
${SED} -e '/Entering directory/d' \
|
||||||
-e '/Nothing to be done/d' \
|
-e '/Nothing to be done/d' \
|
||||||
-e '/Leaving directory/d'` /dev/null; do \
|
-e '/Leaving directory/d'` /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
||||||
echo "#if !defined($$tag)" > "skel/$$i"; \
|
echo "#if !defined($$tag)" > "skel/$$i"; \
|
||||||
@@ -500,39 +527,39 @@ depend:
|
|||||||
echo '#endif /* '"$$tag"' */' >> "skel/$$i"; \
|
echo '#endif /* '"$$tag"' */' >> "skel/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
-${Q}rm -f skel/sample/makedep.out
|
-${Q} ${RM} -f skel/sample/makedep.out
|
||||||
${Q}echo sample/skel formed
|
${Q} echo sample/skel formed
|
||||||
${Q}echo forming sample dependency list
|
${Q} echo forming sample dependency list
|
||||||
${Q}echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > \
|
${Q} echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > \
|
||||||
skel/sample/makedep.out
|
skel/sample/makedep.out
|
||||||
${Q}cd skel/sample; ${MAKEDEPEND} -w 1 -f makedep.out -I.. ${C_SRC}
|
${Q} cd skel/sample; ${MAKEDEPEND} -w 1 -f makedep.out -I.. ${C_SRC}
|
||||||
-${Q}for i in ${C_SRC} /dev/null; do \
|
-${Q} for i in ${C_SRC} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo "$$i" | ${SED} 's/^\(.*\)\.c/\1.o: \1.c/'; \
|
echo "$$i" | ${SED} 's/^\(.*\)\.c/\1.o: \1.c/'; \
|
||||||
fi; \
|
fi; \
|
||||||
done >> skel/sample/makedep.out
|
done >> skel/sample/makedep.out
|
||||||
${Q}echo sample dependency list formed
|
${Q} echo sample dependency list formed
|
||||||
${Q}echo forming new sample/Makefile
|
${Q} echo forming new sample/Makefile
|
||||||
-${Q}rm -f Makefile.bak
|
-${Q} ${RM} -f Makefile.bak
|
||||||
${Q}mv Makefile Makefile.bak
|
${Q} ${MV} Makefile Makefile.bak
|
||||||
${Q}${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak > Makefile
|
${Q} ${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak > Makefile
|
||||||
${Q}echo "" >> Makefile
|
${Q} echo "" >> Makefile
|
||||||
${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 \
|
||||||
rm -f Makefile.tmp; \
|
${RM} -f Makefile.tmp; \
|
||||||
mv Makefile Makefile.tmp; \
|
${MV} Makefile Makefile.tmp; \
|
||||||
if [ -d RCS ]; then \
|
if [ -d RCS ]; then \
|
||||||
co -l Makefile; \
|
${CO} -l Makefile; \
|
||||||
fi; \
|
fi; \
|
||||||
mv Makefile.tmp Makefile; \
|
${MV} Makefile.tmp Makefile; \
|
||||||
if [ -d RCS ]; then \
|
if [ -d RCS ]; then \
|
||||||
echo new sample Makefile formed, you need to check it in; \
|
echo new sample Makefile formed, you need to check it in; \
|
||||||
fi; \
|
fi; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##
|
##
|
||||||
@@ -551,12 +578,12 @@ echo_inst_files: Makefile
|
|||||||
##
|
##
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm -f ${SAMPLE_OBJ} core
|
-${RM} -f ${SAMPLE_OBJ} core
|
||||||
|
|
||||||
clobber:
|
clobber:
|
||||||
-rm -f ${SAMPLE_OBJ}
|
-${RM} -f ${SAMPLE_OBJ}
|
||||||
-rm -f ${TARGETS}
|
-${RM} -f ${TARGETS}
|
||||||
rm -f .all Makefile.tmp sample
|
${RM} -f .all Makefile.tmp sample
|
||||||
|
|
||||||
# install everything
|
# install everything
|
||||||
#
|
#
|
||||||
@@ -565,7 +592,7 @@ clobber:
|
|||||||
# NOTE: for right now we will not install anything
|
# NOTE: for right now we will not install anything
|
||||||
#
|
#
|
||||||
install: all
|
install: all
|
||||||
@true
|
@${TRUE}
|
||||||
|
|
||||||
# Try to remove everything that was installed
|
# Try to remove everything that was installed
|
||||||
#
|
#
|
||||||
@@ -574,7 +601,7 @@ install: all
|
|||||||
# NOTE: nothing installed, nothing to uninstall
|
# NOTE: nothing installed, nothing to uninstall
|
||||||
#
|
#
|
||||||
uninstall:
|
uninstall:
|
||||||
@true
|
@${TRUE}
|
||||||
|
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
|
@@ -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.67 $
|
* @(#) $Revision: 29.74 $
|
||||||
* @(#) $Id: version.c,v 29.67 2006/09/17 23:50:45 chongo Exp $
|
* @(#) $Id: version.c,v 29.74 2007/02/07 01:37:07 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
|
||||||
@@ -48,7 +48,7 @@ static char *program;
|
|||||||
#define MAJOR_VER 2 /* major version */
|
#define MAJOR_VER 2 /* major version */
|
||||||
#define MINOR_VER 12 /* minor version */
|
#define MINOR_VER 12 /* minor version */
|
||||||
#define MAJOR_PATCH 1 /* patch level or 0 if no patch */
|
#define MAJOR_PATCH 1 /* patch level or 0 if no patch */
|
||||||
#define MINOR_PATCH 1 /* test number or 0 if no minor patch */
|
#define MINOR_PATCH 8 /* test number or 0 if no minor patch */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -57,4 +57,3 @@ CALCPAGER=less.exe
|
|||||||
|
|
||||||
EXT=.exe
|
EXT=.exe
|
||||||
|
|
||||||
ECHO=
|
|
||||||
|
@@ -32,10 +32,5 @@
|
|||||||
#define DEFAULTCALCPAGER "less.exe"
|
#define DEFAULTCALCPAGER "less.exe"
|
||||||
#endif /* DEFAULTCALCPAGER */
|
#endif /* DEFAULTCALCPAGER */
|
||||||
|
|
||||||
/* where the echo command is located */
|
|
||||||
#if !defined(ECHO_PROG)
|
|
||||||
#define ECHO_PROG ""
|
|
||||||
#endif /* ECHO_PROG */
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* !__CONF_H__ */
|
#endif /* !__CONF_H__ */
|
||||||
|
@@ -3,12 +3,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#if !defined(__HAVE_RUSAGE_H__)
|
#if !defined(__HAVE_STRDUP_H__)
|
||||||
#define __HAVE_RUSAGE_H__
|
#define __HAVE_STRDUP_H__
|
||||||
|
|
||||||
|
|
||||||
/* do we have or want getstrdup()? */
|
/* do we have or want getstrdup()? */
|
||||||
#define HAVE_STRDUP /* yes */
|
#define HAVE_STRDUP /* yes */
|
||||||
|
|
||||||
|
|
||||||
#endif /* !__HAVE_RUSAGE_H__ */
|
#endif /* !__HAVE_STRDUP_H__ */
|
||||||
|
75
zmath.c
75
zmath.c
@@ -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.2 $
|
* @(#) $Revision: 29.3 $
|
||||||
* @(#) $Id: zmath.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
* @(#) $Id: zmath.c,v 29.3 2006/12/15 16:20:04 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zmath.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zmath.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:48:28
|
* Under source code control: 1990/02/15 01:48:28
|
||||||
@@ -355,6 +355,42 @@ utoz(FULL i, ZVALUE *res)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convert a normal signed integer to a number.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
stoz(SFULL i, ZVALUE *res)
|
||||||
|
{
|
||||||
|
long diddle, len;
|
||||||
|
|
||||||
|
res->len = 1;
|
||||||
|
res->sign = 0;
|
||||||
|
diddle = 0;
|
||||||
|
if (i == 0) {
|
||||||
|
res->v = _zeroval_;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (i < 0) {
|
||||||
|
res->sign = 1;
|
||||||
|
i = -i;
|
||||||
|
if (i < 0) { /* fix most negative number */
|
||||||
|
diddle = 1;
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (i == 1) {
|
||||||
|
res->v = _oneval_;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
len = 1 + (((FULL) i) >= BASE);
|
||||||
|
res->len = (LEN)len;
|
||||||
|
res->v = alloc((LEN)len);
|
||||||
|
res->v[0] = (HALF) (i + diddle);
|
||||||
|
if (len == 2)
|
||||||
|
res->v[1] = (HALF) (i / BASE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert a number to a unsigned normal integer, as far as possible.
|
* Convert a number to a unsigned normal integer, as far as possible.
|
||||||
* If the number is out of range, the largest number is returned.
|
* If the number is out of range, the largest number is returned.
|
||||||
@@ -370,6 +406,41 @@ ztou(ZVALUE z)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convert a number to a signed normal integer, as far as possible.
|
||||||
|
*
|
||||||
|
* If the number is too large to fit into an integer, than the largest
|
||||||
|
* positive or largest negative integer is returned depending on the sign.
|
||||||
|
*/
|
||||||
|
SFULL
|
||||||
|
ztos(ZVALUE z)
|
||||||
|
{
|
||||||
|
FULL val; /* absolute value of the return value */
|
||||||
|
|
||||||
|
/* negative value processing */
|
||||||
|
if (z.sign) {
|
||||||
|
if (z.len > 2) {
|
||||||
|
return MINSFULL;
|
||||||
|
}
|
||||||
|
val = ztofull(z);
|
||||||
|
if (val > TOPFULL) {
|
||||||
|
return MINSFULL;
|
||||||
|
}
|
||||||
|
return (SFULL)(-val);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* positive value processing */
|
||||||
|
if (z.len > 2) {
|
||||||
|
return (SFULL)MAXFULL;
|
||||||
|
}
|
||||||
|
val = ztofull(z);
|
||||||
|
if (val > MAXFULL) {
|
||||||
|
return (SFULL)MAXFULL;
|
||||||
|
}
|
||||||
|
return (SFULL)val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make a copy of an integer value
|
* Make a copy of an integer value
|
||||||
*/
|
*/
|
||||||
|
7
zmath.h
7
zmath.h
@@ -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.17 $
|
* @(#) $Revision: 29.18 $
|
||||||
* @(#) $Id: zmath.h,v 29.17 2006/06/11 07:07:23 chongo Exp $
|
* @(#) $Id: zmath.h,v 29.18 2006/12/15 16:20:04 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zmath.h,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zmath.h,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1993/07/30 19:42:48
|
* Under source code control: 1993/07/30 19:42:48
|
||||||
@@ -131,6 +131,7 @@ typedef SB32 SFULL; /* signed FULL */
|
|||||||
|
|
||||||
#define TOPFULL ((FULL)1 << (FULL_BITS-1)) /* highest bit in FULL */
|
#define TOPFULL ((FULL)1 << (FULL_BITS-1)) /* highest bit in FULL */
|
||||||
#define MAXFULL (TOPFULL - (FULL)1) /* largest SFULL value */
|
#define MAXFULL (TOPFULL - (FULL)1) /* largest SFULL value */
|
||||||
|
#define MINSFULL ((SFULL)(TOPFULL)) /* most negative SFULL value */
|
||||||
#define MAXUFULL (MAXFULL | TOPFULL) /* largest FULL value */
|
#define MAXUFULL (MAXFULL | TOPFULL) /* largest FULL value */
|
||||||
|
|
||||||
#define TOPLONG ((unsigned long)1 << (LONG_BITS-1)) /* top long bit */
|
#define TOPLONG ((unsigned long)1 << (LONG_BITS-1)) /* top long bit */
|
||||||
@@ -289,9 +290,11 @@ extern DLL void freeh(HALF *);
|
|||||||
extern DLL void zcopy(ZVALUE z, ZVALUE *res);
|
extern DLL void zcopy(ZVALUE z, ZVALUE *res);
|
||||||
extern DLL void itoz(long i, ZVALUE *res);
|
extern DLL void itoz(long i, ZVALUE *res);
|
||||||
extern DLL void utoz(FULL i, ZVALUE *res);
|
extern DLL void utoz(FULL i, ZVALUE *res);
|
||||||
|
extern DLL void stoz(SFULL i, ZVALUE *res);
|
||||||
extern DLL void str2z(char *s, ZVALUE *res);
|
extern DLL void str2z(char *s, ZVALUE *res);
|
||||||
extern DLL long ztoi(ZVALUE z);
|
extern DLL long ztoi(ZVALUE z);
|
||||||
extern DLL FULL ztou(ZVALUE z);
|
extern DLL FULL ztou(ZVALUE z);
|
||||||
|
extern DLL SFULL ztos(ZVALUE z);
|
||||||
extern DLL void zprintval(ZVALUE z, long decimals, long width);
|
extern DLL void zprintval(ZVALUE z, long decimals, long width);
|
||||||
extern DLL void zprintx(ZVALUE z, long width);
|
extern DLL void zprintx(ZVALUE z, long width);
|
||||||
extern DLL void zprintb(ZVALUE z, long width);
|
extern DLL void zprintb(ZVALUE z, long width);
|
||||||
|
Reference in New Issue
Block a user