Update of /cvsroot/pure-data/externals/grill/pool/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27423/source
Modified Files: data.cpp main.cpp pool.cpp pool.h Log Message: added saving/loading of spaces and other special characters (escaping) use AtomListStatic where feasible better method for discriminating numbers and symbols - by Frank Barknecht
Index: data.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/pool/source/data.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** data.cpp 4 Jan 2005 05:00:38 -0000 1.5 --- data.cpp 7 Jun 2005 14:14:50 -0000 1.6 *************** *** 33,37 **** const A pooldata::nullatom = { A_NULL };
! I pooldata::GetAll(const AtomList &d,A *&keys,AtomList *&lst) { pooldir *pd = root.GetDir(d); --- 33,37 ---- const A pooldata::nullatom = { A_NULL };
! I pooldata::GetAll(const AtomList &d,A *&keys,Atoms *&lst) { pooldir *pd = root.GetDir(d); *************** *** 144,148 **** if(t) { ofstream file(t); ! AtomList tmp; if(absdir) tmp = d; return file.good() && pd->SvDir(file,depth,tmp); --- 144,148 ---- if(t) { ofstream file(t); ! Atoms tmp; if(absdir) tmp = d; return file.good() && pd->SvDir(file,depth,tmp); *************** *** 191,195 **** if(t) { ofstream file(t); ! AtomList tmp; if(absdir) tmp = d; if(file.good()) { --- 191,195 ---- if(t) { ofstream file(t); ! Atoms tmp; if(absdir) tmp = d; if(file.good()) {
Index: main.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/pool/source/main.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** main.cpp 25 Mar 2005 04:53:43 -0000 1.9 --- main.cpp 7 Jun 2005 14:14:50 -0000 1.10 *************** *** 142,146 **** I vcnt,dcnt; pooldata *pl; ! AtomList curdir; pooldir *clip; const S *holdname; --- 142,146 ---- I vcnt,dcnt; pooldata *pl; ! Atoms curdir; pooldir *clip; const S *holdname; *************** *** 391,394 **** --- 391,395 ---- V pool::m_reset() { + curdir(); pl->Reset(); } *************** *** 409,413 **** post("%s - %s: invalid directory name",thisName(),GetString(thisTag())); else { ! AtomList ndir; if(abs) ndir(argc,argv); else (ndir = curdir).Append(argc,argv); --- 410,414 ---- post("%s - %s: invalid directory name",thisName(),GetString(thisTag())); else { ! Atoms ndir; if(abs) ndir(argc,argv); else (ndir = curdir).Append(argc,argv); *************** *** 428,432 **** post("%s - %s: invalid directory name",thisName(),GetString(thisTag())); else { ! AtomList prv(curdir); if(abs) curdir(argc,argv); else curdir.Append(argc,argv); --- 429,433 ---- post("%s - %s: invalid directory name",thisName(),GetString(thisTag())); else { ! Atoms prv(curdir); if(abs) curdir(argc,argv); else curdir.Append(argc,argv); *************** *** 455,459 **** }
! AtomList prv(curdir);
if(lvls > curdir.Count()) { --- 456,460 ---- }
! Atoms prv(curdir);
if(lvls > curdir.Count()) { *************** *** 506,510 **** } else ! if(!pl->Seti(curdir,GetAInt(argv[0]),new AtomList(argc-1,argv+1))) post("%s - %s: value couldn't be set",thisName(),GetString(thisTag()));
--- 507,511 ---- } else ! if(!pl->Seti(curdir,GetAInt(argv[0]),new Atoms(argc-1,argv+1))) post("%s - %s: value couldn't be set",thisName(),GetString(thisTag()));
*************** *** 618,622 **** I pool::getrec(const t_symbol *tag,I level,BL order,get_t how,const AtomList &rdir) { ! AtomList gldir(curdir); gldir.Append(rdir);
--- 619,623 ---- I pool::getrec(const t_symbol *tag,I level,BL order,get_t how,const AtomList &rdir) { ! Atoms gldir(curdir); gldir.Append(rdir);
*************** *** 632,636 **** case get_norm: { A *k; ! AtomList *r; I cnt = pl->GetAll(gldir,k,r); if(!k) --- 633,637 ---- case get_norm: { A *k; ! Atoms *r; I cnt = pl->GetAll(gldir,k,r); if(!k) *************** *** 658,662 **** I lv = level > 0?level-1:-1; for(I i = 0; i < cnt; ++i) { ! ret += getrec(tag,lv,order,how,AtomList(rdir).Append(*r[i])); } delete[] r; --- 659,663 ---- I lv = level > 0?level-1:-1; for(I i = 0; i < cnt; ++i) { ! ret += getrec(tag,lv,order,how,Atoms(rdir).Append(*r[i])); } delete[] r; *************** *** 723,727 **** I pool::getsub(const S *tag,I level,BL order,get_t how,const AtomList &rdir) { ! AtomList gldir(curdir); gldir.Append(rdir); --- 724,728 ---- I pool::getsub(const S *tag,I level,BL order,get_t how,const AtomList &rdir) { ! Atoms gldir(curdir); gldir.Append(rdir); *************** *** 736,740 **** I lv = level > 0?level-1:-1; for(I i = 0; i < cnt; ++i) { ! AtomList ndir(absdir?gldir:rdir); ndir.Append(*r[i]); ++ret; --- 737,741 ---- I lv = level > 0?level-1:-1; for(I i = 0; i < cnt; ++i) { ! Atoms ndir(absdir?gldir:rdir); ndir.Append(*r[i]); ++ret; *************** *** 748,752 ****
if(level != 0) ! ret += getsub(tag,lv,order,how,AtomList(rdir).Append(*r[i])); } delete[] r; --- 749,753 ----
if(level != 0) ! ret += getsub(tag,lv,order,how,Atoms(rdir).Append(*r[i])); } delete[] r; *************** *** 873,877 **** }
! AtomList svdir(curdir); if(fromroot) curdir.Clear();
--- 874,878 ---- }
! Atoms svdir(curdir); if(fromroot) curdir.Clear();
Index: pool.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/pool/source/pool.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** pool.cpp 19 Apr 2005 20:55:56 -0000 1.17 --- pool.cpp 7 Jun 2005 14:14:51 -0000 1.18 *************** *** 79,83 **** poolval *poolval::Dup() const { ! return new poolval(key,data?new AtomList(*data):NULL); }
--- 79,83 ---- poolval *poolval::Dup() const { ! return new poolval(key,data?new Atoms(*data):NULL); }
*************** *** 315,319 **** } else ! ret = new AtomList(*ix->data); return ret; } --- 315,319 ---- } else ! ret = new Atoms(*ix->data); return ret; } *************** *** 362,370 **** }
! I pooldir::GetAll(A *&keys,AtomList *&lst,BL cut) { I cnt = CntAll(); keys = new A[cnt]; ! lst = new AtomList[cnt];
for(I i = 0,vix = 0; vix < vsize; ++vix) { --- 362,370 ---- }
! I pooldir::GetAll(A *&keys,Atoms *&lst,BL cut) { I cnt = CntAll(); keys = new A[cnt]; ! lst = new Atoms[cnt];
for(I i = 0,vix = 0; vix < vsize; ++vix) { *************** *** 414,418 **** for(I vi = 0; vi < p->vsize; ++vi) { for(poolval *ix = p->vals[vi].v; ix; ix = ix->nxt) { ! SetVal(ix->key,new AtomList(*ix->data),repl); } } --- 414,418 ---- for(I vi = 0; vi < p->vsize; ++vi) { for(poolval *ix = p->vals[vi].v; ix; ix = ix->nxt) { ! SetVal(ix->key,new Atoms(*ix->data),repl); } } *************** *** 447,451 **** for(I vi = 0; vi < vsize; ++vi) { for(poolval *ix = vals[vi].v; ix; ix = ix->nxt) { ! p->SetVal(ix->key,new AtomList(*ix->data)); } } --- 447,451 ---- for(I vi = 0; vi < vsize; ++vi) { for(poolval *ix = vals[vi].v; ix; ix = ix->nxt) { ! p->SetVal(ix->key,new Atoms(*ix->data)); } } *************** *** 603,607 **** { for(I i = 1; !is.eof(); ++i) { ! AtomList d,k,*v = new AtomList; BL r = ReadAtoms(is,d,',') && --- 603,607 ---- { for(I i = 1; !is.eof(); ++i) { ! Atoms d,k,*v = new Atoms; BL r = ReadAtoms(is,d,',') && *************** *** 657,661 **** for(I di = 0; di < dsize; ++di) { for(pooldir *ix = dirs[di].d; ix; ix = ix->nxt) { ! ix->SvDir(os,nd,AtomList(dir).Append(ix->dir)); } } --- 657,661 ---- for(I di = 0; di < dsize; ++di) { for(pooldir *ix = dirs[di].d; ix; ix = ix->nxt) { ! ix->SvDir(os,nd,Atoms(dir).Append(ix->dir)); } } *************** *** 784,788 **** BL pooldir::LdDirXMLRec(istream &is,I depth,BL mkdir,AtomList &d) { ! AtomList k,v; bool inval = false,inkey = false,indata = false; int cntval = 0; --- 784,788 ---- BL pooldir::LdDirXMLRec(istream &is,I depth,BL mkdir,AtomList &d) { ! Atoms k,v; bool inval = false,inkey = false,indata = false; int cntval = 0; *************** *** 837,841 **** post("pool - XML load: dir key must be given prior to subdirs, ignoring items");
! AtomList dnext(d.Count()+1); // copy existing dir dnext.Set(d.Count(),d.Atoms(),0,false); --- 837,841 ---- post("pool - XML load: dir key must be given prior to subdirs, ignoring items");
! Atoms dnext(d.Count()+1); // copy existing dir dnext.Set(d.Count(),d.Atoms(),0,false); *************** *** 881,885 **** pooldir *nd = mkdir?AddDir(d):GetDir(d); if(nd) ! nd->SetVal(k[0],new AtomList(v)); else post("pool - XML load: value key must be exactly one word, value not stored"); --- 881,885 ---- pooldir *nd = mkdir?AddDir(d):GetDir(d); if(nd) ! nd->SetVal(k[0],new Atoms(v)); else post("pool - XML load: value key must be exactly one word, value not stored"); *************** *** 930,934 **** if(tag == "pool") { if(tag.type == xmltag::t_start) { ! AtomList empty; // must be a separate definition for gcc LdDirXMLRec(is,depth,mkdir,empty); } --- 930,934 ---- if(tag == "pool") { if(tag.type == xmltag::t_start) { ! Atoms empty; // must be a separate definition for gcc LdDirXMLRec(is,depth,mkdir,empty); } *************** *** 981,985 **** for(I di = 0; di < dsize; ++di) { for(pooldir *ix = dirs[di].d; ix; ix = ix->nxt) { ! ix->SvDirXML(os,nd,AtomList(dir).Append(ix->dir),ind+lvls); } } --- 981,985 ---- for(I di = 0; di < dsize; ++di) { for(pooldir *ix = dirs[di].d; ix; ix = ix->nxt) { ! ix->SvDirXML(os,nd,Atoms(dir).Append(ix->dir),ind+lvls); } }
Index: pool.h =================================================================== RCS file: /cvsroot/pure-data/externals/grill/pool/source/pool.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pool.h 4 Jan 2005 05:00:39 -0000 1.8 --- pool.h 7 Jun 2005 14:14:51 -0000 1.9 *************** *** 16,21 **** #include <flext.h>
! #if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406) ! #error You need at least flext version 0.4.6 #endif
--- 16,21 ---- #include <flext.h>
! #if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 500) ! #error You need at least flext version 0.5.0 #endif
*************** *** 33,36 **** --- 33,38 ---- typedef t_symbol S;
+ typedef flext::AtomListStatic<8> Atoms; + class poolval: public flext *************** *** 76,80 **** AtomList *GetVal(const A &key,BL cut = false); I CntAll() const; ! I GetAll(A *&keys,AtomList *&lst,BL cut = false); I PrintAll(char *buf,int len) const; I GetKeys(AtomList &keys); --- 78,82 ---- AtomList *GetVal(const A &key,BL cut = false); I CntAll() const; ! I GetAll(A *&keys,Atoms *&lst,BL cut = false); I PrintAll(char *buf,int len) const; I GetKeys(AtomList &keys); *************** *** 219,223 ****
I PrintAll(const AtomList &d); ! I GetAll(const AtomList &d,A *&keys,AtomList *&lst);
I CntSub(const AtomList &d) --- 221,225 ----
I PrintAll(const AtomList &d); ! I GetAll(const AtomList &d,A *&keys,Atoms *&lst);
I CntSub(const AtomList &d)