From dbe124108b7a3529feeeba91339928c4ac737072 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 23 Jun 2015 14:02:12 -0700 Subject: 1631 - update html versions Html is a little more readable thanks to feedback from J David Eisenberg (https://news.ycombinator.com/item?id=9766330), in particular the suggestion to use https://addons.mozilla.org/En-us/firefox/addon/wcag-contrast-checker. --- html/020run.cc.html | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) (limited to 'html/020run.cc.html') diff --git a/html/020run.cc.html b/html/020run.cc.html index 497766fa..c9b0fa2e 100644 --- a/html/020run.cc.html +++ b/html/020run.cc.html @@ -12,16 +12,16 @@ @@ -90,11 +90,11 @@ void run(recipe_number r) void run_current_routine() { // curly on a separate line, because later layers will modify header -//? cerr << "AAA 6\n"; //? 2 +//? cerr << "AAA 6\n"; //? 3 while (!Current_routine->completed()) // later layers will modify condition { //? cerr << "AAA 7: " << current_step_index() << '\n'; //? 1 - // Running One Instruction. + // Running One Instruction if (current_instruction().is_label) { ++current_step_index(); continue; } trace(Initial_callstack_depth+Callstack_depth, "run") << current_instruction().to_string(); assert(Memory[0] == 0); @@ -108,6 +108,7 @@ void run_current_routine() // Instructions below will write to 'products'. vector<vector<double> > products; //? cerr << "AAA 8: " << current_instruction().operation << " ^" << Recipe[current_instruction().operation].name << "$\n"; //? 1 +//? cerr << "% " << current_recipe_name() << "/" << current_step_index() << ": " << Memory[1013] << ' ' << Memory[1014] << '\n'; //? 1 switch (current_instruction().operation) { // Primitive Recipe Implementations case COPY: { @@ -124,9 +125,10 @@ void run_current_routine() for (long long int i = 0; i < SIZE(current_instruction().products); ++i) { write_memory(current_instruction().products.at(i), products.at(i)); } + // End of Instruction ++current_step_index(); } -//? cerr << "AAA 9\n"; //? 1 +//? cerr << "AAA 9\n"; //? 2 stop_running_current_routine:; } @@ -198,13 +200,14 @@ load_permanently("cor :(code) // helper for tests void run(string form) { -//? cerr << "AAA 2\n"; //? 1 +//? cerr << "AAA 2\n"; //? 2 +//? cerr << form << '\n'; //? 1 vector<recipe_number> tmp = load(form); if (tmp.empty()) return; transform_all(); -//? cerr << "AAA 3\n"; //? 1 +//? cerr << "AAA 3\n"; //? 2 run(tmp.front()); -//? cerr << "YYY\n"; //? 1 +//? cerr << "YYY\n"; //? 2 } //:: Reading from memory, writing to memory. @@ -212,7 +215,7 @@ void run(string form)(reagent x) { //? cout << "read_memory: " << x.to_string() << '\n'; //? 2 vector<double> result; - if (isa_literal(x)) { + if (is_literal(x)) { result.push_back(x.value); return result; } @@ -228,9 +231,11 @@ vector<double> read_memory(reagent x(reagent x, vector<double> data) { if (is_dummy(x)) return; + if (is_literal(x)) return; long long int base = x.value; - if (size_of(x) != SIZE(data)) - raise << "size mismatch in storing to " << x.to_string() << '\n'; + if (size_mismatch(x, data)) { + raise << current_recipe_name() << ": size mismatch in storing to " << x.to_string() << " at " << current_instruction().to_string() << '\n' << die(); + } for (long long int offset = 0; offset < SIZE(data); ++offset) { trace(Primitive_recipe_depth, "mem") << "storing " << data.at(offset) << " in location " << base+offset; Memory[base+offset] = data.at(offset); @@ -246,11 +251,15 @@ long long int size_of(const vector<type_number return 1; } +bool size_mismatch(const reagent& x, const vector<double>& data) { + return size_of(x) != SIZE(data); +} + bool is_dummy(const reagent& x) { return x.name == "_"; } -bool isa_literal(const reagent& r) { +bool is_literal(const reagent& r) { return SIZE(r.types) == 1 && r.types.at(0) == 0; } @@ -269,6 +278,12 @@ recipe main [ _ <- copy 0:literal ] +run: _ <- copy 0:literal + +:(scenario run_literal) +recipe main [ + 0:literal/screen <- copy 0:literal +] +-mem: storing 0 in location 0 -- cgit 1.4.1-2-gfad0