[Openmcl-devel] patch: eofs in read-toplevel-form

James Bielman jamesjb at jamesjb.com
Thu May 4 20:42:35 PDT 2006


Hi,

As someone who habitually uses ^D to abort errors in the toplevel, I
noticed that OpenMCL took two EOFs to return from READ-TOPLEVEL-FORM.
The attached patch should fix this.

Thanks,
James

-------------- next part --------------
Index: level-1/l1-streams.lisp
===================================================================
RCS file: /usr/local/tmpcvs/openmcl-dev/ccl/level-1/l1-streams.lisp,v
retrieving revision 1.36
diff -u -r1.36 l1-streams.lisp
--- level-1/l1-streams.lisp	2 May 2006 16:27:08 -0000	1.36
+++ level-1/l1-streams.lisp	5 May 2006 03:37:59 -0000
@@ -2560,11 +2560,12 @@
 (defmethod read-toplevel-form ((stream input-stream)
                                eof-value)
   (loop
-    (let* ((*in-read-loop* nil) 
-           (form
-            (if (eq (peek-char t stream nil nil) #\:)
-              (read-command-or-keyword stream eof-value)
-              (read stream nil eof-value))))
+    (let* ((*in-read-loop* nil)
+           (first-char (peek-char t stream nil eof-value))
+           (form (cond ((eq first-char #\:)
+                        (read-command-or-keyword stream eof-value))
+                       ((eq first-char eof-value) eof-value)
+                       (t (read stream nil eof-value)))))
       (if (eq form eof-value)
         (return (values form nil t))
         (progn


More information about the Openmcl-devel mailing list