Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <gerwitm@lovullo.com>2016-08-24 09:43:05 -0400
committerMike Gerwitz <gerwitm@lovullo.com>2016-08-24 12:38:00 -0400
commitff01f39c1e8c9b9549d884a0db1f9a74799cf37e (patch)
tree35978db88a8d385250b1b47ad05966e19516373d /src/current/dot
parent6c0aa54bd1b7b49d736f0db3a8f48b7aa90b3b65 (diff)
downloadtame-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')
-rw-r--r--src/current/dot/attr-color.xsl72
-rw-r--r--src/current/dot/attr-extern.xsl33
-rw-r--r--src/current/dot/attr-keep.xsl33
-rw-r--r--src/current/dot/attr-shape.xsl62
-rw-r--r--src/current/dot/defnode-attr.xsl70
-rw-r--r--src/current/dot/defnode.xsl107
-rw-r--r--src/current/dot/depout.xsl212
-rw-r--r--src/current/dot/pkg-exec.xsl99
-rw-r--r--src/current/dot/pkg-obj.xsl49
9 files changed, 737 insertions, 0 deletions
diff --git a/src/current/dot/attr-color.xsl b/src/current/dot/attr-color.xsl
new file mode 100644
index 0000000..4ef7c01
--- /dev/null
+++ b/src/current/dot/attr-color.xsl
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Styles node color based on symbol type
+-->
+
+<xsl:stylesheet version="2.0"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+
+ xmlns:dot="http://www.lovullo.com/calc/dot"
+ xmlns:preproc="http://www.lovullo.com/rater/preproc">
+
+
+<!--
+ Parameter
+-->
+<xsl:template mode="dot:attr-color" priority="5"
+ match="*[ @type='param' ]">
+
+ <dot:attr name="color">#204a87</dot:attr>
+</xsl:template>
+
+
+<!--
+ Param type
+-->
+<xsl:template mode="dot:attr-color" priority="5"
+ match="*[ @type='type' ]">
+
+ <dot:attr name="color">#729fcf</dot:attr>
+</xsl:template>
+
+
+<!--
+ Classification
+-->
+<xsl:template mode="dot:attr-color" priority="5"
+ match="*[ @type='class' or @type='cgen' ]">
+
+ <dot:attr name="color">#4e9a06</dot:attr>
+</xsl:template>
+
+
+<!--
+ Function
+-->
+<xsl:template mode="dot:attr-color" priority="5"
+ match="*[ @type='func' ]">
+
+ <dot:attr name="color">#c4a000</dot:attr>
+</xsl:template>
+
+
+<!--
+ Map
+-->
+<xsl:template mode="dot:attr-color" priority="5"
+ match="*[ @type='map' or @type='retmap' ]">
+
+ <dot:attr name="color">#888a85</dot:attr>
+</xsl:template>
+
+
+<!--
+ Default
+-->
+<xsl:template match="*" mode="dot:attr-color" priority="1">
+ <!-- no color -->
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/src/current/dot/attr-extern.xsl b/src/current/dot/attr-extern.xsl
new file mode 100644
index 0000000..318da4a
--- /dev/null
+++ b/src/current/dot/attr-extern.xsl
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Styles node based on locality
+-->
+
+<xsl:stylesheet version="2.0"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+
+ xmlns:dot="http://www.lovullo.com/calc/dot"
+ xmlns:preproc="http://www.lovullo.com/rater/preproc">
+
+
+<!--
+ External nodes should be styled as such
+-->
+<xsl:template mode="dot:attr-extern" priority="5" match="
+ *[ @src and not( @src='' ) ]
+ ">
+
+ <dot:attr name="style">dashed</dot:attr>
+</xsl:template>
+
+
+
+<!--
+ Default node attributes
+-->
+<xsl:template match="preproc:sym" mode="dot:defnode-attr" priority="1">
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/src/current/dot/attr-keep.xsl b/src/current/dot/attr-keep.xsl
new file mode 100644
index 0000000..3a72af4
--- /dev/null
+++ b/src/current/dot/attr-keep.xsl
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Styles node based on keep flag
+-->
+
+<xsl:stylesheet version="2.0"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+
+ xmlns:dot="http://www.lovullo.com/calc/dot"
+ xmlns:preproc="http://www.lovullo.com/rater/preproc">
+
+
+<!--
+ External nodes should be styled as such
+-->
+<xsl:template mode="dot:attr-keep" priority="5" match="
+ *[ @keep='true' ]
+ ">
+
+ <dot:attr name="fontcolor">red</dot:attr>
+</xsl:template>
+
+
+
+<!--
+ Default node attributes
+-->
+<xsl:template match="preproc:sym" mode="dot:defnode-keep" priority="1">
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/src/current/dot/attr-shape.xsl b/src/current/dot/attr-shape.xsl
new file mode 100644
index 0000000..f4bc289
--- /dev/null
+++ b/src/current/dot/attr-shape.xsl
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Styles node shape based on symbol type
+-->
+
+<xsl:stylesheet version="2.0"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+
+ xmlns:dot="http://www.lovullo.com/calc/dot"
+ xmlns:preproc="http://www.lovullo.com/rater/preproc">
+
+
+<!--
+ Parameter
+-->
+<xsl:template mode="dot:attr-shape" priority="5"
+ match="*[ @type='param' ]">
+
+ <dot:attr name="shape">box</dot:attr>
+</xsl:template>
+
+
+<!--
+ Classification
+-->
+<xsl:template mode="dot:attr-shape" priority="5"
+ match="*[ @type='class' or @type='cgen' ]">
+
+ <dot:attr name="shape">octagon</dot:attr>
+</xsl:template>
+
+
+<!--
+ Function
+-->
+<xsl:template mode="dot:attr-shape" priority="5"
+ match="*[ @type='func' ]">
+
+ <dot:attr name="shape">component</dot:attr>
+</xsl:template>
+
+
+<!--
+ Map
+-->
+<xsl:template mode="dot:attr-shape" priority="5"
+ match="*[ @type='map' or @type='retmap' ]">
+
+ <dot:attr name="shape">note</dot:attr>
+</xsl:template>
+
+
+<!--
+ Default
+-->
+<xsl:template match="*" mode="dot:attr-shape" priority="1">
+ <!-- default shape -->
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/src/current/dot/defnode-attr.xsl b/src/current/dot/defnode-attr.xsl
new file mode 100644
index 0000000..778835a
--- /dev/null
+++ b/src/current/dot/defnode-attr.xsl
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Outputs graph visualization of dependencies in DOT format
+-->
+
+<xsl:stylesheet version="2.0"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+
+ xmlns:dot="http://www.lovullo.com/calc/dot"
+ xmlns:preproc="http://www.lovullo.com/rater/preproc">
+
+<xsl:import href="./attr-color.xsl" />
+<xsl:import href="./attr-shape.xsl" />
+<xsl:import href="./attr-extern.xsl" />
+<xsl:import href="./attr-keep.xsl" />
+
+
+<!--
+ External nodes should be styled as such
+-->
+<xsl:template mode="dot:defnode-attr" priority="5" match="
+ preproc:sym[ @src and not( @src='' ) ]
+ ">
+
+ <dot:attr name="label">
+ <xsl:value-of select="@src" />
+ <xsl:text>/\n</xsl:text>
+ <xsl:value-of select="@name" />
+ </dot:attr>
+
+ <dot:attr name="tooltip">
+ <xsl:value-of select="@src" />
+ <xsl:text>/</xsl:text>
+ <xsl:value-of select="@name" />
+ </dot:attr>
+</xsl:template>
+
+
+
+<!--
+ Default node attributes
+-->
+<xsl:template match="preproc:sym" mode="dot:defnode-attr" priority="1">
+</xsl:template>
+
+
+<!--
+ Render an attribute list as a comma-delimited string
+
+ Expects a tree of dot:attr nodes where @name is the name of the attribute, and
+ its normalized text is the value. The value will be quoted; double quotes must
+ be manually escaped prior to calling this template.
+-->
+<xsl:template name="dot:render-attr-list">
+ <xsl:param name="attr-list" />
+
+ <xsl:for-each select="$attr-list/dot:attr">
+ <xsl:if test="position() > 1">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+
+ <xsl:value-of select="@name" />
+ <xsl:text>="</xsl:text>
+ <xsl:value-of select="normalize-space( text() )" />
+ <xsl:text>"</xsl:text>
+ </xsl:for-each>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/src/current/dot/defnode.xsl b/src/current/dot/defnode.xsl
new file mode 100644
index 0000000..c34c591
--- /dev/null
+++ b/src/current/dot/defnode.xsl
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Graph node definitions
+
+ Nodes do not need to be defined (DOT will generate them upon first reference);
+ this defines nodes that require additional data associated with them.
+-->
+
+<xsl:stylesheet version="2.0"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+
+ xmlns:dot="http://www.lovullo.com/calc/dot"
+ xmlns:preproc="http://www.lovullo.com/rater/preproc">
+
+<xsl:import href="./defnode-attr.xsl" />
+
+
+<!--
+ Do not declare constants or generated symbols
+
+ XXX: Duplicated logic from smy-ref!
+-->
+<xsl:template mode="dot:defnode" priority="9" match="
+ preproc:sym[
+ @type='const'
+ or @type='map' or @type='retmap'
+ or @type='map:head' or @type='map:tail'
+ or @type='retmap:head' or @type='retmap:tail'
+ or (
+ @type='type'
+ and (
+ @name='integer'
+ or @name='float'
+ or @name='boolean'
+ )
+ )
+ or @parent
+ or @preproc:generated='true'
+ ]
+ ">
+</xsl:template>
+
+
+<!--
+ Process parent symbol in place of current symbol
+
+ Symbols with defined parents are generated as part of that parent and will
+ therefore be treated as a single unit.
+-->
+<xsl:template match="preproc:sym[ @parent ]" mode="dot:defnode" priority="7">
+ <xsl:variable name="parent" select="@parent" />
+
+ <xsl:apply-templates select="
+ parent::preproc:symtable/preproc:sym[ @name=$parent ]
+ " />
+</xsl:template>
+
+
+<!--
+ Default node definition
+
+ If no attributes are generated, then the node will be entirely omitted (it'll
+ be created automatically by DOT when referenced).
+-->
+<xsl:template match="preproc:sym" mode="dot:defnode" priority="1">
+ <xsl:variable name="attr">
+ <xsl:call-template name="dot:render-attr-list">
+ <xsl:with-param name="attr-list">
+ <!-- this kluge exists because of XSLT limitiations and the confusion
+ that would result (in this particular situation) from
+ xsl:apply-imports
+ -->
+ <xsl:apply-templates select="." mode="dot:defnode-attr" />
+ <xsl:apply-templates select="." mode="dot:attr-extern" />
+ <xsl:apply-templates select="." mode="dot:attr-color" />
+ <xsl:apply-templates select="." mode="dot:attr-shape" />
+ <xsl:apply-templates select="." mode="dot:attr-keep" />
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:if test="not( $attr = '' )">
+ <xsl:text>"</xsl:text>
+ <xsl:value-of select="@name" />
+ <xsl:text>" [</xsl:text>
+ <xsl:value-of select="$attr" />
+
+ <xsl:if test="@src and not( @src='' )">
+ <xsl:if test="$attr">
+ <xsl:text>,</xsl:text>
+ </xsl:if>
+
+ <!-- link to other packages in the graph for navigation -->
+ <xsl:text>href="</xsl:text>
+ <xsl:value-of select="concat( @src, '.svg' )" />
+ <xsl:text>"</xsl:text>
+ </xsl:if>
+ <xsl:text>];</xsl:text>
+
+ <xsl:value-of select="$dot:nl" />
+ </xsl:if>
+</xsl:template>
+
+
+</xsl:stylesheet>
+
diff --git a/src/current/dot/depout.xsl b/src/current/dot/depout.xsl
new file mode 100644
index 0000000..5b3dbda
--- /dev/null
+++ b/src/current/dot/depout.xsl
@@ -0,0 +1,212 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Outputs dependency relationship to a directed 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:dot="http://www.lovullo.com/calc/dot"
+ xmlns:preproc="http://www.lovullo.com/rater/preproc">
+
+
+
+<!--
+ Container for all the dependencies
+-->
+<xsl:template match="preproc:sym-deps" mode="dot:depout" priority="5">
+ <xsl:apply-templates mode="dot:depout" />
+</xsl:template>
+
+
+<!--
+ Treat the entry point (lv:yield) as the root node
+-->
+<xsl:template match="preproc:sym-dep[ @name='___yield' ]" mode="dot:depout" priority="6">
+ <xsl:value-of select="@name" />
+ <xsl:text> [root=ctr,fontsize=24,style=bold,label="Yield"]; </xsl:text>
+
+ <xsl:apply-templates mode="dot:depout" />
+</xsl:template>
+
+
+<!--
+ Constant and generated symbols will not be rendered
+-->
+<xsl:template mode="dot:depout" priority="5" match="
+ preproc:sym-dep[
+ @name=ancestor::lv:package/preproc:symtable/preproc:sym[
+ @type='const'
+ or @preproc:generated='true'
+ ]/@name
+ ]
+ ">
+</xsl:template>
+
+
+<!--
+ Container for symbol dependencies
+
+ That is: this node represents a symbol, and its children are its dependencies.
+-->
+<xsl:template match="preproc:sym-dep" mode="dot:depout" priority="3">
+ <xsl:apply-templates mode="dot:depout" />
+</xsl:template>
+
+
+<!--
+ Do not output relationships to primitives or constants; or generated
+-->
+<xsl:template mode="dot:depout" priority="5" match="
+ preproc:sym-ref[
+ @type='type'
+ and (
+ @name='integer'
+ or @name='float'
+ or @name='boolean'
+ )
+ or @type='const'
+ or @type='lparam'
+ or @type='map' or @type='retmap'
+ or @type='map:head' or @type='map:tail'
+ or @type='retmap:head' or @type='retmap:tail'
+ ]
+ ">
+
+ <!-- skip -->
+</xsl:template>
+
+
+<!--
+ Process generated symbol deps as our own
+
+ Generated symbols are not known by the user, so they should be treated as part
+ of the unit from which they are generated.
+-->
+<xsl:template mode="dot:depout" priority="4" match="
+ preproc:sym-ref[
+ @name=ancestor::lv:package/preproc:symtable/preproc:sym[
+ @preproc:generated='true'
+ ]/@name
+ ]
+ ">
+
+ <xsl:param name="usedby" select="parent::preproc:sym-dep/@name" />
+
+ <xsl:variable name="name" select="@name" />
+
+ <!-- process the generated symbol's deps as our own -->
+ <xsl:apply-templates mode="dot:depout" select="
+ ancestor::preproc:sym-deps/preproc:sym-dep[
+ @name=$name
+ ]/preproc:sym-ref
+ ">
+ <xsl:with-param name="usedby" select="$usedby" />
+ </xsl:apply-templates>
+</xsl:template>
+
+
+<!--
+ Process references with parents as if they were their parent symbol
+
+ Symbols with defined parents are generated as part of that parent and will
+ therefore be treated as a single unit.
+-->
+<xsl:template match="preproc:sym-ref[ @parent ]" mode="dot:depout" priority="3">
+ <xsl:param name="usedby" select="parent::preproc:sym-dep/@name" />
+
+ <xsl:variable name="parent" select="@parent" />
+
+ <xsl:apply-templates mode="dot:depout" select="
+ ancestor::lv:package/preproc:symtable/preproc:sym[ @name=$parent ]
+ ">
+ <xsl:with-param name="usedby" select="$usedby" />
+ </xsl:apply-templates>
+</xsl:template>
+
+
+<!--
+ Trigger processing of symbol associated with the ref
+-->
+<xsl:template match="preproc:sym-ref" mode="dot:depout" priority="2">
+ <xsl:param name="usedby" select="parent::preproc:sym-dep/@name" />
+
+ <xsl:variable name="name" select="@name" />
+
+ <xsl:apply-templates mode="dot:depout" select="
+ ancestor::lv:package/preproc:symtable/preproc:sym[ @name=$name ]
+ ">
+ <xsl:with-param name="usedby" select="$usedby" />
+ </xsl:apply-templates>
+</xsl:template>
+
+
+<!--
+ Output symbol reference to directed graph
+
+ The symbol (dependency) is referenced as a node adjacent to the node of the
+ symbol that uses it. The edge is directed toward the dependency and shall be
+ read as "uses".
+
+ For example: "foo uses bar":
+ (foo) -> (bar)
+-->
+<xsl:template match="preproc:sym" mode="dot:depout" priority="5">
+ <xsl:param name="usedby" />
+
+ <xsl:variable name="attr">
+ <xsl:call-template name="dot:render-attr-list">
+ <xsl:with-param name="attr-list">
+ <xsl:apply-templates select="." mode="dot:attr-extern" />
+ <xsl:apply-templates select="." mode="dot:attr-color" />
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:text>"</xsl:text>
+ <xsl:value-of select="$usedby" />
+ <xsl:text disable-output-escaping="yes">" -&gt; "</xsl:text>
+ <xsl:value-of select="@name" />
+ <xsl:text>"</xsl:text>
+
+ <xsl:if test="not( $attr='' )">
+ <xsl:text> [</xsl:text>
+ <xsl:value-of select="$attr" />
+ <xsl:text>]</xsl:text>
+ </xsl:if>
+
+ <xsl:text>;</xsl:text>
+
+ <xsl:value-of select="$dot:nl" />
+</xsl:template>
+
+
+<!--
+ Bail out if asked to render something unexpected
+-->
+<xsl:template match="*" mode="dot:depout" priority="1">
+ <xsl:message terminate="yes">
+ <xsl:text>error: what do I do!?: unexpected </xsl:text>
+ <xsl:value-of select="name()" />
+ </xsl:message>
+</xsl:template>
+
+
+<!--
+ Extra comments and attributes are ignored
+
+ text() is ignored, otherwise, extra whitespace corresponding to the
+ indentation of nodes appears in the output.
+
+ Ignoring attributes is just in case of an xpath whoopsie, but probably isn't
+ necessary, and is probably dangerous (because it may veil bugs).
+-->
+<xsl:template match="@*|text()" mode="dot:depout" priority="1">
+ <!-- ignore -->
+</xsl:template>
+
+
+</xsl:stylesheet>
+
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>
+
diff --git a/src/current/dot/pkg-obj.xsl b/src/current/dot/pkg-obj.xsl
new file mode 100644
index 0000000..d281cff
--- /dev/null
+++ b/src/current/dot/pkg-obj.xsl
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Processes object 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:dot="http://www.lovullo.com/calc/dot"
+ xmlns:preproc="http://www.lovullo.com/rater/preproc">
+
+
+<!--
+ Entry point for object file DOT generation
+
+ To render the graph, we first declare all nodes associated with all referenced
+ symbols in the symbol tree (it's important to check against preproc:sym-deps,
+ since it's likely that not all imported symbols are used); this allows setting
+ attributes for the symbol nodes on the graph without having to worry about
+ duplicate code later on.
+
+ After that, we simply recurse through the dependency list and neighbor the
+ nodes.
+-->
+<xsl:template match="lv:package[ preproc:sym-deps ]" priority="5">
+ <xsl:apply-templates select="." mode="dot:head" />
+
+ <xsl:variable name="sym-deps" select="preproc:sym-deps" />
+
+ <!-- pre-style all referenced nodes (the symbol table is likely to contain
+ references to symbols that were imported but not used) -->
+ <xsl:apply-templates mode="dot:defnode" select="
+ preproc:symtable/preproc:sym[
+ @name=$sym-deps/preproc:sym-dep/preproc:sym-ref/@name
+ or @name=$sym-deps/preproc:sym-dep/preproc:sym-ref/@parent
+ ]
+ " />
+
+ <!-- output graph description -->
+ <xsl:apply-templates select="preproc:sym-deps" mode="dot:depout" />
+
+ <xsl:apply-templates select="." mode="dot:tail" />
+</xsl:template>
+
+
+</xsl:stylesheet>
+