about summary refs log tree commit diff stats
path: root/010vm.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-10-28 18:19:41 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-10-28 18:26:05 -0700
commit70f70118f468b51ac14b7e992b0ec941c3a50d4d (patch)
tree07749a54af09d9bfbeb93b7b52dc4a175ed6a886 /010vm.cc
parentb69daf785df8dee56f851ce9d6dd38d7779a04ca (diff)
downloadmu-70f70118f468b51ac14b7e992b0ec941c3a50d4d.tar.gz
2306 - recipe headers
Once a student has gotten used to recipes and ingredients using the
staged 'next-ingredient' approach there's no reason to avoid
conventional function headers. As an added bonus we can now:

a) check that all 'reply' instructions in a recipe are consistent
b) deduce what to reply without needing to say so everytime
c) start thinking about type parameters for recipes (generic functions!)
Diffstat (limited to '010vm.cc')
-rw-r--r--010vm.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/010vm.cc b/010vm.cc
index 47a2d01c..08da15a3 100644
--- a/010vm.cc
+++ b/010vm.cc
@@ -38,6 +38,7 @@ struct instruction {
   // End instruction Fields
   instruction();
   void clear();
+  bool is_clear();
   string to_string() const;
 };
 
@@ -222,6 +223,7 @@ instruction::instruction() :is_label(false), operation(IDLE) {
   // End instruction Constructor
 }
 void instruction::clear() { is_label=false; label.clear(); operation=IDLE; ingredients.clear(); products.clear(); }
+bool instruction::is_clear() { return !is_label && operation == IDLE; }
 
 // Reagents have the form <name>:<type>:<type>:.../<property>/<property>/...
 reagent::reagent(string s) :original_string(s), value(0), initialized(false), type(NULL) {