New comment-based message style

Fix thread support (at least don't deadlock with oneself)
small fixes for coroutining predicates
force Yap to recover space in arrays of dbrefs
use private predicates in debugger.


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1084 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2004-06-23 17:24:20 +00:00
parent 34ea2e6905
commit a7f550d667
24 changed files with 375 additions and 295 deletions

View File

@ -10,8 +10,11 @@
* *
* File: absmi.c *
* comments: Portable abstract machine interpreter *
* Last rev: $Date: 2004-06-17 22:07:22 $,$Author: vsc $ *
* Last rev: $Date: 2004-06-23 17:24:19 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $
* Revision 1.136 2004/06/17 22:07:22 vsc
* bad bug in indexing code.
*
* Revision 1.135 2004/06/09 03:32:02 vsc
* fix bugs
*
@ -91,6 +94,25 @@ AritFunctorOfTerm(Term t) {
#include "arith2.h"
#ifdef THREADS
static int
same_lu_block(yamop **paddr, yamop *p)
{
yamop *np = *paddr;
if (np != p) {
OPCODE jmp_op = Yap_opcode(_jump_if_nonvar);
while (np->opc == jmp_op) {
np = NEXTOP(np, xl);
if (np == p) return TRUE;
}
return FALSE;
} else {
return TRUE;
}
}
#endif
#ifdef COROUTINING
/*
Imagine we are interrupting the execution, say, because we have a spy
@ -1167,6 +1189,7 @@ Yap_absmi(int inp)
BOp(stale_lu_index, Ill);
{
yamop *ipc;
PredEntry *pe = PREG->u.Ill.l1->u.ld.p;
/* update ASP before calling IPred */
ASP = YREG+E_CB;
@ -1174,19 +1197,24 @@ Yap_absmi(int inp)
ASP = (CELL *) B;
}
#if defined(YAPOR) || defined(THREADS)
LOCK(PREG->u.Ill.l1->u.ld.p->PELock);
if (*PREG_ADDR != PREG) {
LOCK(pe->PELock);
if (PP) {
/* PP would be NULL for local preds */
READ_UNLOCK(PP->PRWLock);
PP = NULL;
}
if (!same_lu_block(PREG_ADDR, PREG)) {
PREG = *PREG_ADDR;
UNLOCK(PREG->u.Ill.l1->u.ld.p->PELock);
UNLOCK(pe->PELock);
JMPNext();
}
#endif
saveregs();
ipc = Yap_CleanUpIndex(PREG->u.Ill.I);
setregs();
UNLOCK(PREG->u.Ill.l1->u.ld.p->PELock);
/* restart index */
PREG = ipc;
UNLOCK(pe->PELock);
if (PREG == NULL) FAIL();
CACHED_A1() = ARG1;
JMPNext();
@ -1253,7 +1281,7 @@ Yap_absmi(int inp)
INC_CLREF_COUNT(lcl);
TRAIL_CLREF(lcl);
}
UNLOCK(cl->ClLock);
UNLOCK(lcl->ClLock);
}
Yap_ErLogUpdIndex(cl);
} else {
@ -6484,7 +6512,7 @@ Yap_absmi(int inp)
PP = pe;
}
LOCK(pe->PELock);
if (*PREG_ADDR != PREG) {
if (!same_lu_block(PREG_ADDR, PREG)) {
PREG = *PREG_ADDR;
if (pe->PredFlags & (ThreadLocalPredFlag|LogUpdatePredFlag)) {
READ_UNLOCK(pe->PRWLock);
@ -6526,7 +6554,7 @@ Yap_absmi(int inp)
PP = pe;
}
LOCK(pe->PELock);
if (*PREG_ADDR != PREG) {
if (!same_lu_block(PREG_ADDR, PREG)) {
PREG = *PREG_ADDR;
if (pe->PredFlags & (ThreadLocalPredFlag|LogUpdatePredFlag)) {
READ_UNLOCK(pe->PRWLock);

View File

@ -365,9 +365,9 @@ atom_gc(void)
agc_calls++;
agc_collected = 0;
if (gc_trace) {
fprintf(Yap_stderr, "AGC]\n");
fprintf(Yap_stderr, "%% agc:\n");
} else if (gc_verbose) {
fprintf(Yap_stderr, "[AGC] Start of atom garbage collection %d:\n", agc_calls);
fprintf(Yap_stderr, "%% Start of atom garbage collection %d:\n", agc_calls);
}
time_start = Yap_cputime();
/* get the number of active registers */
@ -380,8 +380,8 @@ atom_gc(void)
tot_agc_time += agc_time;
tot_agc_recovered += agc_collected;
if (gc_verbose) {
fprintf(Yap_stderr, "[AGC] collected %ld bytes.\n", agc_collected);
fprintf(Yap_stderr, "[AGC] GC %d took %g sec, total of %g sec doing GC so far.\n", agc_calls, (double)agc_time/1000, (double)tot_agc_time/1000);
fprintf(Yap_stderr, "%% Collected %ld bytes.\n", agc_collected);
fprintf(Yap_stderr, "%% GC %d took %g sec, total of %g sec doing GC so far.\n", agc_calls, (double)agc_time/1000, (double)tot_agc_time/1000);
}
}

View File

@ -12,7 +12,7 @@
* Last rev: *
* mods: *
* comments: allocating space *
* version:$Id: alloc.c,v 1.50 2004-06-09 03:32:02 vsc Exp $ *
* version:$Id: alloc.c,v 1.51 2004-06-23 17:24:19 vsc Exp $ *
*************************************************************************/
#ifdef SCCS
static char SccsId[] = "%W% %G%";
@ -603,7 +603,7 @@ InitWorkSpace(Int s)
Yap_Error(FATAL_ERROR,TermNil,"VirtualAlloc failed");
return(0);
}
fprintf(stderr,"[ Warning: YAP reserving space at variable address %p ]\n", b);
fprintf(stderr,"% Warning: YAP reserving space at variable address %p\n", b);
}
brk = BASE_ADDRESS;

View File

@ -233,15 +233,23 @@ AccessNamedArray(Atom a, Int indx)
READ_UNLOCK(ptr->ArRWLock);
if (TRef != 0L) {
DBRef ref = DBRefOfTerm(TRef);
#if defined(YAPOR) || defined(THREADS)
LOCK(ref->lock);
INC_DBREF_COUNT(ref);
TRAIL_REF(ref); /* So that fail will erase it */
UNLOCK(ref->lock);
#else
if (!(ref->Flags & InUseMask)) {
ref->Flags |= InUseMask;
TRAIL_REF(ref); /* So that fail will erase it */
if (ref->Flags & LogUpdMask) {
LogUpdClause *cl = (LogUpdClause *)ref;
cl->ClFlags |= InUseMask;
TRAIL_CLREF(cl);
} else {
if (!(ref->Flags & InUseMask)) {
ref->Flags |= InUseMask;
TRAIL_REF(ref); /* So that fail will erase it */
}
}
#endif
} else {
@ -1551,11 +1559,22 @@ p_assign_static(void)
ptr->ValueOfVE.dbrefs[indx]= t3;
if (t0 != 0L) {
DBRef ptr = DBRefOfTerm(t0);
if (ptr->Flags & LogUpdMask) {
LogUpdClause *lup = (LogUpdClause *)ptr;
lup->ClRefCount--;
if (lup->ClRefCount == 0 &&
(lup->ClFlags & ErasedMask) &&
!(lup->ClFlags & InUseMask)) {
Yap_ErLogUpdCl(lup);
}
} else {
ptr->NOfRefsTo--;
if (ptr->NOfRefsTo == 0 &&
(ptr->Flags & ErasedMask) &&
!(ptr->Flags & InUseMask)) {
Yap_ErDBE(ptr);
}
}
}

View File

@ -20,8 +20,6 @@ static char SccsId[]="%W% %G%";
#include "Yap.h"
#ifdef COROUTINING
#include "Yatom.h"
#include "Heap.h"
#include "heapgc.h"
@ -30,6 +28,8 @@ static char SccsId[]="%W% %G%";
#define NULL (void *)0
#endif
#ifdef COROUTINING
STATIC_PROTO(Term InitVarTime, (void));
STATIC_PROTO(Int PutAtt, (attvar_record *,Int,Term));
STATIC_PROTO(Int BuildNewAttVar, (Term,Int,Term));
@ -636,14 +636,14 @@ static Int
p_n_atts(void)
{
Term t = MkIntegerTerm(NUM_OF_ATTS);
return(Yap_unify(ARG1,t));
return Yap_unify(ARG1,t);
}
static Int
p_all_attvars(void)
{
Term t = Yap_ReadTimedVar(AttsMutableList);
return(Yap_unify(ARG1,AllAttVars(t)));
return Yap_unify(ARG1,AllAttVars(t));
}
static Int
@ -666,15 +666,38 @@ p_attvar_bound(void)
!IsUnboundVar(((attvar_record *)VarOfTerm(t))->Done));
}
#else
static Int
p_all_attvars(void)
{
return FALSE;
}
static Int
p_is_attvar(void)
{
return FALSE;
}
static Int
p_attvar_bound(void)
{
return FALSE;
}
#endif /* COROUTINING */
void Yap_InitAttVarPreds(void)
{
Term OldCurrentModule = CurrentModule;
CurrentModule = ATTRIBUTES_MODULE;
#ifdef COROUTINING
attas[attvars_ext].bind_op = WakeAttVar;
attas[attvars_ext].copy_term_op = CopyAttVar;
attas[attvars_ext].to_term_op = AttVarToTerm;
attas[attvars_ext].term_to_op = TermToAttVar;
attas[attvars_ext].mark_op = mark_attvar;
CurrentModule = ATTRIBUTES_MODULE;
Yap_InitCPred("get_att", 3, p_get_att, SafePredFlag);
Yap_InitCPred("get_all_atts", 2, p_get_all_atts, SafePredFlag);
Yap_InitCPred("free_att", 2, p_free_att, SafePredFlag);
@ -684,12 +707,12 @@ void Yap_InitAttVarPreds(void)
Yap_InitCPred("inc_n_of_atts", 1, p_inc_atts, SafePredFlag);
Yap_InitCPred("n_of_atts", 1, p_n_atts, SafePredFlag);
Yap_InitCPred("bind_attvar", 1, p_bind_attvar, SafePredFlag);
#endif /* COROUTINING */
Yap_InitCPred("all_attvars", 1, p_all_attvars, SafePredFlag);
CurrentModule = OldCurrentModule;
Yap_InitCPred("$is_att_variable", 1, p_is_attvar, SafePredFlag|TestPredFlag);
Yap_InitCPred("$att_bound", 1, p_attvar_bound, SafePredFlag|TestPredFlag);
}
#endif /* COROUTINING */

View File

@ -554,8 +554,8 @@ Yap_InitCoroutPreds(void)
at = Yap_LookupAtom("$wake_up_goal");
pred = RepPredProp(PredPropByFunc(Yap_MkFunctor(at, 2),0));
WakeUpCode = pred;
#endif
Yap_InitAttVarPreds();
#endif /* COROUTINING */
Yap_InitCPred("$yap_has_rational_trees", 0, p_yap_has_rational_trees, SafePredFlag);
Yap_InitCPred("$yap_has_coroutining", 0, p_yap_has_coroutining, SafePredFlag);
Yap_InitCPred("$read_svar_list", 1, p_read_svar_list, SafePredFlag);

View File

@ -3895,10 +3895,18 @@ static void
EraseLogUpdCl(LogUpdClause *clau)
{
PredEntry *ap;
#if defined(YAPOR) || defined(THREADS)
int i_locked = FALSE;
#endif
ap = clau->ClPred;
#if defined(YAPOR) || defined(THREADS)
if (WPP != ap) {
WRITE_LOCK(ap->PRWLock);
if (WPP == NULL) {
i_locked = TRUE;
WPP = ap;
}
}
#endif
LOCK(clau->ClLock);
@ -3958,7 +3966,8 @@ EraseLogUpdCl(LogUpdClause *clau)
UNLOCK(clau->ClLock);
complete_lu_erase(clau);
#if defined(YAPOR) || defined(THREADS)
if (WPP != ap) {
if (WPP != ap || i_locked) {
if (i_locked) WPP= NULL;
WRITE_UNLOCK(ap->PRWLock);
}
#endif
@ -4030,7 +4039,7 @@ static void
PrepareToEraseLogUpdClause(LogUpdClause *clau, DBRef dbr)
{
yamop *code_p = clau->ClCode;
PredEntry *p = (PredEntry *)(code_p->u.ld.p);
PredEntry *p = clau->ClPred;
yamop *cl = code_p;
if (clau->ClFlags & ErasedMask)

View File

@ -292,9 +292,9 @@ dump_stack(void)
CELL *env_ptr = ENV;
if (H > ASP || H > LCL0) {
fprintf(stderr,"[ YAP ERROR: Global Collided against Local ]\n");
fprintf(stderr,"%% YAP ERROR: Global Collided against Local\n");
} else if (HeapTop > (ADDR)Yap_GlobalBase) {
fprintf(stderr,"[ YAP ERROR: Code Space Collided against Global ]\n");
fprintf(stderr,"%% YAP ERROR: Code Space Collided against Global\n");
} else {
if (b_ptr != NULL) {
fprintf(stderr," [ Goals with alternatives open:\n");
@ -302,7 +302,7 @@ dump_stack(void)
cl_position(b_ptr->cp_ap);
b_ptr = b_ptr->cp_b;
}
fprintf(stderr," ]\n");
fprintf(stderr,"\n");
}
if (env_ptr != NULL) {
fprintf(stderr," [ Goals left to continue:\n");
@ -310,7 +310,7 @@ dump_stack(void)
cl_position((yamop *)(env_ptr[E_CP]));
env_ptr = (CELL *)(env_ptr[E_E]);
}
fprintf(stderr," ]\n");
fprintf(stderr,"\n");
}
}
}
@ -356,7 +356,7 @@ Yap_Error (yap_error_number type, Term where, char *format,...)
int psize = YAP_BUF_SIZE;
if (type == INTERRUPT_ERROR) {
fprintf(stderr,"[ YAP exiting: cannot handle signal %d ]\n",
fprintf(stderr,"%% YAP exiting: cannot handle signal %d\n",
(int)IntOfTerm(where));
Yap_exit(1);
}
@ -375,7 +375,7 @@ Yap_Error (yap_error_number type, Term where, char *format,...)
tmpbuf[0] = '\0';
}
va_end (ap);
fprintf(stderr,"[ ERROR WITHIN ERROR: %s ]\n", tmpbuf);
fprintf(stderr,"%% ERROR WITHIN ERROR: %s\n", tmpbuf);
exit(1);
}
/* must do this here */
@ -396,7 +396,7 @@ Yap_Error (yap_error_number type, Term where, char *format,...)
tmpbuf[0] = '\0';
}
va_end (ap);
fprintf(stderr,"[ Fatal YAP Error: %s exiting.... ]\n",tmpbuf);
fprintf(stderr,"%% Fatal YAP Error: %s exiting....\n",tmpbuf);
error_exit_yap (1);
}
if (P == (yamop *)(FAILCODE))
@ -435,7 +435,7 @@ Yap_Error (yap_error_number type, Term where, char *format,...)
va_end (ap);
if (Yap_PrologMode & BootMode) {
/* crash in flames! */
fprintf(stderr,"[ Fatal Error: %s exiting.... ]\n",tmpbuf);
fprintf(stderr,"%% Fatal Error: %s exiting....\n",tmpbuf);
error_exit_yap (1);
}
#ifdef DEBUGX
@ -444,15 +444,15 @@ Yap_Error (yap_error_number type, Term where, char *format,...)
switch (type) {
case INTERNAL_ERROR:
{
fprintf(stderr,"[ Internal YAP Error: %s exiting.... ]\n",tmpbuf);
fprintf(stderr,"%% Internal YAP Error: %s exiting....\n",tmpbuf);
serious = TRUE;
detect_bug_location(P, tmpbuf, YAP_BUF_SIZE);
fprintf(stderr,"[ Bug found while executing %s ]\n",tmpbuf);
fprintf(stderr,"%% Bug found while executing %s\n",tmpbuf);
error_exit_yap (1);
}
case FATAL_ERROR:
{
fprintf(stderr,"[ Fatal YAP Error: %s exiting.... ]\n",tmpbuf);
fprintf(stderr,"%% Fatal YAP Error: %s exiting....\n",tmpbuf);
error_exit_yap (1);
}
case INTERRUPT_ERROR:

View File

@ -254,7 +254,7 @@ AdjustAppl(register CELL t0)
#ifdef DEBUG
else {
/* strange cell */
/* fprintf(Yap_stderr,"[ garbage appl %lx found in stacks by stack shifter ]\n", t0);*/
/* fprintf(Yap_stderr,"% garbage appl %lx found in stacks by stack shifter\n", t0);*/
}
#endif
return(t0);
@ -274,7 +274,7 @@ AdjustPair(register CELL t0)
else if (IsHeapP(t))
return (AbsPair(CellPtoHeapAdjust(t)));
#ifdef DEBUG
/* fprintf(Yap_stderr,"[ garbage pair %lx found in stacks by stack shifter ]\n", t0);*/
/* fprintf(Yap_stderr,"% garbage pair %lx found in stacks by stack shifter\n", t0);*/
#endif
return(t0);
}
@ -313,7 +313,7 @@ AdjustTrail(int adjusting_heap)
}
#ifdef DEBUG
else
fprintf(Yap_stderr,"[ garbage heap ptr %p to %lx found in trail at %p by stack shifter ]\n", ptr, (unsigned long int)*ptr, ptt);
fprintf(Yap_stderr,"%% garbage heap ptr %p to %lx found in trail at %p by stack shifter\n", ptr, (unsigned long int)*ptr, ptt);
#endif
}
} else if (IsPairTerm(reg)) {
@ -820,20 +820,20 @@ growstack(long size)
gc_verbose = Yap_is_gc_verbose();
stack_overflows++;
if (gc_verbose) {
fprintf(Yap_stderr, "[SO] Stack Overflow %d\n", stack_overflows);
fprintf(Yap_stderr, "[SO] Heap: %8ld cells (%p-%p)\n", (unsigned long int)(H-(CELL *)Yap_GlobalBase),Yap_GlobalBase,H);
fprintf(Yap_stderr, "[SO] Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP);
fprintf(Yap_stderr, "[SO] Trail:%8ld cells (%p-%p)\n",
fprintf(Yap_stderr, "%% Stack Overflow %d\n", stack_overflows);
fprintf(Yap_stderr, "%% Heap: %8ld cells (%p-%p)\n", (unsigned long int)(H-(CELL *)Yap_GlobalBase),Yap_GlobalBase,H);
fprintf(Yap_stderr, "%% Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP);
fprintf(Yap_stderr, "%% Trail:%8ld cells (%p-%p)\n",
(unsigned long int)(TR-(tr_fr_ptr)Yap_TrailBase),Yap_TrailBase,TR);
fprintf(Yap_stderr, "[SO] growing the stacks %ld bytes\n", size);
fprintf(Yap_stderr, "%% Growing the stacks %ld bytes\n", size);
}
if (!execute_growstack(size, FALSE))
return FALSE;
growth_time = Yap_cputime()-start_growth_time;
total_stack_overflow_time += growth_time;
if (gc_verbose) {
fprintf(Yap_stderr, "[SO] took %g sec\n", (double)growth_time/1000);
fprintf(Yap_stderr, "[SO] Total of %g sec expanding stacks \n", (double)total_stack_overflow_time/1000);
fprintf(Yap_stderr, "%% took %g sec\n", (double)growth_time/1000);
fprintf(Yap_stderr, "%% Total of %g sec expanding stacks \n", (double)total_stack_overflow_time/1000);
}
return(TRUE);
}
@ -936,12 +936,12 @@ Yap_growstack_in_parser(tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep)
gc_verbose = Yap_is_gc_verbose();
stack_overflows++;
if (gc_verbose) {
fprintf(Yap_stderr, "[SO] Stack overflow %d\n", stack_overflows);
fprintf(Yap_stderr, "[SO] Heap: %8ld cells (%p-%p)\n", (unsigned long int)(H-(CELL *)Yap_GlobalBase),(CELL *)Yap_GlobalBase,H);
fprintf(Yap_stderr, "[SO] Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP);
fprintf(Yap_stderr, "[SO] Trail:%8ld cells (%p-%p)\n",
fprintf(Yap_stderr, "%% Stack overflow %d\n", stack_overflows);
fprintf(Yap_stderr, "%% Heap: %8ld cells (%p-%p)\n", (unsigned long int)(H-(CELL *)Yap_GlobalBase),(CELL *)Yap_GlobalBase,H);
fprintf(Yap_stderr, "%% Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP);
fprintf(Yap_stderr, "%% Trail:%8ld cells (%p-%p)\n",
(unsigned long int)(TR-(tr_fr_ptr)Yap_TrailBase),Yap_TrailBase,TR);
fprintf(Yap_stderr, "[SO] growing the stacks %ld bytes\n", size);
fprintf(Yap_stderr, "%% growing the stacks %ld bytes\n", size);
}
TrDiff = LDiff = size;
XDiff = HDiff = GDiff = DelayDiff = 0;
@ -964,8 +964,8 @@ Yap_growstack_in_parser(tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep)
growth_time = Yap_cputime()-start_growth_time;
total_stack_overflow_time += growth_time;
if (gc_verbose) {
fprintf(Yap_stderr, "[SO] took %g sec\n", (double)growth_time/1000);
fprintf(Yap_stderr, "[SO] Total of %g sec expanding stacks \n", (double)total_stack_overflow_time/1000);
fprintf(Yap_stderr, "%% took %g sec\n", (double)growth_time/1000);
fprintf(Yap_stderr, "%% Total of %g sec expanding stacks \n", (double)total_stack_overflow_time/1000);
}
return(TRUE);
}
@ -979,14 +979,14 @@ static int do_growtrail(long size)
size = AdjustPageSize(size);
trail_overflows++;
if (gc_verbose) {
fprintf(Yap_stderr, "[TO] Trail overflow %d\n", trail_overflows);
fprintf(Yap_stderr, "%% Trail overflow %d\n", trail_overflows);
#if USE_SYSTEM_MALLOC
fprintf(Yap_stderr, "[TO] Heap: %8ld cells (%p-%p)\n", (unsigned long int)(H-(CELL *)Yap_GlobalBase),(CELL *)Yap_GlobalBase,H);
fprintf(Yap_stderr, "[TO] Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP);
fprintf(Yap_stderr, "[TO] Trail:%8ld cells (%p-%p)\n",
fprintf(Yap_stderr, "%% Heap: %8ld cells (%p-%p)\n", (unsigned long int)(H-(CELL *)Yap_GlobalBase),(CELL *)Yap_GlobalBase,H);
fprintf(Yap_stderr, "%% Local:%8ld cells (%p-%p)\n", (unsigned long int)(LCL0-ASP),LCL0,ASP);
fprintf(Yap_stderr, "%% Trail:%8ld cells (%p-%p)\n",
(unsigned long int)(TR-(tr_fr_ptr)Yap_TrailBase),Yap_TrailBase,TR);
#endif
fprintf(Yap_stderr, "[TO] growing the trail %ld bytes\n", size);
fprintf(Yap_stderr, "%% growing the trail %ld bytes\n", size);
}
Yap_ErrorMessage = NULL;
#if USE_SYSTEM_MALLOC
@ -1003,8 +1003,8 @@ static int do_growtrail(long size)
growth_time = Yap_cputime()-start_growth_time;
total_trail_overflow_time += growth_time;
if (gc_verbose) {
fprintf(Yap_stderr, "[TO] took %g sec\n", (double)growth_time/1000);
fprintf(Yap_stderr, "[TO] Total of %g sec expanding trail \n", (double)total_trail_overflow_time/1000);
fprintf(Yap_stderr, "%% took %g sec\n", (double)growth_time/1000);
fprintf(Yap_stderr, "%% Total of %g sec expanding trail \n", (double)total_trail_overflow_time/1000);
}
LOCK(SignalLock);
if (ActiveSignals == YAP_TROVF_SIGNAL) {
@ -1076,8 +1076,8 @@ Yap_growatomtable(void)
}
atom_table_overflows++;
if (gc_verbose) {
fprintf(Yap_stderr, "[AO] Atom Table overflow %d\n", atom_table_overflows);
fprintf(Yap_stderr, "[AO] growing the atom table to %ld entries\n", (long int)(nsize));
fprintf(Yap_stderr, "%% Atom Table overflow %d\n", atom_table_overflows);
fprintf(Yap_stderr, "%% growing the atom table to %ld entries\n", (long int)(nsize));
}
YAPEnterCriticalSection();
for (i = 0; i < nsize; ++i) {
@ -1109,8 +1109,8 @@ Yap_growatomtable(void)
growth_time = Yap_cputime()-start_growth_time;
total_atom_table_overflow_time += growth_time;
if (gc_verbose) {
fprintf(Yap_stderr, "[AO] took %g sec\n", (double)growth_time/1000);
fprintf(Yap_stderr, "[AO] Total of %g sec expanding atom table \n", (double)total_atom_table_overflow_time/1000);
fprintf(Yap_stderr, "%% took %g sec\n", (double)growth_time/1000);
fprintf(Yap_stderr, "%% Total of %g sec expanding atom table \n", (double)total_atom_table_overflow_time/1000);
}
}

View File

@ -569,7 +569,7 @@ Yap_DebugSetIFile(char *fname)
curfile = YP_fopen(fname, "r");
if (curfile == NULL) {
curfile = stdin;
fprintf(stderr,"[ Warning: can not open %s for input]\n", fname);
fprintf(stderr,"%% YAP Warning: can not open %s for input\n", fname);
}
}
@ -2469,7 +2469,7 @@ Yap_CloseStreams (int loud)
YP_fclose (Stream[sno].u.file.file);
else {
if (loud)
fprintf (Yap_stderr, "[ Error: while closing stream: %s ]\n", RepAtom (Stream[sno].u.file.name)->StrOfAE);
fprintf (Yap_stderr, "%% YAP Error: while closing stream: %s\n", RepAtom (Stream[sno].u.file.name)->StrOfAE);
}
if (Yap_c_input_stream == sno)
{

View File

@ -49,7 +49,7 @@ LoadForeign(StringList ofiles, StringList libs,
/* dlopen wants to follow the LD_CONFIG_PATH */
if (!Yap_TrueFileName(ofiles->s, Yap_FileNameBuf, TRUE)) {
strcpy(Yap_ErrorSay, "[ Trying to open unexisting file in LoadForeign ]");
strcpy(Yap_ErrorSay, "%% Trying to open unexisting file in LoadForeign");
return LOAD_FAILLED;
}
#ifdef __osf__

View File

@ -123,7 +123,7 @@ LoadForeign(StringList ofiles, StringList libs,
/* mydlopen wants to follow the LD_CONFIG_PATH */
if (!Yap_TrueFileName(ofiles->s, Yap_FileNameBuf, TRUE)) {
strcpy(Yap_ErrorSay, "[ Trying to open unexisting file in LoadForeign ]");
strcpy(Yap_ErrorSay, "%% Trying to open unexisting file in LoadForeign");
return LOAD_FAILLED;
}
if((handle=mydlopen(Yap_FileNameBuf)) == 0)

View File

@ -44,7 +44,7 @@ LoadForeign( StringList ofiles, StringList libs,
valid_fname = Yap_TrueFileName( ofiles->s, Yap_FileNameBuf, TRUE );
if( !valid_fname ) {
strcpy( Yap_ErrorSay, "[ Trying to open non-existing file in LoadForeign ]" );
strcpy( Yap_ErrorSay, "%% Trying to open non-existing file in LoadForeign" );
return LOAD_FAILLED;
}

View File

@ -1182,7 +1182,7 @@ commit_to_saved_state(char *s, CELL *Astate, CELL *ATrail, CELL *AStack, CELL *A
if (Yap_HeapBase) {
if (!yap_flags[HALT_AFTER_CONSULT_FLAG]) {
Yap_TrueFileName(s,Yap_FileNameBuf2, YAP_FILENAME_MAX);
fprintf(stderr, "[ Restoring file %s ]\n", Yap_FileNameBuf2);
fprintf(stderr, "%% Restoring file %s\n", Yap_FileNameBuf2);
}
Yap_CloseStreams(TRUE);
}

View File

@ -1048,7 +1048,7 @@ static RETSIGTYPE
HandleSIGSEGV(int sig)
{
if (Yap_PrologMode & ExtendStackMode) {
fprintf(stderr, "[ FATAL ERROR: OS memory allocation crashed: bailing out ]~n");
fprintf(stderr, "%% YAP FATAL ERROR: OS memory allocation crashed: bailing out~n");
exit(1);
}
SearchForTrailFault();

View File

@ -2546,7 +2546,8 @@ The user may also define clauses for
@code{user:unknown_predicate_handler/3} hook predicate. This
user-defined procedure is called before any system processing for the
undefined procedure, with the first argument @var{G} set to the current
goal, and the second @var{M} set to the current module.
goal, and the second @var{M} set to the current module. The predicate
@var{G} will be called from within the user module.
If @code{user:unknown_predicate_handler/3} succeeds, the system will
execute @var{NG}. If @code{user:unknown_predicate_handler/3} fails, the

View File

@ -124,11 +124,11 @@ read_sig.
'$system_catch'('$do_yes_no'((G->true),user),user,Error,user:'$Error'(Error)),
fail.
'$enter_top_level' :-
( get_value('$trace', 1) ->
'$format'(user_error, '[trace]~n', [])
( recorded('$trace', on, _) ->
'$format'(user_error, '% trace~n', [])
;
get_value(debug, 1) ->
'$format'(user_error, '[debug]~n', [])
recorded('$debug', on, _) ->
'$format'(user_error, '% debug~n', [])
),
fail.
'$enter_top_level' :-
@ -136,11 +136,9 @@ read_sig.
prompt(' | '),
'$run_toplevel_hooks',
'$read_vars'(user_input,Command,_,Varnames),
set_value(spy_fs,0),
set_value(spy_sp,0),
set_value(spy_gn,1),
set_value(spy_skip,off),
set_value(spy_stop,on),
( recorded('$spy_skip',_,R), erase(R), fail ; true),
( recorded('$spy_stop',_,R), erase(R), fail ; true),
prompt(_,' |: '),
'$command'((?-Command),Varnames,top),
'$sync_mmapped_arrays',
@ -434,7 +432,7 @@ repeat :- '$repeat'.
'$start_creep' :-
( get_value('$trace', 1) ->
( recorded('$trace', on, _) ->
'$creep'
;
true
@ -451,6 +449,8 @@ repeat :- '$repeat'.
'$format'(user_error,'~ntrue',[]).
'$write_query_answer_true'(_).
'$show_frozen'(_,_,[]) :-
'$undefined'(all_attvars(LAV), attributes), !.
'$show_frozen'(G,V,LGs) :-
attributes:all_attvars(LAV),
LAV = [_|_], !,
@ -795,7 +795,7 @@ incore(G) :- '$execute'(G).
'$undefp'([M|G]) :-
\+ '$undefined'(unknown_predicate_handler(_,_,_), user),
user:unknown_predicate_handler(G,M,NG), !,
'$execute'(M:NG).
'$execute'(user:NG).
'$undefp'([M|G]) :-
recorded('$unknown','$unknown'(M:G,US),_), !,
'$execute'(user:US).
@ -806,20 +806,16 @@ incore(G) :- '$execute'(G).
debugger state */
break :- get_value('$break',BL), NBL is BL+1,
get_value(spy_fs,SPY_FS),
get_value(spy_sp,SPY_SP),
get_value(spy_gn,SPY_GN),
'$access_yap_flags'(10,SPY_CREEP),
get_value(spy_cl,SPY_CL),
get_value(spy_leap,_Leap),
set_value('$break',NBL),
current_output(OutStream), current_input(InpStream),
'$format'(user_error, '[ Break (level ~w) ]~n', [NBL]),
'$format'(user_error, '% Break (level ~w)~n', [NBL]),
'$do_live',
!,
set_value('$live','$true'),
get_value(spy_fs,SPY_FS),
set_value(spy_sp,SPY_SP),
set_value(spy_gn,SPY_GN),
'$set_yap_flags'(10,SPY_CREEP),
set_value(spy_cl,SPY_CL),
@ -875,7 +871,7 @@ break :- get_value('$break',BL), NBL is BL+1,
recorda('$initialisation','$',_),
( '$undefined'('$print_message'(_,_),prolog) ->
( get_value('$verbose',on) ->
'$format'(user_error, '~*|[ consulting ~w... ]~n', [LC,F])
'$format'(user_error, '~*|% consulting ~w...~n', [LC,F])
; true )
;
'$print_message'(informational, loading(consulting, File))
@ -891,7 +887,7 @@ break :- get_value('$break',BL), NBL is BL+1,
H is heapused-H0, '$cputime'(TF,_), T is TF-T0,
( '$undefined'('$print_message'(_,_),prolog) ->
( get_value('$verbose',on) ->
'$format'(user_error, '~*|[ ~w consulted ~w bytes in ~d msecs ]~n', [LC,F,H,T])
'$format'(user_error, '~*|% ~w consulted ~w bytes in ~d msecs~n', [LC,F,H,T])
;
true
)

View File

@ -23,6 +23,8 @@
:- op(900,fx,[spy,nospy]).
:- thread_local([idb:'$debug',idb:'$trace',idb:'$spy_skip',idb:'$spy_stop']).
% First part : setting and reseting spy points
% $suspy does most of the work
@ -94,7 +96,6 @@
'$print_message'(informational,breakp(bp(debugger,plain,M:T,M:F/N,N),add,already)).
'$suspy2'(spy,F,N,T,M) :- !,
recorda('$spy','$spy'(T,M),_),
set_value('$spypoint_added', true),
'$set_spy'(T,M),
'$print_message'(informational,breakp(bp(debugger,plain,M:T,M:F/N,N),add,ok)).
'$suspy2'(nospy,F,N,T,M) :-
@ -108,11 +109,9 @@
'$pred_being_spied'(G, M) :-
recorded('$spy','$spy'(G,M),_), !.
spy _ :- set_value('$spypoint_added', false), fail.
spy L :-
'$current_module'(M),
'$suspy'(L, spy, M), fail.
spy _ :- get_value('$spypoint_added', false), !.
spy _ :- debug.
nospy L :-
@ -126,29 +125,35 @@ nospyall.
% debug mode -> debug flag = 1
debug :- get_value(debug,1), !.
debug :- set_value(debug,1),
debug :- recordaifnot('$debug',on,_), !,
'$print_message'(informational,debug(debug)).
debug.
nodebug :-
recorded('$debug',_,R), erase(R), fail.
nodebug :-
recorded('$trace',_,R), erase(R), fail.
nodebug :- nospyall,
set_value(debug,0),
set_value('$trace',0),
'$set_yap_flags'(10,0),
'$print_message'(informational,debug(off)).
trace :- get_value('$trace',1), !.
trace :-
recorded('$trace',on,_), !.
trace :-
recorded('$spy_skip',_,R), erase(R), fail.
trace :-
'$print_message'(informational,debug(trace)),
set_value('$trace',1),
set_value(debug,1),
set_value(spy_skip,off),
set_value(spy_stop,on),
( recordaifnot('$trace',on,_) -> true ; true),
( recordaifnot('$debug',on,_) -> true ; true),
( recordaifnot('$spy_stop',on,_) -> true ; true),
'$set_yap_flags'(10,1),
'$creep'.
notrace :-
set_value('$trace',0),
set_value(debug,0),
recorded('$debug',_,R), erase(R), fail.
notrace :-
recorded('$trace',_,R), erase(R), fail.
notrace :-
'$print_message'(informational,debug(off)).
/*-----------------------------------------------------------------------------
@ -207,7 +212,7 @@ leash(X) :-
-----------------------------------------------------------------------------*/
debugging :-
( get_value(debug,1) ->
( recorded('$debug',on,_) ->
'$print_message'(help,debug(debug))
;
'$print_message'(help,debug(off))
@ -365,15 +370,14 @@ debugging :-
'$trace'(P,G,Module,GoalNumber).
'$avoid_goal'(GoalNumber, G, Module) :-
get_value(debug,0), !.
\+ recorded('$debug',on,_), !.
'$avoid_goal'(GoalNumber, G, Module) :-
get_value(spy_skip, Value),
number(Value), % we are in skip mode
recorded('$spy_skip', Value, _),
'$continue_avoid_goal'(GoalNumber, G, Module, Value).
% for leap keep on going until finding something spied.
'$continue_avoid_goal'(_, G, Module, _) :-
get_value(spy_stop, on), !,
recorded('$spy_stop', on, _), !,
\+ '$pred_being_spied'(G, Module).
% fpr skip keep on going until we get back.
'$continue_avoid_goal'(GoalNumber, _, _, Value) :-
@ -401,12 +405,11 @@ debugging :-
'$trace'(P,G,Module,L) :-
flush_output(user_output),
flush_output(user_error),
get_value(debug,1),
recorded('$debug',on,R0), erase(R0),
repeat,
('$pred_being_spied'(G,Module) -> CSPY = '*' ; CSPY = ' '),
( SL = L -> SLL = '>' ; SLL = ' '),
get_value(debug,OldDebug),
set_value(debug,0),
( recorded('$debug',on, R), erase(R), fail ; true),
( Module\=prolog,
Module\=user ->
'$format'(user_error,"~a~a (~d) ~q: ~a:",[CSPY,SLL,L,P,Module])
@ -414,7 +417,7 @@ debugging :-
'$format'(user_error,"~a~a (~d) ~q:",[CSPY,SLL,L,P])
),
'$debugger_write'(user_error,G),
set_value(debug,OldDebug),
( nonvar(R0), recordaifnot('$debug',on,_), fail ; true),
(
'$unleashed'(P),
'$action'(10,P,L,G,Module)
@ -438,7 +441,7 @@ debugging :-
writeq(Stream, G).
'$action'(10,_,_,_,_) :- % newline creep
set_value(spy_skip,off),
( recorded('$spy_skip',_,R), erase(R), fail ; true ),
'$set_yap_flags'(10,1).
'$action'(33,_,_,_,_) :- !, % ! g execute
read(user,G),
@ -501,18 +504,18 @@ debugging :-
'$action'(0'l,_,CallNumber,_,_) :- !, % l leap
'$skipeol'(0'l),
'$set_yap_flags'(10,1),
set_value(spy_skip,CallNumber),
set_value(spy_stop,on).
( recorded('$spy_skip',_,R), erase(R), fail ; recorda('$spy_skip',CallNumber,_) ),
( recordaifnot('$spy_stop',on,_) -> true ; true ).
'$action'(0'n,_,_,_,_) :- !, % n nodebug
'$skipeol'(0'n),
'$set_yap_flags'(10,0),
set_value(spy_stop,off),
( recorded('$spy_stop',_,R), erase(R), fail ; true).
nodebug.
'$action'(0'k,_,CallNumber,_,_) :- !, % k quasi leap
'$skipeol'(0'k),
'$set_yap_flags'(10,0),
set_value(spy_skip,CallNumber),
set_value(spy_stop,on).
( recorded('$spy_skip',_,R), erase(R), fail ; recorda('$spy_skip',CallNumber,_) ),
( recordaifnot('$spy_stop',on,_) -> true ; true ).
% skip first call (for current goal),
% stop next time.
'$action'(0'r,P,CallId,_,_) :- !, % r retry
@ -522,17 +525,17 @@ debugging :-
'$skipeol'(0's),
( (P=call; P=redo) ->
'$set_yap_flags'(10,1),
set_value(spy_skip,CallNumber),
set_value(spy_stop,off)
( recorded('$spy_skip',_,R), erase(R), fail ; recorda('$spy_skip',CallNumber,_) ),
( recorded('$spy_stop',_,R), erase(R), fail ; true)
;
'$ilgl'(0's)
).
'$action'(0't,P,CallNumber,_,_) :- !, % t fast skip
'$skipeol'(0't),
( (P=call; P=redo) ->
set_value(spy_skip,CallNumber),
( recorded('$spy_skip',_,R), erase(R), fail ; recorda('$spy_skip',CallNumber,_) ),
'$set_yap_flags'(10,0),
set_value(spy_stop,off)
( recorded('$spy_stop',_,R), erase(R), fail ; true)
;
'$ilgl'(0't)
).
@ -555,7 +558,7 @@ debugging :-
'$access_yap_flags'(10,1), !,
'$creep'.
'$continue_debugging'(_) :-
get_value(spy_stop, On).
recorded('$spy_stop', _, _).
'$stop_debugging' :-
'$stop_creep'.
@ -575,7 +578,8 @@ debugging :-
'$format'(user_error,"! g execute goal~n", []).
'$ilgl'(C) :-
'$format'(user_error,"[ Illegal option ~d. Use h for help. ]. ~n", [C]).
'$print_message'(warning, trace_command(C)),
'$print_message'(help, trace_help).
'$skipeol'(10) :- !.
'$skipeol'(_) :- get0(user,C), '$skipeol'(C).

View File

@ -342,7 +342,7 @@ yap_flag(language,X) :-
yap_flag(debug,X) :-
var(X), !,
(get_value(debug,1) ->
(recorded('$debug',on,_) ->
X = on
;
X = off

View File

@ -11,8 +11,11 @@
* File: errors.yap *
* comments: error messages for YAP *
* *
* Last rev: $Date: 2004-06-18 15:41:19 $,$Author: vsc $ *
* Last rev: $Date: 2004-06-23 17:24:20 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $
* Revision 1.52 2004/06/18 15:41:19 vsc
* fix extraneous line in yes/no messages
*
* Revision 1.51 2004/06/09 03:32:03 vsc
* fix bugs
*
@ -62,7 +65,7 @@ print_message(Level, Mss) :-
user:portray_message(Severity, Msg), !.
'$print_message'(error,error(Msg,Info)) :-
( var(Msg) ; var(Info) ), !,
'$format'(user_error,'[ No handler for error ~w ]~n', [error(Msg,Info)]).
'$format'(user_error,'% YAP: no handler for error ~w~n', [error(Msg,Info)]).
'$print_message'(error,error(syntax_error(A,B,C,D,E,F),_)) :- !,
'$output_error_message'(syntax_error(A,B,C,D,E,F), 'SYNTAX ERROR').
'$print_message'(error,error(Msg,[Info|local_sp(Where,Envs,CPs)])) :-
@ -73,58 +76,42 @@ print_message(Level, Mss) :-
'$print_message'(error,error(Type,Where)) :-
'$output_error_message'(Type, Where), !.
'$print_message'(error,Throw) :-
'$format'(user_error,'[ No handler for error ~w ]~n', [Throw]).
'$format'(user_error,'% YAP: no handler for error ~w~n', [Throw]).
'$print_message'(informational,M) :-
( get_value('$verbose',on) ->
'$do_informational_message'(M) ;
true
).
'$print_message'(warning,M) :-
'$format'(user_error, '[ ', []),
'$format'(user_error, '% ', []),
'$do_print_message'(M),
'$format'(user_error, ' ]~n', []).
'$format'(user_error, '~n', []).
'$print_message'(help,M) :-
'$do_print_message'(M),
'$format'(user_error, '~n', []).
'$do_informational_message'(halt) :- !,
'$format'(user_error, '[ Prolog execution halted ]~n', []).
'$format'(user_error, '% YAP execution halted~n', []).
'$do_informational_message'(abort(_)) :- !,
'$format'(user_error, '[ Execution Aborted ]~n', []).
'$format'(user_error, '% YAP execution aborted~n', []).
'$do_informational_message'(loading(_,user)) :- !.
'$do_informational_message'(loading(What,AbsoluteFileName)) :- !,
'$show_consult_level'(LC),
'$format'(user_error, '~*|[ ~a ~a... ]~n', [LC, What, AbsoluteFileName]).
'$format'(user_error, '~*|% ~a ~a...~n', [LC, What, AbsoluteFileName]).
'$do_informational_message'(loaded(_,user,_,_,_)) :- !.
'$do_informational_message'(loaded(What,AbsoluteFileName,Mod,Time,Space)) :- !,
'$show_consult_level'(LC0),
LC is LC0+1,
'$format'(user_error, '~*|[ ~a ~a in module ~a, ~d msec ~d bytes ]~n', [LC, What, AbsoluteFileName,Mod,Time,Space]).
'$format'(user_error, '~*|% ~a ~a in module ~a, ~d msec ~d bytes~n', [LC, What, AbsoluteFileName,Mod,Time,Space]).
'$do_informational_message'(M) :-
'$format'(user_error,'[ ', []),
'$format'(user_error,'% ', []),
'$do_print_message'(M),
'$format'(user_error,' ]~n', []).
'$format'(user_error,'~n', []).
%message(loaded(Past,AbsoluteFileName,user,Msec,Bytes), Prefix, Suffix) :- !,
'$do_print_message'(no) :- !,
'$format'(user_error, 'no', []).
'$do_print_message'(yes) :- !,
'$format'(user_error, 'yes', []).
'$do_print_message'(debug(debug)) :- !,
'$format'(user_error,'Debug mode on.',[]).
'$do_print_message'(debug(off)) :- !,
'$format'(user_error,'Debug mode off.',[]).
'$do_print_message'(debug(trace)) :- !,
'$format'(user_error,'Trace mode on.',[]).
'$do_print_message'('$format'(Msg, Args)) :- !,
'$format'(user_error,Msg,Args).
'$do_print_message'(import(Pred,To,From,private)) :- !,
'$format'(user_error,'Importing private predicate ~w:~w to ~w.',
[From,Pred,To]).
'$do_print_message'(no_match(P)) :- !,
'$format'(user_error,'No matching predicate for ~w.',
[P]).
'$do_print_message'(breakp(bp(debugger,_,_,M:F/N,_),add,already)) :- !,
'$format'(user_error,'There is already a spy point on ~w:~w/~w.',
[M,F,N]).
@ -137,20 +124,40 @@ print_message(Level, Mss) :-
'$do_print_message'(breakp(no,breakpoint_for,M:F/N)) :- !,
'$format'(user_error,'There is no spy point on ~w:~w/~w.',
[M,F,N]).
'$do_print_message'(leash([])) :- !,
'$format'(user_error,'No leashing.',
[M,F,N]).
'$do_print_message'(leash([A|B])) :- !,
'$format'(user_error,'Leashing set to ~w.',
[[A|B]]).
'$do_print_message'(breakpoints([])) :- !,
'$format'(user_error,'There are no spy-points set.',
[M,F,N]).
'$do_print_message'(breakpoints(L)) :- !,
'$format'(user_error,'Spy-points set on:', []),
'$print_list_of_preds'(L).
'$do_print_message'(debug(debug)) :- !,
'$format'(user_error,'Debug mode on.',[]).
'$do_print_message'(debug(off)) :- !,
'$format'(user_error,'Debug mode off.',[]).
'$do_print_message'(debug(trace)) :- !,
'$format'(user_error,'Trace mode on.',[]).
'$do_print_message'(import(Pred,To,From,private)) :- !,
'$format'(user_error,'Importing private predicate ~w:~w to ~w.',
[From,Pred,To]).
'$do_print_message'(leash([])) :- !,
'$format'(user_error,'No leashing.',
[M,F,N]).
'$do_print_message'(leash([A|B])) :- !,
'$format'(user_error,'Leashing set to ~w.',
[[A|B]]).
'$do_print_message'(no) :- !,
'$format'(user_error, 'no', []).
'$do_print_message'(no_match(P)) :- !,
'$format'(user_error,'No matching predicate for ~w.',
[P]).
'$do_print_message'(trace_command(C)) :- !,
'$format'(user_error,'Invalid trace command: ~c', [C]).
'$do_print_message'(trace_help) :- !,
'$format'(user_error,' Please enter a valid debugger command (h for help).', []).
'$do_print_message'(version(Version)) :- !,
'$format'(user_error,'YAP version ~a', [Version]).
'$do_print_message'(yes) :- !,
'$format'(user_error, 'yes', []).
'$do_print_message'(Messg) :-
'$format'(user_error,'~q',Messg).
@ -259,20 +266,20 @@ print_message(Level, Mss) :-
'$say_stack_dump'([], []) :- !.
'$say_stack_dump'(_, _) :-
'$format'(user_error,'[ Stack dump for error:', []).
'$format'(user_error,'% Stack dump for error:', []).
'$close_stack_dump'([], []) :- !.
'$close_stack_dump'(_, _) :-
'$format'(user_error,' ]~n', []).
'$format'(user_error,'~n', []).
'$show_cps'([]) :- !.
'$show_cps'(List) :-
'$format'(user_error,'~n choice-points (goals with alternatives left):',[]),
'$format'(user_error,'% ~n choice-points (goals with alternatives left):',[]),
'$print_stack'(List).
'$show_envs'([]) :- !.
'$show_envs'(List) :-
'$format'(user_error,'~n environments (partially executed clauses):',[]),
'$format'(user_error,'% ~n environments (partially executed clauses):',[]),
'$print_stack'(List).
'$prepare_loc'(Info,Where,Location) :- integer(Where), !,
@ -282,16 +289,16 @@ print_message(Level, Mss) :-
'$print_stack'([]).
'$print_stack'([overflow]) :- !,
'$format'(user_error,'~n ...',[]).
'$format'(user_error,'~n% ...',[]).
'$print_stack'([cl(Name,Arity,Mod,Clause)|List]) :-
'$show_goal'(Clause,Name,Arity,Mod),
'$print_stack'(List).
'$show_goal'(-1,Name,Arity,Mod) :- !,
'$format'('~n ~a:~a/~d at indexing code',[Mod,Name,Arity]).
'$format'('~n% ~a:~a/~d at indexing code',[Mod,Name,Arity]).
'$show_goal'(0,Name,Arity,Mod) :- !.
'$show_goal'(I,Name,Arity,Mod) :-
'$format'(user_error,'~n ~a:~a/~d at clause ~d',[Mod,Name,Arity,I]).
'$format'(user_error,'~n% ~a:~a/~d at clause ~d',[Mod,Name,Arity,I]).
'$construct_code'(-1,Name,Arity,Mod,Where,Location) :- !,
number_codes(Arity,ArityCode),
@ -306,338 +313,338 @@ print_message(Level, Mss) :-
atom_concat([Where,' at ',Mod,':',Name,'/',ArityAtom,' (clause ',ClAtom,')'],Location).
'$output_error_message'(consistency_error(Who),Where) :-
'$format'(user_error,'[ CONSISTENCY ERROR- ~w ~w ]~n',
'$format'(user_error,'% CONSISTENCY ERROR- ~w ~w~n',
[Who,Where]).
'$output_error_message'(context_error(Goal,Who),Where) :-
'$format'(user_error,'[ CONTEXT ERROR- ~w: ~w appeared in ~w ]~n',
'$format'(user_error,'% CONTEXT ERROR- ~w: ~w appeared in ~w~n',
[Goal,Who,Where]).
'$output_error_message'(domain_error(array_overflow,Opt), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: invalid index ~w for array ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: invalid index ~w for array~n',
[Where,Opt]).
'$output_error_message'(domain_error(array_type,Opt), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: invalid static array type ~w ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: invalid static array type ~w~n',
[Where,Opt]).
'$output_error_message'(domain_error(builtin_procedure,P), P) :-
'$format'(user_error,'[ DOMAIN ERROR- non-iso built-in procedure ~w ]~n',
'$format'(user_error,'% DOMAIN ERROR- non-iso built-in procedure ~w~n',
[P]).
'$output_error_message'(domain_error(character_code_list,Opt), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: invalid list of codes ~w ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: invalid list of codes ~w~n',
[Where,Opt]).
'$output_error_message'(domain_error(delete_file_option,Opt), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: invalid list of options ~w ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: invalid list of options ~w~n',
[Where,Opt]).
'$output_error_message'(domain_error(operator_specifier,Op), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: invalid operator specifier ~w ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: invalid operator specifier ~w~n',
[Where,Op]).
'$output_error_message'(domain_error(out_of_range,Value), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: expression ~w is out of range ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: expression ~w is out of range~n',
[Where,Value]).
'$output_error_message'(domain_error(close_option,Opt), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: invalid close option ~w ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: invalid close option ~w~n',
[Where,Opt]).
'$output_error_message'(domain_error(radix,Opt), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: invalid radix ~w ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: invalid radix ~w~n',
[Where,Opt]).
'$output_error_message'(domain_error(shift_count_overflow,Opt), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: shift count overflow in ~w ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: shift count overflow in ~w~n',
[Where,Opt]).
'$output_error_message'(domain_error(flag_value,F+V), W) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: invalid value ~w for flag ~w ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: invalid value ~w for flag ~w~n',
[W,V,F]).
'$output_error_message'(domain_error(io_mode,N), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: invalid io mode ~w ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: invalid io mode ~w~n',
[Where,N]).
'$output_error_message'(domain_error(mutable,N), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: invalid mutable ~w ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: invalid mutable ~w~n',
[Where,N]).
'$output_error_message'(domain_error(module_decl_options,N), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: expect module declaration options, found ~w ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: expect module declaration options, found ~w~n',
[Where,N]).
'$output_error_message'(domain_error(not_empty_list,_), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: found empty list ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: found empty list~n',
[Where]).
'$output_error_message'(domain_error(not_less_than_zero,N), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: number ~w less than zero ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: number ~w less than zero~n',
[Where,N]).
'$output_error_message'(domain_error(not_newline,N), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: number ~w not newline ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: number ~w not newline~n',
[Where,N]).
'$output_error_message'(domain_error(not_zero,N), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: ~w is not allowed in the domain ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: ~w is not allowed in the domain ~n',
[Where,N]).
'$output_error_message'(domain_error(operator_priority,N), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: ~w invalid operator priority ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: ~w invalid operator priority~n',
[Where,N]).
'$output_error_message'(domain_error(operator_specifier,N), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: ~w invalid operator specifier ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: ~w invalid operator specifier~n',
[Where,N]).
'$output_error_message'(domain_error(predicate_spec,N), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: ~w invalid predicate specifier ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: ~w invalid predicate specifier~n',
[Where,N]).
'$output_error_message'(domain_error(read_option,N), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: ~w invalid option to read ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: ~w invalid option to read~n',
[Where,N]).
'$output_error_message'(domain_error(semantics_indicator,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected predicate indicator, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected predicate indicator, got ~w~n',
[Where,W]).
'$output_error_message'(domain_error(source_sink,N), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: ~w is not a source sink term ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: ~w is not a source sink term~n',
[Where,N]).
'$output_error_message'(domain_error(stream,What), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: ~w not a stream ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: ~w not a stream~n',
[Where,What]).
'$output_error_message'(domain_error(stream_or_alias,What), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: ~w not a stream ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: ~w not a stream~n',
[Where,What]).
'$output_error_message'(domain_error(stream_option,What), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: ~w not a stream option ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: ~w not a stream option~n',
[Where,What]).
'$output_error_message'(domain_error(stream_position,What), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: ~w not a stream position ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: ~w not a stream position~n',
[Where,What]).
'$output_error_message'(domain_error(stream_property,What), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: ~w not a stream property ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: ~w not a stream property~n',
[Where,What]).
'$output_error_message'(domain_error(syntax_error_handler,What), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: ~w not a syntax error handler ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: ~w not a syntax error handler~n',
[Where,What]).
'$output_error_message'(domain_error(thread_create_option,Option+Opts), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: ~w not in ~w ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: ~w not in ~w~n',
[Where,Option, Opts]).
'$output_error_message'(domain_error(time_out_spec,What), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: ~w not a valid specification for a time out ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: ~w not a valid specification for a time out~n',
[Where,What]).
'$output_error_message'(domain_error(write_option,N), Where) :-
'$format'(user_error,'[ DOMAIN ERROR- ~w: ~w invalid option to write ]~n',
'$format'(user_error,'% DOMAIN ERROR- ~w: ~w invalid option to write~n',
[Where,N]).
'$output_error_message'(existence_error(array,F), W) :-
'$format'(user_error,'[ EXISTENCE ERROR- ~w could not open array ~w ]~n',
'$format'(user_error,'% EXISTENCE ERROR- ~w could not open array ~w~n',
[W,F]).
'$output_error_message'(existence_error(mutex,F), W) :-
'$format'(user_error,'[ EXISTENCE ERROR- ~w could not open mutex ~w ]~n',
'$format'(user_error,'% EXISTENCE ERROR- ~w could not open mutex ~w~n',
[W,F]).
'$output_error_message'(existence_error(queue,F), W) :-
'$format'(user_error,'[ EXISTENCE ERROR- ~w could not open message queue ~w ]~n',
'$format'(user_error,'% EXISTENCE ERROR- ~w could not open message queue ~w~n',
[W,F]).
'$output_error_message'(existence_error(procedure,P), _) :-
'$format'(user_error,'[ EXISTENCE ERROR- procedure ~w undefined ]~n',
'$format'(user_error,'% EXISTENCE ERROR- procedure ~w undefined~n',
[P]).
'$output_error_message'(existence_error(source_sink,F), W) :-
'$format'(user_error,'[ EXISTENCE ERROR- ~w could not find file ~w ]~n',
'$format'(user_error,'% EXISTENCE ERROR- ~w could not find file ~w~n',
[W,F]).
'$output_error_message'(existence_error(stream,Stream), Where) :-
'$format'(user_error,'[ EXISTENCE ERROR- ~w: ~w not an open stream ]~n',
'$format'(user_error,'% EXISTENCE ERROR- ~w: ~w not an open stream~n',
[Where,Stream]).
'$output_error_message'(evaluation_error(int_overflow), Where) :-
'$format'(user_error,'[ INTEGER OVERFLOW ERROR- ~w ]~n',
'$format'(user_error,'% INTEGER OVERFLOW ERROR- ~w~n',
[Where]).
'$output_error_message'(evaluation_error(float_overflow), Where) :-
'$format'(user_error,'[ FLOATING POINT OVERFLOW ERROR- ~w ]~n',
'$format'(user_error,'% FLOATING POINT OVERFLOW ERROR- ~w~n',
[Where]).
'$output_error_message'(evaluation_error(undefined), Where) :-
'$format'(user_error,'[ UNDEFINED ARITHMETIC RESULT ERROR- ~w ]~n',
'$format'(user_error,'% UNDEFINED ARITHMETIC RESULT ERROR- ~w~n',
[Where]).
'$output_error_message'(evaluation_error(underflow), Where) :-
'$format'(user_error,'[ UNDERFLOW ERROR- ~w ]~n',
'$format'(user_error,'% UNDERFLOW ERROR- ~w~n',
[Where]).
'$output_error_message'(evaluation_error(float_underflow), Where) :-
'$format'(user_error,'[ FLOATING POINT UNDERFLOW ERROR- ~w ]~n',
'$format'(user_error,'% FLOATING POINT UNDERFLOW ERROR- ~w~n',
[Where]).
'$output_error_message'(evaluation_error(zero_divisor), Where) :-
'$format'(user_error,'[ ZERO DIVISOR ERROR- ~w ]~n',
'$format'(user_error,'% ZERO DIVISOR ERROR- ~w~n',
[Where]).
'$output_error_message'(instantiation_error, Where) :-
'$format'(user_error,'[ INSTANTIATION ERROR- ~w: expected bound value ]~n',
'$format'(user_error,'% INSTANTIATION ERROR- ~w: expected bound value~n',
[Where]).
'$output_error_message'(out_of_heap_error, Where) :-
'$format'(user_error,'[ OUT OF HEAP SPACE ERROR- ~w ]~n',
'$format'(user_error,'% OUT OF HEAP SPACE ERROR- ~w~n',
[Where]).
'$output_error_message'(out_of_stack_error, Where) :-
'$format'(user_error,'[ OUT OF STACK SPACE ERROR- ~w ]~n',
'$format'(user_error,'% OUT OF STACK SPACE ERROR- ~w~n',
[Where]).
'$output_error_message'(out_of_trail_error, Where) :-
'$format'(user_error,'[ OUT OF TRAIL SPACE ERROR- ~w ]~n',
'$format'(user_error,'% OUT OF TRAIL SPACE ERROR- ~w~n',
[Where]).
'$output_error_message'(permission_error(access,private_procedure,P), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: cannot see clauses for ~w ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: cannot see clauses for ~w~n',
[Where,P]).
'$output_error_message'(permission_error(access,static_procedure,P), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: cannot access static procedure ~w ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: cannot access static procedure ~w~n',
[Where,P]).
'$output_error_message'(permission_error(alias,new,P), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: cannot create alias ~w ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: cannot create alias ~w~n',
[Where,P]).
'$output_error_message'(permission_error(create,array,P), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: cannot create array ~w ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: cannot create array ~w~n',
[Where,P]).
'$output_error_message'(permission_error(create,mutex,P), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: cannot create mutex ~a ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: cannot create mutex ~a~n',
[Where,P]).
'$output_error_message'(permission_error(create,queue,P), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: cannot create queue ~a ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: cannot create queue ~a~n',
[Where,P]).
'$output_error_message'(permission_error(create,operator,P), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: cannot create operator ~w ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: cannot create operator ~w~n',
[Where,P]).
'$output_error_message'(permission_error(input,binary_stream,Stream), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: cannot read from binary stream ~w ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: cannot read from binary stream ~w~n',
[Where,Stream]).
'$output_error_message'(permission_error(input,closed_stream,Stream), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: trying to read from closed stream ~w ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: trying to read from closed stream ~w~n',
[Where,Stream]).
'$output_error_message'(permission_error(input,past_end_of_stream,Stream), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: past end of stream ~w ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: past end of stream ~w~n',
[Where,Stream]).
'$output_error_message'(permission_error(input,stream,Stream), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: cannot read from ~w ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: cannot read from ~w~n',
[Where,Stream]).
'$output_error_message'(permission_error(input,text_stream,Stream), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: cannot read from text stream ~w ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: cannot read from text stream ~w~n',
[Where,Stream]).
'$output_error_message'(permission_error(modify,dynamic_procedure,_), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: modifying a dynamic procedure ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: modifying a dynamic procedure~n',
[Where]).
'$output_error_message'(permission_error(modify,flag,W), _) :-
'$format'(user_error,'[ PERMISSION ERROR- cannot modify flag ~w ]~n',
'$format'(user_error,'% PERMISSION ERROR- cannot modify flag ~w~n',
[W]).
'$output_error_message'(permission_error(modify,operator,W), _) :-
'$format'(user_error,'[ PERMISSION ERROR- T cannot declare ~w an operator ]~n',
'$format'(user_error,'% PERMISSION ERROR- T cannot declare ~w an operator~n',
[W]).
'$output_error_message'(permission_error(modify,dynamic_procedure,_), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: modifying a dynamic procedure ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: modifying a dynamic procedure~n',
[Where]).
'$output_error_message'(permission_error(modify,static_procedure,_), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: modifying a static procedure ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: modifying a static procedure~n',
[Where]).
'$output_error_message'(permission_error(modify,static_procedure_in_use,_), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: modifying a static procedure in use ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: modifying a static procedure in use~n',
[Where]).
'$output_error_message'(permission_error(module,redefined,Mod), Who) :-
'$format'(user_error,'[ PERMISSION ERROR ~w- redefining module ~a in a different file ]~n',
'$format'(user_error,'% PERMISSION ERROR ~w- redefining module ~a in a different file~n',
[Who,Mod]).
'$output_error_message'(permission_error(open,source_sink,Stream), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: cannot open file ~w ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: cannot open file ~w~n',
[Where,Stream]).
'$output_error_message'(permission_error(output,binary_stream,Stream), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: cannot write to binary stream ~w ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: cannot write to binary stream ~w~n',
[Where,Stream]).
'$output_error_message'(permission_error(output,stream,Stream), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: cannot write to ~w ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: cannot write to ~w~n',
[Where,Stream]).
'$output_error_message'(permission_error(output,text_stream,Stream), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: cannot write to text stream ~w ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: cannot write to text stream ~w~n',
[Where,Stream]).
'$output_error_message'(permission_error(resize,array,P), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: cannot resize array ~w ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: cannot resize array ~w~n',
[Where,P]).
'$output_error_message'(permission_error(unlock,mutex,P), Where) :-
'$format'(user_error,'[ PERMISSION ERROR- ~w: cannot unlock mutex ~w ]~n',
'$format'(user_error,'% PERMISSION ERROR- ~w: cannot unlock mutex ~w~n',
[Where,P]).
'$output_error_message'(representation_error(character), Where) :-
'$format'(user_error,'[ REPRESENTATION ERROR- ~w: expected character ]~n',
'$format'(user_error,'% REPRESENTATION ERROR- ~w: expected character~n',
[Where]).
'$output_error_message'(representation_error(character_code), Where) :-
'$format'(user_error,'[ REPRESENTATION ERROR- ~w: expected character code ]~n',
'$format'(user_error,'% REPRESENTATION ERROR- ~w: expected character code~n',
[Where]).
'$output_error_message'(representation_error(max_arity), Where) :-
'$format'(user_error,'[ REPRESENTATION ERROR- ~w: number too big ]~n',
'$format'(user_error,'% REPRESENTATION ERROR- ~w: number too big~n',
[Where]).
'$output_error_message'(syntax_error(G,0,Msg,[],0,0), Where) :- !,
'$format'(user_error,'[ SYNTAX ERROR in ~w: ~a ]~n',[G,Msg]).
'$format'(user_error,'% SYNTAX ERROR in ~w: ~a~n',[G,Msg]).
'$output_error_message'(syntax_error(_,Position,_,Term,Pos,Start), Where) :-
'$format'(user_error,'[ ~w ',[Where]),
'$format'(user_error,'% ~w ',[Where]),
'$dump_syntax_error_line'(Start,Position),
'$dump_syntax_error_term'(10,Pos, Term),
'$format'(user_error,'.~n]~n',[]).
'$output_error_message'(system_error, Where) :-
'$format'(user_error,'[ SYSTEM ERROR- ~w ]~n',
'$format'(user_error,'% SYSTEM ERROR- ~w~n',
[Where]).
'$output_error_message'(system_error(Message), Where) :-
'$format'(user_error,'[ SYSTEM ERROR- ~w at ~w]~n',
'$format'(user_error,'% SYSTEM ERROR- ~w at ~w]~n',
[Message,Where]).
'$output_error_message'(type_error(T,_,Err,M), _Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected ~w, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected ~w, got ~w~n',
[T,Err,M]).
'$output_error_message'(type_error(array,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected array, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected array, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(atom,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected atom, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected atom, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(atomic,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected atomic, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected atomic, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(byte,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected byte, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected byte, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(callable,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected callable goal, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected callable goal, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(char,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected char, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected char, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(character,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected character, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected character, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(character_code,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected character code, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected character code, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(compound,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected compound, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected compound, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(db_reference,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected data base reference, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected data base reference, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(db_term,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected data base term, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected data base term, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(evaluable,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected evaluable term, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected evaluable term, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(float,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected float, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected float, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(in_byte,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected byte, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected byte, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(in_character,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected atom character, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected atom character, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(in_character_code,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected character code, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected character code, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(integer,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected integer, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected integer, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(key,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected database key, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected database key, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(leash_mode,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected modes for leash, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected modes for leash, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(list,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected list, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected list, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(number,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected number, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected number, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(pointer,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected pointer, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected pointer, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(predicate_indicator,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected predicate indicator, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected predicate indicator, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(unsigned_byte,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected unsigned byte, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected unsigned byte, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(unsigned_char,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected unsigned char, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected unsigned char, got ~w~n',
[Where,W]).
'$output_error_message'(type_error(variable,W), Where) :-
'$format'(user_error,'[ TYPE ERROR- ~w: expected unbound variable, got ~w ]~n',
'$format'(user_error,'% TYPE ERROR- ~w: expected unbound variable, got ~w~n',
[Where,W]).
'$output_error_message'(unknown, Where) :-
'$format'(user_error,'[ EXISTENCE ERROR- procedure ~w undefined ]~n',
'$format'(user_error,'% EXISTENCE ERROR- procedure ~w undefined~n',
[Where]).

View File

@ -42,7 +42,8 @@ not(G) :- '$current_module'(Module), '$meta_call'(not(G),Module).
:- ['errors.yap',
'utils.yap',
'arith.yap'].
'arith.yap',
'directives.yap'].
:- compile_expressions.
@ -51,7 +52,6 @@ not(G) :- '$current_module'(Module), '$meta_call'(not(G),Module).
'consult.yap',
'checker.yap',
'depth_bound.yap',
'directives.yap',
'grammar.yap',
'ground.yap',
'listing.yap',

View File

@ -42,8 +42,8 @@ use_module(M) :-
'$do_error'(permission_error(input,stream,File),use_module(File)).
use_module(M,I) :-
'$use_module'(M, I).
use_module(File,I) :-
'$use_module'(File, I).
'$use_module'(File,Imports) :- var(File), !,
'$do_error'(instantiation_error,use_module(File,Imports)).
@ -70,8 +70,8 @@ use_module(M,I) :-
( recorded('$module','$module'(TrueFileName,Mod,Publics),_) ->
'$use_preds'(Imports,Publics,Mod,M)
;
'$format'(user_error,"[ use_module/2 can not find a module in file ~w]~n",File),
fail
true
).
'$use_module'(File,Imports) :-
'$do_error'(permission_error(input,stream,File),use_module(File,Imports)).
@ -109,8 +109,7 @@ use_module(Mod,F,I) :-
->
'$use_preds'(Imports,Publics,Module,M)
;
'$format'(user_error,"[ use_module/2 can not find module ~w in file ~w]~n",[Module,File]),
fail
true
).
'$use_module'(Module,File,Imports) :-
'$do_error'(permission_error(input,stream,File),use_module(Module,File,Imports)).
@ -214,7 +213,6 @@ module(N) :-
'$import'([N/K|L],M,T) :-
integer(K), atom(N), !,
( '$check_import'(M,T,N,K) ->
% '$format'(user_error,"[vsc1: Importing ~w to ~w]~n",[M:N/K,T]),
( T = user ->
( recordzifnot('$import','$import'(M,user,N,K),_) -> true ; true)
;
@ -225,8 +223,7 @@ module(N) :-
),
'$import'(L,M,T).
'$import'([PS|L],M,T) :-
'$format'(user_error,"[Illegal pred specification(~w) in module declaration for module ~w]~n",[PS,M]),
'$import'(L,M,T).
'$do_error'(domain_error(predicate_spec,PS),import([PS|L])).
'$check_import'(M,T,N,K) :-
recorded('$import','$import'(M1,T,N,K),R), M1 \= M, /* ZP */ !,
@ -254,7 +251,6 @@ module(N) :-
( '$check_import'(M,Mod,N,K) ->
% '$format'(user_error,'[ Importing ~w to ~w]~n',[M:N/K,Mod]),
% '$trace_module'(importing(M:N/K,Mod)),
% '$format'(user_error,"[vsc2: Importing ~w to ~w]~n",[M:N/K,T]),
(Mod = user ->
( recordzifnot('$import','$import'(M,user,N,K),_) -> true ; true )
;
@ -489,7 +485,6 @@ module(N) :-
functor(G,F,N),
'$meta_predicate'(F,Mod,N,D), !,
functor(G1,F,N),
% '$format'(user_error,"[expanding ~w:~w in ~w",[Mod,G,MP]),
'$meta_expansion_loop'(N,D,G,G1,HVars,MP).
% '$format'(user_error," gives ~w~n]",[G1]).

View File

@ -645,8 +645,7 @@ abolish(X) :-
'$access_yap_flags'(8, 2), % only do this in sicstus mode
'$undefined'(G, Module),
functor(G,Name,Arity),
'$format'(user_error,"[ Warning: abolishing undefined predicate (~w:~w/~w) ]~n",[Module,Name,Arity]),
fail.
'$print_message'(warning,no_match(abolish(Module:Name/Arity))).
% I cannot allow modifying static procedures in YAPOR
% this code has to be here because of abolish/2
'$abolishs'(G, Module) :-

View File

@ -438,8 +438,7 @@ unknown(V0,V) :-
'$unknown_warning'(P) :-
P=M:F,
functor(F,Na,Ar),
'$format'(user_error,"[ EXISTENCE ERROR: ~w, procedure ~w:~w/~w undefined ]~n",
[P,M,Na,Ar]),
'$print_message'(existence_error(P,0,procedure,M:F,0), [P,M,Na,Ar]),
fail.
%%% Some "dirty" predicates