aboutsummaryrefslogtreecommitdiff
path: root/externals/grill
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2008-01-03 16:06:07 +0000
committerThomas Grill <xovo@users.sourceforge.net>2008-01-03 16:06:07 +0000
commit5e78a38d9cecc1eafced1fedcac889023c6cfa6b (patch)
tree1e6061f0ea4be5a8a622b14f7615ea794c9a2d8f /externals/grill
parent019c0e56579fe7f94982434d8efcd7b00d8df0aa (diff)
clarify usage of absdir flag for file operations
fixed buffer overrun problems some assertions added success/error reporting for file operations got rid of type abbreviations changed obviously buggy pool name registering svn path=/trunk/; revision=9119
Diffstat (limited to 'externals/grill')
-rw-r--r--externals/grill/pool/pool-help.pd12
-rw-r--r--externals/grill/pool/pool.vcproj4
-rw-r--r--externals/grill/pool/readme.txt3
-rw-r--r--externals/grill/pool/source/data.cpp47
-rw-r--r--externals/grill/pool/source/main.cpp348
-rw-r--r--externals/grill/pool/source/pool.cpp212
-rw-r--r--externals/grill/pool/source/pool.h171
7 files changed, 401 insertions, 396 deletions
diff --git a/externals/grill/pool/pool-help.pd b/externals/grill/pool/pool-help.pd
index 4ddde71c..8b55ecb3 100644
--- a/externals/grill/pool/pool-help.pd
+++ b/externals/grill/pool/pool-help.pd
@@ -1,4 +1,4 @@
-#N canvas 24 27 964 785 12;
+#N canvas 24 27 968 789 12;
#X msg 296 105 set 1 2 3;
#X obj 238 631 print K;
#X msg 607 211 getall;
@@ -239,8 +239,6 @@ absdir=0 means relative paths.;
#X msg 295 276 seti 3 Uhu;
#X text 424 343 clear value at index;
#X msg 425 363 clri 2;
-#X text 272 13 a hierarchical storage object \, (C)2002-2006 Thomas
-Grill;
#X text 713 523 output ordering;
#N canvas 285 155 534 455 ordered 0;
#X obj 24 284 s \$0-pool;
@@ -276,6 +274,8 @@ you should not input data as a direct reaction upon output.;
#X obj 294 552 route bang;
#X obj 499 666 print ------------;
#X text 503 646 separator on bang;
+#X text 272 13 a hierarchical storage object \, (C)2002-2008 Thomas
+Grill;
#X connect 0 0 67 0;
#X connect 2 0 67 0;
#X connect 3 0 67 0;
@@ -306,7 +306,7 @@ you should not input data as a direct reaction upon output.;
#X connect 67 0 4 0;
#X connect 67 1 1 0;
#X connect 67 2 5 0;
-#X connect 67 3 92 0;
+#X connect 67 3 91 0;
#X connect 67 4 60 0;
#X connect 70 0 67 0;
#X connect 71 0 67 0;
@@ -315,5 +315,5 @@ you should not input data as a direct reaction upon output.;
#X connect 79 0 77 0;
#X connect 82 0 67 0;
#X connect 84 0 67 0;
-#X connect 92 0 93 0;
-#X connect 92 1 90 0;
+#X connect 91 0 92 0;
+#X connect 91 1 89 0;
diff --git a/externals/grill/pool/pool.vcproj b/externals/grill/pool/pool.vcproj
index 7aece276..59ecc423 100644
--- a/externals/grill/pool/pool.vcproj
+++ b/externals/grill/pool/pool.vcproj
@@ -88,7 +88,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="&quot;c:\data\pd\pd-cvs\src&quot;;..\flext\source"
+ AdditionalIncludeDirectories="&quot;c:\programme\pd-0.40-2\src&quot;;..\flext\source"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FLEXT_SYS=2"
StringPooling="TRUE"
BasicRuntimeChecks="3"
@@ -111,7 +111,7 @@
OutputFile="$(outdir)/pool.dll"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
- AdditionalLibraryDirectories="c:\data\pd\pd-cvs\bin"
+ AdditionalLibraryDirectories="c:\programme\pd-0.40-2\bin"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(outdir)/pool.pdb"
ImportLibrary="$(outdir)/pool.lib"
diff --git a/externals/grill/pool/readme.txt b/externals/grill/pool/readme.txt
index f4905980..511614b5 100644
--- a/externals/grill/pool/readme.txt
+++ b/externals/grill/pool/readme.txt
@@ -1,6 +1,6 @@
pool - a hierarchical storage object for PD and Max/MSP
-Copyright (c) 2002-2006 Thomas Grill (gr@grrrr.org)
+Copyright (c) 2002-2008 Thomas Grill (gr@grrrr.org)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
@@ -87,6 +87,7 @@ Version history:
- fixed handling of non-ASCII-characters
- XML files are now encoded UTF-8
- implemented output sorting (ogetall, ogetrec, ogetsub)
+- fixed some potential buffer overrun problems
0.2.1:
- fixed "cntsub"... directories in current directory have been forgotten
diff --git a/externals/grill/pool/source/data.cpp b/externals/grill/pool/source/data.cpp
index decfc436..de5d555e 100644
--- a/externals/grill/pool/source/data.cpp
+++ b/externals/grill/pool/source/data.cpp
@@ -1,15 +1,16 @@
/*
-
pool - hierarchical storage object for PD and Max/MSP
-Copyright (c) 2002-2006 Thomas Grill (gr@grrrr.org)
+Copyright (c) 2002-2008 Thomas Grill (gr@grrrr.org)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
+$LastChangedRevision: 26 $
+$LastChangedDate: 2008-01-03 16:14:29 +0100 (Thu, 03 Jan 2008) $
+$LastChangedBy: thomas $
*/
#include "pool.h"
-
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
@@ -17,7 +18,7 @@ WARRANTIES, see the file, "license.txt," in this distribution.
using namespace std;
-pooldata::pooldata(const S *s,I vcnt,I dcnt):
+pooldata::pooldata(const t_symbol *s,int vcnt,int dcnt):
sym(s),nxt(NULL),refs(0),
root(nullatom,NULL,vcnt,dcnt)
{
@@ -30,9 +31,9 @@ pooldata::~pooldata()
}
-const A pooldata::nullatom = { A_NULL };
+const t_atom pooldata::nullatom = { A_NULL };
-I pooldata::GetAll(const AtomList &d,A *&keys,Atoms *&lst)
+int pooldata::GetAll(const AtomList &d,t_atom *&keys,Atoms *&lst)
{
pooldir *pd = root.GetDir(d);
if(pd)
@@ -43,7 +44,7 @@ I pooldata::GetAll(const AtomList &d,A *&keys,Atoms *&lst)
}
}
-I pooldata::PrintAll(const AtomList &d)
+int pooldata::PrintAll(const AtomList &d)
{
char tmp[1024];
d.Print(tmp,sizeof tmp);
@@ -54,7 +55,7 @@ I pooldata::PrintAll(const AtomList &d)
return cnt;
}
-I pooldata::GetSub(const AtomList &d,const t_atom **&dirs)
+int pooldata::GetSub(const AtomList &d,const t_atom **&dirs)
{
pooldir *pd = root.GetDir(d);
if(pd)
@@ -66,13 +67,13 @@ I pooldata::GetSub(const AtomList &d,const t_atom **&dirs)
}
-BL pooldata::Paste(const AtomList &d,const pooldir *clip,I depth,BL repl,BL mkdir)
+bool pooldata::Paste(const AtomList &d,const pooldir *clip,int depth,bool repl,bool mkdir)
{
pooldir *pd = root.GetDir(d);
return pd && pd->Paste(clip,depth,repl,mkdir);
}
-pooldir *pooldata::Copy(const AtomList &d,const A &key,BL cut)
+pooldir *pooldata::Copy(const AtomList &d,const t_atom &key,bool cut)
{
pooldir *pd = root.GetDir(d);
if(pd) {
@@ -89,7 +90,7 @@ pooldir *pooldata::Copy(const AtomList &d,const A &key,BL cut)
return NULL;
}
-pooldir *pooldata::CopyAll(const AtomList &d,I depth,BL cut)
+pooldir *pooldata::CopyAll(const AtomList &d,int depth,bool cut)
{
pooldir *pd = root.GetDir(d);
if(pd) {
@@ -125,7 +126,7 @@ bool pooldata::LdDir(const AtomList &d,const char *flnm,int depth,bool mkdir)
{
pooldir *pd = root.GetDir(d);
if(pd) {
- char tmp[1024];
+ char tmp[1024]; // CnvFlnm checks for size of string buffer
const char *t = CnvFlnm(tmp,flnm,sizeof tmp);
if(t) {
ifstream file(t);
@@ -137,12 +138,12 @@ bool pooldata::LdDir(const AtomList &d,const char *flnm,int depth,bool mkdir)
return false;
}
-BL pooldata::SvDir(const AtomList &d,const C *flnm,I depth,BL absdir)
+bool pooldata::SvDir(const AtomList &d,const char *flnm,int depth,bool absdir)
{
pooldir *pd = root.GetDir(d);
if(pd) {
- C tmp[1024];
- const C *t = CnvFlnm(tmp,flnm,sizeof tmp);
+ char tmp[1024]; // CnvFlnm checks for size of string buffer
+ const char *t = CnvFlnm(tmp,flnm,sizeof tmp);
if(t) {
ofstream file(t);
Atoms tmp;
@@ -155,15 +156,15 @@ 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)
+bool pooldata::LdDirXML(const AtomList &d,const char *flnm,int depth,bool mkdir)
{
pooldir *pd = root.GetDir(d);
if(pd) {
- C tmp[1024];
- const C *t = CnvFlnm(tmp,flnm,sizeof tmp);
+ char tmp[1024]; // CnvFlnm checks for size of string buffer
+ const char *t = CnvFlnm(tmp,flnm,sizeof tmp);
if(t) {
ifstream file(t);
- BL ret = file.good() != 0;
+ bool ret = file.good() != 0;
if(ret) {
file.getline(tmp,sizeof tmp);
ret = !strncmp(tmp,"<?xml",5);
@@ -184,12 +185,12 @@ BL pooldata::LdDirXML(const AtomList &d,const C *flnm,I depth,BL mkdir)
return false;
}
-BL pooldata::SvDirXML(const AtomList &d,const C *flnm,I depth,BL absdir)
+bool pooldata::SvDirXML(const AtomList &d,const char *flnm,int depth,bool absdir)
{
pooldir *pd = root.GetDir(d);
if(pd) {
- C tmp[1024];
- const C *t = CnvFlnm(tmp,flnm,sizeof tmp);
+ char tmp[1024]; // CnvFlnm checks for size of string buffer
+ const char *t = CnvFlnm(tmp,flnm,sizeof tmp);
if(t) {
ofstream file(t);
Atoms tmp;
@@ -198,7 +199,7 @@ BL pooldata::SvDirXML(const AtomList &d,const C *flnm,I depth,BL absdir)
file << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl;
file << "<!DOCTYPE pool SYSTEM \"http://grrrr.org/ext/pool/pool-0.2.dtd\">" << endl;
file << "<pool>" << endl;
- BL ret = pd->SvDirXML(file,depth,tmp);
+ bool ret = pd->SvDirXML(file,depth,tmp);
file << "</pool>" << endl;
return ret;
}
diff --git a/externals/grill/pool/source/main.cpp b/externals/grill/pool/source/main.cpp
index 02d617b7..3b262113 100644
--- a/externals/grill/pool/source/main.cpp
+++ b/externals/grill/pool/source/main.cpp
@@ -1,11 +1,13 @@
/*
-
pool - hierarchical storage object for PD and Max/MSP
-Copyright (c) 2002-2006 Thomas Grill (gr@grrrr.org)
+Copyright (c) 2002-2008 Thomas Grill (gr@grrrr.org)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
+$LastChangedRevision: 26 $
+$LastChangedDate: 2008-01-03 16:14:29 +0100 (Thu, 03 Jan 2008) $
+$LastChangedBy: thomas $
*/
#include "pool.h"
@@ -24,148 +26,148 @@ class pool:
FLEXT_HEADER_S(pool,flext_base,setup)
public:
- pool(I argc,const A *argv);
+ pool(int argc,const t_atom *argv);
virtual ~pool();
- static V setup(t_classid);
+ static void setup(t_classid);
- virtual BL Init();
+ virtual bool Init();
pooldata *Pool() { return pl; }
protected:
// switch to other pool
- V ms_pool(const AtomList &l);
- V mg_pool(AtomList &l);
+ void ms_pool(const AtomList &l);
+ void mg_pool(AtomList &l);
- V mg_priv(bool &p) const { p = pl && pl->Private(); }
+ void mg_priv(bool &p) const { p = pl && pl->Private(); }
// print some help message
- static V m_help() { post("pool " POOL_VERSION " - hierarchical storage object, (C)2002-2006 Thomas Grill"); }
+ static void m_help() { post("pool " POOL_VERSION " - hierarchical storage object, (C)2002-2008 Thomas Grill"); }
// clear all data in pool
- V m_reset();
+ void m_reset();
// handle directories
- V m_getdir();
+ void m_getdir();
- V m_mkdir(I argc,const A *argv,BL abs = true,BL chg = false); // make (and change) to dir
- V m_mkchdir(I argc,const A *argv) { m_mkdir(argc,argv,true,true); } // make and change to dir
- V m_chdir(I argc,const A *argv,BL abs = true); // change to dir
- V m_rmdir(I argc,const A *argv,BL abs = true); // remove dir
- V m_updir(I argc,const A *argv); // one or more levels up
+ void m_mkdir(int argc,const t_atom *argv,bool abs = true,bool chg = false); // make (and change) to dir
+ void m_mkchdir(int argc,const t_atom *argv) { m_mkdir(argc,argv,true,true); } // make and change to dir
+ void m_chdir(int argc,const t_atom *argv,bool abs = true); // change to dir
+ void m_rmdir(int argc,const t_atom *argv,bool abs = true); // remove dir
+ void m_updir(int argc,const t_atom *argv); // one or more levels up
- V ms_curdir(const AtomList &l) { m_chdir(l.Count(),l.Atoms()); }
+ void ms_curdir(const AtomList &l) { m_chdir(l.Count(),l.Atoms()); }
- V m_mksub(I argc,const A *argv) { m_mkdir(argc,argv,false); }
- V m_mkchsub(I argc,const A *argv) { m_mkdir(argc,argv,false,true); }
- V m_chsub(I argc,const A *argv) { m_chdir(argc,argv,false); }
- V m_rmsub(I argc,const A *argv) { m_rmdir(argc,argv,false); }
+ void m_mksub(int argc,const t_atom *argv) { m_mkdir(argc,argv,false); }
+ void m_mkchsub(int argc,const t_atom *argv) { m_mkdir(argc,argv,false,true); }
+ void m_chsub(int argc,const t_atom *argv) { m_chdir(argc,argv,false); }
+ void m_rmsub(int argc,const t_atom *argv) { m_rmdir(argc,argv,false); }
// handle data
- V m_set(I argc,const A *argv) { set(argc,argv,true); }
- V m_seti(I argc,const A *argv); // set value at index
- V m_add(I argc,const A *argv) { set(argc,argv,false); }
- V m_clr(I argc,const A *argv);
- V m_clri(I ix); // clear value at index
- V m_clrall(); // only values
- 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
- V m_ogetall(int argc,const A *argv); // 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
+ void m_set(int argc,const t_atom *argv) { set(argc,argv,true); }
+ void m_seti(int argc,const t_atom *argv); // set value at index
+ void m_add(int argc,const t_atom *argv) { set(argc,argv,false); }
+ void m_clr(int argc,const t_atom *argv);
+ void m_clri(int ix); // clear value at index
+ void m_clrall(); // only values
+ void m_clrrec(); // also subdirectories
+ void m_clrsub(); // only subdirectories
+ void m_get(int argc,const t_atom *argv);
+ void m_geti(int ix); // get value at index
+ void m_getall(); // only values
+ void m_getrec(int argc,const t_atom *argv); // also subdirectories
+ void m_getsub(int argc,const t_atom *argv); // only subdirectories
+ void m_ogetall(int argc,const t_atom *argv); // only values (ordered)
+ void m_ogetrec(int argc,const t_atom *argv); // also subdirectories (ordered)
+ void m_ogetsub(int argc,const t_atom *argv); // only subdirectories (ordered)
+ void m_cntall(); // only values
+ void m_cntrec(int argc,const t_atom *argv); // also subdirectories
+ void m_cntsub(int argc,const t_atom *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
+ void m_printall(); // print values in current dir
+ void m_printrec(int argc,const t_atom *argv,bool fromroot = false); // print values recursively
+ void m_printroot() { m_printrec(0,NULL,true); } // print values recursively from root
// cut/copy/paste
- V m_paste(I argc,const A *argv) { paste(thisTag(),argc,argv,true); } // paste contents of clipboard
- V m_pasteadd(I argc,const A *argv) { paste(thisTag(),argc,argv,false); } // paste but don't replace
- V m_clrclip(); // clear clipboard
- V m_cut(I argc,const A *argv) { copy(thisTag(),argc,argv,true); } // cut value into clipboard
- V m_copy(I argc,const A *argv) { copy(thisTag(),argc,argv,false); } // copy value into clipboard
- V m_cutall() { copyall(thisTag(),true,0); } // cut all values in current directory into clipboard
- V m_copyall() { copyall(thisTag(),false,0); } // copy all values in current directory into clipboard
- V m_cutrec(I argc,const A *argv) { copyrec(thisTag(),argc,argv,true); } // cut directory (and subdirs) into clipboard
- V m_copyrec(I argc,const A *argv) { copyrec(thisTag(),argc,argv,false); } // cut directory (and subdirs) into clipboard
+ void m_paste(int argc,const t_atom *argv) { paste(thisTag(),argc,argv,true); } // paste contents of clipboard
+ void m_pasteadd(int argc,const t_atom *argv) { paste(thisTag(),argc,argv,false); } // paste but don't replace
+ void m_clrclip(); // clear clipboard
+ void m_cut(int argc,const t_atom *argv) { copy(thisTag(),argc,argv,true); } // cut value into clipboard
+ void m_copy(int argc,const t_atom *argv) { copy(thisTag(),argc,argv,false); } // copy value into clipboard
+ void m_cutall() { copyall(thisTag(),true,0); } // cut all values in current directory into clipboard
+ void m_copyall() { copyall(thisTag(),false,0); } // copy all values in current directory into clipboard
+ void m_cutrec(int argc,const t_atom *argv) { copyrec(thisTag(),argc,argv,true); } // cut directory (and subdirs) into clipboard
+ void m_copyrec(int argc,const t_atom *argv) { copyrec(thisTag(),argc,argv,false); } // cut directory (and subdirs) into clipboard
// load/save from/to file
- 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
+ void m_load(int argc,const t_atom *argv) { load(argc,argv,false); }
+ void m_save(int argc,const t_atom *argv) { save(argc,argv,false); }
+ void m_loadx(int argc,const t_atom *argv) { load(argc,argv,true); } // XML
+ void m_savex(int argc,const t_atom *argv) { save(argc,argv,true); } // XML
// load directories
- 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)
+ void m_lddir(int argc,const t_atom *argv) { lddir(argc,argv,false); } // load values into current dir
+ void m_ldrec(int argc,const t_atom *argv) { ldrec(argc,argv,false); } // load values recursively
+ void m_ldxdir(int argc,const t_atom *argv) { lddir(argc,argv,true); } // load values into current dir (XML)
+ void m_ldxrec(int argc,const t_atom *argv) { ldrec(argc,argv,true); } // load values recursively (XML)
// save directories
- 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)
+ void m_svdir(int argc,const t_atom *argv) { svdir(argc,argv,false); } // save values in current dir
+ void m_svrec(int argc,const t_atom *argv) { svrec(argc,argv,false); } // save values recursively
+ void m_svxdir(int argc,const t_atom *argv) { svdir(argc,argv,true); } // save values in current dir (XML)
+ void m_svxrec(int argc,const t_atom *argv) { svrec(argc,argv,true); } // save values recursively (XML)
private:
- static BL KeyChk(const A &a);
- static BL ValChk(I argc,const A *argv);
- static BL ValChk(const AtomList &l) { return ValChk(l.Count(),l.Atoms()); }
- V ToOutAtom(I ix,const A &a);
+ static bool KeyChk(const t_atom &a);
+ static bool ValChk(int argc,const t_atom *argv);
+ static bool ValChk(const AtomList &l) { return ValChk(l.Count(),l.Atoms()); }
+ void ToOutAtom(int ix,const t_atom &a);
static const t_symbol *sym_echo;
static const t_symbol *sym_error;
enum get_t { get_norm,get_cnt,get_print };
- V set(I argc,const A *argv,BL over);
- V getdir(const S *tag);
- int getrec(const S *tag,int level,int order,bool rev,get_t how /*= get_norm*/,const AtomList &rdir);
- int getsub(const S *tag,int level,int order,bool rev,get_t how /*= get_norm*/,const AtomList &rdir);
+ void set(int argc,const t_atom *argv,bool over);
+ void getdir(const t_symbol *tag);
+ int getrec(const t_symbol *tag,int level,int order,bool rev,get_t how /*= get_norm*/,const AtomList &rdir);
+ int getsub(const t_symbol *tag,int level,int order,bool rev,get_t how /*= get_norm*/,const AtomList &rdir);
- 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);
+ void paste(const t_symbol *tag,int argc,const t_atom *argv,bool repl);
+ void copy(const t_symbol *tag,int argc,const t_atom *argv,bool cut);
+ void copyall(const t_symbol *tag,bool cut,int lvls);
+ void copyrec(const t_symbol *tag,int argc,const t_atom *argv,bool 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
+ void load(int argc,const t_atom *argv,bool xml);
+ void save(int argc,const t_atom *argv,bool xml);
+ void lddir(int argc,const t_atom *argv,bool xml); // load values into current dir
+ void ldrec(int argc,const t_atom *argv,bool xml); // load values recursively
+ void svdir(int argc,const t_atom *argv,bool xml); // save values in current dir
+ void svrec(int argc,const t_atom *argv,bool xml); // save values recursively
- V echodir() { if(echo) getdir(sym_echo); }
+ void echodir() { if(echo) getdir(sym_echo); }
- BL absdir,echo;
- I vcnt,dcnt;
+ bool absdir,echo;
+ int vcnt,dcnt;
pooldata *pl;
Atoms curdir;
pooldir *clip;
- static const S *holdname; // used during initialization of new object (between constructor and Init method)
+ static const t_symbol *holdname; // used during initialization of new object (between constructor and Init method)
typedef std::map<const t_symbol *,pooldata *> PoolMap;
static PoolMap poolmap;
- V SetPool(const S *s);
- V FreePool();
+ void SetPool(const t_symbol *s);
+ void FreePool();
- static pooldata *GetPool(const S *s);
- static V RmvPool(pooldata *p);
+ static pooldata *GetPool(const t_symbol *s);
+ static void RmvPool(pooldata *p);
- string MakeFilename(const C *fn) const;
+ string MakeFilename(const char *fn) const;
FLEXT_CALLVAR_V(mg_pool,ms_pool)
FLEXT_ATTRGET_V(curdir)
@@ -246,7 +248,7 @@ const t_symbol *pool::sym_echo,*pool::sym_error;
const t_symbol *pool::holdname;
-V pool::setup(t_classid c)
+void pool::setup(t_classid c)
{
post("");
pool::m_help();
@@ -324,7 +326,7 @@ V pool::setup(t_classid c)
FLEXT_CADDMETHOD_(c,0,"svxrec",m_svxrec);
}
-pool::pool(I argc,const A *argv):
+pool::pool(int argc,const t_atom *argv):
absdir(true),echo(false),
pl(NULL),
clip(NULL),
@@ -344,7 +346,7 @@ pool::~pool()
FreePool();
}
-BL pool::Init()
+bool pool::Init()
{
if(flext_base::Init()) {
SetPool(holdname);
@@ -353,7 +355,7 @@ BL pool::Init()
else return false;
}
-V pool::SetPool(const S *s)
+void pool::SetPool(const t_symbol *s)
{
if(s) {
if(pl)
@@ -376,7 +378,7 @@ V pool::SetPool(const S *s)
}
}
-V pool::FreePool()
+void pool::FreePool()
{
curdir(); // reset current directory
@@ -391,9 +393,9 @@ V pool::FreePool()
if(clip) { delete clip; clip = NULL; }
}
-V pool::ms_pool(const AtomList &l)
+void pool::ms_pool(const AtomList &l)
{
- const S *s = NULL;
+ const t_symbol *s = NULL;
if(l.Count()) {
if(l.Count() > 1) post("%s - pool: superfluous arguments ignored",thisName());
s = GetASymbol(l[0]);
@@ -403,28 +405,28 @@ V pool::ms_pool(const AtomList &l)
SetPool(s);
}
-V pool::mg_pool(AtomList &l)
+void pool::mg_pool(AtomList &l)
{
if(!pl || pl->Private()) l();
else { l(1); SetSymbol(l[0],pl->sym); }
}
-V pool::m_reset()
+void pool::m_reset()
{
curdir();
pl->Reset();
}
-V pool::getdir(const S *tag)
+void pool::getdir(const t_symbol *tag)
{
ToSysAnything(3,tag,0,NULL);
ToSysList(2,curdir);
}
-V pool::m_getdir() { getdir(thisTag()); }
+void pool::m_getdir() { getdir(thisTag()); }
-V pool::m_mkdir(I argc,const A *argv,BL abs,BL chg)
+void pool::m_mkdir(int argc,const t_atom *argv,bool abs,bool chg)
{
// const char *nm = chg?"mkchdir":"mkdir";
if(!ValChk(argc,argv))
@@ -444,7 +446,7 @@ V pool::m_mkdir(I argc,const A *argv,BL abs,BL chg)
echodir();
}
-V pool::m_chdir(I argc,const A *argv,BL abs)
+void pool::m_chdir(int argc,const t_atom *argv,bool abs)
{
if(!ValChk(argc,argv))
post("%s - %s: invalid directory name",thisName(),GetString(thisTag()));
@@ -461,9 +463,9 @@ V pool::m_chdir(I argc,const A *argv,BL abs)
echodir();
}
-V pool::m_updir(I argc,const A *argv)
+void pool::m_updir(int argc,const t_atom *argv)
{
- I lvls = 1;
+ int lvls = 1;
if(argc > 0) {
if(CanbeInt(argv[0])) {
if(argc > 1)
@@ -493,7 +495,7 @@ V pool::m_updir(I argc,const A *argv)
echodir();
}
-V pool::m_rmdir(I argc,const A *argv,BL abs)
+void pool::m_rmdir(int argc,const t_atom *argv,bool abs)
{
if(abs) curdir(argc,argv);
else curdir.Append(argc,argv);
@@ -505,7 +507,7 @@ V pool::m_rmdir(I argc,const A *argv,BL abs)
echodir();
}
-V pool::set(I argc,const A *argv,BL over)
+void pool::set(int argc,const t_atom *argv,bool over)
{
if(!argc || !KeyChk(argv[0]))
post("%s - %s: invalid key",thisName(),GetString(thisTag()));
@@ -519,7 +521,7 @@ V pool::set(I argc,const A *argv,BL over)
echodir();
}
-V pool::m_seti(I argc,const A *argv)
+void pool::m_seti(int argc,const t_atom *argv)
{
if(!argc || !CanbeInt(argv[0]))
post("%s - %s: invalid index",thisName(),GetString(thisTag()));
@@ -533,7 +535,7 @@ V pool::m_seti(I argc,const A *argv)
echodir();
}
-V pool::m_clr(I argc,const A *argv)
+void pool::m_clr(int argc,const t_atom *argv)
{
if(!argc || !KeyChk(argv[0]))
post("%s - %s: invalid key",thisName(),GetString(thisTag()));
@@ -548,7 +550,7 @@ V pool::m_clr(I argc,const A *argv)
echodir();
}
-V pool::m_clri(I ix)
+void pool::m_clri(int ix)
{
if(ix < 0)
post("%s - %s: invalid index",thisName(),GetString(thisTag()));
@@ -560,7 +562,7 @@ V pool::m_clri(I ix)
echodir();
}
-V pool::m_clrall()
+void pool::m_clrall()
{
if(!pl->ClrAll(curdir,false))
post("%s - %s: values couldn't be cleared",thisName(),GetString(thisTag()));
@@ -568,7 +570,7 @@ V pool::m_clrall()
echodir();
}
-V pool::m_clrrec()
+void pool::m_clrrec()
{
if(!pl->ClrAll(curdir,true))
post("%s - %s: values couldn't be cleared",thisName(),GetString(thisTag()));
@@ -576,7 +578,7 @@ V pool::m_clrrec()
echodir();
}
-V pool::m_clrsub()
+void pool::m_clrsub()
{
if(!pl->ClrAll(curdir,true,true))
post("%s - %s: directories couldn't be cleared",thisName(),GetString(thisTag()));
@@ -584,7 +586,7 @@ V pool::m_clrsub()
echodir();
}
-V pool::m_get(I argc,const A *argv)
+void pool::m_get(int argc,const t_atom *argv)
{
if(!argc || !KeyChk(argv[0]))
post("%s - %s: invalid key",thisName(),GetString(thisTag()));
@@ -612,7 +614,7 @@ V pool::m_get(I argc,const A *argv)
echodir();
}
-V pool::m_geti(I ix)
+void pool::m_geti(int ix)
{
if(ix < 0)
post("%s - %s: invalid index",thisName(),GetString(thisTag()));
@@ -640,11 +642,11 @@ V pool::m_geti(I ix)
// ---- some sorting stuff ----------------------------------
-inline bool smaller(const A &a,const A &b,int index) { return a < b; }
-inline void swap(A &a,A &b) { A c = a; a = b; b = c; }
+inline bool smaller(const t_atom &a,const t_atom &b,int index) { return a < b; }
+inline void swap(t_atom &a,t_atom &b) { t_atom c = a; a = b; b = c; }
-inline bool smaller(const A *a,const A *b,int index) { return *a < *b; }
-inline void swap(A *a,A *b) { A *c = a; a = b; b = c; }
+inline bool smaller(const t_atom *a,const t_atom *b,int index) { return *a < *b; }
+inline void swap(t_atom *a,t_atom *b) { t_atom *c = a; a = b; b = c; }
inline bool smaller(const Atoms &a,const Atoms &b,int index)
{
@@ -728,7 +730,7 @@ int pool::getrec(const t_symbol *tag,int level,int order,bool rev,get_t how,cons
ret = pl->PrintAll(gldir);
break;
case get_norm: {
- A *k;
+ t_atom *k;
Atoms *r;
int cnt = pl->GetAll(gldir,k,r);
if(!k) {
@@ -755,7 +757,7 @@ int pool::getrec(const t_symbol *tag,int level,int order,bool rev,get_t how,cons
}
if(level != 0) {
- const A **r;
+ const t_atom **r;
int cnt = pl->GetSub(gldir,r);
if(!r)
post("%s - %s: error retrieving directories",thisName(),GetString(tag));
@@ -775,7 +777,7 @@ int pool::getrec(const t_symbol *tag,int level,int order,bool rev,get_t how,cons
return ret;
}
-V pool::m_getall()
+void pool::m_getall()
{
AtomList l;
getrec(thisTag(),0,-1,false,get_norm,l);
@@ -784,7 +786,7 @@ V pool::m_getall()
echodir();
}
-V pool::m_ogetall(I argc,const A *argv)
+void pool::m_ogetall(int argc,const t_atom *argv)
{
int index = 0;
if(argc) {
@@ -814,7 +816,7 @@ V pool::m_ogetall(I argc,const A *argv)
echodir();
}
-V pool::m_getrec(I argc,const A *argv)
+void pool::m_getrec(int argc,const t_atom *argv)
{
int lvls = -1;
if(argc) {
@@ -836,7 +838,7 @@ V pool::m_getrec(I argc,const A *argv)
}
-V pool::m_ogetrec(I argc,const A *argv)
+void pool::m_ogetrec(int argc,const t_atom *argv)
{
int lvls = -1;
if(argc) {
@@ -876,14 +878,14 @@ V pool::m_ogetrec(I argc,const A *argv)
}
-int pool::getsub(const S *tag,int level,int order,bool rev,get_t how,const AtomList &rdir)
+int pool::getsub(const t_symbol *tag,int level,int order,bool rev,get_t how,const AtomList &rdir)
{
Atoms gldir(curdir);
gldir.Append(rdir);
int ret = 0;
- const A **r = NULL;
+ const t_atom **r = NULL;
// CntSub is not used here because it doesn't allow checking for valid directory
int cnt = pl->GetSub(gldir,r);
if(!r)
@@ -916,7 +918,7 @@ int pool::getsub(const S *tag,int level,int order,bool rev,get_t how,const AtomL
return ret;
}
-V pool::m_getsub(int argc,const A *argv)
+void pool::m_getsub(int argc,const t_atom *argv)
{
int lvls = 0;
if(argc) {
@@ -938,7 +940,7 @@ V pool::m_getsub(int argc,const A *argv)
}
-V pool::m_ogetsub(int argc,const A *argv)
+void pool::m_ogetsub(int argc,const t_atom *argv)
{
int lvls = 0;
if(argc) {
@@ -978,10 +980,10 @@ V pool::m_ogetsub(int argc,const A *argv)
}
-V pool::m_cntall()
+void pool::m_cntall()
{
AtomList l;
- I cnt = getrec(thisTag(),0,-1,false,get_cnt,l);
+ int cnt = getrec(thisTag(),0,-1,false,get_cnt,l);
ToSysSymbol(3,thisTag());
ToSysBang(2);
ToSysBang(1);
@@ -990,7 +992,7 @@ V pool::m_cntall()
echodir();
}
-V pool::m_cntrec(int argc,const A *argv)
+void pool::m_cntrec(int argc,const t_atom *argv)
{
int lvls = -1;
if(argc) {
@@ -1005,7 +1007,7 @@ V pool::m_cntrec(int argc,const A *argv)
post("%s - %s: superfluous arguments ignored",thisName(),GetString(thisTag()));
AtomList l;
- I cnt = getrec(thisTag(),lvls,-1,false,get_cnt,l);
+ int cnt = getrec(thisTag(),lvls,-1,false,get_cnt,l);
ToSysSymbol(3,thisTag());
ToSysBang(2);
ToSysBang(1);
@@ -1015,7 +1017,7 @@ V pool::m_cntrec(int argc,const A *argv)
}
-V pool::m_cntsub(I argc,const A *argv)
+void pool::m_cntsub(int argc,const t_atom *argv)
{
int lvls = 0;
if(argc) {
@@ -1030,7 +1032,7 @@ V pool::m_cntsub(I argc,const A *argv)
post("%s - %s: superfluous arguments ignored",thisName(),GetString(thisTag()));
AtomList l;
- I cnt = getsub(thisTag(),lvls,-1,false,get_cnt,l);
+ int cnt = getsub(thisTag(),lvls,-1,false,get_cnt,l);
ToSysSymbol(3,thisTag());
ToSysBang(2);
ToSysBang(1);
@@ -1039,16 +1041,16 @@ V pool::m_cntsub(I argc,const A *argv)
echodir();
}
-V pool::m_printall()
+void pool::m_printall()
{
AtomList l;
- I cnt = getrec(thisTag(),0,-1,false,get_print,l);
+ int cnt = getrec(thisTag(),0,-1,false,get_print,l);
post("");
}
-V pool::m_printrec(I argc,const A *argv,BL fromroot)
+void pool::m_printrec(int argc,const t_atom *argv,bool fromroot)
{
- const S *tag = thisTag();
+ const t_symbol *tag = thisTag();
int lvls = -1;
if(argc) {
@@ -1066,18 +1068,18 @@ V pool::m_printrec(I argc,const A *argv,BL fromroot)
if(fromroot) curdir.Clear();
AtomList l;
- I cnt = getrec(tag,lvls,-1,false,get_print,l);
+ int cnt = getrec(tag,lvls,-1,false,get_print,l);
post("");
curdir = svdir;
}
-V pool::paste(const S *tag,I argc,const A *argv,BL repl)
+void pool::paste(const t_symbol *tag,int argc,const t_atom *argv,bool repl)
{
if(clip) {
- BL mkdir = true;
- I depth = -1;
+ bool mkdir = true;
+ int depth = -1;
if(argc >= 1) {
if(CanbeInt(argv[0])) depth = GetAInt(argv[1]);
@@ -1102,13 +1104,13 @@ V pool::paste(const S *tag,I argc,const A *argv,BL repl)
}
-V pool::m_clrclip()
+void pool::m_clrclip()
{
if(clip) { delete clip; clip = NULL; }
}
-V pool::copy(const S *tag,I argc,const A *argv,BL cut)
+void pool::copy(const t_symbol *tag,int argc,const t_atom *argv,bool cut)
{
if(!argc || !KeyChk(argv[0]))
post("%s - %s: invalid key",thisName(),GetString(tag));
@@ -1127,7 +1129,7 @@ V pool::copy(const S *tag,I argc,const A *argv,BL cut)
}
-V pool::copyall(const S *tag,BL cut,I depth)
+void pool::copyall(const t_symbol *tag,bool cut,int depth)
{
m_clrclip();
clip = pl->CopyAll(curdir,depth,cut);
@@ -1139,9 +1141,9 @@ V pool::copyall(const S *tag,BL cut,I depth)
}
-V pool::copyrec(const S *tag,I argc,const A *argv,BL cut)
+void pool::copyrec(const t_symbol *tag,int argc,const t_atom *argv,bool cut)
{
- I lvls = -1;
+ int lvls = -1;
if(argc > 0) {
if(CanbeInt(argv[0])) {
if(argc > 1)
@@ -1155,9 +1157,9 @@ V pool::copyrec(const S *tag,I argc,const A *argv,BL cut)
copyall(tag,cut,lvls);
}
-V pool::load(I argc,const A *argv,BL xml)
+void pool::load(int argc,const t_atom *argv,bool xml)
{
- const C *flnm = NULL;
+ const char *flnm = NULL;
if(argc > 0) {
if(argc > 1) post("%s - %s: superfluous arguments ignored",thisName(),GetString(thisTag()));
if(IsString(argv[0])) flnm = GetString(argv[0]);
@@ -1179,9 +1181,9 @@ V pool::load(I argc,const A *argv,BL xml)
echodir();
}
-V pool::save(I argc,const A *argv,BL xml)
+void pool::save(int argc,const t_atom *argv,bool xml)
{
- const C *flnm = NULL;
+ const char *flnm = NULL;
if(argc > 0) {
if(argc > 1) post("%s - %s: superfluous arguments ignored",thisName(),GetString(thisTag()));
if(IsString(argv[0])) flnm = GetString(argv[0]);
@@ -1203,9 +1205,9 @@ V pool::save(I argc,const A *argv,BL xml)
echodir();
}
-V pool::lddir(I argc,const A *argv,BL xml)
+void pool::lddir(int argc,const t_atom *argv,bool xml)
{
- const C *flnm = NULL;
+ const char *flnm = NULL;
if(argc > 0) {
if(argc > 1) post("%s - %s: superfluous arguments ignored",thisName(),GetString(thisTag()));
if(IsString(argv[0])) flnm = GetString(argv[0]);
@@ -1227,11 +1229,11 @@ V pool::lddir(I argc,const A *argv,BL xml)
echodir();
}
-V pool::ldrec(I argc,const A *argv,BL xml)
+void pool::ldrec(int argc,const t_atom *argv,bool xml)
{
- const C *flnm = NULL;
- I depth = -1;
- BL mkdir = true;
+ const char *flnm = NULL;
+ int depth = -1;
+ bool mkdir = true;
if(argc >= 1) {
if(IsString(argv[0])) flnm = GetString(argv[0]);
@@ -1266,9 +1268,9 @@ V pool::ldrec(I argc,const A *argv,BL xml)
echodir();
}
-V pool::svdir(I argc,const A *argv,BL xml)
+void pool::svdir(int argc,const t_atom *argv,bool xml)
{
- const C *flnm = NULL;
+ const char *flnm = NULL;
if(argc > 0) {
if(argc > 1) post("%s - %s: superfluous arguments ignored",thisName(),GetString(thisTag()));
if(IsString(argv[0])) flnm = GetString(argv[0]);
@@ -1290,9 +1292,9 @@ V pool::svdir(I argc,const A *argv,BL xml)
echodir();
}
-V pool::svrec(I argc,const A *argv,BL xml)
+void pool::svrec(int argc,const t_atom *argv,bool xml)
{
- const C *flnm = NULL;
+ const char *flnm = NULL;
if(argc > 0) {
if(argc > 1) post("%s - %s: superfluous arguments ignored",thisName(),GetString(thisTag()));
if(IsString(argv[0])) flnm = GetString(argv[0]);
@@ -1316,21 +1318,21 @@ V pool::svrec(I argc,const A *argv,BL xml)
-BL pool::KeyChk(const t_atom &a)
+bool pool::KeyChk(const t_atom &a)
{
return IsSymbol(a) || IsFloat(a) || IsInt(a);
}
-BL pool::ValChk(I argc,const t_atom *argv)
+bool pool::ValChk(int argc,const t_atom *argv)
{
- for(I i = 0; i < argc; ++i) {
+ for(int i = 0; i < argc; ++i) {
const t_atom &a = argv[i];
if(!IsSymbol(a) && !IsFloat(a) && !IsInt(a)) return false;
}
return true;
}
-V pool::ToOutAtom(I ix,const t_atom &a)
+void pool::ToOutAtom(int ix,const t_atom &a)
{
if(IsSymbol(a))
ToSysSymbol(ix,GetSymbol(a));
@@ -1344,7 +1346,7 @@ V pool::ToOutAtom(I ix,const t_atom &a)
-pooldata *pool::GetPool(const S *s)
+pooldata *pool::GetPool(const t_symbol *s)
{
PoolMap::iterator it = poolmap.find(s);
pooldata *p;
@@ -1356,7 +1358,7 @@ pooldata *pool::GetPool(const S *s)
return p;
}
-V pool::RmvPool(pooldata *p)
+void pool::RmvPool(pooldata *p)
{
FLEXT_ASSERT(p->sym);
PoolMap::iterator it = poolmap.find(p->sym);
@@ -1368,20 +1370,20 @@ V pool::RmvPool(pooldata *p)
}
}
-string pool::MakeFilename(const C *fn) const
+string pool::MakeFilename(const char *fn) const
{
#if FLEXT_SYS == FLEXT_SYS_PD
// / and \ must not be mixed!
// (char *) type casts for BorlandC++
- C *sl = strchr((C *)fn,'/');
- if(!sl) sl = strchr((C *)fn,'\\');
+ char *sl = strchr((char *)fn,'/');
+ if(!sl) sl = strchr((char *)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()));
+ const char *p = GetString(canvas_getdir(thisCanvas()));
return string(p)+'/'+fn;
}
else
diff --git a/externals/grill/pool/source/pool.cpp b/externals/grill/pool/source/pool.cpp
index 078fa3d9..23e8517f 100644
--- a/externals/grill/pool/source/pool.cpp
+++ b/externals/grill/pool/source/pool.cpp
@@ -1,19 +1,21 @@
/*
-
pool - hierarchical storage object for PD and Max/MSP
-Copyright (c) 2002-2006 Thomas Grill (gr@grrrr.org)
+Copyright (c) 2002-2008 Thomas Grill (gr@grrrr.org)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
+$LastChangedRevision: 26 $
+$LastChangedDate: 2008-01-03 16:14:29 +0100 (Thu, 03 Jan 2008) $
+$LastChangedBy: thomas $
*/
#include "pool.h"
-
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <fstream>
+#include <vector>
#if FLEXT_OS == FLEXT_OS_WIN
#include <windows.h> // for charset conversion functions
@@ -114,10 +116,10 @@ using namespace std;
-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); }
+inline int compare(int a,int b) { return a == b?0:(a < b?-1:1); }
+inline int compare(float a,float b) { return a == b?0:(a < b?-1:1); }
-static I compare(const S *a,const S *b)
+static int compare(const t_symbol *a,const t_symbol *b)
{
if(a == b)
return 0;
@@ -125,7 +127,7 @@ static I compare(const S *a,const S *b)
return strcmp(flext::GetString(a),flext::GetString(b));
}
-static I compare(const A &a,const A &b)
+static int compare(const t_atom &a,const t_atom &b)
{
if(flext::GetType(a) == flext::GetType(b)) {
switch(flext::GetType(a)) {
@@ -151,7 +153,7 @@ static I compare(const A &a,const A &b)
}
-poolval::poolval(const A &k,AtomList *d):
+poolval::poolval(const t_atom &k,AtomList *d):
data(d),nxt(NULL)
{
SetAtom(key,k);
@@ -177,7 +179,7 @@ poolval *poolval::Dup() const
}
-pooldir::pooldir(const A &d,pooldir *p,I vcnt,I dcnt):
+pooldir::pooldir(const t_atom &d,pooldir *p,int vcnt,int dcnt):
parent(p),nxt(NULL),vals(NULL),dirs(NULL),
vbits(Int2Bits(vcnt)),dbits(Int2Bits(dcnt)),
vsize(1<<vbits),dsize(1<<dbits)
@@ -193,10 +195,10 @@ pooldir::~pooldir()
FLEXT_ASSERT(nxt == NULL);
}
-V pooldir::Clear(BL rec,BL dironly)
+void pooldir::Clear(bool rec,bool dironly)
{
if(rec && dirs) {
- for(I i = 0; i < dsize; ++i) {
+ for(int i = 0; i < dsize; ++i) {
pooldir *d = dirs[i].d,*d1;
if(d) {
do {
@@ -210,7 +212,7 @@ V pooldir::Clear(BL rec,BL dironly)
}
}
if(!dironly && vals) {
- for(I i = 0; i < vsize; ++i) {
+ for(int i = 0; i < vsize; ++i) {
poolval *v = vals[i].v,*v1;
if(v) {
do {
@@ -225,7 +227,7 @@ V pooldir::Clear(BL rec,BL dironly)
}
}
-V pooldir::Reset(BL realloc)
+void pooldir::Reset(bool realloc)
{
Clear(true,false);
@@ -242,11 +244,11 @@ V pooldir::Reset(BL realloc)
dirs = NULL,vals = NULL;
}
-pooldir *pooldir::AddDir(I argc,const A *argv,I vcnt,I dcnt)
+pooldir *pooldir::AddDir(int argc,const t_atom *argv,int vcnt,int dcnt)
{
if(!argc) return this;
- I c = 1,dix = DIdx(argv[0]);
+ int 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);
@@ -266,11 +268,11 @@ pooldir *pooldir::AddDir(I argc,const A *argv,I vcnt,I dcnt)
return ix->AddDir(argc-1,argv+1);
}
-pooldir *pooldir::GetDir(I argc,const A *argv,BL rmv)
+pooldir *pooldir::GetDir(int argc,const t_atom *argv,bool rmv)
{
if(!argc) return this;
- I c = 1,dix = DIdx(argv[0]);
+ int 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);
@@ -295,7 +297,7 @@ pooldir *pooldir::GetDir(I argc,const A *argv,BL rmv)
}
}
-BL pooldir::DelDir(I argc,const A *argv)
+bool pooldir::DelDir(int argc,const t_atom *argv)
{
pooldir *pd = GetDir(argc,argv,true);
if(pd && pd != this) {
@@ -306,9 +308,9 @@ BL pooldir::DelDir(I argc,const A *argv)
return false;
}
-V pooldir::SetVal(const A &key,AtomList *data,BL over)
+void pooldir::SetVal(const t_atom &key,AtomList *data,bool over)
{
- I c = 1,vix = VIdx(key);
+ int c = 1,vix = VIdx(key);
poolval *prv = NULL,*ix = vals[vix].v;
for(; ix; prv = ix,ix = ix->nxt) {
c = compare(key,ix->key);
@@ -345,7 +347,7 @@ V pooldir::SetVal(const A &key,AtomList *data,BL over)
}
}
-BL pooldir::SetVali(I rix,AtomList *data)
+bool pooldir::SetVali(int rix,AtomList *data)
{
poolval *prv = NULL,*ix = NULL;
int vix;
@@ -378,9 +380,9 @@ BL pooldir::SetVali(I rix,AtomList *data)
return false;
}
-poolval *pooldir::RefVal(const A &key)
+poolval *pooldir::RefVal(const t_atom &key)
{
- I c = 1,vix = VIdx(key);
+ int c = 1,vix = VIdx(key);
poolval *ix = vals[vix].v;
for(; ix; ix = ix->nxt) {
c = compare(key,ix->key);
@@ -390,9 +392,9 @@ poolval *pooldir::RefVal(const A &key)
return c || !ix?NULL:ix;
}
-poolval *pooldir::RefVali(I rix)
+poolval *pooldir::RefVali(int rix)
{
- for(I vix = 0; vix < vsize; ++vix)
+ for(int vix = 0; vix < vsize; ++vix)
if(rix > vals[vix].cnt) rix -= vals[vix].cnt;
else {
poolval *ix = vals[vix].v;
@@ -402,15 +404,15 @@ poolval *pooldir::RefVali(I rix)
return NULL;
}
-flext::AtomList *pooldir::PeekVal(const A &key)
+flext::AtomList *pooldir::PeekVal(const t_atom &key)
{
poolval *ix = RefVal(key);
return ix?ix->data:NULL;
}
-flext::AtomList *pooldir::GetVal(const A &key,BL cut)
+flext::AtomList *pooldir::GetVal(const t_atom &key,bool cut)
{
- I c = 1,vix = VIdx(key);
+ int c = 1,vix = VIdx(key);
poolval *prv = NULL,*ix = vals[vix].v;
for(; ix; prv = ix,ix = ix->nxt) {
c = compare(key,ix->key);
@@ -436,21 +438,21 @@ flext::AtomList *pooldir::GetVal(const A &key,BL cut)
}
}
-I pooldir::CntAll() const
+int pooldir::CntAll() const
{
- I cnt = 0;
- for(I vix = 0; vix < vsize; ++vix) cnt += vals[vix].cnt;
+ int cnt = 0;
+ for(int vix = 0; vix < vsize; ++vix) cnt += vals[vix].cnt;
return cnt;
}
-I pooldir::PrintAll(char *buf,int len) const
+int pooldir::PrintAll(char *buf,int len) const
{
int offs = strlen(buf);
- I cnt = 0;
- for(I vix = 0; vix < vsize; ++vix) {
+ int cnt = 0;
+ for(int vix = 0; vix < vsize; ++vix) {
poolval *ix = vals[vix].v;
- for(I i = 0; ix; ++i,ix = ix->nxt) {
+ for(int i = 0; ix; ++i,ix = ix->nxt) {
PrintAtom(ix->key,buf+offs,len-offs);
strcat(buf+offs," , ");
int l = strlen(buf+offs)+offs;
@@ -465,26 +467,26 @@ I pooldir::PrintAll(char *buf,int len) const
return cnt;
}
-I pooldir::GetKeys(AtomList &keys)
+int pooldir::GetKeys(AtomList &keys)
{
- I cnt = CntAll();
+ int cnt = CntAll();
keys(cnt);
- for(I vix = 0; vix < vsize; ++vix) {
+ for(int vix = 0; vix < vsize; ++vix) {
poolval *ix = vals[vix].v;
- for(I i = 0; ix; ++i,ix = ix->nxt)
+ for(int i = 0; ix; ++i,ix = ix->nxt)
SetAtom(keys[i],ix->key);
}
return cnt;
}
-I pooldir::GetAll(A *&keys,Atoms *&lst,BL cut)
+int pooldir::GetAll(t_atom *&keys,Atoms *&lst,bool cut)
{
- I cnt = CntAll();
- keys = new A[cnt];
+ int cnt = CntAll();
+ keys = new t_atom[cnt];
lst = new Atoms[cnt];
- for(I i = 0,vix = 0; vix < vsize; ++vix) {
+ for(int i = 0,vix = 0; vix < vsize; ++vix) {
poolval *ix = vals[vix].v;
for(; ix; ++i) {
SetAtom(keys[i],ix->key);
@@ -504,19 +506,19 @@ I pooldir::GetAll(A *&keys,Atoms *&lst,BL cut)
}
-I pooldir::CntSub() const
+int pooldir::CntSub() const
{
- I cnt = 0;
- for(I dix = 0; dix < dsize; ++dix) cnt += dirs[dix].cnt;
+ int cnt = 0;
+ for(int dix = 0; dix < dsize; ++dix) cnt += dirs[dix].cnt;
return cnt;
}
-I pooldir::GetSub(const A **&lst)
+int pooldir::GetSub(const t_atom **&lst)
{
- const I cnt = CntSub();
- lst = new const A *[cnt];
- for(I i = 0,dix = 0; i < cnt; ++dix) {
+ const int cnt = CntSub();
+ lst = new const t_atom *[cnt];
+ for(int i = 0,dix = 0; i < cnt; ++dix) {
pooldir *ix = dirs[dix].d;
for(; ix; ix = ix->nxt) lst[i++] = &ix->dir;
}
@@ -524,18 +526,18 @@ I pooldir::GetSub(const A **&lst)
}
-BL pooldir::Paste(const pooldir *p,I depth,BL repl,BL mkdir)
+bool pooldir::Paste(const pooldir *p,int depth,bool repl,bool mkdir)
{
- BL ok = true;
+ bool ok = true;
- for(I vi = 0; vi < p->vsize; ++vi) {
+ for(int 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);
}
}
if(ok && depth) {
- for(I di = 0; di < p->dsize; ++di) {
+ for(int 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) {
@@ -548,12 +550,12 @@ BL pooldir::Paste(const pooldir *p,I depth,BL repl,BL mkdir)
return ok;
}
-BL pooldir::Copy(pooldir *p,I depth,BL cut)
+bool pooldir::Copy(pooldir *p,int depth,bool cut)
{
- BL ok = true;
+ bool ok = true;
if(cut) {
- for(I vi = 0; vi < vsize; ++vi) {
+ for(int 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;
@@ -561,7 +563,7 @@ BL pooldir::Copy(pooldir *p,I depth,BL cut)
}
}
else {
- for(I vi = 0; vi < vsize; ++vi) {
+ for(int vi = 0; vi < vsize; ++vi) {
for(poolval *ix = vals[vi].v; ix; ix = ix->nxt) {
p->SetVal(ix->key,new Atoms(*ix->data));
}
@@ -569,7 +571,7 @@ BL pooldir::Copy(pooldir *p,I depth,BL cut)
}
if(ok && depth) {
- for(I di = 0; di < dsize; ++di) {
+ for(int 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)
@@ -585,7 +587,7 @@ BL pooldir::Copy(pooldir *p,I depth,BL cut)
static bool _isspace(char c) { return c > 0 && isspace(c); }
-static const char *ReadAtom(const char *c,A &a,bool utf8)
+static const char *ReadAtom(const char *c,t_atom &a,bool utf8)
{
// skip leading whitespace (NON-ASCII character are < 0)
while(*c && _isspace(*c)) ++c;
@@ -653,9 +655,9 @@ static const char *ReadAtom(const char *c,A &a,bool utf8)
#if FLEXT_OS == FLEXT_OS_WIN
wchar_t wtmp[1024];
int err = MultiByteToWideChar(CP_UTF8,0,tmp,strlen(tmp),wtmp,1024);
- if(!err) return false;
+ if(!err) return NULL;
err = WideCharToMultiByte(CP_ACP,0,wtmp,err,tmp,1024,NULL,FALSE);
- if(!err) return false;
+ if(!err) return NULL;
tmp[err] = 0;
c = tmp;
#elif FLEXT_OS == FLEXT_OS_MAC
@@ -667,7 +669,7 @@ static const char *ReadAtom(const char *c,A &a,bool utf8)
TECObjectRef converter;
OSStatus status = TECCreateConverter(&converter,inconv,outconv);
- if(status) return false;
+ if(status) return NULL;
ByteCount inlen,outlen;
status = TECConvertText(
@@ -679,12 +681,12 @@ static const char *ReadAtom(const char *c,A &a,bool utf8)
TECDisposeConverter(converter);
c = ctmp;
- if(status) return false;
+ if(status) return NULL;
#else
wchar_t wtmp[1024];
size_t len = mbstowcs(wtmp,tmp,1024);
if(len < 0) return false;
- if(!WCStoUTF8(tmp,wtmp,sizeof(tmp))) return false;
+ if(!WCStoUTF8(tmp,wtmp,sizeof(tmp))) return NULL;
c = tmp;
#endif
}
@@ -696,35 +698,39 @@ static const char *ReadAtom(const char *c,A &a,bool utf8)
return c;
}
-static BL ParseAtoms(C *tmp,flext::AtomList &l,bool utf8)
+static bool ParseAtoms(const char *tmp,flext::AtomList &l,bool utf8)
{
- const int MAXATOMS = 1024;
- int cnt = 0;
- t_atom atoms[MAXATOMS];
- for(const char *t = tmp; *t && cnt < MAXATOMS; ++cnt) {
- t = ReadAtom(t,atoms[cnt],utf8);
- if(!t) break;
+ FLEXT_ASSERT(tmp);
+ vector<t_atom> atoms;
+ while(*tmp) {
+ t_atom at;
+ tmp = ReadAtom(tmp,at,utf8);
+ if(!tmp) break;
+ atoms.push_back(at);
}
- l(cnt,atoms);
- return true;
+ l(atoms.size(),&atoms[0]);
+ return true;
}
-static BL ParseAtoms(string &s,flext::AtomList &l,bool utf8)
+static bool ParseAtoms(string &s,flext::AtomList &l,bool utf8)
{
- return ParseAtoms((C *)s.c_str(),l,utf8);
+ return ParseAtoms((char *)s.c_str(),l,utf8);
}
-static bool ReadAtoms(istream &is,flext::AtomList &l,C del,bool utf8)
+static bool ReadAtoms(istream &is,flext::AtomList &l,char del,bool utf8)
{
- char tmp[1024];
- is.getline(tmp,sizeof tmp,del);
- if(is.eof() || !is.good())
- return false;
- else
- return ParseAtoms(tmp,l,utf8);
+ vector<char> tmp;
+ for(;;) {
+ char c = is.get();
+ if(is.eof() || c == del) break;
+ tmp.push_back(c);
+ }
+ tmp.push_back(0); // end-of-string marker
+
+ return is.good() && ParseAtoms(&tmp[0],l,utf8);
}
-static bool WriteAtom(ostream &os,const A &a,bool utf8)
+static bool WriteAtom(ostream &os,const t_atom &a,bool utf8)
{
if(flext::IsFloat(a))
os << flext::GetFloat(a);
@@ -791,17 +797,17 @@ static bool WriteAtom(ostream &os,const A &a,bool utf8)
static void WriteAtoms(ostream &os,const flext::AtomList &l,bool utf8)
{
- for(I i = 0; i < l.Count(); ++i) {
+ for(int i = 0; i < l.Count(); ++i) {
WriteAtom(os,l[i],utf8);
if(i < l.Count()-1) os << ' ';
}
}
-BL pooldir::LdDir(istream &is,I depth,BL mkdir)
+bool pooldir::LdDir(istream &is,int depth,bool mkdir)
{
- for(I i = 1; !is.eof(); ++i) {
+ for(int i = 1; !is.eof(); ++i) {
Atoms d,k,*v = new Atoms;
- BL r =
+ bool r =
ReadAtoms(is,d,',',false) &&
ReadAtoms(is,k,',',false) &&
ReadAtoms(is,*v,'\n',false);
@@ -830,10 +836,10 @@ BL pooldir::LdDir(istream &is,I depth,BL mkdir)
return true;
}
-BL pooldir::SvDir(ostream &os,I depth,const AtomList &dir)
+bool pooldir::SvDir(ostream &os,int depth,const AtomList &dir)
{
- I cnt = 0;
- for(I vi = 0; vi < vsize; ++vi) {
+ int cnt = 0;
+ for(int vi = 0; vi < vsize; ++vi) {
for(poolval *ix = vals[vi].v; ix; ix = ix->nxt) {
WriteAtoms(os,dir,false);
os << " , ";
@@ -851,8 +857,8 @@ BL pooldir::SvDir(ostream &os,I depth,const AtomList &dir)
}
if(depth) {
// save sub-directories
- I nd = depth > 0?depth-1:-1;
- for(I di = 0; di < dsize; ++di) {
+ int nd = depth > 0?depth-1:-1;
+ for(int di = 0; di < dsize; ++di) {
for(pooldir *ix = dirs[di].d; ix; ix = ix->nxt) {
ix->SvDir(os,nd,Atoms(dir).Append(ix->dir));
}
@@ -865,7 +871,7 @@ class xmltag {
public:
string tag,attr;
bool Ok() const { return tag.length() > 0; }
- bool operator ==(const C *t) const { return !tag.compare(t); }
+ bool operator ==(const char *t) const { return !tag.compare(t); }
void Clear()
{
@@ -979,7 +985,7 @@ static void getvalue(istream &is,string &s)
s = tmp;
}
-BL pooldir::LdDirXMLRec(istream &is,I depth,BL mkdir,AtomList &d)
+bool pooldir::LdDirXMLRec(istream &is,int depth,bool mkdir,AtomList &d)
{
Atoms k,v;
bool inval = false,inkey = false,indata = false;
@@ -999,7 +1005,7 @@ BL pooldir::LdDirXMLRec(istream &is,I depth,BL mkdir,AtomList &d)
(inval && (inkey || indata)) /* value */
)
) {
- BL ret = true;
+ bool ret = true;
if(indata) {
if(v.Count())
post("pool - XML load: value data already given, ignoring new data");
@@ -1121,7 +1127,7 @@ BL pooldir::LdDirXMLRec(istream &is,I depth,BL mkdir,AtomList &d)
return true;
}
-BL pooldir::LdDirXML(istream &is,I depth,BL mkdir)
+bool pooldir::LdDirXML(istream &is,int depth,bool mkdir)
{
while(!is.eof()) {
xmltag tag;
@@ -1147,12 +1153,12 @@ BL pooldir::LdDirXML(istream &is,I depth,BL mkdir)
return true;
}
-static void indent(ostream &s,I cnt)
+static void indent(ostream &s,int cnt)
{
- for(I i = 0; i < cnt; ++i) s << '\t';
+ for(int i = 0; i < cnt; ++i) s << '\t';
}
-BL pooldir::SvDirXML(ostream &os,I depth,const AtomList &dir,I ind)
+bool pooldir::SvDirXML(ostream &os,int depth,const AtomList &dir,int ind)
{
int i,lvls = ind?(dir.Count()?1:0):dir.Count();
@@ -1165,7 +1171,7 @@ BL pooldir::SvDirXML(ostream &os,I depth,const AtomList &dir,I ind)
os << "</key>" << endl;
}
- for(I vi = 0; vi < vsize; ++vi) {
+ for(int vi = 0; vi < vsize; ++vi) {
for(poolval *ix = vals[vi].v; ix; ix = ix->nxt) {
indent(os,ind+lvls);
os << "<value><key>";
@@ -1177,8 +1183,8 @@ BL pooldir::SvDirXML(ostream &os,I depth,const AtomList &dir,I ind)
}
if(depth) {
- I nd = depth > 0?depth-1:-1;
- for(I di = 0; di < dsize; ++di) {
+ int nd = depth > 0?depth-1:-1;
+ for(int 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);
}
diff --git a/externals/grill/pool/source/pool.h b/externals/grill/pool/source/pool.h
index f69ad2ea..3382d843 100644
--- a/externals/grill/pool/source/pool.h
+++ b/externals/grill/pool/source/pool.h
@@ -1,11 +1,13 @@
/*
-
pool - hierarchical storage object for PD and Max/MSP
-Copyright (c) 2002-2006 Thomas Grill (gr@grrrr.org)
+Copyright (c) 2002-2008 Thomas Grill (gr@grrrr.org)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
+$LastChangedRevision: 26 $
+$LastChangedDate: 2008-01-03 16:14:29 +0100 (Thu, 03 Jan 2008) $
+$LastChangedBy: thomas $
*/
#ifndef __POOL_H
@@ -23,28 +25,21 @@ WARRANTIES, see the file, "license.txt," in this distribution.
using namespace std;
-typedef void V;
-typedef int I;
-typedef unsigned long UL;
-typedef float F;
-typedef char C;
-typedef bool BL;
-typedef t_atom A;
-typedef t_symbol S;
typedef flext::AtomListStatic<8> Atoms;
+
class poolval:
public flext
{
public:
- poolval(const A &key,AtomList *data);
+ poolval(const t_atom &key,AtomList *data);
~poolval();
poolval &Set(AtomList *data);
poolval *Dup() const;
- A key;
+ t_atom key;
AtomList *data;
poolval *nxt;
};
@@ -53,59 +48,59 @@ class pooldir:
public flext
{
public:
- pooldir(const A &dir,pooldir *parent,I vcnt,I dcnt);
+ pooldir(const t_atom &dir,pooldir *parent,int vcnt,int dcnt);
~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; }
-
- pooldir *GetDir(I argc,const A *argv,BL cut = false);
- 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,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);
- BL SetVali(I ix,AtomList *data);
- V ClrVal(const A &key) { SetVal(key,NULL); }
- BL ClrVali(I ix) { return SetVali(ix,NULL); }
- AtomList *PeekVal(const A &key);
- 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);
- I CntSub() const;
- I GetSub(const A **&dirs);
-
- poolval *RefVal(const A &key);
- poolval *RefVali(I ix);
+ void Clear(bool rec,bool dironly = false);
+ void Reset(bool realloc = true);
+
+ bool Empty() const { return !dirs && !vals; }
+ bool HasDirs() const { return dirs != NULL; }
+ bool HasVals() const { return vals != NULL; }
+
+ pooldir *GetDir(int argc,const t_atom *argv,bool cut = false);
+ pooldir *GetDir(const AtomList &d,bool cut = false) { return GetDir(d.Count(),d.Atoms(),cut); }
+ bool DelDir(int argc,const t_atom *argv);
+ bool DelDir(const AtomList &d) { return DelDir(d.Count(),d.Atoms()); }
+ pooldir *AddDir(int argc,const t_atom *argv,int vcnt = 0,int dcnt = 0);
+ pooldir *AddDir(const AtomList &d,int vcnt = 0,int dcnt = 0) { return AddDir(d.Count(),d.Atoms(),vcnt,dcnt); }
+
+ void SetVal(const t_atom &key,AtomList *data,bool over = true);
+ bool SetVali(int ix,AtomList *data);
+ void ClrVal(const t_atom &key) { SetVal(key,NULL); }
+ bool ClrVali(int ix) { return SetVali(ix,NULL); }
+ AtomList *PeekVal(const t_atom &key);
+ AtomList *GetVal(const t_atom &key,bool cut = false);
+ int CntAll() const;
+ int GetAll(t_atom *&keys,Atoms *&lst,bool cut = false);
+ int PrintAll(char *buf,int len) const;
+ int GetKeys(AtomList &keys);
+ int CntSub() const;
+ int GetSub(const t_atom **&dirs);
+
+ poolval *RefVal(const t_atom &key);
+ poolval *RefVali(int ix);
- BL Paste(const pooldir *p,I depth,BL repl,BL mkdir);
- BL Copy(pooldir *p,I depth,BL cur);
+ bool Paste(const pooldir *p,int depth,bool repl,bool mkdir);
+ bool Copy(pooldir *p,int depth,bool 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(),I ind = 0);
+ bool LdDir(istream &is,int depth,bool mkdir);
+ bool LdDirXML(istream &is,int depth,bool mkdir);
+ bool SvDir(ostream &os,int depth,const AtomList &dir = AtomList());
+ bool SvDirXML(ostream &os,int depth,const AtomList &dir = AtomList(),int ind = 0);
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); }
+ int VIdx(const t_atom &v) const { return FoldBits(AtomHash(v),vbits); }
+ int DIdx(const t_atom &d) const { return FoldBits(AtomHash(d),dbits); }
- A dir;
+ t_atom dir;
pooldir *nxt;
pooldir *parent;
- const I vbits,dbits,vsize,dsize;
+ const int vbits,dbits,vsize,dsize;
static unsigned int FoldBits(unsigned long h,int bits);
static int Int2Bits(unsigned long n);
@@ -117,7 +112,7 @@ protected:
direntry *dirs;
private:
- BL LdDirXMLRec(istream &is,I depth,BL mkdir,AtomList &d);
+ bool LdDirXMLRec(istream &is,int depth,bool mkdir,AtomList &d);
};
@@ -125,33 +120,33 @@ class pooldata:
public flext
{
public:
- pooldata(const S *s = NULL,I vcnt = 0,I dcnt = 0);
+ pooldata(const t_symbol *s = NULL,int vcnt = 0,int dcnt = 0);
~pooldata();
bool Private() const { return sym == NULL; }
- V Push() { ++refs; }
- BL Pop() { return --refs > 0; }
+ void Push() { ++refs; }
+ bool Pop() { return --refs > 0; }
- V Reset() { root.Reset(); }
+ void Reset() { root.Reset(); }
- BL MkDir(const AtomList &d,I vcnt = 0,I dcnt = 0)
+ bool MkDir(const AtomList &d,int vcnt = 0,int dcnt = 0)
{
root.AddDir(d,vcnt,dcnt);
return true;
}
- BL ChkDir(const AtomList &d)
+ bool ChkDir(const AtomList &d)
{
return root.GetDir(d) != NULL;
}
- BL RmDir(const AtomList &d)
+ bool RmDir(const AtomList &d)
{
return root.DelDir(d);
}
- BL Set(const AtomList &d,const A &key,AtomList *data,BL over = true)
+ bool Set(const AtomList &d,const t_atom &key,AtomList *data,bool over = true)
{
pooldir *pd = root.GetDir(d);
if(!pd) return false;
@@ -159,7 +154,7 @@ public:
return true;
}
- BL Seti(const AtomList &d,I ix,AtomList *data)
+ bool Seti(const AtomList &d,int ix,AtomList *data)
{
pooldir *pd = root.GetDir(d);
if(!pd) return false;
@@ -167,7 +162,7 @@ public:
return true;
}
- BL Clr(const AtomList &d,const A &key)
+ bool Clr(const AtomList &d,const t_atom &key)
{
pooldir *pd = root.GetDir(d);
if(!pd) return false;
@@ -175,7 +170,7 @@ public:
return true;
}
- BL Clri(const AtomList &d,I ix)
+ bool Clri(const AtomList &d,int ix)
{
pooldir *pd = root.GetDir(d);
if(!pd) return false;
@@ -183,7 +178,7 @@ public:
return true;
}
- BL ClrAll(const AtomList &d,BL rec,BL dironly = false)
+ bool ClrAll(const AtomList &d,bool rec,bool dironly = false)
{
pooldir *pd = root.GetDir(d);
if(!pd) return false;
@@ -191,68 +186,68 @@ public:
return true;
}
- AtomList *Peek(const AtomList &d,const A &key)
+ AtomList *Peek(const AtomList &d,const t_atom &key)
{
pooldir *pd = root.GetDir(d);
return pd?pd->PeekVal(key):NULL;
}
- AtomList *Get(const AtomList &d,const A &key)
+ AtomList *Get(const AtomList &d,const t_atom &key)
{
pooldir *pd = root.GetDir(d);
return pd?pd->GetVal(key):NULL;
}
- poolval *Ref(const AtomList &d,const A &key)
+ poolval *Ref(const AtomList &d,const t_atom &key)
{
pooldir *pd = root.GetDir(d);
return pd?pd->RefVal(key):NULL;
}
- poolval *Refi(const AtomList &d,I ix)
+ poolval *Refi(const AtomList &d,int ix)
{
pooldir *pd = root.GetDir(d);
return pd?pd->RefVali(ix):NULL;
}
- I CntAll(const AtomList &d)
+ int CntAll(const AtomList &d)
{
pooldir *pd = root.GetDir(d);
return pd?pd->CntAll():0;
}
- I PrintAll(const AtomList &d);
- I GetAll(const AtomList &d,A *&keys,Atoms *&lst);
+ int PrintAll(const AtomList &d);
+ int GetAll(const AtomList &d,t_atom *&keys,Atoms *&lst);
- I CntSub(const AtomList &d)
+ int CntSub(const AtomList &d)
{
pooldir *pd = root.GetDir(d);
return pd?pd->CntSub():0;
}
- I GetSub(const AtomList &d,const t_atom **&dirs);
+ int 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);
- pooldir *Copy(const AtomList &d,const A &key,BL cut);
- pooldir *CopyAll(const AtomList &d,I depth,BL cut);
+ bool Paste(const AtomList &d,const pooldir *clip,int depth = -1,bool repl = true,bool mkdir = true);
+ pooldir *Copy(const AtomList &d,const t_atom &key,bool cut);
+ pooldir *CopyAll(const AtomList &d,int depth,bool cut);
- BL LdDir(const AtomList &d,const C *flnm,I depth,BL mkdir = true);
- BL SvDir(const AtomList &d,const C *flnm,I depth,BL absdir);
- BL Load(const C *flnm) { AtomList l; return LdDir(l,flnm,-1); }
- BL Save(const C *flnm) { AtomList l; return SvDir(l,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) { AtomList l; return LdDirXML(l,flnm,-1); }
- BL SaveXML(const C *flnm) { AtomList l; return SvDirXML(l,flnm,-1,true); }
+ bool LdDir(const AtomList &d,const char *flnm,int depth,bool mkdir = true);
+ bool SvDir(const AtomList &d,const char *flnm,int depth,bool absdir);
+ bool Load(const char *flnm) { AtomList l; return LdDir(l,flnm,-1); }
+ bool Save(const char *flnm) { AtomList l; return SvDir(l,flnm,-1,true); }
+ bool LdDirXML(const AtomList &d,const char *flnm,int depth,bool mkdir = true);
+ bool SvDirXML(const AtomList &d,const char *flnm,int depth,bool absdir);
+ bool LoadXML(const char *flnm) { AtomList l; return LdDirXML(l,flnm,-1); }
+ bool SaveXML(const char *flnm) { AtomList l; return SvDirXML(l,flnm,-1,true); }
- I refs;
- const S *sym;
+ int refs;
+ const t_symbol *sym;
pooldata *nxt;
pooldir root;
private:
- static const A nullatom;
+ static const t_atom nullatom;
};
#endif