\doxysection{src/libsphinxbase/lm/jsgf.c File Reference}
\label{jsgf_8c}\index{src/libsphinxbase/lm/jsgf.c@{src/libsphinxbase/lm/jsgf.c}}


This file implements the data structures for parsing JSGF grammars into Sphinx finite-\/state grammars.  


{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include $<$assert.\+h$>$}\newline
{\ttfamily \#include "{}sphinxbase/ckd\+\_\+alloc.\+h"{}}\newline
{\ttfamily \#include "{}sphinxbase/strfuncs.\+h"{}}\newline
{\ttfamily \#include "{}sphinxbase/hash\+\_\+table.\+h"{}}\newline
{\ttfamily \#include "{}sphinxbase/err.\+h"{}}\newline
{\ttfamily \#include "{}jsgf\+\_\+internal.\+h"{}}\newline
{\ttfamily \#include "{}jsgf\+\_\+parser.\+h"{}}\newline
{\ttfamily \#include "{}jsgf\+\_\+scanner.\+h"{}}\newline
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ jsgf\+\_\+atom\+\_\+t} $\ast$ \textbf{ jsgf\+\_\+atom\+\_\+new} (char $\ast$name, float weight)
\item 
int \textbf{ jsgf\+\_\+atom\+\_\+free} (\textbf{ jsgf\+\_\+atom\+\_\+t} $\ast$atom)
\item 
\textbf{ jsgf\+\_\+t} $\ast$ \textbf{ jsgf\+\_\+grammar\+\_\+new} (\textbf{ jsgf\+\_\+t} $\ast$parent)
\begin{DoxyCompactList}\small\item\em Create a new JSGF grammar. \end{DoxyCompactList}\item 
void \textbf{ jsgf\+\_\+grammar\+\_\+free} (\textbf{ jsgf\+\_\+t} $\ast$jsgf)
\begin{DoxyCompactList}\small\item\em Free a JSGF grammar. \end{DoxyCompactList}\item 
\textbf{ jsgf\+\_\+atom\+\_\+t} $\ast$ \textbf{ jsgf\+\_\+kleene\+\_\+new} (\textbf{ jsgf\+\_\+t} $\ast$jsgf, \textbf{ jsgf\+\_\+atom\+\_\+t} $\ast$atom, int plus)
\item 
\textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$ \textbf{ jsgf\+\_\+optional\+\_\+new} (\textbf{ jsgf\+\_\+t} $\ast$jsgf, \textbf{ jsgf\+\_\+rhs\+\_\+t} $\ast$exp)
\item 
void \textbf{ jsgf\+\_\+add\+\_\+link} (\textbf{ jsgf\+\_\+t} $\ast$grammar, \textbf{ jsgf\+\_\+atom\+\_\+t} $\ast$atom, int from, int to)
\item 
char const $\ast$ \textbf{ jsgf\+\_\+grammar\+\_\+name} (\textbf{ jsgf\+\_\+t} $\ast$jsgf)
\begin{DoxyCompactList}\small\item\em Get the grammar name from the file. \end{DoxyCompactList}\item 
\textbf{ jsgf\+\_\+rule\+\_\+iter\+\_\+t} $\ast$ \textbf{ jsgf\+\_\+rule\+\_\+iter} (\textbf{ jsgf\+\_\+t} $\ast$grammar)
\begin{DoxyCompactList}\small\item\em Get an iterator over all rules in a grammar. \end{DoxyCompactList}\item 
\textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$ \textbf{ jsgf\+\_\+get\+\_\+rule} (\textbf{ jsgf\+\_\+t} $\ast$grammar, char const $\ast$name)
\begin{DoxyCompactList}\small\item\em Get a rule by name from a grammar. \end{DoxyCompactList}\item 
char const $\ast$ \textbf{ jsgf\+\_\+rule\+\_\+name} (\textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$rule)
\begin{DoxyCompactList}\small\item\em Get the rule name from a rule. \end{DoxyCompactList}\item 
int \textbf{ jsgf\+\_\+rule\+\_\+public} (\textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$rule)
\begin{DoxyCompactList}\small\item\em Test if a rule is public or not. \end{DoxyCompactList}\item 
\textbf{ fsg\+\_\+model\+\_\+t} $\ast$ \textbf{ jsgf\+\_\+build\+\_\+fsg} (\textbf{ jsgf\+\_\+t} $\ast$grammar, \textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$rule, \textbf{ logmath\+\_\+t} $\ast$lmath, float32 lw)
\begin{DoxyCompactList}\small\item\em Build a Sphinx FSG object from a JSGF rule. \end{DoxyCompactList}\item 
\textbf{ fsg\+\_\+model\+\_\+t} $\ast$ \textbf{ jsgf\+\_\+build\+\_\+fsg\+\_\+raw} (\textbf{ jsgf\+\_\+t} $\ast$grammar, \textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$rule, \textbf{ logmath\+\_\+t} $\ast$lmath, float32 lw)
\begin{DoxyCompactList}\small\item\em Build a Sphinx FSG object from a JSGF rule. \end{DoxyCompactList}\item 
\textbf{ fsg\+\_\+model\+\_\+t} $\ast$ \textbf{ jsgf\+\_\+read\+\_\+file} (const char $\ast$file, \textbf{ logmath\+\_\+t} $\ast$lmath, float32 lw)
\begin{DoxyCompactList}\small\item\em Read JSGF from file and return FSG object from it. \end{DoxyCompactList}\item 
int \textbf{ jsgf\+\_\+write\+\_\+fsg} (\textbf{ jsgf\+\_\+t} $\ast$grammar, \textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$rule, FILE $\ast$outfh)
\begin{DoxyCompactList}\small\item\em Convert a JSGF rule to Sphinx FSG text form. \end{DoxyCompactList}\item 
\textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$ \textbf{ jsgf\+\_\+define\+\_\+rule} (\textbf{ jsgf\+\_\+t} $\ast$jsgf, char $\ast$name, \textbf{ jsgf\+\_\+rhs\+\_\+t} $\ast$rhs, int public)
\item 
\textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$ \textbf{ jsgf\+\_\+rule\+\_\+retain} (\textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$rule)
\item 
int \textbf{ jsgf\+\_\+rule\+\_\+free} (\textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$rule)
\item 
\textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$ \textbf{ jsgf\+\_\+import\+\_\+rule} (\textbf{ jsgf\+\_\+t} $\ast$jsgf, char $\ast$name)
\item 
\textbf{ jsgf\+\_\+t} $\ast$ \textbf{ jsgf\+\_\+parse\+\_\+file} (const char $\ast$filename, \textbf{ jsgf\+\_\+t} $\ast$parent)
\begin{DoxyCompactList}\small\item\em Parse a JSGF grammar from a file. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
This file implements the data structures for parsing JSGF grammars into Sphinx finite-\/state grammars. 



Definition in file \textbf{ jsgf.\+c}.



\doxysubsection{Function Documentation}
\label{jsgf_8c_acb5af4a04abc56a8584eba9b937f8154} 
\index{jsgf.c@{jsgf.c}!jsgf\_add\_link@{jsgf\_add\_link}}
\index{jsgf\_add\_link@{jsgf\_add\_link}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_add\_link()}
{\footnotesize\ttfamily void jsgf\+\_\+add\+\_\+link (\begin{DoxyParamCaption}\item[{\textbf{ jsgf\+\_\+t} $\ast$}]{grammar,  }\item[{\textbf{ jsgf\+\_\+atom\+\_\+t} $\ast$}]{atom,  }\item[{int}]{from,  }\item[{int}]{to }\end{DoxyParamCaption})}



Definition at line \textbf{ 208} of file \textbf{ jsgf.\+c}.

\label{jsgf_8c_a289d683bf62d1a5aaac6917fa64f54f2} 
\index{jsgf.c@{jsgf.c}!jsgf\_atom\_free@{jsgf\_atom\_free}}
\index{jsgf\_atom\_free@{jsgf\_atom\_free}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_atom\_free()}
{\footnotesize\ttfamily int jsgf\+\_\+atom\+\_\+free (\begin{DoxyParamCaption}\item[{\textbf{ jsgf\+\_\+atom\+\_\+t} $\ast$}]{atom }\end{DoxyParamCaption})}



Definition at line \textbf{ 69} of file \textbf{ jsgf.\+c}.

\label{jsgf_8c_a3088c3df99f8eb09774214d7ecabcc47} 
\index{jsgf.c@{jsgf.c}!jsgf\_atom\_new@{jsgf\_atom\_new}}
\index{jsgf\_atom\_new@{jsgf\_atom\_new}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_atom\_new()}
{\footnotesize\ttfamily \textbf{ jsgf\+\_\+atom\+\_\+t} $\ast$ jsgf\+\_\+atom\+\_\+new (\begin{DoxyParamCaption}\item[{char $\ast$}]{name,  }\item[{float}]{weight }\end{DoxyParamCaption})}



Definition at line \textbf{ 58} of file \textbf{ jsgf.\+c}.

\label{jsgf_8c_ab94ad753193e071b5834baec4bcecd32} 
\index{jsgf.c@{jsgf.c}!jsgf\_build\_fsg@{jsgf\_build\_fsg}}
\index{jsgf\_build\_fsg@{jsgf\_build\_fsg}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_build\_fsg()}
{\footnotesize\ttfamily \textbf{ fsg\+\_\+model\+\_\+t} $\ast$ jsgf\+\_\+build\+\_\+fsg (\begin{DoxyParamCaption}\item[{\textbf{ jsgf\+\_\+t} $\ast$}]{grammar,  }\item[{\textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$}]{rule,  }\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath,  }\item[{float32}]{lw }\end{DoxyParamCaption})}



Build a Sphinx FSG object from a JSGF rule. 



Definition at line \textbf{ 497} of file \textbf{ jsgf.\+c}.



Referenced by \textbf{ jsgf\+\_\+read\+\_\+file()}.

\label{jsgf_8c_a73f4929927faa23e2a46810fada156c6} 
\index{jsgf.c@{jsgf.c}!jsgf\_build\_fsg\_raw@{jsgf\_build\_fsg\_raw}}
\index{jsgf\_build\_fsg\_raw@{jsgf\_build\_fsg\_raw}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_build\_fsg\_raw()}
{\footnotesize\ttfamily \textbf{ fsg\+\_\+model\+\_\+t} $\ast$ jsgf\+\_\+build\+\_\+fsg\+\_\+raw (\begin{DoxyParamCaption}\item[{\textbf{ jsgf\+\_\+t} $\ast$}]{grammar,  }\item[{\textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$}]{rule,  }\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath,  }\item[{float32}]{lw }\end{DoxyParamCaption})}



Build a Sphinx FSG object from a JSGF rule. 

This differs from \doxyref{jsgf\+\_\+build\+\_\+fsg()}{p.}{jsgf_8h_a3ec1941c49bda651a69e224bdb8f2e65} in that it does not do closure on epsilon transitions or any other postprocessing. For the time being this is necessary in order to write it to a file -\/ the FSG code will be fixed soon. 

Definition at line \textbf{ 504} of file \textbf{ jsgf.\+c}.



Referenced by \textbf{ jsgf\+\_\+write\+\_\+fsg()}.

\label{jsgf_8c_a0302bb081e44feaeb44071ac16f2459b} 
\index{jsgf.c@{jsgf.c}!jsgf\_define\_rule@{jsgf\_define\_rule}}
\index{jsgf\_define\_rule@{jsgf\_define\_rule}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_define\_rule()}
{\footnotesize\ttfamily \textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$ jsgf\+\_\+define\+\_\+rule (\begin{DoxyParamCaption}\item[{\textbf{ jsgf\+\_\+t} $\ast$}]{jsgf,  }\item[{char $\ast$}]{name,  }\item[{\textbf{ jsgf\+\_\+rhs\+\_\+t} $\ast$}]{rhs,  }\item[{int}]{public }\end{DoxyParamCaption})}



Definition at line \textbf{ 559} of file \textbf{ jsgf.\+c}.

\label{jsgf_8c_af079d323103e31694372d6608fb241c3} 
\index{jsgf.c@{jsgf.c}!jsgf\_get\_rule@{jsgf\_get\_rule}}
\index{jsgf\_get\_rule@{jsgf\_get\_rule}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_get\_rule()}
{\footnotesize\ttfamily \textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$ jsgf\+\_\+get\+\_\+rule (\begin{DoxyParamCaption}\item[{\textbf{ jsgf\+\_\+t} $\ast$}]{grammar,  }\item[{char const $\ast$}]{name }\end{DoxyParamCaption})}



Get a rule by name from a grammar. 



Definition at line \textbf{ 427} of file \textbf{ jsgf.\+c}.



References \textbf{ hash\+\_\+table\+\_\+lookup()}, and \textbf{ jsgf\+\_\+s\+::rules}.

\label{jsgf_8c_a0a5185af0b0f1c19d85ae553c5ecc51b} 
\index{jsgf.c@{jsgf.c}!jsgf\_grammar\_free@{jsgf\_grammar\_free}}
\index{jsgf\_grammar\_free@{jsgf\_grammar\_free}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_grammar\_free()}
{\footnotesize\ttfamily void jsgf\+\_\+grammar\+\_\+free (\begin{DoxyParamCaption}\item[{\textbf{ jsgf\+\_\+t} $\ast$}]{jsgf }\end{DoxyParamCaption})}



Free a JSGF grammar. 



Definition at line \textbf{ 125} of file \textbf{ jsgf.\+c}.



References \textbf{ jsgf\+\_\+s\+::charset}, \textbf{ ckd\+\_\+free()}, \textbf{ hash\+\_\+iter\+\_\+s\+::ent}, \textbf{ glist\+\_\+free()}, \textbf{ gnode\+\_\+ptr}, \textbf{ hash\+\_\+table\+\_\+free()}, \textbf{ hash\+\_\+table\+\_\+iter()}, \textbf{ hash\+\_\+table\+\_\+iter\+\_\+next()}, \textbf{ jsgf\+\_\+s\+::imports}, \textbf{ jsgf\+\_\+grammar\+\_\+free()}, \textbf{ jsgf\+\_\+s\+::links}, \textbf{ jsgf\+\_\+s\+::locale}, \textbf{ jsgf\+\_\+s\+::name}, \textbf{ jsgf\+\_\+s\+::parent}, \textbf{ jsgf\+\_\+s\+::rules}, \textbf{ jsgf\+\_\+s\+::searchpath}, \textbf{ hash\+\_\+entry\+\_\+s\+::val}, and \textbf{ jsgf\+\_\+s\+::version}.



Referenced by \textbf{ jsgf\+\_\+grammar\+\_\+free()}, \textbf{ jsgf\+\_\+parse\+\_\+file()}, and \textbf{ jsgf\+\_\+read\+\_\+file()}.

\label{jsgf_8c_adc094c0f23da2df26dc3ee099e80d605} 
\index{jsgf.c@{jsgf.c}!jsgf\_grammar\_name@{jsgf\_grammar\_name}}
\index{jsgf\_grammar\_name@{jsgf\_grammar\_name}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_grammar\_name()}
{\footnotesize\ttfamily char const  $\ast$ jsgf\+\_\+grammar\+\_\+name (\begin{DoxyParamCaption}\item[{\textbf{ jsgf\+\_\+t} $\ast$}]{jsgf }\end{DoxyParamCaption})}



Get the grammar name from the file. 



Definition at line \textbf{ 233} of file \textbf{ jsgf.\+c}.



References \textbf{ jsgf\+\_\+s\+::name}.

\label{jsgf_8c_a8d77b07ffd8cdbb26fec8670b5e29871} 
\index{jsgf.c@{jsgf.c}!jsgf\_grammar\_new@{jsgf\_grammar\_new}}
\index{jsgf\_grammar\_new@{jsgf\_grammar\_new}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_grammar\_new()}
{\footnotesize\ttfamily \textbf{ jsgf\+\_\+t} $\ast$ jsgf\+\_\+grammar\+\_\+new (\begin{DoxyParamCaption}\item[{\textbf{ jsgf\+\_\+t} $\ast$}]{parent }\end{DoxyParamCaption})}



Create a new JSGF grammar. 


\begin{DoxyParams}{Parameters}
{\em parent} & optional parent grammar for this one (NULL, usually). \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
new JSGF grammar object, or NULL on failure. 
\end{DoxyReturn}


Definition at line \textbf{ 79} of file \textbf{ jsgf.\+c}.



References \textbf{ ckd\+\_\+calloc}, \textbf{ ckd\+\_\+salloc}, \textbf{ glist\+\_\+add\+\_\+ptr()}, \textbf{ glist\+\_\+reverse()}, \textbf{ hash\+\_\+table\+\_\+new()}, \textbf{ jsgf\+\_\+s\+::imports}, \textbf{ jsgf\+\_\+s\+::parent}, \textbf{ jsgf\+\_\+s\+::rules}, and \textbf{ jsgf\+\_\+s\+::searchpath}.



Referenced by \textbf{ jsgf\+\_\+parse\+\_\+file()}.

\label{jsgf_8c_a4873306f82d8c3028b788f9d2072038c} 
\index{jsgf.c@{jsgf.c}!jsgf\_import\_rule@{jsgf\_import\_rule}}
\index{jsgf\_import\_rule@{jsgf\_import\_rule}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_import\_rule()}
{\footnotesize\ttfamily \textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$ jsgf\+\_\+import\+\_\+rule (\begin{DoxyParamCaption}\item[{\textbf{ jsgf\+\_\+t} $\ast$}]{jsgf,  }\item[{char $\ast$}]{name }\end{DoxyParamCaption})}



Definition at line \textbf{ 635} of file \textbf{ jsgf.\+c}.

\label{jsgf_8c_aa9d355a69b184cb5260e88f41af76d88} 
\index{jsgf.c@{jsgf.c}!jsgf\_kleene\_new@{jsgf\_kleene\_new}}
\index{jsgf\_kleene\_new@{jsgf\_kleene\_new}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_kleene\_new()}
{\footnotesize\ttfamily \textbf{ jsgf\+\_\+atom\+\_\+t} $\ast$ jsgf\+\_\+kleene\+\_\+new (\begin{DoxyParamCaption}\item[{\textbf{ jsgf\+\_\+t} $\ast$}]{jsgf,  }\item[{\textbf{ jsgf\+\_\+atom\+\_\+t} $\ast$}]{atom,  }\item[{int}]{plus }\end{DoxyParamCaption})}



Definition at line \textbf{ 174} of file \textbf{ jsgf.\+c}.

\label{jsgf_8c_a1df897e930221f198fa069f9eb2e7572} 
\index{jsgf.c@{jsgf.c}!jsgf\_optional\_new@{jsgf\_optional\_new}}
\index{jsgf\_optional\_new@{jsgf\_optional\_new}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_optional\_new()}
{\footnotesize\ttfamily \textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$ jsgf\+\_\+optional\+\_\+new (\begin{DoxyParamCaption}\item[{\textbf{ jsgf\+\_\+t} $\ast$}]{jsgf,  }\item[{\textbf{ jsgf\+\_\+rhs\+\_\+t} $\ast$}]{exp }\end{DoxyParamCaption})}



Definition at line \textbf{ 198} of file \textbf{ jsgf.\+c}.

\label{jsgf_8c_afc0a7b3ddf8b353804f9865c8eebffac} 
\index{jsgf.c@{jsgf.c}!jsgf\_parse\_file@{jsgf\_parse\_file}}
\index{jsgf\_parse\_file@{jsgf\_parse\_file}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_parse\_file()}
{\footnotesize\ttfamily \textbf{ jsgf\+\_\+t} $\ast$ jsgf\+\_\+parse\+\_\+file (\begin{DoxyParamCaption}\item[{const char $\ast$}]{filename,  }\item[{\textbf{ jsgf\+\_\+t} $\ast$}]{parent }\end{DoxyParamCaption})}



Parse a JSGF grammar from a file. 


\begin{DoxyParams}{Parameters}
{\em filename} & the name of the file to parse. \\
\hline
{\em parent} & optional parent grammar for this one (NULL, usually). \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
new JSGF grammar object, or NULL on failure. 
\end{DoxyReturn}


Definition at line \textbf{ 734} of file \textbf{ jsgf.\+c}.



References \textbf{ E\+\_\+\+ERROR}, \textbf{ E\+\_\+\+ERROR\+\_\+\+SYSTEM}, \textbf{ jsgf\+\_\+grammar\+\_\+free()}, and \textbf{ jsgf\+\_\+grammar\+\_\+new()}.



Referenced by \textbf{ jsgf\+\_\+read\+\_\+file()}.

\label{jsgf_8c_ad0e2a8ba78020191494b0686ba5a6727} 
\index{jsgf.c@{jsgf.c}!jsgf\_read\_file@{jsgf\_read\_file}}
\index{jsgf\_read\_file@{jsgf\_read\_file}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_read\_file()}
{\footnotesize\ttfamily \textbf{ fsg\+\_\+model\+\_\+t} $\ast$ jsgf\+\_\+read\+\_\+file (\begin{DoxyParamCaption}\item[{const char $\ast$}]{file,  }\item[{\textbf{ logmath\+\_\+t} $\ast$}]{lmath,  }\item[{float32}]{lw }\end{DoxyParamCaption})}



Read JSGF from file and return FSG object from it. 

This function looks for a first public rule in jsgf and constructs JSGF from it. 

Definition at line \textbf{ 511} of file \textbf{ jsgf.\+c}.



References \textbf{ E\+\_\+\+ERROR}, \textbf{ jsgf\+\_\+build\+\_\+fsg()}, \textbf{ jsgf\+\_\+grammar\+\_\+free()}, \textbf{ jsgf\+\_\+parse\+\_\+file()}, \textbf{ jsgf\+\_\+rule\+\_\+iter()}, \textbf{ jsgf\+\_\+rule\+\_\+iter\+\_\+free}, \textbf{ jsgf\+\_\+rule\+\_\+iter\+\_\+next}, \textbf{ jsgf\+\_\+rule\+\_\+iter\+\_\+rule}, and \textbf{ jsgf\+\_\+rule\+\_\+public()}.

\label{jsgf_8c_af2faf6fb74ad1e4d43cf990c1bcec672} 
\index{jsgf.c@{jsgf.c}!jsgf\_rule\_free@{jsgf\_rule\_free}}
\index{jsgf\_rule\_free@{jsgf\_rule\_free}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_rule\_free()}
{\footnotesize\ttfamily int jsgf\+\_\+rule\+\_\+free (\begin{DoxyParamCaption}\item[{\textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$}]{rule }\end{DoxyParamCaption})}



Definition at line \textbf{ 599} of file \textbf{ jsgf.\+c}.

\label{jsgf_8c_a00bd65d53e749e1ffab8907437d00c76} 
\index{jsgf.c@{jsgf.c}!jsgf\_rule\_iter@{jsgf\_rule\_iter}}
\index{jsgf\_rule\_iter@{jsgf\_rule\_iter}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_rule\_iter()}
{\footnotesize\ttfamily \textbf{ jsgf\+\_\+rule\+\_\+iter\+\_\+t} $\ast$ jsgf\+\_\+rule\+\_\+iter (\begin{DoxyParamCaption}\item[{\textbf{ jsgf\+\_\+t} $\ast$}]{grammar }\end{DoxyParamCaption})}



Get an iterator over all rules in a grammar. 



Definition at line \textbf{ 421} of file \textbf{ jsgf.\+c}.



References \textbf{ hash\+\_\+table\+\_\+iter()}, and \textbf{ jsgf\+\_\+s\+::rules}.



Referenced by \textbf{ jsgf\+\_\+read\+\_\+file()}.

\label{jsgf_8c_a6beb1d693d1ad84f5358f5ea92832f09} 
\index{jsgf.c@{jsgf.c}!jsgf\_rule\_name@{jsgf\_rule\_name}}
\index{jsgf\_rule\_name@{jsgf\_rule\_name}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_rule\_name()}
{\footnotesize\ttfamily char const  $\ast$ jsgf\+\_\+rule\+\_\+name (\begin{DoxyParamCaption}\item[{\textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$}]{rule }\end{DoxyParamCaption})}



Get the rule name from a rule. 



Definition at line \textbf{ 437} of file \textbf{ jsgf.\+c}.



References \textbf{ jsgf\+\_\+rule\+\_\+s\+::name}.

\label{jsgf_8c_a49d5d9f6c1edda3bb087545ecfa21809} 
\index{jsgf.c@{jsgf.c}!jsgf\_rule\_public@{jsgf\_rule\_public}}
\index{jsgf\_rule\_public@{jsgf\_rule\_public}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_rule\_public()}
{\footnotesize\ttfamily int jsgf\+\_\+rule\+\_\+public (\begin{DoxyParamCaption}\item[{\textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$}]{rule }\end{DoxyParamCaption})}



Test if a rule is public or not. 



Definition at line \textbf{ 443} of file \textbf{ jsgf.\+c}.



References \textbf{ jsgf\+\_\+rule\+\_\+s\+::public}.



Referenced by \textbf{ jsgf\+\_\+read\+\_\+file()}.

\label{jsgf_8c_aa439cbe2e9002f5e74638f9af249aa36} 
\index{jsgf.c@{jsgf.c}!jsgf\_rule\_retain@{jsgf\_rule\_retain}}
\index{jsgf\_rule\_retain@{jsgf\_rule\_retain}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_rule\_retain()}
{\footnotesize\ttfamily \textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$ jsgf\+\_\+rule\+\_\+retain (\begin{DoxyParamCaption}\item[{\textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$}]{rule }\end{DoxyParamCaption})}



Definition at line \textbf{ 592} of file \textbf{ jsgf.\+c}.

\label{jsgf_8c_ab9454daf3cdf0c857b0f4780b600632c} 
\index{jsgf.c@{jsgf.c}!jsgf\_write\_fsg@{jsgf\_write\_fsg}}
\index{jsgf\_write\_fsg@{jsgf\_write\_fsg}!jsgf.c@{jsgf.c}}
\doxysubsubsection{jsgf\_write\_fsg()}
{\footnotesize\ttfamily int jsgf\+\_\+write\+\_\+fsg (\begin{DoxyParamCaption}\item[{\textbf{ jsgf\+\_\+t} $\ast$}]{grammar,  }\item[{\textbf{ jsgf\+\_\+rule\+\_\+t} $\ast$}]{rule,  }\item[{FILE $\ast$}]{outfh }\end{DoxyParamCaption})}



Convert a JSGF rule to Sphinx FSG text form. 

This does a direct conversion without doing transitive closure on null transitions and so forth. 

Definition at line \textbf{ 542} of file \textbf{ jsgf.\+c}.



References \textbf{ jsgf\+\_\+build\+\_\+fsg\+\_\+raw()}, \textbf{ logmath\+\_\+free()}, and \textbf{ logmath\+\_\+init()}.

