diff options
author | Mike Gerwitz <gerwitm@lovullo.com> | 2016-07-05 23:18:47 -0400 |
---|---|---|
committer | Mike Gerwitz <gerwitm@lovullo.com> | 2016-07-06 00:16:33 -0400 |
commit | 000c0345bd5450cd7d12fbadb5859620bf5d38c4 (patch) | |
tree | b05f872b70236a3cad4b2df7cc8e69139dcb64c6 /src | |
parent | b2d87c531837c04df5501d65ad67a56a689f3eb5 (diff) | |
download | tame-000c0345bd5450cd7d12fbadb5859620bf5d38c4.tar.gz tame-000c0345bd5450cd7d12fbadb5859620bf5d38c4.tar.bz2 tame-000c0345bd5450cd7d12fbadb5859620bf5d38c4.zip |
Add graph:make-from-deps convenience function
* src/graph.xsl (graph:make-from-deps): Added with documentation.
* test/graph{-test.xsl,.xspec}: Updated accordingly.
Diffstat (limited to 'src')
-rw-r--r-- | src/graph.xsl | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/graph.xsl b/src/graph.xsl index 7351cd7..2875234 100644 --- a/src/graph.xsl +++ b/src/graph.xsl @@ -245,4 +245,38 @@ ()" /> </function> +<!-- + @ref{graph:dep-lookup} can be used together with the convenience + function @ref{graph:make-from-deps} to produce a graph that + contains all dependencies for a given symbol list. + Used together with @ref{graph:reverse}, + a reverse dependency graph can be easily created that provides a + useful ``used by'' relationship. +--> + +<!-- + Create a dependency graph containing all dependencies of the given + symbol list @var{$symbols}. + The graph contains the union of the minimal subset of all package + subgraphs@mdash{}only vertices representing a symbol in + @var{$symbols} or its direct dependencies are included. + + This function is @emph{not} recursive; + it assumes that the given symbol list @var{$symbols} is sufficient + for whatever operation is being performed. + + The lookup function @var{$lookup} is invoked once per symbol in + @var{$symbols} with the @code{preproc:sym} to look up. + The final result is used to produce a new normalized graph, + with any duplicate vertices and edges removed. +--> +<function name="graph:make-from-deps" as="element( preproc:sym-deps )*"> + <param name="lookup" as="item()+" /> + <param name="symbols" as="element( preproc:sym )*" /> + + <sequence select="graph:make-from-vertices( + for $symbol in $symbols + return f:apply( $lookup, $symbol ) )" /> +</function> + </stylesheet> |