diff options
author | Thomas Grill <xovo@users.sourceforge.net> | 2005-03-25 04:53:43 +0000 |
---|---|---|
committer | Thomas Grill <xovo@users.sourceforge.net> | 2005-03-25 04:53:43 +0000 |
commit | 83c049b6c7eb05aabbfc008f46541c9d83b2be01 (patch) | |
tree | 778b1ca4f6a97b39712455bff4700a87fe9c5d38 /externals/grill/pool | |
parent | 53bf2216c3d76fdba0c98e6b41267d6b09dab1c6 (diff) |
update for flext build system
added saving/loading of spaces and other special characters (escaping)
svn path=/trunk/; revision=2644
Diffstat (limited to 'externals/grill/pool')
-rw-r--r-- | externals/grill/pool/pool.vcproj | 6 | ||||
-rw-r--r-- | externals/grill/pool/readme.txt | 9 | ||||
-rw-r--r-- | externals/grill/pool/source/main.cpp | 2 | ||||
-rw-r--r-- | externals/grill/pool/source/pool.cpp | 47 |
4 files changed, 37 insertions, 27 deletions
diff --git a/externals/grill/pool/pool.vcproj b/externals/grill/pool/pool.vcproj index 1ec3b570..39aec802 100644 --- a/externals/grill/pool/pool.vcproj +++ b/externals/grill/pool/pool.vcproj @@ -21,7 +21,7 @@ Name="VCCLCompilerTool" Optimization="2" InlineFunctionExpansion="1" - AdditionalIncludeDirectories="f:\prog\pd\pd-cvs\src,f:\prog\max\flext\source" + AdditionalIncludeDirectories="c:\programme\audio\pd\bin\src,..\flext\source" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FLEXT_SYS=2" StringPooling="TRUE" RuntimeLibrary="4" @@ -43,7 +43,7 @@ OutputFile="pd-msvc/pool.dll" LinkIncremental="1" SuppressStartupBanner="TRUE" - AdditionalLibraryDirectories="f:\prog\pd\pd-cvs\bin,f:\prog\max\flext\pd-msvc" + AdditionalLibraryDirectories="c:\programme\audio\pd\bin" ProgramDatabaseFile=".\pd-msvc/r/pool.pdb" ImportLibrary=".\pd-msvc/r/pool.lib" TargetMachine="1"/> @@ -87,7 +87,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""c:\data\prog\pd\pd-cvs\src";c:\data\prog\max\flext\source" + AdditionalIncludeDirectories=""c:\data\pd\pd-cvs\src";..\flext\source" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FLEXT_SYS=2" StringPooling="TRUE" BasicRuntimeChecks="3" diff --git a/externals/grill/pool/readme.txt b/externals/grill/pool/readme.txt index bdb0be1e..9b57f37b 100644 --- a/externals/grill/pool/readme.txt +++ b/externals/grill/pool/readme.txt @@ -83,6 +83,7 @@ Version history: - 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 0.2.0: - attributes (pool,private,echodir,absdir) @@ -102,14 +103,6 @@ Version history: --------------------------------------------------------------------------- -BUGS: -- pool does not handle symbols with spaces, colons or all digits - - -TODO list: -- check for invalid symbols (spaces, colons) - general: - what is output as value if it is key only? (Max->nothing!) - XML format ok? - diff --git a/externals/grill/pool/source/main.cpp b/externals/grill/pool/source/main.cpp index 8dfa06e8..21dbb0ce 100644 --- a/externals/grill/pool/source/main.cpp +++ b/externals/grill/pool/source/main.cpp @@ -232,7 +232,7 @@ pooldata *pool::head,*pool::tail; V pool::setup(t_classid c) { post(""); - post("pool %s - hierarchical storage object, (C)2002-2004 Thomas Grill",POOL_VERSION); + post("pool %s - hierarchical storage object, (C)2002-2005 Thomas Grill",POOL_VERSION); post(""); head = tail = NULL; diff --git a/externals/grill/pool/source/pool.cpp b/externals/grill/pool/source/pool.cpp index 35dfa2fe..7032707d 100644 --- a/externals/grill/pool/source/pool.cpp +++ b/externals/grill/pool/source/pool.cpp @@ -467,24 +467,39 @@ BL pooldir::Copy(pooldir *p,I depth,BL cut) } -static C *ReadAtom(C *c,A *a) +static char *ReadAtom(char *c,A *a) { - // skip whitespace + // skip leading whitespace while(*c && isspace(*c)) ++c; if(!*c) return NULL; - const C *m = c; // remember position - + char tmp[1024]; + char *m = tmp; // write position + // go to next whitespace - // \todo recognize symbol escapes - for(; *c && !isspace(*c); ++c) {} + for(bool escaped = false;; ++c) + if(*c == '\\') { + if(escaped) { + *m++ = *c; + escaped = false; + } + else + escaped = true; + } + else if(!*c || (isspace(*c) && !escaped)) { + *m = 0; + break; + } + else { + *m++ = *c; + escaped = false; + } // save character and set delimiter - char t = *c; *c = 0; float fres; // first try float - if(sscanf(m,"%f",&fres) == 1) { + if(sscanf(tmp,"%f",&fres) == 1) { if(a) { int ires = (int)fres; // try a cast if(fres == ires) @@ -495,11 +510,9 @@ static C *ReadAtom(C *c,A *a) } // no, it's a symbol else { - if(a) flext::SetString(*a,m); + if(a) flext::SetString(*a,tmp); } - // set back the saved character - *c = t; return c; } @@ -542,18 +555,22 @@ static V WriteAtom(ostream &os,const A &a) os << a.a_w.w_long; break; #endif - case A_SYMBOL: - os << flext::GetString(flext::GetSymbol(a)); + case A_SYMBOL: { + const char *c = flext::GetString(flext::GetSymbol(a)); + for(; *c; ++c) { + if(isspace(*c) || *c == '\\' || *c == ',') + os << '\\'; + os << *c; + } break; } + } } static V WriteAtoms(ostream &os,const flext::AtomList &l) { for(I i = 0; i < l.Count(); ++i) { -// if(IsSymbol(l[i]) os << "\""; WriteAtom(os,l[i]); -// if(IsSymbol(l[i]) os << "\""; if(i < l.Count()-1) os << ' '; } } |