00001 /*******************************************************/ 00002 /* "C" Language Integrated Production System */ 00003 /* */ 00004 /* CLIPS Version 6.30 10/19/06 */ 00005 /* */ 00006 /* MATCH HEADER FILE */ 00007 /*******************************************************/ 00008 00009 /*************************************************************/ 00010 /* Purpose: */ 00011 /* */ 00012 /* Principal Programmer(s): */ 00013 /* Gary D. Riley */ 00014 /* */ 00015 /* Contributing Programmer(s): */ 00016 /* */ 00017 /* Revision History: */ 00018 /* */ 00019 /* 6.30: Added support for hashed alpha memories. */ 00020 /* */ 00021 /*************************************************************/ 00022 00023 #ifndef _H_match 00024 00025 #define _H_match 00026 00027 struct genericMatch; 00028 struct patternMatch; 00029 struct partialMatch; 00030 struct alphaMatch; 00031 struct multifieldMarker; 00032 00033 #ifndef _H_evaluatn 00034 #include "evaluatn.h" 00035 #endif 00036 #ifndef _H_network 00037 #include "network.h" 00038 #endif 00039 #ifndef _H_pattern 00040 #include "pattern.h" 00041 #endif 00042 00043 /************************************************************/ 00044 /* PATTERNMATCH STRUCTURE: */ 00045 /************************************************************/ 00046 struct patternMatch 00047 { 00048 struct patternMatch *next; 00049 struct partialMatch *theMatch; 00050 struct patternNodeHeader *matchingPattern; 00051 }; 00052 00053 /**************************/ 00054 /* genericMatch structure */ 00055 /**************************/ 00056 struct genericMatch 00057 { 00058 union 00059 { 00060 void *theValue; 00061 struct alphaMatch *theMatch; 00062 } gm; 00063 }; 00064 00065 /************************************************************/ 00066 /* PARTIALMATCH STRUCTURE: */ 00067 /************************************************************/ 00068 struct partialMatch 00069 { 00070 unsigned int betaMemory : 1; 00071 unsigned int busy : 1; 00072 unsigned int rhsMemory : 1; 00073 unsigned short bcount; 00074 unsigned long hashValue; 00075 void *owner; 00076 void *marker; 00077 void *dependents; 00078 struct partialMatch *nextInMemory; 00079 struct partialMatch *prevInMemory; 00080 struct partialMatch *children; 00081 struct partialMatch *rightParent; 00082 struct partialMatch *nextRightChild; 00083 struct partialMatch *prevRightChild; 00084 struct partialMatch *leftParent; 00085 struct partialMatch *nextLeftChild; 00086 struct partialMatch *prevLeftChild; 00087 struct partialMatch *blockList; 00088 struct partialMatch *nextBlocked; 00089 struct partialMatch *prevBlocked; 00090 struct genericMatch binds[1]; 00091 }; 00092 00093 /************************************************************/ 00094 /* ALPHAMATCH STRUCTURE: */ 00095 /************************************************************/ 00096 struct alphaMatch 00097 { 00098 struct patternEntity *matchingItem; 00099 struct multifieldMarker *markers; 00100 struct alphaMatch *next; 00101 unsigned long bucket; 00102 }; 00103 00104 /************************************************************/ 00105 /* MULTIFIELDMARKER STRUCTURE: Used in the pattern matching */ 00106 /* process to mark the range of fields that the $? and */ 00107 /* $?variables match because a single pattern restriction */ 00108 /* may span zero or more fields.. */ 00109 /************************************************************/ 00110 struct multifieldMarker 00111 { 00112 int whichField; 00113 union 00114 { 00115 void *whichSlot; 00116 short int whichSlotNumber; 00117 } where; 00118 long startPosition; 00119 long endPosition; 00120 struct multifieldMarker *next; 00121 }; 00122 00123 #define get_nth_pm_value(thePM,thePos) (thePM->binds[thePos].gm.theValue) 00124 #define get_nth_pm_match(thePM,thePos) (thePM->binds[thePos].gm.theMatch) 00125 00126 #define set_nth_pm_value(thePM,thePos,theVal) (thePM->binds[thePos].gm.theValue = (void *) theVal) 00127 #define set_nth_pm_match(thePM,thePos,theVal) (thePM->binds[thePos].gm.theMatch = theVal) 00128 00129 #endif 00130 00131 00132 00133 00134 00135
1.5.6