Vendor import of Gavin D. Howard's bc version 4.0.0

This commit is contained in:
Stefan Eßer 2021-04-06 10:44:52 +02:00
parent 893ecb52db
commit 7a590c074c
107 changed files with 29093 additions and 20247 deletions

View File

@ -29,8 +29,6 @@
#
.POSIX:
VERSION = 3.3.4
SRC = %%SRC%%
OBJ = %%OBJ%%
GCDA = %%GCDA%%
@ -128,6 +126,8 @@ MAIN_EXEC = $(EXEC_PREFIX)$(%%MAIN_EXEC%%)$(EXEC_SUFFIX)
EXEC = $(%%EXEC%%)
NLSPATH = %%NLSPATH%%
BC_BUILD_TYPE = %%BUILD_TYPE%%
BC_ENABLE_LIBRARY = %%LIBRARY%%
BC_ENABLE_HISTORY = %%HISTORY%%
@ -158,7 +158,7 @@ TEST_STARS = "******************************************************************
BC_NUM_KARATSUBA_LEN = %%KARATSUBA_LEN%%
CPPFLAGS1 = -D$(BC_ENABLED_NAME)=$(BC_ENABLED) -D$(DC_ENABLED_NAME)=$(DC_ENABLED)
CPPFLAGS2 = $(CPPFLAGS1) -I./include/ -DVERSION=$(VERSION) %%LONG_BIT_DEFINE%%
CPPFLAGS2 = $(CPPFLAGS1) -I./include/ -DBUILD_TYPE=$(BC_BUILD_TYPE) %%LONG_BIT_DEFINE%%
CPPFLAGS3 = $(CPPFLAGS2) -DEXECPREFIX=$(EXEC_PREFIX) -DMAINEXEC=$(MAIN_EXEC)
CPPFLAGS4 = $(CPPFLAGS3) -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700
CPPFLAGS5 = $(CPPFLAGS4) -DBC_NUM_KARATSUBA_LEN=$(BC_NUM_KARATSUBA_LEN)
@ -322,9 +322,6 @@ coverage_output:
coverage:%%COVERAGE_PREREQS%%
version:
@printf '%s' "$(VERSION)"
libcname:
@printf '%s' "$(BC_LIB_C)"
@ -341,6 +338,7 @@ clean_gen:
clean:%%CLEAN_PREREQS%%
@printf 'Cleaning files...\n'
@$(RM) -f src/*.tmp gen/*.tmp
@$(RM) -f $(OBJ)
@$(RM) -f $(BC_EXEC)
@$(RM) -f $(DC_EXEC)
@ -352,6 +350,7 @@ clean:%%CLEAN_PREREQS%%
@$(RM) -f $(DC_HELP_C) $(DC_HELP_O)
@$(RM) -fr $(BC_TEST_OUTPUTS) $(DC_TEST_OUTPUTS)
@$(RM) -fr $(BC_FUZZ_OUTPUTS) $(DC_FUZZ_OUTPUTS)
@$(RM) -fr Debug/ Release/
clean_config: clean
@printf 'Cleaning config...\n'

25
NEWS.md
View File

@ -1,5 +1,30 @@
# News
## 4.0.0
This is a production release with many fixes, a new command-line option, and a
big surprise:
* A bug was fixed in `dc`'s `P` command where the item on the stack was *not*
popped.
* Various bugs in the manuals have been fixed.
* A known bug was fixed where history did not interact well with prompts printed
by user code without newlines.
* A new command-line option, `-R` and `--no-read-prompt` was added to disable
just the prompt when using `read()` (`bc`) or `?` (`dc`).
* And finally, **official support for Windows was added**.
The last item is why this is a major version bump.
Currently, only one set of build options (extra math and prompt enabled, history
and NLS/locale support disabled, both calculators enabled) is supported on
Windows. However, both debug and release builds are supported.
In addition, Windows builds are supported for the the library (`bcl`).
For more details about how to build on Windows, see the [README][5] or the
[build manual][13].
## 3.3.4
This is a production release that fixes a small bug.

107
README.md
View File

@ -24,13 +24,16 @@ This `bc` is Free and Open Source Software (FOSS). It is offered under the BSD
## Prerequisites
This `bc` only requires a C99-compatible compiler and a (mostly) POSIX
2008-compatible system with the XSI (X/Open System Interfaces) option group.
This `bc` only requires either:
1. Windows 10 or later, or
2. A C99-compatible compiler and a (mostly) POSIX 2008-compatible system with
the XSI (X/Open System Interfaces) option group.
Since POSIX 2008 with XSI requires the existence of a C99 compiler as `c99`, any
POSIX and XSI-compatible system will have everything needed.
Systems that are known to work:
POSIX-compatible systems that are known to work:
* Linux
* FreeBSD
@ -41,17 +44,68 @@ Systems that are known to work:
* AIX
* HP-UX* (except for history)
In addition, there is compatibility code to make this `bc` work on Windows.
Please submit bug reports if this `bc` does not build out of the box on any
system besides Windows.
system.
## Build
This `bc` should build unmodified on any POSIX-compliant system.
### Windows
There is no guarantee that this `bc` will work on any version of Windows earlier
than Windows 10 (I cannot test on earlier versions), but it is guaranteed to
work on Windows 10 at least.
Also, if building with MSBuild, the MSBuild bundled with Visual Studio is
required.
**Note**: Unlike the POSIX-compatible platforms, only one build configuration is
supported on Windows: extra math and prompt enabled, history and NLS (locale
support) disabled, with both calculators built.
#### `bc`
To build `bc`, you can open the `bc.sln` file in Visual Studio, select the
configuration, and build.
You can also build using MSBuild with the following from the root directory:
```
msbuild -property:Configuration=<config> bc.sln
```
where `<config>` is either one of `Debug` or `Release`.
#### `bcl` (Library)
To build the library, you can open the `bcl.sln` file in Visual Studio, select
the configuration, and build.
You can also build using MSBuild with the following from the root directory:
```
msbuild -property:Configuration=<config> bcl.sln
```
where `<config>` is either one of `Debug` or `Release`.
### POSIX-Compatible Systems
This `bc` should build unmodified on any POSIX-compliant system or on Windows
starting with Windows 10 (though earlier versions may work).
For more complex build requirements than the ones below, see the
[build manual][5].
### Default
On POSIX-compatible systems, `bc` is built as `bin/bc` and `dc` is built as
`bin/dc` by default. On Windows, they are built as `Release/bc/bc.exe` and
`Release/bc/dc.exe`.
**Note**: On Windows, `dc.exe` is just copied from `bc.exe`; it is not linked.
Patches are welcome for a way to do that.
#### Default
For the default build with optimization, use the following commands in the root
directory:
@ -61,7 +115,7 @@ directory:
make
```
### One Calculator
#### One Calculator
To only build `bc`, use the following commands:
@ -77,7 +131,7 @@ To only build `dc`, use the following commands:
make
```
### Debug
#### Debug
For debug builds, use the following commands in the root directory:
@ -86,7 +140,7 @@ For debug builds, use the following commands in the root directory:
make
```
### Install
#### Install
To install, use the following command:
@ -99,7 +153,7 @@ other locations, use the `PREFIX` environment variable when running
`configure.sh` or pass the `--prefix=<prefix>` option to `configure.sh`. See the
[build manual][5], or run `./configure.sh --help`, for more details.
### Library
#### Library
This `bc` does provide a way to build a math library with C bindings. This is
done by the `-a` or `--library` options to `configure.sh`:
@ -114,11 +168,12 @@ see the [build manual][5].
The library API can be found in [`manuals/bcl.3.md`][26] or `man bcl` once the
library is installed.
The library is built as `bin/libbcl.a`.
The library is built as `bin/libbcl.a` on POSIX-compatible systems or as
`Release/bcl/bcl.lib` on Windows.
### Package and Distro Maintainers
#### Package and Distro Maintainers
#### Recommended Compiler
##### Recommended Compiler
When I ran benchmarks with my `bc` compiled under `clang`, it performed much
better than when compiled under `gcc`. I recommend compiling this `bc` with
@ -127,7 +182,7 @@ better than when compiled under `gcc`. I recommend compiling this `bc` with
I also recommend building this `bc` with C11 if you can because `bc` will detect
a C11 compiler and add `_Noreturn` to any relevant function(s).
#### Recommended Optimizations
##### Recommended Optimizations
I wrote this `bc` with Separation of Concerns, which means that there are many
small functions that could be inlined. However, they are often called across
@ -154,12 +209,12 @@ However, I recommend ***NOT*** using `-march=native`. Doing so will reduce this
`bc`'s performance, at least when building with link-time optimization. See the
[benchmarks][19] for more details.
#### Stripping Binaries
##### Stripping Binaries
By default, non-debug binaries are stripped, but stripping can be disabled with
the `-T` option to `configure.sh`.
#### Using This `bc` as an Alternative
##### Using This `bc` as an Alternative
If this `bc` is packaged as an alternative to an already existing `bc` package,
it is possible to rename it in the build to prevent name collision. To prepend
@ -181,7 +236,7 @@ allowed.
**Note**: The suggested name (and package name) when `bc` is not available is
`bc-gh`.
#### Karatsuba Number
##### Karatsuba Number
Package and distro maintainers have one tool at their disposal to build this
`bc` in the optimal configuration: `karatsuba.py`.
@ -217,6 +272,7 @@ translations will also be added as they are provided.
This `bc` compares favorably to GNU `bc`.
* This `bc` builds natively on Windows.
* It has more extensions, which make this `bc` more useful for scripting.
* This `bc` is a bit more POSIX compliant.
* It has a much less buggy parser. The GNU `bc` will give parse errors for what
@ -246,7 +302,9 @@ To see what algorithms this `bc` uses, see the [algorithms manual][7].
## Locales
Currently, this `bc` only has support for English (and US English), French,
Currently, there is no locale support on Windows.
Additionally, this `bc` only has support for English (and US English), French,
German, Portuguese, Dutch, Polish, Russian, Japanese, and Chinese locales.
Patches are welcome for translations; use the existing `*.msg` files in
`locales/` as a starting point.
@ -276,7 +334,8 @@ Other projects based on this bc are:
## Language
This `bc` is written in pure ISO C99, using POSIX 2008 APIs.
This `bc` is written in pure ISO C99, using POSIX 2008 APIs with custom Windows
compatibility code.
## Commit Messages
@ -294,6 +353,13 @@ tarballs.
Files:
.gitignore The git ignore file (maintainer use only).
.gitattributes The git attributes file (maintainer use only).
bc.sln The Visual Studio solution file for bc.
bc.vcxproj The Visual Studio project file for bc.
bc.vcxproj.filters The Visual Studio filters file for bc.
bcl.sln The Visual Studio solution file for bcl.
bcl.vcxproj The Visual Studio project file for bcl.
bcl.vcxproj.filters The Visual Studio filters file for bcl.
configure A symlink to configure.sh to make packaging easier.
configure.sh The configure script.
functions.sh A script with functions used by other scripts.
@ -304,7 +370,8 @@ Files:
locale_install.sh A script to install locales, if desired.
locale_uninstall.sh A script to uninstall locales.
Makefile.in The Makefile template.
manpage.sh Script to generate man pages from markdown files.
manpage.sh Script to generate man pages from markdown files
(maintainer use only).
NOTICE.md List of contributors and copyright owners.
RELEASE.md A checklist for making a release (maintainer use only).
release.sh A script to test for release (maintainer use only).

31
bc.sln Normal file
View File

@ -0,0 +1,31 @@

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}") = "bc", "bc.vcxproj", "{D5086CFE-052C-4742-B005-E05DB983BBA2}"
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
{D5086CFE-052C-4742-B005-E05DB983BBA2}.Debug|x64.ActiveCfg = Debug|x64
{D5086CFE-052C-4742-B005-E05DB983BBA2}.Debug|x64.Build.0 = Debug|x64
{D5086CFE-052C-4742-B005-E05DB983BBA2}.Debug|x86.ActiveCfg = Debug|Win32
{D5086CFE-052C-4742-B005-E05DB983BBA2}.Debug|x86.Build.0 = Debug|Win32
{D5086CFE-052C-4742-B005-E05DB983BBA2}.Release|x64.ActiveCfg = Release|x64
{D5086CFE-052C-4742-B005-E05DB983BBA2}.Release|x64.Build.0 = Release|x64
{D5086CFE-052C-4742-B005-E05DB983BBA2}.Release|x86.ActiveCfg = Release|Win32
{D5086CFE-052C-4742-B005-E05DB983BBA2}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7869B1FB-A7C4-4FCF-8B99-F696DB2765EC}
EndGlobalSection
EndGlobal

278
bc.vcxproj Normal file
View File

@ -0,0 +1,278 @@
<?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>
<ProjectGuid>{D5086CFE-052C-4742-B005-E05DB983BBA2}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
</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>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
</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>
<ItemGroup>
<CustomBuild Include="gen\strgen.c">
<Message>Building strgen</Message>
<Command>CL /Fo:$(Configuration)\$(ProjectName)\ /Fe:$(Configuration)\$(ProjectName)\strgen.exe gen\strgen.c</Command>
<Inputs>gen\strgen.c</Inputs>
<Outputs>$(Configuration)\$(ProjectName)\strgen.exe</Outputs>
</CustomBuild>
<CustomBuild Include="gen\lib.bc">
<Message>Generating $(Configuration)\$(ProjectName)/lib.c</Message>
<Command>START $(Configuration)\$(ProjectName)/strgen gen\lib.bc $(Configuration)\$(ProjectName)/lib.c bc_lib bc_lib_name BC_ENABLED 1</Command>
<Inputs>$(Configuration)\$(ProjectName)\strgen.exe;gen\lib.bc</Inputs>
<Outputs>$(Configuration)\$(ProjectName)\lib.c</Outputs>
</CustomBuild>
<CustomBuild Include="gen\lib2.bc">
<Message>Generating $(Configuration)\$(ProjectName)/lib2.c</Message>
<Command>START $(Configuration)\$(ProjectName)/strgen gen\lib2.bc $(Configuration)\$(ProjectName)/lib2.c bc_lib2 bc_lib2_name BC_ENABLED 1</Command>
<Inputs>$(Configuration)\$(ProjectName)\strgen.exe;gen\lib2.bc</Inputs>
<Outputs>$(Configuration)\$(ProjectName)\lib2.c</Outputs>
</CustomBuild>
<CustomBuild Include="gen\bc_help.txt">
<Message>Generating $(Configuration)\$(ProjectName)/bc_help.c</Message>
<Command>START $(Configuration)\$(ProjectName)/strgen gen\bc_help.txt $(Configuration)\$(ProjectName)\bc_help.c bc_help "" BC_ENABLED</Command>
<Inputs>$(Configuration)\$(ProjectName)\strgen.exe;gen\bc_help.txt</Inputs>
<Outputs>$(Configuration)\$(ProjectName)\bc_help.c</Outputs>
</CustomBuild>
<CustomBuild Include="gen\dc_help.txt">
<Message>Generating $(Configuration)\$(ProjectName)/dc_help.c</Message>
<Command>START $(Configuration)\$(ProjectName)/strgen gen\dc_help.txt $(Configuration)\$(ProjectName)\dc_help.c dc_help "" DC_ENABLED</Command>
<Inputs>$(Configuration)\$(ProjectName)\strgen.exe;gen\dc_help.txt</Inputs>
<Outputs>$(Configuration)\$(ProjectName)\dc_help.c</Outputs>
</CustomBuild>
</ItemGroup>
<PropertyGroup>
<CustomBuildBeforeTargets>ClCompile</CustomBuildBeforeTargets>
</PropertyGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)\$(Configuration)\$(ProjectName)\</OutDir>
<IntDir>$(SolutionDir)\$(Configuration)\$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)\$(Configuration)\$(ProjectName)\</OutDir>
<IntDir>$(SolutionDir)\$(Configuration)\$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)\$(Configuration)\$(ProjectName)\</OutDir>
<IntDir>$(SolutionDir)\$(Configuration)\$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<OutDir>$(SolutionDir)\$(Configuration)\$(ProjectName)\</OutDir>
<IntDir>$(SolutionDir)\$(Configuration)\$(ProjectName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_ENABLE_PROMPT=1;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=0;EXECSUFFIX=.exe;BUILD_TYPE=HN</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<ExceptionHandling>false</ExceptionHandling>
<AdditionalOptions>/W3 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;bcrypt.lib;ucrt.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy /b "$(SolutionDir)\$(Configuration)\$(ProjectName)\bc.exe" "$(SolutionDir)\$(Configuration)\$(ProjectName)\dc.exe"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copying bc to dc...</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_ENABLE_PROMPT=1;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=0;EXECSUFFIX=.exe;BUILD_TYPE=HN</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>MaxSpeed</Optimization>
<ExceptionHandling>false</ExceptionHandling>
<AdditionalOptions>/W3 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;bcrypt.lib;ucrt.lib;%(AdditionalDependencies)</AdditionalDependencies>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PostBuildEvent>
<Command>copy /b "$(SolutionDir)\$(Configuration)\$(ProjectName)\bc.exe" "$(SolutionDir)\$(Configuration)\$(ProjectName)\dc.exe"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copying bc to dc...</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_ENABLE_PROMPT=1;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=0;EXECSUFFIX=.exe;BUILD_TYPE=HN</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<ExceptionHandling>false</ExceptionHandling>
<AdditionalOptions>/W3 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<TargetMachine>MachineX64</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;bcrypt.lib;ucrt.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy /b "$(SolutionDir)\$(Configuration)\$(ProjectName)\bc.exe" "$(SolutionDir)\$(Configuration)\$(ProjectName)\dc.exe"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copying bc to dc...</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_ENABLE_PROMPT=1;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=0;EXECSUFFIX=.exe;BUILD_TYPE=HN</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>MaxSpeed</Optimization>
<ExceptionHandling>false</ExceptionHandling>
<AdditionalOptions>/W3 %(AdditionalOptions)</AdditionalOptions>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
</ClCompile>
<Link>
<TargetMachine>MachineX64</TargetMachine>
<GenerateDebugInformation>false</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;bcrypt.lib;ucrt.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy /b "$(SolutionDir)\$(Configuration)\$(ProjectName)\bc.exe" "$(SolutionDir)\$(Configuration)\$(ProjectName)\dc.exe"</Command>
</PostBuildEvent>
<PostBuildEvent>
<Message>Copying bc to dc...</Message>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="$(Configuration)\$(ProjectName)\lib.c" />
<ClCompile Include="$(Configuration)\$(ProjectName)\lib2.c" />
<ClCompile Include="$(Configuration)\$(ProjectName)\bc_help.c" />
<ClCompile Include="$(Configuration)\$(ProjectName)\dc_help.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\history.c" />
<ClCompile Include="src\lang.c" />
<ClCompile Include="src\lex.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>
<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>
<Text Include="gen\bc_help.txt" />
<Text Include="gen\dc_help.txt" />
</ItemGroup>
<ItemGroup>
<None Include="gen\lib.bc" />
<None Include="gen\lib2.bc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

182
bc.vcxproj.filters Normal file
View File

@ -0,0 +1,182 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\args.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\bc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\bc_lex.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\bc_parse.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\data.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\dc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\dc_lex.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\dc_parse.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\file.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\history.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\lang.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\lex.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\main.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\num.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\opt.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\parse.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\program.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\rand.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\read.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\vector.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\vm.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gen\lib.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gen\lib2.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gen\bc_help.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gen\dc_help.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\args.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\bc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\bcl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\dc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\file.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\history.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\lang.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\lex.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\library.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\num.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\opt.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\parse.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\program.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\rand.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\read.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\status.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\vector.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\version.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\vm.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="gen\strgen.c">
<Filter>Source Files</Filter>
</CustomBuild>
<CustomBuild Include="gen\lib.bc" />
<CustomBuild Include="gen\lib2.bc" />
<CustomBuild Include="gen\bc_help.txt" />
<CustomBuild Include="gen\dc_help.txt" />
<CustomBuild Include="gen\lib.bc" />
<CustomBuild Include="gen\lib2.bc" />
<CustomBuild Include="gen\bc_help.txt" />
<CustomBuild Include="gen\dc_help.txt" />
</ItemGroup>
<ItemGroup>
<Text Include="gen\bc_help.txt">
<Filter>Resource Files</Filter>
</Text>
<Text Include="gen\dc_help.txt">
<Filter>Resource Files</Filter>
</Text>
</ItemGroup>
<ItemGroup>
<None Include="gen\lib.bc">
<Filter>Resource Files</Filter>
</None>
<None Include="gen\lib2.bc">
<Filter>Resource Files</Filter>
</None>
</ItemGroup>
</Project>

31
bcl.sln Normal file
View File

@ -0,0 +1,31 @@

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

161
bcl.vcxproj Normal file
View File

@ -0,0 +1,161 @@
<?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>
<ProjectGuid>{D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<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>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
</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>
<OutDir>$(SolutionDir)\$(Configuration)\$(ProjectName)\</OutDir>
<IntDir>$(SolutionDir)\$(Configuration)\$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)\$(Configuration)\$(ProjectName)\</OutDir>
<IntDir>$(SolutionDir)\$(Configuration)\$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)\$(Configuration)\$(ProjectName)\</OutDir>
<IntDir>$(SolutionDir)\$(Configuration)\$(ProjectName)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>true</LinkIncremental>
<OutDir>$(SolutionDir)\$(Configuration)\$(ProjectName)\</OutDir>
<IntDir>$(SolutionDir)\$(Configuration)\$(ProjectName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_ENABLE_PROMPT=0;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=1</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir)\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_ENABLE_PROMPT=0;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=1</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalIncludeDirectories>$(SolutionDir)\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_ENABLE_PROMPT=0;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=1</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)\include</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions);BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_ENABLE_PROMPT=0;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=1</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir)\include</AdditionalIncludeDirectories>
</ClCompile>
</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>

96
bcl.vcxproj.filters Normal file
View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\data.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\library.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\num.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\rand.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\vector.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\vm.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\args.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\bc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\bcl.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\dc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\file.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\history.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\lang.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\lex.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\library.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\num.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\opt.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\parse.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\program.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\rand.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\read.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\status.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\vector.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\version.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\vm.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

1
configure vendored
View File

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

1321
configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@ -1221,6 +1221,8 @@ contents=$(replace "$contents" "DC_TESTS" "$dc_tests")
contents=$(replace "$contents" "DC_SCRIPT_TESTS" "$dc_script_tests")
contents=$(replace "$contents" "DC_TEST_EXEC" "$dc_test_exec")
contents=$(replace "$contents" "BUILD_TYPE" "$manpage_args")
contents=$(replace "$contents" "LIBRARY" "$library")
contents=$(replace "$contents" "HISTORY" "$hist")
contents=$(replace "$contents" "EXTRA_MATH" "$extra_math")

View File

@ -36,7 +36,8 @@
usage: %s [options] [file...]
bc is a command-line, arbitrary-precision calculator with a Turing-complete
language. For details, use `man %s`.
language. For details, use `man %s` or see the online documentation at
https://git.yzena.com/gavin/bc/src/tag/%s/manuals/bc/%s.1.md.
This bc is compatible with both the GNU bc and the POSIX bc spec. See the GNU bc
manual (https://www.gnu.org/software/bc/manual/bc.html) and bc spec
@ -56,7 +57,7 @@ This bc has three differences to the GNU bc:
scripts to work while somewhat preserving expected behavior (versus C) and
making parsing easier.
3) This bc has many more extensions than the GNU bc does. For details, see the
man page.
man page or online documentation.
This bc also implements the dot (.) extension of the BSD bc.
@ -74,8 +75,8 @@ Options:
-g --global-stacks
Turn scale, ibase, and obase into stacks. This makes the value of each be
be restored on returning from functions. See the man page for more
details.
be restored on returning from functions. See the man page or online
documentation for more details.
-h --help
@ -96,12 +97,16 @@ Options:
e(expr) = raises e to the power of expr
j(n, x) = Bessel function of integer order n of x
This bc may load more functions with these options. See the manpage for
details.
This bc may load more functions with these options. See the manpage or
online documentation for details.
-P --no-prompt
Disable the prompt in interactive mode.
Disable the prompts in interactive mode.
-R --no-read-prompt
Disable the read prompt in interactive mode.
-q --quiet

View File

@ -36,12 +36,13 @@
usage: %s [options] [file...]
dc is a reverse-polish notation command-line calculator which supports unlimited
precision arithmetic. For details, use `man %s`.
precision arithmetic. For details, use `man %s` or see the online documentation
at https://git.yzena.com/gavin/bc/src/tag/%s/manuals/bc/%s.1.md.
This dc is (mostly) compatible with the FreeBSD dc and the GNU dc. See the
FreeBSD man page (https://www.unix.com/man-page/FreeBSD/1/dc/) and the GNU dc
manual (https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html) for
details.
This dc is (mostly) compatible with the OpenBSD dc and the GNU dc. See the
OpenBSD man page (http://man.openbsd.org/OpenBSD-current/man1/dc.1) and the GNU
dc manual (https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html)
for details.
This dc has a few differences from the two above:
@ -90,7 +91,11 @@ Options:
-P --no-prompt
Disable the prompt in interactive mode.
Disable the prompts in interactive mode.
-R --no-read-prompt
Disable the read prompt in interactive mode.
-V --version

View File

@ -40,7 +40,9 @@
#include <errno.h>
#ifndef _WIN32
#include <libgen.h>
#endif // _WIN32
static const char* const bc_gen_header =
"// Copyright (c) 2018-2021 Gavin D. Howard and contributors.\n"
@ -60,6 +62,54 @@ static const char* const bc_gen_name_extern = "extern const char %s[];\n\n";
#define MAX_WIDTH (74)
static void open_file(FILE** f, const char* filename, const char* mode) {
#ifndef _WIN32
*f = fopen(filename, mode);
#else // _WIN32
*f = NULL;
fopen_s(f, filename, mode);
#endif // _WIN32
}
static int output_label(FILE* out, const char* label, const char* name) {
#ifndef _WIN32
return fprintf(out, bc_gen_label, label, name);
#else // _WIN32
size_t i, count = 0, len = strlen(name);
char* buf;
int ret;
for (i = 0; i < len; ++i) {
count += (name[i] == '\\');
}
buf = (char*) malloc(len + 1 + count);
if (buf == NULL) return -1;
count = 0;
for (i = 0; i < len; ++i) {
buf[i + count] = name[i];
if (name[i] == '\\') {
count += 1;
buf[i + count] = name[i];
}
}
buf[i + count] = '\0';
ret = fprintf(out, bc_gen_label, label, buf);
free(buf);
return ret;
#endif // _WIN32
}
int main(int argc, char *argv[]) {
FILE *in, *out;
@ -82,17 +132,17 @@ int main(int argc, char *argv[]) {
remove_tabs = (argc > 6);
in = fopen(argv[1], "r");
open_file(&in, argv[1], "r");
if (!in) return INVALID_INPUT_FILE;
out = fopen(argv[2], "w");
open_file(&out, argv[2], "w");
if (!out) goto out_err;
if (fprintf(out, bc_gen_header, argv[1]) < 0) goto err;
if (has_label && fprintf(out, bc_gen_label_extern, label) < 0) goto err;
if (fprintf(out, bc_gen_name_extern, name) < 0) goto err;
if (has_define && fprintf(out, bc_gen_ifdef, define) < 0) goto err;
if (has_label && fprintf(out, bc_gen_label, label, argv[1]) < 0) goto err;
if (has_label && output_label(out, label, argv[1]) < 0) goto err;
if (fprintf(out, bc_gen_name, name) < 0) goto err;
c = count = slashes = 0;

View File

@ -36,6 +36,13 @@
#ifndef BC_BCL_H
#define BC_BCL_H
#ifdef _WIN32
#include <Windows.h>
#include <BaseTsd.h>
#include <stdio.h>
#include <io.h>
#endif // _WIN32
#include <stdbool.h>
#include <stdlib.h>
#include <limits.h>
@ -74,6 +81,99 @@ typedef uint32_t BclRandInt;
#error BC_LONG_BIT must be at least 32
#endif // BC_LONG_BIT >= 64
#define BC_UNUSED(e) ((void) (e))
#ifndef BC_LIKELY
#define BC_LIKELY(e) (e)
#endif // BC_LIKELY
#ifndef BC_UNLIKELY
#define BC_UNLIKELY(e) (e)
#endif // BC_UNLIKELY
#define BC_ERR(e) BC_UNLIKELY(e)
#define BC_NO_ERR(s) BC_LIKELY(s)
#ifndef BC_DEBUG_CODE
#define BC_DEBUG_CODE (0)
#endif // BC_DEBUG_CODE
#if __STDC_VERSION__ >= 201100L
#include <stdnoreturn.h>
#define BC_NORETURN _Noreturn
#else // __STDC_VERSION__
#define BC_NORETURN
#define BC_MUST_RETURN
#endif // __STDC_VERSION__
#if defined(__clang__) || defined(__GNUC__)
#if defined(__has_attribute)
#if __has_attribute(fallthrough)
#define BC_FALLTHROUGH __attribute__((fallthrough));
#else // __has_attribute(fallthrough)
#define BC_FALLTHROUGH
#endif // __has_attribute(fallthrough)
#else // defined(__has_attribute)
#define BC_FALLTHROUGH
#endif // defined(__has_attribute)
#else // defined(__clang__) || defined(__GNUC__)
#define BC_FALLTHROUGH
#endif // defined(__clang__) || defined(__GNUC__)
// Workarounds for AIX's POSIX incompatibility.
#ifndef SIZE_MAX
#define SIZE_MAX __SIZE_MAX__
#endif // SIZE_MAX
#ifndef UINTMAX_C
#define UINTMAX_C __UINTMAX_C
#endif // UINTMAX_C
#ifndef UINT32_C
#define UINT32_C __UINT32_C
#endif // UINT32_C
#ifndef UINT_FAST32_MAX
#define UINT_FAST32_MAX __UINT_FAST32_MAX__
#endif // UINT_FAST32_MAX
#ifndef UINT16_MAX
#define UINT16_MAX __UINT16_MAX__
#endif // UINT16_MAX
#ifndef SIG_ATOMIC_MAX
#define SIG_ATOMIC_MAX __SIG_ATOMIC_MAX__
#endif // SIG_ATOMIC_MAX
// Windows has deprecated isatty() and the rest of these.
// Or doesn't have them.
#ifdef _WIN32
// This one is special. Windows did not like me defining an
// inline function that was not given a definition in a header
// file. This suppresses that by making inline functions non-inline.
#define inline
#define restrict __restrict
#define strdup _strdup
#define write(f, b, s) _write((f), (b), (unsigned int) (s))
#define read(f, b, s) _read((f), (b), (unsigned int) (s))
#define close _close
#define open(f, n, m) _sopen_s(f, n, m, _SH_DENYNO, _S_IREAD | _S_IWRITE)
#define sigjmp_buf jmp_buf
#define sigsetjmp(j, s) setjmp(j)
#define siglongjmp longjmp
#define isatty _isatty
#define STDIN_FILENO (0)
#define STDOUT_FILENO (1)
#define STDERR_FILENO (2)
#define ssize_t SSIZE_T
#define S_ISDIR(m) ((m) & _S_IFDIR)
#define O_RDONLY _O_RDONLY
#define stat _stat
#define fstat _fstat
#define BC_FILE_SEP '\\'
#else // _WIN32
#define BC_FILE_SEP '/'
#endif // _WIN32
#if BC_ENABLE_LIBRARY
typedef enum BclError {
@ -181,4 +281,6 @@ BclNumber bcl_rand_seed2num(void);
BclRandInt bcl_rand_int(void);
BclRandInt bcl_rand_bounded(BclRandInt bound);
#endif // BC_ENABLE_LIBRARY
#endif // BC_BCL_H

View File

@ -51,15 +51,39 @@ typedef struct BcFile {
} BcFile;
#if BC_ENABLE_HISTORY
typedef enum BcFlushType {
BC_FLUSH_NO_EXTRAS_NO_CLEAR,
BC_FLUSH_SAVE_EXTRAS_NO_CLEAR,
BC_FLUSH_NO_EXTRAS_CLEAR,
BC_FLUSH_SAVE_EXTRAS_CLEAR,
} BcFlushType;
#else // BC_ENABLE_HISTORY
#define bc_file_putchar(f, t, c) bc_file_putchar(f, c)
#define bc_file_flushErr(f, t) bc_file_flushErr(f)
#define bc_file_flush(f, t) bc_file_flush(f)
#define bc_file_write(f, t, b, n) bc_file_write(f, b, n)
#define bc_file_puts(f, t, s) bc_file_puts(f, s)
#endif // BC_ENABLE_HISTORY
void bc_file_init(BcFile *f, int fd, char *buf, size_t cap);
void bc_file_free(BcFile *f);
void bc_file_putchar(BcFile *restrict f, uchar c);
BcStatus bc_file_flushErr(BcFile *restrict f);
void bc_file_flush(BcFile *restrict f);
void bc_file_write(BcFile *restrict f, const char *buf, size_t n);
void bc_file_putchar(BcFile *restrict f, BcFlushType type, uchar c);
BcStatus bc_file_flushErr(BcFile *restrict f, BcFlushType type);
void bc_file_flush(BcFile *restrict f, BcFlushType type);
void bc_file_write(BcFile *restrict f, BcFlushType type,
const char *buf, size_t n);
void bc_file_printf(BcFile *restrict f, const char *fmt, ...);
void bc_file_vprintf(BcFile *restrict f, const char *fmt, va_list args);
void bc_file_puts(BcFile *restrict f, const char *str);
void bc_file_puts(BcFile *restrict f, BcFlushType type, const char *str);
#if BC_ENABLE_HISTORY
extern const BcFlushType bc_flush_none;
extern const BcFlushType bc_flush_err;
extern const BcFlushType bc_flush_save;
#endif // BC_ENABLE_HISTORY
#endif // BC_FILE_H

View File

@ -186,6 +186,9 @@ typedef struct BcHistory {
/// The history.
BcVec history;
/// Any material printed without a trailing newline.
BcVec extras;
#if BC_ENABLE_PROMPT
/// Prompt to display.
const char *prompt;

View File

@ -172,9 +172,10 @@ struct BcRNG;
#endif // BC_DEBUG_CODE
typedef void (*BcNumBinaryOp)(BcNum*, BcNum*, BcNum*, size_t);
typedef void (*BcNumBinOp)(BcNum*, BcNum*, BcNum* restrict, size_t);
typedef size_t (*BcNumBinaryOpReq)(const BcNum*, const BcNum*, size_t);
typedef void (*BcNumDigitOp)(size_t, size_t, bool);
typedef void (*BcNumShiftAddOp)(BcDig*, const BcDig*, size_t);
typedef void (*BcNumShiftAddOp)(BcDig* restrict, const BcDig* restrict, size_t);
void bc_num_init(BcNum *restrict n, size_t req);
void bc_num_setup(BcNum *restrict n, BcDig *restrict num, size_t cap);

View File

@ -150,63 +150,4 @@ typedef enum BcErr {
#define BC_ERR_IDX_WARN (BC_ERR_IDX_NELEMS)
#endif // BC_ENABLED
#define BC_UNUSED(e) ((void) (e))
#ifndef BC_LIKELY
#define BC_LIKELY(e) (e)
#endif // BC_LIKELY
#ifndef BC_UNLIKELY
#define BC_UNLIKELY(e) (e)
#endif // BC_UNLIKELY
#define BC_ERR(e) BC_UNLIKELY(e)
#define BC_NO_ERR(s) BC_LIKELY(s)
#ifndef BC_DEBUG_CODE
#define BC_DEBUG_CODE (0)
#endif // BC_DEBUG_CODE
#if __STDC_VERSION__ >= 201100L
#include <stdnoreturn.h>
#define BC_NORETURN _Noreturn
#else // __STDC_VERSION__
#define BC_NORETURN
#define BC_MUST_RETURN
#endif // __STDC_VERSION__
#if defined(__clang__) || defined(__GNUC__)
#if defined(__has_attribute)
#if __has_attribute(fallthrough)
#define BC_FALLTHROUGH __attribute__((fallthrough));
#else // __has_attribute(fallthrough)
#define BC_FALLTHROUGH
#endif // __has_attribute(fallthrough)
#else // defined(__has_attribute)
#define BC_FALLTHROUGH
#endif // defined(__has_attribute)
#else // defined(__clang__) || defined(__GNUC__)
#define BC_FALLTHROUGH
#endif // defined(__clang__) || defined(__GNUC__)
// Workarounds for AIX's POSIX incompatibility.
#ifndef SIZE_MAX
#define SIZE_MAX __SIZE_MAX__
#endif // SIZE_MAX
#ifndef UINTMAX_C
#define UINTMAX_C __UINTMAX_C
#endif // UINTMAX_C
#ifndef UINT32_C
#define UINT32_C __UINT32_C
#endif // UINT32_C
#ifndef UINT_FAST32_MAX
#define UINT_FAST32_MAX __UINT_FAST32_MAX__
#endif // UINT_FAST32_MAX
#ifndef UINT16_MAX
#define UINT16_MAX __UINT16_MAX__
#endif // UINT16_MAX
#ifndef SIG_ATOMIC_MAX
#define SIG_ATOMIC_MAX __SIG_ATOMIC_MAX__
#endif // SIG_ATOMIC_MAX
#endif // BC_STATUS_H

41
include/version.h Normal file
View File

@ -0,0 +1,41 @@
/*
* *****************************************************************************
*
* 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.
*
* *****************************************************************************
*
* Definitions for processing command-line arguments.
*
*/
#ifndef BC_VERSION_H
#define BC_VERSION_H
#define VERSION 4.0.0
#endif // BC_VERSION_H

View File

@ -52,6 +52,7 @@
#endif // BC_ENABLE_NLS
#include <version.h>
#include <status.h>
#include <num.h>
#include <parse.h>
@ -77,22 +78,27 @@
#ifndef MAINEXEC
#define MAINEXEC bc
#endif
#endif // MAINEXEC
#ifndef _WIN32
#ifndef EXECPREFIX
#define EXECPREFIX
#endif
#endif // EXECPREFIX
#else // _WIN32
#undef EXECPREFIX
#endif // _WIN32
#define GEN_STR(V) #V
#define GEN_STR2(V) GEN_STR(V)
#define BC_VERSION GEN_STR2(VERSION)
#define BC_EXECPREFIX GEN_STR2(EXECPREFIX)
#define BC_MAINEXEC GEN_STR2(MAINEXEC)
#define BC_BUILD_TYPE GEN_STR2(BUILD_TYPE)
// Windows has deprecated isatty().
#ifdef _WIN32
#define isatty _isatty
#ifndef _WIN32
#define BC_EXECPREFIX GEN_STR2(EXECPREFIX)
#else // _WIN32
#define BC_EXECPREFIX ""
#endif // _WIN32
#if !BC_ENABLE_LIBRARY
@ -110,8 +116,9 @@
#define BC_FLAG_I (UINTMAX_C(1)<<5)
#define BC_FLAG_P (UINTMAX_C(1)<<6)
#define BC_FLAG_TTYIN (UINTMAX_C(1)<<7)
#define BC_FLAG_TTY (UINTMAX_C(1)<<8)
#define BC_FLAG_R (UINTMAX_C(1)<<7)
#define BC_FLAG_TTYIN (UINTMAX_C(1)<<8)
#define BC_FLAG_TTY (UINTMAX_C(1)<<9)
#define BC_TTYIN (vm.flags & BC_FLAG_TTYIN)
#define BC_TTY (vm.flags & BC_FLAG_TTY)
@ -130,6 +137,7 @@
#define BC_I (vm.flags & BC_FLAG_I)
#define BC_P (vm.flags & BC_FLAG_P)
#define BC_R (vm.flags & BC_FLAG_R)
#if BC_ENABLED
@ -421,13 +429,19 @@ void bc_vm_init(void);
void bc_vm_shutdown(void);
void bc_vm_freeTemps(void);
#if !BC_ENABLE_HISTORY
#define bc_vm_putchar(c, t) bc_vm_putchar(c)
#endif // !BC_ENABLE_HISTORY
void bc_vm_printf(const char *fmt, ...);
void bc_vm_putchar(int c);
void bc_vm_putchar(int c, BcFlushType type);
size_t bc_vm_arraySize(size_t n, size_t size);
size_t bc_vm_growSize(size_t a, size_t b);
void* bc_vm_malloc(size_t n);
void* bc_vm_realloc(void *ptr, size_t n);
char* bc_vm_strdup(const char *str);
char* bc_vm_getenv(const char* var);
void bc_vm_getenvFree(char* var);
#if BC_DEBUG_CODE
void bc_vm_jmp(const char *f);

View File

@ -121,20 +121,20 @@ def run(cmd, env=None):
p = run([ "make", "clean" ])
print("Testing \"make -j12\"")
print("Testing \"make -j16\"")
if p.returncode != 0:
print("make returned an error ({}); exiting...".format(p.returncode))
sys.exit(p.returncode)
p = run([ "make", "-j12" ])
p = run([ "make", "-j16" ])
if p.returncode == 0:
makecmd = [ "make", "-j12" ]
print("Using \"make -j12\"")
makecmd = [ "make", "-j16" ]
print("Using \"make -j16\"")
else:
makecmd = [ "make" ]
print("Not using \"make -j12\"")
print("Not using \"make -j16\"")
if test_num != 0:
mx2 = test_num

View File

@ -43,7 +43,7 @@ print_manpage() {
cat "$manualsdir/header.txt" > "$_print_manpage_out"
cat "$manualsdir/header_${manpage}.txt" >> "$_print_manpage_out"
pandoc -f markdown -t man "$_print_manpage_md" >> "$_print_manpage_out"
pandoc -f commonmark -t man "$_print_manpage_md" >> "$_print_manpage_out"
}

View File

@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -181,7 +181,7 @@ The following are the options that bc(1) accepts.
{{ A E H N EH EN HN EHN }}
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in bc(1). Most of those users
would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section).
@ -192,6 +192,25 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
{{ A E H N EH EN HN EHN }}
: Disables the read prompt in TTY mode. (The read prompt is only enabled in
TTY mode. See the **TTY MODE** section.) This is mostly for those users that
do not want a read prompt or are not used to having them in bc(1). Most of
those users would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
lines of bc(1) scripts that prompt for user input.
This option does not disable the regular prompt because the read prompt is
only used when the **read()** built-in function is called.
{{ end }}
{{ P EP HP NP EHP ENP HNP EHNP }}
: Because bc(1) was built without support for prompts, this option is a no-op.
{{ end }}
This is a **non-portable extension**.
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -143,13 +143,27 @@ The following are the options that bc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in bc(1). Most of those users
would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section).
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Disables the read prompt in TTY mode. (The read prompt is only enabled in
TTY mode. See the **TTY MODE** section.) This is mostly for those users that
do not want a read prompt or are not used to having them in bc(1). Most of
those users would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
lines of bc(1) scripts that prompt for user input.
This option does not disable the regular prompt because the read prompt is
only used when the **read()** built-in function is called.
This is a **non-portable extension**.
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -127,13 +127,27 @@ The following are the options that bc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in bc(1). Most of those users
would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section).
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Disables the read prompt in TTY mode. (The read prompt is only enabled in
TTY mode. See the **TTY MODE** section.) This is mostly for those users that
do not want a read prompt or are not used to having them in bc(1). Most of
those users would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
lines of bc(1) scripts that prompt for user input.
This option does not disable the regular prompt because the read prompt is
only used when the **read()** built-in function is called.
This is a **non-portable extension**.
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -124,13 +124,27 @@ The following are the options that bc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in bc(1). Most of those users
would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section).
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Disables the read prompt in TTY mode. (The read prompt is only enabled in
TTY mode. See the **TTY MODE** section.) This is mostly for those users that
do not want a read prompt or are not used to having them in bc(1). Most of
those users would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
lines of bc(1) scripts that prompt for user input.
This option does not disable the regular prompt because the read prompt is
only used when the **read()** built-in function is called.
This is a **non-portable extension**.
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -124,13 +124,27 @@ The following are the options that bc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in bc(1). Most of those users
would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section).
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Disables the read prompt in TTY mode. (The read prompt is only enabled in
TTY mode. See the **TTY MODE** section.) This is mostly for those users that
do not want a read prompt or are not used to having them in bc(1). Most of
those users would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
lines of bc(1) scripts that prompt for user input.
This option does not disable the regular prompt because the read prompt is
only used when the **read()** built-in function is called.
This is a **non-portable extension**.
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -127,6 +127,12 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Because bc(1) was built without support for prompts, this option is a no-op.
This is a **non-portable extension**.
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -127,6 +127,12 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Because bc(1) was built without support for prompts, this option is a no-op.
This is a **non-portable extension**.
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -127,13 +127,27 @@ The following are the options that bc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in bc(1). Most of those users
would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section).
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Disables the read prompt in TTY mode. (The read prompt is only enabled in
TTY mode. See the **TTY MODE** section.) This is mostly for those users that
do not want a read prompt or are not used to having them in bc(1). Most of
those users would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
lines of bc(1) scripts that prompt for user input.
This option does not disable the regular prompt because the read prompt is
only used when the **read()** built-in function is called.
This is a **non-portable extension**.
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -130,6 +130,12 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Because bc(1) was built without support for prompts, this option is a no-op.
This is a **non-portable extension**.
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -130,6 +130,12 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Because bc(1) was built without support for prompts, this option is a no-op.
This is a **non-portable extension**.
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -139,13 +139,27 @@ The following are the options that bc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in bc(1). Most of those users
would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section).
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Disables the read prompt in TTY mode. (The read prompt is only enabled in
TTY mode. See the **TTY MODE** section.) This is mostly for those users that
do not want a read prompt or are not used to having them in bc(1). Most of
those users would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
lines of bc(1) scripts that prompt for user input.
This option does not disable the regular prompt because the read prompt is
only used when the **read()** built-in function is called.
This is a **non-portable extension**.
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -139,13 +139,27 @@ The following are the options that bc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in bc(1). Most of those users
would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section).
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Disables the read prompt in TTY mode. (The read prompt is only enabled in
TTY mode. See the **TTY MODE** section.) This is mostly for those users that
do not want a read prompt or are not used to having them in bc(1). Most of
those users would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
lines of bc(1) scripts that prompt for user input.
This option does not disable the regular prompt because the read prompt is
only used when the **read()** built-in function is called.
This is a **non-portable extension**.
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -142,6 +142,12 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Because bc(1) was built without support for prompts, this option is a no-op.
This is a **non-portable extension**.
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -142,6 +142,12 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Because bc(1) was built without support for prompts, this option is a no-op.
This is a **non-portable extension**.
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -143,13 +143,27 @@ The following are the options that bc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in bc(1). Most of those users
would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section).
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Disables the read prompt in TTY mode. (The read prompt is only enabled in
TTY mode. See the **TTY MODE** section.) This is mostly for those users that
do not want a read prompt or are not used to having them in bc(1). Most of
those users would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
lines of bc(1) scripts that prompt for user input.
This option does not disable the regular prompt because the read prompt is
only used when the **read()** built-in function is called.
This is a **non-portable extension**.
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -146,6 +146,12 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Because bc(1) was built without support for prompts, this option is a no-op.
This is a **non-portable extension**.
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -146,6 +146,12 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Because bc(1) was built without support for prompts, this option is a no-op.
This is a **non-portable extension**.
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.

File diff suppressed because it is too large Load Diff

View File

@ -37,9 +37,50 @@ See [Build Environment Variables][4] for a more detailed description of all
accepted environment variables and [Build Options][5] for more detail about all
accepted build options.
## Windows
On Windows, this `bc` can be built using Visual Studio or MSBuild.
However, only one build configuration (besides Debug or Release) is supported:
extra math and prompt enabled, history and NLS (locale support) disabled, with
both calculators built.
The library can also be built on Windows.
### Visual Studio
In Visual Studio, open up the solution file (`bc.sln` for `bc`, or `bcl.sln` for
the library), select the desired configuration, and build.
### MSBuild
To build with MSBuild, first, *be sure that you are using the MSBuild that comes
with Visual Studio*.
To build `bc`, run the following from the root directory:
```
msbuild -property:Configuration=<config> bc.sln
```
where `<config>` is either one of `Debug` or `Release`.
To build the library, run the following from the root directory:
```
msbuild -property:Configuration=<config> bcl.sln
```
where `<config>` is either one of `Debug` or `Release`.
## POSIX-Compatible Systems
Building `bc`, `dc`, and `bcl` (the library) is more complex than on Windows
because many build options are supported.
<a name="cross-compiling"/>
## Cross Compiling
### Cross Compiling
To cross-compile this `bc`, an appropriate compiler must be present and assigned
to the environment variable `HOSTCC` or `HOST_CC` (the two are equivalent,
@ -69,7 +110,7 @@ the environment variable `GEN_EMU`.
<a name="build-environment-variables"/>
## Build Environment Variables
### Build Environment Variables
This `bc` supports `CC`, `HOSTCC`, `HOST_CC`, `CFLAGS`, `HOSTCFLAGS`,
`HOST_CFLAGS`, `CPPFLAGS`, `LDFLAGS`, `LDLIBS`, `PREFIX`, `DESTDIR`, `BINDIR`,
@ -81,7 +122,7 @@ put into the generated Makefile.
More detail on what those environment variables do can be found in the following
sections.
### `CC`
#### `CC`
C compiler for the target system. `CC` must be compatible with POSIX `c99`
behavior and options. However, **I encourage users to use any C99 or C11
@ -104,33 +145,33 @@ automatically moved into HOSTCFLAGS.
Defaults to `$CC`.
### `CFLAGS`
#### `CFLAGS`
Command-line flags that will be passed verbatim to `CC`.
Defaults to empty.
### `HOSTCFLAGS` or `HOST_CFLAGS`
#### `HOSTCFLAGS` or `HOST_CFLAGS`
Command-line flags that will be passed verbatim to `HOSTCC` or `HOST_CC`.
Defaults to `$CFLAGS`.
### `CPPFLAGS`
#### `CPPFLAGS`
Command-line flags for the C preprocessor. These are also passed verbatim to
both compilers (`CC` and `HOSTCC`); they are supported just for legacy reasons.
Defaults to empty.
### `LDFLAGS`
#### `LDFLAGS`
Command-line flags for the linker. These are also passed verbatim to both
compilers (`CC` and `HOSTCC`); they are supported just for legacy reasons.
Defaults to empty.
### `LDLIBS`
#### `LDLIBS`
Libraries to link to. These are also passed verbatim to both compilers (`CC` and
`HOSTCC`); they are supported just for legacy reasons and for cross compiling
@ -138,7 +179,7 @@ with different C standard libraries (like [musl][3]).
Defaults to empty.
### `PREFIX`
#### `PREFIX`
The prefix to install to.
@ -146,7 +187,7 @@ Can be overridden by passing the `--prefix` option to `configure.sh`.
Defaults to `/usr/local`.
### `DESTDIR`
#### `DESTDIR`
Path to prepend onto `PREFIX`. This is mostly for distro and package
maintainers.
@ -156,7 +197,7 @@ to both, the one given to `configure.sh` takes precedence.
Defaults to empty.
### `BINDIR`
#### `BINDIR`
The directory to install binaries in.
@ -164,7 +205,7 @@ Can be overridden by passing the `--bindir` option to `configure.sh`.
Defaults to `$PREFIX/bin`.
### `INCLUDEDIR`
#### `INCLUDEDIR`
The directory to install header files in.
@ -172,7 +213,7 @@ Can be overridden by passing the `--includedir` option to `configure.sh`.
Defaults to `$PREFIX/include`.
### `LIBDIR`
#### `LIBDIR`
The directory to install libraries in.
@ -180,7 +221,7 @@ Can be overridden by passing the `--libdir` option to `configure.sh`.
Defaults to `$PREFIX/lib`.
### `DATAROOTDIR`
#### `DATAROOTDIR`
The root directory to install data files in.
@ -188,7 +229,7 @@ Can be overridden by passing the `--datarootdir` option to `configure.sh`.
Defaults to `$PREFIX/share`.
### `DATADIR`
#### `DATADIR`
The directory to install data files in.
@ -196,7 +237,7 @@ Can be overridden by passing the `--datadir` option to `configure.sh`.
Defaults to `$DATAROOTDIR`.
### `MANDIR`
#### `MANDIR`
The directory to install manpages in.
@ -204,7 +245,7 @@ Can be overridden by passing the `--mandir` option to `configure.sh`.
Defaults to `$DATADIR/man`
### `MAN1DIR`
#### `MAN1DIR`
The directory to install Section 1 manpages in. Because both `bc` and `dc` are
Section 1 commands, this is the only relevant section directory.
@ -213,7 +254,7 @@ Can be overridden by passing the `--man1dir` option to `configure.sh`.
Defaults to `$MANDIR/man1`.
### `LOCALEDIR`
#### `LOCALEDIR`
The directory to install locales in.
@ -221,7 +262,7 @@ Can be overridden by passing the `--localedir` option to `configure.sh`.
Defaults to `$DATAROOTDIR/locale`.
### `EXECSUFFIX`
#### `EXECSUFFIX`
The suffix to append onto the executable names *when installing*. This is for
packagers and distro maintainers who want this `bc` as an option, but do not
@ -229,7 +270,7 @@ want to replace the default `bc`.
Defaults to empty.
### `EXECPREFIX`
#### `EXECPREFIX`
The prefix to append onto the executable names *when building and installing*.
This is for packagers and distro maintainers who want this `bc` as an option,
@ -237,7 +278,7 @@ but do not want to replace the default `bc`.
Defaults to empty.
### `LONG_BIT`
#### `LONG_BIT`
The number of bits in a C `long` type. This is mostly for the embedded space.
@ -254,7 +295,7 @@ compliance with the `bc` spec, the minimum allowed value is `32`.
It is an error if the specified value is greater than the default value of
`LONG_BIT` for the target platform.
### `GEN_HOST`
#### `GEN_HOST`
Whether to use `gen/strgen.c`, instead of `gen/strgen.sh`, to produce the C
files that contain the help texts as well as the math libraries. By default,
@ -274,7 +315,7 @@ or a non-existent value, will cause the build system to compile and run
Default is "".
### `GEN_EMU`
#### `GEN_EMU`
The emulator to run bootstrap binaries under. This is only if the binaries
produced by `HOSTCC` (or `HOST_CC`) need to be run under an emulator to work.
@ -283,7 +324,7 @@ Defaults to empty.
<a name="build-options"/>
## Build Options
### Build Options
This `bc` comes with several build options, all of which are enabled by default.
@ -298,7 +339,7 @@ following forms:
--option=arg
```
### Library
#### Library
To build the math library, use the following commands for the configure step:
@ -321,7 +362,7 @@ is installed.
The library is built as `bin/libbcl.a`.
### `bc` Only
#### `bc` Only
To build `bc` only (no `dc`), use any one of the following commands for the
configure step:
@ -338,7 +379,7 @@ Those commands are all equivalent.
***Warning***: It is an error to use those options if `bc` has also been
disabled (see below).
### `dc` Only
#### `dc` Only
To build `dc` only (no `bc`), use either one of the following commands for the
configure step:
@ -357,7 +398,7 @@ disabled (see above).
<a name="build-history"/>
### History
#### History
To disable signal handling, pass either the `-H` flag or the `--disable-history`
option to `configure.sh`, as follows:
@ -376,7 +417,7 @@ platform that does not support the terminal handling that is required.
completely portable. If the `bc` does not work on your platform, your first step
should be to retry with history disabled.
### NLS (Locale Support)
#### NLS (Locale Support)
To disable locale support (use only English), pass either the `-N` flag or the
`--disable-nls` option to `configure.sh`, as follows:
@ -391,7 +432,7 @@ Both commands are equivalent.
NLS (locale support) is automatically disabled when building for Windows or on
another platform that does not support the POSIX locale API or utilities.
### Prompt
#### Prompt
By default, `bc` and `dc` print a prompt when in interactive mode. They both
have the command-line option `-P`/`--no-prompt`, which turns that off, but it
@ -405,7 +446,7 @@ can be disabled permanently in the build by passing the `-P` flag or the
Both commands are equivalent.
### Locales
#### Locales
By default, `bc` and `dc` do not install all locales, but only the enabled
locales. If `DESTDIR` exists and is not empty, then they will install all of
@ -421,7 +462,7 @@ have, regardless. To enable that behavior, you can pass the `-l` flag or the
Both commands are equivalent.
### Extra Math
#### Extra Math
This `bc` has 7 extra operators:
@ -458,7 +499,7 @@ This `bc` also has a larger library that is only enabled if extra operators and
the pseudo-random number generator are. More information about the functions can
be found in the Extended Library section of the full manual.
### Manpages
#### Manpages
To disable installing manpages, pass either the `-M` flag or the
`--disable-man-pages` option to `configure.sh` as follows:
@ -470,7 +511,7 @@ To disable installing manpages, pass either the `-M` flag or the
Both commands are equivalent.
### Karatsuba Length
#### Karatsuba Length
The Karatsuba length is the point at which `bc` and `dc` switch from Karatsuba
multiplication to brute force, `O(n^2)` multiplication. It can be set by passing
@ -489,7 +530,7 @@ Default is `64`.
to `16` (to prevent stack overflow). If it is not, `configure.sh` will give an
error.
### Install Options
#### Install Options
The relevant `autotools`-style install options are supported in `configure.sh`:
@ -520,7 +561,7 @@ environment variable is overridden.
other command-line options must be used. Mixing long and short options is not
supported.
## Optimization
### Optimization
The `configure.sh` script will accept an optimization level to pass to the
compiler. Because `bc` is orders of magnitude faster with optimization, I
@ -560,7 +601,7 @@ I do **NOT*** recommend building with `-march=native`; doing so reduces this
Manual stripping is not necessary; non-debug builds are automatically stripped
in the link stage.
## Debug Builds
### Debug Builds
Debug builds (which also disable optimization if no optimization level is given
and if no extra `CFLAGS` are given) can be enabled with either the `-g` flag or
@ -580,7 +621,7 @@ make
make install
```
## Stripping Binaries
### Stripping Binaries
By default, when `bc` and `dc` are not built in debug mode, the binaries are
stripped. Stripping can be disabled with either the `-T` or the
@ -600,7 +641,7 @@ make
make install
```
## Binary Size
### Binary Size
When built with both calculators, all available features, and `-Os` using
`clang` and `musl`, the executable is 140.4 kb (140,386 bytes) on `x86_64`. That
@ -649,7 +690,7 @@ kb (107,576 bytes) without history and with extra math support, and 95.3 kb
optimizations. These builds were done on an `x86_64` machine running Gentoo
Linux.
## Testing
### Testing
The default test suite can be run with the following command:

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -82,7 +82,7 @@ The following are the options that dc(1) accepts.
{{ A E H N EH EN HN EHN }}
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in dc(1). Most of those users
would want to put this option in **DC_ENV_ARGS**.
{{ end }}
@ -92,6 +92,25 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
{{ A E H N EH EN HN EHN }}
: Disables the read prompt in TTY mode. (The read prompt is only enabled in
TTY mode. See the **TTY MODE** section.) This is mostly for those users that
do not want a read prompt or are not used to having them in dc(1). Most of
those users would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
lines of dc(1) scripts that prompt for user input.
This option does not disable the regular prompt because the read prompt is
only used when the **?** command is used.
{{ end }}
{{ P EP HP NP EHP ENP HNP EHNP }}
: This option is a no-op.
{{ end }}
This is a **non-portable extension**.
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@ -576,25 +595,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
**s***r*
**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
**l***r*
**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
**S***r*
**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
**L***r*
**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
now accessible via the **l***r* command.
now accessible via the **l**_r_ command.
## Parameters
@ -761,7 +780,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
**\>***r*
**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@ -773,7 +792,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**>***r***e***s*
**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -782,7 +801,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\>***r*
**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@ -791,7 +810,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\>***r***e***s*
**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -800,7 +819,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**\<***r*
**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@ -809,7 +828,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**\<***r***e***s*
**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -818,7 +837,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\<***r*
**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@ -827,7 +846,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\<***r***e***s*
**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -836,7 +855,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**=***r*
**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@ -845,7 +864,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**=***r***e***s*
**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -854,7 +873,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!=***r*
**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@ -863,7 +882,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!=***r***e***s*
**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -919,12 +938,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
**:***r*
**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
**;***r*
**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -81,12 +81,26 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in dc(1). Most of those users
would want to put this option in **DC_ENV_ARGS**.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Disables the read prompt in TTY mode. (The read prompt is only enabled in
TTY mode. See the **TTY MODE** section.) This is mostly for those users that
do not want a read prompt or are not used to having them in dc(1). Most of
those users would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
lines of dc(1) scripts that prompt for user input.
This option does not disable the regular prompt because the read prompt is
only used when the **?** command is used.
This is a **non-portable extension**.
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@ -556,25 +570,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
**s***r*
**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
**l***r*
**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
**S***r*
**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
**L***r*
**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
now accessible via the **l***r* command.
now accessible via the **l**_r_ command.
## Parameters
@ -723,7 +737,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
**\>***r*
**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@ -735,7 +749,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**>***r***e***s*
**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -744,7 +758,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\>***r*
**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@ -753,7 +767,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\>***r***e***s*
**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -762,7 +776,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**\<***r*
**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@ -771,7 +785,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**\<***r***e***s*
**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -780,7 +794,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\<***r*
**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@ -789,7 +803,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\<***r***e***s*
**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -798,7 +812,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**=***r*
**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@ -807,7 +821,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**=***r***e***s*
**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -816,7 +830,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!=***r*
**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@ -825,7 +839,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!=***r***e***s*
**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -881,12 +895,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
**:***r*
**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
**;***r*
**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -81,12 +81,26 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in dc(1). Most of those users
would want to put this option in **DC_ENV_ARGS**.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Disables the read prompt in TTY mode. (The read prompt is only enabled in
TTY mode. See the **TTY MODE** section.) This is mostly for those users that
do not want a read prompt or are not used to having them in dc(1). Most of
those users would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
lines of dc(1) scripts that prompt for user input.
This option does not disable the regular prompt because the read prompt is
only used when the **?** command is used.
This is a **non-portable extension**.
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@ -432,25 +446,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
**s***r*
**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
**l***r*
**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
**S***r*
**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
**L***r*
**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
now accessible via the **l***r* command.
now accessible via the **l**_r_ command.
## Parameters
@ -563,7 +577,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
**\>***r*
**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@ -575,7 +589,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**>***r***e***s*
**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -584,7 +598,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\>***r*
**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@ -593,7 +607,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\>***r***e***s*
**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -602,7 +616,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**\<***r*
**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@ -611,7 +625,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**\<***r***e***s*
**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -620,7 +634,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\<***r*
**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@ -629,7 +643,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\<***r***e***s*
**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -638,7 +652,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**=***r*
**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@ -647,7 +661,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**=***r***e***s*
**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -656,7 +670,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!=***r*
**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@ -665,7 +679,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!=***r***e***s*
**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -721,12 +735,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
**:***r*
**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
**;***r*
**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -81,12 +81,26 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in dc(1). Most of those users
would want to put this option in **DC_ENV_ARGS**.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Disables the read prompt in TTY mode. (The read prompt is only enabled in
TTY mode. See the **TTY MODE** section.) This is mostly for those users that
do not want a read prompt or are not used to having them in dc(1). Most of
those users would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
lines of dc(1) scripts that prompt for user input.
This option does not disable the regular prompt because the read prompt is
only used when the **?** command is used.
This is a **non-portable extension**.
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@ -432,25 +446,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
**s***r*
**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
**l***r*
**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
**S***r*
**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
**L***r*
**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
now accessible via the **l***r* command.
now accessible via the **l**_r_ command.
## Parameters
@ -563,7 +577,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
**\>***r*
**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@ -575,7 +589,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**>***r***e***s*
**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -584,7 +598,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\>***r*
**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@ -593,7 +607,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\>***r***e***s*
**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -602,7 +616,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**\<***r*
**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@ -611,7 +625,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**\<***r***e***s*
**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -620,7 +634,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\<***r*
**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@ -629,7 +643,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\<***r***e***s*
**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -638,7 +652,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**=***r*
**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@ -647,7 +661,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**=***r***e***s*
**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -656,7 +670,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!=***r*
**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@ -665,7 +679,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!=***r***e***s*
**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -721,12 +735,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
**:***r*
**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
**;***r*
**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -81,12 +81,26 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in dc(1). Most of those users
would want to put this option in **DC_ENV_ARGS**.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Disables the read prompt in TTY mode. (The read prompt is only enabled in
TTY mode. See the **TTY MODE** section.) This is mostly for those users that
do not want a read prompt or are not used to having them in dc(1). Most of
those users would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
lines of dc(1) scripts that prompt for user input.
This option does not disable the regular prompt because the read prompt is
only used when the **?** command is used.
This is a **non-portable extension**.
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@ -432,25 +446,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
**s***r*
**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
**l***r*
**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
**S***r*
**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
**L***r*
**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
now accessible via the **l***r* command.
now accessible via the **l**_r_ command.
## Parameters
@ -563,7 +577,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
**\>***r*
**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@ -575,7 +589,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**>***r***e***s*
**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -584,7 +598,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\>***r*
**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@ -593,7 +607,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\>***r***e***s*
**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -602,7 +616,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**\<***r*
**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@ -611,7 +625,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**\<***r***e***s*
**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -620,7 +634,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\<***r*
**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@ -629,7 +643,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\<***r***e***s*
**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -638,7 +652,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**=***r*
**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@ -647,7 +661,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**=***r***e***s*
**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -656,7 +670,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!=***r*
**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@ -665,7 +679,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!=***r***e***s*
**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -721,12 +735,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
**:***r*
**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
**;***r*
**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -80,6 +80,12 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: This option is a no-op.
This is a **non-portable extension**.
@ -429,25 +435,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
**s***r*
**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
**l***r*
**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
**S***r*
**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
**L***r*
**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
now accessible via the **l***r* command.
now accessible via the **l**_r_ command.
## Parameters
@ -560,7 +566,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
**\>***r*
**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@ -572,7 +578,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**>***r***e***s*
**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -581,7 +587,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\>***r*
**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@ -590,7 +596,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\>***r***e***s*
**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -599,7 +605,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**\<***r*
**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@ -608,7 +614,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**\<***r***e***s*
**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -617,7 +623,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\<***r*
**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@ -626,7 +632,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\<***r***e***s*
**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -635,7 +641,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**=***r*
**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@ -644,7 +650,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**=***r***e***s*
**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -653,7 +659,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!=***r*
**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@ -662,7 +668,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!=***r***e***s*
**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -718,12 +724,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
**:***r*
**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
**;***r*
**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -80,6 +80,12 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: This option is a no-op.
This is a **non-portable extension**.
@ -429,25 +435,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
**s***r*
**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
**l***r*
**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
**S***r*
**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
**L***r*
**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
now accessible via the **l***r* command.
now accessible via the **l**_r_ command.
## Parameters
@ -560,7 +566,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
**\>***r*
**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@ -572,7 +578,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**>***r***e***s*
**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -581,7 +587,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\>***r*
**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@ -590,7 +596,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\>***r***e***s*
**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -599,7 +605,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**\<***r*
**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@ -608,7 +614,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**\<***r***e***s*
**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -617,7 +623,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\<***r*
**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@ -626,7 +632,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\<***r***e***s*
**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -635,7 +641,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**=***r*
**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@ -644,7 +650,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**=***r***e***s*
**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -653,7 +659,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!=***r*
**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@ -662,7 +668,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!=***r***e***s*
**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -718,12 +724,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
**:***r*
**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
**;***r*
**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -81,12 +81,26 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in dc(1). Most of those users
would want to put this option in **DC_ENV_ARGS**.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Disables the read prompt in TTY mode. (The read prompt is only enabled in
TTY mode. See the **TTY MODE** section.) This is mostly for those users that
do not want a read prompt or are not used to having them in dc(1). Most of
those users would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
lines of dc(1) scripts that prompt for user input.
This option does not disable the regular prompt because the read prompt is
only used when the **?** command is used.
This is a **non-portable extension**.
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@ -432,25 +446,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
**s***r*
**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
**l***r*
**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
**S***r*
**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
**L***r*
**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
now accessible via the **l***r* command.
now accessible via the **l**_r_ command.
## Parameters
@ -563,7 +577,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
**\>***r*
**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@ -575,7 +589,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**>***r***e***s*
**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -584,7 +598,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\>***r*
**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@ -593,7 +607,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\>***r***e***s*
**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -602,7 +616,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**\<***r*
**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@ -611,7 +625,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**\<***r***e***s*
**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -620,7 +634,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\<***r*
**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@ -629,7 +643,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\<***r***e***s*
**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -638,7 +652,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**=***r*
**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@ -647,7 +661,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**=***r***e***s*
**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -656,7 +670,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!=***r*
**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@ -665,7 +679,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!=***r***e***s*
**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -721,12 +735,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
**:***r*
**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
**;***r*
**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -80,6 +80,12 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: This option is a no-op.
This is a **non-portable extension**.
@ -429,25 +435,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
**s***r*
**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
**l***r*
**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
**S***r*
**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
**L***r*
**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
now accessible via the **l***r* command.
now accessible via the **l**_r_ command.
## Parameters
@ -560,7 +566,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
**\>***r*
**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@ -572,7 +578,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**>***r***e***s*
**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -581,7 +587,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\>***r*
**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@ -590,7 +596,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\>***r***e***s*
**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -599,7 +605,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**\<***r*
**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@ -608,7 +614,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**\<***r***e***s*
**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -617,7 +623,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\<***r*
**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@ -626,7 +632,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\<***r***e***s*
**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -635,7 +641,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**=***r*
**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@ -644,7 +650,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**=***r***e***s*
**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -653,7 +659,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!=***r*
**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@ -662,7 +668,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!=***r***e***s*
**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -718,12 +724,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
**:***r*
**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
**;***r*
**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -80,6 +80,12 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: This option is a no-op.
This is a **non-portable extension**.
@ -429,25 +435,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
**s***r*
**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
**l***r*
**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
**S***r*
**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
**L***r*
**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
now accessible via the **l***r* command.
now accessible via the **l**_r_ command.
## Parameters
@ -560,7 +566,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
**\>***r*
**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@ -572,7 +578,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**>***r***e***s*
**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -581,7 +587,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\>***r*
**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@ -590,7 +596,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\>***r***e***s*
**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -599,7 +605,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**\<***r*
**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@ -608,7 +614,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**\<***r***e***s*
**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -617,7 +623,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\<***r*
**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@ -626,7 +632,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\<***r***e***s*
**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -635,7 +641,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**=***r*
**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@ -644,7 +650,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**=***r***e***s*
**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -653,7 +659,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!=***r*
**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@ -662,7 +668,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!=***r***e***s*
**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -718,12 +724,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
**:***r*
**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
**;***r*
**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -81,12 +81,26 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in dc(1). Most of those users
would want to put this option in **DC_ENV_ARGS**.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Disables the read prompt in TTY mode. (The read prompt is only enabled in
TTY mode. See the **TTY MODE** section.) This is mostly for those users that
do not want a read prompt or are not used to having them in dc(1). Most of
those users would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
lines of dc(1) scripts that prompt for user input.
This option does not disable the regular prompt because the read prompt is
only used when the **?** command is used.
This is a **non-portable extension**.
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@ -556,25 +570,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
**s***r*
**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
**l***r*
**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
**S***r*
**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
**L***r*
**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
now accessible via the **l***r* command.
now accessible via the **l**_r_ command.
## Parameters
@ -723,7 +737,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
**\>***r*
**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@ -735,7 +749,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**>***r***e***s*
**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -744,7 +758,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\>***r*
**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@ -753,7 +767,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\>***r***e***s*
**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -762,7 +776,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**\<***r*
**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@ -771,7 +785,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**\<***r***e***s*
**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -780,7 +794,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\<***r*
**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@ -789,7 +803,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\<***r***e***s*
**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -798,7 +812,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**=***r*
**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@ -807,7 +821,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**=***r***e***s*
**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -816,7 +830,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!=***r*
**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@ -825,7 +839,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!=***r***e***s*
**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -881,12 +895,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
**:***r*
**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
**;***r*
**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -81,12 +81,26 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in dc(1). Most of those users
would want to put this option in **DC_ENV_ARGS**.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Disables the read prompt in TTY mode. (The read prompt is only enabled in
TTY mode. See the **TTY MODE** section.) This is mostly for those users that
do not want a read prompt or are not used to having them in dc(1). Most of
those users would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
lines of dc(1) scripts that prompt for user input.
This option does not disable the regular prompt because the read prompt is
only used when the **?** command is used.
This is a **non-portable extension**.
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@ -556,25 +570,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
**s***r*
**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
**l***r*
**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
**S***r*
**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
**L***r*
**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
now accessible via the **l***r* command.
now accessible via the **l**_r_ command.
## Parameters
@ -723,7 +737,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
**\>***r*
**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@ -735,7 +749,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**>***r***e***s*
**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -744,7 +758,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\>***r*
**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@ -753,7 +767,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\>***r***e***s*
**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -762,7 +776,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**\<***r*
**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@ -771,7 +785,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**\<***r***e***s*
**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -780,7 +794,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\<***r*
**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@ -789,7 +803,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\<***r***e***s*
**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -798,7 +812,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**=***r*
**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@ -807,7 +821,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**=***r***e***s*
**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -816,7 +830,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!=***r*
**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@ -825,7 +839,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!=***r***e***s*
**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -881,12 +895,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
**:***r*
**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
**;***r*
**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -80,6 +80,12 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: This option is a no-op.
This is a **non-portable extension**.
@ -553,25 +559,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
**s***r*
**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
**l***r*
**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
**S***r*
**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
**L***r*
**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
now accessible via the **l***r* command.
now accessible via the **l**_r_ command.
## Parameters
@ -720,7 +726,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
**\>***r*
**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@ -732,7 +738,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**>***r***e***s*
**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -741,7 +747,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\>***r*
**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@ -750,7 +756,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\>***r***e***s*
**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -759,7 +765,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**\<***r*
**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@ -768,7 +774,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**\<***r***e***s*
**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -777,7 +783,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\<***r*
**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@ -786,7 +792,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\<***r***e***s*
**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -795,7 +801,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**=***r*
**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@ -804,7 +810,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**=***r***e***s*
**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -813,7 +819,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!=***r*
**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@ -822,7 +828,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!=***r***e***s*
**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -878,12 +884,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
**:***r*
**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
**;***r*
**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -80,6 +80,12 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: This option is a no-op.
This is a **non-portable extension**.
@ -553,25 +559,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
**s***r*
**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
**l***r*
**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
**S***r*
**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
**L***r*
**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
now accessible via the **l***r* command.
now accessible via the **l**_r_ command.
## Parameters
@ -720,7 +726,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
**\>***r*
**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@ -732,7 +738,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**>***r***e***s*
**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -741,7 +747,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\>***r*
**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@ -750,7 +756,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\>***r***e***s*
**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -759,7 +765,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**\<***r*
**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@ -768,7 +774,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**\<***r***e***s*
**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -777,7 +783,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\<***r*
**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@ -786,7 +792,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\<***r***e***s*
**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -795,7 +801,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**=***r*
**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@ -804,7 +810,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**=***r***e***s*
**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -813,7 +819,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!=***r*
**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@ -822,7 +828,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!=***r***e***s*
**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -878,12 +884,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
**:***r*
**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
**;***r*
**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -81,12 +81,26 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
See the **TTY MODE** section) This is mostly for those users that do not
See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in dc(1). Most of those users
would want to put this option in **DC_ENV_ARGS**.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: Disables the read prompt in TTY mode. (The read prompt is only enabled in
TTY mode. See the **TTY MODE** section.) This is mostly for those users that
do not want a read prompt or are not used to having them in dc(1). Most of
those users would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
lines of dc(1) scripts that prompt for user input.
This option does not disable the regular prompt because the read prompt is
only used when the **?** command is used.
This is a **non-portable extension**.
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@ -556,25 +570,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
**s***r*
**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
**l***r*
**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
**S***r*
**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
**L***r*
**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
now accessible via the **l***r* command.
now accessible via the **l**_r_ command.
## Parameters
@ -723,7 +737,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
**\>***r*
**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@ -735,7 +749,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**>***r***e***s*
**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -744,7 +758,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\>***r*
**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@ -753,7 +767,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\>***r***e***s*
**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -762,7 +776,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**\<***r*
**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@ -771,7 +785,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**\<***r***e***s*
**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -780,7 +794,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\<***r*
**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@ -789,7 +803,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\<***r***e***s*
**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -798,7 +812,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**=***r*
**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@ -807,7 +821,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**=***r***e***s*
**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -816,7 +830,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!=***r*
**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@ -825,7 +839,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!=***r***e***s*
**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -881,12 +895,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
**:***r*
**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
**;***r*
**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -80,6 +80,12 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: This option is a no-op.
This is a **non-portable extension**.
@ -553,25 +559,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
**s***r*
**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
**l***r*
**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
**S***r*
**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
**L***r*
**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
now accessible via the **l***r* command.
now accessible via the **l**_r_ command.
## Parameters
@ -720,7 +726,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
**\>***r*
**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@ -732,7 +738,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**>***r***e***s*
**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -741,7 +747,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\>***r*
**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@ -750,7 +756,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\>***r***e***s*
**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -759,7 +765,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**\<***r*
**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@ -768,7 +774,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**\<***r***e***s*
**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -777,7 +783,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\<***r*
**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@ -786,7 +792,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\<***r***e***s*
**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -795,7 +801,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**=***r*
**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@ -804,7 +810,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**=***r***e***s*
**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -813,7 +819,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!=***r*
**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@ -822,7 +828,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!=***r***e***s*
**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -878,12 +884,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
**:***r*
**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
**;***r*
**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@ -80,6 +80,12 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: This option is a no-op.
This is a **non-portable extension**.
**-R**, **-\-no-read-prompt**
: This option is a no-op.
This is a **non-portable extension**.
@ -553,25 +559,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
**s***r*
**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
**l***r*
**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
**S***r*
**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
**L***r*
**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
now accessible via the **l***r* command.
now accessible via the **l**_r_ command.
## Parameters
@ -720,7 +726,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
**\>***r*
**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@ -732,7 +738,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**>***r***e***s*
**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -741,7 +747,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\>***r*
**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@ -750,7 +756,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\>***r***e***s*
**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -759,7 +765,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**\<***r*
**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@ -768,7 +774,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**\<***r***e***s*
**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -777,7 +783,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!\<***r*
**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@ -786,7 +792,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!\<***r***e***s*
**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -795,7 +801,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**=***r*
**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@ -804,7 +810,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**=***r***e***s*
**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -813,7 +819,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
**!=***r*
**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@ -822,7 +828,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
**!=***r***e***s*
**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@ -878,12 +884,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
**:***r*
**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
**;***r*
**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.

View File

@ -1 +1 @@
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.TH "BC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"

View File

@ -1 +1 @@
.TH "BCL" "3" "March 2021" "Gavin D. Howard" "Libraries Manual"
.TH "BCL" "3" "April 2021" "Gavin D. Howard" "Libraries Manual"

View File

@ -1 +1 @@
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
.TH "DC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"

View File

@ -30,6 +30,7 @@
usage() {
printf 'usage: %s [run_tests] [generate_tests] [test_with_clang] [test_with_gcc] \n' "$script"
printf ' [run_sanitizers] [run_valgrind] [run_64_bit] [run_gen_script]\n'
printf ' [test_c11] [test_128_bit]\n'
exit 1
}
@ -216,8 +217,10 @@ runconfigseries() {
if [ "$run_64_bit" -ne 0 ]; then
runconfigtests "$_runconfigseries_CFLAGS" "$_runconfigseries_CC" \
"$_runconfigseries_configure_flags" 1 64 "$_runconfigseries_run_tests"
if [ "$test_128_bit" -ne 0 ]; then
runconfigtests "$_runconfigseries_CFLAGS" "$_runconfigseries_CC" \
"$_runconfigseries_configure_flags" 1 64 "$_runconfigseries_run_tests"
fi
if [ "$run_gen_script" -ne 0 ]; then
runconfigtests "$_runconfigseries_CFLAGS" "$_runconfigseries_CC" \
@ -307,7 +310,10 @@ runtests() {
shift
runtestseries "-std=c99 $_runtests_CFLAGS" "$_runtests_CC" "$_runtests_configure_flags" "$_runtests_run_tests"
runtestseries "-std=c11 $_runtests_CFLAGS" "$_runtests_CC" "$_runtests_configure_flags" "$_runtests_run_tests"
if [ "$test_c11" -ne 0 ]; then
runtestseries "-std=c11 $_runtests_CFLAGS" "$_runtests_CC" "$_runtests_configure_flags" "$_runtests_run_tests"
fi
}
karatsuba() {
@ -498,6 +504,20 @@ else
run_gen_script=0
fi
if [ "$#" -gt 0 ]; then
test_c11="$1"
shift
else
test_c11=0
fi
if [ "$#" -gt 0 ]; then
test_128_bit="$1"
shift
else
test_128_bit=0
fi
if [ "$run_64_bit" -ne 0 ]; then
bits=64
else
@ -523,8 +543,6 @@ header "Running math library under --standard"
printf 'quit\n' | bin/bc -ls
version=$(make version)
do_make clean_tests
if [ "$test_with_clang" -ne 0 ]; then
@ -573,8 +591,9 @@ if [ "$run_tests" -ne 0 ]; then
printf '\n'
printf 'Then run the GitHub release script as follows:\n'
printf '\n'
printf ' <github_release> %s release.sh RELEASE.md\\\n' "$version"
printf ' tests/afl.py tests/radamsa.sh tests/radamsa.txt tests/randmath.py \\\n'
printf ' <github_release> <version> .gitignore .gitattributes\\\n'
printf ' manpage.sh release.sh RELEASE.md tests/afl.py\\\n'
printf ' tests/radamsa.sh tests/radamsa.txt tests/randmath.py\\\n'
printf ' tests/fuzzing/ tests/bc/scripts/timeconst.bc\n'
fi

View File

@ -39,7 +39,9 @@
#include <stdlib.h>
#include <string.h>
#ifndef _WIN32
#include <unistd.h>
#endif // _WIN32
#include <vector.h>
#include <read.h>
@ -53,6 +55,7 @@ static const BcOptLong bc_args_lopt[] = {
{ "help", BC_OPT_NONE, 'h' },
{ "interactive", BC_OPT_NONE, 'i' },
{ "no-prompt", BC_OPT_NONE, 'P' },
{ "no-read-prompt", BC_OPT_NONE, 'R' },
#if BC_ENABLED
{ "global-stacks", BC_OPT_BC_ONLY, 'g' },
{ "mathlib", BC_OPT_BC_ONLY, 'l' },
@ -144,6 +147,12 @@ void bc_args(int argc, char *argv[], bool exit_exprs) {
break;
}
case 'R':
{
vm.flags |= BC_FLAG_R;
break;
}
#if BC_ENABLED
case 'g':
{

View File

@ -172,6 +172,12 @@ const char* const bc_err_msgs[] = {
};
#if BC_ENABLE_HISTORY
const BcFlushType bc_flush_none = BC_FLUSH_NO_EXTRAS_NO_CLEAR;
const BcFlushType bc_flush_err = BC_FLUSH_NO_EXTRAS_CLEAR;
const BcFlushType bc_flush_save = BC_FLUSH_SAVE_EXTRAS_CLEAR;
#endif // BC_ENABLE_HISTORY
#if BC_ENABLE_HISTORY
const char *bc_history_bad_terms[] = { "dumb", "cons25", "emacs", NULL };

View File

@ -36,7 +36,10 @@
#include <assert.h>
#include <errno.h>
#include <string.h>
#ifndef _WIN32
#include <unistd.h>
#endif // _WIN32
#include <file.h>
#include <vm.h>
@ -82,11 +85,32 @@ static BcStatus bc_file_output(int fd, const char *buf, size_t n) {
return BC_STATUS_SUCCESS;
}
BcStatus bc_file_flushErr(BcFile *restrict f) {
BcStatus bc_file_flushErr(BcFile *restrict f, BcFlushType type)
{
BcStatus s;
if (f->len) {
#if BC_ENABLE_HISTORY
if (BC_TTY) {
if (f->buf[f->len - 1] != '\n' &&
(type == BC_FLUSH_SAVE_EXTRAS_CLEAR ||
type == BC_FLUSH_SAVE_EXTRAS_NO_CLEAR))
{
size_t i;
for (i = f->len - 2; i < f->len && f->buf[i] != '\n'; --i);
i += 1;
bc_vec_string(&vm.history.extras, f->len - i, f->buf + i);
}
else if (type >= BC_FLUSH_NO_EXTRAS_CLEAR) {
bc_vec_popAll(&vm.history.extras);
}
}
#endif // BC_ENABLE_HISTORY
s = bc_file_output(f->fd, f->buf, f->len);
f->len = 0;
}
@ -95,9 +119,9 @@ BcStatus bc_file_flushErr(BcFile *restrict f) {
return s;
}
void bc_file_flush(BcFile *restrict f) {
void bc_file_flush(BcFile *restrict f, BcFlushType type) {
BcStatus s = bc_file_flushErr(f);
BcStatus s = bc_file_flushErr(f, type);
if (BC_ERR(s)) {
@ -109,10 +133,11 @@ void bc_file_flush(BcFile *restrict f) {
}
}
void bc_file_write(BcFile *restrict f, const char *buf, size_t n) {
void bc_file_write(BcFile *restrict f, BcFlushType type,
const char *buf, size_t n)
{
if (n > f->cap - f->len) {
bc_file_flush(f);
bc_file_flush(f, type);
assert(!f->len);
}
@ -123,8 +148,8 @@ void bc_file_write(BcFile *restrict f, const char *buf, size_t n) {
}
}
void bc_file_printf(BcFile *restrict f, const char *fmt, ...) {
void bc_file_printf(BcFile *restrict f, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
@ -144,7 +169,7 @@ void bc_file_vprintf(BcFile *restrict f, const char *fmt, va_list args) {
if (percent != ptr) {
size_t len = (size_t) (percent - ptr);
bc_file_write(f, ptr, len);
bc_file_write(f, bc_flush_none, ptr, len);
}
c = percent[1];
@ -153,13 +178,13 @@ void bc_file_vprintf(BcFile *restrict f, const char *fmt, va_list args) {
uchar uc = (uchar) va_arg(args, int);
bc_file_putchar(f, uc);
bc_file_putchar(f, bc_flush_none, uc);
}
else if (c == 's') {
char *s = va_arg(args, char*);
bc_file_puts(f, s);
bc_file_puts(f, bc_flush_none, s);
}
#if BC_DEBUG_CODE
else if (c == 'd') {
@ -167,14 +192,14 @@ void bc_file_vprintf(BcFile *restrict f, const char *fmt, va_list args) {
int d = va_arg(args, int);
if (d < 0) {
bc_file_putchar(f, '-');
bc_file_putchar(f, bc_flush_none, '-');
d = -d;
}
if (!d) bc_file_putchar(f, '0');
if (!d) bc_file_putchar(f, bc_flush_none, '0');
else {
bc_file_ultoa((unsigned long long) d, buf);
bc_file_puts(f, buf);
bc_file_puts(f, bc_flush_none, buf);
}
}
#endif // BC_DEBUG_CODE
@ -187,25 +212,25 @@ void bc_file_vprintf(BcFile *restrict f, const char *fmt, va_list args) {
if (c == 'z') ull = (unsigned long long) va_arg(args, size_t);
else ull = (unsigned long long) va_arg(args, unsigned long);
if (!ull) bc_file_putchar(f, '0');
if (!ull) bc_file_putchar(f, bc_flush_none, '0');
else {
bc_file_ultoa(ull, buf);
bc_file_puts(f, buf);
bc_file_puts(f, bc_flush_none, buf);
}
}
ptr = percent + 2 + (c == 'l' || c == 'z');
}
if (ptr[0]) bc_file_puts(f, ptr);
if (ptr[0]) bc_file_puts(f, bc_flush_none, ptr);
}
void bc_file_puts(BcFile *restrict f, const char *str) {
bc_file_write(f, str, strlen(str));
void bc_file_puts(BcFile *restrict f, BcFlushType type, const char *str) {
bc_file_write(f, type, str, strlen(str));
}
void bc_file_putchar(BcFile *restrict f, uchar c) {
if (f->len == f->cap) bc_file_flush(f);
void bc_file_putchar(BcFile *restrict f, BcFlushType type, uchar c) {
if (f->len == f->cap) bc_file_flush(f, type);
assert(f->len < f->cap);
f->buf[f->len] = (char) c;
f->len += 1;
@ -221,5 +246,5 @@ void bc_file_init(BcFile *f, int fd, char *buf, size_t cap) {
void bc_file_free(BcFile *f) {
BC_SIG_ASSERT_LOCKED;
bc_file_flush(f);
bc_file_flush(f, bc_flush_none);
}

View File

@ -505,8 +505,8 @@ static size_t bc_history_cursorPos(void) {
size_t cols, rows, i;
// Report cursor location.
bc_file_write(&vm.fout, "\x1b[6n", 4);
bc_file_flush(&vm.fout);
bc_file_write(&vm.fout, bc_flush_none, "\x1b[6n", 4);
bc_file_flush(&vm.fout, bc_flush_none);
// Read the response: ESC [ rows ; cols R.
for (i = 0; i < sizeof(buf) - 1; ++i) {
@ -556,15 +556,15 @@ static size_t bc_history_columns(void) {
if (BC_ERR(start == SIZE_MAX)) return BC_HIST_DEF_COLS;
// Go to right margin and get position.
bc_file_write(&vm.fout, "\x1b[999C", 6);
bc_file_flush(&vm.fout);
bc_file_write(&vm.fout, bc_flush_none, "\x1b[999C", 6);
bc_file_flush(&vm.fout, bc_flush_none);
cols = bc_history_cursorPos();
if (BC_ERR(cols == SIZE_MAX)) return BC_HIST_DEF_COLS;
// Restore position.
if (cols > start) {
bc_file_printf(&vm.fout, "\x1b[%zuD", cols - start);
bc_file_flush(&vm.fout);
bc_file_flush(&vm.fout, bc_flush_none);
}
return cols;
@ -632,7 +632,7 @@ static void bc_history_refresh(BcHistory *h) {
char* buf = h->buf.v;
size_t colpos, len = BC_HIST_BUF_LEN(h), pos = h->pos;
bc_file_flush(&vm.fout);
bc_file_flush(&vm.fout, bc_flush_none);
while(h->pcol + bc_history_colPos(buf, len, pos) >= h->cols) {
@ -647,24 +647,32 @@ static void bc_history_refresh(BcHistory *h) {
len -= bc_history_prevLen(buf, len, NULL);
// Cursor to left edge.
bc_file_write(&vm.fout, "\r", 1);
bc_file_write(&vm.fout, bc_flush_none, "\r", 1);
// Take the extra stuff into account.
if (h->extras.len > 1) {
len += h->extras.len - 1;
pos += h->extras.len - 1;
bc_file_write(&vm.fout, bc_flush_none, h->extras.v, h->extras.len - 1);
}
// Write the prompt, if desired.
#if BC_ENABLE_PROMPT
if (BC_USE_PROMPT) bc_file_write(&vm.fout, h->prompt, h->plen);
if (BC_USE_PROMPT)
bc_file_write(&vm.fout, bc_flush_none, h->prompt, h->plen);
#endif // BC_ENABLE_PROMPT
bc_file_write(&vm.fout, buf, BC_HIST_BUF_LEN(h));
bc_file_write(&vm.fout, bc_flush_none, buf, BC_HIST_BUF_LEN(h));
// Erase to right.
bc_file_write(&vm.fout, "\x1b[0K", 4);
bc_file_write(&vm.fout, bc_flush_none, "\x1b[0K", 4);
// Move cursor to original position.
colpos = bc_history_colPos(buf, len, pos) + h->pcol;
if (colpos) bc_file_printf(&vm.fout, "\r\x1b[%zuC", colpos);
bc_file_flush(&vm.fout);
bc_file_flush(&vm.fout, bc_flush_none);
}
/**
@ -684,7 +692,7 @@ static void bc_history_edit_insert(BcHistory *h, const char *cbuf, size_t clen)
h->buf.len += clen - 1;
bc_vec_pushByte(&h->buf, '\0');
len = BC_HIST_BUF_LEN(h);
len = BC_HIST_BUF_LEN(h) + h->extras.len - 1;
#if BC_ENABLE_PROMPT
colpos = bc_history_promptColLen(h->prompt, h->plen);
#endif // BC_ENABLE_PROMPT
@ -693,8 +701,8 @@ static void bc_history_edit_insert(BcHistory *h, const char *cbuf, size_t clen)
if (colpos < h->cols) {
// Avoid a full update of the line in the trivial case.
bc_file_write(&vm.fout, cbuf, clen);
bc_file_flush(&vm.fout);
bc_file_write(&vm.fout, bc_flush_none, cbuf, clen);
bc_file_flush(&vm.fout, bc_flush_none);
}
else bc_history_refresh(h);
}
@ -1102,7 +1110,7 @@ static void bc_history_printCtrl(BcHistory *h, unsigned int c) {
bc_vec_pushByte(&h->buf, '\0');
if (c != BC_ACTION_CTRL_C && c != BC_ACTION_CTRL_D) {
bc_file_write(&vm.fout, newline, sizeof(newline) - 1);
bc_file_write(&vm.fout, bc_flush_none, newline, sizeof(newline) - 1);
bc_history_refresh(h);
}
}
@ -1116,6 +1124,11 @@ static BcStatus bc_history_edit(BcHistory *h, const char *prompt) {
bc_history_reset(h);
// Don't write the saved output the first time. This is because it has
// already been written to output. In other words, don't uncomment the
// line below or add anything like it.
// bc_file_write(&vm.fout, bc_flush_none, h->extras.v, h->extras.len - 1);
#if BC_ENABLE_PROMPT
if (BC_USE_PROMPT) {
@ -1123,8 +1136,8 @@ static BcStatus bc_history_edit(BcHistory *h, const char *prompt) {
h->plen = strlen(prompt);
h->pcol = bc_history_promptColLen(prompt, h->plen);
bc_file_write(&vm.fout, prompt, h->plen);
bc_file_flush(&vm.fout);
bc_file_write(&vm.fout, bc_flush_none, prompt, h->plen);
bc_file_flush(&vm.fout, bc_flush_none);
}
#endif // BC_ENABLE_PROMPT
@ -1158,8 +1171,8 @@ static BcStatus bc_history_edit(BcHistory *h, const char *prompt) {
case BC_ACTION_CTRL_C:
{
bc_history_printCtrl(h, c);
bc_file_write(&vm.fout, vm.sigmsg, vm.siglen);
bc_file_write(&vm.fout, bc_program_ready_msg,
bc_file_write(&vm.fout, bc_flush_none, vm.sigmsg, vm.siglen);
bc_file_write(&vm.fout, bc_flush_none, bc_program_ready_msg,
bc_program_ready_msg_len);
bc_history_reset(h);
bc_history_refresh(h);
@ -1254,7 +1267,7 @@ static BcStatus bc_history_edit(BcHistory *h, const char *prompt) {
// Clear screen.
case BC_ACTION_CTRL_L:
{
bc_file_write(&vm.fout, "\x1b[H\x1b[2J", 7);
bc_file_write(&vm.fout, bc_flush_none, "\x1b[H\x1b[2J", 7);
bc_history_refresh(h);
break;
}
@ -1302,8 +1315,8 @@ static BcStatus bc_history_raw(BcHistory *h, const char *prompt) {
h->stdin_has_data = bc_history_stdinHasData(h);
if (!h->stdin_has_data) bc_history_disableRaw(h);
bc_file_write(&vm.fout, "\n", 1);
bc_file_flush(&vm.fout);
bc_file_write(&vm.fout, bc_flush_none, "\n", 1);
bc_file_flush(&vm.fout, bc_flush_none);
return s;
}
@ -1382,6 +1395,7 @@ void bc_history_init(BcHistory *h) {
bc_vec_init(&h->buf, sizeof(char), NULL);
bc_vec_init(&h->history, sizeof(char*), bc_history_string_free);
bc_vec_init(&h->extras, sizeof(char), NULL);
FD_ZERO(&h->rdset);
FD_SET(STDIN_FILENO, &h->rdset);
@ -1401,6 +1415,7 @@ void bc_history_free(BcHistory *h) {
#ifndef NDEBUG
bc_vec_free(&h->buf);
bc_vec_free(&h->history);
bc_vec_free(&h->extras);
#endif // NDEBUG
}
@ -1439,8 +1454,8 @@ void bc_history_printKeyCodes(BcHistory *h) {
isprint(c) ? c : '?', (unsigned long) c);
// Go left edge manually, we are in raw mode.
bc_vm_putchar('\r');
bc_file_flush(&vm.fout);
bc_vm_putchar('\r', bc_flush_none);
bc_file_flush(&vm.fout, bc_flush_none);
}
bc_history_disableRaw(h);

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