diff options
author | Anastasios Grammenos <anastasios.grammenos@noris.gr> | 2022-10-23 19:20:39 +0300 |
---|---|---|
committer | Anastasios Grammenos <anastasios.grammenos@noris.gr> | 2022-10-23 19:20:39 +0300 |
commit | 7c5af1b2768247984a08569b35e47ff927e70389 (patch) | |
tree | 04ebe56d46bc4511a5549b0eda2a136d682185ea /src/eval.c | |
parent | 7b7240d50dd5e418bc17beff48aa5681b398b980 (diff) | |
download | foodtools-7c5af1b2768247984a08569b35e47ff927e70389.tar.gz foodtools-7c5af1b2768247984a08569b35e47ff927e70389.tar.bz2 foodtools-7c5af1b2768247984a08569b35e47ff927e70389.zip |
Start work for step evaluation
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -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; } |