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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
/* Copyright (c) 1997-1999 Miller Puckette.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
/* interface objects */
#include "m_pd.h"
/* -------------------------- print ------------------------------ */
static t_class *print_class;
typedef struct _print
{
t_object x_obj;
t_symbol *x_sym;
} t_print;
static void *print_new(t_symbol *s)
{
t_print *x = (t_print *)pd_new(print_class);
if (*s->s_name) x->x_sym = s;
else x->x_sym = gensym("");
return (x);
}
static void print_bang(t_print *x)
{
post("%sbang", x->x_sym->s_name);
}
static void print_pointer(t_print *x, t_gpointer *gp)
{
post("%s(gpointer)", x->x_sym->s_name);
}
static void print_float(t_print *x, t_float f)
{
post("%s%g", x->x_sym->s_name, f);
}
static void print_list(t_print *x, t_symbol *s, int argc, t_atom *argv)
{
int i;
char buf[80];
if (argc && argv->a_type != A_SYMBOL) startpost("%s:", x->x_sym->s_name);
else startpost("%s%s", x->x_sym->s_name,
(argc > 1 ? s_list.s_name : (argc == 1 ? s_symbol.s_name :
s_bang.s_name)));
postatom(argc, argv);
endpost();
}
static void print_anything(t_print *x, t_symbol *s, int argc, t_atom *argv)
{
int i;
char buf[80];
startpost("%s%s", x->x_sym->s_name, s->s_name);
postatom(argc, argv);
endpost();
}
static void print_setup(void)
{
print_class = class_new(gensym("print"), (t_newmethod)print_new, 0,
sizeof(t_print), 0, A_DEFSYM, 0);
class_addbang(print_class, print_bang);
class_addfloat(print_class, print_float);
class_addpointer(print_class, print_pointer);
class_addlist(print_class, print_list);
class_addanything(print_class, print_anything);
}
void x_interface_setup(void)
{
print_setup();
}
/* Copyright (c) 1997-1999 Miller Puckette.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
/* interface objects */
#include "m_pd.h"
/* -------------------------- print ------------------------------ */
static t_class *print_class;
typedef struct _print
{
t_object x_obj;
t_symbol *x_sym;
} t_print;
static void *print_new(t_symbol *s)
{
t_print *x = (t_print *)pd_new(print_class);
if (*s->s_name) x->x_sym = s;
else x->x_sym = gensym("");
return (x);
}
static void print_bang(t_print *x)
{
post("%sbang", x->x_sym->s_name);
}
static void print_pointer(t_print *x, t_gpointer *gp)
{
post("%s(gpointer)", x->x_sym->s_name);
}
static void print_float(t_print *x, t_float f)
{
post("%s%g", x->x_sym->s_name, f);
}
static void print_list(t_print *x, t_symbol *s, int argc, t_atom *argv)
{
int i;
char buf[80];
if (argc && argv->a_type != A_SYMBOL) startpost("%s:", x->x_sym->s_name);
else startpost("%s%s", x->x_sym->s_name,
(argc > 1 ? s_list.s_name : (argc == 1 ? s_symbol.s_name :
s_bang.s_name)));
postatom(argc, argv);
endpost();
}
static void print_anything(t_print *x, t_symbol *s, int argc, t_atom *argv)
{
int i;
char buf[80];
startpost("%s%s", x->x_sym->s_name, s->s_name);
postatom(argc, argv);
endpost();
}
static void print_setup(void)
{
print_class = class_new(gensym("print"), (t_newmethod)print_new, 0,
sizeof(t_print), 0, A_DEFSYM, 0);
class_addbang(print_class, print_bang);
class_addfloat(print_class, print_float);
class_addpointer(print_class, print_pointer);
class_addlist(print_class, print_list);
class_addanything(print_class, print_anything);
}
void x_interface_setup(void)
{
print_setup();
}
|