\subsection{The Motorlist Module}
The motorlist is e helper module for implementing complex movements of 
multiple motors. A good example is the coordination of the reflectometer AMOR.
The general idea is to have a list (using the lld implementation used in
SICS) which contains one of the  following data structure for each motor
to run:

\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap1}
$\langle$motlistmot {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@typedef struct{@\\
\mbox{}\verb@        char name[80];@\\
\mbox{}\verb@        float target;@\\
\mbox{}\verb@        float position;@\\
\mbox{}\verb@        pIDrivable pDriv;@\\
\mbox{}\verb@        void *data;@\\
\mbox{}\verb@        int running;@\\
\mbox{}\verb@}MotControl, *pMotControl;@\\
\mbox{}\verb@@$\diamond$
\end{list}
\vspace{-1ex}
\footnotesize\addtolength{\baselineskip}{-1ex}
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item Macro referenced in scrap ?.
\end{list}
\end{minipage}\\[4ex]
\end{flushleft}
The motorlist module then takes care of starting all these motors,
 checking their status etc. A client module then only needs to calculate 
 targets for its motors and populate a list with them. All other 
 drivable tasks will then be performed by motorlist.
 
The interface provided by this module looks like this:
\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap2}
$\langle$motlistint {\footnotesize ?}$\rangle\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@pIDrivable makeMotListInterface();@\\
\mbox{}\verb@int addMotorToList(int listHandle, char *name, float targetValue);@\\
\mbox{}\verb@int setNewMotorTarget(int listHandle, char *name, float value);@\\
\mbox{}\verb@int getMotorFromList(int listHandle, char *name, pMotControl tuk);@\\
\mbox{}\verb@float      getListMotorPosition(int listHandle, char *name);@\\
\mbox{}\verb@void printMotorList(int listHandle, SConnection *pCon); @\\
\mbox{}\verb@@$\diamond$
\end{list}
\vspace{-1ex}
\footnotesize\addtolength{\baselineskip}{-1ex}
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
\item Macro referenced in scrap ?.
\end{list}
\end{minipage}\\[4ex]
\end{flushleft}
\begin{description}
\item[makeMotListInterface] creates a drivable interface which is initialized
 with the motlist implementations. Each of the drivabel functions expects 
 as pData pointer a pointer to the listHandle describing the list of motors
 to run
 \item[addMotorToList] adds motor name with target value targetValue to
  the list identified by listHandle. Retruns 1 on success, 0 on failure (The 
  motor could not be found)
\item[setNewMotorTarget] does what it says. 
\item[getMotorFromList] rets a motor entry for name from listHandle. Used in 
order to retrieve positions.
\item[getListMotorPosition] retrieves the current position of motor name.
\end{description}
All the rest of the interface is invoked through the drivable interface 
functions which thus can be used in implementing own drivable interfaces.

\begin{flushleft} \small
\begin{minipage}{\linewidth} \label{scrap3}
\verb@"motorlist.h"@ {\footnotesize ? }$\equiv$
\vspace{-1ex}
\begin{list}{}{} \item
\mbox{}\verb@@\\
\mbox{}\verb@/*----------------------------------------------------------------------@\\
\mbox{}\verb@  Support module which manages a list of motors and their target values@\\
\mbox{}\verb@  when running complex movements. See accompanying tex file for@\\
\mbox{}\verb@  more info.@\\
\mbox{}\verb@@\\
\mbox{}\verb@  copyright: see file COPYRIGHT@\\
\mbox{}\verb@@\\
\mbox{}\verb@  Mark Koennecke, September 2005@\\
\mbox{}\verb@-----------------------------------------------------------------------*/@\\
\mbox{}\verb@#ifndef SICSMOTLIST@\\
\mbox{}\verb@#define SICSMOTLIST@\\
\mbox{}\verb@#include "sics.h"@\\
\mbox{}\verb@@$\langle$motlistmot {\footnotesize ?}$\rangle$\verb@@\\
\mbox{}\verb@/*======================================================================*/@\\
\mbox{}\verb@@$\langle$motlistint {\footnotesize ?}$\rangle$\verb@@\\
\mbox{}\verb@#endif@\\
\mbox{}\verb@@\\
\mbox{}\verb@@$\diamond$
\end{list}
\vspace{-2ex}
\end{minipage}\\[4ex]
\end{flushleft}
