1 ;;;; This software is part of the SBCL system. See the README file for
4 ;;;; This software is derived from the CMU CL system, which was
5 ;;;; written at Carnegie Mellon University and released into the
6 ;;;; public domain. The software is in the public domain and is
7 ;;;; provided with absolutely no warranty. See the COPYING and CREDITS
8 ;;;; files for more information.
10 (in-package "SB-COLD")
12 ;;; Return an expression read from the file named PATHNAME-DESIGNATOR.
13 (export 'read-from-file)
14 (defun read-from-file (pathname-designator)
15 (with-open-file (s pathname-designator)
16 (let* ((result (read s))
17 (eof-result (cons nil nil))
18 (after-result (read s nil eof-result)))
19 (unless (eq after-result eof-result)
20 (error "more than one expression in file ~S" pathname-designator))
22 (compile 'read-from-file)