diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-10-28 18:19:41 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-10-28 18:26:05 -0700 |
commit | 70f70118f468b51ac14b7e992b0ec941c3a50d4d (patch) | |
tree | 07749a54af09d9bfbeb93b7b52dc4a175ed6a886 /010vm.cc | |
parent | b69daf785df8dee56f851ce9d6dd38d7779a04ca (diff) | |
download | mu-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.cc | 2 |
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) { |