\hypertarget{state_8c}{
\section{state.c File Reference}
\label{state_8c}\index{state.c@{state.c}}
}
Change of state on entering and leaving an element. 

{\tt \#include \char`\"{}XLX\_\-p.h\char`\"{}}\par
{\tt \#include \char`\"{}EXPAT/expat.h\char`\"{}}\par
{\tt \#include \char`\"{}stdlib.h\char`\"{}}\par
{\tt \#include \char`\"{}stdio.h\char`\"{}}\par
{\tt \#include \char`\"{}string.h\char`\"{}}\par


Include dependency graph for state.c:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=163pt]{state_8c__incl}
\end{center}
\end{figure}
\subsection*{Functions}
\begin{CompactItemize}
\item 
int \hyperlink{state_8c_a0}{XLX\_\-init\-State} (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$state, unsigned int stack\-Limit, void $\ast$stack\-Seed, \hyperlink{XLX_8h_a1}{XLX\_\-p\-Doctype} doctype, \hyperlink{XLX_8h_a3}{XLX\_\-p\-Enter} enter, \hyperlink{XLX_8h_a4}{XLX\_\-p\-Exit} exit, \hyperlink{XLX_8h_a2}{XLX\_\-p\-Char} character, int verbose)
\begin{CompactList}\small\item\em Initialise the state of the parser. \item\end{CompactList}\item 
void \hyperlink{state_8c_a1}{XLX\_\-doctype} (void $\ast$data, const char $\ast$name, const char $\ast$sys\-Id, const char $\ast$pub\-Id, int int\-Subset)
\begin{CompactList}\small\item\em Handle a doctype declaration. \item\end{CompactList}\item 
void \hyperlink{state_8c_a2}{XLX\_\-start} (void $\ast$data, const char $\ast$element, const char $\ast$$\ast$attribute)
\begin{CompactList}\small\item\em Handle a start tag. \item\end{CompactList}\item 
void \hyperlink{state_8c_a3}{XLX\_\-end} (void $\ast$data, const char $\ast$element)
\begin{CompactList}\small\item\em Handle an end tag. \item\end{CompactList}\item 
void \hyperlink{state_8c_a4}{XLX\_\-character} (void $\ast$data, const char $\ast$element, int len)
\begin{CompactList}\small\item\em Handle a character element. \item\end{CompactList}\item 
void \hyperlink{state_8c_a5}{XLX\_\-printout\_\-down} (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$state, const char $\ast$element)
\begin{CompactList}\small\item\em Print a starting tag. \item\end{CompactList}\item 
void \hyperlink{state_8c_a6}{XLX\_\-printout\_\-up} (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$state, const char $\ast$element)
\begin{CompactList}\small\item\em Print an ending tag. \item\end{CompactList}\item 
void \hyperlink{state_8c_a7}{XLX\_\-character\_\-noop} (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$state, const char $\ast$element, int len)
\begin{CompactList}\small\item\em No-op character element handler. \item\end{CompactList}\item 
void \hyperlink{state_8c_a8}{XLX\_\-enter\_\-noop} (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$state, const char $\ast$$\ast$attribute)
\begin{CompactList}\small\item\em No-op enter element handler. \item\end{CompactList}\item 
void \hyperlink{state_8c_a9}{XLX\_\-exit\_\-noop} (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$state)
\begin{CompactList}\small\item\em No-op exit element handler. \item\end{CompactList}\item 
void \hyperlink{state_8c_a10}{XLX\_\-character\_\-tag} (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$state, const char $\ast$element, int len)
\begin{CompactList}\small\item\em Handle a character element inside a parent tag by delegating the work to the first child. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Change of state on entering and leaving an element. 

\begin{Desc}
\item[Author:]James Swain \& Owen Saxton\end{Desc}
\begin{Desc}
\item[Id]\hyperlink{state_8c}{state.c},v 1.17 2007/05/10 20:06:00 saxton Exp \end{Desc}


\subsection{Function Documentation}
\hypertarget{state_8c_a4}{
\index{state.c@{state.c}!XLX_character@{XLX\_\-character}}
\index{XLX_character@{XLX\_\-character}!state.c@{state.c}}
\subsubsection[XLX\_\-character]{\setlength{\rightskip}{0pt plus 5cm}void XLX\_\-character (void $\ast$ {\em data}, const char $\ast$ {\em element}, int {\em len})}}
\label{state_8c_a4}


Handle a character element. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]Pointer to the current state of the parser\item[{\em element}]Character element\item[{\em len}]Length of the character element\end{description}
\end{Desc}
\hypertarget{state_8c_a7}{
\index{state.c@{state.c}!XLX_character_noop@{XLX\_\-character\_\-noop}}
\index{XLX_character_noop@{XLX\_\-character\_\-noop}!state.c@{state.c}}
\subsubsection[XLX\_\-character\_\-noop]{\setlength{\rightskip}{0pt plus 5cm}void XLX\_\-character\_\-noop (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$ {\em state}, const char $\ast$ {\em element}, int {\em len})}}
\label{state_8c_a7}


No-op character element handler. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to the current state of the parser\item[{\em element}]The text string from the current element\item[{\em len}]Length of element\end{description}
\end{Desc}
\hypertarget{state_8c_a10}{
\index{state.c@{state.c}!XLX_character_tag@{XLX\_\-character\_\-tag}}
\index{XLX_character_tag@{XLX\_\-character\_\-tag}!state.c@{state.c}}
\subsubsection[XLX\_\-character\_\-tag]{\setlength{\rightskip}{0pt plus 5cm}void XLX\_\-character\_\-tag (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$ {\em state}, const char $\ast$ {\em element}, int {\em len})}}
\label{state_8c_a10}


Handle a character element inside a parent tag by delegating the work to the first child. 

If there are valid characters in the character element then the first child of the current tag is pushed onto the stack and then XLX\_\-character is called to handle the character parsing. After the parsing is complete the child is popped off the stack.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to the current state of the parser\item[{\em element}]Character element\item[{\em len}]Length of the character element\end{description}
\end{Desc}
\hypertarget{state_8c_a1}{
\index{state.c@{state.c}!XLX_doctype@{XLX\_\-doctype}}
\index{XLX_doctype@{XLX\_\-doctype}!state.c@{state.c}}
\subsubsection[XLX\_\-doctype]{\setlength{\rightskip}{0pt plus 5cm}void XLX\_\-doctype (void $\ast$ {\em data}, const char $\ast$ {\em name}, const char $\ast$ {\em sys\-Id}, const char $\ast$ {\em pub\-Id}, int {\em int\-Subset})}}
\label{state_8c_a1}


Handle a doctype declaration. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]Pointer to the current state of the parser\item[{\em name}]The doctype name\item[{\em sys\-Id}]The system ID name\item[{\em pub\-Id}]The public ID name\item[{\em int\-Subset}]True if internal subset\end{description}
\end{Desc}
\hypertarget{state_8c_a3}{
\index{state.c@{state.c}!XLX_end@{XLX\_\-end}}
\index{XLX_end@{XLX\_\-end}!state.c@{state.c}}
\subsubsection[XLX\_\-end]{\setlength{\rightskip}{0pt plus 5cm}void XLX\_\-end (void $\ast$ {\em data}, const char $\ast$ {\em element})}}
\label{state_8c_a3}


Handle an end tag. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]Pointer to the current state of the parser\item[{\em element}]Element name from end tag\end{description}
\end{Desc}
\hypertarget{state_8c_a8}{
\index{state.c@{state.c}!XLX_enter_noop@{XLX\_\-enter\_\-noop}}
\index{XLX_enter_noop@{XLX\_\-enter\_\-noop}!state.c@{state.c}}
\subsubsection[XLX\_\-enter\_\-noop]{\setlength{\rightskip}{0pt plus 5cm}void XLX\_\-enter\_\-noop (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$ {\em state}, const char $\ast$$\ast$ {\em attribute})}}
\label{state_8c_a8}


No-op enter element handler. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to the current state of the parser\item[{\em attribute}]Attribute list for the current element\end{description}
\end{Desc}
\hypertarget{state_8c_a9}{
\index{state.c@{state.c}!XLX_exit_noop@{XLX\_\-exit\_\-noop}}
\index{XLX_exit_noop@{XLX\_\-exit\_\-noop}!state.c@{state.c}}
\subsubsection[XLX\_\-exit\_\-noop]{\setlength{\rightskip}{0pt plus 5cm}void XLX\_\-exit\_\-noop (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$ {\em state})}}
\label{state_8c_a9}


No-op exit element handler. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to the current state of the parser\end{description}
\end{Desc}
\hypertarget{state_8c_a0}{
\index{state.c@{state.c}!XLX_initState@{XLX\_\-initState}}
\index{XLX_initState@{XLX\_\-initState}!state.c@{state.c}}
\subsubsection[XLX\_\-initState]{\setlength{\rightskip}{0pt plus 5cm}int XLX\_\-init\-State (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$ {\em state}, unsigned int {\em stack\-Limit}, void $\ast$ {\em stack\-Seed}, \hyperlink{XLX_8h_a1}{XLX\_\-p\-Doctype} {\em doctype}, \hyperlink{XLX_8h_a3}{XLX\_\-p\-Enter} {\em enter}, \hyperlink{XLX_8h_a4}{XLX\_\-p\-Exit} {\em exit}, \hyperlink{XLX_8h_a2}{XLX\_\-p\-Char} {\em character}, int {\em verbose})}}
\label{state_8c_a0}


Initialise the state of the parser. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to the state information\item[{\em stack\-Limit}]Initial depth of the stack\item[{\em stack\-Seed}]Initial item on the stack\item[{\em doctype}]Action on encountering a doctype declaration\item[{\em enter}]Parser default action on encountering an enter tag\item[{\em exit}]Parser default action on encountering an exit tag\item[{\em character}]Parser default action on encountering a character tag\item[{\em verbose}]Verbosity level of the parser: 0 is quiet, 1 displays file name after error messages, $>$ 1 displays information messages\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]Success \item[{\em -1}]Insufficient memory\end{description}
\end{Desc}
\hypertarget{state_8c_a5}{
\index{state.c@{state.c}!XLX_printout_down@{XLX\_\-printout\_\-down}}
\index{XLX_printout_down@{XLX\_\-printout\_\-down}!state.c@{state.c}}
\subsubsection[XLX\_\-printout\_\-down]{\setlength{\rightskip}{0pt plus 5cm}void XLX\_\-printout\_\-down (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$ {\em state}, const char $\ast$ {\em element})}}
\label{state_8c_a5}


Print a starting tag. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to the current state of the parser\item[{\em element}]Text string from the current tag\end{description}
\end{Desc}
\hypertarget{state_8c_a6}{
\index{state.c@{state.c}!XLX_printout_up@{XLX\_\-printout\_\-up}}
\index{XLX_printout_up@{XLX\_\-printout\_\-up}!state.c@{state.c}}
\subsubsection[XLX\_\-printout\_\-up]{\setlength{\rightskip}{0pt plus 5cm}void XLX\_\-printout\_\-up (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$ {\em state}, const char $\ast$ {\em element})}}
\label{state_8c_a6}


Print an ending tag. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to the current state of the parser\item[{\em element}]Text string from the current tag\end{description}
\end{Desc}
\hypertarget{state_8c_a2}{
\index{state.c@{state.c}!XLX_start@{XLX\_\-start}}
\index{XLX_start@{XLX\_\-start}!state.c@{state.c}}
\subsubsection[XLX\_\-start]{\setlength{\rightskip}{0pt plus 5cm}void XLX\_\-start (void $\ast$ {\em data}, const char $\ast$ {\em element}, const char $\ast$$\ast$ {\em attribute})}}
\label{state_8c_a2}


Handle a start tag. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data}]Pointer to the current state of the parser\item[{\em element}]Element name from start tag\item[{\em attribute}]Attribute list from the start tag\end{description}
\end{Desc}
