\newpage
\section{The WOLCOMPII composition system}

   WOL provides a textual composition system, embedded in the Pascal
language.  The user writes a program that loads the component geometry
cells, then composes them together.  The WOLCOMPII composition system is
intended to be a more user-friendly interface to an earlier composition
system called WOLCOMP (written by Carver Mead; see the next section).  In
order to use these routines, a PASCAL program must search and link the
following modules:

{\tt
\begin{verbatim}
import
   $search '/LIB/WOLLIB/WOLCOMP/WOLCOMP'$  wolcomplib,
   $search '/LIB/WOLLIB/WOLCOMP/WOLCOMPII'$  wolcompii ;
\end{verbatim}
}

   A brief description of these routines follows:

\begin{flushleft}
   {\bf PROCEDURE  wolcomp\_init}(lamb :  integer);
\end{flushleft}
   Initialize the WOLCOMP and WOLCOMPII libraries to generate CIF
with $\lambda$~=~lamb~/~100 microns.   This must be the first call
to the system, and is generally followed by commands to load the
various geometry cells:
\begin{flushleft}
   {\bf PROCEDURE load} (filename : strg);
\end{flushleft}
   Reads a file containing a composition cell, and inserts all contained
geometry cells into an internal dictionary.  The global string variable
{\tt prefix} is prepended to {\tt filename}; this is convenient while
searching some library directory.  The {\tt load} command is identical to
the WOLCOMP {\tt load\_library} procedure.  Once all the cells are loaded,
they can be composed into new cells:


\begin{flushleft}
   {\bf PROCEDURE define\_cell } (cell\_name : strg);
\end{flushleft}
   Begin the definition of the cell ``cell\_name''.  The current cell
placement origin (x0,y0) is set to the lower left corner (0,0), and
transformation, composition, and overlap modes are reset.  The definition
is terminated with the {\tt \bf endef;} statement.
\begin{flushleft}
   {\bf PROCEDURE  place} (cell\_name : strg);
\end{flushleft}
   Within a cell definition, position an instance of cell ``cell\_name'' at
position (x0,y0).  The user can manually update (x0,y0) by hand as in
WOLCOMP (perhaps making use of the ``{\tt cell\_width}'' and ``{\tt
cell\_height}'' procedures below), {\em or} they can be updated
automatically according to the current {\em \putindex{composition mode}},
and ``overlap'' distance (see below).  For example, if we are currently
composing horizontally, {\tt x0} will be updated to {\tt
x0+cell\_width-overlap}, and {\tt y0} will be left undisturbed.
If the global variable {\tt include\_geometry} is set to {\tt FALSE} before
a call to {\tt place}, the coordinate (x0,y0) is updated, but {\em no geometry
is actually drawn}; this is often useful in debugging to reduce the amount
of output CIF generated.
\begin{flushleft}
   {\bf PROCEDURE  hcompose};
\end{flushleft}
   Set the current composition mode to horizontal.  Successive calls
   to {\tt place} will create a horizontal row of cells.
\begin{flushleft}
   {\bf PROCEDURE  vcompose};
\end{flushleft}
   Set the current composition mode to vertical.
\begin{flushleft}
   {\bf PROCEDURE  nocompose};
\end{flushleft}
   Set the current composition mode to ``do nothing''.  This means that
x0 and y0 are unaffected by a call to {\tt place}.  This is the default
initial composition mode of WOLCOMPII.
\begin{flushleft}
   {\bf PROCEDURE overlap }(lambda : integer);
\end{flushleft}
   Sets the overlap between adjacent cells. For example, if {\tt vcompose}
   is set, and {\tt overlap(10)} is in effect, then every call to
   {\tt place} will result in {\tt x0} (the position of the {\em next}
   cell to be placed) to be 10 lambda to the left of the new cell's right side.
\begin{flushleft}
   {\bf PROCEDURE  make\_array} (cell\_name : strg; count : integer);
\end{flushleft}
   Equivalent to the loop:
    {\tt for i := 1 to count do place(cell\_name);}
\begin{flushleft}
   {\bf PROCEDURE  transform} (xfrm : integer);
\end{flushleft}
   Sets the current transform to {\tt xfrm}, which can take the value
   of the predeclared constants:
   \begin{verbatim}
   R0 = 0;
   R90 = 1;
   R18 = 2;  R180 = 2;
   R27 = 3;  R270 = 3;
   M0  = 4;               MX  = 4;
   M90 = 5;
   M18 = 6;  M180 = 6;    MY  = 6;
   M27 = 7;  M270 = 7;    MXY = 7;
   \end{verbatim}
   This transform {\em remains in effect} until another transform is
   specified, or another cell is defined; all calls to {\tt place} will
   employ the current transform.  The initial transform in WOLCOMPII is R0
\begin{flushleft}
   {\bf PROCEDURE vpad } (cell1, cell2, cell3 : strg; to\_width : integer);
\end{flushleft}
   Takes one instance of {\tt cell1} and vertically adds as many instances
   of {\tt cell2} as are required to give a cell of height {\tt to\_width}
   in lambda.  It is legitimate to partially overlap instances of {\tt cell2}.
   The resulting cell is defined as cell3.  This function is useful in
   generating parameterized cells that must ``stretch'' to abut against
   some constraining cell.  This function must not be called within
   a {\tt define\_cell} command, as cell definitions cannot be nested.
\begin{flushleft}
   {\bf PROCEDURE hpad } (cell1, cell2, cell3 : strg; to\_width : integer);
\end{flushleft}
   Same as {\tt vpad}, but the composition is horizontal.
   (identity transform).

   Once the project composition is complete, WOLCOMP is terminated with
a call to:
\begin{flushleft}
   {\bf PROCEDURE  shut\_down;}
\end{flushleft}

   Other functions that are often useful include:
\begin{flushleft}
   {\bf FUNCTION   cell\_width} (cell\_name : strg) : integer;
\end{flushleft}
   Returns the width of the cell in internal WOLCOMP units, which
   makes it suitable for addition/subtraction from variables such
   as (x0,y0).
\begin{flushleft}
   {\bf FUNCTION   cell\_height} (cell\_name : strg) : integer;
\end{flushleft}
   Similar to ``cell\_width'', but returns the height of the cell.
\begin{flushleft}
   {\bf FUNCTION make\_cell\_name} (root : strg; i : integer) : strg;
\end{flushleft}
   Returns a string which is the concatenation of the string {\tt root},
   and a string containing the integer {\tt i}.
\begin{flushleft}
   {\bf PROCEDURE  push} (xi, yi : integer);
\end{flushleft}
   Push a pair of integers onto a stack.  This is very useful for
   recording some (x0,y0) position that you want to return to after
   going off and doing something else.
\begin{flushleft}
   {\bf PROCEDURE  pop} (var xi, yi : integer);
\end{flushleft}
   Pop a pair of integers off the stack, into the variables xi and yi.
\begin{flushleft}
   {\bf PROCEDURE include\_file} (fname : strg);
\end{flushleft}
   Include the contents of the file {\tt fname} directly into the
   output CIF file.  This operation can be safely performed only
   while no cell definition is in progress.

\subsection{Sample program}

See the PADGEN portion of this manual.

