about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-06-03 10:06:14 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-06-03 10:06:14 -0700
commitae496d70be94f8ffa363ae1612aa3cbfbaca11b8 (patch)
treec27046412579870fd7aa5063f1580f4062dde7e7
parentee0ec58c89508444b280a247a03195114197998a (diff)
downloadmu-ae496d70be94f8ffa363ae1612aa3cbfbaca11b8.tar.gz
1522
Extracting a function for the prompt before starting to test it.

Still not clear how I should proceed. Need to express screen dependency
to 'run-interactive' somehow. Supporting generics might finally be on
the critical path.
-rw-r--r--repl.mu16
1 files changed, 12 insertions, 4 deletions
diff --git a/repl.mu b/repl.mu
index cae95386..6830578c 100644
--- a/repl.mu
+++ b/repl.mu
@@ -6,17 +6,25 @@ recipe main [
   msg:address:array:character <- new [ready! type in an instruction, then hit enter. ctrl-d exits.
 ]
   0:literal/real-screen <- print-string 0:literal/real-screen, msg:address:array:character
+  0:literal/real-keyboard, 0:literal/real-screen <- color-session 0:literal/real-keyboard, 0:literal/real-screen
+#?   wait-for-key-from-keyboard #? 1
+  return-to-console
+]
+
+recipe color-session [
+  default-space:address:array:location <- new location:type, 30:literal
+  keyboard:address <- next-ingredient
+  screen:address <- next-ingredient
   {
-    inst:address:array:character, 0:literal/real-keyboard, 0:literal/real-screen <- read-instruction 0:literal/real-keyboard, 0:literal/real-screen
+    inst:address:array:character, keyboard:address, screen:address <- read-instruction keyboard:address, screen:address
     break-unless inst:address:array:character
     run-interactive inst:address:array:character
     # assume run-interactive printed on the current line
     move-cursor-down-on-display
-    clear-line-on-display  # just to refresh the screen
+#?     clear-line-on-display  # just to refresh the screen
     loop
   }
-#?   wait-for-key-from-keyboard #? 1
-  return-to-console
+  reply keyboard:address/same-as-ingredient:0, screen:address/same-as-ingredient:1
 ]
 
 # basic keyboard input; just text and enter