diff options
Diffstat (limited to 'externals/grill/pool')
-rw-r--r-- | externals/grill/pool/pool.vcproj | 6 | ||||
-rw-r--r-- | externals/grill/pool/readme.txt | 1 | ||||
-rw-r--r-- | externals/grill/pool/source/pool.cpp | 69 |
3 files changed, 35 insertions, 41 deletions
diff --git a/externals/grill/pool/pool.vcproj b/externals/grill/pool/pool.vcproj index 593a3177..4eceac34 100644 --- a/externals/grill/pool/pool.vcproj +++ b/externals/grill/pool/pool.vcproj @@ -87,7 +87,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="f:\prog\pd\pd-cvs\src,f:\prog\max\flext\source" + AdditionalIncludeDirectories=""c:\data\prog\pd\pd-cvs\src";c:\data\prog\max\flext\source" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FLEXT_SYS=2" StringPooling="TRUE" BasicRuntimeChecks="3" @@ -108,9 +108,9 @@ Name="VCLinkerTool" AdditionalDependencies="pd.lib" OutputFile=".\pd-msvc/d/pool.dll" - LinkIncremental="1" + LinkIncremental="2" SuppressStartupBanner="TRUE" - AdditionalLibraryDirectories="f:\prog\pd\pd-cvs\bin" + AdditionalLibraryDirectories="c:\data\prog\pd\pd-cvs\bin" GenerateDebugInformation="TRUE" ProgramDatabaseFile=".\pd-msvc/d/pool.pdb" ImportLibrary=".\pd-msvc/d/pool.lib" diff --git a/externals/grill/pool/readme.txt b/externals/grill/pool/readme.txt index 381feffe..9681dd00 100644 --- a/externals/grill/pool/readme.txt +++ b/externals/grill/pool/readme.txt @@ -93,6 +93,7 @@ Version history: - 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 0.2.0: - attributes (pool,private,echodir,absdir) diff --git a/externals/grill/pool/source/pool.cpp b/externals/grill/pool/source/pool.cpp index 8c89a676..d554a9b6 100644 --- a/externals/grill/pool/source/pool.cpp +++ b/externals/grill/pool/source/pool.cpp @@ -475,51 +475,44 @@ static C *ReadAtom(C *c,A *a) const C *m = c; // remember position - // check for word type (s = 0,1,2 ... int,float,symbol) - I s = 0; - for(; *c && !isspace(*c); ++c) { - if(!isdigit(*c)) - if(!s && (*c == '-' || *c == '+')) {} // minus or plus is ok + // go to next whitespace + // \todo recognize symbol escapes + for(; *c && !isspace(*c); ++c) {} + + // save character and set delimiter + char t = *c; *c = 0; + + float fres; + // first try float + if(sscanf(m,"%f",&fres)) { + if(a) { + int ires = (int)fres; // try a cast + if(fres == ires) + flext::SetInt(*a,ires); else - s = (*c != '.' || s == 1)?2:1; - } - - if(a) { - switch(s) { - case 0: // integer -#if FLEXT_SYS == FLEXT_SYS_MAX - flext::SetInt(*a,atoi(m)); - break; -#endif - case 1: // float - flext::SetFloat(*a,(F)atof(m)); - break; - default: { // anything else is a symbol - C t = *c; *c = 0; - flext::SetString(*a,m); - *c = t; - break; - } - } - } + flext::SetFloat(*a,fres); + } + } + // no, it's a symbol + else { + if(a) flext::SetString(*a,m); + } + // set back the saved character + *c = t; return c; } static BL ParseAtoms(C *tmp,flext::AtomList &l) { - I i,cnt; - C *t = tmp; - for(cnt = 0; ; ++cnt) { - t = ReadAtom(t,NULL); - if(!t) break; - } - - l(cnt); - if(cnt) { - for(i = 0,t = tmp; i < cnt; ++i) - t = ReadAtom(t,&l[i]); - } + const int MAXATOMS = 1024; + int cnt = 0; + t_atom atoms[MAXATOMS]; + for(char *t = tmp; *t && cnt < MAXATOMS; ++cnt) { + t = ReadAtom(t,&atoms[cnt]); + if(!t) break; + } + l(cnt,atoms); return true; } |