From:	CSBVAX::MRGATE!info-gnu-emacs-request@prep.ai.mit.edu@SMTP 16-JUL-1988 15:01
To:	ARISIA::EVERHART
Subj:	GNUEMACS kbd macro aids for translating 7.2 VHDL to 1076 VHDL


Received: from ai.ai.mit.edu by prep.ai.mit.edu; Fri, 15 Jul 88 18:59:27 EST
Received: from tut.cis.ohio-state.edu (TCP 20044404074) by AI.AI.MIT.EDU 15 Jul 88 12:52:35 EDT
Received: by tut.cis.ohio-state.edu (5.54/2.0)
	id AA14024; Fri, 15 Jul 88 05:44:06 EDT
Received: from USENET by tut.cis.ohio-state.edu with netnews
	for info-gnu-emacs@prep.ai.mit.edu (info-gnu-emacs@prep.ai.mit.edu)
	(contact usenet@tut.cis.ohio-state.edu if you have questions)
Date: 13 Jul 88 08:54:17 GMT
From: sdcrdcf!cs.utexas.edu!milano!pp!cadillac!grout@oberon.usc.edu  (Steve Grout)
Organization: MCC CAD Program
Subject: GNUEMACS kbd macro aids for translating 7.2 VHDL to 1076 VHDL
Message-Id: <GROUT.GNUS7@sunspot.cad.mcc.com>
Sender: info-gnu-emacs-request@prep.ai.mit.edu
To: info-gnu-emacs@prep.ai.mit.edu

;;; -*- mode: emacs-lisp -*-
;;; ************************************************************************
;;;  Copyright (C) 1988 Microelectronics and Computer Technology Corporation
;;;  - VLSI CAD Program - %Y%
;;; ************************************************************************
;;;  File Contents:  Aids For Translating 7.2 VHDL to IEEE 1076-1987 VHDL
;;;  This file may be redistributed provided the above copyright notice 
;;;  appears on all copies and that the further free redistribution of this 
;;;  file is not in any way restricted by those who redistribute it.
;;;
;;;  These gnuemacs aids are distributed 'as is', without warranties of any kind.
;;;
;;;  This file is not part of any MCC proprietary or DoD VHDL software.
;;; 
;;;     Author:     Steve Grout
;;;
;;; **********************************************************************
;;; DESCRIPTION:  Save this message as a file named "translate-72-to-1076.el".
;;; 
;;; This file describes the generic changes that will be made
;;; using GNU-EMACS keyboard macro command definitions
;;; to convert ../VHD/CH*/*.vhd 7.2 files to ../VHD/CH*/*.vhdl 1076 files.
;;; Each section briefly describes what the 7.2 language construct WAS
;;;   and what it should be in order to be proper 1076 VHDL.
;;; Each 'fset' expression was created as keyboard macro, named,
;;;    inserted into this file, and bound to an available key.
;;; The 'BINDING - ACTION' table below summarizes the bindings
;;;    and under the conditions this file is used by the author
;;;    shows up as a 'reminder' buffer at the top of the screen.
;;;
;;; Most of the actual translation commands work in the current
;;;   buffer window and are therefore independent of the current
;;;   gnuemacs screen/windowing configuration. 
;;;
;;; However a few commands (e.g., meta-c-shift-B, meta-c-shift-N) presume
;;;   that the current gnuemacs window is about 120-chars by
;;;   55-lines in size, a *shell* buffer has been started, this
;;;   file has both been loaded and is in a buffer, the chapter
;;;   of interest (e.g., ../VHD/CH10/*) is in a dired buffer with
;;;   the point at the file being edited, and the file of interest
;;;   is a buffer, the shell window is cd'd to the chapter of interest,
;;;   and that the command to VHDL analyze a file is 'va'.  Also
;;;   the shell assumes a UNIX 'csh'.
;;;
;;;   This somewhat complicated setup allows for very
;;;   fast editing, verification, and moving on to the next file.
;;;
;;;   If all of that is too much to follow, then just ignore that
;;;   part. (All of this is quite easy to CREATE but much more
;;;   complicated to change...most of the time, a new keyboard was
;;;   simply created to do the most correct action and took the
;;;   place of the previous definition.)
;;;  --jsgrout 5/5/88
;;;
;;;     Modification History
;;;   --------------------------------------------------------------------
;;; Cleaned up, added copyright boiler-plate, description, and posted
;;;   to vhdl-sw@simtel20.arpa, info-vlsi@think.com, and comp.lis --jsgrout 7/14/88
;;; **********************************************************************
;;;
;;; --------------------------------------------------------------
;;;   BINDING:         ACTION:
;;; --------------------------------------------------------------
;;;
;;;  meta-c-W        Fix with-package     
;;;  meta-shift-B    Fix with-package and add package body
;;;  meta-shift-P    Change package to package body
;;;  meta-c-P        Fix entity ports
;;;  meta-c-A        Fix architectural block
;;;  meta-c-F        Fix for-loop
;;;  meta-c-shift-C  Fix component declarations/instantiations
;;:  meta-c-shift-Q  fix standalone function
;;;  meta-K          Fix package containing a function
;;;  meta-G          fix-qualified-name - <name>'('<lit>'..)
;;;  meta-S          Fix signal target list
;;;  meta-A          Fix attribute specification
;;;  c-X c-T         Fix attribute declaration
;;;  meta-c-shift-Y  create a mail message from current shell buffer
;;;  meta-c-shift-D  Move current test to ../VHD/Dead directory.
;;;  meta-c-shift-N  Save, rename, and edit next file
;;;  meta-c-shift-B  test file referenced by vhdl buffer, assuming
;;;                        standard translate window setup.
;;;  meta-o h        Update DoD header for 1076 update, sccs
;;;  meta-shft-;     Comment out line
;;;  meta-;          Uncomment out line
;;;
;;; ------------------------------------------------------------
;
;;; ; make sure cant exit X-emacs unless I want to.
;;;    If I type c-X C-X the worst I do is save buffers...
(global-set-key "" 'save-some-buffers)
 
;;; ------------------------------------------------------------
;1. Convert 'with package, ..use package' statements:
;   WAS:
;     with package <name> ;
;      use <name>;
;   IS:
;     -- with package <name> ;
;     use <name>.all ;
;   FUNCTION: fix-with-package
;   BINDING:  meta-c-W
(fset 'fix-with-package
   "with-- use ;.alluse 
(global-set-key "" 'fix-with-package) ;  meta-c-W

;;; ------------------------------------------------------------
;2. Convert Entity Port & Generic Statements:
;   WAS:
;     entity <name> ( <port list> ) is
;        generic ( <generic decls> )
;   IS:
;     entity <name> is
;       generic ( < generic decls> ) ;
;       port ( <port list> ) ;
;   FUNCTION: fix-entity-ports
;   BINDING:  meta-c-P
;
(fset 'fix-entity-ports
   "entity()
(global-set-key "" 'fix-entity-ports)  ;  meta-c-P

;;; ------------------------------------------------------------
;3. Convert Architectural bodies:
;   WAS:
;     architecture <name> of <name> is
;      <lable> :    block
;         begin
;         ...
;      end block ;
;     end <name> ;
;   IS:
;     architecture <name> of <name> is
;       -- <lable> :   block
;           begin
;            ...
;       -- end block ;
;     end <name>;
;   FUNCTION: fix-arch-block
;   BINDING:  meta-c-A
;
(fset 'fix-arch-block
   "architectureffb
(global-set-key "" 'fix-arch-block) ; meta-c-A

;;; ------------------------------------------------------------
;   WAS:
;      for <name> := <range> loop .. end loop ;
;   IS:
;      for <name> in <range> loop .. end loop ;
;   FUNCTION: fix-for-loop
;   BINDING:  meta-c-F
(fset 'fix-for-loop
   "for:=
(global-set-key "" 'fix-for-loop)  ; meta-c-F

;;; ------------------------------------------------------------
; 5. Comment out line VHDL-style
;   WAS:
;     <anything>
;      <anything>
;   IS:
;     -- <anything>
;     -- <anything
;   FUNCTION: vhdl-comment-out-line
;   BINDING:  meta-shift-;
(fset 'vhdl-comment-out-line
   "--")
(global-set-key ":" 'vhdl-comment-out-line) ; meta-shift-;

;;; ------------------------------------------------------------
; 6. Uncomment VHDL-style line 
;   WAS:
;     --<anything>
;     <anything> --  <anything>
;   IS:
;     <anything>
;     <anything> <anything>
;   FUNCTION: vhdl-uncomment-line
;   BINDING:  meta-;
(fset 'vhdl-uncomment-line
   "--")
(global-set-key ";" 'vhdl-uncomment-line) ; meta-;

;;; ------------------------------------------------------------
;1. Convert  package statements to package-body statements:
;   WAS:
;     with package <name>;
;     use <name>;
;     package <name> ;
;     <statements>
;     end <name> ;
;   IS:
;     -- with package <name>;
;     use <name>.all ;
;     package body <name> ;
;     <statements>
;     end <name> ;
;   FUNCTION: fix-with-package-body
;   BINDING:  meta-shift-B
(fset 'fix-with-package-body
   "with-- useb
(global-set-key "B" 'fix-with-package-body) ;  meta-shift-B

;;; ------------------------------------------------------------
;   WAS:
;     (not applicable)
;   IS:
;
;   FUNCTION: after editing is complete, save the current buffer,
;              kill the buffer, go back to the chapter buffer,
;              rename the file to .vhdl, and begin editing the next file.
;   BINDING:  meta-c-shift-N
(fset 'save-and-get-next-file
   "k
(global-set-key "" 'save-and-get-next-file); meta-c-shift-N

;;; ------------------------------------------------------------
;   WAS:
;     package <name> is
;      <package declarations which belong in package body>
;     end <name> ;
;   IS:
;     use <name>.all ;
;     package body <name> is
;      <package body declarations, including FUNCTIONs>
;     end <name> ;
;   FUNCTION: Change from package declaration to package body
;   BINDING:  meta-shift-P
(fset 'change-to-package-body
   "packagebody 
(global-set-key "P" 'change-to-package-body); meta-shift-P

;;; ------------------------------------------------------------
;   WAS:
;     package <name> is
;      <function> ;
;     end <name> ;
;   IS:
;     use <name>.all ;
;     package <name> is
;       <function declaration> ;
;     end <name> ;
;     use <name>.all ;
;     package body <name> is
;       <function specification> ;
;     end <name> ;
;   FUNCTION: fix package containing a function.
;   BINDING:  meta-shift-P
(fset 'fix-package-function
   "package
(global-set-key "k" 'fix-package-function)

;;; ------------------------------------------------------------
;   FUNCTION: Save and run thru VHDL analyzer in next window.
;   BINDING:  meta-c-shift-B
(fset 'test-vhdl-buffer
   "3o
(global-set-key "" 'test-vhdl-buffer); meta-c-shift-B

;;; ------------------------------------------------------------
;   WAS:
;     Architecture <name> of <name> is
;       ...
;       component <name> port ( <port list> ) ;
;     begin
;       <label>: <name> port ( (<portlist>), <portlist>) ;
;     end <name> ;
;   IS:
;     Architecture <name> of <name> is
;       ...
;       component <name> port ( <port list> ) ;
;       END COMPONENT ;
;     begin
;       <label>: <name> port MAP( <portlist> ) ;
;     end <name> ;
;   FUNCTION: Fix Component Declaration, Instantiations.
;   BINDING:  meta-c-shift-C
(fset 'fix-components
   "componentport );
(global-set-key "" 'fix-components); meta-c-shift-C

;;; ------------------------------------------------------------
;   WAS:
;     function <name> ...
;       ...
;     end <name>;
;   IS:
;     use P.all ;
;     package body P is
;     function <name> ...
;       ...
;       end <name>;
;     end P ;
;   FUNCTION: fix-standalone-function
;   BINDING:  meta-c-shift-Q
(fset 'fix-standalone-function
   "function
(global-set-key "" 'fix-standalone-function) ;


;;; ------------------------------------------------------------
;   WAS:
;     <Results for a given test.>
;   IS:
;     To: <project-leader>
;     From: <Tester>
;     Subject: Error not found during Acceptance Test
;     Cc: <tester>
;     --text follows this line--
;     file: <test file name>
;     command: <command used to generate below results>
;     <run time results for a given test.>
;     
;   FUNCTION: create a mail message from current shell buffer
;   BINDING:  meta-c-shift-Y
(fset 'make-error-mail-message
   "
(global-set-key ""  'make-error-mail-message) ;

;;; ------------------------------------------------------------
;   WAS:
;     <current acceptance file - not yet a proper 1076 test..>
;   IS:
;     <file no longer in its original Analyzer/VHD chapter directory.>
;   FUNCTION: Move current test to ../VHD/Dead directory.
;   BINDING:  meta-c-shift-D
(fset 'move-test-to-Dead-dir
   "3o
(global-set-key "" 'move-test-to-Dead-dir)

;;; ------------------------------------------------------------
;   WAS:
;     <signal-list> <= waveform ;
;   IS:
;     ( <signal-list ) <= waveform ;
;   FUNCTION: Fix signal target list
;   BINDING:  meta-S
(fset 'fix-signal-target-list
   "fb( <=) ")
(global-set-key "s" 'fix-signal-target-list)

;;; ------------------------------------------------------------
;   WAS:
;     .. <name>'('<literal-charactar>'..)
;   IS:
;     .. <name> ' ('<literal-charactar>'..)
;   FUNCTION: fix-qualified-name 
;                 - a temporary fix for current analyzer bug.
;   BINDING:  meta-G
(fset 'fix-qualified-name
   "'('  ")
(global-set-key "g" 'fix-qualified-name)


;;; ------------------------------------------------------------
;   WAS:
;     for <attrname> of <entityclass> <entityname> use <expr> ;
;   IS:
;     attribute <attrname> of <entityname>:<entityclass> is <expr> ;
;   FUNCTION: fix attribute specification
;   BINDING:  meta-a
(fset 'fix-attribute-specification
   "for attribute  t :  dis")
(global-set-key "a" 'fix-attribute-specification)

;;; ------------------------------------------------------------
;   WAS:
;     attribute <name> of <entityclass> is <typemark> ;
;   IS:
;     attribute <name> : <typemark> ;
;   FUNCTION: 
;   BINDING:  
(fset 'fix-attribute-declaration
   "attribute  
(global-set-key "" 'fix-attribute-declaration)

;;; ------------------------------------------------------------
;   WAS: <original DoD/Intermetrics test header>
;   IS:  Added SCCS fields and modification notice
;         indicating updating of test to 1076 std at mcc.com
;   FUNCTION: Update DoD test headers for sccs, 1076 change
;   BINDING:
(fset 'update-DoD-header
   "---------- File: %P%Original file name: 
(global-set-key "oh" 'update-DoD-header)

;;; ------------------------------------------------------------
(fset 'update-DoD-header-next
   "k
(global-set-key "on" 'update-DoD-header-next)

;;; ------------------------------------------------------------
;;;  The following are 
;;;  gnuemacs commands to setup a  bunch of windows after
;;;    restarting X-emacs.  Note that there are key-bound
;;;    macros for both 80x50 and 120x50 sized windows, with
;;;    the default being a 120x50 size.
;;;;
;;;  To start up a set of test translation windows, 
;;;     do the following:
;;;;
;;;    1.  meta-x load-file ~/.emacs
;;;    2.  meta-x load-file $VHDL_EMACS/init_vhdl  ;; which defines where 'va' is.
;;;    3.  meta-x dired $VHDL_TEST/Analyzer/VHD/
;;;    4.  meta-x load-file translate-72-to-1076.el
;;;         and then edit that file as well
;;;    5.  Go to the VHD dired buffer and
;;;          movethe cursor to the desired chapter and type:
;;;          meta-c-shift-T to start a window setup.
;;;    6.  Once the chapter 'dired' comes up,
;;;         move the mouse to the first file of interest
;;;         and edit (with 'E')
;;;    7.  Move to *shell* window, and give the command:
;;;         %  cd <chapter-name>
;;;    8.  Now give the 'reset-test-window by typing:
;;;         meta-c-shift-R
;;;
;;;    Everything should now be up and in the proper
;;;    configuration with your mouse in the file buffer
;;;    ready to start/continue editting.
;;;
;;;  Install via:
;;;     meta-X load-file
;;;       setup-test-windows.el
;;; 
;;;  Defined Keys:
;;;    meta-c-shift-T:  Setup test windows - do after startup of 'X-emacs &'
;;;                        (Assumes you have ONLY the VHD buffer up so far.)
;;;    meta-c-shift-R:  restart test windows - puts windows in normal format
;;;                        (Assumes you have ALL the buffers up already, including
;;;                          translate-72-to-1076.el, <chapter-buffer>, and *shell*.)
;;;    meta-c-shift-L:  reload VHDL conversion gnuemacs macros.
;;;    meta-c-shift-B:  Test the VHDL file in the current buffer, assuming
;;;                        standard translate window setup.
;;;
;;;  Author: JSGRout 5/13/88
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(fset 'setup-80x50-test-window ; this sets up an 80X50 window ;
      "1bVHD

(fset 'setup-120x50-test-window ; this sets up a 120X50 window
      "1bVHD

(global-set-key "" 'setup-120x50-test-window); Meta-c-shift-T: setup test windows

(fset 'restart-80x50-test-window ; this restarts a 80x50 window set
   "1btranslate-72-to-1076.el

;(fset 'restart-120x50-test-window ; this restarts a 120x50 window set
 ;  "1btranslate-72-to-1076.el
(fset 'restart-120x50-test-window ; this restarts a 120x50 window set
   "1btranslate-72-to-1076.el

(global-set-key "" 'restart-120x50-test-window); Meta-c-shift-R: restart test windows

(fset 'reload-test-macros
   "xload-file
(global-set-key "" 'reload-test-macros); meta-c-shift-L: reload test macros

(fset 'test-vhdl-buffer
   "3o
(global-set-key "" 'test-vhdl-buffer); meta-c-shift-B

--
Steve Grout @ MCC VLSI CAD Program, Austin TX.  [512] 343-0860 
ARPA: grout@mcc.arpa
UUCP: {ihnp4,seismo,harvard,gatech,pyramid}!ut-sally!im4u!milano!grout

