From: nishi Date: Sat, 27 Apr 2024 00:18:22 +0000 (+0000) Subject: works X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=67b9ac9d498f0c61244f1a7d826b2fc37e79bf81;p=serenade.git works git-svn-id: file:///raid/svn-main/nishi-serenade/trunk@59 0f02c867-ac3d-714e-8a88-971ba1f6efcf --- diff --git a/Serenade/main.c b/Serenade/main.c index d1a7a6d..0321f7d 100644 --- a/Serenade/main.c +++ b/Serenade/main.c @@ -42,8 +42,8 @@ #include #ifdef HAS_READLINE_SUPPORT -#include #include +#include #endif extern bool is_repl; @@ -117,30 +117,31 @@ int main(int argc, char** argv) { #ifdef HAS_READLINE_SUPPORT char* line = NULL; using_history(); + read_history(".serenade_history"); #endif while(1) { #ifdef HAS_READLINE_SUPPORT line = readline("> "); - if(line == NULL){ + if(line == NULL) { free(line); break; } int i; - for(i = 0; line[i] != 0; i++){ - if(line[i] == '('){ + for(i = 0; line[i] != 0; i++) { + if(line[i] == '(') { br++; - }else if(line[i] == ')'){ + } else if(line[i] == ')') { br--; } } - if(strcmp(line, ":quit") == 0){ + if(strcmp(line, ":quit") == 0) { free(line); break; } char* tmp = str; str = sn_strcat(tmp, line); free(tmp); - if(br == 0){ + if(br == 0) { sn_eval(sn, str, strlen(str)); add_history(str); free(str); @@ -150,7 +151,7 @@ int main(int argc, char** argv) { free(line); #else if(cbuf[0] == '\n') { - if(strcmp(str, ":quit") == 0){ + if(strcmp(str, ":quit") == 0) { break; } if(br == 0 && strlen(str) > 0) { @@ -181,6 +182,7 @@ int main(int argc, char** argv) { } #endif } + write_history(".serenade_history"); free(str); sn_interpreter_free(sn); } diff --git a/Tool/configgen.c b/Tool/configgen.c index 9c60e60..4b4f12c 100644 --- a/Tool/configgen.c +++ b/Tool/configgen.c @@ -35,9 +35,7 @@ char choice[256]; -char* asks[] = {"repl", "y", "HAS_REPL_SUPPORT", "Do you want the REPL support?", - "ffi", "y", "HAS_FFI_SUPPORT", "Do you want the FFI support?", - "readline", "n", "HAS_READLINE_SUPPORT", "Do you want the readline support for the REPL?", +char* asks[] = {"repl", "y", "HAS_REPL_SUPPORT", "Do you want the REPL support?", "ffi", "y", "HAS_FFI_SUPPORT", "Do you want the FFI support?", "readline", "n", "HAS_READLINE_SUPPORT", "Do you want the readline support for the REPL?", NULL};