[PD-cvs] externals/grill/pool/source main.cpp,1.8,1.9 pool.cpp,1.13,1.14

Thomas Grill xovo at users.sourceforge.net
Fri Mar 25 05:53:45 CET 2005


Update of /cvsroot/pure-data/externals/grill/pool/source
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6962/source

Modified Files:
	main.cpp pool.cpp 
Log Message:
update for flext build system
added saving/loading of spaces and other special characters (escaping)


Index: main.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/pool/source/main.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** main.cpp	4 Jan 2005 05:00:38 -0000	1.8
--- main.cpp	25 Mar 2005 04:53:43 -0000	1.9
***************
*** 233,237 ****
  {
  	post("");
! 	post("pool %s - hierarchical storage object, (C)2002-2004 Thomas Grill",POOL_VERSION);
  	post("");
  
--- 233,237 ----
  {
  	post("");
! 	post("pool %s - hierarchical storage object, (C)2002-2005 Thomas Grill",POOL_VERSION);
  	post("");
  

Index: pool.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/pool/source/pool.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** pool.cpp	4 Jan 2005 05:00:39 -0000	1.13
--- pool.cpp	25 Mar 2005 04:53:43 -0000	1.14
***************
*** 468,489 ****
  
  
! static C *ReadAtom(C *c,A *a)
  {
! 	// skip whitespace
  	while(*c && isspace(*c)) ++c;
  	if(!*c) return NULL;
  
! 	const C *m = c; // remember position
! 
      // 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) == 1) {
          if(a) {
              int ires = (int)fres; // try a cast
--- 468,504 ----
  
  
! static char *ReadAtom(char *c,A *a)
  {
! 	// skip leading whitespace
  	while(*c && isspace(*c)) ++c;
  	if(!*c) return NULL;
  
! 	char tmp[1024];
!     char *m = tmp; // write position
!     
      // go to next whitespace
!     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
  
      float fres;
      // first try float
!     if(sscanf(tmp,"%f",&fres) == 1) {
          if(a) {
              int ires = (int)fres; // try a cast
***************
*** 496,504 ****
      // no, it's a symbol
      else {
!         if(a) flext::SetString(*a,m);
      }
  
-     // set back the saved character
-     *c = t;
  	return c;
  }
--- 511,517 ----
      // no, it's a symbol
      else {
!         if(a) flext::SetString(*a,tmp);
      }
  
  	return c;
  }
***************
*** 543,550 ****
  		break;
  #endif
! 	case A_SYMBOL:
! 		os << flext::GetString(flext::GetSymbol(a));
  		break;
  	}
  }
  
--- 556,569 ----
  		break;
  #endif
!     case A_SYMBOL: {
!         const char *c = flext::GetString(flext::GetSymbol(a));
!         for(; *c; ++c) {
!             if(isspace(*c) || *c == '\\' || *c == ',')
!                 os << '\\';
! 	        os << *c;
!         }
  		break;
  	}
+     }
  }
  
***************
*** 552,558 ****
  {
  	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 << ' ';
  	}
--- 571,575 ----





More information about the Pd-cvs mailing list