print_arg(N) :- var(N),!,print_var(N).
print_arg(int(N)) :- !, (var(N) -> print_var_integer(N) ; write(int(N))).
print_arg(term(F)) :- nonvar(F), F=floating(N),!, (var(N) -> write(F) ; write(N)).
print_arg(float(N)) :- !, write(float(N)).
print_arg(freeval(ID,Case,Value)) :- !, format('freeval ~w.~w : ',[ID,Case]), print_arg(Value).
print_arg(fd(N,GS)) :- !,
(number(N),b_global_sets:is_b_global_constant(GS,N,Res) -> write(Res)
; write('fd('),print_integer(N),format(',~w)',GS)).
print_arg(rec(Fields)) :- !, write('rec('), print_arg(Fields),write(')').
print_arg(bind(Var,Val)) :- atomic(Var), !, write(Var),write('/'),print_arg(Val).
print_arg(field(Var,Val)) :- atomic(Var), !, write('field('),write(Var),write('/'),print_arg(Val),write(')').
print_arg(typedvalc(Val,Type,VarID,EnumWarningInfos,Card)) :-
atomic(VarID), !, format('typedvalc for ~w :(',[VarID]),print_arg(Val),
format(',~w,~w,~w) ',[Type,EnumWarningInfos,Card]).
print_arg(wfx(WF0,_Store,WFE,_Infos)) :- !, write(wfx(WF0,'...',WFE,'...')). % do not print store and Infos: TODO we could show call_stack summary
print_arg(Module:Call) :- atomic(Module),!,
write(Module), write(':'),print_arg(Call).
print_arg(A) :- atomic(A),!, write(A).
print_arg(A) :- A=node(_,_,_,_,_),ground(A), !, write('AVLnode.size='),avl_size(A,Sz), write(Sz).
print_arg(avl_set(A)) :- ground(A), !,
(custom_explicit_sets:singleton_set(avl_set(A),El) -> write('AVL{'),print_arg(El),write('}')
; avl_size(A,Sz),
(Sz>3 -> write('AVL.size='),write(Sz)
; custom_explicit_sets:expand_custom_set_to_list(avl_set(A),ESet,_,print_arg),
write('AVL{'), l_print_nested_arg(ESet), write('}')
)
).
print_arg((A,B)) :- !, write('('),print_arg(A), write(','), print_arg(B), write(')').
print_arg(string(A)) :- !, write('string('),print_arg(A), write(')').
print_arg([]) :- !, write('[]').
print_arg([H|T]) :- T==[], !, write('['),print_arg(H),write(']').
print_arg([H|T]) :- nonvar(T),T=[H2|T2],T2==[], !,
write('['),print_arg(H),write(','),print_arg(H2),write(']').
print_arg([H|T]) :- nonvar(H), H=bind(_,_),!, get_list_up_to([H|T],10,S,ALL),
translate:print_bstate(S),
(ALL=all -> true ; write(', ... ')).
print_arg([H|T]) :- list_skeleton_size([H|T],Sz,Type), !,
write(Type),
(Type=closed,ground([H|T]) -> write('&ground') ; true),
write(' LIST.size='), write(Sz),
(Sz<35 -> write(' ['), l_print_nested_arg([H|T]), write(']') ; true).
print_arg(closure(P,T,B)) :- !,
(custom_explicit_sets:is_interval_closure(P,T,B,Low,Up)
-> write('SYMBOLIC-INTERVAL ['),
print_integer_with_var(Low), write('..'),
print_integer_with_var(Up), write(']')
; B=b(_,_,INFO),
findall(Ann,member(prob_annotation(Ann),INFO),Anns),
(closures:is_symbolic_closure(P,T,B) -> INF='ANNOTATED-'
; custom_explicit_sets:is_infinite_or_very_large_closure(P,T,B,200000) -> INF='INF_OR_LARGE-'
; INF=''),
format('SYMBOLIC-~wSET(~w) ~w ',[INF,Anns,P])
). %, write(' | '), write(_B).
print_arg(mnf(Call)) :- !, write('mnf('),print_term_summary_wo_nl(Call), write(')').
print_arg(pp_mnf(Call)) :- !, write('mnf('),print_term_summary_wo_nl(Call), write(')').
print_arg(pp_cll(Call)) :- !, write('mnf('),print_term_summary_wo_nl(Call), write(')').
print_arg(b(Expr,T,I)) :- !,
(T==pred -> write('PRED(') ; write('BEXPR(')),
print_functor(Expr), write(','),
translate:print_bexpr_with_limit(b(Expr,T,I),200),
(error_manager:extract_line_col(b(Expr,T,I),Srow,Scol,_,_) -> format(', lne:col=~w:~w)',[Srow,Scol])
; write(')')).
print_arg(span_predicate(A,B,C)) :-
error_manager:extract_line_col(span_predicate(A,B,C),Srow,Scol,Erow,Ecol), !,
format('span_predicate(~w:~w-~w:~w)',[Srow,Scol,Erow,Ecol]).
print_arg(N) :- print_functor(N).