[PD] Bug in pool?
Frank Barknecht
fbar at footils.org
Tue Apr 19 15:16:42 CEST 2005
Hallo,
Thomas Grill hat gesagt: // Thomas Grill wrote:
> thanks for your report. It seems the only (cheap) way of storing
> arbitrary symbols is to escape them with " ".
> I've done so now - will be mirrored to the SF cvs shortly.
Thanks for the fast reply.
Will this still allow my old preset files, which contain symbols like
"10x20x40", to be loaded correctly?
I was researching the problem a bit in the meantime, and maybe "strtof" can
help. This is what I have so far:
// save character and set delimiter
float fres;
char *endp;
// see if it's a float
fres = strtof(tmp,&endp);
if (endp or (endp == tmp)) {
// it's a symbol:
post("end: %s", endp);
post("tmp: %s", tmp);
if(a) flext::SetString(*a,tmp);
}
else {
if(a) {
int ires = (int)fres; // try a cast
if(fres == ires)
flext::SetInt(*a,ires);
else
flext::SetFloat(*a,fres);
}
}
This works correctly for symbols like "set a 10xxx", the only problem is, that
now "set a 10" will result in "symbol 10" as result of "get a" after loading in
the savefile again.
Ciao
--
Frank Barknecht _ ______footils.org__
_ __latest track: "scans" _ http://footils.org/cms/show/41
More information about the Pd-list
mailing list