From 0a21ac1b711e6e559598341845b09ea1413d6822 Mon Sep 17 00:00:00 2001 From: vsc Date: Tue, 21 Nov 2006 16:21:33 +0000 Subject: [PATCH] fix I/O mess fix spy/reconsult mess git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1724 b08c6af1-5177-4d33-ba66-4b1c6b8b522a --- C/absmi.c | 21 +++++++++++++++++++-- C/index.c | 12 +++++++++--- C/iopreds.c | 11 ++++++----- changes-5.1.html | 3 +++ pl/yio.yap | 8 ++++---- 5 files changed, 41 insertions(+), 14 deletions(-) diff --git a/C/absmi.c b/C/absmi.c index 99c98279e..aad8b9fce 100644 --- a/C/absmi.c +++ b/C/absmi.c @@ -10,8 +10,11 @@ * * * File: absmi.c * * comments: Portable abstract machine interpreter * -* Last rev: $Date: 2006-11-15 00:13:36 $,$Author: vsc $ * +* Last rev: $Date: 2006-11-21 16:21:30 $,$Author: vsc $ * * $Log: not supported by cvs2svn $ +* Revision 1.211 2006/11/15 00:13:36 vsc +* fixes for indexing code. +* * Revision 1.210 2006/10/25 02:31:07 vsc * fix emulation of trust_logical * @@ -7711,8 +7714,22 @@ Yap_absmi(int inp) { PredEntry *pe = PredFromDefCode(PREG); BEGD(d0); + WRITE_LOCK(pe->PRWLock); + if (!(pe->PredFlags & IndexedPredFlag) && + pe->cs.p_code.NOfClauses > 1) { + /* update ASP before calling IPred */ + ASP = YREG+E_CB; + if (ASP > (CELL *) PROTECT_FROZEN_B(B)) { + ASP = (CELL *) PROTECT_FROZEN_B(B); + } + saveregs(); + Yap_IPred(pe, 0); + /* IPred can generate errors, it thus must get rid of the lock itself */ + setregs(); + } + WRITE_UNLOCK(pe->PRWLock); d0 = pe->ArityOfPE; - /* save S for ModuleName */ + /* save S for ModuleName */ if (d0 == 0) { H[1] = MkAtomTerm((Atom)(pe->FunctorOfPred)); } else { diff --git a/C/index.c b/C/index.c index ce19d9c01..afcf551c2 100644 --- a/C/index.c +++ b/C/index.c @@ -11,8 +11,11 @@ * File: index.c * * comments: Indexing a Prolog predicate * * * -* Last rev: $Date: 2006-11-15 00:13:36 $,$Author: vsc $ * +* Last rev: $Date: 2006-11-21 16:21:31 $,$Author: vsc $ * * $Log: not supported by cvs2svn $ +* Revision 1.177 2006/11/15 00:13:36 vsc +* fixes for indexing code. +* * Revision 1.176 2006/11/08 01:53:08 vsc * avoid generating suspensions on static code. * @@ -8179,8 +8182,11 @@ Yap_FollowIndexingCode(PredEntry *ap, yamop *ipc, Term Terms[3], yamop *ap_pc, y break; #endif case _spy_pred: - ipc = ap->cs.p_code.TrueCodeOfPred; - break; + if ((ap->PredFlags & IndexedPredFlag) || + ap->cs.p_code.NOfClauses <= 1) { + ipc = ap->cs.p_code.TrueCodeOfPred; + break; + } case _index_pred: XREGS[ap->ArityOfPE+1] = (CELL)s_reg; XREGS[ap->ArityOfPE+2] = (CELL)t; diff --git a/C/iopreds.c b/C/iopreds.c index 11f553573..4c2f09e18 100644 --- a/C/iopreds.c +++ b/C/iopreds.c @@ -1791,7 +1791,7 @@ p_open (void) ta[1] = MkAtomTerm(AtomTrue); t = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("reposition"),1),1,ta); Yap_Error(PERMISSION_ERROR_OPEN_SOURCE_SINK,t,"open/4"); - return(FALSE); + return FALSE; } /* useless crap */ st->status |= Seekable_Stream_f; @@ -1802,14 +1802,14 @@ p_open (void) st->status &= ~Seekable_Stream_f; } if (opts & 16) { - st->status &= ~(Reset_Eof_Stream_f); - st->status |= Eof_Error_Stream_f; + st->status &= ~Reset_Eof_Stream_f; } if (opts & 32) { - st->status &= ~(Eof_Error_Stream_f|Reset_Eof_Stream_f); + st->status &= ~Reset_Eof_Stream_f; + st->status &= ~Eof_Error_Stream_f; } if (opts & 64) { - st->status &= ~(Eof_Error_Stream_f); + st->status &= ~Eof_Error_Stream_f; st->status |= Reset_Eof_Stream_f; } } @@ -1818,6 +1818,7 @@ p_open (void) else st->stream_getc_for_read = st->stream_getc; t = MkStream (sno); + st->status &= ~(Free_Stream_f); return (Yap_unify (ARG3, t)); } diff --git a/changes-5.1.html b/changes-5.1.html index be3caaf48..c3b12a17f 100644 --- a/changes-5.1.html +++ b/changes-5.1.html @@ -16,6 +16,9 @@

Yap-5.1.2: