This module is a first start of what should become a full-featured
pretty printer for Prolog terms with many options and parameters.
Eventually, it should replace portray_clause/1 and various other
- To be done
- - This is just a quicky. We need proper handling of portray/1, avoid
printing very long terms multiple times, spacing (around operators),
- - Use a record for the option-processing.
- - The current approach is far too simple, often resulting in illegal
- print_term(+Term, +Options) is det
- Pretty print a Prolog term. The following options are processed:
- Define the output stream. Default is
- Width of a line. Default is 72 characters.
- Left margin for continuation lines. Default is 0.
- Distance between tab-stops. Default is 8 characters.
- Defines how arguments of compound terms are placed. Defined
Simply place them left to right (no line-breaks)
Place them vertically, aligned with the open bracket (not
As horizontal if line-width is not exceeded, vertical
- An integer
Place them vertically aligned, <N> spaces to the right of
the beginning of the head.
- This is the inverse of the write_term/3 option
Default is to respect them.
- List of options passed to write_term/3 for terms that are
not further processed. Default:
- prepare_term(+Term, -Template, -Cycles, -Constraints)[private]
- Prepare a term, possibly holding cycles and constraints for
- indent(+Out, +Indent, +Options)[private]
- Newline and indent to the indicated column. Respects the option
tab_width. Default is 8. If the tab-width equals zero,
indentation is emitted using spaces.
- print_width(+Term, -W, +Options) is det[private]
- Width required when printing `normally' left-to-right.
- pprint(+Term, +Context, +Options)[private]
- The bottom-line print-routine.