1
/******************************************************
3
* zexy - implementation file
5
* copyleft (c) IOhannes m zm�lnig
7
* 1999:forum::f�r::uml�ute:2004
9
* institute of electronic music and acoustics (iem)
11
******************************************************
13
* license: GNU General Public License v.2
15
******************************************************/
18
/* 2305:forum::f�r::uml�ute:2001 */
22
/* ------------------------- zunpack ------------------------------- */
24
/* like pack, but does no type-checking */
26
static t_class *zunpack_class;
28
typedef struct _zunpack
35
static void zunpack_list(t_zunpack *x, t_symbol *s, int argc, t_atom *argv)
37
int count=(argc<(x->x_numouts))?argc:x->x_numouts;
40
outlet_list(x->x_out[count], gensym("list"), 1, argv+count);
44
static void zunpack_bang(t_zunpack *x)
46
outlet_bang(x->x_out[0]);
49
static void zunpack_free(t_zunpack *x)
52
for(i=0; i<x->x_numouts; i++) {
53
outlet_free(x->x_out[i]);
55
freebytes(x->x_out, x->x_numouts*sizeof(t_outlet*));
61
static void *zunpack_new(t_symbol*s, int argc, t_atom*argv)
63
t_zunpack *x = (t_zunpack *)pd_new(zunpack_class);
64
int count=(argc>0)?argc:2;
68
x->x_out=(t_outlet**)getbytes(count*sizeof(t_outlet*));
70
for(i=0; i<count; i++) {
71
x->x_out[i] =outlet_new(&x->x_obj, 0);
77
void zunpack_setup(void)
80
zunpack_class = class_new(gensym("zexy/unpack"),
81
(t_newmethod)zunpack_new, (t_method)zunpack_free, sizeof(t_zunpack),
84
/* oops Pd-0.42 allows us to override built-ins
85
* this is bad as long as the 2 objects are not compatible */
86
class_addcreator((t_newmethod)zunpack_new, gensym("unpack"), A_GIMME, 0);
89
class_addbang(zunpack_class, zunpack_bang);
90
class_addlist(zunpack_class, zunpack_list);
92
zexy_register("unpack");
95
void unpack_setup(void)