Commit 2f57ecae authored by Stefan Eßer's avatar Stefan Eßer
Browse files

vendor/bc: imoport release 5.0.0

This is a new major release with a number of changes and extensions:

- Limited the number of temporary numbers and made the space for them
  static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
  and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
  environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
  and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
  left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
parent b46baf82
*.vcxproj eol=crlf *.vcxproj eol=crlf
*.vcxproj.filters eol=crlf *.vcxproj.filters eol=crlf
*.sln eol= crlf *.sln eol=crlf
...@@ -51,11 +51,17 @@ print_results.txt ...@@ -51,11 +51,17 @@ print_results.txt
bessel.txt bessel.txt
bessel_results.txt bessel_results.txt
prime.txt prime.txt
stream.txt strings2.txt
strings2_results.txt
tests/bc/scripts/add.txt tests/bc/scripts/add.txt
tests/bc/scripts/divide.txt tests/bc/scripts/divide.txt
tests/bc/scripts/multiply.txt tests/bc/scripts/multiply.txt
tests/bc/scripts/subtract.txt tests/bc/scripts/subtract.txt
tests/bc/scripts/strings2.txt
benchmarks/bc/*.txt
benchmarks/dc/*.txt
scripts/ministat
scripts/bitgen
perf.data perf.data
perf.data.old perf.data.old
*.gcda *.gcda
......
...@@ -79,9 +79,9 @@ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER ...@@ -79,9 +79,9 @@ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 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. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
## `safe-install.sh` ## `scripts/safe-install.sh`
The file `safe-install.sh` is under the following copyright and license: The file `scripts/safe-install.sh` is under the following copyright and license:
Copyright (c) 2021 Rich Felker Copyright (c) 2021 Rich Felker
...@@ -101,3 +101,13 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR ...@@ -101,3 +101,13 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 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. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
## `scripts/ministat.c`
The file `scripts/ministat.c` is under the following license:
"THE BEER-WARE LICENSE" (Revision 42):
<phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
can do whatever you want with this stuff. If we meet some day, and you think
this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
...@@ -134,39 +134,64 @@ BC_ENABLE_HISTORY = %%HISTORY%% ...@@ -134,39 +134,64 @@ BC_ENABLE_HISTORY = %%HISTORY%%
BC_ENABLE_EXTRA_MATH_NAME = BC_ENABLE_EXTRA_MATH BC_ENABLE_EXTRA_MATH_NAME = BC_ENABLE_EXTRA_MATH
BC_ENABLE_EXTRA_MATH = %%EXTRA_MATH%% BC_ENABLE_EXTRA_MATH = %%EXTRA_MATH%%
BC_ENABLE_NLS = %%NLS%% BC_ENABLE_NLS = %%NLS%%
BC_ENABLE_PROMPT = %%PROMPT%%
BC_LONG_BIT = %%LONG_BIT%% BC_LONG_BIT = %%LONG_BIT%%
BC_ENABLE_AFL = %%FUZZ%% BC_ENABLE_AFL = %%FUZZ%%
BC_ENABLE_MEMCHECK = %%MEMCHECK%% BC_ENABLE_MEMCHECK = %%MEMCHECK%%
BC_DEFAULT_BANNER = %%BC_DEFAULT_BANNER%%
BC_DEFAULT_SIGINT_RESET = %%BC_DEFAULT_SIGINT_RESET%%
DC_DEFAULT_SIGINT_RESET = %%DC_DEFAULT_SIGINT_RESET%%
BC_DEFAULT_TTY_MODE = %%BC_DEFAULT_TTY_MODE%%
DC_DEFAULT_TTY_MODE = %%DC_DEFAULT_TTY_MODE%%
BC_DEFAULT_PROMPT = %%BC_DEFAULT_PROMPT%%
DC_DEFAULT_PROMPT = %%DC_DEFAULT_PROMPT%%
RM = rm RM = rm
MKDIR = mkdir MKDIR = mkdir
INSTALL = ./exec-install.sh SCRIPTS = ./scripts
SAFE_INSTALL = ./safe-install.sh
LINK = ./link.sh MINISTAT = ministat
MANPAGE = ./manpage.sh MINISTAT_EXEC = $(SCRIPTS)/$(MINISTAT)
KARATSUBA = ./karatsuba.py
LOCALE_INSTALL = ./locale_install.sh BITFUNCGEN = bitfuncgen
LOCALE_UNINSTALL = ./locale_uninstall.sh BITFUNCGEN_EXEC = $(SCRIPTS)/$(BITFUNCGEN)
INSTALL = $(SCRIPTS)/exec-install.sh
SAFE_INSTALL = $(SCRIPTS)/safe-install.sh
LINK = $(SCRIPTS)/link.sh
MANPAGE = $(SCRIPTS)/manpage.sh
KARATSUBA = $(SCRIPTS)/karatsuba.py
LOCALE_INSTALL = $(SCRIPTS)/locale_install.sh
LOCALE_UNINSTALL = $(SCRIPTS)/locale_uninstall.sh
VALGRIND_ARGS = --error-exitcode=100 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all VALGRIND_ARGS = --error-exitcode=100 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all
TEST_STARS = "***********************************************************************" TEST_STARS = ***********************************************************************
BC_NUM_KARATSUBA_LEN = %%KARATSUBA_LEN%% BC_NUM_KARATSUBA_LEN = %%KARATSUBA_LEN%%
BC_DEFS0 = -DBC_DEFAULT_BANNER=$(BC_DEFAULT_BANNER)
BC_DEFS1 = -DBC_DEFAULT_SIGINT_RESET=$(BC_DEFAULT_SIGINT_RESET)
BC_DEFS2 = -DBC_DEFAULT_TTY_MODE=$(BC_DEFAULT_TTY_MODE)
BC_DEFS3 = -DBC_DEFAULT_PROMPT=$(BC_DEFAULT_PROMPT)
BC_DEFS = $(BC_DEFS0) $(BC_DEFS1) $(BC_DEFS2) $(BC_DEFS3)
DC_DEFS1 = -DDC_DEFAULT_SIGINT_RESET=$(DC_DEFAULT_SIGINT_RESET)
DC_DEFS2 = -DDC_DEFAULT_TTY_MODE=$(DC_DEFAULT_TTY_MODE)
DC_DEFS3 = -DDC_DEFAULT_PROMPT=$(DC_DEFAULT_PROMPT)
DC_DEFS = $(DC_DEFS1) $(DC_DEFS2) $(DC_DEFS3)
CPPFLAGS1 = -D$(BC_ENABLED_NAME)=$(BC_ENABLED) -D$(DC_ENABLED_NAME)=$(DC_ENABLED) CPPFLAGS1 = -D$(BC_ENABLED_NAME)=$(BC_ENABLED) -D$(DC_ENABLED_NAME)=$(DC_ENABLED)
CPPFLAGS2 = $(CPPFLAGS1) -I./include/ -DBUILD_TYPE=$(BC_BUILD_TYPE) %%LONG_BIT_DEFINE%% CPPFLAGS2 = $(CPPFLAGS1) -I./include/ -DBUILD_TYPE=$(BC_BUILD_TYPE) %%LONG_BIT_DEFINE%%
CPPFLAGS3 = $(CPPFLAGS2) -DEXECPREFIX=$(EXEC_PREFIX) -DMAINEXEC=$(MAIN_EXEC) CPPFLAGS3 = $(CPPFLAGS2) -DEXECPREFIX=$(EXEC_PREFIX) -DMAINEXEC=$(MAIN_EXEC)
CPPFLAGS4 = $(CPPFLAGS3) -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 CPPFLAGS4 = $(CPPFLAGS3) -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 %%BSD%%
CPPFLAGS5 = $(CPPFLAGS4) -DBC_NUM_KARATSUBA_LEN=$(BC_NUM_KARATSUBA_LEN) CPPFLAGS5 = $(CPPFLAGS4) -DBC_NUM_KARATSUBA_LEN=$(BC_NUM_KARATSUBA_LEN)
CPPFLAGS6 = $(CPPFLAGS5) -DBC_ENABLE_NLS=$(BC_ENABLE_NLS) -DBC_ENABLE_PROMPT=$(BC_ENABLE_PROMPT) CPPFLAGS6 = $(CPPFLAGS5) -DBC_ENABLE_NLS=$(BC_ENABLE_NLS)
CPPFLAGS7 = $(CPPFLAGS6) -D$(BC_ENABLE_EXTRA_MATH_NAME)=$(BC_ENABLE_EXTRA_MATH) CPPFLAGS7 = $(CPPFLAGS6) -D$(BC_ENABLE_EXTRA_MATH_NAME)=$(BC_ENABLE_EXTRA_MATH)
CPPFLAGS8 = $(CPPFLAGS7) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY) -DBC_ENABLE_LIBRARY=$(BC_ENABLE_LIBRARY) CPPFLAGS8 = $(CPPFLAGS7) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY) -DBC_ENABLE_LIBRARY=$(BC_ENABLE_LIBRARY)
CPPFLAGS = $(CPPFLAGS8) -DBC_ENABLE_MEMCHECK=$(BC_ENABLE_MEMCHECK) -DBC_ENABLE_AFL=$(BC_ENABLE_AFL) CPPFLAGS = $(CPPFLAGS8) -DBC_ENABLE_MEMCHECK=$(BC_ENABLE_MEMCHECK) -DBC_ENABLE_AFL=$(BC_ENABLE_AFL)
CFLAGS = $(CPPFLAGS) %%CPPFLAGS%% %%CFLAGS%% CFLAGS = $(CPPFLAGS) $(BC_DEFS) $(DC_DEFS) %%CPPFLAGS%% %%CFLAGS%%
LDFLAGS = %%LDFLAGS%% LDFLAGS = %%LDFLAGS%%
HOSTCFLAGS = %%HOSTCFLAGS%% HOSTCFLAGS = %%HOSTCFLAGS%%
...@@ -219,6 +244,12 @@ $(BIN): ...@@ -219,6 +244,12 @@ $(BIN):
headers: %%HEADERS%% headers: %%HEADERS%%
$(MINISTAT):
$(HOSTCC) $(HOSTCFLAGS) -lm -o $(MINISTAT_EXEC) scripts/ministat.c
$(BITFUNCGEN):
$(HOSTCC) $(HOSTCFLAGS) -lm -o $(BITFUNCGEN_EXEC) scripts/bitfuncgen.c
help: help:
@printf 'available targets:\n' @printf 'available targets:\n'
@printf '\n' @printf '\n'
...@@ -249,16 +280,25 @@ help: ...@@ -249,16 +280,25 @@ help:
@printf ' valgrind_dc runs the dc test suite, if dc has been built,\n' @printf ' valgrind_dc runs the dc test suite, if dc has been built,\n'
@printf ' through valgrind\n' @printf ' through valgrind\n'
run_all_tests: run_all_tests: bc_all_tests timeconst_all_tests dc_all_tests history_all_tests
bc_all_tests:
%%BC_ALL_TESTS%% %%BC_ALL_TESTS%%
timeconst_all_tests:
%%TIMECONST_ALL_TESTS%% %%TIMECONST_ALL_TESTS%%
dc_all_tests:
%%DC_ALL_TESTS%% %%DC_ALL_TESTS%%
history_all_tests:
%%HISTORY_TESTS%%
check: test check: test
test: %%TESTS%% test: %%TESTS%%
test_bc: test_bc_header test_bc_tests test_bc_scripts test_bc_stdin test_bc_read test_bc_errors test_bc_other test_bc: test_bc_header test_bc_tests test_bc_scripts test_bc_errors test_bc_stdin test_bc_read test_bc_other
@printf '\nAll bc tests passed.\n\n$(TEST_STARS)\n' @printf '\nAll bc tests passed.\n\n$(TEST_STARS)\n'
test_bc_tests:%%BC_TESTS%% test_bc_tests:%%BC_TESTS%%
...@@ -275,12 +315,12 @@ test_bc_errors: ...@@ -275,12 +315,12 @@ test_bc_errors:
@sh tests/errors.sh bc %%BC_TEST_EXEC%% @sh tests/errors.sh bc %%BC_TEST_EXEC%%
test_bc_other: test_bc_other:
@sh tests/other.sh bc %%BC_TEST_EXEC%% @sh tests/other.sh bc $(BC_ENABLE_EXTRA_MATH) %%BC_TEST_EXEC%%
test_bc_header: test_bc_header:
@printf '$(TEST_STARS)\n\nRunning bc tests...\n\n' @printf '$(TEST_STARS)\n\nRunning bc tests...\n\n'
test_dc: test_dc_header test_dc_tests test_dc_scripts test_dc_stdin test_dc_read test_dc_errors test_dc_other test_dc: test_dc_header test_dc_tests test_dc_scripts test_dc_errors test_dc_stdin test_dc_read test_dc_other
@printf '\nAll dc tests passed.\n\n$(TEST_STARS)\n' @printf '\nAll dc tests passed.\n\n$(TEST_STARS)\n'
test_dc_tests:%%DC_TESTS%% test_dc_tests:%%DC_TESTS%%
...@@ -297,7 +337,7 @@ test_dc_errors: ...@@ -297,7 +337,7 @@ test_dc_errors:
@sh tests/errors.sh dc %%DC_TEST_EXEC%% @sh tests/errors.sh dc %%DC_TEST_EXEC%%
test_dc_other: test_dc_other:
@sh tests/other.sh dc %%DC_TEST_EXEC%% @sh tests/other.sh dc $(BC_ENABLE_EXTRA_MATH) %%DC_TEST_EXEC%%
test_dc_header: test_dc_header:
@printf '$(TEST_STARS)\n\nRunning dc tests...\n\n' @printf '$(TEST_STARS)\n\nRunning dc tests...\n\n'
...@@ -305,6 +345,122 @@ test_dc_header: ...@@ -305,6 +345,122 @@ test_dc_header:
timeconst: timeconst:
%%TIMECONST%% %%TIMECONST%%
test_history: test_history_header test_bc_history test_dc_history
@printf '\nAll history tests passed.\n\n$(TEST_STARS)\n'
test_bc_history:%%BC_HISTORY_TEST_PREREQS%%
test_bc_history_all: test_bc_history0 test_bc_history1 test_bc_history2 test_bc_history3 test_bc_history4 test_bc_history5 test_bc_history6 test_bc_history7 test_bc_history8 test_bc_history9 test_bc_history10 test_bc_history11 test_bc_history12 test_bc_history13 test_bc_history14 test_bc_history15 test_bc_history16 test_bc_history17 test_bc_history18 test_bc_history19 test_bc_history20 test_bc_history21
test_bc_history_skip:
@printf 'No bc history tests to run\n'
test_bc_history0:
@sh tests/history.sh bc 0 %%BC_TEST_EXEC%%
test_bc_history1:
@sh tests/history.sh bc 1 %%BC_TEST_EXEC%%
test_bc_history2:
@sh tests/history.sh bc 2 %%BC_TEST_EXEC%%
test_bc_history3:
@sh tests/history.sh bc 3 %%BC_TEST_EXEC%%
test_bc_history4:
@sh tests/history.sh bc 4 %%BC_TEST_EXEC%%
test_bc_history5:
@sh tests/history.sh bc 5 %%BC_TEST_EXEC%%
test_bc_history6:
@sh tests/history.sh bc 6 %%BC_TEST_EXEC%%
test_bc_history7:
@sh tests/history.sh bc 7 %%BC_TEST_EXEC%%
test_bc_history8:
@sh tests/history.sh bc 8 %%BC_TEST_EXEC%%
test_bc_history9:
@sh tests/history.sh bc 9 %%BC_TEST_EXEC%%
test_bc_history10:
@sh tests/history.sh bc 10 %%BC_TEST_EXEC%%
test_bc_history11:
@sh tests/history.sh bc 11 %%BC_TEST_EXEC%%
test_bc_history12:
@sh tests/history.sh bc 12 %%BC_TEST_EXEC%%
test_bc_history13:
@sh tests/history.sh bc 13 %%BC_TEST_EXEC%%
test_bc_history14:
@sh tests/history.sh bc 14 %%BC_TEST_EXEC%%
test_bc_history15:
@sh tests/history.sh bc 15 %%BC_TEST_EXEC%%
test_bc_history16:
@sh tests/history.sh bc 16 %%BC_TEST_EXEC%%
test_bc_history17:
@sh tests/history.sh bc 17 %%BC_TEST_EXEC%%
test_bc_history18:
@sh tests/history.sh bc 18 %%BC_TEST_EXEC%%
test_bc_history19:
@sh tests/history.sh bc 19 %%BC_TEST_EXEC%%
test_bc_history20:
@sh tests/history.sh bc 20 %%BC_TEST_EXEC%%
test_bc_history21:
@sh tests/history.sh bc 21 %%BC_TEST_EXEC%%
test_dc_history:%%DC_HISTORY_TEST_PREREQS%%
test_dc_history_all: test_dc_history0 test_dc_history1 test_dc_history2 test_dc_history3 test_dc_history4 test_dc_history5 test_dc_history6 test_dc_history7 test_dc_history8 test_dc_history9
test_dc_history_skip:
@printf 'No dc history tests to run\n'
test_dc_history0:
@sh tests/history.sh dc 0 %%DC_TEST_EXEC%%
test_dc_history1:
@sh tests/history.sh dc 1 %%DC_TEST_EXEC%%
test_dc_history2:
@sh tests/history.sh dc 2 %%DC_TEST_EXEC%%
test_dc_history3:
@sh tests/history.sh dc 3 %%DC_TEST_EXEC%%
test_dc_history4:
@sh tests/history.sh dc 4 %%DC_TEST_EXEC%%
test_dc_history5:
@sh tests/history.sh dc 5 %%DC_TEST_EXEC%%
test_dc_history6:
@sh tests/history.sh dc 6 %%DC_TEST_EXEC%%
test_dc_history7:
@sh tests/history.sh dc 7 %%DC_TEST_EXEC%%
test_dc_history8:
@sh tests/history.sh dc 8 %%DC_TEST_EXEC%%
test_dc_history9:
@sh tests/history.sh dc 9 %%DC_TEST_EXEC%%
test_history_header:
@printf '$(TEST_STARS)\n\nRunning history tests...\n\n'
library_test: $(LIBBC) library_test: $(LIBBC)
$(CC) $(CFLAGS) $(BCL_TEST_C) $(LIBBC) -o $(BCL_TEST) $(CC) $(CFLAGS) $(BCL_TEST_C) $(LIBBC) -o $(BCL_TEST)
...@@ -322,12 +478,6 @@ coverage_output: ...@@ -322,12 +478,6 @@ coverage_output:
coverage:%%COVERAGE_PREREQS%% coverage:%%COVERAGE_PREREQS%%
libcname:
@printf '%s' "$(BC_LIB_C)"
extra_math:
@printf '%s' "$(BC_ENABLE_EXTRA_MATH)"
manpages: manpages:
$(MANPAGE) bc $(MANPAGE) bc
$(MANPAGE) dc $(MANPAGE) dc
...@@ -348,15 +498,19 @@ clean:%%CLEAN_PREREQS%% ...@@ -348,15 +498,19 @@ clean:%%CLEAN_PREREQS%%
@$(RM) -f $(BC_LIB2_C) $(BC_LIB2_O) @$(RM) -f $(BC_LIB2_C) $(BC_LIB2_O)
@$(RM) -f $(BC_HELP_C) $(BC_HELP_O) @$(RM) -f $(BC_HELP_C) $(BC_HELP_O)
@$(RM) -f $(DC_HELP_C) $(DC_HELP_O) @$(RM) -f $(DC_HELP_C) $(DC_HELP_O)
@$(RM) -fr $(BC_TEST_OUTPUTS) $(DC_TEST_OUTPUTS)
@$(RM) -fr $(BC_FUZZ_OUTPUTS) $(DC_FUZZ_OUTPUTS)
@$(RM) -fr Debug/ Release/ @$(RM) -fr Debug/ Release/
clean_config: clean clean_benchmarks:
@printf 'Cleaning benchmarks...\n'
@$(RM) -f $(MINISTAT_EXEC)
@$(RM) -f benchmarks/bc/*.txt
@$(RM) -f benchmarks/dc/*.txt
clean_config: clean clean_benchmarks
@printf 'Cleaning config...\n' @printf 'Cleaning config...\n'
@$(RM) -f Makefile @$(RM) -f Makefile
@$(RM) -f $(BC_MD) $(DC_MD) @$(RM) -f $(BC_MD) $(BC_MANPAGE)
@$(RM) -f $(BC_MANPAGE) $(DC_MANPAGE) @$(RM) -f $(DC_MD) $(DC_MANPAGE)
clean_coverage: clean_coverage:
@printf 'Cleaning coverage files...\n' @printf 'Cleaning coverage files...\n'
...@@ -376,9 +530,12 @@ clean_coverage: ...@@ -376,9 +530,12 @@ clean_coverage:
clean_tests: clean clean_config clean_coverage clean_tests: clean clean_config clean_coverage
@printf 'Cleaning test files...\n' @printf 'Cleaning test files...\n'
@$(RM) -fr $(BC_TEST_OUTPUTS) $(DC_TEST_OUTPUTS)
@$(RM) -fr $(BC_FUZZ_OUTPUTS) $(DC_FUZZ_OUTPUTS)
@$(RM) -f tests/bc/parse.txt tests/bc/parse_results.txt @$(RM) -f tests/bc/parse.txt tests/bc/parse_results.txt
@$(RM) -f tests/bc/print.txt tests/bc/print_results.txt @$(RM) -f tests/bc/print.txt tests/bc/print_results.txt
@$(RM) -f tests/bc/bessel.txt tests/bc/bessel_results.txt @$(RM) -f tests/bc/bessel.txt tests/bc/bessel_results.txt
@$(RM) -f tests/bc/strings2.txt tests/bc/strings2_results.txt
@$(RM) -f tests/bc/scripts/bessel.txt @$(RM) -f tests/bc/scripts/bessel.txt
@$(RM) -f tests/bc/scripts/parse.txt @$(RM) -f tests/bc/scripts/parse.txt
@$(RM) -f tests/bc/scripts/print.txt @$(RM) -f tests/bc/scripts/print.txt
...@@ -386,13 +543,15 @@ clean_tests: clean clean_config clean_coverage ...@@ -386,13 +543,15 @@ clean_tests: clean clean_config clean_coverage
@$(RM) -f tests/bc/scripts/divide.txt @$(RM) -f tests/bc/scripts/divide.txt
@$(RM) -f tests/bc/scripts/multiply.txt @$(RM) -f tests/bc/scripts/multiply.txt
@$(RM) -f tests/bc/scripts/subtract.txt @$(RM) -f tests/bc/scripts/subtract.txt
@$(RM) -f tests/dc/scripts/prime.txt tests/dc/scripts/stream.txt @$(RM) -f tests/bc/scripts/strings2.txt
@$(RM) -f tests/dc/scripts/prime.txt
@$(RM) -f .log_*.txt @$(RM) -f .log_*.txt
@$(RM) -f .math.txt .results.txt .ops.txt @$(RM) -f .math.txt .results.txt .ops.txt
@$(RM) -f .test.txt @$(RM) -f .test.txt
@$(RM) -f tags .gdbbreakpoints .gdb_history .gdbsetup @$(RM) -f tags .gdbbreakpoints .gdb_history .gdbsetup
@$(RM) -f cscope.* @$(RM) -f cscope.*
@$(RM) -f bc.old @$(RM) -f bc.old
@$(RM) -f $(BITFUNCGEN_EXEC)
install_locales: install_locales:
%%INSTALL_LOCALES%% %%INSTALL_LOCALES%%
......
# News # News
## 5.0.0
This is a major production release with several changes:
* Added support for OpenBSD's `pledge()` and `unveil()`.
* Fixed print bug where a backslash newline combo was printed even if only one
digit was left, something I blindly copied from GNU `bc`, like a fool.
* Fixed bugs in the manuals.
* Fixed a possible multiplication overflow in power.
* Temporary numbers are garbage collected if allocation fails, and the
allocation is retried. This is to make `bc` and `dc` more resilient to running
out of memory.
* Limited the number of temporary numbers and made the space for them static so
that allocating more space for them cannot fail.
* Allowed integers with non-zero `scale` to be used with power, places, and
shift operators.
* Added greatest common divisor and least common multiple to `lib2.bc`.
* Added `SIGQUIT` handling to history.
* Added a command to `dc` (`y`) to get the length of register stacks.
* Fixed multi-digit bugs in `lib2.bc`.
* Removed the no prompt build option.
* Created settings that builders can set defaults for and users can set their
preferences for. This includes the `bc` banner, resetting on `SIGINT`, TTY
mode, and prompt.
* Added history support to Windows.
* Fixed bugs with the handling of register names in `dc`.
* Fixed bugs with multi-line comments and strings in both calculators.
* Added a new error type and message for `dc` when register stacks don't have
enough items.
* Optimized string allocation.
* Made `bc` and `dc` UTF-8 capable.
* Fixed a bug with `void` functions.
* Fixed a misspelled symbol in `bcl`. This is technically a breaking change,
which requires this to be `5.0.0`.
* Added the ability for users to get the copyright banner back.
* Added the ability for users to have `bc` and `dc` quit on `SIGINT`.
* Added the ability for users to disable prompt and TTY mode by environment
variables.
* Added the ability for users to redefine keywords. This is another reason this
is `5.0.0`.
* Added `dc`'s modular exponentiation and divmod to `bc`.
* Added the ability to assign strings to variables and array elements and pass
them to functions in `bc`.
* Added `dc`'s asciify command and stream printing to `bc`.
* Added a command to `dc` (`Y`) to get the length of an array.
* Added a command to `dc` (`,`) to get the depth of the execution stack.
* Added bitwise and, or, xor, left shift, right shift, reverse, left rotate,
right rotate, and mod functions to `lib2.bc`.
* Added the functions `s2u(x)` and `s2un(x,n)`, to `lib2.bc`.
## 4.0.2 ## 4.0.2
This is a production release that fixes two bugs: This is a production release that fixes two bugs:
...@@ -310,8 +360,8 @@ running tests during install. **If `bc` segfaults while running arg tests when ...@@ -310,8 +360,8 @@ running tests during install. **If `bc` segfaults while running arg tests when
updating, it is because the global locale files have not been replaced. Make updating, it is because the global locale files have not been replaced. Make
sure to either prevent the test suite from running on update or remove the old sure to either prevent the test suite from running on update or remove the old
locale files before updating.** (Removing the locale files can be done with locale files before updating.** (Removing the locale files can be done with
`make uninstall` or by running the `locale_uninstall.sh` script.) Once this is `make uninstall` or by running the [`locale_uninstall.sh`][22] script.) Once
done, `bc` should install without problems.* this is done, `bc` should install without problems.*
*Second, **the option to build without signal support has been removed**. See *Second, **the option to build without signal support has been removed**. See
below for the reasons why.* below for the reasons why.*
...@@ -396,7 +446,7 @@ diameter of the universe in Planck lengths. ...@@ -396,7 +446,7 @@ diameter of the universe in Planck lengths.
(For 32-bit, these numbers are either 32 integer digits or 12 integer digits and (For 32-bit, these numbers are either 32 integer digits or 12 integer digits and
20 fractional digits. These are also quite big, and going much bigger on a 20 fractional digits. These are also quite big, and going much bigger on a
32-bit system seems a little pointless since 12 digits in just under a trillion 32-bit system seems a little pointless since 12 digits is just under a trillion
and 20 fractional digits is still enough for about any use since `10^-20` light and 20 fractional digits is still enough for about any use since `10^-20` light
years is just under a millimeter.) years is just under a millimeter.)
...@@ -1084,7 +1134,7 @@ not thoroughly tested. ...@@ -1084,7 +1134,7 @@ not thoroughly tested.
[1]: https://docs.microsoft.com/en-us/windows/wsl/install-win10 [1]: https://docs.microsoft.com/en-us/windows/wsl/install-win10
[2]: https://pkg.musl.cc/bc/ [2]: https://pkg.musl.cc/bc/
[3]: http://lcamtuf.coredump.cx/afl/ [3]: http://lcamtuf.coredump.cx/afl/
[4]: ./karatsuba.py [4]: ./scripts/karatsuba.py
[5]: ./README.md [5]: ./README.md
[6]: ./configure.sh [6]: ./configure.sh
[7]: https://github.com/rain-1/linenoise-mob [7]: https://github.com/rain-1/linenoise-mob
...@@ -1092,7 +1142,7 @@ not thoroughly tested. ...@@ -1092,7 +1142,7 @@ not thoroughly tested.
[9]: ./manuals/bc/A.1.md [9]: ./manuals/bc/A.1.md
[10]: ./manuals/dc/A.1.md [10]: ./manuals/dc/A.1.md
[11]: https://scan.coverity.com/projects/gavinhoward-bc [11]: https://scan.coverity.com/projects/gavinhoward-bc
[12]: ./locale_install.sh [12]: ./scripts/locale_install.sh
[13]: ./manuals/build.md [13]: ./manuals/build.md
[14]: https://github.com/stesser [14]: https://github.com/stesser
[15]: https://github.com/bugcrazy [15]: https://github.com/bugcrazy
...@@ -1102,3 +1152,4 @@ not thoroughly tested. ...@@ -1102,3 +1152,4 @@ not thoroughly tested.
[19]: ./manuals/benchmarks.md [19]: ./manuals/benchmarks.md
[20]: https://github.com/apjanke/ronn-ng [20]: https://github.com/apjanke/ronn-ng
[21]: https://pandoc.org/ [21]: https://pandoc.org/
[22]: ./scripts/locale_uninstall.sh
# `bc` # `bc`
[![Coverity Scan Build Status][17]][18]
***WARNING: This project has moved to [https://git.yzena.com/][20] for [these ***WARNING: This project has moved to [https://git.yzena.com/][20] for [these
reasons][21], though GitHub will remain a mirror.*** reasons][21], though GitHub will remain a mirror.***
...@@ -23,6 +21,8 @@ This `bc` also provides `bc`'s math as a library with C bindings, called `bcl`. ...@@ -23,6 +21,8 @@ This `bc` also provides `bc`'s math as a library with C bindings, called `bcl`.
For more information, see the full manual for `bcl`. For more information, see the full manual for `bcl`.
## License
This `bc` is Free and Open Source Software (FOSS). It is offered under the BSD This `bc` is Free and Open Source Software (FOSS). It is offered under the BSD
2-clause License. Full license text may be found in the [`LICENSE.md`][4] file. 2-clause License. Full license text may be found in the [`LICENSE.md`][4] file.
...@@ -55,6 +55,12 @@ system. ...@@ -55,6 +55,12 @@ system.
## Build ## Build
This `bc` should build unmodified on any POSIX-compliant system or on Windows
starting with Windows 10 (though earlier versions may work).
For more complex build requirements than the ones below, see the
[build manual][5].
### Windows ### Windows
There is no guarantee that this `bc` will work on any version of Windows earlier There is no guarantee that this `bc` will work on any version of Windows earlier
...@@ -96,12 +102,6 @@ where `<config>` is either one of `Debug` or `Release`. ...@@ -96,12 +102,6 @@ where `<config>` is either one of `Debug` or `Release`.
### POSIX-Compatible Systems ### POSIX-Compatible Systems
This `bc` should build unmodified on any POSIX-compliant system or on Windows