\hypertarget{LCBR_8c}{
\section{LCBR.c File Reference}
\label{LCBR_8c}\index{LCBR.c@{LCBR.c}}
}
Implements the LCB result list/item scanning parsing routines.  


{\tt \#include $<$LCBD/LCBR.h$>$}\par
{\tt \#include $<$LCBD/LATP.h$>$}\par
{\tt \#include $<$LCBD/LCB\_\-cr.h$>$}\par
{\tt \#include $<$stdio.h$>$}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
unsigned int \hyperlink{LCBR_8c_da0bf9551035dfd00933eaf3e7a314c4}{LCBR\_\-process} (const \hyperlink{union__LCB__ri}{LCB\_\-ri} $\ast$ri, const \hyperlink{union__LCB__ri}{LCB\_\-ri} $\ast$end, \hyperlink{LCBR_8h_b554bae4e2a6f51e050d24b73d31f76e}{LCBR\_\-processor} rtn, void $\ast$prm)
\begin{CompactList}\small\item\em Executes the user specified handler for each result item in the range {\em ri\/} to {\em end\/}. \item\end{CompactList}\item 
const \hyperlink{union__LCB__ri}{LCB\_\-ri} $\ast$ \hyperlink{LCBR_8c_cc2afe46c148553746441e098f3544f7}{LCBR\_\-check} (const \hyperlink{union__LCB__ri}{LCB\_\-ri} $\ast$ri, const \hyperlink{union__LCB__ri}{LCB\_\-ri} $\ast$end)
\begin{CompactList}\small\item\em Checks the specified range of result items for errors. \item\end{CompactList}\item 
unsigned int \hyperlink{LCBR_8c_778cc23a80af140c22f7d20e8f0e6ffb}{LCBR\_\-error\_\-get} (const \hyperlink{union__LCB__ri}{LCB\_\-ri} $\ast$ri)
\begin{CompactList}\small\item\em Returns the 16-bit error word of {\em ri\/}. \item\end{CompactList}\item 
static unsigned int \hyperlink{LCBR_8c_9b51528fc346d593d1318002f65b632c}{show} (void $\ast$prm, const \hyperlink{union__LCB__ri}{LCB\_\-ri} $\ast$ri)
\begin{CompactList}\small\item\em Shows (prints) a single result item. \item\end{CompactList}\item 
void \hyperlink{LCBR_8c_f2e1ea7c3b83f0da926a5ca308df98ea}{LCBR\_\-show} (unsigned int options, const \hyperlink{union__LCB__ri}{LCB\_\-ri} $\ast$beg, const \hyperlink{union__LCB__ri}{LCB\_\-ri} $\ast$end)
\begin{CompactList}\small\item\em Dumps the result items to stdout. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Implements the LCB result list/item scanning parsing routines. 

\begin{Desc}
\item[Author:]JJRussell -- \href{mailto:russell@slac.stanford.edu}{\tt russell@slac.stanford.edu} 

\footnotesize\begin{verbatim}
  CVS $Id
\end{verbatim}
\normalsize
 \end{Desc}


\subsection{Function Documentation}
\hypertarget{LCBR_8c_cc2afe46c148553746441e098f3544f7}{
\index{LCBR.c@{LCBR.c}!LCBR\_\-check@{LCBR\_\-check}}
\index{LCBR\_\-check@{LCBR\_\-check}!LCBR.c@{LCBR.c}}
\subsubsection[{LCBR\_\-check}]{\setlength{\rightskip}{0pt plus 5cm}const {\bf LCB\_\-ri}$\ast$ LCBR\_\-check (const {\bf LCB\_\-ri} $\ast$ {\em ri}, \/  const {\bf LCB\_\-ri} $\ast$ {\em end})}}
\label{LCBR_8c_cc2afe46c148553746441e098f3544f7}


Checks the specified range of result items for errors. 

\begin{Desc}
\item[Returns:]Pointer to the last item successfully checked. If successful, end should be returned. A convience method to quickly scan a result list for any errors. If any result item has an error, a pointer to that result item is returned.\end{Desc}
If anything of than a pointer to {\em end\/} is returned, then an error in the result list has occurred. There are two offending conditions

\begin{enumerate}
\item The error code in the result item is anything but successful\item A result item has an undefined OPCODE making it impossible to advance.\end{enumerate}


The low 2 bits of the returned pointer contain the error syndrome. Currently only these two cases are defined

\begin{itemize}
\item low 2 bits 0, error is from the error field in the result item\item low 2 bits 1, error is because of a bad opcode. \end{itemize}


References \_\-LCB\_\-ri::hdr, LCBR\_\-MAP\_\-N8BYTES\_\-BY\_\-OPCODE, LCBR\_\-N8BYTES\_\-BY\_\-OPCODE\_\-FULL, and \_\-LCB\_\-ri\_\-hdr\_\-bf::opcode.\hypertarget{LCBR_8c_778cc23a80af140c22f7d20e8f0e6ffb}{
\index{LCBR.c@{LCBR.c}!LCBR\_\-error\_\-get@{LCBR\_\-error\_\-get}}
\index{LCBR\_\-error\_\-get@{LCBR\_\-error\_\-get}!LCBR.c@{LCBR.c}}
\subsubsection[{LCBR\_\-error\_\-get}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int LCBR\_\-error\_\-get (const {\bf LCB\_\-ri} $\ast$ {\em ri})}}
\label{LCBR_8c_778cc23a80af140c22f7d20e8f0e6ffb}


Returns the 16-bit error word of {\em ri\/}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ri}]Pointer to result item structure \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The error code. If the opcode is not recognized, the value LCB\_\-RCV\_\-ERR\_\-UNDEFINED\_\-7 is returned. \end{Desc}


References \_\-LCB\_\-ri::hdr, LCB\_\-RST\_\-ERR\_\-RCV\_\-UNDEFINED\_\-7, LCBR\_\-N8BYTES\_\-BY\_\-OPCODE, and \_\-LCB\_\-ri\_\-hdr\_\-bf::opcode.

Referenced by show().\hypertarget{LCBR_8c_da0bf9551035dfd00933eaf3e7a314c4}{
\index{LCBR.c@{LCBR.c}!LCBR\_\-process@{LCBR\_\-process}}
\index{LCBR\_\-process@{LCBR\_\-process}!LCBR.c@{LCBR.c}}
\subsubsection[{LCBR\_\-process}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int LCBR\_\-process (const {\bf LCB\_\-ri} $\ast$ {\em ri}, \/  const {\bf LCB\_\-ri} $\ast$ {\em end}, \/  {\bf LCBR\_\-processor} {\em rtn}, \/  void $\ast$ {\em prm})}}
\label{LCBR_8c_da0bf9551035dfd00933eaf3e7a314c4}


Executes the user specified handler for each result item in the range {\em ri\/} to {\em end\/}. 

\begin{Desc}
\item[Returns:]The status of the last processing call\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ri}]The first result item to process \item[{\em end}]One past the last result item to process \item[{\em rtn}]User provided callback routine to process one item \item[{\em prm}]User provided parameter passed to {\em rtn\/} \end{description}
\end{Desc}


References LCBR\_\-\_\-next().

Referenced by LCBR\_\-show().\hypertarget{LCBR_8c_f2e1ea7c3b83f0da926a5ca308df98ea}{
\index{LCBR.c@{LCBR.c}!LCBR\_\-show@{LCBR\_\-show}}
\index{LCBR\_\-show@{LCBR\_\-show}!LCBR.c@{LCBR.c}}
\subsubsection[{LCBR\_\-show}]{\setlength{\rightskip}{0pt plus 5cm}void LCBR\_\-show (unsigned int {\em options}, \/  const {\bf LCB\_\-ri} $\ast$ {\em beg}, \/  const {\bf LCB\_\-ri} $\ast$ {\em end})}}
\label{LCBR_8c_f2e1ea7c3b83f0da926a5ca308df98ea}


Dumps the result items to stdout. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em options}]Show options \item[{\em beg}]Pointer to the first result descriptor to show \item[{\em end}]Pointer to one past the lst result descriptor to show \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]void \end{Desc}


References LCBR\_\-process(), and show().\hypertarget{LCBR_8c_9b51528fc346d593d1318002f65b632c}{
\index{LCBR.c@{LCBR.c}!show@{show}}
\index{show@{show}!LCBR.c@{LCBR.c}}
\subsubsection[{show}]{\setlength{\rightskip}{0pt plus 5cm}static unsigned int show (void $\ast$ {\em prm}, \/  const {\bf LCB\_\-ri} $\ast$ {\em ri})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{LCBR_8c_9b51528fc346d593d1318002f65b632c}


Shows (prints) a single result item. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em prm}]Arbitrary user parameter, unused \item[{\em ri}]Pointer to result item\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]0 Useful when passed to LCBR\_\-process () to print all result items. \end{Desc}


References \_\-LATP\_\-cell\_\-hdr::bf, \_\-LATP\_\-cell\_\-hdr\_\-bf::dst, \_\-LCB\_\-ri::hdr, LCB\_\-RESULT\_\-ADDR\_\-MASK, LCBR\_\-error\_\-get(), LCBR\_\-TYPE\_\-BY\_\-OPCODE, LCBR\_\-TYPE\_\-REGISTER, \_\-LCB\_\-ri\_\-hdr\_\-bf::opcode, \_\-LATP\_\-cell\_\-hdr\_\-bf::parity, \_\-LATP\_\-cell\_\-hdr\_\-bf::proto, \_\-LATP\_\-cell\_\-hdr\_\-bf::rsp, \_\-LATP\_\-cell\_\-hdr\_\-bf::src, \_\-LCB\_\-ri\_\-hdr\_\-bf::timestamp, and \_\-LATP\_\-cell\_\-hdr::us.