contrib/bc: merge version 5.1.0 from vendor branch
This version adds options and functions that allow to print numbers in the open interval (-1 .. 1) with or without a leading 0 digit. Additionally, an option has been added to prevent line wrap and allows to print arbitrarily long results on a single line. Merge commit '5d58a51571721190681c50d4bd3a1f45e6282d72'
This commit is contained in:
commit
d43fa8ef53
@ -280,17 +280,25 @@ help:
|
|||||||
@printf ' valgrind_dc runs the dc test suite, if dc has been built,\n'
|
@printf ' valgrind_dc runs the dc test suite, if dc has been built,\n'
|
||||||
@printf ' through valgrind\n'
|
@printf ' through valgrind\n'
|
||||||
|
|
||||||
run_all_tests: bc_all_tests timeconst_all_tests dc_all_tests history_all_tests
|
run_all_tests: bc_all_tests timeconst_all_tests dc_all_tests
|
||||||
|
|
||||||
|
run_all_tests_np: bc_all_tests_np timeconst_all_tests dc_all_tests_np
|
||||||
|
|
||||||
bc_all_tests:
|
bc_all_tests:
|
||||||
%%BC_ALL_TESTS%%
|
%%BC_ALL_TESTS%%
|
||||||
|
|
||||||
|
bc_all_tests_np:
|
||||||
|
%%BC_ALL_TESTS_NP%%
|
||||||
|
|
||||||
timeconst_all_tests:
|
timeconst_all_tests:
|
||||||
%%TIMECONST_ALL_TESTS%%
|
%%TIMECONST_ALL_TESTS%%
|
||||||
|
|
||||||
dc_all_tests:
|
dc_all_tests:
|
||||||
%%DC_ALL_TESTS%%
|
%%DC_ALL_TESTS%%
|
||||||
|
|
||||||
|
dc_all_tests_np:
|
||||||
|
%%DC_ALL_TESTS_NP%%
|
||||||
|
|
||||||
history_all_tests:
|
history_all_tests:
|
||||||
%%HISTORY_TESTS%%
|
%%HISTORY_TESTS%%
|
||||||
|
|
||||||
@ -311,7 +319,9 @@ test_bc_stdin:
|
|||||||
test_bc_read:
|
test_bc_read:
|
||||||
@sh tests/read.sh bc %%BC_TEST_EXEC%%
|
@sh tests/read.sh bc %%BC_TEST_EXEC%%
|
||||||
|
|
||||||
test_bc_errors:
|
test_bc_errors: test_bc_error_lines%%BC_ERROR_TESTS%%
|
||||||
|
|
||||||
|
test_bc_error_lines:
|
||||||
@sh tests/errors.sh bc %%BC_TEST_EXEC%%
|
@sh tests/errors.sh bc %%BC_TEST_EXEC%%
|
||||||
|
|
||||||
test_bc_other:
|
test_bc_other:
|
||||||
@ -333,7 +343,9 @@ test_dc_stdin:
|
|||||||
test_dc_read:
|
test_dc_read:
|
||||||
@sh tests/read.sh dc %%DC_TEST_EXEC%%
|
@sh tests/read.sh dc %%DC_TEST_EXEC%%
|
||||||
|
|
||||||
test_dc_errors:
|
test_dc_errors: test_dc_error_lines%%DC_ERROR_TESTS%%
|
||||||
|
|
||||||
|
test_dc_error_lines:
|
||||||
@sh tests/errors.sh dc %%DC_TEST_EXEC%%
|
@sh tests/errors.sh dc %%DC_TEST_EXEC%%
|
||||||
|
|
||||||
test_dc_other:
|
test_dc_other:
|
||||||
|
@ -1,5 +1,23 @@
|
|||||||
# News
|
# News
|
||||||
|
|
||||||
|
## 5.1.0
|
||||||
|
|
||||||
|
This is a production release with some fixes and new features.
|
||||||
|
|
||||||
|
* Fixed a bug where an `if` statement without an `else` before defining a
|
||||||
|
function caused an error.
|
||||||
|
* Fixed a bug with the `bc` banner and `-q`.
|
||||||
|
* Fixed a bug on Windows where files were not read correctly.
|
||||||
|
* Added a command-line flag (`-z`) to make `bc` and `dc` print leading zeroes on
|
||||||
|
numbers `-1 < x < 1`.
|
||||||
|
* Added four functions to `lib2.bc` (`plz()`, `plznl()`, `pnlz()`, and
|
||||||
|
`pnlznl()`) to allow printing numbers with or without leading zeros, despite
|
||||||
|
the use of `-z` or not.
|
||||||
|
* Added builtin functions to query global state like line length, global stacks,
|
||||||
|
and leading zeroes.
|
||||||
|
* Added a command-line flag (`-L`) to disable wrapping when printing numbers.
|
||||||
|
* Improved builds on Windows.
|
||||||
|
|
||||||
## 5.0.2
|
## 5.0.2
|
||||||
|
|
||||||
This is a production release with one fix for a flaky test. If you have not
|
This is a production release with one fix for a flaky test. If you have not
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio Version 16
|
|
||||||
VisualStudioVersion = 16.0.31129.286
|
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bcl", "bcl.vcxproj", "{D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|x64 = Debug|x64
|
|
||||||
Debug|x86 = Debug|x86
|
|
||||||
Release|x64 = Release|x64
|
|
||||||
Release|x86 = Release|x86
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}.Debug|x86.ActiveCfg = Debug|Win32
|
|
||||||
{D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}.Debug|x86.Build.0 = Debug|Win32
|
|
||||||
{D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}.Release|x64.Build.0 = Release|x64
|
|
||||||
{D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}.Release|x86.ActiveCfg = Release|Win32
|
|
||||||
{D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}.Release|x86.Build.0 = Release|Win32
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
SolutionGuid = {591735E0-C314-4BFF-A595-E9999B49CB25}
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
@ -446,35 +446,35 @@ gen_file_list() {
|
|||||||
# @param extra_math An integer that, if non-zero, activates extra math tests.
|
# @param extra_math An integer that, if non-zero, activates extra math tests.
|
||||||
# @param time_tests An integer that, if non-zero, tells the test suite to time
|
# @param time_tests An integer that, if non-zero, tells the test suite to time
|
||||||
# the execution of each test.
|
# the execution of each test.
|
||||||
gen_tests() {
|
gen_std_tests() {
|
||||||
|
|
||||||
_gen_tests_name="$1"
|
_gen_std_tests_name="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
_gen_tests_extra_math="$1"
|
_gen_std_tests_extra_math="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
_gen_tests_time_tests="$1"
|
_gen_std_tests_time_tests="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
_gen_tests_extra_required=$(cat "$scriptdir/tests/extra_required.txt")
|
_gen_std_tests_extra_required=$(cat "$scriptdir/tests/extra_required.txt")
|
||||||
|
|
||||||
for _gen_tests_t in $(cat "$scriptdir/tests/$_gen_tests_name/all.txt"); do
|
for _gen_std_tests_t in $(cat "$scriptdir/tests/$_gen_std_tests_name/all.txt"); do
|
||||||
|
|
||||||
if [ "$_gen_tests_extra_math" -eq 0 ]; then
|
if [ "$_gen_std_tests_extra_math" -eq 0 ]; then
|
||||||
|
|
||||||
if [ -z "${_gen_tests_extra_required##*$_gen_tests_t*}" ]; then
|
if [ -z "${_gen_std_tests_extra_required##*$_gen_std_tests_t*}" ]; then
|
||||||
printf 'test_%s_%s:\n\t@printf "Skipping %s %s\\n"\n\n' \
|
printf 'test_%s_%s:\n\t@printf "Skipping %s %s\\n"\n\n' \
|
||||||
"$_gen_tests_name" "$_gen_tests_t" "$_gen_tests_name" \
|
"$_gen_std_tests_name" "$_gen_std_tests_t" "$_gen_std_tests_name" \
|
||||||
"$_gen_tests_t" >> "$scriptdir/Makefile"
|
"$_gen_std_tests_t" >> "$scriptdir/Makefile"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf 'test_%s_%s:\n\t@sh tests/test.sh %s %s %s %s %s\n\n' \
|
printf 'test_%s_%s:\n\t@sh tests/test.sh %s %s %s %s %s\n\n' \
|
||||||
"$_gen_tests_name" "$_gen_tests_t" "$_gen_tests_name" \
|
"$_gen_std_tests_name" "$_gen_std_tests_t" "$_gen_std_tests_name" \
|
||||||
"$_gen_tests_t" "$generate_tests" "$time_tests" \
|
"$_gen_std_tests_t" "$generate_tests" "$time_tests" \
|
||||||
"$*" >> "$scriptdir/Makefile"
|
"$*" >> "$scriptdir/Makefile"
|
||||||
|
|
||||||
done
|
done
|
||||||
@ -484,15 +484,55 @@ gen_tests() {
|
|||||||
# targets.
|
# targets.
|
||||||
#
|
#
|
||||||
# @param name The name of the calculator to generate test targets for.
|
# @param name The name of the calculator to generate test targets for.
|
||||||
gen_test_targets() {
|
gen_std_test_targets() {
|
||||||
|
|
||||||
_gen_test_targets_name="$1"
|
_gen_std_test_targets_name="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
_gen_test_targets_tests=$(cat "$scriptdir/tests/${_gen_test_targets_name}/all.txt")
|
_gen_std_test_targets_tests=$(cat "$scriptdir/tests/${_gen_std_test_targets_name}/all.txt")
|
||||||
|
|
||||||
for _gen_test_targets_t in $_gen_test_targets_tests; do
|
for _gen_std_test_targets_t in $_gen_std_test_targets_tests; do
|
||||||
printf ' test_%s_%s' "$_gen_test_targets_name" "$_gen_test_targets_t"
|
printf ' test_%s_%s' "$_gen_std_test_targets_name" "$_gen_std_test_targets_t"
|
||||||
|
done
|
||||||
|
|
||||||
|
printf '\n'
|
||||||
|
}
|
||||||
|
|
||||||
|
# Generates the proper test targets for each error test to have its own target.
|
||||||
|
# This allows `make test_bc_errors` and `make test_dc_errors` to run in
|
||||||
|
# parallel.
|
||||||
|
#
|
||||||
|
# @param name Which calculator to generate tests for.
|
||||||
|
gen_err_tests() {
|
||||||
|
|
||||||
|
_gen_err_tests_name="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
_gen_err_tests_fs=$(ls "$scriptdir/tests/$_gen_err_tests_name/errors/")
|
||||||
|
|
||||||
|
for _gen_err_tests_t in $_gen_err_tests_fs; do
|
||||||
|
|
||||||
|
printf 'test_%s_error_%s:\n\t@sh tests/error.sh %s %s %s\n\n' \
|
||||||
|
"$_gen_err_tests_name" "$_gen_err_tests_t" "$_gen_err_tests_name" \
|
||||||
|
"$_gen_err_tests_t" "$*" >> "$scriptdir/Makefile"
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Generates a list of error test targets that will be used as prerequisites for
|
||||||
|
# other targets.
|
||||||
|
#
|
||||||
|
# @param name The name of the calculator to generate test targets for.
|
||||||
|
gen_err_test_targets() {
|
||||||
|
|
||||||
|
_gen_err_test_targets_name="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
_gen_err_test_targets_tests=$(ls "$scriptdir/tests/$_gen_err_test_targets_name/errors/")
|
||||||
|
|
||||||
|
for _gen_err_test_targets_t in $_gen_err_test_targets_tests; do
|
||||||
|
printf ' test_%s_error_%s' "$_gen_err_test_targets_name" "$_gen_err_test_targets_t"
|
||||||
done
|
done
|
||||||
|
|
||||||
printf '\n'
|
printf '\n'
|
||||||
@ -904,10 +944,12 @@ link="@printf 'No link necessary\\\\n'"
|
|||||||
main_exec="BC"
|
main_exec="BC"
|
||||||
executable="BC_EXEC"
|
executable="BC_EXEC"
|
||||||
|
|
||||||
tests="test_bc timeconst test_dc test_history"
|
tests="test_bc timeconst test_dc"
|
||||||
|
|
||||||
bc_test="@tests/all.sh bc $extra_math 1 $generate_tests $time_tests \$(BC_EXEC)"
|
bc_test="@tests/all.sh bc $extra_math 1 $generate_tests $time_tests \$(BC_EXEC)"
|
||||||
|
bc_test_np="@tests/all.sh -n bc $extra_math 1 $generate_tests $time_tests \$(BC_EXEC)"
|
||||||
dc_test="@tests/all.sh dc $extra_math 1 $generate_tests $time_tests \$(DC_EXEC)"
|
dc_test="@tests/all.sh dc $extra_math 1 $generate_tests $time_tests \$(DC_EXEC)"
|
||||||
|
dc_test_np="@tests/all.sh -n dc $extra_math 1 $generate_tests $time_tests \$(DC_EXEC)"
|
||||||
|
|
||||||
timeconst="@tests/bc/timeconst.sh tests/bc/scripts/timeconst.bc \$(BC_EXEC)"
|
timeconst="@tests/bc/timeconst.sh tests/bc/scripts/timeconst.bc \$(BC_EXEC)"
|
||||||
|
|
||||||
@ -967,6 +1009,7 @@ elif [ "$bc_only" -eq 1 ]; then
|
|||||||
executables="bc"
|
executables="bc"
|
||||||
|
|
||||||
dc_test="@printf 'No dc tests to run\\\\n'"
|
dc_test="@printf 'No dc tests to run\\\\n'"
|
||||||
|
dc_test_np="@printf 'No dc tests to run\\\\n'"
|
||||||
test_dc_history_prereqs=" test_dc_history_skip"
|
test_dc_history_prereqs=" test_dc_history_skip"
|
||||||
|
|
||||||
install_prereqs=" install_execs"
|
install_prereqs=" install_execs"
|
||||||
@ -976,7 +1019,7 @@ elif [ "$bc_only" -eq 1 ]; then
|
|||||||
|
|
||||||
default_target="\$(BC_EXEC)"
|
default_target="\$(BC_EXEC)"
|
||||||
second_target="\$(DC_EXEC)"
|
second_target="\$(DC_EXEC)"
|
||||||
tests="test_bc timeconst test_history"
|
tests="test_bc timeconst"
|
||||||
|
|
||||||
elif [ "$dc_only" -eq 1 ]; then
|
elif [ "$dc_only" -eq 1 ]; then
|
||||||
|
|
||||||
@ -992,6 +1035,7 @@ elif [ "$dc_only" -eq 1 ]; then
|
|||||||
executable="DC_EXEC"
|
executable="DC_EXEC"
|
||||||
|
|
||||||
bc_test="@printf 'No bc tests to run\\\\n'"
|
bc_test="@printf 'No bc tests to run\\\\n'"
|
||||||
|
bc_test_np="@printf 'No bc tests to run\\\\n'"
|
||||||
test_bc_history_prereqs=" test_bc_history_skip"
|
test_bc_history_prereqs=" test_bc_history_skip"
|
||||||
|
|
||||||
timeconst="@printf 'timeconst cannot be run because bc is not built\\\\n'"
|
timeconst="@printf 'timeconst cannot be run because bc is not built\\\\n'"
|
||||||
@ -1001,7 +1045,7 @@ elif [ "$dc_only" -eq 1 ]; then
|
|||||||
uninstall_prereqs=" uninstall_dc"
|
uninstall_prereqs=" uninstall_dc"
|
||||||
uninstall_man_prereqs=" uninstall_dc_manpage"
|
uninstall_man_prereqs=" uninstall_dc_manpage"
|
||||||
|
|
||||||
tests="test_dc test_history"
|
tests="test_dc"
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@ -1392,10 +1436,12 @@ if [ "$dc_default_prompt" = "" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate the test targets and prerequisites.
|
# Generate the test targets and prerequisites.
|
||||||
bc_tests=$(gen_test_targets bc)
|
bc_tests=$(gen_std_test_targets bc)
|
||||||
bc_script_tests=$(gen_script_test_targets bc)
|
bc_script_tests=$(gen_script_test_targets bc)
|
||||||
dc_tests=$(gen_test_targets dc)
|
bc_err_tests=$(gen_err_test_targets bc)
|
||||||
|
dc_tests=$(gen_std_test_targets dc)
|
||||||
dc_script_tests=$(gen_script_test_targets dc)
|
dc_script_tests=$(gen_script_test_targets dc)
|
||||||
|
dc_err_tests=$(gen_err_test_targets dc)
|
||||||
|
|
||||||
# Print out the values; this is for debugging.
|
# Print out the values; this is for debugging.
|
||||||
if [ "$bc" -ne 0 ]; then
|
if [ "$bc" -ne 0 ]; then
|
||||||
@ -1483,14 +1529,18 @@ contents=$(replace "$contents" "BC_ENABLED" "$bc")
|
|||||||
contents=$(replace "$contents" "DC_ENABLED" "$dc")
|
contents=$(replace "$contents" "DC_ENABLED" "$dc")
|
||||||
|
|
||||||
contents=$(replace "$contents" "BC_ALL_TESTS" "$bc_test")
|
contents=$(replace "$contents" "BC_ALL_TESTS" "$bc_test")
|
||||||
|
contents=$(replace "$contents" "BC_ALL_TESTS_NP" "$bc_test_np")
|
||||||
contents=$(replace "$contents" "BC_TESTS" "$bc_tests")
|
contents=$(replace "$contents" "BC_TESTS" "$bc_tests")
|
||||||
contents=$(replace "$contents" "BC_SCRIPT_TESTS" "$bc_script_tests")
|
contents=$(replace "$contents" "BC_SCRIPT_TESTS" "$bc_script_tests")
|
||||||
|
contents=$(replace "$contents" "BC_ERROR_TESTS" "$bc_err_tests")
|
||||||
contents=$(replace "$contents" "BC_TEST_EXEC" "$bc_test_exec")
|
contents=$(replace "$contents" "BC_TEST_EXEC" "$bc_test_exec")
|
||||||
contents=$(replace "$contents" "TIMECONST_ALL_TESTS" "$timeconst")
|
contents=$(replace "$contents" "TIMECONST_ALL_TESTS" "$timeconst")
|
||||||
|
|
||||||
contents=$(replace "$contents" "DC_ALL_TESTS" "$dc_test")
|
contents=$(replace "$contents" "DC_ALL_TESTS" "$dc_test")
|
||||||
|
contents=$(replace "$contents" "DC_ALL_TESTS_NP" "$dc_test_np")
|
||||||
contents=$(replace "$contents" "DC_TESTS" "$dc_tests")
|
contents=$(replace "$contents" "DC_TESTS" "$dc_tests")
|
||||||
contents=$(replace "$contents" "DC_SCRIPT_TESTS" "$dc_script_tests")
|
contents=$(replace "$contents" "DC_SCRIPT_TESTS" "$dc_script_tests")
|
||||||
|
contents=$(replace "$contents" "DC_ERROR_TESTS" "$dc_err_tests")
|
||||||
contents=$(replace "$contents" "DC_TEST_EXEC" "$dc_test_exec")
|
contents=$(replace "$contents" "DC_TEST_EXEC" "$dc_test_exec")
|
||||||
|
|
||||||
contents=$(replace "$contents" "BUILD_TYPE" "$manpage_args")
|
contents=$(replace "$contents" "BUILD_TYPE" "$manpage_args")
|
||||||
@ -1551,9 +1601,7 @@ contents=$(replace "$contents" "MAIN_EXEC" "$main_exec")
|
|||||||
contents=$(replace "$contents" "EXEC" "$executable")
|
contents=$(replace "$contents" "EXEC" "$executable")
|
||||||
contents=$(replace "$contents" "TESTS" "$tests")
|
contents=$(replace "$contents" "TESTS" "$tests")
|
||||||
|
|
||||||
contents=$(replace "$contents" "BC_TEST" "$bc_test")
|
|
||||||
contents=$(replace "$contents" "BC_HISTORY_TEST_PREREQS" "$test_bc_history_prereqs")
|
contents=$(replace "$contents" "BC_HISTORY_TEST_PREREQS" "$test_bc_history_prereqs")
|
||||||
contents=$(replace "$contents" "DC_TEST" "$dc_test")
|
|
||||||
contents=$(replace "$contents" "DC_HISTORY_TEST_PREREQS" "$test_dc_history_prereqs")
|
contents=$(replace "$contents" "DC_HISTORY_TEST_PREREQS" "$test_dc_history_prereqs")
|
||||||
contents=$(replace "$contents" "HISTORY_TESTS" "$history_tests")
|
contents=$(replace "$contents" "HISTORY_TESTS" "$history_tests")
|
||||||
|
|
||||||
@ -1588,13 +1636,15 @@ printf '%s\n%s\n\n' "$contents" "$SRC_TARGETS" > "$scriptdir/Makefile"
|
|||||||
|
|
||||||
# Generate the individual test targets.
|
# Generate the individual test targets.
|
||||||
if [ "$bc" -ne 0 ]; then
|
if [ "$bc" -ne 0 ]; then
|
||||||
gen_tests bc "$extra_math" "$time_tests" $bc_test_exec
|
gen_std_tests bc "$extra_math" "$time_tests" $bc_test_exec
|
||||||
gen_script_tests bc "$extra_math" "$generate_tests" "$time_tests" $bc_test_exec
|
gen_script_tests bc "$extra_math" "$generate_tests" "$time_tests" $bc_test_exec
|
||||||
|
gen_err_tests bc $bc_test_exec
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$dc" -ne 0 ]; then
|
if [ "$dc" -ne 0 ]; then
|
||||||
gen_tests dc "$extra_math" "$time_tests" $dc_test_exec
|
gen_std_tests dc "$extra_math" "$time_tests" $dc_test_exec
|
||||||
gen_script_tests dc "$extra_math" "$generate_tests" "$time_tests" $dc_test_exec
|
gen_script_tests dc "$extra_math" "$generate_tests" "$time_tests" $dc_test_exec
|
||||||
|
gen_err_tests dc $dc_test_exec
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$scriptdir"
|
cd "$scriptdir"
|
||||||
|
@ -86,6 +86,10 @@ Options:
|
|||||||
|
|
||||||
Force interactive mode.
|
Force interactive mode.
|
||||||
|
|
||||||
|
-L --no-line-length
|
||||||
|
|
||||||
|
Disable line length checking.
|
||||||
|
|
||||||
-l --mathlib
|
-l --mathlib
|
||||||
|
|
||||||
Use predefined math routines:
|
Use predefined math routines:
|
||||||
@ -135,6 +139,10 @@ Options:
|
|||||||
|
|
||||||
Print version information and copyright and exit.
|
Print version information and copyright and exit.
|
||||||
|
|
||||||
|
-z --leading-zeroes
|
||||||
|
|
||||||
|
Enable leading zeroes on numbers greater than -1 and less than 1.
|
||||||
|
|
||||||
Environment variables:
|
Environment variables:
|
||||||
|
|
||||||
POSIXLY_CORRECT
|
POSIXLY_CORRECT
|
||||||
@ -148,7 +156,7 @@ Environment variables:
|
|||||||
BC_LINE_LENGTH
|
BC_LINE_LENGTH
|
||||||
|
|
||||||
If an integer, the number of characters to print on a line before
|
If an integer, the number of characters to print on a line before
|
||||||
wrapping.
|
wrapping. Using 0 will disable line length checking.
|
||||||
|
|
||||||
BC_BANNER
|
BC_BANNER
|
||||||
|
|
||||||
|
@ -89,6 +89,10 @@ Options:
|
|||||||
|
|
||||||
Put dc into interactive mode. See the man page for more details.
|
Put dc into interactive mode. See the man page for more details.
|
||||||
|
|
||||||
|
-L --no-line-length
|
||||||
|
|
||||||
|
Disable line length checking.
|
||||||
|
|
||||||
-P --no-prompt
|
-P --no-prompt
|
||||||
|
|
||||||
Disable the prompts in interactive mode.
|
Disable the prompts in interactive mode.
|
||||||
@ -105,6 +109,10 @@ Options:
|
|||||||
|
|
||||||
Enable extended register mode.
|
Enable extended register mode.
|
||||||
|
|
||||||
|
-z --leading-zeroes
|
||||||
|
|
||||||
|
Enable leading zeroes on numbers greater than -1 and less than 1.
|
||||||
|
|
||||||
Environment variables:
|
Environment variables:
|
||||||
|
|
||||||
DC_ENV_ARGS
|
DC_ENV_ARGS
|
||||||
@ -114,7 +122,7 @@ Environment variables:
|
|||||||
DC_LINE_LENGTH
|
DC_LINE_LENGTH
|
||||||
|
|
||||||
If an integer, the number of characters to print on a line before
|
If an integer, the number of characters to print on a line before
|
||||||
wrapping.
|
wrapping. Using 0 will disable line length checking.
|
||||||
|
|
||||||
DC_SIGINT_RESET
|
DC_SIGINT_RESET
|
||||||
|
|
||||||
|
@ -274,6 +274,42 @@ define s2un(x,n){
|
|||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
define s2u(x){return s2un(x,sbytes(x))}
|
define s2u(x){return s2un(x,sbytes(x))}
|
||||||
|
define void plz(x){
|
||||||
|
if(leading_zero())print x
|
||||||
|
else{
|
||||||
|
if(x>-1&&x<1&&x!=0){
|
||||||
|
if(x<0)print"-"
|
||||||
|
print 0,abs(x)
|
||||||
|
}
|
||||||
|
else print x
|
||||||
|
}
|
||||||
|
}
|
||||||
|
define void plznl(x){
|
||||||
|
plz(x)
|
||||||
|
print"\n"
|
||||||
|
}
|
||||||
|
define void pnlz(x){
|
||||||
|
auto s,i
|
||||||
|
if(leading_zero()){
|
||||||
|
if(x>-1&&x<1&&x!=0){
|
||||||
|
s=scale(x)
|
||||||
|
if(x<0)print"-"
|
||||||
|
print"."
|
||||||
|
x=abs(x)
|
||||||
|
for(i=0;i<s;++i){
|
||||||
|
x<<=1
|
||||||
|
print x$
|
||||||
|
x-=x$
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print x
|
||||||
|
}
|
||||||
|
define void pnlznl(x){
|
||||||
|
pnlz(x)
|
||||||
|
print"\n"
|
||||||
|
}
|
||||||
define void output_byte(x,i){
|
define void output_byte(x,i){
|
||||||
auto j,p,y,b
|
auto j,p,y,b
|
||||||
j=ibase
|
j=ibase
|
||||||
|
@ -73,7 +73,7 @@ typedef struct BcLexKeyword {
|
|||||||
uchar data;
|
uchar data;
|
||||||
|
|
||||||
/// The keyword text.
|
/// The keyword text.
|
||||||
const char name[9];
|
const char name[14];
|
||||||
} BcLexKeyword;
|
} BcLexKeyword;
|
||||||
|
|
||||||
/// Sets the most significant bit. Used for setting the POSIX bit in
|
/// Sets the most significant bit. Used for setting the POSIX bit in
|
||||||
@ -94,13 +94,13 @@ typedef struct BcLexKeyword {
|
|||||||
|
|
||||||
/// A macro for the number of keywords bc has. This has to be updated if any are
|
/// A macro for the number of keywords bc has. This has to be updated if any are
|
||||||
/// added. This is for the redefined_kws field of the BcVm struct.
|
/// added. This is for the redefined_kws field of the BcVm struct.
|
||||||
#define BC_LEX_NKWS (32)
|
#define BC_LEX_NKWS (35)
|
||||||
|
|
||||||
#else // BC_ENABLE_EXTRA_MATH
|
#else // BC_ENABLE_EXTRA_MATH
|
||||||
|
|
||||||
/// A macro for the number of keywords bc has. This has to be updated if any are
|
/// A macro for the number of keywords bc has. This has to be updated if any are
|
||||||
/// added. This is for the redefined_kws field of the BcVm struct.
|
/// added. This is for the redefined_kws field of the BcVm struct.
|
||||||
#define BC_LEX_NKWS (28)
|
#define BC_LEX_NKWS (31)
|
||||||
|
|
||||||
#endif // BC_ENABLE_EXTRA_MATH
|
#endif // BC_ENABLE_EXTRA_MATH
|
||||||
|
|
||||||
|
@ -63,7 +63,8 @@
|
|||||||
#define write(f, b, s) _write((f), (b), (unsigned int) (s))
|
#define write(f, b, s) _write((f), (b), (unsigned int) (s))
|
||||||
#define read(f, b, s) _read((f), (b), (unsigned int) (s))
|
#define read(f, b, s) _read((f), (b), (unsigned int) (s))
|
||||||
#define close _close
|
#define close _close
|
||||||
#define open(f, n, m) _sopen_s(f, n, m, _SH_DENYNO, _S_IREAD | _S_IWRITE)
|
#define open(f, n, m) \
|
||||||
|
_sopen_s((f), (n), (m) | _O_BINARY, _SH_DENYNO, _S_IREAD | _S_IWRITE)
|
||||||
#define sigjmp_buf jmp_buf
|
#define sigjmp_buf jmp_buf
|
||||||
#define sigsetjmp(j, s) setjmp(j)
|
#define sigsetjmp(j, s) setjmp(j)
|
||||||
#define siglongjmp longjmp
|
#define siglongjmp longjmp
|
||||||
@ -168,6 +169,8 @@ void bcl_free(void);
|
|||||||
|
|
||||||
bool bcl_abortOnFatalError(void);
|
bool bcl_abortOnFatalError(void);
|
||||||
void bcl_setAbortOnFatalError(bool abrt);
|
void bcl_setAbortOnFatalError(bool abrt);
|
||||||
|
bool bcl_leadingZeroes(void);
|
||||||
|
void bcl_setLeadingZeroes(bool leadingZeroes);
|
||||||
|
|
||||||
void bcl_gc(void);
|
void bcl_gc(void);
|
||||||
|
|
||||||
|
@ -244,7 +244,11 @@ typedef struct BcHistory {
|
|||||||
/// The original terminal state.
|
/// The original terminal state.
|
||||||
struct termios orig_termios;
|
struct termios orig_termios;
|
||||||
#else // _WIN32
|
#else // _WIN32
|
||||||
DWORD orig_console_mode;
|
/// The original input console mode.
|
||||||
|
DWORD orig_in;
|
||||||
|
|
||||||
|
/// The original output console mode.
|
||||||
|
DWORD orig_out;
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
/// These next two are here because pahole found a 4 byte hole here.
|
/// These next two are here because pahole found a 4 byte hole here.
|
||||||
|
@ -200,6 +200,19 @@ typedef enum BcInst {
|
|||||||
BC_INST_MAXRAND,
|
BC_INST_MAXRAND,
|
||||||
#endif // BC_ENABLE_EXTRA_MATH
|
#endif // BC_ENABLE_EXTRA_MATH
|
||||||
|
|
||||||
|
/// bc line_length() builtin function.
|
||||||
|
BC_INST_LINE_LENGTH,
|
||||||
|
|
||||||
|
#if BC_ENABLED
|
||||||
|
|
||||||
|
/// bc global_stacks() builtin function.
|
||||||
|
BC_INST_GLOBAL_STACKS,
|
||||||
|
|
||||||
|
#endif // BC_ENABLED
|
||||||
|
|
||||||
|
/// bc leading_zero() builtin function.
|
||||||
|
BC_INST_LEADING_ZERO,
|
||||||
|
|
||||||
/// This is slightly misnamed versus BC_INST_PRINT_POP. Well, it is in bc.
|
/// This is slightly misnamed versus BC_INST_PRINT_POP. Well, it is in bc.
|
||||||
/// dc uses this instruction to print, but not pop. That's valid in dc.
|
/// dc uses this instruction to print, but not pop. That's valid in dc.
|
||||||
/// However, in bc, it is *never* valid to print without popping. In bc,
|
/// However, in bc, it is *never* valid to print without popping. In bc,
|
||||||
|
@ -357,6 +357,19 @@ typedef enum BcLexType {
|
|||||||
BC_LEX_KW_MAXRAND,
|
BC_LEX_KW_MAXRAND,
|
||||||
#endif // BC_ENABLE_EXTRA_MATH
|
#endif // BC_ENABLE_EXTRA_MATH
|
||||||
|
|
||||||
|
/// bc line_length keyword.
|
||||||
|
BC_LEX_KW_LINE_LENGTH,
|
||||||
|
|
||||||
|
#if BC_ENABLED
|
||||||
|
|
||||||
|
/// bc global_stacks keyword.
|
||||||
|
BC_LEX_KW_GLOBAL_STACKS,
|
||||||
|
|
||||||
|
#endif // BC_ENABLED
|
||||||
|
|
||||||
|
/// bc leading_zero keyword.
|
||||||
|
BC_LEX_KW_LEADING_ZERO,
|
||||||
|
|
||||||
/// bc stream keyword.
|
/// bc stream keyword.
|
||||||
BC_LEX_KW_STREAM,
|
BC_LEX_KW_STREAM,
|
||||||
|
|
||||||
|
@ -513,6 +513,9 @@ extern const char bc_program_esc_seqs[];
|
|||||||
&&lbl_BC_INST_MAXOBASE, \
|
&&lbl_BC_INST_MAXOBASE, \
|
||||||
&&lbl_BC_INST_MAXSCALE, \
|
&&lbl_BC_INST_MAXSCALE, \
|
||||||
&&lbl_BC_INST_MAXRAND, \
|
&&lbl_BC_INST_MAXRAND, \
|
||||||
|
&&lbl_BC_INST_LINE_LENGTH, \
|
||||||
|
&&lbl_BC_INST_GLOBAL_STACKS, \
|
||||||
|
&&lbl_BC_INST_LEADING_ZERO, \
|
||||||
&&lbl_BC_INST_PRINT, \
|
&&lbl_BC_INST_PRINT, \
|
||||||
&&lbl_BC_INST_PRINT_POP, \
|
&&lbl_BC_INST_PRINT_POP, \
|
||||||
&&lbl_BC_INST_STR, \
|
&&lbl_BC_INST_STR, \
|
||||||
@ -600,6 +603,9 @@ extern const char bc_program_esc_seqs[];
|
|||||||
&&lbl_BC_INST_MAXIBASE, \
|
&&lbl_BC_INST_MAXIBASE, \
|
||||||
&&lbl_BC_INST_MAXOBASE, \
|
&&lbl_BC_INST_MAXOBASE, \
|
||||||
&&lbl_BC_INST_MAXSCALE, \
|
&&lbl_BC_INST_MAXSCALE, \
|
||||||
|
&&lbl_BC_INST_LINE_LENGTH, \
|
||||||
|
&&lbl_BC_INST_GLOBAL_STACKS, \
|
||||||
|
&&lbl_BC_INST_LEADING_ZERO, \
|
||||||
&&lbl_BC_INST_PRINT, \
|
&&lbl_BC_INST_PRINT, \
|
||||||
&&lbl_BC_INST_PRINT_POP, \
|
&&lbl_BC_INST_PRINT_POP, \
|
||||||
&&lbl_BC_INST_STR, \
|
&&lbl_BC_INST_STR, \
|
||||||
@ -705,6 +711,9 @@ extern const char bc_program_esc_seqs[];
|
|||||||
&&lbl_BC_INST_MAXOBASE, \
|
&&lbl_BC_INST_MAXOBASE, \
|
||||||
&&lbl_BC_INST_MAXSCALE, \
|
&&lbl_BC_INST_MAXSCALE, \
|
||||||
&&lbl_BC_INST_MAXRAND, \
|
&&lbl_BC_INST_MAXRAND, \
|
||||||
|
&&lbl_BC_INST_LINE_LENGTH, \
|
||||||
|
&&lbl_BC_INST_GLOBAL_STACKS, \
|
||||||
|
&&lbl_BC_INST_LEADING_ZERO, \
|
||||||
&&lbl_BC_INST_PRINT, \
|
&&lbl_BC_INST_PRINT, \
|
||||||
&&lbl_BC_INST_PRINT_POP, \
|
&&lbl_BC_INST_PRINT_POP, \
|
||||||
&&lbl_BC_INST_STR, \
|
&&lbl_BC_INST_STR, \
|
||||||
@ -778,6 +787,9 @@ extern const char bc_program_esc_seqs[];
|
|||||||
&&lbl_BC_INST_MAXIBASE, \
|
&&lbl_BC_INST_MAXIBASE, \
|
||||||
&&lbl_BC_INST_MAXOBASE, \
|
&&lbl_BC_INST_MAXOBASE, \
|
||||||
&&lbl_BC_INST_MAXSCALE, \
|
&&lbl_BC_INST_MAXSCALE, \
|
||||||
|
&&lbl_BC_INST_LINE_LENGTH, \
|
||||||
|
&&lbl_BC_INST_GLOBAL_STACKS, \
|
||||||
|
&&lbl_BC_INST_LEADING_ZERO, \
|
||||||
&&lbl_BC_INST_PRINT, \
|
&&lbl_BC_INST_PRINT, \
|
||||||
&&lbl_BC_INST_PRINT_POP, \
|
&&lbl_BC_INST_PRINT_POP, \
|
||||||
&&lbl_BC_INST_STR, \
|
&&lbl_BC_INST_STR, \
|
||||||
@ -849,6 +861,8 @@ extern const char bc_program_esc_seqs[];
|
|||||||
&&lbl_BC_INST_MAXOBASE, \
|
&&lbl_BC_INST_MAXOBASE, \
|
||||||
&&lbl_BC_INST_MAXSCALE, \
|
&&lbl_BC_INST_MAXSCALE, \
|
||||||
&&lbl_BC_INST_MAXRAND, \
|
&&lbl_BC_INST_MAXRAND, \
|
||||||
|
&&lbl_BC_INST_LINE_LENGTH, \
|
||||||
|
&&lbl_BC_INST_LEADING_ZERO, \
|
||||||
&&lbl_BC_INST_PRINT, \
|
&&lbl_BC_INST_PRINT, \
|
||||||
&&lbl_BC_INST_PRINT_POP, \
|
&&lbl_BC_INST_PRINT_POP, \
|
||||||
&&lbl_BC_INST_STR, \
|
&&lbl_BC_INST_STR, \
|
||||||
@ -912,6 +926,8 @@ extern const char bc_program_esc_seqs[];
|
|||||||
&&lbl_BC_INST_MAXIBASE, \
|
&&lbl_BC_INST_MAXIBASE, \
|
||||||
&&lbl_BC_INST_MAXOBASE, \
|
&&lbl_BC_INST_MAXOBASE, \
|
||||||
&&lbl_BC_INST_MAXSCALE, \
|
&&lbl_BC_INST_MAXSCALE, \
|
||||||
|
&&lbl_BC_INST_LINE_LENGTH, \
|
||||||
|
&&lbl_BC_INST_LEADING_ZERO, \
|
||||||
&&lbl_BC_INST_PRINT, \
|
&&lbl_BC_INST_PRINT, \
|
||||||
&&lbl_BC_INST_PRINT_POP, \
|
&&lbl_BC_INST_PRINT_POP, \
|
||||||
&&lbl_BC_INST_STR, \
|
&&lbl_BC_INST_STR, \
|
||||||
|
@ -37,6 +37,6 @@
|
|||||||
#define BC_VERSION_H
|
#define BC_VERSION_H
|
||||||
|
|
||||||
/// The current version.
|
/// The current version.
|
||||||
#define VERSION 5.0.2
|
#define VERSION 5.1.0
|
||||||
|
|
||||||
#endif // BC_VERSION_H
|
#endif // BC_VERSION_H
|
||||||
|
@ -164,14 +164,17 @@
|
|||||||
/// The flag for read prompt. This is also reversed; the option clears the flag.
|
/// The flag for read prompt. This is also reversed; the option clears the flag.
|
||||||
#define BC_FLAG_R (UINTMAX_C(1)<<8)
|
#define BC_FLAG_R (UINTMAX_C(1)<<8)
|
||||||
|
|
||||||
|
/// The flag for a leading zero.
|
||||||
|
#define BC_FLAG_Z (UINTMAX_C(1)<<9)
|
||||||
|
|
||||||
/// The flag for stdin being a TTY.
|
/// The flag for stdin being a TTY.
|
||||||
#define BC_FLAG_TTYIN (UINTMAX_C(1)<<9)
|
#define BC_FLAG_TTYIN (UINTMAX_C(1)<<10)
|
||||||
|
|
||||||
/// The flag for TTY mode.
|
/// The flag for TTY mode.
|
||||||
#define BC_FLAG_TTY (UINTMAX_C(1)<<10)
|
#define BC_FLAG_TTY (UINTMAX_C(1)<<11)
|
||||||
|
|
||||||
/// The flag for reset on SIGINT.
|
/// The flag for reset on SIGINT.
|
||||||
#define BC_FLAG_SIGINT (UINTMAX_C(1)<<11)
|
#define BC_FLAG_SIGINT (UINTMAX_C(1)<<12)
|
||||||
|
|
||||||
/// A convenience macro for getting the TTYIN flag.
|
/// A convenience macro for getting the TTYIN flag.
|
||||||
#define BC_TTYIN (vm.flags & BC_FLAG_TTYIN)
|
#define BC_TTYIN (vm.flags & BC_FLAG_TTYIN)
|
||||||
@ -214,6 +217,9 @@
|
|||||||
/// A convenience macro for getting the read prompt flag.
|
/// A convenience macro for getting the read prompt flag.
|
||||||
#define BC_R (vm.flags & BC_FLAG_R)
|
#define BC_R (vm.flags & BC_FLAG_R)
|
||||||
|
|
||||||
|
/// A convenience macro for getting the leading zero flag.
|
||||||
|
#define BC_Z (vm.flags & BC_FLAG_Z)
|
||||||
|
|
||||||
#if BC_ENABLED
|
#if BC_ENABLED
|
||||||
|
|
||||||
/// A convenience macro for checking if bc is in POSIX mode.
|
/// A convenience macro for checking if bc is in POSIX mode.
|
||||||
@ -253,6 +259,10 @@
|
|||||||
/// A convenience macro for checking if the prompt is enabled.
|
/// A convenience macro for checking if the prompt is enabled.
|
||||||
#define BC_PROMPT (BC_P)
|
#define BC_PROMPT (BC_P)
|
||||||
|
|
||||||
|
#else // !BC_ENABLE_LIBRARY
|
||||||
|
|
||||||
|
#define BC_Z (vm.leading_zeroes)
|
||||||
|
|
||||||
#endif // !BC_ENABLE_LIBRARY
|
#endif // !BC_ENABLE_LIBRARY
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -406,6 +416,9 @@ typedef struct BcVm {
|
|||||||
/// Whether or not bcl should abort on fatal errors.
|
/// Whether or not bcl should abort on fatal errors.
|
||||||
bool abrt;
|
bool abrt;
|
||||||
|
|
||||||
|
/// Whether or not to print leading zeros.
|
||||||
|
bool leading_zeroes;
|
||||||
|
|
||||||
/// The number of "references," or times that the library was initialized.
|
/// The number of "references," or times that the library was initialized.
|
||||||
unsigned int refs;
|
unsigned int refs;
|
||||||
|
|
||||||
|
@ -176,6 +176,16 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-L\f[R], \f[B]--no-line-length\f[R]
|
||||||
|
Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines.
|
||||||
|
In other words, this option sets \f[B]BC_LINE_LENGTH\f[R] to \f[B]0\f[R]
|
||||||
|
(see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library and the extended math library before
|
and loads the included math library and the extended math library before
|
||||||
@ -318,6 +328,18 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
|
||||||
|
Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
|
||||||
|
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This can be set for individual numbers with the \f[B]plz(x)\f[R],
|
||||||
|
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
|
||||||
|
extended math library (see the \f[B]LIBRARY\f[R] section).
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
@ -636,11 +658,28 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
\f[B]maxscale()\f[R]: The max allowable \f[B]scale\f[R].
|
\f[B]maxscale()\f[R]: The max allowable \f[B]scale\f[R].
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.IP "17." 4
|
.IP "17." 4
|
||||||
|
\f[B]line_length()\f[R]: The line length set with
|
||||||
|
\f[B]BC_LINE_LENGTH\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
|
||||||
|
section).
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "18." 4
|
||||||
|
\f[B]global_stacks()\f[R]: \f[B]0\f[R] if global stacks are not enabled
|
||||||
|
with the \f[B]-g\f[R] or \f[B]--global-stacks\f[R] options, non-zero
|
||||||
|
otherwise.
|
||||||
|
See the \f[B]OPTIONS\f[R] section.
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "19." 4
|
||||||
|
\f[B]leading_zero()\f[R]: \f[B]0\f[R] if leading zeroes are not enabled
|
||||||
|
with the \f[B]-z\f[R] or \f[B]\[en]leading-zeroes\f[R] options, non-zero
|
||||||
|
otherwise.
|
||||||
|
See the \f[B]OPTIONS\f[R] section.
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "20." 4
|
||||||
\f[B]rand()\f[R]: A pseudo-random integer between \f[B]0\f[R]
|
\f[B]rand()\f[R]: A pseudo-random integer between \f[B]0\f[R]
|
||||||
(inclusive) and \f[B]BC_RAND_MAX\f[R] (inclusive).
|
(inclusive) and \f[B]BC_RAND_MAX\f[R] (inclusive).
|
||||||
Using this operand will change the value of \f[B]seed\f[R].
|
Using this operand will change the value of \f[B]seed\f[R].
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.IP "18." 4
|
.IP "21." 4
|
||||||
\f[B]irand(E)\f[R]: A pseudo-random integer between \f[B]0\f[R]
|
\f[B]irand(E)\f[R]: A pseudo-random integer between \f[B]0\f[R]
|
||||||
(inclusive) and the value of \f[B]E\f[R] (exclusive).
|
(inclusive) and the value of \f[B]E\f[R] (exclusive).
|
||||||
If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[cq]s
|
If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[cq]s
|
||||||
@ -658,7 +697,7 @@ value of \f[B]E\f[R] is \f[B]0\f[R] or \f[B]1\f[R].
|
|||||||
In that case, \f[B]0\f[R] is returned, and \f[B]seed\f[R] is
|
In that case, \f[B]0\f[R] is returned, and \f[B]seed\f[R] is
|
||||||
\f[I]not\f[R] changed.
|
\f[I]not\f[R] changed.
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.IP "19." 4
|
.IP "22." 4
|
||||||
\f[B]maxrand()\f[R]: The max integer returned by \f[B]rand()\f[R].
|
\f[B]maxrand()\f[R]: The max integer returned by \f[B]rand()\f[R].
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.PP
|
.PP
|
||||||
@ -1937,6 +1976,46 @@ This function is used to implement other bitwise functions; it is not
|
|||||||
meant to be used by users, but it can be.
|
meant to be used by users, but it can be.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]plz(x)\f[R]
|
||||||
|
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that \f[B]-1\f[R]
|
||||||
|
and less than \f[B]1\f[R], it is printed with a leading zero, regardless
|
||||||
|
of the use of the \f[B]-z\f[R] option (see the \f[B]OPTIONS\f[R]
|
||||||
|
section) and without a trailing newline.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
Otherwise, \f[B]x\f[R] is printed normally, without a trailing newline.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\f[B]plznl(x)\f[R]
|
||||||
|
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that \f[B]-1\f[R]
|
||||||
|
and less than \f[B]1\f[R], it is printed with a leading zero, regardless
|
||||||
|
of the use of the \f[B]-z\f[R] option (see the \f[B]OPTIONS\f[R]
|
||||||
|
section) and with a trailing newline.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
Otherwise, \f[B]x\f[R] is printed normally, with a trailing newline.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\f[B]pnlz(x)\f[R]
|
||||||
|
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that \f[B]-1\f[R]
|
||||||
|
and less than \f[B]1\f[R], it is printed without a leading zero,
|
||||||
|
regardless of the use of the \f[B]-z\f[R] option (see the
|
||||||
|
\f[B]OPTIONS\f[R] section) and without a trailing newline.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
Otherwise, \f[B]x\f[R] is printed normally, without a trailing newline.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\f[B]pnlznl(x)\f[R]
|
||||||
|
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that \f[B]-1\f[R]
|
||||||
|
and less than \f[B]1\f[R], it is printed without a leading zero,
|
||||||
|
regardless of the use of the \f[B]-z\f[R] option (see the
|
||||||
|
\f[B]OPTIONS\f[R] section) and with a trailing newline.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
Otherwise, \f[B]x\f[R] is printed normally, with a trailing newline.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]ubytes(x)\f[R]
|
\f[B]ubytes(x)\f[R]
|
||||||
Returns the numbers of unsigned integer bytes required to hold the
|
Returns the numbers of unsigned integer bytes required to hold the
|
||||||
truncated absolute value of \f[B]x\f[R].
|
truncated absolute value of \f[B]x\f[R].
|
||||||
@ -2407,6 +2486,12 @@ greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
|
|||||||
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
|
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
|
||||||
including the backslash (\f[B]\[rs]\f[R]).
|
including the backslash (\f[B]\[rs]\f[R]).
|
||||||
The default line length is \f[B]70\f[R].
|
The default line length is \f[B]70\f[R].
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
The special value of \f[B]0\f[R] will disable line length checking and
|
||||||
|
print numbers without regard to line length and without backslashes and
|
||||||
|
newlines.
|
||||||
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]BC_BANNER\f[R]
|
\f[B]BC_BANNER\f[R]
|
||||||
If this environment variable exists and contains an integer, then a
|
If this environment variable exists and contains an integer, then a
|
||||||
|
@ -141,6 +141,14 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-L**, **-\-no-line-length**
|
||||||
|
|
||||||
|
: Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines. In other words, this option sets **BC_LINE_LENGTH** to **0** (see
|
||||||
|
the **ENVIRONMENT VARIABLES** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **-\-mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
@ -248,6 +256,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-z**, **-\-leading-zeroes**
|
||||||
|
|
||||||
|
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
|
||||||
|
not equal to **0**, with a leading zero.
|
||||||
|
|
||||||
|
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
|
||||||
|
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
|
||||||
|
the **LIBRARY** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **-\-expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
@ -488,10 +507,18 @@ The following are valid operands in bc(1):
|
|||||||
extension**.
|
extension**.
|
||||||
16. **maxscale()**: The max allowable **scale**. This is a **non-portable
|
16. **maxscale()**: The max allowable **scale**. This is a **non-portable
|
||||||
extension**.
|
extension**.
|
||||||
17. **rand()**: A pseudo-random integer between **0** (inclusive) and
|
17. **line_length()**: The line length set with **BC_LINE_LENGTH** (see the
|
||||||
|
**ENVIRONMENT VARIABLES** section). This is a **non-portable extension**.
|
||||||
|
18. **global_stacks()**: **0** if global stacks are not enabled with the **-g**
|
||||||
|
or **-\-global-stacks** options, non-zero otherwise. See the **OPTIONS**
|
||||||
|
section. This is a **non-portable extension**.
|
||||||
|
19. **leading_zero()**: **0** if leading zeroes are not enabled with the **-z**
|
||||||
|
or **--leading-zeroes** options, non-zero otherwise. See the **OPTIONS**
|
||||||
|
section. This is a **non-portable extension**.
|
||||||
|
20. **rand()**: A pseudo-random integer between **0** (inclusive) and
|
||||||
**BC_RAND_MAX** (inclusive). Using this operand will change the value of
|
**BC_RAND_MAX** (inclusive). Using this operand will change the value of
|
||||||
**seed**. This is a **non-portable extension**.
|
**seed**. This is a **non-portable extension**.
|
||||||
18. **irand(E)**: A pseudo-random integer between **0** (inclusive) and the
|
21. **irand(E)**: A pseudo-random integer between **0** (inclusive) and the
|
||||||
value of **E** (exclusive). If **E** is negative or is a non-integer
|
value of **E** (exclusive). If **E** is negative or is a non-integer
|
||||||
(**E**'s *scale* is not **0**), an error is raised, and bc(1) resets (see
|
(**E**'s *scale* is not **0**), an error is raised, and bc(1) resets (see
|
||||||
the **RESET** section) while **seed** remains unchanged. If **E** is larger
|
the **RESET** section) while **seed** remains unchanged. If **E** is larger
|
||||||
@ -502,7 +529,7 @@ The following are valid operands in bc(1):
|
|||||||
change the value of **seed**, unless the value of **E** is **0** or **1**.
|
change the value of **seed**, unless the value of **E** is **0** or **1**.
|
||||||
In that case, **0** is returned, and **seed** is *not* changed. This is a
|
In that case, **0** is returned, and **seed** is *not* changed. This is a
|
||||||
**non-portable extension**.
|
**non-portable extension**.
|
||||||
19. **maxrand()**: The max integer returned by **rand()**. This is a
|
22. **maxrand()**: The max integer returned by **rand()**. This is a
|
||||||
**non-portable extension**.
|
**non-portable extension**.
|
||||||
|
|
||||||
The integers generated by **rand()** and **irand(E)** are guaranteed to be as
|
The integers generated by **rand()** and **irand(E)** are guaranteed to be as
|
||||||
@ -1597,6 +1624,38 @@ The extended library is a **non-portable extension**.
|
|||||||
This function is used to implement other bitwise functions; it is not meant
|
This function is used to implement other bitwise functions; it is not meant
|
||||||
to be used by users, but it can be.
|
to be used by users, but it can be.
|
||||||
|
|
||||||
|
**plz(x)**
|
||||||
|
|
||||||
|
: If **x** is not equal to **0** and greater that **-1** and less than **1**,
|
||||||
|
it is printed with a leading zero, regardless of the use of the **-z**
|
||||||
|
option (see the **OPTIONS** section) and without a trailing newline.
|
||||||
|
|
||||||
|
Otherwise, **x** is printed normally, without a trailing newline.
|
||||||
|
|
||||||
|
**plznl(x)**
|
||||||
|
|
||||||
|
: If **x** is not equal to **0** and greater that **-1** and less than **1**,
|
||||||
|
it is printed with a leading zero, regardless of the use of the **-z**
|
||||||
|
option (see the **OPTIONS** section) and with a trailing newline.
|
||||||
|
|
||||||
|
Otherwise, **x** is printed normally, with a trailing newline.
|
||||||
|
|
||||||
|
**pnlz(x)**
|
||||||
|
|
||||||
|
: If **x** is not equal to **0** and greater that **-1** and less than **1**,
|
||||||
|
it is printed without a leading zero, regardless of the use of the **-z**
|
||||||
|
option (see the **OPTIONS** section) and without a trailing newline.
|
||||||
|
|
||||||
|
Otherwise, **x** is printed normally, without a trailing newline.
|
||||||
|
|
||||||
|
**pnlznl(x)**
|
||||||
|
|
||||||
|
: If **x** is not equal to **0** and greater that **-1** and less than **1**,
|
||||||
|
it is printed without a leading zero, regardless of the use of the **-z**
|
||||||
|
option (see the **OPTIONS** section) and with a trailing newline.
|
||||||
|
|
||||||
|
Otherwise, **x** is printed normally, with a trailing newline.
|
||||||
|
|
||||||
**ubytes(x)**
|
**ubytes(x)**
|
||||||
|
|
||||||
: Returns the numbers of unsigned integer bytes required to hold the truncated
|
: Returns the numbers of unsigned integer bytes required to hold the truncated
|
||||||
@ -2012,6 +2071,9 @@ bc(1) recognizes the following environment variables:
|
|||||||
lines to that length, including the backslash (**\\**). The default line
|
lines to that length, including the backslash (**\\**). The default line
|
||||||
length is **70**.
|
length is **70**.
|
||||||
|
|
||||||
|
The special value of **0** will disable line length checking and print
|
||||||
|
numbers without regard to line length and without backslashes and newlines.
|
||||||
|
|
||||||
**BC_BANNER**
|
**BC_BANNER**
|
||||||
|
|
||||||
: If this environment variable exists and contains an integer, then a non-zero
|
: If this environment variable exists and contains an integer, then a non-zero
|
||||||
|
@ -154,6 +154,16 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-L\f[R], \f[B]--no-line-length\f[R]
|
||||||
|
Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines.
|
||||||
|
In other words, this option sets \f[B]BC_LINE_LENGTH\f[R] to \f[B]0\f[R]
|
||||||
|
(see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library before running any code, including
|
and loads the included math library before running any code, including
|
||||||
@ -287,6 +297,18 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
|
||||||
|
Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
|
||||||
|
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This can be set for individual numbers with the \f[B]plz(x)\f[R],
|
||||||
|
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
|
||||||
|
extended math library (see the \f[B]LIBRARY\f[R] section).
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
@ -570,6 +592,23 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
.IP "16." 4
|
.IP "16." 4
|
||||||
\f[B]maxscale()\f[R]: The max allowable \f[B]scale\f[R].
|
\f[B]maxscale()\f[R]: The max allowable \f[B]scale\f[R].
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "17." 4
|
||||||
|
\f[B]line_length()\f[R]: The line length set with
|
||||||
|
\f[B]BC_LINE_LENGTH\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
|
||||||
|
section).
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "18." 4
|
||||||
|
\f[B]global_stacks()\f[R]: \f[B]0\f[R] if global stacks are not enabled
|
||||||
|
with the \f[B]-g\f[R] or \f[B]--global-stacks\f[R] options, non-zero
|
||||||
|
otherwise.
|
||||||
|
See the \f[B]OPTIONS\f[R] section.
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "19." 4
|
||||||
|
\f[B]leading_zero()\f[R]: \f[B]0\f[R] if leading zeroes are not enabled
|
||||||
|
with the \f[B]-z\f[R] or \f[B]\[en]leading-zeroes\f[R] options, non-zero
|
||||||
|
otherwise.
|
||||||
|
See the \f[B]OPTIONS\f[R] section.
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.SS Numbers
|
.SS Numbers
|
||||||
.PP
|
.PP
|
||||||
Numbers are strings made up of digits, uppercase letters, and at most
|
Numbers are strings made up of digits, uppercase letters, and at most
|
||||||
@ -1295,6 +1334,12 @@ greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
|
|||||||
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
|
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
|
||||||
including the backslash (\f[B]\[rs]\f[R]).
|
including the backslash (\f[B]\[rs]\f[R]).
|
||||||
The default line length is \f[B]70\f[R].
|
The default line length is \f[B]70\f[R].
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
The special value of \f[B]0\f[R] will disable line length checking and
|
||||||
|
print numbers without regard to line length and without backslashes and
|
||||||
|
newlines.
|
||||||
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]BC_BANNER\f[R]
|
\f[B]BC_BANNER\f[R]
|
||||||
If this environment variable exists and contains an integer, then a
|
If this environment variable exists and contains an integer, then a
|
||||||
|
@ -125,6 +125,14 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-L**, **-\-no-line-length**
|
||||||
|
|
||||||
|
: Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines. In other words, this option sets **BC_LINE_LENGTH** to **0** (see
|
||||||
|
the **ENVIRONMENT VARIABLES** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **-\-mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
@ -228,6 +236,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-z**, **-\-leading-zeroes**
|
||||||
|
|
||||||
|
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
|
||||||
|
not equal to **0**, with a leading zero.
|
||||||
|
|
||||||
|
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
|
||||||
|
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
|
||||||
|
the **LIBRARY** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **-\-expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
@ -442,6 +461,14 @@ The following are valid operands in bc(1):
|
|||||||
extension**.
|
extension**.
|
||||||
16. **maxscale()**: The max allowable **scale**. This is a **non-portable
|
16. **maxscale()**: The max allowable **scale**. This is a **non-portable
|
||||||
extension**.
|
extension**.
|
||||||
|
17. **line_length()**: The line length set with **BC_LINE_LENGTH** (see the
|
||||||
|
**ENVIRONMENT VARIABLES** section). This is a **non-portable extension**.
|
||||||
|
18. **global_stacks()**: **0** if global stacks are not enabled with the **-g**
|
||||||
|
or **-\-global-stacks** options, non-zero otherwise. See the **OPTIONS**
|
||||||
|
section. This is a **non-portable extension**.
|
||||||
|
19. **leading_zero()**: **0** if leading zeroes are not enabled with the **-z**
|
||||||
|
or **--leading-zeroes** options, non-zero otherwise. See the **OPTIONS**
|
||||||
|
section. This is a **non-portable extension**.
|
||||||
|
|
||||||
## Numbers
|
## Numbers
|
||||||
|
|
||||||
@ -1064,6 +1091,9 @@ bc(1) recognizes the following environment variables:
|
|||||||
lines to that length, including the backslash (**\\**). The default line
|
lines to that length, including the backslash (**\\**). The default line
|
||||||
length is **70**.
|
length is **70**.
|
||||||
|
|
||||||
|
The special value of **0** will disable line length checking and print
|
||||||
|
numbers without regard to line length and without backslashes and newlines.
|
||||||
|
|
||||||
**BC_BANNER**
|
**BC_BANNER**
|
||||||
|
|
||||||
: If this environment variable exists and contains an integer, then a non-zero
|
: If this environment variable exists and contains an integer, then a non-zero
|
||||||
|
@ -154,6 +154,16 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-L\f[R], \f[B]--no-line-length\f[R]
|
||||||
|
Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines.
|
||||||
|
In other words, this option sets \f[B]BC_LINE_LENGTH\f[R] to \f[B]0\f[R]
|
||||||
|
(see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library before running any code, including
|
and loads the included math library before running any code, including
|
||||||
@ -287,6 +297,18 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
|
||||||
|
Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
|
||||||
|
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This can be set for individual numbers with the \f[B]plz(x)\f[R],
|
||||||
|
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
|
||||||
|
extended math library (see the \f[B]LIBRARY\f[R] section).
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
@ -570,6 +592,23 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
.IP "16." 4
|
.IP "16." 4
|
||||||
\f[B]maxscale()\f[R]: The max allowable \f[B]scale\f[R].
|
\f[B]maxscale()\f[R]: The max allowable \f[B]scale\f[R].
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "17." 4
|
||||||
|
\f[B]line_length()\f[R]: The line length set with
|
||||||
|
\f[B]BC_LINE_LENGTH\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
|
||||||
|
section).
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "18." 4
|
||||||
|
\f[B]global_stacks()\f[R]: \f[B]0\f[R] if global stacks are not enabled
|
||||||
|
with the \f[B]-g\f[R] or \f[B]--global-stacks\f[R] options, non-zero
|
||||||
|
otherwise.
|
||||||
|
See the \f[B]OPTIONS\f[R] section.
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "19." 4
|
||||||
|
\f[B]leading_zero()\f[R]: \f[B]0\f[R] if leading zeroes are not enabled
|
||||||
|
with the \f[B]-z\f[R] or \f[B]\[en]leading-zeroes\f[R] options, non-zero
|
||||||
|
otherwise.
|
||||||
|
See the \f[B]OPTIONS\f[R] section.
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.SS Numbers
|
.SS Numbers
|
||||||
.PP
|
.PP
|
||||||
Numbers are strings made up of digits, uppercase letters, and at most
|
Numbers are strings made up of digits, uppercase letters, and at most
|
||||||
@ -1295,6 +1334,12 @@ greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
|
|||||||
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
|
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
|
||||||
including the backslash (\f[B]\[rs]\f[R]).
|
including the backslash (\f[B]\[rs]\f[R]).
|
||||||
The default line length is \f[B]70\f[R].
|
The default line length is \f[B]70\f[R].
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
The special value of \f[B]0\f[R] will disable line length checking and
|
||||||
|
print numbers without regard to line length and without backslashes and
|
||||||
|
newlines.
|
||||||
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]BC_BANNER\f[R]
|
\f[B]BC_BANNER\f[R]
|
||||||
If this environment variable exists and contains an integer, then a
|
If this environment variable exists and contains an integer, then a
|
||||||
|
@ -125,6 +125,14 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-L**, **-\-no-line-length**
|
||||||
|
|
||||||
|
: Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines. In other words, this option sets **BC_LINE_LENGTH** to **0** (see
|
||||||
|
the **ENVIRONMENT VARIABLES** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **-\-mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
@ -228,6 +236,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-z**, **-\-leading-zeroes**
|
||||||
|
|
||||||
|
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
|
||||||
|
not equal to **0**, with a leading zero.
|
||||||
|
|
||||||
|
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
|
||||||
|
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
|
||||||
|
the **LIBRARY** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **-\-expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
@ -442,6 +461,14 @@ The following are valid operands in bc(1):
|
|||||||
extension**.
|
extension**.
|
||||||
16. **maxscale()**: The max allowable **scale**. This is a **non-portable
|
16. **maxscale()**: The max allowable **scale**. This is a **non-portable
|
||||||
extension**.
|
extension**.
|
||||||
|
17. **line_length()**: The line length set with **BC_LINE_LENGTH** (see the
|
||||||
|
**ENVIRONMENT VARIABLES** section). This is a **non-portable extension**.
|
||||||
|
18. **global_stacks()**: **0** if global stacks are not enabled with the **-g**
|
||||||
|
or **-\-global-stacks** options, non-zero otherwise. See the **OPTIONS**
|
||||||
|
section. This is a **non-portable extension**.
|
||||||
|
19. **leading_zero()**: **0** if leading zeroes are not enabled with the **-z**
|
||||||
|
or **--leading-zeroes** options, non-zero otherwise. See the **OPTIONS**
|
||||||
|
section. This is a **non-portable extension**.
|
||||||
|
|
||||||
## Numbers
|
## Numbers
|
||||||
|
|
||||||
@ -1064,6 +1091,9 @@ bc(1) recognizes the following environment variables:
|
|||||||
lines to that length, including the backslash (**\\**). The default line
|
lines to that length, including the backslash (**\\**). The default line
|
||||||
length is **70**.
|
length is **70**.
|
||||||
|
|
||||||
|
The special value of **0** will disable line length checking and print
|
||||||
|
numbers without regard to line length and without backslashes and newlines.
|
||||||
|
|
||||||
**BC_BANNER**
|
**BC_BANNER**
|
||||||
|
|
||||||
: If this environment variable exists and contains an integer, then a non-zero
|
: If this environment variable exists and contains an integer, then a non-zero
|
||||||
|
@ -154,6 +154,16 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-L\f[R], \f[B]--no-line-length\f[R]
|
||||||
|
Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines.
|
||||||
|
In other words, this option sets \f[B]BC_LINE_LENGTH\f[R] to \f[B]0\f[R]
|
||||||
|
(see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library before running any code, including
|
and loads the included math library before running any code, including
|
||||||
@ -287,6 +297,18 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
|
||||||
|
Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
|
||||||
|
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This can be set for individual numbers with the \f[B]plz(x)\f[R],
|
||||||
|
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
|
||||||
|
extended math library (see the \f[B]LIBRARY\f[R] section).
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
@ -570,6 +592,23 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
.IP "16." 4
|
.IP "16." 4
|
||||||
\f[B]maxscale()\f[R]: The max allowable \f[B]scale\f[R].
|
\f[B]maxscale()\f[R]: The max allowable \f[B]scale\f[R].
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "17." 4
|
||||||
|
\f[B]line_length()\f[R]: The line length set with
|
||||||
|
\f[B]BC_LINE_LENGTH\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
|
||||||
|
section).
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "18." 4
|
||||||
|
\f[B]global_stacks()\f[R]: \f[B]0\f[R] if global stacks are not enabled
|
||||||
|
with the \f[B]-g\f[R] or \f[B]--global-stacks\f[R] options, non-zero
|
||||||
|
otherwise.
|
||||||
|
See the \f[B]OPTIONS\f[R] section.
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "19." 4
|
||||||
|
\f[B]leading_zero()\f[R]: \f[B]0\f[R] if leading zeroes are not enabled
|
||||||
|
with the \f[B]-z\f[R] or \f[B]\[en]leading-zeroes\f[R] options, non-zero
|
||||||
|
otherwise.
|
||||||
|
See the \f[B]OPTIONS\f[R] section.
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.SS Numbers
|
.SS Numbers
|
||||||
.PP
|
.PP
|
||||||
Numbers are strings made up of digits, uppercase letters, and at most
|
Numbers are strings made up of digits, uppercase letters, and at most
|
||||||
@ -1295,6 +1334,12 @@ greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
|
|||||||
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
|
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
|
||||||
including the backslash (\f[B]\[rs]\f[R]).
|
including the backslash (\f[B]\[rs]\f[R]).
|
||||||
The default line length is \f[B]70\f[R].
|
The default line length is \f[B]70\f[R].
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
The special value of \f[B]0\f[R] will disable line length checking and
|
||||||
|
print numbers without regard to line length and without backslashes and
|
||||||
|
newlines.
|
||||||
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]BC_BANNER\f[R]
|
\f[B]BC_BANNER\f[R]
|
||||||
If this environment variable exists and contains an integer, then a
|
If this environment variable exists and contains an integer, then a
|
||||||
|
@ -125,6 +125,14 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-L**, **-\-no-line-length**
|
||||||
|
|
||||||
|
: Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines. In other words, this option sets **BC_LINE_LENGTH** to **0** (see
|
||||||
|
the **ENVIRONMENT VARIABLES** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **-\-mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
@ -228,6 +236,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-z**, **-\-leading-zeroes**
|
||||||
|
|
||||||
|
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
|
||||||
|
not equal to **0**, with a leading zero.
|
||||||
|
|
||||||
|
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
|
||||||
|
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
|
||||||
|
the **LIBRARY** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **-\-expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
@ -442,6 +461,14 @@ The following are valid operands in bc(1):
|
|||||||
extension**.
|
extension**.
|
||||||
16. **maxscale()**: The max allowable **scale**. This is a **non-portable
|
16. **maxscale()**: The max allowable **scale**. This is a **non-portable
|
||||||
extension**.
|
extension**.
|
||||||
|
17. **line_length()**: The line length set with **BC_LINE_LENGTH** (see the
|
||||||
|
**ENVIRONMENT VARIABLES** section). This is a **non-portable extension**.
|
||||||
|
18. **global_stacks()**: **0** if global stacks are not enabled with the **-g**
|
||||||
|
or **-\-global-stacks** options, non-zero otherwise. See the **OPTIONS**
|
||||||
|
section. This is a **non-portable extension**.
|
||||||
|
19. **leading_zero()**: **0** if leading zeroes are not enabled with the **-z**
|
||||||
|
or **--leading-zeroes** options, non-zero otherwise. See the **OPTIONS**
|
||||||
|
section. This is a **non-portable extension**.
|
||||||
|
|
||||||
## Numbers
|
## Numbers
|
||||||
|
|
||||||
@ -1064,6 +1091,9 @@ bc(1) recognizes the following environment variables:
|
|||||||
lines to that length, including the backslash (**\\**). The default line
|
lines to that length, including the backslash (**\\**). The default line
|
||||||
length is **70**.
|
length is **70**.
|
||||||
|
|
||||||
|
The special value of **0** will disable line length checking and print
|
||||||
|
numbers without regard to line length and without backslashes and newlines.
|
||||||
|
|
||||||
**BC_BANNER**
|
**BC_BANNER**
|
||||||
|
|
||||||
: If this environment variable exists and contains an integer, then a non-zero
|
: If this environment variable exists and contains an integer, then a non-zero
|
||||||
|
@ -154,6 +154,16 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-L\f[R], \f[B]--no-line-length\f[R]
|
||||||
|
Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines.
|
||||||
|
In other words, this option sets \f[B]BC_LINE_LENGTH\f[R] to \f[B]0\f[R]
|
||||||
|
(see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library before running any code, including
|
and loads the included math library before running any code, including
|
||||||
@ -287,6 +297,18 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
|
||||||
|
Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
|
||||||
|
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This can be set for individual numbers with the \f[B]plz(x)\f[R],
|
||||||
|
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
|
||||||
|
extended math library (see the \f[B]LIBRARY\f[R] section).
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
@ -570,6 +592,23 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
.IP "16." 4
|
.IP "16." 4
|
||||||
\f[B]maxscale()\f[R]: The max allowable \f[B]scale\f[R].
|
\f[B]maxscale()\f[R]: The max allowable \f[B]scale\f[R].
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "17." 4
|
||||||
|
\f[B]line_length()\f[R]: The line length set with
|
||||||
|
\f[B]BC_LINE_LENGTH\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
|
||||||
|
section).
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "18." 4
|
||||||
|
\f[B]global_stacks()\f[R]: \f[B]0\f[R] if global stacks are not enabled
|
||||||
|
with the \f[B]-g\f[R] or \f[B]--global-stacks\f[R] options, non-zero
|
||||||
|
otherwise.
|
||||||
|
See the \f[B]OPTIONS\f[R] section.
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "19." 4
|
||||||
|
\f[B]leading_zero()\f[R]: \f[B]0\f[R] if leading zeroes are not enabled
|
||||||
|
with the \f[B]-z\f[R] or \f[B]\[en]leading-zeroes\f[R] options, non-zero
|
||||||
|
otherwise.
|
||||||
|
See the \f[B]OPTIONS\f[R] section.
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.SS Numbers
|
.SS Numbers
|
||||||
.PP
|
.PP
|
||||||
Numbers are strings made up of digits, uppercase letters, and at most
|
Numbers are strings made up of digits, uppercase letters, and at most
|
||||||
@ -1295,6 +1334,12 @@ greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
|
|||||||
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
|
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
|
||||||
including the backslash (\f[B]\[rs]\f[R]).
|
including the backslash (\f[B]\[rs]\f[R]).
|
||||||
The default line length is \f[B]70\f[R].
|
The default line length is \f[B]70\f[R].
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
The special value of \f[B]0\f[R] will disable line length checking and
|
||||||
|
print numbers without regard to line length and without backslashes and
|
||||||
|
newlines.
|
||||||
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]BC_BANNER\f[R]
|
\f[B]BC_BANNER\f[R]
|
||||||
If this environment variable exists and contains an integer, then a
|
If this environment variable exists and contains an integer, then a
|
||||||
|
@ -125,6 +125,14 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-L**, **-\-no-line-length**
|
||||||
|
|
||||||
|
: Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines. In other words, this option sets **BC_LINE_LENGTH** to **0** (see
|
||||||
|
the **ENVIRONMENT VARIABLES** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **-\-mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
@ -228,6 +236,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-z**, **-\-leading-zeroes**
|
||||||
|
|
||||||
|
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
|
||||||
|
not equal to **0**, with a leading zero.
|
||||||
|
|
||||||
|
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
|
||||||
|
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
|
||||||
|
the **LIBRARY** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **-\-expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
@ -442,6 +461,14 @@ The following are valid operands in bc(1):
|
|||||||
extension**.
|
extension**.
|
||||||
16. **maxscale()**: The max allowable **scale**. This is a **non-portable
|
16. **maxscale()**: The max allowable **scale**. This is a **non-portable
|
||||||
extension**.
|
extension**.
|
||||||
|
17. **line_length()**: The line length set with **BC_LINE_LENGTH** (see the
|
||||||
|
**ENVIRONMENT VARIABLES** section). This is a **non-portable extension**.
|
||||||
|
18. **global_stacks()**: **0** if global stacks are not enabled with the **-g**
|
||||||
|
or **-\-global-stacks** options, non-zero otherwise. See the **OPTIONS**
|
||||||
|
section. This is a **non-portable extension**.
|
||||||
|
19. **leading_zero()**: **0** if leading zeroes are not enabled with the **-z**
|
||||||
|
or **--leading-zeroes** options, non-zero otherwise. See the **OPTIONS**
|
||||||
|
section. This is a **non-portable extension**.
|
||||||
|
|
||||||
## Numbers
|
## Numbers
|
||||||
|
|
||||||
@ -1064,6 +1091,9 @@ bc(1) recognizes the following environment variables:
|
|||||||
lines to that length, including the backslash (**\\**). The default line
|
lines to that length, including the backslash (**\\**). The default line
|
||||||
length is **70**.
|
length is **70**.
|
||||||
|
|
||||||
|
The special value of **0** will disable line length checking and print
|
||||||
|
numbers without regard to line length and without backslashes and newlines.
|
||||||
|
|
||||||
**BC_BANNER**
|
**BC_BANNER**
|
||||||
|
|
||||||
: If this environment variable exists and contains an integer, then a non-zero
|
: If this environment variable exists and contains an integer, then a non-zero
|
||||||
|
@ -176,6 +176,16 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-L\f[R], \f[B]--no-line-length\f[R]
|
||||||
|
Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines.
|
||||||
|
In other words, this option sets \f[B]BC_LINE_LENGTH\f[R] to \f[B]0\f[R]
|
||||||
|
(see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library and the extended math library before
|
and loads the included math library and the extended math library before
|
||||||
@ -318,6 +328,18 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
|
||||||
|
Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
|
||||||
|
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This can be set for individual numbers with the \f[B]plz(x)\f[R],
|
||||||
|
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
|
||||||
|
extended math library (see the \f[B]LIBRARY\f[R] section).
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
@ -636,11 +658,28 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
\f[B]maxscale()\f[R]: The max allowable \f[B]scale\f[R].
|
\f[B]maxscale()\f[R]: The max allowable \f[B]scale\f[R].
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.IP "17." 4
|
.IP "17." 4
|
||||||
|
\f[B]line_length()\f[R]: The line length set with
|
||||||
|
\f[B]BC_LINE_LENGTH\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
|
||||||
|
section).
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "18." 4
|
||||||
|
\f[B]global_stacks()\f[R]: \f[B]0\f[R] if global stacks are not enabled
|
||||||
|
with the \f[B]-g\f[R] or \f[B]--global-stacks\f[R] options, non-zero
|
||||||
|
otherwise.
|
||||||
|
See the \f[B]OPTIONS\f[R] section.
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "19." 4
|
||||||
|
\f[B]leading_zero()\f[R]: \f[B]0\f[R] if leading zeroes are not enabled
|
||||||
|
with the \f[B]-z\f[R] or \f[B]\[en]leading-zeroes\f[R] options, non-zero
|
||||||
|
otherwise.
|
||||||
|
See the \f[B]OPTIONS\f[R] section.
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "20." 4
|
||||||
\f[B]rand()\f[R]: A pseudo-random integer between \f[B]0\f[R]
|
\f[B]rand()\f[R]: A pseudo-random integer between \f[B]0\f[R]
|
||||||
(inclusive) and \f[B]BC_RAND_MAX\f[R] (inclusive).
|
(inclusive) and \f[B]BC_RAND_MAX\f[R] (inclusive).
|
||||||
Using this operand will change the value of \f[B]seed\f[R].
|
Using this operand will change the value of \f[B]seed\f[R].
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.IP "18." 4
|
.IP "21." 4
|
||||||
\f[B]irand(E)\f[R]: A pseudo-random integer between \f[B]0\f[R]
|
\f[B]irand(E)\f[R]: A pseudo-random integer between \f[B]0\f[R]
|
||||||
(inclusive) and the value of \f[B]E\f[R] (exclusive).
|
(inclusive) and the value of \f[B]E\f[R] (exclusive).
|
||||||
If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[cq]s
|
If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[cq]s
|
||||||
@ -658,7 +697,7 @@ value of \f[B]E\f[R] is \f[B]0\f[R] or \f[B]1\f[R].
|
|||||||
In that case, \f[B]0\f[R] is returned, and \f[B]seed\f[R] is
|
In that case, \f[B]0\f[R] is returned, and \f[B]seed\f[R] is
|
||||||
\f[I]not\f[R] changed.
|
\f[I]not\f[R] changed.
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.IP "19." 4
|
.IP "22." 4
|
||||||
\f[B]maxrand()\f[R]: The max integer returned by \f[B]rand()\f[R].
|
\f[B]maxrand()\f[R]: The max integer returned by \f[B]rand()\f[R].
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.PP
|
.PP
|
||||||
@ -1937,6 +1976,46 @@ This function is used to implement other bitwise functions; it is not
|
|||||||
meant to be used by users, but it can be.
|
meant to be used by users, but it can be.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]plz(x)\f[R]
|
||||||
|
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that \f[B]-1\f[R]
|
||||||
|
and less than \f[B]1\f[R], it is printed with a leading zero, regardless
|
||||||
|
of the use of the \f[B]-z\f[R] option (see the \f[B]OPTIONS\f[R]
|
||||||
|
section) and without a trailing newline.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
Otherwise, \f[B]x\f[R] is printed normally, without a trailing newline.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\f[B]plznl(x)\f[R]
|
||||||
|
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that \f[B]-1\f[R]
|
||||||
|
and less than \f[B]1\f[R], it is printed with a leading zero, regardless
|
||||||
|
of the use of the \f[B]-z\f[R] option (see the \f[B]OPTIONS\f[R]
|
||||||
|
section) and with a trailing newline.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
Otherwise, \f[B]x\f[R] is printed normally, with a trailing newline.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\f[B]pnlz(x)\f[R]
|
||||||
|
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that \f[B]-1\f[R]
|
||||||
|
and less than \f[B]1\f[R], it is printed without a leading zero,
|
||||||
|
regardless of the use of the \f[B]-z\f[R] option (see the
|
||||||
|
\f[B]OPTIONS\f[R] section) and without a trailing newline.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
Otherwise, \f[B]x\f[R] is printed normally, without a trailing newline.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\f[B]pnlznl(x)\f[R]
|
||||||
|
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that \f[B]-1\f[R]
|
||||||
|
and less than \f[B]1\f[R], it is printed without a leading zero,
|
||||||
|
regardless of the use of the \f[B]-z\f[R] option (see the
|
||||||
|
\f[B]OPTIONS\f[R] section) and with a trailing newline.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
Otherwise, \f[B]x\f[R] is printed normally, with a trailing newline.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]ubytes(x)\f[R]
|
\f[B]ubytes(x)\f[R]
|
||||||
Returns the numbers of unsigned integer bytes required to hold the
|
Returns the numbers of unsigned integer bytes required to hold the
|
||||||
truncated absolute value of \f[B]x\f[R].
|
truncated absolute value of \f[B]x\f[R].
|
||||||
@ -2407,6 +2486,12 @@ greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
|
|||||||
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
|
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
|
||||||
including the backslash (\f[B]\[rs]\f[R]).
|
including the backslash (\f[B]\[rs]\f[R]).
|
||||||
The default line length is \f[B]70\f[R].
|
The default line length is \f[B]70\f[R].
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
The special value of \f[B]0\f[R] will disable line length checking and
|
||||||
|
print numbers without regard to line length and without backslashes and
|
||||||
|
newlines.
|
||||||
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]BC_BANNER\f[R]
|
\f[B]BC_BANNER\f[R]
|
||||||
If this environment variable exists and contains an integer, then a
|
If this environment variable exists and contains an integer, then a
|
||||||
|
@ -141,6 +141,14 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-L**, **-\-no-line-length**
|
||||||
|
|
||||||
|
: Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines. In other words, this option sets **BC_LINE_LENGTH** to **0** (see
|
||||||
|
the **ENVIRONMENT VARIABLES** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **-\-mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
@ -248,6 +256,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-z**, **-\-leading-zeroes**
|
||||||
|
|
||||||
|
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
|
||||||
|
not equal to **0**, with a leading zero.
|
||||||
|
|
||||||
|
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
|
||||||
|
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
|
||||||
|
the **LIBRARY** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **-\-expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
@ -488,10 +507,18 @@ The following are valid operands in bc(1):
|
|||||||
extension**.
|
extension**.
|
||||||
16. **maxscale()**: The max allowable **scale**. This is a **non-portable
|
16. **maxscale()**: The max allowable **scale**. This is a **non-portable
|
||||||
extension**.
|
extension**.
|
||||||
17. **rand()**: A pseudo-random integer between **0** (inclusive) and
|
17. **line_length()**: The line length set with **BC_LINE_LENGTH** (see the
|
||||||
|
**ENVIRONMENT VARIABLES** section). This is a **non-portable extension**.
|
||||||
|
18. **global_stacks()**: **0** if global stacks are not enabled with the **-g**
|
||||||
|
or **-\-global-stacks** options, non-zero otherwise. See the **OPTIONS**
|
||||||
|
section. This is a **non-portable extension**.
|
||||||
|
19. **leading_zero()**: **0** if leading zeroes are not enabled with the **-z**
|
||||||
|
or **--leading-zeroes** options, non-zero otherwise. See the **OPTIONS**
|
||||||
|
section. This is a **non-portable extension**.
|
||||||
|
20. **rand()**: A pseudo-random integer between **0** (inclusive) and
|
||||||
**BC_RAND_MAX** (inclusive). Using this operand will change the value of
|
**BC_RAND_MAX** (inclusive). Using this operand will change the value of
|
||||||
**seed**. This is a **non-portable extension**.
|
**seed**. This is a **non-portable extension**.
|
||||||
18. **irand(E)**: A pseudo-random integer between **0** (inclusive) and the
|
21. **irand(E)**: A pseudo-random integer between **0** (inclusive) and the
|
||||||
value of **E** (exclusive). If **E** is negative or is a non-integer
|
value of **E** (exclusive). If **E** is negative or is a non-integer
|
||||||
(**E**'s *scale* is not **0**), an error is raised, and bc(1) resets (see
|
(**E**'s *scale* is not **0**), an error is raised, and bc(1) resets (see
|
||||||
the **RESET** section) while **seed** remains unchanged. If **E** is larger
|
the **RESET** section) while **seed** remains unchanged. If **E** is larger
|
||||||
@ -502,7 +529,7 @@ The following are valid operands in bc(1):
|
|||||||
change the value of **seed**, unless the value of **E** is **0** or **1**.
|
change the value of **seed**, unless the value of **E** is **0** or **1**.
|
||||||
In that case, **0** is returned, and **seed** is *not* changed. This is a
|
In that case, **0** is returned, and **seed** is *not* changed. This is a
|
||||||
**non-portable extension**.
|
**non-portable extension**.
|
||||||
19. **maxrand()**: The max integer returned by **rand()**. This is a
|
22. **maxrand()**: The max integer returned by **rand()**. This is a
|
||||||
**non-portable extension**.
|
**non-portable extension**.
|
||||||
|
|
||||||
The integers generated by **rand()** and **irand(E)** are guaranteed to be as
|
The integers generated by **rand()** and **irand(E)** are guaranteed to be as
|
||||||
@ -1597,6 +1624,38 @@ The extended library is a **non-portable extension**.
|
|||||||
This function is used to implement other bitwise functions; it is not meant
|
This function is used to implement other bitwise functions; it is not meant
|
||||||
to be used by users, but it can be.
|
to be used by users, but it can be.
|
||||||
|
|
||||||
|
**plz(x)**
|
||||||
|
|
||||||
|
: If **x** is not equal to **0** and greater that **-1** and less than **1**,
|
||||||
|
it is printed with a leading zero, regardless of the use of the **-z**
|
||||||
|
option (see the **OPTIONS** section) and without a trailing newline.
|
||||||
|
|
||||||
|
Otherwise, **x** is printed normally, without a trailing newline.
|
||||||
|
|
||||||
|
**plznl(x)**
|
||||||
|
|
||||||
|
: If **x** is not equal to **0** and greater that **-1** and less than **1**,
|
||||||
|
it is printed with a leading zero, regardless of the use of the **-z**
|
||||||
|
option (see the **OPTIONS** section) and with a trailing newline.
|
||||||
|
|
||||||
|
Otherwise, **x** is printed normally, with a trailing newline.
|
||||||
|
|
||||||
|
**pnlz(x)**
|
||||||
|
|
||||||
|
: If **x** is not equal to **0** and greater that **-1** and less than **1**,
|
||||||
|
it is printed without a leading zero, regardless of the use of the **-z**
|
||||||
|
option (see the **OPTIONS** section) and without a trailing newline.
|
||||||
|
|
||||||
|
Otherwise, **x** is printed normally, without a trailing newline.
|
||||||
|
|
||||||
|
**pnlznl(x)**
|
||||||
|
|
||||||
|
: If **x** is not equal to **0** and greater that **-1** and less than **1**,
|
||||||
|
it is printed without a leading zero, regardless of the use of the **-z**
|
||||||
|
option (see the **OPTIONS** section) and with a trailing newline.
|
||||||
|
|
||||||
|
Otherwise, **x** is printed normally, with a trailing newline.
|
||||||
|
|
||||||
**ubytes(x)**
|
**ubytes(x)**
|
||||||
|
|
||||||
: Returns the numbers of unsigned integer bytes required to hold the truncated
|
: Returns the numbers of unsigned integer bytes required to hold the truncated
|
||||||
@ -2012,6 +2071,9 @@ bc(1) recognizes the following environment variables:
|
|||||||
lines to that length, including the backslash (**\\**). The default line
|
lines to that length, including the backslash (**\\**). The default line
|
||||||
length is **70**.
|
length is **70**.
|
||||||
|
|
||||||
|
The special value of **0** will disable line length checking and print
|
||||||
|
numbers without regard to line length and without backslashes and newlines.
|
||||||
|
|
||||||
**BC_BANNER**
|
**BC_BANNER**
|
||||||
|
|
||||||
: If this environment variable exists and contains an integer, then a non-zero
|
: If this environment variable exists and contains an integer, then a non-zero
|
||||||
|
@ -176,6 +176,16 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-L\f[R], \f[B]--no-line-length\f[R]
|
||||||
|
Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines.
|
||||||
|
In other words, this option sets \f[B]BC_LINE_LENGTH\f[R] to \f[B]0\f[R]
|
||||||
|
(see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library and the extended math library before
|
and loads the included math library and the extended math library before
|
||||||
@ -318,6 +328,18 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
|
||||||
|
Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
|
||||||
|
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This can be set for individual numbers with the \f[B]plz(x)\f[R],
|
||||||
|
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
|
||||||
|
extended math library (see the \f[B]LIBRARY\f[R] section).
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
@ -636,11 +658,28 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
\f[B]maxscale()\f[R]: The max allowable \f[B]scale\f[R].
|
\f[B]maxscale()\f[R]: The max allowable \f[B]scale\f[R].
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.IP "17." 4
|
.IP "17." 4
|
||||||
|
\f[B]line_length()\f[R]: The line length set with
|
||||||
|
\f[B]BC_LINE_LENGTH\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
|
||||||
|
section).
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "18." 4
|
||||||
|
\f[B]global_stacks()\f[R]: \f[B]0\f[R] if global stacks are not enabled
|
||||||
|
with the \f[B]-g\f[R] or \f[B]--global-stacks\f[R] options, non-zero
|
||||||
|
otherwise.
|
||||||
|
See the \f[B]OPTIONS\f[R] section.
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "19." 4
|
||||||
|
\f[B]leading_zero()\f[R]: \f[B]0\f[R] if leading zeroes are not enabled
|
||||||
|
with the \f[B]-z\f[R] or \f[B]\[en]leading-zeroes\f[R] options, non-zero
|
||||||
|
otherwise.
|
||||||
|
See the \f[B]OPTIONS\f[R] section.
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "20." 4
|
||||||
\f[B]rand()\f[R]: A pseudo-random integer between \f[B]0\f[R]
|
\f[B]rand()\f[R]: A pseudo-random integer between \f[B]0\f[R]
|
||||||
(inclusive) and \f[B]BC_RAND_MAX\f[R] (inclusive).
|
(inclusive) and \f[B]BC_RAND_MAX\f[R] (inclusive).
|
||||||
Using this operand will change the value of \f[B]seed\f[R].
|
Using this operand will change the value of \f[B]seed\f[R].
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.IP "18." 4
|
.IP "21." 4
|
||||||
\f[B]irand(E)\f[R]: A pseudo-random integer between \f[B]0\f[R]
|
\f[B]irand(E)\f[R]: A pseudo-random integer between \f[B]0\f[R]
|
||||||
(inclusive) and the value of \f[B]E\f[R] (exclusive).
|
(inclusive) and the value of \f[B]E\f[R] (exclusive).
|
||||||
If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[cq]s
|
If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[cq]s
|
||||||
@ -658,7 +697,7 @@ value of \f[B]E\f[R] is \f[B]0\f[R] or \f[B]1\f[R].
|
|||||||
In that case, \f[B]0\f[R] is returned, and \f[B]seed\f[R] is
|
In that case, \f[B]0\f[R] is returned, and \f[B]seed\f[R] is
|
||||||
\f[I]not\f[R] changed.
|
\f[I]not\f[R] changed.
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.IP "19." 4
|
.IP "22." 4
|
||||||
\f[B]maxrand()\f[R]: The max integer returned by \f[B]rand()\f[R].
|
\f[B]maxrand()\f[R]: The max integer returned by \f[B]rand()\f[R].
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.PP
|
.PP
|
||||||
@ -1937,6 +1976,46 @@ This function is used to implement other bitwise functions; it is not
|
|||||||
meant to be used by users, but it can be.
|
meant to be used by users, but it can be.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]plz(x)\f[R]
|
||||||
|
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that \f[B]-1\f[R]
|
||||||
|
and less than \f[B]1\f[R], it is printed with a leading zero, regardless
|
||||||
|
of the use of the \f[B]-z\f[R] option (see the \f[B]OPTIONS\f[R]
|
||||||
|
section) and without a trailing newline.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
Otherwise, \f[B]x\f[R] is printed normally, without a trailing newline.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\f[B]plznl(x)\f[R]
|
||||||
|
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that \f[B]-1\f[R]
|
||||||
|
and less than \f[B]1\f[R], it is printed with a leading zero, regardless
|
||||||
|
of the use of the \f[B]-z\f[R] option (see the \f[B]OPTIONS\f[R]
|
||||||
|
section) and with a trailing newline.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
Otherwise, \f[B]x\f[R] is printed normally, with a trailing newline.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\f[B]pnlz(x)\f[R]
|
||||||
|
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that \f[B]-1\f[R]
|
||||||
|
and less than \f[B]1\f[R], it is printed without a leading zero,
|
||||||
|
regardless of the use of the \f[B]-z\f[R] option (see the
|
||||||
|
\f[B]OPTIONS\f[R] section) and without a trailing newline.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
Otherwise, \f[B]x\f[R] is printed normally, without a trailing newline.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\f[B]pnlznl(x)\f[R]
|
||||||
|
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that \f[B]-1\f[R]
|
||||||
|
and less than \f[B]1\f[R], it is printed without a leading zero,
|
||||||
|
regardless of the use of the \f[B]-z\f[R] option (see the
|
||||||
|
\f[B]OPTIONS\f[R] section) and with a trailing newline.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
Otherwise, \f[B]x\f[R] is printed normally, with a trailing newline.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]ubytes(x)\f[R]
|
\f[B]ubytes(x)\f[R]
|
||||||
Returns the numbers of unsigned integer bytes required to hold the
|
Returns the numbers of unsigned integer bytes required to hold the
|
||||||
truncated absolute value of \f[B]x\f[R].
|
truncated absolute value of \f[B]x\f[R].
|
||||||
@ -2407,6 +2486,12 @@ greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
|
|||||||
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
|
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
|
||||||
including the backslash (\f[B]\[rs]\f[R]).
|
including the backslash (\f[B]\[rs]\f[R]).
|
||||||
The default line length is \f[B]70\f[R].
|
The default line length is \f[B]70\f[R].
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
The special value of \f[B]0\f[R] will disable line length checking and
|
||||||
|
print numbers without regard to line length and without backslashes and
|
||||||
|
newlines.
|
||||||
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]BC_BANNER\f[R]
|
\f[B]BC_BANNER\f[R]
|
||||||
If this environment variable exists and contains an integer, then a
|
If this environment variable exists and contains an integer, then a
|
||||||
|
@ -141,6 +141,14 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-L**, **-\-no-line-length**
|
||||||
|
|
||||||
|
: Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines. In other words, this option sets **BC_LINE_LENGTH** to **0** (see
|
||||||
|
the **ENVIRONMENT VARIABLES** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **-\-mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
@ -248,6 +256,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-z**, **-\-leading-zeroes**
|
||||||
|
|
||||||
|
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
|
||||||
|
not equal to **0**, with a leading zero.
|
||||||
|
|
||||||
|
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
|
||||||
|
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
|
||||||
|
the **LIBRARY** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **-\-expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
@ -488,10 +507,18 @@ The following are valid operands in bc(1):
|
|||||||
extension**.
|
extension**.
|
||||||
16. **maxscale()**: The max allowable **scale**. This is a **non-portable
|
16. **maxscale()**: The max allowable **scale**. This is a **non-portable
|
||||||
extension**.
|
extension**.
|
||||||
17. **rand()**: A pseudo-random integer between **0** (inclusive) and
|
17. **line_length()**: The line length set with **BC_LINE_LENGTH** (see the
|
||||||
|
**ENVIRONMENT VARIABLES** section). This is a **non-portable extension**.
|
||||||
|
18. **global_stacks()**: **0** if global stacks are not enabled with the **-g**
|
||||||
|
or **-\-global-stacks** options, non-zero otherwise. See the **OPTIONS**
|
||||||
|
section. This is a **non-portable extension**.
|
||||||
|
19. **leading_zero()**: **0** if leading zeroes are not enabled with the **-z**
|
||||||
|
or **--leading-zeroes** options, non-zero otherwise. See the **OPTIONS**
|
||||||
|
section. This is a **non-portable extension**.
|
||||||
|
20. **rand()**: A pseudo-random integer between **0** (inclusive) and
|
||||||
**BC_RAND_MAX** (inclusive). Using this operand will change the value of
|
**BC_RAND_MAX** (inclusive). Using this operand will change the value of
|
||||||
**seed**. This is a **non-portable extension**.
|
**seed**. This is a **non-portable extension**.
|
||||||
18. **irand(E)**: A pseudo-random integer between **0** (inclusive) and the
|
21. **irand(E)**: A pseudo-random integer between **0** (inclusive) and the
|
||||||
value of **E** (exclusive). If **E** is negative or is a non-integer
|
value of **E** (exclusive). If **E** is negative or is a non-integer
|
||||||
(**E**'s *scale* is not **0**), an error is raised, and bc(1) resets (see
|
(**E**'s *scale* is not **0**), an error is raised, and bc(1) resets (see
|
||||||
the **RESET** section) while **seed** remains unchanged. If **E** is larger
|
the **RESET** section) while **seed** remains unchanged. If **E** is larger
|
||||||
@ -502,7 +529,7 @@ The following are valid operands in bc(1):
|
|||||||
change the value of **seed**, unless the value of **E** is **0** or **1**.
|
change the value of **seed**, unless the value of **E** is **0** or **1**.
|
||||||
In that case, **0** is returned, and **seed** is *not* changed. This is a
|
In that case, **0** is returned, and **seed** is *not* changed. This is a
|
||||||
**non-portable extension**.
|
**non-portable extension**.
|
||||||
19. **maxrand()**: The max integer returned by **rand()**. This is a
|
22. **maxrand()**: The max integer returned by **rand()**. This is a
|
||||||
**non-portable extension**.
|
**non-portable extension**.
|
||||||
|
|
||||||
The integers generated by **rand()** and **irand(E)** are guaranteed to be as
|
The integers generated by **rand()** and **irand(E)** are guaranteed to be as
|
||||||
@ -1597,6 +1624,38 @@ The extended library is a **non-portable extension**.
|
|||||||
This function is used to implement other bitwise functions; it is not meant
|
This function is used to implement other bitwise functions; it is not meant
|
||||||
to be used by users, but it can be.
|
to be used by users, but it can be.
|
||||||
|
|
||||||
|
**plz(x)**
|
||||||
|
|
||||||
|
: If **x** is not equal to **0** and greater that **-1** and less than **1**,
|
||||||
|
it is printed with a leading zero, regardless of the use of the **-z**
|
||||||
|
option (see the **OPTIONS** section) and without a trailing newline.
|
||||||
|
|
||||||
|
Otherwise, **x** is printed normally, without a trailing newline.
|
||||||
|
|
||||||
|
**plznl(x)**
|
||||||
|
|
||||||
|
: If **x** is not equal to **0** and greater that **-1** and less than **1**,
|
||||||
|
it is printed with a leading zero, regardless of the use of the **-z**
|
||||||
|
option (see the **OPTIONS** section) and with a trailing newline.
|
||||||
|
|
||||||
|
Otherwise, **x** is printed normally, with a trailing newline.
|
||||||
|
|
||||||
|
**pnlz(x)**
|
||||||
|
|
||||||
|
: If **x** is not equal to **0** and greater that **-1** and less than **1**,
|
||||||
|
it is printed without a leading zero, regardless of the use of the **-z**
|
||||||
|
option (see the **OPTIONS** section) and without a trailing newline.
|
||||||
|
|
||||||
|
Otherwise, **x** is printed normally, without a trailing newline.
|
||||||
|
|
||||||
|
**pnlznl(x)**
|
||||||
|
|
||||||
|
: If **x** is not equal to **0** and greater that **-1** and less than **1**,
|
||||||
|
it is printed without a leading zero, regardless of the use of the **-z**
|
||||||
|
option (see the **OPTIONS** section) and with a trailing newline.
|
||||||
|
|
||||||
|
Otherwise, **x** is printed normally, with a trailing newline.
|
||||||
|
|
||||||
**ubytes(x)**
|
**ubytes(x)**
|
||||||
|
|
||||||
: Returns the numbers of unsigned integer bytes required to hold the truncated
|
: Returns the numbers of unsigned integer bytes required to hold the truncated
|
||||||
@ -2012,6 +2071,9 @@ bc(1) recognizes the following environment variables:
|
|||||||
lines to that length, including the backslash (**\\**). The default line
|
lines to that length, including the backslash (**\\**). The default line
|
||||||
length is **70**.
|
length is **70**.
|
||||||
|
|
||||||
|
The special value of **0** will disable line length checking and print
|
||||||
|
numbers without regard to line length and without backslashes and newlines.
|
||||||
|
|
||||||
**BC_BANNER**
|
**BC_BANNER**
|
||||||
|
|
||||||
: If this environment variable exists and contains an integer, then a non-zero
|
: If this environment variable exists and contains an integer, then a non-zero
|
||||||
|
@ -176,6 +176,16 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-L\f[R], \f[B]--no-line-length\f[R]
|
||||||
|
Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines.
|
||||||
|
In other words, this option sets \f[B]BC_LINE_LENGTH\f[R] to \f[B]0\f[R]
|
||||||
|
(see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library and the extended math library before
|
and loads the included math library and the extended math library before
|
||||||
@ -318,6 +328,18 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
|
||||||
|
Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
|
||||||
|
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This can be set for individual numbers with the \f[B]plz(x)\f[R],
|
||||||
|
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
|
||||||
|
extended math library (see the \f[B]LIBRARY\f[R] section).
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
@ -636,11 +658,28 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
\f[B]maxscale()\f[R]: The max allowable \f[B]scale\f[R].
|
\f[B]maxscale()\f[R]: The max allowable \f[B]scale\f[R].
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.IP "17." 4
|
.IP "17." 4
|
||||||
|
\f[B]line_length()\f[R]: The line length set with
|
||||||
|
\f[B]BC_LINE_LENGTH\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
|
||||||
|
section).
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "18." 4
|
||||||
|
\f[B]global_stacks()\f[R]: \f[B]0\f[R] if global stacks are not enabled
|
||||||
|
with the \f[B]-g\f[R] or \f[B]--global-stacks\f[R] options, non-zero
|
||||||
|
otherwise.
|
||||||
|
See the \f[B]OPTIONS\f[R] section.
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "19." 4
|
||||||
|
\f[B]leading_zero()\f[R]: \f[B]0\f[R] if leading zeroes are not enabled
|
||||||
|
with the \f[B]-z\f[R] or \f[B]\[en]leading-zeroes\f[R] options, non-zero
|
||||||
|
otherwise.
|
||||||
|
See the \f[B]OPTIONS\f[R] section.
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.IP "20." 4
|
||||||
\f[B]rand()\f[R]: A pseudo-random integer between \f[B]0\f[R]
|
\f[B]rand()\f[R]: A pseudo-random integer between \f[B]0\f[R]
|
||||||
(inclusive) and \f[B]BC_RAND_MAX\f[R] (inclusive).
|
(inclusive) and \f[B]BC_RAND_MAX\f[R] (inclusive).
|
||||||
Using this operand will change the value of \f[B]seed\f[R].
|
Using this operand will change the value of \f[B]seed\f[R].
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.IP "18." 4
|
.IP "21." 4
|
||||||
\f[B]irand(E)\f[R]: A pseudo-random integer between \f[B]0\f[R]
|
\f[B]irand(E)\f[R]: A pseudo-random integer between \f[B]0\f[R]
|
||||||
(inclusive) and the value of \f[B]E\f[R] (exclusive).
|
(inclusive) and the value of \f[B]E\f[R] (exclusive).
|
||||||
If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[cq]s
|
If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[cq]s
|
||||||
@ -658,7 +697,7 @@ value of \f[B]E\f[R] is \f[B]0\f[R] or \f[B]1\f[R].
|
|||||||
In that case, \f[B]0\f[R] is returned, and \f[B]seed\f[R] is
|
In that case, \f[B]0\f[R] is returned, and \f[B]seed\f[R] is
|
||||||
\f[I]not\f[R] changed.
|
\f[I]not\f[R] changed.
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.IP "19." 4
|
.IP "22." 4
|
||||||
\f[B]maxrand()\f[R]: The max integer returned by \f[B]rand()\f[R].
|
\f[B]maxrand()\f[R]: The max integer returned by \f[B]rand()\f[R].
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.PP
|
.PP
|
||||||
@ -1937,6 +1976,46 @@ This function is used to implement other bitwise functions; it is not
|
|||||||
meant to be used by users, but it can be.
|
meant to be used by users, but it can be.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]plz(x)\f[R]
|
||||||
|
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that \f[B]-1\f[R]
|
||||||
|
and less than \f[B]1\f[R], it is printed with a leading zero, regardless
|
||||||
|
of the use of the \f[B]-z\f[R] option (see the \f[B]OPTIONS\f[R]
|
||||||
|
section) and without a trailing newline.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
Otherwise, \f[B]x\f[R] is printed normally, without a trailing newline.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\f[B]plznl(x)\f[R]
|
||||||
|
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that \f[B]-1\f[R]
|
||||||
|
and less than \f[B]1\f[R], it is printed with a leading zero, regardless
|
||||||
|
of the use of the \f[B]-z\f[R] option (see the \f[B]OPTIONS\f[R]
|
||||||
|
section) and with a trailing newline.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
Otherwise, \f[B]x\f[R] is printed normally, with a trailing newline.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\f[B]pnlz(x)\f[R]
|
||||||
|
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that \f[B]-1\f[R]
|
||||||
|
and less than \f[B]1\f[R], it is printed without a leading zero,
|
||||||
|
regardless of the use of the \f[B]-z\f[R] option (see the
|
||||||
|
\f[B]OPTIONS\f[R] section) and without a trailing newline.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
Otherwise, \f[B]x\f[R] is printed normally, without a trailing newline.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\f[B]pnlznl(x)\f[R]
|
||||||
|
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that \f[B]-1\f[R]
|
||||||
|
and less than \f[B]1\f[R], it is printed without a leading zero,
|
||||||
|
regardless of the use of the \f[B]-z\f[R] option (see the
|
||||||
|
\f[B]OPTIONS\f[R] section) and with a trailing newline.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
Otherwise, \f[B]x\f[R] is printed normally, with a trailing newline.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]ubytes(x)\f[R]
|
\f[B]ubytes(x)\f[R]
|
||||||
Returns the numbers of unsigned integer bytes required to hold the
|
Returns the numbers of unsigned integer bytes required to hold the
|
||||||
truncated absolute value of \f[B]x\f[R].
|
truncated absolute value of \f[B]x\f[R].
|
||||||
@ -2407,6 +2486,12 @@ greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
|
|||||||
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
|
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
|
||||||
including the backslash (\f[B]\[rs]\f[R]).
|
including the backslash (\f[B]\[rs]\f[R]).
|
||||||
The default line length is \f[B]70\f[R].
|
The default line length is \f[B]70\f[R].
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
The special value of \f[B]0\f[R] will disable line length checking and
|
||||||
|
print numbers without regard to line length and without backslashes and
|
||||||
|
newlines.
|
||||||
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]BC_BANNER\f[R]
|
\f[B]BC_BANNER\f[R]
|
||||||
If this environment variable exists and contains an integer, then a
|
If this environment variable exists and contains an integer, then a
|
||||||
|
@ -141,6 +141,14 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-L**, **-\-no-line-length**
|
||||||
|
|
||||||
|
: Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines. In other words, this option sets **BC_LINE_LENGTH** to **0** (see
|
||||||
|
the **ENVIRONMENT VARIABLES** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **-\-mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
@ -248,6 +256,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-z**, **-\-leading-zeroes**
|
||||||
|
|
||||||
|
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
|
||||||
|
not equal to **0**, with a leading zero.
|
||||||
|
|
||||||
|
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
|
||||||
|
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
|
||||||
|
the **LIBRARY** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **-\-expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
@ -488,10 +507,18 @@ The following are valid operands in bc(1):
|
|||||||
extension**.
|
extension**.
|
||||||
16. **maxscale()**: The max allowable **scale**. This is a **non-portable
|
16. **maxscale()**: The max allowable **scale**. This is a **non-portable
|
||||||
extension**.
|
extension**.
|
||||||
17. **rand()**: A pseudo-random integer between **0** (inclusive) and
|
17. **line_length()**: The line length set with **BC_LINE_LENGTH** (see the
|
||||||
|
**ENVIRONMENT VARIABLES** section). This is a **non-portable extension**.
|
||||||
|
18. **global_stacks()**: **0** if global stacks are not enabled with the **-g**
|
||||||
|
or **-\-global-stacks** options, non-zero otherwise. See the **OPTIONS**
|
||||||
|
section. This is a **non-portable extension**.
|
||||||
|
19. **leading_zero()**: **0** if leading zeroes are not enabled with the **-z**
|
||||||
|
or **--leading-zeroes** options, non-zero otherwise. See the **OPTIONS**
|
||||||
|
section. This is a **non-portable extension**.
|
||||||
|
20. **rand()**: A pseudo-random integer between **0** (inclusive) and
|
||||||
**BC_RAND_MAX** (inclusive). Using this operand will change the value of
|
**BC_RAND_MAX** (inclusive). Using this operand will change the value of
|
||||||
**seed**. This is a **non-portable extension**.
|
**seed**. This is a **non-portable extension**.
|
||||||
18. **irand(E)**: A pseudo-random integer between **0** (inclusive) and the
|
21. **irand(E)**: A pseudo-random integer between **0** (inclusive) and the
|
||||||
value of **E** (exclusive). If **E** is negative or is a non-integer
|
value of **E** (exclusive). If **E** is negative or is a non-integer
|
||||||
(**E**'s *scale* is not **0**), an error is raised, and bc(1) resets (see
|
(**E**'s *scale* is not **0**), an error is raised, and bc(1) resets (see
|
||||||
the **RESET** section) while **seed** remains unchanged. If **E** is larger
|
the **RESET** section) while **seed** remains unchanged. If **E** is larger
|
||||||
@ -502,7 +529,7 @@ The following are valid operands in bc(1):
|
|||||||
change the value of **seed**, unless the value of **E** is **0** or **1**.
|
change the value of **seed**, unless the value of **E** is **0** or **1**.
|
||||||
In that case, **0** is returned, and **seed** is *not* changed. This is a
|
In that case, **0** is returned, and **seed** is *not* changed. This is a
|
||||||
**non-portable extension**.
|
**non-portable extension**.
|
||||||
19. **maxrand()**: The max integer returned by **rand()**. This is a
|
22. **maxrand()**: The max integer returned by **rand()**. This is a
|
||||||
**non-portable extension**.
|
**non-portable extension**.
|
||||||
|
|
||||||
The integers generated by **rand()** and **irand(E)** are guaranteed to be as
|
The integers generated by **rand()** and **irand(E)** are guaranteed to be as
|
||||||
@ -1597,6 +1624,38 @@ The extended library is a **non-portable extension**.
|
|||||||
This function is used to implement other bitwise functions; it is not meant
|
This function is used to implement other bitwise functions; it is not meant
|
||||||
to be used by users, but it can be.
|
to be used by users, but it can be.
|
||||||
|
|
||||||
|
**plz(x)**
|
||||||
|
|
||||||
|
: If **x** is not equal to **0** and greater that **-1** and less than **1**,
|
||||||
|
it is printed with a leading zero, regardless of the use of the **-z**
|
||||||
|
option (see the **OPTIONS** section) and without a trailing newline.
|
||||||
|
|
||||||
|
Otherwise, **x** is printed normally, without a trailing newline.
|
||||||
|
|
||||||
|
**plznl(x)**
|
||||||
|
|
||||||
|
: If **x** is not equal to **0** and greater that **-1** and less than **1**,
|
||||||
|
it is printed with a leading zero, regardless of the use of the **-z**
|
||||||
|
option (see the **OPTIONS** section) and with a trailing newline.
|
||||||
|
|
||||||
|
Otherwise, **x** is printed normally, with a trailing newline.
|
||||||
|
|
||||||
|
**pnlz(x)**
|
||||||
|
|
||||||
|
: If **x** is not equal to **0** and greater that **-1** and less than **1**,
|
||||||
|
it is printed without a leading zero, regardless of the use of the **-z**
|
||||||
|
option (see the **OPTIONS** section) and without a trailing newline.
|
||||||
|
|
||||||
|
Otherwise, **x** is printed normally, without a trailing newline.
|
||||||
|
|
||||||
|
**pnlznl(x)**
|
||||||
|
|
||||||
|
: If **x** is not equal to **0** and greater that **-1** and less than **1**,
|
||||||
|
it is printed without a leading zero, regardless of the use of the **-z**
|
||||||
|
option (see the **OPTIONS** section) and with a trailing newline.
|
||||||
|
|
||||||
|
Otherwise, **x** is printed normally, with a trailing newline.
|
||||||
|
|
||||||
**ubytes(x)**
|
**ubytes(x)**
|
||||||
|
|
||||||
: Returns the numbers of unsigned integer bytes required to hold the truncated
|
: Returns the numbers of unsigned integer bytes required to hold the truncated
|
||||||
@ -2012,6 +2071,9 @@ bc(1) recognizes the following environment variables:
|
|||||||
lines to that length, including the backslash (**\\**). The default line
|
lines to that length, including the backslash (**\\**). The default line
|
||||||
length is **70**.
|
length is **70**.
|
||||||
|
|
||||||
|
The special value of **0** will disable line length checking and print
|
||||||
|
numbers without regard to line length and without backslashes and newlines.
|
||||||
|
|
||||||
**BC_BANNER**
|
**BC_BANNER**
|
||||||
|
|
||||||
: If this environment variable exists and contains an integer, then a non-zero
|
: If this environment variable exists and contains an integer, then a non-zero
|
||||||
|
@ -55,6 +55,11 @@ These items allow clients to set up bcl(3).
|
|||||||
.PP
|
.PP
|
||||||
\f[B]void bcl_setAbortOnFatalError(bool\f[R] \f[I]abrt\f[R]\f[B]);\f[R]
|
\f[B]void bcl_setAbortOnFatalError(bool\f[R] \f[I]abrt\f[R]\f[B]);\f[R]
|
||||||
.PP
|
.PP
|
||||||
|
\f[B]bool bcl_leadingZeroes(\f[R]\f[I]void\f[R]\f[B]);\f[R]
|
||||||
|
.PP
|
||||||
|
\f[B]void bcl_setLeadingZeroes(bool\f[R]
|
||||||
|
\f[I]leadingZeroes\f[R]\f[B]);\f[R]
|
||||||
|
.PP
|
||||||
\f[B]void bcl_gc(\f[R]\f[I]void\f[R]\f[B]);\f[R]
|
\f[B]void bcl_gc(\f[R]\f[I]void\f[R]\f[B]);\f[R]
|
||||||
.SS Contexts
|
.SS Contexts
|
||||||
.PP
|
.PP
|
||||||
@ -231,8 +236,9 @@ bcl(3) is async-signal-safe if
|
|||||||
\f[B]bcl_handleSignal(\f[R]\f[I]void\f[R]\f[B])\f[R] is used properly.
|
\f[B]bcl_handleSignal(\f[R]\f[I]void\f[R]\f[B])\f[R] is used properly.
|
||||||
(See the \f[B]SIGNAL HANDLING\f[R] section.)
|
(See the \f[B]SIGNAL HANDLING\f[R] section.)
|
||||||
.PP
|
.PP
|
||||||
bcl(3) assumes that it is allowed to use the \f[B]bcl_\f[R] and
|
bcl(3) assumes that it is allowed to use the \f[B]bcl\f[R],
|
||||||
\f[B]bc_\f[R] prefixes for symbol names without collision.
|
\f[B]Bcl\f[R], \f[B]bc\f[R], and \f[B]Bc\f[R] prefixes for symbol names
|
||||||
|
without collision.
|
||||||
.PP
|
.PP
|
||||||
All of the items in its interface are described below.
|
All of the items in its interface are described below.
|
||||||
See the documentation for each function for what each function can
|
See the documentation for each function for what each function can
|
||||||
@ -304,6 +310,8 @@ a fatal error occurs.
|
|||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
If activated, clients do not need to check for fatal errors.
|
If activated, clients do not need to check for fatal errors.
|
||||||
|
.PP
|
||||||
|
The default is \f[B]false\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]void bcl_setAbortOnFatalError(bool\f[R] \f[I]abrt\f[R]\f[B])\f[R]
|
\f[B]void bcl_setAbortOnFatalError(bool\f[R] \f[I]abrt\f[R]\f[B])\f[R]
|
||||||
@ -317,6 +325,23 @@ If \f[I]abrt\f[R] is \f[B]true\f[R], bcl(3) will cause a
|
|||||||
If activated, clients do not need to check for fatal errors.
|
If activated, clients do not need to check for fatal errors.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]bool bcl_leadingZeroes(\f[R]\f[I]void\f[R]\f[B])\f[R]
|
||||||
|
Queries and returns the state of whether leading zeroes are added to
|
||||||
|
strings returned by \f[B]bcl_string()\f[R] when numbers are greater than
|
||||||
|
\f[B]-1\f[R], less than \f[B]1\f[R], and not equal to \f[B]0\f[R].
|
||||||
|
If \f[B]true\f[R] is returned, then leading zeroes will be added.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
The default is \f[B]false\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
|
\f[B]void bcl_setLeadingZeroes(bool\f[R] \f[I]leadingZeroes\f[R]\f[B])\f[R]
|
||||||
|
Sets the state of whether leading zeroes are added to strings returned
|
||||||
|
by \f[B]bcl_string()\f[R] when numbers are greater than \f[B]-1\f[R],
|
||||||
|
less than \f[B]1\f[R], and not equal to \f[B]0\f[R].
|
||||||
|
If \f[I]leadingZeroes\f[R] is \f[B]true\f[R], leading zeroes will be
|
||||||
|
added to strings returned by \f[B]bcl_string()\f[R].
|
||||||
|
.TP
|
||||||
\f[B]void bcl_gc(\f[R]\f[I]void\f[R]\f[B])\f[R]
|
\f[B]void bcl_gc(\f[R]\f[I]void\f[R]\f[B])\f[R]
|
||||||
Garbage collects cached instances of arbitrary-precision numbers.
|
Garbage collects cached instances of arbitrary-precision numbers.
|
||||||
This only frees the memory of numbers that are \f[I]not\f[R] in use, so
|
This only frees the memory of numbers that are \f[I]not\f[R] in use, so
|
||||||
|
@ -61,6 +61,10 @@ These items allow clients to set up bcl(3).
|
|||||||
|
|
||||||
**void bcl_setAbortOnFatalError(bool** _abrt_**);**
|
**void bcl_setAbortOnFatalError(bool** _abrt_**);**
|
||||||
|
|
||||||
|
**bool bcl_leadingZeroes(**_void_**);**
|
||||||
|
|
||||||
|
**void bcl_setLeadingZeroes(bool** _leadingZeroes_**);**
|
||||||
|
|
||||||
**void bcl_gc(**_void_**);**
|
**void bcl_gc(**_void_**);**
|
||||||
|
|
||||||
## Contexts
|
## Contexts
|
||||||
@ -216,8 +220,8 @@ bcl(3) is a library that implements arbitrary-precision decimal math, as
|
|||||||
bcl(3) is async-signal-safe if **bcl_handleSignal(**_void_**)** is used
|
bcl(3) is async-signal-safe if **bcl_handleSignal(**_void_**)** is used
|
||||||
properly. (See the **SIGNAL HANDLING** section.)
|
properly. (See the **SIGNAL HANDLING** section.)
|
||||||
|
|
||||||
bcl(3) assumes that it is allowed to use the **bcl_** and **bc_** prefixes for
|
bcl(3) assumes that it is allowed to use the **bcl**, **Bcl**, **bc**, and
|
||||||
symbol names without collision.
|
**Bc** prefixes for symbol names without collision.
|
||||||
|
|
||||||
All of the items in its interface are described below. See the documentation for
|
All of the items in its interface are described below. See the documentation for
|
||||||
each function for what each function can return.
|
each function for what each function can return.
|
||||||
@ -280,6 +284,8 @@ each function for what each function can return.
|
|||||||
|
|
||||||
If activated, clients do not need to check for fatal errors.
|
If activated, clients do not need to check for fatal errors.
|
||||||
|
|
||||||
|
The default is **false**.
|
||||||
|
|
||||||
**void bcl_setAbortOnFatalError(bool** _abrt_**)**
|
**void bcl_setAbortOnFatalError(bool** _abrt_**)**
|
||||||
|
|
||||||
: Sets the state of calling **abort()** on fatal errors. If *abrt* is
|
: Sets the state of calling **abort()** on fatal errors. If *abrt* is
|
||||||
@ -289,6 +295,22 @@ each function for what each function can return.
|
|||||||
|
|
||||||
If activated, clients do not need to check for fatal errors.
|
If activated, clients do not need to check for fatal errors.
|
||||||
|
|
||||||
|
**bool bcl_leadingZeroes(**_void_**)**
|
||||||
|
|
||||||
|
: Queries and returns the state of whether leading zeroes are added to strings
|
||||||
|
returned by **bcl_string()** when numbers are greater than **-1**, less than
|
||||||
|
**1**, and not equal to **0**. If **true** is returned, then leading zeroes
|
||||||
|
will be added.
|
||||||
|
|
||||||
|
The default is **false**.
|
||||||
|
|
||||||
|
**void bcl_setLeadingZeroes(bool** _leadingZeroes_**)**
|
||||||
|
|
||||||
|
: Sets the state of whether leading zeroes are added to strings returned by
|
||||||
|
**bcl_string()** when numbers are greater than **-1**, less than **1**, and
|
||||||
|
not equal to **0**. If *leadingZeroes* is **true**, leading zeroes will be
|
||||||
|
added to strings returned by **bcl_string()**.
|
||||||
|
|
||||||
**void bcl_gc(**_void_**)**
|
**void bcl_gc(**_void_**)**
|
||||||
|
|
||||||
: Garbage collects cached instances of arbitrary-precision numbers. This only
|
: Garbage collects cached instances of arbitrary-precision numbers. This only
|
||||||
|
@ -46,7 +46,7 @@ However, if you wish to build it yourself, this `bc` can be built using Visual
|
|||||||
Studio or MSBuild.
|
Studio or MSBuild.
|
||||||
|
|
||||||
Unfortunately, only one build configuration (besides Debug or Release) is
|
Unfortunately, only one build configuration (besides Debug or Release) is
|
||||||
supported: extra math, and history enabled, NLS (locale support) disabled, with
|
supported: extra math enabled, history and NLS (locale support) disabled, with
|
||||||
both calculators built. The default [settings][11] are `BC_BANNER=1`,
|
both calculators built. The default [settings][11] are `BC_BANNER=1`,
|
||||||
`{BC,DC}_SIGINT_RESET=0`, `{BC,DC}_TTY_MODE=1`, `{BC,DC}_PROMPT=1`.
|
`{BC,DC}_SIGINT_RESET=0`, `{BC,DC}_TTY_MODE=1`, `{BC,DC}_PROMPT=1`.
|
||||||
|
|
||||||
|
@ -73,6 +73,16 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-L\f[R], \f[B]--no-line-length\f[R]
|
||||||
|
Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines.
|
||||||
|
In other words, this option sets \f[B]BC_LINE_LENGTH\f[R] to \f[B]0\f[R]
|
||||||
|
(see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
@ -118,6 +128,18 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
|
||||||
|
Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
|
||||||
|
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This can be set for individual numbers with the \f[B]plz(x)\f[R],
|
||||||
|
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
|
||||||
|
extended math library (see the \f[B]LIBRARY\f[R] section).
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
@ -1072,6 +1094,23 @@ Pushes the length of the array \f[I]r\f[R] onto the stack.
|
|||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
|
.SS Global Settings
|
||||||
|
.PP
|
||||||
|
These commands retrieve global settings.
|
||||||
|
These are the only commands that require multiple specific characters,
|
||||||
|
and all of them begin with the letter \f[B]g\f[R].
|
||||||
|
Only the characters below are allowed after the character \f[B]g\f[R];
|
||||||
|
any other character produces a parse error (see the \f[B]ERRORS\f[R]
|
||||||
|
section).
|
||||||
|
.TP
|
||||||
|
\f[B]gl\f[R]
|
||||||
|
Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the
|
||||||
|
\f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack.
|
||||||
|
.TP
|
||||||
|
\f[B]gz\f[R]
|
||||||
|
Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
|
||||||
|
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options
|
||||||
|
(see the \f[B]OPTIONS\f[R] section), non-zero otherwise.
|
||||||
.SH REGISTERS
|
.SH REGISTERS
|
||||||
.PP
|
.PP
|
||||||
Registers are names that can store strings, numbers, and arrays.
|
Registers are names that can store strings, numbers, and arrays.
|
||||||
@ -1249,6 +1288,12 @@ greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
|
|||||||
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
|
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
|
||||||
including the backslash newline combo.
|
including the backslash newline combo.
|
||||||
The default line length is \f[B]70\f[R].
|
The default line length is \f[B]70\f[R].
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
The special value of \f[B]0\f[R] will disable line length checking and
|
||||||
|
print numbers without regard to line length and without backslashes and
|
||||||
|
newlines.
|
||||||
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]DC_SIGINT_RESET\f[R]
|
\f[B]DC_SIGINT_RESET\f[R]
|
||||||
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
|
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
|
||||||
|
@ -69,6 +69,14 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-L**, **-\-no-line-length**
|
||||||
|
|
||||||
|
: Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines. In other words, this option sets **BC_LINE_LENGTH** to **0** (see
|
||||||
|
the **ENVIRONMENT VARIABLES** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **-\-no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
@ -106,6 +114,17 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-z**, **-\-leading-zeroes**
|
||||||
|
|
||||||
|
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
|
||||||
|
not equal to **0**, with a leading zero.
|
||||||
|
|
||||||
|
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
|
||||||
|
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
|
||||||
|
the **LIBRARY** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **-\-expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
@ -942,6 +961,24 @@ These commands manipulate arrays.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
## Global Settings
|
||||||
|
|
||||||
|
These commands retrieve global settings. These are the only commands that
|
||||||
|
require multiple specific characters, and all of them begin with the letter
|
||||||
|
**g**. Only the characters below are allowed after the character **g**; any
|
||||||
|
other character produces a parse error (see the **ERRORS** section).
|
||||||
|
|
||||||
|
**gl**
|
||||||
|
|
||||||
|
: Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT
|
||||||
|
VARIABLES** section) onto the stack.
|
||||||
|
|
||||||
|
**gz**
|
||||||
|
|
||||||
|
: Pushes **0** onto the stack if the leading zero setting has not been enabled
|
||||||
|
with the **-z** or **-\-leading-zeroes** options (see the **OPTIONS**
|
||||||
|
section), non-zero otherwise.
|
||||||
|
|
||||||
# REGISTERS
|
# REGISTERS
|
||||||
|
|
||||||
Registers are names that can store strings, numbers, and arrays. (Number/string
|
Registers are names that can store strings, numbers, and arrays. (Number/string
|
||||||
@ -1108,6 +1145,9 @@ dc(1) recognizes the following environment variables:
|
|||||||
lines to that length, including the backslash newline combo. The default
|
lines to that length, including the backslash newline combo. The default
|
||||||
line length is **70**.
|
line length is **70**.
|
||||||
|
|
||||||
|
The special value of **0** will disable line length checking and print
|
||||||
|
numbers without regard to line length and without backslashes and newlines.
|
||||||
|
|
||||||
**DC_SIGINT_RESET**
|
**DC_SIGINT_RESET**
|
||||||
|
|
||||||
: If dc(1) is not in interactive mode (see the **INTERACTIVE MODE** section),
|
: If dc(1) is not in interactive mode (see the **INTERACTIVE MODE** section),
|
||||||
|
@ -73,6 +73,16 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-L\f[R], \f[B]--no-line-length\f[R]
|
||||||
|
Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines.
|
||||||
|
In other words, this option sets \f[B]BC_LINE_LENGTH\f[R] to \f[B]0\f[R]
|
||||||
|
(see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
@ -118,6 +128,18 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
|
||||||
|
Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
|
||||||
|
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This can be set for individual numbers with the \f[B]plz(x)\f[R],
|
||||||
|
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
|
||||||
|
extended math library (see the \f[B]LIBRARY\f[R] section).
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
@ -872,6 +894,23 @@ Pushes the length of the array \f[I]r\f[R] onto the stack.
|
|||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
|
.SS Global Settings
|
||||||
|
.PP
|
||||||
|
These commands retrieve global settings.
|
||||||
|
These are the only commands that require multiple specific characters,
|
||||||
|
and all of them begin with the letter \f[B]g\f[R].
|
||||||
|
Only the characters below are allowed after the character \f[B]g\f[R];
|
||||||
|
any other character produces a parse error (see the \f[B]ERRORS\f[R]
|
||||||
|
section).
|
||||||
|
.TP
|
||||||
|
\f[B]gl\f[R]
|
||||||
|
Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the
|
||||||
|
\f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack.
|
||||||
|
.TP
|
||||||
|
\f[B]gz\f[R]
|
||||||
|
Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
|
||||||
|
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options
|
||||||
|
(see the \f[B]OPTIONS\f[R] section), non-zero otherwise.
|
||||||
.SH REGISTERS
|
.SH REGISTERS
|
||||||
.PP
|
.PP
|
||||||
Registers are names that can store strings, numbers, and arrays.
|
Registers are names that can store strings, numbers, and arrays.
|
||||||
@ -1044,6 +1083,12 @@ greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
|
|||||||
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
|
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
|
||||||
including the backslash newline combo.
|
including the backslash newline combo.
|
||||||
The default line length is \f[B]70\f[R].
|
The default line length is \f[B]70\f[R].
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
The special value of \f[B]0\f[R] will disable line length checking and
|
||||||
|
print numbers without regard to line length and without backslashes and
|
||||||
|
newlines.
|
||||||
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]DC_SIGINT_RESET\f[R]
|
\f[B]DC_SIGINT_RESET\f[R]
|
||||||
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
|
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
|
||||||
|
@ -69,6 +69,14 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-L**, **-\-no-line-length**
|
||||||
|
|
||||||
|
: Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines. In other words, this option sets **BC_LINE_LENGTH** to **0** (see
|
||||||
|
the **ENVIRONMENT VARIABLES** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **-\-no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
@ -106,6 +114,17 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-z**, **-\-leading-zeroes**
|
||||||
|
|
||||||
|
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
|
||||||
|
not equal to **0**, with a leading zero.
|
||||||
|
|
||||||
|
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
|
||||||
|
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
|
||||||
|
the **LIBRARY** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **-\-expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
@ -782,6 +801,24 @@ These commands manipulate arrays.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
## Global Settings
|
||||||
|
|
||||||
|
These commands retrieve global settings. These are the only commands that
|
||||||
|
require multiple specific characters, and all of them begin with the letter
|
||||||
|
**g**. Only the characters below are allowed after the character **g**; any
|
||||||
|
other character produces a parse error (see the **ERRORS** section).
|
||||||
|
|
||||||
|
**gl**
|
||||||
|
|
||||||
|
: Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT
|
||||||
|
VARIABLES** section) onto the stack.
|
||||||
|
|
||||||
|
**gz**
|
||||||
|
|
||||||
|
: Pushes **0** onto the stack if the leading zero setting has not been enabled
|
||||||
|
with the **-z** or **-\-leading-zeroes** options (see the **OPTIONS**
|
||||||
|
section), non-zero otherwise.
|
||||||
|
|
||||||
# REGISTERS
|
# REGISTERS
|
||||||
|
|
||||||
Registers are names that can store strings, numbers, and arrays. (Number/string
|
Registers are names that can store strings, numbers, and arrays. (Number/string
|
||||||
@ -943,6 +980,9 @@ dc(1) recognizes the following environment variables:
|
|||||||
lines to that length, including the backslash newline combo. The default
|
lines to that length, including the backslash newline combo. The default
|
||||||
line length is **70**.
|
line length is **70**.
|
||||||
|
|
||||||
|
The special value of **0** will disable line length checking and print
|
||||||
|
numbers without regard to line length and without backslashes and newlines.
|
||||||
|
|
||||||
**DC_SIGINT_RESET**
|
**DC_SIGINT_RESET**
|
||||||
|
|
||||||
: If dc(1) is not in interactive mode (see the **INTERACTIVE MODE** section),
|
: If dc(1) is not in interactive mode (see the **INTERACTIVE MODE** section),
|
||||||
|
@ -73,6 +73,16 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-L\f[R], \f[B]--no-line-length\f[R]
|
||||||
|
Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines.
|
||||||
|
In other words, this option sets \f[B]BC_LINE_LENGTH\f[R] to \f[B]0\f[R]
|
||||||
|
(see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
@ -118,6 +128,18 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
|
||||||
|
Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
|
||||||
|
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This can be set for individual numbers with the \f[B]plz(x)\f[R],
|
||||||
|
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
|
||||||
|
extended math library (see the \f[B]LIBRARY\f[R] section).
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
@ -872,6 +894,23 @@ Pushes the length of the array \f[I]r\f[R] onto the stack.
|
|||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
|
.SS Global Settings
|
||||||
|
.PP
|
||||||
|
These commands retrieve global settings.
|
||||||
|
These are the only commands that require multiple specific characters,
|
||||||
|
and all of them begin with the letter \f[B]g\f[R].
|
||||||
|
Only the characters below are allowed after the character \f[B]g\f[R];
|
||||||
|
any other character produces a parse error (see the \f[B]ERRORS\f[R]
|
||||||
|
section).
|
||||||
|
.TP
|
||||||
|
\f[B]gl\f[R]
|
||||||
|
Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the
|
||||||
|
\f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack.
|
||||||
|
.TP
|
||||||
|
\f[B]gz\f[R]
|
||||||
|
Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
|
||||||
|
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options
|
||||||
|
(see the \f[B]OPTIONS\f[R] section), non-zero otherwise.
|
||||||
.SH REGISTERS
|
.SH REGISTERS
|
||||||
.PP
|
.PP
|
||||||
Registers are names that can store strings, numbers, and arrays.
|
Registers are names that can store strings, numbers, and arrays.
|
||||||
@ -1044,6 +1083,12 @@ greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
|
|||||||
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
|
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
|
||||||
including the backslash newline combo.
|
including the backslash newline combo.
|
||||||
The default line length is \f[B]70\f[R].
|
The default line length is \f[B]70\f[R].
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
The special value of \f[B]0\f[R] will disable line length checking and
|
||||||
|
print numbers without regard to line length and without backslashes and
|
||||||
|
newlines.
|
||||||
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]DC_SIGINT_RESET\f[R]
|
\f[B]DC_SIGINT_RESET\f[R]
|
||||||
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
|
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
|
||||||
|
@ -69,6 +69,14 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-L**, **-\-no-line-length**
|
||||||
|
|
||||||
|
: Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines. In other words, this option sets **BC_LINE_LENGTH** to **0** (see
|
||||||
|
the **ENVIRONMENT VARIABLES** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **-\-no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
@ -106,6 +114,17 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-z**, **-\-leading-zeroes**
|
||||||
|
|
||||||
|
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
|
||||||
|
not equal to **0**, with a leading zero.
|
||||||
|
|
||||||
|
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
|
||||||
|
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
|
||||||
|
the **LIBRARY** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **-\-expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
@ -782,6 +801,24 @@ These commands manipulate arrays.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
## Global Settings
|
||||||
|
|
||||||
|
These commands retrieve global settings. These are the only commands that
|
||||||
|
require multiple specific characters, and all of them begin with the letter
|
||||||
|
**g**. Only the characters below are allowed after the character **g**; any
|
||||||
|
other character produces a parse error (see the **ERRORS** section).
|
||||||
|
|
||||||
|
**gl**
|
||||||
|
|
||||||
|
: Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT
|
||||||
|
VARIABLES** section) onto the stack.
|
||||||
|
|
||||||
|
**gz**
|
||||||
|
|
||||||
|
: Pushes **0** onto the stack if the leading zero setting has not been enabled
|
||||||
|
with the **-z** or **-\-leading-zeroes** options (see the **OPTIONS**
|
||||||
|
section), non-zero otherwise.
|
||||||
|
|
||||||
# REGISTERS
|
# REGISTERS
|
||||||
|
|
||||||
Registers are names that can store strings, numbers, and arrays. (Number/string
|
Registers are names that can store strings, numbers, and arrays. (Number/string
|
||||||
@ -943,6 +980,9 @@ dc(1) recognizes the following environment variables:
|
|||||||
lines to that length, including the backslash newline combo. The default
|
lines to that length, including the backslash newline combo. The default
|
||||||
line length is **70**.
|
line length is **70**.
|
||||||
|
|
||||||
|
The special value of **0** will disable line length checking and print
|
||||||
|
numbers without regard to line length and without backslashes and newlines.
|
||||||
|
|
||||||
**DC_SIGINT_RESET**
|
**DC_SIGINT_RESET**
|
||||||
|
|
||||||
: If dc(1) is not in interactive mode (see the **INTERACTIVE MODE** section),
|
: If dc(1) is not in interactive mode (see the **INTERACTIVE MODE** section),
|
||||||
|
@ -73,6 +73,16 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-L\f[R], \f[B]--no-line-length\f[R]
|
||||||
|
Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines.
|
||||||
|
In other words, this option sets \f[B]BC_LINE_LENGTH\f[R] to \f[B]0\f[R]
|
||||||
|
(see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
@ -118,6 +128,18 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
|
||||||
|
Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
|
||||||
|
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This can be set for individual numbers with the \f[B]plz(x)\f[R],
|
||||||
|
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
|
||||||
|
extended math library (see the \f[B]LIBRARY\f[R] section).
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
@ -872,6 +894,23 @@ Pushes the length of the array \f[I]r\f[R] onto the stack.
|
|||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
|
.SS Global Settings
|
||||||
|
.PP
|
||||||
|
These commands retrieve global settings.
|
||||||
|
These are the only commands that require multiple specific characters,
|
||||||
|
and all of them begin with the letter \f[B]g\f[R].
|
||||||
|
Only the characters below are allowed after the character \f[B]g\f[R];
|
||||||
|
any other character produces a parse error (see the \f[B]ERRORS\f[R]
|
||||||
|
section).
|
||||||
|
.TP
|
||||||
|
\f[B]gl\f[R]
|
||||||
|
Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the
|
||||||
|
\f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack.
|
||||||
|
.TP
|
||||||
|
\f[B]gz\f[R]
|
||||||
|
Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
|
||||||
|
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options
|
||||||
|
(see the \f[B]OPTIONS\f[R] section), non-zero otherwise.
|
||||||
.SH REGISTERS
|
.SH REGISTERS
|
||||||
.PP
|
.PP
|
||||||
Registers are names that can store strings, numbers, and arrays.
|
Registers are names that can store strings, numbers, and arrays.
|
||||||
@ -1044,6 +1083,12 @@ greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
|
|||||||
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
|
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
|
||||||
including the backslash newline combo.
|
including the backslash newline combo.
|
||||||
The default line length is \f[B]70\f[R].
|
The default line length is \f[B]70\f[R].
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
The special value of \f[B]0\f[R] will disable line length checking and
|
||||||
|
print numbers without regard to line length and without backslashes and
|
||||||
|
newlines.
|
||||||
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]DC_SIGINT_RESET\f[R]
|
\f[B]DC_SIGINT_RESET\f[R]
|
||||||
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
|
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
|
||||||
|
@ -69,6 +69,14 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-L**, **-\-no-line-length**
|
||||||
|
|
||||||
|
: Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines. In other words, this option sets **BC_LINE_LENGTH** to **0** (see
|
||||||
|
the **ENVIRONMENT VARIABLES** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **-\-no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
@ -106,6 +114,17 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-z**, **-\-leading-zeroes**
|
||||||
|
|
||||||
|
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
|
||||||
|
not equal to **0**, with a leading zero.
|
||||||
|
|
||||||
|
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
|
||||||
|
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
|
||||||
|
the **LIBRARY** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **-\-expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
@ -782,6 +801,24 @@ These commands manipulate arrays.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
## Global Settings
|
||||||
|
|
||||||
|
These commands retrieve global settings. These are the only commands that
|
||||||
|
require multiple specific characters, and all of them begin with the letter
|
||||||
|
**g**. Only the characters below are allowed after the character **g**; any
|
||||||
|
other character produces a parse error (see the **ERRORS** section).
|
||||||
|
|
||||||
|
**gl**
|
||||||
|
|
||||||
|
: Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT
|
||||||
|
VARIABLES** section) onto the stack.
|
||||||
|
|
||||||
|
**gz**
|
||||||
|
|
||||||
|
: Pushes **0** onto the stack if the leading zero setting has not been enabled
|
||||||
|
with the **-z** or **-\-leading-zeroes** options (see the **OPTIONS**
|
||||||
|
section), non-zero otherwise.
|
||||||
|
|
||||||
# REGISTERS
|
# REGISTERS
|
||||||
|
|
||||||
Registers are names that can store strings, numbers, and arrays. (Number/string
|
Registers are names that can store strings, numbers, and arrays. (Number/string
|
||||||
@ -943,6 +980,9 @@ dc(1) recognizes the following environment variables:
|
|||||||
lines to that length, including the backslash newline combo. The default
|
lines to that length, including the backslash newline combo. The default
|
||||||
line length is **70**.
|
line length is **70**.
|
||||||
|
|
||||||
|
The special value of **0** will disable line length checking and print
|
||||||
|
numbers without regard to line length and without backslashes and newlines.
|
||||||
|
|
||||||
**DC_SIGINT_RESET**
|
**DC_SIGINT_RESET**
|
||||||
|
|
||||||
: If dc(1) is not in interactive mode (see the **INTERACTIVE MODE** section),
|
: If dc(1) is not in interactive mode (see the **INTERACTIVE MODE** section),
|
||||||
|
@ -73,6 +73,16 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-L\f[R], \f[B]--no-line-length\f[R]
|
||||||
|
Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines.
|
||||||
|
In other words, this option sets \f[B]BC_LINE_LENGTH\f[R] to \f[B]0\f[R]
|
||||||
|
(see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
@ -118,6 +128,18 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
|
||||||
|
Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
|
||||||
|
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This can be set for individual numbers with the \f[B]plz(x)\f[R],
|
||||||
|
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
|
||||||
|
extended math library (see the \f[B]LIBRARY\f[R] section).
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
@ -872,6 +894,23 @@ Pushes the length of the array \f[I]r\f[R] onto the stack.
|
|||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
|
.SS Global Settings
|
||||||
|
.PP
|
||||||
|
These commands retrieve global settings.
|
||||||
|
These are the only commands that require multiple specific characters,
|
||||||
|
and all of them begin with the letter \f[B]g\f[R].
|
||||||
|
Only the characters below are allowed after the character \f[B]g\f[R];
|
||||||
|
any other character produces a parse error (see the \f[B]ERRORS\f[R]
|
||||||
|
section).
|
||||||
|
.TP
|
||||||
|
\f[B]gl\f[R]
|
||||||
|
Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the
|
||||||
|
\f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack.
|
||||||
|
.TP
|
||||||
|
\f[B]gz\f[R]
|
||||||
|
Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
|
||||||
|
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options
|
||||||
|
(see the \f[B]OPTIONS\f[R] section), non-zero otherwise.
|
||||||
.SH REGISTERS
|
.SH REGISTERS
|
||||||
.PP
|
.PP
|
||||||
Registers are names that can store strings, numbers, and arrays.
|
Registers are names that can store strings, numbers, and arrays.
|
||||||
@ -1044,6 +1083,12 @@ greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
|
|||||||
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
|
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
|
||||||
including the backslash newline combo.
|
including the backslash newline combo.
|
||||||
The default line length is \f[B]70\f[R].
|
The default line length is \f[B]70\f[R].
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
The special value of \f[B]0\f[R] will disable line length checking and
|
||||||
|
print numbers without regard to line length and without backslashes and
|
||||||
|
newlines.
|
||||||
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]DC_SIGINT_RESET\f[R]
|
\f[B]DC_SIGINT_RESET\f[R]
|
||||||
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
|
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
|
||||||
|
@ -69,6 +69,14 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-L**, **-\-no-line-length**
|
||||||
|
|
||||||
|
: Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines. In other words, this option sets **BC_LINE_LENGTH** to **0** (see
|
||||||
|
the **ENVIRONMENT VARIABLES** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **-\-no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
@ -106,6 +114,17 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-z**, **-\-leading-zeroes**
|
||||||
|
|
||||||
|
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
|
||||||
|
not equal to **0**, with a leading zero.
|
||||||
|
|
||||||
|
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
|
||||||
|
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
|
||||||
|
the **LIBRARY** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **-\-expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
@ -782,6 +801,24 @@ These commands manipulate arrays.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
## Global Settings
|
||||||
|
|
||||||
|
These commands retrieve global settings. These are the only commands that
|
||||||
|
require multiple specific characters, and all of them begin with the letter
|
||||||
|
**g**. Only the characters below are allowed after the character **g**; any
|
||||||
|
other character produces a parse error (see the **ERRORS** section).
|
||||||
|
|
||||||
|
**gl**
|
||||||
|
|
||||||
|
: Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT
|
||||||
|
VARIABLES** section) onto the stack.
|
||||||
|
|
||||||
|
**gz**
|
||||||
|
|
||||||
|
: Pushes **0** onto the stack if the leading zero setting has not been enabled
|
||||||
|
with the **-z** or **-\-leading-zeroes** options (see the **OPTIONS**
|
||||||
|
section), non-zero otherwise.
|
||||||
|
|
||||||
# REGISTERS
|
# REGISTERS
|
||||||
|
|
||||||
Registers are names that can store strings, numbers, and arrays. (Number/string
|
Registers are names that can store strings, numbers, and arrays. (Number/string
|
||||||
@ -943,6 +980,9 @@ dc(1) recognizes the following environment variables:
|
|||||||
lines to that length, including the backslash newline combo. The default
|
lines to that length, including the backslash newline combo. The default
|
||||||
line length is **70**.
|
line length is **70**.
|
||||||
|
|
||||||
|
The special value of **0** will disable line length checking and print
|
||||||
|
numbers without regard to line length and without backslashes and newlines.
|
||||||
|
|
||||||
**DC_SIGINT_RESET**
|
**DC_SIGINT_RESET**
|
||||||
|
|
||||||
: If dc(1) is not in interactive mode (see the **INTERACTIVE MODE** section),
|
: If dc(1) is not in interactive mode (see the **INTERACTIVE MODE** section),
|
||||||
|
@ -73,6 +73,16 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-L\f[R], \f[B]--no-line-length\f[R]
|
||||||
|
Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines.
|
||||||
|
In other words, this option sets \f[B]BC_LINE_LENGTH\f[R] to \f[B]0\f[R]
|
||||||
|
(see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
@ -118,6 +128,18 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
|
||||||
|
Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
|
||||||
|
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This can be set for individual numbers with the \f[B]plz(x)\f[R],
|
||||||
|
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
|
||||||
|
extended math library (see the \f[B]LIBRARY\f[R] section).
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
@ -1072,6 +1094,23 @@ Pushes the length of the array \f[I]r\f[R] onto the stack.
|
|||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
|
.SS Global Settings
|
||||||
|
.PP
|
||||||
|
These commands retrieve global settings.
|
||||||
|
These are the only commands that require multiple specific characters,
|
||||||
|
and all of them begin with the letter \f[B]g\f[R].
|
||||||
|
Only the characters below are allowed after the character \f[B]g\f[R];
|
||||||
|
any other character produces a parse error (see the \f[B]ERRORS\f[R]
|
||||||
|
section).
|
||||||
|
.TP
|
||||||
|
\f[B]gl\f[R]
|
||||||
|
Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the
|
||||||
|
\f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack.
|
||||||
|
.TP
|
||||||
|
\f[B]gz\f[R]
|
||||||
|
Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
|
||||||
|
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options
|
||||||
|
(see the \f[B]OPTIONS\f[R] section), non-zero otherwise.
|
||||||
.SH REGISTERS
|
.SH REGISTERS
|
||||||
.PP
|
.PP
|
||||||
Registers are names that can store strings, numbers, and arrays.
|
Registers are names that can store strings, numbers, and arrays.
|
||||||
@ -1249,6 +1288,12 @@ greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
|
|||||||
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
|
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
|
||||||
including the backslash newline combo.
|
including the backslash newline combo.
|
||||||
The default line length is \f[B]70\f[R].
|
The default line length is \f[B]70\f[R].
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
The special value of \f[B]0\f[R] will disable line length checking and
|
||||||
|
print numbers without regard to line length and without backslashes and
|
||||||
|
newlines.
|
||||||
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]DC_SIGINT_RESET\f[R]
|
\f[B]DC_SIGINT_RESET\f[R]
|
||||||
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
|
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
|
||||||
|
@ -69,6 +69,14 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-L**, **-\-no-line-length**
|
||||||
|
|
||||||
|
: Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines. In other words, this option sets **BC_LINE_LENGTH** to **0** (see
|
||||||
|
the **ENVIRONMENT VARIABLES** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **-\-no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
@ -106,6 +114,17 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-z**, **-\-leading-zeroes**
|
||||||
|
|
||||||
|
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
|
||||||
|
not equal to **0**, with a leading zero.
|
||||||
|
|
||||||
|
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
|
||||||
|
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
|
||||||
|
the **LIBRARY** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **-\-expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
@ -942,6 +961,24 @@ These commands manipulate arrays.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
## Global Settings
|
||||||
|
|
||||||
|
These commands retrieve global settings. These are the only commands that
|
||||||
|
require multiple specific characters, and all of them begin with the letter
|
||||||
|
**g**. Only the characters below are allowed after the character **g**; any
|
||||||
|
other character produces a parse error (see the **ERRORS** section).
|
||||||
|
|
||||||
|
**gl**
|
||||||
|
|
||||||
|
: Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT
|
||||||
|
VARIABLES** section) onto the stack.
|
||||||
|
|
||||||
|
**gz**
|
||||||
|
|
||||||
|
: Pushes **0** onto the stack if the leading zero setting has not been enabled
|
||||||
|
with the **-z** or **-\-leading-zeroes** options (see the **OPTIONS**
|
||||||
|
section), non-zero otherwise.
|
||||||
|
|
||||||
# REGISTERS
|
# REGISTERS
|
||||||
|
|
||||||
Registers are names that can store strings, numbers, and arrays. (Number/string
|
Registers are names that can store strings, numbers, and arrays. (Number/string
|
||||||
@ -1108,6 +1145,9 @@ dc(1) recognizes the following environment variables:
|
|||||||
lines to that length, including the backslash newline combo. The default
|
lines to that length, including the backslash newline combo. The default
|
||||||
line length is **70**.
|
line length is **70**.
|
||||||
|
|
||||||
|
The special value of **0** will disable line length checking and print
|
||||||
|
numbers without regard to line length and without backslashes and newlines.
|
||||||
|
|
||||||
**DC_SIGINT_RESET**
|
**DC_SIGINT_RESET**
|
||||||
|
|
||||||
: If dc(1) is not in interactive mode (see the **INTERACTIVE MODE** section),
|
: If dc(1) is not in interactive mode (see the **INTERACTIVE MODE** section),
|
||||||
|
@ -73,6 +73,16 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-L\f[R], \f[B]--no-line-length\f[R]
|
||||||
|
Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines.
|
||||||
|
In other words, this option sets \f[B]BC_LINE_LENGTH\f[R] to \f[B]0\f[R]
|
||||||
|
(see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
@ -118,6 +128,18 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
|
||||||
|
Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
|
||||||
|
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This can be set for individual numbers with the \f[B]plz(x)\f[R],
|
||||||
|
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
|
||||||
|
extended math library (see the \f[B]LIBRARY\f[R] section).
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
@ -1072,6 +1094,23 @@ Pushes the length of the array \f[I]r\f[R] onto the stack.
|
|||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
|
.SS Global Settings
|
||||||
|
.PP
|
||||||
|
These commands retrieve global settings.
|
||||||
|
These are the only commands that require multiple specific characters,
|
||||||
|
and all of them begin with the letter \f[B]g\f[R].
|
||||||
|
Only the characters below are allowed after the character \f[B]g\f[R];
|
||||||
|
any other character produces a parse error (see the \f[B]ERRORS\f[R]
|
||||||
|
section).
|
||||||
|
.TP
|
||||||
|
\f[B]gl\f[R]
|
||||||
|
Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the
|
||||||
|
\f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack.
|
||||||
|
.TP
|
||||||
|
\f[B]gz\f[R]
|
||||||
|
Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
|
||||||
|
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options
|
||||||
|
(see the \f[B]OPTIONS\f[R] section), non-zero otherwise.
|
||||||
.SH REGISTERS
|
.SH REGISTERS
|
||||||
.PP
|
.PP
|
||||||
Registers are names that can store strings, numbers, and arrays.
|
Registers are names that can store strings, numbers, and arrays.
|
||||||
@ -1249,6 +1288,12 @@ greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
|
|||||||
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
|
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
|
||||||
including the backslash newline combo.
|
including the backslash newline combo.
|
||||||
The default line length is \f[B]70\f[R].
|
The default line length is \f[B]70\f[R].
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
The special value of \f[B]0\f[R] will disable line length checking and
|
||||||
|
print numbers without regard to line length and without backslashes and
|
||||||
|
newlines.
|
||||||
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]DC_SIGINT_RESET\f[R]
|
\f[B]DC_SIGINT_RESET\f[R]
|
||||||
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
|
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
|
||||||
|
@ -69,6 +69,14 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-L**, **-\-no-line-length**
|
||||||
|
|
||||||
|
: Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines. In other words, this option sets **BC_LINE_LENGTH** to **0** (see
|
||||||
|
the **ENVIRONMENT VARIABLES** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **-\-no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
@ -106,6 +114,17 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-z**, **-\-leading-zeroes**
|
||||||
|
|
||||||
|
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
|
||||||
|
not equal to **0**, with a leading zero.
|
||||||
|
|
||||||
|
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
|
||||||
|
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
|
||||||
|
the **LIBRARY** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **-\-expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
@ -942,6 +961,24 @@ These commands manipulate arrays.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
## Global Settings
|
||||||
|
|
||||||
|
These commands retrieve global settings. These are the only commands that
|
||||||
|
require multiple specific characters, and all of them begin with the letter
|
||||||
|
**g**. Only the characters below are allowed after the character **g**; any
|
||||||
|
other character produces a parse error (see the **ERRORS** section).
|
||||||
|
|
||||||
|
**gl**
|
||||||
|
|
||||||
|
: Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT
|
||||||
|
VARIABLES** section) onto the stack.
|
||||||
|
|
||||||
|
**gz**
|
||||||
|
|
||||||
|
: Pushes **0** onto the stack if the leading zero setting has not been enabled
|
||||||
|
with the **-z** or **-\-leading-zeroes** options (see the **OPTIONS**
|
||||||
|
section), non-zero otherwise.
|
||||||
|
|
||||||
# REGISTERS
|
# REGISTERS
|
||||||
|
|
||||||
Registers are names that can store strings, numbers, and arrays. (Number/string
|
Registers are names that can store strings, numbers, and arrays. (Number/string
|
||||||
@ -1108,6 +1145,9 @@ dc(1) recognizes the following environment variables:
|
|||||||
lines to that length, including the backslash newline combo. The default
|
lines to that length, including the backslash newline combo. The default
|
||||||
line length is **70**.
|
line length is **70**.
|
||||||
|
|
||||||
|
The special value of **0** will disable line length checking and print
|
||||||
|
numbers without regard to line length and without backslashes and newlines.
|
||||||
|
|
||||||
**DC_SIGINT_RESET**
|
**DC_SIGINT_RESET**
|
||||||
|
|
||||||
: If dc(1) is not in interactive mode (see the **INTERACTIVE MODE** section),
|
: If dc(1) is not in interactive mode (see the **INTERACTIVE MODE** section),
|
||||||
|
@ -73,6 +73,16 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-L\f[R], \f[B]--no-line-length\f[R]
|
||||||
|
Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines.
|
||||||
|
In other words, this option sets \f[B]BC_LINE_LENGTH\f[R] to \f[B]0\f[R]
|
||||||
|
(see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
@ -118,6 +128,18 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
|
||||||
|
Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
|
||||||
|
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
This can be set for individual numbers with the \f[B]plz(x)\f[R],
|
||||||
|
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
|
||||||
|
extended math library (see the \f[B]LIBRARY\f[R] section).
|
||||||
|
.PP
|
||||||
|
This is a \f[B]non-portable extension\f[R].
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
@ -1072,6 +1094,23 @@ Pushes the length of the array \f[I]r\f[R] onto the stack.
|
|||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
|
.SS Global Settings
|
||||||
|
.PP
|
||||||
|
These commands retrieve global settings.
|
||||||
|
These are the only commands that require multiple specific characters,
|
||||||
|
and all of them begin with the letter \f[B]g\f[R].
|
||||||
|
Only the characters below are allowed after the character \f[B]g\f[R];
|
||||||
|
any other character produces a parse error (see the \f[B]ERRORS\f[R]
|
||||||
|
section).
|
||||||
|
.TP
|
||||||
|
\f[B]gl\f[R]
|
||||||
|
Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the
|
||||||
|
\f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack.
|
||||||
|
.TP
|
||||||
|
\f[B]gz\f[R]
|
||||||
|
Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
|
||||||
|
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options
|
||||||
|
(see the \f[B]OPTIONS\f[R] section), non-zero otherwise.
|
||||||
.SH REGISTERS
|
.SH REGISTERS
|
||||||
.PP
|
.PP
|
||||||
Registers are names that can store strings, numbers, and arrays.
|
Registers are names that can store strings, numbers, and arrays.
|
||||||
@ -1249,6 +1288,12 @@ greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
|
|||||||
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
|
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
|
||||||
including the backslash newline combo.
|
including the backslash newline combo.
|
||||||
The default line length is \f[B]70\f[R].
|
The default line length is \f[B]70\f[R].
|
||||||
|
.RS
|
||||||
|
.PP
|
||||||
|
The special value of \f[B]0\f[R] will disable line length checking and
|
||||||
|
print numbers without regard to line length and without backslashes and
|
||||||
|
newlines.
|
||||||
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]DC_SIGINT_RESET\f[R]
|
\f[B]DC_SIGINT_RESET\f[R]
|
||||||
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
|
If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
|
||||||
|
@ -69,6 +69,14 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-L**, **-\-no-line-length**
|
||||||
|
|
||||||
|
: Disables line length checking and prints numbers without backslashes and
|
||||||
|
newlines. In other words, this option sets **BC_LINE_LENGTH** to **0** (see
|
||||||
|
the **ENVIRONMENT VARIABLES** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **-\-no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
@ -106,6 +114,17 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
**-z**, **-\-leading-zeroes**
|
||||||
|
|
||||||
|
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
|
||||||
|
not equal to **0**, with a leading zero.
|
||||||
|
|
||||||
|
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
|
||||||
|
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
|
||||||
|
the **LIBRARY** section).
|
||||||
|
|
||||||
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **-\-expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
@ -942,6 +961,24 @@ These commands manipulate arrays.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
|
## Global Settings
|
||||||
|
|
||||||
|
These commands retrieve global settings. These are the only commands that
|
||||||
|
require multiple specific characters, and all of them begin with the letter
|
||||||
|
**g**. Only the characters below are allowed after the character **g**; any
|
||||||
|
other character produces a parse error (see the **ERRORS** section).
|
||||||
|
|
||||||
|
**gl**
|
||||||
|
|
||||||
|
: Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT
|
||||||
|
VARIABLES** section) onto the stack.
|
||||||
|
|
||||||
|
**gz**
|
||||||
|
|
||||||
|
: Pushes **0** onto the stack if the leading zero setting has not been enabled
|
||||||
|
with the **-z** or **-\-leading-zeroes** options (see the **OPTIONS**
|
||||||
|
section), non-zero otherwise.
|
||||||
|
|
||||||
# REGISTERS
|
# REGISTERS
|
||||||
|
|
||||||
Registers are names that can store strings, numbers, and arrays. (Number/string
|
Registers are names that can store strings, numbers, and arrays. (Number/string
|
||||||
@ -1108,6 +1145,9 @@ dc(1) recognizes the following environment variables:
|
|||||||
lines to that length, including the backslash newline combo. The default
|
lines to that length, including the backslash newline combo. The default
|
||||||
line length is **70**.
|
line length is **70**.
|
||||||
|
|
||||||
|
The special value of **0** will disable line length checking and print
|
||||||
|
numbers without regard to line length and without backslashes and newlines.
|
||||||
|
|
||||||
**DC_SIGINT_RESET**
|
**DC_SIGINT_RESET**
|
||||||
|
|
||||||
: If dc(1) is not in interactive mode (see the **INTERACTIVE MODE** section),
|
: If dc(1) is not in interactive mode (see the **INTERACTIVE MODE** section),
|
||||||
|
@ -223,11 +223,9 @@ checkerrtest()
|
|||||||
die "$_checkerrtest_d" "produced no error message" "$_checkerrtest_name" "$_checkerrtest_error"
|
die "$_checkerrtest_d" "produced no error message" "$_checkerrtest_name" "$_checkerrtest_error"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Display the error messages if not directly running exe.
|
# To display error messages, uncomment this line. This is useful when
|
||||||
# This allows the script to print valgrind output.
|
# debugging.
|
||||||
if [ "$_checkerrtest_exebase" != "bc" ] && [ "$_checkerrtest_exebase" != "dc" ]; then
|
#cat "$_checkerrtest_out"
|
||||||
cat "$_checkerrtest_out"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Replace a substring in a string with another. This function is the *real*
|
# Replace a substring in a string with another. This function is the *real*
|
||||||
|
@ -171,6 +171,18 @@ void bc_args(int argc, char *argv[], bool exit_exprs) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 'z':
|
||||||
|
{
|
||||||
|
vm.flags |= BC_FLAG_Z;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 'L':
|
||||||
|
{
|
||||||
|
vm.line_len = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 'P':
|
case 'P':
|
||||||
{
|
{
|
||||||
vm.flags &= ~(BC_FLAG_P);
|
vm.flags &= ~(BC_FLAG_P);
|
||||||
@ -201,7 +213,7 @@ void bc_args(int argc, char *argv[], bool exit_exprs) {
|
|||||||
case 'q':
|
case 'q':
|
||||||
{
|
{
|
||||||
assert(BC_IS_BC);
|
assert(BC_IS_BC);
|
||||||
// Do nothing.
|
vm.flags &= ~(BC_FLAG_Q);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1589,6 +1589,9 @@ static void bc_parse_stmt(BcParse *p) {
|
|||||||
#if BC_ENABLE_EXTRA_MATH
|
#if BC_ENABLE_EXTRA_MATH
|
||||||
case BC_LEX_KW_MAXRAND:
|
case BC_LEX_KW_MAXRAND:
|
||||||
#endif // BC_ENABLE_EXTRA_MATH
|
#endif // BC_ENABLE_EXTRA_MATH
|
||||||
|
case BC_LEX_KW_LINE_LENGTH:
|
||||||
|
case BC_LEX_KW_GLOBAL_STACKS:
|
||||||
|
case BC_LEX_KW_LEADING_ZERO:
|
||||||
{
|
{
|
||||||
bc_parse_expr_status(p, BC_PARSE_PRINT, bc_parse_next_expr);
|
bc_parse_expr_status(p, BC_PARSE_PRINT, bc_parse_next_expr);
|
||||||
break;
|
break;
|
||||||
@ -1726,8 +1729,14 @@ void bc_parse_parse(BcParse *p) {
|
|||||||
|
|
||||||
// Functions need special parsing.
|
// Functions need special parsing.
|
||||||
else if (p->l.t == BC_LEX_KW_DEFINE) {
|
else if (p->l.t == BC_LEX_KW_DEFINE) {
|
||||||
if (BC_ERR(BC_PARSE_NO_EXEC(p)))
|
if (BC_ERR(BC_PARSE_NO_EXEC(p))) {
|
||||||
bc_parse_err(p, BC_ERR_PARSE_TOKEN);
|
if (p->flags.len == 1 &&
|
||||||
|
BC_PARSE_TOP_FLAG(p) == BC_PARSE_FLAG_IF_END)
|
||||||
|
{
|
||||||
|
bc_parse_noElse(p);
|
||||||
|
}
|
||||||
|
else bc_parse_err(p, BC_ERR_PARSE_TOKEN);
|
||||||
|
}
|
||||||
bc_parse_func(p);
|
bc_parse_func(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2078,6 +2087,9 @@ static BcParseStatus bc_parse_expr_err(BcParse *p, uint8_t flags,
|
|||||||
#if BC_ENABLE_EXTRA_MATH
|
#if BC_ENABLE_EXTRA_MATH
|
||||||
case BC_LEX_KW_MAXRAND:
|
case BC_LEX_KW_MAXRAND:
|
||||||
#endif // BC_ENABLE_EXTRA_MATH
|
#endif // BC_ENABLE_EXTRA_MATH
|
||||||
|
case BC_LEX_KW_LINE_LENGTH:
|
||||||
|
case BC_LEX_KW_GLOBAL_STACKS:
|
||||||
|
case BC_LEX_KW_LEADING_ZERO:
|
||||||
{
|
{
|
||||||
// All of these are leaves and cannot come right after a leaf.
|
// All of these are leaves and cannot come right after a leaf.
|
||||||
if (BC_ERR(BC_PARSE_LEAF(prev, bin_last, rprn)))
|
if (BC_ERR(BC_PARSE_LEAF(prev, bin_last, rprn)))
|
||||||
|
@ -141,6 +141,8 @@ const BcOptLong bc_args_lopt[] = {
|
|||||||
{ "file", BC_OPT_REQUIRED, 'f' },
|
{ "file", BC_OPT_REQUIRED, 'f' },
|
||||||
{ "help", BC_OPT_NONE, 'h' },
|
{ "help", BC_OPT_NONE, 'h' },
|
||||||
{ "interactive", BC_OPT_NONE, 'i' },
|
{ "interactive", BC_OPT_NONE, 'i' },
|
||||||
|
{ "leading-zeroes", BC_OPT_NONE, 'z' },
|
||||||
|
{ "no-line-length", BC_OPT_NONE, 'L' },
|
||||||
{ "no-prompt", BC_OPT_NONE, 'P' },
|
{ "no-prompt", BC_OPT_NONE, 'P' },
|
||||||
{ "no-read-prompt", BC_OPT_NONE, 'R' },
|
{ "no-read-prompt", BC_OPT_NONE, 'R' },
|
||||||
#if BC_ENABLED
|
#if BC_ENABLED
|
||||||
@ -873,6 +875,9 @@ const BcLexKeyword bc_lex_kws[] = {
|
|||||||
#if BC_ENABLE_EXTRA_MATH
|
#if BC_ENABLE_EXTRA_MATH
|
||||||
BC_LEX_KW_ENTRY("maxrand", 7, false),
|
BC_LEX_KW_ENTRY("maxrand", 7, false),
|
||||||
#endif // BC_ENABLE_EXTRA_MATH
|
#endif // BC_ENABLE_EXTRA_MATH
|
||||||
|
BC_LEX_KW_ENTRY("line_length", 11, false),
|
||||||
|
BC_LEX_KW_ENTRY("global_stacks", 13, false),
|
||||||
|
BC_LEX_KW_ENTRY("leading_zero", 12, false),
|
||||||
BC_LEX_KW_ENTRY("stream", 6, false),
|
BC_LEX_KW_ENTRY("stream", 6, false),
|
||||||
BC_LEX_KW_ENTRY("else", 4, false),
|
BC_LEX_KW_ENTRY("else", 4, false),
|
||||||
};
|
};
|
||||||
@ -928,7 +933,10 @@ const uint8_t bc_parse_exprs[] = {
|
|||||||
BC_PARSE_EXPR_ENTRY(true, true, true, true, true, true, false, true),
|
BC_PARSE_EXPR_ENTRY(true, true, true, true, true, true, false, true),
|
||||||
|
|
||||||
// Starts with BC_LEX_KW_MAXIBASE.
|
// Starts with BC_LEX_KW_MAXIBASE.
|
||||||
BC_PARSE_EXPR_ENTRY(true, true, true, true, true, false, false, 0)
|
BC_PARSE_EXPR_ENTRY(true, true, true, true, true, true, true, true),
|
||||||
|
|
||||||
|
// Starts with BC_LEX_KW_STREAM.
|
||||||
|
BC_PARSE_EXPR_ENTRY(false, false, 0, 0, 0, 0, 0, 0)
|
||||||
|
|
||||||
#else // BC_ENABLE_EXTRA_MATH
|
#else // BC_ENABLE_EXTRA_MATH
|
||||||
|
|
||||||
@ -948,7 +956,7 @@ const uint8_t bc_parse_exprs[] = {
|
|||||||
BC_PARSE_EXPR_ENTRY(true, true, true, true, true, false, true, true),
|
BC_PARSE_EXPR_ENTRY(true, true, true, true, true, false, true, true),
|
||||||
|
|
||||||
// Starts with BC_LEX_KW_MAXSCALE,
|
// Starts with BC_LEX_KW_MAXSCALE,
|
||||||
BC_PARSE_EXPR_ENTRY(true, true, false, false, 0, 0, 0, 0)
|
BC_PARSE_EXPR_ENTRY(true, true, true, true, true, false, false, 0)
|
||||||
|
|
||||||
#endif // BC_ENABLE_EXTRA_MATH
|
#endif // BC_ENABLE_EXTRA_MATH
|
||||||
};
|
};
|
||||||
@ -1170,7 +1178,11 @@ const uchar dc_parse_insts[] = {
|
|||||||
#if BC_ENABLE_EXTRA_MATH
|
#if BC_ENABLE_EXTRA_MATH
|
||||||
BC_INST_MAXRAND,
|
BC_INST_MAXRAND,
|
||||||
#endif // BC_ENABLE_EXTRA_MATH
|
#endif // BC_ENABLE_EXTRA_MATH
|
||||||
BC_INST_PRINT_STREAM, BC_INST_INVALID,
|
BC_INST_LINE_LENGTH,
|
||||||
|
#if BC_ENABLED
|
||||||
|
BC_INST_INVALID,
|
||||||
|
#endif // BC_ENABLED
|
||||||
|
BC_INST_LEADING_ZERO, BC_INST_PRINT_STREAM, BC_INST_INVALID,
|
||||||
BC_INST_REL_EQ, BC_INST_INVALID,
|
BC_INST_REL_EQ, BC_INST_INVALID,
|
||||||
BC_INST_EXECUTE, BC_INST_PRINT_STACK, BC_INST_CLEAR_STACK,
|
BC_INST_EXECUTE, BC_INST_PRINT_STACK, BC_INST_CLEAR_STACK,
|
||||||
BC_INST_INVALID, BC_INST_STACK_LEN, BC_INST_DUPLICATE, BC_INST_SWAP,
|
BC_INST_INVALID, BC_INST_STACK_LEN, BC_INST_DUPLICATE, BC_INST_SWAP,
|
||||||
|
@ -248,6 +248,19 @@ void dc_lex_token(BcLex *l) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 'g':
|
||||||
|
{
|
||||||
|
c2 = l->buf[l->i];
|
||||||
|
|
||||||
|
if (c2 == 'l') l->t = BC_LEX_KW_LINE_LENGTH;
|
||||||
|
else if (c2 == 'z') l->t = BC_LEX_KW_LEADING_ZERO;
|
||||||
|
else bc_lex_invalidChar(l, c2);
|
||||||
|
|
||||||
|
l->i += 1;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case '[':
|
case '[':
|
||||||
{
|
{
|
||||||
dc_lex_string(l);
|
dc_lex_string(l);
|
||||||
|
@ -1648,8 +1648,45 @@ void bc_history_string_free(void *str) {
|
|||||||
|
|
||||||
void bc_history_init(BcHistory *h) {
|
void bc_history_init(BcHistory *h) {
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
HANDLE out, in;
|
||||||
|
#endif // _WIN32
|
||||||
|
|
||||||
BC_SIG_ASSERT_LOCKED;
|
BC_SIG_ASSERT_LOCKED;
|
||||||
|
|
||||||
|
h->rawMode = false;
|
||||||
|
h->badTerm = bc_history_isBadTerm();
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
h->orig_in = 0;
|
||||||
|
h->orig_out = 0;
|
||||||
|
|
||||||
|
in = GetStdHandle(STD_INPUT_HANDLE);
|
||||||
|
out = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
|
||||||
|
if (!h->badTerm) {
|
||||||
|
SetConsoleCP(CP_UTF8);
|
||||||
|
SetConsoleOutputCP(CP_UTF8);
|
||||||
|
if (!GetConsoleMode(in, &h->orig_in) ||
|
||||||
|
!GetConsoleMode(out, &h->orig_out))
|
||||||
|
{
|
||||||
|
h->badTerm = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
DWORD reqOut = ENABLE_VIRTUAL_TERMINAL_PROCESSING |
|
||||||
|
DISABLE_NEWLINE_AUTO_RETURN;
|
||||||
|
DWORD reqIn = ENABLE_VIRTUAL_TERMINAL_INPUT;
|
||||||
|
if (!SetConsoleMode(in, h->orig_in | reqIn) ||
|
||||||
|
!SetConsoleMode(out, h->orig_out | reqOut))
|
||||||
|
{
|
||||||
|
h->badTerm = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // _WIN32
|
||||||
|
|
||||||
bc_vec_init(&h->buf, sizeof(char), BC_DTOR_NONE);
|
bc_vec_init(&h->buf, sizeof(char), BC_DTOR_NONE);
|
||||||
bc_vec_init(&h->history, sizeof(char*), BC_DTOR_HISTORY_STRING);
|
bc_vec_init(&h->history, sizeof(char*), BC_DTOR_HISTORY_STRING);
|
||||||
bc_vec_init(&h->extras, sizeof(char), BC_DTOR_NONE);
|
bc_vec_init(&h->extras, sizeof(char), BC_DTOR_NONE);
|
||||||
@ -1663,19 +1700,6 @@ void bc_history_init(BcHistory *h) {
|
|||||||
sigemptyset(&h->sigmask);
|
sigemptyset(&h->sigmask);
|
||||||
sigaddset(&h->sigmask, SIGINT);
|
sigaddset(&h->sigmask, SIGINT);
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
h->rawMode = false;
|
|
||||||
h->badTerm = bc_history_isBadTerm();
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
if (!h->badTerm) {
|
|
||||||
SetConsoleCP(CP_UTF8);
|
|
||||||
SetConsoleOutputCP(CP_UTF8);
|
|
||||||
GetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), &h->orig_console_mode);
|
|
||||||
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),
|
|
||||||
ENABLE_VIRTUAL_TERMINAL_INPUT);
|
|
||||||
}
|
|
||||||
#endif // _WIN32
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void bc_history_free(BcHistory *h) {
|
void bc_history_free(BcHistory *h) {
|
||||||
@ -1683,7 +1707,8 @@ void bc_history_free(BcHistory *h) {
|
|||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
bc_history_disableRaw(h);
|
bc_history_disableRaw(h);
|
||||||
#else // _WIN32
|
#else // _WIN32
|
||||||
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), h->orig_console_mode);
|
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), h->orig_in);
|
||||||
|
SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), h->orig_out);
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
bc_vec_free(&h->buf);
|
bc_vec_free(&h->buf);
|
||||||
|
@ -185,6 +185,14 @@ void bcl_setAbortOnFatalError(bool abrt) {
|
|||||||
vm.abrt = abrt;
|
vm.abrt = abrt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool bcl_leadingZeroes(void) {
|
||||||
|
return vm.leading_zeroes;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bcl_setLeadingZeroes(bool leadingZeroes) {
|
||||||
|
vm.leading_zeroes = leadingZeroes;
|
||||||
|
}
|
||||||
|
|
||||||
BclContext bcl_ctxt_create(void) {
|
BclContext bcl_ctxt_create(void) {
|
||||||
|
|
||||||
BclContext ctxt = NULL;
|
BclContext ctxt = NULL;
|
||||||
|
@ -2366,7 +2366,7 @@ static void bc_num_parseBase(BcNum *restrict n, const char *restrict val,
|
|||||||
*/
|
*/
|
||||||
static inline void bc_num_printNewline(void) {
|
static inline void bc_num_printNewline(void) {
|
||||||
#if !BC_ENABLE_LIBRARY
|
#if !BC_ENABLE_LIBRARY
|
||||||
if (vm.nchars >= vm.line_len - 1) {
|
if (vm.nchars >= vm.line_len - 1 && vm.line_len) {
|
||||||
bc_vm_putchar('\\', bc_flush_none);
|
bc_vm_putchar('\\', bc_flush_none);
|
||||||
bc_vm_putchar('\n', bc_flush_err);
|
bc_vm_putchar('\n', bc_flush_err);
|
||||||
}
|
}
|
||||||
@ -2475,9 +2475,6 @@ static void bc_num_printDecimal(const BcNum *restrict n, bool newline) {
|
|||||||
bool zero = true;
|
bool zero = true;
|
||||||
size_t buffer[BC_BASE_DIGS];
|
size_t buffer[BC_BASE_DIGS];
|
||||||
|
|
||||||
// Print the sign.
|
|
||||||
if (BC_NUM_NEG(n)) bc_num_putchar('-', true);
|
|
||||||
|
|
||||||
// Print loop.
|
// Print loop.
|
||||||
for (i = n->len - 1; i < n->len; --i) {
|
for (i = n->len - 1; i < n->len; --i) {
|
||||||
|
|
||||||
@ -2975,9 +2972,6 @@ static void bc_num_printBase(BcNum *restrict n, BcBigDig base, bool newline) {
|
|||||||
BcNumDigitOp print;
|
BcNumDigitOp print;
|
||||||
bool neg = BC_NUM_NEG(n);
|
bool neg = BC_NUM_NEG(n);
|
||||||
|
|
||||||
// Just take care of the sign right here.
|
|
||||||
if (neg) bc_num_putchar('-', true);
|
|
||||||
|
|
||||||
// Clear the sign because it makes the actual printing easier when we have
|
// Clear the sign because it makes the actual printing easier when we have
|
||||||
// to do math.
|
// to do math.
|
||||||
BC_NUM_NEG_CLR(n);
|
BC_NUM_NEG_CLR(n);
|
||||||
@ -3145,6 +3139,16 @@ void bc_num_print(BcNum *restrict n, BcBigDig base, bool newline) {
|
|||||||
// We may need a newline, just to start.
|
// We may need a newline, just to start.
|
||||||
bc_num_printNewline();
|
bc_num_printNewline();
|
||||||
|
|
||||||
|
if (BC_NUM_NONZERO(n)) {
|
||||||
|
|
||||||
|
// Print the sign.
|
||||||
|
if (BC_NUM_NEG(n)) bc_num_putchar('-', true);
|
||||||
|
|
||||||
|
// Print the leading zero if necessary.
|
||||||
|
if (BC_Z && BC_NUM_RDX_VAL(n) == n->len)
|
||||||
|
bc_num_printHex(0, 1, false, !newline);
|
||||||
|
}
|
||||||
|
|
||||||
// Short-circuit 0.
|
// Short-circuit 0.
|
||||||
if (BC_NUM_ZERO(n)) bc_num_printHex(0, 1, false, !newline);
|
if (BC_NUM_ZERO(n)) bc_num_printHex(0, 1, false, !newline);
|
||||||
else if (base == BC_BASE) bc_num_printDecimal(n, newline);
|
else if (base == BC_BASE) bc_num_printDecimal(n, newline);
|
||||||
|
@ -287,6 +287,14 @@ static BcNum* bc_program_num(BcProgram *p, BcResult *r) {
|
|||||||
|
|
||||||
BcNum *n;
|
BcNum *n;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
// Windows made it an error to not initialize this, so shut it up.
|
||||||
|
// I don't want to do this on other platforms because this procedure
|
||||||
|
// is one of the most heavily-used, and eliminating the initialization
|
||||||
|
// is a performance win.
|
||||||
|
n = NULL;
|
||||||
|
#endif // _WIN32
|
||||||
|
|
||||||
switch (r->t) {
|
switch (r->t) {
|
||||||
|
|
||||||
case BC_RESULT_STR:
|
case BC_RESULT_STR:
|
||||||
@ -2389,6 +2397,28 @@ static void bc_program_pushGlobal(BcProgram *p, uchar inst) {
|
|||||||
bc_program_pushBigdig(p, p->globals[inst - BC_INST_IBASE], t);
|
bc_program_pushBigdig(p, p->globals[inst - BC_INST_IBASE], t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pushes the value of a global setting onto the stack.
|
||||||
|
* @param p The program.
|
||||||
|
* @param inst Which global setting to push, as an instruction.
|
||||||
|
*/
|
||||||
|
static void bc_program_globalSetting(BcProgram *p, uchar inst) {
|
||||||
|
|
||||||
|
BcBigDig val;
|
||||||
|
|
||||||
|
// Make sure the instruction is valid.
|
||||||
|
assert(inst >= BC_INST_LINE_LENGTH && inst <= BC_INST_LEADING_ZERO);
|
||||||
|
|
||||||
|
if (inst == BC_INST_LINE_LENGTH) val = (BcBigDig) vm.line_len;
|
||||||
|
#if BC_ENABLED
|
||||||
|
else if (inst == BC_INST_GLOBAL_STACKS) val = (BC_G != 0);
|
||||||
|
#endif // BC_ENABLED
|
||||||
|
else val = (BC_Z != 0);
|
||||||
|
|
||||||
|
// Push the global.
|
||||||
|
bc_program_pushBigdig(p, val, BC_RESULT_TEMP);
|
||||||
|
}
|
||||||
|
|
||||||
#if BC_ENABLE_EXTRA_MATH
|
#if BC_ENABLE_EXTRA_MATH
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2822,6 +2852,16 @@ void bc_program_exec(BcProgram *p) {
|
|||||||
BC_PROG_JUMP(inst, code, ip);
|
BC_PROG_JUMP(inst, code, ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BC_PROG_LBL(BC_INST_LINE_LENGTH):
|
||||||
|
#if BC_ENABLED
|
||||||
|
BC_PROG_LBL(BC_INST_GLOBAL_STACKS):
|
||||||
|
#endif // BC_ENABLED
|
||||||
|
BC_PROG_LBL(BC_INST_LEADING_ZERO):
|
||||||
|
{
|
||||||
|
bc_program_globalSetting(p, inst);
|
||||||
|
BC_PROG_JUMP(inst, code, ip);
|
||||||
|
}
|
||||||
|
|
||||||
BC_PROG_LBL(BC_INST_VAR):
|
BC_PROG_LBL(BC_INST_VAR):
|
||||||
{
|
{
|
||||||
bc_program_pushVar(p, code, &ip->idx, false, false);
|
bc_program_pushVar(p, code, &ip->idx, false, false);
|
||||||
|
@ -232,10 +232,11 @@ BcStatus bc_read_line(BcVec *vec, const char *prompt) {
|
|||||||
char* bc_read_file(const char *path) {
|
char* bc_read_file(const char *path) {
|
||||||
|
|
||||||
BcErr e = BC_ERR_FATAL_IO_ERR;
|
BcErr e = BC_ERR_FATAL_IO_ERR;
|
||||||
size_t size, r;
|
size_t size, to_read;
|
||||||
struct stat pstat;
|
struct stat pstat;
|
||||||
int fd;
|
int fd;
|
||||||
char* buf;
|
char* buf;
|
||||||
|
char* buf2;
|
||||||
|
|
||||||
BC_SIG_ASSERT_LOCKED;
|
BC_SIG_ASSERT_LOCKED;
|
||||||
|
|
||||||
@ -264,11 +265,18 @@ char* bc_read_file(const char *path) {
|
|||||||
// Get the size of the file and allocate that much.
|
// Get the size of the file and allocate that much.
|
||||||
size = (size_t) pstat.st_size;
|
size = (size_t) pstat.st_size;
|
||||||
buf = bc_vm_malloc(size + 1);
|
buf = bc_vm_malloc(size + 1);
|
||||||
|
buf2 = buf;
|
||||||
|
to_read = size;
|
||||||
|
|
||||||
// Read the file. We just bail if a signal interrupts. This is so that users
|
do {
|
||||||
// can interrupt the reading of big files if they want.
|
|
||||||
r = (size_t) read(fd, buf, size);
|
// Read the file. We just bail if a signal interrupts. This is so that
|
||||||
if (BC_ERR(r != size)) goto read_err;
|
// users can interrupt the reading of big files if they want.
|
||||||
|
ssize_t r = read(fd, buf2, to_read);
|
||||||
|
if (BC_ERR(r < 0)) goto read_err;
|
||||||
|
to_read -= (size_t) r;
|
||||||
|
buf2 += (size_t) r;
|
||||||
|
} while (to_read);
|
||||||
|
|
||||||
// Got to have a nul byte.
|
// Got to have a nul byte.
|
||||||
buf[size] = '\0';
|
buf[size] = '\0';
|
||||||
|
@ -495,7 +495,7 @@ static size_t bc_vm_envLen(const char *var) {
|
|||||||
|
|
||||||
// Parse it and clamp it if needed.
|
// Parse it and clamp it if needed.
|
||||||
len = (size_t) atoi(lenv) - 1;
|
len = (size_t) atoi(lenv) - 1;
|
||||||
if (len < 2 || len >= UINT16_MAX) len = BC_NUM_PRINT_WIDTH;
|
if (len == 1 || len >= UINT16_MAX) len = BC_NUM_PRINT_WIDTH;
|
||||||
}
|
}
|
||||||
// Set the default.
|
// Set the default.
|
||||||
else len = BC_NUM_PRINT_WIDTH;
|
else len = BC_NUM_PRINT_WIDTH;
|
||||||
@ -1336,6 +1336,13 @@ void bc_vm_boot(int argc, char *argv[]) {
|
|||||||
vm.flags |= BC_TTY ? BC_FLAG_P | BC_FLAG_R : 0;
|
vm.flags |= BC_TTY ? BC_FLAG_P | BC_FLAG_R : 0;
|
||||||
vm.flags |= BC_I ? BC_FLAG_Q : 0;
|
vm.flags |= BC_I ? BC_FLAG_Q : 0;
|
||||||
|
|
||||||
|
#if BC_ENABLED
|
||||||
|
if (BC_IS_BC && BC_I) {
|
||||||
|
// Set whether we print the banner or not.
|
||||||
|
bc_vm_setenvFlag("BC_BANNER", BC_DEFAULT_BANNER, BC_FLAG_Q);
|
||||||
|
}
|
||||||
|
#endif // BC_ENABLED
|
||||||
|
|
||||||
// Are we in TTY mode?
|
// Are we in TTY mode?
|
||||||
if (BC_TTY) {
|
if (BC_TTY) {
|
||||||
|
|
||||||
@ -1368,11 +1375,6 @@ void bc_vm_boot(int argc, char *argv[]) {
|
|||||||
|
|
||||||
// Set whether we reset on SIGINT or not.
|
// Set whether we reset on SIGINT or not.
|
||||||
bc_vm_setenvFlag(env_sigint, env_sigint_def, BC_FLAG_SIGINT);
|
bc_vm_setenvFlag(env_sigint, env_sigint_def, BC_FLAG_SIGINT);
|
||||||
#if BC_ENABLED
|
|
||||||
// Set whether we print the banner or not.
|
|
||||||
if (BC_IS_BC)
|
|
||||||
bc_vm_setenvFlag("BC_BANNER", BC_DEFAULT_BANNER, BC_FLAG_Q);
|
|
||||||
#endif // BC_ENABLED
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BC_ENABLED
|
#if BC_ENABLED
|
||||||
|
@ -27,19 +27,29 @@
|
|||||||
# POSSIBILITY OF SUCH DAMAGE.
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
#
|
#
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
script="$0"
|
script="$0"
|
||||||
testdir=$(dirname "$script")
|
testdir=$(dirname "$script")
|
||||||
|
|
||||||
. "$testdir/../scripts/functions.sh"
|
. "$testdir/../scripts/functions.sh"
|
||||||
|
|
||||||
|
# We need to figure out if we should run stuff in parallel.
|
||||||
|
pll=1
|
||||||
|
|
||||||
|
while getopts "n" opt; do
|
||||||
|
|
||||||
|
case "$opt" in
|
||||||
|
n) pll=0 ; shift ; set -e ;;
|
||||||
|
?) usage "Invalid option: $opt" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
# Command-line processing.
|
# Command-line processing.
|
||||||
if [ "$#" -ge 1 ]; then
|
if [ "$#" -ge 1 ]; then
|
||||||
d="$1"
|
d="$1"
|
||||||
shift
|
shift
|
||||||
else
|
else
|
||||||
err_exit "usage: $script dir [run_extra_tests] [run_stack_tests] [gen_tests] [time_tests] [exec args...]" 1
|
err_exit "usage: $script [-n] dir [run_extra_tests] [run_stack_tests] [gen_tests] [time_tests] [exec args...]" 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$#" -lt 1 ]; then
|
if [ "$#" -lt 1 ]; then
|
||||||
@ -96,6 +106,8 @@ unset DC_LINE_LENGTH
|
|||||||
# Get the list of tests that require extra math.
|
# Get the list of tests that require extra math.
|
||||||
extra_required=$(cat "$testdir/extra_required.txt")
|
extra_required=$(cat "$testdir/extra_required.txt")
|
||||||
|
|
||||||
|
pids=""
|
||||||
|
|
||||||
printf '\nRunning %s tests...\n\n' "$d"
|
printf '\nRunning %s tests...\n\n' "$d"
|
||||||
|
|
||||||
# Run the tests one at a time.
|
# Run the tests one at a time.
|
||||||
@ -109,28 +121,93 @@ while read t; do
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sh "$testdir/test.sh" "$d" "$t" "$generate_tests" "$time_tests" "$exe" "$@"
|
if [ "$pll" -ne 0 ]; then
|
||||||
|
sh "$testdir/test.sh" "$d" "$t" "$generate_tests" "$time_tests" "$exe" "$@" &
|
||||||
|
pids="$pids $!"
|
||||||
|
else
|
||||||
|
sh "$testdir/test.sh" "$d" "$t" "$generate_tests" "$time_tests" "$exe" "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
done < "$testdir/$d/all.txt"
|
done < "$testdir/$d/all.txt"
|
||||||
|
|
||||||
# stdin tests.
|
# stdin tests.
|
||||||
sh "$testdir/stdin.sh" "$d" "$exe" "$@"
|
if [ "$pll" -ne 0 ]; then
|
||||||
|
sh "$testdir/stdin.sh" "$d" "$exe" "$@" &
|
||||||
|
pids="$pids $!"
|
||||||
|
else
|
||||||
|
sh "$testdir/stdin.sh" "$d" "$exe" "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
# Script tests.
|
# Script tests.
|
||||||
sh "$testdir/scripts.sh" "$d" "$extra" "$run_stack_tests" "$generate_tests" \
|
if [ "$pll" -ne 0 ]; then
|
||||||
"$time_tests" "$exe" "$@"
|
sh "$testdir/scripts.sh" "$d" "$extra" "$run_stack_tests" "$generate_tests" \
|
||||||
|
"$time_tests" "$exe" "$@" &
|
||||||
|
pids="$pids $!"
|
||||||
|
else
|
||||||
|
sh "$testdir/scripts.sh" -n "$d" "$extra" "$run_stack_tests" "$generate_tests" \
|
||||||
|
"$time_tests" "$exe" "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
# Read tests.
|
# Read tests.
|
||||||
sh "$testdir/read.sh" "$d" "$exe" "$@"
|
if [ "$pll" -ne 0 ]; then
|
||||||
|
sh "$testdir/read.sh" "$d" "$exe" "$@" &
|
||||||
|
pids="$pids $!"
|
||||||
|
else
|
||||||
|
sh "$testdir/read.sh" "$d" "$exe" "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
# Error tests.
|
# Error tests.
|
||||||
sh "$testdir/errors.sh" "$d" "$exe" "$@"
|
if [ "$pll" -ne 0 ]; then
|
||||||
|
sh "$testdir/errors.sh" "$d" "$exe" "$@" &
|
||||||
|
pids="$pids $!"
|
||||||
|
else
|
||||||
|
sh "$testdir/errors.sh" "$d" "$exe" "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Test all the files in the errors directory. While the other error test (in
|
||||||
|
# tests/errors.sh) does a test for every line, this does one test per file, but
|
||||||
|
# it runs the file through stdin and as a file on the command-line.
|
||||||
|
for testfile in $testdir/$d/errors/*.txt; do
|
||||||
|
|
||||||
|
b=$(basename "$testfile")
|
||||||
|
|
||||||
|
if [ "$pll" -ne 0 ]; then
|
||||||
|
sh "$testdir/error.sh" "$d" "$b" "$@" &
|
||||||
|
pids="$pids $!"
|
||||||
|
else
|
||||||
|
sh "$testdir/error.sh" "$d" "$b" "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
# Other tests.
|
# Other tests.
|
||||||
sh "$testdir/other.sh" "$d" "$extra" "$exe" "$@"
|
if [ "$pll" -ne 0 ]; then
|
||||||
|
sh "$testdir/other.sh" "$d" "$extra" "$exe" "$@" &
|
||||||
|
pids="$pids $!"
|
||||||
|
else
|
||||||
|
sh "$testdir/other.sh" "$d" "$extra" "$exe" "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
# History tests.
|
if [ "$pll" -ne 0 ]; then
|
||||||
sh "$testdir/history.sh" "$d" -a
|
|
||||||
|
exit_err=0
|
||||||
|
|
||||||
|
for p in $pids; do
|
||||||
|
|
||||||
|
wait "$p"
|
||||||
|
err="$?"
|
||||||
|
|
||||||
|
if [ "$err" -ne 0 ]; then
|
||||||
|
printf 'A test failed!\n'
|
||||||
|
exit_err=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$exit_err" -ne 0 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
printf '\nAll %s tests passed.\n' "$d"
|
printf '\nAll %s tests passed.\n' "$d"
|
||||||
|
|
||||||
|
@ -49,3 +49,4 @@ recursive_arrays
|
|||||||
divmod
|
divmod
|
||||||
modexp
|
modexp
|
||||||
bitfuncs
|
bitfuncs
|
||||||
|
leadingzero
|
||||||
|
12
contrib/bc/tests/bc/leadingzero.txt
Normal file
12
contrib/bc/tests/bc/leadingzero.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
plznl(0.01)
|
||||||
|
plznl(-0.01)
|
||||||
|
plznl(.01)
|
||||||
|
plznl(-.01)
|
||||||
|
plznl(1.01)
|
||||||
|
plznl(-1.01)
|
||||||
|
pnlznl(0.01)
|
||||||
|
pnlznl(-0.01)
|
||||||
|
pnlznl(.01)
|
||||||
|
pnlznl(-.01)
|
||||||
|
pnlznl(1.01)
|
||||||
|
pnlznl(-1.01)
|
12
contrib/bc/tests/bc/leadingzero_results.txt
Normal file
12
contrib/bc/tests/bc/leadingzero_results.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
0.01
|
||||||
|
-0.01
|
||||||
|
0.01
|
||||||
|
-0.01
|
||||||
|
1.01
|
||||||
|
-1.01
|
||||||
|
.01
|
||||||
|
-.01
|
||||||
|
.01
|
||||||
|
-.01
|
||||||
|
1.01
|
||||||
|
-1.01
|
@ -1,5 +1,9 @@
|
|||||||
#! /usr/bin/bc -gq
|
#! /usr/bin/bc -gq
|
||||||
|
|
||||||
|
if (!global_stacks()) {
|
||||||
|
sqrt(-1)
|
||||||
|
}
|
||||||
|
|
||||||
define i(x) {
|
define i(x) {
|
||||||
ibase=x
|
ibase=x
|
||||||
return ibase
|
return ibase
|
||||||
|
@ -234,6 +234,104 @@ int main(void) {
|
|||||||
// Clean up.
|
// Clean up.
|
||||||
bcl_num_free(n);
|
bcl_num_free(n);
|
||||||
|
|
||||||
|
// Test leading zeroes.
|
||||||
|
if (bcl_leadingZeroes())
|
||||||
|
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
|
||||||
|
|
||||||
|
n = bcl_parse("0.01");
|
||||||
|
err(bcl_err(n));
|
||||||
|
|
||||||
|
n2 = bcl_parse("-0.01");
|
||||||
|
err(bcl_err(n2));
|
||||||
|
|
||||||
|
n3 = bcl_parse("1.01");
|
||||||
|
err(bcl_err(n3));
|
||||||
|
|
||||||
|
n4 = bcl_parse("-1.01");
|
||||||
|
err(bcl_err(n4));
|
||||||
|
|
||||||
|
res = bcl_string(bcl_dup(n));
|
||||||
|
if (strcmp(res, ".01"))
|
||||||
|
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
|
||||||
|
|
||||||
|
free(res);
|
||||||
|
|
||||||
|
res = bcl_string(bcl_dup(n2));
|
||||||
|
if (strcmp(res, "-.01"))
|
||||||
|
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
|
||||||
|
|
||||||
|
free(res);
|
||||||
|
|
||||||
|
res = bcl_string(bcl_dup(n3));
|
||||||
|
if (strcmp(res, "1.01"))
|
||||||
|
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
|
||||||
|
|
||||||
|
free(res);
|
||||||
|
|
||||||
|
res = bcl_string(bcl_dup(n4));
|
||||||
|
if (strcmp(res, "-1.01"))
|
||||||
|
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
|
||||||
|
|
||||||
|
free(res);
|
||||||
|
|
||||||
|
bcl_setLeadingZeroes(true);
|
||||||
|
|
||||||
|
if (!bcl_leadingZeroes())
|
||||||
|
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
|
||||||
|
|
||||||
|
res = bcl_string(bcl_dup(n));
|
||||||
|
if (strcmp(res, "0.01"))
|
||||||
|
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
|
||||||
|
|
||||||
|
free(res);
|
||||||
|
|
||||||
|
res = bcl_string(bcl_dup(n2));
|
||||||
|
if (strcmp(res, "-0.01"))
|
||||||
|
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
|
||||||
|
|
||||||
|
free(res);
|
||||||
|
|
||||||
|
res = bcl_string(bcl_dup(n3));
|
||||||
|
if (strcmp(res, "1.01"))
|
||||||
|
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
|
||||||
|
|
||||||
|
free(res);
|
||||||
|
|
||||||
|
res = bcl_string(bcl_dup(n4));
|
||||||
|
if (strcmp(res, "-1.01"))
|
||||||
|
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
|
||||||
|
|
||||||
|
free(res);
|
||||||
|
|
||||||
|
bcl_setLeadingZeroes(false);
|
||||||
|
|
||||||
|
if (bcl_leadingZeroes())
|
||||||
|
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
|
||||||
|
|
||||||
|
res = bcl_string(n);
|
||||||
|
if (strcmp(res, ".01"))
|
||||||
|
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
|
||||||
|
|
||||||
|
free(res);
|
||||||
|
|
||||||
|
res = bcl_string(n2);
|
||||||
|
if (strcmp(res, "-.01"))
|
||||||
|
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
|
||||||
|
|
||||||
|
free(res);
|
||||||
|
|
||||||
|
res = bcl_string(n3);
|
||||||
|
if (strcmp(res, "1.01"))
|
||||||
|
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
|
||||||
|
|
||||||
|
free(res);
|
||||||
|
|
||||||
|
res = bcl_string(n4);
|
||||||
|
if (strcmp(res, "-1.01"))
|
||||||
|
err(BCL_ERROR_FATAL_UNKNOWN_ERR);
|
||||||
|
|
||||||
|
free(res);
|
||||||
|
|
||||||
bcl_ctxt_freeNums(ctxt);
|
bcl_ctxt_freeNums(ctxt);
|
||||||
|
|
||||||
bcl_gc();
|
bcl_gc();
|
||||||
|
@ -24,6 +24,9 @@ zp198202389.289374pzp[He World!]xSzpzXfrfxzpfR
|
|||||||
3 0~
|
3 0~
|
||||||
0 _251^pR
|
0 _251^pR
|
||||||
.
|
.
|
||||||
|
ga
|
||||||
|
gb
|
||||||
|
gd
|
||||||
@
|
@
|
||||||
0 0< $
|
0 0< $
|
||||||
0 0> s e %
|
0 0> s e %
|
||||||
|
99
contrib/bc/tests/error.sh
Executable file
99
contrib/bc/tests/error.sh
Executable file
@ -0,0 +1,99 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018-2021 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"
|
||||||
|
testdir=$(dirname "$script")
|
||||||
|
|
||||||
|
. "$testdir/../scripts/functions.sh"
|
||||||
|
|
||||||
|
outputdir=${BC_TEST_OUTPUT_DIR:-$testdir}
|
||||||
|
|
||||||
|
# Command-line processing.
|
||||||
|
if [ "$#" -lt 2 ]; then
|
||||||
|
printf 'usage: %s dir test [exec args...]\n' "$script"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
d="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
t="$1"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$#" -lt 1 ]; then
|
||||||
|
exe="$testdir/../bin/$d"
|
||||||
|
else
|
||||||
|
exe="$1"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
|
# I use these, so unset them to make the tests work.
|
||||||
|
unset BC_ENV_ARGS
|
||||||
|
unset BC_LINE_LENGTH
|
||||||
|
unset DC_ENV_ARGS
|
||||||
|
unset DC_LINE_LENGTH
|
||||||
|
|
||||||
|
out="$outputdir/${d}_outputs/error_results_${t}"
|
||||||
|
outdir=$(dirname "$out")
|
||||||
|
|
||||||
|
# Make sure the directory exists.
|
||||||
|
if [ ! -d "$outdir" ]; then
|
||||||
|
mkdir -p "$outdir"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set stuff for the correct calculator.
|
||||||
|
if [ "$d" = "bc" ]; then
|
||||||
|
opts="-l"
|
||||||
|
halt="halt"
|
||||||
|
read_call="read()"
|
||||||
|
read_expr="${read_call}\n5+5;"
|
||||||
|
else
|
||||||
|
opts="-x"
|
||||||
|
halt="q"
|
||||||
|
fi
|
||||||
|
|
||||||
|
testfile="$testdir/$d/errors/$t"
|
||||||
|
|
||||||
|
printf 'Running %s error file %s...' "$d" "$t"
|
||||||
|
|
||||||
|
printf '%s\n' "$halt" | "$exe" "$@" $opts "$testfile" 2> "$out" > /dev/null
|
||||||
|
err="$?"
|
||||||
|
|
||||||
|
checkerrtest "$d" "$err" "$testfile" "$out" "$exebase" > /dev/null
|
||||||
|
|
||||||
|
printf 'pass\n'
|
||||||
|
|
||||||
|
printf 'Running %s error file %s through cat...' "$d" "$t"
|
||||||
|
|
||||||
|
cat "$testfile" | "$exe" "$@" $opts 2> "$out" > /dev/null
|
||||||
|
err="$?"
|
||||||
|
|
||||||
|
checkcrash "$d" "$err" "$testfile"
|
||||||
|
|
||||||
|
printf 'pass\n'
|
@ -147,28 +147,3 @@ for testfile in $testdir/$d/*errors.txt; do
|
|||||||
printf 'pass\n'
|
printf 'pass\n'
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Test all the files in the errors directory. While the loop above does one test
|
|
||||||
# for every line, this does one test per file, but it runs the file through
|
|
||||||
# stdin and as a file on the command-line.
|
|
||||||
for testfile in $testdir/$d/errors/*.txt; do
|
|
||||||
|
|
||||||
printf 'Running %s error file %s...' "$d" "$testfile"
|
|
||||||
|
|
||||||
printf '%s\n' "$halt" | "$exe" "$@" $opts "$testfile" 2> "$out" > /dev/null
|
|
||||||
err="$?"
|
|
||||||
|
|
||||||
checkerrtest "$d" "$err" "$testfile" "$out" "$exebase"
|
|
||||||
|
|
||||||
printf 'pass\n'
|
|
||||||
|
|
||||||
printf 'Running %s error file %s through cat...' "$d" "$testfile"
|
|
||||||
|
|
||||||
cat "$testfile" | "$exe" "$@" $opts 2> "$out" > /dev/null
|
|
||||||
err="$?"
|
|
||||||
|
|
||||||
checkcrash "$d" "$err" "$testfile"
|
|
||||||
|
|
||||||
printf 'pass\n'
|
|
||||||
|
|
||||||
done
|
|
||||||
|
@ -6,3 +6,4 @@ scientific
|
|||||||
shift
|
shift
|
||||||
trunc
|
trunc
|
||||||
bitfuncs
|
bitfuncs
|
||||||
|
leadingzero
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
import os, sys
|
import os, sys
|
||||||
import time
|
import time
|
||||||
import signal
|
import signal
|
||||||
|
import traceback
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import pexpect
|
import pexpect
|
||||||
@ -72,23 +73,54 @@
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def expect(child, data):
|
||||||
|
child.expect(data)
|
||||||
|
|
||||||
|
|
||||||
|
# Eats all of the child's data.
|
||||||
|
# @param child The child whose data should be eaten.
|
||||||
|
def eat(child):
|
||||||
|
while child.buffer is not None and len(child.buffer) > 0:
|
||||||
|
expect(child, ".+")
|
||||||
|
|
||||||
|
|
||||||
|
# Send data to a child. This makes sure the buffers are empty first.
|
||||||
|
# @param child The child to send data to.
|
||||||
|
# @param data The data to send.
|
||||||
|
def send(child, data):
|
||||||
|
eat(child)
|
||||||
|
child.send(data)
|
||||||
|
|
||||||
|
|
||||||
|
def wait(child):
|
||||||
|
if child.isalive():
|
||||||
|
child.sendeof()
|
||||||
|
time.sleep(1)
|
||||||
|
if child.isalive():
|
||||||
|
child.kill(signal.SIGTERM)
|
||||||
|
time.sleep(1)
|
||||||
|
if child.isalive():
|
||||||
|
child.kill(signal.SIGKILL)
|
||||||
|
child.wait()
|
||||||
|
|
||||||
|
|
||||||
# Check that the child output the expected line. If history is false, then
|
# Check that the child output the expected line. If history is false, then
|
||||||
# the output should change.
|
# the output should change.
|
||||||
def check_line(child, expected, prompt=">>> ", history=True):
|
def check_line(child, expected, prompt=">>> ", history=True):
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
prefix = "\r\n" if history else ""
|
prefix = "\r\n" if history else ""
|
||||||
child.expect(prefix + expected + "\r\n" + prompt)
|
expect(child, prefix + expected + "\r\n" + prompt)
|
||||||
|
|
||||||
|
|
||||||
# Write a string to output, checking all of the characters are output,
|
# Write a string to output, checking all of the characters are output,
|
||||||
# one-by-one.
|
# one-by-one.
|
||||||
def write_str(child, s):
|
def write_str(child, s):
|
||||||
for c in s:
|
for c in s:
|
||||||
child.send(c)
|
send(child, c)
|
||||||
if c in escapes:
|
if c in escapes:
|
||||||
child.expect("\\{}".format(c))
|
expect(child, "\\{}".format(c))
|
||||||
else:
|
else:
|
||||||
child.expect(c)
|
expect(child, c)
|
||||||
|
|
||||||
|
|
||||||
# Check the bc banner.
|
# Check the bc banner.
|
||||||
@ -98,11 +130,11 @@ def bc_banner(child):
|
|||||||
bc_banner2 = "Copyright \(c\) 2018-[2-9][0-9][0-9][0-9] Gavin D. Howard and contributors\r\n"
|
bc_banner2 = "Copyright \(c\) 2018-[2-9][0-9][0-9][0-9] Gavin D. Howard and contributors\r\n"
|
||||||
bc_banner3 = "Report bugs at: https://git.yzena.com/gavin/bc\r\n\r\n"
|
bc_banner3 = "Report bugs at: https://git.yzena.com/gavin/bc\r\n\r\n"
|
||||||
bc_banner4 = "This is free software with ABSOLUTELY NO WARRANTY.\r\n\r\n"
|
bc_banner4 = "This is free software with ABSOLUTELY NO WARRANTY.\r\n\r\n"
|
||||||
child.expect(bc_banner1)
|
expect(child, bc_banner1)
|
||||||
child.expect(bc_banner2)
|
expect(child, bc_banner2)
|
||||||
child.expect(bc_banner3)
|
expect(child, bc_banner3)
|
||||||
child.expect(bc_banner4)
|
expect(child, bc_banner4)
|
||||||
child.expect(prompt)
|
expect(child, prompt)
|
||||||
|
|
||||||
|
|
||||||
# Common UTF-8 testing function. The index is the index into utf8_stress_strs
|
# Common UTF-8 testing function. The index is the index into utf8_stress_strs
|
||||||
@ -121,20 +153,20 @@ def test_utf8(exe, args, env, idx, bc=True):
|
|||||||
try:
|
try:
|
||||||
|
|
||||||
# Write the stress string.
|
# Write the stress string.
|
||||||
child.send(utf8_stress_strs[idx])
|
send(child, utf8_stress_strs[idx])
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.expect("Parse error: bad character")
|
|
||||||
|
|
||||||
if bc:
|
if bc:
|
||||||
child.send("quit")
|
send(child, "quit")
|
||||||
else:
|
else:
|
||||||
child.send("q")
|
send(child, "q")
|
||||||
|
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
|
|
||||||
child.wait()
|
wait(child)
|
||||||
|
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -162,21 +194,21 @@ def test_utf8_0(exe, args, env, bc=True):
|
|||||||
|
|
||||||
# Just random UTF-8 I generated somewhow, plus ensuring that insert works.
|
# Just random UTF-8 I generated somewhow, plus ensuring that insert works.
|
||||||
write_str(child, "ﴪáá̵̗🈐ã")
|
write_str(child, "ﴪáá̵̗🈐ã")
|
||||||
child.send("\x1b[D\x1b[D\x1b[D\x1b\x1b[Aℐ")
|
send(child, "\x1b[D\x1b[D\x1b[D\x1b\x1b[Aℐ")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
|
|
||||||
child.expect("Parse error: bad character")
|
|
||||||
|
|
||||||
if bc:
|
if bc:
|
||||||
child.send("quit")
|
send(child, "quit")
|
||||||
else:
|
else:
|
||||||
child.send("q")
|
send(child, "q")
|
||||||
|
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
|
eat(child)
|
||||||
|
|
||||||
child.wait()
|
wait(child)
|
||||||
|
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -212,15 +244,19 @@ def test_utf8_4(exe, args, env, bc=True):
|
|||||||
# @param env The environment.
|
# @param env The environment.
|
||||||
def test_sigint_sigquit(exe, args, env):
|
def test_sigint_sigquit(exe, args, env):
|
||||||
|
|
||||||
|
# Because both bc and dc use this, make sure the banner doesn't pop.
|
||||||
|
env["BC_BANNER"] = "0"
|
||||||
|
|
||||||
child = pexpect.spawn(exe, args=args, env=env)
|
child = pexpect.spawn(exe, args=args, env=env)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
child.send("\t")
|
send(child, "\t")
|
||||||
child.expect(" ")
|
expect(child, " ")
|
||||||
child.send("\x03")
|
send(child, "\x03")
|
||||||
child.send("\x1c")
|
send(child, "\x1c")
|
||||||
child.wait()
|
wait(child)
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -240,14 +276,18 @@ def test_sigint_sigquit(exe, args, env):
|
|||||||
# @param env The environment.
|
# @param env The environment.
|
||||||
def test_eof(exe, args, env):
|
def test_eof(exe, args, env):
|
||||||
|
|
||||||
|
# Because both bc and dc use this, make sure the banner doesn't pop.
|
||||||
|
env["BC_BANNER"] = "0"
|
||||||
|
|
||||||
child = pexpect.spawn(exe, args=args, env=env)
|
child = pexpect.spawn(exe, args=args, env=env)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
child.send("\t")
|
send(child, "\t")
|
||||||
child.expect(" ")
|
expect(child, " ")
|
||||||
child.send("\x04")
|
send(child, "\x04")
|
||||||
child.wait()
|
wait(child)
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -267,17 +307,21 @@ def test_eof(exe, args, env):
|
|||||||
# @param env The environment.
|
# @param env The environment.
|
||||||
def test_sigint(exe, args, env):
|
def test_sigint(exe, args, env):
|
||||||
|
|
||||||
|
# Because both bc and dc use this, make sure the banner doesn't pop.
|
||||||
|
env["BC_BANNER"] = "0"
|
||||||
|
|
||||||
env["BC_SIGINT_RESET"] = "0"
|
env["BC_SIGINT_RESET"] = "0"
|
||||||
env["DC_SIGINT_RESET"] = "0"
|
env["DC_SIGINT_RESET"] = "0"
|
||||||
|
|
||||||
child = pexpect.spawn(exe, args=args, env=env)
|
child = pexpect.spawn(exe, args=args, env=env)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
child.send("\t")
|
send(child, "\t")
|
||||||
child.expect(" ")
|
expect(child, " ")
|
||||||
child.send("\x03")
|
send(child, "\x03")
|
||||||
child.wait()
|
wait(child)
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -297,12 +341,19 @@ def test_sigint(exe, args, env):
|
|||||||
# @param env The environment.
|
# @param env The environment.
|
||||||
def test_sigtstp(exe, args, env):
|
def test_sigtstp(exe, args, env):
|
||||||
|
|
||||||
|
# This test does not work on FreeBSD, so skip.
|
||||||
|
if sys.platform.startswith("freebsd"):
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
# Because both bc and dc use this, make sure the banner doesn't pop.
|
||||||
|
env["BC_BANNER"] = "0"
|
||||||
|
|
||||||
child = pexpect.spawn(exe, args=args, env=env)
|
child = pexpect.spawn(exe, args=args, env=env)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
child.send("\t")
|
send(child, "\t")
|
||||||
child.expect(" ")
|
expect(child, " ")
|
||||||
child.send("\x13")
|
send(child, "\x13")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
if not child.isalive():
|
if not child.isalive():
|
||||||
print("child exited early")
|
print("child exited early")
|
||||||
@ -310,10 +361,11 @@ def test_sigtstp(exe, args, env):
|
|||||||
print(str(child.buffer))
|
print(str(child.buffer))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
child.kill(signal.SIGCONT)
|
child.kill(signal.SIGCONT)
|
||||||
write_str(child, "quit")
|
send(child, "quit")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.wait()
|
wait(child)
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -333,19 +385,22 @@ def test_sigtstp(exe, args, env):
|
|||||||
# @param env The environment.
|
# @param env The environment.
|
||||||
def test_sigstop(exe, args, env):
|
def test_sigstop(exe, args, env):
|
||||||
|
|
||||||
|
# Because both bc and dc use this, make sure the banner doesn't pop.
|
||||||
|
env["BC_BANNER"] = "0"
|
||||||
|
|
||||||
child = pexpect.spawn(exe, args=args, env=env)
|
child = pexpect.spawn(exe, args=args, env=env)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
child.send("\t")
|
send(child, "\t")
|
||||||
child.expect(" ")
|
expect(child, " ")
|
||||||
child.send("\x14")
|
send(child, "\x14")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
if not child.isalive():
|
if not child.isalive():
|
||||||
print("child exited early")
|
print("child exited early")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
print(str(child.buffer))
|
print(str(child.buffer))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
child.send("\x13")
|
send(child, "\x13")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
if not child.isalive():
|
if not child.isalive():
|
||||||
print("child exited early")
|
print("child exited early")
|
||||||
@ -353,10 +408,11 @@ def test_sigstop(exe, args, env):
|
|||||||
print(str(child.buffer))
|
print(str(child.buffer))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
child.kill(signal.SIGCONT)
|
child.kill(signal.SIGCONT)
|
||||||
child.send("quit")
|
send(child, "quit")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.wait()
|
wait(child)
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -404,10 +460,11 @@ def test_bc1(exe, args, env):
|
|||||||
check_line(child, "1")
|
check_line(child, "1")
|
||||||
write_str(child, "1")
|
write_str(child, "1")
|
||||||
check_line(child, "1")
|
check_line(child, "1")
|
||||||
write_str(child, "quit")
|
send(child, "quit")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.wait()
|
wait(child)
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -438,8 +495,9 @@ def test_bc2(exe, args, env):
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
child.sendintr()
|
child.sendintr()
|
||||||
child.sendline("quit")
|
child.sendline("quit")
|
||||||
child.wait()
|
wait(child)
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -463,22 +521,23 @@ def test_bc3(exe, args, env):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
bc_banner(child)
|
bc_banner(child)
|
||||||
child.send("\x1b[D\x1b[D\x1b[C\x1b[C")
|
send(child, "\x1b[D\x1b[D\x1b[C\x1b[C")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.expect(prompt)
|
expect(child, prompt)
|
||||||
child.send("12\x1b[D3\x1b[C4\x1bOD5\x1bOC6")
|
send(child, "12\x1b[D3\x1b[C4\x1bOD5\x1bOC6")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
check_line(child, "132546")
|
check_line(child, "132546")
|
||||||
child.send("12\x023\x064")
|
send(child, "12\x023\x064")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
check_line(child, "1324")
|
check_line(child, "1324")
|
||||||
child.send("12\x1b[H3\x1bOH\x01\x1b[H45\x1bOF6\x05\x1b[F7\x1bOH8")
|
send(child, "12\x1b[H3\x1bOH\x01\x1b[H45\x1bOF6\x05\x1b[F7\x1bOH8")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
check_line(child, "84531267")
|
check_line(child, "84531267")
|
||||||
write_str(child, "quit")
|
send(child, "quit")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.wait()
|
wait(child)
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -502,25 +561,26 @@ def test_bc4(exe, args, env):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
bc_banner(child)
|
bc_banner(child)
|
||||||
child.send("\x1b[A\x1bOA\x1b[B\x1bOB")
|
send(child, "\x1b[A\x1bOA\x1b[B\x1bOB")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.expect(prompt)
|
expect(child, prompt)
|
||||||
write_str(child, "15")
|
write_str(child, "15")
|
||||||
check_line(child, "15")
|
check_line(child, "15")
|
||||||
write_str(child, "2^16")
|
write_str(child, "2^16")
|
||||||
check_line(child, "65536")
|
check_line(child, "65536")
|
||||||
child.send("\x1b[A\x1bOA")
|
send(child, "\x1b[A\x1bOA")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
check_line(child, "15")
|
check_line(child, "15")
|
||||||
child.send("\x1b[A\x1bOA\x1b[A\x1b[B")
|
send(child, "\x1b[A\x1bOA\x1b[A\x1b[B")
|
||||||
check_line(child, "65536")
|
check_line(child, "65536")
|
||||||
child.send("\x1b[A\x1bOA\x0e\x1b[A\x1b[A\x1b[A\x1b[B\x10\x1b[B\x1b[B\x1bOB\x1b[B\x1bOA")
|
send(child, "\x1b[A\x1bOA\x0e\x1b[A\x1b[A\x1b[A\x1b[B\x10\x1b[B\x1b[B\x1bOB\x1b[B\x1bOA")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
check_line(child, "65536")
|
check_line(child, "65536")
|
||||||
write_str(child, "quit")
|
send(child, "quit")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.wait()
|
wait(child)
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -544,11 +604,12 @@ def test_bc5(exe, args, env):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
bc_banner(child)
|
bc_banner(child)
|
||||||
child.send("\x0c")
|
send(child, "\x0c")
|
||||||
write_str(child, "quit")
|
send(child, "quit")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.wait()
|
wait(child)
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -572,15 +633,16 @@ def test_bc6(exe, args, env):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
bc_banner(child)
|
bc_banner(child)
|
||||||
child.send("print \"Enter number: \"")
|
send(child, "print \"Enter number: \"")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.expect("Enter number: ")
|
expect(child, "Enter number: ")
|
||||||
child.send("4\x1b[A\x1b[A")
|
send(child, "4\x1b[A\x1b[A")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
write_str(child, "quit")
|
send(child, "quit")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.wait()
|
wait(child)
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -604,34 +666,35 @@ def test_bc7(exe, args, env):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
bc_banner(child)
|
bc_banner(child)
|
||||||
child.send("\x1bb\x1bb\x1bf\x1bf")
|
send(child, "\x1bb\x1bb\x1bf\x1bf")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.expect(prompt)
|
expect(child, prompt)
|
||||||
child.send("\x1b[0~\x1b[3a")
|
send(child, "\x1b[0~\x1b[3a")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.expect(prompt)
|
expect(child, prompt)
|
||||||
child.send("\x1b[0;4\x1b[0A")
|
send(child, "\x1b[0;4\x1b[0A")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.expect(prompt)
|
expect(child, prompt)
|
||||||
child.send(" ")
|
send(child, " ")
|
||||||
child.send("\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb")
|
send(child, "\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb")
|
||||||
child.send("\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf")
|
send(child, "\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.expect(prompt)
|
expect(child, prompt)
|
||||||
write_str(child, "12 + 34 + 56 + 78 + 90")
|
write_str(child, "12 + 34 + 56 + 78 + 90")
|
||||||
check_line(child, "270")
|
check_line(child, "270")
|
||||||
child.send("\x1b[A")
|
send(child, "\x1b[A")
|
||||||
child.send("\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb")
|
send(child, "\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb\x1bb")
|
||||||
child.send("\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf")
|
send(child, "\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf\x1bf")
|
||||||
check_line(child, "270")
|
check_line(child, "270")
|
||||||
child.send("\x1b[A")
|
send(child, "\x1b[A")
|
||||||
child.send("\x1bh\x1bh\x1bf + 14 ")
|
send(child, "\x1bh\x1bh\x1bf + 14 ")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
check_line(child, "284")
|
check_line(child, "284")
|
||||||
write_str(child, "quit")
|
send(child, "quit")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.wait()
|
wait(child)
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -655,13 +718,14 @@ def test_bc8(exe, args, env):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
bc_banner(child)
|
bc_banner(child)
|
||||||
child.send("12\x1b[D3\x1b[C4\x08\x7f")
|
send(child, "12\x1b[D3\x1b[C4\x08\x7f")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
check_line(child, "13")
|
check_line(child, "13")
|
||||||
write_str(child, "quit")
|
send(child, "quit")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.wait()
|
wait(child)
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -685,26 +749,27 @@ def test_bc9(exe, args, env):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
bc_banner(child)
|
bc_banner(child)
|
||||||
child.send("\x1b[0;5D\x1b[0;5D\x1b[0;5D\x1b[0;5C\x1b[0;5D\x1bd\x1b[3~\x1b[d\x1b[d\x1b[d\x1b[d\x7f\x7f\x7f")
|
send(child, "\x1b[0;5D\x1b[0;5D\x1b[0;5D\x1b[0;5C\x1b[0;5D\x1bd\x1b[3~\x1b[d\x1b[d\x1b[d\x1b[d\x7f\x7f\x7f")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.expect(prompt)
|
expect(child, prompt)
|
||||||
write_str(child, "12 + 34 + 56 + 78 + 90")
|
write_str(child, "12 + 34 + 56 + 78 + 90")
|
||||||
check_line(child, "270")
|
check_line(child, "270")
|
||||||
child.send("\x1b[A")
|
send(child, "\x1b[A")
|
||||||
child.send("\x1b[0;5D\x1b[0;5D\x1b[0;5D\x1b[0;5C\x1b[0;5D\x1bd\x1b[3~\x1b[d\x1b[d\x1b[d\x1b[d\x7f\x7f\x7f")
|
send(child, "\x1b[0;5D\x1b[0;5D\x1b[0;5D\x1b[0;5C\x1b[0;5D\x1bd\x1b[3~\x1b[d\x1b[d\x1b[d\x1b[d\x7f\x7f\x7f")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
check_line(child, "102")
|
check_line(child, "102")
|
||||||
child.send("\x1b[A")
|
send(child, "\x1b[A")
|
||||||
child.send("\x17\x17")
|
send(child, "\x17\x17")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
check_line(child, "46")
|
check_line(child, "46")
|
||||||
child.send("\x17\x17")
|
send(child, "\x17\x17")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.expect(prompt)
|
expect(child, prompt)
|
||||||
write_str(child, "quit")
|
send(child, "quit")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.wait()
|
wait(child)
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -728,26 +793,27 @@ def test_bc10(exe, args, env):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
bc_banner(child)
|
bc_banner(child)
|
||||||
child.send("\x1b[3~\x1b[3~")
|
send(child, "\x1b[3~\x1b[3~")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.expect(prompt)
|
expect(child, prompt)
|
||||||
child.send(" \x1b[3~\x1b[3~")
|
send(child, " \x1b[3~\x1b[3~")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.expect(prompt)
|
expect(child, prompt)
|
||||||
write_str(child, "12 + 34 + 56 + 78 + 90")
|
write_str(child, "12 + 34 + 56 + 78 + 90")
|
||||||
check_line(child, "270")
|
check_line(child, "270")
|
||||||
child.send("\x1b[A\x1b[A\x1b[A\x1b[B\x1b[B\x1b[B\x1b[A")
|
send(child, "\x1b[A\x1b[A\x1b[A\x1b[B\x1b[B\x1b[B\x1b[A")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
check_line(child, "270")
|
check_line(child, "270")
|
||||||
child.send("\x1b[A\x1b[0;5D\x1b[0;5D\x0b")
|
send(child, "\x1b[A\x1b[0;5D\x1b[0;5D\x0b")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
check_line(child, "180")
|
check_line(child, "180")
|
||||||
child.send("\x1b[A\x1521")
|
send(child, "\x1b[A\x1521")
|
||||||
check_line(child, "21")
|
check_line(child, "21")
|
||||||
write_str(child, "quit")
|
send(child, "quit")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.wait()
|
wait(child)
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -771,17 +837,18 @@ def test_bc11(exe, args, env):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
bc_banner(child)
|
bc_banner(child)
|
||||||
child.send("\x1b[A\x02\x14")
|
send(child, "\x1b[A\x02\x14")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.expect(prompt)
|
expect(child, prompt)
|
||||||
write_str(child, "12 + 34 + 56 + 78")
|
write_str(child, "12 + 34 + 56 + 78")
|
||||||
check_line(child, "180")
|
check_line(child, "180")
|
||||||
child.send("\x1b[A\x02\x14")
|
send(child, "\x1b[A\x02\x14")
|
||||||
check_line(child, "189")
|
check_line(child, "189")
|
||||||
write_str(child, "quit")
|
send(child, "quit")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.wait()
|
wait(child)
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -805,18 +872,19 @@ def test_bc12(exe, args, env):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
bc_banner(child)
|
bc_banner(child)
|
||||||
child.send("12 +")
|
send(child, "12 +")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
if not child.isalive():
|
if not child.isalive():
|
||||||
print("child exited early")
|
print("child exited early")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
print(str(child.buffer))
|
print(str(child.buffer))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
child.send("quit")
|
send(child, "quit")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.wait()
|
wait(child)
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -864,9 +932,10 @@ def test_dc1(exe, args, env):
|
|||||||
write_str(child, "1pR")
|
write_str(child, "1pR")
|
||||||
check_line(child, "1")
|
check_line(child, "1")
|
||||||
write_str(child, "q")
|
write_str(child, "q")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.wait()
|
wait(child)
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -896,8 +965,9 @@ def test_dc2(exe, args, env):
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
child.sendintr()
|
child.sendintr()
|
||||||
child.sendline("q")
|
child.sendline("q")
|
||||||
child.wait()
|
wait(child)
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -925,9 +995,10 @@ def test_dc3(exe, args, env):
|
|||||||
write_str(child, "1pR")
|
write_str(child, "1pR")
|
||||||
check_line(child, "1")
|
check_line(child, "1")
|
||||||
write_str(child, "q")
|
write_str(child, "q")
|
||||||
child.send("\n")
|
send(child, "\n")
|
||||||
child.wait()
|
wait(child)
|
||||||
except pexpect.TIMEOUT:
|
except pexpect.TIMEOUT:
|
||||||
|
traceback.print_tb(sys.exc_info()[2])
|
||||||
print("timed out")
|
print("timed out")
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
@ -988,7 +1059,7 @@ def usage():
|
|||||||
print(" The valid values for dir are: 'bc' and 'dc'.")
|
print(" The valid values for dir are: 'bc' and 'dc'.")
|
||||||
print(" The max test_idx for bc is {}.".format(len(bc_tests) - 1))
|
print(" The max test_idx for bc is {}.".format(len(bc_tests) - 1))
|
||||||
print(" The max test_idx for dc is {}.".format(len(dc_tests) - 1))
|
print(" The max test_idx for dc is {}.".format(len(dc_tests) - 1))
|
||||||
print(" If -a is given, the number of test for dir is printed.")
|
print(" If -a is given, the number of tests for dir is printed.")
|
||||||
print(" No tests are run.")
|
print(" No tests are run.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
@ -1038,7 +1109,7 @@ def usage():
|
|||||||
# Use the correct options.
|
# Use the correct options.
|
||||||
if exebase == "bc":
|
if exebase == "bc":
|
||||||
halt = "halt\n"
|
halt = "halt\n"
|
||||||
options = "-lq"
|
options = "-l"
|
||||||
test_array = bc_tests
|
test_array = bc_tests
|
||||||
else:
|
else:
|
||||||
halt = "q\n"
|
halt = "q\n"
|
||||||
@ -1076,7 +1147,7 @@ def usage():
|
|||||||
|
|
||||||
exit = child.exitstatus
|
exit = child.exitstatus
|
||||||
|
|
||||||
if exit != 0:
|
if exit is not None and exit != 0:
|
||||||
print("child failed; expected exit code 0, got {}".format(exit))
|
print("child failed; expected exit code 0, got {}".format(exit))
|
||||||
print(str(child))
|
print(str(child))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -33,7 +33,7 @@ testdir=$(dirname "$script")
|
|||||||
|
|
||||||
. "$testdir/../scripts/functions.sh"
|
. "$testdir/../scripts/functions.sh"
|
||||||
|
|
||||||
# usage: history.sh dir -a|idx
|
# usage: history.sh dir -a|idx [exe args...]
|
||||||
|
|
||||||
# If Python does not exist, then just skip.
|
# If Python does not exist, then just skip.
|
||||||
py=$(command -v python3)
|
py=$(command -v python3)
|
||||||
@ -60,6 +60,24 @@ shift
|
|||||||
idx="$1"
|
idx="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
|
if [ "$#" -gt 0 ]; then
|
||||||
|
|
||||||
|
# exe is the executable to run.
|
||||||
|
exe="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
else
|
||||||
|
exe="$testdir/../bin/$d"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$d" = "bc" ]; then
|
||||||
|
flip="! %s"
|
||||||
|
addone="%s + 1"
|
||||||
|
else
|
||||||
|
flip="%s Np"
|
||||||
|
addone="%s 1+p"
|
||||||
|
fi
|
||||||
|
|
||||||
# Set the test range correctly for all tests or one test. st is the start index.
|
# Set the test range correctly for all tests or one test. st is the start index.
|
||||||
if [ "$idx" = "-a" ]; then
|
if [ "$idx" = "-a" ]; then
|
||||||
idx=$("$py" "$testdir/history.py" "$d" -a)
|
idx=$("$py" "$testdir/history.py" "$d" -a)
|
||||||
@ -72,12 +90,12 @@ fi
|
|||||||
# Run all of the tests.
|
# Run all of the tests.
|
||||||
for i in $(seq "$st" "$idx"); do
|
for i in $(seq "$st" "$idx"); do
|
||||||
|
|
||||||
|
printf 'Running %s history test %d...' "$d" "$i"
|
||||||
|
|
||||||
for j in $(seq 1 3); do
|
for j in $(seq 1 3); do
|
||||||
|
|
||||||
printf 'Running %s history test %d...' "$d" "$i"
|
"$py" "$testdir/history.py" "$d" "$i" "$exe" "$@"
|
||||||
|
err="$?"
|
||||||
"$py" "$testdir/history.py" "$d" "$i" "$@"
|
|
||||||
err=$?
|
|
||||||
|
|
||||||
if [ "$err" -eq 0 ]; then
|
if [ "$err" -eq 0 ]; then
|
||||||
break
|
break
|
||||||
@ -85,7 +103,7 @@ for i in $(seq "$st" "$idx"); do
|
|||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
checktest_retcode "$d" "$err" "$d history tests $i"
|
checktest_retcode "$d" "$err" "$d history test $i"
|
||||||
|
|
||||||
printf 'pass\n'
|
printf 'pass\n'
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@ fi
|
|||||||
|
|
||||||
# For tests later.
|
# For tests later.
|
||||||
num=100000000000000000000000000000000000000000000000000000000000000000000000000000
|
num=100000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||||
|
num2="$num"
|
||||||
numres="$num"
|
numres="$num"
|
||||||
num70="10000000000000000000000000000000000000000000000000000000000000000000\\
|
num70="10000000000000000000000000000000000000000000000000000000000000000000\\
|
||||||
0000000000"
|
0000000000"
|
||||||
@ -74,12 +75,14 @@ if [ "$d" = "bc" ]; then
|
|||||||
opt="x"
|
opt="x"
|
||||||
lopt="extended-register"
|
lopt="extended-register"
|
||||||
line_var="BC_LINE_LENGTH"
|
line_var="BC_LINE_LENGTH"
|
||||||
|
lltest="line_length()"
|
||||||
else
|
else
|
||||||
halt="q"
|
halt="q"
|
||||||
opt="l"
|
opt="l"
|
||||||
lopt="mathlib"
|
lopt="mathlib"
|
||||||
line_var="DC_LINE_LENGTH"
|
line_var="DC_LINE_LENGTH"
|
||||||
num="$num pR"
|
num="$num pR"
|
||||||
|
lltest="glpR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# I use these, so unset them to make the tests work.
|
# I use these, so unset them to make the tests work.
|
||||||
@ -234,17 +237,32 @@ printf '%s\n' "$numres" > "$out1"
|
|||||||
export "$line_var"=80
|
export "$line_var"=80
|
||||||
printf '%s\n' "$num" | "$exe" "$@" > "$out2"
|
printf '%s\n' "$num" | "$exe" "$@" > "$out2"
|
||||||
|
|
||||||
checktest "$d" "$?" "environment var" "$out1" "$out2"
|
checktest "$d" "$?" "line length" "$out1" "$out2"
|
||||||
|
|
||||||
printf '%s\n' "$num70" > "$out1"
|
printf '%s\n' "$num70" > "$out1"
|
||||||
|
|
||||||
export "$line_var"=2147483647
|
export "$line_var"=2147483647
|
||||||
printf '%s\n' "$num" | "$exe" "$@" > "$out2"
|
printf '%s\n' "$num" | "$exe" "$@" > "$out2"
|
||||||
|
|
||||||
checktest "$d" "$?" "environment var" "$out1" "$out2"
|
checktest "$d" "$?" "line length 2" "$out1" "$out2"
|
||||||
|
|
||||||
|
printf '%s\n' "$num2" > "$out1"
|
||||||
|
|
||||||
|
export "$line_var"=62
|
||||||
|
printf '%s\n' "$num" | "$exe" "$@" -L > "$out2"
|
||||||
|
|
||||||
|
checktest "$d" "$?" "line length 3" "$out1" "$out2"
|
||||||
|
|
||||||
|
printf '0\n' > "$out1"
|
||||||
|
printf '%s\n' "$lltest" | "$exe" "$@" -L > "$out2"
|
||||||
|
|
||||||
|
checktest "$d" "$?" "line length 3" "$out1" "$out2"
|
||||||
|
|
||||||
printf 'pass\n'
|
printf 'pass\n'
|
||||||
|
|
||||||
|
printf '%s\n' "$numres" > "$out1"
|
||||||
|
export "$line_var"=2147483647
|
||||||
|
|
||||||
printf 'Running %s arg tests...' "$d"
|
printf 'Running %s arg tests...' "$d"
|
||||||
|
|
||||||
f="$testdir/$d/add.txt"
|
f="$testdir/$d/add.txt"
|
||||||
@ -276,6 +294,26 @@ checktest_retcode "$d" "$?" "arg"
|
|||||||
printf '%s\n' "$halt" | "$exe" "$@" -V > /dev/null
|
printf '%s\n' "$halt" | "$exe" "$@" -V > /dev/null
|
||||||
checktest_retcode "$d" "$?" "arg"
|
checktest_retcode "$d" "$?" "arg"
|
||||||
|
|
||||||
|
out=$(printf '0.1\n-0.1\n1.1\n-1.1\n0.1\n-0.1\n')
|
||||||
|
printf '%s\n' "$out" > "$out1"
|
||||||
|
|
||||||
|
if [ "$d" = "bc" ]; then
|
||||||
|
data=$(printf '0.1\n-0.1\n1.1\n-1.1\n.1\n-.1\n')
|
||||||
|
else
|
||||||
|
data=$(printf '0.1pR\n_0.1pR\n1.1pR\n_1.1pR\n.1pR\n_.1pR\n')
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf '%s\n' "$data" | "$exe" "$@" -z > "$out2"
|
||||||
|
checktest "$d" "$?" "leading zero" "$out1" "$out2"
|
||||||
|
|
||||||
|
if [ "$d" = "bc" ] && [ "$extra_math" -ne 0 ]; then
|
||||||
|
|
||||||
|
printf '%s\n' "$halt" | "$exe" "$@" -lz "$testdir/bc/leadingzero.txt" > "$out2"
|
||||||
|
|
||||||
|
checktest "$d" "$?" "leading zero script" "$testdir/bc/leadingzero_results.txt" "$out2"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
"$exe" "$@" -f "saotehasotnehasthistohntnsahxstnhalcrgxgrlpyasxtsaosysxsatnhoy.txt" > /dev/null 2> "$out2"
|
"$exe" "$@" -f "saotehasotnehasthistohntnsahxstnhalcrgxgrlpyasxtsaosysxsatnhoy.txt" > /dev/null 2> "$out2"
|
||||||
err="$?"
|
err="$?"
|
||||||
|
|
||||||
|
@ -27,15 +27,27 @@
|
|||||||
# POSSIBILITY OF SUCH DAMAGE.
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
#
|
#
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
script="$0"
|
script="$0"
|
||||||
|
|
||||||
testdir=$(dirname "${script}")
|
testdir=$(dirname "${script}")
|
||||||
|
|
||||||
|
pids=""
|
||||||
|
|
||||||
|
# We need to figure out if we should run stuff in parallel.
|
||||||
|
pll=1
|
||||||
|
|
||||||
|
while getopts "n" opt; do
|
||||||
|
|
||||||
|
case "$opt" in
|
||||||
|
n) pll=0 ; shift ; set -e ;;
|
||||||
|
?) usage "Invalid option: $opt" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
# Command-line processing.
|
# Command-line processing.
|
||||||
if [ "$#" -eq 0 ]; then
|
if [ "$#" -eq 0 ]; then
|
||||||
printf 'usage: %s dir [run_extra_tests] [run_stack_tests] [generate_tests] [time_tests] [exec args...]\n' "$script"
|
printf 'usage: %s [-n] dir [run_extra_tests] [run_stack_tests] [generate_tests] [time_tests] [exec args...]\n' "$script"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
d="$1"
|
d="$1"
|
||||||
@ -85,7 +97,36 @@ scripts=$(cat "$scriptdir/all.txt")
|
|||||||
for s in $scripts; do
|
for s in $scripts; do
|
||||||
|
|
||||||
f=$(basename "$s")
|
f=$(basename "$s")
|
||||||
sh "$testdir/script.sh" "$d" "$f" "$run_extra_tests" "$run_stack_tests" \
|
|
||||||
"$generate" "$time_tests" "$exe" "$@"
|
if [ "$pll" -ne 0 ]; then
|
||||||
|
sh "$testdir/script.sh" "$d" "$f" "$run_extra_tests" "$run_stack_tests" \
|
||||||
|
"$generate" "$time_tests" "$exe" "$@" &
|
||||||
|
pids="$pids $!"
|
||||||
|
else
|
||||||
|
sh "$testdir/script.sh" "$d" "$f" "$run_extra_tests" "$run_stack_tests" \
|
||||||
|
"$generate" "$time_tests" "$exe" "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "$pll" -ne 0 ]; then
|
||||||
|
|
||||||
|
exit_err=0
|
||||||
|
|
||||||
|
for p in $pids; do
|
||||||
|
|
||||||
|
wait "$p"
|
||||||
|
err="$?"
|
||||||
|
|
||||||
|
if [ "$err" -ne 0 ]; then
|
||||||
|
printf 'A script failed!\n'
|
||||||
|
exit_err=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$exit_err" -ne 0 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 16
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 16.0.31129.286
|
VisualStudioVersion = 16.0.31515.178
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bc", "bc.vcxproj", "{D5086CFE-052C-4742-B005-E05DB983BBA2}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bc", "bc.vcxproj", "{4450D61F-2535-4085-B1B1-F96ACD23CC9F}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -13,19 +13,19 @@ Global
|
|||||||
Release|x86 = Release|x86
|
Release|x86 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{D5086CFE-052C-4742-B005-E05DB983BBA2}.Debug|x64.ActiveCfg = Debug|x64
|
{4450D61F-2535-4085-B1B1-F96ACD23CC9F}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
{D5086CFE-052C-4742-B005-E05DB983BBA2}.Debug|x64.Build.0 = Debug|x64
|
{4450D61F-2535-4085-B1B1-F96ACD23CC9F}.Debug|x64.Build.0 = Debug|x64
|
||||||
{D5086CFE-052C-4742-B005-E05DB983BBA2}.Debug|x86.ActiveCfg = Debug|Win32
|
{4450D61F-2535-4085-B1B1-F96ACD23CC9F}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
{D5086CFE-052C-4742-B005-E05DB983BBA2}.Debug|x86.Build.0 = Debug|Win32
|
{4450D61F-2535-4085-B1B1-F96ACD23CC9F}.Debug|x86.Build.0 = Debug|Win32
|
||||||
{D5086CFE-052C-4742-B005-E05DB983BBA2}.Release|x64.ActiveCfg = Release|x64
|
{4450D61F-2535-4085-B1B1-F96ACD23CC9F}.Release|x64.ActiveCfg = Release|x64
|
||||||
{D5086CFE-052C-4742-B005-E05DB983BBA2}.Release|x64.Build.0 = Release|x64
|
{4450D61F-2535-4085-B1B1-F96ACD23CC9F}.Release|x64.Build.0 = Release|x64
|
||||||
{D5086CFE-052C-4742-B005-E05DB983BBA2}.Release|x86.ActiveCfg = Release|Win32
|
{4450D61F-2535-4085-B1B1-F96ACD23CC9F}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{D5086CFE-052C-4742-B005-E05DB983BBA2}.Release|x86.Build.0 = Release|Win32
|
{4450D61F-2535-4085-B1B1-F96ACD23CC9F}.Release|x86.Build.0 = Release|Win32
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {7869B1FB-A7C4-4FCF-8B99-F696DB2765EC}
|
SolutionGuid = {99364EF5-C65F-4658-A3FA-19EAC64BE8B9}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
297
contrib/bc/vs/bc.vcxproj
Normal file
297
contrib/bc/vs/bc.vcxproj
Normal file
@ -0,0 +1,297 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>16.0</VCProjectVersion>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectGuid>{4450d61f-2535-4085-b1b1-f96acd23cc9f}</ProjectGuid>
|
||||||
|
<RootNamespace>bc</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<CustomBuildBeforeTargets>ClCompile</CustomBuildBeforeTargets>
|
||||||
|
<GenerateManifest>false</GenerateManifest>
|
||||||
|
<OutDir>bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>bin\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<CustomBuildBeforeTargets>ClCompile</CustomBuildBeforeTargets>
|
||||||
|
<GenerateManifest>false</GenerateManifest>
|
||||||
|
<OutDir>bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>bin\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<CustomBuildBeforeTargets>ClCompile</CustomBuildBeforeTargets>
|
||||||
|
<GenerateManifest>false</GenerateManifest>
|
||||||
|
<OutDir>bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>bin\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<CustomBuildBeforeTargets>ClCompile</CustomBuildBeforeTargets>
|
||||||
|
<GenerateManifest>false</GenerateManifest>
|
||||||
|
<OutDir>bin\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>bin\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=0;BUILD_TYPE=HN;BC_DEFAULT_BANNER=1;BC_DEFAULT_SIGINT_RESET=0;DC_DEFAULT_SIGINT_RESET=0;BC_DEFAULT_TTY_MODE=1;DC_DEFAULT_TTY_MODE=1;BC_DEFAULT_PROMPT=1;DC_DEFAULT_PROMPT=1;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>copy /b /y $(OutDir)bc.exe $(OutDir)dc.exe</Command>
|
||||||
|
</PostBuildEvent>
|
||||||
|
<PreBuildEvent />
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=0;BUILD_TYPE=HN;BC_DEFAULT_BANNER=1;BC_DEFAULT_SIGINT_RESET=0;DC_DEFAULT_SIGINT_RESET=0;BC_DEFAULT_TTY_MODE=1;DC_DEFAULT_TTY_MODE=1;BC_DEFAULT_PROMPT=1;DC_DEFAULT_PROMPT=1;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>copy /b /y $(OutDir)bc.exe $(OutDir)dc.exe</Command>
|
||||||
|
</PostBuildEvent>
|
||||||
|
<PreBuildEvent />
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=0;BUILD_TYPE=HN;BC_DEFAULT_BANNER=1;BC_DEFAULT_SIGINT_RESET=0;DC_DEFAULT_SIGINT_RESET=0;BC_DEFAULT_TTY_MODE=1;DC_DEFAULT_TTY_MODE=1;BC_DEFAULT_PROMPT=1;DC_DEFAULT_PROMPT=1;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories>
|
||||||
|
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>copy /b /y $(OutDir)bc.exe $(OutDir)dc.exe</Command>
|
||||||
|
</PostBuildEvent>
|
||||||
|
<PreBuildEvent />
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=0;BUILD_TYPE=HN;BC_DEFAULT_BANNER=1;BC_DEFAULT_SIGINT_RESET=0;DC_DEFAULT_SIGINT_RESET=0;BC_DEFAULT_TTY_MODE=1;DC_DEFAULT_TTY_MODE=1;BC_DEFAULT_PROMPT=1;DC_DEFAULT_PROMPT=1;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
</Link>
|
||||||
|
<PostBuildEvent>
|
||||||
|
<Command>copy /b /y $(OutDir)bc.exe $(OutDir)dc.exe</Command>
|
||||||
|
</PostBuildEvent>
|
||||||
|
<PreBuildEvent />
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\include\args.h" />
|
||||||
|
<ClInclude Include="..\include\bc.h" />
|
||||||
|
<ClInclude Include="..\include\bcl.h" />
|
||||||
|
<ClInclude Include="..\include\dc.h" />
|
||||||
|
<ClInclude Include="..\include\file.h" />
|
||||||
|
<ClInclude Include="..\include\history.h" />
|
||||||
|
<ClInclude Include="..\include\lang.h" />
|
||||||
|
<ClInclude Include="..\include\lex.h" />
|
||||||
|
<ClInclude Include="..\include\library.h" />
|
||||||
|
<ClInclude Include="..\include\num.h" />
|
||||||
|
<ClInclude Include="..\include\opt.h" />
|
||||||
|
<ClInclude Include="..\include\parse.h" />
|
||||||
|
<ClInclude Include="..\include\program.h" />
|
||||||
|
<ClInclude Include="..\include\rand.h" />
|
||||||
|
<ClInclude Include="..\include\read.h" />
|
||||||
|
<ClInclude Include="..\include\status.h" />
|
||||||
|
<ClInclude Include="..\include\vector.h" />
|
||||||
|
<ClInclude Include="..\include\version.h" />
|
||||||
|
<ClInclude Include="..\include\vm.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<CustomBuild Include="..\gen\strgen.c">
|
||||||
|
<FileType>CppCode</FileType>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cl.exe /Fo:$(OutDir)strgen.obj /Fe:$(OutDir)strgen.exe %(Identity)</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)strgen.exe</Outputs>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cl.exe /Fo:$(OutDir)strgen.obj /Fe:$(OutDir)strgen.exe %(Identity)</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)strgen.exe</Outputs>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">cl.exe /Fo:$(OutDir)strgen.obj /Fe:$(OutDir)strgen.exe %(Identity)</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)strgen.exe</Outputs>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">cl.exe /Fo:$(OutDir)strgen.obj /Fe:$(OutDir)strgen.exe %(Identity)</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)strgen.exe</Outputs>
|
||||||
|
</CustomBuild>
|
||||||
|
<ClCompile Include="src2\bc_help.c" />
|
||||||
|
<ClCompile Include="src2\dc_help.c" />
|
||||||
|
<ClCompile Include="src2\lib.c" />
|
||||||
|
<ClCompile Include="src2\lib2.c" />
|
||||||
|
<ClCompile Include="..\src\args.c" />
|
||||||
|
<ClCompile Include="..\src\bc.c" />
|
||||||
|
<ClCompile Include="..\src\bc_lex.c" />
|
||||||
|
<ClCompile Include="..\src\bc_parse.c" />
|
||||||
|
<ClCompile Include="..\src\data.c" />
|
||||||
|
<ClCompile Include="..\src\dc.c" />
|
||||||
|
<ClCompile Include="..\src\dc_lex.c" />
|
||||||
|
<ClCompile Include="..\src\dc_parse.c" />
|
||||||
|
<ClCompile Include="..\src\file.c" />
|
||||||
|
<ClCompile Include="..\src\lang.c" />
|
||||||
|
<ClCompile Include="..\src\lex.c" />
|
||||||
|
<ClCompile Include="..\src\library.c" />
|
||||||
|
<ClCompile Include="..\src\main.c" />
|
||||||
|
<ClCompile Include="..\src\num.c" />
|
||||||
|
<ClCompile Include="..\src\opt.c" />
|
||||||
|
<ClCompile Include="..\src\parse.c" />
|
||||||
|
<ClCompile Include="..\src\program.c" />
|
||||||
|
<ClCompile Include="..\src\rand.c" />
|
||||||
|
<ClCompile Include="..\src\read.c" />
|
||||||
|
<ClCompile Include="..\src\vector.c" />
|
||||||
|
<ClCompile Include="..\src\vm.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<CustomBuild Include="..\gen\lib.bc">
|
||||||
|
<FileType>Document</FileType>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)strgen.exe %(Identity) src2\lib.c bc_lib bc_lib_name BC_ENABLED 1</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">src2\lib.c</Outputs>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)strgen.exe %(Identity) src2\lib.c bc_lib bc_lib_name BC_ENABLED 1</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">src2\lib.c</Outputs>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)strgen.exe %(Identity) src2\lib.c bc_lib bc_lib_name BC_ENABLED 1</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">src2\lib.c</Outputs>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)strgen.exe %(Identity) src2\lib.c bc_lib bc_lib_name BC_ENABLED 1</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">src2\lib.c</Outputs>
|
||||||
|
</CustomBuild>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<CustomBuild Include="..\gen\lib2.bc">
|
||||||
|
<FileType>Document</FileType>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)strgen.exe %(Identity) src2\lib2.c bc_lib2 bc_lib2_name BC_ENABLED 1</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">src2\lib2.c</Outputs>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)strgen.exe %(Identity) src2\lib2.c bc_lib2 bc_lib2_name BC_ENABLED 1</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">src2\lib2.c</Outputs>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)strgen.exe %(Identity) src2\lib2.c bc_lib2 bc_lib2_name BC_ENABLED 1</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">src2\lib2.c</Outputs>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)strgen.exe %(Identity) src2\lib2.c bc_lib2 bc_lib2_name BC_ENABLED 1</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">src2\lib2.c</Outputs>
|
||||||
|
</CustomBuild>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<CustomBuild Include="..\gen\dc_help.txt">
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)strgen.exe %(Identity) src2\dc_help.c dc_help "" DC_ENABLED</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">src2\dc_help.c</Outputs>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)strgen.exe %(Identity) src2\dc_help.c dc_help "" DC_ENABLED</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">src2\dc_help.c</Outputs>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)strgen.exe %(Identity) src2\dc_help.c dc_help "" DC_ENABLED</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">src2\dc_help.c</Outputs>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)strgen.exe %(Identity) src2\dc_help.c dc_help "" DC_ENABLED</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">src2\dc_help.c</Outputs>
|
||||||
|
</CustomBuild>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<CustomBuild Include="..\gen\bc_help.txt">
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)strgen.exe %(Identity) src2\bc_help.c bc_help "" BC_ENABLED</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">src2\bc_help.c</Outputs>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)strgen.exe %(Identity) src2\bc_help.c bc_help "" BC_ENABLED</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">src2\bc_help.c</Outputs>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)strgen.exe %(Identity) src2\bc_help.c bc_help "" BC_ENABLED</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">src2\bc_help.c</Outputs>
|
||||||
|
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)strgen.exe %(Identity) src2\bc_help.c bc_help "" BC_ENABLED</Command>
|
||||||
|
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">src2\bc_help.c</Outputs>
|
||||||
|
</CustomBuild>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
173
contrib/bc/vs/bc.vcxproj.filters
Normal file
173
contrib/bc/vs/bc.vcxproj.filters
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="src">
|
||||||
|
<UniqueIdentifier>{ef855c5b-fc2c-4736-bb38-346aae9184f7}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="include">
|
||||||
|
<UniqueIdentifier>{df4ea0e1-2549-4c13-bf11-79ba8ba4cad9}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="gen">
|
||||||
|
<UniqueIdentifier>{1bbcb2e0-c1a0-417e-88bf-8eda8a53714e}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="src2">
|
||||||
|
<UniqueIdentifier>{c384b486-4ea2-473a-8b04-86f2f5f7bb69}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\include\args.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\bc.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\bcl.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\dc.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\file.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\history.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\lang.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\lex.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\library.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\num.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\opt.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\parse.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\program.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\rand.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\read.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\status.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\vector.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\version.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\vm.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\src\args.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\bc.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\bc_lex.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\bc_parse.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\data.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\dc.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\dc_lex.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\dc_parse.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\file.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\history.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\lang.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\lex.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\library.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\main.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\num.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\opt.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\parse.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\program.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\rand.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\read.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\vector.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\vm.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="src2\bc_help.c">
|
||||||
|
<Filter>src2</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="src2\dc_help.c">
|
||||||
|
<Filter>src2</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="src2\lib.c">
|
||||||
|
<Filter>src2</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="src2\lib2.c">
|
||||||
|
<Filter>src2</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<CustomBuild Include="..\gen\lib.bc">
|
||||||
|
<Filter>gen</Filter>
|
||||||
|
</CustomBuild>
|
||||||
|
<CustomBuild Include="..\gen\lib2.bc">
|
||||||
|
<Filter>gen</Filter>
|
||||||
|
</CustomBuild>
|
||||||
|
<CustomBuild Include="..\gen\dc_help.txt">
|
||||||
|
<Filter>gen</Filter>
|
||||||
|
</CustomBuild>
|
||||||
|
<CustomBuild Include="..\gen\bc_help.txt">
|
||||||
|
<Filter>gen</Filter>
|
||||||
|
</CustomBuild>
|
||||||
|
<CustomBuild Include="..\gen\strgen.c">
|
||||||
|
<Filter>gen</Filter>
|
||||||
|
</CustomBuild>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
37
contrib/bc/vs/bcl.sln
Normal file
37
contrib/bc/vs/bcl.sln
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.31515.178
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bcl", "bcl.vcxproj", "{76B451C9-72BF-45B2-B78D-B3515410F99F}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
ReleaseMD|x64 = ReleaseMD|x64
|
||||||
|
ReleaseMD|x86 = ReleaseMD|x86
|
||||||
|
ReleaseMT|x64 = ReleaseMT|x64
|
||||||
|
ReleaseMT|x86 = ReleaseMT|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{76B451C9-72BF-45B2-B78D-B3515410F99F}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{76B451C9-72BF-45B2-B78D-B3515410F99F}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{76B451C9-72BF-45B2-B78D-B3515410F99F}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{76B451C9-72BF-45B2-B78D-B3515410F99F}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{76B451C9-72BF-45B2-B78D-B3515410F99F}.ReleaseMD|x64.ActiveCfg = ReleaseMD|x64
|
||||||
|
{76B451C9-72BF-45B2-B78D-B3515410F99F}.ReleaseMD|x64.Build.0 = ReleaseMD|x64
|
||||||
|
{76B451C9-72BF-45B2-B78D-B3515410F99F}.ReleaseMD|x86.ActiveCfg = ReleaseMD|Win32
|
||||||
|
{76B451C9-72BF-45B2-B78D-B3515410F99F}.ReleaseMD|x86.Build.0 = ReleaseMD|Win32
|
||||||
|
{76B451C9-72BF-45B2-B78D-B3515410F99F}.ReleaseMT|x64.ActiveCfg = ReleaseMT|x64
|
||||||
|
{76B451C9-72BF-45B2-B78D-B3515410F99F}.ReleaseMT|x64.Build.0 = ReleaseMT|x64
|
||||||
|
{76B451C9-72BF-45B2-B78D-B3515410F99F}.ReleaseMT|x86.ActiveCfg = ReleaseMT|Win32
|
||||||
|
{76B451C9-72BF-45B2-B78D-B3515410F99F}.ReleaseMT|x86.Build.0 = ReleaseMT|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {C943D6A7-81EA-47C8-90D6-7DB528C262E7}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
259
contrib/bc/vs/bcl.vcxproj
Normal file
259
contrib/bc/vs/bcl.vcxproj
Normal file
@ -0,0 +1,259 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="ReleaseMD|Win32">
|
||||||
|
<Configuration>ReleaseMD</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="ReleaseMD|x64">
|
||||||
|
<Configuration>ReleaseMD</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="ReleaseMT|Win32">
|
||||||
|
<Configuration>ReleaseMT</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="ReleaseMT|x64">
|
||||||
|
<Configuration>ReleaseMT</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>16.0</VCProjectVersion>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectGuid>{76b451c9-72bf-45b2-b78d-b3515410f99f}</ProjectGuid>
|
||||||
|
<RootNamespace>bcl</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMD|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMT|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMD|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMT|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='ReleaseMD|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMT|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='ReleaseMD|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMT|x64'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>lib\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>lib\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMD|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>lib\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>lib\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMT|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>lib\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>lib\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>lib\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>lib\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMD|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>lib\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>lib\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMT|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>lib\$(Platform)\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>lib\$(Platform)\$(Configuration)\</IntDir>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=1;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMD|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=1;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMT|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=1;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=1;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMD|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=1;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseMT|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=1;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<AdditionalIncludeDirectories>..\include</AdditionalIncludeDirectories>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\src\data.c" />
|
||||||
|
<ClCompile Include="..\src\library.c" />
|
||||||
|
<ClCompile Include="..\src\num.c" />
|
||||||
|
<ClCompile Include="..\src\rand.c" />
|
||||||
|
<ClCompile Include="..\src\vector.c" />
|
||||||
|
<ClCompile Include="..\src\vm.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\include\args.h" />
|
||||||
|
<ClInclude Include="..\include\bc.h" />
|
||||||
|
<ClInclude Include="..\include\bcl.h" />
|
||||||
|
<ClInclude Include="..\include\dc.h" />
|
||||||
|
<ClInclude Include="..\include\file.h" />
|
||||||
|
<ClInclude Include="..\include\history.h" />
|
||||||
|
<ClInclude Include="..\include\lang.h" />
|
||||||
|
<ClInclude Include="..\include\lex.h" />
|
||||||
|
<ClInclude Include="..\include\library.h" />
|
||||||
|
<ClInclude Include="..\include\num.h" />
|
||||||
|
<ClInclude Include="..\include\opt.h" />
|
||||||
|
<ClInclude Include="..\include\parse.h" />
|
||||||
|
<ClInclude Include="..\include\program.h" />
|
||||||
|
<ClInclude Include="..\include\rand.h" />
|
||||||
|
<ClInclude Include="..\include\read.h" />
|
||||||
|
<ClInclude Include="..\include\status.h" />
|
||||||
|
<ClInclude Include="..\include\vector.h" />
|
||||||
|
<ClInclude Include="..\include\version.h" />
|
||||||
|
<ClInclude Include="..\include\vm.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
90
contrib/bc/vs/bcl.vcxproj.filters
Normal file
90
contrib/bc/vs/bcl.vcxproj.filters
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="src">
|
||||||
|
<UniqueIdentifier>{4eccf85f-77c4-4ebd-b89c-3920075c5b2d}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="include">
|
||||||
|
<UniqueIdentifier>{48fc3219-18c1-42d7-b9f4-da5f65ab1ccc}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\src\data.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\library.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\num.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\rand.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\vector.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\vm.c">
|
||||||
|
<Filter>src</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="..\include\args.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\bc.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\bcl.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\dc.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\file.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\history.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\lang.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\lex.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\library.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\num.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\opt.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\parse.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\program.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\rand.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\read.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\status.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\vector.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\version.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\include\vm.h">
|
||||||
|
<Filter>include</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
0
contrib/bc/vs/bin/some.txt
Normal file
0
contrib/bc/vs/bin/some.txt
Normal file
0
contrib/bc/vs/tests/some.txt
Normal file
0
contrib/bc/vs/tests/some.txt
Normal file
104
contrib/bc/vs/tests/tests_bc.bat
Normal file
104
contrib/bc/vs/tests/tests_bc.bat
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
set scripts=..\..\tests\bc
|
||||||
|
set bc=%~dp0\bc.exe
|
||||||
|
set args=-ql
|
||||||
|
|
||||||
|
del /f /q *.txt > NUL
|
||||||
|
|
||||||
|
|
||||||
|
rem excluded: all, errors, read_errors, posix_errors, misc6, misc7, recursive_arrays
|
||||||
|
|
||||||
|
for %%i in (
|
||||||
|
abs
|
||||||
|
add
|
||||||
|
arctangent
|
||||||
|
arrays
|
||||||
|
assignments
|
||||||
|
bitfuncs
|
||||||
|
boolean
|
||||||
|
comp
|
||||||
|
cosine
|
||||||
|
decimal
|
||||||
|
divide
|
||||||
|
divmod
|
||||||
|
engineering
|
||||||
|
exponent
|
||||||
|
functions
|
||||||
|
globals
|
||||||
|
length
|
||||||
|
letters
|
||||||
|
lib2
|
||||||
|
log
|
||||||
|
misc
|
||||||
|
misc1
|
||||||
|
misc2
|
||||||
|
misc3
|
||||||
|
misc4
|
||||||
|
misc5
|
||||||
|
modexp
|
||||||
|
modulus
|
||||||
|
multiply
|
||||||
|
pi
|
||||||
|
places
|
||||||
|
power
|
||||||
|
print2
|
||||||
|
rand
|
||||||
|
read
|
||||||
|
scale
|
||||||
|
scientific
|
||||||
|
shift
|
||||||
|
sine
|
||||||
|
sqrt
|
||||||
|
stdin
|
||||||
|
stdin1
|
||||||
|
stdin2
|
||||||
|
strings
|
||||||
|
subtract
|
||||||
|
trunc
|
||||||
|
vars
|
||||||
|
void
|
||||||
|
leadingzero
|
||||||
|
) do (
|
||||||
|
if exist "%scripts%\%%i.txt" (
|
||||||
|
"%bc%" "%args%" < "%scripts%\%%i.txt" > "%%i_results.txt"
|
||||||
|
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo FAIL_RUNTIME: %%i
|
||||||
|
goto :eof
|
||||||
|
)
|
||||||
|
|
||||||
|
fc.exe "%scripts%\%%i_results.txt" "%%i_results.txt" > NUL
|
||||||
|
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo FAIL_RESULTS: %%i
|
||||||
|
goto :eof
|
||||||
|
)
|
||||||
|
|
||||||
|
echo PASS: %%i
|
||||||
|
) else (
|
||||||
|
echo FAIL_NOT_EXIST: %%i
|
||||||
|
goto :eof
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
if exist "%scripts%\leadingzero.txt" (
|
||||||
|
"%bc%" "%args%" -z < "%scripts%\leadingzero.txt" > "leadingzero_z_results.txt"
|
||||||
|
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo FAIL_RUNTIME: leadingzero_z
|
||||||
|
goto :eof
|
||||||
|
)
|
||||||
|
|
||||||
|
fc.exe "%scripts%\leadingzero_results.txt" "leadingzero_z_results.txt" > NUL
|
||||||
|
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo FAIL_RESULTS: leadingzero_z
|
||||||
|
goto :eof
|
||||||
|
)
|
||||||
|
|
||||||
|
echo PASS: leadingzero_z
|
||||||
|
) else (
|
||||||
|
echo FAIL_NOT_EXIST: leadingzero_z
|
||||||
|
goto :eof
|
||||||
|
)
|
61
contrib/bc/vs/tests/tests_dc.bat
Normal file
61
contrib/bc/vs/tests/tests_dc.bat
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
set scripts=..\..\tests\dc
|
||||||
|
set dc=%~dp0\dc.exe
|
||||||
|
set args=-x
|
||||||
|
|
||||||
|
del /f /q *.txt > NUL
|
||||||
|
|
||||||
|
|
||||||
|
rem excluded: all, errors, read_errors
|
||||||
|
|
||||||
|
for %%i in (
|
||||||
|
abs
|
||||||
|
add
|
||||||
|
boolean
|
||||||
|
decimal
|
||||||
|
divide
|
||||||
|
divmod
|
||||||
|
engineering
|
||||||
|
exec_stack_len
|
||||||
|
length
|
||||||
|
misc
|
||||||
|
modexp
|
||||||
|
modulus
|
||||||
|
multiply
|
||||||
|
negate
|
||||||
|
places
|
||||||
|
power
|
||||||
|
rand
|
||||||
|
read
|
||||||
|
scientific
|
||||||
|
shift
|
||||||
|
sqrt
|
||||||
|
stack_len
|
||||||
|
stdin
|
||||||
|
strings
|
||||||
|
subtract
|
||||||
|
trunc
|
||||||
|
vars
|
||||||
|
) do (
|
||||||
|
if exist "%scripts%\%%i.txt" (
|
||||||
|
"%dc%" "%args%" < "%scripts%\%%i.txt" > "%%i_results.txt"
|
||||||
|
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo FAIL_RUNTIME: %%i
|
||||||
|
goto :eof
|
||||||
|
)
|
||||||
|
|
||||||
|
fc.exe "%scripts%\%%i_results.txt" "%%i_results.txt" > NUL
|
||||||
|
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo FAIL_RESULTS: %%i
|
||||||
|
goto :eof
|
||||||
|
)
|
||||||
|
|
||||||
|
echo PASS: %%i
|
||||||
|
) else (
|
||||||
|
echo FAIL_NOT_EXIST: %%i
|
||||||
|
goto :eof
|
||||||
|
)
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user