remove support for confusing manipulation of $VAR
This commit is contained in:
parent
2bd2de1b9f
commit
e51de5f83c
@ -3652,7 +3652,7 @@ Term YAP_UnNumberVars(Term t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int YAP_IsNumberedVariable(Term t) {
|
int YAP_IsNumberedVariable(Term t) {
|
||||||
return IsApplTerm(t) && FunctorOfTerm(t) == FunctorVar &&
|
return IsApplTerm(t) && FunctorOfTerm(t) == FunctorDollarVar &&
|
||||||
IsIntegerTerm(ArgOfTerm(1, t));
|
IsIntegerTerm(ArgOfTerm(1, t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,7 +558,7 @@ static int p_grab_tokens() {
|
|||||||
char ch, IdChars[256], *chp;
|
char ch, IdChars[256], *chp;
|
||||||
|
|
||||||
IdFunctor = FunctorId;
|
IdFunctor = FunctorId;
|
||||||
VarFunctor = FunctorVar;
|
VarFunctor = FunctorDollarVar;
|
||||||
p0 = p;
|
p0 = p;
|
||||||
ch = Yap_PlGetchar();
|
ch = Yap_PlGetchar();
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -4584,7 +4584,7 @@ numbervar(Int id USES_REGS)
|
|||||||
{
|
{
|
||||||
Term ts[1];
|
Term ts[1];
|
||||||
ts[0] = MkIntegerTerm(id);
|
ts[0] = MkIntegerTerm(id);
|
||||||
return Yap_MkApplTerm(LOCAL_FunctorVar, 1, ts);
|
return Yap_MkApplTerm(FunctorDollarVar, 1, ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Term
|
static Term
|
||||||
@ -4592,7 +4592,7 @@ numbervar_singleton(USES_REGS1)
|
|||||||
{
|
{
|
||||||
Term ts[1];
|
Term ts[1];
|
||||||
ts[0] = MkIntegerTerm(-1);
|
ts[0] = MkIntegerTerm(-1);
|
||||||
return Yap_MkApplTerm(LOCAL_FunctorVar, 1, ts);
|
return Yap_MkApplTerm(FunctorDollarVar, 1, ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -4904,7 +4904,7 @@ unnumber_complex_term(CELL *pt0, CELL *pt0_end, CELL *ptf, CELL *HLow, int share
|
|||||||
*ptf++ = d0; /* you can just unnumber other extensions. */
|
*ptf++ = d0; /* you can just unnumber other extensions. */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (f == FunctorVar) {
|
if (f == FunctorDollarVar) {
|
||||||
Int id = IntegerOfTerm(ap2[1]);
|
Int id = IntegerOfTerm(ap2[1]);
|
||||||
ground = FALSE;
|
ground = FALSE;
|
||||||
if (id < -1) {
|
if (id < -1) {
|
||||||
|
11
C/write.c
11
C/write.c
@ -1117,14 +1117,17 @@ static void writeTerm(Term t, int p, int depth, int rinfixarg,
|
|||||||
if (op > p) {
|
if (op > p) {
|
||||||
wrclose_bracket(wglb, TRUE);
|
wrclose_bracket(wglb, TRUE);
|
||||||
}
|
}
|
||||||
} else if (wglb->Handle_vars && functor == LOCAL_FunctorVar) {
|
} else if ( functor == FunctorDollarVar) {
|
||||||
Term ti = ArgOfTerm(1, t);
|
Term ti = ArgOfTerm(1, t);
|
||||||
if (lastw == alphanum) {
|
if (lastw == alphanum) {
|
||||||
wrputc(' ', wglb->stream);
|
wrputc(' ', wglb->stream);
|
||||||
}
|
}
|
||||||
if (!IsVarTerm(ti) &&
|
if (wglb->Handle_vars &&
|
||||||
(IsIntTerm(ti) || IsCodesTerm(ti) ||
|
!IsVarTerm(ti) &&
|
||||||
IsAtomTerm(ti) || IsStringTerm(ti) )) {
|
(IsIntTerm(ti) ||
|
||||||
|
IsCodesTerm(ti) ||
|
||||||
|
IsAtomTerm(ti) ||
|
||||||
|
IsStringTerm(ti) )) {
|
||||||
if (IsIntTerm(ti)) {
|
if (IsIntTerm(ti)) {
|
||||||
Int k = IntOfTerm(ti);
|
Int k = IntOfTerm(ti);
|
||||||
if (k == -1) {
|
if (k == -1) {
|
||||||
|
@ -390,8 +390,8 @@
|
|||||||
AtomUserErr = Yap_LookupAtom("user_error");
|
AtomUserErr = Yap_LookupAtom("user_error");
|
||||||
AtomUserIn = Yap_LookupAtom("user_input");
|
AtomUserIn = Yap_LookupAtom("user_input");
|
||||||
AtomUserOut = Yap_LookupAtom("user_output");
|
AtomUserOut = Yap_LookupAtom("user_output");
|
||||||
|
AtomDollarVar = Yap_LookupAtom("$VAR");
|
||||||
AtomVBar = Yap_LookupAtom("|");
|
AtomVBar = Yap_LookupAtom("|");
|
||||||
AtomVar = Yap_FullLookupAtom("$VAR");
|
|
||||||
AtomVarBranches = Yap_LookupAtom("var_branches");
|
AtomVarBranches = Yap_LookupAtom("var_branches");
|
||||||
AtomVariableNames = Yap_LookupAtom("variable_names");
|
AtomVariableNames = Yap_LookupAtom("variable_names");
|
||||||
AtomHiddenVar = Yap_FullLookupAtom("$V");
|
AtomHiddenVar = Yap_FullLookupAtom("$V");
|
||||||
@ -443,6 +443,7 @@
|
|||||||
FunctorDoLogUpdClause0 = Yap_MkFunctor(AtomDoLogUpdClause0,6);
|
FunctorDoLogUpdClause0 = Yap_MkFunctor(AtomDoLogUpdClause0,6);
|
||||||
FunctorDoLogUpdClauseErase = Yap_MkFunctor(AtomDoLogUpdClauseErase,6);
|
FunctorDoLogUpdClauseErase = Yap_MkFunctor(AtomDoLogUpdClauseErase,6);
|
||||||
FunctorDoStaticClause = Yap_MkFunctor(AtomDoStaticClause,5);
|
FunctorDoStaticClause = Yap_MkFunctor(AtomDoStaticClause,5);
|
||||||
|
FunctorDollarVar = Yap_MkFunctor(AtomDollarVar,1);
|
||||||
FunctorDomainError = Yap_MkFunctor(AtomDomainError,2);
|
FunctorDomainError = Yap_MkFunctor(AtomDomainError,2);
|
||||||
FunctorDot = Yap_MkFunctor(AtomDot,2);
|
FunctorDot = Yap_MkFunctor(AtomDot,2);
|
||||||
FunctorDot10 = Yap_MkFunctor(AtomDot,10);
|
FunctorDot10 = Yap_MkFunctor(AtomDot,10);
|
||||||
@ -531,5 +532,4 @@
|
|||||||
FunctorUMinus = Yap_MkFunctor(AtomMinus,1);
|
FunctorUMinus = Yap_MkFunctor(AtomMinus,1);
|
||||||
FunctorUPlus = Yap_MkFunctor(AtomPlus,1);
|
FunctorUPlus = Yap_MkFunctor(AtomPlus,1);
|
||||||
FunctorVBar = Yap_MkFunctor(AtomVBar,2);
|
FunctorVBar = Yap_MkFunctor(AtomVBar,2);
|
||||||
FunctorVar = Yap_MkFunctor(AtomVar,1);
|
|
||||||
FunctorHiddenVar = Yap_MkFunctor(AtomHiddenVar,1);
|
FunctorHiddenVar = Yap_MkFunctor(AtomHiddenVar,1);
|
||||||
|
@ -133,6 +133,7 @@
|
|||||||
AtomFail = AtomAdjust(AtomFail);
|
AtomFail = AtomAdjust(AtomFail);
|
||||||
AtomFalse = AtomAdjust(AtomFalse);
|
AtomFalse = AtomAdjust(AtomFalse);
|
||||||
AtomFast = AtomAdjust(AtomFast);
|
AtomFast = AtomAdjust(AtomFast);
|
||||||
|
AtomFastFail = AtomAdjust(AtomFastFail);
|
||||||
AtomFileErrors = AtomAdjust(AtomFileErrors);
|
AtomFileErrors = AtomAdjust(AtomFileErrors);
|
||||||
AtomFileerrors = AtomAdjust(AtomFileerrors);
|
AtomFileerrors = AtomAdjust(AtomFileerrors);
|
||||||
AtomFileType = AtomAdjust(AtomFileType);
|
AtomFileType = AtomAdjust(AtomFileType);
|
||||||
@ -390,8 +391,8 @@
|
|||||||
AtomUserErr = AtomAdjust(AtomUserErr);
|
AtomUserErr = AtomAdjust(AtomUserErr);
|
||||||
AtomUserIn = AtomAdjust(AtomUserIn);
|
AtomUserIn = AtomAdjust(AtomUserIn);
|
||||||
AtomUserOut = AtomAdjust(AtomUserOut);
|
AtomUserOut = AtomAdjust(AtomUserOut);
|
||||||
|
AtomDollarVar = AtomAdjust(AtomDollarVar);
|
||||||
AtomVBar = AtomAdjust(AtomVBar);
|
AtomVBar = AtomAdjust(AtomVBar);
|
||||||
AtomVar = AtomAdjust(AtomVar);
|
|
||||||
AtomVarBranches = AtomAdjust(AtomVarBranches);
|
AtomVarBranches = AtomAdjust(AtomVarBranches);
|
||||||
AtomVariableNames = AtomAdjust(AtomVariableNames);
|
AtomVariableNames = AtomAdjust(AtomVariableNames);
|
||||||
AtomHiddenVar = AtomAdjust(AtomHiddenVar);
|
AtomHiddenVar = AtomAdjust(AtomHiddenVar);
|
||||||
@ -443,6 +444,7 @@
|
|||||||
FunctorDoLogUpdClause0 = FuncAdjust(FunctorDoLogUpdClause0);
|
FunctorDoLogUpdClause0 = FuncAdjust(FunctorDoLogUpdClause0);
|
||||||
FunctorDoLogUpdClauseErase = FuncAdjust(FunctorDoLogUpdClauseErase);
|
FunctorDoLogUpdClauseErase = FuncAdjust(FunctorDoLogUpdClauseErase);
|
||||||
FunctorDoStaticClause = FuncAdjust(FunctorDoStaticClause);
|
FunctorDoStaticClause = FuncAdjust(FunctorDoStaticClause);
|
||||||
|
FunctorDollarVar = FuncAdjust(FunctorDollarVar);
|
||||||
FunctorDomainError = FuncAdjust(FunctorDomainError);
|
FunctorDomainError = FuncAdjust(FunctorDomainError);
|
||||||
FunctorDot = FuncAdjust(FunctorDot);
|
FunctorDot = FuncAdjust(FunctorDot);
|
||||||
FunctorDot10 = FuncAdjust(FunctorDot10);
|
FunctorDot10 = FuncAdjust(FunctorDot10);
|
||||||
@ -531,5 +533,4 @@
|
|||||||
FunctorUMinus = FuncAdjust(FunctorUMinus);
|
FunctorUMinus = FuncAdjust(FunctorUMinus);
|
||||||
FunctorUPlus = FuncAdjust(FunctorUPlus);
|
FunctorUPlus = FuncAdjust(FunctorUPlus);
|
||||||
FunctorVBar = FuncAdjust(FunctorVBar);
|
FunctorVBar = FuncAdjust(FunctorVBar);
|
||||||
FunctorVar = FuncAdjust(FunctorVar);
|
|
||||||
FunctorHiddenVar = FuncAdjust(FunctorHiddenVar);
|
FunctorHiddenVar = FuncAdjust(FunctorHiddenVar);
|
||||||
|
10
H/tatoms.h
10
H/tatoms.h
@ -1166,12 +1166,12 @@
|
|||||||
Atom AtomUserOut_;
|
Atom AtomUserOut_;
|
||||||
#define AtomUserOut Yap_heap_regs->AtomUserOut_
|
#define AtomUserOut Yap_heap_regs->AtomUserOut_
|
||||||
#define TermUserOut MkAtomTerm( Yap_heap_regs->AtomUserOut_ )
|
#define TermUserOut MkAtomTerm( Yap_heap_regs->AtomUserOut_ )
|
||||||
|
Atom AtomDollarVar_;
|
||||||
|
#define AtomDollarVar Yap_heap_regs->AtomDollarVar_
|
||||||
|
#define TermDollarVar MkAtomTerm( Yap_heap_regs->AtomDollarVar_ )
|
||||||
Atom AtomVBar_;
|
Atom AtomVBar_;
|
||||||
#define AtomVBar Yap_heap_regs->AtomVBar_
|
#define AtomVBar Yap_heap_regs->AtomVBar_
|
||||||
#define TermVBar MkAtomTerm( Yap_heap_regs->AtomVBar_ )
|
#define TermVBar MkAtomTerm( Yap_heap_regs->AtomVBar_ )
|
||||||
Atom AtomVar_;
|
|
||||||
#define AtomVar Yap_heap_regs->AtomVar_
|
|
||||||
#define TermVar MkAtomTerm( Yap_heap_regs->AtomVar_ )
|
|
||||||
Atom AtomVarBranches_;
|
Atom AtomVarBranches_;
|
||||||
#define AtomVarBranches Yap_heap_regs->AtomVarBranches_
|
#define AtomVarBranches Yap_heap_regs->AtomVarBranches_
|
||||||
#define TermVarBranches MkAtomTerm( Yap_heap_regs->AtomVarBranches_ )
|
#define TermVarBranches MkAtomTerm( Yap_heap_regs->AtomVarBranches_ )
|
||||||
@ -1287,6 +1287,8 @@
|
|||||||
#define FunctorDoLogUpdClauseErase Yap_heap_regs->FunctorDoLogUpdClauseErase_
|
#define FunctorDoLogUpdClauseErase Yap_heap_regs->FunctorDoLogUpdClauseErase_
|
||||||
Functor FunctorDoStaticClause_;
|
Functor FunctorDoStaticClause_;
|
||||||
#define FunctorDoStaticClause Yap_heap_regs->FunctorDoStaticClause_
|
#define FunctorDoStaticClause Yap_heap_regs->FunctorDoStaticClause_
|
||||||
|
Functor FunctorDollarVar_;
|
||||||
|
#define FunctorDollarVar Yap_heap_regs->FunctorDollarVar_
|
||||||
Functor FunctorDomainError_;
|
Functor FunctorDomainError_;
|
||||||
#define FunctorDomainError Yap_heap_regs->FunctorDomainError_
|
#define FunctorDomainError Yap_heap_regs->FunctorDomainError_
|
||||||
Functor FunctorDot_;
|
Functor FunctorDot_;
|
||||||
@ -1463,7 +1465,5 @@
|
|||||||
#define FunctorUPlus Yap_heap_regs->FunctorUPlus_
|
#define FunctorUPlus Yap_heap_regs->FunctorUPlus_
|
||||||
Functor FunctorVBar_;
|
Functor FunctorVBar_;
|
||||||
#define FunctorVBar Yap_heap_regs->FunctorVBar_
|
#define FunctorVBar Yap_heap_regs->FunctorVBar_
|
||||||
Functor FunctorVar_;
|
|
||||||
#define FunctorVar Yap_heap_regs->FunctorVar_
|
|
||||||
Functor FunctorHiddenVar_;
|
Functor FunctorHiddenVar_;
|
||||||
#define FunctorHiddenVar Yap_heap_regs->FunctorHiddenVar_
|
#define FunctorHiddenVar Yap_heap_regs->FunctorHiddenVar_
|
||||||
|
@ -396,7 +396,6 @@ A UserErr N "user_error"
|
|||||||
A UserIn N "user_input"
|
A UserIn N "user_input"
|
||||||
A UserOut N "user_output"
|
A UserOut N "user_output"
|
||||||
A VBar N "|"
|
A VBar N "|"
|
||||||
A Var F "$VAR"
|
|
||||||
A VarBranches N "var_branches"
|
A VarBranches N "var_branches"
|
||||||
A VariableNames N "variable_names"
|
A VariableNames N "variable_names"
|
||||||
A HiddenVar F "$V"
|
A HiddenVar F "$V"
|
||||||
@ -448,6 +447,7 @@ F DoLogUpdClause DoLogUpdClause 6
|
|||||||
F DoLogUpdClause0 DoLogUpdClause0 6
|
F DoLogUpdClause0 DoLogUpdClause0 6
|
||||||
F DoLogUpdClauseErase DoLogUpdClauseErase 6
|
F DoLogUpdClauseErase DoLogUpdClauseErase 6
|
||||||
F DoStaticClause DoStaticClause 5
|
F DoStaticClause DoStaticClause 5
|
||||||
|
F DollarVar DollarVar 1
|
||||||
F DomainError DomainError 2
|
F DomainError DomainError 2
|
||||||
F Dot Dot 2
|
F Dot Dot 2
|
||||||
F Dot10 Dot 10
|
F Dot10 Dot 10
|
||||||
@ -536,6 +536,5 @@ F TypeError TypeError 2
|
|||||||
F UMinus Minus 1
|
F UMinus Minus 1
|
||||||
F UPlus Plus 1
|
F UPlus Plus 1
|
||||||
F VBar VBar 2
|
F VBar VBar 2
|
||||||
F Var Var 1
|
|
||||||
F HiddenVar HiddenVar 1
|
F HiddenVar HiddenVar 1
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ bind_variable_names(Term t USES_REGS)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
t2 = ArgOfTerm(2, tl);
|
t2 = ArgOfTerm(2, tl);
|
||||||
tv = Yap_MkApplTerm(LOCAL_FunctorVar, 1, &t1);
|
tv = Yap_MkApplTerm(FunctorDollarVar, 1, &t1);
|
||||||
if (IsVarTerm(t2)) {
|
if (IsVarTerm(t2)) {
|
||||||
Bind(VarOfTerm(t2), tv);
|
Bind(VarOfTerm(t2), tv);
|
||||||
}
|
}
|
||||||
@ -746,7 +746,7 @@ dollar_var( USES_REGS1 )
|
|||||||
Term t2;
|
Term t2;
|
||||||
if (!IsVarTerm(t2=Deref(ARG2))) {
|
if (!IsVarTerm(t2=Deref(ARG2))) {
|
||||||
if (IsApplTerm(t2) &&
|
if (IsApplTerm(t2) &&
|
||||||
FunctorOfTerm( t2 ) == LOCAL_FunctorVar ) {
|
FunctorOfTerm( t2 ) == FunctorDollarVar ) {
|
||||||
return Yap_unify(ArgOfTerm(1, t2), ARG1);
|
return Yap_unify(ArgOfTerm(1, t2), ARG1);
|
||||||
}
|
}
|
||||||
Yap_Error( TYPE_ERROR_COMPOUND, ARG2 , "");
|
Yap_Error( TYPE_ERROR_COMPOUND, ARG2 , "");
|
||||||
@ -756,7 +756,7 @@ dollar_var( USES_REGS1 )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Term t2 = Yap_unify( MkVarTerm(), ARG1);
|
Term t2 = Yap_unify( MkVarTerm(), ARG1);
|
||||||
Term tv = Yap_MkApplTerm(LOCAL_FunctorVar, 1, &t2);
|
Term tv = Yap_MkApplTerm(FunctorDollarVar, 1, &t2);
|
||||||
return Yap_unify(tv, ARG2);
|
return Yap_unify(tv, ARG2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user