Update of /cvsroot/pure-data/externals/miXed/toxy In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv597/toxy
Modified Files: Makefile build_counter tot.c Log Message: toxy alpha10
Index: Makefile =================================================================== RCS file: /cvsroot/pure-data/externals/miXed/toxy/Makefile,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Makefile 23 Mar 2004 12:07:22 -0000 1.6 --- Makefile 29 Mar 2004 17:09:53 -0000 1.7 *************** *** 10,16 **** @echo transferring widget definitions from "$<" to "$@" @cat $< | sed \ ! -e '1i// Do not edit this file (edit "$<", and run "make").' \ ! -e '1i//' \ ! -e '1i"puts stderr [concat loading built-in widget definitions]\n"' \ -e 's/([\"])/\\1/g' \ -e 's/^.*$$/"&\n"/' > $@ --- 10,19 ---- @echo transferring widget definitions from "$<" to "$@" @cat $< | sed \ ! -e '1i\ ! // Do not edit this file (edit "$<", and run "make").' \ ! -e '1i\ ! //' \ ! -e '1i\ ! "puts stderr [concat loading built-in widget definitions]\n"' \ -e 's/([\"])/\\1/g' \ -e 's/^.*$$/"&\n"/' > $@
Index: build_counter =================================================================== RCS file: /cvsroot/pure-data/externals/miXed/toxy/build_counter,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** build_counter 23 Mar 2004 12:07:22 -0000 1.8 --- build_counter 29 Mar 2004 17:09:53 -0000 1.9 *************** *** 1,3 **** #define TOXY_VERSION "0.1" #define TOXY_RELEASE "alpha" ! #define TOXY_BUILD 9 --- 1,3 ---- #define TOXY_VERSION "0.1" #define TOXY_RELEASE "alpha" ! #define TOXY_BUILD 10
Index: tot.c =================================================================== RCS file: /cvsroot/pure-data/externals/miXed/toxy/tot.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tot.c 19 Feb 2004 22:23:18 -0000 1.3 --- tot.c 29 Mar 2004 17:09:53 -0000 1.4 *************** *** 1,3 **** ! /* Copyright (c) 2003 krzYszcz and others. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ --- 1,3 ---- ! /* Copyright (c) 2003-2004 krzYszcz and others. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ *************** *** 25,30 **** t_object x_ob; t_glist *x_glist; /* containing glist */ ! t_symbol *x_cvremote; /* null if containing glist is our destination */ ! t_symbol *x_cvname; t_symbol *x_cvpathname; /* see tot_getpathname() */ t_symbol *x_visedpathname; /* see tot__vised() */ --- 25,31 ---- t_object x_ob; t_glist *x_glist; /* containing glist */ ! t_symbol *x_dotname; /* "." (if explicit), ".parent", ".root", etc. */ ! t_symbol *x_cvname; /* destination name (if literal), or 0 */ ! t_symbol *x_cvremote; /* bindsym of the above */ t_symbol *x_cvpathname; /* see tot_getpathname() */ t_symbol *x_visedpathname; /* see tot__vised() */ *************** *** 55,58 **** --- 56,60 ---- t_atom ts_outbuf[TOTSPY_MAXSIZE]; t_outlet *ts_out3; + t_clock *ts_cleanupclock; /* also a tot-is-gone flag */ } t_totspy;
*************** *** 66,80 **** static t_symbol *totps_query;
static t_canvas *tot_getcanvas(t_tot *x, int complain) { t_canvas *cv = 0; ! t_glist *glist = ! (x->x_cvremote ? ! (t_glist *)pd_findbyclass(x->x_cvremote, canvas_class) : x->x_glist); if (glist) cv = glist_getcanvas(glist); else if (complain) ! loud_error((t_pd *)x, "bad canvas name '%s'", x->x_cvname->s_name); ! if (!x->x_warned && !x->x_cvremote) { x->x_warned = 1; --- 68,131 ---- static t_symbol *totps_query;
+ static t_symbol *totps_dotparent; /* holder of our containing glist's box */ + static t_symbol *totps_dotroot; /* our document's root canvas */ + static t_symbol *totps_dotowner; /* parent of .root */ + static t_symbol *totps_dottop; /* top-level canvas */ + + static t_glist *tot_getglist(t_tot *x) + { + t_glist *glist; + if (x->x_cvremote) + glist = (t_glist *)pd_findbyclass(x->x_cvremote, canvas_class); + else if (x->x_dotname == totps_dotparent) + glist = x->x_glist->gl_owner; + else if (x->x_dotname == totps_dotroot) + glist = canvas_getrootfor(x->x_glist); + else if (x->x_dotname == totps_dotowner) + { + if (glist = canvas_getrootfor(x->x_glist)) + glist = glist->gl_owner; + } + else if (x->x_dotname == totps_dottop) + { + glist = x->x_glist; + while (glist->gl_owner) glist = glist->gl_owner; + } + else + glist = x->x_glist; + return (glist); + } + + static t_symbol *tot_getcvname(t_tot *x) + { + t_glist *glist = tot_getglist(x); + t_symbol *cvname = (glist ? glist->gl_name : x->x_cvname); + if (cvname) + return (cvname); + else if (x->x_dotname) + return (x->x_dotname); + else + { + bug("tot_getcvname"); + return (gensym("???")); + } + } + static t_canvas *tot_getcanvas(t_tot *x, int complain) { t_canvas *cv = 0; ! t_glist *glist = tot_getglist(x); if (glist) cv = glist_getcanvas(glist); else if (complain) ! { ! if (x->x_dotname && *x->x_dotname->s_name) ! loud_error((t_pd *)x, "%s canvas does not exist", ! &x->x_dotname->s_name[1]); ! else ! loud_error((t_pd *)x, "bad canvas name '%s'", ! tot_getcvname(x)->s_name); ! } ! if (!x->x_warned) { x->x_warned = 1; *************** *** 259,263 **** char *bp; post("containing glist: %x", x->x_glist); ! post("destination: %s", x->x_cvname->s_name); post("pathname%s %s", (pn ? ":" : ""), (pn ? pn->s_name : "unknown")); bp = scriptlet_getbuffer(x->x_transient, &sz); --- 310,314 ---- char *bp; post("containing glist: %x", x->x_glist); ! post("destination: %s", tot_getcvname(x)->s_name); post("pathname%s %s", (pn ? ":" : ""), (pn ? pn->s_name : "unknown")); bp = scriptlet_getbuffer(x->x_transient, &sz); *************** *** 398,401 **** --- 449,454 ---- static void totspy_anything(t_totspy *ts, t_symbol *s, int ac, t_atom *av) { + if (ts->ts_cleanupclock) + return; if (s == totps_motion) { *************** *** 433,436 **** --- 486,498 ---- }
+ static void totspy_cleanuptick(t_totspy *ts) + { + if (ts->ts_target) + pd_unbind((t_pd *)ts, ts->ts_target); + if (ts->ts_cleanupclock) + clock_free(ts->ts_cleanupclock); + pd_free((t_pd *)ts); + } + static void totsink_anything(t_pd *x, t_symbol *s, int ac, t_atom *av) { *************** *** 446,451 **** scriptlet_free(x->x_transient); if (x->x_spy->ts_target) ! pd_unbind((t_pd *)x->x_spy, x->x_spy->ts_target); ! pd_free((t_pd *)x->x_spy); pd_free(x->x_guisink); } --- 508,519 ---- scriptlet_free(x->x_transient); if (x->x_spy->ts_target) ! { ! /* postpone unbinding, due to a danger of being deleted by ! a message to the canvas we spy on... */ ! x->x_spy->ts_cleanupclock = ! clock_new(x->x_spy, (t_method)totspy_cleanuptick); ! clock_delay(x->x_spy->ts_cleanupclock, 0); ! } ! else pd_free((t_pd *)x->x_spy); pd_free(x->x_guisink); } *************** *** 462,467 **** x->x_persistent = scriptlet_new((t_pd *)x, x->x_target, x->x_target, 0, x->x_glist, tot_cvhook); ! if (s1 && s1 != &s_ && strcmp(s1->s_name, ".")) { x->x_cvremote = canvas_makebindsym(x->x_cvname = s1); x->x_cvpathname = 0; --- 530,537 ---- x->x_persistent = scriptlet_new((t_pd *)x, x->x_target, x->x_target, 0, x->x_glist, tot_cvhook); ! if (s1 && s1 != &s_ && *s1->s_name != '.') { + x->x_dotname = 0; + x->x_warned = 1; x->x_cvremote = canvas_makebindsym(x->x_cvname = s1); x->x_cvpathname = 0; *************** *** 469,477 **** else { ! x->x_warned = (s1 && *s1->s_name == '.'); /* do not warn if explicit */ x->x_cvremote = 0; ! x->x_cvname = x->x_glist->gl_name; ! sprintf(buf, ".x%x.c", (int)x->x_glist); ! x->x_cvpathname = gensym(buf); } outlet_new((t_object *)x, &s_anything); --- 539,554 ---- else { ! t_glist *glist; ! x->x_dotname = (s1 && *s1->s_name == '.' ? s1 : 0); ! x->x_warned = (x->x_dotname != 0); /* do not warn if explicit */ ! x->x_cvname = 0; x->x_cvremote = 0; ! glist = tot_getglist(x); ! if (glist == x->x_glist) ! { ! sprintf(buf, ".x%x.c", (int)glist); ! x->x_cvpathname = gensym(buf); ! } ! else x->x_cvpathname = 0; } outlet_new((t_object *)x, &s_anything); *************** *** 507,510 **** --- 584,591 ---- totps_qpush = gensym("qpush"); totps_query = gensym("query"); + totps_dotparent = gensym(".parent"); + totps_dotroot = gensym(".root"); + totps_dotowner = gensym(".owner"); + totps_dottop = gensym(".top"); tot_class = class_new(gensym("tot"), (t_newmethod)tot_new,