diff options
-rw-r--r-- | 010vm.cc | 12 | ||||
-rw-r--r-- | 032array.cc | 2 | ||||
-rw-r--r-- | 034address.cc | 10 | ||||
-rw-r--r-- | 038new_text.cc | 4 | ||||
-rw-r--r-- | 043space.cc | 2 | ||||
-rw-r--r-- | 085scenario_console.cc | 4 |
6 files changed, 17 insertions, 17 deletions
diff --git a/010vm.cc b/010vm.cc index 198244e4..e1d7497e 100644 --- a/010vm.cc +++ b/010vm.cc @@ -650,13 +650,13 @@ ostream& operator<<(ostream& os, no_scientific x) { string trim_floating_point(const string& in) { if (in.empty()) return ""; - int len = SIZE(in); - while (len > 1) { - if (in.at(len-1) != '0') break; - --len; + int length = SIZE(in); + while (length > 1) { + if (in.at(length-1) != '0') break; + --length; } - if (in.at(len-1) == '.') --len; - return in.substr(0, len); + if (in.at(length-1) == '.') --length; + return in.substr(0, length); } void test_trim_floating_point() { diff --git a/032array.cc b/032array.cc index 2a4f83ae..0cb27bd3 100644 --- a/032array.cc +++ b/032array.cc @@ -50,7 +50,7 @@ case CREATE_ARRAY: { // Update CREATE_ARRAY product in Run int base_address = product.value; int array_length = to_integer(product.type->right->right->name); - // initialize array size, so that size_of will work + // initialize array length, so that size_of will work trace(9999, "mem") << "storing " << array_length << " in location " << base_address << end(); put(Memory, base_address, array_length); // in array elements int size = size_of(product); // in locations diff --git a/034address.cc b/034address.cc index 6a688240..cd48680b 100644 --- a/034address.cc +++ b/034address.cc @@ -269,7 +269,7 @@ case ALLOCATE: { int size = ingredients.at(0).at(0); if (SIZE(ingredients) > 1) { // array allocation - trace(9999, "mem") << "array size is " << ingredients.at(1).at(0) << end(); + trace(9999, "mem") << "array length is " << ingredients.at(1).at(0) << end(); size = /*space for length*/1 + size*ingredients.at(1).at(0); } int result = allocate(size); @@ -350,8 +350,8 @@ def main [ 3:number/raw <- subtract 2:address:number/raw, 1:address:array:number/raw ] +run: {1: ("address" "array" "number"), "raw": ()} <- new {number: "type"}, {5: "literal"} -+mem: array size is 5 -# don't forget the extra location for array size, and the second extra location for the refcount ++mem: array length is 5 +# don't forget the extra location for array length, and the second extra location for the refcount +mem: storing 7 in location 3 :(scenario new_empty_array) @@ -361,8 +361,8 @@ def main [ 3:number/raw <- subtract 2:address:number/raw, 1:address:array:number/raw ] +run: {1: ("address" "array" "number"), "raw": ()} <- new {number: "type"}, {0: "literal"} -+mem: array size is 0 -# one location for array size, and one for the refcount ++mem: array length is 0 +# one location for array length, and one for the refcount +mem: storing 2 in location 3 //: If a routine runs out of its initial allocation, it should allocate more. diff --git a/038new_text.cc b/038new_text.cc index ad0bb99a..46e4db7c 100644 --- a/038new_text.cc +++ b/038new_text.cc @@ -36,7 +36,7 @@ int new_mu_string(const string& contents) { int string_length = unicode_length(contents); //? Total_alloc += string_length+1; //? ++Num_alloc; - int result = allocate(string_length+/*array size*/1); + int result = allocate(string_length+/*array length*/1); trace(9999, "mem") << "storing string refcount 0 in location " << result << end(); put(Memory, result, 0); int curr_address = result+/*skip refcount*/1; @@ -103,7 +103,7 @@ if (!canonize_type(x)) return false; % Initial_memory_per_routine = 3; def main [ 1:address:number/raw <- new number:type - 2:address:array:character/raw <- new [a] # not enough room in initial page, if you take the refcount and array size into account + 2:address:array:character/raw <- new [a] # not enough room in initial page, if you take the refcount and array length into account ] +new: routine allocated memory from 1000 to 1003 +new: routine allocated memory from 1003 to 1006 diff --git a/043space.cc b/043space.cc index b8f00918..15325c3c 100644 --- a/043space.cc +++ b/043space.cc @@ -162,7 +162,7 @@ def main [ y:number <- copy 3 ] # allocate space for x and y, as well as the chaining slot at 0 -+mem: array size is 3 ++mem: array length is 3 :(before "End is_disqualified Cases") if (x.name == "number-of-locals") diff --git a/085scenario_console.cc b/085scenario_console.cc index d18792af..1e11af12 100644 --- a/085scenario_console.cc +++ b/085scenario_console.cc @@ -255,8 +255,8 @@ case REPLACE_IN_CONSOLE: { } int console_address = get_or_insert(Memory, CONSOLE); int console_data = get_or_insert(Memory, console_address+1); - int size = get_or_insert(Memory, console_data); // array size - for (int i = 0, curr = console_data+1; i < size; ++i, curr+=size_of_event()) { + int length = get_or_insert(Memory, console_data); // array length + for (int i = 0, curr = console_data+1; i < length; ++i, curr+=size_of_event()) { if (get_or_insert(Memory, curr) != /*text*/0) continue; if (get_or_insert(Memory, curr+1) != ingredients.at(0).at(0)) continue; for (int n = 0; n < size_of_event(); ++n) |