From dfc747cebe8cf366bf694e977aa5f591e01c9a53 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Wed, 27 Jan 2016 19:33:35 +0100 Subject: readline history --- compile.c | 9 ++++----- iclean.icl | 14 ++++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/compile.c b/compile.c index 5e8f167..71d6f11 100644 --- a/compile.c +++ b/compile.c @@ -65,13 +65,12 @@ int64_t compile(CleanString path, CleanString module) { for (i=0;i - chdir(pathchars); // Build command: - // clm -ms -o - char cmd[64] = "clm -ms -nw "; + // cd "" && clm -ms -o + char cmd[64] = "cd \""; + strcat(cmd, pathchars); + strcat(cmd, "\" && clm -ms -nw "); strcat(cmd, modulechars); strcat(cmd, " -o "); strcat(cmd, modulechars); diff --git a/iclean.icl b/iclean.icl index 13e7f5e..6f7ff04 100644 --- a/iclean.icl +++ b/iclean.icl @@ -33,6 +33,7 @@ import ReadLine // SETTINGS temp_path :== "/tmp/" temp_module :== "iclean" +readline_history :== ".iclean_history" // END SETTINGS temp_file :== temp_path +++ temp_module +++ ".icl" @@ -40,24 +41,25 @@ temp_file :== temp_path +++ temp_module +++ ".icl" Start :: *World -> *World Start w # w = setReadLineName "iClean" w +# w = usingHistory w +# (_, w) = readHistory readline_history w # w = loop w +# (i, w) = writeHistory readline_history w = w where - loop :: *World -> *World + loop :: !*World -> *World loop w - # (s,w) = readLine "λ. " True w + # (s,w) = readLine "λ. " False w | isNothing s = print "\n" w # s = fromJust s - | s == "" = w + | s == "" = loop (print "Use Ctrl-D to exit\n" w) + # w = addHistory s w # w = writemodule s w # (r,w) = compile temp_path temp_module w | r <> 0 = loop w # w = run (temp_path +++ temp_module) w = loop w - toList :: String -> [Char] - toList s = fromString s - print :: String *World -> *World print s w # (io,w) = stdio w -- cgit v1.2.3