pool-master/ 0000755 0001750 0001750 00000000000 12504366625 013563 5 ustar zmoelnig zmoelnig pool-master/readme.txt 0000644 0001750 0001750 00000012045 12504366625 015563 0 ustar zmoelnig zmoelnig pool - a hierarchical storage object for PD and Max/MSP
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.
Donations for further development of the package are highly appreciated.
Visit https://www.paypal.com/xclick/business=gr%40grrrr.org&item_name=pool&no_note=1&tax=0¤cy_code=EUR
----------------------------------------------------------------------------
Goals/features of the package:
- pool can store and retrieve key/value pairs, where a key can be any atom and
the value can be any list of atoms
- pool can manage folders. A folder name can be any atom.
- pool objects can be named and then share their data space
- clipboard operations are possible in a pool or among several pools
- file operations can load/save data from disk
----------------------------------------------------------------------------
IMPORTANT INFORMATION for all PD users:
Put the pd-msvc/pool.dll, pd-linux/pool.pd_linux or pd-darwin/pool.pd_darwin file
into the extra folder of the PD installation, or use a -path or -lib option
at PD startup to find the pool external.
Put the help-pool.pd file into the doc\5.reference subfolder of your PD installation.
----------------------------------------------------------------------------
IMPORTANT INFORMATION for all Max/MSP users:
For Mac OSX put the max-osx/pool.mxd file into the folder
/Library/Application Support/Cycling '74/externals
For Mac OS9 put the max-os9/pool.mxe file into the externals subfolder of your Max/MSP installation
For Windows put the max-msvc\pool.mxe file into the folder
C:\program files\common files\Cycling '74\externals (english version)
Put the pool.help file into the max-help folder.
============================================================================
BUILDING from source
--------------------
You will need the flext C++ layer for PD and Max/MSP externals to compile this.
See http://grrrr.org/ext/flext
Download, install and compile the package.
Afterwards you can proceed with building this external.
POSIX configure style
---------------------
./bootstrap.sh
./configure --enable-system=pd_OR_max --with-sysdir=PATH_TO_PD_OR_MAX_HEADER_FILES --libdir=WHERE_TO_PUT_THE_EXTERNAL
make
sudo make install
pd/Max - Windows - Microsoft Visual C, Borland C++, MinGW:
----------------------------------------------------------
Start a command shell with your eventual build environment
(e.g. run vcvars32.bat for Microsoft Visual Studio)
then run
..\flext\build.bat
(you would have to substitute ..\flext with the respective path to the flext package)
pd/Max - OSX/Linux - GCC:
-------------------------
From a shell run
bash ../flext/build.sh
(you would have to substitute ../flext with the respective path to the flext package)
============================================================================
Version history:
0.2.2:
- fixed serious bug with clearing values and dirs. e.g. "clrall" and "clrrec" messages.
- fixed double-free for clearing dirs and values
- re-introduced a help message
- fixed bug in nested-dir XML saving
- changed printrec/printroot to display empty folders
- new curdir attribute for getting/setting the current directory
- changed pool name searching with STL code (more efficient)
- added success/error reporting for file operations (through attribute outlet)
- 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
- store/create also empty dirs with file I/O
- more inlined functions and better symbol handling
- added "seti" message to set elements at index
- added "clri" message to erase elements at index
- fixed bad bug: pool::priv was not initialized
- enhanced and optimized atom parsing
- escaped symbols (with \) for whitespace support on store and load
- escape symbols also with "" to help the load routine
- improved reading of legacy data by Frank Barknecht
- use statically allocated lists where feasible
- bug fix: [reset( didn't reset the current dir
- file loading: fixed recognition of stringified directory names
0.2.0:
- attributes (pool,private,echodir,absdir)
- added "geti" message for retrieval of a value at an index
- fixed bug in "get" message if key not present
- adapted source to flext 0.4.1 - register methods at class creation
- extensive use of hashing for keys and directories
- database can be saved/loaded as XML data
- fixed bug with stored numbers starting with - or +
- relative file names will be based on the folder of the current patcher
- added printall, printrec, printroot messages for console printout
- added mkchdir, mkchsub to create and change to directories at once
- change storage object only when name has changed
0.1.0:
- first public release
---------------------------------------------------------------------------
general:
- what is output as value if it is key only? (Max->nothing!)
- XML format ok?
pool-master/pool-0.2.dtd 0000644 0001750 0001750 00000000217 12504366625 015526 0 ustar zmoelnig zmoelnig
pool-master/pool.vcproj 0000644 0001750 0001750 00000026202 12504366625 015763 0 ustar zmoelnig zmoelnig
pool-master/Makefile.am 0000755 0001750 0001750 00000000052 12504366625 015617 0 ustar zmoelnig zmoelnig #
# automake template
#
SUBDIRS = source
pool-master/source/ 0000755 0001750 0001750 00000000000 12504366625 015063 5 ustar zmoelnig zmoelnig pool-master/source/pool.h 0000644 0001750 0001750 00000014452 12504366625 016213 0 ustar zmoelnig zmoelnig /*
pool - hierarchical storage object for PD and Max/MSP
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$
$LastChangedBy$
*/
#ifndef __POOL_H
#define __POOL_H
#define FLEXT_ATTRIBUTES 1
#include
#if !defined(FLEXT_VERSION) || (FLEXT_VERSION < 500)
#error You need at least flext version 0.5.0
#endif
#include
using namespace std;
typedef flext::AtomListStatic<8> Atoms;
class poolval:
public flext
{
public:
poolval(const t_atom &key,AtomList *data);
~poolval();
poolval &Set(AtomList *data);
poolval *Dup() const;
t_atom key;
AtomList *data;
poolval *nxt;
};
class pooldir:
public flext
{
public:
pooldir(const t_atom &dir,pooldir *parent,int vcnt,int dcnt);
~pooldir();
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);
bool Paste(const pooldir *p,int depth,bool repl,bool mkdir);
bool Copy(pooldir *p,int depth,bool cur);
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 t_atom &v) const { return FoldBits(AtomHash(v),vbits); }
int DIdx(const t_atom &d) const { return FoldBits(AtomHash(d),dbits); }
t_atom dir;
pooldir *nxt;
pooldir *parent;
const int vbits,dbits,vsize,dsize;
static unsigned int FoldBits(unsigned long h,int bits);
static int Int2Bits(unsigned long n);
struct valentry { int cnt; poolval *v; };
struct direntry { int cnt; pooldir *d; };
valentry *vals;
direntry *dirs;
private:
bool LdDirXMLRec(istream &is,int depth,bool mkdir,AtomList &d);
};
class pooldata:
public flext
{
public:
pooldata(const t_symbol *s = NULL,int vcnt = 0,int dcnt = 0);
~pooldata();
bool Private() const { return sym == NULL; }
void Push() { ++refs; }
bool Pop() { return --refs > 0; }
void Reset() { root.Reset(); }
bool MkDir(const AtomList &d,int vcnt = 0,int dcnt = 0)
{
root.AddDir(d,vcnt,dcnt);
return true;
}
bool ChkDir(const AtomList &d)
{
return root.GetDir(d) != NULL;
}
bool RmDir(const AtomList &d)
{
return root.DelDir(d);
}
bool Set(const AtomList &d,const t_atom &key,AtomList *data,bool over = true)
{
pooldir *pd = root.GetDir(d);
if(!pd) return false;
pd->SetVal(key,data,over);
return true;
}
bool Seti(const AtomList &d,int ix,AtomList *data)
{
pooldir *pd = root.GetDir(d);
if(!pd) return false;
pd->SetVali(ix,data);
return true;
}
bool Clr(const AtomList &d,const t_atom &key)
{
pooldir *pd = root.GetDir(d);
if(!pd) return false;
pd->ClrVal(key);
return true;
}
bool Clri(const AtomList &d,int ix)
{
pooldir *pd = root.GetDir(d);
if(!pd) return false;
pd->ClrVali(ix);
return true;
}
bool ClrAll(const AtomList &d,bool rec,bool dironly = false)
{
pooldir *pd = root.GetDir(d);
if(!pd) return false;
pd->Clear(rec,dironly);
return true;
}
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 t_atom &key)
{
pooldir *pd = root.GetDir(d);
return pd?pd->GetVal(key):NULL;
}
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,int ix)
{
pooldir *pd = root.GetDir(d);
return pd?pd->RefVali(ix):NULL;
}
int CntAll(const AtomList &d)
{
pooldir *pd = root.GetDir(d);
return pd?pd->CntAll():0;
}
int PrintAll(const AtomList &d);
int GetAll(const AtomList &d,t_atom *&keys,Atoms *&lst);
int CntSub(const AtomList &d)
{
pooldir *pd = root.GetDir(d);
return pd?pd->CntSub():0;
}
int GetSub(const AtomList &d,const t_atom **&dirs);
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);
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); }
int refs;
const t_symbol *sym;
pooldata *nxt;
pooldir root;
private:
static const t_atom nullatom;
};
#endif
pool-master/source/main.cpp 0000644 0001750 0001750 00000106201 12504366625 016513 0 ustar zmoelnig zmoelnig /*
pool - hierarchical storage object for PD and Max/MSP
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$
$LastChangedBy$
*/
#include "pool.h"
#include
#include