From f1d5e8491837f5435692bdf82be59a9e9f6713d7 Mon Sep 17 00:00:00 2001 From: vsc Date: Mon, 28 Apr 2008 23:02:32 +0000 Subject: [PATCH] fix bug in current_predicate/2 fix bug in c_interface. git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@2221 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/c_interface.c | 7 ++++++- C/cdmgr.c | 26 +++++++++++++++++++++++--- changes-5.1.html | 3 +++ pl/consult.yap | 6 ++++++ pl/preds.yap | 16 ++++++++-------- 5 files changed, 46 insertions(+), 12 deletions(-) diff --git a/C/c_interface.c b/C/c_interface.c index e5ec2e814..668972484 100644 --- a/C/c_interface.c +++ b/C/c_interface.c @@ -10,8 +10,11 @@ * File: c_interface.c * * comments: c_interface primitives definition * * * -* Last rev: $Date: 2008-04-11 16:30:27 $,$Author: ricroc $ * +* Last rev: $Date: 2008-04-28 23:02:32 $,$Author: vsc $ * * $Log: not supported by cvs2svn $ +* Revision 1.115 2008/04/11 16:30:27 ricroc +* *** empty log message *** +* * Revision 1.114 2008/04/04 13:35:41 vsc * fix duplicate dependency frame at entry * @@ -1305,6 +1308,8 @@ run_emulator(YAP_dogoalinfo *dgi) ASP = (CELL *)(B+1); B = B->cp_b; HB = B->cp_h; + } else { + Yap_StartSlots(); } P = dgi->p; RECOVER_MACHINE_REGS(); diff --git a/C/cdmgr.c b/C/cdmgr.c index 29dc06838..bc0364707 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -11,8 +11,11 @@ * File: cdmgr.c * * comments: Code manager * * * -* Last rev: $Date: 2008-04-11 16:30:27 $,$Author: ricroc $ * +* Last rev: $Date: 2008-04-28 23:02:32 $,$Author: vsc $ * * $Log: not supported by cvs2svn $ +* Revision 1.227 2008/04/11 16:30:27 ricroc +* *** empty log message *** +* * Revision 1.226 2008/04/01 22:28:41 vsc * put YAPOR back to life. * @@ -2886,6 +2889,22 @@ p_is_source(void) return(out); } +static Int +p_mk_d(void) +{ /* '$is_dynamic'(+P) */ + PredEntry *pe; + + pe = get_pred(Deref(ARG1), Deref(ARG2), "$is_source"); + if (EndOfPAEntr(pe)) + return FALSE; + LOCK(pe->PELock); + if (pe->OpcodeOfPred == UNDEF_OPCODE) { + pe->OpcodeOfPred = FAIL_OPCODE; + } + UNLOCK(pe->PELock); + return TRUE; +} + static Int p_is_dynamic(void) { /* '$is_dynamic'(+P) */ @@ -3049,14 +3068,14 @@ p_kill_dynamic(void) LOCK(pe->PELock); if (!(pe->PredFlags & (DynamicPredFlag|LogUpdatePredFlag))) { UNLOCK(pe->PELock); - return (FALSE); + return FALSE; } if (pe->cs.p_code.LastClause != pe->cs.p_code.FirstClause) { UNLOCK(pe->PELock); return (FALSE); } pe->cs.p_code.LastClause = pe->cs.p_code.FirstClause = NULL; - pe->OpcodeOfPred = UNDEF_OPCODE; + pe->OpcodeOfPred = FAIL_OPCODE; pe->cs.p_code.TrueCodeOfPred = pe->CodeOfPred = (yamop *)(&(pe->OpcodeOfPred)); pe->PredFlags = pe->PredFlags & GoalExPredFlag; UNLOCK(pe->PELock); @@ -6106,6 +6125,7 @@ Yap_InitCdMgr(void) Yap_InitCPred("$is_expand_goal_or_meta_predicate", 2, p_is_expandgoalormetapredicate, TestPredFlag | SafePredFlag|HiddenPredFlag); Yap_InitCPred("$is_log_updatable", 2, p_is_log_updatable, TestPredFlag | SafePredFlag|HiddenPredFlag); Yap_InitCPred("$is_source", 2, p_is_source, TestPredFlag | SafePredFlag|HiddenPredFlag); + Yap_InitCPred("$mk_d", 2, p_mk_d, SafePredFlag|HiddenPredFlag); Yap_InitCPred("$pred_exists", 2, p_pred_exists, TestPredFlag | SafePredFlag|HiddenPredFlag); Yap_InitCPred("$number_of_clauses", 3, p_number_of_clauses, SafePredFlag|SyncPredFlag|HiddenPredFlag); Yap_InitCPred("$undefined", 2, p_undefined, SafePredFlag|TestPredFlag|HiddenPredFlag); diff --git a/changes-5.1.html b/changes-5.1.html index 96436acf4..550228d0c 100644 --- a/changes-5.1.html +++ b/changes-5.1.html @@ -17,6 +17,9 @@ xb

Yap-5.1.3: