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
******************************************************/
17
/* print the incoming message as raw as possible */
22
static t_class *rawprint_class;
24
typedef struct _rawprint {
29
static void rawprint_any(t_rawprint *x, t_symbol*s, int argc, t_atom*argv)
31
char buf[MAXPDSTRING];
33
startpost("%s: ", x->label->s_name);
35
startpost("\"%s\"", s->s_name);
37
switch(argv->a_type) {
39
snprintf(buf, MAXPDSTRING-1, "%f", atom_getfloat(argv));
42
snprintf(buf, MAXPDSTRING-1, "'%s'", atom_getsymbol(argv)->s_name);
45
snprintf(buf, MAXPDSTRING-1, "pointer[0x%X]", argv->a_w.w_gpointer);
48
snprintf(buf, MAXPDSTRING-1, "SEMI");
51
snprintf(buf, MAXPDSTRING-1, "COMMA");
54
snprintf(buf, MAXPDSTRING-1, "DEFFLOAT[%f]", atom_getfloat(argv));
57
snprintf(buf, MAXPDSTRING-1, "DEFSYM['%s']", atom_getsymbol(argv)->s_name);
60
snprintf(buf, MAXPDSTRING-1, "DOLLAR['%s']", atom_getsymbol(argv)->s_name);
63
snprintf(buf, MAXPDSTRING-1, "DOLLSYM['%s']", atom_getsymbol(argv)->s_name);
66
snprintf(buf, MAXPDSTRING-1, "GIMME");
68
case A_CANT: // we _really_ cannot do CANT
69
snprintf(buf, MAXPDSTRING-1, "CANT");
72
snprintf(buf, MAXPDSTRING-1, "unknown[%d]", argv->a_type);
76
startpost(" %s", buf);
83
static void *rawprint_new(t_symbol*s)
85
t_rawprint *x = (t_rawprint *)pd_new(rawprint_class);
93
void rawprint_setup(void) {
94
rawprint_class = class_new(gensym("rawprint"),
95
(t_newmethod)rawprint_new,
96
0, sizeof(t_rawprint),
97
CLASS_DEFAULT, A_DEFSYMBOL, 0);
99
class_addanything(rawprint_class, rawprint_any);
100
zexy_register("rawprint");