icfp12/ovm/task.h
2009-06-26 23:13:17 +02:00

28 lines
548 B
C

#ifndef OVM_TASK_H
#define OVM_TASK_H
#include "base.h"
typedef struct {
gdouble scenario;
guint in_size, out_size;
gdouble *in, *out;
} task_t;
typedef void (*task_app_t)(task_t *task);
task_t* task_new(gdouble scenario, guint in_size, guint out_size);
void task_free(task_t *task);
void ovm_init();
void ovm_step(gdouble scenario, gdouble *in, gdouble *out);
static inline void task_run(task_t *task, task_app_t app) {
ovm_init();
while (task->out[0] == 0.0) {
app(task);
ovm_step(task->scenario, task->in, task->out);
}
}
#endif