Initial revision
[sbcl.git] / src / cold / read-from-file.lisp
1 ;;;; This software is part of the SBCL system. See the README file for
2 ;;;; more information.
3 ;;;;
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.
9
10 (in-package "SB-COLD")
11
12 ;;;; $Header$
13
14 ;;; Return an expression read from the file named PATHNAME-DESIGNATOR.
15 (export 'read-from-file)
16 (defun read-from-file (pathname-designator)
17   (with-open-file (s pathname-designator)
18     (let* ((result (read s))
19            (eof-result (cons nil nil))
20            (after-result (read s nil eof-result)))
21       (unless (eq after-result eof-result)
22         (error "more than one expression in file ~S" pathname-designator))
23       result)))
24 (compile 'read-from-file)