Skip to content
Snippets Groups Projects
Commit 39c3c396 authored by Ivica Bukvic's avatar Ivica Bukvic
Browse files
parent 1d659c01
No related branches found
No related tags found
No related merge requests found
...@@ -19,24 +19,31 @@ typedef struct _print ...@@ -19,24 +19,31 @@ typedef struct _print
t_symbol *x_sym; t_symbol *x_sym;
} t_print; } t_print;
static void *print_new(t_symbol *s, int argc, t_atom *argv) static void *print_new(t_symbol *sel, int argc, t_atom *argv)
{ {
int bufsize;
char *buf;
t_print *x = (t_print *)pd_new(print_class); t_print *x = (t_print *)pd_new(print_class);
if (argc) if (argc == 0)
x->x_sym = gensym("print");
else if (argc == 1 && argv->a_type == A_SYMBOL)
{
t_symbol *s = atom_getsymbolarg(0, argc, argv);
if (!strcmp(s->s_name, "-n"))
x->x_sym = &s_;
else x->x_sym = s;
}
else
{ {
int bufsize;
char *buf;
t_binbuf *bb = binbuf_new(); t_binbuf *bb = binbuf_new();
binbuf_add(bb, argc, argv); binbuf_add(bb, argc, argv);
binbuf_gettext(bb, &buf, &bufsize); binbuf_gettext(bb, &buf, &bufsize);
buf = resizebytes(buf, bufsize, bufsize+1);
buf[bufsize] = 0; buf[bufsize] = 0;
x->x_sym = gensym(buf); x->x_sym = gensym(buf);
freebytes(buf, bufsize+1);
binbuf_free(bb); binbuf_free(bb);
} }
else
{
x->x_sym = gensym("print");
}
return (x); return (x);
} }
...@@ -58,7 +65,10 @@ static void print_float(t_print *x, t_float f) ...@@ -58,7 +65,10 @@ static void print_float(t_print *x, t_float f)
static void print_list(t_print *x, t_symbol *s, int argc, t_atom *argv) static void print_list(t_print *x, t_symbol *s, int argc, t_atom *argv)
{ {
int i; int i;
if (argc && argv->a_type != A_SYMBOL) startpost("%s:", x->x_sym->s_name); if (argc && argv->a_type != A_SYMBOL)
startpost("%s%s%g", x->x_sym->s_name,
(*x->x_sym->s_name ? ": " : ""),
atom_getfloatarg(0, argc--, argv++));
else startpost("%s: %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 : (argc > 1 ? s_list.s_name : (argc == 1 ? s_symbol.s_name :
s_bang.s_name))); s_bang.s_name)));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment