aboutsummaryrefslogtreecommitdiff
path: root/externals
diff options
context:
space:
mode:
authorThomas Grill <xovo@users.sourceforge.net>2005-04-19 13:08:32 +0000
committerThomas Grill <xovo@users.sourceforge.net>2005-04-19 13:08:32 +0000
commit4868cd86e564ec1d61b1e10b4f3f993249974337 (patch)
treef8b52157ebc726e7645d5dad0959b11b9b14452c /externals
parent2980784b0084b1bfa265755530114f6d57abfccc (diff)
added saving/loading of spaces and other special characters (escaping)
more symbol escaping svn path=/trunk/; revision=2788
Diffstat (limited to 'externals')
-rw-r--r--externals/grill/pool/pool.vcproj2
-rw-r--r--externals/grill/pool/readme.txt1
-rw-r--r--externals/grill/pool/source/pool.cpp25
3 files changed, 23 insertions, 5 deletions
diff --git a/externals/grill/pool/pool.vcproj b/externals/grill/pool/pool.vcproj
index 39aec802..d1f6a34f 100644
--- a/externals/grill/pool/pool.vcproj
+++ b/externals/grill/pool/pool.vcproj
@@ -110,7 +110,7 @@
OutputFile=".\pd-msvc/d/pool.dll"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
- AdditionalLibraryDirectories="c:\data\prog\pd\pd-cvs\bin"
+ AdditionalLibraryDirectories="c:\data\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 9b57f37b..42103fa6 100644
--- a/externals/grill/pool/readme.txt
+++ b/externals/grill/pool/readme.txt
@@ -84,6 +84,7 @@ Version history:
- 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
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 7032707d..0ce81ed8 100644
--- a/externals/grill/pool/source/pool.cpp
+++ b/externals/grill/pool/source/pool.cpp
@@ -475,7 +475,15 @@ static char *ReadAtom(char *c,A *a)
char tmp[1024];
char *m = tmp; // write position
-
+
+ bool issymbol;
+ if(*c == '"') {
+ issymbol = true;
+ ++c;
+ }
+ else
+ issymbol = false;
+
// go to next whitespace
for(bool escaped = false;; ++c)
if(*c == '\\') {
@@ -486,9 +494,16 @@ static char *ReadAtom(char *c,A *a)
else
escaped = true;
}
+ else if(*c == '"' && issymbol && !escaped) {
+ // end of string
+ ++c;
+ FLEXT_ASSERT(!*c || isspace(*c));
+ *m = 0;
+ break;
+ }
else if(!*c || (isspace(*c) && !escaped)) {
- *m = 0;
- break;
+ *m = 0;
+ break;
}
else {
*m++ = *c;
@@ -499,7 +514,7 @@ static char *ReadAtom(char *c,A *a)
float fres;
// first try float
- if(sscanf(tmp,"%f",&fres) == 1) {
+ if(!issymbol && sscanf(tmp,"%f",&fres) == 1) {
if(a) {
int ires = (int)fres; // try a cast
if(fres == ires)
@@ -557,11 +572,13 @@ static V WriteAtom(ostream &os,const A &a)
#endif
case A_SYMBOL: {
const char *c = flext::GetString(flext::GetSymbol(a));
+ os << '"';
for(; *c; ++c) {
if(isspace(*c) || *c == '\\' || *c == ',')
os << '\\';
os << *c;
}
+ os << '"';
break;
}
}