mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
Compare commits
118 Commits
v2.14.0.0
...
prod-2.14.
Author | SHA1 | Date | |
---|---|---|---|
|
ee70c12481 | ||
|
d4970d66ce | ||
|
c3ea3d28a4 | ||
|
3fa34dabfe | ||
|
ffd4422870 | ||
|
b5b2c3f812 | ||
|
f7dadbf1f8 | ||
|
22e123140c | ||
|
1242700601 | ||
|
5b7dfeaf11 | ||
|
b3c015d338 | ||
|
5985ad2f33 | ||
|
e401c9abf1 | ||
|
ad79b6384d | ||
|
862dbd6777 | ||
|
0d31eb6828 | ||
|
c0be37d4e3 | ||
|
4344532c28 | ||
|
0f6efb29bb | ||
|
39c0cba1ca | ||
|
a68e41248f | ||
|
e213cc5072 | ||
|
95ebb60619 | ||
|
e5c8f00adc | ||
|
265713778f | ||
|
4b08a896b0 | ||
|
44f3778af1 | ||
|
8db8f93ae0 | ||
|
e688c22c0e | ||
|
af72992ead | ||
|
9f3a7817d3 | ||
|
dd0610db0a | ||
|
177a5d00d1 | ||
|
a02f8aa9f9 | ||
|
b7d1fb096d | ||
|
48c4f3b948 | ||
|
2023175fcc | ||
|
c54e2648dc | ||
|
faf40b7149 | ||
|
4b2ae40c86 | ||
|
af57104e25 | ||
|
5ae3ca059a | ||
|
cc5fb9a45b | ||
|
5dcadad8b6 | ||
|
9c67ceeed8 | ||
|
7ffbaf922e | ||
|
f9464652fe | ||
|
b30c5c1855 | ||
|
7417f2e776 | ||
|
71138215a9 | ||
|
241f777d07 | ||
|
9d27f0aaa7 | ||
|
a28edba4e9 | ||
|
de47c960d3 | ||
|
c3a51f42e2 | ||
|
f5c5cea8b0 | ||
|
769ac51f8c | ||
|
cdda633369 | ||
|
50f349f4d7 | ||
|
ef00e00328 | ||
|
bb041098bc | ||
|
f794b8d859 | ||
|
bd990cef1f | ||
|
febb9d96b3 | ||
|
13ae9b804e | ||
|
56cc4897d6 | ||
|
eb940e0a21 | ||
|
f3adb35e36 | ||
|
d1d365d7ba | ||
|
af214b166d | ||
|
51b933dfff | ||
|
c4e5007587 | ||
|
c838798f04 | ||
|
23d49a41fe | ||
|
3d300acca1 | ||
|
8f449ba6d2 | ||
|
f4d754b47d | ||
|
fde724aa2d | ||
|
e411a3e6bf | ||
|
7db81649b0 | ||
|
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 |
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
|
9
.gitignore
vendored
9
.gitignore
vendored
@@ -6,7 +6,6 @@
|
||||
#
|
||||
.dynamic
|
||||
.hsrc
|
||||
Makefile.simple
|
||||
NOTES
|
||||
align32.h
|
||||
args.h
|
||||
@@ -16,6 +15,7 @@ calc.1
|
||||
calc.usage
|
||||
calcerr.c
|
||||
calcerr.h
|
||||
charbit.h
|
||||
conf.h
|
||||
cscript/.all
|
||||
cscript/4dsphere
|
||||
@@ -28,19 +28,21 @@ cscript/powerterm
|
||||
cscript/simple
|
||||
cscript/square
|
||||
custom/.all
|
||||
custom/Makefile.simple
|
||||
custom/libcustcalc*
|
||||
endian
|
||||
endian_calc.h
|
||||
fposval.h
|
||||
have_arc4random.h
|
||||
have_ban_pragma.h
|
||||
have_const.h
|
||||
have_environ.h
|
||||
have_fpos.h
|
||||
have_fpos_pos.h
|
||||
have_getpgid.h
|
||||
have_getprid.h
|
||||
have_getsid.h
|
||||
have_gettime.h
|
||||
have_limits.h
|
||||
have_memmv.h
|
||||
have_newstr.h
|
||||
have_offscl.h
|
||||
@@ -82,6 +84,7 @@ help/man
|
||||
help/new_custom
|
||||
help/question
|
||||
help/questions
|
||||
help/releases
|
||||
help/resource
|
||||
help/type
|
||||
help/usage
|
||||
@@ -89,11 +92,13 @@ libcalc*
|
||||
libcustcalc*
|
||||
longbits
|
||||
longbits.h
|
||||
Makefile.our
|
||||
sample_many
|
||||
sample_rand
|
||||
tags
|
||||
terminal.h
|
||||
ver_calc
|
||||
win32/
|
||||
|
||||
# other commonly excluded patterns
|
||||
#
|
||||
|
28
BUGS
28
BUGS
@@ -15,19 +15,37 @@ Look at the end of the output, it should say something like:
|
||||
|
||||
If it does not, then something is really broken!
|
||||
|
||||
To be sure that your version of calc is up to date, check out:
|
||||
To be sure that your version of calc is up to date.
|
||||
Look for the latest release on GitHub:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/calc-mirror.html
|
||||
https://github.com/lcn2/calc/releases
|
||||
|
||||
Just below latest GitHub release sectiop is something called:
|
||||
|
||||
> Assets
|
||||
|
||||
Click in the triangle to open up the Assets then click on
|
||||
the approptiate package to download.
|
||||
|
||||
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 those changges out and see if things get
|
||||
better.
|
||||
|
||||
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.
|
||||
|
||||
=-=
|
||||
|
||||
The BEST WAY TO SEND IN A BUG REPORT is via calc GitHub issue URL:
|
||||
If you encounter a warning or error in compiling, or if you
|
||||
find a calc bug and you wish to send is a fix, we recommend
|
||||
that you submit your change using the GitHub pull request:
|
||||
|
||||
https://github.com/lcn2/calc/pulls
|
||||
|
||||
=-=
|
||||
|
||||
If you just want to send us a bug report, we recommend
|
||||
doing so via the GitHub issue process:
|
||||
|
||||
https://github.com/lcn2/calc/issues
|
||||
|
||||
@@ -119,6 +137,8 @@ Known bugs in calc:
|
||||
The output of the alg_config.cal resource file is bogus.
|
||||
We would welcome a replacement for this code.
|
||||
|
||||
Calc may not compile natively under Windows 11. See README.WINDOWS.
|
||||
|
||||
We are sure some more bugs exist. When you find them, please let
|
||||
us know! See the above for details on how to report and were to
|
||||
Email your bug reports and hopefully patches to fix them.
|
||||
|
499
CHANGES
499
CHANGES
@@ -1,4 +1,211 @@
|
||||
The following are the changes from calc version 2.14.0.0 to date:
|
||||
The following are the changes from calc version 2.14.0.14 to date:
|
||||
|
||||
Fixed typo in Makefile.local comment.
|
||||
|
||||
Established a tagging procedure for a production release.
|
||||
Production git tags will be of the form:
|
||||
|
||||
prod-2.x.y.z
|
||||
|
||||
|
||||
The following are the changes from calc version 2.14.0.13 to 2.14.0.13:
|
||||
|
||||
Made major changes to our release process in order to avoid
|
||||
missing critical files that happened in calc v2.4.0.12.
|
||||
|
||||
Minor tweak to seed() builtin. Updated help/srand and help/srandom.
|
||||
|
||||
Moved Makefile.ship into Makefile.
|
||||
|
||||
Removed custom/Makefile.head and custom/Makefile.tail.
|
||||
|
||||
The custom/Makefile is now part of source and includes Makefile.
|
||||
In particular, custom/Makefile makes use of the 'middle' of
|
||||
the new top level Makefile where calc's top level Makefile
|
||||
variables are defined.
|
||||
|
||||
Makefile.simple and custom/Makefile.simple are now part of the source
|
||||
and are constructed from Makefile and custom/Makefile respectively.
|
||||
The Makefile.simple and custom/Makefile.simple avoid using GNU
|
||||
conditionals. They may be used with older/classic make commands.
|
||||
|
||||
Makefile.local will include comments about how to better use
|
||||
it. Between releases, Makefile.local at the top of the master branch
|
||||
will contain how we typically build calc and test calc (FYI: we
|
||||
normally enable things such as -Werror -Wextra -pedantic). When we
|
||||
push out a release, Makefile.local will be stripped of non-comment
|
||||
lines. Thus, releases of calc, and, released "calc*.src.rpm"
|
||||
files and the source tarballs, will have a Makefile.local with
|
||||
only comments.
|
||||
|
||||
The "README.*" files and "HOWTO.INSTALL" file have been updated.
|
||||
|
||||
By default, compiler warnings have been turned up. The Makefile
|
||||
variable ${CCWARN} now defaults to:
|
||||
|
||||
CCWARN= -Wall -Wextra -pedantic
|
||||
|
||||
The previous level of compiler warnings can be easily restored by
|
||||
adding to Makefile.local:
|
||||
|
||||
CCWARN:= -Wall
|
||||
|
||||
The readline, history and ncurses libraries are now default.
|
||||
The Makefile variables ${USE_READLINE}, ${READLINE_LIB}, and
|
||||
${READLINE_EXTRAS} now default to:
|
||||
|
||||
USE_READLINE= -DUSE_READLINE
|
||||
READLINE_LIB= -lreadline
|
||||
READLINE_EXTRAS= -lhistory -lncurses
|
||||
|
||||
The previous mode where readline, history and ncurses libraries
|
||||
were not compiled in by default can be easily restored by
|
||||
adding to Makefile.local:
|
||||
|
||||
USE_READLINE:=
|
||||
READLINE_LIB:=
|
||||
READLINE_EXTRAS:=
|
||||
|
||||
We have renamed "stable" as "production".
|
||||
We have renamed "unstable" as "tested".
|
||||
|
||||
On the web site:
|
||||
|
||||
http://www.isthe.com/chongo/src/calc/
|
||||
|
||||
these files has been renamed:
|
||||
|
||||
2.x.y.z_IS_LATEST_STABLE ==> 2.x.y.z_IS_LATEST_PRODUCTION
|
||||
2.x.y.z_IS_LATEST_UNSTABLE ==> 2.x.y.z_IS_LATEST_TESTED
|
||||
|
||||
The terms 'stable' and 'unstable' were both misleading and
|
||||
inaccurate. For details see the new documention file:
|
||||
|
||||
README.RELEASE
|
||||
|
||||
See also the help command:
|
||||
|
||||
; help release
|
||||
|
||||
Fixed bug impacting how have_ustat.h was formed.
|
||||
|
||||
Updated help/archive, BUGS, HOWTO.INSTALL to reflect GitHub use.
|
||||
|
||||
|
||||
The following are the changes from calc version 2.14.0.11 to 2.14.0.12:
|
||||
|
||||
Fixed a number of typos.
|
||||
|
||||
Drop support for SunOS, IRIX and MINGW32_NT-5.0 targets.
|
||||
Drop support for CLOCK_SGI_CYCLE. Drop testing for __MSDOS__.
|
||||
|
||||
Minor improvement of various help files. Made format of help
|
||||
files more consistent.
|
||||
|
||||
Corrected a few comments in zrandom.c, including a case where
|
||||
the comment referred to 1007 when it should have used 2^32.
|
||||
|
||||
Improved seed() generation. Improved some comments in seed.c.
|
||||
Added have_environ.c to build have_environ.h in order to
|
||||
determine if:
|
||||
|
||||
extern char **environ; /* user environment */
|
||||
|
||||
is an valid external symbol.
|
||||
|
||||
Fixed documentation that referred to the old additive 55
|
||||
generator. We have been using the subtractive 100 in place
|
||||
of the additive 55 generator for a while now.
|
||||
|
||||
Fixed depend rule for custom/Makefile.
|
||||
|
||||
Fixed how Makefile variable SHELL is set on macOS vs. Linux.
|
||||
Using /bin/sh on macOS due to how zsh treats globs by default.
|
||||
|
||||
Added charbit.h to define CALC_CHARBIT which is either CHAR_BIT
|
||||
from <limits.h> or 8 or a value set by the Makefile variable
|
||||
CALC_CHARBIT. Added have_limits.h to determine if <limits.h>
|
||||
is a system include file.
|
||||
|
||||
Compiling now tests for _WIN64 as well when testing for _WIN32.
|
||||
|
||||
Now assuming that <stdio.h> is available under _WIN32 and _WIN64.
|
||||
|
||||
Added some preliminary notes about attempts to compile calc
|
||||
under Windows 11.
|
||||
|
||||
BTW: While we are unable to use Windows 11, we welcome
|
||||
Windows 11 developers to try compiling calc natively
|
||||
(instead of via a Linux virtual machine). If you are
|
||||
able to compile Windows 11 natively, we would welcome
|
||||
GitHub pull requests showing any needed modifications:
|
||||
|
||||
https://github.com/lcn2/calc/pulls
|
||||
|
||||
Please also add notes to the 'Compiling calc under Windows 11'
|
||||
section in README.WINDOWS file.
|
||||
|
||||
We added Makefile.simple as part of the master branch source
|
||||
to help those who may be using a make tool that does not support
|
||||
GNU Make-like features such as "ifeq" and ":=".
|
||||
|
||||
Fixed incorrect ustat_dev member ref in seed() builtin that
|
||||
was part of the unreleased calc v2.12.0.11.
|
||||
|
||||
|
||||
The following are the changes from calc version 2.14.0.9 to 2.14.0.10:
|
||||
|
||||
Due to issues with clang and Apple Silicon, ARCH_CFLAGS is now,
|
||||
by default, empty:
|
||||
|
||||
ARCH_CFLAGS=
|
||||
|
||||
If you want to use, say, -march=native, then either change
|
||||
the Makefile or make with:
|
||||
|
||||
make all ARCH_CFLAGS='-march=native'
|
||||
|
||||
Added arch and hardware as GNU Makefile computed values.
|
||||
As with ${target}, ${arch} and ${hardware} is computed by uname:
|
||||
|
||||
target: uname -a
|
||||
arch: uname -p
|
||||
hardware: uname -m
|
||||
|
||||
Fixed compiling calc on Apple Silicon with HomeBrew. On Apple
|
||||
Silicon, HomeBrew installs on into a different location. The
|
||||
Makefile checks if ${hardware} is arm64 and adjusts the location
|
||||
of libraries such as readline and history accordingly.
|
||||
|
||||
Plugged a number of memory leaks.
|
||||
|
||||
Fixed a few cases where v_subtype was not properly initialized.
|
||||
|
||||
Improved the way that internal pre-defined constants are managed.
|
||||
Removed unused internal pre-defined constants. Added code to
|
||||
prevent an internal pre-defined constant (that was never allocated)
|
||||
from being freed.
|
||||
|
||||
Remove unnecessary spaces in-between or next to tabs.
|
||||
|
||||
Update Copyright dates to account for 2021 modifications.
|
||||
|
||||
|
||||
The following are the changes from calc version 2.14.0.7 to 2.14.0.8:
|
||||
|
||||
Fizzbin is a better word. :-)
|
||||
|
||||
The help and man builtin commands now return an error when a
|
||||
help file cannot be opened, such as when there is no help file.
|
||||
|
||||
Added palindrome.cal resource file. For example, to find the
|
||||
largest (highly probable) prime palindrome under 280 decimal
|
||||
digits (text tweet limit):
|
||||
|
||||
prevprimepal(1e280)
|
||||
|
||||
|
||||
The following are the changes from calc version 2.14.0.0 to 2.14.0.6:
|
||||
|
||||
The :-separated default CALCRC value has been reversed.
|
||||
The default CALCRC was:
|
||||
@@ -36,6 +243,180 @@ The following are the changes from calc version 2.14.0.0 to date:
|
||||
a call to base2(1000) would make calc unstable and likely to
|
||||
dump core.
|
||||
|
||||
Added builtin functions to convert between degrees, radians
|
||||
and gradians:
|
||||
|
||||
d2r(deg) - given degrees returns radians
|
||||
g2r(grad) - given gradians returns radians
|
||||
|
||||
r2d(rad) - given radians returns degrees
|
||||
g2d(grad) - given gradians returns degrees
|
||||
|
||||
r2g(rad) - given radians returns gradians
|
||||
d2g(deg) - given degrees returns gradians
|
||||
|
||||
Add 6 functions take a 2nd optional epsilon argument.
|
||||
For d2r(deg, ep), r2d(rad, ep), the optional 2nd epsilon argument controls
|
||||
the precision of the internal constant pi/180.
|
||||
For g2r(grad, ep), r2g(rad, ep), the optional 2nd epsilon argument controls
|
||||
the precision of the internal constant pi/200.
|
||||
The optional 2nd argument is ignored by g2d(grad, ep) and d2g(deg, ep).
|
||||
|
||||
The clean and clobber makefile rules no longer list custom/Makefile
|
||||
as a dependency.
|
||||
|
||||
Unfortunately due to the complex dependency issues between
|
||||
Makefile, Makefile.ship and custom/Makefile, parallel GNU make
|
||||
is NOT recommended. Sorry (tm Canada) :)
|
||||
|
||||
The clean and clobber makefile rules no longer list custom/Makefile
|
||||
as a dependency.
|
||||
|
||||
Unfortunately due to the complex dependency issues between
|
||||
Makefile, Makefile.ship and custom/Makefile, parallel GNU make
|
||||
is NOT recommended. Sorry (tm Canada) :)
|
||||
|
||||
Fixed a few typos in CHANGES.
|
||||
|
||||
As a side note: We stayed v2.13.x was kept for only a short time.
|
||||
The move to 2.14.x was motivated by non-compatible changes due to
|
||||
the default order of CALCRC, plus some new builtin functions.
|
||||
|
||||
More changes are likely, so we might see another v2.14.0.x release
|
||||
before things are declared "recommended stable".
|
||||
|
||||
Not that we want to discourage people from trying v2.14.0, you should
|
||||
try it. We just want things to become stable and well field tested
|
||||
before we reach the "recommended stable" release state.
|
||||
|
||||
Added builtin functions to convert between degrees and
|
||||
degrees, minutes and seconds under the config("mod")
|
||||
round rules:
|
||||
|
||||
d2dms(degs, d, m, s [,rnd]) - given degs, compute d, m, s
|
||||
d2dm(degs, d, m [,rnd]) - given degs, compute d, m
|
||||
|
||||
See help/d2dms and help/d2dm.
|
||||
|
||||
Example:
|
||||
|
||||
; print d2dms(360.321,deg=,min=,sec=), deg, min, sec;
|
||||
0.321 0 19 15.6
|
||||
|
||||
; print d2dm(360.321,deg=,min=), deg, min;
|
||||
0.321 0 19.26
|
||||
|
||||
Added builtin functions to convert between gradians and
|
||||
gradians, minutes and seconds under the config("mod")
|
||||
round rules:
|
||||
|
||||
g2gms(grads, g, m, s [,rnd]) - given grads, compute g, m, s
|
||||
g2gm(grads, g, m [,rnd]) - given grads, compute g, m
|
||||
|
||||
See help/g2gms and help/g2gm.
|
||||
|
||||
Example:
|
||||
|
||||
; print g2gms(400.321,grad=,min=,sec=), grad, min, sec;
|
||||
0.321 0 19 15.6
|
||||
|
||||
; print g2gm(400.321,grad=,min=), grad, min;
|
||||
0.321 0 19.26
|
||||
|
||||
Added builtin functions to convert between hours and
|
||||
hours, minutes and seconds under the config("mod")
|
||||
round rules:
|
||||
|
||||
h2hms(hours, h, m, s [,rnd]) - given hours, compute h, m, s
|
||||
h2hm(hours, h, m [,rnd]) - given hours, compute h, m
|
||||
|
||||
See help/h2hms and help/h2hm.
|
||||
|
||||
Example:
|
||||
|
||||
; print h2hms(24.321,hour=,min=,sec=), hour, min, sec;
|
||||
0.321 0 19 15.6
|
||||
|
||||
; print h2hm(24.321,hour=,min=), hour, min;
|
||||
0.321 0 19.26
|
||||
|
||||
Renumbered regression tests 3408 thru 3437, to 9102 thru 9131.
|
||||
|
||||
Updated Added hms.cal resource file to use h2hms() builtin.
|
||||
Updated Added dms.cal resource file to use d2dms() builtin.
|
||||
|
||||
Fix minor typo in help/mod SYNOPSIS.
|
||||
Fix minor typo in help/quo SYNOPSIS.
|
||||
|
||||
Added a few more examples to help/strcmp.
|
||||
|
||||
Added builtin functions to convert between degrees, minutes and
|
||||
seconds and degrees under the config("mod") round rules:
|
||||
|
||||
dms2d(d, m, s [,rnd]) - convert deg, min, and secs to deg
|
||||
dm2d(d, m [,rnd]) - convert deg, min to deg
|
||||
|
||||
See help/dms2d and help/dm2d.
|
||||
|
||||
Example:
|
||||
|
||||
; print dms2d(12, 20, 44.16);
|
||||
12.3456
|
||||
|
||||
; print dm2d(3601, -25.5594);
|
||||
0.57401
|
||||
|
||||
Added builtin functions to convert between gradians, minutes and
|
||||
seconds and gradians under the config("mod") round rules:
|
||||
|
||||
gms2g(g, m, s [,rnd]) - convert grad, min, and secs to grad
|
||||
gm2g(g, m [,rnd]) - convert grad and min to grad
|
||||
|
||||
See help/g2gms and help/g2gm.
|
||||
|
||||
Example:
|
||||
|
||||
; print gms2g(12, 20, 44.16);
|
||||
12.3456
|
||||
|
||||
; print gm2g(4001, -25.5594);
|
||||
0.57401
|
||||
|
||||
Added builtin functions to convert between hours, minutes and
|
||||
seconds and hours under the config("mod") round rules:
|
||||
|
||||
hms2h(h, m, s [,rnd]) - convert hours, min, and secs to hours
|
||||
hm2h(h, m [,rnd]) - convert hours, min to hours
|
||||
|
||||
See help/hms2h and help/hm2h.
|
||||
|
||||
Example:
|
||||
|
||||
; print hms2h(12, 20, 44.16);
|
||||
12.3456
|
||||
|
||||
; print hm2h(241, -25.5594);
|
||||
0.57401
|
||||
|
||||
Fixed typo in cal/statistics.cal thanks to a report by <GitHub user
|
||||
dennisaldea>.
|
||||
|
||||
Fixed an old Windows pun in README.WINDOWS as requested by <GitHub
|
||||
user marcodegio>.
|
||||
|
||||
Fixed a really obscure bug in the internal initconstants()
|
||||
function of const.c that has been sitting for over 31 years!
|
||||
|
||||
We are amazed that nobody has encountered this bug before
|
||||
now. Nevertheless, our very extensive regression and
|
||||
multi-architecture testing found the bug. Now, after all
|
||||
those years, it is fixed.
|
||||
|
||||
Fixed issues identified by the default CodeUL GitHub security code scan:
|
||||
|
||||
Wrong type of arguments to printf in have_fpos_pos.c
|
||||
Multiplication result converted to larger type in zfunc.c
|
||||
|
||||
|
||||
The following are the changes from calc version 2.13.0.1 to 2.13.0.1:
|
||||
|
||||
@@ -74,7 +455,7 @@ The following are the changes from calc version 2.13.0.0 to 2.13.0.0:
|
||||
|
||||
Fixed typo (missing quotes) in the env rule.
|
||||
|
||||
Fixed intendation problem in CHANGES.
|
||||
Fixed indentation problem in CHANGES.
|
||||
|
||||
Combined 2.12.9.1 changes into the 2.12.8.2 to 2.12.9.0
|
||||
range, and thus renamed the range to 2.12.8.2 to 2.12.9.1.
|
||||
@@ -110,7 +491,7 @@ The following are the changes from calc version 2.13.0.0 to 2.13.0.0:
|
||||
#!/usr/local/bin/calc -f
|
||||
...
|
||||
|
||||
It is common that -q be usde with a calc script, so assuming the
|
||||
It is common that -q be used with a calc script, so assuming the
|
||||
same /usr/local/bin/calc path:
|
||||
|
||||
#!/usr/local/bin/calc -q -f
|
||||
@@ -654,7 +1035,7 @@ The following are the changes from calc version 2.12.5.4 to 2.12.5.6:
|
||||
Rewrote gen_v1() in the lucas.cal resource file using the method
|
||||
based on a paper:
|
||||
|
||||
"A note on primality tests for N = h*2^n-1", by Oystein J. Rodseth,
|
||||
"A note on primality tests for N = h*2^n-1", by Oystein J. Rodseth,
|
||||
Department of Mathematics, University of Bergen, BIT Numerical
|
||||
Mathematics. 34 (3): pp 451-454.
|
||||
|
||||
@@ -713,13 +1094,13 @@ The following are the changes from calc version 2.12.5.3 to 2.12.5.3:
|
||||
macOS (Darwin) users who installed calc version 2.12.5.2
|
||||
should, after installing version 2.12.5.3:
|
||||
|
||||
rm -rf /opt/calc
|
||||
rm -rf /opt/calc
|
||||
|
||||
|
||||
The following are the changes from calc version 2.12.5.1 to 2.12.5.2:
|
||||
|
||||
NOTE: calc version 2.12.5.2, for macOS (Darwin) users,
|
||||
installed under /opt/calc. We neglected to mention this
|
||||
installed under /opt/calc. We neglected to mention this
|
||||
AND /usr/local would have been a better choice. Sorry!
|
||||
Fixed in calc version 2.12.5.3.
|
||||
|
||||
@@ -792,7 +1173,7 @@ The following are the changes from calc version 2.12.4.14 to 2.12.5.0:
|
||||
|
||||
For Apple OS X / Darwin target:
|
||||
|
||||
MACOSX_DEPLOYMENT_TARGET is no longer defined
|
||||
MACOSX_DEPLOYMENT_TARGET is no longer defined
|
||||
using clang compiler
|
||||
|
||||
By default, -install-name is used when forming shared libs.
|
||||
@@ -836,9 +1217,9 @@ The following are the changes from calc version 2.12.4.14 to 2.12.5.0:
|
||||
for mul2, sq2, and pow2. However, it has been shown that this
|
||||
code is not correct. Suggestions for a replacement are welcome!
|
||||
|
||||
calc -u 'read alg_config; config("user_debug", 2),; best_mul2();'
|
||||
calc -u 'read alg_config; config("user_debug", 2),; best_sq2();'
|
||||
calc -u 'read alg_config; config("user_debug", 2),; best_pow2();'
|
||||
calc -u 'read alg_config; config("user_debug", 2),; best_mul2();'
|
||||
calc -u 'read alg_config; config("user_debug", 2),; best_sq2();'
|
||||
calc -u 'read alg_config; config("user_debug", 2),; best_pow2();'
|
||||
|
||||
Fixed a number of pedantic compiler warnings.
|
||||
|
||||
@@ -1005,7 +1386,7 @@ The following are the changes from calc version 2.12.4.6 to version 2.12.4.10:
|
||||
With the exception of 3 source files, we became "picky" about
|
||||
line lengths and other issues reported by the picky tool:
|
||||
|
||||
cal/test8900.cal
|
||||
cal/test8900.cal
|
||||
cal/set8700.line
|
||||
help/errorcodes.sed
|
||||
|
||||
@@ -1061,7 +1442,7 @@ The following are the changes from calc version 2.12.4.0 to 2.12.4.2:
|
||||
Added prep makefile rule to make is easier to compile calc without
|
||||
an optimizer. By doing:
|
||||
|
||||
make clobber prep
|
||||
make clobber prep
|
||||
|
||||
one may build a calc binary that is easier to debug.
|
||||
|
||||
@@ -1078,7 +1459,7 @@ The following are the changes from calc version 2.12.4.0 to 2.12.4.2:
|
||||
dot org) for this patch.
|
||||
|
||||
Michael Penk (mpenk at wuska dot com) reported success in installs
|
||||
under windoz via Cygwin by making a change to the Cygwin target.
|
||||
under Windows via Cygwin by making a change to the Cygwin target.
|
||||
These changes have been folded into the main calc Makefile.
|
||||
The old recommendation of using 'make win32_hsrc' is no longer
|
||||
required for Cygwin. See the README.WINDOWS file for details.
|
||||
@@ -1218,7 +1599,7 @@ The following are the changes from calc version 2.12.1.1 to 2.12.2.2:
|
||||
what was calc-something.tar.gz is now calc-something.tar.bz2.
|
||||
To "uncompress" use:
|
||||
|
||||
bunzip2 calc-something.tar.bz2
|
||||
bunzip2 calc-something.tar.bz2
|
||||
|
||||
On some systems, one may untar directly by:
|
||||
|
||||
@@ -1252,7 +1633,7 @@ The following are the changes from calc version 2.12.1.10 to 2.12.2:
|
||||
All extern functions are now declared with the symbol E_FUNC.
|
||||
The include file decl.h defines these 4 symbols by default
|
||||
to static, extern, static, and extern respectively. Under
|
||||
Windoz, DLL is also defined according to the _EXPORTING symbol
|
||||
Windows, DLL is also defined according to the _EXPORTING symbol
|
||||
and is prepended to the EXTERN and E_FUNC symbols. The decl.h
|
||||
file has replaced the win32dll.h file.
|
||||
|
||||
@@ -1283,7 +1664,7 @@ The following are the changes from calc version 2.12.1.10 to 2.12.2:
|
||||
Renamed the following variables related to calc error processing:
|
||||
|
||||
int calc_jmp ==> int calc_use_matherr_jmpbuf
|
||||
jmp_buf calc_jmp_buf ==> jmp_buf calc_matherr_jmpbuf
|
||||
jmp_buf calc_jmp_buf ==> jmp_buf calc_matherr_jmpbuf
|
||||
|
||||
int post_init ==> int calc_use_scanerr_jmpbuf
|
||||
jmp_buf jmpbuf ==> jmpbuf calc_scanerr_jmpbuf
|
||||
@@ -1298,7 +1679,7 @@ The following are the changes from calc version 2.12.1.10 to 2.12.2:
|
||||
Parse/scan errors will not be printed if calc_print_scanerr_msg
|
||||
is zero. By default:
|
||||
|
||||
int calc_print_scanerr_msg = 1;
|
||||
int calc_print_scanerr_msg = 1;
|
||||
|
||||
This variable is declared in the lib_calc.h include file. Storage
|
||||
comes from libcalc.
|
||||
@@ -1306,7 +1687,7 @@ The following are the changes from calc version 2.12.1.10 to 2.12.2:
|
||||
Parse/scan warnings will not be printed if calc_print_scanwarn_msg
|
||||
is zero. By default:
|
||||
|
||||
int calc_print_scanwarn_msg = 1;
|
||||
int calc_print_scanwarn_msg = 1;
|
||||
|
||||
This variable is declared in the lib_calc.h include file. Storage
|
||||
comes from libcalc.
|
||||
@@ -1342,16 +1723,16 @@ The following are the changes from calc version 2.12.1.10 to 2.12.2:
|
||||
Replaced the concept of compiler sets in the Makefile with
|
||||
host target section in the Makefile. Initial host targets are:
|
||||
|
||||
Linux
|
||||
Linux
|
||||
Darwin
|
||||
FreeBSD
|
||||
(default) <<== Target does not match any previous target name
|
||||
Simple
|
||||
|
||||
NOTE: If your target is not supported below and the default target
|
||||
NOTE: If your target is not supported below and the default target
|
||||
is not suitable for your needs, please send to the:
|
||||
|
||||
calc-contrib at asthe dot com
|
||||
calc-contrib at asthe dot com
|
||||
|
||||
Email address an "ifeq ($(target),YOUR_TARGET_NAME)"
|
||||
... "endif" set of lines from the Makefile so that
|
||||
@@ -1360,12 +1741,12 @@ The following are the changes from calc version 2.12.1.10 to 2.12.2:
|
||||
The custom/Makefile is now constructed from 3 parts: custom/Makefile.head,
|
||||
the host target section in Makefile, and the custom/Makefile.tail.
|
||||
|
||||
The top level Makefile and the custom/Makefile require a GNU Make
|
||||
The top level Makefile and the custom/Makefile require a GNU make
|
||||
(such as gmake) or an equivalently advanced make. On many targets,
|
||||
the default make is sufficient. On FreeBSD for example, 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
|
||||
you should try using the Makefile.simple and custom/Makefile.simple
|
||||
files:
|
||||
|
||||
@@ -1496,7 +1877,7 @@ The following are the changes from calc version 2.12.1.8 to 2.12.1.9:
|
||||
comments. Improved calc comment documentation in "help unexpected"
|
||||
to help other avoid similar mistakes. Calc comments are of the form:
|
||||
|
||||
/* c style comments */
|
||||
/* c style comments */
|
||||
/*
|
||||
* multi-line
|
||||
* comments
|
||||
@@ -1510,7 +1891,7 @@ The following are the changes from calc version 2.12.1.8 to 2.12.1.9:
|
||||
|
||||
Documented these help commands in "help help":
|
||||
|
||||
help ->
|
||||
help ->
|
||||
help *
|
||||
help .
|
||||
help %
|
||||
@@ -1691,7 +2072,7 @@ The following are the changes from calc version 2.12.0 to 2.12.0.8:
|
||||
Added the builtin function fpathopen() to open a file while
|
||||
searching along a path:
|
||||
|
||||
; fd2 = fpathopen("tmp/date", "r", ".:~:~sc:/tmp:/var/tmp:/var")
|
||||
; fd2 = fpathopen("tmp/date", "r", ".:~:~sc:/tmp:/var/tmp:/var")
|
||||
; print fd2
|
||||
"/var/tmp/date"
|
||||
|
||||
@@ -1741,12 +2122,12 @@ The following are the changes from calc version 2.12.0 to 2.12.0.8:
|
||||
level. When comparing with older source, one may use the -b argument
|
||||
of the diff command to ignore changes in amount of white space:
|
||||
|
||||
diff -b -r -u calc-2.11.11 calc-2.12.0
|
||||
diff -b -r -u calc-2.11.11 calc-2.12.0
|
||||
|
||||
The read, write, and help commands use the value of global string
|
||||
variable if the symbol name starts with a $. For example:
|
||||
|
||||
global x = "lucas.cal";
|
||||
global x = "lucas.cal";
|
||||
read $x; /* same as read lucas.cal or read "lucas.cal" */
|
||||
|
||||
Added dotest.cal resource. Based on a design by Ernest Bowen
|
||||
@@ -1856,7 +2237,7 @@ The following are the changes from calc version 2.12.0 to 2.12.0.8:
|
||||
|
||||
Changed the default values for the following config() parameters:
|
||||
|
||||
config("mul2") == 1780
|
||||
config("mul2") == 1780
|
||||
config("sq2") == 3388
|
||||
config("pow2") == 176
|
||||
|
||||
@@ -1951,10 +2332,10 @@ The following are the changes from calc version 2.12.0 to 2.12.0.8:
|
||||
value is TRUE by default. Examples of variable name collisions
|
||||
include when:
|
||||
|
||||
* both local and static variables have the same name
|
||||
* both local and global variables have the same name
|
||||
* both function parameter and local variables have the same name
|
||||
* both function parameter and global variables have the same name
|
||||
* both local and static variables have the same name
|
||||
* both local and global variables have the same name
|
||||
* both function parameter and local variables have the same name
|
||||
* both function parameter and global variables have the same name
|
||||
|
||||
Fix of a bug which causes some static variables not to be correctly
|
||||
unscoped when their identifiers are used in a global declaration.
|
||||
@@ -1974,7 +2355,7 @@ The following are the changes from calc version 2.12.0 to 2.12.0.8:
|
||||
Changed the definition of the function ssq() to enable list arguments
|
||||
to be processed in the same way as in sum(). For example:
|
||||
|
||||
ssq(1,2, list(3,4,list(5,6)), list(), 7, 8)
|
||||
ssq(1,2, list(3,4,list(5,6)), list(), 7, 8)
|
||||
|
||||
returns the value of 1^2 + 2^2 + ... + 8^2 == 204.
|
||||
|
||||
@@ -1982,12 +2363,12 @@ The following are the changes from calc version 2.12.0 to 2.12.0.8:
|
||||
various ways of evaluating sums, sums of squares, etc, for large
|
||||
lists and matrices. For example:
|
||||
|
||||
read sumtimes
|
||||
read sumtimes
|
||||
doalltimes(1e6)
|
||||
|
||||
Calc now ignores carriage returns (\r), vertical tabs (\v), and
|
||||
form feeds (\f) when token parsing. Thus users on Windoz systems
|
||||
can write files using their \r\n format and users on non-Windoz
|
||||
form feeds (\f) when token parsing. Thus users on Windows systems
|
||||
can write files using their \r\n format and users on non-Windows
|
||||
systems can read them without errors.
|
||||
|
||||
The quomod() builtin function now takes an optional 5th argument
|
||||
@@ -2021,7 +2402,7 @@ The following are the changes from calc version 2.11.10.1 to 2.11.11:
|
||||
|
||||
Fixed a bug reported by the sourceforge user: cedars where:
|
||||
|
||||
ln(exp(6)) == 3 /* WRONG!!! */
|
||||
ln(exp(6)) == 3 /* WRONG!!! */
|
||||
|
||||
incorrectly returned 1. This bug was fixed by Ernest Bowen
|
||||
<ebowen at une dot edu dot au>. The regression test
|
||||
@@ -2126,7 +2507,7 @@ The following are the changes from calc version 2.11.10 to 2.11.10:
|
||||
|
||||
Fixed -d so that:
|
||||
|
||||
calc -d 2/3
|
||||
calc -d 2/3
|
||||
|
||||
will print 0.66666666666666666667 without the leading tilde as
|
||||
advertised in the man page.
|
||||
@@ -2146,7 +2527,7 @@ The following are the changes from calc version 2.11.10 to 2.11.10:
|
||||
|
||||
Added custom function:
|
||||
|
||||
custom("pmodm127", q)
|
||||
custom("pmodm127", q)
|
||||
|
||||
to compute 2^(2^127-1) mod q. While currently slower than just
|
||||
doing pmod(2,2^127-1,q), it is added to give an example of a
|
||||
@@ -2237,7 +2618,7 @@ The following are the changes from calc version 2.11.8.0 to 2.11.8.1:
|
||||
configuration (calc -n or config("all", "newstd")) is now the default
|
||||
calc configuration. The flag:
|
||||
|
||||
calc -O
|
||||
calc -O
|
||||
|
||||
was added to get the old classic calc configuration. The flag command
|
||||
line flag, -n, now does nothing. Use of -n is deprecated and may go
|
||||
@@ -2250,7 +2631,7 @@ The following are the changes from calc version 2.11.8.0 to 2.11.8.1:
|
||||
and oldstd -n & newstd classic cfg default
|
||||
--------------------------------------------------------
|
||||
epsilon 1e-20 1e-10 1e-20 1e-20
|
||||
quo 2 2 2 2
|
||||
quo 2 2 2 2
|
||||
outround 2 24 2 24
|
||||
leadzero 0 1 0 1
|
||||
fullzero 0 1 0 0
|
||||
@@ -2329,7 +2710,7 @@ The following are the changes from calc version 2.11.6.0 to 2.11.6.2:
|
||||
|
||||
Fixed help typos reported by Marc Mezzarobba <mm at mm dot ovh dot org>.
|
||||
|
||||
Forced system("") to return 0 under windoz.
|
||||
Forced system("") to return 0 under Windows.
|
||||
|
||||
The direct.h include file is not used when compiling under Cygwin.
|
||||
|
||||
@@ -2414,16 +2795,16 @@ The following are the changes from calc version 2.11.5.5 to 2.11.5.9:
|
||||
|
||||
Now using version numbers of one of these forms:
|
||||
|
||||
x.y.z.w
|
||||
x.y.z
|
||||
x.y
|
||||
x.y.z.w
|
||||
x.y.z
|
||||
x.y
|
||||
|
||||
Changed the READLINE_LIB Makefile variable to not link with -lreadline
|
||||
by default. If you do have readline, we recommend that you use it.
|
||||
If you can install the GNU readline:
|
||||
|
||||
http://freshmeat.net/projects/gnureadline/
|
||||
http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html
|
||||
http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html
|
||||
|
||||
we recommend it. But if not, you should set the USE_READLINE,
|
||||
READLINE_LIB, and READLINE_INCLUDE Makefile variables to empty.
|
||||
@@ -2495,7 +2876,7 @@ The following are the changes from calc version 2.11.5t4.1 to 2.11.5t4.4:
|
||||
Added subject requirements for the calc-tester-request and
|
||||
calc-bugs-mail Email aliases. See:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/email.html
|
||||
http://www.isthe.com/chongo/tech/comp/calc/email.html
|
||||
|
||||
for details.
|
||||
|
||||
@@ -2639,10 +3020,10 @@ The following are the changes from calc version 2.11.5t2 to 2.11.5t2.1:
|
||||
The calc builtin function, fopen(), now allows one to specify
|
||||
opening files in binary modes. On POSIX / Linux / Un*x-like systems,
|
||||
text file is the same as a binary file and so 'b' to an fopen has
|
||||
no effect and is ignored. However on systems such as MS Windoz
|
||||
no effect and is ignored. However on systems such as MS Windows
|
||||
the 'b' / binary mode has meaning. See 'help fopen' for details.
|
||||
|
||||
On systems (such as MS Windoz), calc will produce a different error
|
||||
On systems (such as MS Windows), calc will produce a different error
|
||||
message when it attempts to open /dev/tty. This will condition
|
||||
will occur in things like calc scripts when they switch from ``batch
|
||||
processing'' commands from and want to start interactive mode.
|
||||
@@ -2662,7 +3043,7 @@ The following are the changes from calc version 2.11.5t2 to 2.11.5t2.1:
|
||||
Applied a bug fix from Ernest Bowen <ernie at turing dot une dot
|
||||
edu dot au> dealing with one-line "static" declaration like:
|
||||
|
||||
static a = 1, b;
|
||||
static a = 1, b;
|
||||
|
||||
Added regression test 8310 to test for the static bug fix.
|
||||
|
||||
@@ -2677,14 +3058,14 @@ The following are the changes from calc version 2.11.5t0 to 2.11.5t1.1:
|
||||
Thanks goes to Martin Buck <m at rtin-buck dot de> for reporting
|
||||
this bug and testing the fix.
|
||||
|
||||
An effort was made to make calc easier to build under Windoz
|
||||
An effort was made to make calc easier to build under Windows
|
||||
using the Cygwin project (http://sources.redhat.com/cygwin/).
|
||||
Thanks to the work of Thomas Jones-Low (tjoneslo at softstart
|
||||
dot com), a number of #if defined(_WIN32)'s have been added
|
||||
to calc source. These changes should not effect Windoz
|
||||
to calc source. These changes should not effect Windows
|
||||
free system such as GNU/Linux, Solaris, POSIX-like, etc ...
|
||||
|
||||
Added windll.h to deal with Windoz related DLL issues.
|
||||
Added windll.h to deal with Windows related DLL issues.
|
||||
Using the convention of 'extern DLL' instead of 'DLL extern'
|
||||
to deal with symbols that export to or import from a DLL.
|
||||
|
||||
@@ -2701,12 +3082,12 @@ The following are the changes from calc version 2.11.5t0 to 2.11.5t1.1:
|
||||
If HAVE_URANDOM is NO, then the Makefile will assume /dev/urandom does
|
||||
not exist.
|
||||
|
||||
If TERMCONTROL is -DUSE_WIN32, then the Windoz terminal control
|
||||
If TERMCONTROL is -DUSE_WIN32, then the Windows terminal control
|
||||
(no TERMIOS, no TERMIO, no SGTTY) will be assumed.
|
||||
|
||||
Added a win32_hsrc Makefile rule to create hsrc files appropriate
|
||||
for a Windoz system using Cygwin gcc environment. Added win32.mkdef
|
||||
which is used by the win32_hsrc rule to set the Windoz specific
|
||||
for a Windows system using Cygwin gcc environment. Added win32.mkdef
|
||||
which is used by the win32_hsrc rule to set the Windows specific
|
||||
Makefile values to build hsrc files. The hsrc files are built
|
||||
under the win32 directory.
|
||||
|
||||
@@ -2775,7 +3156,7 @@ The following are the changes from calc version 2.11.5t0 to 2.11.5t1.1:
|
||||
Configuration values that used to return "true" or "false" now return
|
||||
1 (a true value) or 0 (a false value). Thus one can do:
|
||||
|
||||
if (config("tab")) { ... } else { ... }
|
||||
if (config("tab")) { ... } else { ... }
|
||||
|
||||
The configuration values that now return 1 or 0 are:
|
||||
|
||||
@@ -2787,7 +3168,7 @@ The following are the changes from calc version 2.11.5t0 to 2.11.5t1.1:
|
||||
config("windows")
|
||||
|
||||
Now shipping a win32 sub-directory that contains hsrc .h files
|
||||
that have been attempted to be built for windoz.
|
||||
that have been attempted to be built for Windows.
|
||||
|
||||
|
||||
The following are the changes from calc version 2.11.4t1 to 2.11.4t2:
|
||||
|
142
HOWTO.INSTALL
142
HOWTO.INSTALL
@@ -2,13 +2,22 @@
|
||||
IMPORTANT: Please see the section at the bottom of this file for
|
||||
some important information on Makefiles used in calc.
|
||||
|
||||
Installing calc from the bzip2-ed tarball in 4 easy steps:
|
||||
###################################################################
|
||||
# IMPORTANT: DO NOT use make in parallel mode!!! #
|
||||
###################################################################
|
||||
# Unfortunately due to the complex dependency issues between #
|
||||
# Makefile, Makefile.ship and custom/Makefile, parallel make #
|
||||
# is NOT recommended. Sorry (tm Canada) :) #
|
||||
###################################################################
|
||||
|
||||
(0) If your platform supports i686 RPMs, you may want to go to:
|
||||
Installing calc from the bzip2-ed tarball: 4 easy steps:
|
||||
|
||||
http://www.isthe.com/chongo/src/calc/
|
||||
(0) If your platform supports i686 RPMs, you may want to go to:
|
||||
|
||||
and use these RPMs:
|
||||
https://github.com/lcn2/calc/releases
|
||||
|
||||
Open up the 'Assets' tag below a given release and
|
||||
download these RPMs:
|
||||
|
||||
* calc*.i686.rpm
|
||||
- all that is needed if you just want to use calc
|
||||
@@ -17,17 +26,26 @@ Installing calc from the bzip2-ed tarball in 4 easy steps:
|
||||
- calc *.h header and *.a lib files for use in other programs
|
||||
|
||||
* calc.*.src.rpm
|
||||
- calc source in RPM package form
|
||||
- calc source via a SRPM package
|
||||
|
||||
The following 4 steps apply to calc source tree that comes from either:
|
||||
Alternately to the above github link, you might try looking at
|
||||
the RPMs under:
|
||||
|
||||
bunzip2 -c calc-*.tar.bz2 | tar -xvf -
|
||||
http://www.isthe.com/chongo/src/calc/
|
||||
|
||||
or from:
|
||||
=-=
|
||||
|
||||
rpm -ivh calc-*.src.rpm
|
||||
cd /var/tmp
|
||||
bunzip2 -c /usr/src/redhat/SOURCES/calc-*.tar.bz2 | tar -xvf -
|
||||
The following 4 steps apply to calc source tree that comes from either:
|
||||
|
||||
bunzip2 -c calc-*.tar.bz2 | tar -xvf -
|
||||
|
||||
or from:
|
||||
|
||||
rpm -ivh calc-*.src.rpm
|
||||
cd /var/tmp
|
||||
bunzip2 -c /usr/src/redhat/SOURCES/calc-*.tar.bz2 | tar -xvf -
|
||||
|
||||
4 steps:
|
||||
|
||||
(1) Look at the makefile, and adjust it to suit your needs.
|
||||
|
||||
@@ -46,7 +64,7 @@ Installing calc from the bzip2-ed tarball in 4 easy steps:
|
||||
make target=Darwin chk
|
||||
make target=Darwin install
|
||||
|
||||
If your target system does not have a moderm Makefile (such as gmake),
|
||||
If your target system does not have a modern Makefile (such as gmake),
|
||||
then you should try using the Makefile.simple and custom/Makefile.simple
|
||||
files:
|
||||
|
||||
@@ -61,17 +79,17 @@ Installing calc from the bzip2-ed tarball in 4 easy steps:
|
||||
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
|
||||
any values set in the Makefile 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 !
|
||||
! (such as Cygwin or DJGPP), read the README.WINDOWS file. !
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
! If you are building under Windows or a Windows-like environment !
|
||||
! (such as Cygwin or DJGPP), read the README.WINDOWS file. !
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
You should determine if these Makefile variables are reasonable:
|
||||
|
||||
@@ -79,7 +97,7 @@ Installing calc from the bzip2-ed tarball in 4 easy steps:
|
||||
BINDIR Where to install calc binary files.
|
||||
LIBDIR Where to install calc link library (*.a) files.
|
||||
CALC_SHAREDIR Where to install calc help, .cal, startup, and
|
||||
config files.
|
||||
config files.
|
||||
|
||||
You may want to change the default installation locations for
|
||||
these values, which are based on the 4 values listed above:
|
||||
@@ -100,13 +118,13 @@ Installing calc from the bzip2-ed tarball in 4 easy steps:
|
||||
|
||||
For example, if:
|
||||
|
||||
BINDIR= /usr/bin
|
||||
BINDIR= /usr/bin
|
||||
LIBDIR= /usr/lib
|
||||
CALC_SHAREDIR= /usr/share/calc
|
||||
|
||||
and if:
|
||||
|
||||
T= /var/tmp/testing
|
||||
T= /var/tmp/testing
|
||||
|
||||
Then the installation locations will be:
|
||||
|
||||
@@ -196,9 +214,6 @@ Installing calc from the bzip2-ed tarball in 4 easy steps:
|
||||
|
||||
make check
|
||||
|
||||
==> If you run into problems, read the BUGS file and follow
|
||||
the instructions found in there.
|
||||
|
||||
NOTE: For a quiet check which only prints if something goes wrong:
|
||||
|
||||
make chk
|
||||
@@ -210,6 +225,9 @@ Installing calc from the bzip2-ed tarball in 4 easy steps:
|
||||
We suggest that you might want to read the README.FIRST file and look at
|
||||
the calc help subsystem. See also the README.md file.
|
||||
|
||||
In general, if you run into problems, read the BUGS file and follow
|
||||
the instructions.
|
||||
|
||||
=-=
|
||||
|
||||
On calc Makefiles:
|
||||
@@ -233,50 +251,38 @@ SHELL= ...
|
||||
|
||||
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
|
||||
On such systems, the sh may be a much better alternative
|
||||
shell for this Makefile to use:
|
||||
|
||||
SHELL= /bin/zsh
|
||||
SHELL= /bin/sh
|
||||
|
||||
Makefile
|
||||
Makefile.local
|
||||
|
||||
# SRC: Makefile - Our calc build environment
|
||||
# SRC: Makefile.local - tweaks to the top level Makefile
|
||||
|
||||
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.
|
||||
Between releases, Makefile.local at the top of the master branch
|
||||
will contain how we typically build calc and test calc (FYI: we
|
||||
normally enable things such as -Werror -Wextra -pedantic). When we
|
||||
push out a release, Makefile.local will be stripped of non-comment
|
||||
lines. Thus, releases of calc, and, released "calc*.src.rpm"
|
||||
files and the source tarballs, will have a Makefile.local with
|
||||
only comments.
|
||||
|
||||
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:
|
||||
If the Makefile is not suitable for you (say because you fetch it
|
||||
from the top of the master branch between releases), then you may
|
||||
wish to remove all non-comment lines. I.e., lines that do not start
|
||||
with the # character.
|
||||
|
||||
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
|
||||
This Makefile.local 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
|
||||
Makefile
|
||||
|
||||
# SRC: Makefile.ship - top level Makefile
|
||||
|
||||
@@ -316,16 +322,9 @@ Makefile.ship
|
||||
...
|
||||
#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
|
||||
# SRC: Makefile.simple - non-GNU version
|
||||
|
||||
This is a non-GNU or simple Makefile designed for environments
|
||||
that do not have a modern make command.
|
||||
@@ -352,36 +351,15 @@ Makefile.simple
|
||||
|
||||
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
|
||||
# SRC: custom/Makefile.simple - non-GNU version
|
||||
|
||||
This is a non-GNU or simple Makefile for the custom directory
|
||||
that is designed for environments that do not have a modern make
|
||||
|
14
LIBRARY
14
LIBRARY
@@ -216,7 +216,7 @@ Your program must handle parse/scan errors in one of two ways:
|
||||
/* report the parse/scan */
|
||||
if (calc_use_scanerr_jmpbuf == 0) {
|
||||
printf("parse error: %s\n", calc_err_msg);
|
||||
}
|
||||
}
|
||||
|
||||
/* initialize calc after the longjmp */
|
||||
initialize();
|
||||
@@ -320,10 +320,10 @@ The arbitrary precision integer routines define a structure called a ZVALUE.
|
||||
This is defined in zmath.h. A ZVALUE contains a pointer to an array of
|
||||
integers, the length of the array, and a sign flag. The array is allocated
|
||||
using malloc, so you need to free this array when you are done with a
|
||||
ZVALUE. To do this, you should call zfree with the ZVALUE as an argument
|
||||
(or call freeh with the pointer as an argument) and never try to free the
|
||||
array yourself using free. The reason for this is that sometimes the pointer
|
||||
points to one of two statically allocated arrays which should NOT be freed.
|
||||
ZVALUE. To do this, you should call zfree() with the ZVALUE as an argument
|
||||
and never try to free the array yourself using free(). The reason for this
|
||||
is that sometimes the pointer points to a statically allocated arrays which
|
||||
should NOT be freed.
|
||||
|
||||
The ZVALUE structures are passed to routines by value, and are returned
|
||||
through pointers. For example, to multiply two small integers together,
|
||||
@@ -615,14 +615,14 @@ These have the values 0, 1, and i.
|
||||
LAST THINGS LAST
|
||||
----------------
|
||||
|
||||
If you wish, when you are all doen you can call libcalc_call_me_last()
|
||||
If you wish, when you are all done you can call libcalc_call_me_last()
|
||||
to free a small amount of storage associated with the libcalc_call_me_first()
|
||||
call. This is not required, but is does bring things to a closure.
|
||||
|
||||
The function libcalc_call_me_last() takes no args and returns void. You
|
||||
need call libcalc_call_me_last() only once.
|
||||
|
||||
## Copyright (C) 1999 David I. Bell and Landon Curt Noll
|
||||
## Copyright (C) 1999,2021 David I. Bell and Landon Curt Noll
|
||||
##
|
||||
## Calc is open software; you can redistribute it and/or modify it under
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
@@ -1 +1,18 @@
|
||||
# Add below to override Makefile values (using :=) as in: HAVE_STRING_H:= YES
|
||||
#
|
||||
# Makefile.local - local Makefile variables
|
||||
#
|
||||
# This file is included by Makefile after the last Makefile is set and
|
||||
# before the first make rule. This makes this file suitable to override
|
||||
# Makefile variables.
|
||||
#
|
||||
# To replace a Makefile variable, use := symbols. For example:
|
||||
#
|
||||
# CCWERR:= -Werror
|
||||
#
|
||||
# NOTE: You need to remove the leading '#<whitespaces>' to take effect.
|
||||
# Comments start with a #-character.
|
||||
#
|
||||
# You can append to an existing Makefile variable using '+=' symbols.
|
||||
# For example:
|
||||
#
|
||||
# CFLAGS+= -Ofast
|
||||
|
File diff suppressed because it is too large
Load Diff
117
README.RELEASE
Normal file
117
README.RELEASE
Normal file
@@ -0,0 +1,117 @@
|
||||
On calc versions and releases
|
||||
|
||||
Calc version numbers have 4 levels. For example:
|
||||
|
||||
++=== top 2 levels: calc builtin functions compatibility
|
||||
||
|
||||
vvvv
|
||||
|
||||
2.14.0.8
|
||||
\\\\\\
|
||||
^ \\\\----> top 3 levels: calc important code base change
|
||||
|
|
||||
+--- top version level: internal representation compatibility
|
||||
|
||||
The top version level (e.g., 2) refers to the internal representation
|
||||
of values. Any library or hardware linked/built for calc 2 will be able
|
||||
to use values from other 2.x.y.z versions.
|
||||
|
||||
The top 2 levels (e.g., 2.14) refers to a specific compatible set of
|
||||
builtin functions. Calc interpreted code (such as calc resource files)
|
||||
written for, say calc 2.14, will be able to use the same set of builtin
|
||||
functions for any other 2.14.y.z version. Any new builtin functions or
|
||||
significant changes to existing builtin functions would be introduced in
|
||||
a later release such as version 2.15.y.z. While calc scripts written for
|
||||
2.14.y.z will highly likely be able to run under version 2.15.y.z, any
|
||||
new builtin functions added in calc 2.15 may collide with an identically
|
||||
named used defined function.
|
||||
|
||||
The top 3 levels (e.g., 2.14.0) change to reflect an important change to
|
||||
the code base such as a bug fix or performance improvement. There was
|
||||
neither a change to the internal representation format (a top level
|
||||
version change), nor were there new calc builtins introduced in such
|
||||
a top 3 level release.
|
||||
|
||||
There are 3 classes of changes to the calc source tree:
|
||||
|
||||
alpha => untagged GitHub commit
|
||||
|
||||
Any untagged commit to the GitHub master branch should be
|
||||
considered as alpha code that may make calc unstable.
|
||||
|
||||
While we try to avoid breaking the calc code with commits,
|
||||
there is a risk that picking up such a change could
|
||||
negatively impact the code.
|
||||
|
||||
tested => tagged GitHub pre-release commit
|
||||
|
||||
A new version of calc has been released and has recently passed
|
||||
regression testing on at least to different platforms and chip
|
||||
architectures.
|
||||
|
||||
The "tested" class was historically called "untested",
|
||||
however this term was misleading as such releases ARE tested.
|
||||
Since 2.14.0.13 we have used the term "tested".
|
||||
|
||||
All tested releases are tagged with a new version number.
|
||||
Such releases have GitHub assets such as a source tarball,
|
||||
zip file, source rpm, development rpm and binary rpm. See the
|
||||
orange "Pre-release" GitHub releases under:
|
||||
|
||||
https://github.com/lcn2/calc/releases
|
||||
|
||||
At the bottom of a given release is a "> Assets" that may
|
||||
be opened to reveal down-loadable files.
|
||||
|
||||
production => tagged GitHub release commit
|
||||
|
||||
A new version of calc has been released and has undergone
|
||||
extensive testing over time over a number of platforms.
|
||||
Sometimes a "tested" release that is found work well over
|
||||
a period of time will be re-released with a new version
|
||||
number as a "production" release.
|
||||
|
||||
The latest production GitHub release is marked with green
|
||||
"Latest" label under:
|
||||
|
||||
https://github.com/lcn2/calc/releases
|
||||
|
||||
A release that has neither an orange "Pre-release" nor
|
||||
a green "Latest" label is a prior production class release.
|
||||
|
||||
At the bottom of a given release is a "> Assets" that may
|
||||
be opened to reveal down-loadable files.
|
||||
|
||||
Production class code where stability is critical should use a
|
||||
"production" release.
|
||||
|
||||
A historical note and apology:
|
||||
|
||||
In the past, some version number changes were made that did not fully
|
||||
reflect the above version number or change class. Moreover older terms
|
||||
such as "stable" and "unstable" were misleading and did not properly
|
||||
reflect the nature of the change. Sorry! The purpose of this document
|
||||
is to try and bring a better level of conformity to source code updates,
|
||||
tagged releases and version numbers.
|
||||
|
||||
## 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/12/12 19:36:26
|
||||
## 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/
|
@@ -1,19 +1,57 @@
|
||||
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 also the README file.
|
||||
|
||||
NOTE: The main developers do not have access to a Windoz based platform.
|
||||
While we will make an effort to not break calc Windoz based system,
|
||||
our lack of a Windoz test environment will mean we will make mistakes
|
||||
from time to time. Hopefully Windowz users can overcome these mistakes.
|
||||
BTW: While we are unable to use Windows 11, we welcome
|
||||
Windows 11 developers to try compiling calc natively
|
||||
(instead of via a Linux virtual machine). If you are
|
||||
able to compile Windows 11 natively, we would welcome
|
||||
GitHub pull requests showing any needed modifications:
|
||||
|
||||
https://github.com/lcn2/calc/pulls
|
||||
|
||||
Please also add notes to the 'Compiling calc under Windows 11'
|
||||
section in README.WINDOWS file.
|
||||
|
||||
NOTE: The main developers do not have access to a Windows based platform.
|
||||
While we will make an effort to not break calc Windows based system,
|
||||
our lack of a Windows test environment will mean we will make mistakes
|
||||
from time to time. Hopefully Windows users can overcome these mistakes.
|
||||
Of course you are welcome to send us any patches that fix your
|
||||
Windoz build environment.
|
||||
Windows build environment.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
=-= Compiling calc under Windows 11 =-=
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
=-= compiling with Windows Subsystem for Linux (WSL) =-Cygwin =-=
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
We were given this advice from a Windows 11 developer:
|
||||
|
||||
Windows 11 users should try:
|
||||
|
||||
https://git-scm.com/downloads
|
||||
|
||||
When you run the installer wizard, make sure you choose/check
|
||||
the git bash installer option.
|
||||
|
||||
https://www.mingw-w64.org/
|
||||
|
||||
Runtime environment for GCC & LLVM for 32 and 64 bit Windows
|
||||
|
||||
We suggest Windows 11 users consider using MINGW64.
|
||||
|
||||
We would prefer a Windows 11 solution that does not require a Windows 11
|
||||
developer to install a Linux virtual machine. Nevertheless, a Windows 11
|
||||
user might want to use the Microsoft Windows Subsystem (WSL) for Linux:
|
||||
|
||||
https://docs.microsoft.com/en-us/windows/wsl/
|
||||
|
||||
We have been told that you will need to turn on virtualization
|
||||
to use this WSL subsystem.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
=-= Compiling calc under Windows 10 via Windows Subsystem for Linux (WSL) =-=
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
|
||||
It has been reported that calc version 2.12.6.4 has been successfully
|
||||
compiled, installed and running on Windows 10 on 2018 Jan 21.
|
||||
@@ -78,9 +116,9 @@ needs.
|
||||
|
||||
In particular:
|
||||
|
||||
Just copy the win32/*.[ch] files up into the top level calc
|
||||
source directory, edit them (if needed) and build using the
|
||||
Cygwin GCC compiler and Cygwin build environment.
|
||||
Just copy the win32/*.[ch] files up into the top level calc
|
||||
source directory, edit them (if needed) and build using the
|
||||
Cygwin GCC compiler and Cygwin build environment.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
=-= compiling under DJGPP =-=
|
||||
@@ -128,7 +166,9 @@ recommends the following settings:
|
||||
CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR}
|
||||
CALCRC= ./.calcinit;~/.calcrc;${CALC_SHAREDIR}/startup
|
||||
CALCPAGER= less.exe -ci
|
||||
DEBUG= -O2 -gstabs+ -DWINDOZ
|
||||
DEBUG= -O2 -gstabs+ -D_WIN32
|
||||
HAVE_ENVIRON=-DHAVE_NO_ENVIRON
|
||||
HAVE_ARC4RANDOM=-DHAVE_NO_ARC4RANDOM
|
||||
|
||||
The 'Linux set' or 'gcc set' (see the Select your compiler type section)
|
||||
should work for DJGPP systems if you set the above Makefile variables.
|
||||
@@ -141,7 +181,7 @@ Follow those recommendations. In cases where they conflict with
|
||||
the above Makefile list, follow the recommendation in the Makefile.
|
||||
|
||||
|
||||
## Copyright (C) 2002-2009 Landon Curt Noll and Thomas Jones-Low
|
||||
## Copyright (C) 2002-2009,2021 Landon Curt Noll and Thomas Jones-Low
|
||||
##
|
||||
## 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
|
||||
|
14
SECURITY.md
Normal file
14
SECURITY.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
The most recent version of calc is supported with security updates.
|
||||
|
||||
If the most recent stable of calc is also supported with security updates.
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
To report a vulnerability, please review the BUGS file, or enter
|
||||
the calc command:
|
||||
|
||||
; help BUGS
|
2
alloc.h
2
alloc.h
@@ -42,9 +42,7 @@
|
||||
# include <string.h>
|
||||
|
||||
#else
|
||||
#if defined(_WIN32) && defined(NOTCYGWIN)
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
# if defined(HAVE_NEWSTR)
|
||||
E_FUNC void *memcpy();
|
||||
|
12
banned.h
12
banned.h
@@ -1,14 +1,14 @@
|
||||
/*
|
||||
* banned - optionally ban dqngerious functions
|
||||
* banned - optionally ban dangerous 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.
|
||||
* calc to correctly calculate: even during extremely long calculations.
|
||||
*
|
||||
* If UNBAN is NOT defined, then calling certain functions
|
||||
* will result in a syntaxc error.
|
||||
* will result in a syntax error.
|
||||
*
|
||||
* If we define UNBAN, then the effect of this file is disabled.
|
||||
*
|
||||
@@ -17,7 +17,7 @@
|
||||
* 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.
|
||||
* 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).
|
||||
@@ -88,11 +88,11 @@
|
||||
* 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
|
||||
* for calc to correctly calculate: even during extremely long
|
||||
* calculations.
|
||||
*
|
||||
* If UNBAN is NOT defined, then calling certain functions
|
||||
* will result in a syntaxc error.
|
||||
* will result in a syntax error.
|
||||
*
|
||||
* Unlike the above URL, we suggest an alternative function.
|
||||
* In many cases, additional logic is required to use the
|
||||
|
2
block.c
2
block.c
@@ -156,7 +156,7 @@ blk_free(BLOCK *blk)
|
||||
* blk - the BLOCK to check
|
||||
*
|
||||
* returns:
|
||||
* if all is ok, otherwise math_error() is called and this
|
||||
* if all is OK, otherwise math_error() is called and this
|
||||
* function does not return
|
||||
*/
|
||||
S_FUNC void
|
||||
|
22
byteswap.c
22
byteswap.c
@@ -36,7 +36,7 @@
|
||||
* swap_b8_in_HALFs - swap 8 and if needed, 16 bits in an array of HALFs
|
||||
*
|
||||
* given:
|
||||
* dest - pointer to where the swapped src wil be put or
|
||||
* dest - pointer to where the swapped src will be put or
|
||||
* NULL to allocate the storage
|
||||
* src - pointer to a HALF array to swap
|
||||
* len - length of the src HALF array
|
||||
@@ -76,7 +76,7 @@ swap_b8_in_HALFs(HALF *dest, HALF *src, LEN len)
|
||||
* swap_b8_in_ZVALUE - swap 8 and if needed, 16 bits in a ZVALUE
|
||||
*
|
||||
* given:
|
||||
* dest - pointer to where the swapped src wil be put or
|
||||
* dest - pointer to where the swapped src will be put or
|
||||
* NULL to allocate the storage
|
||||
* src - pointer to a ZVALUE to swap
|
||||
* all - TRUE => swap every element, FALSE => swap only the
|
||||
@@ -144,7 +144,7 @@ swap_b8_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all)
|
||||
* swap_b8_in_NUMBER - swap 8 and if needed, 16 bits in a NUMBER
|
||||
*
|
||||
* given:
|
||||
* dest - pointer to where the swapped src wil be put or
|
||||
* dest - pointer to where the swapped src will be put or
|
||||
* NULL to allocate the storage
|
||||
* src - pointer to a NUMBER to swap
|
||||
* all - TRUE => swap every element, FALSE => swap only the
|
||||
@@ -208,7 +208,7 @@ swap_b8_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all)
|
||||
* swap_b8_in_COMPLEX - swap 8 and if needed, 16 bits in a COMPLEX
|
||||
*
|
||||
* given:
|
||||
* dest - pointer to where the swapped src wil be put or
|
||||
* dest - pointer to where the swapped src will be put or
|
||||
* NULL to allocate the storage
|
||||
* src - pointer to a COMPLEX to swap
|
||||
* all - TRUE => swap every element, FALSE => swap only the
|
||||
@@ -272,7 +272,7 @@ swap_b8_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all)
|
||||
* swap_b16_in_HALFs - swap 16 bits in an array of HALFs
|
||||
*
|
||||
* given:
|
||||
* dest - pointer to where the swapped src wil be put or
|
||||
* dest - pointer to where the swapped src will be put or
|
||||
* NULL to allocate the storage
|
||||
* src - pointer to a HALF array to swap
|
||||
* len - length of the src HALF array
|
||||
@@ -312,7 +312,7 @@ swap_b16_in_HALFs(HALF *dest, HALF *src, LEN len)
|
||||
* swap_b16_in_ZVALUE - swap 16 bits in a ZVALUE
|
||||
*
|
||||
* given:
|
||||
* dest - pointer to where the swapped src wil be put or
|
||||
* dest - pointer to where the swapped src will be put or
|
||||
* NULL to allocate the storage
|
||||
* src - pointer to a ZVALUE to swap
|
||||
* all - TRUE => swap every element, FALSE => swap only the
|
||||
@@ -379,7 +379,7 @@ swap_b16_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all)
|
||||
* swap_b16_in_NUMBER - swap 16 bits in a NUMBER
|
||||
*
|
||||
* given:
|
||||
* dest - pointer to where the swapped src wil be put or
|
||||
* dest - pointer to where the swapped src will be put or
|
||||
* NULL to allocate the storage
|
||||
* src - pointer to a NUMBER to swap
|
||||
* all - TRUE => swap every element, FALSE => swap only the
|
||||
@@ -443,7 +443,7 @@ swap_b16_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all)
|
||||
* swap_b16_in_COMPLEX - swap 16 bits in a COMPLEX
|
||||
*
|
||||
* given:
|
||||
* dest - pointer to where the swapped src wil be put or
|
||||
* dest - pointer to where the swapped src will be put or
|
||||
* NULL to allocate the storage
|
||||
* src - pointer to a COMPLEX to swap
|
||||
* all - TRUE => swap every element, FALSE => swap only the
|
||||
@@ -507,7 +507,7 @@ swap_b16_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all)
|
||||
* swap_HALF_in_ZVALUE - swap HALFs in a ZVALUE
|
||||
*
|
||||
* given:
|
||||
* dest - pointer to where the swapped src wil be put or
|
||||
* dest - pointer to where the swapped src will be put or
|
||||
* NULL to allocate the storage
|
||||
* src - pointer to a ZVALUE to swap
|
||||
* all - TRUE => swap every element, FALSE => swap only the
|
||||
@@ -575,7 +575,7 @@ swap_HALF_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all)
|
||||
* swap_HALF_in_NUMBER - swap HALFs in a NUMBER
|
||||
*
|
||||
* given:
|
||||
* dest - pointer to where the swapped src wil be put or
|
||||
* dest - pointer to where the swapped src will be put or
|
||||
* NULL to allocate the storage
|
||||
* src - pointer to a NUMBER to swap
|
||||
* all - TRUE => swap every element, FALSE => swap only the
|
||||
@@ -639,7 +639,7 @@ swap_HALF_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all)
|
||||
* swap_HALF_in_COMPLEX - swap HALFs in a COMPLEX
|
||||
*
|
||||
* given:
|
||||
* dest - pointer to where the swapped src wil be put or
|
||||
* dest - pointer to where the swapped src will be put or
|
||||
* NULL to allocate the storage
|
||||
* src - pointer to a COMPLEX to swap
|
||||
* all - TRUE => swap every element, FALSE => swap only the
|
||||
|
20
byteswap.h
20
byteswap.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* byteswap - byte swapping macros
|
||||
*
|
||||
* 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
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -39,7 +39,7 @@
|
||||
/*
|
||||
* SWAP_B8_IN_B16 - swap 8 bits in 16 bits
|
||||
*
|
||||
* dest - pointer to where the swapped src wil be put
|
||||
* dest - pointer to where the swapped src will be put
|
||||
* src - pointer to a 16 bit value to swap
|
||||
*
|
||||
* This macro will either switch to the opposite byte sex (Big Endian vs.
|
||||
@@ -53,7 +53,7 @@
|
||||
/*
|
||||
* SWAP_B16_IN_B32 - swap 16 bits in 32 bits
|
||||
*
|
||||
* dest - pointer to where the swapped src wil be put
|
||||
* dest - pointer to where the swapped src will be put
|
||||
* src - pointer to a 32 bit value to swap
|
||||
*/
|
||||
#define SWAP_B16_IN_B32(dest, src) ( \
|
||||
@@ -64,7 +64,7 @@
|
||||
/*
|
||||
* SWAP_B8_IN_B32 - swap 8 & 16 bits in 32 bits
|
||||
*
|
||||
* dest - pointer to where the swapped src wil be put
|
||||
* dest - pointer to where the swapped src will be put
|
||||
* src - pointer to a 32 bit value to swap
|
||||
*
|
||||
* This macro will either switch to the opposite byte sex (Big Endian vs.
|
||||
@@ -82,7 +82,7 @@
|
||||
/*
|
||||
* SWAP_B32_IN_B64 - swap 32 bits in 64 bits
|
||||
*
|
||||
* dest - pointer to where the swapped src wil be put
|
||||
* dest - pointer to where the swapped src will be put
|
||||
* src - pointer to a 64 bit value to swap
|
||||
*/
|
||||
#define SWAP_B32_IN_B64(dest, src) ( \
|
||||
@@ -93,7 +93,7 @@
|
||||
/*
|
||||
* SWAP_B16_IN_B64 - swap 16 & 32 bits in 64 bits
|
||||
*
|
||||
* dest - pointer to where the swapped src wil be put
|
||||
* dest - pointer to where the swapped src will be put
|
||||
* src - pointer to a 64 bit value to swap
|
||||
*/
|
||||
#define SWAP_B16_IN_B64(dest, src) ( \
|
||||
@@ -106,7 +106,7 @@
|
||||
/*
|
||||
* SWAP_B8_IN_B64 - swap 16 & 32 bits in 64 bits
|
||||
*
|
||||
* dest - pointer to where the swapped src wil be put
|
||||
* dest - pointer to where the swapped src will be put
|
||||
* src - pointer to a 64 bit value to swap
|
||||
*
|
||||
* This macro will either switch to the opposite byte sex (Big Endian vs.
|
||||
@@ -124,7 +124,7 @@
|
||||
/*
|
||||
* SWAP_B32_IN_B64 - swap 32 bits in 64 bits (simulated by 2 32 bit values)
|
||||
*
|
||||
* dest - pointer to where the swapped src wil be put
|
||||
* dest - pointer to where the swapped src will be put
|
||||
* src - pointer to a 64 bit value to swap
|
||||
*/
|
||||
#define SWAP_B32_IN_B64(dest, src) ( \
|
||||
@@ -135,7 +135,7 @@
|
||||
/*
|
||||
* SWAP_B16_IN_B64 - swap 16 & 32 bits in 64 bits (simulated by 2 32 bit vals)
|
||||
*
|
||||
* dest - pointer to where the swapped src wil be put
|
||||
* dest - pointer to where the swapped src will be put
|
||||
* src - pointer to a 64 bit value to swap
|
||||
*/
|
||||
#define SWAP_B16_IN_B64(dest, src) ( \
|
||||
@@ -146,7 +146,7 @@
|
||||
/*
|
||||
* SWAP_B8_IN_B64 - swap 16 & 32 bits in 64 bits (simulated by 2 32 bit vals)
|
||||
*
|
||||
* dest - pointer to where the swapped src wil be put
|
||||
* dest - pointer to where the swapped src will be put
|
||||
* src - pointer to a 64 bit value to swap
|
||||
*
|
||||
* This macro will either switch to the opposite byte sex (Big Endian vs.
|
||||
|
51
cal/Makefile
51
cal/Makefile
@@ -48,14 +48,18 @@
|
||||
#
|
||||
# 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
|
||||
# On such systems, the sh 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
|
||||
SHELL= /bin/bash
|
||||
#SHELL= /bin/sh
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
ifeq ($(target),Darwin)
|
||||
SHELL:= /bin/zsh
|
||||
endif
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
|
||||
|
||||
####
|
||||
@@ -102,15 +106,6 @@ PREFIX= /usr/local
|
||||
#
|
||||
MAKE_FILE= Makefile
|
||||
|
||||
# Controlling file makefile basename (without the path)
|
||||
#
|
||||
# This is the basename same of the makefile that may/does/will drive
|
||||
# this makefile.
|
||||
#
|
||||
# If in doubt, set TOP_MAKE_FILE to Makefile
|
||||
#
|
||||
TOP_MAKE_FILE= Makefile
|
||||
|
||||
# Where the system include (.h) files are kept
|
||||
#
|
||||
# For DJGPP, select:
|
||||
@@ -220,10 +215,10 @@ T=
|
||||
# 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= >/dev/null 2>&1 silence ${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= 2>/dev/null silence command stderr during hsrc file formation
|
||||
# E= full command stderr during hsrc file formation
|
||||
#
|
||||
# V=@: do not echo debug statements (quiet mode)
|
||||
@@ -275,17 +270,17 @@ CALC_FILES= README alg_config.cal beer.cal bernoulli.cal \
|
||||
constants.cal deg.cal dms.cal dotest.cal ellip.cal factorial.cal \
|
||||
factorial2.cal gvec.cal hello.cal hms.cal infinities.cal intfile.cal \
|
||||
intnum.cal lambertw.cal linear.cal lnseries.cal lucas.cal \
|
||||
lucas_chk.cal mersenne.cal mfactor.cal mod.cal natnumset.cal pell.cal \
|
||||
pi.cal pix.cal pollard.cal poly.cal prompt.cal psqrt.cal qtime.cal \
|
||||
quat.cal randbitrun.cal randmprime.cal randombitrun.cal randomrun.cal \
|
||||
randrun.cal regress.cal repeat.cal screen.cal seedrandom.cal \
|
||||
set8700.cal set8700.line smallfactors.cal solve.cal \
|
||||
specialfunctions.cal statistics.cal strings.cal sumsq.cal sumtimes.cal \
|
||||
surd.cal test1700.cal test2300.cal test2600.cal test2700.cal \
|
||||
test3100.cal test3300.cal test3400.cal test3500.cal test4000.cal \
|
||||
test4100.cal test4600.cal test5100.cal test5200.cal test8400.cal \
|
||||
test8500.cal test8600.cal test8900.cal toomcook.cal unitfrac.cal \
|
||||
varargs.cal xx_print.cal zeta2.cal
|
||||
lucas_chk.cal mersenne.cal mfactor.cal mod.cal natnumset.cal \
|
||||
palindrome.cal pell.cal pi.cal pix.cal pollard.cal poly.cal prompt.cal \
|
||||
psqrt.cal qtime.cal quat.cal randbitrun.cal randmprime.cal \
|
||||
randombitrun.cal randomrun.cal randrun.cal regress.cal repeat.cal \
|
||||
screen.cal seedrandom.cal set8700.cal set8700.line smallfactors.cal \
|
||||
solve.cal specialfunctions.cal statistics.cal strings.cal sumsq.cal \
|
||||
sumtimes.cal surd.cal test1700.cal test2300.cal test2600.cal \
|
||||
test2700.cal test3100.cal test3300.cal test3400.cal test3500.cal \
|
||||
test4000.cal test4100.cal test4600.cal test5100.cal test5200.cal \
|
||||
test8400.cal test8500.cal test8600.cal test8900.cal toomcook.cal \
|
||||
unitfrac.cal varargs.cal xx_print.cal zeta2.cal
|
||||
|
||||
# These calc files are now obsolete and are removed by the install rule.
|
||||
#
|
||||
@@ -461,7 +456,7 @@ uninstall:
|
||||
continue; \
|
||||
fi; \
|
||||
if [ -f "${T}${CALC_SHAREDIR}/$$i" ]; then \
|
||||
${RM} -f "${T}${CALC_SHAREDIR}/$$i"; \
|
||||
${RM} -f "${T}${CALC_SHAREDIR}/$$i"; \
|
||||
if [ -f "${T}${CALC_SHAREDIR}/$$i" ]; then \
|
||||
echo "cannot uninstall ${T}${CALC_SHAREDIR}/$$i"; \
|
||||
else \
|
||||
|
40
cal/README
40
cal/README
@@ -186,7 +186,7 @@ bernoulli.cal
|
||||
Calculate the nth Bernoulli number.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
@@ -767,7 +767,7 @@ lucas.cal
|
||||
prove that h*2^n-1 is prime or not prime.
|
||||
|
||||
NOTE: Some call this term u(0). The function gen_u0(h, n, v1)
|
||||
simply calls gen_u2(h, n, v1) for such people. :-)
|
||||
simply calls gen_u2(h, n, v1) for such people. :-)
|
||||
|
||||
gen_v1(h, v)
|
||||
|
||||
@@ -879,6 +879,38 @@ natnumset.cal
|
||||
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 palindromes 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
|
||||
|
||||
pellx(D)
|
||||
@@ -900,7 +932,7 @@ pi.cal
|
||||
as your free memory space and system up time allows.
|
||||
|
||||
The piforever() function (written by Klaus Alexander Seistrup
|
||||
<klaus@seistrup.dk>) was inspired by an algorithm conceived by
|
||||
<klaus at seistrup dot dk>) was inspired by an algorithm conceived by
|
||||
Lambert Meertens. See also the ABC Programmer's Handbook, by Geurts,
|
||||
Meertens & Pemberton, published by Prentice-Hall (UK) Ltd., 1990.
|
||||
|
||||
@@ -1435,7 +1467,7 @@ sumtimes.cal
|
||||
the list or matrix to use. The doalltimes() function will run
|
||||
all of the sumtimes tests. For example:
|
||||
|
||||
doalltimes(1e6);
|
||||
doalltimes(1e6);
|
||||
|
||||
|
||||
surd.cal
|
||||
|
@@ -474,7 +474,7 @@ define best_mul2()
|
||||
*/
|
||||
while (low+1 < high) {
|
||||
|
||||
/* try the mid-point */
|
||||
/* try the mid-point */
|
||||
mid = int((low+high)/2);
|
||||
if (config("user_debug") > 0) {
|
||||
printf("testing multiply alg1/alg2 ratio for len = %d\n", mid);
|
||||
@@ -497,7 +497,7 @@ define best_mul2()
|
||||
low = mid;
|
||||
high = mid;
|
||||
if (config("user_debug") > 0) {
|
||||
printf("\twe are close enough to unity ratio at: %d\n", mid);
|
||||
printf("\twe are close enough to unity ratio at: %d\n", mid);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -505,7 +505,7 @@ define best_mul2()
|
||||
/* bump lower range up if we went over */
|
||||
if (ratio > 1.0) {
|
||||
if (config("user_debug") > 2) {
|
||||
printf("\tmove low from %d up to %d\n",
|
||||
printf("\tmove low from %d up to %d\n",
|
||||
low, mid);
|
||||
}
|
||||
low = mid;
|
||||
@@ -513,7 +513,7 @@ define best_mul2()
|
||||
/* drop higher range down if we went under */
|
||||
} else {
|
||||
if (config("user_debug") > 2) {
|
||||
printf("\tmove high from %d down to %d\n",
|
||||
printf("\tmove high from %d down to %d\n",
|
||||
high, mid);
|
||||
}
|
||||
high = mid;
|
||||
@@ -522,7 +522,7 @@ define best_mul2()
|
||||
/* report on test loop progress */
|
||||
if (config("user_debug") > 1) {
|
||||
printf("\tsetting low: %d high: %d diff: %d\n",
|
||||
low, high, high-low);
|
||||
low, high, high-low);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -884,7 +884,7 @@ define best_sq2()
|
||||
high *= expand;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" expand the next test range by a factor of %d\n",
|
||||
expand);
|
||||
expand);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -956,7 +956,7 @@ define best_sq2()
|
||||
*/
|
||||
while (low+1 < high) {
|
||||
|
||||
/* try the mid-point */
|
||||
/* try the mid-point */
|
||||
mid = int((low+high)/2);
|
||||
if (config("user_debug") > 0) {
|
||||
printf("testing square alg1/alg2 ratio for len = %d\n", mid);
|
||||
@@ -979,7 +979,7 @@ define best_sq2()
|
||||
low = mid;
|
||||
high = mid;
|
||||
if (config("user_debug") > 0) {
|
||||
printf("\twe are close enough to unity ratio at: %d\n", mid);
|
||||
printf("\twe are close enough to unity ratio at: %d\n", mid);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -987,7 +987,7 @@ define best_sq2()
|
||||
/* bump lower range up if we went over */
|
||||
if (ratio > 1.0) {
|
||||
if (config("user_debug") > 2) {
|
||||
printf("\tmove low from %d up to %d\n",
|
||||
printf("\tmove low from %d up to %d\n",
|
||||
low, mid);
|
||||
}
|
||||
low = mid;
|
||||
@@ -995,7 +995,7 @@ define best_sq2()
|
||||
/* drop higher range down if we went under */
|
||||
} else {
|
||||
if (config("user_debug") > 2) {
|
||||
printf("\tmove high from %d down to %d\n",
|
||||
printf("\tmove high from %d down to %d\n",
|
||||
high, mid);
|
||||
}
|
||||
high = mid;
|
||||
@@ -1004,7 +1004,7 @@ define best_sq2()
|
||||
/* report on test loop progress */
|
||||
if (config("user_debug") > 1) {
|
||||
printf("\tsetting low: %d high: %d diff: %d\n",
|
||||
low, high, high-low);
|
||||
low, high, high-low);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1385,7 +1385,7 @@ define best_pow2()
|
||||
printf(" pmod alg1/alg2 ratio = %.3f\n", ratio);
|
||||
if (ratio > 1.0 && ratio <= 1.02) {
|
||||
printf(" while alg1 is slightly better than alg2, "
|
||||
"it is not clearly better\n");
|
||||
"it is not clearly better\n");
|
||||
}
|
||||
}
|
||||
} while (ratio <= 1.02);
|
||||
@@ -1420,7 +1420,7 @@ define best_pow2()
|
||||
high *= expand;
|
||||
if (config("user_debug") > 1) {
|
||||
printf(" expand the next test range by a factor of %d\n",
|
||||
expand);
|
||||
expand);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1455,7 +1455,7 @@ define best_pow2()
|
||||
*/
|
||||
while (low+1 < high) {
|
||||
|
||||
/* try the mid-point */
|
||||
/* try the mid-point */
|
||||
mid = int((low+high)/2);
|
||||
if (config("user_debug") > 0) {
|
||||
printf("testing pow2 alg1/alg2 ratio for len = %d\n", mid);
|
||||
@@ -1478,7 +1478,7 @@ define best_pow2()
|
||||
low = mid;
|
||||
high = mid;
|
||||
if (config("user_debug") > 0) {
|
||||
printf("\twe are close enough to unity ratio at: %d\n", mid);
|
||||
printf("\twe are close enough to unity ratio at: %d\n", mid);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1486,7 +1486,7 @@ define best_pow2()
|
||||
/* bump lower range up if we went over */
|
||||
if (ratio > 1.0) {
|
||||
if (config("user_debug") > 2) {
|
||||
printf("\tmove low from %d up to %d\n",
|
||||
printf("\tmove low from %d up to %d\n",
|
||||
low, mid);
|
||||
}
|
||||
low = mid;
|
||||
@@ -1494,7 +1494,7 @@ define best_pow2()
|
||||
/* drop higher range down if we went under */
|
||||
} else {
|
||||
if (config("user_debug") > 2) {
|
||||
printf("\tmove high from %d down to %d\n",
|
||||
printf("\tmove high from %d down to %d\n",
|
||||
high, mid);
|
||||
}
|
||||
high = mid;
|
||||
@@ -1503,7 +1503,7 @@ define best_pow2()
|
||||
/* report on test loop progress */
|
||||
if (config("user_debug") > 1) {
|
||||
printf("\tsetting low: %d high: %d diff: %d\n",
|
||||
low, high, high-low);
|
||||
low, high, high-low);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -40,7 +40,7 @@ define Z(x, eps_term)
|
||||
|
||||
/* obtain the error term */
|
||||
if (isnull(eps_term)) {
|
||||
eps = epsilon();
|
||||
eps = epsilon();
|
||||
} else {
|
||||
eps = eps_term;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ define P(x, eps_term)
|
||||
|
||||
/* obtain the error term */
|
||||
if (isnull(eps_term)) {
|
||||
eps = epsilon();
|
||||
eps = epsilon();
|
||||
} else {
|
||||
eps = eps_term;
|
||||
}
|
||||
|
22
cal/dms.cal
22
cal/dms.cal
@@ -188,7 +188,7 @@ define dms_abs(a)
|
||||
|
||||
/* firewall - just absolute value non dms objects */
|
||||
if (! istype(a, ans)) {
|
||||
return abs(a);
|
||||
return abs(a);
|
||||
}
|
||||
|
||||
/* compute degrees */
|
||||
@@ -352,24 +352,8 @@ define fixdms(a)
|
||||
quit "attempt to fix a non dms object";
|
||||
}
|
||||
|
||||
/* force minutes to be integral */
|
||||
a.min += frac(a.deg) * 60;
|
||||
a.deg = int(a.deg);
|
||||
|
||||
/* force degrees to be integral */
|
||||
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;
|
||||
/* use builtin d2dms function */
|
||||
d2dms(a.deg + a.min/60 + a.sec/3600, a.deg, a.min, a.sec),;
|
||||
|
||||
/* return normalized result */
|
||||
return a;
|
||||
|
@@ -157,7 +157,7 @@ define dotest(dotest_file, dotest_code = 0, dotest_maxcond = -1)
|
||||
* test the close of the line file
|
||||
*/
|
||||
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);
|
||||
fclose(dotest_f_file);
|
||||
|
||||
|
@@ -56,7 +56,7 @@ define __CZ__factor_factorial(n,start){
|
||||
if(start){
|
||||
if(!isint(start) && start < 0 && start > n)
|
||||
return newerror("__CZ__factor_factorial(n,start): value of "
|
||||
"parameter 'start' out of range");
|
||||
"parameter 'start' out of range");
|
||||
if(start == n && isprime(n)){
|
||||
prime_list = mat[1 , 2];
|
||||
prime_list[0,0] = n;
|
||||
@@ -64,7 +64,7 @@ define __CZ__factor_factorial(n,start){
|
||||
}
|
||||
else if(!isprime(start) && nextprime(start) >n)
|
||||
return newerror("__CZ__factor_factorial(n,start): value of parameter "
|
||||
"'start' out of range");
|
||||
"'start' out of range");
|
||||
else{
|
||||
if(!isprime(start)) prime = nextprime(start);
|
||||
else prime = start;
|
||||
@@ -225,11 +225,11 @@ define __CZ__multiply_factored_factorial(matrix,stop){
|
||||
|
||||
if(!ismat(matrix))
|
||||
return newerror("__CZ__multiply_factored_factorial(matrix): "
|
||||
"argument matrix not a matrix ");
|
||||
"argument matrix not a matrix ");
|
||||
if(!matrix[0,0])
|
||||
return
|
||||
newerror("__CZ__multiply_factored_factorial(matrix): "
|
||||
"matrix[0,0] is null/0");
|
||||
"matrix[0,0] is null/0");
|
||||
|
||||
if(!isnull(stop))
|
||||
pix = stop;
|
||||
@@ -376,7 +376,7 @@ define bigcatalan(n){
|
||||
|
||||
/*
|
||||
df(-111) = -1/3472059605858239446587523014902616804783337112829102414124928
|
||||
7753332469144201839599609375
|
||||
7753332469144201839599609375
|
||||
|
||||
df(-3+1i) = 0.12532538977287649201-0.0502372106177184607i
|
||||
df(2n + 1) = (2*n)!/(n!*2^n)
|
||||
@@ -427,7 +427,7 @@ define doublefactorial(n){
|
||||
*/
|
||||
eps=epsilon(epsilon()*1e-2);
|
||||
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);
|
||||
return ret;
|
||||
}
|
||||
|
22
cal/hms.cal
22
cal/hms.cal
@@ -188,7 +188,7 @@ define hms_abs(a)
|
||||
|
||||
/* firewall - just absolute value non hms objects */
|
||||
if (! istype(a, ans)) {
|
||||
return abs(a);
|
||||
return abs(a);
|
||||
}
|
||||
|
||||
/* compute hours */
|
||||
@@ -352,24 +352,8 @@ define fixhms(a)
|
||||
quit "attempt to fix a non hms object";
|
||||
}
|
||||
|
||||
/* force minutes to be integral */
|
||||
a.min += frac(a.hour) * 60;
|
||||
a.hour = int(a.hour);
|
||||
|
||||
/* force hours to be integral */
|
||||
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;
|
||||
/* use builtin h2hms function */
|
||||
h2hms(a.hour + a.min/60 + a.sec/3600, a.hour, a.min, a.sec),;
|
||||
|
||||
/* return normalized result */
|
||||
return a;
|
||||
|
@@ -156,7 +156,7 @@ define be2file(v, filename)
|
||||
*/
|
||||
octlen = int((highbit(v)+8) / 8);
|
||||
for (i=octlen-1; i >= 0; --i) {
|
||||
fputc(fd, char(v >> (i*8)));
|
||||
fputc(fd, char(v >> (i*8)));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -731,7 +731,7 @@ rodseth_xhn(x, h, n)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Check for jacobi(x-2, h*2^n-1) == 1 (Ref4, condition 1) part 1
|
||||
*/
|
||||
testval = h*2^n-1;
|
||||
@@ -739,7 +739,7 @@ rodseth_xhn(x, h, n)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Check for jacobi(x+2, h*2^n-1) == -1 (Ref4, condition 1) part 2
|
||||
*/
|
||||
if (jacobi(x+2, testval) != -1) {
|
||||
|
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 @@
|
||||
/*
|
||||
* pi - various routines to calculate pi
|
||||
*
|
||||
* Copyright (C) 1999-2004 David I. Bell
|
||||
* Copyright (C) 1999-2004,2021 David I. Bell
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -74,7 +74,7 @@ define qpi(epsilon)
|
||||
/*
|
||||
* Print digits of PI forever, neatly formatted, using calc.
|
||||
*
|
||||
* Written by Klaus Alexander Seistrup <klaus@seistrup.dk>
|
||||
* Written by Klaus Alexander Seistrup <klaus at seistrup dot dk>
|
||||
* on a dull Friday evening in November 1999.
|
||||
*
|
||||
* Inspired by an algorithm conceived by Lambert Meertens.
|
||||
|
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* qtime - Display time as English sentence
|
||||
*
|
||||
* Copyright (C) 1999 Klaus Alexander Seistrup and Landon Curt Noll
|
||||
* Copyright (C) 1999,2021 Klaus Alexander Seistrup and Landon Curt Noll
|
||||
*
|
||||
* Written by: Klaus Alexander Seistrup <kseis@magnetic-ink.dk>
|
||||
* Written by: Klaus Alexander Seistrup <kseis at magnetic-ink dot dk>
|
||||
* With mods by: Landon Curt Noll <http://www.isthe.com/chongo/>
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
|
416
cal/regress.cal
416
cal/regress.cal
@@ -775,7 +775,9 @@ print '016: parsed test_bignums()';
|
||||
/*
|
||||
* 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()
|
||||
{
|
||||
@@ -1718,7 +1720,7 @@ define test_rand()
|
||||
print '1503: state0 = srand(0)';
|
||||
vrfy(state0 == init, '1504: state0 == init');
|
||||
|
||||
/* test the additive 55 shuffle generator */
|
||||
/* test the subtractive 100 shuffle generator */
|
||||
tmp = srand(0);
|
||||
print '1505: tmp = srand(0)';
|
||||
vrfy(rand() == 0x1fe5b46fba7e069d, \
|
||||
@@ -3400,9 +3402,11 @@ define test_trig()
|
||||
|
||||
print '3400: Beginning test_trig';
|
||||
|
||||
/* test 3401-3407 */
|
||||
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()';
|
||||
|
||||
@@ -4746,7 +4750,7 @@ define test_random()
|
||||
print '5303: state0 = srandom(0)';
|
||||
vrfy(state0 == init, '5304: state0 == init');
|
||||
|
||||
/* test the additive 55 shuffle generator */
|
||||
/* test the subtractive 100 shuffle generator */
|
||||
tmp = srandom(0);
|
||||
print '5305: tmp = srandom(0)';
|
||||
vrfy(random() == 0x7fb838a8a0a95046, \
|
||||
@@ -7097,9 +7101,10 @@ define test_sha1()
|
||||
vrfy(sha1("x", "y", "z") == sha1("xyz"),
|
||||
'7208: sha1("x", "y", "z") == sha1("xyz")');
|
||||
|
||||
vrfy(sha1(sha1("this is",7^19-8,"a composit",3i+4.5,"hash")) ==
|
||||
0xc3e1b562bf45b3bcfc055ac65b5b39cdeb6a6c55,
|
||||
'7209: sha1(sha1("this is",7^19-8,"a composit",3i+4.5,"hash")) == ...');
|
||||
vrfy(sha1(sha1("this is",7^19-8,"a composite",3i+4.5,"hash")) ==
|
||||
0x68aa4fe0a9b6d1662f8d2dbdeee8879239185d09,
|
||||
'7209: sha1(sha1("this is",7^19-8,"a composite",3i+4.5,"hash")) ' +
|
||||
'== ...');
|
||||
|
||||
|
||||
z = sha1(list(1,2,3), "curds and whey", 2^21701-1, pi(1e-100));
|
||||
@@ -8165,6 +8170,8 @@ ecnt = 211;
|
||||
* Test 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_functions2()
|
||||
{
|
||||
@@ -8278,6 +8285,401 @@ print;
|
||||
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
|
||||
*
|
||||
|
@@ -1,7 +1,7 @@
|
||||
##
|
||||
## set8700 - dotest line tests for the 8700 set of regress.cal
|
||||
##
|
||||
## Copyright (C) 2006 Ernest Bowen and Landon Curt Noll
|
||||
## Copyright (C) 2006,2021 Ernest Bowen and Landon Curt Noll
|
||||
##
|
||||
## Calc is open software; you can redistribute it and/or modify it under
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -159,7 +159,7 @@ set8700_A = 42, protect(set8700_A,1024), set8700_B = set8700_A, protect(set8700_
|
||||
set8700_A = 6 * 7, protect(set8700_A) == 1024
|
||||
set8700_A == set8700_B
|
||||
|
||||
## Testing matrix protectioon
|
||||
## Testing matrix protection
|
||||
set8700_A = mat [3] = {1, 2, list(3,4)}; 1
|
||||
protect(set8700_A, 65, 1), protect(set8700_A) == 1089
|
||||
protect(set8700_A[0]) == 65
|
||||
@@ -261,7 +261,7 @@ protect(set8700_L[0]) == 0
|
||||
protect(set8700_L[1]) == 512 ## protect(set8700_A) copied
|
||||
protect(set8700_L[1][1]) == 1024 ## protect(set8700_A[1]) copied
|
||||
|
||||
## Testing list with "intialization"
|
||||
## Testing list with "initialization"
|
||||
set8700_L = list(1,2,3), protect(set8700_L) == 0
|
||||
protect(set8700_L[0]) | protect(set8700_L[1]) | protect(set8700_L[2]) == 0 ## All zero
|
||||
set8700_L = {1,set8700_A}, set8700_L[1] == set8700_A
|
||||
|
@@ -371,7 +371,7 @@ define normalcdf(x,mu,sigma){
|
||||
|
||||
define probit(p){
|
||||
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){
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* sumtimes - runtimes evaluating sums & squares of large lists and mats
|
||||
* sumtimes - runtime evaluating sums & squares of large lists and mats
|
||||
*
|
||||
* Copyright (C) 2006 Ernest Bowen
|
||||
* Copyright (C) 2006,2021 Ernest Bowen
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -160,7 +160,7 @@ define timehmean(N, M = 10) {
|
||||
v2 = hmean(sumtimes_A);
|
||||
sumtimes_t2 = usertime();
|
||||
print v1, v2;
|
||||
print "List harmonic meanruntimes";
|
||||
print "List harmonic mean runtimes";
|
||||
printf('\tStandard "for" loop:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0);
|
||||
printf('\tUsing builtin "hmean":\t\t%.4f\n', sumtimes_t2 - sumtimes_t1);
|
||||
}
|
||||
|
@@ -2867,7 +2867,7 @@ define t035()
|
||||
epsilon(eps);
|
||||
return 6;
|
||||
}
|
||||
/* Percentiles. Numbers shamlessly stolen from a question at stackoverflow*/
|
||||
/* Percentiles. Numbers shamelessly stolen from a question at stackoverflow */
|
||||
if (abs
|
||||
(invbetainc(0.025, 10008, 151744) -
|
||||
0.060703546312525377697082321820950758320207425674954679415395) >
|
||||
@@ -3081,7 +3081,7 @@ define test8900(verbose = 0, tnum, testnum = 8903)
|
||||
return tnum;
|
||||
}
|
||||
|
||||
/* We will cause erors intentionally. A lot of them. */
|
||||
/* We will cause errors intentionally. A lot of them. */
|
||||
old_errmax = errmax(-1);
|
||||
|
||||
/*
|
||||
|
@@ -336,7 +336,7 @@ define __CZ__produce_long_random_number(n)
|
||||
ret = 1;
|
||||
if(!isint(n) || n<1)
|
||||
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++){
|
||||
ret += random();
|
||||
ret = toomcook4square(ret);
|
||||
|
@@ -72,7 +72,7 @@ define hurwitzzeta(s,a){
|
||||
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_function=ceil(sqrt((limit+realpart_a/2-.25)^2+(imagpart_s*1.)^2/4)/
|
||||
pi());
|
||||
pi());
|
||||
if (config("user_debug") > 0) {
|
||||
print "limit_function = " limit_function;
|
||||
print "limit = " limit;
|
||||
|
39
calc.c
39
calc.c
@@ -29,14 +29,14 @@
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
|
||||
#if !defined (_WIN32)
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
# include <pwd.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
# include <io.h>
|
||||
# if !defined(NOTCYGWIN)
|
||||
/*
|
||||
@@ -49,7 +49,7 @@
|
||||
# endif
|
||||
# define strdup _strdup
|
||||
# define isatty _isatty
|
||||
#endif /* Windoz */
|
||||
#endif /* Windows */
|
||||
|
||||
#define CALC_C
|
||||
#include "calc.h"
|
||||
@@ -277,14 +277,14 @@ main(int argc, char **argv)
|
||||
if (nextcp(&cp, &index, argc, argv,
|
||||
FALSE)) {
|
||||
fprintf(stderr,
|
||||
"-D expects argument\n");
|
||||
"-D expects argument\n");
|
||||
exit(5);
|
||||
}
|
||||
havearg = TRUE;
|
||||
if (*cp != ':') {
|
||||
if (*cp < '0' || *cp > '9') {
|
||||
fprintf(stderr,
|
||||
"-D expects"
|
||||
"-D expects"
|
||||
" integer\n");
|
||||
exit(6);
|
||||
}
|
||||
@@ -296,13 +296,13 @@ main(int argc, char **argv)
|
||||
if (*cp != '\0' &&
|
||||
*cp != ' ' && *cp != ':') {
|
||||
fprintf(stderr,
|
||||
"Bad syntax im -D"
|
||||
"Bad syntax im -D"
|
||||
" arg\n");
|
||||
exit(7);
|
||||
}
|
||||
if (*cp != ':') {
|
||||
if (nextcp(&cp, &index,
|
||||
argc, argv,
|
||||
argc, argv,
|
||||
FALSE)
|
||||
|| *cp != ':')
|
||||
break;
|
||||
@@ -318,7 +318,7 @@ main(int argc, char **argv)
|
||||
if (*cp != ':') {
|
||||
if (*cp < '0' || *cp > '9') {
|
||||
fprintf(stderr,
|
||||
"-D : expects"
|
||||
"-D : expects"
|
||||
" integer\n");
|
||||
exit(9);
|
||||
}
|
||||
@@ -330,13 +330,13 @@ main(int argc, char **argv)
|
||||
if (*cp != '\0' &&
|
||||
*cp != ' ' && *cp != ':') {
|
||||
fprintf(stderr,
|
||||
"Bad syntax im -D"
|
||||
"Bad syntax im -D"
|
||||
" : arg\n");
|
||||
exit(10);
|
||||
}
|
||||
if (*cp != ':') {
|
||||
if (nextcp(&cp, &index,
|
||||
argc, argv,
|
||||
argc, argv,
|
||||
FALSE)
|
||||
|| *cp != ':') {
|
||||
break;
|
||||
@@ -346,12 +346,12 @@ main(int argc, char **argv)
|
||||
if (nextcp(&cp, &index, argc, argv,
|
||||
FALSE)) {
|
||||
fprintf(stderr, "-D : : expects"
|
||||
" argument\n");
|
||||
" argument\n");
|
||||
exit(11);
|
||||
}
|
||||
if (*cp < '0' || *cp > '9') {
|
||||
fprintf(stderr, "-D :: expects"
|
||||
" integer\n");
|
||||
" integer\n");
|
||||
exit(12);
|
||||
}
|
||||
user_debug = cp;
|
||||
@@ -398,7 +398,7 @@ main(int argc, char **argv)
|
||||
if (nextcp(&cp, &index, argc,
|
||||
argv, haveendstr)) {
|
||||
fprintf(stderr, "-f -once"
|
||||
" expects"
|
||||
" expects"
|
||||
" filename\n");
|
||||
exit(16);
|
||||
}
|
||||
@@ -548,7 +548,6 @@ main(int argc, char **argv)
|
||||
setbuf(stdout, NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* initialize
|
||||
*/
|
||||
@@ -705,18 +704,18 @@ main(int argc, char **argv)
|
||||
if (!p_flag && i_flag && !stdin_tty) {
|
||||
closeinput();
|
||||
if(!freopen("/dev/tty", "r", stdin)) {
|
||||
#if defined (_WIN32)
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
fprintf(stderr,
|
||||
"/dev/tty does not exist on "
|
||||
"this operating system. "
|
||||
"Change operating systems\n"
|
||||
"or don't use this calc mode "
|
||||
"in the future, sorry!\n");
|
||||
#else /* Windoz free systems */
|
||||
#else /* Windows free systems */
|
||||
fprintf(stderr,
|
||||
"Unable to associate stdin"
|
||||
" with /dev/tty");
|
||||
#endif /* Windoz free systems */
|
||||
#endif /* Windows free systems */
|
||||
set_run_state(RUN_EXIT_WITH_ERROR);
|
||||
break;
|
||||
}
|
||||
@@ -735,18 +734,18 @@ main(int argc, char **argv)
|
||||
!p_flag && (!havecommands||i_flag)) {
|
||||
closeinput();
|
||||
if(!freopen("/dev/tty", "r", stdin)) {
|
||||
#if defined (_WIN32)
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
fprintf(stderr,
|
||||
"/dev/tty does not exist on "
|
||||
"this operating system. "
|
||||
"Change operating systems\n"
|
||||
"or don't use this calc mode "
|
||||
"in the future, sorry!\n");
|
||||
#else /* Windoz free systems */
|
||||
#else /* Windows free systems */
|
||||
fprintf(stderr,
|
||||
"Unable to associate stdin"
|
||||
" with /dev/tty");
|
||||
#endif /* Windoz free systems */
|
||||
#endif /* Windows free systems */
|
||||
set_run_state(RUN_EXIT_WITH_ERROR);
|
||||
break;
|
||||
}
|
||||
|
6
calc.h
6
calc.h
@@ -59,7 +59,7 @@
|
||||
#define HOMECHAR '~' /* char which indicates home directory */
|
||||
#define DOTCHAR '.' /* char which indicates current directory */
|
||||
#define PATHCHAR '/' /* char which separates path components */
|
||||
#if defined(__MSDOS__) || defined(__WIN32)
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#define LISTCHAR ';' /* char which separates paths in a list */
|
||||
#else
|
||||
#define LISTCHAR ':' /* char which separates paths in a list */
|
||||
@@ -123,7 +123,7 @@ E_FUNC int get_inode(FILEID id, ZVALUE *ino);
|
||||
E_FUNC FILEID reopenid(FILEID id, char *mode, char *name);
|
||||
E_FUNC int closeall(void);
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
E_FUNC int flushall(void);
|
||||
#endif
|
||||
|
||||
@@ -186,7 +186,7 @@ E_FUNC char *calc_strdup(CONST char *);
|
||||
*/
|
||||
E_FUNC void initialize(void);
|
||||
E_FUNC void reinitialize(void);
|
||||
#if !defined (_WIN32)
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
E_FUNC int isatty(int tty); /* TRUE if fd is a tty */
|
||||
#endif
|
||||
E_FUNC char *version(void); /* return version string */
|
||||
|
4
calc.man
4
calc.man
@@ -252,7 +252,7 @@ For example:
|
||||
.fi
|
||||
.in -5n
|
||||
.sp 1
|
||||
This allows the script to run independely of
|
||||
This allows the script to run independently of
|
||||
startup scripts.
|
||||
|
||||
.sp 1
|
||||
@@ -1445,7 +1445,7 @@ 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:
|
||||
If you do not want to use calc GitHub, then send Email to:
|
||||
.sp
|
||||
.in +0.5i
|
||||
.nf
|
||||
|
12
calc.spec.in
12
calc.spec.in
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# calc.spec.in - template specfile for calc
|
||||
#
|
||||
# Copyright (C) 2003-2014 Petteri Kettunen and Landon Curt Noll
|
||||
# Copyright (C) 2003-2014,2021 Petteri Kettunen and Landon Curt Noll
|
||||
#
|
||||
# Calc is open software; you can redistribute it and/or modify it under
|
||||
# the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -49,7 +49,7 @@ BuildRoot: %{_tmppath}/build-root
|
||||
Calc is arbitrary precision C-like arithmetic system that is a
|
||||
calculator, an algorithm prototype and mathematical research
|
||||
tool. Calc comes with a rich set of builtin mathematical and
|
||||
programmatic functions.
|
||||
programming functions.
|
||||
|
||||
For the latest calc release, see the calc project home page:
|
||||
|
||||
@@ -165,11 +165,11 @@ echo '-=- calc.spec beginning make clean -=-'
|
||||
%attr(644, root, root) %{_libdir}/libcustcalc.a
|
||||
|
||||
%changelog
|
||||
* Sun Mar 24 2019 cLandon Curt Noll http://www.isthe.com/chongo
|
||||
* Sun Mar 24 2019 Landon 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.
|
||||
by clearing the ARCH_CFLAGS value in order to maximize
|
||||
the RPM binary portability.
|
||||
|
||||
* Mon Sep 01 2014 Landon Curt Noll http://www.isthe.com/chongo
|
||||
- Release: 12
|
||||
@@ -178,7 +178,7 @@ echo '-=- calc.spec beginning make clean -=-'
|
||||
use -j1 while building these RPMs to avoid this make bug.
|
||||
This only impacts the speed of building the rpms.
|
||||
- Stopped removing %{_buildroot} at the beginning of install
|
||||
as this, acording to a number of sources, was asking for trouble.
|
||||
as this, according to a number of sources, was asking for trouble.
|
||||
- Clean removes tmp, BUILD, SPEC, and BUILDROOT dirs under topdir.
|
||||
- Fixed the building of the calc-debuginfo rpm.
|
||||
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
|
||||
|
50
calcerr.tbl
50
calcerr.tbl
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# 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
|
||||
# the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -259,7 +259,7 @@ E_COPY6 Non-integer or negative destination index for copy
|
||||
E_COPY7 Destination index too large for copy
|
||||
E_COPY8 Freed block source for copy
|
||||
E_COPY9 Unsuitable source type for copy
|
||||
E_COPY10 Freed block destinction for copy
|
||||
E_COPY10 Freed block destination for copy
|
||||
E_COPY11 Unsuitable destination type for copy
|
||||
E_COPY12 Incompatible source and destination for copy
|
||||
E_COPY13 No-copy-from source variable
|
||||
@@ -496,3 +496,49 @@ E_ATANH3 Invalid value for calculating atan
|
||||
E_ACOTH3 Invalid value for calculating acot
|
||||
E_ASECH3 Invalid value for calculating asec
|
||||
E_ACSCH3 Invalid value for calculating acsc
|
||||
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 arguments 1, 2 or 3 for dms2d
|
||||
E_DMS2D2 Invalid rounding arg 4 for dms2d
|
||||
E_DM2D1 Non-real-number arguments 1 or 2 for dm2d
|
||||
E_DM2D2 Invalid rounding arg 4 for dm2d
|
||||
E_GMS2G1 Non-real-number arguments 1, 2 or 3 for gms2g
|
||||
E_GMS2G2 Invalid rounding arg 4 for gms2g
|
||||
E_GM2G1 Non-real-number arguments 1 or 2 for gm2g
|
||||
E_GM2G2 Invalid rounding arg 4 for gm2g
|
||||
E_HMS2H1 Non-real-number arguments 1, 2 or 3 for hms2h
|
||||
E_HMS2H2 Invalid rounding arg 4 for hms2h
|
||||
E_HM2H1 Non-real-number arguments 1 or 2 for hm2h
|
||||
E_HM2H2 Invalid rounding arg 4 for hm2h
|
||||
|
67
charbit.c
Normal file
67
charbit.c
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* charbit - determine what CHAR_BIT is and define CALC_CHARBIT
|
||||
*
|
||||
* 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/12/07 20:57:50
|
||||
* 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/
|
||||
*/
|
||||
|
||||
/*
|
||||
* usage:
|
||||
* charbit
|
||||
*
|
||||
* This prog outputs several defines:
|
||||
*
|
||||
* CALC_CHARBIT
|
||||
* after including have_limits.h and perhaps <limits.h>,
|
||||
* output CALC_CHARBIT as CHAR_BIT (from <limits.h>, or as 8.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "have_limits.h"
|
||||
#if defined(HAVE_LIMITS_H)
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "banned.h" /* include after system header <> includes */
|
||||
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
printf("#include \"have_limits.h\"\n");
|
||||
printf("#if defined(HAVE_LIMITS_H)\n");
|
||||
printf("#include <limits.h>\n");
|
||||
printf("#endif\n\n");
|
||||
#if defined(CHAR_BIT)
|
||||
|
||||
printf("#define CALC_CHARBIT (CHAR_BIT) /* from <limits.h> */\n");
|
||||
|
||||
#else /* CHAR_BIT */
|
||||
|
||||
printf("#define CALC_CHARBIT (8) /* no CHAR_BIT, assume 8 */\n");
|
||||
|
||||
#endif /* CHAR_BIT */
|
||||
|
||||
/* exit(0); */
|
||||
return 0;
|
||||
}
|
@@ -44,9 +44,11 @@
|
||||
#include "conf.h"
|
||||
#include "strl.h"
|
||||
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#if !defined(__CYGWIN__)
|
||||
# include <direct.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#include "banned.h" /* include after system header <> includes */
|
||||
@@ -451,7 +453,7 @@ getsimplebody(void)
|
||||
|
||||
|
||||
/*
|
||||
* Get the body of a function, or a subbody of a function.
|
||||
* Get the body of a function, or a sub-body of a function.
|
||||
* body = '{' [ declarations ] ... [ statement ] ... '}'
|
||||
* | [ declarations ] ... [statement ] ... '\n'
|
||||
*/
|
||||
@@ -1516,7 +1518,7 @@ getexprlist(void)
|
||||
|
||||
|
||||
/*
|
||||
* Get an opassignment or possibly just an assignment or expression.
|
||||
* Get an op-assignment or possibly just an assignment or expression.
|
||||
* Returns flags describing the type of assignment or expression found.
|
||||
* assignment = lvalue '=' assignment
|
||||
* | lvalue '+=' assignment
|
||||
|
24
config.c
24
config.c
@@ -149,8 +149,8 @@ CONFIG oldstd = { /* backward compatible standard configuration */
|
||||
SQ_ALG2, /* size of number to use square alg 2 */
|
||||
POW_ALG2, /* size of modulus to use REDC for powers */
|
||||
REDC_ALG2, /* size of modulus to use REDC algorithm 2 */
|
||||
TRUE, /* ok to print a tilde on approximations */
|
||||
TRUE, /* ok to print tab before numeric values */
|
||||
TRUE, /* OK to print a tilde on approximations */
|
||||
TRUE, /* OK to print tab before numeric values */
|
||||
0, /* quomod() default rounding mode */
|
||||
2, /* quotient // default rounding mode */
|
||||
0, /* mod % default rounding mode */
|
||||
@@ -160,8 +160,8 @@ CONFIG oldstd = { /* backward compatible standard configuration */
|
||||
8, /* cfsim() default rounding mode */
|
||||
2, /* output default rounding mode */
|
||||
24, /* round()/bround() default rounding mode */
|
||||
FALSE, /* ok to print leading 0 before decimal pt */
|
||||
0, /* ok to print trailing 0's */
|
||||
FALSE, /* OK to print leading 0 before decimal pt */
|
||||
0, /* OK to print trailing 0's */
|
||||
MAXSCANCOUNT, /* max scan errors before abort */
|
||||
PROMPT1, /* normal prompt */
|
||||
PROMPT2, /* prompt when inside multi-line input */
|
||||
@@ -176,10 +176,10 @@ CONFIG oldstd = { /* backward compatible standard configuration */
|
||||
CTRL_D_VIRGIN_EOF, /* ^D only exits on virgin lines */
|
||||
NULL, /* our name */
|
||||
NULL, /* basename of our name */
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
TRUE, /* running under windows */
|
||||
#else
|
||||
FALSE, /* congrats, you are not using windows */
|
||||
FALSE, /* not using windows */
|
||||
#endif
|
||||
#if defined(__CYGWIN__)
|
||||
TRUE, /* compiled under cygwin */
|
||||
@@ -209,8 +209,8 @@ CONFIG newstd = { /* new non-backward compatible configuration */
|
||||
SQ_ALG2, /* size of number to use square alg 2 */
|
||||
POW_ALG2, /* size of modulus to use REDC for powers */
|
||||
REDC_ALG2, /* size of modulus to use REDC algorithm 2 */
|
||||
TRUE, /* ok to print a tilde on approximations */
|
||||
TRUE, /* ok to print tab before numeric values */
|
||||
TRUE, /* OK to print a tilde on approximations */
|
||||
TRUE, /* OK to print tab before numeric values */
|
||||
0, /* quomod() default rounding mode */
|
||||
2, /* quotient // default rounding mode */
|
||||
0, /* mod % default rounding mode */
|
||||
@@ -220,8 +220,8 @@ CONFIG newstd = { /* new non-backward compatible configuration */
|
||||
8, /* cfsim() default rounding mode */
|
||||
24, /* output default rounding mode */
|
||||
24, /* round()/bround() default rounding mode */
|
||||
TRUE, /* ok to print leading 0 before decimal pt */
|
||||
0, /* ok to print trailing 0's */
|
||||
TRUE, /* OK to print leading 0 before decimal pt */
|
||||
0, /* OK to print trailing 0's */
|
||||
MAXSCANCOUNT, /* max scan errors before abort */
|
||||
"; ", /* normal prompt */
|
||||
";; ", /* prompt when inside multi-line input */
|
||||
@@ -236,10 +236,10 @@ CONFIG newstd = { /* new non-backward compatible configuration */
|
||||
CTRL_D_VIRGIN_EOF, /* ^D only exits on virgin lines */
|
||||
NULL, /* our name */
|
||||
NULL, /* basename of our name */
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
TRUE, /* running under windows */
|
||||
#else
|
||||
FALSE, /* congrats, you are not using windows */
|
||||
FALSE, /* not using windows */
|
||||
#endif
|
||||
#if defined(__CYGWIN__)
|
||||
TRUE, /* compiled under cygwin */
|
||||
|
8
config.h
8
config.h
@@ -130,8 +130,8 @@ struct config {
|
||||
LEN sq2; /* size of number to use square algorithm 2 */
|
||||
LEN pow2; /* size of modulus to use REDC for powers */
|
||||
LEN redc2; /* size of modulus to use REDC algorithm 2 */
|
||||
BOOL tilde_ok; /* ok to print a tilde on approximations */
|
||||
BOOL tab_ok; /* ok to print tab before numeric values */
|
||||
BOOL tilde_ok; /* OK to print a tilde on approximations */
|
||||
BOOL tab_ok; /* OK to print tab before numeric values */
|
||||
LEN quomod; /* quomod() default rounding mode */
|
||||
LEN quo; /* quotient // default rounding mode */
|
||||
LEN mod; /* mod % default rounding mode */
|
||||
@@ -141,8 +141,8 @@ struct config {
|
||||
LEN cfsim; /* cfsim() default rounding mode */
|
||||
LEN outround; /* output default rounding mode */
|
||||
LEN round; /* round()/bround() default rounding mode */
|
||||
BOOL leadzero; /* ok to print leading 0 before decimal pt */
|
||||
BOOL fullzero; /* ok to print trailing 0's */
|
||||
BOOL leadzero; /* OK to print leading 0 before decimal pt */
|
||||
BOOL fullzero; /* OK to print trailing 0's */
|
||||
long maxscancount; /* max scan errors before abort */
|
||||
char *prompt1; /* normal prompt */
|
||||
char *prompt2; /* prompt when inside multi-line input */
|
||||
|
13
const.c
13
const.c
@@ -44,16 +44,16 @@ initconstants(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
consttable = (NUMBER **) malloc(sizeof(NUMBER *) * CONSTALLOCSIZE);
|
||||
consttable = (NUMBER **) calloc(sizeof(NUMBER *), CONSTALLOCSIZE);
|
||||
if (consttable == NULL) {
|
||||
math_error("Unable to allocate constant table");
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
for (i = 0; i < INITCONSTCOUNT; i++)
|
||||
for (i = 0; initnumbs[i] != NULL; i++) {
|
||||
consttable[i] = initnumbs[i];
|
||||
consttable[INITCONSTCOUNT] = NULL; /* firewall */
|
||||
constcount = INITCONSTCOUNT;
|
||||
constavail = CONSTALLOCSIZE - INITCONSTCOUNT;
|
||||
}
|
||||
constcount = i-1;
|
||||
constavail = CONSTALLOCSIZE - constcount;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,6 +123,9 @@ addqconstant(NUMBER *q)
|
||||
tp = consttable;
|
||||
for (index = 0; index < constcount; index++, tp++) {
|
||||
t = *tp;
|
||||
if (t == NULL) { /* paranoia */
|
||||
break;
|
||||
}
|
||||
if (t->links == 0) {
|
||||
if (!havefirst) {
|
||||
havefirst = TRUE;
|
||||
|
@@ -47,14 +47,18 @@
|
||||
#
|
||||
# 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
|
||||
# On such systems, the sh 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
|
||||
SHELL= /bin/bash
|
||||
#SHELL= /bin/sh
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
ifeq ($(target),Darwin)
|
||||
SHELL:= /bin/zsh
|
||||
endif
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
|
||||
|
||||
####
|
||||
@@ -101,15 +105,6 @@ PREFIX= /usr/local
|
||||
#
|
||||
MAKE_FILE= Makefile
|
||||
|
||||
# Controlling file makefile basename (without the path)
|
||||
#
|
||||
# This is the basename same of the makefile that may/does/will drive
|
||||
# this makefile.
|
||||
#
|
||||
# If in doubt, set TOP_MAKE_FILE to Makefile
|
||||
#
|
||||
TOP_MAKE_FILE= Makefile
|
||||
|
||||
# Where the system include (.h) files are kept
|
||||
#
|
||||
# For DJGPP, select:
|
||||
@@ -219,10 +214,10 @@ T=
|
||||
# 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= >/dev/null 2>&1 silence ${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= 2>/dev/null silence command stderr during hsrc file formation
|
||||
# E= full command stderr during hsrc file formation
|
||||
#
|
||||
# V=@: do not echo debug statements (quiet mode)
|
||||
@@ -497,7 +492,7 @@ uninstall:
|
||||
continue; \
|
||||
fi; \
|
||||
if [ -f "${T}${SCRIPTDIR}/$$i" ]; then \
|
||||
${RM} -f "${T}${SCRIPTDIR}/$$i"; \
|
||||
${RM} -f "${T}${SCRIPTDIR}/$$i"; \
|
||||
if [ -f "${T}${SCRIPTDIR}/$$i" ]; then \
|
||||
echo "cannot uninstall ${T}${SCRIPTDIR}/$$i"; \
|
||||
else \
|
||||
|
@@ -92,7 +92,7 @@ if (base_lim <= 2^20+1) { /* 2^20 requires ~96 Megs of memory */
|
||||
}
|
||||
|
||||
/*
|
||||
* remove nestest powers
|
||||
* remove nearest powers
|
||||
*/
|
||||
while (abs(x) >= base_lim) {
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/usr/local/src/bin/calc/calc -q -p -f
|
||||
/*
|
||||
* sqaure - print the squares of input values
|
||||
* square - print the squares of input values
|
||||
*
|
||||
* Copyright (C) 2000-2007,2014,2019,2021 Ernest Bowen
|
||||
*
|
||||
|
@@ -4,7 +4,7 @@ Custom calc resource files
|
||||
The following custom calc resource files are provided because they serve
|
||||
as examples of how use the custom interface. The custom interface
|
||||
allows for machine dependent and/or non-portable code to be added as
|
||||
builtins to the calc program. A few example custom functions and
|
||||
built-ins to the calc program. A few example custom functions and
|
||||
resource files are shipped with calc to provide you with examples.
|
||||
|
||||
By default, the custom builtin returns an error. Calc have been
|
||||
@@ -41,7 +41,7 @@ pzasusb8.cal
|
||||
Run custom("pzasusb8") on a standard set of data, print Endian
|
||||
related information and print value size information.
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
@@ -374,12 +374,12 @@ Step 5: Write your custom function
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
|
815
custom/Makefile
815
custom/Makefile
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# Copyright (C) 1999-2006,2014,2017-2018,2021 Landon Curt Noll
|
||||
#
|
||||
# SRC: Makefile via make -f Makefile.ship custom/Makefile
|
||||
# SRC: custom/Makefile
|
||||
#
|
||||
# The "# SRC: ... - ..." comment line above indicates
|
||||
# the origin of this file.
|
||||
@@ -35,25 +35,6 @@
|
||||
# calculator by David I. Bell with help/mods from others
|
||||
# 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
|
||||
#
|
||||
@@ -72,9 +53,13 @@
|
||||
#
|
||||
# SHELL= /bin/zsh
|
||||
#
|
||||
SHELL= /bin/sh
|
||||
#SHELL= /bin/bash
|
||||
#SHELL= /bin/zsh
|
||||
SHELL= /bin/bash
|
||||
#SHELL= /bin/sh
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
ifeq ($(target),Darwin)
|
||||
SHELL:= /bin/zsh
|
||||
endif
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
|
||||
|
||||
# PREFIX - Top level location for calc
|
||||
@@ -145,6 +130,15 @@ CCBAN= -UUNBAN
|
||||
|
||||
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
|
||||
# Unfortunately due to the complex dependency issues between
|
||||
# Makefile, and custom/Makefile, parallel GNU make
|
||||
# is NOT recommended.
|
||||
#
|
||||
# XXX - fix this - XXX
|
||||
#
|
||||
.NOTPARALLEL:
|
||||
|
||||
##############################################################################
|
||||
#-=-=-=-=-=-=-=-=- Identify the target machine, if possible -=-=-=-=-=-=-=-=-#
|
||||
##############################################################################
|
||||
@@ -160,10 +154,6 @@ target=$(shell uname -s 2>/dev/null)
|
||||
endif
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
|
||||
##############################################################################
|
||||
#-=-=-=-=-=-=-=-=- You may want to change some values below -=-=-=-=-=-=-=-=-#
|
||||
##############################################################################
|
||||
|
||||
# The custom calc resource files to install
|
||||
#
|
||||
# Put your custom calc resource files here.
|
||||
@@ -207,6 +197,10 @@ CUSTOM_SRC= c_argv.c c_devnull.c c_help.c c_sysinfo.c c_pzasusb8.c \
|
||||
CUSTOM_OBJ= c_argv.o c_devnull.o c_help.o c_sysinfo.o c_pzasusb8.o \
|
||||
c_pmodm127.o c_register.o
|
||||
|
||||
##############################################################################
|
||||
#-=-=-=-=-=-=-=-=- You may want to change some values below -=-=-=-=-=-=-=-=-#
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
#-=-=-=-=-=-=- Defaults in case you want to build from this dir -=-=-=-=-=-=-#
|
||||
##############################################################################
|
||||
@@ -222,10 +216,10 @@ CUSTOM_OBJ= c_argv.o c_devnull.o c_help.o c_sysinfo.o c_pzasusb8.o \
|
||||
# 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= >/dev/null 2>&1 silence ${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= 2>/dev/null silence command stderr during hsrc file formation
|
||||
# E= full command stderr during hsrc file formation
|
||||
#
|
||||
# V=@: do not echo debug statements (quiet mode)
|
||||
@@ -363,7 +357,7 @@ T=
|
||||
|
||||
# Debug/Optimize options for ${CC} and ${LCC}
|
||||
#
|
||||
# Select DEBUG= -O2 -gstabs+ -DWINDOZ for DJGPP.
|
||||
# Select DEBUG= -O2 -gstabs+ -D_WIN32 for DJGPP.
|
||||
#
|
||||
#DEBUG=
|
||||
#
|
||||
@@ -392,7 +386,7 @@ DEBUG= -O3 -g3
|
||||
#DEBUG= -gx
|
||||
#DEBUG= -WM,-g
|
||||
#
|
||||
#DEBUG= -O2 -gstabs+ -DWINDOZ
|
||||
#DEBUG= -O2 -gstabs+ -D_WIN32
|
||||
|
||||
# Some systems require one to use ranlib to add a symbol table to
|
||||
# a *.a link library. Set RANLIB to the utility that performs this
|
||||
@@ -411,15 +405,6 @@ RANLIB=ranlib
|
||||
MAKE_FILE= Makefile
|
||||
#MAKE_FILE=
|
||||
|
||||
# Controlling file makefile basename (without the path)
|
||||
#
|
||||
# This is the basename same of the makefile that may/does/will drive
|
||||
# this makefile.
|
||||
#
|
||||
# If in doubt, set TOP_MAKE_FILE to Makefile
|
||||
#
|
||||
TOP_MAKE_FILE= Makefile
|
||||
|
||||
# If you do not wish to use purify, set PURIFY to an empty string.
|
||||
#
|
||||
# If in doubt, use PURIFY=
|
||||
@@ -480,7 +465,7 @@ ALLOW_CUSTOM= -DCUSTOM
|
||||
# the extension required by such.
|
||||
#
|
||||
# EXT= # normal Un*x / Linux / GNU/Linux systems
|
||||
# EXT=.exe # windoz / Cygwin
|
||||
# EXT=.exe # Windows / Cygwin
|
||||
#
|
||||
# If in doubt, use EXT=
|
||||
#
|
||||
@@ -489,7 +474,7 @@ EXT=
|
||||
|
||||
# The default calc versions
|
||||
#
|
||||
VERSION= 2.14.0.0
|
||||
VERSION= 2.14.0.14
|
||||
|
||||
# Names of shared libraries with versions
|
||||
#
|
||||
@@ -504,9 +489,11 @@ CHMOD= chmod
|
||||
CMP= cmp
|
||||
CO= co
|
||||
CP= cp
|
||||
DIFF= diff
|
||||
FMT= fmt
|
||||
GREP= egrep
|
||||
LN= ln
|
||||
LS= ls
|
||||
MAKE= make
|
||||
MAKEDEPEND= makedepend
|
||||
MKDIR= mkdir
|
||||
@@ -515,6 +502,7 @@ RM= rm
|
||||
RMDIR= rmdir
|
||||
SED= sed
|
||||
SORT= sort
|
||||
TAIL= tail
|
||||
TOUCH= touch
|
||||
TRUE= true
|
||||
|
||||
@@ -576,649 +564,21 @@ LDFLAGS= ${LD_DEBUG} ${ILDFLAGS}
|
||||
|
||||
#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
|
||||
|
||||
###########################################################
|
||||
# NOTE: Start of section from the middle of Makefile.ship #
|
||||
###########################################################
|
||||
|
||||
##############################################################################
|
||||
#-=-=-=-=-=- host target section - targets that override defaults -=-=-=-=-=-#
|
||||
##############################################################################
|
||||
|
||||
# Common values set in targets
|
||||
#
|
||||
# BLD_TYPE determines if calc is built with static and/or dynamic libs.
|
||||
# Set this value to one of:
|
||||
#
|
||||
# BLD_TYPE= calc-dynamic-only
|
||||
# BLD_TYPE= calc-static-only
|
||||
#
|
||||
# CC_SHARE are flags given to ${CC} to build .o files suitable for shared libs
|
||||
# DEFAULT_LIB_INSTALL_PATH is where calc programs look for calc shared libs
|
||||
# LD_SHARE are common flags given to ${CC} to link with shared libraries
|
||||
# LIBCALC_SHLIB are flags given to ${CC} to build libcalc shared libraries
|
||||
# LIBCUSTCALC_SHLIB are flags given to ${CC} to build libcustcalc shared lib
|
||||
#
|
||||
# NOTE: The above 5 values are unused if BLD_TYPE= calc-static-only
|
||||
#
|
||||
# CC_STATIC are flags given to ${CC} to build .o files suitable for static libs
|
||||
# LD_STATIC are common flags given to ${CC} to link with static libraries
|
||||
# LIBCALC_STATIC are flags given to ${CC} to build libcalc static libraries
|
||||
# LIBCUSTCALC_STATIC are flags given to ${CC} to build libcustcalc static lib
|
||||
#
|
||||
# NOTE: The above 4 values are unused if BLD_TYPE= calc-dynamic-only
|
||||
#
|
||||
# CCOPT are flags given to ${CC} for optimization
|
||||
# CCWARN are flags given to ${CC} for warning message control
|
||||
#
|
||||
# The following are given to ${CC}:
|
||||
#
|
||||
# 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,
|
||||
# which is useful only when CCWERR is set to -Werror.
|
||||
#
|
||||
# NOTE: If your compiler does not have these -Wno files, just
|
||||
# set these variables to nothing as in:
|
||||
#
|
||||
# WNO_IMPLICT=
|
||||
# WNO_ERROR_LONG_LONG=
|
||||
# WNO_LONG_LONG=
|
||||
#
|
||||
# CCWERR are flags given to ${CC} to make warnings fatal errors
|
||||
# NOTE: CCWERR is only set in development Makefiles and must only be
|
||||
# used with ${CC}, not ${LCC}. If you do not want the compiler
|
||||
# to abort on warnings, then leave CCWERR blank.
|
||||
# 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
|
||||
# CC is how the C compiler is invoked (with an optional Purify)
|
||||
#
|
||||
# Specific target overrides or modifications to default values
|
||||
|
||||
##########################################################################
|
||||
# NOTE: If your target is not supported below and the default target #
|
||||
# is not suitable for your needs, please send to the: #
|
||||
# #
|
||||
# calc-contrib at asthe dot com #
|
||||
# #
|
||||
# Email address an "ifeq ($(target),YOUR_TARGET_NAME)" ... "endif" #
|
||||
# set of lines so that we can consider them for the next release. #
|
||||
#=-=-=-=-=- Be careful if you change something below this line -=-=-=-=-=#
|
||||
##########################################################################
|
||||
|
||||
# include start from top Makefile - keep this line
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
################
|
||||
# Linux target #
|
||||
################
|
||||
|
||||
ifeq ($(target),Linux)
|
||||
###
|
||||
#
|
||||
BLD_TYPE= calc-dynamic-only
|
||||
# Allow Makefile.local to override any of the above settings
|
||||
#
|
||||
CC_SHARE= -fPIC
|
||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
|
||||
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
||||
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
||||
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
||||
ifdef ALLOW_CUSTOM
|
||||
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
|
||||
else
|
||||
LIBCUSTCALC_SHLIB=
|
||||
endif
|
||||
#
|
||||
CC_STATIC=
|
||||
LD_STATIC=
|
||||
LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
#
|
||||
# If you want to add flags to all compiler and linker
|
||||
# run (via ${COMMON_CFLAGS} and ${COMMON_LDFLAGS}),
|
||||
# set ${COMMON_ADD}.
|
||||
#
|
||||
# For example to use gcc's -Werror to force warnings
|
||||
# to become errors, call make with:
|
||||
#
|
||||
# make .. COMMON_ADD='-Werror'
|
||||
#
|
||||
# This facility requires a Gnu Makefile, or a make command
|
||||
# that understands the += make operand.
|
||||
#
|
||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||
#
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
WNO_LONG_LONG= -Wno-long-long
|
||||
CCWERR=
|
||||
CCOPT= ${DEBUG}
|
||||
CCMISC=
|
||||
#
|
||||
LCC= gcc
|
||||
CC= ${PURIFY} ${LCC} ${CCWERR}
|
||||
#
|
||||
endif
|
||||
|
||||
###############################
|
||||
# Apple macOS / Darwin target #
|
||||
###############################
|
||||
|
||||
ifeq ($(target),Darwin)
|
||||
#
|
||||
BLD_TYPE= calc-dynamic-only
|
||||
#
|
||||
CC_SHARE= -fPIC
|
||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:${LIBDIR}:${PREFIX}/lib
|
||||
LD_SHARE= ${DARWIN_ARCH}
|
||||
#SET_INSTALL_NAME= no
|
||||
SET_INSTALL_NAME= yes
|
||||
ifeq ($(SET_INSTALL_NAME),yes)
|
||||
LIBCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib \
|
||||
-install_name ${LIBDIR}/libcalc${LIB_EXT_VERSION} ${DARWIN_ARCH}
|
||||
else
|
||||
LIBCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib \
|
||||
${DARWIN_ARCH}
|
||||
endif
|
||||
ifdef ALLOW_CUSTOM
|
||||
ifeq ($(SET_INSTALL_NAME),yes)
|
||||
LIBCUSTCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib \
|
||||
-install_name ${LIBDIR}/libcustcalc${LIB_EXT_VERSION} ${DARWIN_ARCH}
|
||||
else
|
||||
LIBCUSTCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib \
|
||||
${DARWIN_ARCH}
|
||||
endif
|
||||
else
|
||||
LIBCUSTCALC_SHLIB=
|
||||
endif
|
||||
#
|
||||
CC_STATIC=
|
||||
LD_STATIC= ${DARWIN_ARCH}
|
||||
LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
#
|
||||
# If you want to add flags to all compiler and linker
|
||||
# run (via ${COMMON_CFLAGS} and ${COMMON_LDFLAGS}),
|
||||
# set ${COMMON_ADD}.
|
||||
#
|
||||
# For example to use clang's -fsanitize for calc testing,
|
||||
# which requires a common set of flags to be passed to
|
||||
# every compile and link, then call make with:
|
||||
#
|
||||
# make .. COMMON_ADD='-fsanitize=undefined -fsanitize=address'
|
||||
#
|
||||
# This facility requires a Gnu Makefile, or a make command
|
||||
# that understands the += make operand.
|
||||
#
|
||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||
#
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
WNO_LONG_LONG= -Wno-long-long
|
||||
CCWERR=
|
||||
CCOPT= ${DEBUG}
|
||||
CCMISC= ${DARWIN_ARCH}
|
||||
#
|
||||
LCC= clang
|
||||
CC= ${PURIFY} ${LCC} ${CCWERR}
|
||||
#
|
||||
# Darwin dynamic shared lib filenames
|
||||
LIB_EXT:= .dylib
|
||||
LIB_EXT_VERSION:= .${VERSION}${LIB_EXT}
|
||||
# LDCONFIG not required on this platform, so we redefine it to an empty string
|
||||
LDCONFIG:=
|
||||
# DARWIN_ARCH= -arch i386 -arch ppc # Universal binary
|
||||
# DARWIN_ARCH= -arch i386 # Intel binary
|
||||
# DARWIN_ARCH= -arch ppc # PPC binary
|
||||
# DARWIN_ARCH= -arch x86_64 # native 64-bit binary
|
||||
DARWIN_ARCH= # native binary
|
||||
endif
|
||||
|
||||
##################
|
||||
# FreeBSD target #
|
||||
##################
|
||||
|
||||
########################################################################
|
||||
# NOTE: You MUST either use gmake (GNU Make) or you must try your luck #
|
||||
# with Makefile.simple and custom/Makefile.simple versions. #
|
||||
# See HOWTO.INSTALL for more information. #
|
||||
########################################################################
|
||||
|
||||
ifeq ($(target),FreeBSD)
|
||||
#
|
||||
BLD_TYPE= calc-dynamic-only
|
||||
#
|
||||
CC_SHARE= -fPIC
|
||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
|
||||
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
||||
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
||||
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
||||
ifdef ALLOW_CUSTOM
|
||||
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
|
||||
else
|
||||
LIBCUSTCALC_SHLIB=
|
||||
endif
|
||||
#
|
||||
CC_STATIC=
|
||||
LD_STATIC=
|
||||
LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
#
|
||||
# If you want to add flags to all compiler and linker
|
||||
# run (via ${COMMON_CFLAGS} and ${COMMON_LDFLAGS}),
|
||||
# set ${COMMON_ADD}.
|
||||
#
|
||||
# For example to use gcc's -Werror to force warnings
|
||||
# to become errors, call make with:
|
||||
#
|
||||
# make .. COMMON_ADD='-Werror'
|
||||
#
|
||||
# This facility requires a Gnu Makefile, or a make command
|
||||
# that understands the += make operand.
|
||||
#
|
||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||
#
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
WNO_LONG_LONG= -Wno-long-long
|
||||
CCWERR=
|
||||
CCOPT= ${DEBUG}
|
||||
CCMISC=
|
||||
#
|
||||
LCC= gcc
|
||||
CC= ${PURIFY} ${LCC} ${CCWERR}
|
||||
#
|
||||
MAKE= gmake
|
||||
#
|
||||
endif
|
||||
|
||||
##################
|
||||
# OpenBSD target #
|
||||
##################
|
||||
|
||||
########################################################################
|
||||
# NOTE: You MUST either use gmake (GNU Make) or you must try your luck #
|
||||
# with Makefile.simple and custom/Makefile.simple versions. #
|
||||
# See HOWTO.INSTALL for more information. #
|
||||
########################################################################
|
||||
|
||||
ifeq ($(target),OpenBSD)
|
||||
#
|
||||
BLD_TYPE= calc-dynamic-only
|
||||
#
|
||||
CC_SHARE= -fPIC
|
||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
|
||||
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
||||
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
||||
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
||||
ifdef ALLOW_CUSTOM
|
||||
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
|
||||
else
|
||||
LIBCUSTCALC_SHLIB=
|
||||
endif
|
||||
#
|
||||
CC_STATIC=
|
||||
LD_STATIC=
|
||||
LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
#
|
||||
# If you want to add flags to all compiler and linker
|
||||
# run (via ${COMMON_CFLAGS} and ${COMMON_LDFLAGS}),
|
||||
# set ${COMMON_ADD}.
|
||||
#
|
||||
# For example to use gcc's -Werror to force warnings
|
||||
# to become errors, call make with:
|
||||
#
|
||||
# make .. COMMON_ADD='-Werror'
|
||||
#
|
||||
# This facility requires a Gnu Makefile, or a make command
|
||||
# that understands the += make operand.
|
||||
#
|
||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||
#
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
WNO_LONG_LONG= -Wno-long-long
|
||||
CCWERR=
|
||||
CCOPT= ${DEBUG}
|
||||
CCMISC=
|
||||
#
|
||||
LCC= gcc
|
||||
CC= ${PURIFY} ${LCC} ${CCWERR}
|
||||
#
|
||||
MAKE= gmake
|
||||
#
|
||||
endif
|
||||
|
||||
################
|
||||
# SunOS target #
|
||||
################
|
||||
|
||||
ifeq ($(target),SunOS)
|
||||
#
|
||||
BLD_TYPE= calc-dynamic-only
|
||||
#
|
||||
CC_SHARE= -fPIC
|
||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
|
||||
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
||||
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
||||
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
||||
ifdef ALLOW_CUSTOM
|
||||
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
|
||||
else
|
||||
LIBCUSTCALC_SHLIB=
|
||||
endif
|
||||
#
|
||||
CC_STATIC=
|
||||
LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
LD_STATIC=
|
||||
#
|
||||
# If you want to add flags to all compiler and linker
|
||||
# run (via ${COMMON_CFLAGS} and ${COMMON_LDFLAGS}),
|
||||
# set ${COMMON_ADD}.
|
||||
#
|
||||
# For example to use gcc's -Werror to force warnings
|
||||
# to become errors, call make with:
|
||||
#
|
||||
# make .. COMMON_ADD='-Werror'
|
||||
#
|
||||
# This facility requires a Gnu Makefile, or a make command
|
||||
# that understands the += make operand.
|
||||
#
|
||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||
#
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
WNO_LONG_LONG= -Wno-long-long
|
||||
CCWERR=
|
||||
CCOPT= ${DEBUG}
|
||||
CCMISC=
|
||||
#
|
||||
LCC= gcc
|
||||
CC= ${PURIFY} ${LCC} ${CCWERR}
|
||||
#
|
||||
endif
|
||||
|
||||
#################
|
||||
# Cygwin target #
|
||||
#################
|
||||
|
||||
ifeq ($(target),Cygwin)
|
||||
#
|
||||
BLD_TYPE= calc-static-only
|
||||
#
|
||||
CC_SHARE= -fPIC
|
||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
|
||||
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
||||
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
||||
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
||||
ifdef ALLOW_CUSTOM
|
||||
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
|
||||
else
|
||||
LIBCUSTCALC_SHLIB=
|
||||
endif
|
||||
#
|
||||
CC_STATIC=
|
||||
LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
LD_STATIC=
|
||||
#
|
||||
# If you want to add flags to all compiler and linker
|
||||
# run (via ${COMMON_CFLAGS} and ${COMMON_LDFLAGS}),
|
||||
# set ${COMMON_ADD}.
|
||||
#
|
||||
# For example to use gcc's -Werror to force warnings
|
||||
# to become errors, call make with:
|
||||
#
|
||||
# make .. COMMON_ADD='-Werror'
|
||||
#
|
||||
# This facility requires a Gnu Makefile, or a make command
|
||||
# that understands the += make operand.
|
||||
#
|
||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||
#
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
WNO_LONG_LONG= -Wno-long-long
|
||||
CCWERR=
|
||||
CCOPT= ${DEBUG}
|
||||
CCMISC=
|
||||
#
|
||||
LCC= gcc
|
||||
CC= ${PURIFY} ${LCC} ${CCWERR}
|
||||
#
|
||||
endif
|
||||
|
||||
#######################################################
|
||||
# simple target - values used to form Makefile.simple #
|
||||
#######################################################
|
||||
|
||||
# NOTE: This is not a real host target. The simple target
|
||||
# exists only to form the Makefile.simple file.
|
||||
|
||||
ifeq ($(target),simple)
|
||||
###
|
||||
EXCLUDE_FROM_CUSTOM_MAKEFILE=true # include only middle of ../Makefile
|
||||
include ../Makefile
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
#
|
||||
BLD_TYPE= calc-static-only
|
||||
#
|
||||
CC_SHARE= -fPIC
|
||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
|
||||
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
||||
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
||||
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
||||
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
|
||||
#
|
||||
CC_STATIC=
|
||||
LD_STATIC=
|
||||
LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
#
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
WNO_LONG_LONG= -Wno-long-long
|
||||
CCWERR=
|
||||
CCOPT= ${DEBUG}
|
||||
CCMISC=
|
||||
#
|
||||
LCC= cc
|
||||
CC= ${PURIFY} ${LCC} ${CCWERR}
|
||||
#
|
||||
# The simple makefile forces the use of static ${CC} flags
|
||||
#
|
||||
# ICFLAGS are given to ${CC} for intermediate programs used to help compile calc
|
||||
# CFLAGS are given to ${CC} for calc programs other than intermediate programs
|
||||
# ILDFLAGS for ${CC} in linking intermediate programs used to help compile calc
|
||||
# LDFLAGS for ${CC} in linking calc programs other than intermediate programs
|
||||
#
|
||||
ICFLAGS= ${COMMON_CFLAGS} ${CCBAN} ${CC_STATIC}
|
||||
CFLAGS= ${ICFLAGS} ${CCOPT}
|
||||
#
|
||||
ILDFLAGS= ${COMMON_LDFLAGS} ${LD_STATIC}
|
||||
LDFLAGS= ${LD_DEBUG} ${ILDFLAGS} ${LIBCALC_STATIC} ${LIBCUSTCALC_STATIC}
|
||||
#
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
endif
|
||||
|
||||
###################################################
|
||||
# MINGW32_NT-5.0 target #
|
||||
###################################################
|
||||
|
||||
|
||||
ifeq ($(target),MINGW32_NT-5.0)
|
||||
|
||||
EXT=.exe
|
||||
TERMCONTROL= -DUSE_WIN32
|
||||
ifdef ALLOW_CUSTOM
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
CALCPATH= .;./cal;~/.cal;${T}${CALC_SHAREDIR};${T}${CUSTOMCALDIR}
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
else
|
||||
CALCPATH= .;./cal;~/.cal;${T}${CALC_SHAREDIR}
|
||||
endif
|
||||
CALCRC= ./.calcinit;~/.calcrc;${CALC_SHAREDIR}/startup
|
||||
#
|
||||
BLD_TYPE= calc-static-only
|
||||
#
|
||||
CC_SHARE= -fPIC
|
||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
|
||||
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
||||
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
||||
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
||||
ifdef ALLOW_CUSTOM
|
||||
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
|
||||
else
|
||||
LIBCUSTCALC_SHLIB=
|
||||
endif
|
||||
#
|
||||
CC_STATIC= -DSTATIC_ONLY
|
||||
LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
LD_STATIC=
|
||||
#
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
WNO_LONG_LONG= -Wno-long-long
|
||||
CCWERR=
|
||||
CCOPT= ${DEBUG}
|
||||
CCMISC= -DNOTCYGWIN
|
||||
#
|
||||
LCC= gcc
|
||||
CC= ${PURIFY} ${LCC} ${CCWERR}
|
||||
#
|
||||
endif
|
||||
|
||||
###################################################
|
||||
# default target - when no specific target exists #
|
||||
###################################################
|
||||
|
||||
# NOTE: This is the default generic host target. Used when no other
|
||||
# host target matches.
|
||||
|
||||
ifeq ($(target),)
|
||||
#
|
||||
BLD_TYPE= calc-static-only
|
||||
#
|
||||
CC_SHARE= -fPIC
|
||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
|
||||
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
||||
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
||||
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
||||
ifdef ALLOW_CUSTOM
|
||||
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
|
||||
else
|
||||
LIBCUSTCALC_SHLIB=
|
||||
endif
|
||||
#
|
||||
CC_STATIC=
|
||||
LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
LD_STATIC=
|
||||
#
|
||||
# If you want to add flags to all compiler and linker
|
||||
# run (via ${COMMON_CFLAGS} and ${COMMON_LDFLAGS}),
|
||||
# set ${COMMON_ADD}.
|
||||
#
|
||||
# For example to use gcc's -Werror to force warnings
|
||||
# to become errors, call make with:
|
||||
#
|
||||
# make .. COMMON_ADD='-Werror'
|
||||
#
|
||||
# This facility requires a Gnu Makefile, or a make command
|
||||
# that understands the += make operand.
|
||||
#
|
||||
COMMON_CFLAGS+= ${COMMON_ADD}
|
||||
COMMON_LDFLAGS+= ${COMMON_ADD}
|
||||
#
|
||||
CCWARN= -Wall
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
WNO_LONG_LONG= -Wno-long-long
|
||||
CCWERR=
|
||||
CCOPT= ${DEBUG}
|
||||
CCMISC=
|
||||
#
|
||||
LCC= gcc
|
||||
CC= ${PURIFY} ${LCC} ${CCWERR}
|
||||
#
|
||||
endif
|
||||
|
||||
###########################################
|
||||
# Set the default compile flags for ${CC} #
|
||||
###########################################
|
||||
|
||||
# Required flags to compile C files for calc
|
||||
#
|
||||
# ICFLAGS are given to ${CC} for intermediate programs used to help compile calc
|
||||
# CFLAGS are given to ${CC} for calc programs other than intermediate programs
|
||||
#
|
||||
# NOTE: This does not work for: make-XYZ-only and BLD_TYPE != make-XYZ-only
|
||||
#
|
||||
ifeq ($(BLD_TYPE),calc-static-only)
|
||||
ICFLAGS= ${COMMON_CFLAGS} ${CCBAN} ${CC_STATIC}
|
||||
else
|
||||
ICFLAGS= ${COMMON_CFLAGS} ${CCBAN} ${CC_SHARE}
|
||||
endif
|
||||
CFLAGS= ${ICFLAGS} ${CCOPT}
|
||||
|
||||
# Required flags to link files for calc
|
||||
#
|
||||
# ILDFLAGS for ${CC} in linking intermediate programs used to help compile calc
|
||||
# LDFLAGS for ${CC} in linking calc programs other than intermediate programs
|
||||
#
|
||||
ILDFLAGS= ${COMMON_LDFLAGS}
|
||||
LDFLAGS= ${LD_DEBUG} ${ILDFLAGS}
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
|
||||
#######################################################################
|
||||
#-=-=-=-=-=- 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
|
||||
#
|
||||
# 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 -=-=-=-=-=-=-=-=-#
|
||||
##############################################################################
|
||||
# include end from top Makefile - keep this line
|
||||
|
||||
# These .c files are required for the main custom interface and
|
||||
# for the custom support functions for libcustcalc${LIB_EXT_VERSION}.
|
||||
@@ -1260,8 +620,7 @@ H_SRC= ${CUSTOM_H_SRC}
|
||||
# directory but are installed as help files from the help/Makefile.
|
||||
#
|
||||
DISTLIST= ${CUSTCALC_SRC} ${CUSTOM_CALC_FILES} ${CUSTOM_HELP} \
|
||||
${INSTALL_H_SRC} CUSTOM_CAL HOW_TO_ADD ${MAKE_FILE}.head \
|
||||
${MAKE_FILE}.tail
|
||||
${INSTALL_H_SRC} CUSTOM_CAL HOW_TO_ADD Makefile Makefile.simple
|
||||
|
||||
# These files are used to make (but not built) a calc .a link library
|
||||
#
|
||||
@@ -1281,7 +640,7 @@ TARGETS= ${BLD_TYPE} Makefile.simple
|
||||
|
||||
###
|
||||
#
|
||||
# The reason for this Makefile :-)
|
||||
# The main reason for this Makefile :-)
|
||||
#
|
||||
###
|
||||
|
||||
@@ -1362,18 +721,69 @@ calcliblist: ${CALCLIBLIST}
|
||||
done
|
||||
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
Makefile.simple: ${MAKE_FILE}
|
||||
Makefile.simple: Makefile ../Makefile
|
||||
${V} echo '=-=-=-=-= custom/${MAKE_FILE} start of $@ rule =-=-=-=-='
|
||||
${Q} ${RM} -f $@
|
||||
${Q} if [ -f $@.bak ]; then \
|
||||
echo "custom/$@.bak exists, remove or move it"; \
|
||||
exit 1; \
|
||||
else \
|
||||
${TRUE}; \
|
||||
fi
|
||||
-${Q} if [ -f $@ ]; then \
|
||||
${MV} -f $@ $@.bak; \
|
||||
fi
|
||||
${Q} ${AWK} '/^#if 0/{skp=1} {if(!skp){print $$0}} /^#endif/{skp=0}' \
|
||||
${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 'Makefile.simple:' >> $@
|
||||
${Q} echo ' $${Q} if [ ! -f Makefile.simple ]; then '"\\" >> $@
|
||||
${Q} echo ' $${CP} -f $${MAKE_FILE} $$@; fi' >> $@
|
||||
Makefile | \
|
||||
${SED} -e '/^# include start from top Makefile - keep /,$$d' \
|
||||
-e 's;^# SRC:.*;# SRC: custom/$@ - non-GNU version;' \
|
||||
-e '/^ifeq /d' \
|
||||
-e '/^ifneq /d' \
|
||||
-e '/^ifdef /d' \
|
||||
-e '/^ifndef /d' \
|
||||
-e '/^else/d' \
|
||||
-e '/^endif/d' \
|
||||
> $@
|
||||
${Q} echo '# include start from top Makefile - keep this line' \
|
||||
>> $@
|
||||
${Q} ${AWK} '/^#if 0/{skp=1} {if(!skp){print $$0}} /^#endif/{skp=0}' \
|
||||
../Makefile | \
|
||||
${SED} -e '1,/^# include start from top Makefile - keep /d' \
|
||||
-e '/^# include end from top Makefile - keep /,$$d' \
|
||||
-e '/^ifeq /d' \
|
||||
-e '/^ifneq /d' \
|
||||
-e '/^ifdef /d' \
|
||||
-e '/^ifndef /d' \
|
||||
-e '/^else/d' \
|
||||
-e '/^endif/d' \
|
||||
>> $@
|
||||
${Q} echo '# include end from top Makefile - keep this line' \
|
||||
>> $@
|
||||
${Q} ${AWK} '/^#if 0/{skp=1} {if(!skp){print $$0}} /^#endif/{skp=0}' \
|
||||
Makefile | \
|
||||
${SED} -e '1,/^# include end from top Makefile - keep /d' \
|
||||
-e '/^ifeq /d' \
|
||||
-e '/^ifneq /d' \
|
||||
-e '/^ifdef /d' \
|
||||
-e '/^ifndef /d' \
|
||||
-e '/^else/d' \
|
||||
-e '/^endif/d' \
|
||||
>> $@
|
||||
-${Q} if [ -s $@.bak ]; then \
|
||||
if ${CMP} -s $@.bak $@; then \
|
||||
echo 'custom/$@ was already up to date'; \
|
||||
echo 'restoring original custom/$@'; \
|
||||
${MV} -f $@.bak $@; \
|
||||
else \
|
||||
echo 'old custom/$@ is now custom/$@.bak'; \
|
||||
echo 'updated custom/$@ formed'; \
|
||||
(cd .. ; ${DIFF} -u custom/$@.bak custom/$@); \
|
||||
fi; \
|
||||
else \
|
||||
echo 'new custom/$@ formed'; \
|
||||
echo; \
|
||||
(cd .. ; ${LS} -l custom/$@); \
|
||||
echo; \
|
||||
fi
|
||||
${V} echo '=-=-=-=-= custom/${MAKE_FILE} end of $@ rule =-=-=-=-='
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
|
||||
@@ -1415,8 +825,8 @@ depend:
|
||||
>> "skel/custom/$$i"; \
|
||||
echo '#endif /* '"$$tag"' */' >> "skel/custom/$$i"; \
|
||||
done
|
||||
${Q} (cd ..; ${MAKE} -f ${TOP_MAKE_FILE} hsrc)
|
||||
${MAKE} -f ../${TOP_MAKE_FILE} h_list 2>/dev/null | \
|
||||
${Q} (cd ..; ${MAKE} -f ${MAKE_FILE} hsrc)
|
||||
${MAKE} -f ../${MAKE_FILE} h_list 2>/dev/null | \
|
||||
while read i; do \
|
||||
if [ ! -f "../$$i" ]; then continue; fi; \
|
||||
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
||||
@@ -1426,7 +836,7 @@ depend:
|
||||
>> "skel/$$i"; \
|
||||
echo '#endif /* '"$$tag"' */' >> "skel/$$i"; \
|
||||
done
|
||||
${Q} ${RM} -f skel/custom/makedep.out
|
||||
${Q} ${RM} -f skel/custom/makedep.out skel/custom/makedep.in
|
||||
${Q} echo custom/skel formed
|
||||
${Q} echo forming custom dependency list
|
||||
${Q} :> skel/custom/makedep.out
|
||||
@@ -1434,7 +844,9 @@ depend:
|
||||
-I../../.. -w 1 -f makedep.out -- \
|
||||
${CFLAGS} -- \
|
||||
${C_SRC} 2>/dev/null
|
||||
${Q} ${SED} -e 's|: ../../|: |' -E -i '' -l skel/custom/makedep.out
|
||||
${Q} ${CP} -f skel/custom/makedep.out skel/custom/makedep.in
|
||||
${Q} ${SED} -e 's|: ../../|: |' -E < skel/custom/makedep.in | \
|
||||
${GREP} -v /usr/include > skel/custom/makedep.out
|
||||
-${Q} for i in ${C_SRC} /dev/null; do \
|
||||
if [ X"$$i" != X"/dev/null" ]; then \
|
||||
echo "$$i" | ${SED} 's/^\(.*\)\.c/\1.o: \1.c/'; \
|
||||
@@ -1507,9 +919,6 @@ clobber: clean
|
||||
${RM} -f libcustcalc*
|
||||
${RM} -rf skel
|
||||
${V} echo remove files that are obsolete
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
${RM} -f Makefile.simple
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
-${Q} if [ -e .DS_Store ]; then \
|
||||
echo ${RM} -rf .DS_Store; \
|
||||
${RM} -rf .DS_Store; \
|
||||
@@ -1701,7 +1110,7 @@ uninstall:
|
||||
continue; \
|
||||
fi; \
|
||||
if [ -f "${T}${CUSTOMHELPDIR}/$$i" ]; then \
|
||||
${RM} -f "${T}${CUSTOMHELPDIR}/$$i"; \
|
||||
${RM} -f "${T}${CUSTOMHELPDIR}/$$i"; \
|
||||
if [ -f "${T}${CUSTOMHELPDIR}/$$i" ]; then \
|
||||
echo "cannot uninstall ${T}${CUSTOMHELPDIR}/$$i"; \
|
||||
else \
|
||||
@@ -1714,7 +1123,7 @@ uninstall:
|
||||
continue; \
|
||||
fi; \
|
||||
if [ -f "${T}${CUSTOMCALDIR}/$$i" ]; then \
|
||||
${RM} -f "${T}${CUSTOMCALDIR}/$$i"; \
|
||||
${RM} -f "${T}${CUSTOMCALDIR}/$$i"; \
|
||||
if [ -f "${T}${CUSTOMCALDIR}/$$i" ]; then \
|
||||
echo "cannot uninstall ${T}${CUSTOMCALDIR}/$$i"; \
|
||||
else \
|
||||
@@ -1727,7 +1136,7 @@ uninstall:
|
||||
continue; \
|
||||
fi; \
|
||||
if [ -f "${T}${CUSTOMINCDIR}/$$i" ]; then \
|
||||
${RM} -f "${T}${CUSTOMINCDIR}/$$i"; \
|
||||
${RM} -f "${T}${CUSTOMINCDIR}/$$i"; \
|
||||
if [ -f "${T}${CUSTOMINCDIR}/$$i" ]; then \
|
||||
echo "cannot uninstall ${T}${CUSTOMINCDIR}/$$i"; \
|
||||
else \
|
||||
@@ -1970,7 +1379,3 @@ custtbl.o: ../str.h
|
||||
custtbl.o: ../value.h
|
||||
custtbl.o: ../zmath.h
|
||||
custtbl.o: custtbl.c
|
||||
|
||||
##################################################
|
||||
# NOTE: End of section from custom/Makefile.tail #
|
||||
##################################################
|
||||
|
@@ -1,581 +0,0 @@
|
||||
#!/bin/make
|
||||
#
|
||||
# custom - makefile for calc custom routines
|
||||
#
|
||||
# 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
|
||||
# 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 02:28:54
|
||||
# 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/
|
||||
#
|
||||
# calculator by David I. Bell with help/mods from others
|
||||
# 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 */
|
||||
##############################################################################
|
||||
#-=-=-=-=-=-=-=-=- Identify the target machine, if possible -=-=-=-=-=-=-=-=-#
|
||||
##############################################################################
|
||||
|
||||
# NOTE: You can force a target value by defining target as in:
|
||||
#
|
||||
# make ...__optional_arguments_... target=value
|
||||
|
||||
# Try uname -s if the target was not already set on the make command line
|
||||
#
|
||||
ifeq ($(target),)
|
||||
target=$(shell uname -s 2>/dev/null)
|
||||
endif
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
|
||||
##############################################################################
|
||||
#-=-=-=-=-=-=-=-=- You may want to change some values below -=-=-=-=-=-=-=-=-#
|
||||
##############################################################################
|
||||
|
||||
# The custom calc resource files to install
|
||||
#
|
||||
# Put your custom calc resource files here.
|
||||
#
|
||||
CUSTOM_CALC_FILES= argv.cal halflen.cal pzasusb8.cal pmodm127.cal register.cal
|
||||
|
||||
# The custom help files to install
|
||||
#
|
||||
# Put your custom help files here.
|
||||
#
|
||||
CUSTOM_HELP= argv devnull help sysinfo pzasusb8 pmodm127 register
|
||||
|
||||
# Any .h files that are needed by programs that use
|
||||
# libcustcalc${LIB_EXT_VERSION}
|
||||
#
|
||||
# Put any .h files that you add which might be useful to other
|
||||
# programs here.
|
||||
#
|
||||
CUSTOM_H_SRC=
|
||||
|
||||
# Any .c files that are needed to build libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
# Don't put ${REQUIRED_SRC} files in this list.
|
||||
#
|
||||
# There MUST be a .c in CUSTOM_SRC for every .o in CUSTOM_OBJ.
|
||||
#
|
||||
# Put your custom .c files here.
|
||||
#
|
||||
CUSTOM_SRC= c_argv.c c_devnull.c c_help.c c_sysinfo.c c_pzasusb8.c \
|
||||
c_pmodm127.c c_register.c
|
||||
|
||||
# Any .o files that are needed by program that use
|
||||
# libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
# Don't put ${REQUIRED_OBJ} files in this list.
|
||||
#
|
||||
# There MUST be a .c in CUSTOM_SRC for every .o in CUSTOM_OBJ.
|
||||
#
|
||||
# Put your custom .o files here.
|
||||
#
|
||||
CUSTOM_OBJ= c_argv.o c_devnull.o c_help.o c_sysinfo.o c_pzasusb8.o \
|
||||
c_pmodm127.o c_register.o
|
||||
|
||||
##############################################################################
|
||||
#-=-=-=-=-=-=- Defaults in case you want to build from this dir -=-=-=-=-=-=-#
|
||||
##############################################################################
|
||||
|
||||
# Normally, the upper level makefile will set these values. We provide
|
||||
# a default here just in case you want to build from this directory.
|
||||
|
||||
# Makefile debug
|
||||
#
|
||||
# Q=@ do not echo internal Makefile actions (quiet 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=@
|
||||
#
|
||||
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
|
||||
# a default here just in case you want to build from this directory.
|
||||
####
|
||||
|
||||
# Where the system include (.h) files are kept
|
||||
#
|
||||
# For DJGPP, select:
|
||||
#
|
||||
# INCDIR= /dev/env/DJDIR/include
|
||||
#
|
||||
# If in doubt, set:
|
||||
#
|
||||
# INCDIR= /usr/include
|
||||
#
|
||||
|
||||
#INCDIR= ${PREFIX}/include
|
||||
#INCDIR= /dev/env/DJDIR/include
|
||||
INCDIR= /usr/include
|
||||
|
||||
# where to install calc related things
|
||||
#
|
||||
# ${BINDIR} where to install calc binary files
|
||||
# ${LIBDIR} where calc link library (*.a) files are installed
|
||||
# ${CALC_SHAREDIR} where to install calc help, .cal, startup, config files
|
||||
#
|
||||
# NOTE: The install rule prepends installation paths with ${T}, which
|
||||
# by default is empty. If ${T} is non-empty, then installation
|
||||
# locations will be relative to the ${T} directory.
|
||||
#
|
||||
# For DJGPP, select:
|
||||
#
|
||||
# BINDIR= /dev/env/DJDIR/bin
|
||||
# LIBDIR= /dev/env/DJDIR/lib
|
||||
# CALC_SHAREDIR= /dev/env/DJDIR/share/calc
|
||||
#
|
||||
# If in doubt, set:
|
||||
#
|
||||
# BINDIR= /usr/bin
|
||||
# LIBDIR= /usr/lib
|
||||
# CALC_SHAREDIR= /usr/share/calc
|
||||
#
|
||||
#BINDIR= ${PREFIX}/bin
|
||||
#BINDIR= /dev/env/DJDIR/bin
|
||||
BINDIR= /usr/bin
|
||||
|
||||
#LIBDIR= ${PREFIX}/lib
|
||||
#LIBDIR= /dev/env/DJDIR/lib
|
||||
LIBDIR= /usr/lib
|
||||
|
||||
#CALC_SHAREDIR= ${PREFIX}/lib/calc
|
||||
#CALC_SHAREDIR= /dev/env/DJDIR/share/calc
|
||||
CALC_SHAREDIR= /usr/share/calc
|
||||
|
||||
# By default, these values are based CALC_SHAREDIR, INCDIR, BINDIR
|
||||
# ---------------------------------------------------------------
|
||||
# ${HELPDIR} where the help directory is installed
|
||||
# ${CALC_INCDIR} where the calc include files are installed
|
||||
# ${CUSTOMCALDIR} where custom *.cal files are installed
|
||||
# ${CUSTOMHELPDIR} where custom help files are installed
|
||||
# ${CUSTOMINCDIR} where custom .h files are installed
|
||||
# ${SCRIPTDIR} where calc shell scripts are installed
|
||||
#
|
||||
# NOTE: The install rule prepends installation paths with ${T}, which
|
||||
# by default is empty. If ${T} is non-empty, then installation
|
||||
# locations will be relative to the ${T} directory.
|
||||
#
|
||||
# If in doubt, set:
|
||||
#
|
||||
# HELPDIR= ${CALC_SHAREDIR}/help
|
||||
# CALC_INCDIR= ${INCDIR}/calc
|
||||
# CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
|
||||
# CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
|
||||
# CUSTOMINCDIR= ${CALC_INCDIR}/custom
|
||||
# SCRIPTDIR= ${BINDIR}/cscript
|
||||
#
|
||||
HELPDIR= ${CALC_SHAREDIR}/help
|
||||
CALC_INCDIR= ${INCDIR}/calc
|
||||
CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
|
||||
CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
|
||||
CUSTOMINCDIR= ${CALC_INCDIR}/custom
|
||||
SCRIPTDIR= ${BINDIR}/cscript
|
||||
|
||||
# T - top level directory under which calc will be installed
|
||||
#
|
||||
# The calc install is performed under ${T}, the calc build is
|
||||
# performed under /. The purpose for ${T} is to allow someone
|
||||
# to install calc somewhere other than into the system area.
|
||||
#
|
||||
# For example, if:
|
||||
#
|
||||
# BINDIR= /usr/bin
|
||||
# LIBDIR= /usr/lib
|
||||
# CALC_SHAREDIR= /usr/share/calc
|
||||
#
|
||||
# and if:
|
||||
#
|
||||
# T= /var/tmp/testing
|
||||
#
|
||||
# Then the installation locations will be:
|
||||
#
|
||||
# calc binary files: /var/tmp/testing/usr/bin
|
||||
# calc link library: /var/tmp/testing/usr/lib
|
||||
# calc help, .cal ...: /var/tmp/testing/usr/share/calc
|
||||
# ... etc ... /var/tmp/testing/...
|
||||
#
|
||||
# If ${T} is empty, calc is installed under /, which is the same
|
||||
# top of tree for which it was built. If ${T} is non-empty, then
|
||||
# calc is installed under ${T}, as if one had to chroot under
|
||||
# ${T} for calc to operate.
|
||||
#
|
||||
# If in doubt, use T=
|
||||
#
|
||||
T=
|
||||
|
||||
# Debug/Optimize options for ${CC} and ${LCC}
|
||||
#
|
||||
# Select DEBUG= -O2 -gstabs+ -DWINDOZ for DJGPP.
|
||||
#
|
||||
#DEBUG=
|
||||
#
|
||||
#DEBUG= -O
|
||||
#DEBUG= -O -g
|
||||
#DEBUG= -O -g3
|
||||
#
|
||||
#DEBUG= -O1
|
||||
#DEBUG= -O1 -g
|
||||
#DEBUG= -O1 -g3
|
||||
#
|
||||
#DEBUG= -O2
|
||||
#DEBUG= -O2 -g
|
||||
#DEBUG= -O2 -g3
|
||||
#DEBUG= -O2 -ipa
|
||||
#DEBUG= -O2 -g3 -ipa
|
||||
#
|
||||
#DEBUG= -O3
|
||||
#DEBUG= -O3 -g
|
||||
DEBUG= -O3 -g3
|
||||
#DEBUG= -O3 -ipa
|
||||
#DEBUG= -O3 -g3 -ipa
|
||||
#
|
||||
#DEBUG= -g
|
||||
#DEBUG= -g3
|
||||
#DEBUG= -gx
|
||||
#DEBUG= -WM,-g
|
||||
#
|
||||
#DEBUG= -O2 -gstabs+ -DWINDOZ
|
||||
|
||||
# Some systems require one to use ranlib to add a symbol table to
|
||||
# a *.a link library. Set RANLIB to the utility that performs this
|
||||
# action. Set RANLIB to : if your system does not need such a utility.
|
||||
#
|
||||
RANLIB=ranlib
|
||||
#RANLIB=:
|
||||
|
||||
# Normally certain files depend on the Makefile. If the Makefile is
|
||||
# changed, then certain steps should be redone. If MAKE_FILE is
|
||||
# set to Makefile, then these files will depend on Makefile. If
|
||||
# MAKE_FILE is empty, then they wont.
|
||||
#
|
||||
# If in doubt, set MAKE_FILE to Makefile
|
||||
#
|
||||
MAKE_FILE= Makefile
|
||||
#MAKE_FILE=
|
||||
|
||||
# Controlling file makefile basename (without the path)
|
||||
#
|
||||
# This is the basename same of the makefile that may/does/will drive
|
||||
# this makefile.
|
||||
#
|
||||
# If in doubt, set TOP_MAKE_FILE to Makefile
|
||||
#
|
||||
TOP_MAKE_FILE= Makefile
|
||||
|
||||
# If you do not wish to use purify, set PURIFY to an empty string.
|
||||
#
|
||||
# If in doubt, use PURIFY=
|
||||
#
|
||||
#PURIFY= purify
|
||||
#PURIFY= purify -m71-engine
|
||||
#PURIFY= purify -logfile=pure.out
|
||||
#PURIFY= purify -m71-engine -logfile=pure.out
|
||||
PURIFY=
|
||||
|
||||
# If you want to use a debugging link library such as a malloc debug link
|
||||
# library, or need to add special ld flags after the calc link libraries
|
||||
# are included, set ${LD_DEBUG} below.
|
||||
#
|
||||
# If in doubt, set LD_DEBUG to empty.
|
||||
#
|
||||
#LD_DEBUG= -lmalloc_cv
|
||||
LD_DEBUG=
|
||||
|
||||
# When doing a:
|
||||
#
|
||||
# make check
|
||||
# make chk
|
||||
# make debug
|
||||
#
|
||||
# the ${CALC_ENV} is used to supply the proper environment variables
|
||||
# to calc. Most people will simply need 'CALCPATH=./cal' to ensure
|
||||
# that these debug rules will only use calc resource files under the
|
||||
# local source directory. The longer lines (with MALLOC_VERBOSE=1 ...)
|
||||
# are useful for SGI IRIX people who have 'WorkShop Performance Tools'
|
||||
# and who also set 'LD_DEBUG= -lmalloc_cv' above.
|
||||
#
|
||||
# If in doubt, use CALC_ENV= CALCPATH=./cal.
|
||||
#
|
||||
CALC_ENV= CALCPATH=./cal
|
||||
#CALC_ENV= CALCPATH=./cal MALLOC_VERBOSE=1 MALLOC_TRACING=1 \
|
||||
# MALLOC_FASTCHK=1 MALLOC_FULLWARN=1
|
||||
#CALC_ENV= CALCPATH=./cal MALLOC_VERBOSE=1 MALLOC_TRACING=1 \
|
||||
# MALLOC_FASTCHK=1 MALLOC_FULLWARN=1 MALLOC_CLEAR_FREE=1 \
|
||||
# MALLOC_CLEAR_MALLOC=1
|
||||
|
||||
# By default, custom builtin functions may only be executed if calc
|
||||
# is given the -C option. This is because custom builtin functions
|
||||
# may invoke non-standard or non-portable code. One may completely
|
||||
# disable custom builtin functions by not compiling any of code
|
||||
#
|
||||
# ALLOW_CUSTOM= -DCUSTOM # allow custom only if -C is given
|
||||
# ALLOW_CUSTOM= # disable custom even if -C is given
|
||||
#
|
||||
# If in doubt, use ALLOW_CUSTOM= -DCUSTOM
|
||||
#
|
||||
ALLOW_CUSTOM= -DCUSTOM
|
||||
#ALLOW_CUSTOM=
|
||||
|
||||
# Some out of date operating systems require / want an executable to
|
||||
# end with a certain file extension. Some compile systems such as
|
||||
# Cygwin build calc as calc.exe. The EXT variable is used to denote
|
||||
# the extension required by such.
|
||||
#
|
||||
# EXT= # normal Un*x / Linux / GNU/Linux systems
|
||||
# EXT=.exe # windoz / Cygwin
|
||||
#
|
||||
# If in doubt, use EXT=
|
||||
#
|
||||
EXT=
|
||||
#EXT=.exe
|
||||
|
||||
# The default calc versions
|
||||
#
|
||||
VERSION= 2.14.0.0
|
||||
|
||||
# Names of shared libraries with versions
|
||||
#
|
||||
LIB_EXT= .so
|
||||
LIB_EXT_VERSION= ${LIB_EXT}.${VERSION}
|
||||
|
||||
# standard tools
|
||||
#
|
||||
AR= ar
|
||||
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_LDFLAGS are flags given to ${CC} when linking progs
|
||||
#
|
||||
# Both CFLAGS and LDFLAGS are left blank in this Makefile by
|
||||
# default so that users may use them on the make command line
|
||||
# to always the way that C is compiled and files are linked
|
||||
# respectively. For example:
|
||||
#
|
||||
# make all EXTRA_CFLAGS="-DMAGIC" EXTRA_LDFLAGS="-lmagic"
|
||||
#
|
||||
# NOTE: These should be left blank in this Makefile to make it
|
||||
# easier to add stuff on the command line. If you want to
|
||||
# to change the way calc is compiled by this Makefile, change
|
||||
# the appropriate host target section below or a flag above.
|
||||
#
|
||||
EXTRA_CFLAGS=
|
||||
EXTRA_LDFLAGS=
|
||||
|
||||
# COMMON_CFLAGS are the common ${CC} flags used for all progs, both
|
||||
# intermediate and final calc and calc related progs
|
||||
#
|
||||
COMMON_CFLAGS= -DCALC_SRC ${ALLOW_CUSTOM} ${CCWARN} ${CCMISC} ${EXTRA_CFLAGS}
|
||||
|
||||
# COMMON_LDFLAGS are the common flags used for linking all progs, both
|
||||
# intermediate and final calc and calc related progs
|
||||
#
|
||||
COMMON_LDFLAGS= ${EXTRA_LDFLAGS}
|
||||
|
||||
###########################################
|
||||
# Set the default compile flags for ${CC} #
|
||||
###########################################
|
||||
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
|
||||
# Required flags to compile C files for calc
|
||||
#
|
||||
# ICFLAGS are given to ${CC} for intermediate progs used to help compile calc
|
||||
# CFLAGS are given to ${CC} for calc progs other than intermediate progs
|
||||
#
|
||||
# NOTE: This does not work for: make-XYZ-only and BLD_TYPE != make-XYZ-only
|
||||
#
|
||||
ifeq ($(BLD_TYPE),calc-static-only)
|
||||
ICFLAGS= ${COMMON_CFLAGS} ${CCBAN} ${CC_STATIC}
|
||||
else
|
||||
ICFLAGS= ${COMMON_CFLAGS} ${CCBAN} ${CC_SHARE}
|
||||
endif
|
||||
CFLAGS= ${ICFLAGS} ${CCOPT}
|
||||
|
||||
# Required flags to link files for calc
|
||||
#
|
||||
# ILDFLAGS for ${CC} in linking intermediate progs used to help compile calc
|
||||
# LDFLAGS for ${CC} in linking calc progs other than intermediate progs
|
||||
#
|
||||
ILDFLAGS= ${COMMON_LDFLAGS}
|
||||
LDFLAGS= ${LD_DEBUG} ${ILDFLAGS}
|
||||
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
|
||||
##################################################
|
||||
# NOTE: End of section from custom/Makefile.head #
|
||||
##################################################
|
@@ -1,22 +1,656 @@
|
||||
#!/bin/make
|
||||
#
|
||||
# custom - makefile for calc custom routines
|
||||
#
|
||||
# Copyright (C) 1999-2006,2014,2017-2018,2021 Landon Curt Noll
|
||||
#
|
||||
# SRC: custom/Makefile.tail
|
||||
# SRC: custom/Makefile.simple - non-GNU version
|
||||
#
|
||||
# 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
|
||||
# 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 02:28:54
|
||||
# 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/
|
||||
#
|
||||
# calculator by David I. Bell with help/mods from others
|
||||
# Makefile by Landon Curt Noll
|
||||
|
||||
####################################################
|
||||
# NOTE: Start of section from custom/Makefile.tail #
|
||||
####################################################
|
||||
|
||||
# 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/bash
|
||||
#SHELL= /bin/sh
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
|
||||
|
||||
# The custom calc resource files to install
|
||||
#
|
||||
# Put your custom calc resource files here.
|
||||
#
|
||||
CUSTOM_CALC_FILES= argv.cal halflen.cal pzasusb8.cal pmodm127.cal register.cal
|
||||
|
||||
# The custom help files to install
|
||||
#
|
||||
# Put your custom help files here.
|
||||
#
|
||||
CUSTOM_HELP= argv devnull help sysinfo pzasusb8 pmodm127 register
|
||||
|
||||
# Any .h files that are needed by programs that use
|
||||
# libcustcalc${LIB_EXT_VERSION}
|
||||
#
|
||||
# Put any .h files that you add which might be useful to other
|
||||
# programs here.
|
||||
#
|
||||
CUSTOM_H_SRC=
|
||||
|
||||
# Any .c files that are needed to build libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
# Don't put ${REQUIRED_SRC} files in this list.
|
||||
#
|
||||
# There MUST be a .c in CUSTOM_SRC for every .o in CUSTOM_OBJ.
|
||||
#
|
||||
# Put your custom .c files here.
|
||||
#
|
||||
CUSTOM_SRC= c_argv.c c_devnull.c c_help.c c_sysinfo.c c_pzasusb8.c \
|
||||
c_pmodm127.c c_register.c
|
||||
|
||||
# Any .o files that are needed by program that use
|
||||
# libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
# Don't put ${REQUIRED_OBJ} files in this list.
|
||||
#
|
||||
# There MUST be a .c in CUSTOM_SRC for every .o in CUSTOM_OBJ.
|
||||
#
|
||||
# Put your custom .o files here.
|
||||
#
|
||||
CUSTOM_OBJ= c_argv.o c_devnull.o c_help.o c_sysinfo.o c_pzasusb8.o \
|
||||
c_pmodm127.o c_register.o
|
||||
|
||||
##############################################################################
|
||||
#-=-=-=-=-=-=-=-=- Be careful if you change something below -=-=-=-=-=-=-=-=-#
|
||||
#-=-=-=-=-=-=-=-=- You may want to change some values below -=-=-=-=-=-=-=-=-#
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
#-=-=-=-=-=-=- Defaults in case you want to build from this dir -=-=-=-=-=-=-#
|
||||
##############################################################################
|
||||
|
||||
# Normally, the upper level makefile will set these values. We provide
|
||||
# a default here just in case you want to build from this directory.
|
||||
|
||||
# Makefile debug
|
||||
#
|
||||
# Q=@ do not echo internal Makefile actions (quiet 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 silence ${CC} output during hsrc file formation
|
||||
# S= full ${CC} output during hsrc file formation
|
||||
#
|
||||
# E= 2>/dev/null silence 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=@
|
||||
#
|
||||
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
|
||||
# a default here just in case you want to build from this directory.
|
||||
####
|
||||
|
||||
# Where the system include (.h) files are kept
|
||||
#
|
||||
# For DJGPP, select:
|
||||
#
|
||||
# INCDIR= /dev/env/DJDIR/include
|
||||
#
|
||||
# If in doubt, set:
|
||||
#
|
||||
# INCDIR= /usr/include
|
||||
#
|
||||
|
||||
#INCDIR= ${PREFIX}/include
|
||||
#INCDIR= /dev/env/DJDIR/include
|
||||
INCDIR= /usr/include
|
||||
|
||||
# where to install calc related things
|
||||
#
|
||||
# ${BINDIR} where to install calc binary files
|
||||
# ${LIBDIR} where calc link library (*.a) files are installed
|
||||
# ${CALC_SHAREDIR} where to install calc help, .cal, startup, config files
|
||||
#
|
||||
# NOTE: The install rule prepends installation paths with ${T}, which
|
||||
# by default is empty. If ${T} is non-empty, then installation
|
||||
# locations will be relative to the ${T} directory.
|
||||
#
|
||||
# For DJGPP, select:
|
||||
#
|
||||
# BINDIR= /dev/env/DJDIR/bin
|
||||
# LIBDIR= /dev/env/DJDIR/lib
|
||||
# CALC_SHAREDIR= /dev/env/DJDIR/share/calc
|
||||
#
|
||||
# If in doubt, set:
|
||||
#
|
||||
# BINDIR= /usr/bin
|
||||
# LIBDIR= /usr/lib
|
||||
# CALC_SHAREDIR= /usr/share/calc
|
||||
#
|
||||
#BINDIR= ${PREFIX}/bin
|
||||
#BINDIR= /dev/env/DJDIR/bin
|
||||
BINDIR= /usr/bin
|
||||
|
||||
#LIBDIR= ${PREFIX}/lib
|
||||
#LIBDIR= /dev/env/DJDIR/lib
|
||||
LIBDIR= /usr/lib
|
||||
|
||||
#CALC_SHAREDIR= ${PREFIX}/lib/calc
|
||||
#CALC_SHAREDIR= /dev/env/DJDIR/share/calc
|
||||
CALC_SHAREDIR= /usr/share/calc
|
||||
|
||||
# By default, these values are based CALC_SHAREDIR, INCDIR, BINDIR
|
||||
# ---------------------------------------------------------------
|
||||
# ${HELPDIR} where the help directory is installed
|
||||
# ${CALC_INCDIR} where the calc include files are installed
|
||||
# ${CUSTOMCALDIR} where custom *.cal files are installed
|
||||
# ${CUSTOMHELPDIR} where custom help files are installed
|
||||
# ${CUSTOMINCDIR} where custom .h files are installed
|
||||
# ${SCRIPTDIR} where calc shell scripts are installed
|
||||
#
|
||||
# NOTE: The install rule prepends installation paths with ${T}, which
|
||||
# by default is empty. If ${T} is non-empty, then installation
|
||||
# locations will be relative to the ${T} directory.
|
||||
#
|
||||
# If in doubt, set:
|
||||
#
|
||||
# HELPDIR= ${CALC_SHAREDIR}/help
|
||||
# CALC_INCDIR= ${INCDIR}/calc
|
||||
# CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
|
||||
# CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
|
||||
# CUSTOMINCDIR= ${CALC_INCDIR}/custom
|
||||
# SCRIPTDIR= ${BINDIR}/cscript
|
||||
#
|
||||
HELPDIR= ${CALC_SHAREDIR}/help
|
||||
CALC_INCDIR= ${INCDIR}/calc
|
||||
CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
|
||||
CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
|
||||
CUSTOMINCDIR= ${CALC_INCDIR}/custom
|
||||
SCRIPTDIR= ${BINDIR}/cscript
|
||||
|
||||
# T - top level directory under which calc will be installed
|
||||
#
|
||||
# The calc install is performed under ${T}, the calc build is
|
||||
# performed under /. The purpose for ${T} is to allow someone
|
||||
# to install calc somewhere other than into the system area.
|
||||
#
|
||||
# For example, if:
|
||||
#
|
||||
# BINDIR= /usr/bin
|
||||
# LIBDIR= /usr/lib
|
||||
# CALC_SHAREDIR= /usr/share/calc
|
||||
#
|
||||
# and if:
|
||||
#
|
||||
# T= /var/tmp/testing
|
||||
#
|
||||
# Then the installation locations will be:
|
||||
#
|
||||
# calc binary files: /var/tmp/testing/usr/bin
|
||||
# calc link library: /var/tmp/testing/usr/lib
|
||||
# calc help, .cal ...: /var/tmp/testing/usr/share/calc
|
||||
# ... etc ... /var/tmp/testing/...
|
||||
#
|
||||
# If ${T} is empty, calc is installed under /, which is the same
|
||||
# top of tree for which it was built. If ${T} is non-empty, then
|
||||
# calc is installed under ${T}, as if one had to chroot under
|
||||
# ${T} for calc to operate.
|
||||
#
|
||||
# If in doubt, use T=
|
||||
#
|
||||
T=
|
||||
|
||||
# Debug/Optimize options for ${CC} and ${LCC}
|
||||
#
|
||||
# Select DEBUG= -O2 -gstabs+ -D_WIN32 for DJGPP.
|
||||
#
|
||||
#DEBUG=
|
||||
#
|
||||
#DEBUG= -O
|
||||
#DEBUG= -O -g
|
||||
#DEBUG= -O -g3
|
||||
#
|
||||
#DEBUG= -O1
|
||||
#DEBUG= -O1 -g
|
||||
#DEBUG= -O1 -g3
|
||||
#
|
||||
#DEBUG= -O2
|
||||
#DEBUG= -O2 -g
|
||||
#DEBUG= -O2 -g3
|
||||
#DEBUG= -O2 -ipa
|
||||
#DEBUG= -O2 -g3 -ipa
|
||||
#
|
||||
#DEBUG= -O3
|
||||
#DEBUG= -O3 -g
|
||||
DEBUG= -O3 -g3
|
||||
#DEBUG= -O3 -ipa
|
||||
#DEBUG= -O3 -g3 -ipa
|
||||
#
|
||||
#DEBUG= -g
|
||||
#DEBUG= -g3
|
||||
#DEBUG= -gx
|
||||
#DEBUG= -WM,-g
|
||||
#
|
||||
#DEBUG= -O2 -gstabs+ -D_WIN32
|
||||
|
||||
# Some systems require one to use ranlib to add a symbol table to
|
||||
# a *.a link library. Set RANLIB to the utility that performs this
|
||||
# action. Set RANLIB to : if your system does not need such a utility.
|
||||
#
|
||||
RANLIB=ranlib
|
||||
#RANLIB=:
|
||||
|
||||
# Normally certain files depend on the Makefile. If the Makefile is
|
||||
# changed, then certain steps should be redone. If MAKE_FILE is
|
||||
# set to Makefile, then these files will depend on Makefile. If
|
||||
# MAKE_FILE is empty, then they wont.
|
||||
#
|
||||
# If in doubt, set MAKE_FILE to Makefile
|
||||
#
|
||||
MAKE_FILE= Makefile
|
||||
#MAKE_FILE=
|
||||
|
||||
# If you do not wish to use purify, set PURIFY to an empty string.
|
||||
#
|
||||
# If in doubt, use PURIFY=
|
||||
#
|
||||
#PURIFY= purify
|
||||
#PURIFY= purify -m71-engine
|
||||
#PURIFY= purify -logfile=pure.out
|
||||
#PURIFY= purify -m71-engine -logfile=pure.out
|
||||
PURIFY=
|
||||
|
||||
# If you want to use a debugging link library such as a malloc debug link
|
||||
# library, or need to add special ld flags after the calc link libraries
|
||||
# are included, set ${LD_DEBUG} below.
|
||||
#
|
||||
# If in doubt, set LD_DEBUG to empty.
|
||||
#
|
||||
#LD_DEBUG= -lmalloc_cv
|
||||
LD_DEBUG=
|
||||
|
||||
# When doing a:
|
||||
#
|
||||
# make check
|
||||
# make chk
|
||||
# make debug
|
||||
#
|
||||
# the ${CALC_ENV} is used to supply the proper environment variables
|
||||
# to calc. Most people will simply need 'CALCPATH=./cal' to ensure
|
||||
# that these debug rules will only use calc resource files under the
|
||||
# local source directory. The longer lines (with MALLOC_VERBOSE=1 ...)
|
||||
# are useful for SGI IRIX people who have 'WorkShop Performance Tools'
|
||||
# and who also set 'LD_DEBUG= -lmalloc_cv' above.
|
||||
#
|
||||
# If in doubt, use CALC_ENV= CALCPATH=./cal.
|
||||
#
|
||||
CALC_ENV= CALCPATH=./cal
|
||||
#CALC_ENV= CALCPATH=./cal MALLOC_VERBOSE=1 MALLOC_TRACING=1 \
|
||||
# MALLOC_FASTCHK=1 MALLOC_FULLWARN=1
|
||||
#CALC_ENV= CALCPATH=./cal MALLOC_VERBOSE=1 MALLOC_TRACING=1 \
|
||||
# MALLOC_FASTCHK=1 MALLOC_FULLWARN=1 MALLOC_CLEAR_FREE=1 \
|
||||
# MALLOC_CLEAR_MALLOC=1
|
||||
|
||||
# By default, custom builtin functions may only be executed if calc
|
||||
# is given the -C option. This is because custom builtin functions
|
||||
# may invoke non-standard or non-portable code. One may completely
|
||||
# disable custom builtin functions by not compiling any of code
|
||||
#
|
||||
# ALLOW_CUSTOM= -DCUSTOM # allow custom only if -C is given
|
||||
# ALLOW_CUSTOM= # disable custom even if -C is given
|
||||
#
|
||||
# If in doubt, use ALLOW_CUSTOM= -DCUSTOM
|
||||
#
|
||||
ALLOW_CUSTOM= -DCUSTOM
|
||||
#ALLOW_CUSTOM=
|
||||
|
||||
# Some out of date operating systems require / want an executable to
|
||||
# end with a certain file extension. Some compile systems such as
|
||||
# Cygwin build calc as calc.exe. The EXT variable is used to denote
|
||||
# the extension required by such.
|
||||
#
|
||||
# EXT= # normal Un*x / Linux / GNU/Linux systems
|
||||
# EXT=.exe # Windows / Cygwin
|
||||
#
|
||||
# If in doubt, use EXT=
|
||||
#
|
||||
EXT=
|
||||
#EXT=.exe
|
||||
|
||||
# The default calc versions
|
||||
#
|
||||
VERSION= 2.14.0.14
|
||||
|
||||
# Names of shared libraries with versions
|
||||
#
|
||||
LIB_EXT= .so
|
||||
LIB_EXT_VERSION= ${LIB_EXT}.${VERSION}
|
||||
|
||||
# standard tools
|
||||
#
|
||||
AR= ar
|
||||
AWK= awk
|
||||
CHMOD= chmod
|
||||
CMP= cmp
|
||||
CO= co
|
||||
CP= cp
|
||||
DIFF= diff
|
||||
FMT= fmt
|
||||
GREP= egrep
|
||||
LN= ln
|
||||
LS= ls
|
||||
MAKE= make
|
||||
MAKEDEPEND= makedepend
|
||||
MKDIR= mkdir
|
||||
MV= mv
|
||||
RM= rm
|
||||
RMDIR= rmdir
|
||||
SED= sed
|
||||
SORT= sort
|
||||
TAIL= tail
|
||||
TOUCH= touch
|
||||
TRUE= true
|
||||
|
||||
# EXTRA_CFLAGS are flags given to ${CC} when compiling C files
|
||||
# EXTRA_LDFLAGS are flags given to ${CC} when linking progs
|
||||
#
|
||||
# Both CFLAGS and LDFLAGS are left blank in this Makefile by
|
||||
# default so that users may use them on the make command line
|
||||
# to always the way that C is compiled and files are linked
|
||||
# respectively. For example:
|
||||
#
|
||||
# make all EXTRA_CFLAGS="-DMAGIC" EXTRA_LDFLAGS="-lmagic"
|
||||
#
|
||||
# NOTE: These should be left blank in this Makefile to make it
|
||||
# easier to add stuff on the command line. If you want to
|
||||
# to change the way calc is compiled by this Makefile, change
|
||||
# the appropriate host target section below or a flag above.
|
||||
#
|
||||
EXTRA_CFLAGS=
|
||||
EXTRA_LDFLAGS=
|
||||
|
||||
# COMMON_CFLAGS are the common ${CC} flags used for all progs, both
|
||||
# intermediate and final calc and calc related progs
|
||||
#
|
||||
COMMON_CFLAGS= -DCALC_SRC ${ALLOW_CUSTOM} ${CCWARN} ${CCMISC} ${EXTRA_CFLAGS}
|
||||
|
||||
# COMMON_LDFLAGS are the common flags used for linking all progs, both
|
||||
# intermediate and final calc and calc related progs
|
||||
#
|
||||
COMMON_LDFLAGS= ${EXTRA_LDFLAGS}
|
||||
|
||||
###########################################
|
||||
# Set the default compile flags for ${CC} #
|
||||
###########################################
|
||||
|
||||
|
||||
##########################################################################
|
||||
#=-=-=-=-=- Be careful if you change something below this line -=-=-=-=-=#
|
||||
##########################################################################
|
||||
|
||||
# include start from top Makefile - keep this line
|
||||
######################################################
|
||||
# NOTE: Start of section from the middle of Makefile #
|
||||
# #
|
||||
# These lines are shared in common with the lower #
|
||||
# custom/Makefile. That is, until the comment line #
|
||||
# that starts with '# NOTE: End of section ..' line, #
|
||||
# these Makefile lines are used in BOTH Makefiles. #
|
||||
######################################################
|
||||
|
||||
##############################################################################
|
||||
#-=-=-=-=-=- host target section - targets that override defaults -=-=-=-=-=-#
|
||||
##############################################################################
|
||||
|
||||
# Common values set in targets
|
||||
#
|
||||
# BLD_TYPE determines if calc is built with static and/or dynamic libs.
|
||||
# Set this value to one of:
|
||||
#
|
||||
# BLD_TYPE= calc-dynamic-only
|
||||
# BLD_TYPE= calc-static-only
|
||||
#
|
||||
# CC_SHARE are flags given to ${CC} to build .o files suitable for shared libs
|
||||
# DEFAULT_LIB_INSTALL_PATH is where calc programs look for calc shared libs
|
||||
# LD_SHARE are common flags given to ${CC} to link with shared libraries
|
||||
# LIBCALC_SHLIB are flags given to ${CC} to build libcalc shared libraries
|
||||
# LIBCUSTCALC_SHLIB are flags given to ${CC} to build libcustcalc shared lib
|
||||
#
|
||||
# NOTE: The above 5 values are unused if BLD_TYPE= calc-static-only
|
||||
#
|
||||
# CC_STATIC are flags given to ${CC} to build .o files suitable for static libs
|
||||
# LD_STATIC are common flags given to ${CC} to link with static libraries
|
||||
# LIBCALC_STATIC are flags given to ${CC} to build libcalc static libraries
|
||||
# LIBCUSTCALC_STATIC are flags given to ${CC} to build libcustcalc static lib
|
||||
#
|
||||
# NOTE: The above 4 values are unused if BLD_TYPE= calc-dynamic-only
|
||||
#
|
||||
# CCOPT are flags given to ${CC} for optimization
|
||||
# CCWARN are flags given to ${CC} for warning message control
|
||||
#
|
||||
# The following are given to ${CC}:
|
||||
#
|
||||
# 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,
|
||||
# which is useful only when CCWERR is set to -Werror.
|
||||
#
|
||||
# NOTE: If your compiler does not have these -Wno files, just
|
||||
# set these variables to nothing as in:
|
||||
#
|
||||
# WNO_IMPLICT=
|
||||
# WNO_ERROR_LONG_LONG=
|
||||
# WNO_LONG_LONG=
|
||||
#
|
||||
# CCWERR are flags given to ${CC} to make warnings fatal errors
|
||||
# NOTE: CCWERR is only set in development Makefiles and must only be
|
||||
# used with ${CC}, not ${LCC}. If you do not want the compiler
|
||||
# to abort on warnings, then leave CCWERR blank.
|
||||
# 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
|
||||
# CC is how the C compiler is invoked (with an optional Purify)
|
||||
#
|
||||
# Specific target overrides or modifications to default values
|
||||
|
||||
##########################################################################
|
||||
# NOTE: If your target is not supported below and the default target #
|
||||
# is not suitable for your needs, please send to the: #
|
||||
# #
|
||||
# calc-contrib at asthe dot com #
|
||||
# #
|
||||
# Email address an "ifeq ($(target),YOUR_TARGET_NAME)" ... "endif" #
|
||||
# set of lines so that we can consider them for the next release. #
|
||||
##########################################################################
|
||||
|
||||
#
|
||||
BLD_TYPE= calc-static-only
|
||||
#
|
||||
CC_SHARE= -fPIC
|
||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:${PREFIX}/lib
|
||||
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
|
||||
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
|
||||
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
||||
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
|
||||
#
|
||||
CC_STATIC=
|
||||
LD_STATIC=
|
||||
LIBCALC_STATIC=
|
||||
LIBCUSTCALC_STATIC=
|
||||
#
|
||||
#CCWARN= -Wall
|
||||
CCWARN= -Wall -Wextra -pedantic
|
||||
WNO_IMPLICT= -Wno-implicit
|
||||
WNO_ERROR_LONG_LONG= -Wno-error=long-long
|
||||
WNO_LONG_LONG= -Wno-long-long
|
||||
CCWERR=
|
||||
CCOPT= ${DEBUG}
|
||||
CCMISC=
|
||||
#
|
||||
LCC= cc
|
||||
CC= ${PURIFY} ${LCC} ${CCWERR}
|
||||
#
|
||||
# The simple makefile forces the use of static ${CC} flags
|
||||
#
|
||||
# ICFLAGS are given to ${CC} for intermediate programs used to help compile calc
|
||||
# CFLAGS are given to ${CC} for calc programs other than intermediate programs
|
||||
# ILDFLAGS for ${CC} in linking intermediate programs used to help compile calc
|
||||
# LDFLAGS for ${CC} in linking calc programs other than intermediate programs
|
||||
#
|
||||
ICFLAGS= ${COMMON_CFLAGS} ${CCBAN} ${CC_STATIC}
|
||||
CFLAGS= ${ICFLAGS} ${CCOPT}
|
||||
#
|
||||
ILDFLAGS= ${COMMON_LDFLAGS} ${LD_STATIC}
|
||||
LDFLAGS= ${LD_DEBUG} ${ILDFLAGS} ${LIBCALC_STATIC} ${LIBCUSTCALC_STATIC}
|
||||
#
|
||||
|
||||
#######################################################################
|
||||
#-=-=-=-=-=- end of target section - only make rules below -=-=-=-=-=-#
|
||||
#######################################################################
|
||||
|
||||
######################################################
|
||||
# NOTE: End of section from the middle of Makefile #
|
||||
# #
|
||||
# These lines are shared in common with the lower #
|
||||
# custom/Makefile. That is, starting with the line #
|
||||
# that starts with '# NOTE: End of section ..' line, #
|
||||
# these Makefile lines are used in BOTH Makefiles. #
|
||||
######################################################
|
||||
# include end from top Makefile - keep this line
|
||||
|
||||
# These .c files are required for the main custom interface and
|
||||
# for the custom support functions for libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
@@ -57,8 +691,7 @@ H_SRC= ${CUSTOM_H_SRC}
|
||||
# directory but are installed as help files from the help/Makefile.
|
||||
#
|
||||
DISTLIST= ${CUSTCALC_SRC} ${CUSTOM_CALC_FILES} ${CUSTOM_HELP} \
|
||||
${INSTALL_H_SRC} CUSTOM_CAL HOW_TO_ADD ${MAKE_FILE}.head \
|
||||
${MAKE_FILE}.tail
|
||||
${INSTALL_H_SRC} CUSTOM_CAL HOW_TO_ADD Makefile Makefile.simple
|
||||
|
||||
# These files are used to make (but not built) a calc .a link library
|
||||
#
|
||||
@@ -78,7 +711,7 @@ TARGETS= ${BLD_TYPE} Makefile.simple
|
||||
|
||||
###
|
||||
#
|
||||
# The reason for this Makefile :-)
|
||||
# The main reason for this Makefile :-)
|
||||
#
|
||||
###
|
||||
|
||||
@@ -158,21 +791,6 @@ calcliblist: ${CALCLIBLIST}
|
||||
fi; \
|
||||
done
|
||||
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
Makefile.simple: ${MAKE_FILE}
|
||||
${V} echo '=-=-=-=-= custom/${MAKE_FILE} start of $@ rule =-=-=-=-='
|
||||
${Q} ${RM} -f $@
|
||||
${Q} ${AWK} '/^#if 0/{skp=1} {if(!skp){print $$0}} /^#endif/{skp=0}' \
|
||||
${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 'Makefile.simple:' >> $@
|
||||
${Q} echo ' $${Q} if [ ! -f Makefile.simple ]; then '"\\" >> $@
|
||||
${Q} echo ' $${CP} -f $${MAKE_FILE} $$@; fi' >> $@
|
||||
${V} echo '=-=-=-=-= custom/${MAKE_FILE} end of $@ rule =-=-=-=-='
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
|
||||
##
|
||||
#
|
||||
@@ -212,8 +830,8 @@ depend:
|
||||
>> "skel/custom/$$i"; \
|
||||
echo '#endif /* '"$$tag"' */' >> "skel/custom/$$i"; \
|
||||
done
|
||||
${Q} (cd ..; ${MAKE} -f ${TOP_MAKE_FILE} hsrc)
|
||||
${MAKE} -f ../${TOP_MAKE_FILE} h_list 2>/dev/null | \
|
||||
${Q} (cd ..; ${MAKE} -f ${MAKE_FILE} hsrc)
|
||||
${MAKE} -f ../${MAKE_FILE} h_list 2>/dev/null | \
|
||||
while read i; do \
|
||||
if [ ! -f "../$$i" ]; then continue; fi; \
|
||||
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
||||
@@ -223,7 +841,7 @@ depend:
|
||||
>> "skel/$$i"; \
|
||||
echo '#endif /* '"$$tag"' */' >> "skel/$$i"; \
|
||||
done
|
||||
${Q} ${RM} -f skel/custom/makedep.out
|
||||
${Q} ${RM} -f skel/custom/makedep.out skel/custom/makedep.in
|
||||
${Q} echo custom/skel formed
|
||||
${Q} echo forming custom dependency list
|
||||
${Q} :> skel/custom/makedep.out
|
||||
@@ -231,7 +849,9 @@ depend:
|
||||
-I../../.. -w 1 -f makedep.out -- \
|
||||
${CFLAGS} -- \
|
||||
${C_SRC} 2>/dev/null
|
||||
${Q} ${SED} -e 's|: ../../|: |' -E -i '' -l skel/custom/makedep.out
|
||||
${Q} ${CP} -f skel/custom/makedep.out skel/custom/makedep.in
|
||||
${Q} ${SED} -e 's|: ../../|: |' -E < skel/custom/makedep.in | \
|
||||
${GREP} -v /usr/include > skel/custom/makedep.out
|
||||
-${Q} for i in ${C_SRC} /dev/null; do \
|
||||
if [ X"$$i" != X"/dev/null" ]; then \
|
||||
echo "$$i" | ${SED} 's/^\(.*\)\.c/\1.o: \1.c/'; \
|
||||
@@ -304,9 +924,6 @@ clobber: clean
|
||||
${RM} -f libcustcalc*
|
||||
${RM} -rf skel
|
||||
${V} echo remove files that are obsolete
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
${RM} -f Makefile.simple
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
-${Q} if [ -e .DS_Store ]; then \
|
||||
echo ${RM} -rf .DS_Store; \
|
||||
${RM} -rf .DS_Store; \
|
||||
@@ -498,7 +1115,7 @@ uninstall:
|
||||
continue; \
|
||||
fi; \
|
||||
if [ -f "${T}${CUSTOMHELPDIR}/$$i" ]; then \
|
||||
${RM} -f "${T}${CUSTOMHELPDIR}/$$i"; \
|
||||
${RM} -f "${T}${CUSTOMHELPDIR}/$$i"; \
|
||||
if [ -f "${T}${CUSTOMHELPDIR}/$$i" ]; then \
|
||||
echo "cannot uninstall ${T}${CUSTOMHELPDIR}/$$i"; \
|
||||
else \
|
||||
@@ -511,7 +1128,7 @@ uninstall:
|
||||
continue; \
|
||||
fi; \
|
||||
if [ -f "${T}${CUSTOMCALDIR}/$$i" ]; then \
|
||||
${RM} -f "${T}${CUSTOMCALDIR}/$$i"; \
|
||||
${RM} -f "${T}${CUSTOMCALDIR}/$$i"; \
|
||||
if [ -f "${T}${CUSTOMCALDIR}/$$i" ]; then \
|
||||
echo "cannot uninstall ${T}${CUSTOMCALDIR}/$$i"; \
|
||||
else \
|
||||
@@ -524,7 +1141,7 @@ uninstall:
|
||||
continue; \
|
||||
fi; \
|
||||
if [ -f "${T}${CUSTOMINCDIR}/$$i" ]; then \
|
||||
${RM} -f "${T}${CUSTOMINCDIR}/$$i"; \
|
||||
${RM} -f "${T}${CUSTOMINCDIR}/$$i"; \
|
||||
if [ -f "${T}${CUSTOMINCDIR}/$$i" ]; then \
|
||||
echo "cannot uninstall ${T}${CUSTOMINCDIR}/$$i"; \
|
||||
else \
|
||||
@@ -767,7 +1384,3 @@ custtbl.o: ../str.h
|
||||
custtbl.o: ../value.h
|
||||
custtbl.o: ../zmath.h
|
||||
custtbl.o: custtbl.c
|
||||
|
||||
##################################################
|
||||
# NOTE: End of section from custom/Makefile.tail #
|
||||
##################################################
|
@@ -57,7 +57,7 @@ c_argv(char *UNUSED(name), int count, VALUE **vals)
|
||||
{
|
||||
VALUE result; /* what we will return */
|
||||
ZVALUE zfilelen; /* length of a file as a ZVALUE */
|
||||
NUMBER *filelen; /* pointer to length of a file as a NUMER */
|
||||
NUMBER *filelen; /* pointer to length of a file as a NUMBER */
|
||||
char *type; /* the name of the arg type */
|
||||
int i;
|
||||
|
||||
@@ -103,12 +103,12 @@ c_argv(char *UNUSED(name), int count, VALUE **vals)
|
||||
type = "assoc";
|
||||
break;
|
||||
case V_OBJ: /* address of object structure */
|
||||
type = "ocject";
|
||||
type = "object";
|
||||
break;
|
||||
case V_FILE: /* opened file id */
|
||||
type = "file";
|
||||
break;
|
||||
case V_RAND: /* address of additive 55 random state */
|
||||
case V_RAND: /* subtractive 100 random state */
|
||||
type = "rand_state";
|
||||
break;
|
||||
case V_RANDOM: /* address of Blum random state */
|
||||
|
@@ -208,7 +208,7 @@ STATIC struct infoname sys_info[] = {
|
||||
(FULL)SBITS},
|
||||
{"SBYTES", "size of additive or shuffle entry in bytes", NULL,
|
||||
(FULL)SBYTES},
|
||||
{"SCNT", "length of additive 55 table in FULLs", NULL,
|
||||
{"SCNT", "length of subtractive 100 table in FULLs", NULL,
|
||||
(FULL)SCNT},
|
||||
{"SEEDXORBITS", "low bits of a55 seed devoted to xor", NULL,
|
||||
(FULL)SEEDXORBITS},
|
||||
|
@@ -13,7 +13,7 @@ DESCRIPTION
|
||||
|
||||
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
|
||||
a custom function. It performs the equivalent of:
|
||||
|
4
decl.h
4
decl.h
@@ -52,9 +52,9 @@
|
||||
|
||||
|
||||
/*
|
||||
* MS windoz macros
|
||||
* MS Windows macros
|
||||
*/
|
||||
#elif defined(_WIN32) || defined(WINDOZ)
|
||||
#elif defined(_WIN32) || defined(_WIN64)
|
||||
|
||||
|
||||
/* determine which type of DLL we must generate */
|
||||
|
16
file.c
16
file.c
@@ -46,7 +46,7 @@
|
||||
#include "calcerr.h"
|
||||
#include "strl.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
||||
@@ -338,7 +338,7 @@ init_fileio(FILEIO *fiop, char *name, char *mode,
|
||||
* NOTE: This function will not return 0, 1 or 2 since they are
|
||||
* reserved for stdin, stdout, stderr. In fact, it must not
|
||||
* return 0, 1, or 2 because it will confuse those who call
|
||||
* the opensearchfiile() function
|
||||
* the opensearchfile() function
|
||||
*/
|
||||
FILEID
|
||||
openid(char *name, char *mode)
|
||||
@@ -383,7 +383,7 @@ openid(char *name, char *mode)
|
||||
|
||||
|
||||
/*
|
||||
* openpathid - open the specified abse filename, or
|
||||
* openpathid - open the specified base filename, or
|
||||
* relative filename along a search path
|
||||
*
|
||||
* given:
|
||||
@@ -398,7 +398,7 @@ openid(char *name, char *mode)
|
||||
* NOTE: This function will not return 0, 1 or 2 since they are
|
||||
* reserved for stdin, stdout, stderr. In fact, it must not
|
||||
* return 0, 1, or 2 because it will confuse those who call
|
||||
* the opensearchfiile() function
|
||||
* the opensearchfile() function
|
||||
*/
|
||||
FILEID
|
||||
openpathid(char *name, char *mode, char *pathlist)
|
||||
@@ -728,7 +728,7 @@ flushid(FILEID id)
|
||||
}
|
||||
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
int
|
||||
flushall(void)
|
||||
{
|
||||
@@ -744,7 +744,7 @@ flushall(void)
|
||||
}
|
||||
return err;
|
||||
}
|
||||
#endif /* Windoz free systems */
|
||||
#endif /* Windows free systems */
|
||||
|
||||
|
||||
/*
|
||||
@@ -926,7 +926,7 @@ printid(FILEID id, int flags)
|
||||
|
||||
if (get_open_pos(fp, &pos) < 0) {
|
||||
if (fileno(fp) > 2)
|
||||
math_str("Error while determining file position!");
|
||||
math_str("Error while determining file position!");
|
||||
math_chr(')');
|
||||
return 0;
|
||||
}
|
||||
@@ -2328,7 +2328,7 @@ fscanfile(FILE *fp, char *fmt, int count, VALUE **vals)
|
||||
var = *vals++;
|
||||
count--;
|
||||
if (var->v_type != V_ADDR)
|
||||
math_error("Assigning to nonvariable");
|
||||
math_error("Assigning to non-variable");
|
||||
var = var->v_addr;
|
||||
subtype = var->v_subtype;
|
||||
freevalue(var);
|
||||
|
73
have_arc4random.c
Normal file
73
have_arc4random.c
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* have_arc4random - Determine if we have the arc4random_buf() RNG
|
||||
*
|
||||
* 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/12/06 23:58:51
|
||||
* 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/
|
||||
*/
|
||||
|
||||
/*
|
||||
* usage:
|
||||
* have_arc4random
|
||||
*
|
||||
* Not all enviroments have the arc4random_buf() function,
|
||||
* so this may not compile on your system.
|
||||
*
|
||||
* This prog outputs:
|
||||
*
|
||||
* HAVE_ARC4RANDOM
|
||||
* defined ==> have arc4random_buf() call
|
||||
* undefined ==> do not have arc4random_buf() call
|
||||
*/
|
||||
|
||||
#include "have_stdlib.h"
|
||||
#if defined(HAVE_STDLIB_H)
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#include "banned.h" /* include after system header <> includes */
|
||||
|
||||
|
||||
#define BUFLEN (32) /* length of the buffer to fill */
|
||||
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
#if defined(HAVE_NO_ARC4RANDOM)
|
||||
|
||||
printf("#undef HAVE_ARC4RANDOM /* no */\n");
|
||||
|
||||
#else /* HAVE_NO_ARC4RANDOM */
|
||||
|
||||
/* buffer for arc4random_buf() to fill */
|
||||
static char buf[BUFLEN];
|
||||
|
||||
arc4random_buf(buf, BUFLEN);
|
||||
printf("#define HAVE_ARC4RANDOM /* yes */\n");
|
||||
|
||||
#endif /* HAVE_NO_ARC4RANDOM */
|
||||
|
||||
/* exit(0); */
|
||||
return 0;
|
||||
}
|
@@ -33,7 +33,7 @@
|
||||
* This prog outputs several defines:
|
||||
*
|
||||
* HAVE_CONST
|
||||
* defined ==> ok to use const
|
||||
* defined ==> OK to use const
|
||||
* undefined ==> do not use const
|
||||
*
|
||||
* CONST
|
||||
|
71
have_environ.c
Normal file
71
have_environ.c
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* have_environ - Determine if we have the environ user environment synbol
|
||||
*
|
||||
* 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/12/06 19:34:32
|
||||
* 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/
|
||||
*/
|
||||
|
||||
/*
|
||||
* usage:
|
||||
* have_environ
|
||||
*
|
||||
* Not all enviroments have the user environment external:
|
||||
*
|
||||
* extern char **environ;
|
||||
*
|
||||
* so this may not compile on your system.
|
||||
*
|
||||
* This prog outputs:
|
||||
*
|
||||
* HAVE_ENVIRON
|
||||
* defined ==> environ is an non-NULL extern symbol
|
||||
* undefined ==> environ is NOT an extern symbol or is NULL
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#include "banned.h" /* include after system header <> includes */
|
||||
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
#if defined(HAVE_NO_ENVIRON)
|
||||
|
||||
printf("#undef HAVE_ENVIRON /* no */\n");
|
||||
|
||||
#else /* HAVE_NO_ENVIRON */
|
||||
|
||||
extern char **environ;
|
||||
|
||||
if (environ == NULL) {
|
||||
printf("#define HAVE_ENVIRON /* no */\n");
|
||||
} else {
|
||||
printf("#define HAVE_ENVIRON /* yes */\n");
|
||||
}
|
||||
|
||||
#endif /* HAVE_NO_ENVIRON */
|
||||
|
||||
/* exit(0); */
|
||||
return 0;
|
||||
}
|
@@ -56,8 +56,8 @@ main(void)
|
||||
printf("#define FPOS_POS_BITS %d\n", FPOS_POS_BITS);
|
||||
printf("#define FPOS_POS_LEN %d\n", int(FPOS_POS_BITS/8));
|
||||
# else
|
||||
printf("#define FPOS_POS_BITS %d\n", sizeof(pos.__pos)*8);
|
||||
printf("#define FPOS_POS_LEN %d\n", sizeof(pos.__pos));
|
||||
printf("#define FPOS_POS_BITS %lu\n", sizeof(pos.__pos)*8);
|
||||
printf("#define FPOS_POS_LEN %lu\n", sizeof(pos.__pos));
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
@@ -34,10 +34,9 @@
|
||||
* This prog outputs several defines:
|
||||
*
|
||||
* HAVE_GETTIME
|
||||
* defined ==> use clock_gettime() for either CLOCK_SGI_CYCLE
|
||||
* and/or CLOCK_REALTIME
|
||||
* undefined ==> clock_gettime() is not available for both
|
||||
* CLOCK_SGI_CYCLE and CLOCK_REALTIME
|
||||
* defined ==> use clock_gettime() from CLOCK_REALTIME
|
||||
* undefined ==> clock_gettime() is not available from
|
||||
* CLOCK_REALTIME
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -56,13 +55,7 @@ main(void)
|
||||
|
||||
#else /* HAVE_NO_GETTIME */
|
||||
|
||||
# if defined(CLOCK_SGI_CYCLE)
|
||||
|
||||
struct timespec sgi_cycle; /* SGI hardware clock */
|
||||
(void) clock_gettime(CLOCK_SGI_CYCLE, &sgi_cycle);
|
||||
printf("#define HAVE_GETTIME /* yes - w/CLOCK_SGI_CYCLE */\n");
|
||||
|
||||
# elif defined(CLOCK_REALTIME)
|
||||
# if defined(CLOCK_REALTIME)
|
||||
|
||||
struct timespec realtime; /* POSIX realtime clock */
|
||||
(void) clock_gettime(CLOCK_REALTIME, &realtime);
|
||||
@@ -70,7 +63,7 @@ main(void)
|
||||
|
||||
# else
|
||||
|
||||
printf("#undef HAVE_GETTIME /* no - no SGI_CYCLE and no REALTIME */\n");
|
||||
printf("#undef HAVE_GETTIME /* no - no CLOCK_REALTIME */\n");
|
||||
|
||||
# endif /* CLOCK_REALTIME */
|
||||
|
||||
|
@@ -38,7 +38,7 @@
|
||||
* This prog outputs several defines:
|
||||
*
|
||||
* HAVE_OFF_T_SCALAR
|
||||
* defined ==> ok to perform arithmetic ops, = and comparisons
|
||||
* defined ==> OK to perform arithmetic ops, = and comparisons
|
||||
* undefined ==> convert to ZVALUE first
|
||||
*/
|
||||
|
||||
@@ -69,7 +69,7 @@ main(void)
|
||||
if (value > (off_t)1) {
|
||||
--value;
|
||||
}
|
||||
#if !defined(_WIN32)
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
if (value <= (off_t)getppid()) {
|
||||
--value;
|
||||
}
|
||||
|
@@ -37,7 +37,7 @@
|
||||
* This prog outputs several defines:
|
||||
*
|
||||
* HAVE_FILEPOS_SCALAR
|
||||
* defined ==> ok to perform arithmetic ops, = and comparisons
|
||||
* defined ==> OK to perform arithmetic ops, = and comparisons
|
||||
* undefined ==> convert to ZVALUE first
|
||||
*/
|
||||
|
||||
@@ -69,7 +69,7 @@ main(void)
|
||||
if (value > (FILEPOS)1) {
|
||||
--value;
|
||||
}
|
||||
#if !defined(_WIN32)
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
if (value <= (FILEPOS)getppid()) {
|
||||
--value;
|
||||
}
|
||||
|
@@ -152,7 +152,7 @@ main(void)
|
||||
puts(" *");
|
||||
puts(" * Systems that do not have vsnprintf() need something. In some");
|
||||
puts(" * cases the snprintf function will deal correctly with the");
|
||||
puts(" * va_alist 4th arg. Same gors for a lack of an vsnprintf()");
|
||||
puts(" * va_alist 4th arg. Same goes for a lack of an vsnprintf()");
|
||||
puts(" * function. In either case we use the #defines below and");
|
||||
puts(" * hope for the best!");
|
||||
puts(" */");
|
||||
|
@@ -33,7 +33,7 @@
|
||||
* This prog outputs several defines:
|
||||
*
|
||||
* HAVE_UID_T
|
||||
* defined ==> ok to use uid_t
|
||||
* defined ==> OK to use uid_t
|
||||
* undefined ==> do not use uid_t
|
||||
*/
|
||||
|
||||
|
@@ -34,7 +34,7 @@
|
||||
* This prog outputs several defines:
|
||||
*
|
||||
* HAVE_UNUSED
|
||||
* defined ==> ok to use unused
|
||||
* defined ==> OK to use unused
|
||||
* undefined ==> do not use unused
|
||||
*
|
||||
* UNUSED
|
||||
|
@@ -141,7 +141,7 @@ main(void)
|
||||
puts(" *");
|
||||
puts(" * Systems that do not have vsnprintf() need something. In some");
|
||||
puts(" * cases the snprintf() function will deal correctly with the");
|
||||
puts(" * va_alist 4th arg. Same gors for a lack of an vsnprintf()");
|
||||
puts(" * va_alist 4th arg. Same goes for a lack of an vsnprintf()");
|
||||
puts(" * function. In either case we use the #defines below and");
|
||||
puts(" * hope for the best!");
|
||||
puts(" */");
|
||||
|
62
help.c
62
help.c
@@ -29,6 +29,7 @@
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include <sys/errno.h>
|
||||
|
||||
#include "calc.h"
|
||||
#include "conf.h"
|
||||
@@ -39,7 +40,7 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
# define popen _popen
|
||||
# define pclose _pclose
|
||||
#endif
|
||||
@@ -83,6 +84,10 @@ STATIC struct help_alias {
|
||||
{"show", "command"},
|
||||
{"stdlib", "resource"},
|
||||
{"question", "questions"},
|
||||
{"dm2d", "dms2d"},
|
||||
{"gm2g", "gms2g"},
|
||||
{"hm2d", "hms2d"},
|
||||
{"release", "releases"},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
@@ -259,6 +264,7 @@ givehelp(char *type)
|
||||
}
|
||||
snprintf(helppath, snprintf_len, "%s/%s", calc_helpdir, type);
|
||||
helppath[snprintf_len] = '\0'; /* paranoia */
|
||||
errno = 0;
|
||||
stream = fopen(helppath, "r");
|
||||
if (stream != NULL) {
|
||||
|
||||
@@ -273,30 +279,42 @@ givehelp(char *type)
|
||||
* open the helpfile (looking in CUSTOMHELPDIR last)
|
||||
*/
|
||||
} else {
|
||||
char *cust_helppath; /* path to the custom help file */
|
||||
size_t cust_snprintf_len; /* malloced custom snprintf buf len */
|
||||
char *cust_helppath; /* path to the custom help file */
|
||||
size_t cust_snprintf_len; /* malloced custom snprintf buf len */
|
||||
|
||||
cust_snprintf_len = strlen(calc_customhelpdir)+1+strlen(type) + 1;
|
||||
cust_helppath = (char *)malloc(cust_snprintf_len+1);
|
||||
if (cust_helppath == NULL) {
|
||||
fprintf(stderr, "malloc failure for givehelp #1\n");
|
||||
return;
|
||||
}
|
||||
snprintf(cust_helppath, cust_snprintf_len,
|
||||
"%s/%s", calc_customhelpdir, type);
|
||||
cust_helppath[cust_snprintf_len] = '\0'; /* paranoia */
|
||||
stream = fopen(cust_helppath, "r");
|
||||
if (stream != NULL) {
|
||||
cust_snprintf_len =
|
||||
strlen(calc_customhelpdir)+1+strlen(type) + 1;
|
||||
cust_helppath = (char *)malloc(cust_snprintf_len+1);
|
||||
if (cust_helppath == NULL) {
|
||||
fprintf(stderr, "malloc failure for givehelp #1\n");
|
||||
return;
|
||||
}
|
||||
snprintf(cust_helppath, cust_snprintf_len,
|
||||
"%s/%s", calc_customhelpdir, type);
|
||||
cust_helppath[cust_snprintf_len] = '\0'; /* paranoia */
|
||||
errno = 0;
|
||||
stream = fopen(cust_helppath, "r");
|
||||
if (stream != NULL) {
|
||||
|
||||
/*
|
||||
* we have the help file open, now display it
|
||||
*/
|
||||
page_file(stream);
|
||||
(void) fclose(stream);
|
||||
}
|
||||
free(cust_helppath);
|
||||
cust_helppath = NULL;
|
||||
/*
|
||||
* we have the help file open, now display it
|
||||
*/
|
||||
page_file(stream);
|
||||
(void) fclose(stream);
|
||||
|
||||
/* unable to open help file */
|
||||
} else {
|
||||
fprintf(stderr, "unable to open help file: %s - %s\n",
|
||||
type, strerror(errno));
|
||||
}
|
||||
free(cust_helppath);
|
||||
cust_helppath = NULL;
|
||||
|
||||
#else /* CUSTOM */
|
||||
/* unable to open help file */
|
||||
} else {
|
||||
fprintf(stderr, "unable to open help file: %s - %s\n",
|
||||
type, strerror(errno));
|
||||
#endif /* CUSTOM */
|
||||
}
|
||||
|
||||
|
@@ -48,14 +48,18 @@
|
||||
#
|
||||
# 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
|
||||
# On such systems, the sh 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
|
||||
SHELL= /bin/bash
|
||||
#SHELL= /bin/sh
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
ifeq ($(target),Darwin)
|
||||
SHELL:= /bin/zsh
|
||||
endif
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
|
||||
|
||||
####
|
||||
@@ -102,15 +106,6 @@ PREFIX= /usr/local
|
||||
#
|
||||
MAKE_FILE= Makefile
|
||||
|
||||
# Controlling file makefile basename (without the path)
|
||||
#
|
||||
# This is the basename same of the makefile that may/does/will drive
|
||||
# this makefile.
|
||||
#
|
||||
# If in doubt, set TOP_MAKE_FILE to Makefile
|
||||
#
|
||||
TOP_MAKE_FILE= Makefile
|
||||
|
||||
# Where the system include (.h) files are kept
|
||||
#
|
||||
# For DJGPP, select:
|
||||
@@ -220,10 +215,10 @@ T=
|
||||
# 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= >/dev/null 2>&1 silence ${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= 2>/dev/null silence command stderr during hsrc file formation
|
||||
# E= full command stderr during hsrc file formation
|
||||
#
|
||||
# V=@: do not echo debug statements (quiet mode)
|
||||
@@ -270,7 +265,7 @@ TRUE= true
|
||||
# the extension required by such.
|
||||
#
|
||||
# EXT= # normal Un*x / Linux / GNU/Linux systems
|
||||
# EXT=.exe # windoz / Cygwin
|
||||
# EXT=.exe # Windows / Cygwin
|
||||
#
|
||||
# If in doubt, use EXT=
|
||||
#
|
||||
@@ -314,7 +309,7 @@ BLT_HELP_FILES_13= bugs changes
|
||||
|
||||
STD_HELP_FILES_14= credit
|
||||
|
||||
BLT_HELP_FILES_14= contrib COPYING COPYING-LGPL questions
|
||||
BLT_HELP_FILES_14= contrib COPYING COPYING-LGPL questions releases
|
||||
|
||||
STD_HELP_FILES_15= wishlist todo
|
||||
|
||||
@@ -356,7 +351,7 @@ BLT_HELP_FILES= ${BLT_HELP_FILES_3} ${BLT_HELP_FILES_5} \
|
||||
#
|
||||
# Please use:
|
||||
#
|
||||
# make detail_help_list
|
||||
# make clobber >/dev/null && make detail_help_list
|
||||
#
|
||||
# to keep this list in nice sorted order.
|
||||
#
|
||||
@@ -364,14 +359,15 @@ DETAIL_HELP= abs access acos acosh acot acoth acsc acsch address agd \
|
||||
append appr arg argv arrow asec asech asin asinh assign atan atan2 \
|
||||
atanh avg base base2 bernoulli bit blk blkcpy blkfree blocks bround \
|
||||
btrunc calc_tty calclevel calcpath catalan ceil cfappr cfsim char \
|
||||
cmdbuf cmp comb conj cos cosh cot coth count cp csc csch ctime delete \
|
||||
den dereference det digit digits display dp epsilon errcount errmax \
|
||||
errno error estr euler eval exp fact factor fclose fcnt feof ferror \
|
||||
fflush fgetc fgetfield fgetfile fgetline fgets fgetstr fib files floor \
|
||||
fopen forall fpathopen fprintf fputc fputs fputstr frac free \
|
||||
freebernoulli freeeuler freeglobals freeredc freestatics frem freopen \
|
||||
fscan fscanf fseek fsize ftell gcd gcdrem gd getenv hash head highbit \
|
||||
hmean hnrmod hypot ilog ilog10 ilog2 im indices inputlevel insert int \
|
||||
cmdbuf cmp comb conj cos cosh cot coth count cp csc csch ctime d2dm \
|
||||
d2dms d2g d2r delete den dereference det digit digits display dms2d dp \
|
||||
epsilon errcount errmax errno error estr euler eval exp fact factor \
|
||||
fclose fcnt feof ferror fflush fgetc fgetfield fgetfile fgetline fgets \
|
||||
fgetstr fib files floor fopen forall fpathopen fprintf fputc fputs \
|
||||
fputstr frac free freebernoulli freeeuler freeglobals freeredc \
|
||||
freestatics frem freopen fscan fscanf fseek fsize ftell g2d g2gm g2gms \
|
||||
g2r gcd gcdrem gd getenv gms2g h2hm h2hms hash head highbit hmean \
|
||||
hms2h hnrmod hypot ilog ilog10 ilog2 im indices inputlevel insert int \
|
||||
inverse iroot isalnum isalpha isassoc isatty isblk iscntrl isconfig \
|
||||
isdefined isdigit iserror iseven isfile isgraph ishash isident isint \
|
||||
islist islower ismat ismult isnull isnum isobj isobjtype isodd isprime \
|
||||
@@ -381,11 +377,11 @@ DETAIL_HELP= abs access acos acosh acot acoth acsc acsch address agd \
|
||||
matsum mattrace mattrans max memsize meq min minv mmin mne mod modify \
|
||||
name near newerror nextcand nextprime norm null num oldvalue ord param \
|
||||
perm pfact pi pix places pmod polar poly pop popcnt pound power \
|
||||
prevcand prevprime printf prompt protect ptest push putenv questions \
|
||||
quo quomod rand randbit random randombit randperm rcin rcmul rcout \
|
||||
rcpow rcsq re remove reverse rewind rm root round rsearch runtime \
|
||||
saveval scale scan scanf search sec sech seed segment select sgn sha1 \
|
||||
sin sinh size sizeof sleep sort sqrt srand srandom ssq stoponerror str \
|
||||
prevcand prevprime printf prompt protect ptest push putenv quo quomod \
|
||||
r2d r2g rand randbit random randombit randperm rcin rcmul rcout rcpow \
|
||||
rcsq re remove reverse rewind rm root round rsearch runtime saveval \
|
||||
scale scan scanf search sec sech seed segment select sgn sha1 sin sinh \
|
||||
size sizeof sleep sort sqrt srand srandom ssq stoponerror str \
|
||||
strcasecmp strcat strcmp strcpy strerror strlen strncasecmp strncmp \
|
||||
strncpy strpos strprintf strscan strscanf strtolower strtoupper substr \
|
||||
sum swap system systime tail tan tanh test time trunc usertime version \
|
||||
@@ -524,7 +520,7 @@ usage: ../calc.usage
|
||||
fi
|
||||
|
||||
../calc.usage:
|
||||
(cd ..; ${MAKE} -f ${TOP_MAKE_FILE} calc.usage)
|
||||
(cd ..; ${MAKE} -f ${MAKE_FILE} calc.usage)
|
||||
|
||||
custom_cal: ../custom/CUSTOM_CAL
|
||||
${RM} -f $@
|
||||
@@ -627,6 +623,18 @@ cscript: ../cscript/README
|
||||
${Q} ${RM} -f $@
|
||||
(cd ../cscript; ${MAKE} -f Makefile README)
|
||||
|
||||
releases: ../README.RELEASE
|
||||
${RM} -f $@
|
||||
${CP} ../README.RELEASE $@
|
||||
${CHMOD} 0444 $@
|
||||
-@if [ -z "${Q}" ]; then \
|
||||
echo ''; \
|
||||
echo '=-=-= skipping the ${CAT} of help/$@ =-=-='; \
|
||||
echo ''; \
|
||||
else \
|
||||
${TRUE}; \
|
||||
fi
|
||||
|
||||
full: ${FULL_HELP_FILES} ${MAKE_FILE}
|
||||
${Q} echo "forming full"
|
||||
${Q} ${RM} -f $@
|
||||
@@ -684,7 +692,7 @@ ${SINGULAR_FILES}: ${PLURAL_FILES}
|
||||
# into a stand-alone program that generates a suitable function list
|
||||
# that is sandwiched between the top and bottom builtin help text.
|
||||
#
|
||||
# We form funclist.c by sedding out unwanted stuff from builtins table,
|
||||
# We form funclist.c by sed-ing out unwanted stuff from builtins table,
|
||||
# converting NUMBER* and VALUE into harmless types and converting
|
||||
# the showbuiltins() function into main(). Combined with the -DFUNCLIST
|
||||
# we will avoid all of the complex calc types, macros and defines and
|
||||
@@ -730,7 +738,7 @@ distlist: ${DISTLIST}
|
||||
if [ X"$$i" != X"/dev/null" ]; then \
|
||||
echo help/$$i; \
|
||||
fi; \
|
||||
done | LANG=C ${SORT}
|
||||
done | fgrep -v '.bak' | LANG=C ${SORT}
|
||||
|
||||
distdir:
|
||||
${Q} echo help
|
||||
@@ -893,7 +901,7 @@ uninstall:
|
||||
continue; \
|
||||
fi; \
|
||||
if [ -f "${T}${HELPDIR}/$$i" ]; then \
|
||||
${RM} -f "${T}${HELPDIR}/$$i"; \
|
||||
${RM} -f "${T}${HELPDIR}/$$i"; \
|
||||
if [ -f "${T}${HELPDIR}/$$i" ]; then \
|
||||
echo "cannot uninstall ${T}${HELPDIR}/$$i"; \
|
||||
else \
|
||||
|
6
help/abs
6
help/abs
@@ -6,8 +6,8 @@ SYNOPSIS
|
||||
|
||||
TYPES
|
||||
If x is an object of type xx, the function xx_abs has to have
|
||||
been defined; this will determine the types for x, eps and
|
||||
the returned value.
|
||||
been defined; this will determine the types for x, eps and
|
||||
the returned value.
|
||||
|
||||
For non-object x and eps:
|
||||
|
||||
@@ -44,7 +44,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
cmp, epsilon, hypot, norm, near, obj
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
@@ -20,8 +20,8 @@ DESCRIPTION
|
||||
'w' or bit 1 for writing, 'x' or bit 0 for execution.
|
||||
|
||||
EXAMPLE
|
||||
The system error-numbers and messages may differ for different
|
||||
implementations
|
||||
; ## The system error-numbers and messages may differ
|
||||
; ## for different implementations
|
||||
|
||||
; !rm -f junk
|
||||
; access("junk")
|
||||
@@ -48,7 +48,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
fopen, fclose, isfile, files
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
@@ -18,7 +18,7 @@ DESCRIPTION
|
||||
|
||||
EXAMPLE
|
||||
; print acot(2, 1e-5), acot(2, 1e-10), acot(2, 1e-15), acot(2, 1e-20)
|
||||
.46365 .463647609 .463647609000806 .46364760900080611621
|
||||
0.46365 0.463647609 0.463647609000806 0.46364760900080611621
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -29,7 +29,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
asin, acos, atan, asec, acsc, epsilon
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
@@ -20,7 +20,7 @@ DESCRIPTION
|
||||
|
||||
EXAMPLE
|
||||
; print acoth(2, 1e-5), acoth(2, 1e-10), acoth(2, 1e-15), acoth(2, 1e-20)
|
||||
.54931 .5493061443 .549306144334055 .5493061443340548457
|
||||
0.54931 0.5493061443 0.549306144334055 0.5493061443340548457
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -31,7 +31,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
asinh, acosh, atanh, asech, acsch, epsilon
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
@@ -18,7 +18,7 @@ DESCRIPTION
|
||||
|
||||
EXAMPLE
|
||||
; print acsc(2, 1e-5), acsc(2, 1e-10), acsc(2, 1e-15), acsc(2, 1e-20)
|
||||
.5236 .5235987756 .523598775598299 .52359877559829887308
|
||||
0.5236 0.5235987756 0.523598775598299 0.52359877559829887308
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -29,7 +29,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
asin, acos, atan, asec, acot, epsilon
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
@@ -18,10 +18,9 @@ DESCRIPTION
|
||||
|
||||
acsch(x) = ln((1 + sqrt(1 + x^2))/x)
|
||||
|
||||
|
||||
EXAMPLE
|
||||
; print acsch(2, 1e-5), acsch(2, 1e-10), acsch(2, 1e-15), acsch(2, 1e-20)
|
||||
.48121 .4812118251 .481211825059603 .4812118250596034475
|
||||
0.48121 0.4812118251 0.481211825059603 0.4812118250596034475
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -32,7 +31,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
asinh, acosh, atanh, asech, acoth, epsilon
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
3
help/agd
3
help/agd
@@ -33,7 +33,6 @@ DESCRIPTION
|
||||
|
||||
agd(z) = atanh(sin(x)/cosh(y)) + i * atan(sinh(y)/cos(x)>
|
||||
|
||||
|
||||
EXAMPLE
|
||||
; print agd(1, 1e-5), agd(1, 1e-10), agd(1, 1e-15)
|
||||
1.22619 1.2261911709 1.226191170883517
|
||||
@@ -45,7 +44,7 @@ EXAMPLE
|
||||
-1.93237 -1.9323667197 -1.932366719745925
|
||||
|
||||
; print agd(1+2i, 1e-5), agd(1+2i, 1e-10)
|
||||
.22751+1.42291i .2275106584+1.4229114625i
|
||||
0.22751+1.42291i 0.2275106584+1.4229114625i
|
||||
|
||||
LIMITS
|
||||
none
|
||||
|
18
help/appr
18
help/appr
@@ -96,7 +96,7 @@ PROPERTIES
|
||||
|
||||
If y is nonzero, appr(x,y,8)/y = an odd integer n only if x = n * y.
|
||||
|
||||
EXAMPLES
|
||||
EXAMPLE
|
||||
; print appr(-5.44,0.1,0), appr(5.44,0.1,0), appr(5.7,1,0), appr(-5.7,1,0)
|
||||
-5.5 5.4 5 -6
|
||||
|
||||
@@ -119,26 +119,26 @@ EXAMPLES
|
||||
-5.5 5.5 5 -5
|
||||
|
||||
; print appr(-.44,0.1,11), appr(.44,0.1,11), appr(5.7,1,11), appr(-5.7,1,11)
|
||||
-.4 .5 5 -6
|
||||
-0.4 0.5 5 -6
|
||||
|
||||
; print appr(-.44,-.1,11),appr(.44,-.1,11),appr(5.7,-1,11),appr(-5.7,-1,11)
|
||||
-.5 .4 6 -5
|
||||
-0.5 0.4 6 -5
|
||||
|
||||
; print appr(-.44,0.1,12), appr(.44,0.1,12), appr(5.7,1,12), appr(-5.7,1,12)
|
||||
-.4 .5 5 -6
|
||||
-0.4 0.5 5 -6
|
||||
|
||||
; print appr(-.44,-.1,12),appr(.44,-.1,12),appr(5.7,-1,12),appr(-5.7,-1,12)
|
||||
-.5 .4 6 -5
|
||||
-0.5 0.4 6 -5
|
||||
|
||||
; print appr(-.44,0.1,15), appr(.44,0.1,15), appr(5.7,1,15), appr(-5.7,1,15)
|
||||
-.4 .5 5 -6
|
||||
-0.4 0.5 5 -6
|
||||
|
||||
; print appr(-.44,-.1,15),appr(.44,-.1,15),appr(5.7,-1,15),appr(-5.7,-1,15)
|
||||
-.4 .5 5 -6
|
||||
-0.4 0.5 5 -6
|
||||
|
||||
; x = sqrt(7-3i, 1e-20)
|
||||
; print appr(x,1e-5,0), appr(x,1e-5,1), appr(x,1e-5,2), appr(x,1e-6,3)
|
||||
2.70331-.55488i 2.70332-.55487i 2.70331-.55487i 2.70332-.55488i
|
||||
2.70331-0.55488i 2.70332-0.55487i 2.70331-0.55487i 2.70332-0.55488i
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -151,7 +151,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
round, bround, cfappr, cfsim
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
22
help/archive
22
help/archive
@@ -1,21 +1,27 @@
|
||||
Where to get the latest versions of calc
|
||||
|
||||
Landon Noll maintains the official calc home page at:
|
||||
Official calc source is maintained on GitHub:
|
||||
|
||||
https://github.com/lcn2/calc
|
||||
|
||||
Calc releases may be found as GitHub tagged releases:
|
||||
|
||||
https://github.com/lcn2/calc/releases?page=2
|
||||
|
||||
At the bottom of a given release is a "> Assets" that may
|
||||
be opened to reveal down-loadable files such as source
|
||||
tarballs, source zip files and RPMs.
|
||||
|
||||
Landon Noll also maintains a calc home page at:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
||||
See:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/calc-download.html
|
||||
|
||||
for information on how to obtain up a recent version of calc.
|
||||
|
||||
Landon Curt Noll
|
||||
http://www.isthe.com/chongo/
|
||||
|
||||
chongo <was here> /\../\
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
4
help/arg
4
help/arg
@@ -17,7 +17,7 @@ DESCRIPTION
|
||||
|
||||
EXAMPLE
|
||||
; print arg(2), arg(2+3i, 1e-5), arg(2+3i, 1e-10), arg(2+3i, 1e-20)
|
||||
0 .98279 .9827937232 .98279372324732906799
|
||||
0 0.98279 0.9827937232 0.98279372324732906799
|
||||
|
||||
; pi = pi(1e-10); deg = pi/180; eps = deg/10000
|
||||
; print arg(2+3i, eps)/deg, arg(-1 +1i, eps)/deg, arg(-1 - 1i,eps)/deg
|
||||
@@ -32,7 +32,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
conj, im, polar, re
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
15
help/arrow
15
help/arrow
@@ -22,24 +22,23 @@ DESCRIPTION
|
||||
|
||||
Spaces or tabs on either side of -> are optional.
|
||||
|
||||
EXAMPLES
|
||||
EXAMPLE
|
||||
; obj pair {one, two}
|
||||
; obj pair A, B
|
||||
; obj pair A; obj pair B
|
||||
; p = &A
|
||||
; p->one = 1; p->two = 2
|
||||
; A
|
||||
obj pair {1, 2}
|
||||
obj pair {1, 2}
|
||||
|
||||
; A->two = &B
|
||||
; p->two->one = 3; p->two->two = 4
|
||||
; p->one = 3; p->two = 4
|
||||
|
||||
; *p->ptwo
|
||||
; *p
|
||||
obj pair {3, 4}
|
||||
|
||||
; B = {5,6}
|
||||
; *p->two
|
||||
obj pair {5, 6}
|
||||
|
||||
4
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -50,7 +49,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
address, dereference, isptr, dot
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
@@ -29,7 +29,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
asin, acos, atan, acsc, acot, epsilon
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
@@ -18,7 +18,7 @@ DESCRIPTION
|
||||
|
||||
EXAMPLE
|
||||
; print asin(.5, 1e-5), asin(.5, 1e-10), asin(.5, 1e-15), asin(.5, 1e-20)
|
||||
.5236 .5235987756 .523598775598299 .52359877559829887308
|
||||
0.5236 0.5235987756 0.523598775598299 0.52359877559829887308
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -29,7 +29,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
acos, atan, asec, acsc, acot, epsilon
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
@@ -74,7 +74,6 @@ DESCRIPTION
|
||||
results in the value 3 being stored not only as the new value for A
|
||||
but also at the now unnamed location earlier used for A[0].
|
||||
|
||||
|
||||
EXAMPLE
|
||||
; b = 3+1
|
||||
; a = b
|
||||
|
14
help/assoc
14
help/assoc
@@ -66,12 +66,12 @@ EXAMPLE
|
||||
; A["zero"] = 0; A["one"] = 1; A["two"] = 2; A["three"] = 3;
|
||||
; A["smallest", "prime"] = 2;
|
||||
; print A
|
||||
assoc (5 elements);
|
||||
["two"] = 2
|
||||
["three"] = 3
|
||||
["one"] = 1
|
||||
["zero"] = 0
|
||||
["smallest","prime"] = 2
|
||||
assoc (5 elements);
|
||||
["two"] = 2
|
||||
["three"] = 3
|
||||
["one"] = 1
|
||||
["zero"] = 0
|
||||
["smallest","prime"] = 2
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -82,7 +82,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
isassoc, rsearch, search, size
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
@@ -25,7 +25,7 @@ DESCRIPTION
|
||||
|
||||
EXAMPLE
|
||||
; print atan2(0,0), atan2(1,sqrt(3)), atan2(17,53,1e-100)
|
||||
0 ~.52359877559829887307 ~.31038740713235146535
|
||||
0 ~0.52359877559829887307 ~0.31038740713235146535
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -36,7 +36,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
acos, asin, atan, cos, epsilon, sin, tan
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
@@ -20,7 +20,7 @@ DESCRIPTION
|
||||
|
||||
EXAMPLE
|
||||
; print atanh(.5,1e-5), atanh(.5,1e-10), atanh(.5,1e-15), atanh(.5,1e-20)
|
||||
.54931 .5493061443 .549306144334055 .5493061443340548457
|
||||
0.54931 0.5493061443 0.549306144334055 0.5493061443340548457
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -31,7 +31,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
asinh, acosh, asech, acsch, acoth, epsilon
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
10
help/avg
10
help/avg
@@ -35,10 +35,10 @@ EXAMPLE
|
||||
; avg(x,y)
|
||||
|
||||
mat [2,2] (4 elements, 4 nonzero):
|
||||
[0,0] = 1
|
||||
[0,1] = 2
|
||||
[1,0] = 3.5
|
||||
[1,1] = 6
|
||||
[0,0] = 1
|
||||
[0,1] = 2
|
||||
[1,0] = 3.5
|
||||
[1,1] = 6
|
||||
|
||||
LIMITS
|
||||
The number of arguments is not to exceed 1024.
|
||||
@@ -49,7 +49,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
hmean
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
@@ -79,7 +79,7 @@ EXAMPLE
|
||||
10 /* 012 */
|
||||
; base2(16),
|
||||
; 131072
|
||||
131072 /* 0x20000 */
|
||||
131072 /* 0x20000 */
|
||||
; 2345
|
||||
2345 /* 0x929 */
|
||||
|
||||
@@ -96,7 +96,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
base, config, str
|
||||
|
||||
## Copyright (C) 2002 Landon Curt Noll
|
||||
## Copyright (C) 2002,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
|
||||
|
@@ -106,7 +106,6 @@ DESCRIPTION
|
||||
and dsi refer to the double-bracket method of indexing, i.e. the
|
||||
matrix is as if its elements were indexed 0, 1, ..., size(M) - 1.
|
||||
|
||||
|
||||
EXAMPLE
|
||||
; A = blk() = {1,2,3,4}
|
||||
; B = blk()
|
||||
@@ -190,7 +189,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
blk, mat, file, list, str
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
@@ -19,7 +19,6 @@ DESCRIPTION
|
||||
of their creation.
|
||||
|
||||
EXAMPLE
|
||||
|
||||
; A = blk("alpha")
|
||||
; B = blk("beta") = {1,2,3}
|
||||
; blocks()
|
||||
@@ -42,7 +41,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
blk, blkfree
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
32
help/bround
32
help/bround
@@ -65,29 +65,29 @@ DESCRIPTION
|
||||
changed by assignments; plcs and rnd are copied to temporary
|
||||
variables, so their values are not changed by the call.
|
||||
|
||||
EXAMPLES
|
||||
EXAMPLE
|
||||
; a = 7/32, b = -7/32
|
||||
|
||||
; print a, b
|
||||
.21875 -.21875
|
||||
0.21875 -0.21875
|
||||
|
||||
; print round(a,3,0), round(a,3,1), round(a,3,2), print round(a,3,3)
|
||||
.218, .219, .218, .219
|
||||
0.218, 0.219, 0.218, 0.219
|
||||
|
||||
; print round(b,3,0), round(b,3,1), round(b,3,2), print round(b,3,3)
|
||||
-.219, -.218, -.218, -.219
|
||||
-0.219, -0.218, -0.218, -0.219
|
||||
|
||||
; print round(a,3,16), round(a,3,17), round(a,3,18), print round(a,3,19)
|
||||
.2188 .2188 .2188 .2188
|
||||
0.2188 0.2188 0.2188 0.2188
|
||||
|
||||
; print round(a,4,16), round(a,4,17), round(a,4,18), print round(a,4,19)
|
||||
.2187 .2188 .2187 .2188
|
||||
0.2187 0.2188 0.2187 0.2188
|
||||
|
||||
; print round(a,2,8), round(a,3,8), round(a,4,8), round(a,5,8)
|
||||
.22 .218 .2188 .21875
|
||||
0.22 0.218 0.2188 0.21875
|
||||
|
||||
; print round(a,2,24), round(a,3,24), round(a,4,24), round(a,5,24)
|
||||
.22 .219 .2188 .21875
|
||||
0.22 0.219 0.2188 0.21875
|
||||
|
||||
; c = 21875
|
||||
; print round(c,-2,0), round(c,-2,1), round(c,-3,0), round(c,-3,16)
|
||||
@@ -100,13 +100,13 @@ EXAMPLES
|
||||
; print round(A,2,24)
|
||||
|
||||
list(7 elements, 7 nonzero):
|
||||
[[0]] = .12
|
||||
[[1]] = .25
|
||||
[[3]] = .38
|
||||
[[4]] = .5
|
||||
[[5]] = .62
|
||||
[[6]] = .75
|
||||
[[7]] = .88
|
||||
[[0]] = 0.12
|
||||
[[1]] = 0.25
|
||||
[[3]] = 0.38
|
||||
[[4]] = 0.5
|
||||
[[5]] = 0.62
|
||||
[[6]] = 0.75
|
||||
[[7]] = 0.88
|
||||
|
||||
LIMITS
|
||||
For non-object case:
|
||||
@@ -122,7 +122,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
round, trunc, btrunc, int, appr
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
@@ -23,7 +23,10 @@ DESCRIPTION
|
||||
depths.
|
||||
|
||||
EXAMPLE
|
||||
n/a
|
||||
; ## NOTE: Your current calculation level may vary:
|
||||
|
||||
; calclevel()
|
||||
0
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -34,7 +37,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
eval, read, quit, abort, inputlevel
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
@@ -18,7 +18,10 @@ DESCRIPTION
|
||||
information on CALCPATH.
|
||||
|
||||
EXAMPLE
|
||||
n/a
|
||||
; ## NOTE: Your current CALCPATH search path may vary:
|
||||
|
||||
; calcpath()
|
||||
".:./cal:~/.cal:/usr/local/share/calc:/usr/local/share/calc/custom"
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -29,7 +32,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
environment, fpathopen
|
||||
|
||||
## Copyright (C) 2006 Landon Curt Noll
|
||||
## Copyright (C) 2006,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
|
||||
|
@@ -34,7 +34,7 @@ DESCRIPTION
|
||||
consider the two cases rnd = 8 and rnd = 16.
|
||||
|
||||
If den(x) > 2, cfsim(x, 8) returns the value of the penultimate simple
|
||||
continued-fraction approximant to x, i.e. if:
|
||||
continued-fraction approximate to x, i.e. if:
|
||||
|
||||
x = a_0 + 1/(a_1 + 1/(a_2 + ... + 1/a_n) ...)),
|
||||
|
||||
@@ -47,7 +47,7 @@ DESCRIPTION
|
||||
of x described above, this is given by replacing a_n by a_n - 1.
|
||||
|
||||
If den(x) = 2, the definition adopted is to round towards zero for the
|
||||
approximant case (rnd = 8) and from zero for the "nearest" case (rnd = 16).
|
||||
approximate case (rnd = 8) and from zero for the "nearest" case (rnd = 16).
|
||||
|
||||
For integral x, cfsim(x, 8) returns zero, cfsim(x,16) returns x - sgn(x).
|
||||
|
||||
@@ -55,7 +55,7 @@ DESCRIPTION
|
||||
|
||||
rnd integer x half-integer x den(x) > 2
|
||||
|
||||
8 0 x - sgn(x)/2 approximant
|
||||
8 0 x - sgn(x)/2 approximate
|
||||
16 x - sgn(x) x + sgn(x)/2 nearest
|
||||
|
||||
From either cfsim(x, 0) and cfsim(x, 1), the other is easily
|
||||
@@ -73,7 +73,7 @@ DESCRIPTION
|
||||
"good" approximations to x with decreasing denominators and
|
||||
correspondingly decreasing accuracy; each denominator is less than half
|
||||
the preceding denominator. (Unlike the "forward" sequence of
|
||||
continued-fraction approximants these are not necessarily alternately
|
||||
continued-fraction approximates these are not necessarily alternately
|
||||
greater than and less than x.)
|
||||
|
||||
Some other properties:
|
||||
|
@@ -13,11 +13,12 @@ DESCRIPTION
|
||||
this function will return an empty string.
|
||||
|
||||
EXAMPLE
|
||||
% calc "print cmdbuf(); a = 3; print a^2;"
|
||||
# NOTE: The following is intended to a shell command line:
|
||||
|
||||
$ calc "print cmdbuf(); a = 3; print a^2;"
|
||||
print cmdbuf(); a = 3; print a^2;
|
||||
|
||||
9
|
||||
%
|
||||
|
||||
LIMITS
|
||||
none
|
||||
@@ -28,7 +29,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
argv, system
|
||||
|
||||
## 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
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user