2001-04-09 20:54:03 +01:00
|
|
|
/*************************************************************************
|
|
|
|
* *
|
|
|
|
* Yap Prolog *
|
|
|
|
* *
|
|
|
|
* Yap Prolog Was Developed At Nccup - Universidade Do Porto *
|
|
|
|
* *
|
|
|
|
* Copyright L.Damas, V.S.Costa And Universidade Do Porto 1985-1997 *
|
|
|
|
* *
|
|
|
|
**************************************************************************
|
|
|
|
* *
|
|
|
|
* File: errors.c *
|
|
|
|
* Last Rev: *
|
|
|
|
* Mods: *
|
|
|
|
* Comments: Yap'S error handlers *
|
|
|
|
* *
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#include "absmi.h"
|
|
|
|
#include "yapio.h"
|
|
|
|
#if HAVE_STDARG_H
|
|
|
|
#include <stdarg.h>
|
|
|
|
#endif
|
|
|
|
#include <stdlib.h>
|
|
|
|
#if HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
#if HAVE_STRING_H
|
|
|
|
#include <string.h>
|
|
|
|
#endif
|
|
|
|
#include "Foreign.h"
|
|
|
|
|
2014-09-16 10:00:31 +01:00
|
|
|
#if DEBUG
|
|
|
|
void
|
|
|
|
Yap_PrintPredName( PredEntry *ap )
|
|
|
|
{
|
|
|
|
CACHE_REGS
|
|
|
|
Term tmod = ap->ModuleOfPred;
|
|
|
|
if (!tmod) tmod = TermProlog;
|
|
|
|
#if THREADS
|
|
|
|
Yap_DebugPlWrite(MkIntegerTerm(worker_id));
|
|
|
|
Yap_DebugPutc(LOCAL_c_error_stream,' ');
|
|
|
|
#endif
|
|
|
|
Yap_DebugPutc(LOCAL_c_error_stream,'>');
|
|
|
|
Yap_DebugPutc(LOCAL_c_error_stream,'\t');
|
|
|
|
Yap_DebugPlWrite(tmod);
|
|
|
|
Yap_DebugPutc(LOCAL_c_error_stream,':');
|
|
|
|
if (ap->ModuleOfPred == IDB_MODULE) {
|
|
|
|
Term t = Deref(ARG1);
|
|
|
|
if (IsAtomTerm(t)) {
|
|
|
|
Yap_DebugPlWrite(t);
|
|
|
|
} else if (IsIntegerTerm(t)) {
|
|
|
|
Yap_DebugPlWrite(t);
|
|
|
|
} else {
|
|
|
|
Functor f = FunctorOfTerm(t);
|
|
|
|
Atom At = NameOfFunctor(f);
|
|
|
|
Yap_DebugPlWrite(MkAtomTerm(At));
|
|
|
|
Yap_DebugPutc(LOCAL_c_error_stream,'/');
|
|
|
|
Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (ap->ArityOfPE == 0) {
|
|
|
|
Atom At = (Atom)ap->FunctorOfPred;
|
|
|
|
Yap_DebugPlWrite(MkAtomTerm(At));
|
|
|
|
} else {
|
|
|
|
Functor f = ap->FunctorOfPred;
|
|
|
|
Atom At = NameOfFunctor(f);
|
|
|
|
Yap_DebugPlWrite(MkAtomTerm(At));
|
|
|
|
Yap_DebugPutc(LOCAL_c_error_stream,'/');
|
|
|
|
Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Yap_DebugPutc(LOCAL_c_error_stream,'\n');
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-12-02 14:49:41 +00:00
|
|
|
int Yap_HandleError( const char *s, ... ) {
|
|
|
|
CACHE_REGS
|
|
|
|
yap_error_number err = LOCAL_Error_TYPE;
|
2015-01-26 04:02:46 +00:00
|
|
|
const char *serr;
|
2013-12-02 14:49:41 +00:00
|
|
|
|
|
|
|
LOCAL_Error_TYPE = YAP_NO_ERROR;
|
|
|
|
if (LOCAL_ErrorMessage) {
|
|
|
|
serr = LOCAL_ErrorMessage;
|
|
|
|
} else {
|
2015-01-26 04:02:46 +00:00
|
|
|
serr = s;
|
2013-12-02 14:49:41 +00:00
|
|
|
}
|
|
|
|
switch (err) {
|
|
|
|
case OUT_OF_STACK_ERROR:
|
|
|
|
if (!Yap_gc(2, ENV, gc_P(P,CP))) {
|
|
|
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, serr);
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
case OUT_OF_AUXSPACE_ERROR:
|
|
|
|
if (LOCAL_MAX_SIZE < (char *)AuxSp-AuxBase) {
|
|
|
|
LOCAL_MAX_SIZE += 1024;
|
|
|
|
}
|
|
|
|
if (!Yap_ExpandPreAllocCodeSpace(0,NULL, TRUE)) {
|
|
|
|
/* crash in flames */
|
|
|
|
Yap_Error(OUT_OF_AUXSPACE_ERROR, ARG1, serr);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
case OUT_OF_HEAP_ERROR:
|
|
|
|
if (!Yap_growheap(FALSE, 0, NULL)) {
|
|
|
|
Yap_Error(OUT_OF_HEAP_ERROR, ARG2, serr);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
Yap_Error(err, LOCAL_Error_Term, serr);
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int Yap_SWIHandleError( const char *s, ... )
|
|
|
|
{
|
|
|
|
CACHE_REGS
|
|
|
|
yap_error_number err = LOCAL_Error_TYPE;
|
|
|
|
char *serr;
|
|
|
|
|
|
|
|
LOCAL_Error_TYPE = YAP_NO_ERROR;
|
|
|
|
if (LOCAL_ErrorMessage) {
|
|
|
|
serr = LOCAL_ErrorMessage;
|
|
|
|
} else {
|
|
|
|
serr = (char *)s;
|
|
|
|
}
|
|
|
|
switch (err) {
|
|
|
|
case OUT_OF_STACK_ERROR:
|
|
|
|
if (!Yap_gc(2, ENV, gc_P(P,CP))) {
|
|
|
|
Yap_Error(OUT_OF_STACK_ERROR, TermNil, serr);
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
case OUT_OF_AUXSPACE_ERROR:
|
|
|
|
if (LOCAL_MAX_SIZE < (char *)AuxSp-AuxBase) {
|
|
|
|
LOCAL_MAX_SIZE += 1024;
|
|
|
|
}
|
|
|
|
if (!Yap_ExpandPreAllocCodeSpace(0,NULL, TRUE)) {
|
|
|
|
/* crash in flames */
|
|
|
|
Yap_Error(OUT_OF_AUXSPACE_ERROR, ARG1, serr);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
case OUT_OF_HEAP_ERROR:
|
|
|
|
if (!Yap_growheap(FALSE, 0, NULL)) {
|
|
|
|
Yap_Error(OUT_OF_HEAP_ERROR, ARG2, serr);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
Yap_Error(err, LOCAL_Error_Term, serr);
|
|
|
|
return(FALSE);
|
|
|
|
}
|
|
|
|
}
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2012-02-05 12:04:29 +00:00
|
|
|
void
|
|
|
|
Yap_RestartYap ( int flag )
|
|
|
|
{
|
2012-02-07 15:18:43 +00:00
|
|
|
CACHE_REGS
|
2012-02-05 12:04:29 +00:00
|
|
|
#if PUSH_REGS
|
|
|
|
restore_absmi_regs(&Yap_standard_regs);
|
|
|
|
#endif
|
|
|
|
siglongjmp(LOCAL_RestartEnv,1);
|
|
|
|
}
|
|
|
|
|
2013-10-14 08:04:24 +01:00
|
|
|
void DumpActiveGoals( CACHE_TYPE1 );
|
2013-04-25 23:15:04 +01:00
|
|
|
static int hidden(Atom);
|
|
|
|
static int legal_env(CELL * CACHE_TYPE);
|
|
|
|
static void detect_bug_location(yamop *,find_pred_type,char *, int);
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2002-11-18 18:18:05 +00:00
|
|
|
#define ONHEAP(ptr) (CellPtr(ptr) >= CellPtr(Yap_HeapBase) && CellPtr(ptr) < CellPtr(HeapTop))
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2014-01-19 21:15:05 +00:00
|
|
|
#define ONLOCAL(ptr) (CellPtr(ptr) > CellPtr(HR) && CellPtr(ptr) < CellPtr(LOCAL_LocalBase))
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
static int
|
|
|
|
hidden (Atom at)
|
|
|
|
{
|
|
|
|
AtomEntry *chain;
|
|
|
|
|
|
|
|
READ_LOCK(INVISIBLECHAIN.AERWLock);
|
|
|
|
chain = RepAtom(INVISIBLECHAIN.Entry);
|
|
|
|
while (!EndOfPAEntr (chain) && AbsAtom (chain) != at)
|
|
|
|
chain = RepAtom(chain->NextOfAE);
|
|
|
|
READ_UNLOCK(INVISIBLECHAIN.AERWLock);
|
|
|
|
if (EndOfPAEntr (chain))
|
|
|
|
return (FALSE);
|
|
|
|
return (TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2011-03-07 16:02:55 +00:00
|
|
|
legal_env (CELL *ep USES_REGS)
|
2001-04-09 20:54:03 +01:00
|
|
|
{
|
|
|
|
CELL cp, ps;
|
|
|
|
PredEntry *pe;
|
|
|
|
if (!ONLOCAL (ep) || Unsigned (ep) & 3)
|
|
|
|
return (FALSE);
|
|
|
|
cp = ep[E_CP];
|
|
|
|
if (!ONHEAP (cp))
|
|
|
|
return (FALSE);
|
|
|
|
ps = *((CELL *) (Addr (cp) - CellSize));
|
|
|
|
pe = (PredEntry *) (ps - sizeof (OPREG) - sizeof (Prop));
|
2010-07-25 11:22:16 +01:00
|
|
|
PELOCK(70,pe);
|
2001-04-09 20:54:03 +01:00
|
|
|
if (!ONHEAP (pe) || Unsigned (pe) & 3 || pe->KindOfPE & 0xff00) {
|
2007-11-26 23:43:10 +00:00
|
|
|
UNLOCK(pe->PELock);
|
2001-04-09 20:54:03 +01:00
|
|
|
return (FALSE);
|
|
|
|
}
|
2007-11-26 23:43:10 +00:00
|
|
|
UNLOCK(pe->PELock);
|
2001-04-09 20:54:03 +01:00
|
|
|
return (TRUE);
|
|
|
|
}
|
|
|
|
|
2013-10-14 08:04:24 +01:00
|
|
|
static int
|
|
|
|
YapPutc(int sno, wchar_t ch)
|
|
|
|
{
|
2014-03-06 02:09:48 +00:00
|
|
|
return (putc(ch, stderr));
|
2013-10-14 08:04:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
YapPlWrite(Term t)
|
|
|
|
{
|
|
|
|
Yap_plwrite(t, NULL, 15, 0, 1200);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
void
|
2011-03-07 16:02:55 +00:00
|
|
|
DumpActiveGoals ( USES_REGS1 )
|
2001-04-09 20:54:03 +01:00
|
|
|
{
|
|
|
|
/* try to dump active goals */
|
|
|
|
CELL *ep = YENV; /* and current environment */
|
|
|
|
choiceptr b_ptr = B;
|
|
|
|
CELL cp;
|
|
|
|
PredEntry *pe;
|
|
|
|
int first = 1;
|
2005-02-08 18:05:21 +00:00
|
|
|
|
2011-03-07 16:02:55 +00:00
|
|
|
if (legal_env (YENV PASS_REGS) && YENV < ENV)
|
2001-04-09 20:54:03 +01:00
|
|
|
ep = YENV;
|
2011-03-07 16:02:55 +00:00
|
|
|
else if (legal_env (ENV PASS_REGS))
|
2001-04-09 20:54:03 +01:00
|
|
|
ep = ENV;
|
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
if (!ONLOCAL (ep) || (Unsigned (ep) & (sizeof(CELL)-1)))
|
|
|
|
break;
|
|
|
|
cp = ep[E_CP];
|
|
|
|
if (!ONHEAP (cp) || (Unsigned (cp) & (sizeof(CELL)-1)))
|
|
|
|
break;
|
2008-09-18 17:48:31 +01:00
|
|
|
pe = EnvPreg((yamop *)cp);
|
2001-04-09 20:54:03 +01:00
|
|
|
if (!ONHEAP (pe) || Unsigned (pe) & (sizeof(CELL)-1))
|
|
|
|
break;
|
2010-07-25 11:22:16 +01:00
|
|
|
PELOCK(71,pe);
|
2001-04-09 20:54:03 +01:00
|
|
|
if (pe->KindOfPE & 0xff00) {
|
2007-11-26 23:43:10 +00:00
|
|
|
UNLOCK(pe->PELock);
|
2001-04-09 20:54:03 +01:00
|
|
|
break;
|
|
|
|
}
|
2004-12-05 05:01:45 +00:00
|
|
|
if (pe->PredFlags & (CompiledPredFlag | DynamicPredFlag))
|
2001-04-09 20:54:03 +01:00
|
|
|
{
|
|
|
|
Functor f;
|
2004-02-12 12:37:12 +00:00
|
|
|
Term mod = TermProlog;
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2007-11-26 23:43:10 +00:00
|
|
|
UNLOCK(pe->PELock);
|
2001-04-09 20:54:03 +01:00
|
|
|
f = pe->FunctorOfPred;
|
|
|
|
if (pe->KindOfPE && hidden (NameOfFunctor (f)))
|
|
|
|
goto next;
|
|
|
|
if (first++ == 1)
|
2002-05-28 18:12:58 +01:00
|
|
|
fprintf(stderr,"Active ancestors:\n");
|
2004-02-12 12:37:12 +00:00
|
|
|
if (pe->ModuleOfPred) mod = pe->ModuleOfPred;
|
2013-10-14 08:04:24 +01:00
|
|
|
YapPlWrite (mod);
|
|
|
|
YapPutc (LOCAL_c_error_stream,':');
|
2001-04-09 20:54:03 +01:00
|
|
|
if (pe->ArityOfPE == 0) {
|
2013-10-14 08:04:24 +01:00
|
|
|
YapPlWrite (MkAtomTerm ((Atom)f));
|
2001-04-09 20:54:03 +01:00
|
|
|
} else {
|
2013-10-14 08:04:24 +01:00
|
|
|
YapPlWrite (MkAtomTerm (NameOfFunctor (f)));
|
|
|
|
YapPutc (LOCAL_c_error_stream,'/');
|
|
|
|
YapPlWrite (MkIntTerm (ArityOfFunctor (f)));
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
2013-10-14 08:04:24 +01:00
|
|
|
YapPutc (LOCAL_c_error_stream,'\n');
|
2004-02-22 00:35:07 +00:00
|
|
|
} else {
|
2007-11-26 23:43:10 +00:00
|
|
|
UNLOCK(pe->PELock);
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
next:
|
|
|
|
ep = (CELL *) ep[E_E];
|
|
|
|
}
|
|
|
|
first = 1;
|
2002-05-28 18:12:58 +01:00
|
|
|
fprintf(stderr,"Active Choice-Points:\n");
|
2001-04-09 20:54:03 +01:00
|
|
|
while (TRUE)
|
|
|
|
{
|
|
|
|
PredEntry *pe;
|
|
|
|
|
|
|
|
if (!ONLOCAL (b_ptr) || b_ptr->cp_b == NULL)
|
|
|
|
break;
|
2004-09-27 21:45:04 +01:00
|
|
|
pe = Yap_PredForChoicePt(b_ptr);
|
2014-08-04 15:47:03 +01:00
|
|
|
if (!pe)
|
|
|
|
break;
|
2001-04-09 20:54:03 +01:00
|
|
|
{
|
|
|
|
Functor f;
|
2004-02-12 12:37:12 +00:00
|
|
|
Term mod = PROLOG_MODULE;
|
2001-04-09 20:54:03 +01:00
|
|
|
|
|
|
|
f = pe->FunctorOfPred;
|
2004-02-12 12:37:12 +00:00
|
|
|
if (pe->ModuleOfPred)
|
|
|
|
mod = pe->ModuleOfPred;
|
|
|
|
else mod = TermProlog;
|
2014-08-04 15:47:03 +01:00
|
|
|
if (mod != TermProlog &&
|
|
|
|
mod != MkAtomTerm(AtomUser) ) {
|
|
|
|
YapPlWrite (mod);
|
|
|
|
YapPutc (LOCAL_c_error_stream,':');
|
|
|
|
}
|
2001-04-09 20:54:03 +01:00
|
|
|
if (pe->ArityOfPE == 0) {
|
2014-08-04 15:47:03 +01:00
|
|
|
YapPlWrite (MkAtomTerm ((Atom)f));
|
2001-04-09 20:54:03 +01:00
|
|
|
} else {
|
|
|
|
Int i = 0, arity = pe->ArityOfPE;
|
|
|
|
Term *args = &(b_ptr->cp_a1);
|
2013-10-14 08:04:24 +01:00
|
|
|
YapPlWrite (MkAtomTerm (NameOfFunctor (f)));
|
|
|
|
YapPutc (LOCAL_c_error_stream,'(');
|
2001-04-09 20:54:03 +01:00
|
|
|
for (i= 0; i < arity; i++) {
|
2013-10-14 08:04:24 +01:00
|
|
|
if (i > 0) YapPutc (LOCAL_c_error_stream,',');
|
|
|
|
YapPlWrite(args[i]);
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
2013-10-14 08:04:24 +01:00
|
|
|
YapPutc (LOCAL_c_error_stream,')');
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
2013-10-14 08:04:24 +01:00
|
|
|
YapPutc (LOCAL_c_error_stream,'\n');
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
b_ptr = b_ptr->cp_b;
|
|
|
|
}
|
|
|
|
}
|
2013-10-14 08:04:24 +01:00
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2002-01-30 02:20:44 +00:00
|
|
|
static void
|
2004-10-26 21:16:18 +01:00
|
|
|
detect_bug_location(yamop *yap_pc, find_pred_type where_from, char *tp, int psize)
|
2001-04-09 20:54:03 +01:00
|
|
|
{
|
|
|
|
Atom pred_name;
|
2002-12-06 20:03:26 +00:00
|
|
|
UInt pred_arity;
|
2004-02-12 12:37:12 +00:00
|
|
|
Term pred_module;
|
2001-04-09 20:54:03 +01:00
|
|
|
Int cl;
|
|
|
|
|
2005-02-08 18:05:21 +00:00
|
|
|
tp[0] = '\0';
|
2004-10-26 21:16:18 +01:00
|
|
|
if ((cl = Yap_PredForCode(yap_pc, where_from, &pred_name, &pred_arity, &pred_module))
|
2001-04-09 20:54:03 +01:00
|
|
|
== 0) {
|
|
|
|
/* system predicate */
|
|
|
|
#if HAVE_SNPRINTF
|
|
|
|
snprintf(tp, psize, "%s",
|
|
|
|
"meta-call");
|
|
|
|
#else
|
|
|
|
sprintf(tp, "%s",
|
|
|
|
"meta-call");
|
|
|
|
#endif
|
|
|
|
} else if (pred_module == 0) {
|
|
|
|
/* don't give info on system predicates */
|
|
|
|
#if HAVE_SNPRINTF
|
2009-05-17 17:42:56 +01:00
|
|
|
snprintf(tp, psize, "prolog:%s/%lu",
|
|
|
|
RepAtom(pred_name)->StrOfAE, (unsigned long int)pred_arity);
|
2001-04-09 20:54:03 +01:00
|
|
|
#else
|
2009-05-17 17:42:56 +01:00
|
|
|
sprintf(tp, "in prolog:%s/%lu",
|
|
|
|
RepAtom(pred_name)->StrOfAE, (unsigned long int)pred_arity);
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif
|
|
|
|
} else if (cl < 0) {
|
|
|
|
#if HAVE_SNPRINTF
|
2009-05-17 17:42:56 +01:00
|
|
|
snprintf(tp, psize, "%s:%s/%lu",
|
2004-02-12 12:37:12 +00:00
|
|
|
RepAtom(AtomOfTerm(pred_module))->StrOfAE,
|
2009-05-17 17:42:56 +01:00
|
|
|
RepAtom(pred_name)->StrOfAE, (unsigned long int)pred_arity);
|
2001-04-09 20:54:03 +01:00
|
|
|
#else
|
2009-05-17 17:42:56 +01:00
|
|
|
sprintf(tp, "%s:%s/%lu",
|
2004-02-12 12:37:12 +00:00
|
|
|
RepAtom(AtomOfTerm(pred_module))->StrOfAE,
|
2009-05-17 17:42:56 +01:00
|
|
|
RepAtom(pred_name)->StrOfAE, (unsigned long int)pred_arity);
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif
|
|
|
|
} else {
|
|
|
|
#if HAVE_SNPRINTF
|
2009-05-17 17:42:56 +01:00
|
|
|
snprintf(tp, psize, "%s:%s/%lu at clause %lu ",
|
2004-02-12 12:37:12 +00:00
|
|
|
RepAtom(AtomOfTerm(pred_module))->StrOfAE,
|
2009-05-17 17:42:56 +01:00
|
|
|
RepAtom(pred_name)->StrOfAE, (unsigned long int)pred_arity, (unsigned long int)cl);
|
2001-04-09 20:54:03 +01:00
|
|
|
#else
|
2009-05-17 17:42:56 +01:00
|
|
|
sprintf(tp, "%s:%s/%lu at clause %lu",
|
2004-02-12 12:37:12 +00:00
|
|
|
RepAtom(AtomOfTerm(pred_module))->StrOfAE,
|
2009-05-17 17:42:56 +01:00
|
|
|
RepAtom(pred_name)->StrOfAE, (unsigned long int)pred_arity, (unsigned long int)cl);
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-12 20:04:32 +01:00
|
|
|
static int
|
2011-03-07 16:02:55 +00:00
|
|
|
handled_exception( USES_REGS1 )
|
2009-06-12 20:04:32 +01:00
|
|
|
{
|
|
|
|
yamop *pos = NEXTOP(PredDollarCatch->cs.p_code.TrueCodeOfPred,l);
|
|
|
|
int found_handler = FALSE;
|
|
|
|
choiceptr gc_b;
|
|
|
|
|
|
|
|
gc_b = B;
|
|
|
|
while (gc_b) {
|
|
|
|
yamop *ap = gc_b->cp_ap;
|
|
|
|
if (ap == NOCODE) {
|
|
|
|
/* C-code: let they deal with that */
|
|
|
|
return FALSE;
|
|
|
|
} else if (ap == pos) {
|
|
|
|
if (found_handler)
|
|
|
|
return TRUE; /* we have two handlers */
|
|
|
|
found_handler = TRUE;
|
|
|
|
}
|
|
|
|
gc_b = gc_b->cp_b;
|
|
|
|
}
|
|
|
|
/* handled by Top c-code? */
|
|
|
|
return !found_handler;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-10-14 17:25:38 +01:00
|
|
|
static void
|
2014-09-02 20:19:23 +01:00
|
|
|
dump_stack( void )
|
2002-09-09 20:52:38 +01:00
|
|
|
{
|
2014-09-02 20:19:23 +01:00
|
|
|
CACHE_REGS
|
2002-09-09 20:52:38 +01:00
|
|
|
choiceptr b_ptr = B;
|
|
|
|
CELL *env_ptr = ENV;
|
2005-02-08 18:05:21 +00:00
|
|
|
char tp[256];
|
|
|
|
yamop *ipc = CP;
|
2009-05-23 21:51:00 +01:00
|
|
|
int max_count = 200;
|
2002-09-09 20:52:38 +01:00
|
|
|
|
2009-06-12 20:04:32 +01:00
|
|
|
/* check if handled */
|
2011-03-07 16:02:55 +00:00
|
|
|
if (handled_exception( PASS_REGS1 ))
|
2009-06-12 20:04:32 +01:00
|
|
|
return;
|
2005-02-24 21:46:40 +00:00
|
|
|
#if DEBUG
|
2014-01-19 21:15:05 +00:00
|
|
|
fprintf(stderr,"%% YAP regs: P=%p, CP=%p, ASP=%p, H=%p, TR=%p, HeapTop=%p\n",P,CP,ASP,HR,TR,HeapTop);
|
2011-05-25 16:40:36 +01:00
|
|
|
fprintf(stderr,"%% YAP mode: %ux\n",(unsigned int)LOCAL_PrologMode);
|
2011-05-23 16:19:47 +01:00
|
|
|
if (LOCAL_ErrorMessage)
|
|
|
|
fprintf(stderr,"%% LOCAL_ErrorMessage: %s\n",LOCAL_ErrorMessage);
|
2005-02-24 21:46:40 +00:00
|
|
|
#endif
|
2014-01-19 21:15:05 +00:00
|
|
|
if (HR > ASP || HR > LCL0) {
|
|
|
|
fprintf(stderr,"%% YAP ERROR: Global Collided against Local (%p--%p)\n",HR,ASP);
|
2011-05-23 16:19:47 +01:00
|
|
|
} else if (HeapTop > (ADDR)LOCAL_GlobalBase) {
|
|
|
|
fprintf(stderr,"%% YAP ERROR: Code Space Collided against Global (%p--%p)\n", HeapTop, LOCAL_GlobalBase);
|
2002-09-09 20:52:38 +01:00
|
|
|
} else {
|
2005-02-08 18:05:21 +00:00
|
|
|
#if !USE_SYSTEM_MALLOC
|
2005-02-21 16:50:21 +00:00
|
|
|
fprintf (stderr,"%ldKB of Code Space (%p--%p)\n",(long int)((CELL)HeapTop-(CELL)Yap_HeapBase)/1024,Yap_HeapBase,HeapTop);
|
2005-02-08 18:05:21 +00:00
|
|
|
#if USE_DL_MALLOC
|
2006-05-16 19:37:31 +01:00
|
|
|
if (Yap_NOfMemoryHoles) {
|
|
|
|
UInt i;
|
|
|
|
|
|
|
|
for (i=0; i < Yap_NOfMemoryHoles; i++)
|
|
|
|
fprintf(stderr," Current hole: %p--%p\n",
|
|
|
|
Yap_MemoryHoles[i].start,
|
|
|
|
Yap_MemoryHoles[i].end);
|
2005-02-08 18:05:21 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
2014-01-19 21:15:05 +00:00
|
|
|
detect_bug_location(P, FIND_PRED_FROM_ANYWHERE, (char *)HR, 256);
|
|
|
|
fprintf (stderr,"%%\n%% PC: %s\n",(char *)HR);
|
|
|
|
detect_bug_location(CP, FIND_PRED_FROM_ANYWHERE, (char *)HR, 256);
|
|
|
|
fprintf (stderr,"%% Continuation: %s\n",(char *)HR);
|
|
|
|
fprintf (stderr,"%% %luKB of Global Stack (%p--%p)\n",(unsigned long int)(sizeof(CELL)*(HR-H0))/1024,H0,HR);
|
2010-03-22 15:01:54 +00:00
|
|
|
fprintf (stderr,"%% %luKB of Local Stack (%p--%p)\n",(unsigned long int)(sizeof(CELL)*(LCL0-ASP))/1024,ASP,LCL0);
|
2011-05-23 16:19:47 +01:00
|
|
|
fprintf (stderr,"%% %luKB of Trail (%p--%p)\n",(unsigned long int)((ADDR)TR-LOCAL_TrailBase)/1024,LOCAL_TrailBase,TR);
|
2011-05-04 10:11:41 +01:00
|
|
|
fprintf (stderr,"%% Performed %ld garbage collections\n", (unsigned long int)LOCAL_GcCalls);
|
2005-02-08 18:05:21 +00:00
|
|
|
#if LOW_LEVEL_TRACER
|
|
|
|
{
|
|
|
|
extern long long vsc_count;
|
|
|
|
|
|
|
|
if (vsc_count) {
|
2011-03-08 00:03:50 +00:00
|
|
|
#if _WIN32
|
|
|
|
fprintf(stderr,"Trace Counter at %I64d\n",vsc_count);
|
|
|
|
#else
|
2005-02-08 18:05:21 +00:00
|
|
|
fprintf(stderr,"Trace Counter at %lld\n",vsc_count);
|
2011-03-08 00:03:50 +00:00
|
|
|
#endif
|
2002-10-30 17:27:19 +00:00
|
|
|
}
|
2002-09-09 20:52:38 +01:00
|
|
|
}
|
2005-02-08 18:05:21 +00:00
|
|
|
#endif
|
2009-05-17 17:42:56 +01:00
|
|
|
fprintf (stderr,"%% All Active Calls and\n");
|
|
|
|
fprintf (stderr,"%% Goals With Alternatives Open (Global In Use--Local In Use)\n%%\n");
|
2005-02-08 18:05:21 +00:00
|
|
|
while (b_ptr != NULL) {
|
|
|
|
while (env_ptr && env_ptr <= (CELL *)b_ptr) {
|
|
|
|
detect_bug_location(ipc, FIND_PRED_FROM_ENV, tp, 256);
|
|
|
|
if (env_ptr == (CELL *)b_ptr &&
|
|
|
|
(choiceptr)env_ptr[E_CB] > b_ptr) {
|
|
|
|
b_ptr = b_ptr->cp_b;
|
2009-05-17 17:42:56 +01:00
|
|
|
fprintf(stderr,"%% %s\n", tp);
|
2005-02-08 18:05:21 +00:00
|
|
|
} else {
|
2009-05-17 17:42:56 +01:00
|
|
|
fprintf(stderr,"%% %s\n", tp);
|
2005-02-08 18:05:21 +00:00
|
|
|
}
|
2009-05-23 21:51:00 +01:00
|
|
|
if (!max_count--) {
|
|
|
|
fprintf(stderr,"%% .....\n");
|
|
|
|
return;
|
|
|
|
}
|
2005-02-08 18:05:21 +00:00
|
|
|
ipc = (yamop *)(env_ptr[E_CP]);
|
|
|
|
env_ptr = (CELL *)(env_ptr[E_E]);
|
|
|
|
}
|
|
|
|
if (b_ptr) {
|
2009-05-23 21:51:00 +01:00
|
|
|
if (!max_count--) {
|
|
|
|
fprintf(stderr,"%% .....\n");
|
|
|
|
return;
|
|
|
|
}
|
2009-05-01 18:09:22 +01:00
|
|
|
if (b_ptr->cp_ap && /* tabling */
|
|
|
|
b_ptr->cp_ap->opc != Yap_opcode(_or_else) &&
|
2005-02-08 18:05:21 +00:00
|
|
|
b_ptr->cp_ap->opc != Yap_opcode(_or_last) &&
|
|
|
|
b_ptr->cp_ap->opc != Yap_opcode(_Nstop)) {
|
|
|
|
/* we can safely ignore ; because there is always an upper env */
|
|
|
|
detect_bug_location(b_ptr->cp_ap, FIND_PRED_FROM_CP, tp, 256);
|
2009-05-17 17:42:56 +01:00
|
|
|
fprintf(stderr,"%% %s (%luKB--%luKB)\n", tp,
|
|
|
|
(unsigned long int)((b_ptr->cp_h-H0)*sizeof(CELL)/1024),
|
|
|
|
(unsigned long int)((ADDR)LCL0-(ADDR)b_ptr)/1024);
|
2005-02-08 18:05:21 +00:00
|
|
|
}
|
|
|
|
b_ptr = b_ptr->cp_b;
|
2002-10-30 17:27:19 +00:00
|
|
|
}
|
2002-09-09 20:52:38 +01:00
|
|
|
}
|
|
|
|
}
|
2002-10-10 06:58:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
error_exit_yap (int value)
|
|
|
|
{
|
2011-03-07 16:02:55 +00:00
|
|
|
CACHE_REGS
|
2011-05-25 16:40:36 +01:00
|
|
|
if (!(LOCAL_PrologMode & BootMode)) {
|
2014-09-02 20:19:23 +01:00
|
|
|
dump_stack( );
|
2005-02-08 04:05:39 +00:00
|
|
|
#if DEBUG
|
|
|
|
#endif
|
|
|
|
}
|
2005-02-08 18:05:21 +00:00
|
|
|
fprintf(stderr, "\n Exiting ....\n");
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_exit(value);
|
2002-09-09 20:52:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-02-26 15:51:54 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
|
2004-10-26 21:16:18 +01:00
|
|
|
void
|
|
|
|
Yap_bug_location(yamop *pc)
|
2002-02-26 15:51:54 +00:00
|
|
|
{
|
2011-03-07 16:02:55 +00:00
|
|
|
CACHE_REGS
|
2014-01-19 21:15:05 +00:00
|
|
|
detect_bug_location(pc, FIND_PRED_FROM_ANYWHERE, (char *)HR, 256);
|
|
|
|
fprintf(stderr,"%s\n",(char *)HR);
|
2014-09-02 20:19:23 +01:00
|
|
|
dump_stack( );
|
2002-02-26 15:51:54 +00:00
|
|
|
}
|
2004-10-26 21:16:18 +01:00
|
|
|
|
2002-02-26 15:51:54 +00:00
|
|
|
#endif
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
/* This needs to be a static because I can't trust the stack (WIN32), and
|
|
|
|
I can't trust the Yap stacks (error) */
|
|
|
|
#define YAP_BUF_SIZE 512
|
|
|
|
|
|
|
|
static char tmpbuf[YAP_BUF_SIZE];
|
2001-04-09 20:54:03 +01:00
|
|
|
|
2011-10-03 01:01:14 +01:00
|
|
|
yamop *
|
2015-01-26 04:02:46 +00:00
|
|
|
Yap_NilError(yap_error_number type, const char *format,...)
|
2011-10-03 01:01:14 +01:00
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
yamop *res;
|
|
|
|
|
|
|
|
va_start (ap, format);
|
|
|
|
/* now build the error string */
|
|
|
|
res = Yap_Error(type, TermNil, format, ap);
|
|
|
|
va_end (ap);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
yamop *
|
2015-01-26 04:02:46 +00:00
|
|
|
Yap_Error(yap_error_number type, Term where, const char *format,...)
|
2001-04-09 20:54:03 +01:00
|
|
|
{
|
2011-03-07 16:02:55 +00:00
|
|
|
CACHE_REGS
|
2001-04-09 20:54:03 +01:00
|
|
|
va_list ap;
|
2002-09-09 18:40:12 +01:00
|
|
|
CELL nt[3];
|
2001-04-09 20:54:03 +01:00
|
|
|
Functor fun;
|
|
|
|
int serious;
|
2002-02-22 06:12:18 +00:00
|
|
|
int psize = YAP_BUF_SIZE;
|
2002-10-23 21:55:37 +01:00
|
|
|
|
2011-05-23 16:19:47 +01:00
|
|
|
LOCAL_Error_TYPE = YAP_NO_ERROR;
|
2014-10-16 10:49:11 +01:00
|
|
|
Yap_ClearExs();
|
|
|
|
if (where == 0L)
|
2008-01-24 00:11:59 +00:00
|
|
|
where = TermNil;
|
2005-04-20 21:06:26 +01:00
|
|
|
#if DEBUG_STRICT
|
2011-05-25 16:40:36 +01:00
|
|
|
if (Yap_heap_regs && !(LOCAL_PrologMode & BootMode))
|
|
|
|
fprintf(stderr,"***** Processing Error %d (%lx,%x) %s***\n", type, (unsigned long int)LOCAL_ActiveSignals,LOCAL_PrologMode,format);
|
2005-03-02 18:35:49 +00:00
|
|
|
else
|
2011-05-25 16:40:36 +01:00
|
|
|
fprintf(stderr,"***** Processing Error %d (%x) %s***\n", type,LOCAL_PrologMode,format);
|
2005-02-24 21:46:40 +00:00
|
|
|
#endif
|
2002-10-23 21:55:37 +01:00
|
|
|
if (type == INTERRUPT_ERROR) {
|
2004-06-23 18:24:20 +01:00
|
|
|
fprintf(stderr,"%% YAP exiting: cannot handle signal %d\n",
|
2002-10-23 21:55:37 +01:00
|
|
|
(int)IntOfTerm(where));
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_exit(1);
|
2002-10-23 21:55:37 +01:00
|
|
|
}
|
2002-02-01 15:48:17 +00:00
|
|
|
/* disallow recursive error handling */
|
2011-05-25 16:40:36 +01:00
|
|
|
if (LOCAL_PrologMode & InErrorMode) {
|
2002-02-01 15:48:17 +00:00
|
|
|
/* error within error */
|
|
|
|
va_start (ap, format);
|
|
|
|
/* now build the error string */
|
|
|
|
if (format != NULL) {
|
|
|
|
#if HAVE_VSNPRINTF
|
2004-08-11 17:14:55 +01:00
|
|
|
(void) vsnprintf(tmpbuf, YAP_BUF_SIZE, format, ap);
|
2002-02-01 15:48:17 +00:00
|
|
|
#else
|
2002-02-22 06:12:18 +00:00
|
|
|
(void) vsprintf(tmpbuf, format, ap);
|
2002-02-01 15:48:17 +00:00
|
|
|
#endif
|
|
|
|
} else {
|
2002-02-22 06:12:18 +00:00
|
|
|
tmpbuf[0] = '\0';
|
2002-02-01 15:48:17 +00:00
|
|
|
}
|
|
|
|
va_end (ap);
|
2013-04-16 20:38:01 +01:00
|
|
|
fprintf(stderr,"%% ERROR WITHIN ERROR %d: %s\n", LOCAL_CurrentError, tmpbuf);
|
2002-02-01 15:48:17 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
2002-04-11 16:31:58 +01:00
|
|
|
/* must do this here */
|
2004-12-02 06:06:47 +00:00
|
|
|
if (type == FATAL_ERROR
|
2005-03-01 22:25:09 +00:00
|
|
|
|| type == INTERNAL_ERROR
|
2004-12-02 06:06:47 +00:00
|
|
|
#if USE_SYSTEM_MALLOC
|
|
|
|
|| !Yap_heap_regs
|
|
|
|
#else
|
|
|
|
|| !Yap_HeapBase
|
|
|
|
#endif
|
|
|
|
) {
|
2002-04-11 16:31:58 +01:00
|
|
|
if (format != NULL) {
|
2004-11-04 18:22:36 +00:00
|
|
|
va_start (ap, format);
|
|
|
|
/* now build the error string */
|
2002-04-11 16:31:58 +01:00
|
|
|
#if HAVE_VSNPRINTF
|
|
|
|
(void) vsnprintf(tmpbuf, YAP_BUF_SIZE, format, ap);
|
|
|
|
#else
|
|
|
|
(void) vsprintf(tmpbuf, format, ap);
|
|
|
|
#endif
|
2004-11-04 18:22:36 +00:00
|
|
|
va_end (ap);
|
2002-04-11 16:31:58 +01:00
|
|
|
} else {
|
|
|
|
tmpbuf[0] = '\0';
|
|
|
|
}
|
2011-05-25 16:40:36 +01:00
|
|
|
if (LOCAL_PrologMode == UserCCallMode) {
|
2005-08-04 16:45:56 +01:00
|
|
|
fprintf(stderr,"%%\n%%\n");
|
2005-03-02 18:35:49 +00:00
|
|
|
fprintf(stderr,"%% YAP OOOPS in USER C-CODE: %s.\n",tmpbuf);
|
2005-08-04 16:45:56 +01:00
|
|
|
fprintf(stderr,"%%\n%%\n");
|
2005-02-08 18:05:21 +00:00
|
|
|
} else {
|
2005-08-04 16:45:56 +01:00
|
|
|
fprintf(stderr,"%%\n%%\n");
|
2005-03-02 18:35:49 +00:00
|
|
|
fprintf(stderr,"%% YAP OOOPS: %s.\n",tmpbuf);
|
2005-08-04 16:45:56 +01:00
|
|
|
fprintf(stderr,"%%\n%%\n");
|
2005-02-08 18:05:21 +00:00
|
|
|
}
|
2014-01-19 21:15:05 +00:00
|
|
|
detect_bug_location(P, FIND_PRED_FROM_ANYWHERE, (char *)HR, 256);
|
|
|
|
fprintf (stderr,"%%\n%% PC: %s\n",(char *)HR);
|
|
|
|
detect_bug_location(CP, FIND_PRED_FROM_ANYWHERE, (char *)HR, 256);
|
|
|
|
fprintf (stderr,"%% Continuation: %s\n",(char *)HR);
|
2013-10-14 08:04:24 +01:00
|
|
|
DumpActiveGoals( PASS_REGS1 );
|
2002-09-09 20:52:38 +01:00
|
|
|
error_exit_yap (1);
|
2002-04-11 16:31:58 +01:00
|
|
|
}
|
2002-02-04 16:12:54 +00:00
|
|
|
if (P == (yamop *)(FAILCODE))
|
2005-03-01 22:25:09 +00:00
|
|
|
return P;
|
2002-02-22 06:12:18 +00:00
|
|
|
/* PURE_ABORT may not have set where correctly, BootMode may not have the data terms ready */
|
2011-05-25 16:40:36 +01:00
|
|
|
if (type == PURE_ABORT || LOCAL_PrologMode & BootMode) {
|
2002-01-17 22:12:09 +00:00
|
|
|
where = TermNil;
|
2011-05-25 16:40:36 +01:00
|
|
|
LOCAL_PrologMode &= ~AbortMode;
|
2013-01-29 10:50:04 +00:00
|
|
|
LOCAL_CurrentError = type;
|
2011-05-25 16:40:36 +01:00
|
|
|
LOCAL_PrologMode |= InErrorMode;
|
2010-12-04 19:05:13 +00:00
|
|
|
/* make sure failure will be seen at next port */
|
2014-09-02 20:19:23 +01:00
|
|
|
// no need to lock & unlock
|
2011-05-25 16:40:36 +01:00
|
|
|
if (LOCAL_PrologMode & AsyncIntMode)
|
2010-12-04 19:05:13 +00:00
|
|
|
Yap_signal(YAP_FAIL_SIGNAL);
|
2010-04-08 01:44:08 +01:00
|
|
|
P = FAILCODE;
|
2002-02-22 06:12:18 +00:00
|
|
|
} else {
|
|
|
|
if (IsVarTerm(where)) {
|
|
|
|
/* we must be careful someone gave us a copy to a local variable */
|
|
|
|
Term t = MkVarTerm();
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_unify(t, where);
|
2002-02-22 06:12:18 +00:00
|
|
|
where = Deref(where);
|
|
|
|
}
|
|
|
|
/* Exit Abort Mode, if we were there */
|
2011-05-25 16:40:36 +01:00
|
|
|
LOCAL_PrologMode &= ~AbortMode;
|
2013-01-29 10:50:04 +00:00
|
|
|
LOCAL_CurrentError = type;
|
2011-05-25 16:40:36 +01:00
|
|
|
LOCAL_PrologMode |= InErrorMode;
|
2005-02-24 21:46:40 +00:00
|
|
|
if (!(where = Yap_CopyTerm(where))) {
|
|
|
|
where = TermNil;
|
|
|
|
}
|
2002-01-10 18:01:14 +00:00
|
|
|
}
|
2001-04-09 20:54:03 +01:00
|
|
|
va_start (ap, format);
|
|
|
|
/* now build the error string */
|
|
|
|
if (format != NULL)
|
|
|
|
{
|
|
|
|
#if HAVE_VSNPRINTF
|
2002-02-22 06:12:18 +00:00
|
|
|
(void) vsnprintf(tmpbuf, YAP_BUF_SIZE, format, ap);
|
2001-04-09 20:54:03 +01:00
|
|
|
#else
|
2002-02-22 06:12:18 +00:00
|
|
|
(void) vsprintf(tmpbuf, format, ap);
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else
|
2002-02-22 06:12:18 +00:00
|
|
|
tmpbuf[0] = '\0';
|
2001-04-09 20:54:03 +01:00
|
|
|
va_end (ap);
|
2011-05-25 16:40:36 +01:00
|
|
|
if (LOCAL_PrologMode & BootMode) {
|
2001-04-09 20:54:03 +01:00
|
|
|
/* crash in flames! */
|
2005-03-02 18:35:49 +00:00
|
|
|
fprintf(stderr,"%% YAP Fatal Error: %s exiting....\n",tmpbuf);
|
2002-09-09 20:52:38 +01:00
|
|
|
error_exit_yap (1);
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
#ifdef DEBUGX
|
2011-03-07 16:02:55 +00:00
|
|
|
DumpActiveGoals( USES_REGS1 );
|
2001-04-09 20:54:03 +01:00
|
|
|
#endif /* DEBUG */
|
|
|
|
switch (type) {
|
|
|
|
case INTERNAL_ERROR:
|
|
|
|
{
|
2004-06-23 18:24:20 +01:00
|
|
|
fprintf(stderr,"%% Internal YAP Error: %s exiting....\n",tmpbuf);
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
2011-05-25 16:40:36 +01:00
|
|
|
if (LOCAL_PrologMode & BootMode) {
|
2005-03-02 18:35:49 +00:00
|
|
|
fprintf(stderr,"%% YAP crashed while booting %s\n",tmpbuf);
|
|
|
|
} else {
|
|
|
|
detect_bug_location(P, FIND_PRED_FROM_ANYWHERE, tmpbuf, YAP_BUF_SIZE);
|
|
|
|
fprintf(stderr,"%% Bug found while executing %s\n",tmpbuf);
|
|
|
|
}
|
2002-09-09 20:52:38 +01:00
|
|
|
error_exit_yap (1);
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
case FATAL_ERROR:
|
|
|
|
{
|
2004-06-23 18:24:20 +01:00
|
|
|
fprintf(stderr,"%% Fatal YAP Error: %s exiting....\n",tmpbuf);
|
2002-09-09 20:52:38 +01:00
|
|
|
error_exit_yap (1);
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
2002-10-23 21:55:37 +01:00
|
|
|
case INTERRUPT_ERROR:
|
|
|
|
{
|
|
|
|
error_exit_yap (1);
|
|
|
|
}
|
2001-04-09 20:54:03 +01:00
|
|
|
case PURE_ABORT:
|
2011-03-01 12:31:19 +00:00
|
|
|
nt[0] = MkAtomTerm(AtomDAbort);
|
2004-11-19 21:32:53 +00:00
|
|
|
fun = FunctorVar;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
break;
|
2002-09-03 15:28:09 +01:00
|
|
|
case CALL_COUNTER_UNDERFLOW:
|
|
|
|
/* Do a long jump */
|
2011-05-04 10:11:41 +01:00
|
|
|
LOCAL_ReductionsCounterOn = FALSE;
|
|
|
|
LOCAL_PredEntriesCounterOn = FALSE;
|
|
|
|
LOCAL_RetriesCounterOn = FALSE;
|
2008-12-23 01:53:52 +00:00
|
|
|
Yap_JumpToEnv(MkAtomTerm(AtomCallCounter));
|
2002-09-03 15:28:09 +01:00
|
|
|
P = (yamop *)FAILCODE;
|
2011-05-25 16:40:36 +01:00
|
|
|
LOCAL_PrologMode &= ~InErrorMode;
|
2002-09-03 15:28:09 +01:00
|
|
|
return(P);
|
|
|
|
case PRED_ENTRY_COUNTER_UNDERFLOW:
|
|
|
|
/* Do a long jump */
|
2011-05-04 10:11:41 +01:00
|
|
|
LOCAL_ReductionsCounterOn = FALSE;
|
|
|
|
LOCAL_PredEntriesCounterOn = FALSE;
|
|
|
|
LOCAL_RetriesCounterOn = FALSE;
|
2008-12-23 01:53:52 +00:00
|
|
|
Yap_JumpToEnv(MkAtomTerm(AtomCallAndRetryCounter));
|
2002-09-03 15:28:09 +01:00
|
|
|
P = (yamop *)FAILCODE;
|
2011-05-25 16:40:36 +01:00
|
|
|
LOCAL_PrologMode &= ~InErrorMode;
|
2002-09-03 15:28:09 +01:00
|
|
|
return(P);
|
|
|
|
case RETRY_COUNTER_UNDERFLOW:
|
|
|
|
/* Do a long jump */
|
2011-05-04 10:11:41 +01:00
|
|
|
LOCAL_ReductionsCounterOn = FALSE;
|
|
|
|
LOCAL_PredEntriesCounterOn = FALSE;
|
|
|
|
LOCAL_RetriesCounterOn = FALSE;
|
2008-12-23 01:53:52 +00:00
|
|
|
Yap_JumpToEnv(MkAtomTerm(AtomRetryCounter));
|
2002-09-03 15:28:09 +01:00
|
|
|
P = (yamop *)FAILCODE;
|
2011-05-25 16:40:36 +01:00
|
|
|
LOCAL_PrologMode &= ~InErrorMode;
|
2002-09-03 15:28:09 +01:00
|
|
|
return(P);
|
2004-02-13 18:39:29 +00:00
|
|
|
case CONSISTENCY_ERROR:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[1];
|
|
|
|
|
2005-07-06 16:10:18 +01:00
|
|
|
i = strlen(tmpbuf);
|
2004-02-13 18:39:29 +00:00
|
|
|
ti[0] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorConsistencyError, 1, ti);
|
2004-02-13 18:39:29 +00:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2004-02-13 18:39:29 +00:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2001-04-09 20:54:03 +01:00
|
|
|
case DOMAIN_ERROR_ARRAY_OVERFLOW:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomArrayOverflow);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DOMAIN_ERROR_ARRAY_TYPE:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomArrayType);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DOMAIN_ERROR_IO_MODE:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomIOMode);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DOMAIN_ERROR_MUTABLE:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomMutable);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DOMAIN_ERROR_NON_EMPTY_LIST:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomNonEmptyList);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DOMAIN_ERROR_NOT_LESS_THAN_ZERO:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomNotLessThanZero);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DOMAIN_ERROR_NOT_NL:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomNotNewline);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DOMAIN_ERROR_NOT_ZERO:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomNotZero);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DOMAIN_ERROR_OUT_OF_RANGE:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomOutOfRange);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DOMAIN_ERROR_OPERATOR_PRIORITY:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomOperatorPriority);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DOMAIN_ERROR_OPERATOR_SPECIFIER:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomOperatorSpecifier);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DOMAIN_ERROR_RADIX:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomRadix);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DOMAIN_ERROR_SHIFT_COUNT_OVERFLOW:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomShiftCountOverflow);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DOMAIN_ERROR_SOURCE_SINK:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomSourceSink);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DOMAIN_ERROR_STREAM:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2010-02-26 10:59:43 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomVStream);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DOMAIN_ERROR_STREAM_OR_ALIAS:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomStreamOrAlias);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2010-10-27 14:49:27 +01:00
|
|
|
case DOMAIN_ERROR_STREAM_ENCODING:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
|
|
|
i = strlen(tmpbuf);
|
|
|
|
ti[0] = MkAtomTerm(AtomEncoding);
|
|
|
|
ti[1] = where;
|
|
|
|
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
|
|
|
|
psize -= i;
|
|
|
|
fun = FunctorError;
|
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2001-04-09 20:54:03 +01:00
|
|
|
case DOMAIN_ERROR_STREAM_POSITION:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomStreamPosition);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DOMAIN_ERROR_SYNTAX_ERROR_HANDLER:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomSyntaxErrorHandler);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DOMAIN_ERROR_TIMEOUT_SPEC:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomTimeOutSpec);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EXISTENCE_ERROR_SOURCE_SINK:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomSourceSink);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorExistenceError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EXISTENCE_ERROR_ARRAY:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomArray);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorExistenceError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2008-03-27 00:41:33 +00:00
|
|
|
case EXISTENCE_ERROR_KEY:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomKey);
|
2008-03-27 00:41:33 +00:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorExistenceError, 2, ti);
|
2008-03-27 00:41:33 +00:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2008-03-27 00:41:33 +00:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2001-04-09 20:54:03 +01:00
|
|
|
case EXISTENCE_ERROR_STREAM:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2010-02-26 10:59:43 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomVStream);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorExistenceError, 2, ti);
|
2010-02-28 00:57:29 +00:00
|
|
|
psize -= i;
|
|
|
|
fun = FunctorError;
|
2014-11-27 10:02:04 +00:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EXISTENCE_ERROR_MUTEX:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
|
|
|
i = strlen(tmpbuf);
|
|
|
|
ti[0] = MkAtomTerm(AtomMutex);
|
|
|
|
ti[1] = where;
|
|
|
|
nt[0] = Yap_MkApplTerm(FunctorExistenceError, 2, ti);
|
|
|
|
psize -= i;
|
|
|
|
fun = FunctorError;
|
2010-02-28 00:57:29 +00:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EXISTENCE_ERROR_VARIABLE:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
|
|
|
i = strlen(tmpbuf);
|
|
|
|
ti[0] = MkAtomTerm(AtomVariable);
|
|
|
|
ti[1] = where;
|
|
|
|
nt[0] = Yap_MkApplTerm(FunctorExistenceError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EVALUATION_ERROR_FLOAT_OVERFLOW:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[1];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomFloatOverflow);
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorEvaluationError, 1, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EVALUATION_ERROR_INT_OVERFLOW:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[1];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomIntOverflow);
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorEvaluationError, 1, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EVALUATION_ERROR_UNDEFINED:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[1];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomUndefined);
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorEvaluationError, 1, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EVALUATION_ERROR_FLOAT_UNDERFLOW:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[1];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomFloatUnderflow);
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorEvaluationError, 1, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EVALUATION_ERROR_UNDERFLOW:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[1];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomUnderflow);
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorEvaluationError, 1, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EVALUATION_ERROR_ZERO_DIVISOR:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[1];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomZeroDivisor);
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorEvaluationError, 1, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case INSTANTIATION_ERROR:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
nt[0] = MkAtomTerm(AtomInstantiationError);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2005-11-23 13:24:00 +00:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPERATING_SYSTEM_ERROR:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
nt[0] = MkAtomTerm(AtomOperatingSystemError);
|
2005-11-23 13:24:00 +00:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2002-10-10 06:58:49 +01:00
|
|
|
case OUT_OF_HEAP_ERROR:
|
|
|
|
{
|
|
|
|
int i;
|
2009-05-17 17:42:56 +01:00
|
|
|
Term ti[1];
|
2002-10-10 06:58:49 +01:00
|
|
|
|
2014-09-02 20:19:23 +01:00
|
|
|
dump_stack();
|
2009-05-17 17:42:56 +01:00
|
|
|
ti[0] = MkAtomTerm(AtomCodeSpace);
|
2002-10-10 06:58:49 +01:00
|
|
|
i = strlen(tmpbuf);
|
2009-05-17 17:42:56 +01:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorResourceError, 1, ti);
|
2002-10-10 06:58:49 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2002-10-10 06:58:49 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OUT_OF_STACK_ERROR:
|
|
|
|
{
|
|
|
|
int i;
|
2009-05-17 17:42:56 +01:00
|
|
|
Term ti[1];
|
2002-10-10 06:58:49 +01:00
|
|
|
|
2014-09-02 20:19:23 +01:00
|
|
|
dump_stack( );
|
2002-10-10 06:58:49 +01:00
|
|
|
i = strlen(tmpbuf);
|
2009-05-17 17:42:56 +01:00
|
|
|
ti[0] = MkAtomTerm(AtomStack);
|
|
|
|
nt[0] = Yap_MkApplTerm(FunctorResourceError, 1, ti);
|
2002-10-10 06:58:49 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2002-10-10 06:58:49 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2004-09-17 20:34:53 +01:00
|
|
|
case OUT_OF_ATTVARS_ERROR:
|
|
|
|
{
|
|
|
|
int i;
|
2009-05-17 17:42:56 +01:00
|
|
|
Term ti[1];
|
2004-09-17 20:34:53 +01:00
|
|
|
|
2014-09-02 20:19:23 +01:00
|
|
|
dump_stack( );
|
2004-09-17 20:34:53 +01:00
|
|
|
i = strlen(tmpbuf);
|
2009-05-17 17:42:56 +01:00
|
|
|
ti[0] = MkAtomTerm(AtomAttributes);
|
|
|
|
nt[0] = Yap_MkApplTerm(FunctorResourceError, 1, ti);
|
2004-09-17 20:34:53 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2004-09-17 20:34:53 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2004-10-27 16:56:34 +01:00
|
|
|
case OUT_OF_AUXSPACE_ERROR:
|
|
|
|
{
|
|
|
|
int i;
|
2009-05-17 17:42:56 +01:00
|
|
|
Term ti[1];
|
2004-10-27 16:56:34 +01:00
|
|
|
|
2014-09-02 20:19:23 +01:00
|
|
|
dump_stack( );
|
2004-10-27 16:56:34 +01:00
|
|
|
i = strlen(tmpbuf);
|
2009-05-17 17:42:56 +01:00
|
|
|
ti[0] = MkAtomTerm(AtomUnificationStack);
|
|
|
|
nt[0] = Yap_MkApplTerm(FunctorResourceError, 1, ti);
|
2004-10-27 16:56:34 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2004-10-27 16:56:34 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2002-10-10 06:58:49 +01:00
|
|
|
case OUT_OF_TRAIL_ERROR:
|
|
|
|
{
|
|
|
|
int i;
|
2009-05-17 17:42:56 +01:00
|
|
|
Term ti[1];
|
2002-10-10 06:58:49 +01:00
|
|
|
|
2014-09-02 20:19:23 +01:00
|
|
|
dump_stack( );
|
2002-10-10 06:58:49 +01:00
|
|
|
i = strlen(tmpbuf);
|
2009-05-17 17:42:56 +01:00
|
|
|
ti[0] = MkAtomTerm(AtomTrail);
|
|
|
|
nt[0] = Yap_MkApplTerm(FunctorResourceError, 1, ti);
|
2002-10-10 06:58:49 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2002-10-10 06:58:49 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2001-04-09 20:54:03 +01:00
|
|
|
case PERMISSION_ERROR_ACCESS_PRIVATE_PROCEDURE:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[3];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomAccess);
|
|
|
|
ti[1] = MkAtomTerm(AtomPrivateProcedure);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorPermissionError, 3, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PERMISSION_ERROR_CREATE_ARRAY:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[3];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomCreate);
|
|
|
|
ti[1] = MkAtomTerm(AtomArray);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorPermissionError, 3, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PERMISSION_ERROR_CREATE_OPERATOR:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[3];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomCreate);
|
|
|
|
ti[1] = MkAtomTerm(AtomOperator);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorPermissionError, 3, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PERMISSION_ERROR_INPUT_BINARY_STREAM:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[3];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomInput);
|
|
|
|
ti[1] = MkAtomTerm(AtomBinaryStream);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorPermissionError, 3, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PERMISSION_ERROR_INPUT_PAST_END_OF_STREAM:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[3];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomInput);
|
|
|
|
ti[1] = MkAtomTerm(AtomPastEndOfStream);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorPermissionError, 3, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PERMISSION_ERROR_INPUT_STREAM:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[3];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomInput);
|
2010-02-26 10:59:43 +00:00
|
|
|
ti[1] = MkAtomTerm(AtomVStream);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorPermissionError, 3, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PERMISSION_ERROR_INPUT_TEXT_STREAM:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[3];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomInput);
|
|
|
|
ti[1] = MkAtomTerm(AtomTextStream);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorPermissionError, 3, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PERMISSION_ERROR_MODIFY_STATIC_PROCEDURE:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[3];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomModify);
|
|
|
|
ti[1] = MkAtomTerm(AtomStaticProcedure);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorPermissionError, 3, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2001-04-16 17:41:04 +01:00
|
|
|
case PERMISSION_ERROR_NEW_ALIAS_FOR_STREAM:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[3];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomNew);
|
|
|
|
ti[1] = MkAtomTerm(AtomAlias);
|
2001-04-16 17:41:04 +01:00
|
|
|
ti[2] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorPermissionError, 3, ti);
|
2001-04-16 17:41:04 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-16 17:41:04 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2001-04-09 20:54:03 +01:00
|
|
|
case PERMISSION_ERROR_OPEN_SOURCE_SINK:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[3];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomOpen);
|
|
|
|
ti[1] = MkAtomTerm(AtomSourceSink);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorPermissionError, 3, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PERMISSION_ERROR_OUTPUT_BINARY_STREAM:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[3];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomOutput);
|
|
|
|
ti[1] = MkAtomTerm(AtomBinaryStream);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorPermissionError, 3, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PERMISSION_ERROR_OUTPUT_STREAM:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[3];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomOutput);
|
2010-02-26 10:59:43 +00:00
|
|
|
ti[1] = MkAtomTerm(AtomVStream);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorPermissionError, 3, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PERMISSION_ERROR_OUTPUT_TEXT_STREAM:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[3];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomOutput);
|
|
|
|
ti[1] = MkAtomTerm(AtomTextStream);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorPermissionError, 3, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PERMISSION_ERROR_REPOSITION_STREAM:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[3];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomReposition);
|
2010-02-26 10:59:43 +00:00
|
|
|
ti[1] = MkAtomTerm(AtomVStream);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorPermissionError, 3, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PERMISSION_ERROR_RESIZE_ARRAY:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[3];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomResize);
|
|
|
|
ti[1] = MkAtomTerm(AtomArray);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorPermissionError, 3, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case REPRESENTATION_ERROR_CHARACTER:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[1];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomCharacter);
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorRepresentationError, 1, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case REPRESENTATION_ERROR_CHARACTER_CODE:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[1];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomCharacterCode);
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorRepresentationError, 1, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2013-12-05 21:26:46 +00:00
|
|
|
case REPRESENTATION_ERROR_INT:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[1];
|
|
|
|
|
|
|
|
i = strlen(tmpbuf);
|
|
|
|
ti[0] = MkAtomTerm(AtomInt);
|
|
|
|
nt[0] = Yap_MkApplTerm(FunctorRepresentationError, 1, ti);
|
|
|
|
psize -= i;
|
|
|
|
fun = FunctorError;
|
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2001-04-09 20:54:03 +01:00
|
|
|
case REPRESENTATION_ERROR_MAX_ARITY:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[1];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomMaxArity);
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorRepresentationError, 1, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2009-05-23 03:51:48 +01:00
|
|
|
case REPRESENTATION_ERROR_VARIABLE:
|
2008-03-24 23:48:47 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[1];
|
|
|
|
|
|
|
|
i = strlen(tmpbuf);
|
2009-05-23 03:51:48 +01:00
|
|
|
ti[0] = MkAtomTerm(AtomVariable);
|
|
|
|
nt[0] = Yap_MkApplTerm(FunctorRepresentationError, 1, ti);
|
2008-03-24 23:48:47 +00:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2008-03-24 23:48:47 +00:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2009-05-23 01:55:18 +01:00
|
|
|
case RESOURCE_ERROR_MAX_STREAMS:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[1];
|
|
|
|
|
|
|
|
i = strlen(tmpbuf);
|
|
|
|
ti[0] = MkAtomTerm(AtomStreams);
|
|
|
|
nt[0] = Yap_MkApplTerm(FunctorResourceError, 1, ti);
|
|
|
|
psize -= i;
|
|
|
|
fun = FunctorError;
|
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2009-04-25 17:01:33 +01:00
|
|
|
case RESOURCE_ERROR_STACK:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[1];
|
|
|
|
|
|
|
|
i = strlen(tmpbuf);
|
|
|
|
ti[0] = MkAtomTerm(AtomStack);
|
|
|
|
nt[0] = Yap_MkApplTerm(FunctorResourceError, 1, ti);
|
|
|
|
psize -= i;
|
|
|
|
fun = FunctorError;
|
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2009-04-25 01:03:00 +01:00
|
|
|
case RESOURCE_ERROR_HUGE_INT:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[1];
|
|
|
|
|
|
|
|
i = strlen(tmpbuf);
|
|
|
|
ti[0] = MkAtomTerm(AtomHugeInt);
|
|
|
|
nt[0] = Yap_MkApplTerm(FunctorResourceError, 1, ti);
|
|
|
|
psize -= i;
|
|
|
|
fun = FunctorError;
|
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2001-04-09 20:54:03 +01:00
|
|
|
case SYNTAX_ERROR:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2013-01-18 14:30:10 +00:00
|
|
|
case SAVED_STATE_ERROR:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = strlen(tmpbuf);
|
|
|
|
nt[0] = MkAtomTerm(AtomSystemError);
|
|
|
|
psize -= i;
|
|
|
|
fun = FunctorError;
|
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2001-04-09 20:54:03 +01:00
|
|
|
case SYSTEM_ERROR:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
nt[0] = MkAtomTerm(AtomSystemError);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2005-05-25 22:43:33 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case INTERNAL_COMPILER_ERROR:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
nt[0] = MkAtomTerm(AtomInternalCompilerError);
|
2005-05-25 22:43:33 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_ERROR_ARRAY:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomArray);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_ERROR_ATOM:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomAtom);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_ERROR_ATOMIC:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomAtomic);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2013-12-02 14:49:41 +00:00
|
|
|
case TYPE_ERROR_BIGNUM:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
|
|
|
i = strlen(tmpbuf);
|
|
|
|
ti[0] = MkAtomTerm(AtomBigNum);
|
|
|
|
ti[1] = where;
|
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
|
|
|
psize -= i;
|
|
|
|
fun = FunctorError;
|
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2001-04-09 20:54:03 +01:00
|
|
|
case TYPE_ERROR_BYTE:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomByte);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_ERROR_CALLABLE:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomCallable);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2002-11-26 22:28:32 +00:00
|
|
|
case TYPE_ERROR_CHAR:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomChar);
|
2002-11-26 22:28:32 +00:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2002-11-26 22:28:32 +00:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2002-11-26 22:28:32 +00:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2001-04-09 20:54:03 +01:00
|
|
|
case TYPE_ERROR_CHARACTER:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomCharacter);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_ERROR_COMPOUND:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomCompound);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_ERROR_DBREF:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomDBReference);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_ERROR_DBTERM:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomDBTerm);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_ERROR_EVALUABLE:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomEvaluable);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_ERROR_FLOAT:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomFloat);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_ERROR_INTEGER:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomInteger);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_ERROR_KEY:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomKey);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_ERROR_LIST:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomList);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_ERROR_NUMBER:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomNumber);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_ERROR_PREDICATE_INDICATOR:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomPredicateIndicator);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_ERROR_PTR:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomPointer);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2011-06-13 01:42:32 +01:00
|
|
|
fun = FunctorError;
|
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2013-12-09 14:16:30 +00:00
|
|
|
case TYPE_ERROR_REFERENCE:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
|
|
|
i = strlen(tmpbuf);
|
|
|
|
ti[0] = MkAtomTerm(AtomDBReference);
|
|
|
|
ti[1] = where;
|
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
|
|
|
psize -= i;
|
|
|
|
fun = FunctorError;
|
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2011-06-13 01:42:32 +01:00
|
|
|
case TYPE_ERROR_STRING:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
|
|
|
i = strlen(tmpbuf);
|
|
|
|
ti[0] = MkAtomTerm(AtomString);
|
|
|
|
ti[1] = where;
|
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2013-12-08 19:12:24 +00:00
|
|
|
case TYPE_ERROR_TEXT:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
|
|
|
i = strlen(tmpbuf);
|
|
|
|
ti[0] = MkAtomTerm(AtomText);
|
|
|
|
ti[1] = where;
|
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
|
|
|
psize -= i;
|
|
|
|
fun = FunctorError;
|
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2001-04-09 20:54:03 +01:00
|
|
|
case TYPE_ERROR_UBYTE:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomUnsignedByte);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2002-11-26 22:28:32 +00:00
|
|
|
case TYPE_ERROR_UCHAR:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomUnsignedChar);
|
2002-11-26 22:28:32 +00:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2002-11-26 22:28:32 +00:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2002-11-26 22:28:32 +00:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2001-04-09 20:54:03 +01:00
|
|
|
case TYPE_ERROR_VARIABLE:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
ti[0] = MkAtomTerm(AtomVariable);
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2008-12-23 02:20:22 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(FunctorTypeError, 2, ti);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2008-12-23 01:53:52 +00:00
|
|
|
nt[0] = MkAtomTerm(AtomSystemError);
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2008-12-23 01:53:52 +00:00
|
|
|
fun = FunctorError;
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (type != PURE_ABORT) {
|
|
|
|
/* This is used by some complex procedures to detect there was an error */
|
2003-10-06 15:16:23 +01:00
|
|
|
if (IsAtomTerm(nt[0])) {
|
2011-05-23 16:19:47 +01:00
|
|
|
strncpy(LOCAL_ErrorSay, RepAtom(AtomOfTerm(nt[0]))->StrOfAE, MAX_ERROR_MSG_SIZ\
|
2011-04-27 10:04:26 +01:00
|
|
|
E);
|
2011-05-23 16:19:47 +01:00
|
|
|
LOCAL_ErrorMessage = LOCAL_ErrorSay;
|
2003-10-06 15:16:23 +01:00
|
|
|
} else {
|
2011-05-23 16:19:47 +01:00
|
|
|
strncpy(LOCAL_ErrorSay, RepAtom(NameOfFunctor(FunctorOfTerm(nt[0])))->StrOfAE,\
|
2011-04-27 10:04:26 +01:00
|
|
|
MAX_ERROR_MSG_SIZE);
|
2011-05-23 16:19:47 +01:00
|
|
|
LOCAL_ErrorMessage = LOCAL_ErrorSay;
|
2003-10-06 15:16:23 +01:00
|
|
|
}
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
2002-10-10 06:58:49 +01:00
|
|
|
switch (type) {
|
|
|
|
case OUT_OF_HEAP_ERROR:
|
|
|
|
case OUT_OF_STACK_ERROR:
|
|
|
|
case OUT_OF_TRAIL_ERROR:
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[1] = MkAtomTerm(Yap_LookupAtom(tmpbuf));
|
2002-10-10 06:58:49 +01:00
|
|
|
break;
|
|
|
|
default:
|
2010-04-29 10:29:06 +01:00
|
|
|
{
|
|
|
|
Term stack_dump;
|
|
|
|
|
|
|
|
if ((stack_dump = Yap_all_calls()) == 0L) {
|
|
|
|
stack_dump = TermNil;
|
2011-05-23 16:19:47 +01:00
|
|
|
LOCAL_Error_Size = 0L;
|
2010-04-29 10:29:06 +01:00
|
|
|
}
|
|
|
|
nt[1] = MkPairTerm(MkAtomTerm(Yap_LookupAtom(tmpbuf)), stack_dump);
|
2012-05-03 00:16:11 +01:00
|
|
|
if (type == SYNTAX_ERROR) {
|
|
|
|
nt[1] = MkPairTerm(where, nt[1]);
|
|
|
|
}
|
2010-04-29 10:29:06 +01:00
|
|
|
}
|
2002-10-10 06:58:49 +01:00
|
|
|
}
|
2001-04-09 20:54:03 +01:00
|
|
|
if (serious) {
|
2005-02-24 21:46:40 +00:00
|
|
|
/* disable active signals at this point */
|
2014-09-02 20:19:23 +01:00
|
|
|
LOCAL_Signals = 0;
|
2013-12-12 14:24:40 +00:00
|
|
|
CalculateStackGap( PASS_REGS1 );
|
2011-05-25 16:40:36 +01:00
|
|
|
LOCAL_PrologMode &= ~InErrorMode;
|
2009-05-23 21:51:00 +01:00
|
|
|
/* we might be in the middle of a critical region */
|
2011-05-04 10:11:41 +01:00
|
|
|
if (LOCAL_InterruptsDisabled) {
|
|
|
|
LOCAL_InterruptsDisabled = 0;
|
|
|
|
LOCAL_UncaughtThrow = TRUE;
|
2012-02-05 12:04:29 +00:00
|
|
|
Yap_RestartYap( 1 );
|
2009-05-23 21:51:00 +01:00
|
|
|
}
|
2014-08-04 15:47:03 +01:00
|
|
|
#if DEBUG
|
2014-09-16 10:00:31 +01:00
|
|
|
// DumpActiveGoals( PASS_REGS1 );
|
2014-08-04 15:47:03 +01:00
|
|
|
#endif
|
2010-08-04 11:34:04 +01:00
|
|
|
/* wait if we we are in user code,
|
|
|
|
it's up to her to decide */
|
|
|
|
|
2011-05-25 16:40:36 +01:00
|
|
|
if (LOCAL_PrologMode & UserCCallMode) {
|
2011-02-15 07:39:27 +00:00
|
|
|
if (!(EX = Yap_StoreTermInDB(Yap_MkApplTerm(fun, 2, nt), 0))) {
|
|
|
|
/* fat chance */
|
2012-02-05 12:04:29 +00:00
|
|
|
Yap_RestartYap( 1 );
|
2010-08-04 11:34:04 +01:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (type == PURE_ABORT) {
|
|
|
|
Yap_JumpToEnv(MkAtomTerm(AtomDAbort));
|
|
|
|
} else
|
|
|
|
Yap_JumpToEnv(Yap_MkApplTerm(fun, 2, nt));
|
|
|
|
P = (yamop *)FAILCODE;
|
|
|
|
}
|
2009-04-26 16:48:32 +01:00
|
|
|
} else {
|
2011-05-25 16:40:36 +01:00
|
|
|
LOCAL_PrologMode &= ~InErrorMode;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
2005-02-24 21:46:40 +00:00
|
|
|
return P;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|