Common Lisp Package: COM.INFORMATIMAGO.COMMON-LISP.PICTURE.TREE-TO-ASCII

This package draws a tree onto an ASCII-ART picture The tree drawn is a list whose car is the node displayed, and whose cdr is the list of children. License: AGPL3 Copyright Pascal J. Bourguignon 2002 - 2012 This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>

README:

FUNCTION

Public

TREE-DECORATE (TREE MAKE-DECORATION)

DO: Converts the list based tree to a decorated tree. The building of the decoration is done by the make-decoration function. RETURN: The decorated tree.

TREE-TO-ASCII (TLEE &KEY BOXED FORMAT-FUN BACKGROUND TO-LENGTH FROM-LENGTH)

tlee: is a list-based tree, whose car is a "node", and whose cdr is the list of children. boxed: t if boxes should be drawn around the nodes. format-fun: a function taking a node (one of the car's) and returning a string to be displayed as the node. Defaults merely use (format nil "~S" node). background: is a character used as background. Default: space. DO: Draw the tree onto an ASCII-art picture. RETURNS: The string containing the ASCII-ART tree. EXAMPLE: (tree-to-ascii '(if (= a b) (decf b a) (decf a b))) --> " +--a +--=--+ | +--b | | +--b if--+--decf--+ | +--a | | +--a +--decf--+ +--b "

TREE-TO-ASCII-DRAW-TO-PICT (TREE PICT LEFT BOTTOM &KEY BOXED TO-LENGTH FROM-LENGTH)

DO: Draw the decorated TREE into the PICT.

Private

TREE-TO-ASCII-BOX (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

TREE-TO-ASCII-BOX-BASE (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

TREE-TO-ASCII-BOX-HEIGHT (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

TREE-TO-ASCII-BOX-WIDTH (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

TREE-TO-ASCII-CHILDREN (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

TREE-TO-ASCII-COMPUTE-BOXES (TREE &KEY BOXED FORMAT-FUN FROM-LENGTH TO-LENGTH)

DO: Compute the boxes and formated strings and store them in the decorated tree. FROM-LENGTH: The length of the stem from the child box (default = 2). TO-LENGTH: The length of the stem to the parent box (default = 2). RETURN: (tree-to-ascii-box tree) NOTE: TO-LENGTH FROM-LENGTH |<--------->|<----------->| +---------+ +-------------| Child 3 | | +---------+ | +--------+ | +---------+ | Parent |-----------+-------------| Child 2 | +--------+ | +---------+ | | +---------+ +-------------| Child 3 | +---------+

TREE-TO-ASCII-FORMATED (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

TREE-TO-ASCII-MAKE-DECORATION (NODE CHILDREN)

DO: Builds a new decorated node: an array of 4 entries: node, children list, formated string, and box array RETURN: The decorated node.

TREE-TO-ASCII-NODE (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

Undocumented

COPY-TREE-TO-ASCII (INSTANCE)

COPY-TREE-TO-ASCII-BOX (INSTANCE)

MAKE-TREE-TO-ASCII (&KEY ((NODE DUM9) NIL) ((CHILDREN DUM10) NIL) ((FORMATED DUM11) NIL) ((BOX DUM12) NIL))

MAKE-TREE-TO-ASCII-BOX (&KEY ((WIDTH DUM51) 0) ((HEIGHT DUM52) 0) ((BASE DUM53) 0))

SETFTREE-TO-ASCII-BOX (NEW-VALUE INSTANCE)

SETFTREE-TO-ASCII-BOX-BASE (NEW-VALUE INSTANCE)

SETFTREE-TO-ASCII-BOX-HEIGHT (NEW-VALUE INSTANCE)

TREE-TO-ASCII-BOX-P (OBJECT)

SETFTREE-TO-ASCII-BOX-WIDTH (NEW-VALUE INSTANCE)

SETFTREE-TO-ASCII-CHILDREN (NEW-VALUE INSTANCE)

SETFTREE-TO-ASCII-FORMATED (NEW-VALUE INSTANCE)

SETFTREE-TO-ASCII-NODE (NEW-VALUE INSTANCE)

TREE-TO-ASCII-P (OBJECT)

CLASS

Public

Undocumented

TREE-TO-ASCII (TLEE &KEY BOXED FORMAT-FUN BACKGROUND TO-LENGTH FROM-LENGTH)

Private

Undocumented

TREE-TO-ASCII-BOX (INSTANCE)