:(scenarios run_mu_scenario)
:(scenario keyboard_in_scenario)
scenario keyboard-in-scenario [
assume-keyboard [abc]
run [
1:character, 2:boolean, keyboard:address <- read-key keyboard:address
3:character, 4:boolean, keyboard:address <- read-key keyboard:address
5:character, 6:boolean, keyboard:address <- read-key keyboard:address
7:character, 8:boolean, keyboard:address <- read-key keyboard:address
]
memory-should-contain [
1 <- 97
2 <- 1
3 <- 98
4 <- 1
5 <- 99
6 <- 1
7 <- 0
8 <- 0
]
]
:(before "End Scenario Globals")
const size_t KEYBOARD = Next_predefined_global_for_scenarios++;
:(before "End Predefined Scenario Locals In Run")
Name[tmp_recipe[0]]["keyboard"] = KEYBOARD;
:(before "End Rewrite Instruction(curr)")
if (curr.name == "assume-keyboard") {
curr.operation = Recipe_number["new"];
assert(curr.products.empty());
curr.products.push_back(reagent("keyboard:address"));
curr.products[0].set_value(KEYBOARD);
result.steps.push_back(curr);
curr.clear();
curr.operation = Recipe_number["init-fake-keyboard"];
assert(curr.ingredients.empty());
curr.ingredients.push_back(reagent("keyboard:address"));
curr.ingredients[0].set_value(KEYBOARD);
assert(curr.products.empty());
curr.products.push_back(reagent("keyboard:address"));
curr.products[0].set_value(KEYBOARD);
}