1
;;;; Copyright (c) 1984, Taiichi Yuasa and Masami Hagiya.
2
;;;; Copyright (c) 1990, Giuseppe Attardi.
4
;;;; This program is free software; you can redistribute it and/or
5
;;;; modify it under the terms of the GNU Library General Public
6
;;;; License as published by the Free Software Foundation; either
7
;;;; version 2 of the License, or (at your option) any later version.
9
;;;; See file '../Copyright' for full details.
10
;;;; Exporting external symbols of LISP package
12
(eval-when (eval compile load)
13
(si::select-package "SI"))
15
;;; ----------------------------------------------------------------------
17
(*make-special '*dump-defun-definitions*)
18
(setq *dump-defun-definitions* nil)
19
(*make-special '*dump-defmacro-definitions*)
20
(setq *dump-defmacro-definitions* *dump-defun-definitions*)
22
;; This is needed only when bootstrapping ECL using ECL-MIN
25
#'(ext::lambda-block defun (def env)
26
(let* ((name (second def))
27
(function `#'(ext::lambda-block ,@(cdr def))))
28
(when *dump-defun-definitions*
30
(setq function `(si::bc-disassemble ,function)))
31
`(si::fset ',name ,function)))
34
#'(ext::lambda-block in-package (def env)
35
`(eval-when (eval compile load)
36
(si::select-package ,(string (second def)))))
41
;; This is also needed for booting ECL. In particular it is required in
44
(let ((f #'(ext::lambda-block dolist (whole env)
45
(let (body pop finished control var expr exit)
46
(setq body (rest whole))
48
(simple-program-error "Syntax error in ~A:~%~A" 'DOLIST whole))
49
(setq control (first body) body (rest body))
51
(simple-program-error "Syntax error in ~A:~%~A" 'DOLIST whole))
52
(setq var (first control) control (rest control))
53
(if (<= 1 (length control) 2)
54
(setq expr (first control) exit (rest control))
55
(simple-program-error "Syntax error in ~A:~%~A" 'DOLIST whole))
56
(multiple-value-bind (declarations body)
57
(process-declarations body nil)
59
(let* ((%dolist-var ,expr)
61
(declare ,@declarations)
62
(si::while %dolist-var
63
(setq ,var (first %dolist-var))
65
(setq %dolist-var (rest %dolist-var)))
66
,(when exit `(setq ,var nil))
68
(si::fset 'dolist f t))
70
(let ((f #'(ext::lambda-block dotimes (whole env)
71
(let (body pop finished control var expr exit)
72
(setq body (rest whole))
74
(simple-program-error "Syntax error in ~A:~%~A" 'DOTIMES whole))
75
(setq control (first body) body (rest body))
77
(simple-program-error "Syntax error in ~A:~%~A" 'DOTIMES whole))
78
(setq var (first control) control (rest control))
79
(if (<= 1 (length control) 2)
80
(setq expr (first control) exit (rest control))
81
(simple-program-error "Syntax error in ~A:~%~A" 'DOTIMES whole))
82
(multiple-value-bind (declarations body)
83
(process-declarations body nil)
85
(let* ((%dotimes-var ,expr)
87
(declare ,@declarations)
88
(si::while (< ,var %dotimes-var)
90
(setq ,var (1+ ,var)))
92
(si::fset 'dotimes f t))
94
(let ((f #'(ext::lambda-block do/do*-expand (whole env)
95
(let (do/do* control test result vl step let psetq body)
96
(setq do/do* (first whole) body (rest whole))
98
(setq let 'LET psetq 'PSETQ)
99
(setq let 'LET* psetq 'SETQ))
101
(simple-program-error "Syntax error in ~A:~%~A" do/do* whole))
102
(setq control (first body) body (rest body))
104
(simple-program-error "Syntax error in ~A:~%~A" do/do* whole))
105
(setq test (first body) body (rest body))
107
(simple-program-error "Syntax error in ~A:~%~A" do/do* whole))
108
(setq result (rest test) test (first test))
110
(when (symbolp c) (setq c (list c)))
113
(setq vl (cons c vl)))
115
(setq vl (cons (butlast c) vl)
116
step (list* (third c) (first c) step)))
118
(simple-program-error "Syntax error in ~A:~%~A" do/do* whole))))
119
(multiple-value-bind (declarations real-body)
120
(process-declarations body nil)
123
(declare ,@declarations)
126
,@(when step (list (cons psetq (nreverse step)))))
127
,@(or result '(nil)))))))))
131
(defun eval-feature (x &aux operator)
132
(declare (si::c-local))
134
(and (member x *features* :test #'eq) t))
135
((atom x) (error "~ is not allowed as a feature" x))
136
((not (symbolp (setq operator (first x))))
137
(error "~S is not a valid feature expression." x))
139
(dolist (x (cdr x) t) (when (not (eval-feature x)) (return nil))))
141
(dolist (x (cdr x) nil) (when (eval-feature x) (return t))))
143
(not (eval-feature (second x))))
144
(t (error "~S is not a valid feature expression." x))))
146
(defun do-read-feature (stream subchar arg test)
147
(declare (si::c-local))
149
(error "Reading from ~S: no number should appear between # and ~A"
151
(let ((feature (let ((*package* (find-package "KEYWORD")))
152
(read stream t nil t))))
153
(if (and (not *read-suppress*) (eq (eval-feature feature) test))
154
(read stream t nil t)
155
(let ((*read-suppress* t)) (read stream t nil t) (values)))))
157
(defun sharp-+-reader (stream subchar arg)
158
(do-read-feature stream subchar arg T))
160
(defun sharp---reader (stream subchar arg)
161
(do-read-feature stream subchar arg NIL))
163
(set-dispatch-macro-character #\# #\+ 'sharp-+-reader)
164
(set-dispatch-macro-character #\# #\+ 'sharp-+-reader (sys::standard-readtable))
166
(set-dispatch-macro-character #\# #\- 'sharp---reader)
167
(set-dispatch-macro-character #\# #\- 'sharp---reader (sys::standard-readtable))