[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Toplevel Loop Problems...
- To: info-macl@cambridge.apple.com
- Subject: Toplevel Loop Problems...
- From: waander@cs.UMD.EDU (Bill Andersen)
- Date: Wed, 13 Mar 91 23:50:07 -0500
- Full-name:
I am using this toplevel loop in a standalone application. Most of
it is borrowed from the "Math Loop" example in ccl;examples. I just
need to use Fred editor windows with the application so as to be able
to evaluate forms from the editor, by EVALing forms from
GET-NEXT-FORM.
The problem is that the call to GET-NEXT-FORM does not seem to
remove anything from the *terminal-io* queue. When I quit my toplevel
loop, all the queued forms get evaluated (presumably by the normal
TOPLEVEL-LOOP function.
Can someone tell me why this doesn't work, and what to do about it?
Weren't there some difficulties with GET-NEXT-FORM reported earlier?
Another question: Why does the example code include a
MULTIPLE-VALUE-BIND when MESSAGE-DIALOG apparently only returns one
value? Thanks in advance.
...Bill (waander@cs.umd.edu)
(defun inner-main-loop (&aux abort-or-cancel-p)
(multiple-value-bind (result error-p)
(catch-error-quietly
(setq abort-or-cancel-p
(catch-abort
(catch-cancel
;; Process forms normally
(eval (ask *terminal-io* (get-next-form)))
(event-dispatch))))
(when (or (eq abort-or-cancel-p :abort)
(eq abort-or-cancel-p :cancel))
(message-dialog (format nil "~aed." abort-or-cancel-p))))
(when error-p
(unless (y-or-n-dialog
(format nil "The following error occured:~%~s~%Continue, or quit the application?"
(apply #'format nil result))
:yes-text "Continue"
:no-text "Quit"
:cancel-text nil) ;no cancel button
(app-quit)))))