Don't parse the strings "+" and "-" as numerical zeros. Also fix the

code generation of constant objects to use real identity and not Nasal
equality, so (e.g.) the constants 1 (number) and "1.0" (string) do not
get turned into the same object in the generated code.
This commit is contained in:
andy
2005-03-11 19:07:06 +00:00
parent fc06ae58b2
commit d2cbed151b
3 changed files with 21 additions and 21 deletions

View File

@@ -151,11 +151,14 @@ static int readdec(unsigned char* s, int len, int i, double* v)
// are returned as zero.
static int readsigned(unsigned char* s, int len, int i, double* v)
{
int i0 = i, i2;
double sgn=1, val;
if(i >= len) { *v = 0; return len; }
if(s[i] == '+') { i++; }
else if(s[i] == '-') { i++; sgn = -1; }
i = readdec(s, len, i, &val);
i2 = readdec(s, len, i, &val);
if(i2 == i)
return i0; // don't parse "+" or "-" as zero.
*v = sgn*val;
return i;
}