avoid direct dependencies on CurrentModule
This commit is contained in:
parent
5a95c6bbc7
commit
96bc776375
13
.gitignore
vendored
13
.gitignore
vendored
@ -118,7 +118,7 @@ packages/swig/java/*.jar
|
|||||||
packages/swig/java/*wrap*
|
packages/swig/java/*wrap*
|
||||||
*jnilib
|
*jnilib
|
||||||
*.jar
|
*.jar
|
||||||
|
*LOG
|
||||||
packages/cplint/approx/simplecuddLPADs/LPADBDD
|
packages/cplint/approx/simplecuddLPADs/LPADBDD
|
||||||
|
|
||||||
packages/swi-minisat2/˜:ilp
|
packages/swi-minisat2/˜:ilp
|
||||||
@ -140,13 +140,14 @@ xcode
|
|||||||
Threads
|
Threads
|
||||||
mxe
|
mxe
|
||||||
caret
|
caret
|
||||||
|
codelite
|
||||||
configure
|
configure
|
||||||
|
Qt
|
||||||
cmake/cmake-android
|
cmake/cmake-android
|
||||||
|
sublime
|
||||||
yap-6.3.workspace
|
yap-6.3.workspace
|
||||||
|
yap-6.3-geany
|
||||||
YAP.project
|
YAP.project
|
||||||
|
CBlocks
|
||||||
*.tmp
|
*.tmp
|
||||||
|
YAP.sublime*
|
@ -564,7 +564,8 @@ Yap_OpPropForModule(Atom a,
|
|||||||
|
|
||||||
OpEntry *
|
OpEntry *
|
||||||
Yap_GetOpProp(Atom a,
|
Yap_GetOpProp(Atom a,
|
||||||
op_type type
|
op_type type,
|
||||||
|
Term cmod
|
||||||
USES_REGS) { /* look property list of atom a for kind */
|
USES_REGS) { /* look property list of atom a for kind */
|
||||||
AtomEntry *ae = RepAtom(a);
|
AtomEntry *ae = RepAtom(a);
|
||||||
PropEntry *pp;
|
PropEntry *pp;
|
||||||
@ -579,7 +580,7 @@ Yap_GetOpProp(Atom a,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
info = (OpEntry *)pp;
|
info = (OpEntry *)pp;
|
||||||
if (info->OpModule != CurrentModule && info->OpModule != PROLOG_MODULE) {
|
if (info->OpModule != cmod && info->OpModule != PROLOG_MODULE) {
|
||||||
pp = RepProp(pp->NextOfPE);
|
pp = RepProp(pp->NextOfPE);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
98
C/parser.c
98
C/parser.c
@ -163,10 +163,10 @@ 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 * CACHE_TYPE);
|
||||||
static Term ParseArgs(Atom, wchar_t, JMPBUFF *, Term CACHE_TYPE);
|
static Term ParseArgs(Atom, wchar_t, JMPBUFF *, Term, Term CACHE_TYPE);
|
||||||
static Term ParseList(JMPBUFF *CACHE_TYPE);
|
static Term ParseList(JMPBUFF *, Term CACHE_TYPE);
|
||||||
static Term ParseTerm(int, JMPBUFF *CACHE_TYPE);
|
static Term ParseTerm(int, JMPBUFF *, Term CACHE_TYPE);
|
||||||
|
|
||||||
const char *Yap_tokRep(TokEntry *tokptr);
|
const char *Yap_tokRep(TokEntry *tokptr);
|
||||||
|
|
||||||
@ -367,13 +367,13 @@ 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 USES_REGS) {
|
static int IsPrefixOp(Atom op, int *pptr, int *rpptr, Term cmod USES_REGS) {
|
||||||
int p;
|
int p;
|
||||||
|
|
||||||
OpEntry *opp = Yap_GetOpProp(op, PREFIX_OP PASS_REGS);
|
OpEntry *opp = Yap_GetOpProp(op, PREFIX_OP, cmod PASS_REGS);
|
||||||
if (!opp)
|
if (!opp)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (opp->OpModule && opp->OpModule != CurrentModule) {
|
if (opp->OpModule && opp->OpModule != cmod) {
|
||||||
READ_UNLOCK(opp->OpRWLock);
|
READ_UNLOCK(opp->OpRWLock);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -391,16 +391,16 @@ static int IsPrefixOp(Atom op, int *pptr, int *rpptr 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 PASS_REGS);
|
return IsPrefixOp(op, pptr, rpptr, CurrentModule PASS_REGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int IsInfixOp(Atom op, int *pptr, int *lpptr, int *rpptr USES_REGS) {
|
static int IsInfixOp(Atom op, int *pptr, int *lpptr, int *rpptr, Term cmod USES_REGS) {
|
||||||
int p;
|
int p;
|
||||||
|
|
||||||
OpEntry *opp = Yap_GetOpProp(op, INFIX_OP PASS_REGS);
|
OpEntry *opp = Yap_GetOpProp(op, INFIX_OP, cmod PASS_REGS);
|
||||||
if (!opp)
|
if (!opp)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (opp->OpModule && opp->OpModule != CurrentModule) {
|
if (opp->OpModule && opp->OpModule != cmod) {
|
||||||
READ_UNLOCK(opp->OpRWLock);
|
READ_UNLOCK(opp->OpRWLock);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -420,16 +420,16 @@ static int IsInfixOp(Atom op, int *pptr, int *lpptr, int *rpptr USES_REGS) {
|
|||||||
|
|
||||||
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 PASS_REGS);
|
return IsInfixOp(op, pptr, lpptr, rpptr, CurrentModule PASS_REGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int IsPosfixOp(Atom op, int *pptr, int *lpptr USES_REGS) {
|
static int IsPosfixOp(Atom op, int *pptr, int *lpptr, Term cmod USES_REGS) {
|
||||||
int p;
|
int p;
|
||||||
|
|
||||||
OpEntry *opp = Yap_GetOpProp(op, POSFIX_OP PASS_REGS);
|
OpEntry *opp = Yap_GetOpProp(op, POSFIX_OP, cmod PASS_REGS);
|
||||||
if (!opp)
|
if (!opp)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (opp->OpModule && opp->OpModule != CurrentModule) {
|
if (opp->OpModule && opp->OpModule != cmod) {
|
||||||
READ_UNLOCK(opp->OpRWLock);
|
READ_UNLOCK(opp->OpRWLock);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -447,7 +447,7 @@ static int IsPosfixOp(Atom op, int *pptr, int *lpptr 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 PASS_REGS);
|
return IsPosfixOp(op, pptr, lpptr, CurrentModule PASS_REGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static void GNextToken(USES_REGS1) {
|
inline static void GNextToken(USES_REGS1) {
|
||||||
@ -472,9 +472,9 @@ 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) {
|
static int is_quasi_quotation_syntax(Term goal, Atom *pat, Term cmod) {
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
Term m = CurrentModule, t;
|
Term m = cmod, t;
|
||||||
Atom at;
|
Atom at;
|
||||||
UInt arity;
|
UInt arity;
|
||||||
Functor f;
|
Functor f;
|
||||||
@ -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 USES_REGS) {
|
Term arg1, 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 PASS_REGS));
|
*tp++ = Unsigned(ParseTerm(999, FailBuff, 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))
|
||||||
@ -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 USES_REGS) {
|
static Term ParseList(JMPBUFF *FailBuff, 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 PASS_REGS);
|
to_store[0] = ParseTerm(999, FailBuff, 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,7 +641,7 @@ loop:
|
|||||||
}
|
}
|
||||||
} else if (((int)LOCAL_tokptr->TokInfo) == '|') {
|
} else if (((int)LOCAL_tokptr->TokInfo) == '|') {
|
||||||
NextToken;
|
NextToken;
|
||||||
to_store[1] = ParseTerm(999, FailBuff PASS_REGS);
|
to_store[1] = ParseTerm(999, FailBuff, cmod PASS_REGS);
|
||||||
} else {
|
} else {
|
||||||
to_store[1] = MkAtomTerm(AtomNil);
|
to_store[1] = MkAtomTerm(AtomNil);
|
||||||
}
|
}
|
||||||
@ -653,7 +653,7 @@ loop:
|
|||||||
return (o);
|
return (o);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Term ParseTerm(int prio, JMPBUFF *FailBuff USES_REGS) {
|
static Term ParseTerm(int prio, JMPBUFF *FailBuff, 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 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 PASS_REGS)) {
|
IsPrefixOp((Atom)t, &opprio, &oprprio, 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 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 PASS_REGS);
|
t = ParseTerm(oprprio, FailBuff, 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 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 PASS_REGS);
|
t = ParseArgs((Atom)t, ')', FailBuff, 0L, 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 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, CurrentModule, LOCAL_encoding PASS_REGS);
|
t = Yap_CharsToTDQ(p, cmod, LOCAL_encoding 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;
|
||||||
@ -764,7 +764,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff 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_WCharsToTDQ(p, CurrentModule PASS_REGS);
|
t = Yap_WCharsToTDQ(p, cmod PASS_REGS);
|
||||||
if (!t) {
|
if (!t) {
|
||||||
syntax_msg("line %d: could not convert \'%S\'",LOCAL_tokptr->TokPos, (wchar_t *)LOCAL_tokptr->TokInfo);
|
syntax_msg("line %d: could not convert \'%S\'",LOCAL_tokptr->TokPos, (wchar_t *)LOCAL_tokptr->TokInfo);
|
||||||
FAIL;
|
FAIL;
|
||||||
@ -780,7 +780,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff USES_REGS) {
|
|||||||
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_CharsToTBQ(p, CurrentModule, LOCAL_encoding PASS_REGS);
|
t = Yap_CharsToTBQ(p, cmod, LOCAL_encoding 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;
|
||||||
@ -792,7 +792,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff USES_REGS) {
|
|||||||
case WBQString_tok: /* build list on the heap */
|
case WBQString_tok: /* build list on the heap */
|
||||||
{
|
{
|
||||||
Volatile wchar_t *p = (wchar_t *)LOCAL_tokptr->TokInfo;
|
Volatile wchar_t *p = (wchar_t *)LOCAL_tokptr->TokInfo;
|
||||||
t = Yap_WCharsToTBQ(p, CurrentModule PASS_REGS);
|
t = Yap_WCharsToTBQ(p, cmod PASS_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;
|
||||||
@ -822,7 +822,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff USES_REGS) {
|
|||||||
case '(':
|
case '(':
|
||||||
case 'l': /* non solo ( */
|
case 'l': /* non solo ( */
|
||||||
NextToken;
|
NextToken;
|
||||||
t = ParseTerm(GLOBAL_MaxPriority, FailBuff PASS_REGS);
|
t = ParseTerm(GLOBAL_MaxPriority, FailBuff, cmod PASS_REGS);
|
||||||
checkfor(')', FailBuff PASS_REGS);
|
checkfor(')', FailBuff PASS_REGS);
|
||||||
break;
|
break;
|
||||||
case '[':
|
case '[':
|
||||||
@ -833,7 +833,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff USES_REGS) {
|
|||||||
NextToken;
|
NextToken;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
t = ParseList(FailBuff PASS_REGS);
|
t = ParseList(FailBuff, cmod PASS_REGS);
|
||||||
checkfor(']', FailBuff PASS_REGS);
|
checkfor(']', FailBuff PASS_REGS);
|
||||||
break;
|
break;
|
||||||
case '{':
|
case '{':
|
||||||
@ -844,7 +844,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff USES_REGS) {
|
|||||||
NextToken;
|
NextToken;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
t = ParseTerm(GLOBAL_MaxPriority, FailBuff PASS_REGS);
|
t = ParseTerm(GLOBAL_MaxPriority, FailBuff, 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) {
|
||||||
@ -896,7 +896,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff USES_REGS) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
NextToken;
|
NextToken;
|
||||||
t = ParseTerm(GLOBAL_MaxPriority, FailBuff PASS_REGS);
|
t = ParseTerm(GLOBAL_MaxPriority, FailBuff, 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));
|
||||||
@ -954,7 +954,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff 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 PASS_REGS) &&
|
if (IsInfixOp(save_opinfo, &opprio, &oplprio, &oprprio, 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 USES_REGS) {
|
|||||||
{
|
{
|
||||||
Term args[2];
|
Term args[2];
|
||||||
args[0] = t;
|
args[0] = t;
|
||||||
args[1] = ParseTerm(oprprio, FailBuff PASS_REGS);
|
args[1] = ParseTerm(oprprio, FailBuff, 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 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 PASS_REGS) && opprio <= prio &&
|
if (IsPosfixOp(opinfo, &opprio, &oplprio, 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 USES_REGS) {
|
|||||||
Volatile Term args[2];
|
Volatile Term args[2];
|
||||||
NextToken;
|
NextToken;
|
||||||
args[0] = t;
|
args[0] = t;
|
||||||
args[1] = ParseTerm(1000, FailBuff PASS_REGS);
|
args[1] = ParseTerm(1000, FailBuff, 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 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 PASS_REGS) &&
|
IsInfixOp(AtomVBar, &opprio, &oplprio, &oprprio, 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 PASS_REGS);
|
args[1] = ParseTerm(oprprio, FailBuff, 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,24 +1030,24 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff USES_REGS) {
|
|||||||
curprio = opprio;
|
curprio = opprio;
|
||||||
continue;
|
continue;
|
||||||
} else if (Unsigned(LOCAL_tokptr->TokInfo) == '(' &&
|
} else if (Unsigned(LOCAL_tokptr->TokInfo) == '(' &&
|
||||||
IsPosfixOp(AtomEmptyBrackets, &opprio, &oplprio PASS_REGS) &&
|
IsPosfixOp(AtomEmptyBrackets, &opprio, &oplprio, cmod PASS_REGS) &&
|
||||||
opprio <= prio && oplprio >= curprio) {
|
opprio <= prio && oplprio >= curprio) {
|
||||||
t = ParseArgs(AtomEmptyBrackets, ')', FailBuff, t PASS_REGS);
|
t = ParseArgs(AtomEmptyBrackets, ')', FailBuff, t, 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 PASS_REGS) &&
|
&oplprio, cmod PASS_REGS) &&
|
||||||
opprio <= prio && oplprio >= curprio) {
|
opprio <= prio && oplprio >= curprio) {
|
||||||
t = ParseArgs(AtomEmptySquareBrackets, ']', FailBuff, t PASS_REGS);
|
t = ParseArgs(AtomEmptySquareBrackets, ']', FailBuff, t, 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 PASS_REGS) &&
|
&oplprio, cmod PASS_REGS) &&
|
||||||
opprio <= prio && oplprio >= curprio) {
|
opprio <= prio && oplprio >= curprio) {
|
||||||
t = ParseArgs(AtomEmptyCurlyBrackets, '}', FailBuff, t PASS_REGS);
|
t = ParseArgs(AtomEmptyCurlyBrackets, '}', FailBuff, t, cmod PASS_REGS);
|
||||||
t = MakeAccessor(t, FunctorEmptyCurlyBrackets PASS_REGS);
|
t = MakeAccessor(t, FunctorEmptyCurlyBrackets PASS_REGS);
|
||||||
curprio = opprio;
|
curprio = opprio;
|
||||||
continue;
|
continue;
|
||||||
@ -1062,7 +1062,7 @@ static Term ParseTerm(int prio, JMPBUFF *FailBuff USES_REGS) {
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
Term Yap_Parse(UInt prio) {
|
Term Yap_Parse(UInt prio, 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) {
|
|||||||
|
|
||||||
if (!sigsetjmp(FailBuff.JmpBuff, 0)) {
|
if (!sigsetjmp(FailBuff.JmpBuff, 0)) {
|
||||||
|
|
||||||
t = ParseTerm(prio, &FailBuff PASS_REGS);
|
t = ParseTerm(prio, &FailBuff, 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, '[');
|
||||||
|
@ -391,7 +391,7 @@ INLINE_ONLY inline EXTERN PropFlags IsOpProperty(int flags) {
|
|||||||
|
|
||||||
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;
|
||||||
|
|
||||||
OpEntry *Yap_GetOpProp(Atom, op_type CACHE_TYPE);
|
OpEntry *Yap_GetOpProp(Atom, op_type, Term CACHE_TYPE);
|
||||||
|
|
||||||
int Yap_IsPrefixOp(Atom, int *, int *);
|
int Yap_IsPrefixOp(Atom, int *, int *);
|
||||||
int Yap_IsOp(Atom);
|
int Yap_IsOp(Atom);
|
||||||
|
Reference in New Issue
Block a user