FORM 4.3
|
#include "form3.h"
Go to the source code of this file.
Macros | |
#define | PutInBuffers(pow) |
Functions | |
WORD | TestMatch (PHEAD WORD *term, WORD *level) |
VOID | Substitute (PHEAD WORD *term, WORD *pattern, WORD power) |
WORD | FindAll (PHEAD WORD *term, WORD *pattern, WORD level, WORD *par) |
int | TestSelect (WORD *term, WORD *setp) |
VOID | SubsInAll (PHEAD0) |
VOID | TransferBuffer (int from, int to, int spectator) |
int | TakeIDfunction (PHEAD WORD *term) |
Top level pattern matching routines. More pattern matching is found in findpat.c, function.c, symmetr.c and smart.c. The last three files contain the matching inside functions. The file 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 SUBEXPRESSION.
Definition in file pattern.c.
#define PutInBuffers | ( | pow | ) |
WORD TestMatch | ( | PHEAD WORD * | term, |
WORD * | level ) |
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 *AT.TMout. For operations the subexpression pointer is negative and corresponds to an address in the array AT.TMout. In this array are then the instructions for the routine to be called and its number in the array 'Operations' 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 FORM, but with the advent of TFORM this cannot be maintained. Now, for TFORM 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 TFORM only and that may indicate problems.
Definition at line 97 of file pattern.c.
References AddRHS(), EndSort(), Generator(), CbUf::lhs, LowerSortLevel(), and NewSort().
Referenced by Generator().
VOID Substitute | ( | PHEAD WORD * | term, |
WORD * | pattern, | ||
WORD | power ) |
WORD FindAll | ( | PHEAD WORD * | term, |
WORD * | pattern, | ||
WORD | level, | ||
WORD * | par ) |