[PD-cvs] externals/grill/pool/source data.cpp, 1.6, 1.7 main.cpp, 1.15, 1.16 pool.cpp, 1.22, 1.23 pool.h, 1.11, 1.12

Thomas Grill xovo at users.sourceforge.net
Sat Sep 30 21:23:18 CEST 2006


Update of /cvsroot/pure-data/externals/grill/pool/source
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4681/source

Modified Files:
	data.cpp main.cpp pool.cpp pool.h 
Log Message:
reintroduced missing help message
added success/error reporting for file operations
fixed double-free on clearing values and dirs
fixed bug in XML saving of nested folders
changed obviously buggy pool name registering
fixed clearing values and dirs, e.g. with messages clrall and clrrec
use new ToSys* methods


Index: data.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/pool/source/data.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** data.cpp	7 Jun 2005 14:14:50 -0000	1.6
--- data.cpp	30 Sep 2006 19:23:16 -0000	1.7
***************
*** 3,7 ****
  pool - hierarchical storage object for PD and Max/MSP
  
! Copyright (c) 2002-2005 Thomas Grill
  For information on usage and redistribution, and for a DISCLAIMER OF ALL
  WARRANTIES, see the file, "license.txt," in this distribution.  
--- 3,7 ----
  pool - hierarchical storage object for PD and Max/MSP
  
! Copyright (c) 2002-2006 Thomas Grill (gr at grrrr.org)
  For information on usage and redistribution, and for a DISCLAIMER OF ALL
  WARRANTIES, see the file, "license.txt," in this distribution.  
***************
*** 50,54 ****
      pooldir *pd = root.GetDir(d);
      strcat(tmp," , ");
! 	return pd?pd->PrintAll(tmp,sizeof tmp):0;
  }
  
--- 50,56 ----
      pooldir *pd = root.GetDir(d);
      strcat(tmp," , ");
! 	int cnt = pd?pd->PrintAll(tmp,sizeof tmp):0;
!     if(!cnt) post(tmp);
!     return cnt;
  }
  

Index: main.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/pool/source/main.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** main.cpp	19 Apr 2006 17:40:18 -0000	1.15
--- main.cpp	30 Sep 2006 19:23:16 -0000	1.16
***************
*** 3,7 ****
  pool - hierarchical storage object for PD and Max/MSP
  
! Copyright (c) 2002-2005 Thomas Grill
  For information on usage and redistribution, and for a DISCLAIMER OF ALL
  WARRANTIES, see the file, "license.txt," in this distribution.  
--- 3,7 ----
  pool - hierarchical storage object for PD and Max/MSP
  
! Copyright (c) 2002-2006 Thomas Grill (gr at grrrr.org)
  For information on usage and redistribution, and for a DISCLAIMER OF ALL
  WARRANTIES, see the file, "license.txt," in this distribution.  
***************
*** 11,14 ****
--- 11,15 ----
  #include "pool.h"
  #include <string>
+ #include <map>
  
  #define POOL_VERSION "0.2.2pre"
***************
*** 39,42 ****
--- 40,45 ----
  	V mg_pool(AtomList &l);
  
+     V 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"); }
***************
*** 54,57 ****
--- 57,62 ----
  	V m_updir(I argc,const A *argv);		// one or more levels up
  
+     V 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); }
***************
*** 121,124 ****
--- 126,130 ----
  
      static const t_symbol *sym_echo;
+     static const t_symbol *sym_error;
  
      enum get_t { get_norm,get_cnt,get_print };
***************
*** 143,154 ****
  	V echodir() { if(echo) getdir(sym_echo); }
  
! 	BL priv,absdir,echo;
  	I vcnt,dcnt;
  	pooldata *pl;
  	Atoms curdir;
  	pooldir *clip;
- 	const S *holdname;
  
! 	static pooldata *head,*tail;
  
  	V SetPool(const S *s);
--- 149,162 ----
  	V echodir() { if(echo) getdir(sym_echo); }
  
! 	BL absdir,echo;
  	I vcnt,dcnt;
  	pooldata *pl;
  	Atoms curdir;
  	pooldir *clip;
  
! 	static const S *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);
***************
*** 161,168 ****
  
  	FLEXT_CALLVAR_V(mg_pool,ms_pool)
  	FLEXT_ATTRVAR_B(absdir)
  	FLEXT_ATTRVAR_B(echo)
! 	FLEXT_ATTRGET_B(priv)
! //	FLEXT_ATTRGET_B(curdir)
  	FLEXT_ATTRVAR_I(vcnt)
  	FLEXT_ATTRVAR_I(dcnt)
--- 169,177 ----
  
  	FLEXT_CALLVAR_V(mg_pool,ms_pool)
+ 	FLEXT_ATTRGET_V(curdir)
+ 	FLEXT_CALLSET_V(ms_curdir)
  	FLEXT_ATTRVAR_B(absdir)
  	FLEXT_ATTRVAR_B(echo)
! 	FLEXT_CALLGET_B(mg_priv)
  	FLEXT_ATTRVAR_I(vcnt)
  	FLEXT_ATTRVAR_I(dcnt)
***************
*** 233,238 ****
  
  
! pooldata *pool::head,*pool::tail;	
! const t_symbol *pool::sym_echo;
  
  
--- 242,248 ----
  
  
! pool::PoolMap pool::poolmap;	
! const t_symbol *pool::sym_echo,*pool::sym_error;
! const t_symbol *pool::holdname;
  
  
***************
*** 243,253 ****
  	post("");
  
- 	head = tail = NULL;
      sym_echo = MakeSymbol("echo");
  
  	FLEXT_CADDATTR_VAR(c,"pool",mg_pool,ms_pool);
  	FLEXT_CADDATTR_VAR1(c,"absdir",absdir);
  	FLEXT_CADDATTR_VAR1(c,"echodir",echo);
! 	FLEXT_CADDATTR_GET(c,"private",priv);
  	FLEXT_CADDATTR_VAR1(c,"valcnt",vcnt);
  	FLEXT_CADDATTR_VAR1(c,"dircnt",dcnt);
--- 253,264 ----
  	post("");
  
      sym_echo = MakeSymbol("echo");
+     sym_error = MakeSymbol("error");
  
  	FLEXT_CADDATTR_VAR(c,"pool",mg_pool,ms_pool);
+ 	FLEXT_CADDATTR_VAR(c,"curdir",curdir,ms_curdir);
  	FLEXT_CADDATTR_VAR1(c,"absdir",absdir);
  	FLEXT_CADDATTR_VAR1(c,"echodir",echo);
! 	FLEXT_CADDATTR_GET(c,"private",mg_priv);
  	FLEXT_CADDATTR_VAR1(c,"valcnt",vcnt);
  	FLEXT_CADDATTR_VAR1(c,"dircnt",dcnt);
***************
*** 316,320 ****
  pool::pool(I argc,const A *argv):
  	absdir(true),echo(false),
!     pl(NULL),priv(false),
  	clip(NULL),
  	vcnt(VCNT),dcnt(DCNT)
--- 327,331 ----
  pool::pool(I argc,const A *argv):
  	absdir(true),echo(false),
!     pl(NULL),
  	clip(NULL),
  	vcnt(VCNT),dcnt(DCNT)
***************
*** 346,350 ****
  {
  	if(s) {
- 		priv = false;
  		if(pl)
  			// check if new symbol equals the current one
--- 357,360 ----
***************
*** 356,364 ****
  	}
  	else {
! 		// if already private no need to allocate new storage
! 		if(priv) return;
! 
! 		priv = true;
! 		if(pl) FreePool();
  		pl = new pooldata(NULL,vcnt,dcnt);
  	}
--- 366,376 ----
  	}
  	else {
!         if(pl) {
!     		// if already private no need to allocate new storage
!             if(pl->Private()) 
!                 return;
!             else
!     		    FreePool();
!         }
  		pl = new pooldata(NULL,vcnt,dcnt);
  	}
***************
*** 370,374 ****
  
  	if(pl) {
! 		if(!priv) 
  			RmvPool(pl);
  		else
--- 382,386 ----
  
  	if(pl) {
! 		if(!pl->Private()) 
  			RmvPool(pl);
  		else
***************
*** 394,398 ****
  V pool::mg_pool(AtomList &l)
  {
! 	if(priv || !pl) l();
  	else { l(1); SetSymbol(l[0],pl->sym); }
  }
--- 406,410 ----
  V pool::mg_pool(AtomList &l)
  {
! 	if(!pl || pl->Private()) l();
  	else { l(1); SetSymbol(l[0],pl->sym); }
  }
***************
*** 407,412 ****
  V pool::getdir(const S *tag)
  {
! 	ToOutAnything(3,tag,0,NULL);
! 	ToOutList(2,curdir);
  }
  
--- 419,424 ----
  V pool::getdir(const S *tag)
  {
! 	ToSysAnything(3,tag,0,NULL);
! 	ToSysList(2,curdir);
  }
  
***************
*** 583,598 ****
  		poolval *r = pl->Ref(curdir,argv[0]);
  
! 		ToOutAnything(3,thisTag(),0,NULL);
  		if(absdir)
! 			ToOutList(2,curdir);
  		else
! 			ToOutList(2,0,NULL);
  		if(r) {
  			ToOutAtom(1,r->key);
! 			ToOutList(0,*r->data);
  		}
  		else {
! 			ToOutBang(1);
! 			ToOutBang(0);
  		}
  	}
--- 595,610 ----
  		poolval *r = pl->Ref(curdir,argv[0]);
  
! 		ToSysAnything(3,thisTag(),0,NULL);
  		if(absdir)
! 			ToSysList(2,curdir);
  		else
! 			ToSysList(2,0,NULL);
  		if(r) {
  			ToOutAtom(1,r->key);
! 			ToSysList(0,*r->data);
  		}
  		else {
! 			ToSysBang(1);
! 			ToSysBang(0);
  		}
  	}
***************
*** 608,623 ****
  		poolval *r = pl->Refi(curdir,ix);
  
! 		ToOutAnything(3,thisTag(),0,NULL);
  		if(absdir)
! 			ToOutList(2,curdir);
  		else
! 			ToOutList(2,0,NULL);
  		if(r) {
  			ToOutAtom(1,r->key);
! 			ToOutList(0,*r->data);
  		}
  		else {
! 			ToOutBang(1);
! 			ToOutBang(0);
  		}
  	}
--- 620,635 ----
  		poolval *r = pl->Refi(curdir,ix);
  
! 		ToSysAnything(3,thisTag(),0,NULL);
  		if(absdir)
! 			ToSysList(2,curdir);
  		else
! 			ToSysList(2,0,NULL);
  		if(r) {
  			ToOutAtom(1,r->key);
! 			ToSysList(0,*r->data);
  		}
  		else {
! 			ToSysBang(1);
! 			ToSysBang(0);
  		}
  	}
***************
*** 648,655 ****
  		    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;
--- 660,667 ----
  		    else {
  			    for(I i = 0; i < cnt; ++i) {
! 				    ToSysAnything(3,tag,0,NULL);
! 				    ToSysList(2,absdir?gldir:rdir);
  				    ToOutAtom(1,k[i]);
! 				    ToSysList(0,r[i]);
  			    }
  			    delete[] k;
***************
*** 682,686 ****
  	AtomList l;
  	getrec(thisTag(),0,false,get_norm,l);
! 	ToOutBang(3);
  
  	echodir();
--- 694,698 ----
  	AtomList l;
  	getrec(thisTag(),0,false,get_norm,l);
! 	ToSysBang(3);
  
  	echodir();
***************
*** 691,695 ****
  	AtomList l;
  	getrec(thisTag(),0,true,get_norm,l);
! 	ToOutBang(3);
  
  	echodir();
--- 703,707 ----
  	AtomList l;
  	getrec(thisTag(),0,true,get_norm,l);
! 	ToSysBang(3);
  
  	echodir();
***************
*** 711,715 ****
  	AtomList l;
  	getrec(thisTag(),lvls,false,get_norm,l);
! 	ToOutBang(3);
  
  	echodir();
--- 723,727 ----
  	AtomList l;
  	getrec(thisTag(),lvls,false,get_norm,l);
! 	ToSysBang(3);
  
  	echodir();
***************
*** 732,736 ****
  	AtomList l;
  	getrec(thisTag(),lvls,true,get_norm,l);
! 	ToOutBang(3);
  
  	echodir();
--- 744,748 ----
  	AtomList l;
  	getrec(thisTag(),lvls,true,get_norm,l);
! 	ToSysBang(3);
  
  	echodir();
***************
*** 758,765 ****
  
  			if(how == get_norm) {
! 				ToOutAnything(3,tag,0,NULL);
! 				ToOutList(2,curdir);
! 				ToOutList(1,ndir);
! 				ToOutBang(0);
  			}
  
--- 770,777 ----
  
  			if(how == get_norm) {
! 				ToSysAnything(3,tag,0,NULL);
! 				ToSysList(2,curdir);
! 				ToSysList(1,ndir);
! 				ToSysBang(0);
  			}
  
***************
*** 790,794 ****
  	AtomList l;
  	getsub(thisTag(),lvls,false,get_norm,l);
! 	ToOutBang(3);
  
  	echodir();
--- 802,806 ----
  	AtomList l;
  	getsub(thisTag(),lvls,false,get_norm,l);
! 	ToSysBang(3);
  
  	echodir();
***************
*** 811,815 ****
  	AtomList l;
  	getsub(thisTag(),lvls,true,get_norm,l); 
! 	ToOutBang(3);
  
  	echodir();
--- 823,827 ----
  	AtomList l;
  	getsub(thisTag(),lvls,true,get_norm,l); 
! 	ToSysBang(3);
  
  	echodir();
***************
*** 821,828 ****
  	AtomList l;
  	I cnt = getrec(thisTag(),0,false,get_cnt,l);
! 	ToOutSymbol(3,thisTag());
! 	ToOutBang(2);
! 	ToOutBang(1);
! 	ToOutInt(0,cnt);
  
  	echodir();
--- 833,840 ----
  	AtomList l;
  	I cnt = getrec(thisTag(),0,false,get_cnt,l);
! 	ToSysSymbol(3,thisTag());
! 	ToSysBang(2);
! 	ToSysBang(1);
! 	ToSysInt(0,cnt);
  
  	echodir();
***************
*** 844,851 ****
  	AtomList l;
  	I cnt = getrec(thisTag(),lvls,false,get_cnt,l);
! 	ToOutSymbol(3,thisTag());
! 	ToOutBang(2);
! 	ToOutBang(1);
! 	ToOutInt(0,cnt);
  
  	echodir();
--- 856,863 ----
  	AtomList l;
  	I cnt = getrec(thisTag(),lvls,false,get_cnt,l);
! 	ToSysSymbol(3,thisTag());
! 	ToSysBang(2);
! 	ToSysBang(1);
! 	ToSysInt(0,cnt);
  
  	echodir();
***************
*** 868,875 ****
  	AtomList l;
  	I cnt = getsub(thisTag(),lvls,false,get_cnt,l);
! 	ToOutSymbol(3,thisTag());
! 	ToOutBang(2);
! 	ToOutBang(1);
! 	ToOutInt(0,cnt);
  
  	echodir();
--- 880,887 ----
  	AtomList l;
  	I cnt = getsub(thisTag(),lvls,false,get_cnt,l);
! 	ToSysSymbol(3,thisTag());
! 	ToSysBang(2);
! 	ToSysBang(1);
! 	ToSysInt(0,cnt);
  
  	echodir();
***************
*** 885,890 ****
  V pool::m_printrec(I argc,const A *argv,BL fromroot)
  {
! 	const S *tag = MakeSymbol(fromroot?"printroot":"printrec");
! 
  	I lvls = -1;
  	if(argc > 0) {
--- 897,901 ----
  V pool::m_printrec(I argc,const A *argv,BL fromroot)
  {
!     const S *tag = thisTag();
  	I lvls = -1;
  	if(argc > 0) {
***************
*** 993,997 ****
  V pool::load(I argc,const A *argv,BL xml)
  {
! 	const C *flnm = NULL;
  	if(argc > 0) {
  		if(argc > 1) post("%s - %s: superfluous arguments ignored",thisName(),GetString(thisTag()));
--- 1004,1008 ----
  V pool::load(I argc,const A *argv,BL xml)
  {
!     const C *flnm = NULL;
  	if(argc > 0) {
  		if(argc > 1) post("%s - %s: superfluous arguments ignored",thisName(),GetString(thisTag()));
***************
*** 999,1010 ****
  	}
  
  	if(!flnm) 
  		post("%s - %s: no filename given",thisName(),GetString(thisTag()));
  	else {
  		string file(MakeFilename(flnm));
! 		if(!(xml?pl->LoadXML(file.c_str()):pl->Load(file.c_str())))
  			post("%s - %s: error loading data",thisName(),GetString(thisTag()));
  	}
  
  	echodir();
  }
--- 1010,1026 ----
  	}
  
+     bool ok = false;
  	if(!flnm) 
  		post("%s - %s: no filename given",thisName(),GetString(thisTag()));
  	else {
  		string file(MakeFilename(flnm));
!         ok = xml?pl->LoadXML(file.c_str()):pl->Load(file.c_str());
! 		if(!ok)
  			post("%s - %s: error loading data",thisName(),GetString(thisTag()));
  	}
  
+     t_atom at; SetBool(at,ok);
+     ToOutAnything(GetOutAttr(),thisTag(),1,&at);
+ 
  	echodir();
  }
***************
*** 1018,1029 ****
  	}
  
  	if(!flnm) 
  		post("%s - %s: no filename given",thisName(),GetString(thisTag()));
  	else {
  		string file(MakeFilename(flnm));
! 		if(!(xml?pl->SaveXML(file.c_str()):pl->Save(file.c_str())))
  			post("%s - %s: error saving data",thisName(),GetString(thisTag()));
  	}
  
  	echodir();
  }
--- 1034,1050 ----
  	}
  
+     bool ok = false;
  	if(!flnm) 
  		post("%s - %s: no filename given",thisName(),GetString(thisTag()));
  	else {
  		string file(MakeFilename(flnm));
!         ok = xml?pl->SaveXML(file.c_str()):pl->Save(file.c_str());
! 		if(!ok)
  			post("%s - %s: error saving data",thisName(),GetString(thisTag()));
  	}
  
+     t_atom at; SetBool(at,ok);
+     ToOutAnything(GetOutAttr(),thisTag(),1,&at);
+ 
  	echodir();
  }
***************
*** 1037,1048 ****
  	}
  
  	if(!flnm)
  		post("%s - %s: invalid filename",thisName(),GetString(thisTag()));
  	else {
  		string file(MakeFilename(flnm));
! 		if(!(xml?pl->LdDirXML(curdir,file.c_str(),0):pl->LdDir(curdir,file.c_str(),0))) 
  			post("%s - %s: directory couldn't be loaded",thisName(),GetString(thisTag()));
  	}
  
  	echodir();
  }
--- 1058,1074 ----
  	}
  
+     bool ok = false;
  	if(!flnm)
  		post("%s - %s: invalid filename",thisName(),GetString(thisTag()));
  	else {
  		string file(MakeFilename(flnm));
!         ok = xml?pl->LdDirXML(curdir,file.c_str(),0):pl->LdDir(curdir,file.c_str(),0);
! 		if(!ok) 
  			post("%s - %s: directory couldn't be loaded",thisName(),GetString(thisTag()));
  	}
  
+     t_atom at; SetBool(at,ok);
+     ToOutAnything(GetOutAttr(),thisTag(),1,&at);
+ 
  	echodir();
  }
***************
*** 1071,1082 ****
  	}
  
  	if(!flnm)
  		post("%s - %s: invalid filename",thisName(),GetString(thisTag()));
  	else {
  		string file(MakeFilename(flnm));
!         if(!(xml?pl->LdDirXML(curdir,file.c_str(),depth,mkdir):pl->LdDir(curdir,file.c_str(),depth,mkdir))) 
  		    post("%s - %s: directory couldn't be saved",thisName(),GetString(thisTag()));
  	}
  
  	echodir();
  }
--- 1097,1113 ----
  	}
  
+     bool ok = false;
  	if(!flnm)
  		post("%s - %s: invalid filename",thisName(),GetString(thisTag()));
  	else {
  		string file(MakeFilename(flnm));
!         ok = xml?pl->LdDirXML(curdir,file.c_str(),depth,mkdir):pl->LdDir(curdir,file.c_str(),depth,mkdir);
!         if(!ok) 
  		    post("%s - %s: directory couldn't be saved",thisName(),GetString(thisTag()));
  	}
  
+     t_atom at; SetBool(at,ok);
+     ToOutAnything(GetOutAttr(),thisTag(),1,&at);
+ 
  	echodir();
  }
***************
*** 1090,1101 ****
  	}
  
  	if(!flnm)
  		post("%s - %s: invalid filename",thisName(),GetString(thisTag()));
  	else {
  		string file(MakeFilename(flnm));
!         if(!(xml?pl->SvDirXML(curdir,file.c_str(),0,absdir):pl->SvDir(curdir,file.c_str(),0,absdir))) 
! 		post("%s - %s: directory couldn't be saved",thisName(),GetString(thisTag()));
  	}
  
  	echodir();
  }
--- 1121,1137 ----
  	}
  
+     bool ok = false;
  	if(!flnm)
  		post("%s - %s: invalid filename",thisName(),GetString(thisTag()));
  	else {
  		string file(MakeFilename(flnm));
!         ok = xml?pl->SvDirXML(curdir,file.c_str(),0,absdir):pl->SvDir(curdir,file.c_str(),0,absdir);
!         if(!ok) 
! 		    post("%s - %s: directory couldn't be saved",thisName(),GetString(thisTag()));
  	}
  
+     t_atom at; SetBool(at,ok);
+     ToOutAnything(GetOutAttr(),thisTag(),1,&at);
+ 
  	echodir();
  }
***************
*** 1109,1120 ****
  	}
  
  	if(!flnm)
  		post("%s - %s: invalid filename",thisName(),GetString(thisTag()));
  	else {
  		string file(MakeFilename(flnm));
!         if(!(xml?pl->SvDirXML(curdir,file.c_str(),-1,absdir):pl->SvDir(curdir,file.c_str(),-1,absdir))) 
! 		post("%s - %s: directory couldn't be saved",thisName(),GetString(thisTag()));
  	}
  
  	echodir();
  }
--- 1145,1161 ----
  	}
  
+     bool ok = false;
  	if(!flnm)
  		post("%s - %s: invalid filename",thisName(),GetString(thisTag()));
  	else {
  		string file(MakeFilename(flnm));
!         ok = xml?pl->SvDirXML(curdir,file.c_str(),-1,absdir):pl->SvDir(curdir,file.c_str(),-1,absdir);
!         if(!ok) 
! 		    post("%s - %s: directory couldn't be saved",thisName(),GetString(thisTag()));
  	}
  
+     t_atom at; SetBool(at,ok);
+     ToOutAnything(GetOutAttr(),thisTag(),1,&at);
+ 
  	echodir();
  }
***************
*** 1139,1147 ****
  {
  	if(IsSymbol(a))
! 		ToOutSymbol(ix,GetSymbol(a));
  	else if(IsFloat(a))
! 		ToOutFloat(ix,GetFloat(a));
  	else if(IsInt(a))
! 		ToOutInt(ix,GetInt(a));
  	else
  		post("%s - %s type not supported!",thisName(),GetString(thisTag()));
--- 1180,1188 ----
  {
  	if(IsSymbol(a))
! 		ToSysSymbol(ix,GetSymbol(a));
  	else if(IsFloat(a))
! 		ToSysFloat(ix,GetFloat(a));
  	else if(IsInt(a))
! 		ToSysInt(ix,GetInt(a));
  	else
  		post("%s - %s type not supported!",thisName(),GetString(thisTag()));
***************
*** 1152,1185 ****
  pooldata *pool::GetPool(const S *s)
  {
! 	pooldata *pi = head;
! 	for(; pi && pi->sym != s; pi = pi->nxt) (V)0;
! 
! 	if(pi) {
! 		pi->Push();
! 		return pi;
! 	}
! 	else {
! 		pooldata *p = new pooldata(s);
! 		p->Push();
! 
! 		// now add to chain
! 		if(head) head->nxt = p;
! 		else head = p;
! 		tail = p;
! 		return p;
! 	}
  }
  
  V pool::RmvPool(pooldata *p)
  {
! 	pooldata *prv = NULL,*pi = head;
! 	for(; pi && pi != p; prv = pi,pi = pi->nxt) (V)0;
! 
! 	if(pi && !pi->Pop()) {
! 		if(prv) prv->nxt = pi->nxt;
! 		else head = pi->nxt;
! 		if(!pi->nxt) tail = pi;
! 
! 		delete pi;
  	}
  }
--- 1193,1215 ----
  pooldata *pool::GetPool(const S *s)
  {
!     PoolMap::iterator it = poolmap.find(s);
!     pooldata *p;   
! 	if(it != poolmap.end())
!         p = it->second;
! 	else
! 		poolmap[s] = p = new pooldata(s);
!     p->Push();
! 	return p;
  }
  
  V pool::RmvPool(pooldata *p)
  {
!     FLEXT_ASSERT(p->sym);
!     PoolMap::iterator it = poolmap.find(p->sym);
!     FLEXT_ASSERT(it != poolmap.end());
!     FLEXT_ASSERT(p == it->second);
! 	if(!p->Pop()) {
!         poolmap.erase(it);
! 		delete p;
  	}
  }

Index: pool.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/pool/source/pool.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** pool.cpp	14 Mar 2006 17:14:53 -0000	1.22
--- pool.cpp	30 Sep 2006 19:23:16 -0000	1.23
***************
*** 3,7 ****
  pool - hierarchical storage object for PD and Max/MSP
  
! Copyright (c) 2002-2005 Thomas Grill
  For information on usage and redistribution, and for a DISCLAIMER OF ALL
  WARRANTIES, see the file, "license.txt," in this distribution.  
--- 3,7 ----
  pool - hierarchical storage object for PD and Max/MSP
  
! Copyright (c) 2002-2006 Thomas Grill (gr at grrrr.org)
  For information on usage and redistribution, and for a DISCLAIMER OF ALL
  WARRANTIES, see the file, "license.txt," in this distribution.  

Index: pool.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/pool/source/pool.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** pool.h	22 Oct 2005 18:56:30 -0000	1.11
--- pool.h	30 Sep 2006 19:23:16 -0000	1.12
***************
*** 3,7 ****
  pool - hierarchical storage object for PD and Max/MSP
  
! Copyright (c) 2002-2005 Thomas Grill
  For information on usage and redistribution, and for a DISCLAIMER OF ALL
  WARRANTIES, see the file, "license.txt," in this distribution.  
--- 3,7 ----
  pool - hierarchical storage object for PD and Max/MSP
  
! Copyright (c) 2002-2006 Thomas Grill (gr at grrrr.org)
  For information on usage and redistribution, and for a DISCLAIMER OF ALL
  WARRANTIES, see the file, "license.txt," in this distribution.  
***************
*** 129,132 ****
--- 129,134 ----
  	~pooldata();
  
+     bool Private() const { return sym == NULL; }
+ 
  	V Push() { ++refs; }
  	BL Pop() { return --refs > 0; }





More information about the Pd-cvs mailing list