\chapter{BASIC-PLUS/BASIC-PLUS-2 Handling}
\label{BASIC-PLUS/BASIC-PLUS-2 Handling}

\section{Purpose}
\label{Purpose}

     In  BASIC-PLUS  and  BASIC-PLUS-2  a  program  statement  may  be
     continued over more than one text line.  A text line which is not
     the last text line of a given statement may need to be flagged as
     a  ``continued''  line.   (See  the  appropriate language reference
     manual  for  requirements  of  each  version  of  each   language
     processor.)

     The standard continuation flag is the {\tt \&} character.  A line  which
     must  be  marked  as ``continued'' is written with an {\tt \&} as the last
     non-whitespace character before the {\tt <CR><LF>}.

     (An older form of continuation was, in BASIC-PLUS  only,  to  end
     the text line by typing a \fbox{LF} key instead of \fbox{CR}.)

     The switches described in this appendix cause TECO to  manipulate
     the  text  files in such a way that each text line appears in the
     editing buffer to be completely ``conventional'':   that  is,  each
     text  line  ends with a standard {\tt <CR><LF>}, and no text line has a
     trailing  {\tt \&}  character.   You  can  correctly  edit   well-formed
     BASIC-PLUS  or  BASIC-PLUS-2  source  files  without having to be
     concerned about continuation conventions.


\section{Method}
\label{Method}

     TECO allows you to work with ``unemcumbered'' lines in the  editing
     buffer  by removing continuation conventions as each text line is
     read  in.   You  indicate  that  you  want  this  processing   by
     specifying  a switch on the file specification supplied to the {\tt ER}
     (or the {\tt EB}) command.

     TECO (again) adds appropriate continuation  conventions  to  each
     text  line  as  it  is  written out from the editing buffer.  You
     indicate that you want this processing by specifying a switch  on
     the file specification supplied to the {\tt EW} (or the {\tt EB}) command.


\section{Input Processing}
\label{Input Processing}

     As TECO reads each new text line into the editing buffer,  it  is
     examined  for  a  trailing  {\tt \&}  character.   If one is found, TECO
     removes it, and then additionally  removes  any  trailing  spaces
     and/or tabs.

     (In the case of {\tt <LF>} continuation, TECO  converts  that  kind  of
     line terminator character sequence to {\tt <CR><LF>}.)

     The available switches follow.  (Consult the appropriate appendix
     to see which switches are supported on your operating system.)

\begin{tabular}{ll}

            {\tt /B2}    & TECO strips trailing {\tt \&} sequences \\

            {\tt /n}     & Same as /B2 for input processing \\

            {\tt /B+}    & TECO changes {\tt <LF><CR><NUL>} \\
                         & sequences to {\tt <CR><LF>}. \\
\end{tabular}


\section{Output Processing}
\label{Output Processing}

     As TECO writes each text line from the editing buffer, it takes a
     look  at  the text line which will follow.  If the following line
     begins with a digit, the current line is written without  change.
     If  the  following line does not begin with a digit, TECO assumes
     that the current line must be continued.

     The convention applied to an output text line which TECO marks as
     ``continued''  depends  on  the  form  of  the  switch you specify.
     (Consult the appropriate  appendix  to  see  which  switches  are
     supported on your operating system.)

\begin{list}{}{\labelsep 30pt}

            \item [{\tt /B2}]     TECO appends a space and an {\tt \&}

            \item [{\tt /n}]     TECO appends an {\tt \&}, after padding out 
                         	 the line with tabs and/or spaces to make 
                         	 the {\tt \&} appear in column {\tt n} 

            \item [{\tt /B+}]    TECO ends the line with a
                         	 {\tt <LF><CR><NUL>} sequence 
                         	 (instead of {\tt <CR><LF>}.)
\end{list}


\section{Form Feed Interaction}
\label{Form Feed Interaction}

     When TECO reads a page of text into the editing buffer, it  stops
     when  a  {\tt <form feed>} character is encountered, or when the buffer
     has been filled to capacity.  In the latter case, the  last  line
     will  be complete, and will include its line delimiter.  However,
     no look-ahead is done to examine the next line in the file.

     If TECO is being used with one of the switches described in  this
     appendix,  a  very  long BASIC-PLUS-x source program which is not
     segmented with {\tt <FF>} characters can cause the  last  line  in  the
     buffer  to  not  be  the  last  text  line of a multi-line source
     statement.

     When the buffer is written to the output file, TECO has no way of
     determining  whether  the  next  text line (the first line of the
     next buffer load) will begin with a line number.  TECO makes  the
     assumption  that  the  buffer's  last  text  line  is  not  to be
     ``continued'', and terminates it with {\tt <CR><LF>}.  If this assumption
     is  incorrect (frequently the case), remaining text lines of that
     multi-line  statement  will  be  lost   when   the   program   is
     subsequently OLDed.

     To  avoid  this  problem,  lengthy  BASIC-PLUS  or   BASIC-PLUS-2
     programs  should  be segmented with {\tt <form feed>} characters before
     editing  them   using   these   TECO   switches.    Segments   of
     approximately  150  to  200 lines are convenient.  Starting a new
     page even more frequently to make listings readable isn't  a  bad
     idea, either.

