Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1640
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.58
retrieving revision 1.1.2.59
diff -C2 -d -r1.1.2.58 -r1.1.2.59
*** kernel.c 18 Jul 2007 04:16:17 -0000 1.1.2.58
--- kernel.c 18 Jul 2007 04:50:35 -0000 1.1.2.59
***************
*** 264,270 ****
char tbuf[30];
sprintf(tbuf, "%g", a->a_float);
! if (strlen(tbuf) < bufsize-1) strcpy(buf, tbuf);
! else if (a->a_float < 0) strcpy(buf, "-");
! else strcat(buf, "+");
} break;
case A_SYMBOL: {
--- 264,268 ----
char tbuf[30];
sprintf(tbuf, "%g", a->a_float);
! if (strlen(tbuf) < bufsize-1) strcpy(buf, tbuf); else strcpy(buf, a->a_float < 0 ? "-" : "+");
} break;
case A_SYMBOL: {
***************
*** 297,300 ****
--- 295,306 ----
}
+ /*
+ void atom_string(t_atom *a, char *buf, unsigned int bufsize) {
+ ostringstream b;
+ atom_ostream(a,b,bufsize-1);
+ strcpy(buf,b.str().data());
+ }
+ */
+
/* in which the value has bit 0 set if the key object is not a zombie,
and has bit 1 set if the object has been uploaded to the client */
***************
*** 1668,1672 ****
/* this one is for pd format version 0 */
char *binbuf_text_miller(t_binbuf *x, char *t, char *end) {
! char buf[MAXPDSTRING+1], *bufp = buf, *ebuf = buf+MAXPDSTRING;
/* it's an atom other than a comma or semi */
int q = 0, slash = 0, lastslash = 0, dollar = 0;
--- 1674,1678 ----
/* this one is for pd format version 0 */
char *binbuf_text_miller(t_binbuf *x, char *t, char *end) {
! ostringstream buf;
/* it's an atom other than a comma or semi */
int q = 0, slash = 0, lastslash = 0, dollar = 0;
***************
*** 1677,1681 ****
if (*t==',') {binbuf_addv(x,","); return t+1;}
do {
! char c = *bufp = *t++;
lastslash = slash;
slash = c=='\\';
--- 1683,1687 ----
if (*t==',') {binbuf_addv(x,","); return t+1;}
do {
! char c = *t++;
lastslash = slash;
slash = c=='\\';
***************
*** 1693,1708 ****
}
if (!lastslash && c == '$' && t!=end && isdigit(*t)) dollar = 1;
! if (!slash) bufp++;
! } while (t!=end && bufp!=ebuf && (slash || !strchr(" \n\r\t,;",*t)));
! *bufp = 0;
! if (q == 2 || q == 4 || q == 5 || q == 8) {binbuf_addv(x,"f",atof(buf)); return t;}
/* LATER try to figure out how to mix "$" and "\$" correctly; here, the backslashes were already
stripped so we assume all "$" chars are real dollars. In fact, we only know at least one was. */
if (dollar) {
! if (buf[0] != '$') dollar = 0;
! for (bufp = buf+1; *bufp; bufp++) if (!isdigit(*bufp)) dollar = 0;
! if (dollar) binbuf_addv(x,"$",atoi(buf+1));
! else binbuf_addv(x,"&",gensym(buf));
! } else binbuf_addv(x,"t",buf);
return t;
}
--- 1699,1714 ----
}
if (!lastslash && c == '$' && t!=end && isdigit(*t)) dollar = 1;
! if (!slash) buf << c;
! } while (t!=end && (slash || !strchr(" \n\r\t,;",*t)));
! if (q == 2 || q == 4 || q == 5 || q == 8) {binbuf_addv(x,"f",atof(buf.str().data())); return t;}
/* LATER try to figure out how to mix "$" and "\$" correctly; here, the backslashes were already
stripped so we assume all "$" chars are real dollars. In fact, we only know at least one was. */
if (dollar) {
! const char *b = buf.str().data();
! if (*b != '$') dollar = 0;
! for (b++; *b; b++) if (!isdigit(*b)) dollar = 0;
! if (dollar) 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;
}
***************
*** 1821,1825 ****
case A_COMMA: SETSYMBOL(ap, gensym(",")); break;
case A_DOLLAR: sprintf(tbuf, "$%ld", ap->a_index); SETSYMBOL(ap, gensym(tbuf)); break;
! case A_DOLLSYM: atom_string(ap, tbuf, MAXPDSTRING); SETSYMBOL(ap, gensym(tbuf)); break;
case A_SYMBOL:
/* FIXME make this general */
--- 1827,1831 ----
case A_COMMA: SETSYMBOL(ap, gensym(",")); break;
case A_DOLLAR: sprintf(tbuf, "$%ld", ap->a_index); SETSYMBOL(ap, gensym(tbuf)); break;
! case A_DOLLSYM: atom_string(ap, tbuf, MAXPDSTRING); SETSYMBOL(ap, gensym(tbuf)); break;
case A_SYMBOL:
/* FIXME make this general */
***************
*** 1913,1917 ****
* return value = 1; (s+1=="-bla")
*/
! int binbuf_expanddollsym(char*s, char*buf,t_atom dollar0, int ac, t_atom *av, int tonew) {
int argno=atol(s);
int arglen=0;
--- 1919,1923 ----
* return value = 1; (s+1=="-bla")
*/
! static int binbuf_expanddollsym(char *s, char *buf, t_atom dollar0, int ac, t_atom *av, int tonew) {
int argno=atol(s);
int arglen=0;
***************
*** 1923,1933 ****
arglen++;
}
! if (cs==s) { /* invalid $-expansion (like "$bla") */
! sprintf(buf, "$");
! return 0;
! } else if (argno < 0 || argno > ac) { /* undefined argument */
! if(!tonew)return 0;
sprintf(buf, "$%d", argno);
! } else if (argno == 0){ /* $0 */
atom_string(&dollar0, buf, MAXPDSTRING/2-1);
} else { /* fine! */
--- 1929,1938 ----
arglen++;
}
! /* invalid $-expansion (like "$bla") */
! if (cs==s) {sprintf(buf, "$"); return 0;}
! if (argno < 0 || argno > ac) { /* undefined argument */
! if(!tonew) return 0;
sprintf(buf, "$%d", argno);
! } else if (argno == 0) { /* $0 */
atom_string(&dollar0, buf, MAXPDSTRING/2-1);
} else { /* fine! */
***************
*** 1937,1942 ****
}
! /* LATER remove the dependence on the current canvas for $0; should be another
! argument. */
t_symbol *binbuf_realizedollsym(t_symbol *s, int ac, t_atom *av, int tonew) {
char buf[MAXPDSTRING];
--- 1942,1946 ----
}
! /* LATER remove the dependence on the current canvas for $0; should be another argument. */
t_symbol *binbuf_realizedollsym(t_symbol *s, int ac, t_atom *av, int tonew) {
char buf[MAXPDSTRING];