diff options
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;  } | 
