diff --git a/C/iopreds.c b/C/iopreds.c index f854abfc9..6d48b10cf 100644 --- a/C/iopreds.c +++ b/C/iopreds.c @@ -3697,6 +3697,7 @@ format(Term tail, Term args, int sno) Term mytargs[8], *targs; Int tnum, targ = 0; char *fstr = NULL, *fptr; + Term oargs = args; if (IsVarTerm(tail)) { Yap_Error(INSTANTIATION_ERROR,tail,"format/2"); @@ -3968,7 +3969,9 @@ format(Term tail, Term args, int sno) if (targ > tnum || has_repeats) goto do_consistency_error; t = targs[targ++]; + *--ASP = MkIntTerm(0); Yap_plwrite (t, format_putc, Quote_illegal_f|Ignore_ops_f|To_heap_f ); + ASP++; break; case 'p': if (targ > tnum || has_repeats) @@ -3998,13 +4001,17 @@ format(Term tail, Term args, int sno) if (targ > tnum || has_repeats) goto do_consistency_error; t = targs[targ++]; + *--ASP = MkIntTerm(0); Yap_plwrite (t, format_putc, Handle_vars_f|Quote_illegal_f|To_heap_f); + ASP++; break; case 'w': if (targ > tnum || has_repeats) goto do_consistency_error; t = targs[targ++]; + *--ASP = MkIntTerm(0); Yap_plwrite (t, format_putc, Handle_vars_f|To_heap_f); + ASP++; break; case '~': if (has_repeats) @@ -4082,7 +4089,7 @@ format(Term tail, Term args, int sno) goto do_default_error; do_consistency_error: default: - Yap_Error(CONSISTENCY_ERROR, args, "format/2"); + Yap_Error(CONSISTENCY_ERROR, oargs, "format/2"); do_default_error: if (tnum <= 8) targs = NULL; diff --git a/C/write.c b/C/write.c index 07ddf0038..06c8c9c98 100644 --- a/C/write.c +++ b/C/write.c @@ -782,7 +782,6 @@ Yap_plwrite(Term t, int (*mywrite) (int, int), int flags) wglb.keep_terms = (flags & (Use_portray_f|To_heap_f)); wglb.Ignore_ops = flags & Ignore_ops_f; /* protect slots for portray */ - *--ASP = MkIntTerm(0); writeTerm(t, 1200, 1, FALSE, &wglb); } diff --git a/pl/debug.yap b/pl/debug.yap index 4f10f8eb5..e2549c186 100644 --- a/pl/debug.yap +++ b/pl/debug.yap @@ -577,7 +577,7 @@ debugging :- '$format'(user_error,"! g execute goal~n", []). '$ilgl'(C) :- - '$format'(user_error,"[ Illegal option ~d. Use h for help. ]. ~n", []). + '$format'(user_error,"[ Illegal option ~d. Use h for help. ]. ~n", [C]). '$skipeol'(10) :- !. '$skipeol'(_) :- get0(user,C), '$skipeol'(C).