Merge branch 'master' of git.dcc.fc.up.pt:yap-6.3
This commit is contained in:
commit
cd5e1211c5
42
C/stdpreds.c
42
C/stdpreds.c
@ -1530,7 +1530,6 @@ p_atom_concat( USES_REGS1 )
|
|||||||
{
|
{
|
||||||
Term t1;
|
Term t1;
|
||||||
int wide_mode = FALSE;
|
int wide_mode = FALSE;
|
||||||
UInt sz;
|
|
||||||
|
|
||||||
restart:
|
restart:
|
||||||
t1 = Deref(ARG1);
|
t1 = Deref(ARG1);
|
||||||
@ -1543,8 +1542,9 @@ p_atom_concat( USES_REGS1 )
|
|||||||
if (wide_mode) {
|
if (wide_mode) {
|
||||||
wchar_t *cptr = (wchar_t *)(((AtomEntry *)Yap_PreAllocCodeSpace())->StrOfAE), *cpt0;
|
wchar_t *cptr = (wchar_t *)(((AtomEntry *)Yap_PreAllocCodeSpace())->StrOfAE), *cpt0;
|
||||||
wchar_t *top = (wchar_t *)AuxSp;
|
wchar_t *top = (wchar_t *)AuxSp;
|
||||||
char *atom_str;
|
unsigned char *atom_str;
|
||||||
Atom ahead;
|
Atom ahead;
|
||||||
|
UInt sz;
|
||||||
|
|
||||||
cpt0 = cptr;
|
cpt0 = cptr;
|
||||||
while (IsPairTerm(t1)) {
|
while (IsPairTerm(t1)) {
|
||||||
@ -1560,26 +1560,29 @@ p_atom_concat( USES_REGS1 )
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
ahead = AtomOfTerm(thead);
|
ahead = AtomOfTerm(thead);
|
||||||
atom_str = RepAtom(ahead)->StrOfAE;
|
|
||||||
if (IsWideAtom(ahead)) {
|
if (IsWideAtom(ahead)) {
|
||||||
/* check for overflows */
|
/* check for overflows */
|
||||||
sz = wcslen((wchar_t *)atom_str);
|
sz = wcslen(RepAtom(ahead)->WStrOfAE);
|
||||||
} else {
|
} else {
|
||||||
sz = strlen(atom_str);
|
atom_str = (unsigned char *)RepAtom(ahead)->StrOfAE;
|
||||||
|
sz = strlen((char *)atom_str);
|
||||||
}
|
}
|
||||||
if (cptr+sz >= top-1024) {
|
if (cptr+sz > top+1024) {
|
||||||
Yap_ReleasePreAllocCodeSpace((ADDR)cpt0);
|
cptr = (wchar_t *)Yap_ExpandPreAllocCodeSpace(sz+1024,NULL, TRUE);
|
||||||
if (!Yap_growheap(FALSE, sz+1024, NULL)) {
|
if (cptr+sz > (wchar_t *)AuxSp+1024) {
|
||||||
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, LOCAL_ErrorMessage);
|
/* crash in flames */
|
||||||
|
Yap_Error(OUT_OF_AUXSPACE_ERROR, ARG1, "allocating temp space in atom_concat/2");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
top = (wchar_t *)AuxSp;
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
if (IsWideAtom(ahead)) {
|
if (IsWideAtom(ahead)) {
|
||||||
memcpy((void *)cptr, (void *)atom_str, sz*sizeof(wchar_t));
|
memcpy((void *)cptr, RepAtom(ahead)->WStrOfAE, sz*sizeof(wchar_t));
|
||||||
cptr += sz;
|
cptr += sz;
|
||||||
} else {
|
} else {
|
||||||
int i;
|
UInt i;
|
||||||
|
|
||||||
for (i=0; i < sz; i++) {
|
for (i=0; i < sz; i++) {
|
||||||
*cptr++ = *atom_str++;
|
*cptr++ = *atom_str++;
|
||||||
}
|
}
|
||||||
@ -1607,7 +1610,8 @@ p_atom_concat( USES_REGS1 )
|
|||||||
} else {
|
} else {
|
||||||
char *cptr = ((AtomEntry *)Yap_PreAllocCodeSpace())->StrOfAE, *cpt0;
|
char *cptr = ((AtomEntry *)Yap_PreAllocCodeSpace())->StrOfAE, *cpt0;
|
||||||
char *top = (char *)AuxSp;
|
char *top = (char *)AuxSp;
|
||||||
char *atom_str;
|
unsigned char *atom_str;
|
||||||
|
UInt sz;
|
||||||
|
|
||||||
cpt0 = cptr;
|
cpt0 = cptr;
|
||||||
while (IsPairTerm(t1)) {
|
while (IsPairTerm(t1)) {
|
||||||
@ -1627,9 +1631,9 @@ p_atom_concat( USES_REGS1 )
|
|||||||
Yap_ReleasePreAllocCodeSpace((ADDR)cpt0);
|
Yap_ReleasePreAllocCodeSpace((ADDR)cpt0);
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
atom_str = RepAtom(AtomOfTerm(thead))->StrOfAE;
|
atom_str = (unsigned char *)RepAtom(AtomOfTerm(thead))->StrOfAE;
|
||||||
/* check for overflows */
|
/* check for overflows */
|
||||||
sz = strlen(atom_str);
|
sz = strlen((char *)atom_str);
|
||||||
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)) {
|
||||||
@ -1725,9 +1729,9 @@ p_atomic_concat( USES_REGS1 )
|
|||||||
memcpy((void *)wcptr, (void *)watom_str, sz*sizeof(wchar_t));
|
memcpy((void *)wcptr, (void *)watom_str, sz*sizeof(wchar_t));
|
||||||
wcptr += sz;
|
wcptr += sz;
|
||||||
} else {
|
} else {
|
||||||
char *atom_str = RepAtom(AtomOfTerm(thead))->StrOfAE;
|
unsigned char *atom_str = (unsigned char *)RepAtom(AtomOfTerm(thead))->StrOfAE;
|
||||||
/* check for overflows */
|
/* check for overflows */
|
||||||
UInt sz = strlen(atom_str);
|
UInt sz = strlen((char *)atom_str);
|
||||||
if (wcptr+sz >= wtop-1024) {
|
if (wcptr+sz >= wtop-1024) {
|
||||||
Yap_ReleasePreAllocCodeSpace((ADDR)cpt0);
|
Yap_ReleasePreAllocCodeSpace((ADDR)cpt0);
|
||||||
if (!Yap_growheap(FALSE, sz+1024, NULL)) {
|
if (!Yap_growheap(FALSE, sz+1024, NULL)) {
|
||||||
@ -1823,7 +1827,7 @@ p_atomic_concat( USES_REGS1 )
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
if (IsAtomTerm(thead)) {
|
if (IsAtomTerm(thead)) {
|
||||||
char *atom_str;
|
unsigned char *atom_str;
|
||||||
UInt sz;
|
UInt sz;
|
||||||
|
|
||||||
if (IsWideAtom(AtomOfTerm(thead))) {
|
if (IsWideAtom(AtomOfTerm(thead))) {
|
||||||
@ -1831,9 +1835,9 @@ p_atomic_concat( USES_REGS1 )
|
|||||||
wide_mode = TRUE;
|
wide_mode = TRUE;
|
||||||
goto restart;
|
goto restart;
|
||||||
}
|
}
|
||||||
atom_str = RepAtom(AtomOfTerm(thead))->StrOfAE;
|
atom_str = (unsigned char *)RepAtom(AtomOfTerm(thead))->StrOfAE;
|
||||||
/* check for overflows */
|
/* check for overflows */
|
||||||
sz = strlen(atom_str);
|
sz = strlen((char *)atom_str);
|
||||||
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)) {
|
||||||
|
@ -18,11 +18,9 @@
|
|||||||
static char SccsId[] = "@(#)utilpreds.c 1.3";
|
static char SccsId[] = "@(#)utilpreds.c 1.3";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Yap.h"
|
#include "absmi.h"
|
||||||
#include "clause.h"
|
|
||||||
#include "YapHeap.h"
|
#include "YapHeap.h"
|
||||||
#include "yapio.h"
|
#include "yapio.h"
|
||||||
#include "eval.h"
|
|
||||||
#include "attvar.h"
|
#include "attvar.h"
|
||||||
#ifdef HAVE_STRING_H
|
#ifdef HAVE_STRING_H
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
@ -4370,6 +4368,10 @@ static Int numbervars_in_complex_term(register CELL *pt0, register CELL *pt0_end
|
|||||||
goto trail_overflow;
|
goto trail_overflow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(TABLING) || defined(YAPOR_SBA)
|
||||||
|
TrailVal(TR) = (CELL)ptd0;
|
||||||
|
#endif
|
||||||
TrailTerm(TR++) = (CELL)ptd0;
|
TrailTerm(TR++) = (CELL)ptd0;
|
||||||
}
|
}
|
||||||
/* Do we still have compound terms to visit */
|
/* Do we still have compound terms to visit */
|
||||||
@ -4387,6 +4389,7 @@ static Int numbervars_in_complex_term(register CELL *pt0, register CELL *pt0_end
|
|||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prune(B);
|
||||||
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
|
Yap_ReleasePreAllocCodeSpace((ADDR)to_visit0);
|
||||||
return numbv;
|
return numbv;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user