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 #ifndef _H_tmpltdef
00027 #define _H_tmpltdef
00028
00029 struct deftemplate;
00030 struct templateSlot;
00031 struct deftemplateModule;
00032
00033 #ifndef _H_conscomp
00034 #include "conscomp.h"
00035 #endif
00036 #ifndef _H_symbol
00037 #include "symbol.h"
00038 #endif
00039 #ifndef _H_expressn
00040 #include "expressn.h"
00041 #endif
00042 #ifndef _H_evaluatn
00043 #include "evaluatn.h"
00044 #endif
00045 #ifndef _H_constrct
00046 #include "constrct.h"
00047 #endif
00048 #ifndef _H_moduldef
00049 #include "moduldef.h"
00050 #endif
00051 #ifndef _H_constrnt
00052 #include "constrnt.h"
00053 #endif
00054 #include "factbld.h"
00055 #ifndef _H_factmngr
00056 #include "factmngr.h"
00057 #endif
00058 #ifndef _H_cstrccom
00059 #include "cstrccom.h"
00060 #endif
00061
00062 struct deftemplate
00063 {
00064 struct constructHeader header;
00065 struct templateSlot *slotList;
00066 unsigned int implied : 1;
00067 unsigned int watch : 1;
00068 unsigned int inScope : 1;
00069 unsigned short numberOfSlots;
00070 long busyCount;
00071 struct factPatternNode *patternNetwork;
00072 struct fact *factList;
00073 struct fact *lastFact;
00074 };
00075
00076 struct templateSlot
00077 {
00078 struct symbolHashNode *slotName;
00079 unsigned int multislot : 1;
00080 unsigned int noDefault : 1;
00081 unsigned int defaultPresent : 1;
00082 unsigned int defaultDynamic : 1;
00083 CONSTRAINT_RECORD *constraints;
00084 struct expr *defaultList;
00085 struct expr *facetList;
00086 struct templateSlot *next;
00087 };
00088
00089 struct deftemplateModule
00090 {
00091 struct defmoduleItemHeader header;
00092 };
00093
00094 #define DEFTEMPLATE_DATA 5
00095
00096 struct deftemplateData
00097 {
00098 struct construct *DeftemplateConstruct;
00099 int DeftemplateModuleIndex;
00100 struct entityRecord DeftemplatePtrRecord;
00101 #if DEBUGGING_FUNCTIONS
00102 int DeletedTemplateDebugFlags;
00103 #endif
00104 #if CONSTRUCT_COMPILER && (! RUN_TIME)
00105 struct CodeGeneratorItem *DeftemplateCodeItem;
00106 #endif
00107 #if (! RUN_TIME) && (! BLOAD_ONLY)
00108 int DeftemplateError;
00109 #endif
00110 };
00111
00112 #define EnvGetDeftemplateName(theEnv,x) GetConstructNameString((struct constructHeader *) x)
00113 #define EnvGetDeftemplatePPForm(theEnv,x) GetConstructPPForm(theEnv,(struct constructHeader *) x)
00114 #define EnvDeftemplateModule(theEnv,x) GetConstructModuleName((struct constructHeader *) x)
00115 #define DeftemplateData(theEnv) ((struct deftemplateData *) GetEnvironmentData(theEnv,DEFTEMPLATE_DATA))
00116
00117 #ifdef LOCALE
00118 #undef LOCALE
00119 #endif
00120
00121 #ifdef _TMPLTDEF_SOURCE_
00122 #define LOCALE
00123 #else
00124 #define LOCALE extern
00125 #endif
00126
00127 #define FindDeftemplate(a) EnvFindDeftemplate(GetCurrentEnvironment(),a)
00128 #define GetNextDeftemplate(a) EnvGetNextDeftemplate(GetCurrentEnvironment(),a)
00129 #define IsDeftemplateDeletable(a) EnvIsDeftemplateDeletable(GetCurrentEnvironment(),a)
00130 #define GetDeftemplateName(x) GetConstructNameString((struct constructHeader *) x)
00131 #define GetDeftemplatePPForm(x) GetConstructPPForm(GetCurrentEnvironment(),(struct constructHeader *) x)
00132 #define GetNextFactInTemplate(a,b) EnvGetNextFactInTemplate(GetCurrentEnvironment(),a,b)
00133 #define DeftemplateModule(x) GetConstructModuleName((struct constructHeader *) x)
00134
00135 LOCALE void InitializeDeftemplates(void *);
00136 LOCALE void *EnvFindDeftemplate(void *,char *);
00137 LOCALE void *EnvGetNextDeftemplate(void *,void *);
00138 LOCALE intBool EnvIsDeftemplateDeletable(void *,void *);
00139 LOCALE void *EnvGetNextFactInTemplate(void *,void *,void *);
00140 LOCALE struct deftemplateModule *GetDeftemplateModuleItem(void *,struct defmodule *);
00141 LOCALE void ReturnSlots(void *,struct templateSlot *);
00142 LOCALE void IncrementDeftemplateBusyCount(void *,void *);
00143 LOCALE void DecrementDeftemplateBusyCount(void *,void *);
00144 LOCALE void *CreateDeftemplateScopeMap(void *,struct deftemplate *);
00145
00146 #if RUN_TIME
00147 LOCALE void DeftemplateRunTimeInitialize(void *);
00148 #endif
00149
00150 #endif
00151
00152