use DebugPlWrite for debugging writes

This commit is contained in:
Vitor Santos Costa 2009-05-22 13:23:51 -05:00
parent 328e2f5c22
commit e1421f207e
2 changed files with 34 additions and 34 deletions

View File

@ -117,14 +117,14 @@ DumpActiveGoals (void)
if (first++ == 1) if (first++ == 1)
fprintf(stderr,"Active ancestors:\n"); fprintf(stderr,"Active ancestors:\n");
if (pe->ModuleOfPred) mod = pe->ModuleOfPred; if (pe->ModuleOfPred) mod = pe->ModuleOfPred;
Yap_plwrite (mod, Yap_DebugPutc, 0); Yap_DebugPlWrite (mod);
Yap_DebugPutc (Yap_c_error_stream,':'); Yap_DebugPutc (Yap_c_error_stream,':');
if (pe->ArityOfPE == 0) { if (pe->ArityOfPE == 0) {
Yap_plwrite (MkAtomTerm ((Atom)f), Yap_DebugPutc, 0); Yap_DebugPlWrite (MkAtomTerm ((Atom)f));
} else { } else {
Yap_plwrite (MkAtomTerm (NameOfFunctor (f)), Yap_DebugPutc, 0); Yap_DebugPlWrite (MkAtomTerm (NameOfFunctor (f)));
Yap_DebugPutc (Yap_c_error_stream,'/'); Yap_DebugPutc (Yap_c_error_stream,'/');
Yap_plwrite (MkIntTerm (ArityOfFunctor (f)), Yap_DebugPutc, 0); Yap_DebugPlWrite (MkIntTerm (ArityOfFunctor (f)));
} }
Yap_DebugPutc (Yap_c_error_stream,'\n'); Yap_DebugPutc (Yap_c_error_stream,'\n');
} else { } else {
@ -151,18 +151,18 @@ DumpActiveGoals (void)
if (pe->ModuleOfPred) if (pe->ModuleOfPred)
mod = pe->ModuleOfPred; mod = pe->ModuleOfPred;
else mod = TermProlog; else mod = TermProlog;
Yap_plwrite (mod, Yap_DebugPutc, 0); Yap_DebugPlWrite (mod);
Yap_DebugPutc (Yap_c_error_stream,':'); Yap_DebugPutc (Yap_c_error_stream,':');
if (pe->ArityOfPE == 0) { if (pe->ArityOfPE == 0) {
Yap_plwrite (MkAtomTerm (NameOfFunctor(f)), Yap_DebugPutc, 0); Yap_DebugPlWrite (MkAtomTerm (NameOfFunctor(f)));
} else { } else {
Int i = 0, arity = pe->ArityOfPE; Int i = 0, arity = pe->ArityOfPE;
Term *args = &(b_ptr->cp_a1); Term *args = &(b_ptr->cp_a1);
Yap_plwrite (MkAtomTerm (NameOfFunctor (f)), Yap_DebugPutc, 0); Yap_DebugPlWrite (MkAtomTerm (NameOfFunctor (f)));
Yap_DebugPutc (Yap_c_error_stream,'('); Yap_DebugPutc (Yap_c_error_stream,'(');
for (i= 0; i < arity; i++) { for (i= 0; i < arity; i++) {
if (i > 0) Yap_DebugPutc (Yap_c_error_stream,','); if (i > 0) Yap_DebugPutc (Yap_c_error_stream,',');
Yap_plwrite(args[i], Yap_DebugPutc, Handle_vars_f); Yap_DebugPlWrite(args[i]);
} }
Yap_DebugPutc (Yap_c_error_stream,')'); Yap_DebugPutc (Yap_c_error_stream,')');
} }

View File

@ -4447,42 +4447,42 @@ ExpandIndex(PredEntry *ap, int ExtraArgs) {
Yap_LockStream(Yap_c_error_stream); Yap_LockStream(Yap_c_error_stream);
if (!tmod) tmod = TermProlog; if (!tmod) tmod = TermProlog;
#if THREADS #if THREADS
Yap_plwrite(MkIntegerTerm(worker_id), Yap_DebugPutc, 0); Yap_DebugPlWrite(MkIntegerTerm(worker_id));
Yap_DebugPutc(Yap_c_error_stream,' '); Yap_DebugPutc(Yap_c_error_stream,' ');
#endif #endif
Yap_DebugPutc(Yap_c_error_stream,'>'); Yap_DebugPutc(Yap_c_error_stream,'>');
Yap_DebugPutc(Yap_c_error_stream,'\t'); Yap_DebugPutc(Yap_c_error_stream,'\t');
Yap_plwrite(tmod, Yap_DebugPutc, 0); Yap_DebugPlWrite(tmod);
Yap_DebugPutc(Yap_c_error_stream,':'); Yap_DebugPutc(Yap_c_error_stream,':');
if (ap->ModuleOfPred == IDB_MODULE) { if (ap->ModuleOfPred == IDB_MODULE) {
Term t = Deref(ARG1); Term t = Deref(ARG1);
if (IsAtomTerm(t)) { if (IsAtomTerm(t)) {
Yap_plwrite(t, Yap_DebugPutc, 0); Yap_DebugPlWrite(t);
} else if (IsIntegerTerm(t)) { } else if (IsIntegerTerm(t)) {
Yap_plwrite(t, Yap_DebugPutc, 0); Yap_DebugPlWrite(t);
} else { } else {
Functor f = FunctorOfTerm(t); Functor f = FunctorOfTerm(t);
Atom At = NameOfFunctor(f); Atom At = NameOfFunctor(f);
Yap_plwrite(MkAtomTerm(At), Yap_DebugPutc, 0); Yap_DebugPlWrite(MkAtomTerm(At));
Yap_DebugPutc(Yap_c_error_stream,'/'); Yap_DebugPutc(Yap_c_error_stream,'/');
Yap_plwrite(MkIntegerTerm(ArityOfFunctor(f)), Yap_DebugPutc, 0); Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
} }
} else { } else {
if (ap->ArityOfPE == 0) { if (ap->ArityOfPE == 0) {
Atom At = (Atom)ap->FunctorOfPred; Atom At = (Atom)ap->FunctorOfPred;
Yap_plwrite(MkAtomTerm(At), Yap_DebugPutc, 0); Yap_DebugPlWrite(MkAtomTerm(At));
} else { } else {
Functor f = ap->FunctorOfPred; Functor f = ap->FunctorOfPred;
Atom At = NameOfFunctor(f); Atom At = NameOfFunctor(f);
Yap_plwrite(MkAtomTerm(At), Yap_DebugPutc, 0); Yap_DebugPlWrite(MkAtomTerm(At));
Yap_DebugPutc(Yap_c_error_stream,'/'); Yap_DebugPutc(Yap_c_error_stream,'/');
Yap_plwrite(MkIntegerTerm(ArityOfFunctor(f)), Yap_DebugPutc, 0); Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
} }
Yap_UnLockStream(Yap_c_error_stream); Yap_UnLockStream(Yap_c_error_stream);
} }
Yap_DebugPutc(Yap_c_error_stream,'\n'); Yap_DebugPutc(Yap_c_error_stream,'\n');
#if THREADS #if THREADS
Yap_plwrite(MkIntegerTerm(worker_id), Yap_DebugPutc, 0); Yap_DebugPlWrite(MkIntegerTerm(worker_id));
Yap_DebugPutc(Yap_c_error_stream,' '); Yap_DebugPutc(Yap_c_error_stream,' ');
#endif #endif
Yap_UnLockStream(Yap_c_error_stream); Yap_UnLockStream(Yap_c_error_stream);
@ -5919,31 +5919,31 @@ Yap_AddClauseToIndex(PredEntry *ap, yamop *beg, int first) {
if (!tmod) tmod = TermProlog; if (!tmod) tmod = TermProlog;
Yap_DebugPutc(Yap_c_error_stream,'+'); Yap_DebugPutc(Yap_c_error_stream,'+');
Yap_DebugPutc(Yap_c_error_stream,'\t'); Yap_DebugPutc(Yap_c_error_stream,'\t');
Yap_plwrite(tmod, Yap_DebugPutc, 0); Yap_DebugPlWrite(tmod);
Yap_DebugPutc(Yap_c_error_stream,':'); Yap_DebugPutc(Yap_c_error_stream,':');
if (ap->ModuleOfPred == IDB_MODULE) { if (ap->ModuleOfPred == IDB_MODULE) {
Term t = Deref(ARG1); Term t = Deref(ARG1);
if (IsAtomTerm(t)) { if (IsAtomTerm(t)) {
Yap_plwrite(t, Yap_DebugPutc, 0); Yap_DebugPlWrite(t);
} else if (IsIntegerTerm(t)) { } else if (IsIntegerTerm(t)) {
Yap_plwrite(t, Yap_DebugPutc, 0); Yap_DebugPlWrite(t);
} else { } else {
Functor f = FunctorOfTerm(t); Functor f = FunctorOfTerm(t);
Atom At = NameOfFunctor(f); Atom At = NameOfFunctor(f);
Yap_plwrite(MkAtomTerm(At), Yap_DebugPutc, 0); Yap_DebugPlWrite(MkAtomTerm(At));
Yap_DebugPutc(Yap_c_error_stream,'/'); Yap_DebugPutc(Yap_c_error_stream,'/');
Yap_plwrite(MkIntegerTerm(ArityOfFunctor(f)), Yap_DebugPutc, 0); Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
} }
} else { } else {
if (ap->ArityOfPE == 0) { if (ap->ArityOfPE == 0) {
Atom At = (Atom)ap->FunctorOfPred; Atom At = (Atom)ap->FunctorOfPred;
Yap_plwrite(MkAtomTerm(At), Yap_DebugPutc, 0); Yap_DebugPlWrite(MkAtomTerm(At));
} else { } else {
Functor f = ap->FunctorOfPred; Functor f = ap->FunctorOfPred;
Atom At = NameOfFunctor(f); Atom At = NameOfFunctor(f);
Yap_plwrite(MkAtomTerm(At), Yap_DebugPutc, 0); Yap_DebugPlWrite(MkAtomTerm(At));
Yap_DebugPutc(Yap_c_error_stream,'/'); Yap_DebugPutc(Yap_c_error_stream,'/');
Yap_plwrite(MkIntegerTerm(ArityOfFunctor(f)), Yap_DebugPutc, 0); Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
} }
} }
Yap_DebugPutc(Yap_c_error_stream,'\n'); Yap_DebugPutc(Yap_c_error_stream,'\n');
@ -6414,32 +6414,32 @@ Yap_RemoveClauseFromIndex(PredEntry *ap, yamop *beg) {
Yap_LockStream(Yap_c_error_stream); Yap_LockStream(Yap_c_error_stream);
Yap_DebugPutc(Yap_c_error_stream,'-'); Yap_DebugPutc(Yap_c_error_stream,'-');
Yap_DebugPutc(Yap_c_error_stream,'\t'); Yap_DebugPutc(Yap_c_error_stream,'\t');
Yap_plwrite(tmod, Yap_DebugPutc, 0); Yap_DebugPlWrite(tmod);
Yap_DebugPutc(Yap_c_error_stream,':'); Yap_DebugPutc(Yap_c_error_stream,':');
if (ap->ModuleOfPred != IDB_MODULE) { if (ap->ModuleOfPred != IDB_MODULE) {
if (ap->ArityOfPE == 0) { if (ap->ArityOfPE == 0) {
Atom At = (Atom)ap->FunctorOfPred; Atom At = (Atom)ap->FunctorOfPred;
Yap_plwrite(MkAtomTerm(At), Yap_DebugPutc, 0); Yap_DebugPlWrite(MkAtomTerm(At));
} else { } else {
Functor f = ap->FunctorOfPred; Functor f = ap->FunctorOfPred;
Atom At = NameOfFunctor(f); Atom At = NameOfFunctor(f);
Yap_plwrite(MkAtomTerm(At), Yap_DebugPutc, 0); Yap_DebugPlWrite(MkAtomTerm(At));
Yap_DebugPutc(Yap_c_error_stream,'/'); Yap_DebugPutc(Yap_c_error_stream,'/');
Yap_plwrite(MkIntegerTerm(ArityOfFunctor(f)), Yap_DebugPutc, 0); Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
} }
} else { } else {
if (ap->PredFlags & NumberDBPredFlag) { if (ap->PredFlags & NumberDBPredFlag) {
Int id = ap->src.IndxId; Int id = ap->src.IndxId;
Yap_plwrite(MkIntegerTerm(id), Yap_DebugPutc, 0); Yap_DebugPlWrite(MkIntegerTerm(id));
} else if (ap->PredFlags & AtomDBPredFlag) { } else if (ap->PredFlags & AtomDBPredFlag) {
Atom At = (Atom)ap->FunctorOfPred; Atom At = (Atom)ap->FunctorOfPred;
Yap_plwrite(MkAtomTerm(At), Yap_DebugPutc, 0); Yap_DebugPlWrite(MkAtomTerm(At));
} else { } else {
Functor f = ap->FunctorOfPred; Functor f = ap->FunctorOfPred;
Atom At = NameOfFunctor(f); Atom At = NameOfFunctor(f);
Yap_plwrite(MkAtomTerm(At), Yap_DebugPutc, 0); Yap_DebugPlWrite(MkAtomTerm(At));
Yap_DebugPutc(Yap_c_error_stream,'/'); Yap_DebugPutc(Yap_c_error_stream,'/');
Yap_plwrite(MkIntegerTerm(ArityOfFunctor(f)), Yap_DebugPutc, 0); Yap_DebugPlWrite(MkIntegerTerm(ArityOfFunctor(f)));
} }
} }
Yap_DebugPutc(Yap_c_error_stream,'\n'); Yap_DebugPutc(Yap_c_error_stream,'\n');