From 31a2d9dcc2b3a519033918e180f81c4e7b9f8e7e Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Tue, 15 Mar 2005 04:56:36 +0000 Subject: new data type flext::AtomListStatic using pre-allocated space if possible fixes for OSX replaced memory-intensive STL maps by custom-made vector/map-container fix for gcc strangeness no more static assignment of symbols (problems with Metrowerks) small fix for gcc fixed bugs in SIMD code for non-power-of-2 lengths fixes for attribute editor (to deal with large dialogs) svn path=/trunk/; revision=2628 --- externals/grill/flext/source/flattr_ed.cpp | 59 ++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 16 deletions(-) (limited to 'externals/grill/flext/source/flattr_ed.cpp') diff --git a/externals/grill/flext/source/flattr_ed.cpp b/externals/grill/flext/source/flattr_ed.cpp index 16a418a3..d8883005 100644 --- a/externals/grill/flext/source/flattr_ed.cpp +++ b/externals/grill/flext/source/flattr_ed.cpp @@ -494,7 +494,7 @@ void flext_base::cb_GfxProperties(t_gobj *c, t_glist *) PrintList(argc,argv,buf,sizeof(buf)); sys_vgui("%s } {\n",buf); - AtomList la; + AtomListStatic<32> la; th->ListAttrib(la); int cnt = la.Count(); @@ -509,18 +509,20 @@ void flext_base::cb_GfxProperties(t_gobj *c, t_glist *) // get flags int sv; const AtomList *initdata; - AttrDataCont::iterator it = th->attrdata->find(sym); - if(it == th->attrdata->end()) + const AttrData *a = th->attrdata->find(sym); +// AttrDataCont::iterator it = th->attrdata->find(sym); +// if(it == th->attrdata->end()) + if(!a) sv = 0,initdata = NULL; else { - const AttrData &a = *it.data(); - if(a.IsSaved()) +// const AttrData &a = *it.data(); + if(a->IsSaved()) sv = 2; - else if(a.IsInit()) + else if(a->IsInit()) sv = 1; else sv = 0; - initdata = a.IsInitValue()?&a.GetInitValue():NULL; + initdata = a->IsInitValue()?&a->GetInitValue():NULL; } // get attribute type @@ -540,7 +542,7 @@ void flext_base::cb_GfxProperties(t_gobj *c, t_glist *) sys_vgui(const_cast(list?"%s {":"%s "),GetString(sym)); - AtomList lv; + AtomListStatic<32> lv; if(gattr) { // gettable attribute is present // Retrieve attribute value th->GetAttrib(sym,gattr,lv); @@ -561,7 +563,7 @@ void flext_base::cb_GfxProperties(t_gobj *c, t_glist *) if(pattr) { // if there is initialization data take this, otherwise take the current data - const AtomList &lp = initdata?*initdata:lv; + const AtomList &lp = initdata?*initdata:static_cast(lv); char *b = buf; *b = 0; for(int i = 0; i < lp.Count(); ++i) { @@ -702,10 +704,13 @@ bool flext_base::cb_AttrDialog(flext_base *th,int argc,const t_atom *argv) bool ret = th->SetAttrib(aname,attr,ccnt,argv+coffs); FLEXT_ASSERT(ret); - AttrDataCont::iterator it = th->attrdata->find(aname); +// AttrDataCont::iterator it = th->attrdata->find(aname); + AttrData *a = th->attrdata->find(aname); if(sv >= 1) { // if data not present create it + +/* if(it == th->attrdata->end()) { AttrDataCont::pair pair; pair.key() = aname; @@ -717,14 +722,30 @@ bool flext_base::cb_AttrDialog(flext_base *th,int argc,const t_atom *argv) a.SetSave(sv == 2); a.SetInit(true); a.SetInitValue(icnt,argv+ioffs); +*/ + if(!a) + th->attrdata->insert(aname,a = new AttrData); + + a->SetSave(sv == 2); + a->SetInit(true); + a->SetInitValue(icnt,argv+ioffs); } else { +/* if(it != th->attrdata->end()) { AttrData &a = *it.data(); // if data is present reset flags a.SetSave(false); a.SetInit(false); + // let init data as is + } +*/ + if(a) { + // if data is present reset flags + a->SetSave(false); + a->SetInit(false); + // let init data as is } } @@ -765,21 +786,26 @@ void flext_base::BinbufArgs(t_binbuf *b,t_binbuf *args,bool withname,bool transd void flext_base::BinbufAttr(t_binbuf *b,bool transdoll) { // process the attributes - AtomList la; + AtomListStatic<32> la,lv; ListAttrib(la); int i,cnt = la.Count(); for(i = 0; i < cnt; ++i) { const t_symbol *sym = GetSymbol(la[i]); - AtomList lv; const AtomList *lref = NULL; +/* AttrDataCont::iterator it = attrdata->find(sym); - if(it != attrdata->end()) { const AttrData &a = *it.data(); if(a.IsInit() && a.IsInitValue()) { lref = &a.GetInitValue(); -/* +*/ + AttrData *a = attrdata->find(sym); + if(a) { + if(a->IsInit() && a->IsInitValue()) { + lref = &a->GetInitValue(); + +#if 0 ///////////////////////////////////////////////////////////// // check for $-parameters lv = lref->Count(); for(int j = 0; j < lref->Count(); ++j) { @@ -795,9 +821,10 @@ void flext_base::BinbufAttr(t_binbuf *b,bool transdoll) } lref = &lv; -*/ +#endif ///////////////////////////////////////////////////////////// } - else if(a.IsSaved()) { +// else if(a.IsSaved()) { + else if(a->IsSaved()) { AttrItem *attr = FindAttrib(sym,true); // attribute must be gettable (so that the data can be retrieved) and puttable (so that the data can be inited) -- cgit v1.2.1