mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
Compare commits
33 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
06dcb3e51e | ||
|
6e0e48e17e | ||
|
f416973a31 | ||
|
b408b59d8d | ||
|
77405e1d84 | ||
|
da623e13cb | ||
|
f025dcf0d8 | ||
|
3bfcaae767 | ||
|
bf5b56d263 | ||
|
0b044ce972 | ||
|
e2686911ae | ||
|
544b873914 | ||
|
948d9e807b | ||
|
6d020b7fbe | ||
|
9fcdd80549 | ||
|
3148ce06a0 | ||
|
945977f1f4 | ||
|
b03e71f0ce | ||
|
db799aac10 | ||
|
adecf7d76e | ||
|
94bf264088 | ||
|
80e841eded | ||
|
3f78fc20d7 | ||
|
c26460b255 | ||
|
3ec7b39366 | ||
|
49c599aec9 | ||
|
a582511002 | ||
|
e05d904821 | ||
|
ccd579ecda | ||
|
15be1dec4d | ||
|
f34c659877 | ||
|
2ad27e7909 | ||
|
a4d3c8ff9d |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -6,12 +6,14 @@
|
||||
#
|
||||
.dynamic
|
||||
.hsrc
|
||||
.static
|
||||
Makefile.our
|
||||
NOTES
|
||||
align32.h
|
||||
args.h
|
||||
cal/.all
|
||||
calc
|
||||
calc-static
|
||||
calc.1
|
||||
calc.usage
|
||||
calcerr.c
|
||||
@@ -99,7 +101,9 @@ libcustcalc*
|
||||
longbits
|
||||
longbits.h
|
||||
sample_many
|
||||
sample_many-static
|
||||
sample_rand
|
||||
sample_rand-static
|
||||
tags
|
||||
terminal.h
|
||||
ver_calc
|
||||
|
2
BUGS
2
BUGS
@@ -88,7 +88,7 @@ Please include the following information in the new issue:
|
||||
* cd to the calc source directory, and send the contents
|
||||
of debug.out.txt produced by this command:
|
||||
|
||||
make debug > debug.out.txt 2>&1
|
||||
make debug
|
||||
|
||||
PLEASE attach the debug.out.txt file to your GitHub issue (bug report)!!
|
||||
|
||||
|
137
CHANGES
137
CHANGES
@@ -1,4 +1,127 @@
|
||||
The following are the changes from calc version 2.14.1.5 to date:
|
||||
The following are the changes from calc version 2.14.3.1 to date:
|
||||
|
||||
Fix typo in the `make debug` Makefile rule.
|
||||
|
||||
Improved .gitignore to ignore .static, calc-static,
|
||||
sample_many-static and sample_rand-static.
|
||||
|
||||
Improved error messages when trying to compile with
|
||||
with one calc type (when BLD_TYPE=calc-dynamic-only or
|
||||
BLD_TYPE=calc-static-only) and install with the other.
|
||||
|
||||
When installing with BLD_TYPE=calc-static-only, the
|
||||
installed calc and calc-static are links to each other.
|
||||
Thanks to GitHub user @TurtleWilly for this suggestion.
|
||||
|
||||
The dynamic shared libraries are not installed if they are not
|
||||
built. So when installing with BLD_TYPE=calc-static-only, the
|
||||
install rule will not attempt to install dynamic shared libraries.
|
||||
Thanks to GitHub user @TurtleWilly for bringing to our attention,
|
||||
problems related to building a statically linked calc under macOS.
|
||||
|
||||
Updated comments in Makefile.local for how to Diagnosing memory,
|
||||
thread, and crash issues under RHEL and macOS.
|
||||
|
||||
We no longer support the Makefile variable ${ALLOW_CUSTOM} to be empty.
|
||||
Normally ${ALLOW_CUSTOM} is:
|
||||
|
||||
ALLOW_CUSTOM= -DCUSTOM
|
||||
|
||||
Now, to disable custom disable custom even if -C is given, use:
|
||||
|
||||
ALLOW_CUSTOM="-UCUSTOM"
|
||||
|
||||
Added comments in Makefile.local for how to reduce dependency chains
|
||||
under macOS. XXX - this doesn't yet work so don't uncomment - XXX.
|
||||
|
||||
Dropped support of Makefile.simple and custom/Makefile.simple.
|
||||
The calc version 2.14.3.0 is the last release that supported
|
||||
the Makefile.simple and custom/Makefile.simple files.
|
||||
Now, a make that supports makefile conditional syntax is required.
|
||||
|
||||
The platform target section from the old Makefile has been moved
|
||||
to a new file, Makefile.target. The Makefile.target is shared
|
||||
by both Makefile and custom/Makefile. The custom/Makefile no
|
||||
longer includes Makefile (instead it includes ../Makefile.target).
|
||||
|
||||
|
||||
The following are the changes from calc version 2.14.2.1 to 2.14.3.0:
|
||||
|
||||
Added cal/fnv_tool.cal, a calc resource file defining:
|
||||
|
||||
find_fnv_prime(bits)
|
||||
deprecated_fnv0(bits,fnv_prime,string)
|
||||
fnv_offset_basis(bits,fnv_prime)
|
||||
fnv1a_style_hash(bits,fnv_prime,prev_hash,string)
|
||||
|
||||
Fixed sorted order of cal/README.
|
||||
|
||||
Removed references to obsolete Email addresses.
|
||||
|
||||
macOS Darwin defaults LCC to "cc".
|
||||
|
||||
Updated COPYING to include the actual text of "The Unlicense".
|
||||
Made minor formatting changes to the file.
|
||||
|
||||
The Darwin specific ${DARWIN_ARCH}, thay by default was unset,
|
||||
is now the ${ARCH_CFLAGS} Makefile variable. Comments about
|
||||
various "-arch name" have been moved to the ${ARCH_CFLAGS} area.
|
||||
|
||||
For old Apple Power PC systems, the following is added:
|
||||
|
||||
COMMON_CFLAGS+= -std=gnu99
|
||||
COMMON_LDFLAGS+= -std=gnu99
|
||||
ARCH_CFLAGS+= -arch ppc
|
||||
|
||||
Old Apple Power PC systems should be detected by the
|
||||
"uname -p" command returning "powerpc". One may force the
|
||||
Power PC mode by adding to the end of any make command:
|
||||
|
||||
make ...make_args... target=Darwin arch=powerpc
|
||||
|
||||
or by adding the following in the Makefile.local file:
|
||||
|
||||
target= Darwin
|
||||
arch= powerpc
|
||||
|
||||
Improved the output of the calcinfo rule by adding echos
|
||||
of various uname values as well as some top Makefile variables.
|
||||
|
||||
Fixed the BUGS file with respect to using `make debug`.
|
||||
|
||||
Added a final ls of `debug.out` for `make debug`.
|
||||
|
||||
|
||||
The following are the changes from calc version 2.14.2.0 to 2.14.2.0:
|
||||
|
||||
Ported calc to the s390x IBM Mainframe running RHEL9.1.
|
||||
|
||||
Added cal/splitbits.cal:
|
||||
|
||||
splitbits(x, b)
|
||||
|
||||
Given an integer x, split the value into a list of integers,
|
||||
each of which is at most b bits long.
|
||||
|
||||
The value b must be an integer > 0.
|
||||
|
||||
The number of elements in the returned list is:
|
||||
|
||||
ceil((highbit(x) + 1) / b)
|
||||
|
||||
If x == 0, then a list of 1 element containing 0 is returned.
|
||||
|
||||
If x < 0, then the two's compliment of abs(x) is returned.
|
||||
Even though calc represents negative integers as positive values
|
||||
with sign bit, the bits returned by this function are as if
|
||||
the integer converted as if the integer was a two's compliment value.
|
||||
|
||||
See also the help command:
|
||||
|
||||
; help resource
|
||||
|
||||
|
||||
The following are the changes from calc version 2.14.1.5 to 2.14.1.6:
|
||||
|
||||
Fixed version numbers in two cases in CHANGES that referred
|
||||
to the 2.14.2.x instead of 2.14.1.x.
|
||||
@@ -1563,9 +1686,9 @@ The following are the changes from calc version 2.12.5.0 to 2.12.5.1:
|
||||
|
||||
There is a new calc bug report Email address:
|
||||
|
||||
calc-bug-report at asthe dot com
|
||||
NOTE: calc-bug-report Email address no longer in use
|
||||
|
||||
This replaces the old calc-bugs at asthe dot com address.
|
||||
This replaces the old calc-bugs Email address.
|
||||
|
||||
To be sure we see your Email reporting a calc bug, please use the
|
||||
following phase in your Email Subject line:
|
||||
@@ -2159,7 +2282,7 @@ The following are the changes from calc version 2.12.1.10 to 2.12.2:
|
||||
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
|
||||
NOTE: calc-contrib Email address no longer in use
|
||||
|
||||
Email address an "ifeq ($(target),YOUR_TARGET_NAME)"
|
||||
... "endif" set of lines from the Makefile so that
|
||||
@@ -3882,9 +4005,9 @@ The following are the changes from calc version 2.11.2t0 to 2.11.2t1.0:
|
||||
www.isthe.com. NOTE: The Email address uses 'asthe' and the web
|
||||
site URL uses 'isthe'.
|
||||
|
||||
Using calc-bugs at asthe dot com for calc bug reports,
|
||||
calc-contrib at asthe dot com for calc contributions,
|
||||
calc-tester-request at asthe dot com for requests to join calc-tester and
|
||||
NOTE: calc-bugs Email address no longer in use
|
||||
NOTE: calc-contrib Email address no longer in use
|
||||
NOTE: calc-tester-request Email address no longer in use
|
||||
|
||||
Replaced explicit Email addresses found this file with the <user at
|
||||
site dot domain> notation to reduce the potential for those folks
|
||||
|
40
COPYING
40
COPYING
@@ -1,6 +1,5 @@
|
||||
calc - arbitrary precision calculator
|
||||
|
||||
|
||||
This file is Copyrighted
|
||||
------------------------
|
||||
|
||||
@@ -76,8 +75,8 @@ Calc's relationship to the GNU Lesser General Public License
|
||||
Clearly all files that go into the creation of those binary link
|
||||
libraries are covered under the License.
|
||||
|
||||
The ``scripts used to control compilation and installation of the
|
||||
of the library'' include:
|
||||
The "scripts used to control compilation and installation of the
|
||||
of the library" include:
|
||||
|
||||
* Makefiles
|
||||
* source files created by the Makefiles
|
||||
@@ -85,7 +84,7 @@ Calc's relationship to the GNU Lesser General Public License
|
||||
|
||||
All of those files are covered under the License.
|
||||
|
||||
The ``associated interface definition files'' are those files that:
|
||||
The "associated interface definition files" are those files that:
|
||||
|
||||
* show how the calc binary link libraries are used
|
||||
* test the validity of the binary link libraries
|
||||
@@ -100,9 +99,9 @@ Calc's relationship to the GNU Lesser General Public License
|
||||
* files under the lib sub-directory
|
||||
* the main calc.c file
|
||||
|
||||
The ``complete source code'' includes ALL files shipped with calc,
|
||||
except for the exception files explicitly listed in the ``Calc
|
||||
copyrights and exception files'' section below.
|
||||
The "complete source code" includes ALL files shipped with calc,
|
||||
except for the exception files explicitly listed in the "Calc
|
||||
copyrights and exception files" section below.
|
||||
|
||||
-=-
|
||||
|
||||
@@ -146,9 +145,32 @@ Calc copyrights and exception files
|
||||
cal/dotest.cal
|
||||
cal/screen.cal
|
||||
|
||||
For more information on this license, see:
|
||||
"The Unlicense" is as follows:
|
||||
|
||||
https://unlicense.org
|
||||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <http://unlicense.org/>
|
||||
|
||||
In all cases one may use and distribute these exception files freely.
|
||||
And because one may freely distribute the LGPL covered files, the
|
||||
|
733
HOWTO.INSTALL
733
HOWTO.INSTALL
@@ -1,495 +1,360 @@
|
||||
# Installing a pre-compiled calc from an RPM
|
||||
|
||||
IMPORTANT: Please see the section at the bottom of this file for
|
||||
some important information on Makefiles used in calc.
|
||||
If your platform supports RPMs, you may want to go to:
|
||||
|
||||
###################################################################
|
||||
# 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) :) #
|
||||
###################################################################
|
||||
https://github.com/lcn2/calc/releases
|
||||
|
||||
Installing calc from the bzip2-ed tarball: 4 easy steps:
|
||||
and see if there is a pre-compiled version of calc that you may install.
|
||||
|
||||
(0) If your platform supports i686 RPMs, you may want to go to:
|
||||
Open up the 'Assets' tag below a given release and download these RPMs:
|
||||
|
||||
https://github.com/lcn2/calc/releases
|
||||
* calc*.rpm
|
||||
- all that is needed if you just want to use calc
|
||||
|
||||
Open up the 'Assets' tag below a given release and
|
||||
download these RPMs:
|
||||
If your platform supports rpm and matches one of the "calc*.rpm" files, you
|
||||
may just install that "calc*.rpm". For exammple on an x86_64 system:
|
||||
|
||||
* calc*.i686.rpm
|
||||
- all that is needed if you just want to use calc
|
||||
dnf install calc-x.y.z.cv-ww.x86_64.rpm
|
||||
|
||||
* calc-devel-*.i686.rpm
|
||||
- calc *.h header and *.a lib files for use in other programs
|
||||
where "calc-x.y.z.cv-ww.x86_64.rpm" is the name of the calc RPM.
|
||||
|
||||
* calc.*.src.rpm
|
||||
- calc source via a SRPM package
|
||||
In addition, if your platform supports rpm and matches one of the
|
||||
"calc*.rpm" files, you may also install the calc *.h header and *.a lib
|
||||
files for use in other programs:
|
||||
|
||||
Alternately to the above github link, you might try looking at
|
||||
the RPMs under:
|
||||
* calc-devel-*.rpm
|
||||
- calc *.h header and *.a lib files for use in other programs
|
||||
|
||||
http://www.isthe.com/chongo/src/calc/
|
||||
Alternately to the above github link, you might try looking at the RPMs under:
|
||||
|
||||
=-=
|
||||
http://www.isthe.com/chongo/src/calc/
|
||||
|
||||
The following 4 steps apply to calc source tree that comes from either:
|
||||
|
||||
bunzip2 -c calc-*.tar.bz2 | tar -xvf -
|
||||
|
||||
or from:
|
||||
# Building calc from a source tree
|
||||
|
||||
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.
|
||||
|
||||
The top level Makefile and the custom/Makefile require a modern
|
||||
Make (such as gmake) or an equivalently advanced make. On many
|
||||
targets, the default make is sufficient. On FreeBSD for example,
|
||||
probably want to use gmake instead of make.
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
! By default, calc assumes you have the readline package installed !
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
! macOS does not have readline, so mac users need to make a choice !
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
The readline package (-lreadline, -lhistory, -lncurses) used by and
|
||||
linked into calc by default. If your system does NOT have those
|
||||
libaraies, then you have two options:
|
||||
|
||||
(1-with readline) Install the readline package <- Recommended
|
||||
|
||||
Install the readline package first, then compile calc.
|
||||
|
||||
For information on the readline package, see:
|
||||
|
||||
https://tiswww.case.edu/php/chet/readline/rltop.html
|
||||
|
||||
MacOS users can use MacPorts or HomeBrew to install readline:
|
||||
|
||||
https://www.macports.org
|
||||
https://brew.sh
|
||||
|
||||
Or compile from the readline.git repo:
|
||||
|
||||
http://git.savannah.gnu.org/cgit/readline.git/
|
||||
|
||||
(1-w/o readline) Compile calc without readline (not recommended)
|
||||
|
||||
Why do we not recommend (1b)? Because using calc with readline
|
||||
provides a beter user experience.
|
||||
|
||||
If you feel you must use calc without the readline package, then you
|
||||
will need to change your calc Makefile with this patch:
|
||||
|
||||
--- Makefile.old 2021-12-29 14:57:56.000000000 -0800
|
||||
+++ Makefile 2021-12-29 14:59:13.000000000 -0800
|
||||
@@ -1140,14 +1140,14 @@
|
||||
#
|
||||
# If in doubt, set USE_READLINE, READLINE_LIB and READLINE_INCLUDE to nothing.
|
||||
#
|
||||
-#USE_READLINE=
|
||||
-USE_READLINE= -DUSE_READLINE
|
||||
+USE_READLINE=
|
||||
+#USE_READLINE= -DUSE_READLINE
|
||||
#
|
||||
-#READLINE_LIB=
|
||||
-#READLINE_EXTRAS=
|
||||
+READLINE_LIB=
|
||||
+READLINE_EXTRAS=
|
||||
#
|
||||
-READLINE_LIB= -lreadline
|
||||
-READLINE_EXTRAS= -lhistory -lncurses
|
||||
+#READLINE_LIB= -lreadline
|
||||
+#READLINE_EXTRAS= -lhistory -lncurses
|
||||
#
|
||||
#READLINE_LIB= -L/usr/gnu/lib -lreadline
|
||||
#READLINE_EXTRAS= -lhistory -lncurses
|
||||
@@ -1181,8 +1181,8 @@
|
||||
# # and using the readline, history, and ncurses libraries.
|
||||
# #
|
||||
ifneq ($(HOMEBREW_PREFIX),)
|
||||
-READLINE_LIB:= -L${HOMEBREW_PREFIX}/opt/readline/lib -lreadline
|
||||
-READLINE_INCLUDE:= -I${HOMEBREW_PREFIX}/opt/readline/include
|
||||
+#READLINE_LIB:= -L${HOMEBREW_PREFIX}/opt/readline/lib -lreadline
|
||||
+#READLINE_INCLUDE:= -I${HOMEBREW_PREFIX}/opt/readline/include
|
||||
endif
|
||||
#
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
|
||||
If your target system does not have a modern Makefile
|
||||
(such as gmake), then you will need to change your
|
||||
Makefile.simple with this patch:
|
||||
|
||||
--- Makefile.simple.orig 2021-12-29 15:00:53.000000000 -0800
|
||||
+++ Makefile.simple 2021-12-29 15:01:00.000000000 -0800
|
||||
@@ -1005,14 +1005,14 @@
|
||||
#
|
||||
# If in doubt, set USE_READLINE, READLINE_LIB and READLINE_INCLUDE to nothing.
|
||||
#
|
||||
-#USE_READLINE=
|
||||
-USE_READLINE= -DUSE_READLINE
|
||||
+USE_READLINE=
|
||||
+#USE_READLINE= -DUSE_READLINE
|
||||
#
|
||||
-#READLINE_LIB=
|
||||
-#READLINE_EXTRAS=
|
||||
+READLINE_LIB=
|
||||
+READLINE_EXTRAS=
|
||||
#
|
||||
-READLINE_LIB= -lreadline
|
||||
-READLINE_EXTRAS= -lhistory -lncurses
|
||||
+#READLINE_LIB= -lreadline
|
||||
+#READLINE_EXTRAS= -lhistory -lncurses
|
||||
#
|
||||
#READLINE_LIB= -L/usr/gnu/lib -lreadline
|
||||
#READLINE_EXTRAS= -lhistory -lncurses
|
||||
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
! By default, calc assumes you are using a modern gnu-like make tool !
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
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:
|
||||
|
||||
mv Makefile Makefile.gmake
|
||||
cp Makefile.simple Makefile
|
||||
mv custom/Makefile custom/Makefile.gmake
|
||||
cp custom/Makefile.simple custom/Makefile
|
||||
|
||||
The Makefile, as shipped, is suitable for installation under
|
||||
Linux and Un*x-like environments. For the most part, the default
|
||||
values should work. If in doubt, follow the 'When in doubt'
|
||||
suggestion.
|
||||
|
||||
If you are using a modern make (such as gmake), you may override
|
||||
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 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:
|
||||
|
||||
INCDIR Where the system include (.h) files are kept.
|
||||
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.
|
||||
|
||||
You may want to change the default installation locations for
|
||||
these values, which are based on the 4 values listed above:
|
||||
|
||||
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
|
||||
|
||||
If you want to install calc files under a top level directory,
|
||||
then set the T value:
|
||||
|
||||
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
|
||||
## Step 0: Obtain the calc source tree
|
||||
|
||||
Then the installation locations will be:
|
||||
Go to the site:
|
||||
|
||||
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/...
|
||||
https://github.com/lcn2/calc/releases
|
||||
|
||||
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.
|
||||
Look for release with a file of the form:
|
||||
|
||||
Look for the section that starts:
|
||||
calc-x.y.z.v.tar.bz2
|
||||
|
||||
################
|
||||
# compiler set #
|
||||
################
|
||||
A release marked with a green "(Latest)" is a production release
|
||||
that as undergone a fair amount of testing.
|
||||
|
||||
Select a compiler set by commenting in the appropriate set
|
||||
of cc options. As shipped the Makefile assumes a gcc-like
|
||||
environment such as Linux. If a more appropriate cc set if
|
||||
found below, comment out the Linux set and comment in that
|
||||
set or edit the gcc set or the common cc set as needed.
|
||||
A release marked with an orange "(Pre-release)" is likly to be
|
||||
more stable than the top of the master branch, as they do undergo
|
||||
thru a reasonable level of regression testing, just not to
|
||||
the level of a "(Latest)" production release.
|
||||
|
||||
You may want to change these Makefile variables from their defaults:
|
||||
Use the followig command to uncompress the bzip2 compressed tarball:
|
||||
|
||||
RANLIB
|
||||
bunzip2 -c calc-*.tar.bz2 | tar -xvf -
|
||||
|
||||
You may or may not need RANLIB when building libraries.
|
||||
As shipped the Makefile assumes RANLIB is needed.
|
||||
Comment the in/out the RANLIB value if ranlib does
|
||||
not work or does not exist.
|
||||
NOTE: An alternate location for calc bzip2 compressed tarballs is:
|
||||
|
||||
CALCPAGER
|
||||
http://www.isthe.com/chongo/src/calc/
|
||||
|
||||
You may want to change the default pager used by calc.
|
||||
As shipped the Makefile assumes 'more'. On your system
|
||||
you may find 'less' to be a better pager.
|
||||
|
||||
DEBUG
|
||||
|
||||
Some compilers (to put it mildly) have bugs. Sometimes the
|
||||
DEBUG Makefile variable causes the compiler / optimizer to
|
||||
produce bad code. Other compilers do just fine.
|
||||
### Obtaining the experimental top of the master branch calc source
|
||||
|
||||
If possible try to use DEBUG=-O3 -g3 (maximum optimization
|
||||
and debug symbols). If the calc test fails (see step 3),
|
||||
try lowering either the -O value and/or the -g3. Also try
|
||||
using -Osomething without -g.
|
||||
You may also fetch the top of the master branch of the GitHub repo
|
||||
if you wish to see what the latest source code looks like:
|
||||
|
||||
Adjust other Makefile variables as needed.
|
||||
git clone https://github.com/lcn2/calc.git
|
||||
|
||||
(2) build calc:
|
||||
IMPORTANT:
|
||||
|
||||
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.
|
||||
The latest source code may be "experimental in nature". You may be
|
||||
better off using a released bzip2 compressed tarball instead.
|
||||
Released bzip2 compressed tarballs tend to be more well tested
|
||||
than the top of the master branch.
|
||||
|
||||
If your target system does not have GNU Make (or equivalent), then
|
||||
you should try using the Makefile.simple and custom/Makefile.simple
|
||||
files:
|
||||
|
||||
mv Makefile Makefile.gmake
|
||||
cp Makefile.simple Makefile
|
||||
mv custom/Makefile custom/Makefile.gmake
|
||||
cp custom/Makefile.simple custom/Makefile
|
||||
|
||||
make all
|
||||
## Step 1: Makefile considerations
|
||||
|
||||
==> We are interested in any compiler warnings (and errors) that
|
||||
you may find. See the BUGS file if you find any compiler
|
||||
warning or errors.
|
||||
Look at Makefile, and adjust it to suit your needs.
|
||||
|
||||
NOTE: You can force calc to build with only static libs:
|
||||
|
||||
make clobber
|
||||
make calc-static-only BLD_TYPE=calc-static-only
|
||||
|
||||
or force calc to build with only dynamic libs:
|
||||
### IMPORTANT: Make support of conditional syntax required:
|
||||
|
||||
make clobber
|
||||
make calc-dynamic-only BLD_TYPE=calc-dynamic-only
|
||||
To compile calc, you must use a make that supports the use of
|
||||
"Conditional syntax". As nearly all modern make tools
|
||||
support "Conditional syntax", thus should not be a problem
|
||||
for you. If for some reason your make tool does not support
|
||||
"Conditional syntax", consider upgraded to a make that does,
|
||||
such as the Gnu Make tool:
|
||||
|
||||
(3) test calc:
|
||||
https://www.gnu.org/software/make/
|
||||
|
||||
make check
|
||||
The Gnu Make is not required per-se, just a modern make tool
|
||||
that supports "Conditional syntax".
|
||||
|
||||
NOTE: For a quiet check which only prints if something goes wrong:
|
||||
|
||||
make chk
|
||||
|
||||
(4) install calc:
|
||||
### Suggestion: Modify Makefile.local instead of Makefile:
|
||||
|
||||
make install
|
||||
In most cases, to change the way that calc is made, consider
|
||||
adding lines to Makefile.local instead of modifying Makefile.
|
||||
|
||||
A recommened way to adjust it is to add lines to: Makefile.local
|
||||
using the := syntax to replace values such as:
|
||||
|
||||
DEBUG:= -O0 -g
|
||||
|
||||
or by using the += syntax to append to values such as:
|
||||
|
||||
CFLAGS+= -UCUSTOM
|
||||
|
||||
|
||||
|
||||
## readline package assumed by default:
|
||||
|
||||
By "readline package" we refer to the combination of the
|
||||
readline library, the history library, and the ncurses library.
|
||||
|
||||
By default, calc assumes you have the readline package installed.
|
||||
The readline package (-lreadline, -lhistory, -lncurses) used by and
|
||||
linked into calc by default.
|
||||
|
||||
If your system (such as macOS) does NOT have those libaraies, then
|
||||
you have two options:
|
||||
|
||||
|
||||
|
||||
### Install the readline package:
|
||||
|
||||
We recommend that you install the readline package first, then compile calc.
|
||||
|
||||
For information on the readline package, see:
|
||||
|
||||
https://tiswww.case.edu/php/chet/readline/rltop.html
|
||||
|
||||
MacOS users can use MacPorts or HomeBrew to install readline:
|
||||
|
||||
https://www.macports.org
|
||||
https://brew.sh
|
||||
|
||||
Or compile from the readline.git repo:
|
||||
|
||||
http://git.savannah.gnu.org/cgit/readline.git/
|
||||
|
||||
|
||||
|
||||
### Compile calc without readline:
|
||||
|
||||
Why do we not recommend this option because using calc with readline
|
||||
provides a beter user experience.
|
||||
|
||||
If you feel you must use calc without the readline package, then you
|
||||
will need to compile with:
|
||||
|
||||
make clobber all USE_READLINE= READLINE_EXTRAS= READLINE_INCLUDE= READLINE_LIB=
|
||||
|
||||
or add to Makefile.local, these lines:
|
||||
|
||||
USE_READLINE=
|
||||
READLINE_EXTRAS=
|
||||
READLINE_INCLUDE=
|
||||
READLINE_LIB=
|
||||
|
||||
|
||||
|
||||
### Windows or a Windows-like environments:
|
||||
|
||||
Currently Windows is not a well supported platform for calc. There are
|
||||
people within Microsoft who plan to assist us in being able to allow
|
||||
the standard Microsoft Windows developor environment to compile calc.
|
||||
|
||||
|
||||
|
||||
### Makefile variables to consider:
|
||||
|
||||
You should determine if these Makefile variables are reasonable:
|
||||
|
||||
INCDIR Where the system include (.h) files are kept.
|
||||
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.
|
||||
|
||||
You may want to change the default installation locations for
|
||||
these values, which are based on the 4 values listed above:
|
||||
|
||||
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
|
||||
|
||||
If you want to install calc files under a top level directory, then set the T value:
|
||||
|
||||
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.
|
||||
|
||||
Again, consider adding replacement lines or append linbes to
|
||||
the Makefile.local file. See "Suggestion Modify Makefile.local
|
||||
instead of Makefile" above. For example:
|
||||
|
||||
T:= /var/tmp/testing
|
||||
|
||||
|
||||
|
||||
### platform target section
|
||||
|
||||
The file, Makefile.target, contains information about various platforms.
|
||||
The current list of targets in Makefile.target are:
|
||||
|
||||
- Linux target
|
||||
- Apple macOS / Darwin target
|
||||
- FreeBSD target
|
||||
- OpenBSD target
|
||||
- Cygwin target
|
||||
- simple target
|
||||
- default target (when target is empty)
|
||||
|
||||
If you wish to modiy your target platform, consider doing
|
||||
so via the Makefile.local file. See "Suggestion Modify Makefile.local
|
||||
instead of Makefile" above.
|
||||
|
||||
|
||||
|
||||
## Step 2: compile calc
|
||||
|
||||
Remove any previous compile attempts and compile by default:
|
||||
|
||||
make clobber all
|
||||
|
||||
|
||||
|
||||
### Force calc to build with only static libs:
|
||||
|
||||
You may force calc to build with only static libs:
|
||||
|
||||
make clobber calc-static-only BLD_TYPE=calc-static-only
|
||||
|
||||
|
||||
|
||||
### Force calc to build with only dynamic shared libs:
|
||||
|
||||
You may force calc to build with only dynamic libs:
|
||||
|
||||
make clobber calc-dynamic-only BLD_TYPE=calc-dynamic-only
|
||||
|
||||
|
||||
|
||||
### Reports of compiler warnings (and errors) as welcome
|
||||
|
||||
We are interested learning about any compiler warnings (and errors) that you may find.
|
||||
See the BUGS file if you find any compiler warning or errors.
|
||||
|
||||
|
||||
|
||||
### Step 3: test calc
|
||||
|
||||
You may run the calc regression test suite, after successfully compiling, by:
|
||||
|
||||
make check
|
||||
|
||||
For a more quiet check which only prints if something goes wrong, use:
|
||||
|
||||
make chk
|
||||
|
||||
|
||||
|
||||
### Step 4: install calc
|
||||
|
||||
Depending on permissions, you may need to become the super-user:
|
||||
|
||||
sudo -s
|
||||
|
||||
before you install:
|
||||
|
||||
make install
|
||||
|
||||
|
||||
|
||||
### Step n: calc help - getting started
|
||||
|
||||
Calc is distributed with an extensive collection of help files that
|
||||
are accessible from the command line. The following assume that you
|
||||
are running calc from the distribution directory or that you have
|
||||
installed calc. In these examples, the "; " is the calc prompt, not
|
||||
something that you type.
|
||||
|
||||
For list of help topics:
|
||||
|
||||
; help
|
||||
|
||||
For overview of calc overview:
|
||||
|
||||
; help intro
|
||||
; help overview
|
||||
; help command
|
||||
; help define
|
||||
; help statement
|
||||
; help variable
|
||||
; help usage
|
||||
|
||||
For list of builtin functions:
|
||||
|
||||
; help builtin
|
||||
|
||||
C programmers should note some unexpected differences with the calc syntax:
|
||||
|
||||
; help unexpected
|
||||
|
||||
Calc is shipped with a standard collection of calc resource files.
|
||||
For a list of calc standard resource files see:
|
||||
|
||||
; help resource
|
||||
|
||||
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.
|
||||
In general, if you run into problems, read the BUGS file and follow the instructions.
|
||||
|
||||
=-=
|
||||
# IMPORTANT: parallel make not supported
|
||||
|
||||
On calc Makefiles:
|
||||
We do not support making calc using a parallel make as most parallel
|
||||
make systems fail to understand the depedency relationships between
|
||||
a numner of important make rules and thus fail to properly compile calc.
|
||||
|
||||
How to tell the origin of of a Makefile:
|
||||
|
||||
The "# SRC: ... - ..." comment line near the top
|
||||
of the file indicates the origin of this file.
|
||||
In each segment below, we indicate what the SRC
|
||||
comment like will read.
|
||||
|
||||
SHELL= ...
|
||||
|
||||
On some systems, /bin/sh is a rather reduced shell with
|
||||
deprecated behavior.
|
||||
|
||||
If your system has a up to date, bash shell, then
|
||||
you may wish to edit the Makefile to use:
|
||||
|
||||
SHELL= /bin/bash
|
||||
|
||||
On some systems such as macOS, the bash shell is very
|
||||
far behind to the point where is cannot be depended on.
|
||||
On such systems, the sh may be a much better alternative
|
||||
shell for this Makefile to use:
|
||||
|
||||
SHELL= /bin/sh
|
||||
|
||||
Makefile.local
|
||||
|
||||
# SRC: Makefile.local - tweaks to the top level Makefile
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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 the calc GitHub repo, Makefile is the calc build environment
|
||||
and Makefile.ship is the top level Makefile:
|
||||
|
||||
https://github.com/lcn2/calc
|
||||
|
||||
Makefile
|
||||
|
||||
# SRC: Makefile.ship - top level Makefile
|
||||
|
||||
This is the main top level Makefile.
|
||||
|
||||
In calc packages such as RPMs, and the tar.bz2 source tarball,
|
||||
Makefile.ship has been moved into Makefile.
|
||||
|
||||
In the calc GitHub repo, Makefile is the calc build environment
|
||||
and Makefile.ship is the top level Makefile:
|
||||
|
||||
https://github.com/lcn2/calc
|
||||
|
||||
The Makefile.simple rule of Makefile.ship, when forming the
|
||||
Makefile.simple file, removes lines from Makefile.ship between
|
||||
pairs of '#if 0' AND '#endif':
|
||||
|
||||
#if 0
|
||||
lines removed when forming Makefile.simple
|
||||
...
|
||||
lines removed when forming Makefile.simple
|
||||
#endif
|
||||
|
||||
The '#if 0' AND '#endif' MUST be at the start of the line.
|
||||
Any text after the '#if 0' OR '#endif' is ignored.
|
||||
|
||||
While they may look like a CPP directives, they are not. The
|
||||
inline awk script of the Makefile.simple rule does NOT allow
|
||||
them to nest:
|
||||
|
||||
#if 0 /* DO NOT DO THIS */
|
||||
lines removed when forming Makefile.simple
|
||||
...
|
||||
#if 0 /* DO NOT DO THIS */
|
||||
...
|
||||
#endif /* DO NOT DO THIS */
|
||||
...
|
||||
#endif /* DO NOT DO THIS */
|
||||
|
||||
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.
|
||||
|
||||
If you have a Makefile.simple file, use these commands to
|
||||
form a Makefile:
|
||||
|
||||
if [ -f Makefile ]; then mv -f Makefile Makefile.orig; fi
|
||||
cp Makefile.simple Makefile
|
||||
|
||||
The Makefile.simple rule from Makefile.ship is used to construct
|
||||
this file from the contents of Makefile.ship.
|
||||
|
||||
In calc packages such as RPMs, and the tar.bz2 source the
|
||||
Makefile.simple exists. In the calc GitHub repo:
|
||||
|
||||
https://github.com/lcn2/calc
|
||||
|
||||
this file does NOT exist and must be made via the Makefile.simple
|
||||
make rule. Therefore, non-GNU and simple make commands are NOT
|
||||
supported by the calc GitHub repo master branch. Instead, you
|
||||
need to extract Makefile.simple from one of the calc tar.bz2
|
||||
source tarball source from a calc source mirror:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/calc-mirror.html
|
||||
|
||||
custom/Makefile
|
||||
|
||||
# SRC: Makefile via make -f Makefile custom/Makefile
|
||||
|
||||
This is the custom directory 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
|
||||
command.
|
||||
|
||||
In calc packages such as RPMs, and the tar.bz2 source the
|
||||
Makefile.simple exists. In the calc GitHub repo:
|
||||
|
||||
https://github.com/lcn2/calc
|
||||
|
||||
this file does NOT exist and must be made via the
|
||||
custom/Makefile.simple make rule. Therefore, non-GNU and simple
|
||||
make commands are NOT supported by the calc GitHub repo master
|
||||
branch. Instead, you need to extract custom/Makefile.simple
|
||||
from one of the calc tar.bz2 source tarball source from a calc
|
||||
source mirror:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/calc-mirror.html
|
||||
|
||||
cal/Makefile
|
||||
|
||||
# SRC: cal/Makefile
|
||||
|
||||
The Makefile for the cal sub-directory.
|
||||
|
||||
cscript/Makefile
|
||||
|
||||
# SRC: cscript/Makefile
|
||||
|
||||
The Makefile for the cscript sub-directory.
|
||||
|
||||
help/Makefile
|
||||
|
||||
# SRC: help/Makefile
|
||||
|
||||
The Makefile for the help sub-directory.
|
||||
|
||||
## Copyright (C) 1999-2007,2021 Landon Curt Noll
|
||||
## Copyright (C) 1999-2007,2021,2023 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
|
||||
|
@@ -9,6 +9,12 @@
|
||||
# To replace a Makefile variable, use := symbols. For example:
|
||||
#
|
||||
# CCWERR:= -Werror
|
||||
#
|
||||
# You can append to an existing Makefile variable using '+=' symbols.
|
||||
# For example:
|
||||
#
|
||||
# CFLAGS+= -Ofast
|
||||
####
|
||||
|
||||
###################################################################
|
||||
# NOTE: For this and other commended out examples in this file, #
|
||||
@@ -17,24 +23,75 @@
|
||||
# Comments start with a #-character. #
|
||||
###################################################################
|
||||
|
||||
# You can append to an existing Makefile variable using '+=' symbols.
|
||||
# For example:
|
||||
####
|
||||
# RHEL Diagnosing memory, thread, and crash issues:
|
||||
#
|
||||
# CFLAGS+= -Ofast
|
||||
# For more info see: https://github.com/google/sanitizers/wiki/AddressSanitizer
|
||||
#
|
||||
# This comment block was tested under:
|
||||
#
|
||||
# RHEL9 gcc version 11.3.1 20221121 (Red Hat 11.3.1-4) (GCC)
|
||||
#
|
||||
# with:
|
||||
#
|
||||
# libasan-11.3.1-4.3.el9.x86_64 libubsan-11.3.1-4.3.el9.x86_64
|
||||
#
|
||||
# NOTE: With the above version, these are NOT supported:
|
||||
#
|
||||
# UNSUPPORTED_FSANITIZE:= -fsanitize=nullability-arg -fsanitize=nullability-assign
|
||||
#
|
||||
# Uncomment these lines:
|
||||
#
|
||||
# DEBUG:= -O0 -g
|
||||
# FSANITIZE:= -fsanitize=undefined -fsanitize=address -fsanitize=bool -fsanitize=bounds
|
||||
# FSANITIZE+= -fsanitize=enum -fsanitize=vptr -fsanitize=integer-divide-by-zero
|
||||
# FSANITIZE+= -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow
|
||||
# FSANITIZE+= -fsanitize=nonnull-attribute -fsanitize=returns-nonnull-attribute
|
||||
# FSANITIZE+= -fsanitize=null -fsanitize=shift -fsanitize=signed-integer-overflow
|
||||
# FSANITIZE+= -fsanitize=unreachable -fsanitize=vla-bound
|
||||
# CFLAGS+= -Wno-invalid-command-line-argument ${FSANITIZE} -fno-omit-frame-pointer
|
||||
# LDFLAGS+= -Wno-invalid-command-line-argument ${FSANITIZE} -fno-omit-frame-pointer
|
||||
# CALC_ENV+= ASAN_OPTIONS=detect_stack_use_after_return=1
|
||||
####
|
||||
|
||||
# For example, a AddressSanitizer. You do NOT want to do this by
|
||||
# by default! Do this only if you are debugging with libasan:
|
||||
####
|
||||
# macOS Diagnosing memory, thread, and crash issues:
|
||||
#
|
||||
# For Linux gcc version 11.3.1 with libasan-11.3.1-2.1 you might try:
|
||||
# For more info see: https://github.com/google/sanitizers/wiki/AddressSanitizer
|
||||
#
|
||||
# DEBUG:= -O0 -g
|
||||
# CFLAGS+= -fsanitize=address -fno-omit-frame-pointer
|
||||
# LDFLAGS+= -fsanitize=address -fno-omit-frame-pointer
|
||||
# CALC_ENV+= ASAN_OPTIONS=detect_stack_use_after_return=1
|
||||
# This comment block was tested under:
|
||||
#
|
||||
# For macOS 13.2.1 with clang version 14.0.0 (clang-1400.0.29.202) you might try:
|
||||
# macOS 13.5 with clang version 14.0.3 (clang-1403.0.22.14.1)
|
||||
#
|
||||
# DEBUG:= -O0 -g
|
||||
# CFLAGS+= -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
|
||||
# LDFLAGS+= -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
|
||||
# CALC_ENV+= ASAN_OPTIONS=detect_stack_use_after_return=1
|
||||
# For more info for clang to Diagnosing memory, thread, and crash issues early, see:
|
||||
#
|
||||
# https://developer.apple.com/documentation/xcode/diagnosing-memory-thread-and-crash-issues-early
|
||||
#
|
||||
# NOTE: With the above version, these are NOT supported:
|
||||
#
|
||||
# UNSUPPORTED_FSANITIZE:= -fsanitize-nullability-return
|
||||
#
|
||||
# Uncomment these lines:
|
||||
#
|
||||
# DEBUG:= -O0 -g
|
||||
# FSANITIZE:= -fsanitize=undefined -fsanitize=address -fsanitize=bool -fsanitize=bounds
|
||||
# FSANITIZE+= -fsanitize=enum -fsanitize=vptr -fsanitize=integer-divide-by-zero
|
||||
# FSANITIZE+= -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow
|
||||
# FSANITIZE+= -fsanitize=nonnull-attribute -fsanitize=nullability-arg
|
||||
# FSANITIZE+= -fsanitize=nullability-assign -fsanitize=returns-nonnull-attribute
|
||||
# FSANITIZE+= -fsanitize=null -fsanitize=object-size -fsanitize=shift
|
||||
# FSANITIZE+= -fsanitize=signed-integer-overflow -fsanitize=unreachable -fsanitize=vla-bound
|
||||
# CFLAGS+= -Wno-invalid-command-line-argument ${FSANITIZE} -fno-omit-frame-pointer
|
||||
# LDFLAGS+= -Wno-invalid-command-line-argument ${FSANITIZE} -fno-omit-frame-pointer
|
||||
# CALC_ENV+= ASAN_OPTIONS=detect_stack_use_after_return=1
|
||||
####
|
||||
|
||||
####
|
||||
# To reduce dependency chains under macOS:
|
||||
#
|
||||
# This comment block was tested under:
|
||||
#
|
||||
# macOS 13.5 with clang version 14.0.3 (clang-1403.0.22.14.1)
|
||||
#
|
||||
# LDFLAGS+= -Wl,-dead_strip_dylibs -Wl,-dead_strip
|
||||
####
|
||||
|
6881
Makefile.simple
6881
Makefile.simple
File diff suppressed because it is too large
Load Diff
523
Makefile.target
Normal file
523
Makefile.target
Normal file
@@ -0,0 +1,523 @@
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# Makefile.target - platform target section
|
||||
#
|
||||
# Copyright (C) 2023 Landon Curt Noll
|
||||
#
|
||||
# Suggestion: Read the HOWTO.INSTALL file.
|
||||
#
|
||||
# Calc is open software; you can redistribute it and/or modify it under
|
||||
# the terms of version 2.1 of the GNU Lesser General Public License
|
||||
# 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.
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#######################################################################
|
||||
# NOTE: These lines are included by both Makefile and custom/Makefile #
|
||||
#######################################################################
|
||||
|
||||
##################################################################################
|
||||
#-=-=-=-=-=- platform 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
|
||||
|
||||
################
|
||||
# Linux target #
|
||||
################
|
||||
|
||||
ifeq ($(target),Linux)
|
||||
#
|
||||
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}"
|
||||
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
|
||||
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
|
||||
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= gcc
|
||||
CC= ${PURIFY} ${LCC} ${CCWERR}
|
||||
#
|
||||
endif
|
||||
|
||||
###############################
|
||||
# Apple macOS / Darwin target #
|
||||
###############################
|
||||
|
||||
# For old Apple Power PC systems, we need to add:
|
||||
#
|
||||
# -std=gnu99 -arch ppc
|
||||
#
|
||||
ifeq ($(arch),powerpc)
|
||||
COMMON_CFLAGS+= -std=gnu99
|
||||
COMMON_LDFLAGS+= -std=gnu99
|
||||
ARCH_CFLAGS+= -arch ppc
|
||||
endif
|
||||
|
||||
ifeq ($(target),Darwin)
|
||||
#
|
||||
BLD_TYPE= calc-dynamic-only
|
||||
#
|
||||
CC_SHARE= -fPIC
|
||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:${LIBDIR}:${PREFIX}/lib
|
||||
LD_SHARE= ${ARCH_CFLAGS}
|
||||
#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} ${ARCH_CFLAGS}
|
||||
else
|
||||
LIBCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib \
|
||||
${ARCH_CFLAGS}
|
||||
endif
|
||||
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
|
||||
ifeq ($(SET_INSTALL_NAME),yes)
|
||||
LIBCUSTCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib \
|
||||
-install_name ${LIBDIR}/libcustcalc${LIB_EXT_VERSION} ${ARCH_CFLAGS}
|
||||
else
|
||||
LIBCUSTCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib \
|
||||
${ARCH_CFLAGS}
|
||||
endif
|
||||
else
|
||||
LIBCUSTCALC_SHLIB=
|
||||
endif
|
||||
#
|
||||
CC_STATIC=
|
||||
LD_STATIC= ${ARCH_CFLAGS}
|
||||
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
|
||||
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= ${ARCH_CFLAGS}
|
||||
#
|
||||
LCC= cc
|
||||
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:=
|
||||
endif
|
||||
|
||||
##################
|
||||
# FreeBSD target #
|
||||
##################
|
||||
|
||||
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}"
|
||||
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
|
||||
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
|
||||
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= gcc
|
||||
CC= ${PURIFY} ${LCC} ${CCWERR}
|
||||
#
|
||||
MAKE= gmake
|
||||
#
|
||||
endif
|
||||
|
||||
##################
|
||||
# OpenBSD target #
|
||||
##################
|
||||
|
||||
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}"
|
||||
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
|
||||
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
|
||||
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= gcc
|
||||
CC= ${PURIFY} ${LCC} ${CCWERR}
|
||||
#
|
||||
MAKE= gmake
|
||||
#
|
||||
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}"
|
||||
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
|
||||
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
|
||||
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}
|
||||
#
|
||||
endif
|
||||
|
||||
#################
|
||||
# simple target #
|
||||
#################
|
||||
|
||||
# NOTE: This is not a real host target. It is just a best
|
||||
# attempt is a generic host not otherwise found above.
|
||||
|
||||
ifeq ($(target),simple)
|
||||
#
|
||||
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}"
|
||||
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
|
||||
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
|
||||
else
|
||||
LIBCUSTCALC_SHLIB=
|
||||
endif
|
||||
#
|
||||
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}
|
||||
#
|
||||
endif
|
||||
|
||||
###########################################
|
||||
# default target - (when target is empty) #
|
||||
###########################################
|
||||
|
||||
# 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}"
|
||||
ifeq ($(ALLOW_CUSTOM),-DCUSTOM)
|
||||
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
|
||||
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= 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}
|
||||
|
||||
#######################################################################
|
||||
#-=-=-=-=-=- end of target section - only make rules below -=-=-=-=-=-#
|
||||
#######################################################################
|
@@ -27,7 +27,7 @@ If you run into problems, see the BUGS file.
|
||||
Calc is distributed with an extensive collection of help files that
|
||||
are accessible from the command line. The following assume that you
|
||||
are running calc from the distribution directory or that you have
|
||||
installed calc. In these examples, the ">" is the calc prompt, not
|
||||
installed calc. In these examples, the "; " is the calc prompt, not
|
||||
something that you type in.
|
||||
|
||||
For list of help topics:
|
||||
@@ -48,7 +48,7 @@ For list of builtin functions:
|
||||
|
||||
; help builtin
|
||||
|
||||
C programmers should note some unexpected differences in the calc syntax:
|
||||
C programmers should note some unexpected differences with the calc syntax:
|
||||
|
||||
; help unexpected
|
||||
|
||||
|
22
README.md
22
README.md
@@ -1,3 +1,25 @@
|
||||
# TL;DR Try calc
|
||||
|
||||
## TL;DR Install calc
|
||||
|
||||
```
|
||||
misc linux: sudo yum install calc
|
||||
on Debian: sudo apt install calc
|
||||
on RHEL: sudo dnf install calc
|
||||
on Ubuntu: sudo apt install calc
|
||||
via Termux: apt install calc
|
||||
via src: sudo make clobber all chk instsll
|
||||
```
|
||||
|
||||
## TL;DR Run calc
|
||||
|
||||
```
|
||||
misc shell: calc
|
||||
via bash: calc
|
||||
via misc app: launch calc via Termux
|
||||
via zsh: calc
|
||||
```
|
||||
|
||||
# What is calc?
|
||||
|
||||
Calc is an interactive calculator which provides for easy large
|
||||
|
27
cal/Makefile
27
cal/Makefile
@@ -269,19 +269,20 @@ TRUE= true
|
||||
CALC_FILES= README alg_config.cal beer.cal bernoulli.cal \
|
||||
bernpoly.cal bigprime.cal bindings brentsolve.cal chi.cal chrem.cal \
|
||||
comma.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 \
|
||||
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
|
||||
factorial.cal factorial2.cal fnv_tool.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 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 splitbits.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.
|
||||
#
|
||||
|
120
cal/README
120
cal/README
@@ -388,6 +388,13 @@ dotest.cal
|
||||
dotest("set8700.line");
|
||||
|
||||
|
||||
ellip.cal
|
||||
|
||||
efactor(iN, ia, B, force)
|
||||
|
||||
Attempt to factor using the elliptic functions: y^2 = x^3 + a*x + b.
|
||||
|
||||
|
||||
factorial.cal
|
||||
|
||||
factorial(n)
|
||||
@@ -548,12 +555,65 @@ factorial2.cal
|
||||
for information on falling factorials.
|
||||
|
||||
|
||||
ellip.cal
|
||||
fnv_util.cal
|
||||
|
||||
efactor(iN, ia, B, force)
|
||||
Utility tools for FNV hash and "FNV-style" hash operations.
|
||||
|
||||
Attempt to factor using the elliptic functions: y^2 = x^3 + a*x + b.
|
||||
These functions, if given non-standard values, will produce bogus results.
|
||||
In some cases, such as specifying the number of bits in the hash,
|
||||
using a non-power of 2 bit will produce a result that may work,
|
||||
but the hash will be only an "FNV-style" hash and not a true FNV hash.
|
||||
|
||||
find_fnv_prime(bits)
|
||||
|
||||
If bits == null(), this function will attempt to prompt stdin
|
||||
for a value and provide commends on the value of bits.
|
||||
|
||||
given:
|
||||
bits number of bits in the hash, null() ==> prompt for value
|
||||
|
||||
returns:
|
||||
0 ==> no FNV prime found
|
||||
>0 ==> FNV prime
|
||||
|
||||
deprecated_fnv0(bits, fnv_prime, string)
|
||||
|
||||
If fnv_prime == null(), this function will try to compute the FNV prime
|
||||
for a hash of size bits.
|
||||
|
||||
given:
|
||||
bits number of bits in FNV hash
|
||||
fnv_prime FNV prime, null() ==> generate suitable FNV prime if possible
|
||||
string string to hash
|
||||
|
||||
returns:
|
||||
FNV-0 hash, for size bytes, of string
|
||||
|
||||
NOTE: This function does NOT attempt to determine that fnv_prime is prime.
|
||||
|
||||
fnv_offset_basis(bits, fnv_prime)
|
||||
|
||||
given:
|
||||
bits number of bits in FNV hash
|
||||
fnv_prime FNV prime, null() ==> generate suitable FNV prime if possible
|
||||
|
||||
returns:
|
||||
FNV offset basis for a hash size of bits and an FNV prime of fnv_prime
|
||||
|
||||
NOTE: This function does NOT attempt to determine that fnv_prime is prime.
|
||||
|
||||
fnv1a_style_hash(bits, fnv_prime, prev_hash, string)
|
||||
|
||||
given:
|
||||
bits number of bits in FNV hash
|
||||
fnv_prime FNV prime, null() ==> generate suitable FNV prime if possible
|
||||
prev_hash previous hash value, null() ==> generate FNV offset basis
|
||||
string string to hash
|
||||
|
||||
returns:
|
||||
"FNV-style" hash of bits
|
||||
|
||||
NOTE: This function does NOT attempt to determine that fnv_prime is prime.
|
||||
|
||||
gvec.cal
|
||||
|
||||
@@ -1433,6 +1493,60 @@ specialfunctions.cal
|
||||
on the script zeta2.cal.
|
||||
|
||||
|
||||
splitbits.cal
|
||||
|
||||
splitbits(x, b)
|
||||
|
||||
Given an integer x, split the value into a list of integers,
|
||||
each of which is at most b bits long.
|
||||
|
||||
The value b must be an integer > 0.
|
||||
|
||||
The number of elements in the returned list is:
|
||||
|
||||
ceil((highbit(x) + 1) / b)
|
||||
|
||||
If x == 0, then a list of 1 element containing 0 is returned.
|
||||
|
||||
If x < 0, then the two's compliment of abs(x) is returned.
|
||||
Even though calc represents negative integers as positive values
|
||||
with sign bit, the bits returned by this function are as if
|
||||
the integer converted as if the integer was a two's compliment
|
||||
value. For example:
|
||||
|
||||
; L = splitbits(-1, 8);
|
||||
; print L[[0]]
|
||||
255
|
||||
|
||||
; L = splitbits(-2, 8);
|
||||
; print L[[0]]
|
||||
254
|
||||
|
||||
; L = splitbits(-3, 8);
|
||||
; print L[[0]]
|
||||
253
|
||||
|
||||
The first element of the list contains the lowest order bits
|
||||
of x. The last element of the list contains the highest number
|
||||
bits of x.
|
||||
|
||||
For example:
|
||||
|
||||
; x = 2^23209-1
|
||||
; L = splitbits(x, 16);
|
||||
; print size(L), L[[0]]
|
||||
|
||||
; print istype(2, 3i), istype(2, "2"), istype(2, null())
|
||||
0 0 0
|
||||
|
||||
; mat a[2]
|
||||
; b = list(1,2,3)
|
||||
; c = assoc()
|
||||
; obj chongo {was, here} d;
|
||||
; print istype(a,b), istype(b,c), istype(c,d)
|
||||
0 0 0
|
||||
|
||||
|
||||
statistics.cal
|
||||
|
||||
gammaincoctave(z,a)
|
||||
|
473
cal/fnv_tool.cal
Normal file
473
cal/fnv_tool.cal
Normal file
@@ -0,0 +1,473 @@
|
||||
/*
|
||||
* fnv_util - utility tools for FNV hash and "FNV-style" hash operations
|
||||
*
|
||||
* This file provides the following functions:
|
||||
*
|
||||
* find_fnv_prime(bits)
|
||||
* deprecated_fnv0(bits, fnv_prime, string)
|
||||
* fnv_offset_basis(bits, fnv_prime)
|
||||
* fnv1a_style_hash(bits, fnv_prime, prev_hash, string)
|
||||
*
|
||||
* See the individual function for details on args and return value.
|
||||
*
|
||||
* If no args are given to find_fnv_prime() and stdin is associated
|
||||
* with a tty (i.e., an interactive terminal), then bits will be
|
||||
* prompted for and commentary will be printed to stdout as well.
|
||||
*
|
||||
* If fnv_prime == null(), then an attempt to compute the FNV prime
|
||||
* for a hash if size bits is attempted..
|
||||
*
|
||||
* If prev_hash == null(), then the FNV offset basis for
|
||||
* for a hash if size bits is computed.
|
||||
*
|
||||
* For more information on the FNV hash see:
|
||||
*
|
||||
* https://en.wikipedia.org/wiki/Fowler-Noll-Vo_hash_function
|
||||
* http://www.isthe.com/chongo/tech/comp/fnv/index.html
|
||||
*
|
||||
* IMPORTANT NOTE:
|
||||
*
|
||||
* These functions, if given non-standard values, will produce bogus results.
|
||||
* In some cases, such as specifying the number of bits in the hash,
|
||||
* using a non-power of 2 bit will produce a result that may work,
|
||||
* but the hash will be only an "FNV-style" hash and not a true FNV hash.
|
||||
*
|
||||
* We say "FNV-style" because the result hash is not a "true FNV-like" hash.
|
||||
*
|
||||
* Let integer n > 0 be the number if bits in the FNV hash. Then:
|
||||
*
|
||||
* t = floor((5+n)/12)
|
||||
*
|
||||
* The FNV prime, for the given n bits is the smallest prime of the form:
|
||||
*
|
||||
* p = 256^t + 2^8 + b
|
||||
*
|
||||
* such that:
|
||||
*
|
||||
* 0 < b < 2^8
|
||||
* The number of one-bits in b must be 4 or 5
|
||||
* p mod (2^40 - 2^24 - 1) > (2^24 + 2^8 + 2^7)
|
||||
*
|
||||
* If you force n to not be a power of 2, for example:
|
||||
*
|
||||
* n = 44
|
||||
*
|
||||
* you will find that the FNV prime for 44 bits is:
|
||||
*
|
||||
* p44 = 4294967597
|
||||
* = 0x10000012d
|
||||
* = 0b100000000000000000000000100101101
|
||||
* = 2^32 + 301 = 2^32 + 2^8 + 2^5 + 2^3 + 2^2 + 2^0
|
||||
*
|
||||
* However a hash size of 44 bits is not a true FNV hash, it is only a "FNV-style" hash.
|
||||
*
|
||||
* NOTE: We disallow n <= 31 because there are no FNV primes that small.
|
||||
*
|
||||
* NOTE: For n that is a power of 2 and n > 1024, you will find that
|
||||
* that FNV primes become so rare that that one may not find a suitable
|
||||
* FNV prime. For n = powers of 2 >= 2048 and <= 1048576,
|
||||
* there is NO FNV primes.
|
||||
*
|
||||
* As for as hashing goes, large values of n, even if an
|
||||
* FNV hash may be found, are unlikely to be truly useful. :-)
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2023 by Landon Curt Noll. All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
* its documentation for any purpose and without fee is hereby granted,
|
||||
* provided that the above copyright, this permission notice and text
|
||||
* this comment, and the disclaimer below appear in all of the following:
|
||||
*
|
||||
* supporting documentation
|
||||
* source copies
|
||||
* source works derived from this source
|
||||
* binaries derived from this source or from derived source
|
||||
*
|
||||
* LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
|
||||
* EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
|
||||
* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* chongo (Landon Curt Noll, http://www.isthe.com/chongo/index.html) /\oo/\
|
||||
*
|
||||
* Share and enjoy! :-)
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* find_fnv_prime - try to find a FNV prime given the number of bits
|
||||
*
|
||||
* If bits == null(), this function will attempt to prompt stdin
|
||||
* for a value and provide commends on the value of bits.
|
||||
*
|
||||
* given:
|
||||
* bits number of bits in the hash, null() ==> prompt for value
|
||||
*
|
||||
* returns:
|
||||
* 0 ==> no FNV prime found
|
||||
* >0 ==> FNV prime
|
||||
*/
|
||||
define find_fnv_prime(bits)
|
||||
{
|
||||
local b; /* lower octet of the potential FNV prime: [1,255] */
|
||||
local p; /* value to test as an FNV prime */
|
||||
local t; /* power of 256 part of the FNV prime */
|
||||
local one_bits; /* number of 1 bits in b */
|
||||
local p_minus_b; /* potential FNV prime less b */
|
||||
local interactive; /* true ==> interactive mode and print commentary */
|
||||
|
||||
/*
|
||||
* case: no arg, prompt for bits and print commentary
|
||||
*/
|
||||
interactive = 0; /* assume non-interactive mode */
|
||||
if (isnull(bits)) {
|
||||
|
||||
/*
|
||||
* must be attached to an interactive terminal
|
||||
*/
|
||||
if (!isatty(files(0))) {
|
||||
print "# FATAL: stdin is not a tty: not attached to an interactive terminal";
|
||||
return 0;
|
||||
}
|
||||
interactive = 1; /* set interactive mode */
|
||||
|
||||
/*
|
||||
* prompt for the number of bits
|
||||
*/
|
||||
do {
|
||||
local strscanf_ret; /* return from strscanf_ret */
|
||||
local input; /* value read after prompt */
|
||||
|
||||
/*
|
||||
* prompt and obtain the input
|
||||
*/
|
||||
input = prompt("Enter hash size in bits: ");
|
||||
strscanf_ret = strscanf(input, "%i", bits);
|
||||
print "input =", input;
|
||||
print "bits =", bits;
|
||||
if (!isint(bits) || bits <= 0) {
|
||||
print;
|
||||
print "# NOTE: must enter a integer > 0, try again";
|
||||
print;
|
||||
}
|
||||
} while (!isint(bits) || bits <= 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* firewall - bits must be non-negative integer
|
||||
*/
|
||||
if (!isint(bits) || bits < 0) {
|
||||
if (interactive) {
|
||||
print "# FATAL: bits must be non-negative integer";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* provide commentary on the choice of bits if we are interactive
|
||||
*/
|
||||
if (interactive) {
|
||||
if (popcnt(bits) == 1) {
|
||||
if (bits > 1024) {
|
||||
print "# WARNING: FNV primes for bit size powers of 2 > 1024 are extremely rare.";
|
||||
print "# WARNING: There are no FNV primes for bit size powers of 2 >= 2048 and <= 1048576.";
|
||||
}
|
||||
print "n =", bits;
|
||||
} else {
|
||||
if (bits < 32) {
|
||||
print "# WARNING: bits < 32 is not recommended because there isn't enough bits to be worth hashing";
|
||||
}
|
||||
print "# WARNING: because bits is not a power of 2, we can only form an \"FNV-style hash\": not a true FNV hash.";
|
||||
print "# WARNING: A \"FNV-style hash\" may not have the desired hash properties of a true FNV hash.";
|
||||
print "n =", bits;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* search setup
|
||||
*/
|
||||
t = floor((5+bits)/12);
|
||||
p_minus_b = 256^t + 2^8;
|
||||
|
||||
/*
|
||||
* search for a b that forms a suitable FNV prime
|
||||
*/
|
||||
for (b=1; b < 256; ++b) {
|
||||
|
||||
/*
|
||||
* reject b unless the of one-bits in bottom octet of p is 4 or 5
|
||||
*/
|
||||
one_bits = popcnt(b);
|
||||
if (one_bits != 4 && one_bits != 5) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* reject p if p mod (2^40 - 2^24 - 1) <= (2^24 + 2^8 + 2^7)
|
||||
*/
|
||||
p = p_minus_b + b;
|
||||
if ((p % (2^40 - 2^24 - 1)) <= (2^24 + 2^8 + 2^7)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* accept potential p value that is prime
|
||||
*/
|
||||
if (ptest(p) == 1) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* case: did not find an FNV prime
|
||||
*/
|
||||
if (b >= 256) {
|
||||
|
||||
/*
|
||||
* examine results if interactive
|
||||
*/
|
||||
if (interactive) {
|
||||
print "# FATAL: There is no a suitable FNV prime for bits =", bits;
|
||||
quit "find_fnv_prime: FATAL: FNV prime search failed";
|
||||
}
|
||||
|
||||
/*
|
||||
* return 0 to indicate no FNV prime found
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* provide FNV commentary if interactive
|
||||
*/
|
||||
if (interactive) {
|
||||
print "t =", t;
|
||||
print "b =", b;
|
||||
print "# NOTE: p = 256^":t, "+ 2^8 +", b;
|
||||
print;
|
||||
print "p =", p;
|
||||
}
|
||||
|
||||
/*
|
||||
* return FNV prime
|
||||
*/
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* deprecated_fnv0 - FNV-0 hash that should only be used to generate an FNV offset basis
|
||||
*
|
||||
* If fnv_prime == null(), this function will try to compute the FNV prime
|
||||
* for a hash of size bits.
|
||||
*
|
||||
* given:
|
||||
* bits number of bits in FNV hash
|
||||
* fnv_prime FNV prime, null() ==> generate suitable FNV prime if possible
|
||||
* string string to hash
|
||||
*
|
||||
* returns:
|
||||
* FNV-0 hash, for size bytes, of string
|
||||
*
|
||||
* NOTE: This function does NOT attempt to determine that fnv_prime is prime.
|
||||
*/
|
||||
define deprecated_fnv0(bits, fnv_prime, string)
|
||||
{
|
||||
local hash; /* FNV hash value */
|
||||
local len; /* length of string */
|
||||
local base; /* base of FNV hash: 2^bits */
|
||||
local i;
|
||||
|
||||
/*
|
||||
* firewall
|
||||
*/
|
||||
if (!isint(bits) || bits <= 0) {
|
||||
quit "deprecated_fnv0: FATAL: bits arg must be an integer > 0";
|
||||
}
|
||||
if (!isstr(string)) {
|
||||
quit "deprecated_fnv0: FATAL: string arg must be a string";
|
||||
}
|
||||
|
||||
/*
|
||||
* fnv_prime == null() means to try and generate the FNV prime
|
||||
*/
|
||||
if (isnull(fnv_prime)) {
|
||||
/* try to generate an FNV prime */
|
||||
fnv_prime = find_fnv_prime(bits);
|
||||
if (fnv_prime == 0) {
|
||||
quit "deprecated_fnv0: FATAL: no FNV prime exists for the given hash size in bits";
|
||||
}
|
||||
}
|
||||
if (!isint(fnv_prime) || fnv_prime <= 0) {
|
||||
quit "deprecated_fnv0: FATAL: fnv_prime arg must be an integer > 0 and should be prime";
|
||||
}
|
||||
|
||||
/*
|
||||
* FNV-0 hash each character
|
||||
*/
|
||||
len = strlen(string);
|
||||
base = 2^bits;
|
||||
hash = 0;
|
||||
for (i=0; i < len; ++i) {
|
||||
hash = xor((hash * fnv_prime) % base, ord(string[i]));
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* fnv_offset_basis - generate and FNV offset basis
|
||||
*
|
||||
* given:
|
||||
* bits number of bits in FNV hash
|
||||
* fnv_prime FNV prime, null() ==> generate suitable FNV prime if possible
|
||||
*
|
||||
* returns:
|
||||
* FNV offset basis for a hash size of bits and an FNV prime of fnv_prime
|
||||
*
|
||||
* NOTE: This function does NOT attempt to determine that fnv_prime is prime.
|
||||
*/
|
||||
define
|
||||
fnv_offset_basis(bits, fnv_prime)
|
||||
{
|
||||
local fnv0_hash = 0; /* FNV-0 hash value */
|
||||
|
||||
/* string to generate a FNV offset basis - do not change this value */
|
||||
static chongo_was_here = "chongo <Landon Curt Noll> /\\../\\";
|
||||
|
||||
/*
|
||||
* firewall
|
||||
*/
|
||||
if (!isint(bits) || bits <= 0) {
|
||||
quit "fnv_offset_basis: FATAL: bits arg must be an integer > 0";
|
||||
}
|
||||
|
||||
/*
|
||||
* fnv_prime == null() means to try and generate the FNV prime
|
||||
*/
|
||||
if (isnull(fnv_prime)) {
|
||||
/* try to generate an FNV prime */
|
||||
fnv_prime = find_fnv_prime(bits);
|
||||
if (fnv_prime == 0) {
|
||||
quit "fnv_offset_basis: FATAL: no FNV prime exists for the given hash size in bits";
|
||||
}
|
||||
}
|
||||
if (!isint(fnv_prime) || fnv_prime <= 0) {
|
||||
quit "fnv_offset_basis: FATAL: fnv_prime arg must be an integer > 0 and should be prime";
|
||||
}
|
||||
|
||||
/*
|
||||
* return the FNV-0 hash of fnv_offset_basis as the FNV offset basis
|
||||
*/
|
||||
fnv0_hash = deprecated_fnv0(bits, fnv_prime, chongo_was_here);
|
||||
return fnv0_hash;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* fnv_style_hash - compute an "FNV-1a-style" hash
|
||||
*
|
||||
* These functions, if given non-standard values, will produce bogus results.
|
||||
* To produce a true FNV-1a hash:
|
||||
*
|
||||
* bits must be a power of 2
|
||||
* 32 <= bits
|
||||
* fnv_prime == find_fnv_prime(bits) OR fnv_prime == null()
|
||||
* prev_hash == previous FNV hash OR prev_hash == null()
|
||||
*
|
||||
* If fnv_prime == null(), this function will try to compute the FNV prime
|
||||
* for a hash of size bits.
|
||||
*
|
||||
* If prev_hash == null(), this function will try to compute the FNV offset basis
|
||||
* for a hash of size bits.
|
||||
*
|
||||
* One may chain "FNV-style" hashes by replacing the offset_basis with
|
||||
* the hash state of the previous hash. For the first hash:
|
||||
*
|
||||
* fnv_prime = find_fnv_prime(bits)
|
||||
* hash_val = fnv_style_hash(bits, fnv_prime, null(), string_a);
|
||||
*
|
||||
* then:
|
||||
*
|
||||
* hash_val = fnv_style_hash(bits, fnv_prime, hash_val, string_b);
|
||||
*
|
||||
* This will produce the same as the string_a concatenated with string_b:
|
||||
*
|
||||
* hash_val = fnv_style_hash(bits, null(), null(), string_a + string_b);
|
||||
*
|
||||
* NOTE: Because string_a and string_b are strings, the expression:
|
||||
*
|
||||
* string_a + string_b
|
||||
*
|
||||
* is string_a concatenated with string_b.
|
||||
*
|
||||
* given:
|
||||
* bits number of bits in FNV hash
|
||||
* fnv_prime FNV prime, null() ==> generate suitable FNV prime if possible
|
||||
* prev_hash previous hash value, null() ==> generate FNV offset basis
|
||||
* string string to hash
|
||||
*
|
||||
* returns:
|
||||
* "FNV-style" hash of bits
|
||||
*
|
||||
* NOTE: This function does NOT attempt to determine that fnv_prime is prime.
|
||||
*/
|
||||
define
|
||||
fnv1a_style_hash(bits, fnv_prime, prev_hash, string)
|
||||
{
|
||||
local hash = 0; /* FNV hash value */
|
||||
local len; /* length of string */
|
||||
local base; /* base of FNV hash: 2^bits */
|
||||
local i;
|
||||
|
||||
/*
|
||||
* firewall
|
||||
*/
|
||||
if (!isint(bits) || bits <= 0) {
|
||||
quit "fnv1a_style_hash: FATAL: bits arg must be an integer > 0";
|
||||
}
|
||||
if (!isstr(string)) {
|
||||
quit "fnv1a_style_hash: FATAL: string arg must be a string";
|
||||
}
|
||||
|
||||
/*
|
||||
* fnv_prime == null() means to try and generate the FNV prime
|
||||
*/
|
||||
if (isnull(fnv_prime)) {
|
||||
/* try to generate an FNV prime */
|
||||
fnv_prime = find_fnv_prime(bits);
|
||||
if (fnv_prime == 0) {
|
||||
quit "fnv1a_style_hash: FATAL: no FNV prime exists for the given hash size in bits";
|
||||
}
|
||||
}
|
||||
if (!isint(fnv_prime) || fnv_prime <= 0) {
|
||||
quit "fnv1a_style_hash: FATAL: fnv_prime arg must be an integer > 0 and should be prime";
|
||||
}
|
||||
|
||||
/*
|
||||
* prev_hash == null() means to generate the FNV offset basis
|
||||
*/
|
||||
if (isnull(prev_hash)) {
|
||||
|
||||
/* generate the FNV offset basis for a hash of size bits */
|
||||
prev_hash = fnv_offset_basis(bits, fnv_prime);
|
||||
}
|
||||
if (!isint(prev_hash) || prev_hash < 0) {
|
||||
quit "fnv1a_style_hash: FATAL: prev_hash arg must be an integer => 0";
|
||||
}
|
||||
|
||||
/*
|
||||
* FNV-1a hash each character
|
||||
*/
|
||||
len = strlen(string);
|
||||
base = 2^bits;
|
||||
hash = prev_hash;
|
||||
for (i=0; i < len; ++i) {
|
||||
hash = xor((hash * fnv_prime) % base, ord(string[i]));
|
||||
}
|
||||
return hash;
|
||||
}
|
83
cal/splitbits.cal
Normal file
83
cal/splitbits.cal
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* splitbits - split an integer into list on bit boundardies of a fixed size
|
||||
*
|
||||
* Copyright (C) 2018,2023 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: 2006/06/07 14:10:11
|
||||
* File existed as early as: 2006
|
||||
*
|
||||
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* setup splitbits errors
|
||||
*/
|
||||
static E_SPLITBITS_1, E_SPLITBITS_2, E_SPLITBITS_3;
|
||||
if (! iserror(E_SPLITBITS_1)) E_SPLITBITS_1 = newerror("1st argument to splitbits must be an integer");
|
||||
if (! iserror(E_SPLITBITS_2)) E_SPLITBITS_2 = newerror("2nd argument to splitbits must be an integer");
|
||||
if (! iserror(E_SPLITBITS_3)) E_SPLITBITS_3 = newerror("2nd argument must be an integer > 0");
|
||||
|
||||
|
||||
/*
|
||||
* define splitbits function
|
||||
*/
|
||||
define splitbits(x, b)
|
||||
{
|
||||
local ret; /* list to return */
|
||||
local mask; /* 2^b-1 */
|
||||
local x_is_reg = 0; /* true if x < 0 */
|
||||
|
||||
/* firewall */
|
||||
if (! isint(x)) {
|
||||
return error(E_SPLITBITS_1);
|
||||
}
|
||||
if (! isint(b)) {
|
||||
return error(E_SPLITBITS_2);
|
||||
}
|
||||
if (b <= 0) {
|
||||
return error(E_SPLITBITS_3);
|
||||
}
|
||||
|
||||
/* special case: x == 0 */
|
||||
if (x == 0) {
|
||||
return list(0);
|
||||
}
|
||||
|
||||
/* setup for splitting x */
|
||||
ret = list();
|
||||
mask = 2^b-1;
|
||||
if (x < 0) {
|
||||
x_is_reg = 1;
|
||||
x = abs(x);
|
||||
}
|
||||
|
||||
/* split x */
|
||||
while (x > 0) {
|
||||
printf("%d %x\n", size(ret), x);
|
||||
if (x_is_reg) {
|
||||
append(ret, xor(x & mask, mask));
|
||||
} else {
|
||||
append(ret, x & mask);
|
||||
}
|
||||
x >>= b;
|
||||
}
|
||||
|
||||
/* return list */
|
||||
return ret;
|
||||
}
|
4
custom.h
4
custom.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* custom - interface for custom software and hardware interfaces
|
||||
*
|
||||
* Copyright (C) 1999-2007,2021 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007,2021,2023 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
/*
|
||||
* Be careful what you put in this file, upper .c files include
|
||||
* this file even when CUSTOM is not defined (ALLOW_CUSTOM is empty).
|
||||
* this file even when CUSTOM is not defined (ALLOW_CUSTOM="-UCUSTOM").
|
||||
*
|
||||
* Don't include anything, let the including .c file bring in:
|
||||
*
|
||||
|
@@ -19,6 +19,10 @@ must be invoked with a -C argument:
|
||||
|
||||
when it is run.
|
||||
|
||||
To disable custom even if -C is given, calc must be built with:
|
||||
|
||||
ALLOW_CUSTOM="-UCUSTOM"
|
||||
|
||||
See the ../cal/README or "help resource" for information about
|
||||
calc resource standards and guidelines.
|
||||
|
||||
@@ -41,7 +45,7 @@ pzasusb8.cal
|
||||
Run custom("pzasusb8") on a standard set of data, print Endian
|
||||
related information and print value size information.
|
||||
|
||||
## Copyright (C) 1999,2021 Landon Curt Noll
|
||||
## Copyright (C) 1999,2021,2023 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
|
||||
|
@@ -168,8 +168,7 @@ Step 5: Write your custom function
|
||||
#endif /* CUSTOM */
|
||||
|
||||
This allows this code to 'go away' when the upper Makefile
|
||||
disables the custom code (because ALLOW_CUSTOM no longer
|
||||
has the -DCUSTOM define).
|
||||
disables the custom code when CUSTOM is not defined.
|
||||
|
||||
b) The function type must be:
|
||||
|
||||
|
141
custom/Makefile
141
custom/Makefile
@@ -55,12 +55,20 @@
|
||||
#
|
||||
SHELL= bash
|
||||
#SHELL= sh
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
|
||||
# Darwin shell default
|
||||
#
|
||||
ifeq ($(target),Darwin)
|
||||
SHELL:= /bin/sh
|
||||
endif
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
endif # ($(target),Darwin)
|
||||
|
||||
# If you are using Cygwin with MinGW64 packages
|
||||
# then we will also need to use the Cygwin runtime enviroment
|
||||
# and the calc Cygwin make target.
|
||||
##
|
||||
ifeq ($(OSNAME),Cygwin)
|
||||
target:= Cygwin
|
||||
endif # ($(OSNAME),Cygwin)
|
||||
|
||||
|
||||
# PREFIX - Top level location for calc
|
||||
@@ -130,13 +138,13 @@ CCBAN= -UUNBAN
|
||||
#CCBAN= -DUNBAN
|
||||
|
||||
|
||||
#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.
|
||||
# We do not support parallel make of calc. We have found most
|
||||
# parallel make systems do not get the rule dependency order
|
||||
# correct, resulting in a failed attempt to compile calc.
|
||||
#
|
||||
# XXX - fix this - XXX
|
||||
# If you believe you have a way to get a parallel make of calc
|
||||
# to work, consider submitting a pull request with a
|
||||
# proposed change.
|
||||
#
|
||||
.NOTPARALLEL:
|
||||
|
||||
@@ -152,8 +160,16 @@ CCBAN= -UUNBAN
|
||||
#
|
||||
ifeq ($(target),)
|
||||
target=$(shell uname -s 2>/dev/null)
|
||||
endif
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
endif # ($(target),)
|
||||
ifeq ($(arch),)
|
||||
arch=$(shell uname -p 2>/dev/null)
|
||||
endif # ($(arch),)
|
||||
ifeq ($(hardware),)
|
||||
hardware=$(shell uname -m 2>/dev/null)
|
||||
endif # ($(hardware),)
|
||||
ifeq ($(OSNAME),)
|
||||
OSNAME=$(shell uname -o 2>/dev/null)
|
||||
endif # ($(OSNAME),)
|
||||
|
||||
# The custom calc resource files to install
|
||||
#
|
||||
@@ -453,12 +469,13 @@ CALC_ENV= CALCPATH=./cal
|
||||
# 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
|
||||
# ALLOW_CUSTOM= -UCUSTOM # disable custom even if -C is given
|
||||
#
|
||||
# If in doubt, use ALLOW_CUSTOM= -DCUSTOM
|
||||
#
|
||||
ALLOW_CUSTOM= -DCUSTOM
|
||||
#ALLOW_CUSTOM=
|
||||
#ALLOW_CUSTOM= -UCUSTOM
|
||||
|
||||
|
||||
# Some out of date operating systems require / want an executable to
|
||||
# end with a certain file extension. Some compile systems such as
|
||||
@@ -475,7 +492,7 @@ EXT=
|
||||
|
||||
# The default calc versions
|
||||
#
|
||||
VERSION= 2.14.1.6
|
||||
VERSION= 2.14.3.1
|
||||
|
||||
# Names of shared libraries with versions
|
||||
#
|
||||
@@ -539,8 +556,6 @@ 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
|
||||
@@ -550,9 +565,9 @@ COMMON_LDFLAGS= ${EXTRA_LDFLAGS}
|
||||
#
|
||||
ifeq ($(BLD_TYPE),calc-static-only)
|
||||
ICFLAGS= ${COMMON_CFLAGS} ${CCBAN} ${CC_STATIC}
|
||||
else
|
||||
else # ($(BLD_TYPE),calc-static-only)
|
||||
ICFLAGS= ${COMMON_CFLAGS} ${CCBAN} ${CC_SHARE}
|
||||
endif
|
||||
endif # ($(BLD_TYPE),calc-static-only)
|
||||
CFLAGS= ${ICFLAGS} ${CCOPT}
|
||||
|
||||
# Required flags to link files for calc
|
||||
@@ -563,23 +578,15 @@ CFLAGS= ${ICFLAGS} ${CCOPT}
|
||||
ILDFLAGS= ${COMMON_LDFLAGS}
|
||||
LDFLAGS= ${LD_DEBUG} ${ILDFLAGS}
|
||||
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
|
||||
##########################################################################
|
||||
#=-=-=-=-=- 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 */
|
||||
###
|
||||
# Host targets that are shared in common with both Makefile
|
||||
# and custom/Makefile (if ALLOW_CUSTOM is -DCUSTOM).
|
||||
#
|
||||
# Allow Makefile.local to override any of the above settings
|
||||
#
|
||||
###
|
||||
EXCLUDE_FROM_CUSTOM_MAKEFILE=true # include only middle of ../Makefile
|
||||
include ../Makefile
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
# include end from top Makefile - keep this line
|
||||
TARGET_MKF= ../Makefile.target
|
||||
include ${TARGET_MKF}
|
||||
|
||||
# These .c files are required for the main custom interface and
|
||||
# for the custom support functions for libcustcalc${LIB_EXT_VERSION}.
|
||||
@@ -621,7 +628,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 Makefile Makefile.simple
|
||||
${INSTALL_H_SRC} CUSTOM_CAL HOW_TO_ADD Makefile
|
||||
|
||||
# These files are used to make (but not built) a calc .a link library
|
||||
#
|
||||
@@ -637,7 +644,7 @@ CALC_STATIC_LIBCUSTCALC= libcustcalc.a
|
||||
|
||||
# complete list of targets
|
||||
#
|
||||
TARGETS= ${BLD_TYPE} Makefile.simple
|
||||
TARGETS= ${BLD_TYPE}
|
||||
|
||||
###
|
||||
#
|
||||
@@ -721,72 +728,8 @@ calcliblist: ${CALCLIBLIST}
|
||||
fi; \
|
||||
done
|
||||
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
Makefile.simple: Makefile ../Makefile
|
||||
${V} echo '=-=-=-=-= custom/${MAKE_FILE} start of $@ rule =-=-=-=-='
|
||||
${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}' \
|
||||
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 */
|
||||
Makefile.simple:
|
||||
${Q} echo Support for custom/$@ was dropped after the the release of calc v2.14.3.0.
|
||||
|
||||
##
|
||||
#
|
||||
@@ -1079,7 +1022,7 @@ install: all
|
||||
${RM} -f ${T}${CUSTOMCALDIR}/libcustcalc.a; \
|
||||
echo "removed old ${T}${CUSTOMCALDIR}/libcustcalc.a"; \
|
||||
fi
|
||||
-${Q} if [ ! -z ${ALLOW_CUSTOM} ]; then \
|
||||
-${Q} if [ X"${ALLOW_CUSTOM}" = "X-DCUSTOM" ]; then \
|
||||
if [ -f libcustcalc.a ]; then \
|
||||
if ${CMP} -s libcustcalc.a ${T}${LIBDIR}/libcustcalc.a; then \
|
||||
${TRUE}; \
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* fposval - Determine information about the file position type
|
||||
*
|
||||
* Copyright (C) 1999,2021 Landon Curt Noll
|
||||
* Copyright (C) 1999,2021,2023 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
|
||||
@@ -72,6 +72,7 @@
|
||||
#include "alloc.h"
|
||||
#include "have_unused.h"
|
||||
#include "have_memmv.h"
|
||||
#include "zmath.h"
|
||||
|
||||
|
||||
#include "banned.h" /* include after system header <> includes */
|
||||
|
@@ -832,7 +832,7 @@ DESCRIPTION
|
||||
Returns TRUE if you calc was compiled with -DCUSTOM. By default,
|
||||
the calc Makefile uses ALLOW_CUSTOM= -DCUSTOM so by default
|
||||
config("compile_custom") is TRUE. If, however, calc is compiled
|
||||
without -DCUSTOM, then config("compile_custom") will be FALSE.
|
||||
with ALLOW_CUSTOM="-UCUSTOM", then config("compile_custom") will be FALSE.
|
||||
|
||||
The config("compile_custom") value is only affected by compile
|
||||
flags. The calc -D runtime command line option does not change
|
||||
@@ -1042,7 +1042,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
custom, custom_cal, display, epsilon, fprintf, printf, strprintf, usage
|
||||
|
||||
## Copyright (C) 1999-2007,2018,2021 Landon Curt Noll
|
||||
## Copyright (C) 1999-2007,2018,2021,2023 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
|
||||
|
@@ -68,7 +68,8 @@ DESCRIPTION
|
||||
help contrib
|
||||
|
||||
EXAMPLE
|
||||
If calc compiled with ALLOW_CUSTOM= (custom disabled):
|
||||
If calc compiled with ALLOW_CUSTOM="-UCUSTOM", the custom system
|
||||
is disabled, even when -C is used on the command line:
|
||||
|
||||
; print custom("sysinfo", "baseb")
|
||||
Calc was built with custom functions disabled
|
||||
@@ -94,7 +95,7 @@ LINK LIBRARY
|
||||
SEE ALSO
|
||||
custom_cal, new_custom, contrib
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
## Copyright (C) 1999,2023 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
|
||||
|
@@ -101,11 +101,11 @@ Low priority items:
|
||||
|
||||
Calc bug reports and calc bug fixes should be sent to:
|
||||
|
||||
calc-bug-report at asthe dot com
|
||||
NOTE: calc-bug-report Email address no longer in use
|
||||
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
|
||||
This replaces the old calc-bugs at asthe dot com address.
|
||||
This replaces the old calc-bugs Email address.
|
||||
|
||||
To be sure we see your Email reporting a calc bug, please use the
|
||||
following phase in your Email Subject line:
|
||||
|
@@ -187,11 +187,11 @@ Please read CONTRIB-CODE or run the following calc command:
|
||||
|
||||
Calc bug reports and calc bug fixes should be sent to:
|
||||
|
||||
calc-bug-report at asthe dot com
|
||||
NOTE: calc-bug-report Email address no longer in use
|
||||
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
|
||||
This replaces the old calc-bugs at asthe dot com address.
|
||||
This replaces the old calc-bugs Email address.
|
||||
|
||||
To be sure we see your Email reporting a calc bug, please use the
|
||||
following phase in your Email Subject line:
|
||||
|
@@ -83,8 +83,8 @@ static char *program;
|
||||
*/
|
||||
#define MAJOR_VER 2 /* major library version */
|
||||
#define MINOR_VER 14 /* minor library version */
|
||||
#define MAJOR_PATCH 1 /* major software version level */
|
||||
#define MINOR_PATCH 6 /* minor software version level */
|
||||
#define MAJOR_PATCH 3 /* major software version level */
|
||||
#define MINOR_PATCH 1 /* minor software version level */
|
||||
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user