[PD-cvs] pd/src objective.tcl, 1.1.2.1, 1.1.2.2 desire.c, 1.1.2.45, 1.1.2.46 desire.tk, 1.1.2.87, 1.1.2.88

Mathieu Bouchard matju at users.sourceforge.net
Mon Oct 31 12:14:00 CET 2005


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

Modified Files:
      Tag: devel_0_39
	objective.tcl desire.c desire.tk 
Log Message:
added client-side manager.
bugfixes.


Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.87
retrieving revision 1.1.2.88
diff -C2 -d -r1.1.2.87 -r1.1.2.88
*** desire.tk	29 Oct 2005 18:00:50 -0000	1.1.2.87
--- desire.tk	31 Oct 2005 11:13:58 -0000	1.1.2.88
***************
*** 70,74 ****
  set poolset(foo) bar
  array unset poolset foo
! set poolqueue {}
  
  #-----------------------------------------------------------------------------------#
--- 70,102 ----
  set poolset(foo) bar
  array unset poolset foo
! 
! class_new manager {thing}
! 
! def manager init {} {
! 	set @q [list]
! 	$self call
! }
! 
! def manager call {} {
! 	global poolset
! 	if {![llength $@q]} return
! 	post "client queue %d" [llength $@q]
! 	foreach o $@q {
! 		puts "$o: $poolset($o)"
! 		unset poolset($origin)
! 	}
! 	set @q [list]
! 	after 500 "$self call"
! }
! 
! def manager notice {origin args} {
! 	global poolset
! 	if {[info exists poolset($origin)]} {
! 		# nothing for now
! 	} {
! 		set poolset($origin) {-1}
! 		lappend poolset $origin
! 	}
! }
  
  #-----------------------------------------------------------------------------------#
***************
*** 662,666 ****
  
  class_new canvas {view}
! def* canvas init {width height geometry editable} {
      super
      global pd_opendir pd_tearoff OS cmdline canvasmenu focus
--- 690,694 ----
  
  class_new canvas {view}
! def* canvas init {{width 300} {height 400} {geometry 400x300+0+0} {editable 0}} {
      super
      global pd_opendir pd_tearoff OS cmdline canvasmenu focus
***************
*** 706,709 ****
--- 734,740 ----
  }
  
+ def* canvas  ninlets= {n} {}
+ def* canvas noutlets= {n} {}
+ 
  #-----------------------------------------------------------------------------------#
  
***************
*** 1179,1184 ****
--- 1210,1226 ----
  #def* canvas del {i}     {lset @children $i ""}
  
+ proc lwithout {a b} {
+ 	set r {}
+ 	foreach x $b {set c($x) {}}
+ 	foreach x $a {if {![info exists c($x)]} {lappend r $x}}
+ 	return $r
+ }
+ 
  def* canvas children= {children} {
  	# think of the children!!!
+ 	set born [lwithout $children $@children]; post %s "BORN: $born"
+ 	set dead [lwithout $@children $children]; post %s "BORN: $dead"
+ 	foreach x $born {}
+ 	foreach x $dead {}
  	set @children $children
  }
***************
*** 1194,1198 ****
  }
  
- 
  def canvas delete_selection {} {
  	foreach obj $@selection {$obj erase}
--- 1236,1239 ----
***************
*** 2984,2985 ****
--- 3025,3029 ----
  #c that thing..redraws anythign that is currently selected or was currently selected
  #c lsort proably does what u want (has an integer flag too)
+ 
+ 
+ set manager [manager_new]

Index: objective.tcl
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/objective.tcl,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** objective.tcl	13 Oct 2005 07:03:25 -0000	1.1.2.1
--- objective.tcl	31 Oct 2005 11:13:58 -0000	1.1.2.2
***************
*** 36,40 ****
  proc proc* {name args body} {
  	set argl {}
! 	foreach arg $args {lappend argl "$arg=\$$arg"}
  	proc $name $args "puts \"CALL TO PROC $name [join $argl " "]\"; $body"
  }
--- 36,40 ----
  proc proc* {name args body} {
  	set argl {}
! 	foreach arg $args {set arg [lindex $arg 0]; lappend argl "$arg=\$$arg"}
  	proc $name $args "puts \"CALL TO PROC $name [join $argl " "]\"; $body"
  }
***************
*** 66,70 ****
  	global _
  	set self [lindex $args 0]
! 	if {"$self" == ""} {error "null pointer you black emperor"}
  	set selector [lindex $args 1]
  	if {[llength [array names _ $self:_class]] == 0} {
--- 66,70 ----
  	global _
  	set self [lindex $args 0]
! 	if {"$self" == ""} {error "null pointer error"}
  	set selector [lindex $args 1]
  	if {[llength [array names _ $self:_class]] == 0} {
***************
*** 75,78 ****
--- 75,79 ----
  	lookup_method $_($self:_class) $selector methods ancestors
  	set i 0
+ #	puts "FOUND METHODS: $methods"
  	if {![llength $methods]} {
  		error "no such method '$selector' for object '$self'\nwith ancestors {$ancestors}"
***************
*** 93,96 ****
--- 94,99 ----
  class_new thing
  set _(thing:_super) {}
+ def* thing init {} {}
+ 
  # virtual destructor
  def* thing _delete {} {}

Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.45
retrieving revision 1.1.2.46
diff -C2 -d -r1.1.2.45 -r1.1.2.46
*** desire.c	29 Oct 2005 17:28:11 -0000	1.1.2.45
--- desire.c	31 Oct 2005 11:13:58 -0000	1.1.2.46
***************
*** 44,48 ****
  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;
--- 44,47 ----
***************
*** 117,121 ****
  
  void queue_put (t_queue *self, void *stuff) {
- 	post("HEY");
  	if (self->len==QUEUE_SIZE) {bug("queue full"); return;}
  	self->o[(self->start+self->len)%QUEUE_SIZE] = stuff;
--- 116,119 ----
***************
*** 154,161 ****
  void manager_call (void *foo) {
  	t_manager *self = (t_manager *)foo;
- 	LS
  	while (!queue_empty(self->q)) {
  		t_gobj *o = (t_gobj *)queue_get(self->q);
  		if (!o->g_adix->dirtyc) continue;
  		pd_upload(o);
  		o->g_adix->dirtyc = 0;
--- 152,159 ----
  void manager_call (void *foo) {
  	t_manager *self = (t_manager *)foo;
  	while (!queue_empty(self->q)) {
  		t_gobj *o = (t_gobj *)queue_get(self->q);
  		if (!o->g_adix->dirtyc) continue;
+ 		post("UPLOADING a %s",o->g_pd->c_name->s_name);
  		pd_upload(o);
  		o->g_adix->dirtyc = 0;
***************
*** 166,174 ****
  void manager_notice (t_gobj *self_, t_gobj *origin, int argc, t_atom *argv) {
  	t_manager *self = (t_manager *)self_;
! 	LS
  	t_appendix *a = (t_appendix *)origin->g_adix;
  	if (!a->dirtyc) {
  		queue_put(self->q,origin);
  		a->dirtyc = 1;
  	}
  	SETFLOAT(a->dirtyv,-1); /* in the future this may contain real data instead */
--- 164,174 ----
  void manager_notice (t_gobj *self_, t_gobj *origin, int argc, t_atom *argv) {
  	t_manager *self = (t_manager *)self_;
! 	post("manager_notice(%p,%p,%d,...)",self,origin,argc);
  	t_appendix *a = (t_appendix *)origin->g_adix;
  	if (!a->dirtyc) {
  		queue_put(self->q,origin);
  		a->dirtyc = 1;
+ 	} else {
+ 		post("double dirty");
  	}
  	SETFLOAT(a->dirtyv,-1); /* in the future this may contain real data instead */
***************
*** 177,181 ****
  t_manager *manager_new (t_symbol *s, int argc, t_atom *argv) {
  	t_manager *self = (t_manager *)pd_new(manager_class);
- 	LS
  	self->super.g_adix = appendix_new((t_gobj *)self);
  	self->q = queue_new();
--- 177,180 ----
***************
*** 186,190 ****
  
  void manager_free (t_manager *self) {
- 	LS
  	clock_free(self->clock);
  	queue_free(self->q);
--- 185,188 ----
***************
*** 272,283 ****
  
      /* add a glist the list of "root" canvases (toplevels without parents.) */
! static void canvas_addtolist(t_canvas *x)
! {
      x->gl_next = canvas_list;
      canvas_list = x;
!     post("addtolist %lx",(long)x);
!     gobj_subscribe((t_gobj *)x,(t_gobj *)manager);
!     gobj_changed(x,"");
!     // canvas_redraw(x);
  }
  
--- 270,281 ----
  
      /* add a glist the list of "root" canvases (toplevels without parents.) */
! static void canvas_addtolist(t_canvas *x) {
      x->gl_next = canvas_list;
      canvas_list = x;
!     if (x->gl_havewindow || x->gl_willvis) {
! 	post("subscribe %lx",(long)x);
! 	gobj_subscribe((t_gobj *)x,(t_gobj *)manager);
! 	gobj_changed(x,"");
!     }
  }
  
***************
*** 1672,1683 ****
      /* get the index of a gobj in a glist.  If y is zero, return the
      total number of objects. */
! int glist_getindex(t_glist *x, t_gobj *y)
! {
      t_gobj *y2;
!     int indx;
! 
!     for (y2 = x->gl_list, indx = 0; y2 && y2 != y; y2 = y2->g_next)
!         indx++;
!     return (indx);
  }
  
--- 1670,1678 ----
      /* get the index of a gobj in a glist.  If y is zero, return the
      total number of objects. */
! int glist_getindex(t_glist *x, t_gobj *y) {
      t_gobj *y2;
!     int i=0;
!     glist_each(y2,x) {if (y2==y) break; else i++;}
!     return i;
  }
  
***************
*** 5317,5321 ****
      }
      gobj_changed(x,"");
- //  sys_mgui(x,"add","p",y);
      /* voodoo */
      /* if (x->gl_editor && (ob = pd_checkobject(&y->g_pd))) rtext_new(x, ob); */
--- 5312,5315 ----
***************
*** 12083,12092 ****
  }
  static void text_select(t_gobj *z, t_glist *glist, int state) {
!     sys_mgui(z,"wb_select","i",state);
  //    rtext_select(y, state); //???
  }
  static void text_activate(t_gobj *z, t_glist *glist, int state) {
!     sys_mgui(z,"wb_activate","i",state);
!     // what is this function supposed to be for anyway?
  }
  static void text_delete(t_gobj *z, t_glist *glist) {sys_mgui(z,"wb_delete","");}
--- 12077,12086 ----
  }
  static void text_select(t_gobj *z, t_glist *glist, int state) {
! //    sys_mgui(z,"wb_select","i",state);
  //    rtext_select(y, state); //???
  }
  static void text_activate(t_gobj *z, t_glist *glist, int state) {
! //    sys_mgui(z,"wb_activate","i",state);
! //	what is this function supposed to be for anyway?
  }
  static void text_delete(t_gobj *z, t_glist *glist) {sys_mgui(z,"wb_delete","");}





More information about the Pd-cvs mailing list