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

another problem with MacLisp read routine



JONL,
	I am having another problem with the MacLisp read
routine.  I hesitate to call it a bug, due to my last
experience, but it sure isn't doing what I want it to.
Specifically the problem is that, with (sstatus linmode nil),
sometimes (READ) will accept <space> or <cr> as a terminator,
and sometimes it won't.  The case where it won't is when
a 1 character symbol or number is the second element of a 
line being read by LINEREAD (defined below).

Examples:

(TRACE TYI TYIPEEK READ)
(SSTATUS LINMODE NIL)

(LINEREAD) foo xyz<cr>	; works

(LINEREAD) foo 12<cr>	; works

(LINEREAD) foo 1<cr>	; doesn't work; requires ")" to terminate

(LINEREAD) foo x<cr>	; also doesn't work


The lineread function is defined as:

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

What is it that's going wrong?   -- Dave