From 83c049b6c7eb05aabbfc008f46541c9d83b2be01 Mon Sep 17 00:00:00 2001 From: Thomas Grill Date: Fri, 25 Mar 2005 04:53:43 +0000 Subject: update for flext build system added saving/loading of spaces and other special characters (escaping) svn path=/trunk/; revision=2644 --- externals/grill/pool/pool.vcproj | 6 ++--- externals/grill/pool/readme.txt | 9 +------ externals/grill/pool/source/main.cpp | 2 +- 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 @@ 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 << ' '; } } -- cgit v1.2.1