Function: edebug--unwrap1

edebug--unwrap1 is a byte-compiled function defined in edebug.el.gz.

Signature

(edebug--unwrap1 SEXP HASH-TABLE)

Documentation

Unwrap SEXP using HASH-TABLE of things already unwrapped.

HASH-TABLE contains the results of unwrapping cons cells within SEXP, which are reused to avoid infinite loops when SEXP is or contains a circular object.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/edebug.el.gz
(defun edebug--unwrap1 (sexp hash-table)
  "Unwrap SEXP using HASH-TABLE of things already unwrapped.
HASH-TABLE contains the results of unwrapping cons cells within
SEXP, which are reused to avoid infinite loops when SEXP is or
contains a circular object."
  (let ((new-sexp (edebug-unwrap sexp)))
    (while (not (eq sexp new-sexp))
      (setq sexp new-sexp
	    new-sexp (edebug-unwrap sexp)))
    (if (consp new-sexp)
	(let ((result (gethash new-sexp hash-table nil)))
	  (unless result
	    (let ((remainder new-sexp)
		  current)
	      (setq result (cons nil nil)
		    current result)
	      (while
		  (progn
		    (puthash remainder current hash-table)
		    (setf (car current)
			  (edebug--unwrap1 (car remainder) hash-table))
		    (setq remainder (cdr remainder))
		    (cond
		     ((atom remainder)
		      (setf (cdr current)
			    (edebug--unwrap1 remainder hash-table))
		      nil)
		     ((gethash remainder hash-table nil)
		      (setf (cdr current) (gethash remainder hash-table nil))
		      nil)
		     (t (setq current
			      (setf (cdr current) (cons nil nil)))))))))
	  result)
      new-sexp)))