From 3c435756bcd997dac981ca78c49c5100eb2211b7 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 16 Mar 2015 20:26:59 -0700 Subject: 932 - clean up comments in the tangled c++ --- cpp/012run | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'cpp/012run') diff --git a/cpp/012run b/cpp/012run index 42b5d477..3d1395a9 100644 --- a/cpp/012run +++ b/cpp/012run @@ -19,7 +19,7 @@ recipe main [ :(before "End Types") // Book-keeping while running a recipe. -// Later layers will change this. +//: Later layers will change this. struct routine { recipe_number running_recipe; size_t running_at; @@ -27,11 +27,6 @@ struct routine { }; :(code) -void run(string form) { - vector recipes_added = add_recipes(form); - run(recipes_added.front()); -} - void run(recipe_number r) { run(routine(r)); } @@ -59,9 +54,9 @@ void run(routine rr) { } } -// Some helpers. -// We'll need to override these later as we change the definition of routine. -// Important that they return referrences into the routine. +//: Some helpers. +//: We'll need to override these later as we change the definition of routine. +//: Important that they return referrences into the routine. inline size_t& running_at(routine& rr) { return rr.running_at; } @@ -92,6 +87,25 @@ if (argc > 1) { dump_memory(); } +//: helper for tests + +:(before "End Globals") +vector recipes_added_by_test; + +:(code) +void run(string form) { + vector tmp = add_recipes(form); + recipes_added_by_test.insert(recipes_added_by_test.end(), tmp.begin(), tmp.end()); + run(recipes_added_by_test.front()); +} + +:(before "End Setup") +for (size_t i = 0; i < recipes_added_by_test.size(); ++i) { + Recipe_number.erase(Recipe[recipes_added_by_test[i]].name); + Recipe.erase(recipes_added_by_test[i]); +} +recipes_added_by_test.clear(); + :(code) vector read_memory(reagent x) { //? cout << "read_memory: " << x.to_string() << '\n'; //? 1 -- cgit 1.4.1-2-gfad0