Fix some greedy sed changes in imported code. Also provide a sys/types.h for compatib...
[kugel-rb.git] / apps / plugins / pdbox / PDa / src / x_interface.c
blob9939c6bdf0057617340a818d94c10cff6b85964d
1 /* Copyright (c) 1997-1999 Miller Puckette.
2 * For information on usage and redistribution, and for a DISCLAIMER OF ALL
3 * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
5 /* interface objects */
7 #include "m_pd.h"
9 /* -------------------------- print ------------------------------ */
10 static t_class *print_class;
12 typedef struct _print
14 t_object x_obj;
15 t_symbol *x_sym;
16 } t_print;
18 static void *print_new(t_symbol *s)
20 t_print *x = (t_print *)pd_new(print_class);
21 if (*s->s_name) x->x_sym = s;
22 else x->x_sym = gensym("");
23 return (x);
26 static void print_bang(t_print *x)
28 post("%sbang", x->x_sym->s_name);
31 static void print_pointer(t_print *x, t_gpointer *gp)
33 #ifdef ROCKBOX
34 (void) gp;
35 #endif
36 post("%s(gpointer)", x->x_sym->s_name);
39 static void print_float(t_print *x, t_float f)
41 post("%s%g", x->x_sym->s_name, f);
44 static void print_list(t_print *x, t_symbol *s, int argc, t_atom *argv)
46 #ifdef ROCKBOX
47 (void) s;
48 #else
49 int i;
50 char buf[80];
51 #endif
52 if (argc && argv->a_type != A_SYMBOL) startpost("%s:", x->x_sym->s_name);
53 else startpost("%s%s", x->x_sym->s_name,
54 (argc > 1 ? s_list.s_name : (argc == 1 ? s_symbol.s_name :
55 s_bang.s_name)));
56 postatom(argc, argv);
57 endpost();
60 static void print_anything(t_print *x, t_symbol *s, int argc, t_atom *argv)
62 #ifndef ROCKBOX
63 int i;
64 char buf[80];
65 #endif
66 startpost("%s%s", x->x_sym->s_name, s->s_name);
67 postatom(argc, argv);
68 endpost();
71 static void print_setup(void)
73 print_class = class_new(gensym("print"), (t_newmethod)print_new, 0,
74 sizeof(t_print), 0, A_DEFSYM, 0);
75 class_addbang(print_class, print_bang);
76 class_addfloat(print_class, print_float);
77 class_addpointer(print_class, print_pointer);
78 class_addlist(print_class, print_list);
79 class_addanything(print_class, print_anything);
84 void x_interface_setup(void)
86 print_setup();