From 192b1cc01897906f67e15a0046897eb5fecbe002 Mon Sep 17 00:00:00 2001 From: krasimir Date: Sat, 4 Jul 2015 15:06:34 +0000 Subject: the reasoner's states are now closures just like the code for the def rules. This means more compact JIT compiled code and uniformity with the code for def rules --- src/runtime/c/pgf/reasoner.h | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'src/runtime/c/pgf/reasoner.h') diff --git a/src/runtime/c/pgf/reasoner.h b/src/runtime/c/pgf/reasoner.h index 966ba11a5..714b31b4a 100644 --- a/src/runtime/c/pgf/reasoner.h +++ b/src/runtime/c/pgf/reasoner.h @@ -7,20 +7,6 @@ typedef struct PgfReasoner PgfReasoner; typedef struct PgfReasonerState PgfReasonerState; typedef struct PgfExprState PgfExprState; -typedef void (*PgfPredicate)(PgfReasoner* rs, PgfReasonerState* st); - -void -pgf_reasoner_try_first(PgfReasoner* rs, PgfExprState* parent, PgfAbsFun* absfun); - -void -pgf_reasoner_try_else(PgfReasoner* rs, PgfExprState* prev, PgfAbsFun* absfun); - -void -pgf_reasoner_complete(PgfReasoner* rs, PgfExprState* st); - -void -pgf_reasoner_try_constant(PgfReasoner* rs, PgfExprState* prev, PgfAbsFun* absfun); - typedef struct { PgfFunction code; } PgfClosure; @@ -117,6 +103,9 @@ struct PgfEvalGates { PgfFunction mk_const; + PgfFunction combine1; + PgfFunction combine2; + PgfClosure* (*enter)(PgfReasoner* rs, PgfClosure* closure); GuFinalizer fin; @@ -126,6 +115,24 @@ struct PgfEvalGates { PgfReasoner* pgf_new_reasoner(PgfPGF* pgf, GuExn* err, GuPool* pool, GuPool* out_pool); +void +pgf_reasoner_try_first(PgfReasoner* rs, PgfExprState* parent, PgfAbsFun* absfun); + +void +pgf_reasoner_try_else(PgfReasoner* rs, PgfExprState* prev, PgfAbsFun* absfun); + +void +pgf_reasoner_combine1(PgfReasoner* rs, PgfClosure* closure); + +void +pgf_reasoner_combine2(PgfReasoner* rs, PgfClosure* closure); + +void +pgf_reasoner_complete(PgfReasoner* rs, PgfExprState* st); + +void +pgf_reasoner_try_constant(PgfReasoner* rs, PgfExprState* prev, PgfAbsFun* absfun); + PgfClosure* pgf_evaluate_expr_thunk(PgfReasoner* rs, PgfExprThunk* thunk); -- cgit v1.2.3