[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug in MacLisp read routine



There appears to be a bug in the MacLisp read routine whereby,
if the last atom on a line is in ||'s, immediately after READing
this item TYIPEEK returns 131 instead of 13 (carriage return).
Since the value 131 isn't even in ascii, something is clearly
bogus here.  The following lines should be sufficient to reproduce
the behavior I described:

(DEFUN LINEREAD NIL
  (PROG (VAL NXTCHAR)
        (SETQ VAL NIL)
   LOOP (SETQ VAL (NCONC VAL (NCONS (READ))))
   LOOP2 (SETQ NXTCHAR (TYIPEEK))
        (COND ((EQUAL NXTCHAR 13.) (RETURN VAL))
              ((MEMQ (ASCII NXTCHAR) '(| | |)|))
               (READCH)
               (GO LOOP2)))
        (GO LOOP)))

(TRACE READ READCH TYIPEEK)

(LINEREAD) FOO<cr>	; works correctly

(LINEREAD) |FOO|<cr>
()<cr>			; the () is needed to terminate the
			; LINEREAD

(LINEREAD) |FOO| )	; also works correctly

Please reply to this message, whether you can fix the problem
immediately or not.

Thanks.  -- Dave Touretzky