[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gcl-devel] Disable a warning?
From: |
Pascal J . Bourguignon |
Subject: |
Re: [Gcl-devel] Disable a warning? |
Date: |
Thu, 12 Aug 2004 19:34:31 +0200 |
Jared Davis writes:
> I'm basically needing to change the way that read works. I will need to
> inject my changes into the top level read-eval-print loop, the debug
> loop, etc. Is there a way to do this without changing read itself?
Well, I've not looked the source of GCL, but any implementation may
well not use COMMON-LISP:READ from the REPL.
If you want a (portable) REPL with a different read, you'll have to
write it yourself.
Here is for example what I use in a small program of mine:
(defmacro handling-errors (&body body)
`(HANDLER-CASE (progn ,@body)
(ERROR (ERR)
(apply (function format) *error-output*
(simple-condition-format-control err)
(simple-condition-format-arguments err)))))
(defun server-repl ()
(do ((hist 1 (1+ hist))
(+eof+ (gensym)))
(nil)
(format t "~%~A[~D]> " (package-name *package*) hist)
(handling-errors
(setf +++ ++ ++ + + - - (read *standard-input* nil +eof+))
(when (or (eq - +eof+)
(member - '((quit)(exit)(continue)) :test (function equal)))
(return-from server-repl))
(setf /// // // / / (multiple-value-list (eval -)))
(setf *** ** ** * * (first /))
(format t "~& --> ~{~S~^ ;~% ~}~%" /))))
But first see if you cannot customize the behavior of READ with the
numerous *READ-...* variables and the READ-TABLE and macro characters.
What way do you want your read to work?
--
__Pascal Bourguignon__ http://www.informatimago.com/
Our enemies are innovative and resourceful, and so are we. They never
stop thinking about new ways to harm our country and our people, and
neither do we.