aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/pool
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/pool')
-rw-r--r--externals/grill/pool/data.cpp12
-rw-r--r--externals/grill/pool/main.cpp38
-rw-r--r--externals/grill/pool/pool.cpp9
-rwxr-xr-xexternals/grill/pool/pool.cwbin131746 -> 131746 bytes
-rw-r--r--externals/grill/pool/pool.h3
-rwxr-xr-xexternals/grill/pool/pool.helpbin5887 -> 5952 bytes
-rw-r--r--externals/grill/pool/readme.txt1
7 files changed, 57 insertions, 6 deletions
diff --git a/externals/grill/pool/data.cpp b/externals/grill/pool/data.cpp
index eb5c5bd8..38c13bd5 100644
--- a/externals/grill/pool/data.cpp
+++ b/externals/grill/pool/data.cpp
@@ -82,6 +82,18 @@ flext::AtomList *pooldata::Peek(const AtomList &d,const A &key)
return pd?pd->PeekVal(key):NULL;
}
+poolval *pooldata::Ref(const AtomList &d,const A &key)
+{
+ pooldir *pd = root.GetDir(d);
+ return pd?pd->RefVal(key):NULL;
+}
+
+poolval *pooldata::Refi(const AtomList &d,I ix)
+{
+ pooldir *pd = root.GetDir(d);
+ return pd?pd->RefVali(ix):NULL;
+}
+
flext::AtomList *pooldata::Get(const AtomList &d,const A &key)
{
pooldir *pd = root.GetDir(d);
diff --git a/externals/grill/pool/main.cpp b/externals/grill/pool/main.cpp
index ad1da05a..57773742 100644
--- a/externals/grill/pool/main.cpp
+++ b/externals/grill/pool/main.cpp
@@ -10,7 +10,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#include "pool.h"
-#define POOL_VERSION "0.1.1"
+#define POOL_VERSION "0.1.1pre"
class pool:
public flext_base
@@ -54,6 +54,7 @@ protected:
V m_clrrec(); // also subdirectories
V m_clrsub(); // only subdirectories
V m_get(I argc,const A *argv);
+ V m_geti(I ix); // get value at index
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
@@ -139,6 +140,7 @@ private:
FLEXT_CALLBACK(m_clrrec)
FLEXT_CALLBACK(m_clrsub)
FLEXT_CALLBACK_V(m_get)
+ FLEXT_CALLBACK_I(m_geti)
FLEXT_CALLBACK(m_getall)
FLEXT_CALLBACK_V(m_getrec)
FLEXT_CALLBACK_V(m_getsub)
@@ -214,6 +216,7 @@ pool::pool(I argc,const A *argv):
FLEXT_ADDMETHOD_(0,"clrrec",m_clrrec);
FLEXT_ADDMETHOD_(0,"clrsub",m_clrsub);
FLEXT_ADDMETHOD_(0,"get",m_get);
+ FLEXT_ADDMETHOD_(0,"geti",m_geti);
FLEXT_ADDMETHOD_(0,"getall",m_getall);
FLEXT_ADDMETHOD_(0,"getrec",m_getrec);
FLEXT_ADDMETHOD_(0,"getsub",m_getsub);
@@ -443,20 +446,43 @@ V pool::m_get(I argc,const A *argv)
if(argc > 1)
post("%s - get: superfluous arguments ignored",thisName());
- AtomList *r = pl->Get(curdir,argv[0]);
+ poolval *r = pl->Ref(curdir,argv[0]);
ToOutAnything(3,MakeSymbol("get"),0,NULL);
if(absdir)
ToOutList(2,curdir);
else
ToOutList(2,0,NULL);
- ToOutAtom(1,argv[0]);
+ ToOutAtom(1,r->key);
+ if(r)
+ ToOutList(0,*r->data);
+ else
+ ToOutBang(0);
+ }
+
+ echodir();
+}
+
+V pool::m_geti(I ix)
+{
+ if(ix < 0)
+ post("%s - geti: invalid index",thisName());
+ else {
+ poolval *r = pl->Refi(curdir,ix);
+
+ ToOutAnything(3,MakeSymbol("geti"),0,NULL);
+ if(absdir)
+ ToOutList(2,curdir);
+ else
+ ToOutList(2,0,NULL);
if(r) {
- ToOutList(0,*r);
- delete r;
+ ToOutAtom(1,r->key);
+ ToOutList(0,*r->data);
}
- else
+ else {
+ ToOutBang(1);
ToOutBang(0);
+ }
}
echodir();
diff --git a/externals/grill/pool/pool.cpp b/externals/grill/pool/pool.cpp
index 21eaf279..9c30603c 100644
--- a/externals/grill/pool/pool.cpp
+++ b/externals/grill/pool/pool.cpp
@@ -205,6 +205,15 @@ 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;
+}
+
flext::AtomList *pooldir::PeekVal(const A &key)
{
poolval *ix = RefVal(key);
diff --git a/externals/grill/pool/pool.cw b/externals/grill/pool/pool.cw
index fabf0ff1..18d5f42f 100755
--- a/externals/grill/pool/pool.cw
+++ b/externals/grill/pool/pool.cw
Binary files differ
diff --git a/externals/grill/pool/pool.h b/externals/grill/pool/pool.h
index af73341d..5e1c0cc1 100644
--- a/externals/grill/pool/pool.h
+++ b/externals/grill/pool/pool.h
@@ -73,6 +73,7 @@ public:
I GetSub(const A **&dirs);
poolval *RefVal(const A &key);
+ poolval *RefVali(I ix);
BL Paste(const pooldir *p,I depth,BL repl,BL mkdir);
BL Copy(pooldir *p,I depth,BL cur);
@@ -107,6 +108,8 @@ public:
BL ClrAll(const AtomList &d,BL rec,BL dironly = false);
AtomList *Peek(const AtomList &d,const A &key);
AtomList *Get(const AtomList &d,const A &key);
+ poolval *Ref(const AtomList &d,const A &key);
+ poolval *Refi(const AtomList &d,I ix);
I CntAll(const AtomList &d);
I GetAll(const AtomList &d,A *&keys,AtomList *&lst);
I GetSub(const AtomList &d,const t_atom **&dirs);
diff --git a/externals/grill/pool/pool.help b/externals/grill/pool/pool.help
index 20f96ffa..dfef05f1 100755
--- a/externals/grill/pool/pool.help
+++ b/externals/grill/pool/pool.help
Binary files differ
diff --git a/externals/grill/pool/readme.txt b/externals/grill/pool/readme.txt
index 0fc0f7f3..6bf4c969 100644
--- a/externals/grill/pool/readme.txt
+++ b/externals/grill/pool/readme.txt
@@ -54,6 +54,7 @@ Version history:
0.1.1:
- attributes (pool,private,echodir,absdir)
+- added "geti" message for retrieval of a value at an index
0.1.0:
- first public release