From ae496d70be94f8ffa363ae1612aa3cbfbaca11b8 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 3 Jun 2015 10:06:14 -0700 Subject: 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. --- repl.mu | 16 ++++++++++++---- 1 file 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 -- cgit 1.4.1-2-gfad0