Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17131
Modified Files:
Tag: desiredata
desire.c desire.h desire.tk m_class.c
Log Message:
switched to a better, client-driven serial system for new objects
Index: m_class.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_class.c,v
retrieving revision 1.3.4.7.2.22.2.7
retrieving revision 1.3.4.7.2.22.2.8
diff -C2 -d -r1.3.4.7.2.22.2.7 -r1.3.4.7.2.22.2.8
*** m_class.c 12 Dec 2006 20:13:54 -0000 1.3.4.7.2.22.2.7
--- m_class.c 12 Dec 2006 23:21:03 -0000 1.3.4.7.2.22.2.8
***************
*** 519,528 ****
current = s__X.s_thing;
if ((fd = open_via_path(dir->s_name, s->s_name, ".pd", dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0 ||
! (fd = open_via_path(dir->s_name, s->s_name, ".pat", dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0)
! {
! close (fd);
! if (!pd_setloadingabstraction(s))
! {
! pd_push_origin(0);
canvas_setargs(argc, argv); /* bug fix by Krzysztof Czaja */
binbuf_evalfile(gensym(nameptr), gensym(dirbuf));
--- 519,525 ----
current = s__X.s_thing;
if ((fd = open_via_path(dir->s_name, s->s_name, ".pd", dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0 ||
! (fd = open_via_path(dir->s_name, s->s_name, ".pat", dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0) {
! close(fd);
! if (!pd_setloadingabstraction(s)) {
canvas_setargs(argc, argv); /* bug fix by Krzysztof Czaja */
binbuf_evalfile(gensym(nameptr), gensym(dirbuf));
***************
*** 530,534 ****
canvas_popabstraction((t_canvas *)(s__X.s_thing));
canvas_setargs(0, 0);
- pd_pop_origin();
}
else error("%s: can't load abstraction within itself\n", s->s_name);
--- 527,530 ----
Index: desire.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v
retrieving revision 1.1.2.600.2.67
retrieving revision 1.1.2.600.2.68
diff -C2 -d -r1.1.2.600.2.67 -r1.1.2.600.2.68
*** desire.tk 12 Dec 2006 21:15:28 -0000 1.1.2.600.2.67
--- desire.tk 12 Dec 2006 23:21:02 -0000 1.1.2.600.2.68
***************
*** 248,256 ****
if {[string compare $callback noserial]} {
set replyset($serial) $callback
! if {$::debug} {puts "<- [join $message]; [VTgreen]serial #$serial will do: $callback \$new[VTgrey]"}
incr serial
} else {
- if {$::debug} {puts "<- [join $message];"}
}
puts $sock "[join $message];"
}
--- 248,256 ----
if {[string compare $callback noserial]} {
set replyset($serial) $callback
! set message [concat [lrange $message 0 0] [list with_reply $serial] [lrange $message 1 end]]
incr serial
} else {
}
+ if {$::debug} {puts "<- [join $message];"}
puts $sock "[join $message];"
}
***************
*** 887,891 ****
global untitled_number untitled_folder
netsend [list pd filename Untitled-$untitled_number $untitled_folder]
! netsend [list #N canvas] {none}
netsend [list #X pop 1]
incr untitled_number
--- 887,891 ----
global untitled_number untitled_folder
netsend [list pd filename Untitled-$untitled_number $untitled_folder]
! netsend [list #N canvas]
netsend [list #X pop 1]
incr untitled_number
***************
*** 1843,1847 ****
default {set goto [list $self new_object_callback]}
}
! netsend [list [concat [list .$self $sel $x $y] $args]] $goto
}
--- 1843,1847 ----
default {set goto [list $self new_object_callback]}
}
! netsend [concat [list .$self $sel $x $y] $args] $goto
}
***************
*** 1886,1890 ****
}
# this should use callback...
! netsend [list .$self obj $x $y] {none}
set @action insert
}
--- 1886,1890 ----
}
# this should use callback...
! netsend [list .$self obj $x $y]
set @action insert
}
***************
*** 1894,1898 ****
mset {x1 y1 x2 y2} [$@selection bbox]
# this should use callback...
! netsend [list .$self obj $x1 [expr $y2 + 10]] {none}
set @action chain_obj
} else {
--- 1894,1898 ----
mset {x1 y1 x2 y2} [$@selection bbox]
# this should use callback...
! netsend [list .$self obj $x1 [expr $y2 + 10]]
set @action chain_obj
} else {
***************
*** 1919,1924 ****
def Canvas cnv {} {$self new_object obj cnv}
! def Canvas Graph {} {$self editmode= 1; pd .x$self graph }
! def Canvas Array {} {$self editmode= 1; pd .x$self menuarray}
def Canvas new_menubar {} {
--- 1919,1924 ----
def Canvas cnv {} {$self new_object obj cnv}
! def Canvas Graph {} {$self editmode= 1; netsend [list .x$self graph ]}
! def Canvas Array {} {$self editmode= 1; netsend [list .x$self menuarray]}
def Canvas new_menubar {} {
***************
*** 3090,3094 ****
def Canvas connect {wire} {
mset {from outlet to inlet} $wire
! netsend [list .$self connect $from $outlet $to $inlet] {none}
$@history add [list $self disconnect $wire]
}
--- 3090,3094 ----
def Canvas connect {wire} {
mset {from outlet to inlet} $wire
! netsend [list .$self connect $from $outlet $to $inlet]
$@history add [list $self disconnect $wire]
}
***************
*** 5532,5536 ****
proc tcl_eval {self l} {post %s "tcl: $l"; post %s "returns: [uplevel [info level] $l]"}
! proc pd_eval {self l} {post %s "pd: $l"; pd $l}
############ button bar
--- 5532,5536 ----
proc tcl_eval {self l} {post %s "tcl: $l"; post %s "returns: [uplevel [info level] $l]"}
! proc pd_eval {self l} {post %s "pd: $l"; netsend $l}
############ button bar
Index: desire.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.h,v
retrieving revision 1.1.2.49.2.8
retrieving revision 1.1.2.49.2.9
diff -C2 -d -r1.1.2.49.2.8 -r1.1.2.49.2.9
*** desire.h 12 Dec 2006 20:13:54 -0000 1.1.2.49.2.8
--- desire.h 12 Dec 2006 23:21:02 -0000 1.1.2.49.2.9
***************
*** 331,339 ****
//EXTERN int pd_pickle(t_foo *foo, char *fmt, ...);
void pd_set_newest (t_pd *x);
- void pd_set_newest_debug (t_pd *x, const char *file, int line);
- #define pd_set_newest(x) pd_set_newest_debug(x,__FILE__,__LINE__)
- struct t_manager;
- void pd_push_origin(t_manager *orig);
- void pd_pop_origin();
#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus)
--- 331,334 ----
Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.217.2.53
retrieving revision 1.1.2.217.2.54
diff -C2 -d -r1.1.2.217.2.53 -r1.1.2.217.2.54
*** desire.c 12 Dec 2006 16:32:54 -0000 1.1.2.217.2.53
--- desire.c 12 Dec 2006 23:20:59 -0000 1.1.2.217.2.54
***************
*** 262,266 ****
t_queue *q;
t_clock *clock;
- unsigned short serial; /* of objects created by the client */
t_binbuf *b; /* reusable, for processing messages from the gui */
};
--- 262,265 ----
***************
*** 268,272 ****
static t_class *manager_class;
t_manager *manager;
- t_hash *newest_table;
void manager_call (void *foo) {
--- 267,270 ----
***************
*** 301,305 ****
self->q = queue_new();
self->clock = clock_new(self,(t_method)manager_call);
- self->serial = 0;
self->b = binbuf_new();
clock_delay(self->clock,0);
--- 299,302 ----
***************
*** 585,595 ****
}
- /* this one should be used instead, when not used as a t_newmethod. */
- static t_canvas *canvas_new_2(void *dummy, t_symbol *sel, int argc, t_atom *argv) {
- t_canvas *x = canvas_new(dummy,sel,argc,argv);
- pd_set_newest(x);
- return x;
- }
-
void canvas_setgraph(t_canvas *x, int flag, int nogoprect);
--- 582,585 ----
***************
*** 861,884 ****
}
! void glob_newest_table(t_pd*);
!
! #undef pd_set_newest
! void pd_set_newest_debug (t_pd *x, const char *file, int line) {
! //post("pd_set_newest(x%lx) called from %s at line %d",(long)x,file,line);
! pd_set_newest(x);
! }
!
! void pd_set_newest (t_pd *x) {
! newest = x;
! if (!pd_origin()) return; /* the following only applies to objects created by client */
! unsigned short serial = manager->serial++;
! //post("hash_set newest_table x%lx %d",(void*)x,(int)serial);
! if (hash_exists(newest_table,x)) post("WARNING: duplicate serial for object x%lx",(long)x);
! hash_set(newest_table,x,(void*)serial);
! //glob_newest_table(0);
! /* sys_vgui("serial %d x%lx\n",serial,(long)x);*/
! }
! #define pd_set_newest(x) pd_set_newest_debug(x,__FILE__,__LINE__);
!
/* called by m_class.c */
--- 851,855 ----
}
! void pd_set_newest (t_pd *x) {newest = x;}
/* called by m_class.c */
***************
*** 940,944 ****
SETSYMBOL(a+4, s);
SETFLOAT(a+5, 0);
! t_canvas *x = canvas_new_2(0,0,6,a);
x->owner = z;
/* create a graph for the table */
--- 911,915 ----
SETSYMBOL(a+4, s);
SETFLOAT(a+5, 0);
! t_canvas *x = canvas_new(0,0,6,a);
x->owner = z;
/* create a graph for the table */
***************
*** 3696,3700 ****
else if (type == DT_LIST) {
/* LATER test this and get it to work */
! wp->w_list = canvas_new_2(0,0,0,0);
}
}
--- 3667,3671 ----
else if (type == DT_LIST) {
/* LATER test this and get it to work */
! wp->w_list = canvas_new(0,0,0,0);
}
}
***************
*** 6729,6738 ****
}
}
- if (hash_exists(newest_table,x)) {
- //glob_newest_table(0);
- sys_vgui("serial %d x%lx\n",hash_get(newest_table,x),(long)x);
- //post("hash_delete newest_table x%lx",(long)x);
- hash_delete(newest_table,x);
- }
}
--- 6700,6703 ----
***************
*** 7751,7755 ****
/* end miller 0.40 */
!
static void g_canvas_setup(void) {
--- 7716,7725 ----
/* end miller 0.40 */
! /* desiredata pre5 */
! static void canvas_with_reply (t_canvas *x, t_symbol *s, int argc, t_atom *argv) {
! if (!( argc>=2 && IS_A_FLOAT(argv,0) && IS_A_SYMBOL(argv,1) )) return;
! pd_typedmess(x,atom_getsymbol(&argv[1]),argc-2,argv+2);
! sys_vgui("serial %ld x%lx\n",(long)atom_getfloat(&argv[0]),(long)newest);
! }
static void g_canvas_setup(void) {
***************
*** 7763,7767 ****
/* here is the real creator function, invoked in patch files
by sending the "canvas" message to #N, which is bound to pd_canvasmaker. */
! class_addmethod3(pd_canvasmaker._class,canvas_new_2,"canvas","*");
class_addmethod3(c,canvas_restore,"restore","*");
class_addmethod3(c,canvas_coords,"coords","*");
--- 7733,7737 ----
/* here is the real creator function, invoked in patch files
by sending the "canvas" message to #N, which is bound to pd_canvasmaker. */
! class_addmethod3(pd_canvasmaker._class,canvas_new,"canvas","*");
class_addmethod3(c,canvas_restore,"restore","*");
class_addmethod3(c,canvas_coords,"coords","*");
***************
*** 7822,7825 ****
--- 7792,7796 ----
class_addmethod3(c,canvas_object_insert,"object_insert","*");
class_addmethod3(c,canvas_text_setto,"text_setto","*");
+ class_addmethod3(c,canvas_with_reply,"with_reply","*");
class_setnotice(c, canvas_notice);
}
***************
*** 7918,7922 ****
extern "C"
void desire_setup(void) {
- newest_table = hash_new(31);
s_empty = gensym("empty");
s_Pd = gensym("Pd");
--- 7889,7892 ----
***************
*** 8065,8076 ****
}
- void glob_newest_table(t_pd *ignore) {
- hashkey k;
- hashvalue v;
- post("newest_table = {");
- hash_foreach(k,v,newest_table) post(" x%lx -> %5ld",(void*)k,(long)v);
- post("}");
- }
-
extern t_class *glob_pdobject;
extern "C" void glob_init(void) {
--- 8035,8038 ----
***************
*** 8127,8131 ****
class_addmethod3(c,glob_help, "help", "s");
class_addmethod3(c,glob_redraw, "redraw", "");
- class_addmethod3(c,glob_newest_table, "newest_table", "");
class_addanything(c, max_default);
pd_bind((t_pd *)&glob_pdobject, gensym("pd"));
--- 8089,8092 ----