From ce9b2b0515eaf92a9c68c8608fd9bf392c941d50 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Fri, 15 Jun 2018 22:16:09 -0700 Subject: 4258 - undo 4257 --- 089scenario_filesystem.cc | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to '089scenario_filesystem.cc') diff --git a/089scenario_filesystem.cc b/089scenario_filesystem.cc index bacb61be..f14534ac 100644 --- a/089scenario_filesystem.cc +++ b/089scenario_filesystem.cc @@ -71,7 +71,7 @@ scenario escaping-file-contents [ ] :(before "End Globals") -extern const int RESOURCES = next_predefined_global_for_scenarios(/*size_of(address:resources)*/2); +extern const int RESOURCES = Next_predefined_global_for_scenarios++; //: give 'resources' a fixed location in scenarios :(before "End Special Scenario Variable Names(r)") Name[r]["resources"] = RESOURCES; @@ -203,28 +203,26 @@ string munge_resources_contents(const string& data, const string& filename, cons } void construct_resources_object(const map& contents) { - int resources_data_address = allocate(SIZE(contents) * /*size of resource*/4 + /*array length*/1); - int curr = resources_data_address + /*skip alloc id*/1 + /*skip array length*/1; + int resources_data_address = allocate(SIZE(contents)*2 + /*array length*/1); + int curr = resources_data_address + /*skip length*/1; for (map::const_iterator p = contents.begin(); p != contents.end(); ++p) { - ++curr; // skip alloc id of resource.name put(Memory, curr, new_mu_text(p->first)); trace("mem") << "storing file name " << get(Memory, curr) << " in location " << curr << end(); ++curr; - ++curr; // skip alloc id of resource.contents put(Memory, curr, new_mu_text(p->second)); trace("mem") << "storing file contents " << get(Memory, curr) << " in location " << curr << end(); ++curr; } - curr = resources_data_address + /*skip alloc id of resources.data*/1; - put(Memory, curr, SIZE(contents)); // array length + curr = resources_data_address; + put(Memory, curr, SIZE(contents)); // size of array trace("mem") << "storing resources size " << get(Memory, curr) << " in location " << curr << end(); // wrap the resources data in a 'resources' object int resources_address = allocate(size_of_resources()); - curr = resources_address+/*alloc id*/1+/*offset of 'data' element*/1+/*skip alloc id of 'data' element*/1; + curr = resources_address+/*offset of 'data' element*/1; put(Memory, curr, resources_data_address); trace("mem") << "storing resources data address " << resources_data_address << " in location " << curr << end(); // save in product - put(Memory, RESOURCES+/*skip alloc id*/1, resources_address); + put(Memory, RESOURCES, resources_address); trace("mem") << "storing resources address " << resources_address << " in location " << RESOURCES << end(); } -- cgit 1.4.1-2-gfad0