summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/eval.c b/src/eval.c
index d6c8933..98ad3bf 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -21,6 +21,31 @@ create_hash(recipe * r)
sha1digest(NULL, r->sha1, (uint8_t *)data, strlen(data));
}
+int
+eval_step(step * s)
+{
+ s->duration = strdup(s->inst);
+ s->result = strdup(s->inst);
+ return 0;
+}
+
+int
+resolve_steps(recipe * r)
+{
+ if (!r) return 1;
+
+ int rc = 0;
+ for (int i=0; i < r->sn; i++) {
+ rc += eval_step(r->s[i]);
+ }
+
+ if (rc > 0) {
+ return 1;
+ }
+
+ return 0;
+}
+
recipe *
eval(recipe * r)
{
@@ -33,6 +58,8 @@ eval(recipe * r)
copy_subrecipes(_r, r, 0 /* shallow copy off */);
create_hash(_r);
+
+ resolve_steps(_r);
return _r;
}