From 97926eb08cf74f277e522ffb8c7f985457822de3 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Tue, 11 Feb 2003 04:37:35 +0000 Subject: "" svn path=/trunk/; revision=388 --- externals/grill/pool/data.cpp | 77 ++++++++++- externals/grill/pool/main.cpp | 225 +++++++++++++++++++++++--------- externals/grill/pool/pool.cpp | 280 ++++++++++++++++++++++++++++------------ externals/grill/pool/pool.cw | Bin 202236 -> 202236 bytes externals/grill/pool/pool.dsp | 4 + externals/grill/pool/pool.dtd | 5 + externals/grill/pool/pool.h | 44 +++++-- externals/grill/pool/pool.help | Bin 5952 -> 6174 bytes externals/grill/pool/pool.pd | 146 ++++++++++++--------- externals/grill/pool/readme.txt | 8 +- 10 files changed, 570 insertions(+), 219 deletions(-) create mode 100644 externals/grill/pool/pool.dtd (limited to 'externals/grill/pool') diff --git a/externals/grill/pool/data.cpp b/externals/grill/pool/data.cpp index 4984129b..8d5d41c4 100644 --- a/externals/grill/pool/data.cpp +++ b/externals/grill/pool/data.cpp @@ -16,9 +16,9 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include -pooldata::pooldata(const S *s): +pooldata::pooldata(const S *s,I vcnt,I dcnt): sym(s),nxt(NULL),refs(0), - root(nullatom,NULL) + root(nullatom,NULL,vcnt,dcnt) { LOG1("new pool %s",sym?flext_base::GetString(sym):""); } @@ -28,17 +28,18 @@ pooldata::~pooldata() LOG1("free pool %s",sym?flext_base::GetString(sym):""); } + const A pooldata::nullatom = { A_NULL }; V pooldata::Reset() { - root.Clear(true); + root.Reset(); } -BL pooldata::MkDir(const AtomList &d) +BL pooldata::MkDir(const AtomList &d,I vcnt,I dcnt) { - root.AddDir(d); + root.AddDir(d,vcnt,dcnt); return true; } @@ -117,6 +118,12 @@ I pooldata::GetAll(const AtomList &d,A *&keys,AtomList *&lst) } } +I pooldata::CntSub(const AtomList &d) +{ + pooldir *pd = root.GetDir(d); + return pd?pd->CntSub():0; +} + I pooldata::GetSub(const AtomList &d,const t_atom **&dirs) { pooldir *pd = root.GetDir(d); @@ -144,7 +151,7 @@ pooldir *pooldata::Copy(const AtomList &d,const A &key,BL cut) if(pd) { AtomList *val = pd->GetVal(key,cut); if(val) { - pooldir *ret = new pooldir(nullatom,NULL); + pooldir *ret = new pooldir(nullatom,NULL,pd->VSize(),pd->DSize()); ret->SetVal(key,val); return ret; } @@ -159,7 +166,8 @@ pooldir *pooldata::CopyAll(const AtomList &d,I depth,BL cut) { pooldir *pd = root.GetDir(d); if(pd) { - pooldir *ret = new pooldir(nullatom,NULL); + // What sizes should we choose here? + pooldir *ret = new pooldir(nullatom,NULL,pd->VSize(),pd->DSize()); if(pd->Copy(ret,depth,cut)) return ret; else { @@ -220,4 +228,59 @@ BL pooldata::SvDir(const AtomList &d,const C *flnm,I depth,BL absdir) return false; } +BL pooldata::LdDirXML(const AtomList &d,const C *flnm,I depth,BL mkdir) +{ + pooldir *pd = root.GetDir(d); + if(pd) { + C tmp[1024]; + const C *t = CnvFlnm(tmp,flnm,sizeof tmp); + if(t) { + ifstream fl(t); + BL ret = fl.good() != 0; + if(ret) { + fl.getline(tmp,sizeof tmp); + ret = !strncmp(tmp,"",6); + } + if(ret) + ret = pd->LdDirXML(fl,depth,mkdir); + return ret; + } + else return false; + } + else + return false; +} + +BL pooldata::SvDirXML(const AtomList &d,const C *flnm,I depth,BL absdir) +{ + pooldir *pd = root.GetDir(d); + if(pd) { + C tmp[1024]; + const C *t = CnvFlnm(tmp,flnm,sizeof tmp); + if(t) { + ofstream fl(t); + AtomList tmp; + if(absdir) tmp = d; + if(fl.good()) { + fl << "" << endl; + fl << "" << endl; + fl << "" << endl; + BL ret = pd->SvDirXML(fl,depth,tmp); + fl << "" << endl; + return ret; + } + } + else return false; + } + else + return false; +} + diff --git a/externals/grill/pool/main.cpp b/externals/grill/pool/main.cpp index cf513d87..4397a55b 100644 --- a/externals/grill/pool/main.cpp +++ b/externals/grill/pool/main.cpp @@ -10,7 +10,10 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include "pool.h" -#define POOL_VERSION "0.1.1pre" +#define POOL_VERSION "0.2.0pre" + +#define VCNT 64 +#define DCNT 16 class pool: public flext_base @@ -22,6 +25,8 @@ public: ~pool(); static V setup(t_classid); + + virtual BL Init(); pooldata *Pool() { return pl; } @@ -58,6 +63,9 @@ protected: V m_getall(); // only values V m_getrec(I argc,const A *argv); // also subdirectories V m_getsub(I argc,const A *argv); // only subdirectories + V m_ogetall(); // only values (ordered) + V m_ogetrec(I argc,const A *argv); // also subdirectories (ordered) + V m_ogetsub(I argc,const A *argv); // only subdirectories (ordered) V m_cntall(); // only values V m_cntrec(I argc,const A *argv); // also subdirectories V m_cntsub(I argc,const A *argv); // only subdirectories @@ -74,16 +82,22 @@ protected: V m_copyrec(I argc,const A *argv) { copyrec(MakeSymbol("copyrec"),argc,argv,false); } // cut directory (and subdirs) into clipboard // load/save from/to file - V m_load(I argc,const A *argv); - V m_save(I argc,const A *argv); + V m_load(I argc,const A *argv) { load(argc,argv,false); } + V m_save(I argc,const A *argv) { save(argc,argv,false); } + V m_loadx(I argc,const A *argv) { load(argc,argv,true); } // XML + V m_savex(I argc,const A *argv) { save(argc,argv,true); } // XML // load directories - V m_lddir(I argc,const A *argv); // load values into current dir - V m_ldrec(I argc,const A *argv); // load values recursively + V m_lddir(I argc,const A *argv) { lddir(argc,argv,false); } // load values into current dir + V m_ldrec(I argc,const A *argv) { ldrec(argc,argv,false); } // load values recursively + V m_ldxdir(I argc,const A *argv) { lddir(argc,argv,true); } // load values into current dir (XML) + V m_ldxrec(I argc,const A *argv) { ldrec(argc,argv,true); } // load values recursively (XML) // save directories - V m_svdir(I argc,const A *argv); // save values in current dir - V m_svrec(I argc,const A *argv); // save values recursively + V m_svdir(I argc,const A *argv) { svdir(argc,argv,false); } // save values in current dir + V m_svrec(I argc,const A *argv) { svrec(argc,argv,false); } // save values recursively + V m_svxdir(I argc,const A *argv) { svdir(argc,argv,true); } // save values in current dir (XML) + V m_svxrec(I argc,const A *argv) { svrec(argc,argv,true); } // save values recursively (XML) private: static BL KeyChk(const A &a); @@ -93,20 +107,29 @@ private: V set(const S *tag,I argc,const A *argv,BL over); V getdir(const S *tag); - I getrec(const S *tag,I level,BL cntonly = false,const AtomList &rdir = AtomList()); - I getsub(const S *tag,I level,BL cntonly = false,const AtomList &rdir = AtomList()); + I getrec(const S *tag,I level,BL order,BL cntonly = false,const AtomList &rdir = AtomList()); + I getsub(const S *tag,I level,BL order,BL cntonly = false,const AtomList &rdir = AtomList()); V paste(const S *tag,I argc,const A *argv,BL repl); V copy(const S *tag,I argc,const A *argv,BL cut); V copyall(const S *tag,BL cut,I lvls); V copyrec(const S *tag,I argc,const A *argv,BL cut); + V load(I argc,const A *argv,BL xml); + V save(I argc,const A *argv,BL xml); + V lddir(I argc,const A *argv,BL xml); // load values into current dir + V ldrec(I argc,const A *argv,BL xml); // load values recursively + V svdir(I argc,const A *argv,BL xml); // save values in current dir + V svrec(I argc,const A *argv,BL xml); // save values recursively + V echodir() { if(echo) getdir(MakeSymbol("echo")); } BL priv,absdir,echo; + I vcnt,dcnt; pooldata *pl; AtomList curdir; pooldir *clip; + const S *holdname; static pooldata *head,*tail; @@ -121,6 +144,8 @@ private: FLEXT_ATTRVAR_B(echo) FLEXT_ATTRGET_B(priv) // FLEXT_ATTRGET_B(curdir) + FLEXT_ATTRVAR_I(vcnt) + FLEXT_ATTRVAR_I(dcnt) FLEXT_CALLBACK(m_reset) @@ -144,6 +169,9 @@ private: FLEXT_CALLBACK(m_getall) FLEXT_CALLBACK_V(m_getrec) FLEXT_CALLBACK_V(m_getsub) + FLEXT_CALLBACK(m_ogetall) + FLEXT_CALLBACK_V(m_ogetrec) + FLEXT_CALLBACK_V(m_ogetsub) FLEXT_CALLBACK(m_cntall) FLEXT_CALLBACK_V(m_cntrec) FLEXT_CALLBACK_V(m_cntsub) @@ -164,6 +192,12 @@ private: FLEXT_CALLBACK_V(m_ldrec) FLEXT_CALLBACK_V(m_svdir) FLEXT_CALLBACK_V(m_svrec) + FLEXT_CALLBACK_V(m_loadx) + FLEXT_CALLBACK_V(m_savex) + FLEXT_CALLBACK_V(m_ldxdir) + FLEXT_CALLBACK_V(m_ldxrec) + FLEXT_CALLBACK_V(m_svxdir) + FLEXT_CALLBACK_V(m_svxrec) }; FLEXT_NEW_V("pool",pool); @@ -175,7 +209,7 @@ pooldata *pool::head,*pool::tail; V pool::setup(t_classid c) { post(""); - post("pool %s - hierarchical storage object, (C)2002 Thomas Grill",POOL_VERSION); + post("pool %s - hierarchical storage object,(C)2002-2003 Thomas Grill",POOL_VERSION); post(""); head = tail = NULL; @@ -184,6 +218,8 @@ V pool::setup(t_classid c) FLEXT_CADDATTR_VAR1(c,"absdir",absdir); FLEXT_CADDATTR_VAR1(c,"echodir",echo); FLEXT_CADDATTR_GET(c,"private",priv); + FLEXT_CADDATTR_VAR1(c,"valcnt",vcnt); + FLEXT_CADDATTR_VAR1(c,"dircnt",dcnt); FLEXT_CADDMETHOD_(c,0,"reset",m_reset); FLEXT_CADDMETHOD_(c,0,"set",m_set); @@ -207,6 +243,9 @@ V pool::setup(t_classid c) FLEXT_CADDMETHOD_(c,0,"getall",m_getall); FLEXT_CADDMETHOD_(c,0,"getrec",m_getrec); FLEXT_CADDMETHOD_(c,0,"getsub",m_getsub); + FLEXT_CADDMETHOD_(c,0,"ogetall",m_ogetall); + FLEXT_CADDMETHOD_(c,0,"ogetrec",m_ogetrec); + FLEXT_CADDMETHOD_(c,0,"ogetsub",m_ogetsub); FLEXT_CADDMETHOD_(c,0,"cntall",m_cntall); FLEXT_CADDMETHOD_(c,0,"cntrec",m_cntrec); FLEXT_CADDMETHOD_(c,0,"cntsub",m_cntsub); @@ -227,13 +266,20 @@ V pool::setup(t_classid c) FLEXT_CADDMETHOD_(c,0,"ldrec",m_ldrec); FLEXT_CADDMETHOD_(c,0,"svdir",m_svdir); FLEXT_CADDMETHOD_(c,0,"svrec",m_svrec); + FLEXT_CADDMETHOD_(c,0,"loadx",m_loadx); + FLEXT_CADDMETHOD_(c,0,"savex",m_savex); + FLEXT_CADDMETHOD_(c,0,"ldxdir",m_ldxdir); + FLEXT_CADDMETHOD_(c,0,"ldxrec",m_ldxrec); + FLEXT_CADDMETHOD_(c,0,"svxdir",m_svxdir); + FLEXT_CADDMETHOD_(c,0,"svxrec",m_svxrec); } pool::pool(I argc,const A *argv): absdir(true),echo(false),pl(NULL), - clip(NULL) + clip(NULL), + vcnt(VCNT),dcnt(DCNT) { - SetPool(argc >= 1 && IsSymbol(argv[0])?GetSymbol(argv[0]):NULL); + holdname = argc >= 1 && IsSymbol(argv[0])?GetSymbol(argv[0]):NULL; AddInAnything(); AddOutList(); @@ -247,6 +293,15 @@ pool::~pool() FreePool(); } +BL pool::Init() +{ + if(flext_base::Init()) { + SetPool(holdname); + return true; + } + else return false; +} + V pool::SetPool(const S *s) { if(pl) FreePool(); @@ -257,7 +312,7 @@ V pool::SetPool(const S *s) } else { priv = true; - pl = new pooldata; + pl = new pooldata(NULL,vcnt,dcnt); } } @@ -316,7 +371,7 @@ V pool::m_mkdir(I argc,const A *argv,BL abs) AtomList ndir; if(abs) ndir(argc,argv); else (ndir = curdir).Append(argc,argv); - if(!pl->MkDir(ndir)) { + if(!pl->MkDir(ndir,vcnt,dcnt)) { post("%s - mkdir: directory couldn't be created",thisName()); } } @@ -491,7 +546,7 @@ V pool::m_geti(I ix) echodir(); } -I pool::getrec(const S *tag,I level,BL cntonly,const AtomList &rdir) +I pool::getrec(const S *tag,I level,BL order,BL cntonly,const AtomList &rdir) { AtomList gldir(curdir); gldir.Append(rdir); @@ -527,7 +582,7 @@ I pool::getrec(const S *tag,I level,BL cntonly,const AtomList &rdir) else { I lv = level > 0?level-1:-1; for(I i = 0; i < cnt; ++i) { - ret += getrec(tag,lv,cntonly,AtomList(rdir).Append(*r[i])); + ret += getrec(tag,lv,order,cntonly,AtomList(rdir).Append(*r[i])); } delete[] r; } @@ -538,7 +593,15 @@ I pool::getrec(const S *tag,I level,BL cntonly,const AtomList &rdir) V pool::m_getall() { - getrec(MakeSymbol("getall"),0); + getrec(MakeSymbol("getall"),0,false); + ToOutBang(3); + + echodir(); +} + +V pool::m_ogetall() +{ + getrec(MakeSymbol("ogetall"),0,true); ToOutBang(3); echodir(); @@ -556,21 +619,41 @@ V pool::m_getrec(I argc,const A *argv) else post("%s - getrec: invalid level specification - set to infinite",thisName()); } - getrec(MakeSymbol("getrec"),lvls); + getrec(MakeSymbol("getrec"),lvls,false); + ToOutBang(3); + + echodir(); +} + + +V pool::m_ogetrec(I argc,const A *argv) +{ + I lvls = -1; + if(argc > 0) { + if(CanbeInt(argv[0])) { + if(argc > 1) + post("%s - ogetrec: superfluous arguments ignored",thisName()); + lvls = GetAInt(argv[0]); + } + else + post("%s - ogetrec: invalid level specification - set to infinite",thisName()); + } + getrec(MakeSymbol("ogetrec"),lvls,true); ToOutBang(3); echodir(); } -I pool::getsub(const S *tag,I level,BL cntonly,const AtomList &rdir) +I pool::getsub(const S *tag,I level,BL order,BL cntonly,const AtomList &rdir) { AtomList gldir(curdir); gldir.Append(rdir); I ret = 0; - const A **r; + const A **r = NULL; + // CntSub is not used here because it doesn't allow checking for valid directory I cnt = pl->GetSub(gldir,r); if(!r) post("%s - %s: error retrieving directories",thisName(),GetString(tag)); @@ -588,7 +671,7 @@ I pool::getsub(const S *tag,I level,BL cntonly,const AtomList &rdir) } if(level != 0) - ret += getsub(tag,lv,cntonly,AtomList(rdir).Append(*r[i])); + ret += getsub(tag,lv,order,cntonly,AtomList(rdir).Append(*r[i])); } delete[] r; } @@ -609,7 +692,27 @@ V pool::m_getsub(I argc,const A *argv) post("%s - getsub: invalid level specification - set to 0",thisName()); } - getsub(MakeSymbol("getsub"),lvls); + getsub(MakeSymbol("getsub"),lvls,false); + ToOutBang(3); + + echodir(); +} + + +V pool::m_ogetsub(I argc,const A *argv) +{ + I lvls = 0; + if(argc > 0) { + if(CanbeInt(argv[0])) { + if(argc > 1) + post("%s - ogetsub: superfluous arguments ignored",thisName()); + lvls = GetAInt(argv[0]); + } + else + post("%s - ogetsub: invalid level specification - set to 0",thisName()); + } + + getsub(MakeSymbol("ogetsub"),lvls,true); ToOutBang(3); echodir(); @@ -619,7 +722,7 @@ V pool::m_getsub(I argc,const A *argv) V pool::m_cntall() { const S *tag = MakeSymbol("cntall"); - I cnt = getrec(tag,0,true); + I cnt = getrec(tag,0,false,true); ToOutSymbol(3,tag); ToOutBang(2); ToOutBang(1); @@ -643,7 +746,7 @@ V pool::m_cntrec(I argc,const A *argv) post("%s - %s: invalid level specification - set to infinite",thisName(),GetString(tag)); } - I cnt = getrec(tag,lvls,true); + I cnt = getrec(tag,lvls,false,true); ToOutSymbol(3,tag); ToOutBang(2); ToOutBang(1); @@ -668,7 +771,7 @@ V pool::m_cntsub(I argc,const A *argv) post("%s - %s: invalid level specification - set to 0",thisName(),GetString(tag)); } - I cnt = getsub(tag,lvls,true); + I cnt = getsub(tag,lvls,false,true); ToOutSymbol(3,tag); ToOutBang(2); ToOutBang(1); @@ -760,58 +863,60 @@ V pool::copyrec(const S *tag,I argc,const A *argv,BL cut) copyall(tag,cut,lvls); } -V pool::m_load(I argc,const A *argv) +V pool::load(I argc,const A *argv,BL xml) { + const C *sym = xml?"loadx":"load"; const C *flnm = NULL; if(argc > 0) { - if(argc > 1) post("%s - load: superfluous arguments ignored",thisName()); + if(argc > 1) post("%s - %s: superfluous arguments ignored",thisName(),sym); if(IsString(argv[0])) flnm = GetString(argv[0]); } if(!flnm) - post("%s - load: no filename given",thisName()); - else if(!pl->Load(flnm)) - post("%s - load: error loading data",thisName()); + post("%s - %s: no filename given",thisName(),sym); + else if(!(xml?pl->LoadXML(flnm):pl->Load(flnm))) + post("%s - %s: error loading data",thisName(),sym); echodir(); } -V pool::m_save(I argc,const A *argv) +V pool::save(I argc,const A *argv,BL xml) { + const C *sym = xml?"savex":"save"; const C *flnm = NULL; if(argc > 0) { - if(argc > 1) post("%s - save: superfluous arguments ignored",thisName()); + if(argc > 1) post("%s - %s: superfluous arguments ignored",thisName(),sym); if(IsString(argv[0])) flnm = GetString(argv[0]); } if(!flnm) - post("%s - save: no filename given",thisName()); - else if(!pl->Save(flnm)) - post("%s - save: error saving data",thisName()); + post("%s - %s: no filename given",thisName(),sym); + else if(!(xml?pl->SaveXML(flnm):pl->Save(flnm))) + post("%s - %s: error saving data",thisName(),sym); echodir(); } -V pool::m_lddir(I argc,const A *argv) +V pool::lddir(I argc,const A *argv,BL xml) { + const C *sym = xml?"ldxdir":"lddir"; const C *flnm = NULL; if(argc > 0) { - if(argc > 1) post("%s - lddir: superfluous arguments ignored",thisName()); + if(argc > 1) post("%s - %s: superfluous arguments ignored",thisName(),sym); if(IsString(argv[0])) flnm = GetString(argv[0]); } if(!flnm) - post("%s - lddir: invalid filename",thisName()); - else { - if(!pl->LdDir(curdir,flnm,0)) - post("%s - lddir: directory couldn't be loaded",thisName()); - } + post("%s - %s: invalid filename",thisName(),sym); + else if(!(xml?pl->LdDirXML(curdir,flnm,0):pl->LdDir(curdir,flnm,0))) + post("%s - %s: directory couldn't be loaded",thisName(),sym); echodir(); } -V pool::m_ldrec(I argc,const A *argv) +V pool::ldrec(I argc,const A *argv,BL xml) { + const C *sym = xml?"ldxrec":"ldrec"; const C *flnm = NULL; I depth = -1; BL mkdir = true; @@ -821,59 +926,61 @@ V pool::m_ldrec(I argc,const A *argv) if(argc >= 2) { if(CanbeInt(argv[1])) depth = GetAInt(argv[1]); else - post("%s - ldrec: invalid depth argument - set to -1",thisName()); + post("%s - %s: invalid depth argument - set to -1",thisName(),sym); if(argc >= 3) { if(CanbeBool(argv[2])) mkdir = GetABool(argv[2]); else - post("%s - ldrec: invalid mkdir argument - set to true",thisName()); + post("%s - %s: invalid mkdir argument - set to true",thisName(),sym); - if(argc > 3) post("%s - ldrec: superfluous arguments ignored",thisName()); + if(argc > 3) post("%s - %s: superfluous arguments ignored",thisName(),sym); } } } if(!flnm) - post("%s - ldrec: invalid filename",thisName()); + post("%s - %s: invalid filename",thisName(),sym); else { - if(!pl->LdDir(curdir,flnm,depth,mkdir)) - post("%s - ldrec: directory couldn't be saved",thisName()); + if(!(xml?pl->LdDirXML(curdir,flnm,depth,mkdir):pl->LdDir(curdir,flnm,depth,mkdir))) + post("%s - %s: directory couldn't be saved",thisName(),sym); } echodir(); } -V pool::m_svdir(I argc,const A *argv) +V pool::svdir(I argc,const A *argv,BL xml) { + const C *sym = xml?"svxdir":"svdir"; const C *flnm = NULL; if(argc > 0) { - if(argc > 1) post("%s - svdir: superfluous arguments ignored",thisName()); + if(argc > 1) post("%s - %s: superfluous arguments ignored",thisName(),sym); if(IsString(argv[0])) flnm = GetString(argv[0]); } if(!flnm) - post("%s - svdir: invalid filename",thisName()); + post("%s - %s: invalid filename",thisName(),sym); else { - if(!pl->SvDir(curdir,flnm,0,absdir)) - post("%s - svdir: directory couldn't be saved",thisName()); + if(!(xml?pl->SvDirXML(curdir,flnm,0,absdir):pl->SvDir(curdir,flnm,0,absdir))) + post("%s - %s: directory couldn't be saved",thisName(),sym); } echodir(); } -V pool::m_svrec(I argc,const A *argv) +V pool::svrec(I argc,const A *argv,BL xml) { + const C *sym = xml?"svxrec":"svrec"; const C *flnm = NULL; if(argc > 0) { - if(argc > 1) post("%s - svrec: superfluous arguments ignored",thisName()); + if(argc > 1) post("%s - %s: superfluous arguments ignored",thisName(),sym); if(IsString(argv[0])) flnm = GetString(argv[0]); } if(!flnm) - post("%s - svrec: invalid filename",thisName()); + post("%s - %s: invalid filename",thisName(),sym); else { - if(!pl->SvDir(curdir,flnm,-1,absdir)) - post("%s - svrec: directory couldn't be saved",thisName()); + if(!(xml?pl->SvDirXML(curdir,flnm,-1,absdir):pl->SvDir(curdir,flnm,-1,absdir))) + post("%s - %s: directory couldn't be saved",thisName(),sym); } echodir(); diff --git a/externals/grill/pool/pool.cpp b/externals/grill/pool/pool.cpp index 886debc6..5eb48294 100644 --- a/externals/grill/pool/pool.cpp +++ b/externals/grill/pool/pool.cpp @@ -15,6 +15,8 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include #include +#define VBITS 6 +#define DBITS 5 inline I compare(I a,I b) { return a == b?0:(a < b?-1:1); } inline I compare(F a,F b) { return a == b?0:(a < b?-1:1); } @@ -78,41 +80,67 @@ poolval *poolval::Dup() const } -pooldir::pooldir(const A &d,pooldir *p): - parent(p),dirs(NULL),vals(NULL),nxt(NULL) +pooldir::pooldir(const A &d,pooldir *p,I vcnt,I dcnt): + parent(p),nxt(NULL),vals(NULL),dirs(NULL), + vbits(vcnt?Int2Bits(vcnt):VBITS),dbits(dcnt?Int2Bits(dcnt):DBITS), + vsize(1<nxt) { c = compare(argv[0],ix->dir); if(c <= 0) break; } if(c || !ix) { - pooldir *nd = new pooldir(argv[0],this); + pooldir *nd = new pooldir(argv[0],this,vcnt,dcnt); nd->nxt = ix; if(prv) prv->nxt = nd; - else dirs = nd; + else dirs[dix].d = nd; + dirs[dix].cnt++; ix = nd; } @@ -123,8 +151,8 @@ pooldir *pooldir::GetDir(I argc,const A *argv,BL rmv) { if(!argc) return this; - I c = 1; - pooldir *prv = NULL,*ix = dirs; + I c = 1,dix = DIdx(argv[0]); + pooldir *prv = NULL,*ix = dirs[dix].d; for(; ix; prv = ix,ix = ix->nxt) { c = compare(argv[0],ix->dir); if(c <= 0) break; @@ -138,7 +166,8 @@ pooldir *pooldir::GetDir(I argc,const A *argv,BL rmv) else if(rmv) { pooldir *nd = ix->nxt; if(prv) prv->nxt = nd; - else dirs = nd; + else dirs[dix].d = nd; + dirs[dix].cnt--; ix->nxt = NULL; return ix; } @@ -160,8 +189,8 @@ BL pooldir::DelDir(I argc,const A *argv) V pooldir::SetVal(const A &key,AtomList *data,BL over) { - I c = 1; - poolval *prv = NULL,*ix = vals; + I c = 1,vix = VIdx(key); + poolval *prv = NULL,*ix = vals[vix].v; for(; ix; prv = ix,ix = ix->nxt) { c = compare(key,ix->key); if(c <= 0) break; @@ -175,7 +204,8 @@ V pooldir::SetVal(const A &key,AtomList *data,BL over) nv->nxt = ix; if(prv) prv->nxt = nv; - else vals = nv; + else vals[vix].v = nv; + vals[vix].cnt++; } } else if(over) { @@ -184,9 +214,12 @@ V pooldir::SetVal(const A &key,AtomList *data,BL over) if(data) ix->Set(data); else { + // delete key + poolval *nv = ix->nxt; if(prv) prv->nxt = nv; - else vals = nv; + else vals[vix].v = nv; + vals[vix].cnt--; ix->nxt = NULL; delete ix; } @@ -195,8 +228,8 @@ V pooldir::SetVal(const A &key,AtomList *data,BL over) poolval *pooldir::RefVal(const A &key) { - I c = 1; - poolval *ix = vals; + I c = 1,vix = VIdx(key); + poolval *ix = vals[vix].v; for(; ix; ix = ix->nxt) { c = compare(key,ix->key); if(c <= 0) break; @@ -205,13 +238,17 @@ poolval *pooldir::RefVal(const A &key) return c || !ix?NULL:ix; } + poolval *pooldir::RefVali(I rix) { - I c = 0; - poolval *ix = vals; - for(; ix && c < rix; ix = ix->nxt,++c) {} - - return c == rix?ix:NULL; + for(I vix = 0; vix < vsize; ++vix) + if(rix > vals[vix].cnt) rix -= vals[vix].cnt; + else { + poolval *ix = vals[vix].v; + for(; ix && rix; ix = ix->nxt) --rix; + if(ix && !rix) return ix; + } + return NULL; } flext::AtomList *pooldir::PeekVal(const A &key) @@ -222,8 +259,8 @@ flext::AtomList *pooldir::PeekVal(const A &key) flext::AtomList *pooldir::GetVal(const A &key,BL cut) { - I c = 1; - poolval *prv = NULL,*ix = vals; + I c = 1,vix = VIdx(key); + poolval *prv = NULL,*ix = vals[vix].v; for(; ix; prv = ix,ix = ix->nxt) { c = compare(key,ix->key); if(c <= 0) break; @@ -236,7 +273,8 @@ flext::AtomList *pooldir::GetVal(const A &key,BL cut) if(cut) { poolval *nv = ix->nxt; if(prv) prv->nxt = nv; - else vals = nv; + else vals[vix].v = nv; + vals[vix].cnt--; ix->nxt = NULL; ret = ix->data; ix->data = NULL; delete ix; @@ -247,11 +285,10 @@ flext::AtomList *pooldir::GetVal(const A &key,BL cut) } } -I pooldir::CntAll() +I pooldir::CntAll() const { I cnt = 0; - poolval *ix = vals; - for(; ix; ix = ix->nxt,++cnt) {} + for(I vix = 0; vix < vsize; ++vix) cnt += vals[vix].cnt; return cnt; } @@ -260,10 +297,11 @@ I pooldir::GetKeys(AtomList &keys) I cnt = CntAll(); keys(cnt); - poolval *ix = vals; - for(I i = 0; ix; ++i,ix = ix->nxt) - SetAtom(keys[i],ix->key); - + for(I vix = 0; vix < vsize; ++vix) { + poolval *ix = vals[vix].v; + for(I i = 0; ix; ++i,ix = ix->nxt) + SetAtom(keys[i],ix->key); + } return cnt; } @@ -273,35 +311,42 @@ I pooldir::GetAll(A *&keys,AtomList *&lst,BL cut) keys = new A[cnt]; lst = new AtomList[cnt]; - poolval *ix = vals; - for(I i = 0; ix; ++i) { - SetAtom(keys[i],ix->key); - lst[i] = *ix->data; - - if(cut) { - poolval *t = ix; - vals = ix = ix->nxt; - t->nxt = NULL; delete t; + for(I i = 0,vix = 0; vix < vsize; ++vix) { + poolval *ix = vals[vix].v; + for(; ix; ++i) { + SetAtom(keys[i],ix->key); + lst[i] = *ix->data; + + if(cut) { + poolval *t = ix; + vals[vix].v = ix = ix->nxt; + vals[vix].cnt--; + t->nxt = NULL; delete t; + } + else + ix = ix->nxt; } - else - ix = ix->nxt; } + return cnt; +} + +I pooldir::CntSub() const +{ + I cnt = 0; + for(I dix = 0; dix < dsize; ++dix) cnt += dirs[dix].cnt; return cnt; } + I pooldir::GetSub(const A **&lst) { - I cnt = 0; - pooldir *ix = dirs; - for(; ix; ix = ix->nxt,++cnt) {} + const I cnt = CntSub(); lst = new const A *[cnt]; - - ix = dirs; - for(I i = 0; ix; ix = ix->nxt,++i) { - lst[i] = &ix->dir; + for(I i = 0,dix = 0; dix < dsize; ++dix) { + pooldir *ix = dirs[dix].d; + for(; ix; ix = ix->nxt) lst[i++] = &ix->dir; } - return cnt; } @@ -310,15 +355,19 @@ BL pooldir::Paste(const pooldir *p,I depth,BL repl,BL mkdir) { BL ok = true; - for(poolval *ix = p->vals; ix; ix = ix->nxt) { - SetVal(ix->key,new AtomList(*ix->data),repl); + 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); + } } if(ok && depth) { - for(pooldir *dix = p->dirs; ok && dix; dix = dix->nxt) { - pooldir *ndir = mkdir?AddDir(1,&dix->dir):GetDir(1,&dix->dir); - if(ndir) { - ok = ndir->Paste(dix,depth > 0?depth-1:depth,repl,mkdir); + for(I di = 0; di < p->dsize; ++di) { + for(pooldir *dix = p->dirs[di].d; ok && dix; dix = dix->nxt) { + pooldir *ndir = mkdir?AddDir(1,&dix->dir):GetDir(1,&dix->dir); + if(ndir) { + ok = ndir->Paste(dix,depth > 0?depth-1:depth,repl,mkdir); + } } } } @@ -331,26 +380,30 @@ BL pooldir::Copy(pooldir *p,I depth,BL cut) BL ok = true; if(cut) { - if(p->vals) - ok = false; - else - p->vals = vals, vals = NULL; + for(I vi = 0; vi < vsize; ++vi) { + for(poolval *ix = vals[vi].v; ix; ix = ix->nxt) + p->SetVal(ix->key,ix->data); + vals[vi].cnt = 0; + vals[vi].v = NULL; + } } else { - // inefficient!! p->SetVal has to search through list unnecessarily!! - for(poolval *ix = vals; ix; ix = ix->nxt) { - p->SetVal(ix->key,new AtomList(*ix->data)); + 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)); + } } } if(ok && depth) { - // also quite inefficient for cut - for(pooldir *dix = dirs; ok && dix; dix = dix->nxt) { - pooldir *ndir = p->AddDir(1,&dix->dir); - if(ndir) - ok = ndir->Copy(dix,depth > 0?depth-1:depth,cut); - else - ok = false; + for(I di = 0; di < dsize; ++di) { + for(pooldir *dix = dirs[di].d; ok && dix; dix = dix->nxt) { + pooldir *ndir = p->AddDir(1,&dix->dir); + if(ndir) + ok = ndir->Copy(dix,depth > 0?depth-1:depth,cut); + else + ok = false; + } } } @@ -436,17 +489,18 @@ static V WriteAtom(ostream &os,const A &a) static V WriteAtoms(ostream &os,const flext::AtomList &l) { for(I i = 0; i < l.Count(); ++i) { +// if(IsSymbol(l[i]) os << "\""; WriteAtom(os,l[i]); - os << ' '; +// if(IsSymbol(l[i]) os << "\""; + if(i < l.Count()-1) os << ' '; } } BL pooldir::LdDir(istream &is,I depth,BL mkdir) { - BL r; for(I i = 1; !is.eof(); ++i) { AtomList d,k,*v = new AtomList; - r = ReadAtoms(is,d,','); + BL r = ReadAtoms(is,d,','); r = r && ReadAtoms(is,k,',') && k.Count() == 1; r = r && ReadAtoms(is,*v,'\n') && v->Count(); @@ -472,10 +526,10 @@ BL pooldir::LdDir(istream &is,I depth,BL mkdir) BL pooldir::SvDir(ostream &os,I depth,const AtomList &dir) { - { - for(poolval *ix = vals; ix; ix = ix->nxt) { + for(I vi = 0; vi < vsize; ++vi) { + for(poolval *ix = vals[vi].v; ix; ix = ix->nxt) { WriteAtoms(os,dir); - os << ", "; + os << " , "; WriteAtom(os,ix->key); os << " , "; WriteAtoms(os,*ix->data); @@ -484,13 +538,77 @@ BL pooldir::SvDir(ostream &os,I depth,const AtomList &dir) } if(depth) { I nd = depth > 0?depth-1:-1; - for(pooldir *ix = dirs; ix; ix = ix->nxt) { - ix->SvDir(os,nd,AtomList(dir).Append(ix->dir)); + 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)); + } } } return true; } +BL pooldir::LdDirXML(istream &is,I depth,BL mkdir) +{ +/* + for(I i = 1; !is.eof(); ++i) { + AtomList d,k,*v = new AtomList; + BL r = ReadAtoms(is,d,','); + r = r && ReadAtoms(is,k,',') && k.Count() == 1; + r = r && ReadAtoms(is,*v,'\n') && v->Count(); + + if(r) { + if(depth < 0 || d.Count() <= depth) { + pooldir *nd = mkdir?AddDir(d):GetDir(d); + if(nd) { + nd->SetVal(k[0],v); v = NULL; + } + #ifdef FLEXT_DEBUG + else + post("pool - directory was not found",i); + #endif + } + } + else if(!is.eof()) + post("pool - format mismatch encountered, skipped line %i",i); + + if(v) delete v; + } + return true; +*/ + return false; +} + +BL pooldir::SvDirXML(ostream &os,I depth,const AtomList &dir) +{ + if(dir.Count()) { + os << "" << endl; + } + + for(I vi = 0; vi < vsize; ++vi) { + for(poolval *ix = vals[vi].v; ix; ix = ix->nxt) { + os << "key); + os << "\">"; + WriteAtoms(os,*ix->data); + os << "" << endl; + } + } + + if(depth) { + I nd = depth > 0?depth-1:-1; + 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)); + } + } + } + + if(dir.Count()) os << "" << endl; + return true; +} + diff --git a/externals/grill/pool/pool.cw b/externals/grill/pool/pool.cw index a42f2abf..0169ea73 100755 Binary files a/externals/grill/pool/pool.cw and b/externals/grill/pool/pool.cw differ diff --git a/externals/grill/pool/pool.dsp b/externals/grill/pool/pool.dsp index dd2209ae..f59a4e15 100644 --- a/externals/grill/pool/pool.dsp +++ b/externals/grill/pool/pool.dsp @@ -101,6 +101,10 @@ SOURCE=.\pool.cpp # End Source File # Begin Source File +SOURCE=.\pool.dtd +# End Source File +# Begin Source File + SOURCE=.\pool.h # End Source File # Begin Source File diff --git a/externals/grill/pool/pool.dtd b/externals/grill/pool/pool.dtd new file mode 100644 index 00000000..c5cb5568 --- /dev/null +++ b/externals/grill/pool/pool.dtd @@ -0,0 +1,5 @@ + + + + + diff --git a/externals/grill/pool/pool.h b/externals/grill/pool/pool.h index 2fdbbd28..59195555 100644 --- a/externals/grill/pool/pool.h +++ b/externals/grill/pool/pool.h @@ -15,14 +15,15 @@ WARRANTIES, see the file, "license.txt," in this distribution. #include -#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 401) -#error You need at least flext version 0.4.1 +#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 402) +#error You need at least flext version 0.4.2 #endif #include typedef void V; typedef int I; +typedef unsigned long UL; typedef float F; typedef char C; typedef bool BL; @@ -48,10 +49,12 @@ class pooldir: public flext { public: - pooldir(const A &dir,pooldir *parent); + pooldir(const A &dir,pooldir *parent,I vcnt = 0,I dcnt = 0); ~pooldir(); V Clear(BL rec,BL dironly = false); + V Reset(BL realloc = true); + BL Empty() const { return !dirs && !vals; } BL HasDirs() const { return dirs != NULL; } BL HasVals() const { return vals != NULL; } @@ -60,16 +63,17 @@ public: pooldir *GetDir(const AtomList &d,BL cut = false) { return GetDir(d.Count(),d.Atoms(),cut); } BL DelDir(I argc,const A *argv); BL DelDir(const AtomList &d) { return DelDir(d.Count(),d.Atoms()); } - pooldir *AddDir(I argc,const A *argv); - pooldir *AddDir(const AtomList &d) { return AddDir(d.Count(),d.Atoms()); } + pooldir *AddDir(I argc,const A *argv,I vcnt = 0,I dcnt = 0); + pooldir *AddDir(const AtomList &d,I vcnt = 0,I dcnt = 0) { return AddDir(d.Count(),d.Atoms(),vcnt,dcnt); } V SetVal(const A &key,AtomList *data,BL over = true); V ClrVal(const A &key) { SetVal(key,NULL); } AtomList *PeekVal(const A &key); AtomList *GetVal(const A &key,BL cut = false); - I CntAll(); + I CntAll() const; I GetAll(A *&keys,AtomList *&lst,BL cut = false); I GetKeys(AtomList &keys); + I CntSub() const; I GetSub(const A **&dirs); poolval *RefVal(const A &key); @@ -79,27 +83,42 @@ public: BL Copy(pooldir *p,I depth,BL cur); BL LdDir(istream &is,I depth,BL mkdir); + BL LdDirXML(istream &is,I depth,BL mkdir); BL SvDir(ostream &os,I depth,const AtomList &dir = AtomList()); + BL SvDirXML(ostream &os,I depth,const AtomList &dir = AtomList()); + + int VSize() const { return vsize; } + int DSize() const { return dsize; } + +protected: + int VIdx(const A &v) const { return FoldBits(AtomHash(v),vbits); } + int DIdx(const A &d) const { return FoldBits(AtomHash(d),dbits); } A dir; pooldir *nxt; - pooldir *parent,*dirs; - poolval *vals; + pooldir *parent; + const I vbits,dbits,vsize,dsize; + + struct valentry { int cnt; poolval *v; }; + struct direntry { int cnt; pooldir *d; }; + + valentry *vals; + direntry *dirs; }; class pooldata: public flext { public: - pooldata(const S *s = NULL); + pooldata(const S *s = NULL,I vcnt = 0,I dcnt = 0); ~pooldata(); V Push() { ++refs; } BL Pop() { return --refs > 0; } V Reset(); - BL MkDir(const AtomList &d); + BL MkDir(const AtomList &d,I vcnt = 0,I dcnt = 0); BL ChkDir(const AtomList &d); BL RmDir(const AtomList &d); @@ -112,6 +131,7 @@ public: poolval *Refi(const AtomList &d,I ix); I CntAll(const AtomList &d); I GetAll(const AtomList &d,A *&keys,AtomList *&lst); + I CntSub(const AtomList &d); I GetSub(const AtomList &d,const t_atom **&dirs); BL Paste(const AtomList &d,const pooldir *clip,I depth = -1,BL repl = true,BL mkdir = true); @@ -122,6 +142,10 @@ public: BL SvDir(const AtomList &d,const C *flnm,I depth,BL absdir); BL Load(const C *flnm) { return LdDir(AtomList(),flnm,-1); } BL Save(const C *flnm) { return SvDir(AtomList(),flnm,-1,true); } + BL LdDirXML(const AtomList &d,const C *flnm,I depth,BL mkdir = true); + BL SvDirXML(const AtomList &d,const C *flnm,I depth,BL absdir); + BL LoadXML(const C *flnm) { return LdDirXML(AtomList(),flnm,-1); } + BL SaveXML(const C *flnm) { return SvDirXML(AtomList(),flnm,-1,true); } I refs; const S *sym; diff --git a/externals/grill/pool/pool.help b/externals/grill/pool/pool.help index dfef05f1..959ca32f 100755 Binary files a/externals/grill/pool/pool.help and b/externals/grill/pool/pool.help differ diff --git a/externals/grill/pool/pool.pd b/externals/grill/pool/pool.pd index 4d5592e3..70fc7461 100644 --- a/externals/grill/pool/pool.pd +++ b/externals/grill/pool/pool.pd @@ -1,10 +1,10 @@ -#N canvas 25 23 980 683 12; +#N canvas 12 3 926 682 12; #X msg 295 108 set 1 2 3; -#X obj 254 615 print K; +#X obj 308 619 print K; #X msg 607 211 getall; #X msg 295 137 set A k g; -#X obj 233 646 print V; -#X obj 272 584 print D; +#X obj 259 648 print V; +#X obj 357 593 print D; #X msg 295 167 set A l m; #X msg 298 196 set 2 34; #X msg 297 227 set 3 17; @@ -19,11 +19,11 @@ #X msg 40 234 absdir \$1; #X text 427 85 clear value; #X text 428 159 get value; -#X obj 291 557 print C; -#X text 363 557 command; -#X text 345 584 directory (abs or rel to current); -#X text 308 647 data value; -#X text 326 615 data key; +#X obj 406 564 print C; +#X text 478 564 command; +#X text 430 593 directory (abs or rel to current); +#X text 334 649 data value; +#X text 380 619 data key; #X msg 41 314 pool pool1; #X msg 42 343 pool; #X text 86 343 set to private; @@ -32,7 +32,7 @@ #X msg 613 111 clrall; #X text 604 89 clear all values in dir; #X text 607 190 get all values in dir; -#X text 314 479 pool name can be given as argument; +#X text 175 500 pool name can be given as argument; #X text 603 136 clear all values and dirs; #X msg 611 158 clrrec; #X msg 605 258 getrec; @@ -54,9 +54,8 @@ #X msg 609 364 cntrec; #X text 677 362 ... and subdirs; #X text 673 376 (depth may be given); -#X msg 296 282 add 3 14; #X text 294 261 set but don't replace; -#N canvas 0 0 512 538 dirs 0; +#N canvas 0 0 514 540 dirs 0; #X msg 109 27 mkdir fld1; #X msg 111 122 chdir; #X msg 110 217 updir; @@ -96,29 +95,51 @@ #X connect 23 0 26 0; #X restore 718 511 pd dirs; #X text 715 485 directory operations; -#N canvas 0 0 469 436 file 0; +#N canvas 0 0 815 447 file 0; #X text 117 207 save dir and subdirs; #X text 117 165 save data in current dir; -#X msg 117 184 svdir c:/temp/pool.dat; -#X msg 117 226 svrec c:/temp/pool.dat; -#X msg 116 272 lddir c:/temp/pool.dat; -#X msg 116 319 ldrec c:/temp/pool.dat; #X text 117 253 load data into current dir; #X text 115 300 load data into current dir and below; #X text 132 340 depth (default -1) and; #X text 134 356 mkdir flag (default 1) can be given; #X text 117 37 save all; #X text 117 81 load all (add to existing data); -#X msg 118 100 load c:/temp/pool.dat; -#X msg 120 54 save c:/temp/pool.dat; #X text 22 12 file operations; #X obj 22 188 s \$0-pool; -#X connect 2 0 15 0; -#X connect 3 0 15 0; -#X connect 4 0 15 0; -#X connect 5 0 15 0; -#X connect 12 0 15 0; -#X connect 13 0 15 0; +#X text 473 209 save dir and subdirs; +#X text 473 167 save data in current dir; +#X text 473 255 load data into current dir; +#X text 471 302 load data into current dir and below; +#X text 488 342 depth (default -1) and; +#X text 490 358 mkdir flag (default 1) can be given; +#X text 473 39 save all; +#X text 473 83 load all (add to existing data); +#X obj 378 190 s \$0-pool; +#X text 444 12 XML format; +#X msg 120 54 save pool.dat; +#X msg 118 100 load pool.dat; +#X msg 117 184 svdir pool.dat; +#X msg 117 226 svrec pool.dat; +#X msg 116 272 lddir pool.dat; +#X msg 116 319 ldrec pool.dat; +#X msg 476 56 savex pool.xml; +#X msg 474 102 loadx pool.xml; +#X msg 473 186 svxdir pool.xml; +#X msg 473 228 svxrec pool.xml; +#X msg 472 274 ldxdir pool.xml; +#X msg 472 321 ldxrec pool.xml; +#X connect 20 0 9 0; +#X connect 21 0 9 0; +#X connect 22 0 9 0; +#X connect 23 0 9 0; +#X connect 24 0 9 0; +#X connect 25 0 9 0; +#X connect 26 0 18 0; +#X connect 27 0 18 0; +#X connect 28 0 18 0; +#X connect 29 0 18 0; +#X connect 30 0 18 0; +#X connect 31 0 18 0; #X restore 719 566 pd file; #X text 717 543 file operations; #X text 717 600 clipboard operations; @@ -162,51 +183,54 @@ #X connect 23 0 26 0; #X restore 719 623 pd clip; #X text 717 454 more commands:; -#X obj 349 429 r \$0-pool; -#X text 174 500 data is shared among pool objects with the same name +#X obj 289 389 r \$0-pool; +#X text 174 517 data is shared among pool objects with the same name ; #X obj 26 10 cnv 15 850 40 empty empty pool 10 22 0 24 -260818 -1 0 ; #X text 272 33 http://www.parasitaere-kapazitaeten.net; -#X obj 317 529 print A; -#X text 382 529 attributes; +#X obj 456 541 print A; +#X text 521 541 attributes; #X msg 43 490 getattributes; #X msg 136 132 getechodir; #X msg 132 232 getabsdir; #X msg 146 313 getpool; -#X obj 260 478 pool; #X text 272 13 a hierarchical storage object \, (C)2002-2003 Thomas Grill; -#X connect 0 0 72 0; -#X connect 2 0 72 0; -#X connect 3 0 72 0; -#X connect 6 0 72 0; -#X connect 7 0 72 0; -#X connect 8 0 72 0; -#X connect 9 0 72 0; -#X connect 10 0 72 0; -#X connect 11 0 72 0; -#X connect 12 0 72 0; +#X msg 296 282 add 2 14; +#X obj 260 478 pool @valcnt 10 @dircnt 5; +#X text 332 442 expected value and directory counts; +#X text 332 457 can be given for optimal performance; +#X connect 0 0 73 0; +#X connect 2 0 73 0; +#X connect 3 0 73 0; +#X connect 6 0 73 0; +#X connect 7 0 73 0; +#X connect 8 0 73 0; +#X connect 9 0 73 0; +#X connect 10 0 73 0; +#X connect 11 0 73 0; +#X connect 12 0 73 0; #X connect 13 0 12 0; #X connect 14 0 15 0; -#X connect 15 0 72 0; -#X connect 23 0 72 0; -#X connect 24 0 72 0; -#X connect 26 0 72 0; -#X connect 28 0 72 0; -#X connect 33 0 72 0; -#X connect 34 0 72 0; -#X connect 45 0 72 0; -#X connect 48 0 72 0; -#X connect 50 0 72 0; -#X connect 53 0 72 0; -#X connect 62 0 72 0; -#X connect 68 0 72 0; -#X connect 69 0 72 0; -#X connect 70 0 72 0; -#X connect 71 0 72 0; -#X connect 72 0 4 0; -#X connect 72 1 1 0; -#X connect 72 2 5 0; -#X connect 72 3 18 0; -#X connect 72 4 66 0; +#X connect 15 0 73 0; +#X connect 23 0 73 0; +#X connect 24 0 73 0; +#X connect 26 0 73 0; +#X connect 28 0 73 0; +#X connect 33 0 73 0; +#X connect 34 0 73 0; +#X connect 45 0 73 0; +#X connect 48 0 73 0; +#X connect 50 0 73 0; +#X connect 61 0 73 0; +#X connect 67 0 73 0; +#X connect 68 0 73 0; +#X connect 69 0 73 0; +#X connect 70 0 73 0; +#X connect 72 0 73 0; +#X connect 73 0 4 0; +#X connect 73 1 1 0; +#X connect 73 2 5 0; +#X connect 73 3 18 0; +#X connect 73 4 65 0; diff --git a/externals/grill/pool/readme.txt b/externals/grill/pool/readme.txt index 56d7b7b5..62e42669 100644 --- a/externals/grill/pool/readme.txt +++ b/externals/grill/pool/readme.txt @@ -52,17 +52,23 @@ o CodeWarrior: edit "pool.cw" and build Version history: -0.1.1: +0.2.0: - attributes (pool,private,echodir,absdir) - added "geti" message for retrieval of a value at an index - fixed bug in "get" message if key not present - adapted source to flext 0.4.1 - register methods at class creation +- extensive use of hashing for keys and directories +- database can be saved/loaded as XML data 0.1.0: - first public release --------------------------------------------------------------------------- +BUGS: +- pool does not handle symbols with spaces or all digits + + TODO list: general: -- cgit v1.2.1