[PD-cvs] pd/src desire.c, 1.1.2.41, 1.1.2.42 desire.tk, 1.1.2.85, 1.1.2.86

Mathieu Bouchard matju at users.sourceforge.net
Sat Oct 29 13:40:34 CEST 2005


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29521

Modified Files:
      Tag: devel_0_39
	desire.c desire.tk 
Log Message:
server-side queue now works


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.85
retrieving revision 1.1.2.86
diff -C2 -d -r1.1.2.85 -r1.1.2.86
*** desire.tk	21 Oct 2005 13:47:09 -0000	1.1.2.85
--- desire.tk	29 Oct 2005 11:40:32 -0000	1.1.2.86
***************
*** 63,66 ****
--- 63,75 ----
  }
  
+ def observable child_changed {origin args} {
+ 	foreach x $@subscribers {eval [concat [list $x notice $origin] $args]}
+ }
+ 
+ #-----------------------------------------------------------------------------------#
+ set poolset(foo) bar
+ array unset poolset foo
+ set poolqueue {}
+ 
  #-----------------------------------------------------------------------------------#
  # this is the beginning of the more application-dependent part.
***************
*** 627,631 ****
  #-----------------------------------------------------------------------------------#
  # check or uncheck the "edit" menu item
! def* canvas editmode {mode} {
      global look
      .x$self.m.edit entryconfigure "Edit mode" -indicatoron $mode
--- 636,640 ----
  #-----------------------------------------------------------------------------------#
  # check or uncheck the "edit" menu item
! def* canvas editmode= {mode} {
      global look
      .x$self.m.edit entryconfigure "Edit mode" -indicatoron $mode
***************
*** 673,677 ****
      $self new_binds
      focus $c
!     $self editmode $editable
      set @action none
      set @selection {}
--- 682,686 ----
      $self new_binds
      focus $c
!     $self editmode= $editable
      set @action none
      set @selection {}
***************
*** 1620,1623 ****
--- 1629,1642 ----
  }
  
+ def canvas notice {origin args} {
+     global pool
+     set has_window 1
+     if {$has_window} {
+ 	set pool($origin) 1
+     } {
+         eval [concat [list child_changed $origin] $args]
+     }
+ }
+ 
  #-----------------------------------------------------------------------------------#
  set lastcanvasconfigured ""

Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.41
retrieving revision 1.1.2.42
diff -C2 -d -r1.1.2.41 -r1.1.2.42
*** desire.c	29 Oct 2005 10:30:18 -0000	1.1.2.41
--- desire.c	29 Oct 2005 11:40:32 -0000	1.1.2.42
***************
*** 42,45 ****
--- 42,46 ----
  t_appendix *appendix_new (t_gobj *master) {
  	t_appendix *self = (t_appendix *)malloc(sizeof(t_appendix));
+ 	post("appendix_new: %p for %p",self,master);
  	self->master = master;
  	self->next = 0;
***************
*** 116,119 ****
--- 117,121 ----
  	self->o[(self->start+self->len)%QUEUE_SIZE] = stuff;
  	self->len++;
+ 	post("queue_get: items in queue: %d",self->len);
  }
  
***************
*** 122,125 ****
--- 124,128 ----
  	self->start = (self->start+1)%QUEUE_SIZE;
  	self->len--;
+ 	post("queue_get: items in queue: %d",self->len);
  	return r;
  }
***************
*** 250,253 ****
--- 253,257 ----
      x->gl_next = canvas_list;
      canvas_list = x;
+     canvas_redraw(x);
  }
  
***************
*** 423,429 ****
  int glist_valid = 10000;
  
! void glist_init(t_glist *x)
! {
!         /* zero out everyone except "pd" field */
      memset(((char *)x) + sizeof(x->gl_pd), 0, sizeof(*x) - sizeof(x->gl_pd));
      x->gl_stub = gstub_new(x, 0);
--- 427,432 ----
  int glist_valid = 10000;
  
! void glist_init(t_glist *x) {
!     /* zero out everyone except "pd" field */
      memset(((char *)x) + sizeof(x->gl_pd), 0, sizeof(*x) - sizeof(x->gl_pd));
      x->gl_stub = gstub_new(x, 0);
***************
*** 431,434 ****
--- 434,438 ----
      x->gl_xlabel = (t_symbol **)t_getbytes(0);
      x->gl_ylabel = (t_symbol **)t_getbytes(0);
+     ((t_gobj *)x)->g_adix = appendix_new((t_gobj *)x);
  }
  
***************
*** 448,453 ****
      if (!owner)
          canvas_addtolist(x);
-     /* post("canvas %lx, owner %lx", x, owner); */
- 
      if (argc == 5)  /* toplevel */
  	pd_scanargs(argc,argv,"iiiii",&xloc,&yloc,&width,&height,&font);
--- 452,455 ----
***************
*** 638,644 ****
  {
      char buf[MAXPDSTRING];
!     strcpy(buf, "pd-");
!     strcat(buf, s->s_name);
!     return (gensym(buf));
  }
  
--- 640,645 ----
  {
      char buf[MAXPDSTRING];
!     sprintf(buf,"pd-%s",s->s_name);
!     return gensym(buf);
  }
  
***************
*** 782,791 ****
  void canvas_vis(t_canvas *x, t_floatarg f)
  {
!     int flag = (f != 0);
!     if (flag)
      {
-         /* post("havewindow %d, isgraph %d, isvisible %d  editor %d",
-             x->gl_havewindow, x->gl_isgraph, glist_isvisible(x),
-                 (x->gl_editor != 0)); */
              /* test if we're already visible and toplevel */
          if (x->gl_editor)
--- 783,788 ----
  void canvas_vis(t_canvas *x, t_floatarg f)
  {
!     if (!!f)
      {
              /* test if we're already visible and toplevel */
          if (x->gl_editor)
***************
*** 2358,2362 ****
  static void canvas_done_popup(t_canvas *x, float which, float xpos, float ypos)
  {
!     char pathbuf[MAXPDSTRING], namebuf[MAXPDSTRING];
      t_gobj *y;
      for (y = x->gl_list; y; y = y->g_next)
--- 2355,2359 ----
  static void canvas_done_popup(t_canvas *x, float which, float xpos, float ypos)
  {
!     char namebuf[MAXPDSTRING];
      t_gobj *y;
      for (y = x->gl_list; y; y = y->g_next)
***************
*** 2408,2416 ****
          canvas_properties(x);
      else if (which == 2)
!     {
!         strcpy(pathbuf, sys_libdir->s_name);
!         strcat(pathbuf, "/doc/5.reference/0.INTRO.txt");
!         sys_vgui("menu_opentext %s\n", pathbuf);
!     }
  }
  
--- 2405,2409 ----
          canvas_properties(x);
      else if (which == 2)
!         sys_vgui("menu_opentext %s%s\n", sys_libdir->s_name,"/doc/5.reference/0.INTRO.txt");
  }
  
***************
*** 3738,3742 ****
              canvas_setcursor(x, CURSOR_RUNMODE_NOTHING);
      }
!     sys_vgui("%lx editval %d\n", (long)glist_getcanvas(x), x->gl_edit);
  }
  
--- 3731,3735 ----
              canvas_setcursor(x, CURSOR_RUNMODE_NOTHING);
      }
!     sys_mgui(glist_getcanvas(x),"editmode=","i",x->gl_edit);
  }
  
***************
*** 5286,5290 ****
  void glist_add(t_glist *x, t_gobj *y)
  {
!     y->g_adix = appendix_new(y); /* mb: i found no better place for initing this */
      gobj_subscribe(y,(t_gobj *)x);
      gobj_changed(y,"");
--- 5279,5283 ----
  void glist_add(t_glist *x, t_gobj *y)
  {
!     if (!y->g_adix) y->g_adix = appendix_new(y); /* mb: i found no better place for initing this */
      gobj_subscribe(y,(t_gobj *)x);
      gobj_changed(y,"");
***************
*** 5297,5301 ****
          y2->g_next = y;
      }
!     sys_mgui(x,"add","p",y);
      /* voodoo */
      /* if (x->gl_editor && (ob = pd_checkobject(&y->g_pd))) rtext_new(x, ob); */
--- 5290,5295 ----
          y2->g_next = y;
      }
!     gobj_changed(x,"");
! //  sys_mgui(x,"add","p",y);
      /* voodoo */
      /* if (x->gl_editor && (ob = pd_checkobject(&y->g_pd))) rtext_new(x, ob); */
***************
*** 5330,5336 ****
      t_canvas *canvas = glist_getcanvas(x);
      int drawcommand = class_isdrawcommand(y->g_pd);
!     int wasdeleting;
!     
!     wasdeleting = canvas_setdeleting(canvas, 1);
      if (x->gl_editor)
      {
--- 5324,5328 ----
      t_canvas *canvas = glist_getcanvas(x);
      int drawcommand = class_isdrawcommand(y->g_pd);
!     int wasdeleting = canvas_setdeleting(canvas, 1);
      if (x->gl_editor)
      {
***************
*** 12417,12434 ****
  	int n;
  	char *s;
! 	if (strcmp(c->c_name->s_name,"canvas")!=0) {
! 		c->c_savefn(self,buf);
! 	} else {
  		/* just the "#N canvas" line, not the contents */
! 		canvas_savecontainerto((t_canvas *)c,buf);
  	}
  	binbuf_gettext(buf,&s,&n);
  	sys_vgui("update_object %x {%.*s}\n", (unsigned)self,n,s);
! 	//sys_mgui(self,"ninlets=","i", obj_ninlets((t_text *)self));
! 	//sys_mgui(self,"noutlets=","i",obj_noutlets((t_text *)self));
! 	sys_vgui("%lx ninlets= %d\n",  (long)self, obj_ninlets((t_text *)self));
! 	sys_vgui("%lx noutlets= %d\n", (long)self, obj_noutlets((t_text *)self));
  	binbuf_free(buf);
  	free(s);
  }
  
--- 12409,12432 ----
  	int n;
  	char *s;
! 	if (c==canvas_class) {
  		/* just the "#N canvas" line, not the contents */
! 		canvas_savecontainerto((t_canvas *)self,buf);
! 	} else {
! 		c->c_savefn(self,buf);
  	}
  	binbuf_gettext(buf,&s,&n);
  	sys_vgui("update_object %x {%.*s}\n", (unsigned)self,n,s);
! 	sys_mgui(self,"ninlets=","i", obj_ninlets((t_text *)self));
! 	sys_mgui(self,"noutlets=","i",obj_noutlets((t_text *)self));
  	binbuf_free(buf);
  	free(s);
+ 	if (c==canvas_class) {
+ 		// buffer overflow bug here
+ 		char foo[4096];
+ 		char *bar = foo;
+ 		t_gobj *y;
+ 		glist_each(y,(t_canvas *)self) bar+=sprintf(bar,"%lx ",(long)y);
+ 		sys_mgui((t_gobj *)self,"children=","S",foo);
+ 	}
  }
  
***************
*** 13389,13394 ****
  void canvas_notice(t_gobj *x, struct _gobj *origin, int argc, t_atom *argv) {
  	t_canvas *self = (t_canvas *)x;
! 	post("canvas_notice(%p,%p,%d,...)",x,origin,argc);
! 	if (self->gl_havewindow && self->gl_mapped) {
  		manager_notice(manager,origin,argc,argv);
  	} else {
--- 13387,13392 ----
  void canvas_notice(t_gobj *x, struct _gobj *origin, int argc, t_atom *argv) {
  	t_canvas *self = (t_canvas *)x;
! 	post("canvas_notice(%p,%p,%d,...): havewindow=%d mapped=%d",x,origin,argc,self->gl_havewindow,self->gl_mapped);
! 	if (self->gl_havewindow /* && self->gl_mapped */) {
  		manager_notice(manager,origin,argc,argv);
  	} else {





More information about the Pd-cvs mailing list