% tiedoc.tex  25 Oct 89

% adapted to CWEB by J.Schrod on 89-10-25

\documentstyle[a4]{article}
\font\mc=cmcsc10
\def\TANGLE{{\tt TANGLE}}
\def\TIE{{\tt TIE}}
\def\WEAVE{{\tt WEAVE}}
\def\WEB{{\tt WEB}}
\def\CWEB{{\mc cweb}}
\def\PASCAL{{\mc Pascal}}
\title{The TIE Processor}
\author{Klaus Guntermann\\
TH Darmstadt\\
Fachbereich Informatik\\
Institut f\"ur Theoretische Informatik}

\date{October 1989}
\begin{document}
\maketitle
\section{Introduction}

To install a program on a computer usually
system dependent changes are needed.
The \WEB\ system allows to describe these changes in a
so called change file.
To incorporate the changes into the program \TANGLE\ processes
the original source file and inserts the changes into the proper places.

Sometimes it is good practice to develop a set of change files to be able to
distinguish between different changes like
program enhancements, bug fixes, system dependent changes 
and output device dependent modifications.
Additionally this allows combinations of changes that can be used with a set of 
programs that share some common features.

The processors \TANGLE\ and \WEAVE\ can handle only one change file.
The combination of change files is done best in another preprocessing step.
\TIE\ is able to create either a new master file or a single change file that 
comprises the effect of all change files.

Since \TIE\ does not know anything about \WEB\ programs but only about the 
structure of change files, it is possible to use this program for other 
programming languages as well.
You just pretend that you want to create a new master file and \TIE\ will go 
and insert all the changes from your change files.



\section{Application}

The current version of \TIE\ accepts a master file and up to 9 change files.
Because in general it is important to use the changes in their proper sequence 
the order of the files must be chosen carefully.

The CWEB version of \TIE{} may be called with the following command
line interface:
%
\begin{verbatim}
   tie -[mc] output_file master_file changefile(s)
\end{verbatim}
%
The option \verb|-m| results in the creation of a new master file,
\verb|-c| yields a new changefile.  Usually wildcards may be used for
the filenames. 

The multiple change files are used as if the single change files were merged 
into the master files step by step.
Thus more than 9 change files might be incorporated by repeated application of 
\TIE.

Please note that even when multiple change files are processed each of the 
files is read only once.
For each of the change files and for the master file there is only one line in 
memory at a time (neglecting operating system buffering).
Thus the storage requirement of \TIE\ does not depend on the size of the change 
files or the size of a single changed section.

\vfill\eject
\def\eof{$\langle$EOF$\rangle$}
\section{Example}

To illustrate the actions \TIE\ performs you may inspect the following example 
that exercises some of the border line cases.

$$\vbox{
\halign{#\hfill\qquad\quad&#\hfill\qquad\quad&#\hfill\qquad\quad&#\hfill\cr
``master''      &{\tt CF1}      &{\tt CF2}      &{\tt CF3}\cr
line 1		&@x		&@x		&@x\cr
line 2		&line 2		&line 1		&changed line 4\cr
line 3		&line 3		&changed line 2	&@y\cr
line 4		&@y		&changed line 3	&final line 4\cr
line 5		&changed line 2	&inserted line	&@z\cr
line 6		&changed line 3	&line 4		&\eof\cr
line 7		&inserted line	&@y\cr
line 8		&@z		&final line 2\cr
line 9		&		&final line 3\cr
line 10		&@x		&changed line 4\cr
\eof		&line 7		&@z\cr
		&@y\cr
		&changed line 7	&@x\cr
		&@z		&changed line 7\cr
		&\eof		&line 8\cr
		&		&@y\cr
		&		&final line 7\cr
		&		&final line 8\cr
		&		&@z\cr
		&		&\eof\cr}
}$$
\vfill\eject
Using these input files and running \TIE\ twice to create a new master file
and a new change file will result in the following output files:

$$\vbox{
\halign{#\hfill\qquad\quad&&#\hfill\qquad\quad\cr
``master''	&``change''\cr
final line 2	&@x\cr
final line 3	&line 1\cr
final line 4	&line 2\cr
line 5		&line 3\cr
line 6		&line 4\cr
final line 7	&@y\cr
final line 8	&final line 2\cr
line 9		&final line 3\cr
line 10		&final line 4\cr
\eof		&@z\cr
		&\cr
		&@x\cr
		&line 7\cr
		&line 8\cr
		&@y\cr
		&final line 7\cr
		&final line 8\cr
		&@z\cr
		&\eof\cr}
}$$
\end{document}
