PublicShow sourceportray_object.pl -- Create Human readable XPCE object descriptions

Note: you may wish to incorporate portray_object/2 with the standard portray mechanism of your Prolog. In that case:

portray(Object) :-
        object(Object), !,
        portray_object(Object).

Sometimes the use of object references can be a new nuisance, in particular while writing and debugging PCE programs. Suppose you have done:

    new(@s, spatial(xref=x+w, yref=x+h/2, xref=x, yref=y+h))

then

    object(@s, S)
    S = spatial(@1234, @1235, @1236, @1237, @default, @default)

is not of much use. portray_object/2 makes life easier:

    portray_object(@s, S)
    S = spatial(xref=x+w, yref=x+h/2, xref=x, yref=y+h)

More or less expanding the arguments until they become readable. portray_object/3 uses rules which specify how each object will be portrayed. You can make private extensions to these rules if you like.

Source portray_object(@Object)
Prints the result of portray_object/2 on the display.
Source portray_object(@Object, -Term)
Expands the object description of Object in a human readable form and returs this in Term. portray_object/2 uses the rules found under portray_class/2.