comparison lisp/emacs-lisp/disass.el @ 1821:04fb1d3d6992

JimB's changes since January 18th
author Jim Blandy <jimb@redhat.com>
date Tue, 26 Jan 1993 01:58:16 +0000
parents 4303c30b29de
children 2c7997f249eb
comparison
equal deleted inserted replaced
1820:b95bdb97c3e8 1821:04fb1d3d6992
39 (defvar disassemble-column-1-indent 5 "*") 39 (defvar disassemble-column-1-indent 5 "*")
40 (defvar disassemble-column-2-indent 10 "*") 40 (defvar disassemble-column-2-indent 10 "*")
41 41
42 (defvar disassemble-recursive-indent 3 "*") 42 (defvar disassemble-recursive-indent 3 "*")
43 43
44 ;;;###autoload
44 (defun disassemble (object &optional buffer indent interactive-p) 45 (defun disassemble (object &optional buffer indent interactive-p)
45 "Print disassembled code for OBJECT in (optional) BUFFER. 46 "Print disassembled code for OBJECT in (optional) BUFFER.
46 OBJECT can be a symbol defined as a function, or a function itself 47 OBJECT can be a symbol defined as a function, or a function itself
47 \(a lambda expression or a compiled-function object). 48 \(a lambda expression or a compiled-function object).
48 If OBJECT is not already compiled, we compile it, but do not 49 If OBJECT is not already compiled, we compile it, but do not
134 (let ((print-escape-newlines t)) 135 (let ((print-escape-newlines t))
135 (prin1 interactive (current-buffer)))) 136 (prin1 interactive (current-buffer))))
136 (insert "\n")))) 137 (insert "\n"))))
137 (cond ((and (consp obj) (assq 'byte-code obj)) 138 (cond ((and (consp obj) (assq 'byte-code obj))
138 (disassemble-1 (assq 'byte-code obj) indent)) 139 (disassemble-1 (assq 'byte-code obj) indent))
139 ((compiled-function-p obj) 140 ((byte-code-function-p obj)
140 (disassemble-1 obj indent)) 141 (disassemble-1 obj indent))
141 (t 142 (t
142 (insert "Uncompiled body: ") 143 (insert "Uncompiled body: ")
143 (let ((print-escape-newlines t)) 144 (let ((print-escape-newlines t))
144 (prin1 (if (cdr obj) (cons 'progn obj) (car obj)) 145 (prin1 (if (cdr obj) (cons 'progn obj) (car obj))
193 ((memq op '(byte-constant byte-constant2)) 194 ((memq op '(byte-constant byte-constant2))
194 ;; it's a constant 195 ;; it's a constant
195 (setq arg (car arg)) 196 (setq arg (car arg))
196 ;; but if the value of the constant is compiled code, then 197 ;; but if the value of the constant is compiled code, then
197 ;; recursively disassemble it. 198 ;; recursively disassemble it.
198 (cond ((or (compiled-function-p arg) 199 (cond ((or (byte-code-function-p arg)
199 (and (eq (car-safe arg) 'lambda) 200 (and (eq (car-safe arg) 'lambda)
200 (assq 'byte-code arg)) 201 (assq 'byte-code arg))
201 (and (eq (car-safe arg) 'macro) 202 (and (eq (car-safe arg) 'macro)
202 (or (compiled-function-p (cdr arg)) 203 (or (byte-code-function-p (cdr arg))
203 (and (eq (car-safe (cdr arg)) 'lambda) 204 (and (eq (car-safe (cdr arg)) 'lambda)
204 (assq 'byte-code (cdr arg)))))) 205 (assq 'byte-code (cdr arg))))))
205 (cond ((compiled-function-p arg) 206 (cond ((byte-code-function-p arg)
206 (insert "<compiled-function>\n")) 207 (insert "<compiled-function>\n"))
207 ((eq (car-safe arg) 'lambda) 208 ((eq (car-safe arg) 'lambda)
208 (insert "<compiled lambda>")) 209 (insert "<compiled lambda>"))
209 (t (insert "<compiled macro>\n"))) 210 (t (insert "<compiled macro>\n")))
210 (disassemble-internal 211 (disassemble-internal