\hypertarget{pattern_8c}{}\doxysection{pattern.\+c File Reference}
\label{pattern_8c}\index{pattern.c@{pattern.c}}
{\ttfamily \#include \char`\"{}form3.\+h\char`\"{}}\newline
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define {\bfseries Put\+In\+Buffers}(pow)
\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
W\+O\+RD \mbox{\hyperlink{pattern_8c_a23841bb1c7de8056ebccec32f4217602}{Test\+Match}} (P\+H\+E\+AD W\+O\+RD $\ast$term, W\+O\+RD $\ast$level)
\item 
\mbox{\Hypertarget{pattern_8c_a1720b78decb4d39d9cb5d5059da22c9b}\label{pattern_8c_a1720b78decb4d39d9cb5d5059da22c9b}} 
V\+O\+ID {\bfseries Substitute} (P\+H\+E\+AD W\+O\+RD $\ast$term, W\+O\+RD $\ast$pattern, W\+O\+RD power)
\item 
\mbox{\Hypertarget{pattern_8c_a4d9a8d6624dfcbb6047e3b0746377d42}\label{pattern_8c_a4d9a8d6624dfcbb6047e3b0746377d42}} 
W\+O\+RD {\bfseries Find\+All} (P\+H\+E\+AD W\+O\+RD $\ast$term, W\+O\+RD $\ast$pattern, W\+O\+RD level, W\+O\+RD $\ast$par)
\item 
\mbox{\Hypertarget{pattern_8c_a0a8e713e5ed23bf0f9f6b51efa3bceb4}\label{pattern_8c_a0a8e713e5ed23bf0f9f6b51efa3bceb4}} 
int {\bfseries Test\+Select} (W\+O\+RD $\ast$term, W\+O\+RD $\ast$setp)
\item 
\mbox{\Hypertarget{pattern_8c_a1b9d0ab3060bc77cd037a8d75a8431df}\label{pattern_8c_a1b9d0ab3060bc77cd037a8d75a8431df}} 
V\+O\+ID {\bfseries Subs\+In\+All} (P\+H\+E\+A\+D0)
\item 
\mbox{\Hypertarget{pattern_8c_a68936044932b1823b8b0765d0ab13043}\label{pattern_8c_a68936044932b1823b8b0765d0ab13043}} 
V\+O\+ID {\bfseries Transfer\+Buffer} (int from, int to, int spectator)
\item 
\mbox{\Hypertarget{pattern_8c_a91d9b0a9dd577df31daef57c486aaa49}\label{pattern_8c_a91d9b0a9dd577df31daef57c486aaa49}} 
int {\bfseries Take\+I\+Dfunction} (P\+H\+E\+AD W\+O\+RD $\ast$term)
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Top level pattern matching routines. More pattern matching is found in \mbox{\hyperlink{findpat_8c}{findpat.\+c}}, \mbox{\hyperlink{function_8c}{function.\+c}}, \mbox{\hyperlink{symmetr_8c}{symmetr.\+c}} and \mbox{\hyperlink{smart_8c}{smart.\+c}}. The last three files contain the matching inside functions. The file \mbox{\hyperlink{pattern_8c}{pattern.\+c}} contains also the very important routine Substitute. All regular pattern matching is just the finding of the pattern and indicating what are the wildcards etc. The routine Substitute does the actual removal of the pattern and replaces it by a subterm of the type S\+U\+B\+E\+X\+P\+R\+E\+S\+S\+I\+ON. 

\doxysubsection{Macro Definition Documentation}
\mbox{\Hypertarget{pattern_8c_aba36e6b67bd0a972d704d3416189303b}\label{pattern_8c_aba36e6b67bd0a972d704d3416189303b}} 
\index{pattern.c@{pattern.c}!PutInBuffers@{PutInBuffers}}
\index{PutInBuffers@{PutInBuffers}!pattern.c@{pattern.c}}
\doxysubsubsection{\texorpdfstring{PutInBuffers}{PutInBuffers}}
{\footnotesize\ttfamily \#define Put\+In\+Buffers(\begin{DoxyParamCaption}\item[{}]{pow }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{\mbox{\hyperlink{comtool_8c_aab7acff43928a668734d4c39c01fbdb4}{AddRHS}}(AT.ebufnum,1); \(\backslash\)}
\DoxyCodeLine{    *out++ = SUBEXPRESSION; \(\backslash\)}
\DoxyCodeLine{    *out++ = SUBEXPSIZE; \(\backslash\)}
\DoxyCodeLine{    *out++ = C-\/>numrhs; \(\backslash\)}
\DoxyCodeLine{    *out++ = pow; \(\backslash\)}
\DoxyCodeLine{    *out++ = AT.ebufnum; \(\backslash\)}
\DoxyCodeLine{    FILLSUB(out) \(\backslash\)}
\DoxyCodeLine{    r = AT.pWorkSpace[rhs+i]; \(\backslash\)}
\DoxyCodeLine{    if ( *r > 0 ) \{ \(\backslash\)}
\DoxyCodeLine{        oldinr = r[*r]; r[*r] = 0; \(\backslash\)}
\DoxyCodeLine{        AddNtoC(AT.ebufnum,(*r+1-\/ARGHEAD),(r+ARGHEAD),14); \(\backslash\)}
\DoxyCodeLine{        r[*r] = oldinr; \(\backslash\)}
\DoxyCodeLine{    \} \(\backslash\)}
\DoxyCodeLine{    else \{ \(\backslash\)}
\DoxyCodeLine{        ToGeneral(r,buffer,1); \(\backslash\)}
\DoxyCodeLine{        buffer[buffer[0]] = 0; \(\backslash\)}
\DoxyCodeLine{        AddNtoC(AT.ebufnum,buffer[0]+1,buffer,15); \(\backslash\)}
\DoxyCodeLine{    \}}

\end{DoxyCode}


Definition at line 2193 of file pattern.\+c.



\doxysubsection{Function Documentation}
\mbox{\Hypertarget{pattern_8c_a23841bb1c7de8056ebccec32f4217602}\label{pattern_8c_a23841bb1c7de8056ebccec32f4217602}} 
\index{pattern.c@{pattern.c}!TestMatch@{TestMatch}}
\index{TestMatch@{TestMatch}!pattern.c@{pattern.c}}
\doxysubsubsection{\texorpdfstring{TestMatch()}{TestMatch()}}
{\footnotesize\ttfamily W\+O\+RD Test\+Match (\begin{DoxyParamCaption}\item[{P\+H\+E\+AD W\+O\+RD $\ast$}]{term,  }\item[{W\+O\+RD $\ast$}]{level }\end{DoxyParamCaption})}

This routine governs the pattern matching. If it decides that a substitution should be made, this can be either the insertion of a right hand side (C-\/$>$rhs) or the automatic generation of terms as a result of an operation (like trace). The object to be replaced is removed from term and a subexpression pointer is inserted. If the substitution is made more than once there can be more subexpression pointers. Its number is positive as it corresponds to the level at which the C-\/$>$rhs can be found in the compiler output. The subexpression pointer contains the wildcard substitution information. The power is found in $\ast$\+AT.T\+Mout. For operations the subexpression pointer is negative and corresponds to an address in the array A\+T.\+T\+Mout. In this array are then the instructions for the routine to be called and its number in the array \textquotesingle{}Operations\textquotesingle{} The format is here\+: length,functionnumber,length-\/2 parameters

There is a certain complexity wrt repeat levels. Another complication is the poking of the wildcard values in the subexpression prototype in the compiler buffer. This was how things were done in the past with sequential F\+O\+RM, but with the advent of T\+F\+O\+RM this cannot be maintained. Now, for T\+F\+O\+RM we make a copy of it. 7-\/may-\/2008 (JV)\+: We cannot yet guarantee that this has been done 100\% correctly. There are errors that occur in T\+F\+O\+RM only and that may indicate problems. 

Definition at line 97 of file pattern.\+c.

