Re: Inform: bug in a box? (patch)


28 Nov 1995 14:54:46 -0800

In article <19951126.163310.79@arnod.arnod.demon.co.uk>,
Julian Arnold <jools@arnod.demon.co.uk> wrote:
> #SWITCHES sv5x;
> [ Main; box "Hello"; Key(); box "@@92@@92@@92@@92@@92"; Key(); quit; ];
> [ Key k; print "[Press a key]^^"; @read_char 1 k; ];
> #END;
>
>Notice the second box is far too wide, taking each '\' to be four characters,
>presumably because of the `@@92' notation.
>
>> Is this a (known) bug? Is there a way around it?

I don't know if it's a bug, but it's certainly not the desired behaviour.
Here's a patch I wrote quickly. Keep in mind that I'm not a competent C
programmer; I had 1 class in C a year ago. I'm certain there is a more elegant
(and verified bug-free) way to do this. Graham?

in inform.c, near line 813:

do { word(b,next_token++); j++;
if (i<strlen(b)) i=strlen(b);
/* Check for character literals. @@?? should count as 1 character, not 4. */
for (k=0;k<=strlen(b);k++) {
if (b[k]=='@') {
k++;
if (b[k]=='@') {
k++; k++;
i = i - 3;
}
}
}
/* End kludgy check for literals. */
if (b[0]!=0)
{ if (strcmp(b,"\"\"")==0)

I haven't tested this very much at all- I only compiled your boxes to make sure
it fixed the problem.

Your mileage may vary, no warranty is expressed or implied, yadda yadda yada.

-Josh