Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the utilities.print-tree Reference Manual, version 0.1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 06:07:14 2022 GMT+0.
Next: Systems, Previous: The utilities.print-tree Reference Manual, Up: The utilities.print-tree Reference Manual [Contents][Index]
#+TITLE: utilities.print-tree README #+AUTHOR: Jan Moringen #+EMAIL: jmoringe@techfak.uni-bielefeld.de #+DESCRIPTION: A simple system for pretty-printing tree structures #+KEYWORDS: common lisp, tree, printing, pretty-printing #+LANGUAGE: en * Introduction The =utilities.print-tree= system provides simple facilities for printing tree structures in an easy to read way using either ASCII or Unicode characters to render the parent-child relations. One focus is playing nicely with pretty printing. #+ATTR_HTML: :alt "build status image" :title Build Status :align right [[https://travis-ci.org/scymtym/utilities.print-tree][https://travis-ci.org/scymtym/utilities.print-tree.svg]] The following example shows the result of printing the =utilities.print-tree= ASDF system without and with additional details added to nodes: #+begin_example utilities.print-tree ├─src │ ├─package │ └─print-tree └─README.org #+end_example Note how pretty-printing of the "Depends-on" entry works seamlessly with tree printing: #+begin_example utilities.print-tree │ Pathname /home/jmoringe/code/cl/utilities.print-tree/ │ Encoding UTF-8 │ Depends-on ((## │ # ) │ (PREPARE-OP # ) │ (COMPILE-OP # )) ├─src │ │ Pathname /home/jmoringe/code/cl/utilities.print-tree/src/ │ │ Encoding UTF-8 │ │ Depends-on ((# │ │ # │ │ # ) │ │ (PREPARE-OP # ) │ │ (COMPILE-OP # )) │ ├─package │ │ Pathname /home/jmoringe/code/cl/utilities.print-tree/src/package.lisp │ │ Encoding UTF-8 │ │ Depends-on ((PREPARE-OP │ │ # ) │ │ (COMPILE-OP │ │ # )) │ └─print-tree │ Pathname /home/jmoringe/code/cl/utilities.print-tree/src/print-tree.lisp │ Encoding UTF-8 │ Depends-on ((PREPARE-OP │ # ) │ (COMPILE-OP │ # )) └─README.org Pathname /home/jmoringe/code/cl/utilities.print-tree/README.org Encoding UTF-8 Depends-on ((PREPARE-OP # ) (COMPILE-OP # )) #+end_example The following code produces this output: #+begin_src lisp (defmethod print-component ((target stream) (depth t) (component asdf:component)) (princ (asdf:component-name component) target)) (defmethod print-details ((target stream) (depth t) (component asdf:component)) (format target "Pathname ~A~@:_~ Encoding ~A~@:_~ Depends-on ~A" (asdf:component-pathname component) (asdf:component-encoding component) (asdf:component-depends-on 'asdf:load-op component))) (defmethod asdf:component-children ((component t)) '()) (labels ((do-it (details?) (fresh-line) (terpri) (print-tree *standard-output* (asdf:find-system :utilities.print-tree) (make-node-printer #'print-component (when details? #'print-details) #'asdf:component-children)))) (do-it nil) (do-it t)) #+end_src The full code of this example is available in [[file:examples/asdf.lisp]]. * settings :noexport: #+STARTUP: content # Local Variables: # mode: org # indent-tabs-mode: nil # End:
Next: Modules, Previous: Introduction, Up: The utilities.print-tree Reference Manual [Contents][Index]
The main system appears first, followed by any subsystem dependency.
This system provides simple facilities for printing tree structures.
Jan Moringen <jmoringe@techfak.uni-bielefeld.de>
Jan Moringen <jmoringe@techfak.uni-bielefeld.de>
LLGPLv3
0.1.0
alexandria (system).
Next: Files, Previous: Systems, Up: The utilities.print-tree Reference Manual [Contents][Index]
Modules are listed depth-first from the system components tree.
Next: utilities.print-tree/examples, Previous: Modules, Up: Modules [Contents][Index]
utilities.print-tree (system).
Previous: utilities.print-tree/src, Up: Modules [Contents][Index]
utilities.print-tree (system).
Next: Packages, Previous: Modules, Up: The utilities.print-tree Reference Manual [Contents][Index]
Files are sorted by type and then listed depth-first from the systems components trees.
Next: utilities.print-tree/src/package.lisp, Previous: Lisp, Up: Lisp [Contents][Index]
utilities.print-tree (system).
Next: utilities.print-tree/src/print-tree.lisp, Previous: utilities.print-tree/utilities.print-tree.asd, Up: Lisp [Contents][Index]
src (module).
Previous: utilities.print-tree/src/package.lisp, Up: Lisp [Contents][Index]
package.lisp (file).
src (module).
Next: utilities.print-tree/examples/minimal.lisp, Previous: Static, Up: Static [Contents][Index]
utilities.print-tree (system).
Next: utilities.print-tree/examples/asdf.lisp, Previous: utilities.print-tree/README.org, Up: Static [Contents][Index]
examples (module).
Previous: utilities.print-tree/examples/minimal.lisp, Up: Static [Contents][Index]
examples (module).
Next: Definitions, Previous: Files, Up: The utilities.print-tree Reference Manual [Contents][Index]
Packages are listed by definition order.
This package provides functions for printing tree structures.
The main entry point is the ‘print-tree’ function. It accepts a
stream, a tree object and a printer function.
In common cases, tree printer functions can be creating using ‘make-node-printer’ or ‘make-folding-node-printer’.
Next: Indexes, Previous: Packages, Up: The utilities.print-tree Reference Manual [Contents][Index]
Definitions are sorted by export status, category, package, and then by lexicographic order.
Next: Internals, Previous: Definitions, Up: Definitions [Contents][Index]
Next: Ordinary functions, Previous: Public Interface, Up: Public Interface [Contents][Index]
Previous: Special variables, Up: Public Interface [Contents][Index]
Like ‘make-node-printer’, return a node printer function that used
FIRST-LINE-PRINTER, REST-PRINTER and CHILDREN.
PREDICATE is called to determine whether and to what extend nodes
should be printed. When called with the depth of a node and node as
its arguments, PREDICATE must return a list of "bits" of the node
that should be printed. The following bits are recognized:
:first
Print first line of the node by calling FIRST-LINE-PRINTER?
:content
Print more details for the node by calling REST-PRINTER?
:children
Print children of the node?
:children-ellipsis
Print ellipsis of the form "…", if the node has children
butlast the :children bit has not been specified?
When PREDICATE returns T, all bits are printed.
Return a node printer function that used FIRST-LINE-PRINTER,
REST-PRINTER and CHILDREN.
FIRST-LINE-PRINTER is called with the destination stream, the depth of the node and the node and should print a one-line representation of the node to the stream. The function should return true if REST-PRINTER should be called to print more details for the node.
REST-PRINTER is also called with the destination stream, the depth
of the node and node. It is not restricted to only producing a
single line, however.
CHILDREN is called with a node and must return a (possibly empty) list of children of the node.
Print the tree ROOT to STREAM using PRINTER.
PRINTER is called with four arguments, STREAM, ROOT, the
keyword :root and the integer 0, indicating depth zero. PRINTER
will usually call ‘print-node’, ‘print-subree’ and
‘print-node-contents’ to do the actual work.
Functions suitable for use as PRINTER can, for many common cases, be constructed via ‘make-node-printer’ and ‘make-folding-node-printer’.
Previous: Public Interface, Up: Definitions [Contents][Index]
Next: Ordinary functions, Previous: Internals, Up: Internals [Contents][Index]
Previous: Definitions, Up: The utilities.print-tree Reference Manual [Contents][Index]
Jump to: | F M P T |
---|
Jump to: | F M P T |
---|
Next: Data types, Previous: Functions, Up: Indexes [Contents][Index]
Jump to: | *
+
C S |
---|
Jump to: | *
+
C S |
---|
Jump to: | A E F M P R S U |
---|
Jump to: | A E F M P R S U |
---|