aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCamil Staps2016-01-27 19:33:35 +0100
committerCamil Staps2016-01-27 19:33:35 +0100
commitdfc747cebe8cf366bf694e977aa5f591e01c9a53 (patch)
tree47c10c9a8482e51c19467c24f768c7d5f9898c24
parentUpdate Makefile (diff)
readline history
-rw-r--r--compile.c9
-rw-r--r--iclean.icl14
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<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);
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