mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
Compare commits
59 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
0aca07d278 | ||
|
1ab3b2c313 | ||
|
64e2c6a262 | ||
|
eac02835ed | ||
|
33657bb2cc | ||
|
8af0b351ae | ||
|
3260f90a73 | ||
|
b7e15195f9 | ||
|
c02725f036 | ||
|
507fe026e5 | ||
|
486f4c5626 | ||
|
91991bb729 | ||
|
71a116ca6f | ||
|
8b7e01f426 | ||
|
229345ade8 | ||
|
0f902b95cf | ||
|
8684e1be9c | ||
|
ae3a6129b2 | ||
|
2c72570b8d | ||
|
41803b878e | ||
|
a8be58becb | ||
|
067afc140a | ||
|
41128fada9 | ||
|
f5fae012f9 | ||
|
3d25fb30cb | ||
|
8374586275 | ||
|
68c2edf610 | ||
|
d58a55a1ed | ||
|
ccfa797b68 | ||
|
0f030f0759 | ||
|
af59b9dab2 | ||
|
fa173cd9aa | ||
|
1f8269c0e2 | ||
|
51462b8612 | ||
|
9b69648921 | ||
|
c5e416c41f | ||
|
37ad43c7fd | ||
|
a877cb52c0 | ||
|
4bec694df3 | ||
|
4870a7a164 | ||
|
84ccb37bc3 | ||
|
29c6e9325f | ||
|
81a4a4f828 | ||
|
1cdb5172d8 | ||
|
54a7a3f7bc | ||
|
2ea77e6151 | ||
|
5cfa6199e5 | ||
|
da6ccc146f | ||
|
fcfe237375 | ||
|
5fb3db4558 | ||
|
c8705c1198 | ||
|
0558bafcb6 | ||
|
f58277f53d | ||
|
e555a718c0 | ||
|
b29fcf2dd5 | ||
|
4f86703843 | ||
|
07d8bf0f3e | ||
|
b4cd692bae | ||
|
83c898cc2b |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -65,6 +65,7 @@ help/bugs
|
|||||||
help/builtin
|
help/builtin
|
||||||
help/change
|
help/change
|
||||||
help/changes
|
help/changes
|
||||||
|
help/contrib
|
||||||
help/copy
|
help/copy
|
||||||
help/cscript
|
help/cscript
|
||||||
help/custom_cal
|
help/custom_cal
|
||||||
@@ -76,6 +77,8 @@ help/funclist.c
|
|||||||
help/libcalc
|
help/libcalc
|
||||||
help/man
|
help/man
|
||||||
help/new_custom
|
help/new_custom
|
||||||
|
help/question
|
||||||
|
help/questions
|
||||||
help/resource
|
help/resource
|
||||||
help/type
|
help/type
|
||||||
help/usage
|
help/usage
|
||||||
|
202
BUGS
202
BUGS
@@ -1,12 +1,12 @@
|
|||||||
If you notice something wrong, strange or broken, try rereading:
|
If you notice something wrong, strange or broken, try rereading:
|
||||||
|
|
||||||
README.FIRST
|
README.FIRST
|
||||||
HOWTO.INSTALL
|
HOWTO.INSTALL
|
||||||
BUGS (this file)
|
BUGS (this file)
|
||||||
|
|
||||||
If that does not help, cd to the calc source directory and try:
|
If that does not help, cd to the calc source directory and try:
|
||||||
|
|
||||||
make check
|
make check
|
||||||
|
|
||||||
Look at the end of the output, it should say something like:
|
Look at the end of the output, it should say something like:
|
||||||
|
|
||||||
@@ -15,74 +15,163 @@ Look at the end of the output, it should say something like:
|
|||||||
|
|
||||||
If it does not, then something is really broken!
|
If it does not, then something is really broken!
|
||||||
|
|
||||||
|
To be sure that your version of calc is up to date, check out:
|
||||||
|
|
||||||
|
http://www.isthe.com/chongo/tech/comp/calc/calc-mirror.html
|
||||||
|
|
||||||
If you made and modifications to calc beyond the simple Makefile
|
If you made and modifications to calc beyond the simple Makefile
|
||||||
configuration, try backing them out and see if things get better.
|
configuration, try backing them out and see if things get better.
|
||||||
|
|
||||||
To be sure that your version of calc is up to date, check out:
|
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.
|
||||||
http://www.isthe.com/chongo/tech/comp/calc/calc-download.html
|
|
||||||
|
|
||||||
The calc web site is located at:
|
|
||||||
|
|
||||||
http://www.isthe.com/chongo/tech/comp/calc/index.html
|
|
||||||
|
|
||||||
=-=
|
=-=
|
||||||
|
|
||||||
If you have tried all of the above and things still are not right,
|
The BEST WAY TO SEND IN A BUG REPORT is via calc GitHub issue URL:
|
||||||
then it may be time to send in a bug report. You can send bug
|
|
||||||
and bug fixes reports to:
|
|
||||||
|
|
||||||
calc-bug-report at asthe dot com
|
https://github.com/lcn2/calc/issues
|
||||||
|
|
||||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
If you see an existing issue that matches your problem, look
|
||||||
|
over the notes and if needed, add your own observation,
|
||||||
|
even if you just add to an existing issue:
|
||||||
|
|
||||||
This replaces the old calc-bugs at asthe dot com address.
|
I have this issue too
|
||||||
|
|
||||||
To be sure we see your EMail reporting a calc bug, please use the
|
If you don't see your issue addressed, then on the above
|
||||||
following phase in your EMail Subject line:
|
GitHub web page, click on this button:
|
||||||
|
|
||||||
calc bug report
|
((New Issue))
|
||||||
|
|
||||||
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
|
If you prefer to not use GitHub, then you
|
||||||
to the calc-tester mailing list (see below) and then to
|
may send bug and bug fixes reports 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:
|
calc-bugrept-mail at asthe dot com
|
||||||
|
|
||||||
* a description of the problem
|
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||||
* the version of calc you are using (if you cannot get calc
|
|
||||||
to run, then send us the 4 #define lines from version.c)
|
|
||||||
* if you modified calc from an official patch, send me the mods you made
|
|
||||||
* the type of system you were using
|
|
||||||
* the type of compiler you were using
|
|
||||||
* any compiler warnings or errors that you saw
|
|
||||||
* cd to the calc source directory, and type:
|
|
||||||
|
|
||||||
make debug > debug.out 2>&1 (sh, ksh, bash users)
|
NOTE: This replaces the old calc-bugs at asthe dot com address.
|
||||||
make debug >& debug.out (csh, tcsh users)
|
|
||||||
|
|
||||||
and send the contents of the 'debug.out' file.
|
PLEASE put following the SPECIAL PHRASE somewhere in your Email Subject line:
|
||||||
|
|
||||||
Stack traces from core dumps are useful to send as well.
|
calc bug report
|
||||||
|
|
||||||
Fell free to use the above address to send in big fixes (in the form
|
You may add additional words to your subject line.
|
||||||
|
|
||||||
|
Suggestion:
|
||||||
|
|
||||||
|
From time to time, the Email address and Subject SPECIAL PHRASE
|
||||||
|
may change so verify you have the current info by visiting:
|
||||||
|
|
||||||
|
http://www.isthe.com/chongo/tech/comp/calc/calc-bugrept.html
|
||||||
|
|
||||||
|
IMPORTANT:
|
||||||
|
|
||||||
|
PLEASE use the above SPECIAL PHRASE somewhere in the Subject line or
|
||||||
|
the mail system won't deliver your Email message.
|
||||||
|
|
||||||
|
Keep in mind that the best way to report on a calc bug is
|
||||||
|
via the above mentioned calc GitHub issue URL.
|
||||||
|
|
||||||
|
Please be patient as we cannot always respond to Email messages quickly.
|
||||||
|
|
||||||
|
=-=
|
||||||
|
|
||||||
|
When you send your report, via the calc GitHub issue URL or Email,
|
||||||
|
please include the following information:
|
||||||
|
|
||||||
|
* A description of the problem
|
||||||
|
|
||||||
|
* Version of calc you are using
|
||||||
|
|
||||||
|
If you cannot compile calc, then look at version.c
|
||||||
|
and report the #define that start with:
|
||||||
|
|
||||||
|
#define MAJOR_VER
|
||||||
|
#define MINOR_VER
|
||||||
|
#define MAJOR_PATCH
|
||||||
|
#define MINOR_PATCH
|
||||||
|
|
||||||
|
* If you modified calc from an official patch,
|
||||||
|
send us the mods you made
|
||||||
|
|
||||||
|
* Type and version of the operating system
|
||||||
|
|
||||||
|
* Type and version of compiler
|
||||||
|
|
||||||
|
* Send us all compiler warnings or errors you find
|
||||||
|
|
||||||
|
* If calc dumped core, try to send us a core dump stack trace
|
||||||
|
|
||||||
|
* cd to the calc source directory, and send the contents
|
||||||
|
of debug.out produced by this command:
|
||||||
|
|
||||||
|
make debug > debug.out 2>&1
|
||||||
|
|
||||||
|
Fell free to use the above address to send in bug fixes (in the form
|
||||||
of a context diff patch).
|
of a context diff patch).
|
||||||
|
|
||||||
=-=
|
=-=
|
||||||
|
|
||||||
Known bugs:
|
Known bugs in calc:
|
||||||
|
|
||||||
|
Under macOS, the installation of the calc man page fails.
|
||||||
|
|
||||||
The output of the alg_config.cal resource file is bogus.
|
The output of the alg_config.cal resource file is bogus.
|
||||||
We would welcome a replacement for this code.
|
We would welcome a replacement for this code.
|
||||||
|
|
||||||
|
Calc shell scripts do not read from stdin properly,
|
||||||
|
we all as a number of the cscript examples.
|
||||||
|
|
||||||
|
The argv() function is behaving differently
|
||||||
|
when run in calc shell script mode:
|
||||||
|
|
||||||
|
When calc is run as:
|
||||||
|
|
||||||
|
calc -s a bb ccc
|
||||||
|
|
||||||
|
and given this input on the command prompt:
|
||||||
|
|
||||||
|
print "config(\"program\")=", config("program");
|
||||||
|
print "argv()=", argv();
|
||||||
|
argc = argv();
|
||||||
|
for (i=0; i < argc; ++i) {
|
||||||
|
print "argv(":i:")=", argv(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
calc prints:
|
||||||
|
|
||||||
|
config("program")= calc
|
||||||
|
argv()= 3
|
||||||
|
argv(0)= a
|
||||||
|
argv(1)= bb
|
||||||
|
argv(2)= ccc
|
||||||
|
|
||||||
|
but when it is run as a script called ./simple:
|
||||||
|
|
||||||
|
#!/usr/local/bin/calc -q -s -f
|
||||||
|
print "config(\"program\")=", config("program");
|
||||||
|
print "argv()=", argv();
|
||||||
|
argc = argv();
|
||||||
|
for (i=0; i < argc; ++i) {
|
||||||
|
print "argv(":i:")=", argv(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
under Linux prints:
|
||||||
|
|
||||||
|
config("program")= /usr/bin/calc
|
||||||
|
argv()= 4
|
||||||
|
argv(0)= ./simple
|
||||||
|
argv(1)= a
|
||||||
|
argv(2)= bb
|
||||||
|
argv(3)= ccc
|
||||||
|
|
||||||
|
and under macOS simply enters into interactive mode.
|
||||||
|
|
||||||
We are sure some more bugs exist. When you find them, please let
|
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
|
us know! See the above for details on how to report and were to
|
||||||
EMail your bug reports and hopefully patches to fix them.
|
Email your bug reports and hopefully patches to fix them.
|
||||||
|
|
||||||
=-=
|
=-=
|
||||||
|
|
||||||
@@ -135,32 +224,7 @@ mis-features in calc:
|
|||||||
|
|
||||||
=-=
|
=-=
|
||||||
|
|
||||||
To subscribe to the calc-tester mailing list, visit the following URL:
|
## Copyright (C) 1999-2014,2021 Landon Curt Noll
|
||||||
|
|
||||||
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
|
## Calc is open software; you can redistribute it and/or modify it under
|
||||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
304
CHANGES
304
CHANGES
@@ -1,7 +1,274 @@
|
|||||||
The following are the changes from calc version 2.12.6.5 to date:
|
The following are the changes from calc version 2.12.8.1 to date:
|
||||||
|
|
||||||
|
Fixed how the *.tar.bz2 are formed. The calc-2.12.8.0.tar.bz2 file
|
||||||
|
that was formed for calc version 2.12.8.0 was missing most files.
|
||||||
|
|
||||||
|
Expanded 'make chk' to also verify that 'make distchk' and 'make
|
||||||
|
distlist' execute successfully. This will help check a regression
|
||||||
|
of the bug that produced the bogus calc-2.12.8.0.tar.bz2 file.
|
||||||
|
|
||||||
|
Added additional regression tests related 0^(zero_expression)==1.
|
||||||
|
|
||||||
|
Calc can now correctly compile without CUSTOM being defined,
|
||||||
|
thanks to a report by <GitHub user barsnick>.
|
||||||
|
|
||||||
|
|
||||||
|
The following are the changes from calc version 2.12.7.5 to 2.12.8.0:
|
||||||
|
|
||||||
|
Fixed a mistake in "help intro" where some inserted text changed
|
||||||
|
the value of "." and thus made the next result incorrect.
|
||||||
|
|
||||||
|
Clarified in "help factor" that 1 is returned if no
|
||||||
|
factor below the limit was found.
|
||||||
|
|
||||||
|
Removed Makefile variable ${MAKEFILE_REV}.
|
||||||
|
|
||||||
|
The missing cscript/square.calc file has been restored.
|
||||||
|
|
||||||
|
Fixed compiler errors and warnings related to GCC. In particular,
|
||||||
|
gcc/9.3.1 and gcc/10.2.1 now compile calc without any compiler
|
||||||
|
errors or warnings, even with -Werror -Wextra -pedantic.
|
||||||
|
|
||||||
|
To print out information about the calc compilation
|
||||||
|
environment, we added the following make rule:
|
||||||
|
|
||||||
|
make calcinfo
|
||||||
|
|
||||||
|
Improved how 'make debug' operates.
|
||||||
|
|
||||||
|
Moved help/contrib to CONTRIB-CODE. The help/contrib file
|
||||||
|
is now build from a copy of CONTRIB-CODE.
|
||||||
|
|
||||||
|
Created a new calc bug report Email address. Created a new
|
||||||
|
calc question Email address. Created a new calc contribution
|
||||||
|
Email address. See the BUGS file for details.
|
||||||
|
|
||||||
|
Added "help questions" to print the QUESTIONS help file.
|
||||||
|
|
||||||
|
If the environment variable $CALCHELP is defined and is non-empty,
|
||||||
|
then calc help files will be in the directory by the $CALCHISTFILE
|
||||||
|
environment variable.
|
||||||
|
|
||||||
|
If the environment variable $CALCCUSTOMHELP is defined and is
|
||||||
|
non-empty, then custom calc help files will be in the directory
|
||||||
|
by the $CALCCUSTOMHELP environment variable.
|
||||||
|
|
||||||
|
Fixed a number of typos in text and in source code comments.
|
||||||
|
|
||||||
|
The calc-tester mailing list has been retired. See:
|
||||||
|
|
||||||
|
* How to submit a calc bug report:
|
||||||
|
|
||||||
|
http://www.isthe.com/chongo/tech/comp/calc/calc-bugrept.html
|
||||||
|
|
||||||
|
* How to contribute code to calc:
|
||||||
|
|
||||||
|
http://www.isthe.com/chongo/tech/comp/calc/calc-contrib.html
|
||||||
|
|
||||||
|
* How to submit a question about calc:
|
||||||
|
|
||||||
|
http://www.isthe.com/chongo/tech/comp/calc/calc-question.html
|
||||||
|
|
||||||
|
|
||||||
|
The following are the changes from calc version 2.12.7.1 to 2.12.7.5:
|
||||||
|
|
||||||
|
Corrected CHANGES notes that were mixed up for TAB, VT, CR &
|
||||||
|
NL. The code in 2.12.7.0 is correct. The CHANGE notes should
|
||||||
|
have read:
|
||||||
|
|
||||||
|
The following is a partial list of escape sequences recognized
|
||||||
|
in strings and in printf formats:
|
||||||
|
|
||||||
|
\a audible bell byte 0x07 in ASCII encoding
|
||||||
|
\b backspace byte 0x08 in ASCII encoding
|
||||||
|
\f form feed byte 0x0c in ASCII encoding
|
||||||
|
\n newline byte 0x0a in ASCII encoding
|
||||||
|
\r return byte 0x0d in ASCII encoding
|
||||||
|
\t tab byte 0x09 in ASCII encoding
|
||||||
|
\v vertical tab byte 0x0b in ASCII encoding
|
||||||
|
|
||||||
|
Fixed a segfault when getpwuid() returned NULL during initialization.
|
||||||
|
Thanks goes to baratharon GitHub user for reporting this issue.
|
||||||
|
|
||||||
|
Requiring calc shell scripts to use -s -f at the end of the
|
||||||
|
initial #! line.
|
||||||
|
|
||||||
|
Fixed /tmp/mersenne example in calc(1) man page.
|
||||||
|
|
||||||
|
Added make variable ${ARCH_CFLAGS}. The ${ARCH_CFLAGS} is
|
||||||
|
added after ${CCMISC} and before ${EXTRA_CFLAGS} when building
|
||||||
|
the ${CFLAGS} for compiling C code. are ${CC} when compiling
|
||||||
|
C files. The default value is:
|
||||||
|
|
||||||
|
ARCH_CFLAGS= -march=native
|
||||||
|
|
||||||
|
which directs C compiler to compile for the native machine.
|
||||||
|
To disable use of '-march=native', set ARCH_CFLAGS to the empty
|
||||||
|
string as in:
|
||||||
|
|
||||||
|
make all ARCH_CFLAGS=
|
||||||
|
|
||||||
|
To make calc RPMs more portable, they are compiled with an
|
||||||
|
empty ARCH_CFLAGS.
|
||||||
|
|
||||||
|
Fixed issues relating to compiling on macOS. Fixed issues
|
||||||
|
where <unistd.h> is needed.
|
||||||
|
|
||||||
|
Fixed typos in help/intro and README.md. <<GitHub guilhermgonzaga>>
|
||||||
|
|
||||||
|
Copied missing description lines from help/intro to README.md
|
||||||
|
"What is calc?" section. <<GitHub guilhermgonzaga>>
|
||||||
|
|
||||||
|
GCC 7 added a warning on fall through in case statements. It's
|
||||||
|
enabled by -Wextra and treated as an error due to -Wall so it
|
||||||
|
breaks compilation. See -Wimplicit-fallthrough in the GCC
|
||||||
|
manual. The default value is 3, which means a comment matching
|
||||||
|
some specific regexes is enough to disable the warning.
|
||||||
|
Fixed spaces vs tabs and use FALLTHRU as it's used elsewhere.
|
||||||
|
Fixed one FALLTHRU comment that was inconsistent with others.
|
||||||
|
<<GitHub jcul>>
|
||||||
|
|
||||||
|
Fixed minor typo on help/power. <<GitHub thegithubr>>
|
||||||
|
|
||||||
|
By default, the calc history file is located in ~/.calc_history.
|
||||||
|
Now, if the environment variable $CALCHISTFILE is defined
|
||||||
|
and is non-empty, then calc history file will be defined
|
||||||
|
by the $CALCHISTFILE environment variable.
|
||||||
|
|
||||||
|
Calc as defined 0^0 as 1. However in the past, 0 raised to
|
||||||
|
an expression that evaluated to zero returned 1. The result
|
||||||
|
was that 0^0 was different than 0^(6-6) or even 0^(0).
|
||||||
|
Now, calc will return 1 for 0^(0) and 0^zero when zero == 0.
|
||||||
|
|
||||||
|
The missing cscript/square.calc file has been restored.
|
||||||
|
|
||||||
|
|
||||||
|
The following are the changes from calc version 2.12.6.10: to 2.12.7.0:
|
||||||
|
|
||||||
|
Added a patch to replaces the manual search for include files
|
||||||
|
in $(INCDIR) in the have_*.h targets with compiler invocations.
|
||||||
|
Thanks goes to Helmut Grohne (helmut at subdivi dot de) who
|
||||||
|
implemented the patch and posted it to the Debian bug tracker
|
||||||
|
and Martin Buck (m at rtin-buck dor de) for forwarding it to us.
|
||||||
|
|
||||||
|
The check_include make rule was fixed to not assume /usr/include.
|
||||||
|
|
||||||
|
The qprintnum() function now takes outdigits as a 3rd argument.
|
||||||
|
Most of the time, this 3rd argument is just conf->outdigits.
|
||||||
|
But when it comes to the experimental '%g', this value can
|
||||||
|
change. This avoids having to modify conf->outdigits.
|
||||||
|
|
||||||
|
Fixed a problem where gcc complains about E_FUNC not being defined
|
||||||
|
for Linux systems as reported by Martin Buck (m at rtin-buck dor de).
|
||||||
|
|
||||||
|
Updated the help files help/config, help/display, help/epsilon,
|
||||||
|
help/fprint, help/printf, and help/strprintf to give more
|
||||||
|
examples of how display digits and epsilon precision interact
|
||||||
|
with displaying values.
|
||||||
|
|
||||||
|
Added more information about %g in the help file help/printf.
|
||||||
|
|
||||||
|
The '\a' is now recognized in a printf format string as the
|
||||||
|
single byte audible bell character (byte 0x07 in ASCII encoding).
|
||||||
|
|
||||||
|
The following is a partial list of escape sequences recognized
|
||||||
|
in strings and in printf formats:
|
||||||
|
|
||||||
|
\a audible bell byte 0x07 in ASCII encoding
|
||||||
|
\b backspace byte 0x08 in ASCII encoding
|
||||||
|
\f form feed byte 0x0c in ASCII encoding
|
||||||
|
\n newline byte 0x0a in ASCII encoding
|
||||||
|
\r return byte 0x0d in ASCII encoding
|
||||||
|
\t tab byte 0x09 in ASCII encoding
|
||||||
|
\v vertical tab byte 0x0b in ASCII encoding
|
||||||
|
|
||||||
|
|
||||||
|
The following are the changes from calc version 2.12.6.9 to 2.12.6.9:
|
||||||
|
|
||||||
|
Fixed a number of core dump bugs related to the calculation of
|
||||||
|
tan(), cot(), sec(), csc(), tanh(), coth(), sech(), and csch(),
|
||||||
|
asin(), acos(), asinh(), acosh(), where when a call to an
|
||||||
|
underlying function produced an invalid value. Thanks goes to
|
||||||
|
github user wuxiuheng for reporting this problem.
|
||||||
|
|
||||||
|
A number of trigonometric and hyperbolic functions that incorrectly
|
||||||
|
returned E_LOGINF, now return a new error code that is more
|
||||||
|
specific to the trigonometric or hyperbolic function. The
|
||||||
|
following is a list of these new error codes: E_TAN3 E_TAN4
|
||||||
|
E_COT3 E_COT4 E_SEC3 E_CSC3 E_TANH3 E_TANH4 E_COTH3 E_COTH4
|
||||||
|
E_SECH3 E_CSCH3 E_ASIN3 E_ACOS3 E_ASINH3 E_ACOSH3 E_ATAN3 E_ACOT3
|
||||||
|
E_ASEC3 E_ACSC3 E_ATANH3 E_ACOTH3 E_ASECH3 E_ACSCH3.
|
||||||
|
|
||||||
|
Added regression tests 3729 thru 3732 to test E_TAN3, E_COT3,
|
||||||
|
E_SEC3 and E_CSC3 respectively.
|
||||||
|
|
||||||
|
Added experimental %g printf (and strprintf) format implementation
|
||||||
|
based on pull request from github user 10110111.
|
||||||
|
|
||||||
|
Made experimental changes to macOS builds to not require use of
|
||||||
|
/usr/include. The INCDIR for macOS uses:
|
||||||
|
|
||||||
|
INCDIR= $(shell xcrun --show-sdk-path --sdk macosx)/usr/include
|
||||||
|
|
||||||
|
to determine the upper path of the /usr/include directory for macOS.
|
||||||
|
In some rare cases, the Darwin target seems to not automatically detected.
|
||||||
|
If you are running under macOS, and that happens, you can force
|
||||||
|
the target to be Darwin:
|
||||||
|
|
||||||
|
# for macOS users only, force the target to be darwin
|
||||||
|
#
|
||||||
|
make target=Darwin clobber
|
||||||
|
make target=Darwin all
|
||||||
|
make target=Darwin chk
|
||||||
|
make target=Darwin install
|
||||||
|
|
||||||
|
|
||||||
|
The following are the changes from calc version 2.12.6.6 to 2.12.6.8:
|
||||||
|
|
||||||
|
For historical purposes, in lucas.cal, gen_v1(1, n) always returns 4.
|
||||||
|
|
||||||
|
Fixed some compiler warnings, thanks to a report by Mike
|
||||||
|
<michael dot d dot ince at gmail dot com>.
|
||||||
|
|
||||||
|
Added work around for a gcc warning bug, thanks to a report by Mike
|
||||||
|
<michael dot d dot ince at gmail dot com>.
|
||||||
|
|
||||||
|
Fixed errors in various help files such as:
|
||||||
|
|
||||||
|
mat randbit seed srandom types
|
||||||
|
|
||||||
|
Removed the MAXSTRING symbol because it was no longer used by calc.
|
||||||
|
|
||||||
|
Increased HIST_SIZE (depth of the history stack) from 10k to 32k.
|
||||||
|
|
||||||
|
Increased TTYSIZE (reallocation size for terminal buffers) from 100 to 8191.
|
||||||
|
|
||||||
|
Increased MAXDEPTH (maximum depth of input stack) from 10 to 255.
|
||||||
|
|
||||||
|
Increased interactive input buffer size from 1024 to 256k. This has the
|
||||||
|
effect of increasing the maximum length of an input line from a tty.
|
||||||
|
This helps with an interactive bug that was reported by Ruslan Kabatsayev
|
||||||
|
(b7 dot 10110111 at gmail dot com).
|
||||||
|
|
||||||
|
The calc man page indicates that -d also disables the printing of the
|
||||||
|
leading tilde.
|
||||||
|
|
||||||
|
Added information to "help command" about how to silence messages
|
||||||
|
while reading calc resource files.
|
||||||
|
|
||||||
|
Fixed an error message buffer overflow thanks to a report by
|
||||||
|
Frank Peters <nlp at northernlightsphoto dot biz>.
|
||||||
|
|
||||||
|
Replaced all use of the C function sprintf() with snprintf().
|
||||||
|
Replaced all use of the C funcion vsprintf() with vsnprintf().
|
||||||
|
Replaced all DONT_HAVE_VSPRINTF with DONT_HAVE_VSNPRINTF.
|
||||||
|
Replaced all Makefile var ${HAVE_VSPRINTF} with ${HAVE_VSNPRINTF}.
|
||||||
|
|
||||||
|
|
||||||
|
The following are the changes from calc version 2.12.6.4 to 2.12.6.5:
|
||||||
|
|
||||||
Fixed warning about undefined operations involving the qlink(q)
|
Fixed warning about undefined operations involving the qlink(q)
|
||||||
macro by deplacing that macro with an inline-function. Thanks goes
|
macro by replacing that macro with an inline-function. Thanks goes
|
||||||
to David Haller <dnh at opensuse dot org> for this fix.
|
to David Haller <dnh at opensuse dot org> for this fix.
|
||||||
|
|
||||||
NOTE for Windows 10 users: Pavel Nemec <pane at seznam dot cz>
|
NOTE for Windows 10 users: Pavel Nemec <pane at seznam dot cz>
|
||||||
@@ -128,7 +395,7 @@ The following are the changes from calc version 2.12.5.4 to 2.12.5.6:
|
|||||||
The improved gen_v1() function is capable of returning a value
|
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
|
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
|
used by gen_v1() have been changed to a short list of values
|
||||||
to try, in order ot likelyhood of success, before doing an
|
to try, in order ot likelihood of success, before doing an
|
||||||
exhaustive search for a v1 value to return.
|
exhaustive search for a v1 value to return.
|
||||||
|
|
||||||
Removed lucas_tbl.cal calc resource file. This file was made
|
Removed lucas_tbl.cal calc resource file. This file was made
|
||||||
@@ -218,32 +485,6 @@ The following are the changes from calc version 2.12.5.1 to 2.12.5.2:
|
|||||||
|
|
||||||
The following are the changes from calc version 2.12.5.0 to 2.12.5.1:
|
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:
|
There is a new calc bug report Email address:
|
||||||
|
|
||||||
calc-bug-report at asthe dot com
|
calc-bug-report at asthe dot com
|
||||||
@@ -458,7 +699,7 @@ The following are the changes from calc version 2.12.4.6 to version 2.12.4.10:
|
|||||||
Silenced annoying warning about unused variable 'intp'
|
Silenced annoying warning about unused variable 'intp'
|
||||||
while compiling endian.c under some circumstances.
|
while compiling endian.c under some circumstances.
|
||||||
|
|
||||||
Fixed typo in redeclaration warnings. Thanks to
|
Fixed typo in re-declaration warnings. Thanks to
|
||||||
Christoph Zurnieden <czurnieden at gmx dot de> for this report.
|
Christoph Zurnieden <czurnieden at gmx dot de> for this report.
|
||||||
|
|
||||||
Added a number of calc resource files by
|
Added a number of calc resource files by
|
||||||
@@ -2568,7 +2809,6 @@ The following are the changes from calc version 2.11.2t0 to 2.11.2t1.0:
|
|||||||
Using calc-bugs at asthe dot com for calc bug reports,
|
Using calc-bugs at asthe dot com for calc bug reports,
|
||||||
calc-contrib at asthe dot com for calc contributions,
|
calc-contrib at asthe dot com for calc contributions,
|
||||||
calc-tester-request at asthe dot com for requests to join calc-tester and
|
calc-tester-request at asthe dot com for requests to join calc-tester and
|
||||||
calc-tester at asthe dot com for the calc tester mailing list.
|
|
||||||
|
|
||||||
Replaced explicit Email addresses found this file with the <user at
|
Replaced explicit Email addresses found this file with the <user at
|
||||||
site dot domain> notation to reduce the potential for those folks
|
site dot domain> notation to reduce the potential for those folks
|
||||||
@@ -7308,7 +7548,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.
|
A small bug in the library file regress.cal was fixed.
|
||||||
|
|
||||||
## Copyright (C) 2001-2017 Landon Curt Noll
|
## Copyright (C) 2001-2017,2021 Landon Curt Noll
|
||||||
##
|
##
|
||||||
## Calc is open software; you can redistribute it and/or modify it under
|
## Calc is open software; you can redistribute it and/or modify it under
|
||||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
100
CONTRIB-CODE
Normal file
100
CONTRIB-CODE
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
Calc is open source. Contributions of code are welcome.
|
||||||
|
|
||||||
|
We welcome and encourage you to send us:
|
||||||
|
|
||||||
|
* calc resource files (cal/*.cal files)
|
||||||
|
* calc shell scripts (cscript/*.calc files)
|
||||||
|
* builtin functions that you have modified or written, i.e.:
|
||||||
|
assocfunc.c comfunc.c func.c func.h
|
||||||
|
listfunc.c matfunc.c qfunc.c zfunc.c
|
||||||
|
* custom functions that you have modified or written
|
||||||
|
* help files modified or written (help/*)
|
||||||
|
* Makefile improvements (Makefile, */Makefile)
|
||||||
|
* other source code modifications (*.c, *.h)
|
||||||
|
* etc. (* */* :) )
|
||||||
|
|
||||||
|
In order to consider integrating your code, we need:
|
||||||
|
|
||||||
|
* calc version you are working with (please try use the latest version)
|
||||||
|
* new help files or help file patches, if applicable (documentation)
|
||||||
|
* proposed text for the CHANGES file (brief description of what it does)
|
||||||
|
* regress.cal test patch as needed
|
||||||
|
* your source code and/or source code changes (:-))
|
||||||
|
|
||||||
|
If you add functionality to calc, please be sure to modify/patch/add
|
||||||
|
Makefiles, help files, cal/regress.cal test code as well.
|
||||||
|
Regression test cases are vital to maintaining calc's level
|
||||||
|
of correctness and helps us avoid code bug regression.
|
||||||
|
|
||||||
|
Please try to generate a patch against the most recent
|
||||||
|
version of calc, and if you use GitHub, the top of the
|
||||||
|
master branch:
|
||||||
|
|
||||||
|
https://github.com/lcn2/calc
|
||||||
|
|
||||||
|
The best way contribute to calc bug is to generate calc
|
||||||
|
GitHub pull request:
|
||||||
|
|
||||||
|
https://github.com/lcn2/calc/pulls
|
||||||
|
|
||||||
|
Your code needs to be contributed under either the 2.1 of the GNU
|
||||||
|
Lesser General Public License (LGPL 2.1) or in the public domain.
|
||||||
|
|
||||||
|
If you do not want to use calc GitHub, then send Email to:
|
||||||
|
|
||||||
|
calc-contrib-mail at asthe dot com
|
||||||
|
|
||||||
|
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||||
|
|
||||||
|
You MUST use following SPECIAL PHRASE in your Email Subject line:
|
||||||
|
|
||||||
|
calc contribution
|
||||||
|
|
||||||
|
You may add additional words to your subject line.
|
||||||
|
|
||||||
|
Suggestion:
|
||||||
|
|
||||||
|
From time to time, the Email address and Subject SPECIAL PHRASE
|
||||||
|
may change so verify you have the current info by visiting:
|
||||||
|
|
||||||
|
http://www.isthe.com/chongo/tech/comp/calc/calc-contrib.html
|
||||||
|
|
||||||
|
IMPORTANT: If your Email doesn't contain the above phrase,
|
||||||
|
then we WILL NOT SEE your Email.
|
||||||
|
|
||||||
|
PLEASE BE SURE you have that SPECIAL PHRASE somewhere in the subject line!
|
||||||
|
|
||||||
|
Keep in mind that the best way to report on a calc bug is to use
|
||||||
|
the above mentioned calc GitHub procedure.
|
||||||
|
|
||||||
|
Please be patient as we cannot always respond to Email messages quickly.
|
||||||
|
|
||||||
|
=-=
|
||||||
|
|
||||||
|
See also the calc wishlist by running the calc command:
|
||||||
|
|
||||||
|
; help wishlist
|
||||||
|
|
||||||
|
=-=
|
||||||
|
|
||||||
|
## Copyright (C) 1999,2014,2021 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.
|
||||||
|
##
|
||||||
|
## Under source code control: 1997/03/09 16:33:22
|
||||||
|
## File existed as early as: 1997
|
||||||
|
##
|
||||||
|
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||||
|
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
61
COPYING
61
COPYING
@@ -6,7 +6,7 @@ This file is Copyrighted
|
|||||||
|
|
||||||
This file is covered under the following Copyright:
|
This file is covered under the following Copyright:
|
||||||
|
|
||||||
Copyright (C) 1999-2014 Landon Curt Noll
|
Copyright (C) 1999-2021 Landon Curt Noll
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
@@ -49,65 +49,6 @@ Calc is covered by the GNU Lesser General Public License
|
|||||||
Boston, MA 02110-1301
|
Boston, MA 02110-1301
|
||||||
USA
|
USA
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
-=-
|
|
||||||
|
|
||||||
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'.
|
|
||||||
|
|
||||||
-=-
|
|
||||||
|
|
||||||
Calc's relationship to the GNU Lesser General Public License
|
Calc's relationship to the GNU Lesser General Public License
|
||||||
------------------------------------------------------------
|
------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -29,9 +29,19 @@ Installing calc from the bzip2-ed tarball in 4 easy steps:
|
|||||||
|
|
||||||
The top level Makefile and the custom/Makefile require a GNU
|
The top level Makefile and the custom/Makefile require a GNU
|
||||||
Make (such as gmake) or an equivalently advanced make. On many
|
Make (such as gmake) or an equivalently advanced make. On many
|
||||||
targets, the default make is sufficent. On FreeBSD for example,
|
targets, the default make is sufficient. On FreeBSD for example,
|
||||||
one must use gmake instead of make.
|
one must use gmake instead of make.
|
||||||
|
|
||||||
|
Some report that under macOS, one has to declare the target
|
||||||
|
to be darwin. So for macOS, one might have to do:
|
||||||
|
|
||||||
|
# for macOS users only, force the target to be darwin
|
||||||
|
#
|
||||||
|
make target=Darwin clobber
|
||||||
|
make target=Darwin all
|
||||||
|
make target=Darwin chk
|
||||||
|
make target=Darwin install
|
||||||
|
|
||||||
If your target system does not have GNU Make (or equivalent), then
|
If your target system does not have GNU Make (or equivalent), then
|
||||||
you should try using the Makefile.simple and custom/Makefile.simple
|
you should try using the Makefile.simple and custom/Makefile.simple
|
||||||
files:
|
files:
|
||||||
@@ -110,7 +120,7 @@ Installing calc from the bzip2-ed tarball in 4 easy steps:
|
|||||||
found below, comment out the Linux set and comment in that
|
found below, comment out the Linux set and comment in that
|
||||||
set or edit the gcc set or the common cc set as needed.
|
set or edit the gcc set or the common cc set as needed.
|
||||||
|
|
||||||
You may want to change these Makrfile variables from their defaults:
|
You may want to change these Makefile variables from their defaults:
|
||||||
|
|
||||||
RANLIB
|
RANLIB
|
||||||
|
|
||||||
@@ -142,7 +152,7 @@ Installing calc from the bzip2-ed tarball in 4 easy steps:
|
|||||||
|
|
||||||
The top level Makefile and the custom/Makefile require a GNU
|
The top level Makefile and the custom/Makefile require a GNU
|
||||||
Make (such as gmake) or an equivalently advanced make. On many
|
Make (such as gmake) or an equivalently advanced make. On many
|
||||||
targets, the default make is sufficent. On FreeBSD for example,
|
targets, the default make is sufficient. On FreeBSD for example,
|
||||||
one must use gmake instead of make.
|
one must use gmake instead of make.
|
||||||
|
|
||||||
If your target system does not have GNU Make (or equivalent), then
|
If your target system does not have GNU Make (or equivalent), then
|
||||||
@@ -188,7 +198,7 @@ Installing calc from the bzip2-ed tarball in 4 easy steps:
|
|||||||
We suggest that you might want to read the README.FIRST file and look at
|
We suggest that you might want to read the README.FIRST file and look at
|
||||||
the calc help subsystem. See also the README.md file.
|
the calc help subsystem. See also the README.md file.
|
||||||
|
|
||||||
## Copyright (C) 1999-2007 Landon Curt Noll
|
## Copyright (C) 1999-2007,2021 Landon Curt Noll
|
||||||
##
|
##
|
||||||
## Calc is open software; you can redistribute it and/or modify it under
|
## Calc is open software; you can redistribute it and/or modify it under
|
||||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
61
Makefile
61
Makefile
@@ -8,11 +8,12 @@
|
|||||||
# comments, this Makefile differs from the non-rpm bzip2-ed tarball
|
# comments, this Makefile differs from the non-rpm bzip2-ed tarball
|
||||||
# source Makefile in the following ways:
|
# source Makefile in the following ways:
|
||||||
#
|
#
|
||||||
# MAKEFILE_REV= $$Revision: 30.26 $$
|
|
||||||
# CCWERR= -Werror
|
# CCWERR= -Werror
|
||||||
# USE_READLINE= -DUSE_READLINE
|
# USE_READLINE= -DUSE_READLINE
|
||||||
# READLINE_LIB= -lreadline -lhistory -lncurses
|
# READLINE_LIB= -lreadline -lhistory -lncurses
|
||||||
#
|
#
|
||||||
|
# Copyright (C) 1999-2018,2021 Landon Curt Noll
|
||||||
|
#
|
||||||
# The Makefile.ship makefile becomes the Makefile found in the
|
# The Makefile.ship makefile becomes the Makefile found in the
|
||||||
# calc-*.tar.bz2 bzip2 source tarball.
|
# calc-*.tar.bz2 bzip2 source tarball.
|
||||||
#
|
#
|
||||||
@@ -24,7 +25,7 @@
|
|||||||
#
|
#
|
||||||
# This makefile contains only those critical rules (such as all, clean, etc.)
|
# This makefile contains only those critical rules (such as all, clean, etc.)
|
||||||
# and the common rules needed in development (such as chk, check, etc.).
|
# and the common rules needed in development (such as chk, check, etc.).
|
||||||
# This makefiile has a few special rules that are used to set the version
|
# This makefile has a few special rules that are used to set the version
|
||||||
# string in the shipped makefiles (such as Makefile.ship).
|
# string in the shipped makefiles (such as Makefile.ship).
|
||||||
|
|
||||||
# Copyright (C) 1999-2008,2014 Landon Curt Noll
|
# Copyright (C) 1999-2008,2014 Landon Curt Noll
|
||||||
@@ -52,7 +53,7 @@
|
|||||||
# calculator by David I. Bell with help/mods from others
|
# calculator by David I. Bell with help/mods from others
|
||||||
# Makefile by Landon Curt Noll
|
# Makefile by Landon Curt Noll
|
||||||
|
|
||||||
# Try uname -s if the target was not alreadhy set on the make command line
|
# Try uname -s if the target was not already set on the make command line
|
||||||
#
|
#
|
||||||
ifeq ($(target),)
|
ifeq ($(target),)
|
||||||
target=$(shell uname -s 2>/dev/null)
|
target=$(shell uname -s 2>/dev/null)
|
||||||
@@ -87,6 +88,12 @@ endif
|
|||||||
#READLINE_INCLUDE= -I/usr/gnu/include
|
#READLINE_INCLUDE= -I/usr/gnu/include
|
||||||
#READLINE_INCLUDE= -I/usr/local/include
|
#READLINE_INCLUDE= -I/usr/local/include
|
||||||
|
|
||||||
|
# Where man pages are installed
|
||||||
|
#
|
||||||
|
# Under macOS, we cannot modify /usr/share/man.
|
||||||
|
#
|
||||||
|
MANDIR= /usr/local/man/man1
|
||||||
|
|
||||||
# Normally certain files depend on the Makefile. If the Makefile is
|
# Normally certain files depend on the Makefile. If the Makefile is
|
||||||
# changed, then certain steps should be redone. If MAKE_FILE is
|
# changed, then certain steps should be redone. If MAKE_FILE is
|
||||||
# set to Makefile, then these files will depend on Makefile. If
|
# set to Makefile, then these files will depend on Makefile. If
|
||||||
@@ -109,7 +116,7 @@ TOP_MAKE_FILE= Makefile
|
|||||||
EXT=
|
EXT=
|
||||||
#EXT=.exe
|
#EXT=.exe
|
||||||
|
|
||||||
# This value is configured for chongo@theta.mellis.com.
|
# This value is configured for chongo for his laptop
|
||||||
#
|
#
|
||||||
RPM_TOP= ${HOME}/rpm/calc
|
RPM_TOP= ${HOME}/rpm/calc
|
||||||
|
|
||||||
@@ -169,7 +176,7 @@ V=@:
|
|||||||
#
|
#
|
||||||
XARG=
|
XARG=
|
||||||
|
|
||||||
# We pass these make varaibles to the end of each make command line
|
# We pass these make variables to the end of each make command line
|
||||||
# that invokes the ${MAKE_FILE}.
|
# that invokes the ${MAKE_FILE}.
|
||||||
#
|
#
|
||||||
XVAR= \
|
XVAR= \
|
||||||
@@ -184,6 +191,7 @@ XVAR= \
|
|||||||
CCWERR='${CCWERR}' \
|
CCWERR='${CCWERR}' \
|
||||||
NROFF='${NROFF}' \
|
NROFF='${NROFF}' \
|
||||||
COMMON_ADD='${COMMON_ADD}' \
|
COMMON_ADD='${COMMON_ADD}' \
|
||||||
|
MANDIR='${MANDIR}' \
|
||||||
Q='${Q}' \
|
Q='${Q}' \
|
||||||
V='${V}'
|
V='${V}'
|
||||||
|
|
||||||
@@ -207,30 +215,9 @@ all: fix_version check_include
|
|||||||
${V} echo '=-=-=-=-= private Makefile $@ rule end =-=-=-=-='
|
${V} echo '=-=-=-=-= private Makefile $@ rule end =-=-=-=-='
|
||||||
|
|
||||||
check_include:
|
check_include:
|
||||||
$(Q) if [ ! -d /usr/include ]; then \
|
${V} echo '=-=-=-=-= private Makefile $@ rule start =-=-=-=-='
|
||||||
echo "ERROR: critical directory missing: /usr/include" 1>&2; \
|
${Q} ${MAKE} ${XARG} -f ${MAKE_FILE} $@ ${XVAR}
|
||||||
echo "Without this critical directory, we cannot compile." 1>&2; \
|
${V} echo '=-=-=-=-= private Makefile $@ rule end =-=-=-=-='
|
||||||
echo 1>&2; \
|
|
||||||
echo "Perhaps your system isn't setup to compile C source?" 1>&2; \
|
|
||||||
echo "For example, Apple OS X / darwin requres that XCode" 1>&2; \
|
|
||||||
echo "must be installed and that you run the command:" 1>&2; \
|
|
||||||
echo 1>&2; \
|
|
||||||
echo " xcode-select --install" 1>&2; \
|
|
||||||
echo 1>&2; \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
||||||
$(Q) if [ ! -f /usr/include/stdio.h ]; then \
|
|
||||||
echo "ERROR: critical include files are missing" 1>&2; \
|
|
||||||
echo "Without this critical directory, we cannot compile." 1>&2; \
|
|
||||||
echo 1>&2; \
|
|
||||||
echo "Perhaps your system isn't setup to compile C source?" 1>&2; \
|
|
||||||
echo "For example, Apple OS X / darwin requres that XCode" 1>&2; \
|
|
||||||
echo "must be installed and that you run the command:" 1>&2; \
|
|
||||||
echo 1>&2; \
|
|
||||||
echo " xcode-select --install" 1>&2; \
|
|
||||||
echo 1>&2; \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
calc-dynamic-only:
|
calc-dynamic-only:
|
||||||
${V} echo '=-=-=-=-= private Makefile $@ rule start =-=-=-=-='
|
${V} echo '=-=-=-=-= private Makefile $@ rule start =-=-=-=-='
|
||||||
@@ -594,7 +581,7 @@ custom/.all:
|
|||||||
|
|
||||||
###
|
###
|
||||||
#
|
#
|
||||||
# building calc-static and static lib*.a libraires
|
# building calc-static and static lib*.a libraries
|
||||||
#
|
#
|
||||||
###
|
###
|
||||||
|
|
||||||
@@ -623,7 +610,7 @@ libcustcalc.a:
|
|||||||
# Home grown make dependency rules. Your system make not support
|
# Home grown make dependency rules. Your system make not support
|
||||||
# or have the needed tools. You can ignore this section.
|
# or have the needed tools. You can ignore this section.
|
||||||
#
|
#
|
||||||
# We will form a skelaton tree of *.c files containing only #include "foo.h"
|
# We will form a skeleton tree of *.c files containing only #include "foo.h"
|
||||||
# lines and .h files containing the same lines surrounded by multiple include
|
# lines and .h files containing the same lines surrounded by multiple include
|
||||||
# prevention lines. This allows us to build a static depend list that will
|
# prevention lines. This allows us to build a static depend list that will
|
||||||
# satisfy all possible cpp symbol definition combinations.
|
# satisfy all possible cpp symbol definition combinations.
|
||||||
@@ -731,6 +718,9 @@ chk:
|
|||||||
#
|
#
|
||||||
# debug
|
# debug
|
||||||
#
|
#
|
||||||
|
# make calcinfo:
|
||||||
|
# * print information about the host and compile environment
|
||||||
|
#
|
||||||
# make env:
|
# make env:
|
||||||
# * print major Makefile variables
|
# * print major Makefile variables
|
||||||
#
|
#
|
||||||
@@ -748,6 +738,11 @@ chk:
|
|||||||
# * compile without optimizers to make debugging easier
|
# * compile without optimizers to make debugging easier
|
||||||
##
|
##
|
||||||
|
|
||||||
|
calcinfo:
|
||||||
|
${V} echo '=-=-=-=-= private Makefile $@ rule start =-=-=-=-='
|
||||||
|
${Q} ${MAKE} ${XARG} -f ${MAKE_FILE} $@ ${XVAR}
|
||||||
|
${V} echo '=-=-=-=-= private Makefile $@ rule end =-=-=-=-='
|
||||||
|
|
||||||
env:
|
env:
|
||||||
${V} echo '=-=-=-=-= private Makefile $@ rule start =-=-=-=-='
|
${V} echo '=-=-=-=-= private Makefile $@ rule start =-=-=-=-='
|
||||||
${Q} ${MAKE} ${XARG} -f ${MAKE_FILE} $@ ${XVAR}
|
${Q} ${MAKE} ${XARG} -f ${MAKE_FILE} $@ ${XVAR}
|
||||||
@@ -848,7 +843,7 @@ inst_files:
|
|||||||
${Q} ${MAKE} ${XARG} -f ${MAKE_FILE} $@ ${XVAR}
|
${Q} ${MAKE} ${XARG} -f ${MAKE_FILE} $@ ${XVAR}
|
||||||
${V} echo '=-=-=-=-= private Makefile $@ rule end =-=-=-=-='
|
${V} echo '=-=-=-=-= private Makefile $@ rule end =-=-=-=-='
|
||||||
|
|
||||||
# The olduninstall rule will remove calc files from the older, histroic
|
# The olduninstall rule will remove calc files from the older, historic
|
||||||
# locations under the /usr/local directory. If you are using the
|
# locations under the /usr/local directory. If you are using the
|
||||||
# new default values for ${BINDIR}, ${CALC_SHAREDIR}, ${INCDIR} and ${LIBDIR}
|
# new default values for ${BINDIR}, ${CALC_SHAREDIR}, ${INCDIR} and ${LIBDIR}
|
||||||
# then you can use this rule to clean out the older calc stuff under
|
# then you can use this rule to clean out the older calc stuff under
|
||||||
@@ -906,7 +901,7 @@ strip:
|
|||||||
${Q} ${MAKE} ${XARG} -f ${MAKE_FILE} $@ ${XVAR}
|
${Q} ${MAKE} ${XARG} -f ${MAKE_FILE} $@ ${XVAR}
|
||||||
${V} echo '=-=-=-=-= private Makefile $@ rule end =-=-=-=-='
|
${V} echo '=-=-=-=-= private Makefile $@ rule end =-=-=-=-='
|
||||||
|
|
||||||
# calc-symlink - setup symlinks from stardard locations into the ${T} tree
|
# calc-symlink - setup symlinks from standard locations into the ${T} tree
|
||||||
#
|
#
|
||||||
calc-symlink:
|
calc-symlink:
|
||||||
${V} echo '=-=-=-=-= private Makefile $@ rule start =-=-=-=-='
|
${V} echo '=-=-=-=-= private Makefile $@ rule start =-=-=-=-='
|
||||||
|
275
Makefile.ship
275
Makefile.ship
@@ -23,7 +23,7 @@
|
|||||||
# READLINE_LIB= -lreadline
|
# READLINE_LIB= -lreadline
|
||||||
# READLINE_EXTRAS= -lhistory -lncurses
|
# READLINE_EXTRAS= -lhistory -lncurses
|
||||||
#
|
#
|
||||||
# Copyright (C) 1999-2018 Landon Curt Noll
|
# Copyright (C) 1999-2018,2021 Landon Curt Noll
|
||||||
#
|
#
|
||||||
# Calc is open software; you can redistribute it and/or modify it under
|
# Calc is open software; you can redistribute it and/or modify it under
|
||||||
# the terms of version 2.1 of the GNU Lesser General Public License
|
# the terms of version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -39,8 +39,6 @@
|
|||||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#
|
#
|
||||||
MAKEFILE_REV= $$Revision: 30.88 $$
|
|
||||||
#
|
|
||||||
# Under source code control: 1990/02/15 01:48:41
|
# Under source code control: 1990/02/15 01:48:41
|
||||||
# File existed as early as: before 1990
|
# File existed as early as: before 1990
|
||||||
#
|
#
|
||||||
@@ -90,29 +88,29 @@ TERMCONTROL=
|
|||||||
#TERMCONTROL= -DUSE_SGTTY
|
#TERMCONTROL= -DUSE_SGTTY
|
||||||
#TERMCONTROL= -DUSE_WIN32
|
#TERMCONTROL= -DUSE_WIN32
|
||||||
|
|
||||||
# If your system does not have a vsprintf() function, you could be in trouble.
|
# If your system does not have a vsnprintf() function, you could be in trouble.
|
||||||
#
|
#
|
||||||
# vsprintf(string, format, ap)
|
# vsnprintf(string, size, format, ap)
|
||||||
#
|
#
|
||||||
# This function works like sprintf except that the 3rd arg is a va_list
|
# This function works like spnrintf except that the 4th arg is a va_list
|
||||||
# strarg (or varargs) list. Some old systems do not have vsprintf().
|
# strarg (or varargs) list. Some old systems do not have vsnprintf().
|
||||||
# If you do not have vsprintf(), then calc will try sprintf() and hope
|
# If you do not have vsnprintf(), then calc will try snprintf() and hope
|
||||||
# for the best.
|
# for the best.
|
||||||
#
|
#
|
||||||
# A similar problem occurs if your system does not have a vsnprintf()
|
# A similar problem occurs if your system does not have a vsnprintf()
|
||||||
# function. This function is like the vsprintf() function except that
|
# function. This function is like the vsnprintf() function except that
|
||||||
# there is an extra second argument that controls the maximum size
|
# there is an extra second argument that controls the maximum size
|
||||||
# string that is produced.
|
# string that is produced.
|
||||||
#
|
#
|
||||||
# If HAVE_VSPRINTF is empty, this Makefile will run the have_stdvs.c and/or
|
# If HAVE_VSNPRINTF is empty, this Makefile will run the have_stdvs.c and/or
|
||||||
# have_varvs.c program to determine if vsprintf() is supported. If
|
# have_varvs.c program to determine if vsnprintf() is supported. If
|
||||||
# HAVE_VSPRINTF is set to -DDONT_HAVE_VSPRINTF then calc will hope that
|
# HAVE_VSNPRINTF is set to -DDONT_HAVE_VSNPRINTF then calc will hope that
|
||||||
# sprintf() will work.
|
# snprintf() will work.
|
||||||
#
|
#
|
||||||
# If in doubt, leave HAVE_VSPRINTF empty.
|
# If in doubt, leave HAVE_VSNPRINTF empty.
|
||||||
#
|
#
|
||||||
HAVE_VSPRINTF=
|
HAVE_VSNPRINTF=
|
||||||
#HAVE_VSPRINTF= -DDONT_HAVE_VSPRINTF
|
#HAVE_VSNPRINTF= -DDONT_HAVE_VSNPRINTF
|
||||||
|
|
||||||
# Determine the byte order of your machine
|
# Determine the byte order of your machine
|
||||||
#
|
#
|
||||||
@@ -575,7 +573,7 @@ HAVE_UNUSED=
|
|||||||
ifeq ($(target),Darwin)
|
ifeq ($(target),Darwin)
|
||||||
|
|
||||||
# default INCDIR for macOS
|
# default INCDIR for macOS
|
||||||
INCDIR= /usr/local/include
|
INCDIR= $(shell xcrun --show-sdk-path --sdk macosx)/usr/include
|
||||||
|
|
||||||
else
|
else
|
||||||
#endif /* end of skip for non-Gnu makefiles */
|
#endif /* end of skip for non-Gnu makefiles */
|
||||||
@@ -1028,7 +1026,8 @@ LD_DEBUG=
|
|||||||
#
|
#
|
||||||
# CALC_ENV= CALCPATH=./cal LD_LIBRARY_PATH=.:./custom DYLD_LIBRARY_PATH=.
|
# CALC_ENV= CALCPATH=./cal LD_LIBRARY_PATH=.:./custom DYLD_LIBRARY_PATH=.
|
||||||
#
|
#
|
||||||
CALC_ENV= CALCPATH=./cal LD_LIBRARY_PATH=. DYLD_LIBRARY_PATH=.
|
CALC_ENV= CALCPATH=./cal LD_LIBRARY_PATH=. DYLD_LIBRARY_PATH=. CALCHELP=./help \
|
||||||
|
CALCCUSTOMHELP=./custom
|
||||||
#CALC_ENV= CALCPATH=./cal DYLD_LIBRARY_PATH=. \
|
#CALC_ENV= CALCPATH=./cal DYLD_LIBRARY_PATH=. \
|
||||||
# MALLOC_VERBOSE=1 MALLOC_TRACING=1 \
|
# MALLOC_VERBOSE=1 MALLOC_TRACING=1 \
|
||||||
# MALLOC_FASTCHK=1 MALLOC_FULLWARN=1 LD_LIBRARY_PATH=.:./custom
|
# MALLOC_FASTCHK=1 MALLOC_FULLWARN=1 LD_LIBRARY_PATH=.:./custom
|
||||||
@@ -1054,7 +1053,7 @@ EXT=
|
|||||||
|
|
||||||
# The default calc versions
|
# The default calc versions
|
||||||
#
|
#
|
||||||
VERSION= 2.12.6.5
|
VERSION= 2.12.8.2
|
||||||
|
|
||||||
# Names of shared libraries with versions
|
# Names of shared libraries with versions
|
||||||
#
|
#
|
||||||
@@ -1064,34 +1063,39 @@ LIB_EXT_VERSION= ${LIB_EXT}.${VERSION}
|
|||||||
# standard utilities used during make
|
# standard utilities used during make
|
||||||
#
|
#
|
||||||
SHELL= /bin/sh
|
SHELL= /bin/sh
|
||||||
LANG= C
|
AR= ar
|
||||||
MAKE= make
|
|
||||||
AWK= awk
|
AWK= awk
|
||||||
SED= sed
|
CAT= cat
|
||||||
DIFF= diff
|
|
||||||
GREP= egrep
|
|
||||||
SORT= sort
|
|
||||||
TEE= tee
|
|
||||||
CTAGS= ctags
|
|
||||||
CHMOD= chmod
|
CHMOD= chmod
|
||||||
FMT= fmt
|
|
||||||
XARGS= xargs
|
|
||||||
CMP= cmp
|
CMP= cmp
|
||||||
|
CO= co
|
||||||
|
COL= col
|
||||||
|
CP= cp
|
||||||
|
CTAGS= ctags
|
||||||
|
DATE= date
|
||||||
|
DIFF= diff
|
||||||
|
FMT= fmt
|
||||||
|
GREP= egrep
|
||||||
|
HOSTNAME= hostname
|
||||||
|
LANG= C
|
||||||
|
LDCONFIG= ldconfig
|
||||||
|
LN= ln
|
||||||
|
MAKE= make
|
||||||
MKDIR= mkdir
|
MKDIR= mkdir
|
||||||
|
MV= mv
|
||||||
|
PWDCMD= pwd
|
||||||
|
RM= rm
|
||||||
|
RMDIR= rmdir
|
||||||
|
SED= sed
|
||||||
|
SORT= sort
|
||||||
SPLINT= splint
|
SPLINT= splint
|
||||||
SPLINT_OPTS=
|
SPLINT_OPTS=
|
||||||
RM= rm
|
TEE= tee
|
||||||
TOUCH= touch
|
TOUCH= touch
|
||||||
RMDIR= rmdir
|
|
||||||
CP= cp
|
|
||||||
MV= mv
|
|
||||||
CO= co
|
|
||||||
AR= ar
|
|
||||||
TRUE= true
|
TRUE= true
|
||||||
CAT= cat
|
UNAME= uname
|
||||||
COL= col
|
XARGS= xargs
|
||||||
LN= ln
|
|
||||||
LDCONFIG= ldconfig
|
|
||||||
# assume the X11 makedepend tool for the depend rule
|
# assume the X11 makedepend tool for the depend rule
|
||||||
MAKEDEPEND= makedepend
|
MAKEDEPEND= makedepend
|
||||||
STRIP= strip
|
STRIP= strip
|
||||||
@@ -1116,16 +1120,26 @@ STRIP= strip
|
|||||||
EXTRA_CFLAGS=
|
EXTRA_CFLAGS=
|
||||||
EXTRA_LDFLAGS=
|
EXTRA_LDFLAGS=
|
||||||
|
|
||||||
|
# Architecture compile flags
|
||||||
|
#
|
||||||
|
# The ARCH_CFLAGS are ${CC} when compiling C files. They follow
|
||||||
|
# CCMISC and precede EXTRA_CFLAGS.
|
||||||
|
#
|
||||||
|
ARCH_CFLAGS= -march=native
|
||||||
|
#ARCH_CFLAGS=
|
||||||
|
|
||||||
# COMMON_CFLAGS are the common ${CC} flags used for all programs, both
|
# COMMON_CFLAGS are the common ${CC} flags used for all programs, both
|
||||||
# intermediate and final calc and calc related programs
|
# intermediate and final calc and calc related programs
|
||||||
#
|
#
|
||||||
#if 0 /* start of skip for non-Gnu makefiles */
|
#if 0 /* start of skip for non-Gnu makefiles */
|
||||||
ifdef ALLOW_CUSTOM
|
ifdef ALLOW_CUSTOM
|
||||||
#endif /* end of skip for non-Gnu makefiles */
|
#endif /* end of skip for non-Gnu makefiles */
|
||||||
COMMON_CFLAGS= -DCALC_SRC ${ALLOW_CUSTOM} ${CCWARN} ${CCMISC} ${EXTRA_CFLAGS}
|
COMMON_CFLAGS= -DCALC_SRC ${ALLOW_CUSTOM} ${CCWARN} \
|
||||||
|
${CCMISC} ${ARCH_CFLAGS} ${EXTRA_CFLAGS}
|
||||||
#if 0 /* start of skip for non-Gnu makefiles */
|
#if 0 /* start of skip for non-Gnu makefiles */
|
||||||
else
|
else
|
||||||
COMMON_CFLAGS= -DCALC_SRC -UCUSTOM ${CCWARN} ${CCMISC} ${EXTRA_CFLAGS}
|
COMMON_CFLAGS= -DCALC_SRC -UCUSTOM ${CCWARN} \
|
||||||
|
${CCMISC} ${ARCH_CFLAGS} ${EXTRA_CFLAGS}
|
||||||
endif
|
endif
|
||||||
#endif /* end of skip for non-Gnu makefiles */
|
#endif /* end of skip for non-Gnu makefiles */
|
||||||
|
|
||||||
@@ -1192,7 +1206,7 @@ COMMON_LDFLAGS= ${EXTRA_LDFLAGS}
|
|||||||
# #
|
# #
|
||||||
# calc-contrib at asthe dot com #
|
# calc-contrib at asthe dot com #
|
||||||
# #
|
# #
|
||||||
# EMail address an "ifeq ($(target),YOUR_TARGET_NAME)" ... "endif" #
|
# Email address an "ifeq ($(target),YOUR_TARGET_NAME)" ... "endif" #
|
||||||
# set of lines so that we can consider them for the next release. #
|
# set of lines so that we can consider them for the next release. #
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
@@ -1900,6 +1914,7 @@ SAMPLE_OBJ= sample_many.o sample_rand.o
|
|||||||
CUSTOM_PASSDOWN= \
|
CUSTOM_PASSDOWN= \
|
||||||
ALLOW_CUSTOM="${ALLOW_CUSTOM}" \
|
ALLOW_CUSTOM="${ALLOW_CUSTOM}" \
|
||||||
AR=${AR} \
|
AR=${AR} \
|
||||||
|
ARCH_CFLAGS=${ARCH_CFLAGS} \
|
||||||
AWK=${AWK} \
|
AWK=${AWK} \
|
||||||
BINDIR="${BINDIR}" \
|
BINDIR="${BINDIR}" \
|
||||||
BLD_TYPE="${BLD_TYPE}" \
|
BLD_TYPE="${BLD_TYPE}" \
|
||||||
@@ -2073,7 +2088,7 @@ LICENSE= COPYING COPYING-LGPL
|
|||||||
#
|
#
|
||||||
DISTLIST= ${C_SRC} ${H_SRC} ${MAKE_FILE} BUGS CHANGES LIBRARY README.FIRST \
|
DISTLIST= ${C_SRC} ${H_SRC} ${MAKE_FILE} BUGS CHANGES LIBRARY README.FIRST \
|
||||||
README.WINDOWS calc.man HOWTO.INSTALL ${UTIL_MISC_SRC} ${LICENSE} \
|
README.WINDOWS calc.man HOWTO.INSTALL ${UTIL_MISC_SRC} ${LICENSE} \
|
||||||
sample.README calc.spec.in rpm.mk README.md
|
sample.README calc.spec.in rpm.mk README.md QUESTIONS CONTRIB-CODE
|
||||||
|
|
||||||
# These files are used to make (but not build) a calc .a link library
|
# These files are used to make (but not build) a calc .a link library
|
||||||
#
|
#
|
||||||
@@ -2179,25 +2194,15 @@ TARGETS= ${EARLY_TARGETS} ${BLD_TYPE} ${LATE_TARGETS}
|
|||||||
all: check_include ${BLD_TYPE} CHANGES
|
all: check_include ${BLD_TYPE} CHANGES
|
||||||
|
|
||||||
check_include:
|
check_include:
|
||||||
$(Q) if [ ! -d /usr/include ]; then \
|
$(Q) if ! echo '#include <stdio.h>' | ${CC} -E - >/dev/null 2>&1; then \
|
||||||
echo "ERROR: critical directory missing: /usr/include" 1>&2; \
|
echo "ERROR: Missing critical <stdio.h> include file." 1>&2; \
|
||||||
echo "Without this critical directory, we cannot compile." 1>&2; \
|
echo "Without critical include files, we cannot compile." 1>&2; \
|
||||||
echo 1>&2; \
|
|
||||||
echo "Perhaps your system isn't setup to compile C source?" 1>&2; \
|
echo "Perhaps your system isn't setup to compile C source?" 1>&2; \
|
||||||
echo "For example, Apple OS X / darwin requres that XCode" 1>&2; \
|
|
||||||
echo "must be installed and that you run the command:" 1>&2; \
|
|
||||||
echo 1>&2; \
|
echo 1>&2; \
|
||||||
echo " xcode-select --install" 1>&2; \
|
echo "For example, Apple macOS / Darwin requires that XCode" 1>&2; \
|
||||||
|
echo "must be installed." 1>&2; \
|
||||||
echo 1>&2; \
|
echo 1>&2; \
|
||||||
exit 1; \
|
echo "Also macOS users might later to run this command:" 1>&2; \
|
||||||
fi
|
|
||||||
$(Q) if [ ! -f /usr/include/stdio.h ]; then \
|
|
||||||
echo "ERROR: critical include files are missing" 1>&2; \
|
|
||||||
echo "Without this critical directory, we cannot compile." 1>&2; \
|
|
||||||
echo 1>&2; \
|
|
||||||
echo "Perhaps your system isn't setup to compile C source?" 1>&2; \
|
|
||||||
echo "For example, Apple OS X / darwin requres that XCode" 1>&2; \
|
|
||||||
echo "must be installed and that you run the command:" 1>&2; \
|
|
||||||
echo 1>&2; \
|
echo 1>&2; \
|
||||||
echo " xcode-select --install" 1>&2; \
|
echo " xcode-select --install" 1>&2; \
|
||||||
echo 1>&2; \
|
echo 1>&2; \
|
||||||
@@ -2321,6 +2326,7 @@ calc.1: calc.man ${MAKE_FILE}
|
|||||||
-e 's,$${CALC_INCDIR},${CALC_INCDIR},g' \
|
-e 's,$${CALC_INCDIR},${CALC_INCDIR},g' \
|
||||||
-e 's,$${CUSTOMCALDIR},${CUSTOMCALDIR},g' \
|
-e 's,$${CUSTOMCALDIR},${CUSTOMCALDIR},g' \
|
||||||
-e 's,$${CUSTOMINCDIR},${CUSTOMINCDIR},g' \
|
-e 's,$${CUSTOMINCDIR},${CUSTOMINCDIR},g' \
|
||||||
|
-e 's,$${HELPDIR},${HELPDIR},g' \
|
||||||
-e 's,$${CUSTOMHELPDIR},${CUSTOMHELPDIR},g' \
|
-e 's,$${CUSTOMHELPDIR},${CUSTOMHELPDIR},g' \
|
||||||
-e 's,$${CALCRC},${CALCRC},g' < calc.man > calc.1
|
-e 's,$${CALCRC},${CALCRC},g' < calc.man > calc.1
|
||||||
${Q} echo calc.1 formed
|
${Q} echo calc.1 formed
|
||||||
@@ -2332,7 +2338,7 @@ calc.usage: calc.1 ${MAKE_FILE}
|
|||||||
LESSCHARSET=iso8859 ${CALCPAGER} calc.1; \
|
LESSCHARSET=iso8859 ${CALCPAGER} calc.1; \
|
||||||
else \
|
else \
|
||||||
${NROFF} -man calc.1; \
|
${NROFF} -man calc.1; \
|
||||||
fi | ${COL} -b > $@
|
fi 2>&1 | ${GREP} -v 'cannot adjust line' | ${COL} -b > $@
|
||||||
${Q} echo calc.usage formed
|
${Q} echo calc.usage formed
|
||||||
|
|
||||||
|
|
||||||
@@ -2477,22 +2483,15 @@ endian_calc.h: endian${EXT} ${MAKE_FILE}
|
|||||||
${Q} echo '' >> endian_calc.h
|
${Q} echo '' >> endian_calc.h
|
||||||
${Q} echo '/* what byte order are we? */' >> endian_calc.h
|
${Q} echo '/* what byte order are we? */' >> endian_calc.h
|
||||||
-${Q} if [ X"${CALC_BYTE_ORDER}" = X ]; then \
|
-${Q} if [ X"${CALC_BYTE_ORDER}" = X ]; then \
|
||||||
if [ -f ${INCDIR}/endian.h ]; then \
|
if echo '#include <endian.h>' | ${CC} -E - >/dev/null 2>&1; then \
|
||||||
echo '#include <endian.h>' >> endian_calc.h; \
|
echo '#include <endian.h>' >> endian_calc.h; \
|
||||||
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
|
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
|
||||||
elif [ -f ${INCDIR}/machine/endian.h ]; then \
|
elif echo '#include <machine/endian.h>' | \
|
||||||
|
${CC} -E - >/dev/null 2>&1; then \
|
||||||
echo '#include <machine/endian.h>' >> endian_calc.h; \
|
echo '#include <machine/endian.h>' >> endian_calc.h; \
|
||||||
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
|
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
|
||||||
elif [ -f ${INCDIR}/sys/endian.h ]; then \
|
elif echo '#include <sys/endian.h>' | \
|
||||||
echo '#include <sys/endian.h>' >> endian_calc.h; \
|
${CC} -E- >/dev/null 2>&1; then \
|
||||||
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
|
|
||||||
elif [ -f /usr/include/endian.h ]; then \
|
|
||||||
echo '#include <endian.h>' >> endian_calc.h; \
|
|
||||||
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
|
|
||||||
elif [ -f /usr/include/machine/endian.h ]; then \
|
|
||||||
echo '#include <machine/endian.h>' >> endian_calc.h; \
|
|
||||||
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
|
|
||||||
elif [ -f /usr/include/sys/endian.h ]; then \
|
|
||||||
echo '#include <sys/endian.h>' >> endian_calc.h; \
|
echo '#include <sys/endian.h>' >> endian_calc.h; \
|
||||||
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
|
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
|
||||||
else \
|
else \
|
||||||
@@ -2559,9 +2558,7 @@ have_times.h: ${MAKE_FILE}
|
|||||||
echo '#define HAVE_TIMES_H /* yes */' >> have_times.h; \
|
echo '#define HAVE_TIMES_H /* yes */' >> have_times.h; \
|
||||||
elif [ X"${HAVE_TIMES_H}" = X"NO" ]; then \
|
elif [ X"${HAVE_TIMES_H}" = X"NO" ]; then \
|
||||||
echo '#undef HAVE_TIMES_H /* no */' >> have_times.h; \
|
echo '#undef HAVE_TIMES_H /* no */' >> have_times.h; \
|
||||||
elif [ -f ${INCDIR}/times.h ]; then \
|
elif echo '#include <times.h>' | ${CC} -E - >/dev/null 2>&1; then \
|
||||||
echo '#define HAVE_TIMES_H /* yes */' >> have_times.h; \
|
|
||||||
elif [ -f /usr/include/times.h ]; then \
|
|
||||||
echo '#define HAVE_TIMES_H /* yes */' >> have_times.h; \
|
echo '#define HAVE_TIMES_H /* yes */' >> have_times.h; \
|
||||||
else \
|
else \
|
||||||
echo '#undef HAVE_TIMES_H /* no */' >> have_times.h; \
|
echo '#undef HAVE_TIMES_H /* no */' >> have_times.h; \
|
||||||
@@ -2570,9 +2567,7 @@ have_times.h: ${MAKE_FILE}
|
|||||||
echo '#define HAVE_SYS_TIMES_H /* yes */' >> have_times.h; \
|
echo '#define HAVE_SYS_TIMES_H /* yes */' >> have_times.h; \
|
||||||
elif [ X"${HAVE_SYS_TIMES_H}" = X"NO" ]; then \
|
elif [ X"${HAVE_SYS_TIMES_H}" = X"NO" ]; then \
|
||||||
echo '#undef HAVE_SYS_TIMES_H /* no */' >> have_times.h; \
|
echo '#undef HAVE_SYS_TIMES_H /* no */' >> have_times.h; \
|
||||||
elif [ -f ${INCDIR}/sys/times.h ]; then \
|
elif echo '#include <sys/times.h>' | ${CC} -E - >/dev/null 2>&1; then \
|
||||||
echo '#define HAVE_SYS_TIMES_H /* yes */' >> have_times.h; \
|
|
||||||
elif [ -f /usr/include/sys/times.h ]; then \
|
|
||||||
echo '#define HAVE_SYS_TIMES_H /* yes */' >> have_times.h; \
|
echo '#define HAVE_SYS_TIMES_H /* yes */' >> have_times.h; \
|
||||||
else \
|
else \
|
||||||
echo '#undef HAVE_SYS_TIMES_H /* no */' >> have_times.h; \
|
echo '#undef HAVE_SYS_TIMES_H /* no */' >> have_times.h; \
|
||||||
@@ -2581,9 +2576,7 @@ have_times.h: ${MAKE_FILE}
|
|||||||
echo '#define HAVE_TIME_H /* yes */' >> have_times.h; \
|
echo '#define HAVE_TIME_H /* yes */' >> have_times.h; \
|
||||||
elif [ X"${HAVE_TIME_H}" = X"NO" ]; then \
|
elif [ X"${HAVE_TIME_H}" = X"NO" ]; then \
|
||||||
echo '#undef HAVE_TIME_H /* no */' >> have_times.h; \
|
echo '#undef HAVE_TIME_H /* no */' >> have_times.h; \
|
||||||
elif [ -f ${INCDIR}/time.h ]; then \
|
elif echo '#include <time.h>' | ${CC} -E - >/dev/null 2>&1; then \
|
||||||
echo '#define HAVE_TIME_H /* yes */' >> have_times.h; \
|
|
||||||
elif [ -f /usr/include/time.h ]; then \
|
|
||||||
echo '#define HAVE_TIME_H /* yes */' >> have_times.h; \
|
echo '#define HAVE_TIME_H /* yes */' >> have_times.h; \
|
||||||
else \
|
else \
|
||||||
echo '#undef HAVE_TIME_H /* no */' >> have_times.h; \
|
echo '#undef HAVE_TIME_H /* no */' >> have_times.h; \
|
||||||
@@ -2592,9 +2585,7 @@ have_times.h: ${MAKE_FILE}
|
|||||||
echo '#define HAVE_SYS_TIME_H /* yes */' >> have_times.h; \
|
echo '#define HAVE_SYS_TIME_H /* yes */' >> have_times.h; \
|
||||||
elif [ X"${HAVE_SYS_TIME_H}" = X"NO" ]; then \
|
elif [ X"${HAVE_SYS_TIME_H}" = X"NO" ]; then \
|
||||||
echo '#undef HAVE_SYS_TIME_H /* no */' >> have_times.h; \
|
echo '#undef HAVE_SYS_TIME_H /* no */' >> have_times.h; \
|
||||||
elif [ -f ${INCDIR}/sys/time.h ]; then \
|
elif echo '#include <sys/time.h>' | ${CC} -E - >/dev/null 2>&1; then \
|
||||||
echo '#define HAVE_SYS_TIME_H /* yes */' >> have_times.h; \
|
|
||||||
elif [ -f /usr/include/sys/time.h ]; then \
|
|
||||||
echo '#define HAVE_SYS_TIME_H /* yes */' >> have_times.h; \
|
echo '#define HAVE_SYS_TIME_H /* yes */' >> have_times.h; \
|
||||||
else \
|
else \
|
||||||
echo '#undef HAVE_SYS_TIME_H /* no */' >> have_times.h; \
|
echo '#undef HAVE_SYS_TIME_H /* no */' >> have_times.h; \
|
||||||
@@ -2630,9 +2621,7 @@ have_stdlib.h: ${MAKE_FILE}
|
|||||||
echo '#define HAVE_STDLIB_H /* yes */' >> have_stdlib.h; \
|
echo '#define HAVE_STDLIB_H /* yes */' >> have_stdlib.h; \
|
||||||
elif [ X"${HAVE_STDLIB_H}" = X"NO" ]; then \
|
elif [ X"${HAVE_STDLIB_H}" = X"NO" ]; then \
|
||||||
echo '#undef HAVE_STDLIB_H /* no */' >> have_stdlib.h; \
|
echo '#undef HAVE_STDLIB_H /* no */' >> have_stdlib.h; \
|
||||||
elif [ -f ${INCDIR}/stdlib.h ]; then \
|
elif echo '#include <stdlib.h>' | ${CC} -E - >/dev/null 2>&1; then \
|
||||||
echo '#define HAVE_STDLIB_H /* yes */' >> have_stdlib.h; \
|
|
||||||
elif [ -f /usr/include/stdlib.h ]; then \
|
|
||||||
echo '#define HAVE_STDLIB_H /* yes */' >> have_stdlib.h; \
|
echo '#define HAVE_STDLIB_H /* yes */' >> have_stdlib.h; \
|
||||||
else \
|
else \
|
||||||
echo '#undef HAVE_STDLIB_H /* no */' >> have_stdlib.h; \
|
echo '#undef HAVE_STDLIB_H /* no */' >> have_stdlib.h; \
|
||||||
@@ -2668,9 +2657,7 @@ have_unistd.h: ${MAKE_FILE}
|
|||||||
echo '#define HAVE_UNISTD_H /* yes */' >> have_unistd.h; \
|
echo '#define HAVE_UNISTD_H /* yes */' >> have_unistd.h; \
|
||||||
elif [ X"${HAVE_UNISTD_H}" = X"NO" ]; then \
|
elif [ X"${HAVE_UNISTD_H}" = X"NO" ]; then \
|
||||||
echo '#undef HAVE_UNISTD_H /* no */' >> have_unistd.h; \
|
echo '#undef HAVE_UNISTD_H /* no */' >> have_unistd.h; \
|
||||||
elif [ -f ${INCDIR}/unistd.h ]; then \
|
elif echo '#include <unistd.h>' | ${CC} -E - >/dev/null 2>&1; then \
|
||||||
echo '#define HAVE_UNISTD_H /* yes */' >> have_unistd.h; \
|
|
||||||
elif [ -f /usr/include/unistd.h ]; then \
|
|
||||||
echo '#define HAVE_UNISTD_H /* yes */' >> have_unistd.h; \
|
echo '#define HAVE_UNISTD_H /* yes */' >> have_unistd.h; \
|
||||||
else \
|
else \
|
||||||
echo '#undef HAVE_UNISTD_H /* no */' >> have_unistd.h; \
|
echo '#undef HAVE_UNISTD_H /* no */' >> have_unistd.h; \
|
||||||
@@ -2706,9 +2693,7 @@ have_string.h: ${MAKE_FILE}
|
|||||||
echo '#define HAVE_STRING_H /* yes */' >> have_string.h; \
|
echo '#define HAVE_STRING_H /* yes */' >> have_string.h; \
|
||||||
elif [ X"${HAVE_STRING_H}" = X"NO" ]; then \
|
elif [ X"${HAVE_STRING_H}" = X"NO" ]; then \
|
||||||
echo '#undef HAVE_STRING_H /* no */' >> have_string.h; \
|
echo '#undef HAVE_STRING_H /* no */' >> have_string.h; \
|
||||||
elif [ -f ${INCDIR}/string.h ]; then \
|
elif echo '#include <string.h>' | ${CC} -E - >/dev/null 2>&1; then \
|
||||||
echo '#define HAVE_STRING_H /* yes */' >> have_string.h; \
|
|
||||||
elif [ -f /usr/include/string.h ]; then \
|
|
||||||
echo '#define HAVE_STRING_H /* yes */' >> have_string.h; \
|
echo '#define HAVE_STRING_H /* yes */' >> have_string.h; \
|
||||||
else \
|
else \
|
||||||
echo '#undef HAVE_STRING_H /* no */' >> have_string.h; \
|
echo '#undef HAVE_STRING_H /* no */' >> have_string.h; \
|
||||||
@@ -2748,22 +2733,12 @@ terminal.h: ${MAKE_FILE}
|
|||||||
echo '#undef USE_TERMIOS /* <termios.h> */' >> terminal.h; \
|
echo '#undef USE_TERMIOS /* <termios.h> */' >> terminal.h; \
|
||||||
echo '#undef USE_TERMIO /* <termio.h> */' >> terminal.h; \
|
echo '#undef USE_TERMIO /* <termio.h> */' >> terminal.h; \
|
||||||
echo '#undef USE_SGTTY /* <sys/ioctl.h> */' >> terminal.h; \
|
echo '#undef USE_SGTTY /* <sys/ioctl.h> */' >> terminal.h; \
|
||||||
elif [ -f ${INCDIR}/termios.h ]; then \
|
elif echo '#include <termios.h>' | ${CC} -E - >/dev/null 2>&1; then \
|
||||||
echo '/* use termios */' >> terminal.h; \
|
echo '/* use termios */' >> terminal.h; \
|
||||||
echo '#define USE_TERMIOS /* <termios.h> */' >> terminal.h; \
|
echo '#define USE_TERMIOS /* <termios.h> */' >> terminal.h; \
|
||||||
echo '#undef USE_TERMIO /* <termio.h> */' >> terminal.h; \
|
echo '#undef USE_TERMIO /* <termio.h> */' >> terminal.h; \
|
||||||
echo '#undef USE_SGTTY /* <sys/ioctl.h> */' >> terminal.h; \
|
echo '#undef USE_SGTTY /* <sys/ioctl.h> */' >> terminal.h; \
|
||||||
elif [ -f ${INCDIR}/termio.h ]; then \
|
elif echo '#include <termio.h>' | ${CC} -E - >/dev/null 2>&1; then \
|
||||||
echo '/* use termio */' >> terminal.h; \
|
|
||||||
echo '#undef USE_TERMIOS /* <termios.h> */' >> terminal.h; \
|
|
||||||
echo '#define USE_TERMIO /* <termio.h> */' >> terminal.h; \
|
|
||||||
echo '#undef USE_SGTTY /* <sys/ioctl.h> */' >> terminal.h; \
|
|
||||||
elif [ -f /usr/include/termios.h ]; then \
|
|
||||||
echo '/* use termios */' >> terminal.h; \
|
|
||||||
echo '#define USE_TERMIOS /* <termios.h> */' >> terminal.h; \
|
|
||||||
echo '#undef USE_TERMIO /* <termio.h> */' >> terminal.h; \
|
|
||||||
echo '#undef USE_SGTTY /* <sys/ioctl.h> */' >> terminal.h; \
|
|
||||||
elif [ -f /usr/include/termio.h ]; then \
|
|
||||||
echo '/* use termio */' >> terminal.h; \
|
echo '/* use termio */' >> terminal.h; \
|
||||||
echo '#undef USE_TERMIOS /* <termios.h> */' >> terminal.h; \
|
echo '#undef USE_TERMIOS /* <termios.h> */' >> terminal.h; \
|
||||||
echo '#define USE_TERMIO /* <termio.h> */' >> terminal.h; \
|
echo '#define USE_TERMIO /* <termio.h> */' >> terminal.h; \
|
||||||
@@ -2955,7 +2930,7 @@ have_const.h: have_const.c ${MAKE_FILE}
|
|||||||
${TRUE}; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
have_offscl.h: have_offscl.c ${MAKE_FILE}
|
have_offscl.h: have_offscl.c have_unistd.h ${MAKE_FILE}
|
||||||
${Q} ${RM} -f offscl_tmp have_offscl.h
|
${Q} ${RM} -f offscl_tmp have_offscl.h
|
||||||
${Q} echo 'forming have_offscl.h'
|
${Q} echo 'forming have_offscl.h'
|
||||||
${Q} echo '/*' > have_offscl.h
|
${Q} echo '/*' > have_offscl.h
|
||||||
@@ -2995,7 +2970,7 @@ have_offscl.h: have_offscl.c ${MAKE_FILE}
|
|||||||
${TRUE}; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
have_posscl.h: have_posscl.c have_fpos.h ${MAKE_FILE}
|
have_posscl.h: have_posscl.c have_fpos.h have_unistd.h ${MAKE_FILE}
|
||||||
${Q} ${RM} -f have_posscl have_posscl.o posscl_tmp have_posscl.h
|
${Q} ${RM} -f have_posscl have_posscl.o posscl_tmp have_posscl.h
|
||||||
${Q} echo 'forming have_posscl.h'
|
${Q} echo 'forming have_posscl.h'
|
||||||
${Q} echo '/*' > have_posscl.h
|
${Q} echo '/*' > have_posscl.h
|
||||||
@@ -3251,7 +3226,7 @@ have_ustat.h: have_ustat.c ${MAKE_FILE}
|
|||||||
${TRUE}; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
have_getsid.h: have_getsid.c ${MAKE_FILE}
|
have_getsid.h: have_getsid.c have_unistd.h ${MAKE_FILE}
|
||||||
${Q} ${RM} -f getsid_tmp have_getsid.h
|
${Q} ${RM} -f getsid_tmp have_getsid.h
|
||||||
${Q} echo 'forming have_getsid.h'
|
${Q} echo 'forming have_getsid.h'
|
||||||
${Q} echo '/*' > have_getsid.h
|
${Q} echo '/*' > have_getsid.h
|
||||||
@@ -3291,7 +3266,7 @@ have_getsid.h: have_getsid.c ${MAKE_FILE}
|
|||||||
${TRUE}; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
have_getpgid.h: have_getpgid.c ${MAKE_FILE}
|
have_getpgid.h: have_getpgid.c have_unistd.h ${MAKE_FILE}
|
||||||
${Q} ${RM} -f getpgid_tmp have_getpgid.h
|
${Q} ${RM} -f getpgid_tmp have_getpgid.h
|
||||||
${Q} echo 'forming have_getpgid.h'
|
${Q} echo 'forming have_getpgid.h'
|
||||||
${Q} echo '/*' > have_getpgid.h
|
${Q} echo '/*' > have_getpgid.h
|
||||||
@@ -3373,7 +3348,7 @@ have_gettime.h: have_gettime.c ${MAKE_FILE}
|
|||||||
${TRUE}; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
have_getprid.h: have_getprid.c ${MAKE_FILE}
|
have_getprid.h: have_getprid.c have_unistd.h ${MAKE_FILE}
|
||||||
${Q} ${RM} -f getprid_tmp have_getprid.h
|
${Q} ${RM} -f getprid_tmp have_getprid.h
|
||||||
${Q} echo 'forming have_getprid.h'
|
${Q} echo 'forming have_getprid.h'
|
||||||
${Q} echo '/*' > have_getprid.h
|
${Q} echo '/*' > have_getprid.h
|
||||||
@@ -3545,7 +3520,7 @@ args.h: have_stdvs.c have_varvs.c have_string.h have_unistd.h have_string.h
|
|||||||
${Q} echo '' >> args.h
|
${Q} echo '' >> args.h
|
||||||
${Q} echo '' >> args.h
|
${Q} echo '' >> args.h
|
||||||
${Q} ${RM} -f have_stdvs.o have_stdvs${EXT}
|
${Q} ${RM} -f have_stdvs.o have_stdvs${EXT}
|
||||||
-${Q} ${LCC} ${ICFLAGS} ${HAVE_VSPRINTF} have_stdvs.c -c \
|
-${Q} ${LCC} ${ICFLAGS} ${HAVE_VSNPRINTF} have_stdvs.c -c \
|
||||||
>/dev/null 2>&1; ${TRUE}
|
>/dev/null 2>&1; ${TRUE}
|
||||||
-${Q} ${LCC} ${ILDFLAGS} have_stdvs.o -o have_stdvs${EXT} \
|
-${Q} ${LCC} ${ILDFLAGS} have_stdvs.o -o have_stdvs${EXT} \
|
||||||
>/dev/null 2>&1; ${TRUE}
|
>/dev/null 2>&1; ${TRUE}
|
||||||
@@ -3554,10 +3529,10 @@ args.h: have_stdvs.c have_varvs.c have_string.h have_unistd.h have_string.h
|
|||||||
else \
|
else \
|
||||||
${TRUE}; \
|
${TRUE}; \
|
||||||
fi
|
fi
|
||||||
-${Q} if [ ! -f have_args.sh ] && [ X"${HAVE_VSPRINTF}" = X ]; then \
|
-${Q} if [ ! -f have_args.sh ] && [ X"${HAVE_VSNPRINTF}" = X ]; then \
|
||||||
${RM} -f have_stdvs.o have_stdvs${EXT} have_varvs.o; \
|
${RM} -f have_stdvs.o have_stdvs${EXT} have_varvs.o; \
|
||||||
${RM} -f have_varvs${EXT}; \
|
${RM} -f have_varvs${EXT}; \
|
||||||
${LCC} ${ICFLAGS} ${HAVE_VSPRINTF} have_varvs.c -c \
|
${LCC} ${ICFLAGS} ${HAVE_VSNPRINTF} have_varvs.c -c \
|
||||||
2>/dev/null; \
|
2>/dev/null; \
|
||||||
${LCC} ${ILDFLAGS} have_varvs.o -o have_varvs${EXT} 2>/dev/null; \
|
${LCC} ${ILDFLAGS} have_varvs.o -o have_varvs${EXT} 2>/dev/null; \
|
||||||
if ./have_varvs${EXT} >>args.h 2>/dev/null; then \
|
if ./have_varvs${EXT} >>args.h 2>/dev/null; then \
|
||||||
@@ -3573,8 +3548,8 @@ args.h: have_stdvs.c have_varvs.c have_string.h have_unistd.h have_string.h
|
|||||||
else \
|
else \
|
||||||
echo 'exit 1' > have_args.sh; \
|
echo 'exit 1' > have_args.sh; \
|
||||||
echo "Unable to determine what type of variable args and"; \
|
echo "Unable to determine what type of variable args and"; \
|
||||||
echo "what type of vsprintf() should be used. Set or change"; \
|
echo "what type of vsnprintf() should be used. Set or change"; \
|
||||||
echo "the Makefile variable HAVE_VSPRINTF."; \
|
echo "the Makefile variable HAVE_VSNPRINTF."; \
|
||||||
fi
|
fi
|
||||||
${Q} sh ./have_args.sh
|
${Q} sh ./have_args.sh
|
||||||
${Q} echo '' >> args.h
|
${Q} echo '' >> args.h
|
||||||
@@ -4057,12 +4032,18 @@ check: all ./cal/regress.cal
|
|||||||
chk: ./cal/regress.cal
|
chk: ./cal/regress.cal
|
||||||
${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
|
${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
|
||||||
${CALC_ENV} ./calc${EXT} -d -q read regress 2>&1 | ${AWK} -f check.awk
|
${CALC_ENV} ./calc${EXT} -d -q read regress 2>&1 | ${AWK} -f check.awk
|
||||||
|
@${MAKE} -f Makefile Q= V=@ distdir >/dev/null 2>&1
|
||||||
|
@${MAKE} -f Makefile Q= V=@ distlist >/dev/null 2>&1
|
||||||
|
${Q} echo 'chk OK'
|
||||||
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
|
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
|
||||||
|
|
||||||
###
|
###
|
||||||
#
|
#
|
||||||
# debug
|
# debug
|
||||||
#
|
#
|
||||||
|
# make calcinfo:
|
||||||
|
# * print information about the host and compile environment
|
||||||
|
#
|
||||||
# make env:
|
# make env:
|
||||||
# * print major Makefile variables
|
# * print major Makefile variables
|
||||||
#
|
#
|
||||||
@@ -4077,11 +4058,59 @@ chk: ./cal/regress.cal
|
|||||||
# * run the regression tests
|
# * run the regression tests
|
||||||
###
|
###
|
||||||
|
|
||||||
|
calcinfo:
|
||||||
|
@echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
|
||||||
|
@echo
|
||||||
|
@echo '=-=-= UNAME=${UNAME} =-=-='
|
||||||
|
@echo
|
||||||
|
@echo '=-=-= output of $${UNAME} -a follows =-=-='
|
||||||
|
-@${UNAME} -a
|
||||||
|
@echo '=-=-= end of output of $${UNAME} -a =-=-='
|
||||||
|
@echo
|
||||||
|
@echo '=-=-= HOSTNAME=${HOSTNAME} =-=-='
|
||||||
|
@echo
|
||||||
|
@echo '=-=-= output of $${HOSTNAME} follows =-=-='
|
||||||
|
-@${HOSTNAME}
|
||||||
|
@echo '=-=-= end of output of $${HOSTNAME} =-=-='
|
||||||
|
@echo
|
||||||
|
@echo '=-=-= DATE=${DATE} =-=-='
|
||||||
|
@echo
|
||||||
|
@echo '=-=-= output of $${DATE} follows =-=-='
|
||||||
|
-@${DATE}
|
||||||
|
@echo '=-=-= end of output of $${DATE} =-=-='
|
||||||
|
@echo
|
||||||
|
@echo '=-=-= LCC=${LCC} =-=-='
|
||||||
|
@echo
|
||||||
|
@echo '=-=-= output of $${LCC} -v follows =-=-='
|
||||||
|
-@${LCC} -v
|
||||||
|
@echo '=-=-= end of output of $${LCC} -v =-=-='
|
||||||
|
@echo
|
||||||
|
@echo '=-=-= PWD=${PWD} =-=-='
|
||||||
|
@echo
|
||||||
|
@echo '=-=-= output of echo $${PWD} follows =-=-='
|
||||||
|
-@echo ${PWD}
|
||||||
|
@echo '=-=-= end of output of echo $${PWD} =-=-='
|
||||||
|
@echo
|
||||||
|
@echo '=-=-= PWDCMD=${PWDCMD} =-=-='
|
||||||
|
@echo
|
||||||
|
@echo '=-=-= output of $${PWDCMD} follows =-=-='
|
||||||
|
-@${PWDCMD}
|
||||||
|
@echo '=-=-= end of output of $${PWDCMD} =-=-='
|
||||||
|
@echo
|
||||||
|
@echo '=-=-= VERSION=${VERSION} =-=-='
|
||||||
|
@echo
|
||||||
|
@echo '=-=-= output of echo $${VERSION} follows =-=-='
|
||||||
|
-@echo ${VERSION}
|
||||||
|
@echo '=-=-= end of output of echo $${VERSION} =-=-='
|
||||||
|
@echo
|
||||||
|
@echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@echo '=-=-=-=-= dumping major make variables =-=-=-=-='
|
@echo '=-=-=-=-= dumping major make variables =-=-=-=-='
|
||||||
@echo 'ALIGN32=${ALIGN32}'; echo ''
|
@echo 'ALIGN32=${ALIGN32}'; echo ''
|
||||||
@echo 'ALLOW_CUSTOM=${ALLOW_CUSTOM}'; echo ''
|
@echo 'ALLOW_CUSTOM=${ALLOW_CUSTOM}'; echo ''
|
||||||
@echo 'AR=${AR}'; echo ''
|
@echo 'AR=${AR}'; echo ''
|
||||||
|
@echo 'ARCH_CFLAGS=${ARCH_CFLAGS}'; echo ''
|
||||||
@echo 'AWK=${AWK}'; echo ''
|
@echo 'AWK=${AWK}'; echo ''
|
||||||
@echo 'BINDIR=${BINDIR}'; echo ''
|
@echo 'BINDIR=${BINDIR}'; echo ''
|
||||||
@echo 'BLD_TYPE=${BLD_TYPE}'; echo ''
|
@echo 'BLD_TYPE=${BLD_TYPE}'; echo ''
|
||||||
@@ -4126,6 +4155,7 @@ env:
|
|||||||
@echo 'CUSTOMINCDIR=${CUSTOMINCDIR}'; echo ''
|
@echo 'CUSTOMINCDIR=${CUSTOMINCDIR}'; echo ''
|
||||||
@echo 'CUSTOM_PASSDOWN=${CUSTOM_PASSDOWN}'; echo ''
|
@echo 'CUSTOM_PASSDOWN=${CUSTOM_PASSDOWN}'; echo ''
|
||||||
@echo 'C_SRC=${C_SRC}'; echo ''
|
@echo 'C_SRC=${C_SRC}'; echo ''
|
||||||
|
@echo 'DATE=${DATE}'; echo ''
|
||||||
@echo 'DEBUG=${DEBUG}'; echo ''
|
@echo 'DEBUG=${DEBUG}'; echo ''
|
||||||
@echo 'DEFAULT_LIB_INSTALL_PATH=${DEFAULT_LIB_INSTALL_PATH}'; echo ''
|
@echo 'DEFAULT_LIB_INSTALL_PATH=${DEFAULT_LIB_INSTALL_PATH}'; echo ''
|
||||||
@echo 'DEV_BITS=${DEV_BITS}'; echo ''
|
@echo 'DEV_BITS=${DEV_BITS}'; echo ''
|
||||||
@@ -4160,9 +4190,10 @@ env:
|
|||||||
@echo 'HAVE_UNUSED=${HAVE_UNUSED}'; echo ''
|
@echo 'HAVE_UNUSED=${HAVE_UNUSED}'; echo ''
|
||||||
@echo 'HAVE_URANDOM_H=${HAVE_URANDOM_H}'; echo ''
|
@echo 'HAVE_URANDOM_H=${HAVE_URANDOM_H}'; echo ''
|
||||||
@echo 'HAVE_USTAT=${HAVE_USTAT}'; echo ''
|
@echo 'HAVE_USTAT=${HAVE_USTAT}'; echo ''
|
||||||
@echo 'HAVE_VSPRINTF=${HAVE_VSPRINTF}'; echo ''
|
@echo 'HAVE_VSNPRINTF=${HAVE_VSNPRINTF}'; echo ''
|
||||||
@echo 'HELPDIR=${HELPDIR}'; echo ''
|
@echo 'HELPDIR=${HELPDIR}'; echo ''
|
||||||
@echo 'HELP_PASSDOWN=${HELP_PASSDOWN}'; echo ''
|
@echo 'HELP_PASSDOWN=${HELP_PASSDOWN}'; echo ''
|
||||||
|
@echo 'HOSTNAME=${HOSTNAME}'; echo ''
|
||||||
@echo 'H_SRC=${H_SRC}'; echo ''
|
@echo 'H_SRC=${H_SRC}'; echo ''
|
||||||
@echo 'ICFLAGS=${ICFLAGS}'; echo ''
|
@echo 'ICFLAGS=${ICFLAGS}'; echo ''
|
||||||
@echo 'ILDFLAGS=${ILDFLAGS}'; echo ''
|
@echo 'ILDFLAGS=${ILDFLAGS}'; echo ''
|
||||||
@@ -4186,7 +4217,6 @@ env:
|
|||||||
@echo 'LONG_BITS=${LONG_BITS}'; echo ''
|
@echo 'LONG_BITS=${LONG_BITS}'; echo ''
|
||||||
@echo 'MAKE=${MAKE}'; echo ''
|
@echo 'MAKE=${MAKE}'; echo ''
|
||||||
@echo 'MAKEDEPEND=${MAKEDEPEND}'; echo ''
|
@echo 'MAKEDEPEND=${MAKEDEPEND}'; echo ''
|
||||||
@echo 'MAKEFILE_REV=${MAKEFILE_REV}'; echo ''
|
|
||||||
@echo 'MAKE_FILE=${MAKE_FILE}'; echo ''
|
@echo 'MAKE_FILE=${MAKE_FILE}'; echo ''
|
||||||
@echo 'MANDIR=${MANDIR}'; echo ''
|
@echo 'MANDIR=${MANDIR}'; echo ''
|
||||||
@echo 'MANEXT=${MANEXT}'; echo ''
|
@echo 'MANEXT=${MANEXT}'; echo ''
|
||||||
@@ -4199,6 +4229,8 @@ env:
|
|||||||
@echo 'OBJS=${OBJS}'; echo ''
|
@echo 'OBJS=${OBJS}'; echo ''
|
||||||
@echo 'OFF_T_BITS=${OFF_T_BITS}'; echo ''
|
@echo 'OFF_T_BITS=${OFF_T_BITS}'; echo ''
|
||||||
@echo 'PURIFY=${PURIFY}'; echo ''
|
@echo 'PURIFY=${PURIFY}'; echo ''
|
||||||
|
@echo 'PWD=${PWD}'; echo ''
|
||||||
|
@echo 'PWDCMD=${PWDCMD}'; echo ''
|
||||||
@echo 'Q=${Q}'; echo ''
|
@echo 'Q=${Q}'; echo ''
|
||||||
@echo 'RANLIB=${RANLIB}'; echo ''
|
@echo 'RANLIB=${RANLIB}'; echo ''
|
||||||
@echo 'READLINE_EXTRAS=${READLINE_EXTRAS}'; echo ''
|
@echo 'READLINE_EXTRAS=${READLINE_EXTRAS}'; echo ''
|
||||||
@@ -4225,11 +4257,12 @@ env:
|
|||||||
@echo 'TOP_MAKE_FILE=${TOP_MAKE_FILE}'; echo ''
|
@echo 'TOP_MAKE_FILE=${TOP_MAKE_FILE}'; echo ''
|
||||||
@echo 'TOUCH=${TOUCH}'; echo ''
|
@echo 'TOUCH=${TOUCH}'; echo ''
|
||||||
@echo 'TRUE=${TRUE}'; echo ''
|
@echo 'TRUE=${TRUE}'; echo ''
|
||||||
|
@echo 'UNAME=${UNAME}'; echo ''
|
||||||
@echo 'USE_READLINE=${USE_READLINE}'; echo ''
|
@echo 'USE_READLINE=${USE_READLINE}'; echo ''
|
||||||
@echo 'UTIL_C_SRC=${UTIL_C_SRC}'; echo ''
|
@echo 'UTIL_C_SRC=${UTIL_C_SRC}'; echo ''
|
||||||
|
@echo 'UTIL_FILES=${UTIL_FILES}'; echo ''
|
||||||
@echo 'UTIL_MISC_SRC=${UTIL_MISC_SRC}'; echo ''
|
@echo 'UTIL_MISC_SRC=${UTIL_MISC_SRC}'; echo ''
|
||||||
@echo 'UTIL_OBJS=${UTIL_OBJS}'; echo ''
|
@echo 'UTIL_OBJS=${UTIL_OBJS}'; echo ''
|
||||||
@echo 'UTIL_FILES=${UTIL_FILES}'; echo ''
|
|
||||||
@echo 'UTIL_PROGS=${UTIL_PROGS}'; echo ''
|
@echo 'UTIL_PROGS=${UTIL_PROGS}'; echo ''
|
||||||
@echo 'UTIL_TMP=${UTIL_TMP}'; echo ''
|
@echo 'UTIL_TMP=${UTIL_TMP}'; echo ''
|
||||||
@echo 'V=${V}'; echo ''
|
@echo 'V=${V}'; echo ''
|
||||||
@@ -4251,7 +4284,7 @@ mkdebug: env version.c
|
|||||||
@echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-='
|
@echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-='
|
||||||
@echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
|
@echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
|
||||||
|
|
||||||
debug: env
|
debug: calcinfo env
|
||||||
@echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
|
@echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
|
||||||
@echo '=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ clobber =-=-=-='
|
@echo '=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ clobber =-=-=-='
|
||||||
@${MAKE} -f Makefile Q= V=@ clobber
|
@${MAKE} -f Makefile Q= V=@ clobber
|
||||||
@@ -4266,7 +4299,7 @@ debug: env
|
|||||||
@echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-='
|
@echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-='
|
||||||
@echo -n '=-=-=-= Print #defile values if custom functions '
|
@echo -n '=-=-=-= Print #defile values if custom functions '
|
||||||
@echo 'are allowed =-=-=-='
|
@echo 'are allowed =-=-=-='
|
||||||
-@./calc${EXT} -e -q -C 'print custom("sysinfo", 2);'
|
-@${CALC_ENV} ./calc${EXT} -e -q -C 'print custom("sysinfo", 2);'
|
||||||
@echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-='
|
@echo '=-=-=-= Back to the main Makefile for $@ rule =-=-=-='
|
||||||
@echo '=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ check =-=-=-='
|
@echo '=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ check =-=-=-='
|
||||||
@echo '=-=-= this may take a while =-=-='
|
@echo '=-=-= this may take a while =-=-='
|
||||||
@@ -5478,6 +5511,7 @@ help.o: have_string.h
|
|||||||
help.o: have_unistd.h
|
help.o: have_unistd.h
|
||||||
help.o: help.c
|
help.o: help.c
|
||||||
help.o: longbits.h
|
help.o: longbits.h
|
||||||
|
help.o: lib_calc.h
|
||||||
help.o: nametype.h
|
help.o: nametype.h
|
||||||
help.o: qmath.h
|
help.o: qmath.h
|
||||||
help.o: sha1.h
|
help.o: sha1.h
|
||||||
@@ -5504,6 +5538,7 @@ hist.o: have_unistd.h
|
|||||||
hist.o: have_unused.h
|
hist.o: have_unused.h
|
||||||
hist.o: hist.c
|
hist.o: hist.c
|
||||||
hist.o: hist.h
|
hist.o: hist.h
|
||||||
|
hist.o: lib_calc.h
|
||||||
hist.o: longbits.h
|
hist.o: longbits.h
|
||||||
hist.o: nametype.h
|
hist.o: nametype.h
|
||||||
hist.o: qmath.h
|
hist.o: qmath.h
|
||||||
|
54
QUESTIONS
Normal file
54
QUESTIONS
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
If you have a simple general question about calc, send Email to:
|
||||||
|
|
||||||
|
calc-quest-mail at asthe dot com
|
||||||
|
|
||||||
|
NOTE: Remove spaces and replace 'at' with @, and 'dot' with .
|
||||||
|
|
||||||
|
PLEASE put following the SPECIAL PHRASE somewhere in your Email Subject line:
|
||||||
|
|
||||||
|
calc question
|
||||||
|
|
||||||
|
You may add additional words to your subject line.
|
||||||
|
|
||||||
|
IMPORTANT: If your Email doesn't contain the above phrase,
|
||||||
|
then we WILL NOT SEE your Email.
|
||||||
|
|
||||||
|
PLEASE BE SURE you have that SPECIAL PHRASE somewhere in the subject line!
|
||||||
|
|
||||||
|
Suggestion:
|
||||||
|
|
||||||
|
From time to time, the Email address and Subject SPECIAL PHRASE
|
||||||
|
may change so verify you have the current info by visiting:
|
||||||
|
|
||||||
|
http://www.isthe.com/chongo/tech/comp/calc/calc-question.html
|
||||||
|
|
||||||
|
Please limit your questions to general questions about calc. We
|
||||||
|
cannot go into great detail in our answers, nor can we do your
|
||||||
|
homework, nor can we do much more than answer short general questions
|
||||||
|
about calc.
|
||||||
|
|
||||||
|
Please be patient as we cannot always respond to Email messages quickly.
|
||||||
|
|
||||||
|
=-=
|
||||||
|
|
||||||
|
## Copyright (C) 2021 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.
|
||||||
|
##
|
||||||
|
## Under source code control: 2021/02/10 00:15:05
|
||||||
|
## File existed as early as: 2021
|
||||||
|
##
|
||||||
|
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||||
|
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
79
README.FIRST
79
README.FIRST
@@ -32,30 +32,30 @@ something that you type in.
|
|||||||
|
|
||||||
For list of help topics:
|
For list of help topics:
|
||||||
|
|
||||||
> help
|
; help
|
||||||
|
|
||||||
For overview of calc overview:
|
For overview of calc overview:
|
||||||
|
|
||||||
> help intro
|
; help intro
|
||||||
> help overview
|
; help overview
|
||||||
> help command
|
; help command
|
||||||
> help define
|
; help define
|
||||||
> help statement
|
; help statement
|
||||||
> help variable
|
; help variable
|
||||||
> help usage
|
; help usage
|
||||||
|
|
||||||
For list of builtin functions:
|
For list of builtin functions:
|
||||||
|
|
||||||
> help builtin
|
; help builtin
|
||||||
|
|
||||||
C programmers should note some unexpected differences in the calc syntax:
|
C programmers should note some unexpected differences in the calc syntax:
|
||||||
|
|
||||||
> help unexpected
|
; help unexpected
|
||||||
|
|
||||||
Calc is shipped with a standard collection of calc resource files.
|
Calc is shipped with a standard collection of calc resource files.
|
||||||
For a list of calc standard resource files see:
|
For a list of calc standard resource files see:
|
||||||
|
|
||||||
> help resource
|
; help resource
|
||||||
|
|
||||||
=-=
|
=-=
|
||||||
|
|
||||||
@@ -71,66 +71,33 @@ or run:
|
|||||||
|
|
||||||
for a wish/todo list. Code contributions are welcome.
|
for a wish/todo list. Code contributions are welcome.
|
||||||
|
|
||||||
=-=
|
-=-
|
||||||
|
|
||||||
To subscribe to the calc-tester mailing list, visit the following URL:
|
If you you notice something wrong, strange or broken, see the file:
|
||||||
|
|
||||||
http://www.isthe.com/chongo/tech/comp/calc/calc-tester.html
|
BUGS
|
||||||
|
|
||||||
This is a low volume moderated mailing list.
|
or run:
|
||||||
|
|
||||||
This mailing list replaces calc-tester at asthe dot com list.
|
calc help bugs
|
||||||
|
|
||||||
If you need a human to help you with your mailing list subscription,
|
for information about how to report a bug.
|
||||||
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:
|
If you have a general question about calc, see the file:
|
||||||
|
|
||||||
calc-bug-report at asthe dot com
|
QUESTIONS
|
||||||
|
|
||||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
or run:
|
||||||
|
|
||||||
This replaces the old calc-bugs at asthe dot com address.
|
calc help questions
|
||||||
|
|
||||||
To be sure we see your EMail reporting a calc bug, please use the
|
for information about how to ask a question.
|
||||||
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:
|
## Copyright (C) 1999,2014,2017,2021 Landon Curt Noll
|
||||||
|
|
||||||
http://www.isthe.com/chongo/tech/comp/calc/
|
|
||||||
|
|
||||||
NOTE: The EMail address uses 'asthe', while the web site uses 'isthe'.
|
|
||||||
|
|
||||||
## Copyright (C) 1999,2014,2017 Landon Curt Noll
|
|
||||||
##
|
##
|
||||||
## Calc is open software; you can redistribute it and/or modify it under
|
## Calc is open software; you can redistribute it and/or modify it under
|
||||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
@@ -1,6 +1,9 @@
|
|||||||
# What is calc?
|
# What is calc?
|
||||||
|
|
||||||
Calc is an interactive calculator which provides for easy large
|
Calc is an interactive calculator which provides for easy large
|
||||||
|
numeric calculations, but which also can be easily programmed
|
||||||
|
for difficult or long calculations. It can accept a command line
|
||||||
|
argument, in which case it executes that single command and exits.
|
||||||
Otherwise, it enters interactive mode. In this mode, it accepts
|
Otherwise, it enters interactive mode. In this mode, it accepts
|
||||||
commands one at a time, processes them, and displays the answers.
|
commands one at a time, processes them, and displays the answers.
|
||||||
In the simplest case, commands are simply expressions which are
|
In the simplest case, commands are simply expressions which are
|
||||||
@@ -16,7 +19,7 @@ and the calculator will print:
|
|||||||
15
|
15
|
||||||
```
|
```
|
||||||
|
|
||||||
Calc as the usual collection of arithmetic operators +, -, /, * as
|
Calc has the usual collection of arithmetic operators +, -, /, * as
|
||||||
well as ^ (exponentiation), % (modulus) and // (integer divide).
|
well as ^ (exponentiation), % (modulus) and // (integer divide).
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
@@ -257,4 +260,4 @@ help unexpected
|
|||||||
```
|
```
|
||||||
|
|
||||||
It contains information about differences between C and calc
|
It contains information about differences between C and calc
|
||||||
that may surprize C programmers.
|
that may surprise C programmers.
|
||||||
|
4
blkcpy.c
4
blkcpy.c
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* blkcpy - general values and related routines used by the calculator
|
* blkcpy - general values and related routines used by the calculator
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007 Landon Curt Noll and Ernest Bowen
|
* Copyright (C) 1999-2007,2021 Landon Curt Noll and Ernest Bowen
|
||||||
*
|
*
|
||||||
* Primary author: Landon Curt Noll
|
* Primary author: Landon Curt Noll
|
||||||
*
|
*
|
||||||
@@ -1040,7 +1040,7 @@ copyblk2num(BLOCK *sblk, long ssi, long num, NUMBER *dnum, long dsi,
|
|||||||
NUMBER *ret; /* cloned and modified numerator */
|
NUMBER *ret; /* cloned and modified numerator */
|
||||||
#if CALC_BYTE_ORDER == BIG_ENDIAN
|
#if CALC_BYTE_ORDER == BIG_ENDIAN
|
||||||
HALF *swapped; /* byte swapped input data */
|
HALF *swapped; /* byte swapped input data */
|
||||||
unsigned long halflen; /* length of the input ounded up to HALFs */
|
unsigned long halflen; /* length of the input rounded up to HALFs */
|
||||||
HALF *h; /* copy byteswap pointer */
|
HALF *h; /* copy byteswap pointer */
|
||||||
unsigned long i;
|
unsigned long i;
|
||||||
#endif
|
#endif
|
||||||
|
4
block.c
4
block.c
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* block - fixed, dynamic, fifo and circular memory blocks
|
* block - fixed, dynamic, fifo and circular memory blocks
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007 Landon Curt Noll and Ernest Bowen
|
* Copyright (C) 1999-2007,2021 Landon Curt Noll and Ernest Bowen
|
||||||
*
|
*
|
||||||
* Primary author: Landon Curt Noll
|
* Primary author: Landon Curt Noll
|
||||||
*
|
*
|
||||||
@@ -291,7 +291,7 @@ blkrealloc(BLOCK *blk, int newlen, int newchunk)
|
|||||||
* Set the data length
|
* Set the data length
|
||||||
*
|
*
|
||||||
* We also know that the new block is not empty since we have
|
* We also know that the new block is not empty since we have
|
||||||
* already dealth with that case above.
|
* already dealt with that case above.
|
||||||
*
|
*
|
||||||
* After this section of code, limit and datalen will be
|
* After this section of code, limit and datalen will be
|
||||||
* correct in terms of the new type.
|
* correct in terms of the new type.
|
||||||
|
10
block.h
10
block.h
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* block - fixed, dynamic, fifo and circular memory blocks
|
* block - fixed, dynamic, fifo and circular memory blocks
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007,2014 Landon Curt Noll and Ernest Bowen
|
* Copyright (C) 1999-2007,2014,2021 Landon Curt Noll and Ernest Bowen
|
||||||
*
|
*
|
||||||
* Primary author: Landon Curt Noll
|
* Primary author: Landon Curt Noll
|
||||||
*
|
*
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
* blkchunk defaults to BLK_CHUNKSIZE
|
* blkchunk defaults to BLK_CHUNKSIZE
|
||||||
*
|
*
|
||||||
* blkfree(x)
|
* blkfree(x)
|
||||||
* Reduce storage down to 0 octetes.
|
* Reduce storage down to 0 octets.
|
||||||
*
|
*
|
||||||
* size(x)
|
* size(x)
|
||||||
* The length of data stored in the block.
|
* The length of data stored in the block.
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
* blkmove(dest, src, length [, dest_offset [, src_offset]])
|
* blkmove(dest, src, length [, dest_offset [, src_offset]])
|
||||||
* 0 <= length <= blksize(x)
|
* 0 <= length <= blksize(x)
|
||||||
* offset's are restricted in value by block type
|
* offset's are restricted in value by block type
|
||||||
* overlapping moves are handeled correctly
|
* overlapping moves are handled correctly
|
||||||
*
|
*
|
||||||
* blkccpy(dest, src, stopval, length [, dest_offset [, src_offset]])
|
* blkccpy(dest, src, stopval, length [, dest_offset [, src_offset]])
|
||||||
* 0 <= length <= blksize(x)
|
* 0 <= length <= blksize(x)
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
* b = a*k for some integer k >= 1
|
* b = a*k for some integer k >= 1
|
||||||
*
|
*
|
||||||
* scatter(src, dest1, dest2 [, dest3 ] ...)
|
* scatter(src, dest1, dest2 [, dest3 ] ...)
|
||||||
* copy sucessive octets from src into dest1, dest2, ...
|
* copy successive octets from src into dest1, dest2, ...
|
||||||
* restarting with dest1 after end of list
|
* restarting with dest1 after end of list
|
||||||
* stops at end of src
|
* stops at end of src
|
||||||
*
|
*
|
||||||
@@ -184,7 +184,7 @@ EXTERN int blk_debug; /* 0 => debug off */
|
|||||||
/* length of data stored in a block */
|
/* length of data stored in a block */
|
||||||
#define blklen(blk) ((blk)->datalen)
|
#define blklen(blk) ((blk)->datalen)
|
||||||
|
|
||||||
/* block footpint in memory */
|
/* block footprint in memory */
|
||||||
#define blksizeof(blk) ((blk)->maxsize)
|
#define blksizeof(blk) ((blk)->maxsize)
|
||||||
|
|
||||||
/* block allocation chunk size */
|
/* block allocation chunk size */
|
||||||
|
20
byteswap.c
20
byteswap.c
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* byteswap - byte swapping routines
|
* byteswap - byte swapping routines
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Landon Curt Noll
|
* Copyright (C) 1999,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -77,7 +77,7 @@ swap_b8_in_HALFs(HALF *dest, HALF *src, LEN len)
|
|||||||
* NULL to allocate the storage
|
* NULL to allocate the storage
|
||||||
* src - pointer to a ZVALUE to swap
|
* src - pointer to a ZVALUE to swap
|
||||||
* all - TRUE => swap every element, FALSE => swap only the
|
* all - TRUE => swap every element, FALSE => swap only the
|
||||||
* multiprecision storage
|
* multi-precision storage
|
||||||
*
|
*
|
||||||
* returns:
|
* returns:
|
||||||
* pointer to where the swapped src has been put
|
* pointer to where the swapped src has been put
|
||||||
@@ -145,7 +145,7 @@ swap_b8_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all)
|
|||||||
* NULL to allocate the storage
|
* NULL to allocate the storage
|
||||||
* src - pointer to a NUMBER to swap
|
* src - pointer to a NUMBER to swap
|
||||||
* all - TRUE => swap every element, FALSE => swap only the
|
* all - TRUE => swap every element, FALSE => swap only the
|
||||||
* multiprecision storage
|
* multi-precision storage
|
||||||
*
|
*
|
||||||
* returns:
|
* returns:
|
||||||
* pointer to where the swapped src has been put
|
* pointer to where the swapped src has been put
|
||||||
@@ -209,7 +209,7 @@ swap_b8_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all)
|
|||||||
* NULL to allocate the storage
|
* NULL to allocate the storage
|
||||||
* src - pointer to a COMPLEX to swap
|
* src - pointer to a COMPLEX to swap
|
||||||
* all - TRUE => swap every element, FALSE => swap only the
|
* all - TRUE => swap every element, FALSE => swap only the
|
||||||
* multiprecision storage
|
* multi-precision storage
|
||||||
*
|
*
|
||||||
* returns:
|
* returns:
|
||||||
* pointer to where the swapped src has been put
|
* pointer to where the swapped src has been put
|
||||||
@@ -313,7 +313,7 @@ swap_b16_in_HALFs(HALF *dest, HALF *src, LEN len)
|
|||||||
* NULL to allocate the storage
|
* NULL to allocate the storage
|
||||||
* src - pointer to a ZVALUE to swap
|
* src - pointer to a ZVALUE to swap
|
||||||
* all - TRUE => swap every element, FALSE => swap only the
|
* all - TRUE => swap every element, FALSE => swap only the
|
||||||
* multiprecision storage
|
* multi-precision storage
|
||||||
*
|
*
|
||||||
* returns:
|
* returns:
|
||||||
* pointer to where the swapped src has been put
|
* pointer to where the swapped src has been put
|
||||||
@@ -380,7 +380,7 @@ swap_b16_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all)
|
|||||||
* NULL to allocate the storage
|
* NULL to allocate the storage
|
||||||
* src - pointer to a NUMBER to swap
|
* src - pointer to a NUMBER to swap
|
||||||
* all - TRUE => swap every element, FALSE => swap only the
|
* all - TRUE => swap every element, FALSE => swap only the
|
||||||
* multiprecision storage
|
* multi-precision storage
|
||||||
*
|
*
|
||||||
* returns:
|
* returns:
|
||||||
* pointer to where the swapped src has been put
|
* pointer to where the swapped src has been put
|
||||||
@@ -444,7 +444,7 @@ swap_b16_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all)
|
|||||||
* NULL to allocate the storage
|
* NULL to allocate the storage
|
||||||
* src - pointer to a COMPLEX to swap
|
* src - pointer to a COMPLEX to swap
|
||||||
* all - TRUE => swap every element, FALSE => swap only the
|
* all - TRUE => swap every element, FALSE => swap only the
|
||||||
* multiprecision storage
|
* multi-precision storage
|
||||||
*
|
*
|
||||||
* returns:
|
* returns:
|
||||||
* pointer to where the swapped src has been put
|
* pointer to where the swapped src has been put
|
||||||
@@ -508,7 +508,7 @@ swap_b16_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all)
|
|||||||
* NULL to allocate the storage
|
* NULL to allocate the storage
|
||||||
* src - pointer to a ZVALUE to swap
|
* src - pointer to a ZVALUE to swap
|
||||||
* all - TRUE => swap every element, FALSE => swap only the
|
* all - TRUE => swap every element, FALSE => swap only the
|
||||||
* multiprecision storage
|
* multi-precision storage
|
||||||
*
|
*
|
||||||
* returns:
|
* returns:
|
||||||
* pointer to where the swapped src has been put
|
* pointer to where the swapped src has been put
|
||||||
@@ -576,7 +576,7 @@ swap_HALF_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all)
|
|||||||
* NULL to allocate the storage
|
* NULL to allocate the storage
|
||||||
* src - pointer to a NUMBER to swap
|
* src - pointer to a NUMBER to swap
|
||||||
* all - TRUE => swap every element, FALSE => swap only the
|
* all - TRUE => swap every element, FALSE => swap only the
|
||||||
* multiprecision storage
|
* multi-precision storage
|
||||||
*
|
*
|
||||||
* returns:
|
* returns:
|
||||||
* pointer to where the swapped src has been put
|
* pointer to where the swapped src has been put
|
||||||
@@ -640,7 +640,7 @@ swap_HALF_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all)
|
|||||||
* NULL to allocate the storage
|
* NULL to allocate the storage
|
||||||
* src - pointer to a COMPLEX to swap
|
* src - pointer to a COMPLEX to swap
|
||||||
* all - TRUE => swap every element, FALSE => swap only the
|
* all - TRUE => swap every element, FALSE => swap only the
|
||||||
* multiprecision storage
|
* multi-precision storage
|
||||||
*
|
*
|
||||||
* returns:
|
* returns:
|
||||||
* pointer to where the swapped src has been put
|
* pointer to where the swapped src has been put
|
||||||
|
10
cal/Makefile
10
cal/Makefile
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# cal - makefile for calc standard resource files
|
# cal - makefile for calc standard resource files
|
||||||
#
|
#
|
||||||
# Copyright (C) 1999-2006,2017 Landon Curt Noll
|
# Copyright (C) 1999-2006,2017,2021 Landon Curt Noll
|
||||||
#
|
#
|
||||||
# Calc is open software; you can redistribute it and/or modify it under
|
# Calc is open software; you can redistribute it and/or modify it under
|
||||||
# the terms of the version 2.1 of the GNU Lesser General Public License
|
# the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -181,14 +181,14 @@ FMT= fmt
|
|||||||
|
|
||||||
# The calc files to install
|
# The calc files to install
|
||||||
#
|
#
|
||||||
# This list is prodiced by the detaillist rule when no WARNINGS are detected.
|
# This list is produced by the detaillist rule when no WARNINGS are detected.
|
||||||
#
|
#
|
||||||
# Please use:
|
# Please use:
|
||||||
#
|
#
|
||||||
# make calc_files_list
|
# make calc_files_list
|
||||||
#
|
#
|
||||||
# to keep this list in nice sorted order and to check that these
|
# to keep this list in nice sorted order and to check that these
|
||||||
# deailed help files are under RCS control.
|
# detailed help files are under RCS control.
|
||||||
#
|
#
|
||||||
CALC_FILES= README alg_config.cal beer.cal bernoulli.cal \
|
CALC_FILES= README alg_config.cal beer.cal bernoulli.cal \
|
||||||
bernpoly.cal bigprime.cal bindings brentsolve.cal chi.cal chrem.cal \
|
bernpoly.cal bigprime.cal bindings brentsolve.cal chi.cal chrem.cal \
|
||||||
@@ -236,7 +236,7 @@ all: ${CALC_FILES} ${MAKE_FILE} .all
|
|||||||
# sub-directory called calc/cal.
|
# sub-directory called calc/cal.
|
||||||
#
|
#
|
||||||
# NOTE: Due to bogus shells found on one common system we must have
|
# NOTE: Due to bogus shells found on one common system we must have
|
||||||
# an non-emoty else clause for every if condition. *sigh*
|
# an non-empty else clause for every if condition. *sigh*
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
|
|
||||||
@@ -391,7 +391,7 @@ uninstall:
|
|||||||
if [ -f "${T}${CALC_SHAREDIR}/$$i" ]; then \
|
if [ -f "${T}${CALC_SHAREDIR}/$$i" ]; then \
|
||||||
echo "cannot uninstall ${T}${CALC_SHAREDIR}/$$i"; \
|
echo "cannot uninstall ${T}${CALC_SHAREDIR}/$$i"; \
|
||||||
else \
|
else \
|
||||||
echo "uninstalled ${T}${CALC_SHAREDIR}/$$i"; \
|
echo "un-installed ${T}${CALC_SHAREDIR}/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
73
cal/README
73
cal/README
@@ -38,43 +38,6 @@ 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
|
how use the calc language, and/or because the authors thought them to
|
||||||
be useful!
|
be useful!
|
||||||
|
|
||||||
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:
|
|
||||||
|
|
||||||
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,
|
By convention, a resource file only defines and/or initializes functions,
|
||||||
@@ -250,12 +213,12 @@ brentsolve.cal
|
|||||||
|
|
||||||
brentsolve(low, high,eps)
|
brentsolve(low, high,eps)
|
||||||
|
|
||||||
A root-finder implementwed with the Brent-Dekker trick.
|
A root-finder implemented with the Brent-Dekker trick.
|
||||||
|
|
||||||
brentsolve2(low, high,which,eps)
|
brentsolve2(low, high,which,eps)
|
||||||
|
|
||||||
The second function, brentsolve2(low, high,which,eps) has some lines
|
The second function, brentsolve2(low, high,which,eps) has some lines
|
||||||
added to make it easier to hardcode the name of the helper function
|
added to make it easier to hard-code the name of the helper function
|
||||||
different from the obligatory "f".
|
different from the obligatory "f".
|
||||||
|
|
||||||
See:
|
See:
|
||||||
@@ -429,7 +392,7 @@ factorial2.cal
|
|||||||
|
|
||||||
bigcatalan(n)
|
bigcatalan(n)
|
||||||
|
|
||||||
Calculates the n-th Catalan number for n large. It is usefull
|
Calculates the n-th Catalan number for n large. It is useful
|
||||||
above n~50,000 but defaults to the builtin function for smaller
|
above n~50,000 but defaults to the builtin function for smaller
|
||||||
values.Meant as a complete replacement for catalan(n) with only a
|
values.Meant as a complete replacement for catalan(n) with only a
|
||||||
very small overhead. See:
|
very small overhead. See:
|
||||||
@@ -470,9 +433,9 @@ factorial2.cal
|
|||||||
k = 0
|
k = 0
|
||||||
|
|
||||||
The other function stirling2caching(n,m) does it by way of the
|
The other function stirling2caching(n,m) does it by way of the
|
||||||
reccurence relation and keeps all earlier results. This function
|
re-occurrence relation and keeps all earlier results. This function
|
||||||
is much slower for computing a single value than stirling2(n,m) but
|
is much slower for computing a single value than stirling2(n,m) but
|
||||||
is very usefull if many Stirling numbers are needed, for example in
|
is very useful if many Stirling numbers are needed, for example in
|
||||||
a series. See:
|
a series. See:
|
||||||
|
|
||||||
http://en.wikipedia.org/wiki/Stirling_numbers_of_the_second_kind
|
http://en.wikipedia.org/wiki/Stirling_numbers_of_the_second_kind
|
||||||
@@ -583,7 +546,7 @@ infinities.cal
|
|||||||
pinf()
|
pinf()
|
||||||
|
|
||||||
The symbolic handling of infinities. Needed for intnum.cal but might be
|
The symbolic handling of infinities. Needed for intnum.cal but might be
|
||||||
usefull elsewhere, too.
|
useful elsewhere, too.
|
||||||
|
|
||||||
|
|
||||||
intfile.cal
|
intfile.cal
|
||||||
@@ -632,13 +595,13 @@ intnum.cal
|
|||||||
This file offers some methods for numerical integration. Implemented are
|
This file offers some methods for numerical integration. Implemented are
|
||||||
the Gauss-Legendre and the tanh-sinh quadrature.
|
the Gauss-Legendre and the tanh-sinh quadrature.
|
||||||
|
|
||||||
All functions are usefull to some extend but the main function for
|
All functions are useful to some extend but the main function for
|
||||||
quadrature is quad(), which is not much more than an abstraction layer.
|
quadrature is quad(), which is not much more than an abstraction layer.
|
||||||
|
|
||||||
The main workers are quadgl() for Gauss-legendre and quadts() for the
|
The main workers are quadgl() for Gauss-Legendre and quadts() for the
|
||||||
tanh-sinh quadrature. The limits of the integral can be anything in the
|
tanh-sinh quadrature. The limits of the integral can be anything in the
|
||||||
complex plane and the extended real line. The latter means that infinite
|
complex plane and the extended real line. The latter means that infinite
|
||||||
limits are supported by way of the smbolic infinities implemented in the
|
limits are supported by way of the symbolic infinities implemented in the
|
||||||
file infinities.cal (automatically linked in by intnum.cal).
|
file infinities.cal (automatically linked in by intnum.cal).
|
||||||
|
|
||||||
Integration in parts and contour is supported by the "points" argument
|
Integration in parts and contour is supported by the "points" argument
|
||||||
@@ -698,7 +661,7 @@ intnum.cal
|
|||||||
|
|
||||||
The quad*core functions do not offer anything fancy but the third parameter
|
The quad*core functions do not offer anything fancy but the third parameter
|
||||||
controls the so called "order" which is just the number of nodes computed.
|
controls the so called "order" which is just the number of nodes computed.
|
||||||
This can be quite usefull in some circumstances.
|
This can be quite useful in some circumstances.
|
||||||
|
|
||||||
; quadgldeletenodes()
|
; quadgldeletenodes()
|
||||||
; define f(x){ return exp(x);}
|
; define f(x){ return exp(x);}
|
||||||
@@ -760,7 +723,7 @@ lambertw.cal
|
|||||||
ProductLog[branch,z] with the tested values.
|
ProductLog[branch,z] with the tested values.
|
||||||
|
|
||||||
The series is only valid for the branches 0,-1, real z, converges
|
The series is only valid for the branches 0,-1, real z, converges
|
||||||
for values of z _very_ near the branchpoint -exp(-1) only, and must
|
for values of z _very_ near the branch-point -exp(-1) only, and must
|
||||||
be given the branches explicitly. See the code in lambertw.cal
|
be given the branches explicitly. See the code in lambertw.cal
|
||||||
for further information.
|
for further information.
|
||||||
|
|
||||||
@@ -783,7 +746,7 @@ lnseries.cal
|
|||||||
does so by computing the prime factorization of all of the number
|
does so by computing the prime factorization of all of the number
|
||||||
sequence 1,2,3...n, calculates the natural logarithms of the primes
|
sequence 1,2,3...n, calculates the natural logarithms of the primes
|
||||||
in 1,2,3...n and uses the above factorization to build the natural
|
in 1,2,3...n and uses the above factorization to build the natural
|
||||||
logarithms of the rest of the sequence by sadding the logarithms of
|
logarithms of the rest of the sequence by adding the logarithms of
|
||||||
the primes in the factorization. This is faster for high precision
|
the primes in the factorization. This is faster for high precision
|
||||||
of the logarithms and/or long sequences.
|
of the logarithms and/or long sequences.
|
||||||
|
|
||||||
@@ -843,7 +806,7 @@ mfactor.cal
|
|||||||
at 2*start_k*n+1. Skips values that are multiples of primes <= p_elim.
|
at 2*start_k*n+1. Skips values that are multiples of primes <= p_elim.
|
||||||
By default, start_k == 1, rept_loop = 10000 and p_elim = 17.
|
By default, start_k == 1, rept_loop = 10000 and p_elim = 17.
|
||||||
|
|
||||||
The p_elim == 17 overhead takes ~3 minutes on an 200 Mhz r4k CPU and
|
The p_elim == 17 overhead takes ~3 minutes on an 200 MHz r4k CPU and
|
||||||
requires about ~13 Megs of memory. The p_elim == 13 overhead
|
requires about ~13 Megs of memory. The p_elim == 13 overhead
|
||||||
takes about 3 seconds and requires ~1.5 Megs of memory.
|
takes about 3 seconds and requires ~1.5 Megs of memory.
|
||||||
|
|
||||||
@@ -1354,7 +1317,7 @@ specialfunctions.cal
|
|||||||
http://en.wikipedia.org/wiki/Polygamma
|
http://en.wikipedia.org/wiki/Polygamma
|
||||||
http://dlmf.nist.gov/5
|
http://dlmf.nist.gov/5
|
||||||
|
|
||||||
for information on the n-th derivative ofthe Euler gamma function. This
|
for information on the n-th derivative of the Euler gamma function. This
|
||||||
function depends on the script zeta2.cal.
|
function depends on the script zeta2.cal.
|
||||||
|
|
||||||
|
|
||||||
@@ -1371,7 +1334,7 @@ specialfunctions.cal
|
|||||||
|
|
||||||
zeta(s)
|
zeta(s)
|
||||||
|
|
||||||
Calculates the value of the Rieman Zeta function at s. See:
|
Calculates the value of the Riemann Zeta function at s. See:
|
||||||
|
|
||||||
http://en.wikipedia.org/wiki/Riemann_zeta_function
|
http://en.wikipedia.org/wiki/Riemann_zeta_function
|
||||||
http://dlmf.nist.gov/25.2
|
http://dlmf.nist.gov/25.2
|
||||||
@@ -1390,7 +1353,7 @@ statistics.cal
|
|||||||
invbetainc(x,a,b)
|
invbetainc(x,a,b)
|
||||||
|
|
||||||
Computes the inverse of the regularized beta function. Does so the
|
Computes the inverse of the regularized beta function. Does so the
|
||||||
brute-force way wich makes it a bit slower.
|
brute-force way which makes it a bit slower.
|
||||||
|
|
||||||
betapdf(x,a,b)
|
betapdf(x,a,b)
|
||||||
betacdf(x,a,b)
|
betacdf(x,a,b)
|
||||||
@@ -1470,7 +1433,7 @@ sumtimes.cal
|
|||||||
Give the user CPU time for various ways of evaluating sums, sums of
|
Give the user CPU time for various ways of evaluating sums, sums of
|
||||||
squares, etc, for large lists and matrices. N is the size of
|
squares, etc, for large lists and matrices. N is the size of
|
||||||
the list or matrix to use. The doalltimes() function will run
|
the list or matrix to use. The doalltimes() function will run
|
||||||
all fo the sumtimes tests. For example:
|
all of the sumtimes tests. For example:
|
||||||
|
|
||||||
doalltimes(1e6);
|
doalltimes(1e6);
|
||||||
|
|
||||||
@@ -1816,7 +1779,7 @@ zeta2.cal
|
|||||||
for information on this special zeta function.
|
for information on this special zeta function.
|
||||||
|
|
||||||
|
|
||||||
## Copyright (C) 2000,2014,2017 David I. Bell and Landon Curt Noll
|
## Copyright (C) 2000,2014,2017,2021 David I. Bell and Landon Curt Noll
|
||||||
##
|
##
|
||||||
## Primary author: Landon Curt Noll
|
## Primary author: Landon Curt Noll
|
||||||
##
|
##
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* alg_config - help determine optimal values for algorithm levels
|
* alg_config - help determine optimal values for algorithm levels
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006,2014 Landon Curt Noll
|
* Copyright (C) 2006,2014,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -33,7 +33,7 @@ static test_time; /* try for this many seconds in loop test */
|
|||||||
* given:
|
* given:
|
||||||
* ratio the ratio of time between two algorithms
|
* ratio the ratio of time between two algorithms
|
||||||
*
|
*
|
||||||
* retuns:
|
* returns:
|
||||||
* 1 When ratio is near 1.0
|
* 1 When ratio is near 1.0
|
||||||
* 0 otherwise
|
* 0 otherwise
|
||||||
*
|
*
|
||||||
@@ -354,7 +354,7 @@ define best_mul2()
|
|||||||
local high; /* high loop value tested */
|
local high; /* high loop value tested */
|
||||||
local mid; /* between low and high */
|
local mid; /* between low and high */
|
||||||
local best_val; /* value found with ratio closest to unity */
|
local best_val; /* value found with ratio closest to unity */
|
||||||
local best_ratio; /* cloest ratio found to unity */
|
local best_ratio; /* closest ratio found to unity */
|
||||||
local expand; /* how fast to expand the length */
|
local expand; /* how fast to expand the length */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -363,7 +363,7 @@ define best_mul2()
|
|||||||
printf("WARNING: This tool may not be computing the correct best value\n");
|
printf("WARNING: This tool may not be computing the correct best value\n");
|
||||||
test_time = 5.0;
|
test_time = 5.0;
|
||||||
printf("The best_mul2() function will take a LONG time to run!\n");
|
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");
|
printf("It is important that best_mul2() run on an otherwise idle host!\n");
|
||||||
if (config("user_debug") <= 0) {
|
if (config("user_debug") <= 0) {
|
||||||
printf("To monitor progress, set user_debug to 2: "
|
printf("To monitor progress, set user_debug to 2: "
|
||||||
"config(\"user_debug\", 2)\n");
|
"config(\"user_debug\", 2)\n");
|
||||||
@@ -392,7 +392,7 @@ define best_mul2()
|
|||||||
*/
|
*/
|
||||||
do {
|
do {
|
||||||
/*
|
/*
|
||||||
* determine the paramters of the next ratio test
|
* determine the parameters of the next ratio test
|
||||||
*
|
*
|
||||||
* We will multiplicatively expand our test level until
|
* We will multiplicatively expand our test level until
|
||||||
* the ratio drops below 1.0.
|
* the ratio drops below 1.0.
|
||||||
@@ -419,7 +419,7 @@ define best_mul2()
|
|||||||
best_val = high;
|
best_val = high;
|
||||||
best_ratio = ratio;
|
best_ratio = ratio;
|
||||||
if (config("user_debug") > 1) {
|
if (config("user_debug") > 1) {
|
||||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
printf(" len %d has a new closest ratio to unity: %.6f\n",
|
||||||
best_val, best_ratio);
|
best_val, best_ratio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -442,7 +442,7 @@ define best_mul2()
|
|||||||
high /= 2;
|
high /= 2;
|
||||||
low = high / 2;
|
low = high / 2;
|
||||||
if (config("user_debug") > 0) {
|
if (config("user_debug") > 0) {
|
||||||
printf("retesting multiply alg1/alg2 ratio for len = %d\n",
|
printf("re-testing multiply alg1/alg2 ratio for len = %d\n",
|
||||||
high);
|
high);
|
||||||
}
|
}
|
||||||
ratio = mul_ratio(high);
|
ratio = mul_ratio(high);
|
||||||
@@ -450,7 +450,8 @@ define best_mul2()
|
|||||||
best_val = high;
|
best_val = high;
|
||||||
best_ratio = ratio;
|
best_ratio = ratio;
|
||||||
if (config("user_debug") > 1) {
|
if (config("user_debug") > 1) {
|
||||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
printf(" len %d has a new closest ratio "
|
||||||
|
"to unity: %.6f\n",
|
||||||
best_val, best_ratio);
|
best_val, best_ratio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -483,7 +484,7 @@ define best_mul2()
|
|||||||
best_val = mid;
|
best_val = mid;
|
||||||
best_ratio = ratio;
|
best_ratio = ratio;
|
||||||
if (config("user_debug") > 1) {
|
if (config("user_debug") > 1) {
|
||||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
printf(" len %d has a new closest ratio to unity: %.6f\n",
|
||||||
best_val, best_ratio);
|
best_val, best_ratio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -535,7 +536,7 @@ define best_mul2()
|
|||||||
printf("config(\"mul2\", %d),;\n", best_val);
|
printf("config(\"mul2\", %d),;\n", best_val);
|
||||||
printf("WARNING: It is believed that the output "
|
printf("WARNING: It is believed that the output "
|
||||||
"of this resource file is bogus!\n");
|
"of this resource file is bogus!\n");
|
||||||
printf("WARNING: You may NOT wish to follow the above suggeston.\n");
|
printf("WARNING: You may NOT wish to follow the above suggestion.\n");
|
||||||
}
|
}
|
||||||
return mid;
|
return mid;
|
||||||
}
|
}
|
||||||
@@ -835,7 +836,7 @@ define best_sq2()
|
|||||||
local high; /* high loop value tested */
|
local high; /* high loop value tested */
|
||||||
local mid; /* between low and high */
|
local mid; /* between low and high */
|
||||||
local best_val; /* value found with ratio closest to unity */
|
local best_val; /* value found with ratio closest to unity */
|
||||||
local best_ratio; /* cloest ratio found to unity */
|
local best_ratio; /* closest ratio found to unity */
|
||||||
local expand; /* how fast to expand the length */
|
local expand; /* how fast to expand the length */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -844,7 +845,7 @@ define best_sq2()
|
|||||||
printf("WARNING: This tool may not be computing the correct best value\n");
|
printf("WARNING: This tool may not be computing the correct best value\n");
|
||||||
test_time = 5.0;
|
test_time = 5.0;
|
||||||
printf("The best_sq2() function will take a LONG time to run!\n");
|
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");
|
printf("It is important that best_sq2() run on an otherwise idle host!\n");
|
||||||
if (config("user_debug") <= 0) {
|
if (config("user_debug") <= 0) {
|
||||||
printf("To monitor progress, set user_debug to 2: "
|
printf("To monitor progress, set user_debug to 2: "
|
||||||
"config(\"user_debug\", 2)\n");
|
"config(\"user_debug\", 2)\n");
|
||||||
@@ -873,7 +874,7 @@ define best_sq2()
|
|||||||
*/
|
*/
|
||||||
do {
|
do {
|
||||||
/*
|
/*
|
||||||
* determine the paramters of the next ratio test
|
* determine the parameters of the next ratio test
|
||||||
*
|
*
|
||||||
* We will multiplicatively expand our test level until
|
* We will multiplicatively expand our test level until
|
||||||
* the ratio drops below 1.0.
|
* the ratio drops below 1.0.
|
||||||
@@ -900,7 +901,7 @@ define best_sq2()
|
|||||||
best_val = high;
|
best_val = high;
|
||||||
best_ratio = ratio;
|
best_ratio = ratio;
|
||||||
if (config("user_debug") > 1) {
|
if (config("user_debug") > 1) {
|
||||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
printf(" len %d has a new closest ratio to unity: %.6f\n",
|
||||||
best_val, best_ratio);
|
best_val, best_ratio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -923,7 +924,7 @@ define best_sq2()
|
|||||||
high /= 2;
|
high /= 2;
|
||||||
low = high / 2;
|
low = high / 2;
|
||||||
if (config("user_debug") > 0) {
|
if (config("user_debug") > 0) {
|
||||||
printf("retesting multiply alg1/alg2 ratio for len = %d\n",
|
printf("re-testing multiply alg1/alg2 ratio for len = %d\n",
|
||||||
high);
|
high);
|
||||||
}
|
}
|
||||||
ratio = mul_ratio(high);
|
ratio = mul_ratio(high);
|
||||||
@@ -931,7 +932,8 @@ define best_sq2()
|
|||||||
best_val = high;
|
best_val = high;
|
||||||
best_ratio = ratio;
|
best_ratio = ratio;
|
||||||
if (config("user_debug") > 1) {
|
if (config("user_debug") > 1) {
|
||||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
printf(" len %d has a new closest ratio "
|
||||||
|
"to unity: %.6f\n",
|
||||||
best_val, best_ratio);
|
best_val, best_ratio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -964,7 +966,7 @@ define best_sq2()
|
|||||||
best_val = mid;
|
best_val = mid;
|
||||||
best_ratio = ratio;
|
best_ratio = ratio;
|
||||||
if (config("user_debug") > 1) {
|
if (config("user_debug") > 1) {
|
||||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
printf(" len %d has a new closest ratio to unity: %.6f\n",
|
||||||
best_val, best_ratio);
|
best_val, best_ratio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1017,7 +1019,7 @@ define best_sq2()
|
|||||||
printf("config(\"sq2\", %d),;\n", best_val);
|
printf("config(\"sq2\", %d),;\n", best_val);
|
||||||
printf("WARNING: It is believed that the output "
|
printf("WARNING: It is believed that the output "
|
||||||
"of this resource file is bogus!\n");
|
"of this resource file is bogus!\n");
|
||||||
printf("WARNING: You may NOT wish to follow the above suggeston.\n");
|
printf("WARNING: You may NOT wish to follow the above suggestion.\n");
|
||||||
}
|
}
|
||||||
return mid;
|
return mid;
|
||||||
}
|
}
|
||||||
@@ -1337,7 +1339,7 @@ define best_pow2()
|
|||||||
local high; /* high loop value tested */
|
local high; /* high loop value tested */
|
||||||
local mid; /* between low and high */
|
local mid; /* between low and high */
|
||||||
local best_val; /* value found with ratio closest to unity */
|
local best_val; /* value found with ratio closest to unity */
|
||||||
local best_ratio; /* cloest ratio found to unity */
|
local best_ratio; /* closest ratio found to unity */
|
||||||
local expand; /* how fast to expand the length */
|
local expand; /* how fast to expand the length */
|
||||||
local looped; /* 1 ==> we have expanded lengths before */
|
local looped; /* 1 ==> we have expanded lengths before */
|
||||||
|
|
||||||
@@ -1347,7 +1349,7 @@ define best_pow2()
|
|||||||
printf("WARNING: This tool may not be computing the correct best value\n");
|
printf("WARNING: This tool may not be computing the correct best value\n");
|
||||||
test_time = 60.0;
|
test_time = 60.0;
|
||||||
printf("The best_pow2() function will take a LONG time to run!\n");
|
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");
|
printf("It is important that best_pow2() run on an otherwise idle host!\n");
|
||||||
if (config("user_debug") <= 0) {
|
if (config("user_debug") <= 0) {
|
||||||
printf("To monitor progress, set user_debug to 2: "
|
printf("To monitor progress, set user_debug to 2: "
|
||||||
"config(\"user_debug\", 2)\n");
|
"config(\"user_debug\", 2)\n");
|
||||||
@@ -1358,7 +1360,7 @@ define best_pow2()
|
|||||||
* firewall - must have a >1.02 ratio for the initial length
|
* firewall - must have a >1.02 ratio for the initial length
|
||||||
*
|
*
|
||||||
* We select 1.02 because of the precision of the CPU timing. We
|
* We select 1.02 because of the precision of the CPU timing. We
|
||||||
* want to firt move into an area where the 1st algoritm clearly
|
* want to first move into an area where the 1st algorithm clearly
|
||||||
* dominates.
|
* dominates.
|
||||||
*/
|
*/
|
||||||
low = 4;
|
low = 4;
|
||||||
@@ -1375,7 +1377,7 @@ define best_pow2()
|
|||||||
best_val = high;
|
best_val = high;
|
||||||
best_ratio = ratio;
|
best_ratio = ratio;
|
||||||
if (config("user_debug") > 1) {
|
if (config("user_debug") > 1) {
|
||||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
printf(" len %d has a new closest ratio to unity: %.6f\n",
|
||||||
best_val, best_ratio);
|
best_val, best_ratio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1397,7 +1399,7 @@ define best_pow2()
|
|||||||
looped = 0;
|
looped = 0;
|
||||||
do {
|
do {
|
||||||
/*
|
/*
|
||||||
* determine the paramters of the next ratio test
|
* determine the parameters of the next ratio test
|
||||||
*
|
*
|
||||||
* We will multiplicatively expand our test level until
|
* We will multiplicatively expand our test level until
|
||||||
* the ratio drops below 1.0.
|
* the ratio drops below 1.0.
|
||||||
@@ -1435,7 +1437,7 @@ define best_pow2()
|
|||||||
best_val = high;
|
best_val = high;
|
||||||
best_ratio = ratio;
|
best_ratio = ratio;
|
||||||
if (config("user_debug") > 1) {
|
if (config("user_debug") > 1) {
|
||||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
printf(" len %d has a new closest ratio to unity: %.6f\n",
|
||||||
best_val, best_ratio);
|
best_val, best_ratio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1463,7 +1465,7 @@ define best_pow2()
|
|||||||
best_val = mid;
|
best_val = mid;
|
||||||
best_ratio = ratio;
|
best_ratio = ratio;
|
||||||
if (config("user_debug") > 1) {
|
if (config("user_debug") > 1) {
|
||||||
printf(" len %d has a new cloest ratio to unity: %.6f\n",
|
printf(" len %d has a new closest ratio to unity: %.6f\n",
|
||||||
best_val, best_ratio);
|
best_val, best_ratio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1516,7 +1518,7 @@ define best_pow2()
|
|||||||
printf("config(\"pow2\", %d),;\n", best_val);
|
printf("config(\"pow2\", %d),;\n", best_val);
|
||||||
printf("WARNING: It is believed that the output "
|
printf("WARNING: It is believed that the output "
|
||||||
"of this resource file is bogus!\n");
|
"of this resource file is bogus!\n");
|
||||||
printf("WARNING: You may NOT wish to follow the above suggeston.\n");
|
printf("WARNING: You may NOT wish to follow the above suggestion.\n");
|
||||||
}
|
}
|
||||||
return mid;
|
return mid;
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* bernoulli - clculate the Nth Bernoulli number B(n)
|
* bernoulli - calculate the Nth Bernoulli number B(n)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2000 David I. Bell and Landon Curt Noll
|
* Copyright (C) 2000,2021 David I. Bell and Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -26,9 +26,9 @@
|
|||||||
/*
|
/*
|
||||||
* Calculate the Nth Bernoulli number B(n).
|
* Calculate the Nth Bernoulli number B(n).
|
||||||
*
|
*
|
||||||
* NOTE: This is now a bulitin function.
|
* NOTE: This is now a builtin function.
|
||||||
*
|
*
|
||||||
* The non-buildin code used the following symbolic formula to calculate B(n):
|
* The non-builtin code used the following symbolic formula to calculate B(n):
|
||||||
*
|
*
|
||||||
* (b+1)^(n+1) - b^(n+1) = 0
|
* (b+1)^(n+1) - b^(n+1) = 0
|
||||||
*
|
*
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
* B(3) = -(6*B(2) + 4*B(1) + 1) / 4
|
* B(3) = -(6*B(2) + 4*B(1) + 1) / 4
|
||||||
*
|
*
|
||||||
* The combinatorial factors in the expansion of the above formula are
|
* The combinatorial factors in the expansion of the above formula are
|
||||||
* calculated interatively, and we use the fact that B(2i+1) = 0 if i > 0.
|
* calculated interactively, and we use the fact that B(2i+1) = 0 if i > 0.
|
||||||
* Since all previous B(n)'s are needed to calculate a particular B(n), all
|
* Since all previous B(n)'s are needed to calculate a particular B(n), all
|
||||||
* values obtained are saved in an array for ease in repeated calculations.
|
* values obtained are saved in an array for ease in repeated calculations.
|
||||||
*/
|
*/
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* bernpoly - Bernoully polynomials B_n(z) for arbitrary n,z..
|
* bernpoly - Bernoulli polynomials B_n(z) for arbitrary n,z..
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Christoph Zurnieden
|
* Copyright (C) 2013,2021 Christoph Zurnieden
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* brentsolve - Root finding with the Brent-Dekker trick
|
* brentsolve - Root finding with the Brent-Dekker trick
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Christoph Zurnieden
|
* Copyright (C) 2013,2021 Christoph Zurnieden
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -143,7 +143,7 @@ define brentsolve2(low, high,which,eps){
|
|||||||
|
|
||||||
switch(param(0)){
|
switch(param(0)){
|
||||||
case 0:
|
case 0:
|
||||||
case 1: return newerror("brentsolve2: not enough argments");
|
case 1: return newerror("brentsolve2: not enough arguments");
|
||||||
case 2: eps = epsilon(epsilon()*1e-2);
|
case 2: eps = epsilon(epsilon()*1e-2);
|
||||||
which = 0;break;
|
which = 0;break;
|
||||||
case 3: eps = epsilon(epsilon()*1e-2);break;
|
case 3: eps = epsilon(epsilon()*1e-2);break;
|
||||||
|
10
cal/chi.cal
10
cal/chi.cal
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* chi - chi^2 probabilities with degrees of freedom for null hypothesis
|
* chi - chi^2 probabilities with degrees of freedom for null hypothesis
|
||||||
*
|
*
|
||||||
* Copyright (C) 2001 Landon Curt Noll
|
* Copyright (C) 2001,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -51,7 +51,7 @@ define Z(x, eps_term)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* P(x[, eps]) asymtotic P(x) expansion for x>0 to an given epsilon error term
|
* P(x[, eps]) asymptotic P(x) expansion for x>0 to an given epsilon error term
|
||||||
*
|
*
|
||||||
* NOTE: If eps is omitted, the stored epsilon value is used.
|
* NOTE: If eps is omitted, the stored epsilon value is used.
|
||||||
*
|
*
|
||||||
@@ -99,7 +99,7 @@ define P(x, eps_term)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* aproximate sum(n=0; n < infinity){x^(2*n+1)/(1*3*5*...(2*n+1)}
|
* approximate sum(n=0; n < infinity){x^(2*n+1)/(1*3*5*...(2*n+1)}
|
||||||
*/
|
*/
|
||||||
x2 = x*x;
|
x2 = x*x;
|
||||||
x_term = x;
|
x_term = x;
|
||||||
@@ -130,7 +130,7 @@ define P(x, eps_term)
|
|||||||
*
|
*
|
||||||
* The chi_prob() function does not work well with odd degrees of freedom.
|
* The chi_prob() function does not work well with odd degrees of freedom.
|
||||||
* It is reasonable with even degrees of freedom, although one must give
|
* It is reasonable with even degrees of freedom, although one must give
|
||||||
* a sifficently small error term as the degress gets large (>100).
|
* a sufficiently small error term as the degrees gets large (>100).
|
||||||
*
|
*
|
||||||
* NOTE: This function does not work well with odd degrees of freedom.
|
* NOTE: This function does not work well with odd degrees of freedom.
|
||||||
* Can somebody help / find a bug / provide a better method of
|
* Can somebody help / find a bug / provide a better method of
|
||||||
@@ -186,7 +186,7 @@ define chi_prob(chi_sq, v, eps_term)
|
|||||||
local r; /* index in finite sum */
|
local r; /* index in finite sum */
|
||||||
local r_lim; /* limit value for r */
|
local r_lim; /* limit value for r */
|
||||||
local s; /* sum */
|
local s; /* sum */
|
||||||
local d; /* demoninator (2*4*6*... or 1*3*5...) */
|
local d; /* denominator (2*4*6*... or 1*3*5...) */
|
||||||
local chi_term; /* chi_sq^r */
|
local chi_term; /* chi_sq^r */
|
||||||
local ret; /* return value */
|
local ret; /* return value */
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* chrem - chinese remainder theorem/problem solver
|
* chrem - Chinese remainder theorem/problem solver
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Ernest Bowen and Landon Curt Noll
|
* Copyright (C) 1999,2021 Ernest Bowen and Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Primary author: Ernest Bowen
|
* Primary author: Ernest Bowen
|
||||||
*
|
*
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When possible, chrem finds solutions for x of a set of congruences
|
* When possible, chrem finds solutions for x of a set of congruence
|
||||||
* of the form:
|
* of the form:
|
||||||
*
|
*
|
||||||
* x = r1 (mod m1)
|
* x = r1 (mod m1)
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
*
|
*
|
||||||
* where the residues r1, r2, ... and the moduli m1, m2, ... are
|
* where the residues r1, r2, ... and the moduli m1, m2, ... are
|
||||||
* given integers. The Chinese remainder theorem states that if
|
* given integers. The Chinese remainder theorem states that if
|
||||||
* m1, m2, ... are relatively prime in pairs, the above congruences
|
* m1, m2, ... are relatively prime in pairs, the above congruence
|
||||||
* have a unique solution modulo m1 * m2 * ... If m1, m2, ...
|
* have a unique solution modulo m1 * m2 * ... If m1, m2, ...
|
||||||
* are not relatively prime in pairs, it is possible that no solution
|
* are not relatively prime in pairs, it is possible that no solution
|
||||||
* exists. If solutions exist, the general solution is expressible as:
|
* exists. If solutions exist, the general solution is expressible as:
|
||||||
|
10
cal/dms.cal
10
cal/dms.cal
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* dms - calculate in degrees, minutes, and seconds (based on deg)
|
* dms - calculate in degrees, minutes, and seconds (based on deg)
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999,2010 David I. Bell and Landon Curt Noll
|
* Copyright (C) 1999,2010,2021 David I. Bell and Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -53,7 +53,7 @@ define dms_add(a, b)
|
|||||||
{
|
{
|
||||||
local obj dms ans; /* return value */
|
local obj dms ans; /* return value */
|
||||||
|
|
||||||
/* initalize value to 1st arg */
|
/* initialize value to 1st arg */
|
||||||
if (istype(a, ans)) {
|
if (istype(a, ans)) {
|
||||||
/* 1st arg is dms object, load it */
|
/* 1st arg is dms object, load it */
|
||||||
ans.deg = a.deg;
|
ans.deg = a.deg;
|
||||||
@@ -110,7 +110,7 @@ define dms_sub(a, b)
|
|||||||
{
|
{
|
||||||
local obj dms ans; /* return value */
|
local obj dms ans; /* return value */
|
||||||
|
|
||||||
/* initalize value to 1st arg */
|
/* initialize value to 1st arg */
|
||||||
if (istype(a, ans)) {
|
if (istype(a, ans)) {
|
||||||
/* 1st arg is dms object, load it */
|
/* 1st arg is dms object, load it */
|
||||||
ans.deg = a.deg;
|
ans.deg = a.deg;
|
||||||
@@ -352,11 +352,11 @@ define fixdms(a)
|
|||||||
quit "attempt to fix a non dms object";
|
quit "attempt to fix a non dms object";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* force minutes to be intergral */
|
/* force minutes to be integral */
|
||||||
a.min += frac(a.deg) * 60;
|
a.min += frac(a.deg) * 60;
|
||||||
a.deg = int(a.deg);
|
a.deg = int(a.deg);
|
||||||
|
|
||||||
/* force degrees to be intergral */
|
/* force degrees to be integral */
|
||||||
a.sec += frac(a.min) * 60;
|
a.sec += frac(a.min) * 60;
|
||||||
a.min = int(a.min);
|
a.min = int(a.min);
|
||||||
|
|
||||||
|
@@ -8,8 +8,8 @@
|
|||||||
* copyright this dotest_code.
|
* copyright this dotest_code.
|
||||||
*
|
*
|
||||||
* ERNEST BOWEN AND LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
* ERNEST BOWEN AND LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
||||||
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MER-
|
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MER-
|
||||||
* CHANTABILITY AND FITNESS. IN NO EVENT SHALL LANDON CURT
|
* CHANTABILITY AND FITNESS. IN NO EVENT SHALL LANDON CURT
|
||||||
* NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
* NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
||||||
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
@@ -173,7 +173,7 @@ define dotest(dotest_file, dotest_code = 0, dotest_maxcond = -1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* preppare to return to the caller environment
|
* prepare to return to the caller environment
|
||||||
*
|
*
|
||||||
* We increase the caller's error count by the number
|
* We increase the caller's error count by the number
|
||||||
* of line tests that failed, not the number of internal
|
* of line tests that failed, not the number of internal
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* factorial2 - implementation of different factorial related functions
|
* factorial2 - implementation of different factorial related functions
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Christoph Zurnieden
|
* Copyright (C) 2013,2021 Christoph Zurnieden
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -281,10 +281,10 @@ define __CZ__multiply_factored_factorial(matrix,stop){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Compute binomial coeficients n!/(k!(n-k)!)
|
Compute binomial coefficients n!/(k!(n-k)!)
|
||||||
|
|
||||||
One of the rare cases where a formula once meant to ease manual computation
|
One of the rare cases where a formula once meant to ease manual computation
|
||||||
is actually the (aymptotically) fastest way to do it (in July 2013) for
|
is actually the (asymptotically) fastest way to do it (in July 2013) for
|
||||||
the extreme case binomial(2N,N) but for a high price, the memory
|
the extreme case binomial(2N,N) but for a high price, the memory
|
||||||
needed is pi(N)--theoretically.
|
needed is pi(N)--theoretically.
|
||||||
*/
|
*/
|
||||||
@@ -626,7 +626,7 @@ define subfactorialrecursive(n){
|
|||||||
return n * subfactorialrecursive(n-1) + (-1)^n;
|
return n * subfactorialrecursive(n-1) + (-1)^n;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is, quite amusingely, faster than the very same algorithm in
|
/* This is, quite amusingly, faster than the very same algorithm in
|
||||||
PARI/GP + GMP*/
|
PARI/GP + GMP*/
|
||||||
define subfactorialiterative(n){
|
define subfactorialiterative(n){
|
||||||
local k temp1 temp2 ret;
|
local k temp1 temp2 ret;
|
||||||
|
10
cal/hms.cal
10
cal/hms.cal
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* hms - calculate in hours, minutes, and seconds
|
* hms - calculate in hours, minutes, and seconds
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Landon Curt Noll
|
* Copyright (C) 2010,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -53,7 +53,7 @@ define hms_add(a, b)
|
|||||||
{
|
{
|
||||||
local obj hms ans; /* return value */
|
local obj hms ans; /* return value */
|
||||||
|
|
||||||
/* initalize value to 1st arg */
|
/* initialize value to 1st arg */
|
||||||
if (istype(a, ans)) {
|
if (istype(a, ans)) {
|
||||||
/* 1st arg is hms object, load it */
|
/* 1st arg is hms object, load it */
|
||||||
ans.hour = a.hour;
|
ans.hour = a.hour;
|
||||||
@@ -110,7 +110,7 @@ define hms_sub(a, b)
|
|||||||
{
|
{
|
||||||
local obj hms ans; /* return value */
|
local obj hms ans; /* return value */
|
||||||
|
|
||||||
/* initalize value to 1st arg */
|
/* initialize value to 1st arg */
|
||||||
if (istype(a, ans)) {
|
if (istype(a, ans)) {
|
||||||
/* 1st arg is hms object, load it */
|
/* 1st arg is hms object, load it */
|
||||||
ans.hour = a.hour;
|
ans.hour = a.hour;
|
||||||
@@ -352,11 +352,11 @@ define fixhms(a)
|
|||||||
quit "attempt to fix a non hms object";
|
quit "attempt to fix a non hms object";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* force minutes to be intergral */
|
/* force minutes to be integral */
|
||||||
a.min += frac(a.hour) * 60;
|
a.min += frac(a.hour) * 60;
|
||||||
a.hour = int(a.hour);
|
a.hour = int(a.hour);
|
||||||
|
|
||||||
/* force hours to be intergral */
|
/* force hours to be integral */
|
||||||
a.sec += frac(a.min) * 60;
|
a.sec += frac(a.min) * 60;
|
||||||
a.min = int(a.min);
|
a.min = int(a.min);
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* intfile - integer to file and file to integer conversion
|
* intfile - integer to file and file to integer conversion
|
||||||
*
|
*
|
||||||
* Copyright (C) 2001 Landon Curt Noll
|
* Copyright (C) 2001,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -27,20 +27,20 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* NOTE: Because leading HALF values are trimmed from integer, a file
|
* NOTE: Because leading HALF values are trimmed from integer, a file
|
||||||
* that begins with lots of 0 bits (in the case of big endian)
|
* that begins with lots of 0 bits (in the case of big Endian)
|
||||||
* or that ends with lots of 0 bits (in the case of little endian)
|
* or that ends with lots of 0 bits (in the case of little Endian)
|
||||||
* will be changed when the subsequent integer is written back.
|
* will be changed when the subsequent integer is written back.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* file2be - convert a file into an big endian integer
|
* file2be - convert a file into an big Endian integer
|
||||||
*
|
*
|
||||||
* given:
|
* given:
|
||||||
* filename filename to read
|
* filename filename to read
|
||||||
*
|
*
|
||||||
* returns:
|
* returns:
|
||||||
* integer read from its contents on big endian order
|
* integer read from its contents on big Endian order
|
||||||
*/
|
*/
|
||||||
define file2be(filename)
|
define file2be(filename)
|
||||||
{
|
{
|
||||||
@@ -75,13 +75,13 @@ define file2be(filename)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* file2le - convert a file into an little endian integer
|
* file2le - convert a file into an little Endian integer
|
||||||
*
|
*
|
||||||
* given:
|
* given:
|
||||||
* filename filename to read
|
* filename filename to read
|
||||||
*
|
*
|
||||||
* returns:
|
* returns:
|
||||||
* integer read from its contents on little endian order
|
* integer read from its contents on little Endian order
|
||||||
*/
|
*/
|
||||||
define file2le(filename)
|
define file2le(filename)
|
||||||
{
|
{
|
||||||
@@ -118,7 +118,7 @@ define file2le(filename)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* be2file - convert a big endian integer into a file
|
* be2file - convert a big Endian integer into a file
|
||||||
*
|
*
|
||||||
* given:
|
* given:
|
||||||
* v integer to write to the file
|
* v integer to write to the file
|
||||||
@@ -168,7 +168,7 @@ define be2file(v, filename)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* le2file - convert a little endian integer into a file
|
* le2file - convert a little Endian integer into a file
|
||||||
*
|
*
|
||||||
* given:
|
* given:
|
||||||
* v integer to write to the file
|
* v integer to write to the file
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* intnum - implementation of tanhsinh- and Gauss-Legendre quadrature
|
* intnum - implementation of tanhsinh- and Gauss-Legendre quadrature
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Christoph Zurnieden
|
* Copyright (C) 2013,2021 Christoph Zurnieden
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -295,7 +295,7 @@ define quadts(a, b, points)
|
|||||||
* as the number of equally spaced intervals on a straight line
|
* as the number of equally spaced intervals on a straight line
|
||||||
* connecting a and b. Computing the segments here is a bit
|
* connecting a and b. Computing the segments here is a bit
|
||||||
* more complicated but not much, it should have been taught in
|
* more complicated but not much, it should have been taught in
|
||||||
* highschool.
|
* high school.
|
||||||
* Other contours by way of a list of points */
|
* Other contours by way of a list of points */
|
||||||
slope = (im(b) - im(a)) / (re(b) - re(a));
|
slope = (im(b) - im(a)) / (re(b) - re(a));
|
||||||
C = (im(a) + slope) * re(a);
|
C = (im(a) + slope) * re(a);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* lambertw - Lambert's W-function
|
* lambertw - Lambert's W-function
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Christoph Zurnieden
|
* Copyright (C) 2013,2021 Christoph Zurnieden
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -83,7 +83,7 @@ define __CZ__lambertw_m1(z,eps){
|
|||||||
or by using the function lambertw_series_print() after running
|
or by using the function lambertw_series_print() after running
|
||||||
lambertw_series(z,eps,branch,terms) at least once with the wanted number of
|
lambertw_series(z,eps,branch,terms) at least once with the wanted number of
|
||||||
terms and z = 1 (which might throw an error because the series will not
|
terms and z = 1 (which might throw an error because the series will not
|
||||||
converge in anybodies lifetime for something that far from the branchpoint).
|
converge in anybodies lifetime for something that far from the branch point).
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@@ -105,7 +105,7 @@ define lambertw_series_print(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The series is fast but only if _very_ close to the branchpoint
|
The series is fast but only if _very_ close to the branch point
|
||||||
The exact branch must be given explicitly, e.g.:
|
The exact branch must be given explicitly, e.g.:
|
||||||
|
|
||||||
; lambertw(-exp(-1)+.001)-lambertw_series(-exp(-1)+.001,epsilon()*1e-10,0)
|
; lambertw(-exp(-1)+.001)-lambertw_series(-exp(-1)+.001,epsilon()*1e-10,0)
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* linear - perform a simple two point 2D linear interpolation
|
* linear - perform a simple two point 2D linear interpolation
|
||||||
*
|
*
|
||||||
* Copyright (C) 2005-2007 Landon Curt Noll
|
* Copyright (C) 2005-2007,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
*
|
*
|
||||||
* given:
|
* given:
|
||||||
* x0, y0 first known point on the line
|
* x0, y0 first known point on the line
|
||||||
* x1, y1 second knonw point on the line
|
* x1, y1 second known point on the line
|
||||||
* x a given point to interpolate on
|
* x a given point to interpolate on
|
||||||
*
|
*
|
||||||
* returns:
|
* returns:
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* lucas - perform a Lucas primality test on h*2^n-1
|
* lucas - perform a Lucas primality test on h*2^n-1
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999,2017 Landon Curt Noll
|
* Copyright (C) 1999,2017,2018,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -373,41 +373,53 @@ lucas(h, n)
|
|||||||
return 1; /* 239 is prime */
|
return 1; /* 239 is prime */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Verify that h*2^n-1 is not a multiple of 3
|
||||||
|
*
|
||||||
|
* The case for h*2^n-1 == 3 is handled above.
|
||||||
|
*/
|
||||||
|
if (((h % 3 == 1) && (n % 2 == 0)) || ((h % 3 == 2) && (n % 2 == 1))) {
|
||||||
|
/* no need to test h*2^n-1, it is a multiple of 3 */
|
||||||
|
ldebug("lucas","not-prime: != 3 and is a multiple of 3");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Avoid any numbers divisible by small primes
|
* Avoid any numbers divisible by small primes
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* check for 3 <= prime factors < 29
|
* check for 5 <= prime factors < 31
|
||||||
* pfact(28)/2 = 111546435
|
* pfact(30)/6 = 1078282205
|
||||||
*/
|
*/
|
||||||
testval = h*2^n - 1;
|
testval = h*2^n - 1;
|
||||||
if (gcd(testval, 111546435) > 1) {
|
if (gcd(testval, 1078282205) > 1) {
|
||||||
/* a small 3 <= prime < 29 divides h*2^n-1 */
|
/* a small 5 <= prime < 31 divides h*2^n-1 */
|
||||||
ldebug("lucas","not-prime: 3<=prime<29 divides h*2^n-1");
|
ldebug("lucas",\
|
||||||
|
"not-prime: a small 5<=prime<31 divides h*2^n-1");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* check for 29 <= prime factors < 47
|
* check for 31 <= prime factors < 53
|
||||||
* pfact(46)/pfact(28) = 5864229
|
* pfact(52)/pfact(30) = 95041567
|
||||||
*/
|
*/
|
||||||
if (gcd(testval, 58642669) > 1) {
|
if (gcd(testval, 95041567) > 1) {
|
||||||
/* a small 29 <= prime < 47 divides h*2^n-1 */
|
/* a small 31 <= prime < 53 divides h*2^n-1 */
|
||||||
ldebug("lucas","not-prime: 29<=prime<47 divides h*2^n-1");
|
ldebug("lucas","not-prime: 31<=prime<53 divides h*2^n-1");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* check for prime 47 <= factors < 257, if h*2^n-1 is large
|
* check for prime 53 <= factors < 257, if h*2^n-1 is large
|
||||||
* 2^282 > pfact(256)/pfact(46) > 2^281
|
* 2^276 > pfact(256)/pfact(52) > 2^275
|
||||||
*/
|
*/
|
||||||
bits = highbit(testval);
|
bits = highbit(testval);
|
||||||
if (bits >= 281) {
|
if (bits >= 275) {
|
||||||
if (pprod256 <= 0) {
|
if (pprod256 <= 0) {
|
||||||
pprod256 = pfact(256)/pfact(46);
|
pprod256 = pfact(256)/pfact(52);
|
||||||
}
|
}
|
||||||
if (gcd(testval, pprod256) > 1) {
|
if (gcd(testval, pprod256) > 1) {
|
||||||
/* a small 47 <= prime < 257 divides h*2^n-1 */
|
/* a small 53 <= prime < 257 divides h*2^n-1 */
|
||||||
ldebug("lucas",\
|
ldebug("lucas",\
|
||||||
"not-prime: 47<=prime<257 divides h*2^n-1");
|
"not-prime: 53<=prime<257 divides h*2^n-1");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -423,7 +435,9 @@ lucas(h, n)
|
|||||||
* generate a test for h*2^n-1. The legacy function,
|
* generate a test for h*2^n-1. The legacy function,
|
||||||
* legacy_gen_v1() used by the Amdahl 6 could have returned
|
* legacy_gen_v1() used by the Amdahl 6 could have returned
|
||||||
* -1. The new gen_v1() based on the method outlined in Ref4
|
* -1. The new gen_v1() based on the method outlined in Ref4
|
||||||
* will never return -1.
|
* will never return -1 if h*2^n-1 is not a multiple of 3.
|
||||||
|
* Because the "multiple of 3" case is handled above, the
|
||||||
|
* call below to gen_v1() will never return -1.
|
||||||
*/
|
*/
|
||||||
v1 = gen_v1(h, n);
|
v1 = gen_v1(h, n);
|
||||||
if (v1 < 0) {
|
if (v1 < 0) {
|
||||||
@@ -933,7 +947,7 @@ rodseth_xhn(x, h, n)
|
|||||||
*
|
*
|
||||||
* Without Jacobi symbol value caching, it requires on average
|
* Without Jacobi symbol value caching, it requires on average
|
||||||
* 4.851377 Jacobi symbol evaluations. With Jacobi symbol value caching
|
* 4.851377 Jacobi symbol evaluations. With Jacobi symbol value caching
|
||||||
* cacheing, an averare of 4.348820 Jacobi symbol evaluations is needed.
|
* cacheing, an average of 4.348820 Jacobi symbol evaluations is needed.
|
||||||
*
|
*
|
||||||
* Given this information, when odd h is a multiple of 3 we try, in order,
|
* Given this information, when odd h is a multiple of 3 we try, in order,
|
||||||
* these odd values of X:
|
* these odd values of X:
|
||||||
@@ -947,7 +961,7 @@ rodseth_xhn(x, h, n)
|
|||||||
* jacobi(X-2, h*2^n-1) == 1
|
* jacobi(X-2, h*2^n-1) == 1
|
||||||
* jacobi(X+2, h*2^n-1) == -1
|
* jacobi(X+2, h*2^n-1) == -1
|
||||||
*
|
*
|
||||||
* Less than 1 case out of 1000000 will not be satisifed by the above list.
|
* Less than 1 case out of 1000000 will not be satisfied by the above list.
|
||||||
* If no value in that list works, we start simple search starting with X = 167
|
* If no value in that list works, we start simple search starting with X = 167
|
||||||
* and incrementing by 2 until a value of X is found.
|
* and incrementing by 2 until a value of X is found.
|
||||||
*
|
*
|
||||||
@@ -1035,7 +1049,7 @@ next_x = 167; /* must be 2 more than the largest value in x_tbl[] */
|
|||||||
* else
|
* else
|
||||||
* v(1) = 4
|
* v(1) = 4
|
||||||
*
|
*
|
||||||
* HOTE: The above "if then else" works only of h is not a multiple of 3.
|
* NOTE: The above "if then else" works only of h is not a multiple of 3.
|
||||||
*
|
*
|
||||||
***
|
***
|
||||||
*
|
*
|
||||||
@@ -1172,6 +1186,26 @@ gen_v1(h, n)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Common Mersenne number case:
|
||||||
|
*
|
||||||
|
* For Mersenne numbers:
|
||||||
|
*
|
||||||
|
* 2^n-1
|
||||||
|
*
|
||||||
|
* we can use, 40% of the time, v(1) == 3. However nearly all code that
|
||||||
|
* implements the Lucas-Lehmer test uses v(1) == 4. Whenever for
|
||||||
|
* h != 0 mod 3, and particular the Mersenne number case of when h == 1:
|
||||||
|
*
|
||||||
|
* 1*2^n-1
|
||||||
|
*
|
||||||
|
* v(1) == 4 always works. For this reason, we return 4 when h == 1.
|
||||||
|
*/
|
||||||
|
if (h == 1) {
|
||||||
|
/* v(1) == 4 always works for the Mersenne number case */
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* check for Case 1: (h mod 3 != 0)
|
* check for Case 1: (h mod 3 != 0)
|
||||||
*/
|
*/
|
||||||
@@ -1200,10 +1234,10 @@ gen_v1(h, n)
|
|||||||
* jacobi(X-2, h*2^n-1) == 1 part 1
|
* jacobi(X-2, h*2^n-1) == 1 part 1
|
||||||
* jacobi(X+2, h*2^n-1) == -1 part 2
|
* jacobi(X+2, h*2^n-1) == -1 part 2
|
||||||
*
|
*
|
||||||
* NOTE: If we wanted to be super optimial, we would cache
|
* NOTE: If we wanted to be super optimal, we would cache
|
||||||
* jacobi(X+2, h*2^n-1) that that when we increment X
|
* jacobi(X+2, h*2^n-1) that that when we increment X
|
||||||
* to the next odd value, the now jacobi(X-2, h*2^n-1)
|
* to the next odd value, the now jacobi(X-2, h*2^n-1)
|
||||||
* does not need to be re-evaluted.
|
* does not need to be re-evaluated.
|
||||||
*/
|
*/
|
||||||
testval = h*2^n-1;
|
testval = h*2^n-1;
|
||||||
for (i=0; i < x_tbl_len; ++i) {
|
for (i=0; i < x_tbl_len; ++i) {
|
||||||
@@ -1251,7 +1285,7 @@ gen_v1(h, n)
|
|||||||
/*
|
/*
|
||||||
* We are in that rare case (less than 1 in 1 000 000) where none of the
|
* We are in that rare case (less than 1 in 1 000 000) where none of the
|
||||||
* common X values satisfy Ref4 condition 1. We start a linear search
|
* common X values satisfy Ref4 condition 1. We start a linear search
|
||||||
* of odd vules at next_x from here on.
|
* of odd values at next_x from here on.
|
||||||
*/
|
*/
|
||||||
x = next_x;
|
x = next_x;
|
||||||
while (rodseth_xhn(x, h, n) != 1) {
|
while (rodseth_xhn(x, h, n) != 1) {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* lucas_chk - test all primes of the form h*2^n-1, 1<=h<200 and n <= high_n
|
* lucas_chk - test all primes of the form h*2^n-1, 1<=h<200 and n <= high_n
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Landon Curt Noll
|
* Copyright (C) 1999,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -303,7 +303,7 @@ read -once "lucas.cal";
|
|||||||
* [quiet] if given and != 0, then do not print individual test results
|
* [quiet] if given and != 0, then do not print individual test results
|
||||||
*
|
*
|
||||||
* returns:
|
* returns:
|
||||||
* 1 all is ok
|
* 1 all is OK
|
||||||
* 0 something went wrong
|
* 0 something went wrong
|
||||||
*/
|
*/
|
||||||
define
|
define
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* mfactor - return the lowest factor of 2^n-1, for n > 0
|
* mfactor - return the lowest factor of 2^n-1, for n > 0
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Landon Curt Noll
|
* Copyright (C) 1999,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
* hindx = 0;
|
* hindx = 0;
|
||||||
* } while (test_factor < some_limit);
|
* } while (test_factor < some_limit);
|
||||||
*
|
*
|
||||||
* The test, mfactor(67, 1, 10000) took on an 200 Mhz r4k (user CPU seconds):
|
* The test, mfactor(67, 1, 10000) took on an 200 MHz r4k (user CPU seconds):
|
||||||
*
|
*
|
||||||
* 210.83 (prior to use of hset[])
|
* 210.83 (prior to use of hset[])
|
||||||
* 78.35 (hset[] for p_elim = 7)
|
* 78.35 (hset[] for p_elim = 7)
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
* 57.78 (hset[] for p_elim = 17)
|
* 57.78 (hset[] for p_elim = 17)
|
||||||
* p_elim == 19 rejected because of memory size
|
* p_elim == 19 rejected because of memory size
|
||||||
*
|
*
|
||||||
* The p_elim == 17 overhead takes ~3 minutes on an 200 Mhz r4k CPU and
|
* The p_elim == 17 overhead takes ~3 minutes on an 200 MHz r4k CPU and
|
||||||
* requires about ~13 Megs of memory. The p_elim == 13 overhead
|
* requires about ~13 Megs of memory. The p_elim == 13 overhead
|
||||||
* takes about 3 seconds and requires ~1.5 Megs of memory.
|
* takes about 3 seconds and requires ~1.5 Megs of memory.
|
||||||
*
|
*
|
||||||
@@ -256,7 +256,7 @@ define mfactor(n, start_k, rept_loop, p_elim)
|
|||||||
return q;
|
return q;
|
||||||
} else {
|
} else {
|
||||||
/* report this loop */
|
/* report this loop */
|
||||||
printf("at 2*%d*%d+1, cpu: %f\n",
|
printf("at 2*%d*%d+1, CPU: %f\n",
|
||||||
(q-1)/(2*n), n, usertime());
|
(q-1)/(2*n), n, usertime());
|
||||||
fflush(files(1));
|
fflush(files(1));
|
||||||
loop = 0;
|
loop = 0;
|
||||||
@@ -269,14 +269,14 @@ define mfactor(n, start_k, rept_loop, p_elim)
|
|||||||
*/
|
*/
|
||||||
if (rept_loop <= ++loop) {
|
if (rept_loop <= ++loop) {
|
||||||
/* report this loop */
|
/* report this loop */
|
||||||
printf("at 2*%d*%d+1, cpu: %f\n",
|
printf("at 2*%d*%d+1, CPU: %f\n",
|
||||||
(q-1)/(2*n), n, usertime());
|
(q-1)/(2*n), n, usertime());
|
||||||
fflush(files(1));
|
fflush(files(1));
|
||||||
loop = 0;
|
loop = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* skip if divisable by a prime <= 449
|
* skip if divisible by a prime <= 449
|
||||||
*
|
*
|
||||||
* The value 281 was determined by timing loops
|
* The value 281 was determined by timing loops
|
||||||
* which found that 281 was at or near the
|
* which found that 281 was at or near the
|
||||||
@@ -285,7 +285,7 @@ define mfactor(n, start_k, rept_loop, p_elim)
|
|||||||
* The addition of the do { ... } while (factor(q, 449)>1);
|
* The addition of the do { ... } while (factor(q, 449)>1);
|
||||||
* loop reduced the factoring loop time (36504 k values with
|
* loop reduced the factoring loop time (36504 k values with
|
||||||
* the hset[] initialization time removed) from 25.69 sec to
|
* the hset[] initialization time removed) from 25.69 sec to
|
||||||
* 15.62 sec of CPU time on a 200Mhz r4k.
|
* 15.62 sec of CPU time on a 200MHz r4k.
|
||||||
*/
|
*/
|
||||||
do {
|
do {
|
||||||
/*
|
/*
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* natnumset - functions for sets of natural numbers not exceeding a fixed bound
|
* natnumset - functions for sets of natural numbers not exceeding a fixed bound
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Ernest Bowen
|
* Copyright (C) 1999,2021 Ernest Bowen
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
* A \ B = set difference, integers in A but not in B
|
* A \ B = set difference, integers in A but not in B
|
||||||
*
|
*
|
||||||
* ~A = complement of A, integers not in A
|
* ~A = complement of A, integers not in A
|
||||||
* #A = number ofintegers in A
|
* #A = number of integers in A
|
||||||
* !A = 1 or 0 according as A is empty or not empty
|
* !A = 1 or 0 according as A is empty or not empty
|
||||||
* +A = sum of the members of A
|
* +A = sum of the members of A
|
||||||
*
|
*
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
* A >= B = (B <= A)
|
* A >= B = (B <= A)
|
||||||
* A > B = (B < A)
|
* A > B = (B < A)
|
||||||
*
|
*
|
||||||
* Expresssions may be formed from the above "arithmetic" operations in
|
* Expressions may be formed from the above "arithmetic" operations in
|
||||||
* the usual way, with parentheses for variations from the usual precedence
|
* the usual way, with parentheses for variations from the usual precedence
|
||||||
* rules. For example
|
* rules. For example
|
||||||
*
|
*
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* pell - solve Pell's equation
|
* pell - solve Pell's equation
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 David I. Bell
|
* Copyright (C) 1999,2021 David I. Bell
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Solve Pell's equation; Returns the solution X to: X^2 - D * Y^2 = 1.
|
* Solve Pell's equation; Returns the solution X to: X^2 - D * Y^2 = 1.
|
||||||
* Type the solution to pells equation for a particular D.
|
* Type the solution to Pell's equation for a particular D.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* poly - calculate with polynomials of one variable
|
* poly - calculate with polynomials of one variable
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Ernest Bowen
|
* Copyright (C) 1999,2021 Ernest Bowen
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
* variable has only one name. For some purposes, a name like
|
* variable has only one name. For some purposes, a name like
|
||||||
* "sin(t)" or "(a + b)" or "\lambda" might be useful;
|
* "sin(t)" or "(a + b)" or "\lambda" might be useful;
|
||||||
* names like "*" or "-27" are legal but might give expressions
|
* names like "*" or "-27" are legal but might give expressions
|
||||||
* that are difficult to intepret.
|
* that are difficult to interpret.
|
||||||
*
|
*
|
||||||
* Polynomial expressions may be constructed from numbers and the
|
* Polynomial expressions may be constructed from numbers and the
|
||||||
* independent variable and other polynomials by the algebraic
|
* independent variable and other polynomials by the algebraic
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
* The operations // and % are defined to have the quotient and
|
* The operations // and % are defined to have the quotient and
|
||||||
* remainder meanings as usually defined for polynomials.
|
* remainder meanings as usually defined for polynomials.
|
||||||
*
|
*
|
||||||
* When polynomials are assigned to idenfifiers, it is convenient to
|
* When polynomials are assigned to identifiers, it is convenient to
|
||||||
* think of the polynomials as values. For example, p = (x - 1)^2
|
* think of the polynomials as values. For example, p = (x - 1)^2
|
||||||
* assigns to p a polynomial value in the same way as q = (7 - 1)^2
|
* assigns to p a polynomial value in the same way as q = (7 - 1)^2
|
||||||
* would assign to q a number value. As with number expressions
|
* would assign to q a number value. As with number expressions
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* prompt - eemonstration of some uses of prompt() and eval()
|
* prompt - demonstration of some uses of prompt() and eval()
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Ernest Bowen
|
* Copyright (C) 1999,2021 Ernest Bowen
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -61,9 +61,9 @@
|
|||||||
* nothing to sum. The last line returns the value 3, i.e. the last
|
* nothing to sum. The last line returns the value 3, i.e. the last
|
||||||
* non-null value found for the expressions separated by semicolons,
|
* non-null value found for the expressions separated by semicolons,
|
||||||
* so sum will be increased by 3 after the "print sum^2;" command
|
* so sum will be increased by 3 after the "print sum^2;" command
|
||||||
* is executed. xxx The terminating semicolon is essential in the
|
* is executed. XXX The terminating semicolon is essential in the
|
||||||
* last two lines. A command like eval("print 7;") is acceptable to
|
* last two lines. A command like eval("print 7;") is acceptable to
|
||||||
* calc but eval("print 7") causes an exit from calc. xxx)
|
* calc but eval("print 7") causes an exit from calc. XXX)
|
||||||
*
|
*
|
||||||
* If the value returned is not a number (e.g. the name of a list or matrix,
|
* If the value returned is not a number (e.g. the name of a list or matrix,
|
||||||
* or if the string has syntax errors as in "2 + ", in which case the
|
* or if the string has syntax errors as in "2 + ", in which case the
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
* "sin(x)", "x^2 + 3*x", "exp(x, 1e-5)".
|
* "sin(x)", "x^2 + 3*x", "exp(x, 1e-5)".
|
||||||
*
|
*
|
||||||
* Values of the function so defined are returned for values of x
|
* Values of the function so defined are returned for values of x
|
||||||
* entered in reponse to the ? prompt. Operation is terminated by
|
* entered in response to the ? prompt. Operation is terminated by
|
||||||
* entering "end", "exit" or "quit".
|
* entering "end", "exit" or "quit".
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* quat - alculate using quaternions of the form: a + bi + cj + dk
|
* quat - calculate using quaternions of the form: a + bi + cj + dk
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 David I. Bell
|
* Copyright (C) 1999,2021 David I. Bell
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* randmprime - generate a random prime of the form h*2^n-1
|
* randmprime - generate a random prime of the form h*2^n-1
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Landon Curt Noll
|
* Copyright (C) 1999,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -45,9 +45,9 @@ randmprime(bits, seed, dbg)
|
|||||||
local n; /* n as in h*2^n-1 */
|
local n; /* n as in h*2^n-1 */
|
||||||
local h; /* h as in h*2^n-1 */
|
local h; /* h as in h*2^n-1 */
|
||||||
local plush; /* value added to h since the beginning */
|
local plush; /* value added to h since the beginning */
|
||||||
local init; /* initial cpu time */
|
local init; /* initial CPU time */
|
||||||
local start; /* cpu time before last test */
|
local start; /* CPU time before last test */
|
||||||
local stop; /* cpu time afte last test */
|
local stop; /* CPU time after last test */
|
||||||
local tmp; /* just a tmp place holder value */
|
local tmp; /* just a tmp place holder value */
|
||||||
local ret; /* h*2^n-1 that is prime */
|
local ret; /* h*2^n-1 that is prime */
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* regress - calc regression and correctness test suite
|
* regress - calc regression and correctness test suite
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2017 David I. Bell and Landon Curt Noll
|
* Copyright (C) 1999-2017,2021 David I. Bell and Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -43,7 +43,7 @@ global prob; /* libregress.cal problem counter */
|
|||||||
prob = 0; /* clear problem counter */
|
prob = 0; /* clear problem counter */
|
||||||
|
|
||||||
errcount(0),; /* clear error count */
|
errcount(0),; /* clear error count */
|
||||||
errmax(-1),; /* prevent errcount from abouting */
|
errmax(-1),; /* prevent errcount from aborting */
|
||||||
|
|
||||||
global ecnt; /* expected value of errcount() */
|
global ecnt; /* expected value of errcount() */
|
||||||
ecnt = 0; /* clear expected errcount() value */
|
ecnt = 0; /* clear expected errcount() value */
|
||||||
@@ -356,8 +356,18 @@ define test_arithmetic()
|
|||||||
vrfy(-16^-2 == -1/256, '447: -16^-2 == -1/256');
|
vrfy(-16^-2 == -1/256, '447: -16^-2 == -1/256');
|
||||||
vrfy(-7^2 == -49, '448: -7^2 == -49');
|
vrfy(-7^2 == -49, '448: -7^2 == -49');
|
||||||
vrfy(-3! == -6, '449: -3! == -6');
|
vrfy(-3! == -6, '449: -3! == -6');
|
||||||
|
vrfy(0^(0-0) == 1, '450: 0^(0-0) == 1');
|
||||||
|
vrfy(0^(2-2) == 1, '451: 0^(2-2) == 1');
|
||||||
|
vrfy(2^0 == 1, '452: 2^0 == 1');
|
||||||
|
vrfy(2^(0-0) == 1, '453: 2^(0-0) == 1');
|
||||||
|
vrfy(2^(2-2) == 1, '454: 2^(2-2) == 1');
|
||||||
|
vrfy((2^23209-1)^0 == 1, '455: (2^23209-1)^0 == 1');
|
||||||
|
vrfy((2^23209-1)^(0-0) == 1, '456: (2^23209-1)^(0-0) == 1');
|
||||||
|
vrfy((2^23209-1)^(2-2) == 1, '457: (2^23209-1)^(2-2) == 1');
|
||||||
|
vrfy((2^23209-1)^((2^23209-1)-(2^23209-1)) == 1,
|
||||||
|
'458: (2^23209-1)^((2^23209-1)-(2^23209-1)) == 1');
|
||||||
|
|
||||||
print '450: Ending test_arithmetic';
|
print '459: Ending test_arithmetic';
|
||||||
}
|
}
|
||||||
print '009: parsed test_arithmetic()';
|
print '009: parsed test_arithmetic()';
|
||||||
|
|
||||||
@@ -453,7 +463,7 @@ define test_config()
|
|||||||
'539: config("more", ">> ") == ";; "');
|
'539: config("more", ">> ") == ";; "');
|
||||||
vrfy(config("all") == oldcfg, '540: config("all") == oldcfg');
|
vrfy(config("all") == oldcfg, '540: config("all") == oldcfg');
|
||||||
|
|
||||||
/* restore the configation at the start of this function */
|
/* restore the configuration at the start of this function */
|
||||||
vrfy(config("all",callcfg) == oldcfg,
|
vrfy(config("all",callcfg) == oldcfg,
|
||||||
'541: config("all",callcfg) == oldcfg');
|
'541: config("all",callcfg) == oldcfg');
|
||||||
|
|
||||||
@@ -3156,7 +3166,7 @@ print '047: parsed test_poly()';
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* test_det - more determinent testing
|
* test_det - more determinant testing
|
||||||
*/
|
*/
|
||||||
read -once "test3300";
|
read -once "test3300";
|
||||||
print '048: read -once test3300';
|
print '048: read -once test3300';
|
||||||
@@ -3227,9 +3237,9 @@ define test_error()
|
|||||||
|
|
||||||
print '3600: Beginning test_error';
|
print '3600: Beginning test_error';
|
||||||
|
|
||||||
/* bump ecnt up by 148 */
|
/* bump ecnt up by 156 */
|
||||||
ecnt += 148;
|
ecnt += 156;
|
||||||
print '3601: ecnt += 148';
|
print '3601: ecnt += 156';
|
||||||
|
|
||||||
strx = "x";
|
strx = "x";
|
||||||
print '3602: strx = "x"';
|
print '3602: strx = "x"';
|
||||||
@@ -3418,11 +3428,15 @@ define test_error()
|
|||||||
n = 8191;
|
n = 8191;
|
||||||
print '3727: n = 8191';
|
print '3727: n = 8191';
|
||||||
/* test 3728 removed due to non-portable strerror() output */
|
/* test 3728 removed due to non-portable strerror() output */
|
||||||
|
vrfy(tan(2e9i) == error(10435), '3729: tan(2e9i) == error(10435)');
|
||||||
|
vrfy(cot(2e9i) == error(10437), '3730: cot(2e9i) == error(10437)');
|
||||||
|
vrfy(sec(2e9i) == error(10439), '3731: sec(2e9i) == error(10439)');
|
||||||
|
vrfy(csc(2e9i) == error(10440), '3732: csc(2e9i) == error(10440)');
|
||||||
|
|
||||||
/* errmax and errcount should be bumped up the 148 errors above */
|
/* errmax and errcount should be bumped up the 148 errors above */
|
||||||
vrfy(errcount() == ecnt, '3729: errcount() == ecnt');
|
vrfy(errcount() == ecnt, '3733: errcount() == ecnt');
|
||||||
|
|
||||||
print '3730: Ending test_error';
|
print '3734: Ending test_error';
|
||||||
}
|
}
|
||||||
print '054: parsed test_error()';
|
print '054: parsed test_error()';
|
||||||
|
|
||||||
@@ -3469,7 +3483,7 @@ print '065: parsed test_param()';
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* test_noarg - test missing argment functionality
|
* test_noarg - test missing argument functionality
|
||||||
*/
|
*/
|
||||||
define test_noarg()
|
define test_noarg()
|
||||||
{
|
{
|
||||||
@@ -4102,38 +4116,46 @@ define test_strprintf()
|
|||||||
'4821: strprintf("%b", 27/29) == "0b11011/0b11101"');
|
'4821: strprintf("%b", 27/29) == "0b11011/0b11101"');
|
||||||
vrfy(strprintf("%e", 12345) == "~1.23e4",
|
vrfy(strprintf("%e", 12345) == "~1.23e4",
|
||||||
'4822: strprintf("%e", 12345) == "~1.23e4"');
|
'4822: strprintf("%e", 12345) == "~1.23e4"');
|
||||||
|
vrfy(strprintf("%g", .385) == "~.38",
|
||||||
|
'4823: strprintf("%g", .385) == "~.38"');
|
||||||
|
vrfy(strprintf("%g", 385) == "~3.8e2",
|
||||||
|
'4824: strprintf("%g", 385) == "~3.8e2"');
|
||||||
|
|
||||||
/* mode tests with tilde == 0 */
|
/* mode tests with tilde == 0 */
|
||||||
c = config("tilde", 0);
|
c = config("tilde", 0);
|
||||||
print '4823: c = config("tilde", 0)';
|
print '4825: c = config("tilde", 0)';
|
||||||
vrfy(strprintf("%e", 12345) == "1.23e4",
|
vrfy(strprintf("%e", 12345) == "1.23e4",
|
||||||
'4824: strprintf("%e", 12345) == "1.23e4"');
|
'4826: strprintf("%e", 12345) == "1.23e4"');
|
||||||
vrfy(strprintf("%.3e", 12345) == "1.234e4",
|
vrfy(strprintf("%.3e", 12345) == "1.234e4",
|
||||||
'4825: strprintf("%.3e", 12345) == "1.234e4"');
|
'4827: strprintf("%.3e", 12345) == "1.234e4"');
|
||||||
vrfy(strprintf("%e", .00012345) == "1.23e-4",
|
vrfy(strprintf("%e", .00012345) == "1.23e-4",
|
||||||
'4826: strprintf("%e", .00012345) == "1.23e-4"');
|
'4828: strprintf("%e", .00012345) == "1.23e-4"');
|
||||||
vrfy(strprintf("%d %d", 27) == "27 ",
|
vrfy(strprintf("%d %d", 27) == "27 ",
|
||||||
'4827: strprintf("%d %d", 27) == "27 "');
|
'4829: strprintf("%d %d", 27) == "27 "');
|
||||||
vrfy(strprintf("%d", 27, 29) == "27",
|
vrfy(strprintf("%d", 27, 29) == "27",
|
||||||
'4828: strprintf("%d", 27, 29) == "27"');
|
'4830: strprintf("%d", 27, 29) == "27"');
|
||||||
vrfy(strprintf("%r = %f", 27/29, 27/29) == "27/29 = .93",
|
vrfy(strprintf("%r = %f", 27/29, 27/29) == "27/29 = .93",
|
||||||
'4829: strprintf("%r = %f", 27/29, 27/29) == "27/29 = .93"');
|
'4831: strprintf("%r = %f", 27/29, 27/29) == "27/29 = .93"');
|
||||||
vrfy(strprintf("%s", "abc") == "abc",
|
vrfy(strprintf("%s", "abc") == "abc",
|
||||||
'4830: strprintf("%s", "abc") == "abc"');
|
'4832: strprintf("%s", "abc") == "abc"');
|
||||||
vrfy(strprintf("%f", "abc") == "abc",
|
vrfy(strprintf("%f", "abc") == "abc",
|
||||||
'4831: strprintf("%f", "abc") == "abc"');
|
'4833: strprintf("%f", "abc") == "abc"');
|
||||||
vrfy(strprintf("%e", "abc") == "abc",
|
vrfy(strprintf("%e", "abc") == "abc",
|
||||||
'4832: strprintf("%e", "abc") == "abc"');
|
'4834: strprintf("%e", "abc") == "abc"');
|
||||||
vrfy(strprintf("%5s", "abc") == " abc",
|
vrfy(strprintf("%5s", "abc") == " abc",
|
||||||
'4833: strprintf("%5s", "abc") == " abc"');
|
'4835: strprintf("%5s", "abc") == " abc"');
|
||||||
vrfy(strprintf("%-5s", "abc") == "abc ",
|
vrfy(strprintf("%-5s", "abc") == "abc ",
|
||||||
'4834: strprintf("%-5s", "abc") == "abc "');
|
'4836: strprintf("%-5s", "abc") == "abc "');
|
||||||
|
vrfy(strprintf("%g", .385) == ".38",
|
||||||
|
'4837: strprintf("%g", .385) == ".38"');
|
||||||
|
vrfy(strprintf("%g", 385) == "3.8e2",
|
||||||
|
'4838: strprintf("%g", 385) == "3.8e2"');
|
||||||
|
|
||||||
/* restore config */
|
/* restore config */
|
||||||
c = config("all", callcfg);
|
c = config("all", callcfg);
|
||||||
print '4835: c = config("all", callcfg)';
|
print '4839: c = config("all", callcfg)';
|
||||||
|
|
||||||
print '4836: Ending test_strprintf';
|
print '4840: Ending test_strprintf';
|
||||||
}
|
}
|
||||||
print '088: parsed test_fileop()';
|
print '088: parsed test_fileop()';
|
||||||
|
|
||||||
@@ -5171,7 +5193,7 @@ define test_size()
|
|||||||
'5715: sizeof(17^139 + 674)*2 == sizeof(q)');
|
'5715: sizeof(17^139 + 674)*2 == sizeof(q)');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* recipricals are the same size of their integer inverses
|
* reciprocals are the same size of their integer inverses
|
||||||
*/
|
*/
|
||||||
q = 1/13;
|
q = 1/13;
|
||||||
print '5716: q = 1/13';
|
print '5716: q = 1/13';
|
||||||
@@ -5249,7 +5271,7 @@ define test_size()
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* size of a matrix is the sum of the sizes of the elements
|
* size of a matrix is the sum of the sizes of the elements
|
||||||
* sizeof of a matrix is the sum of the sizeofs of the elements
|
* sizeof of a matrix is the sum of the sizeof's of the elements
|
||||||
*/
|
*/
|
||||||
mat m[] = {z,q,c};
|
mat m[] = {z,q,c};
|
||||||
print '5752: mat m[] = {z,q,c}';
|
print '5752: mat m[] = {z,q,c}';
|
||||||
@@ -5369,7 +5391,7 @@ define test_is()
|
|||||||
{
|
{
|
||||||
local loc; /* unassigned local variable */
|
local loc; /* unassigned local variable */
|
||||||
local a; /* assoc */
|
local a; /* assoc */
|
||||||
local ofd; /* open file desriptor */
|
local ofd; /* open file descriptor */
|
||||||
local cfd; /* closed file descriptor */
|
local cfd; /* closed file descriptor */
|
||||||
local blk; /* unnamed block */
|
local blk; /* unnamed block */
|
||||||
local nblk; /* named block */
|
local nblk; /* named block */
|
||||||
@@ -5386,7 +5408,7 @@ define test_is()
|
|||||||
local object; /* object */
|
local object; /* object */
|
||||||
local rand; /* rand seed */
|
local rand; /* rand seed */
|
||||||
local random; /* random seed */
|
local random; /* random seed */
|
||||||
local real; /* real non-intger value */
|
local real; /* real non-integer value */
|
||||||
local prime; /* odd prime */
|
local prime; /* odd prime */
|
||||||
local square; /* square of an odd prime */
|
local square; /* square of an odd prime */
|
||||||
local string; /* string */
|
local string; /* string */
|
||||||
@@ -7470,7 +7492,7 @@ print '190: parsed test_somenew()';
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* test_exponentiation - test new exponentiation functionaltiy
|
* test_exponentiation - test new exponentiation functionality
|
||||||
*/
|
*/
|
||||||
define test_exponentiation()
|
define test_exponentiation()
|
||||||
{
|
{
|
||||||
@@ -7561,7 +7583,7 @@ define test_quit()
|
|||||||
quit;
|
quit;
|
||||||
prob('quit did not end the test_quit() function');
|
prob('quit did not end the test_quit() function');
|
||||||
|
|
||||||
/* 8400 serise continued after return, do not print end here */
|
/* 8400 series continued after return, do not print end here */
|
||||||
}
|
}
|
||||||
print '191: parsed test_quit()';
|
print '191: parsed test_quit()';
|
||||||
|
|
||||||
@@ -7862,7 +7884,7 @@ print '8406: Ending test_quit';
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* test_divmod - psuedo-random tests on the // and % with various rounding modes
|
* test_divmod - pseudo-random tests on the // and % with various rounding modes
|
||||||
*/
|
*/
|
||||||
print;
|
print;
|
||||||
print '8500: Starting test of divmod'
|
print '8500: Starting test of divmod'
|
||||||
@@ -7888,7 +7910,7 @@ vrfy(config("redecl_warn",0), '8651: config("redecl_warn",0)');
|
|||||||
vrfy(config("dupvar_warn",0), '8652: config("dupvar_warn",0)');
|
vrfy(config("dupvar_warn",0), '8652: config("dupvar_warn",0)');
|
||||||
vrfy(u_glob == 6, '8653: u_glob == 6');
|
vrfy(u_glob == 6, '8653: u_glob == 6');
|
||||||
global u_glob = 555;
|
global u_glob = 555;
|
||||||
print '8654: reclare u_glob';
|
print '8654: declare u_glob';
|
||||||
vrfy(u_glob == 555, '8655: u_glob == 555');
|
vrfy(u_glob == 555, '8655: u_glob == 555');
|
||||||
define func_8650(u_glob) { local u_glob; return u_glob; }
|
define func_8650(u_glob) { local u_glob; return u_glob; }
|
||||||
print '8656: u_glob as both local and parameter';
|
print '8656: u_glob as both local and parameter';
|
||||||
@@ -7916,7 +7938,7 @@ vrfy(dotest("set8700.line", 8703) == 0,
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* new exponentiation functionaltiy
|
* new exponentiation functionality
|
||||||
*/
|
*/
|
||||||
print;
|
print;
|
||||||
return test_exponentiation();
|
return test_exponentiation();
|
||||||
@@ -7932,8 +7954,8 @@ print '8901: read -once "test8900"';
|
|||||||
read -once "test8900";
|
read -once "test8900";
|
||||||
print '8902: about to run test8900(1,,8903)';
|
print '8902: about to run test8900(1,,8903)';
|
||||||
testnum = test8900(1,,8903);
|
testnum = test8900(1,,8903);
|
||||||
print '8999: ecnt = 203;'
|
print '8999: ecnt = 211;'
|
||||||
ecnt = 203;
|
ecnt = 211;
|
||||||
/* 89xx: test calc resource functions by Christoph Zurnieden */
|
/* 89xx: test calc resource functions by Christoph Zurnieden */
|
||||||
|
|
||||||
|
|
||||||
@@ -8062,7 +8084,7 @@ return test_functions2();
|
|||||||
*
|
*
|
||||||
* beer.cal - prints a bunch of things when loaded
|
* beer.cal - prints a bunch of things when loaded
|
||||||
* hello.cal - designed to go into an infinite loop
|
* hello.cal - designed to go into an infinite loop
|
||||||
* lucal.cal - already read by this file
|
* lucas.cal - already read by this file
|
||||||
* lucas_chk.cal - already read by this file
|
* lucas_chk.cal - already read by this file
|
||||||
* regress.cal - this file
|
* regress.cal - this file
|
||||||
* surd.cal - already read by this file
|
* surd.cal - already read by this file
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* specialfunctions - special functions (e.g.: gamma, zeta, psi)
|
* specialfunctions - special functions (e.g.: gamma, zeta, psi)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Christoph Zurnieden
|
* Copyright (C) 2013,2021 Christoph Zurnieden
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the version 2.1 of the GNU Lesser General Public
|
||||||
@@ -442,8 +442,8 @@ define lngamma(z)
|
|||||||
if (tmp2 < tmp) {
|
if (tmp2 < tmp) {
|
||||||
return
|
return
|
||||||
newerror(strcat
|
newerror(strcat
|
||||||
("lngamma(1): something happend that ",
|
("lngamma(1): something happened ",
|
||||||
"should not have happend"));
|
"that shouldn't have happened"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -519,8 +519,8 @@ define lngamma(z)
|
|||||||
if (tmp2 < tmp) {
|
if (tmp2 < tmp) {
|
||||||
return
|
return
|
||||||
newerror(strcat
|
newerror(strcat
|
||||||
("lngamma(1): something happend ",
|
("lngamma(1): something happened ",
|
||||||
"that should not have happend"));
|
"that should not have happened"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -576,8 +576,8 @@ define lngamma(z)
|
|||||||
if (tmp2 < tmp) {
|
if (tmp2 < tmp) {
|
||||||
return
|
return
|
||||||
newerror(strcat
|
newerror(strcat
|
||||||
("lngamma(1): something happend ",
|
("lngamma(1): something happened ",
|
||||||
"that should not have happend"));
|
"that should not have happened"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1047,7 +1047,7 @@ define __CZ__ibeta_cf_var_dm(a, b, z, max)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m > max) {
|
if (m > max) {
|
||||||
return newerror("ibeta: continous fraction does not converge");
|
return newerror("ibeta: continuous fraction does not converge");
|
||||||
}
|
}
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
@@ -1290,7 +1290,7 @@ define __CZ__erfinvapprox(x)
|
|||||||
- (2 / (pi() * a) + (ln(1 - x ^ 2)) / 2));
|
- (2 / (pi() * a) + (ln(1 - x ^ 2)) / 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* complementary inverse errror function, faster at about x < 1-.91
|
/* complementary inverse error function, faster at about x < 1-.91
|
||||||
Henry E. Fettis. "A stable algorithm for computing the inverse error function
|
Henry E. Fettis. "A stable algorithm for computing the inverse error function
|
||||||
in the 'tail-end' region" Math. Comp., 28:585-587, 1974.
|
in the 'tail-end' region" Math. Comp., 28:585-587, 1974.
|
||||||
*/
|
*/
|
||||||
@@ -1324,7 +1324,7 @@ define __CZ__fettiscf(y, n)
|
|||||||
return t / (1 + r);
|
return t / (1 + r);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* inverse errror function, faster at about x<=.91*/
|
/* inverse error function, faster at about x<=.91*/
|
||||||
define __CZ__inverfbin(x)
|
define __CZ__inverfbin(x)
|
||||||
{
|
{
|
||||||
local places approx flow fhigh eps high low mid fmid epsilon;
|
local places approx flow fhigh eps high low mid fmid epsilon;
|
||||||
@@ -1370,7 +1370,7 @@ define erfinv(x)
|
|||||||
x = -x;
|
x = -x;
|
||||||
flag = 1;
|
flag = 1;
|
||||||
}
|
}
|
||||||
/* No need for full pecision */
|
/* No need for full precision */
|
||||||
eps = epsilon(1e-20);
|
eps = epsilon(1e-20);
|
||||||
if (eps >= 1e-40) {
|
if (eps >= 1e-40) {
|
||||||
/* Winitzki, Sergei (6 February 2008). "A handy approximation for the
|
/* Winitzki, Sergei (6 February 2008). "A handy approximation for the
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* statistics - Some assorted statistics functions.
|
* statistics - Some assorted statistics functions.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Christoph Zurnieden
|
* Copyright (C) 2013,2021 Christoph Zurnieden
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -106,7 +106,7 @@ define invbetainc_slow(x,a,b){
|
|||||||
GW Cran, KJ Martin, GE Thomas,
|
GW Cran, KJ Martin, GE Thomas,
|
||||||
Remark AS R19 and Algorithm AS 109:
|
Remark AS R19 and Algorithm AS 109:
|
||||||
A Remark on Algorithms AS 63: The Incomplete Beta Integral
|
A Remark on Algorithms AS 63: The Incomplete Beta Integral
|
||||||
and AS 64: Inverse of the Incomplete Beta Integeral,
|
and AS 64: Inverse of the Incomplete Beta integral,
|
||||||
Applied Statistics,
|
Applied Statistics,
|
||||||
Volume 26, Number 1, 1977, pages 111-114.
|
Volume 26, Number 1, 1977, pages 111-114.
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* test2600 - 2600 series of the regress.cal test suite
|
* test2600 - 2600 series of the regress.cal test suite
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Ernest Bowen and Landon Curt Noll
|
* Copyright (C) 1999,2021 Ernest Bowen and Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Primary author: Ernest Bowen
|
* Primary author: Ernest Bowen
|
||||||
*
|
*
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
* of b in power(a, b, eps) is large, the computation required for
|
* of b in power(a, b, eps) is large, the computation required for
|
||||||
* a test may be very heavy.
|
* a test may be very heavy.
|
||||||
*
|
*
|
||||||
* Test funcations are called as:
|
* Test functions are called as:
|
||||||
*
|
*
|
||||||
* testabc(str, ..., verbose)
|
* testabc(str, ..., verbose)
|
||||||
*
|
*
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* test2700 - 2700 series of the regress.cal test suite
|
* test2700 - 2700 series of the regress.cal test suite
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Ernest Bowen and Landon Curt Noll
|
* Copyright (C) 1999,2021 Ernest Bowen and Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Primary author: Ernest Bowen
|
* Primary author: Ernest Bowen
|
||||||
*
|
*
|
||||||
@@ -84,7 +84,7 @@ define mkfrac() = rand(2) ? mkposfrac() : -mkposfrac();
|
|||||||
define mksquarereal() = mknonnegreal()^2;
|
define mksquarereal() = mknonnegreal()^2;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We might be able to do better than the following. For nonsquare
|
* We might be able to do better than the following. For non-square
|
||||||
* positive integer less than 1e6, could use:
|
* positive integer less than 1e6, could use:
|
||||||
* x = rand(1, 1000);
|
* x = rand(1, 1000);
|
||||||
* return rand(x^2 + 1, (x + 1)^2);
|
* return rand(x^2 + 1, (x + 1)^2);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* test5100 - 5100 series of the regress.cal test suite
|
* test5100 - 5100 series of the regress.cal test suite
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Ernest Bowen and Landon Curt Noll
|
* Copyright (C) 1999,2021 Ernest Bowen and Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Primary author: Ernest Bowen
|
* Primary author: Ernest Bowen
|
||||||
*
|
*
|
||||||
@@ -35,7 +35,7 @@ defaultverbose = 1; /* default verbose value */
|
|||||||
* with zero value, when the definition is read.
|
* with zero value, when the definition is read.
|
||||||
*
|
*
|
||||||
* The variable a5100 is initialized with the value x if and when this
|
* The variable a5100 is initialized with the value x if and when this
|
||||||
* function is first called with a positive even x. The varable b5100
|
* function is first called with a positive even x. The variable b5100
|
||||||
* is similarly initialized if and when this function is first called positive
|
* is similarly initialized if and when this function is first called positive
|
||||||
* odd x.
|
* odd x.
|
||||||
*
|
*
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* test8500 - 8500 series of the regress.cal test suite
|
* test8500 - 8500 series of the regress.cal test suite
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Ernest Bowen and Landon Curt Noll
|
* Copyright (C) 1999,2021 Ernest Bowen and Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Primary author: Ernest Bowen
|
* Primary author: Ernest Bowen
|
||||||
*
|
*
|
||||||
@@ -169,7 +169,7 @@ define divmod_8500(N = 10, M1 = 2^128, M2 = 2^64, testnum = 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* seelect one of the 32 rounding modes at random
|
* select one of the 32 rounding modes at random
|
||||||
*/
|
*/
|
||||||
rnd = rand(32);
|
rnd = rand(32);
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* test8900 - 8900 series of the regress.cal test suite
|
* test8900 - 8900 series of the regress.cal test suite
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Christoph Zurnieden
|
* Copyright (C) 2013,2021 Christoph Zurnieden
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -26,7 +26,7 @@ static __CZ__eps = 1e-20;
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* load once, the calc resource functions contribued by Christoph Zurnieden
|
* load once, the calc resource functions contributed by Christoph Zurnieden
|
||||||
*/
|
*/
|
||||||
read -once bernpoly.cal;
|
read -once bernpoly.cal;
|
||||||
read -once brentsolve.cal;
|
read -once brentsolve.cal;
|
||||||
@@ -45,7 +45,7 @@ read -once intnum.cal;
|
|||||||
/*
|
/*
|
||||||
* tests of correctness of the functions implemented by the above listed
|
* tests of correctness of the functions implemented by the above listed
|
||||||
* author. All values tested against have been computed with at least two
|
* author. All values tested against have been computed with at least two
|
||||||
* independant algorithms where possible (indicated if not).
|
* independent algorithms where possible (indicated if not).
|
||||||
*/
|
*/
|
||||||
define t01()
|
define t01()
|
||||||
{
|
{
|
||||||
@@ -1649,7 +1649,7 @@ define t03()
|
|||||||
/* test 04 tests polygamma(m,z) for the following values (m==0 gets computed
|
/* test 04 tests polygamma(m,z) for the following values (m==0 gets computed
|
||||||
* by psi()).
|
* by psi()).
|
||||||
* Values tested against were computed with Mathematica(TM) only
|
* Values tested against were computed with Mathematica(TM) only
|
||||||
* (z in the left complex halfplane does not get computed yet)
|
* (z in the left complex half plane does not get computed yet)
|
||||||
*/
|
*/
|
||||||
define t04()
|
define t04()
|
||||||
{
|
{
|
||||||
@@ -2057,7 +2057,12 @@ define t010()
|
|||||||
epsilon(eps);
|
epsilon(eps);
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
if ((stirling2(10, 5) - (42525)) != 0) {
|
/*
|
||||||
|
* Once, when an expression such as 0^(6-6) returned 0,
|
||||||
|
* then stirling2(10, 5) == 42525. However when we made9
|
||||||
|
* 0^(6-6) == 0^0 == 1, then stirling2(10, 5) == 5102999/120.
|
||||||
|
*/
|
||||||
|
if ((stirling2(10, 5) - (5102999/120)) != 0) {
|
||||||
epsilon(eps);
|
epsilon(eps);
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* toomcook - implementation of Toom-Cook(3,4) multiplication algorithm
|
* toomcook - implementation of Toom-Cook(3,4) multiplication algorithm
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Christoph Zurnieden
|
* Copyright (C) 2013,2021 Christoph Zurnieden
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -320,16 +320,16 @@ define toomcook4square(a){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
TODO: Implement the asymmetric variations
|
* TODO: Implement the asymmetric variations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
produce_long_random_number(n) returns large pseudorandom numbers. Really large
|
* produce_long_random_number(n) returns large pseudo-random numbers.
|
||||||
numbers, e.g.:
|
* Really large numbers, e.g.:
|
||||||
produce_long_random_number(16)
|
* produce_long_random_number(16)
|
||||||
is ca 4,128,561 bits (ca 1,242,821 dec. digits) large. Exact length is not
|
* is ca 4,128,561 bits (ca 1,242,821 dec. digits) large. Exact length is not
|
||||||
predeterminable because of the chaotic output of the function random().
|
* pre-determinable because of the chaotic output of the function random().
|
||||||
*/
|
*/
|
||||||
define __CZ__produce_long_random_number(n)
|
define __CZ__produce_long_random_number(n)
|
||||||
{
|
{
|
||||||
local ret k;
|
local ret k;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* unixfrac - represent a fraction as a sum of distince unit fractions
|
* unixfrac - represent a fraction as a sum of distance unit fractions
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 David I. Bell
|
* Copyright (C) 1999,2021 David I. Bell
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
@@ -34,7 +34,7 @@ define hurwitzzeta(s,a){
|
|||||||
/*
|
/*
|
||||||
According to Linas Vepstas' "An efficient algorithm for accelerating
|
According to Linas Vepstas' "An efficient algorithm for accelerating
|
||||||
the convergence of oscillatory series, useful for computing the
|
the convergence of oscillatory series, useful for computing the
|
||||||
polylogarithm and Hurwitz zeta functions" the Euler-Maclaurin series
|
poly-logarithm and Hurwitz zeta functions" the Euler-Maclaurin series
|
||||||
is the fastest in most cases.
|
is the fastest in most cases.
|
||||||
|
|
||||||
With a lot of help of the PARI/GP implementation by Prof. Henri Cohen,
|
With a lot of help of the PARI/GP implementation by Prof. Henri Cohen,
|
||||||
@@ -78,7 +78,7 @@ define hurwitzzeta(s,a){
|
|||||||
print "limit = " limit;
|
print "limit = " limit;
|
||||||
print "prec = " precision;
|
print "prec = " precision;
|
||||||
}
|
}
|
||||||
/* Full precison plus 5 digits angstzuschlag*/
|
/* Full precision plus 5 digits angstzuschlag*/
|
||||||
epsilon( (10^(-precision)) * 1e-5);
|
epsilon( (10^(-precision)) * 1e-5);
|
||||||
tmp3=(a+limit_function+0.)^(-s);
|
tmp3=(a+limit_function+0.)^(-s);
|
||||||
sum3 = tmp3/2;
|
sum3 = tmp3/2;
|
||||||
|
43
calc.c
43
calc.c
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* calc - arbitrary precision calculator
|
* calc - arbitrary precision calculator
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2013 David I. Bell, Landon Curt Noll and Ernest Bowen
|
* Copyright (C) 1999-2013,2021 David I. Bell, Landon Curt Noll
|
||||||
|
* and Ernest Bowen
|
||||||
*
|
*
|
||||||
* Primary author: David I. Bell
|
* Primary author: David I. Bell
|
||||||
*
|
*
|
||||||
@@ -104,6 +105,8 @@ main(int argc, char **argv)
|
|||||||
int c; /* option */
|
int c; /* option */
|
||||||
int index;
|
int index;
|
||||||
int maxindex;
|
int maxindex;
|
||||||
|
/* fix gcc warning bug */
|
||||||
|
int unusedint = 0;
|
||||||
char *cp;
|
char *cp;
|
||||||
char *endcp;
|
char *endcp;
|
||||||
char *bp;
|
char *bp;
|
||||||
@@ -278,7 +281,9 @@ main(int argc, char **argv)
|
|||||||
exit(6);
|
exit(6);
|
||||||
}
|
}
|
||||||
calc_debug = cp;
|
calc_debug = cp;
|
||||||
(void) strtol(cp, &endcp, 10);
|
/* fix gcc warning bug */
|
||||||
|
unusedint =
|
||||||
|
strtol(cp, &endcp, 10);
|
||||||
cp = endcp;
|
cp = endcp;
|
||||||
if (*cp != '\0' &&
|
if (*cp != '\0' &&
|
||||||
*cp != ' ' && *cp != ':') {
|
*cp != ' ' && *cp != ':') {
|
||||||
@@ -310,7 +315,9 @@ main(int argc, char **argv)
|
|||||||
exit(9);
|
exit(9);
|
||||||
}
|
}
|
||||||
resource_debug = cp;
|
resource_debug = cp;
|
||||||
(void) strtol(cp, &endcp, 10);
|
/* fix gcc warning bug */
|
||||||
|
unusedint =
|
||||||
|
strtol(cp, &endcp, 10);
|
||||||
cp = endcp;
|
cp = endcp;
|
||||||
if (*cp != '\0' &&
|
if (*cp != '\0' &&
|
||||||
*cp != ' ' && *cp != ':') {
|
*cp != ' ' && *cp != ':') {
|
||||||
@@ -340,7 +347,8 @@ main(int argc, char **argv)
|
|||||||
exit(12);
|
exit(12);
|
||||||
}
|
}
|
||||||
user_debug = cp;
|
user_debug = cp;
|
||||||
(void) strtol(cp, &endcp, 10);
|
/* unusedint avoids gcc warning bug */
|
||||||
|
unusedint = strtol(cp, &endcp, 10);
|
||||||
cp = endcp;
|
cp = endcp;
|
||||||
if (*cp != '\0' && *cp != ' ') {
|
if (*cp != '\0' && *cp != ' ') {
|
||||||
fprintf(stderr, "Bad syntax in"
|
fprintf(stderr, "Bad syntax in"
|
||||||
@@ -396,7 +404,7 @@ main(int argc, char **argv)
|
|||||||
" long");
|
" long");
|
||||||
exit(18);
|
exit(18);
|
||||||
}
|
}
|
||||||
/* XXX What if *cp = '\''? */
|
/* XXX - what if *cp = '\''? */
|
||||||
*bp++ = '\'';
|
*bp++ = '\'';
|
||||||
strncpy(bp, cp, len+1);
|
strncpy(bp, cp, len+1);
|
||||||
bp += len;
|
bp += len;
|
||||||
@@ -442,7 +450,7 @@ main(int argc, char **argv)
|
|||||||
"\t[-O] [-p] [-q] [-s] [-u] [-v] "
|
"\t[-O] [-p] [-q] [-s] [-u] [-v] "
|
||||||
"[--] [calc_cmd ...]\n"
|
"[--] [calc_cmd ...]\n"
|
||||||
"usage: %s ... -f filename\n"
|
"usage: %s ... -f filename\n"
|
||||||
"1st cscript line: #/path/to/calc ... -f\n",
|
"1st cscript line: #/path/to/calc ... -s -f\n",
|
||||||
program, program);
|
program, program);
|
||||||
exit(20);
|
exit(20);
|
||||||
}
|
}
|
||||||
@@ -472,7 +480,22 @@ main(int argc, char **argv)
|
|||||||
program);
|
program);
|
||||||
exit(21);
|
exit(21);
|
||||||
}
|
}
|
||||||
strncpy(cmdbuf + cmdlen, cp, cplen+1);
|
/*
|
||||||
|
* The next statement could be:
|
||||||
|
*
|
||||||
|
* strncpy(cmdbuf + cmdlen, cp, cplen);
|
||||||
|
*
|
||||||
|
* however compilers like gcc would issue warnings such as:
|
||||||
|
*
|
||||||
|
* specified bound depends on the length of the
|
||||||
|
* source argument
|
||||||
|
*
|
||||||
|
* even though we terminate the string by setting a NUL
|
||||||
|
* byte following the copy. Therefore we call memcpy()
|
||||||
|
* instead to avoid such warnings.
|
||||||
|
*/
|
||||||
|
memcpy(cmdbuf + cmdlen, cp, cplen);
|
||||||
|
cmdbuf[newcmdlen] = '\0';
|
||||||
cmdlen = newcmdlen;
|
cmdlen = newcmdlen;
|
||||||
index++;
|
index++;
|
||||||
if (index < maxindex)
|
if (index < maxindex)
|
||||||
@@ -721,8 +744,10 @@ main(int argc, char **argv)
|
|||||||
printf("main: run_state = %s\n", run_state_name(run_state));
|
printf("main: run_state = %s\n", run_state_name(run_state));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* all done
|
* All done! - Jessica Noll, Age 2
|
||||||
*/
|
*/
|
||||||
|
/* fix gcc warning bug */
|
||||||
|
unusedint++;
|
||||||
libcalc_call_me_last();
|
libcalc_call_me_last();
|
||||||
return (run_state == RUN_EXIT_WITH_ERROR ||
|
return (run_state == RUN_EXIT_WITH_ERROR ||
|
||||||
run_state == RUN_ZERO) ? 1 : 0;
|
run_state == RUN_ZERO) ? 1 : 0;
|
||||||
@@ -766,7 +791,7 @@ calc_interrupt(char *fmt, ...)
|
|||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vsnprintf(calc_err_msg, MAXERROR, fmt, ap);
|
vsnprintf(calc_err_msg, MAXERROR, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
calc_err_msg[MAXERROR] = '\0';
|
calc_err_msg[MAXERROR] = '\0'; /* paranoia */
|
||||||
fprintf(stderr, "%s\n\n", calc_err_msg);
|
fprintf(stderr, "%s\n\n", calc_err_msg);
|
||||||
funcname = NULL;
|
funcname = NULL;
|
||||||
if (calc_use_scanerr_jmpbuf != 0) {
|
if (calc_use_scanerr_jmpbuf != 0) {
|
||||||
|
10
calc.h
10
calc.h
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* calc - definitions for calculator program
|
* calc - definitions for calculator program
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007,2014 David I. Bell
|
* Copyright (C) 1999-2007,2014,2021 David I. Bell
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -48,6 +48,9 @@
|
|||||||
#define HOME "HOME" /* environment variable for home dir */
|
#define HOME "HOME" /* environment variable for home dir */
|
||||||
#define PAGER "PAGER" /* environment variable for help */
|
#define PAGER "PAGER" /* environment variable for help */
|
||||||
#define SHELL "SHELL" /* environment variable for shell */
|
#define SHELL "SHELL" /* environment variable for shell */
|
||||||
|
#define CALCHISTFILE "CALCHISTFILE" /* history file environment variable */
|
||||||
|
#define CALCHELP "CALCHELP" /* help directory env variable */
|
||||||
|
#define CALCCUSTOMHELP "CALCCUSTOMHELP"/* custom help directory env variable */
|
||||||
#define DEFAULTCALCBINDINGS "bindings" /* default calc bindings file */
|
#define DEFAULTCALCBINDINGS "bindings" /* default calc bindings file */
|
||||||
#define DEFAULTCALCHELP "help" /* help file that -h prints */
|
#define DEFAULTCALCHELP "help" /* help file that -h prints */
|
||||||
#define DEFAULTSHELL "sh" /* default shell to use */
|
#define DEFAULTSHELL "sh" /* default shell to use */
|
||||||
@@ -65,7 +68,6 @@
|
|||||||
|
|
||||||
#define SYMBOLSIZE 256 /* maximum symbol name size */
|
#define SYMBOLSIZE 256 /* maximum symbol name size */
|
||||||
#define MAXLABELS 100 /* maximum number of user labels in function */
|
#define MAXLABELS 100 /* maximum number of user labels in function */
|
||||||
#define MAXSTRING 1024 /* maximum size of string constant */
|
|
||||||
#define MAXSTACK 2048 /* maximum depth of evaluation stack */
|
#define MAXSTACK 2048 /* maximum depth of evaluation stack */
|
||||||
#define MAXFILES 20 /* maximum number of opened files */
|
#define MAXFILES 20 /* maximum number of opened files */
|
||||||
#define PROMPT1 "> " /* default normal prompt*/
|
#define PROMPT1 "> " /* default normal prompt*/
|
||||||
@@ -230,8 +232,8 @@ EXTERN int no_env; /* TRUE (-e) => ignore env vars on startup */
|
|||||||
EXTERN long errmax; /* if >= 0, error when errcount exceeds errmax */
|
EXTERN long errmax; /* if >= 0, error when errcount exceeds errmax */
|
||||||
EXTERN int use_old_std; /* TRUE (-O) => use classic configuration */
|
EXTERN int use_old_std; /* TRUE (-O) => use classic configuration */
|
||||||
|
|
||||||
EXTERN int allow_read; /* FALSE => dont open any files for reading */
|
EXTERN int allow_read; /* FALSE => don't open any files for reading */
|
||||||
EXTERN int allow_write; /* FALSE => dont open any files for writing */
|
EXTERN int allow_write; /* FALSE => don't open any files for writing */
|
||||||
EXTERN int allow_exec; /* FALSE => may not execute any commands */
|
EXTERN int allow_exec; /* FALSE => may not execute any commands */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
404
calc.man
404
calc.man
@@ -1,5 +1,5 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" Copyright (C) 1999-2007,2014 Landon Curt Noll
|
.\" Copyright (C) 1999-2007,2014,2018,2021 Landon Curt Noll
|
||||||
.\"
|
.\"
|
||||||
.\" Calc is open software; you can redistribute it and/or modify it under
|
.\" Calc is open software; you can redistribute it and/or modify it under
|
||||||
.\" the terms of the version 2.1 of the GNU Lesser General Public License
|
.\" the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
.\" calculator by David I. Bell
|
.\" calculator by David I. Bell
|
||||||
.\" man page by Landon Noll
|
.\" man page by Landon Noll
|
||||||
.\"
|
.\"
|
||||||
.TH calc 1 "^..^" "2007-02-06"
|
.TH calc 1 "^..^" "Share and enjoy! :-)"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
calc \- arbitrary precision calculator
|
calc \- arbitrary precision calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@@ -50,7 +50,7 @@ calc \- arbitrary precision calculator
|
|||||||
.RB [ [\-\-]\ calc_cmd\ \&.\|.\|. ]
|
.RB [ [\-\-]\ calc_cmd\ \&.\|.\|. ]
|
||||||
.in -5n
|
.in -5n
|
||||||
.sp
|
.sp
|
||||||
\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-f\fP
|
\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-s\fP \fB\-f\fP
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
\&
|
\&
|
||||||
.br
|
.br
|
||||||
@@ -138,7 +138,7 @@ calc -d "read qtime; qtime(2)"
|
|||||||
.fi
|
.fi
|
||||||
.in -5n
|
.in -5n
|
||||||
.sp 1
|
.sp 1
|
||||||
will just say:
|
will just print:
|
||||||
.sp 1
|
.sp 1
|
||||||
.in +5n
|
.in +5n
|
||||||
.nf
|
.nf
|
||||||
@@ -148,6 +148,41 @@ It's nearly ten past six.
|
|||||||
.sp 1
|
.sp 1
|
||||||
This flag disables the reporting of missing calc
|
This flag disables the reporting of missing calc
|
||||||
startup resource files.
|
startup resource files.
|
||||||
|
.sp 1
|
||||||
|
|
||||||
|
This flag also disables the printing the leading tilde. For example:
|
||||||
|
.sp 1
|
||||||
|
.in +5n
|
||||||
|
.nf
|
||||||
|
calc 2/3
|
||||||
|
.fi
|
||||||
|
.in -5n
|
||||||
|
.sp 1
|
||||||
|
will print:
|
||||||
|
.sp 1
|
||||||
|
.in +5n
|
||||||
|
.nf
|
||||||
|
~0.66666666666666666667
|
||||||
|
.fi
|
||||||
|
.in -5n
|
||||||
|
.sp 1
|
||||||
|
.sp 1
|
||||||
|
whereas:
|
||||||
|
.sp 1
|
||||||
|
.in +5n
|
||||||
|
.nf
|
||||||
|
calc -d 2/3
|
||||||
|
.fi
|
||||||
|
.in -5n
|
||||||
|
.sp 1
|
||||||
|
will just print:
|
||||||
|
.sp 1
|
||||||
|
.in +5n
|
||||||
|
.nf
|
||||||
|
0.66666666666666666667
|
||||||
|
.fi
|
||||||
|
.in -5n
|
||||||
|
.sp 1
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BR -D " calc_debug[:resource_debug[:user_debug]]"
|
.BR -D " calc_debug[:resource_debug[:user_debug]]"
|
||||||
@@ -184,24 +219,29 @@ The getenv() builtin will still return values, however.
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-f
|
.B \-f
|
||||||
|
This flag is normally only with calc shell scripts.
|
||||||
|
.sp 1
|
||||||
This flag is required when using calc in
|
This flag is required when using calc in
|
||||||
.BR "shell script mode" .
|
.BR "shell script mode" .
|
||||||
It must be at the end of the initial
|
It must be at the end of the initial
|
||||||
.B #!
|
.B #!
|
||||||
line of the script.
|
line of the script
|
||||||
|
and must be immediately preceded by the
|
||||||
|
.B \-s
|
||||||
|
flag.
|
||||||
.sp 1
|
.sp 1
|
||||||
This flag is normally only at the end of a calc shell script.
|
|
||||||
If the first line of an executable file begins
|
If the first line of an executable file begins
|
||||||
.B #!
|
.B #!
|
||||||
followed by the absolute pathname of the
|
followed by the absolute pathname of the
|
||||||
.B calc
|
.B calc
|
||||||
program and the flag
|
program and if the first line ends with the two flags
|
||||||
|
.B \-s
|
||||||
.B \-f
|
.B \-f
|
||||||
as in:
|
as in:
|
||||||
.sp 1
|
.sp 1
|
||||||
.in +5n
|
.in +5n
|
||||||
.nf
|
.nf
|
||||||
\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-f\fP
|
\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-s\fP \fB\-f\fP
|
||||||
.fi
|
.fi
|
||||||
.in -5n
|
.in -5n
|
||||||
.sp 1
|
.sp 1
|
||||||
@@ -235,7 +275,7 @@ on the command line:
|
|||||||
.sp 1
|
.sp 1
|
||||||
.in +5n
|
.in +5n
|
||||||
.nf
|
.nf
|
||||||
\fIcalc\fP\ [other_flags\ \&...] \fB\-f\fP filename
|
\fIcalc\fP\ [other_flags\ \&...] \fB\-s\fP \fB\-f\fP filename
|
||||||
.fi
|
.fi
|
||||||
.in -5n
|
.in -5n
|
||||||
.sp 1
|
.sp 1
|
||||||
@@ -248,6 +288,16 @@ Use of
|
|||||||
.B \-f
|
.B \-f
|
||||||
implies
|
implies
|
||||||
.BR \-s .
|
.BR \-s .
|
||||||
|
However in a calc shell script,
|
||||||
|
one must include
|
||||||
|
.B \-f
|
||||||
|
before
|
||||||
|
.B \-s
|
||||||
|
on the initial
|
||||||
|
.B #!
|
||||||
|
line.
|
||||||
|
|
||||||
|
.sp 1
|
||||||
In addition,
|
In addition,
|
||||||
.B \-d
|
.B \-d
|
||||||
and
|
and
|
||||||
@@ -718,25 +768,28 @@ If the first line of an executable file begins
|
|||||||
.B #!
|
.B #!
|
||||||
followed by the absolute pathname of the
|
followed by the absolute pathname of the
|
||||||
.B calc
|
.B calc
|
||||||
program and the flag
|
program and the first line ends with the two flags
|
||||||
|
.B \-s
|
||||||
.B \-f
|
.B \-f
|
||||||
as in:
|
as in:
|
||||||
.sp 1
|
.sp 1
|
||||||
.in +5n
|
.in +5n
|
||||||
.nf
|
.nf
|
||||||
\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-f\fP
|
\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-s\fP \fB\-f\fP
|
||||||
.fi
|
.fi
|
||||||
.in -5n
|
.in -5n
|
||||||
.sp 1
|
.sp 1
|
||||||
the rest of the file will be processed in
|
the rest of the file will be processed in
|
||||||
.BR "shell script mode" .
|
.BR "shell script mode" .
|
||||||
Note that
|
Note that
|
||||||
|
.B \-s
|
||||||
.B \-f
|
.B \-f
|
||||||
must at the end of the initial ``#!'' line.
|
must at the end of the initial ``#!'' line.
|
||||||
Any other optional
|
Any other optional
|
||||||
.B "other_flags"
|
.B "other_flags"
|
||||||
must come before
|
must come before
|
||||||
the
|
the
|
||||||
|
.B \-s
|
||||||
.BR \-f .
|
.BR \-f .
|
||||||
.sp 1
|
.sp 1
|
||||||
In
|
In
|
||||||
@@ -768,18 +821,26 @@ the file
|
|||||||
.sp 1
|
.sp 1
|
||||||
.in +5n
|
.in +5n
|
||||||
.nf
|
.nf
|
||||||
\fI#!${BINDIR}/calc\fP\ \&\fB\-q\fP \fB\-f\fP
|
\fI#!${BINDIR}/calc\fP\ \&\fB\-q\fP \&\fB\-s\fP \fB\-f\fP
|
||||||
#
|
|
||||||
# mersenne - an example of a calc \fBshell script file\fP
|
/* setup */
|
||||||
|
argc = argv();
|
||||||
|
program = argv(0);
|
||||||
|
stderr = files(2);
|
||||||
|
|
||||||
/* parse args */
|
/* parse args */
|
||||||
if (argv() != 1) {
|
if (argc != 2) {
|
||||||
fprintf(files(2), "usage: %s exp\\n", config("program"));
|
fprintf(stderr, "usage: %s exp\n", program);
|
||||||
|
abort "must give one exponent arg";
|
||||||
|
}
|
||||||
|
exp = eval(argv(1));
|
||||||
|
if (!isint(exp) || exp < 0) {
|
||||||
|
fprintf(stderr, "%s: exp must be non-negative integer\n", program);
|
||||||
abort "must give one exponent arg";
|
abort "must give one exponent arg";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* print the mersenne number */
|
/* print the mersenne number */
|
||||||
print "2^": argv(0) : "-1 =", 2^eval(argv(0))-1;
|
print "2^": exp : "-1 =", 2^exp-1;
|
||||||
.fi
|
.fi
|
||||||
.in -5n
|
.in -5n
|
||||||
.sp 1
|
.sp 1
|
||||||
@@ -809,9 +870,9 @@ will print:
|
|||||||
.sp 1
|
.sp 1
|
||||||
Note that because
|
Note that because
|
||||||
.B \-s
|
.B \-s
|
||||||
is assumed in
|
is required in
|
||||||
.B "shell script mode"
|
.B "shell script mode"
|
||||||
and non-dashed args are made available as
|
non-dashed args are made available as
|
||||||
strings via the
|
strings via the
|
||||||
.BR argv ()
|
.BR argv ()
|
||||||
builtin function.
|
builtin function.
|
||||||
@@ -819,16 +880,16 @@ Therefore:
|
|||||||
.sp 1
|
.sp 1
|
||||||
.in +5n
|
.in +5n
|
||||||
.nf
|
.nf
|
||||||
2^eval(argv(0))-1
|
2^eval(argv(1))-1
|
||||||
.fi
|
.fi
|
||||||
.in -5n
|
.in -5n
|
||||||
.sp 1
|
.sp 1
|
||||||
will print the decimal value of 2^n-1
|
will print the decimal value of 2^n-1
|
||||||
but
|
whereas
|
||||||
.sp 1
|
.sp 1
|
||||||
.in +5n
|
.in +5n
|
||||||
.nf
|
.nf
|
||||||
2^argv(0)-1
|
2^argv(1)-1
|
||||||
.fi
|
.fi
|
||||||
.in -5n
|
.in -5n
|
||||||
.sp 1
|
.sp 1
|
||||||
@@ -1042,6 +1103,26 @@ Default value: binding
|
|||||||
This variable is not used if calc was compiled with GNU-readline support.
|
This variable is not used if calc was compiled with GNU-readline support.
|
||||||
In that case, the standard readline mechanisms (see readline(3)) are used.
|
In that case, the standard readline mechanisms (see readline(3)) are used.
|
||||||
.sp
|
.sp
|
||||||
|
.TP 5
|
||||||
|
CALCHISTFILE
|
||||||
|
Location of the calc history file.
|
||||||
|
.sp
|
||||||
|
Default value: ~/.calc_history
|
||||||
|
.sp
|
||||||
|
This variable is not used if calc was compiled with GNU-readline support.
|
||||||
|
.sp
|
||||||
|
.TP 5
|
||||||
|
CALCHELP
|
||||||
|
Location of the calc help directory.
|
||||||
|
.sp
|
||||||
|
Default value: ${HELPDIR}
|
||||||
|
.sp
|
||||||
|
.TP 5
|
||||||
|
CALCCUSTOMHELP
|
||||||
|
Location of the calc custom help directory.
|
||||||
|
.sp
|
||||||
|
Default value: ${CUSTOMHELPDIR}
|
||||||
|
.sp
|
||||||
.SH CREDIT
|
.SH CREDIT
|
||||||
\&
|
\&
|
||||||
.br
|
.br
|
||||||
@@ -1051,7 +1132,7 @@ was written by David I. Bell.
|
|||||||
.sp
|
.sp
|
||||||
The
|
The
|
||||||
.B calc
|
.B calc
|
||||||
primary mirror, calc mailing list and calc bug report
|
primary mirror, and calc bug report
|
||||||
processing is performed by Landon Curt Noll.
|
processing is performed by Landon Curt Noll.
|
||||||
.sp
|
.sp
|
||||||
Landon Curt Noll maintains the master reference source, performs
|
Landon Curt Noll maintains the master reference source, performs
|
||||||
@@ -1130,76 +1211,71 @@ This man page is:
|
|||||||
.sp
|
.sp
|
||||||
.in +0.5i
|
.in +0.5i
|
||||||
.nf
|
.nf
|
||||||
Copyright (C) 1999 Landon Curt Noll
|
Copyright (C) 1999-2021 Landon Curt Noll
|
||||||
.fi
|
.fi
|
||||||
.in -0.5i
|
.in -0.5i
|
||||||
.sp
|
.sp
|
||||||
and is covered under version 2.1 GNU Lesser General
|
and is covered under version 2.1 GNU Lesser General
|
||||||
Public License.
|
Public License.
|
||||||
.sp
|
.sp
|
||||||
.SH "CALC MAILING LIST / CALC UPDATES / ENHANCEMENTS"
|
.SH "CALC QUESTIONS"
|
||||||
\&
|
\&
|
||||||
.br
|
.br
|
||||||
|
If you have a simple general question about calc, send Email to:
|
||||||
.sp
|
.sp
|
||||||
To contribute comments, suggestions, enhancements
|
.in +0.5i
|
||||||
and interesting
|
calc-quest-mail at asthe dot com
|
||||||
.B calc
|
|
||||||
resource files, and
|
|
||||||
shell scripts please join the calc-tester
|
|
||||||
low volume moderated calc mailing list.
|
|
||||||
.sp
|
.sp
|
||||||
To the calc-tester mailing list, visit the following URL:
|
NOTE: Remove spaces and replace 'at' with @, and 'dot' with .
|
||||||
|
.in -0.5i
|
||||||
|
.sp
|
||||||
|
.in +0.5i
|
||||||
|
NOTE: Yes, the Email address uses 'asthe',
|
||||||
|
while the web site uses 'isthe'.
|
||||||
|
.in -0.5i
|
||||||
|
.sp
|
||||||
|
.B PLEASE
|
||||||
|
put following the
|
||||||
|
.B SPECIAL PHRASE
|
||||||
|
somewhere in your Email Subject line:
|
||||||
|
.sp
|
||||||
|
.in +0.5i
|
||||||
|
.B calc question
|
||||||
|
.in -0.5i
|
||||||
|
.sp
|
||||||
|
You may add additional words to your subject line.
|
||||||
|
.sp
|
||||||
|
.B IMPORTANT:
|
||||||
|
If your Email doesn't contain the above phrase,
|
||||||
|
then we
|
||||||
|
.B WILL NOT SEE
|
||||||
|
your Email.
|
||||||
|
.sp
|
||||||
|
.B PLEASE BE SURE
|
||||||
|
you have that
|
||||||
|
.B SPECIAL PHRASE
|
||||||
|
somewhere in the subject line!
|
||||||
|
.sp
|
||||||
|
.B Suggestion:
|
||||||
|
.sp
|
||||||
|
.in +0.5i
|
||||||
|
From time to time, the Email address and Subject
|
||||||
|
.B SPECIAL PHRASE
|
||||||
|
may change so verify you have the current info by visiting:
|
||||||
.sp
|
.sp
|
||||||
.in +0.5i
|
.in +0.5i
|
||||||
.nf
|
.nf
|
||||||
https://www.listbox.com/subscribe/?list_id=239342
|
http://www.isthe.com/chongo/tech/comp/calc/calc-question.html
|
||||||
.fi
|
.fi
|
||||||
.in -0.5i
|
.in -0.5i
|
||||||
.sp
|
|
||||||
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
|
|
||||||
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
|
.in -0.5i
|
||||||
.sp
|
.sp
|
||||||
If you need a human to help you with your mailing list subscription,
|
Please limit your questions to general questions about calc.
|
||||||
or if you have problems with the above procedure, please
|
We cannot go into great detail in our answers,
|
||||||
send EMail to our special address:
|
nor can we do your homework, nor can
|
||||||
|
we do much more than answer short general questions about calc.
|
||||||
.sp
|
.sp
|
||||||
.in +0.5i
|
Please be patient as we cannot always respond to Email messages quickly.
|
||||||
.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
|
.sp
|
||||||
.SH "BUG REPORTS / BUG FIXES"
|
.SH "BUG REPORTS / BUG FIXES"
|
||||||
\&
|
\&
|
||||||
@@ -1209,28 +1285,51 @@ Send bug reports and bug fixes to:
|
|||||||
.sp
|
.sp
|
||||||
.in +0.5i
|
.in +0.5i
|
||||||
.nf
|
.nf
|
||||||
calc-bug-report at asthe dot com
|
calc-bugrept 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
|
.fi
|
||||||
|
.sp
|
||||||
|
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||||
|
.sp
|
||||||
|
NOTE: Yes, the Email address uses 'asthe',
|
||||||
|
while the web site uses 'isthe'.
|
||||||
.in -0.5i
|
.in -0.5i
|
||||||
.sp
|
.sp
|
||||||
Your subject must contain the words:
|
You
|
||||||
|
.B MUST
|
||||||
|
use following
|
||||||
|
.B SPECIAL PHRASE
|
||||||
|
in your Email Subject line:
|
||||||
|
.sp
|
||||||
|
.in +0.5i
|
||||||
|
.B calc bug report
|
||||||
|
.in -0.5i
|
||||||
|
.sp
|
||||||
|
You may add additional words to your subject line.
|
||||||
|
.sp
|
||||||
|
.B Suggestion:
|
||||||
|
.sp
|
||||||
|
.in +0.5i
|
||||||
|
From time to time, the Email address and Subject
|
||||||
|
.B SPECIAL PHRASE
|
||||||
|
may change so verify you have the current info by visiting:
|
||||||
.sp
|
.sp
|
||||||
.in +0.5i
|
.in +0.5i
|
||||||
.nf
|
.nf
|
||||||
calc bug report
|
http://www.isthe.com/chongo/tech/comp/calc/calc-bugrept.html
|
||||||
.fi
|
.fi
|
||||||
.in -0.5i
|
.in -0.5i
|
||||||
|
.in -0.5i
|
||||||
.sp
|
.sp
|
||||||
You may have additional words in your subject line.
|
.B IMPORTANT:
|
||||||
.in
|
If your Email doesn't contain the above phrase,
|
||||||
However, you may find it more helpful to simply subscribe to the
|
then we
|
||||||
calc-tester mailing list (see above) and then to send your report
|
.B WILL NOT SEE
|
||||||
to that mailing list as a wider set calc testers may be able to help you.
|
your Email.
|
||||||
|
.sp
|
||||||
|
.B PLEASE BE SURE
|
||||||
|
you have that
|
||||||
|
.B SPECIAL PHRASE
|
||||||
|
somewhere in the subject line!
|
||||||
.sp
|
.sp
|
||||||
See the
|
See the
|
||||||
.I BUGS
|
.I BUGS
|
||||||
@@ -1246,6 +1345,135 @@ help bugs
|
|||||||
.sp
|
.sp
|
||||||
for more information about bug reporting.
|
for more information about bug reporting.
|
||||||
.sp
|
.sp
|
||||||
|
Please be patient as we cannot always respond to Email messages quickly.
|
||||||
|
.sp
|
||||||
|
.SH "CONTRIBUTING CODE TO CALC"
|
||||||
|
\&
|
||||||
|
.br
|
||||||
|
.sp
|
||||||
|
.I Calc
|
||||||
|
is open source.
|
||||||
|
Contributions of code are welcome.
|
||||||
|
.sp
|
||||||
|
We welcome and encourage you to send us:
|
||||||
|
.sp
|
||||||
|
.sp
|
||||||
|
.in +0.5i
|
||||||
|
.nf
|
||||||
|
* calc resource files (cal/*.cal)
|
||||||
|
* calc shell scripts (cscript/*.calc)
|
||||||
|
* builtin functions that you have modified or written, i.e.:
|
||||||
|
assocfunc.c comfunc.c func.c func.h
|
||||||
|
listfunc.c matfunc.c qfunc.c zfunc.c
|
||||||
|
* custom functions that you have modified or written (custom/*)
|
||||||
|
* help files modified or written (help/*)
|
||||||
|
* brief description of you added, fixed, improved in CHANGES
|
||||||
|
* regression test cases (cal/regress.cal)
|
||||||
|
* Makefile improvements (Makefile, */Makefile)
|
||||||
|
* other source code modifications (*.c, *.h)
|
||||||
|
* etc. (* */* :) )
|
||||||
|
.fi
|
||||||
|
.in -0.5i
|
||||||
|
.sp
|
||||||
|
If you add functionality to calc, please be sure to modify/patch/add
|
||||||
|
Makefiles, help files, cal/regress.cal test code as well.
|
||||||
|
Regression test cases are vital to maintaining calc's level
|
||||||
|
of correctness and helps us avoid code bug regression.
|
||||||
|
.sp
|
||||||
|
In order to consider integrating your code, we need:
|
||||||
|
.sp
|
||||||
|
.nf
|
||||||
|
.in +0.5i
|
||||||
|
* calc version you are working with (please try use the latest version)
|
||||||
|
* new help files or help file patches, if applicable (documentation)
|
||||||
|
* proposed text for the CHANGES file (brief description of what it does)
|
||||||
|
* regress.cal test patch as needed
|
||||||
|
* your source code and/or source code changes (:-))
|
||||||
|
.in -0.5i
|
||||||
|
.fi
|
||||||
|
.sp
|
||||||
|
The best way to send us new code, if your changes are small, is
|
||||||
|
via a patch (diff -c from the latest alpha code to your code).
|
||||||
|
If your change is large, you should send entire files (either
|
||||||
|
as a diff -c /dev/null your-file patch, or as a uuencoded and
|
||||||
|
gziped (or compressed) tar file).
|
||||||
|
.sp
|
||||||
|
Please try to generate a patch against the most recent
|
||||||
|
version of calc, and if you use GitHub, the top of the
|
||||||
|
master branch:
|
||||||
|
.sp
|
||||||
|
.nf
|
||||||
|
.in +0.5i
|
||||||
|
https://github.com/lcn2/calc
|
||||||
|
.in -0.5i
|
||||||
|
.fi
|
||||||
|
.sp
|
||||||
|
.sp
|
||||||
|
The best way contribute to calc bug is to generate calc
|
||||||
|
GitHub pull request:
|
||||||
|
.sp
|
||||||
|
.nf
|
||||||
|
.in +0.5i
|
||||||
|
https://github.com/lcn2/calc/pulls
|
||||||
|
.in -0.5i
|
||||||
|
.fi
|
||||||
|
.sp
|
||||||
|
Your code needs to be contributed under either the 2.1 of the
|
||||||
|
.B GNU Lesser General Public License (LGPL 2.1)
|
||||||
|
or be in the public domain.
|
||||||
|
.sp
|
||||||
|
If you do not want to use calc GitHub, then send EMail to:
|
||||||
|
.sp
|
||||||
|
.in +0.5i
|
||||||
|
.nf
|
||||||
|
calc-contrib at asthe dot com
|
||||||
|
.fi
|
||||||
|
.sp
|
||||||
|
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||||
|
.sp
|
||||||
|
NOTE: Yes, the Email address uses 'asthe',
|
||||||
|
while the web site uses 'isthe'.
|
||||||
|
.in -0.5i
|
||||||
|
.sp
|
||||||
|
You
|
||||||
|
.B MUST
|
||||||
|
use following
|
||||||
|
.B SPECIAL PHRASE
|
||||||
|
in your Email Subject line:
|
||||||
|
.sp
|
||||||
|
.in +0.5i
|
||||||
|
.B calc contribution
|
||||||
|
.in -0.5i
|
||||||
|
.sp
|
||||||
|
You may add additional words to your subject line.
|
||||||
|
.sp
|
||||||
|
.B Suggestion:
|
||||||
|
.sp
|
||||||
|
.in +0.5i
|
||||||
|
From time to time, the Email address and Subject
|
||||||
|
.B SPECIAL PHRASE
|
||||||
|
may change so verify you have the current info by visiting:
|
||||||
|
.sp
|
||||||
|
.in +0.5i
|
||||||
|
.nf
|
||||||
|
http://www.isthe.com/chongo/tech/comp/calc/calc-contrib.html
|
||||||
|
.fi
|
||||||
|
.in -0.5i
|
||||||
|
.in -0.5i
|
||||||
|
.sp
|
||||||
|
.B IMPORTANT:
|
||||||
|
If your Email doesn't contain the above phrase,
|
||||||
|
then we
|
||||||
|
.B WILL NOT SEE
|
||||||
|
your Email.
|
||||||
|
.sp
|
||||||
|
.B PLEASE BE SURE
|
||||||
|
you have that
|
||||||
|
.B SPECIAL PHRASE
|
||||||
|
somewhere in the subject line!
|
||||||
|
.sp
|
||||||
|
Please be patient as we cannot always respond to Email messages quickly.
|
||||||
|
.sp
|
||||||
.SH "CALC WEB SITE"
|
.SH "CALC WEB SITE"
|
||||||
\&
|
\&
|
||||||
.br
|
.br
|
||||||
|
28
calc.spec.in
28
calc.spec.in
@@ -32,7 +32,7 @@
|
|||||||
Summary: Arbitrary precision calculator.
|
Summary: Arbitrary precision calculator.
|
||||||
Name: calc
|
Name: calc
|
||||||
Version: <<<PROJECT_VERSION>>>
|
Version: <<<PROJECT_VERSION>>>
|
||||||
Release: 12
|
Release: 13
|
||||||
License: LGPL
|
License: LGPL
|
||||||
Group: Applications/Engineering
|
Group: Applications/Engineering
|
||||||
Source: http://www.isthe.com/chongo/src/calc/%{name}-%{version}.tar.bz2
|
Source: http://www.isthe.com/chongo/src/calc/%{name}-%{version}.tar.bz2
|
||||||
@@ -76,48 +76,48 @@ For the latest calc release, see the project home page:
|
|||||||
|
|
||||||
%build
|
%build
|
||||||
echo '-=- calc.spec beginning make clobber -=-'
|
echo '-=- calc.spec beginning make clobber -=-'
|
||||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} ARCH_CFLAGS= \
|
||||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||||
MANDIR=%{_mandir}/man1 EXT= V=@ clobber
|
MANDIR=%{_mandir}/man1 EXT= V=@ clobber
|
||||||
echo '-=- calc.spec ending make clobber -=-'
|
echo '-=- calc.spec ending make clobber -=-'
|
||||||
echo '-=- calc.spec beginning make calc-static-only -=-'
|
echo '-=- calc.spec beginning make calc-static-only -=-'
|
||||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} ARCH_CFLAGS= \
|
||||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||||
MANDIR=%{_mandir}/man1 EXT= V=@ calc-static-only BLD_TYPE=calc-static-only
|
MANDIR=%{_mandir}/man1 EXT= V=@ calc-static-only BLD_TYPE=calc-static-only
|
||||||
echo '-=- calc.spec ending make calc-static-only -=-'
|
echo '-=- calc.spec ending make calc-static-only -=-'
|
||||||
echo '-=- calc.spec beginning make rpm-hide-static -=-'
|
echo '-=- calc.spec beginning make rpm-hide-static -=-'
|
||||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} ARCH_CFLAGS= \
|
||||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||||
MANDIR=%{_mandir}/man1 EXT= V=@ rpm-hide-static
|
MANDIR=%{_mandir}/man1 EXT= V=@ rpm-hide-static
|
||||||
echo '-=- calc.spec ending make rpm-hide-static -=-'
|
echo '-=- calc.spec ending make rpm-hide-static -=-'
|
||||||
echo '-=- calc.spec beginning make clobber (again) -=-'
|
echo '-=- calc.spec beginning make clobber (again) -=-'
|
||||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} ARCH_CFLAGS= \
|
||||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||||
MANDIR=%{_mandir}/man1 EXT= V=@ clobber
|
MANDIR=%{_mandir}/man1 EXT= V=@ clobber
|
||||||
echo '-=- calc.spec ending make clobber (again) -=-'
|
echo '-=- calc.spec ending make clobber (again) -=-'
|
||||||
echo '-=- calc.spec beginning make calc-dynamic-only -=-'
|
echo '-=- calc.spec beginning make calc-dynamic-only -=-'
|
||||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} ARCH_CFLAGS= \
|
||||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||||
MANDIR=%{_mandir}/man1 EXT= V=@ calc-dynamic-only \
|
MANDIR=%{_mandir}/man1 EXT= V=@ calc-dynamic-only \
|
||||||
BLD_TYPE=calc-dynamic-only LD_SHARE=
|
BLD_TYPE=calc-dynamic-only LD_SHARE=
|
||||||
echo '-=- calc.spec ending make calc-dynamic-only -=-'
|
echo '-=- calc.spec ending make calc-dynamic-only -=-'
|
||||||
echo '-=- calc.spec beginning make chk -=-'
|
echo '-=- calc.spec beginning make chk -=-'
|
||||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} ARCH_CFLAGS= \
|
||||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||||
MANDIR=%{_mandir}/man1 EXT= V=@ chk
|
MANDIR=%{_mandir}/man1 EXT= V=@ chk
|
||||||
echo '-=- calc.spec ending make chk -=-'
|
echo '-=- calc.spec ending make chk -=-'
|
||||||
echo '-=- calc.spec beginning make rpm-unhide-static -=-'
|
echo '-=- calc.spec beginning make rpm-unhide-static -=-'
|
||||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} ARCH_CFLAGS= \
|
||||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||||
MANDIR=%{_mandir}/man1 EXT= V=@ rpm-unhide-static
|
MANDIR=%{_mandir}/man1 EXT= V=@ rpm-unhide-static
|
||||||
echo '-=- calc.spec ending make rpm-unhide-static -=-'
|
echo '-=- calc.spec ending make rpm-unhide-static -=-'
|
||||||
echo '-=- calc.spec beginning make rpm-clean-static -=-'
|
echo '-=- calc.spec beginning make rpm-clean-static -=-'
|
||||||
make -j1 BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
make -j1 BINDIR=%{_bindir} LIBDIR=%{_libdir} ARCH_CFLAGS= \
|
||||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||||
MANDIR=%{_mandir}/man1 EXT= V=@ rpm-clean-static
|
MANDIR=%{_mandir}/man1 EXT= V=@ rpm-clean-static
|
||||||
echo '-=- calc.spec ending make rpm-clean-static -=-'
|
echo '-=- calc.spec ending make rpm-clean-static -=-'
|
||||||
echo '-=- calc.spec beginning make rpm-chk-static -=-'
|
echo '-=- calc.spec beginning make rpm-chk-static -=-'
|
||||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} ARCH_CFLAGS= \
|
||||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||||
MANDIR=%{_mandir}/man1 EXT= V=@ rpm-chk-static
|
MANDIR=%{_mandir}/man1 EXT= V=@ rpm-chk-static
|
||||||
echo '-=- calc.spec ending make rpm-chk-static -=-'
|
echo '-=- calc.spec ending make rpm-chk-static -=-'
|
||||||
@@ -125,7 +125,7 @@ echo '-=- calc.spec ending make rpm-chk-static -=-'
|
|||||||
%install
|
%install
|
||||||
echo '-=- calc.spec beginning make install -=-'
|
echo '-=- calc.spec beginning make install -=-'
|
||||||
mkdir -p %{_buildroot}
|
mkdir -p %{_buildroot}
|
||||||
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} \
|
make -j1 T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} ARCH_CFLAGS= \
|
||||||
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc \
|
||||||
MANDIR=%{_mandir}/man1 EXT= V=@ install
|
MANDIR=%{_mandir}/man1 EXT= V=@ install
|
||||||
echo '-=- calc.spec ending make install -=-'
|
echo '-=- calc.spec ending make install -=-'
|
||||||
@@ -165,6 +165,12 @@ echo '-=- calc.spec beginning make clean -=-'
|
|||||||
%attr(644, root, root) %{_libdir}/libcustcalc.a
|
%attr(644, root, root) %{_libdir}/libcustcalc.a
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sun Mar 24 2019 cLandon Curt Noll http://www.isthe.com/chongo
|
||||||
|
- Release: 13
|
||||||
|
- Disable compiling with the default ARCH_CFLAGS= -march=native
|
||||||
|
by clearking the ARCH_CFLAGS value in order to maximize
|
||||||
|
the RPM binary protability.
|
||||||
|
|
||||||
* Mon Sep 01 2014 Landon Curt Noll http://www.isthe.com/chongo
|
* Mon Sep 01 2014 Landon Curt Noll http://www.isthe.com/chongo
|
||||||
- Release: 12
|
- Release: 12
|
||||||
- Removed use of %{?_smp_mflags}. On Ubuntu 14.04, the -j2
|
- Removed use of %{?_smp_mflags}. On Ubuntu 14.04, the -j2
|
||||||
|
25
calcerr.tbl
25
calcerr.tbl
@@ -451,6 +451,7 @@ E_FPATHOPEN1 Non-string arguments for fpathopen
|
|||||||
E_FPATHOPEN2 Unrecognized mode for fpathopen
|
E_FPATHOPEN2 Unrecognized mode for fpathopen
|
||||||
E_LOG1 Bad epsilon argument for log
|
E_LOG1 Bad epsilon argument for log
|
||||||
E_LOG2 Non-numeric first argument for log
|
E_LOG2 Non-numeric first argument for log
|
||||||
|
E_LOG3 Cannot calculate log for this value
|
||||||
E_FGETFILE1 Non-file argument for fgetfile
|
E_FGETFILE1 Non-file argument for fgetfile
|
||||||
E_FGETFILE2 File argument for fgetfile not open for reading
|
E_FGETFILE2 File argument for fgetfile not open for reading
|
||||||
E_FGETFILE3 Unable to set file position in fgetfile
|
E_FGETFILE3 Unable to set file position in fgetfile
|
||||||
@@ -471,3 +472,27 @@ E_ISSPACE Bad argument for isspace
|
|||||||
E_ISXDIGIT Bad argument for isxdigit
|
E_ISXDIGIT Bad argument for isxdigit
|
||||||
E_STRTOUPPER Bad argument type for strtoupper
|
E_STRTOUPPER Bad argument type for strtoupper
|
||||||
E_STRTOLOWER Bad argument type for strtolower
|
E_STRTOLOWER Bad argument type for strtolower
|
||||||
|
E_TAN3 Invalid value for calculating the sin numerator for tan
|
||||||
|
E_TAN4 Invalid value for calculating the cos denominator for tan
|
||||||
|
E_COT3 Invalid value for calculating the sin numerator for cot
|
||||||
|
E_COT4 Invalid value for calculating the cos denominator for cot
|
||||||
|
E_SEC3 Invalid value for calculating the cos reciprocal for sec
|
||||||
|
E_CSC3 Invalid value for calculating the sin reciprocal for csc
|
||||||
|
E_TANH3 Invalid value for calculating the sinh numerator for tanh
|
||||||
|
E_TANH4 Invalid value for calculating the cosh denominator for tanh
|
||||||
|
E_COTH3 Invalid value for calculating the sinh numerator for coth
|
||||||
|
E_COTH4 Invalid value for calculating the cosh denominator for coth
|
||||||
|
E_SECH3 Invalid value for calculating the cosh reciprocal for sech
|
||||||
|
E_CSCH3 Invalid value for calculating the sinh reciprocal for csch
|
||||||
|
E_ASIN3 Invalid value for calculating asin
|
||||||
|
E_ACOS3 Invalid value for calculating acos
|
||||||
|
E_ASINH3 Invalid value for calculating asinh
|
||||||
|
E_ACOSH3 Invalid value for calculating acosn
|
||||||
|
E_ATAN3 Invalid value for calculating atan
|
||||||
|
E_ACOT3 Invalid value for calculating acot
|
||||||
|
E_ASEC3 Invalid value for calculating asec
|
||||||
|
E_ACSC3 Invalid value for calculating acsc
|
||||||
|
E_ATANH3 Invalid value for calculating atan
|
||||||
|
E_ACOTH3 Invalid value for calculating acot
|
||||||
|
E_ASECH3 Invalid value for calculating asec
|
||||||
|
E_ACSCH3 Invalid value for calculating acsc
|
||||||
|
12
codegen.c
12
codegen.c
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* codegen - module to generate opcodes from the input tokens
|
* codegen - module to generate opcodes from the input tokens
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007,2017 David I. Bell and Ernest Bowen
|
* Copyright (C) 1999-2007,2017,2021 David I. Bell and Ernest Bowen
|
||||||
*
|
*
|
||||||
* Primary author: David I. Bell
|
* Primary author: David I. Bell
|
||||||
*
|
*
|
||||||
@@ -1021,7 +1021,7 @@ getstatement(LABEL *contlabel, LABEL *breaklabel,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
reread();
|
reread();
|
||||||
/* fall into default case */
|
/*FALLTHRU*/
|
||||||
|
|
||||||
default:
|
default:
|
||||||
rescantoken();
|
rescantoken();
|
||||||
@@ -1384,6 +1384,7 @@ creatematrix(void)
|
|||||||
switch (gettoken()) {
|
switch (gettoken()) {
|
||||||
case T_RIGHTBRACKET:
|
case T_RIGHTBRACKET:
|
||||||
rescantoken();
|
rescantoken();
|
||||||
|
/*FALLTHRU*/
|
||||||
case T_COMMA:
|
case T_COMMA:
|
||||||
addop(OP_ONE);
|
addop(OP_ONE);
|
||||||
addop(OP_SUB);
|
addop(OP_SUB);
|
||||||
@@ -1394,6 +1395,7 @@ creatematrix(void)
|
|||||||
switch(gettoken()) {
|
switch(gettoken()) {
|
||||||
case T_RIGHTBRACKET:
|
case T_RIGHTBRACKET:
|
||||||
rescantoken();
|
rescantoken();
|
||||||
|
/*FALLTHRU*/
|
||||||
case T_COMMA:
|
case T_COMMA:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -2211,6 +2213,7 @@ getterm(void)
|
|||||||
scanerror(T_NULL,
|
scanerror(T_NULL,
|
||||||
"Function calls not allowed "
|
"Function calls not allowed "
|
||||||
"as expressions");
|
"as expressions");
|
||||||
|
/*FALLTHRU*/
|
||||||
default:
|
default:
|
||||||
rescantoken();
|
rescantoken();
|
||||||
return type;
|
return type;
|
||||||
@@ -2248,7 +2251,7 @@ getidexpr(BOOL okmat, int autodef)
|
|||||||
if (autodef != T_GLOBAL && autodef != T_LOCAL &&
|
if (autodef != T_GLOBAL && autodef != T_LOCAL &&
|
||||||
autodef != T_STATIC)
|
autodef != T_STATIC)
|
||||||
autodef = 1;
|
autodef = 1;
|
||||||
/* fall into default case */
|
/*FALLTHRU*/
|
||||||
default:
|
default:
|
||||||
rescantoken();
|
rescantoken();
|
||||||
usesymbol(name, autodef);
|
usesymbol(name, autodef);
|
||||||
@@ -2277,6 +2280,7 @@ getidexpr(BOOL okmat, int autodef)
|
|||||||
scanerror(T_NULL,
|
scanerror(T_NULL,
|
||||||
"Function calls not allowed "
|
"Function calls not allowed "
|
||||||
"as expressions");
|
"as expressions");
|
||||||
|
/*FALLTHRU*/
|
||||||
default:
|
default:
|
||||||
rescantoken();
|
rescantoken();
|
||||||
return type;
|
return type;
|
||||||
@@ -2603,7 +2607,7 @@ getid(char *buf)
|
|||||||
* global or if symtype is static and the old variable is at the same
|
* global or if symtype is static and the old variable is at the same
|
||||||
* level. Warnings are issued when a global or local variable is
|
* level. Warnings are issued when a global or local variable is
|
||||||
* redeclared and when in the same body the variable will be accessible only
|
* redeclared and when in the same body the variable will be accessible only
|
||||||
^ with the appropriate specfier.
|
^ with the appropriate specifier.
|
||||||
*/
|
*/
|
||||||
S_FUNC void
|
S_FUNC void
|
||||||
definesymbol(char *name, int symtype)
|
definesymbol(char *name, int symtype)
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* comfunc - extended precision complex arithmetic non-primitive routines
|
* comfunc - extended precision complex arithmetic non-primitive routines
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007 David I. Bell and Ernest Bowen
|
* Copyright (C) 1999-2007,2021 David I. Bell and Ernest Bowen
|
||||||
*
|
*
|
||||||
* Primary author: David I. Bell
|
* Primary author: David I. Bell
|
||||||
*
|
*
|
||||||
@@ -553,7 +553,7 @@ c_log(COMPLEX *c, NUMBER *epsilon)
|
|||||||
/* first time call */
|
/* first time call */
|
||||||
cln_10_epsilon = qcopy(epsilon);
|
cln_10_epsilon = qcopy(epsilon);
|
||||||
} else if (qcmp(cln_10_epsilon, epsilon) == TRUE) {
|
} else if (qcmp(cln_10_epsilon, epsilon) == TRUE) {
|
||||||
/* replaced cacheed value with epsilon arg */
|
/* replaced cached value with epsilon arg */
|
||||||
qfree(cln_10_epsilon);
|
qfree(cln_10_epsilon);
|
||||||
cln_10_epsilon = qcopy(epsilon);
|
cln_10_epsilon = qcopy(epsilon);
|
||||||
} else if (cln_10 != NULL) {
|
} else if (cln_10 != NULL) {
|
||||||
@@ -1182,7 +1182,7 @@ comprint(COMPLEX *c)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!qiszero(c->real) || qiszero(c->imag))
|
if (!qiszero(c->real) || qiszero(c->imag))
|
||||||
qprintnum(c->real, MODE_DEFAULT);
|
qprintnum(c->real, MODE_DEFAULT, conf->outdigits);
|
||||||
qtmp = c->imag[0];
|
qtmp = c->imag[0];
|
||||||
if (qiszero(&qtmp))
|
if (qiszero(&qtmp))
|
||||||
return;
|
return;
|
||||||
@@ -1192,7 +1192,7 @@ comprint(COMPLEX *c)
|
|||||||
math_chr('-');
|
math_chr('-');
|
||||||
qtmp.num.sign = 0;
|
qtmp.num.sign = 0;
|
||||||
}
|
}
|
||||||
qprintnum(&qtmp, MODE_DEFAULT);
|
qprintnum(&qtmp, MODE_DEFAULT, conf->outdigits);
|
||||||
math_chr('i');
|
math_chr('i');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
11
config.c
11
config.c
@@ -274,6 +274,7 @@ STATIC NAMETYPE modes[] = {
|
|||||||
{"oct", MODE_OCTAL},
|
{"oct", MODE_OCTAL},
|
||||||
{"binary", MODE_BINARY},
|
{"binary", MODE_BINARY},
|
||||||
{"bin", MODE_BINARY},
|
{"bin", MODE_BINARY},
|
||||||
|
{"float-auto", MODE_REAL_AUTO},
|
||||||
{"off", MODE2_OFF},
|
{"off", MODE2_OFF},
|
||||||
{NULL, 0}
|
{NULL, 0}
|
||||||
};
|
};
|
||||||
@@ -908,34 +909,42 @@ setconfig(int type, VALUE *vp)
|
|||||||
case CONFIG_PROGRAM:
|
case CONFIG_PROGRAM:
|
||||||
math_error("The program config parameter is read-only");
|
math_error("The program config parameter is read-only");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
abort();
|
||||||
|
|
||||||
case CONFIG_BASENAME:
|
case CONFIG_BASENAME:
|
||||||
math_error("The basename config parameter is read-only");
|
math_error("The basename config parameter is read-only");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
abort();
|
||||||
|
|
||||||
case CONFIG_WINDOWS:
|
case CONFIG_WINDOWS:
|
||||||
math_error("The windows config parameter is read-only");
|
math_error("The windows config parameter is read-only");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
abort();
|
||||||
|
|
||||||
case CONFIG_CYGWIN:
|
case CONFIG_CYGWIN:
|
||||||
math_error("The cygwin config parameter is read-only");
|
math_error("The cygwin config parameter is read-only");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
abort();
|
||||||
|
|
||||||
case CONFIG_COMPILE_CUSTOM:
|
case CONFIG_COMPILE_CUSTOM:
|
||||||
math_error("The custom config parameter is read-only");
|
math_error("The custom config parameter is read-only");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
abort();
|
||||||
|
|
||||||
case CONFIG_ALLOW_CUSTOM:
|
case CONFIG_ALLOW_CUSTOM:
|
||||||
math_error("The allow_custom config parameter is read-only");
|
math_error("The allow_custom config parameter is read-only");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
abort();
|
||||||
|
|
||||||
case CONFIG_VERSION:
|
case CONFIG_VERSION:
|
||||||
math_error("The version config parameter is read-only");
|
math_error("The version config parameter is read-only");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
abort();
|
||||||
|
|
||||||
case CONFIG_BASEB:
|
case CONFIG_BASEB:
|
||||||
math_error("The baseb config parameter is read-only");
|
math_error("The baseb config parameter is read-only");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
abort();
|
||||||
|
|
||||||
case CONFIG_REDECL_WARN:
|
case CONFIG_REDECL_WARN:
|
||||||
if (vp->v_type == V_NUM) {
|
if (vp->v_type == V_NUM) {
|
||||||
@@ -970,10 +979,12 @@ setconfig(int type, VALUE *vp)
|
|||||||
case CONFIG_HZ:
|
case CONFIG_HZ:
|
||||||
math_error("The clock tick rate config parameter is read-only");
|
math_error("The clock tick rate config parameter is read-only");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
abort();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
math_error("Setting illegal config parameter");
|
math_error("Setting illegal config parameter");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
config.h
6
config.h
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* config - configuration routines
|
* config - configuration routines
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007,2014 Landon Curt Noll and David I. Bell
|
* Copyright (C) 1999-2007,2014,2021 Landon Curt Noll and David I. Bell
|
||||||
*
|
*
|
||||||
* Primary author: Landon Curt Noll
|
* Primary author: Landon Curt Noll
|
||||||
*
|
*
|
||||||
@@ -130,7 +130,7 @@ struct config {
|
|||||||
LEN sq2; /* size of number to use square algorithm 2 */
|
LEN sq2; /* size of number to use square algorithm 2 */
|
||||||
LEN pow2; /* size of modulus to use REDC for powers */
|
LEN pow2; /* size of modulus to use REDC for powers */
|
||||||
LEN redc2; /* size of modulus to use REDC algorithm 2 */
|
LEN redc2; /* size of modulus to use REDC algorithm 2 */
|
||||||
BOOL tilde_ok; /* ok to print a tilde on aproximations */
|
BOOL tilde_ok; /* ok to print a tilde on approximations */
|
||||||
BOOL tab_ok; /* ok to print tab before numeric values */
|
BOOL tab_ok; /* ok to print tab before numeric values */
|
||||||
LEN quomod; /* quomod() default rounding mode */
|
LEN quomod; /* quomod() default rounding mode */
|
||||||
LEN quo; /* quotient // default rounding mode */
|
LEN quo; /* quotient // default rounding mode */
|
||||||
@@ -163,7 +163,7 @@ struct config {
|
|||||||
BOOL *allow_custom; /* ptr to if custom functions are allowed */
|
BOOL *allow_custom; /* ptr to if custom functions are allowed */
|
||||||
char *version; /* calc version string */
|
char *version; /* calc version string */
|
||||||
int baseb; /* base for calculations */
|
int baseb; /* base for calculations */
|
||||||
BOOL redecl_warn; /* TRUE => warn of redeclating variables */
|
BOOL redecl_warn; /* TRUE => warn of redeclaring variables */
|
||||||
BOOL dupvar_warn; /* TRUE => warn of var name collisions */
|
BOOL dupvar_warn; /* TRUE => warn of var name collisions */
|
||||||
};
|
};
|
||||||
typedef struct config CONFIG;
|
typedef struct config CONFIG;
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
* ... ...
|
* ... ...
|
||||||
* x5 y5 z5 w5 point 5 in R^4
|
* x5 y5 z5 w5 point 5 in R^4
|
||||||
*
|
*
|
||||||
* Copyright (C) 2001,2014 Landon Curt Noll
|
* Copyright (C) 2001,2014,2019 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -37,9 +37,11 @@
|
|||||||
* parse args
|
* parse args
|
||||||
*/
|
*/
|
||||||
argc = argv();
|
argc = argv();
|
||||||
if (argc != 25) {
|
stderr = files(2);
|
||||||
fprintf(files(2), "usage: %s x0 y0 z0 w0 x1 y1 z1 w1 ... x5 y5 z5 w5\n",
|
program = argv(0);
|
||||||
argv(0));
|
if (argc != 24) {
|
||||||
|
fprintf(stderr, "usage: %s x0 y0 z0 w0 x1 y1 z1 w1 ... x5 y5 z5 w5\n",
|
||||||
|
program);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
x0 = eval(argv(1));
|
x0 = eval(argv(1));
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# cscript - makefile for calc shell script files
|
# cscript - makefile for calc shell script files
|
||||||
#
|
#
|
||||||
# Copyright (C) 1999-2006,2014,2017 Landon Curt Noll
|
# Copyright (C) 1999-2006,2014,2017,2021 Landon Curt Noll
|
||||||
#
|
#
|
||||||
# Calc is open software; you can redistribute it and/or modify it under
|
# Calc is open software; you can redistribute it and/or modify it under
|
||||||
# the terms of the version 2.1 of the GNU Lesser General Public License
|
# the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -199,7 +199,8 @@ SCRIPT= 4dsphere fproduct mersenne piforever plus powerterm \
|
|||||||
simple square
|
simple square
|
||||||
|
|
||||||
SCRIPT_SRC= 4dsphere.calc fproduct.calc mersenne.calc \
|
SCRIPT_SRC= 4dsphere.calc fproduct.calc mersenne.calc \
|
||||||
piforever.calc plus.calc powerterm.calc simple.calc square.calc
|
piforever.calc plus.calc powerterm.calc simple.calc \
|
||||||
|
square.calc
|
||||||
|
|
||||||
# These files are found (but not built) in the distribution
|
# These files are found (but not built) in the distribution
|
||||||
#
|
#
|
||||||
|
@@ -52,37 +52,6 @@ For more info, see:
|
|||||||
|
|
||||||
#####
|
#####
|
||||||
|
|
||||||
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
|
4dsphere
|
||||||
|
|
||||||
Determine if 6 points lie on the surface of a 4-dimensional sphere in R^4.
|
Determine if 6 points lie on the surface of a 4-dimensional sphere in R^4.
|
||||||
@@ -107,7 +76,7 @@ mersenne exp
|
|||||||
|
|
||||||
piforever
|
piforever
|
||||||
|
|
||||||
Print the value of pi forever, or as long as you cpu / memory allows.
|
Print the value of pi forever, or as long as you CPU / memory allows.
|
||||||
|
|
||||||
|
|
||||||
plus arg ...
|
plus arg ...
|
||||||
@@ -125,7 +94,7 @@ simple
|
|||||||
|
|
||||||
A trivial example of a calc shell script.
|
A trivial example of a calc shell script.
|
||||||
|
|
||||||
## Copyright (C) 1999,2014 Landon Curt Noll
|
## Copyright (C) 1999,2014,2021 Landon Curt Noll
|
||||||
##
|
##
|
||||||
## Calc is open software; you can redistribute it and/or modify it under
|
## Calc is open software; you can redistribute it and/or modify it under
|
||||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
* filename where to write the product, use - for stdout
|
* filename where to write the product, use - for stdout
|
||||||
* term ... terms to multiply
|
* term ... terms to multiply
|
||||||
*
|
*
|
||||||
* Copyright (C) 2001,2014 Landon Curt Noll
|
* Copyright (C) 2001,2014,2019 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -35,8 +35,10 @@
|
|||||||
* parse args
|
* parse args
|
||||||
*/
|
*/
|
||||||
argc = argv();
|
argc = argv();
|
||||||
|
stderr = files(2);
|
||||||
|
program = argv(0);
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
fprintf(files(2), "usage: %s term [term ...]\n", argv(0));
|
fprintf(stderr, "usage: %s term [term ...]\n", program);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
filename = argv(1);
|
filename = argv(1);
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
* mersenne - print the value of a mersenne number
|
* mersenne - print the value of a mersenne number
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007,2014 Landon Curt Noll
|
* Copyright (C) 1999-2007,2014,2019 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -32,16 +32,19 @@
|
|||||||
/*
|
/*
|
||||||
* parse args
|
* parse args
|
||||||
*/
|
*/
|
||||||
if (argv() != 2) {
|
argc = argv();
|
||||||
/* we include the name of this script in the error message */
|
stderr = files(2);
|
||||||
fprintf(files(2), "usage: %s exp\n", config("program"));
|
program = argv(0);
|
||||||
abort "wrong number of args";
|
if (argc != 2) {
|
||||||
|
/* we include the name of this script in the error message */
|
||||||
|
fprintf(stderr, "usage: %s exp\n", program);
|
||||||
|
abort "wrong number of args";
|
||||||
}
|
}
|
||||||
|
|
||||||
global n = eval(argv(1));
|
n = eval(argv(1));
|
||||||
|
|
||||||
if (!isint(n) || n <= 0) {
|
if (!isint(n) || n <= 0) {
|
||||||
quit "Argument to be a positive integer";
|
quit "Argument to be a positive integer";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
#!/usr/local/src/bin/calc/calc -q -f
|
#!/usr/local/src/bin/calc/calc -q -s -f
|
||||||
/*
|
/*
|
||||||
* piforever - print digits of pi forever (or as long as your mem/cpu allow)
|
* piforever - print digits of pi forever (or as long as your mem/CPU allow)
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007,2014 Landon Curt Noll
|
* Copyright (C) 1999-2007,2014,2019,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
#!/usr/local/src/bin/calc/calc -q -f
|
#!/usr/local/src/bin/calc/calc -q -s -f
|
||||||
/*
|
/*
|
||||||
* plus - add two or more arguments together
|
* plus - add two or more arguments together
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007,2014 Landon Curt Noll
|
* Copyright (C) 1999-2007,2014,2019 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -32,10 +32,13 @@
|
|||||||
/*
|
/*
|
||||||
* parse args
|
* parse args
|
||||||
*/
|
*/
|
||||||
if (argv() < 2) {
|
argc = argv();
|
||||||
/* we include the name of this script in the error message */
|
stderr = files(2);
|
||||||
fprintf(files(2), "usage: %s value ...\n", config("program"));
|
program = argv(0);
|
||||||
abort "not enough args";
|
if (argc < 2) {
|
||||||
|
/* we include the name of this script in the error message */
|
||||||
|
fprintf(stderr, "usage: %s value ...\n", program);
|
||||||
|
abort "not enough args";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -45,6 +48,6 @@ if (argv() < 2) {
|
|||||||
*/
|
*/
|
||||||
sum = 0;
|
sum = 0;
|
||||||
for (i=1; i < argv(); ++i) {
|
for (i=1; i < argv(); ++i) {
|
||||||
sum += eval(argv(i));
|
sum += eval(argv(i));
|
||||||
}
|
}
|
||||||
print sum;
|
print sum;
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
* base_limit largest base we will consider (def: 10000)
|
* base_limit largest base we will consider (def: 10000)
|
||||||
* value value to convert into sums of powers of integers
|
* value value to convert into sums of powers of integers
|
||||||
*
|
*
|
||||||
* Copyright (C) 2001,2014 Landon Curt Noll
|
* Copyright (C) 2001,2014,2019 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the powerterm of the version 2.1 of the GNU Lesser General Public License
|
* the powerterm of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -35,28 +35,31 @@
|
|||||||
/*
|
/*
|
||||||
* parse args
|
* parse args
|
||||||
*/
|
*/
|
||||||
|
argc = argv();
|
||||||
|
stderr = files(2);
|
||||||
|
program = argv(0);
|
||||||
config("verbose_quit", 0),;
|
config("verbose_quit", 0),;
|
||||||
base_lim = 10000; /* default: highest base we will consider */
|
base_lim = 10000; /* default: highest base we will consider */
|
||||||
if (argv() < 2 || argv() > 3) {
|
if (argc < 2 || argc > 3) {
|
||||||
fprintf(files(2), "usage: %s [base_limit] value\n", argv(0));
|
fprintf(stderr, "usage: %s [base_limit] value\n", program);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if (argv() == 3) {
|
if (argc == 3) {
|
||||||
x = eval(argv(2));
|
x = eval(argv(2));
|
||||||
base_lim = eval(argv(1));
|
base_lim = eval(argv(1));
|
||||||
} else {
|
} else {
|
||||||
x = eval(argv(1));
|
x = eval(argv(1));
|
||||||
}
|
}
|
||||||
if (! isint(x)) {
|
if (! isint(x)) {
|
||||||
fprintf(files(2), "%s: value must be an integer\n");
|
fprintf(stderr, "%s: value must be an integer\n", program);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if (! isint(base_lim)) {
|
if (! isint(base_lim)) {
|
||||||
fprintf(files(2), "%s: base limit must be an integer\n");
|
fprintf(stderr, "%s: base limit must be an integer\n", program);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if (base_lim <= 1) {
|
if (base_lim <= 1) {
|
||||||
fprintf(files(2), "%s: base limit is too small\n");
|
fprintf(stderr, "%s: base limit is too small\n", program);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
++base_lim;
|
++base_lim;
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
#!/usr/local/src/bin/calc/calc -q -f
|
#!/usr/local/src/bin/calc/calc -q -s -f
|
||||||
/*
|
/*
|
||||||
* simple - an example of a simple calc shell script
|
* simple - an example of a simple calc shell script
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007,2014 Landon Curt Noll
|
* Copyright (C) 1999-2007,2014,2019 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -30,3 +30,9 @@
|
|||||||
* This is an example of a simple calc shell script.
|
* This is an example of a simple calc shell script.
|
||||||
*/
|
*/
|
||||||
print "This simple calc shell script works!"
|
print "This simple calc shell script works!"
|
||||||
|
print "config(\"program\")=", config("program");
|
||||||
|
print "argv()=", argv();
|
||||||
|
argc = argv();
|
||||||
|
for (i=0; i < argc; ++i) {
|
||||||
|
print "argv(":i:")=", argv(i);
|
||||||
|
}
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
#!/usr/local/src/bin/calc/calc -q -f
|
#!/usr/local/src/bin/calc/calc -q -s -f
|
||||||
/*
|
/*
|
||||||
* sqaure - print the squares of input values
|
* sqaure - print the squares of input values
|
||||||
*
|
*
|
||||||
* Copyright (C) 2000-2007,2014 Ernest Bowen
|
* Copyright (C) 2000-2007,2014,2019 Ernest Bowen
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -33,10 +33,6 @@
|
|||||||
* cat file | ./square
|
* cat file | ./square
|
||||||
* echo "123" | ./square
|
* echo "123" | ./square
|
||||||
*
|
*
|
||||||
* Within calc:
|
|
||||||
*
|
|
||||||
* > read square
|
|
||||||
*
|
|
||||||
* With input from a terminal, there is no prompt but each non-empty
|
* With input from a terminal, there is no prompt but each non-empty
|
||||||
* line of input is evaluated as a calc expression and if it can be
|
* line of input is evaluated as a calc expression and if it can be
|
||||||
* calculated, the square of the value of that expression is displayed.
|
* calculated, the square of the value of that expression is displayed.
|
||||||
@@ -59,6 +55,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
global s;
|
while (s = fgetline(files(0))) {
|
||||||
while ((s = prompt("")))
|
|
||||||
print "\t":eval(s)^2;
|
print "\t":eval(s)^2;
|
||||||
|
}
|
||||||
|
11
custom.c
11
custom.c
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* custom - interface for custom software and hardware interfaces
|
* custom - interface for custom software and hardware interfaces
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2006 Landon Curt Noll
|
* Copyright (C) 1999-2006,2018,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -109,7 +109,7 @@ custom(char *name, int count, VALUE **vals)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* showcustom - display the names and brief descriptins of custom functions
|
* showcustom - display the names and brief descriptions of custom functions
|
||||||
*/
|
*/
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
void
|
void
|
||||||
@@ -180,6 +180,7 @@ customhelp(char *name)
|
|||||||
#if defined(CUSTOM)
|
#if defined(CUSTOM)
|
||||||
|
|
||||||
char *customname; /* a string of the form: custom/name */
|
char *customname; /* a string of the form: custom/name */
|
||||||
|
size_t snprintf_len; /* malloced snprintf buffer length */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* firewall
|
* firewall
|
||||||
@@ -191,12 +192,14 @@ customhelp(char *name)
|
|||||||
/*
|
/*
|
||||||
* form the custom help name
|
* form the custom help name
|
||||||
*/
|
*/
|
||||||
customname = (char *)malloc(sizeof("custhelp")+1+strlen(name)+1);
|
snprintf_len = sizeof("custhelp")+1+strlen(name)+1;
|
||||||
|
customname = (char *)malloc(snprintf_len+1);
|
||||||
if (customname == NULL) {
|
if (customname == NULL) {
|
||||||
math_error("bad malloc of customname");
|
math_error("bad malloc of customname");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
sprintf(customname, "custhelp/%s", name);
|
snprintf(customname, snprintf_len, "custhelp/%s", name);
|
||||||
|
customname[snprintf_len] = '\0'; /* paranoia */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* give help directly to the custom file
|
* give help directly to the custom file
|
||||||
|
6
custom.h
6
custom.h
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* custom - interface for custom software and hardware interfaces
|
* custom - interface for custom software and hardware interfaces
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
* Copyright (C) 1999-2007,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
*
|
*
|
||||||
* before they include this file.
|
* before they include this file.
|
||||||
*
|
*
|
||||||
* Keep this file down to a minimum. Don't put custom builtin funcion
|
* Keep this file down to a minimum. Don't put custom builtin function
|
||||||
* stuff in this file!
|
* stuff in this file!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* arg count definitons
|
* arg count definitions
|
||||||
*/
|
*/
|
||||||
#define MAX_CUSTOM_ARGS 100 /* maximum number of custom arguments */
|
#define MAX_CUSTOM_ARGS 100 /* maximum number of custom arguments */
|
||||||
|
|
||||||
|
@@ -220,7 +220,7 @@ Step 5: Write your custom function
|
|||||||
NOTE: If you do not use any of the 3 function parameters,
|
NOTE: If you do not use any of the 3 function parameters,
|
||||||
then you should declare that function parameter to be UNUSED.
|
then you should declare that function parameter to be UNUSED.
|
||||||
For example, if the count and vals parameters were not used
|
For example, if the count and vals parameters were not used
|
||||||
in your custom function, then your declaraction should be:
|
in your custom function, then your declaration should be:
|
||||||
|
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
VALUE
|
VALUE
|
||||||
@@ -645,7 +645,7 @@ Step 12: Contribute
|
|||||||
and consider submitting your custom function for possible
|
and consider submitting your custom function for possible
|
||||||
inclusion in later versions of calc.
|
inclusion in later versions of calc.
|
||||||
|
|
||||||
## Copyright (C) 1999-2007 Landon Curt Noll
|
## Copyright (C) 1999-2007,2021 Landon Curt Noll
|
||||||
##
|
##
|
||||||
## Calc is open software; you can redistribute it and/or modify it under
|
## Calc is open software; you can redistribute it and/or modify it under
|
||||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# custom - makefile for calc custom routines
|
# custom - makefile for calc custom routines
|
||||||
#
|
#
|
||||||
# Copyright (C) 1999-2006,2014,2017 Landon Curt Noll
|
# Copyright (C) 1999-2006,2014,2017-2018,2021 Landon Curt Noll
|
||||||
#
|
#
|
||||||
# Calc is open software; you can redistribute it and/or modify it under
|
# Calc is open software; you can redistribute it and/or modify it under
|
||||||
# the terms of the version 2.1 of the GNU Lesser General Public License
|
# the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
#
|
#
|
||||||
# make ...__optional_arguments_... target=value
|
# make ...__optional_arguments_... target=value
|
||||||
|
|
||||||
# Try uname -s if the target was not alreadhy set on the make command line
|
# Try uname -s if the target was not already set on the make command line
|
||||||
#
|
#
|
||||||
ifeq ($(target),)
|
ifeq ($(target),)
|
||||||
target=$(shell uname -s 2>/dev/null)
|
target=$(shell uname -s 2>/dev/null)
|
||||||
@@ -125,7 +125,7 @@ Q=@
|
|||||||
#INCDIR= /dev/env/DJDIR/include
|
#INCDIR= /dev/env/DJDIR/include
|
||||||
INCDIR= /usr/include
|
INCDIR= /usr/include
|
||||||
|
|
||||||
# where to install calc realted things
|
# where to install calc related things
|
||||||
#
|
#
|
||||||
# ${BINDIR} where to install calc binary files
|
# ${BINDIR} where to install calc binary files
|
||||||
# ${LIBDIR} where calc link library (*.a) files are installed
|
# ${LIBDIR} where calc link library (*.a) files are installed
|
||||||
@@ -348,7 +348,7 @@ EXT=
|
|||||||
|
|
||||||
# The default calc versions
|
# The default calc versions
|
||||||
#
|
#
|
||||||
VERSION= 2.12.6.5
|
VERSION= 2.12.8.2
|
||||||
|
|
||||||
# Names of shared libraries with versions
|
# Names of shared libraries with versions
|
||||||
#
|
#
|
||||||
@@ -391,7 +391,7 @@ AWK= awk
|
|||||||
# NOTE: These should be left blank in this Makefile to make it
|
# NOTE: These should be left blank in this Makefile to make it
|
||||||
# easier to add stuff on the command line. If you want to
|
# easier to add stuff on the command line. If you want to
|
||||||
# to change the way calc is compiled by this Makefile, change
|
# to change the way calc is compiled by this Makefile, change
|
||||||
# the appropirate host target section below or a flag above.
|
# the appropriate host target section below or a flag above.
|
||||||
#
|
#
|
||||||
EXTRA_CFLAGS=
|
EXTRA_CFLAGS=
|
||||||
EXTRA_LDFLAGS=
|
EXTRA_LDFLAGS=
|
||||||
@@ -493,7 +493,7 @@ LDFLAGS= ${LD_DEBUG} ${ILDFLAGS}
|
|||||||
# #
|
# #
|
||||||
# calc-contrib at asthe dot com #
|
# calc-contrib at asthe dot com #
|
||||||
# #
|
# #
|
||||||
# EMail address an "ifeq ($(target),YOUR_TARGET_NAME)" ... "endif" #
|
# Email address an "ifeq ($(target),YOUR_TARGET_NAME)" ... "endif" #
|
||||||
# set of lines so that we can consider them for the next release. #
|
# set of lines so that we can consider them for the next release. #
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
@@ -1084,7 +1084,7 @@ CUSTCALC_OBJ= ${REQUIRED_OBJ} ${CUSTOM_OBJ}
|
|||||||
#
|
#
|
||||||
C_SRC= ${REQUIRED_SRC} ${CUSTOM_SRC}
|
C_SRC= ${REQUIRED_SRC} ${CUSTOM_SRC}
|
||||||
|
|
||||||
# These .h files are used to build the dependecy list
|
# These .h files are used to build the dependency list
|
||||||
#
|
#
|
||||||
H_SRC= ${CUSTOM_H_SRC}
|
H_SRC= ${CUSTOM_H_SRC}
|
||||||
|
|
||||||
@@ -1101,7 +1101,7 @@ DISTLIST= ${CUSTCALC_SRC} ${CUSTOM_CALC_FILES} ${CUSTOM_HELP} \
|
|||||||
#
|
#
|
||||||
CALCLIBLIST= ${CUSTCALC_SRC} ${INSTALL_H_SRC} ${MAKE_FILE} HOW_TO_ADD
|
CALCLIBLIST= ${CUSTCALC_SRC} ${INSTALL_H_SRC} ${MAKE_FILE} HOW_TO_ADD
|
||||||
|
|
||||||
# This is the custom dynbamic shared library that is build
|
# This is the custom dynamic shared library that is build
|
||||||
#
|
#
|
||||||
CALC_DYNAMIC_LIBCUSTCALC= libcustcalc${LIB_EXT_VERSION}
|
CALC_DYNAMIC_LIBCUSTCALC= libcustcalc${LIB_EXT_VERSION}
|
||||||
|
|
||||||
@@ -1155,7 +1155,7 @@ c_sysinfo.o: c_sysinfo.c ${MAKE_FILE}
|
|||||||
|
|
||||||
###
|
###
|
||||||
#
|
#
|
||||||
# building calc-static and static lib*.a libraires
|
# building calc-static and static lib*.a libraries
|
||||||
#
|
#
|
||||||
###
|
###
|
||||||
|
|
||||||
@@ -1174,7 +1174,7 @@ libcustcalc.a: ${CUSTCALC_OBJ} ${MAKE_FILE}
|
|||||||
# sub-directory called calc/lib.
|
# sub-directory called calc/lib.
|
||||||
#
|
#
|
||||||
# NOTE: Due to bogus shells found on one common system we must have
|
# NOTE: Due to bogus shells found on one common system we must have
|
||||||
# an non-emoty else clause for every if condition. *sigh*
|
# an non-empty else clause for every if condition. *sigh*
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
|
|
||||||
@@ -1213,7 +1213,7 @@ Makefile.simple: ${MAKE_FILE}
|
|||||||
# Home grown make dependency rules. Your system make not support
|
# Home grown make dependency rules. Your system make not support
|
||||||
# or have the needed tools. You can ignore this section.
|
# or have the needed tools. You can ignore this section.
|
||||||
#
|
#
|
||||||
# We will form a skelaton tree of *.c files containing only #include "foo.h"
|
# We will form a skeleton tree of *.c files containing only #include "foo.h"
|
||||||
# lines and .h files containing the same lines surrounded by multiple include
|
# lines and .h files containing the same lines surrounded by multiple include
|
||||||
# prevention lines. This allows us to build a static depend list that will
|
# prevention lines. This allows us to build a static depend list that will
|
||||||
# satisfy all possible cpp symbol definition combinations.
|
# satisfy all possible cpp symbol definition combinations.
|
||||||
@@ -1531,7 +1531,7 @@ uninstall:
|
|||||||
if [ -f "${T}${CUSTOMCALDIR}/libcustcalc.a" ]; then \
|
if [ -f "${T}${CUSTOMCALDIR}/libcustcalc.a" ]; then \
|
||||||
echo "cannot uninstall ${T}${CUSTOMCALDIR}/libcustcalc.a"; \
|
echo "cannot uninstall ${T}${CUSTOMCALDIR}/libcustcalc.a"; \
|
||||||
else \
|
else \
|
||||||
echo "uninstalled ${T}${CUSTOMCALDIR}/libcustcalc.a"; \
|
echo "un-installed ${T}${CUSTOMCALDIR}/libcustcalc.a"; \
|
||||||
fi; \
|
fi; \
|
||||||
fi
|
fi
|
||||||
-${Q} for i in ${CUSTOM_HELP} /dev/null; do \
|
-${Q} for i in ${CUSTOM_HELP} /dev/null; do \
|
||||||
@@ -1543,7 +1543,7 @@ uninstall:
|
|||||||
if [ -f "${T}${CUSTOMHELPDIR}/$$i" ]; then \
|
if [ -f "${T}${CUSTOMHELPDIR}/$$i" ]; then \
|
||||||
echo "cannot uninstall ${T}${CUSTOMHELPDIR}/$$i"; \
|
echo "cannot uninstall ${T}${CUSTOMHELPDIR}/$$i"; \
|
||||||
else \
|
else \
|
||||||
echo "uninstalled ${T}${CUSTOMHELPDIR}/$$i"; \
|
echo "un-installed ${T}${CUSTOMHELPDIR}/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
@@ -1556,7 +1556,7 @@ uninstall:
|
|||||||
if [ -f "${T}${CUSTOMCALDIR}/$$i" ]; then \
|
if [ -f "${T}${CUSTOMCALDIR}/$$i" ]; then \
|
||||||
echo "cannot uninstall ${T}${CUSTOMCALDIR}/$$i"; \
|
echo "cannot uninstall ${T}${CUSTOMCALDIR}/$$i"; \
|
||||||
else \
|
else \
|
||||||
echo "uninstalled ${T}${CUSTOMCALDIR}/$$i"; \
|
echo "un-installed ${T}${CUSTOMCALDIR}/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
@@ -1569,7 +1569,7 @@ uninstall:
|
|||||||
if [ -f "${T}${CUSTOMINCDIR}/$$i" ]; then \
|
if [ -f "${T}${CUSTOMINCDIR}/$$i" ]; then \
|
||||||
echo "cannot uninstall ${T}${CUSTOMINCDIR}/$$i"; \
|
echo "cannot uninstall ${T}${CUSTOMINCDIR}/$$i"; \
|
||||||
else \
|
else \
|
||||||
echo "uninstalled ${T}${CUSTOMINCDIR}/$$i"; \
|
echo "un-installed ${T}${CUSTOMINCDIR}/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# custom - makefile for calc custom routines
|
# custom - makefile for calc custom routines
|
||||||
#
|
#
|
||||||
# Copyright (C) 1999-2006,2014,2017 Landon Curt Noll
|
# Copyright (C) 1999-2006,2014,2017-2018,2021 Landon Curt Noll
|
||||||
#
|
#
|
||||||
# Calc is open software; you can redistribute it and/or modify it under
|
# Calc is open software; you can redistribute it and/or modify it under
|
||||||
# the terms of the version 2.1 of the GNU Lesser General Public License
|
# the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
#
|
#
|
||||||
# make ...__optional_arguments_... target=value
|
# make ...__optional_arguments_... target=value
|
||||||
|
|
||||||
# Try uname -s if the target was not alreadhy set on the make command line
|
# Try uname -s if the target was not already set on the make command line
|
||||||
#
|
#
|
||||||
ifeq ($(target),)
|
ifeq ($(target),)
|
||||||
target=$(shell uname -s 2>/dev/null)
|
target=$(shell uname -s 2>/dev/null)
|
||||||
@@ -125,7 +125,7 @@ Q=@
|
|||||||
#INCDIR= /dev/env/DJDIR/include
|
#INCDIR= /dev/env/DJDIR/include
|
||||||
INCDIR= /usr/include
|
INCDIR= /usr/include
|
||||||
|
|
||||||
# where to install calc realted things
|
# where to install calc related things
|
||||||
#
|
#
|
||||||
# ${BINDIR} where to install calc binary files
|
# ${BINDIR} where to install calc binary files
|
||||||
# ${LIBDIR} where calc link library (*.a) files are installed
|
# ${LIBDIR} where calc link library (*.a) files are installed
|
||||||
@@ -348,7 +348,7 @@ EXT=
|
|||||||
|
|
||||||
# The default calc versions
|
# The default calc versions
|
||||||
#
|
#
|
||||||
VERSION= 2.12.6.5
|
VERSION= 2.12.8.2
|
||||||
|
|
||||||
# Names of shared libraries with versions
|
# Names of shared libraries with versions
|
||||||
#
|
#
|
||||||
@@ -391,7 +391,7 @@ AWK= awk
|
|||||||
# NOTE: These should be left blank in this Makefile to make it
|
# NOTE: These should be left blank in this Makefile to make it
|
||||||
# easier to add stuff on the command line. If you want to
|
# easier to add stuff on the command line. If you want to
|
||||||
# to change the way calc is compiled by this Makefile, change
|
# to change the way calc is compiled by this Makefile, change
|
||||||
# the appropirate host target section below or a flag above.
|
# the appropriate host target section below or a flag above.
|
||||||
#
|
#
|
||||||
EXTRA_CFLAGS=
|
EXTRA_CFLAGS=
|
||||||
EXTRA_LDFLAGS=
|
EXTRA_LDFLAGS=
|
||||||
|
@@ -32,7 +32,7 @@ CUSTCALC_OBJ= ${REQUIRED_OBJ} ${CUSTOM_OBJ}
|
|||||||
#
|
#
|
||||||
C_SRC= ${REQUIRED_SRC} ${CUSTOM_SRC}
|
C_SRC= ${REQUIRED_SRC} ${CUSTOM_SRC}
|
||||||
|
|
||||||
# These .h files are used to build the dependecy list
|
# These .h files are used to build the dependency list
|
||||||
#
|
#
|
||||||
H_SRC= ${CUSTOM_H_SRC}
|
H_SRC= ${CUSTOM_H_SRC}
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ DISTLIST= ${CUSTCALC_SRC} ${CUSTOM_CALC_FILES} ${CUSTOM_HELP} \
|
|||||||
#
|
#
|
||||||
CALCLIBLIST= ${CUSTCALC_SRC} ${INSTALL_H_SRC} ${MAKE_FILE} HOW_TO_ADD
|
CALCLIBLIST= ${CUSTCALC_SRC} ${INSTALL_H_SRC} ${MAKE_FILE} HOW_TO_ADD
|
||||||
|
|
||||||
# This is the custom dynbamic shared library that is build
|
# This is the custom dynamic shared library that is build
|
||||||
#
|
#
|
||||||
CALC_DYNAMIC_LIBCUSTCALC= libcustcalc${LIB_EXT_VERSION}
|
CALC_DYNAMIC_LIBCUSTCALC= libcustcalc${LIB_EXT_VERSION}
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ c_sysinfo.o: c_sysinfo.c ${MAKE_FILE}
|
|||||||
|
|
||||||
###
|
###
|
||||||
#
|
#
|
||||||
# building calc-static and static lib*.a libraires
|
# building calc-static and static lib*.a libraries
|
||||||
#
|
#
|
||||||
###
|
###
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ libcustcalc.a: ${CUSTCALC_OBJ} ${MAKE_FILE}
|
|||||||
# sub-directory called calc/lib.
|
# sub-directory called calc/lib.
|
||||||
#
|
#
|
||||||
# NOTE: Due to bogus shells found on one common system we must have
|
# NOTE: Due to bogus shells found on one common system we must have
|
||||||
# an non-emoty else clause for every if condition. *sigh*
|
# an non-empty else clause for every if condition. *sigh*
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ Makefile.simple: ${MAKE_FILE}
|
|||||||
# Home grown make dependency rules. Your system make not support
|
# Home grown make dependency rules. Your system make not support
|
||||||
# or have the needed tools. You can ignore this section.
|
# or have the needed tools. You can ignore this section.
|
||||||
#
|
#
|
||||||
# We will form a skelaton tree of *.c files containing only #include "foo.h"
|
# We will form a skeleton tree of *.c files containing only #include "foo.h"
|
||||||
# lines and .h files containing the same lines surrounded by multiple include
|
# lines and .h files containing the same lines surrounded by multiple include
|
||||||
# prevention lines. This allows us to build a static depend list that will
|
# prevention lines. This allows us to build a static depend list that will
|
||||||
# satisfy all possible cpp symbol definition combinations.
|
# satisfy all possible cpp symbol definition combinations.
|
||||||
@@ -479,7 +479,7 @@ uninstall:
|
|||||||
if [ -f "${T}${CUSTOMCALDIR}/libcustcalc.a" ]; then \
|
if [ -f "${T}${CUSTOMCALDIR}/libcustcalc.a" ]; then \
|
||||||
echo "cannot uninstall ${T}${CUSTOMCALDIR}/libcustcalc.a"; \
|
echo "cannot uninstall ${T}${CUSTOMCALDIR}/libcustcalc.a"; \
|
||||||
else \
|
else \
|
||||||
echo "uninstalled ${T}${CUSTOMCALDIR}/libcustcalc.a"; \
|
echo "un-installed ${T}${CUSTOMCALDIR}/libcustcalc.a"; \
|
||||||
fi; \
|
fi; \
|
||||||
fi
|
fi
|
||||||
-${Q} for i in ${CUSTOM_HELP} /dev/null; do \
|
-${Q} for i in ${CUSTOM_HELP} /dev/null; do \
|
||||||
@@ -491,7 +491,7 @@ uninstall:
|
|||||||
if [ -f "${T}${CUSTOMHELPDIR}/$$i" ]; then \
|
if [ -f "${T}${CUSTOMHELPDIR}/$$i" ]; then \
|
||||||
echo "cannot uninstall ${T}${CUSTOMHELPDIR}/$$i"; \
|
echo "cannot uninstall ${T}${CUSTOMHELPDIR}/$$i"; \
|
||||||
else \
|
else \
|
||||||
echo "uninstalled ${T}${CUSTOMHELPDIR}/$$i"; \
|
echo "un-installed ${T}${CUSTOMHELPDIR}/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
@@ -504,7 +504,7 @@ uninstall:
|
|||||||
if [ -f "${T}${CUSTOMCALDIR}/$$i" ]; then \
|
if [ -f "${T}${CUSTOMCALDIR}/$$i" ]; then \
|
||||||
echo "cannot uninstall ${T}${CUSTOMCALDIR}/$$i"; \
|
echo "cannot uninstall ${T}${CUSTOMCALDIR}/$$i"; \
|
||||||
else \
|
else \
|
||||||
echo "uninstalled ${T}${CUSTOMCALDIR}/$$i"; \
|
echo "un-installed ${T}${CUSTOMCALDIR}/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
@@ -517,7 +517,7 @@ uninstall:
|
|||||||
if [ -f "${T}${CUSTOMINCDIR}/$$i" ]; then \
|
if [ -f "${T}${CUSTOMINCDIR}/$$i" ]; then \
|
||||||
echo "cannot uninstall ${T}${CUSTOMINCDIR}/$$i"; \
|
echo "cannot uninstall ${T}${CUSTOMINCDIR}/$$i"; \
|
||||||
else \
|
else \
|
||||||
echo "uninstalled ${T}${CUSTOMINCDIR}/$$i"; \
|
echo "un-installed ${T}${CUSTOMINCDIR}/$$i"; \
|
||||||
fi; \
|
fi; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* c_pmodm127 - calculate q mod 2^(2^127-1)
|
* c_pmodm127 - calculate q mod 2^(2^127-1)
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2007 Landon Curt Noll
|
* Copyright (C) 2004-2007,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -124,7 +124,7 @@ c_pmodm127(char UNUSED *name, int UNUSED count, VALUE **vals)
|
|||||||
result.v_type = V_NUM;
|
result.v_type = V_NUM;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* compute 2^(2^127-1) mod q by modular exponentation
|
* compute 2^(2^127-1) mod q by modular exponentiation
|
||||||
*
|
*
|
||||||
* We implement the following calc code in C:
|
* We implement the following calc code in C:
|
||||||
*
|
*
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* c_pzasusb8 - print numereator as a string of USB8s
|
* c_pzasusb8 - print numerator as a string of USB8s
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2004 Ernest Bowen
|
* Copyright (C) 1999-2004,2021 Ernest Bowen
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
#include "have_unused.h"
|
#include "have_unused.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* c_pzasusb8 - print numereator as a string of USB8s
|
* c_pzasusb8 - print numerator as a string of USB8s
|
||||||
*
|
*
|
||||||
* given:
|
* given:
|
||||||
* count = 1;
|
* count = 1;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* c_sysinfo - names and values of selected #defines
|
* c_sysinfo - names and values of selected #defines
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
* Copyright (C) 1999-2007,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -173,21 +173,19 @@ STATIC struct infoname sys_info[] = {
|
|||||||
(FULL)MAXSCANCOUNT},
|
(FULL)MAXSCANCOUNT},
|
||||||
{"MAXSTACK", "max depth of evaluation stack", NULL,
|
{"MAXSTACK", "max depth of evaluation stack", NULL,
|
||||||
(FULL)MAXSTACK},
|
(FULL)MAXSTACK},
|
||||||
{"MAXSTRING", "max size of string constant", NULL,
|
|
||||||
(FULL)MAXSTRING},
|
|
||||||
{"MAXUFULL", "largest FULL value", NULL,
|
{"MAXUFULL", "largest FULL value", NULL,
|
||||||
(FULL)MAXUFULL},
|
(FULL)MAXUFULL},
|
||||||
{"MAXULONG", "largest unsigned long val", NULL,
|
{"MAXULONG", "largest unsigned long val", NULL,
|
||||||
(FULL)MAXULONG},
|
(FULL)MAXULONG},
|
||||||
{"MAX_MAP_PRIME", "larest prime in pr_map", NULL,
|
{"MAX_MAP_PRIME", "largest prime in pr_map", NULL,
|
||||||
(FULL)MAX_MAP_PRIME},
|
(FULL)MAX_MAP_PRIME},
|
||||||
{"MAX_MAP_VAL", "larest bit in pr_map", NULL,
|
{"MAX_MAP_VAL", "largest bit in pr_map", NULL,
|
||||||
(FULL)MAX_MAP_VAL},
|
(FULL)MAX_MAP_VAL},
|
||||||
{"MAX_PFACT_VAL", "max x, for which pfact(x) is a long", NULL,
|
{"MAX_PFACT_VAL", "max x, for which pfact(x) is a long", NULL,
|
||||||
(FULL)MAX_PFACT_VAL},
|
(FULL)MAX_PFACT_VAL},
|
||||||
{"MAX_SM_PRIME", "larest 32 bit prime", NULL,
|
{"MAX_SM_PRIME", "largest 32 bit prime", NULL,
|
||||||
(FULL)MAX_SM_PRIME},
|
(FULL)MAX_SM_PRIME},
|
||||||
{"MAX_SM_VAL", "larest 32 bit value", NULL,
|
{"MAX_SM_VAL", "largest 32 bit value", NULL,
|
||||||
(FULL)MAX_SM_VAL},
|
(FULL)MAX_SM_VAL},
|
||||||
{"MUL_ALG2", "default size for alternative multiply", NULL,
|
{"MUL_ALG2", "default size for alternative multiply", NULL,
|
||||||
(FULL)MUL_ALG2},
|
(FULL)MUL_ALG2},
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* custtbl - custom interface table
|
* custtbl - custom interface table
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
* Copyright (C) 1999-2007,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* add your forward custom function declaractions here
|
* add your forward custom function declarations here
|
||||||
*
|
*
|
||||||
* Declare custom functions as follows:
|
* Declare custom functions as follows:
|
||||||
*
|
*
|
||||||
|
@@ -10,7 +10,7 @@ TYPES
|
|||||||
return null
|
return null
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
This custom function does nothing. It is intented for testing
|
This custom function does nothing. It is intended for testing
|
||||||
of the general custom interface.
|
of the general custom interface.
|
||||||
|
|
||||||
EXAMPLE
|
EXAMPLE
|
||||||
@@ -26,7 +26,7 @@ LIBRARY
|
|||||||
SEE ALSO
|
SEE ALSO
|
||||||
custom
|
custom
|
||||||
|
|
||||||
## Copyright (C) 1999 Landon Curt Noll
|
## Copyright (C) 1999,2021 Landon Curt Noll
|
||||||
##
|
##
|
||||||
## Calc is open software; you can redistribute it and/or modify it under
|
## Calc is open software; you can redistribute it and/or modify it under
|
||||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
@@ -25,7 +25,7 @@ DESCRIPTION
|
|||||||
SPECIAL NOTE:
|
SPECIAL NOTE:
|
||||||
|
|
||||||
Can you find a value, q, for which this custom function returns 1?
|
Can you find a value, q, for which this custom function returns 1?
|
||||||
If you do, send the value of q to chongo using the EMail address
|
If you do, send the value of q to chongo using the Email address
|
||||||
found at:
|
found at:
|
||||||
|
|
||||||
http://www.isthe.com/chongo/address.html
|
http://www.isthe.com/chongo/address.html
|
||||||
@@ -51,7 +51,7 @@ LIBRARY
|
|||||||
SEE ALSO
|
SEE ALSO
|
||||||
custom
|
custom
|
||||||
|
|
||||||
## Copyright (C) 2004 Landon Curt Noll
|
## Copyright (C) 2004,2021 Landon Curt Noll
|
||||||
##
|
##
|
||||||
## Calc is open software; you can redistribute it and/or modify it under
|
## Calc is open software; you can redistribute it and/or modify it under
|
||||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
@@ -21,7 +21,7 @@ DESCRIPTION
|
|||||||
|
|
||||||
for details.
|
for details.
|
||||||
|
|
||||||
This custom function is intented for testing of the general
|
This custom function is intended for testing of the general
|
||||||
custom interface.
|
custom interface.
|
||||||
|
|
||||||
EXAMPLE
|
EXAMPLE
|
||||||
@@ -49,7 +49,7 @@ LIBRARY
|
|||||||
SEE ALSO
|
SEE ALSO
|
||||||
custom
|
custom
|
||||||
|
|
||||||
## Copyright (C) 1999 Landon Curt Noll
|
## Copyright (C) 1999,2021 Landon Curt Noll
|
||||||
##
|
##
|
||||||
## Calc is open software; you can redistribute it and/or modify it under
|
## Calc is open software; you can redistribute it and/or modify it under
|
||||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* pzasusb8 - print numereator as a string of USB8s
|
* pzasusb8 - print numerator as a string of USB8s
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999,2004 Ernest Bowen and Landon Curt Noll
|
* Copyright (C) 1999,2004,2021 Ernest Bowen and Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Primary author: Ernest Bowen
|
* Primary author: Ernest Bowen
|
||||||
*
|
*
|
||||||
|
@@ -20,14 +20,14 @@ DESCRIPTION
|
|||||||
|
|
||||||
The number of custom registers is defined at compile time.
|
The number of custom registers is defined at compile time.
|
||||||
There will be at least 32 registers although there could be more
|
There will be at least 32 registers although there could be more
|
||||||
added in the future. It may be deterimed by:
|
added in the future. It may be determined by:
|
||||||
|
|
||||||
custom("sysinfo", "REGNUM_MAX")
|
custom("sysinfo", "REGNUM_MAX")
|
||||||
|
|
||||||
The custom registers are initialized to 0 by the internal
|
The custom registers are initialized to 0 by the internal
|
||||||
function libcalc_call_me_first() during calc startup.
|
function libcalc_call_me_first() during calc startup.
|
||||||
|
|
||||||
This custom interface is intented to make it easier to interface
|
This custom interface is intended to make it easier to interface
|
||||||
with special purpose hardware.
|
with special purpose hardware.
|
||||||
|
|
||||||
EXAMPLE
|
EXAMPLE
|
||||||
@@ -46,7 +46,7 @@ EXAMPLE
|
|||||||
LIMITS
|
LIMITS
|
||||||
calc must be built with ALLOW_CUSTOM= -DCUSTOM
|
calc must be built with ALLOW_CUSTOM= -DCUSTOM
|
||||||
calc must be executed with a -C arg.
|
calc must be executed with a -C arg.
|
||||||
The regnum numbe bee an integer >= 0 and < REGNUM_MAX where
|
The regnum number bee an integer >= 0 and < REGNUM_MAX where
|
||||||
REGNUM_MAX is a compile time constant that is >= 32.
|
REGNUM_MAX is a compile time constant that is >= 32.
|
||||||
|
|
||||||
LIBRARY
|
LIBRARY
|
||||||
@@ -55,7 +55,7 @@ LIBRARY
|
|||||||
SEE ALSO
|
SEE ALSO
|
||||||
custom
|
custom
|
||||||
|
|
||||||
## Copyright (C) 2007 Landon Curt Noll
|
## Copyright (C) 2007,2021 Landon Curt Noll
|
||||||
##
|
##
|
||||||
## Calc is open software; you can redistribute it and/or modify it under
|
## Calc is open software; you can redistribute it and/or modify it under
|
||||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
@@ -13,7 +13,7 @@ DESCRIPTION
|
|||||||
|
|
||||||
This custom function will return the value certain selected #define
|
This custom function will return the value certain selected #define
|
||||||
values. The infoname arg must be a string that matches the given
|
values. The infoname arg must be a string that matches the given
|
||||||
#define name. For conveience, the case infoname does not matter,
|
#define name. For convenience, the case infoname does not matter,
|
||||||
so "baseb" and "BASEB" refer to the same #define value.
|
so "baseb" and "BASEB" refer to the same #define value.
|
||||||
|
|
||||||
The return value is either an integer or a string depending on
|
The return value is either an integer or a string depending on
|
||||||
@@ -53,7 +53,7 @@ LIBRARY
|
|||||||
SEE ALSO
|
SEE ALSO
|
||||||
custom
|
custom
|
||||||
|
|
||||||
## Copyright (C) 1999 Landon Curt Noll
|
## Copyright (C) 1999,2021 Landon Curt Noll
|
||||||
##
|
##
|
||||||
## Calc is open software; you can redistribute it and/or modify it under
|
## Calc is open software; you can redistribute it and/or modify it under
|
||||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
4
endian.c
4
endian.c
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* endian - determine the byte order of a long on your machine
|
* endian - determine the byte order of a long on your machine
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2013 Landon Curt Noll
|
* Copyright (C) 1999-2013,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Big Endian: Amdahl, 68k, Pyramid, Mips, Sparc, ...
|
* Big Endian: Amdahl, 68k, Pyramid, MIPS, Sparc, ...
|
||||||
* Little Endian: Vax, 32k, Spim (Dec Mips), i386, i486, ...
|
* Little Endian: Vax, 32k, Spim (Dec Mips), i386, i486, ...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
51
file.c
51
file.c
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* file - file I/O routines callable by users
|
* file - file I/O routines callable by users
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007 David I. Bell and Landon Curt Noll
|
* Copyright (C) 1999-2007,2018,2021 David I. Bell and Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Primary author: David I. Bell
|
* Primary author: David I. Bell
|
||||||
*
|
*
|
||||||
@@ -50,6 +50,8 @@
|
|||||||
|
|
||||||
#define READSIZE 1024 /* buffer size for reading */
|
#define READSIZE 1024 /* buffer size for reading */
|
||||||
|
|
||||||
|
#define MIN(a,b) (((a) <= (b)) ? (a) : (b))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* external STDIO functions
|
* external STDIO functions
|
||||||
*/
|
*/
|
||||||
@@ -97,7 +99,7 @@ S_FUNC void fskipnum(FILE *fp);
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* file_init - perform needed initilization work
|
* file_init - perform needed initialization work
|
||||||
*
|
*
|
||||||
* On some systems, one cannot initialize a pointer to a FILE *.
|
* On some systems, one cannot initialize a pointer to a FILE *.
|
||||||
* This routine, called once at startup is a work-a-round for
|
* This routine, called once at startup is a work-a-round for
|
||||||
@@ -143,6 +145,7 @@ file_init(void)
|
|||||||
* stat the descriptor to see what we have
|
* stat the descriptor to see what we have
|
||||||
*/
|
*/
|
||||||
if (fstat(i, &sbuf) >= 0) {
|
if (fstat(i, &sbuf) >= 0) {
|
||||||
|
size_t snprintf_len; /* malloced snprintf length */
|
||||||
fp = (FILE *) fdopen(i,"r+"); /*guess mode*/
|
fp = (FILE *) fdopen(i,"r+"); /*guess mode*/
|
||||||
if (fp) {
|
if (fp) {
|
||||||
strcpy(files[idnum].mode, "r+");
|
strcpy(files[idnum].mode, "r+");
|
||||||
@@ -161,12 +164,15 @@ file_init(void)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tname = (char *)malloc(sizeof("descriptor[19]"));
|
snprintf_len =
|
||||||
|
sizeof("descriptor[12345678901234567890]") + 1;
|
||||||
|
tname = (char *)malloc(snprintf_len+1);
|
||||||
if (tname == NULL) {
|
if (tname == NULL) {
|
||||||
math_error("Out of memory for init_file");
|
math_error("Out of memory for init_file");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
sprintf(tname, "descriptor[%d]", i);
|
snprintf(tname, snprintf_len, "descriptor[%d]", i);
|
||||||
|
tname[snprintf_len] = '\0'; /* paranoia */
|
||||||
files[idnum].name = tname;
|
files[idnum].name = tname;
|
||||||
files[idnum].id = idnum;
|
files[idnum].id = idnum;
|
||||||
files[idnum].fp = fp;
|
files[idnum].fp = fp;
|
||||||
@@ -234,7 +240,7 @@ init_fileio(FILEIO *fiop, char *name, char *mode,
|
|||||||
* determine file open mode
|
* determine file open mode
|
||||||
*
|
*
|
||||||
* While a leading 'r' is for reading and a leading 'w' is
|
* While a leading 'r' is for reading and a leading 'w' is
|
||||||
* for writing, the presense of a '+' in the string means
|
* for writing, the presence of a '+' in the string means
|
||||||
* both reading and writing. A leading 'a' means append
|
* both reading and writing. A leading 'a' means append
|
||||||
* which is writing.
|
* which is writing.
|
||||||
*/
|
*/
|
||||||
@@ -1017,6 +1023,7 @@ idprintf(FILEID id, char *fmt, int count, VALUE **vals)
|
|||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 's':
|
case 's':
|
||||||
printstring = TRUE;
|
printstring = TRUE;
|
||||||
|
/*FALLTHRU*/
|
||||||
case 'c':
|
case 'c':
|
||||||
printchar = TRUE;
|
printchar = TRUE;
|
||||||
case 'd':
|
case 'd':
|
||||||
@@ -1027,6 +1034,9 @@ idprintf(FILEID id, char *fmt, int count, VALUE **vals)
|
|||||||
case 'e':
|
case 'e':
|
||||||
newmode = MODE_EXP;
|
newmode = MODE_EXP;
|
||||||
break;
|
break;
|
||||||
|
case 'g':
|
||||||
|
newmode = MODE_REAL_AUTO;
|
||||||
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
newmode = MODE_FRAC;
|
newmode = MODE_FRAC;
|
||||||
break;
|
break;
|
||||||
@@ -1398,7 +1408,7 @@ z2filepos(ZVALUE zpos)
|
|||||||
/*
|
/*
|
||||||
* firewall
|
* firewall
|
||||||
*/
|
*/
|
||||||
zpos.sign = 0; /* deal only with the absolue value */
|
zpos.sign = 0; /* deal only with the absolute value */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* quick return if the position can fit into a long
|
* quick return if the position can fit into a long
|
||||||
@@ -1406,23 +1416,22 @@ z2filepos(ZVALUE zpos)
|
|||||||
#if FILEPOS_BITS == FULL_BITS
|
#if FILEPOS_BITS == FULL_BITS
|
||||||
/* ztofull puts the value into native byte order */
|
/* ztofull puts the value into native byte order */
|
||||||
pos = ztofull(zpos);
|
pos = ztofull(zpos);
|
||||||
/* on some hosts, FILEPOS is not a scalar */
|
memset(&ret, 0, sizeof(ret)); /* FILEPOS could be non-scalar */
|
||||||
memset(&ret, 0, sizeof(FILEPOS));
|
memcpy((void *)&ret, (void *)&pos, MIN(sizeof(ret), sizeof(pos)));
|
||||||
memcpy((void *)&ret, (void *)&pos, sizeof(FILEPOS));
|
|
||||||
return ret;
|
return ret;
|
||||||
#elif FILEPOS_BITS < FULL_BITS
|
#elif FILEPOS_BITS < FULL_BITS
|
||||||
/* ztofull puts the value into native byte order */
|
/* ztofull puts the value into native byte order */
|
||||||
pos = ztolong(zpos);
|
pos = ztolong(zpos);
|
||||||
/* on some hosts, FILEPOS is not a scalar */
|
memset(&ret, 0, sizeof(ret)); /* FILEPOS could be non-scalar */
|
||||||
memset(&ret, 0, sizeof(FILEPOS));
|
memcpy((void *)&ret, (void *)&pos, MIN(sizeof(ret), sizeof(pos)));
|
||||||
memcpy((void *)&ret, (void *)&pos, sizeof(pos));
|
|
||||||
return ret;
|
return ret;
|
||||||
#else /* FILEPOS_BITS > FULL_BITS */
|
#else /* FILEPOS_BITS > FULL_BITS */
|
||||||
if (!zgtmaxfull(zpos)) {
|
if (!zgtmaxfull(zpos)) {
|
||||||
/* ztofull puts the value into native byte order */
|
/* ztofull puts the value into native byte order */
|
||||||
pos = ztofull(zpos);
|
pos = ztofull(zpos);
|
||||||
memset(&ret, 0, sizeof(FILEPOS));
|
memset(&ret, 0, sizeof(ret)); /* FILEPOS could be non-scalar */
|
||||||
memcpy((void *)&ret, (void *)&pos, sizeof(pos));
|
memcpy((void *)&ret, (void *)&pos,
|
||||||
|
MIN(sizeof(ret), sizeof(pos)));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1431,11 +1440,13 @@ z2filepos(ZVALUE zpos)
|
|||||||
*/
|
*/
|
||||||
if (zpos.len >= FILEPOS_BITS/BASEB) {
|
if (zpos.len >= FILEPOS_BITS/BASEB) {
|
||||||
/* copy the lower FILEPOS_BITS of the ZVALUE */
|
/* copy the lower FILEPOS_BITS of the ZVALUE */
|
||||||
memcpy(&tmp, zpos.v, sizeof(FILEPOS));
|
memset(&tmp, 0, sizeof(tmp)); /* FILEPOS could be non-scalar */
|
||||||
|
memcpy(&tmp, zpos.v, MIN(sizeof(tmp), FILEPOS_LEN);
|
||||||
} else {
|
} else {
|
||||||
/* copy what bits we can into the temp value */
|
/* copy what bits we can into the temp value */
|
||||||
memset(&tmp, 0, sizeof(FILEPOS));
|
memset(&tmp, 0, sizeof(tmp)); /* FILEPOS could be non-scalar */
|
||||||
memcpy(&tmp, zpos.v, zpos.len*BASEB/8);
|
memcpy(&tmp, zpos.v, MIN(sizeof(tmp),
|
||||||
|
MIN(zpos.len*BASEB/8, FILEPOS_LEN)));
|
||||||
}
|
}
|
||||||
/* swap into native byte order */
|
/* swap into native byte order */
|
||||||
SWAP_HALF_IN_FILEPOS(&ret, &tmp);
|
SWAP_HALF_IN_FILEPOS(&ret, &tmp);
|
||||||
@@ -1638,7 +1649,7 @@ set_open_pos(FILE *fp, ZVALUE zpos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* return sucess
|
* return success
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2595,7 +2606,7 @@ isattyid(FILEID id)
|
|||||||
* given:
|
* given:
|
||||||
* id FILEID to search
|
* id FILEID to search
|
||||||
* str string to look for
|
* str string to look for
|
||||||
* pos file postion to start at (NULL => current position)
|
* pos file position to start at (NULL => current position)
|
||||||
*
|
*
|
||||||
* returns:
|
* returns:
|
||||||
* EOF if system error
|
* EOF if system error
|
||||||
@@ -2605,7 +2616,7 @@ isattyid(FILEID id)
|
|||||||
*
|
*
|
||||||
* XXX - This search is a translation of the original search that did not
|
* XXX - This search is a translation of the original search that did not
|
||||||
* work with large files. The search algorithm used is slow and
|
* work with large files. The search algorithm used is slow and
|
||||||
* should be spead up much more.
|
* should be speed up much more.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
fsearch(FILEID id, char *str, ZVALUE start, ZVALUE end, ZVALUE *res)
|
fsearch(FILEID id, char *str, ZVALUE start, ZVALUE end, ZVALUE *res)
|
||||||
|
4
file.h
4
file.h
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* file - file I/O routines callable by users
|
* file - file I/O routines callable by users
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007,2014 David I. Bell and Landon Curt Noll
|
* Copyright (C) 1999-2007,2014,2021 David I. Bell and Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Primary author: David I. Bell
|
* Primary author: David I. Bell
|
||||||
*
|
*
|
||||||
@@ -63,7 +63,7 @@ typedef struct {
|
|||||||
* Seek loc bytes from the beginning of the open file, stream.
|
* Seek loc bytes from the beginning of the open file, stream.
|
||||||
*
|
*
|
||||||
* f_tell(FILE *stream, FILEPOS *loc)
|
* f_tell(FILE *stream, FILEPOS *loc)
|
||||||
* Set loc to bytes from the beinning of the open file, stream.
|
* Set loc to bytes from the beginning of the open file, stream.
|
||||||
*
|
*
|
||||||
* We assume that if your system does not have fgetpos/fsetpos,
|
* We assume that if your system does not have fgetpos/fsetpos,
|
||||||
* then it will have a FILEPOS that is a scalar type (e.g., long).
|
* then it will have a FILEPOS that is a scalar type (e.g., long).
|
||||||
|
15
fposval.c
15
fposval.c
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* fposval - Determine information about the file position type
|
* fposval - Determine information about the file position type
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Landon Curt Noll
|
* Copyright (C) 1999,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -122,10 +122,11 @@ main(int argc, char **argv)
|
|||||||
#else /* HAVE_FILEPOS_SCALAR */
|
#else /* HAVE_FILEPOS_SCALAR */
|
||||||
/*
|
/*
|
||||||
* Normally a "(*(dest) = *(src))" would do, but on some
|
* Normally a "(*(dest) = *(src))" would do, but on some
|
||||||
* systems a FILEPOS is not a scalar hince we must memcpy.
|
* systems a FILEPOS is not a scalar hence we must memcpy.
|
||||||
*/
|
*/
|
||||||
printf("#define SWAP_HALF_IN_FILEPOS(dest, src)\t%s\n",
|
printf("#define SWAP_HALF_IN_FILEPOS(dest, src)\t%s\n",
|
||||||
"memcpy((void *)(dest), (void *)(src), sizeof(FPOS_POS_LEN))");
|
"\\\n\tmemcpy((void *)(dest), (void *)(src), "
|
||||||
|
"sizeof(FPOS_POS_LEN))");
|
||||||
#endif /* HAVE_FILEPOS_SCALAR */
|
#endif /* HAVE_FILEPOS_SCALAR */
|
||||||
#endif /* CALC_BYTE_ORDER == BIG_ENDIAN */
|
#endif /* CALC_BYTE_ORDER == BIG_ENDIAN */
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
@@ -162,7 +163,7 @@ main(int argc, char **argv)
|
|||||||
* Little Endian
|
* Little Endian
|
||||||
*
|
*
|
||||||
* Normally a "(*(dest) = *(src))" would do, but on some
|
* Normally a "(*(dest) = *(src))" would do, but on some
|
||||||
* systems an off_t is not a scalar hince we must memcpy.
|
* systems an off_t is not a scalar hence we must memcpy.
|
||||||
*/
|
*/
|
||||||
#if defined(HAVE_OFF_T_SCALAR)
|
#if defined(HAVE_OFF_T_SCALAR)
|
||||||
printf("#define SWAP_HALF_IN_OFF_T(dest, src)\t\t%s\n",
|
printf("#define SWAP_HALF_IN_OFF_T(dest, src)\t\t%s\n",
|
||||||
@@ -170,7 +171,7 @@ main(int argc, char **argv)
|
|||||||
#else /* HAVE_OFF_T_SCALAR */
|
#else /* HAVE_OFF_T_SCALAR */
|
||||||
/*
|
/*
|
||||||
* Normally a "(*(dest) = *(src))" would do, but on some
|
* Normally a "(*(dest) = *(src))" would do, but on some
|
||||||
* systems, a off_t is not a scalar hince we must memcpy.
|
* systems, a off_t is not a scalar hence we must memcpy.
|
||||||
*/
|
*/
|
||||||
printf("#define SWAP_HALF_IN_OFF_T(dest, src)\t%s%d%s\n",
|
printf("#define SWAP_HALF_IN_OFF_T(dest, src)\t%s%d%s\n",
|
||||||
"memcpy((void *)(dest), (void *)(src), ", stsizelen/8, ")");
|
"memcpy((void *)(dest), (void *)(src), ", stsizelen/8, ")");
|
||||||
@@ -213,7 +214,7 @@ main(int argc, char **argv)
|
|||||||
* Little Endian
|
* Little Endian
|
||||||
*
|
*
|
||||||
* Normally a "(*(dest) = *(src))" would do, but on some
|
* Normally a "(*(dest) = *(src))" would do, but on some
|
||||||
* systems, a DEV is not a scalar hince we must memcpy.
|
* systems, a DEV is not a scalar hence we must memcpy.
|
||||||
*/
|
*/
|
||||||
printf("#define SWAP_HALF_IN_DEV(dest, src)\t%s%d%s\n",
|
printf("#define SWAP_HALF_IN_DEV(dest, src)\t%s%d%s\n",
|
||||||
"memcpy((void *)(dest), (void *)(src), ", devlen/8, ")");
|
"memcpy((void *)(dest), (void *)(src), ", devlen/8, ")");
|
||||||
@@ -255,7 +256,7 @@ main(int argc, char **argv)
|
|||||||
* Little Endian
|
* Little Endian
|
||||||
*
|
*
|
||||||
* Normally a "(*(dest) = *(src))" would do, but on some
|
* Normally a "(*(dest) = *(src))" would do, but on some
|
||||||
* systems, a INODE is not a scalar hince we must memcpy.
|
* systems, a INODE is not a scalar hence we must memcpy.
|
||||||
*/
|
*/
|
||||||
printf("#define SWAP_HALF_IN_INODE(dest, src)\t%s%d%s\n",
|
printf("#define SWAP_HALF_IN_INODE(dest, src)\t%s%d%s\n",
|
||||||
"memcpy((void *)(dest), (void *)(src), ", inodelen/8, ")");
|
"memcpy((void *)(dest), (void *)(src), ", inodelen/8, ")");
|
||||||
|
215
func.c
215
func.c
@@ -1,7 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* func - built-in functions implemented here
|
* func - built-in functions implemented here
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007 David I. Bell, Landon Curt Noll and Ernest Bowen
|
* Copyright (C) 1999-2007,2018,2021 David I. Bell, Landon Curt Noll
|
||||||
|
* and Ernest Bowen
|
||||||
*
|
*
|
||||||
* Primary author: David I. Bell
|
* Primary author: David I. Bell
|
||||||
*
|
*
|
||||||
@@ -268,7 +269,22 @@ f_prompt(VALUE *vp)
|
|||||||
math_error("Cannot allocate string");
|
math_error("Cannot allocate string");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
strncpy(newcp, cp, len+1);
|
/*
|
||||||
|
* The next statement could be::
|
||||||
|
*
|
||||||
|
* strncpy(newcp, cp, len);
|
||||||
|
*
|
||||||
|
* however compilers like gcc would issue warnings such as:
|
||||||
|
*
|
||||||
|
* specified bound depends on the length of the
|
||||||
|
* source argument
|
||||||
|
*
|
||||||
|
* even though we terminate the string by setting a NUL
|
||||||
|
* byte following the copy. Therefore we call memcpy()
|
||||||
|
* instead to avoid such warnings.
|
||||||
|
*/
|
||||||
|
memcpy(newcp, cp, len);
|
||||||
|
newcp[len] = '\0';
|
||||||
result.v_str = makestring(newcp);
|
result.v_str = makestring(newcp);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -335,7 +351,7 @@ f_str(VALUE *vp)
|
|||||||
break;
|
break;
|
||||||
case V_NUM:
|
case V_NUM:
|
||||||
math_divertio();
|
math_divertio();
|
||||||
qprintnum(vp->v_num, MODE_DEFAULT);
|
qprintnum(vp->v_num, MODE_DEFAULT, conf->outdigits);
|
||||||
cp = math_getdivertedio();
|
cp = math_getdivertedio();
|
||||||
result.v_str = makestring(cp);
|
result.v_str = makestring(cp);
|
||||||
break;
|
break;
|
||||||
@@ -2122,6 +2138,9 @@ f_log(int count, VALUE **vals)
|
|||||||
default:
|
default:
|
||||||
return error_value(E_LOG2);
|
return error_value(E_LOG2);
|
||||||
}
|
}
|
||||||
|
if (c == NULL) {
|
||||||
|
return error_value(E_LOG3);
|
||||||
|
}
|
||||||
result.v_type = V_COM;
|
result.v_type = V_COM;
|
||||||
result.v_com = c;
|
result.v_com = c;
|
||||||
if (cisreal(c)) {
|
if (cisreal(c)) {
|
||||||
@@ -2239,8 +2258,15 @@ f_tan(int count, VALUE **vals)
|
|||||||
case V_COM:
|
case V_COM:
|
||||||
tmp1.v_type = V_COM;
|
tmp1.v_type = V_COM;
|
||||||
tmp1.v_com = c_sin(vals[0]->v_com, err);
|
tmp1.v_com = c_sin(vals[0]->v_com, err);
|
||||||
|
if (tmp1.v_com == NULL) {
|
||||||
|
return error_value(E_TAN3);
|
||||||
|
}
|
||||||
tmp2.v_type = V_COM;
|
tmp2.v_type = V_COM;
|
||||||
tmp2.v_com = c_cos(vals[0]->v_com, err);
|
tmp2.v_com = c_cos(vals[0]->v_com, err);
|
||||||
|
if (tmp2.v_com == NULL) {
|
||||||
|
comfree(tmp1.v_com);
|
||||||
|
return error_value(E_TAN4);
|
||||||
|
}
|
||||||
divvalue(&tmp1, &tmp2, &result);
|
divvalue(&tmp1, &tmp2, &result);
|
||||||
comfree(tmp1.v_com);
|
comfree(tmp1.v_com);
|
||||||
comfree(tmp2.v_com);
|
comfree(tmp2.v_com);
|
||||||
@@ -2276,6 +2302,9 @@ f_sec(int count, VALUE **vals)
|
|||||||
case V_COM:
|
case V_COM:
|
||||||
tmp.v_type = V_COM;
|
tmp.v_type = V_COM;
|
||||||
tmp.v_com = c_cos(vals[0]->v_com, err);
|
tmp.v_com = c_cos(vals[0]->v_com, err);
|
||||||
|
if (tmp.v_com == NULL) {
|
||||||
|
return error_value(E_SEC3);
|
||||||
|
}
|
||||||
invertvalue(&tmp, &result);
|
invertvalue(&tmp, &result);
|
||||||
comfree(tmp.v_com);
|
comfree(tmp.v_com);
|
||||||
break;
|
break;
|
||||||
@@ -2314,8 +2343,15 @@ f_cot(int count, VALUE **vals)
|
|||||||
case V_COM:
|
case V_COM:
|
||||||
tmp1.v_type = V_COM;
|
tmp1.v_type = V_COM;
|
||||||
tmp1.v_com = c_cos(vals[0]->v_com, err);
|
tmp1.v_com = c_cos(vals[0]->v_com, err);
|
||||||
|
if (tmp1.v_com == NULL) {
|
||||||
|
return error_value(E_COT3);
|
||||||
|
}
|
||||||
tmp2.v_type = V_COM;
|
tmp2.v_type = V_COM;
|
||||||
tmp2.v_com = c_sin(vals[0]->v_com, err);
|
tmp2.v_com = c_sin(vals[0]->v_com, err);
|
||||||
|
if (tmp2.v_com == NULL) {
|
||||||
|
comfree(tmp1.v_com);
|
||||||
|
return error_value(E_COT4);
|
||||||
|
}
|
||||||
divvalue(&tmp1, &tmp2, &result);
|
divvalue(&tmp1, &tmp2, &result);
|
||||||
comfree(tmp1.v_com);
|
comfree(tmp1.v_com);
|
||||||
comfree(tmp2.v_com);
|
comfree(tmp2.v_com);
|
||||||
@@ -2354,6 +2390,9 @@ f_csc(int count, VALUE **vals)
|
|||||||
case V_COM:
|
case V_COM:
|
||||||
tmp.v_type = V_COM;
|
tmp.v_type = V_COM;
|
||||||
tmp.v_com = c_sin(vals[0]->v_com, err);
|
tmp.v_com = c_sin(vals[0]->v_com, err);
|
||||||
|
if (tmp.v_com == NULL) {
|
||||||
|
return error_value(E_CSC3);
|
||||||
|
}
|
||||||
invertvalue(&tmp, &result);
|
invertvalue(&tmp, &result);
|
||||||
comfree(tmp.v_com);
|
comfree(tmp.v_com);
|
||||||
break;
|
break;
|
||||||
@@ -2476,8 +2515,15 @@ f_tanh(int count, VALUE **vals)
|
|||||||
case V_COM:
|
case V_COM:
|
||||||
tmp1.v_type = V_COM;
|
tmp1.v_type = V_COM;
|
||||||
tmp1.v_com = c_sinh(vals[0]->v_com, err);
|
tmp1.v_com = c_sinh(vals[0]->v_com, err);
|
||||||
|
if (tmp1.v_com == NULL) {
|
||||||
|
return error_value(E_TANH3);
|
||||||
|
}
|
||||||
tmp2.v_type = V_COM;
|
tmp2.v_type = V_COM;
|
||||||
tmp2.v_com = c_cosh(vals[0]->v_com, err);
|
tmp2.v_com = c_cosh(vals[0]->v_com, err);
|
||||||
|
if (tmp2.v_com == NULL) {
|
||||||
|
comfree(tmp1.v_com);
|
||||||
|
return error_value(E_TANH4);
|
||||||
|
}
|
||||||
divvalue(&tmp1, &tmp2, &result);
|
divvalue(&tmp1, &tmp2, &result);
|
||||||
comfree(tmp1.v_com);
|
comfree(tmp1.v_com);
|
||||||
comfree(tmp2.v_com);
|
comfree(tmp2.v_com);
|
||||||
@@ -2517,8 +2563,15 @@ f_coth(int count, VALUE **vals)
|
|||||||
case V_COM:
|
case V_COM:
|
||||||
tmp1.v_type = V_COM;
|
tmp1.v_type = V_COM;
|
||||||
tmp1.v_com = c_cosh(vals[0]->v_com, err);
|
tmp1.v_com = c_cosh(vals[0]->v_com, err);
|
||||||
|
if (tmp1.v_com == NULL) {
|
||||||
|
return error_value(E_COTH3);
|
||||||
|
}
|
||||||
tmp2.v_type = V_COM;
|
tmp2.v_type = V_COM;
|
||||||
tmp2.v_com = c_sinh(vals[0]->v_com, err);
|
tmp2.v_com = c_sinh(vals[0]->v_com, err);
|
||||||
|
if (tmp2.v_com == NULL) {
|
||||||
|
comfree(tmp1.v_com);
|
||||||
|
return error_value(E_COTH4);
|
||||||
|
}
|
||||||
divvalue(&tmp1, &tmp2, &result);
|
divvalue(&tmp1, &tmp2, &result);
|
||||||
comfree(tmp1.v_com);
|
comfree(tmp1.v_com);
|
||||||
comfree(tmp2.v_com);
|
comfree(tmp2.v_com);
|
||||||
@@ -2555,6 +2608,9 @@ f_sech(int count, VALUE **vals)
|
|||||||
case V_COM:
|
case V_COM:
|
||||||
tmp.v_type = V_COM;
|
tmp.v_type = V_COM;
|
||||||
tmp.v_com = c_cosh(vals[0]->v_com, err);
|
tmp.v_com = c_cosh(vals[0]->v_com, err);
|
||||||
|
if (tmp.v_com == NULL) {
|
||||||
|
return error_value(E_SECH3);
|
||||||
|
}
|
||||||
invertvalue(&tmp, &result);
|
invertvalue(&tmp, &result);
|
||||||
comfree(tmp.v_com);
|
comfree(tmp.v_com);
|
||||||
break;
|
break;
|
||||||
@@ -2592,6 +2648,9 @@ f_csch(int count, VALUE **vals)
|
|||||||
case V_COM:
|
case V_COM:
|
||||||
tmp.v_type = V_COM;
|
tmp.v_type = V_COM;
|
||||||
tmp.v_com = c_sinh(vals[0]->v_com, err);
|
tmp.v_com = c_sinh(vals[0]->v_com, err);
|
||||||
|
if (tmp.v_com == NULL) {
|
||||||
|
return error_value(E_CSCH3);
|
||||||
|
}
|
||||||
invertvalue(&tmp, &result);
|
invertvalue(&tmp, &result);
|
||||||
comfree(tmp.v_com);
|
comfree(tmp.v_com);
|
||||||
break;
|
break;
|
||||||
@@ -2626,7 +2685,7 @@ f_atan(int count, VALUE **vals)
|
|||||||
case V_COM:
|
case V_COM:
|
||||||
tmp = c_atan(vals[0]->v_com, err);
|
tmp = c_atan(vals[0]->v_com, err);
|
||||||
if (tmp == NULL)
|
if (tmp == NULL)
|
||||||
return error_value(E_LOGINF);
|
return error_value(E_ATAN3);
|
||||||
result.v_type = V_COM;
|
result.v_type = V_COM;
|
||||||
result.v_com = tmp;
|
result.v_com = tmp;
|
||||||
if (cisreal(tmp)) {
|
if (cisreal(tmp)) {
|
||||||
@@ -2666,7 +2725,7 @@ f_acot(int count, VALUE **vals)
|
|||||||
case V_COM:
|
case V_COM:
|
||||||
tmp = c_acot(vals[0]->v_com, err);
|
tmp = c_acot(vals[0]->v_com, err);
|
||||||
if (tmp == NULL)
|
if (tmp == NULL)
|
||||||
return error_value(E_LOGINF);
|
return error_value(E_ACOT3);
|
||||||
result.v_type = V_COM;
|
result.v_type = V_COM;
|
||||||
result.v_com = tmp;
|
result.v_com = tmp;
|
||||||
if (cisreal(tmp)) {
|
if (cisreal(tmp)) {
|
||||||
@@ -2718,6 +2777,9 @@ f_asin(int count, VALUE **vals)
|
|||||||
default:
|
default:
|
||||||
return error_value(E_ASIN2);
|
return error_value(E_ASIN2);
|
||||||
}
|
}
|
||||||
|
if (result.v_com == NULL) {
|
||||||
|
return error_value(E_ASIN3);
|
||||||
|
}
|
||||||
if (result.v_type == V_COM && cisreal(result.v_com)) {
|
if (result.v_type == V_COM && cisreal(result.v_com)) {
|
||||||
q = qlink(result.v_com->real);
|
q = qlink(result.v_com->real);
|
||||||
comfree(result.v_com);
|
comfree(result.v_com);
|
||||||
@@ -2764,6 +2826,9 @@ f_acos(int count, VALUE **vals)
|
|||||||
default:
|
default:
|
||||||
return error_value(E_ACOS2);
|
return error_value(E_ACOS2);
|
||||||
}
|
}
|
||||||
|
if (result.v_com == NULL) {
|
||||||
|
return error_value(E_ACOS3);
|
||||||
|
}
|
||||||
if (result.v_type == V_COM && cisreal(result.v_com)) {
|
if (result.v_type == V_COM && cisreal(result.v_com)) {
|
||||||
q = qlink(result.v_com->real);
|
q = qlink(result.v_com->real);
|
||||||
comfree(result.v_com);
|
comfree(result.v_com);
|
||||||
@@ -2794,7 +2859,7 @@ f_asec(int count, VALUE **vals)
|
|||||||
switch (vals[0]->v_type) {
|
switch (vals[0]->v_type) {
|
||||||
case V_NUM:
|
case V_NUM:
|
||||||
if (qiszero(vals[0]->v_num))
|
if (qiszero(vals[0]->v_num))
|
||||||
return error_value(E_LOGINF);
|
return error_value(E_ASEC3);
|
||||||
result.v_num = qasec(vals[0]->v_num, err);
|
result.v_num = qasec(vals[0]->v_num, err);
|
||||||
result.v_type = V_NUM;
|
result.v_type = V_NUM;
|
||||||
if (result.v_num == NULL) {
|
if (result.v_num == NULL) {
|
||||||
@@ -2813,9 +2878,10 @@ f_asec(int count, VALUE **vals)
|
|||||||
default:
|
default:
|
||||||
return error_value(E_ASEC2);
|
return error_value(E_ASEC2);
|
||||||
}
|
}
|
||||||
|
if (result.v_com == NULL) {
|
||||||
|
return error_value(E_ASEC3);
|
||||||
|
}
|
||||||
if (result.v_type == V_COM) {
|
if (result.v_type == V_COM) {
|
||||||
if (result.v_com == NULL)
|
|
||||||
return error_value(E_LOGINF);
|
|
||||||
if (cisreal(result.v_com)) {
|
if (cisreal(result.v_com)) {
|
||||||
q = qlink(result.v_com->real);
|
q = qlink(result.v_com->real);
|
||||||
comfree(result.v_com);
|
comfree(result.v_com);
|
||||||
@@ -2847,7 +2913,7 @@ f_acsc(int count, VALUE **vals)
|
|||||||
switch (vals[0]->v_type) {
|
switch (vals[0]->v_type) {
|
||||||
case V_NUM:
|
case V_NUM:
|
||||||
if (qiszero(vals[0]->v_num))
|
if (qiszero(vals[0]->v_num))
|
||||||
return error_value(E_LOGINF);
|
return error_value(E_ACSC3);
|
||||||
result.v_num = qacsc(vals[0]->v_num, err);
|
result.v_num = qacsc(vals[0]->v_num, err);
|
||||||
result.v_type = V_NUM;
|
result.v_type = V_NUM;
|
||||||
if (result.v_num == NULL) {
|
if (result.v_num == NULL) {
|
||||||
@@ -2866,9 +2932,10 @@ f_acsc(int count, VALUE **vals)
|
|||||||
default:
|
default:
|
||||||
return error_value(E_ACSC2);
|
return error_value(E_ACSC2);
|
||||||
}
|
}
|
||||||
|
if (result.v_com == NULL) {
|
||||||
|
return error_value(E_ACSC3);
|
||||||
|
}
|
||||||
if (result.v_type == V_COM) {
|
if (result.v_type == V_COM) {
|
||||||
if (result.v_com == NULL)
|
|
||||||
return error_value(E_LOGINF);
|
|
||||||
if (cisreal(result.v_com)) {
|
if (cisreal(result.v_com)) {
|
||||||
q = qlink(result.v_com->real);
|
q = qlink(result.v_com->real);
|
||||||
comfree(result.v_com);
|
comfree(result.v_com);
|
||||||
@@ -2903,6 +2970,9 @@ f_asinh(int count, VALUE **vals)
|
|||||||
break;
|
break;
|
||||||
case V_COM:
|
case V_COM:
|
||||||
tmp = c_asinh(vals[0]->v_com, err);
|
tmp = c_asinh(vals[0]->v_com, err);
|
||||||
|
if (tmp == NULL) {
|
||||||
|
return error_value(E_ASINH3);
|
||||||
|
}
|
||||||
result.v_type = V_COM;
|
result.v_type = V_COM;
|
||||||
result.v_com = tmp;
|
result.v_com = tmp;
|
||||||
if (cisreal(tmp)) {
|
if (cisreal(tmp)) {
|
||||||
@@ -2955,6 +3025,9 @@ f_acosh(int count, VALUE **vals)
|
|||||||
default:
|
default:
|
||||||
return error_value(E_ACOSH2);
|
return error_value(E_ACOSH2);
|
||||||
}
|
}
|
||||||
|
if (result.v_com == NULL) {
|
||||||
|
return error_value(E_ACOSH3);
|
||||||
|
}
|
||||||
if (result.v_type == V_COM && cisreal(result.v_com)) {
|
if (result.v_type == V_COM && cisreal(result.v_com)) {
|
||||||
q = qlink(result.v_com->real);
|
q = qlink(result.v_com->real);
|
||||||
comfree(result.v_com);
|
comfree(result.v_com);
|
||||||
@@ -3002,9 +3075,10 @@ f_atanh(int count, VALUE **vals)
|
|||||||
default:
|
default:
|
||||||
return error_value(E_ATANH2);
|
return error_value(E_ATANH2);
|
||||||
}
|
}
|
||||||
|
if (result.v_com == NULL) {
|
||||||
|
return error_value(E_ATANH3);
|
||||||
|
}
|
||||||
if (result.v_type == V_COM) {
|
if (result.v_type == V_COM) {
|
||||||
if (result.v_com == NULL)
|
|
||||||
return error_value(E_LOGINF);
|
|
||||||
if (cisreal(result.v_com)) {
|
if (cisreal(result.v_com)) {
|
||||||
q = qlink(result.v_com->real);
|
q = qlink(result.v_com->real);
|
||||||
comfree(result.v_com);
|
comfree(result.v_com);
|
||||||
@@ -3053,9 +3127,10 @@ f_acoth(int count, VALUE **vals)
|
|||||||
default:
|
default:
|
||||||
return error_value(E_ACOTH2);
|
return error_value(E_ACOTH2);
|
||||||
}
|
}
|
||||||
|
if (result.v_com == NULL) {
|
||||||
|
return error_value(E_ACOTH3);
|
||||||
|
}
|
||||||
if (result.v_type == V_COM) {
|
if (result.v_type == V_COM) {
|
||||||
if (result.v_com == NULL)
|
|
||||||
return error_value(E_LOGINF);
|
|
||||||
if (cisreal(result.v_com)) {
|
if (cisreal(result.v_com)) {
|
||||||
q = qlink(result.v_com->real);
|
q = qlink(result.v_com->real);
|
||||||
comfree(result.v_com);
|
comfree(result.v_com);
|
||||||
@@ -3087,7 +3162,7 @@ f_asech(int count, VALUE **vals)
|
|||||||
switch (vals[0]->v_type) {
|
switch (vals[0]->v_type) {
|
||||||
case V_NUM:
|
case V_NUM:
|
||||||
if (qiszero(vals[0]->v_num))
|
if (qiszero(vals[0]->v_num))
|
||||||
return error_value(E_LOGINF);
|
return error_value(E_ASECH3);
|
||||||
result.v_num = qasech(vals[0]->v_num, err);
|
result.v_num = qasech(vals[0]->v_num, err);
|
||||||
result.v_type = V_NUM;
|
result.v_type = V_NUM;
|
||||||
if (result.v_num == NULL) {
|
if (result.v_num == NULL) {
|
||||||
@@ -3106,9 +3181,10 @@ f_asech(int count, VALUE **vals)
|
|||||||
default:
|
default:
|
||||||
return error_value(E_ASECH2);
|
return error_value(E_ASECH2);
|
||||||
}
|
}
|
||||||
|
if (result.v_com == NULL) {
|
||||||
|
return error_value(E_ASECH3);
|
||||||
|
}
|
||||||
if (result.v_type == V_COM) {
|
if (result.v_type == V_COM) {
|
||||||
if (result.v_com == NULL)
|
|
||||||
return error_value(E_LOGINF);
|
|
||||||
if (cisreal(result.v_com)) {
|
if (cisreal(result.v_com)) {
|
||||||
q = qlink(result.v_com->real);
|
q = qlink(result.v_com->real);
|
||||||
comfree(result.v_com);
|
comfree(result.v_com);
|
||||||
@@ -3140,7 +3216,7 @@ f_acsch(int count, VALUE **vals)
|
|||||||
switch (vals[0]->v_type) {
|
switch (vals[0]->v_type) {
|
||||||
case V_NUM:
|
case V_NUM:
|
||||||
if (qiszero(vals[0]->v_num))
|
if (qiszero(vals[0]->v_num))
|
||||||
return error_value(E_LOGINF);
|
return error_value(E_ACSCH3);
|
||||||
result.v_num = qacsch(vals[0]->v_num, err);
|
result.v_num = qacsch(vals[0]->v_num, err);
|
||||||
result.v_type = V_NUM;
|
result.v_type = V_NUM;
|
||||||
if (result.v_num == NULL) {
|
if (result.v_num == NULL) {
|
||||||
@@ -3159,9 +3235,10 @@ f_acsch(int count, VALUE **vals)
|
|||||||
default:
|
default:
|
||||||
return error_value(E_ACSCH2);
|
return error_value(E_ACSCH2);
|
||||||
}
|
}
|
||||||
|
if (result.v_com == NULL) {
|
||||||
|
return error_value(E_ACSCH3);
|
||||||
|
}
|
||||||
if (result.v_type == V_COM) {
|
if (result.v_type == V_COM) {
|
||||||
if (result.v_com == NULL)
|
|
||||||
return error_value(E_LOGINF);
|
|
||||||
if (cisreal(result.v_com)) {
|
if (cisreal(result.v_com)) {
|
||||||
q = qlink(result.v_com->real);
|
q = qlink(result.v_com->real);
|
||||||
comfree(result.v_com);
|
comfree(result.v_com);
|
||||||
@@ -3260,7 +3337,7 @@ f_agd(int count, VALUE **vals)
|
|||||||
return error_value(E_AGD2);
|
return error_value(E_AGD2);
|
||||||
}
|
}
|
||||||
if (result.v_com == NULL)
|
if (result.v_com == NULL)
|
||||||
return error_value(E_AGD3);
|
return error_value(E_AGD3);
|
||||||
if (cisreal(result.v_com)) {
|
if (cisreal(result.v_com)) {
|
||||||
q = qlink(result.v_com->real);
|
q = qlink(result.v_com->real);
|
||||||
comfree(result.v_com);
|
comfree(result.v_com);
|
||||||
@@ -5461,7 +5538,7 @@ f_usertime(void)
|
|||||||
NUMBER *secret; /* whole sconds of CPU time to return */
|
NUMBER *secret; /* whole sconds of CPU time to return */
|
||||||
NUMBER *usecret; /* microseconds of CPU time to return */
|
NUMBER *usecret; /* microseconds of CPU time to return */
|
||||||
|
|
||||||
/* get the resource informaion for ourself */
|
/* get the resource information for ourself */
|
||||||
status = getrusage(who, &usage);
|
status = getrusage(who, &usage);
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
/* system call error, so return 0 */
|
/* system call error, so return 0 */
|
||||||
@@ -5500,7 +5577,7 @@ f_systime(void)
|
|||||||
NUMBER *secret; /* whole sconds of CPU time to return */
|
NUMBER *secret; /* whole sconds of CPU time to return */
|
||||||
NUMBER *usecret; /* microseconds of CPU time to return */
|
NUMBER *usecret; /* microseconds of CPU time to return */
|
||||||
|
|
||||||
/* get the resource informaion for ourself */
|
/* get the resource information for ourself */
|
||||||
status = getrusage(who, &usage);
|
status = getrusage(who, &usage);
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
/* system call error, so return 0 */
|
/* system call error, so return 0 */
|
||||||
@@ -5540,7 +5617,7 @@ f_runtime(void)
|
|||||||
NUMBER *secret; /* whole sconds of CPU time to return */
|
NUMBER *secret; /* whole sconds of CPU time to return */
|
||||||
NUMBER *usecret; /* microseconds of CPU time to return */
|
NUMBER *usecret; /* microseconds of CPU time to return */
|
||||||
|
|
||||||
/* get the resource informaion for ourself */
|
/* get the resource information for ourself */
|
||||||
status = getrusage(who, &usage);
|
status = getrusage(who, &usage);
|
||||||
if (status < 0) {
|
if (status < 0) {
|
||||||
/* system call error, so return 0 */
|
/* system call error, so return 0 */
|
||||||
@@ -5657,7 +5734,7 @@ f_fpathopen(int count, VALUE **vals)
|
|||||||
/* initialize VALUE */
|
/* initialize VALUE */
|
||||||
result.v_subtype = V_NOSUBTYPE;
|
result.v_subtype = V_NOSUBTYPE;
|
||||||
|
|
||||||
/* check for valid strongs */
|
/* check for valid strong */
|
||||||
if (vals[0]->v_type != V_STR || vals[1]->v_type != V_STR) {
|
if (vals[0]->v_type != V_STR || vals[1]->v_type != V_STR) {
|
||||||
return error_value(E_FPATHOPEN1);
|
return error_value(E_FPATHOPEN1);
|
||||||
}
|
}
|
||||||
@@ -6022,12 +6099,15 @@ f_strerror(int count, VALUE **vals)
|
|||||||
/* firewall - return generic error string if it is not assigned */
|
/* firewall - return generic error string if it is not assigned */
|
||||||
if (i >= nexterrnum || (i > E__HIGHEST && i < E_USERDEF)
|
if (i >= nexterrnum || (i > E__HIGHEST && i < E_USERDEF)
|
||||||
|| (i < E__BASE && strerror(i) == NULL)) {
|
|| (i < E__BASE && strerror(i) == NULL)) {
|
||||||
cp = (char *) malloc(sizeof("Error 1234567890")+1);
|
size_t snprintf_len; /* malloced snprintf buffer length */
|
||||||
|
snprintf_len = sizeof("Unknown error 12345678901234567890")+1;
|
||||||
|
cp = (char *) malloc(snprintf_len+1);
|
||||||
if (cp == NULL) {
|
if (cp == NULL) {
|
||||||
math_error("Out of memory for strerror");
|
math_error("Out of memory for strerror");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
sprintf(cp, "Unknown error %ld", i);
|
snprintf(cp, snprintf_len, "Unknown error %ld", i);
|
||||||
|
cp[snprintf_len] = '\0'; /* paranoia */
|
||||||
result.v_str = makestring(cp);
|
result.v_str = makestring(cp);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -7382,7 +7462,26 @@ f_cmdbuf(void)
|
|||||||
|
|
||||||
cmdbuf_len = strlen(cmdbuf);
|
cmdbuf_len = strlen(cmdbuf);
|
||||||
newcp = (char *)malloc(cmdbuf_len+1);
|
newcp = (char *)malloc(cmdbuf_len+1);
|
||||||
strncpy(newcp, cmdbuf, cmdbuf_len+1);
|
if (newcp == NULL) {
|
||||||
|
math_error("Cannot allocate string in cmdbuf");
|
||||||
|
/*NOTREACHED*/
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* The next statement could be::
|
||||||
|
*
|
||||||
|
* strncpy(newcp, cmdbuf, cmdbuf_len);
|
||||||
|
*
|
||||||
|
* however compilers like gcc would issue warnings such as:
|
||||||
|
*
|
||||||
|
* specified bound depends on the length of the
|
||||||
|
* source argument
|
||||||
|
*
|
||||||
|
* even though we terminate the string by setting a NUL
|
||||||
|
* byte following the copy. Therefore we call memcpy()
|
||||||
|
* instead to avoid such warnings.
|
||||||
|
*/
|
||||||
|
memcpy(newcp, cmdbuf, cmdbuf_len);
|
||||||
|
newcp[cmdbuf_len] = '\0';
|
||||||
result.v_str = makestring(newcp);
|
result.v_str = makestring(newcp);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -7550,6 +7649,8 @@ f_putenv(int count, VALUE **vals)
|
|||||||
* parse args
|
* parse args
|
||||||
*/
|
*/
|
||||||
if (count == 2) {
|
if (count == 2) {
|
||||||
|
size_t snprintf_len; /* malloced snprintf buffer length */
|
||||||
|
|
||||||
/* firewall */
|
/* firewall */
|
||||||
if (vals[0]->v_type != V_STR || vals[1]->v_type != V_STR) {
|
if (vals[0]->v_type != V_STR || vals[1]->v_type != V_STR) {
|
||||||
math_error("Non-string argument for putenv");
|
math_error("Non-string argument for putenv");
|
||||||
@@ -7557,15 +7658,36 @@ f_putenv(int count, VALUE **vals)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* convert putenv("foo","bar") into putenv("foo=bar") */
|
/* convert putenv("foo","bar") into putenv("foo=bar") */
|
||||||
putenv_str = (char *)malloc(vals[0]->v_str->s_len + 1 +
|
snprintf_len = vals[0]->v_str->s_len + 1 +
|
||||||
vals[1]->v_str->s_len + 1);
|
vals[1]->v_str->s_len;
|
||||||
|
putenv_str = (char *)malloc(snprintf_len+1);
|
||||||
if (putenv_str == NULL) {
|
if (putenv_str == NULL) {
|
||||||
math_error("Cannot allocate string in putenv");
|
math_error("Cannot allocate string in putenv");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
sprintf(putenv_str, "%s=%s", vals[0]->v_str->s_str,
|
/*
|
||||||
vals[1]->v_str->s_str);
|
* The next statement could be::
|
||||||
|
*
|
||||||
|
* snprintf(putenv_str, snprintf_len,
|
||||||
|
* "%s=%s", vals[0]->v_str->s_str,
|
||||||
|
* vals[1]->v_str->s_str);
|
||||||
|
*
|
||||||
|
* however compilers like gcc would issue warnings such as:
|
||||||
|
*
|
||||||
|
* null destination pointer
|
||||||
|
*
|
||||||
|
* even though we check that putenv_str is non-NULL
|
||||||
|
* above before using it. Therefore we call memcpy()
|
||||||
|
* twice and make an assignment instead to avoid such warnings.
|
||||||
|
*/
|
||||||
|
memcpy(putenv_str,
|
||||||
|
vals[0]->v_str->s_str,
|
||||||
|
vals[0]->v_str->s_len);
|
||||||
|
putenv_str[vals[0]->v_str->s_len] = '=';
|
||||||
|
memcpy(putenv_str + vals[0]->v_str->s_len + 1,
|
||||||
|
vals[1]->v_str->s_str,
|
||||||
|
vals[1]->v_str->s_len);
|
||||||
|
putenv_str[snprintf_len] = '\0';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* firewall */
|
/* firewall */
|
||||||
@@ -7589,8 +7711,9 @@ f_putenv(int count, VALUE **vals)
|
|||||||
math_error("Cannot allocate string in putenv");
|
math_error("Cannot allocate string in putenv");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
strncpy(putenv_str, vals[0]->v_str->s_str,
|
memcpy(putenv_str, vals[0]->v_str->s_str,
|
||||||
vals[0]->v_str->s_len + 1);
|
vals[0]->v_str->s_len);
|
||||||
|
putenv_str[vals[0]->v_str->s_len] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return putenv result */
|
/* return putenv result */
|
||||||
@@ -7717,7 +7840,7 @@ f_base(int count, NUMBER **vals)
|
|||||||
return base_value(conf->outmode, conf->outmode);
|
return base_value(conf->outmode, conf->outmode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* deal with the specal modes first */
|
/* deal with the special modes first */
|
||||||
if (qisfrac(vals[0])) {
|
if (qisfrac(vals[0])) {
|
||||||
return base_value(math_setmode(MODE_FRAC), conf->outmode);
|
return base_value(math_setmode(MODE_FRAC), conf->outmode);
|
||||||
}
|
}
|
||||||
@@ -7768,7 +7891,7 @@ f_base2(int count, NUMBER **vals)
|
|||||||
return base_value(conf->outmode2, conf->outmode2);
|
return base_value(conf->outmode2, conf->outmode2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* deal with the specal modes first */
|
/* deal with the special modes first */
|
||||||
if (qisfrac(vals[0])) {
|
if (qisfrac(vals[0])) {
|
||||||
return base_value(math_setmode2(MODE_FRAC), conf->outmode2);
|
return base_value(math_setmode2(MODE_FRAC), conf->outmode2);
|
||||||
}
|
}
|
||||||
@@ -8388,7 +8511,7 @@ f_version(void)
|
|||||||
{
|
{
|
||||||
VALUE result;
|
VALUE result;
|
||||||
|
|
||||||
/* return the calc verstion string */
|
/* return the calc version string */
|
||||||
result.v_type = V_STR;
|
result.v_type = V_STR;
|
||||||
result.v_subtype = V_NOSUBTYPE;
|
result.v_subtype = V_NOSUBTYPE;
|
||||||
result.v_str = makestring(strdup(version()));
|
result.v_str = makestring(strdup(version()));
|
||||||
@@ -8454,7 +8577,7 @@ STATIC CONST struct builtin builtins[] = {
|
|||||||
{"acsch", 1, 2, 0, OP_NOP, 0, f_acsch,
|
{"acsch", 1, 2, 0, OP_NOP, 0, f_acsch,
|
||||||
"inverse csch of a within accuracy b"},
|
"inverse csch of a within accuracy b"},
|
||||||
{"agd", 1, 2, 0, OP_NOP, 0, f_agd,
|
{"agd", 1, 2, 0, OP_NOP, 0, f_agd,
|
||||||
"inverse gudermannian function"},
|
"inverse Gudermannian function"},
|
||||||
{"append", 1, IN, FA, OP_NOP, 0, f_listappend,
|
{"append", 1, IN, FA, OP_NOP, 0, f_listappend,
|
||||||
"append values to end of list"},
|
"append values to end of list"},
|
||||||
{"appr", 1, 3, 0, OP_NOP, 0, f_appr,
|
{"appr", 1, 3, 0, OP_NOP, 0, f_appr,
|
||||||
@@ -8665,7 +8788,7 @@ STATIC CONST struct builtin builtins[] = {
|
|||||||
{"gcdrem", 2, 2, 0, OP_NOP, qgcdrem, 0,
|
{"gcdrem", 2, 2, 0, OP_NOP, qgcdrem, 0,
|
||||||
"a divided repeatedly by gcd with b"},
|
"a divided repeatedly by gcd with b"},
|
||||||
{"gd", 1, 2, 0, OP_NOP, 0, f_gd,
|
{"gd", 1, 2, 0, OP_NOP, 0, f_gd,
|
||||||
"gudermannian function"},
|
"Gudermannian function"},
|
||||||
{"getenv", 1, 1, 0, OP_NOP, 0, f_getenv,
|
{"getenv", 1, 1, 0, OP_NOP, 0, f_getenv,
|
||||||
"value of environment variable (or NULL)"},
|
"value of environment variable (or NULL)"},
|
||||||
{"hash", 1, IN, 0, OP_NOP, 0, f_hash,
|
{"hash", 1, IN, 0, OP_NOP, 0, f_hash,
|
||||||
@@ -8945,7 +9068,7 @@ STATIC CONST struct builtin builtins[] = {
|
|||||||
"reverse search matrix or list for value b\n"
|
"reverse search matrix or list for value b\n"
|
||||||
"\t\t\tstarting at index c"},
|
"\t\t\tstarting at index c"},
|
||||||
{"runtime", 0, 0, 0, OP_NOP, f_runtime, 0,
|
{"runtime", 0, 0, 0, OP_NOP, f_runtime, 0,
|
||||||
"user and kernel mode cpu time in seconds"},
|
"user and kernel mode CPU time in seconds"},
|
||||||
{"saveval", 1, 1, 0, OP_SAVEVAL, 0, 0,
|
{"saveval", 1, 1, 0, OP_SAVEVAL, 0, 0,
|
||||||
"set flag for saving values"},
|
"set flag for saving values"},
|
||||||
{"scale", 2, 2, 0, OP_SCALE, 0, 0,
|
{"scale", 2, 2, 0, OP_SCALE, 0, 0,
|
||||||
@@ -8964,7 +9087,7 @@ STATIC CONST struct builtin builtins[] = {
|
|||||||
{"sech", 1, 2, 0, OP_NOP, 0, f_sech,
|
{"sech", 1, 2, 0, OP_NOP, 0, f_sech,
|
||||||
"hyperbolic secant of a within accuracy b"},
|
"hyperbolic secant of a within accuracy b"},
|
||||||
{"seed", 0, 0, 0, OP_NOP, f_seed, 0,
|
{"seed", 0, 0, 0, OP_NOP, f_seed, 0,
|
||||||
"return a 64 bit seed for a psuedo-random generator"},
|
"return a 64 bit seed for a pseudo-random generator"},
|
||||||
{"segment", 2, 3, 0, OP_NOP, 0, f_segment,
|
{"segment", 2, 3, 0, OP_NOP, 0, f_segment,
|
||||||
"specified segment of specified list"},
|
"specified segment of specified list"},
|
||||||
{"select", 2, 2, 0, OP_NOP, 0, f_select,
|
{"select", 2, 2, 0, OP_NOP, 0, f_select,
|
||||||
@@ -9038,7 +9161,7 @@ STATIC CONST struct builtin builtins[] = {
|
|||||||
{"system", 1, 1, 0, OP_NOP, 0, f_system,
|
{"system", 1, 1, 0, OP_NOP, 0, f_system,
|
||||||
"call Unix command"},
|
"call Unix command"},
|
||||||
{"systime", 0, 0, 0, OP_NOP, f_systime, 0,
|
{"systime", 0, 0, 0, OP_NOP, f_systime, 0,
|
||||||
"kernel mode cpu time in seconds"},
|
"kernel mode CPU time in seconds"},
|
||||||
{"tail", 2, 2, 0, OP_NOP, 0, f_tail,
|
{"tail", 2, 2, 0, OP_NOP, 0, f_tail,
|
||||||
"retain list of specified number at tail of list"},
|
"retain list of specified number at tail of list"},
|
||||||
{"tan", 1, 2, 0, OP_NOP, 0, f_tan,
|
{"tan", 1, 2, 0, OP_NOP, 0, f_tan,
|
||||||
@@ -9054,7 +9177,7 @@ STATIC CONST struct builtin builtins[] = {
|
|||||||
{"ungetc", 2, 2, 0, OP_NOP, 0, f_ungetc,
|
{"ungetc", 2, 2, 0, OP_NOP, 0, f_ungetc,
|
||||||
"unget char read from file"},
|
"unget char read from file"},
|
||||||
{"usertime", 0, 0, 0, OP_NOP, f_usertime, 0,
|
{"usertime", 0, 0, 0, OP_NOP, f_usertime, 0,
|
||||||
"user mode cpu time in seconds"},
|
"user mode CPU time in seconds"},
|
||||||
{"version", 0, 0, 0, OP_NOP, 0, f_version,
|
{"version", 0, 0, 0, OP_NOP, 0, f_version,
|
||||||
"calc version string"},
|
"calc version string"},
|
||||||
{"xor", 1, IN, 0, OP_NOP, 0, f_xor,
|
{"xor", 1, IN, 0, OP_NOP, 0, f_xor,
|
||||||
@@ -9071,7 +9194,7 @@ STATIC CONST struct builtin builtins[] = {
|
|||||||
*
|
*
|
||||||
* When FUNCLIST is defined, we are being compiled by rules from the help
|
* When FUNCLIST is defined, we are being compiled by rules from the help
|
||||||
* sub-directory to form a program that will produce the main part of the
|
* sub-directory to form a program that will produce the main part of the
|
||||||
* buiiltin help file.
|
* builtin help file.
|
||||||
*
|
*
|
||||||
* See the builtin rule in the help/Makefile for details.
|
* See the builtin rule in the help/Makefile for details.
|
||||||
*/
|
*/
|
||||||
|
4
hash.c
4
hash.c
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* hash - one-way hash routines
|
* hash - one-way hash routines
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
* Copyright (C) 1999-2007,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -270,7 +270,7 @@ hash_final(HASH *state)
|
|||||||
* The input is a long. If a long is smaller than 64 bits, we will
|
* The input is a long. If a long is smaller than 64 bits, we will
|
||||||
* hash a final 32 bits of zeros.
|
* hash a final 32 bits of zeros.
|
||||||
*
|
*
|
||||||
* This function is OK to hash BOOL's, unslogned long's, unsigned int's
|
* This function is OK to hash BOOL's, unsigned long's, unsigned int's
|
||||||
* signed int's as well as FLAG's and LEN's.
|
* signed int's as well as FLAG's and LEN's.
|
||||||
*/
|
*/
|
||||||
HASH *
|
HASH *
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* have_const - Determine if we want or can support ansi const
|
* have_const - Determine if we want or can support ANSI const
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Landon Curt Noll
|
* Copyright (C) 1999,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* have_getpgid - determine if we have getpgid()
|
* have_getpgid - determine if we have getpgid()
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Landon Curt Noll
|
* Copyright (C) 1999,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -39,7 +39,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include "have_unistd.h"
|
||||||
|
#if defined(HAVE_UNISTD_H)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
main(void)
|
main(void)
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* have_getprid - determine if we have getprid()
|
* have_getprid - determine if we have getprid()
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Landon Curt Noll
|
* Copyright (C) 1999,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -40,7 +40,10 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include "have_unistd.h"
|
||||||
|
#if defined(HAVE_UNISTD_H)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
main(void)
|
main(void)
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* have_getsid - determine if we have getsid()
|
* have_getsid - determine if we have getsid()
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Landon Curt Noll
|
* Copyright (C) 1999,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -40,6 +40,10 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include "have_unistd.h"
|
||||||
|
#if defined(HAVE_UNISTD_H)
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
main(void)
|
main(void)
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* have_memmv - Determine if we have memmove()
|
* have_memmv - Determine if we have memmove()
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Landon Curt Noll
|
* Copyright (C) 1999,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define MOVELEN 3
|
#define MOVELEN 3
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* have_newstr - Determine if we have a system without ANSI C string functions
|
* have_newstr - Determine if we have a system without ANSI C string functions
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Landon Curt Noll
|
* Copyright (C) 1999,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define MOVELEN 3
|
#define MOVELEN 3
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* have_offscl - determine if we have a scalar off_t element
|
* have_offscl - determine if we have a scalar off_t element
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Landon Curt Noll
|
* Copyright (C) 1999,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -46,13 +46,17 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include "have_unistd.h"
|
||||||
|
#if defined(HAVE_UNISTD_H)
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
main(void)
|
main(void)
|
||||||
{
|
{
|
||||||
#if !defined(OFF_T_NON_SCALAR)
|
#if !defined(OFF_T_NON_SCALAR)
|
||||||
off_t value; /* an off_t to perform arithmatic on */
|
off_t value; /* an off_t to perform arithmetic on */
|
||||||
off_t value2; /* an off_t to perform arithmatic on */
|
off_t value2; /* an off_t to perform arithmetic on */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* do some math opts on an off_t
|
* do some math opts on an off_t
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* have_posscl - determine if we have a scalar FILEPOS element
|
* have_posscl - determine if we have a scalar FILEPOS element
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 Landon Curt Noll
|
* Copyright (C) 1999,2021 Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -45,14 +45,18 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include "have_unistd.h"
|
||||||
|
#if defined(HAVE_UNISTD_H)
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
#include "have_fpos.h"
|
#include "have_fpos.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
main(void)
|
main(void)
|
||||||
{
|
{
|
||||||
#if !defined(FILEPOS_NON_SCALAR)
|
#if !defined(FILEPOS_NON_SCALAR)
|
||||||
FILEPOS value; /* an FILEPOS to perform arithmatic on */
|
FILEPOS value; /* an FILEPOS to perform arithmetic on */
|
||||||
FILEPOS value2; /* an FILEPOS to perform arithmatic on */
|
FILEPOS value2; /* an FILEPOS to perform arithmetic on */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* do some math opts on an FILEPOS
|
* do some math opts on an FILEPOS
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user