Mercurial > hg > xemacs-beta
comparison lisp/modes/vhdl-mode.el @ 189:489f57a838ef r20-3b21
Import from CVS: tag r20-3b21
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:57:07 +0200 |
parents | 9ad43877534d |
children |
comparison
equal
deleted
inserted
replaced
188:e29a8e7498d9 | 189:489f57a838ef |
---|---|
5 ;; Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. | 5 ;; Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. |
6 | 6 |
7 ;; Author: Rodney J. Whitby <rwhitby@geocities.com> | 7 ;; Author: Rodney J. Whitby <rwhitby@geocities.com> |
8 ;; Maintainer: Rodney J. Whitby <rwhitby@geocities.com> | 8 ;; Maintainer: Rodney J. Whitby <rwhitby@geocities.com> |
9 ;; Created: June 1994, adapted from cc-mode.el 4.29 by Barry A. Warsaw. | 9 ;; Created: June 1994, adapted from cc-mode.el 4.29 by Barry A. Warsaw. |
10 ;; Version: $Revision: 1.6 $ | 10 ;; Version: $Revision: 1.7 $ |
11 ;; Last Modified: $Date: 1997/08/01 03:27:57 $ | 11 ;; Last Modified: $Date: 1997/09/17 05:19:27 $ |
12 ;; Keywords: languages VHDL | 12 ;; Keywords: languages VHDL |
13 ;; Archive: http://www.geocities.com/SiliconValley/Park/8287/ | 13 ;; Archive: http://www.geocities.com/SiliconValley/Park/8287/ |
14 | 14 |
15 ;; NOTE: Read the commentary below for the right way to submit bug reports! | 15 ;; NOTE: Read the commentary below for the right way to submit bug reports! |
16 | 16 |
65 ;; and encouragement vhdl-mode.el would be a far inferior package. | 65 ;; and encouragement vhdl-mode.el would be a far inferior package. |
66 | 66 |
67 ;; LCD Archive Entry: | 67 ;; LCD Archive Entry: |
68 ;; vhdl-mode.el|Rodney J. Whitby|rwhitby@geocities.com | 68 ;; vhdl-mode.el|Rodney J. Whitby|rwhitby@geocities.com |
69 ;; |Major mode for editing VHDL code | 69 ;; |Major mode for editing VHDL code |
70 ;; |$Date: 1997/08/01 03:27:57 $|$Revision: 1.6 $ | 70 ;; |$Date: 1997/09/17 05:19:27 $|$Revision: 1.7 $ |
71 ;; |http://www.geocities.com/SiliconValley/Park/8287/ | 71 ;; |http://www.geocities.com/SiliconValley/Park/8287/ |
72 | 72 |
73 | 73 |
74 ;;; Code: | 74 ;;; Code: |
75 | 75 |
76 ;; user definable variables | 76 ;; user definable variables |
77 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv | 77 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv |
78 | 78 |
79 (defvar vhdl-inhibit-startup-warnings-p nil | 79 (defgroup vhdl nil |
80 "*If non-nil, inhibits start up compatibility warnings.") | 80 "Major mode for editing VHDL code." |
81 (defvar vhdl-strict-syntax-p nil | 81 :group 'languages) |
82 | |
83 | |
84 (defcustom vhdl-inhibit-startup-warnings-p nil | |
85 "*If non-nil, inhibits start up compatibility warnings." | |
86 :type 'boolean | |
87 :group 'vhdl) | |
88 | |
89 (defcustom vhdl-strict-syntax-p nil | |
82 "*If non-nil, all syntactic symbols must be found in `vhdl-offsets-alist'. | 90 "*If non-nil, all syntactic symbols must be found in `vhdl-offsets-alist'. |
83 If the syntactic symbol for a particular line does not match a symbol | 91 If the syntactic symbol for a particular line does not match a symbol |
84 in the offsets alist, an error is generated, otherwise no error is | 92 in the offsets alist, an error is generated, otherwise no error is |
85 reported and the syntactic symbol is ignored.") | 93 reported and the syntactic symbol is ignored." |
86 (defvar vhdl-echo-syntactic-information-p nil | 94 :type 'boolean |
87 "*If non-nil, syntactic info is echoed when the line is indented.") | 95 :group 'vhdl) |
88 (defvar vhdl-basic-offset 2 | 96 |
89 "*Amount of basic offset used by + and - symbols in `vhdl-offsets-alist'.") | 97 (defcustom vhdl-echo-syntactic-information-p nil |
98 "*If non-nil, syntactic info is echoed when the line is indented." | |
99 :type 'boolean | |
100 :group 'vhdl) | |
101 | |
102 (defcustom vhdl-basic-offset 2 | |
103 "*Amount of basic offset used by + and - symbols in `vhdl-offsets-alist'." | |
104 :type 'integer | |
105 :group 'vhdl) | |
90 | 106 |
91 (defconst vhdl-offsets-alist-default | 107 (defconst vhdl-offsets-alist-default |
92 '((string . -1000) | 108 '((string . -1000) |
93 (block-open . 0) | 109 (block-open . 0) |
94 (block-close . 0) | 110 (block-close . 0) |
110 ) | 126 ) |
111 "Default settings for offsets of syntactic elements. | 127 "Default settings for offsets of syntactic elements. |
112 Do not change this constant! See the variable `vhdl-offsets-alist' for | 128 Do not change this constant! See the variable `vhdl-offsets-alist' for |
113 more information.") | 129 more information.") |
114 | 130 |
115 (defvar vhdl-offsets-alist (copy-alist vhdl-offsets-alist-default) | 131 (defcustom vhdl-offsets-alist (copy-alist vhdl-offsets-alist-default) |
116 "*Association list of syntactic element symbols and indentation offsets. | 132 "*Association list of syntactic element symbols and indentation offsets. |
117 As described below, each cons cell in this list has the form: | 133 As described below, each cons cell in this list has the form: |
118 | 134 |
119 (SYNTACTIC-SYMBOL . OFFSET) | 135 (SYNTACTIC-SYMBOL . OFFSET) |
120 | 136 |
170 entity -- inside an entity declaration | 186 entity -- inside an entity declaration |
171 configuration -- inside a configuration declaration | 187 configuration -- inside a configuration declaration |
172 package -- inside a package declaration | 188 package -- inside a package declaration |
173 architecture -- inside an architecture body | 189 architecture -- inside an architecture body |
174 package-body -- inside a package body | 190 package-body -- inside a package body |
175 ") | 191 " |
176 | 192 :type 'sexp |
177 (defvar vhdl-tab-always-indent t | 193 :group 'vhdl) |
194 | |
195 (defcustom vhdl-tab-always-indent t | |
178 "*Controls the operation of the TAB key. | 196 "*Controls the operation of the TAB key. |
179 If t, hitting TAB always just indents the current line. If nil, | 197 If t, hitting TAB always just indents the current line. If nil, |
180 hitting TAB indents the current line if point is at the left margin or | 198 hitting TAB indents the current line if point is at the left margin or |
181 in the line's indentation, otherwise it insert a real tab character. | 199 in the line's indentation, otherwise it insert a real tab character. |
182 If other than nil or t, then tab is inserted only within literals | 200 If other than nil or t, then tab is inserted only within literals |
183 -- defined as comments and strings -- and inside preprocessor | 201 -- defined as comments and strings -- and inside preprocessor |
184 directives, but line is always reindented. | 202 directives, but line is always reindented. |
185 | 203 |
186 Note that indentation of lines containing only comments is also | 204 Note that indentation of lines containing only comments is also |
187 controlled by the `vhdl-comment-only-line-offset' variable.") | 205 controlled by the `vhdl-comment-only-line-offset' variable." |
188 | 206 :type '(radio (const :tag "Always indent" t) |
189 (defvar vhdl-comment-only-line-offset 0 | 207 (const :tag "Indent if point in indentation" nil) |
208 (sexp :format "%t\n" | |
209 :tag "Insert if point within literals" other)) | |
210 :group 'vhdl) | |
211 | |
212 (defcustom vhdl-comment-only-line-offset 0 | |
190 "*Extra offset for line which contains only the start of a comment. | 213 "*Extra offset for line which contains only the start of a comment. |
191 Can contain an integer or a cons cell of the form: | 214 Can contain an integer or a cons cell of the form: |
192 | 215 |
193 (NON-ANCHORED-OFFSET . ANCHORED-OFFSET) | 216 (NON-ANCHORED-OFFSET . ANCHORED-OFFSET) |
194 | 217 |
195 Where NON-ANCHORED-OFFSET is the amount of offset given to | 218 Where NON-ANCHORED-OFFSET is the amount of offset given to |
196 non-column-zero anchored comment-only lines, and ANCHORED-OFFSET is | 219 non-column-zero anchored comment-only lines, and ANCHORED-OFFSET is |
197 the amount of offset to give column-zero anchored comment-only lines. | 220 the amount of offset to give column-zero anchored comment-only lines. |
198 Just an integer as value is equivalent to (<val> . 0)") | 221 Just an integer as value is equivalent to (<val> . 0)" |
199 | 222 :type '(choice integer |
200 (defvar vhdl-special-indent-hook nil | 223 (cons :value (0 . 0) |
224 (integer :tag "Non-anchored offset") | |
225 (integer :tag "Anchored offset"))) | |
226 :group 'vhdl) | |
227 | |
228 (defcustom vhdl-special-indent-hook nil | |
201 "*Hook for user defined special indentation adjustments. | 229 "*Hook for user defined special indentation adjustments. |
202 This hook gets called after a line is indented by the mode.") | 230 This hook gets called after a line is indented by the mode." |
231 :type 'hook | |
232 :group 'vhdl) | |
203 | 233 |
204 (defvar vhdl-style-alist | 234 (defvar vhdl-style-alist |
205 '(("IEEE" | 235 '(("IEEE" |
206 (vhdl-basic-offset . 4) | 236 (vhdl-basic-offset . 4) |
207 (vhdl-offsets-alist . ()) | 237 (vhdl-offsets-alist . ()) |
281 (error "Cannot figure out the major and minor version numbers.")) | 311 (error "Cannot figure out the major and minor version numbers.")) |
282 ;; calculate the major version | 312 ;; calculate the major version |
283 (cond | 313 (cond |
284 ((= major 18) (setq major 'v18)) ;Emacs 18 | 314 ((= major 18) (setq major 'v18)) ;Emacs 18 |
285 ((= major 4) (setq major 'v18)) ;Epoch 4 | 315 ((= major 4) (setq major 'v18)) ;Epoch 4 |
286 ((>= major 19) (setq major 'v19 ;Emacs 19 or later | 316 ((= major 19) (setq major 'v19 ;Emacs 19 |
287 flavor (cond | 317 flavor (cond |
288 ((string-match "Win-Emacs" emacs-version) | 318 ((string-match "Win-Emacs" emacs-version) |
289 'Win-Emacs) | 319 'Win-Emacs) |
290 ((or (string-match "Lucid" emacs-version) | 320 ((or (string-match "Lucid" emacs-version) |
291 (string-match "XEmacs" emacs-version)) | 321 (string-match "XEmacs" emacs-version)) |
292 'XEmacs) | 322 'XEmacs) |
293 (t | 323 (t |
294 'FSF)))) | 324 'FSF)))) |
325 ((>= major 20) (setq major 'v20 ;Emacs 20 or later | |
326 flavor (if (string-match "XEmacs" emacs-version) | |
327 'XEmacs | |
328 'FSF))) | |
295 ;; I don't know | 329 ;; I don't know |
296 (t (error "Cannot recognize major version number: %s" major))) | 330 (t (error "Cannot recognize major version number: %s" major))) |
297 ;; lets do some minimal sanity checking. | 331 ;; lets do some minimal sanity checking. |
298 (if (and (or | 332 (if (and (or |
299 ;; Emacs 18 is brain dead | 333 ;; Emacs 18 is brain dead |
535 ;; Main entry point for VHDL mode: | 569 ;; Main entry point for VHDL mode: |
536 | 570 |
537 ;;;###autoload | 571 ;;;###autoload |
538 (defun vhdl-mode () | 572 (defun vhdl-mode () |
539 "Major mode for editing VHDL code. | 573 "Major mode for editing VHDL code. |
540 vhdl-mode $Revision: 1.6 $ | 574 vhdl-mode $Revision: 1.7 $ |
541 To submit a problem report, enter `\\[vhdl-submit-bug-report]' from a | 575 To submit a problem report, enter `\\[vhdl-submit-bug-report]' from a |
542 vhdl-mode buffer. This automatically sets up a mail buffer with version | 576 vhdl-mode buffer. This automatically sets up a mail buffer with version |
543 information already added. You just need to add a description of the | 577 information already added. You just need to add a description of the |
544 problem, including a reproducable test case and send the message. | 578 problem, including a reproducable test case and send the message. |
545 | 579 |
742 ;; on the syntactic analysis list for the current | 776 ;; on the syntactic analysis list for the current |
743 ;; line | 777 ;; line |
744 (let* ((syntax (vhdl-get-syntactic-context)) | 778 (let* ((syntax (vhdl-get-syntactic-context)) |
745 (len (length syntax)) | 779 (len (length syntax)) |
746 (ic (format "%s" (car (nth (1- len) syntax))))) | 780 (ic (format "%s" (car (nth (1- len) syntax))))) |
747 (if (memq 'v19 vhdl-emacs-features) | 781 (if (or (memq 'v19 vhdl-emacs-features) |
782 (memq 'v20 vhdl-emacs-features)) | |
748 (cons ic 0) | 783 (cons ic 0) |
749 ic)) | 784 ic)) |
750 ))) | 785 ))) |
751 (offset (vhdl-read-offset langelem))) | 786 (offset (vhdl-read-offset langelem))) |
752 (list langelem offset current-prefix-arg))) | 787 (list langelem offset current-prefix-arg))) |
2560 (goto-char here) | 2595 (goto-char here) |
2561 )) | 2596 )) |
2562 | 2597 |
2563 ;; Support for Barry Warsaw's elp (emacs lisp profiler) package: | 2598 ;; Support for Barry Warsaw's elp (emacs lisp profiler) package: |
2564 | 2599 |
2600 (eval-when-compile | |
2601 (require 'elp)) | |
2602 | |
2565 (setq elp-all-instrumented-list nil) | 2603 (setq elp-all-instrumented-list nil) |
2566 (setq elp-function-list | 2604 (setq elp-function-list |
2567 '( | 2605 '( |
2568 vhdl-indent-command | 2606 vhdl-indent-command |
2569 vhdl-indent-line | 2607 vhdl-indent-line |
2611 (setq list (cdr list))))) | 2649 (setq list (cdr list))))) |
2612 | 2650 |
2613 | 2651 |
2614 ;; Defuns for submitting bug reports: | 2652 ;; Defuns for submitting bug reports: |
2615 | 2653 |
2616 (defconst vhdl-version "$Revision: 1.6 $" | 2654 (defconst vhdl-version "$Revision: 1.7 $" |
2617 "vhdl-mode version number.") | 2655 "vhdl-mode version number.") |
2618 (defconst vhdl-mode-help-address "rwhitby@geocities.com" | 2656 (defconst vhdl-mode-help-address "rwhitby@geocities.com" |
2619 "Address accepting submission of bug reports.") | 2657 "Address accepting submission of bug reports.") |
2620 | 2658 |
2621 (defun vhdl-version () | 2659 (defun vhdl-version () |