fix error handling

This commit is contained in:
Vítor Santos Costa 2015-09-25 10:57:26 +01:00
parent 4336b2ba88
commit b871f6676e
145 changed files with 4466 additions and 7508 deletions

View File

@ -368,7 +368,7 @@
* Handle overflows when allocating big clauses properly.
*
* Revision 1.153 2004/11/19 22:08:35 vsc
* replace SYSTEM_ERROR by out OUT_OF_WHATEVER_ERROR whenever appropriate.
* replace SYSTEM_ERROR_INTERNAL by out OUT_OF_WHATEVER_ERROR whenever appropriate.
*
* Revision 1.152 2004/11/19 17:14:12 vsc
* a few fixes for 64 bit compiling.
@ -685,7 +685,7 @@ stack_overflow( PredEntry *pe, CELL *env, yamop *cp USES_REGS, arity_t nargs )
Yap_get_signal( YAP_STOVF_SIGNAL )) {
S = (CELL *)pe;
if (!Yap_locked_gc(nargs, env, cp)) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
return 0;
}
return 1;
@ -701,7 +701,7 @@ code_overflow( CELL *yenv USES_REGS )
/* do a garbage collection first to check if we can recover memory */
if (!Yap_locked_growheap(false, 0, NULL)) {
Yap_NilError(OUT_OF_HEAP_ERROR, "YAP failed to grow heap: %s", LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_HEAP, "YAP failed to grow heap: %s", LOCAL_ErrorMessage);
return 0;
}
CACHE_A1();
@ -1110,7 +1110,7 @@ interrupt_deallocate( USES_REGS1 )
return interrupt_handler( pe PASS_REGS );
}
if (!Yap_locked_gc(0, ENV, CP)) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
}
S = ASP;
S[E_CB] = (CELL)(LCL0-cut_b);
@ -1444,7 +1444,7 @@ spy_goal( USES_REGS1 )
PP = NULL;
}
#endif
Yap_NilError(CALL_COUNTER_UNDERFLOW,"");
Yap_NilError(CALL_COUNTER_UNDERFLOW_EVENT,"");
return;
}
LOCAL_PredEntriesCounter--;
@ -1455,7 +1455,7 @@ spy_goal( USES_REGS1 )
PP = NULL;
}
#endif
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
return;
}
if ((pe->PredFlags & (CountPredFlag|ProfiledPredFlag|SpiedPredFlag)) ==
@ -1811,7 +1811,7 @@ Yap_absmi(int inp)
cut_b = LCL0-(CELL *)(ASP[E_CB]);
saveregs();
if(!Yap_growtrail (0, false)) {
Yap_NilError(OUT_OF_TRAIL_ERROR,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * K16);
Yap_NilError(RESOURCE_ERROR_TRAIL,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * K16);
setregs();
FAIL();
}
@ -1835,7 +1835,7 @@ Yap_absmi(int inp)
#if !USE_THREADED_CODE
default:
saveregs();
Yap_Error(SYSTEM_ERROR, MkIntegerTerm(opcode), "trying to execute invalid YAAM instruction %d", opcode);
Yap_Error(SYSTEM_ERROR_INTERNAL, MkIntegerTerm(opcode), "trying to execute invalid YAAM instruction %d", opcode);
setregs();
FAIL();
}

View File

@ -721,7 +721,7 @@
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -747,7 +747,7 @@
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
ENV = B->cp_env;
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -783,7 +783,7 @@
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -827,7 +827,7 @@
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0) {
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -869,7 +869,7 @@
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0) {
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -921,7 +921,7 @@
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0) {
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -1101,16 +1101,16 @@
#if defined(YAPOR) || defined(THREADS)
PP = NULL;
#endif
if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) {
if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growglobal(NULL)) {
Yap_NilError(OUT_OF_ATTVARS_ERROR, LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, LOCAL_ErrorMessage);
FAIL();
}
} else {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_gc(3, ENV, CP)) {
Yap_NilError(OUT_OF_STACK_ERROR, LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK, LOCAL_ErrorMessage);
FAIL();
}
}
@ -1235,7 +1235,7 @@
PREG = NEXTOP(PREG,Osbpa);
saveregs();
if (!Yap_gcl(sz, arity, YENV, PREG)) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
FAIL();
} else {
@ -1334,7 +1334,7 @@
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0) {
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -10937,7 +10937,7 @@
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,xxx),Osbpp))) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -11054,7 +11054,7 @@
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,xxc),Osbpp))) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -11164,7 +11164,7 @@
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gc(0, YREG, NEXTOP(NEXTOP(PREG,xxn),Osbpp))) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -11271,7 +11271,7 @@
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,yxx),Osbpp))) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -11398,7 +11398,7 @@
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,yxc),Osbpp))) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -11526,7 +11526,7 @@
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,yxn),Osbpp))) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -11902,7 +11902,7 @@
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 3, YREG, NEXTOP(NEXTOP(PREG,e),Osbmp))) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {

View File

@ -408,7 +408,7 @@ Yap_LookupAtomWithAddress(const char *atom,
a = HashChain[hash].Entry;
/* search atom in chain */
if (SearchAtom(p, a) != NIL) {
Yap_Error(INTERNAL_ERROR,TermNil,"repeated initialisation for atom %s", ae);
Yap_Error(SYSTEM_ERROR_INTERNAL,TermNil,"repeated initialisation for atom %s", ae);
WRITE_UNLOCK(HashChain[hash].AERWLock);
return;
}
@ -1347,7 +1347,7 @@ Yap_GetName(char *s, UInt max, Term t)
*s++ = i;
t = TailOfTerm(t);
if (--max == 0) {
Yap_Error(FATAL_ERROR,t,"not enough space for GetName");
Yap_Error(SYSTEM_ERROR_FATAL,t,"not enough space for GetName");
}
}
*s = '\0';

View File

@ -348,7 +348,7 @@ mark_global_cell(CELL *pt)
CELL ar[256];
Int i,n = (f)(Yap_BlobTag(t), Yap_BlobInfo(t), ar, 256);
if (n < 0) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"not enough space for slot internal variables in agc");
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"not enough space for slot internal variables in agc");
}
for (i = 0; i< n; i++) {
CELL *pt = ar+i;
@ -360,7 +360,7 @@ mark_global_cell(CELL *pt)
if ( (f2 = Yap_blob_gc_relocate_handler(t)) < 0 ) {
int out = (f2)(Yap_BlobTag(t), Yap_BlobInfo(t), ar, n);
if (out < 0)
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"bad restore of slot internal variables in agc");
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"bad restore of slot internal variables in agc");
}
}
@ -436,7 +436,6 @@ clean_atom_list(AtomHashEntry *HashPtr)
#ifdef DEBUG_RESTORE3
fprintf(stderr, "Purged %p:%s patm=%p %p\n", at, at->StrOfAE, patm, at->NextOfAE);
#endif
GLOBAL_agc_collected += sizeof(AtomEntry)+strlen(at->StrOfAE);
GLOBAL_agc_collected += sizeof(AtomEntry)+strlen((const char *)at->StrOfAE);
}
*patm = atm = at->NextOfAE;

860
C/alloc.c

File diff suppressed because it is too large Load Diff

View File

@ -143,7 +143,7 @@
* Handle overflows when allocating big clauses properly.
*
* Revision 1.66 2004/11/19 22:08:41 vsc
* replace SYSTEM_ERROR by out OUT_OF_WHATEVER_ERROR whenever appropriate.
* replace SYSTEM_ERROR_INTERNAL by out OUT_OF_WHATEVER_ERROR whenever appropriate.
*
* Revision 1.65 2004/10/26 20:15:48 vsc
* More bug fixes for overflow handling
@ -1432,7 +1432,7 @@ a_p(op_numbers opcode, clause_info *clinfo, yamop *code_p, int pass_no, struct i
break;
default:
op = _p_equal; /* just to make some compilers happy */
Yap_Error(INTERNAL_COMPILER_ERROR, TermNil, "internal assembler error for built-in (%d)", (Flags & 0x7f));
Yap_Error(SYSTEM_ERROR_COMPILER, TermNil, "internal assembler error for built-in (%d)", (Flags & 0x7f));
save_machine_regs();
siglongjmp(cip->CompilerBotch, 1);
}
@ -1454,7 +1454,7 @@ a_p(op_numbers opcode, clause_info *clinfo, yamop *code_p, int pass_no, struct i
if (cip->failure_handler && (Flags & TestPredFlag)) {
if (pass_no) {
if (Flags & UserCPredFlag) {
Yap_Error(INTERNAL_COMPILER_ERROR, TermNil,
Yap_Error(SYSTEM_ERROR_COMPILER, TermNil,
"user defined predicate cannot be a test predicate");
save_machine_regs();
siglongjmp(cip->CompilerBotch, 1);
@ -1615,7 +1615,7 @@ compile_cmp_flags(unsigned char *s0)
return GT_OK_IN_CMP|LT_OK_IN_CMP;
if (strcmp(s,"\\==") == 0)
return GT_OK_IN_CMP|LT_OK_IN_CMP;
Yap_Error(INTERNAL_COMPILER_ERROR, TermNil, "internal assembler error, %s/2 not recognised as binary op", s);
Yap_Error(SYSTEM_ERROR_COMPILER, TermNil, "internal assembler error, %s/2 not recognised as binary op", s);
return 0;
}
@ -2490,7 +2490,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
code_p->opc = opcode(_p_db_ref_y);
break;
case _cut_by:
Yap_Error(INTERNAL_COMPILER_ERROR, TermNil, "internal assembler error: cut_by should be handled as ->");
Yap_Error(SYSTEM_ERROR_COMPILER, TermNil, "internal assembler error: cut_by should be handled as ->");
break;
case _primitive:
code_p->opc = opcode(_p_primitive_y);
@ -2532,7 +2532,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
code_p->opc = opcode(_p_db_ref_x);
break;
case _cut_by:
Yap_Error(INTERNAL_COMPILER_ERROR, TermNil, "internal assembler error: cut_by should be handled as ->");
Yap_Error(SYSTEM_ERROR_COMPILER, TermNil, "internal assembler error: cut_by should be handled as ->");
break;
case _primitive:
code_p->opc = opcode(_p_primitive_x);
@ -2645,7 +2645,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
if (pass_no) {
switch (opc) {
case _plus:
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for +/2 (should be XC)");
Yap_Error(SYSTEM_ERROR_COMPILER, cmp_info->x1_arg, "internal assembler error CX for +/2 (should be XC)");
save_machine_regs();
siglongjmp(cip->CompilerBotch, 1);
break;
@ -2653,7 +2653,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
code_p->opc = emit_op(_p_minus_y_cv);
break;
case _times:
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for */2 (should be XC)");
Yap_Error(SYSTEM_ERROR_COMPILER, cmp_info->x1_arg, "internal assembler error CX for */2 (should be XC)");
save_machine_regs();
siglongjmp(cip->CompilerBotch, 1);
break;
@ -2661,12 +2661,12 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
code_p->opc = emit_op(_p_div_y_cv);
break;
case _and:
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for /\\/2 (should be XC)");
Yap_Error(SYSTEM_ERROR_COMPILER, cmp_info->x1_arg, "internal assembler error CX for /\\/2 (should be XC)");
save_machine_regs();
siglongjmp(cip->CompilerBotch, 1);
break;
case _or:
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for \\//2 (should be XC)");
Yap_Error(SYSTEM_ERROR_COMPILER, cmp_info->x1_arg, "internal assembler error CX for \\//2 (should be XC)");
save_machine_regs();
siglongjmp(cip->CompilerBotch, 1);
break;
@ -2696,7 +2696,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
code_p->opc = emit_op(_p_plus_y_vc);
break;
case _minus:
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x2_arg, "internal assembler error XC for -/2");
Yap_Error(SYSTEM_ERROR_COMPILER, cmp_info->x2_arg, "internal assembler error XC for -/2");
save_machine_regs();
siglongjmp(cip->CompilerBotch, 1);
break;
@ -2729,7 +2729,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
}
break;
case _arg:
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x2_arg, "internal assembler error for arg/3");
Yap_Error(SYSTEM_ERROR_COMPILER, cmp_info->x2_arg, "internal assembler error for arg/3");
save_machine_regs();
siglongjmp(cip->CompilerBotch, 1);
break;
@ -2790,7 +2790,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
if (pass_no) {
switch (opc) {
case _plus:
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for +/2");
Yap_Error(SYSTEM_ERROR_COMPILER, cmp_info->x1_arg, "internal assembler error CX for +/2");
save_machine_regs();
siglongjmp(cip->CompilerBotch, 1);
break;
@ -2798,7 +2798,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
code_p->opc = emit_op(_p_minus_cv);
break;
case _times:
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for */2");
Yap_Error(SYSTEM_ERROR_COMPILER, cmp_info->x1_arg, "internal assembler error CX for */2");
save_machine_regs();
siglongjmp(cip->CompilerBotch, 1);
break;
@ -2806,12 +2806,12 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
code_p->opc = emit_op(_p_div_cv);
break;
case _and:
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for /\\/2");
Yap_Error(SYSTEM_ERROR_COMPILER, cmp_info->x1_arg, "internal assembler error CX for /\\/2");
save_machine_regs();
siglongjmp(cip->CompilerBotch, 1);
break;
case _or:
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x1_arg, "internal assembler error CX for \\//2");
Yap_Error(SYSTEM_ERROR_COMPILER, cmp_info->x1_arg, "internal assembler error CX for \\//2");
save_machine_regs();
siglongjmp(cip->CompilerBotch, 1);
break;
@ -2841,7 +2841,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
code_p->opc = emit_op(_p_plus_vc);
break;
case _minus:
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x2_arg, "internal assembler error XC for -/2");
Yap_Error(SYSTEM_ERROR_COMPILER, cmp_info->x2_arg, "internal assembler error XC for -/2");
save_machine_regs();
siglongjmp(cip->CompilerBotch, 1);
break;
@ -2874,7 +2874,7 @@ a_f2(cmp_op_info *cmp_info, yamop *code_p, int pass_no, struct intermediates *ci
}
break;
case _arg:
Yap_Error(INTERNAL_COMPILER_ERROR, cmp_info->x2_arg, "internal assembler error for arg/3");
Yap_Error(SYSTEM_ERROR_COMPILER, cmp_info->x2_arg, "internal assembler error for arg/3");
save_machine_regs();
siglongjmp(cip->CompilerBotch, 1);
break;
@ -3527,7 +3527,7 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
if (pass_no)
either_inst[either_cont++] = code_p;
if (either_cont == MAX_DISJ_BRANCHES) {
Yap_Error(FATAL_ERROR,TermNil,"Too Many Branches in disjunction: please increase MAX_DISJ_BRANCHES in amasm.c\n");
Yap_Error(SYSTEM_ERROR_FATAL,TermNil,"Too Many Branches in disjunction: please increase MAX_DISJ_BRANCHES in amasm.c\n");
exit(1);
}
code_p = a_either(_either,
@ -3723,7 +3723,7 @@ do_pass(int pass_no, yamop **entry_codep, int assembling, int *clause_has_blobsp
break;
#endif
default:
Yap_Error(INTERNAL_COMPILER_ERROR, TermNil, "instruction %d found while assembling", (int) cip->cpc->op);
Yap_Error(SYSTEM_ERROR_COMPILER, TermNil, "instruction %d found while assembling", (int) cip->cpc->op);
save_machine_regs();
siglongjmp(cip->CompilerBotch, 1);
}
@ -3748,11 +3748,11 @@ fetch_clause_space(Term* tp, UInt size, struct intermediates *cip, UInt *osizep
HR = h0;
switch (LOCAL_Error_TYPE) {
case OUT_OF_STACK_ERROR:
case RESOURCE_ERROR_STACK:
LOCAL_Error_Size = 256+((char *)cip->freep - (char *)HR);
save_machine_regs();
siglongjmp(cip->CompilerBotch,3);
case OUT_OF_TRAIL_ERROR:
case RESOURCE_ERROR_TRAIL:
/* don't just return NULL */
ARG1 = *tp;
if (!Yap_growtrail(K64, FALSE)) {
@ -3761,7 +3761,7 @@ fetch_clause_space(Term* tp, UInt size, struct intermediates *cip, UInt *osizep
LOCAL_Error_TYPE = YAP_NO_ERROR;
*tp = ARG1;
break;
case OUT_OF_AUXSPACE_ERROR:
case RESOURCE_ERROR_AUXILIARY_STACK:
ARG1 = *tp;
if (!Yap_ExpandPreAllocCodeSpace(LOCAL_Error_Size, (void *)cip, TRUE)) {
return NULL;
@ -3769,7 +3769,7 @@ fetch_clause_space(Term* tp, UInt size, struct intermediates *cip, UInt *osizep
LOCAL_Error_TYPE = YAP_NO_ERROR;
*tp = ARG1;
break;
case OUT_OF_HEAP_ERROR:
case RESOURCE_ERROR_HEAP:
/* don't just return NULL */
ARG1 = *tp;
if (!Yap_growheap(TRUE, size, cip)) {
@ -3899,7 +3899,7 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
while ((cip->code_addr = (yamop *) Yap_AllocCodeSpace(size)) == NULL) {
if (!Yap_growheap(TRUE, size, cip)) {
LOCAL_Error_TYPE = OUT_OF_HEAP_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP;
LOCAL_Error_Size = size;
return NULL;
}

View File

@ -266,7 +266,7 @@ Yap_InitConstExps(void)
for (i = 0; i < sizeof(InitConstTab)/sizeof(InitConstEntry); ++i) {
AtomEntry *ae = RepAtom(Yap_LookupAtom(InitConstTab[i].OpName));
if (ae == NULL) {
Yap_EvalError(OUT_OF_HEAP_ERROR,TermNil,"at InitConstExps");
Yap_EvalError(RESOURCE_ERROR_HEAP,TermNil,"at InitConstExps");
return;
}
WRITE_LOCK(ae->ARWLock);

View File

@ -1050,7 +1050,7 @@ Yap_InitUnaryExps(void)
for (i = 0; i < sizeof(InitUnTab)/sizeof(InitUnEntry); ++i) {
AtomEntry *ae = RepAtom(Yap_LookupAtom(InitUnTab[i].OpName));
if (ae == NULL) {
Yap_EvalError(OUT_OF_HEAP_ERROR,TermNil,"at InitUnaryExps");
Yap_EvalError(RESOURCE_ERROR_HEAP,TermNil,"at InitUnaryExps");
return;
}
WRITE_LOCK(ae->ARWLock);

View File

@ -1342,7 +1342,7 @@ Yap_InitBinaryExps(void)
for (i = 0; i < sizeof(InitBinTab)/sizeof(InitBinEntry); ++i) {
AtomEntry *ae = RepAtom(Yap_LookupAtom(InitBinTab[i].OpName));
if (ae == NULL) {
Yap_EvalError(OUT_OF_HEAP_ERROR,TermNil,"at InitBinaryExps");
Yap_EvalError(RESOURCE_ERROR_HEAP,TermNil,"at InitBinaryExps");
return;
}
WRITE_LOCK(ae->ARWLock);

View File

@ -239,19 +239,19 @@ CloseMmappedArray(StaticArrayEntry *pp, void *area USES_REGS)
}
if (ptr == NULL) {
#if !defined(USE_SYSTEM_MALLOC)
Yap_Error(SYSTEM_ERROR,ARG1,"close_mmapped_array (array chain incoherent)", strerror(errno));
Yap_Error(SYSTEM_ERROR_INTERNAL,ARG1,"close_mmapped_array (array chain incoherent)", strerror(errno));
#endif
return FALSE;
}
if (munmap(ptr->start, ptr->size) == -1) {
Yap_Error(SYSTEM_ERROR,ARG1,"close_mmapped_array (munmap: %s)", strerror(errno));
Yap_Error(SYSTEM_ERROR_INTERNAL,ARG1,"close_mmapped_array (munmap: %s)", strerror(errno));
return(FALSE);
}
optr->next = ptr->next;
pp->ValueOfVE.ints = NULL;
pp->ArrayEArity = 0;
if (close(ptr->fd) < 0) {
Yap_Error(SYSTEM_ERROR,ARG1,"close_mmapped_array (close: %s)", strerror(errno));
Yap_Error(SYSTEM_ERROR_INTERNAL,ARG1,"close_mmapped_array (close: %s)", strerror(errno));
return(FALSE);
}
Yap_FreeAtomSpace((char *)ptr);
@ -274,24 +274,24 @@ ResizeMmappedArray(StaticArrayEntry *pp, Int dim, void *area USES_REGS)
and last we initialise again
*/
if (munmap(ptr->start, ptr->size) == -1) {
Yap_Error(SYSTEM_ERROR,ARG1,"resize_mmapped_array (munmap: %s)", strerror(errno));
Yap_Error(SYSTEM_ERROR_INTERNAL,ARG1,"resize_mmapped_array (munmap: %s)", strerror(errno));
return;
}
total_size = (ptr->size / ptr->items)*dim;
if (ftruncate(ptr->fd, total_size) < 0) {
Yap_Error(SYSTEM_ERROR,ARG1,"resize_mmapped_array (ftruncate: %s)", strerror(errno));
Yap_Error(SYSTEM_ERROR_INTERNAL,ARG1,"resize_mmapped_array (ftruncate: %s)", strerror(errno));
return;
}
if (lseek(ptr->fd, total_size-1, SEEK_SET) < 0) {
Yap_Error(SYSTEM_ERROR,ARG1,"resize_mmapped_array (lseek: %s)", strerror(errno));
Yap_Error(SYSTEM_ERROR_INTERNAL,ARG1,"resize_mmapped_array (lseek: %s)", strerror(errno));
return;
}
if (write(ptr->fd, "", 1) < 0) {
Yap_Error(SYSTEM_ERROR,ARG1,"resize_mmapped_array (write: %s)", strerror(errno));
Yap_Error(SYSTEM_ERROR_INTERNAL,ARG1,"resize_mmapped_array (write: %s)", strerror(errno));
return;
}
if ((ptr->start = (void *)mmap(0, (size_t) total_size, PROT_READ | PROT_WRITE, MAP_SHARED, ptr->fd, 0)) == (void *) - 1) {
Yap_Error(SYSTEM_ERROR,ARG1,"resize_mmapped_array (mmap: %s)", strerror(errno));
Yap_Error(SYSTEM_ERROR_INTERNAL,ARG1,"resize_mmapped_array (mmap: %s)", strerror(errno));
return;
}
ptr->size = total_size;
@ -308,16 +308,16 @@ GetTermFromArray(DBTerm *ref USES_REGS)
Term TRef;
while ((TRef = Yap_FetchTermFromDB(ref)) == 0L) {
if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) {
if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growglobal(NULL)) {
Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, TermNil, LOCAL_ErrorMessage);
return TermNil;
}
} else {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_gcl(LOCAL_Error_Size, 3, ENV, Yap_gcP())) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return TermNil;
}
}
@ -703,7 +703,7 @@ AllocateStaticArraySpace(StaticArrayEntry *p, static_array_types atype, void *ol
while ((p->ValueOfVE.floats = (Float *) Yap_AllocCodeSpace(asize) ) == NULL) {
YAPLeaveCriticalSection();
if (!Yap_growheap(FALSE, asize, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, LOCAL_ErrorMessage);
return;
}
YAPEnterCriticalSection();
@ -712,7 +712,7 @@ AllocateStaticArraySpace(StaticArrayEntry *p, static_array_types atype, void *ol
while ((p->ValueOfVE.floats = (Float *) Yap_ReallocCodeSpace(old, asize) ) == NULL) {
YAPLeaveCriticalSection();
if (!Yap_growheap(FALSE, asize, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, LOCAL_ErrorMessage);
return;
}
YAPEnterCriticalSection();
@ -727,7 +727,7 @@ CreateStaticArray(AtomEntry *ae, size_t dim, static_array_types type, CODEADDR s
if (EndOfPAEntr(p)) {
while ((p = (StaticArrayEntry *) Yap_AllocCodeSpace(sizeof(*p))) == NULL) {
if (!Yap_growheap(FALSE, sizeof(*p), NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, LOCAL_ErrorMessage);
return NULL;
}
}
@ -998,12 +998,12 @@ p_create_array( USES_REGS1 )
farray = Yap_MkFunctor(AtomArray, size);
if (HR+1+size > ASP-1024) {
if (!Yap_gcl((1+size)*sizeof(CELL), 2, ENV, Yap_gcP())) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK,TermNil,LOCAL_ErrorMessage);
return(FALSE);
} else {
if (HR+1+size > ASP-1024) {
if (!Yap_growstack( sizeof(CELL) * (size+1-(HR-ASP-1024)))) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
}
@ -1036,7 +1036,7 @@ p_create_array( USES_REGS1 )
if (HR+1+size > ASP-1024) {
WRITE_UNLOCK(ae->ARWLock);
if (!Yap_gcl((1+size)*sizeof(CELL), 2, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK,TermNil,LOCAL_ErrorMessage);
return(FALSE);
} else
goto restart;
@ -1057,7 +1057,7 @@ p_create_array( USES_REGS1 )
} else {
if (HR+1+size > ASP-1024) {
if (!Yap_gcl((1+size)*sizeof(CELL), 2, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK,TermNil,LOCAL_ErrorMessage);
return(FALSE);
} else
goto restart;
@ -1490,19 +1490,19 @@ p_create_mmapped_array( USES_REGS1 )
fd = open(filename, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
if (fd == -1) {
Yap_Error(SYSTEM_ERROR,ARG1,"create_mmapped_array (open: %s)", strerror(errno));
Yap_Error(SYSTEM_ERROR_INTERNAL,ARG1,"create_mmapped_array (open: %s)", strerror(errno));
return(FALSE);
}
if (lseek(fd, total_size-1, SEEK_SET) < 0)
Yap_Error(SYSTEM_ERROR,tfile,"create_mmapped_array (lseek: %s)", strerror(errno));
Yap_Error(SYSTEM_ERROR_INTERNAL,tfile,"create_mmapped_array (lseek: %s)", strerror(errno));
if (write(fd, "", 1) < 0)
Yap_Error(SYSTEM_ERROR,tfile,"create_mmapped_array (write: %s)", strerror(errno));
Yap_Error(SYSTEM_ERROR_INTERNAL,tfile,"create_mmapped_array (write: %s)", strerror(errno));
/*
if (ftruncate(fd, total_size) < 0)
Yap_Error(SYSTEM_ERROR,tfile,"create_mmapped_array");
Yap_Error(SYSTEM_ERROR_INTERNAL,tfile,"create_mmapped_array");
*/
if ((array_addr = (CODEADDR)mmap(0, (size_t) total_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == (CODEADDR) - 1)
Yap_Error(SYSTEM_ERROR,tfile,"create_mmapped_array (mmap: %s)", strerror(errno));
Yap_Error(SYSTEM_ERROR_INTERNAL,tfile,"create_mmapped_array (mmap: %s)", strerror(errno));
} else {
Yap_Error(TYPE_ERROR_ATOM,tfile,"create_mmapped_array");
return (FALSE);
@ -1552,7 +1552,7 @@ p_create_mmapped_array( USES_REGS1 )
return FALSE;
}
#else
Yap_Error(SYSTEM_ERROR,ARG1,"create_mmapped_array (mmap)");
Yap_Error(SYSTEM_ERROR_INTERNAL,ARG1,"create_mmapped_array (mmap)");
return (FALSE);
#endif
}
@ -1777,7 +1777,7 @@ p_assign_static( USES_REGS1 )
MaBind(ptr, t3);
return(TRUE);
#else
Yap_Error(SYSTEM_ERROR,t2,"update_array");
Yap_Error(SYSTEM_ERROR_INTERNAL,t2,"update_array");
return(FALSE);
#endif
} else {
@ -1817,7 +1817,7 @@ p_assign_static( USES_REGS1 )
MaBind(pt, t3);
return TRUE;
#else
Yap_Error(SYSTEM_ERROR,t2,"update_array");
Yap_Error(SYSTEM_ERROR_INTERNAL,t2,"update_array");
return FALSE;
#endif
}
@ -2109,7 +2109,7 @@ p_assign_dynamic( USES_REGS1 )
MaBind(ptr, t3);
return(TRUE);
#else
Yap_Error(SYSTEM_ERROR,t2,"update_array");
Yap_Error(SYSTEM_ERROR_INTERNAL,t2,"update_array");
return(FALSE);
#endif
} else {
@ -2148,7 +2148,7 @@ p_assign_dynamic( USES_REGS1 )
MaBind(pt, t3);
return TRUE;
#else
Yap_Error(SYSTEM_ERROR,t2,"update_array");
Yap_Error(SYSTEM_ERROR_INTERNAL,t2,"update_array");
return FALSE;
#endif
}
@ -2195,7 +2195,7 @@ p_assign_dynamic( USES_REGS1 )
return TRUE;
#else
WRITE_UNLOCK(ptr->ArRWLock);
Yap_Error(SYSTEM_ERROR,t2,"update_array");
Yap_Error(SYSTEM_ERROR_INTERNAL,t2,"update_array");
return FALSE;
#endif
@ -2301,7 +2301,7 @@ p_add_to_array_element( USES_REGS1 )
MaBind(ptr, ta);
return(Yap_unify(ARG4,ta));
#else
Yap_Error(SYSTEM_ERROR,t2,"add_to_array_element");
Yap_Error(SYSTEM_ERROR_INTERNAL,t2,"add_to_array_element");
return(FALSE);
#endif
} else {
@ -2369,7 +2369,7 @@ p_add_to_array_element( USES_REGS1 )
WRITE_UNLOCK(pp->ArRWLock);
return Yap_unify(ARG4,t3);
#else
Yap_Error(SYSTEM_ERROR,t2,"add_to_array_element");
Yap_Error(SYSTEM_ERROR_INTERNAL,t2,"add_to_array_element");
WRITE_UNLOCK(pp->ArRWLock);
return FALSE;
#endif
@ -2485,12 +2485,12 @@ p_static_array_to_term( USES_REGS1 )
while (HR+1+dim > ASP-1024) {
if (!Yap_gcl((1+dim)*sizeof(CELL), 2, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK,TermNil,LOCAL_ErrorMessage);
return(FALSE);
} else {
if (HR+1+dim > ASP-1024) {
if (!Yap_growstack( sizeof(CELL) * (dim+1-(HR-ASP-1024)))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
}

View File

@ -109,7 +109,7 @@ hide( USES_REGS1 )
}
atomToInclude = AtomOfTerm(t1);
if (AlreadyHidden(RepAtom(atomToInclude)->UStrOfAE)) {
Yap_Error(SYSTEM_ERROR,t1,"an atom of name %s was already hidden",
Yap_Error(SYSTEM_ERROR_INTERNAL,t1,"an atom of name %s was already hidden",
RepAtom(atomToInclude)->StrOfAE);
return(FALSE);
}
@ -176,7 +176,7 @@ unhide( USES_REGS1 )
atom = RepAtom(AtomOfTerm(t1));
WRITE_LOCK(atom->ARWLock);
if (atom->PropsOfAE != NIL) {
Yap_Error(SYSTEM_ERROR,t1,"cannot unhide an atom in use");
Yap_Error(SYSTEM_ERROR_INTERNAL,t1,"cannot unhide an atom in use");
return(FALSE);
}
WRITE_LOCK(INVISIBLECHAIN.AERWLock);
@ -1019,7 +1019,7 @@ atom_concat2( USES_REGS1 )
Atom at;
if (!inpv) {
LOCAL_Error_TYPE = OUT_OF_HEAP_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP;
free(inpv);
goto error;
}
@ -1067,7 +1067,7 @@ string_concat2( USES_REGS1 )
int i = 0;
if (!inpv) {
LOCAL_Error_TYPE = OUT_OF_HEAP_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP;
free(inpv);
goto error;
}
@ -1116,7 +1116,7 @@ atomic_concat2( USES_REGS1 )
Atom at;
if (!inpv) {
LOCAL_Error_TYPE = OUT_OF_HEAP_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP;
free(inpv);
goto error;
}
@ -1161,7 +1161,7 @@ atomics_to_string2( USES_REGS1 )
Atom at;
if (!inpv) {
LOCAL_Error_TYPE = OUT_OF_HEAP_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP;
free(inpv);
goto error;
}
@ -1207,7 +1207,7 @@ atomics_to_string3( USES_REGS1 )
Atom at;
if (!inpv) {
LOCAL_Error_TYPE = OUT_OF_HEAP_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP;
free(inpv);
goto error;
}
@ -1395,7 +1395,7 @@ atom_split( USES_REGS1 )
wlen = wcslen(ws);
if (len > wlen) return FALSE;
if (s1+len > (unsigned char *)LCL0-1024)
Yap_Error(OUT_OF_STACK_ERROR,t1,"$atom_split/4");
Yap_Error(RESOURCE_ERROR_STACK,t1,"$atom_split/4");
for (i = 0; i< len; i++) {
if (ws[i] > MAX_ISO_LATIN1) {
break;
@ -1405,7 +1405,7 @@ atom_split( USES_REGS1 )
if (ws1[i] > MAX_ISO_LATIN1) {
/* first sequence is wide */
if (ws1+len > (wchar_t *)ASP-1024)
Yap_Error(OUT_OF_STACK_ERROR,t1,"$atom_split/4");
Yap_Error(RESOURCE_ERROR_STACK,t1,"$atom_split/4");
ws = (wchar_t *)RepAtom(at)->StrOfAE;
for (i = 0; i< len; i++) {
ws1[i] = ws[i];
@ -1418,7 +1418,7 @@ atom_split( USES_REGS1 )
} else {
char *s2 = (char *)HR;
if (s2+(wlen-len) > (char *)ASP-1024)
Yap_Error(OUT_OF_STACK_ERROR,t1,"$atom_split/4");
Yap_Error(RESOURCE_ERROR_STACK,t1,"$atom_split/4");
ws += len;
while ((*s2++ = *ws++));
to2 = MkAtomTerm(Yap_LookupAtom(( char *)HR));
@ -1435,7 +1435,7 @@ atom_split( USES_REGS1 )
s = RepAtom(at)->UStrOfAE;
if (len > (Int)strlen((char *)s)) return(FALSE);
if (s1+len > (unsigned char *)ASP-1024)
Yap_Error(OUT_OF_STACK_ERROR,t1,"$atom_split/4");
Yap_Error(RESOURCE_ERROR_STACK,t1,"$atom_split/4");
for (i = 0; i< len; i++) {
s1[i] = s[i];
}
@ -1510,7 +1510,7 @@ alloc_tmp_stack(size_t sz USES_REGS) {
void *pt = (void *)HR;
while (HR > ASP-(1044+sz/sizeof(CELL))) {
if (!Yap_gc(5, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "sub_atom/5");
Yap_Error(RESOURCE_ERROR_STACK, TermNil, "sub_atom/5");
return(NULL);
}
}
@ -1548,7 +1548,7 @@ build_new_atomic(int mask, wchar_t *wp, const unsigned char *p, size_t min, size
src = skip_utf8((unsigned char *)src, min);
const unsigned char *cp = src;
LOCAL_TERM_ERROR( 4*(len+1) );
LOCAL_TERM_ERROR( t, 4*(len+1) );
buf = buf_from_tstring(HR);
while (len) {
utf8proc_int32_t chr;

View File

@ -140,7 +140,7 @@ void
Yap_MkEmptyWakeUp(Atom mod)
{
if (MaxEmptyWakeups == MAX_EMPTY_WAKEUPS)
Yap_Error(SYSTEM_ERROR, TermNil, "too many modules that do not wake up");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "too many modules that do not wake up");
EmptyWakeups[MaxEmptyWakeups++] = mod;
}
@ -422,7 +422,7 @@ BindAttVar(attvar_record *attv USES_REGS) {
Bind_Global_NonAtt(&(attv2->Done), AbsAttVar(attv));
}
} else {
Yap_Error(SYSTEM_ERROR,(CELL)&(attv->Done),"attvar was bound when unset");
Yap_Error(SYSTEM_ERROR_INTERNAL,(CELL)&(attv->Done),"attvar was bound when unset");
return(FALSE);
}
} else {
@ -431,7 +431,7 @@ BindAttVar(attvar_record *attv USES_REGS) {
}
return(TRUE);
} else {
Yap_Error(SYSTEM_ERROR,(CELL)&(attv->Done),"attvar was bound when set");
Yap_Error(SYSTEM_ERROR_INTERNAL,(CELL)&(attv->Done),"attvar was bound when set");
return(FALSE);
}
}
@ -467,7 +467,7 @@ p_put_att( USES_REGS1 ) {
while (!(attv = BuildNewAttVar( PASS_REGS1 ))) {
LOCAL_Error_Size = sizeof(attvar_record);
if (!Yap_gcl(LOCAL_Error_Size, 5, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
inp = Deref(ARG1);
@ -478,7 +478,7 @@ p_put_att( USES_REGS1 ) {
if (IsVarTerm(tatts = SearchAttsForModule(attv->Atts,mfun))) {
while (!(tatts = BuildAttTerm(mfun,ar PASS_REGS))) {
if (!Yap_gcl(LOCAL_Error_Size, 5, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
}
@ -512,7 +512,7 @@ p_put_att_term( USES_REGS1 ) {
while (!(attv = BuildNewAttVar( PASS_REGS1 ))) {
LOCAL_Error_Size = sizeof(attvar_record);
if (!Yap_gcl(LOCAL_Error_Size, 5, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
inp = Deref(ARG1);
@ -546,7 +546,7 @@ p_rm_att( USES_REGS1 ) {
while (!(attv = BuildNewAttVar( PASS_REGS1 ))) {
LOCAL_Error_Size = sizeof(attvar_record);
if (!Yap_gcl(LOCAL_Error_Size, 5, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
inp = Deref(ARG1);
@ -558,7 +558,7 @@ p_rm_att( USES_REGS1 ) {
if (IsVarTerm(tatts = SearchAttsForModule(attv->Atts,mfun))) {
while (!(tatts = BuildAttTerm(mfun, ar PASS_REGS))) {
if (!Yap_gcl(LOCAL_Error_Size, 4, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
}
@ -593,7 +593,7 @@ p_put_atts( USES_REGS1 ) {
while (!(attv = BuildNewAttVar( PASS_REGS1 ))) {
LOCAL_Error_Size = sizeof(attvar_record);
if (!Yap_gcl(LOCAL_Error_Size, 2, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
tatts = Deref(ARG2);
@ -992,7 +992,7 @@ p_all_attvars( USES_REGS1 )
if (!(out = AllAttVars( PASS_REGS1 ))) {
if (!Yap_gcl(LOCAL_Error_Size, 1, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
} else {

8
C/bb.c
View File

@ -60,7 +60,7 @@ PutBBProp(AtomEntry *ae, Term mod USES_REGS) /* get BBentry for at; */
p = (BBProp)Yap_AllocAtomSpace(sizeof(*p));
if (p == NULL) {
WRITE_UNLOCK(ae->ARWLock);
Yap_Error(OUT_OF_HEAP_ERROR,ARG1,"could not allocate space in bb_put/2");
Yap_Error(RESOURCE_ERROR_HEAP,ARG1,"could not allocate space in bb_put/2");
return(NULL);
}
AddPropToAtom(ae, (PropEntry *)p);
@ -91,7 +91,7 @@ PutIntBBProp(Int key, Term mod USES_REGS) /* get BBentry for at; */
pp++;
}
} else {
Yap_Error(OUT_OF_HEAP_ERROR,ARG1,"could not allocate space in bb_put/2");
Yap_Error(RESOURCE_ERROR_HEAP,ARG1,"could not allocate space in bb_put/2");
return(NULL);
}
}
@ -108,7 +108,7 @@ PutIntBBProp(Int key, Term mod USES_REGS) /* get BBentry for at; */
p = (BBProp)Yap_AllocAtomSpace(sizeof(*p));
if (p == NULL) {
YAPLeaveCriticalSection();
Yap_Error(OUT_OF_HEAP_ERROR,ARG1,"could not allocate space in bb_put/2");
Yap_Error(RESOURCE_ERROR_HEAP,ARG1,"could not allocate space in bb_put/2");
return(NULL);
}
p->ModuleOfBB = mod;
@ -179,7 +179,7 @@ resize_bb_int_keys(UInt new_size) {
new = (Prop *)Yap_AllocCodeSpace(sizeof(Prop)*new_size);
if (new == NULL) {
YAPLeaveCriticalSection();
Yap_Error(OUT_OF_HEAP_ERROR,ARG1,"could not allocate space");
Yap_Error(RESOURCE_ERROR_HEAP,ARG1,"could not allocate space");
return(FALSE);
}
for (i = 0; i < new_size; i++) {

View File

@ -170,14 +170,14 @@ int Yap_CleanOpaqueVariable(CELL *pt)
#ifdef DEBUG
/* sanity checking */
if (pt[0] != (CELL)FunctorBigInt) {
Yap_Error(SYSTEM_ERROR, TermNil, "CleanOpaqueVariable bad call");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "CleanOpaqueVariable bad call");
return FALSE;
}
#endif
blob_tag = pt[1];
if (blob_tag < USER_BLOB_START ||
blob_tag >= USER_BLOB_END) {
Yap_Error(SYSTEM_ERROR, AbsAppl(pt), "clean opaque: bad blob with tag " UInt_FORMAT ,blob_tag);
Yap_Error(SYSTEM_ERROR_INTERNAL, AbsAppl(pt), "clean opaque: bad blob with tag " UInt_FORMAT ,blob_tag);
return FALSE;
}
blob_info = blob_tag - USER_BLOB_START;
@ -198,14 +198,14 @@ Yap_blob_write_handler(Term t)
#ifdef DEBUG
/* sanity checking */
if (pt[0] != (CELL)FunctorBigInt) {
Yap_Error(SYSTEM_ERROR, TermNil, "CleanOpaqueVariable bad call");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "CleanOpaqueVariable bad call");
return FALSE;
}
#endif
blob_tag = pt[1];
if (blob_tag < USER_BLOB_START ||
blob_tag >= USER_BLOB_END) {
Yap_Error(SYSTEM_ERROR, AbsAppl(pt), "clean opaque: bad blob with tag " UInt_FORMAT ,blob_tag);
Yap_Error(SYSTEM_ERROR_INTERNAL, AbsAppl(pt), "clean opaque: bad blob with tag " UInt_FORMAT ,blob_tag);
return FALSE;
}
blob_info = blob_tag - USER_BLOB_START;
@ -224,7 +224,7 @@ Yap_blob_gc_mark_handler(Term t)
#ifdef DEBUG
/* sanity checking */
if (pt[0] != (CELL)FunctorBigInt) {
Yap_Error(SYSTEM_ERROR, TermNil, "CleanOpaqueVariable bad call");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "CleanOpaqueVariable bad call");
return FALSE;
}
#endif
@ -248,14 +248,14 @@ Yap_blob_gc_relocate_handler(Term t)
#ifdef DEBUG
/* sanity checking */
if (pt[0] != (CELL)FunctorBigInt) {
Yap_Error(SYSTEM_ERROR, TermNil, "CleanOpaqueVariable bad call");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "CleanOpaqueVariable bad call");
return FALSE;
}
#endif
blob_tag = pt[1];
if (blob_tag < USER_BLOB_START ||
blob_tag >= USER_BLOB_END) {
Yap_Error(SYSTEM_ERROR, AbsAppl(pt), "clean opaque: bad blob with tag " UInt_FORMAT ,blob_tag);
Yap_Error(SYSTEM_ERROR_INTERNAL, AbsAppl(pt), "clean opaque: bad blob with tag " UInt_FORMAT ,blob_tag);
return FALSE;
}
blob_info = blob_tag - USER_BLOB_START;
@ -271,7 +271,7 @@ extern Int Yap_blob_tag(Term t)
#ifdef DEBUG
/* sanity checking */
if (pt[0] != (CELL)FunctorBigInt) {
Yap_Error(SYSTEM_ERROR, TermNil, "CleanOpaqueVariable bad call");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "CleanOpaqueVariable bad call");
return FALSE;
}
#endif
@ -287,7 +287,7 @@ Yap_blob_info(Term t)
#ifdef DEBUG
/* sanity checking */
if (pt[0] != (CELL)FunctorBigInt) {
Yap_Error(SYSTEM_ERROR, TermNil, "CleanOpaqueVariable bad call");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "CleanOpaqueVariable bad call");
return FALSE;
}
#endif
@ -342,7 +342,7 @@ Yap_HeapStoreOpaqueTerm(Term t)
}
new = Yap_AllocCodeSpace(sz);
if (!new) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "subgoal_search_loop: no space for %s", StringOfTerm(t) );
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, "subgoal_search_loop: no space for %s", StringOfTerm(t) );
} else {
if (ptr[0] == (CELL)FunctorBigInt) {
MP_INT *new = (MP_INT *)(RepAppl(t)+2);
@ -539,7 +539,7 @@ p_rational( USES_REGS1 )
(mpq_numref(rat)->_mp_alloc)*(sizeof(mp_limb_t)/CellSize) +
(mpq_denref(rat)->_mp_alloc)*(sizeof(mp_limb_t)/CellSize);
if (!Yap_gcl(size, 3, ENV, P)) {
Yap_Error(OUT_OF_STACK_ERROR, t, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, t, LOCAL_ErrorMessage);
return FALSE;
}
}

View File

@ -256,7 +256,7 @@
* missing ;
*
* Revision 1.58 2004/11/19 22:08:41 vsc
* replace SYSTEM_ERROR by out OUT_OF_WHATEVER_ERROR whenever appropriate.
* replace SYSTEM_ERROR_INTERNAL by out OUT_OF_WHATEVER_ERROR whenever appropriate.
*
* Revision 1.57 2004/11/18 22:32:31 vsc
* fix situation where we might assume nonextsing double initialisation of C predicates (use
@ -699,7 +699,7 @@ YAP_MkBlobTerm(unsigned int sz)
while (HR+(sz+sizeof(MP_INT)/sizeof(CELL)+2) > ASP-1024) {
if (!doexpand((sz+sizeof(MP_INT)/sizeof(CELL)+2)*sizeof(CELL))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "YAP failed to grow the stack while constructing a blob: %s", LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, "YAP failed to grow the stack while constructing a blob: %s", LOCAL_ErrorMessage);
return TermNil;
}
}
@ -796,7 +796,7 @@ YAP_LookupAtom(const char *c)
a = Yap_LookupAtom(c);
if (a == NIL || Yap_get_signal(YAP_CDOVF_SIGNAL)) {
if (!Yap_locked_growheap(FALSE, 0, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, "YAP failed to grow heap: %s", LOCAL_ErrorMessage);
}
} else {
return a;
@ -815,7 +815,7 @@ YAP_LookupWideAtom(const wchar_t *c)
a = Yap_LookupWideAtom((wchar_t *)c);
if (a == NIL || Yap_get_signal(YAP_CDOVF_SIGNAL)) {
if (!Yap_locked_growheap(FALSE, 0, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, "YAP failed to grow heap: %s", LOCAL_ErrorMessage);
}
} else {
return a;
@ -834,7 +834,7 @@ YAP_FullLookupAtom(const char *c)
at = Yap_FullLookupAtom(c);
if (at == NIL || Yap_get_signal(YAP_CDOVF_SIGNAL)) {
if (!Yap_locked_growheap(FALSE, 0, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, "YAP failed to grow heap: %s", LOCAL_ErrorMessage);
}
} else {
return at;
@ -1354,7 +1354,7 @@ execute_cargs(PredEntry *pe, CPredicate exec_code USES_REGS)
return code10(a1, a1+1, a1+2, a1+3, a1+4, a1+5, a1+6, a1+7, a1+8, a1+9);
}
default:
YAP_Error(SYSTEM_ERROR, TermNil, "YAP only supports SWI C-call with arity =< 10");
YAP_Error(SYSTEM_ERROR_INTERNAL, TermNil, "YAP only supports SWI C-call with arity =< 10");
return(FALSE);
}
}
@ -1441,7 +1441,7 @@ execute_cargs_back(PredEntry *pe, CPredicate exec_code, struct foreign_context *
return code10(a1, a1+1, a1+2, a1+3, a1+4, a1+5, a1+6, a1+7, a1+8, a1+9, ctx);
}
default:
YAP_Error(SYSTEM_ERROR, TermNil, "YAP only supports SWI C-call with arity =< 10");
YAP_Error(SYSTEM_ERROR_INTERNAL, TermNil, "YAP only supports SWI C-call with arity =< 10");
return(FALSE);
}
}
@ -1755,7 +1755,7 @@ YAP_ReallocSpaceFromYap(void *ptr,size_t size) {
BACKUP_MACHINE_REGS();
while ((new_ptr = Yap_ReallocCodeSpace(ptr,size)) == NULL) {
if (!Yap_growheap(FALSE, size, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, LOCAL_ErrorMessage);
return NULL;
}
}
@ -1771,7 +1771,7 @@ YAP_AllocSpaceFromYap(size_t size)
while ((ptr = Yap_AllocCodeSpace(size)) == NULL) {
if (!Yap_growheap(FALSE, size, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, LOCAL_ErrorMessage);
return NULL;
}
}
@ -2136,7 +2136,7 @@ YAP_Error(int myerrno, Term t, const char *buf,...)
char tmpbuf[YAP_BUF_SIZE];
if (!myerrno)
myerrno = SYSTEM_ERROR;
myerrno = SYSTEM_ERROR_INTERNAL;
if (t == 0L)
t = TermNil;
if (buf != NULL) {
@ -2594,17 +2594,17 @@ YAP_GoalHasException(Term *t)
if (LOCAL_Error_TYPE == YAP_NO_ERROR) {
RECOVER_MACHINE_REGS();
return TRUE;
} else if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) {
} else if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growglobal(NULL)) {
Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, TermNil, LOCAL_ErrorMessage);
RECOVER_MACHINE_REGS();
return FALSE;
}
} else {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growstack(EX->NOfCells*CellSize)) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
RECOVER_MACHINE_REGS();
return FALSE;
}
@ -2782,7 +2782,7 @@ YAP_CompileClause(Term t)
if (Yap_get_signal( YAP_CDOVF_SIGNAL ) ) {
if (!Yap_locked_growheap(FALSE, 0, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, "YAP failed to grow heap: %s", LOCAL_ErrorMessage);
}
}
RECOVER_MACHINE_REGS();
@ -3012,7 +3012,7 @@ CACHE_REGS
CurrentModule = USER_MODULE;
P = GETWORK_FIRST_TIME;
Yap_exec_absmi(FALSE, YAP_EXEC_ABSMI);
Yap_Error(INTERNAL_ERROR, TermNil, "abstract machine unexpected exit (YAP_Init)");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "abstract machine unexpected exit (YAP_Init)");
}
#endif /* YAPOR */
RECOVER_MACHINE_REGS();
@ -3709,7 +3709,7 @@ YAP_Record(Term t)
if (!Yap_growheap(FALSE, sizeof(struct record_list), NULL)) {
/* be a good neighbor */
Yap_FreeCodeSpace((void *)dbterm);
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "using YAP_Record");
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, "using YAP_Record");
return NULL;
}
}
@ -3737,17 +3737,17 @@ YAP_Recorded(void *handle)
if (LOCAL_Error_TYPE == YAP_NO_ERROR) {
RECOVER_MACHINE_REGS();
return t;
} else if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) {
} else if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growglobal(NULL)) {
Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, TermNil, LOCAL_ErrorMessage);
RECOVER_MACHINE_REGS();
return FALSE;
}
} else {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growstack(dbterm->NOfCells*CellSize)) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
RECOVER_MACHINE_REGS();
return FALSE;
}
@ -4044,7 +4044,7 @@ YAP_AtomToInt(Atom At)
if (AtomTranslations == MaxAtomTranslations) {
Atom * nt = (Atom *)malloc(sizeof(Atom)*2*MaxAtomTranslations), *ot = SWI_Atoms;
if (nt == NULL) {
Yap_Error(SYSTEM_ERROR,MkAtomTerm(At),"No more room for translations");
Yap_Error(SYSTEM_ERROR_INTERNAL,MkAtomTerm(At),"No more room for translations");
return -1;
}
memcpy(nt, ot, sizeof(Atom)*MaxAtomTranslations);
@ -4074,7 +4074,7 @@ YAP_FunctorToInt(Functor f)
if (FunctorTranslations == MaxFunctorTranslations) {
Functor * nt = (Functor *)malloc(sizeof(Functor)*2*MaxFunctorTranslations), *ot = SWI_Functors;
if (nt == NULL) {
Yap_Error(SYSTEM_ERROR,MkAtomTerm(At),"No more room for translations");
Yap_Error(SYSTEM_ERROR_INTERNAL,MkAtomTerm(At),"No more room for translations");
return -1;
}
memcpy(nt, ot, sizeof(Functor)*MaxFunctorTranslations);

View File

@ -519,7 +519,7 @@ InitConsultStack( void )
CACHE_REGS
LOCAL_ConsultLow = (consult_obj *)Yap_AllocCodeSpace(sizeof(consult_obj)*InitialConsultCapacity);
if (LOCAL_ConsultLow == NULL) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"No Heap Space in InitCodes");
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"No Heap Space in InitCodes");
return;
}
LOCAL_ConsultCapacity = InitialConsultCapacity;
@ -780,9 +780,9 @@ split_megaclause(PredEntry *ap)
Yap_FreeCodeSpace((char *)cl);
}
if (ap->ArityOfPE) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"while breaking up mega clause for %s/%d\n",RepAtom(NameOfFunctor(ap->FunctorOfPred))->StrOfAE,ap->ArityOfPE);
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"while breaking up mega clause for %s/%d\n",RepAtom(NameOfFunctor(ap->FunctorOfPred))->StrOfAE,ap->ArityOfPE);
} else {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"while breaking up mega clause for %s\n", RepAtom((Atom)ap->FunctorOfPred)->StrOfAE);
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"while breaking up mega clause for %s\n", RepAtom((Atom)ap->FunctorOfPred)->StrOfAE);
}
return;
}
@ -862,7 +862,7 @@ IPred(PredEntry *ap, UInt NSlots, yamop *next_pc)
#endif
/* Do not try to index a dynamic predicate or one whithout args */
if (is_dynamic(ap)) {
Yap_Error(SYSTEM_ERROR,TermNil,"trying to index a dynamic predicate");
Yap_Error(SYSTEM_ERROR_INTERNAL,TermNil,"trying to index a dynamic predicate");
return;
}
if ((BaseAddr = Yap_PredIsIndexable(ap, NSlots, next_pc)) != NULL) {
@ -1137,7 +1137,7 @@ cleanup_dangling_indices(yamop *ipc, yamop *beg, yamop *end, yamop *suspend_code
case _op_fail:
return;
default:
Yap_Error(SYSTEM_ERROR,TermNil,"Bug in Indexing Code: opcode %d", op);
Yap_Error(SYSTEM_ERROR_INTERNAL,TermNil,"Bug in Indexing Code: opcode %d", op);
return;
}
#if defined(YAPOR) || defined(THREADS)
@ -1588,7 +1588,7 @@ add_first_dynamic(PredEntry *p, yamop *cp, int spy_flag)
cl =
(DynamicClause *) Yap_AllocCodeSpace((Int)NEXTOP(NEXTOP(NEXTOP(ncp,Otapl),e),l));
if (cl == NIL) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"Heap crashed against Stacks");
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"Heap crashed against Stacks");
return;
}
Yap_ClauseSpace += (Int)NEXTOP(NEXTOP(NEXTOP(ncp,Otapl),e),l);
@ -1834,7 +1834,7 @@ static void expand_consult( void )
/* I assume it always works ;-) */
while ((new_cl = (consult_obj *)Yap_AllocCodeSpace(sizeof(consult_obj)*LOCAL_ConsultCapacity)) == NULL) {
if (!Yap_growheap(FALSE, sizeof(consult_obj)*LOCAL_ConsultCapacity, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,LOCAL_ErrorMessage);
return;
}
}
@ -2245,7 +2245,7 @@ addclause(Term t, yamop *cp, int mode, Term mod, Term *t4ref)
sc[3] = t;
Yap_PrintWarning( Yap_MkApplTerm(Yap_MkFunctor(AtomStyleCheck, 4), 4, sc) );
} else if (Yap_multiple( p, mode PASS_REGS ) ) {
Term disc[4], sc[4], disct;
Term disc[4], sc[4];
if (p->ArityOfPE) {
disc[0] = MkAtomTerm(NameOfFunctor(p->FunctorOfPred));
} else {
@ -2707,7 +2707,7 @@ p_purge_clauses( USES_REGS1 )
in case the objs pointing to it are dead themselves */
if (DeadMegaClauses != before) {
if (!Yap_gc(2, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
}
@ -3959,18 +3959,18 @@ fetch_next_lu_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr, ya
ARG5 = th;
ARG6 = tb;
ARG7 = tr;
if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) {
if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growglobal(NULL)) {
UNLOCK(pe->PELock);
Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
} else {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_gcl(LOCAL_Error_Size, 7, ENV, gc_P(P,CP))) {
UNLOCK(pe->PELock);
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
}
@ -3983,7 +3983,7 @@ fetch_next_lu_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr, ya
ARG8 = tr;
if (!Yap_gcl(LOCAL_Error_Size, 8, ENV, gc_P(P,CP))) {
UNLOCK(pe->PELock);
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
th = ARG6;
@ -4107,18 +4107,18 @@ fetch_next_lu_clause_erase(PredEntry *pe, yamop *i_code, Term th, Term tb, Term
ARG5 = th;
ARG6 = tb;
ARG7 = tr;
if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) {
if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_locked_growglobal(NULL)) {
UNLOCK(pe->PELock);
Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
} else {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_locked_gcl(LOCAL_Error_Size, 7, ENV, gc_P(P,CP))) {
UNLOCK(pe->PELock);
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
}
@ -4131,7 +4131,7 @@ fetch_next_lu_clause_erase(PredEntry *pe, yamop *i_code, Term th, Term tb, Term
ARG8 = tr;
if (!Yap_gcl(LOCAL_Error_Size, 8, ENV, CP)) {
UNLOCK(pe->PELock);
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
th = ARG6;
@ -4215,7 +4215,7 @@ replace_integer(Term orig, UInt new)
/* should create an old integer */
if (!IsApplTerm(orig)) {
CACHE_REGS
Yap_Error(SYSTEM_ERROR,orig,"%uld-->%uld where it should increase",(unsigned long int)IntegerOfTerm(orig),(unsigned long int)new);
Yap_Error(SYSTEM_ERROR_INTERNAL,orig,"%uld-->%uld where it should increase",(unsigned long int)IntegerOfTerm(orig),(unsigned long int)new);
return MkIntegerTerm(new);
}
/* appl->appl */
@ -4376,7 +4376,7 @@ Yap_UpdateTimestamps(PredEntry *ap)
LogUpdClause *lcl;
#if THREADS
Yap_Error(SYSTEM_ERROR,TermNil,"Timestamp overflow %p", ap);
Yap_Error(SYSTEM_ERROR_INTERNAL,TermNil,"Timestamp overflow %p", ap);
return;
#endif
if (!ap->cs.p_code.NOfClauses)
@ -4484,7 +4484,7 @@ Yap_UpdateTimestamps(PredEntry *ap)
return;
overflow:
if (!Yap_growstack(64*1024)) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return;
}
goto restart;
@ -4585,10 +4585,10 @@ fetch_next_static_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr
}
while ((t = Yap_FetchClauseTermFromDB(cl->usc.ClSource)) == 0L) {
if (first_time) {
if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) {
if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growglobal(NULL)) {
Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, TermNil, LOCAL_ErrorMessage);
UNLOCKPE(45,pe);
return FALSE;
}
@ -4598,7 +4598,7 @@ fetch_next_static_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr
ARG6 = tb;
ARG7 = tr;
if (!Yap_gc(7, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
UNLOCKPE(45,pe);
return FALSE;
}
@ -4612,7 +4612,7 @@ fetch_next_static_clause(PredEntry *pe, yamop *i_code, Term th, Term tb, Term tr
ARG7 = tb;
ARG8 = tr;
if (!Yap_gcl(LOCAL_Error_Size, 8, ENV, CP)) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
UNLOCKPE(45,pe);
return FALSE;
}
@ -4899,7 +4899,7 @@ p_dbassert( USES_REGS1 )
/* instance(+Ref,?Term) */
static Int
p_instance_property( USES_REGS1 )
instance_property( USES_REGS1 )
{
Term t1 = Deref(ARG1);
DBRef dbr;
@ -5293,7 +5293,7 @@ static Int predicate_flags(USES_REGS1) { /* $predicate_flags(+Functor,+Mod,?OldF
if (IsAtomTerm(t1)) {
while ((pe = RepPredProp(PredPropByAtom(AtomOfTerm(t1), mod))) == NULL) {
if (!Yap_growheap(FALSE, 0, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, ARG1, "while generating new predicate");
Yap_Error(RESOURCE_ERROR_HEAP, ARG1, "while generating new predicate");
return FALSE;
}
t1 = Deref(ARG1);
@ -5303,7 +5303,7 @@ static Int predicate_flags(USES_REGS1) { /* $predicate_flags(+Functor,+Mod,?OldF
Functor funt = FunctorOfTerm(t1);
while ((pe = RepPredProp(PredPropByFunc(funt, mod))) == NULL) {
if (!Yap_growheap(FALSE, 0, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, ARG1, "while generating new predicate");
Yap_Error(RESOURCE_ERROR_HEAP, ARG1, "while generating new predicate");
return FALSE;
}
t1 = Deref(ARG1);
@ -5404,7 +5404,7 @@ Yap_InitCdMgr(void)
Yap_InitCPred("$static_clause", 4, p_static_clause, SyncPredFlag);
Yap_InitCPred("$continue_static_clause", 5, p_continue_static_clause, SafePredFlag|SyncPredFlag);
Yap_InitCPred("$static_pred_statistics", 5, p_static_pred_statistics, SyncPredFlag);
Yap_InitCPred("$instance_property", 3, p_instance_property, SafePredFlag|SyncPredFlag);
Yap_InitCPred("instance_property", 3, instance_property, SafePredFlag|SyncPredFlag);
Yap_InitCPred("$fetch_nth_clause", 4, p_nth_instance, SyncPredFlag);
CurrentModule = DBLOAD_MODULE;
Yap_InitCPred("dbload_get_space", 4, p_dbload_get_space, 0L);

View File

@ -137,7 +137,7 @@
* Handle overflows when allocating big clauses properly.
*
* Revision 1.54 2004/11/19 22:08:41 vsc
* replace SYSTEM_ERROR by out OUT_OF_WHATEVER_ERROR whenever appropriate.
* replace SYSTEM_ERROR_INTERNAL by out OUT_OF_WHATEVER_ERROR whenever appropriate.
*
* Revision 1.53 2004/09/03 03:11:08 vsc
* memory management fixes
@ -579,7 +579,7 @@ compile_sf_term(Term t, int argno, int level)
if (IsAtomicTerm(t))
Yap_emit((cglobs->onhead ? unify_s_a_op : write_s_a_op), t, (CELL) argno, &cglobs->cint);
else if (!IsVarTerm(t)) {
LOCAL_Error_TYPE = INTERNAL_COMPILER_ERROR;
LOCAL_Error_TYPE = SYSTEM_ERROR_COMPILER;
LOCAL_Error_Term = TermNil;
LOCAL_ErrorMessage = "illegal argument of soft functor";
save_machine_regs();
@ -607,7 +607,7 @@ c_args(Term app, unsigned int level, compiler_struct *cglobs)
if (level == 0) {
if (Arity >= MaxTemps) {
LOCAL_Error_TYPE = INTERNAL_COMPILER_ERROR;
LOCAL_Error_TYPE = SYSTEM_ERROR_COMPILER;
LOCAL_Error_Term = TermNil;
LOCAL_ErrorMessage = "exceed maximum arity of compiled goal";
save_machine_regs();
@ -641,16 +641,16 @@ try_store_as_dbterm(Term t, Int argno, unsigned int arity, int level, compiler_s
if ((dbt = Yap_StoreTermInDB(t, -1)) == NULL) {
HR = h0;
switch(LOCAL_Error_TYPE) {
case OUT_OF_STACK_ERROR:
case RESOURCE_ERROR_STACK:
LOCAL_Error_TYPE = YAP_NO_ERROR;
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_STACK_BOTCH);
case OUT_OF_TRAIL_ERROR:
case RESOURCE_ERROR_TRAIL:
LOCAL_Error_TYPE = YAP_NO_ERROR;
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_TRAIL_BOTCH);
case OUT_OF_HEAP_ERROR:
case RESOURCE_ERROR_HEAP:
LOCAL_Error_TYPE = YAP_NO_ERROR;
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_HEAP_BOTCH);
case OUT_OF_AUXSPACE_ERROR:
case RESOURCE_ERROR_AUXILIARY_STACK:
LOCAL_Error_TYPE = YAP_NO_ERROR;
siglongjmp(cglobs->cint.CompilerBotch,OUT_OF_AUX_BOTCH);
default:
@ -968,7 +968,7 @@ c_test(Int Op, Term t1, compiler_struct *cglobs) {
if (!IsNewVar(t)) {
char s[32];
LOCAL_Error_TYPE = TYPE_ERROR_VARIABLE;
LOCAL_Error_TYPE = UNINSTANTIATION_ERROR;
LOCAL_Error_Term = t;
LOCAL_ErrorMessage = LOCAL_ErrorSay;
Yap_bip_name(Op, s);
@ -1315,7 +1315,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
} else {
char s[32];
LOCAL_Error_TYPE = TYPE_ERROR_VARIABLE;
LOCAL_Error_TYPE = UNINSTANTIATION_ERROR;
LOCAL_Error_Term = t1;
LOCAL_ErrorMessage = LOCAL_ErrorSay;
Yap_bip_name(Op, s);
@ -1338,7 +1338,7 @@ c_bifun(basic_preds Op, Term t1, Term t2, Term t3, Term Goal, Term mod, compiler
} else {
char s[32];
LOCAL_Error_TYPE = TYPE_ERROR_VARIABLE;
LOCAL_Error_TYPE = UNINSTANTIATION_ERROR;
LOCAL_Error_Term = t3;
LOCAL_ErrorMessage = LOCAL_ErrorSay;
Yap_bip_name(Op, s);
@ -2192,9 +2192,9 @@ c_head(Term t, compiler_struct *cglobs)
#else
{
if (Yap_ExecutionMode == MIXED_MODE)
Yap_NilError(NOJIT_ERROR, "mixed");
Yap_NilError(SYSTEM_ERROR_JIT_NOT_AVAILABLE, "mixed");
else /* Yap_ExecutionMode == COMPILED */
Yap_NilError(NOJIT_ERROR, "just compiled");
Yap_NilError(SYSTEM_ERROR_JIT_NOT_AVAILABLE, "just compiled");
}
#endif
c_args(t, 0, cglobs);
@ -2401,7 +2401,7 @@ clear_bvarray(int var, CELL *bvarray
if (*bvarray & nbit) {
CACHE_REGS
/* someone had already marked this variable: complain */
LOCAL_Error_TYPE = INTERNAL_COMPILER_ERROR;
LOCAL_Error_TYPE = SYSTEM_ERROR_COMPILER;
LOCAL_Error_Term = TermNil;
LOCAL_ErrorMessage = "compiler internal error: variable initialised twice";
save_machine_regs();
@ -2443,7 +2443,7 @@ push_bvmap(int label, PInstr *pcpc, compiler_struct *cglobs)
{
if (bvindex == MAX_DISJUNCTIONS) {
CACHE_REGS
LOCAL_Error_TYPE = INTERNAL_COMPILER_ERROR;
LOCAL_Error_TYPE = SYSTEM_ERROR_COMPILER;
LOCAL_Error_Term = TermNil;
LOCAL_ErrorMessage = "Too many embedded disjunctions";
save_machine_regs();
@ -2467,7 +2467,7 @@ reset_bvmap(CELL *bvarray, int nperm, compiler_struct *cglobs)
if (bvindex == 0) {
CACHE_REGS
LOCAL_Error_TYPE = INTERNAL_COMPILER_ERROR;
LOCAL_Error_TYPE = SYSTEM_ERROR_COMPILER;
LOCAL_Error_Term = TermNil;
LOCAL_ErrorMessage = "No embedding in disjunctions";
save_machine_regs();
@ -2488,7 +2488,7 @@ pop_bvmap(CELL *bvarray, int nperm, compiler_struct *cglobs)
{
if (bvindex == 0) {
CACHE_REGS
LOCAL_Error_TYPE = INTERNAL_COMPILER_ERROR;
LOCAL_Error_TYPE = SYSTEM_ERROR_COMPILER;
LOCAL_Error_Term = TermNil;
LOCAL_ErrorMessage = "Too few embedded disjunctions";
/* save_machine_regs();
@ -2542,7 +2542,7 @@ CheckUnsafe(PInstr *pc, compiler_struct *cglobs)
if ( (v->FlagsOfVE & PermFlag && pc == v->FirstOpForV) ||
(v3->FlagsOfVE & PermFlag && pc == v3->FirstOpForV) ) {
CACHE_REGS
LOCAL_Error_TYPE = INTERNAL_COMPILER_ERROR;
LOCAL_Error_TYPE = SYSTEM_ERROR_COMPILER;
LOCAL_Error_Term = TermNil;
LOCAL_ErrorMessage = "comparison should not have first instance of variables";
save_machine_regs();
@ -2783,7 +2783,7 @@ checktemp(Int arg, Int rn, compiler_vm_op ic, compiler_struct *cglobs)
}
if (target1 == cglobs->MaxCTemps) {
CACHE_REGS
LOCAL_Error_TYPE = INTERNAL_COMPILER_ERROR;
LOCAL_Error_TYPE = SYSTEM_ERROR_COMPILER;
LOCAL_Error_Term = TermNil;
LOCAL_ErrorMessage = "too many temporaries";
save_machine_regs();
@ -2918,7 +2918,7 @@ c_layout(compiler_struct *cglobs)
#ifdef DEBUG
if (cglobs->pbvars != LOCAL_nperm) {
CACHE_REGS
LOCAL_Error_TYPE = INTERNAL_COMPILER_ERROR;
LOCAL_Error_TYPE = SYSTEM_ERROR_COMPILER;
LOCAL_Error_Term = TermNil;
LOCAL_ErrorMessage = "wrong number of variables found in bitmap";
save_machine_regs();
@ -3497,12 +3497,12 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src)
YAPLeaveCriticalSection();
if (!Yap_gcl(LOCAL_Error_Size, NOfArgs, ENV, gc_P(P,CP))) {
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_STACK;
LOCAL_Error_Term = inp_clause;
}
if (osize > ASP-HR) {
if (!Yap_growstack(2*sizeof(CELL)*(ASP-HR))) {
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_STACK;
LOCAL_Error_Term = inp_clause;
}
}
@ -3517,7 +3517,7 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src)
ARG1 = inp_clause;
ARG3 = src;
if (!Yap_ExpandPreAllocCodeSpace(LOCAL_Error_Size, NULL, TRUE)) {
LOCAL_Error_TYPE = OUT_OF_AUXSPACE_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_AUXILIARY_STACK;
LOCAL_Error_Term = inp_clause;
}
YAPEnterCriticalSection();
@ -3538,7 +3538,7 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src)
ARG3 = src;
YAPLeaveCriticalSection();
if (!Yap_growheap(FALSE, LOCAL_Error_Size, NULL)) {
LOCAL_Error_TYPE = OUT_OF_HEAP_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP;
LOCAL_Error_Term = inp_clause;
return NULL;
}
@ -3552,7 +3552,7 @@ Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod, volatile Term src)
ARG3 = src;
YAPLeaveCriticalSection();
if (!Yap_growtrail(LOCAL_TrailTop-(ADDR)TR, FALSE)) {
LOCAL_Error_TYPE = OUT_OF_TRAIL_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_TRAIL;
LOCAL_Error_Term = inp_clause;
return NULL;
}

View File

@ -462,7 +462,7 @@ non_ground(Term t, Term *Var USES_REGS)
return out;
}
if (!Yap_ExpandPreAllocCodeSpace(0, NULL, TRUE)) {
Yap_Error(OUT_OF_AUXSPACE_ERROR, ARG1, "overflow in ground");
Yap_Error(RESOURCE_ERROR_AUXILIARY_STACK, ARG1, "overflow in ground");
return FALSE;
}
}

View File

@ -528,14 +528,14 @@
LOCAL_ReductionsCounter--;
if (LOCAL_ReductionsCounter == 0 && LOCAL_ReductionsCounterOn) {
saveregs();
Yap_NilError(CALL_COUNTER_UNDERFLOW,"");
Yap_NilError(CALL_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -553,7 +553,7 @@
/* act as if we had backtracked */
ENV = B->cp_env;
saveregs();
Yap_NilError(RETRY_COUNTER_UNDERFLOW,"");
Yap_NilError(RETRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -561,7 +561,7 @@
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
ENV = B->cp_env;
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -590,14 +590,14 @@
LOCAL_RetriesCounter--;
if (LOCAL_RetriesCounter == 0 && LOCAL_RetriesCounterOn) {
saveregs();
Yap_NilError(RETRY_COUNTER_UNDERFLOW,"");
Yap_NilError(RETRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -634,14 +634,14 @@
LOCAL_RetriesCounter--;
if (LOCAL_RetriesCounter == 0) {
saveregs();
Yap_NilError(RETRY_COUNTER_UNDERFLOW,"");
Yap_NilError(RETRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0) {
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -672,7 +672,7 @@
PREG = NEXTOP(PREG,Osbpa);
saveregs();
if (!Yap_gcl(sz, arity, YENV, PREG)) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
FAIL();
} else {
@ -764,14 +764,14 @@
LOCAL_RetriesCounter--;
if (LOCAL_RetriesCounter == 0) {
saveregs();
Yap_NilError(RETRY_COUNTER_UNDERFLOW,"");
Yap_NilError(RETRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0) {
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}

3919
C/dbase.c

File diff suppressed because it is too large Load Diff

View File

@ -180,7 +180,7 @@ void
Yap_add_memory_hole(ADDR start, ADDR end)
{
if (Yap_NOfMemoryHoles == MAX_DLMALLOC_HOLES) {
Yap_Error(OPERATING_SYSTEM_ERROR, 0L, "Unexpected Too Much Memory Fragmentation: please contact YAP maintainers");
Yap_Error(SYSTEM_ERROR_OPERATING_SYSTEM, 0L, "Unexpected Too Much Memory Fragmentation: please contact YAP maintainers");
return;
}
Yap_MemoryHoles[Yap_NOfMemoryHoles].start = start;

2322
C/errors.c

File diff suppressed because it is too large Load Diff

View File

@ -424,7 +424,7 @@ EnterCreepMode(Term t, Term mod USES_REGS) {
if (Yap_get_signal( YAP_CDOVF_SIGNAL ) ) {
ARG1 = t;
if (!Yap_locked_growheap(FALSE, 0, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap at meta-call");
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, "YAP failed to grow heap at meta-call");
}
if (!Yap_has_a_signal()) {
return do_execute(ARG1, mod PASS_REGS);
@ -1361,7 +1361,7 @@ Yap_execute_pred(PredEntry *ppe, CELL *pt, bool pass_ex USES_REGS)
}
return(FALSE);
} else {
Yap_Error(SYSTEM_ERROR,TermNil,"emulator crashed");
Yap_Error(SYSTEM_ERROR_INTERNAL,TermNil,"emulator crashed");
return(FALSE);
}
}
@ -1489,7 +1489,7 @@ restart_runtopgoal:
#if !USE_SYSTEM_MALLOC
if (LOCAL_TrailTop - HeapTop < 2048) {
LOCAL_PrologMode = BootMode;
Yap_Error(OUT_OF_TRAIL_ERROR,TermNil,
Yap_Error(RESOURCE_ERROR_TRAIL,TermNil,
"unable to boot because of too little Trail space");
}
#endif
@ -1922,16 +1922,16 @@ Yap_GetException(void)
do {
t = Yap_PopTermFromDB(LOCAL_BallTerm);
if (t == 0) {
if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) {
if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growglobal(NULL)) {
Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
} else {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growstack(LOCAL_BallTerm->NOfCells*CellSize)) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
}

View File

@ -402,7 +402,7 @@ add_index(struct index_t **ip, UInt bmap, PredEntry *ap, UInt count)
save_machine_regs();
LOCAL_Error_Size = 3*ncls*sizeof(CELL);
LOCAL_ErrorMessage = "not enough space to index";
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, LOCAL_ErrorMessage);
return NULL;
}
i->is_key = FALSE;
@ -422,7 +422,7 @@ add_index(struct index_t **ip, UInt bmap, PredEntry *ap, UInt count)
LOCAL_Error_Size = dsz;
LOCAL_ErrorMessage = "not enough space to generate indices";
Yap_FreeCodeSpace((void *)i);
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, LOCAL_ErrorMessage);
return NULL;
}
memset(base, 0, dsz);

View File

@ -546,7 +546,7 @@ initFlag(flag_info *f, int fnum, bool global)
fprop = (FlagEntry *) Yap_AllocAtomSpace(sizeof(FlagEntry));
if (fprop == NULL) {
WRITE_UNLOCK(ae->ARWLock);
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"not enough space for new Flag %s", ae->StrOfAE); return;
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"not enough space for new Flag %s", ae->StrOfAE); return;
}
fprop->KindOfPE = FlagProperty;
fprop->FlagOfVE = fnum;

View File

@ -199,7 +199,7 @@ NewArena(UInt size, int wid, UInt arity, CELL *where)
if (where == NULL || where == HR) {
while (HR+size > ASP-1024) {
if (!Yap_gcl(size*sizeof(CELL), arity, ENV, P)) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return TermNil;
}
}
@ -207,7 +207,7 @@ NewArena(UInt size, int wid, UInt arity, CELL *where)
HR += size;
} else {
if ((new_size=Yap_InsertInGlobal(where, size*sizeof(CELL)))==0) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,"No Stack Space for Non-Backtrackable terms");
Yap_Error(RESOURCE_ERROR_STACK,TermNil,"No Stack Space for Non-Backtrackable terms");
return TermNil;
}
size = new_size/sizeof(CELL);
@ -275,7 +275,7 @@ GrowArena(Term arena, CELL *pt, size_t old_size, size_t size, UInt arity USES_RE
XREGS[arity+1] = arena;
if (!Yap_gcl(size*sizeof(CELL), arity+1, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
arena = XREGS[arity+1];
@ -290,7 +290,7 @@ GrowArena(Term arena, CELL *pt, size_t old_size, size_t size, UInt arity USES_RE
/* try to recover some room */
if (arena == LOCAL_GlobalArena && 10*(pt-H0) > 8*(HR-H0)) {
if (!Yap_gcl(size*sizeof(CELL), arity+1, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK,TermNil,LOCAL_ErrorMessage);
return FALSE;
}
}
@ -826,13 +826,13 @@ CopyTermToArena(Term t, Term arena, bool share, bool copy_att_vars, UInt arity,
if (arena == LOCAL_GlobalArena)
LOCAL_GlobalArenaOverflows++;
if (!GrowArena(arena, old_top, old_size, min_grow, arity+3 PASS_REGS)) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return 0L;
}
break;
default: /* temporary space overflow */
if (!Yap_ExpandPreAllocCodeSpace(0,NULL,TRUE)) {
Yap_Error(OUT_OF_AUXSPACE_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_AUXILIARY_STACK, TermNil, LOCAL_ErrorMessage);
return 0L;
}
}
@ -880,7 +880,7 @@ CreateTermInArena(Term arena, Atom Na, UInt Nar, UInt arity, Term *newarena, Ter
if (arena == LOCAL_GlobalArena)
LOCAL_GlobalArenaOverflows++;
if (!GrowArena(arena, old_top, old_size, Nar*sizeof(CELL), arity+2 PASS_REGS)) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "while creating large global term");
Yap_Error(RESOURCE_ERROR_STACK, TermNil, "while creating large global term");
return 0L;
}
}
@ -1350,7 +1350,7 @@ p_b_setval( USES_REGS1 )
return TRUE;
#else
WRITE_UNLOCK(ge->GRWLock);
Yap_Error(SYSTEM_ERROR,t,"update_array");
Yap_Error(SYSTEM_ERROR_INTERNAL,t,"update_array");
return FALSE;
#endif
}
@ -1766,7 +1766,7 @@ p_nb_queue_enqueue( USES_REGS1 )
ARG3 = to;
/* fprintf(stderr,"growing %ld cells\n",(unsigned long int)gsiz);*/
if (!GrowArena(arena, ArenaLimit(arena), old_sz, gsiz, 3 PASS_REGS)) {
Yap_Error(OUT_OF_STACK_ERROR, arena, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, arena, LOCAL_ErrorMessage);
return 0L;
}
to = ARG3;
@ -1944,7 +1944,7 @@ p_nb_heap( USES_REGS1 )
while ((heap = MkZeroApplTerm(Yap_MkFunctor(AtomHeap,2*hsize+HEAP_START+1),2*hsize+HEAP_START+1 PASS_REGS)) == TermNil) {
if (!Yap_gcl((2*hsize+HEAP_START+1)*sizeof(CELL), 2, ENV, P)) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
}
@ -2062,7 +2062,7 @@ p_nb_heap_add_to_heap( USES_REGS1 )
extra_size = hmsize;
}
if ((extra_size=Yap_InsertInGlobal(top, extra_size*2*sizeof(CELL)))==0) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,"No Stack Space for Non-Backtrackable terms");
Yap_Error(RESOURCE_ERROR_STACK,TermNil,"No Stack Space for Non-Backtrackable terms");
return FALSE;
}
extra_size = extra_size/(2*sizeof(CELL));
@ -2118,7 +2118,7 @@ p_nb_heap_add_to_heap( USES_REGS1 )
}
ARG3 = to;
if (!GrowArena(arena, ArenaLimit(arena), old_sz, gsiz, 3 PASS_REGS)) {
Yap_Error(OUT_OF_STACK_ERROR, arena, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, arena, LOCAL_ErrorMessage);
return 0L;
}
to = ARG3;
@ -2226,7 +2226,7 @@ p_nb_beam( USES_REGS1 )
}
while ((beam = MkZeroApplTerm(Yap_MkFunctor(AtomHeap,5*hsize+HEAP_START+1),5*hsize+HEAP_START+1 PASS_REGS)) == TermNil) {
if (!Yap_gcl((4*hsize+HEAP_START+1)*sizeof(CELL), 2, ENV, P)) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
}
@ -2507,7 +2507,7 @@ p_nb_beam_add_to_beam( USES_REGS1 )
}
ARG3 = to;
if (!GrowArena(arena, ArenaLimit(arena), old_sz, gsiz, 3 PASS_REGS)) {
Yap_Error(OUT_OF_STACK_ERROR, arena, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, arena, LOCAL_ErrorMessage);
return 0L;
}
to = ARG3;
@ -2619,7 +2619,7 @@ p_nb_beam_keys( USES_REGS1 )
if (HR > ASP-1024) {
HR = ho;
if (!Yap_gcl(((ASP-HR)-1024)*sizeof(CELL), 2, ENV, P)) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return TermNil;
}
goto restart;

View File

@ -805,7 +805,7 @@ InitProfTree(void)
reset_tree();
while (!(GLOBAL_ProfilerRoot = RBTreeCreate())) {
if (!Yap_growheap(FALSE, 0, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "while initialisating profiler");
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, "while initialisating profiler");
return FALSE;
}
}

View File

@ -244,7 +244,7 @@ RestoreTrail(int worker_p USES_REGS)
if (TR == aux_tr)
return;
if (aux_tr < TR){
Yap_Error(SYSTEM_ERROR, TermNil, "oops");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "oops");
}
Yap_NEW_MAHASH((ma_h_inner_struct *)HR PASS_REGS);
while (TR != aux_tr) {
@ -594,7 +594,7 @@ AdjustGlobal(Int sz, bool thread_copying USES_REGS)
CELL ar[256];
Int i,n = (f)(Yap_BlobTag(t), Yap_BlobInfo(t), ar, 256);
if (n < 0) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"not enough space for slot internal variables");
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"not enough space for slot internal variables");
}
for (i = 0; i< n; i++) {
CELL *pt = ar+i;
@ -618,7 +618,7 @@ AdjustGlobal(Int sz, bool thread_copying USES_REGS)
if ( (f2 = Yap_blob_gc_relocate_handler(t)) < 0 ) {
int out = (f2)(Yap_BlobTag(t), Yap_BlobInfo(t), ar, n);
if (out < 0) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"bad restore of slot internal variables");
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"bad restore of slot internal variables");
return;
}
}
@ -1303,7 +1303,7 @@ do_growheap(int fix_code, UInt in_size, struct intermediates *cip, tr_fr_ptr *ol
sz = in_size;
}
#ifdef YAPOR
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"cannot grow Heap: more than a worker/thread running");
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"cannot grow Heap: more than a worker/thread running");
return FALSE;
#endif
if (GLOBAL_SizeOfOverflow > sz) {
@ -1482,7 +1482,7 @@ Yap_locked_growheap(bool fix_code, size_t in_size, void *cip)
}
}
#if USE_SYSTEM_MALLOC
P = Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"malloc failed");
P = Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"malloc failed");
res = FALSE;
#else
res=do_growheap(fix_code, in_size, (struct intermediates *)cip, NULL, NULL, NULL PASS_REGS);
@ -1521,12 +1521,12 @@ Yap_locked_growglobal(CELL **ptr)
#if defined(YAPOR_THREADS)
if (GLOBAL_number_workers != 1) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,"cannot grow Global: more than a worker/thread running");
Yap_Error(RESOURCE_ERROR_STACK,TermNil,"cannot grow Global: more than a worker/thread running");
return(FALSE);
}
#elif defined(THREADS)
if (GLOBAL_NOfThreads != 1) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,"cannot grow Global: more than a worker/thread running");
Yap_Error(RESOURCE_ERROR_STACK,TermNil,"cannot grow Global: more than a worker/thread running");
return(FALSE);
}
#endif
@ -1882,7 +1882,7 @@ Yap_shift_visit(CELL **to_visit, CELL ***to_visit_maxp, CELL ***to_visit_base)
char *newb = Yap_ExpandPreAllocCodeSpace(0, NULL, FALSE);
if (newb == NULL) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"cannot allocate temporary space for unification (%p)", to_visit);
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"cannot allocate temporary space for unification (%p)", to_visit);
return to_visit;
}
/* check new size */
@ -1890,7 +1890,7 @@ Yap_shift_visit(CELL **to_visit, CELL ***to_visit_maxp, CELL ***to_visit_base)
/* how much we grew */
dsz = totalsz-totalsz0;
if (dsz == 0) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"cannot allocate temporary space for unification (%p)", to_visit);
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"cannot allocate temporary space for unification (%p)", to_visit);
return to_visit;
}
/* copy whole block to end */
@ -1962,7 +1962,7 @@ Yap_CopyThreadStacks(int worker_q, int worker_p, bool incremental)
char *oldq = (char *)REMOTE_ThreadHandle(worker_q).stack_address, *newq;
if (!(newq = REMOTE_ThreadHandle(worker_q).stack_address = realloc(REMOTE_ThreadHandle(worker_q).stack_address,p_size*K1))) {
Yap_Error(OUT_OF_STACK_ERROR,TermNil,"cannot expand slave thread to match master thread");
Yap_Error(RESOURCE_ERROR_STACK,TermNil,"cannot expand slave thread to match master thread");
}
start_growth_time = Yap_cputime();
gc_verbose = Yap_is_gc_verbose();

View File

@ -3975,7 +3975,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop USES_REGS)
if (HeapTop >= LOCAL_GlobalBase - MinHeapGap) {
*--ASP = (CELL)current_env;
if (!Yap_locked_growheap(FALSE, MinHeapGap, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, LOCAL_ErrorMessage);
return -1;
}
current_env = (CELL *)*ASP;
@ -3998,7 +3998,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop USES_REGS)
if (
!Yap_locked_growtrail(sz, FALSE)
) {
Yap_Error(OUT_OF_TRAIL_ERROR,TermNil,"out of %lB during gc", sz);
Yap_Error(RESOURCE_ERROR_TRAIL,TermNil,"out of %lB during gc", sz);
return -1;
} else {
LOCAL_total_marked = 0;
@ -4249,7 +4249,7 @@ LeaveGCMode( USES_REGS1 )
if (LOCAL_PrologMode & AbortMode) {
LOCAL_PrologMode &= ~AbortMode;
/* in case someone mangles the P register */
Yap_Error(PURE_ABORT, TermNil, "abort from console");
Yap_Error(ABORT_EVENT, TermNil, "abort from console");
Yap_RestartYap( 1 );
}
}

101
C/index.c
View File

@ -256,7 +256,7 @@
* fix expand_index on tabled code.
*
* Revision 1.129 2005/05/31 02:15:53 vsc
* fix SYSTEM_ERROR messages
* fix SYSTEM_ERROR_INTERNAL messages
*
* Revision 1.128 2005/05/30 05:26:49 vsc
* fix tabling
@ -338,7 +338,7 @@
* Handle overflows when allocating big clauses properly.
*
* Revision 1.108 2004/11/19 22:08:42 vsc
* replace SYSTEM_ERROR by out OUT_OF_WHATEVER_ERROR whenever appropriate.
* replace SYSTEM_ERROR_INTERNAL by out OUT_OF_WHATEVER_ERROR whenever appropriate.
*
* Revision 1.107 2004/11/19 17:14:14 vsc
* a few fixes for 64 bit compiling.
@ -2973,7 +2973,7 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc)
recover_from_failed_susp_on_cls(&cint, 0);
if (!Yap_gcl(LOCAL_Error_Size, ap->ArityOfPE+NSlots, ENV, next_pc)) {
CleanCls(&cint);
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return FAILCODE;
}
} else if (setjres == 2) {
@ -2981,7 +2981,7 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc)
LOCAL_Error_Size = recover_from_failed_susp_on_cls(&cint, LOCAL_Error_Size);
if (!Yap_growheap(FALSE, LOCAL_Error_Size, NULL)) {
CleanCls(&cint);
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, LOCAL_ErrorMessage);
return FAILCODE;
}
} else if (setjres == 4) {
@ -2989,14 +2989,14 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc)
recover_from_failed_susp_on_cls(&cint, 0);
if (!Yap_growtrail(LOCAL_Error_Size, FALSE)) {
CleanCls(&cint);
Yap_Error(OUT_OF_TRAIL_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_TRAIL, TermNil, LOCAL_ErrorMessage);
return FAILCODE;
}
} else if (setjres != 0) {
restore_machine_regs();
recover_from_failed_susp_on_cls(&cint, 0);
if (!Yap_growheap(FALSE, LOCAL_Error_Size, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, LOCAL_ErrorMessage);
CleanCls(&cint);
return FAILCODE;
}
@ -3025,7 +3025,7 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots, yamop *next_pc)
if (!Yap_growheap(FALSE, LOCAL_Error_Size, NULL)) {
Yap_ReleaseCMem(&cint);
CleanCls(&cint);
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, LOCAL_ErrorMessage);
return NULL;
}
goto restart_index;
@ -3619,7 +3619,7 @@ expand_index(struct intermediates *cint) {
break;
case _trust:
/* we should never be here */
Yap_Error(INTERNAL_COMPILER_ERROR, TermNil, "found trust in expand_index");
Yap_Error(SYSTEM_ERROR_COMPILER, TermNil, "found trust in expand_index");
labp = NULL;
ipc = NULL;
break;
@ -3889,7 +3889,7 @@ expand_index(struct intermediates *cint) {
break;
default:
if (alt == NULL) {
Yap_Error(INTERNAL_COMPILER_ERROR,t,"unexpected instruction %d at expand_index ", op);
Yap_Error(SYSTEM_ERROR_COMPILER,t,"unexpected instruction %d at expand_index ", op);
labp = NULL;
ipc = NULL;
} else {
@ -4130,7 +4130,7 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop USES_REGS) {
#if defined(YAPOR) || defined(THREADS)
}
#endif
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, LOCAL_ErrorMessage);
CleanCls(&cint);
return FAILCODE;
}
@ -4163,47 +4163,8 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop USES_REGS) {
}
#if DEBUG
if (GLOBAL_Option['i' - 'a' + 1]) {
Term tmod = ap->ModuleOfPred;
if (!tmod) tmod = TermProlog;
#if THREADS
Yap_DebugPlWrite(MkIntegerTerm(worker_id));
Yap_DebugPutc(stderr,' ');
#endif
Yap_DebugPutc(stderr,'>');
Yap_DebugPutc(stderr,'\t');
Yap_DebugPlWrite(tmod);
Yap_DebugPutc(stderr,':');
if (ap->ModuleOfPred == IDB_MODULE) {
Term t = Deref(ARG1);
if (IsAtomTerm(t)) {
Yap_DebugPlWrite(t);
} else if (IsIntegerTerm(t)) {
Yap_DebugPlWrite(t);
} else {
Functor f = FunctorOfTerm(t);
Atom At = NameOfFunctor(f);
Yap_DebugPlWrite(MkAtomTerm(At));
Yap_DebugPutc(stderr,'/');
Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
}
} else {
if (ap->ArityOfPE == 0) {
Atom At = (Atom)ap->FunctorOfPred;
Yap_DebugPlWrite(MkAtomTerm(At));
} else {
Functor f = ap->FunctorOfPred;
Atom At = NameOfFunctor(f);
Yap_DebugPlWrite(MkAtomTerm(At));
Yap_DebugPutc(stderr,'/');
Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
}
Yap_DebugWriteIndicator( ap );
}
Yap_DebugPutc(stderr,'\n');
#if THREADS
Yap_DebugPlWrite(MkIntegerTerm(worker_id));
Yap_DebugPutc(stderr,' ');
#endif
}
#endif
if ((labp = expand_index(&cint)) == NULL) {
if (expand_clauses) {
@ -4233,7 +4194,7 @@ ExpandIndex(PredEntry *ap, int ExtraArgs, yamop *nextop USES_REGS) {
if (cint.CodeStart) {
if ((indx_out = Yap_assemble(ASSEMBLING_EINDEX, TermNil, ap, FALSE, &cint, cint.i_labelno+1)) == NULL) {
if (!Yap_growheap(FALSE, LOCAL_Error_Size, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, LOCAL_ErrorMessage);
Yap_ReleaseCMem(&cint);
CleanCls(&cint);
return FAILCODE;
@ -4816,7 +4777,7 @@ kill_clause(yamop *ipc, yamop *bg, yamop *lt, path_stack_entry *sp0, PredEntry *
/* weird case ????? */
if (!start->y_u.Illss.s){
/* ERROR */
Yap_Error(INTERNAL_ERROR, TermNil, "Illss.s == 0 %p", ipc);
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "Illss.s == 0 %p", ipc);
return sp;
}
if (start->y_u.Illss.s == 1) {
@ -5648,39 +5609,9 @@ Yap_AddClauseToIndex(PredEntry *ap, yamop *beg, int first) {
LOCAL_ErrorMessage = NULL;
#if DEBUG
if (GLOBAL_Option['i' - 'a' + 1]) {
Term tmod = ap->ModuleOfPred;
if (!tmod) tmod = TermProlog;
Yap_DebugPutc(stderr,'+');
Yap_DebugPutc(stderr,'\t');
Yap_DebugPlWrite(tmod);
Yap_DebugPutc(stderr,':');
if (ap->ModuleOfPred == IDB_MODULE) {
Term t = Deref(ARG1);
if (IsAtomTerm(t)) {
Yap_DebugPlWrite(t);
} else if (IsIntegerTerm(t)) {
Yap_DebugPlWrite(t);
} else {
Functor f = FunctorOfTerm(t);
Atom At = NameOfFunctor(f);
Yap_DebugPlWrite(MkAtomTerm(At));
Yap_DebugPutc(stderr,'/');
Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
}
} else {
if (ap->ArityOfPE == 0) {
Atom At = (Atom)ap->FunctorOfPred;
Yap_DebugPlWrite(MkAtomTerm(At));
} else {
Functor f = ap->FunctorOfPred;
Atom At = NameOfFunctor(f);
Yap_DebugPlWrite(MkAtomTerm(At));
Yap_DebugPutc(stderr,'/');
Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
}
}
Yap_DebugPutc(stderr,'\n');
}
Yap_DebugPutc(stderr,'+');
Yap_DebugWriteIndicator( ap );
}
#endif
stack = (path_stack_entry *)TR;
cl.Code = cl.CurrentCode = beg;

View File

@ -496,7 +496,7 @@ Yap_InitCPred(const char *Name, UInt Arity, CPredicate code, pred_flags_t flags)
else
atom = Yap_FullLookupAtom(Name);
if (atom == NIL && !Yap_growheap(FALSE, 0L, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"while initialising %s", Name);
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"while initialising %s", Name);
return;
}
}
@ -504,7 +504,7 @@ Yap_InitCPred(const char *Name, UInt Arity, CPredicate code, pred_flags_t flags)
while (!f) {
f = Yap_MkFunctor(atom,Arity);
if (!f && !Yap_growheap(FALSE, 0L, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"while initialising %s", Name);
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"while initialising %s", Name);
return;
}
}
@ -515,7 +515,7 @@ Yap_InitCPred(const char *Name, UInt Arity, CPredicate code, pred_flags_t flags)
else
pe = RepPredProp(PredPropByAtom(atom,CurrentModule));
if (!pe && !Yap_growheap(FALSE, sizeof(PredEntry), NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"while initialising %s", Name);
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"while initialising %s", Name);
return;
}
}
@ -541,7 +541,7 @@ Yap_InitCPred(const char *Name, UInt Arity, CPredicate code, pred_flags_t flags)
cl = (StaticClause *)Yap_AllocCodeSpace(sz);
if (!cl) {
if (!Yap_growheap(FALSE, sz, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"while initialising %s", Name);
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"while initialising %s", Name);
return;
}
} else {
@ -645,7 +645,7 @@ Yap_InitCmpPred(const char *Name, UInt Arity, CmpPredicate cmp_code, pred_flags_
while (atom == NIL) {
atom = Yap_FullLookupAtom(Name);
if (atom == NIL && !Yap_growheap(FALSE, 0L, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"while initialising %s", Name);
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"while initialising %s", Name);
return;
}
}
@ -653,7 +653,7 @@ Yap_InitCmpPred(const char *Name, UInt Arity, CmpPredicate cmp_code, pred_flags_
while (!f) {
f = Yap_MkFunctor(atom,Arity);
if (!f && !Yap_growheap(FALSE, 0L, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"while initialising %s", Name);
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"while initialising %s", Name);
return;
}
}
@ -664,7 +664,7 @@ Yap_InitCmpPred(const char *Name, UInt Arity, CmpPredicate cmp_code, pred_flags_
else
pe = RepPredProp(PredPropByAtom(atom,CurrentModule));
if (!pe && !Yap_growheap(FALSE, sizeof(PredEntry), NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"while initialising %s", Name);
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"while initialising %s", Name);
return;
}
}
@ -678,7 +678,7 @@ Yap_InitCmpPred(const char *Name, UInt Arity, CmpPredicate cmp_code, pred_flags_
cl = (StaticClause *)Yap_AllocCodeSpace(sz);
if (!cl) {
if (!Yap_growheap(FALSE, sz, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"while initialising %s", Name);
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"while initialising %s", Name);
return;
}
} else {
@ -721,7 +721,7 @@ Yap_InitAsmPred(const char *Name, UInt Arity, int code, CPredicate def, pred_fl
while (atom == NIL) {
atom = Yap_FullLookupAtom(Name);
if (atom == NIL && !Yap_growheap(FALSE, 0L, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"while initialising %s", Name);
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"while initialising %s", Name);
return;
}
}
@ -729,7 +729,7 @@ Yap_InitAsmPred(const char *Name, UInt Arity, int code, CPredicate def, pred_fl
while (!f) {
f = Yap_MkFunctor(atom,Arity);
if (!f && !Yap_growheap(FALSE, 0L, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"while initialising %s", Name);
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"while initialising %s", Name);
return;
}
}
@ -740,7 +740,7 @@ Yap_InitAsmPred(const char *Name, UInt Arity, int code, CPredicate def, pred_fl
else
pe = RepPredProp(PredPropByAtom(atom,CurrentModule));
if (!pe && !Yap_growheap(FALSE, sizeof(PredEntry), NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"while initialising %s", Name);
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"while initialising %s", Name);
return;
}
}
@ -763,7 +763,7 @@ Yap_InitAsmPred(const char *Name, UInt Arity, int code, CPredicate def, pred_fl
cl = (StaticClause *)Yap_AllocCodeSpace((CELL)NEXTOP(NEXTOP(NEXTOP(NEXTOP(NEXTOP(((yamop *)p_code),e),Osbpp),p),p),l));
}
if (!cl) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"No Heap Space in InitAsmPred");
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"No Heap Space in InitAsmPred");
return;
}
Yap_ClauseSpace += (CELL)NEXTOP(NEXTOP(NEXTOP(((yamop *)p_code),Osbpp),p),l);
@ -814,7 +814,7 @@ CleanBack(PredEntry *pe, CPredicate Start, CPredicate Cont, CPredicate Cut)
if (pe->cs.p_code.FirstClause != pe->cs.p_code.LastClause ||
pe->cs.p_code.TrueCodeOfPred != pe->cs.p_code.FirstClause ||
pe->CodeOfPred != pe->cs.p_code.FirstClause) {
Yap_Error(SYSTEM_ERROR,TermNil,
Yap_Error(SYSTEM_ERROR_INTERNAL,TermNil,
"initiating a C Pred with backtracking");
return;
}
@ -875,7 +875,7 @@ Yap_InitCPredBack_(const char *Name, UInt Arity,
while (atom == NIL) {
atom = Yap_FullLookupAtom(Name);
if (atom == NIL && !Yap_growheap(FALSE, 0L, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"while initialising %s", Name);
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"while initialising %s", Name);
return;
}
}
@ -883,7 +883,7 @@ Yap_InitCPredBack_(const char *Name, UInt Arity,
while (!f) {
f = Yap_MkFunctor(atom,Arity);
if (!f && !Yap_growheap(FALSE, 0L, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"while initialising %s", Name);
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"while initialising %s", Name);
return;
}
}
@ -894,7 +894,7 @@ Yap_InitCPredBack_(const char *Name, UInt Arity,
else
pe = RepPredProp(PredPropByAtom(atom,CurrentModule));
if (!pe && !Yap_growheap(FALSE, sizeof(PredEntry), NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"while initialising %s", Name);
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"while initialising %s", Name);
return;
}
}
@ -919,7 +919,7 @@ Yap_InitCPredBack_(const char *Name, UInt Arity,
cl = (StaticClause *)Yap_AllocCodeSpace(sz);
if (cl == NULL) {
Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"No Heap Space in InitCPredBack");
Yap_Error(RESOURCE_ERROR_HEAP,TermNil,"No Heap Space in InitCPredBack");
return;
}
cl->ClFlags = StaticMask;
@ -995,7 +995,7 @@ InitPredHash(void)
PredHash = (PredEntry **)Yap_AllocAtomSpace(sizeof(PredEntry **) * PredHashInitialSize);
PredHashTableSize = PredHashInitialSize;
if (PredHash == NULL) {
Yap_Error(FATAL_ERROR,MkIntTerm(0),"allocating initial predicate hash table");
Yap_Error(SYSTEM_ERROR_FATAL,MkIntTerm(0),"allocating initial predicate hash table");
}
for (i = 0; i < PredHashTableSize; ++i) {
PredHash[i] = NULL;
@ -1089,7 +1089,7 @@ InitAtoms(void)
AtomHashTableSize = MaxHash;
HashChain = (AtomHashEntry *)Yap_AllocAtomSpace(sizeof(AtomHashEntry) * MaxHash);
if (HashChain == NULL) {
Yap_Error(FATAL_ERROR,MkIntTerm(0),"allocating initial atom table");
Yap_Error(SYSTEM_ERROR_FATAL,MkIntTerm(0),"allocating initial atom table");
}
for (i = 0; i < MaxHash; ++i) {
INIT_RWLOCK(HashChain[i].AERWLock);
@ -1121,7 +1121,7 @@ InitWideAtoms(void)
WideAtomHashTableSize = MaxWideHash;
WideHashChain = (AtomHashEntry *)Yap_AllocAtomSpace(sizeof(AtomHashEntry) * MaxWideHash);
if (WideHashChain == NULL) {
Yap_Error(FATAL_ERROR,MkIntTerm(0),"allocating wide atom table");
Yap_Error(SYSTEM_ERROR_FATAL,MkIntTerm(0),"allocating wide atom table");
}
for (i = 0; i < MaxWideHash; ++i) {
INIT_RWLOCK(WideHashChain[i].AERWLock);
@ -1152,7 +1152,7 @@ void Yap_init_yapor_workers(void) {
int son;
son = fork();
if (son == -1)
Yap_Error(FATAL_ERROR, TermNil, "fork error (Yap_init_yapor_workers)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "fork error (Yap_init_yapor_workers)");
if (son > 0) {
/* I am the father, I must stay here and wait for my children to all die */
struct sigaction sigact;
@ -1170,7 +1170,7 @@ void Yap_init_yapor_workers(void) {
int son;
son = fork();
if (son == -1)
Yap_Error(FATAL_ERROR, TermNil, "fork error (Yap_init_yapor_workers)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "fork error (Yap_init_yapor_workers)");
if (son == 0) {
/* new worker */
worker_id = proc;
@ -1260,7 +1260,7 @@ InitHandles(int wid) {
handles = calloc(initial_slots , sizeof(CELL));
if(handles == NULL) {
Yap_Error(SYSTEM_ERROR, 0 /* TermNil */, "No space for handles at " __FILE__ " : %d", __LINE__);
Yap_Error(SYSTEM_ERROR_INTERNAL, 0 /* TermNil */, "No space for handles at " __FILE__ " : %d", __LINE__);
}
RESET_VARIABLE(handles);
@ -1394,7 +1394,7 @@ Yap_InitWorkspace(UInt Heap, UInt Stack, UInt Trail, UInt Atts, UInt max_table_s
#endif /* YAPOR || THREADS */
#ifdef YAPOR
if (n_workers > MAX_WORKERS)
Yap_Error(INTERNAL_ERROR, TermNil, "excessive number of workers");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "excessive number of workers");
#ifdef YAPOR_COPY
INFORMATION_MESSAGE("YapOr: copy model with %d worker%s", n_workers, n_workers == 1 ? "":"s");
#elif YAPOR_COW
@ -1437,7 +1437,7 @@ Yap_InitWorkspace(UInt Heap, UInt Stack, UInt Trail, UInt Atts, UInt max_table_s
if (Stack < MinStackSpace)
Stack = MinStackSpace;
if (!(LOCAL_GlobalBase = (ADDR)malloc((Trail+Stack)*1024))) {
Yap_Error(RESOURCE_ERROR_MEMORY, 0, "could not allocate stack space for main thread");
Yap_Error(RESOURCE_ERROR_HEAP, 0, "could not allocate stack space for main thread");
Yap_exit(1);
}
#if THREADS

View File

@ -888,7 +888,7 @@ p_functor( USES_REGS1 ) /* functor(?,?,?) */
d0 = AbsAppl(HR);
if (pt1+d1 > ENV - StackGap( PASS_REGS1 )) {
if (!Yap_gcl((1+d1)*sizeof(CELL), 3, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
goto restart;
@ -993,7 +993,7 @@ p_cut_by( USES_REGS1 )
static Int
p_erroneous_call( USES_REGS1 )
{
Yap_Error(SYSTEM_ERROR, TermNil, "bad call to internal built-in");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "bad call to internal built-in");
return(FALSE);
}

View File

@ -96,7 +96,7 @@ Yap_FindExecutable(void)
if (oktox(GLOBAL_Executable))
return GLOBAL_Executable;
else
Yap_Error(SYSTEM_ERROR,MkAtomTerm(Yap_LookupAtom(GLOBAL_Executable)),
Yap_Error(SYSTEM_ERROR_INTERNAL,MkAtomTerm(Yap_LookupAtom(GLOBAL_Executable)),
"cannot find file being executed");
}

View File

@ -92,7 +92,7 @@ Yap_FindExecutable(void)
if (oktox(GLOBAL_Executable))
return GLOBAL_Executable;
else
Yap_Error(SYSTEM_ERROR,MkAtomTerm(Yap_LookupAtom(GLOBAL_Executable)),
Yap_Error(SYSTEM_ERROR_INTERNAL,MkAtomTerm(Yap_LookupAtom(GLOBAL_Executable)),
"cannot find file being executed");
return NULL;
}

View File

@ -55,7 +55,7 @@ Yap_CallFunctionByName(const char *thing_string)
// you could do RTLD_NOW as well. shouldn't matter
if (!handle) {
CACHE_REGS
Yap_Error(SYSTEM_ERROR, ARG1, "Dynamic linking on main module : %s\n", dlerror());
Yap_Error(SYSTEM_ERROR_INTERNAL, ARG1, "Dynamic linking on main module : %s\n", dlerror());
}
prismf * addr = (prismf *)dlsym(handle, thing_string);
if (addr)
@ -142,7 +142,7 @@ Yap_LoadForeignFile(char *file, int flags)
out = (void *)dlopen(file,dlflag);
if (!out) {
CACHE_REGS
Yap_Error(SYSTEM_ERROR, ARG1, "dlopen error for %s: %s\n", file, dlerror());
Yap_Error(SYSTEM_ERROR_INTERNAL, ARG1, "dlopen error for %s: %s\n", file, dlerror());
}
return out;
}
@ -152,7 +152,7 @@ Yap_CallForeignFile(void *handle, char *f)
{
YapInitProc proc = (YapInitProc) dlsym(handle, f);
if (!proc) {
/* Yap_Error(SYSTEM_ERROR, ARG1, "dlsym error %s\n", dlerror());*/
/* Yap_Error(SYSTEM_ERROR_INTERNAL, ARG1, "dlsym error %s\n", dlerror());*/
return FALSE;
}
(*proc) ();
@ -164,7 +164,7 @@ Yap_CloseForeignFile(void *handle)
{
if ( dlclose(handle) < 0) {
CACHE_REGS
Yap_Error(SYSTEM_ERROR, ARG1, "dlclose error %s\n", dlerror());
Yap_Error(SYSTEM_ERROR_INTERNAL, ARG1, "dlclose error %s\n", dlerror());
return -1;
}
return 0;

View File

@ -261,14 +261,14 @@
LOCAL_RetriesCounter--;
if (LOCAL_RetriesCounter == 0) {
saveregs();
Yap_NilError(RETRY_COUNTER_UNDERFLOW,"");
Yap_NilError(RETRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0) {
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -313,14 +313,14 @@
LOCAL_RetriesCounter--;
if (LOCAL_RetriesCounter == 0) {
saveregs();
Yap_NilError(RETRY_COUNTER_UNDERFLOW,"");
Yap_NilError(RETRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0) {
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -657,16 +657,16 @@
#if defined(YAPOR) || defined(THREADS)
PP = NULL;
#endif
if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) {
if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growglobal(NULL)) {
Yap_NilError(OUT_OF_ATTVARS_ERROR, LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, LOCAL_ErrorMessage);
FAIL();
}
} else {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_gc(3, ENV, CP)) {
Yap_NilError(OUT_OF_STACK_ERROR, LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK, LOCAL_ErrorMessage);
FAIL();
}
}
@ -769,5 +769,3 @@
#endif
JMPNext();
ENDBOp();

View File

@ -2800,7 +2800,7 @@
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,xxx),Osbpp))) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -2917,7 +2917,7 @@
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,xxc),Osbpp))) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -3027,7 +3027,7 @@
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gc(0, YREG, NEXTOP(NEXTOP(PREG,xxn),Osbpp))) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -3134,7 +3134,7 @@
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,yxx),Osbpp))) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -3261,7 +3261,7 @@
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,yxc),Osbpp))) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -3389,7 +3389,7 @@
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 0, YREG, NEXTOP(NEXTOP(PREG,yxn),Osbpp))) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -3765,7 +3765,7 @@
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 3, YREG, NEXTOP(NEXTOP(PREG,e),Osbmp))) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {

View File

@ -77,7 +77,7 @@ static void
QLYR_ERROR(qlfr_err_t my_err)
{
// __android_log_print(ANDROID_LOG_INFO, "YAP ", "error %s in saved state %s",GLOBAL_RestoreFile, qlyr_error[my_err]);
Yap_Error(SAVED_STATE_ERROR,TermNil,"error %s in saved state %s",GLOBAL_RestoreFile, qlyr_error[my_err]);
Yap_Error(SYSTEM_ERROR_SAVED_STATE,TermNil,"error %s in saved state %s",GLOBAL_RestoreFile, qlyr_error[my_err]);
Yap_exit(1);
}

View File

@ -161,7 +161,7 @@ LightBug(s)
#endif /* LIGHT */
static Int
do_system_error(yap_error_number etype, const char *msg)
do_SYSTEM_ERROR_INTERNAL(yap_error_number etype, const char *msg)
{
CACHE_REGS
#if HAVE_SNPRINTF
@ -190,7 +190,7 @@ int myread(FILE *fd, char *buffer, Int len) {
while (len > 0) {
nread = fread(buffer, 1, (int)len, fd);
if (nread < 1) {
return do_system_error(PERMISSION_ERROR_INPUT_PAST_END_OF_STREAM,"bad read on saved state");
return do_SYSTEM_ERROR_INTERNAL(PERMISSION_ERROR_INPUT_PAST_END_OF_STREAM,"bad read on saved state");
}
buffer += nread;
len -= nread;
@ -206,7 +206,7 @@ mywrite(FILE *fd, char *buff, Int len) {
while (len > 0) {
nwritten = fwrite(buff, 1, (size_t)len, fd);
if (nwritten < 0) {
return do_system_error(SYSTEM_ERROR,"bad write on saved state");
return do_SYSTEM_ERROR_INTERNAL(SYSTEM_ERROR_INTERNAL,"bad write on saved state");
}
buff += nwritten;
len -= nwritten;
@ -277,7 +277,7 @@ close_file(void)
if (splfild == 0)
return 0;
if (fclose(splfild) < 0)
return do_system_error(SYSTEM_ERROR,"bad close on saved state");
return do_SYSTEM_ERROR_INTERNAL(SYSTEM_ERROR_INTERNAL,"bad close on saved state");
splfild = 0;
return 1;
}
@ -314,7 +314,7 @@ get_header_cell(void)
int n;
while (count < sizeof(CELL)) {
if ((n = fread(&l, 1, sizeof(CELL)-count, splfild)) < 0) {
do_system_error(PERMISSION_ERROR_INPUT_PAST_END_OF_STREAM,"failed to read saved state header");
do_SYSTEM_ERROR_INTERNAL(PERMISSION_ERROR_INPUT_PAST_END_OF_STREAM,"failed to read saved state header");
return 0L;
}
count += n;
@ -581,7 +581,7 @@ do_save(int mode USES_REGS) {
Term t1 = Deref(ARG1);
if (Yap_HoleSize) {
Yap_Error(SYSTEM_ERROR,MkAtomTerm(Yap_LookupAtom(LOCAL_FileNameBuf)),
Yap_Error(SYSTEM_ERROR_INTERNAL,MkAtomTerm(Yap_LookupAtom(LOCAL_FileNameBuf)),
"restore/1: address space has holes of size %ld, cannot save", (long int)Yap_HoleSize);
return FALSE;
}
@ -591,7 +591,7 @@ do_save(int mode USES_REGS) {
}
Yap_CloseStreams(TRUE);
if ((splfild = open_file(LOCAL_FileNameBuf, O_WRONLY | O_CREAT)) < 0) {
Yap_Error(SYSTEM_ERROR,MkAtomTerm(Yap_LookupAtom(LOCAL_FileNameBuf)),
Yap_Error(SYSTEM_ERROR_INTERNAL,MkAtomTerm(Yap_LookupAtom(LOCAL_FileNameBuf)),
"restore/1, open(%s)", strerror(errno));
return(FALSE);
}
@ -621,14 +621,14 @@ p_save2( USES_REGS1 )
Term t;
#ifdef YAPOR
if (GLOBAL_number_workers != 1) {
Yap_Error(SYSTEM_ERROR,TermNil,
Yap_Error(SYSTEM_ERROR_INTERNAL,TermNil,
"cannot perform save: more than a worker/thread running");
return(FALSE);
}
#endif /* YAPOR */
#ifdef THREADS
if (GLOBAL_NOfThreads != 1) {
Yap_Error(SYSTEM_ERROR,TermNil,
Yap_Error(SYSTEM_ERROR_INTERNAL,TermNil,
"cannot perform save: more than a worker/thread running");
return(FALSE);
}
@ -669,7 +669,7 @@ check_header(CELL *info, CELL *ATrail, CELL *AStack, CELL *AHeap USES_REGS)
pp[0] = '\0';
do {
if ((n = fread(pp, 1, 1, splfild)) <= 0) {
do_system_error(PERMISSION_ERROR_INPUT_PAST_END_OF_STREAM,"failed to scan first line from saved state");
do_SYSTEM_ERROR_INTERNAL(PERMISSION_ERROR_INPUT_PAST_END_OF_STREAM,"failed to scan first line from saved state");
return FAIL_RESTORE;
}
} while (pp[0] != 1);
@ -679,7 +679,7 @@ check_header(CELL *info, CELL *ATrail, CELL *AStack, CELL *AHeap USES_REGS)
int count = 0, n, to_read = Unsigned(strlen(msg) + 1);
while (count < to_read) {
if ((n = fread(pp, 1, to_read-count, splfild)) <= 0) {
do_system_error(PERMISSION_ERROR_INPUT_PAST_END_OF_STREAM,"failed to scan version info from saved state");
do_SYSTEM_ERROR_INTERNAL(PERMISSION_ERROR_INPUT_PAST_END_OF_STREAM,"failed to scan version info from saved state");
return FAIL_RESTORE;
}
count += n;
@ -690,7 +690,7 @@ check_header(CELL *info, CELL *ATrail, CELL *AStack, CELL *AHeap USES_REGS)
strncpy(LOCAL_ErrorMessage, "saved state ", MAX_ERROR_MSG_SIZE);
strncat(LOCAL_ErrorMessage, LOCAL_FileNameBuf, MAX_ERROR_MSG_SIZE-1);
strncat(LOCAL_ErrorMessage, " failed to match version ID", MAX_ERROR_MSG_SIZE-1);
LOCAL_Error_TYPE = CONSISTENCY_ERROR;
LOCAL_Error_TYPE = SYSTEM_ERROR_SAVED_STATE;
return FAIL_RESTORE;
}
/* check info on header */
@ -1151,7 +1151,7 @@ rehash(CELL *oldcode, int NOfE, int KindOfEntries USES_REGS)
basep = (CELL *)TR;
if (basep + (NOfE*2) > (CELL *)LOCAL_TrailTop) {
if (!Yap_growtrail((ADDR)(basep + (NOfE*2))-LOCAL_TrailTop, TRUE)) {
Yap_Error(OUT_OF_TRAIL_ERROR, TermNil,
Yap_Error(RESOURCE_ERROR_TRAIL, TermNil,
"not enough space to restore hash tables for indexing");
Yap_exit(1);
}
@ -1295,7 +1295,7 @@ RestoreHashPreds( USES_REGS1 )
np = (PredEntry **) Yap_AllocAtomSpace(sizeof(PredEntry *)*size);
if (!np) {
if (!(np = (PredEntry **) malloc(sizeof(PredEntry *)*size))) {
Yap_Error(FATAL_ERROR,TermNil,"Could not allocate space for pred table");
Yap_Error(SYSTEM_ERROR_FATAL,TermNil,"Could not allocate space for pred table");
return;
}
malloced = TRUE;
@ -1448,10 +1448,10 @@ OpenRestore(char *inpf, char *YapLibDir, CELL *Astate, CELL *ATrail, CELL *AStac
/* try to open from current directory */
/* could not open file */
if (LOCAL_ErrorMessage == NULL) {
do_system_error(PERMISSION_ERROR_OPEN_SOURCE_SINK,"incorrect saved state");
do_SYSTEM_ERROR_INTERNAL(PERMISSION_ERROR_OPEN_SOURCE_SINK,"incorrect saved state");
} else {
strncpy(LOCAL_FileNameBuf, inpf, YAP_FILENAME_MAX-1);
do_system_error(PERMISSION_ERROR_OPEN_SOURCE_SINK,"could not open saved state");
do_SYSTEM_ERROR_INTERNAL(PERMISSION_ERROR_OPEN_SOURCE_SINK,"could not open saved state");
}
return FAIL_RESTORE;
}
@ -1529,7 +1529,7 @@ RestoreHeap(OPCODE old_ops[] USES_REGS)
if (!(Yap_ReInitConstExps() &&
Yap_ReInitUnaryExps() &&
Yap_ReInitBinaryExps())) {
Yap_Error(SYSTEM_ERROR, TermNil, "arithmetic operator not in saved state");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "arithmetic operator not in saved state");
}
#ifdef DEBUG_RESTORE1
fprintf(errout, "phase 1 done\n");
@ -1708,13 +1708,13 @@ p_restore( USES_REGS1 )
Term t1 = Deref(ARG1);
#ifdef YAPOR
if (GLOBAL_number_workers != 1) {
Yap_Error(SYSTEM_ERROR,TermNil,"cannot perform save: more than a worker/thread running");
Yap_Error(SYSTEM_ERROR_INTERNAL,TermNil,"cannot perform save: more than a worker/thread running");
return(FALSE);
}
#endif /* YAPOR */
#ifdef THREADS
if (GLOBAL_NOfThreads != 1) {
Yap_Error(SYSTEM_ERROR,TermNil,"cannot perform save: more than a worker/thread running");
Yap_Error(SYSTEM_ERROR_INTERNAL,TermNil,"cannot perform save: more than a worker/thread running");
return(FALSE);
}
#endif /* THREADS */

View File

@ -1102,7 +1102,7 @@ Term Yap_scan_num(StreamDesc *inp) {
LOCAL_ScannerExtraBlocks = NULL;
if (!(ptr = AllocScannerMemory(4096))) {
LOCAL_ErrorMessage = "Trail Overflow";
LOCAL_Error_TYPE = OUT_OF_TRAIL_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_TRAIL;
return TermNil;
}
ch = getchr(inp);
@ -1133,7 +1133,7 @@ Term Yap_scan_num(StreamDesc *inp) {
#define CHECK_SPACE() \
if (ASP - HR < 1024) { \
LOCAL_ErrorMessage = "Stack Overflow"; \
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR; \
LOCAL_Error_TYPE = RESOURCE_ERROR_STACK; \
LOCAL_Error_Size = 0L; \
if (p) \
p->Tok = Ord(kind = eot_tok); \
@ -1256,7 +1256,7 @@ static wchar_t *ch_to_wide(char *base, char *charp) {
wchar_t *nb = (wchar_t *)base;
if ((nb + n) + 1024 > (wchar_t *)AuxSp) {
LOCAL_Error_TYPE = OUT_OF_AUXSPACE_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_AUXILIARY_STACK;
LOCAL_ErrorMessage =
"Heap Overflow While Scanning: please increase code space (-h)";
return NULL;
@ -1335,7 +1335,7 @@ TokEntry *Yap_tokenizer( struct stream_desc *inp_stream,
t->TokNext = NULL;
if (t == NULL) {
LOCAL_ErrorMessage = "Trail Overflow";
LOCAL_Error_TYPE = OUT_OF_TRAIL_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_TRAIL;
if (p)
p->Tok = Ord(kind = eot_tok);
/* serious error now */
@ -1411,7 +1411,7 @@ scan_name:
huge_var_error:
/* huge atom or variable, we are in trouble */
LOCAL_ErrorMessage = "Code Space Overflow due to huge atom";
LOCAL_Error_TYPE = OUT_OF_AUXSPACE_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_AUXILIARY_STACK;
Yap_ReleasePreAllocCodeSpace((CODEADDR)TokImage);
if (p)
p->Tok = Ord(kind = eot_tok);
@ -1437,7 +1437,7 @@ huge_var_error:
ae = Yap_LookupAtom(TokImage);
}
if (ae == NIL) {
LOCAL_Error_TYPE = OUT_OF_HEAP_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP;
LOCAL_ErrorMessage = "Code Space Overflow";
if (p)
t->Tok = Ord(kind = eot_tok);
@ -1468,7 +1468,7 @@ huge_var_error:
cherr = 0;
if (!(ptr = AllocScannerMemory(4096))) {
LOCAL_ErrorMessage = "Trail Overflow";
LOCAL_Error_TYPE = OUT_OF_TRAIL_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_TRAIL;
if (p)
t->Tok = Ord(kind = eot_tok);
/* serious error now */
@ -1491,7 +1491,7 @@ huge_var_error:
e = (TokEntry *)AllocScannerMemory(sizeof(TokEntry));
if (e == NULL) {
LOCAL_ErrorMessage = "Trail Overflow";
LOCAL_Error_TYPE = OUT_OF_TRAIL_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_TRAIL;
if (p)
p->Tok = Ord(kind = eot_tok);
/* serious error now */
@ -1520,7 +1520,7 @@ huge_var_error:
e2 = (TokEntry *)AllocScannerMemory(sizeof(TokEntry));
if (e2 == NULL) {
LOCAL_ErrorMessage = "Trail Overflow";
LOCAL_Error_TYPE = OUT_OF_TRAIL_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_TRAIL;
if (p)
p->Tok = Ord(kind = eot_tok);
/* serious error now */
@ -1551,7 +1551,7 @@ huge_var_error:
e2 = (TokEntry *)AllocScannerMemory(sizeof(TokEntry));
if (e2 == NULL) {
LOCAL_ErrorMessage = "Trail Overflow";
LOCAL_Error_TYPE = OUT_OF_TRAIL_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_TRAIL;
t->Tok = Ord(kind = eot_tok);
/* serious error now */
return l;
@ -1583,7 +1583,7 @@ quoted_string:
while (TRUE) {
if (charp + 1024 > (char *)AuxSp) {
LOCAL_Error_TYPE = OUT_OF_AUXSPACE_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_AUXILIARY_STACK;
LOCAL_ErrorMessage =
"Heap Overflow While Scanning: please increase code space (-h)";
break;
@ -1620,7 +1620,7 @@ quoted_string:
++len;
if (charp > (char *)AuxSp - 1024) {
/* Not enough space to read in the string. */
LOCAL_Error_TYPE = OUT_OF_AUXSPACE_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_AUXILIARY_STACK;
LOCAL_ErrorMessage =
"not enough space to read in string or quoted atom";
/* serious error now */
@ -1675,7 +1675,7 @@ quoted_string:
t->TokInfo = Unsigned(Yap_LookupAtom(TokImage));
}
if (!(t->TokInfo)) {
LOCAL_Error_TYPE = OUT_OF_HEAP_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP;
LOCAL_ErrorMessage = "Code Space Overflow";
if (p)
t->Tok = Ord(kind = eot_tok);
@ -1767,7 +1767,7 @@ enter_symbol:
ae = Yap_LookupAtom(TokImage);
}
if (ae == NIL) {
LOCAL_Error_TYPE = OUT_OF_HEAP_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP;
LOCAL_ErrorMessage = "Code Space Overflow";
if (p)
t->Tok = Ord(kind = eot_tok);
@ -1776,7 +1776,7 @@ enter_symbol:
}
t->TokInfo = Unsigned(ae);
if (t->TokInfo == (CELL)NIL) {
LOCAL_Error_TYPE = OUT_OF_HEAP_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP;
LOCAL_ErrorMessage = "Code Space Overflow";
if (p)
t->Tok = Ord(kind = eot_tok);
@ -1932,7 +1932,7 @@ enter_symbol:
}
if (charp > (char *)AuxSp - 1024) {
/* Not enough space to read in the string. */
LOCAL_Error_TYPE = OUT_OF_AUXSPACE_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_AUXILIARY_STACK;
LOCAL_ErrorMessage =
"not enough space to read in string or quoted atom";
/* serious error now */
@ -1961,7 +1961,7 @@ enter_symbol:
qq->end.linepos = inp_stream->linepos - 1;
qq->end.charno = inp_stream->charcount - 1;
if (!(t->TokInfo)) {
LOCAL_Error_TYPE = OUT_OF_HEAP_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP;
LOCAL_ErrorMessage = "Code Space Overflow";
if (p)
t->Tok = Ord(kind = eot_tok);
@ -1997,7 +1997,7 @@ enter_symbol:
TokEntry *e = (TokEntry *)AllocScannerMemory(sizeof(TokEntry));
if (e == NULL) {
LOCAL_ErrorMessage = "Trail Overflow";
LOCAL_Error_TYPE = OUT_OF_TRAIL_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_TRAIL;
p->Tok = Ord(kind = eot_tok);
/* serious error now */
return l;

View File

@ -363,7 +363,7 @@ p_first_signal( USES_REGS1 )
LOCAL_PrologMode |= AbortMode;
return -1;
} else {
Yap_Error(PURE_ABORT, TermNil, "abort from console");
Yap_Error(ABORT_EVENT, TermNil, "abort from console");
}
Yap_RestartYap( 1 );
return FALSE;

View File

@ -59,7 +59,7 @@ build_new_list(CELL *pt, Term t USES_REGS)
pt += 2;
if (pt > ASP - 4096) {
if (!Yap_gcl((ASP-HR)*sizeof(CELL), 2, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return(FALSE);
}
t = Deref(ARG1);

436
C/stack.c
View File

@ -228,7 +228,7 @@ static yamop *cur_clause(PredEntry *pe, yamop *codeptr)
break;
cl = cl->ClNext;
} while (TRUE);
Yap_Error(SYSTEM_ERROR,TermNil,"could not find clause for indexing code");
Yap_Error(SYSTEM_ERROR_INTERNAL,TermNil,"could not find clause for indexing code");
return(NULL);
}
@ -242,7 +242,7 @@ static yamop *cur_log_upd_clause(PredEntry *pe, yamop *codeptr)
}
cl = cl->ClNext;
} while (cl != NULL);
Yap_Error(SYSTEM_ERROR,TermNil,"could not find clause for indexing code");
Yap_Error(SYSTEM_ERROR_INTERNAL,TermNil,"could not find clause for indexing code");
return(NULL);
}
@ -532,9 +532,9 @@ clause_loc(void *clcode, PredEntry *pp) {
cl = ClauseCodeToLogUpdClause(clcode);
if (cl->ClFlags & FactMask) {
return MkIntTerm(cl->lusl.ClLine);
return MkIntegerTerm(cl->lusl.ClLine);
} else {
return MkIntTerm(cl->lusl.ClSource->ag.line_number);
return MkIntegerTerm(cl->lusl.ClSource->ag.line_number);
}
} else if (pp->PredFlags & DynamicPredFlag) {
DynamicClause *cl;
@ -1041,7 +1041,7 @@ p_all_choicepoints( USES_REGS1 )
Term t;
while ((t = all_cps(B PASS_REGS)) == 0L) {
if (!Yap_gcl(LOCAL_Error_Size, 1, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "while dumping choicepoints");
Yap_Error(RESOURCE_ERROR_STACK, TermNil, "while dumping choicepoints");
return FALSE;
}
}
@ -1054,7 +1054,7 @@ p_all_envs( USES_REGS1 )
Term t;
while ((t = all_envs(ENV PASS_REGS)) == 0L) {
if (!Yap_gcl(LOCAL_Error_Size, 1, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "while dumping environments");
Yap_Error(RESOURCE_ERROR_STACK, TermNil, "while dumping environments");
return FALSE;
}
}
@ -1164,7 +1164,7 @@ current_stack( USES_REGS1 )
Term t;
while ((t = all_calls( false PASS_REGS1 )) == 0L) {
if (!Yap_gcl(LOCAL_Error_Size, 1, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "while dumping stack");
Yap_Error(RESOURCE_ERROR_STACK, TermNil, "while dumping stack");
return FALSE;
}
}
@ -1625,6 +1625,428 @@ parent_pred( USES_REGS1 )
Yap_unify(ARG3, MkIntTerm(arity));
}
void Yap_dump_stack( void );
void DumpActiveGoals( CACHE_TYPE1 );
static int hidden(Atom);
static int legal_env(CELL * CACHE_TYPE);
#define ONLOCAL(ptr) (CellPtr(ptr) > CellPtr(HR) && CellPtr(ptr) < CellPtr(LOCAL_LocalBase))
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 USES_REGS)
{
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));
PELOCK(70,pe);
if (!ONHEAP (pe) || Unsigned (pe) & 3 || pe->KindOfPE & 0xff00) {
UNLOCK(pe->PELock);
return (FALSE);
}
UNLOCK(pe->PELock);
return (TRUE);
}
static bool
handled_exception( USES_REGS1 )
{
yamop *pos = NEXTOP(PredDollarCatch->cs.p_code.TrueCodeOfPred,l);
bool found_handler = false;
choiceptr gc_b;
gc_b = B;
while (gc_b) {
yamop *ap = gc_b->cp_ap;
if (ap == NOCODE) {
/* C-code: let they deal with that */
return false;
} else if (ap == pos) {
if (found_handler)
return TRUE; /* we have two handlers */
found_handler = true;
}
gc_b = gc_b->cp_b;
}
/* handled by Top c-code? */
return !found_handler;
}
void
Yap_dump_stack( void )
{
CACHE_REGS
choiceptr b_ptr = B;
CELL *env_ptr = ENV;
char tp[256];
yamop *ipc = CP;
int max_count = 200;
/* check if handled */
if (handled_exception( PASS_REGS1 ))
return;
#if DEBUG
fprintf(stderr,"%% YAP regs: P=%p, CP=%p, ASP=%p, H=%p, TR=%p, HeapTop=%p\n",P,CP,ASP,HR,TR,HeapTop);
fprintf(stderr,"%% YAP mode: %ux\n",(unsigned int)LOCAL_PrologMode);
if (LOCAL_ErrorMessage)
fprintf(stderr,"%% LOCAL_ErrorMessage: %s\n",LOCAL_ErrorMessage);
#endif
if (HR > ASP || HR > LCL0) {
fprintf(stderr,"%% YAP ERROR: Global Collided against Local (%p--%p)\n",HR,ASP);
} else if (HeapTop > (ADDR)LOCAL_GlobalBase) {
fprintf(stderr,"%% YAP ERROR: Code Space Collided against Global (%p--%p)\n", HeapTop, LOCAL_GlobalBase);
} else {
#if !USE_SYSTEM_MALLOC
fprintf (stderr,"%ldKB of Code Space (%p--%p)\n",(long int)((CELL)HeapTop-(CELL)Yap_HeapBase)/1024,Yap_HeapBase,HeapTop);
#if USE_DL_MALLOC
if (Yap_NOfMemoryHoles) {
UInt i;
for (i=0; i < Yap_NOfMemoryHoles; i++)
fprintf(stderr," Current hole: %p--%p\n",
Yap_MemoryHoles[i].start,
Yap_MemoryHoles[i].end);
}
#endif
#endif
Yap_detect_bug_location(P, FIND_PRED_FROM_ANYWHERE, (char *)HR, 256);
fprintf (stderr,"%%\n%% PC: %s\n",(char *)HR);
Yap_detect_bug_location(CP, FIND_PRED_FROM_ANYWHERE, (char *)HR, 256);
fprintf (stderr,"%% Continuation: %s\n",(char *)HR);
fprintf (stderr,"%% %luKB of Global Stack (%p--%p)\n",(unsigned long int)(sizeof(CELL)*(HR-H0))/1024,H0,HR);
fprintf (stderr,"%% %luKB of Local Stack (%p--%p)\n",(unsigned long int)(sizeof(CELL)*(LCL0-ASP))/1024,ASP,LCL0);
fprintf (stderr,"%% %luKB of Trail (%p--%p)\n",(unsigned long int)((ADDR)TR-LOCAL_TrailBase)/1024,LOCAL_TrailBase,TR);
fprintf (stderr,"%% Performed %ld garbage collections\n", (unsigned long int)LOCAL_GcCalls);
#if LOW_LEVEL_TRACER
{
extern long long vsc_count;
if (vsc_count) {
#if _WIN32
fprintf(stderr,"Trace Counter at %I64d\n",vsc_count);
#else
fprintf(stderr,"Trace Counter at %lld\n",vsc_count);
#endif
}
}
#endif
fprintf (stderr,"%% All Active Calls and\n");
fprintf (stderr,"%% Goals With Alternatives Open (Global In Use--Local In Use)\n%%\n");
while (b_ptr != NULL) {
while (env_ptr && env_ptr <= (CELL *)b_ptr) {
Yap_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);
}
if (!max_count--) {
fprintf(stderr,"%% .....\n");
return;
}
ipc = (yamop *)(env_ptr[E_CP]);
env_ptr = (CELL *)(env_ptr[E_E]);
}
if (b_ptr) {
if (!max_count--) {
fprintf(stderr,"%% .....\n");
return;
}
if (b_ptr->cp_ap && /* tabling */
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 */
Yap_detect_bug_location(b_ptr->cp_ap, FIND_PRED_FROM_CP, tp, 256);
fprintf(stderr,"%% %s (%luKB--%luKB)\n", tp,
(unsigned long int)((b_ptr->cp_h-H0)*sizeof(CELL)/1024),
(unsigned long int)((ADDR)LCL0-(ADDR)b_ptr)/1024);
}
b_ptr = b_ptr->cp_b;
}
}
}
}
void
DumpActiveGoals ( USES_REGS1 )
{
/* try to dump active goals */
CELL *ep = YENV; /* and current environment */
choiceptr b_ptr = B;
CELL cp;
PredEntry *pe;
int first = 1;
if (legal_env (YENV PASS_REGS) && YENV < ENV)
ep = YENV;
else if (legal_env (ENV PASS_REGS))
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((yamop *)cp);
if (!ONHEAP (pe) || Unsigned (pe) & (sizeof(CELL)-1))
break;
PELOCK(71,pe);
if (pe->KindOfPE & 0xff00) {
UNLOCK(pe->PELock);
break;
}
if (pe->PredFlags & (CompiledPredFlag | DynamicPredFlag))
{
Functor f;
UNLOCK(pe->PELock);
f = pe->FunctorOfPred;
if (pe->KindOfPE && hidden (NameOfFunctor (f)))
goto next;
if (first++ == 1)
fprintf(stderr,"Active ancestors:\n");
Yap_DebugWriteIndicator(pe);
Yap_DebugPutc (stderr,'\n');
} else {
UNLOCK(pe->PELock);
}
next:
ep = (CELL *) ep[E_E];
}
first = 1;
fprintf(stderr,"Active Choice-Points:\n");
while (TRUE)
{
PredEntry *pe;
op_numbers opnum;
if (!ONLOCAL (b_ptr) || b_ptr->cp_b == NULL)
break;
fprintf(stderr,"%p ", b_ptr);
pe = Yap_PredForChoicePt(b_ptr, &opnum);
if (opnum == _Nstop) {
fprintf(stderr, " ********** C-Code Interface Boundary ***********\n");
} else {
Functor f;
Term mod = PROLOG_MODULE;
f = pe->FunctorOfPred;
if (pe->ModuleOfPred)
mod = pe->ModuleOfPred;
else mod = TermProlog;
if (mod != TermProlog &&
mod != MkAtomTerm(AtomUser) ) {
Yap_DebugPlWrite (mod);
Yap_DebugPutc (stderr,':');
}
if (mod == IDB_MODULE) {
if (pe->PredFlags & NumberDBPredFlag) {
Int id = pe->src.IndxId;
Yap_DebugPlWrite(MkIntegerTerm(id));
} else if (pe->PredFlags & AtomDBPredFlag) {
Atom At = (Atom)pe->FunctorOfPred;
Yap_DebugPlWrite(MkAtomTerm(At));
} else {
Functor f = pe->FunctorOfPred;
Atom At = NameOfFunctor(f);
arity_t arity = ArityOfFunctor(f);
int i;
Yap_DebugPlWrite(MkAtomTerm(At));
Yap_DebugPutc (stderr,'(');
for (i= 0; i < arity; i++) {
if (i > 0) Yap_DebugPutc (stderr,',');
Yap_DebugPutc (stderr,'_');
}
Yap_DebugPutc (stderr,')');
}
Yap_DebugPutc (stderr,'(');
Yap_DebugPlWrite(b_ptr->cp_a2);
Yap_DebugPutc (stderr,')');
} else if (pe->ArityOfPE == 0) {
Yap_DebugPlWrite (MkAtomTerm ((Atom)f));
} else {
Int i = 0, arity = pe->ArityOfPE;
if (opnum == _or_last||
opnum == _or_else) {
Yap_DebugPlWrite (MkAtomTerm (NameOfFunctor (f)));
Yap_DebugPutc (stderr,'(');
for (i= 0; i < arity; i++) {
if (i > 0) Yap_DebugPutc (stderr,',');
Yap_DebugPutc(stderr, '_');
}
Yap_DebugErrorPuts (") :- ... ( _ ; _ ");
} else {
Term *args = &(b_ptr->cp_a1);
Yap_DebugPlWrite (MkAtomTerm (NameOfFunctor (f)));
Yap_DebugPutc (stderr,'(');
for (i= 0; i < arity; i++) {
if (i > 0) Yap_DebugPutc (stderr,',');
Yap_DebugPlWrite(args[i]);
}
}
Yap_DebugPutc (stderr,')');
}
Yap_DebugPutc (stderr,'\n');
}
b_ptr = b_ptr->cp_b;
}
}
void
Yap_detect_bug_location(yamop *yap_pc, int where_from, char *tp, int psize)
{
Atom pred_name;
UInt pred_arity;
Term pred_module;
Int cl;
tp[0] = '\0';
if ((cl = Yap_PredForCode(yap_pc, where_from, &pred_name, &pred_arity, &pred_module))
== 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
snprintf(tp, psize, "prolog:%s/%lu",
RepAtom(pred_name)->StrOfAE, (unsigned long int)pred_arity);
#else
sprintf(tp, "in prolog:%s/%lu",
RepAtom(pred_name)->StrOfAE, (unsigned long int)pred_arity);
#endif
} else if (cl < 0) {
#if HAVE_SNPRINTF
snprintf(tp, psize, "%s:%s/%lu",
RepAtom(AtomOfTerm(pred_module))->StrOfAE,
RepAtom(pred_name)->StrOfAE, (unsigned long int)pred_arity);
#else
sprintf(tp, "%s:%s/%lu",
RepAtom(AtomOfTerm(pred_module))->StrOfAE,
RepAtom(pred_name)->StrOfAE, (unsigned long int)pred_arity);
#endif
} else {
#if HAVE_SNPRINTF
snprintf(tp, psize, "%s:%s/%lu at clause %lu ",
RepAtom(AtomOfTerm(pred_module))->StrOfAE,
RepAtom(pred_name)->StrOfAE, (unsigned long int)pred_arity, (unsigned long int)cl);
#else
sprintf(tp, "%s:%s/%lu at clause %lu",
RepAtom(AtomOfTerm(pred_module))->StrOfAE,
RepAtom(pred_name)->StrOfAE, (unsigned long int)pred_arity, (unsigned long int)cl);
#endif
}
}
Term
Yap_bug_location(yamop *codeptr, choiceptr b_ptr, CELL *env)
{
CACHE_REGS
Term p[5];
while ( true ) {
PredEntry *pe= EnvPreg(codeptr);
if (pe &&
pe->ModuleOfPred != PROLOG_MODULE
&& !(pe->PredFlags & HiddenPredFlag)) {
if (pe->ModuleOfPred == PROLOG_MODULE)
p[0] = TermProlog;
else
p[0] = pe->ModuleOfPred;
if (pe->ArityOfPE)
p[1] = MkAtomTerm(NameOfFunctor(pe->FunctorOfPred));
else
p[1] = MkAtomTerm((Atom)pe->FunctorOfPred);
p[2] = MkIntegerTerm( pe->ArityOfPE );
if (pe->src.OwnerFile) {
p[3] = MkAtomTerm(pe->src.OwnerFile);
if (pe->PredFlags & MegaClausePredFlag) {
MegaClause *mcl;
mcl =
ClauseCodeToMegaClause(pe->cs.p_code.FirstClause);
p[4] = MkIntegerTerm( mcl->ClLine );
} else {
CODEADDR clcode;
if ( find_code_in_clause( pe, codeptr, &clcode, NULL) > 0 ) {
if (pe->PredFlags & LogUpdatePredFlag) {
LogUpdClause *cl = ClauseCodeToLogUpdClause(clcode);
if (cl->ClFlags & FactMask) {
p[4] = MkIntegerTerm(cl->lusl.ClLine);
} else {
p[4] = MkIntegerTerm(cl->lusl.ClSource->ag.line_number);
}
} else if (pe->PredFlags & DynamicPredFlag) {
DynamicClause *cl;
cl = ClauseCodeToDynamicClause(clcode);
p[4] = MkIntTerm(0);
} else {
StaticClause *cl;
cl = ClauseCodeToStaticClause(clcode);
if (cl->ClFlags & FactMask) {
p[4] = MkIntTerm(cl->usc.ClLine);
} else if (cl->ClFlags & SrcMask) {
p[4] = MkIntTerm(cl->usc.ClSource->ag.line_number);
} else
p[4] = MkIntTerm(0);
}
}
}
} else if (pe->OpcodeOfPred == UNDEF_OPCODE) {
RESET_VARIABLE(p+3);
RESET_VARIABLE(p+4);
} else {
// by default, user_input
p[3] = MkAtomTerm(AtomUserIn);
p[4] = MkIntTerm(0);
}
return Yap_MkApplTerm( Yap_MkFunctor(Yap_LookupAtom("p"), 5), 5, p);
} else {
if (b_ptr && (CELL*)b_ptr < env) {
env = b_ptr->cp_env;
b_ptr = b_ptr->cp_b;
} else {
env = ENV_Parent(env);
}
}
}
}
void
Yap_InitStInfo(void)

View File

@ -187,7 +187,7 @@ static yamop *cur_clause(PredEntry *pe, yamop *codeptr)
break;
cl = cl->ClNext;
} while (TRUE);
Yap_Error(SYSTEM_ERROR,TermNil,"could not find clause for indexing code");
Yap_Error(SYSTEM_ERROR_INTERNAL,TermNil,"could not find clause for indexing code");
return(NULL);
}
@ -201,7 +201,7 @@ static yamop *cur_log_upd_clause(PredEntry *pe, yamop *codeptr)
}
cl = cl->ClNext;
} while (cl != NULL);
Yap_Error(SYSTEM_ERROR,TermNil,"could not find clause for indexing code");
Yap_Error(SYSTEM_ERROR_INTERNAL,TermNil,"could not find clause for indexing code");
return(NULL);
}

View File

@ -223,7 +223,7 @@
* replace heap_base by Yap_heap_base, according to Yap's convention for globals.
*
* Revision 1.74 2004/11/19 22:08:43 vsc
* replace SYSTEM_ERROR by out OUT_OF_WHATEVER_ERROR whenever appropriate.
* replace SYSTEM_ERROR_INTERNAL by out OUT_OF_WHATEVER_ERROR whenever appropriate.
*
* Revision 1.73 2004/11/19 17:14:14 vsc
* a few fixes for 64 bit compiling.
@ -713,7 +713,7 @@ static Int p_univ(USES_REGS1) { /* A =.. L */
/* restore space */
HR = Ar;
if (!Yap_gcl((ASP - HR) * sizeof(CELL), 2, ENV, gc_P(P, CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return FALSE;
}
twork = TailOfTerm(Deref(ARG2));
@ -781,7 +781,7 @@ static Int p_univ(USES_REGS1) { /* A =.. L */
twork = Yap_ArrayToList(CellPtr(TR), argno - 1);
while (IsIntTerm(twork)) {
if (!Yap_gc(2, ENV, gc_P(P, CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return (FALSE);
}
twork = Yap_ArrayToList(CellPtr(TR), argno - 1);
@ -791,7 +791,7 @@ static Int p_univ(USES_REGS1) { /* A =.. L */
{
while (HR + arity * 2 > ASP - 1024) {
if (!Yap_gcl((arity * 2) * sizeof(CELL), 2, ENV, gc_P(P, CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return (FALSE);
}
tin = Deref(ARG1);
@ -809,7 +809,7 @@ static Int p_univ(USES_REGS1) { /* A =.. L */
static Int p_abort(USES_REGS1) { /* abort */
/* make sure we won't go creeping around */
Yap_Error(PURE_ABORT, TermNil, "");
Yap_Error(ABORT_EVENT, TermNil, "");
return (FALSE);
}

View File

@ -486,7 +486,7 @@ write_strings( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
Term t = init_tstring( PASS_REGS1 );
unsigned char *cp = s, *buf;
LOCAL_TERM_ERROR( 2*(lim-s) );
LOCAL_TERM_ERROR( t, 2*(lim-s) );
buf = buf_from_tstring(HR);
while (*cp && cp < lim) {
utf8proc_int32_t chr;
@ -510,7 +510,7 @@ write_strings( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
unsigned char *buf;
utf8proc_int32_t chr;
LOCAL_TERM_ERROR( 2*(lim-s) );
LOCAL_TERM_ERROR( t, 2*(lim-s) );
buf = buf_from_tstring(HR);
while (cp < lim) {
cp = get_char(cp, &chr);
@ -531,7 +531,7 @@ write_strings( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
wchar_t *wp = s;
unsigned char *buf;
LOCAL_TERM_ERROR( 2*(lim-s) );
LOCAL_TERM_ERROR( t, 2*(lim-s) );
buf = buf_from_tstring(HR);
while (wp < lim) {
utf8proc_int32_t chr;
@ -548,7 +548,7 @@ write_strings( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
}
break;
default:
Yap_Error(SYSTEM_ERROR, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc), __FUNCTION__);
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc), __FUNCTION__);
}
return out->val.t;
@ -574,7 +574,7 @@ write_atoms( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
unsigned char *cp = s;
wchar_t w[2];
w[1] = '\0';
LOCAL_TERM_ERROR( 2*(lim-s) );
LOCAL_TERM_ERROR( t, 2*(lim-s) );
while (cp < lim && *cp) {
utf8proc_int32_t chr;
CELL *cl;
@ -596,7 +596,7 @@ write_atoms( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
char w[2];
w[1] = '\0';
LOCAL_TERM_ERROR( 2*(lim-s) );
LOCAL_TERM_ERROR( t, 2*(lim-s) );
while (cp < lim) {
utf8proc_int32_t chr;
cp = get_char(cp, &chr);
@ -616,7 +616,7 @@ write_atoms( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
wchar_t w[2];
w[1] = '\0';
LOCAL_TERM_ERROR( 2*(lim-s) );
LOCAL_TERM_ERROR( t, 2*(lim-s) );
while (*cp && cp < lim) {
utf8proc_int32_t chr;
cp = get_wchar(cp, &chr);
@ -631,7 +631,7 @@ write_atoms( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
break;
}
default:
Yap_Error(SYSTEM_ERROR, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc), __FUNCTION__);
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc), __FUNCTION__);
}
if (out->type & YAP_STRING_DIFF) {
if (sz == 0) t = out->dif;
@ -660,7 +660,7 @@ write_codes( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
case ENC_ISO_UTF8:
{ unsigned char *s = s0, *lim = s + strnlen(s0, max);
unsigned char *cp = s;
LOCAL_TERM_ERROR( 2*(lim-s) );
LOCAL_TERM_ERROR( t, 2*(lim-s) );
while (*cp && cp < lim) {
utf8proc_int32_t chr;
cp += get_utf8(cp, &chr);
@ -676,7 +676,7 @@ write_codes( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
{ unsigned char *s = s0, *lim = s + strnlen(s0, max);
unsigned char *cp = s;
LOCAL_TERM_ERROR( 2*(lim-s) );
LOCAL_TERM_ERROR( t, 2*(lim-s) );
while (cp < lim) {
utf8proc_int32_t chr;
cp = get_char(cp, &chr);
@ -692,7 +692,7 @@ write_codes( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
{ wchar_t *s = s0, *lim = s + wcsnlen(s, max);
wchar_t *cp = s;
LOCAL_TERM_ERROR( 2*(lim-s) );
LOCAL_TERM_ERROR( t, 2*(lim-s) );
while (cp < lim) {
utf8proc_int32_t chr;
cp = get_wchar(cp, &chr);
@ -705,7 +705,7 @@ write_codes( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
break;
}
default:
Yap_Error(SYSTEM_ERROR, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc), __FUNCTION__);
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc), __FUNCTION__);
}
while (sz < min) {
HR[0] = MkIntTerm(MkIntTerm(0));
@ -768,7 +768,7 @@ write_atom( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng US
return at;
}
default:
Yap_Error(SYSTEM_ERROR, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc));
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc));
}
return NULL;
}
@ -852,7 +852,7 @@ write_wbuffer( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
break;
default:
sz_end = -1;
Yap_Error(SYSTEM_ERROR, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc), __FUNCTION__);
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc), __FUNCTION__);
}
}
sz_end *= sizeof( wchar_t );
@ -944,7 +944,7 @@ write_buffer( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
break;
default:
sz_end = -1;
Yap_Error(SYSTEM_ERROR, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc), __FUNCTION__);
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc), __FUNCTION__);
}
}else if (out->enc == ENC_ISO_LATIN1) {
switch (enc) {
@ -999,7 +999,7 @@ write_buffer( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
break;
default:
sz_end = -1;
Yap_Error(SYSTEM_ERROR, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc), __FUNCTION__);
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc), __FUNCTION__);
}
} else {
// no other encodings are supported.
@ -1041,7 +1041,7 @@ write_length( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
return wcsnlen(s, max);
}
default:
Yap_Error(SYSTEM_ERROR, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc), __FUNCTION__);
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc), __FUNCTION__);
}
return (size_t)-1;
}
@ -1151,7 +1151,7 @@ compute_end( void *s0, encoding_t enc )
return s + (1+wcslen(s));
}
default:
Yap_Error(SYSTEM_ERROR, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc), __FUNCTION__);
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc), __FUNCTION__);
}
return NULL;
}
@ -1167,7 +1167,7 @@ advance_Text( void *s, int l, encoding_t enc )
case ENC_WCHAR:
return ((wchar_t *)s)+l;
default:
Yap_Error(SYSTEM_ERROR, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc), __FUNCTION__);
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc), __FUNCTION__);
}
return s;
}
@ -1198,7 +1198,7 @@ cmp_Text( void *s1, void *s2, int l, encoding_t enc1, encoding_t enc2 )
}
return 0;
default:
Yap_Error(SYSTEM_ERROR, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc2), __FUNCTION__);
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc2), __FUNCTION__);
}
}
case ENC_ISO_UTF8:
@ -1227,7 +1227,7 @@ cmp_Text( void *s1, void *s2, int l, encoding_t enc1, encoding_t enc2 )
}
return 0;
default:
Yap_Error(SYSTEM_ERROR, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc2), __FUNCTION__);
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc2), __FUNCTION__);
}
}
case ENC_WCHAR:
@ -1251,11 +1251,11 @@ cmp_Text( void *s1, void *s2, int l, encoding_t enc1, encoding_t enc2 )
case ENC_WCHAR:
return wcsncmp(s1, s2, l);
default:
Yap_Error(SYSTEM_ERROR, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc2), __FUNCTION__);
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc2), __FUNCTION__);
}
}
default:
Yap_Error(SYSTEM_ERROR, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc1), __FUNCTION__);
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc1), __FUNCTION__);
}
return 0;
}
@ -1302,7 +1302,7 @@ concat( int n, seq_tv_t *out, void *sv[], encoding_t encv[], size_t lengv[] USES
/* wide atom */
wchar_t *buf = (wchar_t *)HR;
Atom at;
LOCAL_ERROR( sz+3 );
LOCAL_ERROR( MkAtomTerm(Yap_LookupWideAtom(buf)), sz+3 );
for (i = 0; i < n ; i ++) {
if (encv[i] == ENC_WCHAR) {
wchar_t *ptr = sv[i];
@ -1326,7 +1326,7 @@ concat( int n, seq_tv_t *out, void *sv[], encoding_t encv[], size_t lengv[] USES
char *buf = (char *)HR;
Atom at;
LOCAL_TERM_ERROR( sz/sizeof(CELL)+3 );
LOCAL_ERROR( MkAtomTerm(Yap_LookupAtom(buf)), sz/sizeof(CELL)+3 );
for (i = 0; i < n ; i ++) {
char *ptr = sv[i];
utf8proc_int32_t chr;
@ -1373,7 +1373,7 @@ slice( size_t min, size_t max, void *buf, seq_tv_t *out, encoding_t enc USES_REG
wchar_t *nbuf = (wchar_t *)HR;
wchar_t *ptr = (wchar_t *)buf + min;
if (max>min) {
LOCAL_ERROR( (max-min)*sizeof(wchar_t) );
LOCAL_ERROR( MkAtomTerm(Yap_LookupWideAtom(buf)), (max-min)*sizeof(wchar_t) );
memcpy( nbuf, ptr, (max - min)*sizeof(wchar_t));
}
nbuf[max-min] = '\0';
@ -1384,7 +1384,7 @@ slice( size_t min, size_t max, void *buf, seq_tv_t *out, encoding_t enc USES_REG
if (max>min) {
char *ptr = (char *)buf + min;
LOCAL_ERROR( max-min );
LOCAL_ERROR( MkAtomTerm(Yap_LookupAtom(buf)), max-min );
memcpy( nbuf, ptr, (max - min));
}
nbuf[max-min] = '\0';
@ -1395,7 +1395,7 @@ slice( size_t min, size_t max, void *buf, seq_tv_t *out, encoding_t enc USES_REG
unsigned char *ptr = skip_utf8 ( ( unsigned char *)buf, min );
utf8proc_int32_t chr;
LOCAL_ERROR( max-min );
LOCAL_ERROR( MkAtomTerm(Yap_LookupAtom(buf)), max-min );
while ( min++ < max ) { ptr += get_utf8(ptr, & chr); *nbuf++ = chr; }
nbuf[0] = '\0';
at = Yap_LookupMaybeWideAtom( (wchar_t*)HR );

View File

@ -422,17 +422,17 @@ thread_run(void *widp)
do {
t = tgs[0] = Yap_PopTermFromDB(LOCAL_ThreadHandle.tgoal);
if (t == 0) {
if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) {
if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growglobal(NULL)) {
Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, TermNil, LOCAL_ErrorMessage);
thread_die(worker_id, FALSE);
return NULL;
}
} else {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growstack(LOCAL_ThreadHandle.tgoal->NOfCells*CellSize)) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
thread_die(worker_id, FALSE);
return NULL;
}
@ -551,9 +551,9 @@ p_thread_sleep( USES_REGS1 )
req.tv_nsec = ntime;
if (nanosleep(&req, &oreq)) {
#if HAVE_STRERROR
Yap_Error(OPERATING_SYSTEM_ERROR, ARG1, "%s in thread_sleep/1", strerror(errno));
Yap_Error(SYSTEM_ERROR_OPERATING_SYSTEM, ARG1, "%s in thread_sleep/1", strerror(errno));
#else
Yap_Error(OPERATING_SYSTEM_ERROR, ARG1, "error %d in thread_sleep/1", errno);
Yap_Error(SYSTEM_ERROR_OPERATING_SYSTEM, ARG1, "error %d in thread_sleep/1", errno);
#endif
return FALSE;
}
@ -563,15 +563,15 @@ p_thread_sleep( USES_REGS1 )
UInt rtime;
if ((rtime = sleep(time)) < 0) {
#if HAVE_STRERROR
Yap_Error(OPERATING_SYSTEM_ERROR, ARG1, "%s in thread_sleep/1", strerror(errno));
Yap_Error(SYSTEM_ERROR_OPERATING_SYSTEM, ARG1, "%s in thread_sleep/1", strerror(errno));
#else
Yap_Error(OPERATING_SYSTEM_ERROR, ARG1, "error %d in thread_sleep/1", errno);
Yap_Error(SYSTEM_ERROR_OPERATING_SYSTEM, ARG1, "error %d in thread_sleep/1", errno);
#endif
}
return Yap_unify(ARG3,MkIntegerTerm(rtime)) &&
Yap_unify(ARG4,MkIntTerm(0L));
#else
Yap_Error(OPERATING_SYSTEM_ERROR, ARG1, "no support for thread_sleep/1 in this YAP configuration");
Yap_Error(SYSTEM_ERROR_OPERATING_SYSTEM, ARG1, "no support for thread_sleep/1 in this YAP configuration");
#endif
}
@ -1461,17 +1461,17 @@ p_thread_atexit( USES_REGS1 )
do {
t = Yap_PopTermFromDB(LOCAL_ThreadHandle.texit);
if (t == 0) {
if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) {
if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growglobal(NULL)) {
Yap_Error(OUT_OF_ATTVARS_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, TermNil, LOCAL_ErrorMessage);
thread_die(worker_id, FALSE);
return FALSE;
}
} else {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growstack(LOCAL_ThreadHandle.tgoal->NOfCells*CellSize)) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
thread_die(worker_id, FALSE);
return FALSE;
}

View File

@ -777,14 +777,14 @@ CACHE_Y(YREG);
SET_ASP(YREG, E_CB*sizeof(CELL));
saveregs();
while ((t = Yap_FetchTermFromDB(cl->lusl.ClSource)) == 0L) {
if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) {
if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growglobal(NULL)) {
UNLOCKPE(3,PP);
#if defined(YAPOR) || defined(THREADS)
PP = NULL;
#endif
Yap_NilError(OUT_OF_ATTVARS_ERROR, LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, LOCAL_ErrorMessage);
FAIL();
}
} else {
@ -794,7 +794,7 @@ CACHE_Y(YREG);
#if defined(YAPOR) || defined(THREADS)
PP = NULL;
#endif
Yap_NilError(OUT_OF_STACK_ERROR, LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK, LOCAL_ErrorMessage);
FAIL();
}
}
@ -918,7 +918,7 @@ CACHE_Y(YREG);
PREG = NEXTOP(PREG,Osbpa);
saveregs();
if (!Yap_gcl(sz, arity, YENV, PREG)) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
FAIL();
} else {
@ -12793,7 +12793,7 @@ S_SREG = RepAppl(d0);
///#ifdef PROFILED_ABSMI
EMIT_SIMPLE_BLOCK(P_FUNC2S_VV_SECONDIFOK_FIRSTIFOK_IFOK);
///#endif
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -12974,7 +12974,7 @@ S_SREG = RepAppl(d0);
///#ifdef PROFILED_ABSMI
EMIT_SIMPLE_BLOCK(P_FUNC2S_CV_D1GREATER_IFOK_IFOK);
///#endif
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -13139,7 +13139,7 @@ S_SREG = RepAppl(d0);
///#ifdef PROFILED_ABSMI
EMIT_SIMPLE_BLOCK(P_FUNC2S_VC_IFOK_IFOK);
///#endif
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -13307,7 +13307,7 @@ S_SREG = RepAppl(d0);
///#ifdef PROFILED_ABSMI
EMIT_SIMPLE_BLOCK(P_FUNC2S_Y_VV_D1GREATER_IFOK_IFOK);
///#endif
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -13498,7 +13498,7 @@ S_SREG = RepAppl(d0);
///#ifdef PROFILED_ABSMI
EMIT_SIMPLE_BLOCK(P_FUNC2S_Y_CV_D1GREATER_IFOK_IFOK);
///#endif
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -13684,7 +13684,7 @@ S_SREG = RepAppl(d0);
///#ifdef PROFILED_ABSMI
EMIT_SIMPLE_BLOCK(P_FUNC2S_Y_VC_IFOK_IFOK);
///#endif
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -14182,7 +14182,7 @@ S_SREG = RepAppl(d0);
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 3, YREG, NEXTOP(NEXTOP(PREG,e),Osbmp))) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {

View File

@ -76,7 +76,7 @@ p_new_udi( USES_REGS1 )
blk = (UdiInfo) Yap_AllocCodeSpace(sizeof(struct udi_info));
memset((void *) blk,0, sizeof(struct udi_info));
if (!blk) {
Yap_Error(OUT_OF_HEAP_ERROR, spec, "new user index/1");
Yap_Error(RESOURCE_ERROR_HEAP, spec, "new user index/1");
return FALSE;
}

View File

@ -607,7 +607,7 @@ InitReverseLookupOpcode(void)
while (OP_RTABLE == NULL) {
if ((OP_RTABLE = (op_entry *)Yap_AllocCodeSpace(sz)) == NULL) {
if (!Yap_growheap(FALSE, sz, NULL)) {
Yap_Error(INTERNAL_ERROR, TermNil,
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil,
"Couldn't obtain space for the reverse translation opcode table");
}
}

View File

@ -371,7 +371,7 @@ handle_cp_overflow(int res, tr_fr_ptr TR0, UInt arity, Term t)
switch(res) {
case -1:
if (!Yap_gcl((ASP-HR)*sizeof(CELL), arity+1, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return 0L;
}
return Deref(XREGS[arity+1]);
@ -384,14 +384,14 @@ handle_cp_overflow(int res, tr_fr_ptr TR0, UInt arity, Term t)
if (size > 4*1024*1024)
size = 4*1024*1024;
if (!Yap_ExpandPreAllocCodeSpace(size, NULL, TRUE)) {
Yap_Error(OUT_OF_AUXSPACE_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_AUXILIARY_STACK, TermNil, LOCAL_ErrorMessage);
return 0L;
}
}
return Deref(XREGS[arity+1]);
case -4:
if (!Yap_growtrail((TR-TR0)*sizeof(tr_fr_ptr *), FALSE)) {
Yap_Error(OUT_OF_TRAIL_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_TRAIL, TermNil, LOCAL_ErrorMessage);
return 0L;
}
return Deref(XREGS[arity+1]);
@ -1270,7 +1270,7 @@ Yap_ImportTerm(char * buf) {
// if not enough stack available
while (HR + sz > ASP - 4096) {
if (!Yap_gcl( (sz+4096)*sizeof(CELL), PP->ArityOfPE, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, LOCAL_ErrorMessage);
return 0L;
}
}
@ -1462,7 +1462,7 @@ static Term vars_in_complex_term(register CELL *pt0, register CELL *pt0_end, Ter
*pt0 = (CELL)to_visit[2];
}
#endif
LOCAL_Error_TYPE = OUT_OF_TRAIL_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_TRAIL;
LOCAL_Error_Size = (TR-TR0)*sizeof(tr_fr_ptr *);
clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
@ -1478,7 +1478,7 @@ static Term vars_in_complex_term(register CELL *pt0, register CELL *pt0_end, Ter
*pt0 = (CELL)to_visit[2];
}
#endif
LOCAL_Error_TYPE = OUT_OF_AUXSPACE_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_AUXILIARY_STACK;
clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
HR = InitialH;
@ -1495,7 +1495,7 @@ static Term vars_in_complex_term(register CELL *pt0, register CELL *pt0_end, Ter
clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
HR = InitialH;
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_STACK;
LOCAL_Error_Size = (ASP-HR)*sizeof(CELL);
return 0L;
@ -1509,12 +1509,12 @@ expand_vts( int args USES_REGS )
LOCAL_Error_Size = 0;
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (yap_errno == OUT_OF_TRAIL_ERROR) {
if (yap_errno == RESOURCE_ERROR_TRAIL) {
/* Trail overflow */
if (!Yap_growtrail(expand, FALSE)) {
return FALSE;
}
} else if (yap_errno == OUT_OF_AUXSPACE_ERROR) {
} else if (yap_errno == RESOURCE_ERROR_AUXILIARY_STACK) {
/* Aux space overflow */
if (expand > 4*1024*1024)
expand = 4*1024*1024;
@ -1523,7 +1523,7 @@ expand_vts( int args USES_REGS )
}
} else {
if (!Yap_gcl(expand, 3, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "in term_variables");
Yap_Error(RESOURCE_ERROR_STACK, TermNil, "in term_variables");
return FALSE;
}
}
@ -1811,7 +1811,7 @@ static Term attvars_in_complex_term(register CELL *pt0, register CELL *pt0_end,
*pt0 = (CELL)to_visit[2];
}
#endif
LOCAL_Error_TYPE = OUT_OF_TRAIL_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_TRAIL;
LOCAL_Error_Size = (TR-TR0)*sizeof(tr_fr_ptr *);
clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
@ -1827,7 +1827,7 @@ static Term attvars_in_complex_term(register CELL *pt0, register CELL *pt0_end,
*pt0 = (CELL)to_visit[2];
}
#endif
LOCAL_Error_TYPE = OUT_OF_AUXSPACE_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_AUXILIARY_STACK;
clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
HR = InitialH;
@ -1844,7 +1844,7 @@ static Term attvars_in_complex_term(register CELL *pt0, register CELL *pt0_end,
clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
HR = InitialH;
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_STACK;
LOCAL_Error_Size = (ASP-HR)*sizeof(CELL);
return 0L;
@ -2043,7 +2043,7 @@ static Term vars_within_complex_term(register CELL *pt0, register CELL *pt0_end,
*pt0 = (CELL)to_visit[2];
}
#endif
LOCAL_Error_TYPE = OUT_OF_TRAIL_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_TRAIL;
LOCAL_Error_Size = (TR-TR0)*sizeof(tr_fr_ptr *);
clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
@ -2059,7 +2059,7 @@ static Term vars_within_complex_term(register CELL *pt0, register CELL *pt0_end,
*pt0 = (CELL)to_visit[2];
}
#endif
LOCAL_Error_TYPE = OUT_OF_AUXSPACE_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_AUXILIARY_STACK;
clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
HR = InitialH;
@ -2076,7 +2076,7 @@ static Term vars_within_complex_term(register CELL *pt0, register CELL *pt0_end,
clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
HR = InitialH;
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_STACK;
LOCAL_Error_Size = (ASP-HR)*sizeof(CELL);
return 0L;
@ -2248,7 +2248,7 @@ static Term new_vars_in_complex_term(register CELL *pt0, register CELL *pt0_end,
*pt0 = (CELL)to_visit[2];
}
#endif
LOCAL_Error_TYPE = OUT_OF_TRAIL_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_TRAIL;
LOCAL_Error_Size = (TR-TR0)*sizeof(tr_fr_ptr *);
clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
@ -2264,7 +2264,7 @@ static Term new_vars_in_complex_term(register CELL *pt0, register CELL *pt0_end,
*pt0 = (CELL)to_visit[2];
}
#endif
LOCAL_Error_TYPE = OUT_OF_AUXSPACE_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_AUXILIARY_STACK;
clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
HR = InitialH;
@ -2281,7 +2281,7 @@ static Term new_vars_in_complex_term(register CELL *pt0, register CELL *pt0_end,
clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
HR = InitialH;
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_STACK;
LOCAL_Error_Size = (ASP-HR)*sizeof(CELL);
return 0L;
@ -2437,7 +2437,7 @@ static Term free_vars_in_complex_term(register CELL *pt0, register CELL *pt0_end
*pt0 = (CELL)to_visit[2];
}
#endif
LOCAL_Error_TYPE = OUT_OF_TRAIL_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_TRAIL;
LOCAL_Error_Size = (TR-TR0)*sizeof(tr_fr_ptr *);
clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
@ -2453,7 +2453,7 @@ static Term free_vars_in_complex_term(register CELL *pt0, register CELL *pt0_end
*pt0 = (CELL)to_visit[2];
}
#endif
LOCAL_Error_TYPE = OUT_OF_AUXSPACE_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_AUXILIARY_STACK;
clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
HR = InitialH;
@ -2470,7 +2470,7 @@ static Term free_vars_in_complex_term(register CELL *pt0, register CELL *pt0_end
clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
HR = InitialH;
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_STACK;
LOCAL_Error_Size = (ASP-HR)*sizeof(CELL);
return 0L;
@ -2582,7 +2582,7 @@ static Term bind_vars_in_complex_term(register CELL *pt0, register CELL *pt0_end
*pt0 = (CELL)to_visit[2];
}
#endif
LOCAL_Error_TYPE = OUT_OF_TRAIL_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_TRAIL;
LOCAL_Error_Size = (TR-TR0)*sizeof(tr_fr_ptr *);
clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
@ -2598,7 +2598,7 @@ static Term bind_vars_in_complex_term(register CELL *pt0, register CELL *pt0_end
*pt0 = (CELL)to_visit[2];
}
#endif
LOCAL_Error_TYPE = OUT_OF_AUXSPACE_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_AUXILIARY_STACK;
clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
HR = InitialH;
@ -2825,7 +2825,7 @@ p_non_singletons_in_term( USES_REGS1 ) /* non_singletons in term t */
return Yap_unify(ARG3,out);
} else {
if (!Yap_ExpandPreAllocCodeSpace(0, NULL, TRUE)) {
Yap_Error(OUT_OF_AUXSPACE_ERROR, ARG1, "overflow in singletons");
Yap_Error(RESOURCE_ERROR_AUXILIARY_STACK, ARG1, "overflow in singletons");
return FALSE;
}
}
@ -2971,7 +2971,7 @@ int Yap_IsGroundTerm(Term t)
if (out < 0) {
*HR++ = t;
if (!Yap_ExpandPreAllocCodeSpace(0, NULL, TRUE)) {
Yap_Error(OUT_OF_AUXSPACE_ERROR, ARG1, "overflow in ground");
Yap_Error(RESOURCE_ERROR_AUXILIARY_STACK, ARG1, "overflow in ground");
return FALSE;
}
t = *--HR;
@ -3584,13 +3584,13 @@ Yap_TermHash(Term t, Int size, Int depth, int variant)
CELL *ar = hash_complex_term(&t1-1, &t1, depth, HR, FALSE PASS_REGS);
if (ar == (CELL *)-1) {
if (!Yap_ExpandPreAllocCodeSpace(0, NULL, TRUE)) {
Yap_Error(OUT_OF_AUXSPACE_ERROR, ARG1, "overflow in term_hash");
Yap_Error(RESOURCE_ERROR_AUXILIARY_STACK, ARG1, "overflow in term_hash");
return FALSE;
}
t1 = Deref(ARG1);
} else if(ar == (CELL *)-2) {
if (!Yap_gcl((ASP-HR)*sizeof(CELL), 0, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "in term_hash");
Yap_Error(RESOURCE_ERROR_STACK, TermNil, "in term_hash");
return FALSE;
}
t1 = Deref(ARG1);
@ -3641,13 +3641,13 @@ p_term_hash( USES_REGS1 )
CELL *ar = hash_complex_term(&t1-1, &t1, depth, HR, FALSE PASS_REGS);
if (ar == (CELL *)-1) {
if (!Yap_ExpandPreAllocCodeSpace(0, NULL, TRUE)) {
Yap_Error(OUT_OF_AUXSPACE_ERROR, ARG1, "overflow in term_hash");
Yap_Error(RESOURCE_ERROR_AUXILIARY_STACK, ARG1, "overflow in term_hash");
return FALSE;
}
t1 = Deref(ARG1);
} else if(ar == (CELL *)-2) {
if (!Yap_gcl((ASP-HR)*sizeof(CELL), 4, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "in term_hash");
Yap_Error(RESOURCE_ERROR_STACK, TermNil, "in term_hash");
return FALSE;
}
t1 = Deref(ARG1);
@ -3699,13 +3699,13 @@ p_instantiated_term_hash( USES_REGS1 )
CELL *ar = hash_complex_term(&t1-1, &t1, depth, HR, TRUE PASS_REGS);
if (ar == (CELL *)-1) {
if (!Yap_ExpandPreAllocCodeSpace(0, NULL, TRUE)) {
Yap_Error(OUT_OF_AUXSPACE_ERROR, ARG1, "overflow in term_hash");
Yap_Error(RESOURCE_ERROR_AUXILIARY_STACK, ARG1, "overflow in term_hash");
return FALSE;
}
t1 = Deref(ARG1);
} else if(ar == (CELL *)-2) {
if (!Yap_gcl((ASP-HR)*sizeof(CELL), 4, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "in term_hash");
Yap_Error(RESOURCE_ERROR_STACK, TermNil, "in term_hash");
return FALSE;
}
t1 = Deref(ARG1);
@ -3952,7 +3952,7 @@ is_variant(Term t1, Term t2, int parity USES_REGS)
error:
if (out == -1) {
if (!Yap_gcl((ASP-HR)*sizeof(CELL), parity, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "in variant");
Yap_Error(RESOURCE_ERROR_STACK, TermNil, "in variant");
return FALSE;
}
return is_variant(t1, t2, parity PASS_REGS);
@ -4501,13 +4501,13 @@ p_term_subsumer( USES_REGS1 ) /* term_subsumer terms t1 and t2 */
HR = oldH;
if (out == -1) {
if (!Yap_gcl((ASP-HR)*sizeof(CELL), 0, ENV, gc_P(P,CP))) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "in term_subsumer");
Yap_Error(RESOURCE_ERROR_STACK, TermNil, "in term_subsumer");
return FALSE;
}
} else {
/* Trail overflow */
if (!Yap_growtrail(0, FALSE)) {
Yap_Error(OUT_OF_TRAIL_ERROR, TermNil, "in term_subsumer");
Yap_Error(RESOURCE_ERROR_TRAIL, TermNil, "in term_subsumer");
return FALSE;
}
}
@ -4728,7 +4728,7 @@ static Int numbervars_in_complex_term(register CELL *pt0, register CELL *pt0_end
*pt0 = (CELL)to_visit[2];
}
#endif
LOCAL_Error_TYPE = OUT_OF_TRAIL_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_TRAIL;
LOCAL_Error_Size = (TR-TR0)*sizeof(tr_fr_ptr *);
clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
@ -4744,7 +4744,7 @@ static Int numbervars_in_complex_term(register CELL *pt0, register CELL *pt0_end
*pt0 = (CELL)to_visit[2];
}
#endif
LOCAL_Error_TYPE = OUT_OF_AUXSPACE_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_AUXILIARY_STACK;
clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
HR = InitialH;
@ -4761,7 +4761,7 @@ static Int numbervars_in_complex_term(register CELL *pt0, register CELL *pt0_end
clean_tr(TR0 PASS_REGS);
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
HR = InitialH;
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR;
LOCAL_Error_TYPE = RESOURCE_ERROR_STACK;
LOCAL_Error_Size = (ASP-HR)*sizeof(CELL);
return -1;
@ -4908,7 +4908,7 @@ unnumber_complex_term(CELL *pt0, CELL *pt0_end, CELL *ptf, CELL *HLow, int share
Int id = IntegerOfTerm(ap2[1]);
ground = FALSE;
if (id < -1) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil, "unnumber vars cannot cope with VAR(-%d)", id);
Yap_Error(RESOURCE_ERROR_STACK, TermNil, "unnumber vars cannot cope with VAR(-%d)", id);
return 0L;
}
if (id <= max) {

View File

@ -224,7 +224,7 @@ static char *ensure_space(size_t sz) {
if (!s) {
s = (char *)HR;
if (s + sz >= (char *)ASP) {
Yap_Error(OUT_OF_STACK_ERROR, TermNil,
Yap_Error(RESOURCE_ERROR_STACK, TermNil,
"not enough space to write bignum: it requires %d bytes", sz);
s = NULL;
}

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.0, 2015-09-17T09:40:51. -->
<!-- Written by QtCreator 3.5.0, 2015-09-24T22:39:02. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{378dfb04-c1f5-4fa0-86e6-78c9ff000795}</value>
<value type="QByteArray">{a0de746c-c885-4e01-9456-e8e37fff153e}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
@ -32,18 +32,18 @@
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">true</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">1</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">1</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">false</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
@ -65,13 +65,13 @@
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{272d81a6-7879-4ae0-b3cf-b19e1dbf86c9}</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{372e928c-645c-4a2e-be60-0afb86ba4bb0}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="bool" key="CMakeProjectManager.CMakeBuildConfiguration.UseNinja">false</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/vsc/Yap/bins/t</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/vsc/Yap/bins/Qt</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
@ -162,13 +162,10 @@
<value type="int">14</value>
</valuelist>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguation.Title">yap-bin</value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments">-l /Users/vsc/share/logtalk/integration/logtalk_yap -z &quot;start_low_level_trace,{'~/Yap/logtalk3/tests/prolog/predicates/open_4/tester'}&quot;</value>
<value type="bool" key="CMakeProjectManager.CMakeRunConfiguration.UseTerminal">false</value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory">/Users/vsc/share/logtalk</value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes">
<value type="QString">LOGTALKHOME=/Users/vsc/share/logtalk</value>
</valuelist>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">yap-bin</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.yap-bin</value>
@ -216,7 +213,6 @@
</valuelist>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguation.Title">Problogbdd</value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value>
<value type="bool" key="CMakeProjectManager.CMakeRunConfiguration.UseTerminal">false</value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
@ -267,7 +263,6 @@
</valuelist>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguation.Title">Problogbdd-Lfi</value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value>
<value type="bool" key="CMakeProjectManager.CMakeRunConfiguration.UseTerminal">false</value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
@ -318,7 +313,6 @@
</valuelist>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguation.Title">HorusCli</value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value>
<value type="bool" key="CMakeProjectManager.CMakeRunConfiguration.UseTerminal">false</value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
@ -332,58 +326,7 @@
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.4">
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguation.Title">qtyap</value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value>
<value type="bool" key="CMakeProjectManager.CMakeRunConfiguration.UseTerminal">false</value>
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qtyap</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.qtyap</value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">5</value>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">4</value>
</valuemap>
</data>
<data>

View File

@ -617,7 +617,7 @@ YAPEngine::YAPEngine( char *savedState,
if (cb) setYAPCallback(cb);
curren = this;
if (YAP_Init( &init_args ) == YAP_BOOT_ERROR)
throw(YAPError(INTERNAL_ERROR));
throw(YAPError(SYSTEM_ERROR_INTERNAL));
}

View File

@ -23,134 +23,129 @@
#ifndef YAP_FLAGS_H
#define YAP_FLAGS_H 1
//INLINE_ONLY inline EXTERN bool nat( Term inp );
// INLINE_ONLY inline EXTERN bool nat( Term inp );
static inline bool nat( Term inp ) {
static inline bool nat(Term inp) {
if (IsVarTerm(inp)) {
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag in 0...");
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag: value must be %s", "bound");
return false;
}
if (IsIntTerm(inp)) {
Int i = IntOfTerm(inp);
if (i >= 0) return true;
Yap_Error(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, inp, "set_prolog_flag in 0...");
if (i >= 0)
return true;
Yap_Error(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, inp, "set_prolog_flag: value must be %s", ">= 0");
return false;
}
Yap_Error(TYPE_ERROR_INTEGER, inp, "set_prolog_flag in 0...");
Yap_Error(TYPE_ERROR_INTEGER, inp, "set_prolog_flag: value must be %s", "integer");
return false;
}
static inline bool at2n( Term inp ) {
Yap_Error(PERMISSION_ERROR_READ_ONLY_FLAG, inp, "set_prolog_flag.");
static inline bool at2n(Term inp) {
Yap_Error(PERMISSION_ERROR_READ_ONLY_FLAG, inp, "set_prolog_flag %s", "flag is read-only");
return false;
}
static inline bool isfloat( Term inp ) {
static inline bool isfloat(Term inp) {
if (IsVarTerm(inp)) {
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag in 0.0.");
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag: value must be %s", "integer");
return false;
}
if (IsFloatTerm(inp)) {
return true;
}
Yap_Error(TYPE_ERROR_FLOAT, inp, "set_prolog_flag in 0...");
Yap_Error(TYPE_ERROR_FLOAT, inp, "set_prolog_flag: value must be %s", "floating-point");
return false;
}
INLINE_ONLY inline EXTERN bool ro( Term inp );
INLINE_ONLY inline EXTERN bool ro(Term inp);
INLINE_ONLY inline EXTERN bool ro( Term inp ) {
INLINE_ONLY inline EXTERN bool ro(Term inp) {
if (IsVarTerm(inp)) {
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag in 0...");
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag: value must be %s", "bound");
return false;
}
Yap_Error( PERMISSION_ERROR_READ_ONLY_FLAG, inp, "set_prolog_flag.");
Yap_Error(PERMISSION_ERROR_READ_ONLY_FLAG, inp, "set_prolog_flag %s", "flag is read-only");
return false;
}
INLINE_ONLY inline EXTERN bool aro( Term inp ) {
INLINE_ONLY inline EXTERN bool aro(Term inp) {
if (IsVarTerm(inp)) {
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag in 0...");
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag %s", "value must be bound");
return false;
}
Yap_Error( PERMISSION_ERROR_READ_ONLY_FLAG, inp, "set_prolog_flag.");
Yap_Error(PERMISSION_ERROR_READ_ONLY_FLAG, inp, "set_prolog_flag %s", "flag is read-only");
return false;
}
//INLINE_ONLY inline EXTERN bool boolean( Term inp );
// INLINE_ONLY inline EXTERN bool boolean( Term inp );
static inline bool boolean( Term inp ) {
if (inp == TermTrue ||
inp == TermFalse||
inp == TermOn||
inp == TermOff )
static inline bool boolean(Term inp) {
if (inp == TermTrue || inp == TermFalse || inp == TermOn || inp == TermOff)
return true;
if (IsVarTerm(inp)) {
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag in {true,false,on,off");
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag %s", "value must be bound");
;
return false;
}
if (IsAtomTerm(inp)) {
Yap_Error(DOMAIN_ERROR_OUT_OF_RANGE, inp, "set_prolog_flag in {true,false,on,off}");
Yap_Error(DOMAIN_ERROR_OUT_OF_RANGE, inp,
"set_prolog_flag in {true,false,on,off}");
return false;
}
Yap_Error(TYPE_ERROR_ATOM, inp, "set_prolog_flag in {true,false,on,off");
return false;
}
static bool synerr( Term inp ) {
if (inp == TermDec10 ||
inp == TermFail||
inp == TermError||
inp == TermQuiet )
static bool synerr(Term inp) {
if (inp == TermDec10 || inp == TermFail || inp == TermError ||
inp == TermQuiet)
return true;
if (IsAtomTerm(inp)) {
Yap_Error(DOMAIN_ERROR_OUT_OF_RANGE, inp, "set_prolog_flag in {dec10,error,fail,quiet}");
Yap_Error(DOMAIN_ERROR_OUT_OF_RANGE, inp,
"set_prolog_flag in {dec10,error,fail,quiet}");
return false;
}
Yap_Error(TYPE_ERROR_ATOM, inp, "set_prolog_flag in {dec10,error,fail,quiet}");
Yap_Error(TYPE_ERROR_ATOM, inp,
"set_prolog_flag in {dec10,error,fail,quiet}");
return false;
}
static inline bool filler(Term inp) { return true; }
static inline bool filler( Term inp )
{
return true;
}
static bool bqs( Term inp ) {
if (inp == TermCodes ||
inp == TermString||
inp == TermSymbolChar )
static bool bqs(Term inp) {
if (inp == TermCodes || inp == TermString || inp == TermSymbolChar)
return true;
if (IsAtomTerm(inp)) {
Yap_Error(DOMAIN_ERROR_OUT_OF_RANGE, inp, "set_prolog_flag in {codes,string}");
Yap_Error(DOMAIN_ERROR_OUT_OF_RANGE, inp,
"set_prolog_flag in {codes,string}");
return false;
}
Yap_Error(TYPE_ERROR_ATOM, inp, "set_prolog_flag in {codes,string}");
return false;
}
//INLINE_ONLY inline EXTERN bool isatom( Term inp );
// INLINE_ONLY inline EXTERN bool isatom( Term inp );
static inline bool isatom( Term inp ) {
static inline bool isatom(Term inp) {
if (IsVarTerm(inp)) {
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag");
Yap_Error(INSTANTIATION_ERROR, inp, "set_prolog_flag %s", "value must be bound");
return false;
}
if (IsAtomTerm(inp) )
if (IsAtomTerm(inp))
return true;
Yap_Error(TYPE_ERROR_ATOM, inp, "set_prolog_flagm");
Yap_Error(TYPE_ERROR_ATOM, inp, "set_prolog_flag");
return false;
}
// INLINE_ONLY inline EXTERN bool ok( Term inp );
static inline bool ok( Term inp ) {
return true;
}
static inline bool ok(Term inp) { return true; }
// a pair, obtained from x(y) -> 1,2,y)
typedef struct x_el {
@ -172,28 +167,27 @@ typedef struct struct_param2 {
} param2_t;
typedef struct {
char *name;
char *name;
bool writable;
flag_func def;
const char *init;
flag_func helper;
} flag_info;
typedef struct {
typedef struct {
char *name;
flag_func def;
const char *init;
} arg_info;
typedef union flagTerm {
Term at;
struct DB_TERM *DBT;
Term at;
struct DB_TERM *DBT;
} flag_term;
void Yap_InitFlags( bool );
void Yap_InitFlags(bool);
#define YAP_FLAG( x, NAME, WRITABLE, DEF, INIT, HELPER ) x
#define YAP_FLAG(x, NAME, WRITABLE, DEF, INIT, HELPER) x
typedef enum {
#include "YapGFlagInfo.h"
@ -204,28 +198,22 @@ typedef enum {
} local_flag_t;
#undef YAP_FLAG
bool setYapFlag(Term tflag, Term t2);
Term getYapFlag(Term tflag);
bool setYapFlag( Term tflag, Term t2 );
Term getYapFlag( Term tflag );
static inline bool check_refs_to_ltable(void) { return true; }
static inline bool check_refs_to_ltable( void ) {
return true;
}
static inline void setAtomicGlobalPrologFlag(int id, Term v)
{
static inline void setAtomicGlobalPrologFlag(int id, Term v) {
GLOBAL_Flags[id].at = v;
}
static inline void setAtomicLocalPrologFlag(int id, Term v)
{
CACHE_REGS
check_refs_to_ltable();
LOCAL_Flags[id].at = v;
static inline void setAtomicLocalPrologFlag(int id, Term v) {
CACHE_REGS
check_refs_to_ltable();
LOCAL_Flags[id].at = v;
}
static inline void setBooleanLocalPrologFlag(int id, bool v)
{
static inline void setBooleanLocalPrologFlag(int id, bool v) {
CACHE_REGS
check_refs_to_ltable();
if (v) {
@ -235,43 +223,37 @@ static inline void setBooleanLocalPrologFlag(int id, bool v)
}
}
static inline void setBooleanGlobalPrologFlag(int id, bool v)
{
static inline void setBooleanGlobalPrologFlag(int id, bool v) {
if (v) {
GLOBAL_Flags[id].at = TermTrue;
} else {
GLOBAL_Flags[id].at = TermFalse;
GLOBAL_Flags[id].at = TermTrue;
} else {
GLOBAL_Flags[id].at = TermFalse;
}
}
static inline bool trueGlobalPrologFlag(int id)
{
return GLOBAL_Flags[id].at == TermTrue;
static inline bool trueGlobalPrologFlag(int id) {
return GLOBAL_Flags[id].at == TermTrue;
}
static inline bool falseGlobalPrologFlag(int id)
{
return GLOBAL_Flags[id].at == TermFalse;
static inline bool falseGlobalPrologFlag(int id) {
return GLOBAL_Flags[id].at == TermFalse;
}
static inline bool trueLocalPrologFlag(int id)
{
CACHE_REGS
return LOCAL_Flags[id].at == TermTrue;
static inline bool trueLocalPrologFlag(int id) {
CACHE_REGS
return LOCAL_Flags[id].at == TermTrue;
}
static inline bool falsePrologFlag(int id)
{
CACHE_REGS
return LOCAL_Flags[id].at == TermFalse;
static inline bool falsePrologFlag(int id) {
CACHE_REGS
return LOCAL_Flags[id].at == TermFalse;
}
static inline bool isoLanguageFlag(void){
static inline bool isoLanguageFlag(void) {
return GLOBAL_Flags[ISO_FLAG].at == TermTrue;
}
static inline bool strictISOFlag(void){
static inline bool strictISOFlag(void) {
return GLOBAL_Flags[STRICT_ISO_FLAG].at == TermTrue;
}
@ -280,53 +262,49 @@ static inline bool silentMode(void) {
}
static inline void setVerbosity(Term val) {
GLOBAL_Flags[VERBOSE_FLAG].at = val;
GLOBAL_Flags[VERBOSE_FLAG].at = val;
}
static inline bool setSyntaxErrorsFlag(Term val) {
if (!synerr( val ))
if (!synerr(val))
return false;
CACHE_REGS
LOCAL_Flags[SYNTAX_ERRORS_FLAG].at = val;
return true;
CACHE_REGS
LOCAL_Flags[SYNTAX_ERRORS_FLAG].at = val;
return true;
}
static inline Term getSyntaxErrorsFlag(void) {
CACHE_REGS
CACHE_REGS
return LOCAL_Flags[SYNTAX_ERRORS_FLAG].at;
}
static inline bool setBackQuotesFlag(Term val) {
if (!bqs( val ))
if (!bqs(val))
return false;
if (val == TermSymbolChar)
val = TermString;
GLOBAL_Flags[BACKQUOTED_STRING_FLAG].at = val;
return true;
return true;
}
static inline Term getBackQuotesFlag(void) {
return GLOBAL_Flags[BACKQUOTED_STRING_FLAG].at;
return GLOBAL_Flags[BACKQUOTED_STRING_FLAG].at;
}
static inline int indexingMode(void) {
return GLOBAL_Flags[INDEX_FLAG].at;
}
static inline int indexingMode(void) { return GLOBAL_Flags[INDEX_FLAG].at; }
static inline const char *floatFormat(void) {
static inline const char *floatFormat(void) {
return RepAtom(AtomOfTerm(GLOBAL_Flags[FLOAT_FORMAT_FLAG].at))->rep.uStrOfAE;
}
static inline size_t indexingDepth(void) {
static inline size_t indexingDepth(void) {
return IntOfTerm(GLOBAL_Flags[INDEX_SUB_TERM_SEARCH_DEPTH_FLAG].at);
}
bool rmdot(Term inp);
xarg *Yap_ArgListToVector(Term listl, const param_t *def, int n);
xarg * Yap_ArgListToVector (Term listl, const param_t *def, int n);
xarg *Yap_ArgList2ToVector(Term listl, const param2_t *def, int n);
xarg * Yap_ArgList2ToVector (Term listl, const param2_t *def, int n);
#endif // YAP_FLAGS_H
#endif // YAP_FLAGS_H

View File

@ -17,14 +17,17 @@
#define YAP_HANDLES_H 1
#include "Regs.h"
/**
@groupdef term_t_slots
Also known as term handles, slots are offsets to entries in the local stack. YAP never compresses the local stack, so slots are respected by the garbage collector,
hence providing a way to access terms without being exposed to stack shifts or garbage-collection.
Also known as term handles, slots are offsets to entries in the local stack. YAP
never compresses the local stack, so slots are respected by the garbage
collector,
hence providing a way to access terms without being exposed to stack shifts or
garbage-collection.
Space is released when the function terminates. Thus, slots will be automatically released at the end
Space is released when the function terminates. Thus, slots will be
automatically released at the end
of a function. Hence, slots should always be used as local variables.
Slots are organized as follows:
@ -36,15 +39,18 @@ Entry
Entry
---- Number of entries (tagged as handle_t), in the example TAG(INT,4)
Slots are not known to the yaam. Instead, A new set of slots is created when the emulator calls user C-code.
Slots are not known to the yaam. Instead, A new set of slots is created when the
emulator calls user C-code.
(see YAP_Execute* functions). They are also created:
- by SWI's PL_foreign_frame() function,
- by the YAP_RunGoal() routines and friends, when they exit successfully. Notice that all handles created by c-goals within
- by the YAP_RunGoal() routines and friends, when they exit successfully.
Notice that all handles created by c-goals within
a `Goal` execution should not be used afterwards.
This section lists the main internal functions for slot management. These functions are then exported through corresponding FLI C-functions
This section lists the main internal functions for slot management. These
functions are then exported through corresponding FLI C-functions
*************************************************************************************************/
@ -52,170 +58,147 @@ Slots are not known to the yaam. Instead, A new set of slots is created when the
/// @brief reboot the slot system.
/// Used when wwe start from scratch (Reset).
#define Yap_RebootSlots( wid ) Yap_RebootSlots__( wid PASS_REGS )
#define Yap_RebootSlots(wid) Yap_RebootSlots__(wid PASS_REGS)
static inline void
Yap_RebootSlots__( int wid USES_REGS ) {
static inline void Yap_RebootSlots__(int wid USES_REGS) {
// // fprintf(stderr, " StartSlots = %ld", LOCAL_CurSlot);
REMOTE_CurSlot(wid) = 1;
}
/// @brief declares a new set of slots.
/// Used to tell how many slots we had when we entered a segment of code.
#define Yap_StartSlots() Yap_StartSlots__( PASS_REGS1 )
#define Yap_StartSlots() Yap_StartSlots__(PASS_REGS1)
static inline yhandle_t
Yap_StartSlots__( USES_REGS1 ) {
static inline yhandle_t Yap_StartSlots__(USES_REGS1) {
// // fprintf(stderr, " StartSlots = %ld", LOCAL_CurSlot);
// fprintf(stderr,"SS %s:%d\n", __FUNCTION__, __LINE__);;
if (LOCAL_CurSlot < 0) {
Yap_Error( SYSTEM_ERROR, 0L, " StartSlots = %ld", LOCAL_CurSlot);
// fprintf(stderr,"SS %s:%d\n", __FUNCTION__, __LINE__);;
if (LOCAL_CurSlot < 0) {
Yap_Error(SYSTEM_ERROR_INTERNAL, 0L, " StartSlots = %ld", LOCAL_CurSlot);
}
return LOCAL_CurSlot;
}
/// @brief reset slots to a well-known position in the stack
#define Yap_CloseSlots( slot ) Yap_CloseSlots__( slot PASS_REGS )
#define Yap_CloseSlots(slot) Yap_CloseSlots__(slot PASS_REGS)
static inline void
Yap_CloseSlots__( yhandle_t slot USES_REGS ) {
// fprintf(stderr,"CS %s:%d\n", __FUNCTION__, __LINE__);;
static inline void Yap_CloseSlots__(yhandle_t slot USES_REGS) {
// fprintf(stderr,"CS %s:%d\n", __FUNCTION__, __LINE__);;
LOCAL_CurSlot = slot;
}
/// @brief report the current position of the slots, assuming that they occupy the top of the stack.
static inline yhandle_t
Yap_CurrentSlot( USES_REGS1 ) {
return LOCAL_CurSlot;
}
/// @brief report the current position of the slots, assuming that they occupy
/// the top of the stack.
static inline yhandle_t Yap_CurrentSlot(USES_REGS1) { return LOCAL_CurSlot; }
#define Yap_GetFromSlot(slot) Yap_GetFromSlot__(slot PASS_REGS)
/// @brief read from a slot.
static inline Term
Yap_GetFromSlot__(yhandle_t slot USES_REGS)
{
// fprintf(stderr,"GS %s:%d\n", __FUNCTION__, __LINE__);;
return(Deref(LOCAL_SlotBase[slot]));
static inline Term Yap_GetFromSlot__(yhandle_t slot USES_REGS) {
// fprintf(stderr,"GS %s:%d\n", __FUNCTION__, __LINE__);;
return (Deref(LOCAL_SlotBase[slot]));
}
/// @brief read from a slot. but does not try to dereference the slot.
static inline Term
Yap_GetDerefedFromSlot(yhandle_t slot USES_REGS)
{
// fprintf(stderr,"GDS %s:%d\n", __FUNCTION__, __LINE__);
static inline Term Yap_GetDerefedFromSlot(yhandle_t slot USES_REGS) {
// fprintf(stderr,"GDS %s:%d\n", __FUNCTION__, __LINE__);
return LOCAL_SlotBase[slot];
}
/// @brief read the object in a slot. but do not try to dereference the slot.
static inline Term
Yap_GetPtrFromSlot(yhandle_t slot USES_REGS)
{
// fprintf(stderr,"GPS %s:%d\n", __FUNCTION__, __LINE__);
static inline Term Yap_GetPtrFromSlot(yhandle_t slot USES_REGS) {
// fprintf(stderr,"GPS %s:%d\n", __FUNCTION__, __LINE__);
return LOCAL_SlotBase[slot];
}
#define Yap_AddressFromSlot( slot ) Yap_AddressFromSlot__(slot PASS_REGS)
#define Yap_AddressFromSlot(slot) Yap_AddressFromSlot__(slot PASS_REGS)
/// @brief get the memory address of a slot
static inline Term *
Yap_AddressFromSlot__(yhandle_t slot USES_REGS)
{
return LOCAL_SlotBase+slot;
static inline Term *Yap_AddressFromSlot__(yhandle_t slot USES_REGS) {
return LOCAL_SlotBase + slot;
}
/// @brief store term in a slot
static inline void
Yap_PutInSlot(yhandle_t slot, Term t USES_REGS)
{
// fprintf(stderr,"PS %s:%d\n", __FUNCTION__, __LINE__);
static inline void Yap_PutInSlot(yhandle_t slot, Term t USES_REGS) {
// fprintf(stderr,"PS %s:%d\n", __FUNCTION__, __LINE__);
LOCAL_SlotBase[slot] = t;
}
#ifndef max
#define max(X,Y) ( X > Y ? X : Y )
#define max(X, Y) (X > Y ? X : Y)
#endif
static inline void
ensure_slots(int N USES_REGS)
{
if (LOCAL_CurSlot+N >= LOCAL_NSlots) {
size_t inc = max(16*1024, LOCAL_NSlots/2); // measured in cells
inc = max(inc, N+16); // measured in cells
LOCAL_SlotBase = (CELL *)realloc( LOCAL_SlotBase, (inc + LOCAL_NSlots )*sizeof(CELL));
static inline void ensure_slots(int N USES_REGS) {
if (LOCAL_CurSlot + N >= LOCAL_NSlots) {
size_t inc = max(16 * 1024, LOCAL_NSlots / 2); // measured in cells
inc = max(inc, N + 16); // measured in cells
LOCAL_SlotBase =
(CELL *)realloc(LOCAL_SlotBase, (inc + LOCAL_NSlots) * sizeof(CELL));
LOCAL_NSlots += inc;
if (!LOCAL_SlotBase) {
unsigned long int kneeds = ((inc + LOCAL_NSlots )*sizeof(CELL))/1024;
Yap_Error(SYSTEM_ERROR, 0 /* TermNil */, "Out of memory for the term handles (term_t) aka slots, l needed", kneeds);
unsigned long int kneeds = ((inc + LOCAL_NSlots) * sizeof(CELL)) / 1024;
Yap_Error(
SYSTEM_ERROR_INTERNAL, 0 /* TermNil */,
"Out of memory for the term handles (term_t) aka slots, l needed",
kneeds);
}
}
}
#define Yap_InitSlot( t ) Yap_InitSlot__( t PASS_REGS )
#define Yap_InitSlot(t) Yap_InitSlot__(t PASS_REGS)
/// @brief create a new slot with term t
static inline yhandle_t
Yap_InitSlot__(Term t USES_REGS)
{
static inline yhandle_t Yap_InitSlot__(Term t USES_REGS) {
yhandle_t old_slots = LOCAL_CurSlot;
// fprintf(stderr,"IS %s:%d\n", __FUNCTION__, __LINE__);
ensure_slots( 1 PASS_REGS);
ensure_slots(1 PASS_REGS);
LOCAL_SlotBase[old_slots] = t;
LOCAL_CurSlot++;
return old_slots;
}
#define Yap_NewSlots( n ) Yap_NewSlots__( n PASS_REGS )
#define Yap_NewSlots(n) Yap_NewSlots__(n PASS_REGS)
/// @brief allocate n empty new slots
static inline yhandle_t
Yap_NewSlots__(int n USES_REGS)
{
static inline yhandle_t Yap_NewSlots__(int n USES_REGS) {
yhandle_t old_slots = LOCAL_CurSlot;
int i;
// fprintf(stderr,"NS %s:%d\n", __FUNCTION__, __LINE__);
ensure_slots(n PASS_REGS);
for (i = 0; i< n; i++) {
LOCAL_SlotBase[old_slots+i] = MkVarTerm();
for (i = 0; i < n; i++) {
LOCAL_SlotBase[old_slots + i] = MkVarTerm();
}
LOCAL_CurSlot += n;
return old_slots;
}
#define Yap_InitSlots(n, ts) Yap_InitSlots__(n, ts PASS_REGS)
#define Yap_InitSlots(n, ts) Yap_InitSlots__(n, ts PASS_REGS)
/// @brief create n new slots with terms ts[]
static inline yhandle_t
Yap_InitSlots__(int n, Term *ts USES_REGS)
{
static inline yhandle_t Yap_InitSlots__(int n, Term *ts USES_REGS) {
yhandle_t old_slots = LOCAL_CurSlot;
int i;
// fprintf(stderr,"1S %s:%d\n", __FUNCTION__, __LINE__);
ensure_slots( n PASS_REGS);
for (i=0; i< n; i++)
LOCAL_SlotBase[old_slots+i] = ts[i];
ensure_slots(n PASS_REGS);
for (i = 0; i < n; i++)
LOCAL_SlotBase[old_slots + i] = ts[i];
LOCAL_CurSlot += n;
return old_slots;
}
/// @brief Succeeds if it is to recover the space allocated for $n$ contiguos slots starting at topSlot.
static inline bool
Yap_RecoverSlots(int n, yhandle_t topSlot USES_REGS)
{
/// @brief Succeeds if it is to recover the space allocated for $n$ contiguos
/// slots starting at topSlot.
static inline bool Yap_RecoverSlots(int n, yhandle_t topSlot USES_REGS) {
if (topSlot + n < LOCAL_CurSlot)
return false;
// fprintf(stderr,"RS %s:%d\n", __FUNCTION__, __LINE__);
#ifdef DEBUG
// fprintf(stderr,"RS %s:%d\n", __FUNCTION__, __LINE__);
#ifdef DEBUG
if (topSlot + n > LOCAL_CurSlot) {
Yap_Error(SYSTEM_ERROR, 0 /* TermNil */, "Inconsistent slot state in Yap_RecoverSlots.");
Yap_Error(SYSTEM_ERROR_INTERNAL, 0 , "Inconsistent slot state in Yap_RecoverSlots.", 0);
return false;
}
#endif
#endif
return true;
}

View File

@ -170,8 +170,6 @@ void Yap_RestartYap(int);
void Yap_exit(int);
bool Yap_Warning( const char *s, ... );
bool Yap_PrintWarning( Term t );
yamop *Yap_Error(yap_error_number,Term,const char *msg, ...);
yamop *Yap_NilError(yap_error_number,const char *msg, ...);
int Yap_HandleError( const char *msg, ... );
int Yap_SWIHandleError( const char *, ... );
@ -288,6 +286,7 @@ void Yap_InitIOPreds(void);
extern void Yap_DebugPlWrite (Term t);
extern void Yap_DebugErrorPutc (int n);
extern void Yap_DebugErrorPuts (const char *s);
extern void Yap_DebugWriteIndicator( struct pred_entry *ap );
#endif
void Yap_PlWriteToStream(Term, int, int);
/* depth_lim.c */
@ -364,7 +363,10 @@ void Yap_InitSockets (void);
void Yap_InitSortPreds(void);
/* stack.c */
void Yap_InitStInfo(void);
void Yap_InitStInfo(void);
void Yap_dump_stack( void );
void Yap_detect_bug_location(yamop *yap_pc, int where_from, char *tp, int psize);
#if !defined(YAPOR) && !defined(THREADS)
bool Yap_search_for_static_predicate_in_use(struct pred_entry *, bool);
#endif

View File

@ -473,9 +473,7 @@ Term Yap_LUInstance(LogUpdClause *, UInt);
int Yap_new_udi_clause(PredEntry *, yamop *, Term);
yamop *Yap_udi_search(PredEntry *);
#ifdef DEBUG
void Yap_bug_location(yamop *);
#endif
Term Yap_bug_location(yamop *codeptr, choiceptr b_ptr, CELL *env);
#if LOW_PROF
void Yap_InformOfRemoval(void *);

View File

@ -243,7 +243,7 @@
AtomOn = Yap_LookupAtom("on");
AtomOnline = Yap_LookupAtom("online");
AtomOpen = Yap_LookupAtom("open");
AtomOperatingSystemError = Yap_LookupAtom("operating_system_error");
AtomOperatingSystemError = Yap_LookupAtom("operating_SYSTEM_ERROR_INTERNAL");
AtomOperatingSystemSupport = Yap_LookupAtom("operating_system_support");
AtomOperator = Yap_LookupAtom("operator");
AtomOperatorPriority = Yap_LookupAtom("operator_priority");
@ -356,7 +356,7 @@
AtomSyntaxErrors = Yap_LookupAtom("syntax_errors");
AtomSyntaxErrorHandler = Yap_LookupAtom("syntax_error_handler");
AtomSystem = Yap_LookupAtom("system");
AtomSystemError = Yap_LookupAtom("system_error");
AtomSystemError = Yap_LookupAtom("SYSTEM_ERROR_INTERNAL");
AtomSystemLibraryDir = Yap_LookupAtom("system_library_directory");
AtomTerm = Yap_LookupAtom("term");
AtomTerms = Yap_LookupAtom("terms");

View File

@ -617,7 +617,7 @@
YAP_AtomToInt(Yap_LookupAtom("syntax_error"));
YAP_AtomToInt(Yap_LookupAtom("syntax_errors"));
YAP_AtomToInt(Yap_LookupAtom("system"));
YAP_AtomToInt(Yap_LookupAtom("system_error"));
YAP_AtomToInt(Yap_LookupAtom("SYSTEM_ERROR_INTERNAL"));
YAP_AtomToInt(Yap_LookupAtom("system_init_file"));
YAP_AtomToInt(Yap_LookupAtom("system_thread_id"));
YAP_AtomToInt(Yap_LookupAtom("system_time"));

View File

@ -409,7 +409,7 @@ AdjustSwitchTable__(op_numbers op, yamop *table, COUNT i USES_REGS)
}
break;
default:
Yap_Error(INTERNAL_ERROR,0L,"Opcode Not Implemented in AdjustSwitchTable");
Yap_Error(SYSTEM_ERROR_INTERNAL,0L,"Opcode Not Implemented in AdjustSwitchTable");
}
}
@ -759,7 +759,7 @@ RestorePredHash__( USES_REGS1 )
{
PredHash = PtoPtoPredAdjust(PredHash);
if (PredHash == NULL) {
Yap_Error(FATAL_ERROR,MkIntTerm(0),"restore should find predicate hash table");
Yap_Error(SYSTEM_ERROR_FATAL,MkIntTerm(0),"restore should find predicate hash table");
}
REINIT_RWLOCK(PredHashRWLock);
RestoreHashPreds( PASS_REGS1 ); /* does most of the work */
@ -1634,7 +1634,7 @@ RestoreEntries(PropEntry *pp, int int_key USES_REGS)
break;
default:
/* OOPS */
Yap_Error(SYSTEM_ERROR, TermNil,
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil,
"Invalid Atom Property %d at %p", pp->KindOfPE, pp);
return;
}

View File

@ -58,7 +58,7 @@
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/RegionPrinter.h"
#include "llvm/Support/MemoryBuffer.h"
//#include "llvm/Support/system_error.h"
//#include "llvm/Support/SYSTEM_ERROR_INTERNAL.h"
#include "llvm/Support/Process.h"
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/Transforms/IPO.h"

View File

@ -1257,7 +1257,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \

View File

@ -1290,7 +1290,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \

View File

@ -180,7 +180,7 @@
if (pt1+d1 > ENV || pt1+d1 > (CELL *)B) { \
saveregs(); \
if (!Yap_gcl((1+d1)*sizeof(CELL), 3, YREG, NEXTOP(NEXTOP((*_PREG),e),Osbmp))) { \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
JMPNext(); \
break; \
@ -259,7 +259,7 @@
if (pt1+d1 > ENV || pt1+d1 > (CELL *)B) { \
saveregs(); \
if (!Yap_gcl((1+d1)*sizeof(CELL), 3, YREG, NEXTOP(NEXTOP((*_PREG),e),Osbmp))) { \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
JMPNext(); \
break; \
@ -345,7 +345,7 @@
if (pt1+d1 > ENV || pt1+d1 > (CELL *)B) { \
saveregs(); \
if (!Yap_gcl((1+d1)*sizeof(CELL), 3, YREG, NEXTOP(NEXTOP((*_PREG),e),Osbmp))) { \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
JMPNext(); \
break; \
@ -424,7 +424,7 @@
if (pt1+d1 > ENV || pt1+d1 > (CELL *)B) { \
saveregs(); \
if (!Yap_gcl((1+d1)*sizeof(CELL), 3, YREG, NEXTOP(NEXTOP((*_PREG),e),Osbmp))) { \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
JMPNext(); \
break; \
@ -744,7 +744,7 @@
if (pt1+d1 > ENV || pt1+d1 > (CELL *)B) { \
saveregs(); \
if (!Yap_gcl((1+d1)*sizeof(CELL), 3, YREG, NEXTOP(NEXTOP((*_PREG),e),Osbmp))) { \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
JMPNext(); \
break; \
@ -823,7 +823,7 @@
if (pt1+d1 > ENV || pt1+d1 > (CELL *)B) { \
saveregs(); \
if (!Yap_gcl((1+d1)*sizeof(CELL), 3, YREG, NEXTOP(NEXTOP((*_PREG),e),Osbmp))) { \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
JMPNext(); \
break; \
@ -909,7 +909,7 @@
if (pt1+d1 > ENV || pt1+d1 > (CELL *)B) { \
saveregs(); \
if (!Yap_gcl((1+d1)*sizeof(CELL), 3, YREG, NEXTOP(NEXTOP((*_PREG),e),Osbmp))) { \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
JMPNext(); \
break; \
@ -988,7 +988,7 @@
if (pt1+d1 > ENV || pt1+d1 > (CELL *)B) { \
saveregs(); \
if (!Yap_gcl((1+d1)*sizeof(CELL), 3, YREG, NEXTOP(NEXTOP((*_PREG),e),Osbmp))) { \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
JMPNext(); \
break; \

View File

@ -71,12 +71,12 @@
SET_ASP(YREG, E_CB*sizeof(CELL)); \
saveregs(); \
while ((t = Yap_FetchTermFromDB(cl->ClSource)) == 0L) { \
if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) { \
if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) { \
LOCAL_Error_TYPE = YAP_NO_ERROR; \
if (!Yap_growglobal(NULL)) { \
UNLOCKPE(3,PP); \
PP = NULL; \
Yap_NilError(OUT_OF_ATTVARS_ERROR, LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, LOCAL_ErrorMessage); \
YAAM_FAIL; \
break; \
} \
@ -85,7 +85,7 @@
if (!Yap_gc(3, ENV, CP)) { \
UNLOCKPE(4,PP); \
PP = NULL; \
Yap_NilError(OUT_OF_STACK_ERROR, LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK, LOCAL_ErrorMessage); \
YAAM_FAIL; \
break; \
} \
@ -125,12 +125,12 @@
SET_ASP(YREG, E_CB*sizeof(CELL)); \
saveregs(); \
while ((t = Yap_FetchTermFromDB(cl->ClSource)) == 0L) { \
if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) { \
if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) { \
LOCAL_Error_TYPE = YAP_NO_ERROR; \
if (!Yap_growglobal(NULL)) { \
UNLOCKPE(3,PP); \
PP = NULL; \
Yap_NilError(OUT_OF_ATTVARS_ERROR, LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, LOCAL_ErrorMessage); \
YAAM_FAIL; \
break; \
} \
@ -139,7 +139,7 @@
if (!Yap_gc(3, ENV, CP)) { \
UNLOCKPE(4,PP); \
PP = NULL; \
Yap_NilError(OUT_OF_STACK_ERROR, LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK, LOCAL_ErrorMessage); \
YAAM_FAIL; tofail = 1; \
break; \
} \
@ -180,12 +180,12 @@
SET_ASP(YREG, E_CB*sizeof(CELL)); \
saveregs(); \
while ((t = Yap_FetchTermFromDB(cl->ClSource)) == 0L) { \
if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) { \
if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) { \
LOCAL_Error_TYPE = YAP_NO_ERROR; \
if (!Yap_growglobal(NULL)) { \
UNLOCKPE(3,PP); \
PP = NULL; \
Yap_NilError(OUT_OF_ATTVARS_ERROR, LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, LOCAL_ErrorMessage); \
YAAM_FAIL; \
break; \
} \
@ -194,7 +194,7 @@
if (!Yap_gc(3, ENV, CP)) { \
UNLOCKPE(4,PP); \
PP = NULL; \
Yap_NilError(OUT_OF_STACK_ERROR, LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK, LOCAL_ErrorMessage); \
YAAM_FAIL; \
break; \
} \
@ -234,12 +234,12 @@
SET_ASP(YREG, E_CB*sizeof(CELL)); \
saveregs(); \
while ((t = Yap_FetchTermFromDB(cl->ClSource)) == 0L) { \
if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) { \
if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) { \
LOCAL_Error_TYPE = YAP_NO_ERROR; \
if (!Yap_growglobal(NULL)) { \
UNLOCKPE(3,PP); \
PP = NULL; \
Yap_NilError(OUT_OF_ATTVARS_ERROR, LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, LOCAL_ErrorMessage); \
YAAM_FAIL; \
break; \
} \
@ -248,7 +248,7 @@
if (!Yap_gc(3, ENV, CP)) { \
UNLOCKPE(4,PP); \
PP = NULL; \
Yap_NilError(OUT_OF_STACK_ERROR, LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK, LOCAL_ErrorMessage); \
YAAM_FAIL; \
break; \
} \
@ -291,11 +291,11 @@
SET_ASP(YREG, E_CB*sizeof(CELL)); \
saveregs(); \
while ((t = Yap_FetchTermFromDB(cl->ClSource)) == 0L) { \
if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) { \
if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) { \
LOCAL_Error_TYPE = YAP_NO_ERROR; \
if (!Yap_growglobal(NULL)) { \
UNLOCKPE(3,PP); \
Yap_NilError(OUT_OF_ATTVARS_ERROR, LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, LOCAL_ErrorMessage); \
YAAM_FAIL; \
break; \
} \
@ -303,7 +303,7 @@
LOCAL_Error_TYPE = YAP_NO_ERROR; \
if (!Yap_gc(3, ENV, CP)) { \
UNLOCKPE(4,PP); \
Yap_NilError(OUT_OF_STACK_ERROR, LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK, LOCAL_ErrorMessage); \
YAAM_FAIL; \
break; \
} \
@ -341,11 +341,11 @@
SET_ASP(YREG, E_CB*sizeof(CELL)); \
saveregs(); \
while ((t = Yap_FetchTermFromDB(cl->ClSource)) == 0L) { \
if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) { \
if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) { \
LOCAL_Error_TYPE = YAP_NO_ERROR; \
if (!Yap_growglobal(NULL)) { \
UNLOCKPE(3,PP); \
Yap_NilError(OUT_OF_ATTVARS_ERROR, LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, LOCAL_ErrorMessage); \
YAAM_FAIL; \
break; \
} \
@ -353,7 +353,7 @@
LOCAL_Error_TYPE = YAP_NO_ERROR; \
if (!Yap_gc(3, ENV, CP)) { \
UNLOCKPE(4,PP); \
Yap_NilError(OUT_OF_STACK_ERROR, LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK, LOCAL_ErrorMessage); \
YAAM_FAIL; \
break; \
} \
@ -392,11 +392,11 @@
SET_ASP(YREG, E_CB*sizeof(CELL)); \
saveregs(); \
while ((t = Yap_FetchTermFromDB(cl->ClSource)) == 0L) { \
if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) { \
if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) { \
LOCAL_Error_TYPE = YAP_NO_ERROR; \
if (!Yap_growglobal(NULL)) { \
UNLOCKPE(3,PP); \
Yap_NilError(OUT_OF_ATTVARS_ERROR, LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, LOCAL_ErrorMessage); \
YAAM_FAIL; \
break; \
} \
@ -404,7 +404,7 @@
LOCAL_Error_TYPE = YAP_NO_ERROR; \
if (!Yap_gc(3, ENV, CP)) { \
UNLOCKPE(4,PP); \
Yap_NilError(OUT_OF_STACK_ERROR, LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK, LOCAL_ErrorMessage); \
YAAM_FAIL; \
break; \
} \
@ -442,11 +442,11 @@
SET_ASP(YREG, E_CB*sizeof(CELL)); \
saveregs(); \
while ((t = Yap_FetchTermFromDB(cl->ClSource)) == 0L) { \
if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) { \
if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) { \
LOCAL_Error_TYPE = YAP_NO_ERROR; \
if (!Yap_growglobal(NULL)) { \
UNLOCKPE(3,PP); \
Yap_NilError(OUT_OF_ATTVARS_ERROR, LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, LOCAL_ErrorMessage); \
YAAM_FAIL; \
break; \
} \
@ -454,7 +454,7 @@
LOCAL_Error_TYPE = YAP_NO_ERROR; \
if (!Yap_gc(3, ENV, CP)) { \
UNLOCKPE(4,PP); \
Yap_NilError(OUT_OF_STACK_ERROR, LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK, LOCAL_ErrorMessage); \
YAAM_FAIL; \
break; \
} \
@ -557,7 +557,7 @@
saveregs();
#define ENSURE_SPACE_SECONDIFOK \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
FAIL();

View File

@ -3671,7 +3671,7 @@
if (pt1+d1 > ENV || pt1+d1 > (CELL *)B) { \
saveregs(); \
if (!Yap_gcl((1+d1)*sizeof(CELL), 3, YREG, NEXTOP(NEXTOP((*_PREG),e),Osbmp))) { \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
BACK(); \
} else { \
@ -3824,7 +3824,7 @@
if (pt1+d1 > ENV || pt1+d1 > (CELL *)B) { \
saveregs(); \
if (!Yap_gcl((1+d1)*sizeof(CELL), 3, YREG, NEXTOP(NEXTOP((*_PREG),e),Osbmp))) { \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
BACK(); \
} else { \

View File

@ -357,7 +357,7 @@
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -386,7 +386,7 @@
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
ENV = B->cp_env;
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -425,7 +425,7 @@
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) {
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -472,7 +472,7 @@
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0) {
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -510,7 +510,7 @@
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0) {
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -557,7 +557,7 @@
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0) {
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -745,14 +745,14 @@
SET_ASP(YREG, E_CB*sizeof(CELL));
saveregs();
while ((t = Yap_FetchTermFromDB(cl->ClSource)) == 0L) {
if (LOCAL_Error_TYPE == OUT_OF_ATTVARS_ERROR) {
if (LOCAL_Error_TYPE == RESOURCE_ERROR_ATTRIBUTED_VARIABLES) {
LOCAL_Error_TYPE = YAP_NO_ERROR;
if (!Yap_growglobal(NULL)) {
UNLOCKPE(3,PP);
#if defined(YAPOR) || defined(THREADS)
PP = NULL;
#endif
Yap_NilError(OUT_OF_ATTVARS_ERROR, LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, LOCAL_ErrorMessage);
TRACED_FAIL();
}
} else {
@ -762,7 +762,7 @@
#if defined(YAPOR) || defined(THREADS)
PP = NULL;
#endif
Yap_NilError(OUT_OF_STACK_ERROR, LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK, LOCAL_ErrorMessage);
TRACED_FAIL();
}
}
@ -886,7 +886,7 @@
PREG = NEXTOP(PREG,Osbpa);
saveregs();
if (!Yap_gcl(sz, arity, YENV, PREG)) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
TRACED_FAIL();
} else {
@ -993,7 +993,7 @@
LOCAL_PredEntriesCounter--;
if (LOCAL_PredEntriesCounter == 0) {
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -7159,7 +7159,7 @@
///#endif
UNLOCKPE(21,pe);
saveregs();
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,"");
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,"");
setregs();
JMPNext();
}
@ -12854,7 +12854,7 @@
///#ifdef PROFILED_ABSMI
EMIT_SIMPLE_BLOCK(P_FUNC2S_VV_SECONDIFOK_FIRSTIFOK_IFOK);
///#endif
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -13035,7 +13035,7 @@
///#ifdef PROFILED_ABSMI
EMIT_SIMPLE_BLOCK(P_FUNC2S_CV_D1GREATER_IFOK_IFOK);
///#endif
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -13200,7 +13200,7 @@
///#ifdef PROFILED_ABSMI
EMIT_SIMPLE_BLOCK(P_FUNC2S_VC_IFOK_IFOK);
///#endif
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -13368,7 +13368,7 @@
///#ifdef PROFILED_ABSMI
EMIT_SIMPLE_BLOCK(P_FUNC2S_Y_VV_D1GREATER_IFOK_IFOK);
///#endif
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -13559,7 +13559,7 @@
///#ifdef PROFILED_ABSMI
EMIT_SIMPLE_BLOCK(P_FUNC2S_Y_CV_D1GREATER_IFOK_IFOK);
///#endif
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -13745,7 +13745,7 @@
///#ifdef PROFILED_ABSMI
EMIT_SIMPLE_BLOCK(P_FUNC2S_Y_VC_IFOK_IFOK);
///#endif
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -14243,7 +14243,7 @@
/* make sure we have something to show for our trouble */
saveregs();
if (!Yap_gcl((1+d1)*sizeof(CELL), 3, YREG, NEXTOP(NEXTOP(PREG,e),Osbmp))) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
setregs();
JMPNext();
} else {
@ -14491,7 +14491,7 @@
}
saveregs_and_ycache();
if (!Yap_gc(((PredEntry *)SREG)->ArityOfPE, ENV, NEXTOP(PREG, Osbpp))) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
}
setregs_and_ycache();
goto traced_execute2_end;
@ -14699,7 +14699,7 @@
}
saveregs_and_ycache();
if (!Yap_gc(((PredEntry *)SREG)->ArityOfPE, ENV, NEXTOP(PREG, Osbmp))) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
}
setregs_and_ycache();
goto traced_execute_end;
@ -14931,7 +14931,7 @@
UNLOCK(LOCAL_SignalLock);
saveregs_and_ycache();
if (!Yap_growheap(FALSE, 0, NULL)) {
Yap_NilError(OUT_OF_HEAP_ERROR, "YAP failed to grow heap: %s", LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_HEAP, "YAP failed to grow heap: %s", LOCAL_ErrorMessage);
setregs_and_ycache();
TRACED_FAIL();
}
@ -14951,7 +14951,7 @@
#endif
saveregs_and_ycache();
if(!Yap_growtrail (0, FALSE)) {
Yap_NilError(OUT_OF_TRAIL_ERROR,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * K16);
Yap_NilError(RESOURCE_ERROR_TRAIL,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * K16);
setregs_and_ycache();
TRACED_FAIL();
}
@ -14975,7 +14975,7 @@
UNLOCK(LOCAL_SignalLock);
saveregs_and_ycache();
if (!Yap_gc(((PredEntry *)SREG)->ArityOfPE, ENV, NEXTOP(PREG, Osbpp))) {
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage);
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage);
}
setregs_and_ycache();
goto traced_execute_after_comma;

View File

@ -15,7 +15,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -44,7 +44,7 @@
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) { \
ENV = B->cp_env; \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -78,7 +78,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
}
@ -100,7 +100,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
}
@ -141,7 +141,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
}
@ -170,7 +170,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
}
@ -196,7 +196,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
}
@ -219,7 +219,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
}
@ -258,7 +258,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -297,7 +297,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -337,7 +337,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -375,7 +375,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -418,7 +418,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -489,7 +489,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -561,7 +561,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -626,7 +626,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -695,7 +695,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -769,7 +769,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -844,7 +844,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -912,7 +912,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -983,7 +983,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -1056,7 +1056,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -1130,7 +1130,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -1197,7 +1197,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \

View File

@ -16,7 +16,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -46,7 +46,7 @@
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) { \
ENV = B->cp_env; \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -81,7 +81,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
}
@ -103,7 +103,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0 && LOCAL_PredEntriesCounterOn) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
}
@ -145,7 +145,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
}
@ -174,7 +174,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
}
@ -200,7 +200,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
}
@ -223,7 +223,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
}
@ -263,7 +263,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -303,7 +303,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -344,7 +344,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -383,7 +383,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -427,7 +427,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -499,7 +499,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -572,7 +572,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -638,7 +638,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -708,7 +708,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -783,7 +783,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -859,7 +859,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -928,7 +928,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -1000,7 +1000,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -1074,7 +1074,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -1149,7 +1149,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \
@ -1217,7 +1217,7 @@
LOCAL_PredEntriesCounter--; \
if (LOCAL_PredEntriesCounter == 0) { \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext(); \
} \

View File

@ -1174,7 +1174,7 @@
#define SPY_PRED_SECONDIFOK_SECONDIFOK \
UNLOCKPE(21,pe); \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext();

View File

@ -1213,7 +1213,7 @@
#define SPY_PRED_SECONDIFOK_SECONDIFOK \
UNLOCKPE(21,pe); \
saveregs(); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW,""); \
Yap_NilError(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT,""); \
setregs(); \
JMPNext();

View File

@ -2390,7 +2390,7 @@
saveregs();
#define P_FUNC2S_VV_SECONDIFOK_FIRSTIFOK_IFOK \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
JMPNext();
@ -2489,7 +2489,7 @@
saveregs();
#define P_FUNC2S_CV_D1GREATER_IFOK_IFOK \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
JMPNext();
@ -2583,7 +2583,7 @@
saveregs();
#define P_FUNC2S_VC_IFOK_IFOK \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
JMPNext();
@ -2674,7 +2674,7 @@
saveregs();
#define P_FUNC2S_Y_VV_D1GREATER_IFOK_IFOK \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
JMPNext();
@ -2776,7 +2776,7 @@
saveregs();
#define P_FUNC2S_Y_CV_D1GREATER_IFOK_IFOK \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
JMPNext();
@ -2880,7 +2880,7 @@
saveregs();
#define P_FUNC2S_Y_VC_IFOK_IFOK \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
JMPNext();

View File

@ -2457,7 +2457,7 @@
saveregs();
#define P_FUNC2S_VV_SECONDIFOK_FIRSTIFOK_IFOK \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
JMPNext();
@ -2557,7 +2557,7 @@
saveregs();
#define P_FUNC2S_CV_D1GREATER_IFOK_IFOK \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
JMPNext();
@ -2652,7 +2652,7 @@
saveregs();
#define P_FUNC2S_VC_IFOK_IFOK \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
JMPNext();
@ -2744,7 +2744,7 @@
saveregs();
#define P_FUNC2S_Y_VV_D1GREATER_IFOK_IFOK \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
JMPNext();
@ -2847,7 +2847,7 @@
saveregs();
#define P_FUNC2S_Y_CV_D1GREATER_IFOK_IFOK \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
JMPNext();
@ -2952,7 +2952,7 @@
saveregs();
#define P_FUNC2S_Y_VC_IFOK_IFOK \
Yap_NilError(OUT_OF_STACK_ERROR,LOCAL_ErrorMessage); \
Yap_NilError(RESOURCE_ERROR_STACK,LOCAL_ErrorMessage); \
setregs(); \
JMPNext();

View File

@ -225,7 +225,7 @@ CACHE_A1();
cut_b = LCL0-(CELL *)(ASP[E_CB]);
saveregs();
if(!Yap_growtrail (0, false)) {
Yap_NilError(OUT_OF_TRAIL_ERROR,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * K16);
Yap_NilError(RESOURCE_ERROR_TRAIL,"YAP failed to reserve %ld bytes in growtrail",sizeof(CELL) * K16);
setregs();
FAIL();
}
@ -255,7 +255,7 @@ CACHE_A1();
#if _NATIVE
default:
saveregs();
Yap_Error(SYSTEM_ERROR, MkIntegerTerm(opcode), "trying to execute invalid YAAM instruction %d", opcode);
Yap_Error(SYSTEM_ERROR_INTERNAL, MkIntegerTerm(opcode), "trying to execute invalid YAAM instruction %d", opcode);
setregs();
FAIL();
}

View File

@ -56,7 +56,7 @@ extern size_t Yap_page_size;
*******************************************************************************************/
#define ALLOC_BLOCK(STR, SIZE, STR_TYPE) \
if ((STR = (STR_TYPE *) malloc(SIZE)) == NULL) \
Yap_Error(FATAL_ERROR, TermNil, "ALLOC_BLOCK: malloc error")
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "ALLOC_BLOCK: malloc error")
#define FREE_BLOCK(STR) \
free(STR)
#else
@ -70,7 +70,7 @@ extern size_t Yap_page_size;
else if ((block_ptr = (char *) malloc(SIZE + sizeof(CELL))) != NULL) \
*block_ptr = 'm'; \
else \
Yap_Error(FATAL_ERROR, TermNil, "ALLOC_BLOCK: malloc error"); \
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "ALLOC_BLOCK: malloc error"); \
block_ptr += sizeof(CELL); \
STR = (STR_TYPE *) block_ptr; \
}
@ -244,11 +244,11 @@ extern size_t Yap_page_size;
int shmid; \
void *mem_block; \
if ((shmid = shmget(IPC_PRIVATE, SHMMAX, SHM_R|SHM_W)) == -1) \
Yap_Error(FATAL_ERROR, TermNil, "shmget error (ALLOC_PAGE)"); \
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "shmget error (ALLOC_PAGE)"); \
if ((mem_block = shmat(shmid, NULL, 0)) == (void *) -1) \
Yap_Error(FATAL_ERROR, TermNil, "shmat error (ALLOC_PAGE)"); \
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "shmat error (ALLOC_PAGE)"); \
if (shmctl(shmid, IPC_RMID, 0) != 0) \
Yap_Error(FATAL_ERROR, TermNil, "shmctl error (ALLOC_PAGE)"); \
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "shmctl error (ALLOC_PAGE)"); \
PgEnt_first(GLOBAL_pages_alloc) = (pg_hd_ptr)(mem_block + Yap_page_size); \
PgEnt_last(GLOBAL_pages_alloc) = (pg_hd_ptr)(mem_block + SHMMAX); \
UPDATE_STATS(PgEnt_pages_in_use(GLOBAL_pages_alloc), SHMMAX / Yap_page_size); \
@ -265,9 +265,9 @@ extern size_t Yap_page_size;
else \
sg_fr = GLOBAL_first_sg_fr; \
if (sg_fr == NULL) \
Yap_Error(FATAL_ERROR, TermNil, "no space left (RECOVER_SPACE)"); \
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "no space left (RECOVER_SPACE)"); \
/* see function 'InteractSIGINT' in file 'sysbits.c' */ \
/* Yap_Error(PURE_ABORT, TermNil, ""); */ \
/* Yap_Error(PURE_ABORT_EVENT, TermNil, ""); */ \
/* restore_absmi_regs(&Yap_standard_regs); */ \
/* siglongjmp (LOCAL_RestartEnv, 1); */ \
if (SgFr_first_answer(sg_fr) && \
@ -518,10 +518,10 @@ extern size_t Yap_page_size;
#ifdef YAPOR
#define ERROR_MESSAGE(MESSAGE) \
Yap_Error(INTERNAL_ERROR, TermNil, "W%d - " MESSAGE, worker_id)
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "W%d - " MESSAGE, worker_id)
#else
#define ERROR_MESSAGE(MESSAGE) \
Yap_Error(INTERNAL_ERROR, TermNil, MESSAGE)
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, MESSAGE)
#endif /* YAPOR */
#ifdef DEBUG_TABLING

View File

@ -312,7 +312,7 @@ static Int p_table( USES_REGS1 ) {
return (FALSE);
if (list != TermNil) { /* non-empty list */
#ifndef MODE_DIRECTED_TABLING
Yap_Error(INTERNAL_COMPILER_ERROR, TermNil, "invalid tabling declaration for %s/%d (mode directed tabling not enabled)", AtomName(at), arity);
Yap_Error(SYSTEM_ERROR_COMPILER, TermNil, "invalid tabling declaration for %s/%d (mode directed tabling not enabled)", AtomName(at), arity);
return(FALSE);
#else
/*************************************************************************************
@ -343,7 +343,7 @@ static Int p_table( USES_REGS1 ) {
else if (mode == MODE_DIRECTED_SUM || mode == MODE_DIRECTED_LAST) {
if (pos_sum_last) {
free(aux_mode_directed);
Yap_Error(INTERNAL_COMPILER_ERROR, TermNil, "invalid tabling declaration for %s/%d (more than one argument with modes 'sum' and/or 'last')", AtomName(at), arity);
Yap_Error(SYSTEM_ERROR_COMPILER, TermNil, "invalid tabling declaration for %s/%d (more than one argument with modes 'sum' and/or 'last')", AtomName(at), arity);
return(FALSE);
} else
pos_sum_last = 1;

View File

@ -568,7 +568,7 @@ void share_private_nodes(int worker_q) {
/* update depth */
if (depth >= MAX_BRANCH_DEPTH)
Yap_Error(INTERNAL_ERROR, TermNil, "maximum depth exceded (share_private_nodes)");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "maximum depth exceded (share_private_nodes)");
or_frame = B->cp_or_fr;
#ifdef TABLING
previous_or_frame = LOCAL_top_cp_on_stack->cp_or_fr;

View File

@ -197,7 +197,7 @@ void share_private_nodes(int worker_q) {
}
/* update depth */
if (depth >= MAX_BRANCH_DEPTH)
Yap_Error(INTERNAL_ERROR, TermNil, "maximum depth exceded (share_private_nodes)");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "maximum depth exceded (share_private_nodes)");
or_frame = B->cp_or_fr;
while (or_frame != LOCAL_top_or_fr) {
unsigned int branch;

View File

@ -66,21 +66,21 @@ void Yap_init_yapor_global_local_memory(void) {
#ifdef MMAP_MEMORY_MAPPING_SCHEME
{ int fd_mapfile;
if (getcwd(mapfile_path,PATH_MAX) == NULL)
Yap_Error(FATAL_ERROR, TermNil, "getcwd error (Yap_init_yapor_global_local_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "getcwd error (Yap_init_yapor_global_local_memory)");
strcat(mapfile_path,"/mapfile");
itos(getpid(), &mapfile_path[strlen(mapfile_path)]);
if (strlen(mapfile_path) >= PATH_MAX)
Yap_Error(FATAL_ERROR, TermNil, "PATH_MAX error (Yap_init_yapor_global_local_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "PATH_MAX error (Yap_init_yapor_global_local_memory)");
if ((fd_mapfile = open(mapfile_path, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0)
Yap_Error(FATAL_ERROR, TermNil, "open error (Yap_init_yapor_global_local_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "open error (Yap_init_yapor_global_local_memory)");
if (lseek(fd_mapfile, GLOBAL_LOCAL_STRUCTS_AREA, SEEK_SET) < 0)
Yap_Error(FATAL_ERROR, TermNil, "lseek error (Yap_init_yapor_global_local_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "lseek error (Yap_init_yapor_global_local_memory)");
if (write(fd_mapfile, "", 1) < 0)
Yap_Error(FATAL_ERROR, TermNil, "write error (Yap_init_yapor_global_local_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "write error (Yap_init_yapor_global_local_memory)");
if (mmap((void *) Yap_local, (size_t) GLOBAL_LOCAL_STRUCTS_AREA, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_FIXED, fd_mapfile, 0) == (void *) -1)
Yap_Error(FATAL_ERROR, TermNil, "mmap error (Yap_init_global_local_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "mmap error (Yap_init_global_local_memory)");
if (close(fd_mapfile) == -1)
Yap_Error(FATAL_ERROR, TermNil, "close error (Yap_init_yapor_global_local_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "close error (Yap_init_yapor_global_local_memory)");
}
#elif defined(SHM_MEMORY_MAPPING_SCHEME)
/* place as segment MAX_WORKERS (0..MAX_WORKERS-1 reserved for worker areas) */
@ -114,15 +114,15 @@ void Yap_init_yapor_stacks_memory(UInt TrailStackArea, UInt HeapStackArea, UInt
/* map stacks in a single go */
{ int fd_mapfile;
if ((fd_mapfile = open(mapfile_path, O_RDWR)) < 0)
Yap_Error(FATAL_ERROR, TermNil, "open error ( Yap_init_yapor_stacks_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "open error ( Yap_init_yapor_stacks_memory)");
if (lseek(fd_mapfile, GLOBAL_LOCAL_STRUCTS_AREA + StacksArea, SEEK_SET) < 0)
Yap_Error(FATAL_ERROR, TermNil, "lseek error (Yap_init_yapor_stacks_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "lseek error (Yap_init_yapor_stacks_memory)");
if (write(fd_mapfile, "", 1) < 0)
Yap_Error(FATAL_ERROR, TermNil, "write error (Yap_init_yapor_stacks_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "write error (Yap_init_yapor_stacks_memory)");
if (mmap((void *) Yap_HeapBase, (size_t) StacksArea, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_FIXED, fd_mapfile, GLOBAL_LOCAL_STRUCTS_AREA) == (void *) -1)
Yap_Error(FATAL_ERROR, TermNil, "mmap error (Yap_init_yapor_stacks_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "mmap error (Yap_init_yapor_stacks_memory)");
if (close(fd_mapfile) == -1)
Yap_Error(FATAL_ERROR, TermNil, "close error (Yap_init_yapor_stacks_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "close error (Yap_init_yapor_stacks_memory)");
}
#elif defined(SHM_MEMORY_MAPPING_SCHEME)
/* place heap stack segment as MAX_WORKERS+1 */
@ -140,10 +140,10 @@ void Yap_init_yapor_stacks_memory(UInt TrailStackArea, UInt HeapStackArea, UInt
/* just allocate local space for stacks */
{ int private_fd_mapfile;
if ((private_fd_mapfile = open("/dev/zero", O_RDWR)) < 0)
Yap_Error(FATAL_ERROR, TermNil, "open error (Yap_init_yapor_stacks_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "open error (Yap_init_yapor_stacks_memory)");
if (mmap(LOCAL_GlobalBase, Yap_worker_area_size, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED, private_fd_mapfile, 0) == (void *) -1)
Yap_Error(FATAL_ERROR, TermNil, "mmap error (Yap_init_yapor_stacks_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "mmap error (Yap_init_yapor_stacks_memory)");
close(private_fd_mapfile);
}
#endif /* YAPOR_COW */
@ -152,9 +152,9 @@ void Yap_init_yapor_stacks_memory(UInt TrailStackArea, UInt HeapStackArea, UInt
/* alloc space for the sparse binding array */
sba_size = Yap_worker_area_size * n_workers;
if ((binding_array = (char *)malloc(sba_size)) == NULL)
Yap_Error(FATAL_ERROR, TermNil, "malloc error (Yap_init_yapor_stacks_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "malloc error (Yap_init_yapor_stacks_memory)");
if ((CELL)binding_array & MBIT)
Yap_Error(INTERNAL_ERROR, TermNil, "binding_array start address conflicts with tag used in IDB (Yap_init_yapor_stacks_memory)");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "binding_array start address conflicts with tag used in IDB (Yap_init_yapor_stacks_memory)");
sba_offset = binding_array - LOCAL_GlobalBase;
sba_end = (int)binding_array + sba_size;
#endif /* YAPOR_SBA */
@ -176,22 +176,22 @@ void Yap_remap_yapor_memory(void) {
int fd_mapfile;
long remap_offset = (ADDR) remap_addr - (ADDR) Yap_local;
if ((fd_mapfile = open(mapfile_path, O_RDWR)) < 0)
Yap_Error(FATAL_ERROR, TermNil, "open error (Yap_remap_yapor_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "open error (Yap_remap_yapor_memory)");
if (munmap(remap_addr, (size_t)(Yap_worker_area_size * GLOBAL_number_workers)) == -1)
Yap_Error(FATAL_ERROR, TermNil, "munmap error (Yap_remap_yapor_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "munmap error (Yap_remap_yapor_memory)");
for (i = 0; i < GLOBAL_number_workers; i++)
if (mmap(remap_addr + worker_offset(i), (size_t)Yap_worker_area_size, PROT_READ|PROT_WRITE,
MAP_SHARED|MAP_FIXED, fd_mapfile, remap_offset + i * Yap_worker_area_size) == (void *) -1)
Yap_Error(FATAL_ERROR, TermNil, "mmap error (Yap_remap_yapor_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "mmap error (Yap_remap_yapor_memory)");
if (close(fd_mapfile) == -1)
Yap_Error(FATAL_ERROR, TermNil, "close error (Yap_remap_yapor_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "close error (Yap_remap_yapor_memory)");
#else /* SHM_MEMORY_MAPPING_SCHEME */
for (i = 0; i < GLOBAL_number_workers; i++)
if (shmdt(remap_addr + Yap_worker_area_size * i) == -1)
Yap_Error(FATAL_ERROR, TermNil, "shmdt error (Yap_remap_yapor_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "shmdt error (Yap_remap_yapor_memory)");
for (i = 0; i < GLOBAL_number_workers; i++)
if(shmat(shm_mapid[i], remap_addr + worker_offset(i), 0) == (void *) -1)
Yap_Error(FATAL_ERROR, TermNil, "shmat error (Yap_remap_yapor_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "shmat error (Yap_remap_yapor_memory)");
#endif /* MEMORY_MAPPING_SCHEME */
#elif defined(YAPOR_SBA)
/* setup workers so that they have different areas */
@ -250,9 +250,9 @@ void Yap_unmap_yapor_memory (void) {
#ifdef SHM_MEMORY_MAPPING_SCHEME
void shm_map_memory(int id, int size, void *shmaddr) {
if ((shm_mapid[id] = shmget(IPC_PRIVATE, size, SHM_R|SHM_W)) == -1)
Yap_Error(FATAL_ERROR, TermNil, "shmget error (shm_map_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "shmget error (shm_map_memory)");
if (shmat(shm_mapid[id], shmaddr, 0) == (void *) -1)
Yap_Error(FATAL_ERROR, TermNil, "shmat error (shm_map_memory)");
Yap_Error(SYSTEM_ERROR_FATAL, TermNil, "shmat error (shm_map_memory)");
return;
}

View File

@ -262,7 +262,7 @@ void share_private_nodes(int worker_q) {
}
/* update depth */
if (depth >= MAX_BRANCH_DEPTH)
Yap_Error(INTERNAL_ERROR, TermNil, "maximum depth exceded (share_private_nodes)");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "maximum depth exceded (share_private_nodes)");
or_frame = B->cp_or_fr;
while (or_frame != LOCAL_top_or_fr) {

View File

@ -432,7 +432,7 @@ void share_private_nodes(int worker_q) {
/* update depth */
if (depth >= MAX_BRANCH_DEPTH)
Yap_Error(INTERNAL_ERROR, TermNil, "maximum depth exceded (share_private_nodes)");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "maximum depth exceded (share_private_nodes)");
or_frame = B->cp_or_fr;
#ifdef TABLING
previous_or_frame = Get_LOCAL_top_cp_on_stack()->cp_or_fr;

View File

@ -235,7 +235,7 @@ typedef enum {
#if defined(YAPOR_COPY) || defined(YAPOR_COW) || defined(YAPOR_SBA)
#define AUX_STACK_CHECK_EXPAND(STACK, STACK_LIMIT) \
if ((STACK_LIMIT) >= (STACK)) \
Yap_Error(INTERNAL_ERROR, TermNil, "stack full (AUX_STACK_CHECK_EXPAND)")
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "stack full (AUX_STACK_CHECK_EXPAND)")
#else /* YAPOR_THREADS */
#define AUX_STACK_CHECK_EXPAND(STACK, STACK_LIMIT) \
if ((STACK_LIMIT) >= (STACK)) \
@ -243,7 +243,7 @@ typedef enum {
#endif /* YAPOR */
#define STACK_CHECK_EXPAND(STACK, STACK_LIMIT) \
if ((STACK_LIMIT) >= (STACK) + 4096) \
Yap_Error(INTERNAL_ERROR, TermNil, "stack full (STACK_CHECK_EXPAND)")
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "stack full (STACK_CHECK_EXPAND)")
@ -1238,7 +1238,7 @@ static inline CELL *__expand_auxiliary_stack(CELL *stack USES_REGS) {
char *old_top = (char *)LOCAL_TrailTop;
INFORMATION_MESSAGE("Expanding trail in " UInt_FORMAT " bytes", K64);
if (! Yap_growtrail(K64, TRUE)) { /* TRUE means 'contiguous_only' */
Yap_Error(OUT_OF_TRAIL_ERROR, TermNil, "stack full (STACK_CHECK_EXPAND)");
Yap_Error(RESOURCE_ERROR_TRAIL, TermNil, "stack full (STACK_CHECK_EXPAND)");
return NULL;
} else {
UInt diff = (char *)LOCAL_TrailTop - old_top;
@ -1399,7 +1399,7 @@ static inline void __abolish_incomplete_subgoals(choiceptr prune_cp USES_REGS) {
#ifdef YAPOR
static inline void pruning_over_tabling_data_structures(void) {
Yap_Error(INTERNAL_ERROR, TermNil, "pruning over tabling data structures");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "pruning over tabling data structures");
return;
}

View File

@ -32,11 +32,11 @@ void term_array_init(term_array *array, int capacity) {
if (array->terms != NULL) {
array->capacity = capacity;
} else
Yap_Error(RESOURCE_ERROR_MEMORY, TermNil, "Out of memory."); // Handle out-of-memory
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, "Out of memory."); // Handle out-of-memory
array->capacity = capacity;
array->nodes = malloc(capacity * sizeof(void*));
if (array->nodes == NULL)
Yap_Error(RESOURCE_ERROR_MEMORY, TermNil, "Out of memory."); // Handle out-of-memory
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, "Out of memory."); // Handle out-of-memory
}
void term_array_free(term_array *array) {
@ -55,12 +55,12 @@ void term_array_push(term_array *array, void* t, void* n) {
if (new_terms != NULL) {
array->terms = new_terms;
} else
Yap_Error(RESOURCE_ERROR_MEMORY, TermNil, "Out of memory."); // Handle out-of-memory
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, "Out of memory."); // Handle out-of-memory
void *new_nodes = realloc(array->nodes, new_capacity * sizeof(void *));
if (new_nodes != NULL) {
array->nodes = new_nodes;
} else
Yap_Error(RESOURCE_ERROR_MEMORY, TermNil, "Out of memory."); // Handle out-of-memory
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, "Out of memory."); // Handle out-of-memory
array->capacity = new_capacity;
}
array->terms[array->length] = t;

View File

@ -1263,7 +1263,7 @@ ans_node_ptr mode_directed_answer_search(sg_fr_ptr sg_fr, CELL *subs_ptr) {
} else if (mode == MODE_DIRECTED_FIRST) {
current_ans_node = NULL;
} else
Yap_Error(INTERNAL_ERROR, TermNil, "mode_directed_answer_search: unknown mode");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "mode_directed_answer_search: unknown mode");
UNLOCK_ANSWER_NODE(current_ans_node);
}
n_subs--;
@ -1679,7 +1679,7 @@ void showTable(tab_ent_ptr tab_ent, int show_mode, FILE *out) {
} else if (mode == MODE_DIRECTED_FIRST) {
fprintf(TrStat_out, "first");
} else
Yap_Error(INTERNAL_ERROR, TermNil, "show_table: unknown mode");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "show_table: unknown mode");
if (i != MODE_DIRECTED_GET_ARG(mode_directed[i]))
fprintf(TrStat_out, "(ARG%d)", MODE_DIRECTED_GET_ARG(mode_directed[i]) + 1);
if (i + 1 != TabEnt_arity(tab_ent))

View File

@ -1062,7 +1062,7 @@ static inline sg_node_ptr subgoal_search_loop(tab_ent_ptr tab_ent, sg_node_ptr c
SUBGOAL_CHECK_INSERT_ENTRY(tab_ent, current_node, t);
} else {
if (subs_arity == MAX_TABLE_VARS)
Yap_Error(INTERNAL_ERROR, TermNil, "subgoal_search_loop: MAX_TABLE_VARS exceeded");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "subgoal_search_loop: MAX_TABLE_VARS exceeded");
STACK_PUSH_UP(t, stack_vars);
*((CELL *)t) = GLOBAL_table_var_enumerator(subs_arity);
t = MakeTableVarTerm(subs_arity);
@ -1230,7 +1230,7 @@ static inline sg_node_ptr subgoal_search_loop(tab_ent_ptr tab_ent, sg_node_ptr c
SUBGOAL_CHECK_INSERT_ENTRY(tab_ent, current_node, AbsAppl((Term *)f));
#endif /* MODE_GLOBAL_TRIE_LOOP */
} else if (f == FunctorDBRef) {
Yap_Error(INTERNAL_ERROR, TermNil, "subgoal_search_loop: unsupported type tag FunctorDBRef");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "subgoal_search_loop: unsupported type tag FunctorDBRef");
} else {
#ifdef TRIE_RATIONAL_TERMS
term_array_push(&Ts, (void *) t, (void *) current_node);
@ -1253,7 +1253,7 @@ static inline sg_node_ptr subgoal_search_loop(tab_ent_ptr tab_ent, sg_node_ptr c
}
}
} else {
Yap_Error(INTERNAL_ERROR, TermNil, "subgoal_search_loop: unknown type tag");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "subgoal_search_loop: unknown type tag");
#endif /* MODE_TERMS_LOOP */
}
t = STACK_POP_DOWN(stack_terms);
@ -1352,7 +1352,7 @@ static inline ans_node_ptr answer_search_loop(sg_fr_ptr sg_fr, ans_node_ptr curr
ANSWER_CHECK_INSERT_ENTRY(sg_fr, current_node, t, _trie_retry_val + in_pair);
} else {
if (vars_arity == MAX_TABLE_VARS)
Yap_Error(INTERNAL_ERROR, TermNil, "answer_search_loop: MAX_TABLE_VARS exceeded");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "answer_search_loop: MAX_TABLE_VARS exceeded");
stack_vars_base[vars_arity] = t;
*((CELL *)t) = GLOBAL_table_var_enumerator(vars_arity);
t = MakeTableVarTerm(vars_arity);
@ -1525,7 +1525,7 @@ static inline ans_node_ptr answer_search_loop(sg_fr_ptr sg_fr, ans_node_ptr curr
ANSWER_CHECK_INSERT_ENTRY(sg_fr, current_node, (CELL)opq, _trie_retry_extension);
ANSWER_CHECK_INSERT_ENTRY(sg_fr, current_node, AbsAppl((Term *)f), _trie_retry_bigint);
} else if (f == FunctorDBRef) {
Yap_Error(INTERNAL_ERROR, TermNil, "answer_search_loop: unsupported type tag FunctorDBRef");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "answer_search_loop: unsupported type tag FunctorDBRef");
} else {
#ifdef TRIE_RATIONAL_TERMS
term_array_push(&Ts, (void *) t, (void *) current_node);
@ -1551,7 +1551,7 @@ static inline ans_node_ptr answer_search_loop(sg_fr_ptr sg_fr, ans_node_ptr curr
in_pair = 0;
#endif /* TRIE_COMPACT_PAIRS */
} else {
Yap_Error(INTERNAL_ERROR, TermNil, "answer_search_loop: unknown type tag");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "answer_search_loop: unknown type tag");
#endif /* MODE_TERMS_LOOP */
}
t = STACK_POP_DOWN(stack_terms);
@ -1606,7 +1606,7 @@ static inline ans_node_ptr answer_search_min_max(sg_fr_ptr sg_fr, ans_node_ptr c
} else if (f == FunctorBigInt) {
trie_value = AbsAppl( (CELL *) TrNode_entry(child_node) );
} else
Yap_Error(INTERNAL_ERROR, TermNil, "answer_search_min_max: invalid arithmetic value");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "answer_search_min_max: invalid arithmetic value");
child_node = TrNode_child(child_node);
}
@ -1686,7 +1686,7 @@ static inline ans_node_ptr answer_search_sum(sg_fr_ptr sg_fr, ans_node_ptr curre
} else if (f == FunctorBigInt) {
trie_value = AbsAppl( (CELL *) TrNode_entry(child_node) );
} else
Yap_Error(INTERNAL_ERROR, TermNil, "answer_search_min_max: invalid arithmetic value");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "answer_search_min_max: invalid arithmetic value");
child_node = TrNode_child(child_node);
}
@ -1911,7 +1911,7 @@ static inline CELL *load_answer_loop(ans_node_ptr current_node USES_REGS) {
Term head, tail = STACK_POP_UP(stack_aux);
#ifdef TRIE_RATIONAL_TERMS
if (IsRationalTerm(tail)) {
Yap_Error(INTERNAL_ERROR, tail, "Rational element of a Rational Term appears as the first Tail of a list");
Yap_Error(SYSTEM_ERROR_INTERNAL, tail, "Rational element of a Rational Term appears as the first Tail of a list");
}
#endif /* RATIONAL TERM SUPPORT FOR TRIES */
while (STACK_NOT_EMPTY(stack_aux, stack_terms)) {

View File

@ -465,7 +465,7 @@
aux_stack_var_in_pair_instr();
#else
Yap_Error(INTERNAL_ERROR, TermNil, "trie_do_var_in_pair: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_do_var_in_pair: invalid instruction");
#endif /* TRIE_COMPACT_PAIRS */
ENDPBOp();
@ -481,7 +481,7 @@
pop_trie_node();
aux_stack_var_in_pair_instr();
#else
Yap_Error(INTERNAL_ERROR, TermNil, "trie_trust_var_in_pair: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_trust_var_in_pair: invalid instruction");
#endif /* TRIE_COMPACT_PAIRS */
ENDPBOp();
@ -497,7 +497,7 @@
store_trie_node(TrNode_next(node));
aux_stack_var_in_pair_instr();
#else
Yap_Error(INTERNAL_ERROR, TermNil, "trie_try_var_in_pair: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_try_var_in_pair: invalid instruction");
#endif /* TRIE_COMPACT_PAIRS */
ENDPBOp();
@ -513,7 +513,7 @@
restore_trie_node(TrNode_next(node));
aux_stack_var_in_pair_instr();
#else
Yap_Error(INTERNAL_ERROR, TermNil, "trie_retry_var_in_pair: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_retry_var_in_pair: invalid instruction");
#endif /* TRIE_COMPACT_PAIRS */
ENDPBOp();
@ -580,7 +580,7 @@
aux_stack_val_in_pair_instr();
#else
Yap_Error(INTERNAL_ERROR, TermNil, "trie_do_val_in_pair: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_do_val_in_pair: invalid instruction");
#endif /* TRIE_COMPACT_PAIRS */
ENDPBOp();
@ -597,7 +597,7 @@
pop_trie_node();
aux_stack_val_in_pair_instr();
#else
Yap_Error(INTERNAL_ERROR, TermNil, "trie_trust_val_in_pair: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_trust_val_in_pair: invalid instruction");
#endif /* TRIE_COMPACT_PAIRS */
ENDPBOp();
@ -614,7 +614,7 @@
store_trie_node(TrNode_next(node));
aux_stack_val_in_pair_instr();
#else
Yap_Error(INTERNAL_ERROR, TermNil, "trie_try_val_in_pair: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_try_val_in_pair: invalid instruction");
#endif /* TRIE_COMPACT_PAIRS */
ENDPBOp();
@ -631,7 +631,7 @@
restore_trie_node(TrNode_next(node));
aux_stack_val_in_pair_instr();
#else
Yap_Error(INTERNAL_ERROR, TermNil, "trie_retry_val_in_pair: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_retry_val_in_pair: invalid instruction");
#endif /* TRIE_COMPACT_PAIRS */
ENDPBOp();
@ -697,7 +697,7 @@
aux_stack_term_in_pair_instr();
#else
Yap_Error(INTERNAL_ERROR, TermNil, "trie_do_atom_in_pair: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_do_atom_in_pair: invalid instruction");
#endif /* TRIE_COMPACT_PAIRS */
ENDPBOp();
@ -713,7 +713,7 @@
pop_trie_node();
aux_stack_term_in_pair_instr();
#else
Yap_Error(INTERNAL_ERROR, TermNil, "trie_trust_atom_in_pair: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_trust_atom_in_pair: invalid instruction");
#endif /* TRIE_COMPACT_PAIRS */
ENDPBOp();
@ -729,7 +729,7 @@
store_trie_node(TrNode_next(node));
aux_stack_term_in_pair_instr();
#else
Yap_Error(INTERNAL_ERROR, TermNil, "trie_try_atom_in_pair: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_try_atom_in_pair: invalid instruction");
#endif /* TRIE_COMPACT_PAIRS */
ENDPBOp();
@ -745,7 +745,7 @@
restore_trie_node(TrNode_next(node));
aux_stack_term_in_pair_instr();
#else
Yap_Error(INTERNAL_ERROR, TermNil, "trie_retry_atom_in_pair: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_retry_atom_in_pair: invalid instruction");
#endif /* TRIE_COMPACT_PAIRS */
ENDPBOp();
@ -803,7 +803,7 @@
aux_stack_new_pair_instr();
#else
Yap_Error(INTERNAL_ERROR, TermNil, "trie_do_null_in_pair: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_do_null_in_pair: invalid instruction");
#endif /* TRIE_COMPACT_PAIRS */
ENDPBOp();
@ -819,7 +819,7 @@
pop_trie_node();
aux_stack_new_pair_instr();
#else
Yap_Error(INTERNAL_ERROR, TermNil, "trie_trust_null_in_pair: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_trust_null_in_pair: invalid instruction");
#endif /* TRIE_COMPACT_PAIRS */
ENDPBOp();
@ -835,7 +835,7 @@
store_trie_node(TrNode_next(node));
aux_stack_new_pair_instr();
#else
Yap_Error(INTERNAL_ERROR, TermNil, "trie_try_null_in_pair: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_try_null_in_pair: invalid instruction");
#endif /* TRIE_COMPACT_PAIRS */
ENDPBOp();
@ -851,7 +851,7 @@
restore_trie_node(TrNode_next(node));
aux_stack_new_pair_instr();
#else
Yap_Error(INTERNAL_ERROR, TermNil, "trie_retry_null_in_pair: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_retry_null_in_pair: invalid instruction");
#endif /* TRIE_COMPACT_PAIRS */
ENDPBOp();
@ -970,7 +970,7 @@
aux_stack_appl_in_pair_instr();
#else
Yap_Error(INTERNAL_ERROR, TermNil, "trie_do_appl_in_pair: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_do_appl_in_pair: invalid instruction");
#endif /* TRIE_COMPACT_PAIRS */
ENDPBOp();
@ -988,7 +988,7 @@
pop_trie_node();
aux_stack_appl_in_pair_instr();
#else
Yap_Error(INTERNAL_ERROR, TermNil, "trie_trust_appl_in_pair: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_trust_appl_in_pair: invalid instruction");
#endif /* TRIE_COMPACT_PAIRS */
ENDPBOp();
@ -1006,7 +1006,7 @@
store_trie_node(TrNode_next(node));
aux_stack_appl_in_pair_instr();
#else
Yap_Error(INTERNAL_ERROR, TermNil, "trie_try_appl_in_pair: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_try_appl_in_pair: invalid instruction");
#endif /* TRIE_COMPACT_PAIRS */
ENDPBOp();
@ -1024,7 +1024,7 @@
restore_trie_node(TrNode_next(node));
aux_stack_appl_in_pair_instr();
#else
Yap_Error(INTERNAL_ERROR, TermNil, "trie_retry_appl_in_pair: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_retry_appl_in_pair: invalid instruction");
#endif /* TRIE_COMPACT_PAIRS */
ENDPBOp();
@ -1103,17 +1103,17 @@
BOp(trie_trust_double, e)
Yap_Error(INTERNAL_ERROR, TermNil, "trie_trust_double: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_trust_double: invalid instruction");
ENDBOp();
BOp(trie_try_double, e)
Yap_Error(INTERNAL_ERROR, TermNil, "trie_try_double: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_try_double: invalid instruction");
ENDBOp();
BOp(trie_retry_double, e)
Yap_Error(INTERNAL_ERROR, TermNil, "trie_retry_double: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_retry_double: invalid instruction");
ENDBOp();
@ -1133,17 +1133,17 @@
BOp(trie_trust_longint, e)
Yap_Error(INTERNAL_ERROR, TermNil, "trie_trust_longint: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_trust_longint: invalid instruction");
ENDBOp();
BOp(trie_try_longint, e)
Yap_Error(INTERNAL_ERROR, TermNil, "trie_try_longint: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_try_longint: invalid instruction");
ENDBOp();
BOp(trie_retry_longint, e)
Yap_Error(INTERNAL_ERROR, TermNil, "trie_retry_longint: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_retry_longint: invalid instruction");
ENDBOp();
@ -1163,17 +1163,17 @@
BOp(trie_trust_bigint, e)
Yap_Error(INTERNAL_ERROR, TermNil, "trie_trust_bigint: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_trust_bigint: invalid instruction");
ENDBOp();
BOp(trie_try_bigint, e)
Yap_Error(INTERNAL_ERROR, TermNil, "trie_try_bigint: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_try_bigint: invalid instruction");
ENDBOp();
BOp(trie_retry_bigint, e)
Yap_Error(INTERNAL_ERROR, TermNil, "trie_retry_bigint: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_retry_bigint: invalid instruction");
ENDBOp();

View File

@ -679,17 +679,17 @@ ENDPBOp();
BOp(trie_trust_double, e)
Yap_Error(INTERNAL_ERROR, TermNil, "trie_trust_double: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_trust_double: invalid instruction");
ENDBOp();
BOp(trie_try_double, e)
Yap_Error(INTERNAL_ERROR, TermNil, "trie_try_double: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_try_double: invalid instruction");
ENDBOp();
BOp(trie_retry_double, e)
Yap_Error(INTERNAL_ERROR, TermNil, "trie_retry_double: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_retry_double: invalid instruction");
ENDBOp();
@ -710,12 +710,12 @@ ENDPBOp();
BOp(trie_trust_longint, e)
Yap_Error(INTERNAL_ERROR, TermNil, "trie_trust_longint: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_trust_longint: invalid instruction");
ENDBOp();
BOp(trie_try_longint, e)
Yap_Error(INTERNAL_ERROR, TermNil, "trie_try_longint: invalid instruction");
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil, "trie_try_longint: invalid instruction");
ENDBOp();

View File

@ -1,54 +0,0 @@
#!/bin/bash
#
# small but nasty script to build a new YAP release from the current
# directory: it first builds a new tar file, next creates
# rpms, and last creates a new web page directory.
#
YAP_DIR=`pwd`
PAGE_DIR=~vitor/lpublic_html/Yap/Yap4.3
OWNER=vitor
parent=$(cd ..;pwd)
version=${PWD##$parent/}
splat() {
rm -f core
for i in *.tex; do
rm -f ${i%.tex}.aux
rm -f ${i%.tex}.log
rm -f ${i%.tex}.dvi
rm -f ${i%.tex}.bbl
rm -f ${i%.tex}.blg
# get rid of outputs from original file.
rm -f ${i%.tex}.ps
done
rm -f *~
rm -f *.BAK
rm -f \#*\#
}
. distribute --small
cp $YAP_DIR/../"$version".tar.gz $PAGE_DIR/"$version"-small.tar.gz
cd /usr/src/RPM/SPECS
cp $YAP_DIR/misc/Yap.spec .
mv $YAP_DIR/../"$version".tar.gz ../SOURCES
rpm -ba Yap.spec
cd /usr/src/RPM
mv SRPMS/Yap* $PAGE_DIR
mv RPMS/*/Yap* $PAGE_DIR
rm -rf BUILD/Yap*
rm -rf SOURCES/Yap*
rm -rf SPECS/Yap*
cd $YAP_DIR
# get rid of silly $1
shift
. distribute
mv -f $YAP_DIR/../"$version".tar.gz $PAGE_DIR
cp -f $YAP_DIR/changes4.3.html $PAGE_DIR
cd $YAP_DIR/docs
make html
cd $YAP_DIR
cp -f $YAP_DIR/docs/*.html $PAGE_DIR
chown $OWNER $PAGE_DIR/*
chmod 666 $PAGE_DIR/*

View File

@ -62,7 +62,7 @@ if ((WIN32 AND NOT(MINGW OR CYGWIN)) OR NOT LLVM_CONFIG)
if (WIN32)
# A bit of a sanity check:
if( NOT EXISTS ${LLVM_ROOT_DIR}/include/llvm )
message(FATAL_ERROR "LLVM_ROOT_DIR (${LLVM_ROOT_DIR}) is not a valid LLVM install")
message(SYSTEM_ERROR_FATAL "LLVM_ROOT_DIR (${LLVM_ROOT_DIR}) is not a valid LLVM install")
endif()
# We incorporate the CMake features provided by LLVM:
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${LLVM_ROOT_DIR}/share/llvm/cmake")

View File

@ -37,7 +37,7 @@ IF (MYSQL_FOUND)
ELSE (MYSQL_FOUND)
IF (MYSQL_FIND_REQUIRED)
MESSAGE(STATUS "Looked for MySQL libraries named ${MYSQL_NAMES}.")
MESSAGE(FATAL_ERROR "Could NOT find MySQL library")
MESSAGE(SYSTEM_ERROR_FATAL "Could NOT find MySQL library")
ENDIF (MYSQL_FIND_REQUIRED)
ENDIF (MYSQL_FOUND)

View File

@ -81,6 +81,6 @@ IF(READLINE_FOUND)
MESSAGE(STATUS "Found readline library")
ELSE(READLINE_FOUND)
IF(READLINE_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find readline -- please give some paths to CMake")
MESSAGE(SYSTEM_ERROR_FATAL "Could not find readline -- please give some paths to CMake")
ENDIF(READLINE_FIND_REQUIRED)
ENDIF(READLINE_FOUND)

View File

@ -91,7 +91,7 @@ else (SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS)
endif (NOT Sqlite3_FIND_QUIETLY)
else (SQLITE3_FOUND)
if (Sqlite3_FIND_REQUIRED)
message(FATAL_ERROR "Could not find Sqlite3")
message(SYSTEM_ERROR_FATAL "Could not find Sqlite3")
endif (Sqlite3_FIND_REQUIRED)
endif (SQLITE3_FOUND)

View File

@ -99,7 +99,7 @@ function(git_describe _var)
# (ARGN MATCHES "||") OR
# (ARGN MATCHES "\\;"))
# message("Please report the following error to the project!")
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
# message(SYSTEM_ERROR_FATAL "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
#endif()
#message(STATUS "Arguments to execute_process: ${ARGN}")

View File

@ -149,7 +149,7 @@ MACRO(MACRO_DISPLAY_FEATURE_LOG)
IF(_haveMissingReq)
MESSAGE(FATAL_ERROR "Exiting: Missing Requirements")
MESSAGE(SYSTEM_ERROR_FATAL "Exiting: Missing Requirements")
ENDIF(_haveMissingReq)
ENDIF(_printSummary)

View File

@ -16,196 +16,102 @@
#ifndef YAP_ERROR_H
#define YAP_ERROR_H 1
/* Types of Errors */
typedef enum
{
YAP_NO_ERROR,
FATAL_ERROR,
INTERNAL_ERROR,
INTERNAL_COMPILER_ERROR,
NOJIT_ERROR, /* I added */
PURE_ABORT,
CALL_COUNTER_UNDERFLOW,
/* ISO_ERRORS */
CONSISTENCY_ERROR,
DOMAIN_ERROR_ARRAY_OVERFLOW,
DOMAIN_ERROR_ARRAY_TYPE,
DOMAIN_ERROR_FILE_ERRORS,
DOMAIN_ERROR_FILE_TYPE,
DOMAIN_ERROR_IO_MODE,
DOMAIN_ERROR_MUTABLE,
DOMAIN_ERROR_NON_EMPTY_LIST,
DOMAIN_ERROR_NOT_LESS_THAN_ZERO,
DOMAIN_ERROR_NOT_NL,
DOMAIN_ERROR_NOT_ZERO,
DOMAIN_ERROR_OUT_OF_RANGE,
DOMAIN_ERROR_OPERATOR_PRIORITY,
DOMAIN_ERROR_OPERATOR_SPECIFIER,
DOMAIN_ERROR_PROLOG_FLAG,
DOMAIN_ERROR_RADIX,
DOMAIN_ERROR_SHIFT_COUNT_OVERFLOW,
DOMAIN_ERROR_SOLUTIONS,
DOMAIN_ERROR_SOURCE_SINK,
DOMAIN_ERROR_STREAM,
DOMAIN_ERROR_STREAM_ENCODING,
DOMAIN_ERROR_STREAM_OR_ALIAS,
DOMAIN_ERROR_STREAM_POSITION,
DOMAIN_ERROR_TIMEOUT_SPEC,
DOMAIN_ERROR_SYNTAX_ERROR_HANDLER,
EVALUATION_ERROR_FLOAT_OVERFLOW,
EVALUATION_ERROR_FLOAT_UNDERFLOW,
EVALUATION_ERROR_INT_OVERFLOW,
EVALUATION_ERROR_UNDEFINED,
EVALUATION_ERROR_UNDERFLOW,
EVALUATION_ERROR_ZERO_DIVISOR,
EXISTENCE_ERROR_ARRAY,
EXISTENCE_ERROR_KEY,
EXISTENCE_ERROR_MUTEX,
EXISTENCE_ERROR_SOURCE_SINK,
EXISTENCE_ERROR_STREAM,
EXISTENCE_ERROR_VARIABLE,
INCOMPATIBLEMODE_WARNING, /* I added */
INCOMPATIBLE_CODEMODE_WARNING, /* I added */
INSTANTIATION_ERROR,
INTERRUPT_ERROR,
INVALID_PARAMETER_TYPE_ERROR, /* I added */
OPERATING_SYSTEM_ERROR,
OUT_OF_HEAP_ERROR,
OUT_OF_KNOWNRANGE_ERROR, /* I added */
OUT_OF_STACK_ERROR,
OUT_OF_TRAIL_ERROR,
OUT_OF_ATTVARS_ERROR,
OUT_OF_AUXSPACE_ERROR,
PERMISSION_ERROR_ACCESS_PRIVATE_PROCEDURE,
PERMISSION_ERROR_NEW_ALIAS_FOR_STREAM,
PERMISSION_ERROR_CREATE_ARRAY,
PERMISSION_ERROR_CREATE_OPERATOR,
PERMISSION_ERROR_INPUT_BINARY_STREAM,
PERMISSION_ERROR_INPUT_PAST_END_OF_STREAM,
PERMISSION_ERROR_INPUT_STREAM,
PERMISSION_ERROR_INPUT_TEXT_STREAM,
PERMISSION_ERROR_MODIFY_STATIC_PROCEDURE,
PERMISSION_ERROR_OPEN_SOURCE_SINK,
PERMISSION_ERROR_OUTPUT_BINARY_STREAM,
PERMISSION_ERROR_OUTPUT_STREAM,
PERMISSION_ERROR_OUTPUT_TEXT_STREAM,
PERMISSION_ERROR_RESIZE_ARRAY,
PERMISSION_ERROR_READ_ONLY_FLAG,
PERMISSION_ERROR_REPOSITION_STREAM,
PRED_ENTRY_COUNTER_UNDERFLOW,
REPRESENTATION_ERROR_CHARACTER,
REPRESENTATION_ERROR_CHARACTER_CODE,
REPRESENTATION_ERROR_INT,
REPRESENTATION_ERROR_MAX_ARITY,
REPRESENTATION_ERROR_VARIABLE,
RESOURCE_ERROR_HUGE_INT,
RESOURCE_ERROR_MAX_STREAMS,
RESOURCE_ERROR_MAX_THREADS,
RESOURCE_ERROR_MEMORY,
RESOURCE_ERROR_STACK,
RETRY_COUNTER_UNDERFLOW,
SAVED_STATE_ERROR,
SYNTAX_ERROR,
SYSTEM_ERROR,
TYPE_ERROR_ARRAY,
TYPE_ERROR_ATOM,
TYPE_ERROR_ATOMIC,
TYPE_ERROR_BIGNUM,
TYPE_ERROR_BYTE,
TYPE_ERROR_CALLABLE,
TYPE_ERROR_CHAR,
TYPE_ERROR_CHARACTER,
TYPE_ERROR_COMPOUND,
TYPE_ERROR_DBREF,
TYPE_ERROR_DBTERM,
TYPE_ERROR_EVALUABLE,
TYPE_ERROR_FLOAT,
TYPE_ERROR_INTEGER,
TYPE_ERROR_KEY,
TYPE_ERROR_LIST,
TYPE_ERROR_NUMBER,
TYPE_ERROR_PARAMETER,
TYPE_ERROR_PREDICATE_INDICATOR,
TYPE_ERROR_PTR,
TYPE_ERROR_REFERENCE,
TYPE_ERROR_STRING,
TYPE_ERROR_TEXT,
TYPE_ERROR_UBYTE,
TYPE_ERROR_UCHAR,
TYPE_ERROR_VARIABLE,
UNINSTANTIATION_ERROR,
UNKNOWN_ERROR
} yap_error_number;
#define ECLASS(CL, A, B) CL,
#define E0(A, B) A,
#define E(A, B, C) A,
#define E2(A, B, C, D) A,
#define BEGIN_ERRORS() typedef enum {
#define END_ERRORS() \
} \
yap_error_number
#define BEGIN_ERROR_CLASSES() typedef enum {
#define END_ERROR_CLASSES() \
} \
yap_error_class_number
#include "YapErrors.h"
struct yami *Yap_Error__(const char *file, const char *function, int lineno, yap_error_number err,YAP_Term wheret, ...);
#define Yap_Error( id, t, ...) Yap_Error__(__FILE__, __FUNCTION__, __LINE__, id, t, __VA_ARGS__)
#define Yap_NilError( id, ...) Yap_Error__(__FILE__, __FUNCTION__, __LINE__, id, TermNil, __VA_ARGS__)
#define JMP_LOCAL_ERROR(v, LAB) \
if (H + 2*(v) > ASP-1024) { \
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR;\
LOCAL_Error_Term = TermNilnnnnnnnnnnnnnnnnnnnnnnnnnn;\
LOCAL_Error_Size = 2*(v)*sizeof(CELL);\
goto LAB; \
#define JMP_LOCAL_ERROR(v, LAB) \
if (H + 2 * (v) > ASP - 1024) { \
LOCAL_Error_TYPE = RESOURCE_ERROR_STACK; \
LOCAL_Error_Term = t; \
LOCAL_Error_Size = 2 * (v) * sizeof(CELL); \
goto LAB; \
}
#define LOCAL_ERROR(v) \
if (HR + (v) > ASP-1024) { \
LOCAL_Error_TYPE = OUT_OF_STACK_ERROR;\
LOCAL_Error_Term = TermNil;\
LOCAL_Error_Size = 2*(v)*sizeof(CELL);\
return NULL; \
#define LOCAL_ERROR(t, v) \
if (HR + (v) > ASP - 1024) { \
LOCAL_Error_TYPE = RESOURCE_ERROR_STACK; \
LOCAL_Error_Term = t; \
LOCAL_Error_Size = 2 * (v) * sizeof(CELL); \
return NULL; \
}
#define LOCAL_TERM_ERROR(v) \
if (HR + (v) > ASP-1024) { \
;\
LOCAL_Error_Size = 2*(v)*sizeof(CELL);\
return 0L; \
#define LOCAL_TERM_ERROR(t, v) \
if (HR + (v) > ASP - 1024) { \
LOCAL_Error_TYPE = RESOURCE_ERROR_STACK; \
LOCAL_Error_Term = t; \
LOCAL_Error_Size = 2 * (v) * sizeof(CELL); \
return 0L; \
}
#define AUX_ERROR(t, n, s, TYPE) \
if (s + (n+1) > (TYPE *)AuxSp) { \
LOCAL_Error_TYPE = OUT_OF_AUXSPACE_ERROR;\
LOCAL_Error_Term = t;\
LOCAL_Error_Size = n*sizeof(TYPE);\
return NULL; \
}
#define AUX_ERROR(t, n, s, TYPE) \
if (s + (n + 1) > (TYPE *)AuxSp) { \
LOCAL_Error_TYPE = RESOURCE_ERROR_AUXILIARY_STACK; \
LOCAL_Error_Term = t; \
LOCAL_Error_Size = n * sizeof(TYPE); \
return NULL; \
}
#define AUX_TERM_ERROR(t, n, s, TYPE) \
if (s + (n+1) > (TYPE *)AuxSp) { \
LOCAL_Error_TYPE = OUT_OF_AUXSPACE_ERROR;\
LOCAL_Error_Term = t;\
LOCAL_Error_Size = n*sizeof(TYPE);\
return 0L; \
}
#define AUX_TERM_ERROR(t, n, s, TYPE) \
if (s + (n + 1) > (TYPE *)AuxSp) { \
LOCAL_Error_TYPE = RESOURCE_ERROR_AUXILIARY_STACK; \
LOCAL_Error_Term = t; \
LOCAL_Error_Size = n * sizeof(TYPE); \
return 0L; \
}
#define JMP_AUX_ERROR(n, s, t, TYPE, LAB) \
if (s + (n+1) > (TYPE *)AuxSp) { \
LOCAL_Error_TYPE = OUT_OF_AUXSPACE_ERROR;\
LOCAL_Error_Term = t;\
LOCAL_Error_Size = n*sizeof(TYPE);\
goto LAB; \
}
#define JMP_AUX_ERROR(n, s, t, TYPE, LAB) \
if (s + (n + 1) > (TYPE *)AuxSp) { \
LOCAL_Error_TYPE = RESOURCE_ERROR_AUXILIARY_STACK; \
LOCAL_Error_Term = t; \
LOCAL_Error_Size = n * sizeof(TYPE); \
goto LAB; \
}
#define HEAP_ERROR(a,TYPE) if( a == NIL) { \
LOCAL_Error_TYPE = OUT_OF_HEAP_ERROR;\
LOCAL_Error_Term = t;\
LOCAL_Error_Size = n*sizeof(TYPE);\
return NULL;\
}
#define HEAP_TERM_ERROR(a,TYPE) if( a == NIL) { \
LOCAL_Error_TYPE = OUT_OF_HEAP_ERROR;\
LOCAL_Error_Term = t;\
LOCAL_Error_Size = n*sizeof(TYPE);\
return 0L;\
}
#define JMP_HEAP_ERROR(a,n,t,TYPE, LAB) if( a == NIL) { \
LOCAL_Error_TYPE = OUT_OF_HEAP_ERROR;\
LOCAL_Error_Term = t;\
LOCAL_Error_Size = n*sizeof(TYPE);\
goto LAB;\
}
#define HEAP_ERROR(a, TYPE) \
if (a == NIL) { \
LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP; \
LOCAL_Error_Term = t; \
LOCAL_Error_Size = n * sizeof(TYPE); \
return NULL; \
}
#define HEAP_TERM_ERROR(a, TYPE) \
if (a == NIL) { \
LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP; \
LOCAL_Error_Term = t; \
LOCAL_Error_Size = n * sizeof(TYPE); \
return 0L; \
}
#define JMP_HEAP_ERROR(a, n, t, TYPE, LAB) \
if (a == NIL) { \
LOCAL_Error_TYPE = RESOURCE_ERROR_HEAP; \
LOCAL_Error_Term = t; \
LOCAL_Error_Size = n * sizeof(TYPE); \
goto LAB; \
}
#endif

152
include/YapErrors.h Normal file
View File

@ -0,0 +1,152 @@
BEGIN_ERROR_CLASSES()
ECLASS(NO_ERROR, "no_error", 0)
ECLASS(DOMAIN_ERROR, "domain_error", 2)
ECLASS(EVALUATION_ERROR, "evaluation_error", 2)
ECLASS(EXISTENCE_ERROR, "existence_error", 2)
ECLASS(INSTANTIATION_ERROR_CLASS, "instantiation_error", 0)
ECLASS(PERMISSION_ERROR, "permission_error", 3)
ECLASS(REPRESENTATION_ERROR, "representation_error", 2)
ECLASS(RESOURCE_ERROR, "resource_error", 2)
ECLASS(SYNTAX_ERROR_CLASS, "syntax_error", 2)
ECLASS(SYSTEM_ERROR_CLASS, "system_error", 2)
ECLASS(TYPE_ERROR, "type_error", 2)
ECLASS(UNINSTANTIATION_ERROR_CLASS, "uninstantiation_error", 1)
ECLASS(EVENT, "event", 2)
END_ERROR_CLASSES();
BEGIN_ERRORS()
/* ISO_ERRORS */
E0(YAP_NO_ERROR, NO_ERROR)
E(DOMAIN_ERROR_ARRAY_OVERFLOW, DOMAIN_ERROR, "array_overflow")
E(DOMAIN_ERROR_ARRAY_TYPE, DOMAIN_ERROR, "array_type")
E(DOMAIN_ERROR_FILE_ERRORS, DOMAIN_ERROR, "file_errors")
E(DOMAIN_ERROR_FILE_TYPE, DOMAIN_ERROR, "file_type")
E(DOMAIN_ERROR_IO_MODE, DOMAIN_ERROR, "io_mode")
E(DOMAIN_ERROR_MUTABLE, DOMAIN_ERROR, "mutable")
E(DOMAIN_ERROR_NON_EMPTY_LIST, DOMAIN_ERROR, "non_empty_list")
E(DOMAIN_ERROR_NOT_LESS_THAN_ZERO, DOMAIN_ERROR, "not_less_than_zero")
E(DOMAIN_ERROR_NOT_NL, DOMAIN_ERROR, "not_nl")
E(DOMAIN_ERROR_NOT_ZERO, DOMAIN_ERROR, "not_zero")
E(DOMAIN_ERROR_OUT_OF_RANGE, DOMAIN_ERROR, "out_of_range")
E(DOMAIN_ERROR_OPERATOR_PRIORITY, DOMAIN_ERROR, "operator_priority")
E(DOMAIN_ERROR_OPERATOR_SPECIFIER, DOMAIN_ERROR, "operator_specifier")
E(DOMAIN_ERROR_RADIX, DOMAIN_ERROR, "radix")
E(DOMAIN_ERROR_PROLOG_FLAG, DOMAIN_ERROR, "prolog_flag")
E(DOMAIN_ERROR_SHIFT_COUNT_OVERFLOW, DOMAIN_ERROR, "shift_count_overflow")
E(DOMAIN_ERROR_SOURCE_SINK, DOMAIN_ERROR, "source_sink")
E(DOMAIN_ERROR_SOLUTIONS, DOMAIN_ERROR, "solutions")
E(DOMAIN_ERROR_STREAM, DOMAIN_ERROR, "stream")
E(DOMAIN_ERROR_STREAM_ENCODING, DOMAIN_ERROR, "stream_encoding")
E(DOMAIN_ERROR_STREAM_OR_ALIAS, DOMAIN_ERROR, "stream_or_alias")
E(DOMAIN_ERROR_STREAM_POSITION, DOMAIN_ERROR, "stream_position")
E(DOMAIN_ERROR_TIMEOUT_SPEC, DOMAIN_ERROR, "timeout_spec")
E(DOMAIN_ERROR_SYNTAX_ERROR_HANDLER, DOMAIN_ERROR, "syntax_error_handler")
E(EVALUATION_ERROR_FLOAT_OVERFLOW, EVALUATION_ERROR, "float_overflow")
E(EVALUATION_ERROR_FLOAT_UNDERFLOW, EVALUATION_ERROR, "float_underflow")
E(EVALUATION_ERROR_INT_OVERFLOW, EVALUATION_ERROR, "int_overflow")
E(EVALUATION_ERROR_UNDEFINED, EVALUATION_ERROR, "undefined")
E(EVALUATION_ERROR_UNDERFLOW, EVALUATION_ERROR, "underflow")
E(EVALUATION_ERROR_ZERO_DIVISOR, EVALUATION_ERROR, "zero_divisor")
E(EXISTENCE_ERROR_ARRAY, EXISTENCE_ERROR, "array")
E(EXISTENCE_ERROR_KEY, EXISTENCE_ERROR, "key, ")
E(EXISTENCE_ERROR_MUTEX, EXISTENCE_ERROR, "mutex, ")
E(EXISTENCE_ERROR_SOURCE_SINK, EXISTENCE_ERROR, "source_sink")
E(EXISTENCE_ERROR_STREAM, EXISTENCE_ERROR, "stream")
E(EXISTENCE_ERROR_VARIABLE, EXISTENCE_ERROR, "variable")
E0(INSTANTIATION_ERROR, INSTANTIATION_ERROR_CLASS)
E2(PERMISSION_ERROR_ACCESS_PRIVATE_PROCEDURE, PERMISSION_ERROR, "access","private_procedure")
E2(PERMISSION_ERROR_NEW_ALIAS_FOR_STREAM, PERMISSION_ERROR,
"add_alias", "stream")
E2(PERMISSION_ERROR_CREATE_ARRAY, PERMISSION_ERROR, "create", "array")
E2(PERMISSION_ERROR_CREATE_OPERATOR, PERMISSION_ERROR, "create", "operator")
E2(PERMISSION_ERROR_INPUT_BINARY_STREAM, PERMISSION_ERROR,
"input", "binary_stream")
E2(PERMISSION_ERROR_INPUT_PAST_END_OF_STREAM, PERMISSION_ERROR,
"input", "past_end_of_stream")
E2(PERMISSION_ERROR_INPUT_STREAM, PERMISSION_ERROR, "input","stream")
E2(PERMISSION_ERROR_INPUT_TEXT_STREAM, PERMISSION_ERROR,
"input","text_stream")
E2(PERMISSION_ERROR_MODIFY_STATIC_PROCEDURE, PERMISSION_ERROR,
"modify","static_procedure")
E2(PERMISSION_ERROR_OPEN_SOURCE_SINK, PERMISSION_ERROR, "open","source_sink")
E2(PERMISSION_ERROR_OUTPUT_BINARY_STREAM, PERMISSION_ERROR,
"output","binary_stream")
E2(PERMISSION_ERROR_OUTPUT_STREAM, PERMISSION_ERROR, "output","stream")
E2(PERMISSION_ERROR_OUTPUT_TEXT_STREAM, PERMISSION_ERROR,
"output","text_stream")
E2(PERMISSION_ERROR_READ_ONLY_FLAG, PERMISSION_ERROR, "read_only","flag")
E2(PERMISSION_ERROR_RESIZE_ARRAY, PERMISSION_ERROR, "resize","array")
E2(PERMISSION_ERROR_REPOSITION_STREAM, PERMISSION_ERROR,
"reposition","stream")
E(REPRESENTATION_ERROR_CHARACTER, REPRESENTATION_ERROR, "character")
E(REPRESENTATION_ERROR_CHARACTER_CODE, REPRESENTATION_ERROR,
"character_code")
E(REPRESENTATION_ERROR_INT, REPRESENTATION_ERROR, "int")
E(REPRESENTATION_ERROR_MAX_ARITY, REPRESENTATION_ERROR, "max_arity")
E(REPRESENTATION_ERROR_VARIABLE, REPRESENTATION_ERROR, "variable")
E(RESOURCE_ERROR_HUGE_INT, RESOURCE_ERROR, "huge_int")
E(RESOURCE_ERROR_MAX_STREAMS, RESOURCE_ERROR, "max_streams")
E(RESOURCE_ERROR_MAX_THREADS, RESOURCE_ERROR, "max_threads")
E(RESOURCE_ERROR_AUXILIARY_STACK, RESOURCE_ERROR, "auxiliary_stack")
E(RESOURCE_ERROR_ATTRIBUTED_VARIABLES, RESOURCE_ERROR,
"attributed_variables")
E(RESOURCE_ERROR_HEAP, RESOURCE_ERROR, "database_space")
E(RESOURCE_ERROR_TRAIL, RESOURCE_ERROR, "trail_space")
E(RESOURCE_ERROR_STACK, RESOURCE_ERROR, "stack_space")
E(SYNTAX_ERROR, SYNTAX_ERROR_CLASS, "syntax_error")
E(SYSTEM_ERROR_INTERNAL, SYSTEM_ERROR_CLASS, "internal")
E(SYSTEM_ERROR_COMPILER, SYSTEM_ERROR_CLASS, "compiler")
E(SYSTEM_ERROR_FATAL, SYSTEM_ERROR_CLASS, "fatal")
E(SYSTEM_ERROR_JIT_NOT_AVAILABLE, SYSTEM_ERROR_CLASS, "jit_not_available")
E(SYSTEM_ERROR_OPERATING_SYSTEM, SYSTEM_ERROR_CLASS, "operating_system_error")
E(SYSTEM_ERROR_SAVED_STATE, SYSTEM_ERROR_CLASS, "saved_state_error")
E(ABORT_EVENT, EVENT, "abort")
E(CALL_COUNTER_UNDERFLOW_EVENT, EVENT, "call_counter_underflow")
E(PRED_ENTRY_COUNTER_UNDERFLOW_EVENT, EVENT,
"pred_entry_counter_underflow")
E(RETRY_COUNTER_UNDERFLOW_EVENT, EVENT, "retry_counter_underflow")
E(INTERRUPT_EVENT, EVENT, "interrupt")
E(TYPE_ERROR_ARRAY, TYPE_ERROR, "array")
E(TYPE_ERROR_ATOM, TYPE_ERROR, "atom")
E(TYPE_ERROR_ATOMIC, TYPE_ERROR, "atomic")
E(TYPE_ERROR_BIGNUM, TYPE_ERROR, "bignum")
E(TYPE_ERROR_BYTE, TYPE_ERROR, "byte")
E(TYPE_ERROR_CALLABLE, TYPE_ERROR, "callable")
E(TYPE_ERROR_CHAR, TYPE_ERROR, "char")
E(TYPE_ERROR_CHARACTER, TYPE_ERROR, "character")
E(TYPE_ERROR_COMPOUND, TYPE_ERROR, "compound")
E(TYPE_ERROR_DBREF, TYPE_ERROR, "dbref")
E(TYPE_ERROR_DBTERM, TYPE_ERROR, "dbterm")
E(TYPE_ERROR_EVALUABLE, TYPE_ERROR, "evaluable")
E(TYPE_ERROR_FLOAT, TYPE_ERROR, "float")
E(TYPE_ERROR_INTEGER, TYPE_ERROR, "integer")
E(TYPE_ERROR_KEY, TYPE_ERROR, "key")
E(TYPE_ERROR_LIST, TYPE_ERROR, "list")
E(TYPE_ERROR_NUMBER, TYPE_ERROR, "number")
E(TYPE_ERROR_PARAMETER, TYPE_ERROR, "parameter")
E(TYPE_ERROR_PREDICATE_INDICATOR, TYPE_ERROR, "predicate_indicator")
E(TYPE_ERROR_PTR, TYPE_ERROR, "pointer")
E(TYPE_ERROR_REFERENCE, TYPE_ERROR, "reference")
E(TYPE_ERROR_STRING, TYPE_ERROR, "string")
E(TYPE_ERROR_TEXT, TYPE_ERROR, "text")
E(TYPE_ERROR_UBYTE, TYPE_ERROR, "ubyte")
E(TYPE_ERROR_UCHAR, TYPE_ERROR, "uchar")
E0(UNINSTANTIATION_ERROR, UNINSTANTIATION_ERROR_CLASS)
END_ERRORS();

View File

@ -617,7 +617,7 @@
#define ATOM_syntax_error ((atom_t)(610*2+1))
#define ATOM_syntax_errors ((atom_t)(611*2+1))
#define ATOM_system ((atom_t)(612*2+1))
#define ATOM_system_error ((atom_t)(613*2+1))
#define ATOM_SYSTEM_ERROR_INTERNAL ((atom_t)(613*2+1))
#define ATOM_system_init_file ((atom_t)(614*2+1))
#define ATOM_system_thread_id ((atom_t)(615*2+1))
#define ATOM_system_time ((atom_t)(616*2+1))

View File

@ -2424,7 +2424,7 @@ X_API predicate_t PL_predicate(const char *name, int arity, const char *m)
Atom at;
while (!(at = Yap_LookupAtom((char *)m))) {
if (!Yap_growheap(FALSE, 0L, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, LOCAL_ErrorMessage);
return NULL;
}
}
@ -2432,7 +2432,7 @@ X_API predicate_t PL_predicate(const char *name, int arity, const char *m)
}
while (!(at = Yap_LookupAtom((char *)name))) {
if (!Yap_growheap(FALSE, 0L, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
Yap_Error(RESOURCE_ERROR_HEAP, TermNil, LOCAL_ErrorMessage);
return NULL;
}
}

View File

@ -485,7 +485,7 @@ int PL_error(const char *pred, int arity, const char *msg, PL_error_code id, ...
PL_ATOM, ATOM_no_memory);
break;
default:
PL_unify_atom(formal, ATOM_system_error);
PL_unify_atom(formal, ATOM_SYSTEM_ERROR_INTERNAL);
break;
}

Some files were not shown because too many files have changed in this diff Show More