[PD-cvs] pd/src desire.c,1.1.2.126,1.1.2.127
Mathieu Bouchard
matju at users.sourceforge.net
Fri Sep 1 17:39:52 CEST 2006
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17182
Modified Files:
Tag: devel_0_39
desire.c
Log Message:
this is the real commit for notice cancellation, sorry.
also removing some old stuff.
Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.126
retrieving revision 1.1.2.127
diff -C2 -d -r1.1.2.126 -r1.1.2.127
*** desire.c 31 Aug 2006 19:36:05 -0000 1.1.2.126
--- desire.c 1 Sep 2006 15:39:48 -0000 1.1.2.127
***************
*** 93,96 ****
--- 93,98 ----
}
+ void manager_nevermind (t_gobj *victim);
+
void appendix_free (t_gobj *master) {
t_appendix *self = master->g_adix;
***************
*** 99,102 ****
--- 101,105 ----
hash_foreach(k,v,self->visual) {free(v);}
hash_free(self->visual);
+ manager_nevermind(master);
free(self);
}
***************
*** 167,197 ****
void queue_put (t_queue *self, void *stuff) {
! /*
char *buf; int bufn;
t_binbuf *b = ((t_text *)stuff)->te_binbuf;
if (b) {char *buf; int bufn; binbuf_gettext(b,&buf,&bufn); printf("queue_put [%.*s]\n",bufn,buf);}
else {printf("queue_put (%s)\n",(*(t_pd*)stuff)->c_name->s_name);}
! */
if (self->len==QUEUE_SIZE) {bug("queue full"); return;}
self->o[(self->start+self->len)%QUEUE_SIZE] = stuff;
self->len++;
! //post("queue_put: items in queue: %d",self->len);
}
void *queue_get (t_queue *self) {
void *stuff = self->o[self->start];
- t_binbuf *b;
self->start = (self->start+1)%QUEUE_SIZE;
self->len--;
! //post("queue_get: items in queue: %d",self->len);
! b = ((t_text *)stuff)->te_binbuf;
! /*if (b) {
! char *buf; int bufn;
! binbuf_gettext(b,&buf,&bufn);
! printf("queue_get [%.*s] %p\n",bufn,buf,stuff);}
! else {printf("queue_get (%s)\n",(*(t_pd*)stuff)->c_name->s_name);}*/
return stuff;
}
void queue_free (t_queue *self) {
abort();
--- 170,220 ----
void queue_put (t_queue *self, void *stuff) {
! #ifdef DEBUG_QUEUE
char *buf; int bufn;
t_binbuf *b = ((t_text *)stuff)->te_binbuf;
if (b) {char *buf; int bufn; binbuf_gettext(b,&buf,&bufn); printf("queue_put [%.*s]\n",bufn,buf);}
else {printf("queue_put (%s)\n",(*(t_pd*)stuff)->c_name->s_name);}
! #endif
if (self->len==QUEUE_SIZE) {bug("queue full"); return;}
self->o[(self->start+self->len)%QUEUE_SIZE] = stuff;
self->len++;
! #ifdef DEBUG_QUEUE
! post("queue_put: items in queue: %d",self->len);
! #endif
}
void *queue_get (t_queue *self) {
void *stuff = self->o[self->start];
self->start = (self->start+1)%QUEUE_SIZE;
self->len--;
! #ifdef DEBUG_QUEUE
! post("queue_get: items in queue: %d",self->len);
! if (stuff) {
! t_binbuf *b;
! b = ((t_text *)stuff)->te_binbuf;
! if (b) {
! char *buf; int bufn;
! binbuf_gettext(b,&buf,&bufn);
! printf("queue_get [%.*s] %p\n",bufn,buf,stuff);
! } else printf("queue_get (%s)\n",(*(t_pd*)stuff)->c_name->s_name);
! }
! #endif
return stuff;
}
+ #define queue_each(i,self) \
+ for (i=self->start; i!=(self->start+self->len)%QUEUE_SIZE; i=(i+1)%QUEUE_SIZE)
+
+ /* suicide letter from a t_gobj who was the originator of a notice */
+ void queue_nevermind (t_queue *self, t_gobj *victim) {
+ int i;
+ queue_each(i,self) {
+ if (self->o[i]==victim) {
+ self->o[i]=0;
+ printf("cancelled update_object for %p\n",victim);
+ }
+ }
+ }
+
void queue_free (t_queue *self) {
abort();
***************
*** 219,222 ****
--- 242,246 ----
while (!queue_empty(self->q)) {
t_gobj *o = (t_gobj *)queue_get(self->q);
+ if (!o) continue; /* cancelled notice */
if (!o->g_adix->dirtyc) continue;
/*post("UPLOADING a %s",o->g_pd->c_name->s_name);*/
***************
*** 254,257 ****
--- 278,283 ----
}
+ void manager_nevermind (t_gobj *victim) {queue_nevermind(manager->q,victim);}
+
//--------------------------------------------------------------------------
/* the "glist" class is also known as "canvas" (the two used
***************
*** 1797,1811 ****
#define NHIST 15
- static void canvas_texteditor(t_canvas *x)
- {
- t_rtext *foo = x->gl_editor->e_textedfor;
- char *buf;
- int bufsize;
- if (foo) rtext_gettext(foo, &buf, &bufsize);
- else buf = "", bufsize = 0;
- sys_vgui("pdtk_pd_texteditor {%.*s}\n", bufsize, buf);
-
- }
-
void canvas_editmode(t_canvas *x, t_floatarg fyesplease)
{
--- 1823,1826 ----
***************
*** 1978,1983 ****
t_class *garray_class;
- static int gcount = 0;
-
static t_pd *garray_arraytemplatecanvas;
--- 1993,1996 ----
***************
*** 2165,2179 ****
}
! /* called from array menu item to create a new one */
! void canvas_menuarray(t_glist *canvas)
! {
! t_glist *x = (t_glist *)canvas;
! char cmdbuf[200];
! sprintf(cmdbuf, "pdtk_array_dialog %%s array%d 100 3 1\n", gcount+1);
! gfxstub_new(&x->gl_pd, x, cmdbuf);
! }
!
! /* this is called back from the dialog window to create a garray.
! The otherflag requests that we find an existing graph to put it in. */
void glist_arraydialog(t_glist *parent, t_symbol *name, t_floatarg size,
t_floatarg fflags, t_floatarg otherflag)
--- 2178,2183 ----
}
! /* this is called back from the dialog window to create a garray.
! The otherflag requests that we find an existing graph to put it in. */
void glist_arraydialog(t_glist *parent, t_symbol *name, t_floatarg size,
t_floatarg fflags, t_floatarg otherflag)
***************
*** 3873,3878 ****
}
- extern void canvas_menuarray(t_glist *canvas);
-
//--------------------------------------------------------------------------
// from g_guiconnect.c
--- 3877,3880 ----
***************
*** 3880,3887 ****
/* a thing to forward messages from the GUI, dealing with race conditions
in which the "target" gets deleted while the GUI is sending it something.
*/
! struct _guiconnect
! {
t_object x_obj;
t_pd *x_who;
--- 3882,3889 ----
/* a thing to forward messages from the GUI, dealing with race conditions
in which the "target" gets deleted while the GUI is sending it something.
+ this is prolly a leftover that doesn't work with DesireData.
*/
! struct _guiconnect {
t_object x_obj;
t_pd *x_who;
***************
*** 3901,3923 ****
}
! /* cleanup routine; delete any resources we have */
! static void guiconnect_free(t_guiconnect *x)
! {
! if (x->x_sym)
! pd_unbind(&x->x_obj.ob_pd, x->x_sym);
! if (x->x_clock)
! clock_free(x->x_clock);
}
! /* this is called when the clock times out to indicate the GUI should
! be gone by now. */
! static void guiconnect_tick(t_guiconnect *x)
! {
! pd_free(&x->x_obj.ob_pd);
! }
! /* the target calls this to disconnect. If the gui has "signed off"
! we're ready to delete the object; otherwise we wait either for signoff
! or for a timeout. */
void guiconnect_notarget(t_guiconnect *x, double timedelay)
{
--- 3903,3918 ----
}
! /* cleanup routine; delete any resources we have */
! static void guiconnect_free(t_guiconnect *x) {
! if (x->x_sym) pd_unbind(&x->x_obj.ob_pd, x->x_sym);
! if (x->x_clock) clock_free(x->x_clock);
}
! /* this is called when the clock times out to indicate the GUI should be gone by now. */
! static void guiconnect_tick(t_guiconnect *x) {pd_free(&x->x_obj.ob_pd);}
! /* the target calls this to disconnect. If the gui has "signed off"
! we're ready to delete the object; otherwise we wait either for signoff
! or for a timeout. */
void guiconnect_notarget(t_guiconnect *x, double timedelay)
{
***************
*** 3940,3945 ****
GUI will fail to do this, the "target", when it signs off, should specify
a timeout after which the guiconnect will disappear.) */
! static void guiconnect_signoff(t_guiconnect *x)
! {
if (!x->x_who) pd_free(&x->x_obj.ob_pd);
else {
--- 3935,3939 ----
GUI will fail to do this, the "target", when it signs off, should specify
a timeout after which the guiconnect will disappear.) */
! static void guiconnect_signoff(t_guiconnect *x) {
if (!x->x_who) pd_free(&x->x_obj.ob_pd);
else {
***************
*** 4137,4151 ****
newtemplate = template_new(templatesym, ntemplateargs, templateargs);
t_freebytes(templateargs, sizeof (*templateargs) * ntemplateargs);
! if (!(existtemplate = template_findbyname(templatesym)))
! {
! error("%s: template not found in current patch",
! templatesym->s_name);
template_free(newtemplate);
return;
}
! if (!template_match(existtemplate, newtemplate))
! {
! error("%s: template doesn't match current one",
! templatesym->s_name);
template_free(newtemplate);
return;
--- 4131,4141 ----
newtemplate = template_new(templatesym, ntemplateargs, templateargs);
t_freebytes(templateargs, sizeof (*templateargs) * ntemplateargs);
! if (!(existtemplate = template_findbyname(templatesym))) {
! error("%s: template not found in current patch", templatesym->s_name);
template_free(newtemplate);
return;
}
! if (!template_match(existtemplate, newtemplate)) {
! error("%s: template doesn't match current one", templatesym->s_name);
template_free(newtemplate);
return;
***************
*** 4306,4317 ****
}
! static void glist_writelist(t_gobj *y, t_binbuf *b)
! {
! for (; y; y = y->g_next)
! {
! if (pd_class(&y->g_pd) == scalar_class)
! {
! canvas_writescalar(((t_scalar *)y)->sc_template,
! ((t_scalar *)y)->sc_vec, b, 0);
}
}
--- 4296,4303 ----
}
! static void glist_writelist(t_gobj *y, t_binbuf *b) {
! for (; y; y = y->g_next) {
! if (pd_class(&y->g_pd) == scalar_class) {
! canvas_writescalar(((t_scalar *)y)->sc_template, ((t_scalar *)y)->sc_vec, b, 0);
}
}
***************
*** 4576,4598 ****
}
- /* should die */
- static void canvas_menusaveas(t_canvas *x)
- {
- t_canvas *x2 = canvas_getrootfor(x);
- sys_vgui("pdtk_canvas_saveas .x%lx \"%s\" \"%s\"\n", (long)x2,
- x2->gl_name->s_name, canvas_getdir(x2)->s_name);
- }
-
- /* should die */
- static void canvas_menusave(t_canvas *x)
- {
- t_canvas *x2 = canvas_getrootfor(x);
- char *name = x2->gl_name->s_name;
- if (*name && strncmp(name, "Untitled", 8)
- && (strlen(name) < 4 || strcmp(name + strlen(name)-4, ".pat")))
- canvas_savetofile(x2, x2->gl_name, canvas_getdir(x2));
- else canvas_menusaveas(x2);
- }
-
///////////////////////////////////////////////////////////////////////////
// from g_io.c
--- 4562,4565 ----
***************
*** 5539,5542 ****
--- 5506,5510 ----
}
+ /*
static void scalar_properties(t_gobj *z, struct _glist *owner)
{
***************
*** 5556,5559 ****
--- 5524,5528 ----
t_freebytes(buf, bufsize+1);
}
+ */
static t_widgetbehavior scalar_widgetbehavior =
***************
*** 10394,10401 ****
class_addmethod3(c,canvas_close,"close","F");
- /* should die: */
- class_addmethod3(c,canvas_texteditor,"texteditor","");
- /* end die */
-
class_addmethod3(c,canvas_editmode, "editmode","F");
--- 10363,10366 ----
***************
*** 10417,10423 ****
class_addmethod3(c,canvas_savetofile,"savetofile","ss");
class_addmethod3(c,canvas_saveto, "saveto","!");
- class_addmethod3(c,canvas_menusave, "menusave","");
- class_addmethod3(c,canvas_menusaveas,"menusaveas","");
- // class_addmethod3(c,canvas_save_as, "save_as","s");
class_setwidget(c, &graph_widgetbehavior);
--- 10382,10385 ----
***************
*** 10428,10432 ****
class_addmethod3(c,graph_ylabel,"ylabel","*");
class_addmethod3(c,graph_array,"array","sfsF");
- class_addmethod3(c,canvas_menuarray,"menuarray","");
class_addmethod3(c,glist_arraydialog,"arraydialog","sfff");
class_addmethod3(c,glist_sort,"sort","");
--- 10390,10393 ----
More information about the Pd-cvs
mailing list