我打了电话(load "code.lisp")
用CCL,然后不小心删除了code.lisp。有什么办法可以找回源代码吗? CCL 在内存中是否有它?
这是一个非常特殊的功能。这里只为克洛祖尔CL。该代码在其他地方不起作用。这在 CCL IDE 中对我有用。它检索符号的源代码:internal
or :external
在某个包中。对于从其他包继承的符号,它不会这样做(然后您通常会从包中获得源代码)CL
or CCL
,这有点太多了)。
(defun retrieve-source-code (&optional (package *package*))
(do-symbols (s package)
(multiple-value-bind (symbol where)
(find-symbol (symbol-name s)
package)
(declare (ignore symbol))
(when (member where '(:internal :external))
(let ((ds (find-definition-sources s)))
(when (and ds (listp ds))
(loop for (nil sn) in ds
for snt = (source-note-text sn)
when snt do (progn
(terpri)
(princ snt)
(terpri)))))))))
正如您所看到的,它可以检索自身(以及更多):
? (retrieve-source-code)
(defun retrieve-source-code (&optional (package *package*))
(do-symbols (s package)
(multiple-value-bind (symbol where)
(find-symbol (symbol-name s)
package)
(declare (ignore symbol))
(when (member where '(:internal :external))
(let ((ds (find-definition-sources s)))
(when (and ds (listp ds))
(loop for (nil sn) in ds
for snt = (source-note-text sn)
when snt do (progn
(terpri)
(princ snt)
(terpri)))))))))
NIL
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)