Author: se
Date: Thu Nov 26 16:52:17 2020
New Revision: 368062
URL: https://svnweb.freebsd.org/changeset/base/368062

Log:
  Update to 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:40:39 2020        (r368061)
+++ vendor/bc/dist/.gitignore   Thu Nov 26 16:52:17 2020        (r368062)
@@ -9,6 +9,7 @@ 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:40:39 2020        (r368061)
+++ vendor/bc/dist/Makefile.in  Thu Nov 26 16:52:17 2020        (r368062)
@@ -29,33 +29,13 @@
 #
 .POSIX:
 
-VERSION = 3.1.6
+VERSION = 3.2.0
 
 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
@@ -102,6 +82,13 @@ 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
@@ -109,16 +96,28 @@ 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%%
@@ -129,7 +128,7 @@ BC_LONG_BIT = %%LONG_BIT%%
 RM = rm
 MKDIR = mkdir
 
-INSTALL = ./install.sh
+INSTALL = ./exec-install.sh
 SAFE_INSTALL = ./safe-install.sh
 LINK = ./link.sh
 MANPAGE = ./manpage.sh
@@ -148,7 +147,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)
+CPPFLAGS = $(CPPFLAGS7) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY) 
-DBC_ENABLE_LIBRARY=$(BC_ENABLE_LIBRARY)
 CFLAGS = $(CPPFLAGS) %%CPPFLAGS%% %%CFLAGS%%
 LDFLAGS = %%LDFLAGS%%
 
@@ -157,21 +156,24 @@ HOSTCFLAGS = %%HOSTCFLAGS%%
 CC = %%CC%%
 HOSTCC = %%HOSTCC%%
 
-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
+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
 
-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)
+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)
 
 .c.o:
        $(CC) $(CFLAGS) -o $@ -c $<
 
-all: make_bin $(OBJ_TARGETS)
+all: %%ALL_PREREQ%%
+
+execs: 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%%
 
@@ -182,10 +184,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.h "" 
$(BC_ENABLED_NAME)
+       $(GEN_EMU) $(GEN_EXEC) $(BC_HELP) $(BC_HELP_C) bc_help "" 
$(BC_ENABLED_NAME)
 
 $(DC_HELP_C): $(GEN_EXEC) $(DC_HELP)
-       $(GEN_EMU) $(GEN_EXEC) $(DC_HELP) $(DC_HELP_C) dc_help dc.h "" 
$(DC_ENABLED_NAME)
+       $(GEN_EMU) $(GEN_EXEC) $(DC_HELP) $(DC_HELP_C) dc_help "" 
$(DC_ENABLED_NAME)
 
 make_bin:
        $(MKDIR) -p $(BIN)
@@ -222,7 +224,7 @@ help:
 
 check: test
 
-test: test_bc timeconst test_dc
+test: %%TESTS%%
 
 test_bc:
        %%BC_TEST%%
@@ -241,6 +243,12 @@ 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:
@@ -272,6 +280,7 @@ extra_math:
 manpages:
        $(MANPAGE) bc
        $(MANPAGE) dc
+       $(MANPAGE) bcl
 
 clean_gen:
        @$(RM) -f $(GEN_EXEC)
@@ -279,10 +288,6 @@ 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)
@@ -343,9 +348,20 @@ install_bc_manpage:
 install_dc_manpage:
        $(SAFE_INSTALL) $(MANPAGE_INSTALL_ARGS) $(DC_MANPAGE) 
$(DESTDIR)$(MAN1DIR)/$(DC_MANPAGE_NAME)
 
-install:%%INSTALL_LOCALES_PREREQS%%%%INSTALL_PREREQS%%
+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) $(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)
 
@@ -360,5 +376,14 @@ 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:40:39 2020        (r368061)
+++ vendor/bc/dist/NEWS.md      Thu Nov 26 16:52:17 2020        (r368062)
@@ -1,5 +1,23 @@
 # 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:40:39 2020        (r368061)
+++ vendor/bc/dist/README.md    Thu Nov 26 16:52:17 2020        (r368062)
@@ -107,6 +107,23 @@ 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
@@ -335,3 +352,4 @@ 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:40:39 2020        (r368061)
+++ vendor/bc/dist/configure.sh Thu Nov 26 16:52:17 2020        (r368062)
@@ -45,22 +45,27 @@ usage() {
                _usage_val=0
        fi
 
-       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 '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 '\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 "--disable-bc"\n'
-       printf '        are specified too.\n'
+       printf '        Build bc only. It is an error if "-d", "--dc-only", 
"-B", or\n'
+       printf '        "--disable-bc" 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'
@@ -69,10 +74,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 "--disable-dc"\n'
-       printf '        are specified too.\n'
+       printf '        Build dc only. It is an error if "-b", "--bc-only", 
"-D", or\n'
+       printf '        "--disable-dc" 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'
@@ -122,8 +127,14 @@ 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. Overrides "$BINDIR" 
if it exists.\n'
+       printf '        The directory to install binaries in. 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'
@@ -136,6 +147,9 @@ 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'
@@ -157,12 +171,18 @@ 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. Default is 
"$PREFIX/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 '    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'
@@ -257,56 +277,55 @@ replace() {
        substring_replace "$_replace_str" "%%$_replace_needle%%" 
"$_replace_replacement"
 }
 
-gen_file_lists() {
+gen_file_list() {
 
-       if [ "$#" -lt 3 ]; then
+       if [ "$#" -lt 1 ]; then
                err_exit "Invalid number of args to $0"
        fi
 
-       _gen_file_lists_contents="$1"
+       _gen_file_list_contents="$1"
        shift
 
-       _gen_file_lists_filedir="$1"
-       shift
+       p=$(pwd)
 
-       _gen_file_lists_typ="$1"
-       shift
+       cd "$scriptdir"
 
-       # 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"
+       if [ "$#" -ge 1 ]; then
+
+               while [ "$#" -ge 1 ]; do
+                       a="$1"
+                       shift
+                       args="$args ! -wholename src/${a}"
+               done
+
        else
-               _gen_file_lists_use="1"
+               args="-print"
        fi
 
-       _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_needle_src="SRC"
+       _gen_file_list_needle_obj="OBJ"
+       _gen_file_list_needle_gcda="GCDA"
+       _gen_file_list_needle_gcno="GCNO"
 
-       if [ "$_gen_file_lists_use" -ne 0 ]; then
+       _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")
 
-               _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" 
"c" "o")
+       _gen_file_list_contents=$(replace "$_gen_file_list_contents" \
+               "$_gen_file_list_needle_obj" "$_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" 
"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" "o" "gcda")
-               _gen_file_lists_contents=$(replace "$_gen_file_lists_contents" 
"$_gen_file_lists_needle_gcda" "$_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" "gcda" "gcno")
-               _gen_file_lists_contents=$(replace "$_gen_file_lists_contents" 
"$_gen_file_lists_needle_gcno" "$_gen_file_lists_replacement")
+       cd "$p"
 
-       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"
+       printf '%s\n' "$_gen_file_list_contents"
 }
 
 bc_only=0
@@ -324,10 +343,12 @@ prompt=1
 force=0
 strip_bin=1
 all_locales=0
+library=0
 
-while getopts "bBcdDEfgGhHk:lMNO:PST-" opt; do
+while getopts "abBcdDEfgGhHk:lMNO:PST-" opt; do
 
        case "$opt" in
+               a) library=1 ;;
                b) bc_only=1 ;;
                B) dc_only=1 ;;
                c) coverage=1 ;;
@@ -352,6 +373,7 @@ while getopts "bBcdDEfgGhHk: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 ;;
@@ -371,6 +393,20 @@ while getopts "bBcdDEfgGhHk: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
@@ -399,6 +435,13 @@ while getopts "bBcdDEfgGhHk: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
@@ -454,6 +497,12 @@ 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" ;;
        (*) ;;
@@ -529,6 +578,8 @@ 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)"
 
@@ -567,7 +618,8 @@ 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_bc_manpage"
+       install_prereqs=" install_execs"
+       install_man_prereqs=" install_bc_manpage"
        uninstall_prereqs=" uninstall_bc"
        uninstall_man_prereqs=" uninstall_bc_manpage"
 
@@ -590,7 +642,8 @@ elif [ "$dc_only" -eq 1 ]; then
 
        timeconst="@printf 'timeconst cannot be run because bc is not 
built\\\\n'"
 
-       install_prereqs=" install_dc_manpage"
+       install_prereqs=" install_execs"
+       install_man_prereqs=" install_dc_manpage"
        uninstall_prereqs=" uninstall_dc"
        uninstall_man_prereqs=" uninstall_dc_manpage"
 
@@ -606,9 +659,18 @@ else
        karatsuba="@\$(KARATSUBA) 30 0 \$(BC_EXEC)"
        karatsuba_test="@\$(KARATSUBA) 1 100 \$(BC_EXEC)"
 
-       install_prereqs=" install_bc_manpage install_dc_manpage"
-       uninstall_prereqs=" uninstall_bc uninstall_dc"
-       uninstall_man_prereqs=" uninstall_bc_manpage uninstall_dc_manpage"
+       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
 
 fi
 
@@ -664,6 +726,14 @@ 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"
@@ -684,11 +754,25 @@ if [ "$install_manpages" -ne 0 ]; then
                MAN1DIR="$MANDIR/man1"
        fi
 
+       if [ -z "${MAN3DIR+set}" ]; then
+               MAN3DIR="$MANDIR/man3"
+       fi
+
 else
-       install_prereqs=""
+       install_man_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
@@ -776,11 +860,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"
+       flags="$flags -DBC_ENABLE_NLS=$nls -DBC_ENABLE_LIBRARY=0"
        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/history.c" -o 
"$scriptdir/history.o" > /dev/null 2>&1
+       "$CC" $CPPFLAGS $CFLAGS $flags -c "src/history.c" -o 
"$scriptdir/history.o" > /dev/null 2>&1
 
        err="$?"
 
@@ -804,7 +888,11 @@ if [ "$hist" -eq 1 ]; then
 
 fi
 
-if [ "$extra_math" -eq 1 ] && [ "$bc" -ne 0 ]; then
+if [ "$library" -eq 1 ]; then
+       bc_lib=""
+fi
+
+if [ "$extra_math" -eq 1 ] && [ "$bc" -ne 0 ] && [ "$library" -eq 0 ]; then
        BC_LIB2_O="\$(GEN_DIR)/lib2.o"
 else
        BC_LIB2_O=""
@@ -846,6 +934,33 @@ 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'
@@ -858,6 +973,7 @@ 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"
@@ -873,10 +989,13 @@ 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"
@@ -892,16 +1011,17 @@ replacement='*** WARNING: Autogenerated from Makefile.
 
 contents=$(replace "$contents" "$needle" "$replacement")
 
-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")
+if [ "$unneeded" = "" ]; then
+       contents=$(gen_file_list "$contents" "library.c")
+else
+       contents=$(gen_file_list "$contents" $unneeded)
+fi
 
 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")
@@ -917,7 +1037,10 @@ 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")
@@ -927,15 +1050,19 @@ 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:40:39 2020        (r368061)
+++ vendor/bc/dist/gen/lib.bc   Thu Nov 26 16:52:17 2020        (r368062)
@@ -173,7 +173,7 @@ define a(x){
        return((m*a+r)/n)
 }
 define j(n,x){
-       auto b,s,o,a,i,v,f
+       auto b,s,o,a,i,r,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:40:39 2020        (r368061)
+++ vendor/bc/dist/gen/strgen.c Thu Nov 26 16:52:17 2020        (r368062)
@@ -45,13 +45,14 @@
 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";
+       "// *** AUTOMATICALLY GENERATED FROM %s. DO NOT MODIFY. ***\n\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)
@@ -62,7 +63,7 @@ static const char* const bc_gen_name = "const char %s[
 int main(int argc, char *argv[]) {
 
        FILE *in, *out;
-       char *label, *define, *name, *include;
+       char *label, *define, *name;
        int c, count, slashes, err = IO_ERR;
        bool has_label, has_define, remove_tabs;
 
@@ -72,15 +73,14 @@ int main(int argc, char *argv[]) {
        }
 
        name = argv[3];
-       include = argv[4];
 
-       has_label = (argc > 5 && strcmp("", argv[5]) != 0);
-       label = has_label ? argv[5] : "";
+       has_label = (argc > 4 && strcmp("", argv[4]) != 0);
+       label = has_label ? argv[4] : "";
 
-       has_define = (argc > 6 && strcmp("", argv[6]) != 0);
-       define = has_define ? argv[6] : "";
+       has_define = (argc > 5 && strcmp("", argv[5]) != 0);
+       define = has_define ? argv[5] : "";
 
-       remove_tabs = (argc > 7);
+       remove_tabs = (argc > 6);
 
        in = fopen(argv[1], "r");
        if (!in) return INVALID_INPUT_FILE;
@@ -89,8 +89,9 @@ 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:40:39 2020        
(r368061)
+++ vendor/bc/dist/gen/strgen.sh        Thu Nov 26 16:52:17 2020        
(r368062)
@@ -50,6 +50,7 @@ exec > "$output"
 
 if [ -n "$label" ]; then
        nameline="const char *${label} = \"${input}\";"
+       labelexternline="extern const char *${label};"
 fi
 
 if [ -n "$define" ]; then
@@ -64,11 +65,14 @@ 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}
-#include <${header}>
+$labelexternline
+
+extern const char $name[];
 
 $nameline
 

Modified: vendor/bc/dist/include/file.h
==============================================================================
--- vendor/bc/dist/include/file.h       Thu Nov 26 16:40:39 2020        
(r368061)
+++ vendor/bc/dist/include/file.h       Thu Nov 26 16:52:17 2020        
(r368062)
@@ -62,6 +62,4 @@ 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:40:39 2020        
(r368061)
+++ vendor/bc/dist/include/lex.h        Thu Nov 26 16:52:17 2020        
(r368062)
@@ -43,8 +43,8 @@
 #include <vector.h>
 #include <lang.h>
 
-#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__))
+#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__))
 
 #if BC_ENABLED
 

Modified: vendor/bc/dist/include/num.h
==============================================================================
--- vendor/bc/dist/include/num.h        Thu Nov 26 16:40:39 2020        
(r368061)
+++ vendor/bc/dist/include/num.h        Thu Nov 26 16:52:17 2020        
(r368062)
@@ -45,6 +45,7 @@
 
 #include <status.h>
 #include <vector.h>
+#include <bcl.h>
 
 #ifndef BC_ENABLE_EXTRA_MATH
 #define BC_ENABLE_EXTRA_MATH (1)
@@ -54,25 +55,10 @@
 
 typedef unsigned long ulong;
 
-// 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
+typedef BclBigDig BcBigDig;
 
-#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)
@@ -80,11 +66,10 @@ typedef uint64_t 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)
@@ -92,6 +77,8 @@ typedef uint32_t BcBigDig;
 
 #define BC_NUM_BIGDIG_C UINT32_C
 
+typedef int_least16_t BcDig;
+
 #else
 
 #error BC_LONG_BIT must be at least 32
@@ -106,7 +93,6 @@ typedef struct BcNum {
        size_t scale;
        size_t len;
        size_t cap;
-       bool neg;
 } BcNum;
 
 #if BC_ENABLE_EXTRA_MATH
@@ -150,6 +136,30 @@ 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
@@ -183,7 +193,7 @@ void bc_num_bigdig2num(BcNum *restrict n, BcBigDig val

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to