dol: initial dol commit
[jump.git] / dol / examples / examplecell / src / consumer.c
1 #include <stdio.h>
2
3 #include "consumer.h"
4
5 void consumer_init(DOLProcess *p) {
6     sprintf(p->local->name, "consumer");
7     p->local->index = 0;
8     p->local->len = LENGTH;
9 }
10
11 int consumer_fire(DOLProcess *p) {
12     if (p->local->index < p->local->len) {
13         DOL_read((void*)PORT_IN, &p->local->c, sizeof(float), p);
14         printf("%s: %f\n", p->local->name, p->local->c);
15         p->local->index++;
16     } else {
17         DOL_detach(p);
18         return -1;
19     }
20
21     return 0;
22 }
23