Skip to content

Commit

Permalink
WIP, re issue #354
Browse files Browse the repository at this point in the history
  • Loading branch information
infradig committed Oct 2, 2023
1 parent 1b6377c commit 79212bf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions src/attributed.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ bool fn_sys_redo_trail_1(query * q)
return true;
}

bool do_post_unification_hook(query *q)
bool do_post_unification_hook(query *q, bool is_builtin)
{
q->run_hook = false;
q->undo_lo_tp = q->before_hook_tp;
Expand Down Expand Up @@ -249,7 +249,11 @@ bool do_post_unification_hook(query *q)
if (!tmp[1].match)
return throw_error(q, tmp+1, q->st.curr_frame, "existence_error", "procedure");

make_call_redo(q, tmp+2);
if (is_builtin)
make_call(q, tmp+2);
else
make_call_redo(q, tmp+2);

q->st.curr_cell = tmp;
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/attributed.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ bool fn_sys_get_attributes_2(query *q);
bool fn_sys_unattributed_var_1(query *q);
bool fn_sys_attributed_var_1(query *q);

bool do_post_unification_hook(query *q);
bool do_post_unification_hook(query *q, bool is_builtin);
bool fn_sys_undo_trail_2(query *q);
bool fn_sys_redo_trail_1(query *q);

4 changes: 2 additions & 2 deletions src/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,7 @@ bool start(query *q)
}

if (q->run_hook)
do_post_unification_hook(q);
do_post_unification_hook(q, true);

Trace(q, save_cell, save_ctx, EXIT);
proceed(q);
Expand All @@ -1593,7 +1593,7 @@ bool start(query *q)
}

if (q->run_hook)
do_post_unification_hook(q);
do_post_unification_hook(q, false);
} else {
if (consultall(q, q->st.curr_cell, q->st.curr_frame) != true) {
q->retry = QUERY_RETRY;
Expand Down

0 comments on commit 79212bf

Please sign in to comment.