fix lack of streams message (Ulrich Neumerkel #60)

This commit is contained in:
Costa Vitor 2009-05-22 19:55:18 -05:00
parent c00facdd17
commit 7304fbda13
8 changed files with 25 additions and 3 deletions

View File

@ -1337,6 +1337,20 @@ Yap_Error(yap_error_number type, Term where, char *format,...)
serious = TRUE;
}
break;
case RESOURCE_ERROR_MAX_STREAMS:
{
int i;
Term ti[1];
i = strlen(tmpbuf);
ti[0] = MkAtomTerm(AtomStreams);
nt[0] = Yap_MkApplTerm(FunctorResourceError, 1, ti);
tp = tmpbuf+i;
psize -= i;
fun = FunctorError;
serious = TRUE;
}
break;
case RESOURCE_ERROR_STACK:
{
int i;

View File

@ -2291,7 +2291,7 @@ p_open (void)
return (PlIOError (SYSTEM_ERROR,file_name,"file name is too long in open/3"));
sno = GetFreeStreamD();
if (sno < 0)
return (PlIOError (SYSTEM_ERROR,TermNil, "new stream not available for open/3"));
return (PlIOError (RESOURCE_ERROR_MAX_STREAMS,TermNil, "all streams in use"));
st = &Stream[sno];
/* can never happen */
tenc = Deref(ARG5);

View File

@ -479,6 +479,7 @@ typedef enum
REPRESENTATION_ERROR_CHARACTER_CODE,
REPRESENTATION_ERROR_MAX_ARITY,
RESOURCE_ERROR_HUGE_INT,
RESOURCE_ERROR_MAX_STREAMS,
RESOURCE_ERROR_MAX_THREADS,
RESOURCE_ERROR_MEMORY,
RESOURCE_ERROR_STACK,

View File

@ -243,6 +243,7 @@
AtomStaticClause = Yap_FullLookupAtom("$static_clause");
AtomStaticProcedure = Yap_LookupAtom("static_procedure");
AtomStream = Yap_FullLookupAtom("$stream");
AtomStreams = Yap_FullLookupAtom("streams");
AtomStreamOrAlias = Yap_LookupAtom("stream_or_alias");
AtomStreamPos = Yap_FullLookupAtom("$stream_position");
AtomStreamPosition = Yap_LookupAtom("stream_position");

View File

@ -245,6 +245,7 @@
AtomStaticClause = AtomAdjust(AtomStaticClause);
AtomStaticProcedure = AtomAdjust(AtomStaticProcedure);
AtomStream = AtomAdjust(AtomStream);
AtomStreams = AtomAdjust(AtomStreams);
AtomStreamOrAlias = AtomAdjust(AtomStreamOrAlias);
AtomStreamPos = AtomAdjust(AtomStreamPos);
AtomStreamPosition = AtomAdjust(AtomStreamPosition);

View File

@ -492,6 +492,8 @@
#define AtomStaticProcedure Yap_heap_regs->AtomStaticProcedure_
Atom AtomStream_;
#define AtomStream Yap_heap_regs->AtomStream_
Atom AtomStreams_;
#define AtomStreams Yap_heap_regs->AtomStreams_
Atom AtomStreamOrAlias_;
#define AtomStreamOrAlias Yap_heap_regs->AtomStreamOrAlias_
Atom AtomStreamPos_;

View File

@ -254,6 +254,7 @@ A StackFree N "stackfree"
A StaticClause F "$static_clause"
A StaticProcedure N "static_procedure"
A Stream F "$stream"
A Streams F "streams"
A StreamOrAlias N "stream_or_alias"
A StreamPos F "$stream_position"
A StreamPosition N "stream_position"

View File

@ -244,14 +244,16 @@ system_message(error(representation_error(character_code), Where)) -->
[ 'REPRESENTATION ERROR- ~w: expected character code' - [Where] ].
system_message(error(representation_error(max_arity), Where)) -->
[ 'REPRESENTATION ERROR- ~w: number too big' - [Where] ].
system_message(error(resource_error(code_space), Where)) -->
[ 'RESOURCE ERROR- not enough code space' - [Where] ].
system_message(error(resource_error(huge_int), Where)) -->
[ 'RESOURCE ERROR- too large an integer in absolute value' - [Where] ].
system_message(error(resource_error(memory), Where)) -->
[ 'RESOURCE ERROR- not enough virtual memory' - [Where] ].
system_message(error(resource_error(stack), Where)) -->
[ 'RESOURCE ERROR- not enough stack' - [Where] ].
system_message(error(resource_error(code_space), Where)) -->
[ 'RESOURCE ERROR- not enough code space' - [Where] ].
system_message(error(resource_error(streams), Where)) -->
[ 'RESOURCE ERROR- could not find a free stream' - [Where] ].
system_message(error(resource_error(threads), Where)) -->
[ 'RESOURCE ERROR- too many open threads' - [Where] ].
system_message(error(resource_error(trail), Where)) -->