Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7939
Modified Files: Tag: desiredata kernel.c m_pd.h Log Message: kernel goes PD_PLUSPLUS_FACE
Index: m_pd.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_pd.h,v retrieving revision 1.4.4.11.2.33.2.25 retrieving revision 1.4.4.11.2.33.2.26 diff -C2 -d -r1.4.4.11.2.33.2.25 -r1.4.4.11.2.33.2.26 *** m_pd.h 3 Jan 2007 03:54:18 -0000 1.4.4.11.2.33.2.25 --- m_pd.h 3 Jan 2007 04:12:13 -0000 1.4.4.11.2.33.2.26 *************** *** 208,214 **** #ifdef PD_PLUSPLUS_FACE typedef struct _outconnect : _gobj { ! struct _outconnect *oc_next; t_pd *oc_to; ! } t_outconnect; #else typedef struct _outconnect t_outconnect; --- 208,218 ---- #ifdef PD_PLUSPLUS_FACE typedef struct _outconnect : _gobj { ! struct _outconnect *next; t_pd *oc_to; ! struct t_text *from; ! struct t_text *to; ! short outlet, inlet; ! } t_outconnect, t_wire; ! #define oc_next next #else typedef struct _outconnect t_outconnect;
Index: kernel.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/kernel.c,v retrieving revision 1.1.2.21 retrieving revision 1.1.2.22 diff -C2 -d -r1.1.2.21 -r1.1.2.22 *** kernel.c 3 Jan 2007 03:55:32 -0000 1.1.2.21 --- kernel.c 3 Jan 2007 04:12:13 -0000 1.1.2.22 *************** *** 11,14 **** --- 11,15 ---- */
+ #define PD_PLUSPLUS_FACE #include "desire.h" #include "m_simd.h" *************** *** 262,266 ****
void atom_init(t_atom *a, size_t n) { ! for (int i=0; i<n; i++) { a[i].a_type = A_FLOAT; a[i].a_w.w_float = 0.0; --- 263,267 ----
void atom_init(t_atom *a, size_t n) { ! for (unsigned int i=0; i<n; i++) { a[i].a_type = A_FLOAT; a[i].a_w.w_float = 0.0; *************** *** 312,316 **** } } break; ! case A_DOLLAR: sprintf(buf, "$%d", a->a_w.w_index); break; case A_DOLLSYM: strncpy(buf, a->a_symbol->s_name, bufsize); buf[bufsize-1] = 0; break; default: bug("atom_string"); --- 313,317 ---- } } break; ! case A_DOLLAR: sprintf(buf, "$%ld", a->a_w.w_index); break; case A_DOLLSYM: strncpy(buf, a->a_symbol->s_name, bufsize); buf[bufsize-1] = 0; break; default: bug("atom_string"); *************** *** 323,327 **** if (!c) bug("pd_new: apparently called before setup routine"); t_pd *x = (t_pd *)t_getbytes(c->size); ! *x = c; hash_set(object_table,x,(void*)0); if (c->gobj) ((t_gobj *)x)->g_adix = appendix_new((t_gobj *)x); --- 324,328 ---- if (!c) bug("pd_new: apparently called before setup routine"); t_pd *x = (t_pd *)t_getbytes(c->size); ! x->_class = c; hash_set(object_table,x,(void*)0); if (c->gobj) ((t_gobj *)x)->g_adix = appendix_new((t_gobj *)x); *************** *** 334,338 ****
void pd_free(t_pd *x) { ! t_class *c = *x; if (c->freemethod) ((t_gotfn)(c->freemethod))(x); if (c->gobj) appendix_free((t_gobj *)x); --- 335,339 ----
void pd_free(t_pd *x) { ! t_class *c = x->_class; if (c->freemethod) ((t_gotfn)(c->freemethod))(x); if (c->gobj) appendix_free((t_gobj *)x); *************** *** 391,395 **** void pd_bind(t_pd *x, t_symbol *s) { if (s->s_thing) { ! if (*s->s_thing == bindlist_class) { t_bindlist *b = (t_bindlist *)s->s_thing; b->b_list = bindelem_new(x,b->b_list); --- 392,396 ---- void pd_bind(t_pd *x, t_symbol *s) { if (s->s_thing) { ! if (s->s_thing->_class == bindlist_class) { t_bindlist *b = (t_bindlist *)s->s_thing; b->b_list = bindelem_new(x,b->b_list); *************** *** 407,411 **** void pd_unbind(t_pd *x, t_symbol *s) { if (s->s_thing == x) {s->s_thing = 0; return;} ! if (s->s_thing && *s->s_thing == bindlist_class) { t_bindlist *b = (t_bindlist *)s->s_thing; t_bindelem *e, *e2; --- 408,412 ---- void pd_unbind(t_pd *x, t_symbol *s) { if (s->s_thing == x) {s->s_thing = 0; return;} ! if (s->s_thing && s->s_thing->_class == bindlist_class) { t_bindlist *b = (t_bindlist *)s->s_thing; t_bindelem *e, *e2; *************** *** 429,437 **** t_pd *x = 0; if (!s->s_thing) return 0; ! if (*s->s_thing == c) return s->s_thing; ! if (*s->s_thing == bindlist_class) { t_bindlist *b = (t_bindlist *)s->s_thing; int warned = 0; ! bind_each(e,b) if (*e->who == c) { if (x && !warned) {post("warning: %s: multiply defined", s->s_name); warned = 1;} x = e->who; --- 430,438 ---- t_pd *x = 0; if (!s->s_thing) return 0; ! if (s->s_thing->_class == c) return s->s_thing; ! if (s->s_thing->_class == bindlist_class) { t_bindlist *b = (t_bindlist *)s->s_thing; int warned = 0; ! bind_each(e,b) if (e->who->_class == c) { if (x && !warned) {post("warning: %s: multiply defined", s->s_name); warned = 1;} x = e->who; *************** *** 486,494 **** }
! void pd_bang(t_pd *x) {(*x)->bangmethod(x);} ! void pd_float(t_pd *x, t_float f) {(*x)->floatmethod(x, f);} ! void pd_pointer(t_pd *x, t_gpointer *gp) {(*x)->pointermethod(x, gp);} ! void pd_symbol(t_pd *x, t_symbol *s) {(*x)->symbolmethod(x, s);} ! void pd_list(t_pd *x, t_symbol *s, int argc, t_atom *argv) {(*x)->listmethod(x, &s_list, argc, argv);}
/* this file handles Max-style patchable objects, i.e., objects which --- 487,495 ---- }
! void pd_bang(t_pd *x) {x->_class->bangmethod(x);} ! void pd_float(t_pd *x, t_float f) {x->_class->floatmethod(x, f);} ! void pd_pointer(t_pd *x, t_gpointer *gp) {x->_class->pointermethod(x, gp);} ! void pd_symbol(t_pd *x, t_symbol *s) {x->_class->symbolmethod(x, s);} ! void pd_list(t_pd *x, t_symbol *s, int ac, t_atom *av) {x->_class->listmethod(x, &s_list, ac, av);}
/* this file handles Max-style patchable objects, i.e., objects which *************** *** 538,545 ****
#define ISINLET(pd) ( \ ! *(pd) == inlet_class || \ ! *(pd) == pointerinlet_class || \ ! *(pd) == floatinlet_class || \ ! *(pd) == symbolinlet_class)
/* --------------------- generic inlets ala max ------------------ */ --- 539,546 ----
#define ISINLET(pd) ( \ ! pd->_class == inlet_class || \ ! pd->_class == pointerinlet_class || \ ! pd->_class == floatinlet_class || \ ! pd->_class == symbolinlet_class)
/* --------------------- generic inlets ala max ------------------ */ *************** *** 566,570 ****
t_inlet *signalinlet_new(t_object *owner, t_float f) { ! t_inlet *x = inlet_new(owner, &owner->ob_pd, &s_signal, &s_signal); x->i_un.iu_floatsignalvalue = f; return x; --- 567,571 ----
t_inlet *signalinlet_new(t_object *owner, t_float f) { ! t_inlet *x = inlet_new(owner, owner, &s_signal, &s_signal); x->i_un.iu_floatsignalvalue = f; return x; *************** *** 680,686 **** else pd_symbol(&ip->i_pd, ap->a_symbol); } ! if (argv->a_type == A_POINTER) pd_pointer(&x->ob_pd, argv->a_w.w_gpointer); ! else if (argv->a_type == A_FLOAT) pd_float(&x->ob_pd, argv->a_float); ! else pd_symbol(&x->ob_pd, argv->a_symbol); }
--- 681,687 ---- else pd_symbol(&ip->i_pd, ap->a_symbol); } ! if (argv->a_type == A_POINTER) pd_pointer(x, argv->a_w.w_gpointer); ! else if (argv->a_type == A_FLOAT) pd_float(x, argv->a_float); ! else pd_symbol(x, argv->a_symbol); }
*************** *** 712,724 **** int sched_geteventno( void) {return outlet_eventno;}
- typedef struct _outconnect { - t_gobj oc_gobj; - struct _outconnect *next; - t_pd *oc_to; - t_object *from; - t_object *to; - short outlet, inlet; - } t_wire; - struct _outlet { t_object *o_owner; --- 713,716 ---- *************** *** 731,735 **** t_wire *wire_new (t_symbol *s, int argc, t_atom *argv) { t_wire *self = (t_wire *)pd_new(wire_class); ! self->oc_gobj.g_adix = appendix_new((t_gobj *)self); return self; } --- 723,727 ---- t_wire *wire_new (t_symbol *s, int argc, t_atom *argv) { t_wire *self = (t_wire *)pd_new(wire_class); ! self->g_adix = appendix_new((t_gobj *)self); return self; } *************** *** 737,741 ****
void wire_save (t_wire *self, t_binbuf *b) { ! t_canvas *c = self->oc_gobj.dix->canvas; binbuf_addv(b,"ttiiii;","#X","connect", canvas_getindex(c,(t_gobj *)self->from), self->outlet, --- 729,733 ----
void wire_save (t_wire *self, t_binbuf *b) { ! t_canvas *c = self->dix->canvas; binbuf_addv(b,"ttiiii;","#X","connect", canvas_getindex(c,(t_gobj *)self->from), self->outlet, *************** *** 892,896 **** it, correctly typed, or zero if the check failed. */ t_object *pd_checkobject(t_pd *x) { ! return (*x)->patchable ? (t_object *)x : 0; }
--- 884,888 ---- it, correctly typed, or zero if the check failed. */ t_object *pd_checkobject(t_pd *x) { ! return x->_class->patchable ? (t_object *)x : 0; }
*************** *** 1011,1015 ****
static void pd_defaultanything(t_pd *x, t_symbol *s, int argc, t_atom *argv) { ! pd_error(x, "%s: no method for '%s'", (*x)->name->s_name, s->s_name); }
--- 1003,1007 ----
static void pd_defaultanything(t_pd *x, t_symbol *s, int argc, t_atom *argv) { ! pd_error(x, "%s: no method for '%s'", x->_class->name->s_name, s->s_name); }
*************** *** 1105,1111 **** #endif
! if (pd_objectmaker && newmethod) { /* add a "new" method by the name specified by the object */ ! class_addmethod(pd_objectmaker, (t_method)newmethod, s, vec[0], vec[1], vec[2], vec[3], vec[4], vec[5]); if (class_loadsym) { /* if we're loading an extern it might have been invoked by a --- 1097,1103 ---- #endif
! if (pd_objectmaker._class && newmethod) { /* add a "new" method by the name specified by the object */ ! class_addmethod(pd_objectmaker._class, (t_method)newmethod, s, vec[0], vec[1], vec[2], vec[3], vec[4], vec[5]); if (class_loadsym) { /* if we're loading an extern it might have been invoked by a *************** *** 1114,1118 **** l1 = strlen(s->s_name), l2 = strlen(loadstring); if (l2 > l1 && !strcmp(s->s_name, loadstring + (l2 - l1))) ! class_addmethod(pd_objectmaker, (t_method)newmethod, class_loadsym, vec[0], vec[1], vec[2], vec[3], vec[4], vec[5]); } --- 1106,1110 ---- l1 = strlen(s->s_name), l2 = strlen(loadstring); if (l2 > l1 && !strcmp(s->s_name, loadstring + (l2 - l1))) ! class_addmethod(pd_objectmaker._class, (t_method)newmethod, class_loadsym, vec[0], vec[1], vec[2], vec[3], vec[4], vec[5]); } *************** *** 1144,1148 **** // like a class_addcreator if (pd_library_name && newmethod) { ! class_addmethod(pd_objectmaker, (t_method)newmethod, S, vec[0], vec[1], vec[2], vec[3], vec[4], vec[5]); } #endif --- 1136,1140 ---- // like a class_addcreator if (pd_library_name && newmethod) { ! class_addmethod(pd_objectmaker._class, (t_method)newmethod, S, vec[0], vec[1], vec[2], vec[3], vec[4], vec[5]); } #endif *************** *** 1171,1175 **** } va_end(ap); ! class_addmethod(pd_objectmaker, (t_method)newmethod, s, vec[0], vec[1], vec[2], vec[3], vec[4], vec[5]);
#ifdef QUALIFIED_NAME --- 1163,1167 ---- } va_end(ap); ! class_addmethod(pd_objectmaker._class, (t_method)newmethod, s, vec[0], vec[1], vec[2], vec[3], vec[4], vec[5]);
#ifdef QUALIFIED_NAME *************** *** 1179,1183 **** s=gensym(namespacename); } ! class_addmethod(pd_objectmaker, (t_method)newmethod, s, vec[0], vec[1], vec[2], vec[3], vec[4], vec[5]); #endif hash_set(class_table,s,0); --- 1171,1175 ---- s=gensym(namespacename); } ! class_addmethod(pd_objectmaker._class, (t_method)newmethod, s, vec[0], vec[1], vec[2], vec[3], vec[4], vec[5]); #endif hash_set(class_table,s,0); *************** *** 1276,1284 ****
static void pd_floatforsignal(t_pd *x, t_float f) { ! int offset = (*x)->floatsignalin; if (offset > 0) *(t_sample *)(((char *)x) + offset) = f; else ! pd_error(x, "%s: float unexpected for signal input", (*x)->name->s_name); }
--- 1268,1276 ----
static void pd_floatforsignal(t_pd *x, t_float f) { ! int offset = x->_class->floatsignalin; if (offset > 0) *(t_sample *)(((char *)x) + offset) = f; else ! pd_error(x, "%s: float unexpected for signal input", x->_class->name->s_name); }
*************** *** 1494,1498 ****
void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv) { ! t_class *c = *x; t_methodentry *m; t_atomtype *wp, wanttype; --- 1486,1490 ----
void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv) { ! t_class *c = x->_class; t_methodentry *m; t_atomtype *wp, wanttype; *************** *** 1637,1641 ****
t_gotfn getfn(t_pd *x, t_symbol *s) { ! t_class *c = *x; t_methodentry *m = c->methods; for (int i=c->nmethod; i--; m++) if (m->me_name == s) return m->me_fun; --- 1629,1633 ----
t_gotfn getfn(t_pd *x, t_symbol *s) { ! t_class *c = x->_class; t_methodentry *m = c->methods; for (int i=c->nmethod; i--; m++) if (m->me_name == s) return m->me_fun; *************** *** 1645,1649 ****
t_gotfn zgetfn(t_pd *x, t_symbol *s) { ! t_class *c = *x; t_methodentry *m = c->methods; for (int i=c->nmethod; i--; m++) if (m->me_name == s) return m->me_fun; --- 1637,1641 ----
t_gotfn zgetfn(t_pd *x, t_symbol *s) { ! t_class *c = x->_class; t_methodentry *m = c->methods; for (int i=c->nmethod; i--; m++) if (m->me_name == s) return m->me_fun; *************** *** 1948,1953 **** case A_SEMI: SETSYMBOL(ap, gensym(";")); break; case A_COMMA: SETSYMBOL(ap, gensym(",")); break; ! case A_DOLLAR: sprintf(tbuf, "$%d", ap->a_w.w_index); SETSYMBOL(ap, gensym(tbuf)); break; ! case A_DOLLSYM: atom_string(ap, tbuf, MAXPDSTRING); SETSYMBOL(ap, gensym(tbuf)); break; case A_SYMBOL: /* FIXME make this general */ --- 1940,1945 ---- case A_SEMI: SETSYMBOL(ap, gensym(";")); break; case A_COMMA: SETSYMBOL(ap, gensym(",")); break; ! case A_DOLLAR: sprintf(tbuf, "$%ld", ap->a_w.w_index); SETSYMBOL(ap, gensym(tbuf)); break; ! case A_DOLLSYM: atom_string(ap, tbuf, MAXPDSTRING); SETSYMBOL(ap, gensym(tbuf)); break; case A_SYMBOL: /* FIXME make this general */ *************** *** 2404,2408 **** if (nextmess[i].a_type == A_DOLLAR) { char buf[100]; ! sprintf(buf, "$%d", nextmess[i].a_w.w_index); SETSYMBOL(nextmess+i, gensym(buf)); } else if (nextmess[i].a_type == A_DOLLSYM) { --- 2396,2400 ---- if (nextmess[i].a_type == A_DOLLAR) { char buf[100]; ! sprintf(buf, "$%ld", nextmess[i].a_w.w_index); SETSYMBOL(nextmess+i, gensym(buf)); } else if (nextmess[i].a_type == A_DOLLSYM) { *************** *** 2651,2661 **** t_symbol **sp; int i; ! if (pd_objectmaker) bug("ARGH"); ! for (i = sizeof(symlist)/sizeof(*symlist), sp = symlist; i--; sp++) (void) dogensym((*sp)->s_name, strlen((*sp)->s_name), *sp); ! pd_objectmaker = class_new(gensym("objectmaker"), 0, 0, sizeof(t_pd), CLASS_DEFAULT, A_NULL); ! pd_canvasmaker = class_new(gensym("canvasmaker"), 0, 0, sizeof(t_pd), CLASS_DEFAULT, A_NULL); pd_bind(&pd_canvasmaker, &s__N); ! class_addanything(pd_objectmaker, (t_method)new_anything); obj_init(); conf_init(); --- 2643,2653 ---- t_symbol **sp; int i; ! if (pd_objectmaker._class) bug("ARGH"); ! for (i=sizeof(symlist)/sizeof(*symlist), sp = symlist; i--; sp++) (void) dogensym((*sp)->s_name, strlen((*sp)->s_name), *sp); ! pd_objectmaker._class = class_new(gensym("objectmaker"), 0, 0, sizeof(t_pd), CLASS_DEFAULT, A_NULL); ! pd_canvasmaker._class = class_new(gensym("canvasmaker"), 0, 0, sizeof(t_pd), CLASS_DEFAULT, A_NULL); pd_bind(&pd_canvasmaker, &s__N); ! class_addanything(pd_objectmaker._class, (t_method)new_anything); obj_init(); conf_init();