Update to version 3.1.1

This version fixes a regression with regard to tradtional behavior of the
non-standard FreeBSD option "-e". In the previous version "-e quit" caused
bc to exit before any computations had been performed, since all -e option
parameters were concatenated and parsed as a whole, with quit causing the
program to exit as soon as it was parsed. This version parses and executes
commands passed with -e one by one and only exits after all prior commands
have been executed.

This commit is not a SVN merge, since the vendor import had been performed
after the import to contrib. Instead the contents of contrib/bc has been
removed and the new version is copied over unchanged from vendor/bc/dist.
This commit is contained in:
Stefan Eßer 2020-07-07 07:51:09 +00:00
commit 3aa99676b4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=362987
476 changed files with 122872 additions and 5618 deletions

60
contrib/bc/.gitignore vendored Normal file
View file

@ -0,0 +1,60 @@
*.config
*.creator
*.files
*.includes
*.creator.user*
*.cflags
*.cxxflags
bin/*bc
bin/*bc.exe
bin/*dc
bin/*dc.exe
bc.old
*.o
*.a
.log_*.txt
.test.txt
.math.txt
.results.txt
.ops.txt
manuals/bc.1
manuals/bc.1.ronn
manuals/bc.1.md
manuals/dc.1
manuals/dc.1.ronn
manuals/dc.1.md
gen/strgen
lib.c
lib2.c
lib3.c
bc_help.c
dc_help.c
config.mak
timeconst.bc
Makefile
.gdb_history
# Ignore the generated test files
parse.txt
parse_results.txt
print.txt
print_results.txt
bessel.txt
bessel_results.txt
prime.txt
stream.txt
tests/bc/scripts/add.txt
tests/bc/scripts/divide.txt
tests/bc/scripts/multiply.txt
tests/bc/scripts/subtract.txt
perf.data
perf.data.old
*.gcda
*.gcno
*.gcov
*.html
*.profraw
cscope*.out
tags

42
contrib/bc/.travis.yml Normal file
View file

@ -0,0 +1,42 @@
dist: bionic
language: c
arch:
- amd64
- arm64
- ppc64le
compiler:
- gcc
env:
global:
- CODECOV_TOKEN="040ce7eb-5bc7-4040-8324-364f3ef4baa3"
- CFLAGS="-coverage -DBC_RAND_BUILTIN=0"
matrix:
- CONFIGURE_ARGS=-fHNPOg GEN_HOST=1 LONG_BIT=64
- CONFIGURE_ARGS=-bfHNPOg GEN_HOST=1 LONG_BIT=64
- CONFIGURE_ARGS=-dfHNPOg GEN_HOST=1 LONG_BIT=64
- CONFIGURE_ARGS=-fEHNPOg GEN_HOST=1 LONG_BIT=64
- CONFIGURE_ARGS=-bfEHNPOg GEN_HOST=1 LONG_BIT=64
- CONFIGURE_ARGS=-dfEHNPOg GEN_HOST=1 LONG_BIT=64
- CONFIGURE_ARGS=-fHNPOg GEN_HOST=1 LONG_BIT=32
- CONFIGURE_ARGS=-bfHNPOg GEN_HOST=1 LONG_BIT=32
- CONFIGURE_ARGS=-dfHNPOg GEN_HOST=1 LONG_BIT=32
- CONFIGURE_ARGS=-fEHNPOg GEN_HOST=1 LONG_BIT=32
- CONFIGURE_ARGS=-bfEHNPOg GEN_HOST=1 LONG_BIT=32
- CONFIGURE_ARGS=-dfEHNPOg GEN_HOST=1 LONG_BIT=32
before_install:
- sudo apt-get install -y dc
- pip install --user codecov
before_script:
- curl -o tests/bc/scripts/timeconst.bc https://raw.githubusercontent.com/torvalds/linux/master/kernel/time/timeconst.bc
after_success:
- bash <(curl -s https://codecov.io/bash)
script:
- if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then ./configure.sh "$CONFIGURE_ARGS" && make -j4 && make -j4 test ; fi

View file

@ -2,8 +2,6 @@
Copyright (c) 2018-2020 Gavin D. Howard <yzena.tech@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@ -35,8 +33,6 @@ Copyright (c) 2010-2013, Pieter Noordhuis <pcnoordhuis at gmail dot com><br>
Copyright (c) 2018 rain-1 <rain1@openmailbox.org><br>
Copyright (c) 2018-2020, Gavin D. Howard <yzena.tech@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

View file

@ -1,8 +1,8 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
@ -29,7 +29,7 @@
#
.POSIX:
VERSION = 3.0.2
VERSION = 3.1.1
SRC = %%SRC%%
OBJ = %%OBJ%%
@ -105,10 +105,10 @@ DC_EXEC = $(BIN)/$(EXEC_PREFIX)$(DC)
MANUALS = manuals
BC_MANPAGE_NAME = $(EXEC_PREFIX)$(BC)$(EXEC_SUFFIX).1
BC_MANPAGE = $(MANUALS)/$(BC).1
BC_RONN = $(BC_MANPAGE).ronn
BC_MD = $(BC_MANPAGE).md
DC_MANPAGE_NAME = $(EXEC_PREFIX)$(DC)$(EXEC_SUFFIX).1
DC_MANPAGE = $(MANUALS)/$(DC).1
DC_RONN = $(DC_MANPAGE).ronn
DC_MD = $(DC_MANPAGE).md
MANPAGE_INSTALL_ARGS = -Dm644
@ -270,8 +270,8 @@ extra_math:
@printf '%s' "$(BC_ENABLE_EXTRA_MATH)"
manpages:
$(MANPAGE) $(BC_RONN) $(BC_MANPAGE)
$(MANPAGE) $(DC_RONN) $(DC_MANPAGE)
$(MANPAGE) bc
$(MANPAGE) dc
clean_gen:
@$(RM) -f $(GEN_EXEC)
@ -295,6 +295,8 @@ clean:%%CLEAN_PREREQS%%
clean_config: clean
@printf 'Cleaning config...\n'
@$(RM) -f Makefile
@$(RM) -f $(BC_MD) $(DC_MD)
@$(RM) -f $(BC_MANPAGE) $(DC_MANPAGE)
clean_coverage:
@printf 'Cleaning coverage files...\n'

View file

@ -1,5 +1,54 @@
# News
## 3.1.1
This is a production release that adds two Spanish locales. Users do ***NOT***
need to upgrade, unless they want those locales.
## 3.1.0
This is a production release that adjusts one behavior, fixes eight bugs, and
improves manpages for FreeBSD. Because this release fixes bugs, **users and
package maintainers should update to this version as soon as possible**.
The behavior that was adjusted was how code from the `-e` and `-f` arguments
(and equivalents) were executed. They used to be executed as one big chunk, but
in this release, they are now executed line-by-line.
The first bug fix in how output to `stdout` was handled in `SIGINT`. If a
`SIGINT` came in, the `stdout` buffer was not correctly flushed. In fact, a
clean-up function was not getting called. This release fixes that bug.
The second bug is in how `dc` handled input from `stdin`. This affected `bc` as
well since it was a mishandling of the `stdin` buffer.
The third fixed bug was that `bc` and `dc` could `abort()` (in debug mode) when
receiving a `SIGTERM`. This one was a race condition with pushing and popping
items onto and out of vectors.
The fourth bug fixed was that `bc` could leave extra items on the stack and
thus, not properly clean up some memory. (The memory would still get
`free()`'ed, but it would not be `free()`'ed when it could have been.)
The next two bugs were bugs in `bc`'s parser that caused crashes when executing
the resulting code.
The last two bugs were crashes in `dc` that resulted from mishandling of
strings.
The manpage improvement was done by switching from [ronn][20] to [Pandoc][21] to
generate manpages. Pandoc generates much cleaner manpages and doesn't leave
blank lines where they shouldn't be.
## 3.0.3
This is a production release that adds one new feature: specific manpages.
Before this release, `bc` and `dc` only used one manpage each that referred to
various build options. This release changes it so there is one manpage set per
relevant build type. Each manual only has information about its particular
build, and `configure.sh` selects the correct set for install.
## 3.0.2
This is a production release that adds `utf8` locale symlinks and removes an
@ -32,8 +81,9 @@ global ones that are already installed, so it will use the previous ones while
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
sure to either prevent the test suite from running on update or remove the old
locale files before updating.** Once this is done, `bc` should install without
problems.*
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
done, `bc` should install without problems.*
*Second, **the option to build without signal support has been removed**. See
below for the reasons why.*
@ -811,14 +861,16 @@ not thoroughly tested.
[6]: ./configure.sh
[7]: https://github.com/rain-1/linenoise-mob
[8]: https://github.com/antirez/linenoise
[9]: ./manuals/bc.1.ronn
[10]: ./manuals/dc.1.ronn
[9]: ./manuals/bc/A.1.md
[10]: ./manuals/dc/A.1.md
[11]: https://scan.coverity.com/projects/gavinhoward-bc
[12]: ./locale_install.sh
[13]: ./manuals/build.md
[14]: https://github.com/stesser
[15]: https://github.com/bugcrazy
[16]: ./manuals/bc.1.ronn#extended-library
[16]: ./manuals/bc/A.1.md#extended-library
[17]: https://github.com/skeeto/optparse
[18]: https://www.deepl.com/translator
[19]: ./manuals/benchmarks.md
[20]: https://github.com/apjanke/ronn-ng
[21]: https://pandoc.org/

View file

@ -11,7 +11,7 @@ This is an implementation of the [POSIX `bc` calculator][12] that implements
[GNU `bc`][1] extensions, as well as the period (`.`) extension for the BSD
flavor of `bc`.
For more information, see this `bc`'s [full manual][2].
For more information, see this `bc`'s full manual.
This `bc` also includes an implementation of `dc` in the same binary, accessible
via a symbolic link, which implements all FreeBSD and GNU extensions. (If a
@ -19,7 +19,7 @@ standalone `dc` binary is desired, `bc` can be copied and renamed to `dc`.) The
`!` command is omitted; I believe this poses security concerns and that such
functionality is unnecessary.
For more information, see the `dc`'s [full manual][3].
For more information, see the `dc`'s full manual.
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.
@ -39,7 +39,7 @@ Systems that are known to work:
* OpenBSD
* NetBSD
* Mac OSX
* Solaris
* Solaris* (as long as the Solaris version supports POSIX 2008)
* AIX
Please submit bug reports if this `bc` does not build out of the box on any
@ -261,6 +261,10 @@ Other projects based on this bc are:
* [toybox `bc`][9]. The maintainer has also made his own changes, so bugs in the
toybox `bc` should be reported there.
* [FreeBSD `bc`][23]. While the `bc` in FreeBSD is kept up-to-date, it is better
to report bugs there, and the maintainers of the package will contact me if
necessary.
## Language
This `bc` is written in pure ISO C99, using POSIX 2008 APIs.
@ -293,7 +297,7 @@ Files:
locale_install.sh A script to install locales, if desired.
locale_uninstall.sh A script to uninstall locales.
Makefile.in The Makefile template.
manpage.sh Script to generate man pages from ronn files.
manpage.sh Script to generate man pages from markdown files.
NOTICE.md List of contributors and copyright owners.
RELEASE.md A checklist for making a release (maintainer use only).
release.sh A script to test for release (maintainer use only).
@ -309,8 +313,6 @@ Folders:
tests All tests.
[1]: https://www.gnu.org/software/bc/
[2]: ./manuals/bc.md
[3]: ./manuals/dc.md
[4]: ./LICENSE.md
[5]: ./manuals/build.md
[6]: https://pkg.musl.cc/bc/
@ -330,3 +332,4 @@ Folders:
[20]: https://git.yzena.com/gavin/bc
[21]: https://gavinhoward.com/2020/04/i-am-moving-away-from-github/
[22]: https://www.deepl.com/translator
[23]: https://github.com/freebsd/freebsd/tree/master/contrib/bc

3
contrib/bc/codecov.yml Normal file
View file

@ -0,0 +1,3 @@
ignore:
- "src/history/history.c"
- "gen/strgen.c"

1
contrib/bc/configure vendored Symbolic link
View file

@ -0,0 +1 @@
configure.sh

954
contrib/bc/configure.sh Executable file
View file

@ -0,0 +1,954 @@
#! /bin/sh
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
script="$0"
scriptdir=$(dirname "$script")
script=$(basename "$script")
. "$scriptdir/functions.sh"
usage() {
if [ $# -gt 0 ]; then
_usage_val=1
printf "%s\n\n" "$1"
else
_usage_val=0
fi
printf 'usage: %s -h\n' "$script"
printf ' %s --help\n' "$script"
printf ' %s [-bD|-dB|-c] [-EfgGHMNPT] [-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] \\\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 ' -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 ' -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'
printf ' -c, --coverage\n'
printf ' Generate test coverage code. Requires gcov and regcovr.\n'
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 ' -D, --disable-dc\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'
printf ' "@" operator (set number of decimal places), and r(x, p) (rounding\n'
printf ' function). Additionally, this option disables the extra printing\n'
printf ' functions in the math library.\n'
printf ' -f, --force\n'
printf ' Force use of all enabled options, even if they do not work. This\n'
printf ' option is to allow the maintainer a way to test that certain options\n'
printf ' are not failing invisibly. (Development only.)'
printf ' -g, --debug\n'
printf ' Build in debug mode. Adds the "-g" flag, and if there are no\n'
printf ' other CFLAGS, and "-O" was not given, this also adds the "-O0"\n'
printf ' flag. If this flag is *not* given, "-DNDEBUG" is added to CPPFLAGS\n'
printf ' and a strip flag is added to the link stage.\n'
printf ' -G, --disable-generated-tests\n'
printf ' Disable generating tests. This is for platforms that do not have a\n'
printf ' GNU bc-compatible bc to generate tests.\n'
printf ' -h, --help\n'
printf ' Print this help message and exit.\n'
printf ' -H, --disable-history\n'
printf ' Disable history.\n'
printf ' -k KARATSUBA_LEN, --karatsuba-len KARATSUBA_LEN\n'
printf ' Set the karatsuba length to KARATSUBA_LEN (default is 64).\n'
printf ' It is an error if KARATSUBA_LEN is not a number or is less than 16.\n'
printf ' -M, --disable-man-pages\n'
printf ' Disable installing manpages.\n'
printf ' -N, --disable-nls\n'
printf ' Disable POSIX locale (NLS) support.\n'
printf ' -O OPT_LEVEL, --opt OPT_LEVEL\n'
printf ' Set the optimization level. This can also be included in the CFLAGS,\n'
printf ' but it is provided, so maintainers can build optimized debug builds.\n'
printf ' This is passed through to the compiler, so it must be supported.\n'
printf ' -P, --disable-prompt\n'
printf ' Disables the prompt in the built bc. The prompt will never show up,\n'
printf ' or in other words, it will be permanently disabled and cannot be\n'
printf ' enabled.\n'
printf ' -T, --disable-strip\n'
printf ' Disable stripping symbols from the compiled binary or binaries.\n'
printf ' Stripping symbols only happens when debug mode is off.\n'
printf ' --prefix PREFIX\n'
printf ' The prefix to install to. Overrides "$PREFIX" if it exists.\n'
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 ' Default is "$PREFIX/bin".\n'
printf ' --datarootdir DATAROOTDIR\n'
printf ' The root location for data files. Overrides "$DATAROOTDIR" if it exists.\n'
printf ' Default is "$PREFIX/share".\n'
printf ' --datadir DATADIR\n'
printf ' The location for data files. Overrides "$DATADIR" if it exists.\n'
printf ' Default is "$DATAROOTDIR".\n'
printf ' --mandir MANDIR\n'
printf ' The location to install manpages to. Overrides "$MANDIR" if it exists.\n'
printf ' Default is "$DATADIR/man".\n'
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 '\n'
printf 'In addition, the following environment variables are used:\n'
printf '\n'
printf ' CC C compiler. Must be compatible with POSIX c99. If there is a\n'
printf ' space in the basename of the compiler, the items after the\n'
printf ' first space are assumed to be compiler flags, and in that case,\n'
printf ' the flags are automatically moved into CFLAGS. Default is\n'
printf ' "c99".\n'
printf ' HOSTCC Host C compiler. Must be compatible with POSIX c99. If there is\n'
printf ' a space in the basename of the compiler, the items after the\n'
printf ' first space are assumed to be compiler flags, and in the case,\n'
printf ' the flags are automatically moved into HOSTCFLAGS. Default is\n'
printf ' "$CC".\n'
printf ' HOST_CC Same as HOSTCC. If HOSTCC also exists, it is used.\n'
printf ' CFLAGS C compiler flags.\n'
printf ' HOSTCFLAGS CFLAGS for HOSTCC. Default is "$CFLAGS".\n'
printf ' HOST_CFLAGS Same as HOST_CFLAGS. If HOST_CFLAGS also exists, it is used.\n'
printf ' CPPFLAGS C preprocessor flags. Default is "".\n'
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 ' 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 ' 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'
printf ' more information). Default is "/usr/share/locale/%%L/%%N".\n'
printf ' EXECSUFFIX The suffix to append to the executable names, used to not\n'
printf ' interfere with other installed bc executables. Default is "".\n'
printf ' EXECPREFIX The prefix to append to the executable names, used to not\n'
printf ' interfere with other installed bc executables. Default is "".\n'
printf ' DESTDIR For package creation. Default is "". If it is empty when\n'
printf ' `%s` is run, it can also be passed to `make install`\n' "$script"
printf ' later as an environment variable. If both are specified,\n'
printf ' the one given to `%s` takes precedence.\n' "$script"
printf ' LONG_BIT The number of bits in a C `long` type. This is mostly for the\n'
printf ' embedded space since this `bc` uses `long`s internally for\n'
printf ' overflow checking. In C99, a `long` is required to be 32 bits.\n'
printf ' For most normal desktop systems, setting this is unnecessary,\n'
printf ' except that 32-bit platforms with 64-bit longs may want to set\n'
printf ' it to `32`. Default is the default of `LONG_BIT` for the target\n'
printf ' platform. Minimum allowed is `32`. It is a build time error if\n'
printf ' the specified value of `LONG_BIT` is greater than the default\n'
printf ' value of `LONG_BIT` for the target platform.\n'
printf ' GEN_HOST Whether to use `gen/strgen.c`, instead of `gen/strgen.sh`, to\n'
printf ' produce the C files that contain the help texts as well as the\n'
printf ' math libraries. By default, `gen/strgen.c` is used, compiled by\n'
printf ' "$HOSTCC" and run on the host machine. Using `gen/strgen.sh`\n'
printf ' removes the need to compile and run an executable on the host\n'
printf ' machine since `gen/strgen.sh` is a POSIX shell script. However,\n'
printf ' `gen/lib2.bc` is perilously close to 4095 characters, the max\n'
printf ' supported length of a string literal in C99 (and it could be\n'
printf ' added to in the future), and `gen/strgen.sh` generates a string\n'
printf ' literal instead of an array, as `gen/strgen.c` does. For most\n'
printf ' production-ready compilers, this limit probably is not\n'
printf ' enforced, but it could be. Both options are still available for\n'
printf ' this reason. If you are sure your compiler does not have the\n'
printf ' limit and do not want to compile and run a binary on the host\n'
printf ' machine, set this variable to "0". Any other value, or a\n'
printf ' non-existent value, will cause the build system to compile and\n'
printf ' run `gen/strgen.c`. Default is "".\n'
printf ' GEN_EMU Emulator to run string generator code under (leave empty if not\n'
printf ' necessary). This is not necessary when using `gen/strgen.sh`.\n'
printf ' Default is "".\n'
printf '\n'
printf 'WARNING: even though `configure.sh` supports both option types, short and\n'
printf 'long, it does not support handling both at the same time. Use only one type.\n'
exit "$_usage_val"
}
replace_ext() {
if [ "$#" -ne 3 ]; then
err_exit "Invalid number of args to $0"
fi
_replace_ext_file="$1"
_replace_ext_ext1="$2"
_replace_ext_ext2="$3"
_replace_ext_result=${_replace_ext_file%.$_replace_ext_ext1}.$_replace_ext_ext2
printf '%s\n' "$_replace_ext_result"
}
replace_exts() {
if [ "$#" -ne 3 ]; then
err_exit "Invalid number of args to $0"
fi
_replace_exts_files="$1"
_replace_exts_ext1="$2"
_replace_exts_ext2="$3"
for _replace_exts_file in $_replace_exts_files; do
_replace_exts_new_name=$(replace_ext "$_replace_exts_file" "$_replace_exts_ext1" "$_replace_exts_ext2")
_replace_exts_result="$_replace_exts_result $_replace_exts_new_name"
done
printf '%s\n' "$_replace_exts_result"
}
replace() {
if [ "$#" -ne 3 ]; then
err_exit "Invalid number of args to $0"
fi
_replace_str="$1"
_replace_needle="$2"
_replace_replacement="$3"
substring_replace "$_replace_str" "%%$_replace_needle%%" "$_replace_replacement"
}
gen_file_lists() {
if [ "$#" -lt 3 ]; then
err_exit "Invalid number of args to $0"
fi
_gen_file_lists_contents="$1"
shift
_gen_file_lists_filedir="$1"
shift
_gen_file_lists_typ="$1"
shift
# 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
_gen_file_lists_use="1"
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"
if [ "$_gen_file_lists_use" -ne 0 ]; then
_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_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_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_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")
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
dc_only=0
coverage=0
karatsuba_len=32
debug=0
hist=1
extra_math=1
optimization=""
generate_tests=1
install_manpages=1
nls=1
prompt=1
force=0
strip_bin=1
while getopts "bBcdDEfgGhHk:MNO:PST-" opt; do
case "$opt" in
b) bc_only=1 ;;
B) dc_only=1 ;;
c) coverage=1 ;;
d) dc_only=1 ;;
D) bc_only=1 ;;
E) extra_math=0 ;;
f) force=1 ;;
g) debug=1 ;;
G) generate_tests=0 ;;
h) usage ;;
H) hist=0 ;;
k) karatsuba_len="$OPTARG" ;;
M) install_manpages=0 ;;
N) nls=0 ;;
O) optimization="$OPTARG" ;;
P) prompt=0 ;;
T) strip_bin=0 ;;
-)
arg="$1"
arg="${arg#--}"
LONG_OPTARG="${arg#*=}"
case $arg in
help) usage ;;
bc-only) bc_only=1 ;;
dc-only) dc_only=1 ;;
coverage) coverage=1 ;;
debug) debug=1 ;;
force) force=1 ;;
prefix=?*) PREFIX="$LONG_OPTARG" ;;
prefix)
if [ "$#" -lt 2 ]; then
usage "No argument given for '--$arg' option"
fi
PREFIX="$2"
shift ;;
bindir=?*) BINDIR="$LONG_OPTARG" ;;
bindir)
if [ "$#" -lt 2 ]; then
usage "No argument given for '--$arg' option"
fi
BINDIR="$2"
shift ;;
datarootdir=?*) DATAROOTDIR="$LONG_OPTARG" ;;
datarootdir)
if [ "$#" -lt 2 ]; then
usage "No argument given for '--$arg' option"
fi
DATAROOTDIR="$2"
shift ;;
datadir=?*) DATADIR="$LONG_OPTARG" ;;
datadir)
if [ "$#" -lt 2 ]; then
usage "No argument given for '--$arg' option"
fi
DATADIR="$2"
shift ;;
mandir=?*) MANDIR="$LONG_OPTARG" ;;
mandir)
if [ "$#" -lt 2 ]; then
usage "No argument given for '--$arg' option"
fi
MANDIR="$2"
shift ;;
man1dir=?*) MAN1DIR="$LONG_OPTARG" ;;
man1dir)
if [ "$#" -lt 2 ]; then
usage "No argument given for '--$arg' option"
fi
MAN1DIR="$2"
shift ;;
localedir=?*) LOCALEDIR="$LONG_OPTARG" ;;
localedir)
if [ "$#" -lt 2 ]; then
usage "No argument given for '--$arg' option"
fi
LOCALEDIR="$2"
shift ;;
karatsuba-len=?*) karatsuba_len="$LONG_OPTARG" ;;
karatsuba-len)
if [ "$#" -lt 2 ]; then
usage "No argument given for '--$arg' option"
fi
karatsuba_len="$1"
shift ;;
opt=?*) optimization="$LONG_OPTARG" ;;
opt)
if [ "$#" -lt 2 ]; then
usage "No argument given for '--$arg' option"
fi
optimization="$1"
shift ;;
disable-bc) dc_only=1 ;;
disable-dc) bc_only=1 ;;
disable-extra-math) extra_math=0 ;;
disable-generated-tests) generate_tests=0 ;;
disable-history) hist=0 ;;
disable-man-pages) install_manpages=0 ;;
disable-nls) nls=0 ;;
disable-prompt) prompt=0 ;;
disable-strip) strip_bin=0 ;;
help* | bc-only* | dc-only* | coverage* | debug*)
usage "No arg allowed for --$arg option" ;;
disable-bc* | disable-dc* | disable-extra-math*)
usage "No arg allowed for --$arg option" ;;
disable-generated-tests* | disable-history*)
usage "No arg allowed for --$arg option" ;;
disable-man-pages* | disable-nls* | disable-strip*)
usage "No arg allowed for --$arg option" ;;
'') break ;; # "--" terminates argument processing
* ) usage "Invalid option $LONG_OPTARG" ;;
esac
shift
OPTIND=1 ;;
?) usage "Invalid option $opt" ;;
esac
done
if [ "$bc_only" -eq 1 ] && [ "$dc_only" -eq 1 ]; then
usage "Can only specify one of -b(-D) or -d(-B)"
fi
case $karatsuba_len in
(*[!0-9]*|'') usage "KARATSUBA_LEN is not a number" ;;
(*) ;;
esac
if [ "$karatsuba_len" -lt 16 ]; then
usage "KARATSUBA_LEN is less than 16"
fi
set -e
if [ -z "${LONG_BIT+set}" ]; then
LONG_BIT_DEFINE=""
elif [ "$LONG_BIT" -lt 32 ]; then
usage "LONG_BIT is less than 32"
else
LONG_BIT_DEFINE="-DBC_LONG_BIT=\$(BC_LONG_BIT)"
fi
if [ -z "$CC" ]; then
CC="c99"
else
ccbase=$(basename "$CC")
suffix=" *"
prefix="* "
if [ "${ccbase%%$suffix}" != "$ccbase" ]; then
ccflags="${ccbase#$prefix}"
cc="${ccbase%%$suffix}"
ccdir=$(dirname "$CC")
if [ "$ccdir" = "." ] && [ "${CC#.}" = "$CC" ]; then
ccdir=""
else
ccdir="$ccdir/"
fi
CC="${ccdir}${cc}"
CFLAGS="$CFLAGS $ccflags"
fi
fi
if [ -z "$HOSTCC" ] && [ -z "$HOST_CC" ]; then
HOSTCC="$CC"
elif [ -z "$HOSTCC" ]; then
HOSTCC="$HOST_CC"
fi
if [ "$HOSTCC" != "$CC" ]; then
ccbase=$(basename "$HOSTCC")
suffix=" *"
prefix="* "
if [ "${ccbase%%$suffix}" != "$ccbase" ]; then
ccflags="${ccbase#$prefix}"
cc="${ccbase%%$suffix}"
ccdir=$(dirname "$HOSTCC")
if [ "$ccdir" = "." ] && [ "${HOSTCC#.}" = "$HOSTCC" ]; then
ccdir=""
else
ccdir="$ccdir/"
fi
HOSTCC="${ccdir}${cc}"
HOSTCFLAGS="$HOSTCFLAGS $ccflags"
fi
fi
if [ -z "${HOSTCFLAGS+set}" ] && [ -z "${HOST_CFLAGS+set}" ]; then
HOSTCFLAGS="$CFLAGS"
elif [ -z "${HOSTCFLAGS+set}" ]; then
HOSTCFLAGS="$HOST_CFLAGS"
fi
link="@printf 'No link necessary\\\\n'"
main_exec="BC"
executable="BC_EXEC"
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)"
dc_test="@tests/all.sh dc $extra_math 1 $generate_tests 0 \$(DC_EXEC)"
dc_time_test="@tests/all.sh dc $extra_math 1 $generate_tests 1 \$(DC_EXEC)"
timeconst="@tests/bc/timeconst.sh tests/bc/scripts/timeconst.bc \$(BC_EXEC)"
# In order to have cleanup at exit, we need to be in
# debug mode, so don't run valgrind without that.
if [ "$debug" -ne 0 ]; then
vg_bc_test="@tests/all.sh bc $extra_math 1 $generate_tests 0 valgrind \$(VALGRIND_ARGS) \$(BC_EXEC)"
vg_dc_test="@tests/all.sh dc $extra_math 1 $generate_tests 0 valgrind \$(VALGRIND_ARGS) \$(DC_EXEC)"
else
vg_bc_test="@printf 'Cannot run valgrind without debug flags\\\\n'"
vg_dc_test="@printf 'Cannot run valgrind without debug flags\\\\n'"
fi
karatsuba="@printf 'karatsuba cannot be run because one of bc or dc is not built\\\\n'"
karatsuba_test="@printf 'karatsuba cannot be run because one of bc or dc is not built\\\\n'"
bc_lib="\$(GEN_DIR)/lib.o"
bc_help="\$(GEN_DIR)/bc_help.o"
dc_help="\$(GEN_DIR)/dc_help.o"
if [ "$bc_only" -eq 1 ]; then
bc=1
dc=0
dc_help=""
executables="bc"
dc_test="@printf 'No dc tests to run\\\\n'"
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"
uninstall_prereqs=" uninstall_bc"
uninstall_man_prereqs=" uninstall_bc_manpage"
elif [ "$dc_only" -eq 1 ]; then
bc=0
dc=1
bc_lib=""
bc_help=""
executables="dc"
main_exec="DC"
executable="DC_EXEC"
bc_test="@printf 'No bc tests to run\\\\n'"
bc_time_test="@printf 'No bc tests to run\\\\n'"
vg_bc_test="@printf 'No bc tests to run\\\\n'"
timeconst="@printf 'timeconst cannot be run because bc is not built\\\\n'"
install_prereqs=" install_dc_manpage"
uninstall_prereqs=" uninstall_dc"
uninstall_man_prereqs=" uninstall_dc_manpage"
else
bc=1
dc=1
executables="bc and dc"
link="\$(LINK) \$(BIN) \$(EXEC_PREFIX)\$(DC)"
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"
fi
if [ "$debug" -eq 1 ]; then
if [ -z "$CFLAGS" ] && [ -z "$optimization" ]; then
CFLAGS="-O0"
fi
CFLAGS="-g $CFLAGS"
else
CPPFLAGS="-DNDEBUG $CPPFLAGS"
if [ "$strip_bin" -ne 0 ]; then
LDFLAGS="-s $LDFLAGS"
fi
fi
if [ -n "$optimization" ]; then
CFLAGS="-O$optimization $CFLAGS"
fi
if [ "$coverage" -eq 1 ]; then
if [ "$bc_only" -eq 1 ] || [ "$dc_only" -eq 1 ]; then
usage "Can only specify -c without -b or -d"
fi
CFLAGS="-fprofile-arcs -ftest-coverage -g -O0 $CFLAGS"
CPPFLAGS="-DNDEBUG $CPPFLAGS"
COVERAGE_OUTPUT="@gcov -pabcdf \$(GCDA) \$(BC_GCDA) \$(DC_GCDA) \$(HISTORY_GCDA) \$(RAND_GCDA)"
COVERAGE_OUTPUT="$COVERAGE_OUTPUT;\$(RM) -f \$(GEN)*.gc*"
COVERAGE_OUTPUT="$COVERAGE_OUTPUT;gcovr --html-details --output index.html"
COVERAGE_PREREQS=" test coverage_output"
else
COVERAGE_OUTPUT="@printf 'Coverage not generated\\\\n'"
COVERAGE_PREREQS=""
fi
if [ -z "${DESTDIR+set}" ]; then
destdir=""
else
destdir="DESTDIR = $DESTDIR"
fi
if [ -z "${PREFIX+set}" ]; then
PREFIX="/usr/local"
fi
if [ -z "${BINDIR+set}" ]; then
BINDIR="$PREFIX/bin"
fi
if [ "$install_manpages" -ne 0 ] || [ "$nls" -ne 0 ]; then
if [ -z "${DATAROOTDIR+set}" ]; then
DATAROOTDIR="$PREFIX/share"
fi
fi
if [ "$install_manpages" -ne 0 ]; then
if [ -z "${DATADIR+set}" ]; then
DATADIR="$DATAROOTDIR"
fi
if [ -z "${MANDIR+set}" ]; then
MANDIR="$DATADIR/man"
fi
if [ -z "${MAN1DIR+set}" ]; then
MAN1DIR="$MANDIR/man1"
fi
else
install_prereqs=""
uninstall_man_prereqs=""
fi
if [ "$nls" -ne 0 ]; then
set +e
printf 'Testing NLS...\n'
flags="-DBC_ENABLE_NLS=1 -DBC_ENABLED=$bc -DDC_ENABLED=$dc"
flags="$flags -DBC_ENABLE_HISTORY=$hist"
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/vm.c" -o "$scriptdir/vm.o" > /dev/null 2>&1
err="$?"
rm -rf "$scriptdir/vm.o"
# If this errors, it is probably because of building on Windows,
# and NLS is not supported on Windows, so disable it.
if [ "$err" -ne 0 ]; then
printf 'NLS does not work.\n'
if [ $force -eq 0 ]; then
printf 'Disabling NLS...\n\n'
nls=0
else
printf 'Forcing NLS...\n\n'
fi
else
printf 'NLS works.\n\n'
printf 'Testing gencat...\n'
gencat "$scriptdir/en_US.cat" "$scriptdir/locales/en_US.msg" > /dev/null 2>&1
err="$?"
rm -rf "$scriptdir/en_US.cat"
if [ "$err" -ne 0 ]; then
printf 'gencat does not work.\n'
if [ $force -eq 0 ]; then
printf 'Disabling NLS...\n\n'
nls=0
else
printf 'Forcing NLS...\n\n'
fi
else
printf 'gencat works.\n\n'
if [ "$HOSTCC" != "$CC" ]; then
printf 'Cross-compile detected.\n\n'
printf 'WARNING: Catalog files generated with gencat may not be portable\n'
printf ' across different architectures.\n\n'
fi
if [ -z "$NLSPATH" ]; then
NLSPATH="/usr/share/locale/%L/%N"
fi
install_locales_prereqs=" install_locales"
uninstall_locales_prereqs=" uninstall_locales"
fi
fi
set -e
else
install_locales_prereqs=""
uninstall_locales_prereqs=""
fi
if [ "$hist" -eq 1 ]; then
set +e
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_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
err="$?"
rm -rf "$scriptdir/history.o"
# If this errors, it is probably because of building on Windows,
# and history is not supported on Windows, so disable it.
if [ "$err" -ne 0 ]; then
printf 'History does not work.\n'
if [ $force -eq 0 ]; then
printf 'Disabling history...\n\n'
hist=0
else
printf 'Forcing history...\n\n'
fi
else
printf 'History works.\n\n'
fi
set -e
fi
if [ "$extra_math" -eq 1 ] && [ "$bc" -ne 0 ]; then
BC_LIB2_O="\$(GEN_DIR)/lib2.o"
else
BC_LIB2_O=""
fi
GEN="strgen"
GEN_EXEC_TARGET="\$(HOSTCC) \$(HOSTCFLAGS) -o \$(GEN_EXEC) \$(GEN_C)"
CLEAN_PREREQS=" clean_gen"
if [ -z "${GEN_HOST+set}" ]; then
GEN_HOST=1
else
if [ "$GEN_HOST" -eq 0 ]; then
GEN="strgen.sh"
GEN_EXEC_TARGET="@printf 'Do not need to build gen/strgen.c\\\\n'"
CLEAN_PREREQS=""
fi
fi
manpage_args=""
if [ "$extra_math" -eq 0 ]; then
manpage_args="E"
fi
if [ "$hist" -eq 0 ]; then
manpage_args="${manpage_args}H"
fi
if [ "$nls" -eq 0 ]; then
manpage_args="${manpage_args}N"
fi
if [ "$prompt" -eq 0 ]; then
manpage_args="${manpage_args}P"
fi
if [ "$manpage_args" = "" ]; then
manpage_args="A"
fi
# Print out the values; this is for debugging.
if [ "$bc" -ne 0 ]; then
printf 'Building bc\n'
else
printf 'Not building bc\n'
fi
if [ "$dc" -ne 0 ]; then
printf 'Building dc\n'
else
printf 'Not building dc\n'
fi
printf '\n'
printf 'BC_ENABLE_HISTORY=%s\n' "$hist"
printf 'BC_ENABLE_EXTRA_MATH=%s\n' "$extra_math"
printf 'BC_ENABLE_NLS=%s\n' "$nls"
printf 'BC_ENABLE_PROMPT=%s\n' "$prompt"
printf '\n'
printf 'BC_NUM_KARATSUBA_LEN=%s\n' "$karatsuba_len"
printf '\n'
printf 'CC=%s\n' "$CC"
printf 'CFLAGS=%s\n' "$CFLAGS"
printf 'HOSTCC=%s\n' "$HOSTCC"
printf 'HOSTCFLAGS=%s\n' "$HOSTCFLAGS"
printf 'CPPFLAGS=%s\n' "$CPPFLAGS"
printf 'LDFLAGS=%s\n' "$LDFLAGS"
printf 'PREFIX=%s\n' "$PREFIX"
printf 'BINDIR=%s\n' "$BINDIR"
printf 'DATAROOTDIR=%s\n' "$DATAROOTDIR"
printf 'DATADIR=%s\n' "$DATADIR"
printf 'MANDIR=%s\n' "$MANDIR"
printf 'MAN1DIR=%s\n' "$MAN1DIR"
printf 'NLSPATH=%s\n' "$NLSPATH"
printf 'EXECSUFFIX=%s\n' "$EXECSUFFIX"
printf 'EXECPREFIX=%s\n' "$EXECPREFIX"
printf 'DESTDIR=%s\n' "$DESTDIR"
printf 'LONG_BIT=%s\n' "$LONG_BIT"
printf 'GEN_HOST=%s\n' "$GEN_HOST"
printf 'GEN_EMU=%s\n' "$GEN_EMU"
contents=$(cat "$scriptdir/Makefile.in")
needle="WARNING"
replacement='*** WARNING: Autogenerated from Makefile.in. DO NOT MODIFY ***'
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")
contents=$(replace "$contents" "BC_ENABLED" "$bc")
contents=$(replace "$contents" "DC_ENABLED" "$dc")
contents=$(replace "$contents" "LINK" "$link")
contents=$(replace "$contents" "HISTORY" "$hist")
contents=$(replace "$contents" "EXTRA_MATH" "$extra_math")
contents=$(replace "$contents" "NLS" "$nls")
contents=$(replace "$contents" "PROMPT" "$prompt")
contents=$(replace "$contents" "BC_LIB_O" "$bc_lib")
contents=$(replace "$contents" "BC_HELP_O" "$bc_help")
contents=$(replace "$contents" "DC_HELP_O" "$dc_help")
contents=$(replace "$contents" "BC_LIB2_O" "$BC_LIB2_O")
contents=$(replace "$contents" "KARATSUBA_LEN" "$karatsuba_len")
contents=$(replace "$contents" "NLSPATH" "$NLSPATH")
contents=$(replace "$contents" "DESTDIR" "$destdir")
contents=$(replace "$contents" "EXECSUFFIX" "$EXECSUFFIX")
contents=$(replace "$contents" "EXECPREFIX" "$EXECPREFIX")
contents=$(replace "$contents" "BINDIR" "$BINDIR")
contents=$(replace "$contents" "MAN1DIR" "$MAN1DIR")
contents=$(replace "$contents" "CFLAGS" "$CFLAGS")
contents=$(replace "$contents" "HOSTCFLAGS" "$HOSTCFLAGS")
contents=$(replace "$contents" "CPPFLAGS" "$CPPFLAGS")
contents=$(replace "$contents" "LDFLAGS" "$LDFLAGS")
contents=$(replace "$contents" "CC" "$CC")
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_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" "EXECUTABLES" "$executables")
contents=$(replace "$contents" "MAIN_EXEC" "$main_exec")
contents=$(replace "$contents" "EXEC" "$executable")
contents=$(replace "$contents" "BC_TEST" "$bc_test")
contents=$(replace "$contents" "BC_TIME_TEST" "$bc_time_test")
contents=$(replace "$contents" "DC_TEST" "$dc_test")
contents=$(replace "$contents" "DC_TIME_TEST" "$dc_time_test")
contents=$(replace "$contents" "VG_BC_TEST" "$vg_bc_test")
contents=$(replace "$contents" "VG_DC_TEST" "$vg_dc_test")
contents=$(replace "$contents" "TIMECONST" "$timeconst")
contents=$(replace "$contents" "KARATSUBA" "$karatsuba")
contents=$(replace "$contents" "KARATSUBA_TEST" "$karatsuba_test")
contents=$(replace "$contents" "LONG_BIT" "$LONG_BIT")
contents=$(replace "$contents" "LONG_BIT_DEFINE" "$LONG_BIT_DEFINE")
contents=$(replace "$contents" "GEN" "$GEN")
contents=$(replace "$contents" "GEN_EXEC_TARGET" "$GEN_EXEC_TARGET")
contents=$(replace "$contents" "CLEAN_PREREQS" "$CLEAN_PREREQS")
contents=$(replace "$contents" "GEN_EMU" "$GEN_EMU")
printf '%s\n' "$contents" > "$scriptdir/Makefile"
cd "$scriptdir"
cp -f manuals/bc/$manpage_args.1.md manuals/bc.1.md
cp -f manuals/bc/$manpage_args.1 manuals/bc.1
cp -f manuals/dc/$manpage_args.1.md manuals/dc.1.md
cp -f manuals/dc/$manpage_args.1 manuals/dc.1
make clean > /dev/null

218
contrib/bc/functions.sh Executable file
View file

@ -0,0 +1,218 @@
#! /bin/sh
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
readlink() {
_readlink_f="$1"
shift
_readlink_arrow="-> "
_readlink_d=$(dirname "$_readlink_f")
_readlink_lsout=""
_readlink_link=""
_readlink_lsout=$(ls -dl "$_readlink_f")
_readlink_link=$(printf '%s' "${_readlink_lsout#*$_readlink_arrow}")
while [ -z "${_readlink_lsout##*$_readlink_arrow*}" ]; do
_readlink_f="$_readlink_d/$_readlink_link"
_readlink_d=$(dirname "$_readlink_f")
_readlink_lsout=$(ls -dl "$_readlink_f")
_readlink_link=$(printf '%s' "${_readlink_lsout#*$_readlink_arrow}")
done
printf '%s' "${_readlink_f##*$_readlink_d/}"
}
err_exit() {
if [ "$#" -ne 2 ]; then
printf 'Invalid number of args to err_exit\n'
exit 1
fi
printf '%s\n' "$1"
printf '\nexiting...\n'
exit "$2"
}
die() {
_die_d="$1"
shift
_die_msg="$1"
shift
_die_name="$1"
shift
_die_err="$1"
shift
_die_str=$(printf '\n%s %s on test:\n\n %s\n' "$_die_d" "$_die_msg" "$_die_name")
err_exit "$_die_str" "$_die_err"
}
checkcrash() {
_checkcrash_d="$1"
shift
_checkcrash_error="$1"
shift
_checkcrash_name="$1"
shift
if [ "$_checkcrash_error" -gt 127 ]; then
die "$_checkcrash_d" "crashed ($_checkcrash_error)" \
"$_checkcrash_name" "$_checkcrash_error"
fi
}
checktest()
{
_checktest_d="$1"
shift
_checktest_error="$1"
shift
_checktest_name="$1"
shift
_checktest_out="$1"
shift
_checktest_exebase="$1"
shift
checkcrash "$_checktest_d" "$_checktest_error" "$_checktest_name"
if [ "$_checktest_error" -eq 0 ]; then
die "$_checktest_d" "returned no error" "$_checktest_name" 127
fi
if [ "$_checktest_error" -eq 100 ]; then
_checktest_output=$(cat "$_checktest_out")
_checktest_fatal_error="Fatal error"
if [ "${_checktest_output##*$_checktest_fatal_error*}" ]; then
printf "%s\n" "$_checktest_output"
die "$_checktest_d" "had memory errors on a non-fatal error" \
"$_checktest_name" "$_checktest_error"
fi
fi
if [ ! -s "$_checktest_out" ]; then
die "$_checktest_d" "produced no error message" "$_checktest_name" "$_checktest_error"
fi
# Display the error messages if not directly running exe.
# This allows the script to print valgrind output.
if [ "$_checktest_exebase" != "bc" -a "$_checktest_exebase" != "dc" ]; then
cat "$_checktest_out"
fi
}
substring_replace() {
_substring_replace_str="$1"
shift
_substring_replace_needle="$1"
shift
_substring_replace_replacement="$1"
shift
_substring_replace_result=$(printf '%s\n' "$_substring_replace_str" | \
sed -e "s!$_substring_replace_needle!$_substring_replace_replacement!g")
printf '%s' "$_substring_replace_result"
}
gen_nlspath() {
_gen_nlspath_nlspath="$1"
shift
_gen_nlspath_locale="$1"
shift
_gen_nlspath_execname="$1"
shift
_gen_nlspath_char="@"
_gen_nlspath_modifier="${_gen_nlspath_locale#*$_gen_nlspath_char}"
_gen_nlspath_tmplocale="${_gen_nlspath_locale%%$_gen_nlspath_char*}"
_gen_nlspath_char="."
_gen_nlspath_charset="${_gen_nlspath_tmplocale#*$_gen_nlspath_char}"
_gen_nlspath_tmplocale="${_gen_nlspath_tmplocale%%$_gen_nlspath_char*}"
if [ "$_gen_nlspath_charset" = "$_gen_nlspath_tmplocale" ]; then
_gen_nlspath_charset=""
fi
_gen_nlspath_char="_"
_gen_nlspath_territory="${_gen_nlspath_tmplocale#*$_gen_nlspath_char}"
_gen_nlspath_language="${_gen_nlspath_tmplocale%%$_gen_nlspath_char*}"
if [ "$_gen_nlspath_territory" = "$_gen_nlspath_tmplocale" ]; then
_gen_nlspath_territory=""
fi
if [ "$_gen_nlspath_language" = "$_gen_nlspath_tmplocale" ]; then
_gen_nlspath_language=""
fi
_gen_nlspath_needles="%%:%L:%N:%l:%t:%c"
_gen_nlspath_needles=$(printf '%s' "$_gen_nlspath_needles" | tr ':' '\n')
for _gen_nlspath_i in $_gen_nlspath_needles; do
_gen_nlspath_nlspath=$(substring_replace "$_gen_nlspath_nlspath" "$_gen_nlspath_i" "|$_gen_nlspath_i|")
done
_gen_nlspath_nlspath=$(substring_replace "$_gen_nlspath_nlspath" "%%" "%")
_gen_nlspath_nlspath=$(substring_replace "$_gen_nlspath_nlspath" "%L" "$_gen_nlspath_locale")
_gen_nlspath_nlspath=$(substring_replace "$_gen_nlspath_nlspath" "%N" "$_gen_nlspath_execname")
_gen_nlspath_nlspath=$(substring_replace "$_gen_nlspath_nlspath" "%l" "$_gen_nlspath_language")
_gen_nlspath_nlspath=$(substring_replace "$_gen_nlspath_nlspath" "%t" "$_gen_nlspath_territory")
_gen_nlspath_nlspath=$(substring_replace "$_gen_nlspath_nlspath" "%c" "$_gen_nlspath_charset")
_gen_nlspath_nlspath=$(printf '%s' "$_gen_nlspath_nlspath" | tr -d '|')
printf '%s' "$_gen_nlspath_nlspath"
}

View file

@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -58,6 +58,8 @@ This bc has three differences to the GNU bc:
3) This bc has many more extensions than the GNU bc does. For details, see the
man page.
This bc also implements the dot (.) extension of the BSD bc.
Options:
-e expr --expression=expr
@ -94,6 +96,9 @@ Options:
e(expr) = raises e to the power of expr
j(n, x) = Bessel function of integer order n of x
This bc may load more functions with these options. See the manpage for
details.
-P --no-prompt
Disable the prompt in interactive mode.

View file

@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:

View file

@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:

View file

@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:

143
contrib/bc/gen/strgen.c Normal file
View file

@ -0,0 +1,143 @@
/*
* *****************************************************************************
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* *****************************************************************************
*
* Generates a const array from a bc script.
*
*/
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <libgen.h>
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";
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_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";
#define IO_ERR (1)
#define INVALID_INPUT_FILE (2)
#define INVALID_PARAMS (3)
#define MAX_WIDTH (74)
int main(int argc, char *argv[]) {
FILE *in, *out;
char *label, *define, *name, *include;
int c, count, slashes, err = IO_ERR;
bool has_label, has_define, remove_tabs;
if (argc < 5) {
printf("usage: %s input output name header [label [define [remove_tabs]]]\n", argv[0]);
return INVALID_PARAMS;
}
name = argv[3];
include = argv[4];
has_label = (argc > 5 && strcmp("", argv[5]) != 0);
label = has_label ? argv[5] : "";
has_define = (argc > 6 && strcmp("", argv[6]) != 0);
define = has_define ? argv[6] : "";
remove_tabs = (argc > 7);
in = fopen(argv[1], "r");
if (!in) return INVALID_INPUT_FILE;
out = fopen(argv[2], "w");
if (!out) goto out_err;
if (fprintf(out, bc_gen_header, argv[1]) < 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;
c = count = slashes = 0;
while (slashes < 2 && (c = fgetc(in)) >= 0) {
slashes += (slashes == 1 && c == '/' && fgetc(in) == '\n');
slashes += (!slashes && c == '/' && fgetc(in) == '*');
}
if (c < 0) {
err = INVALID_INPUT_FILE;
goto err;
}
while ((c = fgetc(in)) == '\n');
while (c >= 0) {
int val;
if (!remove_tabs || c != '\t') {
if (!count && fputc('\t', out) == EOF) goto err;
val = fprintf(out, "%d,", c);
if (val < 0) goto err;
count += val;
if (count > MAX_WIDTH) {
count = 0;
if (fputc('\n', out) == EOF) goto err;
}
}
c = fgetc(in);
}
if (!count && (fputc(' ', out) == EOF || fputc(' ', out) == EOF)) goto err;
if (fprintf(out, "0\n};\n") < 0) goto err;
err = (has_define && fprintf(out, bc_gen_endif, define) < 0);
err:
fclose(out);
out_err:
fclose(in);
return err;
}

View file

@ -1,8 +1,8 @@
#! /bin/sh
#
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
# SPDX-License-Identifier: BSD-2-Clause
#
# All rights reserved.
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:

View file

@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:

View file

@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -130,13 +130,13 @@ void bc_lex_token(BcLex *l);
#define BC_PARSE_LEAF(prev, bin_last, rparen) \
(!(bin_last) && ((rparen) || bc_parse_inst_isLeaf(prev)))
#if BC_ENABLE_EXTRA_MATH
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
#define BC_PARSE_INST_VAR(t) \
((t) >= BC_INST_VAR && (t) <= BC_INST_SEED && (t) != BC_INST_ARRAY)
#else // BC_ENABLE_EXTRA_MATH
#else // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
#define BC_PARSE_INST_VAR(t) \
((t) >= BC_INST_VAR && (t) <= BC_INST_SCALE && (t) != BC_INST_ARRAY)
#endif // BC_ENABLE_EXTRA_MATH
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
#define BC_PARSE_PREV_PREFIX(p) \
((p) >= BC_INST_NEG && (p) <= BC_INST_BOOL_NOT)

View file

@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -36,10 +36,6 @@
#ifndef BC_DC_H
#define BC_DC_H
#ifndef DC_ENABLE_RAND
#define DC_ENABLE_RAND (1)
#endif // DC_ENABLE_RAND
#if DC_ENABLED
#include <status.h>

View file

@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:

View file

@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -47,8 +47,6 @@
* Copyright (c) 2010-2016, Salvatore Sanfilippo <antirez at gmail dot com>
* Copyright (c) 2010-2013, Pieter Noordhuis <pcnoordhuis at gmail dot com>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:

View file

@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -129,6 +129,7 @@ typedef enum BcInst {
BC_INST_ARRAY,
#endif // BC_ENABLED
BC_INST_ZERO,
BC_INST_ONE,
#if BC_ENABLED
@ -137,26 +138,26 @@ typedef enum BcInst {
BC_INST_IBASE,
BC_INST_OBASE,
BC_INST_SCALE,
#if BC_ENABLE_EXTRA_MATH
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_SEED,
#endif // BC_ENABLE_EXTRA_MATH
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_LENGTH,
BC_INST_SCALE_FUNC,
BC_INST_SQRT,
BC_INST_ABS,
#if BC_ENABLE_EXTRA_MATH
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_IRAND,
#endif // BC_ENABLE_EXTRA_MATH
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_READ,
#if BC_ENABLE_EXTRA_MATH
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_RAND,
#endif // BC_ENABLE_EXTRA_MATH
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_MAXIBASE,
BC_INST_MAXOBASE,
BC_INST_MAXSCALE,
#if BC_ENABLE_EXTRA_MATH
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_MAXRAND,
#endif // BC_ENABLE_EXTRA_MATH
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_PRINT,
BC_INST_PRINT_POP,
@ -252,9 +253,9 @@ typedef enum BcResultType {
BC_RESULT_STR,
BC_RESULT_CONSTANT,
BC_RESULT_TEMP,
BC_RESULT_ZERO,
BC_RESULT_ONE,
#if BC_ENABLED

View file

@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -46,8 +46,23 @@
#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
#if DC_ENABLED
#define BC_LEX_NEG_CHAR (BC_IS_BC ? '-' : '_')
#define BC_LEX_LAST_NUM_CHAR (BC_IS_BC ? 'Z' : 'F')
#else // DC_ENABLED
#define BC_LEX_NEG_CHAR ('-')
#define BC_LEX_LAST_NUM_CHAR ('Z')
#endif // DC_ENABLED
#else // BC_ENABLED
#define BC_LEX_NEG_CHAR ('_')
#define BC_LEX_LAST_NUM_CHAR ('F')
#endif // BC_ENABLED
#define BC_LEX_NUM_CHAR(c, pt, int_only) \
(isdigit(c) || ((c) >= 'A' && (c) <= BC_LEX_LAST_NUM_CHAR) || \
((c) == '.' && !(pt) && !(int_only)))
@ -142,27 +157,27 @@ typedef enum BcLexType {
BC_LEX_KW_IBASE,
BC_LEX_KW_OBASE,
BC_LEX_KW_SCALE,
#if BC_ENABLE_EXTRA_MATH
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_LEX_KW_SEED,
#endif // BC_ENABLE_EXTRA_MATH
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_LEX_KW_LENGTH,
BC_LEX_KW_PRINT,
BC_LEX_KW_SQRT,
BC_LEX_KW_ABS,
#if BC_ENABLE_EXTRA_MATH
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_LEX_KW_IRAND,
#endif // BC_ENABLE_EXTRA_MATH
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_LEX_KW_QUIT,
BC_LEX_KW_READ,
#if BC_ENABLE_EXTRA_MATH
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_LEX_KW_RAND,
#endif // BC_ENABLE_EXTRA_MATH
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_LEX_KW_MAXIBASE,
BC_LEX_KW_MAXOBASE,
BC_LEX_KW_MAXSCALE,
#if BC_ENABLE_EXTRA_MATH
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_LEX_KW_MAXRAND,
#endif // BC_ENABLE_EXTRA_MATH
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_LEX_KW_ELSE,
#if DC_ENABLED

View file

@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -110,8 +110,16 @@ typedef struct BcNum {
} BcNum;
#if BC_ENABLE_EXTRA_MATH
#ifndef BC_ENABLE_RAND
#define BC_ENABLE_RAND (1)
#endif // BC_ENABLE_RAND
#if BC_ENABLE_RAND
// Forward declaration
struct BcRNG;
#endif // BC_ENABLE_RAND
#endif // BC_ENABLE_EXTRA_MATH
#define BC_NUM_MIN_BASE (BC_NUM_BIGDIG_C(2))
@ -173,12 +181,12 @@ void bc_num_bigdig(const BcNum *restrict n, BcBigDig *result);
void bc_num_bigdig2(const BcNum *restrict n, BcBigDig *result);
void bc_num_bigdig2num(BcNum *restrict n, BcBigDig val);
#if BC_ENABLE_EXTRA_MATH
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
void bc_num_irand(const BcNum *restrict a, BcNum *restrict b,
struct BcRNG *restrict rng);
void bc_num_rng(const BcNum *restrict n, struct BcRNG *rng);
void bc_num_createFromRNG(BcNum *restrict n, struct BcRNG *rng);
#endif // BC_ENABLE_EXTRA_MATH
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
void bc_num_add(BcNum *a, BcNum *b, BcNum *c, size_t scale);
void bc_num_sub(BcNum *a, BcNum *b, BcNum *c, size_t scale);

View file

@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:

View file

@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -110,6 +110,7 @@ void bc_parse_updateFunc(BcParse *p, size_t fidx);
void bc_parse_pushName(const BcParse* p, char *name, bool var);
void bc_parse_text(BcParse *p, const char *text);
extern const char bc_parse_zero[];
extern const char bc_parse_one[];
#endif // BC_PARSE_H

View file

@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -61,9 +61,9 @@ typedef struct BcProgram {
BcBigDig globals[BC_PROG_GLOBALS_LEN];
BcVec globals_v[BC_PROG_GLOBALS_LEN];
#if BC_ENABLE_EXTRA_MATH
#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BcRNG rng;
#endif // BC_ENABLE_EXTRA_MATH
#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BcVec results;
BcVec stack;
@ -81,12 +81,15 @@ typedef struct BcProgram {
BcVec arr_map;
#if DC_ENABLED
BcVec strs_v;
BcVec tail_calls;
BcBigDig strm;
BcNum strmb;
#endif // DC_ENABLED
BcNum zero;
BcNum one;
#if BC_ENABLED
@ -99,6 +102,7 @@ typedef struct BcProgram {
BcDig strmb_num[BC_NUM_BIGDIG_LOG10];
#endif // DC_ENABLED
BcDig zero_num[BC_PROG_ONE_CAP];
BcDig one_num[BC_PROG_ONE_CAP];
} BcProgram;

View file

@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
* Copyright (c) 2018-2019 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2019 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -69,14 +69,16 @@
#ifndef BC_RAND_H
#define BC_RAND_H
#if BC_ENABLE_EXTRA_MATH
#include <stdint.h>
#include <inttypes.h>
#include <vector.h>
#include <num.h>
#if BC_ENABLE_EXTRA_MATH
#if BC_ENABLE_RAND
typedef ulong (*BcRandUlong)(void*);
#if BC_LONG_BIT >= 64
@ -224,6 +226,8 @@ void bc_rand_getRands(BcRNG *r, BcRand *s1, BcRand *s2, BcRand *i1, BcRand *i2);
extern const BcRandState bc_rand_multiplier;
#endif // BC_ENABLE_RAND
#endif // BC_ENABLE_EXTRA_MATH
#endif // BC_RAND_H

View file

@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -33,8 +33,8 @@
*
*/
#ifndef BC_IO_H
#define BC_IO_H
#ifndef BC_READ_H
#define BC_READ_H
#include <stdlib.h>
@ -55,5 +55,6 @@
BcStatus bc_read_line(BcVec *vec, const char *prompt);
void bc_read_file(const char *path, char **buf);
BcStatus bc_read_chars(BcVec *vec, const char *prompt);
bool bc_read_buf(BcVec *vec, char *buf, size_t *buf_len);
#endif // BC_IO_H
#endif // BC_READ_H

View file

@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:

View file

@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:

View file

@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
* SPDX-License-Identifier: BSD-2-Clause
*
* All rights reserved.
* Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@ -91,28 +91,64 @@
#define isatty _isatty
#endif // _WIN32
#if DC_ENABLED
#define DC_FLAG_X (UINTMAX_C(1)<<0)
#endif // DC_ENABLED
#if BC_ENABLED
#define BC_FLAG_W (UINTMAX_C(1)<<1)
#define BC_FLAG_S (UINTMAX_C(1)<<2)
#define BC_FLAG_Q (UINTMAX_C(1)<<3)
#define BC_FLAG_L (UINTMAX_C(1)<<4)
#define BC_FLAG_I (UINTMAX_C(1)<<5)
#define BC_FLAG_G (UINTMAX_C(1)<<6)
#define BC_FLAG_L (UINTMAX_C(1)<<3)
#define BC_FLAG_G (UINTMAX_C(1)<<4)
#endif // BC_ENABLED
#define BC_FLAG_Q (UINTMAX_C(1)<<5)
#define BC_FLAG_I (UINTMAX_C(1)<<6)
#define BC_FLAG_P (UINTMAX_C(1)<<7)
#define BC_FLAG_TTYIN (UINTMAX_C(1)<<8)
#define BC_FLAG_TTY (UINTMAX_C(1)<<9)
#define BC_TTYIN (vm.flags & BC_FLAG_TTYIN)
#define BC_TTY (vm.flags & BC_FLAG_TTY)
#if BC_ENABLED
#define BC_S (BC_ENABLED && (vm.flags & BC_FLAG_S))
#define BC_W (BC_ENABLED && (vm.flags & BC_FLAG_W))
#define BC_L (BC_ENABLED && (vm.flags & BC_FLAG_L))
#define BC_I (vm.flags & BC_FLAG_I)
#define BC_G (BC_ENABLED && (vm.flags & BC_FLAG_G))
#define DC_X (DC_ENABLED && (vm.flags & DC_FLAG_X))
#endif // BC_ENABLED
#if DC_ENABLED
#define DC_X (vm.flags & DC_FLAG_X)
#endif // DC_ENABLED
#define BC_I (vm.flags & BC_FLAG_I)
#define BC_P (vm.flags & BC_FLAG_P)
#if BC_ENABLED
#define BC_IS_POSIX (BC_S || BC_W)
#if DC_ENABLED
#define BC_IS_BC (vm.name[0] != 'd')
#define BC_IS_DC (vm.name[0] == 'd')
#else // DC_ENABLED
#define BC_IS_BC (1)
#define BC_IS_DC (0)
#endif // DC_ENABLED
#else // BC_ENABLED
#define BC_IS_POSIX (0)
#define BC_IS_BC (0)
#define BC_IS_DC (1)
#endif // BC_ENABLED
#if BC_ENABLED
#define BC_USE_PROMPT (!BC_P && BC_TTY && !BC_IS_POSIX)
#else // BC_ENABLED
#define BC_USE_PROMPT (!BC_P && BC_TTY)
#endif // BC_ENABLED
#define BC_MAX(a, b) ((a) > (b) ? (a) : (b))
#define BC_MIN(a, b) ((a) < (b) ? (a) : (b))
@ -131,9 +167,6 @@
#define BC_MAX_EXP ((ulong) (BC_NUM_BIGDIG_MAX))
#define BC_MAX_VARS ((ulong) (SIZE_MAX - 1))
#define BC_IS_BC (BC_ENABLED && (!DC_ENABLED || vm.name[0] != 'd'))
#define BC_IS_POSIX (BC_S || BC_W)
#if BC_DEBUG_CODE
#define BC_VM_JMP bc_vm_jmp(__func__)
#else // BC_DEBUG_CODE
@ -234,7 +267,9 @@
#define BC_VM_BUF_SIZE (1<<12)
#define BC_VM_STDOUT_BUF_SIZE (1<<11)
#define BC_VM_STDERR_BUF_SIZE (1<<10)
#define BC_VM_STDIN_BUF_SIZE BC_VM_STDERR_BUF_SIZE
#define BC_VM_STDIN_BUF_SIZE (BC_VM_STDERR_BUF_SIZE - 1)
#define BC_VM_SAFE_RESULT(r) ((r)->t >= BC_RESULT_TEMP)
#define bc_vm_err(e) (bc_vm_error((e), 0))
#define bc_vm_verr(e, ...) (bc_vm_error((e), 0, __VA_ARGS__))

63
contrib/bc/install.sh Executable file
View file

@ -0,0 +1,63 @@
#! /bin/sh
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
usage() {
printf "usage: %s install_dir exec_suffix\n" "$0" 1>&2
exit 1
}
script="$0"
scriptdir=$(dirname "$script")
. "$scriptdir/functions.sh"
INSTALL="$scriptdir/safe-install.sh"
test "$#" -ge 2 || usage
installdir="$1"
shift
exec_suffix="$1"
shift
bindir="$scriptdir/bin"
for exe in $bindir/*; do
base=$(basename "$exe")
if [ -L "$exe" ]; then
link=$(readlink "$exe")
"$INSTALL" -Dlm 755 "$link$exec_suffix" "$installdir/$base$exec_suffix"
else
"$INSTALL" -Dm 755 "$exe" "$installdir/$base$exec_suffix"
fi
done

232
contrib/bc/karatsuba.py Executable file
View file

@ -0,0 +1,232 @@
#! /usr/bin/python3 -B
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
import os
import sys
import subprocess
import time
def usage():
print("usage: {} [num_iterations test_num exe]".format(script))
print("\n num_iterations is the number of times to run each karatsuba number; default is 4")
print("\n test_num is the last Karatsuba number to run through tests")
sys.exit(1)
def run(cmd, env=None):
return subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
script = sys.argv[0]
testdir = os.path.dirname(script)
if testdir == "":
testdir = os.getcwd()
print("\nWARNING: This script is for distro and package maintainers.")
print("It is for finding the optimal Karatsuba number.")
print("Though it only needs to be run once per release/platform,")
print("it takes forever to run.")
print("You have been warned.\n")
print("Note: If you send an interrupt, it will report the current best number.\n")
if __name__ != "__main__":
usage()
mx = 520
mx2 = mx // 2
mn = 16
num = "9" * mx
args_idx = 4
if len(sys.argv) >= 2:
num_iterations = int(sys.argv[1])
else:
num_iterations = 4
if len(sys.argv) >= 3:
test_num = int(sys.argv[2])
else:
test_num = 0
if len(sys.argv) >= args_idx:
exe = sys.argv[3]
else:
exe = testdir + "/bin/bc"
exedir = os.path.dirname(exe)
indata = "for (i = 0; i < 100; ++i) {} * {}\n"
indata += "1.23456789^100000\n1.23456789^100000\nhalt"
indata = indata.format(num, num).encode()
times = []
nums = []
runs = []
nruns = num_iterations + 1
for i in range(0, nruns):
runs.append(0)
tests = [ "multiply", "modulus", "power", "sqrt" ]
scripts = [ "multiply" ]
print("Testing CFLAGS=\"-flto\"...")
flags = dict(os.environ)
try:
flags["CFLAGS"] = flags["CFLAGS"] + " " + "-flto"
except KeyError:
flags["CFLAGS"] = "-flto"
p = run([ "./configure.sh", "-O3" ], flags)
if p.returncode != 0:
print("configure.sh returned an error ({}); exiting...".format(p.returncode))
sys.exit(p.returncode)
p = run([ "make" ])
if p.returncode == 0:
config_env = flags
print("Using CFLAGS=\"-flto\"")
else:
config_env = os.environ
print("Not using CFLAGS=\"-flto\"")
p = run([ "make", "clean" ])
print("Testing \"make -j4\"")
if p.returncode != 0:
print("make returned an error ({}); exiting...".format(p.returncode))
sys.exit(p.returncode)
p = run([ "make", "-j4" ])
if p.returncode == 0:
makecmd = [ "make", "-j4" ]
print("Using \"make -j4\"")
else:
makecmd = [ "make" ]
print("Not using \"make -j4\"")
if test_num != 0:
mx2 = test_num
try:
for i in range(mn, mx2 + 1):
print("\nCompiling...\n")
p = run([ "./configure.sh", "-O3", "-k{}".format(i) ], config_env)
if p.returncode != 0:
print("configure.sh returned an error ({}); exiting...".format(p.returncode))
sys.exit(p.returncode)
p = run(makecmd)
if p.returncode != 0:
print("make returned an error ({}); exiting...".format(p.returncode))
sys.exit(p.returncode)
if (test_num >= i):
print("Running tests for Karatsuba Num: {}\n".format(i))
for test in tests:
cmd = [ "{}/tests/test.sh".format(testdir), "bc", test, "0", "0", exe ]
p = subprocess.run(cmd + sys.argv[args_idx:], stderr=subprocess.PIPE)
if p.returncode != 0:
print("{} test failed:\n".format(test, p.returncode))
print(p.stderr.decode())
print("\nexiting...")
sys.exit(p.returncode)
print("")
for script in scripts:
cmd = [ "{}/tests/script.sh".format(testdir), "bc", script + ".bc",
"0", "1", "1", "0", exe ]
p = subprocess.run(cmd + sys.argv[args_idx:], stderr=subprocess.PIPE)
if p.returncode != 0:
print("{} test failed:\n".format(test, p.returncode))
print(p.stderr.decode())
print("\nexiting...")
sys.exit(p.returncode)
print("")
elif test_num == 0:
print("Timing Karatsuba Num: {}".format(i), end='', flush=True)
for j in range(0, nruns):
cmd = [ exe, "{}/tests/bc/power.txt".format(testdir) ]
start = time.perf_counter()
p = subprocess.run(cmd, input=indata, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
end = time.perf_counter()
if p.returncode != 0:
print("bc returned an error; exiting...")
sys.exit(p.returncode)
runs[j] = end - start
run_times = runs[1:]
avg = sum(run_times) / len(run_times)
times.append(avg)
nums.append(i)
print(", Time: {}".format(times[i - mn]))
except KeyboardInterrupt:
nums = nums[0:i]
times = times[0:i]
if test_num == 0:
opt = nums[times.index(min(times))]
print("\n\nOptimal Karatsuba Num (for this machine): {}".format(opt))
print("Run the following:\n")
if "-flto" in config_env["CFLAGS"]:
print("CFLAGS=\"-flto\" ./configure.sh -O3 -k {}".format(opt))
else:
print("./configure.sh -O3 -k {}".format(opt))
print("make")

60
contrib/bc/link.sh Executable file
View file

@ -0,0 +1,60 @@
#! /bin/sh
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
usage() {
printf "usage: %s bin_dir link\n" "$0" 1>&2
exit 1
}
test "$#" -gt 1 || usage
bindir="$1"
shift
link="$1"
shift
for exe in "$bindir"/*; do
if [ ! -L "$exe" ]; then
base=$(basename "$exe")
ext="${base##*.}"
if [ "$ext" != "$base" ]; then
name="$link.$ext"
else
name="$link"
fi
ln -fs "$base" "$bindir/$name"
fi
done

230
contrib/bc/locale_install.sh Executable file
View file

@ -0,0 +1,230 @@
#! /bin/sh
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
usage() {
printf "usage: %s NLSPATH main_exec [DESTDIR]\n" "$0" 1>&2
exit 1
}
gencatfile() {
_gencatfile_loc="$1"
shift
_gencatfile_file="$1"
shift
mkdir -p $(dirname "$_gencatfile_loc")
gencat "$_gencatfile_loc" "$_gencatfile_file" > /dev/null 2>&1
}
localeexists() {
_localeexists_locales="$1"
shift
_localeexists_locale="$1"
shift
_localeexists_destdir="$1"
shift
if [ "$_localeexists_destdir" != "" ]; then
_localeexists_char="@"
_localeexists_locale="${_localeexists_locale%%_localeexists_char*}"
_localeexists_char="."
_localeexists_locale="${_localeexists_locale##*$_localeexists_char}"
fi
test ! -z "${_localeexists_locales##*$_localeexists_locale*}"
return $?
}
splitpath() {
_splitpath_path="$1"
shift
if [ "$_splitpath_path" = "${_splitpath_path#/}" ]; then
printf 'Must use absolute paths\n'
exit 1
fi
if [ "${_splitpath_path#\n*}" != "$_splitpath_path" ]; then
exit 1
fi
_splitpath_list=""
_splitpath_item=""
while [ "$_splitpath_path" != "/" ]; do
_splitpath_item=$(basename "$_splitpath_path")
_splitpath_list=$(printf '\n%s%s' "$_splitpath_item" "$_splitpath_list")
_splitpath_path=$(dirname "$_splitpath_path")
done
if [ "$_splitpath_list" != "/" ]; then
_splitpath_list="${_splitpath_list#?}"
fi
printf '%s' "$_splitpath_list"
}
relpath() {
_relpath_path1="$1"
shift
_relpath_path2="$1"
shift
_relpath_nl=$(printf '\nx')
_relpath_nl="${_relpath_nl%x}"
_relpath_splitpath1=`splitpath "$_relpath_path1"`
_relpath_splitpath2=`splitpath "$_relpath_path2"`
_relpath_path=""
_relpath_temp1="$_relpath_splitpath1"
IFS="$_relpath_nl"
for _relpath_part in $_relpath_temp1; do
_relpath_temp2="${_relpath_splitpath2#$_relpath_part$_relpath_nl}"
if [ "$_relpath_temp2" = "$_relpath_splitpath2" ]; then
break
fi
_relpath_splitpath2="$_relpath_temp2"
_relpath_splitpath1="${_relpath_splitpath1#$_relpath_part$_relpath_nl}"
done
for _relpath_part in $_relpath_splitpath2; do
_relpath_path="../$_relpath_path"
done
_relpath_path="${_relpath_path%../}"
for _relpath_part in $_relpath_splitpath1; do
_relpath_path="$_relpath_path$_relpath_part/"
done
_relpath_path="${_relpath_path%/}"
unset IFS
printf '%s\n' "$_relpath_path"
}
script="$0"
scriptdir=$(dirname "$script")
. "$scriptdir/functions.sh"
test "$#" -ge 2 || usage
nlspath="$1"
shift
main_exec="$1"
shift
if [ "$#" -ge 1 ]; then
destdir="$1"
shift
else
destdir=""
fi
"$scriptdir/locale_uninstall.sh" "$nlspath" "$main_exec" "$destdir"
locales_dir="$scriptdir/locales"
# What this does is if installing to a package, it installs all locales that
# match supported charsets instead of installing all directly supported locales.
if [ "$destdir" = "" ]; then
locales=$(locale -a)
else
locales=$(locale -m)
fi
for file in $locales_dir/*.msg; do
locale=$(basename "$file" ".msg")
loc=$(gen_nlspath "$destdir/$nlspath" "$locale" "$main_exec")
localeexists "$locales" "$locale" "$destdir"
err="$?"
if [ "$err" -eq 0 ]; then
continue
fi
if [ -L "$file" ]; then
continue
fi
gencatfile "$loc" "$file"
done
for file in $locales_dir/*.msg; do
locale=$(basename "$file" ".msg")
loc=$(gen_nlspath "$destdir/$nlspath" "$locale" "$main_exec")
localeexists "$locales" "$locale" "$destdir"
err="$?"
if [ "$err" -eq 0 ]; then
continue
fi
mkdir -p $(dirname "$loc")
if [ -L "$file" ]; then
link=$(readlink "$file")
linkdir=$(dirname "$file")
locale=$(basename "$link" .msg)
linksrc=$(gen_nlspath "$nlspath" "$locale" "$main_exec")
relloc="${loc##$destdir/}"
rel=$(relpath "$linksrc" "$relloc")
if [ ! -f "$destdir/$linksrc" ]; then
gencatfile "$destdir/$linksrc" "$linkdir/$link"
fi
ln -fs "$rel" "$loc"
fi
done

65
contrib/bc/locale_uninstall.sh Executable file
View file

@ -0,0 +1,65 @@
#! /bin/sh
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2018-2020 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
usage() {
printf "usage: %s NLSPATH main_exec [DESTDIR]\n" "$0" 1>&2
exit 1
}
script="$0"
scriptdir=$(dirname "$script")
. "$scriptdir/functions.sh"
INSTALL="$scriptdir/safe-install.sh"
test "$#" -ge 2 || usage
nlspath="$1"
shift
main_exec="$1"
shift
if [ "$#" -ge 1 ]; then
destdir="$1"
shift
else
destdir=""
fi
# I do something clever here. I am replacing the locale spot with
# a wildcard, which should make it search all locale directories.
# This way, we can delete catalogs for locales that we had to install
# because they are symlinks.
locales=$(gen_nlspath "$destdir/$nlspath" "*" "$main_exec")
for l in $locales; do
rm -f "$l"
done

View file

@ -0,0 +1 @@
de_DE.ISO8859-1.msg

View file

@ -0,0 +1 @@
de_DE.ISO8859-1.msg

View file

@ -0,0 +1 @@
de_DE.UTF-8.msg

View file

@ -0,0 +1 @@
de_AT.UTF-8.msg

View file

@ -0,0 +1 @@
de_DE.ISO8859-1.msg

View file

@ -0,0 +1 @@
de_DE.ISO8859-1.msg

View file

@ -0,0 +1 @@
de_DE.UTF-8.msg

View file

@ -0,0 +1 @@
de_CH.UTF-8.msg

View file

@ -1,3 +1,31 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
$ $
$ * Redistributions of source code must retain the above copyright notice, this
$ list of conditions and the following disclaimer.
$ $
$ * Redistributions in binary form must reproduce the above copyright notice,
$ this list of conditions and the following disclaimer in the documentation
$ and/or other materials provided with the distribution.
$ $
$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
$ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
$ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
$ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
$ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
$ POSSIBILITY OF SUCH DAMAGE.
$ $
$quote "
$ Headers for printing errors/warnings.

View file

@ -0,0 +1 @@
de_DE.ISO8859-1.msg

View file

@ -1,3 +1,31 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
$ $
$ * Redistributions of source code must retain the above copyright notice, this
$ list of conditions and the following disclaimer.
$ $
$ * Redistributions in binary form must reproduce the above copyright notice,
$ this list of conditions and the following disclaimer in the documentation
$ and/or other materials provided with the distribution.
$ $
$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
$ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
$ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
$ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
$ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
$ POSSIBILITY OF SUCH DAMAGE.
$ $
$quote "
$ Headers for printing errors/warnings.

View file

@ -0,0 +1 @@
de_DE.UTF-8.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_AU.UTF-8.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_CA.UTF-8.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_GB.UTF-8.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_IE.UTF-8.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_NZ.UTF-8.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -0,0 +1 @@
en_US.msg

View file

@ -1,8 +1,8 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
$ $
$ All rights reserved.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
$ $

View file

@ -0,0 +1 @@
en_US.UTF-8.msg

View file

@ -0,0 +1,108 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
$ $
$ * Redistributions of source code must retain the above copyright notice, this
$ list of conditions and the following disclaimer.
$ $
$ * Redistributions in binary form must reproduce the above copyright notice,
$ this list of conditions and the following disclaimer in the documentation
$ and/or other materials provided with the distribution.
$ $
$ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
$ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
$ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
$ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
$ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
$ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
$ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
$ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
$ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
$ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
$ POSSIBILITY OF SUCH DAMAGE.
$ $
$quote "
$ Miscellaneous messages.
$set 1
1 "Función:"
$ Error types.
$set 2
1 "Error de matemática:"
2 "Error de syntaxis:"
3 "Error de ejecución:"
4 "Error fatal:"
5 "Advertencia:"
$ Math errors.
$set 3
1 "número negativo"
2 "número no es entero"
3 "desbordamiento de enteros: no se puede encajar el el hardware"
4 "división por cero"
$ Parse errors.
$set 4
1 "fin de archivo"
2 "no válido '%c'"
3 "no puede encontrar el fine de la cadena"
4 "no puede encontrar el fine del comentario"
5 "el token no es válido"
6 "la expresión no es válida"
7 "la expresión es vacía"
8 "la expresión de print no es válida"
9 "la definición de función no es válida"
10 "la asignación no es valida: en la izquierda debe ser scale, ibase, obase, last, var, o un elemento de matriz"
11 "no se encontró ninguna variable automática"
12 "ya hay un parámetro de función o variable automatica que se llama \"%s%s\""
13 "no se puede encontrar el final de del bloque de código"
14 "no puede haber un valor de retorno de una función \"void\": %s()"
15 "var no puede ser una referencia: %s"
16 "POSIX no permite nombres de más de 1 carácter: %s"
17 "POSIX no permite '#' script comentarios"
18 "POSIX no permite este palabra clave %s"
19 "POSIX no permite un punto ('.') como un atajo del resultado previoso"
20 "POSIX requieres paréntesis en el expresión del \"return\""
21 "POSIX no permite este operador: %s"
22 "POSIX no permite operadores de comparación aparte de \"if\" expresión o bucles"
23 "POSIX requiere 0 o 1 operadores de comparisón para cada condición"
24 "POSIX requiere todos 3 partes de una bucla que no esta vacío"
25 "POSIX no permite una notación exponencial"
26 "POSIX no permite una referencia a una matriz como un parámetro de función"
27 "POSIX requiere el llave de la izquierda que sea en la misma línea que los parámetros de la función"
$ Runtime errors.
$set 5
1 "\"ibase\" no es válido: debe ser [%lu, %lu]"
2 "\"obase\" no es válido: debe ser [%lu, %lu]"
3 "\"scale\" no es válido: debe ser [%lu, %lu]"
4 "read() expresión no es válido"
5 "recursion en la invocación de read()"
6 "variable o elemento del matriz de tipo equivocado"
7 "la pila no ha demaciado elementos"
8 "la función no tiene un número de argumentos correcto; necessita %zu, tiene %zu"
9 "la función no esta definida: %s()"
10 "no puede utilizar un valor vacío en una expresión"
$ Fatal errors.
$set 6
1 "error en la asignación de memoria"
2 "error de I/O"
3 "no puede abrir el archivo: %s"
4 "el archivo no es ASCII: %s"
5 "el ruta es un directorio: %s"
6 "una opción de línea de comandos no es válida: \"%s\""
7 "una opción requiere un argumento: '%c' (\"%s\")"
8 "una opción no tiene argumento: '%c' (\"%s\")"

View file

@ -0,0 +1 @@
es_ES.ISO8859-1.msg

View file

@ -1,8 +1,8 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
$ $
$ All rights reserved.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
$ $

View file

@ -0,0 +1 @@
es_ES.UTF-8.msg

View file

@ -0,0 +1 @@
fr_FR.ISO8859-1.msg

View file

@ -0,0 +1 @@
fr_FR.ISO8859-1.msg

View file

@ -0,0 +1 @@
fr_FR.UTF-8.msg

View file

@ -0,0 +1 @@
fr_BE.UTF-8.msg

View file

@ -0,0 +1 @@
fr_FR.ISO8859-1.msg

View file

@ -0,0 +1 @@
fr_FR.ISO8859-1.msg

View file

@ -0,0 +1 @@
fr_FR.UTF-8.msg

View file

@ -0,0 +1 @@
fr_CA.UTF-8.msg

View file

@ -0,0 +1 @@
fr_FR.ISO8859-1.msg

View file

@ -0,0 +1 @@
fr_FR.ISO8859-1.msg

View file

@ -0,0 +1 @@
fr_FR.UTF-8.msg

View file

@ -0,0 +1 @@
fr_CH.UTF-8.msg

View file

@ -1,8 +1,8 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
$ $
$ All rights reserved.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
$ $

View file

@ -0,0 +1 @@
fr_FR.ISO8859-1.msg

View file

@ -1,8 +1,8 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2020 Gavin D. Howard and contributors.
$ $
$ All rights reserved.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
$ $

View file

@ -0,0 +1 @@
fr_FR.UTF-8.msg

Some files were not shown because too many files have changed in this diff Show more