mirror of
https://github.com/lcn2/calc.git
synced 2025-08-22 01:23:28 +03:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8dd7a3cd2a | ||
|
2726ae9d23 | ||
|
d25186fc52 | ||
|
28d1e35362 | ||
|
1ae2f953d3 | ||
|
ed4b56d1ec |
65
BUGS
65
BUGS
@@ -32,16 +32,25 @@ If you have tried all of the above and things still are not right,
|
||||
then it may be time to send in a bug report. You can send bug
|
||||
and bug fixes reports to:
|
||||
|
||||
calc-bugs at asthe dot com
|
||||
calc-bug-report at asthe dot com
|
||||
|
||||
[[ NOTE: Replace 'at' with @, 'dot' is with . and remove the spaces ]]
|
||||
[[ NOTE: The EMail address uses 'asthe', the web site URL uses 'isthe' ]]
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
|
||||
Your subject must contain the words:
|
||||
This replaces the old calc-bugs at asthe dot com address.
|
||||
|
||||
calc bug report
|
||||
To be sure we see your EMail reporting a calc bug, please use the
|
||||
following phase in your EMail Subject line:
|
||||
|
||||
You may have additional words in your subject line.
|
||||
calc bug report
|
||||
|
||||
That phrase in your subject line will help ensure your request
|
||||
will get past our anti-spam filters. You may have additional
|
||||
words in your subject line.
|
||||
|
||||
However, you may find it more helpful to simply subscribe
|
||||
to the calc-tester mailing list (see below) and then to
|
||||
send your report to that mailing list as a wider set calc
|
||||
testers may be able to help you.
|
||||
|
||||
When you send your report, please include the following information:
|
||||
|
||||
@@ -68,20 +77,15 @@ of a context diff patch).
|
||||
|
||||
Known bugs:
|
||||
|
||||
The output of the alg_config.cal resource file is bogus.
|
||||
We would welcome a replacement for this code.
|
||||
|
||||
We are sure some more bugs exist. When you find them, please let
|
||||
us know! See the above for details on how to report and were to
|
||||
EMail your bug reports and hopefully patches to fix them.
|
||||
|
||||
=-=
|
||||
|
||||
Problems that have known work-a-rounds:
|
||||
|
||||
* There is a bug in gcc v4.1.0 that causes calc to fail the regression
|
||||
test. The work-a-round is to compile with gcc v4.1.1 or later. This
|
||||
problems was observed on Fedora 5.
|
||||
|
||||
=-=
|
||||
|
||||
mis-features in calc:
|
||||
|
||||
Some problems are not bugs but rather mis-features / things that could
|
||||
@@ -129,7 +133,34 @@ mis-features in calc:
|
||||
|
||||
will not.
|
||||
|
||||
## Copyright (C) 1999-2013 Landon Curt Noll
|
||||
=-=
|
||||
|
||||
To subscribe to the calc-tester mailing list, visit the following URL:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/calc-tester.html
|
||||
|
||||
This is a low volume moderated mailing list.
|
||||
|
||||
This mailing list replaces calc-tester at asthe dot com list.
|
||||
|
||||
If you need a human to help you with your mailing list subscription,
|
||||
please send EMail to our special:
|
||||
|
||||
calc-tester-maillist-help at asthe dot com
|
||||
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
|
||||
address. To be sure we see your EMail asking for help with your
|
||||
mailing list subscription, please use the following phase in your
|
||||
EMail Subject line:
|
||||
|
||||
calc tester mailing list help
|
||||
|
||||
That phrase in your subject line will help ensure your
|
||||
request will get past our anti-spam filters. You may have
|
||||
additional words in your subject line.
|
||||
|
||||
## Copyright (C) 1999-2014 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
|
||||
@@ -145,8 +176,8 @@ mis-features in calc:
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.2 $
|
||||
## @(#) $Id: BUGS,v 30.2 2013/08/11 01:09:27 chongo Exp $
|
||||
## @(#) $Revision: 30.5 $
|
||||
## @(#) $Id: BUGS,v 30.5 2014/10/12 12:23:43 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/RCS/BUGS,v $
|
||||
##
|
||||
## Under source code control: 1994/03/18 14:06:13
|
||||
|
262
CHANGES
262
CHANGES
@@ -1,4 +1,256 @@
|
||||
The following are the changes from calc version 2.12.4.11 to date:
|
||||
The following are the changes from calc version 2.12.5.4 to date:
|
||||
|
||||
Recompile to match current RHEL7.2 libc and friends.
|
||||
|
||||
Added fix by Alexandre Fedotov <fedotov at mail dot desy dot de>
|
||||
to prepend ${T} in front of the CALCPATH path components
|
||||
${CALC_SHAREDIR} and ${CUSTOMDIR}. Add ${T} in front of ${HELPDIR}
|
||||
and ${CUSTONHELPDIR} when making conf.h.
|
||||
|
||||
Improved the jacobi help page.
|
||||
|
||||
Rewrote gen_v1() in the lucas.cal resource file using the method
|
||||
based on a paper:
|
||||
|
||||
"A note on primality tests for N = h*2^n-1", by Oystein J. Rodseth,
|
||||
Department of Mathematics, University of Bergen, BIT Numerical
|
||||
Mathematics. 34 (3): pp 451-454.
|
||||
|
||||
http://folk.uib.no/nmaoy/papers/luc.pdf
|
||||
|
||||
The improved gen_v1() function is capable of returning a value
|
||||
for all valid values of h and n. As a result, the trial tables
|
||||
used by gen_v1() have been changed to a short list of values
|
||||
to try, in order ot likelyhood of success, before doing an
|
||||
enhaustive search for a v1 value to return.
|
||||
|
||||
Removed lucas_tbl.cal calc resource file. This file was made
|
||||
obsolete by the above rewrite of the lucas.cal resource file.
|
||||
This file will be removed from the local cal directory and
|
||||
from CALC_SHAREDIR during a 'make install', 'make cobber',
|
||||
and 'make uninstall'.
|
||||
|
||||
Renamed gen_u0() to gen_u2() in lucas.cal. Provided a gen_u0()
|
||||
stub function that calls gen_u2() for backward compatibility.
|
||||
|
||||
The old gen_v1() method used by the Amdahl 6 group has been
|
||||
renamed legacy_gen_v1() in lucas.cal. This function is no
|
||||
longer usde by the lucas(h, n) function to test the primality of
|
||||
h*2^n-1. It is preserved in lucas.cal for historical purposes.
|
||||
|
||||
The 'make clobber' rule will attempt to remove all files that
|
||||
start with libcalc and start with libcustcalc.
|
||||
|
||||
The 'man' command is now an alias for the 'help' command.
|
||||
|
||||
Fixed extra /'s that were put into CALCPATH because of ${T}.
|
||||
Fixed extra /'s that were compiled into HELPDIR and CUSTOMHELPDIR.
|
||||
|
||||
The fix in 2.12.5.4 to to prepend ${T} in front of the CALCPATH
|
||||
path components ${CALC_SHAREDIR} and ${CUSTOMDIR} broke the
|
||||
calc rpm build process. The check-buildroot tool discovered
|
||||
that the BUILDROOT directory had been improperly put into various
|
||||
paths and binaries. This has been fixed in 2.12.5.5.
|
||||
|
||||
|
||||
The following are the changes from calc version 2.12.5.3 to 2.12.5.3:
|
||||
|
||||
Calc version 2.12.5.2 for Darwin (Mac OS X) users, code to installed
|
||||
calc under /opt/calc. Moreover the CHANGES file did not mention
|
||||
/opt/calc. Sorry about that!.
|
||||
|
||||
A much better tree for Darwin (Mac OS X) users would have been
|
||||
to install cal under /opt/calc. This release ONLY changes the Darwin
|
||||
(Mac OS X) install tree to /usr/local.
|
||||
|
||||
Darwin (Mac OS X) users who installed calc version 2.12.5.2
|
||||
should, after installing version 2.12.5.3:
|
||||
|
||||
rm -rf /opt/calc
|
||||
|
||||
|
||||
The following are the changes from calc version 2.12.5.1 to 2.12.5.2:
|
||||
|
||||
NOTE: calc version 2.12.5.2, for Darwin (Mac OS X) users,
|
||||
installed under /opt/calc. We neglected to mention this
|
||||
AND /usr/local would have been a better choice. Sorry!
|
||||
Fixed in calc version 2.12.5.3.
|
||||
|
||||
Removed rules and makefile variables assocated with shortened
|
||||
calc version numbers of less than 4 levels.
|
||||
|
||||
Under OS X (darwin), if /usr/include is missing, warnings
|
||||
are issued to help the user use xcode-select --install
|
||||
so that one may properly compile C code.
|
||||
|
||||
Lowered REDC levels:
|
||||
|
||||
#define MAXREDC 256 /* number of entries in REDC cache */
|
||||
|
||||
#define SQ_ALG2 28 /* size for alternative squaring */
|
||||
config("sq2") == 28 /* was 3388 */
|
||||
#define MUL_ALG2 28 /* size for alternative multiply */
|
||||
config("mul2") == 28 /* was 1780 */
|
||||
#define POW_ALG2 20 /* size for using REDC for powers */
|
||||
config("pow2") == 20 /* was 176 */
|
||||
#define REDC_ALG2 25 /* size for using alternative REDC */
|
||||
config("redc2") == 25 /* was 220 */
|
||||
|
||||
The alg_config.cal script appears to be not correctly finding the
|
||||
best REDC values. While it has been improved, alg_config.cal still
|
||||
seems to be suspect on how it attempts to find the best values.
|
||||
|
||||
Fixed an intro help file mistake found by Roger Hardiman
|
||||
<roger at rjh dot org dot uk>.
|
||||
|
||||
|
||||
The following are the changes from calc version 2.12.5.0 to 2.12.5.1:
|
||||
|
||||
Calc has a new calc-tester mailing list. This list is for those
|
||||
who are using/testing calc. We also use this list to announce
|
||||
new versions of calc. To subscribe to the calc-tester mailing
|
||||
list, visit the following URL:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/calc-tester.html
|
||||
|
||||
This is a low volume moderated mailing list.
|
||||
|
||||
This mailing list replaces calc-tester at asthe dot com list.
|
||||
|
||||
If you need a human to help you with your mailing list subscription,
|
||||
please send EMail to our special:
|
||||
|
||||
calc-tester-maillist-help at asthe dot com
|
||||
|
||||
address. To be sure we see your EMail asking for help with your
|
||||
mailing list subscription, please use the following phase in your
|
||||
EMail Subject line:
|
||||
|
||||
calc tester mailing list help
|
||||
|
||||
That phrase in your subject line will help ensure your
|
||||
request will get past our anti-spam filters. You may have
|
||||
additional words in your subject line.
|
||||
|
||||
There is a new calc bug report EMail address:
|
||||
|
||||
calc-bug-report at asthe dot com
|
||||
|
||||
This replaces the old calc-bugs at asthe dot com address.
|
||||
|
||||
To be sure we see your EMail reporting a calc bug, please use the
|
||||
following phase in your EMail Subject line:
|
||||
|
||||
calc bug report
|
||||
|
||||
That phrase in your subject line will help ensure your
|
||||
request will get past our anti-spam filters. You may have
|
||||
additional words in your subject line.
|
||||
|
||||
However, you may find it more helpful to simply subscribe
|
||||
to the calc-tester mailing list (see above) and then to
|
||||
send your report to that mailing list as a wider set calc
|
||||
testers may be able to help you.
|
||||
|
||||
The following makefile rules that were related to printing the
|
||||
upper values of the calc version, rules that were made obsolete
|
||||
in calc version 2.12.4.14, have been removed:
|
||||
|
||||
calc_vers calc_ver calc_ve
|
||||
vers ver ve
|
||||
|
||||
Noted that the hash() builtin function, internally known as
|
||||
quickhash (used for internal objects such as the associative
|
||||
arrays as well as other internal processes) uses the deprcated
|
||||
32-bit FNV-0 hash. The use of this deprecated hash is sufficient
|
||||
for calc internal purposes. Use of FNV-1a is recommended for
|
||||
a general non-cryptographic quick hash.
|
||||
|
||||
|
||||
The following are the changes from calc version 2.12.4.14 to 2.12.5.0:
|
||||
|
||||
For Apple OS X / Darwin target:
|
||||
|
||||
MACOSX_DEPLOYMENT_TARGET is no longer defined
|
||||
using clang compiler
|
||||
|
||||
By default, -install-name is used when forming shared libs.
|
||||
To force -install-name to not be used, set SET_INSTALL_NAME=no.
|
||||
|
||||
The have_stdvs.c test uses <stdlib.h> and fixed va_start() test call
|
||||
that didn't use last arg.
|
||||
|
||||
Fixed math_fmt (printf) in value.c where a LEN (SB32) be printed as %d.
|
||||
|
||||
Fixed a significant bug where that resulted in an incorrect
|
||||
complex number comparison. Thanks goes to David Binderman
|
||||
<dcb314 at hotmail dot com> for identifying the subtle typo!
|
||||
|
||||
Make minor fixes to the make depend rule.
|
||||
|
||||
Fixed places were calc defined a reserved identifier that
|
||||
begin with either __ or _[A-Z]. For example, __FILE_H__ has
|
||||
been replaced with INCLUDE_FILE_H.
|
||||
|
||||
Fixed the addall3 example in the script help file. Thanks for this
|
||||
fix goes to Igor Furlan <igor dot furlan at gmail dot com>.
|
||||
|
||||
We made important fixes to the calc command line history:
|
||||
|
||||
Fixed a bug in the command line history where calc would somtimes
|
||||
crash. There was code that used memcpy() instead of memmove()
|
||||
that could corrupt the command line history when entering a
|
||||
into into history that was similar to a previous entry. Thanks
|
||||
goes to Einar Lielmanis <einars at spicausis dot lv> for first
|
||||
identifying this mistake.
|
||||
|
||||
The calc command line history code, in general was not robust.
|
||||
We made use a patch from Mathias Buhr <napcode at users dot sf
|
||||
dot net>, that while it uses a bit more memory: is much more
|
||||
flexible, readable and robust. This patch replaced the improer
|
||||
use of memcpy() (see above) with better code. Thanks!
|
||||
|
||||
The alg_config.cal calc resource file has been reworked to produce
|
||||
better diagnostics while attempting to determine the ideal values
|
||||
for mul2, sq2, and pow2. However, it has been shown that this
|
||||
code is not correct. Suggestions for a replacement are welcome!
|
||||
|
||||
calc -u 'read alg_config; config("user_debug", 2),; best_mul2();'
|
||||
calc -u 'read alg_config; config("user_debug", 2),; best_sq2();'
|
||||
calc -u 'read alg_config; config("user_debug", 2),; best_pow2();'
|
||||
|
||||
Fixed a number of pedantic compiler warnings.
|
||||
|
||||
Removed -W and -Wno-comment from the the CCWARN makefile variable.
|
||||
|
||||
Removed no_implicit.arg makefile rule. Removed HAVE_NO_IMPLICIT
|
||||
makefile variable. Removed no_implicit.c source file.
|
||||
|
||||
Added WNO_IMPLICT makefile variable to hold the compiler flag
|
||||
-Wno-implicit for use on selective compile lines.
|
||||
|
||||
Added WNO_ERROR_LONG_LONG makefile variable to hold the compiler flag
|
||||
-Wno-error=long-long for use on selective compile lines.
|
||||
|
||||
Added WNO_LONG_LONG makefile variable to hold the compiler flag
|
||||
-Wno-long-long for use on selective compile lines.
|
||||
|
||||
The makefile variable ${MKDIR_ARG} has been replaced with just -p.
|
||||
|
||||
Minor fixes were made to the calc.spec.in file.
|
||||
|
||||
The target rpm architecture changed from i686 to x86_64. For those
|
||||
who do not run machine with x86_64, we continue to release a src
|
||||
rpm. For those without the ability to process an rpm, we will always
|
||||
to release src tarball.
|
||||
|
||||
When building the libcalc and libcustcalc shared libraries,
|
||||
ONLY the .so and .so.${VERSION} files are created. The .so is
|
||||
a symlink to the .so.${VERSION} file. Here ${VERSION} is the
|
||||
full "w.x.y.z" calc version.
|
||||
|
||||
|
||||
The following are the changes from calc version 2.12.4.11 to 2.12.4.13:
|
||||
|
||||
Fixed many typos in comments of the Makefile thanks to the review
|
||||
work of Michael Somos.
|
||||
@@ -6944,7 +7196,7 @@ Following is a list of visible changes to calc from version 1.24.7 to 1.26.1:
|
||||
|
||||
A small bug in the library file regress.cal was fixed.
|
||||
|
||||
## Copyright (C) 2001 Landon Curt Noll
|
||||
## Copyright (C) 2001-2017 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
|
||||
@@ -6960,9 +7212,9 @@ 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.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.38 $
|
||||
## @(#) $Id: CHANGES,v 30.38 2013/09/27 08:59:43 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/RCS/CHANGES,v $
|
||||
## @(#) $Revision: 30.55 $
|
||||
## @(#) $Id: CHANGES,v 30.55 2017/05/21 02:22:22 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc-RHEL7/RCS/CHANGES,v $
|
||||
##
|
||||
## Under source code control: 1993/06/02 18:12:57
|
||||
## File existed as early as: 1989
|
||||
|
65
COPYING
65
COPYING
@@ -6,14 +6,14 @@ This file is Copyrighted
|
||||
|
||||
This file is covered under the following Copyright:
|
||||
|
||||
Copyright (C) 1999-2008 Landon Curt Noll
|
||||
Copyright (C) 1999-2014 Landon Curt Noll
|
||||
All rights reserved.
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
# @(#) $Revision: 30.4 $
|
||||
# @(#) $Id: COPYING,v 30.4 2013/09/01 20:14:30 chongo Exp $
|
||||
# @(#) $Revision: 30.6 $
|
||||
# @(#) $Id: COPYING,v 30.6 2014/10/12 12:23:43 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc/RCS/COPYING,v $
|
||||
|
||||
-=-
|
||||
@@ -53,45 +53,62 @@ Calc is covered by the GNU Lesser General Public License
|
||||
Boston, MA 02110-1301
|
||||
USA
|
||||
|
||||
The contact addresses for calc is as follows:
|
||||
To subscribe to the calc-tester mailing list, visit the following URL:
|
||||
|
||||
Web: http://www.isthe.com/chongo/tech/comp/calc/email.html
|
||||
http://www.isthe.com/chongo/tech/comp/calc/calc-tester.html
|
||||
|
||||
To join the low volume calc mailing list. Send a EMail message to:
|
||||
This is a low volume moderated mailing list.
|
||||
|
||||
calc-tester-request at asthe dot com
|
||||
This mailing list replaces calc-tester at asthe dot com list.
|
||||
|
||||
Your subject must contain the words:
|
||||
If you need a human to help you with your mailing list subscription,
|
||||
please send EMail to our special:
|
||||
|
||||
calc mailing list subscription
|
||||
calc-tester-maillist-help at asthe dot com
|
||||
|
||||
You may have additional words in your subject line.
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
|
||||
Your message body (not the subject) should consist of:
|
||||
address. To be sure we see your EMail asking for help with your
|
||||
mailing list subscription, please use the following phase in your
|
||||
EMail Subject line:
|
||||
|
||||
subscribe calc-tester address
|
||||
end
|
||||
name your_full_name
|
||||
calc tester mailing list help
|
||||
|
||||
where ``address'' is your EMail address and ``your_full_name'' is
|
||||
your full name.
|
||||
|
||||
Feel free to follow the name line with additional EMail text as desired.
|
||||
That phrase in your subject line will help ensure your
|
||||
request will get past our anti-spam filters. You may have
|
||||
additional words in your subject line.
|
||||
|
||||
-=-
|
||||
|
||||
Calc bug reports and calc bug fixes should be sent to:
|
||||
|
||||
calc-bugs at asthe dot com
|
||||
calc-bug-report at asthe dot com
|
||||
|
||||
[[ NOTE: Replace 'at' with @, 'dot' is with . and remove the spaces ]]
|
||||
[[ NOTE: The EMail address uses 'asthe' and the web site URL uses 'isthe' ]]
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
|
||||
Your subject must contain the words:
|
||||
This replaces the old calc-bugs at asthe dot com address.
|
||||
|
||||
calc bug report
|
||||
To be sure we see your EMail reporting a calc bug, please use the
|
||||
following phase in your EMail Subject line:
|
||||
|
||||
You may have additional words in your subject line.
|
||||
calc bug report
|
||||
|
||||
That phrase in your subject line will help ensure your
|
||||
request will get past our anti-spam filters. You may have
|
||||
additional words in your subject line.
|
||||
|
||||
However, you may find it more helpful to simply subscribe
|
||||
to the calc-tester mailing list (see above) and then to
|
||||
send your report to that mailing list as a wider set calc
|
||||
testers may be able to help you.
|
||||
|
||||
-=-
|
||||
|
||||
The calc web site is located at:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
||||
NOTE: The EMail address uses 'asthe', while the web site uses 'isthe'.
|
||||
|
||||
-=-
|
||||
|
||||
|
519
Makefile.simple
519
Makefile.simple
File diff suppressed because it is too large
Load Diff
66
README
66
README
@@ -73,52 +73,64 @@ for a wish/todo list. Code contributions are welcome.
|
||||
|
||||
=-=
|
||||
|
||||
To join the calc-tester mailing list. Send an EMail message to:
|
||||
To subscribe to the calc-tester mailing list, visit the following URL:
|
||||
|
||||
calc-tester-request at asthe dot com
|
||||
http://www.isthe.com/chongo/tech/comp/calc/calc-tester.html
|
||||
|
||||
[[ NOTE: Replace 'at' with @, 'dot' is with . and remove the spaces ]]
|
||||
[[ NOTE: The EMail address uses 'asthe' and the web site URL uses 'isthe' ]]
|
||||
This is a low volume moderated mailing list.
|
||||
|
||||
Your subject must contain the words:
|
||||
This mailing list replaces calc-tester at asthe dot com list.
|
||||
|
||||
calc mailing list subscription
|
||||
If you need a human to help you with your mailing list subscription,
|
||||
please send EMail to our special:
|
||||
|
||||
You may have additional words in your subject line.
|
||||
calc-tester-maillist-help at asthe dot com
|
||||
|
||||
Your message body (not the subject) should consist of:
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
|
||||
subscribe calc-tester address
|
||||
end
|
||||
name your_full_name
|
||||
address. To be sure we see your EMail asking for help with your
|
||||
mailing list subscription, please use the following phase in your
|
||||
EMail Subject line:
|
||||
|
||||
where ``address'' is your EMail address and ``your_full_name'' is
|
||||
your full name.
|
||||
calc tester mailing list help
|
||||
|
||||
Feel free to follow the name line with additional EMail text as desired.
|
||||
That phrase in your subject line will help ensure your
|
||||
request will get past our anti-spam filters. You may have
|
||||
additional words in your subject line.
|
||||
|
||||
=-=
|
||||
-=-
|
||||
|
||||
Send Calc bug and bug fixes to:
|
||||
Calc bug reports and calc bug fixes should be sent to:
|
||||
|
||||
calc-bugs at asthe dot com
|
||||
calc-bug-report at asthe dot com
|
||||
|
||||
[[ NOTE: Replace 'at' with @, 'dot' is with . and remove the spaces ]]
|
||||
[[ NOTE: The EMail address uses 'asthe' and the web site URL uses 'isthe' ]]
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
|
||||
but see the BUGS file first.
|
||||
This replaces the old calc-bugs at asthe dot com address.
|
||||
|
||||
Your subject must contain the words:
|
||||
To be sure we see your EMail reporting a calc bug, please use the
|
||||
following phase in your EMail Subject line:
|
||||
|
||||
calc bug report
|
||||
calc bug report
|
||||
|
||||
You may have additional words in your subject line.
|
||||
That phrase in your subject line will help ensure your
|
||||
request will get past our anti-spam filters. You may have
|
||||
additional words in your subject line.
|
||||
|
||||
However, you may find it more helpful to simply subscribe
|
||||
to the calc-tester mailing list (see above) and then to
|
||||
send your report to that mailing list as a wider set calc
|
||||
testers may be able to help you.
|
||||
|
||||
-=-
|
||||
|
||||
The calc web site is located at:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/
|
||||
http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
NOTE: The EMail address uses 'asthe', while the web site uses 'isthe'.
|
||||
|
||||
## Copyright (C) 1999,2014 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
|
||||
@@ -134,8 +146,8 @@ The calc web site is located at:
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: README,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
## @(#) $Revision: 30.3 $
|
||||
## @(#) $Id: README,v 30.3 2014/10/12 12:23:43 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/RCS/README,v $
|
||||
##
|
||||
## Under source code control: 1995/10/25 05:27:59
|
||||
|
12
alloc.h
12
alloc.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* alloc - storage allocation and storage debug macros
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
* Copyright (C) 1999-2007,2014 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: alloc.h,v 30.3 2013/08/11 08:41:38 chongo Exp $
|
||||
* @(#) $Revision: 30.5 $
|
||||
* @(#) $Id: alloc.h,v 30.5 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/alloc.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:29
|
||||
@@ -28,8 +28,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__ALLOC_H__)
|
||||
#define __ALLOC_H__
|
||||
#if !defined(INCLUDE_ALLOC_H)
|
||||
#define INCLUDE_ALLOC_H
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
@@ -92,4 +92,4 @@ E_FUNC int strcmp();
|
||||
E_FUNC void *memmove(void *s1, CONST void *s2, MEMMOVE_SIZE_T n);
|
||||
#endif
|
||||
|
||||
#endif /* !__ALLOC_H__ */
|
||||
#endif /* !INCLUDE_ALLOC_H */
|
||||
|
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: assocfunc.c,v 30.2 2013/08/11 08:41:38 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: assocfunc.c,v 30.3 2014/09/30 00:55:11 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/assocfunc.c,v $
|
||||
*
|
||||
* Under source code control: 1993/07/20 23:04:27
|
||||
@@ -83,7 +83,7 @@ associndex(ASSOC *ap, BOOL create, long dim, VALUE *indices)
|
||||
* so that we can first select the correct hash chain, and
|
||||
* also so we can quickly compare each element for a match.
|
||||
*/
|
||||
hash = FNV1_32_BASIS;
|
||||
hash = QUICKHASH_BASIS;
|
||||
for (i = 0; i < dim; i++)
|
||||
hash = hashvalue(&indices[i], hash);
|
||||
|
||||
|
12
blkcpy.h
12
blkcpy.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* blkcpy - general values and related routines used by the calculator
|
||||
*
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll and Ernest Bowen
|
||||
* Copyright (C) 1999-2007,2014 Landon Curt Noll and Ernest Bowen
|
||||
*
|
||||
* Primary author: Landon Curt Noll
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: blkcpy.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: blkcpy.h,v 30.3 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/blkcpy.h,v $
|
||||
*
|
||||
* Under source code control: 1997/04/18 20:41:25
|
||||
@@ -30,8 +30,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__BLKCPY_H__)
|
||||
#define __BLKCPY_H__
|
||||
#if !defined(INCLUDE_BLKCPY_H)
|
||||
#define INCLUDE_BLKCPY_H
|
||||
|
||||
/*
|
||||
* the main copy gateway function
|
||||
@@ -59,4 +59,4 @@ E_FUNC int copystr2blk(STRING *, long, long, BLOCK *, long, BOOL);
|
||||
E_FUNC int copystr2file(STRING *, long, long, FILEID, long);
|
||||
E_FUNC int copystr2str(STRING *, long, long, STRING *, long);
|
||||
|
||||
#endif /* !__BLKCPY_H__ */
|
||||
#endif /* !INCLUDE_BLKCPY_H */
|
||||
|
12
block.h
12
block.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* block - fixed, dynamic, fifo and circular memory blocks
|
||||
*
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll and Ernest Bowen
|
||||
* Copyright (C) 1999-2007,2014 Landon Curt Noll and Ernest Bowen
|
||||
*
|
||||
* Primary author: Landon Curt Noll
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: block.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: block.h,v 30.3 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/block.h,v $
|
||||
*
|
||||
* Under source code control: 1997/02/21 05:03:39
|
||||
@@ -31,8 +31,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__BLOCK_H__)
|
||||
#define __BLOCK_H__
|
||||
#if !defined(INCLUDE_BLOCK_H)
|
||||
#define INCLUDE_BLOCK_H
|
||||
|
||||
|
||||
/*
|
||||
@@ -222,4 +222,4 @@ E_FUNC int countnblocks(void);
|
||||
E_FUNC void shownblocks(void);
|
||||
|
||||
|
||||
#endif /* !__BLOCK_H__ */
|
||||
#endif /* !INCLUDE_BLOCK_H */
|
||||
|
12
byteswap.h
12
byteswap.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* byteswap - byte swapping macros
|
||||
*
|
||||
* Copyright (C) 1999 Landon Curt Noll
|
||||
* Copyright (C) 1999,2014 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: byteswap.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: byteswap.h,v 30.3 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/byteswap.h,v $
|
||||
*
|
||||
* Under source code control: 1995/10/11 04:44:01
|
||||
@@ -29,8 +29,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__BYTESWAP_H__)
|
||||
#define __BYTESWAP_H__
|
||||
#if !defined(INCLUDE_BYTESWAP_H)
|
||||
#define INCLUDE_BYTESWAP_H
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
@@ -178,4 +178,4 @@
|
||||
#endif /* LONG_BITS == 64 */
|
||||
|
||||
|
||||
#endif /* !__BYTESWAP_H__ */
|
||||
#endif /* !INCLUDE_BYTESWAP_H */
|
||||
|
61
cal/Makefile
61
cal/Makefile
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# cal - makefile for calc standard resource files
|
||||
#
|
||||
# Copyright (C) 1999-2006 Landon Curt Noll
|
||||
# Copyright (C) 1999-2006,2017 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
|
||||
@@ -18,9 +18,9 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# @(#) $Revision: 30.10 $
|
||||
# @(#) $Id: Makefile,v 30.10 2013/09/02 03:02:00 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc/cal/RCS/Makefile,v $
|
||||
# @(#) $Revision: 30.12 $
|
||||
# @(#) $Id: Makefile,v 30.12 2017/05/19 16:09:14 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc-RHEL7/cal/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1991/07/21 05:00:54
|
||||
# File existed as early as: 1991
|
||||
@@ -199,7 +199,7 @@ CALC_FILES= README alg_config.cal beer.cal bernoulli.cal \
|
||||
constants.cal deg.cal dms.cal dotest.cal ellip.cal factorial.cal \
|
||||
factorial2.cal gvec.cal hello.cal hms.cal infinities.cal \
|
||||
intfile.cal intnum.cal lambertw.cal linear.cal lnseries.cal \
|
||||
lucas.cal lucas_chk.cal lucas_tbl.cal mersenne.cal mfactor.cal \
|
||||
lucas.cal lucas_chk.cal mersenne.cal mfactor.cal \
|
||||
mod.cal natnumset.cal pell.cal pi.cal pix.cal pollard.cal poly.cal \
|
||||
prompt.cal psqrt.cal qtime.cal quat.cal randbitrun.cal randmprime.cal \
|
||||
randombitrun.cal randomrun.cal randrun.cal regress.cal repeat.cal \
|
||||
@@ -211,6 +211,10 @@ CALC_FILES= README alg_config.cal beer.cal bernoulli.cal \
|
||||
test8400.cal test8500.cal test8600.cal test8900.cal toomcook.cal \
|
||||
unitfrac.cal varargs.cal xx_print.cal zeta2.cal
|
||||
|
||||
# These calc files are now obsolete and are removed by the install rule.
|
||||
#
|
||||
DEAD_CALC_FILES= lucas_tbl.cal
|
||||
|
||||
# These files are found (but not built) in the distribution
|
||||
#
|
||||
DISTLIST= ${CALC_FILES} ${MAKE_FILE}
|
||||
@@ -301,6 +305,23 @@ clean:
|
||||
|
||||
clobber: clean
|
||||
${RM} -f .all
|
||||
-${Q} if [ -e .DS_Store ]; then \
|
||||
echo ${RM} -rf .DS_Store; \
|
||||
${RM} -rf .DS_Store; \
|
||||
fi
|
||||
-${Q} for i in ${DEAD_CALC_FILES} /dev/null; do \
|
||||
if [ "$$i" = "/dev/null" ]; then \
|
||||
continue; \
|
||||
fi; \
|
||||
if [ -e "${T}${CALC_SHAREDIR}/$$i" ]; then \
|
||||
echo "${RM} -f ${T}${CALC_SHAREDIR}/$$i"; \
|
||||
${RM} -f ${T}${CALC_SHAREDIR}/$$i; \
|
||||
fi; \
|
||||
if [ -e "./$$i" ]; then \
|
||||
echo "${RM} -f ./$$i"; \
|
||||
${RM} -f ./$$i; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
# install everything
|
||||
#
|
||||
@@ -308,8 +329,8 @@ clobber: clean
|
||||
#
|
||||
install: all
|
||||
-${Q} if [ ! -d ${T}${CALC_SHAREDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${CALC_SHAREDIR}; \
|
||||
${MKDIR} ${T}${CALC_SHAREDIR}; \
|
||||
echo ${MKDIR} -p ${T}${CALC_SHAREDIR}; \
|
||||
${MKDIR} -p ${T}${CALC_SHAREDIR}; \
|
||||
if [ ! -d "${T}${CALC_SHAREDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${CALC_SHAREDIR}"; \
|
||||
${MKDIR} -p "${T}${CALC_SHAREDIR}"; \
|
||||
@@ -333,12 +354,38 @@ install: all
|
||||
echo "installed ${T}${CALC_SHAREDIR}/$$i"; \
|
||||
fi; \
|
||||
done
|
||||
${Q} for i in ${DEAD_CALC_FILES} /dev/null; do \
|
||||
if [ "$$i" = "/dev/null" ]; then \
|
||||
continue; \
|
||||
fi; \
|
||||
if [ -e "${T}${CALC_SHAREDIR}/$$i" ]; then \
|
||||
echo "${RM} -f ${T}${CALC_SHAREDIR}/$$i"; \
|
||||
${RM} -f ${T}${CALC_SHAREDIR}/$$i; \
|
||||
fi; \
|
||||
if [ -e "./$$i" ]; then \
|
||||
echo "${RM} -f ./$$i"; \
|
||||
${RM} -f ./$$i; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
# Try to remove everything that was installed
|
||||
#
|
||||
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
||||
#
|
||||
uninstall:
|
||||
- ${Q} for i in ${DEAD_CALC_FILES} /dev/null; do \
|
||||
if [ "$$i" = "/dev/null" ]; then \
|
||||
continue; \
|
||||
fi; \
|
||||
if [ -e "${T}${CALC_SHAREDIR}/$$i" ]; then \
|
||||
echo "${RM} -f ${T}${CALC_SHAREDIR}/$$i"; \
|
||||
${RM} -f ${T}${CALC_SHAREDIR}/$$i; \
|
||||
fi; \
|
||||
if [ -e "./$$i" ]; then \
|
||||
echo "${RM} -f ./$$i"; \
|
||||
${RM} -f ./$$i; \
|
||||
fi; \
|
||||
done
|
||||
-${Q} for i in ${CALC_FILES} /dev/null; do \
|
||||
if [ "$$i" = "/dev/null" ]; then \
|
||||
continue; \
|
||||
|
78
cal/README
78
cal/README
@@ -14,9 +14,12 @@ For example:
|
||||
|
||||
; read lucas
|
||||
lucas(h,n) defined
|
||||
gen_u2(h,n,v1) defined
|
||||
gen_u0(h,n,v1) defined
|
||||
rodseth_xhn(x,h,n) defined
|
||||
gen_v1(h,n) defined
|
||||
ldebug(funct,str) defined
|
||||
legacy_gen_v1(h,n) defined
|
||||
|
||||
will cause calc to load and execute the 'lucas.cal' resource file.
|
||||
Executing the resource file will cause several functions to be defined.
|
||||
@@ -35,12 +38,44 @@ Calc resource file files are provided because they serve as examples of
|
||||
how use the calc language, and/or because the authors thought them to
|
||||
be useful!
|
||||
|
||||
If you write something that you think is useful, please send it to:
|
||||
If you write something that you think is useful, please join the
|
||||
low volume calc mailing list calc-tester. Then send your contribution
|
||||
to the calc-tester mailing list.
|
||||
|
||||
calc-contrib at asthe dot com
|
||||
To subscribe to the calc-tester mailing list, visit the following URL:
|
||||
|
||||
[[ NOTE: Replace 'at' with @, 'dot' is with . and remove the spaces ]]
|
||||
[[ NOTE: The EMail address uses 'asthe' and the web site URL uses 'isthe' ]]
|
||||
https://www.listbox.com/subscribe/?list_id=239342
|
||||
|
||||
To help determine you are a human and not just a spam bot,
|
||||
you will be required to provide the following additional info:
|
||||
|
||||
Your Name
|
||||
Calc Version
|
||||
Operating System
|
||||
The date 7 days ago
|
||||
|
||||
This is a low volume moderated mailing list.
|
||||
|
||||
This mailing list replaces calc-tester at asthe dot com list.
|
||||
|
||||
If you need a human to help you with your mailing list subscription,
|
||||
please send EMail to our special:
|
||||
|
||||
calc-tester-maillist-help at asthe dot com
|
||||
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
|
||||
address. To be sure we see your EMail asking for help with your
|
||||
mailing list subscription, please use the following phase in your
|
||||
EMail Subject line:
|
||||
|
||||
calc tester mailing list help
|
||||
|
||||
That phrase in your subject line will help ensure your
|
||||
request will get past our anti-spam filters. You may have
|
||||
additional words in your subject line.
|
||||
|
||||
=-=
|
||||
|
||||
By convention, a resource file only defines and/or initializes functions,
|
||||
objects and variables. (The regress.cal and testxxx.cal regression test
|
||||
@@ -760,7 +795,27 @@ lucas.cal
|
||||
|
||||
lucas(h, n)
|
||||
|
||||
Perform a primality test of h*2^n-1, with 1<=h<2*n.
|
||||
Perform a primality test of h*2^n-1.
|
||||
|
||||
gen_u2(h, n, v1)
|
||||
|
||||
Generate u(2) for h*2^n-1. This function is used by lucas(h, n),
|
||||
as the first term in the lucas sequence that is needed to
|
||||
prove that h*2^n-1 is prime or not prime.
|
||||
|
||||
NOTE: Some call this term u(0). The function gen_u0(h, n, v1)
|
||||
simply calls gen_u2(h, n, v1) for such people. :-)
|
||||
|
||||
gen_v1(h, v)
|
||||
|
||||
Generate v(1) for h*2^n-1. This function is used by lucas(h, n),
|
||||
via the gen_u2(h, n, v1), to supply the 3rd argument to gen_u2.
|
||||
|
||||
legacy_gen_v1(h, n)
|
||||
|
||||
Generate v(1) for h*2^n-1 using the legacy Amdahl 6 method.
|
||||
This function sometimes returns -1 for a few cases when
|
||||
h is a multiple of 3. This function is NOT used by lucas(h, n).
|
||||
|
||||
|
||||
lucas_chk.cal
|
||||
@@ -773,11 +828,6 @@ lucas_chk.cal
|
||||
Used by regress.cal during the 2100 test set.
|
||||
|
||||
|
||||
lucas_tbl.cal
|
||||
|
||||
Lucasian criteria for primality tables.
|
||||
|
||||
|
||||
mersenne.cal
|
||||
|
||||
mersenne(p)
|
||||
@@ -1766,7 +1816,7 @@ zeta2.cal
|
||||
for information on this special zeta function.
|
||||
|
||||
|
||||
## Copyright (C) 2000 David I. Bell and Landon Curt Noll
|
||||
## Copyright (C) 2000,2014,2017 David I. Bell and Landon Curt Noll
|
||||
##
|
||||
## Primary author: Landon Curt Noll
|
||||
##
|
||||
@@ -1784,9 +1834,9 @@ zeta2.cal
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.8 $
|
||||
## @(#) $Id: README,v 30.8 2013/09/02 01:46:05 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/cal/RCS/README,v $
|
||||
## @(#) $Revision: 30.10 $
|
||||
## @(#) $Id: README,v 30.10 2017/05/19 16:09:14 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc-RHEL7/cal/RCS/README,v $
|
||||
##
|
||||
## Under source code control: 1990/02/15 01:50:32
|
||||
## File existed as early as: before 1990
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* alg_config - help determine optimal values for algorithm levels
|
||||
*
|
||||
* Copyright (C) 2006 Landon Curt Noll
|
||||
* Copyright (C) 2006,2014 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: alg_config.cal,v 30.2 2013/08/11 08:41:38 chongo Exp $
|
||||
* @(#) $Revision: 30.12 $
|
||||
* @(#) $Id: alg_config.cal,v 30.12 2016/02/06 08:38:56 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/alg_config.cal,v $
|
||||
*
|
||||
* Under source code control: 2006/06/07 14:10:11
|
||||
@@ -28,8 +28,37 @@
|
||||
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
*/
|
||||
|
||||
static test_time; /* try for this many seconds in loop test */
|
||||
|
||||
global test_time; /* try for this many seconds in loop test */
|
||||
|
||||
/*
|
||||
* close_to_one - set to 1 if the ratio is close enough to 1
|
||||
*
|
||||
* given:
|
||||
* ratio the ratio of time between two algorithms
|
||||
*
|
||||
* retuns:
|
||||
* 1 When ratio is near 1.0
|
||||
* 0 otherwise
|
||||
*
|
||||
* We consider the range [0.995, 1.005] to be close enough to 1 to be call unity
|
||||
* because of the precision of the CPU timing.
|
||||
*/
|
||||
define close_to_one(ratio)
|
||||
{
|
||||
/* firewall */
|
||||
if (!isreal(ratio)) {
|
||||
quit "close: 1st arg: must be a real number";
|
||||
}
|
||||
|
||||
/* check if the ratio is far from unity */
|
||||
if ((ratio < 0.995) || (ratio > 1.005)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* we are close to unity */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@@ -143,7 +172,7 @@ define mul_loop(repeat, x)
|
||||
* len length in BASEB-bit words to multiply
|
||||
*
|
||||
* return:
|
||||
* ratio of (1st / 2nd) algorithm rate
|
||||
* ratio of (1st / 2nd) algorithm rate.
|
||||
*
|
||||
* When want to determine a rate to a precision of 1 part in 1000.
|
||||
* Most systems today return CPU time to at least 10 msec precision.
|
||||
@@ -166,6 +195,7 @@ define mul_ratio(len)
|
||||
local tover; /* est of time for loop overhead */
|
||||
local alg1_rate; /* loop rate of 1st algorithm */
|
||||
local alg2_rate; /* loop rate of 2nd algorithm */
|
||||
local ret; /* return ratio, or 1.0 */
|
||||
local i;
|
||||
|
||||
/*
|
||||
@@ -218,12 +248,12 @@ define mul_ratio(len)
|
||||
* determine the 1st algorithm rate
|
||||
*/
|
||||
loops = max(1, ceil(loops * test_time / tlen));
|
||||
if (loops < 8) {
|
||||
if (loops < 16) {
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" we must expand loop test time to more than %d secs\n",
|
||||
ceil(test_time * (8 / loops)));
|
||||
printf(" we must expand alg1 loop test time to about %d secs\n",
|
||||
ceil(test_time * (16 / loops)));
|
||||
}
|
||||
loops = 8;
|
||||
loops = 16;
|
||||
}
|
||||
if (config("user_debug") > 3) {
|
||||
printf("\t will try alg1 %d loops\n", loops);
|
||||
@@ -264,12 +294,12 @@ define mul_ratio(len)
|
||||
* determine the 2nd algorithm rate
|
||||
*/
|
||||
loops = max(1, ceil(loops * test_time / tlen));
|
||||
if (loops < 8) {
|
||||
if (loops < 16) {
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" we must expand loop test time to more than %d secs\n",
|
||||
ceil(test_time * (8 / loops)));
|
||||
printf(" we must expand alg2 loop test time to about %d secs\n",
|
||||
ceil(test_time * (16 / loops)));
|
||||
}
|
||||
loops = 8;
|
||||
loops = 16;
|
||||
}
|
||||
tlen = mul_loop(loops, &x);
|
||||
if (config("user_debug") > 3) {
|
||||
@@ -298,7 +328,12 @@ define mul_ratio(len)
|
||||
/*
|
||||
* return alg1 / alg2 rate ratio
|
||||
*/
|
||||
return (alg1_rate / alg2_rate);
|
||||
ret = alg1_rate / alg2_rate;
|
||||
if (config("user_debug") > 2) {
|
||||
printf("\tprecise ratio is: %.f mul_ratio will return: %.3f\n",
|
||||
alg1_rate / alg2_rate, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -320,30 +355,40 @@ define best_mul2()
|
||||
{
|
||||
local ratio; /* previously calculated alg1/alg2 ratio */
|
||||
local low; /* low loop value tested */
|
||||
local high; /* low loop value tested */
|
||||
local high; /* high loop value tested */
|
||||
local mid; /* between low and high */
|
||||
local best_val; /* value found with ratio closest to unity */
|
||||
local best_ratio; /* cloest ratio found to unity */
|
||||
local expand; /* how fast to expand the length */
|
||||
|
||||
/*
|
||||
* setup
|
||||
*/
|
||||
test_time = 15.0;
|
||||
if (config("user_debug") > 0) {
|
||||
printf("will start with loop test time of %d secs\n", test_time);
|
||||
printf("WARNING: This tool may not be computing the correct best value\n");
|
||||
test_time = 5.0;
|
||||
printf("The best_mul2() function will take a LONG time to run!\n");
|
||||
printf("It is important that best_mul2() run on an othwewise idle host!\n");
|
||||
if (config("user_debug") <= 0) {
|
||||
printf("To monitor progress, set user_debug to 2: "
|
||||
"config(\"user_debug\", 2)\n");
|
||||
}
|
||||
printf("Starting with loop test time of %d secs\n", test_time);
|
||||
|
||||
/*
|
||||
* firewall - must have a >1 ratio for the initial length
|
||||
*/
|
||||
high = 16;
|
||||
high = 8;
|
||||
best_val = high;
|
||||
if (config("user_debug") > 0) {
|
||||
printf("testing multiply alg1/alg2 ratio for len = %d\n", high);
|
||||
}
|
||||
ratio = mul_ratio(high);
|
||||
best_ratio = ratio;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" multiply alg1/alg2 ratio = %.3f\n", ratio);
|
||||
printf(" multiply alg1/alg2 ratio = %.6f\n", ratio);
|
||||
}
|
||||
if (ratio <= 1.0) {
|
||||
quit "best_mul2: tests imply config(\"mul2\") should be < 4";
|
||||
if (ratio < 1.0) {
|
||||
quit "best_mul2: tests imply mul2 should be < 16, which seems bogus";
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -356,7 +401,7 @@ define best_mul2()
|
||||
* We will multiplicatively expand our test level until
|
||||
* the ratio drops below 1.0.
|
||||
*/
|
||||
expand = ((ratio >= 3.5) ? 16 : 2^round(ratio));
|
||||
expand = 2;
|
||||
low = high;
|
||||
high *= expand;
|
||||
if (config("user_debug") > 1) {
|
||||
@@ -368,20 +413,63 @@ define best_mul2()
|
||||
* determine the alg1/alg2 test ratio for this new length
|
||||
*/
|
||||
if (high >= 2^31) {
|
||||
quit "best_mul2: tests imply config(\"mul2\") should be >= 2^31";
|
||||
quit "best_mul2: test implies mul2 >= 2^31, which seems bogus";
|
||||
}
|
||||
if (config("user_debug") > 0) {
|
||||
printf("testing multiply alg1/alg2 ratio for len = %d\n", high);
|
||||
}
|
||||
ratio = mul_ratio(high);
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" multiply alg1/alg2 ratio = %.3f\n", ratio);
|
||||
if (abs(ratio - 1.0) < abs(best_ratio - 1.0)) {
|
||||
best_val = high;
|
||||
best_ratio = ratio;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
||||
best_val, best_ratio);
|
||||
}
|
||||
}
|
||||
} while (ratio >= 1.0);
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" multiply alg1/alg2 ratio = %.6f\n", ratio);
|
||||
}
|
||||
} while (ratio > 1.0);
|
||||
|
||||
/*
|
||||
* If we previously expanded more than by a factor of 2, then
|
||||
* we may have jumped over the crossover point. So now
|
||||
* drop down powers of two until the ratio is again >= 1.0
|
||||
*/
|
||||
if (expand > 2) {
|
||||
do {
|
||||
|
||||
/*
|
||||
* contract by 2
|
||||
*/
|
||||
high /= 2;
|
||||
low = high / 2;
|
||||
if (config("user_debug") > 0) {
|
||||
printf("retesting multiply alg1/alg2 ratio for len = %d\n",
|
||||
high);
|
||||
}
|
||||
ratio = mul_ratio(high);
|
||||
if (abs(ratio - 1.0) < abs(best_ratio - 1.0)) {
|
||||
best_val = high;
|
||||
best_ratio = ratio;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
||||
best_val, best_ratio);
|
||||
}
|
||||
}
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" multiply alg1/alg2 ratio = %.6f\n", ratio);
|
||||
}
|
||||
|
||||
} while (ratio <= 1.0);
|
||||
|
||||
/* now that the ratio flipped again, use the previous range */
|
||||
low = high;
|
||||
high = high * 2;
|
||||
}
|
||||
if (config("user_debug") > 0) {
|
||||
printf("alg1/alg2 ratio now < 1.0, starting binary search "
|
||||
"between %d and %d\n",
|
||||
low, high);
|
||||
printf("Starting binary search between %d and %d\n", low, high);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -390,30 +478,54 @@ define best_mul2()
|
||||
while (low+1 < high) {
|
||||
|
||||
/* try the mid-point */
|
||||
mid = int((low+high)/2);
|
||||
if (config("user_debug") > 0) {
|
||||
printf("testing multiply alg1/alg2 ratio for len = %d\n",
|
||||
int((low+high)/2));
|
||||
printf("testing multiply alg1/alg2 ratio for len = %d\n", mid);
|
||||
}
|
||||
ratio = mul_ratio(mid);
|
||||
if (abs(ratio - 1.0) < abs(best_ratio - 1.0)) {
|
||||
best_val = mid;
|
||||
best_ratio = ratio;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
||||
best_val, best_ratio);
|
||||
}
|
||||
}
|
||||
ratio = mul_ratio(int((low+high)/2));
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" multiply alg1/alg2 ratio = %.3f\n", ratio);
|
||||
printf(" len %d multiply alg1/alg2 ratio = %.6f\n", mid, ratio);
|
||||
}
|
||||
|
||||
/* stop search if near unity */
|
||||
if (close_to_one(ratio)) {
|
||||
low = mid;
|
||||
high = mid;
|
||||
if (config("user_debug") > 0) {
|
||||
printf("\twe are close enough to unity ratio at: %d\n", mid);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* bump lower range up if we went over */
|
||||
if (ratio >= 1.0) {
|
||||
if (ratio > 1.0) {
|
||||
if (config("user_debug") > 2) {
|
||||
printf("\tmove low from %d up to %d\n",
|
||||
low, int((low+high)/2));
|
||||
low, mid);
|
||||
}
|
||||
low = int((low+high)/2);
|
||||
low = mid;
|
||||
|
||||
/* drop higher range down if we went under */
|
||||
} else {
|
||||
if (config("user_debug") > 2) {
|
||||
printf("\tmove high from %d down to %d\n",
|
||||
high, int((low+high)/2));
|
||||
high, mid);
|
||||
}
|
||||
high = int((low+high)/2);
|
||||
high = mid;
|
||||
}
|
||||
|
||||
/* report on test loop progress */
|
||||
if (config("user_debug") > 1) {
|
||||
printf("\tsetting low: %d high: %d diff: %d\n",
|
||||
low, high, high-low);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,10 +533,15 @@ define best_mul2()
|
||||
* return on the suggested config("mul2") value
|
||||
*/
|
||||
if (config("user_debug") > 0) {
|
||||
printf("best value of config(\"mul2\") is %d\n",
|
||||
(ratio >= 1.0) ? high : low);
|
||||
printf("Best value for multiply is near %d\n", best_val);
|
||||
printf("Best multiply alg1/alg2 ratio is: %.6f\n", best_ratio);
|
||||
printf("We suggest placing this line in your .calcrc:\n");
|
||||
printf("config(\"mul2\", %d),;\n", best_val);
|
||||
printf("WARNING: It is believed that the output "
|
||||
"of this resource file is bogus!\n");
|
||||
printf("WARNING: You may NOT wish to follow the above suggeston.\n");
|
||||
}
|
||||
return ((ratio >= 1.0) ? high : low);
|
||||
return mid;
|
||||
}
|
||||
|
||||
|
||||
@@ -562,6 +679,7 @@ define sq_ratio(len)
|
||||
local tover; /* est of time for loop overhead */
|
||||
local alg1_rate; /* loop rate of 1st algorithm */
|
||||
local alg2_rate; /* loop rate of 2nd algorithm */
|
||||
local ret; /* return ratio, or 1.0 */
|
||||
local i;
|
||||
|
||||
/*
|
||||
@@ -614,12 +732,12 @@ define sq_ratio(len)
|
||||
* determine the 1st algorithm rate
|
||||
*/
|
||||
loops = max(1, ceil(loops * test_time / tlen));
|
||||
if (loops < 8) {
|
||||
if (loops < 16) {
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" we must expand loop test time to more than %d secs\n",
|
||||
ceil(test_time * (8 / loops)));
|
||||
printf(" we must expand alg1 loop test time to about %d secs\n",
|
||||
ceil(test_time * (16 / loops)));
|
||||
}
|
||||
loops = 8;
|
||||
loops = 16;
|
||||
}
|
||||
tlen = sq_loop(loops, &x);
|
||||
if (config("user_debug") > 3) {
|
||||
@@ -657,12 +775,12 @@ define sq_ratio(len)
|
||||
* determine the 2nd algorithm rate
|
||||
*/
|
||||
loops = max(1, ceil(loops * test_time / tlen));
|
||||
if (loops < 8) {
|
||||
if (loops < 16) {
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" we must expand loop test time to more than %d secs\n",
|
||||
ceil(test_time * (8 / loops)));
|
||||
printf(" we must expand alg2 loop test time to about %d secs\n",
|
||||
ceil(test_time * (16 / loops)));
|
||||
}
|
||||
loops = 8;
|
||||
loops = 16;
|
||||
}
|
||||
tlen = sq_loop(loops, &x);
|
||||
if (config("user_debug") > 3) {
|
||||
@@ -691,7 +809,12 @@ define sq_ratio(len)
|
||||
/*
|
||||
* return alg1 / alg2 rate ratio
|
||||
*/
|
||||
return (alg1_rate / alg2_rate);
|
||||
ret = alg1_rate / alg2_rate;
|
||||
if (config("user_debug") > 2) {
|
||||
printf("\tprecise ratio is: %.f sq_ratio will return: %.3f\n",
|
||||
alg1_rate / alg2_rate, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -713,30 +836,40 @@ define best_sq2()
|
||||
{
|
||||
local ratio; /* previously calculated alg1/alg2 ratio */
|
||||
local low; /* low loop value tested */
|
||||
local high; /* low loop value tested */
|
||||
local high; /* high loop value tested */
|
||||
local mid; /* between low and high */
|
||||
local best_val; /* value found with ratio closest to unity */
|
||||
local best_ratio; /* cloest ratio found to unity */
|
||||
local expand; /* how fast to expand the length */
|
||||
|
||||
/*
|
||||
* setup
|
||||
*/
|
||||
test_time = 15.0;
|
||||
if (config("user_debug") > 0) {
|
||||
printf("will start with loop test time of %d secs\n", test_time);
|
||||
printf("WARNING: This tool may not be computing the correct best value\n");
|
||||
test_time = 5.0;
|
||||
printf("The best_sq2() function will take a LONG time to run!\n");
|
||||
printf("It is important that best_sq2() run on an othwewise idle host!\n");
|
||||
if (config("user_debug") <= 0) {
|
||||
printf("To monitor progress, set user_debug to 2: "
|
||||
"config(\"user_debug\", 2)\n");
|
||||
}
|
||||
printf("Starting with loop test time of %d secs\n", test_time);
|
||||
|
||||
/*
|
||||
* firewall - must have a >1 ratio for the initial length
|
||||
*/
|
||||
high = 16;
|
||||
high = 8;
|
||||
best_val = high;
|
||||
if (config("user_debug") > 0) {
|
||||
printf("testing square alg1/alg2 ratio for len = %d\n", high);
|
||||
}
|
||||
ratio = sq_ratio(high);
|
||||
best_ratio = ratio;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" square alg1/alg2 ratio = %.3f\n", ratio);
|
||||
}
|
||||
if (ratio <= 1.0) {
|
||||
quit "best_sq2: tests imply config(\"sq2\") should be < 4";
|
||||
if (ratio < 1.0) {
|
||||
quit "best_sq2: test implies sq2 < 16, which seems bogus";
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -749,32 +882,75 @@ define best_sq2()
|
||||
* We will multiplicatively expand our test level until
|
||||
* the ratio drops below 1.0.
|
||||
*/
|
||||
expand = ((ratio >= 3.5) ? 16 : 2^round(ratio));
|
||||
expand = 2;
|
||||
low = high;
|
||||
high *= expand;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" expand the next test range by a factor of %d\n",
|
||||
expand);
|
||||
expand);
|
||||
}
|
||||
|
||||
/*
|
||||
* determine the alg1/alg2 test ratio for this new length
|
||||
*/
|
||||
if (high >= 2^31) {
|
||||
quit "best_sq2: tests imply config(\"sq2\") should be >= 2^31";
|
||||
quit "best_sq2: tests imply sq2 >= 2^31, which seems bogus";
|
||||
}
|
||||
if (config("user_debug") > 0) {
|
||||
printf("testing square alg1/alg2 ratio for len = %d\n", high);
|
||||
}
|
||||
ratio = sq_ratio(high);
|
||||
if (abs(ratio - 1.0) < abs(best_ratio - 1.0)) {
|
||||
best_val = high;
|
||||
best_ratio = ratio;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
||||
best_val, best_ratio);
|
||||
}
|
||||
}
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" square alg1/alg2 ratio = %.3f\n", ratio);
|
||||
}
|
||||
} while (ratio >= 1.0);
|
||||
} while (ratio > 1.0);
|
||||
|
||||
/*
|
||||
* If we previously expanded more than by a factor of 2, then
|
||||
* we may have jumped over the crossover point. So now
|
||||
* drop down powers of two until the ratio is again >= 1.0
|
||||
*/
|
||||
if (expand > 2) {
|
||||
do {
|
||||
|
||||
/*
|
||||
* contract by 2
|
||||
*/
|
||||
high /= 2;
|
||||
low = high / 2;
|
||||
if (config("user_debug") > 0) {
|
||||
printf("retesting multiply alg1/alg2 ratio for len = %d\n",
|
||||
high);
|
||||
}
|
||||
ratio = mul_ratio(high);
|
||||
if (abs(ratio - 1.0) < abs(best_ratio - 1.0)) {
|
||||
best_val = high;
|
||||
best_ratio = ratio;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
||||
best_val, best_ratio);
|
||||
}
|
||||
}
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" multiply alg1/alg2 ratio = %.6f\n", ratio);
|
||||
}
|
||||
|
||||
} while (ratio <= 1.0);
|
||||
|
||||
/* now that the ratio flipped again, use the previous range */
|
||||
low = high;
|
||||
high = high * 2;
|
||||
}
|
||||
if (config("user_debug") > 0) {
|
||||
printf("alg1/alg2 ratio now < 1.0, starting binary search "
|
||||
"between %d and %d\n",
|
||||
low, high);
|
||||
printf("Starting binary search between %d and %d\n", low, high);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -783,41 +959,71 @@ define best_sq2()
|
||||
while (low+1 < high) {
|
||||
|
||||
/* try the mid-point */
|
||||
mid = int((low+high)/2);
|
||||
if (config("user_debug") > 0) {
|
||||
printf("testing square alg1/alg2 ratio for len = %d\n",
|
||||
int((low+high)/2));
|
||||
printf("testing square alg1/alg2 ratio for len = %d\n", mid);
|
||||
}
|
||||
ratio = sq_ratio(mid);
|
||||
if (abs(ratio - 1.0) < abs(best_ratio - 1.0)) {
|
||||
best_val = mid;
|
||||
best_ratio = ratio;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
||||
best_val, best_ratio);
|
||||
}
|
||||
}
|
||||
ratio = sq_ratio(int((low+high)/2));
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" square alg1/alg2 ratio = %.3f\n", ratio);
|
||||
printf(" len %d square alg1/alg2 ratio = %.6f\n", mid, ratio);
|
||||
}
|
||||
|
||||
/* stop search if near unity */
|
||||
if (close_to_one(ratio)) {
|
||||
low = mid;
|
||||
high = mid;
|
||||
if (config("user_debug") > 0) {
|
||||
printf("\twe are close enough to unity ratio at: %d\n", mid);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* bump lower range up if we went over */
|
||||
if (ratio >= 1.0) {
|
||||
if (ratio > 1.0) {
|
||||
if (config("user_debug") > 2) {
|
||||
printf("\tmove low from %d up to %d\n",
|
||||
low, int((low+high)/2));
|
||||
low, mid);
|
||||
}
|
||||
low = int((low+high)/2);
|
||||
low = mid;
|
||||
|
||||
/* drop higher range down if we went under */
|
||||
} else {
|
||||
if (config("user_debug") > 2) {
|
||||
printf("\tmove high from %d down to %d\n",
|
||||
high, int((low+high)/2));
|
||||
high, mid);
|
||||
}
|
||||
high = int((low+high)/2);
|
||||
high = mid;
|
||||
}
|
||||
|
||||
/* report on test loop progress */
|
||||
if (config("user_debug") > 1) {
|
||||
printf("\tsetting low: %d high: %d diff: %d\n",
|
||||
low, high, high-low);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* return on the suggested config("sq2") value
|
||||
*/
|
||||
mid = int((low+high)/2);
|
||||
if (config("user_debug") > 0) {
|
||||
printf("best value of config(\"sq2\") is %d\n",
|
||||
(ratio >= 1.0) ? high : low);
|
||||
printf("Best value for square is near %d\n", best_val);
|
||||
printf("Best square alg1/alg2 ratio is: %.6f\n", best_ratio);
|
||||
printf("We suggest placing this line in your .calcrc:\n");
|
||||
printf("config(\"sq2\", %d),;\n", best_val);
|
||||
printf("WARNING: It is believed that the output "
|
||||
"of this resource file is bogus!\n");
|
||||
printf("WARNING: You may NOT wish to follow the above suggeston.\n");
|
||||
}
|
||||
return ((ratio >= 1.0) ? high : low);
|
||||
return mid;
|
||||
}
|
||||
|
||||
|
||||
@@ -968,6 +1174,7 @@ define pow_ratio(len)
|
||||
local alg1_rate; /* loop rate of 1st algorithm */
|
||||
local alg2_rate; /* loop rate of 2nd algorithm */
|
||||
local ex; /* exponent to use in pow_loop() */
|
||||
local ret; /* return ratio, or 1.0 */
|
||||
local i;
|
||||
|
||||
/*
|
||||
@@ -990,7 +1197,7 @@ define pow_ratio(len)
|
||||
/*
|
||||
* setup
|
||||
*/
|
||||
ex = 5;
|
||||
ex = 7;
|
||||
|
||||
/*
|
||||
* initialize x, the values we will pmod
|
||||
@@ -1026,12 +1233,12 @@ define pow_ratio(len)
|
||||
* determine the 1st algorithm rate
|
||||
*/
|
||||
loops = max(1, ceil(loops * test_time / tlen));
|
||||
if (loops < 8) {
|
||||
if (loops < 16) {
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" we must expand loop test time to more than %d secs\n",
|
||||
ceil(test_time * (8 / loops)));
|
||||
printf(" we must expand alg1 loop test time to about %d secs\n",
|
||||
ceil(test_time * (16 / loops)));
|
||||
}
|
||||
loops = 8;
|
||||
loops = 16;
|
||||
}
|
||||
tlen = pow_loop(loops, &x, ex);
|
||||
if (config("user_debug") > 3) {
|
||||
@@ -1070,12 +1277,12 @@ define pow_ratio(len)
|
||||
* determine the 2nd algorithm rate
|
||||
*/
|
||||
loops = max(1, ceil(loops * test_time / tlen));
|
||||
if (loops < 8) {
|
||||
if (loops < 16) {
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" we must expand loop test time to more than %d secs\n",
|
||||
ceil(test_time * (8 / loops)));
|
||||
printf(" we must expand alg2 loop test time to about %d secs\n",
|
||||
ceil(test_time * (16 / loops)));
|
||||
}
|
||||
loops = 8;
|
||||
loops = 16;
|
||||
}
|
||||
tlen = pow_loop(loops, &x, ex);
|
||||
if (config("user_debug") > 3) {
|
||||
@@ -1104,7 +1311,12 @@ define pow_ratio(len)
|
||||
/*
|
||||
* return alg1 / alg2 rate ratio
|
||||
*/
|
||||
return (alg1_rate / alg2_rate);
|
||||
ret = alg1_rate / alg2_rate;
|
||||
if (config("user_debug") > 2) {
|
||||
printf("\tprecise ratio is: %.f pow_ratio will return: %.3f\n",
|
||||
alg1_rate / alg2_rate, ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -1126,17 +1338,25 @@ define best_pow2()
|
||||
{
|
||||
local ratio; /* previously calculated alg1/alg2 ratio */
|
||||
local low; /* low loop value tested */
|
||||
local high; /* low loop value tested */
|
||||
local high; /* high loop value tested */
|
||||
local mid; /* between low and high */
|
||||
local best_val; /* value found with ratio closest to unity */
|
||||
local best_ratio; /* cloest ratio found to unity */
|
||||
local expand; /* how fast to expand the length */
|
||||
local looped; /* 1 ==> we have expanded lengths before */
|
||||
|
||||
/*
|
||||
* setup
|
||||
*/
|
||||
test_time = 15.0;
|
||||
if (config("user_debug") > 0) {
|
||||
printf("will start with loop test time of %d secs\n", test_time);
|
||||
printf("WARNING: This tool may not be computing the correct best value\n");
|
||||
test_time = 60.0;
|
||||
printf("The best_pow2() function will take a LONG time to run!\n");
|
||||
printf("It is important that best_pow2() run on an othwewise idle host!\n");
|
||||
if (config("user_debug") <= 0) {
|
||||
printf("To monitor progress, set user_debug to 2: "
|
||||
"config(\"user_debug\", 2)\n");
|
||||
}
|
||||
printf("Starting with loop test time of %d secs\n", test_time);
|
||||
|
||||
/*
|
||||
* firewall - must have a >1.02 ratio for the initial length
|
||||
@@ -1147,12 +1367,22 @@ define best_pow2()
|
||||
*/
|
||||
low = 4;
|
||||
high = 4;
|
||||
best_val = high;
|
||||
best_ratio = 1e10; /* not a real value */
|
||||
do {
|
||||
high *= 4;
|
||||
if (config("user_debug") > 0) {
|
||||
printf("testing pmod alg1/alg2 ratio for len = %d\n", high);
|
||||
}
|
||||
ratio = pow_ratio(high);
|
||||
if (abs(ratio - 1.0) < abs(best_ratio - 1.0)) {
|
||||
best_val = high;
|
||||
best_ratio = ratio;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
||||
best_val, best_ratio);
|
||||
}
|
||||
}
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" pmod alg1/alg2 ratio = %.3f\n", ratio);
|
||||
if (ratio > 1.0 && ratio <= 1.02) {
|
||||
@@ -1199,20 +1429,27 @@ define best_pow2()
|
||||
* determine the alg1/alg2 test ratio for this new length
|
||||
*/
|
||||
if (high >= 2^31) {
|
||||
quit "best_pow2: tests imply config(\"pow2\") should be >= 2^31";
|
||||
quit "best_pow2: test implies pow2 >= 2^31, which seems bogus";
|
||||
}
|
||||
if (config("user_debug") > 0) {
|
||||
printf("testing pmod alg1/alg2 ratio for len = %d\n", high);
|
||||
}
|
||||
ratio = pow_ratio(high);
|
||||
if (abs(ratio - 1.0) < abs(best_ratio - 1.0)) {
|
||||
best_val = high;
|
||||
best_ratio = ratio;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
||||
best_val, best_ratio);
|
||||
}
|
||||
}
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" pmod alg1/alg2 ratio = %.3f\n", ratio);
|
||||
printf(" pmod alg1/alg2 ratio = %.6f\n", ratio);
|
||||
}
|
||||
looped = 1;
|
||||
} while (ratio >= 1.0);
|
||||
} while (ratio > 1.0);
|
||||
if (config("user_debug") > 0) {
|
||||
printf("alg1/alg2 ratio now < 1.0, starting binary search "
|
||||
"between %d and %d\n", low, high);
|
||||
printf("Starting binary search between %d and %d\n", low, high);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1221,39 +1458,69 @@ define best_pow2()
|
||||
while (low+1 < high) {
|
||||
|
||||
/* try the mid-point */
|
||||
mid = int((low+high)/2);
|
||||
if (config("user_debug") > 0) {
|
||||
printf("testing pmod alg1/alg2 ratio for len = %d\n",
|
||||
int((low+high)/2));
|
||||
printf("testing pow2 alg1/alg2 ratio for len = %d\n", mid);
|
||||
}
|
||||
ratio = pow_ratio(mid);
|
||||
if (abs(ratio - 1.0) < abs(best_ratio - 1.0)) {
|
||||
best_val = mid;
|
||||
best_ratio = ratio;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
||||
best_val, best_ratio);
|
||||
}
|
||||
}
|
||||
ratio = pow_ratio(int((low+high)/2));
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" pmod alg1/alg2 ratio = %.3f\n", ratio);
|
||||
printf(" len %d pmod alg1/alg2 ratio = %.6f\n", mid, ratio);
|
||||
}
|
||||
|
||||
/* stop search if near unity */
|
||||
if (close_to_one(ratio)) {
|
||||
low = mid;
|
||||
high = mid;
|
||||
if (config("user_debug") > 0) {
|
||||
printf("\twe are close enough to unity ratio at: %d\n", mid);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* bump lower range up if we went over */
|
||||
if (ratio >= 1.0) {
|
||||
if (ratio > 1.0) {
|
||||
if (config("user_debug") > 2) {
|
||||
printf("\tmove low from %d up to %d\n",
|
||||
low, int((low+high)/2));
|
||||
low, mid);
|
||||
}
|
||||
low = int((low+high)/2);
|
||||
low = mid;
|
||||
|
||||
/* drop higher range down if we went under */
|
||||
} else {
|
||||
if (config("user_debug") > 2) {
|
||||
printf("\tmove high from %d down to %d\n",
|
||||
high, int((low+high)/2));
|
||||
high, mid);
|
||||
}
|
||||
high = int((low+high)/2);
|
||||
high = mid;
|
||||
}
|
||||
|
||||
/* report on test loop progress */
|
||||
if (config("user_debug") > 1) {
|
||||
printf("\tsetting low: %d high: %d diff: %d\n",
|
||||
low, high, high-low);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* return on the suggested config("pow2") value
|
||||
*/
|
||||
mid = int((low+high)/2);
|
||||
if (config("user_debug") > 0) {
|
||||
printf("best value of config(\"pow2\") is %d\n",
|
||||
(ratio >= 1.0) ? high : low);
|
||||
printf("Best value for pmod is near %d\n", best_val);
|
||||
printf("Best pmod alg1/alg2 ratio is: %.6f\n", best_ratio);
|
||||
printf("We suggest placing this line in your .calcrc:\n");
|
||||
printf("config(\"pow2\", %d),;\n", best_val);
|
||||
printf("WARNING: It is believed that the output "
|
||||
"of this resource file is bogus!\n");
|
||||
printf("WARNING: You may NOT wish to follow the above suggeston.\n");
|
||||
}
|
||||
return ((ratio >= 1.0) ? high : low);
|
||||
return mid;
|
||||
}
|
||||
|
666
cal/lucas.cal
666
cal/lucas.cal
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* lucas - perform a Lucas primality test on h*2^n-1
|
||||
*
|
||||
* Copyright (C) 1999 Landon Curt Noll
|
||||
* Copyright (C) 1999,2017 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
|
||||
@@ -17,9 +17,9 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: lucas.cal,v 30.2 2013/09/27 08:58:46 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/lucas.cal,v $
|
||||
* @(#) $Revision: 30.4 $
|
||||
* @(#) $Id: lucas.cal,v 30.4 2017/05/20 21:54:16 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc-RHEL7/cal/RCS/lucas.cal,v $
|
||||
*
|
||||
* Under source code control: 1990/05/03 16:49:51
|
||||
* File existed as early as: 1990
|
||||
@@ -28,6 +28,12 @@
|
||||
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
*/
|
||||
|
||||
/*
|
||||
* For a general tutorial on how to find a new largest known prime, see:
|
||||
*
|
||||
* http://www.isthe.com/chongo/tech/math/prime/prime-tutorial.pdf
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTE: This is a standard calc resource file. For information on calc see:
|
||||
*
|
||||
@@ -71,10 +77,15 @@
|
||||
* NOTE: Both largest known and largest known twin prime records have been
|
||||
* broken. Rather than update this file each time, I'll just
|
||||
* congratulate the finders and encourage others to try for
|
||||
* larger finds. Records were made to be broken afterall!
|
||||
* larger finds. Records were made to be broken after all!
|
||||
*/
|
||||
|
||||
/* ON GAINING A WORLD RECORD:
|
||||
/*
|
||||
* ON GAINING A WORLD RECORD:
|
||||
*
|
||||
* For a general tutorial on how to find a new largest known prime, see:
|
||||
*
|
||||
* http://www.isthe.com/chongo/tech/math/prime/prime-tutorial.pdf
|
||||
*
|
||||
* The routines in calc were designed to be portable, and to work on
|
||||
* numbers of 'sane' size. The Amdahl 6 team used a 'ultra-high speed
|
||||
@@ -83,6 +94,13 @@
|
||||
* The heart of the package was a multiplication and square routine that
|
||||
* was based on the PFA Fast Fourier Transform and on Winograd's radix FFTs.
|
||||
*
|
||||
* NOTE: While the PFA Fast Fourier Transform and Winograd's radix FFTs
|
||||
* might have been optimal for the Amdahl 6 team at the time,
|
||||
* they might not be optimal for your CPU architecture. See
|
||||
* the above mentioned tutorial for information on better
|
||||
* methods of performing multiplications and squares of very
|
||||
* large numbers.
|
||||
*
|
||||
* Having a fast computer, and a good multi-precision package are
|
||||
* critical, but one also needs to know where to look in order to have
|
||||
* a good chance at a record. Knowing what to test is beyond the scope
|
||||
@@ -139,12 +157,10 @@
|
||||
* be the factors of another candidate.
|
||||
*
|
||||
* Finally, one should eliminate all values of 'h*2^n-1' where
|
||||
* 'h*2^n+1' is divisible by a small primes. The ideas behind this
|
||||
* point is beyond the scope of this program.
|
||||
* 'h*2^n+1' is divisible by a small primes.
|
||||
*/
|
||||
|
||||
|
||||
global pprod256; /* product of "primes up to 256" / "primes up to 46" */
|
||||
pprod256 = 0; /* product of "primes up to 256" / "primes up to 46" */
|
||||
|
||||
/*
|
||||
* lucas - lucas primality test on h*2^n-1
|
||||
@@ -171,15 +187,33 @@ global pprod256; /* product of "primes up to 256" / "primes up to 46" */
|
||||
* "Introduction to Analytic Number Theory", by Tom A. Apostol,
|
||||
* Springer-Verlag, 1984, p 188.
|
||||
*
|
||||
* An excellent 5-page paper by Oystein J. Rodseth (we apologize that the
|
||||
* ASCII character set does not allow us to spell his name with the
|
||||
* umlaut marks on the O's):
|
||||
*
|
||||
* NOTE: The original Amdahl 6 method predates the publication of Ref4.
|
||||
* The gen_v1() function used by lucas() uses the Ref4 method.
|
||||
* See the 'Amdahl 6 legacy code' section below for the original
|
||||
* method of generating v(1).
|
||||
*
|
||||
* Ref4:
|
||||
*
|
||||
* "A note on primality tests for N = h*2^n-1", by Oystein J. Rodseth,
|
||||
* Department of Mathematics, University of Bergen, BIT Numerical
|
||||
* Mathematics. 34 (3): pp 451-454.
|
||||
*
|
||||
* http://folk.uib.no/nmaoy/papers/luc.pdf
|
||||
*
|
||||
* This test is performed as follows: (see Ref1, Theorem 5)
|
||||
*
|
||||
* a) generate u(0) (see the function gen_u0() below)
|
||||
* a) generate u(2) (see the function gen_u2() below)
|
||||
* (NOTE: some call this u(0))
|
||||
*
|
||||
* b) generate u(n-2) according to the rule:
|
||||
* b) generate u(n) according to the rule:
|
||||
*
|
||||
* u(i+1) = u(i)^2-2 mod h*2^n-1
|
||||
*
|
||||
* c) h*2^n-1 is prime if and only if u(n-2) == 0 Q.E.D. :-)
|
||||
* c) h*2^n-1 is prime if and only if u(n) == 0 Q.E.D. :-)
|
||||
*
|
||||
* Now the following conditions must be true for the test to work:
|
||||
*
|
||||
@@ -188,7 +222,7 @@ global pprod256; /* product of "primes up to 256" / "primes up to 46" */
|
||||
* h < 2^n
|
||||
* h mod 2 == 1
|
||||
*
|
||||
* A few misc notes:
|
||||
* A few miscellaneous notes:
|
||||
*
|
||||
* In order to reduce the number of tests, as attempt to eliminate
|
||||
* any number that is divisible by a prime less than 257. Valid prime
|
||||
@@ -222,7 +256,7 @@ lucas(h, n)
|
||||
local testval; /* h*2^n-1 */
|
||||
local shiftdown; /* the power of 2 that divides h */
|
||||
local u; /* the u(i) sequence value */
|
||||
local v1; /* the v(1) generator of u(0) */
|
||||
local v1; /* the v(1) generator of u(2) */
|
||||
local i; /* u sequence cycle number */
|
||||
local oldh; /* pre-reduced h */
|
||||
local oldn; /* pre-reduced n */
|
||||
@@ -364,18 +398,17 @@ lucas(h, n)
|
||||
}
|
||||
|
||||
/*
|
||||
* try to compute u(0)
|
||||
* try to compute u(2) (NOTE: some call this u(0))
|
||||
*
|
||||
* We will use gen_v1() to give us a v(1) using the values
|
||||
* of 'h' and 'n'. We will then use gen_u0() to convert
|
||||
* the v(1) into u(0).
|
||||
* of 'h' and 'n'. We will then use gen_u2() to convert
|
||||
* the v(1) into u(2).
|
||||
*
|
||||
* If gen_v1() returns a negative value, then we failed to
|
||||
* generate a test for h*2^n-1. This is because h mod 3 == 0
|
||||
* is hard to do, and in rare cases, exceed the tables found
|
||||
* in this program. We will generate an message and assume
|
||||
* the number is not prime, even though if we had a larger
|
||||
* table, we might have been able to show that it is prime.
|
||||
* generate a test for h*2^n-1. The legacy function,
|
||||
* legacy_gen_v1() used by the Amdahl 6 could have returned
|
||||
* -1. The new gen_v1() based on the method outlined in Ref4
|
||||
* will never return -1.
|
||||
*/
|
||||
v1 = gen_v1(h, n);
|
||||
if (v1 < 0) {
|
||||
@@ -384,10 +417,10 @@ lucas(h, n)
|
||||
ldebug("lucas", "unknown: no v(1)");
|
||||
return -1;
|
||||
}
|
||||
u = gen_u0(h, n, v1);
|
||||
u = gen_u2(h, n, v1);
|
||||
|
||||
/*
|
||||
* compute u(n-2)
|
||||
* compute u(n) (NOTE: some call this u(n-2))
|
||||
*/
|
||||
for (i=3; i <= n; ++i) {
|
||||
/* u = (u^2 - 2) % testval; */
|
||||
@@ -407,11 +440,19 @@ lucas(h, n)
|
||||
}
|
||||
|
||||
/*
|
||||
* gen_u0 - determine the initial Lucas sequence for h*2^n-1
|
||||
* gen_u2 - determine the initial Lucas sequence for h*2^n-1
|
||||
*
|
||||
* Historically many start the Lucas sequence with u(0).
|
||||
* Some, like the author of this code, prefer to start
|
||||
* with U(2). This is so one may say:
|
||||
*
|
||||
* 2^p-1 is prime if u(p) = 0 mod 2^p-1
|
||||
* or:
|
||||
* h*2^p-1 is prime if u(p) = 0 mod h*2^p-1
|
||||
*
|
||||
* According to Ref1, Theorem 5:
|
||||
*
|
||||
* u(0) = alpha^h + alpha^(-h)
|
||||
* u(2) = alpha^h + alpha^(-h) (NOTE: Ref1 calls it u(0))
|
||||
*
|
||||
* Now:
|
||||
*
|
||||
@@ -419,7 +460,7 @@ lucas(h, n)
|
||||
*
|
||||
* Therefore:
|
||||
*
|
||||
* u(0) = v(h)
|
||||
* u(2) = v(h) (NOTE: Ref1 calls it u(0))
|
||||
*
|
||||
* We calculate v(h) as follows: (Ref1, top of page 873)
|
||||
*
|
||||
@@ -447,11 +488,11 @@ lucas(h, n)
|
||||
* v1 - gen_v1(h,n) (see function below)
|
||||
*
|
||||
* returns:
|
||||
* u(0) - initial value for Lucas test on h*2^n-1
|
||||
* -1 - failed to generate u(0)
|
||||
* u(2) - initial value for Lucas test on h*2^n-1
|
||||
* -1 - failed to generate u(2)
|
||||
*/
|
||||
define
|
||||
gen_u0(h, n, v1)
|
||||
gen_u2(h, n, v1)
|
||||
{
|
||||
local shiftdown; /* the power of 2 that divides h */
|
||||
local r; /* low value: v(n) */
|
||||
@@ -500,7 +541,7 @@ gen_u0(h, n, v1)
|
||||
* at least 2 bits long for the loop below to work.
|
||||
*/
|
||||
if (h == 1) {
|
||||
ldebug("gen_u0", "quick h == 1 case");
|
||||
ldebug("gen_u2", "quick h == 1 case");
|
||||
/* return r%(h*2^n-1); */
|
||||
return hnrmod(r, h, n, -1);
|
||||
}
|
||||
@@ -540,21 +581,502 @@ gen_u0(h, n, v1)
|
||||
return r;
|
||||
}
|
||||
|
||||
/*
|
||||
* gen_u0 - determine the initial Lucas sequence for h*2^n-1
|
||||
*
|
||||
* Historically many start the Lucas sequence with u(0).
|
||||
* Some, like the author of this code, prefer to start
|
||||
* with u(2). This is so one may say:
|
||||
*
|
||||
* 2^p-1 is prime if u(p) = 0 mod 2^p-1
|
||||
* or:
|
||||
* h*2^n-1 is prime if U(n) = 0 mod h*2^n-1
|
||||
*
|
||||
* For those using the old code with gen_u0(), we
|
||||
* simply call gen_u2() instead.
|
||||
*
|
||||
* See the function gen_u2() for details.
|
||||
*
|
||||
* input:
|
||||
* h - h as in h*2^n-1
|
||||
* n - n as in h*2^n-1
|
||||
* v1 - gen_v1(h,n) (see function below)
|
||||
*
|
||||
* returns:
|
||||
* u(2) - initial value for Lucas test on h*2^n-1
|
||||
* -1 - failed to generate u(2)
|
||||
*/
|
||||
define
|
||||
gen_u0(h, n, v1)
|
||||
{
|
||||
return gen_u2(h, n, v1);
|
||||
}
|
||||
|
||||
/*
|
||||
* rodseth_xhn - determine if v(1) == x for h*2^n-1
|
||||
*
|
||||
* For a given h*2^n-1, v(1) == x if:
|
||||
*
|
||||
* jacobi(x-2, h*2^n-1) == 1 (Ref4, condition 1) part 1
|
||||
* jacobi(x+2, h*2^n-1) == -1 (Ref4, condition 1) part 2
|
||||
*
|
||||
* Now when x-2 <= 0:
|
||||
*
|
||||
* jacobi(x-2, h*2^n-1) == 0
|
||||
*
|
||||
* because:
|
||||
*
|
||||
* jacobi(x,y) == 0 if x <= 0
|
||||
*
|
||||
* So for (Ref4, condition 1) part 1 to be true:
|
||||
*
|
||||
* x-2 > 0
|
||||
*
|
||||
* And therefore:
|
||||
*
|
||||
* x > 2
|
||||
*
|
||||
* input:
|
||||
* x - potential v(1) value
|
||||
* h - h as in h*2^n-1
|
||||
* n - n as in h*2^n-1
|
||||
*
|
||||
* returns:
|
||||
* 1 if v(1) == x for h*2^n-1
|
||||
* 0 otherwise
|
||||
*/
|
||||
define
|
||||
rodseth_xhn(x, h, n)
|
||||
{
|
||||
local testval; /* h*2^n-1 */
|
||||
|
||||
/*
|
||||
* check arg types
|
||||
*/
|
||||
if (!isint(h)) {
|
||||
quit "bad args: h must be an integer";
|
||||
}
|
||||
if (!isint(n)) {
|
||||
quit "bad args: n must be an integer";
|
||||
}
|
||||
if (!isint(x)) {
|
||||
quit "bad args: x must be an integer";
|
||||
}
|
||||
|
||||
/*
|
||||
* firewall
|
||||
*/
|
||||
if (x <= 2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for jacobi(x-2, h*2^n-1) == 1 (Ref4, condition 1) part 1
|
||||
*/
|
||||
testval = h*2^n-1;
|
||||
if (jacobi(x-2, testval) != 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for jacobi(x+2, h*2^n-1) == -1 (Ref4, condition 1) part 2
|
||||
*/
|
||||
if (jacobi(x+2, testval) != -1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* v(1) == x for this h*2^n-1
|
||||
*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Trial tables used by gen_v1()
|
||||
*
|
||||
* When h mod 3 == 0, one needs particular values of D, a and b (see gen_v1
|
||||
* documentation) in order to find a value of v(1).
|
||||
* When h mod 3 == 0, according to Ref4 we need to find the first value X where:
|
||||
*
|
||||
* This table defines 'quickmax' possible tests to be taken in ascending
|
||||
* order. The v1_qval[x] refers to a v(1) value from Ref1, Table 1. A
|
||||
* related D value is found in d_qval[x]. All D values expect d_qval[1]
|
||||
* are also taken from Ref1, Table 1. The case of D == 21 as listed in
|
||||
* Ref1, Table 1 can be changed to D == 7 for the sake of the test because
|
||||
* of {note 6}.
|
||||
* jacobi(X-2, h*2^n-1) == 1 (Ref4, condition 1) part 1
|
||||
* jacobi(X+2, h*2^n-1) == -1 (Ref4, condition 1) part 2
|
||||
*
|
||||
* We can show that X > 2. See the comments in the rodseth_xhn(x,h,n) above.
|
||||
*
|
||||
* Some values of X satisfy more often than others. For example a large sample
|
||||
* of odd h, h multiple of 3 and large n (some around 1e4, some near 1e6, others
|
||||
* near 3e7) where the sample size was 66 973 365, here is the count of the
|
||||
* smallest value of X that satisfies conditions in Ref4, condition 1:
|
||||
*
|
||||
* count X
|
||||
* ----------
|
||||
* 26791345 3
|
||||
* 17223016 5
|
||||
* 7829600 9
|
||||
* 6988774 11
|
||||
* 3301093 15
|
||||
* 1517149 17
|
||||
* 910346 21
|
||||
* 711791 29
|
||||
* 573403 20
|
||||
* 390395 27
|
||||
* 288637 35
|
||||
* 149751 36
|
||||
* 107733 39
|
||||
* 58743 41
|
||||
* 35619 45
|
||||
* 25052 32
|
||||
* 17775 51
|
||||
* 13031 44
|
||||
* 7563 56
|
||||
* 7540 49
|
||||
* 7060 59
|
||||
* 4407 57
|
||||
* 2948 65
|
||||
* 2502 55
|
||||
* 2388 69
|
||||
* 2094 71
|
||||
* 689 77
|
||||
* 626 81
|
||||
* 491 66
|
||||
* 426 95
|
||||
* 219 80
|
||||
* 203 67
|
||||
* 185 84
|
||||
* 152 99
|
||||
* 127 72
|
||||
* 102 74
|
||||
* 98 87
|
||||
* 67 90
|
||||
* 55 104
|
||||
* 48 101
|
||||
* 32 105
|
||||
* 17 109
|
||||
* 16 116
|
||||
* 15 111
|
||||
* 13 92
|
||||
* 12 125
|
||||
* 7 129
|
||||
* 3 146
|
||||
* 2 140
|
||||
* 2 120
|
||||
* 1 165
|
||||
* 1 161
|
||||
* 1 155
|
||||
*
|
||||
* The above distribution was found to hold fairly well over many values of
|
||||
* odd h that are a multiple of 3 and for many values of n where h < 2^n.
|
||||
*
|
||||
* Given this information, when odd h is a multiple of 3 we try, in order,
|
||||
* these values of X:
|
||||
*
|
||||
* 3, 5, 9, 11, 15, 17, 21, 29, 20, 27, 35, 36, 39, 41, 45, 32, 51, 44,
|
||||
* 56, 49, 59, 57, 65, 55, 69, 71, 77, 81, 66, 95, 80, 67, 84, 99, 72,
|
||||
* 74, 87, 90, 104, 101, 105, 109, 116, 111, 92
|
||||
*
|
||||
* And stop on the first value of X where:
|
||||
*
|
||||
* jacobi(X-2, h*2^n-1) == 1
|
||||
* jacobi(X+2, h*2^n-1) == -1
|
||||
*
|
||||
* If no value in that list works, we start simple search starting with X = 120
|
||||
* and incrementing by 1 until a value of X is found.
|
||||
*
|
||||
* The x_tbl[] matrix contains those common values of X to try in order.
|
||||
* If all x_tbl_len fail to satisfy Ref4 condition 1, then we begin a
|
||||
* linear search at next_x until we find a proper X value.
|
||||
*
|
||||
* IMPORTANT NOTE: Using this table will not find the smallest possible v(1)
|
||||
* for a given h and n. This is not a problem because using
|
||||
* a larger value of v(1) does not impact the primality test.
|
||||
* Furthermore after lucas(h, n) generates a few u(n) terms,
|
||||
* the values will wrap (due to computing mod h*2^n-1).
|
||||
* Finally on average, about 1/4 of the values of X work as
|
||||
* v(1) for a given n when h is a multiple of 3. Skipping
|
||||
* rarely used v(1) will not doom gen_v1() to a long search.
|
||||
*/
|
||||
x_tbl_len = 45;
|
||||
mat x_tbl[x_tbl_len];
|
||||
x_tbl = {
|
||||
3, 5, 9, 11, 15, 17, 21, 29, 20, 27, 35, 36, 39, 41, 45, 32, 51, 44,
|
||||
56, 49, 59, 57, 65, 55, 69, 71, 77, 81, 66, 95, 80, 67, 84, 99, 72,
|
||||
74, 87, 90, 104, 101, 105, 109, 116, 111, 92
|
||||
};
|
||||
next_x = 120;
|
||||
|
||||
/*
|
||||
* gen_v1 - compute the v(1) for a given h*2^n-1 if we can
|
||||
*
|
||||
* This function assumes:
|
||||
*
|
||||
* n > 2 (n==2 has already been eliminated)
|
||||
* h mod 2 == 1
|
||||
* h < 2^n
|
||||
* h*2^n-1 mod 3 != 0 (h*2^n-1 has no small factors, such as 3)
|
||||
*
|
||||
* The generation of v(1) depends on the value of h. There are two cases
|
||||
* to consider, h mod 3 != 0, and h mod 3 == 0.
|
||||
*
|
||||
***
|
||||
*
|
||||
* Case 1: (h mod 3 != 0)
|
||||
*
|
||||
* This case is easy.
|
||||
*
|
||||
* In Ref1, page 869, one finds that if: (or see Ref2, page 131-132)
|
||||
*
|
||||
* h mod 6 == +/-1
|
||||
* h*2^n-1 mod 3 != 0
|
||||
*
|
||||
* which translates, gives the functions assumptions, into the condition:
|
||||
*
|
||||
* h mod 3 != 0
|
||||
*
|
||||
* If this case condition is true, then:
|
||||
*
|
||||
* u(2) = (2+sqrt(3))^h + (2-sqrt(3))^h (see Ref1, page 869)
|
||||
* = (2+sqrt(3))^h + (2+sqrt(3))^(-h) (NOTE: some call this u(2))
|
||||
*
|
||||
* and since Ref1, Theorem 5 states:
|
||||
*
|
||||
* u(2) = alpha^h + alpha^(-h) (NOTE: some call this u(2))
|
||||
* r = abs(2^2 - 1^2*3) = 1
|
||||
*
|
||||
* and the bottom of Ref1, page 872 states:
|
||||
*
|
||||
* v(x) = alpha^x + alpha^(-x)
|
||||
*
|
||||
* If we let:
|
||||
*
|
||||
* alpha = (2+sqrt(3))
|
||||
*
|
||||
* then
|
||||
*
|
||||
* u(2) = v(h) (NOTE: some call this u(2))
|
||||
*
|
||||
* so we simply return
|
||||
*
|
||||
* v(1) = alpha^1 + alpha^(-1)
|
||||
* = (2+sqrt(3)) + (2-sqrt(3))
|
||||
* = 4
|
||||
*
|
||||
***
|
||||
*
|
||||
* Case 2: (h mod 3 == 0)
|
||||
*
|
||||
* For the case where h is a multiple of 3, we turn to Ref4.
|
||||
*
|
||||
* The central theorem on page 3 of that paper states that
|
||||
* we may set v(1) to the first value X that satisfies:
|
||||
*
|
||||
* jacobi(X-2, h*2^n-1) == 1 (Ref4, condition 1)
|
||||
* jacobi(X+2, h*2^n-1) == -1 (Ref4, condition 1)
|
||||
*
|
||||
* NOTE: Ref4 uses P, which we shall refer to as X.
|
||||
* Ref4 uses N, which we shall refer to as h*2^n-1.
|
||||
*
|
||||
* NOTE: Ref4 uses the term Legendre-Jacobi symbol, which
|
||||
* we shall refer to as the Jacobi symbol.
|
||||
*
|
||||
* Before we address the two conditions, we need some background information
|
||||
* on two symbols, Legendre and Jacobi. In Ref 2, pp 278, 284-285, we find
|
||||
* the following definitions of jacobi(a,b) and L(a,p):
|
||||
*
|
||||
* The Legendre symbol L(a,p) takes the value:
|
||||
*
|
||||
* L(a,p) == 1 => a is a quadratic residue of p
|
||||
* L(a,p) == -1 => a is NOT a quadratic residue of p
|
||||
*
|
||||
* when:
|
||||
*
|
||||
* p is prime
|
||||
* p mod 2 == 1
|
||||
* gcd(a,p) == 1
|
||||
*
|
||||
* The value a is a quadratic residue of b if there exists some integer z
|
||||
* such that:
|
||||
*
|
||||
* z^2 mod b == a
|
||||
*
|
||||
* The Jacobi symbol jacobi(a,b) takes the value:
|
||||
*
|
||||
* jacobi(a,b) == 1 => b is not prime,
|
||||
* or a is a quadratic residue of b
|
||||
* jacobi(a,b) == -1 => a is NOT a quadratic residue of b
|
||||
*
|
||||
* when
|
||||
*
|
||||
* b mod 2 == 1
|
||||
* gcd(a,b) == 1
|
||||
*
|
||||
* It is worth noting for the Legendre symbol, in order for L(X+/-2,
|
||||
* h*2^n-1) to be defined, we must ensure that neither X-2 nor X+2 are
|
||||
* factors of h*2^n-1. This is done by pre-screening h*2^n-1 to not
|
||||
* have small factors and keeping X+2 less than that small factor
|
||||
* limit. It is worth noting that in lucas(h, n), we first verify
|
||||
* that h*2^n-1 does not have a factor < 257 before performing the
|
||||
* primality test. So while X+/-2 < 257, we know that
|
||||
* gcd(X+/-2, h*2^n-1) == 1.
|
||||
*
|
||||
* Returning to the testing of conditions in Ref4, condition 1:
|
||||
*
|
||||
* jacobi(X-2, h*2^n-1) == 1
|
||||
* jacobi(X+2, h*2^n-1) == -1
|
||||
*
|
||||
* When such an X is found, we set:
|
||||
*
|
||||
* v(1) = X
|
||||
*
|
||||
***
|
||||
*
|
||||
* In conclusion, we can compute v,(1) by attempting to do the following:
|
||||
*
|
||||
* h mod 3 != 0
|
||||
*
|
||||
* we return:
|
||||
*
|
||||
* v(1) == 4
|
||||
*
|
||||
* h mod 3 == 0
|
||||
*
|
||||
* we return:
|
||||
*
|
||||
* v(1) = X
|
||||
*
|
||||
* where X > 2 in a integer such that:
|
||||
*
|
||||
* jacobi(X-2, h*2^n-1) == 1
|
||||
* jacobi(X+2, h*2^n-1) == -1
|
||||
*
|
||||
***
|
||||
*
|
||||
* input:
|
||||
* h h as in h*2^n-1
|
||||
* n n as in h*2^n-1
|
||||
*
|
||||
* output:
|
||||
* returns v(1), or -1 is there is no quick way
|
||||
*/
|
||||
define
|
||||
gen_v1(h, n)
|
||||
{
|
||||
local x; /* potential v(1) to test */
|
||||
local i; /* x_tbl index */
|
||||
|
||||
/*
|
||||
* check arg types
|
||||
*/
|
||||
if (!isint(h)) {
|
||||
quit "bad args: h must be an integer";
|
||||
}
|
||||
if (!isint(n)) {
|
||||
quit "bad args: n must be an integer";
|
||||
}
|
||||
|
||||
/*
|
||||
* check for Case 1: (h mod 3 != 0)
|
||||
*/
|
||||
if (h % 3 != 0) {
|
||||
/* v(1) is easy to compute */
|
||||
return 4;
|
||||
}
|
||||
|
||||
/*
|
||||
* What follow is Case 2: (h mod 3 == 0)
|
||||
*/
|
||||
|
||||
/*
|
||||
* We will look for x that satisfies conditions in Ref4, condition 1:
|
||||
*
|
||||
* jacobi(X-2, h*2^n-1) == 1 part 1
|
||||
* jacobi(X+2, h*2^n-1) == -1 part 2
|
||||
*/
|
||||
for (i=0; i < x_tbl_len; ++i) {
|
||||
|
||||
/*
|
||||
* test Ref4 condition 1:
|
||||
*/
|
||||
x = x_tbl[i];
|
||||
if (rodseth_xhn(x, h, n) == 1) {
|
||||
|
||||
/*
|
||||
* found a x that satisfies Ref4 condition 1
|
||||
*/
|
||||
ldebug("gen_v1", "h= " + str(h) + " n= " + str(n) +
|
||||
" v1= " + str(x) + " using tbl[ " +
|
||||
str(i) + " ]");
|
||||
return x;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We are in that rare case (about 1 in 2 300 000) where none of the
|
||||
* common X values satisfy Ref4 condition 1. We start a linear search
|
||||
* at next_x from here on.
|
||||
*
|
||||
* However, we also need to keep in mind that when x+2 >= 257, we
|
||||
* need to verify that gcd(x-2, h*2^n-1) == 1 and
|
||||
* and to verify that gcd(x+2, h*2^n-1) == 1.
|
||||
*/
|
||||
x = next_x;
|
||||
while (rodseth_xhn(x, h, n) != 1) {
|
||||
++x;
|
||||
}
|
||||
/* finally found a v(1) value */
|
||||
ldebug("gen_v1", "h= " + str(h) + " n= " + str(n) +
|
||||
" v1= " + str(x) + " beyond tbl");
|
||||
return x;
|
||||
}
|
||||
|
||||
/*
|
||||
* ldebug - print a debug statement
|
||||
*
|
||||
* input:
|
||||
* funct name of calling function
|
||||
* str string to print
|
||||
*/
|
||||
define
|
||||
ldebug(funct, str)
|
||||
{
|
||||
if (config("resource_debug") & 8) {
|
||||
print "DEBUG:", funct:":", str;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
************************
|
||||
* Amdahl 6 legacy code *
|
||||
************************
|
||||
*
|
||||
* NOTE: What follows is legacy code based on the method used by the
|
||||
* Amdahl 6 group:
|
||||
*
|
||||
* John Brown, Landon Curt Noll, Bodo Parady, Gene Smith,
|
||||
* Joel Smith and Sergio Zarantonello
|
||||
*
|
||||
* This method generated v(1) for nearly all values, except for a
|
||||
* few rare cases when h mod 3 == 0. The code is NOT used by lucas.cal
|
||||
* above. The gen_v1() function above is based on an improved method
|
||||
* outlined in Ref4. That method generated v(1) for all h.
|
||||
*
|
||||
* The code below is kept for historical purposes only. The functions
|
||||
* and global variables of the Amdahl 6 legacy code all begin with legacy_.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Trial tables used by legacy_gen_v1()
|
||||
*
|
||||
* When h mod 3 == 0, one needs particular values of D, a and b (see
|
||||
* legacy_gen_v1 documentation) in order to find a value of v(1).
|
||||
*
|
||||
* This table defines 'legacy_quickmax' possible tests to be taken in ascending
|
||||
* order. The legacy_v1_qval[x] refers to a v(1) value from Ref1, Table 1. A
|
||||
* related D value is found in legacy_d_qval[x]. All D values expect
|
||||
* legacy_d_qval[1] are also taken from Ref1, Table 1. The case of D == 21 as
|
||||
* listed in Ref1, Table 1 can be changed to D == 7 for the sake of the test
|
||||
* because of {note 6}.
|
||||
*
|
||||
* It should be noted that the D values all satisfy the selection values
|
||||
* as outlined in the gen_v1() function comments. That is:
|
||||
* as outlined in the legacy_gen_v1() function comments. That is:
|
||||
*
|
||||
* D == P*(2^f)*(3^g)
|
||||
*
|
||||
@@ -571,20 +1093,20 @@ gen_u0(h, n, v1)
|
||||
* where Q == 1. No further processing is needed to compute v(1) when r
|
||||
* is of this form.
|
||||
*/
|
||||
quickmax = 8;
|
||||
mat d_qval[quickmax];
|
||||
mat v1_qval[quickmax];
|
||||
d_qval[0] = 5; v1_qval[0] = 3; /* a=1 b=1 r=4 */
|
||||
d_qval[1] = 7; v1_qval[1] = 5; /* a=3 b=1 r=12 D=21 */
|
||||
d_qval[2] = 13; v1_qval[2] = 11; /* a=3 b=1 r=4 */
|
||||
d_qval[3] = 11; v1_qval[3] = 20; /* a=3 b=1 r=2 */
|
||||
d_qval[4] = 29; v1_qval[4] = 27; /* a=5 b=1 r=4 */
|
||||
d_qval[5] = 53; v1_qval[5] = 51; /* a=53 b=1 r=4 */
|
||||
d_qval[6] = 17; v1_qval[6] = 66; /* a=17 b=1 r=1 */
|
||||
d_qval[7] = 19; v1_qval[7] = 74; /* a=38 b=1 r=2 */
|
||||
legacy_quickmax = 8;
|
||||
mat legacy_d_qval[legacy_quickmax];
|
||||
mat legacy_v1_qval[legacy_quickmax];
|
||||
legacy_d_qval[0] = 5; legacy_v1_qval[0] = 3; /* a=1 b=1 r=4 */
|
||||
legacy_d_qval[1] = 7; legacy_v1_qval[1] = 5; /* a=3 b=1 r=12 D=21 */
|
||||
legacy_d_qval[2] = 13; legacy_v1_qval[2] = 11; /* a=3 b=1 r=4 */
|
||||
legacy_d_qval[3] = 11; legacy_v1_qval[3] = 20; /* a=3 b=1 r=2 */
|
||||
legacy_d_qval[4] = 29; legacy_v1_qval[4] = 27; /* a=5 b=1 r=4 */
|
||||
legacy_d_qval[5] = 53; legacy_v1_qval[5] = 51; /* a=53 b=1 r=4 */
|
||||
legacy_d_qval[6] = 17; legacy_v1_qval[6] = 66; /* a=17 b=1 r=1 */
|
||||
legacy_d_qval[7] = 19; legacy_v1_qval[7] = 74; /* a=38 b=1 r=2 */
|
||||
|
||||
/*
|
||||
* gen_v1 - compute the v(1) for a given h*2^n-1 if we can
|
||||
* legacy_gen_v1 - compute the v(1) for a given h*2^n-1 if we can
|
||||
*
|
||||
* This function assumes:
|
||||
*
|
||||
@@ -613,12 +1135,12 @@ d_qval[7] = 19; v1_qval[7] = 74; /* a=38 b=1 r=2 */
|
||||
*
|
||||
* If this case condition is true, then:
|
||||
*
|
||||
* u(0) = (2+sqrt(3))^h + (2-sqrt(3))^h (see Ref1, page 869)
|
||||
* = (2+sqrt(3))^h + (2+sqrt(3))^(-h)
|
||||
* u(2) = (2+sqrt(3))^h + (2-sqrt(3))^h (see Ref1, page 869)
|
||||
* = (2+sqrt(3))^h + (2+sqrt(3))^(-h) (some call this u(0))
|
||||
*
|
||||
* and since Ref1, Theorem 5 states:
|
||||
*
|
||||
* u(0) = alpha^h + alpha^(-h)
|
||||
* u(2) = alpha^h + alpha^(-h)
|
||||
* r = abs(2^2 - 1^2*3) = 1
|
||||
*
|
||||
* and the bottom of Ref1, page 872 states:
|
||||
@@ -631,7 +1153,7 @@ d_qval[7] = 19; v1_qval[7] = 74; /* a=38 b=1 r=2 */
|
||||
*
|
||||
* then
|
||||
*
|
||||
* u(0) = v(h)
|
||||
* u(2) = v(h)
|
||||
*
|
||||
* so we simply return
|
||||
*
|
||||
@@ -666,7 +1188,7 @@ d_qval[7] = 19; v1_qval[7] = 74; /* a=38 b=1 r=2 */
|
||||
*
|
||||
* where L(x,y) is the Legendre symbol (see below), then:
|
||||
*
|
||||
* u(0) = alpha^h + alpha^(-h)
|
||||
* u(2) = alpha^h + alpha^(-h)
|
||||
*
|
||||
* The bottom of Ref1, page 872 states:
|
||||
*
|
||||
@@ -674,7 +1196,7 @@ d_qval[7] = 19; v1_qval[7] = 74; /* a=38 b=1 r=2 */
|
||||
*
|
||||
* thus since:
|
||||
*
|
||||
* u(0) = v(h)
|
||||
* u(2) = v(h)
|
||||
*
|
||||
* so we want to return:
|
||||
*
|
||||
@@ -929,7 +1451,7 @@ d_qval[7] = 19; v1_qval[7] = 74; /* a=38 b=1 r=2 */
|
||||
* returns v(1), or -1 is there is no quick way
|
||||
*/
|
||||
define
|
||||
gen_v1(h, n)
|
||||
legacy_gen_v1(h, n)
|
||||
{
|
||||
local d; /* the 'D' value to try */
|
||||
local val_mod; /* h*2^n-1 mod 'D' */
|
||||
@@ -947,10 +1469,10 @@ gen_v1(h, n)
|
||||
* We will try all 'D' values until we find a proper v(1)
|
||||
* or run out of 'D' values.
|
||||
*/
|
||||
for (i=0; i < quickmax; ++i) {
|
||||
for (i=0; i < legacy_quickmax; ++i) {
|
||||
|
||||
/* grab our 'D' value */
|
||||
d = d_qval[i];
|
||||
d = legacy_d_qval[i];
|
||||
|
||||
/* compute h*2^n-1 mod 'D' quickly */
|
||||
val_mod = (h*pmod(2,n%(d-1),d)-1) % d;
|
||||
@@ -965,13 +1487,13 @@ gen_v1(h, n)
|
||||
/* D mod 4 == 1, so check for J(D, h*2^n-1) == -1 */
|
||||
if (jacobi(val_mod, d) == -1) {
|
||||
/* it worked, return the related v(1) value */
|
||||
return v1_qval[i];
|
||||
return legacy_v1_qval[i];
|
||||
}
|
||||
} else {
|
||||
/* D mod 4 == -1, so check for J(D, h*2^n-1) == 1 */
|
||||
if (jacobi(val_mod, d) == 1) {
|
||||
/* it worked, return the related v(1) value */
|
||||
return v1_qval[i];
|
||||
return legacy_v1_qval[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1029,19 +1551,3 @@ gen_v1(h, n)
|
||||
/* no quick and dirty v(1), so return -1 */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* ldebug - print a debug statement
|
||||
*
|
||||
* input:
|
||||
* funct name of calling function
|
||||
* str string to print
|
||||
*/
|
||||
define
|
||||
ldebug(funct, str)
|
||||
{
|
||||
if (config("resource_debug") & 8) {
|
||||
print "DEBUG:", funct:":", str;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@@ -1,165 +0,0 @@
|
||||
/*
|
||||
* lucas_tbl - lucasian criteria for primality tables
|
||||
*
|
||||
* 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.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: lucas_tbl.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/lucas_tbl.cal,v $
|
||||
*
|
||||
* Under source code control: 1991/01/26 02:43:43
|
||||
* 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/
|
||||
*/
|
||||
|
||||
/*
|
||||
* Lucasian criteria for primality
|
||||
*
|
||||
* The following table is taken from:
|
||||
*
|
||||
* "Lucasian Criteria for the Primality of N=h*2^n-1", by Hans Riesel,
|
||||
* Mathematics of Computation, Vol 23 #108, p 872.
|
||||
*
|
||||
* The index of the *_val[] arrays correspond to the v(1) values found
|
||||
* in the table. That is, for v(1) == x:
|
||||
*
|
||||
* D == d_val[x]
|
||||
* a == a_val[x]
|
||||
* b == b_val[x]
|
||||
* r == r_val[x] (r == abs(a^2 - b^2*D))
|
||||
*
|
||||
*
|
||||
* Note that when *_val[i] is not a number, the related v(1) value
|
||||
* is not found in Table 1.
|
||||
*/
|
||||
|
||||
|
||||
trymax = 100;
|
||||
mat d_val[trymax+1];
|
||||
mat a_val[trymax+1];
|
||||
mat b_val[trymax+1];
|
||||
mat r_val[trymax+1];
|
||||
/* v1= 0 INVALID */
|
||||
/* v1= 1 INVALID */
|
||||
/* v1= 2 INVALID */
|
||||
d_val[ 3]= 5; a_val[ 3]= 1; b_val[ 3]=1; r_val[ 3]=4;
|
||||
d_val[ 4]= 3; a_val[ 4]= 1; b_val[ 4]=1; r_val[ 4]=2;
|
||||
d_val[ 5]= 21; a_val[ 5]= 3; b_val[ 5]=1; r_val[ 5]=12;
|
||||
d_val[ 6]= 2; a_val[ 6]= 1; b_val[ 6]=1; r_val[ 6]=1;
|
||||
/* v1= 7 INVALID */
|
||||
d_val[ 8]= 15; a_val[ 8]= 3; b_val[ 8]=1; r_val[ 8]=6;
|
||||
d_val[ 9]= 77; a_val[ 9]= 7; b_val[ 9]=1; r_val[ 9]=28;
|
||||
d_val[10]= 6; a_val[10]= 2; b_val[10]=1; r_val[10]=2;
|
||||
d_val[11]= 13; a_val[11]= 3; b_val[11]=1; r_val[11]=4;
|
||||
d_val[12]= 35; a_val[12]= 5; b_val[12]=1; r_val[12]=10;
|
||||
d_val[13]= 165; a_val[13]=11; b_val[13]=1; r_val[13]=44;
|
||||
/* v1=14 INVALID */
|
||||
d_val[15]= 221; a_val[15]=13; b_val[15]=1; r_val[15]=52;
|
||||
d_val[16]= 7; a_val[16]= 3; b_val[16]=1; r_val[16]=2;
|
||||
d_val[17]= 285; a_val[17]=15; b_val[17]=1; r_val[17]=60;
|
||||
/* v1=18 INVALID */
|
||||
d_val[19]= 357; a_val[19]=17; b_val[19]=1; r_val[19]=68;
|
||||
d_val[20]= 11; a_val[20]= 3; b_val[20]=1; r_val[20]=2;
|
||||
d_val[21]= 437; a_val[21]=19; b_val[21]=1; r_val[21]=76;
|
||||
d_val[22]= 30; a_val[22]= 5; b_val[22]=1; r_val[22]=5;
|
||||
/* v1=23 INVALID */
|
||||
d_val[24]= 143; a_val[24]=11; b_val[24]=1; r_val[24]=22;
|
||||
d_val[25]= 69; a_val[25]= 9; b_val[25]=1; r_val[25]=12;
|
||||
d_val[26]= 42; a_val[26]= 6; b_val[26]=1; r_val[26]=6;
|
||||
d_val[27]= 29; a_val[27]= 5; b_val[27]=1; r_val[27]=4;
|
||||
d_val[28]= 195; a_val[28]=13; b_val[28]=1; r_val[28]=26;
|
||||
d_val[29]= 93; a_val[29]= 9; b_val[29]=1; r_val[29]=12;
|
||||
d_val[30]= 14; a_val[30]= 4; b_val[30]=1; r_val[30]=2;
|
||||
d_val[31]= 957; a_val[31]=29; b_val[31]=1; r_val[31]=116;
|
||||
d_val[32]= 255; a_val[32]=15; b_val[32]=1; r_val[32]=30;
|
||||
d_val[33]=1085; a_val[33]=31; b_val[33]=1; r_val[33]=124;
|
||||
/* v1=34 INVALID */
|
||||
d_val[35]=1221; a_val[35]=33; b_val[35]=1; r_val[35]=132;
|
||||
d_val[36]= 323; a_val[36]=17; b_val[36]=1; r_val[36]=34;
|
||||
d_val[37]=1365; a_val[37]=35; b_val[37]=1; r_val[37]=140;
|
||||
d_val[38]= 10; a_val[38]= 3; b_val[38]=1; r_val[38]=1;
|
||||
d_val[39]=1517; a_val[39]=37; b_val[39]=1; r_val[39]=148;
|
||||
d_val[40]= 399; a_val[40]=19; b_val[40]=1; r_val[40]=38;
|
||||
d_val[41]=1677; a_val[41]=39; b_val[41]=1; r_val[41]=156;
|
||||
d_val[42]= 110; a_val[42]=10; b_val[42]=1; r_val[42]=10;
|
||||
d_val[43]= 205; a_val[43]=15; b_val[43]=1; r_val[43]=20;
|
||||
d_val[44]= 483; a_val[44]=21; b_val[44]=1; r_val[44]=42;
|
||||
d_val[45]=2021; a_val[45]=43; b_val[45]=1; r_val[45]=172;
|
||||
d_val[46]= 33; a_val[46]= 6; b_val[46]=1; r_val[46]=3;
|
||||
/* v1=47 INVALID */
|
||||
d_val[48]= 23; a_val[48]= 5; b_val[48]=1; r_val[48]=2;
|
||||
d_val[49]=2397; a_val[49]=47; b_val[49]=1; r_val[49]=188;
|
||||
d_val[50]= 39; a_val[50]= 6; b_val[50]=1; r_val[50]=3;
|
||||
d_val[51]= 53; a_val[51]= 7; b_val[51]=1; r_val[51]=4;
|
||||
/* v1=52 INVALID */
|
||||
d_val[53]=2805; a_val[53]=51; b_val[53]=1; r_val[53]=204;
|
||||
d_val[54]= 182; a_val[54]=13; b_val[54]=1; r_val[54]=13;
|
||||
d_val[55]=3021; a_val[55]=53; b_val[55]=1; r_val[55]=212;
|
||||
d_val[56]= 87; a_val[56]= 9; b_val[56]=1; r_val[56]=6;
|
||||
d_val[57]=3245; a_val[57]=55; b_val[57]=1; r_val[57]=220;
|
||||
d_val[58]= 210; a_val[58]=14; b_val[58]=1; r_val[58]=14;
|
||||
d_val[59]=3477; a_val[59]=57; b_val[59]=1; r_val[59]=228;
|
||||
d_val[60]= 899; a_val[60]=29; b_val[60]=1; r_val[60]=58;
|
||||
d_val[61]= 413; a_val[61]=21; b_val[61]=1; r_val[61]=28;
|
||||
/* v1=62 INVALID */
|
||||
d_val[63]=3965; a_val[63]=61; b_val[63]=1; r_val[63]=244;
|
||||
d_val[64]=1023; a_val[64]=31; b_val[64]=1; r_val[64]=62;
|
||||
d_val[65]= 469; a_val[65]=21; b_val[65]=1; r_val[65]=28;
|
||||
d_val[66]= 17; a_val[66]= 4; b_val[66]=1; r_val[66]=1;
|
||||
d_val[67]=4485; a_val[67]=65; b_val[67]=1; r_val[67]=260;
|
||||
d_val[68]=1155; a_val[68]=33; b_val[68]=1; r_val[68]=66;
|
||||
d_val[69]=4757; a_val[69]=67; b_val[69]=1; r_val[69]=268;
|
||||
d_val[70]= 34; a_val[70]= 6; b_val[70]=1; r_val[70]=2;
|
||||
d_val[71]=5037; a_val[71]=69; b_val[71]=1; r_val[71]=276;
|
||||
d_val[72]=1295; a_val[72]=35; b_val[72]=1; r_val[72]=70;
|
||||
d_val[73]= 213; a_val[73]=15; b_val[73]=1; r_val[73]=12;
|
||||
d_val[74]= 38; a_val[74]= 6; b_val[74]=1; r_val[74]=2;
|
||||
d_val[75]=5621; a_val[75]=73; b_val[75]=1; r_val[75]=292;
|
||||
d_val[76]=1443; a_val[76]=37; b_val[76]=1; r_val[76]=74;
|
||||
d_val[77]= 237; a_val[77]=15; b_val[77]=1; r_val[77]=12;
|
||||
d_val[78]= 95; a_val[78]=10; b_val[78]=1; r_val[78]=5;
|
||||
/* v1=79 INVALID */
|
||||
d_val[80]=1599; a_val[80]=39; b_val[80]=1; r_val[80]=78;
|
||||
d_val[81]=6557; a_val[81]=79; b_val[81]=1; r_val[81]=316;
|
||||
d_val[82]= 105; a_val[82]=10; b_val[82]=1; r_val[82]=5;
|
||||
d_val[83]= 85; a_val[83]= 9; b_val[83]=1; r_val[83]=4;
|
||||
d_val[84]=1763; a_val[84]=41; b_val[84]=1; r_val[84]=82;
|
||||
d_val[85]=7221; a_val[85]=83; b_val[85]=1; r_val[85]=332;
|
||||
d_val[86]= 462; a_val[86]=21; b_val[86]=1; r_val[86]=21;
|
||||
d_val[87]=7565; a_val[87]=85; b_val[87]=1; r_val[87]=340;
|
||||
d_val[88]= 215; a_val[88]=15; b_val[88]=1; r_val[88]=10;
|
||||
d_val[89]=7917; a_val[89]=87; b_val[89]=1; r_val[89]=348;
|
||||
d_val[90]= 506; a_val[90]=22; b_val[90]=1; r_val[90]=22;
|
||||
d_val[91]=8277; a_val[91]=89; b_val[91]=1; r_val[91]=356;
|
||||
d_val[92]= 235; a_val[92]=15; b_val[92]=1; r_val[92]=10;
|
||||
d_val[93]=8645; a_val[93]=91; b_val[93]=1; r_val[93]=364;
|
||||
d_val[94]= 138; a_val[94]=12; b_val[94]=1; r_val[94]=6;
|
||||
d_val[95]=9021; a_val[95]=93; b_val[95]=1; r_val[95]=372;
|
||||
d_val[96]= 47; a_val[96]= 7; b_val[96]=1; r_val[96]=2;
|
||||
d_val[97]=1045; a_val[97]=33; b_val[97]=1; r_val[97]=44;
|
||||
/* v1=98 INVALID */
|
||||
d_val[99]=9797; a_val[99]=97; b_val[99]=1; r_val[99]=388;
|
||||
d_val[100]= 51; a_val[100]= 7; b_val[100]=1; r_val[100]=2;
|
||||
|
||||
if (config("resource_debug") & 3) {
|
||||
print "d_val[100] defined";
|
||||
print "a_val[100] defined";
|
||||
print "b_val[100] defined";
|
||||
print "r_val[100] defined";
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* regress - calc regression and correctness test suite
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell and Landon Curt Noll
|
||||
* Copyright (C) 1999-2017 David I. Bell and 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
|
||||
@@ -17,9 +17,9 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.12 $
|
||||
* @(#) $Id: regress.cal,v 30.12 2013/09/02 02:32:55 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/regress.cal,v $
|
||||
* @(#) $Revision: 30.14 $
|
||||
* @(#) $Id: regress.cal,v 30.14 2017/05/19 16:09:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc-RHEL7/cal/RCS/regress.cal,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:50:36
|
||||
* File existed as early as: before 1990
|
||||
@@ -403,14 +403,14 @@ define test_config()
|
||||
'512: config("trace") == 0');
|
||||
vrfy(config("maxprint") == 16,
|
||||
'513: config("maxprint") == 16');
|
||||
vrfy(config("mul2") == 1780,
|
||||
'514: config("mul2") == 1780');
|
||||
vrfy(config("sq2") == 3388,
|
||||
'515: config("sq2") == 3388');
|
||||
vrfy(config("pow2") == 176,
|
||||
'516: config("pow2") == 176');
|
||||
vrfy(config("redc2") == 220,
|
||||
'517: config("redc2") == 220');
|
||||
vrfy(config("mul2") == 28,
|
||||
'514: config("mul2") == 28');
|
||||
vrfy(config("sq2") == 28,
|
||||
'515: config("sq2") == 28');
|
||||
vrfy(config("pow2") == 20,
|
||||
'516: config("pow2") == 20');
|
||||
vrfy(config("redc2") == 25,
|
||||
'517: config("redc2") == 25');
|
||||
vrfy(config("tilde"),
|
||||
'518: config("tilde")');
|
||||
vrfy(config("tab"),
|
||||
@@ -8068,7 +8068,6 @@ return test_functions2();
|
||||
* hello.cal - designed to go into an infinite loop
|
||||
* lucal.cal - already read by this file
|
||||
* lucas_chk.cal - already read by this file
|
||||
* lucas_tbl.cal - duplicatres code already read by another file
|
||||
* regress.cal - this file
|
||||
* surd.cal - already read by this file
|
||||
* test9999.cal - files of this form are already read by this file
|
||||
@@ -8141,8 +8140,6 @@ read -once intfile;
|
||||
print '9830: read -once intfile';
|
||||
read -once lucas;
|
||||
print '9831: read -once lucas';
|
||||
read -once lucas_tbl;
|
||||
print '9832: read -once lucas_tbl';
|
||||
read -once natnumset;
|
||||
print '9833: read -once natnumset';
|
||||
read -once repeat;
|
||||
|
12
calc.h
12
calc.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* calc - definitions for calculator program
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
* Copyright (C) 1999-2007,2014 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.4 $
|
||||
* @(#) $Id: calc.h,v 30.4 2013/09/01 22:16:21 chongo Exp $
|
||||
* @(#) $Revision: 30.6 $
|
||||
* @(#) $Id: calc.h,v 30.6 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/calc.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:31
|
||||
@@ -28,8 +28,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__CALC_H__)
|
||||
#define __CALC_H__
|
||||
#if !defined(INCLUDE_CALC_H)
|
||||
#define INCLUDE_CALC_H
|
||||
|
||||
#include <setjmp.h>
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
@@ -267,4 +267,4 @@ EXTERN char *Copyright;
|
||||
E_FUNC char *version(void);
|
||||
|
||||
|
||||
#endif /* !__CALC_H__ */
|
||||
#endif /* !INCLUDE_CALC_H */
|
||||
|
85
calc.man
85
calc.man
@@ -1,5 +1,5 @@
|
||||
.\"
|
||||
.\" Copyright (C) 1999-2007 Landon Curt Noll
|
||||
.\" Copyright (C) 1999-2007,2014 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
|
||||
@@ -15,8 +15,8 @@
|
||||
.\" received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
.\"
|
||||
.\" @(#) $Revision: 30.5 $
|
||||
.\" @(#) $Id: calc.man,v 30.5 2013/08/11 08:41:38 chongo Exp $
|
||||
.\" @(#) $Revision: 30.6 $
|
||||
.\" @(#) $Id: calc.man,v 30.6 2014/10/06 08:39:45 chongo Exp $
|
||||
.\" @(#) $Source: /usr/local/src/bin/calc/RCS/calc.man,v $
|
||||
.\"
|
||||
.\" Under source code control: 1991/07/23 05:48:26
|
||||
@@ -1115,45 +1115,62 @@ To contribute comments, suggestions, enhancements
|
||||
and interesting
|
||||
.B calc
|
||||
resource files, and
|
||||
shell scripts please join the low volume calc mailing list.
|
||||
shell scripts please join the calc-tester
|
||||
low volume moderated calc mailing list.
|
||||
.sp
|
||||
To join the low volume calc mailing list, send EMail to:
|
||||
To the calc-tester mailing list, visit the following URL:
|
||||
.sp
|
||||
.in +0.5i
|
||||
.nf
|
||||
calc-tester-request at asthe dot com
|
||||
https://www.listbox.com/subscribe/?list_id=239342
|
||||
.fi
|
||||
.in -0.5i
|
||||
.sp
|
||||
Your subject must contain the words:
|
||||
To help determine you are a human and not just a spam bot,
|
||||
you will be required to provide the following additional information:
|
||||
.sp
|
||||
.in +0.5i
|
||||
.nf
|
||||
calc mailing list subscription
|
||||
Your Name
|
||||
|
||||
Calc Version
|
||||
For example, the current version is: ${VERSION}
|
||||
|
||||
Operating System
|
||||
If you don't know your operating system, enter: unknown
|
||||
|
||||
The date 7 days ago
|
||||
Consult a calendar :-)
|
||||
.fi
|
||||
.in -0.5i
|
||||
.sp
|
||||
If you need a human to help you with your mailing list subscription,
|
||||
or if you have problems with the above procedure, please
|
||||
send EMail to our special address:
|
||||
.sp
|
||||
.in +0.5i
|
||||
.nf
|
||||
calc-tester-maillist-help at asthe dot com
|
||||
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
|
||||
NOTE: Yes, the EMail address uses 'asthe',
|
||||
while the web site uses 'isthe'.
|
||||
.fi
|
||||
.in -0.5i
|
||||
.sp
|
||||
To be sure we see your EMail asking for help with your mailing list
|
||||
subscription, please use the following phase in your EMail Subject line
|
||||
your subject must contain the words:
|
||||
.sp
|
||||
.in +0.5i
|
||||
.nf
|
||||
calc tester mailing list help
|
||||
.fi
|
||||
.in -0.5i
|
||||
.sp
|
||||
You may have additional words in your subject line.
|
||||
.sp
|
||||
Your message body must contain:
|
||||
.sp
|
||||
.in +0.5i
|
||||
.nf
|
||||
subscribe calc-tester address
|
||||
end
|
||||
name your_full_name
|
||||
.fi
|
||||
.in -0.5i
|
||||
.sp
|
||||
where
|
||||
.B address
|
||||
s your EMail address and
|
||||
.B your_full_name
|
||||
is your full name.
|
||||
Feel free to follow the
|
||||
.B name
|
||||
line with additional EMail text as desired.
|
||||
.sp
|
||||
.SH "BUG REPORTS / BUG FIXES"
|
||||
\&
|
||||
.br
|
||||
@@ -1162,12 +1179,12 @@ Send bug reports and bug fixes to:
|
||||
.sp
|
||||
.in +0.5i
|
||||
.nf
|
||||
calc-bugs at asthe dot com
|
||||
calc-bug-report at asthe dot com
|
||||
|
||||
[[ NOTE: Replace 'at' with @, 'dot' is with . ]]
|
||||
[[ and remove the spaces ]]
|
||||
[[ NOTE: The EMail address uses 'asthe' and
|
||||
[[ the web site URL uses 'isthe' ]]
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
|
||||
NOTE: Yes, the EMail address uses 'asthe',
|
||||
while the web site uses 'isthe'.
|
||||
.fi
|
||||
.in -0.5i
|
||||
.sp
|
||||
@@ -1180,6 +1197,10 @@ calc bug report
|
||||
.in -0.5i
|
||||
.sp
|
||||
You may have additional words in your subject line.
|
||||
.in
|
||||
However, you may find it more helpful to simply subscribe to the
|
||||
calc-tester mailing list (see above) and then to send your report
|
||||
to that mailing list as a wider set calc testers may be able to help you.
|
||||
.sp
|
||||
See the
|
||||
.I BUGS
|
||||
|
82
calc.spec.in
82
calc.spec.in
@@ -1,8 +1,7 @@
|
||||
#****h* calc/calc.spec.in
|
||||
#
|
||||
# calc.spec.in - template specfile for calc
|
||||
#
|
||||
# Copyright (C) 2003-2013 Petteri Kettunen and Landon Curt Noll
|
||||
# Copyright (C) 2003-2014 Petteri Kettunen and 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
|
||||
@@ -18,8 +17,8 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# @(#) $Revision: 30.12 $
|
||||
# @(#) $Id: calc.spec.in,v 30.12 2013/09/02 03:04:26 chongo Exp $
|
||||
# @(#) $Revision: 30.23 $
|
||||
# @(#) $Id: calc.spec.in,v 30.23 2014/09/22 05:01:58 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc/RCS/calc.spec.in,v $
|
||||
#
|
||||
# Under source code control: 2003/02/16 20:21:39
|
||||
@@ -31,13 +30,13 @@
|
||||
# BUGS
|
||||
# - Uninstalling calc and calc-devel leaves empty dirs /usr/include/calc
|
||||
# and /usr/share/calc and its subdirs. In case e.g. %{_includedir}/calc
|
||||
# is defined in `%files devel' section, then rpmbuild complains that
|
||||
# is defined in `files devel' section, then rpmbuild complains that
|
||||
# header files are defined twice - rpmbuild bug or bug in specfile conf???
|
||||
|
||||
Summary: Arbitrary precision calculator.
|
||||
Name: calc
|
||||
Version: <<<PROJECT_VERSION>>>
|
||||
Release: 11
|
||||
Release: 12
|
||||
License: LGPL
|
||||
Group: Applications/Engineering
|
||||
Source: http://www.isthe.com/chongo/src/calc/%{name}-%{version}.tar.bz2
|
||||
@@ -46,6 +45,8 @@ Vendor: Landon Noll and Associates
|
||||
Packager: Landon Noll and Associates (http://www.isthe.com/chongo/index.html)
|
||||
Requires: ncurses >= 5.5-24, readline >= 5.1-3, less >= 358
|
||||
BuildRequires: ncurses-devel >= 5.5-24, readline-devel >= 5.1-3
|
||||
Provides: libcalc.so.%{version}()(64bit)
|
||||
Provides: libcustcalc.so.%{version}()(64bit)
|
||||
BuildRoot: %{_tmppath}/build-root
|
||||
|
||||
%description
|
||||
@@ -61,7 +62,10 @@ For the latest calc release, see the calc project home page:
|
||||
%package devel
|
||||
Summary: Development files and documentation for calc.
|
||||
Group: Applications/Engineering
|
||||
Requires: calc = %{version}-%{release}
|
||||
Requires: calc(x86-64) = %{version}-%{release}
|
||||
Requires: libcalc.so.%{version}()(64bit)
|
||||
Requires: libcustcalc.so.%{version}()(64bit)
|
||||
Requires: ncurses >= 5.5-24, readline >= 5.1-3, less >= 358
|
||||
|
||||
%description devel
|
||||
This package contains the header files and static libraries for developing
|
||||
@@ -76,63 +80,67 @@ For the latest calc release, see the project home page:
|
||||
|
||||
%build
|
||||
echo '-=- calc.spec beginning make clobber -=-'
|
||||
make %{?_smp_mflags} T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||
MANDIR=%{_mandir}/man1 EXT= V=@ clobber
|
||||
echo '-=- calc.spec ending make clobber -=-'
|
||||
echo '-=- calc.spec beginning make calc-static-only -=-'
|
||||
make %{?_smp_mflags} T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||
MANDIR=%{_mandir}/man1 EXT= V=@ calc-static-only BLD_TYPE=calc-static-only
|
||||
echo '-=- calc.spec ending make calc-static-only -=-'
|
||||
echo '-=- calc.spec beginning make rpm-hide-static -=-'
|
||||
make %{?_smp_mflags} T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||
MANDIR=%{_mandir}/man1 EXT= V=@ rpm-hide-static
|
||||
echo '-=- calc.spec ending make rpm-hide-static -=-'
|
||||
echo '-=- calc.spec beginning make clobber (again) -=-'
|
||||
make %{?_smp_mflags} T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||
MANDIR=%{_mandir}/man1 EXT= V=@ clobber
|
||||
echo '-=- calc.spec ending make clobber (again) -=-'
|
||||
echo '-=- calc.spec beginning make calc-dynamic-only -=-'
|
||||
make %{?_smp_mflags} T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||
MANDIR=%{_mandir}/man1 EXT= V=@ calc-dynamic-only \
|
||||
BLD_TYPE=calc-dynamic-only LD_SHARE=
|
||||
echo '-=- calc.spec ending make calc-dynamic-only -=-'
|
||||
echo '-=- calc.spec beginning make chk -=-'
|
||||
make %{?_smp_mflags} T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||
MANDIR=%{_mandir}/man1 EXT= V=@ chk
|
||||
echo '-=- calc.spec ending make chk -=-'
|
||||
echo '-=- calc.spec beginning make rpm-unhide-static -=-'
|
||||
make %{?_smp_mflags} T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||
MANDIR=%{_mandir}/man1 EXT= V=@ rpm-unhide-static
|
||||
echo '-=- calc.spec ending make rpm-unhide-static -=-'
|
||||
echo '-=- calc.spec beginning make rpm-clean-static -=-'
|
||||
make %{?_smp_mflags} T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
||||
make -j1 BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||
MANDIR=%{_mandir}/man1 EXT= V=@ rpm-clean-static
|
||||
echo '-=- calc.spec ending make rpm-clean-static -=-'
|
||||
echo '-=- calc.spec beginning make rpm-chk-static -=-'
|
||||
make %{?_smp_mflags} T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||
MANDIR=%{_mandir}/man1 EXT= V=@ rpm-chk-static
|
||||
echo '-=- calc.spec ending make rpm-chk-static -=-'
|
||||
|
||||
%install
|
||||
echo '-=- calc.spec beginning make install -=-'
|
||||
rm -rf %{_buildroot}
|
||||
mkdir -p %{_buildroot}
|
||||
make T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||
MANDIR=%{_mandir}/man1 EXT= V=@ install
|
||||
echo '-=- calc.spec ending make install -=-'
|
||||
|
||||
%clean
|
||||
rm -rf %{_buildroot}
|
||||
echo '-=- calc.spec beginning make clean -=-'
|
||||
rm -rf %{_tmppath}
|
||||
rm -rf %{_builddir}
|
||||
rm -rf %{_specdir}
|
||||
rm -rf %{_buildrootdir}
|
||||
echo '-=- calc.spec beginning make clean -=-'
|
||||
|
||||
%files
|
||||
%defattr(-, root, root)
|
||||
@@ -148,9 +156,9 @@ rm -rf %{_buildroot}
|
||||
%attr(644, root, root) %{_datadir}/%{name}/*.cal
|
||||
%attr(644, root, root) %{_datadir}/%{name}/set8700.line
|
||||
%attr(644, root, root) %{_libdir}/libcalc.so
|
||||
%attr(644, root, root) %{_libdir}/libcalc.so.*
|
||||
%attr(644, root, root) %{_libdir}/libcalc.so.%{version}
|
||||
%attr(644, root, root) %{_libdir}/libcustcalc.so
|
||||
%attr(644, root, root) %{_libdir}/libcustcalc.so.*
|
||||
%attr(644, root, root) %{_libdir}/libcustcalc.so.%{version}
|
||||
|
||||
%files devel
|
||||
%defattr(-, root, root)
|
||||
@@ -161,10 +169,27 @@ rm -rf %{_buildroot}
|
||||
%attr(644, root, root) %{_libdir}/libcustcalc.a
|
||||
|
||||
%changelog
|
||||
* Mon Sep 01 2014 Landon Curt Noll http://www.isthe.com/chongo
|
||||
- Release: 12
|
||||
- Removed use of %{?_smp_mflags}. On Ubuntu 14.04, the -j2
|
||||
was executing make lines within a rule out of order. Always
|
||||
use -j1 while building these RPMs to avoid this make bug.
|
||||
This only impacts the speed of building the rpms.
|
||||
- Stopped removing %{_buildroot} at the beginning of install
|
||||
as this, acording to a number of sources, was asking for trouble.
|
||||
- Clean removes tmp, BUILD, SPEC, and BUILDROOT dirs under topdir.
|
||||
- Fixed the building of the calc-debuginfo rpm.
|
||||
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
|
||||
by assuming the date is correct and changing the weekday via BogusDateBot.
|
||||
Sun May 20 2006 --> Sun May 14 2006
|
||||
Sun Sep 01 2007 --> Sun Aug 26 2007
|
||||
Sat May 05 2013 --> Sat May 04 2013
|
||||
|
||||
* Sun Sep 01 2013 Landon Curt Noll http://www.isthe.com/chongo
|
||||
- Release: 11
|
||||
- only list %{_datadir}/%{name}/set8700.line not *.line
|
||||
* Sat May 05 2013 Landon Curt Noll http://www.isthe.com/chongo
|
||||
|
||||
* Sun May 05 2013 Landon Curt Noll http://www.isthe.com/chongo
|
||||
- Release: 10
|
||||
- Major bug rpm build process bug fix
|
||||
- Source: is a URL as per rpm requirements
|
||||
@@ -174,37 +199,46 @@ rm -rf %{_buildroot}
|
||||
- Fixed use of %{_buildroot}
|
||||
- Fixed permissions so that rpm build services can modify libraries
|
||||
- Added missing files to files section
|
||||
|
||||
* Mon Mar 25 2013 Landon Curt Noll http://www.isthe.com/chongo
|
||||
- Release: 9 (was 1.1)
|
||||
- Removed deprecated PreReq for calc-devel, using Requires
|
||||
* Sun Sep 01 2007 Landon Curt Noll http://www.isthe.com/chongo
|
||||
|
||||
* Sat Sep 01 2007 Landon Curt Noll http://www.isthe.com/chongo
|
||||
- Release: 8
|
||||
- Release of calc-2.12.2
|
||||
- Calc builds with shared libraries
|
||||
|
||||
* Sun Jun 25 2006 Landon Curt Noll http://www.isthe.com/chongo
|
||||
- Release: 7
|
||||
- Changed Copyright to License as per new rpm v4.4 syntax
|
||||
* Sun May 20 2006 Landon Curt Noll http://www.isthe.com/chongo
|
||||
|
||||
* Sat May 20 2006 Landon Curt Noll http://www.isthe.com/chongo
|
||||
- Release: 6
|
||||
- Release of calc-2.12.0
|
||||
- Added *.line set files to the list of packaged files
|
||||
|
||||
* Sun Dec 11 2005 Landon Curt Noll http://www.isthe.com/chongo
|
||||
- Release: 5
|
||||
- Release of calc-2.11.11
|
||||
- Fixed description in spec file
|
||||
|
||||
* Wed Feb 26 2003 Landon Curt Noll http://www.isthe.com/chongo
|
||||
- Release: 4
|
||||
- Release of calc-2.11.7-2
|
||||
- Fixed attributes on include and lib calc-devel files
|
||||
- Added BUGS to calc-devel as well as calc
|
||||
|
||||
* Tue Feb 25 2003 Landon Curt Noll http://www.isthe.com/chongo
|
||||
- Release: 3
|
||||
- Release of calc-2.11.7-1
|
||||
- Require ncurses, readline and less to install.
|
||||
- Require ncurses-devel and readline-devel to build.
|
||||
|
||||
* Tue Feb 18 2003 Landon Curt Noll http://www.isthe.com/chongo
|
||||
- Release: 2
|
||||
- Misc changes to fit local directory setup
|
||||
|
||||
* Sun Feb 16 2003 Petteri Kettunen <petterik@users.sourceforge.net>
|
||||
- Release: 1
|
||||
- initial RPM build
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#
|
||||
# @(#) $Revision: 30.2 $
|
||||
# @(#) $Id: check.awk,v 30.2 2013/08/11 01:08:32 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/RCS/check.awk,v $
|
||||
# @(#) $Source: /usr/local/src/bin/calc/RCS/check.awk,v $
|
||||
#
|
||||
# Under source code control: 1996/05/25 22:07:58
|
||||
# File existed as early as: 1996
|
||||
|
12
cmath.h
12
cmath.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* cmath - data structures for extended precision complex arithmetic
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
* Copyright (C) 1999-2007,2014 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: cmath.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: cmath.h,v 30.3 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/cmath.h,v $
|
||||
*
|
||||
* Under source code control: 1993/07/30 19:42:45
|
||||
@@ -28,8 +28,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__CMATH_H__)
|
||||
#define __CMATH_H__
|
||||
#if !defined(INCLUDE_CMATH_H)
|
||||
#define INCLUDE_CMATH_H
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
@@ -156,4 +156,4 @@ E_FUNC COMPLEX *swap_HALF_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all);
|
||||
EXTERN COMPLEX _czero_, _cone_, _conei_;
|
||||
|
||||
|
||||
#endif /* !__CMATH_H__ */
|
||||
#endif /* !INCLUDE_CMATH_H */
|
||||
|
14
codegen.c
14
codegen.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* codegen - module to generate opcodes from the input tokens
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell and Ernest Bowen
|
||||
* Copyright (C) 1999-2007,2017 David I. Bell and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,9 +19,9 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.4 $
|
||||
* @(#) $Id: codegen.c,v 30.4 2013/08/11 08:41:38 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/codegen.c,v $
|
||||
* @(#) $Revision: 30.5 $
|
||||
* @(#) $Id: codegen.c,v 30.5 2017/05/19 16:09:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc-RHEL7/RCS/codegen.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:13
|
||||
* File existed as early as: before 1990
|
||||
@@ -148,7 +148,11 @@ getcommands(BOOL toplevel)
|
||||
case 1:
|
||||
case -1:
|
||||
if(i == 1) {
|
||||
strcpy(name, DEFAULTCALCHELP);
|
||||
strncpy(name,
|
||||
DEFAULTCALCHELP,
|
||||
MAXCMD);
|
||||
/* paranoia */
|
||||
name[MAXCMD] = '\0';
|
||||
givehelp(name);
|
||||
}
|
||||
break;
|
||||
|
12
config.h
12
config.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* config - configuration routines
|
||||
*
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll and David I. Bell
|
||||
* Copyright (C) 1999-2007,2014 Landon Curt Noll and David I. Bell
|
||||
*
|
||||
* Primary author: Landon Curt Noll
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: config.h,v 30.2 2007/09/21 01:27:27 chongo Exp $
|
||||
* @(#) $Revision: 30.4 $
|
||||
* @(#) $Id: config.h,v 30.4 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/config.h,v $
|
||||
*
|
||||
* Under source code control: 1995/11/01 22:20:17
|
||||
@@ -31,8 +31,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__CONFIG_H__)
|
||||
#define __CONFIG_H__
|
||||
#if !defined(INCLUDE_CONFIG_H)
|
||||
#define INCLUDE_CONFIG_H
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
@@ -226,4 +226,4 @@ E_FUNC void config_print(CONFIG*);
|
||||
E_FUNC BOOL config_cmp(CONFIG*, CONFIG*);
|
||||
|
||||
|
||||
#endif /* !__CONFIG_H__ */
|
||||
#endif /* !INCLUDE_CONFIG_H */
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/src/cmd/calc/calc -q -s -f
|
||||
#!/usr/local/src/bin/calc/calc -q -s -f
|
||||
/*
|
||||
* 4dsphere - determine if 6 points lie on the surface of a sphere in R^4
|
||||
*
|
||||
@@ -10,7 +10,7 @@
|
||||
* ... ...
|
||||
* x5 y5 z5 w5 point 5 in R^4
|
||||
*
|
||||
* Copyright (C) 2001 Landon Curt Noll
|
||||
* Copyright (C) 2001,2014 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
|
||||
@@ -26,8 +26,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: 4dsphere.calc,v 30.1 2007/03/16 11:12:11 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: 4dsphere.calc,v 30.3 2014/08/24 22:04:32 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/cscript/RCS/4dsphere.calc,v $
|
||||
*
|
||||
* Under source code control: 2001/05/03 19:02:03
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# cscript - makefile for calc shell script files
|
||||
#
|
||||
# Copyright (C) 1999-2006 Landon Curt Noll
|
||||
# Copyright (C) 1999-2006,2014,2017 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
|
||||
@@ -17,9 +17,9 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# @(#) $Revision: 30.4 $
|
||||
# @(#) $Id: Makefile,v 30.4 2013/08/11 08:41:38 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc/cscript/RCS/Makefile,v $
|
||||
# @(#) $Revision: 30.10 $
|
||||
# @(#) $Id: Makefile,v 30.10 2017/05/19 16:09:14 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc-RHEL7/cscript/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1999/11/29 11:10:26
|
||||
# File existed as early as: 1999
|
||||
@@ -227,7 +227,7 @@ all: ${TARGETS} .all
|
||||
|
||||
README: README.src
|
||||
@${RM} -f $@
|
||||
@${SED} -e "s:#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
@${SED} -e "s:#!/usr/local/src/bin/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
|
||||
# used by the upper level Makefile to determine if we have done all
|
||||
#
|
||||
@@ -315,9 +315,8 @@ depend:
|
||||
if [ X"$$i" != X"/dev/null" ]; then \
|
||||
echo "$$i: $$i.calc"; \
|
||||
echo ' @$${RM} -f $$@'; \
|
||||
echo -n ' @$${SED} -e "1s:'; \
|
||||
echo "^#!/usr/local/src/cmd/calc/calc:#!$${BINDIR}/calc:" \
|
||||
$$?>$$@'; \
|
||||
echo -n ' @$${SED} -e "1s:^#!/usr/local/src/bin/'; \
|
||||
echo 'calc/calc:#!$${BINDIR}/calc:" $$?>$$@'; \
|
||||
echo ' @$${CHMOD} +x $$@'; \
|
||||
fi; \
|
||||
done >> makedep.out
|
||||
@@ -341,9 +340,9 @@ depend:
|
||||
fi; \
|
||||
${MV} ${MAKE_FILE}.tmp ${MAKE_FILE}; \
|
||||
if [ -d RCS ]; then \
|
||||
echo '*****************************************************'; \
|
||||
echo 'new sample ${MAKE_FILE} formed -- need to check it in'; \
|
||||
echo '*****************************************************'; \
|
||||
echo '******************************************************'; \
|
||||
echo 'new cscript ${MAKE_FILE} formed -- need to check it in'; \
|
||||
echo '******************************************************'; \
|
||||
fi; \
|
||||
fi
|
||||
|
||||
@@ -372,6 +371,10 @@ clean:
|
||||
clobber: clean
|
||||
${RM} -f .all
|
||||
${RM} -f ${TARGETS}
|
||||
-${Q} if [ -e .DS_Store ]; then \
|
||||
echo ${RM} -rf .DS_Store; \
|
||||
${RM} -rf .DS_Store; \
|
||||
fi
|
||||
|
||||
# install everything
|
||||
#
|
||||
@@ -379,8 +382,8 @@ clobber: clean
|
||||
#
|
||||
install: all
|
||||
-${Q} if [ ! -d ${T}${BINDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${BINDIR}; \
|
||||
${MKDIR} ${T}${BINDIR}; \
|
||||
echo ${MKDIR} -p ${T}${BINDIR}; \
|
||||
${MKDIR} -p ${T}${BINDIR}; \
|
||||
if [ ! -d "${T}${BINDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${BINDIR}"; \
|
||||
${MKDIR} -p "${T}${BINDIR}"; \
|
||||
@@ -391,8 +394,8 @@ install: all
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${SCRIPTDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${SCRIPTDIR}; \
|
||||
${MKDIR} ${T}${SCRIPTDIR}; \
|
||||
echo ${MKDIR} -p ${T}${SCRIPTDIR}; \
|
||||
${MKDIR} -p ${T}${SCRIPTDIR}; \
|
||||
if [ ! -d "${T}${SCRIPTDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${SCRIPTDIR}"; \
|
||||
${MKDIR} -p "${T}${SCRIPTDIR}"; \
|
||||
@@ -446,33 +449,33 @@ uninstall:
|
||||
|
||||
4dsphere: 4dsphere.calc
|
||||
@${RM} -f $@
|
||||
@${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
@${SED} -e "1s:^#!/usr/local/src/bin/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
@${CHMOD} +x $@
|
||||
fproduct: fproduct.calc
|
||||
@${RM} -f $@
|
||||
@${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
@${SED} -e "1s:^#!/usr/local/src/bin/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
@${CHMOD} +x $@
|
||||
mersenne: mersenne.calc
|
||||
@${RM} -f $@
|
||||
@${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
@${SED} -e "1s:^#!/usr/local/src/bin/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
@${CHMOD} +x $@
|
||||
piforever: piforever.calc
|
||||
@${RM} -f $@
|
||||
@${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
@${SED} -e "1s:^#!/usr/local/src/bin/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
@${CHMOD} +x $@
|
||||
plus: plus.calc
|
||||
@${RM} -f $@
|
||||
@${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
@${SED} -e "1s:^#!/usr/local/src/bin/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
@${CHMOD} +x $@
|
||||
powerterm: powerterm.calc
|
||||
@${RM} -f $@
|
||||
@${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
@${SED} -e "1s:^#!/usr/local/src/bin/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
@${CHMOD} +x $@
|
||||
simple: simple.calc
|
||||
@${RM} -f $@
|
||||
@${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
@${SED} -e "1s:^#!/usr/local/src/bin/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
@${CHMOD} +x $@
|
||||
square: square.calc
|
||||
@${RM} -f $@
|
||||
@${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
@${SED} -e "1s:^#!/usr/local/src/bin/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
@${CHMOD} +x $@
|
||||
|
@@ -7,7 +7,7 @@ be useful!
|
||||
|
||||
Please note that calc shell scripts must start with the line:
|
||||
|
||||
#!/usr/local/src/cmd/calc/calc -q -f
|
||||
#!/usr/local/src/bin/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
|
||||
@@ -18,7 +18,7 @@ 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
|
||||
#!/usr/local/src/bin/calc/calc -q -f
|
||||
|
||||
/* a correct comment */
|
||||
## another correct comment
|
||||
@@ -36,27 +36,51 @@ For more informaton about calc command lines, see "help usage".
|
||||
|
||||
This next example WRONG:
|
||||
|
||||
#!/usr/local/src/cmd/calc/calc -q
|
||||
#!/usr/local/src/bin/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:
|
||||
|
||||
calc-contrib at asthe dot com
|
||||
|
||||
[[ NOTE: Replace 'at' with @, 'dot' is with . and remove the spaces ]]
|
||||
[[ NOTE: The EMail address uses 'asthe' and the web site URL uses 'isthe' ]]
|
||||
=-=
|
||||
|
||||
For more info, see:
|
||||
|
||||
help script
|
||||
help cscript
|
||||
|
||||
#####
|
||||
|
||||
If you write something that you think is useful, please join the
|
||||
low volume calc mailing list calc-tester. Then send your contribution
|
||||
to the calc-tester mailing list.
|
||||
|
||||
To subscribe to the calc-tester mailing list, visit the following URL:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/calc-tester.html
|
||||
|
||||
This is a low volume moderated mailing list.
|
||||
|
||||
This mailing list replaces calc-tester at asthe dot com list.
|
||||
|
||||
If you need a human to help you with your mailing list subscription,
|
||||
please send EMail to our special:
|
||||
|
||||
calc-tester-maillist-help at asthe dot com
|
||||
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
|
||||
address. To be sure we see your EMail asking for help with your
|
||||
mailing list subscription, please use the following phase in your
|
||||
EMail Subject line:
|
||||
|
||||
calc tester mailing list help
|
||||
|
||||
That phrase in your subject line will help ensure your
|
||||
request will get past our anti-spam filters. You may have
|
||||
additional words in your subject line.
|
||||
|
||||
=-=
|
||||
|
||||
4dsphere
|
||||
@@ -101,7 +125,7 @@ simple
|
||||
|
||||
A trivial example of a calc shell script.
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
## Copyright (C) 1999,2014 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
|
||||
@@ -117,8 +141,8 @@ simple
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: README.src,v 30.1 2007/03/16 11:12:11 chongo Exp $
|
||||
## @(#) $Revision: 30.5 $
|
||||
## @(#) $Id: README.src,v 30.5 2014/10/12 12:23:43 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/cscript/RCS/README.src,v $
|
||||
##
|
||||
## Under source code control: 1999/12/17 10:23:40
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/src/cmd/calc/calc -q -s -f
|
||||
#!/usr/local/src/bin/calc/calc -q -s -f
|
||||
/*
|
||||
* fproduct - write the big Endian product of terms to a file
|
||||
*
|
||||
@@ -8,7 +8,7 @@
|
||||
* filename where to write the product, use - for stdout
|
||||
* term ... terms to multiply
|
||||
*
|
||||
* Copyright (C) 2001 Landon Curt Noll
|
||||
* Copyright (C) 2001,2014 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
|
||||
@@ -24,8 +24,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: fproduct.calc,v 30.1 2007/03/16 11:12:11 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: fproduct.calc,v 30.3 2014/08/24 22:04:32 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/cscript/RCS/fproduct.calc,v $
|
||||
*
|
||||
* Under source code control: 2001/04/07 20:13:11
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#!/usr/local/src/cmd/calc/calc -q -s -f
|
||||
#!/usr/local/src/bin/calc/calc -q -s -f
|
||||
/*
|
||||
* mersenne - print the value of a mersenne number
|
||||
*
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007,2014 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
|
||||
@@ -18,8 +18,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: mersenne.calc,v 30.1 2007/03/16 11:12:11 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: mersenne.calc,v 30.3 2014/08/24 22:04:32 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/cscript/RCS/mersenne.calc,v $
|
||||
*
|
||||
* Under source code control: 1999/11/30 00:09:01;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#!/usr/local/src/cmd/calc/calc -q -f
|
||||
#!/usr/local/src/bin/calc/calc -q -f
|
||||
/*
|
||||
* piforever - print digits of pi forever (or as long as your mem/cpu allow)
|
||||
*
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007,2014 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
|
||||
@@ -18,8 +18,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: piforever.calc,v 30.1 2007/03/16 11:12:11 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: piforever.calc,v 30.3 2014/08/24 22:04:32 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/cscript/RCS/piforever.calc,v $
|
||||
*
|
||||
* Under source code control: 1999/11/30 00:11:36
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#!/usr/local/src/cmd/calc/calc -q -f
|
||||
#!/usr/local/src/bin/calc/calc -q -f
|
||||
/*
|
||||
* plus - add two or more arguments together
|
||||
*
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007,2014 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
|
||||
@@ -18,8 +18,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: plus.calc,v 30.1 2007/03/16 11:12:11 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: plus.calc,v 30.3 2014/08/24 22:04:32 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/cscript/RCS/plus.calc,v $
|
||||
*
|
||||
* Under source code control: 1999/11/29 10:22:37
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/src/cmd/calc/calc -q -s -f
|
||||
#!/usr/local/src/bin/calc/calc -q -s -f
|
||||
/*
|
||||
* powerterm - print the argument as a sum of powers of integers
|
||||
*
|
||||
@@ -8,7 +8,7 @@
|
||||
* base_limit largest base we will consider (def: 10000)
|
||||
* value value to convert into sums of powers of integers
|
||||
*
|
||||
* Copyright (C) 2001 Landon Curt Noll
|
||||
* Copyright (C) 2001,2014 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the powerterm of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -24,8 +24,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: powerterm.calc,v 30.1 2007/03/16 11:12:11 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: powerterm.calc,v 30.3 2014/08/24 22:04:32 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/cscript/RCS/powerterm.calc,v $
|
||||
*
|
||||
* Under source code control: 2001/04/24 23:49:11
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#!/usr/local/src/cmd/calc/calc -q -f
|
||||
#!/usr/local/src/bin/calc/calc -q -f
|
||||
/*
|
||||
* simple - an example of a simple calc shell script
|
||||
*
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007,2014 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
|
||||
@@ -18,8 +18,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: simple.calc,v 30.1 2007/03/16 11:12:11 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: simple.calc,v 30.3 2014/08/24 22:04:32 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/cscript/RCS/simple.calc,v $
|
||||
*
|
||||
* Under source code control: 1999/11/29 10:22:37
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#!/usr/local/src/cmd/calc/calc -q -f
|
||||
#!/usr/local/src/bin/calc/calc -q -f
|
||||
/*
|
||||
* sqaure - print the squares of input values
|
||||
*
|
||||
* Copyright (C) 2000-2007 Ernest Bowen
|
||||
* Copyright (C) 2000-2007,2014 Ernest Bowen
|
||||
*
|
||||
* 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
|
||||
@@ -18,8 +18,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: square.calc,v 30.1 2007/03/16 11:12:11 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: square.calc,v 30.3 2014/08/24 22:04:32 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/cscript/RCS/square.calc,v $
|
||||
*
|
||||
* Under source code control: 2000/12/15 06:52:01
|
||||
|
184
custom/Makefile
184
custom/Makefile
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# custom - makefile for calc custom routines
|
||||
#
|
||||
# Copyright (C) 1999-2006 Landon Curt Noll
|
||||
# Copyright (C) 1999-2006,2014,2017 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
|
||||
@@ -18,9 +18,9 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# @(#) $Revision: 30.31 $
|
||||
# @(#) $Id: Makefile.head,v 30.31 2013/09/27 08:55:28 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc/custom/RCS/Makefile.head,v $
|
||||
# @(#) $Revision: 30.42 $
|
||||
# @(#) $Id: Makefile.head,v 30.42 2017/05/19 16:09:14 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc-RHEL7/custom/RCS/Makefile.head,v $
|
||||
#
|
||||
# Under source code control: 1997/03/09 02:28:54
|
||||
# File existed as early as: 1997
|
||||
@@ -337,20 +337,6 @@ CALC_ENV= CALCPATH=./cal
|
||||
ALLOW_CUSTOM= -DCUSTOM
|
||||
#ALLOW_CUSTOM=
|
||||
|
||||
# The install rule uses:
|
||||
#
|
||||
# ${MKDIR} ${MKDIR_ARG}
|
||||
#
|
||||
# to create directorties. Normall this amounts to usins mkdir -p dir ...
|
||||
# Some older systems may not have mkdir -p. If you system does not
|
||||
# make mkdir -p, then set MKDIR_ARG to empty.
|
||||
#
|
||||
# MKDIR_ARG= -p # use mkdir -p when creating paths
|
||||
# MKDIR_ARG= # use if system does not understand mkdir -p
|
||||
#
|
||||
MKDIR_ARG= -p
|
||||
#MKDIR_ARG=
|
||||
|
||||
# Some out of date operating systems require / want an executable to
|
||||
# end with a certain file extension. Some compile systems such as
|
||||
# Cygwin build calc as calc.exe. The EXT variable is used to denote
|
||||
@@ -366,18 +352,12 @@ EXT=
|
||||
|
||||
# The default calc versions
|
||||
#
|
||||
VERSION= 2.12.4.13
|
||||
VERS= 2.12.4
|
||||
VER= 2.12
|
||||
VE= 2
|
||||
VERSION= 2.12.5.5
|
||||
|
||||
# Names of shared libraries with versions
|
||||
#
|
||||
LIB_EXT= .so
|
||||
LIB_EXT_VERSION= ${LIB_EXT}.${VERSION}
|
||||
LIB_EXT_VERS= ${LIB_EXT}.${VERS}
|
||||
LIB_EXT_VER= ${LIB_EXT}.${VER}
|
||||
LIB_EXT_VE= ${LIB_EXT}.${VE}
|
||||
|
||||
# standard tools
|
||||
#
|
||||
@@ -478,7 +458,7 @@ LDFLAGS= ${LD_DEBUG} ${ILDFLAGS}
|
||||
# LIBCALC_SHLIB are flags given to ${CC} to build libcalc shared libraries
|
||||
# LIBCUSTCALC_SHLIB are flags given to ${CC} to build libcustcalc shared lib
|
||||
#
|
||||
# NOTE: The above 4 values are unused if BLD_TYPE= calc-static-only
|
||||
# NOTE: The above 5 values are unused if BLD_TYPE= calc-static-only
|
||||
#
|
||||
# CC_STATIC are flags given to ${CC} to build .o files suitable for static libs
|
||||
# LD_STATIC are common flags given to ${CC} to link with static libraries
|
||||
@@ -489,6 +469,17 @@ LDFLAGS= ${LD_DEBUG} ${ILDFLAGS}
|
||||
#
|
||||
# CCOPT are flags given to ${CC} for optimization
|
||||
# CCWARN are flags given to ${CC} for warning message control
|
||||
#
|
||||
# WNO_IMPLICT, WNO_ERROR_LONG_LONG and WNO_LONG_LONG are given to ${CC}
|
||||
# when compiling special .o files that may need special compile options
|
||||
# NOTE: These flags simply turn off certain compiler warnings,
|
||||
# which is useful only when CCWERR is set to -Werror.
|
||||
# NOTE: If your compiler does not have these -Wno files, just
|
||||
# set these variables to nothing as in:
|
||||
# WNO_IMPLICT=
|
||||
# WNO_ERROR_LONG_LONG=
|
||||
# WNO_LONG_LONG=
|
||||
#
|
||||
# CCWERR are flags given to ${CC} to make warnings fatal errors
|
||||
# NOTE: CCWERR is only set in development Makefiles and must only be
|
||||
# used with ${CC}, not ${LCC}. If you do not want the compiler
|
||||
@@ -535,7 +526,10 @@ LD_STATIC=
|
||||
LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
#
|
||||
CCWARN= -Wall -W -Wno-comment
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
WNO_LONG_LONG= -Wno-long-long
|
||||
CCWERR=
|
||||
CCOPT= ${DEBUG}
|
||||
CCMISC=
|
||||
@@ -545,9 +539,9 @@ CC= ${PURIFY} ${LCC} ${CCWERR}
|
||||
#
|
||||
endif
|
||||
|
||||
#################################
|
||||
# Apple MacOS X / Darwin target #
|
||||
#################################
|
||||
##############################
|
||||
# Apple OS X / Darwin target #
|
||||
##############################
|
||||
|
||||
ifeq ($(target),Darwin)
|
||||
#
|
||||
@@ -556,9 +550,23 @@ BLD_TYPE= calc-dynamic-only
|
||||
CC_SHARE= -fPIC
|
||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:${LIBDIR}:/usr/local/lib
|
||||
LD_SHARE= ${DARWIN_ARCH}
|
||||
LIBCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib
|
||||
#SET_INSTALL_NAME= no
|
||||
SET_INSTALL_NAME= yes
|
||||
ifeq ($(SET_INSTALL_NAME),yes)
|
||||
LIBCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib \
|
||||
-install_name ${LIBDIR}/libcalc${LIB_EXT_VERSION} ${DARWIN_ARCH}
|
||||
else
|
||||
LIBCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib \
|
||||
${DARWIN_ARCH}
|
||||
endif
|
||||
ifdef ALLOW_CUSTOM
|
||||
LIBCUSTCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib
|
||||
ifeq ($(SET_INSTALL_NAME),yes)
|
||||
LIBCUSTCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib \
|
||||
-install_name ${LIBDIR}/libcustcalc${LIB_EXT_VERSION} ${DARWIN_ARCH}
|
||||
else
|
||||
LIBCUSTCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib \
|
||||
${DARWIN_ARCH}
|
||||
endif
|
||||
else
|
||||
LIBCUSTCALC_SHLIB=
|
||||
endif
|
||||
@@ -568,28 +576,37 @@ LD_STATIC= ${DARWIN_ARCH}
|
||||
LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
#
|
||||
CCWARN= -Wall -W -Wno-comment
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
WNO_LONG_LONG= -Wno-long-long
|
||||
CCWERR=
|
||||
CCOPT= ${DEBUG}
|
||||
CCMISC= ${DARWIN_ARCH}
|
||||
#
|
||||
LCC= MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} gcc
|
||||
LCC= clang
|
||||
CC= ${PURIFY} ${LCC} ${CCWERR}
|
||||
#
|
||||
# Darwin dynamic shared lib filenames
|
||||
LIB_EXT:= .dylib
|
||||
LIB_EXT_VERSION:= .${VERSION}${LIB_EXT}
|
||||
LIB_EXT_VERS:= .${VERS}${LIB_EXT}
|
||||
LIB_EXT_VER:= .${VER}${LIB_EXT}
|
||||
LIB_EXT_VE:= .${VE}${LIB_EXT}
|
||||
# LDCONFIG not required on this platform, so we redefine it to an empty string
|
||||
LDCONFIG:=
|
||||
# DARWIN_ARCH= -arch i386 -arch ppc # Universal binary
|
||||
# DARWIN_ARCH= -arch i386 # Intel binary
|
||||
# DARWIN_ARCH= -arch ppc # PPC binary
|
||||
# DARWIN_ARCH= -arch x86_64 # native 64-bit binary
|
||||
DARWIN_ARCH= # native binary
|
||||
MACOSX_DEPLOYMENT_TARGET=10.8
|
||||
#
|
||||
# Starting with El Capitan OS X 10.11, root by default could not
|
||||
# mkdir under system locations, so we now use the /usr/local tree.
|
||||
#
|
||||
OPTDIR:= /usr/local
|
||||
BINDIR:= /${OPTDIR}/bin
|
||||
LIBDIR:= /${OPTDIR}/lib
|
||||
CALC_SHAREDIR:= /${OPTDIR}/share
|
||||
CALC_INCDIR:= /${OPTDIR}/include
|
||||
SCRIPTDIR:= ${BINDIR}/cscript
|
||||
endif
|
||||
|
||||
##################
|
||||
@@ -622,7 +639,10 @@ LD_STATIC=
|
||||
LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
#
|
||||
CCWARN= -Wall -W -Wno-comment
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
WNO_LONG_LONG= -Wno-long-long
|
||||
CCWERR=
|
||||
CCOPT= ${DEBUG}
|
||||
CCMISC=
|
||||
@@ -665,6 +685,9 @@ LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
#
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
WNO_LONG_LONG= -Wno-long-long
|
||||
CCWERR=
|
||||
CCOPT= ${DEBUG}
|
||||
CCMISC=
|
||||
@@ -680,7 +703,6 @@ endif
|
||||
# SunOS target #
|
||||
################
|
||||
|
||||
# XXX - this needs to be tested
|
||||
ifeq ($(target),SunOS)
|
||||
#
|
||||
BLD_TYPE= calc-dynamic-only
|
||||
@@ -701,7 +723,10 @@ LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
LD_STATIC=
|
||||
#
|
||||
CCWARN= -Wall -W -Wno-comment
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
WNO_LONG_LONG= -Wno-long-long
|
||||
CCWERR=
|
||||
CCOPT= ${DEBUG}
|
||||
CCMISC=
|
||||
@@ -735,7 +760,10 @@ LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
LD_STATIC=
|
||||
#
|
||||
CCWARN= -Wall -W -Wno-comment
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
WNO_LONG_LONG= -Wno-long-long
|
||||
CCWERR=
|
||||
CCOPT= ${DEBUG}
|
||||
CCMISC=
|
||||
@@ -769,7 +797,10 @@ LD_STATIC=
|
||||
LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
#
|
||||
CCWARN= -Wall -W -Wno-comment
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
WNO_LONG_LONG= -Wno-long-long
|
||||
CCWERR=
|
||||
CCOPT= ${DEBUG}
|
||||
CCMISC=
|
||||
@@ -804,10 +835,10 @@ EXT=.exe
|
||||
TERMCONTROL= -DUSE_WIN32
|
||||
ifdef ALLOW_CUSTOM
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR}
|
||||
CALCPATH= .;./cal;~/.cal;${T}${CALC_SHAREDIR};${T}${CUSTOMCALDIR}
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
else
|
||||
CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR}
|
||||
CALCPATH= .;./cal;~/.cal;${T}${CALC_SHAREDIR}
|
||||
endif
|
||||
CALCRC= ${CALC_SHAREDIR}/startup;~/.calcrc;./.calcinit
|
||||
#
|
||||
@@ -829,7 +860,10 @@ LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
LD_STATIC=
|
||||
#
|
||||
CCWARN= -Wall -W -Wno-comment
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
WNO_LONG_LONG= -Wno-long-long
|
||||
CCWERR=
|
||||
CCOPT= ${DEBUG}
|
||||
CCMISC= -DNOTCYGWIN
|
||||
@@ -866,7 +900,10 @@ LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
LD_STATIC=
|
||||
#
|
||||
CCWARN= -Wall -W -Wno-comment
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
WNO_LONG_LONG= -Wno-long-long
|
||||
CCWERR=
|
||||
CCOPT= ${DEBUG}
|
||||
CCMISC=
|
||||
@@ -1086,8 +1123,8 @@ depend:
|
||||
fi
|
||||
${Q} echo forming custom/skel
|
||||
${Q} ${RM} -rf skel
|
||||
${Q} ${MKDIR} skel
|
||||
${Q} ${MKDIR} skel/custom
|
||||
${Q} ${MKDIR} -p skel
|
||||
${Q} ${MKDIR} -p skel/custom
|
||||
-${Q} for i in ${C_SRC} /dev/null; do \
|
||||
if [ X"$$i" != X"/dev/null" ]; then \
|
||||
${SED} -n '/^#[ ]*include[ ]*"/p' \
|
||||
@@ -1198,23 +1235,38 @@ clobber: clean
|
||||
${RM} -f ${BLD_TYPE}
|
||||
${RM} -f .all ${MAKE_FILE}.tmp ${MAKE_FILE}.bak
|
||||
${RM} -f libcustcalc${LIB_EXT_VERSION}
|
||||
${RM} -f libcustcalc${LIB_EXT_VERS}
|
||||
${RM} -f libcustcalc${LIB_EXT_VER}
|
||||
${RM} -f libcustcalc${LIB_EXT_VE}
|
||||
${RM} -f libcustcalc${LIB_EXT}
|
||||
${RM} -f libcustcalc.a
|
||||
${RM} -f libcustcalc*
|
||||
${V} echo remove files that are obsolete
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
${RM} -f Makefile.simple
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
-${Q} if [ -e .DS_Store ]; then \
|
||||
echo ${RM} -rf .DS_Store; \
|
||||
${RM} -rf .DS_Store; \
|
||||
fi
|
||||
|
||||
# install everything
|
||||
#
|
||||
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
||||
#
|
||||
install: all
|
||||
-${Q} if [ ! -d ${T}${LIBDIR} ]; then \
|
||||
echo ${MKDIR} -p ${T}${LIBDIR}; \
|
||||
${MKDIR} -p ${T}${LIBDIR}; \
|
||||
if [ ! -d "${T}${LIBDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${LIBDIR}"; \
|
||||
${MKDIR} -p "${T}${LIBDIR}"; \
|
||||
fi; \
|
||||
echo ${CHMOD} 0755 ${T}${LIBDIR}; \
|
||||
${CHMOD} 0755 ${T}${LIBDIR}; \
|
||||
else \
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${INCDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${INCDIR}; \
|
||||
${MKDIR} ${T}${INCDIR}; \
|
||||
echo ${MKDIR} -p ${T}${INCDIR}; \
|
||||
${MKDIR} -p ${T}${INCDIR}; \
|
||||
if [ ! -d "${T}${INCDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${INCDIR}"; \
|
||||
${MKDIR} -p "${T}${INCDIR}"; \
|
||||
@@ -1225,8 +1277,8 @@ install: all
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${CALC_SHAREDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${CALC_SHAREDIR}; \
|
||||
${MKDIR} ${T}${CALC_SHAREDIR}; \
|
||||
echo ${MKDIR} -p ${T}${CALC_SHAREDIR}; \
|
||||
${MKDIR} -p ${T}${CALC_SHAREDIR}; \
|
||||
if [ ! -d "${T}${CALC_SHAREDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${CALC_SHAREDIR}"; \
|
||||
${MKDIR} -p "${T}${CALC_SHAREDIR}"; \
|
||||
@@ -1237,8 +1289,8 @@ install: all
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${CALC_INCDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${CALC_INCDIR}; \
|
||||
${MKDIR} ${T}${CALC_INCDIR}; \
|
||||
echo ${MKDIR} -p ${T}${CALC_INCDIR}; \
|
||||
${MKDIR} -p ${T}${CALC_INCDIR}; \
|
||||
if [ ! -d "${T}${CALC_INCDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${CALC_INCDIR}"; \
|
||||
${MKDIR} -p "${T}${CALC_INCDIR}"; \
|
||||
@@ -1249,8 +1301,8 @@ install: all
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${HELPDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${HELPDIR}; \
|
||||
${MKDIR} ${T}${HELPDIR}; \
|
||||
echo ${MKDIR} -p ${T}${HELPDIR}; \
|
||||
${MKDIR} -p ${T}${HELPDIR}; \
|
||||
if [ ! -d "${T}${HELPDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${HELPDIR}"; \
|
||||
${MKDIR} -p "${T}${HELPDIR}"; \
|
||||
@@ -1261,8 +1313,8 @@ install: all
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${CUSTOMCALDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${CUSTOMCALDIR}; \
|
||||
${MKDIR} ${T}${CUSTOMCALDIR}; \
|
||||
echo ${MKDIR} -p ${T}${CUSTOMCALDIR}; \
|
||||
${MKDIR} -p ${T}${CUSTOMCALDIR}; \
|
||||
if [ ! -d "${T}${CUSTOMCALDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${CUSTOMCALDIR}"; \
|
||||
${MKDIR} -p "${T}${CUSTOMCALDIR}"; \
|
||||
@@ -1273,8 +1325,8 @@ install: all
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${CUSTOMHELPDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${CUSTOMHELPDIR}; \
|
||||
${MKDIR} ${T}${CUSTOMHELPDIR}; \
|
||||
echo ${MKDIR} -p ${T}${CUSTOMHELPDIR}; \
|
||||
${MKDIR} -p ${T}${CUSTOMHELPDIR}; \
|
||||
if [ ! -d "${T}${CUSTOMHELPDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${CUSTOMHELPDIR}"; \
|
||||
${MKDIR} -p "${T}${CUSTOMHELPDIR}"; \
|
||||
@@ -1285,8 +1337,8 @@ install: all
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${CUSTOMINCDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${CUSTOMINCDIR}; \
|
||||
${MKDIR} ${T}${CUSTOMINCDIR}; \
|
||||
echo ${MKDIR} -p ${T}${CUSTOMINCDIR}; \
|
||||
${MKDIR} -p ${T}${CUSTOMINCDIR}; \
|
||||
if [ ! -d "${T}${CUSTOMINCDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${CUSTOMINCDIR}"; \
|
||||
${MKDIR} -p "${T}${CUSTOMINCDIR}"; \
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# custom - makefile for calc custom routines
|
||||
#
|
||||
# Copyright (C) 1999-2006 Landon Curt Noll
|
||||
# Copyright (C) 1999-2006,2014,2017 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
|
||||
@@ -18,9 +18,9 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# @(#) $Revision: 30.31 $
|
||||
# @(#) $Id: Makefile.head,v 30.31 2013/09/27 08:55:28 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc/custom/RCS/Makefile.head,v $
|
||||
# @(#) $Revision: 30.42 $
|
||||
# @(#) $Id: Makefile.head,v 30.42 2017/05/19 16:09:14 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc-RHEL7/custom/RCS/Makefile.head,v $
|
||||
#
|
||||
# Under source code control: 1997/03/09 02:28:54
|
||||
# File existed as early as: 1997
|
||||
@@ -337,20 +337,6 @@ CALC_ENV= CALCPATH=./cal
|
||||
ALLOW_CUSTOM= -DCUSTOM
|
||||
#ALLOW_CUSTOM=
|
||||
|
||||
# The install rule uses:
|
||||
#
|
||||
# ${MKDIR} ${MKDIR_ARG}
|
||||
#
|
||||
# to create directorties. Normall this amounts to usins mkdir -p dir ...
|
||||
# Some older systems may not have mkdir -p. If you system does not
|
||||
# make mkdir -p, then set MKDIR_ARG to empty.
|
||||
#
|
||||
# MKDIR_ARG= -p # use mkdir -p when creating paths
|
||||
# MKDIR_ARG= # use if system does not understand mkdir -p
|
||||
#
|
||||
MKDIR_ARG= -p
|
||||
#MKDIR_ARG=
|
||||
|
||||
# Some out of date operating systems require / want an executable to
|
||||
# end with a certain file extension. Some compile systems such as
|
||||
# Cygwin build calc as calc.exe. The EXT variable is used to denote
|
||||
@@ -366,18 +352,12 @@ EXT=
|
||||
|
||||
# The default calc versions
|
||||
#
|
||||
VERSION= 2.12.4.13
|
||||
VERS= 2.12.4
|
||||
VER= 2.12
|
||||
VE= 2
|
||||
VERSION= 2.12.5.5
|
||||
|
||||
# Names of shared libraries with versions
|
||||
#
|
||||
LIB_EXT= .so
|
||||
LIB_EXT_VERSION= ${LIB_EXT}.${VERSION}
|
||||
LIB_EXT_VERS= ${LIB_EXT}.${VERS}
|
||||
LIB_EXT_VER= ${LIB_EXT}.${VER}
|
||||
LIB_EXT_VE= ${LIB_EXT}.${VE}
|
||||
|
||||
# standard tools
|
||||
#
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# custom - makefile for calc custom routines
|
||||
#
|
||||
# Copyright (C) 1999-2006 Landon Curt Noll
|
||||
# Copyright (C) 1999-2006,2014,2017 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
|
||||
@@ -18,9 +18,9 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# @(#) $Revision: 30.31 $
|
||||
# @(#) $Id: Makefile.head,v 30.31 2013/09/27 08:55:28 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc/custom/RCS/Makefile.head,v $
|
||||
# @(#) $Revision: 30.42 $
|
||||
# @(#) $Id: Makefile.head,v 30.42 2017/05/19 16:09:14 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc-RHEL7/custom/RCS/Makefile.head,v $
|
||||
#
|
||||
# Under source code control: 1997/03/09 02:28:54
|
||||
# File existed as early as: 1997
|
||||
@@ -322,20 +322,6 @@ CALC_ENV= CALCPATH=./cal
|
||||
ALLOW_CUSTOM= -DCUSTOM
|
||||
#ALLOW_CUSTOM=
|
||||
|
||||
# The install rule uses:
|
||||
#
|
||||
# ${MKDIR} ${MKDIR_ARG}
|
||||
#
|
||||
# to create directorties. Normall this amounts to usins mkdir -p dir ...
|
||||
# Some older systems may not have mkdir -p. If you system does not
|
||||
# make mkdir -p, then set MKDIR_ARG to empty.
|
||||
#
|
||||
# MKDIR_ARG= -p # use mkdir -p when creating paths
|
||||
# MKDIR_ARG= # use if system does not understand mkdir -p
|
||||
#
|
||||
MKDIR_ARG= -p
|
||||
#MKDIR_ARG=
|
||||
|
||||
# Some out of date operating systems require / want an executable to
|
||||
# end with a certain file extension. Some compile systems such as
|
||||
# Cygwin build calc as calc.exe. The EXT variable is used to denote
|
||||
@@ -351,18 +337,12 @@ EXT=
|
||||
|
||||
# The default calc versions
|
||||
#
|
||||
VERSION= 2.12.4.13
|
||||
VERS= 2.12.4
|
||||
VER= 2.12
|
||||
VE= 2
|
||||
VERSION= 2.12.5.5
|
||||
|
||||
# Names of shared libraries with versions
|
||||
#
|
||||
LIB_EXT= .so
|
||||
LIB_EXT_VERSION= ${LIB_EXT}.${VERSION}
|
||||
LIB_EXT_VERS= ${LIB_EXT}.${VERS}
|
||||
LIB_EXT_VER= ${LIB_EXT}.${VER}
|
||||
LIB_EXT_VE= ${LIB_EXT}.${VE}
|
||||
|
||||
# standard tools
|
||||
#
|
||||
@@ -438,7 +418,7 @@ COMMON_LDFLAGS= ${EXTRA_LDFLAGS}
|
||||
# LIBCALC_SHLIB are flags given to ${CC} to build libcalc shared libraries
|
||||
# LIBCUSTCALC_SHLIB are flags given to ${CC} to build libcustcalc shared lib
|
||||
#
|
||||
# NOTE: The above 4 values are unused if BLD_TYPE= calc-static-only
|
||||
# NOTE: The above 5 values are unused if BLD_TYPE= calc-static-only
|
||||
#
|
||||
# CC_STATIC are flags given to ${CC} to build .o files suitable for static libs
|
||||
# LD_STATIC are common flags given to ${CC} to link with static libraries
|
||||
@@ -449,6 +429,17 @@ COMMON_LDFLAGS= ${EXTRA_LDFLAGS}
|
||||
#
|
||||
# CCOPT are flags given to ${CC} for optimization
|
||||
# CCWARN are flags given to ${CC} for warning message control
|
||||
#
|
||||
# WNO_IMPLICT, WNO_ERROR_LONG_LONG and WNO_LONG_LONG are given to ${CC}
|
||||
# when compiling special .o files that may need special compile options
|
||||
# NOTE: These flags simply turn off certain compiler warnings,
|
||||
# which is useful only when CCWERR is set to -Werror.
|
||||
# NOTE: If your compiler does not have these -Wno files, just
|
||||
# set these variables to nothing as in:
|
||||
# WNO_IMPLICT=
|
||||
# WNO_ERROR_LONG_LONG=
|
||||
# WNO_LONG_LONG=
|
||||
#
|
||||
# CCWERR are flags given to ${CC} to make warnings fatal errors
|
||||
# NOTE: CCWERR is only set in development Makefiles and must only be
|
||||
# used with ${CC}, not ${LCC}. If you do not want the compiler
|
||||
@@ -485,7 +476,10 @@ LD_STATIC=
|
||||
LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
#
|
||||
CCWARN= -Wall -W -Wno-comment
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
WNO_LONG_LONG= -Wno-long-long
|
||||
CCWERR=
|
||||
CCOPT= ${DEBUG}
|
||||
CCMISC=
|
||||
@@ -506,7 +500,7 @@ CFLAGS= ${ICFLAGS} ${CCOPT}
|
||||
ILDFLAGS= ${COMMON_LDFLAGS} ${LD_STATIC}
|
||||
LDFLAGS= ${LD_DEBUG} ${ILDFLAGS} ${LIBCALC_STATIC} ${LIBCUSTCALC_STATIC}
|
||||
#
|
||||
CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR}
|
||||
CALCPATH= .;./cal;~/.cal;${T}${CALC_SHAREDIR};${T}${CUSTOMCALDIR}
|
||||
|
||||
#######################################################################
|
||||
#-=-=-=-=-=- end of target section - only make rules below -=-=-=-=-=-#
|
||||
@@ -679,8 +673,8 @@ depend:
|
||||
fi
|
||||
${Q} echo forming custom/skel
|
||||
${Q} ${RM} -rf skel
|
||||
${Q} ${MKDIR} skel
|
||||
${Q} ${MKDIR} skel/custom
|
||||
${Q} ${MKDIR} -p skel
|
||||
${Q} ${MKDIR} -p skel/custom
|
||||
-${Q} for i in ${C_SRC} /dev/null; do \
|
||||
if [ X"$$i" != X"/dev/null" ]; then \
|
||||
${SED} -n '/^#[ ]*include[ ]*"/p' \
|
||||
@@ -791,20 +785,35 @@ clobber: clean
|
||||
${RM} -f ${BLD_TYPE}
|
||||
${RM} -f .all ${MAKE_FILE}.tmp ${MAKE_FILE}.bak
|
||||
${RM} -f libcustcalc${LIB_EXT_VERSION}
|
||||
${RM} -f libcustcalc${LIB_EXT_VERS}
|
||||
${RM} -f libcustcalc${LIB_EXT_VER}
|
||||
${RM} -f libcustcalc${LIB_EXT_VE}
|
||||
${RM} -f libcustcalc${LIB_EXT}
|
||||
${RM} -f libcustcalc.a
|
||||
${RM} -f libcustcalc*
|
||||
${V} echo remove files that are obsolete
|
||||
-${Q} if [ -e .DS_Store ]; then \
|
||||
echo ${RM} -rf .DS_Store; \
|
||||
${RM} -rf .DS_Store; \
|
||||
fi
|
||||
|
||||
# install everything
|
||||
#
|
||||
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
||||
#
|
||||
install: all
|
||||
-${Q} if [ ! -d ${T}${LIBDIR} ]; then \
|
||||
echo ${MKDIR} -p ${T}${LIBDIR}; \
|
||||
${MKDIR} -p ${T}${LIBDIR}; \
|
||||
if [ ! -d "${T}${LIBDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${LIBDIR}"; \
|
||||
${MKDIR} -p "${T}${LIBDIR}"; \
|
||||
fi; \
|
||||
echo ${CHMOD} 0755 ${T}${LIBDIR}; \
|
||||
${CHMOD} 0755 ${T}${LIBDIR}; \
|
||||
else \
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${INCDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${INCDIR}; \
|
||||
${MKDIR} ${T}${INCDIR}; \
|
||||
echo ${MKDIR} -p ${T}${INCDIR}; \
|
||||
${MKDIR} -p ${T}${INCDIR}; \
|
||||
if [ ! -d "${T}${INCDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${INCDIR}"; \
|
||||
${MKDIR} -p "${T}${INCDIR}"; \
|
||||
@@ -815,8 +824,8 @@ install: all
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${CALC_SHAREDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${CALC_SHAREDIR}; \
|
||||
${MKDIR} ${T}${CALC_SHAREDIR}; \
|
||||
echo ${MKDIR} -p ${T}${CALC_SHAREDIR}; \
|
||||
${MKDIR} -p ${T}${CALC_SHAREDIR}; \
|
||||
if [ ! -d "${T}${CALC_SHAREDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${CALC_SHAREDIR}"; \
|
||||
${MKDIR} -p "${T}${CALC_SHAREDIR}"; \
|
||||
@@ -827,8 +836,8 @@ install: all
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${CALC_INCDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${CALC_INCDIR}; \
|
||||
${MKDIR} ${T}${CALC_INCDIR}; \
|
||||
echo ${MKDIR} -p ${T}${CALC_INCDIR}; \
|
||||
${MKDIR} -p ${T}${CALC_INCDIR}; \
|
||||
if [ ! -d "${T}${CALC_INCDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${CALC_INCDIR}"; \
|
||||
${MKDIR} -p "${T}${CALC_INCDIR}"; \
|
||||
@@ -839,8 +848,8 @@ install: all
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${HELPDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${HELPDIR}; \
|
||||
${MKDIR} ${T}${HELPDIR}; \
|
||||
echo ${MKDIR} -p ${T}${HELPDIR}; \
|
||||
${MKDIR} -p ${T}${HELPDIR}; \
|
||||
if [ ! -d "${T}${HELPDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${HELPDIR}"; \
|
||||
${MKDIR} -p "${T}${HELPDIR}"; \
|
||||
@@ -851,8 +860,8 @@ install: all
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${CUSTOMCALDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${CUSTOMCALDIR}; \
|
||||
${MKDIR} ${T}${CUSTOMCALDIR}; \
|
||||
echo ${MKDIR} -p ${T}${CUSTOMCALDIR}; \
|
||||
${MKDIR} -p ${T}${CUSTOMCALDIR}; \
|
||||
if [ ! -d "${T}${CUSTOMCALDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${CUSTOMCALDIR}"; \
|
||||
${MKDIR} -p "${T}${CUSTOMCALDIR}"; \
|
||||
@@ -863,8 +872,8 @@ install: all
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${CUSTOMHELPDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${CUSTOMHELPDIR}; \
|
||||
${MKDIR} ${T}${CUSTOMHELPDIR}; \
|
||||
echo ${MKDIR} -p ${T}${CUSTOMHELPDIR}; \
|
||||
${MKDIR} -p ${T}${CUSTOMHELPDIR}; \
|
||||
if [ ! -d "${T}${CUSTOMHELPDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${CUSTOMHELPDIR}"; \
|
||||
${MKDIR} -p "${T}${CUSTOMHELPDIR}"; \
|
||||
@@ -875,8 +884,8 @@ install: all
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${CUSTOMINCDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${CUSTOMINCDIR}; \
|
||||
${MKDIR} ${T}${CUSTOMINCDIR}; \
|
||||
echo ${MKDIR} -p ${T}${CUSTOMINCDIR}; \
|
||||
${MKDIR} -p ${T}${CUSTOMINCDIR}; \
|
||||
if [ ! -d "${T}${CUSTOMINCDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${CUSTOMINCDIR}"; \
|
||||
${MKDIR} -p "${T}${CUSTOMINCDIR}"; \
|
||||
|
@@ -177,8 +177,8 @@ depend:
|
||||
fi
|
||||
${Q} echo forming custom/skel
|
||||
${Q} ${RM} -rf skel
|
||||
${Q} ${MKDIR} skel
|
||||
${Q} ${MKDIR} skel/custom
|
||||
${Q} ${MKDIR} -p skel
|
||||
${Q} ${MKDIR} -p skel/custom
|
||||
-${Q} for i in ${C_SRC} /dev/null; do \
|
||||
if [ X"$$i" != X"/dev/null" ]; then \
|
||||
${SED} -n '/^#[ ]*include[ ]*"/p' \
|
||||
@@ -289,23 +289,38 @@ clobber: clean
|
||||
${RM} -f ${BLD_TYPE}
|
||||
${RM} -f .all ${MAKE_FILE}.tmp ${MAKE_FILE}.bak
|
||||
${RM} -f libcustcalc${LIB_EXT_VERSION}
|
||||
${RM} -f libcustcalc${LIB_EXT_VERS}
|
||||
${RM} -f libcustcalc${LIB_EXT_VER}
|
||||
${RM} -f libcustcalc${LIB_EXT_VE}
|
||||
${RM} -f libcustcalc${LIB_EXT}
|
||||
${RM} -f libcustcalc.a
|
||||
${RM} -f libcustcalc*
|
||||
${V} echo remove files that are obsolete
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
${RM} -f Makefile.simple
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
-${Q} if [ -e .DS_Store ]; then \
|
||||
echo ${RM} -rf .DS_Store; \
|
||||
${RM} -rf .DS_Store; \
|
||||
fi
|
||||
|
||||
# install everything
|
||||
#
|
||||
# NOTE: Keep the uninstall rule in reverse order to the install rule
|
||||
#
|
||||
install: all
|
||||
-${Q} if [ ! -d ${T}${LIBDIR} ]; then \
|
||||
echo ${MKDIR} -p ${T}${LIBDIR}; \
|
||||
${MKDIR} -p ${T}${LIBDIR}; \
|
||||
if [ ! -d "${T}${LIBDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${LIBDIR}"; \
|
||||
${MKDIR} -p "${T}${LIBDIR}"; \
|
||||
fi; \
|
||||
echo ${CHMOD} 0755 ${T}${LIBDIR}; \
|
||||
${CHMOD} 0755 ${T}${LIBDIR}; \
|
||||
else \
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${INCDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${INCDIR}; \
|
||||
${MKDIR} ${T}${INCDIR}; \
|
||||
echo ${MKDIR} -p ${T}${INCDIR}; \
|
||||
${MKDIR} -p ${T}${INCDIR}; \
|
||||
if [ ! -d "${T}${INCDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${INCDIR}"; \
|
||||
${MKDIR} -p "${T}${INCDIR}"; \
|
||||
@@ -316,8 +331,8 @@ install: all
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${CALC_SHAREDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${CALC_SHAREDIR}; \
|
||||
${MKDIR} ${T}${CALC_SHAREDIR}; \
|
||||
echo ${MKDIR} -p ${T}${CALC_SHAREDIR}; \
|
||||
${MKDIR} -p ${T}${CALC_SHAREDIR}; \
|
||||
if [ ! -d "${T}${CALC_SHAREDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${CALC_SHAREDIR}"; \
|
||||
${MKDIR} -p "${T}${CALC_SHAREDIR}"; \
|
||||
@@ -328,8 +343,8 @@ install: all
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${CALC_INCDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${CALC_INCDIR}; \
|
||||
${MKDIR} ${T}${CALC_INCDIR}; \
|
||||
echo ${MKDIR} -p ${T}${CALC_INCDIR}; \
|
||||
${MKDIR} -p ${T}${CALC_INCDIR}; \
|
||||
if [ ! -d "${T}${CALC_INCDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${CALC_INCDIR}"; \
|
||||
${MKDIR} -p "${T}${CALC_INCDIR}"; \
|
||||
@@ -340,8 +355,8 @@ install: all
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${HELPDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${HELPDIR}; \
|
||||
${MKDIR} ${T}${HELPDIR}; \
|
||||
echo ${MKDIR} -p ${T}${HELPDIR}; \
|
||||
${MKDIR} -p ${T}${HELPDIR}; \
|
||||
if [ ! -d "${T}${HELPDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${HELPDIR}"; \
|
||||
${MKDIR} -p "${T}${HELPDIR}"; \
|
||||
@@ -352,8 +367,8 @@ install: all
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${CUSTOMCALDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${CUSTOMCALDIR}; \
|
||||
${MKDIR} ${T}${CUSTOMCALDIR}; \
|
||||
echo ${MKDIR} -p ${T}${CUSTOMCALDIR}; \
|
||||
${MKDIR} -p ${T}${CUSTOMCALDIR}; \
|
||||
if [ ! -d "${T}${CUSTOMCALDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${CUSTOMCALDIR}"; \
|
||||
${MKDIR} -p "${T}${CUSTOMCALDIR}"; \
|
||||
@@ -364,8 +379,8 @@ install: all
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${CUSTOMHELPDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${CUSTOMHELPDIR}; \
|
||||
${MKDIR} ${T}${CUSTOMHELPDIR}; \
|
||||
echo ${MKDIR} -p ${T}${CUSTOMHELPDIR}; \
|
||||
${MKDIR} -p ${T}${CUSTOMHELPDIR}; \
|
||||
if [ ! -d "${T}${CUSTOMHELPDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${CUSTOMHELPDIR}"; \
|
||||
${MKDIR} -p "${T}${CUSTOMHELPDIR}"; \
|
||||
@@ -376,8 +391,8 @@ install: all
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${CUSTOMINCDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${CUSTOMINCDIR}; \
|
||||
${MKDIR} ${T}${CUSTOMINCDIR}; \
|
||||
echo ${MKDIR} -p ${T}${CUSTOMINCDIR}; \
|
||||
${MKDIR} -p ${T}${CUSTOMINCDIR}; \
|
||||
if [ ! -d "${T}${CUSTOMINCDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${CUSTOMINCDIR}"; \
|
||||
${MKDIR} -p "${T}${CUSTOMINCDIR}"; \
|
||||
|
12
decl.h
12
decl.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* decl - variable and function declaration macros
|
||||
*
|
||||
* Copyright (C) 2007 Landon Curt Noll
|
||||
* Copyright (C) 2007,2014 Landon Curt Noll
|
||||
*
|
||||
* Primary author: Landon Curt Noll
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.4 $
|
||||
* @(#) $Id: decl.h,v 30.4 2013/08/11 08:41:38 chongo Exp $
|
||||
* @(#) $Revision: 30.6 $
|
||||
* @(#) $Id: decl.h,v 30.6 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/decl.h,v $
|
||||
*
|
||||
* Under source code control: 2007/02/09 05:24:25
|
||||
@@ -33,8 +33,8 @@
|
||||
#include "have_const.h"
|
||||
|
||||
|
||||
#if !defined(__DECL_H__)
|
||||
#define __DECL_H__
|
||||
#if !defined(INCLUDE_DECL_H)
|
||||
#define INCLUDE_DECL_H
|
||||
|
||||
|
||||
/*
|
||||
@@ -106,4 +106,4 @@
|
||||
# define PRINTF_FORMAT(fmt_idx, arg_idx)
|
||||
#endif
|
||||
|
||||
#endif /* !__DECL_H__ */
|
||||
#endif /* !INCLUDE_DECL_H */
|
||||
|
12
file.h
12
file.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* file - file I/O routines callable by users
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell and Landon Curt Noll
|
||||
* Copyright (C) 1999-2007,2014 David I. Bell and Landon Curt Noll
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: file.h,v 30.3 2013/09/01 22:16:21 chongo Exp $
|
||||
* @(#) $Revision: 30.5 $
|
||||
* @(#) $Id: file.h,v 30.5 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/file.h,v $
|
||||
*
|
||||
* Under source code control: 1996/05/24 05:55:58
|
||||
@@ -31,8 +31,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__FILE_H__)
|
||||
#define __FILE_H__
|
||||
#if !defined(INCLUDE_FILE_H)
|
||||
#define INCLUDE_FILE_H
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
@@ -100,4 +100,4 @@ E_FUNC FILE *f_pathopen(char *name, char *mode, char *pathlist,
|
||||
char **openpath);
|
||||
|
||||
|
||||
#endif /* !__FILE_H__ */
|
||||
#endif /* !INCLUDE_FILE_H */
|
||||
|
23
func.c
23
func.c
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.9 $
|
||||
* @(#) $Id: func.c,v 30.9 2013/09/02 01:38:08 chongo Exp $
|
||||
* @(#) $Revision: 30.11 $
|
||||
* @(#) $Id: func.c,v 30.11 2014/09/30 00:55:11 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/func.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:15
|
||||
@@ -1241,10 +1241,11 @@ f_primetest(int count, NUMBER **vals)
|
||||
{
|
||||
/* parse args */
|
||||
switch (count) {
|
||||
case 1: return itoq((long) qprimetest(vals[0],
|
||||
qlink(&_qone_), qlink(&_qone_)));
|
||||
case 2: return itoq((long) qprimetest(vals[0],
|
||||
vals[1], qlink(&_qone_)));
|
||||
case 1: qlink(&_qone_);
|
||||
qlink(&_qone_);
|
||||
return itoq((long) qprimetest(vals[0], &_qone_, &_qone_));
|
||||
case 2: qlink(&_qone_);
|
||||
return itoq((long) qprimetest(vals[0], vals[1], &_qone_));
|
||||
default: return itoq((long) qprimetest(vals[0], vals[1], vals[2]));
|
||||
}
|
||||
}
|
||||
@@ -1675,7 +1676,7 @@ f_hash(int count, VALUE **vals)
|
||||
result.v_type = V_NUM;
|
||||
result.v_subtype = V_NOSUBTYPE;
|
||||
|
||||
hash = FNV1_32_BASIS;
|
||||
hash = QUICKHASH_BASIS;
|
||||
while (count-- > 0)
|
||||
hash = hashvalue(*vals++, hash);
|
||||
result.v_num = utoq((FULL) hash);
|
||||
@@ -8248,6 +8249,10 @@ f_blkcpy(int count, VALUE **vals)
|
||||
*/
|
||||
args[0] = vals[1];
|
||||
args[1] = vals[0];
|
||||
null_value.v_type = V_NULL;
|
||||
args[2] = &null_value;
|
||||
args[3] = &null_value;
|
||||
args[4] = &null_value;
|
||||
switch(count) {
|
||||
case 5:
|
||||
args[2] = vals[4];
|
||||
@@ -8258,14 +8263,10 @@ f_blkcpy(int count, VALUE **vals)
|
||||
count = 5;
|
||||
args[4] = vals[3];
|
||||
args[3] = vals[2];
|
||||
null_value.v_type = V_NULL;
|
||||
args[2] = &null_value;
|
||||
break;
|
||||
case 3:
|
||||
count = 4;
|
||||
args[3] = vals[2];
|
||||
null_value.v_type = V_NULL;
|
||||
args[2] = &null_value;
|
||||
break;
|
||||
}
|
||||
|
||||
|
12
func.h
12
func.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* func - built-in function interface definitions
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
* Copyright (C) 1999-2007,2014 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: func.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: func.h,v 30.3 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/func.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:33
|
||||
@@ -28,8 +28,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__FUNC_H__)
|
||||
#define __FUNC_H__
|
||||
#if !defined(INCLUDE_FUNC_H)
|
||||
#define INCLUDE_FUNC_H
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
@@ -110,4 +110,4 @@ E_FUNC void freenumbers(FUNC *);
|
||||
E_FUNC void freefunc(FUNC *);
|
||||
|
||||
|
||||
#endif /* !__FUNC_H__ */
|
||||
#endif /* !INCLUDE_FUNC_H */
|
||||
|
12
hash.h
12
hash.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* hash - one-way hash routines
|
||||
*
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007,2014 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: hash.h,v 30.2 2007/07/05 17:37:41 chongo Exp $
|
||||
* @(#) $Revision: 30.4 $
|
||||
* @(#) $Id: hash.h,v 30.4 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/hash.h,v $
|
||||
*
|
||||
* Under source code control: 1995/11/14 23:57:45
|
||||
@@ -29,8 +29,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HASH_H__)
|
||||
#define __HASH_H__
|
||||
#if !defined(INCLUDE_HASH_H)
|
||||
#define INCLUDE_HASH_H
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
@@ -132,4 +132,4 @@ E_FUNC HASH* hash_usb8(int, USB8*, int, HASH*);
|
||||
E_FUNC HASH* hash_value(int, void*, HASH*);
|
||||
|
||||
|
||||
#endif /* !__HASH_H__ */
|
||||
#endif /* !INCLUDE_HASH_H */
|
||||
|
13
have_stdvs.c
13
have_stdvs.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* have_stdvs - try <stdarg.h> to see if it really works with vsprintf()
|
||||
*
|
||||
* Copyright (C) 1999 Landon Curt Noll
|
||||
* Copyright (C) 1999,2014 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: have_stdvs.c,v 30.2 2013/08/11 08:41:38 chongo Exp $
|
||||
* @(#) $Revision: 30.4 $
|
||||
* @(#) $Id: have_stdvs.c,v 30.4 2014/08/24 21:57:31 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/have_stdvs.c,v $
|
||||
*
|
||||
* Under source code control: 1995/09/09 22:41:10
|
||||
@@ -56,6 +56,11 @@
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
#include "have_stdlib.h"
|
||||
#ifdef HAVE_STDLIB_H
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#undef VSPRINTF_SIZE_T
|
||||
#if defined(FORCE_STDC) || (defined(__STDC__) && __STDC__ != 0) || \
|
||||
defined(__cplusplus)
|
||||
@@ -87,7 +92,7 @@ try_nthis(char *fmt, VSPRINTF_SIZE_T size, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
va_start(ap, size);
|
||||
#if !defined(DONT_HAVE_VSPRINTF)
|
||||
vsnprintf(buf, size, fmt, ap);
|
||||
#else
|
||||
|
8
help.c
8
help.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* help - display help for calc
|
||||
*
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007,2014 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
|
||||
@@ -17,9 +17,9 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: help.c,v 30.3 2013/08/11 01:08:32 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/help.c,v $
|
||||
* @(#) $Revision: 30.4 $
|
||||
* @(#) $Id: help.c,v 30.4 2014/08/24 21:57:31 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/help.c,v $
|
||||
*
|
||||
* Under source code control: 1997/09/14 10:58:30
|
||||
* File existed as early as: 1997
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# help - makefile for calc help files
|
||||
#
|
||||
# Copyright (C) 1999-2006 Landon Curt Noll
|
||||
# Copyright (C) 1999-2006,2017 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
|
||||
@@ -18,9 +18,9 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
# @(#) $Revision: 30.9 $
|
||||
# @(#) $Id: Makefile,v 30.9 2013/09/02 02:55:19 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc/help/RCS/Makefile,v $
|
||||
# @(#) $Revision: 30.11 $
|
||||
# @(#) $Id: Makefile,v 30.11 2017/05/19 16:09:14 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc-RHEL7/help/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1991/07/23 06:47:57
|
||||
# File existed as early as: 1991
|
||||
@@ -204,7 +204,7 @@ EXT=
|
||||
STD_HELP_FILES_1= intro overview help
|
||||
STD_HELP_FILES_2= assoc
|
||||
|
||||
BLT_HELP_FILES_3= builtin
|
||||
BLT_HELP_FILES_3= builtin man
|
||||
|
||||
STD_HELP_FILES_4= command config custom define environment expression
|
||||
|
||||
@@ -283,36 +283,35 @@ BLT_HELP_FILES= ${BLT_HELP_FILES_3} ${BLT_HELP_FILES_5} \
|
||||
# to keep this list in nice sorted order and to check that these
|
||||
# non-special help files are under RCS control.
|
||||
#
|
||||
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 calcpath catalan ceil cfappr cfsim \
|
||||
char cmdbuf cmp comb conj cos cosh cot coth count cp 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 floor fopen forall fpathopen fprintf fputc fputs fputstr \
|
||||
frac free freebernoulli freeeuler freeglobals freeredc freestatics \
|
||||
frem freopen fscan fscanf fseek fsize ftell gcd gcdrem gd getenv \
|
||||
hash head highbit hmean hnrmod hypot ilog ilog10 ilog2 im indices \
|
||||
inputlevel insert int inverse iroot isalnum isalpha isassoc isatty \
|
||||
isblk iscntrl isconfig isdefined isdigit iserror iseven isfile \
|
||||
isgraph ishash isident isint islist islower ismat ismult isnull \
|
||||
isnum isobj isobjtype isodd isprime isprint isptr ispunct isqrt \
|
||||
isrand israndom isreal isrel issimple isspace issq isstr istype \
|
||||
isupper isxdigit jacobi join lcm lcmfact lfactor ln log lowbit ltol \
|
||||
makelist matdim matfill matmax matmin matsum mattrace mattrans max \
|
||||
memsize meq min minv mmin mne mod modify name near newerror nextcand \
|
||||
nextprime norm null num oldvalue ord param perm pfact pi pix places \
|
||||
pmod polar poly pop popcnt pound 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 saveval scale scan scanf \
|
||||
search sec sech seed segment select sgn sha1 sin sinh size sizeof \
|
||||
sleep sort sqrt srand srandom ssq stoponerror str strcasecmp strcat \
|
||||
strcmp strcpy strerror strlen strncasecmp strncmp strncpy strpos \
|
||||
strprintf strscan strscanf strtolower strtoupper substr sum swap \
|
||||
system systime tail tan tanh test time trunc usertime version xor
|
||||
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 calcpath catalan ceil cfappr cfsim char \
|
||||
cmdbuf cmp comb conj cos cosh cot coth count cp 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 floor \
|
||||
fopen forall fpathopen fprintf fputc fputs fputstr frac free \
|
||||
freebernoulli freeeuler freeglobals freeredc freestatics frem freopen \
|
||||
fscan fscanf fseek fsize ftell gcd gcdrem gd getenv hash head highbit \
|
||||
hmean hnrmod hypot ilog ilog10 ilog2 im indices inputlevel insert int \
|
||||
inverse iroot isalnum isalpha isassoc isatty isblk iscntrl isconfig \
|
||||
isdefined isdigit iserror iseven isfile isgraph ishash isident isint \
|
||||
islist islower ismat ismult isnull isnum isobj isobjtype isodd isprime \
|
||||
isprint isptr ispunct isqrt isrand israndom isreal isrel issimple \
|
||||
isspace issq isstr istype isupper isxdigit jacobi join lcm lcmfact \
|
||||
lfactor ln log lowbit ltol makelist matdim matfill matmax matmin \
|
||||
matsum mattrace mattrans max memsize meq min minv mmin mne mod modify \
|
||||
name near newerror nextcand nextprime norm null num oldvalue ord param \
|
||||
perm pfact pi pix places pmod polar poly pop popcnt pound 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 saveval scale scan \
|
||||
scanf search sec sech seed segment select sgn sha1 sin sinh size \
|
||||
sizeof sleep sort sqrt srand srandom ssq stoponerror str strcasecmp \
|
||||
strcat strcmp strcpy strerror strlen strncasecmp strncmp strncpy \
|
||||
strpos strprintf strscan strscanf strtolower strtoupper 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.
|
||||
@@ -473,6 +472,18 @@ copy: blkcpy
|
||||
${TRUE}; \
|
||||
fi
|
||||
|
||||
man: help
|
||||
${RM} -f $@
|
||||
${CP} help $@
|
||||
${CHMOD} 0444 $@
|
||||
-@if [ -z "${Q}" ]; then \
|
||||
echo ''; \
|
||||
echo '=-=-= skipping the ${CAT} of help/$@ =-=-='; \
|
||||
echo ''; \
|
||||
else \
|
||||
${TRUE}; \
|
||||
fi
|
||||
|
||||
COPYING: ../COPYING
|
||||
${RM} -f $@
|
||||
${CP} ../COPYING $@
|
||||
@@ -698,6 +709,10 @@ clean:
|
||||
clobber: clean
|
||||
${RM} -f ${BLT_HELP_FILES} full .all calc
|
||||
${RM} -f ${SINGULAR_FILES} ${DETAIL_CLONE}
|
||||
-${Q} if [ -e .DS_Store ]; then \
|
||||
echo ${RM} -rf .DS_Store; \
|
||||
${RM} -rf .DS_Store; \
|
||||
fi
|
||||
|
||||
# install everything
|
||||
#
|
||||
@@ -705,8 +720,8 @@ clobber: clean
|
||||
#
|
||||
install: all
|
||||
-${Q} if [ ! -d ${T}${CALC_SHAREDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${CALC_SHAREDIR}; \
|
||||
${MKDIR} ${T}${CALC_SHAREDIR}; \
|
||||
echo ${MKDIR} -p ${T}${CALC_SHAREDIR}; \
|
||||
${MKDIR} -p ${T}${CALC_SHAREDIR}; \
|
||||
if [ ! -d "${T}${CALC_SHAREDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${CALC_SHAREDIR}"; \
|
||||
${MKDIR} -p "${T}${CALC_SHAREDIR}"; \
|
||||
@@ -717,8 +732,8 @@ install: all
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ ! -d ${T}${HELPDIR} ]; then \
|
||||
echo ${MKDIR} ${T}${HELPDIR}; \
|
||||
${MKDIR} ${T}${HELPDIR}; \
|
||||
echo ${MKDIR} -p ${T}${HELPDIR}; \
|
||||
${MKDIR} -p ${T}${HELPDIR}; \
|
||||
if [ ! -d "${T}${HELPDIR}" ]; then \
|
||||
echo ${MKDIR} -p "${T}${HELPDIR}"; \
|
||||
${MKDIR} -p "${T}${HELPDIR}"; \
|
||||
|
74
help/contrib
74
help/contrib
@@ -36,45 +36,73 @@ as a diff -c /dev/null your-file patch, or as a uuencoded and
|
||||
gziped (or compressed) tar file).
|
||||
|
||||
To contribute code, scripts, resource files and/or to help please
|
||||
join the low volume calc mailing list by sending EMail to:
|
||||
join the low volume calc mailing list calc-tester. Then send
|
||||
your contribution to the calc-tester mailing list.
|
||||
|
||||
calc-contrib at asthe dot com
|
||||
To subscribe to the calc-tester mailing list, visit the following URL:
|
||||
|
||||
[[ NOTE: Replace 'at' with @, 'dot' is with . and remove the spaces ]]
|
||||
[[ NOTE: The EMail address uses 'asthe' and the web site URL uses 'isthe' ]]
|
||||
https://www.listbox.com/subscribe/?list_id=239342
|
||||
|
||||
Your subject must contain the words:
|
||||
To help determine you are a human and not just a spam bot,
|
||||
you will be required to provide the following additional info:
|
||||
|
||||
calc mailing list subscription
|
||||
Your Name
|
||||
Calc Version
|
||||
Operating System
|
||||
The date 7 days ago
|
||||
|
||||
You may have additional words in your subject line.
|
||||
This is a low volume moderated mailing list.
|
||||
|
||||
Feel free to follow the name line with additional EMail text as desired.
|
||||
This mailing list replaces calc-tester at asthe dot com list.
|
||||
|
||||
Thanks for considering submitting code to calc. Calc is a collective
|
||||
work by a number of people. It would not be what it is today without
|
||||
your efforts and submissions!
|
||||
If you need a human to help you with your mailing list subscription,
|
||||
please send EMail to our special:
|
||||
|
||||
calc-tester-maillist-help at asthe dot com
|
||||
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
|
||||
address. To be sure we see your EMail asking for help with your
|
||||
mailing list subscription, please use the following phase in your
|
||||
EMail Subject line:
|
||||
|
||||
calc tester mailing list help
|
||||
|
||||
That phrase in your subject line will help ensure your
|
||||
request will get past our anti-spam filters. You may have
|
||||
additional words in your subject line.
|
||||
|
||||
=-=
|
||||
|
||||
Calc bug reports and calc bug fixes should be sent to:
|
||||
|
||||
calc-bugs at asthe dot com
|
||||
calc-bug-report at asthe dot com
|
||||
|
||||
[[ NOTE: Replace 'at' with @, 'dot' is with . and remove the spaces ]]
|
||||
[[ NOTE: The EMail address uses 'asthe' and the web site URL uses 'isthe' ]]
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
|
||||
Your subject must contain the words:
|
||||
This replaces the old calc-bugs at asthe dot com address.
|
||||
|
||||
calc bug report
|
||||
To be sure we see your EMail reporting a calc bug, please use the
|
||||
following phase in your EMail Subject line:
|
||||
|
||||
You may have additional words in your subject line.
|
||||
calc bug report
|
||||
|
||||
See the BUGS file or try the help command:
|
||||
That phrase in your subject line will help ensure your
|
||||
request will get past our anti-spam filters. You may have
|
||||
additional words in your subject line.
|
||||
|
||||
help bugs
|
||||
However, you may find it more helpful to simply subscribe
|
||||
to the calc-tester mailing list (see above) and then to
|
||||
send your report to that mailing list as a wider set calc
|
||||
testers may be able to help you.
|
||||
|
||||
for details on bug reporting.
|
||||
=-=
|
||||
|
||||
The calc web site is located at:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
||||
NOTE: The EMail address uses 'asthe', while the web site uses 'isthe'.
|
||||
|
||||
=-=
|
||||
|
||||
@@ -83,7 +111,7 @@ http://www.isthe.com/chongo/
|
||||
|
||||
chongo (share and enjoy) /\../\
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
## Copyright (C) 1999,2014 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
|
||||
@@ -99,8 +127,8 @@ chongo (share and enjoy) /\../\
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: contrib,v 30.1 2007/03/16 11:10:42 chongo Exp $
|
||||
## @(#) $Revision: 30.2 $
|
||||
## @(#) $Id: contrib,v 30.2 2014/10/06 08:39:45 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/contrib,v $
|
||||
##
|
||||
## Under source code control: 1997/03/09 16:33:22
|
||||
|
22
help/hash
22
help/hash
@@ -13,11 +13,21 @@ DESCRIPTION
|
||||
Returns a hash value for one or more values of arbitrary types.
|
||||
|
||||
The calc hash value is based on the core Fowler/Noll/Vo hash
|
||||
known as FNV-1. The return value, however, cannot be used
|
||||
known as FNV-0. The return value, however, cannot be used
|
||||
as an FNV hash value because calc's internal function also
|
||||
takes into account more abstract concepts such as data types.
|
||||
|
||||
See:
|
||||
WARNING: Use of FNV-0 is NOT recommended for general purposes.
|
||||
Calc uses FNV-0 for internal objects such as associative
|
||||
arrays as well as other internal processes. Calc
|
||||
maintains the use of FNV-0 for backwards compatibility.
|
||||
|
||||
You should use the FNV-1a hash instead!!!!!
|
||||
|
||||
Use the fnv() builtin function for general quick, non-cryptographic
|
||||
hash purposes.
|
||||
|
||||
See also:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/fnv/
|
||||
|
||||
@@ -35,9 +45,9 @@ LINK LIBRARY
|
||||
none
|
||||
|
||||
SEE ALSO
|
||||
ishash, sha1
|
||||
ishash, fnv, sha1
|
||||
|
||||
## Copyright (C) 1999-2007 Landon Curt Noll
|
||||
## Copyright (C) 1999-2007,2014 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
|
||||
@@ -53,8 +63,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.2 $
|
||||
## @(#) $Id: hash,v 30.2 2007/07/05 17:37:41 chongo Exp $
|
||||
## @(#) $Revision: 30.3 $
|
||||
## @(#) $Id: hash,v 30.3 2014/10/06 08:45:56 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/hash,v $
|
||||
##
|
||||
## Under source code control: 1996/03/12 23:10:01
|
||||
|
16
help/help
16
help/help
@@ -115,7 +115,15 @@ as the same effect as:
|
||||
|
||||
custom("help", "anything");
|
||||
|
||||
## Copyright (C) 1999-2007 Landon Curt Noll
|
||||
The man command is an alias for the help command. For example:
|
||||
|
||||
man sin
|
||||
|
||||
Any help file that the help command is able to display may be
|
||||
displayed by the man command. The man command may only display
|
||||
calc help files.
|
||||
|
||||
## Copyright (C) 1999-2007,2017 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
|
||||
@@ -131,9 +139,9 @@ as the same effect as:
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: help,v 30.1 2007/03/16 11:10:42 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/help,v $
|
||||
## @(#) $Revision: 30.2 $
|
||||
## @(#) $Id: help,v 30.2 2017/05/19 16:09:14 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc-RHEL7/help/RCS/help,v $
|
||||
##
|
||||
## Under source code control: 1991/07/21 04:37:20
|
||||
## File existed as early as: 1991
|
||||
|
@@ -54,7 +54,7 @@ What is calc?
|
||||
|
||||
Functions can be used in expressions. There are a great number of
|
||||
pre-defined functions. For example, the following will calculate
|
||||
the factorial of the value of 'old':
|
||||
the factorial of the value of 'whey':
|
||||
|
||||
fact(whey)
|
||||
|
||||
@@ -185,8 +185,8 @@ What is calc?
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: intro,v 30.1 2007/03/16 11:10:42 chongo Exp $
|
||||
## @(#) $Revision: 30.2 $
|
||||
## @(#) $Id: intro,v 30.2 2016/02/06 08:25:30 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/intro,v $
|
||||
##
|
||||
## Under source code control: 1991/07/21 04:37:21
|
||||
|
205
help/jacobi
205
help/jacobi
@@ -11,39 +11,186 @@ TYPES
|
||||
return 1, -1, or 0
|
||||
|
||||
DESCRIPTION
|
||||
If y is a positive odd prime and x is an integer not divisible
|
||||
by y, jacobi(x,y) returns the Legendre symbol function, usually
|
||||
denoted by (x/y) as if x/y were a fraction; this has the value
|
||||
1 or -1 according as x is or is not a quadratic residue modulo y.
|
||||
x is a quadratic residue modulo y if for some integer u,
|
||||
x = u^2 (mod y); if for all integers u, x != u^2 (mod y), x
|
||||
is said to be a quadratic nonresidue modulo y.
|
||||
The jacobi builtin function of calc returns the value of the
|
||||
Jacobi symbol.
|
||||
|
||||
If y is a positive odd prime and x is divisible by y, jacobi(x,y)
|
||||
returns the value 1. (This differs from the zero value usually
|
||||
given in number theory books for (x/y) when x and y
|
||||
are not relatively prime.)
|
||||
assigned to (x/y) O
|
||||
If y is an odd prime, then the Legendre symbol (x/y) returns:
|
||||
|
||||
If y is an odd positive integer equal to p_1 * p_2 * ... * p_k,
|
||||
where the p_i are primes, not necessarily distinct, the
|
||||
jacobi symbol function is given by
|
||||
(x/y) == 0 x is divisible by y (0 == x % y)
|
||||
(x/y) == 1 if x is a quadratic residue modulo y
|
||||
(x/y) == -1 if x is not a quadratic residue modulo y
|
||||
|
||||
jacobi(x,y) = (x/p_1) * (x/p_2) * ... * (x/p_k).
|
||||
Legendre symbol often denoted as (x/y) as if x/y were a fraction.
|
||||
|
||||
where the functions on the right are Legendre symbol functions.
|
||||
If there exists an integer u such that:
|
||||
|
||||
This is also often usually by (x/y).
|
||||
x == u^2 modulo y (i.e., x == u^2 % y)
|
||||
|
||||
If jacobi(x,y) = -1, then x is a quadratic nonresidue modulo y.
|
||||
Equivalently, if x is a quadratic residue modulo y, then
|
||||
jacobi(x,y) = 1.
|
||||
then x is a quadratic residue modulo y. However, if for all integers u:
|
||||
|
||||
If jacobi(x,y) = 1 and y is composite, x may be either a quadratic
|
||||
residue or a quadratic nonresidue modulo y.
|
||||
x != u^2 modulo y (i.e., x != u^2 % y)
|
||||
|
||||
If y is even or negative, jacobi(x,y) as defined by calc returns
|
||||
the value 0.
|
||||
x is said to be a quadratic non-residue modulo y.
|
||||
|
||||
When y is prime, Jacobi symbol is the same as the Legendre symbol.
|
||||
That is, Jacobi symbol satisfies the same rules as the Legendre symbol.
|
||||
Therefore, when y is an odd prime:
|
||||
|
||||
jacobi(x,y) == 0 x is divisible by y (x == 0 % y)
|
||||
jacobi(x,y) == 1 if x is a quadratic residue modulo y
|
||||
jacobi(x,y) == -1 if x is a quadratic non-residue modulo y
|
||||
|
||||
When y is even or y <= 0:
|
||||
|
||||
jacobi(x,y) == 0
|
||||
|
||||
When y is not prime, we may express y as the product of primes:
|
||||
|
||||
y == p0^a0 * p1^a1 * .. * pn^an
|
||||
|
||||
When y is odd and NOT prime, then:
|
||||
|
||||
jacobi(x,y) == (x/p0)^a0 * (x/p1)^a1 * .. * (x/pn)^an
|
||||
|
||||
where (x/y) is Legendre symbol.
|
||||
|
||||
If x is a quadratic residue modulo y, then jacobi(x,y) == 1.
|
||||
|
||||
If jacobi(x,y) == 1 and y is composite (y is not prime), x may
|
||||
be either a quadratic residue or a quadratic non-residue modulo y.
|
||||
|
||||
If y is even or negative, jacobi(x,y) as defined by calc, returns 0.
|
||||
|
||||
Jacobi symbol details
|
||||
---------------------
|
||||
|
||||
In the rest of this section we present for the curious, some
|
||||
rules related to the jacobi symbol. Most of these rules are
|
||||
used internally by calc to evaluate the jacobi symbol.
|
||||
|
||||
In this section, a and b are positive odd integers.
|
||||
In this section, x and y are any integers.
|
||||
|
||||
We have these identities:
|
||||
|
||||
jacobi(x,y) == 0 if x <= 0
|
||||
jacobi(x,y) == 0 if y <= 0
|
||||
jacobi(x,y) == 0 if y is even
|
||||
|
||||
jacobi(x,b) == 0 if gcd(x,b) > 1
|
||||
|
||||
jacobi(0,b) == 0
|
||||
jacobi(1,b) == 1
|
||||
|
||||
jacobi(x,b) == jacobi(y,b) if x == y % b
|
||||
|
||||
jacobi(a,b) == jacobi(2*a,b) if b == 1 % 8 OR b == 7 % 8
|
||||
jacobi(a,b) == -jacobi(2*a,b) if b != 1 & 8 AND b != 7 % 8
|
||||
|
||||
jacobi(a,b) == jacobi(b,a) if a == 3 % 4 AND b == 3 % 4
|
||||
jacobi(a,b) == -jacobi(b,a) if a != 3 % 4 OR b != 3 % 4
|
||||
|
||||
jacobi(-1,b) == 1 if b == 1 % 4
|
||||
jacobi(-1,b) == -1 if b == 3 % 4
|
||||
|
||||
jacobi(x,b) * jacobi(y,b) == jacobi(x*y,b)
|
||||
jacobi(x,a) * jacobi(x,b) == jacobi(x,a*b)
|
||||
|
||||
Technically the Jacobi symbol jacobi(x,y) is not defined when
|
||||
x == 0, x < 0, y is even, y == 0, and when y < 0. So by convention:
|
||||
|
||||
jacobi(x,y) == 0 if x <= 0
|
||||
jacobi(x,y) == 0 if y <= 0
|
||||
jacobi(x,y) == 0 if y == 0 % 2
|
||||
|
||||
It is also worth noting that:
|
||||
|
||||
jacobi(x,y) == 0 if gcd(y,x) != 1
|
||||
jacobi(y,y) == 0 if y > 1
|
||||
|
||||
Based on the generalization of the quadratic reciprocity theorem,
|
||||
when a and b are odd, b >= 3, and gcd(a,b) == 1:
|
||||
|
||||
jacobi(a,b) == jacobi(b,a) * ((-1) ^ ((a-1) * (b-1) / 4))
|
||||
|
||||
Therefore, when a and b are odd, b >= 3, and gcd(a,b) == 1:
|
||||
|
||||
jacobi(a,b) == jacobi(b,a) if a == 1 % 4 OR b == 1 % 4
|
||||
jacobi(a,b) == -jacobi(b,a) if a == 3 % 4 AND b == 3 % 4
|
||||
|
||||
Jacobi symbol satisfies the same rules as the Legendre symbol such as:
|
||||
|
||||
jacobi(x,y0*y1) == jacobi(x,y0) * jacobi(x,y1)
|
||||
jacobi(x0*x1,y) == jacobi(x0,y) * jacobi(x1,y)
|
||||
|
||||
When b is odd:
|
||||
|
||||
jacobi(x^2,b) == 1 if gcd(x,b) == 1
|
||||
jacobi(x,b^2) == 1 if gcd(x,b) == 1
|
||||
|
||||
jacobi(x0,b) == jacobi(x1,b) if x0 == x1 % b
|
||||
|
||||
jacobi(-1,b) == (-1) ^ ((b-1) / 2) == 1 if b == 1 % 4
|
||||
jacobi(-1,b) == (-1) ^ ((b-1) / 2) == -1 if b == 3 % 4
|
||||
|
||||
jacobi(2,b) == (-1) ^ ((b^2 - 1) / 8) == 1 if b == 1 % 8 OR
|
||||
b == 7 % 8
|
||||
jacobi(2,b) == (-1) ^ ((b^2 - 1) / 8) == -1 if b == 3 % 8 OR
|
||||
b == 5 % 8
|
||||
|
||||
jacobi(-3,b) == 1 if b == 1 % 6
|
||||
jacobi(-3,b) == -1 if b == 5 % 6
|
||||
|
||||
jacobi(5,b) == 1 if b == 1 % 10 OR
|
||||
b == 9 % 10
|
||||
jacobi(5,b) == -1 if b == 3 % 10 OR
|
||||
b == 7 % 10
|
||||
|
||||
If a and b are both odd primes, OR
|
||||
if gcd(a,b) = 1 and, a > 0, and a is odd:
|
||||
|
||||
jacobi(a,b) == jacobi(b,a) * ((-1) ^ (((a-1)/2) * ((b-1)/2)))
|
||||
jacobi(a,b) * jacobi(b,a) == ((-1) ^ (((a-1)/2) * ((b-1)/2)))
|
||||
|
||||
If b is an odd prime:
|
||||
|
||||
jacobi(a,b) == (a ^ ((b-1)/2)) % b
|
||||
|
||||
Combining all of the above, computing jacobi(x,b) may be expressed
|
||||
in the following algorithm when b is odd and 0 < x < b:
|
||||
|
||||
j = 1;
|
||||
while (x != 0) {
|
||||
while (iseven(x)) {
|
||||
x = x / 2;
|
||||
t = b % 8;
|
||||
if (t == 3 || t == 5) {
|
||||
j = -j;
|
||||
}
|
||||
}
|
||||
swap(x,b);
|
||||
if (((x % 4) == 3) && ((b % 4) == 3)) {
|
||||
j = -j;
|
||||
}
|
||||
x = x % b;
|
||||
}
|
||||
|
||||
if (b == 1) {
|
||||
return j;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
The above calc pseudo code is provided to help illustrate the
|
||||
properties of the jacobi symbol only. The use of calc's jacobi
|
||||
builtin is recommended for both speed as well as to handle
|
||||
specical cases.
|
||||
|
||||
For more information on the Legendre symbol and the Jacobi symbol:
|
||||
|
||||
http://mathworld.wolfram.com/LegendreSymbol.html
|
||||
http://mathworld.wolfram.com/JacobiSymbol.html
|
||||
http://primes.utm.edu/glossary/xpage/JacobiSymbol.html
|
||||
|
||||
EXAMPLE
|
||||
; print jacobi(2,3), jacobi(2,5), jacobi(2,15)
|
||||
@@ -61,7 +208,7 @@ LINK LIBRARY
|
||||
|
||||
SEE ALSO
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
## Copyright (C) 1999,2017 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
|
||||
@@ -77,9 +224,9 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: jacobi,v 30.1 2007/03/16 11:10:42 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/jacobi,v $
|
||||
## @(#) $Revision: 30.2 $
|
||||
## @(#) $Id: jacobi,v 30.2 2017/05/19 16:09:14 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc-RHEL7/help/RCS/jacobi,v $
|
||||
##
|
||||
## Under source code control: 1995/12/18 12:34:57
|
||||
## File existed as early as: 1995
|
||||
|
@@ -83,6 +83,12 @@
|
||||
|
||||
help full
|
||||
|
||||
The man command is an alias for the help command. Try:
|
||||
|
||||
man jacobi
|
||||
|
||||
Only calc help files may be displayed by the help and man commands.
|
||||
|
||||
By default, arguments to functions are passed by value (even
|
||||
matrices). For speed, you can put an ampersand before any
|
||||
variable argument in a function call, and that variable will be
|
||||
@@ -169,7 +175,7 @@
|
||||
to be calculated. Global variables which are numbers can be
|
||||
saved to a file by using the 'write filename' command.
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
## Copyright (C) 1999-2017 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
|
||||
@@ -185,9 +191,9 @@
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: overview,v 30.1 2007/03/16 11:10:42 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/overview,v $
|
||||
## @(#) $Revision: 30.2 $
|
||||
## @(#) $Id: overview,v 30.2 2017/05/19 16:09:14 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc-RHEL7/help/RCS/overview,v $
|
||||
##
|
||||
## Under source code control: 1991/07/21 04:37:23
|
||||
## File existed as early as: 1991
|
||||
|
10
help/pound
10
help/pound
@@ -2,7 +2,7 @@ NAME
|
||||
#
|
||||
|
||||
SYNOPSIS
|
||||
#!/usr/local/src/cmd/calc/calc -q -f
|
||||
#!/usr/local/src/bin/calc/calc -q -f
|
||||
# x
|
||||
x # y
|
||||
## comment
|
||||
@@ -52,7 +52,7 @@ DESCRIPTION
|
||||
|
||||
For example, of an executable file contains:
|
||||
|
||||
#!/usr/local/src/cmd/calc/calc -q -f
|
||||
#!/usr/local/src/bin/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
|
||||
@@ -100,7 +100,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
cscript, unexpected, usage
|
||||
|
||||
## Copyright (C) 2007 Landon Curt Noll
|
||||
## Copyright (C) 2007,2014 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
|
||||
@@ -116,8 +116,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: pound,v 30.1 2007/03/16 11:10:42 chongo Exp $
|
||||
## @(#) $Revision: 30.4 $
|
||||
## @(#) $Id: pound,v 30.4 2014/08/24 21:59:45 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/pound,v $
|
||||
##
|
||||
## Under source code control: 2007/02/06 14:09
|
||||
|
@@ -149,7 +149,7 @@ Calc shell scripts
|
||||
#!/usr/bin/calc -q -s -f
|
||||
global i, n, s;
|
||||
n = argv();
|
||||
for (i = 1; i <= n; i++)
|
||||
for (i = 1; i < n; i++)
|
||||
s += eval(argv(i));
|
||||
print "sum =", s;
|
||||
|
||||
@@ -273,7 +273,7 @@ For more information use the following calc commands:
|
||||
help config
|
||||
help cscript
|
||||
|
||||
## Copyright (C) 2000 Landon Curt Noll and Ernest Bowen
|
||||
## Copyright (C) 2000,2014 Landon Curt Noll and Ernest Bowen
|
||||
##
|
||||
## 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
|
||||
@@ -289,8 +289,8 @@ For more information use the following calc commands:
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: script,v 30.1 2007/03/16 11:10:42 chongo Exp $
|
||||
## @(#) $Revision: 30.2 $
|
||||
## @(#) $Id: script,v 30.2 2014/08/24 22:38:56 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/script,v $
|
||||
##
|
||||
## Under source code control: 1999/11/30 05:29:48
|
||||
|
@@ -319,8 +319,13 @@ Statements
|
||||
|
||||
help help
|
||||
|
||||
The man command is an alias for the help command. For example:
|
||||
|
||||
## Copyright (C) 1999-2007 Landon Curt Noll
|
||||
man jacobi
|
||||
|
||||
Only calc help files may be displayed by the help and man commands.
|
||||
|
||||
## Copyright (C) 1999-2007,2017 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
|
||||
@@ -336,9 +341,9 @@ Statements
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: statement,v 30.1 2007/03/16 11:10:42 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/statement,v $
|
||||
## @(#) $Revision: 30.2 $
|
||||
## @(#) $Id: statement,v 30.2 2017/05/19 16:09:14 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc-RHEL7/help/RCS/statement,v $
|
||||
##
|
||||
## Under source code control: 1991/07/21 04:37:23
|
||||
## File existed as early as: 1991
|
||||
|
74
help/todo
74
help/todo
@@ -1,28 +1,36 @@
|
||||
Calc Todo Items:
|
||||
|
||||
The following items should be addressed sometime in the short to
|
||||
medium term future, if not before the next release.
|
||||
Code contributions are welcome. First Subscribe to the calc-tester
|
||||
mailing list. Next, send patches to the calc-tester mailing list.
|
||||
|
||||
Code contributions are welcome. Send patches to:
|
||||
To subscribe to the calc-tester mailing list, visit the following URL:
|
||||
|
||||
calc-contrib at asthe dot com
|
||||
http://www.isthe.com/chongo/tech/comp/calc/calc-tester.html
|
||||
|
||||
Calc bug reports, however, should send to:
|
||||
This is a low volume moderated mailing list.
|
||||
|
||||
calc-bugs at asthe dot com
|
||||
This mailing list replaces calc-tester at asthe dot com list.
|
||||
|
||||
[[ NOTE: Replace 'at' with @, 'dot' is with . and remove the spaces ]]
|
||||
[[ NOTE: The EMail address uses 'asthe' and the web site URL uses 'isthe' ]]
|
||||
If you need a human to help you with your mailing list subscription,
|
||||
please send EMail to our special:
|
||||
|
||||
See the BUGS file or try the calc command:
|
||||
calc-tester-maillist-help at asthe dot com
|
||||
|
||||
help bugs
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
|
||||
See also the 'wishlist' help files for the calc enhancement wish list.
|
||||
address. To be sure we see your EMail asking for help with your
|
||||
mailing list subscription, please use the following phase in your
|
||||
EMail Subject line:
|
||||
|
||||
calc tester mailing list help
|
||||
|
||||
That phrase in your subject line will help ensure your
|
||||
request will get past our anti-spam filters. You may have
|
||||
additional words in your subject line.
|
||||
|
||||
=-=
|
||||
|
||||
Very High priority items:
|
||||
High priority items:
|
||||
|
||||
* 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:
|
||||
@@ -62,7 +70,7 @@ Very High priority items:
|
||||
|
||||
=-=
|
||||
|
||||
High priority items:
|
||||
Medium priority items:
|
||||
|
||||
* Verify, complete or fix the 'SEE ALSO' help file sections.
|
||||
|
||||
@@ -87,7 +95,7 @@ High priority items:
|
||||
|
||||
=-=
|
||||
|
||||
Medium priority items:
|
||||
Low priority items:
|
||||
|
||||
* Complete the use of CONST where appropriate:
|
||||
|
||||
@@ -117,7 +125,39 @@ Medium priority items:
|
||||
* Add a builtin function to access the 64 bit FNV hash which
|
||||
is currently being used internally in seed.c.
|
||||
|
||||
## Copyright (C) 1999-2007 Landon Curt Noll
|
||||
=-=
|
||||
|
||||
Calc bug reports and calc bug fixes should be sent to:
|
||||
|
||||
calc-bug-report at asthe dot com
|
||||
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
|
||||
This replaces the old calc-bugs at asthe dot com address.
|
||||
|
||||
To be sure we see your EMail reporting a calc bug, please use the
|
||||
following phase in your EMail Subject line:
|
||||
|
||||
calc bug report
|
||||
|
||||
That phrase in your subject line will help ensure your
|
||||
request will get past our anti-spam filters. You may have
|
||||
additional words in your subject line.
|
||||
|
||||
However, you may find it more helpful to simply subscribe
|
||||
to the calc-tester mailing list (see above) and then to
|
||||
send your report to that mailing list as a wider set calc
|
||||
testers may be able to help you.
|
||||
|
||||
=-=
|
||||
|
||||
The calc web site is located at:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
||||
NOTE: The EMail address uses 'asthe', while the web site uses 'isthe'.
|
||||
|
||||
## Copyright (C) 1999-2007,2014 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
|
||||
@@ -133,8 +173,8 @@ Medium priority items:
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.2 $
|
||||
## @(#) $Id: todo,v 30.2 2007/09/08 02:52:42 chongo Exp $
|
||||
## @(#) $Revision: 30.4 $
|
||||
## @(#) $Id: todo,v 30.4 2014/10/12 12:23:43 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/todo,v $
|
||||
##
|
||||
## Under source code control: 1999/10/20 07:42:55
|
||||
|
@@ -277,7 +277,7 @@ Unexpected
|
||||
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
|
||||
#!/usr/local/src/bin/calc/calc -q -f
|
||||
|
||||
/* a correct comment */
|
||||
## another correct comment
|
||||
@@ -289,7 +289,7 @@ Unexpected
|
||||
|
||||
This next example is WRONG:
|
||||
|
||||
#!/usr/local/src/cmd/calc/calc -q -f
|
||||
#!/usr/local/src/bin/calc/calc -q -f
|
||||
|
||||
# This is not a calc calc comment because it has only a single #
|
||||
# You must to start comments with ## or /*
|
||||
@@ -404,7 +404,7 @@ Unexpected
|
||||
64
|
||||
|
||||
|
||||
## Copyright (C) 1999-2007 Landon Curt Noll
|
||||
## Copyright (C) 1999-2007,2014 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
|
||||
@@ -420,8 +420,8 @@ Unexpected
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.4 $
|
||||
## @(#) $Id: unexpected,v 30.4 2008/05/10 13:18:09 chongo Exp $
|
||||
## @(#) $Revision: 30.6 $
|
||||
## @(#) $Id: unexpected,v 30.6 2014/08/24 21:59:45 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/unexpected,v $
|
||||
##
|
||||
## Under source code control: 1997/03/21 13:15:18
|
||||
|
@@ -1,22 +1,37 @@
|
||||
Calc Enhancement Wish List:
|
||||
|
||||
Send calc comments, suggestions, bug fixes, enhancements and
|
||||
We welcome calc comments, suggestions, bug fixes, enhancements and
|
||||
interesting calc scripts that you would like you see included in
|
||||
future distributions to:
|
||||
future distributions.
|
||||
|
||||
calc-contrib at asthe dot com
|
||||
To send such items, first subscribe to the calc-tester mailing list.
|
||||
Then send your comments, suggestions, bug fixes, enhancements and
|
||||
interesting calc scripts to the calc-tester mailing list.
|
||||
|
||||
The following items are in the calc wish list. Programs like this
|
||||
can be extended and improved forever.
|
||||
To subscribe to the calc-tester mailing list, visit the following URL:
|
||||
|
||||
Calc bug reports, however, should be sent to:
|
||||
http://www.isthe.com/chongo/tech/comp/calc/calc-tester.html
|
||||
|
||||
calc-bugs at asthe dot com
|
||||
This is a low volume moderated mailing list.
|
||||
|
||||
[[ NOTE: Replace 'at' with @, 'dot' is with . and remove the spaces ]]
|
||||
[[ NOTE: The EMail address uses 'asthe' and the web site URL uses 'isthe' ]]
|
||||
This mailing list replaces calc-tester at asthe dot com list.
|
||||
|
||||
See the 'todo' help file for higher priority todo items.
|
||||
If you need a human to help you with your mailing list subscription,
|
||||
please send EMail to our special:
|
||||
|
||||
calc-tester-maillist-help at asthe dot com
|
||||
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
|
||||
address. To be sure we see your EMail asking for help with your
|
||||
mailing list subscription, please use the following phase in your
|
||||
EMail Subject line:
|
||||
|
||||
calc tester mailing list help
|
||||
|
||||
That phrase in your subject line will help ensure your
|
||||
request will get past our anti-spam filters. You may have
|
||||
additional words in your subject line.
|
||||
|
||||
=-=
|
||||
|
||||
@@ -187,7 +202,39 @@ Calc Enhancement Wish List:
|
||||
* Add read -once -try "filename" which would do nothing
|
||||
if "filename" was not a readable file.
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
=-=
|
||||
|
||||
Calc bug reports and calc bug fixes should be sent to:
|
||||
|
||||
calc-bug-report at asthe dot com
|
||||
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
|
||||
This replaces the old calc-bugs at asthe dot com address.
|
||||
|
||||
To be sure we see your EMail reporting a calc bug, please use the
|
||||
following phase in your EMail Subject line:
|
||||
|
||||
calc bug report
|
||||
|
||||
That phrase in your subject line will help ensure your
|
||||
request will get past our anti-spam filters. You may have
|
||||
additional words in your subject line.
|
||||
|
||||
However, you may find it more helpful to simply subscribe
|
||||
to the calc-tester mailing list (see above) and then to
|
||||
send your report to that mailing list as a wider set calc
|
||||
testers may be able to help you.
|
||||
|
||||
=-=
|
||||
|
||||
The calc web site is located at:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
||||
NOTE: The EMail address uses 'asthe', while the web site uses 'isthe'.
|
||||
|
||||
## Copyright (C) 1999,2014 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
|
||||
@@ -203,8 +250,8 @@ Calc Enhancement Wish List:
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: wishlist,v 30.1 2007/03/16 11:10:42 chongo Exp $
|
||||
## @(#) $Revision: 30.3 $
|
||||
## @(#) $Id: wishlist,v 30.3 2014/10/12 12:23:43 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/bin/calc/help/RCS/wishlist,v $
|
||||
##
|
||||
## Under source code control: 1991/07/21 04:37:24
|
||||
|
112
hist.c
112
hist.c
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: hist.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: hist.c,v 30.2 2014/08/24 23:57:57 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/hist.c,v $
|
||||
*
|
||||
* Under source code control: 1993/05/02 20:09:19
|
||||
@@ -88,7 +88,7 @@ STATIC struct {
|
||||
char *mark;
|
||||
int bufsize;
|
||||
int linelen;
|
||||
int histcount;
|
||||
int histcount; /* valid history entries */
|
||||
int curhist;
|
||||
BOOL virgin_line; /* 1 => never typed chars, 0 => chars typed */
|
||||
} HS;
|
||||
@@ -199,29 +199,22 @@ STATIC KEY_MAP maps[] = {
|
||||
{esc_map_name, {NULL, NULL}, {NULL, NULL}},
|
||||
};
|
||||
|
||||
|
||||
#define INTROUND (sizeof(int) - 1)
|
||||
#define HISTLEN(hp) ((((hp)->len + INTROUND) & ~INTROUND) + sizeof(int))
|
||||
#define HISTOFFSET(hp) (((char *) (hp)) - histbuf)
|
||||
#define FIRSTHIST ((HIST *) histbuf)
|
||||
#define NEXTHIST(hp) ((HIST *) (((char *) (hp)) + HISTLEN(hp)))
|
||||
|
||||
|
||||
typedef struct {
|
||||
int len; /* length of data */
|
||||
char data[1]; /* varying length data */
|
||||
typedef struct history_entry {
|
||||
int len; /* length of data */
|
||||
char *data; /* varying length data */
|
||||
struct history_entry* prev;
|
||||
struct history_entry* next;
|
||||
} HIST;
|
||||
|
||||
|
||||
STATIC int inited;
|
||||
STATIC int canedit;
|
||||
STATIC int histused;
|
||||
STATIC int key_count;
|
||||
STATIC int save_len;
|
||||
STATIC KEY_MAP *cur_map;
|
||||
STATIC KEY_MAP *base_map;
|
||||
STATIC KEY_ENT key_table[MAX_KEYS];
|
||||
STATIC char histbuf[HIST_SIZE + 1];
|
||||
STATIC HIST* hist_first = NULL;
|
||||
STATIC HIST* hist_last = NULL;
|
||||
STATIC char save_buffer[SAVE_SIZE];
|
||||
|
||||
/* declare other static functions */
|
||||
@@ -399,6 +392,19 @@ hist_term(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (hist_first) {
|
||||
HIST* hp = hist_first;
|
||||
HIST* next;
|
||||
while(hp) {
|
||||
next = hp->next;
|
||||
free(hp->data);
|
||||
free(hp);
|
||||
hp = next;
|
||||
}
|
||||
}
|
||||
hist_first = NULL;
|
||||
hist_last = NULL;
|
||||
|
||||
/*
|
||||
* restore orignal tty state
|
||||
*/
|
||||
@@ -656,14 +662,18 @@ read_key(void)
|
||||
S_FUNC HIST *
|
||||
get_event(int n)
|
||||
{
|
||||
register HIST * hp;
|
||||
register HIST * hp = hist_first;
|
||||
int i = 0;
|
||||
|
||||
if ((n < 0) || (n >= HS.histcount))
|
||||
return NULL;
|
||||
hp = FIRSTHIST;
|
||||
while (n-- > 0)
|
||||
hp = NEXTHIST(hp);
|
||||
return hp;
|
||||
do {
|
||||
if(!hp)
|
||||
break;
|
||||
if(i == n)
|
||||
return hp;
|
||||
++i;
|
||||
hp = hp->next;
|
||||
} while(hp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -674,11 +684,11 @@ get_event(int n)
|
||||
S_FUNC HIST *
|
||||
find_event(char *pat, int len)
|
||||
{
|
||||
register HIST * hp;
|
||||
register HIST * hp = hist_first;
|
||||
|
||||
for (hp = FIRSTHIST; hp->len; hp = NEXTHIST(hp)) {
|
||||
if ((hp->len == len) && (memcmp(hp->data, pat, len) == 0))
|
||||
return hp;
|
||||
for(hp = hist_first; hp != NULL; hp = hp->next) {
|
||||
if ((hp->len == len) && (memcmp(hp->data, pat, len) == 0))
|
||||
return hp;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -694,8 +704,6 @@ void
|
||||
hist_saveline(char *line, int len)
|
||||
{
|
||||
HIST * hp;
|
||||
HIST * hp2;
|
||||
int left;
|
||||
|
||||
if ((len > 0) && (line[len - 1] == '\n'))
|
||||
len--;
|
||||
@@ -709,13 +717,17 @@ hist_saveline(char *line, int len)
|
||||
*/
|
||||
hp = find_event(line, len);
|
||||
if (hp) {
|
||||
hp2 = NEXTHIST(hp);
|
||||
left = histused - HISTOFFSET(hp2);
|
||||
if (left <= 0)
|
||||
if (hp == hist_last)
|
||||
return;
|
||||
histused -= HISTLEN(hp);
|
||||
memcpy(hp, hp2, left + 1);
|
||||
HS.histcount--;
|
||||
if (hp->prev)
|
||||
hp->prev->next = hp->next;
|
||||
hp->next->prev = hp->prev;
|
||||
|
||||
hist_last->next = hp;
|
||||
hp->next = NULL;
|
||||
hp->prev = hist_last;
|
||||
hist_last = hp;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -723,24 +735,34 @@ hist_saveline(char *line, int len)
|
||||
* the new command, then repeatedly delete the earliest command
|
||||
* as many times as necessary in order to make enough room.
|
||||
*/
|
||||
while ((histused + len) >= HIST_SIZE) {
|
||||
hp = (HIST *) histbuf;
|
||||
hp2 = NEXTHIST(hp);
|
||||
left = histused - HISTOFFSET(hp2);
|
||||
histused -= HISTLEN(hp);
|
||||
memcpy(hp, hp2, left + 1);
|
||||
if (HS.histcount >= HIST_SIZE) {
|
||||
HIST *new_first = hist_first->next;
|
||||
free(hist_first->data);
|
||||
free(hist_first);
|
||||
new_first->prev = NULL;
|
||||
hist_first = new_first;
|
||||
HS.histcount--;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add the line to the end of the history table.
|
||||
*/
|
||||
hp = (HIST *) &histbuf[histused];
|
||||
hp = malloc(sizeof(HIST));
|
||||
hp->next = NULL;
|
||||
hp->prev = NULL;
|
||||
hp->len = len;
|
||||
hp->data = malloc(len);
|
||||
memcpy(hp->data, line, len);
|
||||
histused += HISTLEN(hp);
|
||||
histbuf[histused] = 0;
|
||||
HS.curhist = ++HS.histcount;
|
||||
if (!hist_first)
|
||||
hist_first = hp;
|
||||
if (!hist_last)
|
||||
hist_last = hp;
|
||||
else {
|
||||
hist_last->next = hp;
|
||||
hp->prev = hist_last;
|
||||
hist_last = hp;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
12
hist.h
12
hist.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* hist - definitions for command history module
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
* Copyright (C) 1999-2007,2014 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: hist.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: hist.h,v 30.3 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/hist.h,v $
|
||||
*
|
||||
* Under source code control: 1993/05/02 20:09:20
|
||||
@@ -28,8 +28,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HIST_H__)
|
||||
#define __HIST_H__
|
||||
#if !defined(INCLUDE_HIST_H)
|
||||
#define INCLUDE_HIST_H
|
||||
|
||||
|
||||
/*
|
||||
@@ -74,4 +74,4 @@ E_FUNC size_t hist_getline(char *prompt, char *buf, size_t len);
|
||||
E_FUNC void hist_saveline(char *line, int len);
|
||||
|
||||
|
||||
#endif /* !__HIST_H__ */
|
||||
#endif /* !INCLUDE_HIST_H */
|
||||
|
22
input.c
22
input.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* input - nested input source file reader
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
* Copyright (C) 1999-2007,2014 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: input.c,v 30.3 2013/08/11 08:41:38 chongo Exp $
|
||||
* @(#) $Revision: 30.6 $
|
||||
* @(#) $Id: input.c,v 30.6 2014/08/31 14:54:50 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/input.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:16
|
||||
@@ -51,7 +51,7 @@
|
||||
#if defined(__MSDOS__)
|
||||
#include <limits.h>
|
||||
#define _fullpath(f,n,s) (_fixpath(n,f),f)
|
||||
#define _MAX_PATH PATH_MAX
|
||||
#define MSDOS_MAX_PATH PATH_MAX
|
||||
#endif
|
||||
|
||||
#include "calc.h"
|
||||
@@ -815,6 +815,7 @@ ttychar(void)
|
||||
*/
|
||||
if (charbuf[0] == '!') { /* do a shell command */
|
||||
char *cmd;
|
||||
int ret;
|
||||
|
||||
cmd = charbuf + 1;
|
||||
if (*cmd == '\0' || *cmd == '\n')
|
||||
@@ -823,7 +824,10 @@ ttychar(void)
|
||||
if (conf->calc_debug & CALCDBG_SYSTEM) {
|
||||
printf("%s\n", cmd);
|
||||
}
|
||||
system(cmd);
|
||||
ret = system(cmd);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "error in cmd: %s\n", cmd);
|
||||
}
|
||||
} else {
|
||||
fprintf(stderr, "execution disallowed by -m flag\n");
|
||||
}
|
||||
@@ -977,9 +981,9 @@ isinoderead(struct stat *sbuf)
|
||||
/* scan the entire readset */
|
||||
for (i=0; i < maxreadset; ++i) {
|
||||
#if defined(_WIN32) || defined(__MSDOS__)
|
||||
char tmp[_MAX_PATH+1];
|
||||
tmp[_MAX_PATH] = '\0';
|
||||
if (_fullpath(tmp, cip->i_name, _MAX_PATH) &&
|
||||
char tmp[MSDOS_MAX_PATH+1];
|
||||
tmp[MSDOS_MAX_PATH] = '\0';
|
||||
if (_fullpath(tmp, cip->i_name, MSDOS_MAX_PATH) &&
|
||||
readset[i].active &&
|
||||
strcasecmp(readset[i].path, tmp) == 0) {
|
||||
/* found a match */
|
||||
@@ -1110,7 +1114,7 @@ addreadset(char *name, char *path, struct stat *sbuf)
|
||||
* this new longer path name.
|
||||
*/
|
||||
{
|
||||
readset[ret].path = _fullpath(NULL, path, _MAX_PATH);
|
||||
readset[ret].path = _fullpath(NULL, path, MSDOS_MAX_PATH);
|
||||
if (readset[ret].path == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
12
jump.h
12
jump.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* jump - trivial prime jump table
|
||||
*
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007,2014 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: jump.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: jump.h,v 30.3 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/jump.h,v $
|
||||
*
|
||||
* Under source code control: 1994/06/29 04:03:55
|
||||
@@ -62,8 +62,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__JUMP_H__)
|
||||
#define __JUMP_H__
|
||||
#if !defined(INCLUDE_JUMP_H)
|
||||
#define INCLUDE_JUMP_H
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
@@ -107,4 +107,4 @@ EXTERN CONST short jmpindx[];
|
||||
EXTERN CONST unsigned char jmp[];
|
||||
EXTERN CONST unsigned char *CONST lastjmp;
|
||||
|
||||
#endif /* !__JUMP_H__ */
|
||||
#endif /* !INCLUDE_JUMP_H */
|
||||
|
12
label.h
12
label.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* label - label handling routines
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
* Copyright (C) 1999-2007,2014 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: label.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: label.h,v 30.3 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/label.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:33
|
||||
@@ -28,8 +28,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__LABEL_H__)
|
||||
#define __LABEL_H__
|
||||
#if !defined(INCLUDE_LABEL_H)
|
||||
#define INCLUDE_LABEL_H
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
@@ -61,4 +61,4 @@ E_FUNC void uselabel(LABEL *lp);
|
||||
E_FUNC void checklabels(void);
|
||||
|
||||
|
||||
#endif /* !__LABEL_H__ */
|
||||
#endif /* !INCLUDE_LABEL_H */
|
||||
|
12
lib_calc.h
12
lib_calc.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* math_error - a simple libcalc math error routine
|
||||
*
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007,2014 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: lib_calc.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: lib_calc.h,v 30.3 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/lib_calc.h,v $
|
||||
*
|
||||
* Under source code control: 1997/03/23 18:37:10
|
||||
@@ -29,8 +29,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__MATH_ERROR_H__)
|
||||
#define __MATH_ERROR_H__
|
||||
#if !defined(INCLUDE_MATH_ERROR_H)
|
||||
#define INCLUDE_MATH_ERROR_H
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
@@ -78,4 +78,4 @@ EXTERN int calc_print_scanwarn_msg;
|
||||
/* number of parse/scan warnings found */
|
||||
EXTERN unsigned long calc_warn_cnt;
|
||||
|
||||
#endif /* !__MATH_ERROR_H__ */
|
||||
#endif /* !INCLUDE_MATH_ERROR_H */
|
||||
|
12
lib_util.h
12
lib_util.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* lib_util - calc link library utility routines
|
||||
*
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007,2014 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: lib_util.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: lib_util.h,v 30.3 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/lib_util.h,v $
|
||||
*
|
||||
* Under source code control: 1997/04/19 21:38:30
|
||||
@@ -34,8 +34,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__LIB_UTIL_H__)
|
||||
#define __LIB_UTIL_H__
|
||||
#if !defined(INCLUDE_LIB_UTIL_H)
|
||||
#define INCLUDE_LIB_UTIL_H
|
||||
|
||||
/* external functions in lib_util.c */
|
||||
EXTERN int lowhex2bin[256];
|
||||
@@ -44,4 +44,4 @@ E_FUNC ZVALUE convstr2z(char*);
|
||||
E_FUNC ZVALUE convhex2z(char *hex);
|
||||
E_FUNC char *convz2hex(ZVALUE z);
|
||||
|
||||
#endif /* __LIB_UTIL_H__ */
|
||||
#endif /* INCLUDE_LIB_UTIL_H */
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* longbits - Determine the number if bits in a char, short, int or long
|
||||
*
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007,2014 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: longbits.c,v 30.2 2013/08/11 08:41:38 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: longbits.c,v 30.3 2014/08/24 21:57:31 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/longbits.c,v $
|
||||
*
|
||||
* Under source code control: 1994/03/18 03:06:18
|
||||
|
12
nametype.h
12
nametype.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* nametype - associate names with values
|
||||
*
|
||||
* Copyright (C) 1999 Landon Curt Noll
|
||||
* Copyright (C) 1999,2014 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: nametype.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: nametype.h,v 30.3 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/nametype.h,v $
|
||||
*
|
||||
* Under source code control: 1997/03/08 13:44:55
|
||||
@@ -29,8 +29,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__NAMETYPE_H__)
|
||||
#define __NAMETYPE_H__
|
||||
#if !defined(INCLUDE_NAMETYPE_H)
|
||||
#define INCLUDE_NAMETYPE_H
|
||||
|
||||
|
||||
/*
|
||||
@@ -42,4 +42,4 @@ typedef struct {
|
||||
} NAMETYPE;
|
||||
|
||||
|
||||
#endif /* !__NAMETYPE_H__ */
|
||||
#endif /* !INCLUDE_NAMETYPE_H */
|
||||
|
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* no-implicit - Determine if the compiler allows -Wno-implicit
|
||||
*
|
||||
* Copyright (C) 2003 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.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: no_implicit.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/no_implicit.c,v $
|
||||
*
|
||||
* Under source code control: 2003/01/14 01:45:19
|
||||
* File existed as early as: 2003
|
||||
*
|
||||
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
*/
|
||||
|
||||
/*
|
||||
* If we are able to compile this program, then we the compiler must
|
||||
* allow the -Wno-implicit flag so we output the -Wno-implicit symbol.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
/* -Wno-implicit flag is allowed */
|
||||
printf("-Wno-implicit\n");
|
||||
|
||||
/* exit(0); */
|
||||
return 0;
|
||||
}
|
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.5 $
|
||||
* @(#) $Id: opcodes.c,v 30.5 2013/08/11 08:41:38 chongo Exp $
|
||||
* @(#) $Revision: 30.6 $
|
||||
* @(#) $Id: opcodes.c,v 30.6 2014/08/31 14:54:50 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/opcodes.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:19
|
||||
@@ -3936,7 +3936,7 @@ calculate(FUNC *fp, int argcount)
|
||||
case OPGLB: /* global symbol reference (pointer arg) */
|
||||
/* ignore Saber-C warning #68 - benign type mismatch */
|
||||
/* ok to ignore in proc calculate */
|
||||
(*op->o_func)(fp, *((char **) &fp->f_opcodes[pc]));
|
||||
(*op->o_func)(fp, *(&fp->f_opcodes[pc]));
|
||||
pc += PTR_SIZE;
|
||||
break;
|
||||
|
||||
|
12
opcodes.h
12
opcodes.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* opcodes - opcode execution module definition
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
* Copyright (C) 1999-2007,2014 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: opcodes.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: opcodes.h,v 30.3 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/opcodes.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:35
|
||||
@@ -28,8 +28,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__OPCODES_H__)
|
||||
#define __OPCODES_H__
|
||||
#if !defined(INCLUDE_OPCODES_H)
|
||||
#define INCLUDE_OPCODES_H
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
@@ -184,4 +184,4 @@ EXTERN char *funcname; /* function being executed */
|
||||
EXTERN long funcline; /* function line being executed */
|
||||
|
||||
|
||||
#endif /* !__OPCODES_H__ */
|
||||
#endif /* !INCLUDE_OPCODES_H */
|
||||
|
12
prime.h
12
prime.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* prime - quickly determine if a small number is prime
|
||||
*
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007,2014 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: prime.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: prime.h,v 30.3 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/prime.h,v $
|
||||
*
|
||||
* Under source code control: 1994/06/04 03:26:15
|
||||
@@ -29,8 +29,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__PRIME_H__)
|
||||
#define __PRIME_H__
|
||||
#if !defined(INCLUDE_PRIME_H)
|
||||
#define INCLUDE_PRIME_H
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
@@ -91,4 +91,4 @@ EXTERN CONST ZVALUE _nxt_prime_; /* 2^32+15 - smallest prime > 2^32 */
|
||||
EXTERN CONST ZVALUE _jmpmod2_; /* JMPMOD*2 as a ZVALUE */
|
||||
|
||||
|
||||
#endif /* !__PRIME_H__ */
|
||||
#endif /* !INCLUDE_PRIME_H */
|
||||
|
8
qmath.c
8
qmath.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* qmath - extended precision rational arithmetic primitive routines
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell and Ernest Bowen
|
||||
* Copyright (C) 1999-2007,2014 David I. Bell and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: qmath.c,v 30.2 2013/08/11 08:41:38 chongo Exp $
|
||||
* @(#) $Revision: 30.4 $
|
||||
* @(#) $Id: qmath.c,v 30.4 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/qmath.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:21
|
||||
@@ -1312,7 +1312,7 @@ qcmp(NUMBER *q1, NUMBER *q2)
|
||||
if (q1 == q2)
|
||||
return FALSE;
|
||||
if ((q1->num.sign != q2->num.sign) || (q1->num.len != q2->num.len) ||
|
||||
(q2->den.len != q2->den.len) || (*q1->num.v != *q2->num.v) ||
|
||||
(q1->den.len != q2->den.len) || (*q1->num.v != *q2->num.v) ||
|
||||
(*q1->den.v != *q2->den.v))
|
||||
return TRUE;
|
||||
if (zcmp(q1->num, q2->num))
|
||||
|
12
qmath.h
12
qmath.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* qmath - declarations for extended precision rational arithmetic
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
* Copyright (C) 1999-2007,2014 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.4 $
|
||||
* @(#) $Id: qmath.h,v 30.4 2013/09/01 22:16:21 chongo Exp $
|
||||
* @(#) $Revision: 30.6 $
|
||||
* @(#) $Id: qmath.h,v 30.6 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/qmath.h,v $
|
||||
*
|
||||
* Under source code control: 1993/07/30 19:42:47
|
||||
@@ -28,8 +28,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__QMATH_H__)
|
||||
#define __QMATH_H__
|
||||
#if !defined(INCLUDE_QMATH_H)
|
||||
#define INCLUDE_QMATH_H
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
@@ -278,4 +278,4 @@ EXTERN NUMBER _qtwo_, _qthree_, _qfour_, _qten_;
|
||||
EXTERN NUMBER * initnumbs[];
|
||||
|
||||
|
||||
#endif /* !__QMATH_H__ */
|
||||
#endif /* !INCLUDE_QMATH_H */
|
||||
|
21
quickhash.c
21
quickhash.c
@@ -1,7 +1,12 @@
|
||||
/*
|
||||
* quickhash - quickly hash a calc value using a quasi Fowler/Noll/Vo hash
|
||||
* quickhash - quickly hash a calc value using a 32-bit FNV-0 hash
|
||||
*
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
* WARNING: General use of FNV-0 hash is not recommended. Calc uses FNV-0
|
||||
* for a specific You should use FNV-1a hash instead. See:
|
||||
*
|
||||
* http://www.isthe.com/chongo/tech/comp/fnv/index.html
|
||||
*
|
||||
* Copyright (C) 1999-2007,2014 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
|
||||
@@ -17,8 +22,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: quickhash.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: quickhash.c,v 30.2 2014/09/30 00:55:46 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/quickhash.c,v $
|
||||
*
|
||||
* Under source code control: 1995/03/04 11:34:23
|
||||
@@ -59,6 +64,8 @@ S_FUNC QCKHASH blk_hash(BLOCK *blk, QCKHASH val);
|
||||
/*
|
||||
* quasi_fnv - quasi Fowler/Noll/Vo-0 32 bit hash
|
||||
*
|
||||
* NOTE: General use of FNV-0 hadh
|
||||
*
|
||||
* The basis of this hash algorithm was taken from an idea sent
|
||||
* as reviewer comments to the IEEE POSIX P1003.2 committee by:
|
||||
*
|
||||
@@ -108,7 +115,7 @@ S_FUNC QCKHASH blk_hash(BLOCK *blk, QCKHASH val);
|
||||
* to the (val) hash state. This is a simulation of hashing
|
||||
* a variable type.
|
||||
*
|
||||
* The Fowler/Noll/Vo hash does a very good job in producing
|
||||
* The 32-bit FNV-0 hash does a very good job in producing
|
||||
* a 32 bit hash arrays of octets in a short amount of time.
|
||||
* It is not bad for hashing calc data as well. So doing a
|
||||
* quick and dirty job of hashing on a part of a calc value
|
||||
@@ -139,7 +146,7 @@ S_FUNC QCKHASH blk_hash(BLOCK *blk, QCKHASH val);
|
||||
|
||||
|
||||
/*
|
||||
* fnv_qhash - compute the next Fowler/Noll/Vo hash given a NUMBER
|
||||
* fnv_qhash - compute the next 32-bit FNV-0 hash given a NUMBER
|
||||
*
|
||||
* given:
|
||||
* q pointer to a NUMBER
|
||||
@@ -154,7 +161,7 @@ S_FUNC QCKHASH blk_hash(BLOCK *blk, QCKHASH val);
|
||||
|
||||
|
||||
/*
|
||||
* fnv_chash - compute the next Fowler/Noll/Vo hash given a COMPLEX
|
||||
* fnv_chash - compute the next 32-bit FNV-0 hash given a COMPLEX
|
||||
*
|
||||
* given:
|
||||
* c pointer to a COMPLEX
|
||||
|
58
rpm.mk
58
rpm.mk
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# rpm.mk - Makefile for building rpm packages for calc
|
||||
#
|
||||
# Copyright (C) 2003 Petteri Kettunen and Landon Curt Noll
|
||||
# Copyright (C) 2003,2014 Petteri Kettunen and 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
|
||||
@@ -19,9 +19,9 @@
|
||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#
|
||||
MAKEFILE_REV= $$Revision: 30.11 $$
|
||||
# @(#) $Id: rpm.mk,v 30.11 2013/08/11 08:41:38 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc/RCS/rpm.mk,v $
|
||||
MAKEFILE_REV= $$Revision: 30.15 $$
|
||||
# @(#) $Id: rpm.mk,v 30.15 2014/09/08 00:04:13 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/bin/calc-RHEL7/RCS/rpm.mk,v $
|
||||
#
|
||||
# Under source code control: 2003/02/16 20:21:39
|
||||
# File existed as early as: 2003
|
||||
@@ -35,21 +35,22 @@ MAKEFILE_REV= $$Revision: 30.11 $$
|
||||
# IMPORTANT NOTE: The rpm process assumes that ~/.rpmmacros contains
|
||||
# the following:
|
||||
#
|
||||
# %_topdir /var/tmp/rpmbuild
|
||||
# %_tmppath %{_topdir}/tmp
|
||||
# %_builddir %{_topdir}/BUILD
|
||||
# %_rpmdir %{_topdir}/RPMS
|
||||
# %_sourcedir %{_topdir}/SOURCES
|
||||
# %_specdir %{_topdir}/SPECS
|
||||
# %_srcrpmdir %{_topdir}/SRPMS
|
||||
# %_buildroot %{_topdir}/BUILDROOT
|
||||
# %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
|
||||
#
|
||||
# If you are signing the rpms, you also need:
|
||||
#
|
||||
# %_signature gpg
|
||||
# %_gpg_path ~/.gnupg
|
||||
# %_gpg_name __YOUR_NAME_HERE__
|
||||
# %_gpgbin /usr/bin/gpg
|
||||
# %_topdir %(echo $HOME)/rpm/%{name}
|
||||
# %_sourcedir %(echo $HOME)/rpm/%{name}/SOURCES
|
||||
# %_specdir %(echo $HOME)/rpm/%{name}/SPECS
|
||||
# %_tmppath %(echo $HOME)/rpm/%{name}/tmp
|
||||
# %_builddir %(echo $HOME)/rpm/%{name}/BUILD
|
||||
# %_buildroot %(echo $HOME)/rpm/%{name}/tmp/build-root
|
||||
# %_rpmdir %(echo $HOME)/rpm/%{name}/RPMS
|
||||
# %_srcrpmdir %(echo $HOME)/rpm/%{name}/SRPMS
|
||||
# %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
|
||||
# %packager __YOUR_NAME_HERE__
|
||||
# %vendor __YOUR_ORG_OR_GROUP_OR_COMPANY_HERE__
|
||||
|
||||
# IMPORTANT NOTE: Unless the package redhat-rpm-config is installed,
|
||||
# the calc-debuginfo rpm will not be created.
|
||||
@@ -68,8 +69,8 @@ MAKEFILE_REV= $$Revision: 30.11 $$
|
||||
#
|
||||
SHELL= /bin/sh
|
||||
RPMBUILD_TOOL= rpmbuild
|
||||
TARCH= i686
|
||||
RPMBUILD_OPTION= -ba --target=$(TARCH)
|
||||
TARCH= x86_64
|
||||
RPMBUILD_OPTION= -ba --target=$(TARCH) --buildroot=${RPM_BUILD_ROOT}
|
||||
RPM_TOOL= rpm
|
||||
SED= sed
|
||||
FIND= find
|
||||
@@ -95,11 +96,13 @@ PROJECT_RELEASE=
|
||||
PROJECT= ${PROJECT_NAME}-${PROJECT_VERSION}
|
||||
SPECFILE= ${PROJECT_NAME}.spec
|
||||
TARBALL= ${PROJECT}.${TAR}.bz2
|
||||
RPM686= ${PROJECT}-${PROJECT_RELEASE}.${TARCH}.rpm
|
||||
DRPM686= \
|
||||
RPMx86_64= ${PROJECT}-${PROJECT_RELEASE}.${TARCH}.rpm
|
||||
DRPMx86_64= \
|
||||
${PROJECT_NAME}-devel-${PROJECT_VERSION}-${PROJECT_RELEASE}.${TARCH}.rpm
|
||||
SRPM= ${PROJECT}-${PROJECT_RELEASE}.src.rpm
|
||||
RPM_TOP= ${HOME}/rpm/${NAME}
|
||||
# NOTE: RPM_TOP must be the same as %_topdir in ~/.rpmmacros
|
||||
RPM_TOP= /var/tmp/rpmbuild
|
||||
RPM_BUILD_ROOT= ${RPM_TOP}/BUILDROOT
|
||||
TMPDIR= ${RPM_TOP}/tmp
|
||||
|
||||
# Makefile debug
|
||||
@@ -149,6 +152,7 @@ calc.spec: calc.spec.in ver_calc
|
||||
srcpkg: make_rhdir
|
||||
${V} echo '=-=-=-=-= rpm.mk start of $@ rule =-=-=-=-='
|
||||
${V} echo RPM_TOP="${RPM_TOP}"
|
||||
${V} echo RPM_BUILD_ROOT="${RPM_BUILD_ROOT}"
|
||||
${V} echo PROJECT_VERSION="${PROJECT_VERSION}"
|
||||
${V} echo PROJECT_RELEASE="${PROJECT_RELEASE}"
|
||||
${RM} -rf "$(TMPDIR)/$(PROJECT)"
|
||||
@@ -171,12 +175,13 @@ srcpkg: make_rhdir
|
||||
rpm: srcpkg calc.spec
|
||||
${V} echo '=-=-=-=-= rpm.mk start of $@ rule =-=-=-=-='
|
||||
${V} echo RPM_TOP="${RPM_TOP}"
|
||||
${V} echo RPM_BUILD_ROOT="${RPM_BUILD_ROOT}"
|
||||
${V} echo PROJECT_VERSION="${PROJECT_VERSION}"
|
||||
${V} echo PROJECT_RELEASE="${PROJECT_RELEASE}"
|
||||
$(MAKE) -f Makefile clean
|
||||
${CP} "$(SPECFILE)" "$(RPM_TOP)/SPECS/$(SPECFILE)"
|
||||
${RM} -f "$(RPM_TOP)/RPMS/$(TARCH)/$(RPM686)"
|
||||
${RM} -f "$(RPM_TOP)/RPMS/$(TARCH)/$(DRPM686)"
|
||||
${RM} -f "$(RPM_TOP)/RPMS/$(TARCH)/$(RPMx86_64)"
|
||||
${RM} -f "$(RPM_TOP)/RPMS/$(TARCH)/$(DRPMx86_64)"
|
||||
${RM} -f "$(RPM_TOP)/SRPMS/$(SRPM)"
|
||||
${RPMBUILD_TOOL} ${RPMBUILD_OPTION} "$(RPM_TOP)/SPECS/$(SPECFILE)"
|
||||
@if [ ! -f "$(RPM_TOP)/SRPMS/$(SRPM)" ]; then \
|
||||
@@ -190,6 +195,7 @@ rpm: srcpkg calc.spec
|
||||
make_rhdir:
|
||||
${V} echo '=-=-=-=-= rpm.mk start of $@ rule =-=-=-=-='
|
||||
${V} echo RPM_TOP="${RPM_TOP}"
|
||||
${V} echo RPM_BUILD_ROOT="${RPM_BUILD_ROOT}"
|
||||
${V} echo PROJECT_VERSION="${PROJECT_VERSION}"
|
||||
${V} echo PROJECT_RELEASE="${PROJECT_RELEASE}"
|
||||
for subdir in "" BUILD RPMS SOURCES SPECS SRPMS tmp; do \
|
||||
@@ -243,8 +249,8 @@ logdate:
|
||||
.PHONY: chkpkg
|
||||
chkpkg:
|
||||
${V} echo '=-=-=-=-= rpm.mk start of $@ rule =-=-=-=-='
|
||||
for i in "$(RPM_TOP)/RPMS/$(TARCH)/$(RPM686)" \
|
||||
"$(RPM_TOP)/RPMS/$(TARCH)/$(DRPM686)" \
|
||||
for i in "$(RPM_TOP)/RPMS/$(TARCH)/$(RPMx86_64)" \
|
||||
"$(RPM_TOP)/RPMS/$(TARCH)/$(DRPMx86_64)" \
|
||||
"$(RPM_TOP)/SRPMS/$(SRPM)" ; do \
|
||||
echo "***** start $$i" ; \
|
||||
${RPM_TOOL} -qpi "$$"i ; \
|
||||
@@ -278,8 +284,8 @@ installrpm:
|
||||
echo "must be root to install RPMs" 1>&2; \
|
||||
exit 7; \
|
||||
fi
|
||||
${RPM_TOOL} -ivh "$(RPM_TOP)/RPMS/$(TARCH)/$(RPM686)"
|
||||
${RPM_TOOL} -ivh "$(RPM_TOP)/RPMS/$(TARCH)/$(DRPM686)"
|
||||
${RPM_TOOL} -ivh "$(RPM_TOP)/RPMS/$(TARCH)/$(RPMx86_64)"
|
||||
${RPM_TOOL} -ivh "$(RPM_TOP)/RPMS/$(TARCH)/$(DRPMx86_64)"
|
||||
${V} echo '=-=-=-=-= rpm.mk end of $@ rule =-=-=-=-='
|
||||
|
||||
.PHONY: uninstallrpm
|
||||
|
37
seed.c
37
seed.c
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: seed.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: seed.c,v 30.2 2014/09/30 01:00:04 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/seed.c,v $
|
||||
*
|
||||
* Under source code control: 1999/10/03 10:06:53
|
||||
@@ -117,7 +117,7 @@ typedef struct s_hash64 hash64;
|
||||
|
||||
|
||||
/*
|
||||
* FNV-1 initial basis
|
||||
* 64-bit initial basis - Based on the 64-bit FNV basis value
|
||||
*
|
||||
* We start the hash at a non-zero value at the beginning so that
|
||||
* hashing blocks of data with all 0 bits do not map onto the same
|
||||
@@ -151,17 +151,17 @@ typedef struct s_hash64 hash64;
|
||||
* good hash function.
|
||||
*/
|
||||
#if defined(HAVE_B64)
|
||||
# define FNV1_64_BASIS ((hash64)(0xcbf29ce484222325ULL))
|
||||
# define PRIVATE_64_BASIS ((hash64)(0xcbf29ce484222325ULL))
|
||||
#else
|
||||
# define FNV1_64_BASIS_0 ((USB32)0x2325)
|
||||
# define FNV1_64_BASIS_1 ((USB32)0x8422)
|
||||
# define FNV1_64_BASIS_2 ((USB32)0x9ce4)
|
||||
# define FNV1_64_BASIS_3 ((USB32)0xcbf2)
|
||||
# define PRIVATE_64_BASIS_0 ((USB32)0x2325)
|
||||
# define PRIVATE_64_BASIS_1 ((USB32)0x8422)
|
||||
# define PRIVATE_64_BASIS_2 ((USB32)0x9ce4)
|
||||
# define PRIVATE_64_BASIS_3 ((USB32)0xcbf2)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* hash_buf - perform a Fowler/Noll/Vo-1 64 bit hash
|
||||
* prvate_hash64_buf - perform a Fowler/Noll/Vo-1 64 bit hash
|
||||
*
|
||||
* input:
|
||||
* buf - start of buffer to hash
|
||||
@@ -172,7 +172,7 @@ typedef struct s_hash64 hash64;
|
||||
* 64 bit hash as a static hash64 structure
|
||||
*/
|
||||
S_FUNC hash64
|
||||
hash_buf(char *buf, unsigned len)
|
||||
prvate_hash64_buf(char *buf, unsigned len)
|
||||
{
|
||||
hash64 hval; /* current hash value */
|
||||
#if !defined(HAVE_B64)
|
||||
@@ -205,10 +205,15 @@ hash_buf(char *buf, unsigned len)
|
||||
* http://www.isthe.com/chongo/tech/comp/fnv/
|
||||
*
|
||||
* for more details as well as other forms of the FNV hash.
|
||||
*
|
||||
* NOTE: For general hash functions, we recommend using the
|
||||
* FNV-1a hash function. The use of FNV-1 is kept
|
||||
* for backwards compatibility purposes and because
|
||||
* the use of FNV-1 in this special purpose, suffices.
|
||||
*/
|
||||
#if defined(HAVE_B64)
|
||||
/* hash each octet of the buffer */
|
||||
for (hval = FNV1_64_BASIS; buf < buf_end; ++buf) {
|
||||
for (hval = PRIVATE_64_BASIS; buf < buf_end; ++buf) {
|
||||
|
||||
/* multiply by 1099511628211ULL mod 2^64 using 64 bit longs */
|
||||
hval *= (hash64)1099511628211ULL;
|
||||
@@ -220,10 +225,10 @@ hash_buf(char *buf, unsigned len)
|
||||
#else /* HAVE_B64 */
|
||||
|
||||
/* hash each octet of the buffer */
|
||||
val[0] = FNV1_64_BASIS_0;
|
||||
val[1] = FNV1_64_BASIS_1;
|
||||
val[2] = FNV1_64_BASIS_2;
|
||||
val[3] = FNV1_64_BASIS_3;
|
||||
val[0] = PRIVATE_64_BASIS_0;
|
||||
val[1] = PRIVATE_64_BASIS_1;
|
||||
val[2] = PRIVATE_64_BASIS_2;
|
||||
val[3] = PRIVATE_64_BASIS_3;
|
||||
for (; buf < buf_end; ++buf) {
|
||||
|
||||
/*
|
||||
@@ -441,7 +446,7 @@ pseudo_seed(void)
|
||||
/*
|
||||
* seed the generator with the above data
|
||||
*/
|
||||
hash_val = hash_buf((char *)&sdata, sizeof(sdata));
|
||||
hash_val = prvate_hash64_buf((char *)&sdata, sizeof(sdata));
|
||||
|
||||
/*
|
||||
* load the hash data into the ZVALUE
|
||||
|
2
sha1.c
2
sha1.c
@@ -24,7 +24,7 @@
|
||||
*
|
||||
* @(#) $Revision: 30.4 $
|
||||
* @(#) $Id: sha1.c,v 30.4 2013/08/11 01:08:32 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/sha1.c,v $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/sha1.c,v $
|
||||
*
|
||||
* This file is not covered under version 2.1 of the GNU LGPL.
|
||||
*/
|
||||
|
10
sha1.h
10
sha1.h
@@ -22,16 +22,16 @@
|
||||
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: sha1.h,v 30.3 2007/07/05 17:37:41 chongo Exp $
|
||||
* @(#) $Revision: 30.4 $
|
||||
* @(#) $Id: sha1.h,v 30.4 2014/09/02 06:37:39 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/sha1.h,v $
|
||||
*
|
||||
* This file is not covered under version 2.1 of the GNU LGPL.
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__SHA1_H__)
|
||||
#define __SHA1_H__
|
||||
#if !defined(INCLUDE_SHA1_H)
|
||||
#define INCLUDE_SHA1_H
|
||||
|
||||
|
||||
/* SHA1_CHUNKSIZE must be a power of 2 - fixed value defined by the algorithm */
|
||||
@@ -76,4 +76,4 @@ typedef struct {
|
||||
}
|
||||
|
||||
|
||||
#endif /* !__SHA1_H__ */
|
||||
#endif /* !INCLUDE_SHA1_H */
|
||||
|
12
str.h
12
str.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* str - string list routines
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
* Copyright (C) 1999-2007,2014 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: str.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: str.h,v 30.3 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/str.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:36
|
||||
@@ -28,8 +28,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__CALCSTRING_H__)
|
||||
#define __CALCSTRING_H__
|
||||
#if !defined(INCLUDE_CALCSTRING_H)
|
||||
#define INCLUDE_CALCSTRING_H
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
@@ -79,4 +79,4 @@ E_FUNC void showliterals(void);
|
||||
EXTERN STRING _nullstring_;
|
||||
|
||||
|
||||
#endif /* !__CALCSTRING_H__ */
|
||||
#endif /* !INCLUDE_CALCSTRING_H */
|
||||
|
12
symbol.h
12
symbol.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* symbol - global and local symbol routines
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
* Copyright (C) 1999-2007,2014 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.1 $
|
||||
* @(#) $Id: symbol.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: symbol.h,v 30.3 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/symbol.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:37
|
||||
@@ -28,8 +28,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__SYMBOL_H__)
|
||||
#define __SYMBOL_H__
|
||||
#if !defined(INCLUDE_SYMBOL_H)
|
||||
#define INCLUDE_SYMBOL_H
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
@@ -107,4 +107,4 @@ E_FUNC void showstatics(void);
|
||||
E_FUNC void freestatics(void);
|
||||
|
||||
|
||||
#endif /* !__SYMBOL_H__ */
|
||||
#endif /* !INCLUDE_SYMBOL_H */
|
||||
|
9
token.c
9
token.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* token - read input file characters into tokens
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell and Ernest Bowen
|
||||
* Copyright (C) 1999-2007,2017 David I. Bell and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,9 +19,9 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: token.c,v 30.2 2008/11/05 17:32:19 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/token.c,v $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: token.c,v 30.3 2017/05/19 16:09:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc-RHEL7/RCS/token.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:25
|
||||
* File existed as early as: before 1990
|
||||
@@ -100,6 +100,7 @@ STATIC struct keyword keywords[] = {
|
||||
{"read", T_READ},
|
||||
{"show", T_SHOW},
|
||||
{"help", T_HELP},
|
||||
{"man", T_HELP},
|
||||
{"write", T_WRITE},
|
||||
{"mat", T_MAT},
|
||||
{"obj", T_OBJ},
|
||||
|
12
token.h
12
token.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* token - token defines
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
* Copyright (C) 1999-2007,2014 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: token.h,v 30.3 2013/08/11 08:41:38 chongo Exp $
|
||||
* @(#) $Revision: 30.5 $
|
||||
* @(#) $Id: token.h,v 30.5 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/token.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:37
|
||||
@@ -28,8 +28,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__TOKEN_H__)
|
||||
#define __TOKEN_H__
|
||||
#if !defined(INCLUDE_TOKEN_H)
|
||||
#define INCLUDE_TOKEN_H
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
@@ -183,4 +183,4 @@ E_FUNC void scanerror(int, char *, ...) PRINTF_FORMAT(2, 3);
|
||||
E_FUNC void warning(char *, ...) PRINTF_FORMAT(1, 2);
|
||||
|
||||
|
||||
#endif /* !__TOKEN_H__ */
|
||||
#endif /* !INCLUDE_TOKEN_H */
|
||||
|
18
value.c
18
value.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* value - generic value manipulation routines
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
* Copyright (C) 1999-2007,2014,2017 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,9 +17,9 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.5 $
|
||||
* @(#) $Id: value.c,v 30.5 2013/08/11 08:41:38 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/value.c,v $
|
||||
* @(#) $Revision: 30.9 $
|
||||
* @(#) $Id: value.c,v 30.9 2017/05/19 16:09:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc-RHEL7/RCS/value.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:25
|
||||
* File existed as early as: before 1990
|
||||
@@ -2843,16 +2843,16 @@ printvalue(VALUE *vp, int flags)
|
||||
qfree(qtemp);
|
||||
break;
|
||||
case V_OPTR:
|
||||
math_fmt("o-ptr: %p", vp->v_octet);
|
||||
math_fmt("o-ptr: %p", (void *)vp->v_octet);
|
||||
break;
|
||||
case V_VPTR:
|
||||
math_fmt("v-ptr: %p", vp->v_addr);
|
||||
math_fmt("v-ptr: %p", (void *)vp->v_addr);
|
||||
break;
|
||||
case V_SPTR:
|
||||
math_fmt("s_ptr: %p", vp->v_str);
|
||||
math_fmt("s_ptr: %p", (void *)vp->v_str);
|
||||
break;
|
||||
case V_NPTR:
|
||||
math_fmt("n_ptr: %p", vp->v_num);
|
||||
math_fmt("n_ptr: %p", (void *)vp->v_num);
|
||||
break;
|
||||
case V_NBLOCK:
|
||||
if (!userfunc("nblk_print", vp))
|
||||
@@ -2948,7 +2948,7 @@ printestr(VALUE *vp)
|
||||
bp = vp->v_nblock->blk;
|
||||
}
|
||||
i = bp->datalen;
|
||||
math_fmt("%ld,%ld)", i, bp->blkchunk);
|
||||
math_fmt("%ld,%d)", i, bp->blkchunk);
|
||||
cp = bp->data;
|
||||
if (i > 0) {
|
||||
math_str("={");
|
||||
|
12
value.h
12
value.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* value - definitions of general values and related routines used by calc
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
* Copyright (C) 1999-2007,2014 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.6 $
|
||||
* @(#) $Id: value.h,v 30.6 2013/09/02 01:38:08 chongo Exp $
|
||||
* @(#) $Revision: 30.8 $
|
||||
* @(#) $Id: value.h,v 30.8 2014/08/24 21:56:51 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/value.h,v $
|
||||
*
|
||||
* Under source code control: 1993/07/30 19:42:47
|
||||
@@ -28,8 +28,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__VALUE_H__)
|
||||
#define __VALUE_H__
|
||||
#if !defined(INCLUDE_VALUE_H)
|
||||
#define INCLUDE_VALUE_H
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
@@ -540,4 +540,4 @@ E_FUNC int stringsetbit(STRING *, long, BOOL);
|
||||
E_FUNC int stringsearch(STRING *, STRING *, long, long, ZVALUE *);
|
||||
E_FUNC int stringrsearch(STRING *, STRING *, long, long, ZVALUE *);
|
||||
|
||||
#endif /* !__VALUE_H__ */
|
||||
#endif /* !INCLUDE_VALUE_H */
|
||||
|
40
version.c
40
version.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* version - determine the version of calc
|
||||
*
|
||||
* Copyright (C) 1999-2007 David I. Bell and Landon Curt Noll
|
||||
* Copyright (C) 1999-2017 David I. Bell and Landon Curt Noll
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,9 +19,9 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.22 $
|
||||
* @(#) $Id: version.c,v 30.22 2013/09/27 08:59:43 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc/RCS/version.c,v $
|
||||
* @(#) $Revision: 30.32 $
|
||||
* @(#) $Id: version.c,v 30.32 2017/05/19 16:09:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/bin/calc-RHEL7/RCS/version.c,v $
|
||||
*
|
||||
* Under source code control: 1990/05/22 11:00:58
|
||||
* File existed as early as: 1990
|
||||
@@ -48,8 +48,8 @@ static char *program;
|
||||
|
||||
#define MAJOR_VER 2 /* major library version */
|
||||
#define MINOR_VER 12 /* minor library version */
|
||||
#define MAJOR_PATCH 4 /* major software level under library version */
|
||||
#define MINOR_PATCH 13 /* minor software level or 0 if not patched */
|
||||
#define MAJOR_PATCH 5 /* major software level under library version */
|
||||
#define MINOR_PATCH 5 /* minor software level or 0 if not patched */
|
||||
|
||||
|
||||
/*
|
||||
@@ -73,19 +73,20 @@ STATIC char *stored_version = NULL; /* version formed if != NULL */
|
||||
char *Copyright = "\n"
|
||||
"calc - arbitrary precision calculator\n"
|
||||
"\n"
|
||||
"@(#) Copyright (C) 2007 David I. Bell, Landon Curt Noll and Ernest Bowen\n"
|
||||
"@(#) Copyright (C) 1999-2014 David I. Bell, Landon Curt Noll "
|
||||
"and Ernest Bowen\n"
|
||||
"\n"
|
||||
"Initial author: David I. Bell\n"
|
||||
"\n"
|
||||
"Calc is open software; you can redistribute it and/or modify it under\n"
|
||||
"the terms of the version 2.1 of the GNU Lesser General Public License\n"
|
||||
"as published by the Free Software Foundation.\n"
|
||||
"\n"
|
||||
"as published by the Free Software Foundation.\n";
|
||||
char *Usability = "\n"
|
||||
"Calc is distributed in the hope that it will be useful, but WITHOUT\n"
|
||||
"ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\n"
|
||||
"or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General\n"
|
||||
"Public License for more details.\n"
|
||||
"\n"
|
||||
"Public License for more details.\n";
|
||||
char *COPYING_LGPL = "\n"
|
||||
"A copy of version 2.1 of the GNU Lesser General Public License is\n"
|
||||
"distributed with calc under the filename COPYING-LGPL. You should have\n"
|
||||
"received a copy with calc; if not, write to Free Software Foundation, Inc.\n"
|
||||
@@ -108,6 +109,7 @@ char *
|
||||
version(void)
|
||||
{
|
||||
char verbuf[BUFSIZ+1]; /* form version string here */
|
||||
size_t len; /* length of version string */
|
||||
|
||||
/*
|
||||
* return previously stored version if one exists
|
||||
@@ -126,12 +128,14 @@ version(void)
|
||||
/*
|
||||
* save the versions string into a newly malloced buffer
|
||||
*/
|
||||
stored_version = (char *)malloc(strlen(verbuf)+1);
|
||||
len = strlen(verbuf);
|
||||
stored_version = (char *)malloc(len+1);
|
||||
if (stored_version == NULL) {
|
||||
fprintf(stderr, "%s: cannot malloc version string\n", program);
|
||||
exit(70);
|
||||
}
|
||||
strcpy(stored_version, verbuf);
|
||||
strncpy(stored_version, verbuf, BUFSIZ);
|
||||
stored_version[len] = '\0'; /* paranoia */
|
||||
|
||||
/*
|
||||
* return the newly malloced buffer
|
||||
@@ -149,7 +153,6 @@ version(void)
|
||||
* This function prints a version string, rpm style:
|
||||
*
|
||||
* x.y.z.w-r
|
||||
* x.y.z-r
|
||||
*
|
||||
* where 'r' comes from the content of the release file.
|
||||
*/
|
||||
@@ -183,13 +186,8 @@ print_rpm_version(char *release)
|
||||
/*
|
||||
* form the version buffer
|
||||
*/
|
||||
if (MINOR_PATCH > 0) {
|
||||
printf("%d.%d.%d.%d-%s\n", calc_major_ver, calc_minor_ver,
|
||||
calc_major_patch, calc_minor_patch, buf);
|
||||
} else {
|
||||
printf("%d.%d.%d-%s\n", calc_major_ver, calc_minor_ver,
|
||||
calc_major_patch, buf);
|
||||
}
|
||||
printf("%d.%d.%d.%d-%s\n", calc_major_ver, calc_minor_ver,
|
||||
calc_major_patch, calc_minor_patch, buf);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -3,8 +3,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_CONST_H__)
|
||||
#define __HAVE_CONST_H__
|
||||
#if !defined(CALC_HAVE_CONST_H)
|
||||
#define CALC_HAVE_CONST_H
|
||||
|
||||
|
||||
/* do we have or want const? */
|
||||
@@ -13,4 +13,4 @@
|
||||
#define CONST const /* yes */
|
||||
|
||||
|
||||
#endif /* !__HAVE_CONST_H__ */
|
||||
#endif /* !CALC_HAVE_CONST_H */
|
||||
|
@@ -3,8 +3,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_FPOS_H__)
|
||||
#define __HAVE_FPOS_H__
|
||||
#if !defined(CALC_HAVE_FPOS_H)
|
||||
#define CALC_HAVE_FPOS_H
|
||||
|
||||
|
||||
/* do we have fgetpos & fsetpos functions? */
|
||||
@@ -13,4 +13,4 @@
|
||||
typedef long FILEPOS;
|
||||
|
||||
|
||||
#endif /* !__HAVE_FPOS_H__ */
|
||||
#endif /* !CALC_HAVE_FPOS_H */
|
||||
|
@@ -3,8 +3,8 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_FPOS_POS_H__)
|
||||
#define __HAVE_FPOS_POS_H__
|
||||
#if !defined(CALC_HAVE_FPOS_POS_H)
|
||||
#define CALC_HAVE_FPOS_POS_H
|
||||
|
||||
|
||||
/* do we have fgetpos & fsetpos functions? */
|
||||
@@ -13,4 +13,4 @@
|
||||
#undef FPOS_POS_LEN
|
||||
|
||||
|
||||
#endif /* !__HAVE_FPOS_POS_H__ */
|
||||
#endif /* !CALC_HAVE_FPOS_POS_H */
|
||||
|
@@ -3,12 +3,12 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_GETPGID_H__)
|
||||
#define __HAVE_GETPGID_H__
|
||||
#if !defined(CALC_HAVE_GETPGID_H)
|
||||
#define CALC_HAVE_GETPGID_H
|
||||
|
||||
|
||||
/* do we have or want getpgid()? */
|
||||
#undef HAVE_GETPGID /* no */
|
||||
|
||||
|
||||
#endif /* !__HAVE_GETPGID_H__ */
|
||||
#endif /* !CALC_HAVE_GETPGID_H */
|
||||
|
@@ -3,12 +3,12 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_GETPRID_H__)
|
||||
#define __HAVE_GETPRID_H__
|
||||
#if !defined(CALC_HAVE_GETPRID_H)
|
||||
#define CALC_HAVE_GETPRID_H
|
||||
|
||||
|
||||
/* do we have or want getprid()? */
|
||||
#undef HAVE_GETPRID /* no */
|
||||
|
||||
|
||||
#endif /* !__HAVE_GETPRID_H__ */
|
||||
#endif /* !CALC_HAVE_GETPRID_H */
|
||||
|
@@ -3,12 +3,12 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_GETSID_H__)
|
||||
#define __HAVE_GETSID_H__
|
||||
#if !defined(CALC_HAVE_GETSID_H)
|
||||
#define CALC_HAVE_GETSID_H
|
||||
|
||||
|
||||
/* do we have or want getsid()? */
|
||||
#undef HAVE_GETSID /* no */
|
||||
|
||||
|
||||
#endif /* !__HAVE_GETSID_H__ */
|
||||
#endif /* !CALC_HAVE_GETSID_H */
|
||||
|
@@ -3,12 +3,12 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_GETTIME_H__)
|
||||
#define __HAVE_GETTIME_H__
|
||||
#if !defined(CALC_HAVE_GETTIME_H)
|
||||
#define CALC_HAVE_GETTIME_H
|
||||
|
||||
|
||||
/* do we have or want clock_gettime()? */
|
||||
#undef HAVE_GETTIME /* no */
|
||||
|
||||
|
||||
#endif /* !__HAVE_GETTIME_H__ */
|
||||
#endif /* !CALC_HAVE_GETTIME_H */
|
||||
|
@@ -3,12 +3,12 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_MEMMV_H__)
|
||||
#define __HAVE_MEMMV_H__
|
||||
#if !defined(CALC_HAVE_MEMMV_H)
|
||||
#define CALC_HAVE_MEMMV_H
|
||||
|
||||
|
||||
/* do we have or want memmove()? */
|
||||
#define HAVE_MEMMOVE /* yes */
|
||||
|
||||
|
||||
#endif /* !__HAVE_MEMMV_H__ */
|
||||
#endif /* !CALC_HAVE_MEMMV_H */
|
||||
|
@@ -3,12 +3,12 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_NEWSTR_H__)
|
||||
#define __HAVE_NEWSTR_H__
|
||||
#if !defined(CALC_HAVE_NEWSTR_H)
|
||||
#define CALC_HAVE_NEWSTR_H
|
||||
|
||||
|
||||
/* do we have or want memcpy(), memset() & strchr()? */
|
||||
#define HAVE_NEWSTR /* yes */
|
||||
|
||||
|
||||
#endif /* !__HAVE_NEWSTR_H__ */
|
||||
#endif /* !CALC_HAVE_NEWSTR_H */
|
||||
|
@@ -3,12 +3,12 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_OFFSCL_H__)
|
||||
#define __HAVE_OFFSCL_H__
|
||||
#if !defined(CALC_HAVE_OFFSCL_H)
|
||||
#define CALC_HAVE_OFFSCL_H
|
||||
|
||||
|
||||
#undef HAVE_OFF_T_SCALAR
|
||||
#define HAVE_OFF_T_SCALAR /* off_t is a simple value */
|
||||
|
||||
|
||||
#endif /* !__HAVE_OFFSCL_H__ */
|
||||
#endif /* !CALC_HAVE_OFFSCL_H */
|
||||
|
@@ -3,12 +3,12 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_POSSCL_H__)
|
||||
#define __HAVE_POSSCL_H__
|
||||
#if !defined(CALC_HAVE_POSSCL_H)
|
||||
#define CALC_HAVE_POSSCL_H
|
||||
|
||||
|
||||
#undef HAVE_FILEPOS_SCALAR
|
||||
#define HAVE_FILEPOS_SCALAR /* FILEPOS is a simple value */
|
||||
|
||||
|
||||
#endif /* !__HAVE_POSSCL_H__ */
|
||||
#endif /* !CALC_HAVE_POSSCL_H */
|
||||
|
@@ -3,12 +3,12 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_RUSAGE_H__)
|
||||
#define __HAVE_RUSAGE_H__
|
||||
#if !defined(CALC_HAVE_RUSAGE_H)
|
||||
#define CALC_HAVE_RUSAGE_H
|
||||
|
||||
|
||||
/* do we have or want getrusage()? */
|
||||
#undef HAVE_GETRUSAGE /* no */
|
||||
|
||||
|
||||
#endif /* !__HAVE_RUSAGE_H__ */
|
||||
#endif /* !CALC_HAVE_RUSAGE_H */
|
||||
|
@@ -3,12 +3,12 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_STDLIB_H__)
|
||||
#define __HAVE_STDLIB_H__
|
||||
#if !defined(CALC_HAVE_STDLIB_H)
|
||||
#define CALC_HAVE_STDLIB_H
|
||||
|
||||
|
||||
/* do we have <stdlib.h>? */
|
||||
#define HAVE_STDLIB_H /* yes */
|
||||
|
||||
|
||||
#endif /* !__HAVE_STDLIB_H__ */
|
||||
#endif /* !CALC_HAVE_STDLIB_H */
|
||||
|
@@ -3,12 +3,12 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_STRDUP_H__)
|
||||
#define __HAVE_STRDUP_H__
|
||||
#if !defined(CALC_HAVE_STRDUP_H)
|
||||
#define CALC_HAVE_STRDUP_H
|
||||
|
||||
|
||||
/* do we have or want getstrdup()? */
|
||||
#define HAVE_STRDUP /* yes */
|
||||
|
||||
|
||||
#endif /* !__HAVE_STRDUP_H__ */
|
||||
#endif /* !CALC_HAVE_STRDUP_H */
|
||||
|
@@ -3,12 +3,12 @@
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_STRING_H__)
|
||||
#define __HAVE_STRING_H__
|
||||
#if !defined(CALC_HAVE_STRING_H)
|
||||
#define CALC_HAVE_STRING_H
|
||||
|
||||
|
||||
/* do we have <string.h>? */
|
||||
#define HAVE_STRING_H /* yes */
|
||||
|
||||
|
||||
#endif /* !__HAVE_STRING_H__ */
|
||||
#endif /* !CALC_HAVE_STRING_H */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user