aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Roberts2007-12-24 08:00:52 +0000
committerNick Roberts2007-12-24 08:00:52 +0000
commit74d85a08a614f72a44f4bbbe01ccae67b7b5b080 (patch)
tree248d1ec8a166399ddbc400cbe04364934734a424
parentd72cf2fa89fcd9d4a7e244fcf35b9a0624cef43e (diff)
downloademacs-74d85a08a614f72a44f4bbbe01ccae67b7b5b080.tar.gz
emacs-74d85a08a614f72a44f4bbbe01ccae67b7b5b080.zip
Reformat parts to 80 columns.
-rw-r--r--lisp/progmodes/verilog-mode.el144
1 files changed, 81 insertions, 63 deletions
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 655352e1365..7533d4dd49e 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -175,7 +175,8 @@ STRING should be given if the last search was by `string-match' on STRING."
175 (if (match-beginning num) 175 (if (match-beginning num)
176 (if string 176 (if string
177 (let ((result 177 (let ((result
178 (substring string (match-beginning num) (match-end num)))) 178 (substring string
179 (match-beginning num) (match-end num))))
179 (set-text-properties 0 (length result) nil result) 180 (set-text-properties 0 (length result) nil result)
180 result) 181 result)
181 (buffer-substring-no-properties (match-beginning num) 182 (buffer-substring-no-properties (match-beginning num)
@@ -188,7 +189,8 @@ STRING should be given if the last search was by `string-match' on STRING."
188 ;; We have the old custom-library, hack around it! 189 ;; We have the old custom-library, hack around it!
189 (defmacro defgroup (&rest args) nil) 190 (defmacro defgroup (&rest args) nil)
190 (defmacro customize (&rest args) 191 (defmacro customize (&rest args)
191 (message "Sorry, Customize is not available with this version of emacs")) 192 (message
193 "Sorry, Customize is not available with this version of emacs"))
192 (defmacro defcustom (var value doc &rest args) 194 (defmacro defcustom (var value doc &rest args)
193 `(defvar ,var ,value ,doc)) 195 `(defvar ,var ,value ,doc))
194 ) 196 )
@@ -1187,7 +1189,8 @@ without the directory portion, will be substituted."
1187 1189
1188(defun verilog-error-regexp-add () 1190(defun verilog-error-regexp-add ()
1189 "Add the messages to the `compilation-error-regexp-alist'. 1191 "Add the messages to the `compilation-error-regexp-alist'.
1190Called by `compilation-mode-hook'. This allows \\[next-error] to find the errors." 1192Called by `compilation-mode-hook'. This allows \\[next-error] to
1193find the errors."
1191 (if (not verilog-error-regexp-add-didit) 1194 (if (not verilog-error-regexp-add-didit)
1192 (progn 1195 (progn
1193 (setq verilog-error-regexp-add-didit t) 1196 (setq verilog-error-regexp-add-didit t)
@@ -1195,7 +1198,8 @@ Called by `compilation-mode-hook'. This allows \\[next-error] to find the error
1195 (append verilog-error-regexp 1198 (append verilog-error-regexp
1196 (default-value 'compilation-error-regexp-alist))) 1199 (default-value 'compilation-error-regexp-alist)))
1197 ;; Could be buffer local at this point; maybe also in let; change all three 1200 ;; Could be buffer local at this point; maybe also in let; change all three
1198 (setq compilation-error-regexp-alist (default-value 'compilation-error-regexp-alist)) 1201 (setq compilation-error-regexp-alist
1202 (default-value 'compilation-error-regexp-alist))
1199 (set (make-local-variable 'compilation-error-regexp-alist) 1203 (set (make-local-variable 'compilation-error-regexp-alist)
1200 (default-value 'compilation-error-regexp-alist)) 1204 (default-value 'compilation-error-regexp-alist))
1201 ))) 1205 )))
@@ -2006,10 +2010,9 @@ See also `verilog-font-lock-extra-types'.")
2006 (when verilog-highlight-translate-off 2010 (when verilog-highlight-translate-off
2007 (list 2011 (list
2008 ;; Fontify things in translate off regions 2012 ;; Fontify things in translate off regions
2009 '(verilog-match-translate-off (0 'verilog-font-lock-translate-off-face prepend)) 2013 '(verilog-match-translate-off
2010 ))) 2014 (0 'verilog-font-lock-translate-off-face prepend))
2011 ) 2015 )))))
2012 )
2013 2016
2014 2017
2015 2018
@@ -2019,9 +2022,13 @@ See also `verilog-font-lock-extra-types'.")
2019 (let ((st-point (point)) hitbeg) 2022 (let ((st-point (point)) hitbeg)
2020 (or (search-backward "//" (verilog-get-beg-of-line) t) 2023 (or (search-backward "//" (verilog-get-beg-of-line) t)
2021 (if (progn 2024 (if (progn
2022 ;; This is for tricky case //*, we keep searching if /* is proceeded by // on same line 2025 ;; This is for tricky case //*, we keep searching if /* is
2023 (while (and (setq hitbeg (search-backward "/*" nil t)) 2026 ;; proceeded by // on same line.
2024 (progn (forward-char 1) (search-backward "//" (verilog-get-beg-of-line) t)))) 2027 (while
2028 (and (setq hitbeg (search-backward "/*" nil t))
2029 (progn
2030 (forward-char 1)
2031 (search-backward "//" (verilog-get-beg-of-line) t))))
2025 hitbeg) 2032 hitbeg)
2026 (not (search-forward "*/" st-point t))))))) 2033 (not (search-forward "*/" st-point t)))))))
2027 2034
@@ -3236,8 +3243,7 @@ Insert `// NAME ' if this line ends a function, task, module, primitive or inter
3236 (cond 3243 (cond
3237 ((looking-at "\\<randcase\\>") 3244 ((looking-at "\\<randcase\\>")
3238 (setq str "randcase") 3245 (setq str "randcase")
3239 (setq err nil) 3246 (setq err nil))
3240 )
3241 ((match-end 0) 3247 ((match-end 0)
3242 (goto-char (match-end 1)) 3248 (goto-char (match-end 1))
3243 (if nil 3249 (if nil
@@ -3255,8 +3261,7 @@ Insert `// NAME ' if this line ends a function, task, module, primitive or inter
3255 (verilog-kill-existing-comment)) 3261 (verilog-kill-existing-comment))
3256 (delete-horizontal-space) 3262 (delete-horizontal-space)
3257 (insert (concat " // " str )) 3263 (insert (concat " // " str ))
3258 (if err (ding 't)) 3264 (if err (ding 't))))
3259 ))
3260 3265
3261 (;- This is a begin..end block 3266 (;- This is a begin..end block
3262 (match-end 2) ;; of verilog-end-block-ordered-re 3267 (match-end 2) ;; of verilog-end-block-ordered-re
@@ -3592,19 +3597,25 @@ Useful for creating tri's and other expanded fields."
3592 (let ((signal-string (buffer-substring (point) 3597 (let ((signal-string (buffer-substring (point)
3593 (progn 3598 (progn
3594 (end-of-line) (point))))) 3599 (end-of-line) (point)))))
3595 (if (string-match (concat "\\(.*\\)" 3600 (if (string-match
3596 (regexp-quote bra) 3601 (concat "\\(.*\\)"
3597 "\\([0-9]*\\)\\(:[0-9]*\\|\\)\\(::[0-9---]*\\|\\)" 3602 (regexp-quote bra)
3603 "\\([0-9]*\\)\\(:[0-9]*\\|\\)\\(::[0-9---]*\\|\\)"
3598 (regexp-quote ket) 3604 (regexp-quote ket)
3599 "\\(.*\\)$") signal-string) 3605 "\\(.*\\)$") signal-string)
3600 (let* ((sig-head (match-string 1 signal-string)) 3606 (let* ((sig-head (match-string 1 signal-string))
3601 (vec-start (string-to-number (match-string 2 signal-string))) 3607 (vec-start (string-to-number (match-string 2 signal-string)))
3602 (vec-end (if (= (match-beginning 3) (match-end 3)) 3608 (vec-end (if (= (match-beginning 3) (match-end 3))
3603 vec-start 3609 vec-start
3604 (string-to-number (substring signal-string (1+ (match-beginning 3)) (match-end 3))))) 3610 (string-to-number
3605 (vec-range (if (= (match-beginning 4) (match-end 4)) 3611 (substring signal-string (1+ (match-beginning 3))
3606 1 3612 (match-end 3)))))
3607 (string-to-number (substring signal-string (+ 2 (match-beginning 4)) (match-end 4))))) 3613 (vec-range
3614 (if (= (match-beginning 4) (match-end 4))
3615 1
3616 (string-to-number
3617 (substring signal-string (+ 2 (match-beginning 4))
3618 (match-end 4)))))
3608 (sig-tail (match-string 5 signal-string)) 3619 (sig-tail (match-string 5 signal-string))
3609 vec) 3620 vec)
3610 ;; Decode vectors 3621 ;; Decode vectors
@@ -3627,7 +3638,8 @@ Useful for creating tri's and other expanded fields."
3627 ;; 3638 ;;
3628 ;; Expand vector 3639 ;; Expand vector
3629 (while vec 3640 (while vec
3630 (insert (concat sig-head bra (int-to-string (car vec)) ket sig-tail "\n")) 3641 (insert (concat sig-head bra
3642 (int-to-string (car vec)) ket sig-tail "\n"))
3631 (setq vec (cdr vec))) 3643 (setq vec (cdr vec)))
3632 (delete-char -1) 3644 (delete-char -1)
3633 ;; 3645 ;;
@@ -3821,7 +3833,8 @@ This lets programs calling batch mode to easily extract error messages."
3821 (when (buffer-file-name buf) 3833 (when (buffer-file-name buf)
3822 (save-excursion 3834 (save-excursion
3823 (if (not (file-exists-p (buffer-file-name buf))) 3835 (if (not (file-exists-p (buffer-file-name buf)))
3824 (error (concat "File not found: " (buffer-file-name buf)))) 3836 (error
3837 (concat "File not found: " (buffer-file-name buf))))
3825 (message (concat "Processing " (buffer-file-name buf))) 3838 (message (concat "Processing " (buffer-file-name buf)))
3826 (set-buffer buf) 3839 (set-buffer buf)
3827 (funcall funref) 3840 (funcall funref)
@@ -4092,8 +4105,7 @@ type. Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
4092 (save-excursion 4105 (save-excursion
4093 (verilog-beg-of-statement) 4106 (verilog-beg-of-statement)
4094 (if (= (point) here) 4107 (if (= (point) here)
4095 (throw 'nesting 'block)) 4108 (throw 'nesting 'block)))))
4096 )))
4097 (t (throw 'nesting 'block)))) 4109 (t (throw 'nesting 'block))))
4098 4110
4099 ((looking-at verilog-end-block-re) 4111 ((looking-at verilog-end-block-re)
@@ -4113,11 +4125,8 @@ type. Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
4113 (throw 'nesting 'cpp)) 4125 (throw 'nesting 'cpp))
4114 4126
4115 ((bobp) 4127 ((bobp)
4116 (throw 'nesting 'cpp)) 4128 (throw 'nesting 'cpp))))
4117 )) 4129 (throw 'nesting 'cpp)))
4118 (throw 'nesting 'cpp)
4119 )
4120 )
4121 4130
4122(defun verilog-calculate-indent-directive () 4131(defun verilog-calculate-indent-directive ()
4123 "Return indentation level for directive. 4132 "Return indentation level for directive.
@@ -4639,8 +4648,10 @@ Only look at a few lines to determine indent level."
4639 ((verilog-continued-line) 4648 ((verilog-continued-line)
4640 (let ((sp1 (point))) 4649 (let ((sp1 (point)))
4641 (if (verilog-continued-line) 4650 (if (verilog-continued-line)
4642 (progn (goto-char sp) 4651 (progn
4643 (setq indent-str (list 'statement (verilog-current-indent-level)))) 4652 (goto-char sp)
4653 (setq
4654 indent-str (list 'statement (verilog-current-indent-level))))
4644 (goto-char sp1) 4655 (goto-char sp1)
4645 (setq indent-str (list 'block (verilog-current-indent-level))))) 4656 (setq indent-str (list 'block (verilog-current-indent-level)))))
4646 (goto-char sp)) 4657 (goto-char sp))
@@ -4998,7 +5009,8 @@ ARG is ignored, for `comment-indent-function' compatibility."
4998 (setq e (point)) ;Might be on last line 5009 (setq e (point)) ;Might be on last line
4999 (verilog-forward-syntactic-ws) 5010 (verilog-forward-syntactic-ws)
5000 (beginning-of-line) 5011 (beginning-of-line)
5001 (while (and (not(looking-at (concat "^\\s-*" verilog-complete-reg))) 5012 (while (and (not (looking-at
5013 (concat "^\\s-*" verilog-complete-reg)))
5002 (looking-at myre)) 5014 (looking-at myre))
5003 (end-of-line) 5015 (end-of-line)
5004 (setq e (point)) 5016 (setq e (point))
@@ -5083,7 +5095,8 @@ BASEIND is the base indent to offset everything."
5083 (val) 5095 (val)
5084 (m1 (make-marker)) 5096 (m1 (make-marker))
5085 ) 5097 )
5086 (setq val (+ baseind (eval (cdr (assoc 'declaration verilog-indent-alist))))) 5098 (setq val
5099 (+ baseind (eval (cdr (assoc 'declaration verilog-indent-alist)))))
5087 (indent-line-to val) 5100 (indent-line-to val)
5088 5101
5089 ;; Use previous declaration (in this module) as template. 5102 ;; Use previous declaration (in this module) as template.
@@ -5098,7 +5111,9 @@ BASEIND is the base indent to offset everything."
5098 (skip-chars-forward " \t") 5111 (skip-chars-forward " \t")
5099 (setq ind (current-column)) 5112 (setq ind (current-column))
5100 (goto-char pos) 5113 (goto-char pos)
5101 (setq val (+ baseind (eval (cdr (assoc 'declaration verilog-indent-alist))))) 5114 (setq val
5115 (+ baseind
5116 (eval (cdr (assoc 'declaration verilog-indent-alist)))))
5102 (indent-line-to val) 5117 (indent-line-to val)
5103 (if (and verilog-indent-declaration-macros 5118 (if (and verilog-indent-declaration-macros
5104 (looking-at verilog-declaration-re-2-macro)) 5119 (looking-at verilog-declaration-re-2-macro))
@@ -5130,14 +5145,8 @@ BASEIND is the base indent to offset everything."
5130 (if (/= (current-column) ind) 5145 (if (/= (current-column) ind)
5131 (progn 5146 (progn
5132 (just-one-space) 5147 (just-one-space)
5133 (indent-to ind)) 5148 (indent-to ind))))))))))
5134 ))) 5149 (goto-char pos)))
5135 )))
5136 )
5137 )
5138 (goto-char pos)
5139 )
5140 )
5141 5150
5142(defun verilog-get-lineup-indent (b edpos) 5151(defun verilog-get-lineup-indent (b edpos)
5143 "Return the indent level that will line up several lines within the region. 5152 "Return the indent level that will line up several lines within the region.
@@ -5648,7 +5657,8 @@ If search fails, other files are checked based on
5648 (progn 5657 (progn
5649 (save-excursion 5658 (save-excursion
5650 (goto-char (point-min)) 5659 (goto-char (point-min))
5651 (setq pt (re-search-forward (verilog-build-defun-re label t) nil t))) 5660 (setq pt
5661 (re-search-forward (verilog-build-defun-re label t) nil t)))
5652 (when pt 5662 (when pt
5653 (goto-char pt) 5663 (goto-char pt)
5654 (beginning-of-line)) 5664 (beginning-of-line))
@@ -5991,7 +6001,8 @@ Duplicate signals are also removed. For example A[2] and A[1] become A[2:1]."
5991 (cond ((and bus 6001 (cond ((and bus
5992 (or (and (string-match "\\[\\([0-9]+\\):\\([0-9]+\\)\\]" bus) 6002 (or (and (string-match "\\[\\([0-9]+\\):\\([0-9]+\\)\\]" bus)
5993 (setq highbit (string-to-number (match-string 1 bus)) 6003 (setq highbit (string-to-number (match-string 1 bus))
5994 lowbit (string-to-number (match-string 2 bus)))) 6004 lowbit (string-to-number
6005 (match-string 2 bus))))
5995 (and (string-match "\\[\\([0-9]+\\)\\]" bus) 6006 (and (string-match "\\[\\([0-9]+\\)\\]" bus)
5996 (setq highbit (string-to-number (match-string 1 bus)) 6007 (setq highbit (string-to-number (match-string 1 bus))
5997 lowbit highbit)))) 6008 lowbit highbit))))
@@ -6009,7 +6020,8 @@ Duplicate signals are also removed. For example A[2] and A[1] become A[2:1]."
6009 (setq sig (car in-list)) 6020 (setq sig (car in-list))
6010 (cond ((and sig (equal sv-name (verilog-sig-name sig))) 6021 (cond ((and sig (equal sv-name (verilog-sig-name sig)))
6011 ;; Combine with this signal 6022 ;; Combine with this signal
6012 (when (and sv-busstring (not (equal sv-busstring (verilog-sig-bits sig)))) 6023 (when (and sv-busstring
6024 (not (equal sv-busstring (verilog-sig-bits sig))))
6013 (when nil ;; Debugging 6025 (when nil ;; Debugging
6014 (message (concat "Warning, can't merge into single bus " 6026 (message (concat "Warning, can't merge into single bus "
6015 sv-name bus 6027 sv-name bus
@@ -6025,10 +6037,12 @@ Duplicate signals are also removed. For example A[2] and A[1] become A[2:1]."
6025 ;; Note sig may also be nil for the last signal in the list 6037 ;; Note sig may also be nil for the last signal in the list
6026 (t 6038 (t
6027 (setq out-list 6039 (setq out-list
6028 (cons (list sv-name 6040 (cons
6029 (or sv-busstring 6041 (list sv-name
6030 (if sv-highbit 6042 (or sv-busstring
6031 (concat "[" (int-to-string sv-highbit) ":" (int-to-string sv-lowbit) "]"))) 6043 (if sv-highbit
6044 (concat "[" (int-to-string sv-highbit) ":"
6045 (int-to-string sv-lowbit) "]")))
6032 (concat sv-comment combo buswarn) 6046 (concat sv-comment combo buswarn)
6033 sv-memory sv-enum sv-signed sv-type sv-multidim) 6047 sv-memory sv-enum sv-signed sv-type sv-multidim)
6034 out-list) 6048 out-list)
@@ -7573,13 +7587,15 @@ This repairs those mis-inserted by a AUTOARG."
7573 (setq range-exp (match-string 1 range-exp))) 7587 (setq range-exp (match-string 1 range-exp)))
7574 (cond ((not range-exp) 7588 (cond ((not range-exp)
7575 "1") 7589 "1")
7576 ((string-match "^\\s *\\([0-9]+\\)\\s *:\\s *\\([0-9]+\\)\\s *$" range-exp) 7590 ((string-match "^\\s *\\([0-9]+\\)\\s *:\\s *\\([0-9]+\\)\\s *$"
7577 (int-to-string (1+ (abs (- (string-to-number (match-string 1 range-exp)) 7591 range-exp)
7578 (string-to-number (match-string 2 range-exp))))))) 7592 (int-to-string
7593 (1+ (abs (- (string-to-number (match-string 1 range-exp))
7594 (string-to-number (match-string 2 range-exp)))))))
7579 ((string-match "^\\(.*\\)\\s *:\\s *\\(.*\\)\\s *$" range-exp) 7595 ((string-match "^\\(.*\\)\\s *:\\s *\\(.*\\)\\s *$" range-exp)
7580 (concat "(1+(" (match-string 1 range-exp) 7596 (concat "(1+(" (match-string 1 range-exp) ")"
7581 ")" 7597 (if (equal "0" (match-string 2 range-exp))
7582 (if (equal "0" (match-string 2 range-exp)) ;; Don't bother with -(0) 7598 ;; Don't bother with -(0)
7583 "" 7599 ""
7584 (concat "-(" (match-string 2 range-exp) ")")) 7600 (concat "-(" (match-string 2 range-exp) ")"))
7585 ")")) 7601 ")"))
@@ -9539,16 +9555,18 @@ being different from the final output's line numbering."
9539 (goto-char (point-min)) 9555 (goto-char (point-min))
9540 (while (search-forward "AUTO_TEMPLATE" nil t) 9556 (while (search-forward "AUTO_TEMPLATE" nil t)
9541 (setq templateno (1+ templateno)) 9557 (setq templateno (1+ templateno))
9542 (setq template-line (cons (count-lines (point-min) (point)) template-line))) 9558 (setq template-line
9559 (cons (count-lines (point-min) (point)) template-line)))
9543 (setq template-line (nreverse template-line)) 9560 (setq template-line (nreverse template-line))
9544 ;; Replace T# L# with absolute line number 9561 ;; Replace T# L# with absolute line number
9545 (goto-char (point-min)) 9562 (goto-char (point-min))
9546 (while (re-search-forward " Templated T\\([0-9]+\\) L\\([0-9]+\\)" nil t) 9563 (while (re-search-forward " Templated T\\([0-9]+\\) L\\([0-9]+\\)" nil t)
9547 (replace-match (concat " Templated " 9564 (replace-match
9548 (int-to-string (+ (nth (string-to-number (match-string 1)) 9565 (concat " Templated "
9549 template-line) 9566 (int-to-string (+ (nth (string-to-number (match-string 1))
9550 (string-to-number (match-string 2))))) 9567 template-line)
9551 t t)))) 9568 (string-to-number (match-string 2)))))
9569 t t))))
9552 9570
9553 9571
9554;; 9572;;