diff options
author | dh73 <dh73_fpga@qq.com> | 2017-11-08 20:24:01 -0600 |
---|---|---|
committer | dh73 <dh73_fpga@qq.com> | 2017-11-08 20:24:01 -0600 |
commit | cf8cc50bf51c2fa36a3189e131a7e7fe0807ae8f (patch) | |
tree | 456b6aae2215835e602851eafc3b52bb6bb6f3de /kernel/driver.cc | |
parent | 1fc061d90c45166f87d92f76b6fae1ec517be72f (diff) | |
parent | 9ae25039fb6e28db639372d67c1b72c4170feaa3 (diff) | |
download | yosys-cf8cc50bf51c2fa36a3189e131a7e7fe0807ae8f.tar.gz yosys-cf8cc50bf51c2fa36a3189e131a7e7fe0807ae8f.tar.bz2 yosys-cf8cc50bf51c2fa36a3189e131a7e7fe0807ae8f.zip |
Merge https://github.com/cliffordwolf/yosys
Diffstat (limited to 'kernel/driver.cc')
-rw-r--r-- | kernel/driver.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/kernel/driver.cc b/kernel/driver.cc index 1fe61b499..c5e31d718 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -25,6 +25,10 @@ # include <readline/history.h> #endif +#ifdef YOSYS_ENABLE_EDITLINE +# include <editline/readline.h> +#endif + #include <stdio.h> #include <string.h> #include <limits.h> @@ -119,27 +123,33 @@ const char *prompt() #else /* EMSCRIPTEN */ -#ifdef YOSYS_ENABLE_READLINE +#if defined(YOSYS_ENABLE_READLINE) || defined(YOSYS_ENABLE_EDITLINE) int yosys_history_offset = 0; std::string yosys_history_file; #endif void yosys_atexit() { -#ifdef YOSYS_ENABLE_READLINE +#if defined(YOSYS_ENABLE_READLINE) || defined(YOSYS_ENABLE_EDITLINE) if (!yosys_history_file.empty()) { +#if defined(YOSYS_ENABLE_READLINE) if (yosys_history_offset > 0) { history_truncate_file(yosys_history_file.c_str(), 100); append_history(where_history() - yosys_history_offset, yosys_history_file.c_str()); } else write_history(yosys_history_file.c_str()); +#else + write_history(yosys_history_file.c_str()); +#endif } clear_history(); +#if defined(YOSYS_ENABLE_READLINE) HIST_ENTRY **hist_list = history_list(); if (hist_list != NULL) free(hist_list); #endif +#endif } int main(int argc, char **argv) @@ -159,7 +169,7 @@ int main(int argc, char **argv) bool mode_v = false; bool mode_q = false; -#ifdef YOSYS_ENABLE_READLINE +#if defined(YOSYS_ENABLE_READLINE) || defined(YOSYS_ENABLE_EDITLINE) if (getenv("HOME") != NULL) { yosys_history_file = stringf("%s/.yosys_history", getenv("HOME")); read_history(yosys_history_file.c_str()); |