diff options
author | Camil Staps | 2016-01-27 19:33:35 +0100 |
---|---|---|
committer | Camil Staps | 2016-01-27 19:33:35 +0100 |
commit | dfc747cebe8cf366bf694e977aa5f591e01c9a53 (patch) | |
tree | 47c10c9a8482e51c19467c24f768c7d5f9898c24 | |
parent | Update Makefile (diff) |
readline history
-rw-r--r-- | compile.c | 9 | ||||
-rw-r--r-- | iclean.icl | 14 |
2 files changed, 12 insertions, 11 deletions
@@ -65,13 +65,12 @@ int64_t compile(CleanString path, CleanString module) { for (i=0;i<pathlength;i++) pathchars[i] = CleanStringCharacters(path)[i]; pathchars[i] = 0x00; - - // cd to <path> - chdir(pathchars); // Build command: - // clm -ms <module> -o <module> - char cmd[64] = "clm -ms -nw "; + // cd "<path>" && clm -ms <module> -o <module> + char cmd[64] = "cd \""; + strcat(cmd, pathchars); + strcat(cmd, "\" && clm -ms -nw "); strcat(cmd, modulechars); strcat(cmd, " -o "); strcat(cmd, modulechars); @@ -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 |