-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patharray-redraw.c
39 lines (32 loc) · 988 Bytes
/
array-redraw.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
39
#include "m_pd.h"
static t_class *array_redraw_class;
typedef struct _array_redraw
{
t_object x_obj;
t_symbol *x_arrayname;
} t_array_redraw;
static void array_redraw_bang(t_array_redraw *x) {
t_garray *a;
if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
pd_error(x, "%s: no such array", x->x_arrayname->s_name);
else garray_redraw(a);
}
static void array_redraw_set(t_array_redraw *x, t_symbol *s)
{
x->x_arrayname = s;
}
static void *array_redraw_new(t_symbol *s)
{
t_array_redraw *x = (t_array_redraw *)pd_new(array_redraw_class);
x->x_arrayname = s;
return (x);
}
void setup_array0x2dredraw(void)
{
array_redraw_class = class_new(gensym("array-redraw"),
(t_newmethod)array_redraw_new, 0,
sizeof(t_array_redraw), 0, A_DEFSYM, 0);
class_addbang(array_redraw_class, array_redraw_bang);
class_addmethod(array_redraw_class, (t_method)array_redraw_set,
gensym("set"), A_SYMBOL, 0);
}