Release calc version 2.12.1.6

This commit is contained in:
Landon Curt Noll
2007-01-03 13:33:37 -08:00
parent 4e92927183
commit ee30d787ea
32 changed files with 862 additions and 269 deletions

View File

@@ -18,8 +18,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
# @(#) $Revision: 29.34 $
# @(#) $Id: Makefile,v 29.34 2006/09/18 13:13:25 chongo Exp $
# @(#) $Revision: 29.35 $
# @(#) $Id: Makefile,v 29.35 2006/12/16 10:32:54 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/help/RCS/Makefile,v $
#
# Under source code control: 1991/07/23 06:47:57
@@ -277,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 \
avg base base2 bernoulli bit blk blkcpy blkfree blocks bround \
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 \
errno error estr euler eval exp fact factor fclose fcnt feof ferror \
fflush fgetc fgetfield fgetfile fgetline fgets fgetstr fib files \
@@ -295,12 +295,12 @@ DETAIL_HELP= abs access acos acosh acot acoth acsc acsch address agd append \
param perm pfact pi pix places pmod polar poly pop popcnt power \
prevcand prevprime printf prompt protect ptest push putenv 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 \
sha sha1 sin sinh size sizeof sleep sort sqrt srand srandom ssq \
str strcat strcmp strcpy strerror strlen strncmp strncpy strpos \
strprintf strscan strscanf substr sum swap system tail tan tanh \
test time trunc version xor
strprintf strscan strscanf substr sum swap system systime tail tan \
tanh test time trunc usertime version xor
# This list is of files that are clones of DETAIL_HELP files. They are
# built from DETAIL_HELP files.

View File

@@ -68,6 +68,7 @@ DESCRIPTION
"baseb" bits in calculation base, a read-only value
"redecl_warn" TRUE => warn when redeclaring
"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
set of values. The return of:
@@ -867,6 +868,16 @@ DESCRIPTION
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
; current_cfg = config("all");
@@ -928,6 +939,7 @@ EXAMPLE
baseb 32
redecl_warn 1
dupvar_warn 1
hz 100
; display()
20
@@ -960,8 +972,8 @@ SEE ALSO
## 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.17 $
## @(#) $Id: config,v 29.17 2006/06/24 19:06:58 chongo Exp $
## @(#) $Revision: 29.18 $
## @(#) $Id: config,v 29.18 2006/12/16 11:14:28 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/config,v $
##
## Under source code control: 1991/07/21 04:37:17

63
help/cp
View File

@@ -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/

View File

@@ -1,5 +1,5 @@
NAME
runtime - user runtime
runtime - CPU time used by the current process in both user and kernel modes
SYNOPSIS
runtime()
@@ -8,27 +8,33 @@ TYPES
return nonnegative real
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
The result for this example will depend on the speed and number of
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.
The result for this example will depend on the speed of the CPU
and precision of the operating CPU time accounting sub-system:
; t = runtime();
; pi = pi(1e-1000);
; x = ptest(2^4253-1);
; runtime() - t;
.2
1.288804
LIMITS
none
On non-POSIX based systems, this function always returns 0.
LINK LIBRARY
none
SEE ALSO
ctime, time
config, ctime, systime, time, usertime
## 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.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
##
## @(#) $Revision: 29.5 $
## @(#) $Id: runtime,v 29.5 2006/06/25 22:16:55 chongo Exp $
## @(#) $Revision: 29.7 $
## @(#) $Id: runtime,v 29.7 2006/12/16 10:52:27 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/runtime,v $
##
## Under source code control: 1996/03/12 23:10:01

View File

@@ -3,22 +3,76 @@ Statements
Statements are very much like C statements. Most statements act
identically to those in C, but there are minor differences and
some additions. The following is a list of the statement types,
with explanation of the non-C statements. In this list, upper
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).
with explanation of the non-C statements.
Statements are generally terminated with semicolons or { ... }.
C-like statements
-----------------
{ statement }
{ statement; ... statement }
C-like flow control
-------------------
if (expr) statement
if (expr) statement ELSE statement
if (expr) statement else statement
for (optionalexpr ; optionalexpr ; optionalexpr) statement
while (expr) statement
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
break
goto label
@@ -30,8 +84,9 @@ Statements
return
------
return optionalexpr
return ( optionalexpr )
return
return expr
return ( expr )
This returns a value from a function. Functions always
have a return value, even if this statement is not used.
If no return statement is executed, or if no expression
@@ -241,7 +296,7 @@ Statements
builtin calc builtin functions
usage how to invoke the calc command and calc -options
## 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
## the terms of the version 2.1 of the GNU Lesser General Public License
@@ -257,8 +312,8 @@ Statements
## 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: statement,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: statement,v 29.3 2007/01/03 21:26:22 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/statement,v $
##
## Under source code control: 1991/07/21 04:37:23

63
help/systime Normal file
View 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/

View File

@@ -24,14 +24,32 @@ Calc Todo 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
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.
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".
* Consider using GNU autoconf / configure to build calc.
* Fix any 'Known bugs' as noted in the BUGS file or as
displayed by 'calc help bugs'.
@@ -54,6 +72,13 @@ High priority items:
* Address, if possible and reasonable, any Calc Mis-features
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:
@@ -104,8 +129,8 @@ Medium priority items:
## 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.9 $
## @(#) $Id: todo,v 29.9 2006/09/17 20:54:07 chongo Exp $
## @(#) $Revision: 29.10 $
## @(#) $Id: todo,v 29.10 2007/01/03 21:26:22 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/todo,v $
##
## Under source code control: 1999/10/20 07:42:55

View File

@@ -248,7 +248,55 @@ Unexpected
In addition to the C style /* comment lines */, lines that begin with
#! are treated as comments.
## Copyright (C) 1999 Landon Curt Noll
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
## the terms of the version 2.1 of the GNU Lesser General Public License
@@ -264,8 +312,8 @@ Unexpected
## 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: unexpected,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: unexpected,v 29.3 2007/01/03 21:26:22 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/unexpected,v $
##
## Under source code control: 1997/03/21 13:15:18

61
help/usertime Normal file
View 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/