diff options
author | Mike Gerwitz <gerwitm@lovullo.com> | 2016-08-24 09:43:05 -0400 |
---|---|---|
committer | Mike Gerwitz <gerwitm@lovullo.com> | 2016-08-24 12:38:00 -0400 |
commit | ff01f39c1e8c9b9549d884a0db1f9a74799cf37e (patch) | |
tree | 35978db88a8d385250b1b47ad05966e19516373d /src/current/dot/pkg-exec.xsl | |
parent | 6c0aa54bd1b7b49d736f0db3a8f48b7aa90b3b65 (diff) | |
download | tame-ff01f39c1e8c9b9549d884a0db1f9a74799cf37e.tar.gz tame-ff01f39c1e8c9b9549d884a0db1f9a74799cf37e.tar.bz2 tame-ff01f39c1e8c9b9549d884a0db1f9a74799cf37e.zip |
Liberate current implementation of "Calc DSL"
(Copyright headers will be added in the next commit; these are the
original files, unaltered in any way.)
The internal project name at LoVullo is simply "Calc DSL". This
liberates the entire thing. If anything was missed, I'll be added
later.
To continue building at LoVullo with this move, symlinks are used for
the transition; this is the exact code that is used in production.
There is a lot here---over 25,000 lines. Much of it is in disarray from
the environment surrounding its development, but it does work well for
what it was intended to do.
(LoVullo folks: fork point is 65723a0 in calcdsl.git.)
Diffstat (limited to 'src/current/dot/pkg-exec.xsl')
-rw-r--r-- | src/current/dot/pkg-exec.xsl | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/src/current/dot/pkg-exec.xsl b/src/current/dot/pkg-exec.xsl new file mode 100644 index 0000000..1c934bf --- /dev/null +++ b/src/current/dot/pkg-exec.xsl @@ -0,0 +1,99 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + Processes executable file dependency graph +--> + +<xsl:stylesheet version="2.0" + xmlns="http://www.w3.org/1999/xhtml" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + + xmlns:lv="http://www.lovullo.com/rater" + xmlns:l="http://www.lovullo.com/rater/linker" + xmlns:dot="http://www.lovullo.com/calc/dot" + xmlns:preproc="http://www.lovullo.com/rater/preproc"> + + +<!-- + Entry point for linked executable (.xmle) DOT generation + + We wish to generate a dependency graph for an entire program. This approach is + a little bit different than the approach to processing object files, because + we know that the linker's symbol table contains *only* those symbols that are + used (or kept). We further know that each symbol (unless there's a bug in the + linker) is referenced only a single time in the symbol table. + + This makes our job easy: simply walk the symbol table, look up the + preproc:sym-dep in the source package, and render as we normally would for an + object file. + + Lord Jesus it's a fire. +--> +<xsl:template match="lv:package[ l:dep ]" priority="9"> + <xsl:apply-templates select="." mode="dot:head" /> + + <!-- we know that all symbols in the linker symbol table are used, so we can + immediately generate the node definitions --> + <xsl:apply-templates mode="dot:defnode" + select="l:dep/preproc:sym" /> + + <!-- outputting the dependencies of those symbols is more involved and + requires processing data from each object file --> + <xsl:apply-templates select="l:dep/preproc:sym" mode="dot:ldep-sym-deps"> + <xsl:with-param name="exec-name" select="concat( @__rootpath, @name )" /> + </xsl:apply-templates> + + <xsl:apply-templates select="." mode="dot:tail" /> +</xsl:template> + + +<!-- + Omit symbols with parent references + + Symbols with parents are generated from that parent and will be considered to + be a single unit. Since the parent will also be in the symbol table (it is, + after all, a dependency), we don't have to worry about these at all. +--> +<xsl:template match="preproc:sym[ @parent ]" mode="dot:ldep-sym-deps" priority="5"> + <!-- ignore --> +</xsl:template> + + +<!-- + Process dependencies for each symbol + + The linker symbol table only stores a flattened symbol list; to get the + symbol's dependencies, we must consult the source object file. +--> +<xsl:template match="preproc:sym" mode="dot:ldep-sym-deps" priority="1"> + <xsl:param name="exec-name" /> + + <xsl:variable name="name" select="@name" /> + + <!-- empty @src implies program package --> + <xsl:variable name="pkg" select=" + if ( @src and not( @src='' ) ) then + document( concat( @src, '.xmlo' ), / )/lv:package + else + document( concat( $exec-name, '.xmlo' ), / )/lv:package + " /> + + <xsl:variable name="sym-dep" select=" + $pkg/preproc:sym-deps/preproc:sym-dep[ + @name=$name + ] + " /> + + <xsl:if test="not( $sym-dep )"> + <xsl:message terminate="yes"> + <xsl:text>error: cannot locate symbol dependencies for `</xsl:text> + <xsl:value-of select="concat( @src, '/', @name )" /> + <xsl:text>'</xsl:text> + </xsl:message> + </xsl:if> + + <xsl:apply-templates select="$sym-dep" mode="dot:depout" /> +</xsl:template> + + +</xsl:stylesheet> + |