Function: vhdl-port-paste-port-map

vhdl-port-paste-port-map is a byte-compiled function defined in vhdl-mode.el.gz.

Signature

(vhdl-port-paste-port-map)

Documentation

Paste as a port map.

Source Code

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