mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
Compare commits
115 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
08fe6f13f4 | ||
|
e11d159c81 | ||
|
dfd66be871 | ||
|
27f977b545 | ||
|
2ca6e789ca | ||
|
ff8f921ebc | ||
|
005b78227a | ||
|
b7a42a9d3d | ||
|
3d1e938cb6 | ||
|
8b98a7c1f6 | ||
|
dbf5acf5e8 | ||
|
5fe5ab1c4b | ||
|
e0cd9bb3db | ||
|
f0f6171354 | ||
|
94861cc6d2 | ||
|
286233e28f | ||
|
99ac7836aa | ||
|
6c0c8e0ef6 | ||
|
8aa5f140bf | ||
|
2fcb9a5995 | ||
|
8b018b697d | ||
|
0e269ecd67 | ||
|
a640bc4656 | ||
|
62a95499ef | ||
|
9e92d4a35a | ||
|
459c07b121 | ||
|
ada15fdabc | ||
|
d5de36841a | ||
|
cf419fb329 | ||
|
abf39b34b6 | ||
|
552252371f | ||
|
7570010a04 | ||
|
a9ee753dc6 | ||
|
ca5a81122a | ||
|
554cd97145 | ||
|
806606f284 | ||
|
7c0ebc5887 | ||
|
45665f94a7 | ||
|
cd736fdbd4 | ||
|
f753884008 | ||
|
1d9a4941ce | ||
|
5bde797ba4 | ||
|
ecba35fc26 | ||
|
a4f8f367c3 | ||
|
41b11ab785 | ||
|
3d33c6c6f4 | ||
|
dbd8926022 | ||
|
f7f110b686 | ||
|
ebf065dcb8 | ||
|
6bc0747a71 | ||
|
04861939fc | ||
|
ca0aaa0c3a | ||
|
f5d5319a51 | ||
|
263b8a78ef | ||
|
3c866367c6 | ||
|
09d7080547 | ||
|
f480c8c5df | ||
|
a230431a3b | ||
|
eaec46982d | ||
|
a86d629982 | ||
|
bcbc0cb766 | ||
|
ac0d84eef8 | ||
|
9b4580d861 | ||
|
2085361df1 | ||
|
bf4657c138 | ||
|
1b5636afed | ||
|
7eba99ac29 | ||
|
de6474bf28 | ||
|
55bc690cd1 | ||
|
6dc62c1ab7 | ||
|
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 |
71
.github/workflows/codeql-analysis.yml
vendored
Normal file
71
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
# For most projects, this workflow file will not need changing; you simply need
|
||||||
|
# to commit it to your repository.
|
||||||
|
#
|
||||||
|
# You may wish to alter this file to override the set of languages analyzed,
|
||||||
|
# or to provide custom queries or build logic.
|
||||||
|
#
|
||||||
|
# ******** NOTE ********
|
||||||
|
# We have attempted to detect the languages in your repository. Please check
|
||||||
|
# the `language` matrix defined below to confirm you have the correct set of
|
||||||
|
# supported CodeQL languages.
|
||||||
|
#
|
||||||
|
name: "CodeQL"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ master ]
|
||||||
|
schedule:
|
||||||
|
- cron: '41 1 * * 6'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: Analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language: [ 'cpp' ]
|
||||||
|
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||||
|
# Learn more:
|
||||||
|
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v1
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
|
# By default, queries listed here will override any specified in a config file.
|
||||||
|
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||||
|
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||||
|
|
||||||
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
|
||||||
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
|
# 📚 https://git.io/JvXDl
|
||||||
|
|
||||||
|
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||||
|
# and modify them (or add more) to build your code if your project
|
||||||
|
# uses a compiled language
|
||||||
|
|
||||||
|
#- run: |
|
||||||
|
# make bootstrap
|
||||||
|
# make release
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v1
|
8
.gitignore
vendored
8
.gitignore
vendored
@@ -33,6 +33,7 @@ custom/libcustcalc*
|
|||||||
endian
|
endian
|
||||||
endian_calc.h
|
endian_calc.h
|
||||||
fposval.h
|
fposval.h
|
||||||
|
have_ban_pragma.h
|
||||||
have_const.h
|
have_const.h
|
||||||
have_fpos.h
|
have_fpos.h
|
||||||
have_fpos_pos.h
|
have_fpos_pos.h
|
||||||
@@ -49,6 +50,8 @@ have_stdlib.h
|
|||||||
have_stdvs
|
have_stdvs
|
||||||
have_strdup.h
|
have_strdup.h
|
||||||
have_string.h
|
have_string.h
|
||||||
|
have_strlcat.h
|
||||||
|
have_strlcpy.h
|
||||||
have_times.h
|
have_times.h
|
||||||
have_uid_t.h
|
have_uid_t.h
|
||||||
have_unistd.h
|
have_unistd.h
|
||||||
@@ -65,6 +68,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 +80,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
|
||||||
@@ -85,8 +91,10 @@ longbits
|
|||||||
longbits.h
|
longbits.h
|
||||||
sample_many
|
sample_many
|
||||||
sample_rand
|
sample_rand
|
||||||
|
tags
|
||||||
terminal.h
|
terminal.h
|
||||||
ver_calc
|
ver_calc
|
||||||
|
win32/
|
||||||
|
|
||||||
# other commonly excluded patterns
|
# other commonly excluded patterns
|
||||||
#
|
#
|
||||||
|
152
BUGS
152
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,113 @@ 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:
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
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 +174,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
|
||||||
|
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
|
||||||
------------------------------------------------------------
|
------------------------------------------------------------
|
||||||
|
|
||||||
|
259
HOWTO.INSTALL
259
HOWTO.INSTALL
@@ -1,6 +1,18 @@
|
|||||||
|
|
||||||
|
IMPORTANT: Please see the section at the bottom of this file for
|
||||||
|
some important information on Makefiles used in calc.
|
||||||
|
|
||||||
|
###################################################################
|
||||||
|
# IMPORTANT: DO NOT run GNU make in parallel mode!!! #
|
||||||
|
###################################################################
|
||||||
|
# Unfortunately due to the complex dependency issues between #
|
||||||
|
# Makefile, Makefile.ship and custom/Makefile, parallel GNU make #
|
||||||
|
# is NOT recommended. Sorry (tm Canada) :) #
|
||||||
|
###################################################################
|
||||||
|
|
||||||
Installing calc from the bzip2-ed tarball in 4 easy steps:
|
Installing calc from the bzip2-ed tarball in 4 easy steps:
|
||||||
|
|
||||||
0) If your platform supports i686 RPMs, you may want to go to:
|
(0) If your platform supports i686 RPMs, you may want to go to:
|
||||||
|
|
||||||
http://www.isthe.com/chongo/src/calc/
|
http://www.isthe.com/chongo/src/calc/
|
||||||
|
|
||||||
@@ -25,25 +37,25 @@ Installing calc from the bzip2-ed tarball in 4 easy steps:
|
|||||||
cd /var/tmp
|
cd /var/tmp
|
||||||
bunzip2 -c /usr/src/redhat/SOURCES/calc-*.tar.bz2 | tar -xvf -
|
bunzip2 -c /usr/src/redhat/SOURCES/calc-*.tar.bz2 | tar -xvf -
|
||||||
|
|
||||||
1) Look at the makefile, and adjust it to suit your needs.
|
(1) Look at the makefile, and adjust it to suit your needs.
|
||||||
|
|
||||||
The top level Makefile and the custom/Makefile require a GNU
|
The top level Makefile and the custom/Makefile require a modern
|
||||||
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.
|
probably want to use gmake instead of make.
|
||||||
|
|
||||||
Some report that under macOS, one has to declare the target
|
Some report that under macOS, one has to declare the target
|
||||||
to be darwin. So for macOS, one might have to do:
|
to be Darwin. So for macOS, one might have to do:
|
||||||
|
|
||||||
# for macOS users only, force the target to be darwin
|
# for macOS users only, force the target to be Darwin
|
||||||
#
|
#
|
||||||
make target=Darwin clobber
|
make target=Darwin clobber
|
||||||
make target=Darwin all
|
make target=Darwin all
|
||||||
make target=Darwin chk
|
make target=Darwin chk
|
||||||
make target=Darwin install
|
make target=Darwin install
|
||||||
|
|
||||||
If your target system does not have GNU Make (or equivalent), then
|
If your target system does not have a moderm Makefile (such as gmake),
|
||||||
you should try using the Makefile.simple and custom/Makefile.simple
|
then you should try using the Makefile.simple and custom/Makefile.simple
|
||||||
files:
|
files:
|
||||||
|
|
||||||
mv Makefile Makefile.gmake
|
mv Makefile Makefile.gmake
|
||||||
@@ -56,6 +68,14 @@ Installing calc from the bzip2-ed tarball in 4 easy steps:
|
|||||||
values should work. If in doubt, follow the 'When in doubt'
|
values should work. If in doubt, follow the 'When in doubt'
|
||||||
suggestion.
|
suggestion.
|
||||||
|
|
||||||
|
If you are using a modern make (such as gmake), you may override
|
||||||
|
any values set in the Mkefile by adding them to Makefile.local
|
||||||
|
using the := directive. For example:
|
||||||
|
|
||||||
|
HAVE_STRING_H:= YES
|
||||||
|
HAVE_TIMES_H:= YES
|
||||||
|
SED:= /usr/local/bin/nsed
|
||||||
|
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
! If you are building under Windoz or a Windoz-like environment !
|
! If you are building under Windoz or a Windoz-like environment !
|
||||||
! (such as Cygwin or DJGPP), read the README.WINDOWS file. !
|
! (such as Cygwin or DJGPP), read the README.WINDOWS file. !
|
||||||
@@ -120,7 +140,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
|
||||||
|
|
||||||
@@ -148,11 +168,11 @@ Installing calc from the bzip2-ed tarball in 4 easy steps:
|
|||||||
|
|
||||||
Adjust other Makefile variables as needed.
|
Adjust other Makefile variables as needed.
|
||||||
|
|
||||||
2) build calc:
|
(2) build calc:
|
||||||
|
|
||||||
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
|
||||||
@@ -180,7 +200,7 @@ Installing calc from the bzip2-ed tarball in 4 easy steps:
|
|||||||
make clobber
|
make clobber
|
||||||
make calc-dynamic-only BLD_TYPE=calc-dynamic-only
|
make calc-dynamic-only BLD_TYPE=calc-dynamic-only
|
||||||
|
|
||||||
3) test calc:
|
(3) test calc:
|
||||||
|
|
||||||
make check
|
make check
|
||||||
|
|
||||||
@@ -191,14 +211,223 @@ Installing calc from the bzip2-ed tarball in 4 easy steps:
|
|||||||
|
|
||||||
make chk
|
make chk
|
||||||
|
|
||||||
4) install calc:
|
(4) install calc:
|
||||||
|
|
||||||
make install
|
make install
|
||||||
|
|
||||||
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
|
=-=
|
||||||
|
|
||||||
|
On calc Makefiles:
|
||||||
|
|
||||||
|
How to tell the origin of of a Makefile:
|
||||||
|
|
||||||
|
The "# SRC: ... - ..." comment line near the top
|
||||||
|
of the file indicates the origin of this file.
|
||||||
|
In each segment below, we indicate what the SRC
|
||||||
|
comment like will read.
|
||||||
|
|
||||||
|
SHELL= ...
|
||||||
|
|
||||||
|
On some systems, /bin/sh is a rather reduced shell with
|
||||||
|
deprecated behavior.
|
||||||
|
|
||||||
|
If your system has a up to date, bash shell, then
|
||||||
|
you may wish to edit the Makefile to use:
|
||||||
|
|
||||||
|
SHELL= /bin/bash
|
||||||
|
|
||||||
|
On some systems such as macOS, the bash shell is very
|
||||||
|
far behind to the point where is cannot be depended on.
|
||||||
|
On such systems, the zsh may be a much better alternative
|
||||||
|
shell for this Makefile to use:
|
||||||
|
|
||||||
|
SHELL= /bin/zsh
|
||||||
|
|
||||||
|
Makefile
|
||||||
|
|
||||||
|
# SRC: Makefile - Our calc build environment
|
||||||
|
|
||||||
|
This is our internal Makefile that drives how we build calc.
|
||||||
|
For critical rules in Makefile.ship, there is a corresponding
|
||||||
|
rule in Makefile that calls ${MAKE} -f Makefile.ship with,
|
||||||
|
additional commands, args and Makefile variables. The ${XVAR}
|
||||||
|
Makefile variable, for example, is passed on each call to
|
||||||
|
${MAKE} -f Makefile.ship so that the environment and parameters of
|
||||||
|
Makefile.ship may be managed for our build environment.
|
||||||
|
|
||||||
|
This Makefile is used to make the calc rpm. In addition to these
|
||||||
|
comments, this Makefile differs from the non-rpm bzip2-ed tarball
|
||||||
|
source Makefile in at least the the following ways:
|
||||||
|
|
||||||
|
CCWERR= -Werror
|
||||||
|
USE_READLINE= -DUSE_READLINE
|
||||||
|
READLINE_LIB= -lreadline -lhistory -lncurses
|
||||||
|
|
||||||
|
If the Makefile is not suitable for you, then
|
||||||
|
you may wish to replace it with Makefile.ship:
|
||||||
|
|
||||||
|
mv -f -v Makefile.ship Makefile
|
||||||
|
|
||||||
|
This Makefile assumes you have a modern make command such as
|
||||||
|
the GNU make. See Makefile.simple comment below if you do not
|
||||||
|
have such a modern make command.
|
||||||
|
|
||||||
|
In packages such as RPMs, and the tar.bz2 source tarball,
|
||||||
|
Makefile contains the contents of Makefile.ship. If Makefile.ship
|
||||||
|
is missing it has likely moved to replace Makefile.
|
||||||
|
|
||||||
|
In the calc GitHub repo, Makefile is the calc build environment
|
||||||
|
and Makefile.ship is the top level Makefile:
|
||||||
|
|
||||||
|
https://github.com/lcn2/calc
|
||||||
|
|
||||||
|
Makefile.ship
|
||||||
|
|
||||||
|
# SRC: Makefile.ship - top level Makefile
|
||||||
|
|
||||||
|
This is the main top level Makefile.
|
||||||
|
|
||||||
|
In calc packages such as RPMs, and the tar.bz2 source tarball,
|
||||||
|
Makefile.ship has been moved into Makefile.
|
||||||
|
|
||||||
|
In the calc GitHub repo, Makefile is the calc build environment
|
||||||
|
and Makefile.ship is the top level Makefile:
|
||||||
|
|
||||||
|
https://github.com/lcn2/calc
|
||||||
|
|
||||||
|
The Makefile.simple rule of Makefile.ship, when forming the
|
||||||
|
Makefile.simple file, removes lines from Makefile.ship between
|
||||||
|
pairs of '#if 0' AND '#endif':
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
lines removed when forming Makefile.simple
|
||||||
|
...
|
||||||
|
lines removed when forming Makefile.simple
|
||||||
|
#endif
|
||||||
|
|
||||||
|
The '#if 0' AND '#endif' MUST be at the start of the line.
|
||||||
|
Any text after the '#if 0' OR '#endif' is ignored.
|
||||||
|
|
||||||
|
While they may look like a CPP directives, they are not. The
|
||||||
|
inline awk script of the Makefile.simple rule does NOT allow
|
||||||
|
them to nest:
|
||||||
|
|
||||||
|
#if 0 /* DO NOT DO THIS */
|
||||||
|
lines removed when forming Makefile.simple
|
||||||
|
...
|
||||||
|
#if 0 /* DO NOT DO THIS */
|
||||||
|
...
|
||||||
|
#endif /* DO NOT DO THIS */
|
||||||
|
...
|
||||||
|
#endif /* DO NOT DO THIS */
|
||||||
|
|
||||||
|
The custom/Makefile rule of Makefile.ship is used to form
|
||||||
|
the custom/Makefile. In particular the Makefile.ship lines:
|
||||||
|
|
||||||
|
# start of host target cut
|
||||||
|
... these go in between custom/Makefile.head and custom/Makefile.tail
|
||||||
|
# end of host target cut
|
||||||
|
|
||||||
|
Makefile.simple
|
||||||
|
|
||||||
|
# SRC: non-GNU Makefile via make -f Makefile.ship Makefile.simple
|
||||||
|
|
||||||
|
This is a non-GNU or simple Makefile designed for environments
|
||||||
|
that do not have a modern make command.
|
||||||
|
|
||||||
|
If you have a Makefile.simple file, use these commands to
|
||||||
|
form a Makefile:
|
||||||
|
|
||||||
|
if [ -f Makefile ]; then mv -f Makefile Makefile.orig; fi
|
||||||
|
cp Makefile.simple Makefile
|
||||||
|
|
||||||
|
The Makefile.simple rule from Makefile.ship is used to construct
|
||||||
|
this file from the contents of Makefile.ship.
|
||||||
|
|
||||||
|
In calc packages such as RPMs, and the tar.bz2 source the
|
||||||
|
Makefile.simple exists. In the calc GitHub repo:
|
||||||
|
|
||||||
|
https://github.com/lcn2/calc
|
||||||
|
|
||||||
|
this file does NOT exist and must be made via the Makefile.simple
|
||||||
|
make rule. Therefore, non-GNU and simple make commands are NOT
|
||||||
|
supported by the calc GitHub repo master branch. Instead, you
|
||||||
|
need to extract Makefile.simple from one of the calc tar.bz2
|
||||||
|
source tarball source from a calc source mirror:
|
||||||
|
|
||||||
|
http://www.isthe.com/chongo/tech/comp/calc/calc-mirror.html
|
||||||
|
|
||||||
|
custom/Makefile.head
|
||||||
|
|
||||||
|
# SRC: custom/Makefile.head
|
||||||
|
|
||||||
|
This file forms the top part of the custom/Makefile.
|
||||||
|
|
||||||
|
custom/Makefile.tail
|
||||||
|
|
||||||
|
# SRC: custom/Makefile.tail
|
||||||
|
|
||||||
|
This file forms the bottom part of the custom/Makefile.
|
||||||
|
|
||||||
|
custom/Makefile
|
||||||
|
|
||||||
|
# SRC: Makefile via make -f Makefile custom/Makefile
|
||||||
|
|
||||||
|
This is the custom directory Makefile.
|
||||||
|
|
||||||
|
The custom/Makefile rule of Makefile.ship is used to form
|
||||||
|
the custom/Makefile. In particular the Makefile.ship lines:
|
||||||
|
|
||||||
|
# start of host target cut
|
||||||
|
... these go in between custom/Makefile.head and custom/Makefile.tail
|
||||||
|
# end of host target cut
|
||||||
|
|
||||||
|
NOTE: The clobber rule does not remove this file. - XXX
|
||||||
|
|
||||||
|
custom/Makefile.simple
|
||||||
|
|
||||||
|
# SRC: non-GNU Makefile via make -f Makefile custom/Makefile.simple
|
||||||
|
|
||||||
|
This is a non-GNU or simple Makefile for the custom directory
|
||||||
|
that is designed for environments that do not have a modern make
|
||||||
|
command.
|
||||||
|
|
||||||
|
In calc packages such as RPMs, and the tar.bz2 source the
|
||||||
|
Makefile.simple exists. In the calc GitHub repo:
|
||||||
|
|
||||||
|
https://github.com/lcn2/calc
|
||||||
|
|
||||||
|
this file does NOT exist and must be made via the
|
||||||
|
custom/Makefile.simple make rule. Therefore, non-GNU and simple
|
||||||
|
make commands are NOT supported by the calc GitHub repo master
|
||||||
|
branch. Instead, you need to extract custom/Makefile.simple
|
||||||
|
from one of the calc tar.bz2 source tarball source from a calc
|
||||||
|
source mirror:
|
||||||
|
|
||||||
|
http://www.isthe.com/chongo/tech/comp/calc/calc-mirror.html
|
||||||
|
|
||||||
|
cal/Makefile
|
||||||
|
|
||||||
|
# SRC: cal/Makefile
|
||||||
|
|
||||||
|
The Makefile for the cal sub-directory.
|
||||||
|
|
||||||
|
cscript/Makefile
|
||||||
|
|
||||||
|
# SRC: cscript/Makefile
|
||||||
|
|
||||||
|
The Makefile for the cscript sub-directory.
|
||||||
|
|
||||||
|
help/Makefile
|
||||||
|
|
||||||
|
# SRC: help/Makefile
|
||||||
|
|
||||||
|
The Makefile for the help sub-directory.
|
||||||
|
|
||||||
|
## 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
|
||||||
|
264
Makefile
264
Makefile
@@ -2,32 +2,15 @@
|
|||||||
#
|
#
|
||||||
# calc - arbitrary precision calculator
|
# calc - arbitrary precision calculator
|
||||||
#
|
#
|
||||||
# (Linux calc rpm building makefile)
|
# Copyright (C) 1999-2018,2021 Landon Curt Noll
|
||||||
#
|
#
|
||||||
# NOTE: This Makefile is used to make the calc rpm. In addition to these
|
# SRC: Makefile - Our calc build environment
|
||||||
# comments, this Makefile differs from the non-rpm bzip2-ed tarball
|
|
||||||
# source Makefile in the following ways:
|
|
||||||
#
|
#
|
||||||
# MAKEFILE_REV= $$Revision: 30.26 $$
|
# The "# SRC: ... - ..." comment line above indicates
|
||||||
# CCWERR= -Werror
|
# the origin of this file.
|
||||||
# USE_READLINE= -DUSE_READLINE
|
|
||||||
# READLINE_LIB= -lreadline -lhistory -lncurses
|
|
||||||
#
|
#
|
||||||
# The Makefile.ship makefile becomes the Makefile found in the
|
# IMPORTANT: Please see the section on Makefiles near the
|
||||||
# calc-*.tar.bz2 bzip2 source tarball.
|
# bottom of the HOWTO.INSTALL file.
|
||||||
#
|
|
||||||
# This Makefile drives the makefile: Makefile.ship.
|
|
||||||
#
|
|
||||||
# This makefile mostly contains critical variables (such as SHELL, MAKE, etc.)
|
|
||||||
# as well as those which we choose to override defaults found in
|
|
||||||
# Makefile.ship. Make variables unique to this Makefile start with X.
|
|
||||||
#
|
|
||||||
# This makefile contains only those critical rules (such as all, clean, 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
|
|
||||||
# string in the shipped makefiles (such as Makefile.ship).
|
|
||||||
|
|
||||||
# Copyright (C) 1999-2008,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
|
||||||
@@ -52,16 +35,96 @@
|
|||||||
# 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
|
# Unfortunately due to the complex dependency issues between
|
||||||
|
# Makefile, Makefile.ship and custom/Makefile, parallel GNU make
|
||||||
|
# is NOT recommended. Sorry.
|
||||||
|
#
|
||||||
|
.NOTPARALLEL:
|
||||||
|
|
||||||
|
# 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)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# The shell used by this Makefile
|
||||||
|
#
|
||||||
|
# On some systems, /bin/sh is a rather reduced shell with
|
||||||
|
# deprecated behavior.
|
||||||
|
#
|
||||||
|
# If your system has a up to date, bash shell, then
|
||||||
|
# you may wish to use:
|
||||||
|
#
|
||||||
|
# SHELL= /bin/bash
|
||||||
|
#
|
||||||
|
# On some systems such as macOS, the bash shell is very
|
||||||
|
# far behind to the point wehre is cannot be depended on.
|
||||||
|
# On such systems, the zsh may be a much better alternative
|
||||||
|
# shell for this Makefile to use:
|
||||||
|
#
|
||||||
|
# SHELL= /bin/zsh
|
||||||
|
#
|
||||||
|
ifeq ($(target),Darwin)
|
||||||
|
SHELL= /bin/zsh
|
||||||
|
else
|
||||||
|
SHELL= /bin/bash
|
||||||
|
endif
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#-=-=-=-=-=-=-=-=- You may want to change some values below -=-=-=-=-=-=-=-=-#
|
#-=-=-=-=-=-=-=-=- You may want to change some values below -=-=-=-=-=-=-=-=-#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
|
# PREFIX - Top level location for calc
|
||||||
|
#
|
||||||
|
# The PREFIX is often prepended to paths within calc and calc Makefiles.
|
||||||
|
#
|
||||||
|
# Starting with calc v2.13.0.1, nearly all Makefile places that used
|
||||||
|
# /usr/local now use ${PREFIX}. An exception is the olduninstall rule
|
||||||
|
# and, of course, this section. :-)
|
||||||
|
#
|
||||||
|
# When in doubt, try:
|
||||||
|
#
|
||||||
|
# PREFIX= /usr/local
|
||||||
|
#
|
||||||
|
PREFIX= /usr/local
|
||||||
|
#PREFIX= /usr
|
||||||
|
#PREFIX= /usr/global
|
||||||
|
|
||||||
|
# CCBAN is given to ${CC} in order to control if banned.h is in effect.
|
||||||
|
#
|
||||||
|
# The banned.h attempts to ban the use of certain dangerous functions
|
||||||
|
# that, if improperly used, could compromise the computational integrity
|
||||||
|
# if calculations.
|
||||||
|
#
|
||||||
|
# In the case of calc, we are motivated in part by the desire for calc
|
||||||
|
# to correctly calculate: even durings extremely long calculations.
|
||||||
|
#
|
||||||
|
# If UNBAN is NOT defined, then calling certain functions
|
||||||
|
# will result in a call to a non-existent function (link error).
|
||||||
|
#
|
||||||
|
# While we do NOT encourage defining UNBAN, there may be
|
||||||
|
# a system / compiler environment where re-defining a
|
||||||
|
# function may lead to a fatal compiler complication.
|
||||||
|
# If that happens, consider compiling as:
|
||||||
|
#
|
||||||
|
# make clobber all chk CCBAN=-DUNBAN
|
||||||
|
#
|
||||||
|
# as see if this is a work-a-round.
|
||||||
|
#
|
||||||
|
# If YOU discover a need for the -DUNBAN work-a-round, PLEASE tell us!
|
||||||
|
# Please send us a bug report. See the file:
|
||||||
|
#
|
||||||
|
# BUGS
|
||||||
|
#
|
||||||
|
# or the URL:
|
||||||
|
#
|
||||||
|
# http://www.isthe.com/chongo/tech/comp/calc/calc-bugrept.html
|
||||||
|
#
|
||||||
|
# for how to send us such a bug report.
|
||||||
|
#
|
||||||
|
CCBAN= -UUNBAN
|
||||||
|
#CCBAN= -DUNBAN
|
||||||
|
|
||||||
# Determine of the GNU-readline facility will be used instead of the
|
# Determine of the GNU-readline facility will be used instead of the
|
||||||
# built-in calc binding method.
|
# built-in calc binding method.
|
||||||
#
|
#
|
||||||
@@ -70,22 +133,22 @@ USE_READLINE= -DUSE_READLINE
|
|||||||
#
|
#
|
||||||
#READLINE_LIB=
|
#READLINE_LIB=
|
||||||
#READLINE_LIB= -L/usr/gnu/lib -lreadline -lhistory -lncurses
|
#READLINE_LIB= -L/usr/gnu/lib -lreadline -lhistory -lncurses
|
||||||
#READLINE_LIB= -L/usr/local/lib -lreadline -lhistory -lncurses
|
#READLINE_LIB= -L${PREFIX}/lib -lreadline -lhistory -lncurses
|
||||||
ifeq ($(target),Darwin)
|
ifeq ($(target),Darwin)
|
||||||
# homebrew installs readline & history libs in /usr/local/opt/readline/lib
|
# homebrew installs readline & history libs in ${PREFIX}/opt/readline/lib
|
||||||
READLINE_LIB= -L/usr/local/opt/readline/lib -lreadline -lhistory -lncurses
|
READLINE_LIB= -L${PREFIX}/opt/readline/lib -lreadline -lhistory -lncurses
|
||||||
else
|
else
|
||||||
READLINE_LIB= -lreadline -lhistory -lncurses
|
READLINE_LIB= -lreadline -lhistory -lncurses
|
||||||
endif
|
endif
|
||||||
#
|
#
|
||||||
ifeq ($(target),Darwin)
|
ifeq ($(target),Darwin)
|
||||||
# homebrew installs readline & history *.h under /usr/local/opt/readline/include
|
# homebrew installs readline & history *.h under ${PREFIX}/opt/readline/include
|
||||||
READLINE_INCLUDE= -I/usr/local/opt/readline/include
|
READLINE_INCLUDE= -I${PREFIX}/opt/readline/include
|
||||||
else
|
else
|
||||||
READLINE_INCLUDE=
|
READLINE_INCLUDE=
|
||||||
endif
|
endif
|
||||||
#READLINE_INCLUDE= -I/usr/gnu/include
|
#READLINE_INCLUDE= -I/usr/gnu/include
|
||||||
#READLINE_INCLUDE= -I/usr/local/include
|
#READLINE_INCLUDE= -I${PREFIX}/include
|
||||||
|
|
||||||
# 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
|
||||||
@@ -109,7 +172,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
|
||||||
|
|
||||||
@@ -135,7 +198,6 @@ endif
|
|||||||
|
|
||||||
# standard utilities used during make
|
# standard utilities used during make
|
||||||
#
|
#
|
||||||
SHELL= /bin/sh
|
|
||||||
MAKE= make
|
MAKE= make
|
||||||
SED= sed
|
SED= sed
|
||||||
GREP= egrep
|
GREP= egrep
|
||||||
@@ -153,11 +215,30 @@ CI= ci
|
|||||||
# Q=@ do not echo internal Makefile actions (quiet mode)
|
# Q=@ do not echo internal Makefile actions (quiet mode)
|
||||||
# Q= echo internal Makefile actions (debug / verbose mode)
|
# Q= echo internal Makefile actions (debug / verbose mode)
|
||||||
#
|
#
|
||||||
|
# H=@: do not report hsrc file formation progress
|
||||||
|
# H=@ do echo hsrc file formation progress
|
||||||
|
#
|
||||||
|
# S= >/dev/null 2>&1 slience ${CC} output during hsrc file formation
|
||||||
|
# S= full ${CC} output during hsrc file formation
|
||||||
|
#
|
||||||
|
# E= 2>/dev/null slience command stderr during hsrc file formation
|
||||||
|
# E= full command stderr during hsrc file formation
|
||||||
|
#
|
||||||
# V=@: do not echo debug statements (quiet mode)
|
# V=@: do not echo debug statements (quiet mode)
|
||||||
# V=@ do echo debug statements (debug / verbose mode)
|
# V=@ do echo debug statements (debug / verbose mode)
|
||||||
#
|
#
|
||||||
#Q=
|
#Q=
|
||||||
Q=@
|
Q=@
|
||||||
|
#
|
||||||
|
S= >/dev/null 2>&1
|
||||||
|
#S=
|
||||||
|
#
|
||||||
|
E= 2>/dev/null
|
||||||
|
#E=
|
||||||
|
#
|
||||||
|
#H=@:
|
||||||
|
H=@
|
||||||
|
#
|
||||||
V=@:
|
V=@:
|
||||||
#V=@
|
#V=@
|
||||||
|
|
||||||
@@ -169,23 +250,28 @@ 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= \
|
||||||
target=${target} \
|
CCBAN='${CCBAN}' \
|
||||||
USE_READLINE='${USE_READLINE}' \
|
|
||||||
READLINE_LIB='${READLINE_LIB}' \
|
|
||||||
READLINE_INCLUDE='${READLINE_INCLUDE}' \
|
|
||||||
RPM_TOP='${RPM_TOP}' \
|
|
||||||
MAKE_FILE='${MAKE_FILE}' \
|
|
||||||
EXT='${EXT}' \
|
|
||||||
DARWIN_ARCH='${DARWIN_ARCH}' \
|
|
||||||
CCWERR='${CCWERR}' \
|
CCWERR='${CCWERR}' \
|
||||||
NROFF='${NROFF}' \
|
|
||||||
COMMON_ADD='${COMMON_ADD}' \
|
COMMON_ADD='${COMMON_ADD}' \
|
||||||
|
DARWIN_ARCH='${DARWIN_ARCH}' \
|
||||||
|
E='${E}' \
|
||||||
|
EXT='${EXT}' \
|
||||||
|
H='${H}' \
|
||||||
|
MAKE_FILE='${MAKE_FILE}' \
|
||||||
|
NROFF='${NROFF}' \
|
||||||
Q='${Q}' \
|
Q='${Q}' \
|
||||||
V='${V}'
|
PREFIX='${PREFIX}' \
|
||||||
|
READLINE_INCLUDE='${READLINE_INCLUDE}' \
|
||||||
|
READLINE_LIB='${READLINE_LIB}' \
|
||||||
|
RPM_TOP='${RPM_TOP}' \
|
||||||
|
S='${S}' \
|
||||||
|
USE_READLINE='${USE_READLINE}' \
|
||||||
|
V='${V}' \
|
||||||
|
target=${target}
|
||||||
|
|
||||||
# We update the calc version string in these makefiles
|
# We update the calc version string in these makefiles
|
||||||
#
|
#
|
||||||
@@ -201,36 +287,15 @@ XMKVER= ${MAKE_FILE} custom/Makefile.head
|
|||||||
#
|
#
|
||||||
###
|
###
|
||||||
|
|
||||||
all: fix_version check_include
|
all: fix_version
|
||||||
${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}
|
||||||
${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 =-=-=-=-='
|
||||||
@@ -517,6 +582,20 @@ have_unused.h:
|
|||||||
${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 =-=-=-=-='
|
||||||
|
|
||||||
|
have_ban_pragma.h:
|
||||||
|
${V} echo '=-=-=-=-= private Makefile $@ rule start =-=-=-=-='
|
||||||
|
${Q} ${MAKE} ${XARG} -f ${MAKE_FILE} $@ ${XVAR}
|
||||||
|
${V} echo '=-=-=-=-= private Makefile $@ rule end =-=-=-=-='
|
||||||
|
|
||||||
|
have_strlcpy.h:
|
||||||
|
${V} echo '=-=-=-=-= private Makefile $@ rule start =-=-=-=-='
|
||||||
|
${Q} ${MAKE} ${XARG} -f ${MAKE_FILE} $@ ${XVAR}
|
||||||
|
${V} echo '=-=-=-=-= private Makefile $@ rule end =-=-=-=-='
|
||||||
|
|
||||||
|
have_strlcat.h:
|
||||||
|
${V} echo '=-=-=-=-= private Makefile $@ rule start =-=-=-=-='
|
||||||
|
${Q} ${MAKE} ${XARG} -f ${MAKE_FILE} $@ ${XVAR}
|
||||||
|
${V} echo '=-=-=-=-= private Makefile $@ rule end =-=-=-=-='
|
||||||
|
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
@@ -532,34 +611,6 @@ win32_hsrc:
|
|||||||
${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 =-=-=-=-='
|
||||||
|
|
||||||
|
|
||||||
##
|
|
||||||
#
|
|
||||||
# These rules are used in the process of building the BUILD_H_SRC.
|
|
||||||
#
|
|
||||||
##
|
|
||||||
|
|
||||||
endian.o:
|
|
||||||
${V} echo '=-=-=-=-= private Makefile $@ rule start =-=-=-=-='
|
|
||||||
${Q} ${MAKE} ${XARG} -f ${MAKE_FILE} $@ ${XVAR}
|
|
||||||
${V} echo '=-=-=-=-= private Makefile $@ rule end =-=-=-=-='
|
|
||||||
|
|
||||||
endian${EXT}:
|
|
||||||
${V} echo '=-=-=-=-= private Makefile $@ rule start =-=-=-=-='
|
|
||||||
${Q} ${MAKE} ${XARG} -f ${MAKE_FILE} $@ ${XVAR}
|
|
||||||
${V} echo '=-=-=-=-= private Makefile $@ rule end =-=-=-=-='
|
|
||||||
|
|
||||||
longbits.o:
|
|
||||||
${V} echo '=-=-=-=-= private Makefile $@ rule start =-=-=-=-='
|
|
||||||
${Q} ${MAKE} ${XARG} -f ${MAKE_FILE} $@ ${XVAR}
|
|
||||||
${V} echo '=-=-=-=-= private Makefile $@ rule end =-=-=-=-='
|
|
||||||
|
|
||||||
longbits${EXT}:
|
|
||||||
${V} echo '=-=-=-=-= private Makefile $@ rule start =-=-=-=-='
|
|
||||||
${Q} ${MAKE} ${XARG} -f ${MAKE_FILE} $@ ${XVAR}
|
|
||||||
${V} echo '=-=-=-=-= private Makefile $@ rule end =-=-=-=-='
|
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
# These two .all rules are used to determine of the lower level
|
# These two .all rules are used to determine of the lower level
|
||||||
@@ -594,7 +645,7 @@ custom/.all:
|
|||||||
|
|
||||||
###
|
###
|
||||||
#
|
#
|
||||||
# building calc-static and static lib*.a libraires
|
# building calc-static and static lib*.a libraries
|
||||||
#
|
#
|
||||||
###
|
###
|
||||||
|
|
||||||
@@ -623,7 +674,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.
|
||||||
@@ -703,6 +754,11 @@ Makefile.simple:
|
|||||||
${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 =-=-=-=-='
|
||||||
|
|
||||||
|
custom/Makefile.simple:
|
||||||
|
${V} echo '=-=-=-=-= private Makefile $@ rule start =-=-=-=-='
|
||||||
|
${Q} ${MAKE} ${XARG} -f ${MAKE_FILE} $@ ${XVAR}
|
||||||
|
${V} echo '=-=-=-=-= private Makefile $@ rule end =-=-=-=-='
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
@@ -731,6 +787,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 +807,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 +912,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 +970,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 =-=-=-=-='
|
||||||
|
1
Makefile.local
Normal file
1
Makefile.local
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# Add below to override Makefile values (using :=) as in: HAVE_STRING_H:= YES
|
2714
Makefile.ship
2714
Makefile.ship
File diff suppressed because it is too large
Load Diff
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,4 +1,4 @@
|
|||||||
Dear calc user on a Windoz based system,
|
Dear calc user on a Windows based system,
|
||||||
|
|
||||||
See the HOWTO.INSTALL file for information on how to build and install calc.
|
See the HOWTO.INSTALL file for information on how to build and install calc.
|
||||||
See also the README file.
|
See also the README file.
|
||||||
@@ -126,7 +126,7 @@ recommends the following settings:
|
|||||||
CATDIR= /dev/env/DJDIR/man/cat1
|
CATDIR= /dev/env/DJDIR/man/cat1
|
||||||
NROFF= groff
|
NROFF= groff
|
||||||
CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR}
|
CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR}
|
||||||
CALCRC= ${CALC_SHAREDIR}/startup;~/.calcrc;./.calcinit
|
CALCRC= ./.calcinit;~/.calcrc;${CALC_SHAREDIR}/startup
|
||||||
CALCPAGER= less.exe -ci
|
CALCPAGER= less.exe -ci
|
||||||
DEBUG= -O2 -gstabs+ -DWINDOZ
|
DEBUG= -O2 -gstabs+ -DWINDOZ
|
||||||
|
|
||||||
|
@@ -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.
|
||||||
|
21
SECURITY.md
Normal file
21
SECURITY.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
## Supported Versions
|
||||||
|
|
||||||
|
Use this section to tell people about which versions of your project are
|
||||||
|
currently being supported with security updates.
|
||||||
|
|
||||||
|
| Version | Supported |
|
||||||
|
| ------- | ------------------ |
|
||||||
|
| 5.1.x | :white_check_mark: |
|
||||||
|
| 5.0.x | :x: |
|
||||||
|
| 4.0.x | :white_check_mark: |
|
||||||
|
| < 4.0 | :x: |
|
||||||
|
|
||||||
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
Use this section to tell people how to report a vulnerability.
|
||||||
|
|
||||||
|
Tell them where to go, how often they can expect to get an update on a
|
||||||
|
reported vulnerability, what to expect if the vulnerability is accepted or
|
||||||
|
declined, etc.
|
6
addop.c
6
addop.c
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* addop - add opcodes to a function being compiled
|
* addop - add opcodes to a function being compiled
|
||||||
*
|
*
|
||||||
* 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
|
||||||
*
|
*
|
||||||
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "calc.h"
|
#include "calc.h"
|
||||||
|
#include "alloc.h"
|
||||||
#include "opcodes.h"
|
#include "opcodes.h"
|
||||||
#include "str.h"
|
#include "str.h"
|
||||||
#include "func.h"
|
#include "func.h"
|
||||||
@@ -36,6 +37,9 @@
|
|||||||
#include "symbol.h"
|
#include "symbol.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
#define FUNCALLOCSIZE 20 /* reallocate size for functions */
|
#define FUNCALLOCSIZE 20 /* reallocate size for functions */
|
||||||
#define OPCODEALLOCSIZE 100 /* reallocate size for opcodes in functions */
|
#define OPCODEALLOCSIZE 100 /* reallocate size for opcodes in functions */
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* align32 - determine if 32 bit accesses must be aligned
|
* align32 - determine if 32 bit accesses must be aligned
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -34,6 +34,10 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
static void buserr(void); /* catch alignment errors */
|
static void buserr(void); /* catch alignment errors */
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* assocfunc - association table routines
|
* assocfunc - association table routines
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007 David I. Bell
|
* Copyright (C) 1999-2007,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
|
||||||
@@ -36,6 +36,9 @@
|
|||||||
#include "value.h"
|
#include "value.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
#define MINHASHSIZE 31 /* minimum size of hash tables */
|
#define MINHASHSIZE 31 /* minimum size of hash tables */
|
||||||
#define GROWHASHSIZE 50 /* approximate growth for hash tables */
|
#define GROWHASHSIZE 50 /* approximate growth for hash tables */
|
||||||
#define CHAINLENGTH 10 /* desired number of elements on a hash chain */
|
#define CHAINLENGTH 10 /* desired number of elements on a hash chain */
|
||||||
|
180
banned.h
Normal file
180
banned.h
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
/*
|
||||||
|
* banned - optionally ban dqngerious functions
|
||||||
|
*
|
||||||
|
* Unless UNBAN is defined, this file will turn the use
|
||||||
|
* of certain dangerous functions into syntax errors.
|
||||||
|
*
|
||||||
|
* In the case of calc, we are motivated in part by the desire for
|
||||||
|
* calc to correctly calculate: even durings extremely long calculations.
|
||||||
|
*
|
||||||
|
* If UNBAN is NOT defined, then calling certain functions
|
||||||
|
* will result in a syntaxc error.
|
||||||
|
*
|
||||||
|
* If we define UNBAN, then the effect of this file is disabled.
|
||||||
|
*
|
||||||
|
* The banned.h attempts to ban the use of certain dangerous functions
|
||||||
|
* that, if improperly used, could compromise the computational integrity
|
||||||
|
* if calculations.
|
||||||
|
*
|
||||||
|
* In the case of calc, we are motivated in part by the desire for calc
|
||||||
|
* to correctly calculate: even durings extremely long calculations.
|
||||||
|
*
|
||||||
|
* If UNBAN is NOT defined, then calling certain functions
|
||||||
|
* will result in a call to a non-existent function (link error).
|
||||||
|
*
|
||||||
|
* While we do NOT encourage defining UNBAN, there may be
|
||||||
|
* a system / compiler environment where re-defining a
|
||||||
|
* function may lead to a fatal compiler complication.
|
||||||
|
* If that happens, consider compiling as:
|
||||||
|
*
|
||||||
|
* make clobber all chk CCBAN=-DUNBAN
|
||||||
|
*
|
||||||
|
* as see if this is a work-a-round.
|
||||||
|
*
|
||||||
|
* If YOU discover a need for the -DUNBAN work-a-round, PLEASE tell us!
|
||||||
|
* Please send us a bug report. See the file:
|
||||||
|
*
|
||||||
|
* BUGS
|
||||||
|
*
|
||||||
|
* or the URL:
|
||||||
|
*
|
||||||
|
* http://www.isthe.com/chongo/tech/comp/calc/calc-bugrept.html
|
||||||
|
*
|
||||||
|
* for how to send us such a bug report.
|
||||||
|
*
|
||||||
|
* 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/03/06 21:07:31
|
||||||
|
* 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/
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(PRE_HAVE_BAN_PRAGMA_H)
|
||||||
|
#include "have_ban_pragma.h"
|
||||||
|
#endif /* ! PRE_HAVE_BAN_PRAGMA_H */
|
||||||
|
|
||||||
|
|
||||||
|
#if !defined(INCLUDE_BANNED_H)
|
||||||
|
#define INCLUDE_BANNED_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we define UNBAN, then the effect of this file is disabled.
|
||||||
|
*/
|
||||||
|
#if !defined(UNBAN)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* In the spirit of:
|
||||||
|
*
|
||||||
|
* https://github.com/git/git/blob/master/banned.h
|
||||||
|
*
|
||||||
|
* we will ban the use of certain unsafe functions by turning
|
||||||
|
* then into function calls that do not exist.
|
||||||
|
*
|
||||||
|
* In the case of calc, we are motivated in part by the desire
|
||||||
|
* for calc to correctly calculate: even durings extremely long
|
||||||
|
* calculations.
|
||||||
|
*
|
||||||
|
* If UNBAN is NOT defined, then calling certain functions
|
||||||
|
* will result in a syntaxc error.
|
||||||
|
*
|
||||||
|
* Unlike the above URL, we suggest an alternative function.
|
||||||
|
* In many cases, additional logic is required to use the
|
||||||
|
* alternative function, we cannot simply replace one function
|
||||||
|
* with another.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If one is not careful, strcpy() can lead to buffer overflows.
|
||||||
|
* Use strlcpy() instead.
|
||||||
|
*/
|
||||||
|
#if defined(HAVE_PRAGMA_GCC_POSION)
|
||||||
|
#undef strcpy
|
||||||
|
#pragma GCC poison strcpy
|
||||||
|
#endif /* HAVE_PRAGMA_GCC_POSION */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If one is not careful, strcat() can lead to buffer overflows.
|
||||||
|
* Use strlcat() instead.
|
||||||
|
*/
|
||||||
|
#if defined(HAVE_PRAGMA_GCC_POSION)
|
||||||
|
#undef strcat
|
||||||
|
#pragma GCC poison strcat
|
||||||
|
#endif /* HAVE_PRAGMA_GCC_POSION */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If one is not careful, strncpy() can lead to buffer overflows.
|
||||||
|
* Use memccpy() instead.
|
||||||
|
*/
|
||||||
|
#if defined(HAVE_PRAGMA_GCC_POSION)
|
||||||
|
#undef strncpy
|
||||||
|
#pragma GCC poison strncpy
|
||||||
|
#endif /* HAVE_PRAGMA_GCC_POSION */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If one is not careful, strncat() can lead to buffer overflows.
|
||||||
|
* Use memccpy() instead.
|
||||||
|
*/
|
||||||
|
#if defined(HAVE_PRAGMA_GCC_POSION)
|
||||||
|
#undef strncat
|
||||||
|
#pragma GCC poison strncat
|
||||||
|
#endif /* HAVE_PRAGMA_GCC_POSION */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If one is not careful, sprintf() can lead to buffer overflows.
|
||||||
|
* Use snprintf() instead.
|
||||||
|
*/
|
||||||
|
#if defined(HAVE_PRAGMA_GCC_POSION)
|
||||||
|
#undef sprintf
|
||||||
|
#pragma GCC poison sprintf
|
||||||
|
#endif /* HAVE_PRAGMA_GCC_POSION */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If one is not careful, vsprintf() can lead to buffer overflows.
|
||||||
|
* Use vsnprintf() instead.
|
||||||
|
*/
|
||||||
|
#if defined(HAVE_PRAGMA_GCC_POSION)
|
||||||
|
#undef vsprintf
|
||||||
|
#pragma GCC poison vsprintf
|
||||||
|
#endif /* HAVE_PRAGMA_GCC_POSION */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XXX - As of 2021, functions such as:
|
||||||
|
*
|
||||||
|
* gmtime_s
|
||||||
|
* localtime_s
|
||||||
|
* ctime_s
|
||||||
|
* asctime_s
|
||||||
|
*
|
||||||
|
* are not universal. We cannot yet ban the following
|
||||||
|
* functions because we do not have a portable AND
|
||||||
|
* widely available alternative. Therefore we just
|
||||||
|
* have to be extra careful when using:
|
||||||
|
*
|
||||||
|
* gmtime
|
||||||
|
* localtime
|
||||||
|
* ctime
|
||||||
|
* ctime_r
|
||||||
|
* asctime
|
||||||
|
* asctime_r
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endif /* !UNBAN */
|
||||||
|
|
||||||
|
#endif /* !INCLUDE_BANNED_H */
|
8
blkcpy.c
8
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
|
||||||
*
|
*
|
||||||
@@ -29,12 +29,16 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include "calc.h"
|
#include "calc.h"
|
||||||
|
#include "alloc.h"
|
||||||
#include "value.h"
|
#include "value.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "blkcpy.h"
|
#include "blkcpy.h"
|
||||||
#include "str.h"
|
#include "str.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* copystod - copy num indexed items from source value to destination value
|
* copystod - copy num indexed items from source value to destination value
|
||||||
*
|
*
|
||||||
@@ -1040,7 +1044,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
|
||||||
|
13
block.c
13
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
|
||||||
*
|
*
|
||||||
@@ -28,6 +28,11 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "have_string.h"
|
||||||
|
#ifdef HAVE_STRING_H
|
||||||
|
# include <string.h>
|
||||||
|
#endif
|
||||||
|
#include "alloc.h"
|
||||||
#include "value.h"
|
#include "value.h"
|
||||||
#include "zmath.h"
|
#include "zmath.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@@ -36,6 +41,10 @@
|
|||||||
#include "str.h"
|
#include "str.h"
|
||||||
#include "calcerr.h"
|
#include "calcerr.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
#define NBLOCKCHUNK 16
|
#define NBLOCKCHUNK 16
|
||||||
|
|
||||||
STATIC long nblockcount = 0;
|
STATIC long nblockcount = 0;
|
||||||
@@ -291,7 +300,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 */
|
||||||
|
47
byteswap.c
47
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
|
||||||
@@ -29,6 +29,9 @@
|
|||||||
#include "byteswap.h"
|
#include "byteswap.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* swap_b8_in_HALFs - swap 8 and if needed, 16 bits in an array of HALFs
|
* swap_b8_in_HALFs - swap 8 and if needed, 16 bits in an array of HALFs
|
||||||
*
|
*
|
||||||
@@ -77,7 +80,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
|
||||||
@@ -123,8 +126,8 @@ swap_b8_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all)
|
|||||||
* swap or copy the rest of the ZVALUE elements
|
* swap or copy the rest of the ZVALUE elements
|
||||||
*/
|
*/
|
||||||
if (all) {
|
if (all) {
|
||||||
dest->len = (LEN)SWAP_B8_IN_LEN(&dest->len, &src->len);
|
SWAP_B8_IN_LEN(&dest->len, &src->len);
|
||||||
dest->sign = (BOOL)SWAP_B8_IN_BOOL(&dest->sign, &src->sign);
|
SWAP_B8_IN_BOOL(&dest->sign, &src->sign);
|
||||||
} else {
|
} else {
|
||||||
dest->len = src->len;
|
dest->len = src->len;
|
||||||
dest->sign = src->sign;
|
dest->sign = src->sign;
|
||||||
@@ -145,7 +148,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
|
||||||
@@ -189,7 +192,7 @@ swap_b8_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all)
|
|||||||
* swap or copy the rest of the NUMBER elements
|
* swap or copy the rest of the NUMBER elements
|
||||||
*/
|
*/
|
||||||
if (all) {
|
if (all) {
|
||||||
dest->links = (long)SWAP_B8_IN_LONG(&dest->links, &src->links);
|
SWAP_B8_IN_LONG(&dest->links, &src->links);
|
||||||
} else {
|
} else {
|
||||||
dest->links = src->links;
|
dest->links = src->links;
|
||||||
}
|
}
|
||||||
@@ -209,7 +212,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
|
||||||
@@ -253,7 +256,7 @@ swap_b8_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all)
|
|||||||
* swap or copy the rest of the NUMBER elements
|
* swap or copy the rest of the NUMBER elements
|
||||||
*/
|
*/
|
||||||
if (all) {
|
if (all) {
|
||||||
dest->links = (long)SWAP_B8_IN_LONG(&dest->links, &src->links);
|
SWAP_B8_IN_LONG(&dest->links, &src->links);
|
||||||
} else {
|
} else {
|
||||||
dest->links = src->links;
|
dest->links = src->links;
|
||||||
}
|
}
|
||||||
@@ -313,7 +316,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
|
||||||
@@ -358,8 +361,8 @@ swap_b16_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all)
|
|||||||
* swap or copy the rest of the ZVALUE elements
|
* swap or copy the rest of the ZVALUE elements
|
||||||
*/
|
*/
|
||||||
if (all) {
|
if (all) {
|
||||||
dest->len = (LEN)SWAP_B16_IN_LEN(&dest->len, &src->len);
|
SWAP_B16_IN_LEN(&dest->len, &src->len);
|
||||||
dest->sign = (BOOL)SWAP_B16_IN_BOOL(&dest->sign, &src->sign);
|
SWAP_B16_IN_BOOL(&dest->sign, &src->sign);
|
||||||
} else {
|
} else {
|
||||||
dest->len = src->len;
|
dest->len = src->len;
|
||||||
dest->sign = src->sign;
|
dest->sign = src->sign;
|
||||||
@@ -380,7 +383,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
|
||||||
@@ -424,7 +427,7 @@ swap_b16_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all)
|
|||||||
* swap or copy the rest of the NUMBER elements
|
* swap or copy the rest of the NUMBER elements
|
||||||
*/
|
*/
|
||||||
if (all) {
|
if (all) {
|
||||||
dest->links = (long)SWAP_B16_IN_LONG(&dest->links, &src->links);
|
SWAP_B16_IN_LONG(&dest->links, &src->links);
|
||||||
} else {
|
} else {
|
||||||
dest->links = src->links;
|
dest->links = src->links;
|
||||||
}
|
}
|
||||||
@@ -444,7 +447,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
|
||||||
@@ -488,7 +491,7 @@ swap_b16_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all)
|
|||||||
* swap or copy the rest of the NUMBER elements
|
* swap or copy the rest of the NUMBER elements
|
||||||
*/
|
*/
|
||||||
if (all) {
|
if (all) {
|
||||||
dest->links = (long)SWAP_B16_IN_LONG(&dest->links, &src->links);
|
SWAP_B16_IN_LONG(&dest->links, &src->links);
|
||||||
} else {
|
} else {
|
||||||
dest->links = src->links;
|
dest->links = src->links;
|
||||||
}
|
}
|
||||||
@@ -508,7 +511,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
|
||||||
@@ -554,8 +557,8 @@ swap_HALF_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all)
|
|||||||
* swap or copy the rest of the ZVALUE elements
|
* swap or copy the rest of the ZVALUE elements
|
||||||
*/
|
*/
|
||||||
if (all) {
|
if (all) {
|
||||||
dest->len = (LEN)SWAP_HALF_IN_LEN(&dest->len, &src->len);
|
SWAP_HALF_IN_LEN(&dest->len, &src->len);
|
||||||
dest->sign = (BOOL)SWAP_HALF_IN_BOOL(&dest->sign, &src->sign);
|
SWAP_HALF_IN_BOOL(&dest->sign, &src->sign);
|
||||||
} else {
|
} else {
|
||||||
dest->len = src->len;
|
dest->len = src->len;
|
||||||
dest->sign = src->sign;
|
dest->sign = src->sign;
|
||||||
@@ -576,7 +579,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
|
||||||
@@ -620,7 +623,7 @@ swap_HALF_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all)
|
|||||||
* swap or copy the rest of the NUMBER elements
|
* swap or copy the rest of the NUMBER elements
|
||||||
*/
|
*/
|
||||||
if (all) {
|
if (all) {
|
||||||
dest->links = (long)SWAP_HALF_IN_LONG(&dest->links,&src->links);
|
SWAP_HALF_IN_LONG(&dest->links, &src->links);
|
||||||
} else {
|
} else {
|
||||||
dest->links = src->links;
|
dest->links = src->links;
|
||||||
}
|
}
|
||||||
@@ -640,7 +643,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
|
||||||
@@ -684,7 +687,7 @@ swap_HALF_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all)
|
|||||||
* swap or copy the rest of the NUMBER elements
|
* swap or copy the rest of the NUMBER elements
|
||||||
*/
|
*/
|
||||||
if (all) {
|
if (all) {
|
||||||
dest->links = (long)SWAP_HALF_IN_LONG(&dest->links,&src->links);
|
SWAP_HALF_IN_LONG(&dest->links, &src->links);
|
||||||
} else {
|
} else {
|
||||||
dest->links = src->links;
|
dest->links = src->links;
|
||||||
}
|
}
|
||||||
|
154
cal/Makefile
154
cal/Makefile
@@ -2,7 +2,15 @@
|
|||||||
#
|
#
|
||||||
# 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
|
||||||
|
#
|
||||||
|
# SRC: cal/Makefile
|
||||||
|
#
|
||||||
|
# The "# SRC: ... - ..." comment line above indicates
|
||||||
|
# the origin of this file.
|
||||||
|
#
|
||||||
|
# IMPORTANT: Please see the section on Makefiles near the
|
||||||
|
# bottom of the HOWTO.INSTALL file.
|
||||||
#
|
#
|
||||||
# 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,15 +35,64 @@
|
|||||||
# 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
|
||||||
|
|
||||||
# required vars
|
|
||||||
|
# The shell used by this Makefile
|
||||||
|
#
|
||||||
|
# On some systems, /bin/sh is a rather reduced shell with
|
||||||
|
# deprecated behavior.
|
||||||
|
#
|
||||||
|
# If your system has a up to date, bash shell, then
|
||||||
|
# you may wish to use:
|
||||||
|
#
|
||||||
|
# SHELL= /bin/bash
|
||||||
|
#
|
||||||
|
# On some systems such as macOS, the bash shell is very
|
||||||
|
# far behind to the point where is cannot be depended on.
|
||||||
|
# On such systems, the zsh may be a much better alternative
|
||||||
|
# shell for this Makefile to use:
|
||||||
|
#
|
||||||
|
# SHELL= /bin/zsh
|
||||||
#
|
#
|
||||||
SHELL= /bin/sh
|
SHELL= /bin/sh
|
||||||
|
#SHELL= /bin/bash
|
||||||
|
#SHELL= /bin/zsh
|
||||||
|
|
||||||
|
|
||||||
####
|
####
|
||||||
# Normally, the upper level makefile will set these values. We provide
|
# Normally, the upper level makefile will set these values. We provide
|
||||||
# a default here just in case you want to build from this directory.
|
# a default here just in case you want to build from this directory.
|
||||||
####
|
####
|
||||||
|
|
||||||
|
# PREFIX - Top level location for calc
|
||||||
|
#
|
||||||
|
# The PREFIX is often prepended to paths within calc and calc Makefiles.
|
||||||
|
#
|
||||||
|
# Starting with calc v2.13.0.1, nearly all Makefile places that used
|
||||||
|
# /usr/local now use ${PREFIX}. An exception is the olduninstall rule
|
||||||
|
# and, of course, this section. :-)
|
||||||
|
#
|
||||||
|
# NOTE: The ${PREFIX} is not the same as ${T}. The ${T} specifies
|
||||||
|
# a top level directory under which calc installs things.
|
||||||
|
# While usually ${T} is empty, it can be specific path
|
||||||
|
# as if calc where "chrooted" during an install.
|
||||||
|
# The ${PREFIX} value, during install, is a path between
|
||||||
|
# the top level ${T} install directory and the object
|
||||||
|
# such as an include file.
|
||||||
|
#
|
||||||
|
# NOTE: See also, ${T}, below.
|
||||||
|
#
|
||||||
|
# There are some paths that do NOT call under ${PREFIX}, such as
|
||||||
|
# ${CALCPATH}, that include paths not under ${PREFIX}, but those
|
||||||
|
# too are exceptions to this general rule.
|
||||||
|
#
|
||||||
|
# When in doubt, try:
|
||||||
|
#
|
||||||
|
# PREFIX= /usr/local
|
||||||
|
#
|
||||||
|
PREFIX= /usr/local
|
||||||
|
#PREFIX= /usr
|
||||||
|
#PREFIX= /usr/global
|
||||||
|
|
||||||
# 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
|
||||||
@@ -65,11 +122,11 @@ TOP_MAKE_FILE= Makefile
|
|||||||
# INCDIR= /usr/include
|
# INCDIR= /usr/include
|
||||||
#
|
#
|
||||||
|
|
||||||
#INCDIR= /usr/local/include
|
#INCDIR= ${PREFIX}/include
|
||||||
#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
|
||||||
@@ -91,15 +148,15 @@ INCDIR= /usr/include
|
|||||||
# LIBDIR= /usr/lib
|
# LIBDIR= /usr/lib
|
||||||
# CALC_SHAREDIR= /usr/share/calc
|
# CALC_SHAREDIR= /usr/share/calc
|
||||||
#
|
#
|
||||||
#BINDIR= /usr/local/bin
|
#BINDIR= ${PREFIX}/bin
|
||||||
#BINDIR= /dev/env/DJDIR/bin
|
#BINDIR= /dev/env/DJDIR/bin
|
||||||
BINDIR= /usr/bin
|
BINDIR= /usr/bin
|
||||||
|
|
||||||
#LIBDIR= /usr/local/lib
|
#LIBDIR= ${PREFIX}/lib
|
||||||
#LIBDIR= /dev/env/DJDIR/lib
|
#LIBDIR= /dev/env/DJDIR/lib
|
||||||
LIBDIR= /usr/lib
|
LIBDIR= /usr/lib
|
||||||
|
|
||||||
#CALC_SHAREDIR= /usr/local/lib/calc
|
#CALC_SHAREDIR= ${PREFIX}/lib/calc
|
||||||
#CALC_SHAREDIR= /dev/env/DJDIR/share/calc
|
#CALC_SHAREDIR= /dev/env/DJDIR/share/calc
|
||||||
CALC_SHAREDIR= /usr/share/calc
|
CALC_SHAREDIR= /usr/share/calc
|
||||||
|
|
||||||
@@ -157,47 +214,70 @@ T=
|
|||||||
|
|
||||||
# Makefile debug
|
# Makefile debug
|
||||||
#
|
#
|
||||||
# Q=@ do not echo internal makefile actions (quiet mode)
|
# Q=@ do not echo internal Makefile actions (quiet mode)
|
||||||
# Q= echo internal makefile actions (debug / verbose mode)
|
# Q= echo internal Makefile actions (debug / verbose mode)
|
||||||
|
#
|
||||||
|
# H=@: do not report hsrc file formation progress
|
||||||
|
# H=@ do echo hsrc file formation progress
|
||||||
|
#
|
||||||
|
# S= >/dev/null 2>&1 slience ${CC} output during hsrc file formation
|
||||||
|
# S= full ${CC} output during hsrc file formation
|
||||||
|
#
|
||||||
|
# E= 2>/dev/null slience command stderr during hsrc file formation
|
||||||
|
# E= full command stderr during hsrc file formation
|
||||||
|
#
|
||||||
|
# V=@: do not echo debug statements (quiet mode)
|
||||||
|
# V=@ do echo debug statements (debug / verbose mode)
|
||||||
#
|
#
|
||||||
#Q=
|
#Q=
|
||||||
Q=@
|
Q=@
|
||||||
|
#
|
||||||
|
S= >/dev/null 2>&1
|
||||||
|
#S=
|
||||||
|
#
|
||||||
|
E= 2>/dev/null
|
||||||
|
#E=
|
||||||
|
#
|
||||||
|
#H=@:
|
||||||
|
H=@
|
||||||
|
#
|
||||||
|
V=@:
|
||||||
|
#V=@
|
||||||
|
|
||||||
# standard tools
|
# standard tools
|
||||||
#
|
#
|
||||||
CHMOD= chmod
|
CHMOD= chmod
|
||||||
CMP= cmp
|
CMP= cmp
|
||||||
RM= rm
|
|
||||||
MKDIR= mkdir
|
|
||||||
RMDIR= rmdir
|
|
||||||
CP= cp
|
|
||||||
MV= mv
|
|
||||||
CO= co
|
CO= co
|
||||||
TRUE= true
|
CP= cp
|
||||||
TOUCH= touch
|
FMT= fmt
|
||||||
|
MKDIR= mkdir
|
||||||
|
MV= mv
|
||||||
|
RM= rm
|
||||||
|
RMDIR= rmdir
|
||||||
SED= sed
|
SED= sed
|
||||||
SORT= sort
|
SORT= sort
|
||||||
FMT= fmt
|
TOUCH= touch
|
||||||
|
TRUE= true
|
||||||
|
|
||||||
# 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.
|
||||||
# deailed 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 \
|
||||||
constants.cal deg.cal dms.cal dotest.cal ellip.cal factorial.cal \
|
constants.cal deg.cal dms.cal dotest.cal ellip.cal factorial.cal \
|
||||||
factorial2.cal gvec.cal hello.cal hms.cal infinities.cal \
|
factorial2.cal gvec.cal hello.cal hms.cal infinities.cal intfile.cal \
|
||||||
intfile.cal intnum.cal lambertw.cal linear.cal lnseries.cal \
|
intnum.cal lambertw.cal linear.cal lnseries.cal lucas.cal \
|
||||||
lucas.cal lucas_chk.cal mersenne.cal mfactor.cal \
|
lucas_chk.cal mersenne.cal mfactor.cal mod.cal natnumset.cal \
|
||||||
mod.cal natnumset.cal pell.cal pi.cal pix.cal pollard.cal poly.cal \
|
palindrome.cal pell.cal pi.cal pix.cal pollard.cal poly.cal prompt.cal \
|
||||||
prompt.cal psqrt.cal qtime.cal quat.cal randbitrun.cal randmprime.cal \
|
psqrt.cal qtime.cal quat.cal randbitrun.cal randmprime.cal \
|
||||||
randombitrun.cal randomrun.cal randrun.cal regress.cal repeat.cal \
|
randombitrun.cal randomrun.cal randrun.cal regress.cal repeat.cal \
|
||||||
screen.cal seedrandom.cal set8700.cal set8700.line smallfactors.cal \
|
screen.cal seedrandom.cal set8700.cal set8700.line smallfactors.cal \
|
||||||
solve.cal specialfunctions.cal statistics.cal strings.cal sumsq.cal \
|
solve.cal specialfunctions.cal statistics.cal strings.cal sumsq.cal \
|
||||||
@@ -236,7 +316,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*
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
|
|
||||||
@@ -261,19 +341,13 @@ calcliblist:
|
|||||||
#
|
#
|
||||||
calc_files_list:
|
calc_files_list:
|
||||||
${Q} -(find . -mindepth 1 -maxdepth 1 -type f -name '*.cal' -print | \
|
${Q} -(find . -mindepth 1 -maxdepth 1 -type f -name '*.cal' -print | \
|
||||||
while read i; do \
|
while read i; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
echo $$i; \
|
||||||
if [ ! -f RCS/$$i,v ]; then \
|
done; \
|
||||||
echo "WARNING: $$i not under RCS control" 1>&2; \
|
echo '--first_line--'; \
|
||||||
else \
|
echo README; \
|
||||||
echo $$i; \
|
echo set8700.line; \
|
||||||
fi; \
|
echo bindings) | \
|
||||||
fi; \
|
|
||||||
done; \
|
|
||||||
echo '--first_line--'; \
|
|
||||||
echo README; \
|
|
||||||
echo set8700.line; \
|
|
||||||
echo bindings) | \
|
|
||||||
${SED} -e 's:^\./::' | LANG=C ${SORT} | ${FMT} -70 | \
|
${SED} -e 's:^\./::' | LANG=C ${SORT} | ${FMT} -70 | \
|
||||||
${SED} -e '1s/--first_line--/CALC_FILES=/' -e '2,$$s/^/ /' \
|
${SED} -e '1s/--first_line--/CALC_FILES=/' -e '2,$$s/^/ /' \
|
||||||
-e 's/$$/ \\/' -e '$$s/ \\$$//'
|
-e 's/$$/ \\/' -e '$$s/ \\$$//'
|
||||||
@@ -391,7 +465,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
|
||||||
|
111
cal/README
111
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,
|
||||||
@@ -223,7 +186,7 @@ bernoulli.cal
|
|||||||
Calculate the nth Bernoulli number.
|
Calculate the nth Bernoulli number.
|
||||||
|
|
||||||
NOTE: There is now a bernoulli() builtin function. This file is
|
NOTE: There is now a bernoulli() builtin function. This file is
|
||||||
left here for backward compatibility and now simply returns
|
left here for backward compatibility and now simply returns
|
||||||
the builtin function.
|
the builtin function.
|
||||||
|
|
||||||
|
|
||||||
@@ -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.
|
||||||
|
|
||||||
@@ -804,7 +767,7 @@ lucas.cal
|
|||||||
prove that h*2^n-1 is prime or not prime.
|
prove that h*2^n-1 is prime or not prime.
|
||||||
|
|
||||||
NOTE: Some call this term u(0). The function gen_u0(h, n, v1)
|
NOTE: Some call this term u(0). The function gen_u0(h, n, v1)
|
||||||
simply calls gen_u2(h, n, v1) for such people. :-)
|
simply calls gen_u2(h, n, v1) for such people. :-)
|
||||||
|
|
||||||
gen_v1(h, v)
|
gen_v1(h, v)
|
||||||
|
|
||||||
@@ -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.
|
||||||
|
|
||||||
@@ -916,6 +879,38 @@ natnumset.cal
|
|||||||
user-specified bound.
|
user-specified bound.
|
||||||
|
|
||||||
|
|
||||||
|
palindrome.cal
|
||||||
|
|
||||||
|
digitof(val,place)
|
||||||
|
copalplace(d,place)
|
||||||
|
upperhalf(val)
|
||||||
|
mkpal(val)
|
||||||
|
mkpalmiddigit(val,digit)
|
||||||
|
ispal(val)
|
||||||
|
nextpal(val)
|
||||||
|
prevpal(val)
|
||||||
|
nextprimepal(val)
|
||||||
|
prevprimepal(val)
|
||||||
|
|
||||||
|
Functions to form and manipulate palendromes in base 10.
|
||||||
|
|
||||||
|
Important functions are:
|
||||||
|
|
||||||
|
Find the next / previous palindrome:
|
||||||
|
|
||||||
|
nextpal(val)
|
||||||
|
prevpal(val)
|
||||||
|
|
||||||
|
Test if a value is a palindrome:
|
||||||
|
|
||||||
|
ispal(val)
|
||||||
|
|
||||||
|
Find the next / previous palindrome that is a (highly probable) prime:
|
||||||
|
|
||||||
|
nextprimepal(val)
|
||||||
|
prevprimepal(val)
|
||||||
|
|
||||||
|
|
||||||
pell.cal
|
pell.cal
|
||||||
|
|
||||||
pellx(D)
|
pellx(D)
|
||||||
@@ -1354,7 +1349,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 +1366,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 +1385,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,9 +1465,9 @@ 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);
|
||||||
|
|
||||||
|
|
||||||
surd.cal
|
surd.cal
|
||||||
@@ -1816,7 +1811,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -473,7 +474,7 @@ define best_mul2()
|
|||||||
*/
|
*/
|
||||||
while (low+1 < high) {
|
while (low+1 < high) {
|
||||||
|
|
||||||
/* try the mid-point */
|
/* try the mid-point */
|
||||||
mid = int((low+high)/2);
|
mid = int((low+high)/2);
|
||||||
if (config("user_debug") > 0) {
|
if (config("user_debug") > 0) {
|
||||||
printf("testing multiply alg1/alg2 ratio for len = %d\n", mid);
|
printf("testing multiply alg1/alg2 ratio for len = %d\n", mid);
|
||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -954,7 +956,7 @@ define best_sq2()
|
|||||||
*/
|
*/
|
||||||
while (low+1 < high) {
|
while (low+1 < high) {
|
||||||
|
|
||||||
/* try the mid-point */
|
/* try the mid-point */
|
||||||
mid = int((low+high)/2);
|
mid = int((low+high)/2);
|
||||||
if (config("user_debug") > 0) {
|
if (config("user_debug") > 0) {
|
||||||
printf("testing square alg1/alg2 ratio for len = %d\n", mid);
|
printf("testing square alg1/alg2 ratio for len = %d\n", mid);
|
||||||
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1453,7 +1455,7 @@ define best_pow2()
|
|||||||
*/
|
*/
|
||||||
while (low+1 < high) {
|
while (low+1 < high) {
|
||||||
|
|
||||||
/* try the mid-point */
|
/* try the mid-point */
|
||||||
mid = int((low+high)/2);
|
mid = int((low+high)/2);
|
||||||
if (config("user_debug") > 0) {
|
if (config("user_debug") > 0) {
|
||||||
printf("testing pow2 alg1/alg2 ratio for len = %d\n", mid);
|
printf("testing pow2 alg1/alg2 ratio for len = %d\n", mid);
|
||||||
@@ -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;
|
||||||
|
14
cal/chi.cal
14
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
|
||||||
@@ -40,7 +40,7 @@ define Z(x, eps_term)
|
|||||||
|
|
||||||
/* obtain the error term */
|
/* obtain the error term */
|
||||||
if (isnull(eps_term)) {
|
if (isnull(eps_term)) {
|
||||||
eps = epsilon();
|
eps = epsilon();
|
||||||
} else {
|
} else {
|
||||||
eps = eps_term;
|
eps = eps_term;
|
||||||
}
|
}
|
||||||
@@ -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.
|
||||||
*
|
*
|
||||||
@@ -81,7 +81,7 @@ define P(x, eps_term)
|
|||||||
|
|
||||||
/* obtain the error term */
|
/* obtain the error term */
|
||||||
if (isnull(eps_term)) {
|
if (isnull(eps_term)) {
|
||||||
eps = epsilon();
|
eps = epsilon();
|
||||||
} else {
|
} else {
|
||||||
eps = eps_term;
|
eps = eps_term;
|
||||||
}
|
}
|
||||||
@@ -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:
|
||||||
|
28
cal/dms.cal
28
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;
|
||||||
@@ -188,7 +188,7 @@ define dms_abs(a)
|
|||||||
|
|
||||||
/* firewall - just absolute value non dms objects */
|
/* firewall - just absolute value non dms objects */
|
||||||
if (! istype(a, ans)) {
|
if (! istype(a, ans)) {
|
||||||
return abs(a);
|
return abs(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* compute degrees */
|
/* compute degrees */
|
||||||
@@ -352,24 +352,8 @@ define fixdms(a)
|
|||||||
quit "attempt to fix a non dms object";
|
quit "attempt to fix a non dms object";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* force minutes to be intergral */
|
/* use builtin d2dms function */
|
||||||
a.min += frac(a.deg) * 60;
|
d2dms(a.deg + a.min/60 + a.sec/3600, a.deg, a.min, a.sec),;
|
||||||
a.deg = int(a.deg);
|
|
||||||
|
|
||||||
/* force degrees to be intergral */
|
|
||||||
a.sec += frac(a.min) * 60;
|
|
||||||
a.min = int(a.min);
|
|
||||||
|
|
||||||
/* carry excess seconds into minutes */
|
|
||||||
a.min += a.sec // 60;
|
|
||||||
a.sec %= 60;
|
|
||||||
|
|
||||||
/* carry excess minutes into degrees */
|
|
||||||
a.deg += a.min // 60;
|
|
||||||
a.min %= 60;
|
|
||||||
|
|
||||||
/* round degrees :-) */
|
|
||||||
a.deg %= 360;
|
|
||||||
|
|
||||||
/* return normalized result */
|
/* return normalized result */
|
||||||
return a;
|
return a;
|
||||||
|
@@ -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,
|
||||||
@@ -157,7 +157,7 @@ define dotest(dotest_file, dotest_code = 0, dotest_maxcond = -1)
|
|||||||
* test the close of the line file
|
* test the close of the line file
|
||||||
*/
|
*/
|
||||||
printf("%d-: detected %d error condition(s), many of which may be OK\n",
|
printf("%d-: detected %d error condition(s), many of which may be OK\n",
|
||||||
dotest_code, dotest_old_errcount-dotest_errcnt);
|
dotest_code, dotest_old_errcount-dotest_errcnt);
|
||||||
printf("%d-: closing line file: %d\n", dotest_code, dotest_file);
|
printf("%d-: closing line file: %d\n", dotest_code, dotest_file);
|
||||||
fclose(dotest_f_file);
|
fclose(dotest_f_file);
|
||||||
|
|
||||||
@@ -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
|
||||||
@@ -56,7 +56,7 @@ define __CZ__factor_factorial(n,start){
|
|||||||
if(start){
|
if(start){
|
||||||
if(!isint(start) && start < 0 && start > n)
|
if(!isint(start) && start < 0 && start > n)
|
||||||
return newerror("__CZ__factor_factorial(n,start): value of "
|
return newerror("__CZ__factor_factorial(n,start): value of "
|
||||||
"parameter 'start' out of range");
|
"parameter 'start' out of range");
|
||||||
if(start == n && isprime(n)){
|
if(start == n && isprime(n)){
|
||||||
prime_list = mat[1 , 2];
|
prime_list = mat[1 , 2];
|
||||||
prime_list[0,0] = n;
|
prime_list[0,0] = n;
|
||||||
@@ -64,7 +64,7 @@ define __CZ__factor_factorial(n,start){
|
|||||||
}
|
}
|
||||||
else if(!isprime(start) && nextprime(start) >n)
|
else if(!isprime(start) && nextprime(start) >n)
|
||||||
return newerror("__CZ__factor_factorial(n,start): value of parameter "
|
return newerror("__CZ__factor_factorial(n,start): value of parameter "
|
||||||
"'start' out of range");
|
"'start' out of range");
|
||||||
else{
|
else{
|
||||||
if(!isprime(start)) prime = nextprime(start);
|
if(!isprime(start)) prime = nextprime(start);
|
||||||
else prime = start;
|
else prime = start;
|
||||||
@@ -225,11 +225,11 @@ define __CZ__multiply_factored_factorial(matrix,stop){
|
|||||||
|
|
||||||
if(!ismat(matrix))
|
if(!ismat(matrix))
|
||||||
return newerror("__CZ__multiply_factored_factorial(matrix): "
|
return newerror("__CZ__multiply_factored_factorial(matrix): "
|
||||||
"argument matrix not a matrix ");
|
"argument matrix not a matrix ");
|
||||||
if(!matrix[0,0])
|
if(!matrix[0,0])
|
||||||
return
|
return
|
||||||
newerror("__CZ__multiply_factored_factorial(matrix): "
|
newerror("__CZ__multiply_factored_factorial(matrix): "
|
||||||
"matrix[0,0] is null/0");
|
"matrix[0,0] is null/0");
|
||||||
|
|
||||||
if(!isnull(stop))
|
if(!isnull(stop))
|
||||||
pix = stop;
|
pix = stop;
|
||||||
@@ -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.
|
||||||
*/
|
*/
|
||||||
@@ -376,7 +376,7 @@ define bigcatalan(n){
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
df(-111) = -1/3472059605858239446587523014902616804783337112829102414124928
|
df(-111) = -1/3472059605858239446587523014902616804783337112829102414124928
|
||||||
7753332469144201839599609375
|
7753332469144201839599609375
|
||||||
|
|
||||||
df(-3+1i) = 0.12532538977287649201-0.0502372106177184607i
|
df(-3+1i) = 0.12532538977287649201-0.0502372106177184607i
|
||||||
df(2n + 1) = (2*n)!/(n!*2^n)
|
df(2n + 1) = (2*n)!/(n!*2^n)
|
||||||
@@ -427,7 +427,7 @@ define doublefactorial(n){
|
|||||||
*/
|
*/
|
||||||
eps=epsilon(epsilon()*1e-2);
|
eps=epsilon(epsilon()*1e-2);
|
||||||
ret = 2^(n/2-1/4 * cos(pi()* n)+1/4) * pi()^(1/4 *
|
ret = 2^(n/2-1/4 * cos(pi()* n)+1/4) * pi()^(1/4 *
|
||||||
cos(pi()* n)-1/4)* gamma(n/2+1);
|
cos(pi()* n)-1/4)* gamma(n/2+1);
|
||||||
epsilon(eps);
|
epsilon(eps);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
|
28
cal/hms.cal
28
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;
|
||||||
@@ -188,7 +188,7 @@ define hms_abs(a)
|
|||||||
|
|
||||||
/* firewall - just absolute value non hms objects */
|
/* firewall - just absolute value non hms objects */
|
||||||
if (! istype(a, ans)) {
|
if (! istype(a, ans)) {
|
||||||
return abs(a);
|
return abs(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* compute hours */
|
/* compute hours */
|
||||||
@@ -352,24 +352,8 @@ define fixhms(a)
|
|||||||
quit "attempt to fix a non hms object";
|
quit "attempt to fix a non hms object";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* force minutes to be intergral */
|
/* use builtin h2hms function */
|
||||||
a.min += frac(a.hour) * 60;
|
h2hms(a.hour + a.min/60 + a.sec/3600, a.hour, a.min, a.sec),;
|
||||||
a.hour = int(a.hour);
|
|
||||||
|
|
||||||
/* force hours to be intergral */
|
|
||||||
a.sec += frac(a.min) * 60;
|
|
||||||
a.min = int(a.min);
|
|
||||||
|
|
||||||
/* carry excess seconds into minutes */
|
|
||||||
a.min += a.sec // 60;
|
|
||||||
a.sec %= 60;
|
|
||||||
|
|
||||||
/* carry excess minutes into hours */
|
|
||||||
a.hour += a.min // 60;
|
|
||||||
a.min %= 60;
|
|
||||||
|
|
||||||
/* round hours by day */
|
|
||||||
a.hour %= 24;
|
|
||||||
|
|
||||||
/* return normalized result */
|
/* return normalized result */
|
||||||
return a;
|
return a;
|
||||||
|
@@ -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
|
||||||
@@ -156,7 +156,7 @@ define be2file(v, filename)
|
|||||||
*/
|
*/
|
||||||
octlen = int((highbit(v)+8) / 8);
|
octlen = int((highbit(v)+8) / 8);
|
||||||
for (i=octlen-1; i >= 0; --i) {
|
for (i=octlen-1; i >= 0; --i) {
|
||||||
fputc(fd, char(v >> (i*8)));
|
fputc(fd, char(v >> (i*8)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -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,2018 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
|
||||||
@@ -731,7 +731,7 @@ rodseth_xhn(x, h, n)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for jacobi(x-2, h*2^n-1) == 1 (Ref4, condition 1) part 1
|
* Check for jacobi(x-2, h*2^n-1) == 1 (Ref4, condition 1) part 1
|
||||||
*/
|
*/
|
||||||
testval = h*2^n-1;
|
testval = h*2^n-1;
|
||||||
@@ -739,7 +739,7 @@ rodseth_xhn(x, h, n)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for jacobi(x+2, h*2^n-1) == -1 (Ref4, condition 1) part 2
|
* Check for jacobi(x+2, h*2^n-1) == -1 (Ref4, condition 1) part 2
|
||||||
*/
|
*/
|
||||||
if (jacobi(x+2, testval) != -1) {
|
if (jacobi(x+2, testval) != -1) {
|
||||||
@@ -947,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:
|
||||||
@@ -961,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.
|
||||||
*
|
*
|
||||||
@@ -1049,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.
|
||||||
*
|
*
|
||||||
***
|
***
|
||||||
*
|
*
|
||||||
@@ -1234,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) {
|
||||||
@@ -1285,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
|
||||||
*
|
*
|
||||||
|
641
cal/palindrome.cal
Normal file
641
cal/palindrome.cal
Normal file
@@ -0,0 +1,641 @@
|
|||||||
|
/*
|
||||||
|
* palindrome - palindrome utilities
|
||||||
|
*
|
||||||
|
* 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/11/06 14:35:37
|
||||||
|
* File existed as early as: 2021
|
||||||
|
*
|
||||||
|
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* digitof - return the a digit of a value
|
||||||
|
*
|
||||||
|
* NOTE: We assume base 10 digits and place 1 is the units digit.
|
||||||
|
*
|
||||||
|
* given:
|
||||||
|
* val value to find a digit of
|
||||||
|
* place digit place
|
||||||
|
*
|
||||||
|
* returns:
|
||||||
|
* value (>= 0 and < 10) that is the place-th digit of val
|
||||||
|
* or 0 if place is not a digit of val
|
||||||
|
*/
|
||||||
|
define digitof(val, place)
|
||||||
|
{
|
||||||
|
local d; /* length of val in digits */
|
||||||
|
|
||||||
|
/* determine length */
|
||||||
|
d = digits(val);
|
||||||
|
|
||||||
|
/* firewall - return 0 if digit place doesn't exist */
|
||||||
|
if (place < 1 || place > d) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* return the place-th digit of val as a single digit */
|
||||||
|
return (val // (10^(place-1))) % 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* copalplace - determine the other place in a palindrome
|
||||||
|
*
|
||||||
|
* NOTE: We assume base 10 digits and place 1 is the units digit.
|
||||||
|
*
|
||||||
|
* given:
|
||||||
|
* d digits of a value
|
||||||
|
* place digit place
|
||||||
|
*
|
||||||
|
* returns:
|
||||||
|
* given palindrome val, the other digit paired with place
|
||||||
|
* or 0 if place is not a digit of val
|
||||||
|
*/
|
||||||
|
define copalplace(d, place)
|
||||||
|
{
|
||||||
|
/* firewall - return 0 if digit place doesn't exist */
|
||||||
|
if (d < 1 || place < 1 || place > d) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* return digit coplace */
|
||||||
|
return d+1 - place;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* upperhalf - return the upper half of a palindrome
|
||||||
|
*
|
||||||
|
* NOTE: We assume base 10 digits and place 1 is the units digit.
|
||||||
|
*
|
||||||
|
* NOTE: When the value has an odd number of digits, the upper half
|
||||||
|
* includes the middle digit.
|
||||||
|
*
|
||||||
|
* given:
|
||||||
|
* val a value
|
||||||
|
*
|
||||||
|
* returns:
|
||||||
|
* the upper half digits of a value
|
||||||
|
*/
|
||||||
|
define upperhalf(val)
|
||||||
|
{
|
||||||
|
local d; /* length of val in digits */
|
||||||
|
local halfd; /* length of upper hand of val */
|
||||||
|
|
||||||
|
/* determine length */
|
||||||
|
d = digits(val);
|
||||||
|
halfd = d // 2;
|
||||||
|
|
||||||
|
/* return upper half */
|
||||||
|
return (val // 10^halfd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* mkpal - make a value into a palindrome
|
||||||
|
*
|
||||||
|
* NOTE: We assume base 10 digits and place 1 is the units digit.
|
||||||
|
*
|
||||||
|
* given:
|
||||||
|
* val a value
|
||||||
|
*
|
||||||
|
* returns:
|
||||||
|
* val as a palindrome with lower half being reverse digits of val
|
||||||
|
*/
|
||||||
|
define mkpal(val)
|
||||||
|
{
|
||||||
|
local d; /* length of val in digits */
|
||||||
|
local i; /* counter */
|
||||||
|
local ret; /* palindrome being formed */
|
||||||
|
|
||||||
|
/* determine length */
|
||||||
|
d = digits(val);
|
||||||
|
|
||||||
|
/* insert digits in reverse order at the bottom */
|
||||||
|
ret = val;
|
||||||
|
for (i=0; i < d; ++i) {
|
||||||
|
ret = ret*10 + digit(val, i);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* mkpalmiddigit - make a value into a palindrome with a middle digit
|
||||||
|
*
|
||||||
|
* NOTE: We assume base 10 digits and place 1 is the units digit.
|
||||||
|
*
|
||||||
|
* given:
|
||||||
|
* val a value
|
||||||
|
* digit the digit to put into the middle of the palindrome
|
||||||
|
*
|
||||||
|
* returns:
|
||||||
|
* val as a palindrome with lower half being reverse digits of val
|
||||||
|
* and digit as a middle digit
|
||||||
|
*/
|
||||||
|
define mkpalmiddigit(val, digit)
|
||||||
|
{
|
||||||
|
local d; /* length of val in digits */
|
||||||
|
local i; /* counter */
|
||||||
|
local ret; /* palindrome being formed */
|
||||||
|
|
||||||
|
/* determine length */
|
||||||
|
d = digits(val);
|
||||||
|
|
||||||
|
/* insert digits in reverse order at the bottom */
|
||||||
|
ret = val*10 + digit;
|
||||||
|
for (i=0; i < d; ++i) {
|
||||||
|
ret = ret*10 + digit(val, i);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ispal - determine if a value is a palindrome
|
||||||
|
*
|
||||||
|
* NOTE: We assume base 10 digits and place 1 is the units digit.
|
||||||
|
*
|
||||||
|
* given:
|
||||||
|
* val a value
|
||||||
|
*
|
||||||
|
* returns:
|
||||||
|
* 1 ==> val is a palindrome
|
||||||
|
* 0 ==> val is NOT a palindrome
|
||||||
|
*/
|
||||||
|
define ispal(val)
|
||||||
|
{
|
||||||
|
local half; /* upper half of digits of val */
|
||||||
|
local digit; /* middle digit */
|
||||||
|
|
||||||
|
/* case: val has an even number of digits */
|
||||||
|
if (iseven(digits(val))) {
|
||||||
|
|
||||||
|
/* test palindrome-ness */
|
||||||
|
return (val == mkpal(upperhalf(val)));
|
||||||
|
|
||||||
|
/* case: val can an odd number of digits */
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/* test palindrome-ness */
|
||||||
|
half = upperhalf(val);
|
||||||
|
digit = half % 10;
|
||||||
|
half //= 10;
|
||||||
|
return (val == mkpalmiddigit(half, digit));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* palnextpal - return next palindrome from a known palindrome
|
||||||
|
*
|
||||||
|
* NOTE: We assume base 10 digits and place 1 is the units digit.
|
||||||
|
*
|
||||||
|
* given:
|
||||||
|
* pal a palindrome
|
||||||
|
*
|
||||||
|
* returns:
|
||||||
|
* next palindrome > pal
|
||||||
|
*/
|
||||||
|
define palnextpal(pal)
|
||||||
|
{
|
||||||
|
local paldigits; /* digits in pal */
|
||||||
|
local half; /* upper half of newval */
|
||||||
|
local newhalf; /* half+1 */
|
||||||
|
local newpal; /* new palindrome */
|
||||||
|
|
||||||
|
/* case: negative palindrome */
|
||||||
|
if (pal < 0) {
|
||||||
|
return -(palprevpal(-pal));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* start with upper half
|
||||||
|
*/
|
||||||
|
half = upperhalf(pal);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* prep to find a larger palindrome
|
||||||
|
*/
|
||||||
|
newhalf = half+1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* form palindrome from new upper half
|
||||||
|
*
|
||||||
|
* We need to watch for the corner case where changing the
|
||||||
|
* half changes the number of digits as this will impact
|
||||||
|
* or even/odd number of digits processing.
|
||||||
|
*/
|
||||||
|
paldigits = digits(pal);
|
||||||
|
if (digits(newhalf) == digits(half)) {
|
||||||
|
/* no change in half digits: process as normal */
|
||||||
|
if (iseven(paldigits)) {
|
||||||
|
newpal = mkpal(newhalf);
|
||||||
|
} else {
|
||||||
|
newpal = mkpalmiddigit(newhalf // 10, newhalf % 10);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* change in half digits: process as opposite */
|
||||||
|
if (iseven(paldigits)) {
|
||||||
|
newpal = mkpalmiddigit(newhalf // 10, newhalf % 10);
|
||||||
|
} else {
|
||||||
|
newpal = mkpal(newhalf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* return the new palindrome
|
||||||
|
*/
|
||||||
|
return newpal;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* nextpal - return next palindrome from a value
|
||||||
|
*
|
||||||
|
* NOTE: We assume base 10 digits and place 1 is the units digit.
|
||||||
|
*
|
||||||
|
* given:
|
||||||
|
* val a value
|
||||||
|
*
|
||||||
|
* returns:
|
||||||
|
* next palindrome > val
|
||||||
|
*/
|
||||||
|
define nextpal(val)
|
||||||
|
{
|
||||||
|
local newval; /* val+1 */
|
||||||
|
local newvaldigits; /* digits in newval */
|
||||||
|
local half; /* upper half of newval */
|
||||||
|
local pal; /* palindrome test value */
|
||||||
|
local newpal; /* new palindrome */
|
||||||
|
|
||||||
|
/* case: negative value */
|
||||||
|
if (val < 0) {
|
||||||
|
return -(prevpal(-val));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* start looking from a larger value
|
||||||
|
*/
|
||||||
|
newval = val+1;
|
||||||
|
newvaldigits = digits(newval);
|
||||||
|
|
||||||
|
/* case: single digit palindrome */
|
||||||
|
if (newvaldigits < 2) {
|
||||||
|
return newval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* start with next upper half
|
||||||
|
*/
|
||||||
|
half = upperhalf(newval);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* form palindrome from upper half
|
||||||
|
*
|
||||||
|
* We need to deal with even vs. odd digit counts
|
||||||
|
* when forming a palindrome from a half as the
|
||||||
|
* half may not or may include the middle digit.
|
||||||
|
*/
|
||||||
|
if (iseven(newvaldigits)) {
|
||||||
|
pal = mkpal(half);
|
||||||
|
} else {
|
||||||
|
pal = mkpalmiddigit(half // 10, half % 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* case: we found a larger palindrome, we are done
|
||||||
|
*/
|
||||||
|
if (pal > val) {
|
||||||
|
return pal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* we need to find an even larger palindrome
|
||||||
|
*/
|
||||||
|
newpal = palnextpal(pal);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* return the new palindrome
|
||||||
|
*/
|
||||||
|
return newpal;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* palprevpal - return previous palindrome from a palindrome
|
||||||
|
*
|
||||||
|
* NOTE: We assume base 10 digits and place 1 is the units digit.
|
||||||
|
*
|
||||||
|
* given:
|
||||||
|
* pal a palindrome
|
||||||
|
*
|
||||||
|
* returns:
|
||||||
|
* previous palindrome < pal
|
||||||
|
*/
|
||||||
|
define palprevpal(pal)
|
||||||
|
{
|
||||||
|
local paldigits; /* digits in pal */
|
||||||
|
local half; /* upper half of newval */
|
||||||
|
local newhalf; /* half+1 */
|
||||||
|
local newpal; /* new palindrome */
|
||||||
|
|
||||||
|
/* case: negative value */
|
||||||
|
if (pal < 0) {
|
||||||
|
return -(palnextpal(-pal));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* case: single digit palindrome */
|
||||||
|
if (pal < 10) {
|
||||||
|
newpal = pal-1;
|
||||||
|
return newpal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* case: 10 or 11 */
|
||||||
|
if (pal < 12) {
|
||||||
|
newpal = 9;
|
||||||
|
return newpal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* start with upper half
|
||||||
|
*/
|
||||||
|
half = upperhalf(pal);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* prep to find a smaller palindrome
|
||||||
|
*/
|
||||||
|
newhalf = half-1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* form palindrome from new upper half
|
||||||
|
*
|
||||||
|
* We need to watch for the corner case where changing the
|
||||||
|
* half changes the number of digits as this will impact
|
||||||
|
* or even/odd number of digits processing.
|
||||||
|
*/
|
||||||
|
paldigits = digits(pal);
|
||||||
|
if (digits(newhalf) == digits(half)) {
|
||||||
|
/* no change in half digits: process as normal */
|
||||||
|
if (iseven(paldigits)) {
|
||||||
|
newpal = mkpal(newhalf);
|
||||||
|
} else {
|
||||||
|
newpal = mkpalmiddigit(newhalf // 10, newhalf % 10);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* change in half digits: process as opposite */
|
||||||
|
if (iseven(paldigits)) {
|
||||||
|
newpal = mkpalmiddigit(newhalf // 10, newhalf % 10);
|
||||||
|
} else {
|
||||||
|
newpal = mkpal(newhalf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* return the new palindrome
|
||||||
|
*/
|
||||||
|
return newpal;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* prevpal - return previous palindrome from a value
|
||||||
|
*
|
||||||
|
* NOTE: We assume base 10 digits and place 1 is the units digit.
|
||||||
|
*
|
||||||
|
* given:
|
||||||
|
* val a value
|
||||||
|
*
|
||||||
|
* returns:
|
||||||
|
* previous palindrome < val
|
||||||
|
*/
|
||||||
|
define prevpal(val)
|
||||||
|
{
|
||||||
|
local newval; /* val-1 */
|
||||||
|
local newvaldigits; /* digits in newval */
|
||||||
|
local half; /* upper half of newval */
|
||||||
|
local pal; /* palindrome test value */
|
||||||
|
local newpal; /* new palindrome */
|
||||||
|
|
||||||
|
/* case: negative value */
|
||||||
|
if (val < 0) {
|
||||||
|
return -(nextpal(-val));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* start looking from a smaller value
|
||||||
|
*/
|
||||||
|
newval = val-1;
|
||||||
|
newvaldigits = digits(newval);
|
||||||
|
|
||||||
|
/* case: single digit palindrome */
|
||||||
|
if (newvaldigits < 2) {
|
||||||
|
return newval;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* start with previous upper half
|
||||||
|
*/
|
||||||
|
half = upperhalf(newval);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* form palindrome from upper half
|
||||||
|
*
|
||||||
|
* We need to deal with even vs. odd digit counts
|
||||||
|
* when forming a palindrome from a half as the
|
||||||
|
* half may not or may include the middle digit.
|
||||||
|
*/
|
||||||
|
if (iseven(newvaldigits)) {
|
||||||
|
pal = mkpal(half);
|
||||||
|
} else {
|
||||||
|
pal = mkpalmiddigit(half // 10, half % 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* case: we found a smaller palindrome, we are done
|
||||||
|
*/
|
||||||
|
if (pal < val) {
|
||||||
|
return pal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* we need to find an even smaller palindrome
|
||||||
|
*/
|
||||||
|
newpal = palprevpal(pal);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* return the new palindrome
|
||||||
|
*/
|
||||||
|
return newpal;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* nextprimepal - return next palindrome that is a (highly probable) prime
|
||||||
|
*
|
||||||
|
* NOTE: We assume base 10 digits and place 1 is the units digit.
|
||||||
|
*
|
||||||
|
* given:
|
||||||
|
* val a value
|
||||||
|
*
|
||||||
|
* returns:
|
||||||
|
* next palindrome (highly probable) prime > val
|
||||||
|
*/
|
||||||
|
define nextprimepal(val)
|
||||||
|
{
|
||||||
|
local pal; /* palindrome test value */
|
||||||
|
local dpal; /* digits in pal */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* pre-start under the next palindrome
|
||||||
|
*/
|
||||||
|
pal = nextpal(val-1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* loop until we find a (highly probable) prime or 0
|
||||||
|
*/
|
||||||
|
do {
|
||||||
|
|
||||||
|
/* case: negative values and tiny values */
|
||||||
|
if (pal < 2) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* compute the next palindrome
|
||||||
|
*/
|
||||||
|
pal = palnextpal(pal);
|
||||||
|
dpal = digits(pal);
|
||||||
|
|
||||||
|
/* case: 11 is the only prime palindrome with even digit count */
|
||||||
|
if (pal == 11) {
|
||||||
|
return 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* case: even number of digits and not 11 */
|
||||||
|
if (iseven(dpal)) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Except for 11 (which is handled above already), there are
|
||||||
|
* no prime palindrome with even digits. So we need to
|
||||||
|
* increase the digit count and work with that larger palindrome.
|
||||||
|
*/
|
||||||
|
pal = nextpal(10^dpal);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* case: palindrome is even or ends in 5 */
|
||||||
|
if (iseven(pal % 10) || (pal%10 == 10/2)) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* we need to increase the bottom and top digits
|
||||||
|
* so that we have a chance to be prime
|
||||||
|
*/
|
||||||
|
pal += (1 + 10^(dpal-1));
|
||||||
|
}
|
||||||
|
if (config("resource_debug") & 0x8) {
|
||||||
|
print "DEBUG: nextprimepal:", pal;
|
||||||
|
}
|
||||||
|
} while (ptest(pal) == 0 && pal > 0);
|
||||||
|
|
||||||
|
/* return palindrome that his (highly probable) prime or 0 */
|
||||||
|
return pal;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* prevprimepal - return prev palindrome that is a (highly probable) prime
|
||||||
|
*
|
||||||
|
* NOTE: We assume base 10 digits and place 1 is the units digit.
|
||||||
|
*
|
||||||
|
* given:
|
||||||
|
* val a value
|
||||||
|
*
|
||||||
|
* returns:
|
||||||
|
* prev palindrome (highly probable) prime < val or 0
|
||||||
|
*/
|
||||||
|
define prevprimepal(val)
|
||||||
|
{
|
||||||
|
local pal; /* palindrome test value */
|
||||||
|
local dpal; /* digits in pal */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* pre-start over the previous palindrome
|
||||||
|
*/
|
||||||
|
pal = prevpal(val+1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* loop until we find a (highly probable) prime or 0
|
||||||
|
*/
|
||||||
|
do {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* case: single digit values are always palindromes
|
||||||
|
*/
|
||||||
|
if (val < 10) {
|
||||||
|
/*
|
||||||
|
* The prevcand() call will return 0 if there is no previous prime
|
||||||
|
* such as the case when val < 2.
|
||||||
|
*/
|
||||||
|
return prevcand(pal);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* compute the previous palindrome
|
||||||
|
*/
|
||||||
|
pal = palprevpal(pal);
|
||||||
|
dpal = digits(pal);
|
||||||
|
|
||||||
|
/* case: 11 is the only prime palindrome with even digit count */
|
||||||
|
if (pal == 11) {
|
||||||
|
return 11;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* case: 2 digit palindrome and not 11 */
|
||||||
|
if (dpal == 2) {
|
||||||
|
return 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* case: even number of digits */
|
||||||
|
if (iseven(dpal)) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Except for 11 (which is handled above already), there are
|
||||||
|
* no prime palindrome with even digits. So we need to
|
||||||
|
* decrease the digit count and work with that smaller palindrome.
|
||||||
|
*/
|
||||||
|
pal = prevpal(10^(dpal-1));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* case: palindrome is even or ends in 5 */
|
||||||
|
if (iseven(pal % 10) || (pal%10 == 10/2)) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* we need to decrease the bottom and top digits
|
||||||
|
* so that we have a chance to be prime
|
||||||
|
*/
|
||||||
|
pal -= (1 + 10^(dpal-1));
|
||||||
|
}
|
||||||
|
if (config("resource_debug") & 0x8) {
|
||||||
|
print "DEBUG: prevprimepal:", pal;
|
||||||
|
}
|
||||||
|
} while (ptest(pal) == 0 && pal > 0);
|
||||||
|
|
||||||
|
/* return palindrome that his (highly probable) prime or 0 */
|
||||||
|
return pal;
|
||||||
|
}
|
@@ -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 */
|
||||||
|
|
||||||
|
781
cal/regress.cal
781
cal/regress.cal
@@ -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');
|
||||||
|
|
||||||
@@ -765,7 +775,9 @@ print '016: parsed test_bignums()';
|
|||||||
/*
|
/*
|
||||||
* Test many of the built-in functions.
|
* Test many of the built-in functions.
|
||||||
*
|
*
|
||||||
* See test_functionss() starting at test 9000 for more built-in function tests.
|
* See test_functions() (test 700 - 1238) for other built-in function tests.
|
||||||
|
* See test_functions2() (test 9000 - 9063) for other built-in function tests.
|
||||||
|
* See test_functions3() (test 9100 - 9214) for other built-in function tests.
|
||||||
*/
|
*/
|
||||||
define test_functions()
|
define test_functions()
|
||||||
{
|
{
|
||||||
@@ -1871,96 +1883,298 @@ define test_mode()
|
|||||||
vrfy(tmp == "octal", '1620: tmp == "octal"');
|
vrfy(tmp == "octal", '1620: tmp == "octal"');
|
||||||
vrfy(base() == 2, '1621: base() == 2');
|
vrfy(base() == 2, '1621: base() == 2');
|
||||||
|
|
||||||
tmp = config("mode", "real");
|
tmp = config("mode", "eng");
|
||||||
print '1622: tmp = config("mode", "real")';
|
print '1622: tmp = config("mode", "eng")';
|
||||||
vrfy(tmp == "binary", '1623: tmp == "binary"');
|
vrfy(tmp == "binary", '1623: tmp == "binary"');
|
||||||
|
vrfy(base() == 1000, '1624: base() == 1000');
|
||||||
|
|
||||||
|
tmp = config("mode", "real");
|
||||||
|
print '1625: tmp = config("mode", "real")';
|
||||||
|
vrfy(tmp == "engineering", '1626: tmp == "engineering"');
|
||||||
|
|
||||||
tmp = base(1/3);
|
tmp = base(1/3);
|
||||||
print '1624: tmp = base(1/3)';
|
print '1627: tmp = base(1/3)';
|
||||||
vrfy(config("mode") == "fraction",
|
vrfy(config("mode") == "fraction",
|
||||||
'1625: config("mode") == "fraction"');
|
'1628: config("mode") == "fraction"');
|
||||||
|
|
||||||
tmp = base(-10);
|
tmp = base(-10);
|
||||||
print '1626: tmp = base(-10)';
|
print '1629: tmp = base(-10)';
|
||||||
vrfy(config("mode") == "integer",
|
vrfy(config("mode") == "integer",
|
||||||
'1627: config("mode") == "integer"');
|
'1630: config("mode") == "integer"');
|
||||||
|
|
||||||
tmp = base(10);
|
tmp = base(10);
|
||||||
print '1628: tmp = base(10)';
|
print '1631: tmp = base(10)';
|
||||||
vrfy(config("mode") == "real", '1629: config("mode") == "real"');
|
vrfy(config("mode") == "real", '1632: config("mode") == "real"');
|
||||||
|
|
||||||
tmp = base(1e20);
|
tmp = base(1e20);
|
||||||
print '1630: tmp = base(1e20)';
|
print '1633: tmp = base(1e20)';
|
||||||
vrfy(config("mode") == "scientific",
|
vrfy(config("mode") == "scientific",
|
||||||
'1631: config("mode") == "scientific"');
|
'1634: config("mode") == "scientific"');
|
||||||
|
|
||||||
tmp = base(16);
|
tmp = base(16);
|
||||||
print '1632: tmp = base(16)';
|
print '1635: tmp = base(16)';
|
||||||
vrfy(config("mode") == "hexadecimal", \
|
vrfy(config("mode") == "hexadecimal", \
|
||||||
'1633: config("mode") == "hexadecimal"');
|
'1636: config("mode") == "hexadecimal"');
|
||||||
|
|
||||||
tmp = base(8);
|
tmp = base(8);
|
||||||
print '1634: tmp = base(8)';
|
print '1637: tmp = base(8)';
|
||||||
vrfy(config("mode") == "octal", '1635: config("mode") == "octal"');
|
vrfy(config("mode") == "octal", '1638: config("mode") == "octal"');
|
||||||
|
|
||||||
tmp = base(2);
|
tmp = base(2);
|
||||||
print '1636: tmp = base(2)';
|
print '1639: tmp = base(2)';
|
||||||
vrfy(config("mode") == "binary",'1637: config("mode") == "binary"');
|
vrfy(config("mode") == "binary",'1640: config("mode") == "binary"');
|
||||||
|
|
||||||
|
tmp = base(1000);
|
||||||
|
print '1641: tmp = base(1000)';
|
||||||
|
vrfy(config("mode") == "engineering",
|
||||||
|
'1642: config("mode") == "engineering"');
|
||||||
|
|
||||||
|
tmp = base(1/3);
|
||||||
|
print '1643: tmp = base(1/3)';
|
||||||
|
vrfy(str(0x80000000) == "2147483648", \
|
||||||
|
'1644: str(0x8000000) == \"2147483648\"');
|
||||||
|
vrfy(str(0xffffffff) == "4294967295", \
|
||||||
|
'1645: str(0xffffffff) == \"4294967295\"');
|
||||||
|
vrfy(str(3e9) == "3000000000", \
|
||||||
|
'1646: str(3e9) == \"3000000000\"');
|
||||||
|
vrfy(str(1/3) == "1/3", \
|
||||||
|
'1647: str(1/3) == \"1/3\"');
|
||||||
|
vrfy(str(2e8) == "200000000", \
|
||||||
|
'1648: str(2e8) == \"200000000"');
|
||||||
|
vrfy(str(200e6) == "200000000", \
|
||||||
|
'1649: str(200e6) == \"200000000"');
|
||||||
|
vrfy(str(0b100111) == "39", \
|
||||||
|
'1650: str(0b100111) == \"39"');
|
||||||
|
vrfy(str(07543) == "3939", \
|
||||||
|
'1651: str(07543) == \"3939"');
|
||||||
|
vrfy(str(7543) == "7543", \
|
||||||
|
'1652: str(7543) == \"7543"');
|
||||||
|
|
||||||
tmp = base(8);
|
tmp = base(8);
|
||||||
print '1638: tmp = base(8)';
|
print '1653: tmp = base(8)';
|
||||||
vrfy(str(0x80000000) == "020000000000", \
|
vrfy(str(0x80000000) == "020000000000", \
|
||||||
'1639: str(0x8000000) == \"020000000000\"');
|
'1654: str(0x8000000) == \"020000000000\"');
|
||||||
vrfy(str(0xffffffff) == "037777777777", \
|
vrfy(str(0xffffffff) == "037777777777", \
|
||||||
'1640: str(0xffffffff) == \"037777777777\"');
|
'1655: str(0xffffffff) == \"037777777777\"');
|
||||||
vrfy(str(3e9) == "026264057000", \
|
vrfy(str(3e9) == "026264057000", \
|
||||||
'1641: str(3e9) == \"026264057000\"');
|
'1656: str(3e9) == \"026264057000\"');
|
||||||
|
vrfy(str(1/3) == "1/3", \
|
||||||
|
'1657: str(1/3) == \"1/3\"');
|
||||||
|
vrfy(str(2e8) == "01372741000", \
|
||||||
|
'1658: str(2e8) == \"01372741000"');
|
||||||
|
vrfy(str(200e6) == "01372741000", \
|
||||||
|
'1659: str(200e6) == \"01372741000"');
|
||||||
|
vrfy(str(0b100111) == "047", \
|
||||||
|
'1660: str(0b100111) == \"047"');
|
||||||
|
vrfy(str(07543) == "07543", \
|
||||||
|
'1661: str(07543) == \"07543"');
|
||||||
|
vrfy(str(7543) == "016567", \
|
||||||
|
'1662: str(7543) == \"016567"');
|
||||||
|
|
||||||
tmp = base(16);
|
tmp = base(16);
|
||||||
print '1642: tmp = base(16)';
|
print '1663: tmp = base(16)';
|
||||||
vrfy(str(0x80000000) == "0x80000000", \
|
vrfy(str(0x80000000) == "0x80000000", \
|
||||||
'1643: str(0x8000000) == \"0x80000000\"');
|
'1664: str(0x8000000) == \"0x80000000\"');
|
||||||
vrfy(str(0xffffffff) == "0xffffffff", \
|
vrfy(str(0xffffffff) == "0xffffffff", \
|
||||||
'1644: str(0xffffffff) == \"0xffffffff\"');
|
'1665: str(0xffffffff) == \"0xffffffff\"');
|
||||||
vrfy(str(3e9) == "0xb2d05e00", \
|
vrfy(str(3e9) == "0xb2d05e00", \
|
||||||
'1645: str(3e9) == \"0xb2d05e00\"');
|
'1666: str(3e9) == \"0xb2d05e00\"');
|
||||||
|
vrfy(str(1/3) == "1/3", \
|
||||||
|
'1667: str(1/3) == \"1/3\"');
|
||||||
|
vrfy(str(2e8) == "0xbebc200", \
|
||||||
|
'1668: str(2e8) == \"0xbebc200"');
|
||||||
|
vrfy(str(200e6) == "0xbebc200", \
|
||||||
|
'1669: str(200e6) == \"0xbebc200"');
|
||||||
|
vrfy(str(0b100111) == "0x27", \
|
||||||
|
'1670: str(0b100111) == \"0x27"');
|
||||||
|
vrfy(str(07543) == "0xf63", \
|
||||||
|
'1671: str(07543) == \"0xf63"');
|
||||||
|
vrfy(str(7543) == "0x1d77", \
|
||||||
|
'1672: str(7543) == \"0x1d77"');
|
||||||
|
|
||||||
|
tmp = base(2);
|
||||||
|
print '1673: tmp = base(2)';
|
||||||
|
vrfy(str(0x80000000) == "0b10000000000000000000000000000000", \
|
||||||
|
'1674: str(0x8000000) == \"0b10000000000000000000000000000000\"');
|
||||||
|
vrfy(str(0xffffffff) == "0b11111111111111111111111111111111", \
|
||||||
|
'1675: str(0xffffffff) == \"0b11111111111111111111111111111111\"');
|
||||||
|
vrfy(str(3e9) == "0b10110010110100000101111000000000", \
|
||||||
|
'1676: str(3e9) == \"0b10110010110100000101111000000000\"');
|
||||||
|
vrfy(str(1/3) == "1/0b11", \
|
||||||
|
'1677: str(1/3) == \"1/0b11\"');
|
||||||
|
vrfy(str(2e8) == "0b1011111010111100001000000000", \
|
||||||
|
'1678: str(2e8) == \"0b1011111010111100001000000000"');
|
||||||
|
vrfy(str(200e6) == "0b1011111010111100001000000000", \
|
||||||
|
'1679: str(200e6) == \"0b1011111010111100001000000000"');
|
||||||
|
vrfy(str(0b100111) == "0b100111", \
|
||||||
|
'1680: str(0b100111) == \"0b100111"');
|
||||||
|
vrfy(str(07543) == "0b111101100011", \
|
||||||
|
'1681: str(07543) == \"0b111101100011"');
|
||||||
|
vrfy(str(7543) == "0b1110101110111", \
|
||||||
|
'1682: str(7543) == \"0b1110101110111"');
|
||||||
|
|
||||||
|
tmp = base(1e20);
|
||||||
|
print '1683: tmp = base(1e20)';
|
||||||
|
vrfy(str(0x80000000) == "2.147483648e9", \
|
||||||
|
'1684: str(0x8000000) == \"2.147483648e9\"');
|
||||||
|
vrfy(str(0xffffffff) == "4.294967295e9", \
|
||||||
|
'1685: str(0xffffffff) == \"4.294967295e9\"');
|
||||||
|
vrfy(str(3e9) == "3e9", \
|
||||||
|
'1686: str(3e9) == \"3e9\"');
|
||||||
|
vrfy(str(1/3) == "~3.33333333333333333333e-1", \
|
||||||
|
'1687: str(1/3) == \"~3.33333333333333333333e-1\"');
|
||||||
|
vrfy(str(2e8) == "2e8", \
|
||||||
|
'1688: str(2e8) == \"2e8"');
|
||||||
|
vrfy(str(200e6) == "2e8", \
|
||||||
|
'1689: str(200e6) == \"2e8"');
|
||||||
|
vrfy(str(0b100111) == "3.9e1", \
|
||||||
|
'1690: str(0b100111) == \"3.9e1"');
|
||||||
|
vrfy(str(07543) == "3.939e3", \
|
||||||
|
'1691: str(07543) == \"3.939e3"');
|
||||||
|
vrfy(str(7543) == "7.543e3", \
|
||||||
|
'1692: str(7543) == \"7.543e3"');
|
||||||
|
|
||||||
|
tmp = base(1000);
|
||||||
|
print '1693: tmp = base(1000)';
|
||||||
|
vrfy(str(0x80000000) == "2.147483648e9", \
|
||||||
|
'1694: str(0x8000000) == \"2.147483648e9"');
|
||||||
|
vrfy(str(0xffffffff) == "4.294967295e9", \
|
||||||
|
'1695: str(0xffffffff) == \"4.294967295e9\"');
|
||||||
|
vrfy(str(3e9) == "3e9", \
|
||||||
|
'1696: str(3e9) == \"3e9\"');
|
||||||
|
vrfy(str(1/3) == "~333.33333333333333333333e-3", \
|
||||||
|
'1697: str(1/3) == \"~333.33333333333333333333e-3\"');
|
||||||
|
vrfy(str(2e8) == "200e6", \
|
||||||
|
'1698: str(2e8) == \"200e6"');
|
||||||
|
vrfy(str(200e6) == "200e6", \
|
||||||
|
'1699: str(200e6) == \"200e6"');
|
||||||
|
vrfy(str(0b100111) == "39", \
|
||||||
|
'1700: str(0b100111) == \"39"');
|
||||||
|
vrfy(str(07543) == "3.939e3", \
|
||||||
|
'1701: str(07543) == \"3.939e3"');
|
||||||
|
vrfy(str(7543) == "7.543e3", \
|
||||||
|
'1702: str(7543) == \"7.543e3"');
|
||||||
|
|
||||||
|
tmp = base(-10);
|
||||||
|
print '1703: tmp = base(-10)';
|
||||||
|
vrfy(str(0x80000000) == "2147483648", \
|
||||||
|
'1704: str(0x8000000) == \"2147483648\"');
|
||||||
|
vrfy(str(0xffffffff) == "4294967295", \
|
||||||
|
'1705: str(0xffffffff) == \"4294967295\"');
|
||||||
|
vrfy(str(3e9) == "3000000000", \
|
||||||
|
'1706: str(3e9) == \"3000000000\"');
|
||||||
|
vrfy(str(1/3) == "~0", \
|
||||||
|
'1707: str(1/3) == \"~0\"');
|
||||||
|
vrfy(str(2e8) == "200000000", \
|
||||||
|
'1708: str(2e8) == \"200000000"');
|
||||||
|
vrfy(str(200e6) == "200000000", \
|
||||||
|
'1709: str(200e6) == \"200000000"');
|
||||||
|
vrfy(str(0b100111) == "39", \
|
||||||
|
'1710: str(0b100111) == \"39"');
|
||||||
|
vrfy(str(07543) == "3939", \
|
||||||
|
'1711: str(07543) == \"3939"');
|
||||||
|
vrfy(str(7543) == "7543", \
|
||||||
|
'1712: str(7543) == \"7543"');
|
||||||
|
|
||||||
tmp = base(10);
|
tmp = base(10);
|
||||||
print '1646: tmp = base(10)';
|
print '1713: tmp = base(10)';
|
||||||
vrfy(config("mode") == "real", \
|
|
||||||
'1647: config("mode") == "real"');
|
|
||||||
|
|
||||||
vrfy(str(0x80000000) == "2147483648", \
|
vrfy(str(0x80000000) == "2147483648", \
|
||||||
'1648: str(0x80000000) == \"2147483648\"');
|
'1714: str(0x8000000) == \"2147483648\"');
|
||||||
vrfy(str(0xffffffff) == "4294967295", \
|
vrfy(str(0xffffffff) == "4294967295", \
|
||||||
'1649: str(0xffffffff) == \"4294967295\"');
|
'1715: str(0xffffffff) == \"4294967295\"');
|
||||||
vrfy(str(3e9) == "3000000000", \
|
vrfy(str(3e9) == "3000000000", \
|
||||||
'1650: str(3e9) == \"3000000000\"');
|
'1716: str(3e9) == \"3000000000\"');
|
||||||
|
vrfy(str(1/3) == "~0.33333333333333333333", \
|
||||||
|
'1717: str(1/3) == \"~0.33333333333333333333"');
|
||||||
|
vrfy(str(2e8) == "200000000", \
|
||||||
|
'1718: str(2e8) == \"200000000"');
|
||||||
|
vrfy(str(200e6) == "200000000", \
|
||||||
|
'1719: str(200e6) == \"200000000"');
|
||||||
|
vrfy(str(0b100111) == "39", \
|
||||||
|
'1720: str(0b100111) == \"39"');
|
||||||
|
vrfy(str(07543) == "3939", \
|
||||||
|
'1721: str(07543) == \"3939"');
|
||||||
|
vrfy(str(7543) == "7543", \
|
||||||
|
'1722: str(7543) == \"7543"');
|
||||||
|
|
||||||
/* test base2() functionality */
|
/* test base2() functionality */
|
||||||
vrfy(base2() == 0, '1651: base2() == 0');
|
vrfy(base2() == 0, '1723: base2() == 0');
|
||||||
vrfy(base2(0) == 0, '1652: base2(0) == 0');
|
vrfy(base2(0) == 0, '1724: base2(0) == 0');
|
||||||
vrfy(base2() == 0, '1653: base2() == 0');
|
vrfy(base2() == 0, '1725: base2() == 0');
|
||||||
vrfy(base2(16) == 0, '1654: base2(16) == 0');
|
|
||||||
vrfy(base2() == 16, '1655: base2() == 16');
|
|
||||||
vrfy(str(3e9) == "3000000000 /* 0xb2d05e00 */",
|
|
||||||
'1656: str(3e9) == "3000000000 /* 0xb2d05e00 */"');
|
|
||||||
vrfy(base2(1/3) == 16, '1657: base2(16) == 16');
|
|
||||||
vrfy(str(23209) == "23209 /* 23209 */",
|
|
||||||
'1658: str(23209) == "23209 /* 23209 */"');
|
|
||||||
vrfy(str(3/2) == "1.5 /* 3/2 */",
|
|
||||||
'1659: str(3/2) == "1.5 /* 3/2 */"');
|
|
||||||
vrfy(base() == 10, '1660: base() == 10');
|
|
||||||
vrfy(base2(0) == 1/3, '1661: base2(0) == 1/3');
|
|
||||||
|
|
||||||
print '1662: Ending mode/base test';
|
vrfy(base2(16) == 0, '1726: base2(16) == 0');
|
||||||
|
vrfy(base2() == 16, '1727: base2() == 16');
|
||||||
|
vrfy(str(3e9) == "3000000000 /* 0xb2d05e00 */",
|
||||||
|
'1728: str(3e9) == "3000000000 /* 0xb2d05e00 */"');
|
||||||
|
|
||||||
|
vrfy(base2(1/3) == 16, '1728: base2(16) == 16');
|
||||||
|
vrfy(base2() == 1/3, '1729: base2() == 1/3');
|
||||||
|
vrfy(str(23209) == "23209 /* 23209 */",
|
||||||
|
'1730: str(23209) == "23209 /* 23209 */"');
|
||||||
|
vrfy(str(3/2) == "1.5 /* 3/2 */",
|
||||||
|
'1731: str(3/2) == "1.5 /* 3/2 */"');
|
||||||
|
|
||||||
|
vrfy(base2(8) == 1/3, '1732: base2(8) == 1/3');
|
||||||
|
vrfy(base2() == 8, '1733: base2() == 8');
|
||||||
|
vrfy(str(23209) == "23209 /* 055251 */",
|
||||||
|
'1734: str(23209) == "23209 /* 055251 */"');
|
||||||
|
vrfy(str(3/2) == "1.5 /* 3/2 */",
|
||||||
|
'1735: str(3/2) == "1.5 /* 3/2 */"');
|
||||||
|
|
||||||
|
vrfy(base2(2) == 8, '1736: base2(2) == 8');
|
||||||
|
vrfy(base2() == 2, '1737: base2() == 2');
|
||||||
|
vrfy(str(23209) == "23209 /* 0b101101010101001 */",
|
||||||
|
'1738: str(23209) == "23209 /* 0b101101010101001 */"');
|
||||||
|
vrfy(str(3/2) == "1.5 /* 0b11/0b10 */",
|
||||||
|
'1739: str(3/2) == "1.5 /* 0b11/0b10 */"');
|
||||||
|
|
||||||
|
vrfy(base2(1e20) == 2, '1740: base2(1e20) == 2');
|
||||||
|
vrfy(base2() == 1e20, '1741: base2() == 1e20');
|
||||||
|
vrfy(str(23209) == "23209 /* 2.3209e4 */",
|
||||||
|
'1742: str(23209) == "23209 /* 2.3209e4 */"');
|
||||||
|
vrfy(str(3/2) == "1.5 /* 1.5 */",
|
||||||
|
'1743: str(3/2) == "1.5 /* 1.5 */"');
|
||||||
|
|
||||||
|
vrfy(base2(-10) == 1e20, '1744: base2(-10) == 1e20');
|
||||||
|
vrfy(base2() == -10, '1745: base2() == -10');
|
||||||
|
vrfy(str(23209) == "23209 /* 23209 */",
|
||||||
|
'1746: str(23209) == "23209 /* 23209 */"');
|
||||||
|
vrfy(str(3/2) == "1.5 /* ~2 */",
|
||||||
|
'1747: str(3/2) == "1.5 /* ~2 */"');
|
||||||
|
|
||||||
|
vrfy(base2(1000) == -10, '1748: base2(1000) == -1000');
|
||||||
|
vrfy(base2() == 1000, '1749: base2() == 1000');
|
||||||
|
vrfy(str(23209) == "23209 /* 23.209e3 */",
|
||||||
|
'1750: str(23209) == "23209 /* 23.209e3 */"');
|
||||||
|
vrfy(str(3/2) == "1.5 /* 1.5 */",
|
||||||
|
'1751: str(3/2) == "1.5 /* 1.5 */"');
|
||||||
|
|
||||||
|
vrfy(base2(10) == 1000, '1752: base2(10) == 1000');
|
||||||
|
vrfy(base2() == 10, '1753: base2() == 10');
|
||||||
|
vrfy(str(23209) == "23209 /* 23209 */",
|
||||||
|
'1754: str(23209) == "23209 /* 23209 */"');
|
||||||
|
vrfy(str(3/2) == "1.5 /* 1.5 */",
|
||||||
|
'1755: str(3/2) == "1.5 /* 1.5 */"');
|
||||||
|
|
||||||
|
vrfy(base2(0) == 10, '1756: base2(0) == 10');
|
||||||
|
vrfy(base2() == 0, '1757: base2() == 0');
|
||||||
|
vrfy(str(23209) == "23209",
|
||||||
|
'1758: str(23209) == "23209"');
|
||||||
|
vrfy(str(3/2) == "1.5",
|
||||||
|
'1759: str(3/2) == "1.5"');
|
||||||
|
|
||||||
|
vrfy(base() == 10, '1760: base() == 10');
|
||||||
|
vrfy(base2() == 0, '1761: base2() == 0');
|
||||||
|
|
||||||
|
print '1762: Ending mode/base test';
|
||||||
}
|
}
|
||||||
print '026: parsed test_mode()';
|
print '026: parsed test_mode()';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The 1700's contain tests for reading resource files. These tests are
|
* The 1780's and 1790's contain tests for reading resource files.
|
||||||
* done inline near the bottom.
|
*
|
||||||
|
* These tests are done inline near the bottom.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -3156,7 +3370,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';
|
||||||
@@ -3188,9 +3402,11 @@ define test_trig()
|
|||||||
|
|
||||||
print '3400: Beginning test_trig';
|
print '3400: Beginning test_trig';
|
||||||
|
|
||||||
|
/* test 3401-3407 */
|
||||||
tnum = test3400(1, 3401);
|
tnum = test3400(1, 3401);
|
||||||
|
vrfy(tnum == 3407, '3407: tnum == 3407');
|
||||||
|
|
||||||
print tnum: ': Ending test_trig';
|
print '3438: Ending test_trig';
|
||||||
}
|
}
|
||||||
print '051: parsed test_trig()';
|
print '051: parsed test_trig()';
|
||||||
|
|
||||||
@@ -3473,7 +3689,7 @@ print '065: parsed test_param()';
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* test_noarg - test missing argment functionality
|
* test_noarg - test missing argument functionality
|
||||||
*/
|
*/
|
||||||
define test_noarg()
|
define test_noarg()
|
||||||
{
|
{
|
||||||
@@ -5183,7 +5399,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';
|
||||||
@@ -5261,7 +5477,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}';
|
||||||
@@ -5381,7 +5597,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 */
|
||||||
@@ -5398,7 +5614,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 */
|
||||||
@@ -7482,7 +7698,7 @@ print '190: parsed test_somenew()';
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* test_exponentiation - test new exponentiation functionaltiy
|
* test_exponentiation - test new exponentiation functionality
|
||||||
*/
|
*/
|
||||||
define test_exponentiation()
|
define test_exponentiation()
|
||||||
{
|
{
|
||||||
@@ -7573,7 +7789,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()';
|
||||||
|
|
||||||
@@ -7625,31 +7841,31 @@ print;
|
|||||||
return test_mode();
|
return test_mode();
|
||||||
print;
|
print;
|
||||||
|
|
||||||
print '1700: Beginning read test';
|
print '1780: Beginning read test';
|
||||||
value = 0;
|
value = 0;
|
||||||
vrfy(value == 0, '1701: value == 0');
|
vrfy(value == 0, '1781: value == 0');
|
||||||
read "test1700";
|
read "test1700";
|
||||||
print '1702: read "test1700";';
|
print '1782: read "test1700";';
|
||||||
vrfy(value == 1, '1703: value == 1');
|
vrfy(value == 1, '1783: value == 1');
|
||||||
read -once "test1700";
|
read -once "test1700";
|
||||||
print '1704: read -once "test1700";';
|
print '1784: read -once "test1700";';
|
||||||
vrfy(value == 1, '1705: value == 1');
|
vrfy(value == 1, '1785: value == 1');
|
||||||
read "test1700.cal";
|
read "test1700.cal";
|
||||||
print '1706: read "test1700.cal";';
|
print '1786: read "test1700.cal";';
|
||||||
vrfy(value == 2, '1707: value == 2');
|
vrfy(value == 2, '1787: value == 2');
|
||||||
read -once "test1700.cal";
|
read -once "test1700.cal"
|
||||||
print '1708: read -once "test1700.cal";';
|
print '1788: read -once "test1700.cal";';
|
||||||
vrfy(value == 2, '1709: value == 2');
|
vrfy(value == 2, '1789: value == 2');
|
||||||
read "test1700.cal";
|
read "test1700.cal";
|
||||||
print '1710: read "test1700.cal";';
|
print '1790: read "test1700.cal";';
|
||||||
vrfy(value == 3, '1711: value == 3');
|
vrfy(value == 3, '1791: value == 3');
|
||||||
{++value;} read "test1700.cal";
|
{++value;} read "test1700.cal";
|
||||||
print '1712: {++value;} read "test1700.cal";';
|
print '1792: {++value;} read "test1700.cal";';
|
||||||
vrfy(value == 5, '1713: value == 5');
|
vrfy(value == 5, '1793: value == 5');
|
||||||
{++value;} read -once "test1700.cal";
|
{++value;} read -once "test1700.cal";
|
||||||
print '1714: {++value;} read -once "test1700.cal";';
|
print '1794: {++value;} read -once "test1700.cal";';
|
||||||
vrfy(value == 6, '1715: value == 6');
|
vrfy(value == 6, '1795: value == 6');
|
||||||
print '1716: Ending read test';
|
print '1796: Ending read test';
|
||||||
|
|
||||||
print;
|
print;
|
||||||
return test_obj();
|
return test_obj();
|
||||||
@@ -7874,7 +8090,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'
|
||||||
@@ -7900,7 +8116,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';
|
||||||
@@ -7928,7 +8144,7 @@ vrfy(dotest("set8700.line", 8703) == 0,
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* new exponentiation functionaltiy
|
* new exponentiation functionality
|
||||||
*/
|
*/
|
||||||
print;
|
print;
|
||||||
return test_exponentiation();
|
return test_exponentiation();
|
||||||
@@ -7953,6 +8169,8 @@ ecnt = 211;
|
|||||||
* Test more of the built-in functions.
|
* Test more of the built-in functions.
|
||||||
*
|
*
|
||||||
* See test_functions() (test 700 - 1238) for other built-in function tests.
|
* See test_functions() (test 700 - 1238) for other built-in function tests.
|
||||||
|
* See test_functions2() (test 9000 - 9063) for other built-in function tests.
|
||||||
|
* See test_functions3() (test 9100 - 9214) for other built-in function tests.
|
||||||
*/
|
*/
|
||||||
define test_functions2()
|
define test_functions2()
|
||||||
{
|
{
|
||||||
@@ -8066,6 +8284,401 @@ print;
|
|||||||
return test_functions2();
|
return test_functions2();
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test even more of the built-in functions.
|
||||||
|
*
|
||||||
|
* See test_functions() (test 700 - 1238) for other built-in function tests.
|
||||||
|
* See test_functions2() (test 9000 - 9063) for other built-in function tests.
|
||||||
|
* See test_functions3() (test 9100 - 9214) for other built-in function tests.
|
||||||
|
*/
|
||||||
|
define test_functions3()
|
||||||
|
{
|
||||||
|
local d, m, s, g, h;
|
||||||
|
|
||||||
|
print '9101: Beginning test_functions3';
|
||||||
|
|
||||||
|
/* d2r & r2d */
|
||||||
|
vrfy(d2r(180) == pi(),
|
||||||
|
'9102: d2r(180) == pi()');
|
||||||
|
vrfy(d2r(180, 1e-100) == pi(1e-100),
|
||||||
|
'9103: d2r(180, 1e-100) == pi(1e-100)');
|
||||||
|
vrfy(r2d(pi()/2) == 90,
|
||||||
|
'9104: r2d(pi()/2) == 90');
|
||||||
|
vrfy(r2d(pi(1e-15)/2) == 14137166941154068500000/157079632679489661923,
|
||||||
|
'9105: r2d(pi(1e-15)/2) == ' +
|
||||||
|
'14137166941154068500000/157079632679489661923');
|
||||||
|
vrfy(r2d(d2r(40)) == 40,
|
||||||
|
'9106: r2d(d2r(40)) == 40');
|
||||||
|
vrfy(r2d(d2r(40,1e-90),1e-90) == 40,
|
||||||
|
'9107: r2d(d2r(40,1e-90),1e-90) == 40');
|
||||||
|
vrfy(d2r(180i) == 1i*pi(),
|
||||||
|
'9108: d2r(1808) == 1i*pi()');
|
||||||
|
vrfy(d2r(180i+90) == 1i*pi() + pi()/2,
|
||||||
|
'9109: d2r(180i+90) == 1i*pi() + pi()/2');
|
||||||
|
vrfy(r2d(d2r(40+40i)) == 40+40i,
|
||||||
|
'9110: r2d(d2r(40+40i)) == 40+40i');
|
||||||
|
vrfy(r2d(d2r(40+40i,1e-60),1e-60) == 40+40i,
|
||||||
|
'9111: r2d(d2r(40+40i,1e-60),1e-60) == 40+40i');
|
||||||
|
|
||||||
|
/* g2r & r2g */
|
||||||
|
vrfy(g2r(200) == pi(),
|
||||||
|
'9112: g2r(200) == pi()');
|
||||||
|
vrfy(g2r(200, 1e-100) == pi(1e-100),
|
||||||
|
'9113: g2r(180, 1e-100) == pi(1e-100)');
|
||||||
|
vrfy(r2g(pi()/2) == 100,
|
||||||
|
'9114: r2g(pi()/2) == 100');
|
||||||
|
vrfy(r2g(pi(1e-15)/2) == 15707963267948965000000/157079632679489661923,
|
||||||
|
'9115: r2g(pi(1e-15)/2) == ' +
|
||||||
|
'15707963267948965000000/157079632679489661923');
|
||||||
|
vrfy(r2g(g2r(40)) == 40,
|
||||||
|
'9116: r2g(g2r(40)) == 40');
|
||||||
|
vrfy(r2g(g2r(40,1e-90),1e-90) == 40,
|
||||||
|
'9117: r2g(g2r(40,1e-90),1e-90) == 40');
|
||||||
|
vrfy(g2r(200i) == 1i*pi(),
|
||||||
|
'9118: g2r(200i) == 1i*pi()');
|
||||||
|
vrfy(g2r(200i+150) == pi()*0.75 + 1i*pi(),
|
||||||
|
'9119: g2r(200i+150) == pi()*0.75 + 1i*pi()');
|
||||||
|
vrfy(r2g(g2r(40+40i)) == 40+40i,
|
||||||
|
'9120: r2g(g2r(40+40i)) == 40+40i');
|
||||||
|
vrfy(r2g(g2r(40+40i,1e-60),1e-60) == 40+40i,
|
||||||
|
'9121: r2g(g2r(40+40i,1e-60),1e-60) == 40+40i');
|
||||||
|
|
||||||
|
/* g2d & d2g */
|
||||||
|
vrfy(g2d(200) == 180,
|
||||||
|
'9122: g2d(200) == 180');
|
||||||
|
vrfy(g2d(200, 1e-100) == 180,
|
||||||
|
'9123: g2d(180, 1e-100) == 180');
|
||||||
|
vrfy(d2g(81) == 90,
|
||||||
|
'9124: d2g(81) == 90');
|
||||||
|
vrfy(d2g(pi(1e-15)/2) == 3141592653589793/1800000000000000,
|
||||||
|
'9125: d2g(pi(1e-15)/2) == 3141592653589793/1800000000000000');
|
||||||
|
vrfy(d2g(g2d(40)) == 40,
|
||||||
|
'9126: d2g(g2d(40)) == 40');
|
||||||
|
vrfy(d2g(g2d(40,1e-90),1e-90) == 40,
|
||||||
|
'9127: d2g(g2d(40,1e-90),1e-90) == 40');
|
||||||
|
vrfy(g2d(200i) == 180i,
|
||||||
|
'9128: g2d(200i) == 180i');
|
||||||
|
vrfy(g2d(200i+47) == 42.3 + 180i,
|
||||||
|
'9129: g2d(200i+47) == 42.3 + 180i');
|
||||||
|
vrfy(d2g(g2d(40+40i)) == 40+40i,
|
||||||
|
'9130: d2g(g2d(40+40i)) == 40+40i');
|
||||||
|
vrfy(d2g(g2d(40+40i,1e-90),1e-90) == 40+40i,
|
||||||
|
'9131: d2g(g2d(40+40i,1e-90),1e-90) == 40+40i');
|
||||||
|
|
||||||
|
/* d2dms */
|
||||||
|
vrfy(d2dms(12.3456,d,m,s) == 12.3456,
|
||||||
|
'9132: d2dms(12.3456,d,m,s) == 12.3456');
|
||||||
|
vrfy(d == 12,
|
||||||
|
'9133: d == 12');
|
||||||
|
vrfy(m == 20,
|
||||||
|
'9133: m == 20');
|
||||||
|
vrfy(s == 44.16,
|
||||||
|
'9134: s == 44.16');
|
||||||
|
|
||||||
|
vrfy(d2dms(1234.5678,d,m,s) == 154.5678,
|
||||||
|
'9135: d2dms(1234.5678,d,m,s) == 154.5678');
|
||||||
|
vrfy(d == 154,
|
||||||
|
'9136: d == 154');
|
||||||
|
vrfy(m == 34,
|
||||||
|
'9137: m == 34');
|
||||||
|
vrfy(s == 4.08,
|
||||||
|
'9138: s == 4.08');
|
||||||
|
|
||||||
|
vrfy(d2dms(-1234.5678,d,m,s) == 205.4322,
|
||||||
|
'9139: d2dms(-1234.5678,d,m,s) == 205.4322');
|
||||||
|
vrfy(d == 205,
|
||||||
|
'9140: d == 205');
|
||||||
|
vrfy(m == 25,
|
||||||
|
'9141: m == 25');
|
||||||
|
vrfy(s == 55.92,
|
||||||
|
'9142: s == 55.92');
|
||||||
|
|
||||||
|
vrfy(d2dms(360.321,d,m,s,1) == -359.679,
|
||||||
|
'9143: d2dms(360.321,d,m,s,1) == -359.679');
|
||||||
|
vrfy(d == -359,
|
||||||
|
'9144: d == -359');
|
||||||
|
vrfy(m == -40,
|
||||||
|
'9145: m == -40');
|
||||||
|
vrfy(s == -44.4,
|
||||||
|
'9146: s == -44.4');
|
||||||
|
|
||||||
|
/* d2dm */
|
||||||
|
vrfy(d2dm(12.3456,d,m) == 12.3456,
|
||||||
|
'9147: d2dm(12.3456,d,m) == 12.3456');
|
||||||
|
vrfy(d == 12,
|
||||||
|
'9148: d == 12');
|
||||||
|
vrfy(m == 20.736,
|
||||||
|
'9149: m == 20.736');
|
||||||
|
|
||||||
|
vrfy(d2dm(1234.5678,d,m) == 154.5678,
|
||||||
|
'9150: d2dm(1234.5678,d,m) == 154.5678');
|
||||||
|
vrfy(d == 154,
|
||||||
|
'9151: d == 154');
|
||||||
|
vrfy(m == 34.068,
|
||||||
|
'9152: m == 34.068');
|
||||||
|
|
||||||
|
vrfy(d2dm(-1234.5678,d,m) == 205.4322,
|
||||||
|
'9153: d2dm(-1234.5678,d,m) == 205.4322');
|
||||||
|
vrfy(d == 205,
|
||||||
|
'9154: d == 205');
|
||||||
|
vrfy(m == 25.932,
|
||||||
|
'9155: m == 25.932');
|
||||||
|
|
||||||
|
vrfy(d2dm(360.321,d,m,1) == -359.679,
|
||||||
|
'9156: d2dm(360.321,d,m,1) == -359.679');
|
||||||
|
vrfy(d == -359,
|
||||||
|
'9167: d == -359');
|
||||||
|
vrfy(m == -40.74,
|
||||||
|
'9158: m == -40.74');
|
||||||
|
|
||||||
|
/* g2gms */
|
||||||
|
vrfy(g2gms(12.3456,g,m,s) == 12.3456,
|
||||||
|
'9159: g2gms(12.3456,g,m,s) == 12.3456');
|
||||||
|
vrfy(g == 12,
|
||||||
|
'9133: g == 12');
|
||||||
|
vrfy(m == 20,
|
||||||
|
'9160: m == 20');
|
||||||
|
vrfy(s == 44.16,
|
||||||
|
'9161: s == 44.16');
|
||||||
|
|
||||||
|
vrfy(g2gms(1234.5678,g,m,s) == 34.5678,
|
||||||
|
'9162: g2gms(1234.5678,g,m,s) == 34.5678');
|
||||||
|
vrfy(g == 34,
|
||||||
|
'9163: g == 34');
|
||||||
|
vrfy(m == 34,
|
||||||
|
'9164: m == 34');
|
||||||
|
vrfy(s == 4.08,
|
||||||
|
'9165: s == 4.08');
|
||||||
|
|
||||||
|
vrfy(g2gms(-1234.5678,g,m,s) == 365.4322,
|
||||||
|
'9166: g2gms(-1234.5678,g,m,s) == 365.4322');
|
||||||
|
vrfy(g == 365,
|
||||||
|
'9167: g == 365');
|
||||||
|
vrfy(m == 25,
|
||||||
|
'9168: m == 25');
|
||||||
|
vrfy(s == 55.92,
|
||||||
|
'9169: s == 55.92');
|
||||||
|
|
||||||
|
vrfy(g2gms(400.321,g,m,s,1) == -399.679,
|
||||||
|
'9170: g2gms(400.321,g,m,s,1) == -399.679');
|
||||||
|
vrfy(g == -399,
|
||||||
|
'9171: g == -399');
|
||||||
|
vrfy(m == -40,
|
||||||
|
'9172: m == -40');
|
||||||
|
vrfy(s == -44.4,
|
||||||
|
'9173: s == -44.4');
|
||||||
|
|
||||||
|
/* g2gm */
|
||||||
|
vrfy(g2gm(12.3456,g,m) == 12.3456,
|
||||||
|
'9174: g2gm(12.3456,g,m) == 12.3456');
|
||||||
|
vrfy(g == 12,
|
||||||
|
'9175: g == 12');
|
||||||
|
vrfy(m == 20.736,
|
||||||
|
'9176: m == 20.736');
|
||||||
|
|
||||||
|
vrfy(g2gm(1234.5678,g,m) == 34.5678,
|
||||||
|
'9177: g2gm(1234.5678,g,m) == 34.5678');
|
||||||
|
vrfy(g == 34,
|
||||||
|
'9178: g == 34');
|
||||||
|
vrfy(m == 34.068,
|
||||||
|
'9179: m == 34.068');
|
||||||
|
|
||||||
|
vrfy(g2gm(-1234.5678,g,m) == 365.4322,
|
||||||
|
'9180: g2gm(-1234.5678,g,m) == 365.4322');
|
||||||
|
vrfy(g == 365,
|
||||||
|
'9181: g == 365');
|
||||||
|
vrfy(m == 25.932,
|
||||||
|
'9182: m == 25.932');
|
||||||
|
|
||||||
|
vrfy(g2gm(400.321,g,m,1) == -399.679,
|
||||||
|
'9183: g2gm(400.321,g,m,1) == -399.679');
|
||||||
|
vrfy(g == -399,
|
||||||
|
'9184: g == -399');
|
||||||
|
vrfy(m == -40.74,
|
||||||
|
'9185: m == -40.74');
|
||||||
|
|
||||||
|
/* h2hms */
|
||||||
|
vrfy(h2hms(12.3456,h,m,s) == 12.3456,
|
||||||
|
'9186: h2hms(12.3456,h,m,s) == 12.3456');
|
||||||
|
vrfy(h == 12,
|
||||||
|
'9187: h == 12');
|
||||||
|
vrfy(m == 20,
|
||||||
|
'9188: m == 20');
|
||||||
|
vrfy(s == 44.16,
|
||||||
|
'9189: s == 44.16');
|
||||||
|
|
||||||
|
vrfy(h2hms(1234.5678,h,m,s) == 10.5678,
|
||||||
|
'9190: h2hms(1234.5678,h,m,s) == 10.5678');
|
||||||
|
vrfy(h == 10,
|
||||||
|
'9191: h == 10');
|
||||||
|
vrfy(m == 34,
|
||||||
|
'9192: m == 34');
|
||||||
|
vrfy(s == 4.08,
|
||||||
|
'9193: s == 4.08');
|
||||||
|
|
||||||
|
vrfy(h2hms(-1234.5678,h,m,s) == 13.4322,
|
||||||
|
'9194: h2hms(-1234.5678,h,m,s) == 13.4322');
|
||||||
|
vrfy(h == 13,
|
||||||
|
'9195: h == 13');
|
||||||
|
vrfy(m == 25,
|
||||||
|
'9196: m == 25');
|
||||||
|
vrfy(s == 55.92,
|
||||||
|
'9197: s == 55.92');
|
||||||
|
|
||||||
|
vrfy(h2hms(24.321,h,m,s,1) == -23.679,
|
||||||
|
'9198: h2hms(24.321,h,m,s,1) == -23.679');
|
||||||
|
vrfy(h == -23,
|
||||||
|
'9199: h == -23');
|
||||||
|
vrfy(m == -40,
|
||||||
|
'9200: m == -40');
|
||||||
|
vrfy(s == -44.4,
|
||||||
|
'9201: s == -44.4');
|
||||||
|
|
||||||
|
/* h2hm */
|
||||||
|
vrfy(h2hm(12.3456,h,m) == 12.3456,
|
||||||
|
'9202: h2hm(12.3456,h,m) == 12.3456');
|
||||||
|
vrfy(h == 12,
|
||||||
|
'9203: h == 12');
|
||||||
|
vrfy(m == 20.736,
|
||||||
|
'9204: m == 20.736');
|
||||||
|
|
||||||
|
vrfy(h2hm(1234.5678,h,m) == 10.5678,
|
||||||
|
'9205: h2hm(1234.5678,h,m) == 10.5678');
|
||||||
|
vrfy(h == 10,
|
||||||
|
'9206: h == 10');
|
||||||
|
vrfy(m == 34.068,
|
||||||
|
'9207: m == 34.068');
|
||||||
|
|
||||||
|
vrfy(h2hm(-1234.5678,h,m) == 13.4322,
|
||||||
|
'9208: h2hm(-1234.5678,h,m) == 13.4322');
|
||||||
|
vrfy(h == 13,
|
||||||
|
'9209: h == 13');
|
||||||
|
vrfy(m == 25.932,
|
||||||
|
'9210: m == 25.932');
|
||||||
|
|
||||||
|
vrfy(h2hm(24.321,h,m,1) == -23.679,
|
||||||
|
'9211: h2hm(24.321,h,m,1) == -23.679');
|
||||||
|
vrfy(h == -23,
|
||||||
|
'9212: h == -23');
|
||||||
|
vrfy(m == -40.74,
|
||||||
|
'9213: m == -40.74');
|
||||||
|
|
||||||
|
/* dm2d */
|
||||||
|
vrfy(dm2d(203, 325.5594) == 208.42599,
|
||||||
|
'9214: dm2d(203, 325.5594) == 208.42599');
|
||||||
|
vrfy(dm2d(3601, -25.5594) == 0.57401,
|
||||||
|
'9215: dm2d(3601, -25.5594) == 0.57401');
|
||||||
|
vrfy(dm2d(-923, -25.5594) == 156.57401,
|
||||||
|
'9216: dm2d(-923, -25.5594) == 156.57401');
|
||||||
|
vrfy(dm2d(203, 325.5594, 1) == -151.57401,
|
||||||
|
'9217: dm2d(203, 325.5594, 1) == -151.57401');
|
||||||
|
|
||||||
|
vrfy(d2dm(dm2d(12, 20.16),d,m) == 12.336,
|
||||||
|
'9218: d2dm(dm2d(12, 20.16),d,m) == 12.336');
|
||||||
|
vrfy(d == 12,
|
||||||
|
'9219: d == 12');
|
||||||
|
vrfy(m == 20.16,
|
||||||
|
'9220: m == 20.16');
|
||||||
|
|
||||||
|
/* dms2d */
|
||||||
|
vrfy(dms2d(12, 20, 44.16) == 12.3456,
|
||||||
|
'9221: dms2d(12, 20, 44.16) == 12.3456');
|
||||||
|
vrfy(dms2d(123.456, -345.68, 4.08) == 117.6958,
|
||||||
|
'9222: dms2d(123.456, -345.68, 4.08) == 117.6958');
|
||||||
|
vrfy(dms2d(-65, -40, -44.4) == 294.321,
|
||||||
|
'9223: dms2d(-65, -40, -44.4) == 294.321');
|
||||||
|
vrfy(dms2d(12, 20, 44.16, 1) == -347.6544,
|
||||||
|
'9224: dms2d(12, 20, 44.16, 1) == -347.6544');
|
||||||
|
|
||||||
|
vrfy(d2dms(dms2d(13, 20, 44.16),d,m,s) == 13.3456,
|
||||||
|
'9225: d2dms(dms2d(13, 20, 44.16),d,m,s) == 13.3456');
|
||||||
|
vrfy(d == 13,
|
||||||
|
'9226: d == 13');
|
||||||
|
vrfy(m == 20,
|
||||||
|
'9227: m == 20');
|
||||||
|
vrfy(s == 44.16,
|
||||||
|
'9228: s == 44.16');
|
||||||
|
|
||||||
|
/* gm2g */
|
||||||
|
vrfy(gm2g(203, 325.5594) == 208.42599,
|
||||||
|
'9229: gm2g(203, 325.5594) == 208.42599');
|
||||||
|
vrfy(gm2g(3601, -25.5594) == 0.57401,
|
||||||
|
'9230: gm2g(3601, -25.5594) == 0.57401');
|
||||||
|
vrfy(gm2g(-923, -25.5594) == 276.57401,
|
||||||
|
'9231: gm2g(-923, -25.5594) == 276.57401');
|
||||||
|
vrfy(gm2g(203, 325.5594, 1) == -191.57401,
|
||||||
|
'9232: gm2g(203, 325.5594, 1) == -191.57401');
|
||||||
|
|
||||||
|
vrfy(g2gm(gm2g(12, 20.16),g,m) == 12.336,
|
||||||
|
'9233: g2gm(gm2g(12, 20.16),g,m) == 12.336');
|
||||||
|
vrfy(g == 12,
|
||||||
|
'9234: g == 12');
|
||||||
|
vrfy(m == 20.16,
|
||||||
|
'9235: m == 20.16');
|
||||||
|
|
||||||
|
/* gms2g */
|
||||||
|
vrfy(gms2g(12, 20, 44.16) == 12.3456,
|
||||||
|
'9236: gms2g(12, 20, 44.16) == 12.3456');
|
||||||
|
vrfy(gms2g(123.456, -345.68, 4.08) == 117.6958,
|
||||||
|
'9237: gms2g(123.456, -345.68, 4.08) == 117.6958');
|
||||||
|
vrfy(gms2g(-65, -40, -44.4) == 334.321,
|
||||||
|
'9238: gms2g(-65, -40, -44.4) == 334.321');
|
||||||
|
vrfy(gms2g(12, 20, 44.16, 1) == -387.6544,
|
||||||
|
'9239: gms2g(12, 20, 44.16, 1) == -387.6544');
|
||||||
|
|
||||||
|
vrfy(g2gms(gms2g(14, 20, 44.16),g,m,s) == 14.3456,
|
||||||
|
'9240: g2gms(gms2g(14, 20, 44.16),g,m,s) == 14.3456');
|
||||||
|
vrfy(g == 14,
|
||||||
|
'9241: g == 14');
|
||||||
|
vrfy(m == 20,
|
||||||
|
'9242: m == 20');
|
||||||
|
vrfy(s == 44.16,
|
||||||
|
'9243: s == 44.16');
|
||||||
|
|
||||||
|
/* hm2h */
|
||||||
|
vrfy(hm2h(203, 325.5594) == 16.42599,
|
||||||
|
'9244: hm2h(203, 325.5594) == 16.42599');
|
||||||
|
vrfy(hm2h(241, -25.5594) == 0.57401,
|
||||||
|
'9245: hm2h(241, -25.5594) == 0.57401');
|
||||||
|
vrfy(hm2h(-923, -25.5594) == 12.57401,
|
||||||
|
'9246: hm2h(-923, -25.5594) == 12.57401');
|
||||||
|
vrfy(hm2h(203, 325.5594, 1) == -7.57401,
|
||||||
|
'9247: hm2h(203, 325.5594, 1) == -7.57401');
|
||||||
|
|
||||||
|
vrfy(h2hm(hm2h(12, 20.16),h,m) == 12.336,
|
||||||
|
'9248: h2hm(hm2h(12, 20.16),h,m) == 12.336');
|
||||||
|
vrfy(h == 12,
|
||||||
|
'9249: h == 12');
|
||||||
|
vrfy(m == 20.16,
|
||||||
|
'9250: m == 20.16');
|
||||||
|
|
||||||
|
/* hms2h */
|
||||||
|
vrfy(hms2h(12, 20, 44.16) == 12.3456,
|
||||||
|
'9251: hms2h(12, 20, 44.16) == 12.3456');
|
||||||
|
vrfy(hms2h(123.456, -345.68, 4.08) == 21.6958,
|
||||||
|
'9252: hms2h(123.456, -345.68, 4.08) == 21.6958');
|
||||||
|
vrfy(hms2h(-65, -40, -44.4) == 6.321,
|
||||||
|
'9253: hms2h(-65, -40, -44.4) == 6.321');
|
||||||
|
vrfy(hms2h(12, 20, 44.16, 1) == -11.6544,
|
||||||
|
'9254: hms2h(12, 20, 44.16, 1) == -11.6544');
|
||||||
|
|
||||||
|
vrfy(h2hms(hms2h(15, 20, 44.16),h,m,s) == 15.3456,
|
||||||
|
'9255: h2hms(hms2h(15, 20, 44.16),h,m,s) == 15.3456');
|
||||||
|
vrfy(h == 15,
|
||||||
|
'9256: h == 15');
|
||||||
|
vrfy(m == 20,
|
||||||
|
'9257: m == 20');
|
||||||
|
vrfy(s == 44.16,
|
||||||
|
'9258: s == 44.16');
|
||||||
|
|
||||||
|
print '9259: Ending test_functions3';
|
||||||
|
}
|
||||||
|
print;
|
||||||
|
print '9100: parsed test_functions3()';
|
||||||
|
print;
|
||||||
|
return test_functions3();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* read various calc resource files
|
* read various calc resource files
|
||||||
*
|
*
|
||||||
@@ -8074,7 +8687,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.
|
||||||
|
|
||||||
@@ -371,7 +371,7 @@ define normalcdf(x,mu,sigma){
|
|||||||
|
|
||||||
define probit(p){
|
define probit(p){
|
||||||
if(p<0 || p > 1) return newerror("probit: p out of domain 0<=p<=1");
|
if(p<0 || p > 1) return newerror("probit: p out of domain 0<=p<=1");
|
||||||
return sqrt(2)*ervinv(2*p-1);
|
return sqrt(2)*erfinv(2*p-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
define normalcdfinv(p,mu,sigma){
|
define normalcdfinv(p,mu,sigma){
|
||||||
|
@@ -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,23 +320,23 @@ 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;
|
||||||
ret = 1;
|
ret = 1;
|
||||||
if(!isint(n) || n<1)
|
if(!isint(n) || n<1)
|
||||||
return newerror("__CZ__produce_long_random_number(n): "
|
return newerror("__CZ__produce_long_random_number(n): "
|
||||||
"n is not an integer >=1");
|
"n is not an integer >=1");
|
||||||
for(k=0;k<n;k++){
|
for(k=0;k<n;k++){
|
||||||
ret += random();
|
ret += random();
|
||||||
ret = toomcook4square(ret);
|
ret = toomcook4square(ret);
|
||||||
|
@@ -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,
|
||||||
@@ -72,13 +72,13 @@ define hurwitzzeta(s,a){
|
|||||||
limit=(precision*ln(10)-re((s-.5)*result)+(1.*realpart_a)*ln(2.*pi()))/2;
|
limit=(precision*ln(10)-re((s-.5)*result)+(1.*realpart_a)*ln(2.*pi()))/2;
|
||||||
limit=max(2,ceil(max(limit,abs(s*1.)/2)));
|
limit=max(2,ceil(max(limit,abs(s*1.)/2)));
|
||||||
limit_function=ceil(sqrt((limit+realpart_a/2-.25)^2+(imagpart_s*1.)^2/4)/
|
limit_function=ceil(sqrt((limit+realpart_a/2-.25)^2+(imagpart_s*1.)^2/4)/
|
||||||
pi());
|
pi());
|
||||||
if (config("user_debug") > 0) {
|
if (config("user_debug") > 0) {
|
||||||
print "limit_function = " limit_function;
|
print "limit_function = " limit_function;
|
||||||
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;
|
||||||
|
90
calc.c
90
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
|
||||||
*
|
*
|
||||||
@@ -25,7 +26,6 @@
|
|||||||
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
@@ -65,6 +65,7 @@
|
|||||||
#include "lib_calc.h"
|
#include "lib_calc.h"
|
||||||
#include "args.h"
|
#include "args.h"
|
||||||
#include "zmath.h"
|
#include "zmath.h"
|
||||||
|
#include "strl.h"
|
||||||
|
|
||||||
#include "have_unistd.h"
|
#include "have_unistd.h"
|
||||||
#if defined(HAVE_UNISTD_H)
|
#if defined(HAVE_UNISTD_H)
|
||||||
@@ -84,6 +85,9 @@
|
|||||||
#include "have_unused.h"
|
#include "have_unused.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* S_FUNC definitions and functions
|
* S_FUNC definitions and functions
|
||||||
*/
|
*/
|
||||||
@@ -119,6 +123,11 @@ main(int argc, char **argv)
|
|||||||
* parse args
|
* parse args
|
||||||
*/
|
*/
|
||||||
program = argv[0];
|
program = argv[0];
|
||||||
|
script_name = strdup(argv[0]);
|
||||||
|
if (script_name == NULL) {
|
||||||
|
fprintf(stderr, "%s: failed to strdup(argv[0])\n", program);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
cmdbuf[0] = '\0';
|
cmdbuf[0] = '\0';
|
||||||
cmdlen = 0;
|
cmdlen = 0;
|
||||||
@@ -372,14 +381,20 @@ main(int argc, char **argv)
|
|||||||
havearg = TRUE;
|
havearg = TRUE;
|
||||||
if (cmdlen > 0)
|
if (cmdlen > 0)
|
||||||
cmdbuf[cmdlen++] = ' ';
|
cmdbuf[cmdlen++] = ' ';
|
||||||
strcpy(cmdbuf + cmdlen, "read ");
|
strlcpy(cmdbuf + cmdlen, "read ",
|
||||||
cmdlen += 5;
|
sizeof("read "));
|
||||||
if (strncmp(cp, "-once", 5) == 0 &&
|
cmdlen += sizeof("read ")-1;
|
||||||
(cp[5] == '\0' || cp[5] == ' ')) {
|
cmdbuf[cmdlen] = '\0';
|
||||||
cp += 5;
|
if (strncmp(cp, "-once",
|
||||||
|
sizeof("-once")) == 0 &&
|
||||||
|
(cp[sizeof("-once")-1] == '\0' ||
|
||||||
|
cp[sizeof("-once")-1] == ' ')) {
|
||||||
|
cp += sizeof("-once")-1;
|
||||||
haveendstr = (*cp == '\0');
|
haveendstr = (*cp == '\0');
|
||||||
strcpy(cmdbuf+cmdlen, "-once ");
|
strlcpy(cmdbuf+cmdlen, "-once ",
|
||||||
cmdlen += 6;
|
sizeof("-once "));
|
||||||
|
cmdlen += sizeof("-once ")-1;
|
||||||
|
cmdbuf[cmdlen] = '\0';
|
||||||
if (nextcp(&cp, &index, argc,
|
if (nextcp(&cp, &index, argc,
|
||||||
argv, haveendstr)) {
|
argv, haveendstr)) {
|
||||||
fprintf(stderr, "-f -once"
|
fprintf(stderr, "-f -once"
|
||||||
@@ -389,23 +404,39 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
bp = cmdbuf + cmdlen;
|
bp = cmdbuf + cmdlen;
|
||||||
|
/*
|
||||||
|
* duplicate -f filename arg
|
||||||
|
* as a new script_name value
|
||||||
|
*/
|
||||||
|
if (script_name != NULL) {
|
||||||
|
free(script_name);
|
||||||
|
}
|
||||||
|
script_name = NULL;
|
||||||
|
script_name = strdup(cp);
|
||||||
|
if (script_name == NULL) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"strdup(-f argument)"
|
||||||
|
"failed\n");
|
||||||
|
exit(17);
|
||||||
|
}
|
||||||
|
/* process -f filename arg */
|
||||||
if (haveendstr) {
|
if (haveendstr) {
|
||||||
len = strlen(cp);
|
len = strlen(cp);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Null"
|
"Null"
|
||||||
" filename!");
|
" filename!\n");
|
||||||
exit(17);
|
exit(18);
|
||||||
}
|
}
|
||||||
if (cmdlen + len + 2 > MAXCMD) {
|
if (cmdlen + len + 2 > MAXCMD) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Commands too"
|
"Commands too"
|
||||||
" long");
|
" long\n");
|
||||||
exit(18);
|
exit(19);
|
||||||
}
|
}
|
||||||
/* XXX What if *cp = '\''? */
|
/* XXX - what if *cp = '\''? */
|
||||||
*bp++ = '\'';
|
*bp++ = '\'';
|
||||||
strncpy(bp, cp, len+1);
|
strlcpy(bp, cp, len+1);
|
||||||
bp += len;
|
bp += len;
|
||||||
*bp++ = '\'';
|
*bp++ = '\'';
|
||||||
cp += len;
|
cp += len;
|
||||||
@@ -413,10 +444,10 @@ main(int argc, char **argv)
|
|||||||
} else {
|
} else {
|
||||||
do {
|
do {
|
||||||
if (cmdlen > MAXCMD) {
|
if (cmdlen > MAXCMD) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Commands"
|
"Commands"
|
||||||
" too long");
|
" too long\n");
|
||||||
exit(19);
|
exit(20);
|
||||||
}
|
}
|
||||||
*bp++ = *cp++;
|
*bp++ = *cp++;
|
||||||
cmdlen++;
|
cmdlen++;
|
||||||
@@ -427,8 +458,12 @@ main(int argc, char **argv)
|
|||||||
if (*cp == ';')
|
if (*cp == ';')
|
||||||
cp++;
|
cp++;
|
||||||
*bp++ = ';';
|
*bp++ = ';';
|
||||||
|
*bp = '\0';
|
||||||
cmdlen++;
|
cmdlen++;
|
||||||
s_flag = TRUE; /* -f implies -s */
|
|
||||||
|
/* -f implies -s */
|
||||||
|
s_flag = TRUE;
|
||||||
|
maxindex = index + 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
@@ -449,9 +484,9 @@ 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(21);
|
||||||
}
|
}
|
||||||
if (havearg)
|
if (havearg)
|
||||||
break;
|
break;
|
||||||
@@ -477,9 +512,10 @@ main(int argc, char **argv)
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"%s: commands too long\n",
|
"%s: commands too long\n",
|
||||||
program);
|
program);
|
||||||
exit(21);
|
exit(22);
|
||||||
}
|
}
|
||||||
strncpy(cmdbuf + cmdlen, cp, cplen+1);
|
strlcpy(cmdbuf + cmdlen, cp, cplen+1);
|
||||||
|
cmdbuf[newcmdlen] = '\0';
|
||||||
cmdlen = newcmdlen;
|
cmdlen = newcmdlen;
|
||||||
index++;
|
index++;
|
||||||
if (index < maxindex)
|
if (index < maxindex)
|
||||||
@@ -499,7 +535,7 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
argc_value = argc - maxindex;
|
argc_value = argc - maxindex + 1;
|
||||||
argv_value = argv + maxindex;
|
argv_value = argv + maxindex;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -746,7 +782,7 @@ main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
S_FUNC void
|
S_FUNC void
|
||||||
intint(int UNUSED arg)
|
intint(int UNUSED(arg))
|
||||||
{
|
{
|
||||||
(void) signal(SIGINT, intint);
|
(void) signal(SIGINT, intint);
|
||||||
if (inputwait || (++abortlevel >= ABORT_NOW)) {
|
if (inputwait || (++abortlevel >= ABORT_NOW)) {
|
||||||
@@ -787,7 +823,7 @@ calc_interrupt(char *fmt, ...)
|
|||||||
* don't call libcalc_call_me_last() -- we might loop
|
* don't call libcalc_call_me_last() -- we might loop
|
||||||
* and besides ... this is an unusual internal error case
|
* and besides ... this is an unusual internal error case
|
||||||
*/
|
*/
|
||||||
exit(22);
|
exit(24);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 */
|
||||||
@@ -213,6 +216,7 @@ EXTERN int havecommands; /* TRUE if have cmd args) */
|
|||||||
EXTERN char *program; /* our name */
|
EXTERN char *program; /* our name */
|
||||||
EXTERN char *base_name; /* basename of our name */
|
EXTERN char *base_name; /* basename of our name */
|
||||||
EXTERN char cmdbuf[]; /* command line expression */
|
EXTERN char cmdbuf[]; /* command line expression */
|
||||||
|
EXTERN char *script_name; /* program name or -f filename arg or NULL */
|
||||||
|
|
||||||
EXTERN int abortlevel; /* current level of aborts */
|
EXTERN int abortlevel; /* current level of aborts */
|
||||||
EXTERN BOOL inputwait; /* TRUE if in a terminal input wait */
|
EXTERN BOOL inputwait; /* TRUE if in a terminal input wait */
|
||||||
@@ -229,8 +233,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 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
527
calc.man
527
calc.man
@@ -1,5 +1,5 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" Copyright (C) 1999-2007,2014,2018 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
|
||||||
@@ -37,6 +37,7 @@ calc \- arbitrary precision calculator
|
|||||||
.RB [ -D\ \&calc_debug[:resource_debug[:user_debug]] ]
|
.RB [ -D\ \&calc_debug[:resource_debug[:user_debug]] ]
|
||||||
.br
|
.br
|
||||||
.RB [ \-e ]
|
.RB [ \-e ]
|
||||||
|
.RB [ \-f\ \&filename ]
|
||||||
.RB [ \-h ]
|
.RB [ \-h ]
|
||||||
.RB [ \-i ]
|
.RB [ \-i ]
|
||||||
.RB [ \-m\ \&mode ]
|
.RB [ \-m\ \&mode ]
|
||||||
@@ -50,11 +51,12 @@ 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\ [optional_other_flags\ \&...] \fB\-f\fP
|
||||||
|
|
||||||
|
.PP
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
\&
|
|
||||||
.br
|
|
||||||
CALC OPTIONS
|
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
@@ -218,43 +220,55 @@ Ignore any environment variables on startup.
|
|||||||
The getenv() builtin will still return values, however.
|
The getenv() builtin will still return values, however.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-f
|
.BR \-f " filename"
|
||||||
|
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, as in:
|
||||||
.sp 1
|
|
||||||
This flag is normally only at the end of a calc shell script.
|
|
||||||
If the first line of an executable file begins
|
|
||||||
.B #!
|
|
||||||
followed by the absolute pathname of the
|
|
||||||
.B calc
|
|
||||||
program and the flag
|
|
||||||
.B \-f
|
|
||||||
as in:
|
|
||||||
.sp 1
|
.sp 1
|
||||||
.in +5n
|
.in +5n
|
||||||
.nf
|
.nf
|
||||||
\fI#!${BINDIR}/calc\fP\ [other_flags\ \&...] \fB\-f\fP
|
\fI#!${BINDIR}/calc\fP\ [optional_other_flags\ \&...] \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" .
|
||||||
|
|
||||||
|
.sp 1
|
||||||
|
A common flag to use, prior to the
|
||||||
|
.B \-f
|
||||||
|
on the #! line is the
|
||||||
|
.B \-q
|
||||||
|
flag.
|
||||||
|
For example:
|
||||||
|
.sp 1
|
||||||
|
.in +5n
|
||||||
|
.nf
|
||||||
|
\fI#!${BINDIR}/calc\fP \fB\-q\fP \fB\-f\fP
|
||||||
|
.fi
|
||||||
|
.in -5n
|
||||||
|
.sp 1
|
||||||
|
This allows the script to run independely of
|
||||||
|
startup scripts.
|
||||||
|
|
||||||
|
.sp 1
|
||||||
See
|
See
|
||||||
.B "SHELL SCRIPT MODE"
|
.B "SHELL SCRIPT MODE"
|
||||||
section of this man page
|
section of this man page
|
||||||
below for details.
|
below for details.
|
||||||
.sp 1
|
.sp 1
|
||||||
The actual form of this flag is:
|
While the actual form of this flag is:
|
||||||
.sp 1
|
.sp 1
|
||||||
.in +5n
|
.in +5n
|
||||||
.B \-f
|
.BR \-f
|
||||||
filename
|
filename
|
||||||
.in -5n
|
.in -5n
|
||||||
.sp 1
|
.sp 1
|
||||||
On systems that treat an executable that begins with
|
for systems that treat an executable that begins with
|
||||||
.B #!
|
.B #!
|
||||||
as a script, the path of the executable is appended by the kernel
|
as a script, the path of the executable is appended by the kernel
|
||||||
as the final argument to the exec() system call.
|
as the final argument to the exec() system call.
|
||||||
@@ -265,12 +279,13 @@ flag at the very end of the
|
|||||||
line.
|
line.
|
||||||
.sp 1
|
.sp 1
|
||||||
It is possible use
|
It is possible use
|
||||||
.B \-f\ filename
|
.B \-f
|
||||||
|
filename
|
||||||
on the command line:
|
on the command line:
|
||||||
.sp 1
|
.sp 1
|
||||||
.in +5n
|
.in +5n
|
||||||
.nf
|
.nf
|
||||||
\fIcalc\fP\ [other_flags\ \&...] \fB\-f\fP filename
|
\fIcalc\fP\ [optional_other_flags\ \&...] \fB\-f\fP filename
|
||||||
.fi
|
.fi
|
||||||
.in -5n
|
.in -5n
|
||||||
.sp 1
|
.sp 1
|
||||||
@@ -278,18 +293,14 @@ This will cause calc to process lines in
|
|||||||
.B filename
|
.B filename
|
||||||
in
|
in
|
||||||
.BR "shell script mode" .
|
.BR "shell script mode" .
|
||||||
|
|
||||||
.sp 1
|
.sp 1
|
||||||
Use of
|
The use of
|
||||||
.B \-f
|
.B \-f
|
||||||
implies
|
filename
|
||||||
.BR \-s .
|
implies the
|
||||||
In addition,
|
.B \-s
|
||||||
.B \-d
|
flag.
|
||||||
and
|
|
||||||
.B \-p
|
|
||||||
are implied if
|
|
||||||
.B \-i
|
|
||||||
is not given.
|
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B \-h
|
.B \-h
|
||||||
@@ -476,16 +487,16 @@ This is useful when entering negative values on the command line as in:
|
|||||||
.in +5n
|
.in +5n
|
||||||
.nf
|
.nf
|
||||||
calc \-p \-\- \-1 - -7
|
calc \-p \-\- \-1 - -7
|
||||||
.sp 1
|
|
||||||
.fi
|
.fi
|
||||||
.in -5n
|
.in -5n
|
||||||
|
.sp 1
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
\&
|
.SH CALC COMMAND LINE
|
||||||
.br
|
|
||||||
CALC COMMAND LINE
|
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
With no
|
With no
|
||||||
.I calc_cmd
|
.I calc_cmd
|
||||||
arguments,
|
arguments,
|
||||||
@@ -623,10 +634,10 @@ to parse interactive commands, flushes data on standard input.
|
|||||||
|
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
\&
|
.SH CALC STARTUP FILES
|
||||||
.br
|
|
||||||
CALC STARTUP FILES
|
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
Normally on startup,
|
Normally on startup,
|
||||||
if the environment variable
|
if the environment variable
|
||||||
.B $CALCRC
|
.B $CALCRC
|
||||||
@@ -663,10 +674,12 @@ files is also disabled as if
|
|||||||
.B \-q
|
.B \-q
|
||||||
was given.
|
was given.
|
||||||
|
|
||||||
\&
|
|
||||||
.br
|
|
||||||
CALC FILE SEARCH PATH
|
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
|
.SH CALC FILE SEARCH PATH
|
||||||
|
|
||||||
|
.PP
|
||||||
|
|
||||||
If the environment variable
|
If the environment variable
|
||||||
.B $CALCPATH
|
.B $CALCPATH
|
||||||
is undefined, or if it
|
is undefined, or if it
|
||||||
@@ -743,36 +756,39 @@ help config
|
|||||||
.fi
|
.fi
|
||||||
.in -5n
|
.in -5n
|
||||||
.sp 1
|
.sp 1
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
\&
|
.SH SHELL SCRIPT MODE
|
||||||
.br
|
|
||||||
SHELL SCRIPT MODE
|
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
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 the first line ends with the flag
|
||||||
.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\ [optional_other_flags\ \&...] \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 "optional_other_flags"
|
||||||
must come before
|
must come before
|
||||||
the
|
the
|
||||||
.BR \-f .
|
.B \-f
|
||||||
|
flag.
|
||||||
.sp 1
|
.sp 1
|
||||||
In
|
In
|
||||||
.B "shell script mode"
|
.B "shell script mode"
|
||||||
@@ -781,7 +797,7 @@ executed as if they were in a file being processed by a read
|
|||||||
command, except that a "command" beginning with '#' followed by
|
command, except that a "command" beginning with '#' followed by
|
||||||
whitespace and ending at the next newline is treated as a comment.
|
whitespace and ending at the next newline is treated as a comment.
|
||||||
Any optional
|
Any optional
|
||||||
.B "other_flags"
|
.B "optional_other_flags"
|
||||||
will be parsed first followed by
|
will be parsed first followed by
|
||||||
the later lines within the script itself.
|
the later lines within the script itself.
|
||||||
.sp 1
|
.sp 1
|
||||||
@@ -804,17 +820,25 @@ the file
|
|||||||
.in +5n
|
.in +5n
|
||||||
.nf
|
.nf
|
||||||
\fI#!${BINDIR}/calc\fP\ \&\fB\-q\fP \fB\-f\fP
|
\fI#!${BINDIR}/calc\fP\ \&\fB\-q\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
|
||||||
@@ -844,9 +868,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.
|
||||||
@@ -854,26 +878,27 @@ 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
|
||||||
will not.
|
will not.
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
\&
|
.SH DATA TYPES
|
||||||
.br
|
|
||||||
DATA TYPES
|
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
Fundamental builtin data types include integers, real numbers,
|
Fundamental builtin data types include integers, real numbers,
|
||||||
rational numbers, complex numbers and strings.
|
rational numbers, complex numbers and strings.
|
||||||
.PP
|
.PP
|
||||||
@@ -896,12 +921,13 @@ help obj
|
|||||||
.br
|
.br
|
||||||
show objfuncs
|
show objfuncs
|
||||||
.in -1.0i
|
.in -1.0i
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
\&
|
.SH VARIABLES
|
||||||
.br
|
|
||||||
VARIABLES
|
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
Variables in \fIcalc\fP are typeless.
|
Variables in \fIcalc\fP are typeless.
|
||||||
In other words, the fundamental type of a variable is determined by its content.
|
In other words, the fundamental type of a variable is determined by its content.
|
||||||
Before a variable is assigned a value it has the value of zero.
|
Before a variable is assigned a value it has the value of zero.
|
||||||
@@ -924,12 +950,13 @@ help list
|
|||||||
.br
|
.br
|
||||||
show globals
|
show globals
|
||||||
.in -1.0i
|
.in -1.0i
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
\&
|
.SH INPUT/OUTPUT
|
||||||
.br
|
|
||||||
INPUT/OUTPUT
|
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
A leading ``0x'' implies a hexadecimal value,
|
A leading ``0x'' implies a hexadecimal value,
|
||||||
a leading ``0b'' implies a binary value,
|
a leading ``0b'' implies a binary value,
|
||||||
and a ``0'' followed by a digit implies an octal value.
|
and a ``0'' followed by a digit implies an octal value.
|
||||||
@@ -959,12 +986,13 @@ command:
|
|||||||
.in 1.0i
|
.in 1.0i
|
||||||
help file
|
help file
|
||||||
.in -1.0i
|
.in -1.0i
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
\&
|
.SH CALC LANGUAGE
|
||||||
.br
|
|
||||||
CALC LANGUAGE
|
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
The \fIcalc\fP language is a C-like language.
|
The \fIcalc\fP language is a C-like language.
|
||||||
The language includes commands such as variable declarations,
|
The language includes commands such as variable declarations,
|
||||||
expressions, tests, labels, loops, file operations, function calls.
|
expressions, tests, labels, loops, file operations, function calls.
|
||||||
@@ -991,10 +1019,13 @@ help operator
|
|||||||
.br
|
.br
|
||||||
help config
|
help config
|
||||||
.in -1.0i
|
.in -1.0i
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
|
|
||||||
.SH FILES
|
.SH FILES
|
||||||
\&
|
|
||||||
.br
|
.PP
|
||||||
|
|
||||||
.PD 0
|
.PD 0
|
||||||
.TP 5
|
.TP 5
|
||||||
${BINDIR}/calc
|
${BINDIR}/calc
|
||||||
@@ -1036,9 +1067,13 @@ custom resource files
|
|||||||
${CUSTOMHELPDIR}/*
|
${CUSTOMHELPDIR}/*
|
||||||
custom help files
|
custom help files
|
||||||
.sp 1
|
.sp 1
|
||||||
|
|
||||||
|
.PP
|
||||||
|
|
||||||
.SH ENVIRONMENT
|
.SH ENVIRONMENT
|
||||||
\&
|
|
||||||
.br
|
.PP
|
||||||
|
|
||||||
.PD 0
|
.PD 0
|
||||||
.TP 5
|
.TP 5
|
||||||
CALCPATH
|
CALCPATH
|
||||||
@@ -1077,16 +1112,40 @@ 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
|
||||||
|
|
||||||
|
.PP
|
||||||
|
|
||||||
.SH CREDIT
|
.SH CREDIT
|
||||||
\&
|
|
||||||
.br
|
.PP
|
||||||
|
|
||||||
The main chunk of
|
The main chunk of
|
||||||
.B calc
|
.B calc
|
||||||
was written by David I. Bell.
|
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
|
||||||
@@ -1108,10 +1167,13 @@ public domain arbitrarily precision routines which was posted
|
|||||||
to the net around 1984.
|
to the net around 1984.
|
||||||
By now, there is almost no recognizable
|
By now, there is almost no recognizable
|
||||||
code left from that original source.
|
code left from that original source.
|
||||||
.sp
|
|
||||||
|
.PP
|
||||||
|
|
||||||
.SH "COPYING / CALC GNU LESSER GENERAL PUBLIC LICENSE"
|
.SH "COPYING / CALC GNU LESSER GENERAL PUBLIC LICENSE"
|
||||||
\&
|
|
||||||
.sp
|
.PP
|
||||||
|
|
||||||
Calc is open software, and is
|
Calc is open software, and is
|
||||||
covered under version 2.1 of the GNU Lesser General Public License.
|
covered under version 2.1 of the GNU Lesser General Public License.
|
||||||
You are
|
You are
|
||||||
@@ -1165,107 +1227,130 @@ 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.
|
||||||
|
|
||||||
|
.PP
|
||||||
|
|
||||||
|
.SH "CALC QUESTIONS"
|
||||||
|
|
||||||
|
.PP
|
||||||
|
|
||||||
|
If you have a simple general question about calc, send Email to:
|
||||||
.sp
|
.sp
|
||||||
.SH "CALC MAILING LIST / CALC UPDATES / ENHANCEMENTS"
|
.in +0.5i
|
||||||
\&
|
calc-quest-mail at asthe dot com
|
||||||
.br
|
|
||||||
.sp
|
.sp
|
||||||
To contribute comments, suggestions, enhancements
|
NOTE: Remove spaces and replace 'at' with @, and 'dot' with .
|
||||||
and interesting
|
.in -0.5i
|
||||||
.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:
|
.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 .
|
.PP
|
||||||
|
|
||||||
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
|
|
||||||
.SH "BUG REPORTS / BUG FIXES"
|
.SH "BUG REPORTS / BUG FIXES"
|
||||||
\&
|
|
||||||
.br
|
.PP
|
||||||
.sp
|
|
||||||
Send bug reports and bug fixes to:
|
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
|
||||||
@@ -1281,9 +1366,143 @@ 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.
|
||||||
|
|
||||||
|
.PP
|
||||||
|
|
||||||
|
.SH "CONTRIBUTING CODE TO CALC"
|
||||||
|
|
||||||
|
.PP
|
||||||
|
|
||||||
|
.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.
|
||||||
|
|
||||||
|
.PP
|
||||||
|
|
||||||
.SH "CALC WEB SITE"
|
.SH "CALC WEB SITE"
|
||||||
\&
|
|
||||||
.br
|
.PP
|
||||||
|
|
||||||
Landon Noll maintains the
|
Landon Noll maintains the
|
||||||
.B calc
|
.B calc
|
||||||
web site is located at:
|
web site is located at:
|
||||||
|
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
|
||||||
|
48
calcerr.tbl
48
calcerr.tbl
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# calcerr - error codes and messages
|
# calcerr - error codes and messages
|
||||||
#
|
#
|
||||||
# Copyright (C) 1999-2006 Ernest Bowen
|
# Copyright (C) 1999-2006,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
|
||||||
@@ -496,3 +496,49 @@ E_ATANH3 Invalid value for calculating atan
|
|||||||
E_ACOTH3 Invalid value for calculating acot
|
E_ACOTH3 Invalid value for calculating acot
|
||||||
E_ASECH3 Invalid value for calculating asec
|
E_ASECH3 Invalid value for calculating asec
|
||||||
E_ACSCH3 Invalid value for calculating acsc
|
E_ACSCH3 Invalid value for calculating acsc
|
||||||
|
E_D2R1 Bad epsilon for converting degrees to radians
|
||||||
|
E_D2R2 Bad first argument converting degrees to radians
|
||||||
|
E_R2D1 Bad epsilon for converting radians to degrees
|
||||||
|
E_R2D2 Bad first argument converting radians to degrees
|
||||||
|
E_G2R1 Bad epsilon for converting gradians to radians
|
||||||
|
E_G2R2 Bad first argument converting gradians to radians
|
||||||
|
E_R2G1 Bad epsilon for converting radians to gradians
|
||||||
|
E_R2G2 Bad first argument converting radians to gradians
|
||||||
|
E_D2G1 Bad first argument converting degrees to gradians
|
||||||
|
E_G2D1 Bad first argument converting gradians to degrees
|
||||||
|
E_D2DMS1 Non-lvalue arguments 2, 3 or 4 for d2dms
|
||||||
|
E_D2DMS2 Non-real-number arg 1 for d2dms
|
||||||
|
E_D2DMS3 No-assign-to argument 2, 3 or 4 for d2dms
|
||||||
|
E_D2DMS4 Invalid rounding arg 5 for d2dms
|
||||||
|
E_D2DM1 Non-lvalue arguments 2 or 3 for d2dm
|
||||||
|
E_D2DM2 Non-real-number arg 1 for d2dm
|
||||||
|
E_D2DM3 No-assign-to argument 2 or 3 for d2dm
|
||||||
|
E_D2DM4 Invalid rounding arg 4 for d2dm
|
||||||
|
E_G2GMS1 Non-lvalue arguments 2, 3 or 4 for g2gms
|
||||||
|
E_G2GMS2 Non-real-number arg 1 for g2gms
|
||||||
|
E_G2GMS3 No-assign-to argument 2 or 3 for g2gms
|
||||||
|
E_G2GMS4 Invalid rounding arg 5 for g2gms
|
||||||
|
E_G2GM1 Non-lvalue arguments 2 or 3 for g2gm
|
||||||
|
E_G2GM2 Non-real-number arg 1 for g2gm
|
||||||
|
E_G2GM3 No-assign-to argument 2, 3 or 4 for g2gm
|
||||||
|
E_G2GM4 Invalid rounding arg 4 for g2gm
|
||||||
|
E_H2HMS1 Non-lvalue arguments 2, 3 or 4 for h2hms
|
||||||
|
E_H2HMS2 Non-real-number arg 1 for h2hms
|
||||||
|
E_H2HMS3 No-assign-to argument 2, 3 or 4 for h2hms
|
||||||
|
E_H2HMS4 Invalid rounding arg 5 for h2hms
|
||||||
|
E_H2HM1 Non-lvalue arguments 2 or 3 for h2hm
|
||||||
|
E_H2HM2 Non-real-number arg 1 for h2hm
|
||||||
|
E_H2HM3 No-assign-to argument 2 or 3 for h2hm
|
||||||
|
E_H2HM4 Invalid rounding arg 4 for h2hm
|
||||||
|
E_DMS2D1 Non-real-number aarguments 1, 2 or 3 for dms2d
|
||||||
|
E_DMS2D2 Invalid rounding arg 4 for dms2d
|
||||||
|
E_DM2D1 Non-real-number aarguments 1 or 2 for dm2d
|
||||||
|
E_DM2D2 Invalid rounding arg 4 for dm2d
|
||||||
|
E_GMS2G1 Non-real-number aarguments 1, 2 or 3 for gms2g
|
||||||
|
E_GMS2G2 Invalid rounding arg 4 for gms2g
|
||||||
|
E_GM2G1 Non-real-number aarguments 1 or 2 for gm2g
|
||||||
|
E_GM2G2 Invalid rounding arg 4 for gm2g
|
||||||
|
E_HMS2H1 Non-real-number aarguments 1, 2 or 3 for hms2h
|
||||||
|
E_HMS2H2 Invalid rounding arg 4 for hms2h
|
||||||
|
E_HM2H1 Non-real-number aarguments 1 or 2 for hm2h
|
||||||
|
E_HM2H2 Invalid rounding arg 4 for hm2h
|
||||||
|
@@ -28,6 +28,8 @@ BEGIN {
|
|||||||
printf("#include <stdio.h>\n");
|
printf("#include <stdio.h>\n");
|
||||||
printf("#include \"calcerr.h\"\n\n");
|
printf("#include \"calcerr.h\"\n\n");
|
||||||
printf("#include \"have_const.h\"\n\n");
|
printf("#include \"have_const.h\"\n\n");
|
||||||
|
printf("#include \"banned.h\"\t");
|
||||||
|
printf("/* include after system header <> includes */\n\n");
|
||||||
printf("/*\n");
|
printf("/*\n");
|
||||||
printf(" * names of calc error values\n");
|
printf(" * names of calc error values\n");
|
||||||
printf(" */\n");
|
printf(" */\n");
|
||||||
|
35
codegen.c
35
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
|
||||||
*
|
*
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include "lib_calc.h"
|
#include "lib_calc.h"
|
||||||
#include "calc.h"
|
#include "calc.h"
|
||||||
|
#include "alloc.h"
|
||||||
#include "token.h"
|
#include "token.h"
|
||||||
#include "symbol.h"
|
#include "symbol.h"
|
||||||
#include "label.h"
|
#include "label.h"
|
||||||
@@ -41,11 +42,16 @@
|
|||||||
#include "str.h"
|
#include "str.h"
|
||||||
#include "func.h"
|
#include "func.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
#include "strl.h"
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
# include <direct.h>
|
# include <direct.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
STATIC BOOL rdonce; /* TRUE => do not reread this file */
|
STATIC BOOL rdonce; /* TRUE => do not reread this file */
|
||||||
|
|
||||||
FUNC *curfunc;
|
FUNC *curfunc;
|
||||||
@@ -144,11 +150,9 @@ getcommands(BOOL toplevel)
|
|||||||
case 1:
|
case 1:
|
||||||
case -1:
|
case -1:
|
||||||
if(i == 1) {
|
if(i == 1) {
|
||||||
strncpy(name,
|
strlcpy(name,
|
||||||
DEFAULTCALCHELP,
|
DEFAULTCALCHELP,
|
||||||
MAXCMD);
|
MAXCMD+1);
|
||||||
/* paranoia */
|
|
||||||
name[MAXCMD] = '\0';
|
|
||||||
givehelp(name);
|
givehelp(name);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1021,7 +1025,7 @@ getstatement(LABEL *contlabel, LABEL *breaklabel,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
reread();
|
reread();
|
||||||
/* fall into default case */
|
/*FALLTHRU*/
|
||||||
|
|
||||||
default:
|
default:
|
||||||
rescantoken();
|
rescantoken();
|
||||||
@@ -1384,6 +1388,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 +1399,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 +2217,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 +2255,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 +2284,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;
|
||||||
@@ -2350,8 +2358,7 @@ getfilename(char *name, size_t namelen, BOOL *once)
|
|||||||
|
|
||||||
/* use the value of the literal string */
|
/* use the value of the literal string */
|
||||||
s = findstring(tokenstring());
|
s = findstring(tokenstring());
|
||||||
strncpy(name, s->s_str, namelen-1);
|
strlcpy(name, s->s_str, namelen);
|
||||||
name[namelen-1] = '\0';
|
|
||||||
sfree(s);
|
sfree(s);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -2388,8 +2395,7 @@ getfilename(char *name, size_t namelen, BOOL *once)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* return symbol name or value of global var string */
|
/* return symbol name or value of global var string */
|
||||||
strncpy(name, symstr, namelen-1);
|
strlcpy(name, symstr, namelen);
|
||||||
name[namelen-1] = '\0';
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_NEWLINE:
|
case T_NEWLINE:
|
||||||
@@ -2427,7 +2433,7 @@ getshowstatement(void)
|
|||||||
|
|
||||||
switch (gettoken()) {
|
switch (gettoken()) {
|
||||||
case T_SYMBOL:
|
case T_SYMBOL:
|
||||||
strncpy(name, tokensymbol(), 4);
|
strlcpy(name, tokensymbol(), sizeof(name));
|
||||||
name[4] = '\0';
|
name[4] = '\0';
|
||||||
/* Yuck! */
|
/* Yuck! */
|
||||||
arg = stringindex("buil\000"
|
arg = stringindex("buil\000"
|
||||||
@@ -2591,8 +2597,7 @@ getid(char *buf)
|
|||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
strncpy(buf, tokensymbol(), SYMBOLSIZE);
|
strlcpy(buf, tokensymbol(), SYMBOLSIZE+1);
|
||||||
buf[SYMBOLSIZE] = '\0';
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2603,7 +2608,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)
|
||||||
|
12
comfunc.c
12
comfunc.c
@@ -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
|
||||||
*
|
*
|
||||||
@@ -29,6 +29,10 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "cmath.h"
|
#include "cmath.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* cache the natural logarithm of 10
|
* cache the natural logarithm of 10
|
||||||
*/
|
*/
|
||||||
@@ -553,7 +557,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 +1186,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 +1196,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');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* commath - extended precision complex arithmetic primitive routines
|
* commath - extended precision complex arithmetic primitive routines
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007 David I. Bell
|
* Copyright (C) 1999-2007,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
|
||||||
@@ -27,6 +27,9 @@
|
|||||||
#include "cmath.h"
|
#include "cmath.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
COMPLEX _czero_ = { &_qzero_, &_qzero_, 1 };
|
COMPLEX _czero_ = { &_qzero_, &_qzero_, 1 };
|
||||||
COMPLEX _cone_ = { &_qone_, &_qzero_, 1 };
|
COMPLEX _cone_ = { &_qone_, &_qzero_, 1 };
|
||||||
COMPLEX _conei_ = { &_qzero_, &_qone_, 1 };
|
COMPLEX _conei_ = { &_qzero_, &_qone_, 1 };
|
||||||
|
24
config.c
24
config.c
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* config - configuration routines
|
* config - configuration routines
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007 David I. Bell and Landon Curt Noll
|
* Copyright (C) 1999-2007,2021 David I. Bell and Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Primary author: David I. Bell
|
* Primary author: David I. Bell
|
||||||
*
|
*
|
||||||
@@ -46,6 +46,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "calc.h"
|
#include "calc.h"
|
||||||
|
#include "alloc.h"
|
||||||
#include "token.h"
|
#include "token.h"
|
||||||
#include "zrand.h"
|
#include "zrand.h"
|
||||||
#include "block.h"
|
#include "block.h"
|
||||||
@@ -53,12 +54,17 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "str.h"
|
#include "str.h"
|
||||||
#include "custom.h"
|
#include "custom.h"
|
||||||
|
#include "strl.h"
|
||||||
|
|
||||||
#include "have_strdup.h"
|
#include "have_strdup.h"
|
||||||
#if !defined(HAVE_STRDUP)
|
#if !defined(HAVE_STRDUP)
|
||||||
# define strdup(x) calc_strdup((CONST char *)(x))
|
# define strdup(x) calc_strdup((CONST char *)(x))
|
||||||
#endif /* HAVE_STRDUP */
|
#endif /* HAVE_STRDUP */
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* deal with systems that lack a defined CLK_TCK
|
* deal with systems that lack a defined CLK_TCK
|
||||||
*/
|
*/
|
||||||
@@ -268,6 +274,8 @@ STATIC NAMETYPE modes[] = {
|
|||||||
{"scientific", MODE_EXP},
|
{"scientific", MODE_EXP},
|
||||||
{"sci", MODE_EXP},
|
{"sci", MODE_EXP},
|
||||||
{"exp", MODE_EXP},
|
{"exp", MODE_EXP},
|
||||||
|
{"engineering", MODE_ENG},
|
||||||
|
{"eng", MODE_ENG},
|
||||||
{"hexadecimal", MODE_HEX},
|
{"hexadecimal", MODE_HEX},
|
||||||
{"hex", MODE_HEX},
|
{"hex", MODE_HEX},
|
||||||
{"octal", MODE_OCTAL},
|
{"octal", MODE_OCTAL},
|
||||||
@@ -757,7 +765,7 @@ setconfig(int type, VALUE *vp)
|
|||||||
math_error("Cannot duplicate new prompt");
|
math_error("Cannot duplicate new prompt");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
strncpy(p, vp->v_str->s_str, vp->v_str->s_len + 1);
|
strlcpy(p, vp->v_str->s_str, vp->v_str->s_len + 1);
|
||||||
free(conf->prompt1);
|
free(conf->prompt1);
|
||||||
conf->prompt1 = p;
|
conf->prompt1 = p;
|
||||||
break;
|
break;
|
||||||
@@ -772,7 +780,7 @@ setconfig(int type, VALUE *vp)
|
|||||||
math_error("Cannot duplicate new more prompt");
|
math_error("Cannot duplicate new more prompt");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
strncpy(p, vp->v_str->s_str, vp->v_str->s_len + 1);
|
strlcpy(p, vp->v_str->s_str, vp->v_str->s_len + 1);
|
||||||
free(conf->prompt2);
|
free(conf->prompt2);
|
||||||
conf->prompt2 = p;
|
conf->prompt2 = p;
|
||||||
break;
|
break;
|
||||||
@@ -909,34 +917,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) {
|
||||||
@@ -971,10 +987,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;
|
||||||
|
19
const.c
19
const.c
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* const - constant number storage module
|
* const - constant number storage module
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2007 David I. Bell
|
* Copyright (C) 1999-2007,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
|
||||||
@@ -28,6 +28,10 @@
|
|||||||
#include "calc.h"
|
#include "calc.h"
|
||||||
#include "qmath.h"
|
#include "qmath.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
#define CONSTALLOCSIZE 400 /* number of constants to allocate */
|
#define CONSTALLOCSIZE 400 /* number of constants to allocate */
|
||||||
|
|
||||||
STATIC unsigned long constcount;/* number of constants defined */
|
STATIC unsigned long constcount;/* number of constants defined */
|
||||||
@@ -40,16 +44,16 @@ initconstants(void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
consttable = (NUMBER **) malloc(sizeof(NUMBER *) * CONSTALLOCSIZE);
|
consttable = (NUMBER **) calloc(sizeof(NUMBER *), CONSTALLOCSIZE);
|
||||||
if (consttable == NULL) {
|
if (consttable == NULL) {
|
||||||
math_error("Unable to allocate constant table");
|
math_error("Unable to allocate constant table");
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
for (i = 0; i < INITCONSTCOUNT; i++)
|
for (i = 0; initnumbs[i] != NULL; i++) {
|
||||||
consttable[i] = initnumbs[i];
|
consttable[i] = initnumbs[i];
|
||||||
consttable[INITCONSTCOUNT] = NULL; /* firewall */
|
}
|
||||||
constcount = INITCONSTCOUNT;
|
constcount = i-1;
|
||||||
constavail = CONSTALLOCSIZE - INITCONSTCOUNT;
|
constavail = CONSTALLOCSIZE - constcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -119,6 +123,9 @@ addqconstant(NUMBER *q)
|
|||||||
tp = consttable;
|
tp = consttable;
|
||||||
for (index = 0; index < constcount; index++, tp++) {
|
for (index = 0; index < constcount; index++, tp++) {
|
||||||
t = *tp;
|
t = *tp;
|
||||||
|
if (t == NULL) { /* paranoia */
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (t->links == 0) {
|
if (t->links == 0) {
|
||||||
if (!havefirst) {
|
if (!havefirst) {
|
||||||
havefirst = TRUE;
|
havefirst = TRUE;
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
#!/usr/local/src/bin/calc/calc -q -s -f
|
#!/usr/local/src/bin/calc/calc -q -f
|
||||||
/*
|
/*
|
||||||
* 4dsphere - determine if 6 points lie on the surface of a sphere in R^4
|
* 4dsphere - determine if 6 points lie on the surface of a sphere in R^4
|
||||||
*
|
*
|
||||||
|
* Copyright (C) 2001,2014,2019,2021 Landon Curt Noll
|
||||||
|
*
|
||||||
* usage:
|
* usage:
|
||||||
* 4dsphere x0 y0 z0 w0 x1 y1 z1 w1 ... x5 y5 z5 w5
|
* 4dsphere x0 y0 z0 w0 x1 y1 z1 w1 ... x5 y5 z5 w5
|
||||||
*
|
*
|
||||||
@@ -10,8 +12,6 @@
|
|||||||
* ... ...
|
* ... ...
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
* as published by the Free Software Foundation.
|
* as published by the Free Software Foundation.
|
||||||
@@ -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));
|
||||||
|
169
cscript/Makefile
169
cscript/Makefile
@@ -1,7 +1,15 @@
|
|||||||
#
|
#
|
||||||
# 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
|
||||||
|
#
|
||||||
|
# SRC: cscript/Makefile
|
||||||
|
#
|
||||||
|
# The "# SRC: ... - ..." comment line above indicates
|
||||||
|
# the origin of this file.
|
||||||
|
#
|
||||||
|
# IMPORTANT: Please see the section on Makefiles near the
|
||||||
|
# bottom of the HOWTO.INSTALL file.
|
||||||
#
|
#
|
||||||
# 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,15 +35,63 @@
|
|||||||
# Makefile by Landon Curt Noll
|
# Makefile by Landon Curt Noll
|
||||||
|
|
||||||
|
|
||||||
# required vars
|
# The shell used by this Makefile
|
||||||
|
#
|
||||||
|
# On some systems, /bin/sh is a rather reduced shell with
|
||||||
|
# deprecated behavior.
|
||||||
|
#
|
||||||
|
# If your system has a up to date, bash shell, then
|
||||||
|
# you may wish to use:
|
||||||
|
#
|
||||||
|
# SHELL= /bin/bash
|
||||||
|
#
|
||||||
|
# On some systems such as macOS, the bash shell is very
|
||||||
|
# far behind to the point where is cannot be depended on.
|
||||||
|
# On such systems, the zsh may be a much better alternative
|
||||||
|
# shell for this Makefile to use:
|
||||||
|
#
|
||||||
|
# SHELL= /bin/zsh
|
||||||
#
|
#
|
||||||
SHELL= /bin/sh
|
SHELL= /bin/sh
|
||||||
|
#SHELL= /bin/bash
|
||||||
|
#SHELL= /bin/zsh
|
||||||
|
|
||||||
|
|
||||||
####
|
####
|
||||||
# Normally, the upper level makefile will set these values. We provide
|
# Normally, the upper level makefile will set these values. We provide
|
||||||
# a default here just in case you want to build from this directory.
|
# a default here just in case you want to build from this directory.
|
||||||
####
|
####
|
||||||
|
|
||||||
|
# PREFIX - Top level location for calc
|
||||||
|
#
|
||||||
|
# The PREFIX is often prepended to paths within calc and calc Makefiles.
|
||||||
|
#
|
||||||
|
# Starting with calc v2.13.0.1, nearly all Makefile places that used
|
||||||
|
# /usr/local now use ${PREFIX}. An exception is the olduninstall rule
|
||||||
|
# and, of course, this section. :-)
|
||||||
|
#
|
||||||
|
# NOTE: The ${PREFIX} is not the same as ${T}. The ${T} specifies
|
||||||
|
# a top level directory under which calc installs things.
|
||||||
|
# While usually ${T} is empty, it can be specific path
|
||||||
|
# as if calc where "chrooted" during an install.
|
||||||
|
# The ${PREFIX} value, during install, is a path between
|
||||||
|
# the top level ${T} install directory and the object
|
||||||
|
# such as an include file.
|
||||||
|
#
|
||||||
|
# NOTE: See also, ${T}, below.
|
||||||
|
#
|
||||||
|
# There are some paths that do NOT call under ${PREFIX}, such as
|
||||||
|
# ${CALCPATH}, that include paths not under ${PREFIX}, but those
|
||||||
|
# too are exceptions to this general rule.
|
||||||
|
#
|
||||||
|
# When in doubt, try:
|
||||||
|
#
|
||||||
|
# PREFIX= /usr/local
|
||||||
|
#
|
||||||
|
PREFIX= /usr/local
|
||||||
|
#PREFIX= /usr
|
||||||
|
#PREFIX= /usr/global
|
||||||
|
|
||||||
# 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
|
||||||
@@ -65,11 +121,11 @@ TOP_MAKE_FILE= Makefile
|
|||||||
# INCDIR= /usr/include
|
# INCDIR= /usr/include
|
||||||
#
|
#
|
||||||
|
|
||||||
#INCDIR= /usr/local/include
|
#INCDIR= ${PREFIX}/include
|
||||||
#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
|
||||||
@@ -91,15 +147,15 @@ INCDIR= /usr/include
|
|||||||
# LIBDIR= /usr/lib
|
# LIBDIR= /usr/lib
|
||||||
# CALC_SHAREDIR= /usr/share/calc
|
# CALC_SHAREDIR= /usr/share/calc
|
||||||
#
|
#
|
||||||
#BINDIR= /usr/local/bin
|
#BINDIR= ${PREFIX}/bin
|
||||||
#BINDIR= /dev/env/DJDIR/bin
|
#BINDIR= /dev/env/DJDIR/bin
|
||||||
BINDIR= /usr/bin
|
BINDIR= /usr/bin
|
||||||
|
|
||||||
#LIBDIR= /usr/local/lib
|
#LIBDIR= ${PREFIX}/lib
|
||||||
#LIBDIR= /dev/env/DJDIR/lib
|
#LIBDIR= /dev/env/DJDIR/lib
|
||||||
LIBDIR= /usr/lib
|
LIBDIR= /usr/lib
|
||||||
|
|
||||||
#CALC_SHAREDIR= /usr/local/lib/calc
|
#CALC_SHAREDIR= ${PREFIX}/lib/calc
|
||||||
#CALC_SHAREDIR= /dev/env/DJDIR/share/calc
|
#CALC_SHAREDIR= /dev/env/DJDIR/share/calc
|
||||||
CALC_SHAREDIR= /usr/share/calc
|
CALC_SHAREDIR= /usr/share/calc
|
||||||
|
|
||||||
@@ -157,28 +213,59 @@ T=
|
|||||||
|
|
||||||
# Makefile debug
|
# Makefile debug
|
||||||
#
|
#
|
||||||
# Q=@ do not echo internal makefile actions (quiet mode)
|
# Q=@ do not echo internal Makefile actions (quiet mode)
|
||||||
# Q= echo internal makefile actions (debug / verbose mode)
|
# Q= echo internal Makefile actions (debug / verbose mode)
|
||||||
|
#
|
||||||
|
# H=@: do not report hsrc file formation progress
|
||||||
|
# H=@ do echo hsrc file formation progress
|
||||||
|
#
|
||||||
|
# S= >/dev/null 2>&1 slience ${CC} output during hsrc file formation
|
||||||
|
# S= full ${CC} output during hsrc file formation
|
||||||
|
#
|
||||||
|
# E= 2>/dev/null slience command stderr during hsrc file formation
|
||||||
|
# E= full command stderr during hsrc file formation
|
||||||
|
#
|
||||||
|
# V=@: do not echo debug statements (quiet mode)
|
||||||
|
# V=@ do echo debug statements (debug / verbose mode)
|
||||||
#
|
#
|
||||||
#Q=
|
#Q=
|
||||||
Q=@
|
Q=@
|
||||||
|
#
|
||||||
|
S= >/dev/null 2>&1
|
||||||
|
#S=
|
||||||
|
#
|
||||||
|
E= 2>/dev/null
|
||||||
|
#E=
|
||||||
|
#
|
||||||
|
#H=@:
|
||||||
|
H=@
|
||||||
|
#
|
||||||
|
V=@:
|
||||||
|
#V=@
|
||||||
|
|
||||||
# standard tools
|
# standard tools
|
||||||
#
|
#
|
||||||
|
CAT= cat
|
||||||
CHMOD= chmod
|
CHMOD= chmod
|
||||||
|
CMP= cmp
|
||||||
|
CO= co
|
||||||
|
CP= cp
|
||||||
|
FMT= fmt
|
||||||
|
MKDIR= mkdir
|
||||||
|
MV= mv
|
||||||
|
RM= rm
|
||||||
|
RMDIR= rmdir
|
||||||
SED= sed
|
SED= sed
|
||||||
SORT= sort
|
SORT= sort
|
||||||
FMT= fmt
|
|
||||||
CMP= cmp
|
|
||||||
MKDIR= mkdir
|
|
||||||
RMDIR= rmdir
|
|
||||||
RM= rm
|
|
||||||
TOUCH= touch
|
TOUCH= touch
|
||||||
MV= mv
|
|
||||||
CP= cp
|
|
||||||
CO= co
|
|
||||||
TRUE= true
|
TRUE= true
|
||||||
|
|
||||||
|
# NOTE: On some shells, echo is a builtin that does
|
||||||
|
# not understand -n, so we call /bin/echo -n
|
||||||
|
# directly to get around such shells.
|
||||||
|
#
|
||||||
|
ECHON= /bin/echo -n
|
||||||
|
|
||||||
# The ${SCRIPT} list is the list of calc shell script files (without the .calc
|
# The ${SCRIPT} list is the list of calc shell script files (without the .calc
|
||||||
# extension) which will be installed.
|
# extension) which will be installed.
|
||||||
#
|
#
|
||||||
@@ -188,18 +275,17 @@ TRUE= true
|
|||||||
# To add a script:
|
# To add a script:
|
||||||
#
|
#
|
||||||
# 1) Name the file with a .calc filename extension
|
# 1) Name the file with a .calc filename extension
|
||||||
# 2) Place that file under RCS control
|
# 2) Add the name, without the .calc extension to the ${SCRIPT} below
|
||||||
# 3) Add the name, without the .calc extension to the ${SCRIPT} below
|
# 3) Write out this Makefile
|
||||||
# 4) Write out this Makefile
|
# 4) Replace the SCRIPT= and SCRIPT_SRC= lines with the output of:
|
||||||
# 5) Replace the ${SCRIPT} and ${SCRIPT_SRC} lines with the output of:
|
|
||||||
#
|
#
|
||||||
# make detaillist
|
# make detaillist
|
||||||
#
|
#
|
||||||
SCRIPT= 4dsphere fproduct mersenne piforever plus powerterm \
|
SCRIPT= 4dsphere fproduct mersenne piforever plus powerterm simple \
|
||||||
simple square
|
square
|
||||||
|
|
||||||
SCRIPT_SRC= 4dsphere.calc fproduct.calc mersenne.calc \
|
SCRIPT_SRC= 4dsphere.calc fproduct.calc mersenne.calc piforever.calc \
|
||||||
piforever.calc plus.calc powerterm.calc simple.calc square.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
|
||||||
#
|
#
|
||||||
@@ -263,11 +349,7 @@ detaillist:
|
|||||||
${Q} -(echo "xxxxxxx"; \
|
${Q} -(echo "xxxxxxx"; \
|
||||||
for i in ${SCRIPT} /dev/null; do \
|
for i in ${SCRIPT} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
if [ ! -f RCS/$$i.calc,v ]; then \
|
echo $$i; \
|
||||||
echo "WARNING: $$i.calc not under RCS control" 1>&2; \
|
|
||||||
else \
|
|
||||||
echo $$i; \
|
|
||||||
fi; \
|
|
||||||
fi; \
|
fi; \
|
||||||
done | LANG=C ${SORT}) | ${FMT} -70 | \
|
done | LANG=C ${SORT}) | ${FMT} -70 | \
|
||||||
${SED} -e '1s/xxxxxxx/SCRIPT=/' -e '2,$$s/^/ /' \
|
${SED} -e '1s/xxxxxxx/SCRIPT=/' -e '2,$$s/^/ /' \
|
||||||
@@ -276,11 +358,7 @@ detaillist:
|
|||||||
${Q} -(echo "xxxxxxxxxxx"; \
|
${Q} -(echo "xxxxxxxxxxx"; \
|
||||||
for i in ${SCRIPT} /dev/null; do \
|
for i in ${SCRIPT} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
if [ ! -f RCS/$$i.calc,v ]; then \
|
echo $$i.calc; \
|
||||||
echo "WARNING: $$i.calc not under RCS control" 1>&2; \
|
|
||||||
else \
|
|
||||||
echo $$i.calc; \
|
|
||||||
fi; \
|
|
||||||
fi; \
|
fi; \
|
||||||
done | LANG=C ${SORT}) | ${FMT} -70 | \
|
done | LANG=C ${SORT}) | ${FMT} -70 | \
|
||||||
${SED} -e '1s/xxxxxxxxxxx/SCRIPT_SRC=/' -e '2,$$s/^/ /' \
|
${SED} -e '1s/xxxxxxxxxxx/SCRIPT_SRC=/' -e '2,$$s/^/ /' \
|
||||||
@@ -291,7 +369,7 @@ detaillist:
|
|||||||
# 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.
|
||||||
@@ -311,7 +389,7 @@ depend:
|
|||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo "$$i: $$i.calc"; \
|
echo "$$i: $$i.calc"; \
|
||||||
echo ' @$${RM} -f $$@'; \
|
echo ' @$${RM} -f $$@'; \
|
||||||
echo -n ' @$${SED} -e "1s:^#!/usr/local/src/bin/'; \
|
${ECHON} ' @$${SED} -e "1s:^#!/usr/local/src/bin/'; \
|
||||||
echo 'calc/calc:#!$${BINDIR}/calc:" $$?>$$@'; \
|
echo 'calc/calc:#!$${BINDIR}/calc:" $$?>$$@'; \
|
||||||
echo ' @$${CHMOD} +x $$@'; \
|
echo ' @$${CHMOD} +x $$@'; \
|
||||||
fi; \
|
fi; \
|
||||||
@@ -326,20 +404,13 @@ depend:
|
|||||||
${Q} ${CAT} makedep.out >> ${MAKE_FILE}
|
${Q} ${CAT} makedep.out >> ${MAKE_FILE}
|
||||||
${Q} ${RM} -f makedep.out
|
${Q} ${RM} -f makedep.out
|
||||||
-${Q} if ${CMP} -s ${MAKE_FILE}.bak ${MAKE_FILE}; then \
|
-${Q} if ${CMP} -s ${MAKE_FILE}.bak ${MAKE_FILE}; then \
|
||||||
echo 'sample ${MAKE_FILE} was already up to date'; \
|
echo 'cscript/${MAKE_FILE} was already up to date'; \
|
||||||
|
echo 'restoring original cscript/${MAKE_FILE}'; \
|
||||||
${MV} -f ${MAKE_FILE}.bak ${MAKE_FILE}; \
|
${MV} -f ${MAKE_FILE}.bak ${MAKE_FILE}; \
|
||||||
else \
|
else \
|
||||||
${RM} -f ${MAKE_FILE}.tmp; \
|
echo 'old cscript/${MAKE_FILE} is now cscript/${MAKE_FILE}.bak'; \
|
||||||
${MV} ${MAKE_FILE} ${MAKE_FILE}.tmp; \
|
echo 'new cscript/${MAKE_FILE} formed'; \
|
||||||
if [ -d RCS -a ! -w "${MAKE_FILE}" ]; then \
|
echo 'try: diff -u cscript/${MAKE_FILE}.bak cscript/${MAKE_FILE}'; \
|
||||||
${CO} -l ${MAKE_FILE}; \
|
|
||||||
fi; \
|
|
||||||
${MV} ${MAKE_FILE}.tmp ${MAKE_FILE}; \
|
|
||||||
if [ -d RCS ]; then \
|
|
||||||
echo '******************************************************'; \
|
|
||||||
echo 'new cscript ${MAKE_FILE} formed -- need to check it in'; \
|
|
||||||
echo '******************************************************'; \
|
|
||||||
fi; \
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##
|
##
|
||||||
|
@@ -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
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
#!/usr/local/src/bin/calc/calc -q -s -f
|
#!/usr/local/src/bin/calc/calc -q -f
|
||||||
/*
|
/*
|
||||||
* fproduct - write the big Endian product of terms to a file
|
* fproduct - write the big Endian product of terms to a file
|
||||||
*
|
*
|
||||||
|
* Copyright (C) 2001,2014,2019,2021 Landon Curt Noll
|
||||||
|
*
|
||||||
* usage:
|
* usage:
|
||||||
* fproduct filename term [term ...]
|
* fproduct filename term [term ...]
|
||||||
*
|
*
|
||||||
* 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
|
|
||||||
*
|
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
* as published by the Free Software Foundation.
|
* as published by the Free Software Foundation.
|
||||||
@@ -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);
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
#!/usr/local/src/bin/calc/calc -q -s -f
|
#!/usr/local/src/bin/calc/calc -q -f
|
||||||
/*
|
/*
|
||||||
* 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,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
|
||||||
@@ -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 -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
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
* 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,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
|
||||||
@@ -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";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -44,7 +47,7 @@ if (argv() < 2) {
|
|||||||
* Since args are strings, we must eval them before using them numerically.
|
* Since args are strings, we must eval them before using them numerically.
|
||||||
*/
|
*/
|
||||||
sum = 0;
|
sum = 0;
|
||||||
for (i=1; i < argv(); ++i) {
|
for (i=1; i < argc; ++i) {
|
||||||
sum += eval(argv(i));
|
sum += eval(argv(i));
|
||||||
}
|
}
|
||||||
print sum;
|
print sum;
|
||||||
|
@@ -1,14 +1,22 @@
|
|||||||
#!/usr/local/src/bin/calc/calc -q -s -f
|
#!/usr/local/src/bin/calc/calc -q -f
|
||||||
/*
|
/*
|
||||||
* powerterm - print the argument as a sum of powers of integers
|
* powerterm - print the argument as a sum of powers of integers
|
||||||
*
|
*
|
||||||
|
* Copyright (C) 2001,2014,2019,2021 Landon Curt Noll
|
||||||
|
*
|
||||||
* usage:
|
* usage:
|
||||||
* powerterm [base_limit] value
|
* powerterm [base_limit] value
|
||||||
*
|
*
|
||||||
* 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
|
* Example:
|
||||||
|
*
|
||||||
|
* powerterm 5 1000000
|
||||||
|
*
|
||||||
|
* prints:
|
||||||
|
*
|
||||||
|
* 4^10 - 3^10 + 5^6 - 4^6 - 4^5 - 2^5
|
||||||
*
|
*
|
||||||
* 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 +43,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;
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
* 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,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
|
||||||
@@ -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 -p -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,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
|
||||||
@@ -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.
|
||||||
@@ -52,6 +48,8 @@
|
|||||||
* 1522756
|
* 1522756
|
||||||
* ln(2)
|
* ln(2)
|
||||||
* ~.48045301391820142467
|
* ~.48045301391820142467
|
||||||
|
* 2i
|
||||||
|
* -4
|
||||||
* config("mode","frac"), bernoulli(10)
|
* config("mode","frac"), bernoulli(10)
|
||||||
* 25/4356
|
* 25/4356
|
||||||
* config("mode", "hex"), 0xff
|
* config("mode", "hex"), 0xff
|
||||||
@@ -59,6 +57,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
global s;
|
while (s = fgetline(files(0))) {
|
||||||
while ((s = prompt("")))
|
|
||||||
print "\t":eval(s)^2;
|
print "\t":eval(s)^2;
|
||||||
|
}
|
||||||
|
8
custom.c
8
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,2018 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
|
||||||
@@ -47,6 +47,10 @@
|
|||||||
|
|
||||||
#endif /* CUSTOM */
|
#endif /* CUSTOM */
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
BOOL allow_custom = FALSE; /* TRUE => custom builtins allowed */
|
BOOL allow_custom = FALSE; /* TRUE => custom builtins allowed */
|
||||||
|
|
||||||
|
|
||||||
@@ -109,7 +113,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
|
||||||
|
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
|
||||||
@@ -374,12 +374,12 @@ Step 5: Write your custom function
|
|||||||
|
|
||||||
One is able to set bit 8 by way of the calc command line:
|
One is able to set bit 8 by way of the calc command line:
|
||||||
|
|
||||||
calc -D 128
|
calc -D 128
|
||||||
|
|
||||||
See the calc man page for details. One may also set that bit
|
See the calc man page for details. One may also set that bit
|
||||||
while running calc by way of the config() builtin function:
|
while running calc by way of the config() builtin function:
|
||||||
|
|
||||||
config("calc_debug", 128);
|
config("calc_debug", 128);
|
||||||
|
|
||||||
See the help/config file for details on calc_debug.
|
See the help/config file for details on calc_debug.
|
||||||
|
|
||||||
@@ -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
|
||||||
|
401
custom/Makefile
401
custom/Makefile
@@ -2,7 +2,15 @@
|
|||||||
#
|
#
|
||||||
# custom - makefile for calc custom routines
|
# custom - makefile for calc custom routines
|
||||||
#
|
#
|
||||||
# Copyright (C) 1999-2006,2014,2017-2018 Landon Curt Noll
|
# Copyright (C) 1999-2006,2014,2017-2018,2021 Landon Curt Noll
|
||||||
|
#
|
||||||
|
# SRC: Makefile via make -f Makefile.ship custom/Makefile
|
||||||
|
#
|
||||||
|
# The "# SRC: ... - ..." comment line above indicates
|
||||||
|
# the origin of this file.
|
||||||
|
#
|
||||||
|
# IMPORTANT: Please see the section on Makefiles near the
|
||||||
|
# bottom of the HOWTO.INSTALL file.
|
||||||
#
|
#
|
||||||
# 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,7 +35,123 @@
|
|||||||
# 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
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
# NOTE: Start of section from custom/Makefile.head #
|
||||||
|
####################################################
|
||||||
|
|
||||||
|
#.###############################################################.#
|
||||||
|
#.# #.#
|
||||||
|
#.# WARNING: This Makefile is generated from a combination of #.#
|
||||||
|
#.# custom/Makefile.head, Makefile.ship, and #.#
|
||||||
|
#.# custom/Makefile.tail. We recommend that you NOT #.#
|
||||||
|
#.# edit this file, but instead edit the proper source #.#
|
||||||
|
#.# file and then make custom/Makefile: #.#
|
||||||
|
#.# #.#
|
||||||
|
#.# make custom/Makefile #.#
|
||||||
|
#.# #.#
|
||||||
|
#.# See the '# NOTE .. section from ..' lines for #.#
|
||||||
|
#.# where the source file for the lines are from. #.#
|
||||||
|
#.# #.#
|
||||||
|
#.###############################################################.#
|
||||||
|
|
||||||
|
|
||||||
|
# The shell used by this Makefile
|
||||||
|
#
|
||||||
|
# On some systems, /bin/sh is a rather reduced shell with
|
||||||
|
# deprecated behavior.
|
||||||
|
#
|
||||||
|
# If your system has a up to date, bash shell, then
|
||||||
|
# you may wish to use:
|
||||||
|
#
|
||||||
|
# SHELL= /bin/bash
|
||||||
|
#
|
||||||
|
# On some systems such as macOS, the bash shell is very
|
||||||
|
# far behind to the point where is cannot be depended on.
|
||||||
|
# On such systems, the zsh may be a much better alternative
|
||||||
|
# shell for this Makefile to use:
|
||||||
|
#
|
||||||
|
# SHELL= /bin/zsh
|
||||||
|
#
|
||||||
|
SHELL= /bin/sh
|
||||||
|
#SHELL= /bin/bash
|
||||||
|
#SHELL= /bin/zsh
|
||||||
|
|
||||||
|
|
||||||
|
# PREFIX - Top level location for calc
|
||||||
|
#
|
||||||
|
# The PREFIX is often prepended to paths within calc and calc Makefiles.
|
||||||
|
#
|
||||||
|
# Starting with calc v2.13.0.1, nearly all Makefile places that used
|
||||||
|
# /usr/local now use ${PREFIX}. An exception is the olduninstall rule
|
||||||
|
# and, of course, this section. :-)
|
||||||
|
#
|
||||||
|
# NOTE: The ${PREFIX} is not the same as ${T}. The ${T} specifies
|
||||||
|
# a top level directory under which calc installs things.
|
||||||
|
# While usually ${T} is empty, it can be specific path
|
||||||
|
# as if calc where "chrooted" during an install.
|
||||||
|
# The ${PREFIX} value, during install, is a path between
|
||||||
|
# the top level ${T} install directory and the object
|
||||||
|
# such as an include file.
|
||||||
|
#
|
||||||
|
# NOTE: See also, ${T}, below.
|
||||||
|
#
|
||||||
|
# There are some paths that do NOT call under ${PREFIX}, such as
|
||||||
|
# ${CALCPATH}, that include paths not under ${PREFIX}, but those
|
||||||
|
# too are exceptions to this general rule.
|
||||||
|
#
|
||||||
|
# When in doubt, try:
|
||||||
|
#
|
||||||
|
# PREFIX= /usr/local
|
||||||
|
#
|
||||||
|
PREFIX= /usr/local
|
||||||
|
#PREFIX= /usr
|
||||||
|
#PREFIX= /usr/global
|
||||||
|
|
||||||
|
|
||||||
|
# CCBAN is given to ${CC} in order to control if banned.h is in effect.
|
||||||
|
#
|
||||||
|
# The banned.h attempts to ban the use of certain dangerous functions
|
||||||
|
# that, if improperly used, could compromise the computational integrity
|
||||||
|
# if calculations.
|
||||||
|
#
|
||||||
|
# In the case of calc, we are motivated in part by the desire for calc
|
||||||
|
# to correctly calculate: even during extremely long calculations.
|
||||||
|
#
|
||||||
|
# If UNBAN is NOT defined, then calling certain functions
|
||||||
|
# will result in a call to a non-existent function (link error).
|
||||||
|
#
|
||||||
|
# While we do NOT encourage defining UNBAN, there may be
|
||||||
|
# a system / compiler environment where re-defining a
|
||||||
|
# function may lead to a fatal compiler complication.
|
||||||
|
# If that happens, consider compiling as:
|
||||||
|
#
|
||||||
|
# make clobber all chk CCBAN=-DUNBAN
|
||||||
|
#
|
||||||
|
# as see if this is a work-a-round.
|
||||||
|
#
|
||||||
|
# If YOU discover a need for the -DUNBAN work-a-round, PLEASE tell us!
|
||||||
|
# Please send us a bug report. See the file:
|
||||||
|
#
|
||||||
|
# BUGS
|
||||||
|
#
|
||||||
|
# or the URL:
|
||||||
|
#
|
||||||
|
# http://www.isthe.com/chongo/tech/comp/calc/calc-bugrept.html
|
||||||
|
#
|
||||||
|
# for how to send us such a bug report.
|
||||||
|
#
|
||||||
|
CCBAN= -UUNBAN
|
||||||
|
#CCBAN= -DUNBAN
|
||||||
|
|
||||||
|
|
||||||
#if 0 /* start of skip for non-Gnu makefiles */
|
#if 0 /* start of skip for non-Gnu makefiles */
|
||||||
|
|
||||||
|
# Unfortunately due to the complex dependency issues between
|
||||||
|
# Makefile, Makefile.ship and custom/Makefile, parallel GNU make
|
||||||
|
# is NOT recommended. Sorry.
|
||||||
|
#
|
||||||
|
.NOTPARALLEL:
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#-=-=-=-=-=-=-=-=- Identify the target machine, if possible -=-=-=-=-=-=-=-=-#
|
#-=-=-=-=-=-=-=-=- Identify the target machine, if possible -=-=-=-=-=-=-=-=-#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@@ -36,7 +160,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)
|
||||||
@@ -96,14 +220,38 @@ CUSTOM_OBJ= c_argv.o c_devnull.o c_help.o c_sysinfo.o c_pzasusb8.o \
|
|||||||
|
|
||||||
# Normally, the upper level makefile will set these values. We provide
|
# Normally, the upper level makefile will set these values. We provide
|
||||||
# a default here just in case you want to build from this directory.
|
# a default here just in case you want to build from this directory.
|
||||||
#
|
|
||||||
# Makefile debug
|
# Makefile debug
|
||||||
#
|
#
|
||||||
# Q=@ do not echo internal makefile actions (quiet mode)
|
# Q=@ do not echo internal Makefile actions (quiet mode)
|
||||||
# Q= echo internal makefile actions (debug / verbose mode)
|
# Q= echo internal Makefile actions (debug / verbose mode)
|
||||||
|
#
|
||||||
|
# H=@: do not report hsrc file formation progress
|
||||||
|
# H=@ do echo hsrc file formation progress
|
||||||
|
#
|
||||||
|
# S= >/dev/null 2>&1 slience ${CC} output during hsrc file formation
|
||||||
|
# S= full ${CC} output during hsrc file formation
|
||||||
|
#
|
||||||
|
# E= 2>/dev/null slience command stderr during hsrc file formation
|
||||||
|
# E= full command stderr during hsrc file formation
|
||||||
|
#
|
||||||
|
# V=@: do not echo debug statements (quiet mode)
|
||||||
|
# V=@ do echo debug statements (debug / verbose mode)
|
||||||
#
|
#
|
||||||
#Q=
|
#Q=
|
||||||
Q=@
|
Q=@
|
||||||
|
#
|
||||||
|
S= >/dev/null 2>&1
|
||||||
|
#S=
|
||||||
|
#
|
||||||
|
E= 2>/dev/null
|
||||||
|
#E=
|
||||||
|
#
|
||||||
|
#H=@:
|
||||||
|
H=@
|
||||||
|
#
|
||||||
|
V=@:
|
||||||
|
#V=@
|
||||||
|
|
||||||
####
|
####
|
||||||
# Normally, the upper level makefile will set these values. We provide
|
# Normally, the upper level makefile will set these values. We provide
|
||||||
@@ -121,11 +269,11 @@ Q=@
|
|||||||
# INCDIR= /usr/include
|
# INCDIR= /usr/include
|
||||||
#
|
#
|
||||||
|
|
||||||
#INCDIR= /usr/local/include
|
#INCDIR= ${PREFIX}/include
|
||||||
#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
|
||||||
@@ -147,15 +295,15 @@ INCDIR= /usr/include
|
|||||||
# LIBDIR= /usr/lib
|
# LIBDIR= /usr/lib
|
||||||
# CALC_SHAREDIR= /usr/share/calc
|
# CALC_SHAREDIR= /usr/share/calc
|
||||||
#
|
#
|
||||||
#BINDIR= /usr/local/bin
|
#BINDIR= ${PREFIX}/bin
|
||||||
#BINDIR= /dev/env/DJDIR/bin
|
#BINDIR= /dev/env/DJDIR/bin
|
||||||
BINDIR= /usr/bin
|
BINDIR= /usr/bin
|
||||||
|
|
||||||
#LIBDIR= /usr/local/lib
|
#LIBDIR= ${PREFIX}/lib
|
||||||
#LIBDIR= /dev/env/DJDIR/lib
|
#LIBDIR= /dev/env/DJDIR/lib
|
||||||
LIBDIR= /usr/lib
|
LIBDIR= /usr/lib
|
||||||
|
|
||||||
#CALC_SHAREDIR= /usr/local/lib/calc
|
#CALC_SHAREDIR= ${PREFIX}/lib/calc
|
||||||
#CALC_SHAREDIR= /dev/env/DJDIR/share/calc
|
#CALC_SHAREDIR= /dev/env/DJDIR/share/calc
|
||||||
CALC_SHAREDIR= /usr/share/calc
|
CALC_SHAREDIR= /usr/share/calc
|
||||||
|
|
||||||
@@ -348,7 +496,7 @@ EXT=
|
|||||||
|
|
||||||
# The default calc versions
|
# The default calc versions
|
||||||
#
|
#
|
||||||
VERSION= 2.12.6.9
|
VERSION= 2.14.0.8
|
||||||
|
|
||||||
# Names of shared libraries with versions
|
# Names of shared libraries with versions
|
||||||
#
|
#
|
||||||
@@ -357,26 +505,25 @@ LIB_EXT_VERSION= ${LIB_EXT}.${VERSION}
|
|||||||
|
|
||||||
# standard tools
|
# standard tools
|
||||||
#
|
#
|
||||||
SHELL= /bin/sh
|
|
||||||
SED= sed
|
|
||||||
MAKEDEPEND= makedepend
|
|
||||||
GREP= egrep
|
|
||||||
CHMOD= chmod
|
|
||||||
FMT= fmt
|
|
||||||
SORT= sort
|
|
||||||
CMP= cmp
|
|
||||||
AR= ar
|
AR= ar
|
||||||
RM= rm
|
|
||||||
TOUCH= touch
|
|
||||||
MKDIR= mkdir
|
|
||||||
RMDIR= rmdir
|
|
||||||
MV= mv
|
|
||||||
CP= cp
|
|
||||||
CO= co
|
|
||||||
TRUE= true
|
|
||||||
MAKE= make
|
|
||||||
LN= ln
|
|
||||||
AWK= awk
|
AWK= awk
|
||||||
|
CHMOD= chmod
|
||||||
|
CMP= cmp
|
||||||
|
CO= co
|
||||||
|
CP= cp
|
||||||
|
FMT= fmt
|
||||||
|
GREP= egrep
|
||||||
|
LN= ln
|
||||||
|
MAKE= make
|
||||||
|
MAKEDEPEND= makedepend
|
||||||
|
MKDIR= mkdir
|
||||||
|
MV= mv
|
||||||
|
RM= rm
|
||||||
|
RMDIR= rmdir
|
||||||
|
SED= sed
|
||||||
|
SORT= sort
|
||||||
|
TOUCH= touch
|
||||||
|
TRUE= true
|
||||||
|
|
||||||
# EXTRA_CFLAGS are flags given to ${CC} when compiling C files
|
# EXTRA_CFLAGS are flags given to ${CC} when compiling C files
|
||||||
# EXTRA_LDFLAGS are flags given to ${CC} when linking progs
|
# EXTRA_LDFLAGS are flags given to ${CC} when linking progs
|
||||||
@@ -391,7 +538,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=
|
||||||
@@ -420,9 +567,9 @@ COMMON_LDFLAGS= ${EXTRA_LDFLAGS}
|
|||||||
# NOTE: This does not work for: make-XYZ-only and BLD_TYPE != make-XYZ-only
|
# NOTE: This does not work for: make-XYZ-only and BLD_TYPE != make-XYZ-only
|
||||||
#
|
#
|
||||||
ifeq ($(BLD_TYPE),calc-static-only)
|
ifeq ($(BLD_TYPE),calc-static-only)
|
||||||
ICFLAGS= ${COMMON_CFLAGS} ${CC_STATIC}
|
ICFLAGS= ${COMMON_CFLAGS} ${CCBAN} ${CC_STATIC}
|
||||||
else
|
else
|
||||||
ICFLAGS= ${COMMON_CFLAGS} ${CC_SHARE}
|
ICFLAGS= ${COMMON_CFLAGS} ${CCBAN} ${CC_SHARE}
|
||||||
endif
|
endif
|
||||||
CFLAGS= ${ICFLAGS} ${CCOPT}
|
CFLAGS= ${ICFLAGS} ${CCOPT}
|
||||||
|
|
||||||
@@ -435,7 +582,16 @@ ILDFLAGS= ${COMMON_LDFLAGS}
|
|||||||
LDFLAGS= ${LD_DEBUG} ${ILDFLAGS}
|
LDFLAGS= ${LD_DEBUG} ${ILDFLAGS}
|
||||||
|
|
||||||
#endif /* end of skip for non-Gnu makefiles */
|
#endif /* end of skip for non-Gnu makefiles */
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
# NOTE: End of section from custom/Makefile.head #
|
||||||
|
##################################################
|
||||||
# start of host target cut - Do not remove this line
|
# start of host target cut - Do not remove this line
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
# NOTE: Start of section from the middle of Makefile.ship #
|
||||||
|
###########################################################
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#-=-=-=-=-=- host target section - targets that override defaults -=-=-=-=-=-#
|
#-=-=-=-=-=- host target section - targets that override defaults -=-=-=-=-=-#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@@ -466,12 +622,20 @@ LDFLAGS= ${LD_DEBUG} ${ILDFLAGS}
|
|||||||
# CCOPT are flags given to ${CC} for optimization
|
# CCOPT are flags given to ${CC} for optimization
|
||||||
# CCWARN are flags given to ${CC} for warning message control
|
# CCWARN are flags given to ${CC} for warning message control
|
||||||
#
|
#
|
||||||
# WNO_IMPLICT, WNO_ERROR_LONG_LONG and WNO_LONG_LONG are given to ${CC}
|
# The following are given to ${CC}:
|
||||||
# when compiling special .o files that may need special compile options
|
#
|
||||||
|
# WNO_IMPLICT
|
||||||
|
# WNO_ERROR_LONG_LONG
|
||||||
|
# WNO_LONG_LONG
|
||||||
|
#
|
||||||
|
# when compiling special .o files that may need special compile options:
|
||||||
|
#
|
||||||
# NOTE: These flags simply turn off certain compiler warnings,
|
# NOTE: These flags simply turn off certain compiler warnings,
|
||||||
# which is useful only when CCWERR is set to -Werror.
|
# which is useful only when CCWERR is set to -Werror.
|
||||||
|
#
|
||||||
# NOTE: If your compiler does not have these -Wno files, just
|
# NOTE: If your compiler does not have these -Wno files, just
|
||||||
# set these variables to nothing as in:
|
# set these variables to nothing as in:
|
||||||
|
#
|
||||||
# WNO_IMPLICT=
|
# WNO_IMPLICT=
|
||||||
# WNO_ERROR_LONG_LONG=
|
# WNO_ERROR_LONG_LONG=
|
||||||
# WNO_LONG_LONG=
|
# WNO_LONG_LONG=
|
||||||
@@ -482,6 +646,9 @@ LDFLAGS= ${LD_DEBUG} ${ILDFLAGS}
|
|||||||
# to abort on warnings, then leave CCWERR blank.
|
# to abort on warnings, then leave CCWERR blank.
|
||||||
# CCMISC are misc flags given to ${CC}
|
# CCMISC are misc flags given to ${CC}
|
||||||
#
|
#
|
||||||
|
# CCBAN is given to ${CC} in order to control if banned.h is in effect.
|
||||||
|
# NOTE: See where CCBAN is defined above for details.
|
||||||
|
#
|
||||||
# LCC is how the C compiler is invoked on locally executed intermediate programs
|
# LCC is how the C compiler is invoked on locally executed intermediate programs
|
||||||
# CC is how the C compiler is invoked (with an optional Purify)
|
# CC is how the C compiler is invoked (with an optional Purify)
|
||||||
#
|
#
|
||||||
@@ -493,7 +660,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. #
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
@@ -507,7 +674,7 @@ ifeq ($(target),Linux)
|
|||||||
BLD_TYPE= calc-dynamic-only
|
BLD_TYPE= calc-dynamic-only
|
||||||
#
|
#
|
||||||
CC_SHARE= -fPIC
|
CC_SHARE= -fPIC
|
||||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
|
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
|
||||||
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
||||||
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
||||||
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
||||||
@@ -534,10 +701,8 @@ LIBCUSTCALC_STATIC=
|
|||||||
# This facility requires a Gnu Makefile, or a make command
|
# This facility requires a Gnu Makefile, or a make command
|
||||||
# that understands the += make operand.
|
# that understands the += make operand.
|
||||||
#
|
#
|
||||||
#if 0 /* start of skip for non-Gnu makefiles */
|
|
||||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||||
#endif /* end of skip for non-Gnu makefiles */
|
|
||||||
#
|
#
|
||||||
CCWARN= -Wall
|
CCWARN= -Wall
|
||||||
WNO_IMPLICT= -Wno-implicit
|
WNO_IMPLICT= -Wno-implicit
|
||||||
@@ -552,16 +717,16 @@ CC= ${PURIFY} ${LCC} ${CCWERR}
|
|||||||
#
|
#
|
||||||
endif
|
endif
|
||||||
|
|
||||||
##############################
|
###############################
|
||||||
# Apple OS X / Darwin target #
|
# Apple macOS / Darwin target #
|
||||||
##############################
|
###############################
|
||||||
|
|
||||||
ifeq ($(target),Darwin)
|
ifeq ($(target),Darwin)
|
||||||
#
|
#
|
||||||
BLD_TYPE= calc-dynamic-only
|
BLD_TYPE= calc-dynamic-only
|
||||||
#
|
#
|
||||||
CC_SHARE= -fPIC
|
CC_SHARE= -fPIC
|
||||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:${LIBDIR}:/usr/local/lib
|
DEFAULT_LIB_INSTALL_PATH= ${PWD}:${LIBDIR}:${PREFIX}/lib
|
||||||
LD_SHARE= ${DARWIN_ARCH}
|
LD_SHARE= ${DARWIN_ARCH}
|
||||||
#SET_INSTALL_NAME= no
|
#SET_INSTALL_NAME= no
|
||||||
SET_INSTALL_NAME= yes
|
SET_INSTALL_NAME= yes
|
||||||
@@ -602,10 +767,8 @@ LIBCUSTCALC_STATIC=
|
|||||||
# This facility requires a Gnu Makefile, or a make command
|
# This facility requires a Gnu Makefile, or a make command
|
||||||
# that understands the += make operand.
|
# that understands the += make operand.
|
||||||
#
|
#
|
||||||
#if 0 /* start of skip for non-Gnu makefiles */
|
|
||||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||||
#endif /* end of skip for non-Gnu makefiles */
|
|
||||||
#
|
#
|
||||||
CCWARN= -Wall
|
CCWARN= -Wall
|
||||||
WNO_IMPLICT= -Wno-implicit
|
WNO_IMPLICT= -Wno-implicit
|
||||||
@@ -645,7 +808,7 @@ ifeq ($(target),FreeBSD)
|
|||||||
BLD_TYPE= calc-dynamic-only
|
BLD_TYPE= calc-dynamic-only
|
||||||
#
|
#
|
||||||
CC_SHARE= -fPIC
|
CC_SHARE= -fPIC
|
||||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
|
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
|
||||||
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
||||||
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
||||||
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
||||||
@@ -672,10 +835,8 @@ LIBCUSTCALC_STATIC=
|
|||||||
# This facility requires a Gnu Makefile, or a make command
|
# This facility requires a Gnu Makefile, or a make command
|
||||||
# that understands the += make operand.
|
# that understands the += make operand.
|
||||||
#
|
#
|
||||||
#if 0 /* start of skip for non-Gnu makefiles */
|
|
||||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||||
#endif /* end of skip for non-Gnu makefiles */
|
|
||||||
#
|
#
|
||||||
CCWARN= -Wall
|
CCWARN= -Wall
|
||||||
WNO_IMPLICT= -Wno-implicit
|
WNO_IMPLICT= -Wno-implicit
|
||||||
@@ -707,7 +868,7 @@ ifeq ($(target),OpenBSD)
|
|||||||
BLD_TYPE= calc-dynamic-only
|
BLD_TYPE= calc-dynamic-only
|
||||||
#
|
#
|
||||||
CC_SHARE= -fPIC
|
CC_SHARE= -fPIC
|
||||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
|
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
|
||||||
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
||||||
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
||||||
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
||||||
@@ -734,10 +895,8 @@ LIBCUSTCALC_STATIC=
|
|||||||
# This facility requires a Gnu Makefile, or a make command
|
# This facility requires a Gnu Makefile, or a make command
|
||||||
# that understands the += make operand.
|
# that understands the += make operand.
|
||||||
#
|
#
|
||||||
#if 0 /* start of skip for non-Gnu makefiles */
|
|
||||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||||
#endif /* end of skip for non-Gnu makefiles */
|
|
||||||
#
|
#
|
||||||
CCWARN= -Wall
|
CCWARN= -Wall
|
||||||
WNO_IMPLICT= -Wno-implicit
|
WNO_IMPLICT= -Wno-implicit
|
||||||
@@ -763,7 +922,7 @@ ifeq ($(target),SunOS)
|
|||||||
BLD_TYPE= calc-dynamic-only
|
BLD_TYPE= calc-dynamic-only
|
||||||
#
|
#
|
||||||
CC_SHARE= -fPIC
|
CC_SHARE= -fPIC
|
||||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
|
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
|
||||||
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
||||||
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
||||||
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
||||||
@@ -790,10 +949,8 @@ LD_STATIC=
|
|||||||
# This facility requires a Gnu Makefile, or a make command
|
# This facility requires a Gnu Makefile, or a make command
|
||||||
# that understands the += make operand.
|
# that understands the += make operand.
|
||||||
#
|
#
|
||||||
#if 0 /* start of skip for non-Gnu makefiles */
|
|
||||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||||
#endif /* end of skip for non-Gnu makefiles */
|
|
||||||
#
|
#
|
||||||
CCWARN= -Wall
|
CCWARN= -Wall
|
||||||
WNO_IMPLICT= -Wno-implicit
|
WNO_IMPLICT= -Wno-implicit
|
||||||
@@ -817,7 +974,7 @@ ifeq ($(target),Cygwin)
|
|||||||
BLD_TYPE= calc-static-only
|
BLD_TYPE= calc-static-only
|
||||||
#
|
#
|
||||||
CC_SHARE= -fPIC
|
CC_SHARE= -fPIC
|
||||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
|
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
|
||||||
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
||||||
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
||||||
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
||||||
@@ -844,10 +1001,8 @@ LD_STATIC=
|
|||||||
# This facility requires a Gnu Makefile, or a make command
|
# This facility requires a Gnu Makefile, or a make command
|
||||||
# that understands the += make operand.
|
# that understands the += make operand.
|
||||||
#
|
#
|
||||||
#if 0 /* start of skip for non-Gnu makefiles */
|
|
||||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||||
#endif /* end of skip for non-Gnu makefiles */
|
|
||||||
#
|
#
|
||||||
CCWARN= -Wall
|
CCWARN= -Wall
|
||||||
WNO_IMPLICT= -Wno-implicit
|
WNO_IMPLICT= -Wno-implicit
|
||||||
@@ -875,7 +1030,7 @@ ifeq ($(target),simple)
|
|||||||
BLD_TYPE= calc-static-only
|
BLD_TYPE= calc-static-only
|
||||||
#
|
#
|
||||||
CC_SHARE= -fPIC
|
CC_SHARE= -fPIC
|
||||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
|
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
|
||||||
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
||||||
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
||||||
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
||||||
@@ -904,7 +1059,7 @@ CC= ${PURIFY} ${LCC} ${CCWERR}
|
|||||||
# ILDFLAGS for ${CC} in linking intermediate programs used to help compile calc
|
# ILDFLAGS for ${CC} in linking intermediate programs used to help compile calc
|
||||||
# LDFLAGS for ${CC} in linking calc programs other than intermediate programs
|
# LDFLAGS for ${CC} in linking calc programs other than intermediate programs
|
||||||
#
|
#
|
||||||
ICFLAGS= ${COMMON_CFLAGS} ${CC_STATIC}
|
ICFLAGS= ${COMMON_CFLAGS} ${CCBAN} ${CC_STATIC}
|
||||||
CFLAGS= ${ICFLAGS} ${CCOPT}
|
CFLAGS= ${ICFLAGS} ${CCOPT}
|
||||||
#
|
#
|
||||||
ILDFLAGS= ${COMMON_LDFLAGS} ${LD_STATIC}
|
ILDFLAGS= ${COMMON_LDFLAGS} ${LD_STATIC}
|
||||||
@@ -929,12 +1084,12 @@ CALCPATH= .;./cal;~/.cal;${T}${CALC_SHAREDIR};${T}${CUSTOMCALDIR}
|
|||||||
else
|
else
|
||||||
CALCPATH= .;./cal;~/.cal;${T}${CALC_SHAREDIR}
|
CALCPATH= .;./cal;~/.cal;${T}${CALC_SHAREDIR}
|
||||||
endif
|
endif
|
||||||
CALCRC= ${CALC_SHAREDIR}/startup;~/.calcrc;./.calcinit
|
CALCRC= ./.calcinit;~/.calcrc;${CALC_SHAREDIR}/startup
|
||||||
#
|
#
|
||||||
BLD_TYPE= calc-static-only
|
BLD_TYPE= calc-static-only
|
||||||
#
|
#
|
||||||
CC_SHARE= -fPIC
|
CC_SHARE= -fPIC
|
||||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
|
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
|
||||||
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
||||||
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
||||||
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
||||||
@@ -974,7 +1129,7 @@ ifeq ($(target),)
|
|||||||
BLD_TYPE= calc-static-only
|
BLD_TYPE= calc-static-only
|
||||||
#
|
#
|
||||||
CC_SHARE= -fPIC
|
CC_SHARE= -fPIC
|
||||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
|
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
|
||||||
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
||||||
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
||||||
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
||||||
@@ -1001,10 +1156,8 @@ LD_STATIC=
|
|||||||
# This facility requires a Gnu Makefile, or a make command
|
# This facility requires a Gnu Makefile, or a make command
|
||||||
# that understands the += make operand.
|
# that understands the += make operand.
|
||||||
#
|
#
|
||||||
#if 0 /* start of skip for non-Gnu makefiles */
|
|
||||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||||
#endif /* end of skip for non-Gnu makefiles */
|
|
||||||
#
|
#
|
||||||
CCWARN= -Wall
|
CCWARN= -Wall
|
||||||
WNO_IMPLICT= -Wno-implicit
|
WNO_IMPLICT= -Wno-implicit
|
||||||
@@ -1031,9 +1184,9 @@ endif
|
|||||||
# NOTE: This does not work for: make-XYZ-only and BLD_TYPE != make-XYZ-only
|
# NOTE: This does not work for: make-XYZ-only and BLD_TYPE != make-XYZ-only
|
||||||
#
|
#
|
||||||
ifeq ($(BLD_TYPE),calc-static-only)
|
ifeq ($(BLD_TYPE),calc-static-only)
|
||||||
ICFLAGS= ${COMMON_CFLAGS} ${CC_STATIC}
|
ICFLAGS= ${COMMON_CFLAGS} ${CCBAN} ${CC_STATIC}
|
||||||
else
|
else
|
||||||
ICFLAGS= ${COMMON_CFLAGS} ${CC_SHARE}
|
ICFLAGS= ${COMMON_CFLAGS} ${CCBAN} ${CC_SHARE}
|
||||||
endif
|
endif
|
||||||
CFLAGS= ${ICFLAGS} ${CCOPT}
|
CFLAGS= ${ICFLAGS} ${CCOPT}
|
||||||
|
|
||||||
@@ -1049,7 +1202,27 @@ LDFLAGS= ${LD_DEBUG} ${ILDFLAGS}
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
#-=-=-=-=-=- end of target section - only make rules below -=-=-=-=-=-#
|
#-=-=-=-=-=- end of target section - only make rules below -=-=-=-=-=-#
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
|
#########################################################
|
||||||
|
# NOTE: End of section from the middle of Makefile.ship #
|
||||||
|
#########################################################
|
||||||
|
|
||||||
# end of host target cut - Do not remove this line
|
# end of host target cut - Do not remove this line
|
||||||
|
#
|
||||||
|
# Copyright (C) 1999-2006,2014,2017-2018,2021 Landon Curt Noll
|
||||||
|
#
|
||||||
|
# SRC: Makefile via make -f Makefile.ship custom/Makefile
|
||||||
|
#
|
||||||
|
# The "# SRC: ... - ..." comment line above indicates
|
||||||
|
# the origin of this file.
|
||||||
|
#
|
||||||
|
# IMPORTANT: Please see the section on Makefiles near the
|
||||||
|
# bottom of the HOWTO.INSTALL file.
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
# NOTE: Start of section from custom/Makefile.tail #
|
||||||
|
####################################################
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#-=-=-=-=-=-=-=-=- Be careful if you change something below -=-=-=-=-=-=-=-=-#
|
#-=-=-=-=-=-=-=-=- Be careful if you change something below -=-=-=-=-=-=-=-=-#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@@ -1084,7 +1257,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 +1274,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 +1328,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 +1347,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*
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
|
|
||||||
@@ -1200,7 +1373,10 @@ Makefile.simple: ${MAKE_FILE}
|
|||||||
${V} echo '=-=-=-=-= custom/${MAKE_FILE} start of $@ rule =-=-=-=-='
|
${V} echo '=-=-=-=-= custom/${MAKE_FILE} start of $@ rule =-=-=-=-='
|
||||||
${Q} ${RM} -f $@
|
${Q} ${RM} -f $@
|
||||||
${Q} ${AWK} '/^#if 0/{skp=1} {if(!skp){print $$0}} /^#endif/{skp=0}' \
|
${Q} ${AWK} '/^#if 0/{skp=1} {if(!skp){print $$0}} /^#endif/{skp=0}' \
|
||||||
${MAKE_FILE} > $@
|
${MAKE_FILE} | \
|
||||||
|
${GREP} -v '#\.#' | \
|
||||||
|
${SED} -e 's;^# SRC:.*;# SRC: non-GNU Makefile via;' \
|
||||||
|
-e 's;via$$;via ${MAKE} -f ${MAKE_FILE} custom/$@;' > $@
|
||||||
${Q} echo >> $@
|
${Q} echo >> $@
|
||||||
${Q} echo 'Makefile.simple:' >> $@
|
${Q} echo 'Makefile.simple:' >> $@
|
||||||
${Q} echo ' $${Q} if [ ! -f Makefile.simple ]; then '"\\" >> $@
|
${Q} echo ' $${Q} if [ ! -f Makefile.simple ]; then '"\\" >> $@
|
||||||
@@ -1213,7 +1389,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.
|
||||||
@@ -1222,7 +1398,7 @@ Makefile.simple: ${MAKE_FILE}
|
|||||||
|
|
||||||
depend:
|
depend:
|
||||||
${Q} if [ -f ${MAKE_FILE}.bak ]; then \
|
${Q} if [ -f ${MAKE_FILE}.bak ]; then \
|
||||||
echo "${MAKE_FILE}.bak exists, remove or move it"; \
|
echo "custom/${MAKE_FILE}.bak exists, remove or move it"; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
else \
|
else \
|
||||||
${TRUE}; \
|
${TRUE}; \
|
||||||
@@ -1238,9 +1414,7 @@ depend:
|
|||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
-${Q} for i in ${H_SRC} /dev/null; do \
|
-${Q} for i in ${H_SRC} /dev/null; do \
|
||||||
if [ "$$i" = "/dev/null" ]; then \
|
if [ "$$i" = "/dev/null" ]; then continue; fi; \
|
||||||
continue; \
|
|
||||||
fi; \
|
|
||||||
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
||||||
echo "#if !defined($$tag)" > "skel/custom/$$i"; \
|
echo "#if !defined($$tag)" > "skel/custom/$$i"; \
|
||||||
echo "#define $$tag" >> "skel/custom/$$i"; \
|
echo "#define $$tag" >> "skel/custom/$$i"; \
|
||||||
@@ -1249,25 +1423,25 @@ depend:
|
|||||||
echo '#endif /* '"$$tag"' */' >> "skel/custom/$$i"; \
|
echo '#endif /* '"$$tag"' */' >> "skel/custom/$$i"; \
|
||||||
done
|
done
|
||||||
${Q} (cd ..; ${MAKE} -f ${TOP_MAKE_FILE} hsrc)
|
${Q} (cd ..; ${MAKE} -f ${TOP_MAKE_FILE} hsrc)
|
||||||
${Q} for i in `cd ..; ${MAKE} -f ${TOP_MAKE_FILE} h_list 2>&1 | \
|
${MAKE} -f ../${TOP_MAKE_FILE} h_list 2>/dev/null | \
|
||||||
${SED} -e '/Entering directory/d' \
|
while read i; do \
|
||||||
-e '/Nothing to be done/d' \
|
if [ ! -f "../$$i" ]; then continue; fi; \
|
||||||
-e '/Leaving directory/d'` /dev/null; do \
|
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
||||||
if [ "$$i" = "/dev/null" ]; then \
|
echo "#if !defined($$tag)" > "skel/$$i"; \
|
||||||
continue; \
|
echo "#define $$tag" >> "skel/$$i"; \
|
||||||
fi; \
|
${SED} -n '/^#[ ]*include[ ]*"/p' "../$$i" \
|
||||||
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
>> "skel/$$i"; \
|
||||||
echo "#if !defined($$tag)" > "skel/$$i"; \
|
echo '#endif /* '"$$tag"' */' >> "skel/$$i"; \
|
||||||
echo "#define $$tag" >> "skel/$$i"; \
|
done
|
||||||
${SED} -n '/^#[ ]*include[ ]*"/p' "../$$i" \
|
|
||||||
>> "skel/$$i"; \
|
|
||||||
echo '#endif /* '"$$tag"' */' >> "skel/$$i"; \
|
|
||||||
done
|
|
||||||
${Q} ${RM} -f skel/custom/makedep.out
|
${Q} ${RM} -f skel/custom/makedep.out
|
||||||
${Q} echo custom/skel formed
|
${Q} echo custom/skel formed
|
||||||
${Q} echo forming custom dependency list
|
${Q} echo forming custom dependency list
|
||||||
${Q} :> skel/custom/makedep.out
|
${Q} :> skel/custom/makedep.out
|
||||||
${Q} cd skel/custom; ${MAKEDEPEND} -I.. -w 1 -f makedep.out ${C_SRC}
|
${Q} cd skel/custom; ${MAKEDEPEND} \
|
||||||
|
-I../../.. -w 1 -f makedep.out -- \
|
||||||
|
${CFLAGS} -- \
|
||||||
|
${C_SRC} 2>/dev/null
|
||||||
|
${Q} ${SED} -e 's|: ../../|: |' -E -i '' -l skel/custom/makedep.out
|
||||||
-${Q} for i in ${C_SRC} /dev/null; do \
|
-${Q} for i in ${C_SRC} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo "$$i" | ${SED} 's/^\(.*\)\.c/\1.o: \1.c/'; \
|
echo "$$i" | ${SED} 's/^\(.*\)\.c/\1.o: \1.c/'; \
|
||||||
@@ -1282,22 +1456,16 @@ depend:
|
|||||||
${Q} ${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' \
|
${Q} ${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' \
|
||||||
${MAKE_FILE}.bak > ${MAKE_FILE}
|
${MAKE_FILE}.bak > ${MAKE_FILE}
|
||||||
${Q} ${GREP} -v '^#' skel/custom/makedep.out >> ${MAKE_FILE}
|
${Q} ${GREP} -v '^#' skel/custom/makedep.out >> ${MAKE_FILE}
|
||||||
|
${Q} echo removing skel
|
||||||
${Q} ${RM} -rf skel
|
${Q} ${RM} -rf skel
|
||||||
-${Q} if ${CMP} -s ${MAKE_FILE}.bak ${MAKE_FILE}; then \
|
-${Q} if ${CMP} -s ${MAKE_FILE}.bak ${MAKE_FILE}; then \
|
||||||
echo 'custom ${MAKE_FILE} was already up to date'; \
|
echo 'custom/${MAKE_FILE} was already up to date'; \
|
||||||
|
echo 'restoring original custom/${MAKE_FILE}'; \
|
||||||
${MV} -f ${MAKE_FILE}.bak ${MAKE_FILE}; \
|
${MV} -f ${MAKE_FILE}.bak ${MAKE_FILE}; \
|
||||||
else \
|
else \
|
||||||
${RM} -f ${MAKE_FILE}.tmp; \
|
echo 'old custom/${MAKE_FILE} is now custom/${MAKE_FILE}.bak'; \
|
||||||
${MV} ${MAKE_FILE} ${MAKE_FILE}.tmp; \
|
echo 'new custom/${MAKE_FILE} formed'; \
|
||||||
if [ -d RCS -a ! -w "${MAKE_FILE}" ]; then \
|
echo 'try: diff -u custom/${MAKE_FILE}.bak custom/${MAKE_FILE}'; \
|
||||||
${CO} -l ${MAKE_FILE}; \
|
|
||||||
fi ;\
|
|
||||||
${MV} ${MAKE_FILE}.tmp ${MAKE_FILE}; \
|
|
||||||
if [ -d RCS ]; then \
|
|
||||||
echo '****************************************************'; \
|
|
||||||
echo 'new custom ${MAKE_FILE} formed -- you to check it in'; \
|
|
||||||
echo '****************************************************'; \
|
|
||||||
fi; \
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##
|
##
|
||||||
@@ -1344,6 +1512,7 @@ clobber: clean
|
|||||||
${RM} -f libcustcalc${LIB_EXT}
|
${RM} -f libcustcalc${LIB_EXT}
|
||||||
${RM} -f libcustcalc.a
|
${RM} -f libcustcalc.a
|
||||||
${RM} -f libcustcalc*
|
${RM} -f libcustcalc*
|
||||||
|
${RM} -rf skel
|
||||||
${V} echo remove files that are obsolete
|
${V} echo remove files that are obsolete
|
||||||
#if 0 /* start of skip for non-Gnu makefiles */
|
#if 0 /* start of skip for non-Gnu makefiles */
|
||||||
${RM} -f Makefile.simple
|
${RM} -f Makefile.simple
|
||||||
@@ -1531,7 +1700,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 +1712,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 +1725,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 +1738,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
|
||||||
@@ -1590,6 +1759,7 @@ uninstall:
|
|||||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||||
|
|
||||||
c_argv.o: ../alloc.h
|
c_argv.o: ../alloc.h
|
||||||
|
c_argv.o: ../banned.h
|
||||||
c_argv.o: ../block.h
|
c_argv.o: ../block.h
|
||||||
c_argv.o: ../byteswap.h
|
c_argv.o: ../byteswap.h
|
||||||
c_argv.o: ../calc.h
|
c_argv.o: ../calc.h
|
||||||
@@ -1600,6 +1770,7 @@ c_argv.o: ../custom.h
|
|||||||
c_argv.o: ../decl.h
|
c_argv.o: ../decl.h
|
||||||
c_argv.o: ../endian_calc.h
|
c_argv.o: ../endian_calc.h
|
||||||
c_argv.o: ../hash.h
|
c_argv.o: ../hash.h
|
||||||
|
c_argv.o: ../have_ban_pragma.h
|
||||||
c_argv.o: ../have_const.h
|
c_argv.o: ../have_const.h
|
||||||
c_argv.o: ../have_memmv.h
|
c_argv.o: ../have_memmv.h
|
||||||
c_argv.o: ../have_newstr.h
|
c_argv.o: ../have_newstr.h
|
||||||
@@ -1615,6 +1786,7 @@ c_argv.o: ../value.h
|
|||||||
c_argv.o: ../zmath.h
|
c_argv.o: ../zmath.h
|
||||||
c_argv.o: c_argv.c
|
c_argv.o: c_argv.c
|
||||||
c_devnull.o: ../alloc.h
|
c_devnull.o: ../alloc.h
|
||||||
|
c_devnull.o: ../banned.h
|
||||||
c_devnull.o: ../block.h
|
c_devnull.o: ../block.h
|
||||||
c_devnull.o: ../byteswap.h
|
c_devnull.o: ../byteswap.h
|
||||||
c_devnull.o: ../calcerr.h
|
c_devnull.o: ../calcerr.h
|
||||||
@@ -1624,6 +1796,7 @@ c_devnull.o: ../custom.h
|
|||||||
c_devnull.o: ../decl.h
|
c_devnull.o: ../decl.h
|
||||||
c_devnull.o: ../endian_calc.h
|
c_devnull.o: ../endian_calc.h
|
||||||
c_devnull.o: ../hash.h
|
c_devnull.o: ../hash.h
|
||||||
|
c_devnull.o: ../have_ban_pragma.h
|
||||||
c_devnull.o: ../have_const.h
|
c_devnull.o: ../have_const.h
|
||||||
c_devnull.o: ../have_memmv.h
|
c_devnull.o: ../have_memmv.h
|
||||||
c_devnull.o: ../have_newstr.h
|
c_devnull.o: ../have_newstr.h
|
||||||
@@ -1640,6 +1813,7 @@ c_devnull.o: ../value.h
|
|||||||
c_devnull.o: ../zmath.h
|
c_devnull.o: ../zmath.h
|
||||||
c_devnull.o: c_devnull.c
|
c_devnull.o: c_devnull.c
|
||||||
c_help.o: ../alloc.h
|
c_help.o: ../alloc.h
|
||||||
|
c_help.o: ../banned.h
|
||||||
c_help.o: ../block.h
|
c_help.o: ../block.h
|
||||||
c_help.o: ../byteswap.h
|
c_help.o: ../byteswap.h
|
||||||
c_help.o: ../calcerr.h
|
c_help.o: ../calcerr.h
|
||||||
@@ -1649,6 +1823,7 @@ c_help.o: ../custom.h
|
|||||||
c_help.o: ../decl.h
|
c_help.o: ../decl.h
|
||||||
c_help.o: ../endian_calc.h
|
c_help.o: ../endian_calc.h
|
||||||
c_help.o: ../hash.h
|
c_help.o: ../hash.h
|
||||||
|
c_help.o: ../have_ban_pragma.h
|
||||||
c_help.o: ../have_const.h
|
c_help.o: ../have_const.h
|
||||||
c_help.o: ../have_memmv.h
|
c_help.o: ../have_memmv.h
|
||||||
c_help.o: ../have_newstr.h
|
c_help.o: ../have_newstr.h
|
||||||
@@ -1665,6 +1840,7 @@ c_help.o: ../value.h
|
|||||||
c_help.o: ../zmath.h
|
c_help.o: ../zmath.h
|
||||||
c_help.o: c_help.c
|
c_help.o: c_help.c
|
||||||
c_pmodm127.o: ../alloc.h
|
c_pmodm127.o: ../alloc.h
|
||||||
|
c_pmodm127.o: ../banned.h
|
||||||
c_pmodm127.o: ../block.h
|
c_pmodm127.o: ../block.h
|
||||||
c_pmodm127.o: ../byteswap.h
|
c_pmodm127.o: ../byteswap.h
|
||||||
c_pmodm127.o: ../calcerr.h
|
c_pmodm127.o: ../calcerr.h
|
||||||
@@ -1674,6 +1850,7 @@ c_pmodm127.o: ../custom.h
|
|||||||
c_pmodm127.o: ../decl.h
|
c_pmodm127.o: ../decl.h
|
||||||
c_pmodm127.o: ../endian_calc.h
|
c_pmodm127.o: ../endian_calc.h
|
||||||
c_pmodm127.o: ../hash.h
|
c_pmodm127.o: ../hash.h
|
||||||
|
c_pmodm127.o: ../have_ban_pragma.h
|
||||||
c_pmodm127.o: ../have_const.h
|
c_pmodm127.o: ../have_const.h
|
||||||
c_pmodm127.o: ../have_memmv.h
|
c_pmodm127.o: ../have_memmv.h
|
||||||
c_pmodm127.o: ../have_newstr.h
|
c_pmodm127.o: ../have_newstr.h
|
||||||
@@ -1689,6 +1866,7 @@ c_pmodm127.o: ../value.h
|
|||||||
c_pmodm127.o: ../zmath.h
|
c_pmodm127.o: ../zmath.h
|
||||||
c_pmodm127.o: c_pmodm127.c
|
c_pmodm127.o: c_pmodm127.c
|
||||||
c_pzasusb8.o: ../alloc.h
|
c_pzasusb8.o: ../alloc.h
|
||||||
|
c_pzasusb8.o: ../banned.h
|
||||||
c_pzasusb8.o: ../block.h
|
c_pzasusb8.o: ../block.h
|
||||||
c_pzasusb8.o: ../byteswap.h
|
c_pzasusb8.o: ../byteswap.h
|
||||||
c_pzasusb8.o: ../calcerr.h
|
c_pzasusb8.o: ../calcerr.h
|
||||||
@@ -1698,6 +1876,7 @@ c_pzasusb8.o: ../custom.h
|
|||||||
c_pzasusb8.o: ../decl.h
|
c_pzasusb8.o: ../decl.h
|
||||||
c_pzasusb8.o: ../endian_calc.h
|
c_pzasusb8.o: ../endian_calc.h
|
||||||
c_pzasusb8.o: ../hash.h
|
c_pzasusb8.o: ../hash.h
|
||||||
|
c_pzasusb8.o: ../have_ban_pragma.h
|
||||||
c_pzasusb8.o: ../have_const.h
|
c_pzasusb8.o: ../have_const.h
|
||||||
c_pzasusb8.o: ../have_memmv.h
|
c_pzasusb8.o: ../have_memmv.h
|
||||||
c_pzasusb8.o: ../have_newstr.h
|
c_pzasusb8.o: ../have_newstr.h
|
||||||
@@ -1713,6 +1892,7 @@ c_pzasusb8.o: ../value.h
|
|||||||
c_pzasusb8.o: ../zmath.h
|
c_pzasusb8.o: ../zmath.h
|
||||||
c_pzasusb8.o: c_pzasusb8.c
|
c_pzasusb8.o: c_pzasusb8.c
|
||||||
c_register.o: ../alloc.h
|
c_register.o: ../alloc.h
|
||||||
|
c_register.o: ../banned.h
|
||||||
c_register.o: ../block.h
|
c_register.o: ../block.h
|
||||||
c_register.o: ../byteswap.h
|
c_register.o: ../byteswap.h
|
||||||
c_register.o: ../calc.h
|
c_register.o: ../calc.h
|
||||||
@@ -1723,6 +1903,7 @@ c_register.o: ../custom.h
|
|||||||
c_register.o: ../decl.h
|
c_register.o: ../decl.h
|
||||||
c_register.o: ../endian_calc.h
|
c_register.o: ../endian_calc.h
|
||||||
c_register.o: ../hash.h
|
c_register.o: ../hash.h
|
||||||
|
c_register.o: ../have_ban_pragma.h
|
||||||
c_register.o: ../have_const.h
|
c_register.o: ../have_const.h
|
||||||
c_register.o: ../have_memmv.h
|
c_register.o: ../have_memmv.h
|
||||||
c_register.o: ../have_newstr.h
|
c_register.o: ../have_newstr.h
|
||||||
@@ -1738,6 +1919,7 @@ c_register.o: ../value.h
|
|||||||
c_register.o: ../zmath.h
|
c_register.o: ../zmath.h
|
||||||
c_register.o: c_register.c
|
c_register.o: c_register.c
|
||||||
c_sysinfo.o: ../alloc.h
|
c_sysinfo.o: ../alloc.h
|
||||||
|
c_sysinfo.o: ../banned.h
|
||||||
c_sysinfo.o: ../block.h
|
c_sysinfo.o: ../block.h
|
||||||
c_sysinfo.o: ../byteswap.h
|
c_sysinfo.o: ../byteswap.h
|
||||||
c_sysinfo.o: ../calc.h
|
c_sysinfo.o: ../calc.h
|
||||||
@@ -1750,6 +1932,7 @@ c_sysinfo.o: ../decl.h
|
|||||||
c_sysinfo.o: ../endian_calc.h
|
c_sysinfo.o: ../endian_calc.h
|
||||||
c_sysinfo.o: ../fposval.h
|
c_sysinfo.o: ../fposval.h
|
||||||
c_sysinfo.o: ../hash.h
|
c_sysinfo.o: ../hash.h
|
||||||
|
c_sysinfo.o: ../have_ban_pragma.h
|
||||||
c_sysinfo.o: ../have_const.h
|
c_sysinfo.o: ../have_const.h
|
||||||
c_sysinfo.o: ../have_memmv.h
|
c_sysinfo.o: ../have_memmv.h
|
||||||
c_sysinfo.o: ../have_newstr.h
|
c_sysinfo.o: ../have_newstr.h
|
||||||
@@ -1770,6 +1953,7 @@ c_sysinfo.o: ../zrand.h
|
|||||||
c_sysinfo.o: ../zrandom.h
|
c_sysinfo.o: ../zrandom.h
|
||||||
c_sysinfo.o: c_sysinfo.c
|
c_sysinfo.o: c_sysinfo.c
|
||||||
custtbl.o: ../alloc.h
|
custtbl.o: ../alloc.h
|
||||||
|
custtbl.o: ../banned.h
|
||||||
custtbl.o: ../block.h
|
custtbl.o: ../block.h
|
||||||
custtbl.o: ../byteswap.h
|
custtbl.o: ../byteswap.h
|
||||||
custtbl.o: ../calcerr.h
|
custtbl.o: ../calcerr.h
|
||||||
@@ -1779,6 +1963,7 @@ custtbl.o: ../custom.h
|
|||||||
custtbl.o: ../decl.h
|
custtbl.o: ../decl.h
|
||||||
custtbl.o: ../endian_calc.h
|
custtbl.o: ../endian_calc.h
|
||||||
custtbl.o: ../hash.h
|
custtbl.o: ../hash.h
|
||||||
|
custtbl.o: ../have_ban_pragma.h
|
||||||
custtbl.o: ../have_const.h
|
custtbl.o: ../have_const.h
|
||||||
custtbl.o: ../have_memmv.h
|
custtbl.o: ../have_memmv.h
|
||||||
custtbl.o: ../have_newstr.h
|
custtbl.o: ../have_newstr.h
|
||||||
@@ -1792,3 +1977,7 @@ custtbl.o: ../str.h
|
|||||||
custtbl.o: ../value.h
|
custtbl.o: ../value.h
|
||||||
custtbl.o: ../zmath.h
|
custtbl.o: ../zmath.h
|
||||||
custtbl.o: custtbl.c
|
custtbl.o: custtbl.c
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
# NOTE: End of section from custom/Makefile.tail #
|
||||||
|
##################################################
|
||||||
|
@@ -2,7 +2,15 @@
|
|||||||
#
|
#
|
||||||
# custom - makefile for calc custom routines
|
# custom - makefile for calc custom routines
|
||||||
#
|
#
|
||||||
# Copyright (C) 1999-2006,2014,2017-2018 Landon Curt Noll
|
# Copyright (C) 1999-2006,2014,2017-2018,2021 Landon Curt Noll
|
||||||
|
#
|
||||||
|
# SRC: custom/Makefile.head
|
||||||
|
#
|
||||||
|
# The "# SRC: ... - ..." comment line above indicates
|
||||||
|
# the origin of this file.
|
||||||
|
#
|
||||||
|
# IMPORTANT: Please see the section on Makefiles near the
|
||||||
|
# bottom of the HOWTO.INSTALL file.
|
||||||
#
|
#
|
||||||
# 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,7 +35,123 @@
|
|||||||
# 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
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
# NOTE: Start of section from custom/Makefile.head #
|
||||||
|
####################################################
|
||||||
|
|
||||||
|
#.###############################################################.#
|
||||||
|
#.# #.#
|
||||||
|
#.# WARNING: This Makefile is generated from a combination of #.#
|
||||||
|
#.# custom/Makefile.head, Makefile.ship, and #.#
|
||||||
|
#.# custom/Makefile.tail. We recommend that you NOT #.#
|
||||||
|
#.# edit this file, but instead edit the proper source #.#
|
||||||
|
#.# file and then make custom/Makefile: #.#
|
||||||
|
#.# #.#
|
||||||
|
#.# make custom/Makefile #.#
|
||||||
|
#.# #.#
|
||||||
|
#.# See the '# NOTE .. section from ..' lines for #.#
|
||||||
|
#.# where the source file for the lines are from. #.#
|
||||||
|
#.# #.#
|
||||||
|
#.###############################################################.#
|
||||||
|
|
||||||
|
|
||||||
|
# The shell used by this Makefile
|
||||||
|
#
|
||||||
|
# On some systems, /bin/sh is a rather reduced shell with
|
||||||
|
# deprecated behavior.
|
||||||
|
#
|
||||||
|
# If your system has a up to date, bash shell, then
|
||||||
|
# you may wish to use:
|
||||||
|
#
|
||||||
|
# SHELL= /bin/bash
|
||||||
|
#
|
||||||
|
# On some systems such as macOS, the bash shell is very
|
||||||
|
# far behind to the point where is cannot be depended on.
|
||||||
|
# On such systems, the zsh may be a much better alternative
|
||||||
|
# shell for this Makefile to use:
|
||||||
|
#
|
||||||
|
# SHELL= /bin/zsh
|
||||||
|
#
|
||||||
|
SHELL= /bin/sh
|
||||||
|
#SHELL= /bin/bash
|
||||||
|
#SHELL= /bin/zsh
|
||||||
|
|
||||||
|
|
||||||
|
# PREFIX - Top level location for calc
|
||||||
|
#
|
||||||
|
# The PREFIX is often prepended to paths within calc and calc Makefiles.
|
||||||
|
#
|
||||||
|
# Starting with calc v2.13.0.1, nearly all Makefile places that used
|
||||||
|
# /usr/local now use ${PREFIX}. An exception is the olduninstall rule
|
||||||
|
# and, of course, this section. :-)
|
||||||
|
#
|
||||||
|
# NOTE: The ${PREFIX} is not the same as ${T}. The ${T} specifies
|
||||||
|
# a top level directory under which calc installs things.
|
||||||
|
# While usually ${T} is empty, it can be specific path
|
||||||
|
# as if calc where "chrooted" during an install.
|
||||||
|
# The ${PREFIX} value, during install, is a path between
|
||||||
|
# the top level ${T} install directory and the object
|
||||||
|
# such as an include file.
|
||||||
|
#
|
||||||
|
# NOTE: See also, ${T}, below.
|
||||||
|
#
|
||||||
|
# There are some paths that do NOT call under ${PREFIX}, such as
|
||||||
|
# ${CALCPATH}, that include paths not under ${PREFIX}, but those
|
||||||
|
# too are exceptions to this general rule.
|
||||||
|
#
|
||||||
|
# When in doubt, try:
|
||||||
|
#
|
||||||
|
# PREFIX= /usr/local
|
||||||
|
#
|
||||||
|
PREFIX= /usr/local
|
||||||
|
#PREFIX= /usr
|
||||||
|
#PREFIX= /usr/global
|
||||||
|
|
||||||
|
|
||||||
|
# CCBAN is given to ${CC} in order to control if banned.h is in effect.
|
||||||
|
#
|
||||||
|
# The banned.h attempts to ban the use of certain dangerous functions
|
||||||
|
# that, if improperly used, could compromise the computational integrity
|
||||||
|
# if calculations.
|
||||||
|
#
|
||||||
|
# In the case of calc, we are motivated in part by the desire for calc
|
||||||
|
# to correctly calculate: even during extremely long calculations.
|
||||||
|
#
|
||||||
|
# If UNBAN is NOT defined, then calling certain functions
|
||||||
|
# will result in a call to a non-existent function (link error).
|
||||||
|
#
|
||||||
|
# While we do NOT encourage defining UNBAN, there may be
|
||||||
|
# a system / compiler environment where re-defining a
|
||||||
|
# function may lead to a fatal compiler complication.
|
||||||
|
# If that happens, consider compiling as:
|
||||||
|
#
|
||||||
|
# make clobber all chk CCBAN=-DUNBAN
|
||||||
|
#
|
||||||
|
# as see if this is a work-a-round.
|
||||||
|
#
|
||||||
|
# If YOU discover a need for the -DUNBAN work-a-round, PLEASE tell us!
|
||||||
|
# Please send us a bug report. See the file:
|
||||||
|
#
|
||||||
|
# BUGS
|
||||||
|
#
|
||||||
|
# or the URL:
|
||||||
|
#
|
||||||
|
# http://www.isthe.com/chongo/tech/comp/calc/calc-bugrept.html
|
||||||
|
#
|
||||||
|
# for how to send us such a bug report.
|
||||||
|
#
|
||||||
|
CCBAN= -UUNBAN
|
||||||
|
#CCBAN= -DUNBAN
|
||||||
|
|
||||||
|
|
||||||
#if 0 /* start of skip for non-Gnu makefiles */
|
#if 0 /* start of skip for non-Gnu makefiles */
|
||||||
|
|
||||||
|
# Unfortunately due to the complex dependency issues between
|
||||||
|
# Makefile, Makefile.ship and custom/Makefile, parallel GNU make
|
||||||
|
# is NOT recommended. Sorry.
|
||||||
|
#
|
||||||
|
.NOTPARALLEL:
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#-=-=-=-=-=-=-=-=- Identify the target machine, if possible -=-=-=-=-=-=-=-=-#
|
#-=-=-=-=-=-=-=-=- Identify the target machine, if possible -=-=-=-=-=-=-=-=-#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@@ -36,7 +160,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)
|
||||||
@@ -96,14 +220,38 @@ CUSTOM_OBJ= c_argv.o c_devnull.o c_help.o c_sysinfo.o c_pzasusb8.o \
|
|||||||
|
|
||||||
# Normally, the upper level makefile will set these values. We provide
|
# Normally, the upper level makefile will set these values. We provide
|
||||||
# a default here just in case you want to build from this directory.
|
# a default here just in case you want to build from this directory.
|
||||||
#
|
|
||||||
# Makefile debug
|
# Makefile debug
|
||||||
#
|
#
|
||||||
# Q=@ do not echo internal makefile actions (quiet mode)
|
# Q=@ do not echo internal Makefile actions (quiet mode)
|
||||||
# Q= echo internal makefile actions (debug / verbose mode)
|
# Q= echo internal Makefile actions (debug / verbose mode)
|
||||||
|
#
|
||||||
|
# H=@: do not report hsrc file formation progress
|
||||||
|
# H=@ do echo hsrc file formation progress
|
||||||
|
#
|
||||||
|
# S= >/dev/null 2>&1 slience ${CC} output during hsrc file formation
|
||||||
|
# S= full ${CC} output during hsrc file formation
|
||||||
|
#
|
||||||
|
# E= 2>/dev/null slience command stderr during hsrc file formation
|
||||||
|
# E= full command stderr during hsrc file formation
|
||||||
|
#
|
||||||
|
# V=@: do not echo debug statements (quiet mode)
|
||||||
|
# V=@ do echo debug statements (debug / verbose mode)
|
||||||
#
|
#
|
||||||
#Q=
|
#Q=
|
||||||
Q=@
|
Q=@
|
||||||
|
#
|
||||||
|
S= >/dev/null 2>&1
|
||||||
|
#S=
|
||||||
|
#
|
||||||
|
E= 2>/dev/null
|
||||||
|
#E=
|
||||||
|
#
|
||||||
|
#H=@:
|
||||||
|
H=@
|
||||||
|
#
|
||||||
|
V=@:
|
||||||
|
#V=@
|
||||||
|
|
||||||
####
|
####
|
||||||
# Normally, the upper level makefile will set these values. We provide
|
# Normally, the upper level makefile will set these values. We provide
|
||||||
@@ -121,11 +269,11 @@ Q=@
|
|||||||
# INCDIR= /usr/include
|
# INCDIR= /usr/include
|
||||||
#
|
#
|
||||||
|
|
||||||
#INCDIR= /usr/local/include
|
#INCDIR= ${PREFIX}/include
|
||||||
#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
|
||||||
@@ -147,15 +295,15 @@ INCDIR= /usr/include
|
|||||||
# LIBDIR= /usr/lib
|
# LIBDIR= /usr/lib
|
||||||
# CALC_SHAREDIR= /usr/share/calc
|
# CALC_SHAREDIR= /usr/share/calc
|
||||||
#
|
#
|
||||||
#BINDIR= /usr/local/bin
|
#BINDIR= ${PREFIX}/bin
|
||||||
#BINDIR= /dev/env/DJDIR/bin
|
#BINDIR= /dev/env/DJDIR/bin
|
||||||
BINDIR= /usr/bin
|
BINDIR= /usr/bin
|
||||||
|
|
||||||
#LIBDIR= /usr/local/lib
|
#LIBDIR= ${PREFIX}/lib
|
||||||
#LIBDIR= /dev/env/DJDIR/lib
|
#LIBDIR= /dev/env/DJDIR/lib
|
||||||
LIBDIR= /usr/lib
|
LIBDIR= /usr/lib
|
||||||
|
|
||||||
#CALC_SHAREDIR= /usr/local/lib/calc
|
#CALC_SHAREDIR= ${PREFIX}/lib/calc
|
||||||
#CALC_SHAREDIR= /dev/env/DJDIR/share/calc
|
#CALC_SHAREDIR= /dev/env/DJDIR/share/calc
|
||||||
CALC_SHAREDIR= /usr/share/calc
|
CALC_SHAREDIR= /usr/share/calc
|
||||||
|
|
||||||
@@ -348,7 +496,7 @@ EXT=
|
|||||||
|
|
||||||
# The default calc versions
|
# The default calc versions
|
||||||
#
|
#
|
||||||
VERSION= 2.12.6.9
|
VERSION= 2.14.0.8
|
||||||
|
|
||||||
# Names of shared libraries with versions
|
# Names of shared libraries with versions
|
||||||
#
|
#
|
||||||
@@ -357,26 +505,25 @@ LIB_EXT_VERSION= ${LIB_EXT}.${VERSION}
|
|||||||
|
|
||||||
# standard tools
|
# standard tools
|
||||||
#
|
#
|
||||||
SHELL= /bin/sh
|
|
||||||
SED= sed
|
|
||||||
MAKEDEPEND= makedepend
|
|
||||||
GREP= egrep
|
|
||||||
CHMOD= chmod
|
|
||||||
FMT= fmt
|
|
||||||
SORT= sort
|
|
||||||
CMP= cmp
|
|
||||||
AR= ar
|
AR= ar
|
||||||
RM= rm
|
|
||||||
TOUCH= touch
|
|
||||||
MKDIR= mkdir
|
|
||||||
RMDIR= rmdir
|
|
||||||
MV= mv
|
|
||||||
CP= cp
|
|
||||||
CO= co
|
|
||||||
TRUE= true
|
|
||||||
MAKE= make
|
|
||||||
LN= ln
|
|
||||||
AWK= awk
|
AWK= awk
|
||||||
|
CHMOD= chmod
|
||||||
|
CMP= cmp
|
||||||
|
CO= co
|
||||||
|
CP= cp
|
||||||
|
FMT= fmt
|
||||||
|
GREP= egrep
|
||||||
|
LN= ln
|
||||||
|
MAKE= make
|
||||||
|
MAKEDEPEND= makedepend
|
||||||
|
MKDIR= mkdir
|
||||||
|
MV= mv
|
||||||
|
RM= rm
|
||||||
|
RMDIR= rmdir
|
||||||
|
SED= sed
|
||||||
|
SORT= sort
|
||||||
|
TOUCH= touch
|
||||||
|
TRUE= true
|
||||||
|
|
||||||
# EXTRA_CFLAGS are flags given to ${CC} when compiling C files
|
# EXTRA_CFLAGS are flags given to ${CC} when compiling C files
|
||||||
# EXTRA_LDFLAGS are flags given to ${CC} when linking progs
|
# EXTRA_LDFLAGS are flags given to ${CC} when linking progs
|
||||||
@@ -391,7 +538,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=
|
||||||
@@ -420,9 +567,9 @@ COMMON_LDFLAGS= ${EXTRA_LDFLAGS}
|
|||||||
# NOTE: This does not work for: make-XYZ-only and BLD_TYPE != make-XYZ-only
|
# NOTE: This does not work for: make-XYZ-only and BLD_TYPE != make-XYZ-only
|
||||||
#
|
#
|
||||||
ifeq ($(BLD_TYPE),calc-static-only)
|
ifeq ($(BLD_TYPE),calc-static-only)
|
||||||
ICFLAGS= ${COMMON_CFLAGS} ${CC_STATIC}
|
ICFLAGS= ${COMMON_CFLAGS} ${CCBAN} ${CC_STATIC}
|
||||||
else
|
else
|
||||||
ICFLAGS= ${COMMON_CFLAGS} ${CC_SHARE}
|
ICFLAGS= ${COMMON_CFLAGS} ${CCBAN} ${CC_SHARE}
|
||||||
endif
|
endif
|
||||||
CFLAGS= ${ICFLAGS} ${CCOPT}
|
CFLAGS= ${ICFLAGS} ${CCOPT}
|
||||||
|
|
||||||
@@ -435,3 +582,7 @@ ILDFLAGS= ${COMMON_LDFLAGS}
|
|||||||
LDFLAGS= ${LD_DEBUG} ${ILDFLAGS}
|
LDFLAGS= ${LD_DEBUG} ${ILDFLAGS}
|
||||||
|
|
||||||
#endif /* end of skip for non-Gnu makefiles */
|
#endif /* end of skip for non-Gnu makefiles */
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
# NOTE: End of section from custom/Makefile.head #
|
||||||
|
##################################################
|
||||||
|
@@ -1,3 +1,18 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 1999-2006,2014,2017-2018,2021 Landon Curt Noll
|
||||||
|
#
|
||||||
|
# SRC: custom/Makefile.tail
|
||||||
|
#
|
||||||
|
# The "# SRC: ... - ..." comment line above indicates
|
||||||
|
# the origin of this file.
|
||||||
|
#
|
||||||
|
# IMPORTANT: Please see the section on Makefiles near the
|
||||||
|
# bottom of the HOWTO.INSTALL file.
|
||||||
|
|
||||||
|
####################################################
|
||||||
|
# NOTE: Start of section from custom/Makefile.tail #
|
||||||
|
####################################################
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#-=-=-=-=-=-=-=-=- Be careful if you change something below -=-=-=-=-=-=-=-=-#
|
#-=-=-=-=-=-=-=-=- Be careful if you change something below -=-=-=-=-=-=-=-=-#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@@ -32,7 +47,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 +64,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 +118,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 +137,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*
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
|
|
||||||
@@ -148,7 +163,10 @@ Makefile.simple: ${MAKE_FILE}
|
|||||||
${V} echo '=-=-=-=-= custom/${MAKE_FILE} start of $@ rule =-=-=-=-='
|
${V} echo '=-=-=-=-= custom/${MAKE_FILE} start of $@ rule =-=-=-=-='
|
||||||
${Q} ${RM} -f $@
|
${Q} ${RM} -f $@
|
||||||
${Q} ${AWK} '/^#if 0/{skp=1} {if(!skp){print $$0}} /^#endif/{skp=0}' \
|
${Q} ${AWK} '/^#if 0/{skp=1} {if(!skp){print $$0}} /^#endif/{skp=0}' \
|
||||||
${MAKE_FILE} > $@
|
${MAKE_FILE} | \
|
||||||
|
${GREP} -v '#\.#' | \
|
||||||
|
${SED} -e 's;^# SRC:.*;# SRC: non-GNU Makefile via;' \
|
||||||
|
-e 's;via$$;via ${MAKE} -f ${MAKE_FILE} custom/$@;' > $@
|
||||||
${Q} echo >> $@
|
${Q} echo >> $@
|
||||||
${Q} echo 'Makefile.simple:' >> $@
|
${Q} echo 'Makefile.simple:' >> $@
|
||||||
${Q} echo ' $${Q} if [ ! -f Makefile.simple ]; then '"\\" >> $@
|
${Q} echo ' $${Q} if [ ! -f Makefile.simple ]; then '"\\" >> $@
|
||||||
@@ -161,7 +179,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.
|
||||||
@@ -170,7 +188,7 @@ Makefile.simple: ${MAKE_FILE}
|
|||||||
|
|
||||||
depend:
|
depend:
|
||||||
${Q} if [ -f ${MAKE_FILE}.bak ]; then \
|
${Q} if [ -f ${MAKE_FILE}.bak ]; then \
|
||||||
echo "${MAKE_FILE}.bak exists, remove or move it"; \
|
echo "custom/${MAKE_FILE}.bak exists, remove or move it"; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
else \
|
else \
|
||||||
${TRUE}; \
|
${TRUE}; \
|
||||||
@@ -186,9 +204,7 @@ depend:
|
|||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
-${Q} for i in ${H_SRC} /dev/null; do \
|
-${Q} for i in ${H_SRC} /dev/null; do \
|
||||||
if [ "$$i" = "/dev/null" ]; then \
|
if [ "$$i" = "/dev/null" ]; then continue; fi; \
|
||||||
continue; \
|
|
||||||
fi; \
|
|
||||||
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
||||||
echo "#if !defined($$tag)" > "skel/custom/$$i"; \
|
echo "#if !defined($$tag)" > "skel/custom/$$i"; \
|
||||||
echo "#define $$tag" >> "skel/custom/$$i"; \
|
echo "#define $$tag" >> "skel/custom/$$i"; \
|
||||||
@@ -197,25 +213,25 @@ depend:
|
|||||||
echo '#endif /* '"$$tag"' */' >> "skel/custom/$$i"; \
|
echo '#endif /* '"$$tag"' */' >> "skel/custom/$$i"; \
|
||||||
done
|
done
|
||||||
${Q} (cd ..; ${MAKE} -f ${TOP_MAKE_FILE} hsrc)
|
${Q} (cd ..; ${MAKE} -f ${TOP_MAKE_FILE} hsrc)
|
||||||
${Q} for i in `cd ..; ${MAKE} -f ${TOP_MAKE_FILE} h_list 2>&1 | \
|
${MAKE} -f ../${TOP_MAKE_FILE} h_list 2>/dev/null | \
|
||||||
${SED} -e '/Entering directory/d' \
|
while read i; do \
|
||||||
-e '/Nothing to be done/d' \
|
if [ ! -f "../$$i" ]; then continue; fi; \
|
||||||
-e '/Leaving directory/d'` /dev/null; do \
|
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
||||||
if [ "$$i" = "/dev/null" ]; then \
|
echo "#if !defined($$tag)" > "skel/$$i"; \
|
||||||
continue; \
|
echo "#define $$tag" >> "skel/$$i"; \
|
||||||
fi; \
|
${SED} -n '/^#[ ]*include[ ]*"/p' "../$$i" \
|
||||||
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
>> "skel/$$i"; \
|
||||||
echo "#if !defined($$tag)" > "skel/$$i"; \
|
echo '#endif /* '"$$tag"' */' >> "skel/$$i"; \
|
||||||
echo "#define $$tag" >> "skel/$$i"; \
|
done
|
||||||
${SED} -n '/^#[ ]*include[ ]*"/p' "../$$i" \
|
|
||||||
>> "skel/$$i"; \
|
|
||||||
echo '#endif /* '"$$tag"' */' >> "skel/$$i"; \
|
|
||||||
done
|
|
||||||
${Q} ${RM} -f skel/custom/makedep.out
|
${Q} ${RM} -f skel/custom/makedep.out
|
||||||
${Q} echo custom/skel formed
|
${Q} echo custom/skel formed
|
||||||
${Q} echo forming custom dependency list
|
${Q} echo forming custom dependency list
|
||||||
${Q} :> skel/custom/makedep.out
|
${Q} :> skel/custom/makedep.out
|
||||||
${Q} cd skel/custom; ${MAKEDEPEND} -I.. -w 1 -f makedep.out ${C_SRC}
|
${Q} cd skel/custom; ${MAKEDEPEND} \
|
||||||
|
-I../../.. -w 1 -f makedep.out -- \
|
||||||
|
${CFLAGS} -- \
|
||||||
|
${C_SRC} 2>/dev/null
|
||||||
|
${Q} ${SED} -e 's|: ../../|: |' -E -i '' -l skel/custom/makedep.out
|
||||||
-${Q} for i in ${C_SRC} /dev/null; do \
|
-${Q} for i in ${C_SRC} /dev/null; do \
|
||||||
if [ X"$$i" != X"/dev/null" ]; then \
|
if [ X"$$i" != X"/dev/null" ]; then \
|
||||||
echo "$$i" | ${SED} 's/^\(.*\)\.c/\1.o: \1.c/'; \
|
echo "$$i" | ${SED} 's/^\(.*\)\.c/\1.o: \1.c/'; \
|
||||||
@@ -230,22 +246,16 @@ depend:
|
|||||||
${Q} ${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' \
|
${Q} ${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' \
|
||||||
${MAKE_FILE}.bak > ${MAKE_FILE}
|
${MAKE_FILE}.bak > ${MAKE_FILE}
|
||||||
${Q} ${GREP} -v '^#' skel/custom/makedep.out >> ${MAKE_FILE}
|
${Q} ${GREP} -v '^#' skel/custom/makedep.out >> ${MAKE_FILE}
|
||||||
|
${Q} echo removing skel
|
||||||
${Q} ${RM} -rf skel
|
${Q} ${RM} -rf skel
|
||||||
-${Q} if ${CMP} -s ${MAKE_FILE}.bak ${MAKE_FILE}; then \
|
-${Q} if ${CMP} -s ${MAKE_FILE}.bak ${MAKE_FILE}; then \
|
||||||
echo 'custom ${MAKE_FILE} was already up to date'; \
|
echo 'custom/${MAKE_FILE} was already up to date'; \
|
||||||
|
echo 'restoring original custom/${MAKE_FILE}'; \
|
||||||
${MV} -f ${MAKE_FILE}.bak ${MAKE_FILE}; \
|
${MV} -f ${MAKE_FILE}.bak ${MAKE_FILE}; \
|
||||||
else \
|
else \
|
||||||
${RM} -f ${MAKE_FILE}.tmp; \
|
echo 'old custom/${MAKE_FILE} is now custom/${MAKE_FILE}.bak'; \
|
||||||
${MV} ${MAKE_FILE} ${MAKE_FILE}.tmp; \
|
echo 'new custom/${MAKE_FILE} formed'; \
|
||||||
if [ -d RCS -a ! -w "${MAKE_FILE}" ]; then \
|
echo 'try: diff -u custom/${MAKE_FILE}.bak custom/${MAKE_FILE}'; \
|
||||||
${CO} -l ${MAKE_FILE}; \
|
|
||||||
fi ;\
|
|
||||||
${MV} ${MAKE_FILE}.tmp ${MAKE_FILE}; \
|
|
||||||
if [ -d RCS ]; then \
|
|
||||||
echo '****************************************************'; \
|
|
||||||
echo 'new custom ${MAKE_FILE} formed -- you to check it in'; \
|
|
||||||
echo '****************************************************'; \
|
|
||||||
fi; \
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
##
|
##
|
||||||
@@ -292,6 +302,7 @@ clobber: clean
|
|||||||
${RM} -f libcustcalc${LIB_EXT}
|
${RM} -f libcustcalc${LIB_EXT}
|
||||||
${RM} -f libcustcalc.a
|
${RM} -f libcustcalc.a
|
||||||
${RM} -f libcustcalc*
|
${RM} -f libcustcalc*
|
||||||
|
${RM} -rf skel
|
||||||
${V} echo remove files that are obsolete
|
${V} echo remove files that are obsolete
|
||||||
#if 0 /* start of skip for non-Gnu makefiles */
|
#if 0 /* start of skip for non-Gnu makefiles */
|
||||||
${RM} -f Makefile.simple
|
${RM} -f Makefile.simple
|
||||||
@@ -479,7 +490,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 +502,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 +515,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 +528,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
|
||||||
@@ -538,6 +549,7 @@ uninstall:
|
|||||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||||
|
|
||||||
c_argv.o: ../alloc.h
|
c_argv.o: ../alloc.h
|
||||||
|
c_argv.o: ../banned.h
|
||||||
c_argv.o: ../block.h
|
c_argv.o: ../block.h
|
||||||
c_argv.o: ../byteswap.h
|
c_argv.o: ../byteswap.h
|
||||||
c_argv.o: ../calc.h
|
c_argv.o: ../calc.h
|
||||||
@@ -548,6 +560,7 @@ c_argv.o: ../custom.h
|
|||||||
c_argv.o: ../decl.h
|
c_argv.o: ../decl.h
|
||||||
c_argv.o: ../endian_calc.h
|
c_argv.o: ../endian_calc.h
|
||||||
c_argv.o: ../hash.h
|
c_argv.o: ../hash.h
|
||||||
|
c_argv.o: ../have_ban_pragma.h
|
||||||
c_argv.o: ../have_const.h
|
c_argv.o: ../have_const.h
|
||||||
c_argv.o: ../have_memmv.h
|
c_argv.o: ../have_memmv.h
|
||||||
c_argv.o: ../have_newstr.h
|
c_argv.o: ../have_newstr.h
|
||||||
@@ -563,6 +576,7 @@ c_argv.o: ../value.h
|
|||||||
c_argv.o: ../zmath.h
|
c_argv.o: ../zmath.h
|
||||||
c_argv.o: c_argv.c
|
c_argv.o: c_argv.c
|
||||||
c_devnull.o: ../alloc.h
|
c_devnull.o: ../alloc.h
|
||||||
|
c_devnull.o: ../banned.h
|
||||||
c_devnull.o: ../block.h
|
c_devnull.o: ../block.h
|
||||||
c_devnull.o: ../byteswap.h
|
c_devnull.o: ../byteswap.h
|
||||||
c_devnull.o: ../calcerr.h
|
c_devnull.o: ../calcerr.h
|
||||||
@@ -572,6 +586,7 @@ c_devnull.o: ../custom.h
|
|||||||
c_devnull.o: ../decl.h
|
c_devnull.o: ../decl.h
|
||||||
c_devnull.o: ../endian_calc.h
|
c_devnull.o: ../endian_calc.h
|
||||||
c_devnull.o: ../hash.h
|
c_devnull.o: ../hash.h
|
||||||
|
c_devnull.o: ../have_ban_pragma.h
|
||||||
c_devnull.o: ../have_const.h
|
c_devnull.o: ../have_const.h
|
||||||
c_devnull.o: ../have_memmv.h
|
c_devnull.o: ../have_memmv.h
|
||||||
c_devnull.o: ../have_newstr.h
|
c_devnull.o: ../have_newstr.h
|
||||||
@@ -588,6 +603,7 @@ c_devnull.o: ../value.h
|
|||||||
c_devnull.o: ../zmath.h
|
c_devnull.o: ../zmath.h
|
||||||
c_devnull.o: c_devnull.c
|
c_devnull.o: c_devnull.c
|
||||||
c_help.o: ../alloc.h
|
c_help.o: ../alloc.h
|
||||||
|
c_help.o: ../banned.h
|
||||||
c_help.o: ../block.h
|
c_help.o: ../block.h
|
||||||
c_help.o: ../byteswap.h
|
c_help.o: ../byteswap.h
|
||||||
c_help.o: ../calcerr.h
|
c_help.o: ../calcerr.h
|
||||||
@@ -597,6 +613,7 @@ c_help.o: ../custom.h
|
|||||||
c_help.o: ../decl.h
|
c_help.o: ../decl.h
|
||||||
c_help.o: ../endian_calc.h
|
c_help.o: ../endian_calc.h
|
||||||
c_help.o: ../hash.h
|
c_help.o: ../hash.h
|
||||||
|
c_help.o: ../have_ban_pragma.h
|
||||||
c_help.o: ../have_const.h
|
c_help.o: ../have_const.h
|
||||||
c_help.o: ../have_memmv.h
|
c_help.o: ../have_memmv.h
|
||||||
c_help.o: ../have_newstr.h
|
c_help.o: ../have_newstr.h
|
||||||
@@ -613,6 +630,7 @@ c_help.o: ../value.h
|
|||||||
c_help.o: ../zmath.h
|
c_help.o: ../zmath.h
|
||||||
c_help.o: c_help.c
|
c_help.o: c_help.c
|
||||||
c_pmodm127.o: ../alloc.h
|
c_pmodm127.o: ../alloc.h
|
||||||
|
c_pmodm127.o: ../banned.h
|
||||||
c_pmodm127.o: ../block.h
|
c_pmodm127.o: ../block.h
|
||||||
c_pmodm127.o: ../byteswap.h
|
c_pmodm127.o: ../byteswap.h
|
||||||
c_pmodm127.o: ../calcerr.h
|
c_pmodm127.o: ../calcerr.h
|
||||||
@@ -622,6 +640,7 @@ c_pmodm127.o: ../custom.h
|
|||||||
c_pmodm127.o: ../decl.h
|
c_pmodm127.o: ../decl.h
|
||||||
c_pmodm127.o: ../endian_calc.h
|
c_pmodm127.o: ../endian_calc.h
|
||||||
c_pmodm127.o: ../hash.h
|
c_pmodm127.o: ../hash.h
|
||||||
|
c_pmodm127.o: ../have_ban_pragma.h
|
||||||
c_pmodm127.o: ../have_const.h
|
c_pmodm127.o: ../have_const.h
|
||||||
c_pmodm127.o: ../have_memmv.h
|
c_pmodm127.o: ../have_memmv.h
|
||||||
c_pmodm127.o: ../have_newstr.h
|
c_pmodm127.o: ../have_newstr.h
|
||||||
@@ -637,6 +656,7 @@ c_pmodm127.o: ../value.h
|
|||||||
c_pmodm127.o: ../zmath.h
|
c_pmodm127.o: ../zmath.h
|
||||||
c_pmodm127.o: c_pmodm127.c
|
c_pmodm127.o: c_pmodm127.c
|
||||||
c_pzasusb8.o: ../alloc.h
|
c_pzasusb8.o: ../alloc.h
|
||||||
|
c_pzasusb8.o: ../banned.h
|
||||||
c_pzasusb8.o: ../block.h
|
c_pzasusb8.o: ../block.h
|
||||||
c_pzasusb8.o: ../byteswap.h
|
c_pzasusb8.o: ../byteswap.h
|
||||||
c_pzasusb8.o: ../calcerr.h
|
c_pzasusb8.o: ../calcerr.h
|
||||||
@@ -646,6 +666,7 @@ c_pzasusb8.o: ../custom.h
|
|||||||
c_pzasusb8.o: ../decl.h
|
c_pzasusb8.o: ../decl.h
|
||||||
c_pzasusb8.o: ../endian_calc.h
|
c_pzasusb8.o: ../endian_calc.h
|
||||||
c_pzasusb8.o: ../hash.h
|
c_pzasusb8.o: ../hash.h
|
||||||
|
c_pzasusb8.o: ../have_ban_pragma.h
|
||||||
c_pzasusb8.o: ../have_const.h
|
c_pzasusb8.o: ../have_const.h
|
||||||
c_pzasusb8.o: ../have_memmv.h
|
c_pzasusb8.o: ../have_memmv.h
|
||||||
c_pzasusb8.o: ../have_newstr.h
|
c_pzasusb8.o: ../have_newstr.h
|
||||||
@@ -661,6 +682,7 @@ c_pzasusb8.o: ../value.h
|
|||||||
c_pzasusb8.o: ../zmath.h
|
c_pzasusb8.o: ../zmath.h
|
||||||
c_pzasusb8.o: c_pzasusb8.c
|
c_pzasusb8.o: c_pzasusb8.c
|
||||||
c_register.o: ../alloc.h
|
c_register.o: ../alloc.h
|
||||||
|
c_register.o: ../banned.h
|
||||||
c_register.o: ../block.h
|
c_register.o: ../block.h
|
||||||
c_register.o: ../byteswap.h
|
c_register.o: ../byteswap.h
|
||||||
c_register.o: ../calc.h
|
c_register.o: ../calc.h
|
||||||
@@ -671,6 +693,7 @@ c_register.o: ../custom.h
|
|||||||
c_register.o: ../decl.h
|
c_register.o: ../decl.h
|
||||||
c_register.o: ../endian_calc.h
|
c_register.o: ../endian_calc.h
|
||||||
c_register.o: ../hash.h
|
c_register.o: ../hash.h
|
||||||
|
c_register.o: ../have_ban_pragma.h
|
||||||
c_register.o: ../have_const.h
|
c_register.o: ../have_const.h
|
||||||
c_register.o: ../have_memmv.h
|
c_register.o: ../have_memmv.h
|
||||||
c_register.o: ../have_newstr.h
|
c_register.o: ../have_newstr.h
|
||||||
@@ -686,6 +709,7 @@ c_register.o: ../value.h
|
|||||||
c_register.o: ../zmath.h
|
c_register.o: ../zmath.h
|
||||||
c_register.o: c_register.c
|
c_register.o: c_register.c
|
||||||
c_sysinfo.o: ../alloc.h
|
c_sysinfo.o: ../alloc.h
|
||||||
|
c_sysinfo.o: ../banned.h
|
||||||
c_sysinfo.o: ../block.h
|
c_sysinfo.o: ../block.h
|
||||||
c_sysinfo.o: ../byteswap.h
|
c_sysinfo.o: ../byteswap.h
|
||||||
c_sysinfo.o: ../calc.h
|
c_sysinfo.o: ../calc.h
|
||||||
@@ -698,6 +722,7 @@ c_sysinfo.o: ../decl.h
|
|||||||
c_sysinfo.o: ../endian_calc.h
|
c_sysinfo.o: ../endian_calc.h
|
||||||
c_sysinfo.o: ../fposval.h
|
c_sysinfo.o: ../fposval.h
|
||||||
c_sysinfo.o: ../hash.h
|
c_sysinfo.o: ../hash.h
|
||||||
|
c_sysinfo.o: ../have_ban_pragma.h
|
||||||
c_sysinfo.o: ../have_const.h
|
c_sysinfo.o: ../have_const.h
|
||||||
c_sysinfo.o: ../have_memmv.h
|
c_sysinfo.o: ../have_memmv.h
|
||||||
c_sysinfo.o: ../have_newstr.h
|
c_sysinfo.o: ../have_newstr.h
|
||||||
@@ -718,6 +743,7 @@ c_sysinfo.o: ../zrand.h
|
|||||||
c_sysinfo.o: ../zrandom.h
|
c_sysinfo.o: ../zrandom.h
|
||||||
c_sysinfo.o: c_sysinfo.c
|
c_sysinfo.o: c_sysinfo.c
|
||||||
custtbl.o: ../alloc.h
|
custtbl.o: ../alloc.h
|
||||||
|
custtbl.o: ../banned.h
|
||||||
custtbl.o: ../block.h
|
custtbl.o: ../block.h
|
||||||
custtbl.o: ../byteswap.h
|
custtbl.o: ../byteswap.h
|
||||||
custtbl.o: ../calcerr.h
|
custtbl.o: ../calcerr.h
|
||||||
@@ -727,6 +753,7 @@ custtbl.o: ../custom.h
|
|||||||
custtbl.o: ../decl.h
|
custtbl.o: ../decl.h
|
||||||
custtbl.o: ../endian_calc.h
|
custtbl.o: ../endian_calc.h
|
||||||
custtbl.o: ../hash.h
|
custtbl.o: ../hash.h
|
||||||
|
custtbl.o: ../have_ban_pragma.h
|
||||||
custtbl.o: ../have_const.h
|
custtbl.o: ../have_const.h
|
||||||
custtbl.o: ../have_memmv.h
|
custtbl.o: ../have_memmv.h
|
||||||
custtbl.o: ../have_newstr.h
|
custtbl.o: ../have_newstr.h
|
||||||
@@ -740,3 +767,7 @@ custtbl.o: ../str.h
|
|||||||
custtbl.o: ../value.h
|
custtbl.o: ../value.h
|
||||||
custtbl.o: ../zmath.h
|
custtbl.o: ../zmath.h
|
||||||
custtbl.o: custtbl.c
|
custtbl.o: custtbl.c
|
||||||
|
|
||||||
|
##################################################
|
||||||
|
# NOTE: End of section from custom/Makefile.tail #
|
||||||
|
##################################################
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* c_argv - a custom function display info about its args
|
* c_argv - a custom function display info about its args
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2006 Landon Curt Noll
|
* Copyright (C) 1999-2006,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
|
||||||
@@ -38,6 +38,10 @@
|
|||||||
|
|
||||||
#include "have_unused.h"
|
#include "have_unused.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* c_argv - a custom function display info about its args
|
* c_argv - a custom function display info about its args
|
||||||
*
|
*
|
||||||
@@ -49,7 +53,7 @@
|
|||||||
*/
|
*/
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
VALUE
|
VALUE
|
||||||
c_argv(char UNUSED *name, int count, VALUE **vals)
|
c_argv(char *UNUSED(name), int count, VALUE **vals)
|
||||||
{
|
{
|
||||||
VALUE result; /* what we will return */
|
VALUE result; /* what we will return */
|
||||||
ZVALUE zfilelen; /* length of a file as a ZVALUE */
|
ZVALUE zfilelen; /* length of a file as a ZVALUE */
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* c_devnull - a custom function that does nothing
|
* c_devnull - a custom function that does nothing
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2004 Landon Curt Noll
|
* Copyright (C) 1999-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
|
||||||
@@ -39,6 +39,9 @@
|
|||||||
#include "have_unused.h"
|
#include "have_unused.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* c_devnull - a custom function that does nothing
|
* c_devnull - a custom function that does nothing
|
||||||
*
|
*
|
||||||
@@ -47,7 +50,7 @@
|
|||||||
*/
|
*/
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
VALUE
|
VALUE
|
||||||
c_devnull(char UNUSED *name, int UNUSED count, VALUE UNUSED **vals)
|
c_devnull(char *UNUSED(name), int UNUSED(count), VALUE **UNUSED(vals))
|
||||||
{
|
{
|
||||||
VALUE result; /* what we will return */
|
VALUE result; /* what we will return */
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* c_help - custom help function
|
* c_help - custom help function
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2004 Landon Curt Noll
|
* Copyright (C) 1999-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
|
||||||
@@ -39,6 +39,9 @@
|
|||||||
#include "have_unused.h"
|
#include "have_unused.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* c_help - custom help function
|
* c_help - custom help function
|
||||||
*
|
*
|
||||||
@@ -58,7 +61,7 @@
|
|||||||
*/
|
*/
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
VALUE
|
VALUE
|
||||||
c_help(char UNUSED *name, int UNUSED count, VALUE **vals)
|
c_help(char *UNUSED(name), int UNUSED(count), VALUE **vals)
|
||||||
{
|
{
|
||||||
VALUE result; /* what we will return */
|
VALUE result; /* what we will return */
|
||||||
|
|
||||||
|
@@ -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
|
||||||
@@ -35,6 +35,10 @@
|
|||||||
|
|
||||||
#include "have_unused.h"
|
#include "have_unused.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
/* 2^255 */
|
/* 2^255 */
|
||||||
STATIC HALF h255[] = {
|
STATIC HALF h255[] = {
|
||||||
#if BASEB == 32
|
#if BASEB == 32
|
||||||
@@ -71,7 +75,7 @@ STATIC ZVALUE lastmodinv[1];
|
|||||||
*/
|
*/
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
VALUE
|
VALUE
|
||||||
c_pmodm127(char UNUSED *name, int UNUSED count, VALUE **vals)
|
c_pmodm127(char *UNUSED(name), int UNUSED(count), VALUE **vals)
|
||||||
{
|
{
|
||||||
VALUE result; /* what we will return */
|
VALUE result; /* what we will return */
|
||||||
ZVALUE q; /* test factor */
|
ZVALUE q; /* test factor */
|
||||||
@@ -124,7 +128,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
|
||||||
@@ -35,8 +35,12 @@
|
|||||||
|
|
||||||
#include "have_unused.h"
|
#include "have_unused.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* c_pzasusb8 - print numereator as a string of USB8s
|
* c_pzasusb8 - print numerator as a string of USB8s
|
||||||
*
|
*
|
||||||
* given:
|
* given:
|
||||||
* count = 1;
|
* count = 1;
|
||||||
@@ -47,7 +51,7 @@
|
|||||||
*/
|
*/
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
VALUE
|
VALUE
|
||||||
c_pzasusb8(char UNUSED *name, int UNUSED count, VALUE **vals)
|
c_pzasusb8(char *UNUSED(name), int UNUSED(count), VALUE **vals)
|
||||||
{
|
{
|
||||||
VALUE result; /* what we will return */
|
VALUE result; /* what we will return */
|
||||||
ZVALUE z; /* numerator of the value */
|
ZVALUE z; /* numerator of the value */
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* c_register - set or print a custom register value
|
* c_register - set or print a custom register value
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -39,6 +39,9 @@
|
|||||||
#include "have_unused.h"
|
#include "have_unused.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* registers
|
* registers
|
||||||
*/
|
*/
|
||||||
@@ -76,7 +79,7 @@ init_custreg(void)
|
|||||||
*/
|
*/
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
VALUE
|
VALUE
|
||||||
c_register(char UNUSED *name, int count, VALUE **vals)
|
c_register(char *UNUSED(name), int count, VALUE **vals)
|
||||||
{
|
{
|
||||||
VALUE result; /* what we will return */
|
VALUE result; /* what we will return */
|
||||||
long reg; /* register number */
|
long reg; /* register number */
|
||||||
|
@@ -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
|
||||||
@@ -57,6 +57,9 @@
|
|||||||
#include "have_unused.h"
|
#include "have_unused.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* sys_info - names and values of selected #defines
|
* sys_info - names and values of selected #defines
|
||||||
*/
|
*/
|
||||||
@@ -177,15 +180,15 @@ STATIC struct infoname sys_info[] = {
|
|||||||
(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},
|
||||||
@@ -266,7 +269,7 @@ S_FUNC void dump_mening_value(void); /* custom("sysinfo", 2) */
|
|||||||
*/
|
*/
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
VALUE
|
VALUE
|
||||||
c_sysinfo(char UNUSED *name, int count, VALUE **vals)
|
c_sysinfo(char *UNUSED(name), int count, VALUE **vals)
|
||||||
{
|
{
|
||||||
VALUE result; /* what we will return */
|
VALUE result; /* what we will return */
|
||||||
struct infoname *p; /* current infoname */
|
struct infoname *p; /* current infoname */
|
||||||
|
@@ -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
|
||||||
@@ -30,6 +30,10 @@
|
|||||||
#include "value.h"
|
#include "value.h"
|
||||||
#include "custom.h"
|
#include "custom.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "banned.h" /* include after system header <> includes */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NOTE: See the file CUSTOM for instructions on how to add
|
* NOTE: See the file CUSTOM for instructions on how to add
|
||||||
* custom functions.
|
* custom functions.
|
||||||
@@ -40,7 +44,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
|
||||||
|
@@ -13,7 +13,7 @@ DESCRIPTION
|
|||||||
|
|
||||||
This custom function will return the value:
|
This custom function will return the value:
|
||||||
|
|
||||||
q mod 2^(2^127-1)
|
q mod 2^(2^127-1)
|
||||||
|
|
||||||
This custom function serves as a demonstration of how to write
|
This custom function serves as a demonstration of how to write
|
||||||
a custom function. It performs the equivalent of:
|
a custom function. It performs the equivalent of:
|
||||||
@@ -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
|
||||||
*
|
*
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user