Avoid complaining from strlen

`
This commit is contained in:
Vítor Santos Costa 2015-09-21 17:05:36 -05:00
parent 880a9989c3
commit 4336b2ba88
469 changed files with 207364 additions and 9193 deletions

View File

@ -42,7 +42,7 @@ BOp(Ystop, l);
\************************************************************************/
#if YAP_JIT
static void *OpAddress[] =
static void *OpAddress_JIT[] =
{
#define OPCODE(OP,TYPE) && _##OP
#include "YapOpcodes.h"

View File

@ -106,13 +106,13 @@ Yap_MkFunctorWithAddress(Atom ap, unsigned int arity, FunctorEntry *p)
}
inline static Atom
SearchInInvisible(const char *atom)
SearchInInvisible(const unsigned char *atom)
{
AtomEntry *chain;
READ_LOCK(INVISIBLECHAIN.AERWLock);
chain = RepAtom(INVISIBLECHAIN.Entry);
while (!EndOfPAEntr(chain) && strcmp(chain->StrOfAE, atom)) {
while (!EndOfPAEntr(chain) && strcmp((char *)chain->StrOfAE, (char *)atom)) {
chain = RepAtom(chain->NextOfAE);
}
READ_UNLOCK(INVISIBLECHAIN.AERWLock);
@ -123,13 +123,13 @@ SearchInInvisible(const char *atom)
}
static inline Atom
SearchAtom(const char *p, Atom a) {
SearchAtom(const unsigned char *p, Atom a) {
AtomEntry *ae;
/* search atom in chain */
while (a != NIL) {
ae = RepAtom(a);
if (strcmp(ae->StrOfAE, (const char *)p) == 0) {
if (strcmp((char *)ae->StrOfAE, (const char *)p) == 0) {
return(a);
}
a = ae->NextOfAE;
@ -153,10 +153,10 @@ SearchWideAtom(const wchar_t *p, Atom a) {
}
static Atom
LookupAtom(const char *atom)
LookupAtom(const unsigned char *atom)
{ /* lookup atom in atom table */
UInt hash;
const char *p;
const unsigned char *p;
Atom a, na;
AtomEntry *ae;
@ -188,7 +188,7 @@ LookupAtom(const char *atom)
}
#endif
/* add new atom to start of chain */
ae = (AtomEntry *) Yap_AllocAtomSpace((sizeof *ae) + strlen(atom) + 1);
ae = (AtomEntry *) Yap_AllocAtomSpace((sizeof *ae) + strlen((const char *)atom) + 1);
if (ae == NULL) {
WRITE_UNLOCK(HashChain[hash].AERWLock);
return NIL;
@ -196,8 +196,8 @@ LookupAtom(const char *atom)
NOfAtoms++;
na = AbsAtom(ae);
ae->PropsOfAE = NIL;
if (ae->StrOfAE != atom)
strcpy(ae->StrOfAE, atom);
if (ae->UStrOfAE != atom)
strcpy((char *)ae->StrOfAE, (const char *)atom);
ae->NextOfAE = a;
HashChain[hash].Entry = na;
INIT_RWLOCK(ae->ARWLock);
@ -282,7 +282,7 @@ Yap_LookupMaybeWideAtom(const wchar_t *atom)
{ /* lookup atom in atom table */
wchar_t *p = (wchar_t *)atom, c;
size_t len = 0;
char *ptr, *ptr0;
unsigned char *ptr, *ptr0;
Atom at;
while ((c = *p++)) {
@ -332,9 +332,9 @@ Yap_LookupMaybeWideAtomWithLength(const wchar_t *atom, size_t len0)
Yap_FreeCodeSpace((char *)ptr0);
return at;
} else {
char *ptr0;
unsigned char *ptr0;
ptr0 = (char *)Yap_AllocCodeSpace((len0+1));
ptr0 = Yap_AllocCodeSpace((len0+1));
if (!ptr0)
return NIL;
for (i=0;i<len0;i++)
@ -347,10 +347,10 @@ Yap_LookupMaybeWideAtomWithLength(const wchar_t *atom, size_t len0)
}
Atom
Yap_LookupAtomWithLength(const char *atom, size_t len0)
Yap_LookupAtomWithLength(const char *atom, size_t len0)
{ /* lookup atom in atom table */
Atom at;
char *ptr;
unsigned char *ptr;
/* not really a wide atom */
ptr = Yap_AllocCodeSpace(len0+1);
@ -364,7 +364,13 @@ Yap_LookupAtomWithLength(const char *atom, size_t len0)
}
Atom
Yap_LookupAtom(const char *atom)
Yap_LookupAtom(const char *atom)
{ /* lookup atom in atom table */
return LookupAtom((const unsigned char *)atom);
}
Atom
Yap_ULookupAtom(const unsigned char *atom)
{ /* lookup atom in atom table */
return LookupAtom(atom);
}
@ -380,10 +386,10 @@ Yap_FullLookupAtom(const char *atom)
{ /* lookup atom in atom table */
Atom t;
if ((t = SearchInInvisible(atom)) != NIL) {
if ((t = SearchInInvisible((const unsigned char *)atom)) != NIL) {
return (t);
}
return(LookupAtom(atom));
return(LookupAtom((const unsigned char *)atom));
}
void
@ -391,11 +397,11 @@ Yap_LookupAtomWithAddress(const char *atom,
AtomEntry *ae)
{ /* lookup atom in atom table */
register CELL hash;
register const char *p;
register const unsigned char *p;
Atom a;
/* compute hash */
p = atom;
p = (const unsigned char *)atom;
hash = HashFunction(p) % AtomHashTableSize;
/* ask for a WRITE lock because it is highly unlikely we shall find anything */
WRITE_LOCK(HashChain[hash].AERWLock);
@ -411,7 +417,7 @@ Yap_LookupAtomWithAddress(const char *atom,
ae->NextOfAE = a;
HashChain[hash].Entry = AbsAtom(ae);
ae->PropsOfAE = NIL;
strcpy(ae->StrOfAE, atom);
strcpy((char *)ae->StrOfAE, (char *)atom);
INIT_RWLOCK(ae->ARWLock);
WRITE_UNLOCK(HashChain[hash].AERWLock);
}
@ -420,10 +426,10 @@ void
Yap_ReleaseAtom(Atom atom)
{ /* Releases an atom from the hash chain */
register Int hash;
register const char *p;
register const unsigned char *p;
AtomEntry *inChain;
AtomEntry *ap = RepAtom(atom);
char *name = ap->StrOfAE;
char unsigned *name = ap->UStrOfAE;
/* compute hash */
p = name;

View File

@ -437,6 +437,7 @@ clean_atom_list(AtomHashEntry *HashPtr)
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;
Yap_FreeCodeSpace((char *)at);

View File

@ -151,7 +151,7 @@ call_malloc(size_t size)
return out;
}
char *
void *
Yap_AllocCodeSpace(size_t size)
{
size = AdjustSize(size);
@ -186,15 +186,15 @@ call_realloc(char *p, size_t size)
return out;
}
char *
Yap_ReallocCodeSpace(char *p, size_t size)
void *
Yap_ReallocCodeSpace(void *p, size_t size)
{
size = AdjustSize(size);
return call_realloc(p, size);
}
void
Yap_FreeCodeSpace(char *p)
Yap_FreeCodeSpace(void *p)
{
CACHE_REGS
#if USE_DL_MALLOC
@ -213,7 +213,7 @@ Yap_FreeCodeSpace(char *p)
#endif
}
char *
void *
Yap_AllocAtomSpace(size_t size)
{
size = AdjustSize(size);
@ -221,7 +221,7 @@ Yap_AllocAtomSpace(size_t size)
}
void
Yap_FreeAtomSpace(char *p)
Yap_FreeAtomSpace(void *p)
{
CACHE_REGS
#if USE_DL_MALLOC

View File

@ -260,7 +260,7 @@ static yamop *a_either(op_numbers, CELL, CELL, yamop *, int, struct intermediat
#endif /* YAPOR */
static yamop *a_gl(op_numbers, yamop *, int, struct PSEUDO *, struct intermediates * CACHE_TYPE);
static
COUNT compile_cmp_flags(char *);
COUNT compile_cmp_flags(unsigned char *);
static yamop *a_igl(CELL, op_numbers, yamop *, int, struct intermediates *);
static yamop *a_xigl(op_numbers, yamop *, int, struct PSEUDO *);
static yamop *a_ucons(int *, compiler_vm_op, yamop *, int, struct intermediates *);
@ -1587,8 +1587,10 @@ a_pl(op_numbers opcode, PredEntry *pred, yamop *code_p, int pass_no)
}
static COUNT
compile_cmp_flags(char *s)
compile_cmp_flags(unsigned char *s0)
{
char *s = (char *)s0;
if (strcmp(s,"=<") == 0)
return EQ_OK_IN_CMP|LT_OK_IN_CMP;
if (strcmp(s,"is") == 0)
@ -1621,7 +1623,7 @@ COUNT
Yap_compile_cmp_flags(PredEntry *pred)
{
return
compile_cmp_flags(RepAtom(NameOfFunctor(pred->FunctorOfPred))->StrOfAE);
compile_cmp_flags(RepAtom(NameOfFunctor(pred->FunctorOfPred))->UStrOfAE);
}
static yamop *
@ -1644,7 +1646,7 @@ a_bfunc(CELL a1, CELL a2, PredEntry *pred, clause_info *clinfo, yamop *code_p, i
code_p->y_u.plyys.f = emit_fail(cip);
code_p->y_u.plyys.y1 = v1;
code_p->y_u.plyys.y2 = emit_yreg(var_offset2);
code_p->y_u.plyys.flags = compile_cmp_flags(RepAtom(NameOfFunctor(RepPredProp(((Prop)pred))->FunctorOfPred))->StrOfAE);
code_p->y_u.plyys.flags = compile_cmp_flags(RepAtom(NameOfFunctor(RepPredProp(((Prop)pred))->FunctorOfPred))->UStrOfAE);
}
GONEXT(plyys);
} else {
@ -1654,7 +1656,7 @@ a_bfunc(CELL a1, CELL a2, PredEntry *pred, clause_info *clinfo, yamop *code_p, i
code_p->y_u.plxys.f = emit_fail(cip);
code_p->y_u.plxys.x = emit_xreg(var_offset2);
code_p->y_u.plxys.y = v1;
code_p->y_u.plxys.flags = compile_cmp_flags(RepAtom(NameOfFunctor(RepPredProp(((Prop)pred))->FunctorOfPred))->StrOfAE);
code_p->y_u.plxys.flags = compile_cmp_flags(RepAtom(NameOfFunctor(RepPredProp(((Prop)pred))->FunctorOfPred))->UStrOfAE);
}
GONEXT(plxys);
}
@ -1671,7 +1673,7 @@ a_bfunc(CELL a1, CELL a2, PredEntry *pred, clause_info *clinfo, yamop *code_p, i
code_p->y_u.plxys.f = emit_fail(cip);
code_p->y_u.plxys.x = x1;
code_p->y_u.plxys.y = emit_yreg(var_offset2);
code_p->y_u.plxys.flags = compile_cmp_flags(RepAtom(NameOfFunctor(RepPredProp(((Prop)pred))->FunctorOfPred))->StrOfAE);
code_p->y_u.plxys.flags = compile_cmp_flags(RepAtom(NameOfFunctor(RepPredProp(((Prop)pred))->FunctorOfPred))->UStrOfAE);
}
GONEXT(plxys);
} else {
@ -1682,7 +1684,7 @@ a_bfunc(CELL a1, CELL a2, PredEntry *pred, clause_info *clinfo, yamop *code_p, i
code_p->y_u.plxxs.f = emit_fail(cip);
code_p->y_u.plxxs.x1 = x1;
code_p->y_u.plxxs.x2 = emit_xreg(var_offset2);
code_p->y_u.plxxs.flags = compile_cmp_flags(RepAtom(NameOfFunctor(RepPredProp(((Prop)pred))->FunctorOfPred))->StrOfAE);
code_p->y_u.plxxs.flags = compile_cmp_flags(RepAtom(NameOfFunctor(RepPredProp(((Prop)pred))->FunctorOfPred))->UStrOfAE);
}
GONEXT(plxxs);
}

View File

@ -18,7 +18,7 @@ matchKey(Atom key, xarg *e0, int n, const param_t *def)
{
int i;
for (i=0; i< n; i++) {
if (!strcmp(def->name, RepAtom(key)->StrOfAE)) {
if (!strcmp((char *)def->name, (char *)RepAtom(key)->StrOfAE)) {
return e0;
}
def++;
@ -31,7 +31,9 @@ xarg *
Yap_ArgListToVector (Term listl, const param_t *def, int n)
{
CACHE_REGS
if (!IsPairTerm(listl) && listl != TermNil) {
if (IsApplTerm(listl) && FunctorOfTerm(listl) == FunctorModule)
listl = ArgOfTerm(2,listl);
if (!IsPairTerm(listl) && listl != TermNil) {
listl = MkPairTerm( listl, TermNil );
}
xarg *a = calloc( n , sizeof(xarg) );
@ -86,7 +88,7 @@ matchKey2(Atom key, xarg *e0, int n, const param2_t *def)
{
int i;
for (i=0; i< n; i++) {
if (!strcmp(def->name, RepAtom(key)->StrOfAE)) {
if (!strcmp((char*)def->name, (char*)RepAtom(key)->StrOfAE)) {
return e0;
}
def++;

View File

@ -1106,7 +1106,7 @@ p_create_static_array( USES_REGS1 )
Yap_Error(INSTANTIATION_ERROR,tprops,"create static array");
return (FALSE);
} else if (IsAtomTerm(tprops)) {
char *atname = RepAtom(AtomOfTerm(tprops))->StrOfAE;
char *atname = (char *)RepAtom(AtomOfTerm(tprops))->StrOfAE;
if (!strcmp(atname, "int"))
props = array_of_ints;
else if (!strcmp(atname, "dbref"))

View File

@ -64,7 +64,7 @@ static Int number_chars( USES_REGS1 );
static Int number_codes( USES_REGS1 );
static Int current_atom( USES_REGS1 );
static Int cont_current_atom( USES_REGS1 );
static int AlreadyHidden(char *);
static int AlreadyHidden(unsigned char *);
static Int hide( USES_REGS1 );
static Int hidden( USES_REGS1 );
static Int unhide( USES_REGS1 );
@ -72,14 +72,14 @@ static Int unhide( USES_REGS1 );
static int
AlreadyHidden(char *name)
AlreadyHidden(unsigned char *name)
{
AtomEntry *chain;
READ_LOCK(INVISIBLECHAIN.AERWLock);
chain = RepAtom(INVISIBLECHAIN.Entry);
READ_UNLOCK(INVISIBLECHAIN.AERWLock);
while (!EndOfPAEntr(chain) && strcmp(chain->StrOfAE, name) != 0)
while (!EndOfPAEntr(chain) && strcmp((char *)chain->StrOfAE, (char *)name) != 0)
chain = RepAtom(chain->NextOfAE);
if (EndOfPAEntr(chain))
return (FALSE);
@ -108,7 +108,7 @@ hide( USES_REGS1 )
return(FALSE);
}
atomToInclude = AtomOfTerm(t1);
if (AlreadyHidden(RepAtom(atomToInclude)->StrOfAE)) {
if (AlreadyHidden(RepAtom(atomToInclude)->UStrOfAE)) {
Yap_Error(SYSTEM_ERROR,t1,"an atom of name %s was already hidden",
RepAtom(atomToInclude)->StrOfAE);
return(FALSE);
@ -182,7 +182,7 @@ unhide( USES_REGS1 )
WRITE_LOCK(INVISIBLECHAIN.AERWLock);
chain = RepAtom(INVISIBLECHAIN.Entry);
old = NIL;
while (!EndOfPAEntr(chain) && strcmp(chain->StrOfAE, atom->StrOfAE) != 0) {
while (!EndOfPAEntr(chain) && strcmp((char *)chain->StrOfAE, (char *)atom->StrOfAE) != 0) {
old = chain;
chain = RepAtom(chain->NextOfAE);
}
@ -257,7 +257,7 @@ char_code( USES_REGS1 )
}
tf = MkIntegerTerm(c[0]);
} else {
char *c = RepAtom(at)->StrOfAE;
unsigned char *c = RepAtom(at)->UStrOfAE;
if (c[1] != '\0') {
Yap_Error(TYPE_ERROR_CHARACTER,t0,"char_code/2");
@ -377,11 +377,27 @@ string_to_list( USES_REGS1 )
static Int
atom_string( USES_REGS1 )
{
// swap arguments
Term t1 = ARG2;
ARG2 = ARG1;
ARG1 = t1;
return string_to_atom( PASS_REGS1 );
Term t1 = Deref(ARG1), t2 = Deref(ARG2);
LOCAL_MAX_SIZE = 1024;
restart_aux:
if (Yap_IsGroundTerm(t2)) {
Atom at;
// verify if an atom, int, float or bignnum
at = Yap_StringSWIToAtom( t2 PASS_REGS );
if (at)
return Yap_unify(MkAtomTerm(at), t1);
// else
} else {
Term t0 = Yap_AtomSWIToString( t1 PASS_REGS );
if (t0) return Yap_unify(t0, t2);
}
if (LOCAL_Error_TYPE && Yap_HandleError( "atom_string/2" )) {
t1 = Deref(ARG1);
t2 = Deref(ARG2);
goto restart_aux;
}
return FALSE;
}
static Int
@ -839,15 +855,15 @@ cont_string_code3( USES_REGS1 )
{
Term t2;
Int i, j;
int chr;
char *s;
const char *s0;
utf8proc_int32_t chr;
const unsigned char *s;
const unsigned char *s0;
restart_aux:
t2 = Deref(ARG2);
s0 = StringOfTerm( t2 );
s0 = UStringOfTerm( t2 );
i = IntOfTerm(EXTRA_CBACK_ARG(3,1)); // offset in coded string, increases by 1..6
j = IntOfTerm(EXTRA_CBACK_ARG(3,2)); // offset in UNICODE string, always increases by 1
s = utf8_get_char( s0+i, &chr );
s = (s0+i) + get_utf8( (unsigned char *)s0+i, &chr );
if (s[0]) {
EXTRA_CBACK_ARG(3,1) = MkIntTerm(s-s0);
EXTRA_CBACK_ARG(3,2) = MkIntTerm(j+1);
@ -874,7 +890,7 @@ string_code3( USES_REGS1 )
{
Term t1;
Term t2;
const char *s;
const unsigned char *s;
restart_aux:
t1 = Deref(ARG1);
t2 = Deref(ARG2);
@ -885,7 +901,7 @@ string_code3( USES_REGS1 )
LOCAL_Error_TYPE = TYPE_ERROR_STRING;
LOCAL_Error_Term = t2;
} else {
s = StringOfTerm( t2 );
s = UStringOfTerm( t2 );
t1 = Deref(ARG1);
if (IsVarTerm(t1)) {
EXTRA_CBACK_ARG(3,1) = MkIntTerm(0);
@ -895,8 +911,8 @@ string_code3( USES_REGS1 )
LOCAL_Error_TYPE = TYPE_ERROR_INTEGER;
LOCAL_Error_Term = t1;
} else {
const char *ns = s;
int chr;
const unsigned char *ns = s;
utf8proc_int32_t chr;
Int indx = IntegerOfTerm( t1 );
if (indx <= 0) {
if (indx < 0) {
@ -905,11 +921,11 @@ string_code3( USES_REGS1 )
}
cut_fail();
}
ns = utf8_skip(s,indx);
ns = skip_utf8((unsigned char *)s, indx);
if (ns == NULL) {
cut_fail(); // silently fail?
}
utf8_get_char( ns, &chr);
get_utf8( (unsigned char *)ns, &chr);
if ( chr == '\0') cut_fail();
if (Yap_unify(ARG3, MkIntegerTerm(chr))) cut_succeed();
cut_fail();
@ -932,7 +948,7 @@ get_string_code3( USES_REGS1 )
{
Term t1;
Term t2;
const char *s;
const unsigned char *s;
restart_aux:
t1 = Deref(ARG1);
t2 = Deref(ARG2);
@ -943,7 +959,7 @@ get_string_code3( USES_REGS1 )
LOCAL_Error_TYPE = TYPE_ERROR_STRING;
LOCAL_Error_Term = t2;
} else {
s = StringOfTerm( t2 );
s = UStringOfTerm( t2 );
t1 = Deref(ARG1);
if (IsVarTerm(t1)) {
LOCAL_Error_TYPE = INSTANTIATION_ERROR;
@ -952,8 +968,8 @@ get_string_code3( USES_REGS1 )
LOCAL_Error_TYPE = TYPE_ERROR_INTEGER;
LOCAL_Error_Term = t1;
} else {
const char *ns = s;
int chr;
unsigned char *ns = (unsigned char *)s;
utf8proc_int32_t chr;
Int indx = IntegerOfTerm( t1 );
if (indx <= 0) {
if (indx < 0) {
@ -964,11 +980,11 @@ get_string_code3( USES_REGS1 )
}
} else {
indx -= 1;
ns = utf8_skip(s,indx);
ns = skip_utf8((unsigned char *)s,indx);
if (ns == NULL) {
return FALSE;
} else {
utf8_get_char( ns, &chr);
get_utf8( ns, &chr);
if ( chr != '\0') return Yap_unify(ARG3, MkIntegerTerm(chr));
}
}
@ -1372,13 +1388,13 @@ atom_split( USES_REGS1 )
at = AtomOfTerm(t1);
if (IsWideAtom(at)) {
wchar_t *ws, *ws1 = (wchar_t *)HR;
char *s1 = (char *)HR;
unsigned char *s1 = (unsigned char *)HR;
size_t wlen;
ws = (wchar_t *)RepAtom(at)->StrOfAE;
wlen = wcslen(ws);
if (len > wlen) return FALSE;
if (s1+len > (char *)LCL0-1024)
if (s1+len > (unsigned char *)LCL0-1024)
Yap_Error(OUT_OF_STACK_ERROR,t1,"$atom_split/4");
for (i = 0; i< len; i++) {
if (ws[i] > MAX_ISO_LATIN1) {
@ -1405,27 +1421,27 @@ atom_split( USES_REGS1 )
Yap_Error(OUT_OF_STACK_ERROR,t1,"$atom_split/4");
ws += len;
while ((*s2++ = *ws++));
to2 = MkAtomTerm(Yap_LookupAtom((char *)HR));
to2 = MkAtomTerm(Yap_LookupAtom(( char *)HR));
}
} else {
s1[len] = '\0';
to1 = MkAtomTerm(Yap_LookupAtom(s1));
to1 = MkAtomTerm(Yap_ULookupAtom(s1));
/* second atom must be wide, if first wasn't */
to2 = MkAtomTerm(Yap_LookupWideAtom(ws+len));
}
} else {
char *s, *s1 = (char *)HR;
unsigned char *s, *s1 = (unsigned char *)HR;
s = RepAtom(at)->StrOfAE;
if (len > (Int)strlen(s)) return(FALSE);
if (s1+len > (char *)ASP-1024)
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");
for (i = 0; i< len; i++) {
s1[i] = s[i];
}
s1[len] = '\0';
to1 = MkAtomTerm(Yap_LookupAtom(s1));
to2 = MkAtomTerm(Yap_LookupAtom(s+len));
to1 = MkAtomTerm(Yap_ULookupAtom(s1));
to2 = MkAtomTerm(Yap_ULookupAtom(s+len));
}
return(Yap_unify_constant(ARG3,to1) && Yap_unify_constant(ARG4,to2));
}
@ -1502,7 +1518,7 @@ alloc_tmp_stack(size_t sz USES_REGS) {
}
static Term
build_new_atomic(int mask, wchar_t *wp, char *p, size_t min, size_t len USES_REGS)
build_new_atomic(int mask, wchar_t *wp, const unsigned char *p, size_t min, size_t len USES_REGS)
{
Atom nat;
if (mask & SUB_ATOM_HAS_WIDE) {
@ -1516,27 +1532,28 @@ build_new_atomic(int mask, wchar_t *wp, char *p, size_t min, size_t len USES_REG
if (nat)
return MkAtomTerm(nat);
} else if (!(mask & SUB_ATOM_HAS_UTF8)) {
char *src = p+min;
char *d = alloc_tmp_stack((len+1)*sizeof(char) PASS_REGS);
const unsigned char *src = p+min;
unsigned char *d = alloc_tmp_stack((len+1)*sizeof(char) PASS_REGS);
if (!d) return NIL;
strncpy(d, src, len);
strncpy((char *)d, (char *)src, len);
d[len] = '\0';
nat = Yap_LookupAtom(d);
nat = Yap_ULookupAtom(d);
if (nat)
return MkAtomTerm(nat);
} else {
char *src = p;
const unsigned char *src = p;
unsigned char *buf;
Term t = init_tstring( PASS_REGS1 );
src = (char *)utf8_skip(src, min);
char *cp = src, *buf;
src = skip_utf8((unsigned char *)src, min);
const unsigned char *cp = src;
LOCAL_TERM_ERROR( 4*(len+1) );
buf = buf_from_tstring(HR);
while (len) {
int chr;
cp = utf8_get_char(cp, &chr);
buf = utf8_put_char(buf, chr);
utf8proc_int32_t chr;
cp += get_utf8((unsigned char *)cp, &chr);
buf += put_utf8((unsigned char *)buf, chr);
len--;
}
*buf++ = '\0';
@ -1570,17 +1587,17 @@ check_sub_atom_at(int min, Atom at, Atom nat)
} else {
if (IsWideAtom(at)) {
wchar_t *p1;
char *p2;
unsigned char *p2;
wchar_t c1;
p1 = RepAtom(at)->WStrOfAE+min;
p2 = RepAtom(nat)->StrOfAE;
p2 = RepAtom(nat)->UStrOfAE;
while ( (c1 = *p1++) == *p2++ && c1);
return c1 == 0;
} else {
char *p1, *p2;
unsigned char *p1, *p2;
char c1;
p1 = RepAtom(at)->StrOfAE+min;
p2 = RepAtom(nat)->StrOfAE;
p1 = RepAtom(at)->UStrOfAE+min;
p2 = RepAtom(nat)->UStrOfAE;
while ( (c1 = *p1++) == *p2++ && c1);
return c1 == 0;
}
@ -1588,10 +1605,10 @@ check_sub_atom_at(int min, Atom at, Atom nat)
}
static int
check_sub_string_at(int min, const char *p1, const char *p2, size_t len2)
check_sub_string_at(int min, const unsigned char *p1, const unsigned char *p2, size_t len)
{
p1 = utf8_skip(p1, min);
return utf8_strncmp( p1, p2, len2 ) == 0;
p1 = skip_utf8((unsigned char *)p1, min);
return cmpn_utf8( p1, p2, len ) == 0;
}
static int
@ -1610,22 +1627,22 @@ check_sub_atom_bef(int max, Atom at, Atom nat)
while ( (c1 = *p1++) == *p2++ && c1);
return c1 == 0;
} else {
size_t len = strlen(RepAtom(nat)->StrOfAE);
size_t len = strlen((char *)RepAtom(nat)->StrOfAE);
int min = max- len;
if ((Int)(min - len) < 0) return FALSE;
if (IsWideAtom(at)) {
wchar_t *p1;
char *p2;
unsigned char *p2;
wchar_t c1;
p1 = RepAtom(at)->WStrOfAE+min;
p2 = RepAtom(nat)->StrOfAE;
p2 = RepAtom(nat)->UStrOfAE;
while ( (c1 = *p1++) == *p2++ && c1);
return c1 == 0;
} else {
char *p1, *p2;
unsigned char *p1, *p2;
char c1;
p1 = RepAtom(at)->StrOfAE+min;
p2 = RepAtom(nat)->StrOfAE;
p1 = RepAtom(at)->UStrOfAE+min;
p2 = RepAtom(nat)->UStrOfAE;
while ( (c1 = *p1++) == *p2++ && c1);
return c1 == 0;
}
@ -1635,15 +1652,15 @@ check_sub_atom_bef(int max, Atom at, Atom nat)
static int
check_sub_string_bef(int max, Term at, Term nat)
{
size_t len = utf8_strlen1(StringOfTerm(nat));
size_t len = strlen_utf8(UStringOfTerm(nat));
int min = max- len;
const char *p1, *p2;
const unsigned char *p1, *p2;
int c1;
if ((Int)(min - len) < 0) return FALSE;
p1 = utf8_skip(StringOfTerm(at),min);
p2 = StringOfTerm(nat);
p1 = skip_utf8((unsigned char *)UStringOfTerm(at),min);
p2 = UStringOfTerm(nat);
while ( (c1 = *p1++) == *p2++ && c1);
return c1 == 0;
}
@ -1656,7 +1673,7 @@ cont_sub_atomic( USES_REGS1 )
int mask;
size_t min, len, after, sz;
wchar_t *wp = NULL;
char *p = NULL;
const unsigned char *p = NULL;
Term nat;
int sub_atom = TRUE;
@ -1668,13 +1685,13 @@ cont_sub_atomic( USES_REGS1 )
if (mask & SUB_ATOM_HAS_UTF8) {
sub_atom = FALSE;
p = (char *)StringOfTerm(tat1);
p = UStringOfTerm(tat1);
} else if (mask & SUB_ATOM_HAS_WIDE) {
at = AtomOfTerm(tat1);
wp = RepAtom(at)->WStrOfAE;
} else {
at = AtomOfTerm(tat1);
p = RepAtom(at)->StrOfAE;
p = RepAtom(at)->UStrOfAE;
}
/* we can have one of two cases: A5 bound or unbound */
if (mask & SUB_ATOM_HAS_VAL) {
@ -1704,7 +1721,7 @@ cont_sub_atomic( USES_REGS1 )
}
} else {
while (!found) {
if (wcsstrcmp(wp+min, AtomOfTerm(nat)->StrOfAE, len) == 0) {
if (wcsstrcmp(wp+min, (char *)AtomOfTerm(nat)->StrOfAE, len) == 0) {
Yap_unify(ARG2, MkIntegerTerm(min));
Yap_unify(ARG3, MkIntegerTerm(len));
Yap_unify(ARG4, MkIntegerTerm(after));
@ -1713,7 +1730,7 @@ cont_sub_atomic( USES_REGS1 )
while (min <= sz-len) {
after--;
min++;
if (wcsstrcmp(wp+min, AtomOfTerm(nat)->StrOfAE, len) == 0)
if (wcsstrcmp(wp+min, (char *)AtomOfTerm(nat)->StrOfAE, len) == 0)
break;
}
} else {
@ -1724,9 +1741,9 @@ cont_sub_atomic( USES_REGS1 )
}
}
} else if (sub_atom) {
p = RepAtom(at)->StrOfAE;
p = RepAtom(at)->UStrOfAE;
while (!found) {
if (strncmp(p+min, AtomOfTerm(nat)->StrOfAE, len) == 0) {
if (strncmp((char *)p+min, (char *)AtomOfTerm(nat)->StrOfAE, len) == 0) {
Yap_unify(ARG2, MkIntegerTerm(min));
Yap_unify(ARG3, MkIntegerTerm(len));
Yap_unify(ARG4, MkIntegerTerm(after));
@ -1735,7 +1752,7 @@ cont_sub_atomic( USES_REGS1 )
while (min <= sz-len) {
after--;
min++;
if (strncmp(p+min, AtomOfTerm(nat)->StrOfAE, len) == 0)
if (strncmp((char *)p+min, (char *)AtomOfTerm(nat)->StrOfAE, len) == 0)
break;
}
} else {
@ -1745,12 +1762,12 @@ cont_sub_atomic( USES_REGS1 )
}
}
} else {
const char *p = StringOfTerm( Deref(ARG1) ), *p1 = p;
const char *p5 = StringOfTerm( Deref(ARG5) );
const unsigned char *p = UStringOfTerm( Deref(ARG1) ), *p1 = p;
const unsigned char *p5 = UStringOfTerm( Deref(ARG5) );
while (!found) {
p = utf8_skip(p1, min);
if (utf8_strncmp(p, p5, len) == 0) {
p = skip_utf8((unsigned char *)p1, min);
if (cmpn_utf8(p, p5, len) == 0) {
Yap_unify(ARG2, MkIntegerTerm(min));
Yap_unify(ARG3, MkIntegerTerm(len));
Yap_unify(ARG4, MkIntegerTerm(after));
@ -1758,10 +1775,10 @@ cont_sub_atomic( USES_REGS1 )
/* found one, check if there is any left */
while (min <= sz-len) {
int chr;
p = utf8_get_char(p, &chr);
p += get_utf8((unsigned char *)p, &chr);
after--;
min++;
if (utf8_strncmp(p, StringOfTerm(nat), len) == 0)
if (cmpn_utf8(p, UStringOfTerm(nat), len) == 0)
break;
}
} else {
@ -1828,7 +1845,7 @@ sub_atomic( int sub_atom USES_REGS )
int mask = 0;
size_t min, len, after, sz;
wchar_t *wp = NULL;
char *p = NULL;
unsigned char *p = NULL;
int bnds = 0;
Term nat = 0L;
Atom at = NULL;
@ -1900,7 +1917,7 @@ sub_atomic( int sub_atom USES_REGS )
if (IsWideAtom(oat))
len = wcslen(RepAtom(oat)->WStrOfAE);
else
len = strlen(RepAtom(oat)->StrOfAE);
len = strlen((const char *)RepAtom(oat)->StrOfAE);
}
} else {
if (!IsStringTerm(tout)) {
@ -1908,7 +1925,7 @@ sub_atomic( int sub_atom USES_REGS )
return FALSE;
} else {
mask |= SUB_ATOM_HAS_VAL|SUB_ATOM_HAS_SIZE;
len = utf8_strlen1( StringOfTerm(tout) );
len = strlen_utf8( UStringOfTerm(tout) );
}
}
if (!Yap_unify(ARG3, MkIntegerTerm(len)))
@ -1922,13 +1939,13 @@ sub_atomic( int sub_atom USES_REGS )
wp = RepAtom(at)->WStrOfAE;
sz = wcslen(wp);
} else {
p = RepAtom(at)->StrOfAE;
sz = strlen(p);
p = RepAtom(at)->UStrOfAE;
sz = strlen((const char *)p);
}
} else {
mask |= SUB_ATOM_HAS_UTF8;
p = (char *)StringOfTerm(tat1);
sz = utf8_strlen1(p);
p = (unsigned char *)StringOfTerm(tat1);
sz = strlen_utf8(p);
}
/* the problem is deterministic if we have two cases */
if (bnds > 1) {
@ -1963,7 +1980,7 @@ sub_atomic( int sub_atom USES_REGS )
if (sub_atom)
out = check_sub_atom_at(min, at, AtomOfTerm(nat));
else
out = check_sub_string_at(min, p, StringOfTerm( nat ), len);
out = check_sub_string_at(min, p, UStringOfTerm( nat ), len);
} else if ((mask & (SUB_ATOM_HAS_AFTER|SUB_ATOM_HAS_VAL)) ==
(SUB_ATOM_HAS_AFTER|SUB_ATOM_HAS_VAL)) {
if (sub_atom)
@ -1973,7 +1990,7 @@ sub_atomic( int sub_atom USES_REGS )
} else if ((mask & (SUB_ATOM_HAS_SIZE|SUB_ATOM_HAS_VAL)) ==
(SUB_ATOM_HAS_SIZE|SUB_ATOM_HAS_VAL)) {
if (!sub_atom) {
out = (utf8_strlen1(StringOfTerm(tout)) == len);
out = (strlen_utf8(UStringOfTerm(tout)) == len);
if (!out) cut_fail();
} else if (IsWideAtom(AtomOfTerm(tout))) {
if (!(mask & SUB_ATOM_HAS_VAL)) {
@ -1982,7 +1999,7 @@ sub_atomic( int sub_atom USES_REGS )
/* just check length, they may still be several occurrences :( */
out = (wcslen(RepAtom(AtomOfTerm(tout))->WStrOfAE) == len);
} else {
out = (strlen(RepAtom(AtomOfTerm(tout))->StrOfAE) == len);
out = (strlen((const char *)RepAtom(AtomOfTerm(tout))->StrOfAE) == len);
if (!out) cut_fail();
}
if (len == sz) {

View File

@ -26,7 +26,7 @@ static char SccsId[] = "%W% %G%";
#endif
#include "YapHeap.h"
#include "pl-utf8.h"
#include "YapText.h"
#ifdef USE_GMP
@ -363,13 +363,13 @@ Yap_OpaqueTermToString(Term t, char *str, size_t max)
if (li[0] == (CELL)FunctorString) {
str_index += sprintf(& str[str_index], "\"");
do {
int chr;
char *ptr = (char *)StringOfTerm(AbsAppl(li));
ptr = utf8_get_char(ptr, &chr);
utf8proc_int32_t chr;
unsigned char *ptr = (unsigned char *)StringOfTerm(AbsAppl(li));
ptr += get_utf8(ptr, &chr);
if (chr == '\0') break;
str_index += sprintf(& str[str_index], "%C", chr);
str_index += sprintf(str+str_index, "%C", chr);
} while (TRUE);
str_index += sprintf(& str[str_index], "\"");
str_index += sprintf(str+str_index, "\"");
} else {
CELL big_tag = li[1];

View File

@ -46,7 +46,7 @@ char * Yap_blob_to_string(AtomEntry *ref, const char *s0, size_t sz)
fclose(f); // return the final result.
return s;
} else {
size_t sz0 = strlcpy( s, RepAtom( AtomSWIStream )->StrOfAE, sz);
size_t sz0 = strlcpy( s, (char *)RepAtom( AtomSWIStream )->StrOfAE, sz);
s = s+sz0;
sz -= sz0;
#if defined(__linux__) || defined(__APPLE__)
@ -222,7 +222,7 @@ YAP_blob_data(Atom x, size_t *len, blob_type_t **type)
return x->WStrOfAE;
}
if ( len )
*len = strlen(x->StrOfAE);
*len = strlen((char *)x->StrOfAE);
if ( type )
*type = &unregistered_blob_atom;
return x->StrOfAE;

View File

@ -793,7 +793,7 @@ YAP_LookupAtom(const char *c)
Atom a;
while (TRUE) {
a = Yap_LookupAtom((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);
@ -831,7 +831,7 @@ YAP_FullLookupAtom(const char *c)
Atom at;
while (TRUE) {
at = Yap_FullLookupAtom((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);
@ -854,9 +854,9 @@ YAP_AtomNameLength(Atom at)
return wcslen(c);
} else {
char *c = RepAtom(at)->StrOfAE;
unsigned char *c = RepAtom(at)->UStrOfAE;
return strlen(c);
return strlen((char *)c);
}
}

1830
C/cdmgr.c

File diff suppressed because it is too large Load Diff

View File

@ -112,7 +112,7 @@ cmp_atoms(Atom a1, Atom a2)
}
return *s1-*s2;
} else {
return strcmp(RepAtom(a1)->StrOfAE,RepAtom(a2)->StrOfAE);
return strcmp((char *)RepAtom(a1)->StrOfAE,(char *)RepAtom(a2)->StrOfAE);
}
}
@ -181,7 +181,7 @@ static int compare_complex(register CELL *pt0, register CELL *pt0_end, register
goto done;
} else if (IsStringTerm(d0)) {
if (IsStringTerm(d1)){
out = strcmp(StringOfTerm(d0) , StringOfTerm(d1));
out = strcmp((char *)StringOfTerm(d0) , (char *)StringOfTerm(d1));
} else if (IsIntTerm(d1))
out = 1;
else if (IsFloatTerm(d1)) {
@ -242,7 +242,7 @@ static int compare_complex(register CELL *pt0, register CELL *pt0_end, register
if (IsExtensionFunctor(f))
out = 1;
else if (!(out = 2-ArityOfFunctor(f)))
out = strcmp(".",RepAtom(NameOfFunctor(f))->StrOfAE);
out = strcmp(".",(char *)RepAtom(NameOfFunctor(f))->StrOfAE);
} else out = 1;
goto done;
}
@ -411,7 +411,7 @@ compare(Term t1, Term t2) /* compare terms t1 and t2 */
else {
int out;
if (!(out = 2-ArityOfFunctor(f)))
out = strcmp(".",RepAtom(NameOfFunctor(f))->StrOfAE);
out = strcmp(".",(char *)RepAtom(NameOfFunctor(f))->StrOfAE);
return(out);
}
}
@ -488,7 +488,7 @@ compare(Term t1, Term t2) /* compare terms t1 and t2 */
case db_ref_e:
return 1;
case string_e:
return strcmp(StringOfTerm(t1), StringOfTerm(t2));
return strcmp((char *)StringOfTerm(t1), (char *)StringOfTerm(t2));
}
return -1;
}
@ -507,7 +507,7 @@ compare(Term t1, Term t2) /* compare terms t1 and t2 */
Functor f = FunctorOfTerm(t1);
if (!(out = ArityOfFunctor(f))-2)
out = strcmp(RepAtom(NameOfFunctor(f))->StrOfAE,".");
out = strcmp((char *)RepAtom(NameOfFunctor(f))->StrOfAE,".");
return out;
}
return 1;

View File

@ -605,7 +605,6 @@ ShowOp (compiler_vm_op ic, const char *f, struct PSEUDO *cpc)
case 'a':
case 'n':
case 'S':
Yap_DebugPlWrite ((Term) arg);
break;
case 'b':
@ -674,6 +673,10 @@ ShowOp (compiler_vm_op ic, const char *f, struct PSEUDO *cpc)
Yap_DebugErrorPutc ('A');
Yap_DebugPlWrite (MkIntTerm (rn));
break;
case 'S':
Yap_DebugErrorPutc ('S');
Yap_DebugPlWrite (MkIntTerm (rn));
break;
case 'h':
{
CELL my_arg = *cptr++;

View File

@ -153,7 +153,7 @@ static int can_unify_complex(register CELL *pt0,
if (FloatOfTerm(d0) == FloatOfTerm(d1)) continue;
goto comparison_failed;
case (CELL)FunctorString:
if (strcmp(StringOfTerm(d0), StringOfTerm(d1)) == 0) continue;
if (strcmp((char *)StringOfTerm(d0), (char *)StringOfTerm(d1)) == 0) continue;
goto comparison_failed;
#ifdef USE_GMP
case (CELL)FunctorBigInt:
@ -292,7 +292,7 @@ can_unify(Term t1, Term t2, Term *Vars USES_REGS)
if (RepAppl(t1)[1] == RepAppl(t2)[1]) return(TRUE);
return FALSE;
case (CELL)FunctorString:
if (strcmp(StringOfTerm(t1), StringOfTerm(t2)) == 0) return(TRUE);
if (strcmp((char *)StringOfTerm(t1), (char *)StringOfTerm(t2)) == 0) return(TRUE);
return FALSE;
case (CELL)FunctorDouble:
if (FloatOfTerm(t1) == FloatOfTerm(t2)) return(TRUE);

View File

@ -743,7 +743,7 @@ Yap_Error(yap_error_number type, Term where, const char *format,...)
Yap_signal(YAP_FAIL_SIGNAL);
P = FAILCODE;
} else {
if (IsVarTerm(where)) {
if (IsVarTerm(where)) {
/* we must be careful someone gave us a copy to a local variable */
Term t = MkVarTerm();
Yap_unify(t, where);
@ -754,7 +754,7 @@ Yap_Error(yap_error_number type, Term where, const char *format,...)
LOCAL_CurrentError = type;
LOCAL_PrologMode |= InErrorMode;
if (!(where = Yap_CopyTerm(where))) {
where = TermNil;
where = TermNil;
}
}
va_start (ap, format);
@ -859,13 +859,27 @@ Yap_Error(yap_error_number type, Term where, const char *format,...)
serious = TRUE;
}
break;
case DOMAIN_ERROR_ARRAY_TYPE:
case DOMAIN_ERROR_FILE_ERRORS:
{
int i;
Term ti[2];
i = strlen(tmpbuf);
ti[0] = MkAtomTerm(AtomArrayType);
ti[0] = TermArrayType;
ti[1] = where;
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
psize -= i;
fun = FunctorError;
serious = TRUE;
}
break;
case DOMAIN_ERROR_FILE_TYPE:
{
int i;
Term ti[2];
i = strlen(tmpbuf);
ti[0] = TermFileType;
ti[1] = where;
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
psize -= i;
@ -879,7 +893,7 @@ Yap_Error(yap_error_number type, Term where, const char *format,...)
Term ti[2];
i = strlen(tmpbuf);
ti[0] = MkAtomTerm(AtomIOMode);
ti[0] = TermIOMode;
ti[1] = where;
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
psize -= i;
@ -1041,6 +1055,20 @@ Yap_Error(yap_error_number type, Term where, const char *format,...)
serious = TRUE;
}
break;
case DOMAIN_ERROR_SOLUTIONS:
{
int i;
Term ti[2];
i = strlen(tmpbuf);
ti[0] = TermSolutions;
ti[1] = where;
nt[0] = Yap_MkApplTerm(FunctorDomainError, 2, ti);
psize -= i;
fun = FunctorError;
serious = TRUE;
}
break;
case DOMAIN_ERROR_SOURCE_SINK:
{
int i;
@ -1729,6 +1757,7 @@ Yap_Error(yap_error_number type, Term where, const char *format,...)
i = strlen(tmpbuf);
psize -= i;
fun = FunctorSyntaxError;
serious = false;
}
break;
case SAVED_STATE_ERROR:
@ -2142,11 +2171,11 @@ Yap_Error(yap_error_number type, Term where, const char *format,...)
if (type != PURE_ABORT) {
/* This is used by some complex procedures to detect there was an error */
if (IsAtomTerm(nt[0])) {
strncpy(LOCAL_ErrorSay, RepAtom(AtomOfTerm(nt[0]))->StrOfAE, MAX_ERROR_MSG_SIZ\
strncpy(LOCAL_ErrorSay, (char *)RepAtom(AtomOfTerm(nt[0]))->StrOfAE, MAX_ERROR_MSG_SIZ\
E);
LOCAL_ErrorMessage = LOCAL_ErrorSay;
} else {
strncpy(LOCAL_ErrorSay, RepAtom(NameOfFunctor(FunctorOfTerm(nt[0])))->StrOfAE,\
strncpy(LOCAL_ErrorSay, (char *)RepAtom(NameOfFunctor(FunctorOfTerm(nt[0])))->StrOfAE,\
MAX_ERROR_MSG_SIZE);
LOCAL_ErrorMessage = LOCAL_ErrorSay;
}
@ -2165,7 +2194,8 @@ E);
stack_dump = TermNil;
LOCAL_Error_Size = 0L;
}
nt[1] = MkPairTerm(MkAtomTerm(Yap_LookupAtom(tmpbuf)), stack_dump);
nt[1] = MkPairTerm(MkAtomTerm(Yap_LookupAtom(tmpbuf)),
MkPairTerm(stack_dump, TermNil));
if (type == SYNTAX_ERROR) {
nt[1] = MkPairTerm(where, nt[1]);
}

View File

@ -114,7 +114,7 @@ Eval(Term t USES_REGS)
} else if (IsApplTerm(t)) {
Functor fun = FunctorOfTerm(t);
if (fun == FunctorString) {
const char *s = StringOfTerm(t);
const char *s = (const char*)StringOfTerm(t);
if (s[1] == '\0')
return MkIntegerTerm(s[0]);
return Yap_ArithError(TYPE_ERROR_EVALUABLE, t,

View File

@ -87,9 +87,7 @@ static bool indexer( Term inp ) {
return false;
}
static bool dqf( Term t2 ) {
CACHE_REGS
ModEntry *new = Yap_GetModuleEntry(CurrentModule);
static bool dqf1( ModEntry *new, Term t2 USES_REGS ) {
new->flags &= ~(DBLQ_CHARS|DBLQ_CODES|DBLQ_ATOM|DBLQ_STRING);
if (t2 == TermString) {
new->flags |= DBLQ_STRING;
@ -108,6 +106,12 @@ static bool dqf( Term t2 ) {
return false;
}
static bool dqf( Term t2 ) {
CACHE_REGS
ModEntry *new = Yap_GetModuleEntry(CurrentModule);
return dqf1( new, t2 PASS_REGS);
}
static bool isaccess( Term inp ) {
if (inp == TermReadWrite ||
@ -151,7 +155,7 @@ static bool mkprompt( Term inp ) {
Yap_Error(TYPE_ERROR_ATOM, inp, "set_prolog_flag");
return false;
}
strncpy( LOCAL_Prompt, RepAtom( AtomOfTerm( inp ) )->StrOfAE, MAX_PROMPT );
strncpy( LOCAL_Prompt, (const char *)RepAtom( AtomOfTerm( inp ) )->StrOfAE, MAX_PROMPT );
return true;
}
@ -164,7 +168,7 @@ static bool getenc( Term inp ) {
Yap_Error(TYPE_ERROR_ATOM, inp, "set_prolog_flag");
return false;
}
enc_id( RepAtom( AtomOfTerm( inp ) )->StrOfAE );
enc_id( ( char *)RepAtom( AtomOfTerm( inp ) )->StrOfAE );
return true;
}
@ -587,12 +591,12 @@ static bool setYapFlagInModule( Term tflag, Term t2, Term mod )
{
FlagEntry *fv;
ModEntry *new = Yap_GetModuleEntry(mod);
if (!mod)
if (!new)
return false;
fv = GetFlagProp( AtomOfTerm( tflag ) );
if (!fv && !fv->global) {
Yap_Error(DOMAIN_ERROR_PROLOG_FLAG, tflag, "trying to set unknown module flag");
return FALSE;
return false;
}
if (mod == USER_MODULE && !setYapFlag( tflag, t2) )
return false;
@ -639,25 +643,10 @@ static bool setYapFlagInModule( Term tflag, Term t2, Term mod )
new->flags |= BCKQ_CHARS;
return true;
}
} else if (fv->FlagOfVE == DOUBLE_QUOTES_FLAG) {
new->flags &= ~(DBLQ_CHARS|DBLQ_CODES|DBLQ_ATOM|DBLQ_STRING);
if (t2 == TermString) {
new->flags |= DBLQ_STRING;
return true;
} else if (t2 == TermAtom) {
new->flags |= DBLQ_ATOM;
return true;
} else if (t2 == TermCodes) {
new->flags |= DBLQ_CODES;
return true;
} else if (t2 == TermChars) {
new->flags |= DBLQ_CHARS;
return true;
}
Yap_Error(DOMAIN_ERROR_OUT_OF_RANGE, t2, "bad option for %s:backquoted_string flag", RepAtom(AtomOfTerm(tflag))->StrOfAE);
return false;
} if (fv->FlagOfVE == DOUBLE_QUOTES_FLAG) {
return dqf1(new, t2 PASS_REGS );
}
Yap_Error(DOMAIN_ERROR_OUT_OF_RANGE, t2, "flag %s is not module-scoped", RepAtom(AtomOfTerm(tflag))->StrOfAE);
Yap_Error(DOMAIN_ERROR_OUT_OF_RANGE, t2, "flag %s is not module-scoped", RepAtom(AtomOfTerm(tflag))->StrOfAE);
return FALSE;
}
@ -874,16 +863,19 @@ static Int current_prolog_flag( USES_REGS1 ) {
void Yap_setModuleFlags(ModEntry *new, ModEntry *cme)
{
Atom at = new->AtomOfME;
new->flags = 0;
if (at == AtomProlog ) {
new->flags = UNKNOWN_FAIL | M_SYSTEM | M_CHARESCAPE | DBLQ_CODES | BCKQ_STRING;
return;
} else if (cme == NULL) {
new->flags = UNKNOWN_ERROR | M_SYSTEM | M_CHARESCAPE| DBLQ_CODES | BCKQ_STRING;
return;
} else
if (at == AtomProlog || CurrentModule == PROLOG_MODULE) {
new->flags = M_SYSTEM | UNKNOWN_ERROR |M_CHARESCAPE | DBLQ_CODES | BCKQ_STRING;
if (at == AtomUser)
new->flags = UNKNOWN_ERROR |M_CHARESCAPE | DBLQ_CODES | BCKQ_STRING;
} else if (cme &&
cme->flags && cme != new) {
new->flags = cme->flags;
}
} else {
new->flags = ( UNKNOWN_ERROR | M_CHARESCAPE | DBLQ_CODES | BCKQ_STRING
);
}
//printf("cme=%s new=%s flags=%x\n",cme,at->StrOfAE,new->flags);
}
bool setYapFlag( Term tflag, Term t2 )
{
@ -1213,6 +1205,7 @@ do_prolog_flag_property (Term tflag, Term opts USES_REGS)
Yap_unify(TermAtom, args[PROLOG_FLAG_PROPERTY_TYPE].tvalue);
else if (fv->type == nat)
rc = rc &&
Yap_unify(TermInteger, args[PROLOG_FLAG_PROPERTY_TYPE].tvalue);
else if (fv->type == isfloat)
rc = rc &&
@ -1327,7 +1320,7 @@ newFlag( Term fl, Term val )
int i = GLOBAL_flagCount;
GLOBAL_flagCount ++;
f.name = RepAtom(AtomOfTerm(fl))->StrOfAE;
f.name = (char *)RepAtom(AtomOfTerm(fl))->StrOfAE;
f.writable = true;
f.helper = 0;
f.def = ok;

View File

@ -2722,6 +2722,7 @@ void Yap_InitGlobals(void)
Yap_InitCPred("$allocate_arena", 2, p_allocate_arena, 0);
Yap_InitCPred("arena_size", 1, p_default_arena_size, 0);
Yap_InitCPred("b_setval", 2, p_b_setval, SafePredFlag);
Yap_InitCPred("__B_setval__", 2, p_b_setval, HiddenPredFlag|SafePredFlag);
/** @pred b_setval(+ _Name_, + _Value_)
@ -2745,6 +2746,7 @@ assignment is reversed.
*/
Yap_InitCPred("nb_setval", 2, p_nb_setval, 0L);
Yap_InitCPred("__NB_setval__", 2, p_nb_setval, HiddenPredFlag);
/** @pred nb_setval(+ _Name_, + _Value_)
@ -2816,6 +2818,8 @@ demo_nb_linkval :-
*/
Yap_InitCPred("$nb_getval", 3, p_nb_getval, SafePredFlag);
Yap_InitCPred("__NB_getval__", 3, p_nb_getval, HiddenPredFlag);
Yap_InitCPred("__B_getval__", 3, p_nb_getval, HiddenPredFlag);
Yap_InitCPred("nb_setarg", 3, p_nb_setarg, 0L);
/** @pred nb_setarg(+{Arg], + _Term_, + _Value_)

View File

@ -1370,7 +1370,7 @@ cp_atom_table(AtomHashEntry *ntb, UInt nsize)
Atom natom;
CELL hash;
hash = HashFunction(ap->StrOfAE) % nsize;
hash = HashFunction(ap->UStrOfAE) % nsize;
natom = ap->NextOfAE;
ap->NextOfAE = ntb[hash].Entry;
ntb[hash].Entry = catom;

View File

@ -14,16 +14,16 @@
* comments: C-version for inline code used in meta-calls *
* *
*************************************************************************/
/** @defgroup YAP_Terms Predicates on terms
@ingroup builtins
@{
*/
/** @defgroup YAP_Terms Predicates on terms
@ingroup builtins
@{
*/
#define IN_INLINES_C 1
#include "absmi.h"
@ -47,13 +47,13 @@ static Int p_arg( USES_REGS1 );
static Int p_functor( USES_REGS1 );
/** @pred atom( _T_) is iso
Succeeds if and only if _T_ is currently instantiated to an atom.
*/
/** @pred atom( _T_) is iso
Succeeds if and only if _T_ is currently instantiated to an atom.
*/
static Int
p_atom( USES_REGS1 )
{ /* atom(?) */
@ -75,13 +75,13 @@ p_atom( USES_REGS1 )
ENDD(d0);
}
/** @pred atomic(T) is iso
Checks whether _T_ is an atomic symbol (atom or number).
*/
/** @pred atomic(T) is iso
Checks whether _T_ is an atomic symbol (atom or number).
*/
static Int
p_atomic( USES_REGS1 )
{ /* atomic(?) */
@ -103,13 +103,13 @@ p_atomic( USES_REGS1 )
ENDD(d0);
}
/** @pred integer( _T_) is iso
Succeeds if and only if _T_ is currently instantiated to an integer.
*/
/** @pred integer( _T_) is iso
Succeeds if and only if _T_ is currently instantiated to an integer.
*/
static Int
p_integer( USES_REGS1 )
{ /* integer(?,?) */
@ -149,13 +149,13 @@ p_integer( USES_REGS1 )
ENDD(d0);
}
/** @pred number( _T_) is iso
Checks whether `T` is an integer, rational or a float.
*/
/** @pred number( _T_) is iso
Checks whether `T` is an integer, rational or a float.
*/
static Int
p_number( USES_REGS1 )
{ /* number(?) */
@ -196,13 +196,13 @@ p_number( USES_REGS1 )
ENDD(d0);
}
/** @pred db_reference( _T_)
Checks whether _T_ is a database reference.
*/
/** @pred db_reference( _T_)
Checks whether _T_ is a database reference.
*/
static Int
p_db_ref( USES_REGS1 )
{ /* db_reference(?,?) */
@ -224,13 +224,13 @@ p_db_ref( USES_REGS1 )
ENDD(d0);
}
/** @pred primitive( ?_T_)
Checks whether _T_ is an atomic term or a database reference.
*/
/** @pred primitive( ?_T_)
Checks whether _T_ is an atomic term or a database reference.
*/
static Int
p_primitive( USES_REGS1 )
{ /* primitive(?) */
@ -252,13 +252,13 @@ p_primitive( USES_REGS1 )
ENDD(d0);
}
/** @pred float( _T_) is iso
Checks whether _T_ is a floating point number.
*/
/** @pred float( _T_) is iso
Checks whether _T_ is a floating point number.
*/
static Int
p_float( USES_REGS1 )
{ /* float(?) */
@ -280,13 +280,13 @@ p_float( USES_REGS1 )
ENDD(d0);
}
/** @pred compound( _T_) is iso
Checks whether _T_ is a compound term.
*/
/** @pred compound( _T_) is iso
Checks whether _T_ is a compound term.
*/
static Int
p_compound( USES_REGS1 )
{ /* compound(?) */
@ -314,13 +314,13 @@ p_compound( USES_REGS1 )
ENDD(d0);
}
/** @pred nonvar( _T_) is iso
The opposite of `var( _T_)`.
*/
/** @pred nonvar( _T_) is iso
The opposite of `var( _T_)`.
*/
static Int
p_nonvar( USES_REGS1 )
{ /* nonvar(?) */
@ -337,13 +337,13 @@ p_nonvar( USES_REGS1 )
ENDD(d0);
}
/** @pred var( _T_) is iso
Succeeds if _T_ is currently a free variable, otherwise fails.
*/
/** @pred var( _T_) is iso
Succeeds if _T_ is currently a free variable, otherwise fails.
*/
static Int
p_var( USES_REGS1 )
{ /* var(?) */
@ -360,13 +360,13 @@ p_var( USES_REGS1 )
ENDD(d0);
}
/** @pred _X_ = _Y_ is iso
Tries to unify terms _X_ and _Y_.
*/
/** @pred _X_ = _Y_ is iso
Tries to unify terms _X_ and _Y_.
*/
static Int
p_equal( USES_REGS1 )
{ /* ?=? */
@ -412,7 +412,7 @@ eq(Term t1, Term t2 USES_REGS)
case (CELL)FunctorLongInt:
return(LongIntOfTerm(d0) == LongIntOfTerm(d1));
case (CELL)FunctorString:
return(strcmp(StringOfTerm(d0), StringOfTerm(d1)) == 0);
return(strcmp((char *)StringOfTerm(d0), (char *)StringOfTerm(d1)) == 0);
#ifdef USE_GMP
case (CELL)FunctorBigInt:
return (Yap_gmp_tcmp_big_big(d0, d1) == 0);
@ -459,37 +459,37 @@ eq(Term t1, Term t2 USES_REGS)
ENDD(d0);
}
/** @pred ?_X_ == ?_Y_ is iso
Succeeds if terms _X_ and _Y_ are strictly identical. The
difference between this predicate and =/2 is that, if one of the
arguments is a free variable, it only succeeds when they have already
been unified.
~~~~~{.prolog}
?- X == Y.
~~~~~
fails, but,
~~~~~{.prolog}
?- X = Y, X == Y.
~~~~~
succeeds.
~~~~~{.prolog}
?- X == 2.
~~~~~
fails, but,
~~~~~{.prolog}
?- X = 2, X == 2.
~~~~~
succeeds.
*/
/** @pred ?_X_ == ?_Y_ is iso
Succeeds if terms _X_ and _Y_ are strictly identical. The
difference between this predicate and =/2 is that, if one of the
arguments is a free variable, it only succeeds when they have already
been unified.
~~~~~{.prolog}
?- X == Y.
~~~~~
fails, but,
~~~~~{.prolog}
?- X = Y, X == Y.
~~~~~
succeeds.
~~~~~{.prolog}
?- X == 2.
~~~~~
fails, but,
~~~~~{.prolog}
?- X = 2, X == 2.
~~~~~
succeeds.
*/
static Int
p_eq( USES_REGS1 )
{ /* ? == ? */
@ -503,13 +503,13 @@ Yap_eq(Term t1, Term t2)
return eq(t1,t2 PASS_REGS);
}
/** @pred _X_ \= _Y_ is iso
Succeeds if terms _X_ and _Y_ are not unifiable.
*/
/** @pred _X_ \= _Y_ is iso
Succeeds if terms _X_ and _Y_ are not unifiable.
*/
static Int
p_dif( USES_REGS1 )
{ /* ? \= ? */
@ -618,20 +618,20 @@ p_dif( USES_REGS1 )
ENDD(d0);
}
/** @pred arg(+ _N_,+ _T_, _A_) is iso
Succeeds if the argument _N_ of the term _T_ unifies with
_A_. The arguments are numbered from 1 to the arity of the term.
The current version will generate an error if _T_ or _N_ are
unbound, if _T_ is not a compound term, of if _N_ is not a positive
integer. Note that previous versions of YAP would fail silently
under these errors.
*/
/** @pred arg(+ _N_,+ _T_, _A_) is iso
Succeeds if the argument _N_ of the term _T_ unifies with
_A_. The arguments are numbered from 1 to the arity of the term.
The current version will generate an error if _T_ or _N_ are
unbound, if _T_ is not a compound term, of if _N_ is not a positive
integer. Note that previous versions of YAP would fail silently
under these errors.
*/
static Int
p_arg( USES_REGS1 )
{ /* arg(?,?,?) */
@ -728,26 +728,26 @@ p_arg( USES_REGS1 )
}
/** @pred functor( _T_, _F_, _N_) is iso
The top functor of term _T_ is named _F_ and has arity _N_.
When _T_ is not instantiated, _F_ and _N_ must be. If
_N_ is 0, _F_ must be an atomic symbol, which will be unified
with _T_. If _N_ is not 0, then _F_ must be an atom and
_T_ becomes instantiated to the most general term having functor
_F_ and arity _N_. If _T_ is instantiated to a term then
_F_ and _N_ are respectively unified with its top functor name
and arity.
In the current version of YAP the arity _N_ must be an
integer. Previous versions allowed evaluable expressions, as long as the
expression would evaluate to an integer. This feature is not available
in the ISO Prolog standard.
*/
/** @pred functor( _T_, _F_, _N_) is iso
The top functor of term _T_ is named _F_ and has arity _N_.
When _T_ is not instantiated, _F_ and _N_ must be. If
_N_ is 0, _F_ must be an atomic symbol, which will be unified
with _T_. If _N_ is not 0, then _F_ must be an atom and
_T_ becomes instantiated to the most general term having functor
_F_ and arity _N_. If _T_ is instantiated to a term then
_F_ and _N_ are respectively unified with its top functor name
and arity.
In the current version of YAP the arity _N_ must be an
integer. Previous versions allowed evaluable expressions, as long as the
expression would evaluate to an integer. This feature is not available
in the ISO Prolog standard.
*/
static Int
p_functor( USES_REGS1 ) /* functor(?,?,?) */
{
@ -1114,7 +1114,7 @@ Yap_InitInlines(void)
CurrentModule = cm;
}
/**
@}
*/
/**
@}
*/

View File

@ -182,9 +182,9 @@ LoadForeign(StringList ofiles, StringList libs,
CACHE_REGS
while (libs) {
if (!Yap_TrueFileName(AtomName(libs->name), LOCAL_FileNameBuf, TRUE)) {
if (!Yap_TrueFileName((char *)AtomName(libs->name), LOCAL_FileNameBuf, TRUE)) {
/* use LD_LIBRARY_PATH */
strncpy(LOCAL_FileNameBuf, AtomName(libs->name), YAP_FILENAME_MAX);
strncpy(LOCAL_FileNameBuf, (char *)AtomName(libs->name), YAP_FILENAME_MAX);
}
#ifdef __osf__
@ -206,7 +206,7 @@ LoadForeign(StringList ofiles, StringList libs,
other routines */
/* dlopen wants to follow the LD_CONFIG_PATH */
if (!Yap_TrueFileName(AtomName(ofiles->name), LOCAL_FileNameBuf, TRUE)) {
if (!Yap_TrueFileName((char *)AtomName(ofiles->name), LOCAL_FileNameBuf, TRUE)) {
strcpy(LOCAL_ErrorSay, "%% Trying to open unexisting file in LoadForeign");
return LOAD_FAILLED;
}

View File

@ -80,7 +80,7 @@ p_load_foreign( USES_REGS1 )
/* get the initialization function name */
t1 = Deref(ARG3);
InitProcName = RepAtom(AtomOfTerm(t1))->StrOfAE;
InitProcName = (char *)RepAtom(AtomOfTerm(t1))->StrOfAE;
/* call the OS specific function for dynamic loading */
if(Yap_LoadForeign(ofiles,libs,InitProcName,&InitProc)==LOAD_SUCCEEDED) {
@ -139,7 +139,7 @@ p_open_shared_object( USES_REGS1 ) {
return FALSE;
}
s = RepAtom(AtomOfTerm(t))->StrOfAE;
s = (char *)RepAtom(AtomOfTerm(t))->StrOfAE;
if ((handle = Yap_LoadForeignFile(s, IntegerOfTerm(tflags)))==NULL) {
Yap_Error(EXISTENCE_ERROR_SOURCE_SINK,t,"open_shared_object_failed for %s with %s\n", s, LOCAL_ErrorSay);
return FALSE;
@ -209,14 +209,14 @@ p_call_shared_object_function( USES_REGS1 ) {
return FALSE;
}
CurrentModule = tmod;
res = Yap_CallForeignFile(handle, RepAtom(AtomOfTerm(tfunc))->StrOfAE);
res = Yap_CallForeignFile(handle, (char *)RepAtom(AtomOfTerm(tfunc))->StrOfAE);
CurrentModule = OldCurrentModule;
return res;
}
static Int
p_obj_suffix( USES_REGS1 ) {
return Yap_unify(Yap_CharsToListOfCodes(SO_EXT PASS_REGS),ARG1);
return Yap_unify(Yap_CharsToListOfCodes(SO_EXT, ENC_ISO_LATIN1 PASS_REGS),ARG1);
}
static Int
@ -256,7 +256,7 @@ Yap_ReOpenLoadForeign(void)
YapInitProc InitProc = NULL;
CurrentModule = f_code->module;
if(Yap_ReLoadForeign(f_code->objs,f_code->libs,RepAtom(f_code->f)->StrOfAE,&InitProc)==LOAD_SUCCEEDED) {
if(Yap_ReLoadForeign(f_code->objs,f_code->libs,(char *)RepAtom(f_code->f)->StrOfAE,&InitProc)==LOAD_SUCCEEDED) {
if (InitProc)
(*InitProc)();
}

View File

@ -47,11 +47,11 @@ static ModEntry *LookupModule(Term a);
}
inline static ModEntry *GetModuleEntry(Atom at)
/* get predicate entry for ap/arity; create it if neccessary. */
/* Get predicate entry for ap/arity; create it if necessary. */
{
Prop p0;
AtomEntry *ae = RepAtom(at);
ModEntry *new;
ModEntry *new, *oat;
p0 = ae->PropsOfAE;
while (p0) {
@ -62,7 +62,6 @@ inline static ModEntry *GetModuleEntry(Atom at)
}
{
CACHE_REGS
ModEntry *old;
new = (ModEntry *)Yap_AllocAtomSpace(sizeof(*new));
INIT_RWLOCK(new->ModRWLock);
new->KindOfPE = ModProperty;
@ -70,12 +69,12 @@ inline static ModEntry *GetModuleEntry(Atom at)
new->NextME = CurrentModules;
CurrentModules = new;
new->AtomOfME = ae;
if (CurrentModule == PROLOG_MODULE || AtomOfTerm(CurrentModule) == at) {
old = NULL;
} else
old = GetModuleEntry(AtomOfTerm(CurrentModule));
Yap_setModuleFlags(new, old);
AddPropToAtom(ae, (PropEntry *)new);
if (CurrentModule == 0L || (oat = GetModuleEntry(AtomOfTerm(CurrentModule))) == new) {
Yap_setModuleFlags(new, NULL);
} else {
Yap_setModuleFlags(new, oat);
}
}
return new;
}
@ -116,6 +115,7 @@ Term Yap_Module_Name(PredEntry *ap) {
if (mod)
return mod;
return TermProlog;
}
static ModEntry *LookupModule(Term a) {
@ -183,8 +183,9 @@ static Int
if (t == TermProlog) {
CurrentModule = PROLOG_MODULE;
} else {
// make it very clear that t inherits from cm.
LookupModule(t);
CurrentModule = t;
LookupModule(CurrentModule);
}
LOCAL_SourceModule = CurrentModule;
return TRUE;

View File

@ -167,6 +167,8 @@ static Term ParseArgs( Atom, wchar_t, JMPBUFF *, Term CACHE_TYPE);
static Term ParseList( JMPBUFF *CACHE_TYPE);
static Term ParseTerm( int, JMPBUFF *CACHE_TYPE);
const char *Yap_tokRep(TokEntry *tokptr);
static void
syntax_msg( const char *msg, ...)
{
@ -237,7 +239,7 @@ VarEntry *Yap_LookupVar(const char *var) /* lookup variable in variables table
UInt hv;
p = LOCAL_VarTable;
hv = HashFunction(var) % AtomHashTableSize;
hv = HashFunction((unsigned char *)var) % AtomHashTableSize;
while (p != NULL) {
CELL hpv = p->hv;
if (hv == hpv) {
@ -459,7 +461,9 @@ inline static void GNextToken(USES_REGS1) {
inline static void checkfor(wchar_t c, JMPBUFF *FailBuff USES_REGS) {
if (LOCAL_tokptr->Tok != Ord(Ponctuation_tok) ||
LOCAL_tokptr->TokInfo != (Term)c) {
syntax_msg("expected to find \'%c\', found %s", c, Yap_tokRep(LOCAL_tokptr));
char s[1024];
strncpy(s, Yap_tokRep(LOCAL_tokptr), 1023 );
syntax_msg("expected to find \'%c\', found %s", c, s);
FAIL;
}
NextToken;
@ -624,7 +628,7 @@ loop:
if (((int)LOCAL_tokptr->TokInfo) == ',') {
NextToken;
if (LOCAL_tokptr->Tok == Ord(Name_tok) &&
strcmp(RepAtom((Atom)(LOCAL_tokptr->TokInfo))->StrOfAE, "..") == 0) {
strcmp((char *)RepAtom((Atom)(LOCAL_tokptr->TokInfo))->StrOfAE, "..") == 0) {
NextToken;
to_store[1] = ParseTerm( 999, FailBuff PASS_REGS);
} else {
@ -744,7 +748,7 @@ static Term ParseTerm( int prio, JMPBUFF *FailBuff USES_REGS) {
case String_tok: /* build list on the heap */
{
Volatile char *p = (char *)LOCAL_tokptr->TokInfo;
t = Yap_CharsToTDQ(p, CurrentModule PASS_REGS);
t = Yap_CharsToTDQ(p, CurrentModule, ENC_ISO_LATIN1 PASS_REGS);
if (!t) {
syntax_msg( "could not convert \'%s\'", (char *)LOCAL_tokptr->TokInfo );
FAIL;
@ -766,7 +770,8 @@ static Term ParseTerm( int prio, JMPBUFF *FailBuff USES_REGS) {
case BQString_tok: /* build list on the heap */
{
Volatile char *p = (char *)LOCAL_tokptr->TokInfo;
t = Yap_CharsToTBQ(p, CurrentModule PASS_REGS);
printf("%s\n", p);
t = Yap_CharsToTBQ(p, CurrentModule, ENC_ISO_LATIN1 PASS_REGS);
if (!t) {
syntax_msg( "could not convert \'%s\"", (char *)LOCAL_tokptr->TokInfo );
FAIL;
@ -1043,8 +1048,8 @@ Term Yap_Parse(UInt prio) {
CACHE_REGS
Volatile Term t;
JMPBUFF FailBuff;
static int cnt;
yhandle_t sls = Yap_CurrentSlot(PASS_REGS1);
if (!sigsetjmp(FailBuff.JmpBuff, 0)) {
t = ParseTerm(prio, &FailBuff PASS_REGS);

View File

@ -48,11 +48,11 @@ GrowAtomTable(void) {
Atom a = p->val;
export_atom_hash_entry_t *newp;
CELL hash;
const char *apt;
const unsigned char *apt;
if (!a) continue;
apt = RepAtom(a)->StrOfAE;
apt = RepAtom(a)->UStrOfAE;
hash = HashFunction(apt)/(2*sizeof(CELL)) % new_size;
newp = newt+hash;
while (newp->val) {
@ -71,7 +71,7 @@ static void
LookupAtom(Atom at)
{
CACHE_REGS
const char *p = RepAtom(at)->StrOfAE;
const unsigned char *p = RepAtom(at)->UStrOfAE;
CELL hash = HashFunction(p) % LOCAL_ExportAtomHashTableSize;
export_atom_hash_entry_t *a;
@ -590,8 +590,8 @@ SaveHash(FILE *stream)
CHECK(save_bytes(stream, at->WStrOfAE, (wcslen(at->WStrOfAE)+1)*sizeof(wchar_t)));
} else {
CHECK(save_tag(stream, QLY_ATOM));
CHECK(save_UInt(stream, strlen(RepAtom(at)->StrOfAE)));
CHECK(save_bytes(stream, at->StrOfAE, (strlen(at->StrOfAE)+1)*sizeof(char)));
CHECK(save_UInt(stream, strlen((char *)RepAtom(at)->StrOfAE)));
CHECK(save_bytes(stream, (char *)at->StrOfAE, (strlen((char *)at->StrOfAE)+1)*sizeof(char)));
}
}
}

178
C/realpath.c Normal file
View File

@ -0,0 +1,178 @@
<html>
<head>
<title>/var/www/vhosts/netmite.com/android/mydroid/bionic/libc/bionic/realpath.c</title>
</head>
<body bgcolor="#ffffff" text="#000000">
<pre>
<font color="#444444">/*
* Copyright (c) 1994
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Jan-Simon Pendry.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/</font>
<font color="0000ff"><strong>#if defined(LIBC_SCCS) &amp;&amp; !defined(lint)</strong></font>
<strong>static</strong> <strong>char</strong> <font color="#2040a0">sccsid</font><font color="4444FF">[</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#008000">&quot;@(#)realpath.c 8.1 (Berkeley) 2/16/94&quot;</font><font color="4444FF">;</font>
<strong>static</strong> <strong>char</strong> <font color="#2040a0">rcsid</font><font color="4444FF">[</font><font color="4444FF">]</font> <font color="4444FF">=</font>
<font color="#008000">&quot;$FreeBSD: /repoman/r/ncvs/src/lib/libc/stdlib/realpath.c,v 1.6.2.1 2003/08/03 23:47:39 nectar Exp $&quot;</font><font color="4444FF">;</font>
<font color="0000ff"><strong>#endif<font color="#444444"> /* LIBC_SCCS and not lint */</font></strong></font>
<font color="0000ff"><strong>#include <font color="#008000">&lt;sys/param.h&gt;</font></strong></font>
<font color="0000ff"><strong>#include <font color="#008000">&lt;sys/stat.h&gt;</font></strong></font>
<font color="0000ff"><strong>#include <font color="#008000">&lt;errno.h&gt;</font></strong></font>
<font color="0000ff"><strong>#include <font color="#008000">&lt;fcntl.h&gt;</font></strong></font>
<font color="0000ff"><strong>#include <font color="#008000">&lt;stdlib.h&gt;</font></strong></font>
<font color="0000ff"><strong>#include <font color="#008000">&lt;string.h&gt;</font></strong></font>
<font color="0000ff"><strong>#include <font color="#008000">&lt;unistd.h&gt;</font></strong></font>
<font color="#444444">/*
* char *realpath(const char *path, char resolved_path[MAXPATHLEN]);
*
* Find the real name of path, by removing all &quot;.&quot;, &quot;..&quot; and symlink
* components. Returns (resolved) on success, or (NULL) on failure,
* in which case the path which caused trouble is left in (resolved).
*/</font>
<strong>char</strong> <font color="4444FF">*</font>
<font color="#2040a0">realpath</font><font color="4444FF">(</font><font color="#2040a0">path</font>, <font color="#2040a0">resolved</font><font color="4444FF">)</font>
<strong>const</strong> <strong>char</strong> <font color="4444FF">*</font><font color="#2040a0">path</font><font color="4444FF">;</font>
<strong>char</strong> <font color="4444FF">*</font><font color="#2040a0">resolved</font><font color="4444FF">;</font>
<font color="4444FF"><strong>{</strong></font>
<strong>struct</strong> <font color="#2040a0">stat</font> <font color="#2040a0">sb</font><font color="4444FF">;</font>
<strong>int</strong> <font color="#2040a0">fd</font>, <font color="#2040a0">n</font>, <font color="#2040a0">rootd</font>, <font color="#2040a0">serrno</font><font color="4444FF">;</font>
<strong>char</strong> <font color="4444FF">*</font><font color="#2040a0">p</font>, <font color="4444FF">*</font><font color="#2040a0">q</font>, <font color="#2040a0">wbuf</font><font color="4444FF">[</font><font color="#2040a0">MAXPATHLEN</font><font color="4444FF">]</font><font color="4444FF">;</font>
<strong>int</strong> <font color="#2040a0">symlinks</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font>
<font color="#444444">/* Save the starting point. */</font>
<strong>if</strong> <font color="4444FF">(</font><font color="4444FF">(</font><font color="#2040a0">fd</font> <font color="4444FF">=</font> <font color="#2040a0">open</font><font color="4444FF">(</font><font color="#008000">&quot;.&quot;</font>, <font color="#2040a0">O_RDONLY</font><font color="4444FF">)</font><font color="4444FF">)</font> <font color="4444FF">&lt;</font> <font color="#FF0000">0</font><font color="4444FF">)</font> <font color="4444FF"><strong>{</strong></font>
<font color="4444FF">(</font><strong>void</strong><font color="4444FF">)</font><font color="#2040a0">strcpy</font><font color="4444FF">(</font><font color="#2040a0">resolved</font>, <font color="#008000">&quot;.&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<strong>return</strong> <font color="4444FF">(</font><font color="#2040a0">NULL</font><font color="4444FF">)</font><font color="4444FF">;</font>
<font color="4444FF"><strong>}</strong></font>
<font color="#444444">/*
* Find the dirname and basename from the path to be resolved.
* Change directory to the dirname component.
* lstat the basename part.
* if it is a symlink, read in the value and loop.
* if it is a directory, then change to that directory.
* get the current directory name and append the basename.
*/</font>
<font color="4444FF">(</font><strong>void</strong><font color="4444FF">)</font><font color="#2040a0">strncpy</font><font color="4444FF">(</font><font color="#2040a0">resolved</font>, <font color="#2040a0">path</font>, <font color="#2040a0">MAXPATHLEN</font> <font color="4444FF">-</font> <font color="#FF0000">1</font><font color="4444FF">)</font><font color="4444FF">;</font>
<font color="#2040a0">resolved</font><font color="4444FF">[</font><font color="#2040a0">MAXPATHLEN</font> <font color="4444FF">-</font> <font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#008000">'<font color="#77dd77">\0</font>'</font><font color="4444FF">;</font>
<font color="#2040a0">loop</font><font color="4444FF">:</font>
<font color="#2040a0">q</font> <font color="4444FF">=</font> <font color="#2040a0">strrchr</font><font color="4444FF">(</font><font color="#2040a0">resolved</font>, <font color="#008000">'/'</font><font color="4444FF">)</font><font color="4444FF">;</font>
<strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">q</font> <font color="4444FF">!</font><font color="4444FF">=</font> <font color="#2040a0">NULL</font><font color="4444FF">)</font> <font color="4444FF"><strong>{</strong></font>
<font color="#2040a0">p</font> <font color="4444FF">=</font> <font color="#2040a0">q</font> <font color="4444FF">+</font> <font color="#FF0000">1</font><font color="4444FF">;</font>
<strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">q</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#2040a0">resolved</font><font color="4444FF">)</font>
<font color="#2040a0">q</font> <font color="4444FF">=</font> <font color="#008000">&quot;/&quot;</font><font color="4444FF">;</font>
<strong>else</strong> <font color="4444FF"><strong>{</strong></font>
<strong>do</strong> <font color="4444FF"><strong>{</strong></font>
<font color="4444FF">-</font><font color="4444FF">-</font><font color="#2040a0">q</font><font color="4444FF">;</font>
<font color="4444FF"><strong>}</strong></font> <strong>while</strong> <font color="4444FF">(</font><font color="#2040a0">q</font> <font color="4444FF">&gt;</font> <font color="#2040a0">resolved</font> <font color="4444FF">&amp;</font><font color="4444FF">&amp;</font> <font color="4444FF">*</font><font color="#2040a0">q</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#008000">'/'</font><font color="4444FF">)</font><font color="4444FF">;</font>
<font color="#2040a0">q</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#008000">'<font color="#77dd77">\0</font>'</font><font color="4444FF">;</font>
<font color="#2040a0">q</font> <font color="4444FF">=</font> <font color="#2040a0">resolved</font><font color="4444FF">;</font>
<font color="4444FF"><strong>}</strong></font>
<strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">chdir</font><font color="4444FF">(</font><font color="#2040a0">q</font><font color="4444FF">)</font> <font color="4444FF">&lt;</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<strong>goto</strong> <font color="#2040a0">err1</font><font color="4444FF">;</font>
<font color="4444FF"><strong>}</strong></font> <strong>else</strong>
<font color="#2040a0">p</font> <font color="4444FF">=</font> <font color="#2040a0">resolved</font><font color="4444FF">;</font>
<font color="#444444">/* Deal with the last component. */</font>
<strong>if</strong> <font color="4444FF">(</font><font color="4444FF">*</font><font color="#2040a0">p</font> <font color="4444FF">!</font><font color="4444FF">=</font> <font color="#008000">'<font color="#77dd77">\0</font>'</font> <font color="4444FF">&amp;</font><font color="4444FF">&amp;</font> <font color="#2040a0">lstat</font><font color="4444FF">(</font><font color="#2040a0">p</font>, <font color="4444FF">&amp;</font><font color="#2040a0">sb</font><font color="4444FF">)</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font> <font color="4444FF"><strong>{</strong></font>
<strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">S_ISLNK</font><font color="4444FF">(</font><font color="#2040a0">sb</font>.<font color="#2040a0">st_mode</font><font color="4444FF">)</font><font color="4444FF">)</font> <font color="4444FF"><strong>{</strong></font>
<strong>if</strong> <font color="4444FF">(</font><font color="4444FF">+</font><font color="4444FF">+</font><font color="#2040a0">symlinks</font> <font color="4444FF">&gt;</font> <font color="#2040a0">MAXSYMLINKS</font><font color="4444FF">)</font> <font color="4444FF"><strong>{</strong></font>
<font color="#2040a0">errno</font> <font color="4444FF">=</font> <font color="#2040a0">ELOOP</font><font color="4444FF">;</font>
<strong>goto</strong> <font color="#2040a0">err1</font><font color="4444FF">;</font>
<font color="4444FF"><strong>}</strong></font>
<font color="#2040a0">n</font> <font color="4444FF">=</font> <font color="#2040a0">readlink</font><font color="4444FF">(</font><font color="#2040a0">p</font>, <font color="#2040a0">resolved</font>, <font color="#2040a0">MAXPATHLEN</font> <font color="4444FF">-</font> <font color="#FF0000">1</font><font color="4444FF">)</font><font color="4444FF">;</font>
<strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">n</font> <font color="4444FF">&lt;</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<strong>goto</strong> <font color="#2040a0">err1</font><font color="4444FF">;</font>
<font color="#2040a0">resolved</font><font color="4444FF">[</font><font color="#2040a0">n</font><font color="4444FF">]</font> <font color="4444FF">=</font> <font color="#008000">'<font color="#77dd77">\0</font>'</font><font color="4444FF">;</font>
<strong>goto</strong> <font color="#2040a0">loop</font><font color="4444FF">;</font>
<font color="4444FF"><strong>}</strong></font>
<strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">S_ISDIR</font><font color="4444FF">(</font><font color="#2040a0">sb</font>.<font color="#2040a0">st_mode</font><font color="4444FF">)</font><font color="4444FF">)</font> <font color="4444FF"><strong>{</strong></font>
<strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">chdir</font><font color="4444FF">(</font><font color="#2040a0">p</font><font color="4444FF">)</font> <font color="4444FF">&lt;</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<strong>goto</strong> <font color="#2040a0">err1</font><font color="4444FF">;</font>
<font color="#2040a0">p</font> <font color="4444FF">=</font> <font color="#008000">&quot;&quot;</font><font color="4444FF">;</font>
<font color="4444FF"><strong>}</strong></font>
<font color="4444FF"><strong>}</strong></font>
<font color="#444444">/*
* Save the last component name and get the full pathname of
* the current directory.
*/</font>
<font color="4444FF">(</font><strong>void</strong><font color="4444FF">)</font><font color="#2040a0">strcpy</font><font color="4444FF">(</font><font color="#2040a0">wbuf</font>, <font color="#2040a0">p</font><font color="4444FF">)</font><font color="4444FF">;</font>
<strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">getcwd</font><font color="4444FF">(</font><font color="#2040a0">resolved</font>, <font color="#2040a0">MAXPATHLEN</font><font color="4444FF">)</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<strong>goto</strong> <font color="#2040a0">err1</font><font color="4444FF">;</font>
<font color="#444444">/*
* Join the two strings together, ensuring that the right thing
* happens if the last component is empty, or the dirname is root.
*/</font>
<strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">resolved</font><font color="4444FF">[</font><font color="#FF0000">0</font><font color="4444FF">]</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#008000">'/'</font> <font color="4444FF">&amp;</font><font color="4444FF">&amp;</font> <font color="#2040a0">resolved</font><font color="4444FF">[</font><font color="#FF0000">1</font><font color="4444FF">]</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#008000">'<font color="#77dd77">\0</font>'</font><font color="4444FF">)</font>
<font color="#2040a0">rootd</font> <font color="4444FF">=</font> <font color="#FF0000">1</font><font color="4444FF">;</font>
<strong>else</strong>
<font color="#2040a0">rootd</font> <font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">;</font>
<strong>if</strong> <font color="4444FF">(</font><font color="4444FF">*</font><font color="#2040a0">wbuf</font><font color="4444FF">)</font> <font color="4444FF"><strong>{</strong></font>
<strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">strlen</font><font color="4444FF">(</font><font color="#2040a0">resolved</font><font color="4444FF">)</font> <font color="4444FF">+</font> <font color="#2040a0">strlen</font><font color="4444FF">(</font><font color="#2040a0">wbuf</font><font color="4444FF">)</font> <font color="4444FF">+</font> <font color="4444FF">(</font><font color="#FF0000">1</font><font color="4444FF">-</font><font color="#2040a0">rootd</font><font color="4444FF">)</font> <font color="4444FF">+</font> <font color="#FF0000">1</font> <font color="4444FF">&gt;</font>
<font color="#2040a0">MAXPATHLEN</font><font color="4444FF">)</font> <font color="4444FF"><strong>{</strong></font>
<font color="#2040a0">errno</font> <font color="4444FF">=</font> <font color="#2040a0">ENAMETOOLONG</font><font color="4444FF">;</font>
<strong>goto</strong> <font color="#2040a0">err1</font><font color="4444FF">;</font>
<font color="4444FF"><strong>}</strong></font>
<strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">rootd</font> <font color="4444FF">=</font><font color="4444FF">=</font> <font color="#FF0000">0</font><font color="4444FF">)</font>
<font color="4444FF">(</font><strong>void</strong><font color="4444FF">)</font><font color="#2040a0">strcat</font><font color="4444FF">(</font><font color="#2040a0">resolved</font>, <font color="#008000">&quot;/&quot;</font><font color="4444FF">)</font><font color="4444FF">;</font>
<font color="4444FF">(</font><strong>void</strong><font color="4444FF">)</font><font color="#2040a0">strcat</font><font color="4444FF">(</font><font color="#2040a0">resolved</font>, <font color="#2040a0">wbuf</font><font color="4444FF">)</font><font color="4444FF">;</font>
<font color="4444FF"><strong>}</strong></font>
<font color="#444444">/* Go back to where we came from. */</font>
<strong>if</strong> <font color="4444FF">(</font><font color="#2040a0">fchdir</font><font color="4444FF">(</font><font color="#2040a0">fd</font><font color="4444FF">)</font> <font color="4444FF">&lt;</font> <font color="#FF0000">0</font><font color="4444FF">)</font> <font color="4444FF"><strong>{</strong></font>
<font color="#2040a0">serrno</font> <font color="4444FF">=</font> <font color="#2040a0">errno</font><font color="4444FF">;</font>
<strong>goto</strong> <font color="#2040a0">err2</font><font color="4444FF">;</font>
<font color="4444FF"><strong>}</strong></font>
<font color="#444444">/* It's okay if the close fails, what's an fd more or less? */</font>
<font color="4444FF">(</font><strong>void</strong><font color="4444FF">)</font><font color="#2040a0">close</font><font color="4444FF">(</font><font color="#2040a0">fd</font><font color="4444FF">)</font><font color="4444FF">;</font>
<strong>return</strong> <font color="4444FF">(</font><font color="#2040a0">resolved</font><font color="4444FF">)</font><font color="4444FF">;</font>
<font color="#2040a0">err1</font><font color="4444FF">:</font> <font color="#2040a0">serrno</font> <font color="4444FF">=</font> <font color="#2040a0">errno</font><font color="4444FF">;</font>
<font color="4444FF">(</font><strong>void</strong><font color="4444FF">)</font><font color="#2040a0">fchdir</font><font color="4444FF">(</font><font color="#2040a0">fd</font><font color="4444FF">)</font><font color="4444FF">;</font>
<font color="#2040a0">err2</font><font color="4444FF">:</font> <font color="4444FF">(</font><strong>void</strong><font color="4444FF">)</font><font color="#2040a0">close</font><font color="4444FF">(</font><font color="#2040a0">fd</font><font color="4444FF">)</font><font color="4444FF">;</font>
<font color="#2040a0">errno</font> <font color="4444FF">=</font> <font color="#2040a0">serrno</font><font color="4444FF">;</font>
<strong>return</strong> <font color="4444FF">(</font><font color="#2040a0">NULL</font><font color="4444FF">)</font><font color="4444FF">;</font>
<font color="4444FF"><strong>}</strong></font>
</pre>
<hr>
syntax highlighted by <a href="http://www.palfrader.org/code2html">Code2HTML</a>, v. 0.9.1
</body>
</html>

View File

@ -536,6 +536,18 @@ static char chtype0[NUMBER_OF_CHARS + 1] = {
#endif
};
typedef struct scanner_internals {
StreamDesc *t;
TokEntry *ctok;
char *_ScannerStack; // = (char *)TR;
char *ScannerExtraBlocks;
CELL *CommentsTail;
CELL *Comments;
CELL *CommentsNextChar;
wchar_t *CommentsBuff;
size_t CommentsBuffLim;
} scanner_internals;
char *Yap_chtype = chtype0 + 1;
int Yap_wide_chtype(Int ch) {
@ -553,16 +565,15 @@ int Yap_wide_chtype(Int ch) {
return BS;
}
static inline int getchr__(struct stream_desc* inp) {
int c = inp->stream_wgetc_for_read(inp-GLOBAL_Stream);
if (!GLOBAL_CharConversionTable || c < 0 || c >= 256)
return c;
return GLOBAL_CharConversionTable[c];
}
#define getchr(inp) getchr__(inp)
// standard get char, uses conversion table
// and converts to wide
#define getchr(inp) inp->stream_wgetc_for_read(inp-GLOBAL_Stream)
// get char for quoted data, eg, quoted atoms and so on
// converts to wide
#define getchrq(inp) inp->stream_wgetc(inp-GLOBAL_Stream)
// get char for UTF-8 quoted data, eg, quoted strings
// reads bytes
#define getchru(inp) inp->stream_getc_utf8(inp-GLOBAL_Stream)
/* in case there is an overflow */
typedef struct scanner_extra_alloc {
@ -1141,7 +1152,7 @@ Yap_tokRep(TokEntry *tokptr)
switch (tokptr->Tok) {
case Name_tok:
return RepAtom((Atom)info)->StrOfAE;
return (char *)RepAtom((Atom)info)->StrOfAE;
case Number_tok:
if ((b = Yap_TermToString(info, buf, sze, &length,LOCAL_encoding, flags)) != buf) {
if (b) free(b);
@ -1158,7 +1169,15 @@ Yap_tokRep(TokEntry *tokptr)
return (char *)info;
case WString_tok:
case WBQString_tok:
return utf8_wcscpy(buf, (wchar_t *)info);
{ wchar_t *op = (wchar_t *)info;
wchar_t c;
unsigned char *bp = (unsigned char *)buf;
while ((c=*op++) ){
bp += put_utf8(bp, c);
}
bp[0]='\0';
return buf;
}
case Error_tok:
return "<ERR>";
case eot_tok:
@ -1274,7 +1293,7 @@ static wchar_t *ch_to_wide(char *base, char *charp) {
if ((ch & 0xff) == ch) { \
*charp++ = ch; \
} else { \
charp = _PL__utf8_put_char(charp, ch); \
charp = _PL__put_utf8(charp, chr); \
} \
}
@ -1382,7 +1401,7 @@ continue_comment:
och = ch;
ch = getchr(inp_stream);
scan_name:
TokImage = ((AtomEntry *)(Yap_PreAllocCodeSpace()))->StrOfAE;
TokImage = (char *)((AtomEntry *)(Yap_PreAllocCodeSpace()))->StrOfAE;
charp = TokImage;
wcharp = NULL;
isvar = (chtype(och) != LC);
@ -1555,7 +1574,7 @@ huge_var_error:
case QT:
case DC:
quoted_string:
TokImage = ((AtomEntry *)(Yap_PreAllocCodeSpace()))->StrOfAE;
TokImage = (char *)((AtomEntry *)(Yap_PreAllocCodeSpace()))->StrOfAE;
charp = TokImage;
quote = ch;
len = 0;
@ -1615,7 +1634,7 @@ quoted_string:
} else {
*charp = '\0';
}
if (quote == '"') {
if (quote == '"'||quote == '`') {
if (wcharp) {
mp = AllocScannerMemory(sizeof(wchar_t) * (len + 1));
} else {
@ -1635,37 +1654,21 @@ quoted_string:
}
t->TokInfo = Unsigned(mp);
Yap_ReleasePreAllocCodeSpace((CODEADDR)TokImage);
if (quote == '"') {
if (wcharp) {
t->Tok = Ord(kind = WString_tok);
} else {
t->Tok = Ord(kind = String_tok);
}
} else if (quote == '`') {
if (wcharp) {
mp = AllocScannerMemory( utf8_strlen1(TokImage) + 1 );
} else {
mp = AllocScannerMemory(len + 1);
}
if (mp == NULL) {
LOCAL_ErrorMessage =
"not enough heap space to read in string or quoted atom";
Yap_ReleasePreAllocCodeSpace((CODEADDR)TokImage);
t->Tok = Ord(kind = eot_tok);
return l;
}
if (wcharp) {
wcscpy((wchar_t *)mp, (wchar_t *)TokImage);
} else {
strcpy(mp, TokImage);
}
t->TokInfo = Unsigned(mp);
Yap_ReleasePreAllocCodeSpace((CODEADDR)TokImage);
if (wcharp) {
t->Tok = Ord(kind = WBQString_tok);
} else {
t->Tok = Ord(kind = BQString_tok);
}
} else {
if (wcharp) {
t->Tok = Ord(kind = WBQString_tok);
} else {
t->Tok = Ord(kind = BQString_tok);
}
}
} else {
if (wcharp) {
t->TokInfo = Unsigned(Yap_LookupWideAtom((wchar_t *)TokImage));
} else {
@ -1747,7 +1750,7 @@ enter_symbol:
} else {
Atom ae;
TokImage = ((AtomEntry *)(Yap_PreAllocCodeSpace()))->StrOfAE;
TokImage = (char *)((AtomEntry *)(Yap_PreAllocCodeSpace()))->StrOfAE;
charp = TokImage;
wcharp = NULL;
add_ch_to_buff(och);
@ -1913,8 +1916,8 @@ enter_symbol:
ch = getchrq(inp_stream);
if (ch != '}') {
} else {
add_ch_to_utf8_buff(och);
add_ch_to_utf8_buff(ch);
charp = ( char *)put_utf8((unsigned char *)charp, och);
charp = ( char *)put_utf8((unsigned char *)charp, ch);
/* we're done */
break;
}
@ -1924,7 +1927,7 @@ enter_symbol:
t->Tok = Ord(kind = eot_tok);
break;
} else {
add_ch_to_utf8_buff(ch);
charp = ( char *)put_utf8((unsigned char *)charp, ch);
ch = getchrq(inp_stream);
}
if (charp > (char *)AuxSp - 1024) {

View File

@ -239,17 +239,17 @@ p_creep_fail( USES_REGS1 )
static Int stop_creeping( USES_REGS1 )
{
get_signal( YAP_CREEP_SIGNAL PASS_REGS );
return TRUE;
return true;
}
static Int
p_creep_allowed( USES_REGS1 )
creep_allowed( USES_REGS1 )
{
if (PP != NULL) {
get_signal(YAP_CREEP_SIGNAL PASS_REGS);
return TRUE;
return true;
}
return FALSE;
return false;
}
void
@ -455,7 +455,7 @@ Yap_InitSignalCPreds(void)
Yap_InitCPred("$disable_debugging", 0, stop_creeping, NoTracePredFlag|HiddenPredFlag|SafePredFlag);
Yap_InitCPred ("$first_signal", 1, p_first_signal, SafePredFlag|SyncPredFlag);
Yap_InitCPred ("$continue_signals", 0, p_continue_signals, SafePredFlag|SyncPredFlag);
Yap_InitCPred("$creep_allowed", 0, p_creep_allowed, 0);
Yap_InitCPred("creep_allowed", 0, creep_allowed, 0);
#ifdef DEBUG
Yap_InitCPred("sys_debug", 1, p_debug, SafePredFlag|SyncPredFlag);
#endif

1651
C/stack.c Normal file

File diff suppressed because it is too large Load Diff

1159
C/stackinfo.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -538,7 +538,7 @@ static Int p_opdec(USES_REGS1) { /* '$opdec'(p,type,atom) */
if (tmod == TermProlog) {
tmod = PROLOG_MODULE;
}
return Yap_OpDec((int)IntOfTerm(p), RepAtom(AtomOfTerm(t))->StrOfAE,
return Yap_OpDec((int)IntOfTerm(p), (char *)RepAtom(AtomOfTerm(t))->StrOfAE,
AtomOfTerm(at), tmod);
}
@ -1501,7 +1501,7 @@ static Int p_statistics_atom_info(USES_REGS1) {
while (catom != NIL) {
Atom ncatom;
count++;
spaceused += sizeof(AtomEntry) + strlen(RepAtom(catom)->StrOfAE) + 1;
spaceused += sizeof(AtomEntry) + strlen((char *)RepAtom(catom)->StrOfAE) + 1;
ncatom = RepAtom(catom)->NextOfAE;
if (ncatom != NIL) {
READ_LOCK(RepAtom(ncatom)->ARWLock);
@ -1795,6 +1795,7 @@ void Yap_InitCPreds(void) {
Yap_InitUnify();
Yap_InitQLY();
Yap_InitQLYR();
Yap_InitStInfo();
Yap_udi_init();
Yap_udi_Interval_init();
Yap_InitSignalCPreds();

247
C/text.c
View File

@ -226,8 +226,8 @@ SkipListCodes(Term *l, Term **tailp, Int *atoms, bool *wide)
AtomEntry *ae = RepAtom(AtomOfTerm(hd));
if ((ae->StrOfAE)[1] != '\0') { length = -REPRESENTATION_ERROR_CHARACTER_CODE; }
}
} else if (IsIntTerm(hd)) {
Int ch = IntOfTerm(hd);
} else if (IsIntegerTerm(hd)) {
Int ch = IntegerOfTerm(hd);
if (/* *atoms|| */ch < 0) { *tailp = l; /*if (*atoms) length = -TYPE_ERROR_STRING;*/ length = -DOMAIN_ERROR_NOT_LESS_THAN_ZERO; }
else if (ch > 0x80) { *wide = TRUE; }
} else {
@ -287,7 +287,7 @@ Yap_ListOfAtomsToBuffer(void *buf, Term t, seq_tv_t *inp, bool *widep, size_t *l
} else {
char *s;
if (buf) s = buf;
else s = ((AtomEntry *)Yap_PreAllocCodeSpace())->StrOfAE;
else s = (char *)((AtomEntry *)Yap_PreAllocCodeSpace())->StrOfAE;
AUX_ERROR( t, 2*(n+1), s, char);
s = get_string_from_list( t, inp, s, atoms PASS_REGS);
return s;
@ -327,15 +327,16 @@ Yap_ListOfCodesToBuffer(void *buf, Term t, seq_tv_t *inp, bool *widep, size_t *l
s = get_wide_from_list( t, inp, s, atoms PASS_REGS);
return s;
} else {
char *s;
char *s;
if (buf) s = buf;
else s = ((AtomEntry *)Yap_PreAllocCodeSpace())->StrOfAE;
AUX_ERROR( t, 2*(n+1), s, char);
s = get_string_from_list( t, inp, s, atoms PASS_REGS);
AUX_ERROR( t, 2*(n+1), (char *)s, char);
s = ( char *)get_string_from_list( t, inp, (char *)s, atoms PASS_REGS);
return s;
}
}
#if USE_GEN_TYPE_ERROR
static yap_error_number
gen_type_error(int flags) {
if ((flags & (YAP_STRING_STRING|YAP_STRING_ATOM|YAP_STRING_INT|YAP_STRING_FLOAT|YAP_STRING_ATOMS_CODES|YAP_STRING_BIG)) ==
@ -355,6 +356,7 @@ gen_type_error(int flags) {
return TYPE_ERROR_LIST;
return TYPE_ERROR_NUMBER;
}
#endif
void *
Yap_readText( void *buf, seq_tv_t *inp, encoding_t *enc, int *minimal, size_t *lengp USES_REGS)
@ -365,7 +367,7 @@ Yap_readText( void *buf, seq_tv_t *inp, encoding_t *enc, int *minimal, size_t *l
/* we know what the term is */
if (inp->type & YAP_STRING_STRING && !IsVarTerm(inp->val.t) && IsStringTerm(inp->val.t)) { const char *s;
s = StringOfTerm( inp->val.t );
s = (char *)StringOfTerm( inp->val.t );
if ( s == NULL ) {
return 0L;
}
@ -386,7 +388,7 @@ Yap_readText( void *buf, seq_tv_t *inp, encoding_t *enc, int *minimal, size_t *l
*enc = ENC_WCHAR;
return ws;
} else {
s = at->StrOfAE;
s = (char *)at->StrOfAE;
*lengp = strlen(s);
*enc = ENC_ISO_LATIN1;
return s;
@ -395,7 +397,6 @@ Yap_readText( void *buf, seq_tv_t *inp, encoding_t *enc, int *minimal, size_t *l
if (inp->type & YAP_STRING_CODES && !IsVarTerm(inp->val.t) && (s = Yap_ListOfCodesToBuffer( buf, inp->val.t, inp, &wide, lengp PASS_REGS))) {
// this is a term, extract to a sfer, and representation is wide
*minimal = TRUE;
int wide = FALSE;
*enc = ( wide ? ENC_WCHAR : ENC_ISO_LATIN1 );
return s;
}
@ -404,7 +405,7 @@ Yap_readText( void *buf, seq_tv_t *inp, encoding_t *enc, int *minimal, size_t *l
*minimal = TRUE;
s = Yap_ListOfAtomsToBuffer( buf, inp->val.t, inp, &wide, lengp PASS_REGS);
if (!s) return NULL;
if (wide) { *enc = ENC_WCHAR; }
if (wide) { *enc = ENC_ISO_UTF8; }
else { *enc = ENC_ISO_LATIN1; }
return s;
}
@ -452,7 +453,7 @@ Yap_readText( void *buf, seq_tv_t *inp, encoding_t *enc, int *minimal, size_t *l
return s;
}
if (inp->type & YAP_STRING_CHARS) {
*enc = ENC_ISO_LATIN1;
*enc = inp->enc;
if (inp->type & YAP_STRING_NCHARS)
*lengp = inp->sz;
else
@ -481,21 +482,21 @@ write_strings( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
switch (enc) {
case ENC_ISO_UTF8:
{ char *s = s0, *lim = s + (max = strnlen(s, max));
{ unsigned char *s = s0, *lim = s + (max = strlen_utf8(s));
Term t = init_tstring( PASS_REGS1 );
char *cp = s, *buf;
unsigned char *cp = s, *buf;
LOCAL_TERM_ERROR( 2*(lim-s) );
buf = buf_from_tstring(HR);
while (*cp && cp < lim) {
int chr;
cp = utf8_get_char(cp, &chr);
buf = utf8_put_char(buf, chr);
utf8proc_int32_t chr;
cp += get_utf8(cp, &chr);
buf += put_utf8(buf, chr);
}
if (max >= min) *buf++ = '\0';
else while (max < min) {
max++;
buf = utf8_put_char(buf, '\0');
buf += put_utf8(buf, '\0');
}
close_tstring( buf PASS_REGS );
@ -503,44 +504,44 @@ write_strings( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
}
break;
case ENC_ISO_LATIN1:
{ unsigned char *s = s0, *lim = s + (max = strnlen(s0, max));
{ unsigned char *s = s0, *lim = s + (max = strlen_latin_utf8(s0));
Term t = init_tstring( PASS_REGS1 );
unsigned char *cp = s;
char *buf;
unsigned char *buf;
utf8proc_int32_t chr;
LOCAL_TERM_ERROR( 2*(lim-s) );
buf = buf_from_tstring(HR);
while (cp < lim) {
int chr;
cp = get_char(cp, &chr);
buf = utf8_put_char(buf, chr);
buf += put_utf8(buf, chr);
}
if (max >= min) *buf++ = '\0';
else while (max < min) {
max++;
buf = utf8_put_char(buf, '\0');
buf += put_utf8(buf, chr);
}
close_tstring( buf PASS_REGS );
out->val.t = t;
}
break;
case ENC_WCHAR:
{ wchar_t *s = s0, *lim = s + (max = wcsnlen(s, max));
{ wchar_t *s = s0, *lim = s + (max = strlen_ucs2_utf8(s0));
Term t = init_tstring( PASS_REGS1 );
wchar_t *wp = s;
char *buf;
unsigned char *buf;
LOCAL_TERM_ERROR( 2*(lim-s) );
buf = buf_from_tstring(HR);
while (wp < lim) {
int chr;
utf8proc_int32_t chr;
wp = get_wchar(wp, &chr);
buf = utf8_put_char(buf, chr);
buf += put_utf8(buf, chr);
}
if (max >= min) *buf++ = '\0';
else while (max < min) {
max++;
buf = utf8_put_char(buf, '\0');
buf += put_utf8(buf, '\0');
}
close_tstring( buf PASS_REGS );
out->val.t = t;
@ -569,15 +570,15 @@ write_atoms( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
switch (enc) {
case ENC_ISO_UTF8:
{ char *s = s0, *lim = s + strnlen(s, max);
char *cp = s;
{ unsigned char *s = s0, *lim = s + strnlen((char*)s, max);
unsigned char *cp = s;
wchar_t w[2];
w[1] = '\0';
LOCAL_TERM_ERROR( 2*(lim-s) );
while (cp < lim && *cp) {
int chr;
utf8proc_int32_t chr;
CELL *cl;
cp = utf8_get_char(cp, &chr);
cp += get_utf8(cp, &chr);
if (chr == '\0') break;
w[0] = chr;
cl = HR;
@ -597,7 +598,7 @@ write_atoms( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
LOCAL_TERM_ERROR( 2*(lim-s) );
while (cp < lim) {
int chr;
utf8proc_int32_t chr;
cp = get_char(cp, &chr);
if (chr == '\0') break;
w[0] = chr;
@ -617,7 +618,7 @@ write_atoms( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
LOCAL_TERM_ERROR( 2*(lim-s) );
while (*cp && cp < lim) {
int chr;
utf8proc_int32_t chr;
cp = get_wchar(cp, &chr);
if (chr == '\0') break;
w[0] = chr;
@ -657,12 +658,12 @@ write_codes( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
switch (enc) {
case ENC_ISO_UTF8:
{ char *s = s0, *lim = s + strnlen(s, max);
char *cp = s;
{ unsigned char *s = s0, *lim = s + strnlen(s0, max);
unsigned char *cp = s;
LOCAL_TERM_ERROR( 2*(lim-s) );
while (*cp && cp < lim) {
int chr;
cp = utf8_get_char(cp, &chr);
utf8proc_int32_t chr;
cp += get_utf8(cp, &chr);
HR[0] = MkIntTerm(chr);
HR[1] = AbsPair(HR+2);
HR += 2;
@ -677,7 +678,7 @@ write_codes( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
LOCAL_TERM_ERROR( 2*(lim-s) );
while (cp < lim) {
int chr;
utf8proc_int32_t chr;
cp = get_char(cp, &chr);
HR[0] = MkIntTerm(chr);
HR[1] = AbsPair(HR+2);
@ -693,7 +694,7 @@ write_codes( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng U
LOCAL_TERM_ERROR( 2*(lim-s) );
while (cp < lim) {
int chr;
utf8proc_int32_t chr;
cp = get_wchar(cp, &chr);
HR[0] = MkIntTerm(chr);
HR[1] = AbsPair(HR+2);
@ -734,13 +735,13 @@ write_atom( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng US
switch (enc) {
case ENC_ISO_UTF8:
{ char *s = s0, *lim = s + strnlen(s, max);
{ unsigned char *s = s0, *lim = s + strnlen(s0, max);
wchar_t *buf = malloc(sizeof(wchar_t)*((lim+1)-s)), *ptr = buf;
Atom at;
while (*s && s < lim) {
int chr;
s = utf8_get_char(s, &chr);
utf8proc_int32_t chr;
s += get_utf8(s, &chr);
*ptr++ = chr;
}
*ptr++ = '\0';
@ -784,9 +785,9 @@ write_wbuffer( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
}
if (out->enc != enc || out->type & (YAP_STRING_WITH_BUFFER|YAP_STRING_MALLOC)) {
if (enc != ENC_WCHAR) {
sz = strlen((char *)s0);
sz = strlen((char *)s0)+1;
} else {
sz = wcslen((wchar_t *)s0);
sz = wcslen((wchar_t *)s0)+1;
}
if (sz < min) sz = min;
sz *= sizeof(wchar_t);
@ -807,7 +808,7 @@ write_wbuffer( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
case ENC_WCHAR:
if (out->type & (YAP_STRING_WITH_BUFFER|YAP_STRING_MALLOC) ) {
wchar_t *s = s0;
size_t n = wcslen( s );
size_t n = wcslen( s )+1;
if (n < min) n = min;
memcpy( out->val.c, s0, n*sizeof(wchar_t));
out->val.w[n] = '\0';
@ -815,23 +816,23 @@ write_wbuffer( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
}
case ENC_ISO_UTF8:
{
char *s = s0, *lim = s + (max = strnlen(s, max));
char *cp = s;
unsigned char *s = s0, *lim = s + (max = strnlen(s0, max));
unsigned char *cp = s;
wchar_t *buf0, *buf;
buf = buf0 = out->val.w;
if (!buf)
return -1;
while (*cp && cp < lim) {
int chr;
cp = utf8_get_char(cp, &chr);
utf8proc_int32_t chr;
cp += get_utf8(cp, &chr);
*buf++ = chr;
}
if (max >= min) *buf++ = '\0';
else while (max < min) {
int chr;
utf8proc_int32_t chr;
max++;
cp = utf8_get_char(cp, &chr);
cp += get_utf8(cp, &chr);
*buf++ = chr;
}
*buf = '\0';
@ -850,8 +851,8 @@ 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__);
sz_end = -1;
Yap_Error(SYSTEM_ERROR, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc), __FUNCTION__);
}
}
sz_end *= sizeof( wchar_t );
@ -874,9 +875,9 @@ write_buffer( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
if (out->enc != enc || out->type & (YAP_STRING_WITH_BUFFER|YAP_STRING_MALLOC)) {
size_t sz;
if (enc != ENC_WCHAR)
sz = strlen((char *)s0);
sz = strlen((char *)s0)+1;
else
sz = wcslen((wchar_t *)s0);
sz = wcslen((wchar_t *)s0)+1;
if (sz < min) sz = min;
if (!minimal) sz *= 4;
if (out->type & (YAP_STRING_MALLOC)) {
@ -894,7 +895,7 @@ write_buffer( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
case ENC_ISO_UTF8:
if (out->type & (YAP_STRING_WITH_BUFFER|YAP_STRING_MALLOC) ) {
char *s = s0;
size_t n = strlen( s );
size_t n = strlen( s )+1;
memcpy( out->val.c, s0, n*sizeof(wchar_t));
out->val.c[n] = '\0';
sz_end = n+1;
@ -904,23 +905,24 @@ write_buffer( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
break;
case ENC_ISO_LATIN1:
{
char *s = s0, *lim = s + (max = strnlen(s, max));
char *cp = s, *buf0, *buf;
unsigned char *s = s0, *lim = s + (max = strnlen(s0, max));
unsigned char *cp = s, *buf0, *buf;
buf = buf0 = out->val.c;
buf = buf0 = out->val.uc;
if (!buf)
return -1;
while (*cp && cp < lim) {
int chr;
utf8proc_int32_t chr;
chr = *cp++;
buf = utf8_put_char(buf, chr);
buf += put_utf8(buf, chr);
}
if (max >= min) *buf++ = '\0';
else while (max < min) {
max++;
int chr;
utf8proc_int32_t chr;
chr = *cp++;
buf = utf8_put_char(buf, chr);
buf += put_utf8(buf, chr);
}
buf[0] = '\0';
sz_end = (buf+1)-buf0;
@ -929,15 +931,15 @@ write_buffer( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
case ENC_WCHAR:
{
wchar_t *s = s0;
char *buf = out->val.c;
unsigned char *buf = out->val.uc;
size_t n = wcslen( s ), i;
if (n < min) n = min;
for (i = 0; i < n; i++) {
int chr = s[i];
buf = utf8_put_char(buf, chr);
utf8proc_int32_t chr = s[i];
buf += put_utf8(buf, chr);
}
*buf++ = '\0';
sz_end = (buf+1)-out->val.c;
sz_end = (buf+1)-out->val.uc;
}
break;
default:
@ -962,26 +964,26 @@ write_buffer( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
break;
case ENC_ISO_UTF8:
{
char *s = s0, *lim = s + (max = strnlen(s, max));
char *cp = s;
char *buf0, *buf;
unsigned char *s = s0, *lim = s + (max = strnlen(s0, max));
unsigned char *cp = s;
unsigned char *buf0, *buf;
buf = buf0 = out->val.c;
buf = buf0 = out->val.uc;
if (!buf)
return -1;
while (*cp && cp < lim) {
int chr;
cp = utf8_get_char(cp, &chr);
utf8proc_int32_t chr;
cp += get_utf8(cp, &chr);
*buf++ = chr;
}
if (max >= min) *buf++ = '\0';
else while (max < min) {
int chr;
utf8proc_int32_t chr;
max++;
cp = utf8_get_char(cp, &chr);
cp += get_utf8(cp, &chr);
*buf++ = chr;
}
sz_end = buf-out->val.c;
sz_end = buf-out->val.uc;
}
break;
case ENC_WCHAR:
@ -999,7 +1001,10 @@ write_buffer( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
sz_end = -1;
Yap_Error(SYSTEM_ERROR, TermNil, "Unsupported Encoding ~s in %s", enc_name(enc), __FUNCTION__);
}
}
} else {
// no other encodings are supported.
sz_end = -1;
}
if (out->type & (YAP_STRING_MALLOC)) {
out->val.c = realloc(out->val.c,sz_end);
}
@ -1022,8 +1027,8 @@ write_length( void *s0, seq_tv_t *out, encoding_t enc, int minimal, size_t leng
switch (enc) {
case ENC_ISO_UTF8:
{
const char *s = s0;
return utf8_strlen1(s);
const unsigned char *s = s0;
return strlen_utf8(s);
}
case ENC_ISO_LATIN1:
{
@ -1158,7 +1163,7 @@ advance_Text( void *s, int l, encoding_t enc )
case ENC_ISO_LATIN1:
return ((char *)s)+l;
case ENC_ISO_UTF8:
return (char *)utf8_skip((const char *)s,l);
return (char *)skip_utf8(s,l);
case ENC_WCHAR:
return ((wchar_t *)s)+l;
default:
@ -1180,14 +1185,14 @@ cmp_Text( void *s1, void *s2, int l, encoding_t enc1, encoding_t enc2 )
return strncmp(s1, s2, l);
case ENC_ISO_UTF8:
{
int chr1, chr2;
char *w2 = s2;
for (i = 0; i < l; i++) { chr1 = *w1++; w2 = utf8_get_char(w2, &chr2); if (chr1-chr2) return chr1-chr2; }
utf8proc_int32_t chr1, chr2;
unsigned char *w2 = s2;
for (i = 0; i < l; i++) { chr1 = *w1++; w2 += get_utf8(w2, &chr2); if (chr1-chr2) return chr1-chr2; }
}
return 0;
case ENC_WCHAR:
{
int chr1, chr2;
utf8proc_int32_t chr1, chr2;
wchar_t *w2 = s2;
for (i = 0; i < l; i++) { chr1 = *w1++; chr2 = *w2++; if (chr1-chr2) return chr1-chr2; }
}
@ -1198,27 +1203,27 @@ cmp_Text( void *s1, void *s2, int l, encoding_t enc1, encoding_t enc2 )
}
case ENC_ISO_UTF8:
{
char *w1 = (char *)s1;
unsigned char *w1 = s1;
switch (enc2) {
case ENC_ISO_LATIN1:
{
int chr1, chr2;
char *w2 = s2;
for (i = 0; i < l; i++) { chr2 = *w2++; w1 = utf8_get_char(w1, &chr1); if (chr1-chr2) return chr1-chr2; }
utf8proc_int32_t chr1, chr2;
unsigned char *w2 = s2;
for (i = 0; i < l; i++) { chr2 = *w2++; w1 += get_utf8(w1, &chr1); if (chr1-chr2) return chr1-chr2; }
}
return 0;
case ENC_ISO_UTF8:
{
int chr1, chr2;
char *w2 = s2;
for (i = 0; i < l; i++) { w2 = utf8_get_char(w2, &chr2); w1 = utf8_get_char(w1, &chr1); if (chr1-chr2) return chr1-chr2; }
utf8proc_int32_t chr1, chr2;
unsigned char *w2 = s2;
for (i = 0; i < l; i++) { w2 += get_utf8(w2, &chr2); w1 += get_utf8(w1, &chr1); if (chr1-chr2) return chr1-chr2; }
}
return 0;
case ENC_WCHAR:
{
int chr1, chr2;
utf8proc_int32_t chr1, chr2;
wchar_t *w2 = s2;
for (i = 0; i < l; i++) { chr2 = *w2++; w1 = utf8_get_char(w1, &chr1); if (chr1-chr2) return chr1-chr2; }
for (i = 0; i < l; i++) { chr2 = *w2++; w1 += get_utf8(w1, &chr1); if (chr1-chr2) return chr1-chr2; }
}
return 0;
default:
@ -1231,16 +1236,16 @@ cmp_Text( void *s1, void *s2, int l, encoding_t enc1, encoding_t enc2 )
switch (enc2) {
case ENC_ISO_LATIN1:
{
int chr1, chr2;
utf8proc_int32_t chr1, chr2;
char *w2 = s2;
for (i = 0; i < l; i++) { chr1 = *w1++; chr2 = *w2++; if (chr1-chr2) return chr1-chr2; }
}
return 0;
case ENC_ISO_UTF8:
{
int chr1, chr2;
char *w2 = s2;
for (i = 0; i < l; i++) { chr1 = *w1++; w2 = utf8_get_char(w2, &chr2); if (chr1-chr2) return chr1-chr2; }
utf8proc_int32_t chr1, chr2;
unsigned char *w2 = s2;
for (i = 0; i < l; i++) { chr1 = *w1++; w2 += get_utf8(w2, &chr2); if (chr1-chr2) return chr1-chr2; }
}
return 0;
case ENC_WCHAR:
@ -1261,20 +1266,20 @@ concat( int n, seq_tv_t *out, void *sv[], encoding_t encv[], size_t lengv[] USES
if (out->type == YAP_STRING_STRING) {
/* we assume we concatenate strings only, or ASCII stuff like numbers */
Term t = init_tstring( PASS_REGS1 );
char *buf = buf_from_tstring(HR);
unsigned char *buf = buf_from_tstring(HR);
int i;
for (i = 0; i < n; i++) {
if (encv[i] == ENC_WCHAR) {
wchar_t *ptr = sv[i];
int chr;
while ( (chr = *ptr++) ) buf = utf8_put_char(buf, chr);
utf8proc_int32_t chr;
while ( (chr = *ptr++) ) buf += put_utf8(buf, chr);
} else if (encv[i] == ENC_ISO_LATIN1) {
char *ptr = sv[i];
int chr;
while ( (chr = *ptr++) ) buf = utf8_put_char(buf, chr);
utf8proc_int32_t chr;
while ( (chr = *ptr++) ) buf += put_utf8(buf, chr);
} else {
char *ptr = sv[i];
int chr;
utf8proc_int32_t chr;
while ( (chr = *ptr++) ) *buf++ = chr;
}
}
@ -1301,16 +1306,16 @@ concat( int n, seq_tv_t *out, void *sv[], encoding_t encv[], size_t lengv[] USES
for (i = 0; i < n ; i ++) {
if (encv[i] == ENC_WCHAR) {
wchar_t *ptr = sv[i];
int chr;
utf8proc_int32_t chr;
while ( (chr = *ptr++) != '\0' ) *buf++ = chr;
} else if (encv[i] == ENC_ISO_LATIN1) {
char *ptr = sv[i];
int chr;
utf8proc_int32_t chr;
while ( (chr = *ptr++) != '\0' ) *buf++ = (unsigned char)chr;
} else {
char *ptr = sv[i];
int chr;
while ( (ptr = utf8_get_char( ptr, &chr )) != NULL ) { if (chr == '\0') break; else *buf++ = chr; }
unsigned char *ptr = sv[i];
utf8proc_int32_t chr;
while ( (ptr += get_utf8( ptr, &chr )) != NULL ) { if (chr == '\0') break; else *buf++ = chr; }
}
}
*buf++ = '\0';
@ -1324,7 +1329,7 @@ concat( int n, seq_tv_t *out, void *sv[], encoding_t encv[], size_t lengv[] USES
LOCAL_TERM_ERROR( sz/sizeof(CELL)+3 );
for (i = 0; i < n ; i ++) {
char *ptr = sv[i];
int chr;
utf8proc_int32_t chr;
while ( (chr = *ptr++) != '\0' ) *buf++ = chr;
}
*buf++ = '\0';
@ -1341,20 +1346,20 @@ slice( size_t min, size_t max, void *buf, seq_tv_t *out, encoding_t enc USES_REG
if (out->type == YAP_STRING_STRING) {
/* we assume we concatenate strings only, or ASCII stuff like numbers */
Term t = init_tstring( PASS_REGS1 );
char *nbuf = buf_from_tstring(HR);
unsigned char *nbuf = buf_from_tstring(HR);
if (enc == ENC_WCHAR) {
wchar_t *ptr = (wchar_t *)buf + min;
int chr;
while ( min++ < max ) { chr = *ptr++; nbuf = utf8_put_char(nbuf, chr); }
utf8proc_int32_t chr;
while ( min++ < max ) { chr = *ptr++; nbuf += put_utf8(nbuf, chr); }
} else if (enc == ENC_ISO_LATIN1) {
char *ptr = (char *)buf + min;
int chr;
while ( min++ < max ) { chr = *ptr++; nbuf = utf8_put_char(nbuf, chr); }
unsigned char *ptr = (unsigned char *)buf + min;
utf8proc_int32_t chr;
while ( min++ < max ) { chr = *ptr++; nbuf += put_utf8(nbuf, chr); }
} else {
const char *ptr = utf8_skip ( (const char *)buf, min );
int chr;
unsigned char *ptr = skip_utf8 (buf, min );
utf8proc_int32_t chr;
if (!ptr) return NULL;
while ( min++ < max ) { ptr = utf8_get_char(ptr, & chr); nbuf = utf8_put_char(nbuf, chr); }
while ( min++ < max ) { ptr += get_utf8(ptr, & chr); nbuf += put_utf8(nbuf, chr); }
}
*nbuf ++ = '\0';
close_tstring( nbuf PASS_REGS );
@ -1387,11 +1392,11 @@ slice( size_t min, size_t max, void *buf, seq_tv_t *out, encoding_t enc USES_REG
} else {
/* atom */
wchar_t *nbuf = (wchar_t *)HR;
const char *ptr = utf8_skip ( (const char *)buf, min );
int chr;
unsigned char *ptr = skip_utf8 ( ( unsigned char *)buf, min );
utf8proc_int32_t chr;
LOCAL_ERROR( max-min );
while ( min++ < max ) { ptr = utf8_get_char(ptr, & chr); *nbuf++ = chr; }
while ( min++ < max ) { ptr += get_utf8(ptr, & chr); *nbuf++ = chr; }
nbuf[0] = '\0';
at = Yap_LookupMaybeWideAtom( (wchar_t*)HR );
}

View File

@ -334,12 +334,12 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
}
switch (port) {
case enter_pred:
mname = RepAtom(AtomOfTerm(Yap_Module_Name(pred)))->StrOfAE;
mname = (char *)RepAtom(AtomOfTerm(Yap_Module_Name(pred)))->StrOfAE;
arity = pred->ArityOfPE;
if (arity == 0)
s = RepAtom((Atom)pred->FunctorOfPred)->StrOfAE;
s = (char *)RepAtom((Atom)pred->FunctorOfPred)->StrOfAE;
else
s = RepAtom(NameOfFunctor((pred->FunctorOfPred)))->StrOfAE;
s = (char *)RepAtom(NameOfFunctor((pred->FunctorOfPred)))->StrOfAE;
/* if ((pred->ModuleOfPred == 0) && (s[0] == '$'))
return; */
send_tracer_message("CALL: ", s, arity, mname, args);
@ -353,23 +353,23 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
break;
case retry_table_generator:
send_tracer_message("FAIL ", NULL, 0, NULL, args);
mname = RepAtom(AtomOfTerm(Yap_Module_Name(pred)))->StrOfAE;
mname = (char *)RepAtom(AtomOfTerm(Yap_Module_Name(pred)))->StrOfAE;
arity = pred->ArityOfPE;
if (arity == 0)
s = RepAtom((Atom)pred->FunctorOfPred)->StrOfAE;
s = (char *)RepAtom((Atom)pred->FunctorOfPred)->StrOfAE;
else
s = RepAtom(NameOfFunctor((pred->FunctorOfPred)))->StrOfAE;
s = (char *)RepAtom(NameOfFunctor((pred->FunctorOfPred)))->StrOfAE;
send_tracer_message("RETRY GENERATOR: ", s, arity, mname, args);
break;
case retry_table_consumer:
send_tracer_message("FAIL ", NULL, 0, NULL, args);
mname = RepAtom(AtomOfTerm(Yap_Module_Name(pred)))->StrOfAE;
mname = (char *)RepAtom(AtomOfTerm(Yap_Module_Name(pred)))->StrOfAE;
arity = pred->ArityOfPE;
if (arity == 0) {
s = RepAtom((Atom)pred->FunctorOfPred)->StrOfAE;
s = (char *)RepAtom((Atom)pred->FunctorOfPred)->StrOfAE;
send_tracer_message("RETRY CONSUMER: ", s, 0, mname, NULL);
} else {
s = RepAtom(NameOfFunctor((pred->FunctorOfPred)))->StrOfAE;
s = (char *)RepAtom(NameOfFunctor((pred->FunctorOfPred)))->StrOfAE;
send_tracer_message("RETRY CONSUMER: ", s, pred->ArityOfPE, mname, NULL);
}
break;
@ -378,27 +378,27 @@ low_level_trace(yap_low_level_port port, PredEntry *pred, CELL *args)
if (pred == UndefCode) {
send_tracer_message("RETRY LOADER ", NULL, 0, NULL, NULL);
} else {
mname = RepAtom(AtomOfTerm(Yap_Module_Name(pred)))->StrOfAE;
mname = (char *)RepAtom(AtomOfTerm(Yap_Module_Name(pred)))->StrOfAE;
arity = pred->ArityOfPE;
if (arity == 0)
s = RepAtom((Atom)pred->FunctorOfPred)->StrOfAE;
s = (char *)RepAtom((Atom)pred->FunctorOfPred)->StrOfAE;
else
s = RepAtom(NameOfFunctor((pred->FunctorOfPred)))->StrOfAE;
s = (char *)RepAtom(NameOfFunctor((pred->FunctorOfPred)))->StrOfAE;
send_tracer_message("RETRY LOADER: ", s, 0, mname, NULL);
}
break;
case retry_pred:
send_tracer_message("FAIL ", NULL, 0, NULL, args);
if (pred != NULL) {
mname = RepAtom(AtomOfTerm(Yap_Module_Name(pred)))->StrOfAE;
mname = (char *)RepAtom(AtomOfTerm(Yap_Module_Name(pred)))->StrOfAE;
arity = pred->ArityOfPE;
if (pred->ModuleOfPred == IDB_MODULE) {
s = "recorded";
arity = 3;
} else if (arity == 0) {
s = RepAtom((Atom)pred->FunctorOfPred)->StrOfAE;
s = (char *)RepAtom((Atom)pred->FunctorOfPred)->StrOfAE;
} else {
s = RepAtom(NameOfFunctor((pred->FunctorOfPred)))->StrOfAE;
s = (char *)RepAtom(NameOfFunctor((pred->FunctorOfPred)))->StrOfAE;
}
send_tracer_message("RETRY: ", s, arity, mname, args);
}

272
C/utf8.c
View File

@ -1,272 +0,0 @@
/* $Id$
Part of SWI-Prolog
Author: Jan Wielemaker and Anjo Anjewierden
E-mail: jan@swi.psy.uva.nl
WWW: http://www.swi-prolog.org
Copyright (C): 1985-2002, University of Amsterdam
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <string.h> /* get size_t */
#include "pl-utf8.h"
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
UTF-8 Decoding, based on http://www.cl.cam.ac.uk/~mgk25/unicode.html
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#define CONT(i) ISUTF8_CB(in[i])
#define VAL(i, s) ((in[i]&0x3f) << s)
char *
_PL__utf8_get_char(const char *in, int *chr)
{ /* 2-byte, 0x80-0x7ff */
if ( (in[0]&0xe0) == 0xc0 && CONT(1) )
{ *chr = ((in[0]&0x1f) << 6)|VAL(1,0);
return (char *)in+2;
}
/* 3-byte, 0x800-0xffff */
if ( (in[0]&0xf0) == 0xe0 && CONT(1) && CONT(2) )
{ *chr = ((in[0]&0xf) << 12)|VAL(1,6)|VAL(2,0);
return (char *)in+3;
}
/* 4-byte, 0x10000-0x1FFFFF */
if ( (in[0]&0xf8) == 0xf0 && CONT(1) && CONT(2) && CONT(3) )
{ *chr = ((in[0]&0x7) << 18)|VAL(1,12)|VAL(2,6)|VAL(3,0);
return (char *)in+4;
}
/* 5-byte, 0x200000-0x3FFFFFF */
if ( (in[0]&0xfc) == 0xf8 && CONT(1) && CONT(2) && CONT(3) && CONT(4) )
{ *chr = ((in[0]&0x3) << 24)|VAL(1,18)|VAL(2,12)|VAL(3,6)|VAL(4,0);
return (char *)in+5;
}
/* 6-byte, 0x400000-0x7FFFFFF */
if ( (in[0]&0xfe) == 0xfc && CONT(1) && CONT(2) && CONT(3) && CONT(4) && CONT(5) )
{ *chr = ((in[0]&0x1) << 30)|VAL(1,24)|VAL(2,18)|VAL(3,12)|VAL(4,6)|VAL(5,0);
return (char *)in+4;
}
*chr = *in;
return (char *)in+1;
}
unicode_type_t
_PL__utf8_type(const char *in0, size_t len)
{ /* 2-byte, 0x80-0x7ff */
int chr;
char *in = (char *) in0;
int type = S_ASCII;
while (in[0] != '\0' && in-in0 < len) {
if ( (in[0]&0xe0) == 0xc0 && CONT(1) )
{ chr = ((in[0]&0x1f) << 6)|VAL(1,0);
if (chr > 255) return S_WIDE;
if (chr > 127) type = S_LATIN;
in += 2;
break;
}
/* 3-byte, 0x800-0xffff */
if ( (in[0]&0xf0) == 0xe0 && CONT(1) && CONT(2) )
{ chr = ((in[0]&0xf) << 12)|VAL(1,6)|VAL(2,0);
if (chr > 255) return S_WIDE;
if (chr > 127) type = S_LATIN;
in += 3;
}
/* 4-byte, 0x10000-0x1FFFFF */
if ( (in[0]&0xf8) == 0xf0 && CONT(1) && CONT(2) && CONT(3) )
{ chr = ((in[0]&0x7) << 18)|VAL(1,12)|VAL(2,6)|VAL(3,0);
if (chr > 255) return S_WIDE;
if (chr > 127) type = S_LATIN;
in += 4;
}
/* 5-byte, 0x200000-0x3FFFFFF */
if ( (in[0]&0xfc) == 0xf8 && CONT(1) && CONT(2) && CONT(3) && CONT(4) )
{ chr = ((in[0]&0x3) << 24)|VAL(1,18)|VAL(2,12)|VAL(3,6)|VAL(4,0);
if (chr > 255) return S_WIDE;
if (chr > 127) type = S_LATIN;
in += 5;
}
/* 6-byte, 0x400000-0x7FFFFFF */
if ( (in[0]&0xfe) == 0xfc && CONT(1) && CONT(2) && CONT(3) && CONT(4) && CONT(5) )
{ chr = ((in[0]&0x1) << 30)|VAL(1,24)|VAL(2,18)|VAL(3,12)|VAL(4,6)|VAL(5,0);
if (chr > 255) return S_WIDE;
if (chr > 127) type = S_LATIN;
in += 6;
}
in ++;
}
return type;
}
char *
_PL__utf8_put_char(char *out, int chr)
{ if ( chr < 0x80 )
{ *out++ = chr;
} else if ( chr < 0x800 )
{ *out++ = 0xc0|((chr>>6)&0x1f);
*out++ = 0x80|(chr&0x3f);
} else if ( chr < 0x10000 )
{ *out++ = 0xe0|((chr>>12)&0x0f);
*out++ = 0x80|((chr>>6)&0x3f);
*out++ = 0x80|(chr&0x3f);
} else if ( chr < 0x200000 )
{ *out++ = 0xf0|((chr>>18)&0x07);
*out++ = 0x80|((chr>>12)&0x3f);
*out++ = 0x80|((chr>>6)&0x3f);
*out++ = 0x80|(chr&0x3f);
} else if ( chr < 0x4000000 )
{ *out++ = 0xf8|((chr>>24)&0x03);
*out++ = 0x80|((chr>>18)&0x3f);
*out++ = 0x80|((chr>>12)&0x3f);
*out++ = 0x80|((chr>>6)&0x3f);
*out++ = 0x80|(chr&0x3f);
} else if ( (unsigned)chr < 0x80000000 )
{ *out++ = 0xfc|((chr>>30)&0x01);
*out++ = 0x80|((chr>>24)&0x3f);
*out++ = 0x80|((chr>>18)&0x3f);
*out++ = 0x80|((chr>>12)&0x3f);
*out++ = 0x80|((chr>>6)&0x3f);
*out++ = 0x80|(chr&0x3f);
}
return out;
}
char *
_PL__utf8_skip_char(const char *in)
{ /* 2-byte, 0x80-0x7ff */
if ( (in[0]&0xe0) == 0xc0 && CONT(1) )
{
return (char *)in+2;
}
/* 3-byte, 0x800-0xffff */
if ( (in[0]&0xf0) == 0xe0 && CONT(1) && CONT(2) )
{
return (char *)in+3;
}
/* 4-byte, 0x10000-0x1FFFFF */
if ( (in[0]&0xf8) == 0xf0 && CONT(1) && CONT(2) && CONT(3) )
{
return (char *)in+4;
}
/* 5-byte, 0x200000-0x3FFFFFF */
if ( (in[0]&0xfc) == 0xf8 && CONT(1) && CONT(2) && CONT(3) && CONT(4) )
{
return (char *)in+5;
}
/* 6-byte, 0x400000-0x7FFFFFF */
if ( (in[0]&0xfe) == 0xfc && CONT(1) && CONT(2) && CONT(3) && CONT(4) && CONT(5) )
{
return (char *)in+4;
}
return (char *)in+1;
}
size_t
utf8_strlen(const char *s, size_t len)
{ const char *e = &s[len];
unsigned int l = 0;
while(s<e)
{ int chr;
s = utf8_get_char(s, &chr);
l++;
}
return l;
}
size_t
utf8_strlen1(const char *s)
{
unsigned int l = 0;
while( s [0] )
{
s = utf8_skip_char(s);
l++;
}
return l;
}
const char *
utf8_skip(const char *s, int n)
{
while(n--)
{
if (!s[0]) return NULL;
s = utf8_skip_char(s);
}
return s;
}
int
utf8_strncmp(const char *s1, const char *s2, size_t n)
{
while(n-- >0)
{ int chr1, chr2;
s1 = utf8_get_char(s1, &chr1);
s2 = utf8_get_char(s2, &chr2);
if (chr1-chr2) return chr1-chr2;
if (!chr1) return 0;
}
return 0;
}
int
utf8_strprefix(const char *s1, const char *s2)
{
while(1)
{ int chr1, chr2;
s1 = utf8_get_char(s1, &chr1);
s2 = utf8_get_char(s2, &chr2);
if (!chr2) return 1;
if (chr1-chr2) return 0;
}
return 0;
}
char *
utf8_wcscpy(char *sf, const wchar_t *s0)
{
char *sf0 = sf;
while(1)
{ int chr1;
chr1 = * s0++;
if (chr1 == '\0') {
*sf++ = '\0';
return sf0;
}
sf = utf8_put_char(sf, chr1);
}
return NULL;
}

View File

@ -23,13 +23,13 @@ static char SccsId[] = "%W% %G%";
#include "Yap.h"
#include "Yatom.h"
#include "YapHeap.h"
#include "YapText.h"
#include "yapio.h"
#include "clause.h"
#if COROUTINING
#include "attvar.h"
#endif
#include "iopreds.h"
#include "pl-utf8.h"
#if HAVE_STRING_H
#include <string.h>
@ -374,7 +374,7 @@ static void wrputf(Float f, struct write_globs *wglb) /* writes a float */
wrputc(' ', stream);
}
/* use SWI's format_float */
sprintf(buf, floatFormat(),f);
sprintf(buf, (char *)floatFormat(),f);
wrputs(buf, stream);
#endif
@ -551,12 +551,12 @@ static void write_quoted(wchar_t ch, wchar_t quote, wrf stream) {
}
}
static void write_string(const char *s,
static void write_string(const unsigned char *s,
struct write_globs *wglb) /* writes an integer */
{
StreamDesc *stream = wglb->stream;
int chr, qt;
char *ptr = (char *)s;
utf8proc_int32_t chr, qt;
unsigned char *ptr = (unsigned char *) s;
if (wglb->Write_strings)
qt = '`';
@ -564,7 +564,7 @@ static void write_string(const char *s,
qt = '"';
wrputc(qt, stream);
do {
ptr = utf8_get_char(ptr, &chr);
ptr += get_utf8(ptr, &chr);
if (chr == '\0')
break;
write_quoted(chr, qt, stream);
@ -937,7 +937,7 @@ static void writeTerm(Term t, int p, int depth, int rinfixarg,
wrputf(FloatOfTerm(t), wglb);
return;
case (CELL) FunctorString:
write_string(StringOfTerm(t), wglb);
write_string(UStringOfTerm(t), wglb);
return;
case (CELL) FunctorAttVar:
write_var(RepAppl(t) + 1, wglb, &nrwt);
@ -1093,10 +1093,10 @@ static void writeTerm(Term t, int p, int depth, int rinfixarg,
wrclose_bracket(wglb, TRUE);
}
/* avoid quoting commas and bars */
if (!strcmp(RepAtom(atom)->StrOfAE, ",")) {
if (!strcmp((char *)RepAtom(atom)->StrOfAE, ",")) {
wrputc(',', wglb->stream);
lastw = separator;
} else if (!strcmp(RepAtom(atom)->StrOfAE, "|")) {
} else if (!strcmp((char *)RepAtom(atom)->StrOfAE, "|")) {
wrputc('|', wglb->stream);
lastw = separator;
} else
@ -1247,3 +1247,28 @@ void Yap_plwrite(Term t, StreamDesc *mywrite, int max_depth, int flags, int prio
restore_from_write(&rwt, &wglb);
Yap_CloseSlots( sls );
}
char *
Yap_TermToString(Term t, char *s, size_t sz, size_t *length, encoding_t encp, int flags)
{
CACHE_REGS
int sno = Yap_open_buf_write_stream(s, sz, encp, flags);
int old_output_stream = LOCAL_c_output_stream;
if (sno < 0)
return NULL;
LOCK(GLOBAL_Stream[sno].streamlock);
LOCAL_c_output_stream = sno;
if (encp)
GLOBAL_Stream[sno].encoding = encp;
Yap_plwrite (t, GLOBAL_Stream+sno, 0, flags, 1200);
s[GLOBAL_Stream[sno].u.mem_string.pos] = '\0';
GLOBAL_Stream[sno].status = Free_Stream_f;
UNLOCK(GLOBAL_Stream[sno].streamlock);
LOCAL_c_output_stream = old_output_stream;
if ( EX == 0 ) return s;
return NULL;
}

View File

@ -0,0 +1,63 @@
set(CMAKE_C_COMPILER "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc")
set(CMAKE_C_COMPILER_ARG1 "")
set(CMAKE_C_COMPILER_ID "AppleClang")
set(CMAKE_C_COMPILER_VERSION "6.1.0.6020053")
set(CMAKE_C_COMPILE_FEATURES "c_function_prototypes;c_restrict;c_variadic_macros;c_static_assert")
set(CMAKE_C90_COMPILE_FEATURES "c_function_prototypes")
set(CMAKE_C99_COMPILE_FEATURES "c_restrict;c_variadic_macros")
set(CMAKE_C11_COMPILE_FEATURES "c_static_assert")
set(CMAKE_C_PLATFORM_ID "Darwin")
set(CMAKE_C_SIMULATE_ID "")
set(CMAKE_C_SIMULATE_VERSION "")
set(CMAKE_AR "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar")
set(CMAKE_RANLIB "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib")
set(CMAKE_LINKER "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld")
set(CMAKE_COMPILER_IS_GNUCC )
set(CMAKE_C_COMPILER_LOADED 1)
set(CMAKE_C_COMPILER_WORKS TRUE)
set(CMAKE_C_ABI_COMPILED TRUE)
set(CMAKE_COMPILER_IS_MINGW )
set(CMAKE_COMPILER_IS_CYGWIN )
if(CMAKE_COMPILER_IS_CYGWIN)
set(CYGWIN 1)
set(UNIX 1)
endif()
set(CMAKE_C_COMPILER_ENV_VAR "CC")
if(CMAKE_COMPILER_IS_MINGW)
set(MINGW 1)
endif()
set(CMAKE_C_COMPILER_ID_RUN 1)
set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
set(CMAKE_C_LINKER_PREFERENCE 10)
# Save compiler ABI information.
set(CMAKE_C_SIZEOF_DATA_PTR "8")
set(CMAKE_C_COMPILER_ABI "")
set(CMAKE_C_LIBRARY_ARCHITECTURE "")
if(CMAKE_C_SIZEOF_DATA_PTR)
set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
endif()
if(CMAKE_C_COMPILER_ABI)
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
endif()
if(CMAKE_C_LIBRARY_ARCHITECTURE)
set(CMAKE_LIBRARY_ARCHITECTURE "")
endif()
set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/6.1.0/lib/darwin/libclang_rt.osx.a")
set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib;/usr/local/lib")
set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "/Library/Frameworks;/System/Library/Frameworks")

View File

@ -0,0 +1,64 @@
set(CMAKE_CXX_COMPILER "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++")
set(CMAKE_CXX_COMPILER_ARG1 "")
set(CMAKE_CXX_COMPILER_ID "AppleClang")
set(CMAKE_CXX_COMPILER_VERSION "6.1.0.6020053")
set(CMAKE_CXX_COMPILE_FEATURES "cxx_template_template_parameters;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates")
set(CMAKE_CXX98_COMPILE_FEATURES "cxx_template_template_parameters")
set(CMAKE_CXX11_COMPILE_FEATURES "cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates")
set(CMAKE_CXX14_COMPILE_FEATURES "cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates")
set(CMAKE_CXX_PLATFORM_ID "Darwin")
set(CMAKE_CXX_SIMULATE_ID "")
set(CMAKE_CXX_SIMULATE_VERSION "")
set(CMAKE_AR "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar")
set(CMAKE_RANLIB "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib")
set(CMAKE_LINKER "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld")
set(CMAKE_COMPILER_IS_GNUCXX )
set(CMAKE_CXX_COMPILER_LOADED 1)
set(CMAKE_CXX_COMPILER_WORKS TRUE)
set(CMAKE_CXX_ABI_COMPILED TRUE)
set(CMAKE_COMPILER_IS_MINGW )
set(CMAKE_COMPILER_IS_CYGWIN )
if(CMAKE_COMPILER_IS_CYGWIN)
set(CYGWIN 1)
set(UNIX 1)
endif()
set(CMAKE_CXX_COMPILER_ENV_VAR "CXX")
if(CMAKE_COMPILER_IS_MINGW)
set(MINGW 1)
endif()
set(CMAKE_CXX_COMPILER_ID_RUN 1)
set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;mm;CPP)
set(CMAKE_CXX_LINKER_PREFERENCE 30)
set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)
# Save compiler ABI information.
set(CMAKE_CXX_SIZEOF_DATA_PTR "8")
set(CMAKE_CXX_COMPILER_ABI "")
set(CMAKE_CXX_LIBRARY_ARCHITECTURE "")
if(CMAKE_CXX_SIZEOF_DATA_PTR)
set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}")
endif()
if(CMAKE_CXX_COMPILER_ABI)
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}")
endif()
if(CMAKE_CXX_LIBRARY_ARCHITECTURE)
set(CMAKE_LIBRARY_ARCHITECTURE "")
endif()
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "c++;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/6.1.0/lib/darwin/libclang_rt.osx.a")
set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib;/usr/local/lib")
set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "/Library/Frameworks;/System/Library/Frameworks")

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,15 @@
set(CMAKE_HOST_SYSTEM "Darwin-14.5.0")
set(CMAKE_HOST_SYSTEM_NAME "Darwin")
set(CMAKE_HOST_SYSTEM_VERSION "14.5.0")
set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
set(CMAKE_SYSTEM "Darwin-14.5.0")
set(CMAKE_SYSTEM_NAME "Darwin")
set(CMAKE_SYSTEM_VERSION "14.5.0")
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
set(CMAKE_CROSSCOMPILING "FALSE")
set(CMAKE_SYSTEM_LOADED 1)

View File

@ -0,0 +1,508 @@
#ifdef __cplusplus
# error "A C++ compiler has been selected for C."
#endif
#if defined(__18CXX)
# define ID_VOID_MAIN
#endif
/* Version number components: V=Version, R=Revision, P=Patch
Version date components: YYYY=Year, MM=Month, DD=Day */
#if defined(__INTEL_COMPILER) || defined(__ICC)
# define COMPILER_ID "Intel"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
/* __INTEL_COMPILER = VRP */
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
# if defined(__INTEL_COMPILER_UPDATE)
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
# else
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
# endif
# if defined(__INTEL_COMPILER_BUILD_DATE)
/* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
# endif
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
#elif defined(__PATHCC__)
# define COMPILER_ID "PathScale"
# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
# if defined(__PATHCC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
# endif
#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
# define COMPILER_ID "Embarcadero"
# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
# define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF)
#elif defined(__BORLANDC__)
# define COMPILER_ID "Borland"
/* __BORLANDC__ = 0xVRR */
# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
#elif defined(__WATCOMC__) && __WATCOMC__ < 1200
# define COMPILER_ID "Watcom"
/* __WATCOMC__ = VVRR */
# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
# if (__WATCOMC__ % 10) > 0
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
# endif
#elif defined(__WATCOMC__)
# define COMPILER_ID "OpenWatcom"
/* __WATCOMC__ = VVRP + 1100 */
# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
# if (__WATCOMC__ % 10) > 0
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
# endif
#elif defined(__SUNPRO_C)
# define COMPILER_ID "SunPro"
# if __SUNPRO_C >= 0x5100
/* __SUNPRO_C = 0xVRRP */
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12)
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF)
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
# else
/* __SUNPRO_CC = 0xVRP */
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8)
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF)
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
# endif
#elif defined(__HP_cc)
# define COMPILER_ID "HP"
/* __HP_cc = VVRRPP */
# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000)
# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100)
# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100)
#elif defined(__DECC)
# define COMPILER_ID "Compaq"
/* __DECC_VER = VVRRTPPPP */
# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000)
# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100)
# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000)
#elif defined(__IBMC__) && defined(__COMPILER_VER__)
# define COMPILER_ID "zOS"
/* __IBMC__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800
# define COMPILER_ID "XL"
/* __IBMC__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800
# define COMPILER_ID "VisualAge"
/* __IBMC__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
#elif defined(__PGI)
# define COMPILER_ID "PGI"
# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
# if defined(__PGIC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
# endif
#elif defined(_CRAYC)
# define COMPILER_ID "Cray"
# define COMPILER_VERSION_MAJOR DEC(_RELEASE)
# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
#elif defined(__TI_COMPILER_VERSION__)
# define COMPILER_ID "TI"
/* __TI_COMPILER_VERSION__ = VVVRRRPPP */
# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
#elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version)
# define COMPILER_ID "Fujitsu"
#elif defined(__TINYC__)
# define COMPILER_ID "TinyCC"
#elif defined(__SCO_VERSION__)
# define COMPILER_ID "SCO"
#elif defined(__clang__) && defined(__apple_build_version__)
# define COMPILER_ID "AppleClang"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
#elif defined(__clang__)
# define COMPILER_ID "Clang"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
#elif defined(__GNUC__)
# define COMPILER_ID "GNU"
# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
# if defined(__GNUC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
# endif
#elif defined(_MSC_VER)
# define COMPILER_ID "MSVC"
/* _MSC_VER = VVRR */
# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
# if defined(_MSC_FULL_VER)
# if _MSC_VER >= 1400
/* _MSC_FULL_VER = VVRRPPPPP */
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
# else
/* _MSC_FULL_VER = VVRRPPPP */
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
# endif
# endif
# if defined(_MSC_BUILD)
# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
# endif
#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
# define COMPILER_ID "ADSP"
#if defined(__VISUALDSPVERSION__)
/* __VISUALDSPVERSION__ = 0xVVRRPP00 */
# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
#endif
#elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC)
# define COMPILER_ID "IAR"
#elif defined(SDCC)
# define COMPILER_ID "SDCC"
/* SDCC = VRP */
# define COMPILER_VERSION_MAJOR DEC(SDCC/100)
# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10)
# define COMPILER_VERSION_PATCH DEC(SDCC % 10)
#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
# define COMPILER_ID "MIPSpro"
# if defined(_SGI_COMPILER_VERSION)
/* _SGI_COMPILER_VERSION = VRP */
# define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100)
# define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10)
# define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10)
# else
/* _COMPILER_VERSION = VRP */
# define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100)
# define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10)
# define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10)
# endif
/* These compilers are either not known or too old to define an
identification macro. Try to identify the platform and guess that
it is the native compiler. */
#elif defined(__sgi)
# define COMPILER_ID "MIPSpro"
#elif defined(__hpux) || defined(__hpua)
# define COMPILER_ID "HP"
#else /* unknown compiler */
# define COMPILER_ID ""
#endif
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
#ifdef SIMULATE_ID
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
#endif
#ifdef __QNXNTO__
char const* qnxnto = "INFO" ":" "qnxnto[]";
#endif
#define STRINGIFY_HELPER(X) #X
#define STRINGIFY(X) STRINGIFY_HELPER(X)
/* Identify known platforms by name. */
#if defined(__linux) || defined(__linux__) || defined(linux)
# define PLATFORM_ID "Linux"
#elif defined(__CYGWIN__)
# define PLATFORM_ID "Cygwin"
#elif defined(__MINGW32__)
# define PLATFORM_ID "MinGW"
#elif defined(__APPLE__)
# define PLATFORM_ID "Darwin"
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
# define PLATFORM_ID "Windows"
#elif defined(__FreeBSD__) || defined(__FreeBSD)
# define PLATFORM_ID "FreeBSD"
#elif defined(__NetBSD__) || defined(__NetBSD)
# define PLATFORM_ID "NetBSD"
#elif defined(__OpenBSD__) || defined(__OPENBSD)
# define PLATFORM_ID "OpenBSD"
#elif defined(__sun) || defined(sun)
# define PLATFORM_ID "SunOS"
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
# define PLATFORM_ID "AIX"
#elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
# define PLATFORM_ID "IRIX"
#elif defined(__hpux) || defined(__hpux__)
# define PLATFORM_ID "HP-UX"
#elif defined(__HAIKU__)
# define PLATFORM_ID "Haiku"
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
# define PLATFORM_ID "BeOS"
#elif defined(__QNX__) || defined(__QNXNTO__)
# define PLATFORM_ID "QNX"
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
# define PLATFORM_ID "Tru64"
#elif defined(__riscos) || defined(__riscos__)
# define PLATFORM_ID "RISCos"
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
# define PLATFORM_ID "SINIX"
#elif defined(__UNIX_SV__)
# define PLATFORM_ID "UNIX_SV"
#elif defined(__bsdos__)
# define PLATFORM_ID "BSDOS"
#elif defined(_MPRAS) || defined(MPRAS)
# define PLATFORM_ID "MP-RAS"
#elif defined(__osf) || defined(__osf__)
# define PLATFORM_ID "OSF1"
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
# define PLATFORM_ID "SCO_SV"
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
# define PLATFORM_ID "ULTRIX"
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
# define PLATFORM_ID "Xenix"
#elif defined(__WATCOMC__)
# if defined(__LINUX__)
# define PLATFORM_ID "Linux"
# elif defined(__DOS__)
# define PLATFORM_ID "DOS"
# elif defined(__OS2__)
# define PLATFORM_ID "OS2"
# elif defined(__WINDOWS__)
# define PLATFORM_ID "Windows3x"
# else /* unknown platform */
# define PLATFORM_ID ""
# endif
#else /* unknown platform */
# define PLATFORM_ID ""
#endif
/* For windows compilers MSVC and Intel we can determine
the architecture of the compiler being used. This is because
the compilers do not have flags that can change the architecture,
but rather depend on which compiler is being used
*/
#if defined(_WIN32) && defined(_MSC_VER)
# if defined(_M_IA64)
# define ARCHITECTURE_ID "IA64"
# elif defined(_M_X64) || defined(_M_AMD64)
# define ARCHITECTURE_ID "x64"
# elif defined(_M_IX86)
# define ARCHITECTURE_ID "X86"
# elif defined(_M_ARM)
# if _M_ARM == 4
# define ARCHITECTURE_ID "ARMV4I"
# elif _M_ARM == 5
# define ARCHITECTURE_ID "ARMV5I"
# else
# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
# endif
# elif defined(_M_MIPS)
# define ARCHITECTURE_ID "MIPS"
# elif defined(_M_SH)
# define ARCHITECTURE_ID "SHx"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__WATCOMC__)
# if defined(_M_I86)
# define ARCHITECTURE_ID "I86"
# elif defined(_M_IX86)
# define ARCHITECTURE_ID "X86"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#else
# define ARCHITECTURE_ID ""
#endif
/* Convert integer to decimal digit literals. */
#define DEC(n) \
('0' + (((n) / 10000000)%10)), \
('0' + (((n) / 1000000)%10)), \
('0' + (((n) / 100000)%10)), \
('0' + (((n) / 10000)%10)), \
('0' + (((n) / 1000)%10)), \
('0' + (((n) / 100)%10)), \
('0' + (((n) / 10)%10)), \
('0' + ((n) % 10))
/* Convert integer to hex digit literals. */
#define HEX(n) \
('0' + ((n)>>28 & 0xF)), \
('0' + ((n)>>24 & 0xF)), \
('0' + ((n)>>20 & 0xF)), \
('0' + ((n)>>16 & 0xF)), \
('0' + ((n)>>12 & 0xF)), \
('0' + ((n)>>8 & 0xF)), \
('0' + ((n)>>4 & 0xF)), \
('0' + ((n) & 0xF))
/* Construct a string literal encoding the version number components. */
#ifdef COMPILER_VERSION_MAJOR
char const info_version[] = {
'I', 'N', 'F', 'O', ':',
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
COMPILER_VERSION_MAJOR,
# ifdef COMPILER_VERSION_MINOR
'.', COMPILER_VERSION_MINOR,
# ifdef COMPILER_VERSION_PATCH
'.', COMPILER_VERSION_PATCH,
# ifdef COMPILER_VERSION_TWEAK
'.', COMPILER_VERSION_TWEAK,
# endif
# endif
# endif
']','\0'};
#endif
/* Construct a string literal encoding the version number components. */
#ifdef SIMULATE_VERSION_MAJOR
char const info_simulate_version[] = {
'I', 'N', 'F', 'O', ':',
's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
SIMULATE_VERSION_MAJOR,
# ifdef SIMULATE_VERSION_MINOR
'.', SIMULATE_VERSION_MINOR,
# ifdef SIMULATE_VERSION_PATCH
'.', SIMULATE_VERSION_PATCH,
# ifdef SIMULATE_VERSION_TWEAK
'.', SIMULATE_VERSION_TWEAK,
# endif
# endif
# endif
']','\0'};
#endif
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
/*--------------------------------------------------------------------------*/
#ifdef ID_VOID_MAIN
void main() {}
#else
int main(int argc, char* argv[])
{
int require = 0;
require += info_compiler[argc];
require += info_platform[argc];
require += info_arch[argc];
#ifdef COMPILER_VERSION_MAJOR
require += info_version[argc];
#endif
#ifdef SIMULATE_ID
require += info_simulate[argc];
#endif
#ifdef SIMULATE_VERSION_MAJOR
require += info_simulate_version[argc];
#endif
(void)argv;
return require;
}
#endif

Binary file not shown.

View File

@ -0,0 +1,498 @@
/* This source file must have a .cpp extension so that all C++ compilers
recognize the extension without flags. Borland does not know .cxx for
example. */
#ifndef __cplusplus
# error "A C compiler has been selected for C++."
#endif
/* Version number components: V=Version, R=Revision, P=Patch
Version date components: YYYY=Year, MM=Month, DD=Day */
#if defined(__COMO__)
# define COMPILER_ID "Comeau"
/* __COMO_VERSION__ = VRR */
# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100)
# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100)
#elif defined(__INTEL_COMPILER) || defined(__ICC)
# define COMPILER_ID "Intel"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
/* __INTEL_COMPILER = VRP */
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
# if defined(__INTEL_COMPILER_UPDATE)
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
# else
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
# endif
# if defined(__INTEL_COMPILER_BUILD_DATE)
/* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
# endif
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
#elif defined(__PATHCC__)
# define COMPILER_ID "PathScale"
# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
# if defined(__PATHCC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
# endif
#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
# define COMPILER_ID "Embarcadero"
# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
# define COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__ & 0xFFFF)
#elif defined(__BORLANDC__)
# define COMPILER_ID "Borland"
/* __BORLANDC__ = 0xVRR */
# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
#elif defined(__WATCOMC__) && __WATCOMC__ < 1200
# define COMPILER_ID "Watcom"
/* __WATCOMC__ = VVRR */
# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
# if (__WATCOMC__ % 10) > 0
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
# endif
#elif defined(__WATCOMC__)
# define COMPILER_ID "OpenWatcom"
/* __WATCOMC__ = VVRP + 1100 */
# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
# if (__WATCOMC__ % 10) > 0
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
# endif
#elif defined(__SUNPRO_CC)
# define COMPILER_ID "SunPro"
# if __SUNPRO_CC >= 0x5100
/* __SUNPRO_CC = 0xVRRP */
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12)
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF)
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
# else
/* __SUNPRO_CC = 0xVRP */
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8)
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF)
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF)
# endif
#elif defined(__HP_aCC)
# define COMPILER_ID "HP"
/* __HP_aCC = VVRRPP */
# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000)
# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100)
# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100)
#elif defined(__DECCXX)
# define COMPILER_ID "Compaq"
/* __DECCXX_VER = VVRRTPPPP */
# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000)
# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100)
# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000)
#elif defined(__IBMCPP__) && defined(__COMPILER_VER__)
# define COMPILER_ID "zOS"
/* __IBMCPP__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800
# define COMPILER_ID "XL"
/* __IBMCPP__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800
# define COMPILER_ID "VisualAge"
/* __IBMCPP__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10)
#elif defined(__PGI)
# define COMPILER_ID "PGI"
# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
# if defined(__PGIC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
# endif
#elif defined(_CRAYC)
# define COMPILER_ID "Cray"
# define COMPILER_VERSION_MAJOR DEC(_RELEASE)
# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
#elif defined(__TI_COMPILER_VERSION__)
# define COMPILER_ID "TI"
/* __TI_COMPILER_VERSION__ = VVVRRRPPP */
# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
#elif defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version)
# define COMPILER_ID "Fujitsu"
#elif defined(__SCO_VERSION__)
# define COMPILER_ID "SCO"
#elif defined(__clang__) && defined(__apple_build_version__)
# define COMPILER_ID "AppleClang"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
#elif defined(__clang__)
# define COMPILER_ID "Clang"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
#elif defined(__GNUC__)
# define COMPILER_ID "GNU"
# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
# if defined(__GNUC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
# endif
#elif defined(_MSC_VER)
# define COMPILER_ID "MSVC"
/* _MSC_VER = VVRR */
# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
# if defined(_MSC_FULL_VER)
# if _MSC_VER >= 1400
/* _MSC_FULL_VER = VVRRPPPPP */
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
# else
/* _MSC_FULL_VER = VVRRPPPP */
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
# endif
# endif
# if defined(_MSC_BUILD)
# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
# endif
#elif defined(__VISUALDSPVERSION__) || defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__)
# define COMPILER_ID "ADSP"
#if defined(__VISUALDSPVERSION__)
/* __VISUALDSPVERSION__ = 0xVVRRPP00 */
# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF)
#endif
#elif defined(__IAR_SYSTEMS_ICC__ ) || defined(__IAR_SYSTEMS_ICC)
# define COMPILER_ID "IAR"
#elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION)
# define COMPILER_ID "MIPSpro"
# if defined(_SGI_COMPILER_VERSION)
/* _SGI_COMPILER_VERSION = VRP */
# define COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100)
# define COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10)
# define COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION % 10)
# else
/* _COMPILER_VERSION = VRP */
# define COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100)
# define COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10)
# define COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION % 10)
# endif
/* These compilers are either not known or too old to define an
identification macro. Try to identify the platform and guess that
it is the native compiler. */
#elif defined(__sgi)
# define COMPILER_ID "MIPSpro"
#elif defined(__hpux) || defined(__hpua)
# define COMPILER_ID "HP"
#else /* unknown compiler */
# define COMPILER_ID ""
#endif
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
#ifdef SIMULATE_ID
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
#endif
#ifdef __QNXNTO__
char const* qnxnto = "INFO" ":" "qnxnto[]";
#endif
#define STRINGIFY_HELPER(X) #X
#define STRINGIFY(X) STRINGIFY_HELPER(X)
/* Identify known platforms by name. */
#if defined(__linux) || defined(__linux__) || defined(linux)
# define PLATFORM_ID "Linux"
#elif defined(__CYGWIN__)
# define PLATFORM_ID "Cygwin"
#elif defined(__MINGW32__)
# define PLATFORM_ID "MinGW"
#elif defined(__APPLE__)
# define PLATFORM_ID "Darwin"
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
# define PLATFORM_ID "Windows"
#elif defined(__FreeBSD__) || defined(__FreeBSD)
# define PLATFORM_ID "FreeBSD"
#elif defined(__NetBSD__) || defined(__NetBSD)
# define PLATFORM_ID "NetBSD"
#elif defined(__OpenBSD__) || defined(__OPENBSD)
# define PLATFORM_ID "OpenBSD"
#elif defined(__sun) || defined(sun)
# define PLATFORM_ID "SunOS"
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
# define PLATFORM_ID "AIX"
#elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
# define PLATFORM_ID "IRIX"
#elif defined(__hpux) || defined(__hpux__)
# define PLATFORM_ID "HP-UX"
#elif defined(__HAIKU__)
# define PLATFORM_ID "Haiku"
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
# define PLATFORM_ID "BeOS"
#elif defined(__QNX__) || defined(__QNXNTO__)
# define PLATFORM_ID "QNX"
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
# define PLATFORM_ID "Tru64"
#elif defined(__riscos) || defined(__riscos__)
# define PLATFORM_ID "RISCos"
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
# define PLATFORM_ID "SINIX"
#elif defined(__UNIX_SV__)
# define PLATFORM_ID "UNIX_SV"
#elif defined(__bsdos__)
# define PLATFORM_ID "BSDOS"
#elif defined(_MPRAS) || defined(MPRAS)
# define PLATFORM_ID "MP-RAS"
#elif defined(__osf) || defined(__osf__)
# define PLATFORM_ID "OSF1"
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
# define PLATFORM_ID "SCO_SV"
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
# define PLATFORM_ID "ULTRIX"
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
# define PLATFORM_ID "Xenix"
#elif defined(__WATCOMC__)
# if defined(__LINUX__)
# define PLATFORM_ID "Linux"
# elif defined(__DOS__)
# define PLATFORM_ID "DOS"
# elif defined(__OS2__)
# define PLATFORM_ID "OS2"
# elif defined(__WINDOWS__)
# define PLATFORM_ID "Windows3x"
# else /* unknown platform */
# define PLATFORM_ID ""
# endif
#else /* unknown platform */
# define PLATFORM_ID ""
#endif
/* For windows compilers MSVC and Intel we can determine
the architecture of the compiler being used. This is because
the compilers do not have flags that can change the architecture,
but rather depend on which compiler is being used
*/
#if defined(_WIN32) && defined(_MSC_VER)
# if defined(_M_IA64)
# define ARCHITECTURE_ID "IA64"
# elif defined(_M_X64) || defined(_M_AMD64)
# define ARCHITECTURE_ID "x64"
# elif defined(_M_IX86)
# define ARCHITECTURE_ID "X86"
# elif defined(_M_ARM)
# if _M_ARM == 4
# define ARCHITECTURE_ID "ARMV4I"
# elif _M_ARM == 5
# define ARCHITECTURE_ID "ARMV5I"
# else
# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
# endif
# elif defined(_M_MIPS)
# define ARCHITECTURE_ID "MIPS"
# elif defined(_M_SH)
# define ARCHITECTURE_ID "SHx"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__WATCOMC__)
# if defined(_M_I86)
# define ARCHITECTURE_ID "I86"
# elif defined(_M_IX86)
# define ARCHITECTURE_ID "X86"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#else
# define ARCHITECTURE_ID ""
#endif
/* Convert integer to decimal digit literals. */
#define DEC(n) \
('0' + (((n) / 10000000)%10)), \
('0' + (((n) / 1000000)%10)), \
('0' + (((n) / 100000)%10)), \
('0' + (((n) / 10000)%10)), \
('0' + (((n) / 1000)%10)), \
('0' + (((n) / 100)%10)), \
('0' + (((n) / 10)%10)), \
('0' + ((n) % 10))
/* Convert integer to hex digit literals. */
#define HEX(n) \
('0' + ((n)>>28 & 0xF)), \
('0' + ((n)>>24 & 0xF)), \
('0' + ((n)>>20 & 0xF)), \
('0' + ((n)>>16 & 0xF)), \
('0' + ((n)>>12 & 0xF)), \
('0' + ((n)>>8 & 0xF)), \
('0' + ((n)>>4 & 0xF)), \
('0' + ((n) & 0xF))
/* Construct a string literal encoding the version number components. */
#ifdef COMPILER_VERSION_MAJOR
char const info_version[] = {
'I', 'N', 'F', 'O', ':',
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
COMPILER_VERSION_MAJOR,
# ifdef COMPILER_VERSION_MINOR
'.', COMPILER_VERSION_MINOR,
# ifdef COMPILER_VERSION_PATCH
'.', COMPILER_VERSION_PATCH,
# ifdef COMPILER_VERSION_TWEAK
'.', COMPILER_VERSION_TWEAK,
# endif
# endif
# endif
']','\0'};
#endif
/* Construct a string literal encoding the version number components. */
#ifdef SIMULATE_VERSION_MAJOR
char const info_simulate_version[] = {
'I', 'N', 'F', 'O', ':',
's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
SIMULATE_VERSION_MAJOR,
# ifdef SIMULATE_VERSION_MINOR
'.', SIMULATE_VERSION_MINOR,
# ifdef SIMULATE_VERSION_PATCH
'.', SIMULATE_VERSION_PATCH,
# ifdef SIMULATE_VERSION_TWEAK
'.', SIMULATE_VERSION_TWEAK,
# endif
# endif
# endif
']','\0'};
#endif
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
/*--------------------------------------------------------------------------*/
int main(int argc, char* argv[])
{
int require = 0;
require += info_compiler[argc];
require += info_platform[argc];
#ifdef COMPILER_VERSION_MAJOR
require += info_version[argc];
#endif
#ifdef SIMULATE_ID
require += info_simulate[argc];
#endif
#ifdef SIMULATE_VERSION_MAJOR
require += info_simulate_version[argc];
#endif
(void)argv;
return require;
}

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,40 @@
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>
#undef KEY
#if defined(__i386)
# define KEY '_','_','i','3','8','6'
#elif defined(__x86_64)
# define KEY '_','_','x','8','6','_','6','4'
#elif defined(__ppc__)
# define KEY '_','_','p','p','c','_','_'
#elif defined(__ppc64__)
# define KEY '_','_','p','p','c','6','4','_','_'
#endif
#define SIZE (sizeof(uintptr_t))
char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
('0' + ((SIZE / 10000)%10)),
('0' + ((SIZE / 1000)%10)),
('0' + ((SIZE / 100)%10)),
('0' + ((SIZE / 10)%10)),
('0' + (SIZE % 10)),
']',
#ifdef KEY
' ','k','e','y','[', KEY, ']',
#endif
'\0'};
#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
#else
int main(int argc, char *argv[])
#endif
{
int require = 0;
require += info_size[argc];
(void)argv;
return require;
}

Binary file not shown.

View File

@ -0,0 +1,40 @@
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>
#undef KEY
#if defined(__i386)
# define KEY '_','_','i','3','8','6'
#elif defined(__x86_64)
# define KEY '_','_','x','8','6','_','6','4'
#elif defined(__ppc__)
# define KEY '_','_','p','p','c','_','_'
#elif defined(__ppc64__)
# define KEY '_','_','p','p','c','6','4','_','_'
#endif
#define SIZE (sizeof(double))
char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
('0' + ((SIZE / 10000)%10)),
('0' + ((SIZE / 1000)%10)),
('0' + ((SIZE / 100)%10)),
('0' + ((SIZE / 10)%10)),
('0' + (SIZE % 10)),
']',
#ifdef KEY
' ','k','e','y','[', KEY, ']',
#endif
'\0'};
#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
#else
int main(int argc, char *argv[])
#endif
{
int require = 0;
require += info_size[argc];
(void)argv;
return require;
}

Binary file not shown.

View File

@ -0,0 +1,40 @@
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>
#undef KEY
#if defined(__i386)
# define KEY '_','_','i','3','8','6'
#elif defined(__x86_64)
# define KEY '_','_','x','8','6','_','6','4'
#elif defined(__ppc__)
# define KEY '_','_','p','p','c','_','_'
#elif defined(__ppc64__)
# define KEY '_','_','p','p','c','6','4','_','_'
#endif
#define SIZE (sizeof(float))
char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
('0' + ((SIZE / 10000)%10)),
('0' + ((SIZE / 1000)%10)),
('0' + ((SIZE / 100)%10)),
('0' + ((SIZE / 10)%10)),
('0' + (SIZE % 10)),
']',
#ifdef KEY
' ','k','e','y','[', KEY, ']',
#endif
'\0'};
#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
#else
int main(int argc, char *argv[])
#endif
{
int require = 0;
require += info_size[argc];
(void)argv;
return require;
}

Binary file not shown.

View File

@ -0,0 +1,40 @@
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>
#undef KEY
#if defined(__i386)
# define KEY '_','_','i','3','8','6'
#elif defined(__x86_64)
# define KEY '_','_','x','8','6','_','6','4'
#elif defined(__ppc__)
# define KEY '_','_','p','p','c','_','_'
#elif defined(__ppc64__)
# define KEY '_','_','p','p','c','6','4','_','_'
#endif
#define SIZE (sizeof(int))
char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
('0' + ((SIZE / 10000)%10)),
('0' + ((SIZE / 1000)%10)),
('0' + ((SIZE / 100)%10)),
('0' + ((SIZE / 10)%10)),
('0' + (SIZE % 10)),
']',
#ifdef KEY
' ','k','e','y','[', KEY, ']',
#endif
'\0'};
#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
#else
int main(int argc, char *argv[])
#endif
{
int require = 0;
require += info_size[argc];
(void)argv;
return require;
}

Binary file not shown.

View File

@ -0,0 +1,40 @@
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>
#undef KEY
#if defined(__i386)
# define KEY '_','_','i','3','8','6'
#elif defined(__x86_64)
# define KEY '_','_','x','8','6','_','6','4'
#elif defined(__ppc__)
# define KEY '_','_','p','p','c','_','_'
#elif defined(__ppc64__)
# define KEY '_','_','p','p','c','6','4','_','_'
#endif
#define SIZE (sizeof(int *))
char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
('0' + ((SIZE / 10000)%10)),
('0' + ((SIZE / 1000)%10)),
('0' + ((SIZE / 100)%10)),
('0' + ((SIZE / 10)%10)),
('0' + (SIZE % 10)),
']',
#ifdef KEY
' ','k','e','y','[', KEY, ']',
#endif
'\0'};
#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
#else
int main(int argc, char *argv[])
#endif
{
int require = 0;
require += info_size[argc];
(void)argv;
return require;
}

Binary file not shown.

View File

@ -0,0 +1,40 @@
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>
#undef KEY
#if defined(__i386)
# define KEY '_','_','i','3','8','6'
#elif defined(__x86_64)
# define KEY '_','_','x','8','6','_','6','4'
#elif defined(__ppc__)
# define KEY '_','_','p','p','c','_','_'
#elif defined(__ppc64__)
# define KEY '_','_','p','p','c','6','4','_','_'
#endif
#define SIZE (sizeof(long int))
char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
('0' + ((SIZE / 10000)%10)),
('0' + ((SIZE / 1000)%10)),
('0' + ((SIZE / 100)%10)),
('0' + ((SIZE / 10)%10)),
('0' + (SIZE % 10)),
']',
#ifdef KEY
' ','k','e','y','[', KEY, ']',
#endif
'\0'};
#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
#else
int main(int argc, char *argv[])
#endif
{
int require = 0;
require += info_size[argc];
(void)argv;
return require;
}

Binary file not shown.

View File

@ -0,0 +1,40 @@
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>
#undef KEY
#if defined(__i386)
# define KEY '_','_','i','3','8','6'
#elif defined(__x86_64)
# define KEY '_','_','x','8','6','_','6','4'
#elif defined(__ppc__)
# define KEY '_','_','p','p','c','_','_'
#elif defined(__ppc64__)
# define KEY '_','_','p','p','c','6','4','_','_'
#endif
#define SIZE (sizeof(long int))
char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
('0' + ((SIZE / 10000)%10)),
('0' + ((SIZE / 1000)%10)),
('0' + ((SIZE / 100)%10)),
('0' + ((SIZE / 10)%10)),
('0' + (SIZE % 10)),
']',
#ifdef KEY
' ','k','e','y','[', KEY, ']',
#endif
'\0'};
#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
#else
int main(int argc, char *argv[])
#endif
{
int require = 0;
require += info_size[argc];
(void)argv;
return require;
}

Binary file not shown.

View File

@ -0,0 +1,40 @@
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>
#undef KEY
#if defined(__i386)
# define KEY '_','_','i','3','8','6'
#elif defined(__x86_64)
# define KEY '_','_','x','8','6','_','6','4'
#elif defined(__ppc__)
# define KEY '_','_','p','p','c','_','_'
#elif defined(__ppc64__)
# define KEY '_','_','p','p','c','6','4','_','_'
#endif
#define SIZE (sizeof(long long int))
char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
('0' + ((SIZE / 10000)%10)),
('0' + ((SIZE / 1000)%10)),
('0' + ((SIZE / 100)%10)),
('0' + ((SIZE / 10)%10)),
('0' + (SIZE % 10)),
']',
#ifdef KEY
' ','k','e','y','[', KEY, ']',
#endif
'\0'};
#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
#else
int main(int argc, char *argv[])
#endif
{
int require = 0;
require += info_size[argc];
(void)argv;
return require;
}

Binary file not shown.

View File

@ -0,0 +1,40 @@
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>
#undef KEY
#if defined(__i386)
# define KEY '_','_','i','3','8','6'
#elif defined(__x86_64)
# define KEY '_','_','x','8','6','_','6','4'
#elif defined(__ppc__)
# define KEY '_','_','p','p','c','_','_'
#elif defined(__ppc64__)
# define KEY '_','_','p','p','c','6','4','_','_'
#endif
#define SIZE (sizeof(long long int))
char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
('0' + ((SIZE / 10000)%10)),
('0' + ((SIZE / 1000)%10)),
('0' + ((SIZE / 100)%10)),
('0' + ((SIZE / 10)%10)),
('0' + (SIZE % 10)),
']',
#ifdef KEY
' ','k','e','y','[', KEY, ']',
#endif
'\0'};
#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
#else
int main(int argc, char *argv[])
#endif
{
int require = 0;
require += info_size[argc];
(void)argv;
return require;
}

Binary file not shown.

View File

@ -0,0 +1,40 @@
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>
#undef KEY
#if defined(__i386)
# define KEY '_','_','i','3','8','6'
#elif defined(__x86_64)
# define KEY '_','_','x','8','6','_','6','4'
#elif defined(__ppc__)
# define KEY '_','_','p','p','c','_','_'
#elif defined(__ppc64__)
# define KEY '_','_','p','p','c','6','4','_','_'
#endif
#define SIZE (sizeof(short int))
char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
('0' + ((SIZE / 10000)%10)),
('0' + ((SIZE / 1000)%10)),
('0' + ((SIZE / 100)%10)),
('0' + ((SIZE / 10)%10)),
('0' + (SIZE % 10)),
']',
#ifdef KEY
' ','k','e','y','[', KEY, ']',
#endif
'\0'};
#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
#else
int main(int argc, char *argv[])
#endif
{
int require = 0;
require += info_size[argc];
(void)argv;
return require;
}

Binary file not shown.

View File

@ -0,0 +1,40 @@
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>
#undef KEY
#if defined(__i386)
# define KEY '_','_','i','3','8','6'
#elif defined(__x86_64)
# define KEY '_','_','x','8','6','_','6','4'
#elif defined(__ppc__)
# define KEY '_','_','p','p','c','_','_'
#elif defined(__ppc64__)
# define KEY '_','_','p','p','c','6','4','_','_'
#endif
#define SIZE (sizeof(void *))
char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
('0' + ((SIZE / 10000)%10)),
('0' + ((SIZE / 1000)%10)),
('0' + ((SIZE / 100)%10)),
('0' + ((SIZE / 10)%10)),
('0' + (SIZE % 10)),
']',
#ifdef KEY
' ','k','e','y','[', KEY, ']',
#endif
'\0'};
#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
#else
int main(int argc, char *argv[])
#endif
{
int require = 0;
require += info_size[argc];
(void)argv;
return require;
}

Binary file not shown.

View File

@ -0,0 +1,40 @@
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>
#undef KEY
#if defined(__i386)
# define KEY '_','_','i','3','8','6'
#elif defined(__x86_64)
# define KEY '_','_','x','8','6','_','6','4'
#elif defined(__ppc__)
# define KEY '_','_','p','p','c','_','_'
#elif defined(__ppc64__)
# define KEY '_','_','p','p','c','6','4','_','_'
#endif
#define SIZE (sizeof(void *))
char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
('0' + ((SIZE / 10000)%10)),
('0' + ((SIZE / 1000)%10)),
('0' + ((SIZE / 100)%10)),
('0' + ((SIZE / 10)%10)),
('0' + (SIZE % 10)),
']',
#ifdef KEY
' ','k','e','y','[', KEY, ']',
#endif
'\0'};
#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
#else
int main(int argc, char *argv[])
#endif
{
int require = 0;
require += info_size[argc];
(void)argv;
return require;
}

Binary file not shown.

View File

@ -0,0 +1,40 @@
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>
#undef KEY
#if defined(__i386)
# define KEY '_','_','i','3','8','6'
#elif defined(__x86_64)
# define KEY '_','_','x','8','6','_','6','4'
#elif defined(__ppc__)
# define KEY '_','_','p','p','c','_','_'
#elif defined(__ppc64__)
# define KEY '_','_','p','p','c','6','4','_','_'
#endif
#define SIZE (sizeof(wchar_t))
char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',
('0' + ((SIZE / 10000)%10)),
('0' + ((SIZE / 1000)%10)),
('0' + ((SIZE / 100)%10)),
('0' + ((SIZE / 10)%10)),
('0' + (SIZE % 10)),
']',
#ifdef KEY
' ','k','e','y','[', KEY, ']',
#endif
'\0'};
#ifdef __CLASSIC_C__
int main(argc, argv) int argc; char *argv[];
#else
int main(int argc, char *argv[])
#endif
{
int require = 0;
require += info_size[argc];
(void)argv;
return require;
}

View File

@ -0,0 +1 @@
# This file is generated by cmake for dependency checking of the CMakeCache.txt file

BIN
CMakeFiles/feature_tests.bin Executable file

Binary file not shown.

View File

@ -0,0 +1,34 @@
const char features[] = {""
"C_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400
"1"
#else
"0"
#endif
"c_function_prototypes\n"
"C_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
"1"
#else
"0"
#endif
"c_restrict\n"
"C_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
"1"
#else
"0"
#endif
"c_static_assert\n"
"C_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
"1"
#else
"0"
#endif
"c_variadic_macros\n"
};
int main(int argc, char** argv) { (void)argv; return features[argc]; }

View File

@ -0,0 +1,405 @@
const char features[] = {""
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_aggregate_nsdmi)
"1"
#else
"0"
#endif
"cxx_aggregate_default_initializers\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_alias_templates)
"1"
#else
"0"
#endif
"cxx_alias_templates\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_alignas)
"1"
#else
"0"
#endif
"cxx_alignas\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_alignas)
"1"
#else
"0"
#endif
"cxx_alignof\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_attributes)
"1"
#else
"0"
#endif
"cxx_attributes\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 501 && __cplusplus > 201103L
"1"
#else
"0"
#endif
"cxx_attribute_deprecated\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_auto_type)
"1"
#else
"0"
#endif
"cxx_auto_type\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_binary_literals)
"1"
#else
"0"
#endif
"cxx_binary_literals\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_constexpr)
"1"
#else
"0"
#endif
"cxx_constexpr\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_contextual_conversions)
"1"
#else
"0"
#endif
"cxx_contextual_conversions\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_decltype)
"1"
#else
"0"
#endif
"cxx_decltype\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 501 && __cplusplus > 201103L
"1"
#else
"0"
#endif
"cxx_decltype_auto\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_decltype_incomplete_return_types)
"1"
#else
"0"
#endif
"cxx_decltype_incomplete_return_types\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_default_function_template_args)
"1"
#else
"0"
#endif
"cxx_default_function_template_args\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_defaulted_functions)
"1"
#else
"0"
#endif
"cxx_defaulted_functions\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_defaulted_functions)
"1"
#else
"0"
#endif
"cxx_defaulted_move_initializers\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_delegating_constructors)
"1"
#else
"0"
#endif
"cxx_delegating_constructors\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_deleted_functions)
"1"
#else
"0"
#endif
"cxx_deleted_functions\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 501 && __cplusplus > 201103L
"1"
#else
"0"
#endif
"cxx_digit_separators\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __cplusplus >= 201103L
"1"
#else
"0"
#endif
"cxx_enum_forward_declarations\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_explicit_conversions)
"1"
#else
"0"
#endif
"cxx_explicit_conversions\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __cplusplus >= 201103L
"1"
#else
"0"
#endif
"cxx_extended_friend_declarations\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __cplusplus >= 201103L
"1"
#else
"0"
#endif
"cxx_extern_templates\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_override_control)
"1"
#else
"0"
#endif
"cxx_final\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __cplusplus >= 201103L
"1"
#else
"0"
#endif
"cxx_func_identifier\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_generalized_initializers)
"1"
#else
"0"
#endif
"cxx_generalized_initializers\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 501 && __cplusplus > 201103L
"1"
#else
"0"
#endif
"cxx_generic_lambdas\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_inheriting_constructors)
"1"
#else
"0"
#endif
"cxx_inheriting_constructors\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __cplusplus >= 201103L
"1"
#else
"0"
#endif
"cxx_inline_namespaces\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_lambdas)
"1"
#else
"0"
#endif
"cxx_lambdas\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_init_captures)
"1"
#else
"0"
#endif
"cxx_lambda_init_captures\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_local_type_template_args)
"1"
#else
"0"
#endif
"cxx_local_type_template_args\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __cplusplus >= 201103L
"1"
#else
"0"
#endif
"cxx_long_long_type\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_noexcept)
"1"
#else
"0"
#endif
"cxx_noexcept\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_nonstatic_member_init)
"1"
#else
"0"
#endif
"cxx_nonstatic_member_init\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_nullptr)
"1"
#else
"0"
#endif
"cxx_nullptr\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_override_control)
"1"
#else
"0"
#endif
"cxx_override\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_range_for)
"1"
#else
"0"
#endif
"cxx_range_for\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_raw_string_literals)
"1"
#else
"0"
#endif
"cxx_raw_string_literals\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_reference_qualified_functions)
"1"
#else
"0"
#endif
"cxx_reference_qualified_functions\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_relaxed_constexpr)
"1"
#else
"0"
#endif
"cxx_relaxed_constexpr\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_return_type_deduction)
"1"
#else
"0"
#endif
"cxx_return_type_deduction\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __cplusplus >= 201103L
"1"
#else
"0"
#endif
"cxx_right_angle_brackets\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_rvalue_references)
"1"
#else
"0"
#endif
"cxx_rvalue_references\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __cplusplus >= 201103L
"1"
#else
"0"
#endif
"cxx_sizeof_member\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_static_assert)
"1"
#else
"0"
#endif
"cxx_static_assert\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_strong_enums)
"1"
#else
"0"
#endif
"cxx_strong_enums\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __cplusplus >= 199711L
"1"
#else
"0"
#endif
"cxx_template_template_parameters\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_thread_local)
"1"
#else
"0"
#endif
"cxx_thread_local\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_trailing_return)
"1"
#else
"0"
#endif
"cxx_trailing_return_types\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_unicode_literals)
"1"
#else
"0"
#endif
"cxx_unicode_literals\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_generalized_initializers)
"1"
#else
"0"
#endif
"cxx_uniform_initialization\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_unrestricted_unions)
"1"
#else
"0"
#endif
"cxx_unrestricted_unions\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_user_literals)
"1"
#else
"0"
#endif
"cxx_user_literals\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_variable_templates)
"1"
#else
"0"
#endif
"cxx_variable_templates\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __cplusplus >= 201103L
"1"
#else
"0"
#endif
"cxx_variadic_macros\n"
"CXX_FEATURE:"
#if ((__clang_major__ * 100) + __clang_minor__) >= 400 && __has_feature(cxx_variadic_templates)
"1"
#else
"0"
#endif
"cxx_variadic_templates\n"
};
int main(int argc, char** argv) { (void)argv; return features[argc]; }

1
CMakeFiles/git-data/HEAD Normal file
View File

@ -0,0 +1 @@
ref: refs/heads/master

View File

@ -0,0 +1,43 @@
#
# Internal file for GetGitRevisionDescription.cmake
#
# Requires CMake 2.6 or newer (uses the 'function' command)
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
set(HEAD_HASH)
file(READ "/Users/vsc/git/yap-6.3/CMakeFiles/git-data/HEAD" HEAD_CONTENTS LIMIT 1024)
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
if(HEAD_CONTENTS MATCHES "ref")
# named branch
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
if(EXISTS "/Users/vsc/git/yap-6.3/.git/${HEAD_REF}")
configure_file("/Users/vsc/git/yap-6.3/.git/${HEAD_REF}" "/Users/vsc/git/yap-6.3/CMakeFiles/git-data/head-ref" COPYONLY)
else()
configure_file("/Users/vsc/git/yap-6.3/.git/packed-refs" "/Users/vsc/git/yap-6.3/CMakeFiles/git-data/packed-refs" COPYONLY)
file(READ "/Users/vsc/git/yap-6.3/CMakeFiles/git-data/packed-refs" PACKED_REFS)
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
set(HEAD_HASH "${CMAKE_MATCH_1}")
endif()
endif()
else()
# detached HEAD
configure_file("/Users/vsc/git/yap-6.3/.git/HEAD" "/Users/vsc/git/yap-6.3/CMakeFiles/git-data/head-ref" COPYONLY)
endif()
if(NOT HEAD_HASH)
file(READ "/Users/vsc/git/yap-6.3/CMakeFiles/git-data/head-ref" HEAD_HASH LIMIT 1024)
string(STRIP "${HEAD_HASH}" HEAD_HASH)
endif()

View File

@ -0,0 +1 @@
880a9989c3fca9bd8184f0098049fb87795fde62

File diff suppressed because it is too large Load Diff

401
CMakeLists.txt.user Normal file
View File

@ -0,0 +1,401 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.0, 2015-09-17T09:40:51. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{378dfb04-c1f5-4fa0-86e6-78c9ff000795}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<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="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="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">1</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">false</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>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuemap type="QVariantMap" key="ClangProjectSettings">
<value type="QString" key="CustomPchFile"></value>
<value type="int" key="PchUsage">1</value>
</valuemap>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<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="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>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="CMakeProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="CMakeProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments">clean</value>
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="CMakeProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="CMakeProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">all</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<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">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="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes">
<value type="QString">LOGTALKHOME=/Users/vsc/share/logtalk</value>
</valuelist>
<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>
<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>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
<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">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"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Problogbdd</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.Problogbdd</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>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.2">
<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">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"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Problogbdd-Lfi</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.Problogbdd-Lfi</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>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.3">
<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">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"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">HorusCli</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.HorusCli</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>
<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>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">18</value>
</data>
<data>
<variable>Version</variable>
<value type="int">18</value>
</data>
</qtcreator>

View File

@ -0,0 +1,16 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.3
# Relative path conversion top directories.
set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/Users/vsc/git/yap-6.3")
set(CMAKE_RELATIVE_PATH_TOP_BINARY "/Users/vsc/git/yap-6.3")
# Force unix paths in dependencies.
set(CMAKE_FORCE_UNIX_PATHS 1)
# The C and CXX include file regular expressions for this directory.
set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$")
set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$")
set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})
set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN})

View File

@ -0,0 +1,40 @@
# The set of languages for which implicit dependencies are needed:
set(CMAKE_DEPENDS_LANGUAGES
"CXX"
)
# The set of files for implicit dependencies of each language:
set(CMAKE_DEPENDS_CHECK_CXX
"/Users/vsc/git/yap-6.3/CXX/yapi.cpp" "/Users/vsc/git/yap-6.3/CXX/CMakeFiles/Yap++.dir/yapi.cpp.o"
)
set(CMAKE_CXX_COMPILER_ID "Clang")
# Preprocessor definitions for this target.
set(CMAKE_TARGET_DEFINITIONS_CXX
"COROUTINING=1"
"DEBUG=1"
"DEPTH_LIMIT=1"
"HAVE_CONFIG_H"
"LOW_LEVEL_TRACER=1"
"RATIONAL_TREES=1"
"TABLING=1"
"USE_THREADEAD_CODE=1"
"_YAP_NOT_INSTALLED_=1"
)
# The include file search paths:
set(CMAKE_CXX_TARGET_INCLUDE_PATH
"."
"H"
"include"
"os"
"JIT/HPP"
"/usr/local/include"
"OPTYap"
"CXX/H"
"CXX/include"
)
# Targets to which this target links.
set(CMAKE_TARGET_LINKED_INFO_FILES
"/Users/vsc/git/yap-6.3/CMakeFiles/libYap.dir/DependInfo.cmake"
)

View File

@ -0,0 +1 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -g -dynamiclib -Wl,-headerpad_max_install_names -o libYap++.dylib -install_name @rpath/libYap++.dylib CMakeFiles/Yap++.dir/yapi.cpp.o ../libYap.6.3.4.dylib -ldl /usr/local/lib/libgmp.dylib /usr/local/opt/readline/lib/libreadline.dylib /usr/lib/libncurses.dylib -Wl,-rpath,/Users/vsc/git/yap-6.3

View File

@ -0,0 +1 @@
48

View File

@ -7,7 +7,7 @@ extern "C" {
#include "YapInterface.h"
#include "blobs.h"
char *Yap_TermToString(Term t, char *s, size_t sz, size_t *length, encoding_t encoding, int flags);
void YAP_UserCPredicate(const char *, YAP_UserCPred, YAP_Arity arity);
@ -358,11 +358,11 @@ char *YAPAtom::getName(void) {
// return an UTF-8 version
size_t sz = 512;
wchar_t * ptr = a->WStrOfAE;
int ch = -1;
char *s = new char[sz], *op = s;
utf8proc_int32_t ch = -1;
char *s = new char[sz], *op = s;
while (ch) {
ch = *ptr++;
utf8_put_char( op, ch );
op += put_utf8( (unsigned char *)op, ch);
}
sz = strlen(s)+1;
char *os = new char[sz];
@ -374,7 +374,7 @@ char *YAPAtom::getName(void) {
char *s = new char [sz+1];
return Yap_blob_to_string( RepAtom(a) , s, sz);
} else {
return a->StrOfAE;
return (char *)a->StrOfAE;
}
}

View File

@ -136,7 +136,7 @@ public:
// Getter: outputs the atom;
YAPAtom getAtom() { return YAPAtom(AtomOfTerm( gt() )); }
// Getter: outputs the name as a sequence of ISO-LATIN1 codes;
const char *text() { return AtomOfTerm( gt() )->StrOfAE; }
const char *text() { return (const char *)AtomOfTerm( gt() )->StrOfAE; }
};
/**

1
ChangeLog Normal file
View File

@ -0,0 +1 @@

35
FindPackageLog.txt Normal file
View File

@ -0,0 +1,35 @@
-- The following OPTIONAL packages have been found:
* GMP
* Readline
* MPI
* Gecode
* ODBC , "Use ODBC Data-Base Interface " , <http://www.unixodbc.org>
""
* Sqlite3
* PostgreSQL , "PostgreSQL Data-Base " , <http://www.postgresql.org>
""
* PythonInterp
* SWIG
* PythonLibs
* Java , "Use Java System" , <http://www.java.org>
""
""
* JNI , "Use Java Native Interface" , <http://www.java.org>
""
* CUDD , "Use CUDD Library" , <http://vlsi.colorado.edu/~fabio/CUDD/>
""
* PkgConfig
* RAPTOR , "Use RAPTOR Library" , <http://www.r.org>
""
* Qt5Gui (required version >= 5.4.2)
* Qt5Widgets
* Qt5Core
-- The following OPTIONAL packages have not been found:
* MySQL , "Use MYSQL Data-Base Interface " , <http://www.mysql.org>
""
* R , "Use R Environment" , <http://www.r.org>
""

2
GitSHA1.c Normal file
View File

@ -0,0 +1,2 @@
#define GIT_SHA1 "880a9989c3fca9bd8184f0098049fb87795fde62"
const char g_GIT_SHA1[] = GIT_SHA1;

View File

@ -59,7 +59,8 @@ typedef struct AtomEntryStruct
#endif
union {
char uStrOfAE[MIN_ARRAY]; /* representation of atom as a string */
unsigned char uUStrOfAE[MIN_ARRAY]; /* representation of atom as a string */
char uStrOfAE[MIN_ARRAY]; /* representation of atom as a string */
wchar_t uWStrOfAE[MIN_ARRAY]; /* representation of atom as a string */
struct atom_blob blob[MIN_ARRAY];
} rep;
@ -76,13 +77,15 @@ typedef struct ExtraAtomEntryStruct
#endif
union {
char uStrOfAE[4]; /* representation of atom as a string */
unsigned char uUStrOfAE[4]; /* representation of atom as a string */
char uStrOfAE[4]; /* representation of atom as a string */
wchar_t uWStrOfAE[2]; /* representation of atom as a string */
struct atom_blob blob[2];
} rep;
}
ExtraAtomEntry;
#define UStrOfAE rep.uUStrOfAE
#define StrOfAE rep.uStrOfAE
#define WStrOfAE rep.uWStrOfAE

View File

@ -352,28 +352,51 @@ IsLongIntTerm (Term t)
#define MkStringTerm(i) __MkStringTerm((i) PASS_REGS)
INLINE_ONLY inline EXTERN Term __MkStringTerm (const char *s USES_REGS);
INLINE_ONLY inline EXTERN Term __MkStringTerm (const char *s USES_REGS);
INLINE_ONLY inline EXTERN Term
__MkStringTerm (const char *s USES_REGS)
__MkStringTerm (const char *s USES_REGS)
{
Term t = AbsAppl(HR);
size_t sz = ALIGN_BY_TYPE(strlen(s)+1,CELL);
size_t sz = ALIGN_BY_TYPE(strlen((char *)s)+1,CELL);
HR[0] = (CELL) FunctorString;
HR[1] = (CELL) sz;
strcpy((char *)(HR+2), s);
strcpy((char *)(HR+2), (const char *)s);
HR[2+sz] = EndSpecials;
HR += 3+sz;
return t;
}
INLINE_ONLY inline EXTERN Term __MkUStringTerm (const unsigned char *s USES_REGS);
INLINE_ONLY inline EXTERN Term
__MkUStringTerm (const unsigned char *s USES_REGS)
{
Term t = AbsAppl(HR);
size_t sz = ALIGN_BY_TYPE(strlen((char *)s)+1,CELL);
HR[0] = (CELL) FunctorString;
HR[1] = (CELL) sz;
strcpy((char *)(HR+2), (const char *)s);
HR[2+sz] = EndSpecials;
HR += 3+sz;
return t;
}
INLINE_ONLY inline EXTERN const char *StringOfTerm (Term t);
INLINE_ONLY inline EXTERN const unsigned char *UStringOfTerm (Term t);
INLINE_ONLY inline EXTERN const char *
INLINE_ONLY inline EXTERN const unsigned char *
UStringOfTerm (Term t)
{
return (const unsigned char *) (RepAppl (t)+2);
}
INLINE_ONLY inline EXTERN const char *StringOfTerm (Term t);
INLINE_ONLY inline EXTERN const char *
StringOfTerm (Term t)
{
return (const char *) (RepAppl (t)+2);
return (const char *) (RepAppl (t)+2);
}

418
H/YapAppliedOpcodes.h Normal file
View File

@ -0,0 +1,418 @@
/* This file was generated automatically by "yap -L misc/buildops"
please do not update */
OPCODE(Ystop ,l)
OPCODE(Nstop ,e)
OPCODE(try_me ,Otapl)
OPCODE(retry_me ,Otapl)
OPCODE(trust_me ,Otapl)
OPCODE(enter_profiling ,p)
OPCODE(retry_profiled ,p)
OPCODE(profiled_retry_me ,Otapl)
OPCODE(profiled_trust_me ,Otapl)
OPCODE(profiled_retry_logical ,OtaLl)
OPCODE(profiled_trust_logical ,OtILl)
OPCODE(count_call ,p)
OPCODE(count_retry ,p)
OPCODE(count_retry_me ,Otapl)
OPCODE(count_trust_me ,Otapl)
OPCODE(count_retry_logical ,OtaLl)
OPCODE(count_trust_logical ,OtILl)
OPCODE(lock_lu ,p)
OPCODE(unlock_lu ,e)
OPCODE(alloc_for_logical_pred ,L)
OPCODE(copy_idb_term ,e)
OPCODE(unify_idb_term ,e)
OPCODE(ensure_space ,Osbpa)
OPCODE(spy_or_trymark ,Otapl)
OPCODE(try_and_mark ,Otapl)
OPCODE(count_retry_and_mark ,Otapl)
OPCODE(profiled_retry_and_mark ,Otapl)
OPCODE(retry_and_mark ,Otapl)
OPCODE(trust_fail ,e)
OPCODE(op_fail ,e)
OPCODE(cut ,s)
OPCODE(cut_t ,s)
OPCODE(cut_e ,s)
OPCODE(save_b_x ,x)
OPCODE(save_b_y ,y)
OPCODE(commit_b_x ,xps)
OPCODE(commit_b_y ,yps)
OPCODE(execute ,pp)
OPCODE(dexecute ,pp)
OPCODE(fcall ,Osbpp)
OPCODE(call ,Osbpp)
OPCODE(procceed ,p)
OPCODE(allocate ,e)
OPCODE(deallocate ,p)
#ifdef BEAM
OPCODE(retry_eam ,e)
#endif
#ifdef BEAM
OPCODE(run_eam ,os)
#endif
OPCODE(get_x_var ,xx)
OPCODE(get_y_var ,yx)
OPCODE(get_yy_var ,yyxx)
OPCODE(get_x_val ,xx)
OPCODE(get_y_val ,yx)
OPCODE(get_atom ,xc)
OPCODE(get_2atoms ,cc)
OPCODE(get_3atoms ,ccc)
OPCODE(get_4atoms ,cccc)
OPCODE(get_5atoms ,ccccc)
OPCODE(get_6atoms ,cccccc)
OPCODE(get_list ,x)
OPCODE(get_struct ,xfa)
OPCODE(get_float ,xd)
OPCODE(get_longint ,xi)
OPCODE(get_bigint ,xN)
OPCODE(get_dbterm ,xD)
OPCODE(glist_valx ,xx)
OPCODE(glist_valy ,yx)
OPCODE(gl_void_varx ,xx)
OPCODE(gl_void_vary ,yx)
OPCODE(gl_void_valx ,xx)
OPCODE(gl_void_valy ,yx)
OPCODE(unify_x_var ,ox)
OPCODE(unify_x_var_write ,ox)
OPCODE(unify_l_x_var ,ox)
OPCODE(unify_l_x_var_write ,ox)
OPCODE(unify_x_var2 ,oxx)
OPCODE(unify_x_var2_write ,oxx)
OPCODE(unify_l_x_var2 ,oxx)
OPCODE(unify_l_x_var2_write ,oxx)
OPCODE(unify_y_var ,oy)
OPCODE(unify_y_var_write ,oy)
OPCODE(unify_l_y_var ,oy)
OPCODE(unify_l_y_var_write ,oy)
OPCODE(unify_x_val ,ox)
OPCODE(unify_x_val_write ,ox)
OPCODE(unify_l_x_val ,ox)
OPCODE(unify_l_x_val_write ,ox)
OPCODE(unify_y_val ,oy)
OPCODE(unify_y_val_write ,oy)
OPCODE(unify_l_y_val ,oy)
OPCODE(unify_l_y_val_write ,oy)
OPCODE(unify_x_loc ,ox)
OPCODE(unify_x_loc_write ,ox)
OPCODE(unify_l_x_loc ,ox)
OPCODE(unify_l_x_loc_write ,ox)
OPCODE(unify_y_loc ,oy)
OPCODE(unify_y_loc_write ,oy)
OPCODE(unify_l_y_loc ,oy)
OPCODE(unify_l_y_loc_write ,oy)
OPCODE(unify_void ,o)
OPCODE(unify_void_write ,o)
OPCODE(unify_l_void ,o)
OPCODE(unify_l_void_write ,o)
OPCODE(unify_n_voids ,os)
OPCODE(unify_n_voids_write ,os)
OPCODE(unify_l_n_voids ,os)
OPCODE(unify_l_n_voids_write ,os)
OPCODE(unify_atom ,oc)
OPCODE(unify_atom_write ,oc)
OPCODE(unify_l_atom ,oc)
OPCODE(unify_l_atom_write ,oc)
OPCODE(unify_n_atoms ,osc)
OPCODE(unify_n_atoms_write ,osc)
OPCODE(unify_float ,od)
OPCODE(unify_float_write ,od)
OPCODE(unify_l_float ,od)
OPCODE(unify_l_float_write ,od)
OPCODE(unify_longint ,oi)
OPCODE(unify_longint_write ,oi)
OPCODE(unify_l_longint ,oi)
OPCODE(unify_l_longint_write ,oi)
OPCODE(unify_bigint ,oN)
OPCODE(unify_l_bigint ,oN)
OPCODE(unify_dbterm ,oD)
OPCODE(unify_l_dbterm ,oD)
OPCODE(unify_list ,o)
OPCODE(unify_list_write ,o)
OPCODE(unify_l_list ,o)
OPCODE(unify_l_list_write ,o)
OPCODE(unify_struct ,ofa)
OPCODE(unify_struct_write ,ofa)
OPCODE(unify_l_struc ,ofa)
OPCODE(unify_l_struc_write ,ofa)
OPCODE(put_x_var ,xx)
OPCODE(put_y_var ,yx)
OPCODE(put_x_val ,xx)
OPCODE(put_xx_val ,xxxx)
OPCODE(put_y_val ,yx)
OPCODE(put_y_vals ,yyxx)
OPCODE(put_unsafe ,yx)
OPCODE(put_atom ,xc)
OPCODE(put_dbterm ,xD)
OPCODE(put_bigint ,xN)
OPCODE(put_float ,xd)
OPCODE(put_longint ,xi)
OPCODE(put_list ,x)
OPCODE(put_struct ,xfa)
OPCODE(write_x_var ,x)
OPCODE(write_void ,e)
OPCODE(write_n_voids ,s)
OPCODE(write_y_var ,y)
OPCODE(write_x_val ,x)
OPCODE(write_x_loc ,x)
OPCODE(write_y_val ,y)
OPCODE(write_y_loc ,y)
OPCODE(write_atom ,c)
OPCODE(write_bigint ,N)
OPCODE(write_dbterm ,D)
OPCODE(write_float ,d)
OPCODE(write_longint ,i)
OPCODE(write_n_atoms ,sc)
OPCODE(write_list ,e)
OPCODE(write_l_list ,e)
OPCODE(write_struct ,fa)
OPCODE(write_l_struc ,fa)
OPCODE(save_pair_x ,ox)
OPCODE(save_pair_x_write ,ox)
OPCODE(save_pair_y ,oy)
OPCODE(save_pair_y_write ,oy)
OPCODE(save_appl_x ,ox)
OPCODE(save_appl_x_write ,ox)
OPCODE(save_appl_y ,oy)
OPCODE(save_appl_y_write ,oy)
OPCODE(jump ,l)
OPCODE(move_back ,l)
OPCODE(skip ,l)
OPCODE(either ,Osblp)
OPCODE(or_else ,Osblp)
OPCODE(pop_n ,s)
OPCODE(pop ,e)
OPCODE(call_cpred ,Osbpp)
OPCODE(execute_cpred ,pp)
OPCODE(call_usercpred ,Osbpp)
OPCODE(call_c_wfail ,slp)
OPCODE(try_c ,OtapFs)
OPCODE(retry_c ,OtapFs)
#ifdef CUT_C
OPCODE(cut_c ,OtapFs)
#endif
OPCODE(try_userc ,OtapFs)
OPCODE(retry_userc ,OtapFs)
#ifdef CUT_C
OPCODE(cut_userc ,OtapFs)
#endif
OPCODE(lock_pred ,e)
OPCODE(index_pred ,e)
#ifdef THREADS
OPCODE(thread_local ,e)
#endif
OPCODE(expand_index ,e)
OPCODE(expand_clauses ,sssllp)
OPCODE(undef_p ,e)
OPCODE(spy_pred ,e)
OPCODE(try_clause ,Otapl)
OPCODE(try_clause2 ,l)
OPCODE(try_clause3 ,l)
OPCODE(try_clause4 ,l)
OPCODE(retry ,Otapl)
OPCODE(retry2 ,l)
OPCODE(retry3 ,l)
OPCODE(retry4 ,l)
OPCODE(trust ,Otapl)
OPCODE(try_in ,l)
OPCODE(enter_lu_pred ,Illss)
OPCODE(try_logical ,OtaLl)
OPCODE(retry_logical ,OtaLl)
OPCODE(trust_logical ,OtILl)
OPCODE(user_switch ,lp)
OPCODE(switch_on_type ,llll)
OPCODE(switch_list_nl ,ollll)
OPCODE(switch_on_arg_type ,xllll)
OPCODE(switch_on_sub_arg_type ,sllll)
OPCODE(jump_if_var ,l)
OPCODE(jump_if_nonvar ,xll)
OPCODE(if_not_then ,clll)
OPCODE(switch_on_func ,sssl)
OPCODE(switch_on_cons ,sssl)
OPCODE(go_on_func ,sssl)
OPCODE(go_on_cons ,sssl)
OPCODE(if_func ,sssl)
OPCODE(if_cons ,sssl)
OPCODE(index_dbref ,e)
OPCODE(index_blob ,e)
OPCODE(index_long ,e)
#if YAP_JIT
OPCODE(jit_handler ,jhc)
#endif
OPCODE(p_atom_x ,xl)
OPCODE(p_atom_y ,yl)
OPCODE(p_atomic_x ,xl)
OPCODE(p_atomic_y ,yl)
OPCODE(p_integer_x ,xl)
OPCODE(p_integer_y ,yl)
OPCODE(p_nonvar_x ,xl)
OPCODE(p_nonvar_y ,yl)
OPCODE(p_number_x ,xl)
OPCODE(p_number_y ,yl)
OPCODE(p_var_x ,xl)
OPCODE(p_var_y ,yl)
OPCODE(p_db_ref_x ,xl)
OPCODE(p_db_ref_y ,yl)
OPCODE(p_primitive_x ,xl)
OPCODE(p_primitive_y ,yl)
OPCODE(p_compound_x ,xl)
OPCODE(p_compound_y ,yl)
OPCODE(p_float_x ,xl)
OPCODE(p_float_y ,yl)
OPCODE(p_plus_vv ,xxx)
OPCODE(p_plus_vc ,xxn)
OPCODE(p_plus_y_vv ,yxx)
OPCODE(p_plus_y_vc ,yxn)
OPCODE(p_minus_vv ,xxx)
OPCODE(p_minus_cv ,xxn)
OPCODE(p_minus_y_vv ,yxx)
OPCODE(p_minus_y_cv ,yxn)
OPCODE(p_times_vv ,xxx)
OPCODE(p_times_vc ,xxn)
OPCODE(p_times_y_vv ,yxx)
OPCODE(p_times_y_vc ,yxn)
OPCODE(p_div_vv ,xxx)
OPCODE(p_div_vc ,xxn)
OPCODE(p_div_cv ,xxn)
OPCODE(p_div_y_vv ,yxx)
OPCODE(p_div_y_vc ,yxn)
OPCODE(p_div_y_cv ,yxn)
OPCODE(p_and_vv ,xxx)
OPCODE(p_and_vc ,xxn)
OPCODE(p_and_y_vv ,yxx)
OPCODE(p_and_y_vc ,yxn)
OPCODE(p_or_vv ,xxx)
OPCODE(p_or_vc ,xxn)
OPCODE(p_or_y_vv ,yxx)
OPCODE(p_or_y_vc ,yxn)
OPCODE(p_sll_vv ,xxx)
OPCODE(p_sll_vc ,xxn)
OPCODE(p_sll_cv ,xxn)
OPCODE(p_sll_y_vv ,yxx)
OPCODE(p_sll_y_vc ,yxn)
OPCODE(p_sll_y_cv ,yxn)
OPCODE(p_slr_vv ,xxx)
OPCODE(p_slr_vc ,xxn)
OPCODE(p_slr_cv ,xxn)
OPCODE(p_slr_y_vv ,yxx)
OPCODE(p_slr_y_vc ,yxn)
OPCODE(p_slr_y_cv ,yxn)
OPCODE(call_bfunc_xx ,plxxs)
OPCODE(call_bfunc_yx ,plxys)
OPCODE(call_bfunc_xy ,plxys)
OPCODE(call_bfunc_yy ,plyys)
OPCODE(p_equal ,e)
OPCODE(p_dif ,l)
OPCODE(p_eq ,l)
OPCODE(p_arg_vv ,xxx)
OPCODE(p_arg_cv ,xxn)
OPCODE(p_arg_y_vv ,yxx)
OPCODE(p_arg_y_cv ,yxn)
OPCODE(p_func2s_vv ,xxx)
OPCODE(p_func2s_cv ,xxc)
OPCODE(p_func2s_vc ,xxn)
OPCODE(p_func2s_y_vv ,yxx)
OPCODE(p_func2s_y_cv ,yxn)
OPCODE(p_func2s_y_vc ,yxn)
OPCODE(p_func2f_xx ,xxx)
OPCODE(p_func2f_xy ,xxy)
OPCODE(p_func2f_yx ,yxx)
OPCODE(p_func2f_yy ,yyx)
OPCODE(p_functor ,e)
OPCODE(p_execute2 ,Osbpp)
OPCODE(p_execute ,Osbmp)
OPCODE(p_execute_tail ,Osbpp)
#ifdef YAPOR
OPCODE(getwork_first_time ,e)
OPCODE(getwork ,Otapl)
OPCODE(getwork_seq ,Otapl)
OPCODE(sync ,Otapl)
#endif
#ifdef TABLING
#ifdef TABLING_INNER_CUTS
OPCODE(clause_with_cut ,e)
#endif
OPCODE(table_load_answer ,Otapl)
OPCODE(table_try_answer ,Otapl)
OPCODE(table_try_single ,Otapl)
OPCODE(table_try_me ,Otapl)
OPCODE(table_try ,Otapl)
OPCODE(table_retry_me ,Otapl)
OPCODE(table_retry ,Otapl)
OPCODE(table_trust_me ,Otapl)
OPCODE(table_trust ,Otapl)
OPCODE(table_new_answer ,s)
OPCODE(table_answer_resolution ,Otapl)
OPCODE(table_completion ,Otapl)
#ifdef THREADS_CONSUMER_SHARING
OPCODE(table_answer_resolution_completion,Otapl)
#endif
OPCODE(trie_do_var ,e)
OPCODE(trie_trust_var ,e)
OPCODE(trie_try_var ,e)
OPCODE(trie_retry_var ,e)
OPCODE(trie_do_var_in_pair ,e)
OPCODE(trie_trust_var_in_pair ,e)
OPCODE(trie_try_var_in_pair ,e)
OPCODE(trie_retry_var_in_pair ,e)
OPCODE(trie_do_val ,e)
OPCODE(trie_trust_val ,e)
OPCODE(trie_try_val ,e)
OPCODE(trie_retry_val ,e)
OPCODE(trie_do_val_in_pair ,e)
OPCODE(trie_trust_val_in_pair ,e)
OPCODE(trie_try_val_in_pair ,e)
OPCODE(trie_retry_val_in_pair ,e)
OPCODE(trie_do_atom ,e)
OPCODE(trie_trust_atom ,e)
OPCODE(trie_try_atom ,e)
OPCODE(trie_retry_atom ,e)
OPCODE(trie_do_atom_in_pair ,e)
OPCODE(trie_trust_atom_in_pair ,e)
OPCODE(trie_try_atom_in_pair ,e)
OPCODE(trie_retry_atom_in_pair ,e)
OPCODE(trie_do_null ,e)
OPCODE(trie_trust_null ,e)
OPCODE(trie_try_null ,e)
OPCODE(trie_retry_null ,e)
OPCODE(trie_do_null_in_pair ,e)
OPCODE(trie_trust_null_in_pair ,e)
OPCODE(trie_try_null_in_pair ,e)
OPCODE(trie_retry_null_in_pair ,e)
OPCODE(trie_do_pair ,e)
OPCODE(trie_trust_pair ,e)
OPCODE(trie_try_pair ,e)
OPCODE(trie_retry_pair ,e)
OPCODE(trie_do_appl ,e)
OPCODE(trie_trust_appl ,e)
OPCODE(trie_try_appl ,e)
OPCODE(trie_retry_appl ,e)
OPCODE(trie_do_appl_in_pair ,e)
OPCODE(trie_trust_appl_in_pair ,e)
OPCODE(trie_try_appl_in_pair ,e)
OPCODE(trie_retry_appl_in_pair ,e)
OPCODE(trie_do_extension ,e)
OPCODE(trie_trust_extension ,e)
OPCODE(trie_try_extension ,e)
OPCODE(trie_retry_extension ,e)
OPCODE(trie_do_double ,e)
OPCODE(trie_trust_double ,e)
OPCODE(trie_try_double ,e)
OPCODE(trie_retry_double ,e)
OPCODE(trie_do_longint ,e)
OPCODE(trie_trust_longint ,e)
OPCODE(trie_try_longint ,e)
OPCODE(trie_retry_longint ,e)
OPCODE(trie_do_gterm ,e)
OPCODE(trie_trust_gterm ,e)
OPCODE(trie_try_gterm ,e)
OPCODE(trie_retry_gterm ,e)
#endif
/* this instruction is hardwired */
#ifdef YAPOR
OPCODE(or_last ,sblp)
#elseIlllllllllllllllllllllllllllllllllllllllllllllllllll
OPCODE(or_last ,p)
#endif

View File

@ -172,7 +172,7 @@ typedef struct struct_param2 {
} param2_t;
typedef struct {
const char *name;
char *name;
bool writable;
flag_func def;
const char *init;
@ -180,8 +180,8 @@ typedef struct {
} flag_info;
typedef struct {
const char *name;
typedef struct {
char *name;
flag_func def;
const char *init;
} arg_info;
@ -314,7 +314,7 @@ static inline int indexingMode(void) {
}
static inline const char *floatFormat(void) {
return RepAtom(AtomOfTerm(GLOBAL_Flags[FLOAT_FORMAT_FLAG].at))->StrOfAE;
return RepAtom(AtomOfTerm(GLOBAL_Flags[FLOAT_FORMAT_FLAG].at))->rep.uStrOfAE;
}
static inline size_t indexingDepth(void) {

View File

@ -374,7 +374,13 @@ YAP is booted with the `-q` or `-L` flag.
*/
YAP_FLAG( VERBOSE_AUTOLOAD_FLAG, "verbose_autoload", true, boolean, "false" , NULL ),
YAP_FLAG( VERBOSE_FILE_SEARCH_FLAG, "verbose_file_search", true, boolean, "false" , NULL ),
YAP_FLAG( VERBOSE_FILE_SEARCH_FLAG, "verbose_file_search", true, boolean, "false" , NULL ), /**< `verbose_file_search `
If `true` allow printing of informational messages when
searching for file names. If `false` disable printing these messages. It
is `false` by default except if YAP is booted with the `-L`
flag.
*/
YAP_FLAG( VERBOSE_LOAD_FLAG, "verbose_load", true, isatom, "normal" , NULL ), /**< `verbose_load `
If `true` allow printing of informational messages when

View File

@ -256,9 +256,9 @@ AtomOfTerm (Term t)
INLINE_ONLY inline EXTERN Term MkAtomTerm (Atom);
INLINE_ONLY inline EXTERN Term
MkAtomTerm (Atom a)
MkAtomTerm (Atom at)
{
return (Term) (TAGGEDA ((CELL)AtomTag, (CELL) (a)));
return (Term) (TAGGEDA ((CELL)AtomTag, (CELL) (at)));
}

View File

@ -29,7 +29,100 @@
*/
#include "Yap.h"
#include "pl-utf8.h"
#include "utf8proc.h"
inline static utf8proc_ssize_t get_utf8(utf8proc_uint8_t * ptr, utf8proc_int32_t *valp) { return utf8proc_iterate( ptr, -1, valp ); }
inline static utf8proc_ssize_t put_utf8(utf8proc_uint8_t * ptr, utf8proc_int32_t val) { return utf8proc_encode_char( val, ptr ); }
inline static utf8proc_uint8_t *skip_utf8( utf8proc_uint8_t * pt, utf8proc_ssize_t n) {
utf8proc_ssize_t i;
utf8proc_int32_t b;
for (i=0;i< n; i++) {
utf8proc_ssize_t l = utf8proc_iterate( pt, -1, &b );
if (b==0) return pt;
pt += l;
}
return pt;
}
inline static utf8proc_ssize_t strlen_utf8(const utf8proc_uint8_t * pt) {
utf8proc_ssize_t rc =0;
utf8proc_int32_t b;
while (true) {
utf8proc_ssize_t l = utf8proc_iterate( pt, -1, &b );
if (b==0) return rc;
pt += l;
rc += l;
}
return rc;
}
inline static utf8proc_ssize_t strlen_latin_utf8(const unsigned char * pt) {
utf8proc_ssize_t rc =0;
utf8proc_uint8_t b;
while (true) {
utf8proc_ssize_t l = utf8proc_encode_char( *pt, &b );
if (b==0) return rc;
pt++;
rc += l;
}
return rc;
}
inline static utf8proc_ssize_t strnlen_latin_utf8(const unsigned char * pt, size_t max) {
utf8proc_ssize_t rc =0;
utf8proc_uint8_t b;
while (true) {
utf8proc_ssize_t l = utf8proc_encode_char( *pt, &b );
if (b==0) return rc;
pt++;
rc += l;
if (--max == 0) return rc;
}
return rc;
}
inline static utf8proc_ssize_t strlen_ucs2_utf8(const wchar_t * pt) {
utf8proc_ssize_t rc =0;
utf8proc_uint8_t b;
while (true) {
utf8proc_ssize_t l = utf8proc_encode_char( *pt, &b );
if (b==0) return rc;
pt ++;
rc += l;
}
return rc;
}
inline static utf8proc_ssize_t strnlen_ucs2_utf8(const wchar_t * pt, size_t max) {
utf8proc_ssize_t rc =0;
utf8proc_uint8_t b;
while (true) {
utf8proc_ssize_t l = utf8proc_encode_char( *pt, &b );
if (b==0) return rc;
pt ++;
rc += l;
if (--max == 0) return rc;
}
return rc;
}
inline static int cmpn_utf8(const utf8proc_uint8_t * pt1, const utf8proc_uint8_t * pt2, utf8proc_ssize_t n) {
utf8proc_ssize_t i;
utf8proc_int32_t b;
for (i=0;i< n; i++) {
if (pt1[0] != pt2[0]) return pt1[0]- pt2[0];
utf8proc_ssize_t l = utf8proc_iterate( pt1, -1, &b );
if (l == 2) { if (pt1[1] != pt2[1]) return pt1[1]- pt2[1]; }
else if (l == 3) { if (pt1[2] != pt2[2]) return pt1[2]- pt2[2]; }
else if (l == 4) { if (pt1[3] != pt2[3]) return pt1[3]- pt2[3]; }
pt1 += l;
pt2 += l;
}
return 0;
}
const char *Yap_tokRep(TokEntry *tokptr);
@ -72,6 +165,7 @@ typedef union {
const char *c0;
const wchar_t *w0;
char *c;
unsigned char *uc;
wchar_t *w;
Atom a;
size_t l;
@ -100,14 +194,14 @@ init_tstring( USES_REGS1 ) {
return t;
}
static inline char *
static inline unsigned char *
buf_from_tstring( CELL *p ) {
char *out = (char *)(p + 2);
unsigned char *out = (unsigned char *)(p + 2);
return out;
}
static inline void
close_tstring( char *p USES_REGS ) {
close_tstring( unsigned char *p USES_REGS ) {
CELL *szp = HR+1;
HR = (CELL *)ALIGN_BY_TYPE( p ,CELL);
*szp = (HR - szp)-1;
@ -345,12 +439,13 @@ Yap_AtomicToTBQ(Term t0, Term mod USES_REGS)
}
static inline Atom
Yap_CharsToAtom( const char *s USES_REGS )
Yap_CharsToAtom( const char *s, encoding_t enc USES_REGS )
{
seq_tv_t inp, out;
inp.val.c0 = s;
inp.sz = 0;
inp.enc = enc;
inp.type = YAP_STRING_CHARS;
out.type = YAP_STRING_ATOM;
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
@ -359,12 +454,13 @@ Yap_CharsToAtom( const char *s USES_REGS )
}
static inline Term
Yap_CharsToListOfAtoms( const char *s USES_REGS )
Yap_CharsToListOfAtoms( const char *s, encoding_t enc USES_REGS )
{
seq_tv_t inp, out;
inp.val.c0 = s;
inp.sz = 0;
inp.enc = enc;
inp.type = YAP_STRING_CHARS;
out.type = YAP_STRING_ATOMS;
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
@ -373,12 +469,13 @@ Yap_CharsToListOfAtoms( const char *s USES_REGS )
}
static inline Term
Yap_CharsToListOfCodes( const char *s USES_REGS )
Yap_CharsToListOfCodes( const char *s, encoding_t enc USES_REGS )
{
seq_tv_t inp, out;
inp.val.c0 = s;
inp.sz = 0;
inp.enc = enc;
inp.type = YAP_STRING_CHARS;
out.type = YAP_STRING_CODES;
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
@ -387,13 +484,29 @@ Yap_CharsToListOfCodes( const char *s USES_REGS )
}
static inline Term
Yap_CharsToDiffListOfCodes( const char *s, Term tail USES_REGS )
Yap_UTF8ToListOfCodes( const char *s USES_REGS )
{
seq_tv_t inp, out;
inp.val.c0 = s;
inp.sz = 0;
inp.type = YAP_STRING_CHARS;
inp.enc = ENC_ISO_UTF8;
out.type = YAP_STRING_CODES;
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
static inline Term
Yap_CharsToDiffListOfCodes( const char *s, Term tail, encoding_t enc USES_REGS )
{
seq_tv_t inp, out;
inp.val.c0 = s;
inp.sz = 0;
inp.enc = enc;
inp.type = YAP_STRING_CHARS;
out.type = YAP_STRING_DIFF|YAP_STRING_CODES;
out.dif = tail;
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
@ -402,12 +515,44 @@ Yap_CharsToDiffListOfCodes( const char *s, Term tail USES_REGS )
}
static inline Term
Yap_CharsToString( const char *s USES_REGS )
Yap_UTF8ToDiffListOfCodes( const char *s, Term tail USES_REGS )
{
seq_tv_t inp, out;
inp.val.c0 = s;
inp.sz = 0;
inp.type = YAP_STRING_CHARS;
inp.enc = ENC_ISO_UTF8;
out.type = YAP_STRING_DIFF|YAP_STRING_CODES;
out.dif = tail;
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
static inline Term
Yap_WCharsToDiffListOfCodes( const wchar_t *s, Term tail USES_REGS )
{
seq_tv_t inp, out;
inp.val.w0 = s;
inp.sz = 0;
inp.type = YAP_STRING_WCHARS;
out.type = YAP_STRING_DIFF|YAP_STRING_CODES;
out.dif = tail;
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
return out.val.t;
}
static inline Term
Yap_CharsToString( const char *s, encoding_t enc USES_REGS )
{
seq_tv_t inp, out;
inp.val.c0 = s;
inp.sz = 0;
inp.enc = enc;
inp.type = YAP_STRING_CHARS;
out.type = YAP_STRING_STRING;
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
@ -437,7 +582,7 @@ Yap_AtomToUTF8Text( Atom at, const char *s USES_REGS )
}
static inline Term
Yap_CharsToTDQ( const char *s, Term mod USES_REGS )
Yap_CharsToTDQ( const char *s, Term mod, encoding_t enc USES_REGS )
{
seq_tv_t inp, out;
@ -445,6 +590,7 @@ Yap_CharsToTDQ( const char *s, Term mod USES_REGS )
inp.sz = 0;
inp.type = YAP_STRING_CHARS;
inp.mod = mod;
inp.enc = enc;
out.type = mod_to_type(mod PASS_REGS);
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
@ -454,7 +600,7 @@ Yap_CharsToTDQ( const char *s, Term mod USES_REGS )
}
static inline Term
Yap_CharsToTBQ( const char *s, Term mod USES_REGS )
Yap_CharsToTBQ( const char *s, Term mod, encoding_t enc USES_REGS )
{
seq_tv_t inp, out;
@ -462,6 +608,7 @@ Yap_CharsToTBQ( const char *s, Term mod USES_REGS )
inp.sz = 0;
inp.type = YAP_STRING_CHARS;
inp.mod = mod;
inp.enc = enc;
out.type = mod_to_bqtype(mod PASS_REGS);
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return 0L;
@ -646,13 +793,14 @@ YapListToTBQ(Term t0, Term mod USES_REGS)
}
static inline Atom
Yap_NCharsToAtom( const char *s, size_t len USES_REGS )
Yap_NCharsToAtom( const char *s, size_t len, encoding_t enc USES_REGS )
{
seq_tv_t inp, out;
inp.val.c0 = s;
inp.sz = len;
inp.type = YAP_STRING_CHARS|YAP_STRING_NCHARS;
inp.enc = enc;
out.type = YAP_STRING_ATOM;
out.max = len;
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
@ -661,12 +809,13 @@ Yap_NCharsToAtom( const char *s, size_t len USES_REGS )
}
static inline Term
Yap_CharsToDiffListOfAtoms( const char *s, Term tail USES_REGS )
Yap_CharsToDiffListOfAtoms( const char *s, encoding_t enc, Term tail USES_REGS )
{
seq_tv_t inp, out;
inp.val.c0 = s;
inp.type = YAP_STRING_CHARS;
inp.enc = enc;
out.type = YAP_STRING_ATOMS|YAP_STRING_DIFF;
out.dif = tail;
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
@ -676,13 +825,14 @@ Yap_CharsToDiffListOfAtoms( const char *s, Term tail USES_REGS )
static inline Term
Yap_NCharsToListOfCodes( const char *s, size_t len USES_REGS )
Yap_NCharsToListOfCodes( const char *s, size_t len, encoding_t enc USES_REGS )
{
seq_tv_t inp, out;
inp.val.c0 = s;
inp.sz = len;
inp.type = YAP_STRING_CHARS|YAP_STRING_NCHARS;
inp.enc = enc;
out.type = YAP_STRING_CODES;
out.max = len;
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
@ -691,12 +841,13 @@ Yap_NCharsToListOfCodes( const char *s, size_t len USES_REGS )
}
static inline Term
Yap_NCharsToString( const char *s, size_t len USES_REGS )
Yap_NCharsToString( const char *s, size_t len, encoding_t enc USES_REGS )
{
seq_tv_t inp, out;
inp.val.c0 = s;
inp.sz = len;
inp.enc = enc;
inp.type = YAP_STRING_CHARS|YAP_STRING_NCHARS;
out.type = YAP_STRING_STRING;
out.max = len;
@ -706,13 +857,14 @@ Yap_NCharsToString( const char *s, size_t len USES_REGS )
}
static inline Term
Yap_NCharsToTDQ( const char *s, size_t len, Term mod USES_REGS )
Yap_NCharsToTDQ( const char *s, size_t len, encoding_t enc, Term mod USES_REGS )
{
seq_tv_t inp, out;
inp.val.c0 = s;
inp.type = YAP_STRING_CHARS|YAP_STRING_NCHARS;
inp.sz = len;
inp.enc = enc;
inp.mod = mod;
out.type = mod_to_type(mod PASS_REGS);
out.max = len;
@ -724,13 +876,14 @@ Yap_NCharsToTDQ( const char *s, size_t len, Term mod USES_REGS )
}
static inline Term
Yap_NCharsToTBQ( const char *s, size_t len, Term mod USES_REGS )
Yap_NCharsToTBQ( const char *s, size_t len, encoding_t enc, Term mod USES_REGS )
{
seq_tv_t inp, out;
inp.val.c0 = s;
inp.type = YAP_STRING_CHARS|YAP_STRING_NCHARS;
inp.sz = len;
inp.enc = enc;
inp.mod = mod;
out.type = mod_to_bqtype(mod PASS_REGS);
out.max = len;

View File

@ -26,8 +26,9 @@ Term Yap_GetValue(Atom);
int Yap_HasOp(Atom);
struct operator_entry *Yap_GetOpPropForAModuleHavingALock(struct AtomEntryStruct *, Term);
Atom Yap_LookupAtom(const char *);
Atom Yap_ULookupAtom(const unsigned char *);
Atom Yap_LookupAtomWithLength(const char *, size_t);
Atom Yap_LookupUTF8Atom(const char *);
Atom Yap_LookupUTF8Atom(const unsigned char *);
Atom Yap_LookupMaybeWideAtom(const wchar_t *);
Atom Yap_LookupMaybeWideAtomWithLength(const wchar_t *, size_t);
Atom Yap_FullLookupAtom(const char *);
@ -64,13 +65,13 @@ void Yap_atom_gc( CACHE_TYPE1 );
void Yap_init_agc( void );
/* alloc.c */
void Yap_FreeCodeSpace(char *);
char *Yap_AllocAtomSpace(size_t);
char *Yap_AllocCodeSpace(size_t);
char *Yap_ReallocCodeSpace(char *,size_t);
void Yap_FreeCodeSpace(void *);
void *Yap_AllocAtomSpace(size_t);
void *Yap_AllocCodeSpace(size_t);
void *Yap_ReallocCodeSpace(void *,size_t);
ADDR Yap_AllocFromForeignArea(Int);
int Yap_ExtendWorkSpace(Int);
void Yap_FreeAtomSpace(char *);
void Yap_FreeAtomSpace(void *);
int Yap_FreeWorkSpace(void);
void Yap_InitMemory(UInt,UInt,UInt);
void Yap_InitExStacks(int,int,int);
@ -125,7 +126,7 @@ struct pred_entry *Yap_PredForChoicePt(choiceptr bptr, op_numbers *op);
void Yap_InitCdMgr(void);
struct pred_entry * Yap_PredFromClause( Term t USES_REGS );
bool Yap_discontiguous(struct pred_entry *ap USES_REGS );
bool Yap_multiple(struct pred_entry *ap USES_REGS );
bool Yap_multiple(struct pred_entry *ap, int mode USES_REGS );
void Yap_init_consult(int, const char *);
void Yap_end_consult(void);
void Yap_Abolish(struct pred_entry *);
@ -362,6 +363,11 @@ void Yap_InitSockets (void);
/* sort.c */
void Yap_InitSortPreds(void);
/* stack.c */
void Yap_InitStInfo(void);
#if !defined(YAPOR) && !defined(THREADS)
bool Yap_search_for_static_predicate_in_use(struct pred_entry *, bool);
#endif
/* stdpreds.c */
void Yap_InitBackCPreds(void);

View File

@ -440,7 +440,7 @@ IsModProperty (int flags)
#define UNKNOWN_MASK (UNKNOWN_ERROR|UNKNOWN_WARNING|UNKNOWN_FAIL)
Term Yap_getUnknownModule(ModEntry *m);
void Yap_setModuleFlags(ModEntry *n, ModEntry *o);
void Yap_setModuleFlags(ModEntry *n, ModEntry *o);
/* operator property entry structure */
typedef struct operator_entry
@ -860,12 +860,12 @@ typedef enum
} dbentry_flags;
/* predicate initialization */
void Yap_InitCPred(const char *, UInt, CPredicate, pred_flags_t);
void Yap_InitAsmPred(const char *, UInt, int, CPredicate, pred_flags_t);
void Yap_InitCmpPred(const char *, UInt, CmpPredicate, pred_flags_t);
void Yap_InitCPredBack(const char *, UInt, unsigned int, CPredicate,CPredicate,pred_flags_t);
void Yap_InitCPredBackCut(const char *, UInt, unsigned int, CPredicate,CPredicate,CPredicate,pred_flags_t);
void Yap_InitCPredBack_(const char *, UInt, unsigned int, CPredicate,CPredicate,CPredicate,pred_flags_t);
void Yap_InitCPred(const char *, UInt, CPredicate, pred_flags_t);
void Yap_InitAsmPred(const char *, UInt, int, CPredicate, pred_flags_t);
void Yap_InitCmpPred(const char *, UInt, CmpPredicate, pred_flags_t);
void Yap_InitCPredBack(const char *, UInt, unsigned int, CPredicate,CPredicate,pred_flags_t);
void Yap_InitCPredBackCut(const char *, UInt, unsigned int, CPredicate,CPredicate,CPredicate,pred_flags_t);
void Yap_InitCPredBack_(const char *, UInt, unsigned int, CPredicate,CPredicate,CPredicate,pred_flags_t);
/* *********************** DBrefs **************************************/
@ -889,9 +889,9 @@ INLINE_ONLY inline EXTERN DBTerm *TermToDBTerm(Term);
INLINE_ONLY inline EXTERN DBTerm *TermToDBTerm(Term X)
{
if (IsPairTerm(X)) {
return(DBTerm *)((char *)RepPair(X) - (CELL) &(((DBTerm *) NULL)->Contents));
return(DBTerm *)((unsigned char *)RepPair(X) - (CELL) &(((DBTerm *) NULL)->Contents));
} else {
return(DBTerm *)((char *)RepAppl(X) - (CELL) &(((DBTerm *) NULL)->Contents));
return(DBTerm *)((unsigned char *)RepAppl(X) - (CELL) &(((DBTerm *) NULL)->Contents));
}
}
@ -921,7 +921,7 @@ typedef struct DB_STRUCT
DBTerm DBT;
} DBStruct;
#define DBStructFlagsToDBStruct(X) ((DBRef)((char *)(X) - (CELL) &(((DBRef) NULL)->Flags)))
#define DBStructFlagsToDBStruct(X) ((DBRef)((unsigned char *)(X) - (CELL) &(((DBRef) NULL)->Flags)))
#if MULTIPLE_STACKS
#define INIT_DBREF_COUNT(X) (X)->ref_count = 0
@ -1957,6 +1957,7 @@ PredPropByAtomAndMod (Atom at, Term cur_mod)
return Yap_NewPredPropByAtom (ae, cur_mod);
}
#if DEBUG_PELOCKING
#define PELOCK(I,Z) \
{ LOCK((Z)->PELock); (Z)->StatisticsForPred->NOfEntries=(I);(Z)->StatisticsForPred->NOfHeadSuccesses=pthread_self(); }
@ -1991,7 +1992,7 @@ AddPropToAtom(AtomEntry *ae, PropEntry *p)
// auxiliary functions
INLINE_ONLY inline EXTERN const char *AtomName (Atom at);
INLINE_ONLY inline EXTERN const char *AtomName (Atom at);
/**
* AtomName: get a string with the name of an Atom. Assumes 8 bit representation.
@ -2003,7 +2004,7 @@ INLINE_ONLY inline EXTERN const char *AtomName (Atom at);
INLINE_ONLY inline EXTERN const char *
AtomName (Atom at)
{
return RepAtom(at) -> StrOfAE;
return RepAtom(at) -> rep.uStrOfAE;
}
@ -2021,7 +2022,7 @@ INLINE_ONLY inline EXTERN const char *AtomTermName (Term t);
INLINE_ONLY inline EXTERN const char*
AtomTermName (Term t)
{
return RepAtom(AtomOfTerm(t)) -> StrOfAE;
return RepAtom(AtomOfTerm(t)) -> rep.uStrOfAE;
}

120
H/absmi-switch.h Normal file
View File

@ -0,0 +1,120 @@
/*************************************************************************
* *
* YAP Prolog *
* *
* Yap Prolog was developed at NCCUP - Universidade do Porto *
* *
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
* *
**************************************************************************
* *
* File: absmi.c *
* Last rev: *
* mods: *
* comments: Portable abstract machine interpreter that support threaded
* execution. *
* *
*************************************************************************/
/**
* @file absmi-threaded.h
* @author VITOR SANTOS COSTA <vsc@VITORs-MacBook-Pro.local>
* @date Sun Aug 2 23:46:47 2015
*
* @brief This file implements the support for switch-based execution of
* the YAP abstract machine emulator.
*
* Switch-based emulators consist of one or several switches that are at the
* core of an execution loop. They are simpler to implement, more compact,
* and easier to debug.
*
*
*/
#ifndef ABSMI_THREADED_H
#define ABSMI_THREADED_H
#ifndef _NATIVE
#define ALWAYS_START_PREFETCH(TYPE) {
#define ALWAYS_START_PREFETCH_W(TYPE) {
#define ALWAYS_LOOKAHEAD(WHERE) {
#define START_PREFETCH(TYPE) {
#define START_PREFETCH_W(TYPE) {
#define INIT_PREFETCH() {
#define PREFETCH_OP(X)
#else
#define ALWAYS_START_PREFETCH(TYPE)
#define ALWAYS_START_PREFETCH_W(TYPE)
#define ALWAYS_LOOKAHEAD(WHERE)
#define START_PREFETCH(TYPE)
#define START_PREFETCH_W(TYPE)
#define INIT_PREFETCH()
#define PREFETCH_OP(X)
#endif /* _NATIVE */
#ifndef _NATIVE
#define ALWAYS_END_PREFETCH() }
#define ALWAYS_END_PREFETCH_W() }
#define END_PREFETCH() }
#define END_PREFETCH_W() }
#else
#define ALWAYS_END_PREFETCH()
#define ALWAYS_END_PREFETCH_W()
#define END_PREFETCH()
#define END_PREFETCH_W()
#endif /* _NATIVE */
#define DO_PREFETCH(TYPE)
#define DO_PREFETCH_W(TYPE)
#define JMPNext() goto nextop
#define JMPNextW() goto nextop_write
#define baGONext() JMPNext()
#define GONextW() JMPNextW()
#define ALWAYS_GONext() GONext()
#define ALWAYS_GONextW() GONextW()
#define Op(Label,Type) case _##Label: { START_PREFETCH(Type)
#define OpW(Label,Type) case _##Label: { START_PREFETCH_W(Type)
#define BOp(Label,Type) case _##Label: {
#define PBOp(Label,Type) case _##Label: { INIT_PREFETCH()
#define OpRW(Label,Type) case _##Label: {
#endif // ABSMI_THREADED_H

201
H/absmi-threaded.h Normal file
View File

@ -0,0 +1,201 @@
/*************************************************************************
* *
* YAP Prolog *
* *
* Yap Prolog was developed at NCCUP - Universidade do Porto *
* *
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-1997 *
* *
**************************************************************************
* *
* File: absmi.c *
* Last rev: *
* mods: *
* comments: Portable abstract machine interpreter that support threaded
* execution. *
* *
*************************************************************************/
/**
* @file absmi-threaded.h
* @author VITOR SANTOS COSTA <vsc@VITORs-MacBook-Pro.local>
* @date Sun Aug 2 23:46:47 2015
*
* @brief This file implements the support for threaded execution of
* the YAP abstract machine emulator.
*
% Threaded emulators keep the address of the instruction as the opcode
% itself. This makes it faster to execute virtual instructions, but
% when grain-size is small it is easy to spend most of the instruction
% waiting for data.
%
* YAP includes several operations to support threaded emulation:
*
* - a header that defines the type of instruction;
*
* - a transition instruction that moves to the next operation;
*
* - get values well before they are needed; this is still
* useful for the opcode of the next instruction.
* -
*
*/
#ifndef ABSMI_THREADED_H
#define ABSMI_THREADED_H
#if USE_THREADED_CODE
#ifndef _NATIVE
#if YAP_JIT
#define DO_PREFETCH(TYPE) \
if (ExpEnv.config_struc.current_displacement) \
to_go = (void *) OpAddress[Yap_op_from_opcode(NEXTOP(PREG,TYPE)->opc) + ExpEnv.config_struc.current_displacement]; \
else \
to_go = (void *)(NEXTOP(PREG,TYPE)->opc);
#define DO_PREFETCH_W(TYPE) \
if (ExpEnv.config_struc.current_displacement) \
to_go = (void *)OpAddress[Yap_op_from_opcode(NEXTOP(PREG,TYPE)->y_u.o.opcw) + ExpEnv.config_struc.current_displacement]; \
else \
to_go = (void *)(NEXTOP(PREG,TYPE)->y_u.o.opcw);
#else /* YAP_JIT */
#define DO_PREFETCH(TYPE) to_go = (void *)(NEXTOP(PREG,TYPE)->opc)
#define DO_PREFETCH_W(TYPE) to_go = (void *)(NEXTOP(PREG,TYPE)->y_u.o.opcw)
#endif /* YAP_JIT */
#else /* _NATIVE */
#define DO_PREFETCH(TYPE)
#define DO_PREFETCH_W(TYPE)
#endif /* _NATIVE */
#ifndef _NATIVE
#if LIMITED_PREFETCH||USE_PREFETCH
#define ALWAYS_START_PREFETCH(TYPE) \
{ register void *to_go; DO_PREFETCH(TYPE)
#if YAP_JIT
#define ALWAYS_LOOKAHEAD(WHAT) \
{ \
register void *to_go; \
if (ExpEnv.config_struc.current_displacement) \
to_go = (void *) OpAddress[Yap_op_from_opcode(WHAT) + ExpEnv.config_struc.current_displacement]; \
else \
to_go = (void *)(WHAT);
#else /* YAP_JIT */
#define ALWAYS_LOOKAHEAD(WHAT) \
{ register void *to_go = (void *)(WHAT);
#endif /* YAP_JIT */
#define ALWAYS_START_PREFETCH_W(TYPE) \
{ register void *to_go; DO_PREFETCH_W(TYPE)
#else
#define ALWAYS_START_PREFETCH(TYPE) {
#define ALWAYS_START_PREFETCH_W(TYPE) {
#define ALWAYS_LOOKAHEAD(WHERE) {
#endif /* LIMITED_PREFETCH||USE_PREFETCH */
#else /* _NATIVE */
#if LIMITED_PREFETCH||USE_PREFETCH
#define ALWAYS_START_PREFETCH(TYPE)
#define ALWAYS_LOOKAHEAD(WHAT)
#define ALWAYS_START_PREFETCH_W(TYPE)
#else
#define ALWAYS_START_PREFETCH(TYPE)
#define ALWAYS_START_PREFETCH_W(TYPE)
#define ALWAYS_LOOKAHEAD(WHERE)
#endif /* LIMITED_PREFETCH||USE_PREFETCH */
#endif /* _NATIVE */
#ifndef _NATIVE
#ifdef USE_PREFETCH
#define START_PREFETCH(TYPE) ALWAYS_START_PREFETCH(TYPE)
#define START_PREFETCH_W(TYPE) ALWAYS_START_PREFETCH_W(TYPE)
#define INIT_PREFETCH() \
{ register void *to_go;
#define PREFETCH_OP(X) \
if (ExpEnv.config_struc.current_displacement) \
to_go = (void *) OpAddress[Yap_op_from_opcode((X)->opc) + ExpEnv.config_struc.current_displacement]; \
else \
to_go = (void *)((X)->opc);
#else
#define START_PREFETCH(TYPE) {
#define START_PREFETCH_W(TYPE) {
#define INIT_PREFETCH() {
#define PREFETCH_OP(X)
#endif /* USE_PREFETCH */
#else /* _NATIVE */
#ifdef USE_PREFETCH
#define START_PREFETCH(TYPE) ALWAYS_START_PREFETCH(TYPE)
#define START_PREFETCH_W(TYPE) ALWAYS_START_PREFETCH_W(TYPE)
#define INIT_PREFETCH()
#define PREFETCH_OP(X)
#else
#define START_PREFETCH(TYPE)
#define START_PREFETCH_W(TYPE)
#define INIT_PREFETCH()
#define PREFETCH_OP(X)
#endif /* USE_PREFETCH */
#endif /* _NATIVE */
/*****************************************************************
How to jump to the next abstract machine instruction
******************************************************************/
#endif // THREADED_CODE
#endif // ABSMI_THREADED_H

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