;;; -*- Mode:Lisp; Readtable:ZL; Package:USER; Base:8; Patch-File:T -*- ;;; Patch file for System version 123.251 ;;; Reason: ;;; (read-from-string) and (lisp:read-from-string) with arguments that specified ;;; that end-of-file is not an error didn't always catch end-of-file. ;;; Written 4-May-88 16:28:48 by pld at site Gigamos Cambridge ;;; while running on Azathoth from band 3 ;;; with Experimental System 123.249, Experimental Local-File 73.5, Experimental FILE-Server 22.3, Experimental Unix-Interface 11.0, Experimental KERMIT 34.3, Experimental ZMail 71.0, Experimental Lambda-Diag 15.0, Experimental Tape 22.4, microcode 1756, SDU Boot Tape 3.14, SDU ROM 8, the old ones. ; From modified file DJ: L.IO; QIO.LISP#229 at 4-May-88 16:28:49 #8R SYSTEM-INTERNALS#: (COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "SYSTEM-INTERNALS"))) (COMPILER::PATCH-SOURCE-FILE "SYS: IO; QIO  " (defun read-from-string (string &optional (eof-option nil eof-option-p) (start 0) end &aux (*iolst string) (*ioch start) (*ioend (or end (string-length string)))) "Read an expression out of the characters in STRING. If EOF-OPTION is supplied, it is returned on end of file; otherwise, end of file is an error. START (default 0) is the position in STRING to start reading at; END is where to stop. The second value is the index in the string at which reading stopped. It stops after the first object, even if not all the input is used." (declare (values contents end-char-position)) (values (condition-case-if eof-option-p (error) (internal-read 'read-from-string-stream) (read-end-of-file eof-option)) *ioch)) )) ; From modified file DJ: L.IO; QIO.LISP#229 at 4-May-88 16:33:24 #8R SYSTEM-INTERNALS#: (COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "SYSTEM-INTERNALS"))) (COMPILER::PATCH-SOURCE-FILE "SYS: IO; QIO  " (defun cli:read-from-string (string &optional (eof-error-p t) eof-value &key (start 0) end preserve-whitespace) "Read an expression out of the characters in STRING. START and END are indices which specify a substring of STRING to be used. START defaults to 0 and END to NIL (which means the end of STRING). Reaching the end of STRING or the specified substring constitutes EOF. EOF-ERROR-P and EOF-VALUE are passed to the READ function, and PRESERVE-WHITESPACE non-NIL causes READ-PRESERVING-WHITESPACE to be used. Only one object is read. The first value is that object (or perhaps EOF-VALUE) and the second value is the index in STRING at which reading stopped." (declare (values contents end-char-position)) (let ((*iolst string) (*ioch start) (*ioend (or end (string-length string)))) (values (condition-case-if (not eof-error-p) (error) (internal-read 'read-from-string-stream nil nil nil preserve-whitespace) (read-end-of-file eof-value)) *ioch))) ))