diff options
-rw-r--r-- | Makefile.in | 11 | ||||
-rwxr-xr-x | configure.sh | 24 | ||||
-rw-r--r-- | include/status.h | 28 | ||||
-rw-r--r-- | include/vm.h | 4 | ||||
-rw-r--r-- | src/read.c | 2 | ||||
-rw-r--r-- | src/vm.c | 8 |
6 files changed, 23 insertions, 54 deletions
diff --git a/Makefile.in b/Makefile.in index e63b58fc..28ad99a0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -144,7 +144,6 @@ BC_DEFAULT_SIGINT_RESET = %%BC_DEFAULT_SIGINT_RESET%% DC_DEFAULT_SIGINT_RESET = %%DC_DEFAULT_SIGINT_RESET%% BC_DEFAULT_TTY_MODE = %%BC_DEFAULT_TTY_MODE%% DC_DEFAULT_TTY_MODE = %%DC_DEFAULT_TTY_MODE%% -BC_DEFAULT_HISTORY = %%BC_DEFAULT_HISTORY%% DC_DEFAULT_HISTORY = %%DC_DEFAULT_HISTORY%% BC_DEFAULT_PROMPT = %%BC_DEFAULT_PROMPT%% DC_DEFAULT_PROMPT = %%DC_DEFAULT_PROMPT%% @@ -171,14 +170,12 @@ BC_NUM_KARATSUBA_LEN = %%KARATSUBA_LEN%% BC_DEFS0 = -DBC_DEFAULT_BANNER=$(BC_DEFAULT_BANNER) BC_DEFS1 = -DBC_DEFAULT_SIGINT_RESET=$(BC_DEFAULT_SIGINT_RESET) BC_DEFS2 = -DBC_DEFAULT_TTY_MODE=$(BC_DEFAULT_TTY_MODE) -BC_DEFS3 = -DBC_DEFAULT_HISTORY=$(BC_DEFAULT_HISTORY) -BC_DEFS4 = -DBC_DEFAULT_PROMPT=$(BC_DEFAULT_PROMPT) -BC_DEFS = $(BC_DEFS0) $(BC_DEFS1) $(BC_DEFS2) $(BC_DEFS3) $(BC_DEFS4) +BC_DEFS3 = -DBC_DEFAULT_PROMPT=$(BC_DEFAULT_PROMPT) +BC_DEFS = $(BC_DEFS0) $(BC_DEFS1) $(BC_DEFS2) $(BC_DEFS3) DC_DEFS1 = -DDC_DEFAULT_SIGINT_RESET=$(DC_DEFAULT_SIGINT_RESET) DC_DEFS2 = -DDC_DEFAULT_TTY_MODE=$(DC_DEFAULT_TTY_MODE) -DC_DEFS3 = -DDC_DEFAULT_HISTORY=$(DC_DEFAULT_HISTORY) -DC_DEFS4 = -DDC_DEFAULT_PROMPT=$(DC_DEFAULT_PROMPT) -DC_DEFS = $(DC_DEFS1) $(DC_DEFS2) $(DC_DEFS3) $(DC_DEFS4) +DC_DEFS3 = -DDC_DEFAULT_PROMPT=$(DC_DEFAULT_PROMPT) +DC_DEFS = $(DC_DEFS1) $(DC_DEFS2) $(DC_DEFS3) CPPFLAGS1 = -D$(BC_ENABLED_NAME)=$(BC_ENABLED) -D$(DC_ENABLED_NAME)=$(DC_ENABLED) CPPFLAGS2 = $(CPPFLAGS1) -I./include/ -DBUILD_TYPE=$(BC_BUILD_TYPE) %%LONG_BIT_DEFINE%% diff --git a/configure.sh b/configure.sh index a3af943e..8e01eae1 100755 --- a/configure.sh +++ b/configure.sh @@ -281,14 +281,6 @@ usage() { printf '| | dc should be on when | | |\n' printf '| | available. | | |\n' printf '| --------------- | ---------------------- | ------------ | --------------- |\n' - printf '| bc.history | Whether history should | $BC_TTY_MODE | BC_HISTORY |\n' - printf '| | be on for bc when in | | |\n' - printf '| | TTY mode. | | |\n' - printf '| --------------- | ---------------------- | ------------ | --------------- |\n' - printf '| dc.history | Whether history should | $DC_TTY_MODE | DC_HISTORY |\n' - printf '| | be on for dc when in | | |\n' - printf '| | TTY mode. | | |\n' - printf '| --------------- | ---------------------- | ------------ | --------------- |\n' printf '| bc.prompt | Whether the prompt for | $BC_TTY_MODE | BC_PROMPT |\n' printf '| | bc should be on in TTY | | |\n' printf '| | mode. | | |\n' @@ -552,8 +544,6 @@ set_default() { dc.sigint_reset) dc_default_sigint_reset="$_set_default_on" ;; bc.tty_mode) bc_default_tty_mode="$_set_default_on" ;; dc.tty_mode) dc_default_tty_mode="$_set_default_on" ;; - bc.history) bc_default_history="$_set_default_on" ;; - dc.history) dc_default_history="$_set_default_on" ;; bc.prompt) bc_default_prompt="$_set_default_on" ;; dc.prompt) dc_default_prompt="$_set_default_on" ;; ?) usage "Invalid setting: $_set_default_name" ;; @@ -617,8 +607,6 @@ bc_default_sigint_reset=1 dc_default_sigint_reset=1 bc_default_tty_mode=1 dc_default_tty_mode=0 -bc_default_history="" -dc_default_history="" bc_default_prompt="" dc_default_prompt="" @@ -1368,14 +1356,6 @@ if [ "$vg" -ne 0 ]; then memcheck=1 fi -if [ "$bc_default_history" = "" ]; then - bc_default_history="$bc_default_tty_mode" -fi - -if [ "$dc_default_history" = "" ]; then - dc_default_history="$dc_default_tty_mode" -fi - if [ "$bc_default_prompt" = "" ]; then bc_default_prompt="$bc_default_tty_mode" fi @@ -1440,8 +1420,6 @@ printf 'bc.sigint_reset=%s\n' "$bc_default_sigint_reset" printf 'dc.sigint_reset=%s\n' "$dc_default_sigint_reset" printf 'bc.tty_mode=%s\n' "$bc_default_tty_mode" printf 'dc.tty_mode=%s\n' "$dc_default_tty_mode" -printf 'bc.history=%s\n' "$bc_default_history" -printf 'dc.history=%s\n' "$dc_default_history" printf 'bc.prompt=%s\n' "$bc_default_prompt" printf 'dc.prompt=%s\n' "$dc_default_prompt" @@ -1572,8 +1550,6 @@ contents=$(replace "$contents" "BC_DEFAULT_SIGINT_RESET" "$bc_default_sigint_res contents=$(replace "$contents" "DC_DEFAULT_SIGINT_RESET" "$dc_default_sigint_reset") contents=$(replace "$contents" "BC_DEFAULT_TTY_MODE" "$bc_default_tty_mode") contents=$(replace "$contents" "DC_DEFAULT_TTY_MODE" "$dc_default_tty_mode") -contents=$(replace "$contents" "BC_DEFAULT_HISTORY" "$bc_default_history") -contents=$(replace "$contents" "DC_DEFAULT_HISTORY" "$dc_default_history") contents=$(replace "$contents" "BC_DEFAULT_PROMPT" "$bc_default_prompt") contents=$(replace "$contents" "DC_DEFAULT_PROMPT" "$dc_default_prompt") diff --git a/include/status.h b/include/status.h index 695f04dc..94097d68 100644 --- a/include/status.h +++ b/include/status.h @@ -163,6 +163,8 @@ #include <bcl.h> +#if BC_ENABLED + #ifndef BC_DEFAULT_BANNER #define BC_DEFAULT_BANNER (0) #endif // BC_DEFAULT_BANNER @@ -171,34 +173,36 @@ #define BC_DEFAULT_SIGINT_RESET (1) #endif // BC_DEFAULT_SIGINT_RESET -#ifndef DC_DEFAULT_SIGINT_RESET -#define DC_DEFAULT_SIGINT_RESET (1) -#endif // DC_DEFAULT_SIGINT_RESET - #ifndef BC_DEFAULT_TTY_MODE #define BC_DEFAULT_TTY_MODE (1) #endif // BC_DEFAULT_TTY_MODE +#ifndef BC_DEFAULT_PROMPT +#define BC_DEFAULT_PROMPT BC_DEFAULT_TTY_MODE +#endif // BC_DEFAULT_PROMPT + +#endif // BC_ENABLED + +#if DC_ENABLED + +#ifndef DC_DEFAULT_SIGINT_RESET +#define DC_DEFAULT_SIGINT_RESET (1) +#endif // DC_DEFAULT_SIGINT_RESET + #ifndef DC_DEFAULT_TTY_MODE #define DC_DEFAULT_TTY_MODE (0) #endif // DC_DEFAULT_TTY_MODE -#ifndef BC_DEFAULT_HISTORY -#define BC_DEFAULT_HISTORY BC_DEFAULT_TTY_MODE -#endif // BC_DEFAULT_HISTORY - #ifndef DC_DEFAULT_HISTORY #define DC_DEFAULT_HISTORY DC_DEFAULT_TTY_MODE #endif // DC_DEFAULT_HISTORY -#ifndef BC_DEFAULT_PROMPT -#define BC_DEFAULT_PROMPT BC_DEFAULT_TTY_MODE -#endif // BC_DEFAULT_PROMPT - #ifndef DC_DEFAULT_PROMPT #define DC_DEFAULT_PROMPT DC_DEFAULT_TTY_MODE #endif // DC_DEFAULT_PROMPT +#endif // DC_ENABLED + typedef enum BcStatus { BC_STATUS_SUCCESS = 0, diff --git a/include/vm.h b/include/vm.h index a26794d0..54f17436 100644 --- a/include/vm.h +++ b/include/vm.h @@ -120,11 +120,9 @@ #define BC_FLAG_R (UINTMAX_C(1)<<8) #define BC_FLAG_TTYIN (UINTMAX_C(1)<<8) #define BC_FLAG_TTY (UINTMAX_C(1)<<9) -#define BC_FLAG_HISTORY (UINTMAX_C(1)<<10) -#define BC_FLAG_SIGINT (UINTMAX_C(1)<<11) +#define BC_FLAG_SIGINT (UINTMAX_C(1)<<10) #define BC_TTYIN (vm.flags & BC_FLAG_TTYIN) #define BC_TTY (vm.flags & BC_FLAG_TTY) -#define BC_HISTORY (vm.flags & BC_FLAG_HISTORY) #define BC_SIGINT (vm.flags & BC_FLAG_SIGINT) #if BC_ENABLED @@ -184,7 +184,7 @@ BcStatus bc_read_line(BcVec *vec, const char *prompt) { BcStatus s; #if BC_ENABLE_HISTORY - if (BC_HISTORY && !vm.history.badTerm) + if (BC_TTY && !vm.history.badTerm) s = bc_history_line(&vm.history, vec, prompt); else s = bc_read_chars(vec, prompt); #else // BC_ENABLE_HISTORY @@ -1025,10 +1025,6 @@ void bc_vm_boot(int argc, char *argv[]) { DC_DEFAULT_SIGINT_RESET; const char* const env_tty = BC_IS_BC ? "BC_TTY_MODE" : "DC_TTY_MODE"; int env_tty_def = BC_IS_BC ? BC_DEFAULT_TTY_MODE : DC_DEFAULT_TTY_MODE; -#if BC_ENABLE_HISTORY - const char* const env_history = BC_IS_BC ? "BC_HISTORY" : "DC_HISTORY"; - int env_history_def = BC_IS_BC ? BC_DEFAULT_HISTORY : DC_DEFAULT_HISTORY; -#endif // BC_ENABLE_HISTORY const char* const env_prompt = BC_IS_BC ? "BC_PROMPT" : "DC_PROMPT"; int env_prompt_def = BC_IS_BC ? BC_DEFAULT_PROMPT : DC_DEFAULT_PROMPT; @@ -1074,9 +1070,7 @@ void bc_vm_boot(int argc, char *argv[]) { bc_vm_setenvFlag(env_prompt, tty ? env_prompt_def : 0, BC_FLAG_P); #if BC_ENABLE_HISTORY - bc_vm_setenvFlag(env_history, tty ? env_history_def : 0, - BC_FLAG_HISTORY); - if (BC_HISTORY) bc_history_init(&vm.history); + if (BC_TTY) bc_history_init(&vm.history); #endif // BC_ENABLE_HISTORY } |