!--- EDIT # 0005	5 Dec 1979   11:39:10	DR0:[300,56]README.TEC;10  !
!--- PREVIOUS EDIT	5 Dec 1979   11:36:48	DR0:[300,56]README.TEC;7  !


This is file README.TEC.	
	many handy TEC things, by
	Ray Van Tassle
	Motorola
	1301 E. Algonquin Rd.
	Room 3145
	Schaumburg, Ill.

	We use TECO V 34. Most of these macros run on both V29 & V34,
	on 11D 6.2, IAS V2.0, and 11M V3.1.

	We have made a couple of mods to TECO34. The most useful of these
	is to change the EI command, to wit: 
		If the filename given in the EI command does *NOT*
		specify a device or UFD, it will 1st look in the users
		default device/ufd. If the file is not found, it will
		look at LB:[2,2] for it. We find this extremely useful,
		because this acts something like an automatic library
		feature for TECO macros. Note that the initializing
		lookup for TECO.TEC specifies the device/UFD, so TECO.TEC
		must be in your default device/UFD.
		This new module is included.

	We have also modified the CCLCMD.MAC, which is the initializing
	TECO commands on startup. We know that our machine is not
	a VAX, nor is it running VMS, and we don't use VTEC, so I
	took all that stuff out (including TECO.INI-which I think is
	useless, especially with our TECO.TEC) and it starts up
	faster.

	We use HAZELTINE 1500's, so I also had to modify the TTY I/O
	stuff. All the files I modified are included---if you want to
	see what I did, try the "MUN TAD", using the original TECO34
	from the New Orleans tape.
 **** WARNING ***** The N.O. tape TECO34 appears to have some kind
	of address sensitive bug, which showed up for me when I was
	changing CCLCMD, making it shorter and longer. I would get
	a fatal error "FCS invalid lun", when trying to do an EW.
	When the size of CCLCMD was changed, or when I included ODT,
	the bug went away.
	(Maybe it is due to the fact that an overlay extends to
	the next 4-byte boundary, even if it doesn't appear to, because
	of the disc read requirement ???? Maybe not.)



                                       COPYNOTE.TEC
       Invoke this via "TEC @COPY".  This will  put  the  proprietary
       statement on the .TITLE, put in the copyright notice, and (op-
       tionally) replace the .IDENT.  It first  reads  the  copyright
       notice  from  DR0:[1,2]CPYWRT.TXT.   (The  notice  is  flagged
       between the characters "/" and "\".  It  next  prompts  for  a
       file-spec.   To  quit, type CTRL/Z.  It then prompts for a new
       IDENT.  If you want to  change  this,  enter  the  new  IDENT.
       Otherwise just type "CR".  The operation is:

            1.  Read a file and print out the filename.

            2.  Search for a .TITLE statement.

                1.  If found, replace it's text with the module  name
                    (from the filename), and the Motorola Proprietary
                    notice.

                2.  If not found, print out a  warning  message,  and
                    put in one as the 1st line in the file.

            3.  If a new IDENT was specified,  search  for  a  .IDENT
                statement.

                1.  If found, replace it's text  with  the  specified
                    text.

                2.  If not found, print out a  warning  message,  and
                    put in one as the 2nd line in the file.


            4.  Search for an old copyright notice, and if found, de-
                lete it & print out a message.

            5.  Search for a .IDENT statement.

                1.  If found, insert the new copyright  notice  after
                    it.

                2.  If not found, insert the copyright  notice  after
                    the 1st line of the file.


            6.  If the filename you typed in did not have a wildcard,
                write  out  the  new file with the same name, and the
                next higher version number.

            7.  If you did give it a wildcard filename, write it  out
                with  the  same  name, but an extent of ".NEW".  (You
                can later use PIP to copy or rename them).   It  will
                then  repeat  these  steps, until it has done all the
                files which match the wildcard filename.  (Better not
                use  *.* however, as the .NEW ones will also match it
                & it will never end).

            8.  Go back to prompt for more input.  If you  are  done,
                enter CTRL/Z.


                                        IND.TEC
       Invoke this via "TEC @IND.TEC".  It formats an assembly source
       file, including indenting a SAL program.  It first prompts for
       "comment alignment", then for file-name.  The operation is:

            1.  Set up the comment alignment control.  If you answer-
                ed:

                1.  'NO'--it will not align comments.

                2.  A number--it will align the comments to start  at
                    this column number.

                3.  Nothing--it will align the comments at column  41
                    (the  5th tab stop).  But any comments before the
                    first statement label (one with a :  or ::)  will
                    be  at  column  25 (the 3rd tab stop).  This will
                    allow longer comments on the preamble---the equa-
                    tes,  initializing  macro calls, GLOBL declarati-
                    ons, etc.


            2.  Read the next file & print out the filename.

            3.  Search for a "EDIT Audit trail line" (see  TECO.TEC),
                and if one is found, it is flagged as "INDENTED".

            4.  Go thru it line by line, performing the following ac-
                tions on each line.

                1.  If it is a full line comment (a ";" in column 1),
                    leave it alone.

                2.  Delete any trailing tabs or spaces (see the  note
                    on COMMENT ALIGNMENT below).

                3.  If it does not begin with a tab or space:

                    1.  If it starts off with a  statement  label  (:
                        or ::), make the label start in column 1.

                    2.  If it starts off with an equate label  (=  or
                        ==), make it start in column 1 and delete any
                        "whitespace" before or after the ='s.

                    3.  Otherwise, assume it starts off with  an  op-
                        code.


                4.  Delete all whitespace between the label (if any),




                    and the opcode.

                5.  Indent the statement (starting with the  opcode).
                    If  it  is  a SAL program, the indentation is ac-
                    cording to nesting level (2  spaces  per  level).
                    The  zero-level  indentation  is at column 9 (1st
                    tab stop).

                6.  If comment alignment is called  for,  delete  the
                    whitespace  right  before the comment, and insert
                    enough whitespace to align it.  If it is  already
                    past  the  comment  column, a single space it in-
                    serted before the comment.


                                          NOTE

                        The comment is found as "one or more tabs
                        or  spaces followed by a ;".  Therefore a
                        quoted tab or space in the  source  might
                        get changed, such as
                        " CMP R1,#' ;  COMMENT ".  (But  this  is
                        not  good  programming  practice  in  any
                        case).



                7.  Any SLP audit trail is adjusted so that  it  will
                    not go past column 80.

                8.  The statement is adjusted so that it will not  go
                    past column 80.  (This is done by reducing redun-
                    dant whitespace (as  little  as  possible)  going
                    from  right to left.  A line which cannot be made
                    to fit will be left alone, and a warning  message
                    will be printed out.


            5.  When the entire file is processed, the same  final  3
                steps as COPY.TEC will be done.



                                    NOTE

           The wildcard file name and fitting on  80  columns  is
           not complete yet, but will be shortly.






                            TECO.TEC

            This procedure is  invoked  automatically  everytime  you
       enter TECO.  (As long as it is in your UFD).  We use it to au-
       tomatically keep an "EDIT AUDIT TRAIL" both in the source  mo-
       dule  itself and in a seperate "Edit History" file.  It is au-
       tomatically invoked by TECO everytime it starts up, so you can
       include  any interesting things you might want to set up (such
       as loading up some handy TECO macro's  you  have,  printing  a
       "hello" message, etc).

            It's operation is:

            1.  Set the "Edit Verify" flag so that right before  each
                TECO  prompt,  the  current line is typed out, with a
                "^" character showing the  current  position.   (This
                can be cancelled by a "0EV" command.)

            2.  Put the current date & time in Q-registers D & T
		and an "escape" in Q-register E.


            3.  If the command was NOT "TEC filename", quit &  go  to
                normal TECO things.

	It also does the TECO V34 thing with the "memory file", that is
	it remembers the last file editted, and if you invoke TECO
	with just "TEC", it will read the memory file and pretend you
	said "TEC filename".
            4.  If the command was "TEC filename" and the file  is  a
                .MAC, .SAL, .RNO, .C, .PAS or .TEC then do
		the following steps
                (if not just do as the previous step) :

            5.  Search for the Edit Audit Trail from the  last  edit.
                If not found:

                1.  If this is a .TEC file,  insert  it  as  the  1st
                    line.

                2.  If this is one of the other types of file, insert
                    it  after  the  .IDENT, or if no IDENT was found,
                    insert it after the 1st line.


            6.  Set up the next line to give the info of the previous
                edit.

            7.  Increment the edit number on  the  Edit  Audit  Trail
                line, and put in the current date and time.

            8.  On the same line, put in the complete file-spec  that
                will go on the updated output file.

            9.  Read in the file "EDITHIST.*";1 (on the same device &
                UFD), which has the same extent as the file to be ed-
                itted.  If none exists, create it.

            10. At the end of this file, put in the same info  as  is
                on  the  Edit  Audit Trail line (date, time, & files-
                pec).

            11. If this file is too big, delete the oldest  50  lines
                (giving a message), until is is small enough.

            12. Write it back out, replacing the old one.

            13. Type out the info on the previous edit.

            14. Go back to the normal TECO operation.


            This operation keeps track (in the  source  file  itself)
       the info for the latest 2 edits, and in a seperate Edit Histo-
       ry file the info on ALL normal TECO edit's to a  certain  type
       of source file.  Here is the info on this file which I am cur-
       rently working on:
          .COMMENT EDIT   0040   27 OCT 1978   12:35:10  DR1:[300,3]RT.RNO;54
          .COMMENT PREVIOUS EDIT 27 OCT 1978   12:14:44  DR1:[300,3]RT.RNO;53

	GET.TEC and STRIP.TEC
	These will take an SRD listing and edit it to come up with
	a PIP command file to copy the files. See my SRD writeup
	on this same tape, in UFD [300,57]


	TAD.TEC
	This will create files to put a SLP audit trail on an updated
	.MAC file. Invoke it with "MUN TAD". It will prompt
	for filename(s) and the device/ufd/version of the original
	and new versions. When it is done, it will tell you to
	invoke the (just created) command file "UPDATE.CMD".
	This uses CMP to get the differences between the two versions,
	invoke "MUN SLPID" to do some munging on the output file, then
	invoke SLP. This works pretty good---see my SRD listings
	(in [300,57] to see an example of it's work).


	STATUS.TEC and QS.TEC
	Within TECO, do "EISTATUS$$", and it will give you all sorts
	of interesting info about the status of the TECO flags, etc.
	It will also invoke QS.TEC to tell you what Q-registers have
	data in them, and which ones have a numeric value, along with
	that value (except a value of zero). I stole/modified these
	from an old DECUS tape.


	MT.TEC
	!!!!!! This is it !!!!!!!!
	This is a teco macro to read a line of input from the terminal.
	I finally got tired of doing it over from scratch each time.
	Copy it into your TECO program (macro). It reads one line
	from the terminal, just like an "I.....$$" command.
	It returns a value of success/fail. Fail means CTRL/Z was typed.


	CVL.TEC
	This will take a .RNO file in upper case, with the funny switches
	to control lower case output, and convert the .RNO source to
	lower case characters.
