Function: vhdl-update-file-contents

vhdl-update-file-contents is a byte-compiled function defined in vhdl-mode.el.gz.

Signature

(vhdl-update-file-contents FILE-NAME)

Documentation

Update hierarchy information by contents of current buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/vhdl-mode.el.gz
(defun vhdl-update-file-contents (file-name)
  "Update hierarchy information by contents of current buffer."
  (setq file-name (abbreviate-file-name file-name))
  (let* ((dir-name (file-name-directory file-name))
	 (directory-alist vhdl-directory-alist)
	 updated)
    (while directory-alist
      (when (member dir-name (nth 1 (car directory-alist)))
	(let* ((vhdl-project (nth 0 (car directory-alist)))
	       (project (vhdl-project-p))
	       (ent-alist (vhdl-aget vhdl-entity-alist
				     (or project dir-name)))
	       (conf-alist (vhdl-aget vhdl-config-alist
				      (or project dir-name)))
	       (pack-alist (vhdl-aget vhdl-package-alist
				      (or project dir-name)))
	       (ent-inst-list (car (vhdl-aget vhdl-ent-inst-alist
					 (or project dir-name))))
	       (file-alist (vhdl-aget vhdl-file-alist (or project dir-name)))
	       (file-entry (vhdl-aget file-alist file-name))
	       (ent-list (nth 0 file-entry))
	       (arch-list (nth 1 file-entry))
	       (arch-ent-list (nth 2 file-entry))
	       (conf-list (nth 3 file-entry))
	       (pack-list (nth 4 file-entry))
	       (pack-body-list (nth 5 file-entry))
	       (inst-ent-list (nth 7 file-entry))
	       (cache-key (or project dir-name))
	       arch-alist key ent-key entry)
	  ;; delete design units previously contained in this file:
	  ;; entities
	  (while ent-list
	    (setq key (car ent-list)
		  entry (vhdl-aget ent-alist key))
	    (when (equal file-name (nth 1 entry))
	      (if (nth 3 entry)
		  (vhdl-aput 'ent-alist key
			     (list (nth 0 entry) nil nil (nth 3 entry) nil))
		(vhdl-adelete 'ent-alist key)))
	    (setq ent-list (cdr ent-list)))
	  ;; architectures
	  (while arch-list
	    (setq key (car arch-list)
		  ent-key (car arch-ent-list)
		  entry (vhdl-aget ent-alist ent-key)
		  arch-alist (nth 3 entry))
	    (when (equal file-name (nth 1 (vhdl-aget arch-alist key)))
	      (vhdl-adelete 'arch-alist key)
	      (if (or (nth 1 entry) arch-alist)
		  (vhdl-aput 'ent-alist ent-key
			     (list (nth 0 entry) (nth 1 entry) (nth 2 entry)
				   arch-alist (nth 4 entry) (nth 5 entry)))
		(vhdl-adelete 'ent-alist ent-key)))
	    (setq arch-list (cdr arch-list)
		  arch-ent-list (cdr arch-ent-list)))
	  ;; configurations
	  (while conf-list
	    (setq key (car conf-list))
	    (when (equal file-name (nth 1 (vhdl-aget conf-alist key)))
	      (vhdl-adelete 'conf-alist key))
	    (setq conf-list (cdr conf-list)))
	  ;; package declarations
	  (while pack-list
	    (setq key (car pack-list)
		  entry (vhdl-aget pack-alist key))
	    (when (equal file-name (nth 1 entry))
	      (if (nth 6 entry)
		  (vhdl-aput 'pack-alist key
			     (list (nth 0 entry) nil nil nil nil nil
				   (nth 6 entry) (nth 7 entry) (nth 8 entry)
				   (nth 9 entry)))
		(vhdl-adelete 'pack-alist key)))
	    (setq pack-list (cdr pack-list)))
	  ;; package bodies
	  (while pack-body-list
	    (setq key (car pack-body-list)
		  entry (vhdl-aget pack-alist key))
	    (when (equal file-name (nth 6 entry))
	      (if (nth 1 entry)
		  (vhdl-aput 'pack-alist key
			     (list (nth 0 entry) (nth 1 entry) (nth 2 entry)
				   (nth 3 entry) (nth 4 entry) (nth 5 entry)
				   nil nil nil nil))
		(vhdl-adelete 'pack-alist key)))
	    (setq pack-body-list (cdr pack-body-list)))
	  ;; instantiated entities
	  (while inst-ent-list
	    (setq ent-inst-list
		  (vhdl-delete (car inst-ent-list) ent-inst-list))
	    (setq inst-ent-list (cdr inst-ent-list)))
	  ;; update caches
	  (vhdl-aput-delete-if-nil 'vhdl-entity-alist cache-key ent-alist)
	  (vhdl-aput-delete-if-nil 'vhdl-config-alist cache-key conf-alist)
	  (vhdl-aput-delete-if-nil 'vhdl-package-alist cache-key pack-alist)
	  (vhdl-aput-delete-if-nil 'vhdl-ent-inst-alist cache-key (list ent-inst-list))
	  ;; scan file
	  (vhdl-scan-directory-contents file-name project t)
	  (when (or (and vhdl-speedbar-show-projects project)
		    (and (not vhdl-speedbar-show-projects) (not project)))
	    (vhdl-speedbar-refresh project))
	  (setq updated t)))
      (setq directory-alist (cdr directory-alist)))
    updated))