diff --git a/library/builtins.pl b/library/builtins.pl index 619f7fe88..b41ad41c7 100644 --- a/library/builtins.pl +++ b/library/builtins.pl @@ -712,11 +712,12 @@ % Debugging... -print_goals_([]). -print_goals_([Goal|Goals]) :- +print_goals_(_, []). +print_goals_(Any, [Goal|Goals]) :- + (Any -> write(', ') ; true), write(Goal), (Goals == [] -> true ; write(', ')), - print_goals_(Goals). + print_goals_(false, Goals). dump_attvars_([], []). dump_attvars_([Var|Vars], [Gs|Rest]) :- @@ -724,13 +725,13 @@ Var = Var2, dump_attvars_(Vars, Rest). -dump_attvars :- +dump_attvars(Any) :- '$list_attributed'(Vs0), sort(Vs0, Vs), dump_attvars_(Vs, Gs0), flatten(Gs0, Gs1), sort(Gs1, Gs), - print_goals_(Gs). + print_goals_(Any, Gs). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % diff --git a/src/toplevel.c b/src/toplevel.c index 75c3cb33a..040e53109 100644 --- a/src/toplevel.c +++ b/src/toplevel.c @@ -464,7 +464,7 @@ void dump_vars(query *q, bool partial) bool any_atts = any_attributed(q); if (any && any_atts) - fprintf(stdout, "%s", ", "); + fprintf(stdout, "%s", ""); else if (any_atts && !q->is_redo) fprintf(stdout, "%s", " "); else if (any_atts) @@ -477,10 +477,11 @@ void dump_vars(query *q, bool partial) q->variable_names = vlist; q->variable_names_ctx = q->st.curr_frame; q->tab_idx = 0; - cell p1; - make_atom(&p1, new_atom(q->pl, "dump_attvars")); - cell *tmp = prepare_call(q, NOPREFIX_LEN, &p1, q->st.curr_frame, 1); - pl_idx nbr_cells = p1.nbr_cells; + cell p1[2]; + make_struct(p1+0, new_atom(q->pl, "dump_attvars"), NULL, 1, 1); + make_atom(p1+1, any ? g_true_s : g_false_s); + cell *tmp = prepare_call(q, NOPREFIX_LEN, p1, q->st.curr_frame, 1); + pl_idx nbr_cells = p1->nbr_cells; make_end(tmp+nbr_cells); q->st.curr_instr = tmp; q->in_attvar_print = true;