Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25269
Modified Files: Tag: desiredata desire.c m_pd.h Log Message: removed gs_un.gs_
Index: m_pd.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_pd.h,v retrieving revision 1.4.4.11.2.33.2.27 retrieving revision 1.4.4.11.2.33.2.28 diff -C2 -d -r1.4.4.11.2.33.2.27 -r1.4.4.11.2.33.2.28 *** m_pd.h 3 Jan 2007 04:42:12 -0000 1.4.4.11.2.33.2.27 --- m_pd.h 3 Jan 2007 04:59:09 -0000 1.4.4.11.2.33.2.28 *************** *** 111,121 **** typedef struct _gstub { union { ! struct _glist *gs_glist; /* should be renamed to gs_canvas */ ! struct _array *gs_array; ! } gs_un; } t_gstub; ! #define gs_refcount gs_un.gs_glist->gl_obj.refcount #endif
typedef struct _gpointer { union { --- 111,130 ---- typedef struct _gstub { union { ! struct _glist *canvas; ! struct _array *array; ! } un; } t_gstub; ! #define gs_refcount un.canvas->gl_obj.refcount #endif
+ #ifdef PD_PLUSPLUS_FACE + typedef struct _gpointer { + union { + struct _scalar *scalar; /* scalar we're in (if glist) */ + union word *w; /* raw data (if array) */ + }; + t_gstub *gp_stub; /* stub which points to glist/array */ + } t_gpointer; + #else typedef struct _gpointer { union { *************** *** 123,129 **** union word *gp_w; /* raw data (if array) */ } gp_un; - int gp_useless; t_gstub *gp_stub; /* stub which points to glist/array */ } t_gpointer;
typedef union word { --- 132,138 ---- union word *gp_w; /* raw data (if array) */ } gp_un; t_gstub *gp_stub; /* stub which points to glist/array */ } t_gpointer; + #endif
typedef union word {
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.217.2.105 retrieving revision 1.1.2.217.2.106 diff -C2 -d -r1.1.2.217.2.105 -r1.1.2.217.2.106 *** desire.c 3 Jan 2007 04:42:10 -0000 1.1.2.217.2.105 --- desire.c 3 Jan 2007 04:59:06 -0000 1.1.2.217.2.106 *************** *** 1700,1704 **** 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.gp_un.gp_scalar, canvas); }
--- 1700,1704 ---- 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); }
*************** *** 5109,5113 **** if (!gs) return 0; if (gstub_which(gs) == GP_ARRAY) return 1; ! if (gstub_which(gs) == GP_CANVAS) return headok || gp->gp_un.gp_scalar; return 0; } --- 5109,5113 ---- if (!gs) return 0; if (gstub_which(gs) == GP_ARRAY) return 1; ! if (gstub_which(gs) == GP_CANVAS) return headok || gp->scalar; return 0; } *************** *** 5117,5121 **** 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->gp_un.gp_scalar; return sc ? sc->t : 0;} else {t_array *a = gs->array; return a->templatesym;} } --- 5117,5121 ---- 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;} } *************** *** 5139,5152 **** 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->gp_un.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->gp_un.gp_w = w; gs->gs_refcount++; }
void gpointer_init(t_gpointer *gp) { gp->gp_stub = 0; ! gp->gp_un.gp_scalar = 0; }
--- 5139,5152 ---- 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; }
*************** *** 5206,5210 **** /* if (wantselected && !canvas_isvisible(canvas)) {pd_error(x, "next: next-selected only works for a visible window"); return;} */ ! gobj = gp->gp_un.gp_scalar; if (!gobj) gobj = canvas->list; else gobj = gobj->g_next; --- 5206,5210 ---- /* if (wantselected && !canvas_isvisible(canvas)) {pd_error(x, "next: next-selected only works for a visible window"); return;} */ ! gobj = gp->scalar; if (!gobj) gobj = canvas->list; else gobj = gobj->g_next; *************** *** 5213,5217 **** t_typedout *to = x->typedout; t_scalar *sc = (t_scalar *)gobj; ! gp->gp_un.gp_scalar = sc; for (int n = x->ntypedout; n--; to++) if (to->type == sc->t) {outlet_pointer(to->outlet, &x->gp); return;} --- 5213,5217 ---- t_typedout *to = x->typedout; t_scalar *sc = (t_scalar *)gobj; ! gp->scalar = sc; for (int n = x->ntypedout; n--; to++) if (to->type == sc->t) {outlet_pointer(to->outlet, &x->gp); return;} *************** *** 5310,5314 **** 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->gp_un.gp_w : gp->gp_un.gp_scalar->v; vp = x->variables + nitems-1; for (int i=nitems-1; i>=0; i--, vp--) { --- 5310,5314 ---- 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--) { *************** *** 5384,5397 **** } if (!nitems) return; ! t_word *vec = gstub_which(gs) == GP_ARRAY ? gp->gp_un.gp_w : gp->gp_un.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->gp_un.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.gp_un.gp_scalar, STUB(owner_array)->canvas); } } --- 5384,5397 ---- } 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); } } *************** *** 5448,5452 **** return; } ! t_word *w = gstub_which(gparent->gp_stub)==GP_ARRAY ? gparent->gp_un.gp_w : gparent->gp_un.gp_scalar->v; TEMPLATE_CHECK(x,x->templatesym,) if (!template_find_field(t, fieldsym, &onset, &type, &elemtemplatesym)) { --- 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)) { *************** *** 5507,5511 **** return; } ! t_word *w = gstub_which(gs)==GP_ARRAY ? gp->gp_un.gp_w : gp->gp_un.gp_scalar->v; t_array *array = *(t_array **)(((char *)w) + onset); outlet_float(x->ob_outlet, (float)(array->n)); --- 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)); *************** *** 5542,5546 **** return; } ! t_word *w = gstub_which(gs)==GP_ARRAY ? gp->gp_un.gp_w : gp->gp_un.gp_scalar->v; TEMPLATE_CHECK(x,x->templatesym,) t_symbol *elemtemplatesym; --- 5542,5546 ---- return; } ! t_word *w = gstub_which(gs)==GP_ARRAY ? gp->w : gp->scalar->v; TEMPLATE_CHECK(x,x->templatesym,) t_symbol *elemtemplatesym; *************** *** 5566,5574 **** 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->gp_un.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.gp_un.gp_scalar, "delete",""); }
--- 5566,5574 ---- 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",""); }
*************** *** 5585,5593 **** } if (gstub_which(gs) == GP_CANVAS) { ! gobj_changed(gp->gp_un.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.gp_un.gp_scalar,0); } } --- 5585,5593 ---- } 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); } } *************** *** 5645,5653 **** t_scalar *sc = scalar_new(canvas,x->templatesym); if (!sc) {pd_error(x, "%s: couldn't create scalar", x->templatesym->s_name); return;} ! t_scalar *oldsc = gp->gp_un.gp_scalar; if (oldsc) {sc->g_next = oldsc->g_next; oldsc->g_next = sc;} else {sc->g_next = canvas->list; canvas->list = sc;} gobj_changed(sc,0); ! gp->gp_un.gp_scalar = sc; t_word *vec = sc->v; t_appendvariable *vp=x->variables; --- 5645,5653 ---- t_scalar *sc = scalar_new(canvas,x->templatesym); if (!sc) {pd_error(x, "%s: couldn't create scalar", x->templatesym->s_name); return;} ! t_scalar *oldsc = gp->scalar; if (oldsc) {sc->g_next = oldsc->g_next; oldsc->g_next = sc;} else {sc->g_next = canvas->list; canvas->list = sc;} gobj_changed(sc,0); ! gp->scalar = sc; t_word *vec = sc->v; t_appendvariable *vp=x->variables; *************** *** 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->gp_un.gp_w : gp->gp_un.gp_scalar->v; gpointer_setcanvas(&x->gp, *(t_canvas **)(((char *)w) + onset), 0); outlet_pointer(x->ob_outlet, &x->gp); --- 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);