Function: verilog-showscopes
verilog-showscopes is an interactive and byte-compiled function
defined in verilog-mode.el.gz.
Signature
(verilog-showscopes)
Documentation
List all scopes in this module.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/verilog-mode.el.gz
(defun verilog-showscopes ()
"List all scopes in this module."
(interactive)
(let ((buffer (current-buffer))
(linenum 1)
(nlines 0)
(first 1)
(prevpos (point-min))
(final-context-start (make-marker))
(regexp "\\(\\(connect\\)?module\\s-+\\w+\\s-*(\\)\\|\\(\\w+\\s-+\\w+\\s-*(\\)"))
(with-output-to-temp-buffer "*Occur*"
(save-excursion
(message "Searching for %s ..." regexp)
;; Find next match, but give up if prev match was at end of buffer.
(while (and (not (= prevpos (point-max)))
(verilog-re-search-forward regexp nil t))
(goto-char (match-beginning 0))
(beginning-of-line)
(save-match-data
(setq linenum (+ linenum (count-lines prevpos (point)))))
(setq prevpos (point))
(goto-char (match-end 0))
(let* ((start (save-excursion
(goto-char (match-beginning 0))
(forward-line (if (< nlines 0) nlines (- nlines)))
(point)))
(end (save-excursion
(goto-char (match-end 0))
(if (> nlines 0)
(forward-line (1+ nlines))
(forward-line 1))
(point)))
(tag (format "%3d" linenum))
(empty (make-string (length tag) ?\ ))
tem)
(setq tem (make-marker))
(set-marker tem (point))
(with-current-buffer standard-output
(setq occur-pos-list (cons tem occur-pos-list))
(or first (zerop nlines)
(insert "--------\n"))
(setq first nil)
(insert-buffer-substring buffer start end)
(backward-char (- end start))
(setq tem (if (< nlines 0) (- nlines) nlines))
(while (> tem 0)
(insert empty ?:)
(forward-line 1)
(setq tem (1- tem)))
(let ((this-linenum linenum))
(set-marker final-context-start
(+ (point) (- (match-end 0) (match-beginning 0))))
(while (< (point) final-context-start)
(if (null tag)
(setq tag (format "%3d" this-linenum)))
(insert tag ?:)))))))
(set-buffer-modified-p nil))))