Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31060
Modified Files: Tag: desiredata desire.c Log Message: wipe the rest of gstub
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.217.2.170 retrieving revision 1.1.2.217.2.171 diff -C2 -d -r1.1.2.217.2.170 -r1.1.2.217.2.171 *** desire.c 19 Jul 2007 17:54:50 -0000 1.1.2.217.2.170 --- desire.c 19 Jul 2007 21:47:34 -0000 1.1.2.217.2.171 *************** *** 1321,1325 **** static void array_resize_and_redraw(t_array *array, int n) { /* what was that for??? */ - /* t_array *a2 = array; while (gstub_which(STUB(a2)) == GP_ARRAY) a2 = STUB(a2)->array; */ array_resize(array,n); gobj_changed(array,0); --- 1321,1324 ---- *************** *** 1584,1588 **** static void array_redraw(t_array *a, t_canvas *canvas) { /* what was that for? */ - /* while (gstub_which(STUB(a)) == GP_ARRAY) a = STUB(a)->array; */ scalar_redraw(a->gp.scalar, canvas); } --- 1583,1586 ---- *************** *** 3395,3417 **** static t_canvas *gpointer_getcanvas(t_gpointer *gp) { if (gp->o->_class != array_class) return gp->canvas; - else {/* fuck: - t_array *owner_array = gp->array; - // find associated scalar: - while (gstub_which(STUB(owner_array)) == GP_ARRAY) owner_array = STUB(owner_array)->array; - return STUB(owner_array)->canvas; - */} return 0; /* FIXME */ } static t_scalar *gpointer_getscalar(t_gpointer *gp) { if (gp->o->_class != array_class) return gp->scalar; - /* t_array *o = gp->array; while (gstub_which(STUB(o)) == GP_ARRAY) o = STUB(o)->array; return o->gp.scalar; */ return 0; }
! /* make a new scalar and add to the canvas. We create a "gp" here which ! will be used for array items to point back here. This gp doesn't do ! reference counting or "validation" updates though; the parent won't go away ! without the contained arrays going away too. The "gp" is copied out ! by value in the word_init() routine so we can throw our copy away. */ t_scalar *scalar_new(t_canvas *owner, t_symbol *templatesym) { t_gpointer gp; --- 3393,3406 ---- static t_canvas *gpointer_getcanvas(t_gpointer *gp) { if (gp->o->_class != array_class) return gp->canvas; return 0; /* FIXME */ } static t_scalar *gpointer_getscalar(t_gpointer *gp) { if (gp->o->_class != array_class) return gp->scalar; return 0; }
! /* make a new scalar and add to the canvas. We create a "gp" here which will be used for array items to point back here. ! This gp doesn't do reference counting or "validation" updates though; the parent won't go away without the contained ! arrays going away too. The "gp" is copied out by value in the word_init() routine so we can throw our copy away. */ t_scalar *scalar_new(t_canvas *owner, t_symbol *templatesym) { t_gpointer gp; *************** *** 3431,3438 **** static void canvas_scalar(t_canvas *canvas, t_symbol *classname, t_int argc, t_atom *argv) { t_symbol *templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv)); ! if (!template_findbyname(templatesym)) { ! error("%s: no such template", atom_getsymbolarg(0, argc, argv)->name); ! return; ! } int nextmsg; t_binbuf *b = binbuf_new(); --- 3420,3424 ---- static void canvas_scalar(t_canvas *canvas, t_symbol *classname, t_int argc, t_atom *argv) { t_symbol *templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv)); ! if (!template_findbyname(templatesym)) {error("%s: no such template", atom_getsymbolarg(0, argc, argv)->name); return;} int nextmsg; t_binbuf *b = binbuf_new(); *************** *** 4717,4736 ****
/* ------------- gpointers - safe pointing --------------- */ - /* - static void gstub_dis(t_gstub *gs) { - int refcount = --gs->gs_refcount; - if (!refcount && gstub_which(gs) == GP_NONE) free(gs); - else if (refcount < 0) bug("gstub_dis"); - } - static int gstub_which(t_gstub *gs) { - if (gs->array) return 0; - if (gs->array->_class == array_class) return GP_ARRAY; else return GP_CANVAS; - } - */
! /* call this to verify that a pointer is fresh, i.e., that it either ! points to real data or to the head of a list, and that in either case ! the object hasn't disappeared since this pointer was generated. ! Unless "headok" is set, the routine also fails for the head of a list. */ int gpointer_check(const t_gpointer *gp, int headok) { if (!gp->o) return 0; --- 4703,4710 ----
/* ------------- gpointers - safe pointing --------------- */
! /* call this to verify that a pointer is fresh, i.e., that it either points to real data or to the head of a list, ! and that in either case the object hasn't disappeared since this pointer was generated. Unless "headok" is set, ! the routine also fails for the head of a list. */ int gpointer_check(const t_gpointer *gp, int headok) { if (!gp->o) return 0; *************** *** 4739,4744 **** }
! /* get the template for the object pointer to. Assumes we've already checked ! freshness. Returns 0 if head of list. */ static t_symbol *gpointer_gettemplatesym(const t_gpointer *gp) { if (gp->o->_class == array_class) return gp->array->templatesym; --- 4713,4717 ---- }
! /* get the template for the object pointer to. Assumes we've already checked freshness. Returns 0 if head of list. */ static t_symbol *gpointer_gettemplatesym(const t_gpointer *gp) { if (gp->o->_class == array_class) return gp->array->templatesym; *************** *** 4747,4753 **** }
! /* copy a pointer to another, assuming the second one hasn't yet been ! initialized. New gpointers should be initialized either by this ! routine or by gpointer_init below. */ void gpointer_copy(const t_gpointer *gpfrom, t_gpointer *gpto) { *gpto = *gpfrom; --- 4720,4725 ---- }
! /* copy a pointer to another, assuming the second one hasn't yet been initialized. New gpointers should be initialized ! either by this routine or by gpointer_init below. */ void gpointer_copy(const t_gpointer *gpfrom, t_gpointer *gpto) { *gpto = *gpfrom; *************** *** 4755,4760 **** }
- /* clear a gpointer that was previously set, releasing the associated - gstub if this was the last reference to it. */ void gpointer_unset(t_gpointer *gp) { if (gp->scalar) { --- 4727,4730 ---- *************** *** 5035,5039 **** t_array *array; int elemsize, type; - if (!gpointer_check(gparent, 0)) {error("empty pointer"); return;} if (gpointer_gettemplatesym(gparent) != x->templatesym) { --- 5005,5008 ----