From d1ecedf8e46d5486253436aa7fd5ba4dff19d65b Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Wed, 3 Sep 2003 02:38:08 +0000 Subject: "" svn path=/trunk/; revision=930 --- externals/grill/pool/main.cpp | 50 ++++++++++++++++++++++++++++++++-------- externals/grill/pool/pool.pd | 8 +++++-- externals/grill/pool/pool.vcproj | 8 +++---- externals/grill/pool/readme.txt | 5 ++-- 4 files changed, 53 insertions(+), 18 deletions(-) (limited to 'externals/grill/pool') diff --git a/externals/grill/pool/main.cpp b/externals/grill/pool/main.cpp index 135872b3..0cf73ccd 100644 --- a/externals/grill/pool/main.cpp +++ b/externals/grill/pool/main.cpp @@ -9,6 +9,7 @@ WARRANTIES, see the file, "license.txt," in this distribution. */ #include "pool.h" +#include #define POOL_VERSION "0.2.0pre" @@ -139,6 +140,8 @@ private: static pooldata *GetPool(const S *s); static V RmvPool(pooldata *p); + std::string MakeFilename(const C *fn) const; + FLEXT_CALLVAR_V(mg_pool,ms_pool) FLEXT_ATTRVAR_B(absdir) FLEXT_ATTRVAR_B(echo) @@ -209,7 +212,7 @@ pooldata *pool::head,*pool::tail; V pool::setup(t_classid c) { post(""); - post("pool %s - hierarchical storage object,(C)2002-2003 Thomas Grill",POOL_VERSION); + post("pool %s - hierarchical storage object, (C)2002-2003 Thomas Grill",POOL_VERSION); post(""); head = tail = NULL; @@ -874,8 +877,11 @@ V pool::load(I argc,const A *argv,BL xml) if(!flnm) post("%s - %s: no filename given",thisName(),sym); - else if(!(xml?pl->LoadXML(flnm):pl->Load(flnm))) - post("%s - %s: error loading data",thisName(),sym); + else { + string fl(MakeFilename(flnm)); + if(!(xml?pl->LoadXML(fl.c_str()):pl->Load(fl.c_str()))) + post("%s - %s: error loading data",thisName(),sym); + } echodir(); } @@ -891,8 +897,11 @@ V pool::save(I argc,const A *argv,BL xml) if(!flnm) post("%s - %s: no filename given",thisName(),sym); - else if(!(xml?pl->SaveXML(flnm):pl->Save(flnm))) - post("%s - %s: error saving data",thisName(),sym); + else { + string fl(MakeFilename(flnm)); + if(!(xml?pl->SaveXML(fl.c_str()):pl->Save(fl.c_str()))) + post("%s - %s: error saving data",thisName(),sym); + } echodir(); } @@ -908,8 +917,11 @@ V pool::lddir(I argc,const A *argv,BL xml) if(!flnm) post("%s - %s: invalid filename",thisName(),sym); - else if(!(xml?pl->LdDirXML(curdir,flnm,0):pl->LdDir(curdir,flnm,0))) - post("%s - %s: directory couldn't be loaded",thisName(),sym); + else { + string fl(MakeFilename(flnm)); + if(!(xml?pl->LdDirXML(curdir,fl.c_str(),0):pl->LdDir(curdir,fl.c_str(),0))) + post("%s - %s: directory couldn't be loaded",thisName(),sym); + } echodir(); } @@ -941,7 +953,8 @@ V pool::ldrec(I argc,const A *argv,BL xml) if(!flnm) post("%s - %s: invalid filename",thisName(),sym); else { - if(!(xml?pl->LdDirXML(curdir,flnm,depth,mkdir):pl->LdDir(curdir,flnm,depth,mkdir))) + string fl(MakeFilename(flnm)); + if(!(xml?pl->LdDirXML(curdir,fl.c_str(),depth,mkdir):pl->LdDir(curdir,fl.c_str(),depth,mkdir))) post("%s - %s: directory couldn't be saved",thisName(),sym); } @@ -960,7 +973,8 @@ V pool::svdir(I argc,const A *argv,BL xml) if(!flnm) post("%s - %s: invalid filename",thisName(),sym); else { - if(!(xml?pl->SvDirXML(curdir,flnm,0,absdir):pl->SvDir(curdir,flnm,0,absdir))) + string fl(MakeFilename(flnm)); + if(!(xml?pl->SvDirXML(curdir,fl.c_str(),0,absdir):pl->SvDir(curdir,fl.c_str(),0,absdir))) post("%s - %s: directory couldn't be saved",thisName(),sym); } @@ -979,7 +993,8 @@ V pool::svrec(I argc,const A *argv,BL xml) if(!flnm) post("%s - %s: invalid filename",thisName(),sym); else { - if(!(xml?pl->SvDirXML(curdir,flnm,-1,absdir):pl->SvDir(curdir,flnm,-1,absdir))) + string fl(MakeFilename(flnm)); + if(!(xml?pl->SvDirXML(curdir,fl.c_str(),-1,absdir):pl->SvDir(curdir,fl.c_str(),-1,absdir))) post("%s - %s: directory couldn't be saved",thisName(),sym); } @@ -1051,3 +1066,18 @@ V pool::RmvPool(pooldata *p) } } +std::string pool::MakeFilename(const C *fn) const +{ +#if FLEXT_SYS == FLEXT_SYS_PD + C *sl = strrchr(fn,'/'); + if(!sl) sl = strrchr(fn,'\\'); + if(!sl) { + const C *p = GetString(canvas_getdir(thisCanvas())); + return string(p)+'/'+fn; + } + else + return fn; +#else + return fn; +#endif +} diff --git a/externals/grill/pool/pool.pd b/externals/grill/pool/pool.pd index 3319914b..eab56fc3 100644 --- a/externals/grill/pool/pool.pd +++ b/externals/grill/pool/pool.pd @@ -1,4 +1,4 @@ -#N canvas 12 3 934 690 12; +#N canvas 12 3 936 692 12; #X msg 295 108 set 1 2 3; #X obj 308 619 print K; #X msg 607 211 getall; @@ -94,7 +94,7 @@ #X connect 23 0 26 0; #X restore 718 511 pd dirs; #X text 715 485 directory operations; -#N canvas 0 0 819 451 file 0; +#N canvas 0 0 821 453 file 0; #X text 117 207 save dir and subdirs; #X text 117 165 save data in current dir; #X text 117 253 load data into current dir; @@ -127,6 +127,8 @@ #X msg 473 228 svxrec pool.xml; #X msg 472 274 ldxdir pool.xml; #X msg 472 321 ldxrec pool.xml; +#X text 26 398 If the file name is given without a path specification +the folder containing the current patcher will be used.; #X connect 20 0 9 0; #X connect 21 0 9 0; #X connect 22 0 9 0; @@ -202,6 +204,7 @@ Grill; #X text 332 457 can be given for optimal performance; #X msg 428 218 get 3; #X msg 299 227 set 3 -1 1; +#X msg 41 518 getmethods; #X connect 0 0 72 0; #X connect 2 0 72 0; #X connect 3 0 72 0; @@ -236,3 +239,4 @@ Grill; #X connect 72 4 64 0; #X connect 75 0 72 0; #X connect 76 0 72 0; +#X connect 77 0 72 0; diff --git a/externals/grill/pool/pool.vcproj b/externals/grill/pool/pool.vcproj index 3b04751b..6370595d 100644 --- a/externals/grill/pool/pool.vcproj +++ b/externals/grill/pool/pool.vcproj @@ -24,7 +24,7 @@ Name="VCCLCompilerTool" Optimization="2" InlineFunctionExpansion="1" - AdditionalIncludeDirectories="c:\programme\audio\pd\src,f:\prog\max\flext\source" + AdditionalIncludeDirectories="f:\prog\pd\pd-cvs\src,f:\prog\max\flext\source" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FLEXT_SYS=2" StringPooling="TRUE" RuntimeLibrary="4" @@ -45,7 +45,7 @@ OutputFile="pd-msvc/pool.dll" LinkIncremental="1" SuppressStartupBanner="TRUE" - AdditionalLibraryDirectories="c:\programme\audio\pd\bin,f:\prog\max\flext\pd-msvc" + AdditionalLibraryDirectories="f:\prog\pd\pd-cvs\bin,f:\prog\max\flext\pd-msvc" ProgramDatabaseFile=".\pd-msvc/r/pool.pdb" ImportLibrary=".\pd-msvc/r/pool.lib" TargetMachine="1"/> @@ -89,7 +89,7 @@