mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Added new aversin(x, [,eps]) for inverse versed sine and acoversin(x, [,eps]) for inverse coversed sine. Improved trig function help files to reference use of complex arguments that while supported were not documented. Removed old Makefile testing rules for make dbx and make gdb. Improved "make run" to execute calccalc using shared libraries from the local directory, and with reading of the startup scripts disabled. Changed "make prep" to perform various tests that are used to help verify that calc is ready for a release. Added Makefile testing rule testfuncsort to check for the sort of the builtin function list. Changed the order that builtin functions are listed by "show builtin" and the help/builtin to match the sorting of "LANG=C LC_ALL=C sort -d -u".
201 lines
7.4 KiB
Bash
Executable File
201 lines
7.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# trailblank - find trailing blanks and other file format picky issues
|
|
#
|
|
# This tools is used by "make prep".
|
|
#
|
|
# If all is well, this tool prints nothing and does an exit 0.
|
|
# If a problem is found, this tool prints messages and does a non-0 exit.
|
|
#
|
|
# Copyright (C) 2017,2018,2021-2023 Landon Curt Noll
|
|
#
|
|
# Calc is open software; you can redistribute it and/or modify it under
|
|
# the terms of version 2.1 of the GNU Lesser General Public License
|
|
# as published by the Free Software Foundation.
|
|
#
|
|
# Calc is distributed in the hope that it will be useful, but WITHOUT
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
|
# Public License for more details.
|
|
#
|
|
# A copy of version 2.1 of the GNU Lesser General Public License is
|
|
# distributed with calc under the filename COPYING-LGPL. You should have
|
|
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
|
#
|
|
# Under source code control: 2017/05/22 03:28:20
|
|
# File existed as early as: 2017
|
|
#
|
|
# chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
|
# Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
|
|
|
# exit code
|
|
#
|
|
export EXIT_CODE=0
|
|
|
|
# Look for leading whiitespace before a tab
|
|
#
|
|
# We exclude binary files, RCS source code history, intermediate
|
|
# compiled files, patch droppings and compiled binary libraries.
|
|
#
|
|
# Last, we have two files that have long lines that, for now,
|
|
# we cannot be as picky about without significant work.
|
|
#
|
|
LEADING_SPACES_BEFORE_TAB=$(
|
|
find . \( -path './NOTES' -o -path './calc' -o -path './ver_calc' -o \
|
|
-name '*.o' -o -name '*.a' -o -name '*ptch*' -o -name 'core*' -o \
|
|
-name '*.orig' -o -name '*.rej' -o -name '*.bak' -o \
|
|
-name '*.ptch' -o -name 'core.*' -o \
|
|
-name '*.so*' -o -name 'calc-static' -o -name 'libcalc.*' -o \
|
|
-name 'sample_many' -o -name 'sample_rand' -o \
|
|
-path './help/funclist' -o -path './have_stdvs' -o \
|
|
-path './endian' -o -path './no_implicit' -o -name 'chk_c' -o \
|
|
-path './longbits' -o -name '.*.swp' -o -name 'conf.h' -o \
|
|
-path './help/errorcodes.sed' -o -path './cal/set8700.line' -o \
|
|
-name '.git' -o -path './custom/libcustcalc*' -o -path './libcustcalc*' -o \
|
|
-name 'sample_many-static' -o -name 'sample_rand-static' -o \
|
|
-name 'codeql-analysis.yml' -o -name tags -o -name debug.out \
|
|
\) -prune -o -type f -print0 | \
|
|
xargs -0 egrep -l '^ * * '
|
|
)
|
|
if [[ -n $LEADING_SPACES_BEFORE_TAB ]]; then
|
|
echo
|
|
echo '# files with leading spaces before a tab'
|
|
echo "$LEADING_SPACES_BEFORE_TAB" | sed -e 's/^\.\///'
|
|
EXIT_CODE=1
|
|
fi
|
|
|
|
# Look for trailing whitespace
|
|
#
|
|
# We exclude binary files, RCS source code history, intermediate
|
|
# compiled files, patch droppings and compiled binary libraries.
|
|
#
|
|
# Last, we have two files that have long lines that, for now,
|
|
# we cannot be as picky about without significant work.
|
|
#
|
|
TRAILING_WHITESPACE=$(
|
|
find . \( -path './NOTES' -o -path './calc' -o -path './ver_calc' -o \
|
|
-name '*.o' -o -name '*.a' -o -name '*ptch*' -o -name 'core*' -o \
|
|
-name '*.orig' -o -name '*.rej' -o -name '*.bak' -o \
|
|
-name '*.ptch' -o -name 'core.*' -o \
|
|
-name '*.so*' -o -name 'calc-static' -o -name 'libcalc.*' -o \
|
|
-name 'sample_many' -o -name 'sample_rand' -o \
|
|
-path './help/funclist' -o -path './have_stdvs' -o \
|
|
-path './endian' -o -path './no_implicit' -o -name 'chk_c' -o \
|
|
-path './longbits' -o -name '.*.swp' -o -name 'conf.h' -o \
|
|
-path './help/errorcodes.sed' -o -path './cal/set8700.line' -o \
|
|
-name '.git' -o -path './custom/libcustcalc*' -o -path './libcustcalc*' -o \
|
|
-name 'sample_many-static' -o -name 'sample_rand-static' -o \
|
|
-name 'codeql-analysis.yml' -o -name tags -o -name debug.out \
|
|
\) -prune -o -type f -print0 | \
|
|
xargs -0 egrep -l '[ ]$'
|
|
)
|
|
if [[ -n $TRAILING_WHITESPACE ]]; then
|
|
echo
|
|
echo '# files with trailing whitespace'
|
|
echo "$TRAILING_WHITESPACE" | sed -e 's/^\.\///'
|
|
EXIT_CODE=2
|
|
fi
|
|
|
|
# Perform special picky tool phase 0 processing
|
|
#
|
|
# Some of these files must have long lines. Some of these files may not exist.
|
|
#
|
|
if [[ -x /usr/local/bin/picky ]]; then
|
|
PICKY_PHASE_0A=$(/usr/local/bin/picky -w -s -v ./help/errorcodes.sed ./cal/set8700.line \
|
|
.gitignore README.md .lldbinit 2>&1)
|
|
status="$?"
|
|
if [[ $status -ne 0 ]]; then
|
|
echo
|
|
echo '# picky failed on one of the files with long lines'
|
|
echo "$PICKY_PHASE_0A" | sed -e 's/\.\///'
|
|
EXIT_CODE=3
|
|
fi
|
|
if [[ -e conf.h ]]; then
|
|
PICKY_PHASE_0B=$(/usr/local/bin/picky -w -s -v conf.h 2>&1)
|
|
status="$?"
|
|
if [[ $status -ne 0 ]]; then
|
|
echo
|
|
echo '# picky failed on conf.h'
|
|
echo "$PICKY_PHASE_0B" | sed -e 's/\.\///'
|
|
EXIT_CODE=4
|
|
fi
|
|
fi
|
|
if [[ -e calcerr.h ]]; then
|
|
PICKY_PHASE_0C=$(/usr/local/bin/picky -w -s -v calcerr.h 2>&1)
|
|
status="$?"
|
|
if [[ $status -ne 0 ]]; then
|
|
echo
|
|
echo '# picky failed on calcerr.h'
|
|
echo "$PICKY_PHASE_0C" | sed -e 's/\.\///'
|
|
EXIT_CODE=5
|
|
fi
|
|
fi
|
|
else
|
|
echo "# $0: WARNING: /usr/local/bin/picky not found: skipping picky phase 0 checks!" 1>&2
|
|
echo "#" 1>&2
|
|
fi
|
|
|
|
# Picky tool processing phase 1
|
|
#
|
|
# We exclude binary files, source code history, intermediate
|
|
# compiled files, patch droppings and compiled binary libraries.
|
|
#
|
|
# Last, we have files that have long lines that, for now,
|
|
# we cannot be as picky about without significant work.
|
|
#
|
|
PICKY_PHASE_1=$(
|
|
find . \( -path './NOTES' -o -path './calc' -o -path './ver_calc' -o \
|
|
-name '*.o' -o -name '*.a' -o -name '*ptch*' -o -name 'core*' -o \
|
|
-name '*.orig' -o -name '*.rej' -o -name '*.bak' -o \
|
|
-name '*.ptch' -o -name 'core.*' -o \
|
|
-name '*.so*' -o -name 'calc-static' -o -name 'libcalc.*' -o \
|
|
-name 'sample_many' -o -name 'sample_rand' -o \
|
|
-path './help/funclist' -o -path './have_stdvs' -o \
|
|
-path './endian' -o -path './no_implicit' -o -name 'chk_c' -o \
|
|
-path './longbits' -o -name '.*.swp' -o -name 'conf.h' -o \
|
|
-path './help/errorcodes.sed' -o -path './cal/set8700.line' -o \
|
|
-name '.git' -o -path './custom/libcustcalc*' -o -path './libcustcalc*' -o \
|
|
-name 'sample_many-static' -o -name 'sample_rand-static' -o \
|
|
-name 'codeql-analysis.yml' -o -name tags -o -name debug.out \
|
|
-o \
|
|
-path './help/errorcodes.sed' -o -path './help/errorcodes.sed' -o \
|
|
-name '.gitignore' -o -name 'README.md' -o -name '.lldbinit' \
|
|
\) -prune -o -type f -print0 | \
|
|
if [[ -x /usr/local/bin/picky ]]; then
|
|
xargs -0 /usr/local/bin/picky -s -v -w132
|
|
else
|
|
echo "# $0: WARNING: /usr/local/bin/picky not found: skipping picky phase 1 check!" 1>&2
|
|
echo "#" 1>&2
|
|
echo "# $0: NOTICE: The picky tool used is from the following GitHub repo:" 1>&2
|
|
echo "#" 1>&2
|
|
echo "# https://github.com/lcn2/picky for the picky tool GitHub repo." 1>&2
|
|
echo "#" 1>&2
|
|
fi
|
|
)
|
|
if [[ -n $PICKY_PHASE_1 ]]; then
|
|
echo
|
|
echo '# files flagged by picky'
|
|
echo "$PICKY_PHASE_1" | sed -e 's/^picky: \.\///' -e 's/ / - /'
|
|
EXIT_CODE=6
|
|
fi
|
|
|
|
# look for backup Makefiles
|
|
#
|
|
BACKUP_MAKEILES=$(
|
|
find . -name Makefile.bak -print
|
|
)
|
|
if [[ -n $BACKUP_MAKEILES ]]; then
|
|
echo
|
|
echo "# You need execute the following to remove backup Makefiles:"
|
|
echo
|
|
echo "$BACKUP_MAKEILES" | while read file; do
|
|
echo "rm -f $file"
|
|
done
|
|
EXIT_CODE=7
|
|
fi
|
|
|
|
# All Done!!! -- Jessica Noll, Age 2
|
|
#
|
|
exit "$EXIT_CODE"
|