aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2003-12-06 03:38:13 +0000
committerThomas Grill <xovo@users.sourceforge.net>2003-12-06 03:38:13 +0000
commit5e37af09e119b1f6a1b0548731d885c8131af1a4 (patch)
tree45bf6c72bac4d3dfd02978652945dc0e7c9a05f9
parentbf1a5e1e9d38288f6a8bfc6ff7f49bef31b62439 (diff)
""
svn path=/trunk/; revision=1206
-rw-r--r--externals/grill/pool/data.cpp16
-rw-r--r--externals/grill/pool/main.cpp124
-rw-r--r--externals/grill/pool/pool.cpp258
-rw-r--r--externals/grill/pool/pool.dtd10
-rw-r--r--externals/grill/pool/pool.h4
-rw-r--r--externals/grill/pool/pool.pd92
-rw-r--r--externals/grill/pool/readme.txt5
7 files changed, 389 insertions, 120 deletions
diff --git a/externals/grill/pool/data.cpp b/externals/grill/pool/data.cpp
index d99d83c2..26b5464b 100644
--- a/externals/grill/pool/data.cpp
+++ b/externals/grill/pool/data.cpp
@@ -119,6 +119,15 @@ I pooldata::GetAll(const AtomList &d,A *&keys,AtomList *&lst)
}
}
+I pooldata::PrintAll(const AtomList &d)
+{
+ char tmp[1024];
+ d.Print(tmp,sizeof tmp);
+ pooldir *pd = root.GetDir(d);
+ strcat(tmp," , ");
+ return pd?pd->PrintAll(tmp,sizeof tmp):0;
+}
+
I pooldata::CntSub(const AtomList &d)
{
pooldir *pd = root.GetDir(d);
@@ -242,13 +251,13 @@ BL pooldata::LdDirXML(const AtomList &d,const C *flnm,I depth,BL mkdir)
fl.getline(tmp,sizeof tmp);
ret = !strncmp(tmp,"<?xml",5);
}
+/*
if(ret) {
fl.getline(tmp,sizeof tmp);
// DOCTYPE need not be present / only external DOCTYPE is allowed!
- if(!strncmp(tmp,"<!DOCTYPE",9))
- fl.getline(tmp,sizeof tmp);
- ret = !strncmp(tmp,"<pool>",6);
+ ret = !strncmp(tmp,"<!DOCTYPE",9);
}
+*/
if(ret)
ret = pd->LdDirXML(fl,depth,mkdir);
return ret;
@@ -270,6 +279,7 @@ BL pooldata::SvDirXML(const AtomList &d,const C *flnm,I depth,BL absdir)
if(absdir) tmp = d;
if(fl.good()) {
fl << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" << endl;
+// fl << "<!DOCTYPE pool SYSTEM \"http://www.parasitaere-kapazitaeten.net/ext/pool/pool.dtd\">" << endl;
fl << "<!DOCTYPE pool SYSTEM \"pool.dtd\">" << endl;
fl << "<pool>" << endl;
BL ret = pd->SvDirXML(fl,depth,tmp);
diff --git a/externals/grill/pool/main.cpp b/externals/grill/pool/main.cpp
index 0cf73ccd..dd2567b5 100644
--- a/externals/grill/pool/main.cpp
+++ b/externals/grill/pool/main.cpp
@@ -71,6 +71,11 @@ protected:
V m_cntrec(I argc,const A *argv); // also subdirectories
V m_cntsub(I argc,const A *argv); // only subdirectories
+ // print directories
+ V m_printall(); // print values in current dir
+ V m_printrec(I argc,const A *argv,BL fromroot = false); // print values recursively
+ V m_printroot() { m_printrec(0,NULL,true); } // print values recursively from root
+
// cut/copy/paste
V m_paste(I argc,const A *argv) { paste(MakeSymbol("paste"),argc,argv,true); } // paste contents of clipboard
V m_pasteadd(I argc,const A *argv) { paste(MakeSymbol("pasteadd"),argc,argv,false); } // paste but don't replace
@@ -106,10 +111,12 @@ private:
static BL ValChk(const AtomList &l) { return ValChk(l.Count(),l.Atoms()); }
V ToOutAtom(I ix,const A &a);
+ enum get_t { get_norm,get_cnt,get_print };
+
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 order,BL cntonly = false,const AtomList &rdir = AtomList());
- I getsub(const S *tag,I level,BL order,BL cntonly = false,const AtomList &rdir = AtomList());
+ I getrec(const S *tag,I level,BL order,get_t how = get_norm,const AtomList &rdir = AtomList());
+ I getsub(const S *tag,I level,BL order,get_t how = get_norm,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);
@@ -178,6 +185,9 @@ private:
FLEXT_CALLBACK(m_cntall)
FLEXT_CALLBACK_V(m_cntrec)
FLEXT_CALLBACK_V(m_cntsub)
+ FLEXT_CALLBACK(m_printall)
+ FLEXT_CALLBACK_V(m_printrec)
+ FLEXT_CALLBACK(m_printroot)
FLEXT_CALLBACK_V(m_paste)
FLEXT_CALLBACK_V(m_pasteadd)
@@ -253,6 +263,10 @@ V pool::setup(t_classid c)
FLEXT_CADDMETHOD_(c,0,"cntrec",m_cntrec);
FLEXT_CADDMETHOD_(c,0,"cntsub",m_cntsub);
+ FLEXT_CADDMETHOD_(c,0,"printall",m_printall);
+ FLEXT_CADDMETHOD_(c,0,"printrec",m_printrec);
+ FLEXT_CADDMETHOD_(c,0,"printroot",m_printroot);
+
FLEXT_CADDMETHOD_(c,0,"paste",m_paste);
FLEXT_CADDMETHOD_(c,0,"pasteadd",m_pasteadd);
FLEXT_CADDMETHOD_(c,0,"clrclip",m_clrclip);
@@ -284,7 +298,7 @@ pool::pool(I argc,const A *argv):
{
holdname = argc >= 1 && IsSymbol(argv[0])?GetSymbol(argv[0]):NULL;
- AddInAnything();
+ AddInAnything("Commands in");
AddOutList();
AddOutAnything();
AddOutList();
@@ -549,32 +563,38 @@ V pool::m_geti(I ix)
echodir();
}
-I pool::getrec(const S *tag,I level,BL order,BL cntonly,const AtomList &rdir)
+I pool::getrec(const S *tag,I level,BL order,get_t how,const AtomList &rdir)
{
AtomList gldir(curdir);
gldir.Append(rdir);
I ret = 0;
- if(cntonly)
- ret = pl->CntAll(gldir);
- else {
- A *k;
- AtomList *r;
- I cnt = pl->GetAll(gldir,k,r);
- if(!k)
- post("%s - %s: error retrieving values",thisName(),GetString(tag));
- else {
- for(I i = 0; i < cnt; ++i) {
- ToOutAnything(3,tag,0,NULL);
- ToOutList(2,absdir?gldir:rdir);
- ToOutAtom(1,k[i]);
- ToOutList(0,r[i]);
- }
- delete[] k;
- delete[] r;
- }
- ret = cnt;
+ switch(how) {
+ case get_cnt:
+ ret = pl->CntAll(gldir);
+ break;
+ case get_print:
+ ret = pl->PrintAll(gldir);
+ break;
+ case get_norm: {
+ A *k;
+ AtomList *r;
+ I cnt = pl->GetAll(gldir,k,r);
+ if(!k)
+ post("%s - %s: error retrieving values",thisName(),GetString(tag));
+ else {
+ for(I i = 0; i < cnt; ++i) {
+ ToOutAnything(3,tag,0,NULL);
+ ToOutList(2,absdir?gldir:rdir);
+ ToOutAtom(1,k[i]);
+ ToOutList(0,r[i]);
+ }
+ delete[] k;
+ delete[] r;
+ }
+ ret = cnt;
+ }
}
if(level != 0) {
@@ -585,7 +605,7 @@ I pool::getrec(const S *tag,I level,BL order,BL cntonly,const AtomList &rdir)
else {
I lv = level > 0?level-1:-1;
for(I i = 0; i < cnt; ++i) {
- ret += getrec(tag,lv,order,cntonly,AtomList(rdir).Append(*r[i]));
+ ret += getrec(tag,lv,order,how,AtomList(rdir).Append(*r[i]));
}
delete[] r;
}
@@ -648,7 +668,7 @@ V pool::m_ogetrec(I argc,const A *argv)
}
-I pool::getsub(const S *tag,I level,BL order,BL cntonly,const AtomList &rdir)
+I pool::getsub(const S *tag,I level,BL order,get_t how,const AtomList &rdir)
{
AtomList gldir(curdir);
gldir.Append(rdir);
@@ -666,7 +686,7 @@ I pool::getsub(const S *tag,I level,BL order,BL cntonly,const AtomList &rdir)
AtomList ndir(absdir?gldir:rdir);
ndir.Append(*r[i]);
- if(!cntonly) {
+ if(how == get_norm) {
ToOutAnything(3,tag,0,NULL);
ToOutList(2,curdir);
ToOutList(1,ndir);
@@ -674,7 +694,7 @@ I pool::getsub(const S *tag,I level,BL order,BL cntonly,const AtomList &rdir)
}
if(level != 0)
- ret += getsub(tag,lv,order,cntonly,AtomList(rdir).Append(*r[i]));
+ ret += getsub(tag,lv,order,how,AtomList(rdir).Append(*r[i]));
}
delete[] r;
}
@@ -725,7 +745,7 @@ V pool::m_ogetsub(I argc,const A *argv)
V pool::m_cntall()
{
const S *tag = MakeSymbol("cntall");
- I cnt = getrec(tag,0,false,true);
+ I cnt = getrec(tag,0,false,get_cnt);
ToOutSymbol(3,tag);
ToOutBang(2);
ToOutBang(1);
@@ -749,7 +769,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,false,true);
+ I cnt = getrec(tag,lvls,false,get_cnt);
ToOutSymbol(3,tag);
ToOutBang(2);
ToOutBang(1);
@@ -774,7 +794,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,false,true);
+ I cnt = getsub(tag,lvls,false,get_cnt);
ToOutSymbol(3,tag);
ToOutBang(2);
ToOutBang(1);
@@ -783,6 +803,37 @@ V pool::m_cntsub(I argc,const A *argv)
echodir();
}
+V pool::m_printall()
+{
+ const S *tag = MakeSymbol("printall");
+ I cnt = getrec(tag,0,false,get_print);
+ post("");
+}
+
+V pool::m_printrec(I argc,const A *argv,BL fromroot)
+{
+ const S *tag = MakeSymbol(fromroot?"printroot":"printrec");
+
+ I lvls = -1;
+ if(argc > 0) {
+ if(CanbeInt(argv[0])) {
+ if(argc > 1)
+ post("%s - %s: superfluous arguments ignored",thisName(),GetString(tag));
+ lvls = GetAInt(argv[0]);
+ }
+ else
+ post("%s - %s: invalid level specification - set to infinite",thisName(),GetString(tag));
+ }
+
+ AtomList svdir(curdir);
+ if(fromroot) curdir.Clear();
+
+ I cnt = getrec(tag,lvls,false,get_print);
+ post("");
+
+ curdir = svdir;
+}
+
V pool::paste(const S *tag,I argc,const A *argv,BL repl)
{
@@ -1069,15 +1120,22 @@ V pool::RmvPool(pooldata *p)
std::string pool::MakeFilename(const C *fn) const
{
#if FLEXT_SYS == FLEXT_SYS_PD
- C *sl = strrchr(fn,'/');
- if(!sl) sl = strrchr(fn,'\\');
- if(!sl) {
+ // / and \ must not be mixed!
+ C *sl = strchr(fn,'/');
+ if(!sl) sl = strchr(fn,'\\');
+ if(!sl || (sl != fn
+#if FLEXT_OS == FLEXT_OS_WIN
+ && sl[-1] != ':' // look for drive specification with ":/" or ":\\"
+#endif
+ )) {
+ // prepend absolute canvas path if filename has no absolute path
const C *p = GetString(canvas_getdir(thisCanvas()));
return string(p)+'/'+fn;
}
else
return fn;
#else
+#pragma message("Relative file paths not implemented")
return fn;
#endif
}
diff --git a/externals/grill/pool/pool.cpp b/externals/grill/pool/pool.cpp
index 25bb0b79..52c6a60c 100644
--- a/externals/grill/pool/pool.cpp
+++ b/externals/grill/pool/pool.cpp
@@ -294,6 +294,28 @@ I pooldir::CntAll() const
return cnt;
}
+I pooldir::PrintAll(char *buf,int len) const
+{
+ int offs = strlen(buf);
+
+ I cnt = 0;
+ for(I vix = 0; vix < vsize; ++vix) {
+ poolval *ix = vals[vix].v;
+ for(I i = 0; ix; ++i,ix = ix->nxt) {
+ PrintAtom(ix->key,buf+offs,len-offs);
+ strcat(buf+offs," , ");
+ int l = strlen(buf+offs)+offs;
+ ix->data->Print(buf+l,len-l);
+ post(buf);
+ }
+ cnt += vals[vix].cnt;
+ }
+
+ buf[offs] = 0;
+
+ return cnt;
+}
+
I pooldir::GetKeys(AtomList &keys)
{
I cnt = CntAll();
@@ -452,12 +474,8 @@ static C *ReadAtom(C *c,A *a)
return c;
}
-static BL ReadAtoms(istream &is,flext::AtomList &l,C del)
+static BL ParseAtoms(C *tmp,flext::AtomList &l)
{
- C tmp[1024];
- is.getline(tmp,sizeof tmp,del);
- if(is.eof() || !is.good()) return false;
-
I i,cnt;
C *t = tmp;
for(cnt = 0; ; ++cnt) {
@@ -473,6 +491,21 @@ static BL ReadAtoms(istream &is,flext::AtomList &l,C del)
return true;
}
+static BL ParseAtoms(string &s,flext::AtomList &l)
+{
+ return ParseAtoms((C *)s.c_str(),l);
+}
+
+static BL ReadAtoms(istream &is,flext::AtomList &l,C del)
+{
+ C tmp[1024];
+ is.getline(tmp,sizeof tmp,del);
+ if(is.eof() || !is.good())
+ return false;
+ else
+ return ParseAtoms(tmp,l);
+}
+
static V WriteAtom(ostream &os,const A &a)
{
switch(a.a_type) {
@@ -551,52 +584,196 @@ BL pooldir::SvDir(ostream &os,I depth,const AtomList &dir)
return true;
}
-BL pooldir::LdDirXML(istream &is,I depth,BL mkdir)
+class xmltag {
+public:
+ string tag,attr;
+ bool Ok() const { return tag.length() > 0; }
+ bool operator ==(const C *t) const { return !tag.compare(t); }
+ void Clear() { tag.clear(); attr.clear(); }
+ enum { t_start,t_end,t_empty } type;
+};
+
+static bool gettag(istream &is,xmltag &t)
+{
+ while(isspace(is.peek())) is.get();
+ if(is.peek() == '<') {
+ is.get();
+ char tmp[256];
+ is.getline(tmp,sizeof tmp,'>');
+ char *tb = tmp,*te = tmp+strlen(tmp)-1,*tf;
+
+ for(; isspace(*tb); ++tb);
+ if(*tb == '/') {
+ t.type = xmltag::t_end;
+ for(++tb; isspace(*tb); ++tb);
+ }
+ else {
+ for(; isspace(*te); --te);
+ if(*te == '/') {
+ for(--te; isspace(*te); --te);
+ t.type = xmltag::t_empty;
+ }
+ else
+ t.type = xmltag::t_start;
+ }
+
+ for(tf = tb; tf <= te && *tf && !isspace(*tf); ++tf);
+ t.tag.assign(tb,tf-tb);
+ while(isspace(*tf)) ++tf;
+ t.attr.assign(tf,te-tf+1);
+ return true;
+ }
+ else {
+ t.Clear();
+ return false;
+ }
+}
+
+static void getvalue(istream &is,string &s)
{
-/*
- 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();
+ char tmp[1024],*t = tmp;
+ bool intx = false;
+ for(;;) {
+ char c = is.peek();
+ if(c == '"') intx = !intx;
+ else if(c == '<' && !intx) break;
+ *(t++) = is.get();
+ }
+ *t = 0;
+ s = tmp;
+}
- 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);
+BL pooldir::LdDirXML(istream &is,I depth,BL mkdir)
+{
+ AtomList d,k,v;
+ bool inpool = false,inval = false,inkey = false,indata = false;
+ while(!is.eof()) {
+ xmltag tag;
+ gettag(is,tag);
+ if(!tag.Ok()) {
+ // look for value
+ string s;
+ getvalue(is,s);
+
+ if(s.length() && inpool &&
+ (
+ (!inval && inkey && d.Count()) || /* dir */
+ (inval && (inkey || indata)) /* value */
+ )
+ ) {
+ BL ret;
+ if(indata)
+ ret = ParseAtoms(s,v);
+ else // inkey
+ if(inval)
+ ret = ParseAtoms(s,k);
+ else {
+ SetString(d[d.Count()-1],s.c_str());
+ ret = true;
+ }
+ if(!ret) post("pool - error interpreting XML value (%s)",s.c_str());
+ }
+ else
+ post("pool - error reading XML data");
+ }
+ else if(tag == "pool") {
+ if(tag.type == xmltag::t_end) break;
+ else inpool = true;
+ }
+ else if(inpool) {
+ if(tag == "dir") {
+ if(tag.type == xmltag::t_start) {
+ t_atom at; SetString(at,"");
+ d.Append(at);
+ }
+ else if(tag.type == xmltag::t_end) {
+ if(d.Count())
+ d.Set(d.Count()-1,d.Atoms(),0,true);
+ else
+ post("pool - superfluous </dir> in XML data");
+ }
+ }
+ else if(tag == "value") {
+ if(tag.type == xmltag::t_start) {
+ inval = true;
+ k.Clear(); v.Clear();
+ }
+ else if(tag.type == xmltag::t_end) {
+ if(depth < 0 || d.Count() <= depth) {
+ // NOW set value
+ pooldir *nd = mkdir?AddDir(d):GetDir(d);
+ if(nd) {
+ // only use first word of key
+ if(k.Count() == 1)
+ nd->SetVal(k[0],new AtomList(v));
+ else
+ post("pool - Invalid key (!= 1 atom)");
+ }
+ }
+ inval = false;
+ }
+ }
+ else if(tag == "key") {
+ if(tag.type == xmltag::t_start) {
+ inkey = true;
+ }
+ else if(tag.type == xmltag::t_end) {
+ inkey = false;
+ }
+ }
+ else if(tag == "data") {
+ if(!inval)
+ post("pool - XML tag <data> not within <value>");
+
+ if(tag.type == xmltag::t_start) {
+ indata = true;
+ }
+ else if(tag.type == xmltag::t_end) {
+ indata = false;
+ }
+ }
+#ifdef FLEXT_DEBUG
+ else {
+ post("pool - unknown XML tag '%s'",tag.tag.c_str());
+ }
+#endif
+ }
+ else if(tag == "!DOCTYPE") {
+ // ignore
+ }
+#ifdef FLEXT_DEBUG
+ else {
+ post("pool - unknown XML tag '%s'",tag.tag.c_str());
+ }
+#endif
+ }
+ return true;
+}
- if(v) delete v;
- }
- return true;
-*/
- return false;
+static void indent(ostream &s,I cnt)
+{
+ for(I i = 0; i < cnt; ++i) s << '\t';
}
-BL pooldir::SvDirXML(ostream &os,I depth,const AtomList &dir)
+BL pooldir::SvDirXML(ostream &os,I depth,const AtomList &dir,I ind)
{
if(dir.Count()) {
- os << "<dir key=\"";
+ indent(os,ind);
+ os << "<dir>" << endl;
+ indent(os,ind+1);
+ os << "<key>";
WriteAtom(os,dir[dir.Count()-1]);
- os << "\">" << endl;
+ os << "</key>" << endl;
}
for(I vi = 0; vi < vsize; ++vi) {
for(poolval *ix = vals[vi].v; ix; ix = ix->nxt) {
- os << "<value key=\"";
+ indent(os,ind+1);
+ os << "<value><key>";
WriteAtom(os,ix->key);
- os << "\">";
+ os << "</key><data>";
WriteAtoms(os,*ix->data);
- os << "</value>" << endl;
+ os << "</data></value>" << endl;
}
}
@@ -604,12 +781,15 @@ BL pooldir::SvDirXML(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->SvDirXML(os,nd,AtomList(dir).Append(ix->dir));
+ ix->SvDirXML(os,nd,AtomList(dir).Append(ix->dir),ind+1);
}
}
}
- if(dir.Count()) os << "</dir>" << endl;
+ if(dir.Count()) {
+ indent(os,ind);
+ os << "</dir>" << endl;
+ }
return true;
}
diff --git a/externals/grill/pool/pool.dtd b/externals/grill/pool/pool.dtd
index c5cb5568..57a48498 100644
--- a/externals/grill/pool/pool.dtd
+++ b/externals/grill/pool/pool.dtd
@@ -1,5 +1,5 @@
-<!ELEMENT pool ((dir|value)*)>
-<!ELEMENT dir ((dir|value)*)>
-<!ATTLIST dir key CDATA #REQUIRED>
-<!ELEMENT value ANY>
-<!ATTLIST value key CDATA #REQUIRED>
+<!ELEMENT pool (dir|value)*)>
+<!ELEMENT dir (key+,dir*,value*)>
+<!ELEMENT value (key+,data?)>
+<!ELEMENT key (#CDATA)>
+<!ELEMENT data (#CDATA)>
diff --git a/externals/grill/pool/pool.h b/externals/grill/pool/pool.h
index e4a55647..99e271b3 100644
--- a/externals/grill/pool/pool.h
+++ b/externals/grill/pool/pool.h
@@ -74,6 +74,7 @@ public:
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);
I CntSub() const;
I GetSub(const A **&dirs);
@@ -87,7 +88,7 @@ public:
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());
+ BL SvDirXML(ostream &os,I depth,const AtomList &dir = AtomList(),I ind = 0);
int VSize() const { return vsize; }
int DSize() const { return dsize; }
@@ -132,6 +133,7 @@ public:
poolval *Ref(const AtomList &d,const A &key);
poolval *Refi(const AtomList &d,I ix);
I CntAll(const AtomList &d);
+ I PrintAll(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);
diff --git a/externals/grill/pool/pool.pd b/externals/grill/pool/pool.pd
index eab56fc3..2c1c75d5 100644
--- a/externals/grill/pool/pool.pd
+++ b/externals/grill/pool/pool.pd
@@ -1,23 +1,23 @@
-#N canvas 12 3 936 692 12;
-#X msg 295 108 set 1 2 3;
+#N canvas 12 3 946 702 12;
+#X msg 296 105 set 1 2 3;
#X obj 308 619 print K;
#X msg 607 211 getall;
-#X msg 295 137 set A k g;
+#X msg 296 134 set A k g;
#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 428 105 clr A;
-#X msg 428 168 get A;
-#X msg 428 193 get 2;
+#X msg 296 164 set A l m;
+#X msg 299 193 set 2 34;
+#X msg 429 102 clr A;
+#X msg 429 165 get A;
+#X msg 429 190 get 2;
#X msg 40 132 echodir \$1;
#X obj 40 111 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
;
#X obj 40 213 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
;
#X msg 40 234 absdir \$1;
-#X text 427 85 clear value;
-#X text 424 146 get value;
+#X text 428 82 clear value;
+#X text 425 143 get value;
#X obj 406 564 print C;
#X text 478 564 command;
#X text 430 593 directory (abs or rel to current);
@@ -28,12 +28,12 @@
#X text 86 343 set to private;
#X msg 42 405 reset;
#X text 41 384 clear all pool data;
-#X msg 613 111 clrall;
-#X text 604 89 clear all values in dir;
+#X msg 608 111 clrall;
+#X text 599 89 clear all values in dir;
#X text 607 190 get all values in dir;
#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 text 598 136 clear all values and dirs;
+#X msg 606 158 clrrec;
#X msg 605 258 getrec;
#X text 605 236 get all values in dir and subdirs;
#X text 670 289 bang at EOL;
@@ -42,19 +42,19 @@
#X text 43 291 set pool name;
#X text 40 89 at each command;
#X text 40 73 echo current dir;
-#X text 292 83 set values;
+#X text 293 80 set values;
#X text 35 194 (default on);
#X text 27 178 report absolute dirs;
#X msg 43 452 help;
#X text 86 453 get some info;
#X text 670 274 default=-1 (= infinite);
-#X msg 609 338 cntall;
-#X text 675 336 count all values in dir;
-#X msg 609 364 cntrec;
-#X text 677 362 ... and subdirs;
-#X text 673 376 (depth may be given);
-#X text 294 261 set but don't replace;
-#N canvas 0 0 514 540 dirs 0;
+#X msg 609 340 cntall;
+#X text 675 338 count all values in dir;
+#X msg 609 366 cntrec;
+#X text 677 364 ... and subdirs;
+#X text 673 378 (depth may be given);
+#X text 295 258 set but don't replace;
+#N canvas 0 0 520 546 dirs 0;
#X msg 109 27 mkdir fld1;
#X msg 111 122 chdir;
#X msg 110 217 updir;
@@ -92,9 +92,9 @@
#X connect 13 0 26 0;
#X connect 22 0 26 0;
#X connect 23 0 26 0;
-#X restore 718 511 pd dirs;
-#X text 715 485 directory operations;
-#N canvas 0 0 821 453 file 0;
+#X restore 716 496 pd dirs;
+#X text 713 470 directory operations;
+#N canvas 0 0 829 461 file 0;
#X text 117 207 save dir and subdirs;
#X text 117 165 save data in current dir;
#X text 117 253 load data into current dir;
@@ -141,10 +141,10 @@ the folder containing the current patcher will be used.;
#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;
-#N canvas 0 0 535 583 clip 0;
+#X restore 717 551 pd file;
+#X text 715 528 file operations;
+#X text 715 585 clipboard operations;
+#N canvas 0 0 541 589 clip 0;
#X text 97 56 copy value associated to key into clipboard;
#X msg 100 77 copy A;
#X msg 98 119 cut B;
@@ -182,9 +182,9 @@ the folder containing the current patcher will be used.;
#X connect 14 0 26 0;
#X connect 21 0 26 0;
#X connect 23 0 26 0;
-#X restore 719 623 pd clip;
-#X text 717 454 more commands:;
-#X obj 289 389 r \$0-pool;
+#X restore 716 606 pd clip;
+#X text 715 439 more commands:;
+#X obj 298 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
@@ -198,13 +198,31 @@ the folder containing the current patcher will be used.;
#X msg 146 313 getpool;
#X text 272 13 a hierarchical storage object \, (C)2002-2003 Thomas
Grill;
-#X msg 296 282 add 2 14;
+#X msg 297 279 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 msg 428 218 get 3;
-#X msg 299 227 set 3 -1 1;
+#X text 330 437 expected value and directory counts;
+#X text 330 452 can be given for optimal performance;
+#X msg 429 215 get 3;
+#X msg 300 224 set 3 -1 1;
#X msg 41 518 getmethods;
+#X text 328 466 (see attributes in properties dialog);
+#X text 715 638 console printout;
+#N canvas 0 0 553 284 print 0;
+#X obj 21 231 s \$0-pool;
+#X msg 109 80 printall;
+#X msg 109 132 printrec;
+#X text 110 60 print all values in dir;
+#X text 109 112 print values in dir and subdirs;
+#X text 179 131 (depth may be given);
+#X text 22 12 print-to-console operations;
+#X text 190 185 (depth may be given);
+#X msg 109 181 printroot;
+#X text 109 161 print values in dir and subdirs (starting from root)
+;
+#X connect 1 0 0 0;
+#X connect 2 0 0 0;
+#X connect 8 0 0 0;
+#X restore 717 659 pd print;
#X connect 0 0 72 0;
#X connect 2 0 72 0;
#X connect 3 0 72 0;
diff --git a/externals/grill/pool/readme.txt b/externals/grill/pool/readme.txt
index 3d9b5f1a..98671bdf 100644
--- a/externals/grill/pool/readme.txt
+++ b/externals/grill/pool/readme.txt
@@ -63,7 +63,8 @@ Version history:
- extensive use of hashing for keys and directories
- database can be saved/loaded as XML data
- fixed bug with stored numbers starting with - or +
-- file names without paths will use the folder of the current patcher
+- relative file names will be based on the folder of the current patcher
+- added printall, printrec, printroot messages for console printout
0.1.0:
- first public release
@@ -78,5 +79,5 @@ TODO list:
general:
- what is output as value if it is key only? (Max->nothing!)
-- XML interpretation? (only files written by pool or others too)
+- XML format ok?