\section{Special Numeric Values}
\label{Special Numeric Values}

     TECO maintains several internal variables which record conditions
     within  TECO.   The  variable  name  is equivalent to the current
     contents of the variable and may be entered as a numeric argument
     to  TECO  commands.   When  the  command is executed, the current
     value of the designated variable becomes the numeric argument  of
     the command.

     Some of the characters which stand for specific values associated
     with the text buffer have been introduced earlier in this manual.
     For example, the dot character {\tt .}, which represents the  current
     pointer  position,  may  be  used in the argument of a T command.
     The command {\tt .,.+5T} causes the 5 characters following the buffer
     pointer  to  be  typed  out.   When this command is executed, the
     number of characters preceding the buffer pointer is  substituted
     in  each  case  for the ``dot''.  The addition is then carried out,
     and the command is executed as though it were of the form {\tt m,nT}.

     Table~\ref{Characters Associated With Numeric Quantities} lists all of the characters which have special numeric
     values.   Any of these characters may be used as numeric argument
     in place of the value it represents.



\begin{table}[h]
\caption{\bf{Characters Associated With Numeric Quantities}}
\label{Characters Associated With Numeric Quantities}
\end{table}
\nopagebreak

\begin{list}{}{\labelsep 20pt}

    \item [CHARACTER]      FUNCTION
    \item [{\tt B}]         
	Always equivalent to  zero.   Thus,  {\tt B}  represents  the
              position preceding the first character in the buffer.
    \item [{\tt Z}]         
	Equivalent  to  the  number  of  characters   currently
               contained  in  the  buffer.   Thus,  {\tt Z}  represents  the
               position following the last character in the buffer.

     \item [{\tt .}]         
	Equivalent to the  number  of  characters  between  the
               beginning of the buffer and the current position of the
               pointer.  Thus {\tt .} represents the current  position  of
               the pointer.

     \item [{\tt H}]         
	Equivalent to the numeric  pair  {\tt B,Z},  or  {\em from  the
               beginning  of  the buffer up to the end of the buffer}.
               Thus, {\tt H} represents the whole buffer.

     \item [{\tt nA}]        
	Equivalent to the ASCII code for the {\em .+n+1}th  character
               in  the  buffer (that is, the character to the right of
               buffer pointer position {\em .+n}).  The  expression  {\tt -1A}  is
               equivalent   to   the   ASCII  code  of  the  character
               immediately preceding the pointer and {\tt 0A} is  equivalent
               to   the   ASCII  code  of  the  character  immediately
               following the pointer (the current character).  If  the
               character  position  referenced lies outside the bounds
               of the text buffer, this command returns a -1.

     \item [{\tt Mq}]        
	The {\tt Mq}  command  (execute  the  contents  of  the  text
               storage area of Q-register q as a command string) may
               return a numeric value  if  the  last  command  in  the
               string returns a numeric value and is not followed by a
               {\tt <ESC>}.

     \item [{\tt Qq}]        
	Equivalent to the value stored in  the  number  storage
               area of Q-register q.

\ifnotintecoeight
     \item [{\tt :Qq}]       
	Equivalent to the number  of  characters  in  the  text
               storage area of Q-register q.
               {\em [Not in TECO-8]}
\fi

     \item [{\tt \bs}]         
	Backslash is equivalent to the  numeric  value  of  the
               digit  string in the text buffer at the current pointer
               position,  interpreted  in  the  current  radix.    The
               pointer is moved to the end of the digit string.

     \item [\caret {\tt B}]        
	{\tt <CTRL/B>} (\caret {\tt B}) is equivalent to  the  current  date
               via the following equations:

	\begin{list}{}{\labelsep 10pt}
               \item[OS/8:]      
			\caret {\tt B} = (((month*32)+day)*8)+((year-1970)\&7)+k
                         where k = 4096 if year$>$1977 and k=0 otherwise
               \item[RT-11:]     
			\caret {\tt B} = (((month*32)+day)*32)+year-1972
               \item[RSTS/E:]    
			\caret {\tt B} = ((year-1970)*1000)+day within year
               \item[RSX-11:]    
			\caret {\tt B} = ((year-1900)*16+month)*32+day
               \item[VAX/VMS:]   
			\caret {\tt B} = ((year-1900)*16+month)*32+day
               \item[TOPS-10:]   
			\caret {\tt B} = (((year-1964)*12+month-1)*31+day-1)
	\end{list}
 
      \item [\caret {\tt E}]        
        {\tt <CTRL/E>} (caret/E) determines  whether  or  not  the  {\tt P}
                command  (and related operations) append a form feed to
                the contents of the buffer on output.  If \caret{\tt E} is  
		-1,  a
                form  feed  is  appended;   if \caret{\tt E} is 0, no form 
		feed is
                appended.
 
                Each time text is read into the text buffer  TECO  sets
                the \caret{\tt E} flag.  If the text read terminated due 
		to a form
                feed (i.e., if  the  text  buffer  was  loaded  with  a
                {\em complete  page}),  \caret{\tt E}  is set to -1.  If 
		the text read
                terminated because the buffer was  filled  to  capacity
                before a form feed was encountered or because there was
                no form feed (i.e., the text buffer was not loaded with
                a {\em complete page}), \caret{\tt E} is set to 0.
 
                In TECO-11, you can set the \caret{\tt E} flag's  value  directly,
                overriding  the  value  set  by  the most recent buffer
                read.  Be sure to use only values of 0  or  -1;   other
                values may cause unpredictable results.
 
      \item [\caret {\tt F}]        
        {\tt <CTRL/F>} (caret/F) is equivalent to the  current  value
                of the console switch register.
 
\iftecotenonly
      \item [{\tt n} \caret {\tt F}]       
        {\tt n<CTRL/F>} is the terminal number  plus  200000  (octal)
                for job {\tt n}'s terminal.  -1\caret{\tt F} is the 
		terminal number plus
                200000 (octal) for your job's terminal.  The result  is
                0  if  the  specified job is detached or if there is no
                such job.
                {\em [TECO-10 only]}
\fi
 
      \item [\caret {\tt H}]        
        {\tt <CTRL/H>} (caret/H) is equivalent to the current time of
                day via the following equations:
        \begin{list}{}{\labelsep 10pt}
                \item[OS/8:]      \caret{\tt H} = 0
                \item[RT-11:]     \caret{\tt H} = (seconds since midnight)/2
                \item[RSTS/E:]    \caret{\tt H} = minutes until midnight
                \item[RSX-11:]    \caret{\tt H} = (seconds since midnight)/2
                \item[VAX/VMS:]   \caret{\tt H} = (seconds since midnight)/2
                \item[TOPS-10:]   \caret{\tt H} = 60ths of a second since midnight
                       (or 50ths of a second where 50 Hz power is used)
        \end{list}
 
      \item [\caret {\tt N}]        
        {\tt <CTRL/N>} (caret/N) is the end  of file  flag.   It  is
                equivalent  to  -1  if  the  file open on the currently
                selected input stream is  at  end  of  file,  and  zero
                otherwise.
 
\ifnotintecoeight
      \item[\caret {\tt S}]        
        {\tt <CTRL/S>}  (caret/S) is equivalent to the negative of the
                length  of  the  last  insert,  string found, or string
                inserted with a {\tt G} command, whichever  occurred  last.
                To back up the pointer to the start of the last insert,
                string found, etc., type \caret{\tt SC}.
                {\em [Not in TECO-8]}
\fi
 
      \item[\caret {\tt T}]        
        {\tt <CTRL/T>} (caret/T) is equivalent to the ASCII code  for
                the  next  character  typed  at the terminal.  Every 
		\caret{\tt T}
                command executed causes TECO to pause  and  accept  one
                character  typed  at  the  terminal.   See  the {\tt ET} flag
                description (section~\ref{Mode Control Flags}) for variations.
 
      \item[{\tt :}\caret {\tt T}]       
        Reads and decodes  the  next  keystroke  typed  at  the
                terminal.   The  decoded  keystroke  is  returned  in a
                manner  similar  to  that  used  for  immediate  ESCape
                sequence  commands  (see section 
                \ref{Immediate ESCAPE-Sequence Commands}), i.e., via 
                {\tt <type>} and {\tt <value>} codes, as follows:
 
        \begin{list}{}{\labelsep 10pt}
                      \item[{\tt <type>} 0]   
                        Normal character, {\tt <value>} is ASCII value.
                      \item[{\tt <type>} 1]   
                        Control character (except ESCape or CSI);
                          {\tt <value>} is ASCII value of control char. A 
                        typed {\tt <CR>} yields {\tt <type>} 1 {\tt <value>} 
                        13, and subsequent \caret {\tt T} or : \caret {\tt T}
                        does not return a {\tt <LF>} .
                    \item [{\tt <type>} 2]   
                        Same as immed ESC seq {\tt <type>} 0
                      \item [{\tt <type>} 3]   
                        Same as immed ESC seq {\tt <type>} 1
                      \item [{\tt <type>} 4]   
                        Same as immed ESC seq {\tt <type>} 2
\iftecoelevenonly
                      \item [{\tt <type>} 5]   
                        Same as immed ESC seq {\tt <type>} 3
        \end{list}
                {\em [TECO-11 only]}

      \item[\caret {\tt Y}]        
        {\tt <CTRL/Y>} (caret/{\tt Y}) is equivalent to {\tt .+\caret S,.},  
		the  {\tt n,m}
                numeric argument spanning the text just searched for or
                inserted.  This value  may  be  used  to  recover  from
                inserting  a string in the wrong place.  
        Type \caret{\tt YXSFR}\escape
                to store the string in Q-register S and remove it  from
                the  buffer.   You can then position the pointer to the
                right place and type {\tt GS} to insert the string.
                {\em [TECO-11 only]}

      \item[\caret {\tt Z}]        
        {\tt <CTRL/Z>} (caret/Z) is equivalent  to  the  total  space
                occupied  by  text  in  the  Q-registers (including the
                command line currently being executed).
                {\em [TECO-11 only]}
\fi
 
      \item[\caret \caret {\tt x}]       
        The combination of the Control-caret (double  caret  or
                double   up-arrow)   followed   by   any  character  is
                equivalent to the value of  the  ASCII  code  for  that
                character.    The  {\tt x}  in  this  example  may  be  any
                character that can be typed in to TECO.
 \end{list}
\subsection*{Mode Control Flags}

     The following mode control flags return numeric values.  The  use
               of these flags is described below in section~\ref{Mode Control Flags}.

\begin{list}{}{\labelsep 20pt}
     \item [{\tt ED}]        Equivalent to the current value of the edit level flag.

     \item [{\tt EH}]        Equivalent to the current value of the help level flag.

     \item [{\tt EO}]        Equivalent to the version number of the version of TECO
               which  is  currently  being run.  This manual describes
               TECO-11 Version  40,  TECO-8  Version  7,  and  TECO-10
               Version 3.

\ifnotintecoeight
     \item [{\tt ES}]        Equivalent  to  the  current  value   of   the   search
               verification flag.
               {\em [Not in TECO-8]}
\fi

     \item [{\tt ET}]        Equivalent to the current value of the type out control
               flag.

     \item [{\tt EU}]        Equivalent to the current value of the upper/lower case
               flag.

\iftecoelevenonly
     \item [{\tt EV}]        Equivalent to the current  value  of  the  edit  verify
               flag.
               {\em [TECO-11 only]}
\fi

\ifnotintecoeight
     \item [\caret {\tt X}]        {\tt <CTRL/X>} (caret/{\tt X}) is 
		equivalent to the  current  value of the search mode flag.
               {\em [Not in TECO-8]}
\fi
\end{list}

