annotate lisp/ilisp/clisp.lisp @ 9:6f2bbbbbe05a

Added tag r19-15b5 for changeset 4b173ad71786
author cvs
date Mon, 13 Aug 2007 08:47:36 +0200
parents 376386a54a3c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; -*- Mode: Lisp -*-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;; clisp.lisp --
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;;; This file is part of ILISP.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;;; Version: 5.7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;;; Copyright (C) 1990, 1991, 1992, 1993 Chris McConnell
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;;; 1993, 1994 Ivan Vasquez
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;; 1994, 1995 Marco Antoniotti and Rick Busdiecker
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;;; Other authors' names for which this Copyright notice also holds
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;; may appear later in this file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;;; Send mail to 'ilisp-request@lehman.com' to be included in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;; ILISP mailing list. 'ilisp@lehman.com' is the general ILISP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;;; mailing list were bugs and improvements are discussed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;; ILISP is freely redistributable under the terms found in the file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;;; COPYING.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; Common Lisp initializations
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;; Author: Chris McConnell, ccm@cs.cmu.edu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;;; ange-ftp hack added by ivan Wed Mar 10 12:30:15 1993
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;; ilisp-errors *gc-verbose* addition ivan Tue Mar 16 03:21:51 1993
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;; Rcs_Info: clisp.lisp,v 1.26 1993/09/03 02:05:07 ivan Rel $
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;;; Revision 1.19 1993/08/24 22:01:52 ivan
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;;; Use defpackage instead of just IN-PACKAGE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;;; Renamed FUNCTION to FUN in ilisp-arglist to get around CMUCL 17b bug.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;;; Revision 1.16 1993/06/29 05:51:35 ivan
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;;; Added Ed Gamble's #'readtable-case fix and Hans Chalupsky's
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;;; allegro-4.1 addition.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;;; Revision 1.8 1993/06/28 00:57:42 ivan
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;;; Stopped using 'COMPILED-FUNCTION-P for compiled check.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;;; Revision 1.3 1993/03/16 23:22:10 ivan
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;;; Added breakp arg to ilisp-trace.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 #+(or allegro-v4.0 allegro-v4.1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (eval-when (compile load eval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (setq excl:*cltl1-in-package-compatibility-p* t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 ;;; The following is really a kludge! The defpackage should be in a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;;; separate file, but it looks like it is really hard to change ILISP
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ;;; behavior on the subject.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 ;;; Marco Antoniotti 11/22/94
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 ;;; I am commenting it out to see whether I can actually load the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 ;;; package file with the kludge in the definition of the dialect.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 ;;; Result: it works! This will disappear in the next release.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 #|
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (eval-when (compile load eval)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (defpackage "ILISP" (:use "LISP" #+:CMU "CONDITIONS")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (:export "ILISP-ERRORS"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 "ILISP-SAVE"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 "ILISP-RESTORE"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 "ILISP-SYMBOL-NAME"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 "ILISP-FIND-SYMBOL"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 "ILISP-FIND-PACKAGE"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 "ILISP-EVAL"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 "ILISP-COMPILE"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 "ILISP-DESCRIBE"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 "ILISP-INSPECT"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 "ILISP-ARGLIST"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 "ILISP-DOCUMENTATION"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 "ILISP-MACROEXPAND"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 "ILISP-MACROEXPAND-1"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 "ILISP-TRACE"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 "ILISP-UNTRACE"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 "ILISP-COMPILE-FILE"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 "ILISP-CASIFY"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 "ILISP-MATCHING-SYMBOLS")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 |#
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (in-package "ILISP")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 ;;; GCL 2.2 doesn't have defpackage (yet) so we need to put the export
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 ;;; here. (toy@rtp.ericsson.se)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 #+gcl
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (export '(ilisp-errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 ilisp-save
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 ilisp-restore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 ilisp-symbol-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 ilisp-find-symbol
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 ilisp-find-package
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 ilisp-eval
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 ilisp-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 ilisp-describe
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 ilisp-inspect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 ilisp-arglist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 ilisp-documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 ilisp-macroexpand
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 ilisp-macroexpand-1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 ilisp-trace
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 ilisp-untrace
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 ilisp-compile-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 ilisp-casify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 ilisp-matching-symbols))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (defvar *ilisp-old-result* nil "Used for save/restore of top level values.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 #+:ANSI-CL
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (defun special-form-p (symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 "Backward compatibility for non ANSI CL's."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (special-operator-p symbol))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (defmacro ilisp-handler-case (expression &rest handlers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 "Evaluate EXPRESSION using HANDLERS to handle errors."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 handlers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (if (macro-function 'handler-case)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 `(handler-case ,expression ,@handlers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 #+allegro `(excl::handler-case ,expression ,@handlers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 #+lucid `(lucid::handler-case ,expression ,@handlers)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 #-(or allegro lucid) expression))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (defun ilisp-readtable-case (readtable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (if (fboundp 'readtable-case)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (funcall #'readtable-case readtable)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 #+allegro (case excl:*current-case-mode*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (:case-insensitive-upper :upcase)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (:case-insensitive-lower :downcase)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (otherwise :preserve))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 #-allegro :upcase))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (defmacro ilisp-errors (form)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 "Handle errors when evaluating FORM."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 `(let ((*standard-output* *terminal-io*)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (*error-output* *terminal-io*)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 #+cmu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (ext:*gc-verbose* nil) ; cmulisp outputs "[GC ...]" which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 ; doesn't read well...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 #+ecl
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (sys:*gc-verbose* nil) ; ecolisp also outputs "[GC ...]"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (princ " ") ;Make sure we have output
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (ilisp-handler-case
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ,form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 (error (error)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 (with-output-to-string (string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (format string "ILISP: ~A" error))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (defun ilisp-save ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 "Save the current state of the result history."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (declare (special / // /// + ++ +++))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (unless *ilisp-old-result*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (setq *ilisp-old-result* (list /// // +++ ++ + /))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (defun ilisp-restore ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 "Restore the old result history."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (declare (special / // /// + ++ +++ * ** -))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (setq // (pop *ilisp-old-result*)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 ** (first //)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 / (pop *ilisp-old-result*)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 * (first /)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 ++ (pop *ilisp-old-result*)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 + (pop *ilisp-old-result*)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 - (pop *ilisp-old-result*))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (values-list (pop *ilisp-old-result*)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 ;;; ilisp-symbol-name --
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 ;;; ':capitalize' case added under suggestion by Rich Mallory.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (defun ilisp-symbol-name (symbol-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 "Return SYMBOL-NAME with the appropriate case as a symbol."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (case (ilisp-readtable-case *readtable*)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (:upcase (string-upcase symbol-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (:downcase (string-downcase symbol-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (:capitalize (string-capitalize symbol-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (:preserve symbol-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (defun ilisp-find-package (package-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 "Return package PACKAGE-NAME or the current package."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (if (string-equal package-name "nil")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 *package*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (or (find-package (ilisp-symbol-name package-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (error "Package ~A not found" package-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (defun ilisp-find-symbol (symbol-name package-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 "Return the symbol associated with SYMBOL-NAME in PACKAGE-NAME trying to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 handle case issues intelligently."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (find-symbol (ilisp-symbol-name symbol-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (ilisp-find-package package-name)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 ;;; The following two functions were in version 5.5.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 ;;; They disappeared in version 5.6. I am putting them back in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 ;;; distribution in order to make use of them later if the need
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 ;;; arises.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 ;;; Marco Antoniotti: Jan 2 1995
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 #|
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (defun ilisp-filename-hack (filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 "Strip `/user@machine:' prefix from filename."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 ;; Ivan's hack for getting away with dumb /ivan@bu-conx:/foo/bar/baz
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 ;; filenames...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (let ((at-location (position #\@ filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (colon-location (position #\: filename)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (if (and at-location colon-location)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (subseq filename (1+ colon-location))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 filename)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (defun ilisp-read-form (form package)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 "Read string FORM in PACKAGE and return the resulting form."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (let ((*package* (ilisp-find-package package)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (read-from-string form)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 |#
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (defun ilisp-eval (form package filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 "Evaluate FORM in PACKAGE recording FILENAME as the source file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (princ " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 ;; Ivan's hack for getting away with dumb /ivan@bu-conx:/foo/bar/baz
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 ;; filenames...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (let* ((at-location (position #\@ filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (colon-location (position #\: filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (if (and at-location colon-location)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (subseq filename (1+ colon-location))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (*package* (ilisp-find-package package))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 #+allegro (excl::*source-pathname* filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 #+allegro (excl::*redefinition-warnings* nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 #+lucid (lucid::*source-pathname*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (if (probe-file filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (truename filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (merge-pathnames filename)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 #+lucid (lucid::*redefinition-action* nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 #+lispworks (compiler::*input-pathname* (merge-pathnames filename))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 #+lispworks (compiler::*warn-on-non-top-level-defun* nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 ;; The LW entries are a mix of Rich Mallory and Jason
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 ;; Trenouth suggestions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 ;; Marco Antoniotti: Jan 2 1995.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 (eval (read-from-string form))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (defun ilisp-compile (form package filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 "Compile FORM in PACKAGE recording FILENAME as the source file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (princ " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 ;; This makes sure that function forms are compiled
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 ;; NOTE: Rich Mallory proposed a variation of the next piece of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 ;; code. for the time being we stick to the following simpler code.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 ;; Marco Antoniotti: Jan 2 1995.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 #-lucid
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (ilisp-eval
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (format nil "(funcall (compile nil '(lisp:lambda () ~A)))"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 form)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 package
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 ;; The following piece of conditional code is left in the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 ;; distribution just for historical purposes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 ;; It will disappear in the next release.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 ;; Marco Antoniotti: Jan 2 1995.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 #+lucid-ilisp-5.6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (labels ((compiler (form env)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (if (and (consp form)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (eq (first form) 'function)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (consp (second form)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 #-LCL3.0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (evalhook `(compile nil ,form) nil nil env)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 #+LCL3.0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 ;; If we have just compiled a named-lambda, and the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 ;; name didn't make it in to the procedure object,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 ;; then stuff the appropriate symbol in to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 ;; procedure object.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 (let* ((proc (evalhook `(compile nil ,form)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 nil nil env))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (old-name (and proc (sys:procedure-ref proc 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (lambda (second form))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (name (and (eq (first lambda)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 'lucid::named-lambda)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (second lambda))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (when (or (null old-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (and (listp old-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (eq :internal (car old-name))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (setf (sys:procedure-ref proc 1) name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 proc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (evalhook form #'compiler nil env))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (let ((*evalhook* #'compiler))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (ilisp-eval form package filename)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 #+lucid
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 ;; Following form is a patch provided by Christopher Hoover
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 ;; <ch@lks.csi.com>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (let ((*package* (ilisp-find-package package))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (lcl:*source-pathname* (if (probe-file filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (truename filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (merge-pathnames filename)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (lcl:*redefinition-action* nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (with-input-from-string (s form)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (lucid::compile-in-core-from-stream s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (values)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (defun ilisp-describe (sexp package)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 "Describe SEXP in PACKAGE."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 (ilisp-errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (let ((*package* (ilisp-find-package package)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 (describe (eval (read-from-string sexp))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (defun ilisp-inspect (sexp package)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 "Inspect SEXP in PACKAGE."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (ilisp-errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (let ((*package* (ilisp-find-package package)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (inspect (eval (read-from-string sexp))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (defun ilisp-arglist (symbol package)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (ilisp-errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (let ((fn (ilisp-find-symbol symbol package))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (*print-length* nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (*print-pretty* t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (*package* (ilisp-find-package package)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (cond ((null fn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (format t "Symbol ~s not present in ~s." symbol package))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 ((not (fboundp fn))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 (format t "~s: undefined~%" fn))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (print-function-arglist fn)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (values))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (defun print-function-arglist (fn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 "Pretty arglist printer"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (let* ((a (get-function-arglist fn))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (arglist (ldiff a (member '&aux a)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (desc (ilisp-function-short-description fn)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (format t "~&~s~a" fn (or desc ""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (write-string ": ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (if arglist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (write arglist :case :downcase :escape nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (write-string "()"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (terpri)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (defun ilisp-generic-function-p (symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (let ((generic-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (find-symbol "GENERIC-FUNCTION-P"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (or (find-package "PCL")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 *package*))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (and generic-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (fboundp generic-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (funcall generic-p symbol))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 (defun ilisp-function-short-description (symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (cond ((macro-function symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 " (Macro)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 ((special-form-p symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 " (Special Form)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 ((ilisp-generic-function-p symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 " (Generic)")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (defun get-function-arglist (symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (let ((fun (symbol-function symbol)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (cond ((ilisp-generic-function-p symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (funcall
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (find-symbol "GENERIC-FUNCTION-PRETTY-ARGLIST"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (or (find-package "PCL") *package*))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 fun))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 #+allegro
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (excl::arglist symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 #+(or ibcl kcl ecl gcl)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (help symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 #+lucid
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (lucid::arglist symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 #+lispworks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 (system::function-lambda-list symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 #-(or allegro lucid kcl ibcl ecl)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (documentation symbol 'function)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (defun ilisp-documentation (symbol package type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 "Return the TYPE documentation for SYMBOL in PACKAGE. If TYPE is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 \(qualifiers* (class ...)), the appropriate method will be found."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (ilisp-errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (let* ((real-symbol (ilisp-find-symbol symbol package))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (type (if (and (not (zerop (length type)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (eq (elt type 0) #\())
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (let ((*package* (ilisp-find-package package)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 (read-from-string type))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (ilisp-find-symbol type package))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (when (listp type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (setq real-symbol
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (funcall
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (find-symbol "FIND-METHOD" (or (find-package "CLOS")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (find-package "PCL")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 *package*))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 (symbol-function real-symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 (reverse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 (let ((quals nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (dolist (entry type quals)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 (if (listp entry)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (return quals)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (setq quals (cons entry quals))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (reverse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 (let ((types nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 (dolist (class (first (last type)) types)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 (setq types
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 (cons (funcall
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 (find-symbol "FIND-CLASS"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 (or (find-package "CLOS")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 (find-package "PCL")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 *package*))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 class) types))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (if real-symbol
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 (if (symbolp real-symbol)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (documentation real-symbol type)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 ;; Prevent compiler complaints
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 (eval `(documentation ,real-symbol)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (format nil "~A has no ~A documentation" symbol type)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (defun ilisp-macroexpand (expression package)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 "Macroexpand EXPRESSION as long as the top level function is still a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 macro."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 (ilisp-errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (let ((*print-length* nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 (*print-level* nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (*package* (ilisp-find-package package)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 (pprint (#-allegro macroexpand #+allegro excl::walk
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (read-from-string expression))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 (defun ilisp-macroexpand-1 (expression package)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 "Macroexpand EXPRESSION once."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (ilisp-errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (let ((*print-length* nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (*print-level* nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (*package* (ilisp-find-package package)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (pprint (macroexpand-1 (read-from-string expression))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 #-lispworks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (defun ilisp-trace (symbol package breakp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 "Trace SYMBOL in PACKAGE."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (declare (ignore breakp)) ; No way to do this in CL.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 (ilisp-errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (let ((real-symbol (ilisp-find-symbol symbol package)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 (when real-symbol (eval `(trace ,real-symbol))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 ;;; Jason Trenouth: SEP 6 94 -- LispWorks can trace-break
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 #+lispworks
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (defun ilisp-trace (symbol package breakp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 "Trace SYMBOL in PACKAGE."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (ilisp-errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (let ((real-symbol (ilisp-find-symbol symbol package)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 breakp ;; idiom for (declare (ignorable breakp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (when real-symbol (eval `(trace (,real-symbol :break breakp)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (defun ilisp-untrace (symbol package)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 "Untrace SYMBOL in PACKAGE."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (ilisp-errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 (let ((real-symbol (ilisp-find-symbol symbol package)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 (when real-symbol (eval `(untrace ,real-symbol))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 (defun ilisp-compile-file (file extension)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 "Compile FILE putting the result in FILE+EXTENSION."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (ilisp-errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (compile-file file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 :output-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 (merge-pathnames (make-pathname :type extension) file))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 (defun ilisp-casify (pattern string lower-p upper-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 "Return STRING with its characters converted to the case of PATTERN,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 continuing with the last case beyond the end."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511 (cond (lower-p (string-downcase string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (upper-p (string-upcase string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 (let (case)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 (concatenate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 'string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 (map 'string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 #'(lambda (p s)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (setq case (if (upper-case-p p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 #'char-upcase
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 #'char-downcase))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (funcall case s))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 pattern string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (map 'string case (subseq string (length pattern))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 (defun ilisp-words (string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 "Return STRING broken up into words. Each word is (start end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 delimiter)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (do* ((length (length string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 (start 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 (end t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 (words nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 ((null end) (nreverse words))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (if (setq end (position-if-not #'alphanumericp string :start start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 (setq words (cons (list end (1+ end) t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 (if (= start end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 words
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 (cons (list start end nil) words)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 start (1+ end))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 (setq words (cons (list start length nil) words)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 (defun ilisp-match-words (string pattern words)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 "Match STRING to PATTERN using WORDS."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (do* ((strlen (length string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 (words words (cdr words))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (word (first words) (first words))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (start1 (first word) (first word))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 (end1 (second word) (second word))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (delimiter (third word) (third word))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 (len (- end1 start1) (and word (- end1 start1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 (start2 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 (end2 len))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 ((or (null word) (null start2)) start2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 (setq end2 (+ start2 len)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 start2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 (if delimiter
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 (position (elt pattern start1) string :start start2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 (when (and (<= end2 strlen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (string= pattern string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 :start1 start1 :end1 end1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 :start2 start2 :end2 end2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 (1- end2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (when start2 (incf start2))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 ;;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 (defun ilisp-matching-symbols (string package &optional (function-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (external-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 (prefix-p nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 "Return a list of the symbols that have STRING as a prefix in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 PACKAGE. FUNCTION-P indicates that only symbols with a function value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 should be considered. EXTERNAL-P indicates that only external symbols
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 should be considered. PREFIX-P means that partial matches should not
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 be considered. The returned strings have the same case as the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 original string."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 (ilisp-errors
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (let* ((lower-p (notany #'upper-case-p string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 (upper-p (notany #'lower-case-p string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (no-casify (eq (ilisp-readtable-case *readtable*) :preserve))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 (symbol-string (ilisp-symbol-name string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (length (length string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 (results nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (*print-length* nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 (*package* (ilisp-find-package package)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (labels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 ;; Check SYMBOL against PATTERN
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (check-symbol (symbol pattern)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 (let ((name (symbol-name symbol)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 (when (and (or (not function-p) (fboundp symbol))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592 (>= (length name) length)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (string= pattern name :end2 length))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 (push (list (if no-casify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 (ilisp-casify pattern name lower-p upper-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 results))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 ;; Check SYMBOL against PATTERN using WORDS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 (check-symbol2 (symbol pattern words)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600 (let ((name (symbol-name symbol)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (when (and (or (not function-p) (fboundp symbol))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 (ilisp-match-words name pattern words))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (push (list (if no-casify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 (ilisp-casify pattern name lower-p upper-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 results)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 (if external-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 (do-external-symbols (symbol *package*)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 (check-symbol symbol symbol-string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 ;; KCL does not go over used symbols.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 #+(or kcl ibcl ecl)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 (dolist (used-package (package-use-list *package*))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 (do-external-symbols (symbol used-package)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615 (check-symbol symbol symbol-string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 (do-symbols (symbol *package*)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 (check-symbol symbol symbol-string))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 (unless (or results prefix-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 (let ((words (ilisp-words symbol-string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 (if external-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 (do-external-symbols (symbol *package*)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 (check-symbol2 symbol symbol-string words))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 ;; KCL does not go over used symbols.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 #+(or kcl ibcl ecl)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626 (dolist (used-package (package-use-list *package*))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 (do-external-symbols (symbol used-package)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628 (check-symbol2 symbol symbol-string words)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 (do-symbols (symbol *package*)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
630 (check-symbol2 symbol symbol-string words))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
631 (prin1 results)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
632 nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
633
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
634
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
635 ;;; Make sure that functions are exported
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
636 ;;; Now this could go away. I just leave commented it for backup reasons.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
637
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
638 #|
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
639 (dolist (symbol '(ilisp-errors ilisp-save ilisp-restore
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
640 ilisp-symbol-name ilisp-find-symbol ilisp-find-package
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
641 ilisp-eval ilisp-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
642 ilisp-describe ilisp-inspect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
643 ilisp-arglist ilisp-documentation
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
644 ilisp-macroexpand ilisp-macroexpand-1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
645 ilisp-trace ilisp-untrace
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
646 ilisp-compile-file ilisp-casify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
647 ilisp-matching-symbols))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
648 (export symbol))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
649 |#
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
650
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
651
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
652 (when
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
653 #+cmu (eval:interpreted-function-p #'ilisp-matching-symbols)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
654 #-cmu (not (compiled-function-p #'ilisp-matching-symbols))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
655 (format t "\"ILISP: File is not compiled, use M-x ilisp-compile-inits\""))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
656
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
657 ;;; end of file -- clisp.lisp --