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
|
||||
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];
|
||||
ts[0] = MkIntegerTerm(id);
|
||||
return Yap_MkApplTerm(FunctorVar, 1, ts);
|
||||
return Yap_MkApplTerm(LOCAL_FunctorVar, 1, ts);
|
||||
}
|
||||
|
||||
static Term
|
||||
@ -4262,7 +4262,7 @@ numbervar_singleton(void)
|
||||
{
|
||||
Term ts[1];
|
||||
ts[0] = MkIntegerTerm(-1);
|
||||
return Yap_MkApplTerm(FunctorVar, 1, ts);
|
||||
return Yap_MkApplTerm(LOCAL_FunctorVar, 1, ts);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1013,7 +1013,7 @@ writeTerm(Term t, int p, int depth, int rinfixarg, struct write_globs *wglb, str
|
||||
wrputc(')', wglb->stream);
|
||||
lastw = separator;
|
||||
}
|
||||
} else if (wglb->Handle_vars && functor == FunctorVar) {
|
||||
} else if (wglb->Handle_vars && functor == LOCAL_FunctorVar) {
|
||||
Term ti = ArgOfTerm(1, t);
|
||||
if (lastw == alphanum) {
|
||||
wrputc(' ', wglb->stream);
|
||||
|
@ -427,4 +427,6 @@
|
||||
#define LOCAL_FPreds LOCAL->FPreds_
|
||||
#define REMOTE_FPreds(wid) REMOTE(wid)->FPreds_
|
||||
#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* FPreds_;
|
||||
#endif /* LOW_PROF */
|
||||
Functor FunctorVar_;
|
||||
} w_local;
|
||||
|
@ -311,6 +311,7 @@
|
||||
AtomUserOut = Yap_LookupAtom("user_output");
|
||||
AtomVBar = Yap_LookupAtom("|");
|
||||
AtomVar = Yap_FullLookupAtom("$VAR");
|
||||
AtomHiddenVar = Yap_FullLookupAtom("$V");
|
||||
AtomVariable = Yap_LookupAtom("variable");
|
||||
AtomVersionNumber = Yap_FullLookupAtom("$version_name");
|
||||
AtomWakeUpGoal = Yap_FullLookupAtom("$wake_up_goal");
|
||||
@ -428,3 +429,4 @@
|
||||
FunctorUPlus = Yap_MkFunctor(AtomPlus,1);
|
||||
FunctorVBar = Yap_MkFunctor(AtomVBar,2);
|
||||
FunctorVar = Yap_MkFunctor(AtomVar,1);
|
||||
FunctorHiddenVar = Yap_MkFunctor(AtomHiddenVar,1);
|
||||
|
@ -240,4 +240,5 @@ static void InitWorker(int wid) {
|
||||
REMOTE_FProf(wid) = NULL;
|
||||
REMOTE_FPreds(wid) = NULL;
|
||||
#endif /* LOW_PROF */
|
||||
REMOTE_FunctorVar(wid) = FunctorVar;
|
||||
}
|
||||
|
@ -311,6 +311,7 @@
|
||||
AtomUserOut = AtomAdjust(AtomUserOut);
|
||||
AtomVBar = AtomAdjust(AtomVBar);
|
||||
AtomVar = AtomAdjust(AtomVar);
|
||||
AtomHiddenVar = AtomAdjust(AtomHiddenVar);
|
||||
AtomVariable = AtomAdjust(AtomVariable);
|
||||
AtomVersionNumber = AtomAdjust(AtomVersionNumber);
|
||||
AtomWakeUpGoal = AtomAdjust(AtomWakeUpGoal);
|
||||
@ -428,3 +429,4 @@
|
||||
FunctorUPlus = FuncAdjust(FunctorUPlus);
|
||||
FunctorVBar = FuncAdjust(FunctorVBar);
|
||||
FunctorVar = FuncAdjust(FunctorVar);
|
||||
FunctorHiddenVar = FuncAdjust(FunctorHiddenVar);
|
||||
|
@ -240,4 +240,5 @@ static void RestoreWorker(int wid USES_REGS) {
|
||||
|
||||
|
||||
#endif /* LOW_PROF */
|
||||
|
||||
}
|
||||
|
@ -620,6 +620,8 @@
|
||||
#define AtomVBar Yap_heap_regs->AtomVBar_
|
||||
Atom AtomVar_;
|
||||
#define AtomVar Yap_heap_regs->AtomVar_
|
||||
Atom AtomHiddenVar_;
|
||||
#define AtomHiddenVar Yap_heap_regs->AtomHiddenVar_
|
||||
Atom AtomVariable_;
|
||||
#define AtomVariable Yap_heap_regs->AtomVariable_
|
||||
Atom AtomVersionNumber_;
|
||||
@ -854,3 +856,5 @@
|
||||
#define FunctorVBar Yap_heap_regs->FunctorVBar_
|
||||
Functor 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 VBar N "|"
|
||||
A Var F "$VAR"
|
||||
A HiddenVar F "$V"
|
||||
A Variable N "variable"
|
||||
A VersionNumber F "$version_name"
|
||||
A WakeUpGoal F "$wake_up_goal"
|
||||
@ -433,4 +434,5 @@ F UMinus Minus 1
|
||||
F UPlus Plus 1
|
||||
F VBar VBar 2
|
||||
F Var Var 1
|
||||
F HiddenVar HiddenVar 1
|
||||
|
||||
|
@ -269,4 +269,6 @@ FILE* FProf =NULL
|
||||
FILE* FPreds =NULL
|
||||
#endif /* LOW_PROF */
|
||||
|
||||
Functor FunctorVar =FunctorVar
|
||||
|
||||
END_WORKER_LOCAL
|
||||
|
@ -490,9 +490,15 @@ pl_write_canonical2(term_t stream, term_t term)
|
||||
options.functor = FUNCTOR_isovar1;
|
||||
options.on_attvar = AV_SKIP;
|
||||
options.singletons = TRUE;
|
||||
#if __YAP_PROLOG__
|
||||
LOCAL_FunctorVar = FunctorHiddenVar;
|
||||
#endif
|
||||
numberVars(term, &options, 0 PASS_LD);
|
||||
rc = do_write2(stream, term,
|
||||
PL_WRT_QUOTED|PL_WRT_IGNOREOPS|PL_WRT_NUMBERVARS);
|
||||
#if __YAP_PROLOG__
|
||||
LOCAL_FunctorVar = FunctorVar;
|
||||
#endif
|
||||
PL_discard_foreign_frame(fid);
|
||||
|
||||
return rc;
|
||||
|
Reference in New Issue
Block a user