Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25620
Modified Files: Tag: desiredata desire.c desire.h Log Message: linked-list of havewindow canvases is replaced by std::map
Index: desire.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.h,v retrieving revision 1.1.2.49.2.52 retrieving revision 1.1.2.49.2.53 diff -C2 -d -r1.1.2.49.2.52 -r1.1.2.49.2.53 *** desire.h 19 Aug 2007 02:35:27 -0000 1.1.2.49.2.52 --- desire.h 19 Aug 2007 04:37:55 -0000 1.1.2.49.2.53 *************** *** 165,169 **** t_symbol *name; /* symbol bound here */ int font; /* nominal font size in points, e.g., 10 */ - t_canvas *gl_next; /* link in list of toplevels */ t_canvasenvironment *env; /* one of these per $0; env=0 for subpatches */ unsigned int havewindow:1; /* this indicates whether we publish to the manager */ --- 165,168 ----
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.217.2.228 retrieving revision 1.1.2.217.2.229 diff -C2 -d -r1.1.2.217.2.228 -r1.1.2.217.2.229 *** desire.c 19 Aug 2007 02:35:24 -0000 1.1.2.217.2.228 --- desire.c 19 Aug 2007 04:37:52 -0000 1.1.2.217.2.229 *************** *** 43,49 **** */
#define boxes_each(CHILD,BOXES) for(t_gobj *CHILD=(BOXES)->first(); CHILD; CHILD=CHILD->next()) #define canvas_each(CHILD,CANVAS) for(t_gobj *CHILD=(CANVAS)->boxes->first(); CHILD; CHILD=CHILD->next()) - #define canvases_each(CANVAS) for(t_canvas *CANVAS=canvas_list; CANVAS; CANVAS=CANVAS->gl_next) #define canvas_wires_each(WIRE,TRAV,CANVAS) \ for (t_outconnect *WIRE=(t_outconnect *)666; WIRE==(t_outconnect *)666; ) \ --- 43,50 ---- */
+ #define foreach(ITER,COLL) for(typeof(COLL.begin()) ITER = COLL.begin(); ITER != (COLL).end(); ITER++) + #define boxes_each(CHILD,BOXES) for(t_gobj *CHILD=(BOXES)->first(); CHILD; CHILD=CHILD->next()) #define canvas_each(CHILD,CANVAS) for(t_gobj *CHILD=(CANVAS)->boxes->first(); CHILD; CHILD=CHILD->next()) #define canvas_wires_each(WIRE,TRAV,CANVAS) \ for (t_outconnect *WIRE=(t_outconnect *)666; WIRE==(t_outconnect *)666; ) \ *************** *** 417,421 **** int canvas_dspstate; /* whether DSP is on or off */ t_canvas *canvas_whichfind; /* last canvas we did a find in */ ! t_canvas *canvas_list; /* list of all root canvases */ static void canvas_setbounds(t_canvas *x, t_floatarg x1, t_floatarg y1, t_floatarg x2, t_floatarg y2); static t_symbol *canvas_newfilename = &s_; --- 418,422 ---- int canvas_dspstate; /* whether DSP is on or off */ t_canvas *canvas_whichfind; /* last canvas we did a find in */ ! std::map<t_canvas *,int> windowed_canvases; /* where int is dummy */ static void canvas_setbounds(t_canvas *x, t_floatarg x1, t_floatarg y1, t_floatarg x2, t_floatarg y2); static t_symbol *canvas_newfilename = &s_; *************** *** 425,442 ****
/* add a canvas 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->havewindow) gobj_subscribe(x,manager); } ! ! static void canvas_takeofflist(t_canvas *x) { ! if (x == canvas_list) canvas_list = x->gl_next; ! else { ! t_canvas *z; ! for (z = canvas_list; z->gl_next != x; z = z->gl_next) {} ! z->gl_next = x->gl_next; ! } ! }
/* if there's an old one lying around free it here. --- 426,435 ----
/* add a canvas the list of "root" canvases (toplevels without parents.) */ + /* should those two functions still exist? */ static void canvas_addtolist(t_canvas *x) { ! windowed_canvases.insert(std::pair<t_canvas *,int>(x,42)); if (x->havewindow) gobj_subscribe(x,manager); } ! static void canvas_takeofflist(t_canvas *x) {windowed_canvases.erase(x);}
/* if there's an old one lying around free it here. *************** *** 938,942 **** ugen_start(); //timeval v0,v1; gettimeofday(&v0,0); ! canvases_each(x) canvas_dodsp(x,1,0); //gettimeofday(&v1,0); printf("canvas_start_dsp took %ld us\n",(v1.tv_sec-v0.tv_sec)*1000000+(v1.tv_usec-v0.tv_usec)); canvas_dspstate = 1; --- 931,935 ---- ugen_start(); //timeval v0,v1; gettimeofday(&v0,0); ! foreach(x,windowed_canvases) canvas_dodsp(x->first,1,0); //gettimeofday(&v1,0); printf("canvas_start_dsp took %ld us\n",(v1.tv_sec-v0.tv_sec)*1000000+(v1.tv_usec-v0.tv_usec)); canvas_dspstate = 1; *************** *** 1094,1098 ****
void canvas_reload(t_symbol *name, t_symbol *dir, t_gobj *except) { ! canvases_each(x) canvas_doreload(x, name, dir, except); }
--- 1087,1091 ----
void canvas_reload(t_symbol *name, t_symbol *dir, t_gobj *except) { ! foreach(x,windowed_canvases) canvas_doreload(x->first, name, dir, except); }
*************** *** 1178,1182 ****
void canvas_finderror(void *error_object) { ! canvases_each(x) if (canvas_dofinderror(x, error_object)) return; post("... sorry, I couldn't find the source of that error."); } --- 1171,1175 ----
void canvas_finderror(void *error_object) { ! foreach(x,windowed_canvases) if (canvas_dofinderror(x->first, error_object)) return; post("... sorry, I couldn't find the source of that error."); } *************** *** 3657,3661 **** post("conforming template '%s' to new structure", tfrom->sym->name); for (int i=0; i<nto; i++) post("... %d", conformaction[i]); ! canvases_each(gl) template_conformcanvas(tfrom, tto, conformaction, gl); } free(conformaction); --- 3650,3654 ---- post("conforming template '%s' to new structure", tfrom->sym->name); for (int i=0; i<nto; i++) post("... %d", conformaction[i]); ! foreach(gl,windowed_canvases) template_conformcanvas(tfrom, tto, conformaction, gl->first); } free(conformaction); *************** *** 7325,7333 **** /* properly close all open root canvases */ extern "C" void glob_closeall(void *dummy, t_floatarg fforce) { ! t_canvas *y; ! for (t_canvas *x = canvas_list; x; x=y) { ! y = x->gl_next; ! canvas_close(x); /* forced closing of this root canvas */ ! } }
--- 7318,7322 ---- /* properly close all open root canvases */ extern "C" void glob_closeall(void *dummy, t_floatarg fforce) { ! foreach(x,windowed_canvases) canvas_close(x->first); }