aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules3
m---------CleanReadLine0
-rw-r--r--Makefile7
-rw-r--r--iclean.icl19
4 files changed, 14 insertions, 15 deletions
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..af0f092
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "CleanReadLine"]
+ path = CleanReadLine
+ url = https://github.com/camilstaps/CleanReadLine.git
diff --git a/CleanReadLine b/CleanReadLine
new file mode 160000
+Subproject 2cf43553dbaa560f8a8006d5eadb8a63bdd32cb
diff --git a/Makefile b/Makefile
index b3894be..5c1fcc9 100644
--- a/Makefile
+++ b/Makefile
@@ -6,8 +6,11 @@ clean:
compile.o: compile.c
cc -O0 -c compile.c
-iclean: compile.o iclean.icl
- clm -l compile.o iclean -o iclean
+iclean: compile.o iclean.icl readline
+ clm -I CleanReadLine -l -lreadline -l compile.o iclean -o iclean
+
+readline:
+ make -C CleanReadLine
run: iclean
./iclean -nr -nt
diff --git a/iclean.icl b/iclean.icl
index f72d349..84f0dc5 100644
--- a/iclean.icl
+++ b/iclean.icl
@@ -28,6 +28,7 @@
module iclean
import StdEnv
+import ReadLine
// SETTINGS
temp_path :== "/tmp/"
@@ -38,13 +39,13 @@ temp_file :== temp_path +++ temp_module +++ ".icl"
Start :: *World -> *World
Start w
+# w = setReadLineName "iClean" w
# w = loop w
= w
where
loop :: *World -> *World
loop w
- # w = print "λ. " w
- # (s,w) = readline w
+ # (s,w) = readLine "λ. " True w
| s == "" = print "\n" w
# w = writemodule s w
# (r,w) = compile temp_path temp_module w
@@ -52,6 +53,9 @@ where
# 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
@@ -60,17 +64,6 @@ print s w
| not ok = abort "Couldn't close stdio\n"
| otherwise = w
-readline :: *World -> *(String,*World)
-readline w
-# (io,w) = stdio w
-# (s,io) = freadline io
-# (ok,w) = fclose io w
-| not ok = abort "Couldn't close stdio\n"
-| otherwise = (s % (0,length (l s) - 2), w)
-where
- l :: String -> [Char]
- l s = fromString s
-
writemodule :: String *World -> *World
writemodule s w
# (ok,f,w) = fopen temp_file FWriteText w