fix write_canonical of $VAR(_).
This commit is contained in:
parent
f2782cc274
commit
0c1eb1d642
@ -623,7 +623,8 @@ currentOperator(Module m, atom_t name, int kind, int *type, int *priority)
|
|||||||
|
|
||||||
int
|
int
|
||||||
numberVars(term_t t, nv_options *opts, int n ARG_LD) {
|
numberVars(term_t t, nv_options *opts, int n ARG_LD) {
|
||||||
return Yap_NumberVars(YAP_GetFromSlot(t), n, TRUE);
|
|
||||||
|
return Yap_NumberVars(YAP_GetFromSlot(t), n, opts->singletons);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************
|
/*******************************
|
||||||
|
@ -4254,7 +4254,7 @@ numbervar(Int id)
|
|||||||
{
|
{
|
||||||
Term ts[1];
|
Term ts[1];
|
||||||
ts[0] = MkIntegerTerm(id);
|
ts[0] = MkIntegerTerm(id);
|
||||||
return Yap_MkApplTerm(FunctorVar, 1, ts);
|
return Yap_MkApplTerm(LOCAL_FunctorVar, 1, ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Term
|
static Term
|
||||||
@ -4262,7 +4262,7 @@ numbervar_singleton(void)
|
|||||||
{
|
{
|
||||||
Term ts[1];
|
Term ts[1];
|
||||||
ts[0] = MkIntegerTerm(-1);
|
ts[0] = MkIntegerTerm(-1);
|
||||||
return Yap_MkApplTerm(FunctorVar, 1, ts);
|
return Yap_MkApplTerm(LOCAL_FunctorVar, 1, ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1013,7 +1013,7 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
|
|||||||
wrputc(')', wglb->stream);
|
wrputc(')', wglb->stream);
|
||||||
lastw = separator;
|
lastw = separator;
|
||||||
}
|
}
|
||||||
} else if (wglb->Handle_vars && functor == FunctorVar) {
|
} else if (wglb->Handle_vars && functor == LOCAL_FunctorVar) {
|
||||||
Term ti = ArgOfTerm(1, t);
|
Term ti = ArgOfTerm(1, t);
|
||||||
if (lastw == alphanum) {
|
if (lastw == alphanum) {
|
||||||
wrputc(' ', wglb->stream);
|
wrputc(' ', wglb->stream);
|
||||||
|
@ -427,4 +427,6 @@
|
|||||||
#define LOCAL_FPreds LOCAL->FPreds_
|
#define LOCAL_FPreds LOCAL->FPreds_
|
||||||
#define REMOTE_FPreds(wid) REMOTE(wid)->FPreds_
|
#define REMOTE_FPreds(wid) REMOTE(wid)->FPreds_
|
||||||
#endif /* LOW_PROF */
|
#endif /* LOW_PROF */
|
||||||
|
#define LOCAL_FunctorVar LOCAL->FunctorVar_
|
||||||
|
#define REMOTE_FunctorVar(wid) REMOTE(wid)->FunctorVar_
|
||||||
|
|
||||||
|
@ -240,4 +240,5 @@ typedef struct worker_local {
|
|||||||
FILE* FProf_;
|
FILE* FProf_;
|
||||||
FILE* FPreds_;
|
FILE* FPreds_;
|
||||||
#endif /* LOW_PROF */
|
#endif /* LOW_PROF */
|
||||||
|
Functor FunctorVar_;
|
||||||
} w_local;
|
} w_local;
|
||||||
|
@ -311,6 +311,7 @@
|
|||||||
AtomUserOut = Yap_LookupAtom("user_output");
|
AtomUserOut = Yap_LookupAtom("user_output");
|
||||||
AtomVBar = Yap_LookupAtom("|");
|
AtomVBar = Yap_LookupAtom("|");
|
||||||
AtomVar = Yap_FullLookupAtom("$VAR");
|
AtomVar = Yap_FullLookupAtom("$VAR");
|
||||||
|
AtomHiddenVar = Yap_FullLookupAtom("$V");
|
||||||
AtomVariable = Yap_LookupAtom("variable");
|
AtomVariable = Yap_LookupAtom("variable");
|
||||||
AtomVersionNumber = Yap_FullLookupAtom("$version_name");
|
AtomVersionNumber = Yap_FullLookupAtom("$version_name");
|
||||||
AtomWakeUpGoal = Yap_FullLookupAtom("$wake_up_goal");
|
AtomWakeUpGoal = Yap_FullLookupAtom("$wake_up_goal");
|
||||||
@ -428,3 +429,4 @@
|
|||||||
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);
|
FunctorVar = Yap_MkFunctor(AtomVar,1);
|
||||||
|
FunctorHiddenVar = Yap_MkFunctor(AtomHiddenVar,1);
|
||||||
|
@ -240,4 +240,5 @@ static void InitWorker(int wid) {
|
|||||||
REMOTE_FProf(wid) = NULL;
|
REMOTE_FProf(wid) = NULL;
|
||||||
REMOTE_FPreds(wid) = NULL;
|
REMOTE_FPreds(wid) = NULL;
|
||||||
#endif /* LOW_PROF */
|
#endif /* LOW_PROF */
|
||||||
|
REMOTE_FunctorVar(wid) = FunctorVar;
|
||||||
}
|
}
|
||||||
|
@ -311,6 +311,7 @@
|
|||||||
AtomUserOut = AtomAdjust(AtomUserOut);
|
AtomUserOut = AtomAdjust(AtomUserOut);
|
||||||
AtomVBar = AtomAdjust(AtomVBar);
|
AtomVBar = AtomAdjust(AtomVBar);
|
||||||
AtomVar = AtomAdjust(AtomVar);
|
AtomVar = AtomAdjust(AtomVar);
|
||||||
|
AtomHiddenVar = AtomAdjust(AtomHiddenVar);
|
||||||
AtomVariable = AtomAdjust(AtomVariable);
|
AtomVariable = AtomAdjust(AtomVariable);
|
||||||
AtomVersionNumber = AtomAdjust(AtomVersionNumber);
|
AtomVersionNumber = AtomAdjust(AtomVersionNumber);
|
||||||
AtomWakeUpGoal = AtomAdjust(AtomWakeUpGoal);
|
AtomWakeUpGoal = AtomAdjust(AtomWakeUpGoal);
|
||||||
@ -428,3 +429,4 @@
|
|||||||
FunctorUPlus = FuncAdjust(FunctorUPlus);
|
FunctorUPlus = FuncAdjust(FunctorUPlus);
|
||||||
FunctorVBar = FuncAdjust(FunctorVBar);
|
FunctorVBar = FuncAdjust(FunctorVBar);
|
||||||
FunctorVar = FuncAdjust(FunctorVar);
|
FunctorVar = FuncAdjust(FunctorVar);
|
||||||
|
FunctorHiddenVar = FuncAdjust(FunctorHiddenVar);
|
||||||
|
@ -240,4 +240,5 @@ static void RestoreWorker(int wid USES_REGS) {
|
|||||||
|
|
||||||
|
|
||||||
#endif /* LOW_PROF */
|
#endif /* LOW_PROF */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -620,6 +620,8 @@
|
|||||||
#define AtomVBar Yap_heap_regs->AtomVBar_
|
#define AtomVBar Yap_heap_regs->AtomVBar_
|
||||||
Atom AtomVar_;
|
Atom AtomVar_;
|
||||||
#define AtomVar Yap_heap_regs->AtomVar_
|
#define AtomVar Yap_heap_regs->AtomVar_
|
||||||
|
Atom AtomHiddenVar_;
|
||||||
|
#define AtomHiddenVar Yap_heap_regs->AtomHiddenVar_
|
||||||
Atom AtomVariable_;
|
Atom AtomVariable_;
|
||||||
#define AtomVariable Yap_heap_regs->AtomVariable_
|
#define AtomVariable Yap_heap_regs->AtomVariable_
|
||||||
Atom AtomVersionNumber_;
|
Atom AtomVersionNumber_;
|
||||||
@ -854,3 +856,5 @@
|
|||||||
#define FunctorVBar Yap_heap_regs->FunctorVBar_
|
#define FunctorVBar Yap_heap_regs->FunctorVBar_
|
||||||
Functor FunctorVar_;
|
Functor FunctorVar_;
|
||||||
#define FunctorVar Yap_heap_regs->FunctorVar_
|
#define FunctorVar Yap_heap_regs->FunctorVar_
|
||||||
|
Functor FunctorHiddenVar_;
|
||||||
|
#define FunctorHiddenVar Yap_heap_regs->FunctorHiddenVar_
|
||||||
|
@ -316,6 +316,7 @@ 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 Var F "$VAR"
|
||||||
|
A HiddenVar F "$V"
|
||||||
A Variable N "variable"
|
A Variable N "variable"
|
||||||
A VersionNumber F "$version_name"
|
A VersionNumber F "$version_name"
|
||||||
A WakeUpGoal F "$wake_up_goal"
|
A WakeUpGoal F "$wake_up_goal"
|
||||||
@ -433,4 +434,5 @@ 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 Var Var 1
|
||||||
|
F HiddenVar HiddenVar 1
|
||||||
|
|
||||||
|
@ -269,4 +269,6 @@ FILE* FProf =NULL
|
|||||||
FILE* FPreds =NULL
|
FILE* FPreds =NULL
|
||||||
#endif /* LOW_PROF */
|
#endif /* LOW_PROF */
|
||||||
|
|
||||||
|
Functor FunctorVar =FunctorVar
|
||||||
|
|
||||||
END_WORKER_LOCAL
|
END_WORKER_LOCAL
|
||||||
|
@ -490,9 +490,15 @@ pl_write_canonical2(term_t stream, term_t term)
|
|||||||
options.functor = FUNCTOR_isovar1;
|
options.functor = FUNCTOR_isovar1;
|
||||||
options.on_attvar = AV_SKIP;
|
options.on_attvar = AV_SKIP;
|
||||||
options.singletons = TRUE;
|
options.singletons = TRUE;
|
||||||
|
#if __YAP_PROLOG__
|
||||||
|
LOCAL_FunctorVar = FunctorHiddenVar;
|
||||||
|
#endif
|
||||||
numberVars(term, &options, 0 PASS_LD);
|
numberVars(term, &options, 0 PASS_LD);
|
||||||
rc = do_write2(stream, term,
|
rc = do_write2(stream, term,
|
||||||
PL_WRT_QUOTED|PL_WRT_IGNOREOPS|PL_WRT_NUMBERVARS);
|
PL_WRT_QUOTED|PL_WRT_IGNOREOPS|PL_WRT_NUMBERVARS);
|
||||||
|
#if __YAP_PROLOG__
|
||||||
|
LOCAL_FunctorVar = FunctorVar;
|
||||||
|
#endif
|
||||||
PL_discard_foreign_frame(fid);
|
PL_discard_foreign_frame(fid);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
Reference in New Issue
Block a user