From a654e4ecace2d506d1b10f1dde2c287ebe84ef37 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 26 Mar 2016 23:59:59 -0700 Subject: 2812 --- html/082scenario_screen.cc.html | 89 +++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 40 deletions(-) (limited to 'html/082scenario_screen.cc.html') diff --git a/html/082scenario_screen.cc.html b/html/082scenario_screen.cc.html index 4bc94f75..5bf73b8d 100644 --- a/html/082scenario_screen.cc.html +++ b/html/082scenario_screen.cc.html @@ -3,28 +3,36 @@ Mu - 082scenario_screen.cc - - + + - + + + + -
+
 //: Clean syntax to manipulate and check the screen in scenarios.
 //: Instructions 'assume-screen' and 'screen-should-contain' implicitly create
 //: a variable called 'screen' that is accessible inside other 'run'
@@ -37,7 +45,7 @@ scenario screen-in-scenario [
   assume-screen 5/width, 3/height
   run [
     1:character <- copy 97/a
-    screen:address:shared:screen <- print screen:address:shared:screen, 1:character/a
+    screen:address:shared:screen <- print screen:address:shared:screen, 1:character/a
   ]
   screen-should-contain [
   #  01234
@@ -52,9 +60,9 @@ scenario screen-in-scenario-unicode-color [
   assume-screen 5/width, 3/height
   run [
     1:character <- copy 955/greek-small-lambda
-    screen:address:shared:screen <- print screen:address:shared:screen, 1:character/lambda, 1/red
+    screen:address:shared:screen <- print screen:address:shared:screen, 1:character/lambda, 1/red
     2:character <- copy 97/a
-    screen:address:shared:screen <- print screen:address:shared:screen, 2:character/a
+    screen:address:shared:screen <- print screen:address:shared:screen, 2:character/a
   ]
   screen-should-contain [
   #  01234
@@ -70,9 +78,9 @@ scenario screen-in-scenario-color [
   assume-screen 5/width, 3/height
   run [
     1:character <- copy 955/greek-small-lambda
-    screen:address:shared:screen <- print screen:address:shared:screen, 1:character/lambda, 1/red
+    screen:address:shared:screen <- print screen:address:shared:screen, 1:character/lambda, 1/red
     2:character <- copy 97/a
-    screen:address:shared:screen <- print screen:address:shared:screen, 2:character/a, 7/white
+    screen:address:shared:screen <- print screen:address:shared:screen, 2:character/a, 7/white
   ]
   # screen-should-contain shows everything
   screen-should-contain [
@@ -105,7 +113,7 @@ scenario screen-in-scenario-error [
   assume-screen 5/width, 3/height
   run [
     1:character <- copy 97/a
-    screen:address:shared:screen <- print screen:address:shared:screen, 1:character/a
+    screen:address:shared:screen <- print screen:address:shared:screen, 1:character/a
   ]
   screen-should-contain [
   #  01234
@@ -124,7 +132,7 @@ scenario screen-in-scenario-color [
   assume-screen 5/width, 3/height
   run [
     1:character <- copy 97/a
-    screen:address:shared:screen <- print screen:address:shared:screen, 1:character/a, 1/red
+    screen:address:shared:screen <- print screen:address:shared:screen, 1:character/a, 1/red
   ]
   screen-should-contain-in-color 2/green, [
   #  01234
@@ -143,7 +151,7 @@ scenario screen-in-scenario-color [
 :(scenario convert_names_does_not_fail_when_mixing_special_names_and_numeric_locations)
 % Scenario_testing_scenario = true;
 def main [
-  screen:number <- copy 1:number
+  screen:number <- copy 1:number
 ]
 -error: mixing variable names and numeric addresses in main
 $error: 0
@@ -153,8 +161,8 @@ $error: 0
 // Scenarios may not define default-space, so they should fit within the
 // initial area of memory reserved for tests. We'll put the predefined
 // variables available to them at the end of that region.
-const long long int Max_variables_in_scenarios = Reserved_for_tests-100;
-long long int Next_predefined_global_for_scenarios = Max_variables_in_scenarios;
+const int Max_variables_in_scenarios = Reserved_for_tests-100;
+int Next_predefined_global_for_scenarios = Max_variables_in_scenarios;
 :(before "End Setup")
 assert(Next_predefined_global_for_scenarios < Reserved_for_tests);
 :(after "transform_all()" following "case RUN:")
@@ -165,7 +173,7 @@ assert(Name[tmp_recipe.:(before "End Globals")
 // Scenario Globals.
-const long long int SCREEN = Next_predefined_global_for_scenarios++;
+const int SCREEN = Next_predefined_global_for_scenarios++;
 // End Scenario Globals.
 :(before "End Special Scenario Variable Names(r)")
 Name[r]["screen"] = SCREEN;
@@ -217,8 +225,8 @@ put(Recipe_ordinal,:(before "End Types")
 // scan an array of characters in a unicode-aware, bounds-checked manner
 struct raw_string_stream {
-  long long int index;
-  const long long int max;
+  int index;
+  const int max;
   const char* buf;
 
   raw_string_stream(const string&);
@@ -231,23 +239,23 @@ put(Recipe_ordinal,:(code)
 void check_screen(const string& expected_contents, const int color) {
   assert(!current_call().default_space);  // not supported
-  long long int screen_location = get_or_insert(Memory, SCREEN)+/*skip refcount*/1;
+  int screen_location = get_or_insert(Memory, SCREEN)+/*skip refcount*/1;
   int data_offset = find_element_name(get(Type_ordinal, "screen"), "data", "");
   assert(data_offset >= 0);
-  long long int screen_data_location = screen_location+data_offset;  // type: address:shared:array:character
-  long long int screen_data_start = get_or_insert(Memory, screen_data_location) + /*skip refcount*/1;  // type: array:character
+  int screen_data_location = screen_location+data_offset;  // type: address:shared:array:character
+  int screen_data_start = get_or_insert(Memory, screen_data_location) + /*skip refcount*/1;  // type: array:character
   int width_offset = find_element_name(get(Type_ordinal, "screen"), "num-columns", "");
-  long long int screen_width = get_or_insert(Memory, screen_location+width_offset);
+  int screen_width = get_or_insert(Memory, screen_location+width_offset);
   int height_offset = find_element_name(get(Type_ordinal, "screen"), "num-rows", "");
-  long long int screen_height = get_or_insert(Memory, screen_location+height_offset);
+  int screen_height = get_or_insert(Memory, screen_location+height_offset);
   raw_string_stream cursor(expected_contents);
   // todo: too-long expected_contents should fail
-  long long int addr = screen_data_start+/*skip length*/1;
-  for (long long int row = 0; row < screen_height; ++row) {
+  int addr = screen_data_start+/*skip length*/1;
+  for (int row = 0; row < screen_height; ++row) {
     cursor.skip_whitespace_and_comments();
     if (cursor.at_end()) break;
     assert(cursor.get() == '.');
-    for (long long int column = 0;  column < screen_width;  ++column, addr+= /*size of screen-cell*/2) {
+    for (int column = 0;  column < screen_width;  ++column, addr+= /*size of screen-cell*/2) {
       const int cell_color_offset = 1;
       uint32_t curr = cursor.get();
       if (get_or_insert(Memory, addr) == 0 && isspace(curr)) continue;
@@ -366,20 +374,20 @@ put(Recipe_ordinal,:(code)
 void dump_screen() {
   assert(!current_call().default_space);  // not supported
-  long long int screen_location = get_or_insert(Memory, SCREEN) + /*skip refcount*/1;
+  int screen_location = get_or_insert(Memory, SCREEN) + /*skip refcount*/1;
   int width_offset = find_element_name(get(Type_ordinal, "screen"), "num-columns", "");
-  long long int screen_width = get_or_insert(Memory, screen_location+width_offset);
+  int screen_width = get_or_insert(Memory, screen_location+width_offset);
   int height_offset = find_element_name(get(Type_ordinal, "screen"), "num-rows", "");
-  long long int screen_height = get_or_insert(Memory, screen_location+height_offset);
+  int screen_height = get_or_insert(Memory, screen_location+height_offset);
   int data_offset = find_element_name(get(Type_ordinal, "screen"), "data", "");
   assert(data_offset >= 0);
-  long long int screen_data_location = screen_location+data_offset;  // type: address:shared:array:character
-  long long int screen_data_start = get_or_insert(Memory, screen_data_location) + /*skip refcount*/1;  // type: array:character
+  int screen_data_location = screen_location+data_offset;  // type: address:shared:array:character
+  int screen_data_start = get_or_insert(Memory, screen_data_location) + /*skip refcount*/1;  // type: array:character
   assert(get_or_insert(Memory, screen_data_start) == screen_width*screen_height);
-  long long int curr = screen_data_start+1;  // skip length
-  for (long long int row = 0; row < screen_height; ++row) {
+  int curr = screen_data_start+1;  // skip length
+  for (int row = 0; row < screen_height; ++row) {
     cerr << '.';
-    for (long long int col = 0; col < screen_width; ++col) {
+    for (int col = 0; col < screen_width; ++col) {
       if (get_or_insert(Memory, curr))
         cerr << to_unicode(static_cast<uint32_t>(get_or_insert(Memory, curr)));
       else
@@ -392,3 +400,4 @@ put(Recipe_ordinal,
 
 
+
-- 
cgit 1.4.1-2-gfad0