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"
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
STATIC_PROTO (int hidden, (Atom));
|
|
|
|
STATIC_PROTO (int legal_env, (CELL *));
|
|
|
|
void STD_PROTO (DumpActiveGoals, (void));
|
2004-10-26 21:16:18 +01:00
|
|
|
STATIC_PROTO (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
|
|
|
|
2002-11-18 18:18:05 +00:00
|
|
|
#define ONLOCAL(ptr) (CellPtr(ptr) > CellPtr(H) && CellPtr(ptr) < CellPtr(Yap_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
|
|
|
|
legal_env (CELL *ep)
|
|
|
|
{
|
|
|
|
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));
|
|
|
|
READ_LOCK(pe->PRWLock);
|
|
|
|
if (!ONHEAP (pe) || Unsigned (pe) & 3 || pe->KindOfPE & 0xff00) {
|
|
|
|
READ_UNLOCK(pe->PRWLock);
|
|
|
|
return (FALSE);
|
|
|
|
}
|
|
|
|
READ_UNLOCK(pe->PRWLock);
|
|
|
|
return (TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DumpActiveGoals (void)
|
|
|
|
{
|
|
|
|
/* 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
|
|
|
|
2001-04-09 20:54:03 +01:00
|
|
|
if (legal_env (YENV) && YENV < ENV)
|
|
|
|
ep = YENV;
|
|
|
|
else if (legal_env (ENV))
|
|
|
|
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;
|
|
|
|
pe = EnvPreg(cp);
|
|
|
|
if (!ONHEAP (pe) || Unsigned (pe) & (sizeof(CELL)-1))
|
|
|
|
break;
|
|
|
|
READ_LOCK(pe->PRWLock);
|
|
|
|
if (pe->KindOfPE & 0xff00) {
|
|
|
|
READ_UNLOCK(pe->PRWLock);
|
|
|
|
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
|
|
|
|
2004-02-22 00:35:07 +00:00
|
|
|
READ_UNLOCK(pe->PRWLock);
|
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;
|
|
|
|
Yap_plwrite (mod, Yap_DebugPutc, 0);
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_DebugPutc (Yap_c_error_stream,':');
|
2001-04-09 20:54:03 +01:00
|
|
|
if (pe->ArityOfPE == 0) {
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_plwrite (MkAtomTerm ((Atom)f), Yap_DebugPutc, 0);
|
2001-04-09 20:54:03 +01:00
|
|
|
} else {
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_plwrite (MkAtomTerm (NameOfFunctor (f)), Yap_DebugPutc, 0);
|
|
|
|
Yap_DebugPutc (Yap_c_error_stream,'/');
|
|
|
|
Yap_plwrite (MkIntTerm (ArityOfFunctor (f)), Yap_DebugPutc, 0);
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_DebugPutc (Yap_c_error_stream,'\n');
|
2004-02-22 00:35:07 +00:00
|
|
|
} else {
|
|
|
|
READ_UNLOCK(pe->PRWLock);
|
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);
|
2001-04-09 20:54:03 +01:00
|
|
|
READ_LOCK(pe->PRWLock);
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
Yap_plwrite (mod, Yap_DebugPutc, 0);
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_DebugPutc (Yap_c_error_stream,':');
|
2001-04-09 20:54:03 +01:00
|
|
|
if (pe->ArityOfPE == 0) {
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_plwrite (MkAtomTerm (NameOfFunctor(f)), Yap_DebugPutc, 0);
|
2001-04-09 20:54:03 +01:00
|
|
|
} else {
|
|
|
|
Int i = 0, arity = pe->ArityOfPE;
|
|
|
|
Term *args = &(b_ptr->cp_a1);
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_plwrite (MkAtomTerm (NameOfFunctor (f)), Yap_DebugPutc, 0);
|
|
|
|
Yap_DebugPutc (Yap_c_error_stream,'(');
|
2001-04-09 20:54:03 +01:00
|
|
|
for (i= 0; i < arity; i++) {
|
2002-11-18 18:18:05 +00:00
|
|
|
if (i > 0) Yap_DebugPutc (Yap_c_error_stream,',');
|
|
|
|
Yap_plwrite(args[i], Yap_DebugPutc, Handle_vars_f);
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_DebugPutc (Yap_c_error_stream,')');
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_DebugPutc (Yap_c_error_stream,'\n');
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
READ_UNLOCK(pe->PRWLock);
|
|
|
|
b_ptr = b_ptr->cp_b;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* DEBUG */
|
|
|
|
|
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
|
|
|
|
#if SHORT_INTS
|
2004-02-12 12:37:12 +00:00
|
|
|
snprintf(tp, psize, "prolog:%s/%ld",
|
2001-04-09 20:54:03 +01:00
|
|
|
RepAtom(pred_name)->StrOfAE, pred_arity);
|
|
|
|
#else
|
2004-02-12 12:37:12 +00:00
|
|
|
snprintf(tp, psize, "prolog:%s/%d",
|
2001-04-09 20:54:03 +01:00
|
|
|
RepAtom(pred_name)->StrOfAE, pred_arity);
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#if SHORT_INTS
|
2004-02-12 12:37:12 +00:00
|
|
|
sprintf(tp, "in prolog:%s/%ld",
|
2001-04-09 20:54:03 +01:00
|
|
|
RepAtom(pred_name)->StrOfAE, pred_arity);
|
|
|
|
#else
|
2004-02-12 12:37:12 +00:00
|
|
|
sprintf(tp, "in prolog:%s/%d",
|
2001-04-09 20:54:03 +01:00
|
|
|
RepAtom(pred_name)->StrOfAE, pred_arity);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
} else if (cl < 0) {
|
|
|
|
#if HAVE_SNPRINTF
|
|
|
|
#if SHORT_INTS
|
|
|
|
snprintf(tp, psize, "indexing code of %s:%s/%ld",
|
2004-02-12 12:37:12 +00:00
|
|
|
RepAtom(AtomOfTerm(pred_module))->StrOfAE,
|
2001-04-09 20:54:03 +01:00
|
|
|
RepAtom(pred_name)->StrOfAE, pred_arity);
|
|
|
|
#else
|
|
|
|
snprintf(tp, psize, "indexing code of %s:%s/%d",
|
2004-02-12 12:37:12 +00:00
|
|
|
RepAtom(AtomOfTerm(pred_module))->StrOfAE,
|
2001-04-09 20:54:03 +01:00
|
|
|
RepAtom(pred_name)->StrOfAE, pred_arity);
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#if SHORT_INTS
|
|
|
|
sprintf(tp, "indexing code of %s:%s/%ld",
|
2004-02-12 12:37:12 +00:00
|
|
|
RepAtom(AtomOfTerm(pred_module))->StrOfAE,
|
2001-04-09 20:54:03 +01:00
|
|
|
RepAtom(pred_name)->StrOfAE, pred_arity);
|
|
|
|
#else
|
|
|
|
sprintf(tp, "indexing code of %s:%s/%d",
|
2004-02-12 12:37:12 +00:00
|
|
|
RepAtom(AtomOfTerm(pred_module))->StrOfAE,
|
2001-04-09 20:54:03 +01:00
|
|
|
RepAtom(pred_name)->StrOfAE, pred_arity);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
} else {
|
|
|
|
#if HAVE_SNPRINTF
|
|
|
|
#if SHORT_INTS
|
|
|
|
snprintf(tp, psize, "clause %ld of %s:%s/%ld", cl,
|
2004-02-12 12:37:12 +00:00
|
|
|
RepAtom(AtomOfTerm(pred_module))->StrOfAE,
|
2001-04-09 20:54:03 +01:00
|
|
|
RepAtom(pred_name)->StrOfAE, pred_arity);
|
|
|
|
#else
|
|
|
|
snprintf(tp, psize, "clause %d of %s:%s/%d", cl,
|
2004-02-12 12:37:12 +00:00
|
|
|
RepAtom(AtomOfTerm(pred_module))->StrOfAE,
|
2001-04-09 20:54:03 +01:00
|
|
|
RepAtom(pred_name)->StrOfAE, pred_arity);
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#if SHORT_INTS
|
|
|
|
sprintf(tp, "clause %ld of %s:%s/%ld", cl,
|
2004-02-12 12:37:12 +00:00
|
|
|
RepAtom(AtomOfTerm(pred_module))->StrOfAE,
|
2001-04-09 20:54:03 +01:00
|
|
|
RepAtom(pred_name)->StrOfAE, pred_arity);
|
|
|
|
#else
|
|
|
|
sprintf(tp, "clause %d of %s:%s/%d", cl,
|
2004-02-12 12:37:12 +00:00
|
|
|
RepAtom(AtomOfTerm(pred_module))->StrOfAE,
|
2001-04-09 20:54:03 +01:00
|
|
|
RepAtom(pred_name)->StrOfAE, pred_arity);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-10-14 17:25:38 +01:00
|
|
|
static void
|
|
|
|
dump_stack(void)
|
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;
|
2002-09-09 20:52:38 +01:00
|
|
|
|
2005-02-24 21:46:40 +00:00
|
|
|
#if DEBUG
|
|
|
|
fprintf(stderr,"%% YAP regs: P=%p, CP=%p, ASP=%p, H=%p, TR=%p, HeapTop=%p\n",P,CP,ASP,H,TR,HeapTop);
|
|
|
|
fprintf(stderr,"%% YAP mode: %x\n",Yap_PrologMode);
|
|
|
|
if (Yap_ErrorMessage)
|
|
|
|
fprintf(stderr,"%% YAP_ErrorMessage: %s\n",Yap_ErrorMessage);
|
|
|
|
#endif
|
2002-09-09 20:52:38 +01:00
|
|
|
if (H > ASP || H > LCL0) {
|
2005-02-08 18:05:21 +00:00
|
|
|
fprintf(stderr,"%% YAP ERROR: Global Collided against Local (%p--%p)\n",H,ASP);
|
2002-11-18 18:18:05 +00:00
|
|
|
} else if (HeapTop > (ADDR)Yap_GlobalBase) {
|
2005-02-08 18:05:21 +00:00
|
|
|
fprintf(stderr,"%% YAP ERROR: Code Space Collided against Global (%p--%p)\n", HeapTop, Yap_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
|
|
|
|
if (Yap_hole_start) {
|
|
|
|
fprintf (stderr," Last hole: %p--%p\n", Yap_hole_start, Yap_hole_end);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
2005-02-21 16:50:21 +00:00
|
|
|
fprintf (stderr,"%ldKB of Global Stack (%p--%p)\n",(long int)(sizeof(CELL)*(H-H0))/1024,H0,H);
|
|
|
|
fprintf (stderr,"%ldKB of Local Stack (%p--%p)\n",(long int)(sizeof(CELL)*(LCL0-ASP))/1024,ASP,LCL0);
|
|
|
|
fprintf (stderr,"%ldKB of Trail (%p--%p)\n",(long int)((ADDR)TR-Yap_TrailBase)/1024,Yap_TrailBase,TR);
|
2005-02-08 18:05:21 +00:00
|
|
|
fprintf (stderr,"Performed %d garbage collections\n", GcCalls);
|
|
|
|
#if LOW_LEVEL_TRACER
|
|
|
|
{
|
|
|
|
extern long long vsc_count;
|
|
|
|
|
|
|
|
if (vsc_count) {
|
|
|
|
fprintf(stderr,"Trace Counter at %lld\n",vsc_count);
|
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
|
2005-02-24 21:46:40 +00:00
|
|
|
detect_bug_location(P, FIND_PRED_FROM_ANYWHERE, (char *)H, 256);
|
|
|
|
fprintf (stderr,"Running code at %s\n",(char *)H);
|
|
|
|
detect_bug_location(CP, FIND_PRED_FROM_ANYWHERE, (char *)H, 256);
|
|
|
|
fprintf (stderr,"Continuation is at %s\n",(char *)H);
|
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;
|
|
|
|
fprintf(stderr," %s (*)\n", tp);
|
|
|
|
} else {
|
|
|
|
fprintf(stderr," %s\n", tp);
|
|
|
|
}
|
|
|
|
ipc = (yamop *)(env_ptr[E_CP]);
|
|
|
|
env_ptr = (CELL *)(env_ptr[E_E]);
|
|
|
|
}
|
|
|
|
if (b_ptr) {
|
|
|
|
if (b_ptr->cp_ap->opc != Yap_opcode(_or_else) &&
|
|
|
|
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);
|
|
|
|
fprintf(stderr," %s (*)\n", tp);
|
|
|
|
}
|
|
|
|
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)
|
|
|
|
{
|
2005-02-08 18:05:21 +00:00
|
|
|
if (!(Yap_PrologMode & BootMode)) {
|
|
|
|
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
|
|
|
{
|
2004-10-26 21:16:18 +01:00
|
|
|
detect_bug_location(pc, FIND_PRED_FROM_ANYWHERE, (char *)H, 256);
|
2002-02-26 15:51:54 +00:00
|
|
|
fprintf(stderr,"%s\n",(char *)H);
|
|
|
|
}
|
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
|
|
|
|
|
|
|
yamop *
|
2004-09-03 04:11:09 +01:00
|
|
|
Yap_Error(yap_error_number type, Term where, char *format,...)
|
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
|
|
|
char *tp = tmpbuf;
|
|
|
|
int psize = YAP_BUF_SIZE;
|
2002-10-23 21:55:37 +01:00
|
|
|
|
2005-12-18 17:12:33 +00:00
|
|
|
Yap_Error_TYPE = YAP_NO_ERROR;
|
2005-04-20 21:06:26 +01:00
|
|
|
#if DEBUG_STRICT
|
2005-03-02 18:35:49 +00:00
|
|
|
if (Yap_heap_regs && !(Yap_PrologMode & BootMode))
|
2005-03-13 06:26:13 +00:00
|
|
|
fprintf(stderr,"***** Processing Error %d (%lx,%x) %s***\n", type, (unsigned long int)ActiveSignals,Yap_PrologMode,format);
|
2005-03-02 18:35:49 +00:00
|
|
|
else
|
|
|
|
fprintf(stderr,"***** Processing Error %d (%x) %s***\n", type,Yap_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 */
|
2002-11-18 18:18:05 +00:00
|
|
|
if (Yap_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);
|
2004-06-23 18:24:20 +01:00
|
|
|
fprintf(stderr,"%% ERROR WITHIN ERROR: %s\n", 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';
|
|
|
|
}
|
2005-02-08 18:05:21 +00:00
|
|
|
if (Yap_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
|
|
|
}
|
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 */
|
2002-11-18 18:18:05 +00:00
|
|
|
if (type == PURE_ABORT || Yap_PrologMode & BootMode) {
|
2002-01-17 22:12:09 +00:00
|
|
|
where = TermNil;
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_PrologMode &= ~AbortMode;
|
|
|
|
Yap_PrologMode |= InErrorMode;
|
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 */
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_PrologMode &= ~AbortMode;
|
|
|
|
Yap_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);
|
2002-11-18 18:18:05 +00:00
|
|
|
if (Yap_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
|
|
|
|
DumpActiveGoals();
|
|
|
|
#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;
|
2005-03-02 18:35:49 +00:00
|
|
|
if (Yap_PrologMode & BootMode) {
|
|
|
|
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:
|
2004-11-19 21:32:53 +00:00
|
|
|
fprintf(stderr,"%% YAP execution aborted.\n");
|
|
|
|
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 */
|
|
|
|
PredEntriesCounter--;
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_JumpToEnv(MkAtomTerm(Yap_LookupAtom("call_counter")));
|
2002-09-03 15:28:09 +01:00
|
|
|
P = (yamop *)FAILCODE;
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_PrologMode &= ~InErrorMode;
|
2002-09-03 15:28:09 +01:00
|
|
|
return(P);
|
|
|
|
case PRED_ENTRY_COUNTER_UNDERFLOW:
|
|
|
|
/* Do a long jump */
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_JumpToEnv(MkAtomTerm(Yap_LookupAtom("call_and_retry_counter")));
|
2002-09-03 15:28:09 +01:00
|
|
|
P = (yamop *)FAILCODE;
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_PrologMode &= ~InErrorMode;
|
2002-09-03 15:28:09 +01:00
|
|
|
return(P);
|
|
|
|
case RETRY_COUNTER_UNDERFLOW:
|
|
|
|
/* Do a long jump */
|
|
|
|
PredEntriesCounter--;
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_JumpToEnv(MkAtomTerm(Yap_LookupAtom("retry_counter")));
|
2002-09-03 15:28:09 +01:00
|
|
|
P = (yamop *)FAILCODE;
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_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;
|
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("consistency_error"),1), 1, ti);
|
|
|
|
tp = tmpbuf+i;
|
|
|
|
psize -= i;
|
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
|
|
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("array_overflow"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("domain_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("array_type"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("domain_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("io_mode"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("domain_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("mutable"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("domain_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("non_empty_list"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("domain_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("not_less_than_zero"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("domain_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("not_newline"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("domain_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("not_zero"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("domain_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("out_of_range"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("domain_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("operator_priority"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("domain_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("operator_specifier"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("domain_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("radix"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("domain_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("shift_count_overflow"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("domain_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("source_sink"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("domain_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("stream"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("domain_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("stream_or_alias"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("domain_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case DOMAIN_ERROR_STREAM_POSITION:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("stream_position"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("domain_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("syntax_error_handler"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("domain_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("time_out_spec"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("domain_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("source_sink"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("existence_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("array"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("existence_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EXISTENCE_ERROR_STREAM:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("stream"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("existence_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("float_overflow"));
|
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("evaluation_error"),1), 1, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("int_overflow"));
|
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("evaluation_error"),1), 1, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("undefined"));
|
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("evaluation_error"),1), 1, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("float_underflow"));
|
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("evaluation_error"),1), 1, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("underflow"));
|
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("evaluation_error"),1), 1, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("zero_divisor"));
|
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("evaluation_error"),1), 1, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = MkAtomTerm(Yap_LookupAtom("instantiation_error"));
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
2005-11-23 13:24:00 +00:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OPERATING_SYSTEM_ERROR:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = strlen(tmpbuf);
|
|
|
|
nt[0] = MkAtomTerm(Yap_LookupAtom("operating_system_error"));
|
|
|
|
tp = tmpbuf+i;
|
|
|
|
psize -= i;
|
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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;
|
|
|
|
|
|
|
|
dump_stack();
|
|
|
|
i = strlen(tmpbuf);
|
2004-10-27 16:56:34 +01:00
|
|
|
nt[0] = MkAtomTerm(Yap_LookupAtom("out_of_heap_error"));
|
2002-10-10 06:58:49 +01:00
|
|
|
tp = tmpbuf+i;
|
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
2002-10-10 06:58:49 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OUT_OF_STACK_ERROR:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
dump_stack();
|
|
|
|
i = strlen(tmpbuf);
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = MkAtomTerm(Yap_LookupAtom("out_of_stack_error"));
|
2002-10-10 06:58:49 +01:00
|
|
|
tp = tmpbuf+i;
|
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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;
|
|
|
|
|
|
|
|
dump_stack();
|
|
|
|
i = strlen(tmpbuf);
|
|
|
|
nt[0] = MkAtomTerm(Yap_LookupAtom("out_of_attvars_error"));
|
|
|
|
tp = tmpbuf+i;
|
|
|
|
psize -= i;
|
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2004-10-27 16:56:34 +01:00
|
|
|
case OUT_OF_AUXSPACE_ERROR:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
dump_stack();
|
|
|
|
i = strlen(tmpbuf);
|
|
|
|
nt[0] = MkAtomTerm(Yap_LookupAtom("out_of_auxspace_error"));
|
|
|
|
tp = tmpbuf+i;
|
|
|
|
psize -= i;
|
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
2002-10-10 06:58:49 +01:00
|
|
|
case OUT_OF_TRAIL_ERROR:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
dump_stack();
|
|
|
|
i = strlen(tmpbuf);
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = MkAtomTerm(Yap_LookupAtom("out_of_trail_error"));
|
2002-10-10 06:58:49 +01:00
|
|
|
tp = tmpbuf+i;
|
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("access"));
|
|
|
|
ti[1] = MkAtomTerm(Yap_LookupAtom("private_procedure"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("permission_error"),3), 3, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("create"));
|
|
|
|
ti[1] = MkAtomTerm(Yap_LookupAtom("array"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("permission_error"),3), 3, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("create"));
|
|
|
|
ti[1] = MkAtomTerm(Yap_LookupAtom("operator"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("permission_error"),3), 3, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("input"));
|
|
|
|
ti[1] = MkAtomTerm(Yap_LookupAtom("binary_stream"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("permission_error"),3), 3, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("input"));
|
|
|
|
ti[1] = MkAtomTerm(Yap_LookupAtom("past_end_of_stream"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("permission_error"),3), 3, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("input"));
|
|
|
|
ti[1] = MkAtomTerm(Yap_LookupAtom("stream"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("permission_error"),3), 3, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("input"));
|
|
|
|
ti[1] = MkAtomTerm(Yap_LookupAtom("text_stream"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("permission_error"),3), 3, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("modify"));
|
|
|
|
ti[1] = MkAtomTerm(Yap_LookupAtom("static_procedure"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("permission_error"),3), 3, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("new"));
|
|
|
|
ti[1] = MkAtomTerm(Yap_LookupAtom("alias"));
|
2001-04-16 17:41:04 +01:00
|
|
|
ti[2] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("permission_error"),3), 3, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-16 17:41:04 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("open"));
|
|
|
|
ti[1] = MkAtomTerm(Yap_LookupAtom("source_sink"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("permission_error"),3), 3, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("output"));
|
|
|
|
ti[1] = MkAtomTerm(Yap_LookupAtom("binary_stream"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("permission_error"),3), 3, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("output"));
|
|
|
|
ti[1] = MkAtomTerm(Yap_LookupAtom("stream"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("permission_error"),3), 3, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("output"));
|
|
|
|
ti[1] = MkAtomTerm(Yap_LookupAtom("text_stream"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("permission_error"),3), 3, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("reposition"));
|
|
|
|
ti[1] = MkAtomTerm(Yap_LookupAtom("stream"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("permission_error"),3), 3, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("resize"));
|
|
|
|
ti[1] = MkAtomTerm(Yap_LookupAtom("array"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[2] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("permission_error"),3), 3, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("character"));
|
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("representation_error"),1), 1, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("character_code"));
|
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("representation_error"),1), 1, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case REPRESENTATION_ERROR_MAX_ARITY:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[1];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("max_arity"));
|
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("representation_error"),1), 1, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SYNTAX_ERROR:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2002-04-11 16:31:58 +01:00
|
|
|
nt[0] = where;
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SYSTEM_ERROR:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = MkAtomTerm(Yap_LookupAtom("system_error"));
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
2005-05-25 22:43:33 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case INTERNAL_COMPILER_ERROR:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = strlen(tmpbuf);
|
|
|
|
nt[0] = MkAtomTerm(Yap_LookupAtom("internal_compiler_error"));
|
|
|
|
tp = tmpbuf+i;
|
|
|
|
psize -= i;
|
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("array"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("atom"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("atomic"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_ERROR_BYTE:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("byte"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("callable"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("char"));
|
|
|
|
ti[1] = where;
|
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
|
|
|
tp = tmpbuf+i;
|
|
|
|
psize -= i;
|
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
|
|
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("character"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("compound"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("db_reference"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("db_term"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("evaluable"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("float"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("integer"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("key"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("list"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("number"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("predicate_indicator"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("pointer"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
2001-04-09 20:54:03 +01:00
|
|
|
serious = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TYPE_ERROR_UBYTE:
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
Term ti[2];
|
|
|
|
|
2002-02-22 06:12:18 +00:00
|
|
|
i = strlen(tmpbuf);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("unsigned_byte"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("unsigned_char"));
|
|
|
|
ti[1] = where;
|
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
|
|
|
tp = tmpbuf+i;
|
|
|
|
psize -= i;
|
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
|
|
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
ti[0] = MkAtomTerm(Yap_LookupAtom("variable"));
|
2001-04-09 20:54:03 +01:00
|
|
|
ti[1] = where;
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = Yap_MkApplTerm(Yap_MkFunctor(Yap_LookupAtom("type_error"),2), 2, ti);
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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);
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[0] = MkAtomTerm(Yap_LookupAtom("system_error"));
|
2002-02-22 06:12:18 +00:00
|
|
|
tp = tmpbuf+i;
|
2001-04-09 20:54:03 +01:00
|
|
|
psize -= i;
|
2002-11-18 18:18:05 +00:00
|
|
|
fun = Yap_MkFunctor(Yap_LookupAtom("error"),2);
|
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])) {
|
|
|
|
Yap_ErrorMessage = RepAtom(AtomOfTerm(nt[0]))->StrOfAE;
|
|
|
|
} else {
|
|
|
|
Yap_ErrorMessage = RepAtom(NameOfFunctor(FunctorOfTerm(nt[0])))->StrOfAE;
|
|
|
|
}
|
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:
|
2002-11-18 18:18:05 +00:00
|
|
|
nt[1] = MkPairTerm(MkAtomTerm(Yap_LookupAtom(tmpbuf)), Yap_all_calls());
|
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 */
|
|
|
|
ActiveSignals = 0;
|
|
|
|
CreepFlag = CalculateStackGap();
|
2001-04-09 20:54:03 +01:00
|
|
|
if (type == PURE_ABORT)
|
2004-11-19 21:32:53 +00:00
|
|
|
Yap_JumpToEnv(MkAtomTerm(Yap_LookupAtom("$abort")));
|
2001-04-09 20:54:03 +01:00
|
|
|
else
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_JumpToEnv(Yap_MkApplTerm(fun, 2, nt));
|
2001-04-09 20:54:03 +01:00
|
|
|
P = (yamop *)FAILCODE;
|
|
|
|
}
|
2002-11-18 18:18:05 +00:00
|
|
|
Yap_PrologMode &= ~InErrorMode;
|
2005-02-24 21:46:40 +00:00
|
|
|
return P;
|
2001-04-09 20:54:03 +01:00
|
|
|
}
|
|
|
|
|