mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Release calc version 2.11.10.1
This commit is contained in:
85
BUGS
85
BUGS
@@ -72,7 +72,62 @@ Known bugs:
|
|||||||
us know! See the above for details on how to report and were to
|
us know! See the above for details on how to report and were to
|
||||||
EMail your bug reports and hopefully patches to fix them.
|
EMail your bug reports and hopefully patches to fix them.
|
||||||
|
|
||||||
Problems with known work-a-rounds:
|
* The following command:
|
||||||
|
|
||||||
|
calc 'read ellip; efactor(13*17*19)'
|
||||||
|
|
||||||
|
will generate the following error:
|
||||||
|
|
||||||
|
efactor(iN,ia,B,force) defined
|
||||||
|
point_print(p) defined
|
||||||
|
point_mul(p1,p2) defined
|
||||||
|
point_square(p) defined
|
||||||
|
point_pow(p,pow) defined
|
||||||
|
A = 1
|
||||||
|
2 (1,1)
|
||||||
|
"point_square": line 165: Not initializing matrix, object or list
|
||||||
|
Error in commands
|
||||||
|
|
||||||
|
This is not an error in the ellip standard calc resource files.
|
||||||
|
It is a bug inside calc. Versions going back as far as version
|
||||||
|
2.11.4t2 in the year 2000 (and perhaps even further) alll have
|
||||||
|
this bug.
|
||||||
|
|
||||||
|
Anyone want to track down and fix this bug?
|
||||||
|
|
||||||
|
=-=
|
||||||
|
|
||||||
|
mis-features in calc:
|
||||||
|
|
||||||
|
Some problems are not bugs but rarther mis-features / things that could
|
||||||
|
work better. The following is a list of mis-features that should be
|
||||||
|
addressed and improved someday.
|
||||||
|
|
||||||
|
* The chi.cal resource file does not work well with odd degrees
|
||||||
|
of freedom. Can someone improve this algorithm?
|
||||||
|
|
||||||
|
* The intfile.cal resource file reads and writes big or little Endian
|
||||||
|
integers to/from files the hard way. It does NOT use blkcpy. The
|
||||||
|
following code:
|
||||||
|
|
||||||
|
i = (ord("\n") << 16) | (ord("i") << 8) | ord("H")
|
||||||
|
b = blk()
|
||||||
|
copy(i, b)
|
||||||
|
fd = fopen("file", "w")
|
||||||
|
copy(b, fd);
|
||||||
|
fclose(fd)
|
||||||
|
|
||||||
|
will write an extra NUL octet to the file. Where as:
|
||||||
|
|
||||||
|
read intfile
|
||||||
|
i = (ord("\n") << 16) | (ord("i") << 8) | ord("H")
|
||||||
|
be2file(i, "file2")
|
||||||
|
|
||||||
|
will not.
|
||||||
|
|
||||||
|
=-=
|
||||||
|
|
||||||
|
Problems with old systems that have known work-a-rounds:
|
||||||
|
|
||||||
* The gcc as shipped with Redhat 7 perhaps other Linux distributions
|
* The gcc as shipped with Redhat 7 perhaps other Linux distributions
|
||||||
has a bug causes calc to dump core on startup when calc is:
|
has a bug causes calc to dump core on startup when calc is:
|
||||||
@@ -88,6 +143,8 @@ Problems with known work-a-rounds:
|
|||||||
when calc is compiled with readline (see USE_READLINE,
|
when calc is compiled with readline (see USE_READLINE,
|
||||||
READLINE_LIB and READLINE_INCLUDE in the Makefile)
|
READLINE_LIB and READLINE_INCLUDE in the Makefile)
|
||||||
|
|
||||||
|
This is known as the Redhat 7 readlne problem.
|
||||||
|
|
||||||
On Redhat, the gcc -v which has this problem is:
|
On Redhat, the gcc -v which has this problem is:
|
||||||
|
|
||||||
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)
|
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-85)
|
||||||
@@ -250,28 +307,6 @@ Problems with known work-a-rounds:
|
|||||||
or performance. The work-a-round is to ignore these warnings
|
or performance. The work-a-round is to ignore these warnings
|
||||||
under BSDI.
|
under BSDI.
|
||||||
|
|
||||||
* The chi.cal resource file does not work well with odd degrees
|
|
||||||
of freedom. Can someone improve this algorithm?
|
|
||||||
|
|
||||||
* The intfile.cal resource file reads and writes big or little Endian
|
|
||||||
integers to/from files the hard way. It does NOT use blkcpy. The
|
|
||||||
following code:
|
|
||||||
|
|
||||||
i = (ord("\n") << 16) | (ord("i") << 8) | ord("H")
|
|
||||||
b = blk()
|
|
||||||
copy(i, b)
|
|
||||||
fd = fopen("file", "w")
|
|
||||||
copy(b, fd);
|
|
||||||
fclose(fd)
|
|
||||||
|
|
||||||
will write an extra NUL octet to the file. Where as:
|
|
||||||
|
|
||||||
read intfile
|
|
||||||
i = (ord("\n") << 16) | (ord("i") << 8) | ord("H")
|
|
||||||
be2file(i, "file2")
|
|
||||||
|
|
||||||
will not.
|
|
||||||
|
|
||||||
## Copyright (C) 1999 Landon Curt Noll
|
## Copyright (C) 1999 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
|
||||||
@@ -288,8 +323,8 @@ Problems with 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.18 $
|
## @(#) $Revision: 29.21 $
|
||||||
## @(#) $Id: BUGS,v 29.18 2004/07/26 05:56:40 chongo Exp $
|
## @(#) $Id: BUGS,v 29.21 2004/10/23 01:13:51 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
|
||||||
|
37
CHANGES
37
CHANGES
@@ -1,4 +1,31 @@
|
|||||||
The following are the changes from calc version 2.11.10 to date:
|
The following are the changes from calc version 2.11.10.1 to date:
|
||||||
|
|
||||||
|
Fixed a bug reported by the sourceforge user: cedars where:
|
||||||
|
|
||||||
|
ln(exp(6)) == 3 /* WRONG!!! */
|
||||||
|
|
||||||
|
incorrectly returned 1. This bug was fixed by Ernest Bowen
|
||||||
|
<ernie at turing dot une dot edu dot au>. The regression test
|
||||||
|
was expanded to cover this issue.
|
||||||
|
|
||||||
|
Added minor improvements to hash regression testing of pi().
|
||||||
|
|
||||||
|
Fixed "help script" and the calc man page regarding the requirement
|
||||||
|
of -f to be the last -flag in shell script mode. Further clarified
|
||||||
|
the meaning and placement of the -f flag.
|
||||||
|
|
||||||
|
Moved issues with chi.cal intfile.cal into a "mis-features" section
|
||||||
|
of the BUGS file. See "help bugs" or the BUGS source file for details.
|
||||||
|
|
||||||
|
Added the bug about:
|
||||||
|
|
||||||
|
calc 'read ellip; efactor(13*17*19)'
|
||||||
|
|
||||||
|
to the BUGS file. See "help bugs" or the BUGS source file for details.
|
||||||
|
Anyone want to track down and fix this bug?
|
||||||
|
|
||||||
|
|
||||||
|
The following are the changes from calc version 2.11.10 to 2.11.10:
|
||||||
|
|
||||||
The cygwin config value is correctly tested while doing comparisons
|
The cygwin config value is correctly tested while doing comparisons
|
||||||
between config states.
|
between config states.
|
||||||
@@ -34,7 +61,7 @@ The following are the changes from calc version 2.11.10 to date:
|
|||||||
and ${L64_FORMAT}. Removed longlong.c and longlong.h. The use
|
and ${L64_FORMAT}. Removed longlong.c and longlong.h. The use
|
||||||
of HAVE_LONGLONG=0 was problematic. The lack of complaints about
|
of HAVE_LONGLONG=0 was problematic. The lack of complaints about
|
||||||
the HAVE_LONGLONG=0 shows that the 'long long' type is wide spread
|
the HAVE_LONGLONG=0 shows that the 'long long' type is wide spread
|
||||||
enough to no warrent trying to support this deprecated mode.
|
enough warrent not trying to support compilers without 'long long'.
|
||||||
|
|
||||||
Removed the SVAL and SHVAL macros from zrand.c, zrand.h, and zmath.h
|
Removed the SVAL and SHVAL macros from zrand.c, zrand.h, and zmath.h
|
||||||
as they were causing too many broken C pre-processors and C checkers
|
as they were causing too many broken C pre-processors and C checkers
|
||||||
@@ -69,7 +96,7 @@ The following are the changes from calc version 2.11.10 to date:
|
|||||||
Added EXT Makefile variable so that Cygwin can install calc as
|
Added EXT Makefile variable so that Cygwin can install calc as
|
||||||
calc.exe. By default, EXT is empty so that calc is calc on most
|
calc.exe. By default, EXT is empty so that calc is calc on most
|
||||||
modern operating systems. Thanks goes to Ullal Devappa Kini <wmbfqj
|
modern operating systems. Thanks goes to Ullal Devappa Kini <wmbfqj
|
||||||
at vsnl dot net> for helping identify this problem and test our fix.
|
at vsnl dot net> for helping identify this problem and testing our fix.
|
||||||
|
|
||||||
Added custom function:
|
Added custom function:
|
||||||
|
|
||||||
@@ -5758,8 +5785,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.69 $
|
## @(#) $Revision: 29.70 $
|
||||||
## @(#) $Id: CHANGES,v 29.69 2004/08/03 12:29:19 chongo Exp $
|
## @(#) $Id: CHANGES,v 29.70 2004/10/23 01:16:23 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
|
||||||
|
@@ -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.19 $
|
* @(#) $Revision: 29.20 $
|
||||||
* @(#) $Id: regress.cal,v 29.19 2004/02/23 14:04:01 chongo Exp $
|
* @(#) $Id: regress.cal,v 29.20 2004/10/22 23:51:26 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
|
||||||
@@ -2571,6 +2571,33 @@ define test_2600()
|
|||||||
i = config("sqrt", i);
|
i = config("sqrt", i);
|
||||||
print tnum++: ': i = config("sqrt", i)';
|
print tnum++: ': i = config("sqrt", i)';
|
||||||
|
|
||||||
|
i = epsilon(1e-100),;
|
||||||
|
print tnum++: ': i = epsilon(1e-100),;';
|
||||||
|
vrfy(ln(exp(6)) == 6,
|
||||||
|
strcat(str(tnum++), ': ln(exp(6)) == 6'));
|
||||||
|
vrfy(ln(exp(4)^4) == 16,
|
||||||
|
strcat(str(tnum++), ': ln(exp(4)^4) == 16'));
|
||||||
|
vrfy(ln(exp(6.5)^8) == 52,
|
||||||
|
strcat(str(tnum++), ': ln(exp(6.5)^8) == 52'));
|
||||||
|
vrfy(ln(exp(5)^16) == 80,
|
||||||
|
strcat(str(tnum++), ': ln(exp(5)^16) == 80'));
|
||||||
|
vrfy(ln(exp(4.5)^4) == 18,
|
||||||
|
strcat(str(tnum++), ': ln(exp(4.5)^4) == 18'));
|
||||||
|
vrfy(ln(exp(4)^8) == 32,
|
||||||
|
strcat(str(tnum++), ': ln(exp(4)^8) == 32'));
|
||||||
|
vrfy(ln(exp(60/11)^11) == 60,
|
||||||
|
strcat(str(tnum++), ': ln(exp(60/11)^11) == 60'));
|
||||||
|
vrfy(ln(exp(6)^15) == 90,
|
||||||
|
strcat(str(tnum++), ': ln(exp(6)^11) == 90'));
|
||||||
|
vrfy(ln(exp(80/17)^17) == 80,
|
||||||
|
strcat(str(tnum++), ': ln(exp(80/17)^17) == 80'));
|
||||||
|
vrfy(ln(exp(6)^15) == 90,
|
||||||
|
strcat(str(tnum++), ': ln(exp(6)^15) == 90'));
|
||||||
|
vrfy(ln(exp(5)^18) == 90,
|
||||||
|
strcat(str(tnum++), ': ln(exp(5)^18) == 90'));
|
||||||
|
epsilon(i),;
|
||||||
|
print tnum++: ': epsilon(i),;';
|
||||||
|
|
||||||
print tnum: ': Ending extensive numeric function test';
|
print tnum: ': Ending extensive numeric function test';
|
||||||
}
|
}
|
||||||
print '037: parsed test_2600()';
|
print '037: parsed test_2600()';
|
||||||
@@ -6605,10 +6632,10 @@ define test_sha()
|
|||||||
0x21e42319a26787046c2b28b7ae70f1b54bf0ba2a,
|
0x21e42319a26787046c2b28b7ae70f1b54bf0ba2a,
|
||||||
'7122: sha(sha("this is", 7^19-8, ..., "hash")) == 0x21e4...');
|
'7122: sha(sha("this is", 7^19-8, ..., "hash")) == 0x21e4...');
|
||||||
|
|
||||||
z = sha(list(1,2,3), "curds and whey", 2^21701-1, pi());
|
z = sha(list(1,2,3), "curds and whey", 2^21701-1, pi(1e-100));
|
||||||
print '7123: z = sha(list(1,2,3), "curds and whey", 2^21701-1, pi());';
|
print '7123: z = sha(list(1,2,3), "curds and whey", 2^21701-1, pi(1e-100));';
|
||||||
vrfy(sha(z) == 0x36dcca3e51865c30a2cf738023cda446f1368340,
|
vrfy(sha(z) == 257075527903934749824451356785709876382198951165,
|
||||||
'7124: sha(z) == 0x36dcca3e51865c30a2cf738023cda446f1368340');
|
'7124: sha(z) == 257075527903934749824451356785709876382198951165');
|
||||||
|
|
||||||
y = sha();
|
y = sha();
|
||||||
print '7125: y = sha()';
|
print '7125: y = sha()';
|
||||||
@@ -6616,8 +6643,8 @@ define test_sha()
|
|||||||
print '7126: y = sha(y, list(1,2,3), "curds and whey")';
|
print '7126: y = sha(y, list(1,2,3), "curds and whey")';
|
||||||
y = sha(y, 2^21701-1);
|
y = sha(y, 2^21701-1);
|
||||||
print '7127: y = sha(y, 2^21701-1)';
|
print '7127: y = sha(y, 2^21701-1)';
|
||||||
y = sha(y, pi());
|
y = sha(y, pi(1e-100));
|
||||||
print '7128: y = sha(y, pi())';
|
print '7128: y = sha(y, pi(1e-100))';
|
||||||
vrfy(y == z, '7129: y == z');
|
vrfy(y == z, '7129: y == z');
|
||||||
|
|
||||||
B = blk() = {"a", "b", "c"};
|
B = blk() = {"a", "b", "c"};
|
||||||
@@ -6676,10 +6703,10 @@ define test_sha1()
|
|||||||
'7209: sha1(sha1("this is",7^19-8,"a composit",3i+4.5,"hash")) == ...');
|
'7209: sha1(sha1("this is",7^19-8,"a composit",3i+4.5,"hash")) == ...');
|
||||||
|
|
||||||
|
|
||||||
z = sha1(list(1,2,3), "curds and whey", 2^21701-1, pi());
|
z = sha1(list(1,2,3), "curds and whey", 2^21701-1, pi(1e-100));
|
||||||
print '7210: z = sha1(list(1,2,3), "curds and whey", 2^21701-1, pi());';
|
print '7210: z = sha1(list(1,2,3), "curds and whey", 2^21701-1, pi(1e-100));';
|
||||||
vrfy(sha1(z) == 0xc19e7317675dbf71e293b4c41e117169e9da5b6f,
|
vrfy(sha1(z) == 0x158cc87deeb9dd478ca14e3ab359205b0fb15b83,
|
||||||
'7211: sha1(z) == 0xc19e7317675dbf71e293b4c41e117169e9da5b6f');
|
'7211: sha1(z) == 0x158cc87deeb9dd478ca14e3ab359205b0fb15b83');
|
||||||
|
|
||||||
y = sha1();
|
y = sha1();
|
||||||
print '7212: y = sha1();';
|
print '7212: y = sha1();';
|
||||||
@@ -6687,8 +6714,8 @@ define test_sha1()
|
|||||||
print '7213: y = sha1(y, list(1,2,3), "curds and whey");';
|
print '7213: y = sha1(y, list(1,2,3), "curds and whey");';
|
||||||
y = sha1(y, 2^21701-1);
|
y = sha1(y, 2^21701-1);
|
||||||
print '7214: y = sha1(y, 2^21701-1);';
|
print '7214: y = sha1(y, 2^21701-1);';
|
||||||
y = sha1(y, pi());
|
y = sha1(y, pi(1e-100));
|
||||||
print '7215: y = sha1(y, pi());';
|
print '7215: y = sha1(y, pi(1e-100));';
|
||||||
vrfy(y == z, '7216: y == z');
|
vrfy(y == z, '7216: y == z');
|
||||||
|
|
||||||
vrfy(sha1(sha1("a"))==0x86f7e437faa5a7fce15d1ddcb9eaeaea377667b8,
|
vrfy(sha1(sha1("a"))==0x86f7e437faa5a7fce15d1ddcb9eaeaea377667b8,
|
||||||
@@ -6764,18 +6791,18 @@ define test_md5()
|
|||||||
'7310: md5(md5("this is", 7^19-8, "a composit", 3i+4.5, "hash")) == ...');
|
'7310: md5(md5("this is", 7^19-8, "a composit", 3i+4.5, "hash")) == ...');
|
||||||
|
|
||||||
|
|
||||||
z = md5(list(1,2,3), "curds and whey", 2^21701-1, pi());
|
z = md5(list(1,2,3), "curds and whey", 2^21701-1, pi(1e-100));
|
||||||
print '7311: z = md5(list(1,2,3), "curds and whey", 2^21701-1, pi());';
|
print '7311: z = md5(list(1,2,3), "curds and whey", 2^21701-1, pi(1e-100));';
|
||||||
vrfy(md5(z) == 0x63d2b2fccae2de265227c30b05abb6b5,
|
vrfy(md5(z) == 0x487462e577eabef0302dd13af6632546,
|
||||||
'7312: md5(z) == 0x63d2b2fccae2de265227c30b05abb6b5');
|
'7312: md5(z) == 0x487462e577eabef0302dd13af6632546');
|
||||||
y = md5();
|
y = md5();
|
||||||
print '7313: y = md5();';
|
print '7313: y = md5();';
|
||||||
y = md5(y, list(1,2,3), "curds and whey");
|
y = md5(y, list(1,2,3), "curds and whey");
|
||||||
print '7314: y = md5(y, list(1,2,3), "curds and whey")';
|
print '7314: y = md5(y, list(1,2,3), "curds and whey")';
|
||||||
y = md5(y, 2^21701-1);
|
y = md5(y, 2^21701-1);
|
||||||
print '7315: y = md5(y, 2^21701-1);';
|
print '7315: y = md5(y, 2^21701-1);';
|
||||||
y = md5(y, pi());
|
y = md5(y, pi(1e-100));
|
||||||
print '7316: y = md5(y, pi());';
|
print '7316: y = md5(y, pi(1e-100));';
|
||||||
vrfy(y == z, '7317: y == z');
|
vrfy(y == z, '7317: y == z');
|
||||||
|
|
||||||
vrfy(md5(md5("a")) == 0x0cc175b9c0f1b6a831c399e269772661,
|
vrfy(md5(md5("a")) == 0x0cc175b9c0f1b6a831c399e269772661,
|
||||||
|
86
calc.man
86
calc.man
@@ -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.15 $
|
.\" @(#) $Revision: 29.17 $
|
||||||
.\" @(#) $Id: calc.man,v 29.15 2004/08/03 05:06:22 chongo Exp $
|
.\" @(#) $Id: calc.man,v 29.17 2004/10/23 00:58:33 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
|
||||||
@@ -183,6 +183,80 @@ help config
|
|||||||
Ignore any environment variables on startup.
|
Ignore any environment variables on startup.
|
||||||
The getenv() builtin will still return values, however.
|
The getenv() builtin will still return values, however.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
.B \-f
|
||||||
|
This flag is required when using calc in
|
||||||
|
.BR "shell script mode" .
|
||||||
|
It must be at the end of the initial
|
||||||
|
.B #!
|
||||||
|
line of the script.
|
||||||
|
.sp 1
|
||||||
|
This flag is normally only at the end of a calc shell script.
|
||||||
|
If the first line of an executable file begins
|
||||||
|
.B #!
|
||||||
|
followed by the absolute pathname of the
|
||||||
|
.B calc
|
||||||
|
program and the flag
|
||||||
|
.B \-f
|
||||||
|
as in:
|
||||||
|
.sp 1
|
||||||
|
.in +5n
|
||||||
|
.nf
|
||||||
|
\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-f\fP
|
||||||
|
.fi
|
||||||
|
.in -5n
|
||||||
|
.sp 1
|
||||||
|
the rest of the file will be processed in
|
||||||
|
.BR "shell script mode" .
|
||||||
|
See
|
||||||
|
.B "SHELL SCRIPT MODE"
|
||||||
|
section of this man page
|
||||||
|
below for details.
|
||||||
|
.sp 1
|
||||||
|
The actual form of this flag is:
|
||||||
|
.sp 1
|
||||||
|
.in +5n
|
||||||
|
.B \-f
|
||||||
|
filename
|
||||||
|
.in -5n
|
||||||
|
.sp 1
|
||||||
|
On systems that treat an executable that begins with
|
||||||
|
.B #!
|
||||||
|
as a script, the path of the execurable is appended by the kernel
|
||||||
|
as the final argument to the exec() system call.
|
||||||
|
This is why the
|
||||||
|
.B \-f
|
||||||
|
flag at the very end of the
|
||||||
|
.B #!
|
||||||
|
line.
|
||||||
|
.sp 1
|
||||||
|
It is possible use
|
||||||
|
.B \-f\ filename
|
||||||
|
on the command line:
|
||||||
|
.sp 1
|
||||||
|
.in +5n
|
||||||
|
.nf
|
||||||
|
\fIcalc\fP\ [other_flags\ \&...] \fB\-f\fP filename
|
||||||
|
.fi
|
||||||
|
.in -5n
|
||||||
|
.sp 1
|
||||||
|
This will cause calc to process lines in
|
||||||
|
.B filename
|
||||||
|
in
|
||||||
|
.BR "shell script mode" .
|
||||||
|
.sp 1
|
||||||
|
Use of
|
||||||
|
.B \-f
|
||||||
|
implies
|
||||||
|
.BR \-s .
|
||||||
|
In addition,
|
||||||
|
.B \-d
|
||||||
|
and
|
||||||
|
.B \-p
|
||||||
|
are implied if
|
||||||
|
.B \-i
|
||||||
|
is not given.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-h
|
.B \-h
|
||||||
Print a help message. This option implies
|
Print a help message. This option implies
|
||||||
@@ -578,7 +652,7 @@ help config
|
|||||||
.br
|
.br
|
||||||
SHELL SCRIPT MODE
|
SHELL SCRIPT MODE
|
||||||
.PP
|
.PP
|
||||||
If first line of an executable file begins
|
If the first line of an executable file begins
|
||||||
.B #!
|
.B #!
|
||||||
followed by the absolute pathname of the
|
followed by the absolute pathname of the
|
||||||
.B calc
|
.B calc
|
||||||
@@ -596,10 +670,10 @@ the rest of the file will be processed in
|
|||||||
.BR "shell script mode" .
|
.BR "shell script mode" .
|
||||||
Note that
|
Note that
|
||||||
.B \-f
|
.B \-f
|
||||||
must be the first \-flag on the ``#!'' line.
|
must at the end of the intiial ``#!'' line.
|
||||||
Any other optional
|
Any other optional
|
||||||
.B "other_flags"
|
.B "other_flags"
|
||||||
must come after
|
must come before
|
||||||
the
|
the
|
||||||
.BR \-f .
|
.BR \-f .
|
||||||
.sp 1
|
.sp 1
|
||||||
@@ -617,8 +691,6 @@ the later lines within the script itself.
|
|||||||
In
|
In
|
||||||
.BR "shell script mode" ,
|
.BR "shell script mode" ,
|
||||||
.B \-s
|
.B \-s
|
||||||
(lower case
|
|
||||||
.BR \-s )
|
|
||||||
is always assumed.
|
is always assumed.
|
||||||
In addition,
|
In addition,
|
||||||
.B \-d
|
.B \-d
|
||||||
|
12
help/script
12
help/script
@@ -146,13 +146,19 @@ Calc shell scripts
|
|||||||
interpreter. Assuming the full path for calc is
|
interpreter. Assuming the full path for calc is
|
||||||
/usr/local/bin/calc, one could use the file addall3 with contents
|
/usr/local/bin/calc, one could use the file addall3 with contents
|
||||||
|
|
||||||
#!/usr/local/bin/calc -q -s -f
|
#!/usr/bin/calc -q -s -f
|
||||||
global i, n, s;
|
global i, n, s;
|
||||||
n = argv();
|
n = argv();
|
||||||
for (i = 1; i <= n; i++)
|
for (i = 1; i <= n; i++)
|
||||||
s += eval(argv(i));
|
s += eval(argv(i));
|
||||||
print "sum =", s;
|
print "sum =", s;
|
||||||
|
|
||||||
|
IMPORTANT NOTE:
|
||||||
|
|
||||||
|
The -f flag must be at the very end of the #! line.
|
||||||
|
The #! line must be the first line of the exeuctable file.
|
||||||
|
The path after the #! must be the full path to the calc executable.
|
||||||
|
|
||||||
After the command:
|
After the command:
|
||||||
|
|
||||||
addall3 2 3 4
|
addall3 2 3 4
|
||||||
@@ -283,8 +289,8 @@ For more information use the following calc commands:
|
|||||||
## 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: script,v 29.5 2001/04/08 07:56:32 chongo Exp $
|
## @(#) $Id: script,v 29.7 2004/10/23 00:41:11 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/script,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/script,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1999/11/30 05:29:48
|
## Under source code control: 1999/11/30 05:29:48
|
||||||
|
10
qtrans.c
10
qtrans.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.5 $
|
* @(#) $Revision: 29.6 $
|
||||||
* @(#) $Id: qtrans.c,v 29.5 2004/02/23 14:04:01 chongo Exp $
|
* @(#) $Id: qtrans.c,v 29.6 2004/10/23 00:58:59 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qtrans.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qtrans.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:48:22
|
* Under source code control: 1990/02/15 01:48:22
|
||||||
@@ -987,9 +987,12 @@ qln(NUMBER *q, NUMBER *epsilon)
|
|||||||
}
|
}
|
||||||
zfree(pow);
|
zfree(pow);
|
||||||
zfree(mul);
|
zfree(mul);
|
||||||
|
qtmp = qalloc(); /* qtmp is to be 2^n * sum / 2^m */
|
||||||
k = zlowbit(sum);
|
k = zlowbit(sum);
|
||||||
qtmp = qalloc();
|
|
||||||
sum.sign = neg;
|
sum.sign = neg;
|
||||||
|
if (k + n >= m) {
|
||||||
|
zshift(sum, n - m, &qtmp->num);
|
||||||
|
} else {
|
||||||
if (k) {
|
if (k) {
|
||||||
zshift(sum, -k, &qtmp->num);
|
zshift(sum, -k, &qtmp->num);
|
||||||
zfree(sum);
|
zfree(sum);
|
||||||
@@ -997,6 +1000,7 @@ qln(NUMBER *q, NUMBER *epsilon)
|
|||||||
qtmp->num = sum;
|
qtmp->num = sum;
|
||||||
}
|
}
|
||||||
zbitvalue(m - k - n, &qtmp->den);
|
zbitvalue(m - k - n, &qtmp->den);
|
||||||
|
}
|
||||||
res = qmappr(qtmp, epsilon, 24L);
|
res = qmappr(qtmp, epsilon, 24L);
|
||||||
qfree(qtmp);
|
qfree(qtmp);
|
||||||
return res;
|
return res;
|
||||||
|
@@ -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.53 $
|
* @(#) $Revision: 29.54 $
|
||||||
* @(#) $Id: version.c,v 29.53 2004/07/27 23:49:41 chongo Exp $
|
* @(#) $Id: version.c,v 29.54 2004/10/23 01:16:23 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 11 /* minor version */
|
#define MINOR_VER 11 /* minor version */
|
||||||
#define MAJOR_PATCH 10 /* patch level or 0 if no patch */
|
#define MAJOR_PATCH 10 /* patch level or 0 if no patch */
|
||||||
#define MINOR_PATCH 0 /* test number or 0 if no minor patch */
|
#define MINOR_PATCH 1 /* test number or 0 if no minor patch */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user