aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/args.h4
-rw-r--r--include/bc.h10
-rw-r--r--include/dc.h8
-rw-r--r--include/file.h4
-rw-r--r--include/history.h6
-rw-r--r--include/lang.h23
-rw-r--r--include/lex.h35
-rw-r--r--include/num.h16
-rw-r--r--include/opt.h4
-rw-r--r--include/parse.h5
-rw-r--r--include/program.h12
-rw-r--r--include/rand.h12
-rw-r--r--include/read.h11
-rw-r--r--include/status.h4
-rw-r--r--include/vector.h4
-rw-r--r--include/vm.h59
16 files changed, 140 insertions, 77 deletions
diff --git a/include/args.h b/include/args.h
index af851e3092ea..f2bc2d6bab05 100644
--- a/include/args.h
+++ b/include/args.h
@@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * SPDX-License-Identifier: BSD-2-Clause
*
- * All rights reserved.
+ * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/include/bc.h b/include/bc.h
index dd4fa435cf72..ade18c828c28 100644
--- a/include/bc.h
+++ b/include/bc.h
@@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * SPDX-License-Identifier: BSD-2-Clause
*
- * All rights reserved.
+ * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -130,13 +130,13 @@ void bc_lex_token(BcLex *l);
#define BC_PARSE_LEAF(prev, bin_last, rparen) \
(!(bin_last) && ((rparen) || bc_parse_inst_isLeaf(prev)))
-#if BC_ENABLE_EXTRA_MATH
+#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
#define BC_PARSE_INST_VAR(t) \
((t) >= BC_INST_VAR && (t) <= BC_INST_SEED && (t) != BC_INST_ARRAY)
-#else // BC_ENABLE_EXTRA_MATH
+#else // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
#define BC_PARSE_INST_VAR(t) \
((t) >= BC_INST_VAR && (t) <= BC_INST_SCALE && (t) != BC_INST_ARRAY)
-#endif // BC_ENABLE_EXTRA_MATH
+#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
#define BC_PARSE_PREV_PREFIX(p) \
((p) >= BC_INST_NEG && (p) <= BC_INST_BOOL_NOT)
diff --git a/include/dc.h b/include/dc.h
index 1155307d5c43..07af135bc38f 100644
--- a/include/dc.h
+++ b/include/dc.h
@@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * SPDX-License-Identifier: BSD-2-Clause
*
- * All rights reserved.
+ * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -36,10 +36,6 @@
#ifndef BC_DC_H
#define BC_DC_H
-#ifndef DC_ENABLE_RAND
-#define DC_ENABLE_RAND (1)
-#endif // DC_ENABLE_RAND
-
#if DC_ENABLED
#include <status.h>
diff --git a/include/file.h b/include/file.h
index 948262b89e5f..0ba8caa80c98 100644
--- a/include/file.h
+++ b/include/file.h
@@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * SPDX-License-Identifier: BSD-2-Clause
*
- * All rights reserved.
+ * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/include/history.h b/include/history.h
index 9eac69bc9db0..c632bc81a2a0 100644
--- a/include/history.h
+++ b/include/history.h
@@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * SPDX-License-Identifier: BSD-2-Clause
*
- * All rights reserved.
+ * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -47,8 +47,6 @@
* Copyright (c) 2010-2016, Salvatore Sanfilippo <antirez at gmail dot com>
* Copyright (c) 2010-2013, Pieter Noordhuis <pcnoordhuis at gmail dot com>
*
- * All rights reserved.
- *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
diff --git a/include/lang.h b/include/lang.h
index c1b9606b8f0d..a8ab08ad9bf4 100644
--- a/include/lang.h
+++ b/include/lang.h
@@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * SPDX-License-Identifier: BSD-2-Clause
*
- * All rights reserved.
+ * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -129,6 +129,7 @@ typedef enum BcInst {
BC_INST_ARRAY,
#endif // BC_ENABLED
+ BC_INST_ZERO,
BC_INST_ONE,
#if BC_ENABLED
@@ -137,26 +138,26 @@ typedef enum BcInst {
BC_INST_IBASE,
BC_INST_OBASE,
BC_INST_SCALE,
-#if BC_ENABLE_EXTRA_MATH
+#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_SEED,
-#endif // BC_ENABLE_EXTRA_MATH
+#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_LENGTH,
BC_INST_SCALE_FUNC,
BC_INST_SQRT,
BC_INST_ABS,
-#if BC_ENABLE_EXTRA_MATH
+#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_IRAND,
-#endif // BC_ENABLE_EXTRA_MATH
+#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_READ,
-#if BC_ENABLE_EXTRA_MATH
+#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_RAND,
-#endif // BC_ENABLE_EXTRA_MATH
+#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_MAXIBASE,
BC_INST_MAXOBASE,
BC_INST_MAXSCALE,
-#if BC_ENABLE_EXTRA_MATH
+#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_MAXRAND,
-#endif // BC_ENABLE_EXTRA_MATH
+#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_INST_PRINT,
BC_INST_PRINT_POP,
@@ -252,9 +253,9 @@ typedef enum BcResultType {
BC_RESULT_STR,
- BC_RESULT_CONSTANT,
BC_RESULT_TEMP,
+ BC_RESULT_ZERO,
BC_RESULT_ONE,
#if BC_ENABLED
diff --git a/include/lex.h b/include/lex.h
index fcc30ae53b9a..68b72a7f59bb 100644
--- a/include/lex.h
+++ b/include/lex.h
@@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * SPDX-License-Identifier: BSD-2-Clause
*
- * All rights reserved.
+ * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -46,8 +46,23 @@
#define bc_lex_err(l, e) (bc_vm_error((e), (l)->line))
#define bc_lex_verr(l, e, ...) (bc_vm_error((e), (l)->line, __VA_ARGS__))
+#if BC_ENABLED
+
+#if DC_ENABLED
#define BC_LEX_NEG_CHAR (BC_IS_BC ? '-' : '_')
#define BC_LEX_LAST_NUM_CHAR (BC_IS_BC ? 'Z' : 'F')
+#else // DC_ENABLED
+#define BC_LEX_NEG_CHAR ('-')
+#define BC_LEX_LAST_NUM_CHAR ('Z')
+#endif // DC_ENABLED
+
+#else // BC_ENABLED
+
+#define BC_LEX_NEG_CHAR ('_')
+#define BC_LEX_LAST_NUM_CHAR ('F')
+
+#endif // BC_ENABLED
+
#define BC_LEX_NUM_CHAR(c, pt, int_only) \
(isdigit(c) || ((c) >= 'A' && (c) <= BC_LEX_LAST_NUM_CHAR) || \
((c) == '.' && !(pt) && !(int_only)))
@@ -142,27 +157,27 @@ typedef enum BcLexType {
BC_LEX_KW_IBASE,
BC_LEX_KW_OBASE,
BC_LEX_KW_SCALE,
-#if BC_ENABLE_EXTRA_MATH
+#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_LEX_KW_SEED,
-#endif // BC_ENABLE_EXTRA_MATH
+#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_LEX_KW_LENGTH,
BC_LEX_KW_PRINT,
BC_LEX_KW_SQRT,
BC_LEX_KW_ABS,
-#if BC_ENABLE_EXTRA_MATH
+#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_LEX_KW_IRAND,
-#endif // BC_ENABLE_EXTRA_MATH
+#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_LEX_KW_QUIT,
BC_LEX_KW_READ,
-#if BC_ENABLE_EXTRA_MATH
+#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_LEX_KW_RAND,
-#endif // BC_ENABLE_EXTRA_MATH
+#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_LEX_KW_MAXIBASE,
BC_LEX_KW_MAXOBASE,
BC_LEX_KW_MAXSCALE,
-#if BC_ENABLE_EXTRA_MATH
+#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_LEX_KW_MAXRAND,
-#endif // BC_ENABLE_EXTRA_MATH
+#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BC_LEX_KW_ELSE,
#if DC_ENABLED
diff --git a/include/num.h b/include/num.h
index 0b16ef844036..239daf908834 100644
--- a/include/num.h
+++ b/include/num.h
@@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * SPDX-License-Identifier: BSD-2-Clause
*
- * All rights reserved.
+ * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -110,8 +110,16 @@ typedef struct BcNum {
} BcNum;
#if BC_ENABLE_EXTRA_MATH
+
+#ifndef BC_ENABLE_RAND
+#define BC_ENABLE_RAND (1)
+#endif // BC_ENABLE_RAND
+
+#if BC_ENABLE_RAND
// Forward declaration
struct BcRNG;
+#endif // BC_ENABLE_RAND
+
#endif // BC_ENABLE_EXTRA_MATH
#define BC_NUM_MIN_BASE (BC_NUM_BIGDIG_C(2))
@@ -173,12 +181,12 @@ void bc_num_bigdig(const BcNum *restrict n, BcBigDig *result);
void bc_num_bigdig2(const BcNum *restrict n, BcBigDig *result);
void bc_num_bigdig2num(BcNum *restrict n, BcBigDig val);
-#if BC_ENABLE_EXTRA_MATH
+#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
void bc_num_irand(const BcNum *restrict a, BcNum *restrict b,
struct BcRNG *restrict rng);
void bc_num_rng(const BcNum *restrict n, struct BcRNG *rng);
void bc_num_createFromRNG(BcNum *restrict n, struct BcRNG *rng);
-#endif // BC_ENABLE_EXTRA_MATH
+#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
void bc_num_add(BcNum *a, BcNum *b, BcNum *c, size_t scale);
void bc_num_sub(BcNum *a, BcNum *b, BcNum *c, size_t scale);
diff --git a/include/opt.h b/include/opt.h
index f57238571889..eb3d5959adc0 100644
--- a/include/opt.h
+++ b/include/opt.h
@@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * SPDX-License-Identifier: BSD-2-Clause
*
- * All rights reserved.
+ * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/include/parse.h b/include/parse.h
index e83a3c4acf96..a568fab13e64 100644
--- a/include/parse.h
+++ b/include/parse.h
@@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * SPDX-License-Identifier: BSD-2-Clause
*
- * All rights reserved.
+ * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -110,6 +110,7 @@ void bc_parse_updateFunc(BcParse *p, size_t fidx);
void bc_parse_pushName(const BcParse* p, char *name, bool var);
void bc_parse_text(BcParse *p, const char *text);
+extern const char bc_parse_zero[];
extern const char bc_parse_one[];
#endif // BC_PARSE_H
diff --git a/include/program.h b/include/program.h
index c998a5038c69..a9805fbfb316 100644
--- a/include/program.h
+++ b/include/program.h
@@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * SPDX-License-Identifier: BSD-2-Clause
*
- * All rights reserved.
+ * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -61,9 +61,9 @@ typedef struct BcProgram {
BcBigDig globals[BC_PROG_GLOBALS_LEN];
BcVec globals_v[BC_PROG_GLOBALS_LEN];
-#if BC_ENABLE_EXTRA_MATH
+#if BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BcRNG rng;
-#endif // BC_ENABLE_EXTRA_MATH
+#endif // BC_ENABLE_EXTRA_MATH && BC_ENABLE_RAND
BcVec results;
BcVec stack;
@@ -81,12 +81,15 @@ typedef struct BcProgram {
BcVec arr_map;
#if DC_ENABLED
+ BcVec strs_v;
+
BcVec tail_calls;
BcBigDig strm;
BcNum strmb;
#endif // DC_ENABLED
+ BcNum zero;
BcNum one;
#if BC_ENABLED
@@ -99,6 +102,7 @@ typedef struct BcProgram {
BcDig strmb_num[BC_NUM_BIGDIG_LOG10];
#endif // DC_ENABLED
+ BcDig zero_num[BC_PROG_ONE_CAP];
BcDig one_num[BC_PROG_ONE_CAP];
} BcProgram;
diff --git a/include/rand.h b/include/rand.h
index fa17507276fb..3c8aafd62ade 100644
--- a/include/rand.h
+++ b/include/rand.h
@@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
- * Copyright (c) 2018-2019 Gavin D. Howard and contributors.
+ * SPDX-License-Identifier: BSD-2-Clause
*
- * All rights reserved.
+ * Copyright (c) 2018-2019 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -69,14 +69,16 @@
#ifndef BC_RAND_H
#define BC_RAND_H
-#if BC_ENABLE_EXTRA_MATH
-
#include <stdint.h>
#include <inttypes.h>
#include <vector.h>
#include <num.h>
+#if BC_ENABLE_EXTRA_MATH
+
+#if BC_ENABLE_RAND
+
typedef ulong (*BcRandUlong)(void*);
#if BC_LONG_BIT >= 64
@@ -224,6 +226,8 @@ void bc_rand_getRands(BcRNG *r, BcRand *s1, BcRand *s2, BcRand *i1, BcRand *i2);
extern const BcRandState bc_rand_multiplier;
+#endif // BC_ENABLE_RAND
+
#endif // BC_ENABLE_EXTRA_MATH
#endif // BC_RAND_H
diff --git a/include/read.h b/include/read.h
index 369540ede3a8..664ff983e522 100644
--- a/include/read.h
+++ b/include/read.h
@@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * SPDX-License-Identifier: BSD-2-Clause
*
- * All rights reserved.
+ * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -33,8 +33,8 @@
*
*/
-#ifndef BC_IO_H
-#define BC_IO_H
+#ifndef BC_READ_H
+#define BC_READ_H
#include <stdlib.h>
@@ -55,5 +55,6 @@
BcStatus bc_read_line(BcVec *vec, const char *prompt);
void bc_read_file(const char *path, char **buf);
BcStatus bc_read_chars(BcVec *vec, const char *prompt);
+bool bc_read_buf(BcVec *vec, char *buf, size_t *buf_len);
-#endif // BC_IO_H
+#endif // BC_READ_H
diff --git a/include/status.h b/include/status.h
index 12155cef459d..279edfef8710 100644
--- a/include/status.h
+++ b/include/status.h
@@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * SPDX-License-Identifier: BSD-2-Clause
*
- * All rights reserved.
+ * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/include/vector.h b/include/vector.h
index 3fa599b585d9..bad178eede30 100644
--- a/include/vector.h
+++ b/include/vector.h
@@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * SPDX-License-Identifier: BSD-2-Clause
*
- * All rights reserved.
+ * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
diff --git a/include/vm.h b/include/vm.h
index 0ca20047b824..7f4359c640d3 100644
--- a/include/vm.h
+++ b/include/vm.h
@@ -1,9 +1,9 @@
/*
* *****************************************************************************
*
- * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
+ * SPDX-License-Identifier: BSD-2-Clause
*
- * All rights reserved.
+ * Copyright (c) 2018-2020 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -91,28 +91,64 @@
#define isatty _isatty
#endif // _WIN32
+#if DC_ENABLED
#define DC_FLAG_X (UINTMAX_C(1)<<0)
+#endif // DC_ENABLED
+
+#if BC_ENABLED
#define BC_FLAG_W (UINTMAX_C(1)<<1)
#define BC_FLAG_S (UINTMAX_C(1)<<2)
-#define BC_FLAG_Q (UINTMAX_C(1)<<3)
-#define BC_FLAG_L (UINTMAX_C(1)<<4)
-#define BC_FLAG_I (UINTMAX_C(1)<<5)
-#define BC_FLAG_G (UINTMAX_C(1)<<6)
+#define BC_FLAG_L (UINTMAX_C(1)<<3)
+#define BC_FLAG_G (UINTMAX_C(1)<<4)
+#endif // BC_ENABLED
+
+#define BC_FLAG_Q (UINTMAX_C(1)<<5)
+#define BC_FLAG_I (UINTMAX_C(1)<<6)
#define BC_FLAG_P (UINTMAX_C(1)<<7)
#define BC_FLAG_TTYIN (UINTMAX_C(1)<<8)
#define BC_FLAG_TTY (UINTMAX_C(1)<<9)
#define BC_TTYIN (vm.flags & BC_FLAG_TTYIN)
#define BC_TTY (vm.flags & BC_FLAG_TTY)
+#if BC_ENABLED
+
#define BC_S (BC_ENABLED && (vm.flags & BC_FLAG_S))
#define BC_W (BC_ENABLED && (vm.flags & BC_FLAG_W))
#define BC_L (BC_ENABLED && (vm.flags & BC_FLAG_L))
-#define BC_I (vm.flags & BC_FLAG_I)
#define BC_G (BC_ENABLED && (vm.flags & BC_FLAG_G))
-#define DC_X (DC_ENABLED && (vm.flags & DC_FLAG_X))
+
+#endif // BC_ENABLED
+
+#if DC_ENABLED
+#define DC_X (vm.flags & DC_FLAG_X)
+#endif // DC_ENABLED
+
+#define BC_I (vm.flags & BC_FLAG_I)
#define BC_P (vm.flags & BC_FLAG_P)
+#if BC_ENABLED
+
+#define BC_IS_POSIX (BC_S || BC_W)
+
+#if DC_ENABLED
+#define BC_IS_BC (vm.name[0] != 'd')
+#define BC_IS_DC (vm.name[0] == 'd')
+#else // DC_ENABLED
+#define BC_IS_BC (1)
+#define BC_IS_DC (0)
+#endif // DC_ENABLED
+
+#else // BC_ENABLED
+#define BC_IS_POSIX (0)
+#define BC_IS_BC (0)
+#define BC_IS_DC (1)
+#endif // BC_ENABLED
+
+#if BC_ENABLED
#define BC_USE_PROMPT (!BC_P && BC_TTY && !BC_IS_POSIX)
+#else // BC_ENABLED
+#define BC_USE_PROMPT (!BC_P && BC_TTY)
+#endif // BC_ENABLED
#define BC_MAX(a, b) ((a) > (b) ? (a) : (b))
#define BC_MIN(a, b) ((a) < (b) ? (a) : (b))
@@ -131,9 +167,6 @@
#define BC_MAX_EXP ((ulong) (BC_NUM_BIGDIG_MAX))
#define BC_MAX_VARS ((ulong) (SIZE_MAX - 1))
-#define BC_IS_BC (BC_ENABLED && (!DC_ENABLED || vm.name[0] != 'd'))
-#define BC_IS_POSIX (BC_S || BC_W)
-
#if BC_DEBUG_CODE
#define BC_VM_JMP bc_vm_jmp(__func__)
#else // BC_DEBUG_CODE
@@ -234,7 +267,9 @@
#define BC_VM_BUF_SIZE (1<<12)
#define BC_VM_STDOUT_BUF_SIZE (1<<11)
#define BC_VM_STDERR_BUF_SIZE (1<<10)
-#define BC_VM_STDIN_BUF_SIZE BC_VM_STDERR_BUF_SIZE
+#define BC_VM_STDIN_BUF_SIZE (BC_VM_STDERR_BUF_SIZE - 1)
+
+#define BC_VM_SAFE_RESULT(r) ((r)->t >= BC_RESULT_TEMP)
#define bc_vm_err(e) (bc_vm_error((e), 0))
#define bc_vm_verr(e, ...) (bc_vm_error((e), 0, __VA_ARGS__))