Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18440
Modified Files: Tag: desiredata desire.c Log Message: g_next is dead
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.217.2.226 retrieving revision 1.1.2.217.2.227 diff -C2 -d -r1.1.2.217.2.226 -r1.1.2.217.2.227 *** desire.c 18 Aug 2007 07:05:19 -0000 1.1.2.217.2.226 --- desire.c 19 Aug 2007 01:17:17 -0000 1.1.2.217.2.227 *************** *** 83,91 **** typedef std::pair<int,t_gobj *> KV; private: - t_gobj *list; std::map<int,t_gobj *> map; public: void invariant () {size();} ! t_boxes() : list(0) {} size_t size() { size_t n=0; --- 83,90 ---- typedef std::pair<int,t_gobj *> KV; private: std::map<int,t_gobj *> map; public: void invariant () {size();} ! t_boxes() {} size_t size() { size_t n=0; *************** *** 94,141 **** return n; } ! t_gobj *first() { ! if (list) { ! t_gobj *liste = map.begin()->second; ! if (list != liste) post("list first=%p map begin=%p",list,liste); ! } ! return list; ! } ! t_gobj *last() { ! t_gobj *r = first(); ! if (!r) return 0; ! while (r->next()) r=r->next(); ! M::iterator iter = map.end(); ! iter--; ! t_gobj *lasse = iter->second; ! if (r != lasse) post("list last=%p, map last=%p",r,lasse); ! return r; ! } t_gobj *next(t_gobj *x) { M::iterator iter = map.begin(); while (iter->second != x) iter++; iter++; ! if (iter->second != x->g_next) post("list next=%p, map next=%p",iter->second,x->g_next); ! return x->g_next; ! } ! void add(t_gobj *x) { /* the key is x->index, the value is x */ ! post("t_boxes add %lx",x->dix->index); ! t_gobj *r = last(); ! if (r) r->g_next = x; else list = x; ! x->g_next = 0; ! map.insert(KV(x->dix->index,x)); ! invariant(); ! } ! void remove(int i) { ! map.erase(i); ! if (list->dix->index == i) list = list->next(); ! else boxes_each(g,this) if (g->next()->dix->index == i) {g->g_next = g->next()->next(); break;} ! invariant(); ! } ! void remove_by_value(t_gobj *x) { ! map.erase(x->dix->index); ! if (list == x) list = list->next(); ! else boxes_each(g,this) if (g->next() == x) {g->g_next = g->next()->next(); break;} ! invariant(); } };
--- 93,107 ---- return n; } ! t_gobj *first() {return map.begin() != map.end() ? map.begin()->second : 0;} ! t_gobj *last() {M::iterator iter = map.end(); iter--; return iter->second;} t_gobj *next(t_gobj *x) { M::iterator iter = map.begin(); while (iter->second != x) iter++; iter++; ! return iter->second; } + void add(t_gobj *x) {map.insert(KV(x->dix->index,x)); invariant();} + void remove(int i) {map.erase(i); invariant();} + void remove_by_value(t_gobj *x) {map.erase(x->dix->index); invariant();} };
*************** *** 143,152 **** t_boxes *self = (t_boxes *)pd_new(boxes_class); new(self) t_boxes; ! L return self; }
void boxes_free(t_boxes *self) {self->~t_boxes();}
! t_gobj *_gobj::next() {return this->g_next;}
//-------------------------------------------------------------------------- --- 109,118 ---- t_boxes *self = (t_boxes *)pd_new(boxes_class); new(self) t_boxes; ! return self; }
void boxes_free(t_boxes *self) {self->~t_boxes();}
! t_gobj *_gobj::next() {return dix->canvas->boxes->next(this);}
//-------------------------------------------------------------------------- *************** *** 159,163 **** //fprintf(stderr,"appendix_new %p\n",master); t_appendix *self = (t_appendix *)malloc(sizeof(t_appendix)); - self->next = 0; self->canvas = 0; self->nobs = 0; --- 125,128 ----