Date: Thu, 26 Nov 2020 17:18:19 +0000 (UTC) From: =?UTF-8?Q?Stefan_E=c3=9fer?= <se@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r368063 - in vendor/bc/dist: . gen include manuals manuals/bc manuals/dc src Message-ID: <202011261718.0AQHIJV9099803@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: se Date: Thu Nov 26 17:18:18 2020 New Revision: 368063 URL: https://svnweb.freebsd.org/changeset/base/368063 Log: Revert incomplete import of version 3.2.0 Modified: vendor/bc/dist/.gitignore vendor/bc/dist/Makefile.in vendor/bc/dist/NEWS.md vendor/bc/dist/README.md vendor/bc/dist/configure.sh vendor/bc/dist/gen/lib.bc vendor/bc/dist/gen/strgen.c vendor/bc/dist/gen/strgen.sh vendor/bc/dist/include/file.h vendor/bc/dist/include/lex.h vendor/bc/dist/include/num.h vendor/bc/dist/include/parse.h vendor/bc/dist/include/rand.h vendor/bc/dist/include/status.h vendor/bc/dist/include/vector.h vendor/bc/dist/include/vm.h vendor/bc/dist/manpage.sh vendor/bc/dist/manuals/bc.1.md.in vendor/bc/dist/manuals/bc/A.1 vendor/bc/dist/manuals/bc/A.1.md vendor/bc/dist/manuals/bc/E.1 vendor/bc/dist/manuals/bc/E.1.md vendor/bc/dist/manuals/bc/EH.1 vendor/bc/dist/manuals/bc/EH.1.md vendor/bc/dist/manuals/bc/EHN.1 vendor/bc/dist/manuals/bc/EHN.1.md vendor/bc/dist/manuals/bc/EHNP.1 vendor/bc/dist/manuals/bc/EHNP.1.md vendor/bc/dist/manuals/bc/EHP.1 vendor/bc/dist/manuals/bc/EHP.1.md vendor/bc/dist/manuals/bc/EN.1 vendor/bc/dist/manuals/bc/EN.1.md vendor/bc/dist/manuals/bc/ENP.1 vendor/bc/dist/manuals/bc/ENP.1.md vendor/bc/dist/manuals/bc/EP.1 vendor/bc/dist/manuals/bc/EP.1.md vendor/bc/dist/manuals/bc/H.1 vendor/bc/dist/manuals/bc/H.1.md vendor/bc/dist/manuals/bc/HN.1 vendor/bc/dist/manuals/bc/HN.1.md vendor/bc/dist/manuals/bc/HNP.1 vendor/bc/dist/manuals/bc/HNP.1.md vendor/bc/dist/manuals/bc/HP.1 vendor/bc/dist/manuals/bc/HP.1.md vendor/bc/dist/manuals/bc/N.1 vendor/bc/dist/manuals/bc/N.1.md vendor/bc/dist/manuals/bc/NP.1 vendor/bc/dist/manuals/bc/NP.1.md vendor/bc/dist/manuals/bc/P.1 vendor/bc/dist/manuals/bc/P.1.md vendor/bc/dist/manuals/build.md vendor/bc/dist/manuals/dc.1.md.in vendor/bc/dist/manuals/dc/A.1 vendor/bc/dist/manuals/dc/A.1.md vendor/bc/dist/manuals/dc/E.1 vendor/bc/dist/manuals/dc/E.1.md vendor/bc/dist/manuals/dc/EH.1 vendor/bc/dist/manuals/dc/EH.1.md vendor/bc/dist/manuals/dc/EHN.1 vendor/bc/dist/manuals/dc/EHN.1.md vendor/bc/dist/manuals/dc/EHNP.1 vendor/bc/dist/manuals/dc/EHNP.1.md vendor/bc/dist/manuals/dc/EHP.1 vendor/bc/dist/manuals/dc/EHP.1.md vendor/bc/dist/manuals/dc/EN.1 vendor/bc/dist/manuals/dc/EN.1.md vendor/bc/dist/manuals/dc/ENP.1 vendor/bc/dist/manuals/dc/ENP.1.md vendor/bc/dist/manuals/dc/EP.1 vendor/bc/dist/manuals/dc/EP.1.md vendor/bc/dist/manuals/dc/H.1 vendor/bc/dist/manuals/dc/H.1.md vendor/bc/dist/manuals/dc/HN.1 vendor/bc/dist/manuals/dc/HN.1.md vendor/bc/dist/manuals/dc/HNP.1 vendor/bc/dist/manuals/dc/HNP.1.md vendor/bc/dist/manuals/dc/HP.1 vendor/bc/dist/manuals/dc/HP.1.md vendor/bc/dist/manuals/dc/N.1 vendor/bc/dist/manuals/dc/N.1.md vendor/bc/dist/manuals/dc/NP.1 vendor/bc/dist/manuals/dc/NP.1.md vendor/bc/dist/manuals/dc/P.1 vendor/bc/dist/manuals/dc/P.1.md vendor/bc/dist/release.sh vendor/bc/dist/src/args.c vendor/bc/dist/src/data.c vendor/bc/dist/src/file.c vendor/bc/dist/src/lang.c vendor/bc/dist/src/lex.c vendor/bc/dist/src/main.c vendor/bc/dist/src/num.c vendor/bc/dist/src/opt.c vendor/bc/dist/src/parse.c vendor/bc/dist/src/program.c vendor/bc/dist/src/read.c vendor/bc/dist/src/vector.c vendor/bc/dist/src/vm.c Modified: vendor/bc/dist/.gitignore ============================================================================== --- vendor/bc/dist/.gitignore Thu Nov 26 16:52:17 2020 (r368062) +++ vendor/bc/dist/.gitignore Thu Nov 26 17:18:18 2020 (r368063) @@ -9,7 +9,6 @@ bin/*bc bin/*bc.exe bin/*dc bin/*dc.exe -bin/bcl bc.old *.o *.a Modified: vendor/bc/dist/Makefile.in ============================================================================== --- vendor/bc/dist/Makefile.in Thu Nov 26 16:52:17 2020 (r368062) +++ vendor/bc/dist/Makefile.in Thu Nov 26 17:18:18 2020 (r368063) @@ -29,13 +29,33 @@ # .POSIX: -VERSION = 3.2.0 +VERSION = 3.1.6 SRC = %%SRC%% OBJ = %%OBJ%% GCDA = %%GCDA%% GCNO = %%GCNO%% +BC_SRC = %%BC_SRC%% +BC_OBJ = %%BC_OBJ%% +BC_GCDA = %%BC_GCDA%% +BC_GCNO = %%BC_GCNO%% + +DC_SRC = %%DC_SRC%% +DC_OBJ = %%DC_OBJ%% +DC_GCDA = %%DC_GCDA%% +DC_GCNO = %%DC_GCNO%% + +HISTORY_SRC = %%HISTORY_SRC%% +HISTORY_OBJ = %%HISTORY_OBJ%% +HISTORY_GCDA = %%HISTORY_GCDA%% +HISTORY_GCNO = %%HISTORY_GCNO%% + +RAND_SRC = %%RAND_SRC%% +RAND_OBJ = %%RAND_OBJ%% +RAND_GCDA = %%RAND_GCDA%% +RAND_GCNO = %%RAND_GCNO%% + BC_ENABLED_NAME = BC_ENABLED BC_ENABLED = %%BC_ENABLED%% DC_ENABLED_NAME = DC_ENABLED @@ -82,13 +102,6 @@ DC = dc BC_EXEC = $(BIN)/$(EXEC_PREFIX)$(BC) DC_EXEC = $(BIN)/$(EXEC_PREFIX)$(DC) -LIB = libbcl -LIB_NAME = $(LIB).a -LIBBC = $(BIN)/$(LIB_NAME) -BCL = bcl -BCL_TEST = $(BIN)/$(BCL) -BCL_TEST_C = tests/$(BCL).c - MANUALS = manuals BC_MANPAGE_NAME = $(EXEC_PREFIX)$(BC)$(EXEC_SUFFIX).1 BC_MANPAGE = $(MANUALS)/$(BC).1 @@ -96,28 +109,16 @@ BC_MD = $(BC_MANPAGE).md DC_MANPAGE_NAME = $(EXEC_PREFIX)$(DC)$(EXEC_SUFFIX).1 DC_MANPAGE = $(MANUALS)/$(DC).1 DC_MD = $(DC_MANPAGE).md -BCL_MANPAGE_NAME = bcl.3 -BCL_MANPAGE = $(MANUALS)/$(BCL_MANPAGE_NAME) -BCL_MD = $(BCL_MANPAGE).md MANPAGE_INSTALL_ARGS = -Dm644 -BINARY_INSTALL_ARGS = -Dm755 -BCL_HEADER_NAME = bcl.h -BCL_HEADER = include/$(BCL_HEADER_NAME) - %%DESTDIR%% BINDIR = %%BINDIR%% -INCLUDEDIR = %%INCLUDEDIR%% -LIBDIR = %%LIBDIR%% MAN1DIR = %%MAN1DIR%% -MAN3DIR = %%MAN3DIR%% MAIN_EXEC = $(EXEC_PREFIX)$(%%MAIN_EXEC%%)$(EXEC_SUFFIX) EXEC = $(%%EXEC%%) NLSPATH = %%NLSPATH%% -BC_ENABLE_LIBRARY = %%LIBRARY%% - BC_ENABLE_HISTORY = %%HISTORY%% BC_ENABLE_EXTRA_MATH_NAME = BC_ENABLE_EXTRA_MATH BC_ENABLE_EXTRA_MATH = %%EXTRA_MATH%% @@ -128,7 +129,7 @@ BC_LONG_BIT = %%LONG_BIT%% RM = rm MKDIR = mkdir -INSTALL = ./exec-install.sh +INSTALL = ./install.sh SAFE_INSTALL = ./safe-install.sh LINK = ./link.sh MANPAGE = ./manpage.sh @@ -147,7 +148,7 @@ CPPFLAGS4 = $(CPPFLAGS3) -D_POSIX_C_SOURCE=200809L -D_ CPPFLAGS5 = $(CPPFLAGS4) -DBC_NUM_KARATSUBA_LEN=$(BC_NUM_KARATSUBA_LEN) CPPFLAGS6 = $(CPPFLAGS5) -DBC_ENABLE_NLS=$(BC_ENABLE_NLS) -DBC_ENABLE_PROMPT=$(BC_ENABLE_PROMPT) CPPFLAGS7 = $(CPPFLAGS6) -D$(BC_ENABLE_EXTRA_MATH_NAME)=$(BC_ENABLE_EXTRA_MATH) -CPPFLAGS = $(CPPFLAGS7) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY) -DBC_ENABLE_LIBRARY=$(BC_ENABLE_LIBRARY) +CPPFLAGS = $(CPPFLAGS7) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY) CFLAGS = $(CPPFLAGS) %%CPPFLAGS%% %%CFLAGS%% LDFLAGS = %%LDFLAGS%% @@ -156,24 +157,21 @@ HOSTCFLAGS = %%HOSTCFLAGS%% CC = %%CC%% HOSTCC = %%HOSTCC%% -BC_LIB_C_ARGS = bc_lib bc_lib_name $(BC_ENABLED_NAME) 1 -BC_LIB2_C_ARGS = bc_lib2 bc_lib2_name "$(BC_ENABLED_NAME) && $(BC_ENABLE_EXTRA_MATH_NAME)" 1 +BC_LIB_C_ARGS = bc_lib bc.h bc_lib_name $(BC_ENABLED_NAME) 1 +BC_LIB2_C_ARGS = bc_lib2 bc.h bc_lib2_name "$(BC_ENABLED_NAME) && $(BC_ENABLE_EXTRA_MATH_NAME)" 1 -OBJS = $(BC_HELP_O) $(DC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ) -OBJ_TARGETS = $(DC_HELP_O) $(BC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ) +OBJS1 = $(OBJ) $(DC_OBJ) $(BC_OBJ) $(HISTORY_OBJ) $(RAND_OBJ) $(BC_HELP_O) $(DC_HELP_O) +OBJS = $(OBJS1) $(BC_LIB_O) $(BC_LIB2_O) $(BC_LIB3_O) +OBJ_TARGETS1 = $(DC_HELP_O) $(BC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(BC_LIB3_O) +OBJ_TARGETS = $(OBJ_TARGETS1) $(BC_OBJ) $(DC_OBJ) $(HISTORY_OBJ) $(RAND_OBJ) $(OBJ) .c.o: $(CC) $(CFLAGS) -o $@ -c $< -all: %%ALL_PREREQ%% - -execs: make_bin $(OBJ_TARGETS) +all: make_bin $(OBJ_TARGETS) $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(EXEC) %%LINK%% -library: make_bin $(OBJ) $(BC_LIB_O) $(BC_LIB2_O) - ar -r -cu $(LIBBC) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ) - $(GEN_EXEC): %%GEN_EXEC_TARGET%% @@ -184,10 +182,10 @@ $(BC_LIB2_C): $(GEN_EXEC) $(BC_LIB2) $(GEN_EMU) $(GEN_EXEC) $(BC_LIB2) $(BC_LIB2_C) $(BC_LIB2_C_ARGS) $(BC_HELP_C): $(GEN_EXEC) $(BC_HELP) - $(GEN_EMU) $(GEN_EXEC) $(BC_HELP) $(BC_HELP_C) bc_help "" $(BC_ENABLED_NAME) + $(GEN_EMU) $(GEN_EXEC) $(BC_HELP) $(BC_HELP_C) bc_help bc.h "" $(BC_ENABLED_NAME) $(DC_HELP_C): $(GEN_EXEC) $(DC_HELP) - $(GEN_EMU) $(GEN_EXEC) $(DC_HELP) $(DC_HELP_C) dc_help "" $(DC_ENABLED_NAME) + $(GEN_EMU) $(GEN_EXEC) $(DC_HELP) $(DC_HELP_C) dc_help dc.h "" $(DC_ENABLED_NAME) make_bin: $(MKDIR) -p $(BIN) @@ -224,7 +222,7 @@ help: check: test -test: %%TESTS%% +test: test_bc timeconst test_dc test_bc: %%BC_TEST%% @@ -243,12 +241,6 @@ time_test_dc: timeconst: %%TIMECONST%% -library_test: library - $(CC) $(CFLAGS) $(BCL_TEST_C) $(LIBBC) -o $(BCL_TEST) - -test_library: library_test - $(BCL_TEST) - valgrind: valgrind_bc valgrind_dc valgrind_bc: @@ -280,7 +272,6 @@ extra_math: manpages: $(MANPAGE) bc $(MANPAGE) dc - $(MANPAGE) bcl clean_gen: @$(RM) -f $(GEN_EXEC) @@ -288,6 +279,10 @@ clean_gen: clean:%%CLEAN_PREREQS%% @printf 'Cleaning files...\n' @$(RM) -f $(OBJ) + @$(RM) -f $(BC_OBJ) + @$(RM) -f $(DC_OBJ) + @$(RM) -f $(HISTORY_OBJ) + @$(RM) -f $(RAND_OBJ) @$(RM) -f $(BC_EXEC) @$(RM) -f $(DC_EXEC) @$(RM) -fr $(BIN) @@ -348,20 +343,9 @@ install_bc_manpage: install_dc_manpage: $(SAFE_INSTALL) $(MANPAGE_INSTALL_ARGS) $(DC_MANPAGE) $(DESTDIR)$(MAN1DIR)/$(DC_MANPAGE_NAME) -install_bcl_manpage: - $(SAFE_INSTALL) $(MANPAGE_INSTALL_ARGS) $(BCL_MANPAGE) $(DESTDIR)$(MAN3DIR)/$(BCL_MANPAGE_NAME) - -install_bcl_header: - $(SAFE_INSTALL) $(MANPAGE_INSTALL_ARGS) $(BCL_HEADER) $(DESTDIR)$(INCLUDEDIR)/$(BCL_HEADER_NAME) - -install_execs: +install:%%INSTALL_LOCALES_PREREQS%%%%INSTALL_PREREQS%% $(INSTALL) $(DESTDIR)$(BINDIR) "$(EXEC_SUFFIX)" -install_library: - $(SAFE_INSTALL) $(BINARY_INSTALL_ARGS) $(LIBBC) $(DESTDIR)$(LIBDIR)/$(LIB_NAME) - -install:%%INSTALL_LOCALES_PREREQS%%%%INSTALL_MAN_PREREQS%%%%INSTALL_PREREQS%% - uninstall_locales: $(LOCALE_UNINSTALL) $(NLSPATH) $(MAIN_EXEC) $(DESTDIR) @@ -376,14 +360,5 @@ uninstall_dc_manpage: uninstall_dc: $(RM) -f $(DESTDIR)$(BINDIR)/$(EXEC_PREFIX)$(DC)$(EXEC_SUFFIX) - -uninstall_library: - $(RM) -f $(DESTDIR)$(LIBDIR)/$(LIB_NAME) - -uninstall_bcl_header: - $(RM) -f $(DESTDIR)$(INCLUDEDIR)/$(BCL_HEADER_NAME) - -uninstall_bcl_manpage: - $(RM) -f $(DESTDIR)$(MAN3DIR)/$(BCL_MANPAGE_NAME) uninstall:%%UNINSTALL_LOCALES_PREREQS%%%%UNINSTALL_MAN_PREREQS%%%%UNINSTALL_PREREQS%% Modified: vendor/bc/dist/NEWS.md ============================================================================== --- vendor/bc/dist/NEWS.md Thu Nov 26 16:52:17 2020 (r368062) +++ vendor/bc/dist/NEWS.md Thu Nov 26 17:18:18 2020 (r368063) @@ -1,23 +1,5 @@ # News -## 3.2.0 - -This is a production release that has one bug fix and a major addition. - -The bug fix was a missing `auto` variable in the bessel `j()` function in the -math library. - -The major addition is a way to build a version of `bc`'s math code as a library. -This is done with the `-a` option to `configure.sh`. The API for the library can -be read in `./manuals/bcl.3.md` or `man bcl` once the library is installed with -`make install`. - -This library was requested by developers before I even finished version 1.0, but -I could not figure out how to do it until now. - -If the library has API breaking changes, the major version of `bc` will be -incremented. - ## 3.1.6 This is a production release that fixes a new warning from Clang 12 for FreeBSD Modified: vendor/bc/dist/README.md ============================================================================== --- vendor/bc/dist/README.md Thu Nov 26 16:52:17 2020 (r368062) +++ vendor/bc/dist/README.md Thu Nov 26 17:18:18 2020 (r368063) @@ -107,23 +107,6 @@ other locations, use the `PREFIX` environment variable `configure.sh` or pass the `--prefix=<prefix>` option to `configure.sh`. See the [build manual][5], or run `./configure.sh --help`, for more details. -### Library - -This `bc` does provide a way to build a math library with C bindings. This is -done by the `-a` or `--library` options to `configure.sh`: - -``` -./configure.sh -a -``` - -When building the library, the executables are not built. For more information, -see the [build manual][5]. - -The library API can be found in [`manuals/bcl.3.md`][26] or `man bcl` once the -library is installed. - -The library is built as `bin/libbcl.a`. - ### Package and Distro Maintainers #### Recommended Compiler @@ -352,4 +335,3 @@ Folders: [23]: https://svnweb.freebsd.org/base/head/contrib/bc/ [24]: https://bugs.freebsd.org/ [25]: https://reviews.freebsd.org/ -[26]: ./manuals/bcl.3.md Modified: vendor/bc/dist/configure.sh ============================================================================== --- vendor/bc/dist/configure.sh Thu Nov 26 16:52:17 2020 (r368062) +++ vendor/bc/dist/configure.sh Thu Nov 26 17:18:18 2020 (r368063) @@ -45,27 +45,22 @@ usage() { _usage_val=0 fi - printf 'usage:\n' - printf ' %s -h\n' "$script" - printf ' %s --help\n' "$script" - printf ' %s [-a|-bD|-dB|-c] [-EfgGHlMNPT] [-O OPT_LEVEL] [-k KARATSUBA_LEN]\n' "$script" - printf ' %s \\\n' "$script" - printf ' [--library|--bc-only --disable-dc|--dc-only --disable-bc|--coverage]\\\n' - printf ' [--force --debug --disable-extra-math --disable-generated-tests] \\\n' - printf ' [--disable-history --disable-man-pages --disable-nls] \\\n' - printf ' [--disable-prompt --disable-strip] [--install-all-locales] \\\n' - printf ' [--opt=OPT_LEVEL] [--karatsuba-len=KARATSUBA_LEN] \\\n' - printf ' [--prefix=PREFIX] [--bindir=BINDIR] [--datarootdir=DATAROOTDIR] \\\n' - printf ' [--datadir=DATADIR] [--mandir=MANDIR] [--man1dir=MAN1DIR] \\\n' + printf 'usage: %s -h\n' "$script" + printf ' %s --help\n' "$script" + printf ' %s [-bD|-dB|-c] [-EfgGHlMNPT] [-O OPT_LEVEL] [-k KARATSUBA_LEN]\n' "$script" + printf ' %s \\\n' "$script" + printf ' [--bc-only --disable-dc|--dc-only --disable-bc|--coverage] \\\n' + printf ' [--debug --disable-extra-math --disable-generated-tests] \\\n' + printf ' [--disable-history --disable-man-pages --disable-nls] \\\n' + printf ' [--disable-prompt --disable-strip] [--install-all-locales] \\\n' + printf ' [--opt=OPT_LEVEL] [--karatsuba-len=KARATSUBA_LEN] \\\n' + printf ' [--prefix=PREFIX] [--bindir=BINDIR] [--datarootdir=DATAROOTDIR] \\\n' + printf ' [--datadir=DATADIR] [--mandir=MANDIR] [--man1dir=MAN1DIR] \\\n' + printf ' [--force] \\\n' printf '\n' - printf ' -a, --library\n' - printf ' Build the libbc instead of the programs. This is meant to be used with\n' - printf ' Other software like programming languages that want to make use of the\n' - printf ' parsing and math capabilities. This option will install headers using\n' - printf ' `make install`.\n' printf ' -b, --bc-only\n' - printf ' Build bc only. It is an error if "-d", "--dc-only", "-B", or\n' - printf ' "--disable-bc" are specified too.\n' + printf ' Build bc only. It is an error if "-d", "--dc-only", "-B", or "--disable-bc"\n' + printf ' are specified too.\n' printf ' -B, --disable-bc\n' printf ' Disable bc. It is an error if "-b", "--bc-only", "-D", or "--disable-dc"\n' printf ' are specified too.\n' @@ -74,10 +69,10 @@ usage() { printf ' It is an error if either "-b" ("-D") or "-d" ("-B") is specified.\n' printf ' Requires a compiler that use gcc-compatible coverage options\n' printf ' -d, --dc-only\n' - printf ' Build dc only. It is an error if "-b", "--bc-only", "-D", or\n' - printf ' "--disable-dc" are specified too.\n' + printf ' Build dc only. It is an error if "-b", "--bc-only", "-D", or "--disable-dc"\n' + printf ' are specified too.\n' printf ' -D, --disable-dc\n' - printf ' Disable dc. It is an error if "-d", "--dc-only", "-B", or "--disable-bc"\n' + printf ' Disable dc. It is an error if "-d", "--dc-only" "-B", or "--disable-bc"\n' printf ' are specified too.\n' printf ' -E, --disable-extra-math\n' printf ' Disable extra math. This includes: "$" operator (truncate to integer),\n' @@ -127,14 +122,8 @@ usage() { printf ' If PREFIX is "/usr", install path will be "/usr/bin".\n' printf ' Default is "/usr/local".\n' printf ' --bindir BINDIR\n' - printf ' The directory to install binaries in. Overrides "$BINDIR" if it exists.\n' + printf ' The directory to install binaries. Overrides "$BINDIR" if it exists.\n' printf ' Default is "$PREFIX/bin".\n' - printf ' --includedir INCLUDEDIR\n' - printf ' The directory to install headers in. Overrides "$INCLUDEDIR" if it\n' - printf ' exists. Default is "$PREFIX/include".\n' - printf ' --libdir LIBDIR\n' - printf ' The directory to install libraries in. Overrides "$LIBDIR" if it exists.\n' - printf ' Default is "$PREFIX/lib".\n' printf ' --datarootdir DATAROOTDIR\n' printf ' The root location for data files. Overrides "$DATAROOTDIR" if it exists.\n' printf ' Default is "$PREFIX/share".\n' @@ -147,9 +136,6 @@ usage() { printf ' --man1dir MAN1DIR\n' printf ' The location to install Section 1 manpages to. Overrides "$MAN1DIR" if\n' printf ' it exists. Default is "$MANDIR/man1".\n' - printf ' --man3dir MAN3DIR\n' - printf ' The location to install Section 3 manpages to. Overrides "$MAN3DIR" if\n' - printf ' it exists. Default is "$MANDIR/man3".\n' printf '\n' printf 'In addition, the following environment variables are used:\n' printf '\n' @@ -171,18 +157,12 @@ usage() { printf ' LDFLAGS Linker flags. Default is "".\n' printf ' PREFIX The prefix to install to. Default is "/usr/local".\n' printf ' If PREFIX is "/usr", install path will be "/usr/bin".\n' - printf ' BINDIR The directory to install binaries in. Default is "$PREFIX/bin".\n' - printf ' INCLUDEDIR The directory to install header files in. Default is\n' - printf ' "$PREFIX/include".\n' - printf ' LIBDIR The directory to install libraries in. Default is\n' - printf ' "$PREFIX/lib".\n' + printf ' BINDIR The directory to install binaries. Default is "$PREFIX/bin".\n' printf ' DATAROOTDIR The root location for data files. Default is "$PREFIX/share".\n' printf ' DATADIR The location for data files. Default is "$DATAROOTDIR".\n' printf ' MANDIR The location to install manpages to. Default is "$DATADIR/man".\n' printf ' MAN1DIR The location to install Section 1 manpages to. Default is\n' printf ' "$MANDIR/man1".\n' - printf ' MAN3DIR The location to install Section 3 manpages to. Default is\n' - printf ' "$MANDIR/man3".\n' printf ' NLSPATH The location to install locale catalogs to. Must be an absolute\n' printf ' path (or contain one). This is treated the same as the POSIX\n' printf ' definition of $NLSPATH (see POSIX environment variables for\n' @@ -277,55 +257,56 @@ replace() { substring_replace "$_replace_str" "%%$_replace_needle%%" "$_replace_replacement" } -gen_file_list() { +gen_file_lists() { - if [ "$#" -lt 1 ]; then + if [ "$#" -lt 3 ]; then err_exit "Invalid number of args to $0" fi - _gen_file_list_contents="$1" + _gen_file_lists_contents="$1" shift - p=$(pwd) + _gen_file_lists_filedir="$1" + shift - cd "$scriptdir" + _gen_file_lists_typ="$1" + shift - if [ "$#" -ge 1 ]; then - - while [ "$#" -ge 1 ]; do - a="$1" - shift - args="$args ! -wholename src/${a}" - done - + # If there is an extra argument, and it + # is zero, we keep the file lists empty. + if [ "$#" -gt 0 ]; then + _gen_file_lists_use="$1" else - args="-print" + _gen_file_lists_use="1" fi - _gen_file_list_needle_src="SRC" - _gen_file_list_needle_obj="OBJ" - _gen_file_list_needle_gcda="GCDA" - _gen_file_list_needle_gcno="GCNO" + _gen_file_lists_needle_src="${_gen_file_lists_typ}SRC" + _gen_file_lists_needle_obj="${_gen_file_lists_typ}OBJ" + _gen_file_lists_needle_gcda="${_gen_file_lists_typ}GCDA" + _gen_file_lists_needle_gcno="${_gen_file_lists_typ}GCNO" - _gen_file_list_replacement=$(find src/ -depth -name "*.c" $args | tr '\n' ' ') - _gen_file_list_contents=$(replace "$_gen_file_list_contents" \ - "$_gen_file_list_needle_src" "$_gen_file_list_replacement") + if [ "$_gen_file_lists_use" -ne 0 ]; then - _gen_file_list_replacement=$(replace_exts "$_gen_file_list_replacement" "c" "o") - _gen_file_list_contents=$(replace "$_gen_file_list_contents" \ - "$_gen_file_list_needle_obj" "$_gen_file_list_replacement") + _gen_file_lists_replacement=$(cd "$_gen_file_lists_filedir" && find . ! -name . -prune -name "*.c" | cut -d/ -f2 | sed "s@^@$_gen_file_lists_filedir/@g" | tr '\n' ' ') + _gen_file_lists_contents=$(replace "$_gen_file_lists_contents" "$_gen_file_lists_needle_src" "$_gen_file_lists_replacement") - _gen_file_list_replacement=$(replace_exts "$_gen_file_list_replacement" "o" "gcda") - _gen_file_list_contents=$(replace "$_gen_file_list_contents" \ - "$_gen_file_list_needle_gcda" "$_gen_file_list_replacement") + _gen_file_lists_replacement=$(replace_exts "$_gen_file_lists_replacement" "c" "o") + _gen_file_lists_contents=$(replace "$_gen_file_lists_contents" "$_gen_file_lists_needle_obj" "$_gen_file_lists_replacement") - _gen_file_list_replacement=$(replace_exts "$_gen_file_list_replacement" "gcda" "gcno") - _gen_file_list_contents=$(replace "$_gen_file_list_contents" \ - "$_gen_file_list_needle_gcno" "$_gen_file_list_replacement") + _gen_file_lists_replacement=$(replace_exts "$_gen_file_lists_replacement" "o" "gcda") + _gen_file_lists_contents=$(replace "$_gen_file_lists_contents" "$_gen_file_lists_needle_gcda" "$_gen_file_lists_replacement") - cd "$p" + _gen_file_lists_replacement=$(replace_exts "$_gen_file_lists_replacement" "gcda" "gcno") + _gen_file_lists_contents=$(replace "$_gen_file_lists_contents" "$_gen_file_lists_needle_gcno" "$_gen_file_lists_replacement") - printf '%s\n' "$_gen_file_list_contents" + else + _gen_file_lists_contents=$(replace "$_gen_file_lists_contents" "$_gen_file_lists_needle_src" "") + _gen_file_lists_contents=$(replace "$_gen_file_lists_contents" "$_gen_file_lists_needle_obj" "") + _gen_file_lists_contents=$(replace "$_gen_file_lists_contents" "$_gen_file_lists_needle_gcda" "") + _gen_file_lists_contents=$(replace "$_gen_file_lists_contents" "$_gen_file_lists_needle_gcno" "") + fi + + printf '%s\n' "$_gen_file_lists_contents" } bc_only=0 @@ -343,12 +324,10 @@ prompt=1 force=0 strip_bin=1 all_locales=0 -library=0 -while getopts "abBcdDEfgGhHk:lMNO:PST-" opt; do +while getopts "bBcdDEfgGhHk:lMNO:PST-" opt; do case "$opt" in - a) library=1 ;; b) bc_only=1 ;; B) dc_only=1 ;; c) coverage=1 ;; @@ -373,7 +352,6 @@ while getopts "abBcdDEfgGhHk:lMNO:PST-" opt; do LONG_OPTARG="${arg#*=}" case $arg in help) usage ;; - library) library=1 ;; bc-only) bc_only=1 ;; dc-only) dc_only=1 ;; coverage) coverage=1 ;; @@ -393,20 +371,6 @@ while getopts "abBcdDEfgGhHk:lMNO:PST-" opt; do fi BINDIR="$2" shift ;; - includedir=?*) INCLUDEDIR="$LONG_OPTARG" ;; - includedir) - if [ "$#" -lt 2 ]; then - usage "No argument given for '--$arg' option" - fi - INCLUDEDIR="$2" - shift ;; - libdir=?*) LIBDIR="$LONG_OPTARG" ;; - libdir) - if [ "$#" -lt 2 ]; then - usage "No argument given for '--$arg' option" - fi - LIBDIR="$2" - shift ;; datarootdir=?*) DATAROOTDIR="$LONG_OPTARG" ;; datarootdir) if [ "$#" -lt 2 ]; then @@ -435,13 +399,6 @@ while getopts "abBcdDEfgGhHk:lMNO:PST-" opt; do fi MAN1DIR="$2" shift ;; - man3dir=?*) MAN3DIR="$LONG_OPTARG" ;; - man3dir) - if [ "$#" -lt 2 ]; then - usage "No argument given for '--$arg' option" - fi - MAN3DIR="$2" - shift ;; localedir=?*) LOCALEDIR="$LONG_OPTARG" ;; localedir) if [ "$#" -lt 2 ]; then @@ -497,12 +454,6 @@ if [ "$bc_only" -eq 1 ] && [ "$dc_only" -eq 1 ]; then usage "Can only specify one of -b(-D) or -d(-B)" fi -if [ "$library" -ne 0 ]; then - if [ "$bc_only" -eq 1 ] || [ "$dc_only" -eq 1 ]; then - usage "Must not specify -b(-D) or -d(-B) when building the library" - fi -fi - case $karatsuba_len in (*[!0-9]*|'') usage "KARATSUBA_LEN is not a number" ;; (*) ;; @@ -578,8 +529,6 @@ link="@printf 'No link necessary\\\\n'" main_exec="BC" executable="BC_EXEC" -tests="test_bc timeconst test_dc" - bc_test="@tests/all.sh bc $extra_math 1 $generate_tests 0 \$(BC_EXEC)" bc_time_test="@tests/all.sh bc $extra_math 1 $generate_tests 1 \$(BC_EXEC)" @@ -618,8 +567,7 @@ if [ "$bc_only" -eq 1 ]; then dc_time_test="@printf 'No dc tests to run\\\\n'" vg_dc_test="@printf 'No dc tests to run\\\\n'" - install_prereqs=" install_execs" - install_man_prereqs=" install_bc_manpage" + install_prereqs=" install_bc_manpage" uninstall_prereqs=" uninstall_bc" uninstall_man_prereqs=" uninstall_bc_manpage" @@ -642,8 +590,7 @@ elif [ "$dc_only" -eq 1 ]; then timeconst="@printf 'timeconst cannot be run because bc is not built\\\\n'" - install_prereqs=" install_execs" - install_man_prereqs=" install_dc_manpage" + install_prereqs=" install_dc_manpage" uninstall_prereqs=" uninstall_dc" uninstall_man_prereqs=" uninstall_dc_manpage" @@ -659,18 +606,9 @@ else karatsuba="@\$(KARATSUBA) 30 0 \$(BC_EXEC)" karatsuba_test="@\$(KARATSUBA) 1 100 \$(BC_EXEC)" - if [ "$library" -eq 0 ]; then - install_prereqs=" install_execs" - install_man_prereqs=" install_bc_manpage install_dc_manpage" - uninstall_prereqs=" uninstall_bc uninstall_dc" - uninstall_man_prereqs=" uninstall_bc_manpage uninstall_dc_manpage" - else - install_prereqs=" install_library install_bcl_header" - install_man_prereqs=" install_bcl_manpage" - uninstall_prereqs=" uninstall_library uninstall_bcl_header" - uninstall_man_prereqs=" uninstall_bcl_manpage" - tests="test_library" - fi + install_prereqs=" install_bc_manpage install_dc_manpage" + uninstall_prereqs=" uninstall_bc uninstall_dc" + uninstall_man_prereqs=" uninstall_bc_manpage uninstall_dc_manpage" fi @@ -726,14 +664,6 @@ if [ -z "${BINDIR+set}" ]; then BINDIR="$PREFIX/bin" fi -if [ -z "${INCLUDEDIR+set}" ]; then - INCLUDEDIR="$PREFIX/include" -fi - -if [ -z "${LIBDIR+set}" ]; then - LIBDIR="$PREFIX/lib" -fi - if [ "$install_manpages" -ne 0 ] || [ "$nls" -ne 0 ]; then if [ -z "${DATAROOTDIR+set}" ]; then DATAROOTDIR="$PREFIX/share" @@ -754,25 +684,11 @@ if [ "$install_manpages" -ne 0 ]; then MAN1DIR="$MANDIR/man1" fi - if [ -z "${MAN3DIR+set}" ]; then - MAN3DIR="$MANDIR/man3" - fi - else - install_man_prereqs="" + install_prereqs="" uninstall_man_prereqs="" fi -if [ "$library" -ne 0 ]; then - extra_math=1 - nls=0 - hist=0 - prompt=0 - ALL_PREREQ="library" -else - ALL_PREREQ="execs" -fi - if [ "$nls" -ne 0 ]; then set +e @@ -860,11 +776,11 @@ if [ "$hist" -eq 1 ]; then printf 'Testing history...\n' flags="-DBC_ENABLE_HISTORY=1 -DBC_ENABLED=$bc -DDC_ENABLED=$dc" - flags="$flags -DBC_ENABLE_NLS=$nls -DBC_ENABLE_LIBRARY=0" + flags="$flags -DBC_ENABLE_NLS=$nls" flags="$flags -DBC_ENABLE_EXTRA_MATH=$extra_math -I./include/" flags="$flags -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700" - "$CC" $CPPFLAGS $CFLAGS $flags -c "src/history.c" -o "$scriptdir/history.o" > /dev/null 2>&1 + "$CC" $CPPFLAGS $CFLAGS $flags -c "src/history/history.c" -o "$scriptdir/history.o" > /dev/null 2>&1 err="$?" @@ -888,11 +804,7 @@ if [ "$hist" -eq 1 ]; then fi -if [ "$library" -eq 1 ]; then - bc_lib="" -fi - -if [ "$extra_math" -eq 1 ] && [ "$bc" -ne 0 ] && [ "$library" -eq 0 ]; then +if [ "$extra_math" -eq 1 ] && [ "$bc" -ne 0 ]; then BC_LIB2_O="\$(GEN_DIR)/lib2.o" else BC_LIB2_O="" @@ -934,33 +846,6 @@ if [ "$manpage_args" = "" ]; then manpage_args="A" fi -unneeded="" - -if [ "$hist" -eq 0 ]; then - unneeded="$unneeded history.c" -fi - -if [ "$bc" -eq 0 ]; then - unneeded="$unneeded bc.c bc_lex.c bc_parse.c" -fi - -if [ "$dc" -eq 0 ]; then - unneeded="$unneeded dc.c dc_lex.c dc_parse.c" -fi - -if [ "$extra_math" -eq 0 ]; then - unneeded="$unneeded rand.c" -fi - -if [ "$library" -ne 0 ]; then - unneeded="$unneeded args.c opt.c read.c file.c main.c" - unneeded="$unneeded lang.c lex.c parse.c program.c" - unneeded="$unneeded bc.c bc_lex.c bc_parse.c" - unneeded="$unneeded dc.c dc_lex.c dc_parse.c" -else - unneeded="$unneeded library.c" -fi - # Print out the values; this is for debugging. if [ "$bc" -ne 0 ]; then printf 'Building bc\n' @@ -973,7 +858,6 @@ else printf 'Not building dc\n' fi printf '\n' -printf 'BC_ENABLE_LIBRARY=%s\n\n' "$library" printf 'BC_ENABLE_HISTORY=%s\n' "$hist" printf 'BC_ENABLE_EXTRA_MATH=%s\n' "$extra_math" printf 'BC_ENABLE_NLS=%s\n' "$nls" @@ -989,13 +873,10 @@ printf 'CPPFLAGS=%s\n' "$CPPFLAGS" printf 'LDFLAGS=%s\n' "$LDFLAGS" printf 'PREFIX=%s\n' "$PREFIX" printf 'BINDIR=%s\n' "$BINDIR" -printf 'INCLUDEDIR=%s\n' "$INCLUDEDIR" -printf 'LIBDIR=%s\n' "$LIBDIR" printf 'DATAROOTDIR=%s\n' "$DATAROOTDIR" printf 'DATADIR=%s\n' "$DATADIR" printf 'MANDIR=%s\n' "$MANDIR" printf 'MAN1DIR=%s\n' "$MAN1DIR" -printf 'MAN3DIR=%s\n' "$MAN3DIR" printf 'NLSPATH=%s\n' "$NLSPATH" printf 'EXECSUFFIX=%s\n' "$EXECSUFFIX" printf 'EXECPREFIX=%s\n' "$EXECPREFIX" @@ -1011,17 +892,16 @@ replacement='*** WARNING: Autogenerated from Makefile. contents=$(replace "$contents" "$needle" "$replacement") -if [ "$unneeded" = "" ]; then - contents=$(gen_file_list "$contents" "library.c") -else - contents=$(gen_file_list "$contents" $unneeded) -fi +contents=$(gen_file_lists "$contents" "$scriptdir/src" "") +contents=$(gen_file_lists "$contents" "$scriptdir/src/bc" "BC_" "$bc") +contents=$(gen_file_lists "$contents" "$scriptdir/src/dc" "DC_" "$dc") +contents=$(gen_file_lists "$contents" "$scriptdir/src/history" "HISTORY_" "$hist") +contents=$(gen_file_lists "$contents" "$scriptdir/src/rand" "RAND_" "$extra_math") contents=$(replace "$contents" "BC_ENABLED" "$bc") contents=$(replace "$contents" "DC_ENABLED" "$dc") contents=$(replace "$contents" "LINK" "$link") -contents=$(replace "$contents" "LIBRARY" "$library") contents=$(replace "$contents" "HISTORY" "$hist") contents=$(replace "$contents" "EXTRA_MATH" "$extra_math") contents=$(replace "$contents" "NLS" "$nls") @@ -1037,10 +917,7 @@ contents=$(replace "$contents" "DESTDIR" "$destdir") contents=$(replace "$contents" "EXECSUFFIX" "$EXECSUFFIX") contents=$(replace "$contents" "EXECPREFIX" "$EXECPREFIX") contents=$(replace "$contents" "BINDIR" "$BINDIR") -contents=$(replace "$contents" "INCLUDEDIR" "$INCLUDEDIR") -contents=$(replace "$contents" "LIBDIR" "$LIBDIR") contents=$(replace "$contents" "MAN1DIR" "$MAN1DIR") -contents=$(replace "$contents" "MAN3DIR" "$MAN3DIR") contents=$(replace "$contents" "CFLAGS" "$CFLAGS") contents=$(replace "$contents" "HOSTCFLAGS" "$HOSTCFLAGS") contents=$(replace "$contents" "CPPFLAGS" "$CPPFLAGS") @@ -1050,19 +927,15 @@ contents=$(replace "$contents" "HOSTCC" "$HOSTCC") contents=$(replace "$contents" "COVERAGE_OUTPUT" "$COVERAGE_OUTPUT") contents=$(replace "$contents" "COVERAGE_PREREQS" "$COVERAGE_PREREQS") contents=$(replace "$contents" "INSTALL_PREREQS" "$install_prereqs") -contents=$(replace "$contents" "INSTALL_MAN_PREREQS" "$install_man_prereqs") contents=$(replace "$contents" "INSTALL_LOCALES" "$install_locales") contents=$(replace "$contents" "INSTALL_LOCALES_PREREQS" "$install_locales_prereqs") contents=$(replace "$contents" "UNINSTALL_MAN_PREREQS" "$uninstall_man_prereqs") contents=$(replace "$contents" "UNINSTALL_PREREQS" "$uninstall_prereqs") contents=$(replace "$contents" "UNINSTALL_LOCALES_PREREQS" "$uninstall_locales_prereqs") -contents=$(replace "$contents" "ALL_PREREQ" "$ALL_PREREQ") - contents=$(replace "$contents" "EXECUTABLES" "$executables") contents=$(replace "$contents" "MAIN_EXEC" "$main_exec") contents=$(replace "$contents" "EXEC" "$executable") -contents=$(replace "$contents" "TESTS" "$tests") contents=$(replace "$contents" "BC_TEST" "$bc_test") contents=$(replace "$contents" "BC_TIME_TEST" "$bc_time_test") Modified: vendor/bc/dist/gen/lib.bc ============================================================================== --- vendor/bc/dist/gen/lib.bc Thu Nov 26 16:52:17 2020 (r368062) +++ vendor/bc/dist/gen/lib.bc Thu Nov 26 17:18:18 2020 (r368063) @@ -173,7 +173,7 @@ define a(x){ return((m*a+r)/n) } define j(n,x){ - auto b,s,o,a,i,r,v,f + auto b,s,o,a,i,v,f b=ibase ibase=A s=scale Modified: vendor/bc/dist/gen/strgen.c ============================================================================== --- vendor/bc/dist/gen/strgen.c Thu Nov 26 16:52:17 2020 (r368062) +++ vendor/bc/dist/gen/strgen.c Thu Nov 26 17:18:18 2020 (r368063) @@ -45,14 +45,13 @@ static const char* const bc_gen_header = "// Copyright (c) 2018-2020 Gavin D. Howard and contributors.\n" "// Licensed under the 2-clause BSD license.\n" - "// *** AUTOMATICALLY GENERATED FROM %s. DO NOT MODIFY. ***\n\n"; + "// *** AUTOMATICALLY GENERATED FROM %s. DO NOT MODIFY. ***\n"; +static const char* const bc_gen_include = "#include <%s>\n\n"; static const char* const bc_gen_label = "const char *%s = \"%s\";\n\n"; -static const char* const bc_gen_label_extern = "extern const char *%s;\n\n"; static const char* const bc_gen_ifdef = "#if %s\n"; static const char* const bc_gen_endif = "#endif // %s\n"; static const char* const bc_gen_name = "const char %s[] = {\n"; -static const char* const bc_gen_name_extern = "extern const char %s[];\n\n"; #define IO_ERR (1) #define INVALID_INPUT_FILE (2) @@ -63,7 +62,7 @@ static const char* const bc_gen_name_extern = "extern int main(int argc, char *argv[]) { FILE *in, *out; - char *label, *define, *name; + char *label, *define, *name, *include; int c, count, slashes, err = IO_ERR; bool has_label, has_define, remove_tabs; @@ -73,14 +72,15 @@ int main(int argc, char *argv[]) { } name = argv[3]; + include = argv[4]; - has_label = (argc > 4 && strcmp("", argv[4]) != 0); - label = has_label ? argv[4] : ""; + has_label = (argc > 5 && strcmp("", argv[5]) != 0); + label = has_label ? argv[5] : ""; - has_define = (argc > 5 && strcmp("", argv[5]) != 0); - define = has_define ? argv[5] : ""; + has_define = (argc > 6 && strcmp("", argv[6]) != 0); + define = has_define ? argv[6] : ""; - remove_tabs = (argc > 6); + remove_tabs = (argc > 7); in = fopen(argv[1], "r"); if (!in) return INVALID_INPUT_FILE; @@ -89,9 +89,8 @@ int main(int argc, char *argv[]) { if (!out) goto out_err; if (fprintf(out, bc_gen_header, argv[1]) < 0) goto err; - if (has_label && fprintf(out, bc_gen_label_extern, label) < 0) goto err; - if (fprintf(out, bc_gen_name_extern, name) < 0) goto err; if (has_define && fprintf(out, bc_gen_ifdef, define) < 0) goto err; + if (fprintf(out, bc_gen_include, include) < 0) goto err; if (has_label && fprintf(out, bc_gen_label, label, argv[1]) < 0) goto err; if (fprintf(out, bc_gen_name, name) < 0) goto err; Modified: vendor/bc/dist/gen/strgen.sh ============================================================================== --- vendor/bc/dist/gen/strgen.sh Thu Nov 26 16:52:17 2020 (r368062) +++ vendor/bc/dist/gen/strgen.sh Thu Nov 26 17:18:18 2020 (r368063) @@ -50,7 +50,6 @@ exec > "$output" if [ -n "$label" ]; then nameline="const char *${label} = \"${input}\";" - labelexternline="extern const char *${label};" fi if [ -n "$define" ]; then @@ -65,14 +64,11 @@ if [ -n "$remove_tabs" ]; then fi cat<<EOF -// Copyright (c) 2018-2020 Gavin D. Howard and contributors. // Licensed under the 2-clause BSD license. // *** AUTOMATICALLY GENERATED FROM ${input}. DO NOT MODIFY. *** ${condstart} -$labelexternline - -extern const char $name[]; +#include <${header}> $nameline Modified: vendor/bc/dist/include/file.h ============================================================================== --- vendor/bc/dist/include/file.h Thu Nov 26 16:52:17 2020 (r368062) +++ vendor/bc/dist/include/file.h Thu Nov 26 17:18:18 2020 (r368063) @@ -62,4 +62,6 @@ void bc_file_printf(BcFile *restrict f, const char *fm void bc_file_vprintf(BcFile *restrict f, const char *fmt, va_list args); void bc_file_puts(BcFile *restrict f, const char *str); +void bc_file_ultoa(unsigned long long val, char buf[BC_FILE_ULL_LENGTH]); + #endif // BC_FILE_H Modified: vendor/bc/dist/include/lex.h ============================================================================== --- vendor/bc/dist/include/lex.h Thu Nov 26 16:52:17 2020 (r368062) +++ vendor/bc/dist/include/lex.h Thu Nov 26 17:18:18 2020 (r368063) @@ -43,8 +43,8 @@ #include <vector.h> #include <lang.h> -#define bc_lex_err(l, e) (bc_vm_handleError((e), (l)->line)) -#define bc_lex_verr(l, e, ...) (bc_vm_handleError((e), (l)->line, __VA_ARGS__)) +#define bc_lex_err(l, e) (bc_vm_error((e), (l)->line)) +#define bc_lex_verr(l, e, ...) (bc_vm_error((e), (l)->line, __VA_ARGS__)) #if BC_ENABLED Modified: vendor/bc/dist/include/num.h ============================================================================== --- vendor/bc/dist/include/num.h Thu Nov 26 16:52:17 2020 (r368062) +++ vendor/bc/dist/include/num.h Thu Nov 26 17:18:18 2020 (r368063) @@ -45,7 +45,6 @@ #include <status.h> #include <vector.h> -#include <bcl.h> #ifndef BC_ENABLE_EXTRA_MATH #define BC_ENABLE_EXTRA_MATH (1) @@ -55,10 +54,25 @@ typedef unsigned long ulong; -typedef BclBigDig BcBigDig; +// For some reason, LONG_BIT is not defined in some versions of gcc. +// I define it here to the minimum accepted value in the POSIX standard. +#ifndef LONG_BIT +#define LONG_BIT (32) +#endif // LONG_BIT +#ifndef BC_LONG_BIT +#define BC_LONG_BIT LONG_BIT +#endif // BC_LONG_BIT + +#if BC_LONG_BIT > LONG_BIT +#error BC_LONG_BIT cannot be greater than LONG_BIT +#endif // BC_LONG_BIT > LONG_BIT + #if BC_LONG_BIT >= 64 +typedef int_least32_t BcDig; +typedef uint64_t BcBigDig; + #define BC_NUM_BIGDIG_MAX ((BcBigDig) UINT64_MAX) #define BC_BASE_DIGS (9) @@ -66,10 +80,11 @@ typedef BclBigDig BcBigDig; #define BC_NUM_BIGDIG_C UINT64_C -typedef int_least32_t BcDig; - #elif BC_LONG_BIT >= 32 +typedef int_least16_t BcDig; +typedef uint32_t BcBigDig; + #define BC_NUM_BIGDIG_MAX ((BcBigDig) UINT32_MAX) #define BC_BASE_DIGS (4) @@ -77,8 +92,6 @@ typedef int_least32_t BcDig; #define BC_NUM_BIGDIG_C UINT32_C -typedef int_least16_t BcDig; - #else #error BC_LONG_BIT must be at least 32 @@ -93,6 +106,7 @@ typedef struct BcNum { size_t scale; size_t len; size_t cap; + bool neg; } BcNum; #if BC_ENABLE_EXTRA_MATH @@ -136,30 +150,6 @@ struct BcRNG; #define BC_NUM_ROUND_POW(s) (bc_vm_growSize((s), BC_BASE_DIGS - 1)) #define BC_NUM_RDX(s) (BC_NUM_ROUND_POW(s) / BC_BASE_DIGS) -#define BC_NUM_RDX_VAL(n) ((n)->rdx >> 1) -#define BC_NUM_RDX_VAL_NP(n) ((n).rdx >> 1) -#define BC_NUM_RDX_SET(n, v) \ - ((n)->rdx = (((v) << 1) | ((n)->rdx & (BcBigDig) 1))) -#define BC_NUM_RDX_SET_NP(n, v) \ - ((n).rdx = (((v) << 1) | ((n).rdx & (BcBigDig) 1))) -#define BC_NUM_RDX_SET_NEG(n, v, neg) \ - ((n)->rdx = (((v) << 1) | (neg))) - -#define BC_NUM_RDX_VALID(n) \ - (BC_NUM_ZERO(n) || BC_NUM_RDX_VAL(n) * BC_BASE_DIGS >= (n)->scale) -#define BC_NUM_RDX_VALID_NP(n) \ - ((!(n).len) || BC_NUM_RDX_VAL_NP(n) * BC_BASE_DIGS >= (n).scale) - -#define BC_NUM_NEG(n) ((n)->rdx & ((BcBigDig) 1)) -#define BC_NUM_NEG_NP(n) ((n).rdx & ((BcBigDig) 1)) -#define BC_NUM_NEG_CLR(n) ((n)->rdx &= ~((BcBigDig) 1)) -#define BC_NUM_NEG_CLR_NP(n) ((n).rdx &= ~((BcBigDig) 1)) -#define BC_NUM_NEG_SET(n) ((n)->rdx |= ((BcBigDig) 1)) -#define BC_NUM_NEG_TGL(n) ((n)->rdx ^= ((BcBigDig) 1)) -#define BC_NUM_NEG_TGL_NP(n) ((n).rdx ^= ((BcBigDig) 1)) -#define BC_NUM_NEG_VAL(n, v) (((n)->rdx & ~((BcBigDig) 1)) | (v)) -#define BC_NUM_NEG_VAL_NP(n, v) (((n).rdx & ~((BcBigDig) 1)) | (v)) - #define BC_NUM_SIZE(n) ((n) * sizeof(BcDig)) #if BC_DEBUG_CODE @@ -193,7 +183,7 @@ void bc_num_bigdig2num(BcNum *restrict n, BcBigDig val *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011261718.0AQHIJV9099803>