diff options
-rw-r--r-- | 012transform.cc | 5 | ||||
-rw-r--r-- | 014literal_string.cc | 3 | ||||
-rw-r--r-- | 053rewrite_stash.cc | 12 |
3 files changed, 19 insertions, 1 deletions
diff --git a/012transform.cc b/012transform.cc index fd3b25ff..4b441f86 100644 --- a/012transform.cc +++ b/012transform.cc @@ -39,15 +39,20 @@ vector<transform_fn> Transform; :(code) void transform_all() { trace(9990, "transform") << "=== transform_all()" << end(); +//? cerr << "=== transform_all\n"; for (int t = 0; t < SIZE(Transform); ++t) { //? cerr << "transform " << t << '\n'; for (map<recipe_ordinal, recipe>::iterator p = Recipe.begin(); p != Recipe.end(); ++p) { recipe& r = p->second; +//? cerr << "000 " << r.name << ' ' << SIZE(r.steps) << '\n'; if (r.steps.empty()) continue; +//? cerr << "001 " << r.name << '\n'; if (r.transformed_until != t-1) continue; +//? cerr << "002 " << r.name << '\n'; // End Transform Checks (*Transform.at(t))(/*recipe_ordinal*/p->first); r.transformed_until = t; +//? cerr << "009 after transform " << t << ": " << to_string(r) << '\n'; } } //? cerr << "wrapping up transform\n"; diff --git a/014literal_string.cc b/014literal_string.cc index 7986d0f3..f0fe8d7f 100644 --- a/014literal_string.cc +++ b/014literal_string.cc @@ -1,4 +1,5 @@ -//: For convenience, some instructions will take literal arrays of characters (strings). +//: For convenience, some instructions will take literal arrays of characters +//: (text or strings). //: //: Instead of quotes, we'll use [] to delimit strings. That'll reduce the //: need for escaping since we can support nested brackets. And we can also diff --git a/053rewrite_stash.cc b/053rewrite_stash.cc index 9ce044a8..2d5b5964 100644 --- a/053rewrite_stash.cc +++ b/053rewrite_stash.cc @@ -1,6 +1,16 @@ //: when encountering other types, try to convert them to strings using //: 'to-text' +:(scenarios transform) +:(scenario rewrite_stashes_to_text) +recipe main [ + local-scope + n:number <- copy 34 + stash n +] ++transform: stash_0_0:address:shared:array:character <- to-text-line n ++transform: stash stash_0_0:address:shared:array:character + :(before "End Instruction Inserting/Deleting Transforms") Transform.push_back(rewrite_stashes_to_text); @@ -41,11 +51,13 @@ void rewrite_stashes_to_text_named(recipe& caller) { ostringstream ingredient_name; ingredient_name << "stash_" << stash_instruction_idx << '_' << j << ":address:shared:array:character"; def.products.push_back(reagent(ingredient_name.str())); + trace(9993, "transform") << to_string(def) << end(); new_instructions.push_back(def); inst.ingredients.at(j).clear(); // reclaim old memory inst.ingredients.at(j) = reagent(ingredient_name.str()); } } + trace(9993, "transform") << to_string(inst) << end(); new_instructions.push_back(inst); } new_instructions.swap(caller.steps); |