diff --git a/C/errors.c b/C/errors.c index e68597115..ce6e93e50 100644 --- a/C/errors.c +++ b/C/errors.c @@ -773,7 +773,7 @@ Yap_Error(yap_error_number type, Term where, char *format,...) Term ti[2]; i = strlen(tmpbuf); - ti[0] = MkAtomTerm(AtomStream); + ti[0] = MkAtomTerm(AtomVStream); ti[1] = where; nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti); tp = tmpbuf+i; @@ -893,7 +893,7 @@ Yap_Error(yap_error_number type, Term where, char *format,...) Term ti[2]; i = strlen(tmpbuf); - ti[0] = MkAtomTerm(AtomStream); + ti[0] = MkAtomTerm(AtomVStream); ti[1] = where; nt[0] = Yap_MkApplTerm(FunctorExistenceError, 2, ti); tp = tmpbuf+i; @@ -1172,7 +1172,7 @@ Yap_Error(yap_error_number type, Term where, char *format,...) i = strlen(tmpbuf); ti[0] = MkAtomTerm(AtomInput); - ti[1] = MkAtomTerm(AtomStream); + ti[1] = MkAtomTerm(AtomVStream); ti[2] = where; nt[0] = Yap_MkApplTerm(FunctorPermissionError, 3, ti); tp = tmpbuf+i; @@ -1268,7 +1268,7 @@ Yap_Error(yap_error_number type, Term where, char *format,...) i = strlen(tmpbuf); ti[0] = MkAtomTerm(AtomOutput); - ti[1] = MkAtomTerm(AtomStream); + ti[1] = MkAtomTerm(AtomVStream); ti[2] = where; nt[0] = Yap_MkApplTerm(FunctorPermissionError, 3, ti); tp = tmpbuf+i; @@ -1300,7 +1300,7 @@ Yap_Error(yap_error_number type, Term where, char *format,...) i = strlen(tmpbuf); ti[0] = MkAtomTerm(AtomReposition); - ti[1] = MkAtomTerm(AtomStream); + ti[1] = MkAtomTerm(AtomVStream); ti[2] = where; nt[0] = Yap_MkApplTerm(FunctorPermissionError, 3, ti); tp = tmpbuf+i; diff --git a/C/iopreds.c b/C/iopreds.c index f92739692..50f3fd33c 100755 --- a/C/iopreds.c +++ b/C/iopreds.c @@ -2365,12 +2365,12 @@ p_open (void) if (open_mode == AtomCsult) { if (!find_csult_file (Yap_FileNameBuf, Yap_FileNameBuf2, st, io_mode)) - return (PlIOError (EXISTENCE_ERROR_SOURCE_SINK, file_name, "open/3")); + return (PlIOError (EXISTENCE_ERROR_SOURCE_SINK, ARG1, "open/3")); strncpy (Yap_FileNameBuf, Yap_FileNameBuf2, YAP_FILENAME_MAX); } else { if (errno == ENOENT) - return (PlIOError(EXISTENCE_ERROR_SOURCE_SINK,file_name,"open/3")); + return (PlIOError(EXISTENCE_ERROR_SOURCE_SINK,ARG1,"open/3")); else return (PlIOError(PERMISSION_ERROR_OPEN_SOURCE_SINK,file_name,"open/3")); } @@ -3369,8 +3369,10 @@ p_close (void) Int sno = CheckStream (ARG1, (Input_Stream_f | Output_Stream_f | Socket_Stream_f), "close/2"); if (sno < 0) return (FALSE); - if (sno <= StdErrStream) - return (TRUE); + if (sno <= StdErrStream) { + UNLOCK(Stream[sno].streamlock); + return TRUE; + } CloseStream(sno); UNLOCK(Stream[sno].streamlock); return (TRUE); diff --git a/H/iatoms.h b/H/iatoms.h index fbe353e40..1e3c929c8 100644 --- a/H/iatoms.h +++ b/H/iatoms.h @@ -255,7 +255,8 @@ AtomStaticClause = Yap_FullLookupAtom("$static_clause"); AtomStaticProcedure = Yap_LookupAtom("static_procedure"); AtomStream = Yap_FullLookupAtom("$stream"); - AtomStreams = Yap_FullLookupAtom("streams"); + AtomVStream = Yap_LookupAtom("stream"); + AtomStreams = Yap_LookupAtom("streams"); AtomStreamOrAlias = Yap_LookupAtom("stream_or_alias"); AtomStreamPos = Yap_FullLookupAtom("$stream_position"); AtomStreamPosition = Yap_LookupAtom("stream_position"); diff --git a/H/ratoms.h b/H/ratoms.h index 559de2392..8e58386aa 100644 --- a/H/ratoms.h +++ b/H/ratoms.h @@ -255,6 +255,7 @@ AtomStaticClause = AtomAdjust(AtomStaticClause); AtomStaticProcedure = AtomAdjust(AtomStaticProcedure); AtomStream = AtomAdjust(AtomStream); + AtomVStream = AtomAdjust(AtomVStream); AtomStreams = AtomAdjust(AtomStreams); AtomStreamOrAlias = AtomAdjust(AtomStreamOrAlias); AtomStreamPos = AtomAdjust(AtomStreamPos); diff --git a/H/tatoms.h b/H/tatoms.h index 06768078d..72f1b9ffe 100644 --- a/H/tatoms.h +++ b/H/tatoms.h @@ -512,6 +512,8 @@ #define AtomStaticProcedure Yap_heap_regs->AtomStaticProcedure_ Atom AtomStream_; #define AtomStream Yap_heap_regs->AtomStream_ + Atom AtomVStream_; +#define AtomVStream Yap_heap_regs->AtomVStream_ Atom AtomStreams_; #define AtomStreams Yap_heap_regs->AtomStreams_ Atom AtomStreamOrAlias_; diff --git a/misc/ATOMS b/misc/ATOMS index 568b24263..a9ab86879 100644 --- a/misc/ATOMS +++ b/misc/ATOMS @@ -264,7 +264,8 @@ A StackFree N "stackfree" A StaticClause F "$static_clause" A StaticProcedure N "static_procedure" A Stream F "$stream" -A Streams F "streams" +A VStream N "stream" +A Streams N "streams" A StreamOrAlias N "stream_or_alias" A StreamPos F "$stream_position" A StreamPosition N "stream_position"