vendor/bc: import version 6.3.1

This version adds a command to dc to query whether extended registers
are enabled or not.

(cherry picked from commit 61e1a12bb6c3bfdb0a4e499c88e8eaa2b548e427)
This commit is contained in:
Stefan Eßer 2023-02-24 23:14:58 +01:00
parent eb81dd8404
commit 103d7cdfb7
77 changed files with 442 additions and 294 deletions

View File

@ -51,3 +51,8 @@ existed in.
had properly hooked Valgrind into my `bcl` tests, but I had not. had properly hooked Valgrind into my `bcl` tests, but I had not.
The first version without this bug is `6.0.1`. The first version without this bug is `6.0.1`.
* In version `6.0.0` until `6.2.4` (inclusive) of `bcl`, there is a possible
use-after-free if `bcl_init()` fails.
The first version without this bug is `6.2.5`.

View File

@ -239,25 +239,25 @@ $(GEN_EXEC): $(GEN_DIR)
%%GEN_EXEC_TARGET%% %%GEN_EXEC_TARGET%%
$(BC_LIB_C): $(GEN_EXEC) $(BC_LIB) $(BC_LIB_C): $(GEN_EXEC) $(BC_LIB)
$(GEN_EMU) $(GEN_EXEC) $(BC_LIB) $(BC_LIB_C) $(BC_EXCLUDE_EXTRA_MATH) $(BC_LIB_C_ARGS) $(GEN_EMU) $(GEN_EXEC) $(BC_LIB) $(BC_LIB_C) $(BC_EXCLUDE_EXTRA_MATH) $(BC_LIB_C_ARGS) "" "" 1
$(BC_LIB_O): $(BC_LIB_C) $(BC_LIB_O): $(BC_LIB_C)
$(CC) $(CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) -o $@ -c $<
$(BC_LIB2_C): $(GEN_EXEC) $(BC_LIB2) $(BC_LIB2_C): $(GEN_EXEC) $(BC_LIB2)
$(GEN_EMU) $(GEN_EXEC) $(BC_LIB2) $(BC_LIB2_C) $(BC_EXCLUDE_EXTRA_MATH) $(BC_LIB2_C_ARGS) $(GEN_EMU) $(GEN_EXEC) $(BC_LIB2) $(BC_LIB2_C) $(BC_EXCLUDE_EXTRA_MATH) $(BC_LIB2_C_ARGS) "" "" 1
$(BC_LIB2_O): $(BC_LIB2_C) $(BC_LIB2_O): $(BC_LIB2_C)
$(CC) $(CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) -o $@ -c $<
$(BC_HELP_C): $(GEN_EXEC) $(BC_HELP) $(BC_HELP_C): $(GEN_EXEC) $(BC_HELP)
$(GEN_EMU) $(GEN_EXEC) $(BC_HELP) $(BC_HELP_C) $(BC_EXCLUDE_EXTRA_MATH) bc_help "" $(BC_ENABLED_NAME) $(GEN_EMU) $(GEN_EXEC) $(BC_HELP) $(BC_HELP_C) $(BC_EXCLUDE_EXTRA_MATH) bc_help "" $(BC_ENABLED_NAME) 0
$(BC_HELP_O): $(BC_HELP_C) $(BC_HELP_O): $(BC_HELP_C)
$(CC) $(CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) -o $@ -c $<
$(DC_HELP_C): $(GEN_EXEC) $(DC_HELP) $(DC_HELP_C): $(GEN_EXEC) $(DC_HELP)
$(GEN_EMU) $(GEN_EXEC) $(DC_HELP) $(DC_HELP_C) $(BC_EXCLUDE_EXTRA_MATH) dc_help "" $(DC_ENABLED_NAME) $(GEN_EMU) $(GEN_EXEC) $(DC_HELP) $(DC_HELP_C) $(BC_EXCLUDE_EXTRA_MATH) dc_help "" $(DC_ENABLED_NAME) 0
$(DC_HELP_O): $(DC_HELP_C) $(DC_HELP_O): $(DC_HELP_C)
$(CC) $(CFLAGS) -o $@ -c $< $(CC) $(CFLAGS) -o $@ -c $<
@ -536,6 +536,7 @@ clean:%%CLEAN_PREREQS%%
@$(RM) -f $(BC_HELP_C) $(BC_HELP_O) @$(RM) -f $(BC_HELP_C) $(BC_HELP_O)
@$(RM) -f $(DC_HELP_C) $(DC_HELP_O) @$(RM) -f $(DC_HELP_C) $(DC_HELP_O)
@$(RM) -fr vs/bin/ vs/lib/ @$(RM) -fr vs/bin/ vs/lib/
@$(RM) -f $(BCL_PC)
clean_benchmarks: clean_benchmarks:
@printf 'Cleaning benchmarks...\n' @printf 'Cleaning benchmarks...\n'
@ -548,6 +549,7 @@ clean_config: clean clean_benchmarks
@$(RM) -f Makefile @$(RM) -f Makefile
@$(RM) -f $(BC_MD) $(BC_MANPAGE) @$(RM) -f $(BC_MD) $(BC_MANPAGE)
@$(RM) -f $(DC_MD) $(DC_MANPAGE) @$(RM) -f $(DC_MD) $(DC_MANPAGE)
@$(RM) -f compile_commands.json
clean_coverage: clean_coverage:
@printf 'Cleaning coverage files...\n' @printf 'Cleaning coverage files...\n'

View File

@ -1,5 +1,30 @@
# News # News
## 6.3.1
This is a production release that fixes a `bc` dependency loop for minimal
environments and Linux from Scratch.
## 6.3.0
This is a production release with a couple of fixes for manuals and a new
feature for `dc`: there is now a command to query whether extended registers are
enabled or not.
Users who don't care do not need to upgrade.
## 6.2.6
This is a production release that fixes an install bug that affected locale
installation of all locales when using `mksh`. Users do ***NOT*** need to
upgrade if they don't use `mksh` and/or don't need to install all locales.
## 6.2.5
This is a production release that fixes a test bug that affected Android and
`mksh`. Users do ***NOT*** need to upgrade unless they use `mksh` or another
affected shell and need to run the test suite.
## 6.2.4 ## 6.2.4
This is a production release that fixes a test failure that happens when This is a production release that fixes a test failure that happens when

View File

@ -36,7 +36,7 @@
define p(x,y){ define p(x,y){
auto a auto a
a=y$ a=y$
if(y==a)return (x^a)@scale if(y==a)return(x^a)@scale
return e(y*l(x)) return e(y*l(x))
} }
define r(x,p){ define r(x,p){
@ -474,7 +474,7 @@ define bxor(a,b){
return bunrev(t) return bunrev(t)
} }
define bshl(a,b){return abs(a)$*2^abs(b)$} define bshl(a,b){return abs(a)$*2^abs(b)$}
define bshr(a,b){return (abs(a)$/2^abs(b)$)$} define bshr(a,b){return(abs(a)$/2^abs(b)$)$}
define bnotn(x,n){ define bnotn(x,n){
auto s,t,m[] auto s,t,m[]
s=scale s=scale

View File

@ -157,11 +157,11 @@ bc_read_file(const char* path)
assert(path != NULL); assert(path != NULL);
#ifndef NDEBUG #if BC_DEBUG
// Need this to quiet MSan. // Need this to quiet MSan.
// NOLINTNEXTLINE // NOLINTNEXTLINE
memset(&pstat, 0, sizeof(struct stat)); memset(&pstat, 0, sizeof(struct stat));
#endif // NDEBUG #endif // BC_DEBUG
fd = bc_read_open(path, O_RDONLY); fd = bc_read_open(path, O_RDONLY);
@ -360,7 +360,7 @@ main(int argc, char* argv[])
has_define = (argc > 6 && strcmp("", argv[6]) != 0); has_define = (argc > 6 && strcmp("", argv[6]) != 0);
define = has_define ? argv[6] : ""; define = has_define ? argv[6] : "";
remove_tabs = (argc > 7); remove_tabs = (argc > 7 && atoi(argv[7]) != 0);
in = bc_read_file(argv[1]); in = bc_read_file(argv[1]);
if (in == NULL) return INVALID_INPUT_FILE; if (in == NULL) return INVALID_INPUT_FILE;

View File

@ -62,7 +62,9 @@ name="$4"
label="$5" label="$5"
define="$6" define="$6"
remove_tabs="$7" remove_tabs="$7"
check_bool_arg "$remove_tabs" if [ "$remove_tabs" != "" ]; then
check_bool_arg "$remove_tabs"
fi
tmpinput=$(mktemp -t "${input##*/}_XXXXXX") tmpinput=$(mktemp -t "${input##*/}_XXXXXX")

View File

@ -41,6 +41,12 @@
#include <limits.h> #include <limits.h>
#include <stdint.h> #include <stdint.h>
#ifndef NDEBUG
#define BC_DEBUG (1)
#else // NDEBUG
#define BC_DEBUG (0)
#endif // NDEBUG
#ifdef _WIN32 #ifdef _WIN32
#include <Windows.h> #include <Windows.h>
#include <BaseTsd.h> #include <BaseTsd.h>

View File

@ -277,6 +277,9 @@ typedef enum BcInst
#if DC_ENABLED #if DC_ENABLED
/// dc extended registers command.
BC_INST_EXTENDED_REGISTERS,
/// dc's return; it pops an executing string off of the stack. /// dc's return; it pops an executing string off of the stack.
BC_INST_POP_EXEC, BC_INST_POP_EXEC,
@ -575,7 +578,7 @@ bc_func_insert(BcFunc* f, struct BcProgram* p, char* name, BcType type,
void void
bc_func_reset(BcFunc* f); bc_func_reset(BcFunc* f);
#ifndef NDEBUG #if BC_DEBUG
/** /**
* Frees a function. This is a destructor. This is only used in debug builds * Frees a function. This is a destructor. This is only used in debug builds
* because all functions are freed at exit. We free them in debug builds to * because all functions are freed at exit. We free them in debug builds to
@ -584,7 +587,7 @@ bc_func_reset(BcFunc* f);
*/ */
void void
bc_func_free(void* func); bc_func_free(void* func);
#endif // NDEBUG #endif // BC_DEBUG
/** /**
* Initializes an array, which is the array type in bc and dc source code. Since * Initializes an array, which is the array type in bc and dc source code. Since

View File

@ -49,11 +49,11 @@
* @param l The lexer. * @param l The lexer.
* @param e The error. * @param e The error.
*/ */
#ifndef NDEBUG #if BC_DEBUG
#define bc_lex_err(l, e) (bc_vm_handleError((e), __FILE__, __LINE__, (l)->line)) #define bc_lex_err(l, e) (bc_vm_handleError((e), __FILE__, __LINE__, (l)->line))
#else // NDEBUG #else // BC_DEBUG
#define bc_lex_err(l, e) (bc_vm_handleError((e), (l)->line)) #define bc_lex_err(l, e) (bc_vm_handleError((e), (l)->line))
#endif // NDEBUG #endif // BC_DEBUG
/** /**
* A convenience macro for throwing errors in lex code. This takes care of * A convenience macro for throwing errors in lex code. This takes care of
@ -61,12 +61,12 @@
* @param l The lexer. * @param l The lexer.
* @param e The error. * @param e The error.
*/ */
#ifndef NDEBUG #if BC_DEBUG
#define bc_lex_verr(l, e, ...) \ #define bc_lex_verr(l, e, ...) \
(bc_vm_handleError((e), __FILE__, __LINE__, (l)->line, __VA_ARGS__)) (bc_vm_handleError((e), __FILE__, __LINE__, (l)->line, __VA_ARGS__))
#else // NDEBUG #else // BC_DEBUG
#define bc_lex_verr(l, e, ...) (bc_vm_handleError((e), (l)->line, __VA_ARGS__)) #define bc_lex_verr(l, e, ...) (bc_vm_handleError((e), (l)->line, __VA_ARGS__))
#endif // NDEBUG #endif // BC_DEBUG
// BC_LEX_NEG_CHAR returns the char that corresponds to negative for the // BC_LEX_NEG_CHAR returns the char that corresponds to negative for the
// current calculator. // current calculator.
@ -409,6 +409,9 @@ typedef enum BcLexType
#if DC_ENABLED #if DC_ENABLED
/// dc extended registers keyword.
BC_LEX_EXTENDED_REGISTERS,
/// A special token for dc to calculate equal without a register. /// A special token for dc to calculate equal without a register.
BC_LEX_EQ_NO_REG, BC_LEX_EQ_NO_REG,
@ -533,7 +536,7 @@ void
bc_lex_init(BcLex* l); bc_lex_init(BcLex* l);
/** /**
* Frees a lexer. This is not guarded by #ifndef NDEBUG because a separate * Frees a lexer. This is not guarded by #if BC_DEBUG because a separate
* parser is created at runtime to parse read() expressions and dc strings, and * parser is created at runtime to parse read() expressions and dc strings, and
* that parser needs a lexer. * that parser needs a lexer.
* @param l The lexer to free. * @param l The lexer to free.

View File

@ -110,12 +110,12 @@
* @param p The parser. * @param p The parser.
* @param e The error. * @param e The error.
*/ */
#ifndef NDEBUG #if BC_DEBUG
#define bc_parse_err(p, e) \ #define bc_parse_err(p, e) \
(bc_vm_handleError((e), __FILE__, __LINE__, (p)->l.line)) (bc_vm_handleError((e), __FILE__, __LINE__, (p)->l.line))
#else // NDEBUG #else // BC_DEBUG
#define bc_parse_err(p, e) (bc_vm_handleError((e), (p)->l.line)) #define bc_parse_err(p, e) (bc_vm_handleError((e), (p)->l.line))
#endif // NDEBUG #endif // BC_DEBUG
/** /**
* A convenience macro for throwing errors in parse code. This takes care of * A convenience macro for throwing errors in parse code. This takes care of
@ -124,13 +124,13 @@
* @param e The error. * @param e The error.
* @param ... The varags that are needed. * @param ... The varags that are needed.
*/ */
#ifndef NDEBUG #if BC_DEBUG
#define bc_parse_verr(p, e, ...) \ #define bc_parse_verr(p, e, ...) \
(bc_vm_handleError((e), __FILE__, __LINE__, (p)->l.line, __VA_ARGS__)) (bc_vm_handleError((e), __FILE__, __LINE__, (p)->l.line, __VA_ARGS__))
#else // NDEBUG #else // BC_DEBUG
#define bc_parse_verr(p, e, ...) \ #define bc_parse_verr(p, e, ...) \
(bc_vm_handleError((e), (p)->l.line, __VA_ARGS__)) (bc_vm_handleError((e), (p)->l.line, __VA_ARGS__))
#endif // NDEBUG #endif // BC_DEBUG
// Forward declarations. // Forward declarations.
struct BcParse; struct BcParse;
@ -215,7 +215,7 @@ void
bc_parse_init(BcParse* p, struct BcProgram* prog, size_t func); bc_parse_init(BcParse* p, struct BcProgram* prog, size_t func);
/** /**
* Frees a parser. This is not guarded by #ifndef NDEBUG because a separate * Frees a parser. This is not guarded by #if BC_DEBUG because a separate
* parser is created at runtime to parse read() expressions and dc strings. * parser is created at runtime to parse read() expressions and dc strings.
* @param p The parser to free. * @param p The parser to free.
*/ */

View File

@ -247,9 +247,9 @@ typedef struct BcProgram
// In debug mode, we want bc to check the stack, but otherwise, we don't because // In debug mode, we want bc to check the stack, but otherwise, we don't because
// the bc language implicitly mandates that the stack should always have enough // the bc language implicitly mandates that the stack should always have enough
// items. // items.
#ifdef NDEBUG #ifdef BC_DEBUG
#define BC_PROG_NO_STACK_CHECK #define BC_PROG_NO_STACK_CHECK
#endif // NDEBUG #endif // BC_DEBUG
#endif // DC_ENABLED #endif // DC_ENABLED
@ -298,7 +298,7 @@ typedef void (*BcProgramUnary)(BcResult* r, BcNum* n);
void void
bc_program_init(BcProgram* p); bc_program_init(BcProgram* p);
#ifndef NDEBUG #if BC_DEBUG
/** /**
* Frees a BcProgram. This is only used in debug builds because a BcProgram is * Frees a BcProgram. This is only used in debug builds because a BcProgram is
@ -309,7 +309,7 @@ bc_program_init(BcProgram* p);
void void
bc_program_free(BcProgram* p); bc_program_free(BcProgram* p);
#endif // NDEBUG #endif // BC_DEBUG
/** /**
* Prints a stack trace of the bc functions or dc strings currently executing. * Prints a stack trace of the bc functions or dc strings currently executing.
@ -608,6 +608,7 @@ extern const char bc_program_esc_seqs[];
&&lbl_BC_INST_MODEXP, \ &&lbl_BC_INST_MODEXP, \
&&lbl_BC_INST_DIVMOD, \ &&lbl_BC_INST_DIVMOD, \
&&lbl_BC_INST_PRINT_STREAM, \ &&lbl_BC_INST_PRINT_STREAM, \
&&lbl_BC_INST_EXTENDED_REGISTERS, \
&&lbl_BC_INST_POP_EXEC, \ &&lbl_BC_INST_POP_EXEC, \
&&lbl_BC_INST_EXECUTE, \ &&lbl_BC_INST_EXECUTE, \
&&lbl_BC_INST_EXEC_COND, \ &&lbl_BC_INST_EXEC_COND, \
@ -701,6 +702,7 @@ extern const char bc_program_esc_seqs[];
&&lbl_BC_INST_MODEXP, \ &&lbl_BC_INST_MODEXP, \
&&lbl_BC_INST_DIVMOD, \ &&lbl_BC_INST_DIVMOD, \
&&lbl_BC_INST_PRINT_STREAM, \ &&lbl_BC_INST_PRINT_STREAM, \
&&lbl_BC_INST_EXTENDED_REGISTERS, \
&&lbl_BC_INST_POP_EXEC, \ &&lbl_BC_INST_POP_EXEC, \
&&lbl_BC_INST_EXECUTE, \ &&lbl_BC_INST_EXECUTE, \
&&lbl_BC_INST_EXEC_COND, \ &&lbl_BC_INST_EXEC_COND, \
@ -959,6 +961,7 @@ extern const char bc_program_esc_seqs[];
&&lbl_BC_INST_MODEXP, \ &&lbl_BC_INST_MODEXP, \
&&lbl_BC_INST_DIVMOD, \ &&lbl_BC_INST_DIVMOD, \
&&lbl_BC_INST_PRINT_STREAM, \ &&lbl_BC_INST_PRINT_STREAM, \
&&lbl_BC_INST_EXTENDED_REGISTERS, \
&&lbl_BC_INST_POP_EXEC, \ &&lbl_BC_INST_POP_EXEC, \
&&lbl_BC_INST_EXECUTE, \ &&lbl_BC_INST_EXECUTE, \
&&lbl_BC_INST_EXEC_COND, \ &&lbl_BC_INST_EXEC_COND, \
@ -1027,6 +1030,7 @@ extern const char bc_program_esc_seqs[];
&&lbl_BC_INST_MODEXP, \ &&lbl_BC_INST_MODEXP, \
&&lbl_BC_INST_DIVMOD, \ &&lbl_BC_INST_DIVMOD, \
&&lbl_BC_INST_PRINT_STREAM, \ &&lbl_BC_INST_PRINT_STREAM, \
&&lbl_BC_INST_EXTENDED_REGISTERS, \
&&lbl_BC_INST_POP_EXEC, \ &&lbl_BC_INST_POP_EXEC, \
&&lbl_BC_INST_EXECUTE, \ &&lbl_BC_INST_EXECUTE, \
&&lbl_BC_INST_EXEC_COND, \ &&lbl_BC_INST_EXEC_COND, \

View File

@ -53,11 +53,11 @@
#if BC_ENABLE_LIBRARY #if BC_ENABLE_LIBRARY
#define BC_RAND_USE_FREE (1) #define BC_RAND_USE_FREE (1)
#else // BC_ENABLE_LIBRARY #else // BC_ENABLE_LIBRARY
#ifndef NDEBUG #if BC_DEBUG
#define BC_RAND_USE_FREE (1) #define BC_RAND_USE_FREE (1)
#else // NDEBUG #else // BC_DEBUG
#define BC_RAND_USE_FREE (0) #define BC_RAND_USE_FREE (0)
#endif // NDEBUG #endif // BC_DEBUG
#endif // BC_ENABLE_LIBRARY #endif // BC_ENABLE_LIBRARY
/** /**

View File

@ -700,7 +700,7 @@ typedef enum BcMode
#define BC_SIG_INTERRUPT(vm) BC_UNLIKELY((vm)->sig != 0) #define BC_SIG_INTERRUPT(vm) BC_UNLIKELY((vm)->sig != 0)
#endif // _WIN32 #endif // _WIN32
#ifndef NDEBUG #if BC_DEBUG
/// Assert that signals are locked. There are non-async-signal-safe functions in /// Assert that signals are locked. There are non-async-signal-safe functions in
/// bc, and they *must* have signals locked. Other functions are expected to /// bc, and they *must* have signals locked. Other functions are expected to
@ -724,7 +724,7 @@ typedef enum BcMode
} \ } \
while (0) while (0)
#else // NDEBUG #else // BC_DEBUG
/// Assert that signals are locked. There are non-async-signal-safe functions in /// Assert that signals are locked. There are non-async-signal-safe functions in
/// bc, and they *must* have signals locked. Other functions are expected to /// bc, and they *must* have signals locked. Other functions are expected to
@ -738,7 +738,7 @@ typedef enum BcMode
/// (no-op in non-debug mode) that check that signals are unlocked. /// (no-op in non-debug mode) that check that signals are unlocked.
#define BC_SIG_ASSERT_NOT_LOCKED #define BC_SIG_ASSERT_NOT_LOCKED
#endif // NDEBUG #endif // BC_DEBUG
/// Locks signals. /// Locks signals.
#define BC_SIG_LOCK \ #define BC_SIG_LOCK \
@ -957,33 +957,33 @@ typedef enum BcMode
* @param l The line of the script that the error happened. * @param l The line of the script that the error happened.
* @param ... Extra arguments for error messages as necessary. * @param ... Extra arguments for error messages as necessary.
*/ */
#ifndef NDEBUG #if BC_DEBUG
#define bc_error(e, l, ...) \ #define bc_error(e, l, ...) \
(bc_vm_handleError((e), __FILE__, __LINE__, (l), __VA_ARGS__)) (bc_vm_handleError((e), __FILE__, __LINE__, (l), __VA_ARGS__))
#else // NDEBUG #else // BC_DEBUG
#define bc_error(e, l, ...) (bc_vm_handleError((e), (l), __VA_ARGS__)) #define bc_error(e, l, ...) (bc_vm_handleError((e), (l), __VA_ARGS__))
#endif // NDEBUG #endif // BC_DEBUG
/** /**
* Call bc's error handling routine. * Call bc's error handling routine.
* @param e The error. * @param e The error.
*/ */
#ifndef NDEBUG #if BC_DEBUG
#define bc_err(e) (bc_vm_handleError((e), __FILE__, __LINE__, 0)) #define bc_err(e) (bc_vm_handleError((e), __FILE__, __LINE__, 0))
#else // NDEBUG #else // BC_DEBUG
#define bc_err(e) (bc_vm_handleError((e), 0)) #define bc_err(e) (bc_vm_handleError((e), 0))
#endif // NDEBUG #endif // BC_DEBUG
/** /**
* Call bc's error handling routine. * Call bc's error handling routine.
* @param e The error. * @param e The error.
*/ */
#ifndef NDEBUG #if BC_DEBUG
#define bc_verr(e, ...) \ #define bc_verr(e, ...) \
(bc_vm_handleError((e), __FILE__, __LINE__, 0, __VA_ARGS__)) (bc_vm_handleError((e), __FILE__, __LINE__, 0, __VA_ARGS__))
#else // NDEBUG #else // BC_DEBUG
#define bc_verr(e, ...) (bc_vm_handleError((e), 0, __VA_ARGS__)) #define bc_verr(e, ...) (bc_vm_handleError((e), 0, __VA_ARGS__))
#endif // NDEBUG #endif // BC_DEBUG
#endif // BC_ENABLE_LIBRARY #endif // BC_ENABLE_LIBRARY

View File

@ -85,12 +85,12 @@ typedef enum BcDtorType
#if !BC_ENABLE_LIBRARY #if !BC_ENABLE_LIBRARY
#ifndef NDEBUG #if BC_DEBUG
/// BcFunc destructor. /// BcFunc destructor.
BC_DTOR_FUNC, BC_DTOR_FUNC,
#endif // NDEBUG #endif // BC_DEBUG
/// BcSlab destructor. /// BcSlab destructor.
BC_DTOR_SLAB, BC_DTOR_SLAB,

View File

@ -37,6 +37,6 @@
#define BC_VERSION_H #define BC_VERSION_H
/// The current version. /// The current version.
#define VERSION 6.2.4 #define VERSION 6.3.1
#endif // BC_VERSION_H #endif // BC_VERSION_H

View File

@ -999,7 +999,7 @@ bc_vm_atexit(void);
size_t size_t
bc_vm_numDigits(size_t val); bc_vm_numDigits(size_t val);
#ifndef NDEBUG #if BC_DEBUG
/** /**
* Handle an error. This is the true error handler. It will start a jump series * Handle an error. This is the true error handler. It will start a jump series
@ -1013,7 +1013,7 @@ bc_vm_numDigits(size_t val);
void void
bc_vm_handleError(BcErr e, const char* file, int fline, size_t line, ...); bc_vm_handleError(BcErr e, const char* file, int fline, size_t line, ...);
#else // NDEBUG #else // BC_DEBUG
/** /**
* Handle an error. This is the true error handler. It will start a jump series * Handle an error. This is the true error handler. It will start a jump series
@ -1025,7 +1025,7 @@ bc_vm_handleError(BcErr e, const char* file, int fline, size_t line, ...);
void void
bc_vm_handleError(BcErr e, size_t line, ...); bc_vm_handleError(BcErr e, size_t line, ...);
#endif // NDEBUG #endif // BC_DEBUG
/** /**
* Handle a fatal error. * Handle a fatal error.

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.TH "BC" "1" "October 2022" "Gavin D. Howard" "General Commands Manual" .TH "BC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
.nh .nh
.ad l .ad l
.SH NAME .SH NAME
@ -477,8 +477,8 @@ Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
.RS .RS
.PP .PP
This can be set for individual numbers with the \f[B]plz(x)\f[R], This can be set for individual numbers with the \f[B]plz(x)\f[R],
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the \f[B]plznl(x)\f[R], \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions
extended math library (see the \f[B]LIBRARY\f[R] section). in the extended math library (see the \f[B]LIBRARY\f[R] section).
.PP .PP
This is a \f[B]non-portable extension\f[R]. This is a \f[B]non-portable extension\f[R].
.RE .RE

View File

@ -372,7 +372,7 @@ The following are the options that bc(1) accepts.
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and : Makes bc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero. not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**, This can be set for individual numbers with the **plz(x)**, **plznl(x)**,
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see **pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
the **LIBRARY** section). the **LIBRARY** section).

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.TH "BC" "1" "October 2022" "Gavin D. Howard" "General Commands Manual" .TH "BC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
.nh .nh
.ad l .ad l
.SH NAME .SH NAME
@ -433,8 +433,8 @@ Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
.RS .RS
.PP .PP
This can be set for individual numbers with the \f[B]plz(x)\f[R], This can be set for individual numbers with the \f[B]plz(x)\f[R],
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the \f[B]plznl(x)\f[R], \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions
extended math library (see the \f[B]LIBRARY\f[R] section). in the extended math library (see the \f[B]LIBRARY\f[R] section).
.PP .PP
This is a \f[B]non-portable extension\f[R]. This is a \f[B]non-portable extension\f[R].
.RE .RE

View File

@ -344,7 +344,7 @@ The following are the options that bc(1) accepts.
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and : Makes bc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero. not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**, This can be set for individual numbers with the **plz(x)**, **plznl(x)**,
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see **pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
the **LIBRARY** section). the **LIBRARY** section).

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.TH "BC" "1" "October 2022" "Gavin D. Howard" "General Commands Manual" .TH "BC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
.nh .nh
.ad l .ad l
.SH NAME .SH NAME
@ -433,8 +433,8 @@ Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
.RS .RS
.PP .PP
This can be set for individual numbers with the \f[B]plz(x)\f[R], This can be set for individual numbers with the \f[B]plz(x)\f[R],
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the \f[B]plznl(x)\f[R], \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions
extended math library (see the \f[B]LIBRARY\f[R] section). in the extended math library (see the \f[B]LIBRARY\f[R] section).
.PP .PP
This is a \f[B]non-portable extension\f[R]. This is a \f[B]non-portable extension\f[R].
.RE .RE

View File

@ -344,7 +344,7 @@ The following are the options that bc(1) accepts.
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and : Makes bc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero. not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**, This can be set for individual numbers with the **plz(x)**, **plznl(x)**,
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see **pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
the **LIBRARY** section). the **LIBRARY** section).

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.TH "BC" "1" "October 2022" "Gavin D. Howard" "General Commands Manual" .TH "BC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
.nh .nh
.ad l .ad l
.SH NAME .SH NAME
@ -433,8 +433,8 @@ Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
.RS .RS
.PP .PP
This can be set for individual numbers with the \f[B]plz(x)\f[R], This can be set for individual numbers with the \f[B]plz(x)\f[R],
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the \f[B]plznl(x)\f[R], \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions
extended math library (see the \f[B]LIBRARY\f[R] section). in the extended math library (see the \f[B]LIBRARY\f[R] section).
.PP .PP
This is a \f[B]non-portable extension\f[R]. This is a \f[B]non-portable extension\f[R].
.RE .RE

View File

@ -344,7 +344,7 @@ The following are the options that bc(1) accepts.
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and : Makes bc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero. not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**, This can be set for individual numbers with the **plz(x)**, **plznl(x)**,
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see **pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
the **LIBRARY** section). the **LIBRARY** section).

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.TH "BC" "1" "October 2022" "Gavin D. Howard" "General Commands Manual" .TH "BC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
.nh .nh
.ad l .ad l
.SH NAME .SH NAME
@ -433,8 +433,8 @@ Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
.RS .RS
.PP .PP
This can be set for individual numbers with the \f[B]plz(x)\f[R], This can be set for individual numbers with the \f[B]plz(x)\f[R],
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the \f[B]plznl(x)\f[R], \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions
extended math library (see the \f[B]LIBRARY\f[R] section). in the extended math library (see the \f[B]LIBRARY\f[R] section).
.PP .PP
This is a \f[B]non-portable extension\f[R]. This is a \f[B]non-portable extension\f[R].
.RE .RE

View File

@ -344,7 +344,7 @@ The following are the options that bc(1) accepts.
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and : Makes bc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero. not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**, This can be set for individual numbers with the **plz(x)**, **plznl(x)**,
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see **pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
the **LIBRARY** section). the **LIBRARY** section).

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.TH "BC" "1" "October 2022" "Gavin D. Howard" "General Commands Manual" .TH "BC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
.nh .nh
.ad l .ad l
.SH NAME .SH NAME
@ -477,8 +477,8 @@ Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
.RS .RS
.PP .PP
This can be set for individual numbers with the \f[B]plz(x)\f[R], This can be set for individual numbers with the \f[B]plz(x)\f[R],
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the \f[B]plznl(x)\f[R], \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions
extended math library (see the \f[B]LIBRARY\f[R] section). in the extended math library (see the \f[B]LIBRARY\f[R] section).
.PP .PP
This is a \f[B]non-portable extension\f[R]. This is a \f[B]non-portable extension\f[R].
.RE .RE

View File

@ -372,7 +372,7 @@ The following are the options that bc(1) accepts.
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and : Makes bc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero. not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**, This can be set for individual numbers with the **plz(x)**, **plznl(x)**,
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see **pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
the **LIBRARY** section). the **LIBRARY** section).

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.TH "BC" "1" "October 2022" "Gavin D. Howard" "General Commands Manual" .TH "BC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
.nh .nh
.ad l .ad l
.SH NAME .SH NAME
@ -477,8 +477,8 @@ Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
.RS .RS
.PP .PP
This can be set for individual numbers with the \f[B]plz(x)\f[R], This can be set for individual numbers with the \f[B]plz(x)\f[R],
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the \f[B]plznl(x)\f[R], \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions
extended math library (see the \f[B]LIBRARY\f[R] section). in the extended math library (see the \f[B]LIBRARY\f[R] section).
.PP .PP
This is a \f[B]non-portable extension\f[R]. This is a \f[B]non-portable extension\f[R].
.RE .RE

View File

@ -372,7 +372,7 @@ The following are the options that bc(1) accepts.
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and : Makes bc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero. not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**, This can be set for individual numbers with the **plz(x)**, **plznl(x)**,
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see **pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
the **LIBRARY** section). the **LIBRARY** section).

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.TH "BC" "1" "October 2022" "Gavin D. Howard" "General Commands Manual" .TH "BC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
.nh .nh
.ad l .ad l
.SH NAME .SH NAME
@ -477,8 +477,8 @@ Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
.RS .RS
.PP .PP
This can be set for individual numbers with the \f[B]plz(x)\f[R], This can be set for individual numbers with the \f[B]plz(x)\f[R],
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the \f[B]plznl(x)\f[R], \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions
extended math library (see the \f[B]LIBRARY\f[R] section). in the extended math library (see the \f[B]LIBRARY\f[R] section).
.PP .PP
This is a \f[B]non-portable extension\f[R]. This is a \f[B]non-portable extension\f[R].
.RE .RE

View File

@ -372,7 +372,7 @@ The following are the options that bc(1) accepts.
: Makes bc(1) print all numbers greater than **-1** and less than **1**, and : Makes bc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero. not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**, This can be set for individual numbers with the **plz(x)**, **plznl(x)**,
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see **pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
the **LIBRARY** section). the **LIBRARY** section).

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.TH "BCL" "3" "October 2022" "Gavin D. Howard" "Libraries Manual" .TH "BCL" "3" "February 2023" "Gavin D. Howard" "Libraries Manual"
.nh .nh
.ad l .ad l
.SH NAME .SH NAME

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.TH "DC" "1" "October 2022" "Gavin D. Howard" "General Commands Manual" .TH "DC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
.nh .nh
.ad l .ad l
.SH Name .SH Name
@ -271,10 +271,6 @@ Makes dc(1) print all numbers greater than \f[B]-1\f[R] and less than
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero. \f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
.RS .RS
.PP .PP
This can be set for individual numbers with the \f[B]plz(x)\f[R],
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
extended math library (see the \f[B]LIBRARY\f[R] section).
.PP
This is a \f[B]non-portable extension\f[R]. This is a \f[B]non-portable extension\f[R].
.RE .RE
.PP .PP
@ -1255,6 +1251,12 @@ section).
Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the
\f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack. \f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack.
.TP .TP
\f[B]gx\f[R]
Pushes \f[B]1\f[R] onto the stack if extended register mode is on,
\f[B]0\f[R] otherwise.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
.TP
\f[B]gz\f[R] \f[B]gz\f[R]
Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options

View File

@ -224,10 +224,6 @@ The following are the options that dc(1) accepts.
: Makes dc(1) print all numbers greater than **-1** and less than **1**, and : Makes dc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero. not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
the **LIBRARY** section).
This is a **non-portable extension**. This is a **non-portable extension**.
All long options are **non-portable extensions**. All long options are **non-portable extensions**.
@ -1087,6 +1083,12 @@ other character produces a parse error (see the **ERRORS** section).
: Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT : Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT
VARIABLES** section) onto the stack. VARIABLES** section) onto the stack.
**gx**
: Pushes **1** onto the stack if extended register mode is on, **0**
otherwise. See the *Extended Register Mode* subsection of the **REGISTERS**
section for more information.
**gz** **gz**
: Pushes **0** onto the stack if the leading zero setting has not been enabled : Pushes **0** onto the stack if the leading zero setting has not been enabled

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.TH "DC" "1" "October 2022" "Gavin D. Howard" "General Commands Manual" .TH "DC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
.nh .nh
.ad l .ad l
.SH Name .SH Name
@ -256,10 +256,6 @@ Makes dc(1) print all numbers greater than \f[B]-1\f[R] and less than
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero. \f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
.RS .RS
.PP .PP
This can be set for individual numbers with the \f[B]plz(x)\f[R],
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
extended math library (see the \f[B]LIBRARY\f[R] section).
.PP
This is a \f[B]non-portable extension\f[R]. This is a \f[B]non-portable extension\f[R].
.RE .RE
.PP .PP
@ -1040,6 +1036,12 @@ section).
Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the
\f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack. \f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack.
.TP .TP
\f[B]gx\f[R]
Pushes \f[B]1\f[R] onto the stack if extended register mode is on,
\f[B]0\f[R] otherwise.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
.TP
\f[B]gz\f[R] \f[B]gz\f[R]
Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options

View File

@ -215,10 +215,6 @@ The following are the options that dc(1) accepts.
: Makes dc(1) print all numbers greater than **-1** and less than **1**, and : Makes dc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero. not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
the **LIBRARY** section).
This is a **non-portable extension**. This is a **non-portable extension**.
All long options are **non-portable extensions**. All long options are **non-portable extensions**.
@ -918,6 +914,12 @@ other character produces a parse error (see the **ERRORS** section).
: Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT : Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT
VARIABLES** section) onto the stack. VARIABLES** section) onto the stack.
**gx**
: Pushes **1** onto the stack if extended register mode is on, **0**
otherwise. See the *Extended Register Mode* subsection of the **REGISTERS**
section for more information.
**gz** **gz**
: Pushes **0** onto the stack if the leading zero setting has not been enabled : Pushes **0** onto the stack if the leading zero setting has not been enabled

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.TH "DC" "1" "October 2022" "Gavin D. Howard" "General Commands Manual" .TH "DC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
.nh .nh
.ad l .ad l
.SH Name .SH Name
@ -256,10 +256,6 @@ Makes dc(1) print all numbers greater than \f[B]-1\f[R] and less than
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero. \f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
.RS .RS
.PP .PP
This can be set for individual numbers with the \f[B]plz(x)\f[R],
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
extended math library (see the \f[B]LIBRARY\f[R] section).
.PP
This is a \f[B]non-portable extension\f[R]. This is a \f[B]non-portable extension\f[R].
.RE .RE
.PP .PP
@ -1040,6 +1036,12 @@ section).
Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the
\f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack. \f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack.
.TP .TP
\f[B]gx\f[R]
Pushes \f[B]1\f[R] onto the stack if extended register mode is on,
\f[B]0\f[R] otherwise.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
.TP
\f[B]gz\f[R] \f[B]gz\f[R]
Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options

View File

@ -215,10 +215,6 @@ The following are the options that dc(1) accepts.
: Makes dc(1) print all numbers greater than **-1** and less than **1**, and : Makes dc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero. not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
the **LIBRARY** section).
This is a **non-portable extension**. This is a **non-portable extension**.
All long options are **non-portable extensions**. All long options are **non-portable extensions**.
@ -918,6 +914,12 @@ other character produces a parse error (see the **ERRORS** section).
: Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT : Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT
VARIABLES** section) onto the stack. VARIABLES** section) onto the stack.
**gx**
: Pushes **1** onto the stack if extended register mode is on, **0**
otherwise. See the *Extended Register Mode* subsection of the **REGISTERS**
section for more information.
**gz** **gz**
: Pushes **0** onto the stack if the leading zero setting has not been enabled : Pushes **0** onto the stack if the leading zero setting has not been enabled

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.TH "DC" "1" "October 2022" "Gavin D. Howard" "General Commands Manual" .TH "DC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
.nh .nh
.ad l .ad l
.SH Name .SH Name
@ -256,10 +256,6 @@ Makes dc(1) print all numbers greater than \f[B]-1\f[R] and less than
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero. \f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
.RS .RS
.PP .PP
This can be set for individual numbers with the \f[B]plz(x)\f[R],
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
extended math library (see the \f[B]LIBRARY\f[R] section).
.PP
This is a \f[B]non-portable extension\f[R]. This is a \f[B]non-portable extension\f[R].
.RE .RE
.PP .PP
@ -1040,6 +1036,12 @@ section).
Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the
\f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack. \f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack.
.TP .TP
\f[B]gx\f[R]
Pushes \f[B]1\f[R] onto the stack if extended register mode is on,
\f[B]0\f[R] otherwise.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
.TP
\f[B]gz\f[R] \f[B]gz\f[R]
Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options

View File

@ -215,10 +215,6 @@ The following are the options that dc(1) accepts.
: Makes dc(1) print all numbers greater than **-1** and less than **1**, and : Makes dc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero. not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
the **LIBRARY** section).
This is a **non-portable extension**. This is a **non-portable extension**.
All long options are **non-portable extensions**. All long options are **non-portable extensions**.
@ -918,6 +914,12 @@ other character produces a parse error (see the **ERRORS** section).
: Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT : Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT
VARIABLES** section) onto the stack. VARIABLES** section) onto the stack.
**gx**
: Pushes **1** onto the stack if extended register mode is on, **0**
otherwise. See the *Extended Register Mode* subsection of the **REGISTERS**
section for more information.
**gz** **gz**
: Pushes **0** onto the stack if the leading zero setting has not been enabled : Pushes **0** onto the stack if the leading zero setting has not been enabled

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.TH "DC" "1" "October 2022" "Gavin D. Howard" "General Commands Manual" .TH "DC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
.nh .nh
.ad l .ad l
.SH Name .SH Name
@ -256,10 +256,6 @@ Makes dc(1) print all numbers greater than \f[B]-1\f[R] and less than
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero. \f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
.RS .RS
.PP .PP
This can be set for individual numbers with the \f[B]plz(x)\f[R],
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
extended math library (see the \f[B]LIBRARY\f[R] section).
.PP
This is a \f[B]non-portable extension\f[R]. This is a \f[B]non-portable extension\f[R].
.RE .RE
.PP .PP
@ -1040,6 +1036,12 @@ section).
Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the
\f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack. \f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack.
.TP .TP
\f[B]gx\f[R]
Pushes \f[B]1\f[R] onto the stack if extended register mode is on,
\f[B]0\f[R] otherwise.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
.TP
\f[B]gz\f[R] \f[B]gz\f[R]
Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options

View File

@ -215,10 +215,6 @@ The following are the options that dc(1) accepts.
: Makes dc(1) print all numbers greater than **-1** and less than **1**, and : Makes dc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero. not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
the **LIBRARY** section).
This is a **non-portable extension**. This is a **non-portable extension**.
All long options are **non-portable extensions**. All long options are **non-portable extensions**.
@ -918,6 +914,12 @@ other character produces a parse error (see the **ERRORS** section).
: Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT : Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT
VARIABLES** section) onto the stack. VARIABLES** section) onto the stack.
**gx**
: Pushes **1** onto the stack if extended register mode is on, **0**
otherwise. See the *Extended Register Mode* subsection of the **REGISTERS**
section for more information.
**gz** **gz**
: Pushes **0** onto the stack if the leading zero setting has not been enabled : Pushes **0** onto the stack if the leading zero setting has not been enabled

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.TH "DC" "1" "October 2022" "Gavin D. Howard" "General Commands Manual" .TH "DC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
.nh .nh
.ad l .ad l
.SH Name .SH Name
@ -271,10 +271,6 @@ Makes dc(1) print all numbers greater than \f[B]-1\f[R] and less than
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero. \f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
.RS .RS
.PP .PP
This can be set for individual numbers with the \f[B]plz(x)\f[R],
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
extended math library (see the \f[B]LIBRARY\f[R] section).
.PP
This is a \f[B]non-portable extension\f[R]. This is a \f[B]non-portable extension\f[R].
.RE .RE
.PP .PP
@ -1255,6 +1251,12 @@ section).
Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the
\f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack. \f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack.
.TP .TP
\f[B]gx\f[R]
Pushes \f[B]1\f[R] onto the stack if extended register mode is on,
\f[B]0\f[R] otherwise.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
.TP
\f[B]gz\f[R] \f[B]gz\f[R]
Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options

View File

@ -224,10 +224,6 @@ The following are the options that dc(1) accepts.
: Makes dc(1) print all numbers greater than **-1** and less than **1**, and : Makes dc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero. not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
the **LIBRARY** section).
This is a **non-portable extension**. This is a **non-portable extension**.
All long options are **non-portable extensions**. All long options are **non-portable extensions**.
@ -1087,6 +1083,12 @@ other character produces a parse error (see the **ERRORS** section).
: Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT : Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT
VARIABLES** section) onto the stack. VARIABLES** section) onto the stack.
**gx**
: Pushes **1** onto the stack if extended register mode is on, **0**
otherwise. See the *Extended Register Mode* subsection of the **REGISTERS**
section for more information.
**gz** **gz**
: Pushes **0** onto the stack if the leading zero setting has not been enabled : Pushes **0** onto the stack if the leading zero setting has not been enabled

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.TH "DC" "1" "October 2022" "Gavin D. Howard" "General Commands Manual" .TH "DC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
.nh .nh
.ad l .ad l
.SH Name .SH Name
@ -271,10 +271,6 @@ Makes dc(1) print all numbers greater than \f[B]-1\f[R] and less than
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero. \f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
.RS .RS
.PP .PP
This can be set for individual numbers with the \f[B]plz(x)\f[R],
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
extended math library (see the \f[B]LIBRARY\f[R] section).
.PP
This is a \f[B]non-portable extension\f[R]. This is a \f[B]non-portable extension\f[R].
.RE .RE
.PP .PP
@ -1255,6 +1251,12 @@ section).
Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the
\f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack. \f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack.
.TP .TP
\f[B]gx\f[R]
Pushes \f[B]1\f[R] onto the stack if extended register mode is on,
\f[B]0\f[R] otherwise.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
.TP
\f[B]gz\f[R] \f[B]gz\f[R]
Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options

View File

@ -224,10 +224,6 @@ The following are the options that dc(1) accepts.
: Makes dc(1) print all numbers greater than **-1** and less than **1**, and : Makes dc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero. not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
the **LIBRARY** section).
This is a **non-portable extension**. This is a **non-portable extension**.
All long options are **non-portable extensions**. All long options are **non-portable extensions**.
@ -1087,6 +1083,12 @@ other character produces a parse error (see the **ERRORS** section).
: Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT : Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT
VARIABLES** section) onto the stack. VARIABLES** section) onto the stack.
**gx**
: Pushes **1** onto the stack if extended register mode is on, **0**
otherwise. See the *Extended Register Mode* subsection of the **REGISTERS**
section for more information.
**gz** **gz**
: Pushes **0** onto the stack if the leading zero setting has not been enabled : Pushes **0** onto the stack if the leading zero setting has not been enabled

View File

@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE. .\" POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.TH "DC" "1" "October 2022" "Gavin D. Howard" "General Commands Manual" .TH "DC" "1" "February 2023" "Gavin D. Howard" "General Commands Manual"
.nh .nh
.ad l .ad l
.SH Name .SH Name
@ -271,10 +271,6 @@ Makes dc(1) print all numbers greater than \f[B]-1\f[R] and less than
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero. \f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
.RS .RS
.PP .PP
This can be set for individual numbers with the \f[B]plz(x)\f[R],
plznl(x)**, \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions in the
extended math library (see the \f[B]LIBRARY\f[R] section).
.PP
This is a \f[B]non-portable extension\f[R]. This is a \f[B]non-portable extension\f[R].
.RE .RE
.PP .PP
@ -1255,6 +1251,12 @@ section).
Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the
\f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack. \f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack.
.TP .TP
\f[B]gx\f[R]
Pushes \f[B]1\f[R] onto the stack if extended register mode is on,
\f[B]0\f[R] otherwise.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
.TP
\f[B]gz\f[R] \f[B]gz\f[R]
Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options been enabled with the \f[B]-z\f[R] or \f[B]--leading-zeroes\f[R] options

View File

@ -224,10 +224,6 @@ The following are the options that dc(1) accepts.
: Makes dc(1) print all numbers greater than **-1** and less than **1**, and : Makes dc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero. not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
**pnlz(x)**, and **pnlznl(x)** functions in the extended math library (see
the **LIBRARY** section).
This is a **non-portable extension**. This is a **non-portable extension**.
All long options are **non-portable extensions**. All long options are **non-portable extensions**.
@ -1087,6 +1083,12 @@ other character produces a parse error (see the **ERRORS** section).
: Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT : Pushes the line length set by **DC_LINE_LENGTH** (see the **ENVIRONMENT
VARIABLES** section) onto the stack. VARIABLES** section) onto the stack.
**gx**
: Pushes **1** onto the stack if extended register mode is on, **0**
otherwise. See the *Extended Register Mode* subsection of the **REGISTERS**
section for more information.
**gz** **gz**
: Pushes **0** onto the stack if the leading zero setting has not been enabled : Pushes **0** onto the stack if the leading zero setting has not been enabled

View File

@ -60,6 +60,12 @@ fi
# If it's a symlink, create an equivalent in the install directory. # If it's a symlink, create an equivalent in the install directory.
for exe in $bindir/*; do for exe in $bindir/*; do
# Skip any directories in case the bin/ directory is also used as the
# prefix.
if [ -d "$exe" ]; then
continue
fi
base=$(basename "$exe") base=$(basename "$exe")
if [ -L "$exe" ]; then if [ -L "$exe" ]; then

View File

@ -29,6 +29,8 @@
scriptdir=$(dirname "$0") scriptdir=$(dirname "$0")
. "$scriptdir/functions.sh"
cd "$scriptdir/.." cd "$scriptdir/.."
if [ "$#" -gt 0 ]; then if [ "$#" -gt 0 ]; then

View File

@ -32,6 +32,11 @@ usage() {
exit 1 exit 1
} }
script="$0"
scriptdir=$(dirname "$script")
. "$scriptdir/functions.sh"
# Command-line processing. # Command-line processing.
test "$#" -gt 1 || usage test "$#" -gt 1 || usage

View File

@ -27,7 +27,10 @@
# POSSIBILITY OF SUCH DAMAGE. # POSSIBILITY OF SUCH DAMAGE.
# #
scriptdir=$(dirname "$0") script="$0"
scriptdir=$(dirname "$script")
. "$scriptdir/functions.sh"
cd "$scriptdir/.." cd "$scriptdir/.."

View File

@ -184,11 +184,12 @@ all_locales=0
while getopts "l" opt; do while getopts "l" opt; do
case "$opt" in case "$opt" in
l) all_locales=1 ; shift ;; l) all_locales=1 ;;
?) usage "Invalid option: $opt" ;; ?) usage "Invalid option: $opt" ;;
esac esac
done done
shift $(($OPTIND - 1))
test "$#" -ge 2 || usage "Must have at least two arguments" test "$#" -ge 2 || usage "Must have at least two arguments"

View File

@ -41,7 +41,7 @@ set -e
if test "$mkdirp" ; then if test "$mkdirp" ; then
umask 022 umask 022
case "$2" in case "$dst" in
*/*) mkdir -p "${dst%/*}" ;; */*) mkdir -p "${dst%/*}" ;;
esac esac
fi fi
@ -51,15 +51,15 @@ trap 'rm -f "$tmp"' EXIT INT QUIT TERM HUP
umask 077 umask 077
if test "$symlink" ; then if test "$symlink" ; then
ln -s "$1" "$tmp" ln -s "$src" "$tmp"
else else
cat < "$1" > "$tmp" cat < "$src" > "$tmp"
chmod "$mode" "$tmp" chmod "$mode" "$tmp"
fi fi
mv -f "$tmp" "$2" mv -f "$tmp" "$dst"
test -d "$2" && { test -d "$dst" && {
rm -f "$2/$tmp" rm -f "$dst/$tmp"
printf "%s: %s is a directory\n" "$0" "$dst" 1>&2 printf "%s: %s is a directory\n" "$0" "$dst" 1>&2
exit 1 exit 1
} }

View File

@ -345,7 +345,7 @@ bc_args(int argc, char* argv[], bool exit_exprs, BcBigDig* scale,
} }
#endif // DC_ENABLED #endif // DC_ENABLED
#ifndef NDEBUG #if BC_DEBUG
// We shouldn't get here because bc_opt_error()/bc_error() should // We shouldn't get here because bc_opt_error()/bc_error() should
// longjmp() out. // longjmp() out.
case '?': case '?':
@ -357,7 +357,7 @@ bc_args(int argc, char* argv[], bool exit_exprs, BcBigDig* scale,
abort(); abort();
#endif // !BC_CLANG #endif // !BC_CLANG
} }
#endif // NDEBUG #endif // BC_DEBUG
} }
} }

View File

@ -1888,6 +1888,7 @@ bc_parse_stmt(BcParse* p)
case BC_LEX_KW_AUTO: case BC_LEX_KW_AUTO:
case BC_LEX_KW_DEFINE: case BC_LEX_KW_DEFINE:
#if DC_ENABLED #if DC_ENABLED
case BC_LEX_EXTENDED_REGISTERS:
case BC_LEX_EQ_NO_REG: case BC_LEX_EQ_NO_REG:
case BC_LEX_COLON: case BC_LEX_COLON:
case BC_LEX_EXECUTE: case BC_LEX_EXECUTE:
@ -2436,6 +2437,7 @@ bc_parse_expr_err(BcParse* p, uint8_t flags, BcParseNext next)
case BC_LEX_KW_STREAM: case BC_LEX_KW_STREAM:
case BC_LEX_KW_ELSE: case BC_LEX_KW_ELSE:
#if DC_ENABLED #if DC_ENABLED
case BC_LEX_EXTENDED_REGISTERS:
case BC_LEX_EQ_NO_REG: case BC_LEX_EQ_NO_REG:
case BC_LEX_COLON: case BC_LEX_COLON:
case BC_LEX_EXECUTE: case BC_LEX_EXECUTE:
@ -2462,11 +2464,11 @@ bc_parse_expr_err(BcParse* p, uint8_t flags, BcParseNext next)
case BC_LEX_ARRAY_LENGTH: case BC_LEX_ARRAY_LENGTH:
#endif // DC_ENABLED #endif // DC_ENABLED
{ {
#ifndef NDEBUG #if BC_DEBUG
// We should never get here, even in debug builds. // We should never get here, even in debug builds.
bc_parse_err(p, BC_ERR_PARSE_TOKEN); bc_parse_err(p, BC_ERR_PARSE_TOKEN);
break; break;
#endif // NDEBUG #endif // BC_DEBUG
} }
} }

View File

@ -308,9 +308,9 @@ const BcVecFree bc_vec_dtors[] = {
bc_vec_free, bc_vec_free,
bc_num_free, bc_num_free,
#if !BC_ENABLE_LIBRARY #if !BC_ENABLE_LIBRARY
#ifndef NDEBUG #if BC_DEBUG
bc_func_free, bc_func_free,
#endif // NDEBUG #endif // BC_DEBUG
bc_slab_free, bc_slab_free,
bc_const_free, bc_const_free,
bc_result_free, bc_result_free,
@ -1199,12 +1199,12 @@ const uchar dc_parse_insts[] = {
#if BC_ENABLED #if BC_ENABLED
BC_INST_INVALID, BC_INST_INVALID,
#endif // BC_ENABLED #endif // BC_ENABLED
BC_INST_LEADING_ZERO, BC_INST_PRINT_STREAM, BC_INST_INVALID, BC_INST_LEADING_ZERO, BC_INST_PRINT_STREAM, BC_INST_INVALID,
BC_INST_REL_EQ, BC_INST_INVALID, BC_INST_EXECUTE, BC_INST_EXTENDED_REGISTERS, BC_INST_REL_EQ, BC_INST_INVALID,
BC_INST_PRINT_STACK, BC_INST_CLEAR_STACK, BC_INST_INVALID, BC_INST_EXECUTE, BC_INST_PRINT_STACK, BC_INST_CLEAR_STACK,
BC_INST_STACK_LEN, BC_INST_DUPLICATE, BC_INST_SWAP, BC_INST_INVALID, BC_INST_STACK_LEN, BC_INST_DUPLICATE,
BC_INST_POP, BC_INST_INVALID, BC_INST_INVALID, BC_INST_SWAP, BC_INST_POP, BC_INST_INVALID,
BC_INST_INVALID, BC_INST_INVALID, BC_INST_INVALID,
#if BC_ENABLE_EXTRA_MATH #if BC_ENABLE_EXTRA_MATH
BC_INST_INVALID, BC_INST_INVALID,
#endif // BC_ENABLE_EXTRA_MATH #endif // BC_ENABLE_EXTRA_MATH

View File

@ -278,6 +278,7 @@ dc_lex_token(BcLex* l)
c2 = l->buf[l->i]; c2 = l->buf[l->i];
if (c2 == 'l') l->t = BC_LEX_KW_LINE_LENGTH; if (c2 == 'l') l->t = BC_LEX_KW_LINE_LENGTH;
else if (c2 == 'x') l->t = BC_LEX_EXTENDED_REGISTERS;
else if (c2 == 'z') l->t = BC_LEX_KW_LEADING_ZERO; else if (c2 == 'z') l->t = BC_LEX_KW_LEADING_ZERO;
else bc_lex_invalidChar(l, c2); else bc_lex_invalidChar(l, c2);

View File

@ -349,6 +349,7 @@ dc_parse_token(BcParse* p, BcLexType t, uint8_t flags)
case BC_LEX_KW_LEADING_ZERO: case BC_LEX_KW_LEADING_ZERO:
case BC_LEX_KW_STREAM: case BC_LEX_KW_STREAM:
case BC_LEX_KW_ELSE: case BC_LEX_KW_ELSE:
case BC_LEX_EXTENDED_REGISTERS:
case BC_LEX_EQ_NO_REG: case BC_LEX_EQ_NO_REG:
case BC_LEX_EXECUTE: case BC_LEX_EXECUTE:
case BC_LEX_PRINT_STACK: case BC_LEX_PRINT_STACK:

View File

@ -336,7 +336,7 @@ bc_file_vprintf(BcFile* restrict f, const char* fmt, va_list args)
bc_file_puts(f, bc_flush_none, s); bc_file_puts(f, bc_flush_none, s);
} }
#ifndef NDEBUG #if BC_DEBUG
// We only print signed integers in debug code. // We only print signed integers in debug code.
else if (c == 'd') else if (c == 'd')
{ {
@ -357,7 +357,7 @@ bc_file_vprintf(BcFile* restrict f, const char* fmt, va_list args)
bc_file_puts(f, bc_flush_none, buf); bc_file_puts(f, bc_flush_none, buf);
} }
} }
#endif // NDEBUG #endif // BC_DEBUG
else else
{ {
unsigned long long ull; unsigned long long ull;

View File

@ -2187,11 +2187,11 @@ bc_history_free(BcHistory* h)
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), h->orig_in); SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), h->orig_in);
SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), h->orig_out); SetConsoleMode(GetStdHandle(STD_OUTPUT_HANDLE), h->orig_out);
#endif // _WIN32 #endif // _WIN32
#ifndef NDEBUG #if BC_DEBUG
bc_vec_free(&h->buf); bc_vec_free(&h->buf);
bc_vec_free(&h->history); bc_vec_free(&h->history);
bc_vec_free(&h->extras); bc_vec_free(&h->extras);
#endif // NDEBUG #endif // BC_DEBUG
} }
#if BC_DEBUG_CODE #if BC_DEBUG_CODE

View File

@ -136,7 +136,7 @@ bc_func_reset(BcFunc* f)
#endif // BC_ENABLED #endif // BC_ENABLED
} }
#ifndef NDEBUG #if BC_DEBUG
void void
bc_func_free(void* func) bc_func_free(void* func)
{ {
@ -155,7 +155,7 @@ bc_func_free(void* func)
} }
#endif // BC_ENABLED #endif // BC_ENABLED
} }
#endif // NDEBUG #endif // BC_DEBUG
void void
bc_array_init(BcVec* a, bool nums) bc_array_init(BcVec* a, bool nums)
@ -302,10 +302,10 @@ bc_result_copy(BcResult* d, BcResult* src)
case BC_RESULT_VOID: case BC_RESULT_VOID:
case BC_RESULT_LAST: case BC_RESULT_LAST:
{ {
#ifndef NDEBUG #if BC_DEBUG
// We should *never* try copying either of these. // We should *never* try copying either of these.
abort(); abort();
#endif // NDEBUG #endif // BC_DEBUG
} }
#endif // BC_ENABLED #endif // BC_ENABLED
} }

View File

@ -201,6 +201,8 @@ bcl_init(void)
err: err:
BC_FUNC_FOOTER(vm, e);
// This is why we had to set them to NULL. // This is why we had to set them to NULL.
if (BC_ERR(vm != NULL && vm->err)) if (BC_ERR(vm != NULL && vm->err))
{ {
@ -211,8 +213,6 @@ bcl_init(void)
free(vm); free(vm);
} }
BC_FUNC_FOOTER(vm, e);
return e; return e;
} }

View File

@ -3474,11 +3474,11 @@ bc_num_len(const BcNum* restrict n)
void void
bc_num_parse(BcNum* restrict n, const char* restrict val, BcBigDig base) bc_num_parse(BcNum* restrict n, const char* restrict val, BcBigDig base)
{ {
#ifndef NDEBUG #if BC_DEBUG
#if BC_ENABLE_LIBRARY #if BC_ENABLE_LIBRARY
BcVm* vm = bcl_getspecific(); BcVm* vm = bcl_getspecific();
#endif // BC_ENABLE_LIBRARY #endif // BC_ENABLE_LIBRARY
#endif // NDEBUG #endif // BC_DEBUG
assert(n != NULL && val != NULL && base); assert(n != NULL && val != NULL && base);
assert(base >= BC_NUM_MIN_BASE && base <= vm->maxes[BC_PROG_GLOBALS_IBASE]); assert(base >= BC_NUM_MIN_BASE && base <= vm->maxes[BC_PROG_GLOBALS_IBASE]);
@ -3539,11 +3539,11 @@ bc_num_print(BcNum* restrict n, BcBigDig base, bool newline)
BcBigDig BcBigDig
bc_num_bigdig2(const BcNum* restrict n) bc_num_bigdig2(const BcNum* restrict n)
{ {
#ifndef NDEBUG #if BC_DEBUG
#if BC_ENABLE_LIBRARY #if BC_ENABLE_LIBRARY
BcVm* vm = bcl_getspecific(); BcVm* vm = bcl_getspecific();
#endif // BC_ENABLE_LIBRARY #endif // BC_ENABLE_LIBRARY
#endif // NDEBUG #endif // BC_DEBUG
// This function returns no errors because it's guaranteed to succeed if // This function returns no errors because it's guaranteed to succeed if
// its preconditions are met. Those preconditions include both n needs to // its preconditions are met. Those preconditions include both n needs to
@ -4256,11 +4256,11 @@ bc_num_modexp(BcNum* a, BcNum* b, BcNum* c, BcNum* restrict d)
if (BC_ERR(BC_NUM_ZERO(c))) bc_err(BC_ERR_MATH_DIVIDE_BY_ZERO); if (BC_ERR(BC_NUM_ZERO(c))) bc_err(BC_ERR_MATH_DIVIDE_BY_ZERO);
if (BC_ERR(BC_NUM_NEG(b))) bc_err(BC_ERR_MATH_NEGATIVE); if (BC_ERR(BC_NUM_NEG(b))) bc_err(BC_ERR_MATH_NEGATIVE);
#ifndef NDEBUG #if BC_DEBUG || BC_GCC
// This is entirely for quieting a useless scan-build error. // This is entirely for quieting a useless scan-build error.
btemp.len = 0; btemp.len = 0;
ctemp.len = 0; ctemp.len = 0;
#endif // NDEBUG #endif // BC_DEBUG || BC_GCC
// Eliminate fractional parts that are zero or error if they are not zero. // Eliminate fractional parts that are zero or error if they are not zero.
if (BC_ERR(bc_num_nonInt(a, &atemp) || bc_num_nonInt(b, &btemp) || if (BC_ERR(bc_num_nonInt(a, &atemp) || bc_num_nonInt(b, &btemp) ||

View File

@ -223,7 +223,7 @@ bc_parse_reset(BcParse* p)
if (BC_ERR(vm->status)) BC_JMP; if (BC_ERR(vm->status)) BC_JMP;
} }
#ifndef NDEBUG #if BC_DEBUG
void void
bc_parse_free(BcParse* p) bc_parse_free(BcParse* p)
{ {
@ -244,7 +244,7 @@ bc_parse_free(BcParse* p)
bc_lex_free(&p->l); bc_lex_free(&p->l);
} }
#endif // NDEBUG #endif // BC_DEBUG
void void
bc_parse_init(BcParse* p, BcProgram* prog, size_t func) bc_parse_init(BcParse* p, BcProgram* prog, size_t func)

View File

@ -411,12 +411,12 @@ bc_program_num(BcProgram* p, BcResult* r)
// We should never get here; this is taken care of earlier because a // We should never get here; this is taken care of earlier because a
// result is expected. // result is expected.
case BC_RESULT_VOID: case BC_RESULT_VOID:
#ifndef NDEBUG #if BC_DEBUG
{ {
abort(); abort();
// Fallthrough // Fallthrough
} }
#endif // NDEBUG #endif // BC_DEBUG
case BC_RESULT_LAST: case BC_RESULT_LAST:
{ {
n = &p->last; n = &p->last;
@ -839,14 +839,14 @@ bc_program_rand(BcProgram* p)
bc_program_pushBigdig(p, (BcBigDig) rand, BC_RESULT_TEMP); bc_program_pushBigdig(p, (BcBigDig) rand, BC_RESULT_TEMP);
#ifndef NDEBUG #if BC_DEBUG
// This is just to ensure that the generated number is correct. I also use // This is just to ensure that the generated number is correct. I also use
// braces because I declare every local at the top of the scope. // braces because I declare every local at the top of the scope.
{ {
BcResult* r = bc_vec_top(&p->results); BcResult* r = bc_vec_top(&p->results);
assert(BC_NUM_RDX_VALID_NP(r->d.n)); assert(BC_NUM_RDX_VALID_NP(r->d.n));
} }
#endif // NDEBUG #endif // BC_DEBUG
} }
#endif // BC_ENABLE_EXTRA_MATH #endif // BC_ENABLE_EXTRA_MATH
@ -1140,13 +1140,13 @@ bc_program_logical(BcProgram* p, uchar inst)
cond = (cmp > 0); cond = (cmp > 0);
break; break;
} }
#ifndef NDEBUG #if BC_DEBUG
default: default:
{ {
// There is a bug if we get here. // There is a bug if we get here.
abort(); abort();
} }
#endif // NDEBUG #endif // BC_DEBUG
} }
} }
@ -2689,12 +2689,20 @@ bc_program_globalSetting(BcProgram* p, uchar inst)
BcBigDig val; BcBigDig val;
// Make sure the instruction is valid. // Make sure the instruction is valid.
#if DC_ENABLED
assert((inst >= BC_INST_LINE_LENGTH && inst <= BC_INST_LEADING_ZERO) ||
(BC_IS_DC && inst == BC_INST_EXTENDED_REGISTERS));
#else // DC_ENABLED
assert(inst >= BC_INST_LINE_LENGTH && inst <= BC_INST_LEADING_ZERO); assert(inst >= BC_INST_LINE_LENGTH && inst <= BC_INST_LEADING_ZERO);
#endif // DC_ENABLED
if (inst == BC_INST_LINE_LENGTH) val = (BcBigDig) vm->line_len; if (inst == BC_INST_LINE_LENGTH) val = (BcBigDig) vm->line_len;
#if BC_ENABLED #if BC_ENABLED
else if (inst == BC_INST_GLOBAL_STACKS) val = (BC_G != 0); else if (inst == BC_INST_GLOBAL_STACKS) val = (BC_G != 0);
#endif // BC_ENABLED #endif // BC_ENABLED
#if DC_ENABLED
else if (inst == BC_INST_EXTENDED_REGISTERS) val = (DC_X != 0);
#endif // DC_ENABLED
else val = (BC_Z != 0); else val = (BC_Z != 0);
// Push the global. // Push the global.
@ -2779,7 +2787,7 @@ bc_program_insertFunc(BcProgram* p, const char* name)
return idx; return idx;
} }
#ifndef NDEBUG #if BC_DEBUG
void void
bc_program_free(BcProgram* p) bc_program_free(BcProgram* p)
{ {
@ -2826,7 +2834,7 @@ bc_program_free(BcProgram* p)
if (BC_IS_DC) bc_vec_free(&p->tail_calls); if (BC_IS_DC) bc_vec_free(&p->tail_calls);
#endif // DC_ENABLED #endif // DC_ENABLED
} }
#endif // NDEBUG #endif // BC_DEBUG
void void
bc_program_init(BcProgram* p) bc_program_init(BcProgram* p)
@ -2883,11 +2891,11 @@ bc_program_init(BcProgram* p)
if (BC_IS_BC) bc_num_init(&p->last, BC_NUM_DEF_SIZE); if (BC_IS_BC) bc_num_init(&p->last, BC_NUM_DEF_SIZE);
#endif // BC_ENABLED #endif // BC_ENABLED
#ifndef NDEBUG #if BC_DEBUG
bc_vec_init(&p->fns, sizeof(BcFunc), BC_DTOR_FUNC); bc_vec_init(&p->fns, sizeof(BcFunc), BC_DTOR_FUNC);
#else // NDEBUG #else // BC_DEBUG
bc_vec_init(&p->fns, sizeof(BcFunc), BC_DTOR_NONE); bc_vec_init(&p->fns, sizeof(BcFunc), BC_DTOR_NONE);
#endif // NDEBUG #endif // BC_DEBUG
bc_map_init(&p->fn_map); bc_map_init(&p->fn_map);
bc_program_insertFunc(p, bc_func_main); bc_program_insertFunc(p, bc_func_main);
bc_program_insertFunc(p, bc_func_read); bc_program_insertFunc(p, bc_func_read);
@ -3002,9 +3010,9 @@ bc_program_exec(BcProgram* p)
BcNum* num; BcNum* num;
#endif // BC_ENABLED #endif // BC_ENABLED
#if !BC_HAS_COMPUTED_GOTO #if !BC_HAS_COMPUTED_GOTO
#ifndef NDEBUG #if BC_DEBUG
size_t jmp_bufs_len; size_t jmp_bufs_len;
#endif // NDEBUG #endif // BC_DEBUG
#endif // !BC_HAS_COMPUTED_GOTO #endif // !BC_HAS_COMPUTED_GOTO
#if BC_HAS_COMPUTED_GOTO #if BC_HAS_COMPUTED_GOTO
@ -3042,9 +3050,9 @@ bc_program_exec(BcProgram* p)
#if !BC_HAS_COMPUTED_GOTO #if !BC_HAS_COMPUTED_GOTO
#ifndef NDEBUG #if BC_DEBUG
jmp_bufs_len = vm->jmp_bufs.len; jmp_bufs_len = vm->jmp_bufs.len;
#endif // NDEBUG #endif // BC_DEBUG
// This loop is the heart of the execution engine. It *is* the engine. For // This loop is the heart of the execution engine. It *is* the engine. For
// computed goto, it is ignored. // computed goto, it is ignored.
@ -3246,6 +3254,9 @@ bc_program_exec(BcProgram* p)
#if BC_ENABLED #if BC_ENABLED
BC_PROG_LBL(BC_INST_GLOBAL_STACKS): BC_PROG_LBL(BC_INST_GLOBAL_STACKS):
#endif // BC_ENABLED #endif // BC_ENABLED
#if DC_ENABLED
BC_PROG_LBL(BC_INST_EXTENDED_REGISTERS):
#endif // DC_ENABLE
BC_PROG_LBL(BC_INST_LEADING_ZERO): BC_PROG_LBL(BC_INST_LEADING_ZERO):
// clang-format on // clang-format on
{ {
@ -3669,9 +3680,9 @@ bc_program_exec(BcProgram* p)
default: default:
{ {
BC_UNREACHABLE BC_UNREACHABLE
#if !defined(NDEBUG) && !BC_CLANG #if BC_DEBUG && !BC_CLANG
abort(); abort();
#endif // !defined(NDEBUG) && !BC_CLANG #endif // BC_DEBUG && !BC_CLANG
} }
#endif // BC_HAS_COMPUTED_GOTO #endif // BC_HAS_COMPUTED_GOTO
} }
@ -3688,12 +3699,12 @@ bc_program_exec(BcProgram* p)
#else // BC_HAS_COMPUTED_GOTO #else // BC_HAS_COMPUTED_GOTO
#ifndef NDEBUG #if BC_DEBUG
// This is to allow me to use a debugger to see the last instruction, // This is to allow me to use a debugger to see the last instruction,
// which will point to which function was the problem. But it's also a // which will point to which function was the problem. But it's also a
// good smoke test for error handling changes. // good smoke test for error handling changes.
assert(jmp_bufs_len == vm->jmp_bufs.len); assert(jmp_bufs_len == vm->jmp_bufs.len);
#endif // NDEBUG #endif // BC_DEBUG
#endif // BC_HAS_COMPUTED_GOTO #endif // BC_HAS_COMPUTED_GOTO
} }

View File

@ -279,11 +279,11 @@ bc_read_file(const char* path)
assert(path != NULL); assert(path != NULL);
#ifndef NDEBUG #if BC_DEBUG
// Need this to quiet MSan. // Need this to quiet MSan.
// NOLINTNEXTLINE // NOLINTNEXTLINE
memset(&pstat, 0, sizeof(struct stat)); memset(&pstat, 0, sizeof(struct stat));
#endif // NDEBUG #endif // BC_DEBUG
fd = bc_read_open(path, O_RDONLY); fd = bc_read_open(path, O_RDONLY);

View File

@ -101,9 +101,9 @@ bc_vm_jmp(void)
bc_file_flush(&vm->ferr, bc_flush_none); bc_file_flush(&vm->ferr, bc_flush_none);
#endif // BC_DEBUG_CODE #endif // BC_DEBUG_CODE
#ifndef NDEBUG #if BC_DEBUG
assert(vm->jmp_bufs.len - (size_t) vm->sig_pop); assert(vm->jmp_bufs.len - (size_t) vm->sig_pop);
#endif // NDEBUG #endif // BC_DEBUG
if (vm->jmp_bufs.len == 0) abort(); if (vm->jmp_bufs.len == 0) abort();
if (vm->sig_pop) bc_vec_pop(&vm->jmp_bufs); if (vm->sig_pop) bc_vec_pop(&vm->jmp_bufs);
@ -349,13 +349,13 @@ bc_vm_handleError(BcErr e)
BC_JMP; BC_JMP;
} }
#else // BC_ENABLE_LIBRARY #else // BC_ENABLE_LIBRARY
#ifndef NDEBUG #if BC_DEBUG
void void
bc_vm_handleError(BcErr e, const char* file, int fline, size_t line, ...) bc_vm_handleError(BcErr e, const char* file, int fline, size_t line, ...)
#else // NDEBUG #else // BC_DEBUG
void void
bc_vm_handleError(BcErr e, size_t line, ...) bc_vm_handleError(BcErr e, size_t line, ...)
#endif // NDEBUG #endif // BC_DEBUG
{ {
BcStatus s; BcStatus s;
va_list args; va_list args;
@ -423,9 +423,9 @@ bc_vm_handleError(BcErr e, size_t line, ...)
bc_file_putchar(&vm->ferr, bc_flush_none, '\n'); bc_file_putchar(&vm->ferr, bc_flush_none, '\n');
} }
#ifndef NDEBUG #if BC_DEBUG
bc_file_printf(&vm->ferr, "\n %s:%d\n", file, fline); bc_file_printf(&vm->ferr, "\n %s:%d\n", file, fline);
#endif // NDEBUG #endif // BC_DEBUG
bc_file_puts(&vm->ferr, bc_flush_none, "\n"); bc_file_puts(&vm->ferr, bc_flush_none, "\n");
@ -650,7 +650,7 @@ bc_vm_shutdown(void)
if (BC_TTY && !vm->history.badTerm) bc_history_free(&vm->history); if (BC_TTY && !vm->history.badTerm) bc_history_free(&vm->history);
#endif // BC_ENABLE_HISTORY #endif // BC_ENABLE_HISTORY
#ifndef NDEBUG #if BC_DEBUG
#if !BC_ENABLE_LIBRARY #if !BC_ENABLE_LIBRARY
bc_vec_free(&vm->env_args); bc_vec_free(&vm->env_args);
free(vm->env_args_buffer); free(vm->env_args_buffer);
@ -670,7 +670,7 @@ bc_vm_shutdown(void)
#endif // !BC_ENABLE_LIBRARY #endif // !BC_ENABLE_LIBRARY
bc_vm_freeTemps(); bc_vm_freeTemps();
#endif // NDEBUG #endif // BC_DEBUG
#if !BC_ENABLE_LIBRARY #if !BC_ENABLE_LIBRARY
// We always want to flush. // We always want to flush.
@ -1242,12 +1242,12 @@ bc_vm_stdin(void)
goto restart; goto restart;
} }
#ifndef NDEBUG #if BC_DEBUG
// Since these are tied to this function, free them here. We only free in // Since these are tied to this function, free them here. We only free in
// debug mode because stdin is always the last thing read. // debug mode because stdin is always the last thing read.
bc_vec_free(&vm->line_buf); bc_vec_free(&vm->line_buf);
bc_vec_free(&vm->buffer); bc_vec_free(&vm->buffer);
#endif // NDEBUG #endif // BC_DEBUG
BC_LONGJMP_CONT(vm); BC_LONGJMP_CONT(vm);
} }
@ -1767,17 +1767,17 @@ bc_vm_init(void)
void void
bc_vm_atexit(void) bc_vm_atexit(void)
{ {
#ifndef NDEBUG #if BC_DEBUG
#if BC_ENABLE_LIBRARY #if BC_ENABLE_LIBRARY
BcVm* vm = bcl_getspecific(); BcVm* vm = bcl_getspecific();
#endif // BC_ENABLE_LIBRARY #endif // BC_ENABLE_LIBRARY
#endif // NDEBUG #endif // BC_DEBUG
bc_vm_shutdown(); bc_vm_shutdown();
#ifndef NDEBUG #if BC_DEBUG
bc_vec_free(&vm->jmp_bufs); bc_vec_free(&vm->jmp_bufs);
#endif // NDEBUG #endif // BC_DEBUG
} }
#else // BC_ENABLE_LIBRARY #else // BC_ENABLE_LIBRARY
int int
@ -1788,9 +1788,9 @@ bc_vm_atexit(int status)
bc_vm_shutdown(); bc_vm_shutdown();
#ifndef NDEBUG #if BC_DEBUG
bc_vec_free(&vm->jmp_bufs); bc_vec_free(&vm->jmp_bufs);
#endif // NDEBUG #endif // BC_DEBUG
return s; return s;
} }

View File

@ -50,11 +50,12 @@ pll=1
while getopts "n" opt; do while getopts "n" opt; do
case "$opt" in case "$opt" in
n) pll=0 ; shift ; set -e ;; n) pll=0 ; set -e ;;
?) usage "Invalid option: $opt" ;; ?) usage "Invalid option: $opt" ;;
esac esac
done done
shift $(($OPTIND - 1))
# Command-line processing. # Command-line processing.
if [ "$#" -ge 1 ]; then if [ "$#" -ge 1 ]; then

View File

@ -109,7 +109,7 @@ fi
printf 'Running %s error file %s with clamping...' "$d" "$t" printf 'Running %s error file %s with clamping...' "$d" "$t"
printf '%s\n' "$halt" | "$exe" "$@" $opts -c "$testfile" 2> "$out" > /dev/null printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" $opts -c "$testfile" 2> "$out" > /dev/null
err="$?" err="$?"
checkerrtest "$d" "$err" "$testfile" "$out" "$exebase" > /dev/null checkerrtest "$d" "$err" "$testfile" "$out" "$exebase" > /dev/null
@ -118,7 +118,7 @@ printf 'pass\n'
printf 'Running %s error file %s without clamping...' "$d" "$t" printf 'Running %s error file %s without clamping...' "$d" "$t"
printf '%s\n' "$halt" | "$exe" "$@" $opts -C "$testfile" 2> "$out" > /dev/null printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" $opts -C "$testfile" 2> "$out" > /dev/null
err="$?" err="$?"
checkerrtest "$d" "$err" "$testfile" "$out" "$exebase" > /dev/null checkerrtest "$d" "$err" "$testfile" "$out" "$exebase" > /dev/null
@ -127,7 +127,7 @@ printf 'pass\n'
printf 'Running %s error file %s through cat with clamping...' "$d" "$t" printf 'Running %s error file %s through cat with clamping...' "$d" "$t"
cat "$testfile" | "$exe" "$@" $opts -c 2> "$out" > /dev/null cat "$testfile" 2> /dev/null | "$exe" "$@" $opts -c 2> "$out" > /dev/null
err="$?" err="$?"
checkerrtest "$d" "$err" "$testfile" "$out" "$exebase" checkerrtest "$d" "$err" "$testfile" "$out" "$exebase"
@ -136,7 +136,7 @@ printf 'pass\n'
printf 'Running %s error file %s through cat without clamping...' "$d" "$t" printf 'Running %s error file %s through cat without clamping...' "$d" "$t"
cat "$testfile" | "$exe" "$@" $opts -C 2> "$out" > /dev/null cat "$testfile" 2> /dev/null | "$exe" "$@" $opts -C 2> "$out" > /dev/null
err="$?" err="$?"
checkerrtest "$d" "$err" "$testfile" "$out" "$exebase" checkerrtest "$d" "$err" "$testfile" "$out" "$exebase"

View File

@ -98,12 +98,12 @@ fi
printf 'Running %s command-line error tests...' "$d" printf 'Running %s command-line error tests...' "$d"
printf '%s\n' "$halt" | "$exe" "$@" -e "1+1" -f- -e "2+2" 2> "$out" > /dev/null printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" -e "1+1" -f- -e "2+2" 2> "$out" > /dev/null
err="$?" err="$?"
checkerrtest "$d" "$err" "command-line -e test" "$out" "$exebase" checkerrtest "$d" "$err" "command-line -e test" "$out" "$exebase"
printf '%s\n' "$halt" | "$exe" "$@" -e "1+1" -f- -f "$testdir/$d/decimal.txt" 2> "$out" > /dev/null printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" -e "1+1" -f- -f "$testdir/$d/decimal.txt" 2> "$out" > /dev/null
err="$?" err="$?"
checkerrtest "$d" "$err" "command-line -f test" "$out" "$exebase" checkerrtest "$d" "$err" "command-line -f test" "$out" "$exebase"
@ -123,7 +123,7 @@ for testfile in $testdir/$d/*errors.txt; do
# Just test warnings. # Just test warnings.
line="last" line="last"
printf '%s\n' "$line" | "$exe" "$@" "-lw" 2> "$out" > /dev/null printf '%s\n' "$line" 2> /dev/null | "$exe" "$@" "-lw" 2> "$out" > /dev/null
err="$?" err="$?"
if [ "$err" -ne 0 ]; then if [ "$err" -ne 0 ]; then
@ -150,7 +150,7 @@ for testfile in $testdir/$d/*errors.txt; do
rm -f "$out" rm -f "$out"
printf '%s\n' "$line" | "$exe" "$@" "$options" 2> "$out" > /dev/null printf '%s\n' "$line" 2> /dev/null | "$exe" "$@" "$options" 2> "$out" > /dev/null
err="$?" err="$?"
checkerrtest "$d" "$err" "$line" "$out" "$exebase" checkerrtest "$d" "$err" "$line" "$out" "$exebase"

View File

@ -112,14 +112,14 @@ set +e
printf '\nRunning %s quit test...' "$d" printf '\nRunning %s quit test...' "$d"
printf '%s\n' "$halt" | "$exe" "$@" > /dev/null 2>&1 printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" > /dev/null 2>&1
checktest_retcode "$d" "$?" "quit" checktest_retcode "$d" "$?" "quit"
# bc has two halt or quit commands, so test the second as well. # bc has two halt or quit commands, so test the second as well.
if [ "$d" = bc ]; then if [ "$d" = bc ]; then
printf '%s\n' "quit" | "$exe" "$@" > /dev/null 2>&1 printf '%s\n' "quit" 2> /dev/null | "$exe" "$@" > /dev/null 2>&1
checktest_retcode "$d" "$?" quit checktest_retcode "$d" "$?" quit
@ -142,11 +142,11 @@ if [ "$d" = "bc" ]; then
export BC_ENV_ARGS=" '-l' '' -q" export BC_ENV_ARGS=" '-l' '' -q"
printf 's(.02893)\n' | "$exe" "$@" > /dev/null printf 's(.02893)\n' 2> /dev/null | "$exe" "$@" > /dev/null
checktest_retcode "$d" "$?" "environment var" checktest_retcode "$d" "$?" "environment var"
printf 'halt\n' | "$exe" "$@" -e 4 > /dev/null printf 'halt\n' 2> /dev/null | "$exe" "$@" -e 4 > /dev/null
err="$?" err="$?"
checktest_retcode "$d" "$?" "environment var" checktest_retcode "$d" "$?" "environment var"
@ -168,19 +168,19 @@ if [ "$d" = "bc" ]; then
printf '5\n0\n' > "$redefine_res" printf '5\n0\n' > "$redefine_res"
printf 'halt\n' | "$exe" "$@" --redefine=print -e 'define print(x) { x }' -e 'print(5)' > "$redefine_out" printf 'halt\n' 2> /dev/null | "$exe" "$@" --redefine=print -e 'define print(x) { x }' -e 'print(5)' > "$redefine_out"
err="$?" err="$?"
checktest "$d" "$err" "keyword redefinition" "$redefine_res" "$redefine_out" checktest "$d" "$err" "keyword redefinition" "$redefine_res" "$redefine_out"
printf 'halt\n' | "$exe" "$@" -r "abs" -r "else" -e 'abs = 5;else = 0' -e 'abs;else' > "$redefine_out" printf 'halt\n' 2> /dev/null | "$exe" "$@" -r "abs" -r "else" -e 'abs = 5;else = 0' -e 'abs;else' > "$redefine_out"
err="$?" err="$?"
checktest "$d" "$err" "keyword redefinition" "$redefine_res" "$redefine_out" checktest "$d" "$err" "keyword redefinition" "$redefine_res" "$redefine_out"
if [ "$extra_math" -ne 0 ]; then if [ "$extra_math" -ne 0 ]; then
printf 'halt\n' | "$exe" "$@" -lr abs -e "perm(5, 1)" -e "0" > "$redefine_out" printf 'halt\n' 2> /dev/null | "$exe" "$@" -lr abs -e "perm(5, 1)" -e "0" > "$redefine_out"
err="$?" err="$?"
checktest "$d" "$err" "keyword not redefined in builtin library" "$redefine_res" "$redefine_out" checktest "$d" "$err" "keyword not redefined in builtin library" "$redefine_res" "$redefine_out"
@ -204,7 +204,7 @@ if [ "$d" = "bc" ]; then
multiline_expr_out="$outputdir/bc_outputs/multiline_expr_results.txt" multiline_expr_out="$outputdir/bc_outputs/multiline_expr_results.txt"
# tests/bc/misc1.txt happens to have a multiline comment in it. # tests/bc/misc1.txt happens to have a multiline comment in it.
printf 'halt\n' | "$exe" "$@" -f "$testdir/bc/misc1.txt" > "$multiline_expr_out" printf 'halt\n' 2> /dev/null | "$exe" "$@" -f "$testdir/bc/misc1.txt" > "$multiline_expr_out"
err="$?" err="$?"
checktest "$d" "$err" "multiline comment in expression file" "$testdir/bc/misc1_results.txt" \ checktest "$d" "$err" "multiline comment in expression file" "$testdir/bc/misc1_results.txt" \
@ -213,7 +213,7 @@ if [ "$d" = "bc" ]; then
printf 'pass\n' printf 'pass\n'
printf 'Running multiline comment expression file error test...' printf 'Running multiline comment expression file error test...'
printf 'halt\n' | "$exe" "$@" -f "$testdir/bc/errors/05.txt" 2> "$multiline_expr_out" printf 'halt\n' 2> /dev/null | "$exe" "$@" -f "$testdir/bc/errors/05.txt" 2> "$multiline_expr_out"
err="$?" err="$?"
checkerrtest "$d" "$err" "multiline comment in expression file error" \ checkerrtest "$d" "$err" "multiline comment in expression file error" \
@ -223,7 +223,7 @@ if [ "$d" = "bc" ]; then
printf 'Running multiline string expression file test...' printf 'Running multiline string expression file test...'
# tests/bc/strings.txt happens to have a multiline string in it. # tests/bc/strings.txt happens to have a multiline string in it.
printf 'halt\n' | "$exe" "$@" -f "$testdir/bc/strings.txt" > "$multiline_expr_out" printf 'halt\n' 2> /dev/null | "$exe" "$@" -f "$testdir/bc/strings.txt" > "$multiline_expr_out"
err="$?" err="$?"
checktest "$d" "$err" "multiline string in expression file" "$testdir/bc/strings_results.txt" \ checktest "$d" "$err" "multiline string in expression file" "$testdir/bc/strings_results.txt" \
@ -232,13 +232,13 @@ if [ "$d" = "bc" ]; then
printf 'pass\n' printf 'pass\n'
printf 'Running multiline string expression file error test...' printf 'Running multiline string expression file error test...'
printf 'halt\n' | "$exe" "$@" -f "$testdir/bc/errors/16.txt" 2> "$multiline_expr_out" printf 'halt\n' 2> /dev/null | "$exe" "$@" -f "$testdir/bc/errors/16.txt" 2> "$multiline_expr_out"
err="$?" err="$?"
checkerrtest "$d" "$err" "multiline string in expression file with backslash error" \ checkerrtest "$d" "$err" "multiline string in expression file with backslash error" \
"$multiline_expr_out" "$d" "$multiline_expr_out" "$d"
printf 'halt\n' | "$exe" "$@" -f "$testdir/bc/errors/04.txt" 2> "$multiline_expr_out" printf 'halt\n' 2> /dev/null | "$exe" "$@" -f "$testdir/bc/errors/04.txt" 2> "$multiline_expr_out"
err="$?" err="$?"
checkerrtest "$d" "$err" "multiline string in expression file error" \ checkerrtest "$d" "$err" "multiline string in expression file error" \
@ -251,7 +251,7 @@ else
export DC_ENV_ARGS="'-x'" export DC_ENV_ARGS="'-x'"
export DC_EXPR_EXIT="1" export DC_EXPR_EXIT="1"
printf '4s stuff\n' | "$exe" "$@" > /dev/null printf '4s stuff\n' 2> /dev/null | "$exe" "$@" > /dev/null
checktest_retcode "$d" "$?" "environment var" checktest_retcode "$d" "$?" "environment var"
@ -266,15 +266,15 @@ else
# dc has an extra test for a case that someone found running this easter.dc # dc has an extra test for a case that someone found running this easter.dc
# script. It went into an infinite loop, so we want to check that we did not # script. It went into an infinite loop, so we want to check that we did not
# regress. # regress.
printf 'three\n' | cut -c1-3 > /dev/null printf 'three\n' 2> /dev/null | cut -c1-3 > /dev/null
err=$? err=$?
if [ "$err" -eq 0 ]; then if [ "$err" -eq 0 ]; then
printf 'Running dc Easter script...' printf 'Running dc Easter script...'
easter_res="$outputdir/dc_outputs/easter.txt" easter_out="$outputdir/dc_outputs/easter.txt"
easter_out="$outputdir/dc_outputs/easter_results.txt" easter_res="$outputdir/dc_outputs/easter_results.txt"
outdir=$(dirname "$easter_out") outdir=$(dirname "$easter_out")
@ -284,14 +284,44 @@ else
printf '4 April 2021\n' > "$easter_res" printf '4 April 2021\n' > "$easter_res"
"$testdir/dc/scripts/easter.sh" "$exe" 2021 "$@" | cut -c1-12 > "$easter_out" "$testdir/dc/scripts/easter.sh" "$exe" 2021 "$@" 2> /dev/null | cut -c1-12 > "$easter_out"
err="$?" err="$?"
checktest "$d" "$err" "Easter script" "$easter_res" "$easter_out" checktest "$d" "$err" "Easter script" "$easter_out" "$easter_res"
printf 'pass\n' printf 'pass\n'
fi fi
unset DC_ENV_ARGS
unset DC_EXPR_EXIT
printf 'Running dc extended register command tests...'
ext_reg_out="$outputdir/dc_outputs/ext_reg.txt"
ext_reg_res="$outputdir/dc_outputs/ext_reg_results.txt"
outdir=$(dirname "$ext_reg_out")
if [ ! -d "$outdir" ]; then
mkdir -p "$outdir"
fi
printf '0\n' > "$ext_reg_res"
"$exe" "$@" -e "gxpR" 2> /dev/null > "$ext_reg_out"
err="$?"
checktest "$d" "$err" "Extended register command" "$ext_reg_out" "$ext_reg_res"
printf '1\n' > "$ext_reg_res"
"$exe" "$@" -x -e "gxpR" 2> /dev/null > "$ext_reg_out"
err="$?"
checktest "$d" "$err" "Extended register command" "$ext_reg_out" "$ext_reg_res"
printf 'pass\n'
fi fi
out1="$outputdir/${d}_outputs/${d}_other.txt" out1="$outputdir/${d}_outputs/${d}_other.txt"
@ -302,26 +332,26 @@ printf 'Running %s line length tests...' "$d"
printf '%s\n' "$numres" > "$out1" printf '%s\n' "$numres" > "$out1"
export "$line_var"=80 export "$line_var"=80
printf '%s\n' "$num" | "$exe" "$@" > "$out2" printf '%s\n' "$num" 2> /dev/null | "$exe" "$@" > "$out2"
checktest "$d" "$?" "line length" "$out1" "$out2" checktest "$d" "$?" "line length" "$out1" "$out2"
printf '%s\n' "$num70" > "$out1" printf '%s\n' "$num70" > "$out1"
export "$line_var"=2147483647 export "$line_var"=2147483647
printf '%s\n' "$num" | "$exe" "$@" > "$out2" printf '%s\n' "$num" 2> /dev/null | "$exe" "$@" > "$out2"
checktest "$d" "$?" "line length 2" "$out1" "$out2" checktest "$d" "$?" "line length 2" "$out1" "$out2"
printf '%s\n' "$num2" > "$out1" printf '%s\n' "$num2" > "$out1"
export "$line_var"=62 export "$line_var"=62
printf '%s\n' "$num" | "$exe" "$@" -L > "$out2" printf '%s\n' "$num" 2> /dev/null | "$exe" "$@" -L > "$out2"
checktest "$d" "$?" "line length 3" "$out1" "$out2" checktest "$d" "$?" "line length 3" "$out1" "$out2"
printf '0\n' > "$out1" printf '0\n' > "$out1"
printf '%s\n' "$lltest" | "$exe" "$@" -L > "$out2" printf '%s\n' "$lltest" 2> /dev/null | "$exe" "$@" -L > "$out2"
checktest "$d" "$?" "line length 3" "$out1" "$out2" checktest "$d" "$?" "line length 3" "$out1" "$out2"
@ -342,23 +372,23 @@ printf '%s\n%s\n%s\n%s\n' "$results" "$results" "$results" "$results" > "$out1"
checktest "$d" "$?" "arg" "$out1" "$out2" checktest "$d" "$?" "arg" "$out1" "$out2"
printf '%s\n' "$halt" | "$exe" "$@" -- "$f" "$f" "$f" "$f" > "$out2" printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" -- "$f" "$f" "$f" "$f" > "$out2"
checktest "$d" "$?" "arg" "$out1" "$out2" checktest "$d" "$?" "arg" "$out1" "$out2"
if [ "$d" = "bc" ]; then if [ "$d" = "bc" ]; then
printf '%s\n' "$halt" | "$exe" "$@" -i > /dev/null 2>&1 printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" -i > /dev/null 2>&1
fi fi
printf '%s\n' "$halt" | "$exe" "$@" -h > /dev/null printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" -h > /dev/null
checktest_retcode "$d" "$?" "arg" checktest_retcode "$d" "$?" "arg"
printf '%s\n' "$halt" | "$exe" "$@" -P > /dev/null printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" -P > /dev/null
checktest_retcode "$d" "$?" "arg" checktest_retcode "$d" "$?" "arg"
printf '%s\n' "$halt" | "$exe" "$@" -R > /dev/null printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" -R > /dev/null
checktest_retcode "$d" "$?" "arg" checktest_retcode "$d" "$?" "arg"
printf '%s\n' "$halt" | "$exe" "$@" -v > /dev/null printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" -v > /dev/null
checktest_retcode "$d" "$?" "arg" checktest_retcode "$d" "$?" "arg"
printf '%s\n' "$halt" | "$exe" "$@" -V > /dev/null printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" -V > /dev/null
checktest_retcode "$d" "$?" "arg" checktest_retcode "$d" "$?" "arg"
out=$(printf '0.1\n-0.1\n1.1\n-1.1\n0.1\n-0.1\n') out=$(printf '0.1\n-0.1\n1.1\n-1.1\n0.1\n-0.1\n')
@ -370,12 +400,12 @@ else
data=$(printf '0.1pR\n_0.1pR\n1.1pR\n_1.1pR\n.1pR\n_.1pR\n') data=$(printf '0.1pR\n_0.1pR\n1.1pR\n_1.1pR\n.1pR\n_.1pR\n')
fi fi
printf '%s\n' "$data" | "$exe" "$@" -z > "$out2" printf '%s\n' "$data" 2> /dev/null | "$exe" "$@" -z > "$out2"
checktest "$d" "$?" "leading zero" "$out1" "$out2" checktest "$d" "$?" "leading zero" "$out1" "$out2"
if [ "$d" = "bc" ] && [ "$extra_math" -ne 0 ]; then if [ "$d" = "bc" ] && [ "$extra_math" -ne 0 ]; then
printf '%s\n' "$halt" | "$exe" "$@" -lz "$testdir/bc/leadingzero.txt" > "$out2" printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" -lz "$testdir/bc/leadingzero.txt" > "$out2"
checktest "$d" "$?" "leading zero script" "$testdir/bc/leadingzero_results.txt" "$out2" checktest "$d" "$?" "leading zero script" "$testdir/bc/leadingzero_results.txt" "$out2"
@ -446,10 +476,10 @@ if [ "$extra_math" -ne 0 ]; then
data=$(printf 'J2@OIKAiAopRpRpRpR') data=$(printf 'J2@OIKAiAopRpRpRpR')
fi fi
printf '%s\n' "$data" | "$exe" "$@" -S14 -I15 -O16 -E17.25 > "$out2" printf '%s\n' "$data" 2> /dev/null | "$exe" "$@" -S14 -I15 -O16 -E17.25 > "$out2"
checktest "$d" "$?" "builtin variable args" "$out1" "$out2" checktest "$d" "$?" "builtin variable args" "$out1" "$out2"
printf '%s\n' "$data" | "$exe" "$@" --scale=14 --ibase=15 --obase=16 --seed=17.25 > "$out2" printf '%s\n' "$data" 2> /dev/null | "$exe" "$@" --scale=14 --ibase=15 --obase=16 --seed=17.25 > "$out2"
checktest "$d" "$?" "builtin variable long args" "$out1" "$out2" checktest "$d" "$?" "builtin variable long args" "$out1" "$out2"
else else
@ -463,10 +493,10 @@ else
data=$(printf 'OIKAiAopRpRpR') data=$(printf 'OIKAiAopRpRpR')
fi fi
printf '%s\n' "$data" | "$exe" "$@" -S14 -I15 -O16 > "$out2" printf '%s\n' "$data" 2> /dev/null | "$exe" "$@" -S14 -I15 -O16 > "$out2"
checktest "$d" "$?" "builtin variable args" "$out1" "$out2" checktest "$d" "$?" "builtin variable args" "$out1" "$out2"
printf '%s\n' "$data" | "$exe" "$@" --scale=14 --ibase=15 --obase=16 > "$out2" printf '%s\n' "$data" 2> /dev/null | "$exe" "$@" --scale=14 --ibase=15 --obase=16 > "$out2"
checktest "$d" "$?" "builtin variable long args" "$out1" "$out2" checktest "$d" "$?" "builtin variable long args" "$out1" "$out2"
fi fi
@ -476,40 +506,40 @@ if [ "$d" = "bc" ]; then
out=$(printf '100\n') out=$(printf '100\n')
printf '%s\n' "$out" > "$out1" printf '%s\n' "$out" > "$out1"
printf 'scale\n' | "$exe" "$@" -S100 -l > "$out2" printf 'scale\n' 2> /dev/null | "$exe" "$@" -S100 -l > "$out2"
checktest "$d" "$?" "builtin variable args with math lib" "$out1" "$out2" checktest "$d" "$?" "builtin variable args with math lib" "$out1" "$out2"
printf 'scale\n' | "$exe" "$@" --scale=100 --mathlib > "$out2" printf 'scale\n' 2> /dev/null | "$exe" "$@" --scale=100 --mathlib > "$out2"
checktest "$d" "$?" "builtin variable long args with math lib" "$out1" "$out2" checktest "$d" "$?" "builtin variable long args with math lib" "$out1" "$out2"
export BC_ENV_ARGS="-l" export BC_ENV_ARGS="-l"
printf 'scale\n' | "$exe" "$@" -S100 > "$out2" printf 'scale\n' 2> /dev/null | "$exe" "$@" -S100 > "$out2"
checktest "$d" "$?" "builtin variable args with math lib env arg" "$out1" "$out2" checktest "$d" "$?" "builtin variable args with math lib env arg" "$out1" "$out2"
printf 'scale\n' | "$exe" "$@" --scale=100 > "$out2" printf 'scale\n' 2> /dev/null | "$exe" "$@" --scale=100 > "$out2"
checktest "$d" "$?" "builtin variable long args with math lib env arg" "$out1" "$out2" checktest "$d" "$?" "builtin variable long args with math lib env arg" "$out1" "$out2"
export BC_ENV_ARGS="-S100" export BC_ENV_ARGS="-S100"
printf 'scale\n' | "$exe" "$@" -l > "$out2" printf 'scale\n' 2> /dev/null | "$exe" "$@" -l > "$out2"
checktest "$d" "$?" "builtin variable args with math lib arg" "$out1" "$out2" checktest "$d" "$?" "builtin variable args with math lib arg" "$out1" "$out2"
export BC_ENV_ARGS="--scale=100" export BC_ENV_ARGS="--scale=100"
printf 'scale\n' | "$exe" "$@" -l > "$out2" printf 'scale\n' 2> /dev/null | "$exe" "$@" -l > "$out2"
checktest "$d" "$?" "builtin variable long args with math lib arg" "$out1" "$out2" checktest "$d" "$?" "builtin variable long args with math lib arg" "$out1" "$out2"
fi fi
printf 'scale\n' | "$exe" "$@" --scale=18923c.rlg > /dev/null 2> "$out2" printf 'scale\n' 2> /dev/null | "$exe" "$@" --scale=18923c.rlg > /dev/null 2> "$out2"
err="$?" err="$?"
checkerrtest "$d" "$err" "invalid command-line arg for builtin variable" "$out2" "$d" checkerrtest "$d" "$err" "invalid command-line arg for builtin variable" "$out2" "$d"
if [ "$extra_math" -ne 0 ]; then if [ "$extra_math" -ne 0 ]; then
printf 'seed\n' | "$exe" "$@" --seed=18923c.rlg > /dev/null 2> "$out2" printf 'seed\n' 2> /dev/null | "$exe" "$@" --seed=18923c.rlg > /dev/null 2> "$out2"
err="$?" err="$?"
checkerrtest "$d" "$err" "invalid command-line arg for seed" "$out2" "$d" checkerrtest "$d" "$err" "invalid command-line arg for seed" "$out2" "$d"
@ -540,7 +570,7 @@ printf 'pass\n'
printf 'Running %s binary stdin test...' "$d" printf 'Running %s binary stdin test...' "$d"
cat "$bin" | "$exe" "$@" > /dev/null 2> "$out2" cat "$bin" 2> /dev/null | "$exe" "$@" > /dev/null 2> "$out2"
err="$?" err="$?"
checkerrtest "$d" "$err" "binary stdin" "$out2" "$d" checkerrtest "$d" "$err" "binary stdin" "$out2" "$d"
@ -550,7 +580,7 @@ printf 'pass\n'
if [ "$d" = "bc" ]; then if [ "$d" = "bc" ]; then
printf 'Running %s limits tests...' "$d" printf 'Running %s limits tests...' "$d"
printf 'limits\n' | "$exe" "$@" /dev/null > "$out2" 2>&1 printf 'limits\n' 2> /dev/null | "$exe" "$@" /dev/null > "$out2" 2>&1
checktest_retcode "$d" "$?" "limits" checktest_retcode "$d" "$?" "limits"

View File

@ -194,7 +194,7 @@ else
# where GNU bc is wrong. See the development manual # where GNU bc is wrong. See the development manual
# (manuals/development.md#script-tests) for more information. # (manuals/development.md#script-tests) for more information.
printf 'Generating %s results...' "$f" printf 'Generating %s results...' "$f"
printf '%s\n' "$halt" | "$d" "$s" | sed -n -f "$testdir/script.sed" > "$results" printf '%s\n' "$halt" 2> /dev/null | "$d" "$s" | sed -n -f "$testdir/script.sed" > "$results"
printf 'done\n' printf 'done\n'
res="$results" res="$results"
fi fi
@ -206,11 +206,11 @@ printf 'Running %s script %s...' "$d" "$f"
# Yes this is poor timing, but it works. # Yes this is poor timing, but it works.
if [ "$time_tests" -ne 0 ]; then if [ "$time_tests" -ne 0 ]; then
printf '\n' printf '\n'
printf '%s\n' "$halt" | /usr/bin/time -p "$exe" "$@" $options "$s" > "$out" printf '%s\n' "$halt" 2> /dev/null | /usr/bin/time -p "$exe" "$@" $options "$s" > "$out"
err="$?" err="$?"
printf '\n' printf '\n'
else else
printf '%s\n' "$halt" | "$exe" "$@" $options "$s" > "$out" printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" $options "$s" > "$out"
err="$?" err="$?"
fi fi

View File

@ -31,6 +31,8 @@ script="$0"
testdir=$(dirname "${script}") testdir=$(dirname "${script}")
. "$testdir/../scripts/functions.sh"
# Just print the usage and exit with an error. This can receive a message to # Just print the usage and exit with an error. This can receive a message to
# print. # print.
# @param 1 A message to print. # @param 1 A message to print.
@ -50,11 +52,12 @@ pll=1
while getopts "n" opt; do while getopts "n" opt; do
case "$opt" in case "$opt" in
n) pll=0 ; shift ; set -e ;; n) pll=0 ; set -e ;;
?) usage "Invalid option: $opt" ;; ?) usage "Invalid option: $opt" ;;
esac esac
done done
shift $(($OPTIND - 1))
# Command-line processing. # Command-line processing.
if [ "$#" -eq 0 ]; then if [ "$#" -eq 0 ]; then

View File

@ -138,7 +138,7 @@ fi
# If the results do not exist, generate.. # If the results do not exist, generate..
if [ ! -f "$results" ]; then if [ ! -f "$results" ]; then
printf 'Generating %s %s results...' "$d" "$t" printf 'Generating %s %s results...' "$d" "$t"
printf '%s\n' "$halt" | "$d" $options "$name" > "$results" printf '%s\n' "$halt" 2> /dev/null | "$d" $options "$name" > "$results"
printf 'done\n' printf 'done\n'
fi fi
@ -157,11 +157,11 @@ printf 'Running %s %s...' "$d" "$t"
if [ "$time_tests" -ne 0 ]; then if [ "$time_tests" -ne 0 ]; then
printf '\n' printf '\n'
printf '%s\n' "$halt" | /usr/bin/time -p "$exe" "$@" $options "$name" > "$out" printf '%s\n' "$halt" 2> /dev/null | /usr/bin/time -p "$exe" "$@" $options "$name" > "$out"
err="$?" err="$?"
printf '\n' printf '\n'
else else
printf '%s\n' "$halt" | "$exe" "$@" $options "$name" > "$out" printf '%s\n' "$halt" 2> /dev/null | "$exe" "$@" $options "$name" > "$out"
err="$?" err="$?"
fi fi

View File

@ -295,4 +295,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>