support for executing c code when a cut occurs

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1463 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
tiagosoares
2005-11-18 18:52:41 +00:00
parent d62ec41632
commit 83b5a160f8
17 changed files with 531 additions and 19 deletions

View File

@@ -20,6 +20,9 @@ static char SccsId[] = "@(#)cdmgr.c 1.1 05/02/98";
#include "absmi.h"
#include "yapio.h"
#ifdef CUT_C
#include "cut_c.h"
#endif
STATIC_PROTO(Int CallPredicate, (PredEntry *, choiceptr, yamop *));
STATIC_PROTO(Int EnterCreepMode, (Term, Term));
@@ -1404,6 +1407,16 @@ Yap_execute_goal(Term t, int nargs, Term mod)
/* restore the old environment */
/* get to previous environment */
cut_B = (choiceptr)ENV[E_CB];
#ifdef CUT_C
{
/* Note that
cut_B == (choiceptr)ENV[E_CB] */
while (POP_CHOICE_POINT(ENV[E_CB]))
{
POP_EXECUTE();
}
}
#endif /* CUT_C */
#ifdef YAPOR
CUT_prune_to(cut_B);
#endif /* YAPOR */
@@ -1592,6 +1605,14 @@ p_restore_regs2(void)
#else
pt0 = (choiceptr)(LCL0-IntOfTerm(d0));
#endif
#ifdef CUT_C
{
while (POP_CHOICE_POINT(pt0))
{
POP_EXECUTE();
}
}
#endif /* CUT_C */
#ifdef YAPOR
CUT_prune_to(pt0);
#endif /* YAPOR */