\section{aversive\_\-10-03-12/modules/ihm/parse/parse.c File Reference}
\label{parse_8c}\index{aversive\_\-10-03-12/modules/ihm/parse/parse.c@{aversive\_\-10-03-12/modules/ihm/parse/parse.c}}
{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include $<$inttypes.h$>$}\par
{\tt \#include $<$ctype.h$>$}\par
{\tt \#include $<$aversive/pgmspace.h$>$}\par
{\tt \#include \char`\"{}parse.h\char`\"{}}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define {\bf debug\_\-printf}(args...)~do \{\} while(0)
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
int {\bf isendoftoken} (char c)
\item 
int8\_\-t {\bf parse} ({\bf parse\_\-pgm\_\-ctx\_\-t} ctx[$\,$], const char $\ast$buf)
\item 
int8\_\-t {\bf complete} ({\bf parse\_\-pgm\_\-ctx\_\-t} ctx[$\,$], const char $\ast$buf, int16\_\-t $\ast$state, char $\ast$dst, uint8\_\-t size)
\end{CompactItemize}


\subsection{Define Documentation}
\index{parse.c@{parse.c}!debug\_\-printf@{debug\_\-printf}}
\index{debug\_\-printf@{debug\_\-printf}!parse.c@{parse.c}}
\subsubsection[debug\_\-printf]{\setlength{\rightskip}{0pt plus 5cm}\#define debug\_\-printf(args...)~do \{\} while(0)}\label{parse_8c_acea5c89f299b0d2ae3db3be26d54114}




Definition at line 35 of file parse.c.

\subsection{Function Documentation}
\index{parse.c@{parse.c}!complete@{complete}}
\index{complete@{complete}!parse.c@{parse.c}}
\subsubsection[complete]{\setlength{\rightskip}{0pt plus 5cm}int8\_\-t complete ({\bf parse\_\-pgm\_\-ctx\_\-t} {\em ctx}[$\,$], \/  const char $\ast$ {\em buf}, \/  int16\_\-t $\ast$ {\em state}, \/  char $\ast$ {\em dst}, \/  uint8\_\-t {\em size})}\label{parse_8c_504efa998f81c60f6d2c832e730b2dd7}


\doxyref{complete()}{p.}{parse_8c_504efa998f81c60f6d2c832e730b2dd7} must be called with $\ast$state==0. It returns $<$ 0 on \doxyref{error}{p.}{structerror}.

Else it returns: 2 on completion (one possible choice). In this case, the chars are appended in dst buffer. 1 if there is several possible choices. In this case, you must call the function again, keeping the value of state intact. 0 when the iteration is finished. The dst is not valid for this last call.

The returned dst buf ends with . 

Definition at line 259 of file parse.c.

References token\_\-ops::complete\_\-get\_\-elt, token\_\-ops::complete\_\-get\_\-nb, debug\_\-printf, token\_\-ops::get\_\-help, inst\_\-pgm::help\_\-str, parse\_\-symbols::l, token\_\-hdr::ops, and inst\_\-pgm::tokens.\index{parse.c@{parse.c}!isendoftoken@{isendoftoken}}
\index{isendoftoken@{isendoftoken}!parse.c@{parse.c}}
\subsubsection[isendoftoken]{\setlength{\rightskip}{0pt plus 5cm}int isendoftoken (char {\em c})}\label{parse_8c_e686144463bf8def2e1ded352a1e5a81}




Definition at line 56 of file parse.c.

Referenced by parse\_\-num(), and parse\_\-string().\index{parse.c@{parse.c}!parse@{parse}}
\index{parse@{parse}!parse.c@{parse.c}}
\subsubsection[parse]{\setlength{\rightskip}{0pt plus 5cm}int8\_\-t parse ({\bf parse\_\-pgm\_\-ctx\_\-t} {\em ctx}[$\,$], \/  const char $\ast$ {\em buf})}\label{parse_8c_c63651ed290319d3835b6578ab5c2c48}


Try to parse a buffer according to the specified context. The argument buf must ends with \char`\"{}$\backslash$n$\backslash$0\char`\"{}. The function returns PARSE\_\-AMBIGUOUS, PARSE\_\-NOMATCH or PARSE\_\-BAD\_\-ARGS on \doxyref{error}{p.}{structerror}. Else it calls the associated function (defined in the context) and returns 0 (PARSE\_\-SUCCESS). 

Definition at line 152 of file parse.c.

References inst\_\-pgm::data, debug\_\-printf, parse\_\-symbols::f, inst\_\-pgm::f, PARSE\_\-AMBIGUOUS, PARSE\_\-BAD\_\-ARGS, and PARSE\_\-NOMATCH.