Mercurial > emacs
comparison lisp/progmodes/vhdl-mode.el @ 65302:c4e83cd72e41
Merge vhdl-mode.el version 3.33.6, from Reto Zimmermann <reto@gnu.org>.
author | Romain Francoise <romain@orebokech.com> |
---|---|
date | Wed, 31 Aug 2005 19:53:52 +0000 |
parents | 9c07af802d9a |
children | 6c488c4c11c6 |
comparison
equal
deleted
inserted
replaced
65301:c0c0b5bf96ab | 65302:c4e83cd72e41 |
---|---|
2 | 2 |
3 ;; Copyright (C) 1992-2003, 2004, 2005 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1992-2003, 2004, 2005 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Authors: Reto Zimmermann <reto@gnu.org> | 5 ;; Authors: Reto Zimmermann <reto@gnu.org> |
6 ;; Rodney J. Whitby <software.vhdl-mode@rwhitby.net> | 6 ;; Rodney J. Whitby <software.vhdl-mode@rwhitby.net> |
7 ;; Maintainer: FSF (Because Reto Zimmermann seems to have disappeared) | 7 ;; Maintainer: Reto Zimmermann <reto@gnu.org> |
8 ;; Keywords: languages vhdl | 8 ;; Keywords: languages vhdl |
9 | 9 ;; WWW: http://opensource.ethz.ch/emacs/vhdl-mode.html |
10 (defconst vhdl-version "3.32.12" | 10 |
11 (defconst vhdl-version "3.33.6" | |
11 "VHDL Mode version number.") | 12 "VHDL Mode version number.") |
12 | 13 |
13 (defconst vhdl-time-stamp "2003-02-28" | 14 (defconst vhdl-time-stamp "2005-08-30" |
14 "VHDL Mode time stamp for last update.") | 15 "VHDL Mode time stamp for last update.") |
15 | 16 |
16 ;; This file is part of GNU Emacs. | 17 ;; This file is part of GNU Emacs. |
17 | 18 |
18 ;; GNU Emacs is free software; you can redistribute it and/or modify | 19 ;; GNU Emacs is free software; you can redistribute it and/or modify |
41 ;; - Indentation | 42 ;; - Indentation |
42 ;; - Template insertion (electrification) | 43 ;; - Template insertion (electrification) |
43 ;; - Insertion of file headers | 44 ;; - Insertion of file headers |
44 ;; - Insertion of user-specified models | 45 ;; - Insertion of user-specified models |
45 ;; - Port translation / testbench generation | 46 ;; - Port translation / testbench generation |
47 ;; - Structural composition | |
48 ;; - Configuration generation | |
46 ;; - Sensitivity list updating | 49 ;; - Sensitivity list updating |
47 ;; - File browser | 50 ;; - File browser |
48 ;; - Design hierarchy browser | 51 ;; - Design hierarchy browser |
49 ;; - Source file compilation (syntax analysis) | 52 ;; - Source file compilation (syntax analysis) |
50 ;; - Makefile generation | 53 ;; - Makefile generation |
124 ;; XEmacs handling | 127 ;; XEmacs handling |
125 (defconst vhdl-xemacs (string-match "XEmacs" emacs-version) | 128 (defconst vhdl-xemacs (string-match "XEmacs" emacs-version) |
126 "Non-nil if XEmacs is used.") | 129 "Non-nil if XEmacs is used.") |
127 ;; Emacs 21+ handling | 130 ;; Emacs 21+ handling |
128 (defconst vhdl-emacs-21 (and (<= 21 emacs-major-version) (not vhdl-xemacs)) | 131 (defconst vhdl-emacs-21 (and (<= 21 emacs-major-version) (not vhdl-xemacs)) |
129 "Non-nil if Emacs 21, 22, ... is used.") | 132 "Non-nil if GNU Emacs 21, 22, ... is used.") |
133 (defconst vhdl-emacs-22 (and (<= 22 emacs-major-version) (not vhdl-xemacs)) | |
134 "Non-nil if GNU Emacs 22, ... is used.") | |
130 | 135 |
131 (defvar compilation-file-regexp-alist) | 136 (defvar compilation-file-regexp-alist) |
132 (defvar itimer-version) | 137 (defvar itimer-version) |
133 (defvar lazy-lock-defer-contextually) | 138 (defvar lazy-lock-defer-contextually) |
134 (defvar lazy-lock-defer-on-scrolling) | 139 (defvar lazy-lock-defer-on-scrolling) |
178 | 183 |
179 (defgroup vhdl nil | 184 (defgroup vhdl nil |
180 "Customizations for VHDL Mode." | 185 "Customizations for VHDL Mode." |
181 :prefix "vhdl-" | 186 :prefix "vhdl-" |
182 :group 'languages | 187 :group 'languages |
183 ; :version "20.4" ; comment out for XEmacs | 188 ; :version "21.2" ; comment out for XEmacs |
184 ) | 189 ) |
185 | 190 |
186 (defgroup vhdl-mode nil | 191 (defgroup vhdl-mode nil |
187 "Customizations for modes." | 192 "Customizations for modes." |
188 :group 'vhdl) | 193 :group 'vhdl) |
226 ;; ncvhdl_p: *E,IDENTU (test.vhd,13|25): identifier | 231 ;; ncvhdl_p: *E,IDENTU (test.vhd,13|25): identifier |
227 ;; (PLL_400X_TOP) is not declared [10.3]. | 232 ;; (PLL_400X_TOP) is not declared [10.3]. |
228 ("Cadence NC" "ncvhdl" "-work \\1" "make" "-f \\1" | 233 ("Cadence NC" "ncvhdl" "-work \\1" "make" "-f \\1" |
229 nil "mkdir \\1" "./" "work/" "Makefile" "ncvhdl" | 234 nil "mkdir \\1" "./" "work/" "Makefile" "ncvhdl" |
230 ("ncvhdl_p: \\*E,\\w+ (\\(.+\\),\\([0-9]+\\)|\\([0-9]+\\)):" 1 2 3) ("" 0) | 235 ("ncvhdl_p: \\*E,\\w+ (\\(.+\\),\\([0-9]+\\)|\\([0-9]+\\)):" 1 2 3) ("" 0) |
231 nil) | 236 ("\\1/entity/pc.db" "\\2/\\1/pc.db" "\\1/configuration/pc.db" |
237 "\\1/package/pc.db" "\\1/body/pc.db" downcase)) | |
232 ;; Ikos Voyager: analyze test.vhd | 238 ;; Ikos Voyager: analyze test.vhd |
233 ;; analyze test.vhd | 239 ;; analyze test.vhd |
234 ;; E L4/C5: this library unit is inaccessible | 240 ;; E L4/C5: this library unit is inaccessible |
235 ("Ikos" "analyze" "-l \\1" "make" "-f \\1" | 241 ("Ikos" "analyze" "-l \\1" "make" "-f \\1" |
236 nil "mkdir \\1" "./" "work/" "Makefile" "ikos" | 242 nil "mkdir \\1" "./" "work/" "Makefile" "ikos" |
341 Compile directory: where compilation is run and the Makefile is placed | 347 Compile directory: where compilation is run and the Makefile is placed |
342 Library directory: directory of default library | 348 Library directory: directory of default library |
343 Makefile name : name of Makefile (default is \"Makefile\") | 349 Makefile name : name of Makefile (default is \"Makefile\") |
344 ID string : compiler identification string (see `vhdl-project-alist') | 350 ID string : compiler identification string (see `vhdl-project-alist') |
345 Error message: | 351 Error message: |
346 Regexp : regular expression to match error messages | 352 Regexp : regular expression to match error messages (*) |
347 File subexp index: index of subexpression that matches the file name | 353 File subexp index: index of subexpression that matches the file name |
348 Line subexp index: index of subexpression that matches the line number | 354 Line subexp index: index of subexpression that matches the line number |
349 Column subexp idx: index of subexpression that matches the column number | 355 Column subexp idx: index of subexpression that matches the column number |
350 File message: | 356 File message: |
351 Regexp : regular expression to match a file name message | 357 Regexp : regular expression to match a file name message |
354 generated by the compiler (used for Makefile generation) | 360 generated by the compiler (used for Makefile generation) |
355 To string : string a name is mapped to (\"\\1\" inserts the unit name, | 361 To string : string a name is mapped to (\"\\1\" inserts the unit name, |
356 \"\\2\" inserts the entity name for architectures) | 362 \"\\2\" inserts the entity name for architectures) |
357 Case adjustment : adjust case of inserted unit names | 363 Case adjustment : adjust case of inserted unit names |
358 | 364 |
365 \(*) The regular expression must match the error message starting from the | |
366 beginning of the line (but not necessarily to the end of the line). | |
367 | |
359 Compile options allows insertion of the library name (see `vhdl-project-alist') | 368 Compile options allows insertion of the library name (see `vhdl-project-alist') |
360 in order to set the compilers library option (e.g. \"vcom -work my_lib\"). | 369 in order to set the compilers library option (e.g. \"vcom -work my_lib\"). |
361 | 370 |
362 For Makefile generation, the built-in function can be used (requires | 371 For Makefile generation, the built-in function can be used (requires |
363 specification of the unit-to-file name mapping). Alternatively, an | 372 specification of the unit-to-file name mapping). Alternatively, an |
383 assigning its name to option `vhdl-compiler'. | 392 assigning its name to option `vhdl-compiler'. |
384 | 393 |
385 Please send any missing or erroneous compiler properties to the maintainer for | 394 Please send any missing or erroneous compiler properties to the maintainer for |
386 updating. | 395 updating. |
387 | 396 |
388 NOTE: Reflect the new setting in the choice list of option `vhdl-compiler' | 397 NOTE: Activate new error and file message regexps and reflect the new setting |
389 by restarting Emacs." | 398 in the choice list of option `vhdl-compiler' by restarting Emacs." |
390 :type '(repeat | 399 :type '(repeat |
391 (list :tag "Compiler" :indent 2 | 400 (list :tag "Compiler" :indent 2 |
392 (string :tag "Compiler name ") | 401 (string :tag "Compiler name ") |
393 (string :tag "Compile command ") | 402 (string :tag "Compile command ") |
394 (string :tag "Compile options " "-work \\1") | 403 (string :tag "Compile options " "-work \\1") |
424 (choice :tag "Case adjustment " | 433 (choice :tag "Case adjustment " |
425 (const :tag "None" identity) | 434 (const :tag "None" identity) |
426 (const :tag "Upcase" upcase) | 435 (const :tag "Upcase" upcase) |
427 (const :tag "Downcase" downcase)))))) | 436 (const :tag "Downcase" downcase)))))) |
428 :set (lambda (variable value) | 437 :set (lambda (variable value) |
429 (vhdl-custom-set variable value 'vhdl-update-mode-menu)) | 438 (vhdl-custom-set variable value 'vhdl-update-mode-menu)) |
430 :group 'vhdl-compile) | 439 :group 'vhdl-compile) |
431 | 440 |
432 (defcustom vhdl-compiler "ModelSim" | 441 (defcustom vhdl-compiler "ModelSim" |
433 "*Specifies the VHDL compiler to be used for syntax analysis. | 442 "*Specifies the VHDL compiler to be used for syntax analysis. |
434 Select a compiler name from the ones defined in option `vhdl-compiler-alist'." | 443 Select a compiler name from the ones defined in option `vhdl-compiler-alist'." |
587 :validate vhdl-widget-directory-validate "work/") | 596 :validate vhdl-widget-directory-validate "work/") |
588 (file :tag "Makefile name " "Makefile") | 597 (file :tag "Makefile name " "Makefile") |
589 (string :tag "Description: (type `C-j' for newline)" | 598 (string :tag "Description: (type `C-j' for newline)" |
590 :format "%t\n%v\n"))) | 599 :format "%t\n%v\n"))) |
591 :set (lambda (variable value) | 600 :set (lambda (variable value) |
592 (vhdl-custom-set variable value | 601 (vhdl-custom-set variable value |
593 'vhdl-update-mode-menu | 602 'vhdl-update-mode-menu |
594 'vhdl-speedbar-refresh)) | 603 'vhdl-speedbar-refresh)) |
595 :group 'vhdl-project) | 604 :group 'vhdl-project) |
596 | 605 |
597 (defcustom vhdl-project nil | 606 (defcustom vhdl-project nil |
664 (const :tag "VHDL'93" 93)) | 673 (const :tag "VHDL'93" 93)) |
665 (set :tag "Additional standards" :indent 2 | 674 (set :tag "Additional standards" :indent 2 |
666 (const :tag "VHDL-AMS" ams) | 675 (const :tag "VHDL-AMS" ams) |
667 (const :tag "Math packages" math))) | 676 (const :tag "Math packages" math))) |
668 :set (lambda (variable value) | 677 :set (lambda (variable value) |
669 (vhdl-custom-set variable value | 678 (vhdl-custom-set variable value |
670 'vhdl-template-map-init | 679 'vhdl-template-map-init |
671 'vhdl-mode-abbrev-table-init | 680 'vhdl-mode-abbrev-table-init |
672 'vhdl-template-construct-alist-init | 681 'vhdl-template-construct-alist-init |
673 'vhdl-template-package-alist-init | 682 'vhdl-template-package-alist-init |
674 'vhdl-update-mode-menu | 683 'vhdl-update-mode-menu |
684 (defcustom vhdl-upper-case-keywords nil | 693 (defcustom vhdl-upper-case-keywords nil |
685 "*Non-nil means convert keywords to upper case. | 694 "*Non-nil means convert keywords to upper case. |
686 This is done when typed or expanded or by the fix case functions." | 695 This is done when typed or expanded or by the fix case functions." |
687 :type 'boolean | 696 :type 'boolean |
688 :set (lambda (variable value) | 697 :set (lambda (variable value) |
689 (vhdl-custom-set variable value 'vhdl-abbrev-list-init)) | 698 (vhdl-custom-set variable value 'vhdl-abbrev-list-init)) |
690 :group 'vhdl-style) | 699 :group 'vhdl-style) |
691 | 700 |
692 (defcustom vhdl-upper-case-types nil | 701 (defcustom vhdl-upper-case-types nil |
693 "*Non-nil means convert standardized types to upper case. | 702 "*Non-nil means convert standardized types to upper case. |
694 This is done when expanded or by the fix case functions." | 703 This is done when expanded or by the fix case functions." |
695 :type 'boolean | 704 :type 'boolean |
696 :set (lambda (variable value) | 705 :set (lambda (variable value) |
697 (vhdl-custom-set variable value 'vhdl-abbrev-list-init)) | 706 (vhdl-custom-set variable value 'vhdl-abbrev-list-init)) |
698 :group 'vhdl-style) | 707 :group 'vhdl-style) |
699 | 708 |
700 (defcustom vhdl-upper-case-attributes nil | 709 (defcustom vhdl-upper-case-attributes nil |
701 "*Non-nil means convert standardized attributes to upper case. | 710 "*Non-nil means convert standardized attributes to upper case. |
702 This is done when expanded or by the fix case functions." | 711 This is done when expanded or by the fix case functions." |
703 :type 'boolean | 712 :type 'boolean |
704 :set (lambda (variable value) | 713 :set (lambda (variable value) |
705 (vhdl-custom-set variable value 'vhdl-abbrev-list-init)) | 714 (vhdl-custom-set variable value 'vhdl-abbrev-list-init)) |
706 :group 'vhdl-style) | 715 :group 'vhdl-style) |
707 | 716 |
708 (defcustom vhdl-upper-case-enum-values nil | 717 (defcustom vhdl-upper-case-enum-values nil |
709 "*Non-nil means convert standardized enumeration values to upper case. | 718 "*Non-nil means convert standardized enumeration values to upper case. |
710 This is done when expanded or by the fix case functions." | 719 This is done when expanded or by the fix case functions." |
711 :type 'boolean | 720 :type 'boolean |
712 :set (lambda (variable value) | 721 :set (lambda (variable value) |
713 (vhdl-custom-set variable value 'vhdl-abbrev-list-init)) | 722 (vhdl-custom-set variable value 'vhdl-abbrev-list-init)) |
714 :group 'vhdl-style) | 723 :group 'vhdl-style) |
715 | 724 |
716 (defcustom vhdl-upper-case-constants t | 725 (defcustom vhdl-upper-case-constants t |
717 "*Non-nil means convert standardized constants to upper case. | 726 "*Non-nil means convert standardized constants to upper case. |
718 This is done when expanded." | 727 This is done when expanded." |
719 :type 'boolean | 728 :type 'boolean |
720 :set (lambda (variable value) | 729 :set (lambda (variable value) |
721 (vhdl-custom-set variable value 'vhdl-abbrev-list-init)) | 730 (vhdl-custom-set variable value 'vhdl-abbrev-list-init)) |
722 :group 'vhdl-style) | 731 :group 'vhdl-style) |
723 | 732 |
724 (defcustom vhdl-use-direct-instantiation 'standard | 733 (defcustom vhdl-use-direct-instantiation 'standard |
725 "*Non-nil means use VHDL'93 direct component instantiation. | 734 "*Non-nil means use VHDL'93 direct component instantiation. |
726 Never : never | 735 Never : never |
751 (defcustom vhdl-architecture-file-name '("\\(.*\\) \\(.*\\)" . "\\1_\\2") | 760 (defcustom vhdl-architecture-file-name '("\\(.*\\) \\(.*\\)" . "\\1_\\2") |
752 (concat | 761 (concat |
753 "*Specifies how the architecture file name is obtained. | 762 "*Specifies how the architecture file name is obtained. |
754 The architecture file name can be obtained by modifying the entity | 763 The architecture file name can be obtained by modifying the entity |
755 and/or architecture name (e.g. attaching or stripping off a substring). The | 764 and/or architecture name (e.g. attaching or stripping off a substring). The |
756 string that is matched against the regexp is the concatenation of the entity | 765 file extension is automatically taken from the file name of the current |
757 and the architecture name separated by a space. This gives access to both | 766 buffer. The string that is matched against the regexp is the concatenation |
758 names (see default setting as example)." | 767 of the entity and the architecture name separated by a space. This gives |
768 access to both names (see default setting as example)." | |
759 vhdl-name-doc-string) | 769 vhdl-name-doc-string) |
760 :type '(cons (regexp :tag "From regexp") | 770 :type '(cons (regexp :tag "From regexp") |
761 (string :tag "To string ")) | 771 (string :tag "To string ")) |
762 :group 'vhdl-naming | 772 :group 'vhdl-naming |
763 :group 'vhdl-compose) | 773 :group 'vhdl-compose) |
764 | 774 |
775 (defcustom vhdl-configuration-file-name '(".*" . "\\&") | |
776 (concat | |
777 "*Specifies how the configuration file name is obtained. | |
778 The configuration file name can be obtained by modifying the configuration | |
779 name (e.g. attaching or stripping off a substring). The file extension is | |
780 automatically taken from the file name of the current buffer." | |
781 vhdl-name-doc-string) | |
782 :type '(cons (regexp :tag "From regexp") | |
783 (string :tag "To string ")) | |
784 :group 'vhdl-naming | |
785 :group 'vhdl-compose) | |
786 | |
765 (defcustom vhdl-package-file-name '(".*" . "\\&") | 787 (defcustom vhdl-package-file-name '(".*" . "\\&") |
766 (concat | 788 (concat |
767 "*Specifies how the package file name is obtained. | 789 "*Specifies how the package file name is obtained. |
768 The package file name can be obtained by modifying the package name (e.g. | 790 The package file name can be obtained by modifying the package name (e.g. |
769 attaching or stripping off a substring). The file extension is automatically | 791 attaching or stripping off a substring). The file extension is automatically |
770 taken from the file name of the current buffer." | 792 taken from the file name of the current buffer. Package files can be created |
793 in a different directory by prepending a relative or absolute path to the | |
794 file name." | |
771 vhdl-name-doc-string) | 795 vhdl-name-doc-string) |
772 :type '(cons (regexp :tag "From regexp") | 796 :type '(cons (regexp :tag "From regexp") |
773 (string :tag "To string ")) | 797 (string :tag "To string ")) |
774 :group 'vhdl-naming | 798 :group 'vhdl-naming |
775 :group 'vhdl-compose) | 799 :group 'vhdl-compose) |
799 VHDL keywords: invoke built-in templates | 823 VHDL keywords: invoke built-in templates |
800 User keywords: invoke user models (see option `vhdl-model-alist')" | 824 User keywords: invoke user models (see option `vhdl-model-alist')" |
801 :type '(set (const :tag "VHDL keywords" vhdl) | 825 :type '(set (const :tag "VHDL keywords" vhdl) |
802 (const :tag "User model keywords" user)) | 826 (const :tag "User model keywords" user)) |
803 :set (lambda (variable value) | 827 :set (lambda (variable value) |
804 (vhdl-custom-set variable value 'vhdl-mode-abbrev-table-init)) | 828 (vhdl-custom-set variable value 'vhdl-mode-abbrev-table-init)) |
805 :group 'vhdl-template) | 829 :group 'vhdl-template) |
806 | 830 |
807 (defcustom vhdl-optional-labels 'process | 831 (defcustom vhdl-optional-labels 'process |
808 "*Constructs for which labels are to be queried. | 832 "*Constructs for which labels are to be queried. |
809 Template generators prompt for optional labels for: | 833 Template generators prompt for optional labels for: |
1033 begin -- process <label> | 1057 begin -- process <label> |
1034 if <reset> = '0' then -- asynchronous reset (active low) | 1058 if <reset> = '0' then -- asynchronous reset (active low) |
1035 <cursor> | 1059 <cursor> |
1036 elsif <clock>'event and <clock> = '1' then -- rising clock edge | 1060 elsif <clock>'event and <clock> = '1' then -- rising clock edge |
1037 if <enable> = '1' then -- synchronous load | 1061 if <enable> = '1' then -- synchronous load |
1038 | 1062 |
1039 end if; | 1063 end if; |
1040 end if; | 1064 end if; |
1041 end process <label>;" | 1065 end process <label>;" |
1042 "e" "")) | 1066 "e" "")) |
1043 "*List of user models. | 1067 "*List of user models. |
1073 (string :tag "String : (type `C-j' for newline)" | 1097 (string :tag "String : (type `C-j' for newline)" |
1074 :format "%t\n%v") | 1098 :format "%t\n%v") |
1075 (sexp :tag "Key binding" x) | 1099 (sexp :tag "Key binding" x) |
1076 (string :tag "Keyword " :format "%t: %v\n"))) | 1100 (string :tag "Keyword " :format "%t: %v\n"))) |
1077 :set (lambda (variable value) | 1101 :set (lambda (variable value) |
1078 (vhdl-custom-set variable value | 1102 (vhdl-custom-set variable value |
1079 'vhdl-model-map-init | 1103 'vhdl-model-map-init |
1080 'vhdl-model-defun | 1104 'vhdl-model-defun |
1081 'vhdl-mode-abbrev-table-init | 1105 'vhdl-mode-abbrev-table-init |
1082 'vhdl-update-mode-menu)) | 1106 'vhdl-update-mode-menu)) |
1083 :group 'vhdl-model) | 1107 :group 'vhdl-model) |
1084 | 1108 |
1085 | 1109 |
1086 (defgroup vhdl-port nil | 1110 (defgroup vhdl-compose nil |
1087 "Customizations for port translation functions." | 1111 "Customizations for structural composition." |
1088 :group 'vhdl | 1112 :group 'vhdl) |
1089 :group 'vhdl-compose) | 1113 |
1090 | 1114 (defcustom vhdl-compose-architecture-name '(".*" . "str") |
1091 (defcustom vhdl-include-port-comments nil | |
1092 "*Non-nil means include port comments when a port is pasted." | |
1093 :type 'boolean | |
1094 :group 'vhdl-port) | |
1095 | |
1096 (defcustom vhdl-include-direction-comments nil | |
1097 "*Non-nil means include port direction in instantiations as comments." | |
1098 :type 'boolean | |
1099 :group 'vhdl-port) | |
1100 | |
1101 (defcustom vhdl-include-type-comments nil | |
1102 "*Non-nil means include generic/port type in instantiations as comments." | |
1103 :type 'boolean | |
1104 :group 'vhdl-port) | |
1105 | |
1106 (defcustom vhdl-include-group-comments 'never | |
1107 "*Specifies whether to include group comments and spacings. | |
1108 The comments and empty lines between groups of ports are pasted: | |
1109 Never : never | |
1110 Declarations: in entity/component/constant/signal declarations only | |
1111 Always : also in generic/port maps" | |
1112 :type '(choice (const :tag "Never" never) | |
1113 (const :tag "Declarations" decl) | |
1114 (const :tag "Always" always)) | |
1115 :group 'vhdl-port) | |
1116 | |
1117 (defcustom vhdl-actual-port-name '(".*" . "\\&") | |
1118 (concat | 1115 (concat |
1119 "*Specifies how actual port names are obtained from formal port names. | 1116 "*Specifies how the component architecture name is obtained. |
1120 In a component instantiation, an actual port name can be obtained by | 1117 The component architecture name can be obtained by modifying the entity name |
1121 modifying the formal port name (e.g. attaching or stripping off a substring)." | 1118 \(e.g. attaching or stripping off a substring). |
1122 vhdl-name-doc-string) | |
1123 :type '(cons (regexp :tag "From regexp") | |
1124 (string :tag "To string ")) | |
1125 :group 'vhdl-port) | |
1126 | |
1127 (defcustom vhdl-instance-name '(".*" . "\\&_%d") | |
1128 (concat | |
1129 "*Specifies how an instance name is obtained. | |
1130 The instance name can be obtained by modifying the name of the component to be | |
1131 instantiated (e.g. attaching or stripping off a substring). \"%d\" is replaced | |
1132 by a unique number (starting with 1). | |
1133 If TO STRING is empty, the instance name is queried." | |
1134 vhdl-name-doc-string) | |
1135 :type '(cons (regexp :tag "From regexp") | |
1136 (string :tag "To string ")) | |
1137 :group 'vhdl-port) | |
1138 | |
1139 | |
1140 (defgroup vhdl-testbench nil | |
1141 "Customizations for testbench generation." | |
1142 :group 'vhdl-port) | |
1143 | |
1144 (defcustom vhdl-testbench-entity-name '(".*" . "\\&_tb") | |
1145 (concat | |
1146 "*Specifies how the testbench entity name is obtained. | |
1147 The entity name of a testbench can be obtained by modifying the name of | |
1148 the component to be tested (e.g. attaching or stripping off a substring)." | |
1149 vhdl-name-doc-string) | |
1150 :type '(cons (regexp :tag "From regexp") | |
1151 (string :tag "To string ")) | |
1152 :group 'vhdl-testbench) | |
1153 | |
1154 (defcustom vhdl-testbench-architecture-name '(".*" . "") | |
1155 (concat | |
1156 "*Specifies how the testbench architecture name is obtained. | |
1157 The testbench architecture name can be obtained by modifying the name of | |
1158 the component to be tested (e.g. attaching or stripping off a substring). | |
1159 If TO STRING is empty, the architecture name is queried." | 1119 If TO STRING is empty, the architecture name is queried." |
1160 vhdl-name-doc-string) | 1120 vhdl-name-doc-string) |
1161 :type '(cons (regexp :tag "From regexp") | 1121 :type '(cons (regexp :tag "From regexp") |
1162 (string :tag "To string ")) | 1122 (string :tag "To string ")) |
1163 :group 'vhdl-testbench) | 1123 :group 'vhdl-compose) |
1164 | 1124 |
1165 (defcustom vhdl-testbench-configuration-name | 1125 (defcustom vhdl-compose-configuration-name |
1166 '("\\(.*\\) \\(.*\\)" . "\\1_\\2_cfg") | 1126 '("\\(.*\\) \\(.*\\)" . "\\1_\\2_cfg") |
1167 (concat | 1127 (concat |
1168 "*Specifies how the testbench configuration name is obtained. | 1128 "*Specifies how the configuration name is obtained. |
1169 The configuration name of a testbench can be obtained by modifying the entity | 1129 The configuration name can be obtained by modifying the entity and/or |
1170 and/or architecture name (e.g. attaching or stripping off a substring). The | 1130 architecture name (e.g. attaching or stripping off a substring). The string |
1171 string that is matched against the regexp is the concatenation of the entity | 1131 that is matched against the regexp is the concatenation of the entity and the |
1172 and the architecture name separated by a space. This gives access to both | 1132 architecture name separated by a space. This gives access to both names (see |
1173 names (see default setting as example)." | 1133 default setting as example)." |
1174 vhdl-name-doc-string) | 1134 vhdl-name-doc-string) |
1175 :type '(cons (regexp :tag "From regexp") | 1135 :type '(cons (regexp :tag "From regexp") |
1176 (string :tag "To string ")) | 1136 (string :tag "To string ")) |
1177 :group 'vhdl-testbench) | 1137 :group 'vhdl-compose) |
1178 | 1138 |
1179 (defcustom vhdl-testbench-dut-name '(".*" . "DUT") | 1139 (defcustom vhdl-components-package-name |
1140 '((".*" . "\\&_components") . "components") | |
1180 (concat | 1141 (concat |
1181 "*Specifies how a DUT instance name is obtained. | 1142 "*Specifies how the name for the components package is obtained. |
1182 The design-under-test instance name (i.e. the component instantiated in the | 1143 The components package is a package containing all component declarations for |
1183 testbench) can be obtained by modifying the component name (e.g. attaching | 1144 the current design. It's name can be obtained by modifying the project name |
1184 or stripping off a substring)." | 1145 \(e.g. attaching or stripping off a substring). If no project is defined, the |
1146 DIRECTORY entry is chosen." | |
1185 vhdl-name-doc-string) | 1147 vhdl-name-doc-string) |
1186 :type '(cons (regexp :tag "From regexp") | 1148 :type '(cons (cons :tag "Project" :indent 2 |
1187 (string :tag "To string ")) | 1149 (regexp :tag "From regexp") |
1188 :group 'vhdl-testbench) | 1150 (string :tag "To string ")) |
1189 | 1151 (string :tag "Directory:\n String ")) |
1190 (defcustom vhdl-testbench-include-header t | 1152 :group 'vhdl-compose) |
1153 | |
1154 (defcustom vhdl-use-components-package nil | |
1155 "*Non-nil means use a separate components package for component declarations. | |
1156 Otherwise, component declarations are inserted and searched for in the | |
1157 architecture declarative parts." | |
1158 :type 'boolean | |
1159 :group 'vhdl-compose) | |
1160 | |
1161 (defcustom vhdl-compose-include-header t | |
1191 "*Non-nil means include a header in automatically generated files." | 1162 "*Non-nil means include a header in automatically generated files." |
1192 :type 'boolean | 1163 :type 'boolean |
1193 :group 'vhdl-testbench) | 1164 :group 'vhdl-compose) |
1194 | |
1195 (defcustom vhdl-testbench-declarations "\ | |
1196 -- clock | |
1197 signal Clk : std_logic := '1'; | |
1198 " | |
1199 "*String or file to be inserted in the testbench declarative part. | |
1200 If the string specifies an existing file name, the contents of the file is | |
1201 inserted, otherwise the string itself is inserted in the testbench | |
1202 architecture before the BEGIN keyword. | |
1203 Type `C-j' for newlines." | |
1204 :type 'string | |
1205 :group 'vhdl-testbench) | |
1206 | |
1207 (defcustom vhdl-testbench-statements "\ | |
1208 -- clock generation | |
1209 Clk <= not Clk after 10 ns; | |
1210 | |
1211 -- waveform generation | |
1212 WaveGen_Proc: process | |
1213 begin | |
1214 -- insert signal assignments here | |
1215 | |
1216 wait until Clk = '1'; | |
1217 end process WaveGen_Proc; | |
1218 " | |
1219 "*String or file to be inserted in the testbench statement part. | |
1220 If the string specifies an existing file name, the contents of the file is | |
1221 inserted, otherwise the string itself is inserted in the testbench | |
1222 architecture before the END keyword. | |
1223 Type `C-j' for newlines." | |
1224 :type 'string | |
1225 :group 'vhdl-testbench) | |
1226 | |
1227 (defcustom vhdl-testbench-initialize-signals nil | |
1228 "*Non-nil means initialize signals with `0' when declared in testbench." | |
1229 :type 'boolean | |
1230 :group 'vhdl-testbench) | |
1231 | |
1232 (defcustom vhdl-testbench-include-library t | |
1233 "*Non-nil means a library/use clause for std_logic_1164 is included." | |
1234 :type 'boolean | |
1235 :group 'vhdl-testbench) | |
1236 | |
1237 (defcustom vhdl-testbench-include-configuration t | |
1238 "*Non-nil means a testbench configuration is attached at the end." | |
1239 :type 'boolean | |
1240 :group 'vhdl-testbench) | |
1241 | |
1242 (defcustom vhdl-testbench-create-files 'single | |
1243 "*Specifies whether new files should be created for the testbench. | |
1244 testbench entity and architecture are inserted: | |
1245 None : in current buffer | |
1246 Single file : in new single file | |
1247 Separate files: in two separate files | |
1248 Note that the files have the same name as the contained design unit." | |
1249 :type '(choice (const :tag "None" none) | |
1250 (const :tag "Single file" single) | |
1251 (const :tag "Separate files" separate)) | |
1252 :group 'vhdl-testbench) | |
1253 | |
1254 | |
1255 (defgroup vhdl-compose nil | |
1256 "Customizations for structural composition." | |
1257 :group 'vhdl) | |
1258 | 1165 |
1259 (defcustom vhdl-compose-create-files 'single | 1166 (defcustom vhdl-compose-create-files 'single |
1260 "*Specifies whether new files should be created for the new component. | 1167 "*Specifies whether new files should be created for the new component. |
1261 The component's entity and architecture are inserted: | 1168 The component's entity and architecture are inserted: |
1262 None : in current buffer | 1169 None : in current buffer |
1267 :type '(choice (const :tag "None" none) | 1174 :type '(choice (const :tag "None" none) |
1268 (const :tag "Single file" single) | 1175 (const :tag "Single file" single) |
1269 (const :tag "Separate files" separate)) | 1176 (const :tag "Separate files" separate)) |
1270 :group 'vhdl-compose) | 1177 :group 'vhdl-compose) |
1271 | 1178 |
1272 (defcustom vhdl-compose-include-header t | 1179 (defcustom vhdl-compose-configuration-create-file nil |
1273 "*Non-nil means include a header in automatically generated files." | 1180 "*Specifies whether a new file should be created for the configuration. |
1181 If non-nil, a new file is created for the configuration. | |
1182 The file name is obtained from variable `vhdl-configuration-file-name'." | |
1274 :type 'boolean | 1183 :type 'boolean |
1275 :group 'vhdl-compose) | 1184 :group 'vhdl-compose) |
1276 | 1185 |
1277 (defcustom vhdl-compose-architecture-name '(".*" . "str") | 1186 (defcustom vhdl-compose-configuration-hierarchical t |
1187 "*Specifies whether hierarchical configurations should be created. | |
1188 If non-nil, automatically created configurations are hierarchical and include | |
1189 the whole hierarchy of subcomponents. Otherwise the configuration only | |
1190 includes one level of subcomponents." | |
1191 :type 'boolean | |
1192 :group 'vhdl-compose) | |
1193 | |
1194 (defcustom vhdl-compose-configuration-use-subconfiguration t | |
1195 "*Specifies whether subconfigurations should be used inside configurations. | |
1196 If non-nil, automatically created configurations use configurations in binding | |
1197 indications for subcomponents, if such configurations exist. Otherwise, | |
1198 entities are used in binding indications for subcomponents." | |
1199 :type 'boolean | |
1200 :group 'vhdl-compose) | |
1201 | |
1202 | |
1203 (defgroup vhdl-port nil | |
1204 "Customizations for port translation functions." | |
1205 :group 'vhdl | |
1206 :group 'vhdl-compose) | |
1207 | |
1208 (defcustom vhdl-include-port-comments nil | |
1209 "*Non-nil means include port comments when a port is pasted." | |
1210 :type 'boolean | |
1211 :group 'vhdl-port) | |
1212 | |
1213 (defcustom vhdl-include-direction-comments nil | |
1214 "*Non-nil means include port direction in instantiations as comments." | |
1215 :type 'boolean | |
1216 :group 'vhdl-port) | |
1217 | |
1218 (defcustom vhdl-include-type-comments nil | |
1219 "*Non-nil means include generic/port type in instantiations as comments." | |
1220 :type 'boolean | |
1221 :group 'vhdl-port) | |
1222 | |
1223 (defcustom vhdl-include-group-comments 'never | |
1224 "*Specifies whether to include group comments and spacings. | |
1225 The comments and empty lines between groups of ports are pasted: | |
1226 Never : never | |
1227 Declarations: in entity/component/constant/signal declarations only | |
1228 Always : also in generic/port maps" | |
1229 :type '(choice (const :tag "Never" never) | |
1230 (const :tag "Declarations" decl) | |
1231 (const :tag "Always" always)) | |
1232 :group 'vhdl-port) | |
1233 | |
1234 (defcustom vhdl-actual-port-name '(".*" . "\\&") | |
1278 (concat | 1235 (concat |
1279 "*Specifies how the component architecture name is obtained. | 1236 "*Specifies how actual port names are obtained from formal port names. |
1280 The component architecture name can be obtained by modifying the entity name | 1237 In a component instantiation, an actual port name can be obtained by |
1281 \(e.g. attaching or stripping off a substring). | 1238 modifying the formal port name (e.g. attaching or stripping off a substring)." |
1239 vhdl-name-doc-string) | |
1240 :type '(cons (regexp :tag "From regexp") | |
1241 (string :tag "To string ")) | |
1242 :group 'vhdl-port) | |
1243 | |
1244 (defcustom vhdl-instance-name '(".*" . "\\&_%d") | |
1245 (concat | |
1246 "*Specifies how an instance name is obtained. | |
1247 The instance name can be obtained by modifying the name of the component to be | |
1248 instantiated (e.g. attaching or stripping off a substring). \"%d\" is replaced | |
1249 by a unique number (starting with 1). | |
1250 If TO STRING is empty, the instance name is queried." | |
1251 vhdl-name-doc-string) | |
1252 :type '(cons (regexp :tag "From regexp") | |
1253 (string :tag "To string ")) | |
1254 :group 'vhdl-port) | |
1255 | |
1256 | |
1257 (defgroup vhdl-testbench nil | |
1258 "Customizations for testbench generation." | |
1259 :group 'vhdl-port) | |
1260 | |
1261 (defcustom vhdl-testbench-entity-name '(".*" . "\\&_tb") | |
1262 (concat | |
1263 "*Specifies how the testbench entity name is obtained. | |
1264 The entity name of a testbench can be obtained by modifying the name of | |
1265 the component to be tested (e.g. attaching or stripping off a substring)." | |
1266 vhdl-name-doc-string) | |
1267 :type '(cons (regexp :tag "From regexp") | |
1268 (string :tag "To string ")) | |
1269 :group 'vhdl-testbench) | |
1270 | |
1271 (defcustom vhdl-testbench-architecture-name '(".*" . "") | |
1272 (concat | |
1273 "*Specifies how the testbench architecture name is obtained. | |
1274 The testbench architecture name can be obtained by modifying the name of | |
1275 the component to be tested (e.g. attaching or stripping off a substring). | |
1282 If TO STRING is empty, the architecture name is queried." | 1276 If TO STRING is empty, the architecture name is queried." |
1283 vhdl-name-doc-string) | 1277 vhdl-name-doc-string) |
1284 :type '(cons (regexp :tag "From regexp") | 1278 :type '(cons (regexp :tag "From regexp") |
1285 (string :tag "To string ")) | 1279 (string :tag "To string ")) |
1286 :group 'vhdl-compose) | 1280 :group 'vhdl-testbench) |
1287 | 1281 |
1288 (defcustom vhdl-components-package-name | 1282 (defcustom vhdl-testbench-configuration-name vhdl-compose-configuration-name |
1289 '((".*" . "\\&_components") . "components") | |
1290 (concat | 1283 (concat |
1291 "*Specifies how the name for the components package is obtained. | 1284 "*Specifies how the testbench configuration name is obtained. |
1292 The components package is a package containing all component declarations for | 1285 The configuration name of a testbench can be obtained by modifying the entity |
1293 the current design. Its name can be obtained by modifying the project name | 1286 and/or architecture name (e.g. attaching or stripping off a substring). The |
1294 \(e.g. attaching or stripping off a substring). If no project is defined, the | 1287 string that is matched against the regexp is the concatenation of the entity |
1295 DIRECTORY entry is chosen." | 1288 and the architecture name separated by a space. This gives access to both |
1289 names (see default setting as example)." | |
1296 vhdl-name-doc-string) | 1290 vhdl-name-doc-string) |
1297 :type '(cons (cons :tag "Project" :indent 2 | 1291 :type '(cons (regexp :tag "From regexp") |
1298 (regexp :tag "From regexp") | 1292 (string :tag "To string ")) |
1299 (string :tag "To string ")) | 1293 :group 'vhdl-testbench) |
1300 (string :tag "Directory:\n String ")) | 1294 |
1301 :group 'vhdl-compose) | 1295 (defcustom vhdl-testbench-dut-name '(".*" . "DUT") |
1302 | 1296 (concat |
1303 (defcustom vhdl-use-components-package nil | 1297 "*Specifies how a DUT instance name is obtained. |
1304 "*Non-nil means use a separate components package for component declarations. | 1298 The design-under-test instance name (i.e. the component instantiated in the |
1305 Otherwise, component declarations are inserted and searched for in the | 1299 testbench) can be obtained by modifying the component name (e.g. attaching |
1306 architecture declarative parts." | 1300 or stripping off a substring)." |
1301 vhdl-name-doc-string) | |
1302 :type '(cons (regexp :tag "From regexp") | |
1303 (string :tag "To string ")) | |
1304 :group 'vhdl-testbench) | |
1305 | |
1306 (defcustom vhdl-testbench-include-header t | |
1307 "*Non-nil means include a header in automatically generated files." | |
1307 :type 'boolean | 1308 :type 'boolean |
1308 :group 'vhdl-compose) | 1309 :group 'vhdl-testbench) |
1310 | |
1311 (defcustom vhdl-testbench-declarations "\ | |
1312 -- clock | |
1313 signal Clk : std_logic := '1'; | |
1314 " | |
1315 "*String or file to be inserted in the testbench declarative part. | |
1316 If the string specifies an existing file name, the contents of the file is | |
1317 inserted, otherwise the string itself is inserted in the testbench | |
1318 architecture before the BEGIN keyword. | |
1319 Type `C-j' for newlines." | |
1320 :type 'string | |
1321 :group 'vhdl-testbench) | |
1322 | |
1323 (defcustom vhdl-testbench-statements "\ | |
1324 -- clock generation | |
1325 Clk <= not Clk after 10 ns; | |
1326 | |
1327 -- waveform generation | |
1328 WaveGen_Proc: process | |
1329 begin | |
1330 -- insert signal assignments here | |
1331 | |
1332 wait until Clk = '1'; | |
1333 end process WaveGen_Proc; | |
1334 " | |
1335 "*String or file to be inserted in the testbench statement part. | |
1336 If the string specifies an existing file name, the contents of the file is | |
1337 inserted, otherwise the string itself is inserted in the testbench | |
1338 architecture before the END keyword. | |
1339 Type `C-j' for newlines." | |
1340 :type 'string | |
1341 :group 'vhdl-testbench) | |
1342 | |
1343 (defcustom vhdl-testbench-initialize-signals nil | |
1344 "*Non-nil means initialize signals with `0' when declared in testbench." | |
1345 :type 'boolean | |
1346 :group 'vhdl-testbench) | |
1347 | |
1348 (defcustom vhdl-testbench-include-library t | |
1349 "*Non-nil means a library/use clause for std_logic_1164 is included." | |
1350 :type 'boolean | |
1351 :group 'vhdl-testbench) | |
1352 | |
1353 (defcustom vhdl-testbench-include-configuration t | |
1354 "*Non-nil means a testbench configuration is attached at the end." | |
1355 :type 'boolean | |
1356 :group 'vhdl-testbench) | |
1357 | |
1358 (defcustom vhdl-testbench-create-files 'single | |
1359 "*Specifies whether new files should be created for the testbench. | |
1360 testbench entity and architecture are inserted: | |
1361 None : in current buffer | |
1362 Single file : in new single file | |
1363 Separate files: in two separate files | |
1364 The file names are obtained from variables `vhdl-testbench-entity-file-name' | |
1365 and `vhdl-testbench-architecture-file-name'." | |
1366 :type '(choice (const :tag "None" none) | |
1367 (const :tag "Single file" single) | |
1368 (const :tag "Separate files" separate)) | |
1369 :group 'vhdl-testbench) | |
1370 | |
1371 (defcustom vhdl-testbench-entity-file-name vhdl-entity-file-name | |
1372 (concat | |
1373 "*Specifies how the testbench entity file name is obtained. | |
1374 The entity file name can be obtained by modifying the testbench entity name | |
1375 \(e.g. attaching or stripping off a substring). The file extension is | |
1376 automatically taken from the file name of the current buffer. Testbench | |
1377 files can be created in a different directory by prepending a relative or | |
1378 absolute path to the file name." | |
1379 vhdl-name-doc-string) | |
1380 :type '(cons (regexp :tag "From regexp") | |
1381 (string :tag "To string ")) | |
1382 :group 'vhdl-testbench) | |
1383 | |
1384 (defcustom vhdl-testbench-architecture-file-name vhdl-architecture-file-name | |
1385 (concat | |
1386 "*Specifies how the testbench architecture file name is obtained. | |
1387 The architecture file name can be obtained by modifying the testbench entity | |
1388 and/or architecture name (e.g. attaching or stripping off a substring). The | |
1389 string that is matched against the regexp is the concatenation of the entity | |
1390 and the architecture name separated by a space. This gives access to both | |
1391 names (see default setting as example). Testbench files can be created in | |
1392 a different directory by prepending a relative or absolute path to the file | |
1393 name." | |
1394 vhdl-name-doc-string) | |
1395 :type '(cons (regexp :tag "From regexp") | |
1396 (string :tag "To string ")) | |
1397 :group 'vhdl-testbench) | |
1309 | 1398 |
1310 | 1399 |
1311 (defgroup vhdl-comment nil | 1400 (defgroup vhdl-comment nil |
1312 "Customizations for comments." | 1401 "Customizations for comments." |
1313 :group 'vhdl) | 1402 :group 'vhdl) |
1382 :group 'vhdl) | 1471 :group 'vhdl) |
1383 | 1472 |
1384 (defcustom vhdl-highlight-keywords t | 1473 (defcustom vhdl-highlight-keywords t |
1385 "*Non-nil means highlight VHDL keywords and other standardized words. | 1474 "*Non-nil means highlight VHDL keywords and other standardized words. |
1386 The following faces are used: | 1475 The following faces are used: |
1387 `font-lock-keyword-face' : keywords | 1476 `font-lock-keyword-face' : keywords |
1388 `font-lock-type' : standardized types | 1477 `font-lock-type-face' : standardized types |
1389 `vhdl-attribute' : standardized attributes | 1478 `vhdl-font-lock-attribute-face': standardized attributes |
1390 `vhdl-enumvalue' : standardized enumeration values | 1479 `vhdl-font-lock-enumvalue-face': standardized enumeration values |
1391 `vhdl-function' : standardized function and package names | 1480 `vhdl-font-lock-function-face' : standardized function and package names |
1392 | 1481 |
1393 NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu | 1482 NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu |
1394 entry \"Fontify Buffer\")." | 1483 entry \"Fontify Buffer\")." |
1395 :type 'boolean | 1484 :type 'boolean |
1396 :set (lambda (variable value) | 1485 :set (lambda (variable value) |
1397 (vhdl-custom-set variable value 'vhdl-font-lock-init)) | 1486 (vhdl-custom-set variable value 'vhdl-font-lock-init)) |
1398 :group 'vhdl-highlight) | 1487 :group 'vhdl-highlight) |
1399 | 1488 |
1400 (defcustom vhdl-highlight-names t | 1489 (defcustom vhdl-highlight-names t |
1401 "*Non-nil means highlight declaration names and construct labels. | 1490 "*Non-nil means highlight declaration names and construct labels. |
1402 The following faces are used: | 1491 The following faces are used: |
1403 `font-lock-function-name-face' : names in declarations of units, | 1492 `font-lock-function-name-face' : names in declarations of units, |
1404 subprograms, components, as well as labels of VHDL constructs | 1493 subprograms, components, as well as labels of VHDL constructs |
1405 `font-lock-type-face' : names in type/nature declarations | 1494 `font-lock-type-face' : names in type/nature declarations |
1406 `vhdl-attribute' : names in attribute declarations | 1495 `vhdl-font-lock-attribute-face': names in attribute declarations |
1407 `font-lock-variable-name-face' : names in declarations of signals, | 1496 `font-lock-variable-name-face' : names in declarations of signals, |
1408 variables, constants, subprogram parameters, generics, and ports | 1497 variables, constants, subprogram parameters, generics, and ports |
1409 | 1498 |
1410 NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu | 1499 NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu |
1411 entry \"Fontify Buffer\")." | 1500 entry \"Fontify Buffer\")." |
1412 :type 'boolean | 1501 :type 'boolean |
1413 :set (lambda (variable value) | 1502 :set (lambda (variable value) |
1414 (vhdl-custom-set variable value 'vhdl-font-lock-init)) | 1503 (vhdl-custom-set variable value 'vhdl-font-lock-init)) |
1415 :group 'vhdl-highlight) | 1504 :group 'vhdl-highlight) |
1416 | 1505 |
1417 (defcustom vhdl-highlight-special-words nil | 1506 (defcustom vhdl-highlight-special-words nil |
1418 "*Non-nil means highlight words with special syntax. | 1507 "*Non-nil means highlight words with special syntax. |
1419 The words with syntax and color specified in option `vhdl-special-syntax-alist' | 1508 The words with syntax and color specified in option `vhdl-special-syntax-alist' |
1422 | 1511 |
1423 NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu | 1512 NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu |
1424 entry \"Fontify Buffer\")." | 1513 entry \"Fontify Buffer\")." |
1425 :type 'boolean | 1514 :type 'boolean |
1426 :set (lambda (variable value) | 1515 :set (lambda (variable value) |
1427 (vhdl-custom-set variable value 'vhdl-font-lock-init)) | 1516 (vhdl-custom-set variable value 'vhdl-font-lock-init)) |
1428 :group 'vhdl-highlight) | 1517 :group 'vhdl-highlight) |
1429 | 1518 |
1430 (defcustom vhdl-highlight-forbidden-words nil | 1519 (defcustom vhdl-highlight-forbidden-words nil |
1431 "*Non-nil means highlight forbidden words. | 1520 "*Non-nil means highlight forbidden words. |
1432 The reserved words specified in option `vhdl-forbidden-words' or having the | 1521 The reserved words specified in option `vhdl-forbidden-words' or having the |
1433 syntax specified in option `vhdl-forbidden-syntax' are highlighted in a | 1522 syntax specified in option `vhdl-forbidden-syntax' are highlighted in a |
1434 warning color (face `vhdl-reserved-word') to indicate not to | 1523 warning color (face `vhdl-font-lock-reserved-words-face') to indicate not to |
1435 use them. | 1524 use them. |
1436 | 1525 |
1437 NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu | 1526 NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu |
1438 entry \"Fontify Buffer\")." | 1527 entry \"Fontify Buffer\")." |
1439 :type 'boolean | 1528 :type 'boolean |
1440 :set (lambda (variable value) | 1529 :set (lambda (variable value) |
1441 (vhdl-custom-set variable value | 1530 (vhdl-custom-set variable value |
1442 'vhdl-words-init 'vhdl-font-lock-init)) | 1531 'vhdl-words-init 'vhdl-font-lock-init)) |
1443 :group 'vhdl-highlight) | 1532 :group 'vhdl-highlight) |
1444 | 1533 |
1445 (defcustom vhdl-highlight-verilog-keywords nil | 1534 (defcustom vhdl-highlight-verilog-keywords nil |
1446 "*Non-nil means highlight Verilog keywords as reserved words. | 1535 "*Non-nil means highlight Verilog keywords as reserved words. |
1447 Verilog keywords are highlighted in a warning color (face | 1536 Verilog keywords are highlighted in a warning color (face |
1448 `vhdl-reserved-word') to indicate not to use them. | 1537 `vhdl-font-lock-reserved-words-face') to indicate not to use them. |
1449 | 1538 |
1450 NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu | 1539 NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu |
1451 entry \"Fontify Buffer\")." | 1540 entry \"Fontify Buffer\")." |
1452 :type 'boolean | 1541 :type 'boolean |
1453 :set (lambda (variable value) | 1542 :set (lambda (variable value) |
1454 (vhdl-custom-set variable value | 1543 (vhdl-custom-set variable value |
1455 'vhdl-words-init 'vhdl-font-lock-init)) | 1544 'vhdl-words-init 'vhdl-font-lock-init)) |
1456 :group 'vhdl-highlight) | 1545 :group 'vhdl-highlight) |
1457 | 1546 |
1458 (defcustom vhdl-highlight-translate-off nil | 1547 (defcustom vhdl-highlight-translate-off nil |
1459 "*Non-nil means background-highlight code excluded from translation. | 1548 "*Non-nil means background-highlight code excluded from translation. |
1460 That is, all code between \"-- pragma translate_off\" and | 1549 That is, all code between \"-- pragma translate_off\" and |
1461 \"-- pragma translate_on\" is highlighted using a different background color | 1550 \"-- pragma translate_on\" is highlighted using a different background color |
1462 \(face `vhdl-translate-off'). | 1551 \(face `vhdl-font-lock-translate-off-face'). |
1463 Note: this might slow down on-the-fly fontification (and thus editing). | 1552 Note: this might slow down on-the-fly fontification (and thus editing). |
1464 | 1553 |
1465 NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu | 1554 NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu |
1466 entry \"Fontify Buffer\")." | 1555 entry \"Fontify Buffer\")." |
1467 :type 'boolean | 1556 :type 'boolean |
1468 :set (lambda (variable value) | 1557 :set (lambda (variable value) |
1469 (vhdl-custom-set variable value 'vhdl-font-lock-init)) | 1558 (vhdl-custom-set variable value 'vhdl-font-lock-init)) |
1470 :group 'vhdl-highlight) | 1559 :group 'vhdl-highlight) |
1471 | 1560 |
1472 (defcustom vhdl-highlight-case-sensitive nil | 1561 (defcustom vhdl-highlight-case-sensitive nil |
1473 "*Non-nil means consider case for highlighting. | 1562 "*Non-nil means consider case for highlighting. |
1474 Possible trade-off: | 1563 Possible trade-off: |
1504 Can be used for visual support of naming conventions, such as highlighting | 1593 Can be used for visual support of naming conventions, such as highlighting |
1505 different kinds of signals (e.g. \"Clk50\", \"Rst_n\") or objects (e.g. | 1594 different kinds of signals (e.g. \"Clk50\", \"Rst_n\") or objects (e.g. |
1506 \"Signal_s\", \"Variable_v\", \"Constant_c\") by distinguishing them using | 1595 \"Signal_s\", \"Variable_v\", \"Constant_c\") by distinguishing them using |
1507 common substrings or name suffices. | 1596 common substrings or name suffices. |
1508 For each entry, a new face is generated with the specified colors and name | 1597 For each entry, a new face is generated with the specified colors and name |
1509 \"vhdl-\" + name. | 1598 \"vhdl-font-lock-\" + name + \"-face\". |
1510 | 1599 |
1511 NOTE: Activate a changed regexp in a VHDL buffer by re-fontifying it (menu | 1600 NOTE: Activate a changed regexp in a VHDL buffer by re-fontifying it (menu |
1512 entry \"Fontify Buffer\"). All other changes require restarting Emacs." | 1601 entry \"Fontify Buffer\"). All other changes require restarting Emacs." |
1513 :type '(repeat (list :tag "Face" :indent 2 | 1602 :type '(repeat (list :tag "Face" :indent 2 |
1514 (string :tag "Name ") | 1603 (string :tag "Name ") |
1515 (regexp :tag "Regexp " "\\w+_") | 1604 (regexp :tag "Regexp " "\\w+_") |
1516 (string :tag "Color (light)") | 1605 (string :tag "Color (light)") |
1517 (string :tag "Color (dark) "))) | 1606 (string :tag "Color (dark) "))) |
1518 :set (lambda (variable value) | 1607 :set (lambda (variable value) |
1519 (vhdl-custom-set variable value 'vhdl-font-lock-init)) | 1608 (vhdl-custom-set variable value 'vhdl-font-lock-init)) |
1520 :group 'vhdl-highlight) | 1609 :group 'vhdl-highlight) |
1521 | 1610 |
1522 (defcustom vhdl-forbidden-words '() | 1611 (defcustom vhdl-forbidden-words '() |
1523 "*List of forbidden words to be highlighted. | 1612 "*List of forbidden words to be highlighted. |
1524 If option `vhdl-highlight-forbidden-words' is non-nil, these reserved | 1613 If option `vhdl-highlight-forbidden-words' is non-nil, these reserved |
1526 | 1615 |
1527 NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu | 1616 NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu |
1528 entry \"Fontify Buffer\")." | 1617 entry \"Fontify Buffer\")." |
1529 :type '(repeat (string :format "%v")) | 1618 :type '(repeat (string :format "%v")) |
1530 :set (lambda (variable value) | 1619 :set (lambda (variable value) |
1531 (vhdl-custom-set variable value | 1620 (vhdl-custom-set variable value |
1532 'vhdl-words-init 'vhdl-font-lock-init)) | 1621 'vhdl-words-init 'vhdl-font-lock-init)) |
1533 :group 'vhdl-highlight) | 1622 :group 'vhdl-highlight) |
1534 | 1623 |
1535 (defcustom vhdl-forbidden-syntax "" | 1624 (defcustom vhdl-forbidden-syntax "" |
1536 "*Syntax of forbidden words to be highlighted. | 1625 "*Syntax of forbidden words to be highlighted. |
1541 | 1630 |
1542 NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu | 1631 NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu |
1543 entry \"Fontify Buffer\")." | 1632 entry \"Fontify Buffer\")." |
1544 :type 'regexp | 1633 :type 'regexp |
1545 :set (lambda (variable value) | 1634 :set (lambda (variable value) |
1546 (vhdl-custom-set variable value | 1635 (vhdl-custom-set variable value |
1547 'vhdl-words-init 'vhdl-font-lock-init)) | 1636 'vhdl-words-init 'vhdl-font-lock-init)) |
1548 :group 'vhdl-highlight) | 1637 :group 'vhdl-highlight) |
1549 | 1638 |
1550 (defcustom vhdl-directive-keywords '("pragma" "synopsys") | 1639 (defcustom vhdl-directive-keywords '("pragma" "synopsys") |
1551 "*List of compiler directive keywords recognized for highlighting. | 1640 "*List of compiler directive keywords recognized for highlighting. |
1737 | 1826 |
1738 NOTE: Activate the new setting in a VHDL buffer by using the menu entry | 1827 NOTE: Activate the new setting in a VHDL buffer by using the menu entry |
1739 \"Activate Options\"." | 1828 \"Activate Options\"." |
1740 :type 'boolean | 1829 :type 'boolean |
1741 :set (lambda (variable value) | 1830 :set (lambda (variable value) |
1742 (vhdl-custom-set variable value 'vhdl-mode-syntax-table-init)) | 1831 (vhdl-custom-set variable value 'vhdl-mode-syntax-table-init)) |
1743 :group 'vhdl-misc) | 1832 :group 'vhdl-misc) |
1744 | 1833 |
1745 | 1834 |
1746 (defgroup vhdl-related nil | 1835 (defgroup vhdl-related nil |
1747 "Related general customizations." | 1836 "Related general customizations." |
1783 | 1872 |
1784 (defvar vhdl-echo-syntactic-information-p nil | 1873 (defvar vhdl-echo-syntactic-information-p nil |
1785 "*If non-nil, syntactic info is echoed when the line is indented.") | 1874 "*If non-nil, syntactic info is echoed when the line is indented.") |
1786 | 1875 |
1787 (defconst vhdl-offsets-alist-default | 1876 (defconst vhdl-offsets-alist-default |
1788 '((string . -1000) | 1877 '((string . -1000) |
1789 (block-open . 0) | 1878 (cpp-macro . -1000) |
1790 (block-close . 0) | 1879 (block-open . 0) |
1791 (statement . 0) | 1880 (block-close . 0) |
1792 (statement-cont . vhdl-lineup-statement-cont) | 1881 (statement . 0) |
1882 (statement-cont . vhdl-lineup-statement-cont) | |
1793 (statement-block-intro . +) | 1883 (statement-block-intro . +) |
1794 (statement-case-intro . +) | 1884 (statement-case-intro . +) |
1795 (case-alternative . +) | 1885 (case-alternative . +) |
1796 (comment . vhdl-lineup-comment) | 1886 (comment . vhdl-lineup-comment) |
1797 (arglist-intro . +) | 1887 (arglist-intro . +) |
1798 (arglist-cont . 0) | 1888 (arglist-cont . 0) |
1799 (arglist-cont-nonempty . vhdl-lineup-arglist) | 1889 (arglist-cont-nonempty . vhdl-lineup-arglist) |
1800 (arglist-close . vhdl-lineup-arglist) | 1890 (arglist-close . vhdl-lineup-arglist) |
1801 (entity . 0) | 1891 (entity . 0) |
1802 (configuration . 0) | 1892 (configuration . 0) |
1803 (package . 0) | 1893 (package . 0) |
1804 (architecture . 0) | 1894 (architecture . 0) |
1805 (package-body . 0) | 1895 (package-body . 0) |
1806 ) | 1896 ) |
1807 "Default settings for offsets of syntactic elements. | 1897 "Default settings for offsets of syntactic elements. |
1808 Do not change this constant! See the variable `vhdl-offsets-alist' for | 1898 Do not change this constant! See the variable `vhdl-offsets-alist' for |
1809 more information.") | 1899 more information.") |
1810 | 1900 |
2033 this-dir-contents) | 2123 this-dir-contents) |
2034 this-dir-contents) | 2124 this-dir-contents) |
2035 contents)))) | 2125 contents)))) |
2036 (setq dirs (cdr dirs))) | 2126 (setq dirs (cdr dirs))) |
2037 contents))) | 2127 contents))) |
2128 | |
2129 ;; `member-ignore-case' undefined (XEmacs) | |
2130 (unless (fboundp 'member-ignore-case) | |
2131 (defalias 'member-ignore-case 'member)) | |
2038 | 2132 |
2039 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 2133 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2040 ;; Compatibility with older VHDL Mode versions | 2134 ;; Compatibility with older VHDL Mode versions |
2041 | 2135 |
2042 (defvar vhdl-warnings nil | 2136 (defvar vhdl-warnings nil |
2573 | 2667 |
2574 (defun vhdl-mode-map-init () | 2668 (defun vhdl-mode-map-init () |
2575 "Initialize `vhdl-mode-map'." | 2669 "Initialize `vhdl-mode-map'." |
2576 (setq vhdl-mode-map (make-sparse-keymap)) | 2670 (setq vhdl-mode-map (make-sparse-keymap)) |
2577 ;; template key bindings | 2671 ;; template key bindings |
2578 (define-key vhdl-mode-map "\C-c\C-t" vhdl-template-map) | 2672 (define-key vhdl-mode-map "\C-c\C-t" vhdl-template-map) |
2579 ;; model key bindings | 2673 ;; model key bindings |
2580 (define-key vhdl-mode-map "\C-c\C-m" vhdl-model-map) | 2674 (define-key vhdl-mode-map "\C-c\C-m" vhdl-model-map) |
2581 ;; standard key bindings | 2675 ;; standard key bindings |
2582 (define-key vhdl-mode-map "\M-a" 'vhdl-beginning-of-statement) | 2676 (define-key vhdl-mode-map "\M-a" 'vhdl-beginning-of-statement) |
2583 (define-key vhdl-mode-map "\M-e" 'vhdl-end-of-statement) | 2677 (define-key vhdl-mode-map "\M-e" 'vhdl-end-of-statement) |
2584 (define-key vhdl-mode-map "\M-\C-f" 'vhdl-forward-sexp) | 2678 (define-key vhdl-mode-map "\M-\C-f" 'vhdl-forward-sexp) |
2585 (define-key vhdl-mode-map "\M-\C-b" 'vhdl-backward-sexp) | 2679 (define-key vhdl-mode-map "\M-\C-b" 'vhdl-backward-sexp) |
2586 (define-key vhdl-mode-map "\M-\C-u" 'vhdl-backward-up-list) | 2680 (define-key vhdl-mode-map "\M-\C-u" 'vhdl-backward-up-list) |
2587 (define-key vhdl-mode-map "\M-\C-a" 'vhdl-backward-same-indent) | 2681 (define-key vhdl-mode-map "\M-\C-a" 'vhdl-backward-same-indent) |
2588 (define-key vhdl-mode-map "\M-\C-e" 'vhdl-forward-same-indent) | 2682 (define-key vhdl-mode-map "\M-\C-e" 'vhdl-forward-same-indent) |
2589 (unless vhdl-xemacs ; would override `M-backspace' in XEmacs | 2683 (unless vhdl-xemacs ; would override `M-backspace' in XEmacs |
2590 (define-key vhdl-mode-map "\M-\C-h" 'vhdl-mark-defun)) | 2684 (define-key vhdl-mode-map "\M-\C-h" 'vhdl-mark-defun)) |
2591 (define-key vhdl-mode-map "\M-\C-q" 'vhdl-indent-sexp) | 2685 (define-key vhdl-mode-map "\M-\C-q" 'vhdl-indent-sexp) |
2592 (define-key vhdl-mode-map "\M-^" 'vhdl-delete-indentation) | 2686 (define-key vhdl-mode-map "\M-^" 'vhdl-delete-indentation) |
2593 ;; backspace/delete key bindings | 2687 ;; backspace/delete key bindings |
2594 (define-key vhdl-mode-map [backspace] 'backward-delete-char-untabify) | 2688 (define-key vhdl-mode-map [backspace] 'backward-delete-char-untabify) |
2595 (unless (boundp 'delete-key-deletes-forward) ; XEmacs variable | 2689 (unless (boundp 'delete-key-deletes-forward) ; XEmacs variable |
2596 (define-key vhdl-mode-map [delete] 'delete-char) | 2690 (define-key vhdl-mode-map [delete] 'delete-char) |
2597 (define-key vhdl-mode-map [(meta delete)] 'kill-word)) | 2691 (define-key vhdl-mode-map [(meta delete)] 'kill-word)) |
2598 ;; mode specific key bindings | 2692 ;; mode specific key bindings |
2599 (define-key vhdl-mode-map "\C-c\C-m\C-e" 'vhdl-electric-mode) | 2693 (define-key vhdl-mode-map "\C-c\C-m\C-e" 'vhdl-electric-mode) |
2600 (define-key vhdl-mode-map "\C-c\C-m\C-s" 'vhdl-stutter-mode) | 2694 (define-key vhdl-mode-map "\C-c\C-m\C-s" 'vhdl-stutter-mode) |
2601 (define-key vhdl-mode-map "\C-c\C-s\C-p" 'vhdl-set-project) | 2695 (define-key vhdl-mode-map "\C-c\C-s\C-p" 'vhdl-set-project) |
2602 (define-key vhdl-mode-map "\C-c\C-p\C-d" 'vhdl-duplicate-project) | 2696 (define-key vhdl-mode-map "\C-c\C-p\C-d" 'vhdl-duplicate-project) |
2603 (define-key vhdl-mode-map "\C-c\C-p\C-m" 'vhdl-import-project) | 2697 (define-key vhdl-mode-map "\C-c\C-p\C-m" 'vhdl-import-project) |
2604 (define-key vhdl-mode-map "\C-c\C-p\C-x" 'vhdl-export-project) | 2698 (define-key vhdl-mode-map "\C-c\C-p\C-x" 'vhdl-export-project) |
2605 (define-key vhdl-mode-map "\C-c\C-s\C-k" 'vhdl-set-compiler) | 2699 (define-key vhdl-mode-map "\C-c\C-s\C-k" 'vhdl-set-compiler) |
2606 (define-key vhdl-mode-map "\C-c\C-k" 'vhdl-compile) | 2700 (define-key vhdl-mode-map "\C-c\C-k" 'vhdl-compile) |
2607 (define-key vhdl-mode-map "\C-c\M-\C-k" 'vhdl-make) | 2701 (define-key vhdl-mode-map "\C-c\M-\C-k" 'vhdl-make) |
2608 (define-key vhdl-mode-map "\C-c\M-k" 'vhdl-generate-makefile) | 2702 (define-key vhdl-mode-map "\C-c\M-k" 'vhdl-generate-makefile) |
2609 (define-key vhdl-mode-map "\C-c\C-p\C-w" 'vhdl-port-copy) | 2703 (define-key vhdl-mode-map "\C-c\C-p\C-w" 'vhdl-port-copy) |
2610 (define-key vhdl-mode-map "\C-c\C-p\M-w" 'vhdl-port-copy) | 2704 (define-key vhdl-mode-map "\C-c\C-p\M-w" 'vhdl-port-copy) |
2611 (define-key vhdl-mode-map "\C-c\C-p\C-e" 'vhdl-port-paste-entity) | 2705 (define-key vhdl-mode-map "\C-c\C-p\C-e" 'vhdl-port-paste-entity) |
2627 (define-key vhdl-mode-map "\C-c\C-s\C-c" 'vhdl-subprog-paste-call) | 2721 (define-key vhdl-mode-map "\C-c\C-s\C-c" 'vhdl-subprog-paste-call) |
2628 (define-key vhdl-mode-map "\C-c\C-s\C-f" 'vhdl-subprog-flatten) | 2722 (define-key vhdl-mode-map "\C-c\C-s\C-f" 'vhdl-subprog-flatten) |
2629 (define-key vhdl-mode-map "\C-c\C-c\C-n" 'vhdl-compose-new-component) | 2723 (define-key vhdl-mode-map "\C-c\C-c\C-n" 'vhdl-compose-new-component) |
2630 (define-key vhdl-mode-map "\C-c\C-c\C-p" 'vhdl-compose-place-component) | 2724 (define-key vhdl-mode-map "\C-c\C-c\C-p" 'vhdl-compose-place-component) |
2631 (define-key vhdl-mode-map "\C-c\C-c\C-w" 'vhdl-compose-wire-components) | 2725 (define-key vhdl-mode-map "\C-c\C-c\C-w" 'vhdl-compose-wire-components) |
2726 (define-key vhdl-mode-map "\C-c\C-c\C-f" 'vhdl-compose-configuration) | |
2632 (define-key vhdl-mode-map "\C-c\C-c\C-k" 'vhdl-compose-components-package) | 2727 (define-key vhdl-mode-map "\C-c\C-c\C-k" 'vhdl-compose-components-package) |
2633 (define-key vhdl-mode-map "\C-cc" 'vhdl-comment-uncomment-region) | 2728 (define-key vhdl-mode-map "\C-cc" 'vhdl-comment-uncomment-region) |
2634 (define-key vhdl-mode-map "\C-c-" 'vhdl-comment-append-inline) | 2729 (define-key vhdl-mode-map "\C-c-" 'vhdl-comment-append-inline) |
2635 (define-key vhdl-mode-map "\C-c\M--" 'vhdl-comment-display-line) | 2730 (define-key vhdl-mode-map "\C-c\M--" 'vhdl-comment-display-line) |
2636 (define-key vhdl-mode-map "\C-c\C-i\C-l" 'indent-according-to-mode) | 2731 (define-key vhdl-mode-map "\C-c\C-i\C-l" 'indent-according-to-mode) |
2637 (define-key vhdl-mode-map "\C-c\C-i\C-g" 'vhdl-indent-group) | 2732 (define-key vhdl-mode-map "\C-c\C-i\C-g" 'vhdl-indent-group) |
2638 (define-key vhdl-mode-map "\M-\C-\\" 'vhdl-indent-region) | 2733 (define-key vhdl-mode-map "\M-\C-\\" 'vhdl-indent-region) |
2639 (define-key vhdl-mode-map "\C-c\C-i\C-b" 'vhdl-indent-buffer) | 2734 (define-key vhdl-mode-map "\C-c\C-i\C-b" 'vhdl-indent-buffer) |
2640 (define-key vhdl-mode-map "\C-c\C-a\C-g" 'vhdl-align-group) | 2735 (define-key vhdl-mode-map "\C-c\C-a\C-g" 'vhdl-align-group) |
2641 (define-key vhdl-mode-map "\C-c\C-a\C-a" 'vhdl-align-group) | 2736 (define-key vhdl-mode-map "\C-c\C-a\C-a" 'vhdl-align-group) |
2642 (define-key vhdl-mode-map "\C-c\C-a\C-i" 'vhdl-align-same-indent) | 2737 (define-key vhdl-mode-map "\C-c\C-a\C-i" 'vhdl-align-same-indent) |
2643 (define-key vhdl-mode-map "\C-c\C-a\C-l" 'vhdl-align-list) | 2738 (define-key vhdl-mode-map "\C-c\C-a\C-l" 'vhdl-align-list) |
2663 (define-key vhdl-mode-map "\C-c\C-x\C-p" 'vhdl-fix-clause) | 2758 (define-key vhdl-mode-map "\C-c\C-x\C-p" 'vhdl-fix-clause) |
2664 (define-key vhdl-mode-map "\C-c\C-x\M-c" 'vhdl-fix-case-region) | 2759 (define-key vhdl-mode-map "\C-c\C-x\M-c" 'vhdl-fix-case-region) |
2665 (define-key vhdl-mode-map "\C-c\C-x\C-c" 'vhdl-fix-case-buffer) | 2760 (define-key vhdl-mode-map "\C-c\C-x\C-c" 'vhdl-fix-case-buffer) |
2666 (define-key vhdl-mode-map "\C-c\C-x\M-w" 'vhdl-fixup-whitespace-region) | 2761 (define-key vhdl-mode-map "\C-c\C-x\M-w" 'vhdl-fixup-whitespace-region) |
2667 (define-key vhdl-mode-map "\C-c\C-x\C-w" 'vhdl-fixup-whitespace-buffer) | 2762 (define-key vhdl-mode-map "\C-c\C-x\C-w" 'vhdl-fixup-whitespace-buffer) |
2668 (define-key vhdl-mode-map "\C-c\M-b" 'vhdl-beautify-region) | 2763 (define-key vhdl-mode-map "\C-c\M-b" 'vhdl-beautify-region) |
2669 (define-key vhdl-mode-map "\C-c\C-b" 'vhdl-beautify-buffer) | 2764 (define-key vhdl-mode-map "\C-c\C-b" 'vhdl-beautify-buffer) |
2670 (define-key vhdl-mode-map "\C-c\C-u\C-s" 'vhdl-update-sensitivity-list-process) | 2765 (define-key vhdl-mode-map "\C-c\C-u\C-s" 'vhdl-update-sensitivity-list-process) |
2671 (define-key vhdl-mode-map "\C-c\C-u\M-s" 'vhdl-update-sensitivity-list-buffer) | 2766 (define-key vhdl-mode-map "\C-c\C-u\M-s" 'vhdl-update-sensitivity-list-buffer) |
2672 (define-key vhdl-mode-map "\C-cf" 'vhdl-fontify-buffer) | 2767 (define-key vhdl-mode-map "\C-cf" 'vhdl-fontify-buffer) |
2673 (define-key vhdl-mode-map "\C-cs" 'vhdl-statistics-buffer) | 2768 (define-key vhdl-mode-map "\C-cs" 'vhdl-statistics-buffer) |
2674 (define-key vhdl-mode-map "\C-c\M-m" 'vhdl-show-messages) | 2769 (define-key vhdl-mode-map "\C-c\M-m" 'vhdl-show-messages) |
2675 (define-key vhdl-mode-map "\C-c\C-h" 'vhdl-doc-mode) | 2770 (define-key vhdl-mode-map "\C-c\C-h" 'vhdl-doc-mode) |
2676 (define-key vhdl-mode-map "\C-c\C-v" 'vhdl-version) | 2771 (define-key vhdl-mode-map "\C-c\C-v" 'vhdl-version) |
2677 (define-key vhdl-mode-map "\M-\t" 'insert-tab) | 2772 (define-key vhdl-mode-map "\M-\t" 'insert-tab) |
2678 ;; insert commands bindings | 2773 ;; insert commands bindings |
2679 (define-key vhdl-mode-map "\C-c\C-i\C-t" 'vhdl-template-insert-construct) | 2774 (define-key vhdl-mode-map "\C-c\C-i\C-t" 'vhdl-template-insert-construct) |
2680 (define-key vhdl-mode-map "\C-c\C-i\C-p" 'vhdl-template-insert-package) | 2775 (define-key vhdl-mode-map "\C-c\C-i\C-p" 'vhdl-template-insert-package) |
2681 (define-key vhdl-mode-map "\C-c\C-i\C-d" 'vhdl-template-insert-directive) | 2776 (define-key vhdl-mode-map "\C-c\C-i\C-d" 'vhdl-template-insert-directive) |
2682 (define-key vhdl-mode-map "\C-c\C-i\C-m" 'vhdl-model-insert) | 2777 (define-key vhdl-mode-map "\C-c\C-i\C-m" 'vhdl-model-insert) |
2683 ;; electric key bindings | 2778 ;; electric key bindings |
2684 (define-key vhdl-mode-map " " 'vhdl-electric-space) | 2779 (define-key vhdl-mode-map " " 'vhdl-electric-space) |
2685 (if vhdl-intelligent-tab | 2780 (when vhdl-intelligent-tab |
2686 (define-key vhdl-mode-map "\t" 'vhdl-electric-tab) | 2781 (define-key vhdl-mode-map "\t" 'vhdl-electric-tab)) |
2687 ;; The default binding of TAB already calls `indent-according-to-mode'. | 2782 (define-key vhdl-mode-map "\r" 'vhdl-electric-return) |
2688 ;; (define-key vhdl-mode-map "\t" 'indent-according-to-mode) | 2783 (define-key vhdl-mode-map "-" 'vhdl-electric-dash) |
2689 ) | 2784 (define-key vhdl-mode-map "[" 'vhdl-electric-open-bracket) |
2690 (define-key vhdl-mode-map "\r" 'vhdl-electric-return) | 2785 (define-key vhdl-mode-map "]" 'vhdl-electric-close-bracket) |
2691 (define-key vhdl-mode-map "-" 'vhdl-electric-dash) | 2786 (define-key vhdl-mode-map "'" 'vhdl-electric-quote) |
2692 (define-key vhdl-mode-map "[" 'vhdl-electric-open-bracket) | 2787 (define-key vhdl-mode-map ";" 'vhdl-electric-semicolon) |
2693 (define-key vhdl-mode-map "]" 'vhdl-electric-close-bracket) | 2788 (define-key vhdl-mode-map "," 'vhdl-electric-comma) |
2694 (define-key vhdl-mode-map "'" 'vhdl-electric-quote) | 2789 (define-key vhdl-mode-map "." 'vhdl-electric-period) |
2695 (define-key vhdl-mode-map ";" 'vhdl-electric-semicolon) | |
2696 (define-key vhdl-mode-map "," 'vhdl-electric-comma) | |
2697 (define-key vhdl-mode-map "." 'vhdl-electric-period) | |
2698 (when (vhdl-standard-p 'ams) | 2790 (when (vhdl-standard-p 'ams) |
2699 (define-key vhdl-mode-map "=" 'vhdl-electric-equal))) | 2791 (define-key vhdl-mode-map "=" 'vhdl-electric-equal))) |
2700 | 2792 |
2701 ;; initialize mode map for VHDL Mode | 2793 ;; initialize mode map for VHDL Mode |
2702 (vhdl-mode-map-init) | 2794 (vhdl-mode-map-init) |
2703 | 2795 |
2704 ;; define special minibuffer keymap for enabling word completion in minibuffer | 2796 ;; define special minibuffer keymap for enabling word completion in minibuffer |
2799 (define-abbrev-table 'vhdl-mode-abbrev-table | 2891 (define-abbrev-table 'vhdl-mode-abbrev-table |
2800 (append | 2892 (append |
2801 (when (memq 'vhdl vhdl-electric-keywords) | 2893 (when (memq 'vhdl vhdl-electric-keywords) |
2802 ;; VHDL'93 keywords | 2894 ;; VHDL'93 keywords |
2803 '( | 2895 '( |
2804 ("--" "" vhdl-template-display-comment-hook 0 t) | 2896 ("--" "" vhdl-template-display-comment-hook 0) |
2805 ("abs" "" vhdl-template-default-hook 0 t) | 2897 ("abs" "" vhdl-template-default-hook 0) |
2806 ("access" "" vhdl-template-default-hook 0 t) | 2898 ("access" "" vhdl-template-default-hook 0) |
2807 ("after" "" vhdl-template-default-hook 0 t) | 2899 ("after" "" vhdl-template-default-hook 0) |
2808 ("alias" "" vhdl-template-alias-hook 0 t) | 2900 ("alias" "" vhdl-template-alias-hook 0) |
2809 ("all" "" vhdl-template-default-hook 0 t) | 2901 ("all" "" vhdl-template-default-hook 0) |
2810 ("and" "" vhdl-template-default-hook 0 t) | 2902 ("and" "" vhdl-template-default-hook 0) |
2811 ("arch" "" vhdl-template-architecture-hook 0 t) | 2903 ("arch" "" vhdl-template-architecture-hook 0) |
2812 ("architecture" "" vhdl-template-architecture-hook 0 t) | 2904 ("architecture" "" vhdl-template-architecture-hook 0) |
2813 ("array" "" vhdl-template-default-hook 0 t) | 2905 ("array" "" vhdl-template-default-hook 0) |
2814 ("assert" "" vhdl-template-assert-hook 0 t) | 2906 ("assert" "" vhdl-template-assert-hook 0) |
2815 ("attr" "" vhdl-template-attribute-hook 0 t) | 2907 ("attr" "" vhdl-template-attribute-hook 0) |
2816 ("attribute" "" vhdl-template-attribute-hook 0 t) | 2908 ("attribute" "" vhdl-template-attribute-hook 0) |
2817 ("begin" "" vhdl-template-default-indent-hook 0 t) | 2909 ("begin" "" vhdl-template-default-indent-hook 0) |
2818 ("block" "" vhdl-template-block-hook 0 t) | 2910 ("block" "" vhdl-template-block-hook 0) |
2819 ("body" "" vhdl-template-default-hook 0 t) | 2911 ("body" "" vhdl-template-default-hook 0) |
2820 ("buffer" "" vhdl-template-default-hook 0 t) | 2912 ("buffer" "" vhdl-template-default-hook 0) |
2821 ("bus" "" vhdl-template-default-hook 0 t) | 2913 ("bus" "" vhdl-template-default-hook 0) |
2822 ("case" "" vhdl-template-case-hook 0 t) | 2914 ("case" "" vhdl-template-case-hook 0) |
2823 ("comp" "" vhdl-template-component-hook 0 t) | 2915 ("comp" "" vhdl-template-component-hook 0) |
2824 ("component" "" vhdl-template-component-hook 0 t) | 2916 ("component" "" vhdl-template-component-hook 0) |
2825 ("cond" "" vhdl-template-conditional-signal-asst-hook 0 t) | 2917 ("cond" "" vhdl-template-conditional-signal-asst-hook 0) |
2826 ("conditional" "" vhdl-template-conditional-signal-asst-hook 0 t) | 2918 ("conditional" "" vhdl-template-conditional-signal-asst-hook 0) |
2827 ("conf" "" vhdl-template-configuration-hook 0 t) | 2919 ("conf" "" vhdl-template-configuration-hook 0) |
2828 ("configuration" "" vhdl-template-configuration-hook 0 t) | 2920 ("configuration" "" vhdl-template-configuration-hook 0) |
2829 ("cons" "" vhdl-template-constant-hook 0 t) | 2921 ("cons" "" vhdl-template-constant-hook 0) |
2830 ("constant" "" vhdl-template-constant-hook 0 t) | 2922 ("constant" "" vhdl-template-constant-hook 0) |
2831 ("disconnect" "" vhdl-template-disconnect-hook 0 t) | 2923 ("disconnect" "" vhdl-template-disconnect-hook 0) |
2832 ("downto" "" vhdl-template-default-hook 0 t) | 2924 ("downto" "" vhdl-template-default-hook 0) |
2833 ("else" "" vhdl-template-else-hook 0 t) | 2925 ("else" "" vhdl-template-else-hook 0) |
2834 ("elseif" "" vhdl-template-elsif-hook 0 t) | 2926 ("elseif" "" vhdl-template-elsif-hook 0) |
2835 ("elsif" "" vhdl-template-elsif-hook 0 t) | 2927 ("elsif" "" vhdl-template-elsif-hook 0) |
2836 ("end" "" vhdl-template-default-indent-hook 0 t) | 2928 ("end" "" vhdl-template-default-indent-hook 0) |
2837 ("entity" "" vhdl-template-entity-hook 0 t) | 2929 ("entity" "" vhdl-template-entity-hook 0) |
2838 ("exit" "" vhdl-template-exit-hook 0 t) | 2930 ("exit" "" vhdl-template-exit-hook 0) |
2839 ("file" "" vhdl-template-file-hook 0 t) | 2931 ("file" "" vhdl-template-file-hook 0) |
2840 ("for" "" vhdl-template-for-hook 0 t) | 2932 ("for" "" vhdl-template-for-hook 0) |
2841 ("func" "" vhdl-template-function-hook 0 t) | 2933 ("func" "" vhdl-template-function-hook 0) |
2842 ("function" "" vhdl-template-function-hook 0 t) | 2934 ("function" "" vhdl-template-function-hook 0) |
2843 ("generic" "" vhdl-template-generic-hook 0 t) | 2935 ("generic" "" vhdl-template-generic-hook 0) |
2844 ("group" "" vhdl-template-group-hook 0 t) | 2936 ("group" "" vhdl-template-group-hook 0) |
2845 ("guarded" "" vhdl-template-default-hook 0 t) | 2937 ("guarded" "" vhdl-template-default-hook 0) |
2846 ("if" "" vhdl-template-if-hook 0 t) | 2938 ("if" "" vhdl-template-if-hook 0) |
2847 ("impure" "" vhdl-template-default-hook 0 t) | 2939 ("impure" "" vhdl-template-default-hook 0) |
2848 ("in" "" vhdl-template-default-hook 0 t) | 2940 ("in" "" vhdl-template-default-hook 0) |
2849 ("inertial" "" vhdl-template-default-hook 0 t) | 2941 ("inertial" "" vhdl-template-default-hook 0) |
2850 ("inout" "" vhdl-template-default-hook 0 t) | 2942 ("inout" "" vhdl-template-default-hook 0) |
2851 ("inst" "" vhdl-template-instance-hook 0 t) | 2943 ("inst" "" vhdl-template-instance-hook 0) |
2852 ("instance" "" vhdl-template-instance-hook 0 t) | 2944 ("instance" "" vhdl-template-instance-hook 0) |
2853 ("is" "" vhdl-template-default-hook 0 t) | 2945 ("is" "" vhdl-template-default-hook 0) |
2854 ("label" "" vhdl-template-default-hook 0 t) | 2946 ("label" "" vhdl-template-default-hook 0) |
2855 ("library" "" vhdl-template-library-hook 0 t) | 2947 ("library" "" vhdl-template-library-hook 0) |
2856 ("linkage" "" vhdl-template-default-hook 0 t) | 2948 ("linkage" "" vhdl-template-default-hook 0) |
2857 ("literal" "" vhdl-template-default-hook 0 t) | 2949 ("literal" "" vhdl-template-default-hook 0) |
2858 ("loop" "" vhdl-template-bare-loop-hook 0 t) | 2950 ("loop" "" vhdl-template-bare-loop-hook 0) |
2859 ("map" "" vhdl-template-map-hook 0 t) | 2951 ("map" "" vhdl-template-map-hook 0) |
2860 ("mod" "" vhdl-template-default-hook 0 t) | 2952 ("mod" "" vhdl-template-default-hook 0) |
2861 ("nand" "" vhdl-template-default-hook 0 t) | 2953 ("nand" "" vhdl-template-default-hook 0) |
2862 ("new" "" vhdl-template-default-hook 0 t) | 2954 ("new" "" vhdl-template-default-hook 0) |
2863 ("next" "" vhdl-template-next-hook 0 t) | 2955 ("next" "" vhdl-template-next-hook 0) |
2864 ("nor" "" vhdl-template-default-hook 0 t) | 2956 ("nor" "" vhdl-template-default-hook 0) |
2865 ("not" "" vhdl-template-default-hook 0 t) | 2957 ("not" "" vhdl-template-default-hook 0) |
2866 ("null" "" vhdl-template-default-hook 0 t) | 2958 ("null" "" vhdl-template-default-hook 0) |
2867 ("of" "" vhdl-template-default-hook 0 t) | 2959 ("of" "" vhdl-template-default-hook 0) |
2868 ("on" "" vhdl-template-default-hook 0 t) | 2960 ("on" "" vhdl-template-default-hook 0) |
2869 ("open" "" vhdl-template-default-hook 0 t) | 2961 ("open" "" vhdl-template-default-hook 0) |
2870 ("or" "" vhdl-template-default-hook 0 t) | 2962 ("or" "" vhdl-template-default-hook 0) |
2871 ("others" "" vhdl-template-others-hook 0 t) | 2963 ("others" "" vhdl-template-others-hook 0) |
2872 ("out" "" vhdl-template-default-hook 0 t) | 2964 ("out" "" vhdl-template-default-hook 0) |
2873 ("pack" "" vhdl-template-package-hook 0 t) | 2965 ("pack" "" vhdl-template-package-hook 0) |
2874 ("package" "" vhdl-template-package-hook 0 t) | 2966 ("package" "" vhdl-template-package-hook 0) |
2875 ("port" "" vhdl-template-port-hook 0 t) | 2967 ("port" "" vhdl-template-port-hook 0) |
2876 ("postponed" "" vhdl-template-default-hook 0 t) | 2968 ("postponed" "" vhdl-template-default-hook 0) |
2877 ("procedure" "" vhdl-template-procedure-hook 0 t) | 2969 ("procedure" "" vhdl-template-procedure-hook 0) |
2878 ("process" "" vhdl-template-process-hook 0 t) | 2970 ("process" "" vhdl-template-process-hook 0) |
2879 ("pure" "" vhdl-template-default-hook 0 t) | 2971 ("pure" "" vhdl-template-default-hook 0) |
2880 ("range" "" vhdl-template-default-hook 0 t) | 2972 ("range" "" vhdl-template-default-hook 0) |
2881 ("record" "" vhdl-template-default-hook 0 t) | 2973 ("record" "" vhdl-template-default-hook 0) |
2882 ("register" "" vhdl-template-default-hook 0 t) | 2974 ("register" "" vhdl-template-default-hook 0) |
2883 ("reject" "" vhdl-template-default-hook 0 t) | 2975 ("reject" "" vhdl-template-default-hook 0) |
2884 ("rem" "" vhdl-template-default-hook 0 t) | 2976 ("rem" "" vhdl-template-default-hook 0) |
2885 ("report" "" vhdl-template-report-hook 0 t) | 2977 ("report" "" vhdl-template-report-hook 0) |
2886 ("return" "" vhdl-template-return-hook 0 t) | 2978 ("return" "" vhdl-template-return-hook 0) |
2887 ("rol" "" vhdl-template-default-hook 0 t) | 2979 ("rol" "" vhdl-template-default-hook 0) |
2888 ("ror" "" vhdl-template-default-hook 0 t) | 2980 ("ror" "" vhdl-template-default-hook 0) |
2889 ("select" "" vhdl-template-selected-signal-asst-hook 0 t) | 2981 ("select" "" vhdl-template-selected-signal-asst-hook 0) |
2890 ("severity" "" vhdl-template-default-hook 0 t) | 2982 ("severity" "" vhdl-template-default-hook 0) |
2891 ("shared" "" vhdl-template-default-hook 0 t) | 2983 ("shared" "" vhdl-template-default-hook 0) |
2892 ("sig" "" vhdl-template-signal-hook 0 t) | 2984 ("sig" "" vhdl-template-signal-hook 0) |
2893 ("signal" "" vhdl-template-signal-hook 0 t) | 2985 ("signal" "" vhdl-template-signal-hook 0) |
2894 ("sla" "" vhdl-template-default-hook 0 t) | 2986 ("sla" "" vhdl-template-default-hook 0) |
2895 ("sll" "" vhdl-template-default-hook 0 t) | 2987 ("sll" "" vhdl-template-default-hook 0) |
2896 ("sra" "" vhdl-template-default-hook 0 t) | 2988 ("sra" "" vhdl-template-default-hook 0) |
2897 ("srl" "" vhdl-template-default-hook 0 t) | 2989 ("srl" "" vhdl-template-default-hook 0) |
2898 ("subtype" "" vhdl-template-subtype-hook 0 t) | 2990 ("subtype" "" vhdl-template-subtype-hook 0) |
2899 ("then" "" vhdl-template-default-hook 0 t) | 2991 ("then" "" vhdl-template-default-hook 0) |
2900 ("to" "" vhdl-template-default-hook 0 t) | 2992 ("to" "" vhdl-template-default-hook 0) |
2901 ("transport" "" vhdl-template-default-hook 0 t) | 2993 ("transport" "" vhdl-template-default-hook 0) |
2902 ("type" "" vhdl-template-type-hook 0 t) | 2994 ("type" "" vhdl-template-type-hook 0) |
2903 ("unaffected" "" vhdl-template-default-hook 0 t) | 2995 ("unaffected" "" vhdl-template-default-hook 0) |
2904 ("units" "" vhdl-template-default-hook 0 t) | 2996 ("units" "" vhdl-template-default-hook 0) |
2905 ("until" "" vhdl-template-default-hook 0 t) | 2997 ("until" "" vhdl-template-default-hook 0) |
2906 ("use" "" vhdl-template-use-hook 0 t) | 2998 ("use" "" vhdl-template-use-hook 0) |
2907 ("var" "" vhdl-template-variable-hook 0 t) | 2999 ("var" "" vhdl-template-variable-hook 0) |
2908 ("variable" "" vhdl-template-variable-hook 0 t) | 3000 ("variable" "" vhdl-template-variable-hook 0) |
2909 ("wait" "" vhdl-template-wait-hook 0 t) | 3001 ("wait" "" vhdl-template-wait-hook 0) |
2910 ("when" "" vhdl-template-when-hook 0 t) | 3002 ("when" "" vhdl-template-when-hook 0) |
2911 ("while" "" vhdl-template-while-loop-hook 0 t) | 3003 ("while" "" vhdl-template-while-loop-hook 0) |
2912 ("with" "" vhdl-template-with-hook 0 t) | 3004 ("with" "" vhdl-template-with-hook 0) |
2913 ("xnor" "" vhdl-template-default-hook 0 t) | 3005 ("xnor" "" vhdl-template-default-hook 0) |
2914 ("xor" "" vhdl-template-default-hook 0 t) | 3006 ("xor" "" vhdl-template-default-hook 0) |
2915 )) | 3007 )) |
2916 ;; VHDL-AMS keywords | 3008 ;; VHDL-AMS keywords |
2917 (when (and (memq 'vhdl vhdl-electric-keywords) (vhdl-standard-p 'ams)) | 3009 (when (and (memq 'vhdl vhdl-electric-keywords) (vhdl-standard-p 'ams)) |
2918 '( | 3010 '( |
2919 ("across" "" vhdl-template-default-hook 0 t) | 3011 ("across" "" vhdl-template-default-hook 0) |
2920 ("break" "" vhdl-template-break-hook 0 t) | 3012 ("break" "" vhdl-template-break-hook 0) |
2921 ("limit" "" vhdl-template-limit-hook 0 t) | 3013 ("limit" "" vhdl-template-limit-hook 0) |
2922 ("nature" "" vhdl-template-nature-hook 0 t) | 3014 ("nature" "" vhdl-template-nature-hook 0) |
2923 ("noise" "" vhdl-template-default-hook 0 t) | 3015 ("noise" "" vhdl-template-default-hook 0) |
2924 ("procedural" "" vhdl-template-procedural-hook 0 t) | 3016 ("procedural" "" vhdl-template-procedural-hook 0) |
2925 ("quantity" "" vhdl-template-quantity-hook 0 t) | 3017 ("quantity" "" vhdl-template-quantity-hook 0) |
2926 ("reference" "" vhdl-template-default-hook 0 t) | 3018 ("reference" "" vhdl-template-default-hook 0) |
2927 ("spectrum" "" vhdl-template-default-hook 0 t) | 3019 ("spectrum" "" vhdl-template-default-hook 0) |
2928 ("subnature" "" vhdl-template-subnature-hook 0 t) | 3020 ("subnature" "" vhdl-template-subnature-hook 0) |
2929 ("terminal" "" vhdl-template-terminal-hook 0 t) | 3021 ("terminal" "" vhdl-template-terminal-hook 0) |
2930 ("through" "" vhdl-template-default-hook 0 t) | 3022 ("through" "" vhdl-template-default-hook 0) |
2931 ("tolerance" "" vhdl-template-default-hook 0 t) | 3023 ("tolerance" "" vhdl-template-default-hook 0) |
2932 )) | 3024 )) |
2933 ;; user model keywords | 3025 ;; user model keywords |
2934 (when (memq 'user vhdl-electric-keywords) | 3026 (when (memq 'user vhdl-electric-keywords) |
2935 (let ((alist vhdl-model-alist) | 3027 (let ((alist vhdl-model-alist) |
2936 abbrev-list keyword) | 3028 abbrev-list keyword) |
2938 (setq keyword (nth 3 (car alist))) | 3030 (setq keyword (nth 3 (car alist))) |
2939 (unless (equal keyword "") | 3031 (unless (equal keyword "") |
2940 (setq abbrev-list | 3032 (setq abbrev-list |
2941 (cons (list keyword "" | 3033 (cons (list keyword "" |
2942 (vhdl-function-name | 3034 (vhdl-function-name |
2943 "vhdl-model" (nth 0 (car alist)) "hook") 0 t) | 3035 "vhdl-model" (nth 0 (car alist)) "hook") 0) |
2944 abbrev-list))) | 3036 abbrev-list))) |
2945 (setq alist (cdr alist))) | 3037 (setq alist (cdr alist))) |
2946 abbrev-list))))) | 3038 abbrev-list))))) |
2947 | 3039 |
2948 ;; initialize abbrev table for VHDL Mode | 3040 ;; initialize abbrev table for VHDL Mode |
3092 (function (lambda (a b) (string< (elt a 0) (elt b 0))))) | 3184 (function (lambda (a b) (string< (elt a 0) (elt b 0))))) |
3093 (nreverse menu-list))) | 3185 (nreverse menu-list))) |
3094 (vhdl-menu-split menu-list "Project")) | 3186 (vhdl-menu-split menu-list "Project")) |
3095 '("--" "--" | 3187 '("--" "--" |
3096 ["Select Project..." vhdl-set-project t] | 3188 ["Select Project..." vhdl-set-project t] |
3189 ["Set As Default Project" vhdl-set-default-project t] | |
3097 "--" | 3190 "--" |
3098 ["Duplicate Project" vhdl-duplicate-project vhdl-project] | 3191 ["Duplicate Project" vhdl-duplicate-project vhdl-project] |
3099 ["Import Project..." vhdl-import-project | 3192 ["Import Project..." vhdl-import-project |
3100 :keys "C-c C-p C-m" :active t] | 3193 :keys "C-c C-p C-m" :active t] |
3101 ["Export Project" vhdl-export-project vhdl-project] | 3194 ["Export Project" vhdl-export-project vhdl-project] |
3278 :style toggle :selected vhdl-port-flattened :active vhdl-port-list] | 3371 :style toggle :selected vhdl-port-flattened :active vhdl-port-list] |
3279 ["Reverse Direction" vhdl-port-reverse-direction | 3372 ["Reverse Direction" vhdl-port-reverse-direction |
3280 :style toggle :selected vhdl-port-reversed-direction :active vhdl-port-list]) | 3373 :style toggle :selected vhdl-port-reversed-direction :active vhdl-port-list]) |
3281 ("Compose" | 3374 ("Compose" |
3282 ["New Component" vhdl-compose-new-component t] | 3375 ["New Component" vhdl-compose-new-component t] |
3376 ["Copy Component" vhdl-port-copy t] | |
3283 ["Place Component" vhdl-compose-place-component vhdl-port-list] | 3377 ["Place Component" vhdl-compose-place-component vhdl-port-list] |
3284 ["Wire Components" vhdl-compose-wire-components t] | 3378 ["Wire Components" vhdl-compose-wire-components t] |
3285 "--" | 3379 "--" |
3380 ["Generate Configuration" vhdl-compose-configuration t] | |
3286 ["Generate Components Package" vhdl-compose-components-package t]) | 3381 ["Generate Components Package" vhdl-compose-components-package t]) |
3287 ("Subprogram" | 3382 ("Subprogram" |
3288 ["Copy" vhdl-subprog-copy t] | 3383 ["Copy" vhdl-subprog-copy t] |
3289 "--" | 3384 "--" |
3290 ["Paste As Declaration" vhdl-subprog-paste-declaration vhdl-subprog-list] | 3385 ["Paste As Declaration" vhdl-subprog-paste-declaration vhdl-subprog-list] |
3524 ["Customize Group..." (customize-group 'vhdl-style) t]) | 3619 ["Customize Group..." (customize-group 'vhdl-style) t]) |
3525 ("Naming" | 3620 ("Naming" |
3526 ["Entity File Name..." (customize-option 'vhdl-entity-file-name) t] | 3621 ["Entity File Name..." (customize-option 'vhdl-entity-file-name) t] |
3527 ["Architecture File Name..." | 3622 ["Architecture File Name..." |
3528 (customize-option 'vhdl-architecture-file-name) t] | 3623 (customize-option 'vhdl-architecture-file-name) t] |
3624 ["Configuration File Name..." | |
3625 (customize-option 'vhdl-configuration-file-name) t] | |
3529 ["Package File Name..." (customize-option 'vhdl-package-file-name) t] | 3626 ["Package File Name..." (customize-option 'vhdl-package-file-name) t] |
3530 ("File Name Case" | 3627 ("File Name Case" |
3531 ["As Is" | 3628 ["As Is" |
3532 (customize-set-variable 'vhdl-file-name-case 'identity) | 3629 (customize-set-variable 'vhdl-file-name-case 'identity) |
3533 :style radio :selected (eq 'identity vhdl-file-name-case)] | 3630 :style radio :selected (eq 'identity vhdl-file-name-case)] |
3693 ["Single" | 3790 ["Single" |
3694 (customize-set-variable 'vhdl-testbench-create-files 'single) | 3791 (customize-set-variable 'vhdl-testbench-create-files 'single) |
3695 :style radio :selected (eq 'single vhdl-testbench-create-files)] | 3792 :style radio :selected (eq 'single vhdl-testbench-create-files)] |
3696 ["Separate" | 3793 ["Separate" |
3697 (customize-set-variable 'vhdl-testbench-create-files 'separate) | 3794 (customize-set-variable 'vhdl-testbench-create-files 'separate) |
3698 :style radio :selected (eq 'separate vhdl-testbench-create-files)])) | 3795 :style radio :selected (eq 'separate vhdl-testbench-create-files)]) |
3796 ["Testbench Entity File Name..." | |
3797 (customize-option 'vhdl-testbench-entity-file-name) t] | |
3798 ["Testbench Architecture File Name..." | |
3799 (customize-option 'vhdl-testbench-architecture-file-name) t]) | |
3699 "--" | 3800 "--" |
3700 ["Customize Group..." (customize-group 'vhdl-port) t]) | 3801 ["Customize Group..." (customize-group 'vhdl-port) t]) |
3701 ("Compose" | 3802 ("Compose" |
3702 ("Create Files" | 3803 ["Architecture Name..." |
3804 (customize-option 'vhdl-compose-architecture-name) t] | |
3805 ["Configuration Name..." | |
3806 (customize-option 'vhdl-compose-configuration-name) t] | |
3807 ["Components Package Name..." | |
3808 (customize-option 'vhdl-components-package-name) t] | |
3809 ["Use Components Package" | |
3810 (customize-set-variable 'vhdl-use-components-package | |
3811 (not vhdl-use-components-package)) | |
3812 :style toggle :selected vhdl-use-components-package] | |
3813 ["Include Header" | |
3814 (customize-set-variable 'vhdl-compose-include-header | |
3815 (not vhdl-compose-include-header)) | |
3816 :style toggle :selected vhdl-compose-include-header] | |
3817 ("Create Entity/Architecture Files" | |
3703 ["None" | 3818 ["None" |
3704 (customize-set-variable 'vhdl-compose-create-files 'none) | 3819 (customize-set-variable 'vhdl-compose-create-files 'none) |
3705 :style radio :selected (eq 'none vhdl-compose-create-files)] | 3820 :style radio :selected (eq 'none vhdl-compose-create-files)] |
3706 ["Single" | 3821 ["Single" |
3707 (customize-set-variable 'vhdl-compose-create-files 'single) | 3822 (customize-set-variable 'vhdl-compose-create-files 'single) |
3708 :style radio :selected (eq 'single vhdl-compose-create-files)] | 3823 :style radio :selected (eq 'single vhdl-compose-create-files)] |
3709 ["Separate" | 3824 ["Separate" |
3710 (customize-set-variable 'vhdl-compose-create-files 'separate) | 3825 (customize-set-variable 'vhdl-compose-create-files 'separate) |
3711 :style radio :selected (eq 'separate vhdl-compose-create-files)]) | 3826 :style radio :selected (eq 'separate vhdl-compose-create-files)]) |
3712 ["Include Header" | 3827 ["Create Configuration File" |
3713 (customize-set-variable 'vhdl-compose-include-header | 3828 (customize-set-variable 'vhdl-compose-configuration-create-file |
3714 (not vhdl-compose-include-header)) | 3829 (not vhdl-compose-configuration-create-file)) |
3715 :style toggle :selected vhdl-compose-include-header] | 3830 :style toggle :selected vhdl-compose-configuration-create-file] |
3716 ["Architecture Name..." | 3831 ["Hierarchical Configuration" |
3717 (customize-option 'vhdl-compose-architecture-name) t] | 3832 (customize-set-variable 'vhdl-compose-configuration-hierarchical |
3718 ["Components Package Name..." | 3833 (not vhdl-compose-configuration-hierarchical)) |
3719 (customize-option 'vhdl-components-package-name) t] | 3834 :style toggle :selected vhdl-compose-configuration-hierarchical] |
3720 ["Use Components Package" | 3835 ["Use Subconfiguration" |
3721 (customize-set-variable 'vhdl-use-components-package | 3836 (customize-set-variable 'vhdl-compose-configuration-use-subconfiguration |
3722 (not vhdl-use-components-package)) | 3837 (not vhdl-compose-configuration-use-subconfiguration)) |
3723 :style toggle :selected vhdl-use-components-package] | 3838 :style toggle :selected vhdl-compose-configuration-use-subconfiguration] |
3724 "--" | 3839 "--" |
3725 ["Customize Group..." (customize-group 'vhdl-compose) t]) | 3840 ["Customize Group..." (customize-group 'vhdl-compose) t]) |
3726 ("Comment" | 3841 ("Comment" |
3727 ["Self Insert Comments" | 3842 ["Self Insert Comments" |
3728 (customize-set-variable 'vhdl-self-insert-comments | 3843 (customize-set-variable 'vhdl-self-insert-comments |
4170 | 4285 |
4171 `C-c C-x M-w' fixes up whitespace in a region. That is, operator | 4286 `C-c C-x M-w' fixes up whitespace in a region. That is, operator |
4172 symbols are surrounded by one space, and multiple spaces are eliminated. | 4287 symbols are surrounded by one space, and multiple spaces are eliminated. |
4173 | 4288 |
4174 | 4289 |
4175 | CODE FILLING: | 4290 CODE FILLING: |
4176 | Code filling allows to condens code (e.g. sensitivity lists or port | 4291 Code filling allows to condense code (e.g. sensitivity lists or port |
4177 | maps) by removing comments and newlines and re-wrapping so that all | 4292 maps) by removing comments and newlines and re-wrapping so that all |
4178 | lines are maximally filled (block filling). `C-c C-f C-f' fills a list | 4293 lines are maximally filled (block filling). `C-c C-f C-f' fills a list |
4179 | enclosed by parenthesis, `C-c C-f C-g' a group of lines separated by | 4294 enclosed by parenthesis, `C-c C-f C-g' a group of lines separated by |
4180 | blank lines, `C-c C-f C-i' a block of lines with same indent, and | 4295 blank lines, `C-c C-f C-i' a block of lines with same indent, and |
4181 | `C-c C-f M-f' an entire region. | 4296 `C-c C-f M-f' an entire region. |
4182 | 4297 |
4183 | 4298 |
4184 CODE BEAUTIFICATION: | 4299 CODE BEAUTIFICATION: |
4185 `C-c M-b' and `C-c C-b' beautify the code of a region or of the entire | 4300 `C-c M-b' and `C-c C-b' beautify the code of a region or of the entire |
4186 buffer respectively. This inludes indentation, alignment, and case | 4301 buffer respectively. This inludes indentation, alignment, and case |
4201 `vhdl-association-list-with-formals'. To include comments in pasting, | 4316 `vhdl-association-list-with-formals'. To include comments in pasting, |
4202 see options `vhdl-include-...-comments'. | 4317 see options `vhdl-include-...-comments'. |
4203 | 4318 |
4204 A clause with several generic/port names on the same line can be | 4319 A clause with several generic/port names on the same line can be |
4205 flattened (`C-c C-p C-f') so that only one name per line exists. The | 4320 flattened (`C-c C-p C-f') so that only one name per line exists. The |
4206 | direction of ports can be reversed (`C-c C-p C-r'), i.e., inputs become | 4321 direction of ports can be reversed (`C-c C-p C-r'), i.e., inputs become |
4207 | outputs and vice versa, which can be useful in testbenches. (This | 4322 outputs and vice versa, which can be useful in testbenches. (This |
4208 | reversion is done on the internal data structure and is only reflected | 4323 reversion is done on the internal data structure and is only reflected |
4209 | in subsequent paste operations.) | 4324 in subsequent paste operations.) |
4210 | 4325 |
4211 Names for actual ports, instances, testbenches, and | 4326 Names for actual ports, instances, testbenches, and |
4212 design-under-test instances can be derived from existing names according | 4327 design-under-test instances can be derived from existing names according |
4213 to options `vhdl-...-name'. See customization group `vhdl-port'. | 4328 to options `vhdl-...-name'. See customization group `vhdl-port'. |
4214 | 4329 |
4215 | 4330 |
4216 | SUBPROGRAM TRANSLATION: | 4331 SUBPROGRAM TRANSLATION: |
4217 | Similar functionality exists for copying/pasting the interface of | 4332 Similar functionality exists for copying/pasting the interface of |
4218 | subprograms (function/procedure). A subprogram interface can be copied | 4333 subprograms (function/procedure). A subprogram interface can be copied |
4219 | and then pasted as a subprogram declaration, body or call (uses | 4334 and then pasted as a subprogram declaration, body or call (uses |
4220 | association list with formals). | 4335 association list with formals). |
4221 | 4336 |
4222 | 4337 |
4223 TESTBENCH GENERATION: | 4338 TESTBENCH GENERATION: |
4224 A copied port can also be pasted as a testbench. The generated | 4339 A copied port can also be pasted as a testbench. The generated |
4225 testbench includes an entity, an architecture, and an optional | 4340 testbench includes an entity, an architecture, and an optional |
4271 Simple design consistency checks are done during scanning, such as | 4386 Simple design consistency checks are done during scanning, such as |
4272 multiple declarations of the same unit or missing primary units that are | 4387 multiple declarations of the same unit or missing primary units that are |
4273 required by secondary units. | 4388 required by secondary units. |
4274 | 4389 |
4275 | 4390 |
4276 | STRUCTURAL COMPOSITION: | 4391 STRUCTURAL COMPOSITION: |
4277 | Enables simple structural composition. `C-c C-c C-n' creates a skeleton | 4392 Enables simple structural composition. `C-c C-c C-n' creates a skeleton |
4278 | for a new component. Subcomponents (i.e. component declaration and | 4393 for a new component. Subcomponents (i.e. component declaration and |
4279 | instantiation) can be automatically placed from a previously read port | 4394 instantiation) can be automatically placed from a previously read port |
4280 | \(`C-c C-c C-p') or directly from the hierarchy browser (`P'). Finally, | 4395 \(`C-c C-c C-p') or directly from the hierarchy browser (`P'). Finally, |
4281 | all subcomponents can be automatically connected using internal signals | 4396 all subcomponents can be automatically connected using internal signals |
4282 | and ports (`C-c C-c C-w') following these rules: | 4397 and ports (`C-c C-c C-w') following these rules: |
4283 | - subcomponent actual ports with same name are considered to be | 4398 - subcomponent actual ports with same name are considered to be |
4284 | connected by a signal (internal signal or port) | 4399 connected by a signal (internal signal or port) |
4285 | - signals that are only inputs to subcomponents are considered as | 4400 - signals that are only inputs to subcomponents are considered as |
4286 | inputs to this component -> input port created | 4401 inputs to this component -> input port created |
4287 | - signals that are only outputs from subcomponents are considered as | 4402 - signals that are only outputs from subcomponents are considered as |
4288 | outputs from this component -> output port created | 4403 outputs from this component -> output port created |
4289 | - signals that are inputs to AND outputs from subcomponents are | 4404 - signals that are inputs to AND outputs from subcomponents are |
4290 | considered as internal connections -> internal signal created | 4405 considered as internal connections -> internal signal created |
4406 | |
4407 Purpose: With appropriate naming conventions it is possible to | |
4408 create higher design levels with only a few mouse clicks or key | |
4409 strokes. A new design level can be created by simply generating a new | |
4410 component, placing the required subcomponents from the hierarchy | |
4411 browser, and wiring everything automatically. | |
4412 | |
4413 Note: Automatic wiring only works reliably on templates of new | |
4414 components and component instantiations that were created by VHDL mode. | |
4415 | |
4416 Component declarations can be placed in a components package (option | |
4417 `vhdl-use-components-package') which can be automatically generated for | |
4418 an entire directory or project (`C-c C-c M-p'). The VHDL'93 direct | |
4419 component instantiation is also supported (option | |
4420 `vhdl-use-direct-instantiation'). | |
4421 | |
4422 | Configuration declarations can automatically be generated either from | |
4423 | the menu (`C-c C-c C-f') (for the architecture the cursor is in) or from | |
4424 | the speedbar menu (for the architecture under the cursor). The | |
4425 | configurations can optionally be hierarchical (i.e. include all | |
4426 | component levels of a hierarchical design, option | |
4427 | `vhdl-compose-configuration-hierarchical') or include subconfigurations | |
4428 | (option `vhdl-compose-configuration-use-subconfiguration'). For | |
4429 | subcomponents in hierarchical configurations, the most-recently-analyzed | |
4430 | (mra) architecture is selected. If another architecture is desired, it | |
4431 | can be marked as most-recently-analyzed (speedbar menu) before | |
4432 | generating the configuration. | |
4291 | | 4433 | |
4292 | Component declarations can be placed in a components package (option | 4434 | Note: Configurations of subcomponents (i.e. hierarchical configuration |
4293 | `vhdl-use-components-package') which can be automatically generated for | 4435 | declarations) are currently not considered when displaying |
4294 | an entire directory or project (`C-c C-c M-p'). The VHDL'93 direct | 4436 | configurations in speedbar. |
4295 | component instantiation is also supported (option | 4437 |
4296 | `vhdl-use-direct-instantiation'). | 4438 See the options group `vhdl-compose' for all relevant user options. |
4297 | | |
4298 | Purpose: With appropriate naming conventions it is possible to | |
4299 | create higher design levels with only a few mouse clicks or key | |
4300 | strokes. A new design level can be created by simply generating a new | |
4301 | component, placing the required subcomponents from the hierarchy | |
4302 | browser, and wiring everything automatically. | |
4303 | | |
4304 | Note: Automatic wiring only works reliably on templates of new | |
4305 | components and component instantiations that were created by VHDL mode. | |
4306 | | |
4307 | See the options group `vhdl-compose' for all relevant user options. | |
4308 | 4439 |
4309 | 4440 |
4310 SOURCE FILE COMPILATION: | 4441 SOURCE FILE COMPILATION: |
4311 The syntax of the current buffer can be analyzed by calling a VHDL | 4442 The syntax of the current buffer can be analyzed by calling a VHDL |
4312 compiler (menu, `C-c C-k'). The compiler to be used is specified by | 4443 compiler (menu, `C-c C-k'). The compiler to be used is specified by |
4566 (set (make-local-variable 'paragraph-start) | 4697 (set (make-local-variable 'paragraph-start) |
4567 "\\s-*\\(--+\\s-*$\\|[^ -]\\|$\\)") | 4698 "\\s-*\\(--+\\s-*$\\|[^ -]\\|$\\)") |
4568 (set (make-local-variable 'paragraph-separate) paragraph-start) | 4699 (set (make-local-variable 'paragraph-separate) paragraph-start) |
4569 (set (make-local-variable 'paragraph-ignore-fill-prefix) t) | 4700 (set (make-local-variable 'paragraph-ignore-fill-prefix) t) |
4570 (set (make-local-variable 'require-final-newline) | 4701 (set (make-local-variable 'require-final-newline) |
4571 mode-require-final-newline) | 4702 (if vhdl-emacs-22 mode-require-final-newline t)) |
4572 (set (make-local-variable 'parse-sexp-ignore-comments) t) | 4703 (set (make-local-variable 'parse-sexp-ignore-comments) t) |
4573 (set (make-local-variable 'indent-line-function) 'vhdl-indent-line) | 4704 (set (make-local-variable 'indent-line-function) 'vhdl-indent-line) |
4574 (set (make-local-variable 'comment-start) "--") | 4705 (set (make-local-variable 'comment-start) "--") |
4575 (set (make-local-variable 'comment-end) "") | 4706 (set (make-local-variable 'comment-end) "") |
4576 (set (make-local-variable 'comment-padding) "") | 4707 (when vhdl-emacs-21 |
4708 (set (make-local-variable 'comment-padding) "")) | |
4577 (set (make-local-variable 'comment-column) vhdl-inline-comment-column) | 4709 (set (make-local-variable 'comment-column) vhdl-inline-comment-column) |
4578 (set (make-local-variable 'end-comment-column) vhdl-end-comment-column) | 4710 (set (make-local-variable 'end-comment-column) vhdl-end-comment-column) |
4579 (set (make-local-variable 'comment-start-skip) "--+\\s-*") | 4711 (set (make-local-variable 'comment-start-skip) "--+\\s-*") |
4580 (set (make-local-variable 'comment-multi-line) nil) | 4712 (set (make-local-variable 'comment-multi-line) nil) |
4581 (set (make-local-variable 'indent-tabs-mode) vhdl-indent-tabs-mode) | 4713 (set (make-local-variable 'indent-tabs-mode) vhdl-indent-tabs-mode) |
4624 (vhdl-mode-line-update) | 4756 (vhdl-mode-line-update) |
4625 (message "VHDL Mode %s.%s" vhdl-version | 4757 (message "VHDL Mode %s.%s" vhdl-version |
4626 (if noninteractive "" " See menu for documentation and release notes.")) | 4758 (if noninteractive "" " See menu for documentation and release notes.")) |
4627 | 4759 |
4628 ;; run hooks | 4760 ;; run hooks |
4629 (run-mode-hooks 'vhdl-mode-hook)) | 4761 (if vhdl-emacs-22 |
4762 (run-mode-hooks 'vhdl-mode-hook) | |
4763 (run-hooks 'vhdl-mode-hook))) | |
4630 | 4764 |
4631 (defun vhdl-activate-customizations () | 4765 (defun vhdl-activate-customizations () |
4632 "Activate all customizations on local variables." | 4766 "Activate all customizations on local variables." |
4633 (interactive) | 4767 (interactive) |
4634 (vhdl-mode-map-init) | 4768 (vhdl-mode-map-init) |
5233 (save-excursion | 5367 (save-excursion |
5234 (let ((state (parse-partial-sexp (vhdl-point 'bol) (point)))) | 5368 (let ((state (parse-partial-sexp (vhdl-point 'bol) (point)))) |
5235 (cond | 5369 (cond |
5236 ((nth 3 state) 'string) | 5370 ((nth 3 state) 'string) |
5237 ((nth 4 state) 'comment) | 5371 ((nth 4 state) 'comment) |
5372 ((vhdl-beginning-of-macro) 'pound) | |
5238 (t nil))))) | 5373 (t nil))))) |
5239 | 5374 |
5240 (defun vhdl-forward-comment (&optional direction) | 5375 (defun vhdl-forward-comment (&optional direction) |
5241 "Skip all comments (including whitespace). Skip backwards if DIRECTION is | 5376 "Skip all comments (including whitespace). Skip backwards if DIRECTION is |
5242 negative, skip forward otherwise." | 5377 negative, skip forward otherwise." |
5315 ;; used for backward skipping, (point-max) is used for forward | 5450 ;; used for backward skipping, (point-max) is used for forward |
5316 ;; skipping. | 5451 ;; skipping. |
5317 | 5452 |
5318 (defun vhdl-forward-syntactic-ws (&optional lim) | 5453 (defun vhdl-forward-syntactic-ws (&optional lim) |
5319 "Forward skip of syntactic whitespace." | 5454 "Forward skip of syntactic whitespace." |
5320 (save-restriction | 5455 (let* ((here (point-max)) |
5321 (let* ((lim (or lim (point-max))) | 5456 (hugenum (point-max))) |
5322 (here lim) | 5457 (while (/= here (point)) |
5323 (hugenum (point-max))) | 5458 (setq here (point)) |
5324 (narrow-to-region lim (point)) | 5459 (vhdl-forward-comment hugenum) |
5325 (while (/= here (point)) | 5460 ;; skip preprocessor directives |
5326 (setq here (point)) | 5461 (when (and (eq (char-after) ?#) |
5327 (vhdl-forward-comment hugenum))))) | 5462 (= (vhdl-point 'boi) (point))) |
5463 (while (and (eq (char-before (vhdl-point 'eol)) ?\\) | |
5464 (= (forward-line 1) 0))) | |
5465 (end-of-line))) | |
5466 (if lim (goto-char (min (point) lim))))) | |
5467 | |
5328 | 5468 |
5329 ;; This is the best we can do in Win-Emacs. | 5469 ;; This is the best we can do in Win-Emacs. |
5330 (defun vhdl-win-fsws (&optional lim) | 5470 (defun vhdl-win-fsws (&optional lim) |
5331 "Forward skip syntactic whitespace for Win-Emacs." | 5471 "Forward skip syntactic whitespace for Win-Emacs." |
5332 (let ((lim (or lim (point-max))) | 5472 (let ((lim (or lim (point-max))) |
5340 (t (setq stop t)))))) | 5480 (t (setq stop t)))))) |
5341 | 5481 |
5342 (and (string-match "Win-Emacs" emacs-version) | 5482 (and (string-match "Win-Emacs" emacs-version) |
5343 (fset 'vhdl-forward-syntactic-ws 'vhdl-win-fsws)) | 5483 (fset 'vhdl-forward-syntactic-ws 'vhdl-win-fsws)) |
5344 | 5484 |
5485 (defun vhdl-beginning-of-macro (&optional lim) | |
5486 "Go to the beginning of a cpp macro definition (nicked from `cc-engine')." | |
5487 (let ((here (point))) | |
5488 (beginning-of-line) | |
5489 (while (eq (char-before (1- (point))) ?\\) | |
5490 (forward-line -1)) | |
5491 (back-to-indentation) | |
5492 (if (and (<= (point) here) | |
5493 (eq (char-after) ?#)) | |
5494 t | |
5495 (goto-char here) | |
5496 nil))) | |
5497 | |
5345 (defun vhdl-backward-syntactic-ws (&optional lim) | 5498 (defun vhdl-backward-syntactic-ws (&optional lim) |
5346 "Backward skip over syntactic whitespace." | 5499 "Backward skip over syntactic whitespace." |
5347 (save-restriction | 5500 (let* ((here (point-min)) |
5348 (let* ((lim (or lim (point-min))) | 5501 (hugenum (- (point-max)))) |
5349 (here lim) | 5502 (while (/= here (point)) |
5350 (hugenum (- (point-max)))) | 5503 (setq here (point)) |
5351 (if (< lim (point)) | 5504 (vhdl-forward-comment hugenum) |
5352 (progn | 5505 (vhdl-beginning-of-macro)) |
5353 (narrow-to-region lim (point)) | 5506 (if lim (goto-char (max (point) lim))))) |
5354 (while (/= here (point)) | |
5355 (setq here (point)) | |
5356 (vhdl-forward-comment hugenum))))))) | |
5357 | 5507 |
5358 ;; This is the best we can do in Win-Emacs. | 5508 ;; This is the best we can do in Win-Emacs. |
5359 (defun vhdl-win-bsws (&optional lim) | 5509 (defun vhdl-win-bsws (&optional lim) |
5360 "Backward skip syntactic whitespace for Win-Emacs." | 5510 "Backward skip syntactic whitespace for Win-Emacs." |
5361 (let ((lim (or lim (vhdl-point 'bod))) | 5511 (let ((lim (or lim (vhdl-point 'bod))) |
5601 ;; make sure that the "else" isn't inside a conditional signal | 5751 ;; make sure that the "else" isn't inside a conditional signal |
5602 ;; assignment. | 5752 ;; assignment. |
5603 (save-excursion | 5753 (save-excursion |
5604 (re-search-backward ";\\|\\bwhen\\b[^_]" lim 'move) | 5754 (re-search-backward ";\\|\\bwhen\\b[^_]" lim 'move) |
5605 (or (eq (following-char) ?\;) | 5755 (or (eq (following-char) ?\;) |
5606 (eq (point) lim))))) | 5756 (eq (point) lim) |
5757 (vhdl-in-literal))))) | |
5607 | 5758 |
5608 (defun vhdl-corresponding-begin (&optional lim) | 5759 (defun vhdl-corresponding-begin (&optional lim) |
5609 "If the word at the current position corresponds to an \"end\" | 5760 "If the word at the current position corresponds to an \"end\" |
5610 keyword, then return a vector containing enough information to find | 5761 keyword, then return a vector containing enough information to find |
5611 the corresponding \"begin\" keyword, else return nil. The keyword to | 5762 the corresponding \"begin\" keyword, else return nil. The keyword to |
5670 (vector "begin\\|architecture\\|configuration\\|entity\\|package\\|procedure\\|function" | 5821 (vector "begin\\|architecture\\|configuration\\|entity\\|package\\|procedure\\|function" |
5671 (vhdl-first-word pos) | 5822 (vhdl-first-word pos) |
5672 ;; return an alist of (statement . keyword) mappings | 5823 ;; return an alist of (statement . keyword) mappings |
5673 '( | 5824 '( |
5674 ;; "begin ... end [id]": | 5825 ;; "begin ... end [id]": |
5675 ("begin" . nil) | 5826 ("begin" . nil) |
5676 ;; "architecture ... is ... begin ... end [id]": | 5827 ;; "architecture ... is ... begin ... end [id]": |
5677 ("architecture" . "is") | 5828 ("architecture" . "is") |
5678 ;; "configuration ... is ... end [id]": | 5829 ;; "configuration ... is ... end [id]": |
5679 ("configuration" . "is") | 5830 ("configuration" . "is") |
5680 ;; "entity ... is ... end [id]": | 5831 ;; "entity ... is ... end [id]": |
5681 ("entity" . "is") | 5832 ("entity" . "is") |
5682 ;; "package ... is ... end [id]": | 5833 ;; "package ... is ... end [id]": |
5683 ("package" . "is") | 5834 ("package" . "is") |
5684 ;; "procedure ... is ... begin ... end [id]": | 5835 ;; "procedure ... is ... begin ... end [id]": |
5685 ("procedure" . "is") | 5836 ("procedure" . "is") |
5686 ;; "function ... is ... begin ... end [id]": | 5837 ;; "function ... is ... begin ... end [id]": |
5687 ("function" . "is") | 5838 ("function" . "is") |
5688 ) | 5839 ) |
5719 (point)) | 5870 (point)) |
5720 (t nil) | 5871 (t nil) |
5721 ))) | 5872 ))) |
5722 | 5873 |
5723 (defconst vhdl-trailer-re | 5874 (defconst vhdl-trailer-re |
5724 "\\b\\(is\\|then\\|generate\\|loop\\)\\b[^_]") | 5875 "\\b\\(is\\|then\\|generate\\|loop\\|record\\)\\b[^_]") |
5725 | 5876 |
5726 (defconst vhdl-statement-fwd-re | 5877 (defconst vhdl-statement-fwd-re |
5727 "\\b\\(if\\|for\\|while\\)\\b\\([^_]\\|\\'\\)" | 5878 "\\b\\(if\\|for\\|while\\)\\b\\([^_]\\|\\'\\)" |
5728 "A regular expression for searching forward that matches all known | 5879 "A regular expression for searching forward that matches all known |
5729 \"statement\" keywords.") | 5880 \"statement\" keywords.") |
6074 With argument, do it that many times. | 6225 With argument, do it that many times. |
6075 Returns the location of the corresponding begin keyword, unless search | 6226 Returns the location of the corresponding begin keyword, unless search |
6076 stops due to beginning or end of buffer." | 6227 stops due to beginning or end of buffer." |
6077 ;; Note that if point is between the "defun" keyword and the | 6228 ;; Note that if point is between the "defun" keyword and the |
6078 ;; corresponding "begin" keyword, then that defun will not be | 6229 ;; corresponding "begin" keyword, then that defun will not be |
6079 ;; recognised, and the search will continue backwards. If point is | 6230 ;; recognized, and the search will continue backwards. If point is |
6080 ;; at the "begin" keyword, then the defun will be recognised. The | 6231 ;; at the "begin" keyword, then the defun will be recognized. The |
6081 ;; returned point is at the first character of the "defun" keyword. | 6232 ;; returned point is at the first character of the "defun" keyword. |
6082 (interactive "p") | 6233 (interactive "p") |
6083 (let ((count (or count 1)) | 6234 (let ((count (or count 1)) |
6084 (case-fold-search t) | 6235 (case-fold-search t) |
6085 (last-forward (point)) | 6236 (last-forward (point)) |
6136 beginning of a statement then go to the beginning of the preceding | 6287 beginning of a statement then go to the beginning of the preceding |
6137 one. If within a string or comment, or next to a comment (only | 6288 one. If within a string or comment, or next to a comment (only |
6138 whitespace between), move by sentences instead of statements. | 6289 whitespace between), move by sentences instead of statements. |
6139 | 6290 |
6140 When called from a program, this function takes 3 optional args: the | 6291 When called from a program, this function takes 3 optional args: the |
6141 prefix arg, and a buffer position limit which is the farthest back to | 6292 prefix arg, a buffer position limit which is the farthest back to |
6142 search, and something whose meaning I don't understand." | 6293 search, and an argument indicating an interactive call." |
6143 (interactive "p\np") | 6294 (interactive "p\np") |
6144 (let ((count (or count 1)) | 6295 (let ((count (or count 1)) |
6145 (case-fold-search t) | 6296 (case-fold-search t) |
6146 (lim (or lim (point-min))) | 6297 (lim (or lim (point-min))) |
6147 (here (point)) | 6298 (here (point)) |
6696 ;; now we need to look at any modifiers | 6847 ;; now we need to look at any modifiers |
6697 (goto-char indent-point) | 6848 (goto-char indent-point) |
6698 (skip-chars-forward " \t") | 6849 (skip-chars-forward " \t") |
6699 (if (looking-at "--") | 6850 (if (looking-at "--") |
6700 (vhdl-add-syntax 'comment)) | 6851 (vhdl-add-syntax 'comment)) |
6852 (if (eq literal 'pound) | |
6853 (vhdl-add-syntax 'cpp-macro)) | |
6701 ;; return the syntax | 6854 ;; return the syntax |
6702 vhdl-syntactic-context)))) | 6855 vhdl-syntactic-context)))) |
6703 | 6856 |
6704 ;; Standard indentation line-ups: | 6857 ;; Standard indentation line-ups: |
6705 | 6858 |
6771 (if (not (bolp)) | 6924 (if (not (bolp)) |
6772 (or (car-safe vhdl-comment-only-line-offset) | 6925 (or (car-safe vhdl-comment-only-line-offset) |
6773 vhdl-comment-only-line-offset) | 6926 vhdl-comment-only-line-offset) |
6774 (or (cdr-safe vhdl-comment-only-line-offset) | 6927 (or (cdr-safe vhdl-comment-only-line-offset) |
6775 (car-safe vhdl-comment-only-line-offset) | 6928 (car-safe vhdl-comment-only-line-offset) |
6776 -1000 ;jam it against the left side | 6929 -1000 ;jam it against the left side |
6777 ))))) | 6930 ))))) |
6778 | 6931 |
6779 (defun vhdl-lineup-statement-cont (langelem) | 6932 (defun vhdl-lineup-statement-cont (langelem) |
6780 "Line up statement-cont after the assignment operator." | 6933 "Line up statement-cont after the assignment operator." |
6781 (save-excursion | 6934 (save-excursion |
7465 (save-excursion | 7618 (save-excursion |
7466 (goto-char end) | 7619 (goto-char end) |
7467 (setq end (point-marker)) | 7620 (setq end (point-marker)) |
7468 ;; have no space before and one space after `,' and ';' | 7621 ;; have no space before and one space after `,' and ';' |
7469 (goto-char beg) | 7622 (goto-char beg) |
7470 (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\)\\|\\(\\s-*\\([,;]\\)\\)" end t) | 7623 (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|\'.\'\\)\\|\\(\\s-*\\([,;]\\)\\)" end t) |
7471 (if (match-string 1) | 7624 (if (match-string 1) |
7472 (goto-char (match-end 1)) | 7625 (goto-char (match-end 1)) |
7473 (replace-match "\\3 " nil nil nil 3))) | 7626 (replace-match "\\3 " nil nil nil 3))) |
7474 ;; have no space after `(' | 7627 ;; have no space after `(' |
7475 (goto-char beg) | 7628 (goto-char beg) |
7476 (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\)\\|\\((\\)\\s-+" end t) | 7629 (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|\'.\'\\)\\|\\((\\)\\s-+" end t) |
7477 (if (match-string 1) | 7630 (if (match-string 1) |
7478 (goto-char (match-end 1)) | 7631 (goto-char (match-end 1)) |
7479 (replace-match "\\2"))) | 7632 (replace-match "\\2"))) |
7480 ;; have no space before `)' | 7633 ;; have no space before `)' |
7481 (goto-char beg) | 7634 (goto-char beg) |
7482 (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|^\\s-+\\)\\|\\s-+\\()\\)" end t) | 7635 (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|\'.\'\\|^\\s-+\\)\\|\\s-+\\()\\)" end t) |
7483 (if (match-string 1) | 7636 (if (match-string 1) |
7484 (goto-char (match-end 1)) | 7637 (goto-char (match-end 1)) |
7485 (replace-match "\\2"))) | 7638 (replace-match "\\2"))) |
7486 ;; surround operator symbols by one space | 7639 ;; surround operator symbols by one space |
7487 (goto-char beg) | 7640 (goto-char beg) |
7488 (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\)\\|\\(\\([^/:<>=]\\)\\(:\\|=\\|<\\|>\\|:=\\|<=\\|>=\\|=>\\|/=\\)\\([^=>]\\|$\\)\\)" end t) | 7641 (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|\'.\'\\)\\|\\(\\([^/:<>=]\\)\\(:\\|=\\|<\\|>\\|:=\\|<=\\|>=\\|=>\\|/=\\)\\([^=>]\\|$\\)\\)" end t) |
7489 (if (match-string 1) | 7642 (if (match-string 1) |
7490 (goto-char (match-end 1)) | 7643 (goto-char (match-end 1)) |
7491 (save-excursion | 7644 (replace-match "\\3 \\4 \\5") |
7492 (goto-char (match-beginning 4)) | 7645 (goto-char (match-end 2)))) |
7493 (unless (eq (preceding-char) ?\ ) | |
7494 (insert " ")) | |
7495 (goto-char (match-end 4)) | |
7496 (unless (eq (following-char) ?\ ) | |
7497 (insert " "))) | |
7498 (goto-char (match-end 4)))) | |
7499 ;; eliminate multiple spaces and spaces at end of line | 7646 ;; eliminate multiple spaces and spaces at end of line |
7500 (goto-char beg) | 7647 (goto-char beg) |
7501 (while (or (and (looking-at "--.*\n") (re-search-forward "--.*\n" end t)) | 7648 (while (or (and (looking-at "--.*\n") (re-search-forward "--.*\n" end t)) |
7502 (and (looking-at "\"") (re-search-forward "\"[^\"\n]*[\"\n]" end t)) | 7649 (and (looking-at "\"") (re-search-forward "\"[^\"\n]*[\"\n]" end t)) |
7503 (and (looking-at "\\s-+$") (re-search-forward "\\s-+$" end t) | 7650 (and (looking-at "\\s-+$") (re-search-forward "\\s-+$" end t) |
7507 (and (looking-at "^\\s-+") (re-search-forward "^\\s-+" end t)) | 7654 (and (looking-at "^\\s-+") (re-search-forward "^\\s-+" end t)) |
7508 (and (looking-at "\\s-+--") (re-search-forward "\\s-+" end t) | 7655 (and (looking-at "\\s-+--") (re-search-forward "\\s-+" end t) |
7509 (progn (replace-match " " nil nil) t)) | 7656 (progn (replace-match " " nil nil) t)) |
7510 (and (looking-at "\\s-+") (re-search-forward "\\s-+" end t) | 7657 (and (looking-at "\\s-+") (re-search-forward "\\s-+" end t) |
7511 (progn (replace-match " " nil nil) t)) | 7658 (progn (replace-match " " nil nil) t)) |
7512 (re-search-forward "[^ \t-]+" end t)))) | 7659 ; (re-search-forward "[^ \t-]+" end t)))) |
7660 (re-search-forward "[^ \t\"-]+" end t)))) | |
7513 (unless no-message (message "Fixing up whitespace...done"))) | 7661 (unless no-message (message "Fixing up whitespace...done"))) |
7514 | 7662 |
7515 (defun vhdl-fixup-whitespace-buffer () | 7663 (defun vhdl-fixup-whitespace-buffer () |
7516 "Fixup whitespace in buffer. Surround operator symbols by one space, | 7664 "Fixup whitespace in buffer. Surround operator symbols by one space, |
7517 eliminate multiple spaces (except at beginning of line), eliminate spaces at | 7665 eliminate multiple spaces (except at beginning of line), eliminate spaces at |
7625 (vhdl-prepare-search-2 | 7773 (vhdl-prepare-search-2 |
7626 (goto-char (point-min)) | 7774 (goto-char (point-min)) |
7627 (message "Updating sensitivity lists...") | 7775 (message "Updating sensitivity lists...") |
7628 (while (re-search-forward "^\\s-*\\(\\w+[ \t\n]*:[ \t\n]*\\)?process\\>" nil t) | 7776 (while (re-search-forward "^\\s-*\\(\\w+[ \t\n]*:[ \t\n]*\\)?process\\>" nil t) |
7629 (goto-char (match-beginning 0)) | 7777 (goto-char (match-beginning 0)) |
7630 (condition-case nil (vhdl-update-sensitivity-list) (error))) | 7778 (condition-case nil (vhdl-update-sensitivity-list) (error ""))) |
7631 (message "Updating sensitivity lists...done")))) | 7779 (message "Updating sensitivity lists...done")))) |
7632 | 7780 |
7633 (defun vhdl-update-sensitivity-list () | 7781 (defun vhdl-update-sensitivity-list () |
7634 "Update sensitivity list." | 7782 "Update sensitivity list." |
7635 (let ((proc-beg (point)) | 7783 (let ((proc-beg (point)) |
7669 (re-search-forward "\\(\\<report\\>\\|\\<severity\\>\\|;\\)" proc-end t)) | 7817 (re-search-forward "\\(\\<report\\>\\|\\<severity\\>\\|;\\)" proc-end t)) |
7670 ;; case expression | 7818 ;; case expression |
7671 ((re-search-forward "^\\s-*case\\>" proc-end t) | 7819 ((re-search-forward "^\\s-*case\\>" proc-end t) |
7672 (re-search-forward "\\<is\\>" proc-end t)) | 7820 (re-search-forward "\\<is\\>" proc-end t)) |
7673 ;; parameter list of procedure call | 7821 ;; parameter list of procedure call |
7674 ((re-search-forward "^\\s-*\\w+[ \t\n]*(" proc-end t) | 7822 ((and (re-search-forward "^\\s-*\\w+[ \t\n]*(" proc-end t) |
7675 (progn (backward-char) (forward-sexp) (point))))) | 7823 (1- (point))) |
7824 (progn (backward-char) (forward-sexp) | |
7825 (while (looking-at "(") (forward-sexp)) (point))))) | |
7676 name read-list sens-list signal-list | 7826 name read-list sens-list signal-list |
7677 sens-beg sens-end beg end margin) | 7827 sens-beg sens-end beg end margin) |
7678 ;; scan for signals in old sensitivity list | 7828 ;; scan for signals in old sensitivity list |
7679 (goto-char proc-beg) | 7829 (goto-char proc-beg) |
7680 (re-search-forward "\\<process\\>" proc-mid t) | 7830 (re-search-forward "\\<process\\>" proc-mid t) |
7711 (let ((tmp-list seq-region-list)) | 7861 (let ((tmp-list seq-region-list)) |
7712 (while (and tmp-list | 7862 (while (and tmp-list |
7713 (< (point) (caar tmp-list))) | 7863 (< (point) (caar tmp-list))) |
7714 (setq tmp-list (cdr tmp-list))) | 7864 (setq tmp-list (cdr tmp-list))) |
7715 (and tmp-list (< (point) (cdar tmp-list)))))) | 7865 (and tmp-list (< (point) (cdar tmp-list)))))) |
7716 (while (vhdl-re-search-forward "[^'\"]\\<\\([a-zA-Z]\\w*\\)\\>" end t) | 7866 (while (vhdl-re-search-forward "[^'\"]\\<\\([a-zA-Z]\\w*\\)\\>[ \t\n]*\\('\\(\\w+\\)\\|\\(=>\\)\\)?" end t) |
7717 (setq name (match-string 1)) | 7867 (setq name (match-string 1)) |
7718 (when (member (downcase name) signal-list) | 7868 (when (and (not (match-string 4)) ; not when formal parameter |
7719 (add-to-list 'read-list name))))) | 7869 (not (and (match-string 3) ; not event attribute |
7870 (not (member (downcase (match-string 3)) | |
7871 '("event" "last_event" "transaction"))))) | |
7872 (member (downcase name) signal-list)) | |
7873 (unless (member-ignore-case name read-list) | |
7874 (setq read-list (cons name read-list)))) | |
7875 (goto-char (match-end 1))))) | |
7720 (setq scan-regions-list (cdr scan-regions-list))) | 7876 (setq scan-regions-list (cdr scan-regions-list))) |
7721 ;; update sensitivity list | 7877 ;; update sensitivity list |
7722 (goto-char sens-beg) | 7878 (goto-char sens-beg) |
7723 (if sens-end | 7879 (if sens-end |
7724 (delete-region sens-beg sens-end) | 7880 (delete-region sens-beg sens-end) |
7738 (insert (car read-list)) | 7894 (insert (car read-list)) |
7739 (setq read-list (cdr read-list))))))))) | 7895 (setq read-list (cdr read-list))))))))) |
7740 | 7896 |
7741 (defun vhdl-get-visible-signals () | 7897 (defun vhdl-get-visible-signals () |
7742 "Get all signals visible in the current block." | 7898 "Get all signals visible in the current block." |
7743 (save-excursion | 7899 (let (beg end signal-list entity-name file-name) |
7744 (let (beg end signal-list entity-name file-name) | 7900 (vhdl-prepare-search-2 |
7745 ;; search for signals declared in surrounding block declarative parts | 7901 ;; get entity name |
7746 (save-excursion | 7902 (save-excursion |
7747 (while (and (progn (while (and (setq beg (re-search-backward "^\\s-*\\(\\w+\\s-*:\\s-*block\\|\\(end\\)\\s-+block\\)\\>" nil t)) | 7903 (unless (and (re-search-backward "^\\(architecture\\s-+\\w+\\s-+of\\s-+\\(\\w+\\)\\|end\\)\\>" nil t) |
7748 (match-string 2)) | |
7749 (goto-char (match-end 2)) | |
7750 (vhdl-backward-sexp) | |
7751 (re-search-backward "^\\s-*\\w+\\s-*:\\s-*block\\>" nil t)) | |
7752 beg) | |
7753 (setq end (re-search-forward "^\\s-*begin\\>" nil t))) | |
7754 ;; scan for all declared signal names | |
7755 (goto-char beg) | |
7756 (while (re-search-forward "^\\s-*signal\\>" end t) | |
7757 (while (and (not (looking-at "[ \t\n]*:")) | |
7758 (re-search-forward "[ \t\n,]+\\(\\w+\\)" end t)) | |
7759 (setq signal-list | |
7760 (cons (downcase (match-string 1)) signal-list)))) | |
7761 (goto-char beg))) | |
7762 ;; search for signals declared in architecture declarative part | |
7763 (if (not (and (setq beg (re-search-backward "^\\(architecture\\s-+\\w+\\s-+of\\s-+\\(\\w+\\)\\|end\\)\\>" nil t)) | |
7764 (not (equal "END" (upcase (match-string 1)))) | 7904 (not (equal "END" (upcase (match-string 1)))) |
7765 (setq entity-name (match-string 2)) | 7905 (setq entity-name (match-string 2))) |
7766 (setq end (re-search-forward "^begin\\>" nil t)))) | 7906 (error "ERROR: Not within an architecture"))) |
7767 (error "ERROR: No architecture declarative part found") | 7907 ;; search for signals declared in entity port clause |
7768 ;; scan for all declared signal names | 7908 (save-excursion |
7769 (goto-char beg) | 7909 (goto-char (point-min)) |
7770 (while (re-search-forward "^\\s-*signal\\>" end t) | 7910 (unless (re-search-forward (concat "^entity\\s-+" entity-name "\\>") nil t) |
7771 (while (and (not (looking-at "[ \t\n]*:")) | 7911 (setq file-name |
7772 (re-search-forward "[ \t\n,]+\\(\\w+\\)" end t)) | 7912 (concat (vhdl-replace-string vhdl-entity-file-name entity-name t) |
7773 (setq signal-list | 7913 "." (file-name-extension (buffer-file-name))))) |
7774 (cons (downcase (match-string 1)) signal-list))))) | 7914 (vhdl-visit-file |
7775 ;; search for signals declared in entity port clause | 7915 file-name t |
7776 (goto-char (point-min)) | 7916 (vhdl-prepare-search-2 |
7777 (unless (re-search-forward (concat "^entity\\s-+" entity-name "\\>") nil t) | 7917 (goto-char (point-min)) |
7778 (setq file-name | 7918 (if (not (re-search-forward (concat "^entity\\s-+" entity-name "\\>") nil t)) |
7779 (concat (vhdl-replace-string vhdl-entity-file-name entity-name) | 7919 (error "ERROR: Entity \"%s\" not found:\n --> see option `vhdl-entity-file-name'" entity-name) |
7780 "." (file-name-extension (buffer-file-name))))) | 7920 (when (setq beg (re-search-forward |
7781 (vhdl-visit-file | 7921 "^\\s-*port[ \t\n]*(" |
7782 file-name t | 7922 (save-excursion |
7783 (vhdl-prepare-search-2 | 7923 (re-search-forward "^end\\>" nil t)) t)) |
7784 (goto-char (point-min)) | 7924 (setq end (save-excursion |
7785 (if (not (re-search-forward (concat "^entity\\s-+" entity-name "\\>") nil t)) | 7925 (backward-char) (forward-sexp) (point))) |
7786 (error "ERROR: Entity \"%s\" not found:\n --> see option `vhdl-entity-file-name'" entity-name) | 7926 (vhdl-forward-syntactic-ws) |
7787 (when (setq beg (re-search-forward | 7927 (while (< (point) end) |
7788 "^\\s-*port[ \t\n]*(" | 7928 (when (looking-at "signal[ \t\n]+") |
7789 (save-excursion | 7929 (goto-char (match-end 0))) |
7790 (re-search-forward "^end\\>" nil t)) t)) | 7930 (while (looking-at "\\(\\w+\\)[ \t\n,]+") |
7791 (setq end (save-excursion | 7931 (setq signal-list |
7792 (backward-char) (forward-sexp) (point))) | 7932 (cons (downcase (match-string 1)) signal-list)) |
7793 (vhdl-forward-syntactic-ws) | 7933 (goto-char (match-end 0)) |
7794 (while (< (point) end) | 7934 (vhdl-forward-syntactic-ws)) |
7795 (while (and (not (looking-at "[ \t\n]*:")) | 7935 (re-search-forward ";" end 1) |
7796 (re-search-forward "[ \t\n,]*\\(\\w+\\)" end t)) | 7936 (vhdl-forward-syntactic-ws))))))) |
7797 (setq signal-list | 7937 ;; search for signals declared in architecture declarative part |
7798 (cons (downcase (match-string 1)) signal-list))) | 7938 (save-excursion |
7799 (re-search-forward ";" end 1) | 7939 (if (not (and (setq beg (re-search-backward "^\\(architecture\\s-+\\w+\\s-+of\\s-+\\(\\w+\\)\\|end\\)\\>" nil t)) |
7800 (vhdl-forward-syntactic-ws)))))) | 7940 (not (equal "END" (upcase (match-string 1)))) |
7801 signal-list))) | 7941 (setq end (re-search-forward "^begin\\>" nil t)))) |
7942 (error "ERROR: No architecture declarative part found") | |
7943 ;; scan for all declared signal and alias names | |
7944 (goto-char beg) | |
7945 (while (re-search-forward "^\\s-*\\(\\(signal\\)\\|alias\\)\\>" end t) | |
7946 (when (= 0 (nth 0 (parse-partial-sexp beg (point)))) | |
7947 (if (match-string 2) | |
7948 ;; scan signal name | |
7949 (while (looking-at "[ \t\n,]+\\(\\w+\\)") | |
7950 (setq signal-list | |
7951 (cons (downcase (match-string 1)) signal-list)) | |
7952 (goto-char (match-end 0))) | |
7953 ;; scan alias name, check is alias of (declared) signal | |
7954 (when (and (looking-at "[ \t\n]+\\(\\w+\\)[^;]*\\<is[ \t\n]+\\(\\w+\\)") | |
7955 (member (downcase (match-string 2)) signal-list)) | |
7956 (setq signal-list | |
7957 (cons (downcase (match-string 1)) signal-list)) | |
7958 (goto-char (match-end 0)))) | |
7959 (setq beg (point)))))) | |
7960 ;; search for signals declared in surrounding block declarative parts | |
7961 (save-excursion | |
7962 (while (and (progn (while (and (setq beg (re-search-backward "^\\s-*\\(\\w+\\s-*:\\s-*block\\|\\(end\\)\\s-+block\\)\\>" nil t)) | |
7963 (match-string 2)) | |
7964 (goto-char (match-end 2)) | |
7965 (vhdl-backward-sexp) | |
7966 (re-search-backward "^\\s-*\\w+\\s-*:\\s-*block\\>" nil t)) | |
7967 beg) | |
7968 (setq end (re-search-forward "^\\s-*begin\\>" nil t))) | |
7969 ;; scan for all declared signal names | |
7970 (goto-char beg) | |
7971 (while (re-search-forward "^\\s-*\\(\\(signal\\)\\|alias\\)\\>" end t) | |
7972 (when (= 0 (nth 0 (parse-partial-sexp beg (point)))) | |
7973 (if (match-string 2) | |
7974 ;; scan signal name | |
7975 (while (looking-at "[ \t\n,]+\\(\\w+\\)") | |
7976 (setq signal-list | |
7977 (cons (downcase (match-string 1)) signal-list)) | |
7978 (goto-char (match-end 0))) | |
7979 ;; scan alias name, check is alias of (declared) signal | |
7980 (when (and (looking-at "[ \t\n]+\\(\\w+\\)[^;]*\\<is[ \t\n]+\\(\\w+\\)") | |
7981 (member (downcase (match-string 2)) signal-list)) | |
7982 (setq signal-list | |
7983 (cons (downcase (match-string 1)) signal-list)) | |
7984 (goto-char (match-end 0)))))) | |
7985 (goto-char beg))) | |
7986 signal-list))) | |
7802 | 7987 |
7803 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 7988 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
7804 ;; Generic/port clause fixing | 7989 ;; Generic/port clause fixing |
7805 | 7990 |
7806 (defun vhdl-fix-clause () | 7991 (defun vhdl-fix-clause () |
9618 (concat "^\\s-*\\(\\(library\\)\\s-+\\(\\w+\\s-*,\\s-*\\)*" | 9803 (concat "^\\s-*\\(\\(library\\)\\s-+\\(\\w+\\s-*,\\s-*\\)*" |
9619 library "\\|end\\)\\>") nil t) | 9804 library "\\|end\\)\\>") nil t) |
9620 (match-string 2)))) | 9805 (match-string 2)))) |
9621 (equal (downcase library) "work")) | 9806 (equal (downcase library) "work")) |
9622 (vhdl-insert-keyword "LIBRARY ") | 9807 (vhdl-insert-keyword "LIBRARY ") |
9623 (insert library ";\n") | 9808 (insert library ";") |
9624 (indent-to margin)) | 9809 (when package |
9625 (vhdl-insert-keyword "USE ") | 9810 (insert "\n") |
9626 (insert library "." package) | 9811 (indent-to margin))) |
9627 (vhdl-insert-keyword ".ALL;")))) | 9812 (when package |
9813 (vhdl-insert-keyword "USE ") | |
9814 (insert library "." package) | |
9815 (vhdl-insert-keyword ".ALL;"))))) | |
9628 | 9816 |
9629 (defun vhdl-template-package-math-complex () | 9817 (defun vhdl-template-package-math-complex () |
9630 "Insert specification of `math_complex' package." | 9818 "Insert specification of `math_complex' package." |
9631 (interactive) | 9819 (interactive) |
9632 (vhdl-template-standard-package "ieee" "math_complex")) | 9820 (vhdl-template-standard-package "ieee" "math_complex")) |
10321 ;; not consider subprogram declarations | 10509 ;; not consider subprogram declarations |
10322 (or (and (match-string 5) | 10510 (or (and (match-string 5) |
10323 (save-match-data | 10511 (save-match-data |
10324 (save-excursion | 10512 (save-excursion |
10325 (goto-char (match-end 5)) | 10513 (goto-char (match-end 5)) |
10326 (forward-word 1) (forward-sexp) | 10514 (forward-word 1) |
10515 (vhdl-forward-syntactic-ws) | |
10516 (when (looking-at "(") | |
10517 (forward-sexp)) | |
10327 (re-search-forward "\\<is\\>\\|\\(;\\)" nil t)) | 10518 (re-search-forward "\\<is\\>\\|\\(;\\)" nil t)) |
10328 (match-string 1))) | 10519 (match-string 1))) |
10329 ;; not consider configuration specifications | 10520 ;; not consider configuration specifications |
10330 (and (match-string 6) | 10521 (and (match-string 6) |
10331 (save-match-data | 10522 (save-match-data |
10681 (unless optional | 10872 (unless optional |
10682 (throw 'parse (format "ERROR: Syntax error near line %s, expecting \"%s\"" | 10873 (throw 'parse (format "ERROR: Syntax error near line %s, expecting \"%s\"" |
10683 (vhdl-current-line) string))) | 10874 (vhdl-current-line) string))) |
10684 nil)) | 10875 nil)) |
10685 | 10876 |
10686 (defun vhdl-replace-string (regexp-cons string) | 10877 (defun vhdl-replace-string (regexp-cons string &optional adjust-case) |
10687 "Replace STRING from car of REGEXP-CONS to cdr of REGEXP-CONS." | 10878 "Replace STRING from car of REGEXP-CONS to cdr of REGEXP-CONS." |
10688 (vhdl-prepare-search-1 | 10879 (vhdl-prepare-search-1 |
10689 (if (string-match (car regexp-cons) string) | 10880 (if (string-match (car regexp-cons) string) |
10690 (funcall vhdl-file-name-case | 10881 (if adjust-case |
10691 (replace-match (cdr regexp-cons) t nil string)) | 10882 (funcall vhdl-file-name-case |
10883 (replace-match (cdr regexp-cons) t nil string)) | |
10884 (replace-match (cdr regexp-cons) t nil string)) | |
10692 string))) | 10885 string))) |
10693 | 10886 |
10694 (defun vhdl-parse-group-comment () | 10887 (defun vhdl-parse-group-comment () |
10695 "Parse comment and empty lines between groups of lines." | 10888 "Parse comment and empty lines between groups of lines." |
10696 (let ((start (point)) | 10889 (let ((start (point)) |
10697 string) | 10890 string) |
10698 (vhdl-forward-comment (point-max)) | 10891 (vhdl-forward-comment (point-max)) |
10699 (setq string (buffer-substring-no-properties start (point))) | 10892 (setq string (buffer-substring-no-properties start (point))) |
10893 (vhdl-forward-syntactic-ws) | |
10700 ;; strip off leading blanks and first newline | 10894 ;; strip off leading blanks and first newline |
10701 (while (string-match "^\\(\\s-+\\)" string) | 10895 (while (string-match "^\\(\\s-+\\)" string) |
10702 (setq string (concat (substring string 0 (match-beginning 1)) | 10896 (setq string (concat (substring string 0 (match-beginning 1)) |
10703 (substring string (match-end 1))))) | 10897 (substring string (match-end 1))))) |
10704 (if (and (not (equal string "")) (equal (substring string 0 1) "\n")) | 10898 (if (and (not (equal string "")) (equal (substring string 0 1) "\n")) |
10720 | 10914 |
10721 (defvar vhdl-port-flattened nil | 10915 (defvar vhdl-port-flattened nil |
10722 "Indicates whether a port has been flattened.") | 10916 "Indicates whether a port has been flattened.") |
10723 | 10917 |
10724 (defun vhdl-port-flatten (&optional as-alist) | 10918 (defun vhdl-port-flatten (&optional as-alist) |
10725 "Flatten port list so that only one generic/port exists per line." | 10919 "Flatten port list so that only one generic/port exists per line. |
10920 This operation is performed on an internally stored port and is only | |
10921 reflected in a subsequent paste operation." | |
10726 (interactive) | 10922 (interactive) |
10727 (if (not vhdl-port-list) | 10923 (if (not vhdl-port-list) |
10728 (error "ERROR: No port has been read") | 10924 (error "ERROR: No port has been read") |
10729 (message "Flattening port...") | 10925 (message "Flattening port for next paste...") |
10730 (let ((new-vhdl-port-list (list (car vhdl-port-list))) | 10926 (let ((new-vhdl-port-list (list (car vhdl-port-list))) |
10731 (old-vhdl-port-list (cdr vhdl-port-list)) | 10927 (old-vhdl-port-list (cdr vhdl-port-list)) |
10732 old-port-list new-port-list old-port new-port names) | 10928 old-port-list new-port-list old-port new-port names) |
10733 ;; traverse port list and flatten entries | 10929 ;; traverse port list and flatten entries |
10734 (while (cdr old-vhdl-port-list) | 10930 (while (cdr old-vhdl-port-list) |
10747 (setq new-vhdl-port-list (append new-vhdl-port-list | 10943 (setq new-vhdl-port-list (append new-vhdl-port-list |
10748 (list new-port-list)))) | 10944 (list new-port-list)))) |
10749 (setq vhdl-port-list | 10945 (setq vhdl-port-list |
10750 (append new-vhdl-port-list (list old-vhdl-port-list)) | 10946 (append new-vhdl-port-list (list old-vhdl-port-list)) |
10751 vhdl-port-flattened t) | 10947 vhdl-port-flattened t) |
10752 (message "Flattening port...done")))) | 10948 (message "Flattening port for next paste...done")))) |
10753 | 10949 |
10754 (defvar vhdl-port-reversed-direction nil | 10950 (defvar vhdl-port-reversed-direction nil |
10755 "Indicates whether port directions are reversed.") | 10951 "Indicates whether port directions are reversed.") |
10756 | 10952 |
10757 (defun vhdl-port-reverse-direction () | 10953 (defun vhdl-port-reverse-direction () |
10758 "Reverse direction for all ports (useful in testbenches)." | 10954 "Reverse direction for all ports (useful in testbenches). |
10955 This operation is performed on an internally stored port and is only | |
10956 reflected in a subsequent paste operation." | |
10759 (interactive) | 10957 (interactive) |
10760 (if (not vhdl-port-list) | 10958 (if (not vhdl-port-list) |
10761 (error "ERROR: No port has been read") | 10959 (error "ERROR: No port has been read") |
10762 (message "Reversing port directions...") | 10960 (message "Reversing port directions for next paste...") |
10763 (let ((port-list (nth 2 vhdl-port-list)) | 10961 (let ((port-list (nth 2 vhdl-port-list)) |
10764 port-dir-car port-dir) | 10962 port-dir-car port-dir) |
10765 ;; traverse port list and reverse directions | 10963 ;; traverse port list and reverse directions |
10766 (while port-list | 10964 (while port-list |
10767 (setq port-dir-car (cddr (car port-list)) | 10965 (setq port-dir-car (cddr (car port-list)) |
10770 (cond ((equal port-dir "in") "out") | 10968 (cond ((equal port-dir "in") "out") |
10771 ((equal port-dir "out") "in") | 10969 ((equal port-dir "out") "in") |
10772 (t port-dir))) | 10970 (t port-dir))) |
10773 (setq port-list (cdr port-list))) | 10971 (setq port-list (cdr port-list))) |
10774 (setq vhdl-port-reversed-direction (not vhdl-port-reversed-direction)) | 10972 (setq vhdl-port-reversed-direction (not vhdl-port-reversed-direction)) |
10775 (message "Reversing port directions...done")))) | 10973 (message "Reversing port directions for next paste...done")))) |
10776 | 10974 |
10777 (defun vhdl-port-copy () | 10975 (defun vhdl-port-copy () |
10778 "Get generic and port information from an entity or component declaration." | 10976 "Get generic and port information from an entity or component declaration." |
10779 (interactive) | 10977 (interactive) |
10780 (save-excursion | 10978 (save-excursion |
10801 (when (vhdl-parse-string "generic[ \t\n]*(" t) | 10999 (when (vhdl-parse-string "generic[ \t\n]*(" t) |
10802 ;; parse group comment and spacing | 11000 ;; parse group comment and spacing |
10803 (setq group-comment (vhdl-parse-group-comment)) | 11001 (setq group-comment (vhdl-parse-group-comment)) |
10804 (setq end-of-list (vhdl-parse-string ")[ \t\n]*;[ \t\n]*" t)) | 11002 (setq end-of-list (vhdl-parse-string ")[ \t\n]*;[ \t\n]*" t)) |
10805 (while (not end-of-list) | 11003 (while (not end-of-list) |
10806 ;; parse names | 11004 ;; parse names (accept extended identifiers) |
10807 (vhdl-parse-string "\\(\\w+\\)[ \t\n]*") | 11005 (vhdl-parse-string "\\(\\w+\\|\\\\[^\\]+\\\\\\)[ \t\n]*") |
10808 (setq names (list (match-string-no-properties 1))) | 11006 (setq names (list (match-string-no-properties 1))) |
10809 (while (vhdl-parse-string ",[ \t\n]*\\(\\w+\\)[ \t\n]*" t) | 11007 (while (vhdl-parse-string ",[ \t\n]*\\(\\w+\\)[ \t\n]*" t) |
10810 (setq names | 11008 (setq names |
10811 (append names (list (match-string-no-properties 1))))) | 11009 (append names (list (match-string-no-properties 1))))) |
10812 ;; parse type | 11010 ;; parse type |
10868 (setq group-comment (vhdl-parse-group-comment)) | 11066 (setq group-comment (vhdl-parse-group-comment)) |
10869 (setq end-of-list (vhdl-parse-string ")[ \t\n]*;[ \t\n]*" t)) | 11067 (setq end-of-list (vhdl-parse-string ")[ \t\n]*;[ \t\n]*" t)) |
10870 (while (not end-of-list) | 11068 (while (not end-of-list) |
10871 ;; parse object | 11069 ;; parse object |
10872 (setq object | 11070 (setq object |
10873 (and (vhdl-parse-string "\\(signal\\|quantity\\|terminal\\)[ \t\n]*" t) | 11071 (and (vhdl-parse-string "\\<\\(signal\\|quantity\\|terminal\\)\\>[ \t\n]*" t) |
10874 (match-string-no-properties 1))) | 11072 (match-string-no-properties 1))) |
10875 ;; parse names (accept extended identifiers) | 11073 ;; parse names (accept extended identifiers) |
10876 (vhdl-parse-string "\\(\\w+\\|\\\\[^\\]+\\\\\\)[ \t\n]*") | 11074 (vhdl-parse-string "\\(\\w+\\|\\\\[^\\]+\\\\\\)[ \t\n]*") |
10877 (setq names (list (match-string-no-properties 1))) | 11075 (setq names (list (match-string-no-properties 1))) |
10878 (while (vhdl-parse-string ",[ \t\n]*\\(\\w+\\|\\\\[^\\]+\\\\\\)[ \t\n]*" t) | 11076 (while (vhdl-parse-string ",[ \t\n]*\\(\\w+\\|\\\\[^\\]+\\\\\\)[ \t\n]*" t) |
10879 (setq names (append names (list (match-string-no-properties 1))))) | 11077 (setq names (append names (list (match-string-no-properties 1))))) |
10880 ;; parse direction | 11078 ;; parse direction |
10881 (vhdl-parse-string ":[ \t\n]*") | 11079 (vhdl-parse-string ":[ \t\n]*") |
10882 (setq direct | 11080 (setq direct |
10883 (and (vhdl-parse-string "\\(in\\|out\\|inout\\|buffer\\|linkage\\)[ \t\n]+" t) | 11081 (and (vhdl-parse-string "\\<\\(in\\|out\\|inout\\|buffer\\|linkage\\)\\>[ \t\n]+" t) |
10884 (match-string-no-properties 1))) | 11082 (match-string-no-properties 1))) |
10885 ;; parse type | 11083 ;; parse type |
10886 (vhdl-parse-string "\\([^();\n]+\\)") | 11084 (vhdl-parse-string "\\([^();\n]+\\)") |
10887 (setq type (match-string-no-properties 1)) | 11085 (setq type (match-string-no-properties 1)) |
10888 (setq comment nil) | 11086 (setq comment nil) |
11095 (while generic-list | 11293 (while generic-list |
11096 (insert (if no-constants | 11294 (insert (if no-constants |
11097 (car (nth 0 (car generic-list))) | 11295 (car (nth 0 (car generic-list))) |
11098 (or (nth 2 (car generic-list)) " "))) | 11296 (or (nth 2 (car generic-list)) " "))) |
11099 (setq generic-list (cdr generic-list)) | 11297 (setq generic-list (cdr generic-list)) |
11100 (insert (if generic-list ", " ")"))) | 11298 (insert (if generic-list ", " ")")) |
11299 (when (and (not generic-list) secondary | |
11300 (null (nth 2 vhdl-port-list))) | |
11301 (insert ";"))) | |
11101 (unless vhdl-argument-list-indent | 11302 (unless vhdl-argument-list-indent |
11102 (insert "\n") (indent-to (+ margin vhdl-basic-offset))) | 11303 (insert "\n") (indent-to (+ margin vhdl-basic-offset))) |
11103 (setq list-margin (current-column)) | 11304 (setq list-margin (current-column)) |
11104 (while generic-list | 11305 (while generic-list |
11105 (setq generic (car generic-list)) | 11306 (setq generic (car generic-list)) |
11111 (if no-constants | 11312 (if no-constants |
11112 (car (nth 0 generic)) | 11313 (car (nth 0 generic)) |
11113 (or (nth 2 generic) ""))) | 11314 (or (nth 2 generic) ""))) |
11114 (setq generic-list (cdr generic-list)) | 11315 (setq generic-list (cdr generic-list)) |
11115 (insert (if generic-list "," ")")) | 11316 (insert (if generic-list "," ")")) |
11317 (when (and (not generic-list) secondary | |
11318 (null (nth 2 vhdl-port-list))) | |
11319 (insert ";")) | |
11116 ;; paste comment | 11320 ;; paste comment |
11117 (when (or vhdl-include-type-comments | 11321 (when (or vhdl-include-type-comments |
11118 (and vhdl-include-port-comments (nth 3 generic))) | 11322 (and vhdl-include-port-comments (nth 3 generic))) |
11119 (vhdl-comment-insert-inline | 11323 (vhdl-comment-insert-inline |
11120 (concat | 11324 (concat |
11138 ;; paste list of actual ports | 11342 ;; paste list of actual ports |
11139 (while port-list | 11343 (while port-list |
11140 (insert (vhdl-replace-string vhdl-actual-port-name | 11344 (insert (vhdl-replace-string vhdl-actual-port-name |
11141 (car (nth 0 (car port-list))))) | 11345 (car (nth 0 (car port-list))))) |
11142 (setq port-list (cdr port-list)) | 11346 (setq port-list (cdr port-list)) |
11143 (insert (if port-list ", " ");"))) | 11347 (insert (if port-list ", " ")"))) |
11144 (unless vhdl-argument-list-indent | 11348 (unless vhdl-argument-list-indent |
11145 (insert "\n") (indent-to (+ margin vhdl-basic-offset))) | 11349 (insert "\n") (indent-to (+ margin vhdl-basic-offset))) |
11146 (setq list-margin (current-column)) | 11350 (setq list-margin (current-column)) |
11147 (while port-list | 11351 (while port-list |
11148 (setq port (car port-list)) | 11352 (setq port (car port-list)) |
11218 (insert "\n") (indent-to (+ margin vhdl-basic-offset)) | 11422 (insert "\n") (indent-to (+ margin vhdl-basic-offset)) |
11219 (vhdl-port-paste-generic-map t t)) | 11423 (vhdl-port-paste-generic-map t t)) |
11220 (when (nth 2 vhdl-port-list) | 11424 (when (nth 2 vhdl-port-list) |
11221 (insert "\n") (indent-to (+ margin vhdl-basic-offset)) | 11425 (insert "\n") (indent-to (+ margin vhdl-basic-offset)) |
11222 (vhdl-port-paste-port-map)) | 11426 (vhdl-port-paste-port-map)) |
11427 (unless (or (nth 1 vhdl-port-list) (nth 2 vhdl-port-list)) | |
11428 (insert ";")) | |
11223 (message "Pasting port as instantiation \"%s\"...done" name)) | 11429 (message "Pasting port as instantiation \"%s\"...done" name)) |
11224 (setq vhdl-port-list orig-vhdl-port-list)))) | 11430 (setq vhdl-port-list orig-vhdl-port-list)))) |
11225 | 11431 |
11226 (defun vhdl-port-paste-constants (&optional no-indent) | 11432 (defun vhdl-port-paste-constants (&optional no-indent) |
11227 "Paste generics as constants." | 11433 "Paste generics as constants." |
11359 arch-name config-name ent-file-name arch-file-name | 11565 arch-name config-name ent-file-name arch-file-name |
11360 ent-buffer arch-buffer position) | 11566 ent-buffer arch-buffer position) |
11361 ;; open entity file | 11567 ;; open entity file |
11362 (unless (eq vhdl-testbench-create-files 'none) | 11568 (unless (eq vhdl-testbench-create-files 'none) |
11363 (setq ent-file-name | 11569 (setq ent-file-name |
11364 (concat ent-name "." (file-name-extension (buffer-file-name)))) | 11570 (concat (vhdl-replace-string vhdl-testbench-entity-file-name |
11571 ent-name t) | |
11572 "." (file-name-extension (buffer-file-name)))) | |
11365 (if (file-exists-p ent-file-name) | 11573 (if (file-exists-p ent-file-name) |
11366 (if (y-or-n-p | 11574 (if (y-or-n-p |
11367 (concat "File \"" ent-file-name "\" exists; overwrite? ")) | 11575 (concat "File \"" ent-file-name "\" exists; overwrite? ")) |
11368 (progn (find-file ent-file-name) | 11576 (progn (find-file ent-file-name) |
11369 (erase-buffer) | 11577 (erase-buffer) |
11406 ;; open architecture file | 11614 ;; open architecture file |
11407 (if (not (eq vhdl-testbench-create-files 'separate)) | 11615 (if (not (eq vhdl-testbench-create-files 'separate)) |
11408 (insert "\n") | 11616 (insert "\n") |
11409 (setq ent-buffer (current-buffer)) | 11617 (setq ent-buffer (current-buffer)) |
11410 (setq arch-file-name | 11618 (setq arch-file-name |
11411 (concat ent-name "_" arch-name "." | 11619 (concat (vhdl-replace-string vhdl-testbench-architecture-file-name |
11412 (file-name-extension (buffer-file-name)))) | 11620 (concat ent-name " " arch-name) t) |
11621 "." (file-name-extension (buffer-file-name)))) | |
11413 (when (and (file-exists-p arch-file-name) | 11622 (when (and (file-exists-p arch-file-name) |
11414 (not (y-or-n-p (concat "File \"" arch-file-name | 11623 (not (y-or-n-p (concat "File \"" arch-file-name |
11415 "\" exists; overwrite? ")))) | 11624 "\" exists; overwrite? ")))) |
11416 (error "ERROR: Pasting port as testbench...aborted")) | 11625 (error "ERROR: Pasting port as testbench...aborted")) |
11417 (find-file arch-file-name) | 11626 (find-file arch-file-name) |
11712 ;; paste group comment and spacing | 11921 ;; paste group comment and spacing |
11713 (when (memq vhdl-include-group-comments (list kind 'always)) | 11922 (when (memq vhdl-include-group-comments (list kind 'always)) |
11714 (vhdl-paste-group-comment (nth 5 vhdl-subprog-list) list-margin)) | 11923 (vhdl-paste-group-comment (nth 5 vhdl-subprog-list) list-margin)) |
11715 ;; paste return type | 11924 ;; paste return type |
11716 (insert "return " (nth 3 vhdl-subprog-list)) | 11925 (insert "return " (nth 3 vhdl-subprog-list)) |
11717 (if (eq kind 'decl) (insert ";") (vhdl-insert-keyword " is")) | 11926 (if (eq kind 'decl) (insert ";") (vhdl-insert-keyword " is")) |
11718 (when (and vhdl-include-port-comments (nth 4 vhdl-subprog-list)) | 11927 (when (and vhdl-include-port-comments (nth 4 vhdl-subprog-list)) |
11719 (vhdl-comment-insert-inline (nth 4 vhdl-subprog-list) t))) | 11928 (vhdl-comment-insert-inline (nth 4 vhdl-subprog-list) t))) |
11720 ;; align parameter list | 11929 ;; align parameter list |
11721 (when vhdl-auto-align (vhdl-align-region-groups start (point) 1 t))) | 11930 (when vhdl-auto-align (vhdl-align-region-groups start (point) 1 t))) |
11722 ;; paste body | 11931 ;; paste body |
11936 | 12145 |
11937 (defun vhdl-current-line () | 12146 (defun vhdl-current-line () |
11938 "Return the line number of the line containing point." | 12147 "Return the line number of the line containing point." |
11939 (save-restriction | 12148 (save-restriction |
11940 (widen) | 12149 (widen) |
11941 (1+ (count-lines (point-min) (line-beginning-position))))) | 12150 (save-excursion |
12151 (beginning-of-line) | |
12152 (1+ (count-lines 1 (point)))))) | |
11942 | 12153 |
11943 (defun vhdl-line-kill-entire (&optional arg) | 12154 (defun vhdl-line-kill-entire (&optional arg) |
11944 "Delete entire line." | 12155 "Delete entire line." |
11945 (interactive "p") | 12156 (interactive "p") |
11946 (beginning-of-line) | 12157 (beginning-of-line) |
12063 File statistics: \"%s\"\n\ | 12274 File statistics: \"%s\"\n\ |
12064 ---------------------\n\ | 12275 ---------------------\n\ |
12065 # statements : %5d\n\ | 12276 # statements : %5d\n\ |
12066 # code lines : %5d\n\ | 12277 # code lines : %5d\n\ |
12067 # total lines : %5d\n\ " | 12278 # total lines : %5d\n\ " |
12068 (buffer-file-name) no-stats no-code-lines no-lines))) | 12279 (buffer-file-name) no-stats no-code-lines no-lines) |
12280 (unless vhdl-emacs-21 (vhdl-show-messages)))) | |
12069 | 12281 |
12070 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 12282 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
12071 ;; Help functions | 12283 ;; Help functions |
12072 | 12284 |
12073 (defun vhdl-re-search-forward (regexp &optional bound noerror count) | 12285 (defun vhdl-re-search-forward (regexp &optional bound noerror count) |
12105 (setq vhdl-project name) | 12317 (setq vhdl-project name) |
12106 (message "Current VHDL project: \"%s\"" name)) | 12318 (message "Current VHDL project: \"%s\"" name)) |
12107 (t | 12319 (t |
12108 (vhdl-warning (format "Unknown VHDL project: \"%s\"" name)))) | 12320 (vhdl-warning (format "Unknown VHDL project: \"%s\"" name)))) |
12109 (vhdl-speedbar-update-current-project)) | 12321 (vhdl-speedbar-update-current-project)) |
12322 | |
12323 (defun vhdl-set-default-project () | |
12324 "Set current project as default on startup." | |
12325 (interactive) | |
12326 (customize-set-variable 'vhdl-project vhdl-project) | |
12327 (customize-save-customized)) | |
12110 | 12328 |
12111 (defun vhdl-toggle-project (name token indent) | 12329 (defun vhdl-toggle-project (name token indent) |
12112 "Set current project to NAME or unset if NAME is current project." | 12330 "Set current project to NAME or unset if NAME is current project." |
12113 (vhdl-set-project (if (equal name vhdl-project) "" name))) | 12331 (vhdl-set-project (if (equal name vhdl-project) "" name))) |
12114 | 12332 |
12163 (condition-case () | 12381 (condition-case () |
12164 (let ((current-project vhdl-project)) | 12382 (let ((current-project vhdl-project)) |
12165 (load-file file-name) | 12383 (load-file file-name) |
12166 (when (/= (length (aget vhdl-project-alist vhdl-project t)) 10) | 12384 (when (/= (length (aget vhdl-project-alist vhdl-project t)) 10) |
12167 (adelete 'vhdl-project-alist vhdl-project) | 12385 (adelete 'vhdl-project-alist vhdl-project) |
12168 (error)) | 12386 (error "")) |
12169 (when not-make-current | 12387 (when not-make-current |
12170 (setq vhdl-project current-project)) | 12388 (setq vhdl-project current-project)) |
12171 (vhdl-update-mode-menu) | 12389 (vhdl-update-mode-menu) |
12172 (vhdl-speedbar-refresh) | 12390 (vhdl-speedbar-refresh) |
12173 (unless not-make-current | 12391 (unless not-make-current |
12371 ;; match item | 12589 ;; match item |
12372 (when (looking-at "\\s-*\\([a-zA-Z]\\w*\\)") | 12590 (when (looking-at "\\s-*\\([a-zA-Z]\\w*\\)") |
12373 (save-match-data | 12591 (save-match-data |
12374 (goto-char (match-end 1)) | 12592 (goto-char (match-end 1)) |
12375 ;; move to next item | 12593 ;; move to next item |
12376 (if (looking-at "\\s-*,") | 12594 (if (looking-at "\\(\\s-*,\\)") |
12377 (goto-char (match-end 0)) | 12595 (goto-char (match-end 1)) |
12378 (end-of-line) t)))) | 12596 (end-of-line) t)))) |
12379 (error t))) | 12597 (error t))) |
12380 | 12598 |
12381 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 12599 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
12382 ;; Syntax definitions | 12600 ;; Syntax definitions |
12420 "^\\s-*\\(\\w+\\)\\s-*:[ \t\n]*\\(\\(" | 12638 "^\\s-*\\(\\w+\\)\\s-*:[ \t\n]*\\(\\(" |
12421 "assert\\|block\\|case\\|exit\\|for\\|if\\|loop\\|next\\|null\\|" | 12639 "assert\\|block\\|case\\|exit\\|for\\|if\\|loop\\|next\\|null\\|" |
12422 "postponed\\|process\\|" | 12640 "postponed\\|process\\|" |
12423 (when (vhdl-standard-p 'ams) "procedural\\|") | 12641 (when (vhdl-standard-p 'ams) "procedural\\|") |
12424 "with\\|while" | 12642 "with\\|while" |
12425 "\\)\\>\\|\\w+\\s-*\\(([^\n]*)\\)*\\s-*<=\\)") | 12643 "\\)\\>\\|\\w+\\s-*\\(([^\n]*)\\|\\.\\w+\\)*\\s-*<=\\)") |
12426 1 'font-lock-function-name-face) | 12644 1 'font-lock-function-name-face) |
12427 | 12645 |
12428 ;; highlight label and component name of component instantiations | 12646 ;; highlight label and component name of component instantiations |
12429 (list | 12647 (list |
12430 (concat | 12648 (concat |
12487 | 12705 |
12488 ;; highlight attribute name in attribute declarations/specifications | 12706 ;; highlight attribute name in attribute declarations/specifications |
12489 (list | 12707 (list |
12490 (concat | 12708 (concat |
12491 "^\\s-*attribute\\s-+\\(\\w+\\)") | 12709 "^\\s-*attribute\\s-+\\(\\w+\\)") |
12492 1 'vhdl-attribute) | 12710 1 'vhdl-font-lock-attribute-face) |
12493 | 12711 |
12494 ;; highlight type/nature name in (sub)type/(sub)nature declarations | 12712 ;; highlight type/nature name in (sub)type/(sub)nature declarations |
12495 (list | 12713 (list |
12496 (concat | 12714 (concat |
12497 "^\\s-*\\(sub\\)?\\(nature\\|type\\)\\s-+\\(\\w+\\)") | 12715 "^\\s-*\\(sub\\)?\\(nature\\|type\\)\\s-+\\(\\w+\\)") |
12519 (progn (goto-char (match-beginning 1)) | 12737 (progn (goto-char (match-beginning 1)) |
12520 (skip-syntax-backward " ") | 12738 (skip-syntax-backward " ") |
12521 (while (= (preceding-char) ?\)) (backward-sexp)) | 12739 (while (= (preceding-char) ?\)) (backward-sexp)) |
12522 (skip-syntax-backward "w_") | 12740 (skip-syntax-backward "w_") |
12523 (skip-syntax-backward " ") | 12741 (skip-syntax-backward " ") |
12524 (when (memq (preceding-char) '(?n ?N)) | 12742 (when (memq (preceding-char) '(?n ?N ?|)) |
12525 (goto-char (point-max)))) | 12743 (goto-char (point-max)))) |
12526 (goto-char (match-end 1)) (1 font-lock-variable-name-face))) | 12744 (goto-char (match-end 1)) (1 font-lock-variable-name-face))) |
12527 | 12745 |
12528 ;; highlight alias/group/quantity declaration names and for-loop/-generate | 12746 ;; highlight alias/group/quantity declaration names and for-loop/-generate |
12529 ;; variables | 12747 ;; variables |
12545 "For consideration as a value of `vhdl-font-lock-keywords'. | 12763 "For consideration as a value of `vhdl-font-lock-keywords'. |
12546 This does highlighting of additional reserved words.") | 12764 This does highlighting of additional reserved words.") |
12547 | 12765 |
12548 (defconst vhdl-font-lock-keywords-5 | 12766 (defconst vhdl-font-lock-keywords-5 |
12549 ;; background highlight translate-off regions | 12767 ;; background highlight translate-off regions |
12550 '((vhdl-match-translate-off (0 vhdl-translate-off-face append))) | 12768 '((vhdl-match-translate-off (0 vhdl-font-lock-translate-off-face append))) |
12551 "For consideration as a value of `vhdl-font-lock-keywords'. | 12769 "For consideration as a value of `vhdl-font-lock-keywords'. |
12552 This does background highlighting of translate-off regions.") | 12770 This does background highlighting of translate-off regions.") |
12553 | 12771 |
12554 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 12772 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
12555 ;; Font and color definitions | 12773 ;; Font and color definitions |
12556 | 12774 |
12557 (defvar vhdl-prompt-face 'vhdl-prompt | 12775 (defvar vhdl-font-lock-prompt-face 'vhdl-font-lock-prompt-face |
12558 "Face name to use for prompts.") | 12776 "Face name to use for prompts.") |
12559 | 12777 |
12560 (defvar vhdl-attribute-face 'vhdl-attribute | 12778 (defvar vhdl-font-lock-attribute-face 'vhdl-font-lock-attribute-face |
12561 "Face name to use for standardized attributes.") | 12779 "Face name to use for standardized attributes.") |
12562 | 12780 |
12563 (defvar vhdl-enumvalue-face 'vhdl-enumvalue | 12781 (defvar vhdl-font-lock-enumvalue-face 'vhdl-font-lock-enumvalue-face |
12564 "Face name to use for standardized enumeration values.") | 12782 "Face name to use for standardized enumeration values.") |
12565 | 12783 |
12566 (defvar vhdl-function-face 'vhdl-function | 12784 (defvar vhdl-font-lock-function-face 'vhdl-font-lock-function-face |
12567 "Face name to use for standardized functions and packages.") | 12785 "Face name to use for standardized functions and packages.") |
12568 | 12786 |
12569 (defvar vhdl-directive-face 'vhdl-directive | 12787 (defvar vhdl-font-lock-directive-face 'vhdl-font-lock-directive-face |
12570 "Face name to use for directives.") | 12788 "Face name to use for directives.") |
12571 | 12789 |
12572 (defvar vhdl-reserved-words-face 'vhdl-reserved-words | 12790 (defvar vhdl-font-lock-reserved-words-face 'vhdl-font-lock-reserved-words-face |
12573 "Face name to use for additional reserved words.") | 12791 "Face name to use for additional reserved words.") |
12574 | 12792 |
12575 (defvar vhdl-translate-off-face 'vhdl-translate-off | 12793 (defvar vhdl-font-lock-translate-off-face 'vhdl-font-lock-translate-off-face |
12576 "Face name to use for translate-off regions.") | 12794 "Face name to use for translate-off regions.") |
12577 | 12795 |
12578 ;; face names to use for words with special syntax. | 12796 ;; face names to use for words with special syntax. |
12579 (let ((syntax-alist vhdl-special-syntax-alist) | 12797 (let ((syntax-alist vhdl-special-syntax-alist) |
12580 name) | 12798 name) |
12581 (while syntax-alist | 12799 (while syntax-alist |
12582 (setq name (vhdl-function-name "vhdl" (nth 0 (car syntax-alist)))) | 12800 (setq name (vhdl-function-name |
12801 "vhdl-font-lock" (nth 0 (car syntax-alist)) "face")) | |
12583 (eval `(defvar ,name ',name | 12802 (eval `(defvar ,name ',name |
12584 ,(concat "Face name to use for " | 12803 ,(concat "Face name to use for " |
12585 (nth 0 (car syntax-alist)) "."))) | 12804 (nth 0 (car syntax-alist)) "."))) |
12586 (setq syntax-alist (cdr syntax-alist)))) | 12805 (setq syntax-alist (cdr syntax-alist)))) |
12587 | 12806 |
12601 (custom-add-to-group | 12820 (custom-add-to-group |
12602 'vhdl-highlight-faces 'font-lock-function-name-face 'custom-face) | 12821 'vhdl-highlight-faces 'font-lock-function-name-face 'custom-face) |
12603 (custom-add-to-group | 12822 (custom-add-to-group |
12604 'vhdl-highlight-faces 'font-lock-variable-name-face 'custom-face) | 12823 'vhdl-highlight-faces 'font-lock-variable-name-face 'custom-face) |
12605 | 12824 |
12606 (defface vhdl-prompt | 12825 (defface vhdl-font-lock-prompt-face |
12607 '((((min-colors 88) (class color) (background light)) | 12826 '((((class color) (background light)) (:foreground "Red" :bold t)) |
12827 (((min-colors 88) (class color) (background light)) | |
12608 (:foreground "Red1" :bold t)) | 12828 (:foreground "Red1" :bold t)) |
12609 (((class color) (background light)) (:foreground "Red" :bold t)) | |
12610 (((class color) (background dark)) (:foreground "Pink" :bold t)) | 12829 (((class color) (background dark)) (:foreground "Pink" :bold t)) |
12611 (t (:inverse-video t))) | 12830 (t (:inverse-video t))) |
12612 "Font lock mode face used to highlight prompts." | 12831 "Font lock mode face used to highlight prompts." |
12613 :group 'vhdl-highlight-faces | 12832 :group 'vhdl-highlight-faces |
12614 :group 'font-lock-highlighting-faces) | 12833 :group 'font-lock-highlighting-faces) |
12615 ;; backward-compatibility alias | 12834 |
12616 (put 'vhdl-font-lock-prompt-face 'face-alias 'vhdl-prompt) | 12835 (defface vhdl-font-lock-attribute-face |
12617 | |
12618 (defface vhdl-attribute | |
12619 '((((class color) (background light)) (:foreground "Orchid")) | 12836 '((((class color) (background light)) (:foreground "Orchid")) |
12620 (((class color) (background dark)) (:foreground "LightSteelBlue")) | 12837 (((class color) (background dark)) (:foreground "LightSteelBlue")) |
12621 (t (:italic t :bold t))) | 12838 (t (:italic t :bold t))) |
12622 "Font lock mode face used to highlight standardized attributes." | 12839 "Font lock mode face used to highlight standardized attributes." |
12623 :group 'vhdl-highlight-faces | 12840 :group 'vhdl-highlight-faces |
12624 :group 'font-lock-highlighting-faces) | 12841 :group 'font-lock-highlighting-faces) |
12625 ;; backward-compatibility alias | 12842 |
12626 (put 'vhdl-font-lock-attribute-face 'face-alias 'vhdl-attribute) | 12843 (defface vhdl-font-lock-enumvalue-face |
12627 | |
12628 (defface vhdl-enumvalue | |
12629 '((((class color) (background light)) (:foreground "SaddleBrown")) | 12844 '((((class color) (background light)) (:foreground "SaddleBrown")) |
12630 (((class color) (background dark)) (:foreground "BurlyWood")) | 12845 (((class color) (background dark)) (:foreground "BurlyWood")) |
12631 (t (:italic t :bold t))) | 12846 (t (:italic t :bold t))) |
12632 "Font lock mode face used to highlight standardized enumeration values." | 12847 "Font lock mode face used to highlight standardized enumeration values." |
12633 :group 'vhdl-highlight-faces | 12848 :group 'vhdl-highlight-faces |
12634 :group 'font-lock-highlighting-faces) | 12849 :group 'font-lock-highlighting-faces) |
12635 ;; backward-compatibility alias | 12850 |
12636 (put 'vhdl-font-lock-enumvalue-face 'face-alias 'vhdl-enumvalue) | 12851 (defface vhdl-font-lock-function-face |
12637 | |
12638 (defface vhdl-function | |
12639 '((((class color) (background light)) (:foreground "Cyan4")) | 12852 '((((class color) (background light)) (:foreground "Cyan4")) |
12640 (((class color) (background dark)) (:foreground "Orchid1")) | 12853 (((class color) (background dark)) (:foreground "Orchid1")) |
12641 (t (:italic t :bold t))) | 12854 (t (:italic t :bold t))) |
12642 "Font lock mode face used to highlight standardized functions and packages." | 12855 "Font lock mode face used to highlight standardized functions and packages." |
12643 :group 'vhdl-highlight-faces | 12856 :group 'vhdl-highlight-faces |
12644 :group 'font-lock-highlighting-faces) | 12857 :group 'font-lock-highlighting-faces) |
12645 ;; backward-compatibility alias | 12858 |
12646 (put 'vhdl-font-lock-function-face 'face-alias 'vhdl-function) | 12859 (defface vhdl-font-lock-directive-face |
12647 | |
12648 (defface vhdl-directive | |
12649 '((((class color) (background light)) (:foreground "CadetBlue")) | 12860 '((((class color) (background light)) (:foreground "CadetBlue")) |
12650 (((class color) (background dark)) (:foreground "Aquamarine")) | 12861 (((class color) (background dark)) (:foreground "Aquamarine")) |
12651 (t (:italic t :bold t))) | 12862 (t (:italic t :bold t))) |
12652 "Font lock mode face used to highlight directives." | 12863 "Font lock mode face used to highlight directives." |
12653 :group 'vhdl-highlight-faces | 12864 :group 'vhdl-highlight-faces |
12654 :group 'font-lock-highlighting-faces) | 12865 :group 'font-lock-highlighting-faces) |
12655 ;; backward-compatibility alias | 12866 |
12656 (put 'vhdl-font-lock-directive-face 'face-alias 'vhdl-directive) | 12867 (defface vhdl-font-lock-reserved-words-face |
12657 | |
12658 (defface vhdl-reserved-word | |
12659 '((((class color) (background light)) (:foreground "Orange" :bold t)) | 12868 '((((class color) (background light)) (:foreground "Orange" :bold t)) |
12660 (((min-colors 88) (class color) (background dark)) | 12869 (((min-colors 88) (class color) (background dark)) |
12661 (:foreground "Yellow1" :bold t)) | 12870 (:foreground "Yellow1" :bold t)) |
12662 (((class color) (background dark)) (:foreground "Yellow" :bold t)) | 12871 (((class color) (background dark)) (:foreground "Yellow" :bold t)) |
12663 (t ())) | 12872 (t ())) |
12664 "Font lock mode face used to highlight additional reserved words." | 12873 "Font lock mode face used to highlight additional reserved words." |
12665 :group 'vhdl-highlight-faces | 12874 :group 'vhdl-highlight-faces |
12666 :group 'font-lock-highlighting-faces) | 12875 :group 'font-lock-highlighting-faces) |
12667 ;; backward-compatibility alias | 12876 |
12668 (put 'vhdl-font-lock-reserved-words-face 'face-alias 'vhdl-reserved-word) | 12877 (defface vhdl-font-lock-translate-off-face |
12669 | |
12670 (defface vhdl-translate-off | |
12671 '((((class color) (background light)) (:background "LightGray")) | 12878 '((((class color) (background light)) (:background "LightGray")) |
12672 (((class color) (background dark)) (:background "DimGray")) | 12879 (((class color) (background dark)) (:background "DimGray")) |
12673 (t ())) | 12880 (t ())) |
12674 "Font lock mode face used to background highlight translate-off regions." | 12881 "Font lock mode face used to background highlight translate-off regions." |
12675 :group 'vhdl-highlight-faces | 12882 :group 'vhdl-highlight-faces |
12676 :group 'font-lock-highlighting-faces) | 12883 :group 'font-lock-highlighting-faces) |
12677 ;; backward-compatibility alias | |
12678 (put 'vhdl-font-lock-translate-off-face 'face-alias 'vhdl-translate-off) | |
12679 | 12884 |
12680 ;; font lock mode faces used to highlight words with special syntax. | 12885 ;; font lock mode faces used to highlight words with special syntax. |
12681 (let ((syntax-alist vhdl-special-syntax-alist)) | 12886 (let ((syntax-alist vhdl-special-syntax-alist)) |
12682 (while syntax-alist | 12887 (while syntax-alist |
12683 (eval `(defface ,(vhdl-function-name "vhdl" (caar syntax-alist)) | 12888 (eval `(defface ,(vhdl-function-name |
12889 "vhdl-font-lock" (caar syntax-alist) "face") | |
12684 '((((class color) (background light)) | 12890 '((((class color) (background light)) |
12685 (:foreground ,(nth 2 (car syntax-alist)))) | 12891 (:foreground ,(nth 2 (car syntax-alist)))) |
12686 (((class color) (background dark)) | 12892 (((class color) (background dark)) |
12687 (:foreground ,(nth 3 (car syntax-alist)))) | 12893 (:foreground ,(nth 3 (car syntax-alist)))) |
12688 (t ())) | 12894 (t ())) |
12695 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 12901 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
12696 ;; Font lock initialization | 12902 ;; Font lock initialization |
12697 | 12903 |
12698 (defun vhdl-font-lock-init () | 12904 (defun vhdl-font-lock-init () |
12699 "Initialize fontification." | 12905 "Initialize fontification." |
12700 ;; highlight template prompts and directives | 12906 ;; highlight template prompts and directives |
12701 (setq vhdl-font-lock-keywords-0 | 12907 (setq vhdl-font-lock-keywords-0 |
12702 (list (list (concat "\\(^\\|[ \t(.']\\)\\(<" | 12908 (list (list (concat "\\(^\\|[ \t(.']\\)\\(<" |
12703 vhdl-template-prompt-syntax ">\\)") | 12909 vhdl-template-prompt-syntax ">\\)") |
12704 2 'vhdl-prompt t) | 12910 2 'vhdl-font-lock-prompt-face t) |
12705 (list (concat "--\\s-*" | 12911 (list (concat "--\\s-*" |
12706 vhdl-directive-keywords-regexp "\\s-+\\(.*\\)$") | 12912 vhdl-directive-keywords-regexp "\\s-+\\(.*\\)$") |
12707 2 'vhdl-directive t))) | 12913 2 'vhdl-font-lock-directive-face t) |
12914 ;; highlight c-preprocessor directives | |
12915 (list "^#[ \t]*\\(\\w+\\)\\([ \t]+\\(\\w+\\)\\)?" | |
12916 '(1 font-lock-builtin-face) | |
12917 '(3 font-lock-variable-name-face nil t)))) | |
12708 ;; highlight keywords and standardized types, attributes, enumeration | 12918 ;; highlight keywords and standardized types, attributes, enumeration |
12709 ;; values, and subprograms | 12919 ;; values, and subprograms |
12710 (setq vhdl-font-lock-keywords-1 | 12920 (setq vhdl-font-lock-keywords-1 |
12711 (list | 12921 (list |
12712 (list (concat "'" vhdl-attributes-regexp) 1 'vhdl-attribute) | 12922 (list (concat "'" vhdl-attributes-regexp) |
12923 1 'vhdl-font-lock-attribute-face) | |
12713 (list vhdl-types-regexp 1 'font-lock-type-face) | 12924 (list vhdl-types-regexp 1 'font-lock-type-face) |
12714 (list vhdl-functions-regexp 1 'vhdl-function) | 12925 (list vhdl-functions-regexp 1 'vhdl-font-lock-function-face) |
12715 (list vhdl-packages-regexp 1 'vhdl-function) | 12926 (list vhdl-packages-regexp 1 'vhdl-font-lock-function-face) |
12716 (list vhdl-enum-values-regexp 1 'vhdl-enumvalue) | 12927 (list vhdl-enum-values-regexp 1 'vhdl-font-lock-enumvalue-face) |
12717 (list vhdl-keywords-regexp 1 'font-lock-keyword-face))) | 12928 (list vhdl-keywords-regexp 1 'font-lock-keyword-face))) |
12718 ;; highlight words with special syntax. | 12929 ;; highlight words with special syntax. |
12719 (setq vhdl-font-lock-keywords-3 | 12930 (setq vhdl-font-lock-keywords-3 |
12720 (let ((syntax-alist vhdl-special-syntax-alist) | 12931 (let ((syntax-alist vhdl-special-syntax-alist) |
12721 keywords) | 12932 keywords) |
12722 (while syntax-alist | 12933 (while syntax-alist |
12723 (setq keywords | 12934 (setq keywords |
12724 (cons | 12935 (cons |
12725 (cons (concat "\\<\\(" (nth 1 (car syntax-alist)) "\\)\\>") | 12936 (cons (concat "\\<\\(" (nth 1 (car syntax-alist)) "\\)\\>") |
12726 (vhdl-function-name | 12937 (vhdl-function-name |
12727 "vhdl" (nth 0 (car syntax-alist)))) | 12938 "vhdl-font-lock" (nth 0 (car syntax-alist)) "face")) |
12728 keywords)) | 12939 keywords)) |
12729 (setq syntax-alist (cdr syntax-alist))) | 12940 (setq syntax-alist (cdr syntax-alist))) |
12730 keywords)) | 12941 keywords)) |
12731 ;; highlight additional reserved words | 12942 ;; highlight additional reserved words |
12732 (setq vhdl-font-lock-keywords-4 | 12943 (setq vhdl-font-lock-keywords-4 |
12733 (list (list vhdl-reserved-words-regexp 1 'vhdl-reserved-word))) | 12944 (list (list vhdl-reserved-words-regexp 1 |
12945 'vhdl-font-lock-reserved-words-face))) | |
12734 ;; highlight everything together | 12946 ;; highlight everything together |
12735 (setq vhdl-font-lock-keywords | 12947 (setq vhdl-font-lock-keywords |
12736 (append | 12948 (append |
12737 vhdl-font-lock-keywords-0 | 12949 vhdl-font-lock-keywords-0 |
12738 (when vhdl-highlight-keywords vhdl-font-lock-keywords-1) | 12950 (when vhdl-highlight-keywords vhdl-font-lock-keywords-1) |
12753 'vhdl-font-lock-keywords nil | 12965 'vhdl-font-lock-keywords nil |
12754 (not vhdl-highlight-case-sensitive) '((?\_ . "w")) 'beginning-of-line | 12966 (not vhdl-highlight-case-sensitive) '((?\_ . "w")) 'beginning-of-line |
12755 '(font-lock-syntactic-keywords . vhdl-font-lock-syntactic-keywords))) | 12967 '(font-lock-syntactic-keywords . vhdl-font-lock-syntactic-keywords))) |
12756 (when (fboundp 'font-lock-unset-defaults) | 12968 (when (fboundp 'font-lock-unset-defaults) |
12757 (font-lock-unset-defaults)) ; not implemented in XEmacs | 12969 (font-lock-unset-defaults)) ; not implemented in XEmacs |
12758 (font-lock-set-defaults) ;What for? --Stef | 12970 (font-lock-set-defaults) |
12759 (font-lock-mode nil) | 12971 (font-lock-mode nil) |
12760 (font-lock-mode t)) | 12972 (font-lock-mode t)) |
12761 | 12973 |
12762 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 12974 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
12763 ;; Initialization for postscript printing | 12975 ;; Initialization for postscript printing |
12766 "Initialize custom face and page settings for postscript printing." | 12978 "Initialize custom face and page settings for postscript printing." |
12767 ;; define custom face settings | 12979 ;; define custom face settings |
12768 (unless (or (not vhdl-print-customize-faces) | 12980 (unless (or (not vhdl-print-customize-faces) |
12769 ps-print-color-p) | 12981 ps-print-color-p) |
12770 (set (make-local-variable 'ps-bold-faces) | 12982 (set (make-local-variable 'ps-bold-faces) |
12771 '(font-lock-keyword-face font-lock-type-face | 12983 '(font-lock-keyword-face |
12772 vhdl-attribute vhdl-enumvalue vhdl-directive)) | 12984 font-lock-type-face |
12985 vhdl-font-lock-attribute-face | |
12986 vhdl-font-lock-enumvalue-face | |
12987 vhdl-font-lock-directive-face)) | |
12773 (set (make-local-variable 'ps-italic-faces) | 12988 (set (make-local-variable 'ps-italic-faces) |
12774 '(font-lock-comment-face | 12989 '(font-lock-comment-face |
12775 font-lock-function-name-face font-lock-type-face | 12990 font-lock-function-name-face |
12776 vhdl-attribute vhdl-enumvalue vhdl-directive)) | 12991 font-lock-type-face |
12992 vhdl-font-lock-attribute-face | |
12993 vhdl-font-lock-enumvalue-face | |
12994 vhdl-font-lock-directive-face)) | |
12777 (set (make-local-variable 'ps-underlined-faces) | 12995 (set (make-local-variable 'ps-underlined-faces) |
12778 '(font-lock-string-face)) | 12996 '(font-lock-string-face)) |
12779 (setq ps-always-build-face-reference t)) | 12997 (setq ps-always-build-face-reference t)) |
12780 ;; define page settings, so that a line containing 79 characters (default) | 12998 ;; define page settings, so that a line containing 79 characters (default) |
12781 ;; fits into one column | 12999 ;; fits into one column |
12815 ;; structure: (parenthesised expression means list of such entries) | 13033 ;; structure: (parenthesised expression means list of such entries) |
12816 ;; (cache-key | 13034 ;; (cache-key |
12817 ;; (ent-key ent-name ent-file ent-line | 13035 ;; (ent-key ent-name ent-file ent-line |
12818 ;; (arch-key arch-name arch-file arch-line | 13036 ;; (arch-key arch-name arch-file arch-line |
12819 ;; (inst-key inst-name inst-file inst-line inst-comp-name inst-ent-key | 13037 ;; (inst-key inst-name inst-file inst-line inst-comp-name inst-ent-key |
12820 ;; inst-arch-key inst-conf-key inst-lib-key) | 13038 ;; inst-arch-key inst-conf-key inst-lib-key inst-path) |
12821 ;; (lib-name pack-key)) | 13039 ;; (lib-name pack-key)) |
12822 ;; (lib-name pack-key)) | 13040 ;; mra-key (lib-name pack-key)) |
12823 | 13041 |
12824 (defvar vhdl-config-alist nil | 13042 (defvar vhdl-config-alist nil |
12825 "Cache with configurations for each project/directory.") | 13043 "Cache with configurations for each project/directory.") |
12826 ;; structure: (parenthesised expression means list of such entries) | 13044 ;; structure: (parenthesised expression means list of such entries) |
12827 ;; (cache-key | 13045 ;; (cache-key |
12828 ;; (conf-key conf-name conf-file conf-line ent-key arch-key | 13046 ;; (conf-key conf-name conf-file conf-line ent-key arch-key |
12829 ;; (inst-key inst-comp-name inst-ent-key inst-arch-key | 13047 ;; (inst-key inst-comp-name inst-ent-key inst-arch-key |
12830 ;; inst-conf-key inst-lib-key) | 13048 ;; inst-conf-key inst-lib-key) |
12831 ;; (lib-name pack-key))) | 13049 ;; (lib-name pack-key))) |
12832 | 13050 |
12833 (defvar vhdl-package-alist nil | 13051 (defvar vhdl-package-alist nil |
12834 "Cache with packages for each project/directory.") | 13052 "Cache with packages for each project/directory.") |
12835 ;; structure: (parenthesised expression means list of such entries) | 13053 ;; structure: (parenthesised expression means list of such entries) |
12850 (defvar vhdl-file-alist nil | 13068 (defvar vhdl-file-alist nil |
12851 "Cache with design units in each file for each project/directory.") | 13069 "Cache with design units in each file for each project/directory.") |
12852 ;; structure: (parenthesised expression means list of such entries) | 13070 ;; structure: (parenthesised expression means list of such entries) |
12853 ;; (cache-key | 13071 ;; (cache-key |
12854 ;; (file-name (ent-list) (arch-list) (arch-ent-list) (conf-list) | 13072 ;; (file-name (ent-list) (arch-list) (arch-ent-list) (conf-list) |
12855 ;; (pack-list) (pack-body-list) (inst-list) (inst-ent-list)) | 13073 ;; (pack-list) (pack-body-list) (inst-list) (inst-ent-list)) |
12856 | 13074 |
12857 (defvar vhdl-directory-alist nil | 13075 (defvar vhdl-directory-alist nil |
12858 "Cache with source directories for each project.") | 13076 "Cache with source directories for each project.") |
12859 ;; structure: (parenthesised expression means list of such entries) | 13077 ;; structure: (parenthesised expression means list of such entries) |
12860 ;; (cache-key (directory)) | 13078 ;; (cache-key (directory)) |
12983 (goto-char (point-min)) | 13201 (goto-char (point-min)) |
12984 (while (re-search-forward "^[ \t]*entity[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t) | 13202 (while (re-search-forward "^[ \t]*entity[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t) |
12985 (let* ((ent-name (match-string-no-properties 1)) | 13203 (let* ((ent-name (match-string-no-properties 1)) |
12986 (ent-key (downcase ent-name)) | 13204 (ent-key (downcase ent-name)) |
12987 (ent-entry (aget ent-alist ent-key t)) | 13205 (ent-entry (aget ent-alist ent-key t)) |
12988 (arch-alist (nth 3 ent-entry)) | |
12989 (lib-alist (vhdl-scan-context-clause))) | 13206 (lib-alist (vhdl-scan-context-clause))) |
12990 (if (nth 1 ent-entry) | 13207 (if (nth 1 ent-entry) |
12991 (vhdl-warning-when-idle | 13208 (vhdl-warning-when-idle |
12992 "Entity declared twice (used 1.): \"%s\"\n 1. in \"%s\" (line %d)\n 2. in \"%s\" (line %d)" | 13209 "Entity declared twice (used 1.): \"%s\"\n 1. in \"%s\" (line %d)\n 2. in \"%s\" (line %d)" |
12993 ent-name (nth 1 ent-entry) (nth 2 ent-entry) | 13210 ent-name (nth 1 ent-entry) (nth 2 ent-entry) |
12994 file-name (vhdl-current-line)) | 13211 file-name (vhdl-current-line)) |
12995 (setq ent-list (cons ent-key ent-list)) | 13212 (setq ent-list (cons ent-key ent-list)) |
12996 (aput 'ent-alist ent-key | 13213 (aput 'ent-alist ent-key |
12997 (list ent-name file-name (vhdl-current-line) | 13214 (list ent-name file-name (vhdl-current-line) |
12998 arch-alist lib-alist))))) | 13215 (nth 3 ent-entry) (nth 4 ent-entry) |
13216 lib-alist))))) | |
12999 ;; scan for architectures | 13217 ;; scan for architectures |
13000 (goto-char (point-min)) | 13218 (goto-char (point-min)) |
13001 (while (re-search-forward "^[ \t]*architecture[ \t\n]+\\(\\w+\\)[ \t\n]+of[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t) | 13219 (while (re-search-forward "^[ \t]*architecture[ \t\n]+\\(\\w+\\)[ \t\n]+of[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t) |
13002 (let* ((arch-name (match-string-no-properties 1)) | 13220 (let* ((arch-name (match-string-no-properties 1)) |
13003 (arch-key (downcase arch-name)) | 13221 (arch-key (downcase arch-name)) |
13004 (ent-name (match-string-no-properties 2)) | 13222 (ent-name (match-string-no-properties 2)) |
13005 (ent-key (downcase ent-name)) | 13223 (ent-key (downcase ent-name)) |
13006 (ent-entry (aget ent-alist ent-key t)) | 13224 (ent-entry (aget ent-alist ent-key t)) |
13019 lib-arch-alist)) | 13237 lib-arch-alist)) |
13020 (aput 'ent-alist ent-key | 13238 (aput 'ent-alist ent-key |
13021 (list (or (nth 0 ent-entry) ent-name) | 13239 (list (or (nth 0 ent-entry) ent-name) |
13022 (nth 1 ent-entry) (nth 2 ent-entry) | 13240 (nth 1 ent-entry) (nth 2 ent-entry) |
13023 (vhdl-sort-alist arch-alist) | 13241 (vhdl-sort-alist arch-alist) |
13024 (nth 4 ent-entry)))))) | 13242 arch-key (nth 5 ent-entry)))))) |
13025 ;; scan for configurations | 13243 ;; scan for configurations |
13026 (goto-char (point-min)) | 13244 (goto-char (point-min)) |
13027 (while (re-search-forward "^[ \t]*configuration[ \t\n]+\\(\\w+\\)[ \t\n]+of[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t) | 13245 (while (re-search-forward "^[ \t]*configuration[ \t\n]+\\(\\w+\\)[ \t\n]+of[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t) |
13028 (let* ((conf-name (match-string-no-properties 1)) | 13246 (let* ((conf-name (match-string-no-properties 1)) |
13029 (conf-key (downcase conf-name)) | 13247 (conf-key (downcase conf-name)) |
13136 (arch-alist (nth 3 ent-entry)) | 13354 (arch-alist (nth 3 ent-entry)) |
13137 (arch-entry (aget arch-alist arch-key t)) | 13355 (arch-entry (aget arch-alist arch-key t)) |
13138 (beg-of-unit (point)) | 13356 (beg-of-unit (point)) |
13139 (end-of-unit (vhdl-get-end-of-unit)) | 13357 (end-of-unit (vhdl-get-end-of-unit)) |
13140 (inst-no 0) | 13358 (inst-no 0) |
13141 inst-alist) | 13359 inst-alist inst-path) |
13142 ;; scan for contained instantiations | 13360 ;; scan for contained instantiations |
13143 (while (and (re-search-forward | 13361 (while (and (re-search-forward |
13144 (concat "^[ \t]*\\(\\w+\\)[ \t\n]*:[ \t\n]*\\(" | 13362 (concat "^[ \t]*\\(\\w+\\)[ \t\n]*:[ \t\n]*\\(" |
13145 "\\(\\w+\\)[ \t\n]+\\(--[^\n]*\n[ \t\n]*\\)*\\(generic\\|port\\)[ \t\n]+map\\>\\|" | 13363 "\\(\\w+\\)[ \t\n]+\\(--[^\n]*\n[ \t\n]*\\)*\\(generic\\|port\\)[ \t\n]+map\\>\\|" |
13146 "component[ \t\n]+\\(\\w+\\)\\|" | 13364 "component[ \t\n]+\\(\\w+\\)\\|" |
13147 "\\(\\(entity\\)\\|configuration\\)[ \t\n]+\\(\\(\\w+\\)\\.\\)?\\(\\w+\\)\\([ \t\n]*(\\(\\w+\\))\\)?\\)") end-of-unit t) | 13365 "\\(\\(entity\\)\\|configuration\\)[ \t\n]+\\(\\(\\w+\\)\\.\\)?\\(\\w+\\)\\([ \t\n]*(\\(\\w+\\))\\)?\\|" |
13366 "\\(\\(for\\|if\\)\\>[^;:]+\\<generate\\>\\|block\\>\\)\\)\\|" | |
13367 "\\(^[ \t]*end[ \t\n]+\\(generate\\|block\\)\\>\\)") end-of-unit t) | |
13148 (or (not limit-hier-inst-no) | 13368 (or (not limit-hier-inst-no) |
13149 (<= (setq inst-no (1+ inst-no)) | 13369 (<= (setq inst-no (1+ inst-no)) |
13150 limit-hier-inst-no))) | 13370 limit-hier-inst-no))) |
13151 (let* ((inst-name (match-string-no-properties 1)) | 13371 (cond |
13152 (inst-key (downcase inst-name)) | 13372 ;; block/generate beginning found |
13153 (inst-comp-name | 13373 ((match-string 14) |
13154 (or (match-string-no-properties 3) | 13374 (setq inst-path |
13155 (match-string-no-properties 6))) | 13375 (cons (match-string-no-properties 1) inst-path))) |
13156 (inst-ent-key | 13376 ;; block/generate end found |
13157 (or (and (match-string 8) | 13377 ((match-string 16) |
13158 (vhdl-match-string-downcase 11)) | 13378 (setq inst-path (cdr inst-path))) |
13159 (and inst-comp-name | 13379 ;; instantiation found |
13160 (downcase inst-comp-name)))) | 13380 (t |
13161 (inst-arch-key (vhdl-match-string-downcase 13)) | 13381 (let* ((inst-name (match-string-no-properties 1)) |
13162 (inst-conf-key | 13382 (inst-key (downcase inst-name)) |
13163 (and (not (match-string 8)) | 13383 (inst-comp-name |
13164 (vhdl-match-string-downcase 11))) | 13384 (or (match-string-no-properties 3) |
13165 (inst-lib-key (vhdl-match-string-downcase 10))) | 13385 (match-string-no-properties 6))) |
13166 (goto-char (match-end 1)) | 13386 (inst-ent-key |
13167 (setq inst-list (cons inst-key inst-list) | 13387 (or (and (match-string 8) |
13168 inst-ent-list (cons inst-ent-key inst-ent-list)) | 13388 (vhdl-match-string-downcase 11)) |
13169 (setq inst-alist | 13389 (and inst-comp-name |
13170 (append | 13390 (downcase inst-comp-name)))) |
13171 inst-alist | 13391 (inst-arch-key (vhdl-match-string-downcase 13)) |
13172 (list (list inst-key inst-name file-name | 13392 (inst-conf-key |
13173 (vhdl-current-line) inst-comp-name | 13393 (and (not (match-string 8)) |
13174 inst-ent-key inst-arch-key | 13394 (vhdl-match-string-downcase 11))) |
13175 inst-conf-key inst-lib-key)))))) | 13395 (inst-lib-key (vhdl-match-string-downcase 10))) |
13396 (goto-char (match-end 1)) | |
13397 (setq inst-list (cons inst-key inst-list) | |
13398 inst-ent-list | |
13399 (cons inst-ent-key inst-ent-list)) | |
13400 (setq inst-alist | |
13401 (append | |
13402 inst-alist | |
13403 (list (list inst-key inst-name file-name | |
13404 (vhdl-current-line) inst-comp-name | |
13405 inst-ent-key inst-arch-key | |
13406 inst-conf-key inst-lib-key | |
13407 (reverse inst-path))))))))) | |
13176 ;; scan for contained configuration specifications | 13408 ;; scan for contained configuration specifications |
13177 (goto-char beg-of-unit) | 13409 (goto-char beg-of-unit) |
13178 (while (re-search-forward | 13410 (while (re-search-forward |
13179 (concat "^[ \t]*for[ \t\n]+\\(\\w+\\([ \t\n]*,[ \t\n]*\\w+\\)*\\)[ \t\n]*:[ \t\n]*\\(\\w+\\)[ \t\n]+\\(--[^\n]*\n[ \t\n]*\\)*" | 13411 (concat "^[ \t]*for[ \t\n]+\\(\\w+\\([ \t\n]*,[ \t\n]*\\w+\\)*\\)[ \t\n]*:[ \t\n]*\\(\\w+\\)[ \t\n]+\\(--[^\n]*\n[ \t\n]*\\)*" |
13180 "use[ \t\n]+\\(\\(entity\\)\\|configuration\\)[ \t\n]+\\(\\(\\w+\\)\\.\\)?\\(\\w+\\)\\([ \t\n]*(\\(\\w+\\))\\)?") end-of-unit t) | 13412 "use[ \t\n]+\\(\\(entity\\)\\|configuration\\)[ \t\n]+\\(\\(\\w+\\)\\.\\)?\\(\\w+\\)\\([ \t\n]*(\\(\\w+\\))\\)?") end-of-unit t) |
13181 (let* ((inst-comp-name (match-string-no-properties 3)) | 13413 (let* ((inst-comp-name (match-string-no-properties 3)) |
13182 (inst-ent-key | 13414 (inst-ent-key |
13183 (and (match-string 6) | 13415 (and (match-string 6) |
13184 (vhdl-match-string-downcase 9))) | 13416 (vhdl-match-string-downcase 9))) |
13185 (inst-arch-key (vhdl-match-string-downcase 11)) | 13417 (inst-arch-key (vhdl-match-string-downcase 11)) |
13186 (inst-conf-key | 13418 (inst-conf-key |
13220 (nth 2 arch-entry) inst-alist | 13452 (nth 2 arch-entry) inst-alist |
13221 (nth 4 arch-entry))) | 13453 (nth 4 arch-entry))) |
13222 (aput 'ent-alist ent-key | 13454 (aput 'ent-alist ent-key |
13223 (list (nth 0 ent-entry) (nth 1 ent-entry) | 13455 (list (nth 0 ent-entry) (nth 1 ent-entry) |
13224 (nth 2 ent-entry) (vhdl-sort-alist arch-alist) | 13456 (nth 2 ent-entry) (vhdl-sort-alist arch-alist) |
13225 (nth 4 ent-entry))) | 13457 (nth 4 ent-entry) (nth 5 ent-entry))) |
13226 (when (and limit-hier-inst-no | 13458 (when (and limit-hier-inst-no |
13227 (> inst-no limit-hier-inst-no)) | 13459 (> inst-no limit-hier-inst-no)) |
13228 (message "WARNING: Scan limit (hierarchy: instances per architecture) reached in file:\n \"%s\"" file-name) | 13460 (message "WARNING: Scan limit (hierarchy: instances per architecture) reached in file:\n \"%s\"" file-name) |
13229 (setq big-files t)) | 13461 (setq big-files t)) |
13230 (goto-char end-of-unit)))) | 13462 (goto-char end-of-unit)))) |
13413 (when (equal file-name (nth 1 (aget arch-alist key t))) | 13645 (when (equal file-name (nth 1 (aget arch-alist key t))) |
13414 (adelete 'arch-alist key) | 13646 (adelete 'arch-alist key) |
13415 (if (or (nth 1 entry) arch-alist) | 13647 (if (or (nth 1 entry) arch-alist) |
13416 (aput 'ent-alist ent-key | 13648 (aput 'ent-alist ent-key |
13417 (list (nth 0 entry) (nth 1 entry) (nth 2 entry) | 13649 (list (nth 0 entry) (nth 1 entry) (nth 2 entry) |
13418 arch-alist (nth 4 entry))) | 13650 arch-alist (nth 4 entry) (nth 5 entry))) |
13419 (adelete 'ent-alist ent-key))) | 13651 (adelete 'ent-alist ent-key))) |
13420 (setq arch-list (cdr arch-list) | 13652 (setq arch-list (cdr arch-list) |
13421 arch-ent-list (cdr arch-ent-list))) | 13653 arch-ent-list (cdr arch-ent-list))) |
13422 ;; configurations | 13654 ;; configurations |
13423 (while conf-list | 13655 (while conf-list |
13477 (setq updated | 13709 (setq updated |
13478 (or (vhdl-update-file-contents (car file-list)) | 13710 (or (vhdl-update-file-contents (car file-list)) |
13479 updated)) | 13711 updated)) |
13480 (setq file-list (cdr file-list))) | 13712 (setq file-list (cdr file-list))) |
13481 (setq vhdl-modified-file-list nil) | 13713 (setq vhdl-modified-file-list nil) |
13714 (vhdl-speedbar-update-current-unit) | |
13482 (when updated (message "Updating hierarchy...done"))))) | 13715 (when updated (message "Updating hierarchy...done"))))) |
13483 | 13716 |
13484 ;; structure (parenthesised expression means list of such entries) | 13717 ;; structure (parenthesised expression means list of such entries) |
13485 ;; (inst-key inst-file-marker comp-ent-key comp-ent-file-marker | 13718 ;; (inst-key inst-file-marker comp-ent-key comp-ent-file-marker |
13486 ;; comp-arch-key comp-arch-file-marker comp-conf-key comp-conf-file-marker | 13719 ;; comp-arch-key comp-arch-file-marker comp-conf-key comp-conf-file-marker |
13531 ; from configuration spec. | 13764 ; from configuration spec. |
13532 (nth 5 inst-entry))) ; from direct instantiation | 13765 (nth 5 inst-entry))) ; from direct instantiation |
13533 (setq inst-ent-entry (aget ent-alist inst-ent-key t)) | 13766 (setq inst-ent-entry (aget ent-alist inst-ent-key t)) |
13534 ;; determine architecture | 13767 ;; determine architecture |
13535 (setq inst-arch-key | 13768 (setq inst-arch-key |
13536 (or (nth 3 (car tmp-list)) ; from configuration | 13769 (or (nth 3 (car tmp-list)) ; from configuration |
13537 (nth 4 inst-conf-entry) ; from subconfiguration | 13770 (nth 4 inst-conf-entry) ; from subconfiguration |
13538 (nth 6 inst-entry) ; from direct instantiation | 13771 (nth 6 inst-entry) ; from direct instantiation |
13539 (nth 4 (aget conf-alist (nth 7 inst-entry))) | 13772 (nth 4 (aget conf-alist (nth 7 inst-entry))) |
13540 ; from configuration spec. | 13773 ; from configuration spec. |
13541 (caar (nth 3 inst-ent-entry)))) ; random (simplified MRA) | 13774 (nth 4 inst-ent-entry) ; MRA |
13775 (caar (nth 3 inst-ent-entry)))) ; first alphabetically | |
13542 (setq inst-arch-entry (aget (nth 3 inst-ent-entry) inst-arch-key t)) | 13776 (setq inst-arch-entry (aget (nth 3 inst-ent-entry) inst-arch-key t)) |
13543 ;; set library | 13777 ;; set library |
13544 (setq inst-lib-key | 13778 (setq inst-lib-key |
13545 (or (nth 5 (car tmp-list)) ; from configuration | 13779 (or (nth 5 (car tmp-list)) ; from configuration |
13546 (nth 8 inst-entry))) ; from direct instantiation | 13780 (nth 8 inst-entry))) ; from direct instantiation |
13547 ;; gather information for this instance | 13781 ;; gather information for this instance |
13548 (setq comp-entry | 13782 (setq comp-entry |
13549 (list (nth 1 inst-entry) | 13783 (list (nth 1 inst-entry) |
13550 (cons (nth 2 inst-entry) (nth 3 inst-entry)) | 13784 (cons (nth 2 inst-entry) (nth 3 inst-entry)) |
13551 (or (nth 0 inst-ent-entry) (nth 4 inst-entry)) | 13785 (or (nth 0 inst-ent-entry) (nth 4 inst-entry)) |
13713 (when (file-exists-p file-dir-name) | 13947 (when (file-exists-p file-dir-name) |
13714 (condition-case () | 13948 (condition-case () |
13715 (progn (load-file file-dir-name) | 13949 (progn (load-file file-dir-name) |
13716 (string< (mapconcat | 13950 (string< (mapconcat |
13717 (lambda (a) (format "%3d" (string-to-number a))) | 13951 (lambda (a) (format "%3d" (string-to-number a))) |
13718 (split-string "3.31.14" "\\.") "") | 13952 (split-string "3.33" "\\.") "") |
13719 (mapconcat | 13953 (mapconcat |
13720 (lambda (a) (format "%3d" (string-to-number a))) | 13954 (lambda (a) (format "%3d" (string-to-number a))) |
13721 (split-string vhdl-cache-version "\\.") ""))) | 13955 (split-string vhdl-cache-version "\\.") ""))) |
13722 (error (progn (vhdl-warning (format "ERROR: Corrupted cache file: \"%s\"" file-dir-name)) | 13956 (error (progn (vhdl-warning (format "ERROR: Corrupted cache file: \"%s\"" file-dir-name)) |
13723 nil)))))) | 13957 nil)))))) |
13773 (define-key vhdl-speedbar-key-map "=" 'speedbar-expand-line) | 14007 (define-key vhdl-speedbar-key-map "=" 'speedbar-expand-line) |
13774 (define-key vhdl-speedbar-key-map "-" 'vhdl-speedbar-contract-level) | 14008 (define-key vhdl-speedbar-key-map "-" 'vhdl-speedbar-contract-level) |
13775 (define-key vhdl-speedbar-key-map "_" 'vhdl-speedbar-contract-all) | 14009 (define-key vhdl-speedbar-key-map "_" 'vhdl-speedbar-contract-all) |
13776 (define-key vhdl-speedbar-key-map "C" 'vhdl-speedbar-port-copy) | 14010 (define-key vhdl-speedbar-key-map "C" 'vhdl-speedbar-port-copy) |
13777 (define-key vhdl-speedbar-key-map "P" 'vhdl-speedbar-place-component) | 14011 (define-key vhdl-speedbar-key-map "P" 'vhdl-speedbar-place-component) |
14012 (define-key vhdl-speedbar-key-map "F" 'vhdl-speedbar-configuration) | |
14013 (define-key vhdl-speedbar-key-map "A" 'vhdl-speedbar-select-mra) | |
13778 (define-key vhdl-speedbar-key-map "K" 'vhdl-speedbar-make-design) | 14014 (define-key vhdl-speedbar-key-map "K" 'vhdl-speedbar-make-design) |
13779 (define-key vhdl-speedbar-key-map "R" 'vhdl-speedbar-rescan-hierarchy) | 14015 (define-key vhdl-speedbar-key-map "R" 'vhdl-speedbar-rescan-hierarchy) |
13780 (define-key vhdl-speedbar-key-map "S" 'vhdl-save-caches) | 14016 (define-key vhdl-speedbar-key-map "S" 'vhdl-save-caches) |
13781 (let ((key 0)) | 14017 (let ((key 0)) |
13782 (while (<= key 9) | 14018 (while (<= key 9) |
13814 ["Copy Port/Subprogram" vhdl-speedbar-port-copy | 14050 ["Copy Port/Subprogram" vhdl-speedbar-port-copy |
13815 (or (vhdl-speedbar-check-unit 'entity) | 14051 (or (vhdl-speedbar-check-unit 'entity) |
13816 (vhdl-speedbar-check-unit 'subprogram))] | 14052 (vhdl-speedbar-check-unit 'subprogram))] |
13817 ["Place Component" vhdl-speedbar-place-component | 14053 ["Place Component" vhdl-speedbar-place-component |
13818 (vhdl-speedbar-check-unit 'entity)] | 14054 (vhdl-speedbar-check-unit 'entity)] |
14055 ["Generate Configuration" vhdl-speedbar-configuration | |
14056 (vhdl-speedbar-check-unit 'architecture)] | |
14057 ["Select as MRA" vhdl-speedbar-select-mra | |
14058 (vhdl-speedbar-check-unit 'architecture)] | |
13819 ["Make" vhdl-speedbar-make-design | 14059 ["Make" vhdl-speedbar-make-design |
13820 (save-excursion (beginning-of-line) (looking-at "[0-9]+: *[[<]"))] | 14060 (save-excursion (beginning-of-line) (looking-at "[0-9]+: *[[<]"))] |
13821 ["Generate Makefile" vhdl-speedbar-generate-makefile | 14061 ["Generate Makefile" vhdl-speedbar-generate-makefile |
13822 (save-excursion (beginning-of-line) (looking-at "[0-9]+:"))] | 14062 (save-excursion (beginning-of-line) (looking-at "[0-9]+:"))] |
13823 ["Rescan Directory" vhdl-speedbar-rescan-hierarchy | 14063 ["Rescan Directory" vhdl-speedbar-rescan-hierarchy |
13980 (setq ent-entry (car ent-alist)) | 14220 (setq ent-entry (car ent-alist)) |
13981 (speedbar-make-tag-line | 14221 (speedbar-make-tag-line |
13982 'bracket ?+ 'vhdl-speedbar-expand-entity (nth 0 ent-entry) | 14222 'bracket ?+ 'vhdl-speedbar-expand-entity (nth 0 ent-entry) |
13983 (nth 1 ent-entry) 'vhdl-speedbar-find-file | 14223 (nth 1 ent-entry) 'vhdl-speedbar-find-file |
13984 (cons (nth 2 ent-entry) (nth 3 ent-entry)) | 14224 (cons (nth 2 ent-entry) (nth 3 ent-entry)) |
13985 'vhdl-speedbar-entity depth) | 14225 'vhdl-speedbar-entity-face depth) |
13986 (unless (nth 2 ent-entry) | 14226 (unless (nth 2 ent-entry) |
13987 (end-of-line 0) (insert "!") (forward-char 1)) | 14227 (end-of-line 0) (insert "!") (forward-char 1)) |
13988 (unless (member (nth 0 ent-entry) ent-inst-list) | 14228 (unless (member (nth 0 ent-entry) ent-inst-list) |
13989 (end-of-line 0) (insert " (top)") (forward-char 1)) | 14229 (end-of-line 0) (insert " (top)") (forward-char 1)) |
13990 (setq ent-alist (cdr ent-alist))) | 14230 (setq ent-alist (cdr ent-alist))) |
13994 (setq conf-entry (car conf-alist)) | 14234 (setq conf-entry (car conf-alist)) |
13995 (speedbar-make-tag-line | 14235 (speedbar-make-tag-line |
13996 'bracket ?+ 'vhdl-speedbar-expand-config (nth 0 conf-entry) | 14236 'bracket ?+ 'vhdl-speedbar-expand-config (nth 0 conf-entry) |
13997 (nth 1 conf-entry) 'vhdl-speedbar-find-file | 14237 (nth 1 conf-entry) 'vhdl-speedbar-find-file |
13998 (cons (nth 2 conf-entry) (nth 3 conf-entry)) | 14238 (cons (nth 2 conf-entry) (nth 3 conf-entry)) |
13999 'vhdl-speedbar-configuration depth) | 14239 'vhdl-speedbar-configuration-face depth) |
14000 (setq conf-alist (cdr conf-alist))) | 14240 (setq conf-alist (cdr conf-alist))) |
14001 ;; insert packages | 14241 ;; insert packages |
14002 (when pack-alist (vhdl-speedbar-make-title-line "Packages:" depth)) | 14242 (when pack-alist (vhdl-speedbar-make-title-line "Packages:" depth)) |
14003 (while pack-alist | 14243 (while pack-alist |
14004 (setq pack-entry (car pack-alist)) | 14244 (setq pack-entry (car pack-alist)) |
14163 (let* ((key (vhdl-speedbar-line-key indent)) | 14403 (let* ((key (vhdl-speedbar-line-key indent)) |
14164 (ent-alist (aget vhdl-entity-alist key t)) | 14404 (ent-alist (aget vhdl-entity-alist key t)) |
14165 (ent-entry (aget ent-alist token t)) | 14405 (ent-entry (aget ent-alist token t)) |
14166 (arch-alist (nth 3 ent-entry)) | 14406 (arch-alist (nth 3 ent-entry)) |
14167 (inst-alist (vhdl-get-instantiations token indent)) | 14407 (inst-alist (vhdl-get-instantiations token indent)) |
14168 (subpack-alist (nth 4 ent-entry)) | 14408 (subpack-alist (nth 5 ent-entry)) |
14409 (multiple-arch (> (length arch-alist) 1)) | |
14169 arch-entry inst-entry) | 14410 arch-entry inst-entry) |
14170 (if (not (or arch-alist inst-alist subpack-alist)) | 14411 (if (not (or arch-alist inst-alist subpack-alist)) |
14171 (speedbar-change-expand-button-char ??) | 14412 (speedbar-change-expand-button-char ??) |
14172 (speedbar-change-expand-button-char ?-) | 14413 (speedbar-change-expand-button-char ?-) |
14173 ;; add entity to `vhdl-speedbar-shown-unit-alist' | 14414 ;; add entity to `vhdl-speedbar-shown-unit-alist' |
14185 (speedbar-make-tag-line | 14426 (speedbar-make-tag-line |
14186 'curly ?+ 'vhdl-speedbar-expand-architecture | 14427 'curly ?+ 'vhdl-speedbar-expand-architecture |
14187 (cons token (nth 0 arch-entry)) | 14428 (cons token (nth 0 arch-entry)) |
14188 (nth 1 arch-entry) 'vhdl-speedbar-find-file | 14429 (nth 1 arch-entry) 'vhdl-speedbar-find-file |
14189 (cons (nth 2 arch-entry) (nth 3 arch-entry)) | 14430 (cons (nth 2 arch-entry) (nth 3 arch-entry)) |
14190 'vhdl-speedbar-architecture (1+ indent)) | 14431 'vhdl-speedbar-architecture-face (1+ indent)) |
14432 (when (and multiple-arch | |
14433 (equal (nth 0 arch-entry) (nth 4 ent-entry))) | |
14434 (end-of-line 0) (insert " (mra)") (forward-char 1)) | |
14191 (setq arch-alist (cdr arch-alist))) | 14435 (setq arch-alist (cdr arch-alist))) |
14192 ;; insert instantiations | 14436 ;; insert instantiations |
14193 (when inst-alist | 14437 (when inst-alist |
14194 (vhdl-speedbar-make-title-line "Instantiated as:" (1+ indent))) | 14438 (vhdl-speedbar-make-title-line "Instantiated as:" (1+ indent))) |
14195 (while inst-alist | 14439 (while inst-alist |
14368 (speedbar-make-tag-line | 14612 (speedbar-make-tag-line |
14369 nil nil nil | 14613 nil nil nil |
14370 (cons token (nth 0 comp-entry)) | 14614 (cons token (nth 0 comp-entry)) |
14371 (nth 1 comp-entry) 'vhdl-speedbar-find-file | 14615 (nth 1 comp-entry) 'vhdl-speedbar-find-file |
14372 (cons (nth 2 comp-entry) (nth 3 comp-entry)) | 14616 (cons (nth 2 comp-entry) (nth 3 comp-entry)) |
14373 'vhdl-speedbar-entity (1+ indent)) | 14617 'vhdl-speedbar-entity-face (1+ indent)) |
14374 (setq comp-alist (cdr comp-alist))) | 14618 (setq comp-alist (cdr comp-alist))) |
14375 ;; insert subprograms | 14619 ;; insert subprograms |
14376 (when func-alist | 14620 (when func-alist |
14377 (vhdl-speedbar-make-title-line "Subprograms:" (1+ indent))) | 14621 (vhdl-speedbar-make-title-line "Subprograms:" (1+ indent))) |
14378 (while func-alist | 14622 (while func-alist |
14418 (setq pack-key (cdar subpack-alist) | 14662 (setq pack-key (cdar subpack-alist) |
14419 lib-name (caar subpack-alist)) | 14663 lib-name (caar subpack-alist)) |
14420 (setq pack-entry (aget pack-alist pack-key t)) | 14664 (setq pack-entry (aget pack-alist pack-key t)) |
14421 (vhdl-speedbar-make-subpack-line | 14665 (vhdl-speedbar-make-subpack-line |
14422 (or (nth 0 pack-entry) pack-key) lib-name | 14666 (or (nth 0 pack-entry) pack-key) lib-name |
14423 (cons (nth 1 pack-entry) (nth 2 pack-entry)) indent) | 14667 (cons (nth 1 pack-entry) (nth 2 pack-entry)) |
14668 (cons (nth 6 pack-entry) (nth 7 pack-entry)) indent) | |
14424 (setq subpack-alist (cdr subpack-alist))))) | 14669 (setq subpack-alist (cdr subpack-alist))))) |
14425 | 14670 |
14426 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 14671 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
14427 ;; Display help functions | 14672 ;; Display help functions |
14428 | 14673 |
14484 (save-excursion | 14729 (save-excursion |
14485 ;; unhighlight last units | 14730 ;; unhighlight last units |
14486 (let* ((file-entry (aget file-alist speedbar-last-selected-file t))) | 14731 (let* ((file-entry (aget file-alist speedbar-last-selected-file t))) |
14487 (vhdl-speedbar-update-units | 14732 (vhdl-speedbar-update-units |
14488 "\\[.\\] " (nth 0 file-entry) | 14733 "\\[.\\] " (nth 0 file-entry) |
14489 speedbar-last-selected-file 'vhdl-speedbar-entity) | 14734 speedbar-last-selected-file 'vhdl-speedbar-entity-face) |
14490 (vhdl-speedbar-update-units | 14735 (vhdl-speedbar-update-units |
14491 "{.} " (nth 1 file-entry) | 14736 "{.} " (nth 1 file-entry) |
14492 speedbar-last-selected-file 'vhdl-speedbar-architecture) | 14737 speedbar-last-selected-file 'vhdl-speedbar-architecture-face) |
14493 (vhdl-speedbar-update-units | 14738 (vhdl-speedbar-update-units |
14494 "\\[.\\] " (nth 3 file-entry) | 14739 "\\[.\\] " (nth 3 file-entry) |
14495 speedbar-last-selected-file 'vhdl-speedbar-configuration) | 14740 speedbar-last-selected-file 'vhdl-speedbar-configuration-face) |
14496 (vhdl-speedbar-update-units | 14741 (vhdl-speedbar-update-units |
14497 "[]>] " (nth 4 file-entry) | 14742 "[]>] " (nth 4 file-entry) |
14498 speedbar-last-selected-file 'vhdl-speedbar-package) | 14743 speedbar-last-selected-file 'vhdl-speedbar-package-face) |
14499 (vhdl-speedbar-update-units | 14744 (vhdl-speedbar-update-units |
14500 "\\[.\\].+(" '("body") | 14745 "\\[.\\].+(" '("body") |
14501 speedbar-last-selected-file 'vhdl-speedbar-package) | 14746 speedbar-last-selected-file 'vhdl-speedbar-package-face) |
14502 (vhdl-speedbar-update-units | 14747 (vhdl-speedbar-update-units |
14503 "> " (nth 6 file-entry) | 14748 "> " (nth 6 file-entry) |
14504 speedbar-last-selected-file 'vhdl-speedbar-instantiation)) | 14749 speedbar-last-selected-file 'vhdl-speedbar-instantiation-face)) |
14505 ;; highlight current units | 14750 ;; highlight current units |
14506 (let* ((file-entry (aget file-alist file-name t))) | 14751 (let* ((file-entry (aget file-alist file-name t))) |
14507 (setq | 14752 (setq |
14508 pos (vhdl-speedbar-update-units | 14753 pos (vhdl-speedbar-update-units |
14509 "\\[.\\] " (nth 0 file-entry) | 14754 "\\[.\\] " (nth 0 file-entry) |
14510 file-name 'vhdl-speedbar-entity-selected pos) | 14755 file-name 'vhdl-speedbar-entity-selected-face pos) |
14511 pos (vhdl-speedbar-update-units | 14756 pos (vhdl-speedbar-update-units |
14512 "{.} " (nth 1 file-entry) | 14757 "{.} " (nth 1 file-entry) |
14513 file-name 'vhdl-speedbar-architecture-selected pos) | 14758 file-name 'vhdl-speedbar-architecture-selected-face pos) |
14514 pos (vhdl-speedbar-update-units | 14759 pos (vhdl-speedbar-update-units |
14515 "\\[.\\] " (nth 3 file-entry) | 14760 "\\[.\\] " (nth 3 file-entry) |
14516 file-name 'vhdl-speedbar-configuration-selected pos) | 14761 file-name 'vhdl-speedbar-configuration-selected-face pos) |
14517 pos (vhdl-speedbar-update-units | 14762 pos (vhdl-speedbar-update-units |
14518 "[]>] " (nth 4 file-entry) | 14763 "[]>] " (nth 4 file-entry) |
14519 file-name 'vhdl-speedbar-package-selected pos) | 14764 file-name 'vhdl-speedbar-package-selected-face pos) |
14520 pos (vhdl-speedbar-update-units | 14765 pos (vhdl-speedbar-update-units |
14521 "\\[.\\].+(" '("body") | 14766 "\\[.\\].+(" '("body") |
14522 file-name 'vhdl-speedbar-package-selected pos) | 14767 file-name 'vhdl-speedbar-package-selected-face pos) |
14523 pos (vhdl-speedbar-update-units | 14768 pos (vhdl-speedbar-update-units |
14524 "> " (nth 6 file-entry) | 14769 "> " (nth 6 file-entry) |
14525 file-name 'vhdl-speedbar-instantiation-selected pos)))))) | 14770 file-name 'vhdl-speedbar-instantiation-selected-face pos)))))) |
14526 ;; move speedbar so the first highlighted unit is visible | 14771 ;; move speedbar so the first highlighted unit is visible |
14527 (when (and pos (not no-position)) | 14772 (when (and pos (not no-position)) |
14528 (goto-char pos) | 14773 (goto-char pos) |
14529 (speedbar-center-buffer-smartly) | 14774 (speedbar-center-buffer-smartly) |
14530 (speedbar-position-cursor-on-line)) | 14775 (speedbar-position-cursor-on-line)) |
14571 (setq start (point)) | 14816 (setq start (point)) |
14572 (if (not inst-name) | 14817 (if (not inst-name) |
14573 (insert "(top)") | 14818 (insert "(top)") |
14574 (insert inst-name) | 14819 (insert inst-name) |
14575 (speedbar-make-button | 14820 (speedbar-make-button |
14576 start (point) 'vhdl-speedbar-instantiation 'speedbar-highlight-face | 14821 start (point) 'vhdl-speedbar-instantiation-face 'speedbar-highlight-face |
14577 'vhdl-speedbar-find-file inst-file-marker)) | 14822 'vhdl-speedbar-find-file inst-file-marker)) |
14578 (insert delimiter) | 14823 (insert delimiter) |
14579 (when ent-name | 14824 (when ent-name |
14580 (setq start (point)) | 14825 (setq start (point)) |
14581 (insert ent-name) | 14826 (insert ent-name) |
14582 (speedbar-make-button | 14827 (speedbar-make-button |
14583 start (point) 'vhdl-speedbar-entity 'speedbar-highlight-face | 14828 start (point) 'vhdl-speedbar-entity-face 'speedbar-highlight-face |
14584 'vhdl-speedbar-find-file ent-file-marker) | 14829 'vhdl-speedbar-find-file ent-file-marker) |
14585 (when arch-name | 14830 (when arch-name |
14586 (insert " (") | 14831 (insert " (") |
14587 (setq start (point)) | 14832 (setq start (point)) |
14588 (insert arch-name) | 14833 (insert arch-name) |
14589 (speedbar-make-button | 14834 (speedbar-make-button |
14590 start (point) 'vhdl-speedbar-architecture 'speedbar-highlight-face | 14835 start (point) 'vhdl-speedbar-architecture-face 'speedbar-highlight-face |
14591 'vhdl-speedbar-find-file arch-file-marker) | 14836 'vhdl-speedbar-find-file arch-file-marker) |
14592 (insert ")")) | 14837 (insert ")")) |
14593 (when conf-name | 14838 (when conf-name |
14594 (insert " (") | 14839 (insert " (") |
14595 (setq start (point)) | 14840 (setq start (point)) |
14596 (insert conf-name) | 14841 (insert conf-name) |
14597 (speedbar-make-button | 14842 (speedbar-make-button |
14598 start (point) 'vhdl-speedbar-configuration 'speedbar-highlight-face | 14843 start (point) 'vhdl-speedbar-configuration-face 'speedbar-highlight-face |
14599 'vhdl-speedbar-find-file conf-file-marker) | 14844 'vhdl-speedbar-find-file conf-file-marker) |
14600 (insert ")"))) | 14845 (insert ")"))) |
14601 (when (and lib-name (not (equal lib-name (downcase (vhdl-work-library))))) | 14846 (when (and lib-name (not (equal lib-name (downcase (vhdl-work-library))))) |
14602 (setq start (point)) | 14847 (setq start (point)) |
14603 (insert " (" lib-name ")") | 14848 (insert " (" lib-name ")") |
14604 (put-text-property (+ 2 start) (1- (point)) 'face | 14849 (put-text-property (+ 2 start) (1- (point)) 'face |
14605 'vhdl-speedbar-library)) | 14850 'vhdl-speedbar-library-face)) |
14606 (insert-char ?\n 1) | 14851 (insert-char ?\n 1) |
14607 (put-text-property visible-start (point) 'invisible nil))) | 14852 (put-text-property visible-start (point) 'invisible nil))) |
14608 | 14853 |
14609 (defun vhdl-speedbar-make-pack-line (pack-key pack-name pack-file-marker | 14854 (defun vhdl-speedbar-make-pack-line (pack-key pack-name pack-file-marker |
14610 body-file-marker depth) | 14855 body-file-marker depth) |
14624 (setq visible-start (point)) | 14869 (setq visible-start (point)) |
14625 (insert-char ? 1 nil) | 14870 (insert-char ? 1 nil) |
14626 (setq start (point)) | 14871 (setq start (point)) |
14627 (insert pack-name) | 14872 (insert pack-name) |
14628 (speedbar-make-button | 14873 (speedbar-make-button |
14629 start (point) 'vhdl-speedbar-package 'speedbar-highlight-face | 14874 start (point) 'vhdl-speedbar-package-face 'speedbar-highlight-face |
14630 'vhdl-speedbar-find-file pack-file-marker) | 14875 'vhdl-speedbar-find-file pack-file-marker) |
14631 (unless (car pack-file-marker) | 14876 (unless (car pack-file-marker) |
14632 (insert "!")) | 14877 (insert "!")) |
14633 (when (car body-file-marker) | 14878 (when (car body-file-marker) |
14634 (insert " (") | 14879 (insert " (") |
14635 (setq start (point)) | 14880 (setq start (point)) |
14636 (insert "body") | 14881 (insert "body") |
14637 (speedbar-make-button | 14882 (speedbar-make-button |
14638 start (point) 'vhdl-speedbar-package 'speedbar-highlight-face | 14883 start (point) 'vhdl-speedbar-package-face 'speedbar-highlight-face |
14639 'vhdl-speedbar-find-file body-file-marker) | 14884 'vhdl-speedbar-find-file body-file-marker) |
14640 (insert ")")) | 14885 (insert ")")) |
14641 (insert-char ?\n 1) | 14886 (insert-char ?\n 1) |
14642 (put-text-property visible-start (point) 'invisible nil))) | 14887 (put-text-property visible-start (point) 'invisible nil))) |
14643 | 14888 |
14644 (defun vhdl-speedbar-make-subpack-line (pack-name lib-name pack-file-marker | 14889 (defun vhdl-speedbar-make-subpack-line (pack-name lib-name pack-file-marker |
14645 depth) | 14890 pack-body-file-marker depth) |
14646 "Insert used package entry." | 14891 "Insert used package entry." |
14647 (let ((start (point)) | 14892 (let ((start (point)) |
14648 visible-start) | 14893 visible-start) |
14649 (insert (int-to-string depth) ":") | 14894 (insert (int-to-string depth) ":") |
14650 (put-text-property start (point) 'invisible t) | 14895 (put-text-property start (point) 'invisible t) |
14657 (setq visible-start (point)) | 14902 (setq visible-start (point)) |
14658 (insert " ") | 14903 (insert " ") |
14659 (setq start (point)) | 14904 (setq start (point)) |
14660 (insert pack-name) | 14905 (insert pack-name) |
14661 (speedbar-make-button | 14906 (speedbar-make-button |
14662 start (point) 'vhdl-speedbar-package 'speedbar-highlight-face | 14907 start (point) 'vhdl-speedbar-package-face 'speedbar-highlight-face |
14663 'vhdl-speedbar-find-file pack-file-marker) | 14908 'vhdl-speedbar-find-file pack-file-marker) |
14909 (when (car pack-body-file-marker) | |
14910 (insert " (") | |
14911 (setq start (point)) | |
14912 (insert "body") | |
14913 (speedbar-make-button | |
14914 start (point) 'vhdl-speedbar-package-face 'speedbar-highlight-face | |
14915 'vhdl-speedbar-find-file pack-body-file-marker) | |
14916 (insert ")")) | |
14664 (setq start (point)) | 14917 (setq start (point)) |
14665 (insert " (" lib-name ")") | 14918 (insert " (" lib-name ")") |
14666 (put-text-property (+ 2 start) (1- (point)) 'face | 14919 (put-text-property (+ 2 start) (1- (point)) 'face |
14667 'vhdl-speedbar-library) | 14920 'vhdl-speedbar-library-face) |
14668 (insert-char ?\n 1) | 14921 (insert-char ?\n 1) |
14669 (put-text-property visible-start (point) 'invisible nil))) | 14922 (put-text-property visible-start (point) 'invisible nil))) |
14670 | 14923 |
14671 (defun vhdl-speedbar-make-subprogram-line (func-name func-file-marker | 14924 (defun vhdl-speedbar-make-subprogram-line (func-name func-file-marker |
14672 func-body-file-marker | 14925 func-body-file-marker |
14685 (setq visible-start (point)) | 14938 (setq visible-start (point)) |
14686 (insert " ") | 14939 (insert " ") |
14687 (setq start (point)) | 14940 (setq start (point)) |
14688 (insert func-name) | 14941 (insert func-name) |
14689 (speedbar-make-button | 14942 (speedbar-make-button |
14690 start (point) 'vhdl-speedbar-subprogram 'speedbar-highlight-face | 14943 start (point) 'vhdl-speedbar-subprogram-face 'speedbar-highlight-face |
14691 'vhdl-speedbar-find-file func-file-marker) | 14944 'vhdl-speedbar-find-file func-file-marker) |
14692 (when (car func-body-file-marker) | 14945 (when (car func-body-file-marker) |
14693 (insert " (") | 14946 (insert " (") |
14694 (setq start (point)) | 14947 (setq start (point)) |
14695 (insert "body") | 14948 (insert "body") |
14696 (speedbar-make-button | 14949 (speedbar-make-button |
14697 start (point) 'vhdl-speedbar-subprogram 'speedbar-highlight-face | 14950 start (point) 'vhdl-speedbar-subprogram-face 'speedbar-highlight-face |
14698 'vhdl-speedbar-find-file func-body-file-marker) | 14951 'vhdl-speedbar-find-file func-body-file-marker) |
14699 (insert ")")) | 14952 (insert ")")) |
14700 (insert-char ?\n 1) | 14953 (insert-char ?\n 1) |
14701 (put-text-property visible-start (point) 'invisible nil))) | 14954 (put-text-property visible-start (point) 'invisible nil))) |
14702 | 14955 |
14780 (goto-char (match-end 1)) | 15033 (goto-char (match-end 1)) |
14781 (let ((face (get-text-property (point) 'face))) | 15034 (let ((face (get-text-property (point) 'face))) |
14782 (message | 15035 (message |
14783 "%s \"%s\" in \"%s\"" | 15036 "%s \"%s\" in \"%s\"" |
14784 ;; design unit kind | 15037 ;; design unit kind |
14785 (cond ((or (eq face 'vhdl-speedbar-entity) | 15038 (cond ((or (eq face 'vhdl-speedbar-entity-face) |
14786 (eq face 'vhdl-speedbar-entity-selected)) | 15039 (eq face 'vhdl-speedbar-entity-selected-face)) |
14787 (if (equal (match-string 2) ">") "Component" "Entity")) | 15040 (if (equal (match-string 2) ">") "Component" "Entity")) |
14788 ((or (eq face 'vhdl-speedbar-architecture) | 15041 ((or (eq face 'vhdl-speedbar-architecture-face) |
14789 (eq face 'vhdl-speedbar-architecture-selected)) | 15042 (eq face 'vhdl-speedbar-architecture-selected-face)) |
14790 "Architecture") | 15043 "Architecture") |
14791 ((or (eq face 'vhdl-speedbar-configuration) | 15044 ((or (eq face 'vhdl-speedbar-configuration-face) |
14792 (eq face 'vhdl-speedbar-configuration-selected)) | 15045 (eq face 'vhdl-speedbar-configuration-selected-face)) |
14793 "Configuration") | 15046 "Configuration") |
14794 ((or (eq face 'vhdl-speedbar-package) | 15047 ((or (eq face 'vhdl-speedbar-package-face) |
14795 (eq face 'vhdl-speedbar-package-selected)) | 15048 (eq face 'vhdl-speedbar-package-selected-face)) |
14796 "Package") | 15049 "Package") |
14797 ((or (eq face 'vhdl-speedbar-instantiation) | 15050 ((or (eq face 'vhdl-speedbar-instantiation-face) |
14798 (eq face 'vhdl-speedbar-instantiation-selected)) | 15051 (eq face 'vhdl-speedbar-instantiation-selected-face)) |
14799 "Instantiation") | 15052 "Instantiation") |
14800 ((eq face 'vhdl-speedbar-subprogram) | 15053 ((eq face 'vhdl-speedbar-subprogram-face) |
14801 "Subprogram") | 15054 "Subprogram") |
14802 (t "")) | 15055 (t "")) |
14803 ;; design unit name | 15056 ;; design unit name |
14804 (buffer-substring-no-properties | 15057 (buffer-substring-no-properties |
14805 (progn (looking-at "\"?\\(\\(\\w\\|_\\)+\\)\"?") (match-beginning 1)) | 15058 (progn (looking-at "\"?\\(\\(\\w\\|_\\)+\\)\"?") (match-beginning 1)) |
14814 (defun vhdl-speedbar-line-text () | 15067 (defun vhdl-speedbar-line-text () |
14815 "Calls `speedbar-line-text' and removes text properties." | 15068 "Calls `speedbar-line-text' and removes text properties." |
14816 (let ((string (speedbar-line-text))) | 15069 (let ((string (speedbar-line-text))) |
14817 (set-text-properties 0 (length string) nil string) | 15070 (set-text-properties 0 (length string) nil string) |
14818 string)) | 15071 string)) |
15072 | |
15073 (defun vhdl-speedbar-higher-text () | |
15074 "Get speedbar-line-text of higher level." | |
15075 (let (depth string) | |
15076 (save-excursion | |
15077 (beginning-of-line) | |
15078 (looking-at "^\\([0-9]+\\):") | |
15079 (setq depth (string-to-number (match-string 1))) | |
15080 (when (re-search-backward (format "^%d: *[[<{][-+?][]>}] \\([^ \n]+\\)" (1- depth)) nil t) | |
15081 (setq string (match-string 1)) | |
15082 (set-text-properties 0 (length string) nil string) | |
15083 string)))) | |
14819 | 15084 |
14820 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 15085 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
14821 ;; Help functions | 15086 ;; Help functions |
14822 | 15087 |
14823 (defun vhdl-speedbar-line-key (&optional indent) | 15088 (defun vhdl-speedbar-line-key (&optional indent) |
14939 (speedbar-select-attached-frame) | 15204 (speedbar-select-attached-frame) |
14940 (select-frame speedbar-attached-frame)) | 15205 (select-frame speedbar-attached-frame)) |
14941 (vhdl-compose-place-component) | 15206 (vhdl-compose-place-component) |
14942 (select-frame speedbar-frame))) | 15207 (select-frame speedbar-frame))) |
14943 | 15208 |
15209 (defun vhdl-speedbar-configuration () | |
15210 "Generate configuration for the architecture under the cursor." | |
15211 (interactive) | |
15212 (if (not (vhdl-speedbar-check-unit 'architecture)) | |
15213 (error "ERROR: No architecture under cursor") | |
15214 (let ((arch-name (vhdl-speedbar-line-text)) | |
15215 (ent-name (vhdl-speedbar-higher-text))) | |
15216 (if (fboundp 'speedbar-select-attached-frame) | |
15217 (speedbar-select-attached-frame) | |
15218 (select-frame speedbar-attached-frame)) | |
15219 (vhdl-compose-configuration ent-name arch-name)))) | |
15220 | |
15221 (defun vhdl-speedbar-select-mra () | |
15222 "Select the architecture under the cursor as MRA." | |
15223 (interactive) | |
15224 (if (not (vhdl-speedbar-check-unit 'architecture)) | |
15225 (error "ERROR: No architecture under cursor") | |
15226 (let* ((arch-key (downcase (vhdl-speedbar-line-text))) | |
15227 (ent-key (downcase (vhdl-speedbar-higher-text))) | |
15228 (ent-alist (aget vhdl-entity-alist | |
15229 (or (vhdl-project-p) default-directory) t)) | |
15230 (ent-entry (aget ent-alist ent-key t))) | |
15231 (setcar (cddr (cddr ent-entry)) arch-key) ; (nth 4 ent-entry) | |
15232 (speedbar-refresh)))) | |
15233 | |
14944 (defun vhdl-speedbar-make-design () | 15234 (defun vhdl-speedbar-make-design () |
14945 "Make (compile) design unit or directory/project under the cursor." | 15235 "Make (compile) design unit or directory/project under the cursor." |
14946 (interactive) | 15236 (interactive) |
14947 (if (not (save-excursion (beginning-of-line) | 15237 (if (not (save-excursion (beginning-of-line) |
14948 (looking-at "[0-9]+: *\\(\\(\\[\\)\\|<\\)"))) | 15238 (looking-at "[0-9]+: *\\(\\(\\[\\)\\|<\\)"))) |
14971 expansion function)." | 15261 expansion function)." |
14972 (save-excursion | 15262 (save-excursion |
14973 (speedbar-position-cursor-on-line) | 15263 (speedbar-position-cursor-on-line) |
14974 (cond ((eq design-unit 'entity) | 15264 (cond ((eq design-unit 'entity) |
14975 (memq (get-text-property (match-end 0) 'face) | 15265 (memq (get-text-property (match-end 0) 'face) |
14976 '(vhdl-speedbar-entity | 15266 '(vhdl-speedbar-entity-face |
14977 vhdl-speedbar-entity-selected))) | 15267 vhdl-speedbar-entity-selected-face))) |
15268 ((eq design-unit 'architecture) | |
15269 (memq (get-text-property (match-end 0) 'face) | |
15270 '(vhdl-speedbar-architecture-face | |
15271 vhdl-speedbar-architecture-selected-face))) | |
14978 ((eq design-unit 'subprogram) | 15272 ((eq design-unit 'subprogram) |
14979 (eq (get-text-property (match-end 0) 'face) | 15273 (eq (get-text-property (match-end 0) 'face) |
14980 'vhdl-speedbar-subprogram)) | 15274 'vhdl-speedbar-subprogram-face)) |
14981 (t nil)))) | 15275 (t nil)))) |
14982 | 15276 |
14983 (defun vhdl-speedbar-set-depth (depth) | 15277 (defun vhdl-speedbar-set-depth (depth) |
14984 "Set hierarchy display depth to DEPTH and refresh speedbar." | 15278 "Set hierarchy display depth to DEPTH and refresh speedbar." |
14985 (setq vhdl-speedbar-hierarchy-depth depth) | 15279 (setq vhdl-speedbar-hierarchy-depth depth) |
14986 (speedbar-refresh)) | 15280 (speedbar-refresh)) |
14987 | 15281 |
14988 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 15282 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
14989 ;; Fontification | 15283 ;; Fontification |
14990 | 15284 |
14991 (defface vhdl-speedbar-entity | 15285 (defface vhdl-speedbar-entity-face |
14992 '((((class color) (background light)) (:foreground "ForestGreen")) | 15286 '((((class color) (background light)) (:foreground "ForestGreen")) |
14993 (((class color) (background dark)) (:foreground "PaleGreen"))) | 15287 (((class color) (background dark)) (:foreground "PaleGreen"))) |
14994 "Face used for displaying entity names." | 15288 "Face used for displaying entity names." |
14995 :group 'speedbar-faces) | 15289 :group 'speedbar-faces) |
14996 ;; backward-compatibility alias | 15290 |
14997 (put 'vhdl-speedbar-entity-face 'face-alias 'vhdl-speedbar-entity) | 15291 (defface vhdl-speedbar-architecture-face |
14998 | 15292 '((((class color) (background light)) (:foreground "Blue")) |
14999 (defface vhdl-speedbar-architecture | 15293 (((min-colors 88) (class color) (background light)) (:foreground "Blue1")) |
15000 '((((min-colors 88) (class color) (background light)) (:foreground "Blue1")) | |
15001 (((class color) (background light)) (:foreground "Blue")) | |
15002 (((class color) (background dark)) (:foreground "LightSkyBlue"))) | 15294 (((class color) (background dark)) (:foreground "LightSkyBlue"))) |
15003 "Face used for displaying architecture names." | 15295 "Face used for displaying architecture names." |
15004 :group 'speedbar-faces) | 15296 :group 'speedbar-faces) |
15005 ;; backward-compatibility alias | 15297 |
15006 (put 'vhdl-speedbar-architecture-face 'face-alias 'vhdl-speedbar-architecture) | 15298 (defface vhdl-speedbar-configuration-face |
15007 | |
15008 (defface vhdl-speedbar-configuration | |
15009 '((((class color) (background light)) (:foreground "DarkGoldenrod")) | 15299 '((((class color) (background light)) (:foreground "DarkGoldenrod")) |
15010 (((class color) (background dark)) (:foreground "Salmon"))) | 15300 (((class color) (background dark)) (:foreground "Salmon"))) |
15011 "Face used for displaying configuration names." | 15301 "Face used for displaying configuration names." |
15012 :group 'speedbar-faces) | 15302 :group 'speedbar-faces) |
15013 ;; backward-compatibility alias | 15303 |
15014 (put 'vhdl-speedbar-configuration-face 'face-alias 'vhdl-speedbar-configuration) | 15304 (defface vhdl-speedbar-package-face |
15015 | |
15016 (defface vhdl-speedbar-package | |
15017 '((((class color) (background light)) (:foreground "Grey50")) | 15305 '((((class color) (background light)) (:foreground "Grey50")) |
15018 (((class color) (background dark)) (:foreground "Grey80"))) | 15306 (((class color) (background dark)) (:foreground "Grey80"))) |
15019 "Face used for displaying package names." | 15307 "Face used for displaying package names." |
15020 :group 'speedbar-faces) | 15308 :group 'speedbar-faces) |
15021 ;; backward-compatibility alias | 15309 |
15022 (put 'vhdl-speedbar-package-face 'face-alias 'vhdl-speedbar-package) | 15310 (defface vhdl-speedbar-library-face |
15023 | |
15024 (defface vhdl-speedbar-library | |
15025 '((((class color) (background light)) (:foreground "Purple")) | 15311 '((((class color) (background light)) (:foreground "Purple")) |
15026 (((class color) (background dark)) (:foreground "Orchid1"))) | 15312 (((class color) (background dark)) (:foreground "Orchid1"))) |
15027 "Face used for displaying library names." | 15313 "Face used for displaying library names." |
15028 :group 'speedbar-faces) | 15314 :group 'speedbar-faces) |
15029 ;; backward-compatibility alias | 15315 |
15030 (put 'vhdl-speedbar-library-face 'face-alias 'vhdl-speedbar-library) | 15316 (defface vhdl-speedbar-instantiation-face |
15031 | |
15032 (defface vhdl-speedbar-instantiation | |
15033 '((((class color) (background light)) (:foreground "Brown")) | 15317 '((((class color) (background light)) (:foreground "Brown")) |
15034 (((min-colors 88) (class color) (background dark)) (:foreground "Yellow1")) | 15318 (((min-colors 88) (class color) (background dark)) (:foreground "Yellow1")) |
15035 (((class color) (background dark)) (:foreground "Yellow"))) | 15319 (((class color) (background dark)) (:foreground "Yellow"))) |
15036 "Face used for displaying instantiation names." | 15320 "Face used for displaying instantiation names." |
15037 :group 'speedbar-faces) | 15321 :group 'speedbar-faces) |
15038 ;; backward-compatibility alias | 15322 |
15039 (put 'vhdl-speedbar-instantiation-face 'face-alias 'vhdl-speedbar-instantiation) | 15323 (defface vhdl-speedbar-subprogram-face |
15040 | |
15041 (defface vhdl-speedbar-subprogram | |
15042 '((((class color) (background light)) (:foreground "Orchid4")) | 15324 '((((class color) (background light)) (:foreground "Orchid4")) |
15043 (((class color) (background dark)) (:foreground "BurlyWood2"))) | 15325 (((class color) (background dark)) (:foreground "BurlyWood2"))) |
15044 "Face used for displaying subprogram names." | 15326 "Face used for displaying subprogram names." |
15045 :group 'speedbar-faces) | 15327 :group 'speedbar-faces) |
15046 ;; backward-compatibility alias | 15328 |
15047 (put 'vhdl-speedbar-subprogram-face 'face-alias 'vhdl-speedbar-subprogram) | 15329 (defface vhdl-speedbar-entity-selected-face |
15048 | |
15049 (defface vhdl-speedbar-entity-selected | |
15050 '((((class color) (background light)) (:foreground "ForestGreen" :underline t)) | 15330 '((((class color) (background light)) (:foreground "ForestGreen" :underline t)) |
15051 (((class color) (background dark)) (:foreground "PaleGreen" :underline t))) | 15331 (((class color) (background dark)) (:foreground "PaleGreen" :underline t))) |
15052 "Face used for displaying entity names." | 15332 "Face used for displaying entity names." |
15053 :group 'speedbar-faces) | 15333 :group 'speedbar-faces) |
15054 ;; backward-compatibility alias | 15334 |
15055 (put 'vhdl-speedbar-entity-selected-face 'face-alias 'vhdl-speedbar-entity-selected) | 15335 (defface vhdl-speedbar-architecture-selected-face |
15056 | 15336 '((((class color) (background light)) (:foreground "Blue" :underline t)) |
15057 (defface vhdl-speedbar-architecture-selected | |
15058 '((((min-colors 88) (class color) (background light)) (:foreground "Blue1" :underline t)) | |
15059 (((min-colors 88) (class color) (background light)) (:foreground "Blue1" :underline t)) | 15337 (((min-colors 88) (class color) (background light)) (:foreground "Blue1" :underline t)) |
15060 (((class color) (background light)) (:foreground "Blue" :underline t)) | |
15061 (((class color) (background dark)) (:foreground "LightSkyBlue" :underline t))) | 15338 (((class color) (background dark)) (:foreground "LightSkyBlue" :underline t))) |
15062 "Face used for displaying architecture names." | 15339 "Face used for displaying architecture names." |
15063 :group 'speedbar-faces) | 15340 :group 'speedbar-faces) |
15064 ;; backward-compatibility alias | 15341 |
15065 (put 'vhdl-speedbar-architecture-selected-face 'face-alias 'vhdl-speedbar-architecture-selected) | 15342 (defface vhdl-speedbar-configuration-selected-face |
15066 | |
15067 (defface vhdl-speedbar-configuration-selected | |
15068 '((((class color) (background light)) (:foreground "DarkGoldenrod" :underline t)) | 15343 '((((class color) (background light)) (:foreground "DarkGoldenrod" :underline t)) |
15069 (((class color) (background dark)) (:foreground "Salmon" :underline t))) | 15344 (((class color) (background dark)) (:foreground "Salmon" :underline t))) |
15070 "Face used for displaying configuration names." | 15345 "Face used for displaying configuration names." |
15071 :group 'speedbar-faces) | 15346 :group 'speedbar-faces) |
15072 ;; backward-compatibility alias | 15347 |
15073 (put 'vhdl-speedbar-configuration-selected-face 'face-alias 'vhdl-speedbar-configuration-selected) | 15348 (defface vhdl-speedbar-package-selected-face |
15074 | |
15075 (defface vhdl-speedbar-package-selected | |
15076 '((((class color) (background light)) (:foreground "Grey50" :underline t)) | 15349 '((((class color) (background light)) (:foreground "Grey50" :underline t)) |
15077 (((class color) (background dark)) (:foreground "Grey80" :underline t))) | 15350 (((class color) (background dark)) (:foreground "Grey80" :underline t))) |
15078 "Face used for displaying package names." | 15351 "Face used for displaying package names." |
15079 :group 'speedbar-faces) | 15352 :group 'speedbar-faces) |
15080 ;; backward-compatibility alias | 15353 |
15081 (put 'vhdl-speedbar-package-selected-face 'face-alias 'vhdl-speedbar-package-selected) | 15354 (defface vhdl-speedbar-instantiation-selected-face |
15082 | |
15083 (defface vhdl-speedbar-instantiation-selected | |
15084 '((((class color) (background light)) (:foreground "Brown" :underline t)) | 15355 '((((class color) (background light)) (:foreground "Brown" :underline t)) |
15085 (((min-colors 88) (class color) (background dark)) (:foreground "Yellow1" :underline t)) | |
15086 (((class color) (background dark)) (:foreground "Yellow" :underline t))) | 15356 (((class color) (background dark)) (:foreground "Yellow" :underline t))) |
15087 "Face used for displaying instantiation names." | 15357 "Face used for displaying instantiation names." |
15088 :group 'speedbar-faces) | 15358 :group 'speedbar-faces) |
15089 ;; backward-compatibility alias | |
15090 (put 'vhdl-speedbar-instantiation-selected-face 'face-alias 'vhdl-speedbar-instantiation-selected) | |
15091 | 15359 |
15092 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 15360 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
15093 ;; Initialization | 15361 ;; Initialization |
15094 | 15362 |
15095 ;; add speedbar | 15363 ;; add speedbar |
15137 ent-file-name arch-file-name ent-buffer arch-buffer project) | 15405 ent-file-name arch-file-name ent-buffer arch-buffer project) |
15138 (message "Creating component \"%s(%s)\"..." ent-name arch-name) | 15406 (message "Creating component \"%s(%s)\"..." ent-name arch-name) |
15139 ;; open entity file | 15407 ;; open entity file |
15140 (unless (eq vhdl-compose-create-files 'none) | 15408 (unless (eq vhdl-compose-create-files 'none) |
15141 (setq ent-file-name | 15409 (setq ent-file-name |
15142 (concat (vhdl-replace-string vhdl-entity-file-name ent-name) | 15410 (concat (vhdl-replace-string vhdl-entity-file-name ent-name t) |
15143 "." (file-name-extension (buffer-file-name)))) | 15411 "." (file-name-extension (buffer-file-name)))) |
15144 (when (and (file-exists-p ent-file-name) | 15412 (when (and (file-exists-p ent-file-name) |
15145 (not (y-or-n-p (concat "File \"" ent-file-name | 15413 (not (y-or-n-p (concat "File \"" ent-file-name |
15146 "\" exists; overwrite? ")))) | 15414 "\" exists; overwrite? ")))) |
15147 (error "ERROR: Creating component...aborted")) | 15415 (error "ERROR: Creating component...aborted")) |
15178 (if (not (eq vhdl-compose-create-files 'separate)) | 15446 (if (not (eq vhdl-compose-create-files 'separate)) |
15179 (insert "\n") | 15447 (insert "\n") |
15180 (setq ent-buffer (current-buffer)) | 15448 (setq ent-buffer (current-buffer)) |
15181 (setq arch-file-name | 15449 (setq arch-file-name |
15182 (concat (vhdl-replace-string vhdl-architecture-file-name | 15450 (concat (vhdl-replace-string vhdl-architecture-file-name |
15183 (concat ent-name " " arch-name)) | 15451 (concat ent-name " " arch-name) t) |
15184 "." (file-name-extension (buffer-file-name)))) | 15452 "." (file-name-extension (buffer-file-name)))) |
15185 (when (and (file-exists-p arch-file-name) | 15453 (when (and (file-exists-p arch-file-name) |
15186 (not (y-or-n-p (concat "File \"" arch-file-name | 15454 (not (y-or-n-p (concat "File \"" arch-file-name |
15187 "\" exists; overwrite? ")))) | 15455 "\" exists; overwrite? ")))) |
15188 (error "ERROR: Creating component...aborted")) | 15456 (error "ERROR: Creating component...aborted")) |
15215 (indent-to vhdl-basic-offset) (insert "-- Component instantiations\n") | 15483 (indent-to vhdl-basic-offset) (insert "-- Component instantiations\n") |
15216 (indent-to vhdl-basic-offset) (vhdl-comment-display-line) (insert "\n\n") | 15484 (indent-to vhdl-basic-offset) (vhdl-comment-display-line) (insert "\n\n") |
15217 (vhdl-insert-keyword "END ") | 15485 (vhdl-insert-keyword "END ") |
15218 (unless (vhdl-standard-p '87) (vhdl-insert-keyword "ARCHITECTURE ")) | 15486 (unless (vhdl-standard-p '87) (vhdl-insert-keyword "ARCHITECTURE ")) |
15219 (insert arch-name ";\n\n") | 15487 (insert arch-name ";\n\n") |
15220 ;; insert footer | 15488 ;; insert footer and save |
15221 (if (and vhdl-compose-include-header (not (equal vhdl-file-footer ""))) | 15489 (if (and vhdl-compose-include-header (not (equal vhdl-file-footer ""))) |
15222 (vhdl-template-footer) | 15490 (vhdl-template-footer) |
15223 (vhdl-comment-display-line) (insert "\n")) | 15491 (vhdl-comment-display-line) (insert "\n")) |
15224 (goto-char (point-min)) | 15492 (goto-char (point-min)) |
15225 (setq arch-buffer (current-buffer)) | 15493 (setq arch-buffer (current-buffer)) |
15243 (unless (or (re-search-backward "^architecture[ \t\n]+\\w+[ \t\n]+of[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t) | 15511 (unless (or (re-search-backward "^architecture[ \t\n]+\\w+[ \t\n]+of[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t) |
15244 (re-search-forward "^architecture[ \t\n]+\\w+[ \t\n]+of[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t)) | 15512 (re-search-forward "^architecture[ \t\n]+\\w+[ \t\n]+of[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t)) |
15245 (error "ERROR: No architecture found")) | 15513 (error "ERROR: No architecture found")) |
15246 (let* ((ent-name (match-string 1)) | 15514 (let* ((ent-name (match-string 1)) |
15247 (ent-file-name | 15515 (ent-file-name |
15248 (concat (vhdl-replace-string vhdl-entity-file-name ent-name) | 15516 (concat (vhdl-replace-string vhdl-entity-file-name ent-name t) |
15249 "." (file-name-extension (buffer-file-name)))) | 15517 "." (file-name-extension (buffer-file-name)))) |
15250 (orig-buffer (current-buffer))) | 15518 (orig-buffer (current-buffer))) |
15251 (message "Placing component \"%s\"..." (nth 0 vhdl-port-list)) | 15519 (message "Placing component \"%s\"..." (nth 0 vhdl-port-list)) |
15252 ;; place component declaration | 15520 ;; place component declaration |
15253 (unless (or vhdl-use-components-package | 15521 (unless (or vhdl-use-components-package |
15295 (unless (or (re-search-backward "^architecture[ \t\n]+\\w+[ \t\n]+of[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t) | 15563 (unless (or (re-search-backward "^architecture[ \t\n]+\\w+[ \t\n]+of[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t) |
15296 (re-search-forward "^architecture[ \t\n]+\\w+[ \t\n]+of[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t)) | 15564 (re-search-forward "^architecture[ \t\n]+\\w+[ \t\n]+of[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t)) |
15297 (error "ERROR: No architecture found")) | 15565 (error "ERROR: No architecture found")) |
15298 (let* ((ent-name (match-string 1)) | 15566 (let* ((ent-name (match-string 1)) |
15299 (ent-file-name | 15567 (ent-file-name |
15300 (concat (vhdl-replace-string vhdl-entity-file-name ent-name) | 15568 (concat (vhdl-replace-string vhdl-entity-file-name ent-name t) |
15301 "." (file-name-extension (buffer-file-name)))) | 15569 "." (file-name-extension (buffer-file-name)))) |
15302 (arch-decl-pos (point-marker)) | 15570 (arch-decl-pos (point-marker)) |
15303 (arch-stat-pos (re-search-forward "^begin\\>" nil)) | 15571 (arch-stat-pos (re-search-forward "^begin\\>" nil)) |
15304 (arch-end-pos (re-search-forward "^end\\>" nil)) | 15572 (arch-end-pos (re-search-forward "^end\\>" nil)) |
15305 (pack-name (vhdl-get-components-package-name)) | 15573 (pack-name (vhdl-get-components-package-name)) |
15306 (pack-file-name | 15574 (pack-file-name |
15307 (concat (vhdl-replace-string vhdl-package-file-name pack-name) | 15575 (concat (vhdl-replace-string vhdl-package-file-name pack-name t) |
15308 "." (file-name-extension (buffer-file-name)))) | 15576 "." (file-name-extension (buffer-file-name)))) |
15309 inst-name comp-name comp-ent-name comp-ent-file-name has-generic | 15577 inst-name comp-name comp-ent-name comp-ent-file-name has-generic |
15310 port-alist generic-alist inst-alist | 15578 port-alist generic-alist inst-alist |
15311 signal-name signal-entry signal-alist local-list written-list | 15579 signal-name signal-entry signal-alist local-list written-list |
15312 single-in-list multi-in-list single-out-list multi-out-list | 15580 single-in-list multi-in-list single-out-list multi-out-list |
15338 (unless (re-search-forward (concat "^\\s-*component[ \t\n]+" comp-name "\\>") nil t) | 15606 (unless (re-search-forward (concat "^\\s-*component[ \t\n]+" comp-name "\\>") nil t) |
15339 (error "ERROR: Component declaration not found: \"%s\"" comp-name)) | 15607 (error "ERROR: Component declaration not found: \"%s\"" comp-name)) |
15340 (vhdl-port-copy))) | 15608 (vhdl-port-copy))) |
15341 ;; ... from entity declaration (direct instantiation) | 15609 ;; ... from entity declaration (direct instantiation) |
15342 (setq comp-ent-file-name | 15610 (setq comp-ent-file-name |
15343 (concat (vhdl-replace-string vhdl-entity-file-name comp-ent-name) | 15611 (concat (vhdl-replace-string vhdl-entity-file-name comp-ent-name t) |
15344 "." (file-name-extension (buffer-file-name)))) | 15612 "." (file-name-extension (buffer-file-name)))) |
15345 (vhdl-visit-file | 15613 (vhdl-visit-file |
15346 comp-ent-file-name t | 15614 comp-ent-file-name t |
15347 (save-excursion | 15615 (save-excursion |
15348 (goto-char (point-min)) | 15616 (goto-char (point-min)) |
15349 (unless (re-search-forward (concat "^\\s-*entity[ \t\n]+" comp-ent-name "\\>") nil t) | 15617 (unless (re-search-forward (concat "^\\s-*entity[ \t\n]+" comp-ent-name "\\>") nil t) |
15350 (error "ERROR: Entity declaration not found: \"%s\"" comp-ent-name)) | 15618 (error "ERROR: Entity declaration not found: \"%s\"" comp-ent-name)) |
15351 (vhdl-port-copy)))) | 15619 (vhdl-port-copy)))) |
15352 (vhdl-port-flatten t) | 15620 (vhdl-port-flatten t) |
15353 (setq generic-alist (nth 1 vhdl-port-list) | 15621 (setq generic-alist (nth 1 vhdl-port-list) |
15354 port-alist (nth 2 vhdl-port-list)) | 15622 port-alist (nth 2 vhdl-port-list) |
15623 vhdl-port-list nil) | |
15355 (setq constant-alist nil | 15624 (setq constant-alist nil |
15356 signal-alist nil) | 15625 signal-alist nil) |
15357 (when has-generic | 15626 (when has-generic |
15358 ;; process all constants in generic map | 15627 ;; process all constants in generic map |
15359 (vhdl-forward-syntactic-ws) | 15628 (vhdl-forward-syntactic-ws) |
15618 (interactive) | 15887 (interactive) |
15619 (vhdl-require-hierarchy-info) | 15888 (vhdl-require-hierarchy-info) |
15620 (let* ((project (vhdl-project-p)) | 15889 (let* ((project (vhdl-project-p)) |
15621 (pack-name (vhdl-get-components-package-name)) | 15890 (pack-name (vhdl-get-components-package-name)) |
15622 (pack-file-name | 15891 (pack-file-name |
15623 (concat (vhdl-replace-string vhdl-package-file-name pack-name) | 15892 (concat (vhdl-replace-string vhdl-package-file-name pack-name t) |
15624 "." (file-name-extension (buffer-file-name)))) | 15893 "." (file-name-extension (buffer-file-name)))) |
15625 (ent-alist (aget vhdl-entity-alist | 15894 (ent-alist (aget vhdl-entity-alist |
15626 (or project default-directory) t)) | 15895 (or project default-directory) t)) |
15627 (lazy-lock-minimum-size 0) | 15896 (lazy-lock-minimum-size 0) |
15628 clause-pos component-pos) | 15897 clause-pos component-pos) |
15677 (goto-char (point-min)) | 15946 (goto-char (point-min)) |
15678 (save-buffer) | 15947 (save-buffer) |
15679 (message "Generating components package \"%s\"...done\n File created: \"%s\"" | 15948 (message "Generating components package \"%s\"...done\n File created: \"%s\"" |
15680 pack-name pack-file-name))) | 15949 pack-name pack-file-name))) |
15681 | 15950 |
15951 (defun vhdl-compose-configuration-architecture (ent-name arch-name inst-alist | |
15952 &optional insert-conf) | |
15953 "Generate block configuration for architecture." | |
15954 (let ((margin (current-indentation)) | |
15955 (beg (save-excursion (beginning-of-line) (point))) | |
15956 ent-entry inst-entry inst-path inst-prev-path cons-key tmp-alist) | |
15957 ;; insert block configuration (for architecture) | |
15958 (vhdl-insert-keyword "FOR ") (insert arch-name "\n") | |
15959 (setq margin (+ margin vhdl-basic-offset)) | |
15960 ;; process all instances | |
15961 (while inst-alist | |
15962 (setq inst-entry (car inst-alist)) | |
15963 ;; is component? | |
15964 (when (nth 4 inst-entry) | |
15965 (setq insert-conf t) | |
15966 (setq inst-path (nth 9 inst-entry)) | |
15967 ;; skip common path with previous instance | |
15968 (while (and inst-path (equal (car inst-path) (car inst-prev-path))) | |
15969 (setq inst-path (cdr inst-path) | |
15970 inst-prev-path (cdr inst-prev-path))) | |
15971 ;; insert block configuration end (for previous block/generate) | |
15972 (while inst-prev-path | |
15973 (setq margin (- margin vhdl-basic-offset)) | |
15974 (indent-to margin) | |
15975 (vhdl-insert-keyword "END FOR;\n") | |
15976 (setq inst-prev-path (cdr inst-prev-path))) | |
15977 ;; insert block configuration beginning (for current block/generate) | |
15978 (indent-to margin) | |
15979 (while inst-path | |
15980 (setq margin (+ margin vhdl-basic-offset)) | |
15981 (vhdl-insert-keyword "FOR ") | |
15982 (insert (car inst-path) "\n") | |
15983 (indent-to margin) | |
15984 (setq inst-path (cdr inst-path))) | |
15985 ;; insert component configuration beginning | |
15986 (vhdl-insert-keyword "FOR ") | |
15987 (insert (nth 1 inst-entry) " : " (nth 4 inst-entry) "\n") | |
15988 ;; find subconfiguration | |
15989 (setq conf-key (nth 7 inst-entry)) | |
15990 (setq tmp-alist conf-alist) | |
15991 ;; use first configuration found for instance's entity | |
15992 (while (and tmp-alist (null conf-key)) | |
15993 (when (equal (nth 5 inst-entry) (nth 4 (car tmp-alist))) | |
15994 (setq conf-key (nth 0 (car tmp-alist)))) | |
15995 (setq tmp-alist (cdr tmp-alist))) | |
15996 (setq conf-entry (aget conf-alist conf-key t)) | |
15997 ;; insert binding indication ... | |
15998 ;; ... with subconfiguration (if exists) | |
15999 (if (and vhdl-compose-configuration-use-subconfiguration conf-entry) | |
16000 (progn | |
16001 (indent-to (+ margin vhdl-basic-offset)) | |
16002 (vhdl-insert-keyword "USE CONFIGURATION ") | |
16003 (insert (vhdl-work-library) "." (nth 0 conf-entry)) | |
16004 (insert ";\n")) | |
16005 ;; ... with entity (if exists) | |
16006 (setq ent-entry (aget ent-alist (nth 5 inst-entry) t)) | |
16007 (when ent-entry | |
16008 (indent-to (+ margin vhdl-basic-offset)) | |
16009 (vhdl-insert-keyword "USE ENTITY ") | |
16010 (insert (vhdl-work-library) "." (nth 0 ent-entry)) | |
16011 ;; insert architecture name (if architecture exists) | |
16012 (when (nth 3 ent-entry) | |
16013 (setq arch-name | |
16014 ;; choose architecture name a) from configuration, | |
16015 ;; b) from mra, or c) from first architecture | |
16016 (or (nth 0 (aget (nth 3 ent-entry) | |
16017 (or (nth 6 inst-entry) | |
16018 (nth 4 ent-entry)) t)) | |
16019 (nth 1 (car (nth 3 ent-entry))))) | |
16020 (insert "(" arch-name ")")) | |
16021 (insert ";\n") | |
16022 ;; insert block configuration (for architecture of subcomponent) | |
16023 (when (and vhdl-compose-configuration-hierarchical | |
16024 (nth 3 ent-entry)) | |
16025 (indent-to (+ margin vhdl-basic-offset)) | |
16026 (vhdl-compose-configuration-architecture | |
16027 (nth 0 ent-entry) arch-name | |
16028 (nth 3 (aget (nth 3 ent-entry) (downcase arch-name) t)))))) | |
16029 ;; insert component configuration end | |
16030 (indent-to margin) | |
16031 (vhdl-insert-keyword "END FOR;\n") | |
16032 (setq inst-prev-path (nth 9 inst-entry))) | |
16033 (setq inst-alist (cdr inst-alist))) | |
16034 ;; insert block configuration end (for block/generate) | |
16035 (while inst-prev-path | |
16036 (setq margin (- margin vhdl-basic-offset)) | |
16037 (indent-to margin) | |
16038 (vhdl-insert-keyword "END FOR;\n") | |
16039 (setq inst-prev-path (cdr inst-prev-path))) | |
16040 (indent-to (- margin vhdl-basic-offset)) | |
16041 ;; insert block configuration end or remove beginning (for architecture) | |
16042 (if insert-conf | |
16043 (vhdl-insert-keyword "END FOR;\n") | |
16044 (delete-region beg (point))))) | |
16045 | |
16046 (defun vhdl-compose-configuration (&optional ent-name arch-name) | |
16047 "Generate configuration declaration." | |
16048 (interactive) | |
16049 (vhdl-require-hierarchy-info) | |
16050 (let ((ent-alist (aget vhdl-entity-alist | |
16051 (or (vhdl-project-p) default-directory) t)) | |
16052 (conf-alist (aget vhdl-config-alist | |
16053 (or (vhdl-project-p) default-directory) t)) | |
16054 (from-speedbar ent-name) | |
16055 inst-alist conf-name conf-file-name pos) | |
16056 (vhdl-prepare-search-2 | |
16057 ;; get entity and architecture name | |
16058 (unless ent-name | |
16059 (save-excursion | |
16060 (unless (and (re-search-backward "^\\(architecture\\s-+\\(\\w+\\)\\s-+of\\s-+\\(\\w+\\)\\|end\\)\\>" nil t) | |
16061 (not (equal "END" (upcase (match-string 1)))) | |
16062 (setq ent-name (match-string-no-properties 3)) | |
16063 (setq arch-name (match-string-no-properties 2))) | |
16064 (error "ERROR: Not within an architecture")))) | |
16065 (setq conf-name (vhdl-replace-string | |
16066 vhdl-compose-configuration-name | |
16067 (concat ent-name " " arch-name))) | |
16068 (setq inst-alist | |
16069 (nth 3 (aget (nth 3 (aget ent-alist (downcase ent-name) t)) | |
16070 (downcase arch-name) t)))) | |
16071 (message "Generating configuration \"%s\"..." conf-name) | |
16072 (if vhdl-compose-configuration-create-file | |
16073 ;; open configuration file | |
16074 (progn | |
16075 (setq conf-file-name | |
16076 (concat (vhdl-replace-string vhdl-configuration-file-name | |
16077 conf-name t) | |
16078 "." (file-name-extension (buffer-file-name)))) | |
16079 (when (and (file-exists-p conf-file-name) | |
16080 (not (y-or-n-p (concat "File \"" conf-file-name | |
16081 "\" exists; overwrite? ")))) | |
16082 (error "ERROR: Creating configuration...aborted")) | |
16083 (find-file conf-file-name) | |
16084 (erase-buffer) | |
16085 (set-buffer-modified-p nil) | |
16086 ;; insert header | |
16087 (if vhdl-compose-include-header | |
16088 (progn (vhdl-template-header | |
16089 (concat "Configuration declaration for design \"" | |
16090 ent-name "(" arch-name ")\"")) | |
16091 (goto-char (point-max))) | |
16092 (vhdl-comment-display-line) (insert "\n\n"))) | |
16093 ;; goto end of architecture | |
16094 (unless from-speedbar | |
16095 (re-search-forward "^end\\>" nil) | |
16096 (end-of-line) (insert "\n\n") | |
16097 (vhdl-comment-display-line) (insert "\n\n"))) | |
16098 ;; insert library clause | |
16099 (setq pos (point)) | |
16100 (vhdl-template-standard-package (vhdl-work-library) nil) | |
16101 (when (/= pos (point)) | |
16102 (insert "\n\n")) | |
16103 ;; insert configuration | |
16104 (vhdl-insert-keyword "CONFIGURATION ") (insert conf-name) | |
16105 (vhdl-insert-keyword " OF ") (insert ent-name) | |
16106 (vhdl-insert-keyword " IS\n") | |
16107 (indent-to vhdl-basic-offset) | |
16108 ;; insert block configuration (for architecture) | |
16109 (vhdl-compose-configuration-architecture ent-name arch-name inst-alist t) | |
16110 (vhdl-insert-keyword "END ") (insert conf-name ";") | |
16111 (when conf-file-name | |
16112 ;; insert footer and save | |
16113 (insert "\n\n") | |
16114 (if (and vhdl-compose-include-header (not (equal vhdl-file-footer ""))) | |
16115 (vhdl-template-footer) | |
16116 (vhdl-comment-display-line) (insert "\n")) | |
16117 (save-buffer)) | |
16118 (message | |
16119 (concat (format "Generating configuration \"%s\"...done" conf-name) | |
16120 (and conf-file-name | |
16121 (format "\n File created: \"%s\"" conf-file-name)))))) | |
16122 | |
15682 | 16123 |
15683 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 16124 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
15684 ;;; Compilation / Makefile generation | 16125 ;;; Compilation / Makefile generation |
15685 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 16126 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
15686 ;; (using `compile.el') | 16127 ;; (using `compile.el') |
15857 (if options | 16298 (if options |
15858 (when command | 16299 (when command |
15859 (compile (concat command " " options " " file-name))) | 16300 (compile (concat command " " options " " file-name))) |
15860 (vhdl-warning "Your project settings tell me not to compile this file")))) | 16301 (vhdl-warning "Your project settings tell me not to compile this file")))) |
15861 | 16302 |
16303 (defvar vhdl-make-target "all" | |
16304 "Default target for `vhdl-make' command.") | |
16305 | |
15862 (defun vhdl-make (&optional target) | 16306 (defun vhdl-make (&optional target) |
15863 "Call make command for compilation of all updated source files (requires | 16307 "Call make command for compilation of all updated source files (requires |
15864 `Makefile'). Optional argument TARGET allows to compile the design | 16308 `Makefile'). Optional argument TARGET allows to compile the design |
15865 specified by a target." | 16309 specified by a target." |
15866 (interactive) | 16310 (interactive) |
16311 (setq vhdl-make-target | |
16312 (or target (read-from-minibuffer "Target: " vhdl-make-target | |
16313 vhdl-minibuffer-local-map))) | |
15867 (vhdl-compile-init) | 16314 (vhdl-compile-init) |
15868 (let* ((project (aget vhdl-project-alist vhdl-project)) | 16315 (let* ((project (aget vhdl-project-alist vhdl-project)) |
15869 (compiler (or (aget vhdl-compiler-alist vhdl-compiler) | 16316 (compiler (or (aget vhdl-compiler-alist vhdl-compiler) |
15870 (error "ERROR: No such compiler: \"%s\"" vhdl-compiler))) | 16317 (error "ERROR: No such compiler: \"%s\"" vhdl-compiler))) |
15871 (command (nth 2 compiler)) | 16318 (command (nth 2 compiler)) |
15873 (default-directory (vhdl-compile-directory))) | 16320 (default-directory (vhdl-compile-directory))) |
15874 (unless (file-directory-p default-directory) | 16321 (unless (file-directory-p default-directory) |
15875 (error "ERROR: Compile directory does not exist: \"%s\"" default-directory)) | 16322 (error "ERROR: Compile directory does not exist: \"%s\"" default-directory)) |
15876 ;; run make | 16323 ;; run make |
15877 (compile (concat (if (equal command "") "make" command) | 16324 (compile (concat (if (equal command "") "make" command) |
15878 " " options " " target)))) | 16325 " " options " " vhdl-make-target)))) |
15879 | 16326 |
15880 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 16327 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
15881 ;; Makefile generation | 16328 ;; Makefile generation |
15882 | 16329 |
15883 (defun vhdl-generate-makefile () | 16330 (defun vhdl-generate-makefile () |
15952 ent-key (nth 0 ent-entry)) | 16399 ent-key (nth 0 ent-entry)) |
15953 (when (nth 2 ent-entry) | 16400 (when (nth 2 ent-entry) |
15954 (setq ent-file-name (file-relative-name | 16401 (setq ent-file-name (file-relative-name |
15955 (nth 2 ent-entry) compile-directory) | 16402 (nth 2 ent-entry) compile-directory) |
15956 arch-alist (nth 4 ent-entry) | 16403 arch-alist (nth 4 ent-entry) |
15957 lib-alist (nth 5 ent-entry) | 16404 lib-alist (nth 6 ent-entry) |
15958 rule (aget rule-alist ent-file-name) | 16405 rule (aget rule-alist ent-file-name) |
15959 target-list (nth 0 rule) | 16406 target-list (nth 0 rule) |
15960 depend-list (nth 1 rule) | 16407 depend-list (nth 1 rule) |
15961 second-list nil | 16408 second-list nil |
15962 subcomp-list nil) | 16409 subcomp-list nil) |
16222 " \\\n\t\t$(UNIT-" work-library "-" unit-key ")") | 16669 " \\\n\t\t$(UNIT-" work-library "-" unit-key ")") |
16223 (while second-list | 16670 (while second-list |
16224 (insert " \\\n\t\t$(UNIT-" work-library "-" (car second-list) ")") | 16671 (insert " \\\n\t\t$(UNIT-" work-library "-" (car second-list) ")") |
16225 (setq second-list (cdr second-list))) | 16672 (setq second-list (cdr second-list))) |
16226 (while subcomp-list | 16673 (while subcomp-list |
16227 (when (assoc (car subcomp-list) unit-list) | 16674 (when (and (assoc (car subcomp-list) unit-list) |
16675 (not (equal unit-key (car subcomp-list)))) | |
16228 (insert " \\\n\t\t" (car subcomp-list))) | 16676 (insert " \\\n\t\t" (car subcomp-list))) |
16229 (setq subcomp-list (cdr subcomp-list))) | 16677 (setq subcomp-list (cdr subcomp-list))) |
16230 (insert "\n") | 16678 (insert "\n") |
16231 (setq prim-list (cdr prim-list))) | 16679 (setq prim-list (cdr prim-list))) |
16232 ;; insert rule for each library unit file | 16680 ;; insert rule for each library unit file |
16327 'vhdl-upper-case-types | 16775 'vhdl-upper-case-types |
16328 'vhdl-upper-case-attributes | 16776 'vhdl-upper-case-attributes |
16329 'vhdl-upper-case-enum-values | 16777 'vhdl-upper-case-enum-values |
16330 'vhdl-upper-case-constants | 16778 'vhdl-upper-case-constants |
16331 'vhdl-use-direct-instantiation | 16779 'vhdl-use-direct-instantiation |
16780 'vhdl-compose-configuration-name | |
16332 'vhdl-entity-file-name | 16781 'vhdl-entity-file-name |
16333 'vhdl-architecture-file-name | 16782 'vhdl-architecture-file-name |
16783 'vhdl-configuration-file-name | |
16334 'vhdl-package-file-name | 16784 'vhdl-package-file-name |
16335 'vhdl-file-name-case | 16785 'vhdl-file-name-case |
16336 'vhdl-electric-keywords | 16786 'vhdl-electric-keywords |
16337 'vhdl-optional-labels | 16787 'vhdl-optional-labels |
16338 'vhdl-insert-empty-lines | 16788 'vhdl-insert-empty-lines |
16371 'vhdl-testbench-statements | 16821 'vhdl-testbench-statements |
16372 'vhdl-testbench-initialize-signals | 16822 'vhdl-testbench-initialize-signals |
16373 'vhdl-testbench-include-library | 16823 'vhdl-testbench-include-library |
16374 'vhdl-testbench-include-configuration | 16824 'vhdl-testbench-include-configuration |
16375 'vhdl-testbench-create-files | 16825 'vhdl-testbench-create-files |
16826 'vhdl-testbench-entity-file-name | |
16827 'vhdl-testbench-architecture-file-name | |
16376 'vhdl-compose-create-files | 16828 'vhdl-compose-create-files |
16829 'vhdl-compose-configuration-create-file | |
16830 'vhdl-compose-configuration-hierarchical | |
16831 'vhdl-compose-configuration-use-subconfiguration | |
16377 'vhdl-compose-include-header | 16832 'vhdl-compose-include-header |
16378 'vhdl-compose-architecture-name | 16833 'vhdl-compose-architecture-name |
16379 'vhdl-components-package-name | 16834 'vhdl-components-package-name |
16380 'vhdl-use-components-package | 16835 'vhdl-use-components-package |
16381 'vhdl-self-insert-comments | 16836 'vhdl-self-insert-comments |
16434 ;;; Documentation | 16889 ;;; Documentation |
16435 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 16890 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
16436 | 16891 |
16437 (defconst vhdl-doc-release-notes nil | 16892 (defconst vhdl-doc-release-notes nil |
16438 "\ | 16893 "\ |
16439 Release Notes for VHDL Mode 3.32 | 16894 Release Notes for VHDL Mode 3.33 |
16440 ================================ | 16895 ================================ |
16441 | 16896 |
16442 - New Features | 16897 - New Features |
16443 - Enhanced Features | |
16444 - User Options | 16898 - User Options |
16445 - Remarks | |
16446 | 16899 |
16447 | 16900 |
16448 New Features | 16901 New Features |
16449 ------------ | 16902 ------------ |
16450 | 16903 |
16451 STRUCTURAL COMPOSITION: | 16904 CONFIGURATION DECLARATION GENERATION: |
16452 - Enables simple structural composition similar to graphical editors. | 16905 - Automatic generation of a configuration declaration for a design. |
16453 Simplifies the creation of higher design levels where subcomponents | 16906 (See documentation (`C-c C-h') in section on STRUCTURAL COMPOSITION.) |
16454 are simply sticked together: | |
16455 1. Create a skeleton for a new component | |
16456 2. Place subcomponents in it directly from the hierarchy browser | |
16457 3. Automatically connect all subcomponents and create the ports | |
16458 for the new component (based on names of actual ports) | |
16459 - Automatic generation of a components package (package containing | |
16460 component declarations for all entities). | |
16461 - Find more information in the online documentation (`C-c C-h'). | |
16462 | |
16463 PORT TRANSLATION: | |
16464 - Reverse direction of ports (useful for testbenches). | |
16465 | |
16466 SUBPROGRAM TRANSLATION: | |
16467 - Copy/paste of subprogram interfaces (similar to port translation). | |
16468 | |
16469 CODE FILLING: | |
16470 - Condense code using code-sensitive block filling. | |
16471 | |
16472 CODE STATISTICS: | |
16473 - Calculate number of code lines and statements in a buffer. | |
16474 | |
16475 | |
16476 Enhanced Features | |
16477 ----------------- | |
16478 | |
16479 TESTBENCH GENERATION: | |
16480 - Enhanced templates and user option default values. | |
16481 | |
16482 Emacs 21 compatibility/enhancements: | |
16483 - `lazy-lock-mode' is not used anymore (built-in `jit-lock-mode' is faster). | |
16484 | |
16485 And many other minor fixes and enhancements. | |
16486 | 16907 |
16487 | 16908 |
16488 User Options | 16909 User Options |
16489 ------------ | 16910 ------------ |
16490 | 16911 |
16491 `vhdl-project-file-name': (enhanced) | 16912 `vhdl-configuration-file-name': (new) |
16492 Include user name in project setup file name. | 16913 Specify how the configuration file name is obtained. |
16493 `vhdl-speedbar-cache-file-name': (enhanced, changed default) | 16914 `vhdl-compose-configuration-name': (new) |
16494 Include user name in cache file name. | 16915 Specify how the configuration name is optained. |
16495 `vhdl-default-library': (new) | 16916 `vhdl-compose-configuration-create-file': (new) |
16496 Default working library if no project is active. | 16917 Specify whether a new file should be created for a configuration. |
16497 `vhdl-architecture-file-name': (new) | 16918 `vhdl-compose-configuration-hierarchical': (new) |
16498 Specify how the architecture file name is obtained. | 16919 Specify whether hierarchical configurations should be created. |
16499 `vhdl-package-file-name': (new) | 16920 `vhdl-compose-configuration-use-subconfiguration': (new) |
16500 Specify how the package file name is obtained. | 16921 Specify whether subconfigurations should be used inside configurations. |
16501 `vhdl-file-name-case': (new) | |
16502 Allows to change case when deriving file names. | |
16503 `vhdl-compose-create-files': (new) | |
16504 Specify whether new files should be created for a new component. | |
16505 `vhdl-compose-include-header': (new) | |
16506 Specify whether a header is included in a new component's file. | |
16507 `vhdl-compose-architecture-name': (new) | |
16508 Specify how a new component's architecture name is obtained. | |
16509 `vhdl-components-package-name': (new) | |
16510 Specify how the name for the components package is obtained. | |
16511 `vhdl-use-components-package': (new) | |
16512 Specify whether component declarations go in a components package. | |
16513 `vhdl-use-direct-instantiation': (new) | |
16514 Specify whether to use VHDL'93 direct component instantiation. | |
16515 `vhdl-instance-name': (changed default) | |
16516 Allows insertion of a running number to generate unique instance names. | |
16517 `vhdl-testbench-entity-header', `vhdl-testbench-architecture-header':(obsolete) | |
16518 Headers are now automatically derived from the standard header. | |
16519 `vhdl-testbench-include-header': (new) | |
16520 Specify whether a header is included in testbench files. | |
16521 `vhdl-testbench-declaration', `vhdl-testbench-statements': (changed default) | |
16522 Non-empty default values for more complete testbench templates. | |
16523 | |
16524 | |
16525 Remarks | |
16526 ------- | |
16527 | |
16528 - Changed key binding for `vhdl-comment-uncomment-region': `C-c c' | |
16529 (`C-c C-c ...' is now used for structural composition). | |
16530 | |
16531 - Automatic buffer highlighting (font-lock) is now controlled by option | |
16532 `global-font-lock-mode' in GNU Emacs (`font-lock-auto-fontify' in XEmacs). | |
16533 \(Important: You MUST customize this option in order to turn automatic | |
16534 buffer highlighting on.) | |
16535 ") | 16922 ") |
16536 | 16923 |
16537 | 16924 |
16538 (defconst vhdl-doc-keywords nil | 16925 (defconst vhdl-doc-keywords nil |
16539 "\ | 16926 "\ |
16599 (defun vhdl-doc-variable (variable) | 16986 (defun vhdl-doc-variable (variable) |
16600 "Display VARIABLE's documentation in *Help* buffer." | 16987 "Display VARIABLE's documentation in *Help* buffer." |
16601 (interactive) | 16988 (interactive) |
16602 (unless vhdl-xemacs | 16989 (unless vhdl-xemacs |
16603 (help-setup-xref (list #'vhdl-doc-variable variable) (interactive-p))) | 16990 (help-setup-xref (list #'vhdl-doc-variable variable) (interactive-p))) |
16604 (with-output-to-temp-buffer (if (fboundp 'help-buffer) (help-buffer) "*Help*") | 16991 (with-output-to-temp-buffer |
16992 (if (fboundp 'help-buffer) (help-buffer) "*Help*") | |
16605 (princ (documentation-property variable 'variable-documentation)) | 16993 (princ (documentation-property variable 'variable-documentation)) |
16606 (with-current-buffer standard-output | 16994 (with-current-buffer standard-output |
16607 (help-mode)) | 16995 (help-mode)) |
16608 (print-help-return-message))) | 16996 (print-help-return-message))) |
16609 | 16997 |
16610 (defun vhdl-doc-mode () | 16998 (defun vhdl-doc-mode () |
16611 "Display VHDL Mode documentation in *Help* buffer." | 16999 "Display VHDL Mode documentation in *Help* buffer." |
16612 (interactive) | 17000 (interactive) |
16613 (unless vhdl-xemacs | 17001 (unless vhdl-xemacs |
16614 (help-setup-xref (list #'vhdl-doc-mode) (interactive-p))) | 17002 (help-setup-xref (list #'vhdl-doc-mode) (interactive-p))) |
16615 (with-output-to-temp-buffer (if (fboundp 'help-buffer) (help-buffer) "*Help*") | 17003 (with-output-to-temp-buffer |
17004 (if (fboundp 'help-buffer) (help-buffer) "*Help*") | |
16616 (princ mode-name) | 17005 (princ mode-name) |
16617 (princ " mode:\n") | 17006 (princ " mode:\n") |
16618 (princ (documentation 'vhdl-mode)) | 17007 (princ (documentation 'vhdl-mode)) |
16619 (with-current-buffer standard-output | 17008 (with-current-buffer standard-output |
16620 (help-mode)) | 17009 (help-mode)) |