diff options
| author | Stefan Eßer <se@FreeBSD.org> | 2023-02-24 22:14:58 +0000 |
|---|---|---|
| committer | Stefan Eßer <se@FreeBSD.org> | 2023-02-24 22:14:58 +0000 |
| commit | 61e1a12bb6c3bfdb0a4e499c88e8eaa2b548e427 (patch) | |
| tree | 86bf7579a17d0deeccf9d4a705c36eed3b1e3273 /include | |
| parent | aaf1213c6f70af0b517f6aa13cd837d3468a7a0d (diff) | |
Diffstat (limited to 'include')
| -rw-r--r-- | include/bcl.h | 6 | ||||
| -rw-r--r-- | include/lang.h | 7 | ||||
| -rw-r--r-- | include/lex.h | 17 | ||||
| -rw-r--r-- | include/parse.h | 14 | ||||
| -rw-r--r-- | include/program.h | 12 | ||||
| -rw-r--r-- | include/rand.h | 6 | ||||
| -rw-r--r-- | include/status.h | 24 | ||||
| -rw-r--r-- | include/vector.h | 4 | ||||
| -rw-r--r-- | include/version.h | 2 | ||||
| -rw-r--r-- | include/vm.h | 6 |
10 files changed, 57 insertions, 41 deletions
diff --git a/include/bcl.h b/include/bcl.h index 234fe475f00e..253138231c66 100644 --- a/include/bcl.h +++ b/include/bcl.h @@ -41,6 +41,12 @@ #include <limits.h> #include <stdint.h> +#ifndef NDEBUG +#define BC_DEBUG (1) +#else // NDEBUG +#define BC_DEBUG (0) +#endif // NDEBUG + #ifdef _WIN32 #include <Windows.h> #include <BaseTsd.h> diff --git a/include/lang.h b/include/lang.h index 2d9776532249..97aeeaa98da8 100644 --- a/include/lang.h +++ b/include/lang.h @@ -277,6 +277,9 @@ typedef enum BcInst #if DC_ENABLED + /// dc extended registers command. + BC_INST_EXTENDED_REGISTERS, + /// dc's return; it pops an executing string off of the stack. BC_INST_POP_EXEC, @@ -575,7 +578,7 @@ bc_func_insert(BcFunc* f, struct BcProgram* p, char* name, BcType type, void bc_func_reset(BcFunc* f); -#ifndef NDEBUG +#if BC_DEBUG /** * 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 @@ -584,7 +587,7 @@ bc_func_reset(BcFunc* f); */ void 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 diff --git a/include/lex.h b/include/lex.h index 54d704f8b447..ac9b7b6ea69c 100644 --- a/include/lex.h +++ b/include/lex.h @@ -49,11 +49,11 @@ * @param l The lexer. * @param e The error. */ -#ifndef NDEBUG +#if BC_DEBUG #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)) -#endif // NDEBUG +#endif // BC_DEBUG /** * A convenience macro for throwing errors in lex code. This takes care of @@ -61,12 +61,12 @@ * @param l The lexer. * @param e The error. */ -#ifndef NDEBUG +#if BC_DEBUG #define bc_lex_verr(l, e, ...) \ (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__)) -#endif // NDEBUG +#endif // BC_DEBUG // BC_LEX_NEG_CHAR returns the char that corresponds to negative for the // current calculator. @@ -409,6 +409,9 @@ typedef enum BcLexType #if DC_ENABLED + /// dc extended registers keyword. + BC_LEX_EXTENDED_REGISTERS, + /// A special token for dc to calculate equal without a register. BC_LEX_EQ_NO_REG, @@ -533,7 +536,7 @@ void 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 * that parser needs a lexer. * @param l The lexer to free. diff --git a/include/parse.h b/include/parse.h index 2527aeb824f8..ece413e7bd74 100644 --- a/include/parse.h +++ b/include/parse.h @@ -110,12 +110,12 @@ * @param p The parser. * @param e The error. */ -#ifndef NDEBUG +#if BC_DEBUG #define bc_parse_err(p, e) \ (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)) -#endif // NDEBUG +#endif // BC_DEBUG /** * A convenience macro for throwing errors in parse code. This takes care of @@ -124,13 +124,13 @@ * @param e The error. * @param ... The varags that are needed. */ -#ifndef NDEBUG +#if BC_DEBUG #define bc_parse_verr(p, e, ...) \ (bc_vm_handleError((e), __FILE__, __LINE__, (p)->l.line, __VA_ARGS__)) -#else // NDEBUG +#else // BC_DEBUG #define bc_parse_verr(p, e, ...) \ (bc_vm_handleError((e), (p)->l.line, __VA_ARGS__)) -#endif // NDEBUG +#endif // BC_DEBUG // Forward declarations. struct BcParse; @@ -215,7 +215,7 @@ void 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. * @param p The parser to free. */ diff --git a/include/program.h b/include/program.h index 3a3ea6c9dab7..ff32d5db7760 100644 --- a/include/program.h +++ b/include/program.h @@ -247,9 +247,9 @@ typedef struct BcProgram // 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 // items. -#ifdef NDEBUG +#ifdef BC_DEBUG #define BC_PROG_NO_STACK_CHECK -#endif // NDEBUG +#endif // BC_DEBUG #endif // DC_ENABLED @@ -298,7 +298,7 @@ typedef void (*BcProgramUnary)(BcResult* r, BcNum* n); void bc_program_init(BcProgram* p); -#ifndef NDEBUG +#if BC_DEBUG /** * Frees a BcProgram. This is only used in debug builds because a BcProgram is @@ -309,7 +309,7 @@ bc_program_init(BcProgram* p); void bc_program_free(BcProgram* p); -#endif // NDEBUG +#endif // BC_DEBUG /** * 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_DIVMOD, \ &&lbl_BC_INST_PRINT_STREAM, \ + &&lbl_BC_INST_EXTENDED_REGISTERS, \ &&lbl_BC_INST_POP_EXEC, \ &&lbl_BC_INST_EXECUTE, \ &&lbl_BC_INST_EXEC_COND, \ @@ -701,6 +702,7 @@ extern const char bc_program_esc_seqs[]; &&lbl_BC_INST_MODEXP, \ &&lbl_BC_INST_DIVMOD, \ &&lbl_BC_INST_PRINT_STREAM, \ + &&lbl_BC_INST_EXTENDED_REGISTERS, \ &&lbl_BC_INST_POP_EXEC, \ &&lbl_BC_INST_EXECUTE, \ &&lbl_BC_INST_EXEC_COND, \ @@ -959,6 +961,7 @@ extern const char bc_program_esc_seqs[]; &&lbl_BC_INST_MODEXP, \ &&lbl_BC_INST_DIVMOD, \ &&lbl_BC_INST_PRINT_STREAM, \ + &&lbl_BC_INST_EXTENDED_REGISTERS, \ &&lbl_BC_INST_POP_EXEC, \ &&lbl_BC_INST_EXECUTE, \ &&lbl_BC_INST_EXEC_COND, \ @@ -1027,6 +1030,7 @@ extern const char bc_program_esc_seqs[]; &&lbl_BC_INST_MODEXP, \ &&lbl_BC_INST_DIVMOD, \ &&lbl_BC_INST_PRINT_STREAM, \ + &&lbl_BC_INST_EXTENDED_REGISTERS, \ &&lbl_BC_INST_POP_EXEC, \ &&lbl_BC_INST_EXECUTE, \ &&lbl_BC_INST_EXEC_COND, \ diff --git a/include/rand.h b/include/rand.h index 7db0ee90af1f..e516295d7c5c 100644 --- a/include/rand.h +++ b/include/rand.h @@ -53,11 +53,11 @@ #if BC_ENABLE_LIBRARY #define BC_RAND_USE_FREE (1) #else // BC_ENABLE_LIBRARY -#ifndef NDEBUG +#if BC_DEBUG #define BC_RAND_USE_FREE (1) -#else // NDEBUG +#else // BC_DEBUG #define BC_RAND_USE_FREE (0) -#endif // NDEBUG +#endif // BC_DEBUG #endif // BC_ENABLE_LIBRARY /** diff --git a/include/status.h b/include/status.h index 9962d58d0be0..198cf5704a57 100644 --- a/include/status.h +++ b/include/status.h @@ -700,7 +700,7 @@ typedef enum BcMode #define BC_SIG_INTERRUPT(vm) BC_UNLIKELY((vm)->sig != 0) #endif // _WIN32 -#ifndef NDEBUG +#if BC_DEBUG /// 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 @@ -724,7 +724,7 @@ typedef enum BcMode } \ while (0) -#else // NDEBUG +#else // BC_DEBUG /// 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 @@ -738,7 +738,7 @@ typedef enum BcMode /// (no-op in non-debug mode) that check that signals are unlocked. #define BC_SIG_ASSERT_NOT_LOCKED -#endif // NDEBUG +#endif // BC_DEBUG /// Locks signals. #define BC_SIG_LOCK \ @@ -957,33 +957,33 @@ typedef enum BcMode * @param l The line of the script that the error happened. * @param ... Extra arguments for error messages as necessary. */ -#ifndef NDEBUG +#if BC_DEBUG #define bc_error(e, l, ...) \ (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__)) -#endif // NDEBUG +#endif // BC_DEBUG /** * Call bc's error handling routine. * @param e The error. */ -#ifndef NDEBUG +#if BC_DEBUG #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)) -#endif // NDEBUG +#endif // BC_DEBUG /** * Call bc's error handling routine. * @param e The error. */ -#ifndef NDEBUG +#if BC_DEBUG #define bc_verr(e, ...) \ (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__)) -#endif // NDEBUG +#endif // BC_DEBUG #endif // BC_ENABLE_LIBRARY diff --git a/include/vector.h b/include/vector.h index 51c5e8b95293..b86be1424537 100644 --- a/include/vector.h +++ b/include/vector.h @@ -85,12 +85,12 @@ typedef enum BcDtorType #if !BC_ENABLE_LIBRARY -#ifndef NDEBUG +#if BC_DEBUG /// BcFunc destructor. BC_DTOR_FUNC, -#endif // NDEBUG +#endif // BC_DEBUG /// BcSlab destructor. BC_DTOR_SLAB, diff --git a/include/version.h b/include/version.h index 6d8ddfea0940..f5e345b3b189 100644 --- a/include/version.h +++ b/include/version.h @@ -37,6 +37,6 @@ #define BC_VERSION_H /// The current version. -#define VERSION 6.2.4 +#define VERSION 6.3.1 #endif // BC_VERSION_H diff --git a/include/vm.h b/include/vm.h index 1c303add2de0..dd21d43f5260 100644 --- a/include/vm.h +++ b/include/vm.h @@ -999,7 +999,7 @@ bc_vm_atexit(void); size_t 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 @@ -1013,7 +1013,7 @@ bc_vm_numDigits(size_t val); void 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 @@ -1025,7 +1025,7 @@ bc_vm_handleError(BcErr e, const char* file, int fline, size_t line, ...); void bc_vm_handleError(BcErr e, size_t line, ...); -#endif // NDEBUG +#endif // BC_DEBUG /** * Handle a fatal error. |
