diff options
| author | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-05-22 21:58:48 +0000 |
|---|---|---|
| committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-05-22 21:58:48 +0000 |
| commit | 513389b4c1bc8afe4b2dc9947c534bfeb105e3da (patch) | |
| tree | 10e673b35651ac567fed2eda0c679c7ade64cbc6 /apps/plugins/pdbox/PDa/src/x_interface.c | |
| parent | 95fa7f6a2ef466444fbe3fe87efc6d5db6b77b36 (diff) | |
| download | rockbox-513389b4c1bc8afe4b2dc9947c534bfeb105e3da.zip rockbox-513389b4c1bc8afe4b2dc9947c534bfeb105e3da.tar.gz rockbox-513389b4c1bc8afe4b2dc9947c534bfeb105e3da.tar.bz2 rockbox-513389b4c1bc8afe4b2dc9947c534bfeb105e3da.tar.xz | |
Add FS #10214. Initial commit of the original PDa code for the GSoC Pure Data plugin project of Wincent Balin. Stripped some non-sourcefiles and added a rockbox readme that needs a bit more info from Wincent. Is added to CATEGORIES and viewers, but not yet to SUBDIRS (ie doesn't build yet)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21044 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/x_interface.c')
| -rw-r--r-- | apps/plugins/pdbox/PDa/src/x_interface.c | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/apps/plugins/pdbox/PDa/src/x_interface.c b/apps/plugins/pdbox/PDa/src/x_interface.c new file mode 100644 index 0000000..f6ab350 --- /dev/null +++ b/apps/plugins/pdbox/PDa/src/x_interface.c @@ -0,0 +1,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(); +} |