Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
infradig committed Dec 17, 2024
1 parent a3b4dbc commit 8a99e5d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/bif_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ static bool bif_ignore_1(query *q)

// if -> then

static bool bif_iso_if_then_2(query *q)
bool bif_iso_if_then_2(query *q)
{
GET_FIRST_ARG(p1,callable);
GET_NEXT_ARG(p2,callable);
Expand All @@ -256,7 +256,7 @@ static bool bif_iso_if_then_2(query *q)

// if *-> then

static bool bif_if_2(query *q)
bool bif_if_2(query *q)
{
GET_FIRST_ARG(p1,callable);
GET_NEXT_ARG(p2,callable);
Expand Down Expand Up @@ -351,9 +351,6 @@ static bool bif_iso_disjunction_2(query *q)
cell *c = q->st.curr_instr+1;

if (is_callable(c)) {
if (is_cstring(c) && (c->val_off == g_nil_s))
return throw_error(q, c, q->st.curr_frame, "type_error", "callable");

if (c->bif_ptr && (c->bif_ptr->fn == bif_iso_if_then_2)) {
cell *p1 = q->st.curr_instr + 2;
cell *p2 = p1 + p1->nbr_cells;
Expand Down
20 changes: 20 additions & 0 deletions src/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,26 @@ static void compile_term(clause *cl, cell **dst, cell **src)
return;
}

#if 0
cell *c = (*src)+1;

if (is_callable(c)) {
if (c->bif_ptr && (c->bif_ptr->fn == bif_iso_if_then_2)) {
cell *p1 = q->st.curr_instr + 2;
cell *p2 = p1 + p1->nbr_cells;
cell *p3 = p2 + p2->nbr_cells;
return do_if_then_else(q, p1, p2, p3);
}

if (c->bif_ptr && (c->bif_ptr->fn == bif_if_2)) {
cell *p1 = q->st.curr_instr + 2;
cell *p2 = p1 + p1->nbr_cells;
cell *p3 = p2 + p2->nbr_cells;
return soft_do_if_then_else(q, p1, p2, p3);
}
}
#endif

#if 0
if (((*src)->val_off == g_disjunction_s) && ((*src)->arity == 2)) {
unsigned var_nbr = cl->nbr_vars++;
Expand Down
2 changes: 2 additions & 0 deletions src/query.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ bool bif_iso_conjunction_2(query *q);
bool bif_iso_qualify_2(query *q);
bool bif_iso_cut_0(query *q);
bool bif_iso_unify_2(query *q);
bool bif_if_2(query *q);
bool bif_iso_if_then_2(query *q);

bool bif_sys_call_check_1(query *q);
bool bif_sys_succeed_on_retry_2(query *q);
Expand Down

0 comments on commit 8a99e5d

Please sign in to comment.