Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30479
Modified Files: Tag: desiredata desire.c m_pd.h kernel.c Log Message: t_gstub is gone.
Index: m_pd.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_pd.h,v retrieving revision 1.4.4.11.2.33.2.28 retrieving revision 1.4.4.11.2.33.2.29 diff -C2 -d -r1.4.4.11.2.33.2.28 -r1.4.4.11.2.33.2.29 *** m_pd.h 3 Jan 2007 04:59:09 -0000 1.4.4.11.2.33.2.28 --- m_pd.h 3 Jan 2007 06:39:26 -0000 1.4.4.11.2.33.2.29 *************** *** 99,119 **** #define GP_GLIST 1 #define GP_ARRAY 2 /* ... or array */ - #ifdef PD_PLUSPLUS_FACE - typedef struct _gstub { - union { - struct _glist *canvas; - struct _array *array; - }; - } t_gstub; - #define gs_refcount canvas->refcount #else - typedef struct _gstub { - union { - struct _glist *canvas; - struct _array *array; - } un; - } t_gstub; - #define gs_refcount un.canvas->gl_obj.refcount #endif
--- 99,104 ---- *************** *** 124,128 **** union word *w; /* raw data (if array) */ }; ! t_gstub *gp_stub; /* stub which points to glist/array */ } t_gpointer; #else --- 109,118 ---- union word *w; /* raw data (if array) */ }; ! union { ! struct _glist *canvas; ! struct _array *array; ! struct t_text *o; ! }; ! #define gs_refcount canvas->refcount } t_gpointer; #else *************** *** 132,136 **** union word *gp_w; /* raw data (if array) */ } gp_un; ! t_gstub *gp_stub; /* stub which points to glist/array */ } t_gpointer; #endif --- 122,131 ---- union word *gp_w; /* raw data (if array) */ } gp_un; ! union { ! struct _glist *canvas; ! struct _array *array; ! struct _text *o; ! } un; ! #define gs_refcount un.canvas->gl_obj.refcount } t_gpointer; #endif *************** *** 326,330 **** #define SETSEMI(atom) ((atom)->a_type = A_SEMI, (atom)->a_w.w_index = 0) #define SETCOMMA(atom) ((atom)->a_type = A_COMMA, (atom)->a_w.w_index = 0) ! #define SETPOINTER(atom, gp) ((atom)->a_type = A_POINTER, (atom)->a_w.w_gpointer = (gp)) #define SETFLOAT(atom, f) ((atom)->a_type = A_FLOAT, (atom)->a_w.w_float = (f)) #define SETSYMBOL(atom, s) ((atom)->a_type = A_SYMBOL, (atom)->a_w.w_symbol = (s)) --- 321,325 ---- #define SETSEMI(atom) ((atom)->a_type = A_SEMI, (atom)->a_w.w_index = 0) #define SETCOMMA(atom) ((atom)->a_type = A_COMMA, (atom)->a_w.w_index = 0) ! #define SETPOINTER(atom, gp) ((atom)->a_type = A_POINTER, (atom)->a_w.w_gpointer = (gp)) /* looks unsafe... */ #define SETFLOAT(atom, f) ((atom)->a_type = A_FLOAT, (atom)->a_w.w_float = (f)) #define SETSYMBOL(atom, s) ((atom)->a_type = A_SYMBOL, (atom)->a_w.w_symbol = (s))
Index: kernel.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/kernel.c,v retrieving revision 1.1.2.23 retrieving revision 1.1.2.24 diff -C2 -d -r1.1.2.23 -r1.1.2.24 *** kernel.c 3 Jan 2007 04:25:27 -0000 1.1.2.23 --- kernel.c 3 Jan 2007 06:39:26 -0000 1.1.2.24 *************** *** 620,624 **** gpointer_unset(x->u.pointerslot); *(x->u.pointerslot) = *gp; ! if (gp->gp_stub) gp->gp_stub->gs_refcount++; }
--- 620,624 ---- gpointer_unset(x->u.pointerslot); *(x->u.pointerslot) = *gp; ! if (gp->o) gp->o->refcount++; }
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.217.2.106 retrieving revision 1.1.2.217.2.107 diff -C2 -d -r1.1.2.217.2.106 -r1.1.2.217.2.107 *** desire.c 3 Jan 2007 04:59:06 -0000 1.1.2.217.2.106 --- desire.c 3 Jan 2007 06:39:24 -0000 1.1.2.217.2.107 *************** *** 531,536 **** /* zero out everyone except "pd" and "g_adix" fields */ memset(((char *)x) + sizeof(t_gobj), 0, sizeof(*x) - sizeof(t_gobj)); - x->stub = gstub_new(x, 0); - x->valid = ++canvas_valid; x->xlabel = (t_symbol **)getbytes(0); x->ylabel = (t_symbol **)getbytes(0); --- 531,534 ---- *************** *** 755,759 **** freebytes(x->xlabel, x->nxlabels * sizeof(*(x->xlabel))); freebytes(x->ylabel, x->nylabels * sizeof(*(x->ylabel))); - gstub_cutoff(x->stub); if (!x->owner) canvas_takeofflist(x); } --- 753,756 ---- *************** *** 1391,1395 **** we'll be deleted before the thing pointed to gets deleted anyway; see array_free. */ x->gp = *parent; - x->stub = gstub_new(0, x); word_init((t_word *)x->vec, t, parent); return x; --- 1388,1391 ---- *************** *** 1397,1405 ****
void array_resize(t_array *x, int n) { - int elemsize, oldn; t_template *t = template_findbyname(x->templatesym); if (n < 1) n = 1; ! oldn = x->n; ! elemsize = sizeof(t_word) * t->n; x->vec = (char *)resizealignedbytes(x->vec, oldn * elemsize, n * elemsize); x->n = n; --- 1393,1400 ----
void array_resize(t_array *x, int n) { t_template *t = template_findbyname(x->templatesym); if (n < 1) n = 1; ! int oldn = x->n; ! int elemsize = sizeof(t_word) * t->n; x->vec = (char *)resizealignedbytes(x->vec, oldn * elemsize, n * elemsize); x->n = n; *************** *** 1411,1424 **** } } - x->valid = ++canvas_valid; }
- #define STUB(x) x->gp.gp_stub - - static int gstub_which(t_gstub *); - static void array_resize_and_redraw(t_array *array, int n) { ! t_array *a2 = array; ! while (gstub_which(STUB(a2)) == GP_ARRAY) a2 = STUB(a2)->array; array_resize(array,n); gobj_changed(array,0); --- 1406,1414 ---- } } }
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); *************** *** 1429,1433 **** static void array_free(t_array *x) { t_template *scalartemplate = template_findbyname(x->templatesym); - gstub_cutoff(x->stub); for (int i=0; i < x->n; i++) word_free((t_word *)(x->vec + x->elemsize*i), scalartemplate); freealignedbytes(x->vec, x->elemsize * x->n); --- 1419,1422 ---- *************** *** 1699,1703 ****
static void array_redraw(t_array *a, t_canvas *canvas) { ! while (gstub_which(STUB(a)) == GP_ARRAY) a = STUB(a)->array; scalar_redraw(a->gp.scalar, canvas); } --- 1688,1693 ----
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); } *************** *** 2252,2256 **** if (chkdsp) canvas_update_dsp(); if (drawcommand) canvas_redrawallfortemplate(template_findbyname(canvas_makebindsym(canvas_getcanvas(x)->name)), 1); - x->valid = ++canvas_valid; }
--- 2242,2245 ---- *************** *** 3626,3629 **** --- 3615,3634 ---- static void gpointer_setcanvas(t_gpointer *gp, t_canvas *canvas, t_scalar *x); static void gpointer_setarray(t_gpointer *gp, t_array *array, t_word *w); + static t_word *gpointer_word(t_gpointer *gp) {return gp->o->_class == array_class ? gp->w : gp->scalar->v;} + 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 *************** *** 5067,5084 **** }
! /* ------------- gstubs and gpointers - safe pointing --------------- */ ! /* create a gstub which is "owned" by a canvas (gl) or an array ("a"). */ ! t_gstub *gstub_new(t_canvas *gl, t_array *a) { ! t_gstub *gs = (t_gstub *)getbytes(sizeof(*gs)); ! if (gl) gs->canvas = gl; ! else gs->array = a; ! gs->gs_refcount = 0; ! return gs; ! } ! ! /* when a "gpointer" is set to point to this stub (so we can later chase ! down the owner) we increase a reference count. The following routine is called ! whenever a gpointer is unset from pointing here. If the owner is ! gone and the refcount goes to zero, we can free the gstub safely. */ static void gstub_dis(t_gstub *gs) { int refcount = --gs->gs_refcount; --- 5072,5077 ---- }
! /* ------------- gpointers - safe pointing --------------- */ ! /* static void gstub_dis(t_gstub *gs) { int refcount = --gs->gs_refcount; *************** *** 5086,5103 **** else if (refcount < 0) bug("gstub_dis"); } - - /* this routing is called by the owner to inform the gstub that it is - being deleted. If no gpointers are pointing here, we can free the gstub; - otherwise we wait for the last gstub_dis() to free it. */ - void gstub_cutoff(t_gstub *gs) { - gs->array = 0; - if (gs->gs_refcount < 0) bug("gstub_cutoff"); - if (!gs->gs_refcount) t_freebytes(gs, sizeof (*gs)); - } - 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 --- 5079,5087 ---- 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 *************** *** 5106,5114 **** Unless "headok" is set, the routine also fails for the head of a list. */ int gpointer_check(const t_gpointer *gp, int headok) { ! t_gstub *gs = gp->gp_stub; ! if (!gs) return 0; ! if (gstub_which(gs) == GP_ARRAY) return 1; ! if (gstub_which(gs) == GP_CANVAS) return headok || gp->scalar; ! return 0; }
--- 5090,5096 ---- 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; ! if (gp->o->_class == array_class) return 1; ! return headok || gp->scalar; }
*************** *** 5116,5122 **** freshness. Returns 0 if head of list. */ static t_symbol *gpointer_gettemplatesym(const t_gpointer *gp) { ! t_gstub *gs = gp->gp_stub; ! if (gstub_which(gs) == GP_CANVAS) {t_scalar *sc = gp->scalar; return sc ? sc->t : 0;} ! else {t_array *a = gs->array; return a->templatesym;} }
--- 5098,5104 ---- 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; ! t_scalar *sc = gp->scalar; ! return sc ? sc->t : 0; }
*************** *** 5126,5151 **** void gpointer_copy(const t_gpointer *gpfrom, t_gpointer *gpto) { *gpto = *gpfrom; ! if (gpto->gp_stub) gpto->gp_stub->gs_refcount++; ! else bug("gpointer_copy"); }
! /* clear a gpointer that was previously set, releasing the associted gstub if this was the last reference to it. */ void gpointer_unset(t_gpointer *gp) { ! t_gstub *gs = gp->gp_stub; ! if (gs) {gstub_dis(gs); gp->gp_stub = 0;} }
! static void gpointer_setcanvas(t_gpointer *gp, t_canvas *canvas, t_scalar *x) { ! t_gstub *gs = gp->gp_stub; if (gs) gstub_dis(gs); ! gp->gp_stub=gs=canvas->stub; gp->scalar = x; gs->gs_refcount++; } ! static void gpointer_setarray(t_gpointer *gp, t_array *array, t_word *w) { ! t_gstub *gs = gp->gp_stub; if (gs) gstub_dis(gs); ! gp->gp_stub=gs=array->stub; gp->w = w; gs->gs_refcount++; }
void gpointer_init(t_gpointer *gp) { ! gp->gp_stub = 0; gp->scalar = 0; } --- 5108,5135 ---- void gpointer_copy(const t_gpointer *gpfrom, t_gpointer *gpto) { *gpto = *gpfrom; ! if (gpto && gpto->o) gpto->o->refcount++; else bug("gpointer_copy"); }
! /* 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) { ! if (!--gp->o->refcount) pd_free(gp->o); ! gp->o=0; ! gp->scalar=0; ! } }
! static void gpointer_setcanvas(t_gpointer *gp, t_canvas *o, t_scalar *x) { ! gpointer_unset(gp); ! gp->o=o; gp->scalar = x; gp->o->refcount++; } ! static void gpointer_setarray(t_gpointer *gp, t_array *o, t_word *w) { ! gpointer_unset(gp); ! gp->o=o; gp->w = w; gp->o->refcount++; }
void gpointer_init(t_gpointer *gp) { ! gp->o = 0; gp->scalar = 0; } *************** *** 5190,5206 **** }
- /* for future use */ - static int isstale(t_gpointer *x) {return 1;} - static void ptrobj_vnext(t_ptrobj *x, float f) { t_gobj *gobj; t_gpointer *gp = &x->gp; - t_gstub *gs = gp->gp_stub; - t_canvas *canvas; int wantselected = f!=0; ! if (!gs) {pd_error(x, "next: no current pointer"); return;} ! if (gstub_which(gs) != GP_CANVAS) {pd_error(x, "next: lists only, not arrays"); return;} ! canvas = gs->canvas; ! if (isstale(gp)) {pd_error(x, "next: stale pointer"); return;} if (wantselected) {pd_error(x, "next: next-selected unsupported in desiredata"); return;} /* if (wantselected && !canvas_isvisible(canvas)) --- 5174,5184 ---- }
static void ptrobj_vnext(t_ptrobj *x, float f) { t_gobj *gobj; t_gpointer *gp = &x->gp; int wantselected = f!=0; ! if (!gp->o) {pd_error(x, "next: no current pointer"); return;} ! if (gp->o->_class == array_class) {pd_error(x, "next: lists only, not arrays"); return;} ! t_canvas *canvas = gp->canvas; if (wantselected) {pd_error(x, "next: next-selected unsupported in desiredata"); return;} /* if (wantselected && !canvas_isvisible(canvas)) *************** *** 5226,5241 ****
static void ptrobj_sendwindow(t_ptrobj *x, t_symbol *s, int argc, t_atom *argv) { - t_canvas *canvas; - t_gstub *gs; if (!gpointer_check(&x->gp, 1)) {pd_error(x, "bang: empty pointer"); return;} ! gs = x->gp.gp_stub; ! if (gstub_which(gs) == GP_CANVAS) canvas = gs->canvas; ! else { ! t_array *owner_array = gs->array; ! while (gstub_which(STUB(owner_array)) == GP_ARRAY) owner_array = STUB(owner_array)->array; ! canvas = STUB(owner_array)->canvas; ! } ! if (argc && argv->a_type == A_SYMBOL) ! pd_typedmess(canvas_getcanvas(canvas), argv->a_symbol, argc-1, argv+1); else pd_error(x, "send-window: no message?"); } --- 5204,5210 ----
static void ptrobj_sendwindow(t_ptrobj *x, t_symbol *s, int argc, t_atom *argv) { if (!gpointer_check(&x->gp, 1)) {pd_error(x, "bang: empty pointer"); return;} ! t_canvas *canvas = gpointer_getcanvas(&x->gp); ! if (argc && argv->a_type == A_SYMBOL) pd_typedmess(canvas_getcanvas(canvas), argv->a_symbol, argc-1, argv+1); else pd_error(x, "send-window: no message?"); } *************** *** 5245,5249 **** if (!gpointer_check(&x->gp, 1)) {pd_error(x, "bang: empty pointer"); return;} t_symbol *templatesym = gpointer_gettemplatesym(&x->gp); ! for (int n = x->ntypedout; n--; to++) if (to->type == templatesym) {outlet_pointer(to->outlet, &x->gp); return;} outlet_pointer(x->otherout, &x->gp); --- 5214,5218 ---- if (!gpointer_check(&x->gp, 1)) {pd_error(x, "bang: empty pointer"); return;} t_symbol *templatesym = gpointer_gettemplatesym(&x->gp); ! for (int n=x->ntypedout; n--; to++) if (to->type == templatesym) {outlet_pointer(to->outlet, &x->gp); return;} outlet_pointer(x->otherout, &x->gp); *************** *** 5257,5267 ****
static void ptrobj_rewind(t_ptrobj *x) { - t_canvas *canvas; - t_gstub *gs; if (!gpointer_check(&x->gp, 1)) {pd_error(x, "rewind: empty pointer"); return;} ! gs = x->gp.gp_stub; ! if (gstub_which(gs) != GP_CANVAS) {pd_error(x, "rewind: sorry, unavailable for arrays"); return;} ! canvas = gs->canvas; ! gpointer_setcanvas(&x->gp, canvas, 0); ptrobj_bang(x); } --- 5226,5232 ----
static void ptrobj_rewind(t_ptrobj *x) { if (!gpointer_check(&x->gp, 1)) {pd_error(x, "rewind: empty pointer"); return;} ! if (x->gp.o->_class == array_class) {pd_error(x, "rewind: sorry, unavailable for arrays"); return;} ! gpointer_setcanvas(&x->gp, x->gp.canvas, 0); ptrobj_bang(x); } *************** *** 5306,5314 **** int nitems = x->nout; t_template *t = template_findbyname(x->templatesym); - t_gstub *gs = gp->gp_stub; t_getvariable *vp; TEMPLATE_CHECK(x,x->templatesym,) if (!gpointer_check(gp, 0)) {pd_error(x, "stale or empty pointer"); return;} ! t_word *vec = gstub_which(gs)==GP_ARRAY ? gp->w : gp->scalar->v; vp = x->variables + nitems-1; for (int i=nitems-1; i>=0; i--, vp--) { --- 5271,5278 ---- int nitems = x->nout; t_template *t = template_findbyname(x->templatesym); t_getvariable *vp; TEMPLATE_CHECK(x,x->templatesym,) if (!gpointer_check(gp, 0)) {pd_error(x, "stale or empty pointer"); return;} ! t_word *vec = gpointer_word(gp); vp = x->variables + nitems-1; for (int i=nitems-1; i>=0; i--, vp--) { *************** *** 5376,5380 **** t_template *t = template_findbyname(x->templatesym); t_gpointer *gp = &x->gp; - t_gstub *gs = gp->gp_stub; TEMPLATE_CHECK(x,x->templatesym,) if (!gpointer_check(gp, 0)) {pd_error(x, "empty pointer"); return;} --- 5340,5343 ---- *************** *** 5384,5398 **** } if (!nitems) return; ! t_word *vec = gstub_which(gs) == GP_ARRAY ? gp->w : gp->scalar->v; t_setvariable *vp=x->variables; ! if (x->issymbol) ! for (int i=0; i<nitems; i++,vp++) template_setsymbol(t, vp->sym, vec, vp->w.w_symbol, 1); ! else for (int i=0; i<nitems; i++,vp++) template_setfloat(t, vp->sym, vec, vp->w.w_float, 1); ! if (gstub_which(gs) == GP_CANVAS) scalar_redraw(gp->scalar, gs->canvas); ! else { ! t_array *owner_array = gs->array; ! while (gstub_which(STUB(owner_array)) == GP_ARRAY) owner_array = STUB(owner_array)->array; ! scalar_redraw(owner_array->gp.scalar, STUB(owner_array)->canvas); ! } }
--- 5347,5355 ---- } if (!nitems) return; ! t_word *vec = gpointer_word(gp); t_setvariable *vp=x->variables; ! if (x->issymbol) for (int i=0; i<nitems; i++,vp++) template_setsymbol(t, vp->sym, vec, vp->w.w_symbol, 1); ! else for (int i=0; i<nitems; i++,vp++) template_setfloat(t, vp->sym, vec, vp->w.w_float, 1); ! scalar_redraw(gp->scalar, gpointer_getcanvas(gp)); /* but ought to use owner_array->gp.scalar */ }
*************** *** 5448,5452 **** return; } ! t_word *w = gstub_which(gparent->gp_stub)==GP_ARRAY ? gparent->w : gparent->scalar->v; TEMPLATE_CHECK(x,x->templatesym,) if (!template_find_field(t, fieldsym, &onset, &type, &elemtemplatesym)) { --- 5405,5409 ---- return; } ! t_word *w = gpointer_word(gparent); TEMPLATE_CHECK(x,x->templatesym,) if (!template_find_field(t, fieldsym, &onset, &type, &elemtemplatesym)) { *************** *** 5494,5498 **** t_symbol *fieldsym = x->fieldsym, *elemtemplatesym; t_template *t = template_findbyname(x->templatesym); - t_gstub *gs = gp->gp_stub; TEMPLATE_CHECK(x,x->templatesym,) if (!template_find_field(t, fieldsym, &onset, &type, &elemtemplatesym)) { --- 5451,5454 ---- *************** *** 5507,5511 **** return; } ! t_word *w = gstub_which(gs)==GP_ARRAY ? gp->w : gp->scalar->v; t_array *array = *(t_array **)(((char *)w) + onset); outlet_float(x->ob_outlet, (float)(array->n)); --- 5463,5467 ---- return; } ! t_word *w = gpointer_word(gp); t_array *array = *(t_array **)(((char *)w) + onset); outlet_float(x->ob_outlet, (float)(array->n)); *************** *** 5536,5540 **** int newsize = (int)f; t_gpointer *gp = &x->gp; - t_gstub *gs = gp->gp_stub; if (!gpointer_check(&x->gp, 0)) {pd_error(x, "empty pointer"); return;} if (gpointer_gettemplatesym(&x->gp) != x->templatesym) { --- 5492,5495 ---- *************** *** 5542,5546 **** return; } ! t_word *w = gstub_which(gs)==GP_ARRAY ? gp->w : gp->scalar->v; TEMPLATE_CHECK(x,x->templatesym,) t_symbol *elemtemplatesym; --- 5497,5501 ---- return; } ! t_word *w = gpointer_word(gp); TEMPLATE_CHECK(x,x->templatesym,) t_symbol *elemtemplatesym; *************** *** 5562,5575 **** if (newsize == nitems) return;
! /* erase the array before resizing it. If we belong to a scalar it's easy, ! but if we belong to an element of another array we have to search back until we get to a ! scalar to erase. When graphics updates become queueable this may fall apart... */ ! if (gstub_which(gs) == GP_CANVAS) { ! if (canvas_isvisible(gs->canvas)) sys_mgui(gp->scalar,"delete",""); ! } else { ! t_array *o = gs->array; ! while (gstub_which(STUB(o)) == GP_ARRAY) o = STUB(o)->array; ! if (canvas_isvisible(STUB(o)->canvas)) sys_mgui(o->gp.scalar, "delete",""); ! }
/* now do the resizing and, if growing, initialize new scalars */ --- 5517,5521 ---- if (newsize == nitems) return;
! /* here there was something to erase the array before resizing it */
/* now do the resizing and, if growing, initialize new scalars */ *************** *** 5584,5594 **** } } ! if (gstub_which(gs) == GP_CANVAS) { ! gobj_changed(gp->scalar,0); ! } else {/*is there something missing here?*/ ! t_array *o = gs->array; ! while (gstub_which(STUB(o)) == GP_ARRAY) o = STUB(o)->array; ! gobj_changed(o->gp.scalar,0); ! } }
--- 5530,5534 ---- } } ! gobj_changed(gpointer_getscalar(gp),0); }
*************** *** 5635,5644 **** t_template *t = template_findbyname(x->templatesym); t_gpointer *gp = &x->gp; - t_gstub *gs = gp->gp_stub; TEMPLATE_CHECK(x,x->templatesym,) ! if (!gs) {pd_error(x, "no current pointer"); return;} ! if (gstub_which(gs) != GP_CANVAS) {pd_error(x, "lists only, not arrays"); return;} ! t_canvas *canvas = gs->canvas; ! if (isstale(gp)) {pd_error(x, "stale pointer"); return;} if (!nitems) return; x->variables[0].f = f; --- 5575,5582 ---- t_template *t = template_findbyname(x->templatesym); t_gpointer *gp = &x->gp; TEMPLATE_CHECK(x,x->templatesym,) ! if (!gp->o) {pd_error(x, "no current pointer"); return;} ! if (gp->o->_class == array_class) {pd_error(x, "lists only, not arrays"); return;} ! t_canvas *canvas = gp->canvas; if (!nitems) return; x->variables[0].f = f; *************** *** 5684,5688 **** t_symbol *dummy; t_template *t = template_findbyname(x->templatesym); - t_gstub *gs = gp->gp_stub; int onset, type; TEMPLATE_CHECK(x,x->templatesym,) --- 5622,5625 ---- *************** *** 5693,5697 **** } if (type != DT_LIST) {pd_error(x, "field %s not of type list", x->fieldsym->s_name); return;} ! t_word *w = gstub_which(gs)==GP_ARRAY ? gp->w : gp->scalar->v; gpointer_setcanvas(&x->gp, *(t_canvas **)(((char *)w) + onset), 0); outlet_pointer(x->ob_outlet, &x->gp); --- 5630,5634 ---- } if (type != DT_LIST) {pd_error(x, "field %s not of type list", x->fieldsym->s_name); return;} ! t_word *w = gpointer_word(gp); gpointer_setcanvas(&x->gp, *(t_canvas **)(((char *)w) + onset), 0); outlet_pointer(x->ob_outlet, &x->gp);