more ATOM changes.

This commit is contained in:
Vitor Santos Costa 2010-02-26 10:59:43 +00:00
parent 34400afd8e
commit 038b74493c
6 changed files with 18 additions and 11 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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