00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef _H_engine
00040
00041 #define _H_engine
00042
00043 #ifndef _H_lgcldpnd
00044 #include "lgcldpnd.h"
00045 #endif
00046 #ifndef _H_ruledef
00047 #include "ruledef.h"
00048 #endif
00049 #ifndef _H_network
00050 #include "network.h"
00051 #endif
00052 #ifndef _H_moduldef
00053 #include "moduldef.h"
00054 #endif
00055 #ifndef _H_retract
00056 #include "retract.h"
00057 #endif
00058
00059 struct focus
00060 {
00061 struct defmodule *theModule;
00062 struct defruleModule *theDefruleModule;
00063 struct focus *next;
00064 };
00065
00066 #define ENGINE_DATA 18
00067
00068 struct engineData
00069 {
00070 struct defrule *ExecutingRule;
00071 intBool HaltRules;
00072 struct joinNode *TheLogicalJoin;
00073 struct partialMatch *TheLogicalBind;
00074 struct dependency *UnsupportedDataEntities;
00075 int alreadyEntered;
00076 struct callFunctionItem *ListOfRunFunctions;
00077 struct focus *CurrentFocus;
00078 int FocusChanged;
00079 #if DEBUGGING_FUNCTIONS
00080 unsigned WatchStatistics;
00081 unsigned WatchFocus;
00082 #endif
00083 intBool IncrementalResetInProgress;
00084 intBool IncrementalResetFlag;
00085 intBool JoinOperationInProgress;
00086 struct partialMatch *GlobalLHSBinds;
00087 struct partialMatch *GlobalRHSBinds;
00088 struct joinNode *GlobalJoin;
00089 struct partialMatch *GarbagePartialMatches;
00090 struct alphaMatch *GarbageAlphaMatches;
00091 int AlreadyRunning;
00092 #if DEVELOPER
00093 long leftToRightComparisons;
00094 long rightToLeftComparisons;
00095 long leftToRightSucceeds;
00096 long rightToLeftSucceeds;
00097 long leftToRightLoops;
00098 long rightToLeftLoops;
00099 long findNextConflictingComparisons;
00100 long betaHashHTSkips;
00101 long betaHashListSkips;
00102 long unneededMarkerCompare;
00103 #endif
00104 };
00105
00106 #define EngineData(theEnv) ((struct engineData *) GetEnvironmentData(theEnv,ENGINE_DATA))
00107
00108 #ifdef LOCALE
00109 #undef LOCALE
00110 #endif
00111
00112 #ifdef _ENGINE_SOURCE_
00113 #define LOCALE
00114 #else
00115 #define LOCALE extern
00116 #endif
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127 #define MAX_PATTERNS_CHECKED 64
00128
00129 #define ClearFocusStack() EnvClearFocusStack(GetCurrentEnvironment())
00130 #define DefruleHasBreakpoint(a) EnvDefruleHasBreakpoint(GetCurrentEnvironment(),a)
00131 #define Focus(a) EnvFocus(GetCurrentEnvironment(),a)
00132 #define GetFocus() EnvGetFocus(GetCurrentEnvironment())
00133 #define GetFocusChanged() EnvGetFocusChanged(GetCurrentEnvironment())
00134 #define GetFocusStack(a) EnvGetFocusStack(GetCurrentEnvironment(),a)
00135 #define GetNextFocus(a) EnvGetNextFocus(GetCurrentEnvironment(),a)
00136 #define Halt() EnvHalt(GetCurrentEnvironment())
00137 #define ListFocusStack(a) EnvListFocusStack(GetCurrentEnvironment(),a)
00138 #define PopFocus() EnvPopFocus(GetCurrentEnvironment())
00139 #define RemoveBreak(a) EnvRemoveBreak(GetCurrentEnvironment(),a)
00140 #define RemoveRunFunction(a) EnvRemoveRunFunction(GetCurrentEnvironment(),a)
00141 #define SetBreak(a) EnvSetBreak(GetCurrentEnvironment(),a)
00142 #define SetFocusChanged(a) EnvSetFocusChanged(GetCurrentEnvironment(),a)
00143 #define ShowBreaks(a,b) EnvShowBreaks(GetCurrentEnvironment(),a,b)
00144
00145 #if ALLOW_ENVIRONMENT_GLOBALS
00146 LOCALE long long Run(long long);
00147 #endif
00148
00149 LOCALE long long EnvRun(void *,long long);
00150 LOCALE intBool EnvAddRunFunction(void *,char *,
00151 void (*)(void *),int);
00152 LOCALE intBool EnvAddRunFunctionWithContext(void *,char *,
00153 void (*)(void *),int,void *);
00154 LOCALE intBool AddRunFunction(char *,void (*)(void),int);
00155 LOCALE intBool EnvRemoveRunFunction(void *,char *);
00156 LOCALE void InitializeEngine(void *);
00157 LOCALE void EnvSetBreak(void *,void *);
00158 LOCALE void EnvHalt(void *);
00159 LOCALE intBool EnvRemoveBreak(void *,void *);
00160 LOCALE void RemoveAllBreakpoints(void *);
00161 LOCALE void EnvShowBreaks(void *,char *,void *);
00162 LOCALE intBool EnvDefruleHasBreakpoint(void *,void *);
00163 LOCALE void RunCommand(void *);
00164 LOCALE void SetBreakCommand(void *);
00165 LOCALE void RemoveBreakCommand(void *);
00166 LOCALE void ShowBreaksCommand(void *);
00167 LOCALE void HaltCommand(void *);
00168 LOCALE int FocusCommand(void *);
00169 LOCALE void ClearFocusStackCommand(void *);
00170 LOCALE void EnvClearFocusStack(void *);
00171 LOCALE void *EnvGetNextFocus(void *,void *);
00172 LOCALE void EnvFocus(void *,void *);
00173 LOCALE int EnvGetFocusChanged(void *);
00174 LOCALE void EnvSetFocusChanged(void *,int);
00175 LOCALE void ListFocusStackCommand(void *);
00176 LOCALE void EnvListFocusStack(void *,char *);
00177 LOCALE void GetFocusStackFunction(void *,DATA_OBJECT_PTR);
00178 LOCALE void EnvGetFocusStack(void *,DATA_OBJECT_PTR);
00179 LOCALE void *PopFocusFunction(void *);
00180 LOCALE void *GetFocusFunction(void *);
00181 LOCALE void *EnvPopFocus(void *);
00182 LOCALE void *EnvGetFocus(void *);
00183 LOCALE intBool EnvGetHaltRules(void *);
00184 LOCALE void EnvSetHaltRules(void *,intBool);
00185
00186 #endif
00187
00188
00189
00190
00191
00192