replace SYSTEM_ERROR by out OUT_OF_WHATEVER_ERROR whenever appropriate.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1180 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2004-11-19 22:08:43 +00:00
parent 7d245377a3
commit 9dfcbc1de9
15 changed files with 66 additions and 46 deletions

View File

@ -10,8 +10,11 @@
* * * *
* File: absmi.c * * File: absmi.c *
* comments: Portable abstract machine interpreter * * comments: Portable abstract machine interpreter *
* Last rev: $Date: 2004-11-19 17:14:12 $,$Author: vsc $ * * Last rev: $Date: 2004-11-19 22:08:35 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.152 2004/11/19 17:14:12 vsc
* a few fixes for 64 bit compiling.
*
* Revision 1.151 2004/11/04 18:22:28 vsc * Revision 1.151 2004/11/04 18:22:28 vsc
* don't ever use memory that has been freed (that was done by LU). * don't ever use memory that has been freed (that was done by LU).
* generic fixes for WIN32 libraries * generic fixes for WIN32 libraries
@ -12617,7 +12620,7 @@ Yap_absmi(int inp)
if (ActiveSignals & YAP_CDOVF_SIGNAL) { if (ActiveSignals & YAP_CDOVF_SIGNAL) {
saveregs_and_ycache(); saveregs_and_ycache();
if (!Yap_growheap(FALSE, 0, NULL)) { if (!Yap_growheap(FALSE, 0, NULL)) {
Yap_Error(SYSTEM_ERROR, TermNil, "YAP failed to grow heap: %s", Yap_ErrorMessage); Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "YAP failed to grow heap: %s", Yap_ErrorMessage);
setregs_and_ycache(); setregs_and_ycache();
FAIL(); FAIL();
} }

View File

@ -12,7 +12,7 @@
* Last rev: * * Last rev: *
* mods: * * mods: *
* comments: allocating space * * comments: allocating space *
* version:$Id: alloc.c,v 1.65 2004-11-17 05:24:20 vsc Exp $ * * version:$Id: alloc.c,v 1.66 2004-11-19 22:08:40 vsc Exp $ *
*************************************************************************/ *************************************************************************/
#ifdef SCCS #ifdef SCCS
static char SccsId[] = "%W% %G%"; static char SccsId[] = "%W% %G%";
@ -99,7 +99,7 @@ Yap_InitPreAllocCodeSpace(void)
if (ScratchPad.ptr == NULL) { if (ScratchPad.ptr == NULL) {
while (!(ptr = malloc(sz))) while (!(ptr = malloc(sz)))
if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) { if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) {
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage); Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
return(NULL); return(NULL);
} }
ScratchPad.ptr = ptr; ScratchPad.ptr = ptr;
@ -476,7 +476,7 @@ AllocHeap(unsigned int size)
UNLOCK(HeapUsedLock); UNLOCK(HeapUsedLock);
UNLOCK(HeapTopLock); UNLOCK(HeapTopLock);
/* we destroyed the stack */ /* we destroyed the stack */
Yap_Error(SYSTEM_ERROR, TermNil, "Stack Crashed against Heap..."); Yap_Error(OUT_OF_HEAP_ERROR, TermNil, "Stack Crashed against Heap...");
return(NULL); return(NULL);
} else { } else {
if (HeapTop + size * sizeof(CELL) + sizeof(YAP_SEG_SIZE) < HeapLim) { if (HeapTop + size * sizeof(CELL) + sizeof(YAP_SEG_SIZE) < HeapLim) {

View File

@ -11,8 +11,11 @@
* File: amasm.c * * File: amasm.c *
* comments: abstract machine assembler * * comments: abstract machine assembler *
* * * *
* Last rev: $Date: 2004-10-26 20:15:48 $ * * Last rev: $Date: 2004-11-19 22:08:41 $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.65 2004/10/26 20:15:48 vsc
* More bug fixes for overflow handling
*
* Revision 1.64 2004/09/30 21:37:40 vsc * Revision 1.64 2004/09/30 21:37:40 vsc
* fixes for thread support * fixes for thread support
* *
@ -2968,7 +2971,7 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
while ((x = Yap_StoreTermInDBPlusExtraSpace(t, size)) == NULL) { while ((x = Yap_StoreTermInDBPlusExtraSpace(t, size)) == NULL) {
*H++ = (CELL)h0; *H++ = (CELL)h0;
if (!Yap_growheap(TRUE, size, cip)) { if (!Yap_growheap(TRUE, size, cip)) {
Yap_Error_TYPE = SYSTEM_ERROR; Yap_Error_TYPE = OUT_OF_HEAP_ERROR;
return NULL; return NULL;
} }
h0 = (CELL *)*--H; h0 = (CELL *)*--H;
@ -3024,7 +3027,7 @@ Yap_assemble(int mode, Term t, PredEntry *ap, int is_fact, struct intermediates
while ((cip->code_addr = (yamop *) Yap_AllocCodeSpace(size)) == NULL) { while ((cip->code_addr = (yamop *) Yap_AllocCodeSpace(size)) == NULL) {
if (!Yap_growheap(TRUE, size, cip)) { if (!Yap_growheap(TRUE, size, cip)) {
Yap_Error_TYPE = SYSTEM_ERROR; Yap_Error_TYPE = OUT_OF_HEAP_ERROR;
return NULL; return NULL;
} }
} }

View File

@ -465,7 +465,7 @@ AllocateStaticArraySpace(StaticArrayEntry *p, static_array_types atype, Int arra
while ((p->ValueOfVE.floats = (Float *) Yap_AllocAtomSpace(asize) ) == NULL) { while ((p->ValueOfVE.floats = (Float *) Yap_AllocAtomSpace(asize) ) == NULL) {
YAPLeaveCriticalSection(); YAPLeaveCriticalSection();
if (!Yap_growheap(FALSE, asize, NULL)) { if (!Yap_growheap(FALSE, asize, NULL)) {
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage); Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
return; return;
} }
YAPEnterCriticalSection(); YAPEnterCriticalSection();
@ -479,7 +479,7 @@ CreateStaticArray(AtomEntry *ae, Int dim, static_array_types type, CODEADDR star
if (EndOfPAEntr(p)) { if (EndOfPAEntr(p)) {
while ((p = (StaticArrayEntry *) Yap_AllocAtomSpace(sizeof(*p))) == NULL) { while ((p = (StaticArrayEntry *) Yap_AllocAtomSpace(sizeof(*p))) == NULL) {
if (!Yap_growheap(FALSE, sizeof(*p), NULL)) { if (!Yap_growheap(FALSE, sizeof(*p), NULL)) {
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage); Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
return NULL; return NULL;
} }
} }
@ -646,7 +646,7 @@ p_create_array(void)
} else { } else {
if (H+1+size > ASP-1024) { if (H+1+size > ASP-1024) {
if (!Yap_growstack( sizeof(CELL) * (size+1-(H-ASP-1024)))) { if (!Yap_growstack( sizeof(CELL) * (size+1-(H-ASP-1024)))) {
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage); Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
return FALSE; return FALSE;
} }
} }
@ -1880,7 +1880,7 @@ p_static_array_to_term(void)
} else { } else {
if (H+1+dim > ASP-1024) { if (H+1+dim > ASP-1024) {
if (!Yap_growstack( sizeof(CELL) * (dim+1-(H-ASP-1024)))) { if (!Yap_growstack( sizeof(CELL) * (dim+1-(H-ASP-1024)))) {
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage); Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
return FALSE; return FALSE;
} }
} }

8
C/bb.c
View File

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

View File

@ -10,8 +10,13 @@
* File: c_interface.c * * File: c_interface.c *
* comments: c_interface primitives definition * * comments: c_interface primitives definition *
* * * *
* Last rev: $Date: 2004-11-18 22:32:31 $,$Author: vsc $ * * Last rev: $Date: 2004-11-19 22:08:41 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.57 2004/11/18 22:32:31 vsc
* fix situation where we might assume nonextsing double initialisation of C predicates (use
* Hidden Pred Flag).
* $host_type was double initialised.
*
* Revision 1.56 2004/10/31 02:18:03 vsc * Revision 1.56 2004/10/31 02:18:03 vsc
* fix bug in handling Yap heap overflow while adding new clause. * fix bug in handling Yap heap overflow while adding new clause.
* *
@ -715,7 +720,7 @@ YAP_AllocSpaceFromYap(unsigned int size)
if ((ptr = Yap_AllocCodeSpace(size)) == NULL) { if ((ptr = Yap_AllocCodeSpace(size)) == NULL) {
if (!Yap_growheap(FALSE, size, NULL)) { if (!Yap_growheap(FALSE, size, NULL)) {
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage); Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
return(NULL); return(NULL);
} }
} }

View File

@ -11,8 +11,11 @@
* File: compiler.c * * File: compiler.c *
* comments: Clause compiler * * comments: Clause compiler *
* * * *
* Last rev: $Date: 2004-09-03 03:11:08 $,$Author: vsc $ * * Last rev: $Date: 2004-11-19 22:08:41 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.53 2004/09/03 03:11:08 vsc
* memory management fixes
*
* Revision 1.52 2004/07/15 17:20:23 vsc * Revision 1.52 2004/07/15 17:20:23 vsc
* fix error message * fix error message
* change makefile and configure for clpbn * change makefile and configure for clpbn
@ -2770,7 +2773,7 @@ Yap_cclause(Term inp_clause, int NOfArgs, int mod, Term src)
} }
if (osize > ASP-H) { if (osize > ASP-H) {
if (!Yap_growstack(2*sizeof(CELL)*(ASP-H))) { if (!Yap_growstack(2*sizeof(CELL)*(ASP-H))) {
Yap_Error_TYPE = SYSTEM_ERROR; Yap_Error_TYPE = OUT_OF_STACK_ERROR;
Yap_Error_Term = my_clause; Yap_Error_Term = my_clause;
} }
} }
@ -2791,7 +2794,7 @@ Yap_cclause(Term inp_clause, int NOfArgs, int mod, Term src)
/* not enough heap */ /* not enough heap */
restore_machine_regs(); restore_machine_regs();
reset_vars(cglobs.vtable); reset_vars(cglobs.vtable);
Yap_Error_TYPE = SYSTEM_ERROR; Yap_Error_TYPE = OUT_OF_HEAP_ERROR;
Yap_Error_Term = TermNil; Yap_Error_Term = TermNil;
return(0); return(0);
} }

View File

@ -1290,7 +1290,7 @@ Yap_RunTopGoal(Term t)
#if !USE_MALLOC #if !USE_MALLOC
if (Yap_TrailTop - HeapTop < 2048) { if (Yap_TrailTop - HeapTop < 2048) {
Yap_PrologMode = BootMode; Yap_PrologMode = BootMode;
Yap_Error(SYSTEM_ERROR,TermNil, Yap_Error(OUT_OF_TRAIL_ERROR,TermNil,
"unable to boot because of too little heap space"); "unable to boot because of too little heap space");
} }
#endif #endif

View File

@ -818,7 +818,7 @@ do_growheap(int fix_code, UInt in_size, struct intermediates *cip)
sz = in_size; sz = in_size;
} }
#if YAPOR #if YAPOR
Yap_Error(SYSTEM_ERROR,TermNil,"cannot grow Heap: more than a worker/thread running"); Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"cannot grow Heap: more than a worker/thread running");
return FALSE; return FALSE;
#endif #endif
if (SizeOfOverflow > sz) if (SizeOfOverflow > sz)
@ -959,7 +959,7 @@ Yap_growglobal(CELL **ptr)
#if YAPOR #if YAPOR
if (NOfThreads != 1) { if (NOfThreads != 1) {
Yap_Error(SYSTEM_ERROR,TermNil,"cannot grow Global: more than a worker/thread running"); Yap_Error(OUT_OF_STACK_ERROR,TermNil,"cannot grow Global: more than a worker/thread running");
return(FALSE); return(FALSE);
} }
#endif #endif
@ -1167,7 +1167,7 @@ Yap_growstack_in_parser(tr_fr_ptr *old_trp, TokEntry **tksp, VarEntry **vep)
#if YAPOR #if YAPOR
if (NOfThreads != 1) { if (NOfThreads != 1) {
Yap_Error(SYSTEM_ERROR,TermNil,"cannot grow Parser Stack: more than a worker/thread running"); Yap_Error(OUT_OF_STACK_ERROR,TermNil,"cannot grow Parser Stack: more than a worker/thread running");
return(FALSE); return(FALSE);
} }
#endif #endif
@ -1298,7 +1298,7 @@ Yap_shift_visit(CELL **to_visit, CELL ***to_visit_maxp)
cpcellsd((CELL *)dest, (CELL *)to_visit, (CELL)((CELL *)old_top-(CELL *)to_visit)); cpcellsd((CELL *)dest, (CELL *)to_visit, (CELL)((CELL *)old_top-(CELL *)to_visit));
return dest; return dest;
} else { } else {
Yap_Error(SYSTEM_ERROR,TermNil,"cannot grow temporary stack for unification (%p)", Yap_TrailTop); Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"cannot grow temporary stack for unification (%p)", Yap_TrailTop);
return to_visit; return to_visit;
} }
#endif #endif

View File

@ -3338,7 +3338,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
max = (CELL *)Yap_ReadTimedVar(DelayedVars); max = (CELL *)Yap_ReadTimedVar(DelayedVars);
if (H0 - max < 1024+(2*NUM_OF_ATTS)) { if (H0 - max < 1024+(2*NUM_OF_ATTS)) {
if (!Yap_growglobal(&current_env)) { if (!Yap_growglobal(&current_env)) {
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage); Yap_Error(OUT_OF_STACK_ERROR, TermNil, Yap_ErrorMessage);
return 0; return 0;
} }
} }
@ -3397,7 +3397,7 @@ do_gc(Int predarity, CELL *current_env, yamop *nextop)
if (HeapTop >= Yap_GlobalBase - MinHeapGap) { if (HeapTop >= Yap_GlobalBase - MinHeapGap) {
*--ASP = (CELL)current_env; *--ASP = (CELL)current_env;
if (!Yap_growheap(FALSE, MinHeapGap, NULL)) { if (!Yap_growheap(FALSE, MinHeapGap, NULL)) {
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage); Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
return(FALSE); return(FALSE);
} }
current_env = (CELL *)*ASP; current_env = (CELL *)*ASP;

View File

@ -11,8 +11,11 @@
* File: index.c * * File: index.c *
* comments: Indexing a Prolog predicate * * comments: Indexing a Prolog predicate *
* * * *
* Last rev: $Date: 2004-11-19 17:14:14 $,$Author: vsc $ * * Last rev: $Date: 2004-11-19 22:08:42 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.107 2004/11/19 17:14:14 vsc
* a few fixes for 64 bit compiling.
*
* Revision 1.106 2004/11/18 22:32:36 vsc * Revision 1.106 2004/11/18 22:32:36 vsc
* fix situation where we might assume nonextsing double initialisation of C predicates (use * fix situation where we might assume nonextsing double initialisation of C predicates (use
* Hidden Pred Flag). * Hidden Pred Flag).
@ -473,7 +476,7 @@ sort_group(GroupDef *grp, CELL *top, struct intermediates *cint)
longjmp(cint->CompilerBotch,4); longjmp(cint->CompilerBotch,4);
#else #else
if (!Yap_growtrail(2*max*CellSize)) { if (!Yap_growtrail(2*max*CellSize)) {
Yap_Error(SYSTEM_ERROR,TermNil,"YAP failed to reserve %ld in growtrail", Yap_Error(OUT_OF_TRAIL_ERROR,TermNil,"YAP failed to reserve %ld in growtrail",
2*max*CellSize); 2*max*CellSize);
return; return;
} }
@ -4040,7 +4043,7 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots)
} else if (setjres != 0) { } else if (setjres != 0) {
recover_from_failed_susp_on_cls(&cint, 0); recover_from_failed_susp_on_cls(&cint, 0);
if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) { if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) {
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage); Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
return FAILCODE; return FAILCODE;
} }
} }
@ -4062,7 +4065,7 @@ Yap_PredIsIndexable(PredEntry *ap, UInt NSlots)
if (cint.CodeStart) { if (cint.CodeStart) {
if ((indx_out = Yap_assemble(ASSEMBLING_INDEX, TermNil, ap, FALSE, &cint)) == NULL) { if ((indx_out = Yap_assemble(ASSEMBLING_INDEX, TermNil, ap, FALSE, &cint)) == NULL) {
if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) { if (!Yap_growheap(FALSE, Yap_Error_Size, NULL)) {
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage); Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
return NULL; return NULL;
} }
goto restart_index; goto restart_index;

View File

@ -660,8 +660,8 @@ Yap_InitCPredBack(char *Name, unsigned long int Arity, unsigned int Extra, CPred
pe->PredFlags |= SequentialPredFlag; pe->PredFlags |= SequentialPredFlag;
#endif /* YAPOR */ #endif /* YAPOR */
cl = (StaticClause *)Yap_AllocCodeSpace((CELL)NEXTOP(NEXTOP(NEXTOP(code,lds),lds),e)); cl = (StaticClause *)Yap_AllocCodeSpace((CELL)NEXTOP(NEXTOP(NEXTOP(code,lds),lds),e));
if (cl == NIL) { if (cl == NULL) {
Yap_Error(SYSTEM_ERROR,TermNil,"No Heap Space in InitCPredBack"); Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"No Heap Space in InitCPredBack");
return; return;
} }
cl->ClFlags = 0; cl->ClFlags = 0;
@ -860,8 +860,8 @@ InitCodes(void)
INIT_RWLOCK(heap_regs->invisiblechain.AERWLock); INIT_RWLOCK(heap_regs->invisiblechain.AERWLock);
heap_regs->consultlow = (consult_obj *)Yap_AllocCodeSpace(sizeof(consult_obj)*InitialConsultCapacity); heap_regs->consultlow = (consult_obj *)Yap_AllocCodeSpace(sizeof(consult_obj)*InitialConsultCapacity);
if (heap_regs->consultlow == NIL) { if (heap_regs->consultlow == NULL) {
Yap_Error(SYSTEM_ERROR,TermNil,"No Heap Space in InitCodes"); Yap_Error(OUT_OF_HEAP_ERROR,TermNil,"No Heap Space in InitCodes");
return; return;
} }
heap_regs->consultcapacity = InitialConsultCapacity; heap_regs->consultcapacity = InitialConsultCapacity;

View File

@ -1228,7 +1228,7 @@ PipeGetc(int sno)
#if _MSC_VER || defined(__MINGW32__) #if _MSC_VER || defined(__MINGW32__)
DWORD count; DWORD count;
if (WriteFile(s->u.pipe.hdl, &c, sizeof(c), &count, NULL) == FALSE) { if (WriteFile(s->u.pipe.hdl, &c, sizeof(c), &count, NULL) == FALSE) {
PlIOError (SYSTEM_ERROR,TermNil, "read from pipe returned error"); PlIOError (SYSTEM_ERROR,TermNil, "write to pipe returned error");
return(EOF); return(EOF);
} }
#else #else
@ -2054,7 +2054,7 @@ p_open_mem_read_stream (void) /* $open_mem_read_stream(+List,-Stream) */
} }
while ((nbuf = (char *)Yap_AllocAtomSpace((sl+1)*sizeof(char))) == NULL) { while ((nbuf = (char *)Yap_AllocAtomSpace((sl+1)*sizeof(char))) == NULL) {
if (!Yap_growheap(FALSE, (sl+1)*sizeof(char), NULL)) { if (!Yap_growheap(FALSE, (sl+1)*sizeof(char), NULL)) {
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage); Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
return(FALSE); return(FALSE);
} }
} }
@ -2115,7 +2115,7 @@ p_open_mem_write_stream (void) /* $open_mem_write_stream(-Stream) */
while ((nbuf = (char *)Yap_AllocAtomSpace(Yap_page_size*sizeof(char))) == NULL) { while ((nbuf = (char *)Yap_AllocAtomSpace(Yap_page_size*sizeof(char))) == NULL) {
if (!Yap_growheap(FALSE, Yap_page_size*sizeof(char), NULL)) { if (!Yap_growheap(FALSE, Yap_page_size*sizeof(char), NULL)) {
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage); Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
return(FALSE); return(FALSE);
} }
} }
@ -4550,7 +4550,7 @@ p_char_conversion(void)
CharConversionTable2 = Yap_AllocCodeSpace(NUMBER_OF_CHARS*sizeof(char)); CharConversionTable2 = Yap_AllocCodeSpace(NUMBER_OF_CHARS*sizeof(char));
while (CharConversionTable2 == NULL) { while (CharConversionTable2 == NULL) {
if (!Yap_growheap(FALSE, NUMBER_OF_CHARS*sizeof(char), NULL)) { if (!Yap_growheap(FALSE, NUMBER_OF_CHARS*sizeof(char), NULL)) {
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage); Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
return(FALSE); return(FALSE);
} }
} }

View File

@ -964,7 +964,7 @@ rehash(CELL *oldcode, int NOfE, int KindOfEntries)
basep = (CELL *)TR; basep = (CELL *)TR;
if (basep + (NOfE*2) > (CELL *)Yap_TrailTop) { if (basep + (NOfE*2) > (CELL *)Yap_TrailTop) {
if (!Yap_growtrail((ADDR)(basep + (NOfE*2))-Yap_TrailTop)) { if (!Yap_growtrail((ADDR)(basep + (NOfE*2))-Yap_TrailTop)) {
Yap_Error(SYSTEM_ERROR, TermNil, Yap_Error(OUT_OF_TRAIL_ERROR, TermNil,
"not enough space to restore hash tables for indexing"); "not enough space to restore hash tables for indexing");
Yap_exit(1); Yap_exit(1);
} }

View File

@ -11,8 +11,11 @@
* File: stdpreds.c * * File: stdpreds.c *
* comments: General-purpose C implemented system predicates * * comments: General-purpose C implemented system predicates *
* * * *
* Last rev: $Date: 2004-11-19 17:14:14 $,$Author: vsc $ * * Last rev: $Date: 2004-11-19 22:08:43 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $ * $Log: not supported by cvs2svn $
* Revision 1.73 2004/11/19 17:14:14 vsc
* a few fixes for 64 bit compiling.
*
* Revision 1.72 2004/11/18 22:32:37 vsc * Revision 1.72 2004/11/18 22:32:37 vsc
* fix situation where we might assume nonextsing double initialisation of C predicates (use * fix situation where we might assume nonextsing double initialisation of C predicates (use
* Hidden Pred Flag). * Hidden Pred Flag).
@ -1105,7 +1108,7 @@ p_atom_concat(void)
if (cptr+sz >= top-1024) { if (cptr+sz >= top-1024) {
Yap_ReleasePreAllocCodeSpace((ADDR)cpt0); Yap_ReleasePreAllocCodeSpace((ADDR)cpt0);
if (!Yap_growheap(FALSE, sz+1024, NULL)) { if (!Yap_growheap(FALSE, sz+1024, NULL)) {
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage); Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
return(FALSE); return(FALSE);
} }
goto restart; goto restart;
@ -1167,7 +1170,7 @@ p_atomic_concat(void)
if (cptr+sz >= top-1024) { if (cptr+sz >= top-1024) {
Yap_ReleasePreAllocCodeSpace((ADDR)cpt0); Yap_ReleasePreAllocCodeSpace((ADDR)cpt0);
if (!Yap_growheap(FALSE, sz+1024, NULL)) { if (!Yap_growheap(FALSE, sz+1024, NULL)) {
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage); Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
return(FALSE); return(FALSE);
} }
goto restart; goto restart;
@ -1196,7 +1199,7 @@ p_atomic_concat(void)
if ((sz = mpz_sizeinbase (n, 10)) > (top-cptr)-1024) { if ((sz = mpz_sizeinbase (n, 10)) > (top-cptr)-1024) {
Yap_ReleasePreAllocCodeSpace((ADDR)cpt0); Yap_ReleasePreAllocCodeSpace((ADDR)cpt0);
if (!Yap_growheap(FALSE, sz+1024, NULL)) { if (!Yap_growheap(FALSE, sz+1024, NULL)) {
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage); Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
return(FALSE); return(FALSE);
} }
goto restart; goto restart;
@ -1361,7 +1364,7 @@ p_atom_split(void)
if (len > (Int)strlen(s)) return(FALSE); if (len > (Int)strlen(s)) return(FALSE);
for (i = 0; i< len; i++) { for (i = 0; i< len; i++) {
if (s1 > (char *)LCL0-1024) if (s1 > (char *)LCL0-1024)
Yap_Error(SYSTEM_ERROR,t1,"$atom_split/4"); Yap_Error(OUT_OF_STACK_ERROR,t1,"$atom_split/4");
s1[i] = s[i]; s1[i] = s[i];
} }
s1[len] = '\0'; s1[len] = '\0';