makeTikzGraph: Create a tree representing a CXCursor and its descendants

View source: R/tikz.R

makeTikzGraphR Documentation

Create a tree representing a CXCursor and its descendants

Description

This creates TeX code that can be used to dipslay the hierarchical structure of CXCursor and its children and their children. This can be embedded into a TeX document. One can customize the appearance of the nodes and edges via Tikz settings in the TeX document.

Usage

makeTikzGraph(cur, genLabel = makeCursorLabel, options = NULL,
              siblingDistance = integer(), unit = "cm")

Arguments

cur

the CXCursor whose hierarchy we are to display

genLabel

a function that creates the text for each node in the tree. That text is displayed for the corresponding node. This is called separately for each node.

options

Tikz options in the form of a character vector. These are inserted into the ⁠\begin{tikzpicture}⁠ TeX code .

siblingDistance

an integer value that specifies the distance between nodes at the same level in the hierarchy under the same parent node, i.e. siblings.

unit

a character vector giving the unit of measurement for siblingDistance, e.g. "cm", "em", "pt", "in".

Details

This generates text containing the Tikz TeX code.

Value

A character vector containing the Tikz TeX code. This has multiple elements rather than a single element.

Author(s)

Duncan Temple Lang

References

Tikz http://www.texample.net/tikz/, http://sourceforge.net/projects/pgf/

libclang http://clang.llvm.org/doxygen/group__CINDEX.html

Examples

slr = getRoutines(system.file("exampleCode", "sinLog.c", package = "RCIndex"))
cat(makeTikzGraph(slr$fun), sep = "\n")

cat(makeTikzGraph(slr$fun@def, options = c("font=\tiny", "level distance=1.25cm"), 
                  siblingDistance = structure(c(6, 7, 7, 4, 3), names = c("", 4:7))),
     sep = "\n")

omegahat/RClangSimple documentation built on Aug. 17, 2024, 10:23 a.m.