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 #ifndef _H_factqury
00029 #define _H_factqury
00030
00031 #if FACT_SET_QUERIES
00032
00033 #ifndef _H_factmngr
00034 #include "factmngr.h"
00035 #endif
00036
00037 typedef struct query_template
00038 {
00039 struct deftemplate *templatePtr;
00040 struct query_template *chain, *nxt;
00041 } QUERY_TEMPLATE;
00042
00043 typedef struct query_soln
00044 {
00045 struct fact **soln;
00046 struct query_soln *nxt;
00047 } QUERY_SOLN;
00048
00049 typedef struct query_core
00050 {
00051 struct fact **solns;
00052 EXPRESSION *query,*action;
00053 QUERY_SOLN *soln_set,*soln_bottom;
00054 unsigned soln_size,soln_cnt;
00055 DATA_OBJECT *result;
00056 } QUERY_CORE;
00057
00058 typedef struct query_stack
00059 {
00060 QUERY_CORE *core;
00061 struct query_stack *nxt;
00062 } QUERY_STACK;
00063
00064 #define FACT_QUERY_DATA 63
00065
00066 struct factQueryData
00067 {
00068 SYMBOL_HN *QUERY_DELIMETER_SYMBOL;
00069 QUERY_CORE *QueryCore;
00070 QUERY_STACK *QueryCoreStack;
00071 int AbortQuery;
00072 };
00073
00074 #define FactQueryData(theEnv) ((struct factQueryData *) GetEnvironmentData(theEnv,FACT_QUERY_DATA))
00075
00076 #ifdef LOCALE
00077 #undef LOCALE
00078 #endif
00079
00080 #ifdef _FACTQURY_SOURCE_
00081 #define LOCALE
00082 #else
00083 #define LOCALE extern
00084 #endif
00085
00086 #define QUERY_DELIMETER_STRING "(QDS)"
00087
00088 LOCALE void SetupFactQuery(void *);
00089 LOCALE void GetQueryFact(void *,DATA_OBJECT *);
00090 LOCALE void GetQueryFactSlot(void *,DATA_OBJECT *);
00091 LOCALE intBool AnyFacts(void *);
00092 LOCALE void QueryFindFact(void *,DATA_OBJECT *);
00093 LOCALE void QueryFindAllFacts(void *,DATA_OBJECT *);
00094 LOCALE void QueryDoForFact(void *,DATA_OBJECT *);
00095 LOCALE void QueryDoForAllFacts(void *,DATA_OBJECT *);
00096 LOCALE void DelayedQueryDoForAllFacts(void *,DATA_OBJECT *);
00097
00098 #endif
00099
00100 #endif
00101
00102
00103
00104
00105