[PD-cvs] pd/src kernel.c,1.1.2.57,1.1.2.58

Mathieu Bouchard matju at users.sourceforge.net
Wed Jul 18 06:16:19 CEST 2007


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20931

Modified Files:
      Tag: desiredata
	kernel.c 
Log Message:
removed some MAXPDSTRING


Index: kernel.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/kernel.c,v
retrieving revision 1.1.2.57
retrieving revision 1.1.2.58
diff -C2 -d -r1.1.2.57 -r1.1.2.58
*** kernel.c	18 Jul 2007 03:57:00 -0000	1.1.2.57
--- kernel.c	18 Jul 2007 04:16:17 -0000	1.1.2.58
***************
*** 17,20 ****
--- 17,21 ----
  #include <stdarg.h>
  #include <string.h>
+ #include <sstream>
  #include <fcntl.h>
  #include <stdio.h>
***************
*** 34,37 ****
--- 35,40 ----
  #define a_index    a_w.w_index
  
+ using namespace std;
+ 
  /* T.Grill - bit alignment for signal vectors (must be a multiple of 8!) */
  /* if undefined no alignment occurs */
***************
*** 1606,1632 ****
  /* called just after a doublequote in version 1 parsing */
  char *binbuf_text_quoted(t_binbuf *x, char *t, char *end) {
! 	char buf[MAXPDSTRING+1], *bufp=buf, *ebuf = buf+MAXPDSTRING;
! 	while (t!=end && bufp!=ebuf) {
  		char c = *t++;
  		if (c=='"') break;
! 		if (c!='\\') {*bufp++ = c; continue;}
  		c = *t++;
! 		if (c=='a') {*bufp++='\a'; continue;}
! 		if (c=='b') {*bufp++='\b'; continue;}
! 		if (c=='f') {*bufp++='\f'; continue;}
! 		if (c=='n') {*bufp++='\n'; continue;}
! 		if (c=='r') {*bufp++='\r'; continue;}
! 		if (c=='v') {*bufp++='\v'; continue;}
! 		if (c=='t') {*bufp++='\t'; continue;}
! 		if (c=='"') {*bufp++='\"'; continue;}
! 		if (c=='\\'){*bufp++='\\'; continue;}
  		if (c=='\n'){continue;}
  		/* if (c=='u') ... */
  		/* if (c=='x') ... */
  		/* if (isdigit(c)) ... */
! 		*bufp++ = c; /* ignore syntax error (should it?) */
  	}
! 	*bufp=0;
! 	binbuf_addv(x,"t",buf);
  	return t; /* ignore syntax error (should it?) */
  }
--- 1609,1634 ----
  /* called just after a doublequote in version 1 parsing */
  char *binbuf_text_quoted(t_binbuf *x, char *t, char *end) {
! 	ostringstream buf;
! 	while (t!=end) {
  		char c = *t++;
  		if (c=='"') break;
! 		if (c!='\\') {buf << c; continue;}
  		c = *t++;
! 		if (c=='a') {buf << '\a'; continue;}
! 		if (c=='b') {buf << '\b'; continue;}
! 		if (c=='f') {buf << '\f'; continue;}
! 		if (c=='n') {buf << '\n'; continue;}
! 		if (c=='r') {buf << '\r'; continue;}
! 		if (c=='v') {buf << '\v'; continue;}
! 		if (c=='t') {buf << '\t'; continue;}
! 		if (c=='"') {buf << '\"'; continue;}
! 		if (c=='\\'){buf << '\\'; continue;}
  		if (c=='\n'){continue;}
  		/* if (c=='u') ... */
  		/* if (c=='x') ... */
  		/* if (isdigit(c)) ... */
! 		buf << c; /* ignore syntax error (should it?) */
  	}
! 	binbuf_addv(x,"t",buf.str().data());
  	return t; /* ignore syntax error (should it?) */
  }
***************
*** 1637,1641 ****
  /* TODO: double-quotes, braces, test backslashes&dollars */
  char *binbuf_text_matju(t_binbuf *x, char *t, char *end) {
- 	char buf[MAXPDSTRING+1], *bufp=buf, *ebuf = buf+MAXPDSTRING;
  	int doll=0;
  	while (t!=end && isspace(*t)) t++;
--- 1639,1642 ----
***************
*** 1649,1664 ****
  	    if (t==end || isspace(*token)) {binbuf_addv(x,"f",v); return token;}
  	}
! 	for (; t!=end && bufp!=ebuf && *t!=',' && *t!=';' && !isspace(*t); bufp++) {
  		doll |= t[0]=='$' && t+1!=end && isdigit(t[1]);
  		if (*t=='\\') t++;
! 		if (t!=end) *bufp++ = *t++;
  	}
- 	*bufp=0;
  	if (doll) {
! 		if (buf[0]!='$') doll=0;
! 		for (bufp = buf+1; *bufp; bufp++) if (!isdigit(*bufp)) doll=0;
! 		if (doll) binbuf_addv(x,"$",atoi(buf+1));
! 		else      binbuf_addv(x,"&",gensym(buf));
! 	} else            binbuf_addv(x,"t",buf);
  	return t;
  }
--- 1650,1666 ----
  	    if (t==end || isspace(*token)) {binbuf_addv(x,"f",v); return token;}
  	}
! 	ostringstream buf;
! 	for (; t!=end && *t!=',' && *t!=';' && !isspace(*t); ) {
  		doll |= t[0]=='$' && t+1!=end && isdigit(t[1]);
  		if (*t=='\\') t++;
! 		if (t!=end) buf << *t++;
  	}
  	if (doll) {
! 		const char *b = buf.str().data();
! 		if (b[0]!='$') doll=0;
! 		for (b++; *b; b++) if (!isdigit(*b)) doll=0;
! 		if (doll) binbuf_addv(x,"$",atoi(buf.str().data()+1));
! 		else      binbuf_addv(x,"&",gensym(buf.str().data()));
! 	} else            binbuf_addv(x,"t",buf.str().data());
  	return t;
  }





More information about the Pd-cvs mailing list