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 __TABLES_H__
00027
00028 #define __TABLES_H__
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 void table_call_search(CTXTdeclc TabledCallInfo *, CallLookupResults *);
00039 BTNptr table_answer_search(CTXTdeclc VariantSF, int, int, CPtr, xsbBool *);
00040 void table_consume_answer(CTXTdeclc BTNptr, int, int, CPtr, TIFptr);
00041 ALNptr table_identify_relevant_answers(CTXTdeclc SubProdSF, SubConsSF, CPtr);
00042 void table_complete_entry(CTXTdeclc VariantSF);
00043
00044 void release_all_tabling_resources(CTXTdecl);
00045 VariantSF NewProducerSF(CTXTdeclc BTNptr,TIFptr);
00046
00047
00048
00049
00050
00051
00052
00053 #define table_pending_answer( OldAnswerContinuation, \
00054 NewAnswerContinuation, \
00055 NextAnswer, \
00056 Consumer, \
00057 Producer, \
00058 AnswerTemplate, \
00059 PreIdentificationOp, \
00060 PostIdentificationOp ) { \
00061 \
00062 NewAnswerContinuation = ALN_Next(OldAnswerContinuation); \
00063 \
00064 if ( IsNULL(NewAnswerContinuation) && IsProperlySubsumed(Consumer) ) \
00065 if ( MoreAnswersAreAvailable(Consumer,Producer) ) { \
00066 \
00067 PreIdentificationOp; \
00068 NewAnswerContinuation = \
00069 table_identify_relevant_answers(CTXTc Producer, Consumer, \
00070 AnswerTemplate); \
00071 PostIdentificationOp; \
00072 } \
00073 if ( IsNonNULL(NewAnswerContinuation) ) \
00074 NextAnswer = ALN_Answer(NewAnswerContinuation); \
00075 else \
00076 NextAnswer = NULL; \
00077 }
00078
00079
00080
00081
00082
00083
00084
00085 #define TPA_NoOp
00086
00087
00088
00089
00090
00091
00092
00093 #define MoreAnswersAreAvailable(ConsSF,ProdSF) \
00094 ( IsNonNULL(subg_ans_root_ptr(ProdSF)) && \
00095 (TSTN_TimeStamp((TSTNptr)subg_ans_root_ptr(ProdSF)) > \
00096 conssf_timestamp(ConsSF)) )
00097
00098
00099
00100
00101
00102 #endif