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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#include "../src/tof.h"
static t_class *tokenArgs_class;
typedef struct _tokenArgs
{
t_object x_obj;
t_outlet* outlet;
t_canvas* canvas;
char token;
int size;
int ac;
t_atom* av;
} t_tokenArgs;
// Dump out
static void tokenArgs_bang(t_tokenArgs *x) {
int ac_a;
t_atom* av_a;
t_symbol* selector_a;
int iter = 0 ;
while ( tof_next_tagged_argument(x->token, x->ac, x->av, &ac_a, &av_a,&iter)) {
tof_set_selector(&selector_a,&ac_a,&av_a);
outlet_anything(x->outlet, selector_a, ac_a, av_a);
}
}
static void tokenArgs_free(t_tokenArgs *x)
{
freebytes(x->av,x->ac*sizeof(*(x->av)));
}
static void *tokenArgs_new(t_symbol *s) {
t_tokenArgs *x = (t_tokenArgs *)pd_new(tokenArgs_class);
x->token = s->s_name[0];
//x->canvas = tof_get_canvas();
// I guess the canvas is currently set :)
int ac;
t_atom* av;
canvas_getargs(&ac, &av);
x->ac = ac;
x->av = getbytes(x->ac * sizeof(*(x->av)));
tof_copy_atoms(av,x->av,x->ac);
x->outlet = outlet_new(&x->x_obj, &s_list);
return (x);
}
void tokenArgs_setup(void) {
tokenArgs_class = class_new(gensym("tokenArgs"),
(t_newmethod)tokenArgs_new, (t_method)tokenArgs_free,
sizeof(t_tokenArgs), 0, A_DEFSYMBOL, 0);
class_addbang(tokenArgs_class, tokenArgs_bang);
//class_addsymbol(tokenArgs_class, tokenArgs_symbol);
//class_addmethod(tokenArgs_class, (t_method) tokenArgs_values, gensym("values"), A_DEFSYMBOL,0);
//class_addmethod(tokenArgs_class, (t_method) tokenArgs_guis, gensym("guis"), A_DEFSYMBOL,0);
//class_addmethod(tokenArgs_class, (t_method) tokenArgs_updateguis, gensym("updateguis"), A_DEFSYMBOL,0);
//class_addmethod(tokenArgs_class, (t_method) tokenArgs_update_guis, gensym("update"), A_DEFSYMBOL,0);
}
|