\chapter{TOPS-10 Operating Characteristics}
\label{TOPS-10 Operating Characteristics}

\section{Startup}


     TECO is started with the

\begin{verbatim}
               .R TECO
\end{verbatim

     command.  TECO is now immediately ready to accept commands.   The
     text buffer and Q-register areas are empty.  Initial commands may
     also be specifified by  following  the  monitor  command  with  a
     dollar sign (\$) and then some TECO commands.  For example,

\begin{verbatim}
     .R TECO $3EH
\end{verbatim}

     starts TECO with the help level flag set to 3.

     The TECO command

\begin{verbatim}
               .TECO filespec
\end{verbatim}

     is used to edit an already existing file.  It is equivalent to

\begin{verbatim}
               .R TECO
               *EBfilespec\escapeY\escape\escape
\end{verbatim}

     TOPS-10 ``remembers'' the filespec as the name  of  the  last  file
     that has been edited.

     The MAKE command

\begin{verbatim}
               .MAKE filespec
\end{verbatim}

     is used to create a new file.  It is equivalent to

\begin{verbatim}
              .R TECO
               *EWfilespec\escape\escape
\end{verbatim}

     TOPS-10 ``remembers'' the filespec as the name  of  the  last  file
     that was edited.

     The command

\begin{verbatim}
               .MAKE filespec1=filespec2
\end{verbatim}

     is used to edit {\tt filespec2} into {\tt filespec1}.  That is, 
	{\tt filespec2}  is
     opened  as the input file, and {\tt filespec1} is created as the output
     file.  It is equivalent to

\begin{verbatim}
               .R TECO
               *ERfilespec2`EWfilespec1`Y``
\end{verbatim}

     TOPS-10 ``remembers'' the {\tt filespec1} as the name of  the  last  file
     that was edited.

     The command

\begin{verbatim}
               .TECO
\end{verbatim}

     with no arguments, causes CCL to execute the command

\begin{verbatim}
               .TECO filespec
\end{verbatim}

     where filespec was the file that was previously remembered as the
     last  file  to be edited.  The system purposely does not remember
     filenames from one editing session to the next, that is, when you
     log  out,  the  system  ``forgets''  the  name of the file you were
     editing.

     TECO-10 does not require the use of the {\tt MUNG} command  to  execute
     TECO macros because runnable TECO programs can be created via use
     of the {\tt EE} command and these can then be run with the  standard  
	{\tt R}
     or {\tt RUN} command.  This TECO command has the format

\begin{verbatim}
               EEfilespec`
\end{verbatim}

     which saves away the  current  image  of  TECO  in  the  filename
     specified.   The  default  extension  is  {\tt .EXE}.  When the file is
     subsequently run (using the  {\tt R}  or  {\tt RUN}  monitor  command),  
	TECO
     resumes execution with the TECO command immediately following the
     {\tt EE} command.


\section{Startup Conditions}
\label{Startup Conditions}

     The initial value of the {\tt EU} flag is 0 if you  are  running  on  a
     terminal  that  does not support lower case, and is -1 if you are
     running on a terminal that does support lower case.

     The initial value of the {\tt ET} flag is as follows:

\begin{tabular}{ll}

          Bit value      & Initial value \\

               1         & 0 \\
               2         & 0 (1 if terminal is a scope) \\
               4         & 1 \\
               8         & 0 \\
               16        & 0 \\
               32        & 0 \\
               64        & 0 \\
               128       & 1 (TECO's prompt sets this to 0) \\
               256       & 0 \\
               512       & 0 (1 if VT support is present) \\
               1024      & 0 \\
               2048      & 0 \\
\end{tabular}


     The initial value of the ED flag is 1.


\section{File Specification}


     The  file  access  commands  {\tt ER},  {\tt EB},  and  {\tt EW}  
accept   a   file
     specification in the standard TOPS-10 format:

\begin{verbatim}
               dev:filename.type[p,pn]
\end{verbatim}


     in which {\tt dev:}  is a physical  device  name  or  a  user  assigned
     logical  name;   if  {\tt dev:}  is not specified, the default {\tt DSK:}  
	is
     assumed.  The filename field must be specified  in  the  commands
     {\tt ER},  {\tt EB},  and {\tt EW} and be a legal TOPS-10 filename.  
The type field
     is a file extension and must be explicitly given the first  time.
     Thereafter, if a corresponding command is given with no extension
     specified, the system uses the previously specified extension  as
     the default.  The same defaulting rules hold for the dev:  field.
     The {\tt <prot>} construct is permitted on any output filespecification
     to allow setting the protection of the file being created.


\section{Backup Files}


     The {\tt EB} command maintains one level of  file  backup  on  TOPS-10.
     The pre-edited input file name is changed to

\begin{verbatim}
               filename.BAK
\end{verbatim}

     before the new output file is  closed  with  the  original  name.
     Only normal file closing commands ({\tt EC}, {\tt EF}, {\tt EG}, 
	and {\tt EX}) cause this
     renaming to happen.  If TECO is aborted or  the  output  file  is
     purged  by  the {\tt EK} command, the input filename remains unchanged.
     Note only one {\tt .BAK} file for a given name is kept;   earlier  
	{\tt .BAK}
     backup files are deleted each time a new backup file is created.

     A good policy to follow when editing is to close the edited  file
     frequently  enough so that an unexpected incident would not cause
     a substantial loss of work.  Files should be backed up regularly.
     TECO  has the power to let an unsuspecting user alter a good file
     into a completely useless state.  The {\tt FILCOM} program can be  used
     to verify an editing session.


\section{Exit And Go}


     If TECO  is  exited  via  the  {\tt EG}\escape  command,  then  
	TOPS-10  will
     re-execute  the  last  explicit  compile-class  command  that was
     executed during that session.

\section{CTRL/C}


     The action taken when the user types  {\tt <CTRL/C>}  depends  on  what
     TECO  is doing.  At command level {\tt <CTRL/C>} is an immediate action
     command.  If typed as the  very  first  character  in  a  command
     string  (not  necessarily the first keystroke) it aborts TECO and
     returns to the monitor.  No Control-C trapping is available under
     TOPS-10.   The  {\tt ?XAB} error message is not supported.  If 
	{\tt <CTRL/C>}
     is typed in the middle of entering a command  string,  then  TECO
     returns  control  to  the  monitor.   Note  that if TECO executes
     {\tt <CTRL/C>} as a command from command level, TECO  is  aborted.   If
     TECO  executes  a  {\tt <CTRL/C>}  command from within a macro, TECO is
     also aborted.  If two consecutive {\tt <CTRL/C>}s are typed while  TECO
     is  running, or while TECO is typing on the terminal, or while an
     error message is printing, then control returns to the  operating
     system.  If one {\tt <CTRL/C>} is typed to TECO while it is waiting for
     input, then control returns to the operating system.


\section{Exceptions}


     TECO-10  does  not  support  the  following  commands  which  are
     described in this manual:

\begin{enumerate}
          \item  Secondary streams ({\tt EP}, {\tt EA}, {\tt ER}\escape, 
	{\tt EW}\escape)

          \item   Wildcards ({\tt EN})

          \item   Immediate aids {\tt LF} and {\tt BS}.
\end{enumerate}

     The following incompatibilities exist between TECO-10  and  DEC's
     TOPS-10 TECO V24:

\begin{enumerate}
          \item  The {\tt nA} command under TOPS-10 TECO  V24  always  returned
              the  value  of  the current character, regardless of the
              value of {\tt n}.  In TECO-10,  {\tt 0A}  gives  the  value  of  the
              current character.
\end{enumerate}



\section{User Initialization}


     If a user has a file called {\tt TECO.INI} in his area, then when  TECO
     starts  up  (via  a CCL command), it will execute the contents of
     this file (as a TECO macro).  This file must contain a valid TECO
     program.   {\tt TECO.INI} will be executed before TECO opens any files.
     That is, if TECO was invoked via a {\tt MAKE} command, {\tt TECO.INI}
 will be
     executed before the {\tt EW} command (for the {\tt MAKE}) is executed.

\section{Installation Instructions}


     To create TECO for TOPS-10 from the sources, issue the  following
     commands:

\begin{verbatim}
     .LOAD/MAC/COMPILE TECO10.T10+TECO10.MAC
     .SAVE TECO10
     .LOAD/MAC/COMPILE TECERR.T10+TECO10.MAC
     .SAVE TECERR
\end{verbatim}

     To create TECO for TOPS-20 from the sources, issue the  following
     commands:

\begin{verbatim}
     @LOAD/MAC/COMPILE TECO10
     @SAVE TECO20
\end{verbatim}

     This builds a raw TECO.  This version of TECO  does  not  contain
     any window support since the {\tt W} and {\tt :W} commands are 
	implemented as
     macros.  To load window support, issue the following commands:

\begin{verbatim}
     .RUN TECO10 (or TECO20)
     *EITECO10.TEC\escape\escape
     *EETECO\escape\escape
\end{verbatim}

     You now have a runnable TECO image with window support.

\section{TMPCOR Support}
\label{TMPCOR Support}

     The {\tt EQ} and  {\tt E\%}  commands  support  the  pseudo-device  
	{\tt TMP:}   for
     {\tt TMPCOR}.   Onlhy  the  first three letters of the file name will be
     used, to try and access a {\tt TMPCOR} file.  If that  fails,  it  will
     try  {\tt nnnNAM.TMP}  where  {\tt nnn}  is  your  job  number and 
	{\tt NAM} is the
     three-character name.  For example:  for job  23,  
	{\tt EQqTMP:FOOBAR}\escape
     will read {\tt TMPCOR} file {\tt FOO} or {\tt 023FOO.TMP}.

\section{Q-register Names}
\label{Q-register Names}

     Any printable character (except open parenthesis) is valid  as  a
     Q-register  name.   A  Q-register  whose  name  is  a  lower case
     alphabetic character is the same as  the  Q-register  whose  name
     consists  of the corresponding upper case letter.  Thus {\tt Qa} 
	and {\tt QA}
     are equivalent commands.  Q-register names may also be  up  to  6
     characters  long,  by  enclosing  the  name  in  parentheses, for
     example, {\tt Q(FOOBAR)}.  Q-register names may contain  any  printable
     characters,  however  all  characters other than letters, digits,
     dollar-sign, space, and underline are reserved for special use by
     TECO.   A  Q-register  name  consisting  entirely of zero or more
     spaces is the  same  as  Q-register  {\tt ()},  which  is  special  and
     discussed   below.   Trailing  spaces  in  Q-register  names  are
     discarded, and lower case is converted to upper case.

\section{Referencing The Text Buffer As A Q-register}
\label{Referencing The Text Buffer As A Q-register}

     The Q-register with the null name:  {\tt ()} is the text  buffer.   The
     numeric  part  of  this  Q-register  is  the  value  of {\tt dot}.  The
     sequence {\tt [A ]()} causes  Q-register  A  to  share  with  the  text
     buffer.   The  old  main  text  buffer is lost (unless it is also
     sharing with some Q-register or if  it  has  been  saved  on  the
     Q-register push-down list).  The text in Q-register A becomes the
     text buffer and the numeric part of Q-register A is used for  {\tt .}
     if it is in range, otherwise {\tt dot} is set to 0.

\section{Sharing Of Q-register Pointers}
\label{Sharing Of Q-register Pointers}

     Q-registers may share their text with each  other  and  with  the
     text  buffer  as a result of {\tt [} and {\tt ]} commands.  When 
a Q-register
     is pushed onto the Q-register pushdown list, all that  is  pushed
     is  the  numeric part of the Q-register and a pointer to the text
     part of the Q-register.  Thus a command such as {\tt [A ]B} would cause
     Q-registers  {\tt A} and {\tt B} to share the same text.  
	The commands {\tt X}, \caret {\tt U},
     and {\tt EQ} could be applied to either  Q-register  without  modifying
     the other, since the Q-register is unbound from its previous text
     first.  However, the colon-modified forms of {\tt X} and \caret {\tt U}
	  append  to
     the  existing  text,  so  a  {\tt :X} or {\tt :}\caret{\tt U} command 
	for either of them
     would affect the other.

\section{Editing Line Sequence Numbered Files}
\label{Editing Line Sequence Numbered Files}

     Some ASCII files have a  special  type  of  line  number  at  the
     beginning of each line.  These {\em line-sequence numbers} conform to
     certain rules so that they may be ignored or treated specially by
     compilers  and  other  programs.  The standards for line-sequence
     numbers are given in the {\em LINED Program Reference Manual}.

     TECO does not need line-sequence numbers for operation, but  TECO
     can  be  used  to  edit files containing them.  If such a file is
     edited with TECO-10, the line-sequence numbers are, in the normal
     case,  simply  preserved  as  additional text at the beginning of
     each line.  The line-sequence numbers may be deleted, edited, and
     inserted   exactly   like   any   other  text.   On  output,  the
     line-sequence numbers  are  output  according  to  the  standard,
     except  that  the  tab  after  the number is output only if it is
     already there.  Leading zeros are added as necessary.  If a  line
     without  a  line-sequence  number is encountered, a line-sequence
     number word of five spaces is placed  at  the  beginning  of  the
     line.

     The following switches are available for use  with  line-sequence
     numebred   files.    These  switches  are  merely  added  to  the
     appropriate file selection command.

\begin{verbatim}
     ERfilespec/SUPLSN`
     EBfilespec/SUPLSN`
\end{verbatim}

     causes line sequence numbers to be suppressed at input time.  The
     numbers will not be read into the editing buffer.  Also, the tabs
     following the line-sequence  numbers,  if  they  exist,  will  be
     suppressed.

\begin{verbatim}
     EWfilespec/SUPLSN`
\end{verbatim}

     causes the line-sequence numbers to be suppressed at output time.
     Tabs  following the line-sequence numbers will also be suppressed
     if they exist.

\begin{verbatim}
     EWfilespec/GENLSN`
     EBfilespec/GENLSN`
\end{verbatim}

     causes line sequence numbers to be generated for the output  file
     if  they  did  not  already  exist  in the input file.  Generated
     line-sequence numbers begin at 00010 and continue with increments
     of 10 for each line.

     Note that these switches are needed only if a  change  is  to  be
     made  in the format of the file being edited.  If no switches are
     specified, a file is output in the same form as it was input.

\section{Compiler Restrictions}
\label{Compiler Restrictions}

     TECO-10 is a compiler rather than an  interpreter.   This  means,
     that  before your command string is executed, TECO-10 compiles it
     into assembly language code.  This makes it must faster than most
     other TECOs.  Before executing a macro (with the {\tt Mq} command) TECO
     compiles the program in the macro.  The next time  the  macro  is
     executed, TECO notes that the macro has already been compiled and
     merely branches to the compiled code.  If  the  contents  of  the
     Q-register  are  changed (via an {\tt X} or {\tt U} command), then 
TECO notes
     that it must re-compile the commands  should  the  Q-register  be
     invoked as a macro.

     One consequence of this is that if a syntax error is detected  in
     a  command,  no  portion of that command will have been executed.
     For example, typing the command {\tt HK=} will  yield  the  {\tt ?NAE}
	  error
     message  and  the  text  buffer  will  NOT  be  cleared.  Another
     consequence of this is that you  must  not  invoke  a  macro  two
     different  times  using two different numbers of arguments.  If a
     macro  gets  initially  invoked  with  two  arguments,  then  all
     subsequent  invocations  must  supply  two arguments.  Also, TECO
     cannot tell while compiling an {\tt Mq}  command  whether  or  not  the
     macro  returns  a  value.   Therefore  it assumes that a value is
     always  returned.   This  value  can  be  explicitly  removed  by
     followed  the  {\tt Mq} command with an {\tt <ESCAPE>}.  The {\tt MqA}
	 command will
     compile the {\tt A} command as if it were an {\tt nA} command rather 
	than  an
     {\tt APPEND}.
