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
This commit is contained in:
vsc 2006-11-21 16:21:33 +00:00
parent d9029c6c56
commit 0a21ac1b71
5 changed files with 41 additions and 14 deletions

View File

@ -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 {

View File

@ -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;

View File

@ -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));
}

View File

@ -16,6 +16,9 @@
<h2>Yap-5.1.2:</h2>
<ul>
<li> FIXED: reconsult with spy was broken (obs from Miguel Filgueiras).</li>
<li> FIXED: mess with EOF and open (obs from Nicos Angelopoulos).</li>
<li> FIXED: make use_module/3 handle case where module is given.</li>
<li> FIXED: library_directory/1 was not being used.</li>
<li> FIXED: style_checker was failing on DCGs (obs from Miguel Filgueiras).</li>
<li> FIXED: +inf is a number (obs from Trevor Walker).</li>

View File

@ -857,17 +857,17 @@ stream_property(Stream, Props) :-
'$show_stream_eof'(_, not).
'$show_stream_eof_action'(Fl, error) :-
Fl /\ 16'0200 =:= 16'0200, !.
Fl /\ 0x0200 =:= 0x0200, !.
'$show_stream_eof_action'(Fl, reset) :-
Fl /\ 16'0400 =:= 16'0400, !.
Fl /\ 0x0400 =:= 0x0400, !.
'$show_stream_eof_action'(_, eof_code).
'$show_stream_reposition'(Fl, true) :-
Fl /\ 16'2000 =:= 16'2000, !.
Fl /\ 0x2000 =:= 0x2000, !.
'$show_stream_reposition'(_, false).
'$show_stream_type'(Fl, binary) :-
Fl /\ 16'0100 =:= 16'0100, !.
Fl /\ 0x0100 =:= 0x0100, !.
'$show_stream_type'(_, text).
at_end_of_stream :-