Function: vhdl-port-paste-generic-map

vhdl-port-paste-generic-map is an interactive and byte-compiled function defined in vhdl-mode.el.gz.

Signature

(vhdl-port-paste-generic-map &optional SECONDARY NO-CONSTANTS)

Documentation

Paste as a generic map.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/vhdl-mode.el.gz
(defun vhdl-port-paste-generic-map (&optional secondary no-constants)
  "Paste as a generic map."
  (interactive)
  (unless secondary (indent-according-to-mode))
  (let ((margin (current-indentation))
	list-margin start generic
	(generic-list (nth 1 vhdl-port-list)))
    (when generic-list
      (setq start (point))
      (vhdl-insert-keyword "GENERIC MAP (")
      (if (not vhdl-association-list-with-formals)
	  ;; paste list of actual generics
	  (while generic-list
	    (insert (if no-constants
		      (car (nth 0 (car generic-list)))
		    (or (nth 2 (car generic-list)) " ")))
	    (setq generic-list (cdr generic-list))
	    (insert (if generic-list ", " ")"))
	    (when (and (not generic-list) secondary
		       (null (nth 2 vhdl-port-list)))
	      (insert ";")))
	(unless vhdl-argument-list-indent
	  (insert "\n") (indent-to (+ margin vhdl-basic-offset)))
	(setq list-margin (current-column))
	(while generic-list
	  (setq generic (car generic-list))
	  ;; paste group comment and spacing
	  (when (eq vhdl-include-group-comments 'always)
	    (vhdl-paste-group-comment (nth 4 generic) list-margin))
	  ;; paste formal and actual generic
	  (insert (car (nth 0 generic)) " => "
		  (if no-constants
		      (vhdl-replace-string vhdl-actual-generic-name
					   (car (nth 0 generic)))
		    (or (nth 2 generic) "")))
	  (setq generic-list (cdr generic-list))
	  (insert (if generic-list "," ")"))
	  (when (and (not generic-list) secondary
		     (null (nth 2 vhdl-port-list)))
	    (insert ";"))
	  ;; paste comment
	  (when (or vhdl-include-type-comments
		    (and vhdl-include-port-comments (nth 3 generic)))
	    (vhdl-comment-insert-inline
	     (concat
	      (when vhdl-include-type-comments
		(concat "[" (nth 1 generic) "] "))
	      (when vhdl-include-port-comments (nth 3 generic))) t))
	  (when generic-list (insert "\n") (indent-to list-margin)))
	;; align generic map
	(when vhdl-auto-align
	  (vhdl-align-region-groups start (point) 1 t))))))