-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsporth.c
38 lines (31 loc) · 783 Bytes
/
sporth.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <stdio.h>
#include <stdlib.h>
#include "plumber.h"
typedef struct {
plumber_data pd;
} UserData;
static void process(sp_data *sp, void *udata){
UserData *ud = udata;
plumber_data *pd = &ud->pd;
SPFLOAT out = 0;
int chan;
if(pd->recompile) {
plumber_recompile_string(&ud->pd, pd->str);
pd->recompile = 0;
}
plumber_compute(pd, PLUMBER_COMPUTE);
for (chan = 0; chan < sp->nchan; chan++) {
out = sporth_stack_pop_float(&pd->sporth.stack);
sp->out[chan] = out;
}
if(pd->showprog) {
/* sp_progress_compute(sp, pd->prog, NULL, NULL); */
}
}
int main(int argc, char *argv[])
{
UserData ud;
plumber_init(&ud.pd);
sporth_run(&ud.pd, argc, argv, &ud, process);
return 0;
}