SWI seems to use t=0 for user_input/output. Not very clear why...

This commit is contained in:
Vítor Santos Costa
2010-12-15 20:03:22 +00:00
parent d1665c7462
commit 4546a22101
4 changed files with 24 additions and 11 deletions

View File

@@ -3490,7 +3490,7 @@ CheckStream (Term arg, int kind, char *msg)
if (kind & SWI_Stream_f) {
struct io_stream *swi_stream;
if (Yap_get_stream_handle(arg, &swi_stream)) {
if (Yap_get_stream_handle(arg, kind & Input_Stream_f, kind & Output_Stream_f, &swi_stream)) {
sno = LookupSWIStream(swi_stream);
return sno;
}
@@ -3690,9 +3690,11 @@ Yap_CloseStreams (int loud)
} else {
free(Stream[sno].u.mem_string.buf);
}
} else if (!(Stream[sno].status & Null_Stream_f))
} else if (Stream[sno].status & (SWI_Stream_f)) {
SWIClose(Stream[sno].u.swi_stream.swi_ptr);
} else if (!(Stream[sno].status & Null_Stream_f)) {
YP_fclose (Stream[sno].u.file.file);
else {
} else {
if (loud)
fprintf (Yap_stderr, "%% YAP Error: while closing stream: %s\n", RepAtom (Stream[sno].u.file.name)->StrOfAE);
}