aboutsummaryrefslogtreecommitdiff
path: root/externals
diff options
context:
space:
mode:
Diffstat (limited to 'externals')
-rw-r--r--externals/grill/pool/readme.txt2
-rw-r--r--externals/grill/pool/source/data.cpp6
-rw-r--r--externals/grill/pool/source/main.cpp25
-rw-r--r--externals/grill/pool/source/pool.cpp26
-rw-r--r--externals/grill/pool/source/pool.h10
5 files changed, 37 insertions, 32 deletions
diff --git a/externals/grill/pool/readme.txt b/externals/grill/pool/readme.txt
index df5787c5..e9c21b82 100644
--- a/externals/grill/pool/readme.txt
+++ b/externals/grill/pool/readme.txt
@@ -86,6 +86,8 @@ Version history:
- escaped symbols (with \) for whitespace support on store and load
- escape symbols also with "" to help the load routine
- improved reading of legacy data by Frank Barknecht
+- use statically allocated lists where feasible
+- bug fix: [reset( didn't reset the current dir
0.2.0:
- attributes (pool,private,echodir,absdir)
diff --git a/externals/grill/pool/source/data.cpp b/externals/grill/pool/source/data.cpp
index aaf9b817..afbd8c45 100644
--- a/externals/grill/pool/source/data.cpp
+++ b/externals/grill/pool/source/data.cpp
@@ -32,7 +32,7 @@ pooldata::~pooldata()
const A pooldata::nullatom = { A_NULL };
-I pooldata::GetAll(const AtomList &d,A *&keys,AtomList *&lst)
+I pooldata::GetAll(const AtomList &d,A *&keys,Atoms *&lst)
{
pooldir *pd = root.GetDir(d);
if(pd)
@@ -143,7 +143,7 @@ BL pooldata::SvDir(const AtomList &d,const C *flnm,I depth,BL absdir)
const C *t = CnvFlnm(tmp,flnm,sizeof tmp);
if(t) {
ofstream file(t);
- AtomList tmp;
+ Atoms tmp;
if(absdir) tmp = d;
return file.good() && pd->SvDir(file,depth,tmp);
}
@@ -190,7 +190,7 @@ BL pooldata::SvDirXML(const AtomList &d,const C *flnm,I depth,BL absdir)
const C *t = CnvFlnm(tmp,flnm,sizeof tmp);
if(t) {
ofstream file(t);
- AtomList tmp;
+ Atoms tmp;
if(absdir) tmp = d;
if(file.good()) {
file << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" << endl;
diff --git a/externals/grill/pool/source/main.cpp b/externals/grill/pool/source/main.cpp
index 21dbb0ce..95bc7ccf 100644
--- a/externals/grill/pool/source/main.cpp
+++ b/externals/grill/pool/source/main.cpp
@@ -141,7 +141,7 @@ private:
BL priv,absdir,echo;
I vcnt,dcnt;
pooldata *pl;
- AtomList curdir;
+ Atoms curdir;
pooldir *clip;
const S *holdname;
@@ -390,6 +390,7 @@ V pool::mg_pool(AtomList &l)
V pool::m_reset()
{
+ curdir();
pl->Reset();
}
@@ -408,7 +409,7 @@ V pool::m_mkdir(I argc,const A *argv,BL abs,BL chg)
if(!ValChk(argc,argv))
post("%s - %s: invalid directory name",thisName(),GetString(thisTag()));
else {
- AtomList ndir;
+ Atoms ndir;
if(abs) ndir(argc,argv);
else (ndir = curdir).Append(argc,argv);
if(!pl->MkDir(ndir,vcnt,dcnt)) {
@@ -427,7 +428,7 @@ V pool::m_chdir(I argc,const A *argv,BL abs)
if(!ValChk(argc,argv))
post("%s - %s: invalid directory name",thisName(),GetString(thisTag()));
else {
- AtomList prv(curdir);
+ Atoms prv(curdir);
if(abs) curdir(argc,argv);
else curdir.Append(argc,argv);
if(!pl->ChkDir(curdir)) {
@@ -454,7 +455,7 @@ V pool::m_updir(I argc,const A *argv)
post("%s - %s: invalid level specification - set to 1",thisName(),GetString(thisTag()));
}
- AtomList prv(curdir);
+ Atoms prv(curdir);
if(lvls > curdir.Count()) {
post("%s - %s: level exceeds directory depth - corrected",thisName(),GetString(thisTag()));
@@ -505,7 +506,7 @@ V pool::m_seti(I argc,const A *argv)
post("%s - %s: invalid data values",thisName(),GetString(thisTag()));
}
else
- if(!pl->Seti(curdir,GetAInt(argv[0]),new AtomList(argc-1,argv+1)))
+ if(!pl->Seti(curdir,GetAInt(argv[0]),new Atoms(argc-1,argv+1)))
post("%s - %s: value couldn't be set",thisName(),GetString(thisTag()));
echodir();
@@ -617,7 +618,7 @@ V pool::m_geti(I ix)
I pool::getrec(const t_symbol *tag,I level,BL order,get_t how,const AtomList &rdir)
{
- AtomList gldir(curdir);
+ Atoms gldir(curdir);
gldir.Append(rdir);
I ret = 0;
@@ -631,7 +632,7 @@ I pool::getrec(const t_symbol *tag,I level,BL order,get_t how,const AtomList &rd
break;
case get_norm: {
A *k;
- AtomList *r;
+ Atoms *r;
I cnt = pl->GetAll(gldir,k,r);
if(!k)
post("%s - %s: error retrieving values",thisName(),GetString(tag));
@@ -657,7 +658,7 @@ I pool::getrec(const t_symbol *tag,I level,BL order,get_t how,const AtomList &rd
else {
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]));
+ ret += getrec(tag,lv,order,how,Atoms(rdir).Append(*r[i]));
}
delete[] r;
}
@@ -722,7 +723,7 @@ V pool::m_ogetrec(I argc,const A *argv)
I pool::getsub(const S *tag,I level,BL order,get_t how,const AtomList &rdir)
{
- AtomList gldir(curdir);
+ Atoms gldir(curdir);
gldir.Append(rdir);
I ret = 0;
@@ -735,7 +736,7 @@ I pool::getsub(const S *tag,I level,BL order,get_t how,const AtomList &rdir)
else {
I lv = level > 0?level-1:-1;
for(I i = 0; i < cnt; ++i) {
- AtomList ndir(absdir?gldir:rdir);
+ Atoms ndir(absdir?gldir:rdir);
ndir.Append(*r[i]);
++ret;
@@ -747,7 +748,7 @@ I pool::getsub(const S *tag,I level,BL order,get_t how,const AtomList &rdir)
}
if(level != 0)
- ret += getsub(tag,lv,order,how,AtomList(rdir).Append(*r[i]));
+ ret += getsub(tag,lv,order,how,Atoms(rdir).Append(*r[i]));
}
delete[] r;
}
@@ -872,7 +873,7 @@ V pool::m_printrec(I argc,const A *argv,BL fromroot)
post("%s - %s: invalid level specification - set to infinite",thisName(),GetString(tag));
}
- AtomList svdir(curdir);
+ Atoms svdir(curdir);
if(fromroot) curdir.Clear();
I cnt = getrec(tag,lvls,false,get_print);
diff --git a/externals/grill/pool/source/pool.cpp b/externals/grill/pool/source/pool.cpp
index c2c0de6a..7fd1c289 100644
--- a/externals/grill/pool/source/pool.cpp
+++ b/externals/grill/pool/source/pool.cpp
@@ -78,7 +78,7 @@ poolval &poolval::Set(AtomList *d)
poolval *poolval::Dup() const
{
- return new poolval(key,data?new AtomList(*data):NULL);
+ return new poolval(key,data?new Atoms(*data):NULL);
}
@@ -314,7 +314,7 @@ flext::AtomList *pooldir::GetVal(const A &key,BL cut)
delete ix;
}
else
- ret = new AtomList(*ix->data);
+ ret = new Atoms(*ix->data);
return ret;
}
}
@@ -361,11 +361,11 @@ I pooldir::GetKeys(AtomList &keys)
return cnt;
}
-I pooldir::GetAll(A *&keys,AtomList *&lst,BL cut)
+I pooldir::GetAll(A *&keys,Atoms *&lst,BL cut)
{
I cnt = CntAll();
keys = new A[cnt];
- lst = new AtomList[cnt];
+ lst = new Atoms[cnt];
for(I i = 0,vix = 0; vix < vsize; ++vix) {
poolval *ix = vals[vix].v;
@@ -413,7 +413,7 @@ BL pooldir::Paste(const pooldir *p,I depth,BL repl,BL mkdir)
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);
+ SetVal(ix->key,new Atoms(*ix->data),repl);
}
}
@@ -446,7 +446,7 @@ BL pooldir::Copy(pooldir *p,I depth,BL cut)
else {
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));
+ p->SetVal(ix->key,new Atoms(*ix->data));
}
}
}
@@ -602,7 +602,7 @@ static V WriteAtoms(ostream &os,const flext::AtomList &l)
BL pooldir::LdDir(istream &is,I depth,BL mkdir)
{
for(I i = 1; !is.eof(); ++i) {
- AtomList d,k,*v = new AtomList;
+ Atoms d,k,*v = new Atoms;
BL r =
ReadAtoms(is,d,',') &&
ReadAtoms(is,k,',') &&
@@ -656,7 +656,7 @@ BL pooldir::SvDir(ostream &os,I depth,const AtomList &dir)
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->SvDir(os,nd,AtomList(dir).Append(ix->dir));
+ ix->SvDir(os,nd,Atoms(dir).Append(ix->dir));
}
}
}
@@ -783,7 +783,7 @@ static void getvalue(istream &is,string &s)
BL pooldir::LdDirXMLRec(istream &is,I depth,BL mkdir,AtomList &d)
{
- AtomList k,v;
+ Atoms k,v;
bool inval = false,inkey = false,indata = false;
int cntval = 0;
@@ -836,7 +836,7 @@ BL pooldir::LdDirXMLRec(istream &is,I depth,BL mkdir,AtomList &d)
if(d.Count() && GetSymbol(d[d.Count()-1]) == sym__)
post("pool - XML load: dir key must be given prior to subdirs, ignoring items");
- AtomList dnext(d.Count()+1);
+ Atoms dnext(d.Count()+1);
// copy existing dir
dnext.Set(d.Count(),d.Atoms(),0,false);
// initialize current dir key as empty
@@ -880,7 +880,7 @@ BL pooldir::LdDirXMLRec(istream &is,I depth,BL mkdir,AtomList &d)
if(k.Count() == 1) {
pooldir *nd = mkdir?AddDir(d):GetDir(d);
if(nd)
- nd->SetVal(k[0],new AtomList(v));
+ nd->SetVal(k[0],new Atoms(v));
else
post("pool - XML load: value key must be exactly one word, value not stored");
}
@@ -929,7 +929,7 @@ BL pooldir::LdDirXML(istream &is,I depth,BL mkdir)
if(tag == "pool") {
if(tag.type == xmltag::t_start) {
- AtomList empty; // must be a separate definition for gcc
+ Atoms empty; // must be a separate definition for gcc
LdDirXMLRec(is,depth,mkdir,empty);
}
else
@@ -980,7 +980,7 @@ BL pooldir::SvDirXML(ostream &os,I depth,const AtomList &dir,I ind)
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),ind+lvls);
+ ix->SvDirXML(os,nd,Atoms(dir).Append(ix->dir),ind+lvls);
}
}
}
diff --git a/externals/grill/pool/source/pool.h b/externals/grill/pool/source/pool.h
index 844ba4d8..204fd1ce 100644
--- a/externals/grill/pool/source/pool.h
+++ b/externals/grill/pool/source/pool.h
@@ -15,8 +15,8 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include <flext.h>
-#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 406)
-#error You need at least flext version 0.4.6
+#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 500)
+#error You need at least flext version 0.5.0
#endif
#include <iostream>
@@ -32,6 +32,8 @@ typedef bool BL;
typedef t_atom A;
typedef t_symbol S;
+typedef flext::AtomListStatic<8> Atoms;
+
class poolval:
public flext
{
@@ -75,7 +77,7 @@ public:
AtomList *PeekVal(const A &key);
AtomList *GetVal(const A &key,BL cut = false);
I CntAll() const;
- I GetAll(A *&keys,AtomList *&lst,BL cut = false);
+ I GetAll(A *&keys,Atoms *&lst,BL cut = false);
I PrintAll(char *buf,int len) const;
I GetKeys(AtomList &keys);
I CntSub() const;
@@ -218,7 +220,7 @@ public:
}
I PrintAll(const AtomList &d);
- I GetAll(const AtomList &d,A *&keys,AtomList *&lst);
+ I GetAll(const AtomList &d,A *&keys,Atoms *&lst);
I CntSub(const AtomList &d)
{