\hypertarget{XLX_8h}{
\section{XLX.h File Reference}
\label{XLX_8h}\index{XLX.h@{XLX.h}}
}
Public definitions for the XLX (XML parser) package. 



This graph shows which files directly or indirectly include this file:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=134pt]{XLX_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{struct__XLX__basic__tag}{\_\-XLX\_\-basic\_\-tag}
\begin{CompactList}\small\item\em Structure descibing a basic XML tag with a name and a pointer to a function used to parse PCDATA. \item\end{CompactList}\item 
struct \hyperlink{struct__XLX__parent__tag}{\_\-XLX\_\-parent\_\-tag}
\begin{CompactList}\small\item\em Tag structure specifying the possible contents of this tag and any additional actions to be performed when the tag is entered. \item\end{CompactList}\item 
struct \hyperlink{struct__XLX__stack}{\_\-XLX\_\-stack}
\begin{CompactList}\small\item\em Structure to hold stack control information. \item\end{CompactList}\item 
struct \hyperlink{struct__XLX__state}{\_\-XLX\_\-state}
\begin{CompactList}\small\item\em Current state of the parsing - stack pointing to current element and address of leaf on the configuration tree. \item\end{CompactList}\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{XLX_8h_a0}{
typedef \hyperlink{struct__XLX__state}{\_\-XLX\_\-state} \hyperlink{XLX_8h_a0}{XLX\_\-state}}
\label{XLX_8h_a0}

\begin{CompactList}\small\item\em Forward declaration of the state structure. \item\end{CompactList}\item 
\hypertarget{XLX_8h_a1}{
typedef void($\ast$ \hyperlink{XLX_8h_a1}{XLX\_\-p\-Doctype} )(\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$state, const char $\ast$type, const char $\ast$sys\-Id, const char $\ast$pub\-Id, int int\-Subset)}
\label{XLX_8h_a1}

\begin{CompactList}\small\item\em Pointer to function called to process a doctype declaration. \item\end{CompactList}\item 
\hypertarget{XLX_8h_a2}{
typedef void($\ast$ \hyperlink{XLX_8h_a2}{XLX\_\-p\-Char} )(\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$state, const char $\ast$data, int leng)}
\label{XLX_8h_a2}

\begin{CompactList}\small\item\em Pointer to function called to perform unique actions on character data. \item\end{CompactList}\item 
\hypertarget{XLX_8h_a3}{
typedef void($\ast$ \hyperlink{XLX_8h_a3}{XLX\_\-p\-Enter} )(\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$state, const char $\ast$$\ast$attr)}
\label{XLX_8h_a3}

\begin{CompactList}\small\item\em Pointer to function called to perform additional (attribute parsing) actions on entry to a tag. \item\end{CompactList}\item 
\hypertarget{XLX_8h_a4}{
typedef void($\ast$ \hyperlink{XLX_8h_a4}{XLX\_\-p\-Exit} )(\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$state)}
\label{XLX_8h_a4}

\begin{CompactList}\small\item\em Pointer to function called to perform additional actions on exit from a tag. \item\end{CompactList}\item 
\hypertarget{XLX_8h_a5}{
typedef void($\ast$ \hyperlink{XLX_8h_a5}{XLX\_\-p\-Delete} )(void $\ast$user)}
\label{XLX_8h_a5}

\begin{CompactList}\small\item\em Pointer to function to use to destroy elements on the stack. \item\end{CompactList}\item 
\hypertarget{XLX_8h_a6}{
typedef \hyperlink{struct__XLX__basic__tag}{\_\-XLX\_\-basic\_\-tag} \hyperlink{XLX_8h_a6}{XLX\_\-basic\_\-tag}}
\label{XLX_8h_a6}

\begin{CompactList}\small\item\em Structure descibing a basic XML tag with a name and a pointer to a function used to parse PCDATA. \item\end{CompactList}\item 
\hypertarget{XLX_8h_a7}{
typedef \hyperlink{struct__XLX__parent__tag}{\_\-XLX\_\-parent\_\-tag} \hyperlink{XLX_8h_a7}{XLX\_\-parent\_\-tag}}
\label{XLX_8h_a7}

\begin{CompactList}\small\item\em Tag structure specifying the possible contents of this tag and any additional actions to be performed when the tag is entered. \item\end{CompactList}\item 
\hypertarget{XLX_8h_a8}{
typedef \hyperlink{struct__XLX__stack}{\_\-XLX\_\-stack} \hyperlink{XLX_8h_a8}{XLX\_\-stack}}
\label{XLX_8h_a8}

\begin{CompactList}\small\item\em Structure to hold stack control information. \item\end{CompactList}\end{CompactItemize}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum \hyperlink{XLX_8h_a40}{xlx\-Type} \{ \par
{\bf XLX\_\-BASIC} =  0, 
\par
{\bf XLX\_\-PARENT} =  1, 
\par
{\bf N\_\-XTYPES} =  2
 \}
\begin{CompactList}\small\item\em Enumeration used to extend the types of tag available. \item\end{CompactList}\item 
enum \hyperlink{XLX_8h_a41}{xlx\-Self} \{ \par
{\bf XLX\_\-NON\_\-RECURSIVE} =  0, 
\par
{\bf XLX\_\-RECURSIVE} =  1
 \}
\begin{CompactList}\small\item\em Enumeration used to indicate if the tag can contain itself. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{XLX_8h_a14}{XLX\_\-attr\-Error} (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$state, const char $\ast$func, const char $\ast$name)
\begin{CompactList}\small\item\em Report missing attribute error. \item\end{CompactList}\item 
void \hyperlink{XLX_8h_a15}{XLX\_\-attr\-Val\-Error} (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$state, const char $\ast$func, const char $\ast$name)
\begin{CompactList}\small\item\em Report invalid attribute value error. \item\end{CompactList}\item 
void \hyperlink{XLX_8h_a16}{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{XLX_8h_a17}{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}\item 
void \hyperlink{XLX_8h_a18}{XLX\_\-destroy\-Stack} (\hyperlink{struct__XLX__stack}{XLX\_\-stack} $\ast$stack, \hyperlink{XLX_8h_a5}{XLX\_\-p\-Delete} d\-Fn)
\begin{CompactList}\small\item\em Free the memory allocated to a stack and its elements. \item\end{CompactList}\item 
void \hyperlink{XLX_8h_a19}{XLX\_\-disp\-File\-Name} (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$state, const char $\ast$func)
\begin{CompactList}\small\item\em Display the name of the current file being parsed. \item\end{CompactList}\item 
void \hyperlink{XLX_8h_a20}{XLX\_\-dump} (\hyperlink{struct__XLX__stack}{XLX\_\-stack} $\ast$stack)
\begin{CompactList}\small\item\em Print out the stack information. \item\end{CompactList}\item 
void \hyperlink{XLX_8h_a21}{XLX\_\-end\-Stack} (\hyperlink{struct__XLX__stack}{XLX\_\-stack} $\ast$stack)
\begin{CompactList}\small\item\em Free the memory allocated to a stack. \item\end{CompactList}\item 
void \hyperlink{XLX_8h_a22}{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{XLX_8h_a23}{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 
int \hyperlink{XLX_8h_a24}{XLX\_\-get\-Attribute} (const char $\ast$$\ast$attribute, const char $\ast$name, int $\ast$value)
\begin{CompactList}\small\item\em Find a named attribute in an attribute list. \item\end{CompactList}\item 
int \hyperlink{XLX_8h_a25}{XLX\_\-get\-Line\-Num} (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$state)
\begin{CompactList}\small\item\em Get the current line number. \item\end{CompactList}\item 
int \hyperlink{XLX_8h_a26}{XLX\_\-init\-Stack} (\hyperlink{struct__XLX__stack}{XLX\_\-stack} $\ast$stack, unsigned int limit)
\begin{CompactList}\small\item\em Initialise a stack. \item\end{CompactList}\item 
int \hyperlink{XLX_8h_a27}{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 
int \hyperlink{XLX_8h_a28}{XLX\_\-ischar} (const char $\ast$string, unsigned int len)
\begin{CompactList}\small\item\em Test a string to see if it is a valid register wide character element. \item\end{CompactList}\item 
int \hyperlink{XLX_8h_a29}{XLX\_\-is\-Enabled} (const char $\ast$$\ast$attribute, int $\ast$enabled)
\begin{CompactList}\small\item\em Reads the attribute list and sets {\em enabled\/} accordingly. \item\end{CompactList}\item 
int \hyperlink{XLX_8h_a30}{XLX\_\-parse} (const char $\ast$filename, \hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$p\-State)
\begin{CompactList}\small\item\em Parse an XML file. \item\end{CompactList}\item 
void $\ast$ \hyperlink{XLX_8h_a31}{XLX\_\-peek} (\hyperlink{struct__XLX__stack}{XLX\_\-stack} $\ast$stack, unsigned int depth)
\begin{CompactList}\small\item\em Look at an item on a stack without removing it. \item\end{CompactList}\item 
void $\ast$ \hyperlink{XLX_8h_a32}{XLX\_\-pop} (\hyperlink{struct__XLX__stack}{XLX\_\-stack} $\ast$stack)
\begin{CompactList}\small\item\em Remove and return the top item on a stack. \item\end{CompactList}\item 
int \hyperlink{XLX_8h_a33}{XLX\_\-push} (\hyperlink{struct__XLX__stack}{XLX\_\-stack} $\ast$stack, void $\ast$ptr)
\begin{CompactList}\small\item\em Put a new item on the top of a stack. \item\end{CompactList}\item 
\hypertarget{XLX_8h_a34}{
int {\bf XLX\_\-sizeof\-State} (void)}
\label{XLX_8h_a34}

\item 
int \hyperlink{XLX_8h_a35}{XLX\_\-strtoi} (const char $\ast$string, unsigned int len, int $\ast$value)
\begin{CompactList}\small\item\em Convert a string to a signed 32-bit integer. \item\end{CompactList}\item 
int \hyperlink{XLX_8h_a36}{XLX\_\-strtoll} (const char $\ast$string, unsigned int len, long long $\ast$value)
\begin{CompactList}\small\item\em Convert a string to a signed 64-bit integer. \item\end{CompactList}\item 
int \hyperlink{XLX_8h_a37}{XLX\_\-strtou} (const char $\ast$string, unsigned int len, unsigned int $\ast$value)
\begin{CompactList}\small\item\em Convert a string to an unsigned 32-bit integer. \item\end{CompactList}\item 
int \hyperlink{XLX_8h_a38}{XLX\_\-strtoull} (const char $\ast$string, unsigned int len, unsigned long long $\ast$value)
\begin{CompactList}\small\item\em Convert a string to an unsigned 64-bit integer. \item\end{CompactList}\item 
void \hyperlink{XLX_8h_a39}{XLX\_\-val\-Error} (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$state, const char $\ast$func, const char $\ast$string, unsigned int len)
\begin{CompactList}\small\item\em Report value string to be in error. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Public definitions for the XLX (XML parser) package. 

\begin{Desc}
\item[Author:]James Swain \& Owen Saxton\end{Desc}
\begin{Desc}
\item[Id]\hyperlink{XLX_8h}{XLX.h},v 1.4 2007/05/10 20:00:55 saxton Exp \end{Desc}


\subsection{Function Documentation}
\hypertarget{XLX_8h_a14}{
\index{XLX.h@{XLX.h}!XLX_attrError@{XLX\_\-attrError}}
\index{XLX_attrError@{XLX\_\-attrError}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-attrError]{\setlength{\rightskip}{0pt plus 5cm}void XLX\_\-attr\-Error (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$ {\em state}, const char $\ast$ {\em func}, const char $\ast$ {\em name})}}
\label{XLX_8h_a14}


Report missing attribute error. 

This routine displays the name of the missing attribute, along with the line number in and the name of the file being parsed.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Current parse state\item[{\em func}]Name of function reporting the error\item[{\em name}]Attribute name\end{description}
\end{Desc}
\hypertarget{XLX_8h_a15}{
\index{XLX.h@{XLX.h}!XLX_attrValError@{XLX\_\-attrValError}}
\index{XLX_attrValError@{XLX\_\-attrValError}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-attrValError]{\setlength{\rightskip}{0pt plus 5cm}void XLX\_\-attr\-Val\-Error (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$ {\em state}, const char $\ast$ {\em func}, const char $\ast$ {\em name})}}
\label{XLX_8h_a15}


Report invalid attribute value error. 

This routine displays the name of the attribute, along with the line number in and the name of the file being parsed.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Current parse state\item[{\em func}]Name of function reporting the error\item[{\em name}]Attribute name\end{description}
\end{Desc}
\hypertarget{XLX_8h_a16}{
\index{XLX.h@{XLX.h}!XLX_character_noop@{XLX\_\-character\_\-noop}}
\index{XLX_character_noop@{XLX\_\-character\_\-noop}!XLX.h@{XLX.h}}
\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{XLX_8h_a16}


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{XLX_8h_a17}{
\index{XLX.h@{XLX.h}!XLX_character_tag@{XLX\_\-character\_\-tag}}
\index{XLX_character_tag@{XLX\_\-character\_\-tag}!XLX.h@{XLX.h}}
\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{XLX_8h_a17}


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{XLX_8h_a18}{
\index{XLX.h@{XLX.h}!XLX_destroyStack@{XLX\_\-destroyStack}}
\index{XLX_destroyStack@{XLX\_\-destroyStack}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-destroyStack]{\setlength{\rightskip}{0pt plus 5cm}void XLX\_\-destroy\-Stack (\hyperlink{struct__XLX__stack}{XLX\_\-stack} $\ast$ {\em stack}, \hyperlink{XLX_8h_a5}{XLX\_\-p\-Delete} {\em d\-Fn})}}
\label{XLX_8h_a18}


Free the memory allocated to a stack and its elements. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em stack}]Stack to end\item[{\em d\-Fn}]Function to call to delete objects on the stack\end{description}
\end{Desc}
\hypertarget{XLX_8h_a19}{
\index{XLX.h@{XLX.h}!XLX_dispFileName@{XLX\_\-dispFileName}}
\index{XLX_dispFileName@{XLX\_\-dispFileName}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-dispFileName]{\setlength{\rightskip}{0pt plus 5cm}void XLX\_\-disp\-File\-Name (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$ {\em state}, const char $\ast$ {\em func})}}
\label{XLX_8h_a19}


Display the name of the current file being parsed. 

This routine is used when reporting errors during the parsing.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Current parse state\item[{\em func}]Name of function reporting the error\end{description}
\end{Desc}
\hypertarget{XLX_8h_a20}{
\index{XLX.h@{XLX.h}!XLX_dump@{XLX\_\-dump}}
\index{XLX_dump@{XLX\_\-dump}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-dump]{\setlength{\rightskip}{0pt plus 5cm}void XLX\_\-dump (\hyperlink{struct__XLX__stack}{XLX\_\-stack} $\ast$ {\em stack})}}
\label{XLX_8h_a20}


Print out the stack information. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em stack}]Stack to dump\end{description}
\end{Desc}
\hypertarget{XLX_8h_a21}{
\index{XLX.h@{XLX.h}!XLX_endStack@{XLX\_\-endStack}}
\index{XLX_endStack@{XLX\_\-endStack}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-endStack]{\setlength{\rightskip}{0pt plus 5cm}void XLX\_\-end\-Stack (\hyperlink{struct__XLX__stack}{XLX\_\-stack} $\ast$ {\em stack})}}
\label{XLX_8h_a21}


Free the memory allocated to a stack. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em stack}]Stack to free\end{description}
\end{Desc}
\hypertarget{XLX_8h_a22}{
\index{XLX.h@{XLX.h}!XLX_enter_noop@{XLX\_\-enter\_\-noop}}
\index{XLX_enter_noop@{XLX\_\-enter\_\-noop}!XLX.h@{XLX.h}}
\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{XLX_8h_a22}


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{XLX_8h_a23}{
\index{XLX.h@{XLX.h}!XLX_exit_noop@{XLX\_\-exit\_\-noop}}
\index{XLX_exit_noop@{XLX\_\-exit\_\-noop}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-exit\_\-noop]{\setlength{\rightskip}{0pt plus 5cm}void XLX\_\-exit\_\-noop (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$ {\em state})}}
\label{XLX_8h_a23}


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{XLX_8h_a24}{
\index{XLX.h@{XLX.h}!XLX_getAttribute@{XLX\_\-getAttribute}}
\index{XLX_getAttribute@{XLX\_\-getAttribute}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-getAttribute]{\setlength{\rightskip}{0pt plus 5cm}int XLX\_\-get\-Attribute (const char $\ast$$\ast$ {\em attribute}, const char $\ast$ {\em name}, int $\ast$ {\em value})}}
\label{XLX_8h_a24}


Find a named attribute in an attribute list. 

This routine looks for the attribute in the attribute list and returns its associated value (signed decimal or hexadecimal string) converted to an integer.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em attribute}]Attribute list from the start tag of the element\item[{\em name}]Attribute to find and return\item[{\em value}]Location to put value of attribute\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]If the name is found and its value is valid \item[{\em -1}]If the value is not a valid number \item[{\em -2}]If the name is missing from the attribute list\end{description}
\end{Desc}
\hypertarget{XLX_8h_a25}{
\index{XLX.h@{XLX.h}!XLX_getLineNum@{XLX\_\-getLineNum}}
\index{XLX_getLineNum@{XLX\_\-getLineNum}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-getLineNum]{\setlength{\rightskip}{0pt plus 5cm}int XLX\_\-get\-Line\-Num (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$ {\em state})}}
\label{XLX_8h_a25}


Get the current line number. 

This routine obtains the current line number in the file being parsed.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Current parse state\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The current line number\end{Desc}
\hypertarget{XLX_8h_a26}{
\index{XLX.h@{XLX.h}!XLX_initStack@{XLX\_\-initStack}}
\index{XLX_initStack@{XLX\_\-initStack}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-initStack]{\setlength{\rightskip}{0pt plus 5cm}int XLX\_\-init\-Stack (\hyperlink{struct__XLX__stack}{XLX\_\-stack} $\ast$ {\em stack}, unsigned int {\em limit})}}
\label{XLX_8h_a26}


Initialise a stack. 

This routine allocates memory to hold the stack contents and sets the limit and used values.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em stack}]Stack to initialise\item[{\em limit}]Size of the stack\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]If the stack was successfully initialised \item[{\em -1}]If there was an error allocating memory for the stack\end{description}
\end{Desc}
\hypertarget{XLX_8h_a27}{
\index{XLX.h@{XLX.h}!XLX_initState@{XLX\_\-initState}}
\index{XLX_initState@{XLX\_\-initState}!XLX.h@{XLX.h}}
\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{XLX_8h_a27}


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{XLX_8h_a28}{
\index{XLX.h@{XLX.h}!XLX_ischar@{XLX\_\-ischar}}
\index{XLX_ischar@{XLX\_\-ischar}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-ischar]{\setlength{\rightskip}{0pt plus 5cm}int XLX\_\-ischar (const char $\ast$ {\em string}, unsigned int {\em len})}}
\label{XLX_8h_a28}


Test a string to see if it is a valid register wide character element. 

Checks that the string has valid characters after any leading whitespace and before the start of the next tag.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em string}]Layer address string to convert\item[{\em len}]Max length of the string (including whitespace)\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 1}]If the string has valid characters before the start of the next tag \item[{\em 0}]If the string does not have valid characters before the start of the next tag\end{description}
\end{Desc}
\hypertarget{XLX_8h_a29}{
\index{XLX.h@{XLX.h}!XLX_isEnabled@{XLX\_\-isEnabled}}
\index{XLX_isEnabled@{XLX\_\-isEnabled}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-isEnabled]{\setlength{\rightskip}{0pt plus 5cm}int XLX\_\-is\-Enabled (const char $\ast$$\ast$ {\em attribute}, int $\ast$ {\em enabled})}}
\label{XLX_8h_a29}


Reads the attribute list and sets {\em enabled\/} accordingly. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em attribute}]Attribute list from the start tag of the element\item[{\em enabled}]Location to write 0 (FALSE) or 1 (TRUE)\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]If the attribute list was read correctly \item[{\em -1}]If there was a bad value for the 'enabled' attribute \item[{\em -2}]If there was no 'enabled' attribute\end{description}
\end{Desc}
\hypertarget{XLX_8h_a30}{
\index{XLX.h@{XLX.h}!XLX_parse@{XLX\_\-parse}}
\index{XLX_parse@{XLX\_\-parse}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-parse]{\setlength{\rightskip}{0pt plus 5cm}int XLX\_\-parse (const char $\ast$ {\em filename}, \hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$ {\em p\-State})}}
\label{XLX_8h_a30}


Parse an XML file. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em filename}]XML file to parse\item[{\em p\-State}]State of the parser.\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]If the file is successfully parsed \item[{\em -1}]If the file cannot be opened \item[{\em -1}]If there is an error creating the parser control structure \item[{\em -1}]If there is an error reading the file \item[{\em -1}]If there is an error parsing the XML\end{description}
\end{Desc}
\hypertarget{XLX_8h_a31}{
\index{XLX.h@{XLX.h}!XLX_peek@{XLX\_\-peek}}
\index{XLX_peek@{XLX\_\-peek}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-peek]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ XLX\_\-peek (\hyperlink{struct__XLX__stack}{XLX\_\-stack} $\ast$ {\em stack}, unsigned int {\em depth})}}
\label{XLX_8h_a31}


Look at an item on a stack without removing it. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em stack}]Stack to peek at\item[{\em depth}]Depth from the top of the stack of item to peek at\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Item on the top of the stack\end{Desc}
\hypertarget{XLX_8h_a32}{
\index{XLX.h@{XLX.h}!XLX_pop@{XLX\_\-pop}}
\index{XLX_pop@{XLX\_\-pop}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-pop]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ XLX\_\-pop (\hyperlink{struct__XLX__stack}{XLX\_\-stack} $\ast$ {\em stack})}}
\label{XLX_8h_a32}


Remove and return the top item on a stack. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em stack}]Stack to pop item off\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Item popped off the top of the stack\end{Desc}
\hypertarget{XLX_8h_a33}{
\index{XLX.h@{XLX.h}!XLX_push@{XLX\_\-push}}
\index{XLX_push@{XLX\_\-push}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-push]{\setlength{\rightskip}{0pt plus 5cm}int XLX\_\-push (\hyperlink{struct__XLX__stack}{XLX\_\-stack} $\ast$ {\em stack}, void $\ast$ {\em ptr})}}
\label{XLX_8h_a33}


Put a new item on the top of a stack. 

If the stack is already full, its size is doubled.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em stack}]Stack to push item onto\item[{\em ptr}]Pointer to push onto stack\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]If the item is added successfully \item[{\em -1}]If the stack needs to be extended to accomodate the new item and the memory allocation failed\end{description}
\end{Desc}
\hypertarget{XLX_8h_a35}{
\index{XLX.h@{XLX.h}!XLX_strtoi@{XLX\_\-strtoi}}
\index{XLX_strtoi@{XLX\_\-strtoi}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-strtoi]{\setlength{\rightskip}{0pt plus 5cm}int XLX\_\-strtoi (const char $\ast$ {\em string}, unsigned int {\em len}, int $\ast$ {\em value})}}
\label{XLX_8h_a35}


Convert a string to a signed 32-bit integer. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em string}]String to convert\item[{\em len}]Maximum length of the string (including whitespace)\item[{\em value}]Address of the converted value\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]If the string represents a valid integer \item[{\em -1}]If the string contains invalid characters\end{description}
\end{Desc}
\hypertarget{XLX_8h_a36}{
\index{XLX.h@{XLX.h}!XLX_strtoll@{XLX\_\-strtoll}}
\index{XLX_strtoll@{XLX\_\-strtoll}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-strtoll]{\setlength{\rightskip}{0pt plus 5cm}int XLX\_\-strtoll (const char $\ast$ {\em string}, unsigned int {\em len}, long long $\ast$ {\em value})}}
\label{XLX_8h_a36}


Convert a string to a signed 64-bit integer. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em string}]String to convert\item[{\em len}]Maximum length of the string (including whitespace)\item[{\em value}]Address of the converted value\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]If the string represents a valid integer \item[{\em -1}]If the string contains invalid characters\end{description}
\end{Desc}
\hypertarget{XLX_8h_a37}{
\index{XLX.h@{XLX.h}!XLX_strtou@{XLX\_\-strtou}}
\index{XLX_strtou@{XLX\_\-strtou}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-strtou]{\setlength{\rightskip}{0pt plus 5cm}int XLX\_\-strtou (const char $\ast$ {\em string}, unsigned int {\em len}, unsigned int $\ast$ {\em value})}}
\label{XLX_8h_a37}


Convert a string to an unsigned 32-bit integer. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em string}]String to convert\item[{\em len}]Maximum length of the string (including whitespace)\item[{\em value}]Address of the converted value\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]If the string represents a valid integer \item[{\em -1}]If the string contains invalid characters\end{description}
\end{Desc}
\hypertarget{XLX_8h_a38}{
\index{XLX.h@{XLX.h}!XLX_strtoull@{XLX\_\-strtoull}}
\index{XLX_strtoull@{XLX\_\-strtoull}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-strtoull]{\setlength{\rightskip}{0pt plus 5cm}int XLX\_\-strtoull (const char $\ast$ {\em string}, unsigned int {\em len}, unsigned long long $\ast$ {\em value})}}
\label{XLX_8h_a38}


Convert a string to an unsigned 64-bit integer. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em string}]String to convert\item[{\em len}]Maximum length of the string (including whitespace)\item[{\em value}]Address of the converted value\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]If the string represents a valid integer \item[{\em -1}]If the string contains invalid characters\end{description}
\end{Desc}
\hypertarget{XLX_8h_a39}{
\index{XLX.h@{XLX.h}!XLX_valError@{XLX\_\-valError}}
\index{XLX_valError@{XLX\_\-valError}!XLX.h@{XLX.h}}
\subsubsection[XLX\_\-valError]{\setlength{\rightskip}{0pt plus 5cm}void XLX\_\-val\-Error (\hyperlink{struct__XLX__state}{XLX\_\-state} $\ast$ {\em state}, const char $\ast$ {\em func}, const char $\ast$ {\em string}, unsigned int {\em len})}}
\label{XLX_8h_a39}


Report value string to be in error. 

This routine displays the contents of the string, along with the line number in and the name of the file being parsed.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Current parse state\item[{\em func}]Name of function reporting the error\item[{\em string}]String to report\item[{\em len}]Max length of the string (including whitespace)\end{description}
\end{Desc}
