[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ooc-980713 & oo2c-1.3.8
- To: ooc-list@informatik.uni-kl.de
- Subject: Re: ooc-980713 & oo2c-1.3.8
- From: Ian Rae <ianrae@istar.ca>
- Date: Sun, 19 Jul 1998 23:29:25 -0400
- MMDF-Warning: Parse error in original version of preceding line at uklirb.informatik.uni-kl.de
I've tested TextRider and unfortunately it's broken in a number of ways;
the simple problems are described below. The more complicate problem
is with eol auto-detection. I used 8 test files. 4 one-line files ending
in: nothing,
cr, lf, or cr/lf. A second 4 files are two-line versions of the first four.
When
the eol is lf or cr/lf things work fairly well. When its nothing or cr I
can't
seem to make a fix for one of the test files that doesn't break another!
The test is to call r.ReadLine() and get the correct characters and then
r.Res() # 0
on subsequent calls. I expect that ReadLn, and possibly all the ReadBool,
etc are also all affected but haven't tested them.
So here are two proposals:
1. Fix TextRider.
or
2. Remove auto-detection of eol. Default eolLen=1, eol=0AX, and require
all other implementations to use SetEol().
---Problems fixed:---
(I have to change TextRider.mod to port it to BBox, so I'll just describe
the fixes individually. Original code is marked "old" and the fix is
marked
"new")
1. 2line cr/lf test file. Eol(): once deferredEol was set, it never looked
ahead 2 to clear it.
old:
ELSE
IF Lookahead (r, 1) & (r. la[0] = Ascii.cr) THEN
(* unfinished auto detection *)
RETURN TRUE
new:
ELSE
IF r. deferredEol THEN (* previous character was Ascii.cr *)
IF Lookahead(r, maxLengthEol) & (r.eolLen > 0) THEN
RETURN r.Eol(); (* !recursion! *)
ELSE
RETURN TRUE; (* assume the cr we saw was eol *)
2. Typo in Consume
(*bug 2: old
r. laRes[i-1] := r. laRes[i-1]
new:*)
r. laRes[i-1] := r. laRes[i]
3. r.Res() returns 0 even after reading past the eof. The problem is with
Lookahead and Consume. In this pair of functions Lookahead always
clears r.byteReader.res and Consume propogates any lookahead res
values back into r.byteReader.res. If Consume is called last everything
is fine. If Lookahead is ever the last function of the pair to be called
res will always be 0.
The fix to ReadLine is as follows but it might have to be repeated in
many functions...there's probably a better way.
(*bug#3: new:*)
IF r.Available() <= 0 THEN
r.byteReader.res = Channel.readAfterEnd;
s[0] := 0X;
RETURN
END;
4. Available() returns > 0 after eof because it was considering anything
in la valid without checking laRes.
(*bug #4: old:
IF (avail < 0) & (r. laLen > 0) THEN
RETURN r. laLen
ELSE
RETURN avail+r. laLen
END
new:*)
numNonChars := 0;
FOR i := 0 TO r.laLen - 1 DO
IF r.laRes[i] # done THEN INC(numNonChars); END;
END;
IF (avail < 0) & (r. laLen > 0) THEN
RETURN r.laLen - numNonChars;
ELSE
RETURN avail+r. laLen - numNonChars;
END
--Ian
----------
> From: Ian Rae <ianrae@istar.ca>
> To: ooc-list@informatik.uni-kl.de
> Subject: Re: ooc-980713 & oo2c-1.3.8
> Date: Wednesday, July 15, 1998 7:37 AM
>
> > From: Michael van Acken <mvacken@t-online.de>
> >
> > New in 1.3.8:
> >
> > Some fixes to the compiler and some library modules. Revised
> > TextRider module as discussed on the mailing list. The low-level file
>
> I still can't confirm the june 28th changes to TextRider...sigh. Have
been
> wrestling with version control issues: BBOX ODC to ASCII conversion,
> long and short filenames, etc. Even more reasons to (someday) switch
> to LINUX!! Hopefully this week...
>
> --Ian
>
>