At 08:55 PM 4/14/2002 +0200, Peter Gibbs wrote:
>The specific problem Clinton mentioned is yet another infant mortality
>problem, this time in string_concat. I don't know what the current decision
>is on handling these situations, but this one can be avoided by optimising
>the code anyway. If the transcoding is done before making the result string,
>we know the actual length, instead of using the maximum possible.
>
>I haven't yet looked to see why basic needs to transcode string anyway.
As a follow-up, I found one bug. Rather odd it is. The symptom is loading
a program, doing a LIST
and seeing only part of the code. Dumping the
string-which-contains-the-code you can see the entire program in it (unlike
the earlier described bug). The problem was in here:
set S2, ""
substr S2, S15, I1, LINEWIDTH
save S2
bsr STRIPSPACE # (removes trailing whitespace)
set I2, S2 # Quietly convert S2 to an int
ge I2, I6, VFOUND
So I'd pull things out of S15, strip the space off, look for something
greater-than or equal-to I6. Problem was this test was *failing*. Putting
diagnostics in I found out that S2 wasn't getting converted correctly to an
integer in I2. *puzzle*.
Changing the conversion part of the code to:
save S2
bsr ATOI
restore I2
Fixes the problem. The insane thing is that ATOI essentially loads a
string register from the stack, coverts it, and then puts it back as an
integer -- almost exactly what was failing before.