]> code.delx.au - gnu-emacs/blobdiff - lisp/emacs-lisp/disass.el
Merge from emacs-23; up to 2010-06-12T08:59:37Z!albinus@detlef.
[gnu-emacs] / lisp / emacs-lisp / disass.el
index 8a5d3ce65524e6348e53dfeb2793afe769cc7150..2a41e611dc0f6cccb87819aa35593665c3c76163 100644 (file)
@@ -1,7 +1,6 @@
 ;;; disass.el --- disassembler for compiled Emacs Lisp code
 
-;; Copyright (C) 1986, 1991, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1986, 1991, 2002-2011 Free Software Foundation, Inc.
 
 ;; Author: Doug Cutting <doug@csli.stanford.edu>
 ;;     Jamie Zawinski <jwz@lucid.com>
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -21,9 +20,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -81,13 +78,14 @@ redefine OBJECT if it is a symbol."
            obj (symbol-function obj)))
     (if (subrp obj)
        (error "Can't disassemble #<subr %s>" name))
-    (if (and (listp obj) (eq (car obj) 'autoload))
-       (progn
-         (load (nth 1 obj))
-         (setq obj (symbol-function name))))
+    (when (and (listp obj) (eq (car obj) 'autoload))
+      (load (nth 1 obj))
+      (setq obj (symbol-function name)))
     (if (eq (car-safe obj) 'macro)     ;handle macros
        (setq macro t
              obj (cdr obj)))
+    (when (and (listp obj) (eq (car obj) 'closure))
+      (error "Don't know how to compile an interpreted closure"))
     (if (and (listp obj) (eq (car obj) 'byte-code))
        (setq obj (list 'lambda nil obj)))
     (if (and (listp obj) (not (eq (car obj) 'lambda)))
@@ -218,7 +216,9 @@ OBJ should be a call to BYTE-CODE generated by the byte compiler."
          (cond ((memq op byte-goto-ops)
                 (insert (int-to-string (nth 1 arg))))
                ((memq op '(byte-call byte-unbind
-                           byte-listN byte-concatN byte-insertN))
+                           byte-listN byte-concatN byte-insertN
+                           byte-stack-ref byte-stack-set byte-stack-set2
+                           byte-discardN byte-discardN-preserve-tos))
                 (insert (int-to-string arg)))
                ((memq op '(byte-varref byte-varset byte-varbind))
                 (prin1 (car arg) (current-buffer)))
@@ -251,10 +251,10 @@ OBJ should be a call to BYTE-CODE generated by the byte compiler."
                       ((eq (car-safe (car-safe arg)) 'byte-code)
                        (insert "(<byte code>...)\n")
                        (mapc ;recurse on list of byte-code objects
-                        '(lambda (obj)
-                           (disassemble-1
-                            obj
-                            (+ indent disassemble-recursive-indent)))
+                        (lambda (obj)
+                           (disassemble-1
+                            obj
+                            (+ indent disassemble-recursive-indent)))
                         arg))
                       (t
                        ;; really just a constant
@@ -266,5 +266,4 @@ OBJ should be a call to BYTE-CODE generated by the byte compiler."
 
 (provide 'disass)
 
-;;; arch-tag: 89482fe4-a087-4761-8dc6-d771054e763a
 ;;; disass.el ends here