After fix for listing/1.
Welcome to SWI-Prolog (threaded, 64 bits, version 8.3.4-18-ge5d07a583)
?- listing(portray(cr(_))).
:- dynamic portray/1.
:- multifile portray/1.
true.
?- gtrace.
% The graphical front-end will be used for subsequent tracing
true.
[trace] ?- nodebug.
true.
?- listing(portray(cr(_))).
:- dynamic portray/1.
:- multifile portray/1.
portray(Obj) :-
pce_portray:
( Obj= @(Ref),
object(Obj),
!,
( send(Obj, '_instance_of'(var))
-> get(Obj, '_value', Value),
format('@~w(= ~p)', [Ref, Value])
; get(Obj, '_class_name', CN),
format('@~w/~w', [Ref, CN])
)
).
portray(Codes) :-
portray_text:
( do_portray_text(true),
'$skip_list'(Length, Codes, Tail),
portray_text_option(min_length, MinLen),
Length>=MinLen,
all_ascii(Codes),
portray_text_option(ellipsis, IfLonger),
put_char('"'),
( Length>IfLonger
-> First is IfLonger+ -5,
Skip is Length+ -5,
skip_first(Skip, Codes, Rest),
put_n_codes(First, Codes),
format(..., [])
; Rest=Codes
),
( var_or_numbered(Tail)
-> put_var_codes(Rest)
; format('~s', [Rest])
),
put_char('"')
).
true.
Notice that portray(cr(A)) :-
is now portray(Obj) :-
.