win64 support: encodings
This commit is contained in:
parent
5830eacfec
commit
65f1cb9741
@ -192,7 +192,7 @@ static int check_alarm_fail_int(int CONT USES_REGS) {
|
|||||||
|
|
||||||
static int stack_overflow(PredEntry *pe, CELL *env, yamop *cp,
|
static int stack_overflow(PredEntry *pe, CELL *env, yamop *cp,
|
||||||
arity_t nargs USES_REGS) {
|
arity_t nargs USES_REGS) {
|
||||||
if ((Int)(Unsigned(YREG) - Unsigned(HR)) < StackGap(PASS_REGS1) ||
|
if (Unsigned(YREG) - Unsigned(HR) < StackGap(PASS_REGS1) ||
|
||||||
Yap_get_signal(YAP_STOVF_SIGNAL)) {
|
Yap_get_signal(YAP_STOVF_SIGNAL)) {
|
||||||
S = (CELL *)pe;
|
S = (CELL *)pe;
|
||||||
if (!Yap_locked_gc(nargs, env, cp)) {
|
if (!Yap_locked_gc(nargs, env, cp)) {
|
||||||
|
@ -742,8 +742,7 @@ CreateStaticArray(AtomEntry *ae, size_t dim, static_array_types type, CODEADDR s
|
|||||||
p->ArrayType = type;
|
p->ArrayType = type;
|
||||||
p->TypeOfAE = STATIC_ARRAY;
|
p->TypeOfAE = STATIC_ARRAY;
|
||||||
if (start_addr == NULL) {
|
if (start_addr == NULL) {
|
||||||
Int i;
|
size_t i;
|
||||||
|
|
||||||
AllocateStaticArraySpace(p, type, NULL, dim PASS_REGS);
|
AllocateStaticArraySpace(p, type, NULL, dim PASS_REGS);
|
||||||
if (p->ValueOfVE.ints == NULL) {
|
if (p->ValueOfVE.ints == NULL) {
|
||||||
WRITE_UNLOCK(p->ArRWLock);
|
WRITE_UNLOCK(p->ArRWLock);
|
||||||
|
@ -2012,6 +2012,7 @@ X_API int YAP_InitConsult(int mode, const char *filename, int *osnop) {
|
|||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int sno;
|
int sno;
|
||||||
|
char full[FILENAME_MAX]
|
||||||
BACKUP_MACHINE_REGS();
|
BACKUP_MACHINE_REGS();
|
||||||
|
|
||||||
if (mode == YAP_BOOT_MODE) {
|
if (mode == YAP_BOOT_MODE) {
|
||||||
@ -2019,15 +2020,16 @@ X_API int YAP_InitConsult(int mode, const char *filename, int *osnop) {
|
|||||||
}
|
}
|
||||||
bool consulted = (mode == YAP_CONSULT_MODE);
|
bool consulted = (mode == YAP_CONSULT_MODE);
|
||||||
Yap_init_consult(consulted, filename);
|
Yap_init_consult(consulted, filename);
|
||||||
const char *full = Yap_AbsoluteFile(filename, true);
|
const char *fl = Yap_AbsoluteFile(filename, full, true);
|
||||||
if (!full)
|
if (!fl)
|
||||||
return -1;
|
return -1;
|
||||||
f = fopen(full, "r");
|
f = fopen(fl, "r");
|
||||||
if (!f)
|
if (!f)
|
||||||
return -1;
|
return -1;
|
||||||
else if (full != filename && full != LOCAL_FileNameBuf &&
|
else if (fl != filename && fl != full &&
|
||||||
full != LOCAL_FileNameBuf2)
|
fl != LOCAL_FileNameBuf &&
|
||||||
free((char *)full);
|
fl != LOCAL_FileNameBuf2)
|
||||||
|
free(fl);
|
||||||
sno = Yap_OpenStream(f, NULL, TermNil, Input_Stream_f);
|
sno = Yap_OpenStream(f, NULL, TermNil, Input_Stream_f);
|
||||||
*osnop = Yap_CheckAlias(AtomLoopStream);
|
*osnop = Yap_CheckAlias(AtomLoopStream);
|
||||||
if (!Yap_AddAlias(AtomLoopStream, sno)) {
|
if (!Yap_AddAlias(AtomLoopStream, sno)) {
|
||||||
@ -2036,14 +2038,15 @@ X_API int YAP_InitConsult(int mode, const char *filename, int *osnop) {
|
|||||||
}
|
}
|
||||||
GLOBAL_Stream[sno].name = Yap_LookupAtom(filename);
|
GLOBAL_Stream[sno].name = Yap_LookupAtom(filename);
|
||||||
GLOBAL_Stream[sno].user_name = MkAtomTerm(Yap_LookupAtom(filename));
|
GLOBAL_Stream[sno].user_name = MkAtomTerm(Yap_LookupAtom(filename));
|
||||||
|
GLOBAL_Stream[sno].encoding = ENC_ISO_LATIN1;
|
||||||
RECOVER_MACHINE_REGS();
|
RECOVER_MACHINE_REGS();
|
||||||
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
UNLOCK(GLOBAL_Stream[sno].streamlock);
|
||||||
return sno;
|
return sno;
|
||||||
}
|
}
|
||||||
|
|
||||||
X_API FILE *YAP_TermToStream(Term t) {
|
X_API FILE *YAP_TermToStream(Term t) {
|
||||||
FILE *s;
|
|
||||||
BACKUP_MACHINE_REGS();
|
BACKUP_MACHINE_REGS();
|
||||||
|
FILE *s;
|
||||||
|
|
||||||
if (IsVarTerm(t) || !IsAtomTerm(t))
|
if (IsVarTerm(t) || !IsAtomTerm(t))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1255,7 +1255,8 @@ static bool setInitialValue(bool bootstrap, flag_func f, const char *s,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
t0 = Yap_StringToTerm(s, strlen(s) + 1, &LOCAL_encoding, GLOBAL_MaxPriority,
|
encoding_t encoding = ENC_ISO_UTF8;
|
||||||
|
t0 = Yap_StringToTerm(s, strlen(s) + 1, &encoding, GLOBAL_MaxPriority,
|
||||||
NULL);
|
NULL);
|
||||||
if (!t0)
|
if (!t0)
|
||||||
return false;
|
return false;
|
||||||
@ -1552,7 +1553,7 @@ void Yap_InitFlags(bool bootstrap) {
|
|||||||
bool itf = setInitialValue(bootstrap, f->def, f->init,
|
bool itf = setInitialValue(bootstrap, f->def, f->init,
|
||||||
LOCAL_Flags + LOCAL_flagCount);
|
LOCAL_Flags + LOCAL_flagCount);
|
||||||
// Term itf = Yap_StringToTerm(f->init, strlen(f->init)+1,
|
// Term itf = Yap_StringToTerm(f->init, strlen(f->init)+1,
|
||||||
// LOCAL_encoding, GLOBAL_MaxPriority, &tp);
|
// EBC_ISO_UTF8, GLOBAL_MaxPriority, &tp);
|
||||||
if (itf) {
|
if (itf) {
|
||||||
initFlag(f, LOCAL_flagCount, false);
|
initFlag(f, LOCAL_flagCount, false);
|
||||||
}
|
}
|
||||||
|
112
C/parser.c
112
C/parser.c
@ -163,12 +163,12 @@ dot with single quotes.
|
|||||||
typedef struct jmp_buff_struct { sigjmp_buf JmpBuff; } JMPBUFF;
|
typedef struct jmp_buff_struct { sigjmp_buf JmpBuff; } JMPBUFF;
|
||||||
|
|
||||||
static void GNextToken(CACHE_TYPE1);
|
static void GNextToken(CACHE_TYPE1);
|
||||||
static void checkfor(wchar_t, JMPBUFF * CACHE_TYPE);
|
static void checkfor(wchar_t, JMPBUFF *, encoding_t CACHE_TYPE);
|
||||||
static Term ParseArgs(Atom, wchar_t, JMPBUFF *, Term, Term CACHE_TYPE);
|
static Term ParseArgs(Atom, wchar_t, JMPBUFF *, Term, encoding_t, Term CACHE_TYPE);
|
||||||
static Term ParseList(JMPBUFF *, Term CACHE_TYPE);
|
static Term ParseList(JMPBUFF *, encoding_t, Term CACHE_TYPE);
|
||||||
static Term ParseTerm(int, JMPBUFF *, Term CACHE_TYPE);
|
static Term ParseTerm(int, JMPBUFF *, encoding_t, Term CACHE_TYPE);
|
||||||
|
|
||||||
const char *Yap_tokRep(TokEntry *tokptr);
|
const char *Yap_tokRep(TokEntry *tokptr, encoding_t enc);
|
||||||
|
|
||||||
static void syntax_msg(const char *msg, ...) {
|
static void syntax_msg(const char *msg, ...) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
@ -367,7 +367,7 @@ Term Yap_Variables(VarEntry *p, Term l) {
|
|||||||
return Variables(p, l PASS_REGS);
|
return Variables(p, l PASS_REGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int IsPrefixOp(Atom op, int *pptr, int *rpptr, Term cmod USES_REGS) {
|
static int IsPrefixOp(Atom op, int *pptr, int *rpptr, encoding_t enc, Term cmod USES_REGS) {
|
||||||
int p;
|
int p;
|
||||||
|
|
||||||
OpEntry *opp = Yap_GetOpProp(op, PREFIX_OP, cmod PASS_REGS);
|
OpEntry *opp = Yap_GetOpProp(op, PREFIX_OP, cmod PASS_REGS);
|
||||||
@ -391,10 +391,10 @@ static int IsPrefixOp(Atom op, int *pptr, int *rpptr, Term cmod USES_REGS) {
|
|||||||
|
|
||||||
int Yap_IsPrefixOp(Atom op, int *pptr, int *rpptr) {
|
int Yap_IsPrefixOp(Atom op, int *pptr, int *rpptr) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
return IsPrefixOp(op, pptr, rpptr, CurrentModule PASS_REGS);
|
return IsPrefixOp(op, pptr, rpptr, LOCAL_encoding, CurrentModule PASS_REGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int IsInfixOp(Atom op, int *pptr, int *lpptr, int *rpptr, Term cmod USES_REGS) {
|
static int IsInfixOp(Atom op, int *pptr, int *lpptr, int *rpptr, encoding_t enc, Term cmod USES_REGS) {
|
||||||
int p;
|
int p;
|
||||||
|
|
||||||
OpEntry *opp = Yap_GetOpProp(op, INFIX_OP, cmod PASS_REGS);
|
OpEntry *opp = Yap_GetOpProp(op, INFIX_OP, cmod PASS_REGS);
|
||||||
@ -420,10 +420,10 @@ static int IsInfixOp(Atom op, int *pptr, int *lpptr, int *rpptr, Term cmod USES_
|
|||||||
|
|
||||||
int Yap_IsInfixOp(Atom op, int *pptr, int *lpptr, int *rpptr) {
|
int Yap_IsInfixOp(Atom op, int *pptr, int *lpptr, int *rpptr) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
return IsInfixOp(op, pptr, lpptr, rpptr, CurrentModule PASS_REGS);
|
return IsInfixOp(op, pptr, lpptr, rpptr, CurrentModule, LOCAL_encoding PASS_REGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int IsPosfixOp(Atom op, int *pptr, int *lpptr, Term cmod USES_REGS) {
|
static int IsPosfixOp(Atom op, int *pptr, int *lpptr, encoding_t enc, Term cmod USES_REGS) {
|
||||||
int p;
|
int p;
|
||||||
|
|
||||||
OpEntry *opp = Yap_GetOpProp(op, POSFIX_OP, cmod PASS_REGS);
|
OpEntry *opp = Yap_GetOpProp(op, POSFIX_OP, cmod PASS_REGS);
|
||||||
@ -447,7 +447,7 @@ static int IsPosfixOp(Atom op, int *pptr, int *lpptr, Term cmod USES_REGS) {
|
|||||||
|
|
||||||
int Yap_IsPosfixOp(Atom op, int *pptr, int *lpptr) {
|
int Yap_IsPosfixOp(Atom op, int *pptr, int *lpptr) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
return IsPosfixOp(op, pptr, lpptr, CurrentModule PASS_REGS);
|
return IsPosfixOp(op, pptr, lpptr, CurrentModule, LOCAL_encoding PASS_REGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static void GNextToken(USES_REGS1) {
|
inline static void GNextToken(USES_REGS1) {
|
||||||
@ -459,11 +459,11 @@ inline static void GNextToken(USES_REGS1) {
|
|||||||
LOCAL_tokptr = LOCAL_tokptr->TokNext;
|
LOCAL_tokptr = LOCAL_tokptr->TokNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static void checkfor(wchar_t c, JMPBUFF *FailBuff USES_REGS) {
|
inline static void checkfor(wchar_t c, JMPBUFF *FailBuff, encoding_t enc USES_REGS) {
|
||||||
if (LOCAL_tokptr->Tok != Ord(Ponctuation_tok) ||
|
if (LOCAL_tokptr->Tok != Ord(Ponctuation_tok) ||
|
||||||
LOCAL_tokptr->TokInfo != (Term)c) {
|
LOCAL_tokptr->TokInfo != (Term)c) {
|
||||||
char s[1024];
|
char s[1024];
|
||||||
strncpy(s, Yap_tokRep(LOCAL_tokptr), 1023);
|
strncpy(s, Yap_tokRep(LOCAL_tokptr, enc), 1023);
|
||||||
syntax_msg("line %d: expected to find \'%c\', found %s", LOCAL_tokptr->TokPos, c, s);
|
syntax_msg("line %d: expected to find \'%c\', found %s", LOCAL_tokptr->TokPos, c, s);
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
@ -472,7 +472,7 @@ inline static void checkfor(wchar_t c, JMPBUFF *FailBuff USES_REGS) {
|
|||||||
|
|
||||||
#ifdef O_QUASIQUOTATIONS
|
#ifdef O_QUASIQUOTATIONS
|
||||||
|
|
||||||
static int is_quasi_quotation_syntax(Term goal, Atom *pat, Term cmod) {
|
static int is_quasi_quotation_syntax(Term goal, Atom *pat, encoding_t enc, Term cmod) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
Term m = cmod, t;
|
Term m = cmod, t;
|
||||||
Atom at;
|
Atom at;
|
||||||
@ -525,7 +525,7 @@ static int get_quasi_quotation(term_t t, unsigned char **here,
|
|||||||
#endif /*O_QUASIQUOTATIONS*/
|
#endif /*O_QUASIQUOTATIONS*/
|
||||||
|
|
||||||
static Term ParseArgs(Atom a, wchar_t close, JMPBUFF *FailBuff,
|
static Term ParseArgs(Atom a, wchar_t close, JMPBUFF *FailBuff,
|
||||||
Term arg1, Term cmod USES_REGS) {
|
Term arg1, encoding_t enc, Term cmod USES_REGS) {
|
||||||
int nargs = 0;
|
int nargs = 0;
|
||||||
Term *p, t;
|
Term *p, t;
|
||||||
Functor func;
|
Functor func;
|
||||||
@ -562,7 +562,7 @@ static Term ParseArgs(Atom a, wchar_t close, JMPBUFF *FailBuff,
|
|||||||
syntax_msg("line %d: Trail Overflow",LOCAL_tokptr->TokPos);
|
syntax_msg("line %d: Trail Overflow",LOCAL_tokptr->TokPos);
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
*tp++ = Unsigned(ParseTerm(999, FailBuff, cmod PASS_REGS));
|
*tp++ = Unsigned(ParseTerm(999, FailBuff, enc,cmod PASS_REGS));
|
||||||
ParserAuxSp = (char *)tp;
|
ParserAuxSp = (char *)tp;
|
||||||
++nargs;
|
++nargs;
|
||||||
if (LOCAL_tokptr->Tok != Ord(Ponctuation_tok))
|
if (LOCAL_tokptr->Tok != Ord(Ponctuation_tok))
|
||||||
@ -601,7 +601,7 @@ static Term ParseArgs(Atom a, wchar_t close, JMPBUFF *FailBuff,
|
|||||||
return TermNil;
|
return TermNil;
|
||||||
}
|
}
|
||||||
/* check for possible overflow against local stack */
|
/* check for possible overflow against local stack */
|
||||||
checkfor(close, FailBuff PASS_REGS);
|
checkfor(close, FailBuff, enc PASS_REGS);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,14 +617,14 @@ static Term MakeAccessor(Term t, Functor f USES_REGS) {
|
|||||||
return Yap_MkApplTerm(f, 2, tf);
|
return Yap_MkApplTerm(f, 2, tf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Term ParseList(JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
static Term ParseList(JMPBUFF *FailBuff, encoding_t enc, Term cmod USES_REGS) {
|
||||||
Term o;
|
Term o;
|
||||||
CELL *to_store;
|
CELL *to_store;
|
||||||
o = AbsPair(HR);
|
o = AbsPair(HR);
|
||||||
loop:
|
loop:
|
||||||
to_store = HR;
|
to_store = HR;
|
||||||
HR += 2;
|
HR += 2;
|
||||||
to_store[0] = ParseTerm(999, FailBuff, cmod PASS_REGS);
|
to_store[0] = ParseTerm(999, FailBuff, enc, cmod PASS_REGS);
|
||||||
if (LOCAL_tokptr->Tok == Ord(Ponctuation_tok)) {
|
if (LOCAL_tokptr->Tok == Ord(Ponctuation_tok)) {
|
||||||
if (((int)LOCAL_tokptr->TokInfo) == ',') {
|
if (((int)LOCAL_tokptr->TokInfo) == ',') {
|
||||||
NextToken;
|
NextToken;
|
||||||
@ -641,19 +641,19 @@ loop:
|
|||||||
}
|
}
|
||||||
} else if (((int)LOCAL_tokptr->TokInfo) == '|') {
|
} else if (((int)LOCAL_tokptr->TokInfo) == '|') {
|
||||||
NextToken;
|
NextToken;
|
||||||
to_store[1] = ParseTerm(999, FailBuff, cmod PASS_REGS);
|
to_store[1] = ParseTerm(999, FailBuff, enc, cmod PASS_REGS);
|
||||||
} else {
|
} else {
|
||||||
to_store[1] = MkAtomTerm(AtomNil);
|
to_store[1] = MkAtomTerm(AtomNil);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
syntax_msg("line %d: looking for symbol ',','|' got symbol '%s'",LOCAL_tokptr->TokPos,
|
syntax_msg("line %d: looking for symbol ',','|' got symbol '%s'",LOCAL_tokptr->TokPos,
|
||||||
Yap_tokRep(LOCAL_tokptr));
|
Yap_tokRep(LOCAL_tokptr, enc));
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
return (o);
|
return (o);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
static Term ParseTerm(int prio, JMPBUFF *FailBuff, encoding_t enc, Term cmod USES_REGS) {
|
||||||
/* parse term with priority prio */
|
/* parse term with priority prio */
|
||||||
Volatile Term t;
|
Volatile Term t;
|
||||||
Volatile Functor func;
|
Volatile Functor func;
|
||||||
@ -686,7 +686,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
|||||||
}
|
}
|
||||||
if ((LOCAL_tokptr->Tok != Ord(Ponctuation_tok) ||
|
if ((LOCAL_tokptr->Tok != Ord(Ponctuation_tok) ||
|
||||||
Unsigned(LOCAL_tokptr->TokInfo) != 'l') &&
|
Unsigned(LOCAL_tokptr->TokInfo) != 'l') &&
|
||||||
IsPrefixOp((Atom)t, &opprio, &oprprio, cmod PASS_REGS)) {
|
IsPrefixOp((Atom)t, &opprio, &oprprio, enc, cmod PASS_REGS)) {
|
||||||
if (LOCAL_tokptr->Tok == Name_tok) {
|
if (LOCAL_tokptr->Tok == Name_tok) {
|
||||||
Atom at = (Atom)LOCAL_tokptr->TokInfo;
|
Atom at = (Atom)LOCAL_tokptr->TokInfo;
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
@ -721,7 +721,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
|||||||
syntax_msg("line %d: Heap Overflow",LOCAL_tokptr->TokPos);
|
syntax_msg("line %d: Heap Overflow",LOCAL_tokptr->TokPos);
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
t = ParseTerm(oprprio, FailBuff, cmod PASS_REGS);
|
t = ParseTerm(oprprio, FailBuff, enc, cmod PASS_REGS);
|
||||||
t = Yap_MkApplTerm(func, 1, &t);
|
t = Yap_MkApplTerm(func, 1, &t);
|
||||||
/* check for possible overflow against local stack */
|
/* check for possible overflow against local stack */
|
||||||
if (HR > ASP - 4096) {
|
if (HR > ASP - 4096) {
|
||||||
@ -733,7 +733,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
|||||||
}
|
}
|
||||||
if (LOCAL_tokptr->Tok == Ord(Ponctuation_tok) &&
|
if (LOCAL_tokptr->Tok == Ord(Ponctuation_tok) &&
|
||||||
Unsigned(LOCAL_tokptr->TokInfo) == 'l')
|
Unsigned(LOCAL_tokptr->TokInfo) == 'l')
|
||||||
t = ParseArgs((Atom)t, ')', FailBuff, 0L, cmod PASS_REGS);
|
t = ParseArgs((Atom)t, ')', FailBuff, 0L, enc, cmod PASS_REGS);
|
||||||
else
|
else
|
||||||
t = MkAtomTerm((Atom)t);
|
t = MkAtomTerm((Atom)t);
|
||||||
break;
|
break;
|
||||||
@ -749,7 +749,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
|||||||
// we may be operating under a syntax error
|
// we may be operating under a syntax error
|
||||||
yap_error_number oerr = LOCAL_Error_TYPE;
|
yap_error_number oerr = LOCAL_Error_TYPE;
|
||||||
LOCAL_Error_TYPE = YAP_NO_ERROR;
|
LOCAL_Error_TYPE = YAP_NO_ERROR;
|
||||||
t = Yap_CharsToTDQ(p, cmod, LOCAL_encoding PASS_REGS);
|
t = Yap_CharsToTDQ(p, cmod, enc PASS_REGS);
|
||||||
if (!t) {
|
if (!t) {
|
||||||
syntax_msg("line %d: could not convert \"%s\"",LOCAL_tokptr->TokPos, (char *)LOCAL_tokptr->TokInfo);
|
syntax_msg("line %d: could not convert \"%s\"",LOCAL_tokptr->TokPos, (char *)LOCAL_tokptr->TokInfo);
|
||||||
FAIL;
|
FAIL;
|
||||||
@ -813,7 +813,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Error_tok:
|
case Error_tok:
|
||||||
syntax_msg("line %d: found ill-formed \"%s\"",LOCAL_tokptr->TokPos, Yap_tokRep(LOCAL_tokptr));
|
syntax_msg("line %d: found ill-formed \"%s\"",LOCAL_tokptr->TokPos, Yap_tokRep(LOCAL_tokptr, enc));
|
||||||
FAIL;
|
FAIL;
|
||||||
|
|
||||||
case Ponctuation_tok:
|
case Ponctuation_tok:
|
||||||
@ -822,8 +822,8 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
|||||||
case '(':
|
case '(':
|
||||||
case 'l': /* non solo ( */
|
case 'l': /* non solo ( */
|
||||||
NextToken;
|
NextToken;
|
||||||
t = ParseTerm(GLOBAL_MaxPriority, FailBuff, cmod PASS_REGS);
|
t = ParseTerm(GLOBAL_MaxPriority, FailBuff, enc, cmod PASS_REGS);
|
||||||
checkfor(')', FailBuff PASS_REGS);
|
checkfor(')', FailBuff, enc PASS_REGS);
|
||||||
break;
|
break;
|
||||||
case '[':
|
case '[':
|
||||||
NextToken;
|
NextToken;
|
||||||
@ -833,8 +833,8 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
|||||||
NextToken;
|
NextToken;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
t = ParseList(FailBuff, cmod PASS_REGS);
|
t = ParseList(FailBuff, enc, cmod PASS_REGS);
|
||||||
checkfor(']', FailBuff PASS_REGS);
|
checkfor(']', FailBuff, enc PASS_REGS);
|
||||||
break;
|
break;
|
||||||
case '{':
|
case '{':
|
||||||
NextToken;
|
NextToken;
|
||||||
@ -844,17 +844,17 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
|||||||
NextToken;
|
NextToken;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
t = ParseTerm(GLOBAL_MaxPriority, FailBuff, cmod PASS_REGS);
|
t = ParseTerm(GLOBAL_MaxPriority, FailBuff, enc, cmod PASS_REGS);
|
||||||
t = Yap_MkApplTerm(FunctorBraces, 1, &t);
|
t = Yap_MkApplTerm(FunctorBraces, 1, &t);
|
||||||
/* check for possible overflow against local stack */
|
/* check for possible overflow against local stack */
|
||||||
if (HR > ASP - 4096) {
|
if (HR > ASP - 4096) {
|
||||||
syntax_msg("line %d: Stack Overflow",LOCAL_tokptr->TokPos);
|
syntax_msg("line %d: Stack Overflow",LOCAL_tokptr->TokPos);
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
checkfor('}', FailBuff PASS_REGS);
|
checkfor('}', FailBuff, enc PASS_REGS);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
syntax_msg("line %d: unexpected ponctuation signal %s",LOCAL_tokptr->TokPos, Yap_tokRep(LOCAL_tokptr));
|
syntax_msg("line %d: unexpected ponctuation signal %s",LOCAL_tokptr->TokPos, Yap_tokRep(LOCAL_tokptr, enc));
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -896,15 +896,15 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
NextToken;
|
NextToken;
|
||||||
t = ParseTerm(GLOBAL_MaxPriority, FailBuff, cmod PASS_REGS);
|
t = ParseTerm(GLOBAL_MaxPriority, FailBuff, enc, cmod PASS_REGS);
|
||||||
if (LOCAL_tokptr->Tok != QuasiQuotes_tok) {
|
if (LOCAL_tokptr->Tok != QuasiQuotes_tok) {
|
||||||
syntax_msg("expected to find quasi quotes, got \"%s\"", ,
|
syntax_msg("expected to find quasi quotes, got \"%s\"", ,
|
||||||
Yap_tokRep(LOCAL_tokptr));
|
Yap_tokRep(LOCAL_tokptr, enc));
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
if (!(is_quasi_quotation_syntax(t, &at))) {
|
if (!(is_quasi_quotation_syntax(t, &at))) {
|
||||||
syntax_msg("bad quasi quotation syntax, at \"%s\"",
|
syntax_msg("bad quasi quotation syntax, at \"%s\"",
|
||||||
Yap_tokRep(LOCAL_tokptr));
|
Yap_tokRep(LOCAL_tokptr, enc));
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
/* Arg 2: the content */
|
/* Arg 2: the content */
|
||||||
@ -914,7 +914,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
|||||||
if (!get_quasi_quotation(Yap_InitSlot(ArgOfTerm(2, tn)), &qq->text,
|
if (!get_quasi_quotation(Yap_InitSlot(ArgOfTerm(2, tn)), &qq->text,
|
||||||
qq->text + strlen((const char *)qq->text))) {
|
qq->text + strlen((const char *)qq->text))) {
|
||||||
syntax_msg("could not get quasi quotation, at \"%s\"",
|
syntax_msg("could not get quasi quotation, at \"%s\"",
|
||||||
Yap_tokRep(LOCAL_tokptr));
|
Yap_tokRep(LOCAL_tokptr, enc));
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
if (positions) {
|
if (positions) {
|
||||||
@ -926,7 +926,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
|||||||
qq->mid.charno + 2, /* end of | token */
|
qq->mid.charno + 2, /* end of | token */
|
||||||
PL_INTPTR, qqend - 2)) /* end minus "|}" */
|
PL_INTPTR, qqend - 2)) /* end minus "|}" */
|
||||||
syntax_msg("failed to unify quasi quotation, at \"%s\"",
|
syntax_msg("failed to unify quasi quotation, at \"%s\"",
|
||||||
Yap_tokRep(LOCAL_tokptr));
|
Yap_tokRep(LOCAL_tokptr, enc));
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -937,7 +937,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
|||||||
!PL_unify_list(LOCAL_qq_tail, to, LOCAL_qq_tail) ||
|
!PL_unify_list(LOCAL_qq_tail, to, LOCAL_qq_tail) ||
|
||||||
!PL_unify(to, Yap_InitSlot(tn))) {
|
!PL_unify(to, Yap_InitSlot(tn))) {
|
||||||
syntax_msg("failed to unify quasi quotation, at \"%s\"",
|
syntax_msg("failed to unify quasi quotation, at \"%s\"",
|
||||||
Yap_tokRep(LOCAL_tokptr));
|
Yap_tokRep(LOCAL_tokptr, enc));
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -945,7 +945,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
|||||||
NextToken;
|
NextToken;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
syntax_msg("line %d: expected operator, got \'%s\'",LOCAL_tokptr->TokPos, Yap_tokRep(LOCAL_tokptr));
|
syntax_msg("line %d: expected operator, got \'%s\'",LOCAL_tokptr->TokPos, Yap_tokRep(LOCAL_tokptr, enc));
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -954,7 +954,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
|||||||
if (LOCAL_tokptr->Tok == Ord(Name_tok) &&
|
if (LOCAL_tokptr->Tok == Ord(Name_tok) &&
|
||||||
Yap_HasOp((Atom)(LOCAL_tokptr->TokInfo))) {
|
Yap_HasOp((Atom)(LOCAL_tokptr->TokInfo))) {
|
||||||
Atom save_opinfo = opinfo = (Atom)(LOCAL_tokptr->TokInfo);
|
Atom save_opinfo = opinfo = (Atom)(LOCAL_tokptr->TokInfo);
|
||||||
if (IsInfixOp(save_opinfo, &opprio, &oplprio, &oprprio, cmod PASS_REGS) &&
|
if (IsInfixOp(save_opinfo, &opprio, &oplprio, &oprprio, enc, cmod PASS_REGS) &&
|
||||||
opprio <= prio && oplprio >= curprio) {
|
opprio <= prio && oplprio >= curprio) {
|
||||||
/* try parsing as infix operator */
|
/* try parsing as infix operator */
|
||||||
Volatile int oldprio = curprio;
|
Volatile int oldprio = curprio;
|
||||||
@ -967,7 +967,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
|||||||
{
|
{
|
||||||
Term args[2];
|
Term args[2];
|
||||||
args[0] = t;
|
args[0] = t;
|
||||||
args[1] = ParseTerm(oprprio, FailBuff, cmod PASS_REGS);
|
args[1] = ParseTerm(oprprio, FailBuff,enc, cmod PASS_REGS);
|
||||||
t = Yap_MkApplTerm(func, 2, args);
|
t = Yap_MkApplTerm(func, 2, args);
|
||||||
/* check for possible overflow against local stack */
|
/* check for possible overflow against local stack */
|
||||||
if (HR > ASP - 4096) {
|
if (HR > ASP - 4096) {
|
||||||
@ -979,7 +979,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
|||||||
opinfo = save_opinfo; continue;, opinfo = save_opinfo;
|
opinfo = save_opinfo; continue;, opinfo = save_opinfo;
|
||||||
curprio = oldprio;)
|
curprio = oldprio;)
|
||||||
}
|
}
|
||||||
if (IsPosfixOp(opinfo, &opprio, &oplprio, cmod PASS_REGS) && opprio <= prio &&
|
if (IsPosfixOp(opinfo, &opprio, &oplprio, enc, cmod PASS_REGS) && opprio <= prio &&
|
||||||
oplprio >= curprio) {
|
oplprio >= curprio) {
|
||||||
/* parse as posfix operator */
|
/* parse as posfix operator */
|
||||||
Functor func = Yap_MkFunctor((Atom)LOCAL_tokptr->TokInfo, 1);
|
Functor func = Yap_MkFunctor((Atom)LOCAL_tokptr->TokInfo, 1);
|
||||||
@ -1005,7 +1005,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
|||||||
Volatile Term args[2];
|
Volatile Term args[2];
|
||||||
NextToken;
|
NextToken;
|
||||||
args[0] = t;
|
args[0] = t;
|
||||||
args[1] = ParseTerm(1000, FailBuff, cmod PASS_REGS);
|
args[1] = ParseTerm(1000, FailBuff, enc, cmod PASS_REGS);
|
||||||
t = Yap_MkApplTerm(FunctorComma, 2, args);
|
t = Yap_MkApplTerm(FunctorComma, 2, args);
|
||||||
/* check for possible overflow against local stack */
|
/* check for possible overflow against local stack */
|
||||||
if (HR > ASP - 4096) {
|
if (HR > ASP - 4096) {
|
||||||
@ -1015,12 +1015,12 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
|||||||
curprio = 1000;
|
curprio = 1000;
|
||||||
continue;
|
continue;
|
||||||
} else if (Unsigned(LOCAL_tokptr->TokInfo) == '|' &&
|
} else if (Unsigned(LOCAL_tokptr->TokInfo) == '|' &&
|
||||||
IsInfixOp(AtomVBar, &opprio, &oplprio, &oprprio, cmod PASS_REGS) &&
|
IsInfixOp(AtomVBar, &opprio, &oplprio, &oprprio, enc, cmod PASS_REGS) &&
|
||||||
opprio <= prio && oplprio >= curprio) {
|
opprio <= prio && oplprio >= curprio) {
|
||||||
Volatile Term args[2];
|
Volatile Term args[2];
|
||||||
NextToken;
|
NextToken;
|
||||||
args[0] = t;
|
args[0] = t;
|
||||||
args[1] = ParseTerm(oprprio, FailBuff, cmod PASS_REGS);
|
args[1] = ParseTerm(oprprio, FailBuff, enc, cmod PASS_REGS);
|
||||||
t = Yap_MkApplTerm(FunctorVBar, 2, args);
|
t = Yap_MkApplTerm(FunctorVBar, 2, args);
|
||||||
/* check for possible overflow against local stack */
|
/* check for possible overflow against local stack */
|
||||||
if (HR > ASP - 4096) {
|
if (HR > ASP - 4096) {
|
||||||
@ -1030,31 +1030,31 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
|||||||
curprio = opprio;
|
curprio = opprio;
|
||||||
continue;
|
continue;
|
||||||
} else if (Unsigned(LOCAL_tokptr->TokInfo) == '(' &&
|
} else if (Unsigned(LOCAL_tokptr->TokInfo) == '(' &&
|
||||||
IsPosfixOp(AtomEmptyBrackets, &opprio, &oplprio, cmod PASS_REGS) &&
|
IsPosfixOp(AtomEmptyBrackets, &opprio, &oplprio, enc, cmod PASS_REGS) &&
|
||||||
opprio <= prio && oplprio >= curprio) {
|
opprio <= prio && oplprio >= curprio) {
|
||||||
t = ParseArgs(AtomEmptyBrackets, ')', FailBuff, t, cmod PASS_REGS);
|
t = ParseArgs(AtomEmptyBrackets, ')', FailBuff, t, enc, cmod PASS_REGS);
|
||||||
curprio = opprio;
|
curprio = opprio;
|
||||||
continue;
|
continue;
|
||||||
} else if (Unsigned(LOCAL_tokptr->TokInfo) == '[' &&
|
} else if (Unsigned(LOCAL_tokptr->TokInfo) == '[' &&
|
||||||
IsPosfixOp(AtomEmptySquareBrackets, &opprio,
|
IsPosfixOp(AtomEmptySquareBrackets, &opprio,
|
||||||
&oplprio, cmod PASS_REGS) &&
|
&oplprio, enc, cmod PASS_REGS) &&
|
||||||
opprio <= prio && oplprio >= curprio) {
|
opprio <= prio && oplprio >= curprio) {
|
||||||
t = ParseArgs(AtomEmptySquareBrackets, ']', FailBuff, t, cmod PASS_REGS);
|
t = ParseArgs(AtomEmptySquareBrackets, ']', FailBuff, t, enc, cmod PASS_REGS);
|
||||||
t = MakeAccessor(t, FunctorEmptySquareBrackets PASS_REGS);
|
t = MakeAccessor(t, FunctorEmptySquareBrackets PASS_REGS);
|
||||||
curprio = opprio;
|
curprio = opprio;
|
||||||
continue;
|
continue;
|
||||||
} else if (Unsigned(LOCAL_tokptr->TokInfo) == '{' &&
|
} else if (Unsigned(LOCAL_tokptr->TokInfo) == '{' &&
|
||||||
IsPosfixOp(AtomEmptyCurlyBrackets, &opprio,
|
IsPosfixOp(AtomEmptyCurlyBrackets, &opprio,
|
||||||
&oplprio, cmod PASS_REGS) &&
|
&oplprio, enc, cmod PASS_REGS) &&
|
||||||
opprio <= prio && oplprio >= curprio) {
|
opprio <= prio && oplprio >= curprio) {
|
||||||
t = ParseArgs(AtomEmptyCurlyBrackets, '}', FailBuff, t, cmod PASS_REGS);
|
t = ParseArgs(AtomEmptyCurlyBrackets, '}', FailBuff, t, enc, cmod PASS_REGS);
|
||||||
t = MakeAccessor(t, FunctorEmptyCurlyBrackets PASS_REGS);
|
t = MakeAccessor(t, FunctorEmptyCurlyBrackets PASS_REGS);
|
||||||
curprio = opprio;
|
curprio = opprio;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (LOCAL_tokptr->Tok <= Ord(WString_tok)) {
|
if (LOCAL_tokptr->Tok <= Ord(WString_tok)) {
|
||||||
syntax_msg("line %d: expected operator, got \'%s\'",LOCAL_tokptr->TokPos, Yap_tokRep(LOCAL_tokptr));
|
syntax_msg("line %d: expected operator, got \'%s\'",LOCAL_tokptr->TokPos, Yap_tokRep(LOCAL_tokptr, enc));
|
||||||
FAIL;
|
FAIL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1062,7 +1062,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff, Term cmod USES_REGS) {
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
Term Yap_Parse(UInt prio, Term cmod) {
|
Term Yap_Parse(UInt prio, encoding_t enc, Term cmod) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
Volatile Term t;
|
Volatile Term t;
|
||||||
JMPBUFF FailBuff;
|
JMPBUFF FailBuff;
|
||||||
@ -1070,7 +1070,7 @@ Term Yap_Parse(UInt prio, Term cmod) {
|
|||||||
|
|
||||||
if (!sigsetjmp(FailBuff.JmpBuff, 0)) {
|
if (!sigsetjmp(FailBuff.JmpBuff, 0)) {
|
||||||
|
|
||||||
t = ParseTerm(prio, &FailBuff, cmod PASS_REGS);
|
t = ParseTerm(prio, &FailBuff, enc, cmod PASS_REGS);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (GLOBAL_Option['p' - 'a' + 1]) {
|
if (GLOBAL_Option['p' - 'a' + 1]) {
|
||||||
Yap_DebugPutc(stderr, '[');
|
Yap_DebugPutc(stderr, '[');
|
||||||
|
@ -1226,7 +1226,7 @@ Term Yap_scan_num(StreamDesc *inp) {
|
|||||||
return l; \
|
return l; \
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *Yap_tokRep(TokEntry *tokptr) {
|
const char *Yap_tokRep(TokEntry *tokptr, encoding_t encoding) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
Term info = tokptr->TokInfo;
|
Term info = tokptr->TokInfo;
|
||||||
char *b, *buf = LOCAL_FileNameBuf2;
|
char *b, *buf = LOCAL_FileNameBuf2;
|
||||||
@ -1242,7 +1242,7 @@ const char *Yap_tokRep(TokEntry *tokptr) {
|
|||||||
}
|
}
|
||||||
return RepAtom((Atom)info)->StrOfAE;
|
return RepAtom((Atom)info)->StrOfAE;
|
||||||
case Number_tok:
|
case Number_tok:
|
||||||
if ((b = Yap_TermToString(info, buf, sze, &length, &LOCAL_encoding,
|
if ((b = Yap_TermToString(info, buf, sze, &length, &encoding,
|
||||||
flags)) != buf) {
|
flags)) != buf) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -2054,7 +2054,7 @@ TokEntry *Yap_tokenizer(struct stream_desc *inp_stream, bool store_comments,
|
|||||||
}
|
}
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (GLOBAL_Option[2])
|
if (GLOBAL_Option[2])
|
||||||
fprintf(stderr, "[Token %d %s]", Ord(kind), Yap_tokRep(t));
|
fprintf(stderr, "[Token %d %s]", Ord(kind), Yap_tokRep(t, inp_stream->encoding));
|
||||||
#endif
|
#endif
|
||||||
if (LOCAL_ErrorMessage) {
|
if (LOCAL_ErrorMessage) {
|
||||||
/* insert an error token to inform the system of what happened */
|
/* insert an error token to inform the system of what happened */
|
||||||
|
29
C/text.c
29
C/text.c
@ -1442,18 +1442,26 @@ er.
|
|||||||
* @return the buffer, or NULL in case of failure. If so, Yap_Error may be called.
|
* @return the buffer, or NULL in case of failure. If so, Yap_Error may be called.
|
||||||
*/
|
*/
|
||||||
const char *
|
const char *
|
||||||
Yap_TextTermToText(Term t, char *buf, size_t len)
|
Yap_TextTermToText(Term t, char *buf, size_t len, encoding_t enc)
|
||||||
{ CACHE_REGS
|
{
|
||||||
|
CACHE_REGS
|
||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
encoding_t enc = LOCAL_encoding;
|
|
||||||
|
|
||||||
inp.val.t = t;
|
inp.val.t = t;
|
||||||
if (IsAtomTerm(t))
|
if (IsAtomTerm(t)) {
|
||||||
inp.type = YAP_STRING_ATOM;
|
inp.type = YAP_STRING_ATOM;
|
||||||
else if (IsStringTerm(t))
|
if (IsWideAtom(AtomOfTerm(t)))
|
||||||
|
inp.enc = ENC_WCHAR;
|
||||||
|
else
|
||||||
|
inp.enc = ENC_ISO_LATIN1;
|
||||||
|
}
|
||||||
|
else if (IsStringTerm(t)) {
|
||||||
inp.type = YAP_STRING_STRING;
|
inp.type = YAP_STRING_STRING;
|
||||||
else if (IsPairTerm(t) )
|
inp.enc = ENC_ISO_UTF8;
|
||||||
inp.type = (YAP_STRING_CODES|YAP_STRING_ATOMS);
|
}
|
||||||
|
else if (IsPairTerm(t)) {
|
||||||
|
inp.type = (YAP_STRING_CODES | YAP_STRING_ATOMS);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
Yap_Error(TYPE_ERROR_TEXT, t, NULL);
|
Yap_Error(TYPE_ERROR_TEXT, t, NULL);
|
||||||
return false;
|
return false;
|
||||||
@ -1479,15 +1487,14 @@ Yap_TextTermToText(Term t, char *buf, size_t len)
|
|||||||
*
|
*
|
||||||
* @return the term
|
* @return the term
|
||||||
*/
|
*/
|
||||||
Term Yap_MkTextTerm(const char *s,
|
Term Yap_MkTextTerm(const char *s, encoding_t enc, Term tguide ) {
|
||||||
Term tguide ) {
|
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
if (IsAtomTerm(tguide))
|
if (IsAtomTerm(tguide))
|
||||||
return MkAtomTerm(Yap_LookupAtom(s));
|
return MkAtomTerm(Yap_LookupAtom(s));
|
||||||
if (IsStringTerm(tguide))
|
if (IsStringTerm(tguide))
|
||||||
return MkStringTerm(s);
|
return MkStringTerm(s);
|
||||||
if (IsPairTerm(tguide) && IsAtomTerm(HeadOfTerm(tguide))) {
|
if (IsPairTerm(tguide) && IsAtomTerm(HeadOfTerm(tguide))) {
|
||||||
return Yap_CharsToListOfAtoms( s, LOCAL_encoding PASS_REGS );
|
return Yap_CharsToListOfAtoms( s, enc PASS_REGS );
|
||||||
}
|
}
|
||||||
return Yap_CharsToListOfCodes( s, LOCAL_encoding PASS_REGS );
|
return Yap_CharsToListOfCodes( s, enc PASS_REGS );
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ ENDIF (NOT MSVC)
|
|||||||
set_target_properties(libYap
|
set_target_properties(libYap
|
||||||
PROPERTIES VERSION ${YAP_FULL_VERSION}
|
PROPERTIES VERSION ${YAP_FULL_VERSION}
|
||||||
SOVERSION ${YAP_MAJOR_VERSION}.${YAP_MINOR_VERSION}
|
SOVERSION ${YAP_MAJOR_VERSION}.${YAP_MINOR_VERSION}
|
||||||
OUTPUT_NAME Yap
|
OUTPUT_NAME libYap
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -442,8 +442,10 @@ add_subDIRECTORY (os)
|
|||||||
#bootstrap and saved state
|
#bootstrap and saved state
|
||||||
add_subDIRECTORY (pl)
|
add_subDIRECTORY (pl)
|
||||||
|
|
||||||
|
IF (NOT MSVC)
|
||||||
#C++ interface
|
#C++ interface
|
||||||
add_subDIRECTORY (CXX)
|
add_subDIRECTORY (CXX)
|
||||||
|
ENDIF(NOT MSVC)
|
||||||
|
|
||||||
ADD_SUBDIRECTORY(library)
|
ADD_SUBDIRECTORY(library)
|
||||||
ADD_SUBDIRECTORY(swi/library)
|
ADD_SUBDIRECTORY(swi/library)
|
||||||
@ -471,6 +473,7 @@ add_subDIRECTORY (packages/ProbLog)
|
|||||||
|
|
||||||
add_subDIRECTORY (packages/swi-minisat2)
|
add_subDIRECTORY (packages/swi-minisat2)
|
||||||
|
|
||||||
|
IF (NOT MSVC)
|
||||||
OPTION (WITH_CLPBN " Enable the CLPBN and PFL probabilistic languages" ON)
|
OPTION (WITH_CLPBN " Enable the CLPBN and PFL probabilistic languages" ON)
|
||||||
|
|
||||||
OPTION (WITH_CPLINT " Enable the cplint probabilistic language" ON)
|
OPTION (WITH_CPLINT " Enable the cplint probabilistic language" ON)
|
||||||
@ -484,6 +487,7 @@ ENDIF()
|
|||||||
IF (WITH_CPLINT)
|
IF (WITH_CPLINT)
|
||||||
add_subDIRECTORY (packages/cplint)
|
add_subDIRECTORY (packages/cplint)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
ENDIF(NOT MSVC)
|
||||||
|
|
||||||
add_subDIRECTORY (packages/raptor)
|
add_subDIRECTORY (packages/raptor)
|
||||||
|
|
||||||
|
15
CXX/yapi.cpp
15
CXX/yapi.cpp
@ -8,13 +8,13 @@ extern "C" {
|
|||||||
#include "YapInterface.h"
|
#include "YapInterface.h"
|
||||||
#include "blobs.h"
|
#include "blobs.h"
|
||||||
|
|
||||||
char *Yap_TermToString(Term t, char *s, size_t sz, size_t *length,
|
X_API char *Yap_TermToString(Term t, char *s, size_t sz, size_t *length,
|
||||||
encoding_t *encodingp, int flags);
|
encoding_t *encodingp, int flags);
|
||||||
|
|
||||||
void YAP_UserCPredicate(const char *, YAP_UserCPred, YAP_Arity arity);
|
X_API void YAP_UserCPredicate(const char *, YAP_UserCPred, YAP_Arity arity);
|
||||||
void YAP_UserCPredicateWithArgs(const char *, YAP_UserCPred, YAP_Arity,
|
X_API void YAP_UserCPredicateWithArgs(const char *, YAP_UserCPred, YAP_Arity,
|
||||||
YAP_Term);
|
YAP_Term);
|
||||||
void YAP_UserBackCPredicate(const char *, YAP_UserCPred, YAP_UserCPred,
|
X_API void YAP_UserBackCPredicate(const char *, YAP_UserCPred, YAP_UserCPred,
|
||||||
YAP_Arity, YAP_Arity);
|
YAP_Arity, YAP_Arity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -595,7 +595,12 @@ YAPEngine::YAPEngine(char *savedState, size_t stackSize, size_t trailSize,
|
|||||||
init_args.YapPrologBootFile = bootFile;
|
init_args.YapPrologBootFile = bootFile;
|
||||||
init_args.YapPrologGoal = goal;
|
init_args.YapPrologGoal = goal;
|
||||||
init_args.YapPrologTopLevelGoal = topLevel;
|
init_args.YapPrologTopLevelGoal = topLevel;
|
||||||
init_args.HaltAfterConsult = script;
|
init_args.HaltAfter
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
= script;
|
||||||
init_args.FastBoot = fastBoot;
|
init_args.FastBoot = fastBoot;
|
||||||
yerror = YAPError();
|
yerror = YAPError();
|
||||||
delYAPCallback();
|
delYAPCallback();
|
||||||
|
10
CXX/yapi.hh
10
CXX/yapi.hh
@ -61,22 +61,22 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if _MSC_VER || defined(__MINGW32__)
|
#if _MSC_VER || defined(__MINGW32__)
|
||||||
#include <windows.h>
|
//#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// taken from yap_structs.h
|
// taken from yap_structs.h
|
||||||
#include "iopreds.h"
|
#include "iopreds.h"
|
||||||
|
|
||||||
extern void YAP_UserCPredicate(const char *, YAP_UserCPred, YAP_Arity arity);
|
X_API void YAP_UserCPredicate(const char *, YAP_UserCPred, YAP_Arity arity);
|
||||||
|
|
||||||
/* void UserCPredicateWithArgs(const char *name, int *fn(), unsigned int arity) */
|
/* void UserCPredicateWithArgs(const char *name, int *fn(), unsigned int arity) */
|
||||||
extern void YAP_UserCPredicateWithArgs(const char *, YAP_UserCPred, YAP_Arity, YAP_Term);
|
X_API void YAP_UserCPredicateWithArgs(const char *, YAP_UserCPred, YAP_Arity, YAP_Term);
|
||||||
|
|
||||||
/* void UserBackCPredicate(const char *name, int *init(), int *cont(), int
|
/* void UserBackCPredicate(const char *name, int *init(), int *cont(), int
|
||||||
arity, int extra) */
|
arity, int extra) */
|
||||||
extern void YAP_UserBackCPredicate(const char *, YAP_UserCPred, YAP_UserCPred, YAP_Arity, YAP_Arity);
|
X_API void YAP_UserBackCPredicate(const char *, YAP_UserCPred, YAP_UserCPred, YAP_Arity, YAP_Arity);
|
||||||
|
|
||||||
extern Term Yap_StringToTerm(const char *s, size_t len, encoding_t *encp, int prio, Term *bindings_p);
|
X_API Term Yap_StringToTerm(const char *s, size_t len, encoding_t *encp, int prio, Term *bindings_p);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
class YAPAtomTerm;
|
class YAPAtomTerm;
|
||||||
|
|
||||||
extern "C" Term YAP_ReadBuffer(const char *s, Term *tp);
|
extern "C" Term X_API YAP_ReadBuffer(const char *s, Term *tp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Generic Prolog Term
|
* @brief Generic Prolog Term
|
||||||
|
@ -338,10 +338,7 @@ INLINE_ONLY inline EXTERN int IsStringTerm(Term t) {
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
#define OCXX __cplusplus
|
#include <gmpxx.h>
|
||||||
#undef __cplusplus
|
|
||||||
#include <gmp.h>
|
|
||||||
#define __cplusplus OCXX
|
|
||||||
#elif !defined(__GMP_H__)
|
#elif !defined(__GMP_H__)
|
||||||
#include <gmp.h>
|
#include <gmp.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -345,7 +345,8 @@ static inline Term getBackQuotesFlag(void) {
|
|||||||
return GLOBAL_Flags[BACKQUOTED_STRING_FLAG].at;
|
return GLOBAL_Flags[BACKQUOTED_STRING_FLAG].at;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int indexingMode(void) { return GLOBAL_Flags[INDEX_FLAG].at; }
|
static inline Term
|
||||||
|
indexingMode(void) { return GLOBAL_Flags[INDEX_FLAG].at; }
|
||||||
|
|
||||||
static inline const char *floatFormat(void) {
|
static inline const char *floatFormat(void) {
|
||||||
return RepAtom(AtomOfTerm(GLOBAL_Flags[FLOAT_FORMAT_FLAG].at))->rep.uStrOfAE;
|
return RepAtom(AtomOfTerm(GLOBAL_Flags[FLOAT_FORMAT_FLAG].at))->rep.uStrOfAE;
|
||||||
|
@ -192,7 +192,7 @@ INLINE_ONLY inline EXTERN void ensure_slots(int N USES_REGS) {
|
|||||||
(inc + LOCAL_NHandles) * sizeof(CELL));
|
(inc + LOCAL_NHandles) * sizeof(CELL));
|
||||||
LOCAL_NHandles += inc;
|
LOCAL_NHandles += inc;
|
||||||
if (!LOCAL_HandleBase) {
|
if (!LOCAL_HandleBase) {
|
||||||
unsigned long int kneeds = ((inc + LOCAL_NHandles) * sizeof(CELL)) / 1024;
|
size_t kneeds = ((inc + LOCAL_NHandles) * sizeof(CELL)) / 1024;
|
||||||
Yap_Error(
|
Yap_Error(
|
||||||
SYSTEM_ERROR_INTERNAL, 0 /* TermNil */,
|
SYSTEM_ERROR_INTERNAL, 0 /* TermNil */,
|
||||||
"Out of memory for the term handles (term_t) aka slots, l needed",
|
"Out of memory for the term handles (term_t) aka slots, l needed",
|
||||||
|
@ -269,7 +269,7 @@ inline static int cmpn_utf8(const utf8proc_uint8_t *pt1,
|
|||||||
#define LEAD_OFFSET ((uint32_t)0xD800 - (uint32_t)(0x10000 >> 10))
|
#define LEAD_OFFSET ((uint32_t)0xD800 - (uint32_t)(0x10000 >> 10))
|
||||||
#define SURROGATE_OFFSET ( (uint32_t)0x10000 - (uint32_t)(0xD800 << 10) - (uint32_t)0xDC00 )
|
#define SURROGATE_OFFSET ( (uint32_t)0x10000 - (uint32_t)(0xD800 << 10) - (uint32_t)0xDC00 )
|
||||||
|
|
||||||
const char *Yap_tokRep(TokEntry *tokptr);
|
const char *Yap_tokRep(TokEntry *tokptr, encoding_t enc);
|
||||||
|
|
||||||
// standard strings
|
// standard strings
|
||||||
|
|
||||||
@ -1433,3 +1433,6 @@ static inline Term Yap_SubtractTailString(Term t1, Term th USES_REGS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif // ≈YAP_TEXT_H
|
#endif // ≈YAP_TEXT_H
|
||||||
|
|
||||||
|
const char *Yap_TextTermToText(Term t, char *buf, size_t len, encoding_t enc);
|
||||||
|
Term Yap_MkTextTerm(const char *s, encoding_t e, Term tguide);
|
||||||
|
@ -423,12 +423,10 @@ double Yap_random(void);
|
|||||||
char *Yap_RegistryGetString(char *);
|
char *Yap_RegistryGetString(char *);
|
||||||
void Yap_WinError(char *);
|
void Yap_WinError(char *);
|
||||||
#endif
|
#endif
|
||||||
const char *Yap_TextTermToText(Term t, char *buf, size_t len);
|
|
||||||
Term Yap_MkTextTerm(const char *s, Term tguide );
|
|
||||||
|
|
||||||
typedef enum { YAP_STD, YAP_SAVED_STATE, YAP_OBJ, YAP_PL, YAP_QLY } file_type_t;
|
typedef enum { YAP_STD, YAP_SAVED_STATE, YAP_OBJ, YAP_PL, YAP_QLY } file_type_t;
|
||||||
|
|
||||||
const char *Yap_AbsoluteFile(const char *spec, bool ok);
|
const char *Yap_AbsoluteFile(const char *spec, char *obuf, bool ok);
|
||||||
const char *Yap_AbsoluteFileInBuffer(const char *spec, char *outp, size_t sz, bool ok);
|
const char *Yap_AbsoluteFileInBuffer(const char *spec, char *outp, size_t sz, bool ok);
|
||||||
const char *Yap_findFile(const char *isource, const char *idef, const char *root,
|
const char *Yap_findFile(const char *isource, const char *idef, const char *root,
|
||||||
char *result, bool access, file_type_t ftype,
|
char *result, bool access, file_type_t ftype,
|
||||||
|
73
H/Yatom.h
73
H/Yatom.h
@ -237,22 +237,22 @@ INLINE_ONLY inline EXTERN Prop AbsWideAtomProp(WideAtomEntry *p) {
|
|||||||
|
|
||||||
#define WideAtomProperty ((PropFlags)0xfff8)
|
#define WideAtomProperty ((PropFlags)0xfff8)
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN PropFlags IsWideAtomProperty(int);
|
INLINE_ONLY inline EXTERN bool IsWideAtomProperty(PropFlags);
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN PropFlags IsWideAtomProperty(int flags) {
|
INLINE_ONLY inline EXTERN bool IsWideAtomProperty(PropFlags flags) {
|
||||||
return (PropFlags)((flags == WideAtomProperty));
|
return (flags == WideAtomProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN int IsWideAtom(Atom);
|
INLINE_ONLY inline EXTERN bool IsWideAtom(Atom);
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN int IsWideAtom(Atom at) {
|
INLINE_ONLY inline EXTERN bool IsWideAtom(Atom at) {
|
||||||
return RepAtom(at)->PropsOfAE &&
|
return RepAtom(at)->PropsOfAE != NIL &&
|
||||||
IsWideAtomProperty(RepWideAtomProp(RepAtom(at)->PropsOfAE)->KindOfPE);
|
IsWideAtomProperty(RepWideAtomProp(RepAtom(at)->PropsOfAE)->KindOfPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Module property */
|
/* Module property */
|
||||||
typedef struct mod_entry {
|
typedef struct mod_entry {
|
||||||
Prop NextOfPE; /* used to chain properties */
|
Prop NextOfPE; /** chain of atom properties */
|
||||||
PropFlags KindOfPE; /* kind of property */
|
PropFlags KindOfPE; /* kind of property */
|
||||||
struct pred_entry *PredForME; /* index in module table */
|
struct pred_entry *PredForME; /* index in module table */
|
||||||
Atom AtomOfME; /* module's name */
|
Atom AtomOfME; /* module's name */
|
||||||
@ -296,10 +296,10 @@ INLINE_ONLY inline EXTERN Prop AbsModProp(ModEntry *p) { return (Prop)(p); }
|
|||||||
|
|
||||||
#define ModProperty ((PropFlags)0xfffa)
|
#define ModProperty ((PropFlags)0xfffa)
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN PropFlags IsModProperty(int);
|
INLINE_ONLY inline EXTERN bool IsModProperty(int);
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN PropFlags IsModProperty(int flags) {
|
INLINE_ONLY inline EXTERN bool IsModProperty(int flags) {
|
||||||
return (PropFlags)((flags == ModProperty));
|
return flags == ModProperty;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flags on module. Most of these flags are copied to the read context
|
/* Flags on module. Most of these flags are copied to the read context
|
||||||
@ -369,10 +369,10 @@ INLINE_ONLY inline EXTERN Prop AbsOpProp(OpEntry *p) { return (Prop)(p); }
|
|||||||
#endif
|
#endif
|
||||||
#define OpProperty ((PropFlags)0xffff)
|
#define OpProperty ((PropFlags)0xffff)
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN PropFlags IsOpProperty(int);
|
INLINE_ONLY inline EXTERN bool IsOpProperty(PropFlags);
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN PropFlags IsOpProperty(int flags) {
|
INLINE_ONLY inline EXTERN bool IsOpProperty(PropFlags flags) {
|
||||||
return (PropFlags)((flags == OpProperty));
|
return flags == OpProperty;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef enum { INFIX_OP = 0, POSFIX_OP = 1, PREFIX_OP = 2 } op_type;
|
typedef enum { INFIX_OP = 0, POSFIX_OP = 1, PREFIX_OP = 2 } op_type;
|
||||||
@ -1025,10 +1025,10 @@ static inline TranslationEntry *Yap_GetTranslationProp(Atom at, arity_t arity) {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN PropFlags IsTranslationProperty(int);
|
INLINE_ONLY inline EXTERN bool IsTranslationProperty(PropFlags);
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN PropFlags IsTranslationProperty(int flags) {
|
INLINE_ONLY inline EXTERN bool IsTranslationProperty(PropFlags flags) {
|
||||||
return (PropFlags)((flags == TranslationProperty));
|
return flags == TranslationProperty;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** handle named mutexes */
|
/*** handle named mutexes */
|
||||||
@ -1087,9 +1087,9 @@ static inline void *Yap_GetMutexFromProp(Atom at) {
|
|||||||
return p->Mutex;
|
return p->Mutex;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN PropFlags IsMutexProperty(int);
|
INLINE_ONLY inline EXTERN bool IsMutexProperty(PropFlags);
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN PropFlags IsMutexProperty(int flags) {
|
INLINE_ONLY inline EXTERN bool IsMutexProperty(PropFlags flags) {
|
||||||
return (PropFlags)((flags == MutexProperty));
|
return (PropFlags)((flags == MutexProperty));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1205,16 +1205,16 @@ INLINE_ONLY inline EXTERN Prop AbsStaticArrayProp(StaticArrayEntry *p) {
|
|||||||
#endif
|
#endif
|
||||||
#define ArrayProperty ((PropFlags)0xfff7)
|
#define ArrayProperty ((PropFlags)0xfff7)
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN int ArrayIsDynamic(ArrayEntry *);
|
INLINE_ONLY inline EXTERN bool ArrayIsDynamic(ArrayEntry *);
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN int ArrayIsDynamic(ArrayEntry *are) {
|
INLINE_ONLY inline EXTERN bool ArrayIsDynamic(ArrayEntry *are) {
|
||||||
return (int)(((are)->TypeOfAE & DYNAMIC_ARRAY));
|
return ((are)->TypeOfAE & DYNAMIC_ARRAY) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN PropFlags IsArrayProperty(int);
|
INLINE_ONLY inline EXTERN bool IsArrayProperty(PropFlags);
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN PropFlags IsArrayProperty(int flags) {
|
INLINE_ONLY inline EXTERN bool IsArrayProperty(PropFlags flags) {
|
||||||
return (PropFlags)((flags == ArrayProperty));
|
return flags == ArrayProperty;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SWI Blob property */
|
/* SWI Blob property */
|
||||||
@ -1256,23 +1256,23 @@ INLINE_ONLY inline EXTERN Prop AbsBlobProp(YAP_BlobPropEntry *p) {
|
|||||||
|
|
||||||
#define BlobProperty ((PropFlags)0xfffe)
|
#define BlobProperty ((PropFlags)0xfffe)
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN PropFlags IsBlobProperty(int);
|
INLINE_ONLY inline EXTERN bool IsBlobProperty(PropFlags);
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN PropFlags IsBlobProperty(int flags) {
|
INLINE_ONLY inline EXTERN bool IsBlobProperty(PropFlags flags) {
|
||||||
return (PropFlags)((flags == BlobProperty));
|
return flags == BlobProperty;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN int IsBlob(Atom);
|
INLINE_ONLY inline EXTERN bool IsBlob(Atom);
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN int IsBlob(Atom at) {
|
INLINE_ONLY inline EXTERN bool IsBlob(Atom at) {
|
||||||
return RepAtom(at)->PropsOfAE &&
|
return RepAtom(at)->PropsOfAE != NIL &&
|
||||||
IsBlobProperty(RepBlobProp(RepAtom(at)->PropsOfAE)->KindOfPE);
|
IsBlobProperty(RepBlobProp(RepAtom(at)->PropsOfAE)->KindOfPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN PropFlags IsValProperty(int);
|
INLINE_ONLY inline EXTERN bool IsValProperty(PropFlags);
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN PropFlags IsValProperty(int flags) {
|
INLINE_ONLY inline EXTERN bool IsValProperty(PropFlags flags) {
|
||||||
return (PropFlags)((flags == ValProperty));
|
return flags == ValProperty;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* flag property entry structure */
|
/* flag property entry structure */
|
||||||
@ -1318,10 +1318,11 @@ INLINE_ONLY inline EXTERN Prop AbsFlagProp(FlagEntry *p) { return (Prop)(p); }
|
|||||||
#endif
|
#endif
|
||||||
#define FlagProperty ((PropFlags)0xfff9)
|
#define FlagProperty ((PropFlags)0xfff9)
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN PropFlags IsFlagProperty(int);
|
INLINE_ONLY inline EXTERN bool IsFlagProperty(PropFlags);
|
||||||
|
|
||||||
|
INLINE_ONLY inline EXTERN bool IsFlagProperty(PropFlags flags) {
|
||||||
|
return flags == FlagProperty;
|
||||||
|
|
||||||
INLINE_ONLY inline EXTERN PropFlags IsFlagProperty(int flags) {
|
|
||||||
return (PropFlags)((flags == FlagProperty));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Proto types */
|
/* Proto types */
|
||||||
|
@ -1036,7 +1036,7 @@ CELL *ENV_Parent(CELL *env)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline
|
static inline
|
||||||
UInt ENV_Size(yamop *cp)
|
Int ENV_Size(yamop *cp)
|
||||||
{
|
{
|
||||||
return (((yamop *)((CODEADDR)(cp) - (CELL)NEXTOP((yamop *)NULL,Osbpp)))->y_u.Osbpp.s);
|
return (((yamop *)((CODEADDR)(cp) - (CELL)NEXTOP((yamop *)NULL,Osbpp)))->y_u.Osbpp.s);
|
||||||
}
|
}
|
||||||
|
@ -294,7 +294,7 @@ extern void Yap_WakeUp(CELL *v);
|
|||||||
#define Bind_NonAtt(A,D) { *(A) = (D); TRAIL(A,D); }
|
#define Bind_NonAtt(A,D) { *(A) = (D); TRAIL(A,D); }
|
||||||
#define Bind_Global_NonAtt(A,D) { *(A) = (D); TRAIL_GLOBAL(A,D); }
|
#define Bind_Global_NonAtt(A,D) { *(A) = (D); TRAIL_GLOBAL(A,D); }
|
||||||
#define Bind_and_Trail(A,D) { *(A) = (D); DO_TRAIL(A, D); }
|
#define Bind_and_Trail(A,D) { *(A) = (D); DO_TRAIL(A, D); }
|
||||||
#define Bind(A,D) YapBind(A,D)
|
// #define Bind(A,D) YapBind(A,D) conflicts with Windows headers
|
||||||
|
|
||||||
#define MaBind(VP,D) { MATRAIL((VP),*(VP),(D)); *(VP) = (D); }
|
#define MaBind(VP,D) { MATRAIL((VP),*(VP),(D)); *(VP) = (D); }
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@
|
|||||||
GONext()
|
GONext()
|
||||||
|
|
||||||
#define copy_aux_stack() \
|
#define copy_aux_stack() \
|
||||||
{ int size = 3 + heap_arity + subs_arity + vars_arity; \
|
{ arity_t size = 3 + heap_arity + subs_arity + vars_arity; \
|
||||||
TOP_STACK -= size; \
|
TOP_STACK -= size; \
|
||||||
memcpy(TOP_STACK, aux_stack, size * sizeof(CELL *)); \
|
memcpy(TOP_STACK, aux_stack, size * sizeof(CELL *)); \
|
||||||
aux_stack = TOP_STACK; \
|
aux_stack = TOP_STACK; \
|
||||||
@ -251,7 +251,7 @@
|
|||||||
TOP_STACK[HEAP_ARITY_ENTRY] = func_arity; \
|
TOP_STACK[HEAP_ARITY_ENTRY] = func_arity; \
|
||||||
} \
|
} \
|
||||||
*HR = (CELL) func; \
|
*HR = (CELL) func; \
|
||||||
{ int i; \
|
{ arity_t i; \
|
||||||
for (i = 1; i <= func_arity; i++) \
|
for (i = 1; i <= func_arity; i++) \
|
||||||
TOP_STACK[HEAP_ENTRY(i)] = (CELL) (HR + i); \
|
TOP_STACK[HEAP_ENTRY(i)] = (CELL) (HR + i); \
|
||||||
} \
|
} \
|
||||||
@ -273,7 +273,7 @@
|
|||||||
Bind_Global(HR, AbsAppl(HR + 2)); \
|
Bind_Global(HR, AbsAppl(HR + 2)); \
|
||||||
HR += 2; \
|
HR += 2; \
|
||||||
*HR = (CELL) func; \
|
*HR = (CELL) func; \
|
||||||
{ int i; \
|
{ arity_t i; \
|
||||||
for (i = 1; i <= func_arity; i++) \
|
for (i = 1; i <= func_arity; i++) \
|
||||||
TOP_STACK[HEAP_ENTRY(i)] = (CELL) (HR + i); \
|
TOP_STACK[HEAP_ENTRY(i)] = (CELL) (HR + i); \
|
||||||
} \
|
} \
|
||||||
@ -288,7 +288,7 @@
|
|||||||
|
|
||||||
#define aux_stack_var_instr() \
|
#define aux_stack_var_instr() \
|
||||||
if (heap_arity) { \
|
if (heap_arity) { \
|
||||||
int i; \
|
arity_t i; \
|
||||||
CELL var = aux_stack[HEAP_ENTRY(1)]; \
|
CELL var = aux_stack[HEAP_ENTRY(1)]; \
|
||||||
RESET_VARIABLE(var); \
|
RESET_VARIABLE(var); \
|
||||||
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity - 1; \
|
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity - 1; \
|
||||||
@ -309,7 +309,7 @@
|
|||||||
|
|
||||||
#define aux_stack_var_in_pair_instr() \
|
#define aux_stack_var_in_pair_instr() \
|
||||||
if (heap_arity) { \
|
if (heap_arity) { \
|
||||||
int i; \
|
arity_t i; \
|
||||||
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsPair(HR)); \
|
Bind_Global((CELL *) aux_stack[HEAP_ENTRY(1)], AbsPair(HR)); \
|
||||||
TOP_STACK = &aux_stack[-1]; \
|
TOP_STACK = &aux_stack[-1]; \
|
||||||
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity; \
|
TOP_STACK[HEAP_ARITY_ENTRY] = heap_arity; \
|
||||||
@ -411,9 +411,9 @@
|
|||||||
PBOp(trie_do_var, e)
|
PBOp(trie_do_var, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
aux_stack_var_instr();
|
aux_stack_var_instr();
|
||||||
ENDPBOp();
|
ENDPBOp();
|
||||||
@ -422,9 +422,9 @@
|
|||||||
PBOp(trie_trust_var, e)
|
PBOp(trie_trust_var, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
pop_trie_node();
|
pop_trie_node();
|
||||||
aux_stack_var_instr();
|
aux_stack_var_instr();
|
||||||
@ -434,9 +434,9 @@
|
|||||||
PBOp(trie_try_var, e)
|
PBOp(trie_try_var, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
store_trie_node(TrNode_next(node));
|
store_trie_node(TrNode_next(node));
|
||||||
aux_stack_var_instr();
|
aux_stack_var_instr();
|
||||||
@ -446,9 +446,9 @@
|
|||||||
PBOp(trie_retry_var, e)
|
PBOp(trie_retry_var, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
restore_trie_node(TrNode_next(node));
|
restore_trie_node(TrNode_next(node));
|
||||||
aux_stack_var_instr();
|
aux_stack_var_instr();
|
||||||
@ -459,9 +459,9 @@
|
|||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
aux_stack_var_in_pair_instr();
|
aux_stack_var_in_pair_instr();
|
||||||
#else
|
#else
|
||||||
@ -474,9 +474,9 @@
|
|||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
pop_trie_node();
|
pop_trie_node();
|
||||||
aux_stack_var_in_pair_instr();
|
aux_stack_var_in_pair_instr();
|
||||||
@ -490,9 +490,9 @@
|
|||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
store_trie_node(TrNode_next(node));
|
store_trie_node(TrNode_next(node));
|
||||||
aux_stack_var_in_pair_instr();
|
aux_stack_var_in_pair_instr();
|
||||||
@ -506,9 +506,9 @@
|
|||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
restore_trie_node(TrNode_next(node));
|
restore_trie_node(TrNode_next(node));
|
||||||
aux_stack_var_in_pair_instr();
|
aux_stack_var_in_pair_instr();
|
||||||
@ -521,9 +521,9 @@
|
|||||||
PBOp(trie_do_val, e)
|
PBOp(trie_do_val, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
||||||
|
|
||||||
aux_stack_val_instr();
|
aux_stack_val_instr();
|
||||||
@ -533,9 +533,9 @@
|
|||||||
PBOp(trie_trust_val, e)
|
PBOp(trie_trust_val, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
||||||
|
|
||||||
pop_trie_node();
|
pop_trie_node();
|
||||||
@ -546,9 +546,9 @@
|
|||||||
PBOp(trie_try_val, e)
|
PBOp(trie_try_val, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
||||||
|
|
||||||
store_trie_node(TrNode_next(node));
|
store_trie_node(TrNode_next(node));
|
||||||
@ -559,9 +559,9 @@
|
|||||||
PBOp(trie_retry_val, e)
|
PBOp(trie_retry_val, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
||||||
|
|
||||||
restore_trie_node(TrNode_next(node));
|
restore_trie_node(TrNode_next(node));
|
||||||
@ -573,9 +573,9 @@
|
|||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
||||||
|
|
||||||
aux_stack_val_in_pair_instr();
|
aux_stack_val_in_pair_instr();
|
||||||
@ -589,9 +589,9 @@
|
|||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
||||||
|
|
||||||
pop_trie_node();
|
pop_trie_node();
|
||||||
@ -606,9 +606,9 @@
|
|||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
||||||
|
|
||||||
store_trie_node(TrNode_next(node));
|
store_trie_node(TrNode_next(node));
|
||||||
@ -623,9 +623,9 @@
|
|||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
int var_index = VarIndexOfTableTerm(TrNode_entry(node));
|
||||||
|
|
||||||
restore_trie_node(TrNode_next(node));
|
restore_trie_node(TrNode_next(node));
|
||||||
@ -639,9 +639,9 @@
|
|||||||
PBOp(trie_do_atom, e)
|
PBOp(trie_do_atom, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
Term t = TrNode_entry(node);
|
Term t = TrNode_entry(node);
|
||||||
|
|
||||||
aux_stack_term_instr();
|
aux_stack_term_instr();
|
||||||
@ -651,9 +651,9 @@
|
|||||||
PBOp(trie_trust_atom, e)
|
PBOp(trie_trust_atom, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
Term t = TrNode_entry(node);
|
Term t = TrNode_entry(node);
|
||||||
|
|
||||||
pop_trie_node();
|
pop_trie_node();
|
||||||
@ -664,9 +664,9 @@
|
|||||||
PBOp(trie_try_atom, e)
|
PBOp(trie_try_atom, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
Term t = TrNode_entry(node);
|
Term t = TrNode_entry(node);
|
||||||
|
|
||||||
store_trie_node(TrNode_next(node));
|
store_trie_node(TrNode_next(node));
|
||||||
@ -677,9 +677,9 @@
|
|||||||
PBOp(trie_retry_atom, e)
|
PBOp(trie_retry_atom, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
Term t = TrNode_entry(node);
|
Term t = TrNode_entry(node);
|
||||||
|
|
||||||
restore_trie_node(TrNode_next(node));
|
restore_trie_node(TrNode_next(node));
|
||||||
@ -691,9 +691,9 @@
|
|||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
aux_stack_term_in_pair_instr();
|
aux_stack_term_in_pair_instr();
|
||||||
#else
|
#else
|
||||||
@ -706,9 +706,9 @@
|
|||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
pop_trie_node();
|
pop_trie_node();
|
||||||
aux_stack_term_in_pair_instr();
|
aux_stack_term_in_pair_instr();
|
||||||
@ -722,9 +722,9 @@
|
|||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
store_trie_node(TrNode_next(node));
|
store_trie_node(TrNode_next(node));
|
||||||
aux_stack_term_in_pair_instr();
|
aux_stack_term_in_pair_instr();
|
||||||
@ -738,9 +738,9 @@
|
|||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
restore_trie_node(TrNode_next(node));
|
restore_trie_node(TrNode_next(node));
|
||||||
aux_stack_term_in_pair_instr();
|
aux_stack_term_in_pair_instr();
|
||||||
@ -760,9 +760,9 @@
|
|||||||
PBOp(trie_trust_null, e)
|
PBOp(trie_trust_null, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
pop_trie_node();
|
pop_trie_node();
|
||||||
aux_stack_null_instr();
|
aux_stack_null_instr();
|
||||||
@ -772,9 +772,9 @@
|
|||||||
PBOp(trie_try_null, e)
|
PBOp(trie_try_null, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
store_trie_node(TrNode_next(node));
|
store_trie_node(TrNode_next(node));
|
||||||
aux_stack_null_instr();
|
aux_stack_null_instr();
|
||||||
@ -784,9 +784,9 @@
|
|||||||
PBOp(trie_retry_null, e)
|
PBOp(trie_retry_null, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
restore_trie_node(TrNode_next(node));
|
restore_trie_node(TrNode_next(node));
|
||||||
aux_stack_null_instr();
|
aux_stack_null_instr();
|
||||||
@ -797,9 +797,9 @@
|
|||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
aux_stack_new_pair_instr();
|
aux_stack_new_pair_instr();
|
||||||
#else
|
#else
|
||||||
@ -812,9 +812,9 @@
|
|||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
pop_trie_node();
|
pop_trie_node();
|
||||||
aux_stack_new_pair_instr();
|
aux_stack_new_pair_instr();
|
||||||
@ -828,9 +828,9 @@
|
|||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
store_trie_node(TrNode_next(node));
|
store_trie_node(TrNode_next(node));
|
||||||
aux_stack_new_pair_instr();
|
aux_stack_new_pair_instr();
|
||||||
@ -844,9 +844,9 @@
|
|||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
restore_trie_node(TrNode_next(node));
|
restore_trie_node(TrNode_next(node));
|
||||||
aux_stack_new_pair_instr();
|
aux_stack_new_pair_instr();
|
||||||
@ -859,9 +859,9 @@
|
|||||||
PBOp(trie_do_pair, e)
|
PBOp(trie_do_pair, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
aux_stack_pair_instr();
|
aux_stack_pair_instr();
|
||||||
ENDPBOp();
|
ENDPBOp();
|
||||||
@ -870,9 +870,9 @@
|
|||||||
PBOp(trie_trust_pair, e)
|
PBOp(trie_trust_pair, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
pop_trie_node();
|
pop_trie_node();
|
||||||
aux_stack_pair_instr();
|
aux_stack_pair_instr();
|
||||||
@ -882,9 +882,9 @@
|
|||||||
PBOp(trie_try_pair, e)
|
PBOp(trie_try_pair, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
store_trie_node(TrNode_next(node));
|
store_trie_node(TrNode_next(node));
|
||||||
aux_stack_pair_instr();
|
aux_stack_pair_instr();
|
||||||
@ -894,9 +894,9 @@
|
|||||||
PBOp(trie_retry_pair, e)
|
PBOp(trie_retry_pair, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
restore_trie_node(TrNode_next(node));
|
restore_trie_node(TrNode_next(node));
|
||||||
aux_stack_pair_instr();
|
aux_stack_pair_instr();
|
||||||
@ -906,11 +906,11 @@
|
|||||||
PBOp(trie_do_appl, e)
|
PBOp(trie_do_appl, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
||||||
int func_arity = ArityOfFunctor(func);
|
arity_t func_arity = ArityOfFunctor(func);
|
||||||
|
|
||||||
aux_stack_appl_instr();
|
aux_stack_appl_instr();
|
||||||
ENDPBOp();
|
ENDPBOp();
|
||||||
@ -919,11 +919,11 @@
|
|||||||
PBOp(trie_trust_appl, e)
|
PBOp(trie_trust_appl, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
||||||
int func_arity = ArityOfFunctor(func);
|
arity_t func_arity = ArityOfFunctor(func);
|
||||||
|
|
||||||
pop_trie_node();
|
pop_trie_node();
|
||||||
aux_stack_appl_instr();
|
aux_stack_appl_instr();
|
||||||
@ -933,11 +933,11 @@
|
|||||||
PBOp(trie_try_appl, e)
|
PBOp(trie_try_appl, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
||||||
int func_arity = ArityOfFunctor(func);
|
arity_t func_arity = ArityOfFunctor(func);
|
||||||
|
|
||||||
store_trie_node(TrNode_next(node));
|
store_trie_node(TrNode_next(node));
|
||||||
aux_stack_appl_instr();
|
aux_stack_appl_instr();
|
||||||
@ -947,11 +947,11 @@
|
|||||||
PBOp(trie_retry_appl, e)
|
PBOp(trie_retry_appl, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
||||||
int func_arity = ArityOfFunctor(func);
|
arity_t func_arity = ArityOfFunctor(func);
|
||||||
|
|
||||||
restore_trie_node(TrNode_next(node));
|
restore_trie_node(TrNode_next(node));
|
||||||
aux_stack_appl_instr();
|
aux_stack_appl_instr();
|
||||||
@ -962,11 +962,11 @@
|
|||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
||||||
int func_arity = ArityOfFunctor(func);
|
arity_t func_arity = ArityOfFunctor(func);
|
||||||
|
|
||||||
aux_stack_appl_in_pair_instr();
|
aux_stack_appl_in_pair_instr();
|
||||||
#else
|
#else
|
||||||
@ -979,11 +979,11 @@
|
|||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
||||||
int func_arity = ArityOfFunctor(func);
|
arity_t func_arity = ArityOfFunctor(func);
|
||||||
|
|
||||||
pop_trie_node();
|
pop_trie_node();
|
||||||
aux_stack_appl_in_pair_instr();
|
aux_stack_appl_in_pair_instr();
|
||||||
@ -997,11 +997,11 @@
|
|||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
||||||
int func_arity = ArityOfFunctor(func);
|
arity_t func_arity = ArityOfFunctor(func);
|
||||||
|
|
||||||
store_trie_node(TrNode_next(node));
|
store_trie_node(TrNode_next(node));
|
||||||
aux_stack_appl_in_pair_instr();
|
aux_stack_appl_in_pair_instr();
|
||||||
@ -1015,11 +1015,11 @@
|
|||||||
#ifdef TRIE_COMPACT_PAIRS
|
#ifdef TRIE_COMPACT_PAIRS
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
Functor func = (Functor) RepAppl(TrNode_entry(node));
|
||||||
int func_arity = ArityOfFunctor(func);
|
arity_t func_arity = ArityOfFunctor(func);
|
||||||
|
|
||||||
restore_trie_node(TrNode_next(node));
|
restore_trie_node(TrNode_next(node));
|
||||||
aux_stack_appl_in_pair_instr();
|
aux_stack_appl_in_pair_instr();
|
||||||
@ -1032,7 +1032,7 @@
|
|||||||
PBOp(trie_do_extension, e)
|
PBOp(trie_do_extension, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
|
|
||||||
aux_stack_extension_instr();
|
aux_stack_extension_instr();
|
||||||
ENDPBOp();
|
ENDPBOp();
|
||||||
@ -1041,9 +1041,9 @@
|
|||||||
PBOp(trie_trust_extension, e)
|
PBOp(trie_trust_extension, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
pop_trie_node();
|
pop_trie_node();
|
||||||
aux_stack_extension_instr();
|
aux_stack_extension_instr();
|
||||||
@ -1053,9 +1053,9 @@
|
|||||||
PBOp(trie_try_extension, e)
|
PBOp(trie_try_extension, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
store_trie_node(TrNode_next(node));
|
store_trie_node(TrNode_next(node));
|
||||||
aux_stack_extension_instr();
|
aux_stack_extension_instr();
|
||||||
@ -1065,9 +1065,9 @@
|
|||||||
PBOp(trie_retry_extension, e)
|
PBOp(trie_retry_extension, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
restore_trie_node(TrNode_next(node));
|
restore_trie_node(TrNode_next(node));
|
||||||
aux_stack_extension_instr();
|
aux_stack_extension_instr();
|
||||||
@ -1077,9 +1077,9 @@
|
|||||||
PBOp(trie_do_double, e)
|
PBOp(trie_do_double, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
volatile union {
|
volatile union {
|
||||||
Float dbl;
|
Float dbl;
|
||||||
Term ts[SIZEOF_DOUBLE/SIZEOF_INT_P];
|
Term ts[SIZEOF_DOUBLE/SIZEOF_INT_P];
|
||||||
@ -1120,9 +1120,9 @@
|
|||||||
PBOp(trie_do_longint, e)
|
PBOp(trie_do_longint, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
Term t = MkLongIntTerm(aux_stack[HEAP_ENTRY(1)]);
|
Term t = MkLongIntTerm(aux_stack[HEAP_ENTRY(1)]);
|
||||||
|
|
||||||
heap_arity -= 2;
|
heap_arity -= 2;
|
||||||
@ -1150,9 +1150,9 @@
|
|||||||
PBOp(trie_do_bigint, e)
|
PBOp(trie_do_bigint, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
arity_t heap_arity = aux_stack[HEAP_ARITY_ENTRY];
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
Term t = AbsAppl((CELL*)aux_stack[HEAP_ENTRY(1)]);
|
Term t = AbsAppl((CELL*)aux_stack[HEAP_ENTRY(1)]);
|
||||||
|
|
||||||
heap_arity -= 2;
|
heap_arity -= 2;
|
||||||
@ -1181,9 +1181,9 @@
|
|||||||
PBOp(trie_do_gterm, e)
|
PBOp(trie_do_gterm, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = 0;
|
arity_t heap_arity = 0;
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
TOP_STACK = exec_substitution((gt_node_ptr)TrNode_entry(node), aux_stack);
|
TOP_STACK = exec_substitution((gt_node_ptr)TrNode_entry(node), aux_stack);
|
||||||
next_instruction(subs_arity - 1 , node);
|
next_instruction(subs_arity - 1 , node);
|
||||||
@ -1193,9 +1193,9 @@
|
|||||||
PBOp(trie_trust_gterm, e)
|
PBOp(trie_trust_gterm, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = 0;
|
arity_t heap_arity = 0;
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
pop_trie_node();
|
pop_trie_node();
|
||||||
TOP_STACK = exec_substitution((gt_node_ptr)TrNode_entry(node), aux_stack);
|
TOP_STACK = exec_substitution((gt_node_ptr)TrNode_entry(node), aux_stack);
|
||||||
@ -1206,9 +1206,9 @@
|
|||||||
PBOp(trie_try_gterm, e)
|
PBOp(trie_try_gterm, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = TOP_STACK;
|
register CELL *aux_stack = TOP_STACK;
|
||||||
int heap_arity = 0;
|
arity_t heap_arity = 0;
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
store_trie_node(TrNode_next(node));
|
store_trie_node(TrNode_next(node));
|
||||||
TOP_STACK = exec_substitution((gt_node_ptr)TrNode_entry(node), aux_stack);
|
TOP_STACK = exec_substitution((gt_node_ptr)TrNode_entry(node), aux_stack);
|
||||||
@ -1219,9 +1219,9 @@
|
|||||||
PBOp(trie_retry_gterm, e)
|
PBOp(trie_retry_gterm, e)
|
||||||
register ans_node_ptr node = (ans_node_ptr) PREG;
|
register ans_node_ptr node = (ans_node_ptr) PREG;
|
||||||
register CELL *aux_stack = (CELL *) (B + 1);
|
register CELL *aux_stack = (CELL *) (B + 1);
|
||||||
int heap_arity = 0;
|
arity_t heap_arity = 0;
|
||||||
int vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
arity_t vars_arity = aux_stack[VARS_ARITY_ENTRY];
|
||||||
int subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
arity_t subs_arity = aux_stack[SUBS_ARITY_ENTRY];
|
||||||
|
|
||||||
restore_trie_node(TrNode_next(node));
|
restore_trie_node(TrNode_next(node));
|
||||||
TOP_STACK = exec_substitution((gt_node_ptr)TrNode_entry(node), aux_stack);
|
TOP_STACK = exec_substitution((gt_node_ptr)TrNode_entry(node), aux_stack);
|
||||||
|
@ -63,16 +63,7 @@ else(MSVC)
|
|||||||
|
|
||||||
get_filename_component(GMP_LIBRARIES_DIR "${GMP_LIBRARIES}" PATH CACHE)
|
get_filename_component(GMP_LIBRARIES_DIR "${GMP_LIBRARIES}" PATH CACHE)
|
||||||
|
|
||||||
if (WIN32)
|
find_path(GMP_INCLUDE_DIRS
|
||||||
|
|
||||||
find_library(GMP_LIBRARY_DLL NAMES gmp
|
|
||||||
PATHS
|
|
||||||
${GMP_LIBRARIES_DIR}/../bin
|
|
||||||
${GMP_LIBRARIES_DIR}
|
|
||||||
)
|
|
||||||
endif(WIN32)
|
|
||||||
|
|
||||||
find_file(GMP_INCLUDE_DIRS
|
|
||||||
NAMES gmp.h
|
NAMES gmp.h
|
||||||
PATHS
|
PATHS
|
||||||
${GMP_LIBRARIES_DIR}/../include
|
${GMP_LIBRARIES_DIR}/../include
|
||||||
@ -85,7 +76,7 @@ endif(MSVC)
|
|||||||
# handle the QUIET and REQUIRED arguments and set GMP_FOUND to TRUE if
|
# handle the QUIET and REQUIRED arguments and set GMP_FOUND to TRUE if
|
||||||
# all listed variables are true
|
# all listed variables are true
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
if(WIN32)
|
if(MSVC)
|
||||||
find_package_handle_standard_args(GMP DEFAULT_MSG GMP_LIBRARIES GMP_LIBRARIES_DIR GMP_LIBRARY_DLL GMP_INCLUDE_DIRS)
|
find_package_handle_standard_args(GMP DEFAULT_MSG GMP_LIBRARIES GMP_LIBRARIES_DIR GMP_LIBRARY_DLL GMP_INCLUDE_DIRS)
|
||||||
mark_as_advanced(GMP_LIBRARY_DLL)
|
mark_as_advanced(GMP_LIBRARY_DLL)
|
||||||
else()
|
else()
|
||||||
|
@ -1996,7 +1996,7 @@ calls it, or to nothing if 'inline' is not supported under any name. */
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef MAXPATHLEN
|
#ifndef MAXPATHLEN
|
||||||
#ifdef PATH_MAX
|
#if defined(PATH_MAX)
|
||||||
#define MAXPATHLEN PATH_MAX
|
#define MAXPATHLEN PATH_MAX
|
||||||
#else
|
#else
|
||||||
#define MAXPATHLEN 1024
|
#define MAXPATHLEN 1024
|
||||||
|
@ -1798,7 +1798,6 @@ extern X_API void *YAP_ExtraSpaceCut(void);
|
|||||||
|
|
||||||
extern X_API YAP_Bool YAP_Unify(YAP_Term t1, YAP_Term t2);
|
extern X_API YAP_Bool YAP_Unify(YAP_Term t1, YAP_Term t2);
|
||||||
|
|
||||||
/* void UserCPredicate(const char *name, int *fn(), int arity) */
|
|
||||||
extern X_API void YAP_UserCPredicate(const char *, YAP_UserCPred,
|
extern X_API void YAP_UserCPredicate(const char *, YAP_UserCPred,
|
||||||
YAP_Arity arity);
|
YAP_Arity arity);
|
||||||
|
|
||||||
|
@ -3174,7 +3174,7 @@ atom_generator(const char *prefix, char **hit, int state)
|
|||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
struct scan_atoms *index;
|
struct scan_atoms *index;
|
||||||
Atom catom;
|
Atom catom;
|
||||||
Int i;
|
UInt i;
|
||||||
|
|
||||||
if ( !state )
|
if ( !state )
|
||||||
{ index = (struct scan_atoms *)malloc(sizeof(struct scan_atoms));
|
{ index = (struct scan_atoms *)malloc(sizeof(struct scan_atoms));
|
||||||
|
@ -8,81 +8,7 @@
|
|||||||
* *
|
* *
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
* *
|
* *
|
||||||
* $Id: sys.c,v 1.36 2008-07-11 17:02:09 vsc Exp $ *
|
*
|
||||||
* mods: $Log: not supported by cvs2svn $
|
|
||||||
* mods: Revision 1.35 2008/05/23 13:16:13 vsc
|
|
||||||
* mods: fix sys.c for win32
|
|
||||||
* mods:
|
|
||||||
* mods: Revision 1.34 2008/05/22 23:25:21 vsc
|
|
||||||
* mods: add tmp_file/2
|
|
||||||
* mods:
|
|
||||||
* mods: Revision 1.33 2007/10/05 18:24:30 vsc
|
|
||||||
* mods: fix garbage collector and fix LeaveGoal
|
|
||||||
* mods:
|
|
||||||
* mods: Revision 1.32 2007/05/07 12:11:39 vsc
|
|
||||||
* mods: fix mktime fix
|
|
||||||
* mods:
|
|
||||||
* mods: Revision 1.31 2007/05/07 11:21:29 vsc
|
|
||||||
* mods: mktime needs to know if daylight time savings are on
|
|
||||||
* mods: (obs from Bernd Gutmann).
|
|
||||||
* mods:
|
|
||||||
* mods: Revision 1.30 2007/05/02 11:16:43 vsc
|
|
||||||
* mods: small fixes to sys.c
|
|
||||||
* mods:
|
|
||||||
* mods: Revision 1.29 2006/10/10 14:08:17 vsc
|
|
||||||
* mods: small fixes on threaded implementation.
|
|
||||||
* mods:
|
|
||||||
* mods: Revision 1.28 2006/05/25 16:28:28 vsc
|
|
||||||
* mods: include thread_sleep functionality.
|
|
||||||
* mods:
|
|
||||||
* mods: Revision 1.27 2006/05/17 18:38:11 vsc
|
|
||||||
* mods: make system library use true file name
|
|
||||||
* mods:
|
|
||||||
* mods: Revision 1.26 2006/04/25 03:23:40 vsc
|
|
||||||
* mods: fix ! in debugger (execute_clause)
|
|
||||||
* mods: improve system/1 and execute/1
|
|
||||||
* mods:
|
|
||||||
* mods: Revision 1.25 2006/01/17 14:10:42 vsc
|
|
||||||
* mods: YENV may be an HW register (breaks some tabling code)
|
|
||||||
* mods: All YAAM instructions are now brackedted, so Op introduced an { and EndOp introduces an }. This is because Ricardo assumes that.
|
|
||||||
* mods: Fix attvars when COROUTING is undefined.
|
|
||||||
* mods:
|
|
||||||
* mods: Revision 1.24 2006/01/08 23:01:48 vsc
|
|
||||||
* mods: *** empty log message ***
|
|
||||||
* mods:
|
|
||||||
* mods: Revision 1.23 2005/10/21 16:09:03 vsc
|
|
||||||
* mods: SWI compatible module only operators
|
|
||||||
* mods:
|
|
||||||
* mods: Revision 1.22 2005/03/10 18:04:01 rslopes
|
|
||||||
* mods: update YAP_Error arguments
|
|
||||||
* mods: to be able to compile on Windows...
|
|
||||||
* mods:
|
|
||||||
* mods: Revision 1.21 2004/08/11 16:14:54 vsc
|
|
||||||
* mods: whole lot of fixes:
|
|
||||||
* mods: - memory leak in indexing
|
|
||||||
* mods: - memory management in WIN32 now supports holes
|
|
||||||
* mods: - extend Yap interface, more support for SWI-Interface
|
|
||||||
* mods: - new predicate mktime in system
|
|
||||||
* mods: - buffer console I/O in WIN32
|
|
||||||
* mods:
|
|
||||||
* mods: Revision 1.20 2004/07/23 19:02:09 vsc
|
|
||||||
* mods: misc fixes
|
|
||||||
* mods:
|
|
||||||
* mods: Revision 1.19 2004/07/23 03:37:17 vsc
|
|
||||||
* mods: fix heap overflow in YAP_LookupAtom
|
|
||||||
* mods:
|
|
||||||
* mods: Revision 1.18 2004/01/26 12:51:33 vsc
|
|
||||||
* mods: should be datime/1 not date/1
|
|
||||||
* mods:
|
|
||||||
* mods: Revision 1.17 2004/01/26 12:41:06 vsc
|
|
||||||
* mods: bug fixes
|
|
||||||
* mods:
|
|
||||||
* mods: Revision 1.16 2003/01/27 15:55:40 vsc
|
|
||||||
* mods: use CVS Id
|
|
||||||
* mods:
|
|
||||||
* mods: Revision 1.15 2003/01/27 15:54:10 vsc
|
|
||||||
* mods: fix header
|
|
||||||
* mods: *
|
|
||||||
* comments: regular expression interpreter *
|
* comments: regular expression interpreter *
|
||||||
* *
|
* *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
@ -134,6 +60,7 @@
|
|||||||
#if defined(__MINGW32__) || _MSC_VER
|
#if defined(__MINGW32__) || _MSC_VER
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
|
#include <io.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
#ifdef HAVE_ENVIRON
|
#ifdef HAVE_ENVIRON
|
||||||
|
@ -118,7 +118,7 @@ static enc_map_t ematches[] = {
|
|||||||
{"CP-1252", ENC_ISO_LATIN1},
|
{"CP-1252", ENC_ISO_LATIN1},
|
||||||
{"C", ENC_ISO_ASCII},
|
{"C", ENC_ISO_ASCII},
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
{NULL, ENC_UTF16_LE}
|
{NULL, ENC_ISO_ASCII}
|
||||||
#else
|
#else
|
||||||
{NULL, ENC_ISO_UTF8}
|
{NULL, ENC_ISO_UTF8}
|
||||||
#endif
|
#endif
|
||||||
@ -127,16 +127,11 @@ static enc_map_t ematches[] = {
|
|||||||
static encoding_t enc_os_default( encoding_t rc)\
|
static encoding_t enc_os_default( encoding_t rc)\
|
||||||
{
|
{
|
||||||
// by default, return UTF-8
|
// by default, return UTF-8
|
||||||
// except in _WIN32
|
// note that we match the C locale to UTF8/16, as all Unix machines will work on UNICODE.
|
||||||
// note that we match the C locale to UTF8/16, as all Unix maachines will work on UNICODE.
|
// WIN32 we will rely on BOM
|
||||||
|
|
||||||
if (rc == ENC_ISO_ASCII) {
|
if (rc == ENC_ISO_ASCII) {
|
||||||
#ifdef _WIN32
|
return ENC_ISO_UTF8; }
|
||||||
return ENC_UTF16_BE;
|
|
||||||
#else
|
|
||||||
return ENC_ISO_UTF8;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,11 +79,10 @@ static Int is_same_tty2(USES_REGS1) { /* 'prompt(Atom) */
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Yap_ConsoleOps(StreamDesc *s, bool recursive) {
|
void Yap_ConsoleOps(StreamDesc *s) {
|
||||||
if (!recursive)
|
|
||||||
Yap_DefaultStreamOps(s);
|
|
||||||
/* the putc routine only has to check it is putting out a newline */
|
/* the putc routine only has to check it is putting out a newline */
|
||||||
s->stream_putc = ConsolePutc;
|
s->stream_putc = ConsolePutc;
|
||||||
|
s->stream_getc = ConsoleGetc;
|
||||||
#if USE_READLINE
|
#if USE_READLINE
|
||||||
/* if a tty have a special routine to call readline */
|
/* if a tty have a special routine to call readline */
|
||||||
if ((s->status & Readline_Stream_f) && trueGlobalPrologFlag(READLINE_FLAG)) {
|
if ((s->status & Readline_Stream_f) && trueGlobalPrologFlag(READLINE_FLAG)) {
|
||||||
@ -91,7 +90,6 @@ void Yap_ConsoleOps(StreamDesc *s, bool recursive) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
s->stream_getc = ConsoleGetc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
|
@ -62,7 +62,7 @@ loop:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
char *pts = strrchr(f, '/');
|
char *pts = strrchr(f, '/');
|
||||||
#if WIN32_ssss
|
#if WIN32_
|
||||||
char *pts1 = strrchr(f, '\\');
|
char *pts1 = strrchr(f, '\\');
|
||||||
if (pts11 > pts)
|
if (pts11 > pts)
|
||||||
pts = pts1;
|
pts = pts1;
|
||||||
@ -467,7 +467,7 @@ static Int is_absolute_file_name(USES_REGS1) { /* file_base_name(Stream,N) */
|
|||||||
Yap_Error(INSTANTIATION_ERROR, t, "file_base_name/2");
|
Yap_Error(INSTANTIATION_ERROR, t, "file_base_name/2");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
const char *buf = Yap_TextTermToText(t, NULL, 0);
|
const char *buf = Yap_TextTermToText(t, NULL, 0, LOCAL_encoding);
|
||||||
if (buf) {
|
if (buf) {
|
||||||
return Yap_IsAbsolutePath(buf);
|
return Yap_IsAbsolutePath(buf);
|
||||||
} else {
|
} else {
|
||||||
|
19
os/iopreds.c
19
os/iopreds.c
@ -260,12 +260,17 @@ void Yap_DefaultStreamOps(StreamDesc *st) {
|
|||||||
st->stream_putc = FilePutc;
|
st->stream_putc = FilePutc;
|
||||||
st->stream_getc = PlGetc;
|
st->stream_getc = PlGetc;
|
||||||
if (st->status & (Promptable_Stream_f)) {
|
if (st->status & (Promptable_Stream_f)) {
|
||||||
st->stream_wgetc = get_wchar;
|
Yap_ConsoleOps(st);
|
||||||
Yap_ConsoleOps(st, false);
|
}
|
||||||
} else if (st->encoding == LOCAL_encoding) {
|
#ifndef _WIN32
|
||||||
|
else if (st->file != NULL) {
|
||||||
|
if (st->encoding == LOCAL_encoding) {
|
||||||
st->stream_wgetc = get_wchar_from_file;
|
st->stream_wgetc = get_wchar_from_file;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
st->stream_wgetc = get_wchar_from_FILE;
|
st->stream_wgetc = get_wchar_from_FILE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (GLOBAL_CharConversionTable != NULL)
|
if (GLOBAL_CharConversionTable != NULL)
|
||||||
st->stream_wgetc_for_read = ISOWGetc;
|
st->stream_wgetc_for_read = ISOWGetc;
|
||||||
else
|
else
|
||||||
@ -275,7 +280,7 @@ void Yap_DefaultStreamOps(StreamDesc *st) {
|
|||||||
} else if (st->status & InMemory_Stream_f) {
|
} else if (st->status & InMemory_Stream_f) {
|
||||||
Yap_MemOps(st);
|
Yap_MemOps(st);
|
||||||
} else if (st->status & Tty_Stream_f) {
|
} else if (st->status & Tty_Stream_f) {
|
||||||
Yap_ConsoleOps(st, false);
|
Yap_ConsoleOps(st);
|
||||||
} else {
|
} else {
|
||||||
unix_upd_stream_info(st);
|
unix_upd_stream_info(st);
|
||||||
}
|
}
|
||||||
@ -1129,6 +1134,7 @@ do_open(Term file_name, Term t2,
|
|||||||
StreamDesc *st;
|
StreamDesc *st;
|
||||||
bool avoid_bom = false, needs_bom = false;
|
bool avoid_bom = false, needs_bom = false;
|
||||||
const char *fname;
|
const char *fname;
|
||||||
|
char fbuf[FILENAME_MAX];
|
||||||
stream_flags_t flags;
|
stream_flags_t flags;
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
const char *s_encoding;
|
const char *s_encoding;
|
||||||
@ -1217,7 +1223,7 @@ do_open(Term file_name, Term t2,
|
|||||||
: false) ||
|
: false) ||
|
||||||
trueGlobalPrologFlag(OPEN_EXPANDS_FILENAME_FLAG);
|
trueGlobalPrologFlag(OPEN_EXPANDS_FILENAME_FLAG);
|
||||||
// expand file name?
|
// expand file name?
|
||||||
fname = Yap_AbsoluteFile(fname, ok);
|
fname = Yap_AbsoluteFile(fname, fbuf, ok);
|
||||||
if (fname) {
|
if (fname) {
|
||||||
st->name = Yap_LookupAtom(fname);
|
st->name = Yap_LookupAtom(fname);
|
||||||
} else {
|
} else {
|
||||||
@ -1270,6 +1276,7 @@ do_open(Term file_name, Term t2,
|
|||||||
if ((fd = fopen(fname, io_mode)) == NULL ||
|
if ((fd = fopen(fname, io_mode)) == NULL ||
|
||||||
(!(flags & Binary_Stream_f) && binary_file(fname))) {
|
(!(flags & Binary_Stream_f) && binary_file(fname))) {
|
||||||
strncpy(LOCAL_FileNameBuf, fname, MAXPATHLEN);
|
strncpy(LOCAL_FileNameBuf, fname, MAXPATHLEN);
|
||||||
|
if (fname != fbuf && fname != LOCAL_FileNameBuf && fname != LOCAL_FileNameBuf2)
|
||||||
free((void *)fname);
|
free((void *)fname);
|
||||||
fname = LOCAL_FileNameBuf;
|
fname = LOCAL_FileNameBuf;
|
||||||
UNLOCK(st->streamlock);
|
UNLOCK(st->streamlock);
|
||||||
|
@ -152,7 +152,7 @@ typedef struct read_data_t {
|
|||||||
} read_data, *ReadData;
|
} read_data, *ReadData;
|
||||||
|
|
||||||
Term Yap_read_term(int inp_stream, Term opts, int nargs);
|
Term Yap_read_term(int inp_stream, Term opts, int nargs);
|
||||||
Term Yap_Parse(UInt prio, Term cmod);
|
Term Yap_Parse(UInt prio, encoding_t enc, Term cmod);
|
||||||
|
|
||||||
void init_read_data(ReadData _PL_rd, struct stream_desc *s);
|
void init_read_data(ReadData _PL_rd, struct stream_desc *s);
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ static inline StreamDesc *Yap_GetStreamHandle(Term t) {
|
|||||||
void Yap_InitStdStreams(void);
|
void Yap_InitStdStreams(void);
|
||||||
Term Yap_StreamPosition(int);
|
Term Yap_StreamPosition(int);
|
||||||
|
|
||||||
static inline int GetCurInpPos(StreamDesc *inp_stream) {
|
static inline Int GetCurInpPos(StreamDesc *inp_stream) {
|
||||||
return (inp_stream->linecount);
|
return (inp_stream->linecount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ void Yap_SocketOps(StreamDesc *st);
|
|||||||
void Yap_ConsoleSocketOps(StreamDesc *st);
|
void Yap_ConsoleSocketOps(StreamDesc *st);
|
||||||
bool Yap_ReadlineOps(StreamDesc *st);
|
bool Yap_ReadlineOps(StreamDesc *st);
|
||||||
int Yap_OpenBufWriteStream(USES_REGS1);
|
int Yap_OpenBufWriteStream(USES_REGS1);
|
||||||
void Yap_ConsoleOps(StreamDesc *s, bool recursive);
|
void Yap_ConsoleOps(StreamDesc *s);
|
||||||
|
|
||||||
void Yap_InitRandomPreds(void);
|
void Yap_InitRandomPreds(void);
|
||||||
void Yap_InitSignalPreds(void);
|
void Yap_InitSignalPreds(void);
|
||||||
|
@ -205,7 +205,7 @@ bool Yap_InitReadline(Term enable) {
|
|||||||
#endif
|
#endif
|
||||||
rl_outstream = stderr;
|
rl_outstream = stderr;
|
||||||
using_history();
|
using_history();
|
||||||
const char *s = Yap_AbsoluteFile("~/.YAP.history", true);
|
const char *s = Yap_AbsoluteFile("~/.YAP.history", NULL, true);
|
||||||
if (!read_history(s)) {
|
if (!read_history(s)) {
|
||||||
FILE *f = fopen(s, "w");
|
FILE *f = fopen(s, "w");
|
||||||
if (f) {
|
if (f) {
|
||||||
|
@ -68,7 +68,7 @@ static char SccsId[] = "%W% %G%";
|
|||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#if HAVE_IO_H
|
#if HAVE_IO_H
|
||||||
/* Windows */
|
/* priows */
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -802,8 +802,9 @@ static parser_state_t scan(REnv *re, FEnv *fe, int inp_stream) {
|
|||||||
return YAP_PARSING;
|
return YAP_PARSING;
|
||||||
}
|
}
|
||||||
if (LOCAL_tokptr->Tok == eot_tok && LOCAL_tokptr->TokInfo == TermNl) {
|
if (LOCAL_tokptr->Tok == eot_tok && LOCAL_tokptr->TokInfo == TermNl) {
|
||||||
char *out = malloc(strlen("Empty clause" + 1));
|
size_t len = strlen("Empty clause");
|
||||||
strcpy(out, "Empty clause");
|
char *out = malloc(len + 1);
|
||||||
|
strncpy(out, "Empty clause",len);
|
||||||
LOCAL_ErrorMessage = out;
|
LOCAL_ErrorMessage = out;
|
||||||
LOCAL_Error_TYPE = SYNTAX_ERROR;
|
LOCAL_Error_TYPE = SYNTAX_ERROR;
|
||||||
LOCAL_Error_Term = TermEof;
|
LOCAL_Error_Term = TermEof;
|
||||||
@ -885,10 +886,7 @@ static parser_state_t parseError(REnv *re, FEnv *fe, int inp_stream) {
|
|||||||
static parser_state_t parse(REnv *re, FEnv *fe, int inp_stream) {
|
static parser_state_t parse(REnv *re, FEnv *fe, int inp_stream) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
TokEntry *tokstart = LOCAL_tokptr;
|
TokEntry *tokstart = LOCAL_tokptr;
|
||||||
encoding_t e = LOCAL_encoding;
|
fe->t = Yap_Parse(re->prio, fe->enc, fe->cmod);
|
||||||
LOCAL_encoding = fe->enc;
|
|
||||||
fe->t = Yap_Parse(re->prio, fe->cmod);
|
|
||||||
LOCAL_encoding = e;
|
|
||||||
fe->toklast = LOCAL_tokptr;
|
fe->toklast = LOCAL_tokptr;
|
||||||
LOCAL_tokptr = tokstart;
|
LOCAL_tokptr = tokstart;
|
||||||
TR = (tr_fr_ptr)tokstart;
|
TR = (tr_fr_ptr)tokstart;
|
||||||
@ -1260,14 +1258,17 @@ static Int style_checker(USES_REGS1) {
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Term Yap_StringToTerm(const char *s, size_t len, encoding_t *encp, int prio,
|
X_API Term Yap_StringToTerm(const char *s, size_t len, encoding_t *encp, int prio,
|
||||||
Term *bindings) {
|
Term *bindings) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
Term bvar = MkVarTerm(), ctl;
|
Term bvar = MkVarTerm(), ctl;
|
||||||
yhandle_t sl;
|
yhandle_t sl;
|
||||||
|
|
||||||
if (bindings) {
|
if (bindings) {
|
||||||
|
Term enc = MkAtomTerm(Yap_LookupAtom(enc_name(*encp)));
|
||||||
|
Term encc = Yap_MkApplTerm(Yap_MkFunctor(AtomEncoding, 1), 1, &enc);
|
||||||
ctl = Yap_MkApplTerm(Yap_MkFunctor(AtomVariableNames, 1), 1, &bvar);
|
ctl = Yap_MkApplTerm(Yap_MkFunctor(AtomVariableNames, 1), 1, &bvar);
|
||||||
|
ctl = MkPairTerm(ctl, MkPairTerm(encc, TermNil));
|
||||||
sl = Yap_PushHandle(bvar);
|
sl = Yap_PushHandle(bvar);
|
||||||
} else {
|
} else {
|
||||||
ctl = TermNil;
|
ctl = TermNil;
|
||||||
|
43
os/sysbits.c
43
os/sysbits.c
@ -428,7 +428,8 @@ static char *PrologPath(const char *Y, char *X) { return (char *)Y; }
|
|||||||
|
|
||||||
static bool ChDir(const char *path) {
|
static bool ChDir(const char *path) {
|
||||||
bool rc = false;
|
bool rc = false;
|
||||||
const char *qpath = Yap_AbsoluteFile(path, true);
|
char qp[FILENAME_MAX + 1];
|
||||||
|
const char *qpath = Yap_AbsoluteFile(path, qp, true);
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
if (GLOBAL_AssetsWD) {
|
if (GLOBAL_AssetsWD) {
|
||||||
@ -462,6 +463,8 @@ static bool ChDir(const char *path) {
|
|||||||
#else
|
#else
|
||||||
rc = (chdir(qpath) == 0);
|
rc = (chdir(qpath) == 0);
|
||||||
#endif
|
#endif
|
||||||
|
if (qpath != qp && qpath != LOCAL_FileNameBuf &&
|
||||||
|
qpath != LOCAL_FileNameBuf2)
|
||||||
free((char *)qpath);
|
free((char *)qpath);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -494,8 +497,9 @@ const char *DirName(const char *X) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char *myrealpath(const char *path) {
|
static const char *myrealpath(const char *path, char *out) {
|
||||||
char *out = LOCAL_FileNameBuf;
|
if (!out)
|
||||||
|
out = LOCAL_FileNameBuf;
|
||||||
#if _WIN32 || defined(__MINGW32__)
|
#if _WIN32 || defined(__MINGW32__)
|
||||||
DWORD retval = 0;
|
DWORD retval = 0;
|
||||||
|
|
||||||
@ -576,18 +580,22 @@ static const char *expandVars(const char *spec, char *u) {
|
|||||||
*
|
*
|
||||||
* @return tmp, or NULL, in malloced memory
|
* @return tmp, or NULL, in malloced memory
|
||||||
*/
|
*/
|
||||||
const char *Yap_AbsoluteFile(const char *spec, bool ok) {
|
const char *Yap_AbsoluteFile(const char *spec, char *rc0, bool ok) {
|
||||||
const char *p;
|
const char *p;
|
||||||
const char *rc;
|
char *rc;
|
||||||
rc = PlExpandVars(spec, NULL, NULL);
|
rc = PlExpandVars(spec, NULL, rc0);
|
||||||
if (!rc)
|
if (!rc)
|
||||||
rc = spec;
|
rc = spec;
|
||||||
if ((p = myrealpath(rc))) {
|
if ((p = myrealpath(rc, rc0))) {
|
||||||
|
if (rc != rc0 && rc != spec && rc != p)
|
||||||
|
freeBuffer(rc);
|
||||||
return p;
|
return p;
|
||||||
} else {
|
} else {
|
||||||
|
if (rc != rc0 && rc != spec)
|
||||||
|
freeBuffer(rc);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
freeBuffer(rc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -614,7 +622,7 @@ const char *Yap_AbsoluteFileInBuffer(const char *spec, char *out, size_t sz,
|
|||||||
rc = spec;
|
rc = spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((p = myrealpath(rc))) {
|
if ((p = myrealpath(rc, NULL))) {
|
||||||
if (!out) {
|
if (!out) {
|
||||||
out = LOCAL_FileNameBuf;
|
out = LOCAL_FileNameBuf;
|
||||||
sz = YAP_FILENAME_MAX - 1;
|
sz = YAP_FILENAME_MAX - 1;
|
||||||
@ -802,7 +810,7 @@ static Int prolog_realpath(USES_REGS1) {
|
|||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const char *rc = myrealpath(cmd);
|
const char *rc = myrealpath(cmd, NULL);
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
PlIOError(SYSTEM_ERROR_OPERATING_SYSTEM, ARG1, strerror(errno));
|
PlIOError(SYSTEM_ERROR_OPERATING_SYSTEM, ARG1, strerror(errno));
|
||||||
return false;
|
return false;
|
||||||
@ -950,14 +958,14 @@ static Int absolute_file_system_path(USES_REGS1) {
|
|||||||
const char *fp;
|
const char *fp;
|
||||||
bool rc;
|
bool rc;
|
||||||
char s[MAXPATHLEN + 1];
|
char s[MAXPATHLEN + 1];
|
||||||
const char *text = Yap_TextTermToText(t, s, MAXPATHLEN);
|
const char *text = Yap_TextTermToText(t, s, MAXPATHLEN, LOCAL_encoding);
|
||||||
|
|
||||||
if (text == NULL) {
|
if (text == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!(fp = Yap_AbsoluteFile(RepAtom(AtomOfTerm(t))->StrOfAE, true)))
|
if (!(fp = Yap_AbsoluteFile(RepAtom(AtomOfTerm(t))->StrOfAE, NULL, true)))
|
||||||
return false;
|
return false;
|
||||||
rc = Yap_unify(Yap_MkTextTerm(fp, t), ARG2);
|
rc = Yap_unify(Yap_MkTextTerm(fp, LOCAL_encoding, t), ARG2);
|
||||||
if (fp != s)
|
if (fp != s)
|
||||||
freeBuffer((void *)fp);
|
freeBuffer((void *)fp);
|
||||||
return rc;
|
return rc;
|
||||||
@ -1410,13 +1418,13 @@ static Int p_expand_file_name(USES_REGS1) {
|
|||||||
Yap_Error(INSTANTIATION_ERROR, t, "argument to true_file_name unbound");
|
Yap_Error(INSTANTIATION_ERROR, t, "argument to true_file_name unbound");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
text = Yap_TextTermToText(t, NULL, 0);
|
text = Yap_TextTermToText(t, NULL, 0, LOCAL_encoding);
|
||||||
if (!text)
|
if (!text)
|
||||||
return false;
|
return false;
|
||||||
if (!(text2 = PlExpandVars(text, NULL, NULL)))
|
if (!(text2 = PlExpandVars(text, NULL, NULL)))
|
||||||
return false;
|
return false;
|
||||||
freeBuffer(text);
|
freeBuffer(text);
|
||||||
bool rc = Yap_unify(ARG2, Yap_MkTextTerm(text2, t));
|
bool rc = Yap_unify(ARG2, Yap_MkTextTerm(text2, LOCAL_encoding, t));
|
||||||
freeBuffer(text2);
|
freeBuffer(text2);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -1993,11 +2001,12 @@ static wchar_t *WideStringFromAtom(Atom KeyAt USES_REGS) {
|
|||||||
|
|
||||||
k = (wchar_t *)Yap_AllocCodeSpace(sz);
|
k = (wchar_t *)Yap_AllocCodeSpace(sz);
|
||||||
while (k == NULL) {
|
while (k == NULL) {
|
||||||
if (!Yap_growheap(FALSE, sz, NULL)) {
|
if (!Yap_growheap(false, sz, NULL)) {
|
||||||
Yap_Error(RESOURCE_ERROR_HEAP, MkIntegerTerm(sz),
|
Yap_Error(RESOURCE_ERROR_HEAP, MkIntegerTerm(sz),
|
||||||
"generating key in win_registry_get_value/3");
|
"generating key in win_registry_get_value/3");
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
k = (wchar_t *)Yap_AllocCodeSpace(sz);
|
||||||
}
|
}
|
||||||
kptr = k;
|
kptr = k;
|
||||||
while ((*kptr++ = *chp++))
|
while ((*kptr++ = *chp++))
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#if _WIN32 || defined(__MINGW32__)
|
#if _WIN32 || defined(__MINGW32__)
|
||||||
#if !defined(MINGW_HAS_SECURE_API)
|
#if !defined(MINGW_HAS_SECURE_API)
|
||||||
#define MINGW_HAS_SECURE_API 1
|
#define MINGW_HAS_SECURE_API 1
|
||||||
@ -24,6 +26,7 @@
|
|||||||
#include "YapHeap.h"
|
#include "YapHeap.h"
|
||||||
#include "yapio.h"
|
#include "yapio.h"
|
||||||
#include "eval.h"
|
#include "eval.h"
|
||||||
|
#include "YapText.h"
|
||||||
#if _WIN32 || defined(__MINGW32__)
|
#if _WIN32 || defined(__MINGW32__)
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
/* Windows */
|
/* Windows */
|
||||||
|
@ -170,7 +170,7 @@ bind_variable_names(Term t USES_REGS)
|
|||||||
t2 = ArgOfTerm(2, tl);
|
t2 = ArgOfTerm(2, tl);
|
||||||
tv = Yap_MkApplTerm(FunctorDollarVar, 1, &t1);
|
tv = Yap_MkApplTerm(FunctorDollarVar, 1, &t1);
|
||||||
if (IsVarTerm(t2)) {
|
if (IsVarTerm(t2)) {
|
||||||
Bind(VarOfTerm(t2), tv);
|
YapBind(VarOfTerm(t2), tv);
|
||||||
}
|
}
|
||||||
t = TailOfTerm(t);
|
t = TailOfTerm(t);
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ int Yap_growtrail_in_parser(tr_fr_ptr *, TokEntry **, VarEntry **);
|
|||||||
|
|
||||||
bool Yap_IsAbsolutePath(const char *p);
|
bool Yap_IsAbsolutePath(const char *p);
|
||||||
Atom Yap_TemporaryFile(const char *prefix, int *fd);
|
Atom Yap_TemporaryFile(const char *prefix, int *fd);
|
||||||
const char *Yap_AbsoluteFile(const char *spec, bool expand);
|
const char *Yap_AbsoluteFile(const char *spec, char *obuf, bool expand);
|
||||||
|
|
||||||
typedef enum mem_buf_source {
|
typedef enum mem_buf_source {
|
||||||
MEM_BUF_CODE = 1,
|
MEM_BUF_CODE = 1,
|
||||||
@ -124,7 +124,7 @@ typedef enum mem_buf_source {
|
|||||||
|
|
||||||
char *Yap_MemStreamBuf(int sno);
|
char *Yap_MemStreamBuf(int sno);
|
||||||
|
|
||||||
extern Term Yap_StringToTerm(const char *s, size_t len, encoding_t *encp,
|
extern X_API Term Yap_StringToTerm(const char *s, size_t len, encoding_t *encp,
|
||||||
int prio, Term *bindings_p);
|
int prio, Term *bindings_p);
|
||||||
extern Term Yap_StringToNumberTerm(char *s, encoding_t *encp);
|
extern Term Yap_StringToNumberTerm(char *s, encoding_t *encp);
|
||||||
int Yap_FormatFloat(Float f, char **s, size_t sz);
|
int Yap_FormatFloat(Float f, char **s, size_t sz);
|
||||||
|
@ -1237,6 +1237,7 @@ static Int p_hostname_address(USES_REGS1) {
|
|||||||
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil,
|
Yap_Error(SYSTEM_ERROR_INTERNAL, TermNil,
|
||||||
"hostname_address/2 (gethostbyname)");
|
"hostname_address/2 (gethostbyname)");
|
||||||
#endif
|
#endif
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
memcpy((char *)&adr, (char *)he->h_addr_list[0], (size_t)he->h_length);
|
memcpy((char *)&adr, (char *)he->h_addr_list[0], (size_t)he->h_length);
|
||||||
out = MkAtomTerm(Yap_LookupAtom(inet_ntoa(adr)));
|
out = MkAtomTerm(Yap_LookupAtom(inet_ntoa(adr)));
|
||||||
|
@ -406,7 +406,7 @@ LeafNode::weight() const
|
|||||||
// ancester that is not set. This can only
|
// ancester that is not set. This can only
|
||||||
// happen when calculating the weights
|
// happen when calculating the weights
|
||||||
// for the edge labels in graphviz
|
// for the edge labels in graphviz
|
||||||
return 0.0 / 0.0;
|
return nan(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
double weight = clause_->literals()[0].isPositive()
|
double weight = clause_->literals()[0].isPositive()
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
#include "Horus.h"
|
#include "Horus.h"
|
||||||
|
|
||||||
|
@ -11,28 +11,34 @@ set( MYDDAS_YPP
|
|||||||
myddas_prolog2sql_optimizer.ypp )
|
myddas_prolog2sql_optimizer.ypp )
|
||||||
|
|
||||||
set (MYDDAS_YAP "")
|
set (MYDDAS_YAP "")
|
||||||
|
|
||||||
function(cpp_compile output filename)
|
function(cpp_compile output filename)
|
||||||
set(header_extension "yap")
|
|
||||||
get_filename_component(base ${filename} NAME_WE)
|
get_filename_component(base ${filename} NAME_WE)
|
||||||
set(base_abs ${CMAKE_CURRENT_BINARY_DIR}/${base})
|
set(base_abs ${CMAKE_CURRENT_BINARY_DIR}/${base})
|
||||||
set(outfile ${base_abs}.yap)
|
set(outfile ${base_abs}.yap)
|
||||||
set(${output} ${${output}} ${outfile} PARENT_SCOPE)
|
set(${output} ${${output}} ${outfile} PARENT_SCOPE)
|
||||||
#message("outfile=${outfile}: ${CMAKE_C_COMPILER} -E -Xpreprocessor P ${CMAKE_CURRENT_SOURCE_DIR}/${filename}\n")
|
IF(MSVC)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${outfile}
|
||||||
|
COMMAND ${CMAKE_C_COMPILER} ${MYDDAS_FLAGS} /EP /P ${outfile} ${CMAKE_CURRENT_SOURCE_DIR}/${filename}
|
||||||
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${filename}")
|
||||||
|
else()
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${outfile}
|
OUTPUT ${outfile}
|
||||||
COMMAND ${CMAKE_C_COMPILER} ${MYDDAS_FLAGS} -x c -E -P -w ${CMAKE_CURRENT_SOURCE_DIR}/${filename} -o ${outfile}
|
COMMAND ${CMAKE_C_COMPILER} ${MYDDAS_FLAGS} -x c -E -P -w ${CMAKE_CURRENT_SOURCE_DIR}/${filename} -o ${outfile}
|
||||||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${filename}")
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${filename}")
|
||||||
set_source_files_properties(${outfile} PROPERTIES GENERATED TRUE)
|
ENDIF(MSVC)
|
||||||
|
set_source_files_properties(${outfile} PROPERTIES GENERATED TRUE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
Add_custom_target (plmyddas ALL DEPENDS ${MYDDAS_YPP} ) # WORKING_DIRECTORY ${CMAKE_BINARY_DIR} )
|
||||||
|
|
||||||
foreach(file ${MYDDAS_YPP})
|
foreach(file ${MYDDAS_YPP})
|
||||||
message("infile=${file}\n")
|
|
||||||
cpp_compile( MYDDAS_YAP ${file})
|
cpp_compile( MYDDAS_YAP ${file})
|
||||||
#message("outfiles=${MYDDAS_YAP}\n")
|
#message("outfiles=${MYDDAS_YAP}\n")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
Add_custom_target (plmyddas ALL DEPENDS ${MYDDAS_YPP} ${MYDDAS_YAP} ) # WORKING_DIRECTORY ${CMAKE_BINARY_DIR} )
|
|
||||||
|
|
||||||
|
|
||||||
install(FILES ${MYDDAS_YAP}
|
install(FILES ${MYDDAS_YAP}
|
||||||
DESTINATION ${libpl}
|
DESTINATION ${libpl}
|
||||||
|
Reference in New Issue
Block a user