X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcode%2Fcross-io.lisp;h=de76ce37b4ac308b775f57f45987e01613c8f94d;hb=b14a61c6af3e3005c94e633e727177346240066e;hp=59322052ca414f37dc283ef2e750a4556f2f8468;hpb=aa2dc9529460ea0d9c99998dc87283fc1a43e808;p=sbcl.git diff --git a/src/code/cross-io.lisp b/src/code/cross-io.lisp index 5932205..de76ce3 100644 --- a/src/code/cross-io.lisp +++ b/src/code/cross-io.lisp @@ -18,13 +18,14 @@ ;;;; implementations, and the ordinary fop implementations are defined in terms ;;;; of fast-read operations.) -(defmacro prepare-for-fast-read-byte (stream &body forms) - `(let ((%frc-stream% ,stream)) - ,@forms)) - -(defmacro fast-read-byte (&optional (eof-error-p t) (eof-value nil) any-type) - (declare (ignore any-type)) - `(read-byte %frc-stream% ,eof-error-p ,eof-value)) - -(defmacro done-with-fast-read-byte () - `(values)) +(defmacro with-fast-read-byte ((type stream &optional (eof-error-p t) eof-value) + &body body) + (let ((f-stream (gensym "STREAM")) + (f-eof-error-p (gensym "EOF-ERROR-P")) + (f-eof-value (gensym "EOF-VALUE"))) + `(let ((,f-stream ,stream) + (,f-eof-error-p ,eof-error-p) + (,f-eof-value ,eof-value)) + (flet ((fast-read-byte () + (the ,type (read-byte ,f-stream ,f-eof-error-p ,f-eof-value)))) + ,@body))))