mirror of
https://github.com/lcn2/calc.git
synced 2025-08-22 01:23:28 +03:00
Compare commits
24 Commits
prod-2.14.
...
v2.14.2.0
Author | SHA1 | Date | |
---|---|---|---|
|
3ec7b39366 | ||
|
49c599aec9 | ||
|
a582511002 | ||
|
e05d904821 | ||
|
ccd579ecda | ||
|
15be1dec4d | ||
|
f34c659877 | ||
|
2ad27e7909 | ||
|
a4d3c8ff9d | ||
|
bd64a6cc36 | ||
|
e2b2976d18 | ||
|
3ea51ea937 | ||
|
5fa732b869 | ||
|
6a54caf1c2 | ||
|
cce930987b | ||
|
7c806f13ea | ||
|
616bcd8d46 | ||
|
36a1a042f3 | ||
|
75159fcbc2 | ||
|
8ef7b5311e | ||
|
d5a11b3df4 | ||
|
74c299ad4e | ||
|
d89ea78104 | ||
|
644b348bcb |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -6,6 +6,7 @@
|
||||
#
|
||||
.dynamic
|
||||
.hsrc
|
||||
Makefile.our
|
||||
NOTES
|
||||
align32.h
|
||||
args.h
|
||||
@@ -49,12 +50,16 @@ have_newstr.h
|
||||
have_offscl.h
|
||||
have_posscl.h
|
||||
have_rusage.h
|
||||
have_statfs.h
|
||||
have_stdlib.h
|
||||
have_stdvs
|
||||
have_strdup.h
|
||||
have_string.h
|
||||
have_strlcat.h
|
||||
have_strlcpy.h
|
||||
have_sys_mount.h
|
||||
have_sys_param.h
|
||||
have_sys_vfs.h
|
||||
have_times.h
|
||||
have_uid_t.h
|
||||
have_unistd.h
|
||||
@@ -93,7 +98,6 @@ libcalc*
|
||||
libcustcalc*
|
||||
longbits
|
||||
longbits.h
|
||||
Makefile.our
|
||||
sample_many
|
||||
sample_rand
|
||||
tags
|
||||
|
61
BUGS
61
BUGS
@@ -28,7 +28,7 @@ Click in the triangle to open up the Assets then click on
|
||||
the approptiate package to download.
|
||||
|
||||
If you made and modifications to calc beyond the simple Makefile
|
||||
configuration, try backing those changges out and see if things get
|
||||
configuration, try backing those changes out and see if things get
|
||||
better.
|
||||
|
||||
If you have tried all of the above and things still are not right,
|
||||
@@ -60,44 +60,7 @@ GitHub web page, click on this button:
|
||||
|
||||
((New Issue))
|
||||
|
||||
=-=
|
||||
|
||||
If you prefer to not use GitHub, then you
|
||||
may send bug and bug fixes reports to:
|
||||
|
||||
calc-bugrept-mail at asthe dot com
|
||||
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
|
||||
NOTE: This replaces the old calc-bugs at asthe dot com address.
|
||||
|
||||
PLEASE put following the SPECIAL PHRASE somewhere in your Email Subject line:
|
||||
|
||||
calc bug report
|
||||
|
||||
You may add additional words to your subject line.
|
||||
|
||||
Suggestion:
|
||||
|
||||
From time to time, the Email address and Subject SPECIAL PHRASE
|
||||
may change so verify you have the current info by visiting:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/calc-bugrept.html
|
||||
|
||||
IMPORTANT:
|
||||
|
||||
PLEASE use the above SPECIAL PHRASE somewhere in the Subject line or
|
||||
the mail system won't deliver your Email message.
|
||||
|
||||
Keep in mind that the best way to report on a calc bug is
|
||||
via the above mentioned calc GitHub issue URL.
|
||||
|
||||
Please be patient as we cannot always respond to Email messages quickly.
|
||||
|
||||
=-=
|
||||
|
||||
When you send your report, via the calc GitHub issue URL or Email,
|
||||
please include the following information:
|
||||
Please include the following information in the new issue:
|
||||
|
||||
* A description of the problem
|
||||
|
||||
@@ -123,12 +86,13 @@ please include the following information:
|
||||
* If calc dumped core, try to send us a core dump stack trace
|
||||
|
||||
* cd to the calc source directory, and send the contents
|
||||
of debug.out produced by this command:
|
||||
of debug.out.txt produced by this command:
|
||||
|
||||
make debug > debug.out 2>&1
|
||||
make debug > debug.out.txt 2>&1
|
||||
|
||||
Fell free to use the above address to send in bug fixes (in the form
|
||||
of a context diff patch).
|
||||
PLEASE attach the debug.out.txt file to your GitHub issue (bug report)!!
|
||||
|
||||
Please be patient as we cannot always respond to pull requests quickly.
|
||||
|
||||
=-=
|
||||
|
||||
@@ -192,9 +156,18 @@ mis-features in calc:
|
||||
|
||||
will not.
|
||||
|
||||
* The numerator is assumed
|
||||
|
||||
The numerator value of 1 appears to be assumed. In calc:
|
||||
|
||||
/ 2
|
||||
|
||||
will produce a value of 0.5 as if the numerator 1 was given.
|
||||
|
||||
|
||||
=-=
|
||||
|
||||
## Copyright (C) 1999-2014,2021 Landon Curt Noll
|
||||
## Copyright (C) 1999-2014,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
|
||||
|
131
CHANGES
131
CHANGES
@@ -1,4 +1,60 @@
|
||||
The following are the changes from calc version 2.14.2.3 to date:
|
||||
The following are the changes from calc version 2.14.2.0 to date:
|
||||
|
||||
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.
|
||||
|
||||
Rename MINGW Makefile variable (a holdover from MINGW32_NT-5.0)
|
||||
to OSNAME.
|
||||
|
||||
Fixed FUNCPTR typedef in hist.c to fix deprecated compiler warnings.
|
||||
|
||||
Fixed when USE_READLINE, READLINE_LIB, READLINE_EXTRAS, and
|
||||
READLINE_INCLUDE are set to empty (disable use of the GNU-readline
|
||||
facility).
|
||||
|
||||
Fix cases of spaces before tabs in Makefile and Makefile.simple.
|
||||
|
||||
Fixed obsolete references to the atoz() in LIBRARY to use the
|
||||
correct internal function name of str2z().
|
||||
|
||||
Fixed obsolete references to the atoq() in LIBRARY to use the
|
||||
correct internal function name of str2q().
|
||||
|
||||
Document in help/unexpected that * operator has has a higher
|
||||
precedence than << in calc, which differs from C. Thanks
|
||||
goes to GitHub user @inguin for pointing put this difference.
|
||||
|
||||
|
||||
The following are the changes from calc version 2.14.1.3 to 2.14.1.4:
|
||||
|
||||
Fixed missing <string.h include in have_fpos_pos.c.
|
||||
|
||||
@@ -6,8 +62,79 @@ The following are the changes from calc version 2.14.2.3 to date:
|
||||
build calc RPMs on a reference RHEL8.7 platform (formerly a RHEL7.9
|
||||
platform).
|
||||
|
||||
Changes #! lines in Makefiles to "#!/usr/bin/env make".
|
||||
|
||||
The following are the changes from calc version 2.14.2.0 to 2.14.1.2:
|
||||
Set SHELL in Makefiles to the basename of the shell.
|
||||
|
||||
Updated COPYING file to indicate that these files are now
|
||||
covered under "The Unlicense" (see https://unlicense.org):
|
||||
|
||||
sha1.c
|
||||
sha1.h
|
||||
cal/dotest.cal
|
||||
cal/screen.cal
|
||||
|
||||
Updated help/credit to match the above changes to COPYING.
|
||||
|
||||
Updated CONTRIB-CODE and calc.man to refer to using GitHub pull requests
|
||||
for contributing to calc (instead of using Email).
|
||||
|
||||
Updated BUGS and calc.man to refer to using GitHub issues
|
||||
for reporting calc bugs (instead of using Email).
|
||||
|
||||
Updated QUESTIONS and calc.man to refer to using GitHub issues
|
||||
for asking calc questions (instead of using Email).
|
||||
|
||||
Fixed Makefile.local command example to refer to overriding the
|
||||
Makefile variable DEBUG (instead of CDEBUG).
|
||||
|
||||
Fixed all make chk ASAN warnings under macOS 13.2.1 when calc is compiled
|
||||
with the following uncommented lines in Makefile.local:
|
||||
|
||||
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
|
||||
|
||||
Improved how pointers to functions are declared for the builtins
|
||||
array in func.c to avoid function declarations without a prototype
|
||||
that is now deprecated in C.
|
||||
|
||||
Improved how pointers to functions are declared for the opcodes
|
||||
array in opcodes.c to avoid function declarations without a prototype
|
||||
|
||||
Replaced use of egrep with grep -E in Makefiles.
|
||||
|
||||
Fixed cases where variables were set but not used in symbol.c, calc.c,
|
||||
and the main function in func.c as used by funclist.c.
|
||||
|
||||
Added rule name to "DO NOT EDIT -- generated by the Makefile" lines
|
||||
in constructed files.
|
||||
|
||||
Test if <sys/vfs.h> exists and set HAVE_SYS_VFS_H accordingly
|
||||
in have_sys_vfs.h. Added HAVE_SYS_VFS_H to allow one to force
|
||||
this value.
|
||||
|
||||
Test if <sys/param.h> exists and set HAVE_SYS_PARAM_H accordingly
|
||||
in have_sys_param.h. Added HAVE_SYS_PARAM_H to allow one to force
|
||||
this value.
|
||||
|
||||
Test if <sys/mount.h> exists and set HAVE_SYS_MOUNT_H accordingly
|
||||
in have_sys_mount.h. Added HAVE_SYS_MOUNT_H to allow one to force
|
||||
this value.
|
||||
|
||||
Test if the system as the statfs() system call and set HAVE_STATFS
|
||||
accordingly in have_statfs.h. Added HAVE_STATFS to allow one
|
||||
to force this value.
|
||||
|
||||
The pseudo_seed() function will also try to call statfs() if
|
||||
possible and permitted by the HAVE_STATFS value.
|
||||
|
||||
Test if makedepend command is available before trying to build
|
||||
the Makefile dependency list via "make depend".
|
||||
|
||||
|
||||
The following are the changes from calc version 2.14.1.0 to 2.14.1.2:
|
||||
|
||||
Attempted to address a paranoid compiler warning -Wmaybe-uninitialized
|
||||
in swap_HALF_in_ZVALUE() where the gcc compiler seems to ignore the
|
||||
|
72
CONTRIB-CODE
72
CONTRIB-CODE
@@ -1,73 +1,37 @@
|
||||
Calc is open source. Contributions of code are welcome.
|
||||
|
||||
We welcome and encourage you to send us:
|
||||
In order to consider integrating your contributions, we need:
|
||||
|
||||
* calc resource files (cal/*.cal files)
|
||||
* calc shell scripts (cscript/*.calc files)
|
||||
* builtin functions that you have modified or written, i.e.:
|
||||
assocfunc.c comfunc.c func.c func.h
|
||||
listfunc.c matfunc.c qfunc.c zfunc.c
|
||||
* custom functions that you have modified or written
|
||||
* help files modified or written (help/*)
|
||||
* Makefile improvements (Makefile, */Makefile)
|
||||
* other source code modifications (*.c, *.h)
|
||||
* etc. (* */* :) )
|
||||
* your changes applied agsinst the top of the calc master branch:
|
||||
|
||||
In order to consider integrating your code, we need:
|
||||
https://github.com/lcn2/calc/
|
||||
|
||||
* calc version you are working with (please try use the latest version)
|
||||
* new help files or help file patches, if applicable (documentation)
|
||||
* proposed text for the CHANGES file (brief description of what it does)
|
||||
* regress.cal test patch as needed
|
||||
* your source code and/or source code changes (:-))
|
||||
|
||||
If you add functionality to calc, please be sure to modify/patch/add
|
||||
* Update CHANGES file (brief description of what it does)
|
||||
|
||||
* regress.cal test patch as needed
|
||||
|
||||
If you add functionality to calc, please be sure to modify
|
||||
Makefiles, help files, cal/regress.cal test code as well.
|
||||
Regression test cases are vital to maintaining calc's level
|
||||
of correctness and helps us avoid code bug regression.
|
||||
|
||||
Please try to generate a patch against the most recent
|
||||
version of calc, and if you use GitHub, the top of the
|
||||
master branch:
|
||||
|
||||
https://github.com/lcn2/calc
|
||||
|
||||
The best way contribute to calc bug is to generate calc
|
||||
GitHub pull request:
|
||||
GitHub pull request against the calc GitHub repo:
|
||||
|
||||
https://github.com/lcn2/calc/pulls
|
||||
|
||||
Please be patient as we cannot always respond pull requests quickly.
|
||||
|
||||
=-=
|
||||
|
||||
IMPORTANT:
|
||||
|
||||
Your code needs to be contributed under either the 2.1 of the GNU
|
||||
Lesser General Public License (LGPL 2.1) or in the public domain.
|
||||
Lesser General Public License (LGPL 2.1) or under "The Unlicense":
|
||||
|
||||
If you do not want to use calc GitHub, then send Email to:
|
||||
|
||||
calc-contrib-mail at asthe dot com
|
||||
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
|
||||
You MUST use following SPECIAL PHRASE in your Email Subject line:
|
||||
|
||||
calc contribution
|
||||
|
||||
You may add additional words to your subject line.
|
||||
|
||||
Suggestion:
|
||||
|
||||
From time to time, the Email address and Subject SPECIAL PHRASE
|
||||
may change so verify you have the current info by visiting:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/calc-contrib.html
|
||||
|
||||
IMPORTANT: If your Email doesn't contain the above phrase,
|
||||
then we WILL NOT SEE your Email.
|
||||
|
||||
PLEASE BE SURE you have that SPECIAL PHRASE somewhere in the subject line!
|
||||
|
||||
Keep in mind that the best way to report on a calc bug is to use
|
||||
the above mentioned calc GitHub procedure.
|
||||
|
||||
Please be patient as we cannot always respond to Email messages quickly.
|
||||
https://unlicense.org
|
||||
|
||||
=-=
|
||||
|
||||
@@ -77,7 +41,7 @@ See also the calc wishlist by running the calc command:
|
||||
|
||||
=-=
|
||||
|
||||
## Copyright (C) 1999,2014,2021 Landon Curt Noll
|
||||
## Copyright (C) 1999,2014,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
|
||||
|
18
COPYING
18
COPYING
@@ -4,9 +4,10 @@
|
||||
This file is Copyrighted
|
||||
------------------------
|
||||
|
||||
This file is not covered under version 2.1 of the GNU LGPL.
|
||||
This file is covered under the following Copyright:
|
||||
|
||||
Copyright (C) 1999-2022 Landon Curt Noll
|
||||
Copyright (C) 1999-2023 Landon Curt Noll
|
||||
All rights reserved.
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
@@ -121,11 +122,12 @@ Calc copyrights and exception files
|
||||
Copyright (C) year Petteri Kettunen and Landon Curt Noll
|
||||
Copyright (C) year Christoph Zurnieden
|
||||
Copyright (C) year Landon Curt Noll and Thomas Jones-Low
|
||||
Copyright (C) year Klaus Alexander Seistrup and Landon Curt Noll
|
||||
|
||||
These files are not covered under one of the Copyrights listed above:
|
||||
|
||||
sha1.c sha1.h COPYING
|
||||
COPYING-LGPL cal/qtime.cal cal/screen.cal
|
||||
COPYING-LGPL cal/screen.cal
|
||||
|
||||
The file COPYING-LGPL, which contains a copy of the version 2.1
|
||||
GNU Lesser General Public License, is itself Copyrighted by the
|
||||
@@ -137,8 +139,16 @@ Calc copyrights and exception files
|
||||
top of this file. It is important to note that you may distribute
|
||||
verbatim copies of this file but you may not modify this file.
|
||||
|
||||
Some of these exception files are in the public domain. Other files
|
||||
are under the LGPL but have different authors that those listed above.
|
||||
These files are covered under "The Unlicense":
|
||||
|
||||
sha1.c
|
||||
sha1.h
|
||||
cal/dotest.cal
|
||||
cal/screen.cal
|
||||
|
||||
For more information on this license, see:
|
||||
|
||||
https://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
|
||||
|
16
LIBRARY
16
LIBRARY
@@ -344,7 +344,7 @@ values of 0 and 1 are so common that special checks are made for them.
|
||||
|
||||
For initial values besides 0 or 1, you need to call itoz to convert a long
|
||||
value into a ZVALUE, as shown in the above example. Or alternatively,
|
||||
for larger numbers you can use the atoz routine to convert a string which
|
||||
for larger numbers you can use the str2z routine to convert a string which
|
||||
represents a number into a ZVALUE. The string can be in decimal, octal,
|
||||
hex, or binary according to the leading digits.
|
||||
|
||||
@@ -357,7 +357,7 @@ over a long sequence of operations.
|
||||
ZVALUE z1, z2, z3;
|
||||
|
||||
z1 = _one_;
|
||||
atoz("12345678987654321", &z2);
|
||||
str2z("12345678987654321", &z2);
|
||||
zadd(z1, z2, &z3);
|
||||
zfree(z1);
|
||||
zfree(z2);
|
||||
@@ -446,10 +446,10 @@ to free them first. The following illustrates this:
|
||||
itoz(55L, &q->num);
|
||||
|
||||
A better way to create NUMBERs with particular values is to use the itoq,
|
||||
iitoq, or atoq functions. Using itoq makes a long value into a NUMBER,
|
||||
iitoq, or str2q functions. Using itoq makes a long value into a NUMBER,
|
||||
using iitoq makes a pair of longs into the numerator and denominator of a
|
||||
NUMBER (reducing them first if needed), and atoq converts a string representing
|
||||
a number into the corresponding NUMBER. The atoq function accepts input in
|
||||
NUMBER (reducing them first if needed), and str2q converts a string representing
|
||||
a number into the corresponding NUMBER. The str2q function accepts input in
|
||||
integral, fractional, real, or exponential formats. Examples of allocating
|
||||
numbers are:
|
||||
|
||||
@@ -457,7 +457,7 @@ numbers are:
|
||||
|
||||
q1 = itoq(66L);
|
||||
q2 = iitoq(2L, 3L);
|
||||
q3 = atoq("456.78");
|
||||
q3 = str2q("456.78");
|
||||
|
||||
Also unlike ZVALUEs, NUMBERs are quickly copied. This is because they contain
|
||||
a link count, which is the number of pointers there are to the NUMBER. The
|
||||
@@ -504,8 +504,8 @@ For example, to calculate sin(0.5) to 100 decimal places, you could do:
|
||||
|
||||
NUMBER *q, *ans, *epsilon;
|
||||
|
||||
q = atoq("0.5");
|
||||
epsilon = atoq("1e-100");
|
||||
q = str2q("0.5");
|
||||
epsilon = str2q("1e-100");
|
||||
ans = qsin(q, epsilon);
|
||||
|
||||
There are many convenience macros similar to the ones for ZVALUEs which can
|
||||
|
375
Makefile
375
Makefile
@@ -1,8 +1,8 @@
|
||||
#!/bin/make
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# calc - arbitrary precision calculator
|
||||
#
|
||||
# Copyright (C) 1999-2018,2021,2022 Landon Curt Noll
|
||||
# Copyright (C) 1999-2018,2021-2023 Landon Curt Noll
|
||||
#
|
||||
# SRC: Makefile - top level Makefile
|
||||
#
|
||||
@@ -49,6 +49,7 @@ ifndef EXCLUDE_FROM_CUSTOM_MAKEFILE
|
||||
# The section continues until the next line that #
|
||||
# starts with a '# End skipping ..' comment line. #
|
||||
###################################################
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
|
||||
# Unfortunately due to the complex dependency issues between
|
||||
# Makefile, Makefile.ship and custom/Makefile, parallel GNU make
|
||||
@@ -65,7 +66,8 @@ ifndef EXCLUDE_FROM_CUSTOM_MAKEFILE
|
||||
# NOTE: You can force a target value by defining target as in:
|
||||
#
|
||||
# make ...__optional_arguments_... target=value
|
||||
|
||||
#
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
# Try uname -s if the target was not already set on the make command line
|
||||
#
|
||||
ifeq ($(target),)
|
||||
@@ -77,12 +79,11 @@ endif
|
||||
ifeq ($(hardware),)
|
||||
hardware=$(shell uname -m 2>/dev/null)
|
||||
endif
|
||||
ifeq ($(MINGW),)
|
||||
MINGW=$(shell uname -o 2>/dev/null)
|
||||
ifeq ($(OSNAME),)
|
||||
OSNAME=$(shell uname -o 2>/dev/null)
|
||||
endif
|
||||
#
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
#
|
||||
|
||||
# The shell used by this Makefile
|
||||
#
|
||||
# On some systems, /bin/sh is a rather reduced shell with
|
||||
@@ -91,17 +92,17 @@ endif
|
||||
# If your system has a up to date, bash shell, then
|
||||
# you may wish to use:
|
||||
#
|
||||
# SHELL= /bin/bash
|
||||
# SHELL= 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
|
||||
# SHELL= sh
|
||||
#
|
||||
SHELL= /bin/bash
|
||||
#SHELL= /bin/sh
|
||||
SHELL= bash
|
||||
#SHELL= sh
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
#
|
||||
ifeq ($(target),Darwin)
|
||||
@@ -112,12 +113,13 @@ endif
|
||||
# then we will also need to use the Cygwin runtime enviroment
|
||||
# and the calc Cygwin make target.
|
||||
##
|
||||
ifeq ($(MINGW),Cygwin)
|
||||
ifeq ($(OSNAME),Cygwin)
|
||||
target:= Cygwin
|
||||
endif
|
||||
#
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
|
||||
|
||||
##############################################################################
|
||||
#-=-=-=-=-=-=-=-=- You may want to change some values below -=-=-=-=-=-=-=-=-#
|
||||
##############################################################################
|
||||
@@ -488,6 +490,62 @@ HAVE_MEMMOVE=
|
||||
HAVE_USTAT=
|
||||
#HAVE_USTAT= -DHAVE_NO_USTAT
|
||||
|
||||
# Determine if we have statfs()
|
||||
#
|
||||
# If HAVE_STATFS is empty, this Makefile will run the have_statfs program
|
||||
# to determine if statfs() is supported. If HAVE_STATFS is set to
|
||||
# -DHAVE_NO_STATFS, then calc will use internal functions to simulate
|
||||
# the statfs() function that gets file system statistics.
|
||||
#
|
||||
# Select HAVE_STATFS= -DHAVE_NO_STATFS for DJGPP.
|
||||
#
|
||||
# If in doubt, leave HAVE_STATFS empty and this Makefile will figure it out.
|
||||
#
|
||||
HAVE_STATFS=
|
||||
#HAVE_STATFS= -DHAVE_NO_STATFS
|
||||
|
||||
# Determine if we have the <sys/vfs.h> include file.
|
||||
#
|
||||
# HAVE_SYS_VFS_H= let the Makefile look for the include file
|
||||
# HAVE_SYS_VFS_H= YES assume that the include file exists
|
||||
# HAVE_SYS_VFS_H= NO assume that the include file does not exist
|
||||
#
|
||||
# Select HAVE_SYS_VFS_H= NO for DJGPP.
|
||||
#
|
||||
# When in doubt, leave HAVE_SYS_VFS_H empty.
|
||||
#
|
||||
HAVE_SYS_VFS_H=
|
||||
#HAVE_SYS_VFS_H= YES
|
||||
#HAVE_SYS_VFS_H= NO
|
||||
|
||||
# Determine if we have the <sys/param.h> include file.
|
||||
#
|
||||
# HAVE_SYS_PARAM_H= let the Makefile look for the include file
|
||||
# HAVE_SYS_PARAM_H= YES assume that the include file exists
|
||||
# HAVE_SYS_PARAM_H= NO assume that the include file does not exist
|
||||
#
|
||||
# Select HAVE_SYS_PARAM_H= NO for DJGPP.
|
||||
#
|
||||
# When in doubt, leave HAVE_SYS_PARAM_H empty.
|
||||
#
|
||||
HAVE_SYS_PARAM_H=
|
||||
#HAVE_SYS_PARAM_H= YES
|
||||
#HAVE_SYS_PARAM_H= NO
|
||||
|
||||
# Determine if we have the <sys/mount.h> include file.
|
||||
#
|
||||
# HAVE_SYS_MOUNT_H= let the Makefile look for the include file
|
||||
# HAVE_SYS_MOUNT_H= YES assume that the include file exists
|
||||
# HAVE_SYS_MOUNT_H= NO assume that the include file does not exist
|
||||
#
|
||||
# Select HAVE_SYS_MOUNT_H= NO for DJGPP.
|
||||
#
|
||||
# When in doubt, leave HAVE_SYS_MOUNT_H empty.
|
||||
#
|
||||
HAVE_SYS_MOUNT_H=
|
||||
#HAVE_SYS_MOUNT_H= YES
|
||||
#HAVE_SYS_MOUNT_H= NO
|
||||
|
||||
# Determine if we have getsid()
|
||||
#
|
||||
# If HAVE_GETSID is empty, this Makefile will run the have_getsid program
|
||||
@@ -1144,11 +1202,25 @@ CALCRC= ./.calcinit:~/.calcrc:${CALC_SHAREDIR}/startup
|
||||
# READLINE_INCLUDE Where the readline include files reside
|
||||
# (leave blank if they are /usr/include/readline)
|
||||
#
|
||||
# NOTE: If you select the 'USE_READLINE=' mode, then we recommend you set:
|
||||
#
|
||||
# READLINE_EXTRAS=
|
||||
# READLINE_INCLUDE=
|
||||
# READLINE_LIB=
|
||||
#
|
||||
# NOTE: The GNU-readline code is not shipped with calc. You must have
|
||||
# the appropriate headers and link libs installed on your system in
|
||||
# order to use it.
|
||||
#
|
||||
# If in doubt, set USE_READLINE, READLINE_LIB and READLINE_INCLUDE to nothing.
|
||||
# To disable the use of the GNU-readline facility (as well as ncurses), set:
|
||||
#
|
||||
# USE_READLINE=
|
||||
# READLINE_EXTRAS=
|
||||
# READLINE_INCLUDE=
|
||||
# READLINE_LIB=
|
||||
#
|
||||
# If in doubt, set USE_READLINE, READLINE_EXTRAS, READLINE_INCLUDE, and
|
||||
# READLINE_LIB to nothing.
|
||||
#
|
||||
#USE_READLINE=
|
||||
USE_READLINE= -DUSE_READLINE
|
||||
@@ -1309,7 +1381,7 @@ EXT=
|
||||
|
||||
# The default calc versions
|
||||
#
|
||||
VERSION= 2.14.1.3
|
||||
VERSION= 2.14.2.0
|
||||
|
||||
# Names of shared libraries with versions
|
||||
#
|
||||
@@ -1330,7 +1402,7 @@ CTAGS= ctags
|
||||
DATE= date
|
||||
DIFF= diff
|
||||
FMT= fmt
|
||||
GREP= egrep
|
||||
GREP= grep
|
||||
HOSTNAME= hostname
|
||||
LANG= C
|
||||
LDCONFIG= ldconfig
|
||||
@@ -2084,7 +2156,8 @@ BUILD_H_SRC= align32.h args.h calcerr.h conf.h endian_calc.h \
|
||||
have_string.h have_strlcat.h have_strlcpy.h have_times.h \
|
||||
have_uid_t.h have_unistd.h have_unused.h have_urandom.h \
|
||||
have_ustat.h longbits.h terminal.h have_environ.h \
|
||||
have_arc4random.h have_limits.h charbit.h
|
||||
have_arc4random.h have_limits.h charbit.h have_sys_vfs.h \
|
||||
have_sys_param.h have_sys_mount.h have_statfs.h
|
||||
|
||||
# we build these .c files during the make
|
||||
#
|
||||
@@ -2100,7 +2173,7 @@ UTIL_C_SRC= align32.c endian.c longbits.c have_newstr.c have_uid_t.c \
|
||||
have_ustat.c have_getsid.c have_getpgid.c have_environ.c \
|
||||
have_gettime.c have_getprid.c have_rusage.c have_strdup.c \
|
||||
have_unused.c have_ban_pragma.c have_strlcpy.c have_strlcat.c \
|
||||
have_arc4random.c charbit.c
|
||||
have_arc4random.c charbit.c have_statfs.c
|
||||
|
||||
# these awk and sed tools are used in the process of building BUILD_H_SRC
|
||||
# and BUILD_C_SRC
|
||||
@@ -2118,7 +2191,7 @@ UTIL_OBJS= endian.o longbits.o have_newstr.o have_uid_t.o \
|
||||
have_ustat.o have_getsid.o have_getpgid.o have_environ.o \
|
||||
have_gettime.o have_getprid.o ver_calc.o have_rusage.o have_strdup.o \
|
||||
have_unused.o have_ban_pragma.o have_strlcpy.o have_strlcat.o \
|
||||
have_arc4random.o charbit.o
|
||||
have_arc4random.o charbit.o have_statfs.o
|
||||
|
||||
# these temp files may be created (and removed) during the build of BUILD_C_SRC
|
||||
#
|
||||
@@ -2137,7 +2210,7 @@ UTIL_PROGS= align32${EXT} fposval${EXT} have_uid_t${EXT} have_const${EXT} \
|
||||
have_unused${EXT} have_fpos${EXT} have_fpos_pos${EXT} \
|
||||
have_offscl${EXT} have_rusage${EXT} have_ban_pragma${EXT} \
|
||||
have_strlcpy${EXT} have_strlcat${EXT} have_arc4random${EXT} \
|
||||
charbit${EXT}
|
||||
charbit${EXT} have_statfs${ENT}
|
||||
|
||||
# these utility files and scripts may be created in the process of building
|
||||
# the BUILD_H_SRC file set
|
||||
@@ -2658,7 +2731,7 @@ calc.usage: calc.1 ${MAKE_FILE} ${LOC_MKF}
|
||||
LESSCHARSET=iso8859 ${CALCPAGER} calc.1; \
|
||||
else \
|
||||
${NROFF} -man calc.1; \
|
||||
fi 2>&1 | ${GREP} -v 'cannot adjust line' | ${COL} -b > $@
|
||||
fi 2>&1 | ${GREP} -E -v 'cannot adjust line' | ${COL} -b > $@
|
||||
${Q} echo calc.usage formed
|
||||
|
||||
|
||||
@@ -2721,7 +2794,7 @@ conf.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2806,7 +2879,7 @@ endian_calc.h: endian.c have_stdlib.h have_unistd.h \
|
||||
${Q} ${RM} -f endian.o endian${EXT} $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2858,7 +2931,7 @@ charbit.h: charbit.c have_limits.h \
|
||||
${Q} ${RM} -f charbit.o charbit${EXT} $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2894,7 +2967,7 @@ longbits.h: longbits.c charbit.h have_unistd.h have_stdlib.h \
|
||||
${Q} ${RM} -f longbits.o longbits${EXT} $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2924,7 +2997,7 @@ have_times.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2990,7 +3063,7 @@ have_stdlib.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3026,7 +3099,7 @@ have_unistd.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3062,7 +3135,7 @@ have_limits.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3098,7 +3171,7 @@ have_string.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3134,7 +3207,7 @@ terminal.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3188,7 +3261,7 @@ have_fgetsetpos.h: have_fgetsetpos.c banned.h have_ban_pragma.h ${MAKE_FILE} ${L
|
||||
${Q} ${RM} -f fpos_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3231,7 +3304,7 @@ have_fpos_pos.h: have_fpos_pos.c have_fgetsetpos.h have_posscl.h have_string.h \
|
||||
${Q} ${RM} -f fpos_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3277,7 +3350,7 @@ fposval.h: fposval.c have_fgetsetpos.h have_fpos_pos.h have_offscl.h have_posscl
|
||||
${Q} ${RM} -f fposval_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3319,7 +3392,7 @@ have_const.h: have_const.c banned.h have_ban_pragma.h ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f have_const const_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3362,7 +3435,7 @@ have_offscl.h: have_offscl.c have_unistd.h \
|
||||
${Q} ${RM} -f offscl_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3403,7 +3476,7 @@ have_posscl.h: have_posscl.c have_fgetsetpos.h have_unistd.h \
|
||||
${Q} ${RM} -f have_posscl have_posscl.o posscl_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3444,7 +3517,7 @@ align32.h: align32.c longbits.h have_unistd.h \
|
||||
${Q} ${RM} -f align32 align32_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3499,7 +3572,7 @@ have_uid_t.h: have_uid_t.c have_unistd.h \
|
||||
${Q} ${RM} -f have_uid_t uid_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3540,7 +3613,7 @@ have_environ.h: have_environ.c \
|
||||
${Q} ${RM} -f have_environ environ_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3581,7 +3654,7 @@ have_arc4random.h: have_arc4random.c have_stdlib.h \
|
||||
${Q} ${RM} -f have_arc4random arc4random_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3622,7 +3695,7 @@ have_newstr.h: have_newstr.c banned.h have_ban_pragma.h have_string.h ${MAKE_FIL
|
||||
${Q} ${RM} -f newstr_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3662,7 +3735,7 @@ have_memmv.h: have_memmv.c banned.h have_ban_pragma.h have_string.h ${MAKE_FILE}
|
||||
${Q} ${RM} -f have_memmv have_memmv.o memmv_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3702,7 +3775,7 @@ have_ustat.h: have_ustat.c banned.h have_ban_pragma.h ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f ustat_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3737,12 +3810,161 @@ have_ustat.h: have_ustat.c banned.h have_ban_pragma.h ${MAKE_FILE} ${LOC_MKF}
|
||||
${TRUE}; \
|
||||
fi
|
||||
|
||||
have_statfs.h: have_statfs.c banned.h have_ban_pragma.h have_sys_vfs.h have_sys_param.h \
|
||||
have_sys_mount.h ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f statfs_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '#if !defined(CALC_HAVE_STATFS_H)' >> $@
|
||||
${Q} echo '#define CALC_HAVE_STATFS_H' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '/* do we have or want statfs()? */' >> $@
|
||||
${Q} ${RM} -f have_statfs.o have_statfs${EXT}
|
||||
-${Q} ${LCC} ${ICFLAGS} ${HAVE_STATFS} have_statfs.c -c ${S} \
|
||||
|| ${TRUE}
|
||||
-${Q} ${LCC} ${ILDFLAGS} have_statfs.o -o have_statfs ${S} \
|
||||
|| ${TRUE}
|
||||
-${Q} ./have_statfs${EXT} > statfs_tmp ${E} \
|
||||
|| ${TRUE}
|
||||
-${Q} if [ -s statfs_tmp ]; then \
|
||||
${CAT} statfs_tmp >> $@; \
|
||||
else \
|
||||
echo '#undef HAVE_STATFS /* no */' >> $@; \
|
||||
fi
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '#endif /* !CALC_HAVE_STATFS_H */' >> $@
|
||||
${Q} ${RM} -f have_statfs${EXT} have_statfs.o statfs_tmp
|
||||
${H} echo '$@ formed'
|
||||
-@if [ -z "${Q}" ]; then \
|
||||
echo ''; \
|
||||
echo '=-=-= start of $@ =-=-='; \
|
||||
${CAT} $@; \
|
||||
echo '=-=-= end of $@ =-=-='; \
|
||||
echo ''; \
|
||||
else \
|
||||
${TRUE}; \
|
||||
fi
|
||||
|
||||
have_sys_vfs.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '#if !defined(CALC_HAVE_SYS_VFS_H)' >> $@
|
||||
${Q} echo '#define CALC_HAVE_SYS_VFS_H' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '/* do we have <sys/vfs.h>? */' >> $@
|
||||
-${Q} if [ X"${HAVE_SYS_VFS_H}" = X"YES" ]; then \
|
||||
echo '#define HAVE_SYS_VFS_H /* yes */' >> $@; \
|
||||
elif [ X"${HAVE_SYS_VFS_H}" = X"NO" ]; then \
|
||||
echo '#undef HAVE_SYS_VFS_H /* no */' >> $@; \
|
||||
elif echo '#include <sys/vfs.h>' | ${CC} -E - ${S}; then \
|
||||
echo '#define HAVE_SYS_VFS_H /* yes */' >> $@; \
|
||||
else \
|
||||
echo '#undef HAVE_SYS_VFS_H /* no */' >> $@; \
|
||||
fi
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '#endif /* !CALC_HAVE_SYS_VFS_H */' >> $@
|
||||
${H} echo '$@ formed'
|
||||
-@if [ -z "${Q}" ]; then \
|
||||
echo ''; \
|
||||
echo '=-=-= start of $@ =-=-='; \
|
||||
${CAT} $@; \
|
||||
echo '=-=-= end of $@ =-=-='; \
|
||||
echo ''; \
|
||||
else \
|
||||
${TRUE}; \
|
||||
fi
|
||||
|
||||
have_sys_param.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '#if !defined(CALC_HAVE_SYS_PARAM_H)' >> $@
|
||||
${Q} echo '#define CALC_HAVE_SYS_PARAM_H' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '/* do we have <sys/param.h>? */' >> $@
|
||||
-${Q} if [ X"${HAVE_SYS_PARAM_H}" = X"YES" ]; then \
|
||||
echo '#define HAVE_SYS_PARAM_H /* yes */' >> $@; \
|
||||
elif [ X"${HAVE_SYS_PARAM_H}" = X"NO" ]; then \
|
||||
echo '#undef HAVE_SYS_PARAM_H /* no */' >> $@; \
|
||||
elif echo '#include <sys/param.h>' | ${CC} -E - ${S}; then \
|
||||
echo '#define HAVE_SYS_PARAM_H /* yes */' >> $@; \
|
||||
else \
|
||||
echo '#undef HAVE_SYS_PARAM_H /* no */' >> $@; \
|
||||
fi
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '#endif /* !CALC_HAVE_SYS_PARAM_H */' >> $@
|
||||
${H} echo '$@ formed'
|
||||
-@if [ -z "${Q}" ]; then \
|
||||
echo ''; \
|
||||
echo '=-=-= start of $@ =-=-='; \
|
||||
${CAT} $@; \
|
||||
echo '=-=-= end of $@ =-=-='; \
|
||||
echo ''; \
|
||||
else \
|
||||
${TRUE}; \
|
||||
fi
|
||||
|
||||
have_sys_mount.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '#if !defined(CALC_HAVE_SYS_MOUNT_H)' >> $@
|
||||
${Q} echo '#define CALC_HAVE_SYS_MOUNT_H' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '/* do we have <sys/param.h>? */' >> $@
|
||||
-${Q} if [ X"${HAVE_SYS_MOUNT_H}" = X"YES" ]; then \
|
||||
echo '#define HAVE_SYS_MOUNT_H /* yes */' >> $@; \
|
||||
elif [ X"${HAVE_SYS_MOUNT_H}" = X"NO" ]; then \
|
||||
echo '#undef HAVE_SYS_MOUNT_H /* no */' >> $@; \
|
||||
elif echo '#include <sys/param.h>' | ${CC} -E - ${S}; then \
|
||||
echo '#define HAVE_SYS_MOUNT_H /* yes */' >> $@; \
|
||||
else \
|
||||
echo '#undef HAVE_SYS_MOUNT_H /* no */' >> $@; \
|
||||
fi
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '#endif /* !CALC_HAVE_SYS_MOUNT_H */' >> $@
|
||||
${H} echo '$@ formed'
|
||||
-@if [ -z "${Q}" ]; then \
|
||||
echo ''; \
|
||||
echo '=-=-= start of $@ =-=-='; \
|
||||
${CAT} $@; \
|
||||
echo '=-=-= end of $@ =-=-='; \
|
||||
echo ''; \
|
||||
else \
|
||||
${TRUE}; \
|
||||
fi
|
||||
|
||||
have_getsid.h: have_getsid.c have_unistd.h \
|
||||
banned.h have_ban_pragma.h ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f getsid_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3783,7 +4005,7 @@ have_getpgid.h: have_getpgid.c have_unistd.h \
|
||||
${Q} ${RM} -f getpgid_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3824,7 +4046,7 @@ have_gettime.h: have_gettime.c banned.h have_ban_pragma.h \
|
||||
${Q} ${RM} -f gettime_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3865,7 +4087,7 @@ have_getprid.h: have_getprid.c have_unistd.h \
|
||||
${Q} ${RM} -f getprid_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3905,7 +4127,7 @@ have_urandom.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3941,7 +4163,7 @@ have_rusage.h: have_rusage.c banned.h have_ban_pragma.h ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f rusage_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3981,7 +4203,7 @@ have_strdup.h: have_strdup.c banned.h have_ban_pragma.h have_string.h ${MAKE_FIL
|
||||
${Q} ${RM} -f strdup_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -4022,7 +4244,7 @@ args.h: have_stdvs.c have_varvs.c have_string.h have_unistd.h \
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -4135,7 +4357,7 @@ have_unused.h: have_unused.c have_stdlib.h have_ban_pragma.h \
|
||||
${Q} ${RM} -f unused_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -4177,7 +4399,7 @@ have_ban_pragma.h: have_ban_pragma.c banned.h ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f unused_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -4220,7 +4442,7 @@ have_strlcpy.h: have_strlcpy.c banned.h have_ban_pragma.h have_string.h \
|
||||
${Q} ${RM} -f unused_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -4262,7 +4484,7 @@ have_strlcat.h: have_strlcat.c banned.h have_ban_pragma.h have_string.h \
|
||||
${Q} ${RM} -f unused_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -4467,6 +4689,12 @@ depend: hsrc custom/Makefile
|
||||
else \
|
||||
${TRUE}; \
|
||||
fi
|
||||
${Q} if type -f ${MAKEDEPEND}; then \
|
||||
${TRUE}; \
|
||||
else \
|
||||
echo "make depend failed: cannot find makedepend command: ${MAKEDEPEND}" 1>&2; \
|
||||
exit 1; \
|
||||
fi
|
||||
${V} echo '=-=-=-=-= Invoking depend rule for cscript =-=-=-=-='
|
||||
${Q} cd cscript; ${MAKE} -f Makefile ${CSCRIPT_PASSDOWN} depend
|
||||
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
|
||||
@@ -4478,7 +4706,7 @@ depend: hsrc custom/Makefile
|
||||
${Q} ${MKDIR} -p skel
|
||||
-${Q} for i in ${C_SRC} ${BUILD_C_SRC}; do \
|
||||
${SED} -n '/^#[ ]*include[ ]*"/p' "$$i" | \
|
||||
${GREP} -v '\.\./getopt/getopt\.h' > "skel/$$i"; \
|
||||
${GREP} -E -v '\.\./getopt/getopt\.h' > "skel/$$i"; \
|
||||
done
|
||||
${Q} ${MKDIR} -p skel/custom
|
||||
-${Q} for i in ${H_SRC} ${BUILD_H_SRC} custom.h /dev/null; do \
|
||||
@@ -4522,7 +4750,7 @@ depend: hsrc custom/Makefile
|
||||
${Q} ${MV} ${MAKE_FILE} ${MAKE_FILE}.bak
|
||||
${Q} ${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' \
|
||||
${MAKE_FILE}.bak > ${MAKE_FILE}
|
||||
${Q} ${GREP} -v '^#' skel/makedep.out >> ${MAKE_FILE}
|
||||
${Q} ${GREP} -E -v '^#' skel/makedep.out >> ${MAKE_FILE}
|
||||
${Q} echo removing top level skel
|
||||
${Q} ${RM} -rf skel
|
||||
-${Q} if ${CMP} -s ${MAKE_FILE}.bak ${MAKE_FILE}; then \
|
||||
@@ -4846,13 +5074,17 @@ env:
|
||||
@echo 'HAVE_OFFSCL=${HAVE_OFFSCL}'; echo ''
|
||||
@echo 'HAVE_POSSCL=${HAVE_POSSCL}'; echo ''
|
||||
@echo 'HAVE_PRAGMA_GCC_POSION=${HAVE_PRAGMA_GCC_POSION}'; echo ''
|
||||
@echo 'HAVE_STATFS=${HAVE_STATFS}'; echo ''
|
||||
@echo 'HAVE_STDLIB_H=${HAVE_STDLIB_H}'; echo ''
|
||||
@echo 'HAVE_STRDUP=${HAVE_STRDUP}'; echo ''
|
||||
@echo 'HAVE_STRING_H=${HAVE_STRING_H}'; echo ''
|
||||
@echo 'HAVE_STRLCAT=${HAVE_STRLCAT}'; echo ''
|
||||
@echo 'HAVE_STRLCPY=${HAVE_STRLCPY}'; echo ''
|
||||
@echo 'HAVE_SYS_MOUNT_H=${HAVE_SYS_MOUNT_H}'; echo ''
|
||||
@echo 'HAVE_SYS_PARAM_H=${HAVE_SYS_PARAM_H}'; echo ''
|
||||
@echo 'HAVE_SYS_TIMES_H=${HAVE_SYS_TIMES_H}'; echo ''
|
||||
@echo 'HAVE_SYS_TIME_H=${HAVE_SYS_TIME_H}'; echo ''
|
||||
@echo 'HAVE_SYS_VFS_H=${HAVE_SYS_VFS_H}'; echo ''
|
||||
@echo 'HAVE_TIMES_H=${HAVE_TIMES_H}'; echo ''
|
||||
@echo 'HAVE_TIME_H=${HAVE_TIME_H}'; echo ''
|
||||
@echo 'HAVE_UID_T=${HAVE_UID_T}'; echo ''
|
||||
@@ -4892,18 +5124,18 @@ env:
|
||||
@echo 'MANEXT=${MANEXT}'; echo ''
|
||||
@echo 'MANMAKE=${MANMAKE}'; echo ''
|
||||
@echo 'MANMODE=${MANMODE}'; echo ''
|
||||
@echo 'MKDIR=${MKDIR}'; echo ''
|
||||
@echo 'MINGW=${MINGW}'; echo ''
|
||||
@echo 'MKDIR=${MKDIR}'; echo ''
|
||||
@echo 'MV=${MV}'; echo ''
|
||||
@echo 'NROFF=${NROFF}'; echo ''
|
||||
@echo 'NROFF_ARG=${NROFF_ARG}'; echo ''
|
||||
@echo 'OBJS=${OBJS}'; echo ''
|
||||
@echo 'OFF_T_BITS=${OFF_T_BITS}'; echo ''
|
||||
@echo 'PREFIX=${PREFIX}'; echo ''
|
||||
@echo 'PURIFY=${PURIFY}'; echo ''
|
||||
@echo 'PWD=${PWD}'; echo ''
|
||||
@echo 'PWDCMD=${PWDCMD}'; echo ''
|
||||
@echo 'Q=${Q}'; echo ''
|
||||
@echo 'PREFIX=${PREFIX}'; echo ''
|
||||
@echo 'RANLIB=${RANLIB}'; echo ''
|
||||
@echo 'READLINE_EXTRAS=${READLINE_EXTRAS}'; echo ''
|
||||
@echo 'READLINE_INCLUDE=${READLINE_INCLUDE}'; echo ''
|
||||
@@ -5094,16 +5326,16 @@ inst_files: ${MAKE_FILE} ${LOC_MKF} help/Makefile cal/Makefile \
|
||||
${Q} echo ${BINDIR}/calc${EXT} > inst_files
|
||||
${Q} cd help; LANG=C \
|
||||
${MAKE} -f Makefile ${HELP_PASSDOWN} echo_inst_files | \
|
||||
${GREP} '__file__..' | ${SED} -e s'/.*__file__ //' >> ../inst_files
|
||||
${GREP} -E '__file__..' | ${SED} -e s'/.*__file__ //' >> ../inst_files
|
||||
${Q} cd cal; LANG=C \
|
||||
${MAKE} -f Makefile ${CAL_PASSDOWN} echo_inst_files | \
|
||||
${GREP} '__file__..' | ${SED} -e s'/.*__file__ //' >> ../inst_files
|
||||
${GREP} -E '__file__..' | ${SED} -e s'/.*__file__ //' >> ../inst_files
|
||||
${Q} cd custom; LANG=C \
|
||||
${MAKE} -f Makefile ${CUSTOM_PASSDOWN} echo_inst_files | \
|
||||
${GREP} '__file__..' | ${SED} -e s'/.*__file__ //' >> ../inst_files
|
||||
${GREP} -E '__file__..' | ${SED} -e s'/.*__file__ //' >> ../inst_files
|
||||
${Q} cd cscript; LANG=C \
|
||||
${MAKE} -f Makefile ${CSCRIPT_PASSDOWN} echo_inst_files | \
|
||||
${GREP} '__file__..' | ${SED} -e s'/.*__file__ //' >> ../inst_files
|
||||
${GREP} -E '__file__..' | ${SED} -e s'/.*__file__ //' >> ../inst_files
|
||||
${Q} echo ${LIBDIR}/libcalc.a >> inst_files
|
||||
${Q} for i in ${LIB_H_SRC} ${BUILD_H_SRC} /dev/null; do \
|
||||
if [ X"$$i" != X"/dev/null" ]; then \
|
||||
@@ -5155,7 +5387,7 @@ olduninstall:
|
||||
|
||||
tags: ${CALCSRC} ${LIBSRC} ${H_SRC} ${BUILD_H_SRC} ${MAKE_FILE}
|
||||
-${CTAGS} ${CALCSRC} ${LIBSRC} ${H_SRC} ${BUILD_H_SRC} 2>&1 | \
|
||||
${GREP} -v 'Duplicate entry|Second entry ignored'
|
||||
${GREP} -E -v 'Duplicate entry|Second entry ignored'
|
||||
|
||||
clean:
|
||||
${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
|
||||
@@ -6183,7 +6415,9 @@ file.o: strl.h
|
||||
file.o: value.h
|
||||
file.o: zmath.h
|
||||
fposval.o: alloc.h
|
||||
fposval.o: attribute.h
|
||||
fposval.o: banned.h
|
||||
fposval.o: byteswap.h
|
||||
fposval.o: decl.h
|
||||
fposval.o: endian_calc.h
|
||||
fposval.o: fposval.c
|
||||
@@ -6195,8 +6429,11 @@ fposval.o: have_memmv.h
|
||||
fposval.o: have_newstr.h
|
||||
fposval.o: have_offscl.h
|
||||
fposval.o: have_posscl.h
|
||||
fposval.o: have_stdlib.h
|
||||
fposval.o: have_string.h
|
||||
fposval.o: have_unused.h
|
||||
fposval.o: longbits.h
|
||||
fposval.o: zmath.h
|
||||
func.o: alloc.h
|
||||
func.o: attribute.h
|
||||
func.o: banned.h
|
||||
@@ -6327,6 +6564,12 @@ have_posscl.o: have_unistd.h
|
||||
have_rusage.o: banned.h
|
||||
have_rusage.o: have_ban_pragma.h
|
||||
have_rusage.o: have_rusage.c
|
||||
have_statfs.o: banned.h
|
||||
have_statfs.o: have_ban_pragma.h
|
||||
have_statfs.o: have_statfs.c
|
||||
have_statfs.o: have_sys_mount.h
|
||||
have_statfs.o: have_sys_param.h
|
||||
have_statfs.o: have_sys_vfs.h
|
||||
have_stdvs.o: banned.h
|
||||
have_stdvs.o: have_ban_pragma.h
|
||||
have_stdvs.o: have_stdlib.h
|
||||
@@ -6957,8 +7200,12 @@ seed.o: have_gettime.h
|
||||
seed.o: have_memmv.h
|
||||
seed.o: have_newstr.h
|
||||
seed.o: have_rusage.h
|
||||
seed.o: have_statfs.h
|
||||
seed.o: have_stdlib.h
|
||||
seed.o: have_string.h
|
||||
seed.o: have_sys_mount.h
|
||||
seed.o: have_sys_param.h
|
||||
seed.o: have_sys_vfs.h
|
||||
seed.o: have_times.h
|
||||
seed.o: have_uid_t.h
|
||||
seed.o: have_unistd.h
|
||||
|
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# Makefile.local - local Makefile variables
|
||||
#
|
||||
@@ -24,16 +25,16 @@
|
||||
# For example, a AddressSanitizer. You do NOT want to do this by
|
||||
# by default! Do this only if you are debugging with libasan:
|
||||
#
|
||||
# For Linux gcc version 4.8.5 with libasan-4.8.5-4 you might try:
|
||||
# For Linux gcc version 11.3.1 with libasan-11.3.1-2.1 you might try:
|
||||
#
|
||||
# CDEBUG:= -O0 -g
|
||||
# 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
|
||||
#
|
||||
# For macOS 12.1 with clang version 13.0.0 (clang-1300.0.29.30) you might try:
|
||||
# For macOS 13.2.1 with clang version 14.0.0 (clang-1400.0.29.202) you might try:
|
||||
#
|
||||
# CDEBUG:= -O0 -g
|
||||
# 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
|
||||
|
379
Makefile.simple
379
Makefile.simple
@@ -1,8 +1,8 @@
|
||||
#!/bin/make
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# calc - arbitrary precision calculator
|
||||
#
|
||||
# Copyright (C) 1999-2018,2021,2022 Landon Curt Noll
|
||||
# Copyright (C) 1999-2018,2021-2023 Landon Curt Noll
|
||||
#
|
||||
# SRC: Makefile.simple - non-GNU version
|
||||
#
|
||||
@@ -37,7 +37,24 @@
|
||||
#
|
||||
|
||||
|
||||
|
||||
# Unfortunately due to the complex dependency issues between
|
||||
# Makefile, Makefile.ship and custom/Makefile, parallel GNU make
|
||||
# is NOT recommended. Sorry.
|
||||
#
|
||||
# XXX - fix this - XXX
|
||||
#
|
||||
.NOTPARALLEL:
|
||||
|
||||
##############################################################################
|
||||
#-=-=-=-=-=-=-=-=- Identify the target machine, if possible -=-=-=-=-=-=-=-=-#
|
||||
##############################################################################
|
||||
|
||||
# NOTE: You can force a target value by defining target as in:
|
||||
#
|
||||
# make ...__optional_arguments_... target=value
|
||||
#
|
||||
|
||||
# The shell used by this Makefile
|
||||
#
|
||||
# On some systems, /bin/sh is a rather reduced shell with
|
||||
@@ -46,17 +63,18 @@
|
||||
# If your system has a up to date, bash shell, then
|
||||
# you may wish to use:
|
||||
#
|
||||
# SHELL= /bin/bash
|
||||
# SHELL= 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
|
||||
# SHELL= sh
|
||||
#
|
||||
SHELL= /bin/bash
|
||||
#SHELL= /bin/sh
|
||||
SHELL= bash
|
||||
#SHELL= sh
|
||||
|
||||
|
||||
##############################################################################
|
||||
#-=-=-=-=-=-=-=-=- You may want to change some values below -=-=-=-=-=-=-=-=-#
|
||||
@@ -428,6 +446,62 @@ HAVE_MEMMOVE=
|
||||
HAVE_USTAT=
|
||||
#HAVE_USTAT= -DHAVE_NO_USTAT
|
||||
|
||||
# Determine if we have statfs()
|
||||
#
|
||||
# If HAVE_STATFS is empty, this Makefile will run the have_statfs program
|
||||
# to determine if statfs() is supported. If HAVE_STATFS is set to
|
||||
# -DHAVE_NO_STATFS, then calc will use internal functions to simulate
|
||||
# the statfs() function that gets file system statistics.
|
||||
#
|
||||
# Select HAVE_STATFS= -DHAVE_NO_STATFS for DJGPP.
|
||||
#
|
||||
# If in doubt, leave HAVE_STATFS empty and this Makefile will figure it out.
|
||||
#
|
||||
HAVE_STATFS=
|
||||
#HAVE_STATFS= -DHAVE_NO_STATFS
|
||||
|
||||
# Determine if we have the <sys/vfs.h> include file.
|
||||
#
|
||||
# HAVE_SYS_VFS_H= let the Makefile look for the include file
|
||||
# HAVE_SYS_VFS_H= YES assume that the include file exists
|
||||
# HAVE_SYS_VFS_H= NO assume that the include file does not exist
|
||||
#
|
||||
# Select HAVE_SYS_VFS_H= NO for DJGPP.
|
||||
#
|
||||
# When in doubt, leave HAVE_SYS_VFS_H empty.
|
||||
#
|
||||
HAVE_SYS_VFS_H=
|
||||
#HAVE_SYS_VFS_H= YES
|
||||
#HAVE_SYS_VFS_H= NO
|
||||
|
||||
# Determine if we have the <sys/param.h> include file.
|
||||
#
|
||||
# HAVE_SYS_PARAM_H= let the Makefile look for the include file
|
||||
# HAVE_SYS_PARAM_H= YES assume that the include file exists
|
||||
# HAVE_SYS_PARAM_H= NO assume that the include file does not exist
|
||||
#
|
||||
# Select HAVE_SYS_PARAM_H= NO for DJGPP.
|
||||
#
|
||||
# When in doubt, leave HAVE_SYS_PARAM_H empty.
|
||||
#
|
||||
HAVE_SYS_PARAM_H=
|
||||
#HAVE_SYS_PARAM_H= YES
|
||||
#HAVE_SYS_PARAM_H= NO
|
||||
|
||||
# Determine if we have the <sys/mount.h> include file.
|
||||
#
|
||||
# HAVE_SYS_MOUNT_H= let the Makefile look for the include file
|
||||
# HAVE_SYS_MOUNT_H= YES assume that the include file exists
|
||||
# HAVE_SYS_MOUNT_H= NO assume that the include file does not exist
|
||||
#
|
||||
# Select HAVE_SYS_MOUNT_H= NO for DJGPP.
|
||||
#
|
||||
# When in doubt, leave HAVE_SYS_MOUNT_H empty.
|
||||
#
|
||||
HAVE_SYS_MOUNT_H=
|
||||
#HAVE_SYS_MOUNT_H= YES
|
||||
#HAVE_SYS_MOUNT_H= NO
|
||||
|
||||
# Determine if we have getsid()
|
||||
#
|
||||
# If HAVE_GETSID is empty, this Makefile will run the have_getsid program
|
||||
@@ -998,11 +1072,25 @@ CALCRC= ./.calcinit:~/.calcrc:${CALC_SHAREDIR}/startup
|
||||
# READLINE_INCLUDE Where the readline include files reside
|
||||
# (leave blank if they are /usr/include/readline)
|
||||
#
|
||||
# NOTE: If you select the 'USE_READLINE=' mode, then we recommend you set:
|
||||
#
|
||||
# READLINE_EXTRAS=
|
||||
# READLINE_INCLUDE=
|
||||
# READLINE_LIB=
|
||||
#
|
||||
# NOTE: The GNU-readline code is not shipped with calc. You must have
|
||||
# the appropriate headers and link libs installed on your system in
|
||||
# order to use it.
|
||||
#
|
||||
# If in doubt, set USE_READLINE, READLINE_LIB and READLINE_INCLUDE to nothing.
|
||||
# To disable the use of the GNU-readline facility (as well as ncurses), set:
|
||||
#
|
||||
# USE_READLINE=
|
||||
# READLINE_EXTRAS=
|
||||
# READLINE_INCLUDE=
|
||||
# READLINE_LIB=
|
||||
#
|
||||
# If in doubt, set USE_READLINE, READLINE_EXTRAS, READLINE_INCLUDE, and
|
||||
# READLINE_LIB to nothing.
|
||||
#
|
||||
#USE_READLINE=
|
||||
USE_READLINE= -DUSE_READLINE
|
||||
@@ -1151,7 +1239,7 @@ EXT=
|
||||
|
||||
# The default calc versions
|
||||
#
|
||||
VERSION= 2.14.1.3
|
||||
VERSION= 2.14.2.0
|
||||
|
||||
# Names of shared libraries with versions
|
||||
#
|
||||
@@ -1172,7 +1260,7 @@ CTAGS= ctags
|
||||
DATE= date
|
||||
DIFF= diff
|
||||
FMT= fmt
|
||||
GREP= egrep
|
||||
GREP= grep
|
||||
HOSTNAME= hostname
|
||||
LANG= C
|
||||
LDCONFIG= ldconfig
|
||||
@@ -1491,7 +1579,8 @@ BUILD_H_SRC= align32.h args.h calcerr.h conf.h endian_calc.h \
|
||||
have_string.h have_strlcat.h have_strlcpy.h have_times.h \
|
||||
have_uid_t.h have_unistd.h have_unused.h have_urandom.h \
|
||||
have_ustat.h longbits.h terminal.h have_environ.h \
|
||||
have_arc4random.h have_limits.h charbit.h
|
||||
have_arc4random.h have_limits.h charbit.h have_sys_vfs.h \
|
||||
have_sys_param.h have_sys_mount.h have_statfs.h
|
||||
|
||||
# we build these .c files during the make
|
||||
#
|
||||
@@ -1507,7 +1596,7 @@ UTIL_C_SRC= align32.c endian.c longbits.c have_newstr.c have_uid_t.c \
|
||||
have_ustat.c have_getsid.c have_getpgid.c have_environ.c \
|
||||
have_gettime.c have_getprid.c have_rusage.c have_strdup.c \
|
||||
have_unused.c have_ban_pragma.c have_strlcpy.c have_strlcat.c \
|
||||
have_arc4random.c charbit.c
|
||||
have_arc4random.c charbit.c have_statfs.c
|
||||
|
||||
# these awk and sed tools are used in the process of building BUILD_H_SRC
|
||||
# and BUILD_C_SRC
|
||||
@@ -1525,7 +1614,7 @@ UTIL_OBJS= endian.o longbits.o have_newstr.o have_uid_t.o \
|
||||
have_ustat.o have_getsid.o have_getpgid.o have_environ.o \
|
||||
have_gettime.o have_getprid.o ver_calc.o have_rusage.o have_strdup.o \
|
||||
have_unused.o have_ban_pragma.o have_strlcpy.o have_strlcat.o \
|
||||
have_arc4random.o charbit.o
|
||||
have_arc4random.o charbit.o have_statfs.o
|
||||
|
||||
# these temp files may be created (and removed) during the build of BUILD_C_SRC
|
||||
#
|
||||
@@ -1544,7 +1633,7 @@ UTIL_PROGS= align32${EXT} fposval${EXT} have_uid_t${EXT} have_const${EXT} \
|
||||
have_unused${EXT} have_fpos${EXT} have_fpos_pos${EXT} \
|
||||
have_offscl${EXT} have_rusage${EXT} have_ban_pragma${EXT} \
|
||||
have_strlcpy${EXT} have_strlcat${EXT} have_arc4random${EXT} \
|
||||
charbit${EXT}
|
||||
charbit${EXT} have_statfs${ENT}
|
||||
|
||||
# these utility files and scripts may be created in the process of building
|
||||
# the BUILD_H_SRC file set
|
||||
@@ -2006,7 +2095,7 @@ calc.usage: calc.1 ${MAKE_FILE} ${LOC_MKF}
|
||||
LESSCHARSET=iso8859 ${CALCPAGER} calc.1; \
|
||||
else \
|
||||
${NROFF} -man calc.1; \
|
||||
fi 2>&1 | ${GREP} -v 'cannot adjust line' | ${COL} -b > $@
|
||||
fi 2>&1 | ${GREP} -E -v 'cannot adjust line' | ${COL} -b > $@
|
||||
${Q} echo calc.usage formed
|
||||
|
||||
|
||||
@@ -2069,7 +2158,7 @@ conf.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2120,7 +2209,7 @@ endian_calc.h: endian.c have_stdlib.h have_unistd.h \
|
||||
${Q} ${RM} -f endian.o endian${EXT} $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2172,7 +2261,7 @@ charbit.h: charbit.c have_limits.h \
|
||||
${Q} ${RM} -f charbit.o charbit${EXT} $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2208,7 +2297,7 @@ longbits.h: longbits.c charbit.h have_unistd.h have_stdlib.h \
|
||||
${Q} ${RM} -f longbits.o longbits${EXT} $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2238,7 +2327,7 @@ have_times.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2304,7 +2393,7 @@ have_stdlib.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2340,7 +2429,7 @@ have_unistd.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2376,7 +2465,7 @@ have_limits.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2412,7 +2501,7 @@ have_string.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2448,7 +2537,7 @@ terminal.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2502,7 +2591,7 @@ have_fgetsetpos.h: have_fgetsetpos.c banned.h have_ban_pragma.h ${MAKE_FILE} ${L
|
||||
${Q} ${RM} -f fpos_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2545,7 +2634,7 @@ have_fpos_pos.h: have_fpos_pos.c have_fgetsetpos.h have_posscl.h have_string.h \
|
||||
${Q} ${RM} -f fpos_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2591,7 +2680,7 @@ fposval.h: fposval.c have_fgetsetpos.h have_fpos_pos.h have_offscl.h have_posscl
|
||||
${Q} ${RM} -f fposval_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2633,7 +2722,7 @@ have_const.h: have_const.c banned.h have_ban_pragma.h ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f have_const const_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2676,7 +2765,7 @@ have_offscl.h: have_offscl.c have_unistd.h \
|
||||
${Q} ${RM} -f offscl_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2717,7 +2806,7 @@ have_posscl.h: have_posscl.c have_fgetsetpos.h have_unistd.h \
|
||||
${Q} ${RM} -f have_posscl have_posscl.o posscl_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2758,7 +2847,7 @@ align32.h: align32.c longbits.h have_unistd.h \
|
||||
${Q} ${RM} -f align32 align32_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2813,7 +2902,7 @@ have_uid_t.h: have_uid_t.c have_unistd.h \
|
||||
${Q} ${RM} -f have_uid_t uid_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2854,7 +2943,7 @@ have_environ.h: have_environ.c \
|
||||
${Q} ${RM} -f have_environ environ_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2895,7 +2984,7 @@ have_arc4random.h: have_arc4random.c have_stdlib.h \
|
||||
${Q} ${RM} -f have_arc4random arc4random_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2936,7 +3025,7 @@ have_newstr.h: have_newstr.c banned.h have_ban_pragma.h have_string.h ${MAKE_FIL
|
||||
${Q} ${RM} -f newstr_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -2976,7 +3065,7 @@ have_memmv.h: have_memmv.c banned.h have_ban_pragma.h have_string.h ${MAKE_FILE}
|
||||
${Q} ${RM} -f have_memmv have_memmv.o memmv_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3016,7 +3105,7 @@ have_ustat.h: have_ustat.c banned.h have_ban_pragma.h ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f ustat_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3051,12 +3140,161 @@ have_ustat.h: have_ustat.c banned.h have_ban_pragma.h ${MAKE_FILE} ${LOC_MKF}
|
||||
${TRUE}; \
|
||||
fi
|
||||
|
||||
have_statfs.h: have_statfs.c banned.h have_ban_pragma.h have_sys_vfs.h have_sys_param.h \
|
||||
have_sys_mount.h ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f statfs_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '#if !defined(CALC_HAVE_STATFS_H)' >> $@
|
||||
${Q} echo '#define CALC_HAVE_STATFS_H' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '/* do we have or want statfs()? */' >> $@
|
||||
${Q} ${RM} -f have_statfs.o have_statfs${EXT}
|
||||
-${Q} ${LCC} ${ICFLAGS} ${HAVE_STATFS} have_statfs.c -c ${S} \
|
||||
|| ${TRUE}
|
||||
-${Q} ${LCC} ${ILDFLAGS} have_statfs.o -o have_statfs ${S} \
|
||||
|| ${TRUE}
|
||||
-${Q} ./have_statfs${EXT} > statfs_tmp ${E} \
|
||||
|| ${TRUE}
|
||||
-${Q} if [ -s statfs_tmp ]; then \
|
||||
${CAT} statfs_tmp >> $@; \
|
||||
else \
|
||||
echo '#undef HAVE_STATFS /* no */' >> $@; \
|
||||
fi
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '#endif /* !CALC_HAVE_STATFS_H */' >> $@
|
||||
${Q} ${RM} -f have_statfs${EXT} have_statfs.o statfs_tmp
|
||||
${H} echo '$@ formed'
|
||||
-@if [ -z "${Q}" ]; then \
|
||||
echo ''; \
|
||||
echo '=-=-= start of $@ =-=-='; \
|
||||
${CAT} $@; \
|
||||
echo '=-=-= end of $@ =-=-='; \
|
||||
echo ''; \
|
||||
else \
|
||||
${TRUE}; \
|
||||
fi
|
||||
|
||||
have_sys_vfs.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '#if !defined(CALC_HAVE_SYS_VFS_H)' >> $@
|
||||
${Q} echo '#define CALC_HAVE_SYS_VFS_H' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '/* do we have <sys/vfs.h>? */' >> $@
|
||||
-${Q} if [ X"${HAVE_SYS_VFS_H}" = X"YES" ]; then \
|
||||
echo '#define HAVE_SYS_VFS_H /* yes */' >> $@; \
|
||||
elif [ X"${HAVE_SYS_VFS_H}" = X"NO" ]; then \
|
||||
echo '#undef HAVE_SYS_VFS_H /* no */' >> $@; \
|
||||
elif echo '#include <sys/vfs.h>' | ${CC} -E - ${S}; then \
|
||||
echo '#define HAVE_SYS_VFS_H /* yes */' >> $@; \
|
||||
else \
|
||||
echo '#undef HAVE_SYS_VFS_H /* no */' >> $@; \
|
||||
fi
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '#endif /* !CALC_HAVE_SYS_VFS_H */' >> $@
|
||||
${H} echo '$@ formed'
|
||||
-@if [ -z "${Q}" ]; then \
|
||||
echo ''; \
|
||||
echo '=-=-= start of $@ =-=-='; \
|
||||
${CAT} $@; \
|
||||
echo '=-=-= end of $@ =-=-='; \
|
||||
echo ''; \
|
||||
else \
|
||||
${TRUE}; \
|
||||
fi
|
||||
|
||||
have_sys_param.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '#if !defined(CALC_HAVE_SYS_PARAM_H)' >> $@
|
||||
${Q} echo '#define CALC_HAVE_SYS_PARAM_H' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '/* do we have <sys/param.h>? */' >> $@
|
||||
-${Q} if [ X"${HAVE_SYS_PARAM_H}" = X"YES" ]; then \
|
||||
echo '#define HAVE_SYS_PARAM_H /* yes */' >> $@; \
|
||||
elif [ X"${HAVE_SYS_PARAM_H}" = X"NO" ]; then \
|
||||
echo '#undef HAVE_SYS_PARAM_H /* no */' >> $@; \
|
||||
elif echo '#include <sys/param.h>' | ${CC} -E - ${S}; then \
|
||||
echo '#define HAVE_SYS_PARAM_H /* yes */' >> $@; \
|
||||
else \
|
||||
echo '#undef HAVE_SYS_PARAM_H /* no */' >> $@; \
|
||||
fi
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '#endif /* !CALC_HAVE_SYS_PARAM_H */' >> $@
|
||||
${H} echo '$@ formed'
|
||||
-@if [ -z "${Q}" ]; then \
|
||||
echo ''; \
|
||||
echo '=-=-= start of $@ =-=-='; \
|
||||
${CAT} $@; \
|
||||
echo '=-=-= end of $@ =-=-='; \
|
||||
echo ''; \
|
||||
else \
|
||||
${TRUE}; \
|
||||
fi
|
||||
|
||||
have_sys_mount.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '#if !defined(CALC_HAVE_SYS_MOUNT_H)' >> $@
|
||||
${Q} echo '#define CALC_HAVE_SYS_MOUNT_H' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '/* do we have <sys/param.h>? */' >> $@
|
||||
-${Q} if [ X"${HAVE_SYS_MOUNT_H}" = X"YES" ]; then \
|
||||
echo '#define HAVE_SYS_MOUNT_H /* yes */' >> $@; \
|
||||
elif [ X"${HAVE_SYS_MOUNT_H}" = X"NO" ]; then \
|
||||
echo '#undef HAVE_SYS_MOUNT_H /* no */' >> $@; \
|
||||
elif echo '#include <sys/param.h>' | ${CC} -E - ${S}; then \
|
||||
echo '#define HAVE_SYS_MOUNT_H /* yes */' >> $@; \
|
||||
else \
|
||||
echo '#undef HAVE_SYS_MOUNT_H /* no */' >> $@; \
|
||||
fi
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '#endif /* !CALC_HAVE_SYS_MOUNT_H */' >> $@
|
||||
${H} echo '$@ formed'
|
||||
-@if [ -z "${Q}" ]; then \
|
||||
echo ''; \
|
||||
echo '=-=-= start of $@ =-=-='; \
|
||||
${CAT} $@; \
|
||||
echo '=-=-= end of $@ =-=-='; \
|
||||
echo ''; \
|
||||
else \
|
||||
${TRUE}; \
|
||||
fi
|
||||
|
||||
have_getsid.h: have_getsid.c have_unistd.h \
|
||||
banned.h have_ban_pragma.h ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f getsid_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3097,7 +3335,7 @@ have_getpgid.h: have_getpgid.c have_unistd.h \
|
||||
${Q} ${RM} -f getpgid_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3138,7 +3376,7 @@ have_gettime.h: have_gettime.c banned.h have_ban_pragma.h \
|
||||
${Q} ${RM} -f gettime_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3179,7 +3417,7 @@ have_getprid.h: have_getprid.c have_unistd.h \
|
||||
${Q} ${RM} -f getprid_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3219,7 +3457,7 @@ have_urandom.h: ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3255,7 +3493,7 @@ have_rusage.h: have_rusage.c banned.h have_ban_pragma.h ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f rusage_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3295,7 +3533,7 @@ have_strdup.h: have_strdup.c banned.h have_ban_pragma.h have_string.h ${MAKE_FIL
|
||||
${Q} ${RM} -f strdup_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3336,7 +3574,7 @@ args.h: have_stdvs.c have_varvs.c have_string.h have_unistd.h \
|
||||
${Q} ${RM} -f $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3449,7 +3687,7 @@ have_unused.h: have_unused.c have_stdlib.h have_ban_pragma.h \
|
||||
${Q} ${RM} -f unused_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3491,7 +3729,7 @@ have_ban_pragma.h: have_ban_pragma.c banned.h ${MAKE_FILE} ${LOC_MKF}
|
||||
${Q} ${RM} -f unused_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3534,7 +3772,7 @@ have_strlcpy.h: have_strlcpy.c banned.h have_ban_pragma.h have_string.h \
|
||||
${Q} ${RM} -f unused_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3576,7 +3814,7 @@ have_strlcat.h: have_strlcat.c banned.h have_ban_pragma.h have_string.h \
|
||||
${Q} ${RM} -f unused_tmp $@
|
||||
${H} echo 'forming $@'
|
||||
${Q} echo '/*' > $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile' >> $@
|
||||
${Q} echo ' * DO NOT EDIT -- generated by the Makefile rule $@' >> $@
|
||||
${Q} echo ' */' >> $@
|
||||
${Q} echo '' >> $@
|
||||
${Q} echo '' >> $@
|
||||
@@ -3761,6 +3999,12 @@ depend: hsrc custom/Makefile
|
||||
else \
|
||||
${TRUE}; \
|
||||
fi
|
||||
${Q} if type -f ${MAKEDEPEND}; then \
|
||||
${TRUE}; \
|
||||
else \
|
||||
echo "make depend failed: cannot find makedepend command: ${MAKEDEPEND}" 1>&2; \
|
||||
exit 1; \
|
||||
fi
|
||||
${V} echo '=-=-=-=-= Invoking depend rule for cscript =-=-=-=-='
|
||||
${Q} cd cscript; ${MAKE} -f Makefile ${CSCRIPT_PASSDOWN} depend
|
||||
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
|
||||
@@ -3772,7 +4016,7 @@ depend: hsrc custom/Makefile
|
||||
${Q} ${MKDIR} -p skel
|
||||
-${Q} for i in ${C_SRC} ${BUILD_C_SRC}; do \
|
||||
${SED} -n '/^#[ ]*include[ ]*"/p' "$$i" | \
|
||||
${GREP} -v '\.\./getopt/getopt\.h' > "skel/$$i"; \
|
||||
${GREP} -E -v '\.\./getopt/getopt\.h' > "skel/$$i"; \
|
||||
done
|
||||
${Q} ${MKDIR} -p skel/custom
|
||||
-${Q} for i in ${H_SRC} ${BUILD_H_SRC} custom.h /dev/null; do \
|
||||
@@ -3816,7 +4060,7 @@ depend: hsrc custom/Makefile
|
||||
${Q} ${MV} ${MAKE_FILE} ${MAKE_FILE}.bak
|
||||
${Q} ${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' \
|
||||
${MAKE_FILE}.bak > ${MAKE_FILE}
|
||||
${Q} ${GREP} -v '^#' skel/makedep.out >> ${MAKE_FILE}
|
||||
${Q} ${GREP} -E -v '^#' skel/makedep.out >> ${MAKE_FILE}
|
||||
${Q} echo removing top level skel
|
||||
${Q} ${RM} -rf skel
|
||||
-${Q} if ${CMP} -s ${MAKE_FILE}.bak ${MAKE_FILE}; then \
|
||||
@@ -4134,13 +4378,17 @@ env:
|
||||
@echo 'HAVE_OFFSCL=${HAVE_OFFSCL}'; echo ''
|
||||
@echo 'HAVE_POSSCL=${HAVE_POSSCL}'; echo ''
|
||||
@echo 'HAVE_PRAGMA_GCC_POSION=${HAVE_PRAGMA_GCC_POSION}'; echo ''
|
||||
@echo 'HAVE_STATFS=${HAVE_STATFS}'; echo ''
|
||||
@echo 'HAVE_STDLIB_H=${HAVE_STDLIB_H}'; echo ''
|
||||
@echo 'HAVE_STRDUP=${HAVE_STRDUP}'; echo ''
|
||||
@echo 'HAVE_STRING_H=${HAVE_STRING_H}'; echo ''
|
||||
@echo 'HAVE_STRLCAT=${HAVE_STRLCAT}'; echo ''
|
||||
@echo 'HAVE_STRLCPY=${HAVE_STRLCPY}'; echo ''
|
||||
@echo 'HAVE_SYS_MOUNT_H=${HAVE_SYS_MOUNT_H}'; echo ''
|
||||
@echo 'HAVE_SYS_PARAM_H=${HAVE_SYS_PARAM_H}'; echo ''
|
||||
@echo 'HAVE_SYS_TIMES_H=${HAVE_SYS_TIMES_H}'; echo ''
|
||||
@echo 'HAVE_SYS_TIME_H=${HAVE_SYS_TIME_H}'; echo ''
|
||||
@echo 'HAVE_SYS_VFS_H=${HAVE_SYS_VFS_H}'; echo ''
|
||||
@echo 'HAVE_TIMES_H=${HAVE_TIMES_H}'; echo ''
|
||||
@echo 'HAVE_TIME_H=${HAVE_TIME_H}'; echo ''
|
||||
@echo 'HAVE_UID_T=${HAVE_UID_T}'; echo ''
|
||||
@@ -4180,18 +4428,18 @@ env:
|
||||
@echo 'MANEXT=${MANEXT}'; echo ''
|
||||
@echo 'MANMAKE=${MANMAKE}'; echo ''
|
||||
@echo 'MANMODE=${MANMODE}'; echo ''
|
||||
@echo 'MKDIR=${MKDIR}'; echo ''
|
||||
@echo 'MINGW=${MINGW}'; echo ''
|
||||
@echo 'MKDIR=${MKDIR}'; echo ''
|
||||
@echo 'MV=${MV}'; echo ''
|
||||
@echo 'NROFF=${NROFF}'; echo ''
|
||||
@echo 'NROFF_ARG=${NROFF_ARG}'; echo ''
|
||||
@echo 'OBJS=${OBJS}'; echo ''
|
||||
@echo 'OFF_T_BITS=${OFF_T_BITS}'; echo ''
|
||||
@echo 'PREFIX=${PREFIX}'; echo ''
|
||||
@echo 'PURIFY=${PURIFY}'; echo ''
|
||||
@echo 'PWD=${PWD}'; echo ''
|
||||
@echo 'PWDCMD=${PWDCMD}'; echo ''
|
||||
@echo 'Q=${Q}'; echo ''
|
||||
@echo 'PREFIX=${PREFIX}'; echo ''
|
||||
@echo 'RANLIB=${RANLIB}'; echo ''
|
||||
@echo 'READLINE_EXTRAS=${READLINE_EXTRAS}'; echo ''
|
||||
@echo 'READLINE_INCLUDE=${READLINE_INCLUDE}'; echo ''
|
||||
@@ -4382,16 +4630,16 @@ inst_files: ${MAKE_FILE} ${LOC_MKF} help/Makefile cal/Makefile \
|
||||
${Q} echo ${BINDIR}/calc${EXT} > inst_files
|
||||
${Q} cd help; LANG=C \
|
||||
${MAKE} -f Makefile ${HELP_PASSDOWN} echo_inst_files | \
|
||||
${GREP} '__file__..' | ${SED} -e s'/.*__file__ //' >> ../inst_files
|
||||
${GREP} -E '__file__..' | ${SED} -e s'/.*__file__ //' >> ../inst_files
|
||||
${Q} cd cal; LANG=C \
|
||||
${MAKE} -f Makefile ${CAL_PASSDOWN} echo_inst_files | \
|
||||
${GREP} '__file__..' | ${SED} -e s'/.*__file__ //' >> ../inst_files
|
||||
${GREP} -E '__file__..' | ${SED} -e s'/.*__file__ //' >> ../inst_files
|
||||
${Q} cd custom; LANG=C \
|
||||
${MAKE} -f Makefile ${CUSTOM_PASSDOWN} echo_inst_files | \
|
||||
${GREP} '__file__..' | ${SED} -e s'/.*__file__ //' >> ../inst_files
|
||||
${GREP} -E '__file__..' | ${SED} -e s'/.*__file__ //' >> ../inst_files
|
||||
${Q} cd cscript; LANG=C \
|
||||
${MAKE} -f Makefile ${CSCRIPT_PASSDOWN} echo_inst_files | \
|
||||
${GREP} '__file__..' | ${SED} -e s'/.*__file__ //' >> ../inst_files
|
||||
${GREP} -E '__file__..' | ${SED} -e s'/.*__file__ //' >> ../inst_files
|
||||
${Q} echo ${LIBDIR}/libcalc.a >> inst_files
|
||||
${Q} for i in ${LIB_H_SRC} ${BUILD_H_SRC} /dev/null; do \
|
||||
if [ X"$$i" != X"/dev/null" ]; then \
|
||||
@@ -4443,7 +4691,7 @@ olduninstall:
|
||||
|
||||
tags: ${CALCSRC} ${LIBSRC} ${H_SRC} ${BUILD_H_SRC} ${MAKE_FILE}
|
||||
-${CTAGS} ${CALCSRC} ${LIBSRC} ${H_SRC} ${BUILD_H_SRC} 2>&1 | \
|
||||
${GREP} -v 'Duplicate entry|Second entry ignored'
|
||||
${GREP} -E -v 'Duplicate entry|Second entry ignored'
|
||||
|
||||
clean:
|
||||
${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
|
||||
@@ -5451,7 +5699,9 @@ file.o: strl.h
|
||||
file.o: value.h
|
||||
file.o: zmath.h
|
||||
fposval.o: alloc.h
|
||||
fposval.o: attribute.h
|
||||
fposval.o: banned.h
|
||||
fposval.o: byteswap.h
|
||||
fposval.o: decl.h
|
||||
fposval.o: endian_calc.h
|
||||
fposval.o: fposval.c
|
||||
@@ -5463,8 +5713,11 @@ fposval.o: have_memmv.h
|
||||
fposval.o: have_newstr.h
|
||||
fposval.o: have_offscl.h
|
||||
fposval.o: have_posscl.h
|
||||
fposval.o: have_stdlib.h
|
||||
fposval.o: have_string.h
|
||||
fposval.o: have_unused.h
|
||||
fposval.o: longbits.h
|
||||
fposval.o: zmath.h
|
||||
func.o: alloc.h
|
||||
func.o: attribute.h
|
||||
func.o: banned.h
|
||||
@@ -5595,6 +5848,12 @@ have_posscl.o: have_unistd.h
|
||||
have_rusage.o: banned.h
|
||||
have_rusage.o: have_ban_pragma.h
|
||||
have_rusage.o: have_rusage.c
|
||||
have_statfs.o: banned.h
|
||||
have_statfs.o: have_ban_pragma.h
|
||||
have_statfs.o: have_statfs.c
|
||||
have_statfs.o: have_sys_mount.h
|
||||
have_statfs.o: have_sys_param.h
|
||||
have_statfs.o: have_sys_vfs.h
|
||||
have_stdvs.o: banned.h
|
||||
have_stdvs.o: have_ban_pragma.h
|
||||
have_stdvs.o: have_stdlib.h
|
||||
@@ -6225,8 +6484,12 @@ seed.o: have_gettime.h
|
||||
seed.o: have_memmv.h
|
||||
seed.o: have_newstr.h
|
||||
seed.o: have_rusage.h
|
||||
seed.o: have_statfs.h
|
||||
seed.o: have_stdlib.h
|
||||
seed.o: have_string.h
|
||||
seed.o: have_sys_mount.h
|
||||
seed.o: have_sys_param.h
|
||||
seed.o: have_sys_vfs.h
|
||||
seed.o: have_times.h
|
||||
seed.o: have_uid_t.h
|
||||
seed.o: have_unistd.h
|
||||
|
33
QUESTIONS
33
QUESTIONS
@@ -1,37 +1,28 @@
|
||||
If you have a simple general question about calc, send Email to:
|
||||
If you have a general question about calc, consider opening
|
||||
a new Github discussion under:
|
||||
|
||||
calc-quest-mail at asthe dot com
|
||||
https://github.com/lcn2/calc/discussions
|
||||
|
||||
NOTE: Remove spaces and replace 'at' with @, and 'dot' with .
|
||||
Look over the existing discussions to see of your question fits
|
||||
under one of those exiting discussions.
|
||||
|
||||
PLEASE put following the SPECIAL PHRASE somewhere in your Email Subject line:
|
||||
You may wish to add your question as a comment to an existing discussion.
|
||||
Otherwise click on:
|
||||
|
||||
calc question
|
||||
((New discussion))
|
||||
|
||||
You may add additional words to your subject line.
|
||||
|
||||
IMPORTANT: If your Email doesn't contain the above phrase,
|
||||
then we WILL NOT SEE your Email.
|
||||
|
||||
PLEASE BE SURE you have that SPECIAL PHRASE somewhere in the subject line!
|
||||
|
||||
Suggestion:
|
||||
|
||||
From time to time, the Email address and Subject SPECIAL PHRASE
|
||||
may change so verify you have the current info by visiting:
|
||||
|
||||
http://www.isthe.com/chongo/tech/comp/calc/calc-question.html
|
||||
and ask your question in that new discussion.
|
||||
|
||||
Please limit your questions to general questions about calc. We
|
||||
cannot go into great detail in our answers, nor can we do your
|
||||
homework, nor can we do much more than answer short general questions
|
||||
homework, nor can we do much more than answer general questions
|
||||
about calc.
|
||||
|
||||
Please be patient as we cannot always respond to Email messages quickly.
|
||||
Please be patient as we cannot always respond to discussion messages quickly.
|
||||
|
||||
=-=
|
||||
|
||||
## Copyright (C) 2021 Landon Curt Noll
|
||||
## Copyright (C) 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
|
||||
|
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
|
||||
|
46
cal/Makefile
46
cal/Makefile
@@ -1,8 +1,8 @@
|
||||
#!/bin/make
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# cal - makefile for calc standard resource files
|
||||
#
|
||||
# Copyright (C) 1999-2006,2017,2021,2022 Landon Curt Noll
|
||||
# Copyright (C) 1999-2006,2017,2021-2023 Landon Curt Noll
|
||||
#
|
||||
# SRC: cal/Makefile
|
||||
#
|
||||
@@ -44,20 +44,21 @@
|
||||
# If your system has a up to date, bash shell, then
|
||||
# you may wish to use:
|
||||
#
|
||||
# SHELL= /bin/bash
|
||||
# SHELL= 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
|
||||
# SHELL= sh
|
||||
#
|
||||
SHELL= /bin/bash
|
||||
#SHELL= /bin/sh
|
||||
SHELL= bash
|
||||
#SHELL= sh
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
#
|
||||
ifeq ($(target),Darwin)
|
||||
SHELL:= /bin/zsh
|
||||
SHELL:= /bin/sh
|
||||
endif
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
|
||||
@@ -266,21 +267,22 @@ TRUE= true
|
||||
# to keep this list in nice sorted order.
|
||||
#
|
||||
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
|
||||
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 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.
|
||||
#
|
||||
|
54
cal/README
54
cal/README
@@ -1433,6 +1433,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)
|
||||
|
@@ -4,19 +4,37 @@
|
||||
* This file was created by Ernest Bowen <ebowen at une dot edu dot au>
|
||||
* and modified by Landon Curt Noll.
|
||||
*
|
||||
* This dotest_code has been placed in the public domain. Please do not
|
||||
* copyright this dotest_code.
|
||||
*
|
||||
* ERNEST BOWEN AND LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
||||
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MER-
|
||||
* CHANTABILITY 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.
|
||||
*
|
||||
* This file is not covered under version 2.1 of the GNU LGPL.
|
||||
* This file is covered under "The unlicense":
|
||||
*
|
||||
* https://unlicense.org
|
||||
*
|
||||
* In particular:
|
||||
*
|
||||
* 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/>
|
||||
*
|
||||
* Under source dotest_code control: 2006/03/08 05:54:09
|
||||
* File existed as early as: 2006
|
||||
|
@@ -3,19 +3,37 @@
|
||||
*
|
||||
* This file was created by Ernest Bowen <ebowen at une dot edu dot au>.
|
||||
*
|
||||
* This code has been placed in the public domain. Please do not
|
||||
* copyright this code.
|
||||
*
|
||||
* ERNEST BOWEN DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
||||
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MER-
|
||||
* CHANTABILITY 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.
|
||||
*
|
||||
* This file is not covered under version 2.1 of the GNU LGPL.
|
||||
* This file is covered under "The unlicense":
|
||||
*
|
||||
* https://unlicense.org
|
||||
*
|
||||
* In particular:
|
||||
*
|
||||
* 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/>
|
||||
*
|
||||
* Under source code control: 2006/03/08 05:54:09
|
||||
* File existed as early as: 2006
|
||||
|
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;
|
||||
}
|
15
calc.c
15
calc.c
@@ -108,8 +108,6 @@ main(int argc, char **argv)
|
||||
int c; /* option */
|
||||
int index;
|
||||
int maxindex;
|
||||
/* fix gcc warning bug */
|
||||
int unusedint = 0;
|
||||
char *cp;
|
||||
char *endcp;
|
||||
char *bp;
|
||||
@@ -289,9 +287,7 @@ main(int argc, char **argv)
|
||||
exit(6);
|
||||
}
|
||||
calc_debug = cp;
|
||||
/* fix gcc warning bug */
|
||||
unusedint =
|
||||
strtol(cp, &endcp, 10);
|
||||
(void) strtol(cp, &endcp, 10);
|
||||
cp = endcp;
|
||||
if (*cp != '\0' &&
|
||||
*cp != ' ' && *cp != ':') {
|
||||
@@ -323,9 +319,7 @@ main(int argc, char **argv)
|
||||
exit(9);
|
||||
}
|
||||
resource_debug = cp;
|
||||
/* fix gcc warning bug */
|
||||
unusedint =
|
||||
strtol(cp, &endcp, 10);
|
||||
(void) strtol(cp, &endcp, 10);
|
||||
cp = endcp;
|
||||
if (*cp != '\0' &&
|
||||
*cp != ' ' && *cp != ':') {
|
||||
@@ -355,8 +349,7 @@ main(int argc, char **argv)
|
||||
exit(12);
|
||||
}
|
||||
user_debug = cp;
|
||||
/* unusedint avoids gcc warning bug */
|
||||
unusedint = strtol(cp, &endcp, 10);
|
||||
(void) strtol(cp, &endcp, 10);
|
||||
cp = endcp;
|
||||
if (*cp != '\0' && *cp != ' ') {
|
||||
fprintf(stderr, "Bad syntax in"
|
||||
@@ -765,8 +758,6 @@ main(int argc, char **argv)
|
||||
/*
|
||||
* All done! - Jessica Noll, Age 2
|
||||
*/
|
||||
/* fix gcc warning bug */
|
||||
unusedint++;
|
||||
libcalc_call_me_last();
|
||||
return (run_state == RUN_EXIT_WITH_ERROR ||
|
||||
run_state == RUN_ZERO) ? 1 : 0;
|
||||
|
303
calc.man
303
calc.man
@@ -1225,6 +1225,7 @@ The calc commands:
|
||||
help copyright
|
||||
help copying
|
||||
help copying-lgpl
|
||||
help credit
|
||||
.fi
|
||||
.in -0.5i
|
||||
.sp
|
||||
@@ -1259,6 +1260,10 @@ Copyright (C) year David I. Bell, Landon Curt Noll and Ernest Bowen
|
||||
Copyright (C) year Landon Curt Noll
|
||||
Copyright (C) year Ernest Bowen and Landon Curt Noll
|
||||
Copyright (C) year Ernest Bowen
|
||||
Copyright (C) year Petteri Kettunen and Landon Curt Noll
|
||||
Copyright (C) year Christoph Zurnieden
|
||||
Copyright (C) year Landon Curt Noll and Thomas Jones-Low
|
||||
Copyright (C) year Klaus Alexander Seistrup and Landon Curt Noll
|
||||
.fi
|
||||
.in -0.5i
|
||||
.sp
|
||||
@@ -1266,12 +1271,22 @@ This man page is:
|
||||
.sp
|
||||
.in +0.5i
|
||||
.nf
|
||||
Copyright (C) 1999-2021 Landon Curt Noll
|
||||
Copyright (C) 1999-2023 Landon Curt Noll
|
||||
.fi
|
||||
.in -0.5i
|
||||
.sp
|
||||
and is covered under version 2.1 GNU Lesser General
|
||||
Public License.
|
||||
.sp
|
||||
A few files in calc are covered under "The Unlicense".
|
||||
For more information on this license, see:
|
||||
.sp
|
||||
.in +0.5i
|
||||
.nf
|
||||
https://unlicense.org
|
||||
.fi
|
||||
.in -0.5i
|
||||
.sp
|
||||
|
||||
.PP
|
||||
|
||||
@@ -1279,61 +1294,38 @@ Public License.
|
||||
|
||||
.PP
|
||||
|
||||
If you have a simple general question about calc, send Email to:
|
||||
.sp
|
||||
.in +0.5i
|
||||
calc-quest-mail at asthe dot com
|
||||
.sp
|
||||
NOTE: Remove spaces and replace 'at' with @, and 'dot' with .
|
||||
.in -0.5i
|
||||
.sp
|
||||
.in +0.5i
|
||||
NOTE: Yes, the Email address uses 'asthe',
|
||||
while the web site uses 'isthe'.
|
||||
.in -0.5i
|
||||
.sp
|
||||
.B PLEASE
|
||||
put following the
|
||||
.B SPECIAL PHRASE
|
||||
somewhere in your Email Subject line:
|
||||
.sp
|
||||
.in +0.5i
|
||||
.B calc question
|
||||
.in -0.5i
|
||||
.sp
|
||||
You may add additional words to your subject line.
|
||||
.sp
|
||||
.B IMPORTANT:
|
||||
If your Email doesn't contain the above phrase,
|
||||
then we
|
||||
.B WILL NOT SEE
|
||||
your Email.
|
||||
.sp
|
||||
.B PLEASE BE SURE
|
||||
you have that
|
||||
.B SPECIAL PHRASE
|
||||
somewhere in the subject line!
|
||||
.sp
|
||||
.B Suggestion:
|
||||
.sp
|
||||
.in +0.5i
|
||||
From time to time, the Email address and Subject
|
||||
.B SPECIAL PHRASE
|
||||
may change so verify you have the current info by visiting:
|
||||
To ask the calc maintainers a general question about calc,
|
||||
see the output of the following calc command:
|
||||
|
||||
.sp
|
||||
.in +0.5i
|
||||
.nf
|
||||
http://www.isthe.com/chongo/tech/comp/calc/calc-question.html
|
||||
; help question
|
||||
.fi
|
||||
.in -0.5i
|
||||
.in -0.5i
|
||||
.in +0.5i
|
||||
.sp
|
||||
Please limit your questions to general questions about calc.
|
||||
We cannot go into great detail in our answers,
|
||||
nor can we do your homework, nor can
|
||||
we do much more than answer short general questions about calc.
|
||||
.PP
|
||||
|
||||
or read the source file:
|
||||
|
||||
.sp
|
||||
.in +0.5i
|
||||
.nf
|
||||
QUESTIONS
|
||||
.fi
|
||||
.in +0.5i
|
||||
.sp
|
||||
|
||||
.PP
|
||||
|
||||
or visit the following URL:
|
||||
.sp
|
||||
.in +0.5i
|
||||
.nf
|
||||
https://github.com/lcn2/calc/blob/master/QUESTIONS
|
||||
.fi
|
||||
.in +0.5i
|
||||
.sp
|
||||
Please be patient as we cannot always respond to Email messages quickly.
|
||||
|
||||
.PP
|
||||
|
||||
@@ -1341,71 +1333,37 @@ Please be patient as we cannot always respond to Email messages quickly.
|
||||
|
||||
.PP
|
||||
|
||||
Send bug reports and bug fixes to:
|
||||
To inform the calc maintainers about a bug, or to submit a bug fix,
|
||||
see the output of the following calc command:
|
||||
|
||||
.sp
|
||||
.in +0.5i
|
||||
.nf
|
||||
calc-bugrept at asthe dot com
|
||||
; help bugs
|
||||
.fi
|
||||
.sp
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
.sp
|
||||
NOTE: Yes, the Email address uses 'asthe',
|
||||
while the web site uses 'isthe'.
|
||||
.in -0.5i
|
||||
.sp
|
||||
You
|
||||
.B MUST
|
||||
use following
|
||||
.B SPECIAL PHRASE
|
||||
in your Email Subject line:
|
||||
.sp
|
||||
.in +0.5i
|
||||
.B calc bug report
|
||||
.in -0.5i
|
||||
.sp
|
||||
You may add additional words to your subject line.
|
||||
.sp
|
||||
.B Suggestion:
|
||||
.sp
|
||||
.in +0.5i
|
||||
From time to time, the Email address and Subject
|
||||
.B SPECIAL PHRASE
|
||||
may change so verify you have the current info by visiting:
|
||||
.PP
|
||||
|
||||
or read the source file:
|
||||
|
||||
.sp
|
||||
.in +0.5i
|
||||
.nf
|
||||
http://www.isthe.com/chongo/tech/comp/calc/calc-bugrept.html
|
||||
BUGS
|
||||
.fi
|
||||
.in -0.5i
|
||||
.in -0.5i
|
||||
.in +0.5i
|
||||
.sp
|
||||
.B IMPORTANT:
|
||||
If your Email doesn't contain the above phrase,
|
||||
then we
|
||||
.B WILL NOT SEE
|
||||
your Email.
|
||||
.sp
|
||||
.B PLEASE BE SURE
|
||||
you have that
|
||||
.B SPECIAL PHRASE
|
||||
somewhere in the subject line!
|
||||
.sp
|
||||
See the
|
||||
.I BUGS
|
||||
source file or use the
|
||||
.I calc
|
||||
command:
|
||||
.PP
|
||||
|
||||
or visit the following URL:
|
||||
.sp
|
||||
.in +0.5i
|
||||
.nf
|
||||
help bugs
|
||||
https://github.com/lcn2/calc/blob/master/BUGS
|
||||
.fi
|
||||
.in -0.5i
|
||||
.in +0.5i
|
||||
.sp
|
||||
for more information about bug reporting.
|
||||
.sp
|
||||
Please be patient as we cannot always respond to Email messages quickly.
|
||||
|
||||
.PP
|
||||
|
||||
@@ -1415,126 +1373,40 @@ Please be patient as we cannot always respond to Email messages quickly.
|
||||
|
||||
.I Calc
|
||||
is open source.
|
||||
Contributions of code are welcome.
|
||||
.sp
|
||||
We welcome and encourage you to send us:
|
||||
You are welcome to contribute code to calc, or submit bug fixes to to calc.
|
||||
.sp
|
||||
To contribute code to calc, please see see the output of
|
||||
the following calc command:
|
||||
|
||||
.sp
|
||||
.in +0.5i
|
||||
.nf
|
||||
* calc resource files (cal/*.cal)
|
||||
* calc shell scripts (cscript/*.calc)
|
||||
* builtin functions that you have modified or written, i.e.:
|
||||
assocfunc.c comfunc.c func.c func.h
|
||||
listfunc.c matfunc.c qfunc.c zfunc.c
|
||||
* custom functions that you have modified or written (custom/*)
|
||||
* help files modified or written (help/*)
|
||||
* brief description of you added, fixed, improved in CHANGES
|
||||
* regression test cases (cal/regress.cal)
|
||||
* Makefile improvements (Makefile, */Makefile)
|
||||
* other source code modifications (*.c, *.h)
|
||||
* etc. (* */* :) )
|
||||
; help contrib
|
||||
.fi
|
||||
.in -0.5i
|
||||
.sp
|
||||
If you add functionality to calc, please be sure to modify/patch/add
|
||||
Makefiles, help files, cal/regress.cal test code as well.
|
||||
Regression test cases are vital to maintaining calc's level
|
||||
of correctness and helps us avoid code bug regression.
|
||||
.sp
|
||||
In order to consider integrating your code, we need:
|
||||
.sp
|
||||
.nf
|
||||
.in +0.5i
|
||||
* calc version you are working with (please try use the latest version)
|
||||
* new help files or help file patches, if applicable (documentation)
|
||||
* proposed text for the CHANGES file (brief description of what it does)
|
||||
* regress.cal test patch as needed
|
||||
* your source code and/or source code changes (:-))
|
||||
.in -0.5i
|
||||
.fi
|
||||
.sp
|
||||
The best way to send us new code, if your changes are small, is
|
||||
via a patch (diff -c from the latest alpha code to your code).
|
||||
If your change is large, you should send entire files (either
|
||||
as a diff -c /dev/null your-file patch, or as a uuencoded and
|
||||
gziped (or compressed) tar file).
|
||||
.sp
|
||||
Please try to generate a patch against the most recent
|
||||
version of calc, and if you use GitHub, the top of the
|
||||
master branch:
|
||||
.sp
|
||||
.nf
|
||||
.in +0.5i
|
||||
https://github.com/lcn2/calc
|
||||
.in -0.5i
|
||||
.fi
|
||||
.sp
|
||||
.sp
|
||||
The best way contribute to calc bug is to generate calc
|
||||
GitHub pull request:
|
||||
.sp
|
||||
.nf
|
||||
.in +0.5i
|
||||
https://github.com/lcn2/calc/pulls
|
||||
.in -0.5i
|
||||
.fi
|
||||
.sp
|
||||
Your code needs to be contributed under either the 2.1 of the
|
||||
.B GNU Lesser General Public License (LGPL 2.1)
|
||||
or be in the public domain.
|
||||
.sp
|
||||
If you do not want to use calc GitHub, then send Email to:
|
||||
|
||||
.PP
|
||||
|
||||
or read the source file:
|
||||
|
||||
.sp
|
||||
.in +0.5i
|
||||
.nf
|
||||
calc-contrib at asthe dot com
|
||||
CONTRIB-CODE
|
||||
.fi
|
||||
.sp
|
||||
NOTE: Remove spaces and replace 'at' with @, 'dot' with .
|
||||
.sp
|
||||
NOTE: Yes, the Email address uses 'asthe',
|
||||
while the web site uses 'isthe'.
|
||||
.in -0.5i
|
||||
.sp
|
||||
You
|
||||
.B MUST
|
||||
use following
|
||||
.B SPECIAL PHRASE
|
||||
in your Email Subject line:
|
||||
.sp
|
||||
.in +0.5i
|
||||
.B calc contribution
|
||||
.in -0.5i
|
||||
.sp
|
||||
You may add additional words to your subject line.
|
||||
.sp
|
||||
.B Suggestion:
|
||||
.sp
|
||||
.in +0.5i
|
||||
From time to time, the Email address and Subject
|
||||
.B SPECIAL PHRASE
|
||||
may change so verify you have the current info by visiting:
|
||||
|
||||
.PP
|
||||
|
||||
or visit the following URL:
|
||||
.sp
|
||||
.in +0.5i
|
||||
.nf
|
||||
http://www.isthe.com/chongo/tech/comp/calc/calc-contrib.html
|
||||
https://github.com/lcn2/calc/blob/master/CONTRIB-CODE
|
||||
.fi
|
||||
.in -0.5i
|
||||
.in -0.5i
|
||||
.in +0.5i
|
||||
.sp
|
||||
.B IMPORTANT:
|
||||
If your Email doesn't contain the above phrase,
|
||||
then we
|
||||
.B WILL NOT SEE
|
||||
your Email.
|
||||
.sp
|
||||
.B PLEASE BE SURE
|
||||
you have that
|
||||
.B SPECIAL PHRASE
|
||||
somewhere in the subject line!
|
||||
.sp
|
||||
Please be patient as we cannot always respond to Email messages quickly.
|
||||
|
||||
.PP
|
||||
|
||||
@@ -1549,5 +1421,30 @@ web site is located at:
|
||||
.in +0.5i
|
||||
www.isthe.com/chongo/tech/comp/calc/
|
||||
.in -0.5i
|
||||
|
||||
.SH "CALC SOURCE CODE"
|
||||
|
||||
The latest version of calc source code may be obtained at
|
||||
the following GitHub repo:
|
||||
.sp
|
||||
Share and Enjoy! :\-)
|
||||
.in +0.5i
|
||||
https://github.com/lcn2/calc
|
||||
.in -0.5i
|
||||
.sp
|
||||
The very latest calc souece is found at the top master branch.
|
||||
|
||||
.PP
|
||||
|
||||
You may download the calc releases from:
|
||||
.sp
|
||||
.in +0.5i
|
||||
https://github.com/lcn2/calc/releases
|
||||
.in -0.5i
|
||||
.sp
|
||||
The releases marked
|
||||
.B ((Pre-release))
|
||||
are beta releases.
|
||||
.sp
|
||||
The most recent release that is NOT marked
|
||||
.B ((Pre-release))
|
||||
is the recommended stable release.
|
||||
|
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# cscript - makefile for calc shell script files
|
||||
#
|
||||
# Copyright (C) 1999-2006,2014,2017,2021,2022 Landon Curt Noll
|
||||
# Copyright (C) 1999-2006,2014,2017,2021-2023 Landon Curt Noll
|
||||
#
|
||||
# SRC: cscript/Makefile
|
||||
#
|
||||
@@ -43,20 +44,21 @@
|
||||
# If your system has a up to date, bash shell, then
|
||||
# you may wish to use:
|
||||
#
|
||||
# SHELL= /bin/bash
|
||||
# SHELL= 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
|
||||
# SHELL= sh
|
||||
#
|
||||
SHELL= /bin/bash
|
||||
#SHELL= /bin/sh
|
||||
SHELL= bash
|
||||
#SHELL= sh
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
#
|
||||
ifeq ($(target),Darwin)
|
||||
SHELL:= /bin/zsh
|
||||
SHELL:= /bin/sh
|
||||
endif
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#!/bin/make
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# custom - makefile for calc custom routines
|
||||
#
|
||||
# Copyright (C) 1999-2006,2014,2017-2018,2021 Landon Curt Noll
|
||||
# Copyright (C) 1999-2006,2014,2017-2018,2021,2023 Landon Curt Noll
|
||||
#
|
||||
# SRC: custom/Makefile
|
||||
#
|
||||
@@ -44,20 +44,21 @@
|
||||
# If your system has a up to date, bash shell, then
|
||||
# you may wish to use:
|
||||
#
|
||||
# SHELL= /bin/bash
|
||||
# SHELL= bash
|
||||
#
|
||||
# On some systems such as macOS, the bash shell is very
|
||||
# far behind to the point where is cannot be depended on.
|
||||
# On such systems, the zsh may be a much better alternative
|
||||
# On such systems, the sh may be a much better alternative
|
||||
# shell for this Makefile to use:
|
||||
#
|
||||
# SHELL= /bin/zsh
|
||||
# SHELL= sh
|
||||
#
|
||||
SHELL= /bin/bash
|
||||
#SHELL= /bin/sh
|
||||
SHELL= bash
|
||||
#SHELL= sh
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
#
|
||||
ifeq ($(target),Darwin)
|
||||
SHELL:= /bin/zsh
|
||||
SHELL:= /bin/sh
|
||||
endif
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
|
||||
@@ -474,7 +475,7 @@ EXT=
|
||||
|
||||
# The default calc versions
|
||||
#
|
||||
VERSION= 2.14.1.3
|
||||
VERSION= 2.14.2.0
|
||||
|
||||
# Names of shared libraries with versions
|
||||
#
|
||||
@@ -491,7 +492,7 @@ CO= co
|
||||
CP= cp
|
||||
DIFF= diff
|
||||
FMT= fmt
|
||||
GREP= egrep
|
||||
GREP= grep
|
||||
LN= ln
|
||||
LS= ls
|
||||
MAKE= make
|
||||
@@ -801,11 +802,17 @@ Makefile.simple: Makefile ../Makefile
|
||||
|
||||
depend:
|
||||
${Q} if [ -f ${MAKE_FILE}.bak ]; then \
|
||||
echo "custom/${MAKE_FILE}.bak exists, remove or move it"; \
|
||||
echo "custom/${MAKE_FILE}.bak exists, remove or move it" 1>&2; \
|
||||
exit 1; \
|
||||
else \
|
||||
${TRUE}; \
|
||||
fi
|
||||
${Q} if type -f ${MAKEDEPEND}; then \
|
||||
${TRUE}; \
|
||||
else \
|
||||
echo "make depend failed: cannot find makedepend command: ${MAKEDEPEND}" 1>&2; \
|
||||
exit 1; \
|
||||
fi
|
||||
${Q} echo forming custom/skel
|
||||
${Q} ${RM} -rf skel
|
||||
${Q} ${MKDIR} -p skel
|
||||
@@ -826,7 +833,7 @@ depend:
|
||||
echo '#endif /* '"$$tag"' */' >> "skel/custom/$$i"; \
|
||||
done
|
||||
${Q} (cd ..; ${MAKE} -f ${MAKE_FILE} hsrc)
|
||||
${MAKE} -f ../${MAKE_FILE} h_list 2>/dev/null | \
|
||||
(cd ..; ${MAKE} -f ${MAKE_FILE} h_list 2>/dev/null) | \
|
||||
while read i; do \
|
||||
if [ ! -f "../$$i" ]; then continue; fi; \
|
||||
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
||||
@@ -840,13 +847,13 @@ depend:
|
||||
${Q} echo custom/skel formed
|
||||
${Q} echo forming custom dependency list
|
||||
${Q} :> skel/custom/makedep.out
|
||||
${Q} cd skel/custom; ${MAKEDEPEND} \
|
||||
-${Q} cd skel/custom; ${MAKEDEPEND} \
|
||||
-I../../.. -w 1 -f makedep.out -- \
|
||||
${CFLAGS} -- \
|
||||
${C_SRC} 2>/dev/null
|
||||
${Q} ${CP} -f skel/custom/makedep.out skel/custom/makedep.in
|
||||
${Q} ${SED} -e 's|: ../../|: |' -E < skel/custom/makedep.in | \
|
||||
${GREP} -v /usr/include > skel/custom/makedep.out
|
||||
${GREP} -E -v /usr/include > skel/custom/makedep.out
|
||||
-${Q} for i in ${C_SRC} /dev/null; do \
|
||||
if [ X"$$i" != X"/dev/null" ]; then \
|
||||
echo "$$i" | ${SED} 's/^\(.*\)\.c/\1.o: \1.c/'; \
|
||||
@@ -860,7 +867,7 @@ depend:
|
||||
${Q} ${MV} ${MAKE_FILE} ${MAKE_FILE}.bak
|
||||
${Q} ${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' \
|
||||
${MAKE_FILE}.bak > ${MAKE_FILE}
|
||||
${Q} ${GREP} -v '^#' skel/custom/makedep.out >> ${MAKE_FILE}
|
||||
${Q} ${GREP} -E -v '^#' skel/custom/makedep.out >> ${MAKE_FILE}
|
||||
${Q} echo removing skel
|
||||
${Q} ${RM} -rf skel
|
||||
-${Q} if ${CMP} -s ${MAKE_FILE}.bak ${MAKE_FILE}; then \
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#!/bin/make
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# custom - makefile for calc custom routines
|
||||
#
|
||||
# Copyright (C) 1999-2006,2014,2017-2018,2021 Landon Curt Noll
|
||||
# Copyright (C) 1999-2006,2014,2017-2018,2021,2023 Landon Curt Noll
|
||||
#
|
||||
# SRC: custom/Makefile.simple - non-GNU version
|
||||
#
|
||||
@@ -44,17 +44,17 @@
|
||||
# If your system has a up to date, bash shell, then
|
||||
# you may wish to use:
|
||||
#
|
||||
# SHELL= /bin/bash
|
||||
# SHELL= bash
|
||||
#
|
||||
# On some systems such as macOS, the bash shell is very
|
||||
# far behind to the point where is cannot be depended on.
|
||||
# On such systems, the zsh may be a much better alternative
|
||||
# On such systems, the sh may be a much better alternative
|
||||
# shell for this Makefile to use:
|
||||
#
|
||||
# SHELL= /bin/zsh
|
||||
# SHELL= sh
|
||||
#
|
||||
SHELL= /bin/bash
|
||||
#SHELL= /bin/sh
|
||||
SHELL= bash
|
||||
#SHELL= sh
|
||||
|
||||
|
||||
# PREFIX - Top level location for calc
|
||||
@@ -445,7 +445,7 @@ EXT=
|
||||
|
||||
# The default calc versions
|
||||
#
|
||||
VERSION= 2.14.1.3
|
||||
VERSION= 2.14.2.0
|
||||
|
||||
# Names of shared libraries with versions
|
||||
#
|
||||
@@ -462,7 +462,7 @@ CO= co
|
||||
CP= cp
|
||||
DIFF= diff
|
||||
FMT= fmt
|
||||
GREP= egrep
|
||||
GREP= grep
|
||||
LN= ln
|
||||
LS= ls
|
||||
MAKE= make
|
||||
@@ -806,11 +806,17 @@ calcliblist: ${CALCLIBLIST}
|
||||
|
||||
depend:
|
||||
${Q} if [ -f ${MAKE_FILE}.bak ]; then \
|
||||
echo "custom/${MAKE_FILE}.bak exists, remove or move it"; \
|
||||
echo "custom/${MAKE_FILE}.bak exists, remove or move it" 1>&2; \
|
||||
exit 1; \
|
||||
else \
|
||||
${TRUE}; \
|
||||
fi
|
||||
${Q} if type -f ${MAKEDEPEND}; then \
|
||||
${TRUE}; \
|
||||
else \
|
||||
echo "make depend failed: cannot find makedepend command: ${MAKEDEPEND}" 1>&2; \
|
||||
exit 1; \
|
||||
fi
|
||||
${Q} echo forming custom/skel
|
||||
${Q} ${RM} -rf skel
|
||||
${Q} ${MKDIR} -p skel
|
||||
@@ -831,7 +837,7 @@ depend:
|
||||
echo '#endif /* '"$$tag"' */' >> "skel/custom/$$i"; \
|
||||
done
|
||||
${Q} (cd ..; ${MAKE} -f ${MAKE_FILE} hsrc)
|
||||
${MAKE} -f ../${MAKE_FILE} h_list 2>/dev/null | \
|
||||
(cd ..; ${MAKE} -f ${MAKE_FILE} h_list 2>/dev/null) | \
|
||||
while read i; do \
|
||||
if [ ! -f "../$$i" ]; then continue; fi; \
|
||||
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
||||
@@ -845,13 +851,13 @@ depend:
|
||||
${Q} echo custom/skel formed
|
||||
${Q} echo forming custom dependency list
|
||||
${Q} :> skel/custom/makedep.out
|
||||
${Q} cd skel/custom; ${MAKEDEPEND} \
|
||||
-${Q} cd skel/custom; ${MAKEDEPEND} \
|
||||
-I../../.. -w 1 -f makedep.out -- \
|
||||
${CFLAGS} -- \
|
||||
${C_SRC} 2>/dev/null
|
||||
${Q} ${CP} -f skel/custom/makedep.out skel/custom/makedep.in
|
||||
${Q} ${SED} -e 's|: ../../|: |' -E < skel/custom/makedep.in | \
|
||||
${GREP} -v /usr/include > skel/custom/makedep.out
|
||||
${GREP} -E -v /usr/include > skel/custom/makedep.out
|
||||
-${Q} for i in ${C_SRC} /dev/null; do \
|
||||
if [ X"$$i" != X"/dev/null" ]; then \
|
||||
echo "$$i" | ${SED} 's/^\(.*\)\.c/\1.o: \1.c/'; \
|
||||
@@ -865,7 +871,7 @@ depend:
|
||||
${Q} ${MV} ${MAKE_FILE} ${MAKE_FILE}.bak
|
||||
${Q} ${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' \
|
||||
${MAKE_FILE}.bak > ${MAKE_FILE}
|
||||
${Q} ${GREP} -v '^#' skel/custom/makedep.out >> ${MAKE_FILE}
|
||||
${Q} ${GREP} -E -v '^#' skel/custom/makedep.out >> ${MAKE_FILE}
|
||||
${Q} echo removing skel
|
||||
${Q} ${RM} -rf skel
|
||||
-${Q} if ${CMP} -s ${MAKE_FILE}.bak ${MAKE_FILE}; then \
|
||||
|
@@ -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 */
|
||||
|
82
have_statfs.c
Normal file
82
have_statfs.c
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* have_statfs - Determine if we have statfs()
|
||||
*
|
||||
* Copyright (C) 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: 2023/03/06 00:51:53
|
||||
* File existed as early as: 2023
|
||||
*
|
||||
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
*/
|
||||
|
||||
/*
|
||||
* usage:
|
||||
* have_statfs
|
||||
*
|
||||
* Not all systems have the statfs() function, so this may not
|
||||
* compile on your system.
|
||||
*
|
||||
* This prog outputs several defines:
|
||||
*
|
||||
* HAVE_STATFS
|
||||
* defined ==> use statfs()
|
||||
* undefined ==> do not call or cannot call statfs()
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "have_sys_vfs.h"
|
||||
#if defined(HAVE_SYS_VFS_H)
|
||||
# include <sys/vfs.h>
|
||||
#endif /* HAVE_SYS_VFS_H */
|
||||
|
||||
#include "have_sys_param.h"
|
||||
#if defined(HAVE_SYS_PARAM_H)
|
||||
# include <sys/param.h>
|
||||
#endif /* HAVE_SYS_PARAM_H */
|
||||
|
||||
#include "have_sys_mount.h"
|
||||
#if defined(HAVE_SYS_MOUNT_H)
|
||||
# include <sys/mount.h>
|
||||
#endif /* HAVE_SYS_MOUNT_H */
|
||||
|
||||
#include "banned.h" /* include after system header <> includes */
|
||||
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
#if defined(HAVE_NO_STATFS)
|
||||
|
||||
printf("#undef HAVE_STATFS /* no */\n");
|
||||
|
||||
#else /* HAVE_NO_STATFS */
|
||||
|
||||
struct statfs statfs_dot; /* usage stat of "." */
|
||||
|
||||
(void) statfs(".", &statfs_dot);
|
||||
|
||||
printf("#define HAVE_STATFS /* yes */\n");
|
||||
|
||||
#endif /* HAVE_NO_STATFS */
|
||||
|
||||
/* exit(0); */
|
||||
return 0;
|
||||
}
|
@@ -1,8 +1,8 @@
|
||||
#!/bin/make
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# help - makefile for calc help files
|
||||
#
|
||||
# Copyright (C) 1999-2006,2017,2021,2022 Landon Curt Noll
|
||||
# Copyright (C) 1999-2006,2017,2021-2023 Landon Curt Noll
|
||||
#
|
||||
# SRC: help/Makefile
|
||||
#
|
||||
@@ -44,20 +44,21 @@
|
||||
# If your system has a up to date, bash shell, then
|
||||
# you may wish to use:
|
||||
#
|
||||
# SHELL= /bin/bash
|
||||
# SHELL= 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
|
||||
# SHELL= sh
|
||||
#
|
||||
SHELL= /bin/bash
|
||||
#SHELL= /bin/sh
|
||||
SHELL= bash
|
||||
#SHELL= sh
|
||||
#if 0 /* start of skip for non-Gnu makefiles */
|
||||
#
|
||||
ifeq ($(target),Darwin)
|
||||
SHELL:= /bin/zsh
|
||||
SHELL:= /bin/sh
|
||||
endif
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
|
||||
@@ -246,7 +247,7 @@ CHMOD= chmod
|
||||
CMP= cmp
|
||||
CP= cp
|
||||
FMT= fmt
|
||||
GREP= egrep
|
||||
GREP= grep
|
||||
ICFLAGS=
|
||||
ILDFLAGS=
|
||||
LCC= cc
|
||||
@@ -716,7 +717,7 @@ builtin: builtin.top builtin.end ../func.c funclist.sed
|
||||
-I.. funclist.c -c ${S}
|
||||
${Q} ${LCC} ${ILDFLAGS} funclist.o -o funclist${EXT} ${S}
|
||||
${Q} ${RM} -f builtin
|
||||
${Q} ${GREP} -v '^#' builtin.top > builtin
|
||||
${Q} ${GREP} -E -v '^#' builtin.top > builtin
|
||||
${Q} ./funclist${EXT} | \
|
||||
${SED} -e 's/^/ /' -e 's/[ ][ ]*$$//' >> builtin
|
||||
${Q} ${CAT} builtin.end >> builtin
|
||||
|
11
help/credit
11
help/credit
@@ -33,6 +33,15 @@ Credits
|
||||
Copyright (C) year Landon Curt Noll
|
||||
Copyright (C) year Ernest Bowen and Landon Curt Noll
|
||||
Copyright (C) year Ernest Bowen
|
||||
Copyright (C) year Petteri Kettunen and Landon Curt Noll
|
||||
Copyright (C) year Christoph Zurnieden
|
||||
Copyright (C) year Landon Curt Noll and Thomas Jones-Low
|
||||
Copyright (C) year Klaus Alexander Seistrup and Landon Curt Noll
|
||||
|
||||
A few files in calc are covered under "The Unlicense". For more
|
||||
information on this license, see:
|
||||
|
||||
https://unlicense.org
|
||||
|
||||
|
||||
Copying / Calc GNU Lesser General Public License
|
||||
@@ -65,7 +74,7 @@ See also:
|
||||
help copying
|
||||
help copying-lgpl
|
||||
|
||||
## 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
|
||||
|
@@ -2,11 +2,11 @@ s/VALUE/int/
|
||||
s/NUMBER[ ]*\*/int /
|
||||
s/NUMBER/int/
|
||||
s/STRINGHEAD/int/
|
||||
s/\(".*",.*,.*\),.*,.*,.*,.*,/\1, 0, 0, 0, 0,/
|
||||
s/\(".*",.*,.*\),.*,.*,.*,.*,/\1, 0, 0, {.null = NULL}, {.null = NULL},/
|
||||
s/[ ][ ]*$//
|
||||
p
|
||||
|
||||
## 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
|
||||
|
@@ -556,8 +556,14 @@ Unexpected
|
||||
; print sin(d2r(30))
|
||||
0.5
|
||||
|
||||
* operator has has a higher precedence than <<
|
||||
==============================================
|
||||
|
||||
## Copyright (C) 1999-2007,2014,2017,2021 Landon Curt Noll
|
||||
The * operator has has a higher precedence than <<, which differs from the C language.
|
||||
So 3 << 2*5 evaluates to 3072 in C, whereas 3 << 2*5 evaluates to 60 in calc.
|
||||
|
||||
|
||||
## Copyright (C) 1999-2007,2014,2017,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
|
||||
|
161
hist.c
161
hist.c
@@ -98,7 +98,7 @@ STATIC struct {
|
||||
} HS;
|
||||
|
||||
|
||||
typedef void (*FUNCPTR)();
|
||||
typedef void (*FUNCPTR)(int);
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
@@ -106,38 +106,38 @@ typedef struct {
|
||||
} FUNC;
|
||||
|
||||
/* declare binding functions */
|
||||
S_FUNC void flush_input(void);
|
||||
S_FUNC void start_of_line(void);
|
||||
S_FUNC void end_of_line(void);
|
||||
S_FUNC void forward_char(void);
|
||||
S_FUNC void backward_char(void);
|
||||
S_FUNC void forward_word(void);
|
||||
S_FUNC void backward_word(void);
|
||||
S_FUNC void delete_char(void);
|
||||
S_FUNC void forward_kill_char(void);
|
||||
S_FUNC void backward_kill_char(void);
|
||||
S_FUNC void forward_kill_word(void);
|
||||
S_FUNC void kill_line(void);
|
||||
S_FUNC void new_line(void);
|
||||
S_FUNC void save_line(void);
|
||||
S_FUNC void forward_history(void);
|
||||
S_FUNC void backward_history(void);
|
||||
S_FUNC void flush_input(int key);
|
||||
S_FUNC void start_of_line(int key);
|
||||
S_FUNC void end_of_line(int key);
|
||||
S_FUNC void forward_char(int key);
|
||||
S_FUNC void backward_char(int key);
|
||||
S_FUNC void forward_word(int key);
|
||||
S_FUNC void backward_word(int key);
|
||||
S_FUNC void delete_char(int key);
|
||||
S_FUNC void forward_kill_char(int key);
|
||||
S_FUNC void backward_kill_char(int key);
|
||||
S_FUNC void forward_kill_word(int key);
|
||||
S_FUNC void kill_line(int key);
|
||||
S_FUNC void new_line(int key);
|
||||
S_FUNC void save_line(int key);
|
||||
S_FUNC void forward_history(int key);
|
||||
S_FUNC void backward_history(int key);
|
||||
S_FUNC void insert_char(int key);
|
||||
S_FUNC void goto_line(void);
|
||||
S_FUNC void list_history(void);
|
||||
S_FUNC void refresh_line(void);
|
||||
S_FUNC void swap_chars(void);
|
||||
S_FUNC void set_mark(void);
|
||||
S_FUNC void yank(void);
|
||||
S_FUNC void save_region(void);
|
||||
S_FUNC void kill_region(void);
|
||||
S_FUNC void reverse_search(void);
|
||||
S_FUNC void quote_char(void);
|
||||
S_FUNC void uppercase_word(void);
|
||||
S_FUNC void lowercase_word(void);
|
||||
S_FUNC void ignore_char(void);
|
||||
S_FUNC void arrow_key(void);
|
||||
S_FUNC void quit_calc(void) __attribute__((noreturn));
|
||||
S_FUNC void goto_line(int key);
|
||||
S_FUNC void list_history(int key);
|
||||
S_FUNC void refresh_line(int key);
|
||||
S_FUNC void swap_chars(int key);
|
||||
S_FUNC void set_mark(int key);
|
||||
S_FUNC void yank(int key);
|
||||
S_FUNC void save_region(int key);
|
||||
S_FUNC void kill_region(int key);
|
||||
S_FUNC void reverse_search(int key);
|
||||
S_FUNC void quote_char(int key);
|
||||
S_FUNC void uppercase_word(int key);
|
||||
S_FUNC void lowercase_word(int key);
|
||||
S_FUNC void ignore_char(int key);
|
||||
S_FUNC void arrow_key(int key);
|
||||
S_FUNC void quit_calc(int key) __attribute__((noreturn));
|
||||
|
||||
|
||||
STATIC FUNC funcs[] =
|
||||
@@ -650,13 +650,12 @@ read_key(void)
|
||||
ent = &cur_map->default_ent;
|
||||
if (ent->next)
|
||||
cur_map = ent->next;
|
||||
if (ent->func)
|
||||
/* ignore Saber-C warning #65 - has 1 arg, expecting 0 */
|
||||
/* OK to ignore in proc read_key */
|
||||
if (ent->func != NULL) {
|
||||
(*ent->func)(key);
|
||||
else
|
||||
} else {
|
||||
insert_char(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@@ -797,20 +796,20 @@ find_func(char *name)
|
||||
|
||||
|
||||
S_FUNC void
|
||||
arrow_key(void)
|
||||
arrow_key(int UNUSED(key))
|
||||
{
|
||||
switch (fgetc(stdin)) {
|
||||
case 'A':
|
||||
backward_history();
|
||||
backward_history(0);
|
||||
break;
|
||||
case 'B':
|
||||
forward_history();
|
||||
forward_history(0);
|
||||
break;
|
||||
case 'C':
|
||||
forward_char();
|
||||
forward_char(0);
|
||||
break;
|
||||
case 'D':
|
||||
backward_char();
|
||||
backward_char(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -867,13 +866,13 @@ decrement_end(int n)
|
||||
|
||||
|
||||
S_FUNC void
|
||||
ignore_char(void)
|
||||
ignore_char(int UNUSED(key))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
S_FUNC void
|
||||
flush_input(void)
|
||||
flush_input(int UNUSED(key))
|
||||
{
|
||||
echo_rest_of_line();
|
||||
while (HS.end > HS.buf)
|
||||
@@ -884,21 +883,21 @@ flush_input(void)
|
||||
|
||||
|
||||
S_FUNC void
|
||||
start_of_line(void)
|
||||
start_of_line(int UNUSED(key))
|
||||
{
|
||||
goto_start_of_line();
|
||||
}
|
||||
|
||||
|
||||
S_FUNC void
|
||||
end_of_line(void)
|
||||
end_of_line(int UNUSED(key))
|
||||
{
|
||||
goto_end_of_line();
|
||||
}
|
||||
|
||||
|
||||
S_FUNC void
|
||||
forward_char(void)
|
||||
forward_char(int UNUSED(key))
|
||||
{
|
||||
if (HS.pos < HS.end)
|
||||
echo_char(*HS.pos++);
|
||||
@@ -906,7 +905,7 @@ forward_char(void)
|
||||
|
||||
|
||||
S_FUNC void
|
||||
backward_char(void)
|
||||
backward_char(int UNUSED(key))
|
||||
{
|
||||
if (HS.pos > HS.buf)
|
||||
back_over_char((int)(*--HS.pos));
|
||||
@@ -914,7 +913,7 @@ backward_char(void)
|
||||
|
||||
|
||||
S_FUNC void
|
||||
uppercase_word(void)
|
||||
uppercase_word(int UNUSED(key))
|
||||
{
|
||||
while ((HS.pos < HS.end) && !in_word((int)(*HS.pos)))
|
||||
echo_char(*HS.pos++);
|
||||
@@ -927,7 +926,7 @@ uppercase_word(void)
|
||||
|
||||
|
||||
S_FUNC void
|
||||
lowercase_word(void)
|
||||
lowercase_word(int UNUSED(key))
|
||||
{
|
||||
while ((HS.pos < HS.end) && !in_word((int)(*HS.pos)))
|
||||
echo_char(*HS.pos++);
|
||||
@@ -940,7 +939,7 @@ lowercase_word(void)
|
||||
|
||||
|
||||
S_FUNC void
|
||||
forward_word(void)
|
||||
forward_word(int UNUSED(key))
|
||||
{
|
||||
while ((HS.pos < HS.end) && !in_word((int)(*HS.pos)))
|
||||
echo_char(*HS.pos++);
|
||||
@@ -950,7 +949,7 @@ forward_word(void)
|
||||
|
||||
|
||||
S_FUNC void
|
||||
backward_word(void)
|
||||
backward_word(int UNUSED(key))
|
||||
{
|
||||
if ((HS.pos > HS.buf) && in_word((int)(*HS.pos)))
|
||||
back_over_char((int)(*--HS.pos));
|
||||
@@ -964,7 +963,7 @@ backward_word(void)
|
||||
|
||||
|
||||
S_FUNC void
|
||||
forward_kill_char(void)
|
||||
forward_kill_char(int UNUSED(key))
|
||||
{
|
||||
int rest;
|
||||
char ch;
|
||||
@@ -986,7 +985,7 @@ forward_kill_char(void)
|
||||
|
||||
|
||||
S_FUNC void
|
||||
delete_char(void)
|
||||
delete_char(int UNUSED(key))
|
||||
{
|
||||
/*
|
||||
* quit delete_char (usually ^D) is at start of line and we are allowed
|
||||
@@ -997,30 +996,30 @@ delete_char(void)
|
||||
if ((HS.end == HS.buf) &&
|
||||
(conf->ctrl_d == CTRL_D_EMPTY_EOF ||
|
||||
(conf->ctrl_d == CTRL_D_VIRGIN_EOF && HS.virgin_line == TRUE))) {
|
||||
quit_calc();
|
||||
quit_calc(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* normal case: just forward_kill_char
|
||||
*/
|
||||
if (HS.end > HS.buf)
|
||||
forward_kill_char();
|
||||
forward_kill_char(0);
|
||||
}
|
||||
|
||||
|
||||
S_FUNC void
|
||||
backward_kill_char(void)
|
||||
backward_kill_char(int UNUSED(key))
|
||||
{
|
||||
if (HS.pos > HS.buf) {
|
||||
HS.pos--;
|
||||
back_over_char((int)(*HS.pos));
|
||||
forward_kill_char();
|
||||
forward_kill_char(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
S_FUNC void
|
||||
forward_kill_word(void)
|
||||
forward_kill_word(int UNUSED(key))
|
||||
{
|
||||
char *cp;
|
||||
|
||||
@@ -1044,7 +1043,7 @@ forward_kill_word(void)
|
||||
|
||||
|
||||
S_FUNC void
|
||||
kill_line(void)
|
||||
kill_line(int UNUSED(key))
|
||||
{
|
||||
if (HS.end <= HS.pos)
|
||||
return;
|
||||
@@ -1063,7 +1062,7 @@ kill_line(void)
|
||||
* decide whether or not this should be done.
|
||||
*/
|
||||
S_FUNC void
|
||||
new_line(void)
|
||||
new_line(int UNUSED(key))
|
||||
{
|
||||
int len;
|
||||
|
||||
@@ -1087,21 +1086,21 @@ new_line(void)
|
||||
|
||||
|
||||
S_FUNC void
|
||||
save_line(void)
|
||||
save_line(int UNUSED(key))
|
||||
{
|
||||
int len;
|
||||
|
||||
len = HS.end - HS.buf;
|
||||
if (len > 0) {
|
||||
hist_saveline(HS.buf, len);
|
||||
flush_input();
|
||||
flush_input(0);
|
||||
}
|
||||
HS.curhist = HS.histcount;
|
||||
}
|
||||
|
||||
|
||||
S_FUNC void
|
||||
goto_line(void)
|
||||
goto_line(int UNUSED(key))
|
||||
{
|
||||
int num;
|
||||
char *cp;
|
||||
@@ -1115,7 +1114,7 @@ goto_line(void)
|
||||
beep();
|
||||
return;
|
||||
}
|
||||
flush_input();
|
||||
flush_input(0);
|
||||
HS.curhist = HS.histcount - num;
|
||||
hp = get_event(HS.curhist);
|
||||
memcpy(HS.buf, hp->data, hp->len);
|
||||
@@ -1125,11 +1124,11 @@ goto_line(void)
|
||||
|
||||
|
||||
S_FUNC void
|
||||
forward_history(void)
|
||||
forward_history(int UNUSED(key))
|
||||
{
|
||||
HIST *hp;
|
||||
|
||||
flush_input();
|
||||
flush_input(0);
|
||||
if (++HS.curhist >= HS.histcount)
|
||||
HS.curhist = 0;
|
||||
hp = get_event(HS.curhist);
|
||||
@@ -1142,11 +1141,11 @@ forward_history(void)
|
||||
|
||||
|
||||
S_FUNC void
|
||||
backward_history(void)
|
||||
backward_history(int UNUSED(key))
|
||||
{
|
||||
HIST *hp;
|
||||
|
||||
flush_input();
|
||||
flush_input(0);
|
||||
if (--HS.curhist < 0)
|
||||
HS.curhist = HS.histcount - 1;
|
||||
hp = get_event(HS.curhist);
|
||||
@@ -1208,7 +1207,7 @@ insert_string(char *str, int len)
|
||||
|
||||
|
||||
S_FUNC void
|
||||
list_history(void)
|
||||
list_history(int UNUSED(key))
|
||||
{
|
||||
HIST *hp;
|
||||
int hnum;
|
||||
@@ -1218,12 +1217,12 @@ list_history(void)
|
||||
printf("\n%3d: ", HS.histcount - hnum);
|
||||
echo_string(hp->data, hp->len);
|
||||
}
|
||||
refresh_line();
|
||||
refresh_line(0);
|
||||
}
|
||||
|
||||
|
||||
S_FUNC void
|
||||
refresh_line(void)
|
||||
refresh_line(int UNUSED(key))
|
||||
{
|
||||
char *cp;
|
||||
|
||||
@@ -1239,7 +1238,7 @@ refresh_line(void)
|
||||
|
||||
|
||||
S_FUNC void
|
||||
swap_chars(void)
|
||||
swap_chars(int UNUSED(key))
|
||||
{
|
||||
char ch1;
|
||||
char ch2;
|
||||
@@ -1258,14 +1257,14 @@ swap_chars(void)
|
||||
|
||||
|
||||
S_FUNC void
|
||||
set_mark(void)
|
||||
set_mark(int UNUSED(key))
|
||||
{
|
||||
HS.mark = HS.pos;
|
||||
}
|
||||
|
||||
|
||||
S_FUNC void
|
||||
save_region(void)
|
||||
save_region(int UNUSED(key))
|
||||
{
|
||||
int len;
|
||||
|
||||
@@ -1280,7 +1279,7 @@ save_region(void)
|
||||
|
||||
|
||||
S_FUNC void
|
||||
kill_region(void)
|
||||
kill_region(int UNUSED(key))
|
||||
{
|
||||
char *cp;
|
||||
char *left;
|
||||
@@ -1312,14 +1311,14 @@ kill_region(void)
|
||||
|
||||
|
||||
S_FUNC void
|
||||
yank(void)
|
||||
yank(int UNUSED(key))
|
||||
{
|
||||
insert_string(save_buffer, save_len);
|
||||
}
|
||||
|
||||
|
||||
S_FUNC void
|
||||
reverse_search(void)
|
||||
reverse_search(int UNUSED(key))
|
||||
{
|
||||
int len;
|
||||
int count;
|
||||
@@ -1345,7 +1344,7 @@ reverse_search(void)
|
||||
|
||||
HS.curhist = testhist;
|
||||
save_pos = HS.pos;
|
||||
flush_input();
|
||||
flush_input(0);
|
||||
memcpy(HS.buf, hp->data, hp->len);
|
||||
HS.end = &HS.buf[hp->len];
|
||||
goto_end_of_line();
|
||||
@@ -1355,7 +1354,7 @@ reverse_search(void)
|
||||
|
||||
|
||||
S_FUNC void
|
||||
quote_char(void)
|
||||
quote_char(int UNUSED(key))
|
||||
{
|
||||
int ch;
|
||||
|
||||
@@ -1451,7 +1450,7 @@ memrcpy(char *dest, char *src, int len)
|
||||
#endif /* !USE_READLINE */
|
||||
|
||||
S_FUNC void
|
||||
quit_calc(void)
|
||||
quit_calc(int UNUSED(ch))
|
||||
{
|
||||
hist_term();
|
||||
putchar('\n');
|
||||
@@ -1493,7 +1492,7 @@ hist_getline(char *prompt, char *buf, size_t len)
|
||||
case CTRL_D_VIRGIN_EOF:
|
||||
case CTRL_D_EMPTY_EOF:
|
||||
default:
|
||||
quit_calc();
|
||||
quit_calc(0);
|
||||
not_reached();
|
||||
}
|
||||
}
|
||||
|
16
rpm.mk
16
rpm.mk
@@ -1,9 +1,8 @@
|
||||
#!/bin/make
|
||||
#****h* calc/rpm.mk
|
||||
#!/usr/bin/env make
|
||||
#
|
||||
# rpm.mk - Makefile for building rpm packages for calc
|
||||
#
|
||||
# Copyright (C) 2003,2014,2021 Petteri Kettunen and Landon Curt Noll
|
||||
# Copyright (C) 2003,2014,2021,2023 Petteri Kettunen and Landon Curt Noll
|
||||
#
|
||||
# Calc is open software; you can redistribute it and/or modify it under
|
||||
# the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -63,7 +62,7 @@
|
||||
|
||||
# setup
|
||||
#
|
||||
SHELL= /bin/sh
|
||||
SHELL= bash
|
||||
RPMBUILD_TOOL= rpmbuild
|
||||
TARCH= x86_64
|
||||
RPMBUILD_OPTION= -ba --target=$(TARCH) --buildroot=${RPM_BUILD_ROOT}
|
||||
@@ -76,7 +75,6 @@ RM= rm
|
||||
LS= ls
|
||||
CPIO= cpio
|
||||
CP= cp
|
||||
EGREP= egrep
|
||||
MKDIR= mkdir
|
||||
GREP= grep
|
||||
SORT= sort
|
||||
@@ -172,8 +170,8 @@ srcpkg: make_rhdir
|
||||
${V} echo PROJECT_RELEASE="${PROJECT_RELEASE}"
|
||||
${RM} -rf "$(TMPDIR)/$(PROJECT)"
|
||||
${FIND} . -depth -print | \
|
||||
${EGREP} -v '/RCS|/CVS|/NOTES|/\.|\.out$$|\.safe$$\.tar\.bz2$$' | \
|
||||
${EGREP} -v '/old[._-]|\.old$$|\.tar\.gz$$|/ver_calc$$' | \
|
||||
${GREP} -E -v '/RCS|/CVS|/NOTES|/\.|\.out$$|\.safe$$\.tar\.bz2$$' | \
|
||||
${GREP} -E -v '/old[._-]|\.old$$|\.tar\.gz$$|/ver_calc$$' | \
|
||||
LANG=C ${SORT} | \
|
||||
${CPIO} -dumpv "$(TMPDIR)/$(PROJECT)"
|
||||
${RM} -f "$(TMPDIR)/$(PROJECT)/Makefile"
|
||||
@@ -278,8 +276,8 @@ chkpkg:
|
||||
.PHONY: chksys
|
||||
chksys:
|
||||
${V} echo '=-=-=-=-= rpm.mk start of $@ rule =-=-=-=-='
|
||||
${RPM_TOOL} -qa | ${GREP} "$(PROJECT_NAME)"
|
||||
${RPM_TOOL} -qa | ${GREP} "$(PROJECT_NAME)-devel"
|
||||
${RPM_TOOL} -qa | ${GREP} -E "$(PROJECT_NAME)"
|
||||
${RPM_TOOL} -qa | ${GREP} -E "$(PROJECT_NAME)-devel"
|
||||
${V} echo '=-=-=-=-= rpm.mk end of $@ rule =-=-=-=-='
|
||||
|
||||
.PHONY: test
|
||||
|
72
seed.c
72
seed.c
@@ -66,24 +66,30 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "have_times.h"
|
||||
|
||||
#if defined(HAVE_TIME_H)
|
||||
#include <time.h>
|
||||
#endif
|
||||
#endif /* HAVE_TIME_H */
|
||||
|
||||
#if defined(HAVE_SYS_TIME_H)
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#endif /* HAVE_SYS_TIME_H */
|
||||
|
||||
#if defined(HAVE_SYS_TIMES_H)
|
||||
#include <sys/times.h>
|
||||
#endif
|
||||
#endif /* HAVE_SYS_TIMES_H */
|
||||
|
||||
#if !defined(_WIN32) && !defined(_WIN64)
|
||||
# include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_STDLIB_H)
|
||||
# include <stdlib.h>
|
||||
/* NOTE: RANDOM_CNT should remain 32 to circular shift 31-bit returns */
|
||||
# define RANDOM_CNT (32) /* random() call repeat and circular shift */
|
||||
# define INITSTATE_SIZE (256) /* initstate pool size */
|
||||
#endif
|
||||
#endif /* HAVE_STDLIB_H */
|
||||
|
||||
#include <setjmp.h>
|
||||
#include "alloc.h"
|
||||
#include "qmath.h"
|
||||
@@ -98,15 +104,33 @@
|
||||
#include "have_uid_t.h"
|
||||
#include "have_environ.h"
|
||||
#include "have_arc4random.h"
|
||||
|
||||
#if defined(HAVE_USTAT)
|
||||
# include <ustat.h>
|
||||
#endif
|
||||
#endif /* HAVE_USTAT */
|
||||
|
||||
#if defined(HAVE_URANDOM)
|
||||
# include <fcntl.h>
|
||||
# define DEV_URANDOM "/dev/urandom"
|
||||
# define DEV_URANDOM_POOL (16)
|
||||
#endif
|
||||
#endif /* HAVE_URANDOM */
|
||||
|
||||
#include "have_sys_vfs.h"
|
||||
#if defined(HAVE_SYS_VFS_H)
|
||||
# include <sys/vfs.h>
|
||||
#endif /* HAVE_SYS_VFS_H */
|
||||
|
||||
#include "have_sys_param.h"
|
||||
#if defined(HAVE_SYS_PARAM_H)
|
||||
# include <sys/param.h>
|
||||
#endif /* HAVE_SYS_PARAM_H */
|
||||
|
||||
#include "have_sys_mount.h"
|
||||
#if defined(HAVE_SYS_MOUNT_H)
|
||||
# include <sys/mount.h>
|
||||
#endif /* HAVE_SYS_MOUNT_H */
|
||||
|
||||
#include "have_statfs.h"
|
||||
|
||||
#include "banned.h" /* include after system header <> includes */
|
||||
|
||||
@@ -417,6 +441,25 @@ pseudo_seed(void)
|
||||
/* usage stat of "/var/log/messages" */
|
||||
struct ustat ustat_messages;
|
||||
#endif
|
||||
#if defined(HAVE_STATFS)
|
||||
struct statfs statfs_dot; /* filesystem stat of "." */
|
||||
struct statfs statfs_dotdot; /* filesystem stat of ".." */
|
||||
struct statfs statfs_tmp; /* filesystem stat of "/tmp" */
|
||||
struct statfs statfs_root; /* filesystem stat of "/" */
|
||||
struct statfs statfs_tty; /* filesystem stat of "/dev/tty" */
|
||||
struct statfs statfs_console; /* filesystem stat of "/dev/console" */
|
||||
struct statfs statfs_stdin; /* filesystem stat of stdin */
|
||||
struct statfs statfs_stdout; /* filesystem stat of stdout */
|
||||
struct statfs statfs_stderr; /* filesystem stat of stderr */
|
||||
struct statfs statfs_zero; /* filesystem stat of "/dev/zero" */
|
||||
struct statfs statfs_null; /* filesystem stat of "/dev/null" */
|
||||
struct statfs statfs_sh; /* filesystem stat of "/bin/sh" */
|
||||
struct statfs statfs_ls; /* filesystem stat of "/bin/ls" */
|
||||
/* filesystem stat of "/var/log/system.log" */
|
||||
struct statfs statfs_system;
|
||||
/* filesystem stat of "/var/log/messages" */
|
||||
struct statfs statfs_messages;
|
||||
#endif
|
||||
#if defined(HAVE_GETSID)
|
||||
pid_t getsid; /* session ID */
|
||||
#endif
|
||||
@@ -559,6 +602,23 @@ pseudo_seed(void)
|
||||
(void) ustat(sdata.stat_system.st_dev, &sdata.ustat_system);
|
||||
(void) ustat(sdata.stat_messages.st_dev, &sdata.ustat_messages);
|
||||
#endif
|
||||
#if defined(HAVE_STATFS)
|
||||
(void) statfs("..", &sdata.statfs_dot);
|
||||
(void) statfs(".", &sdata.statfs_dotdot);
|
||||
(void) statfs("/tmp", &sdata.statfs_tmp);
|
||||
(void) statfs("/", &sdata.statfs_root);
|
||||
(void) statfs("/dev/tty", &sdata.statfs_tty);
|
||||
(void) statfs("/dev/console", &sdata.statfs_console);
|
||||
(void) statfs(".dev/stdin", &sdata.statfs_stdin);
|
||||
(void) statfs("/dev/stdout", &sdata.statfs_stdout);
|
||||
(void) statfs("/dev/stderr", &sdata.statfs_stderr);
|
||||
(void) statfs("/dev/zero", &sdata.statfs_zero);
|
||||
(void) statfs("/dev/null", &sdata.statfs_null);
|
||||
(void) statfs("/bin/sh", &sdata.statfs_sh);
|
||||
(void) statfs("/dev/ls", &sdata.statfs_ls);
|
||||
(void) statfs("/var/log/system.log", &sdata.statfs_system);
|
||||
(void) statfs("/var/log/messages", &sdata.statfs_messages);
|
||||
#endif
|
||||
#if defined(HAVE_GETSID)
|
||||
sdata.getsid = getsid((pid_t)0);
|
||||
#endif
|
||||
|
49
sha1.c
49
sha1.c
@@ -3,26 +3,37 @@
|
||||
*
|
||||
* Written 2 September 1992, Peter C. Gutmann.
|
||||
*
|
||||
* This file has been extensively modified by:
|
||||
*
|
||||
* Landon Curt Noll
|
||||
* http://www.isthe.com/chongo/
|
||||
*
|
||||
* chongo <was here> /\../\
|
||||
*
|
||||
* This code has been placed in the public domain. Please do not
|
||||
* copyright this code.
|
||||
*
|
||||
* LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
||||
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MER-
|
||||
* CHANTABILITY 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.
|
||||
*
|
||||
* This file is not covered under version 2.1 of the GNU LGPL.
|
||||
* This file is covered under "The unlicense":
|
||||
*
|
||||
* https://unlicense.org
|
||||
*
|
||||
* In particular:
|
||||
*
|
||||
* 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/>
|
||||
*/
|
||||
|
||||
|
||||
|
49
sha1.h
49
sha1.h
@@ -3,26 +3,37 @@
|
||||
*
|
||||
* Written 2 September 1992, Peter C. Gutmann.
|
||||
*
|
||||
* This file and been extensively modified by:
|
||||
*
|
||||
* Landon Curt Noll
|
||||
* http://www.isthe.com/chongo/
|
||||
*
|
||||
* chongo <was here> /\../\
|
||||
*
|
||||
* This code has been placed in the public domain. Please do not
|
||||
* copyright this code.
|
||||
*
|
||||
* LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
||||
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MER-
|
||||
* CHANTABILITY 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.
|
||||
*
|
||||
* This file is not covered under version 2.1 of the GNU LGPL.
|
||||
* This file is covered under "The unlicense":
|
||||
*
|
||||
* https://unlicense.org
|
||||
*
|
||||
* In particular:
|
||||
*
|
||||
* 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/>
|
||||
*/
|
||||
|
||||
|
||||
|
4
symbol.c
4
symbol.c
@@ -373,7 +373,6 @@ freeglobals(void)
|
||||
{
|
||||
GLOBAL **hp; /* hash table head address */
|
||||
GLOBAL *sp; /* current global symbol pointer */
|
||||
long count; /* number of global variables freed */
|
||||
|
||||
/*
|
||||
* We prevent the hp pointer from walking behind globalhash
|
||||
@@ -384,12 +383,10 @@ freeglobals(void)
|
||||
* short and running the loop one last time manually helps make
|
||||
* code checkers such as insure happy.
|
||||
*/
|
||||
count = 0;
|
||||
for (hp = &globalhash[HASHSIZE-1]; hp > globalhash; hp--) {
|
||||
for (sp = *hp; sp; sp = sp->g_next) {
|
||||
if (sp->g_value.v_type != V_NULL) {
|
||||
freevalue(&sp->g_value);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -397,7 +394,6 @@ freeglobals(void)
|
||||
for (sp = *hp; sp; sp = sp->g_next) {
|
||||
if (sp->g_value.v_type != V_NULL) {
|
||||
freevalue(&sp->g_value);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
44
value.c
44
value.c
@@ -377,6 +377,7 @@ negvalue(VALUE *vp, VALUE *vres)
|
||||
void
|
||||
addvalue(VALUE *v1, VALUE *v2, VALUE *vres)
|
||||
{
|
||||
unsigned int twoval_as_uint; /* TWOVAL(a,b) or TWOVAL_INVALID */
|
||||
COMPLEX *c;
|
||||
VALUE tmp;
|
||||
NUMBER *q;
|
||||
@@ -403,7 +404,8 @@ addvalue(VALUE *v1, VALUE *v2, VALUE *vres)
|
||||
return;
|
||||
}
|
||||
vres->v_type = v1->v_type;
|
||||
switch (TWOVAL(v1->v_type, v2->v_type)) {
|
||||
twoval_as_uint = TWOVAL_AS_UINT(v1->v_type, v2->v_type);
|
||||
switch (twoval_as_uint) {
|
||||
case TWOVAL(V_NUM, V_NUM):
|
||||
vres->v_num = qqadd(v1->v_num, v2->v_num);
|
||||
return;
|
||||
@@ -474,13 +476,15 @@ addvalue(VALUE *v1, VALUE *v2, VALUE *vres)
|
||||
void
|
||||
subvalue(VALUE *v1, VALUE *v2, VALUE *vres)
|
||||
{
|
||||
unsigned int twoval_as_uint; /* TWOVAL(a,b) or TWOVAL_INVALID */
|
||||
COMPLEX *c;
|
||||
NUMBER *q;
|
||||
int i;
|
||||
|
||||
vres->v_type = v1->v_type;
|
||||
vres->v_subtype = V_NOSUBTYPE;
|
||||
switch (TWOVAL(v1->v_type, v2->v_type)) {
|
||||
twoval_as_uint = TWOVAL_AS_UINT(v1->v_type, v2->v_type);
|
||||
switch (twoval_as_uint) {
|
||||
case TWOVAL(V_NUM, V_NUM):
|
||||
vres->v_num = qsub(v1->v_num, v2->v_num);
|
||||
return;
|
||||
@@ -562,11 +566,13 @@ subvalue(VALUE *v1, VALUE *v2, VALUE *vres)
|
||||
void
|
||||
mulvalue(VALUE *v1, VALUE *v2, VALUE *vres)
|
||||
{
|
||||
unsigned int twoval_as_uint; /* TWOVAL(a,b) or TWOVAL_INVALID */
|
||||
COMPLEX *c;
|
||||
|
||||
vres->v_type = v1->v_type;
|
||||
vres->v_subtype = V_NOSUBTYPE;
|
||||
switch (TWOVAL(v1->v_type, v2->v_type)) {
|
||||
twoval_as_uint = TWOVAL_AS_UINT(v1->v_type, v2->v_type);
|
||||
switch (twoval_as_uint) {
|
||||
case TWOVAL(V_NUM, V_NUM):
|
||||
vres->v_num = qmul(v1->v_num, v2->v_num);
|
||||
return;
|
||||
@@ -727,6 +733,8 @@ invertvalue(VALUE *vp, VALUE *vres)
|
||||
void
|
||||
andvalue(VALUE *v1, VALUE *v2, VALUE *vres)
|
||||
{
|
||||
unsigned int twoval_as_uint; /* TWOVAL(a,b) or TWOVAL_INVALID */
|
||||
|
||||
vres->v_subtype = V_NOSUBTYPE;
|
||||
if (v1->v_type == V_NULL) {
|
||||
copyvalue(v2, vres);
|
||||
@@ -737,7 +745,8 @@ andvalue(VALUE *v1, VALUE *v2, VALUE *vres)
|
||||
return;
|
||||
}
|
||||
vres->v_type = v1->v_type;
|
||||
switch (TWOVAL(v1->v_type, v2->v_type)) {
|
||||
twoval_as_uint = TWOVAL_AS_UINT(v1->v_type, v2->v_type);
|
||||
switch (twoval_as_uint) {
|
||||
case TWOVAL(V_NUM, V_NUM):
|
||||
vres->v_num = qand(v1->v_num, v2->v_num);
|
||||
return;
|
||||
@@ -783,6 +792,8 @@ andvalue(VALUE *v1, VALUE *v2, VALUE *vres)
|
||||
void
|
||||
orvalue(VALUE *v1, VALUE *v2, VALUE *vres)
|
||||
{
|
||||
unsigned int twoval_as_uint; /* TWOVAL(a,b) or TWOVAL_INVALID */
|
||||
|
||||
if (v1->v_type == V_NULL) {
|
||||
copyvalue(v2, vres);
|
||||
return;
|
||||
@@ -793,7 +804,8 @@ orvalue(VALUE *v1, VALUE *v2, VALUE *vres)
|
||||
}
|
||||
vres->v_type = v1->v_type;
|
||||
vres->v_subtype = V_NOSUBTYPE;
|
||||
switch (TWOVAL(v1->v_type, v2->v_type)) {
|
||||
twoval_as_uint = TWOVAL_AS_UINT(v1->v_type, v2->v_type);
|
||||
switch (twoval_as_uint) {
|
||||
case TWOVAL(V_NUM, V_NUM):
|
||||
vres->v_num = qor(v1->v_num, v2->v_num);
|
||||
return;
|
||||
@@ -840,9 +852,12 @@ orvalue(VALUE *v1, VALUE *v2, VALUE *vres)
|
||||
void
|
||||
xorvalue(VALUE *v1, VALUE *v2, VALUE *vres)
|
||||
{
|
||||
unsigned int twoval_as_uint; /* TWOVAL(a,b) or TWOVAL_INVALID */
|
||||
|
||||
vres->v_type = v1->v_type;
|
||||
vres->v_subtype = V_NOSUBTYPE;
|
||||
switch (TWOVAL(v1->v_type, v2->v_type)) {
|
||||
twoval_as_uint = TWOVAL_AS_UINT(v1->v_type, v2->v_type);
|
||||
switch (twoval_as_uint) {
|
||||
case (TWOVAL(V_NUM, V_NUM)):
|
||||
vres->v_num = qxor(v1->v_num, v2->v_num);
|
||||
return;
|
||||
@@ -886,11 +901,13 @@ xorvalue(VALUE *v1, VALUE *v2, VALUE *vres)
|
||||
void
|
||||
hashopvalue(VALUE *v1, VALUE *v2, VALUE *vres)
|
||||
{
|
||||
unsigned int twoval_as_uint; /* TWOVAL(a,b) or TWOVAL_INVALID */
|
||||
NUMBER *q;
|
||||
|
||||
vres->v_type = v1->v_type;
|
||||
vres->v_subtype = V_NOSUBTYPE;
|
||||
switch (TWOVAL(v1->v_type, v2->v_type)) {
|
||||
twoval_as_uint = TWOVAL_AS_UINT(v1->v_type, v2->v_type);
|
||||
switch (twoval_as_uint) {
|
||||
case TWOVAL(V_NUM, V_NUM):
|
||||
q = qsub(v1->v_num, v2->v_num);
|
||||
vres->v_num = qqabs(q);
|
||||
@@ -952,9 +969,12 @@ backslashvalue(VALUE *vp, VALUE *vres)
|
||||
void
|
||||
setminusvalue(VALUE *v1, VALUE *v2, VALUE *vres)
|
||||
{
|
||||
unsigned int twoval_as_uint; /* TWOVAL(a,b) or TWOVAL_INVALID */
|
||||
|
||||
vres->v_type = v1->v_type;
|
||||
vres->v_subtype = V_NOSUBTYPE;
|
||||
switch (TWOVAL(v1->v_type, v2->v_type)) {
|
||||
twoval_as_uint = TWOVAL_AS_UINT(v1->v_type, v2->v_type);
|
||||
switch (twoval_as_uint) {
|
||||
case TWOVAL(V_NUM, V_NUM):
|
||||
vres->v_num = qandnot(v1->v_num, v2->v_num);
|
||||
return;
|
||||
@@ -2010,6 +2030,7 @@ powvalue(VALUE *v1, VALUE *v2, VALUE *vres)
|
||||
void
|
||||
powervalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres)
|
||||
{
|
||||
unsigned int twoval_as_uint; /* TWOVAL(a,b) or TWOVAL_INVALID */
|
||||
NUMBER *epsilon;
|
||||
COMPLEX *c, ctmp1, ctmp2;
|
||||
|
||||
@@ -2042,7 +2063,8 @@ powervalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres)
|
||||
return;
|
||||
}
|
||||
|
||||
switch (TWOVAL(v1->v_type, v2->v_type)) {
|
||||
twoval_as_uint = TWOVAL_AS_UINT(v1->v_type, v2->v_type);
|
||||
switch (twoval_as_uint) {
|
||||
case TWOVAL(V_NUM, V_NUM):
|
||||
if (qisneg(v1->v_num)) {
|
||||
ctmp1.real = v1->v_num;
|
||||
@@ -2098,6 +2120,7 @@ powervalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres)
|
||||
void
|
||||
divvalue(VALUE *v1, VALUE *v2, VALUE *vres)
|
||||
{
|
||||
unsigned int twoval_as_uint; /* TWOVAL(a,b) or TWOVAL_INVALID */
|
||||
COMPLEX *c;
|
||||
COMPLEX ctmp;
|
||||
NUMBER *q;
|
||||
@@ -2124,7 +2147,8 @@ divvalue(VALUE *v1, VALUE *v2, VALUE *vres)
|
||||
return;
|
||||
}
|
||||
vres->v_type = v1->v_type;
|
||||
switch (TWOVAL(v1->v_type, v2->v_type)) {
|
||||
twoval_as_uint = TWOVAL_AS_UINT(v1->v_type, v2->v_type);
|
||||
switch (twoval_as_uint) {
|
||||
case TWOVAL(V_NUM, V_NUM):
|
||||
vres->v_num = qqdiv(v1->v_num, v2->v_num);
|
||||
return;
|
||||
|
44
value.h
44
value.h
@@ -167,7 +167,8 @@ struct value {
|
||||
#define V_OPTR 19 /* octet address as pointer */
|
||||
#define V_SPTR 20 /* string address as pointer */
|
||||
#define V_NPTR 21 /* number address as pointer */
|
||||
#define V_MAX 21 /* highest legal value */
|
||||
|
||||
#define V_MAX V_NPTR /* highest legal value - must be last and match highest V_something value */
|
||||
|
||||
#define V_NOSUBTYPE 0 /* subtype has no meaning */
|
||||
#define V_NOASSIGNTO 1 /* protection status 1 */
|
||||
@@ -189,7 +190,46 @@ struct value {
|
||||
*/
|
||||
|
||||
|
||||
#define TWOVAL(a,b) ((a) << 5 | (b)) /* for switch of two values */
|
||||
/*
|
||||
* NOTE: The shift of 8 in TWOVAL() macro below assumes V_MAX < 1<<8
|
||||
*
|
||||
* The macro TWOVAL_ARGS_OK(a,b) will return true if both a and b are in range,
|
||||
* otherwise it will return false.
|
||||
*
|
||||
* The TWOVAL_INVALID is a value that TWOVAL_ARGS_OK(a,b) is true,
|
||||
* will never match a TWOVAL(a,b) value (i.e., using V_something defined values).
|
||||
*
|
||||
* The TWOVAL_AS_UINT(a,b) may be assigned to a unsigned int value so that
|
||||
* with one switches on that unsigned int, cases with a and/or b being
|
||||
* out of range will fall into the default (non-matching) case.
|
||||
*
|
||||
* unsigned int twoval_as_uint;
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* twoval_as_uint = TWOVAL_AS_UINT(a,b);
|
||||
* switch (twoval_as_uint) {
|
||||
* case TWOVAL(V_INT,V_INT):
|
||||
* ...
|
||||
* break;
|
||||
* case TWOVAL(V_INT,V_NUM):
|
||||
* ...
|
||||
* break;
|
||||
* default:
|
||||
* ...
|
||||
* break;
|
||||
* }
|
||||
*
|
||||
* If a is NOT 0 <= a <= V_MAX or if b is NOT 0 <= b <= V_MAX,
|
||||
* when () macro returns -1 (all bits set) in order to
|
||||
* not match and true TWOVAL() macro combination that uses
|
||||
* uses a V_something defined value above.
|
||||
*/
|
||||
|
||||
#define TWOVAL(a,b) ((unsigned int)(((a) << 8) | (b))) /* logical OR for switch of two V_something values */
|
||||
#define TWOVAL_ARGS_OK(a,b) (((a) >= 0) && ((a) <= V_MAX) && ((b) >= 0) && ((b) <= V_MAX))
|
||||
#define TWOVAL_INVALID ((unsigned int)(-1)) /* never a valid TWOVAL(a,b) value when a and b are in range */
|
||||
#define TWOVAL_AS_UINT(a,b) (TWOVAL_ARGS_OK(a,b) ? TWOVAL(a,b) : TWOVAL_INVALID)
|
||||
|
||||
#define NULL_VALUE ((VALUE *) 0)
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* version - determine the version of calc
|
||||
*
|
||||
* Copyright (C) 1999-2021 David I. Bell and Landon Curt Noll
|
||||
* Copyright (C) 1999-2023 David I. Bell and Landon Curt Noll
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -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 3 /* minor software version level */
|
||||
#define MAJOR_PATCH 2 /* major software version level */
|
||||
#define MINOR_PATCH 0 /* minor software version level */
|
||||
|
||||
|
||||
/*
|
||||
|
@@ -36,6 +36,9 @@ HAVE_UNISTD_H=NO
|
||||
HAVE_LIMITS_H=YES
|
||||
HAVE_ENVIRON=-DHAVE_NO_ENVIRON
|
||||
HAVE_ARC4RANDOM=-DHAVE_NO_ARC4RANDOM
|
||||
HAVE_SYS_VFS_H=NO
|
||||
HAVE_SYS_PARAM_H=NO
|
||||
HAVE_SYS_MOUNT_H=NO
|
||||
|
||||
BINDIR=/usr/bin/calc
|
||||
LIBDIR=/lib/calc
|
||||
|
6
zfunc.c
6
zfunc.c
@@ -1036,7 +1036,7 @@ zgcd(ZVALUE z1, ZVALUE z2, ZVALUE *res)
|
||||
}
|
||||
g = (FULL) (*a0 * w);
|
||||
if (h < BASEB) {
|
||||
g &= (1 << h) - 1;
|
||||
g &= (FULL)lowhalf[h];
|
||||
} else {
|
||||
g &= BASE1;
|
||||
}
|
||||
@@ -1354,14 +1354,14 @@ zlog10(ZVALUE z, BOOL *was_10_power)
|
||||
}
|
||||
|
||||
/* create power10 table */
|
||||
power10 = malloc(sizeof(long) * (max_power10_exp+1));
|
||||
power10 = calloc(max_power10_exp+1, sizeof(long));
|
||||
if (power10 == NULL) {
|
||||
math_error("cannot malloc power10 table");
|
||||
not_reached();
|
||||
}
|
||||
|
||||
/* load power10 table */
|
||||
for (i=0, v = 1L; i <= max_power10_exp; ++i, v *= 10L) {
|
||||
for (i=0, v = 1L; i < max_power10_exp; ++i, v *= 10L) {
|
||||
power10[i] = v;
|
||||
}
|
||||
}
|
||||
|
6
zmath.c
6
zmath.c
@@ -88,9 +88,11 @@ HALF *half_tbl[] = {
|
||||
/*
|
||||
* highhalf[i] - masks off the upper i bits of a HALF
|
||||
* rhighhalf[i] - masks off the upper BASEB-i bits of a HALF
|
||||
* lowhalf[i] - masks off the upper i bits of a HALF
|
||||
* rlowhalf[i] - masks off the upper BASEB-i bits of a HALF
|
||||
* lowhalf[i] - masks off the lower i bits of a HALF
|
||||
* rlowhalf[i] - masks off the lower BASEB-i bits of a HALF
|
||||
* bitmask[i] - (1 << i) for 0 <= i <= BASEB*2
|
||||
*
|
||||
* NOTE: In all cases 0 <= i <= BASEB
|
||||
*/
|
||||
HALF highhalf[BASEB+1] = {
|
||||
#if BASEB == 32
|
||||
|
@@ -2861,7 +2861,7 @@ zrandom(long cnt, ZVALUE *res)
|
||||
t = blum.bits-(dest.bit+1);
|
||||
*dest.loc-- = (blum.buffer >> t);
|
||||
dest.bit = BASEB-t-1;
|
||||
*dest.loc = ((blum.buffer&lowhalf[t]) << (dest.bit+1));
|
||||
*dest.loc = (HALF)(((unsigned long)(blum.buffer&lowhalf[t])) << (dest.bit+1));
|
||||
}
|
||||
dest.len -= blum.bits;
|
||||
}
|
||||
@@ -2896,7 +2896,7 @@ zrandom(long cnt, ZVALUE *res)
|
||||
t = loglogn-(dest.bit+1);
|
||||
*dest.loc-- |= (blum.buffer >> t);
|
||||
dest.bit = BASEB-t-1;
|
||||
*dest.loc = ((blum.buffer&lowhalf[t]) << (dest.bit+1));
|
||||
*dest.loc = (HALF)(((unsigned long)(blum.buffer&lowhalf[t])) << (dest.bit+1));
|
||||
}
|
||||
dest.len -= loglogn;
|
||||
}
|
||||
|
Reference in New Issue
Block a user