From 4698dc0002c671b15eb0cb7d52d2a0fa470c5fde Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 27 May 2016 08:02:29 -0700 Subject: 3021 --- html/036refcount.cc.html | 7 +- html/042name.cc.html | 12 +++ html/083scenario_screen_test.mu.html | 10 +- html/chessboard.mu.html | 192 ++++++++++++++++++----------------- 4 files changed, 120 insertions(+), 101 deletions(-) (limited to 'html') diff --git a/html/036refcount.cc.html b/html/036refcount.cc.html index 66136c91..e456934b 100644 --- a/html/036refcount.cc.html +++ b/html/036refcount.cc.html @@ -169,15 +169,12 @@ element.value = address;< :(scenario refcounts_put_index) def main [ 1:address:number <- new number:type - # fake array because we can't yet create an array of addresses (wait for the - # support for dilated reagents and parsing more complex type trees) - 1003:number/raw <- copy 3 # skip refcount at 1002 - 2:address:array:address:number <- copy 1002/unsafe + 2:address:array:address:number <- new {(address number): type}, 3 *2:address:array:address:number <- put-index *2:address:array:address:number, 0, 1:address:number ] +run: {1: ("address" "number")} <- new {number: "type"} +mem: incrementing refcount of 1000: 0 -> 1 -+run: {2: ("address" "array" "address" "number")} <- copy {1002: "literal", "unsafe": ()} ++run: {2: ("address" "array" "address" "number")} <- new {(address number): "type"}, {3: "literal"} +mem: incrementing refcount of 1002: 0 -> 1 +run: {2: ("address" "array" "address" "number"), "lookup": ()} <- put-index {2: ("address" "array" "address" "number"), "lookup": ()}, {0: "literal"}, {1: ("address" "number")} # put-index increments refcount diff --git a/html/042name.cc.html b/html/042name.cc.html index 6067e28c..5b8dc773 100644 --- a/html/042name.cc.html +++ b/html/042name.cc.html @@ -96,6 +96,12 @@ Name = Name_snapshot; int v = lookup_name(inst.ingredients.at(in), r); if (v >= 0) { inst.ingredients.at(in).set_value(v); + // HACK: belongs in a later layer, either in the scenario layer which + // introduces the 'run' pseudo-instruction which is translated to + // run_* recipes, or later when we start using screens and consoles in + // scenarios. + if (is_special_name(inst.ingredients.at(in).name) && caller.name.substr(0, 4) == "run_") + inst.ingredients.at(in).properties.push_back(pair<string, string_tree*>("raw", NULL)); } else { raise << maybe(caller.name) << "can't find a place to store '" << inst.ingredients.at(in).name << "'\n" << end(); @@ -115,6 +121,12 @@ Name = Name_snapshot; int v = lookup_name(inst.products.at(out), r); if (v >= 0) { inst.products.at(out).set_value(v); + // HACK: belongs in a later layer, either in the scenario layer which + // introduces the 'run' pseudo-instruction which is translated to + // run_* recipes, or later when we start using screens and consoles in + // scenarios. + if (is_special_name(inst.products.at(out).name) && caller.name.substr(0, 4) == "run_") + inst.products.at(out).properties.push_back(pair<string, string_tree*>("raw", NULL)); } else { raise << maybe(caller.name) << "can't find a place to store '" << inst.products.at(out).name << "'\n" << end(); diff --git a/html/083scenario_screen_test.mu.html b/html/083scenario_screen_test.mu.html index 63afa9bf..adeb5b93 100644 --- a/html/083scenario_screen_test.mu.html +++ b/html/083scenario_screen_test.mu.html @@ -33,8 +33,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color scenario print-character-at-top-left-2 [ assume-screen 3/width, 2/height run [ - 1:character <- copy 97/a - screen:address:screen <- print screen:address:screen, 1:character/a + local-scope + a:character <- copy 97/a + screen:address:screen <- print screen:address:screen, a ] screen-should-contain [ .a . @@ -45,9 +46,10 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color scenario clear-line-erases-printed-characters-2 [ assume-screen 5/width, 3/height run [ + local-scope # print a character - 1:character <- copy 97/a - screen:address:screen <- print screen:address:screen, 1:character/a + a:character <- copy 97/a + screen:address:screen <- print screen:address:screen, a # move cursor to start of line screen:address:screen <- move-cursor screen:address:screen, 0/row, 0/column # clear line diff --git a/html/chessboard.mu.html b/html/chessboard.mu.html index aa237058..0b583444 100644 --- a/html/chessboard.mu.html +++ b/html/chessboard.mu.html @@ -64,10 +64,11 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color ] ] run [ + local-scope screen:address:screen, console:address:console <- chessboard screen:address:screen, console:address:console # icon for the cursor - 1:character/cursor-icon <- copy 9251/␣ - screen <- print screen, 1:character/cursor-icon + cursor-icon:character <- copy 9251/␣ + screen <- print screen, cursor-icon ] screen-should-contain [ # 1 2 3 4 5 6 7 8 9 10 11 @@ -234,8 +235,9 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color scenario printing-the-board [ assume-screen 30/width, 12/height run [ - 1:address:array:address:array:character/board <- initial-position - screen:address:screen <- print-board screen:address:screen, 1:address:array:address:array:character/board + local-scope + board:address:array:address:array:character <- initial-position + screen:address:screen <- print-board screen:address:screen, board ] screen-should-contain [ # 012345678901234567890123456789 @@ -398,67 +400,68 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color scenario read-move-blocking [ assume-screen 20/width, 2/height run [ - 1:address:source:character, 2:address:sink:character <- new-channel 2/capacity - 3:number/routine <- start-running read-move, 1:address:source:character, screen:address:screen + local-scope + source:address:source:character, sink:address:sink:character <- new-channel 2/capacity + read-move-routine:number/routine <- start-running read-move, source, screen:address:screen # 'read-move' is waiting for input - wait-for-routine 3:number - 4:number <- routine-state 3:number/id - 5:boolean/waiting? <- equal 4:number/routine-state, 3/waiting - assert 5:boolean/waiting?, [ + wait-for-routine read-move-routine + read-move-state:number <- routine-state read-move-routine + waiting?:boolean <- equal read-move-state, 3/waiting + assert waiting?, [ F read-move-blocking: routine failed to pause after coming up (before any keys were pressed)] # press 'a' - 2:address:sink:character <- write 2:address:sink:character, 97/a - restart 3:number/routine + sink <- write sink, 97/a + restart read-move-routine # 'read-move' still waiting for input - wait-for-routine 3:number - 4:number <- routine-state 3:number/id - 5:boolean/waiting? <- equal 4:number/routine-state, 3/waiting - assert 5:boolean/waiting?, [ + wait-for-routine read-move-routine + read-move-state <- routine-state read-move-routine + waiting? <- equal read-move-state, 3/waiting + assert waiting?, [ F read-move-blocking: routine failed to pause after rank 'a'] # press '2' - 2:address:sink:character <- write 2:address:sink:character, 50/'2' - restart 3:number/routine + sink <- write sink, 50/'2' + restart read-move-routine # 'read-move' still waiting for input - wait-for-routine 3:number - 4:number <- routine-state 3:number/id - 5:boolean/waiting? <- equal 4:number/routine-state, 3/waiting - assert 5:boolean/waiting?, [ + wait-for-routine read-move-routine + read-move-state <- routine-state read-move-routine + waiting? <- equal read-move-state, 3/waiting + assert waiting?, [ F read-move-blocking: routine failed to pause after file 'a2'] # press '-' - 2:address:sink:character <- write 2:address:sink:character, 45/'-' - restart 3:number/routine + sink <- write sink, 45/'-' + restart read-move-routine # 'read-move' still waiting for input - wait-for-routine 3:number - 4:number <- routine-state 3:number - 5:boolean/waiting? <- equal 4:number/routine-state, 3/waiting - assert 5:boolean/waiting?/routine-state, [ + wait-for-routine read-move-routine + read-move-state <- routine-state read-move-routine + waiting? <- equal read-move-state, 3/waiting + assert waiting?, [ F read-move-blocking: routine failed to pause after hyphen 'a2-'] # press 'a' - 2:address:sink:character <- write 2:address:sink:character, 97/a - restart 3:number/routine + sink <- write sink, 97/a + restart read-move-routine # 'read-move' still waiting for input - wait-for-routine 3:number - 4:number <- routine-state 3:number - 5:boolean/waiting? <- equal 4:number/routine-state, 3/waiting - assert 5:boolean/waiting?/routine-state, [ + wait-for-routine read-move-routine + read-move-state <- routine-state read-move-routine + waiting? <- equal read-move-state, 3/waiting + assert waiting?, [ F read-move-blocking: routine failed to pause after rank 'a2-a'] # press '4' - 2:address:sink:character <- write 2:address:sink:character, 52/'4' - restart 3:number/routine + sink <- write sink, 52/'4' + restart read-move-routine # 'read-move' still waiting for input - wait-for-routine 3:number - 4:number <- routine-state 3:number - 5:boolean/waiting? <- equal 4:number/routine-state, 3/waiting - assert 5:boolean/waiting?, [ + wait-for-routine read-move-routine + read-move-state <- routine-state read-move-routine + waiting? <- equal read-move-state, 3/waiting + assert waiting?, [ F read-move-blocking: routine failed to pause after file 'a2-a4'] # press 'newline' - 2:address:sink:character <- write 2:address:sink:character, 10 # newline - restart 3:number/routine + sink <- write sink, 10 # newline + restart read-move-routine # 'read-move' now completes - wait-for-routine 3:number - 4:number <- routine-state 3:number - 5:boolean/completed? <- equal 4:number/routine-state, 1/completed - assert 5:boolean/completed?, [ + wait-for-routine read-move-routine + read-move-state <- routine-state read-move-routine + completed?:boolean <- equal read-move-state, 1/completed + assert completed?, [ F read-move-blocking: routine failed to terminate on newline] trace 1, [test], [reached end] ] @@ -470,22 +473,23 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color scenario read-move-quit [ assume-screen 20/width, 2/height run [ - 1:address:source:character, 2:address:sink:character <- new-channel 2/capacity - 3:number/routine <- start-running read-move, 1:address:channel:character, screen:address:screen + local-scope + source:address:source:character, sink:address:sink:character <- new-channel 2/capacity + read-move-routine:number <- start-running read-move, source, screen:address:screen # 'read-move' is waiting for input - wait-for-routine 3:number - 4:number <- routine-state 3:number/id - 5:boolean/waiting? <- equal 4:number/routine-state, 3/waiting - assert 5:boolean/waiting?, [ + wait-for-routine read-move-routine + read-move-state:number <- routine-state read-move-routine + waiting?:boolean <- equal read-move-state, 3/waiting + assert waiting?, [ F read-move-quit: routine failed to pause after coming up (before any keys were pressed)] # press 'q' - 2:address:sink:character <- write 2:address:sink:character, 113/q - restart 3:number/routine + sink <- write sink, 113/q + restart read-move-routine # 'read-move' completes - wait-for-routine 3:number - 4:number <- routine-state 3:number/id - 5:boolean/completed? <- equal 4:number/routine-state, 1/completed - assert 5:boolean/completed?, [ + wait-for-routine read-move-routine + read-move-state <- routine-state read-move-routine + completed?:boolean <- equal read-move-state, 1/completed + assert completed?, [ F read-move-quit: routine failed to terminate on 'q'] trace 1, [test], [reached end] ] @@ -497,17 +501,18 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color scenario read-move-illegal-file [ assume-screen 20/width, 2/height run [ - 1:address:source:character, 2:address:sink:character <- new-channel 2/capacity - 3:number/routine <- start-running read-move, 1:address:source:character, screen:address:screen + local-scope + source:address:source:character, sink:address:sink:character <- new-channel 2/capacity + read-move-routine:number <- start-running read-move, source, screen:address:screen # 'read-move' is waiting for input - wait-for-routine 3:number - 4:number <- routine-state 3:number/id - 5:boolean/waiting? <- equal 4:number/routine-state, 3/waiting - assert 5:boolean/waiting?, [ + wait-for-routine read-move-routine + read-move-state:number <- routine-state read-move-routine + waiting?:boolean <- equal read-move-state, 3/waiting + assert waiting?, [ F read-move-file: routine failed to pause after coming up (before any keys were pressed)] - 1:address:sink:character <- write 1:address:sink:character, 50/'2' - restart 3:number/routine - wait-for-routine 3:number + sink <- write sink, 50/'2' + restart read-move-routine + wait-for-routine read-move-routine ] screen-should-contain [ .file too low: 2 . @@ -518,18 +523,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color scenario read-move-illegal-rank [ assume-screen 20/width, 2/height run [ - 1:address:source:character, 2:address:sink:character <- new-channel 2/capacity - 3:number/routine <- start-running read-move, 1:address:source:character, screen:address:screen + local-scope + source:address:source:character, sink:address:sink:character <- new-channel 2/capacity + read-move-routine:number <- start-running read-move, source, screen:address:screen # 'read-move' is waiting for input - wait-for-routine 3:number - 4:number <- routine-state 3:number/id - 5:boolean/waiting? <- equal 4:number/routine-state, 3/waiting - assert 5:boolean/waiting?, [ + wait-for-routine read-move-routine + read-move-state:number <- routine-state read-move-routine + waiting?:boolean <- equal read-move-state, 3/waiting + assert waiting?, [ F read-move-file: routine failed to pause after coming up (before any keys were pressed)] - 1:address:sink:character <- write 1:address:sink:character, 97/a - 1:address:sink:character <- write 1:address:sink:character, 97/a - restart 3:number/routine - wait-for-routine 3:number + sink <- write sink, 97/a + sink <- write sink, 97/a + restart read-move-routine + wait-for-routine read-move-routine ] screen-should-contain [ .rank too high: a . @@ -540,18 +546,19 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color scenario read-move-empty [ assume-screen 20/width, 2/height run [ - 1:address:source:character, 2:address:sink:character <- new-channel 2/capacity - 3:number/routine <- start-running read-move, 1:address:source:character, screen:address:screen + local-scope + source:address:source:character, sink:address:sink:character <- new-channel 2/capacity + read-move-routine:number <- start-running read-move, source, screen:address:screen # 'read-move' is waiting for input - wait-for-routine 3:number - 4:number <- routine-state 3:number/id - 5:boolean/waiting? <- equal 4:number/routine-state, 3/waiting - assert 5:boolean/waiting?, [ + wait-for-routine read-move-routine + read-move-state:number <- routine-state read-move-routine + waiting?:boolean <- equal read-move-state, 3/waiting + assert waiting?, [ F read-move-file: routine failed to pause after coming up (before any keys were pressed)] - 1:address:sink:character <- write 1:address:sink:character, 10/newline - 1:address:sink:character <- write 1:address:sink:character, 97/a - restart 3:number/routine - wait-for-routine 3:number + sink <- write sink, 10/newline + sink <- write sink, 97/a + restart read-move-routine + wait-for-routine read-move-routine ] screen-should-contain [ .that's not enough . @@ -576,11 +583,12 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color scenario making-a-move [ assume-screen 30/width, 12/height run [ - 2:address:array:address:array:character/board <- initial-position - 3:address:move <- new move:type - *3:address:move <- merge 6/g, 1/'2', 6/g, 3/'4' - 2:address:array:address:array:character/board <- make-move 2:address:array:address:array:character/board, 3:address:move - screen:address:screen <- print-board screen:address:screen, 2:address:array:address:array:character/board + local-scope + board:address:array:address:array:character <- initial-position + move:address:move <- new move:type + *move <- merge 6/g, 1/'2', 6/g, 3/'4' + board <- make-move board, move + screen:address:screen <- print-board screen:address:screen, board ] screen-should-contain [ # 012345678901234567890123456789 -- cgit 1.4.1-2-gfad0