Function: verilog-signals-not-in-struct

verilog-signals-not-in-struct is a byte-compiled function defined in verilog-mode.el.gz.

Signature

(verilog-signals-not-in-struct IN-LIST NOT-LIST)

Documentation

Return list of signals in IN-LIST that aren't also in NOT-LIST.

Also remove any duplicates in IN-LIST. Any structure in not-list will remove all members in in-list. Signals must be in standard (base vector) form.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/verilog-mode.el.gz
;;(verilog-signals-not-in '(("A" "") ("B" "") ("DEL" "[2:3]")) '(("DEL" "") ("EXT" "")))

(defun verilog-signals-not-in-struct (in-list not-list)
  "Return list of signals in IN-LIST that aren't also in NOT-LIST.
Also remove any duplicates in IN-LIST.
Any structure in not-list will remove all members in in-list.
Signals must be in standard (base vector) form."
  (cond ((eval-when-compile (fboundp 'make-hash-table))
	 (let ((ht (make-hash-table :test 'equal :rehash-size 4.0))
	       out-list addit nm)
	   (while not-list
	     (puthash (car (car not-list)) t ht)
	     (setq not-list (cdr not-list)))
	   (while in-list
	     (setq nm (verilog-sig-name (car in-list)))
	     (when (not (gethash nm ht))
	       (setq addit t)
	       (while (string-match "^\\([^\\].*\\)\\.[^.]+$" nm)
		 (setq nm (match-string 1 nm))
		 (setq addit (and addit
				  (not (gethash nm ht)))))
	       (when addit
		 (setq out-list (cons (car in-list) out-list))
		 (puthash (verilog-sig-name (car in-list)) t ht)))
	     (setq in-list (cdr in-list)))
	   (nreverse out-list)))
	;; Slower Fallback if no hash tables (pre Emacs 21.1/XEmacs 21.4)
	(t
	 (let (out-list addit nm)
	   (while in-list
	     (setq nm (verilog-sig-name (car in-list)))
	     (when (and (not (assoc nm not-list))
			(not (assoc nm out-list)))
	       (setq addit t)
	       (while (string-match "^\\([^\\].*\\)\\.[^.]+$" nm)
		 (setq nm (match-string 1 nm))
		 (setq addit (and addit
				  (not (assoc nm not-list)))))
	       (when addit
		 (setq out-list (cons (car in-list) out-list))))
	     (setq in-list (cdr in-list)))
	   (nreverse out-list)))))