dol: initial dol commit
[jump.git] / dol / examples / example5 / src / consumer.c
1 #include <stdio.h>
2
3 #include "consumer.h"
4
5 void consumer_init(DOLProcess *p)
6 {
7   ; //nothing to be done here
8 }
9
10 int consumer_fire(DOLProcess *p)
11 {
12   CREATEPORTVAR(input_port);
13
14   for (p->local->index = 0; p->local->index < NUMBER_OF_FFT_POINTS;
15        p->local->index++) {
16     CREATEPORT(input_port, PORT_OUTPUT_COEFFICIENTS, 1,
17             p->local->index, NUMBER_OF_FFT_POINTS);
18     DOL_read((void*)input_port, &(p->local->coeffs[p->local->index]),
19         sizeof(ComplexNumber), p);
20     printf("%15s: coeff[%d]: %9f + j * %9f\n",
21            "output_consumer", p->local->index,
22            p->local->coeffs[p->local->index].real,
23            p->local->coeffs[p->local->index].imag);
24   }
25
26   DOL_detach(p);
27   return -1;
28 }
29