Function: verilog-modi-lookup
verilog-modi-lookup is a byte-compiled function defined in
verilog-mode.el.gz.
Signature
(verilog-modi-lookup MODULE ALLOW-CACHE &optional IGNORE-ERROR)
Documentation
Find the file and point at which MODULE is defined.
If ALLOW-CACHE is set, check and remember cache of previous lookups. Return modi if successful, else print message unless IGNORE-ERROR is true.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/verilog-mode.el.gz
(defun verilog-modi-lookup (module allow-cache &optional ignore-error)
"Find the file and point at which MODULE is defined.
If ALLOW-CACHE is set, check and remember cache of previous lookups.
Return modi if successful, else print message unless IGNORE-ERROR is true."
(let* ((current (or (buffer-file-name) (current-buffer)))
modi)
;; Check cache
;;(message "verilog-modi-lookup: %s" module)
(cond ((and verilog-modi-lookup-cache
verilog-cache-enabled
allow-cache
(setq modi (gethash module verilog-modi-lookup-cache))
(equal verilog-modi-lookup-last-current current)
;; If hit is in current buffer, then tick must match
(or (equal verilog-modi-lookup-last-tick (buffer-chars-modified-tick))
(not (equal current (verilog-modi-file-or-buffer modi)))))
;;(message "verilog-modi-lookup: HIT %S" modi)
modi)
;; Miss
(t (let* ((realname (verilog-symbol-detick module t))
(orig-filenames (verilog-module-filenames realname current))
(filenames orig-filenames)
mif)
(while (and filenames (not mif))
(if (not (setq mif (verilog-module-inside-filename-p realname (car filenames))))
(setq filenames (cdr filenames))))
;; mif has correct form to become later elements of modi
(setq modi mif)
(or mif ignore-error
(error
(concat
"%s: Can't locate `%s' module definition%s"
"\n Check the verilog-library-directories variable."
"\n I looked in (if not listed, doesn't exist):\n\t%s")
(verilog-point-text) module
(if (not (equal module realname))
(concat " (Expanded macro to " realname ")")
"")
(mapconcat #'concat orig-filenames "\n\t")))
(when (eval-when-compile (fboundp 'make-hash-table))
(unless verilog-modi-lookup-cache
(setq verilog-modi-lookup-cache
(make-hash-table :test 'equal :rehash-size 4.0)))
(puthash module modi verilog-modi-lookup-cache))
(setq verilog-modi-lookup-last-current current
verilog-modi-lookup-last-tick (buffer-chars-modified-tick)))))
modi))