diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-06-21 23:53:17 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-06-21 23:53:17 -0700 |
commit | 290fe117c444399495a83266d602e2f4fc3fc099 (patch) | |
tree | 2fed3d6cd61048d2a3043be94cff7f9985719f3b | |
parent | 6a0f71b9f89df0940a342cd2c91d246cecc18bdf (diff) | |
download | mu-290fe117c444399495a83266d602e2f4fc3fc099.tar.gz |
1618
-rw-r--r-- | 061channel.mu | 4 | ||||
-rw-r--r-- | 070display.cc | 16 | ||||
-rw-r--r-- | chessboard.mu | 10 | ||||
-rw-r--r-- | console.mu | 4 | ||||
-rw-r--r-- | display.mu | 5 | ||||
-rw-r--r-- | edit.mu | 4 | ||||
-rw-r--r-- | repl.mu | 4 | ||||
-rw-r--r-- | screen.mu | 4 |
8 files changed, 26 insertions, 25 deletions
diff --git a/061channel.mu b/061channel.mu index 29f6d82b..5de745eb 100644 --- a/061channel.mu +++ b/061channel.mu @@ -297,7 +297,7 @@ recipe buffer-lines [ backspace?:boolean <- equal c:character, 8:literal break-unless backspace?:boolean # drop previous character -#? return-to-console #? 2 +#? close-console #? 2 #? $print [backspace! #? 1 #? ] #? 1 { @@ -325,7 +325,7 @@ recipe buffer-lines [ break-if eof?:boolean loop } -#? return-to-console #? 1 +#? close-console #? 1 # copy line into 'out' #? $print [buffer-lines: emitting #? ] diff --git a/070display.cc b/070display.cc index 8cedf9e3..76950156 100644 --- a/070display.cc +++ b/070display.cc @@ -1,4 +1,4 @@ -//: Take charge of the text-mode display and keyboard. +//: Take charge of the text-mode display and console. :(before "End Globals") // uncomment to debug console programs @@ -10,23 +10,23 @@ long long int Display_row = 0, Display_column = 0; :(before "End Primitive Recipe Declarations") -SWITCH_TO_DISPLAY, +OPEN_CONSOLE, :(before "End Primitive Recipe Numbers") -Recipe_number["switch-to-display"] = SWITCH_TO_DISPLAY; -//? cerr << "switch-to-display: " << SWITCH_TO_DISPLAY << '\n'; //? 1 +Recipe_number["open-console"] = OPEN_CONSOLE; +//? cerr << "open-console: " << OPEN_CONSOLE << '\n'; //? 1 :(before "End Primitive Recipe Implementations") -case SWITCH_TO_DISPLAY: { +case OPEN_CONSOLE: { tb_init(); Display_row = Display_column = 0; break; } :(before "End Primitive Recipe Declarations") -RETURN_TO_CONSOLE, +CLOSE_CONSOLE, :(before "End Primitive Recipe Numbers") -Recipe_number["return-to-console"] = RETURN_TO_CONSOLE; +Recipe_number["close-console"] = CLOSE_CONSOLE; :(before "End Primitive Recipe Implementations") -case RETURN_TO_CONSOLE: { +case CLOSE_CONSOLE: { tb_shutdown(); //? Trace_stream->dump_layer = "all"; //? 1 break; diff --git a/chessboard.mu b/chessboard.mu index 8efe11e7..c5f7ed4f 100644 --- a/chessboard.mu +++ b/chessboard.mu @@ -3,7 +3,7 @@ # recipes are mu's names for functions recipe main [ - switch-to-display # take control of screen and keyboard + open-console # take control of screen, keyboard and mouse # The chessboard recipe takes keyboard and screen objects as 'ingredients'. # @@ -15,11 +15,11 @@ recipe main [ # results. Here we clearly modify both keyboard and screen, so we return # both. # - # Here the keyboard and screen are both 0, which usually indicates real + # Here the console and screen are both 0, which usually indicates real # hardware rather than a fake for testing as you'll see below. - 0:literal/real-screen, 0:literal/real-keyboard <- chessboard 0:literal/real-screen, 0:literal/real-keyboard + 0:literal/screen, 0:literal/console <- chessboard 0:literal/screen, 0:literal/console - return-to-console # cleanup screen and keyboard + close-console # cleanup screen, keyboard and mouse ] ## But enough about mu. Here's what it looks like to run the chessboard program. @@ -281,7 +281,7 @@ recipe read-move [ from-file:number, quit?:boolean, error?:boolean <- read-file stdin:address:channel, screen:address reply-if quit?:boolean, 0:literal/dummy, quit?:boolean, error?:boolean reply-if error?:boolean, 0:literal/dummy, quit?:boolean, error?:boolean -#? return-to-console #? 1 +#? close-console #? 1 # construct the move object result:address:move <- new move:type x:address:number <- get-address result:address:move/deref, from-file:offset diff --git a/console.mu b/console.mu index 4e6c10a5..4073fb9e 100644 --- a/console.mu +++ b/console.mu @@ -3,12 +3,12 @@ # Keeps printing 'a' until you press a key or click on the mouse. recipe main [ - switch-to-display + open-console { _, found?:boolean <- check-for-interaction break-if found?:boolean print-character-to-display 97:literal, 7:literal/white loop } - return-to-console + close-console ] diff --git a/display.mu b/display.mu index 821f4bd5..e2397382 100644 --- a/display.mu +++ b/display.mu @@ -1,7 +1,7 @@ # example program: managing the display recipe main [ - switch-to-display + open-console print-character-to-display 97:literal, 1:literal/red 1:number/raw, 2:number/raw <- cursor-position-on-display wait-for-some-interaction @@ -20,5 +20,6 @@ recipe main [ wait-for-some-interaction move-cursor-up-on-display wait-for-some-interaction - return-to-console +#? $print [aaa] #? 1 + close-console ] diff --git a/edit.mu b/edit.mu index 3c70f5eb..87721689 100644 --- a/edit.mu +++ b/edit.mu @@ -2,7 +2,7 @@ recipe main [ default-space:address:array:location <- new location:type, 30:literal - switch-to-display + open-console width:number <- display-width height:number <- display-height divider:number, _ <- divide-with-remainder width:number, 2:literal @@ -14,7 +14,7 @@ jkl ] editor:address:editor-data <- new-editor in:address:array:character, 0:literal/screen, 0:literal/top, 0:literal/left, divider:number/right event-loop 0:literal/screen, 0:literal/events, editor:address:editor-data - return-to-console + close-console ] scenario editor-initially-prints-string-to-screen [ diff --git a/repl.mu b/repl.mu index 67eb434a..245e7dfd 100644 --- a/repl.mu +++ b/repl.mu @@ -2,13 +2,13 @@ recipe main [ default-space:address:array:location <- new location:type, 30:literal - switch-to-display + open-console 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, 245:literal/grey 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 + close-console ] recipe color-session [ diff --git a/screen.mu b/screen.mu index 6565b46d..7a2390e8 100644 --- a/screen.mu +++ b/screen.mu @@ -4,7 +4,7 @@ # screens. recipe main [ - switch-to-display + open-console print-character 0:literal/screen, 97:literal, 2:literal/red 1:number/raw, 2:number/raw <- cursor-position 0:literal/screen wait-for-event 0:literal/console @@ -23,5 +23,5 @@ recipe main [ wait-for-event 0:literal/console cursor-up 0:literal/screen wait-for-event 0:literal/console - return-to-console + close-console ] |