-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrestore.lisp
52 lines (48 loc) · 1.66 KB
/
restore.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
;;;-*- Mode:Common-Lisp; Package:PICTURES; Base:10 -*-
;;;
;;;
;;;
;;; TEXAS INSTRUMENTS INCORPORATED
;;; P.O. BOX 149149
;;; AUSTIN, TEXAS 78714-9149
;;;
;;; Copyright (C)1987,1988,1989,1990 Texas Instruments Incorporated.
;;;
;;; Permission is granted to any individual or institution to use, copy, modify,
;;; and distribute this software, provided that this complete copyright and
;;; permission notice is maintained, intact, in all copies and supporting
;;; documentation.
;;;
;;; Texas Instruments Incorporated provides this software "as is" without
;;; express or implied warranty.
;;;
;;; Authors: Delmar Hager, James Dutton, Teri Crowe
;;; Contributors: Kerry Kimbrough, Patrick Hogan, Eric Mielke
(in-package "PICTURES")
; - - - - - - - - - - - generic functions - - - - - - -
; - - - - - - - - nested format - - - - - - - -
(defmethod restore-graphic ((format (eql :nested-forms)) &optional (stream *standard-input*))
(let (graphics-list eof)
(if (eq stream *standard-input*)
(let ((form (read stream nil)))
(setf form (scan-form form))
(when (make-form-p form)
(setf graphics-list
(cons (make-graphic form) graphics-list)))
graphics-list)
(loop until eof do
(let ((form (read stream nil 'last)))
(unless (eq form 'last)
(setf form (scan-form form)))
(when (and form (make-form-p form))
(setf graphics-list
(cons (make-graphic form) graphics-list)))
(when (eq form 'last)
(setf eof t)))
finally (return graphics-list)))))
(defun make-graphic (form)
(eval form)
;; two forms below go with a different save.lisp file
; (handle-embedded-forms (cdr form))
; (apply (car form) (cdr form))
)