Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv441
Modified Files:
Tag: desiredata
desire.c
Log Message:
protect methods text_setto,object_moveto,etc from obsolete pointers
Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.217.2.69
retrieving revision 1.1.2.217.2.70
diff -C2 -d -r1.1.2.217.2.69 -r1.1.2.217.2.70
*** desire.c 13 Dec 2006 21:37:34 -0000 1.1.2.217.2.69
--- desire.c 14 Dec 2006 02:18:26 -0000 1.1.2.217.2.70
***************
*** 2257,2269 ****
t_gotfn chkdsp = zgetfn(y,gensym("dsp"));
int drawcommand = class_isdrawcommand(y->_class);
-
/* if we're a drawing command, erase all scalars now, before deleting
it; we'll redraw them once it's deleted below. */
! if (drawcommand)
! canvas_redrawallfortemplate(template_findbyname(canvas_makebindsym(canvas_getcanvas(x)->name)), 2);
!
canvas_deletelinesfor(x,(t_text *)y);
sys_mgui(y,"delete","");
-
if (x->list == y) {
x->list = y->g_next;
--- 2257,2265 ----
t_gotfn chkdsp = zgetfn(y,gensym("dsp"));
int drawcommand = class_isdrawcommand(y->_class);
/* if we're a drawing command, erase all scalars now, before deleting
it; we'll redraw them once it's deleted below. */
! if (drawcommand) canvas_redrawallfortemplate(template_findbyname(canvas_makebindsym(canvas_getcanvas(x)->name)), 2);
canvas_deletelinesfor(x,(t_text *)y);
sys_mgui(y,"delete","");
if (x->list == y) {
x->list = y->g_next;
***************
*** 2273,2278 ****
pd_free(y);
if (chkdsp) canvas_update_dsp();
! if (drawcommand)
! canvas_redrawallfortemplate(template_findbyname(canvas_makebindsym(canvas_getcanvas(x)->name)), 1);
x->valid = ++canvas_valid;
}
--- 2269,2273 ----
pd_free(y);
if (chkdsp) canvas_update_dsp();
! if (drawcommand) canvas_redrawallfortemplate(template_findbyname(canvas_makebindsym(canvas_getcanvas(x)->name)), 1);
x->valid = ++canvas_valid;
}
***************
*** 6195,6203 ****
}
! static void canvas_text_setto(t_canvas *x, t_symbol *s, int argc, t_atom *argv) {
! char str[666];
t_text *o;
! t_symbol *name = atom_getsymbol(argv);
! if (sscanf(name->s_name,"x%lx",(long*)&o)<1) {pd_error(x,"gargamel was here"); return;}
for (int i=0; i<argc-1; i++) str[i] = atom_getint(argv+i+1);
str[argc-1]=0;
--- 6190,6209 ----
}
! t_object *symbol2opointer(t_symbol *s) {
t_text *o;
! if (sscanf(s->s_name,"x%lx",(long*)&o)<1) {error("expected object-id"); return 0;}
! if (!hash_exists(object_table,o)) {
! error("%s target is not a currently valid pointer",s->s_name);
! return 0;
! }
! if (!o->_class->c_patchable) {error("%s target not a patchable object"); return 0;}
! return o;
! }
!
! t_object *atom2opointer(t_atom *a) {return symbol2opointer(atom_getsymbol(a));}
!
! static void canvas_text_setto(t_canvas *x, t_symbol *s, int argc, t_atom *argv) {
! t_text *o = atom2opointer(&argv[0]); if (!o) return;
! char str[4096];
for (int i=0; i<argc-1; i++) str[i] = atom_getint(argv+i+1);
str[argc-1]=0;
***************
*** 6206,6217 ****
static void canvas_object_moveto(t_canvas *x, t_symbol *name, t_floatarg px, t_floatarg py) {
! t_text *o;
! if (sscanf(name->s_name,"x%lx",(long*)&o)<1) {pd_error(x,"gargamel was here"); return;}
o->x=(int)px; gobj_changed(o,"x");
o->y=(int)py; gobj_changed(o,"y");
}
static void canvas_object_delete(t_canvas *x, t_symbol *name) {
! t_text *o;
! if (sscanf(name->s_name,"x%lx",(long*)&o)<1) {pd_error(x,"gargamel was here"); return;}
canvas_delete(x,o);
gobj_changed(x,"children");
--- 6212,6221 ----
static void canvas_object_moveto(t_canvas *x, t_symbol *name, t_floatarg px, t_floatarg py) {
! t_text *o = symbol2opointer(name); if (!o) return;
o->x=(int)px; gobj_changed(o,"x");
o->y=(int)py; gobj_changed(o,"y");
}
static void canvas_object_delete(t_canvas *x, t_symbol *name) {
! t_text *o = symbol2opointer(name); if (!o) return;
canvas_delete(x,o);
gobj_changed(x,"children");
***************
*** 6219,6224 ****
static void canvas_object_get_tips(t_canvas *x, t_symbol *name) {
! t_text *o;
! if (sscanf(name->s_name,"x%lx",(long*)&o)<1) {pd_error(x,"gargamel was here"); return;}
char foo[666];
if (o->ob_pd->c_firstin) strcpy(foo,o->ob_pd->c_firsttip->s_name); else strcpy(foo,"");
--- 6223,6227 ----
static void canvas_object_get_tips(t_canvas *x, t_symbol *name) {
! t_text *o = symbol2opointer(name); if (!o) return;
char foo[666];
if (o->ob_pd->c_firstin) strcpy(foo,o->ob_pd->c_firsttip->s_name); else strcpy(foo,"");