doclib: Add helper script to build image map from dia files
g0dil [Wed, 13 Feb 2008 10:33:11 +0000 (10:33 +0000)]
doclib: Introduce an intermediate doxygen-compatible image map format
Update all image maps to the new format

git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@691 270642c3-0616-0410-b53a-bc976706d245

16 files changed:
HowTos/NewPacket/Mainpage.dox
PPI/Connectors.hh
PPI/Mainpage.dox
Socket/FileHandle.hh
Socket/Mainpage.dox
Socket/Protocols.dia
Socket/SocketPolicy.hh
Socket/SocketProtocol.hh
Utils/Externals.dox [new file with mode: 0644]
doclib/Doxyfile.global
doclib/dot
doclib/dot-munge.pl
doclib/filter.pl
doclib/html-munge.xsl
doclib/makeDiaImageMap.py [new file with mode: 0755]
doclib/senf.css

index 8769831..436a428 100644 (file)
     senf::PacketTypeMixin. senf::PacketTypeBase must be inherited by every packet type class. the
     senf::PacketTypeMixin provides default implementations for some members which are useful for
     most kinds of packets. If a packet type is very complex and these defaults don't work, the mixin
-    class can and should be left out.
+    class can and should be left out. More on this (what the default members do exactly and when the
+    mixin can be used) can be found in the senf::PacketTypeMixin documentation.
 
     Of the typedefs, only \a parser is mandatory. It defines the packet parser to use to interpret
     this type of packet. \a mixin and \a packet are defined to simplify the following
     \endcode
 
     We have added an additional private bitfield \a reserved0_5bits_() and we made the \a version_()
-    field private since we do not want the user to change the value. We could have used a read-only
-    field in this special case (since the valid value is 0) but generally in a case like this since
-    the field will be initialized by the parser (see next section on how). the field should be
-    private with an additional public read-only accessor.
+    field private since we do not want the user to change the value (0 is the only valid value, any
+    other value is not supported by this parser anyways). In this special case, a read-only field
+    would do. But more generally, if there are fields which must have a fixed value, they must be
+    defined as private fields so they can be initialized by the parser to their correct value (see
+    next section on how). An additional public read-only accessor allows users of the parser to read
+    out the value (but not change it).
 
     We will now add two additional simple members to the parser
 
index 68a0ea4..a69c3d8 100644 (file)
@@ -479,6 +479,8 @@ namespace connector {
 #else
 
     /** \brief Connector actively reading packets
+        
+        \tparam PacketType Type of packet to read. Defaults to senf::Packet
 
         The ActiveInput connector template reads data actively from a connected module. This class
         is completely implemented via it's base-class, GenericActiveInput, the only difference is
@@ -500,6 +502,8 @@ namespace connector {
 
     /** \brief Connector passively receiving packets
 
+        \tparam PacketType Type of packet to read. Defaults to senf::Packet
+
         The PassiveInput connector template receives packets sent to it from a connected
         module. This class is completely implemented via it's base-class, GenericPassiveInput, the
         only difference is that read packets are returned as \a PacketType instead of generic
@@ -521,6 +525,8 @@ namespace connector {
 
     /** \brief Connector actively sending packets
 
+        \tparam PacketType Type of packet to send. Defaults to senf::Packet
+
         The ActiveOutput connector template sends data actively to a connected module. This class is
         completely implemented via it's base-class, GenericActiveOutput, the only difference is that
         it only sends packets of type \a PacketType.
@@ -538,6 +544,8 @@ namespace connector {
 
     /** \brief Connector passively providing packets
 
+        \tparam PacketType Type of packet to send. Defaults to senf::Packet
+
         The PassiveOutput connector template provides data passively to a connected module whenever
         signaled. This class is completely implemented via it's base-class, GenericPassiveOutput, the
         only difference is that it only sends packets of type \a PacketType.
index 2491f50..17aa545 100644 (file)
 
     \section ppi_classdiagram Class Diagram
 
-    \image html classes.png
+    <div class="diamap" name="classes">
+    <span coords="652,428,796,455">\ref senf::ppi::connector::PassiveConnector</span>
+    <span coords="198,381,316,408">\ref senf::ppi::EventManager</span>
+    <span coords="462,543,571,570">\ref senf::ppi::connector::ActiveOutput</span>
+    <span coords="468,494,564,521">\ref senf::ppi::connector::ActiveInput</span>
+    <span coords="414,36,505,63">\ref senf::ppi::RouteBase</span>
+    <span coords="432,325,529,379">\ref senf::ppi::Route</span>
+    <span coords="194,154,319,181">\ref (some module)</span>
+    <span coords="19,293,252,333">\ref senf::ppi::EventImplementation</span>
+    <span coords="225,36,289,63">\ref senf::ppi::module::Module</span>
+    <span coords="309,331,397,358">\ref senf::ppi::connector::Connector</span>
+    <span coords="597,543,717,570">\ref senf::ppi::connector::PassiveOutput</span>
+    <span coords="66,432,210,459">\ref senf::ppi::detail::EventBindingBase</span>
+    <span coords="378,428,505,455">\ref senf::ppi::connector::InputConnector</span>
+    <span coords="491,124,694,210">\ref senf::ppi::RouteImplementation</span>
+    <span coords="283,464,423,491">\ref senf::ppi::connector::OutputConnector</span>
+    <span coords="512,428,645,455">\ref senf::ppi::connector::ActiveConnector</span>
+    <span coords="85,487,259,527">\ref senf::ppi::detail::EventBinding</span>
+    <span coords="39,216,170,243">\ref senf::ppi::EventDescriptor</span>
+    <span coords="604,494,710,521">\ref senf::ppi::connector::PassiveInput</span>
+    </div>
+    \htmlonly <img src="classes.png" border="0" alt="classes" usemap="#classes"> \endhtmlonly
  */
 
 
index 5b0e34d..f578635 100644 (file)
 
 /** \defgroup handle_group The Handle Hierarchy
 
-    \htmlonly 
-    <map name="FhHierarchy">
-      <area shape="rect" alt="FileHandle" href="classsenf_1_1FileHandle.html" title="FileHandle" coords="247,1,345,27" />
-      <area shape="rect" alt="SocketHandle" href="classsenf_1_1SocketHandle.html" title="SocketHandle" coords="235,61,355,87" />
-      <area shape="rect" alt="ClientSocketHandle" href="classsenf_1_1ClientSocketHandle.html" title="ClientSocketHandle" coords="32,140,198,167" />
-      <area shape="rect" alt="ServerSocketHandle" href="classsenf_1_1ServerSocketHandle.html" title="ServerSocketHandle" coords="386,140,558,168" />
-      <area shape="rect" alt="ProtocolServerSocketHandle" href="classsenf_1_1ProtocolServerSocketHandle.html" title="ProtocolServerSocketHandle" coords="354,202,590,228" />
-      <area shape="rect" alt="ProtocolClientSocketHandle" href="classsenf_1_1ProtocolClientSocketHandle.html" title="ProtocolClientSocketHandle" coords="1,202,230,228" />
-    </map>
-    <center>
-      <img src="FhHierarchy.png" border="0" alt="FhHierarchy" usemap="#FhHierarchy">
-    </center>
-    \endhtmlonly
+    <div class="diamap" name="FhHierarchy">
+    <span coords="233,47,438,89">\ref SocketHandle</span>
+    <span coords="32,126,281,168">\ref ClientSocketHandle</span>
+    <span coords="0,187,326,229">\ref ProtocolClientSocketHandle</span>
+    <span coords="350,187,684,229">\ref ProtocolServerSocketHandle</span>
+    <span coords="243,0,343,28">\ref FileHandle</span>
+    <span coords="382,126,638,168">\ref ServerSocketHandle</span>
+    </div>
+    \htmlonly <img src="FhHierarchy.png" border="0" alt="FhHierarchy" usemap="#FhHierarchy"> \endhtmlonly
 
     The senf::FileHandle class is the base of a hierarchy of socket handle classes (realized as
     templates). These classes provide an interface to the complete socket API. While going down the
index c473505..9a0c847 100644 (file)
@@ -247,7 +247,48 @@ namespace senf {
 
     \section class_diagram Class Diagram
 
-    \image html SocketLibrary-classes.png
+    <div class="diamap" name="SocketLibrary-classes">
+    <span coords="472,667,559,689">\ref IPv4Protocol</span>
+    <span coords="29,773,139,794">\ref WritePolicyBase</span>
+    <span coords="97,939,238,960">\ref SocketBufferingPolicy</span>
+    <span coords="97,390,223,411">\ref NoAddressingPolicy</span>
+    <span coords="97,736,217,758">\ref NotReadablePolicy</span>
+    <span coords="418,609,613,631">\ref AdressableBSDSocketProtocol</span>
+    <span coords="18,895,153,917">\ref BufferingPolicyBase</span>
+    <span coords="22,426,148,447">\ref FramingPolicyBase</span>
+    <span coords="409,0,495,36">\ref FileBody</span>
+    <span coords="97,469,249,491">\ref DatagramFramingPolicy</span>
+    <span coords="97,317,240,339">\ref INet6AddressingPolicy</span>
+    <span coords="453,544,578,566">\ref BSDSocketProtocol</span>
+    <span coords="97,281,240,303">\ref INet4AddressingPolicy</span>
+    <span coords="452,177,706,209">\ref ProtocolServerSocketHandle</span>
+    <span coords="412,259,486,281">\ref PolicyBase</span>
+    <span coords="474,768,557,790">\ref TCPProtocol</span>
+    <span coords="97,700,197,722">\ref ReadablePolicy</span>
+    <span coords="342,249,654,411">\ref SocketPolicy</span>
+    <span coords="0,541,173,563">\ref CommunicationPolicyBase</span>
+    <span coords="640,859,736,881">\ref TCPv6Protocol</span>
+    <span coords="353,428,453,465">\ref SocketProtocol</span>
+    <span coords="97,585,297,606">\ref ConnectedCommunicationPolicy</span>
+    <span coords="172,177,420,209">\ref ProtocolClientSocketHandle</span>
+    <span coords="472,718,559,739">\ref IPv6Protocol</span>
+    <span coords="97,816,192,838">\ref WritablePolicy</span>
+    <span coords="383,62,520,98">\ref SocketBody</span>
+    <span coords="698,888,798,910">\ref PacketProtocol</span>
+    <span coords="97,852,213,874">\ref NotWritablePolicy</span>
+    <span coords="31,657,138,679">\ref ReadPolicyBase</span>
+    <span coords="213,60,369,91">\ref SocketHandle</span>
+    <span coords="197,126,385,158">\ref ClientSocketHandle</span>
+    <span coords="97,621,311,642">\ref UnconnectedCommunicationPolicy</span>
+    <span coords="567,480,786,526">\ref ConcreteSocketProtocol</span>
+    <span coords="582,830,678,852">\ref TCPv4Protocol</span>
+    <span coords="97,505,234,527">\ref StreamFramingPolicy</span>
+    <span coords="13,238,161,259">\ref AddressingPolicyBase</span>
+    <span coords="224,0,294,36">\ref FileHandle</span>
+    <span coords="97,353,222,375">\ref LLAddressingPolicy</span>
+    <span coords="476,126,671,158">\ref ServerSocketHandle</span>
+    </div>
+    \htmlonly <img src="SocketLibrary-classes.png" border="0" alt="SocketLibrary-classes" usemap="#SocketLibrary-classes"> \endhtmlonly
 
     \section impl_notes Arbitrary Implementation Notes
 
index 9cd03fa..58c9910 100644 (file)
Binary files a/Socket/Protocols.dia and b/Socket/Protocols.dia differ
index 440a9cf..209c374 100644 (file)
 
 /** \defgroup policy_group The Policy Framework
 
-    \htmlonly
-        <map name="socketPolicy">
-          <area shape="rect" alt="SocketPolicy" href="structsenf_1_1SocketPolicy.html" title="SocketPolicy" coords="276,90,558,213" />
-          <area shape="rect" alt="WritePolicyBase" href="structsenf_1_1WritePolicyBase.html" title="WritePolicyBase" coords="39,243,174,268" />
-          <area shape="rect" alt="ReadPolicyBase" href="structsenf_1_1ReadPolicyBase.html" title="ReadPolicyBase" coords="42,204,174,231" />
-          <area shape="rect" alt="CommunicationPolicyBase" href="structsenf_1_1CommunicationPolicyBase.html" title="CommunicationPolicyBase" coords="0,166,215,193" />
-          <area shape="rect" alt="FramingPolicyBase" href="structsenf_1_1FramingPolicyBase.html" title="FramingPolicyBase" coords="30,129,185,155" />
-          <area shape="rect" alt="AddressingPolicyBase" href="structsenf_1_1AddressingPolicyBase.html" title="AddressingPolicyBase" coords="17,90,200,116" />
-        </map>
-        <img src="SocketPolicy.png" border="0" alt="Socket Policy" usemap="#socketPolicy">
-    \endhtmlonly
+    <div class="diamap" name="SocketPolicy">
+    <span coords="39,229,182,257">\ref WritePolicyBase</span>
+    <span coords="17,76,210,105">\ref AddressingPolicyBase</span>
+    <span coords="29,114,194,143">\ref FramingPolicyBase</span>
+    <span coords="368,0,463,28">\ref PolicyBase</span>
+    <span coords="275,2,691,185">\ref SocketPolicy</span>
+    <span coords="0,152,227,181">\ref CommunicationPolicyBase</span>
+    <span coords="41,191,180,219">\ref ReadPolicyBase</span>
+    </div>
+    \htmlonly <img src="SocketPolicy.png" border="0" alt="SocketPolicy" usemap="#SocketPolicy"> \endhtmlonly
         
     \section policy_group_introduction Introduction to the Policy Framework
 
index 587970a..012b857 100644 (file)
 
 /** \defgroup protocol_group The Protocol Classes
 
-    \htmlonly
-    <map name="Protocols">
-    <area shape="rect" alt="SocketProtocol" href="classsenf_1_1SocketProtocol.html" title="SocketProtocol" coords="0,0,118,25"/>
-    <area shape="rect" alt="UNSocketProtocol" href="classsenf_1_1UNSocketProtocol.html" title="UNSocketProtocol" coords="139,392,279,418"/>
-    <area shape="rect" alt="PacketSocketProtocol" href="classsenf_1_1PacketSocketProtocol.html" title="PacketSocketProtocol" coords="527,412,693,438"/>
-    <area shape="rect" alt="ConcreteSocketProtocol" href="classsenf_1_1ConcreteSocketProtocol.html" title="ConcreteSocketProtocol" coords="214,49,471,86"/>
-    <area shape="rect" alt="BSDSocketProtocol" href="classsenf_1_1BSDSocketProtocol.html" title="BSDSocketProtocol" coords="135,112,283,137"/>
-    <area shape="rect" alt="DatagramSocketProtocol" href="classsenf_1_1DatagramSocketProtocol.html" title="DatagramSocketProtocol" coords="114,258,304,284"/>
-    <area shape="rect" alt="TCPSocketProtocol" href="classsenf_1_1TCPSocketProtocol.html" title="TCPSocketProtocol" coords="136,320,281,346"/>
-    <area shape="rect" alt="UNDatagramSocketProtocol" href="classsenf_1_1UNDatagramSocketProtocol.html" title="UNDatagramSocketProtocol" coords="395,446,604,472"/>
-    <area shape="rect" alt="AddressableBSDSocketProtocol" href="classsenf_1_1AddressableBSDSocketProtocol.html" title="AddressableBSDSocketProtocol" coords="89,189,329,215"/>
-    <area shape="rect" alt="TCPv4SocketProtocol" href="classsenf_1_1TCPv4SocketProtocol.html" title="TCPv4SocketProtocol" coords="282,481,444,507"/>
-    </map>
-    <img src="Protocols.png" border="0" alt="Protocols" usemap="#Protocols">
-    \endhtmlonly
+     <div class="diamap" name="Protocols">
+     <span coords="0,0,118,25">\ref SocketProtocol</span>
+     <span coords="139,381,279,407">\ref UNSocketProtocol</span>
+     <span coords="527,412,693,438">\ref PacketSocketProtocol</span>
+     <span coords="214,49,471,86">\ref ConcreteSocketProtocol</span>
+     <span coords="135,112,283,137">\ref BSDSocketProtocol</span>
+     <span coords="114,258,304,284">\ref DatagramSocketProtocol</span>
+     <span coords="136,320,281,346">\ref TCPSocketProtocol</span>
+     <span coords="395,446,604,472">\ref UNDatagramSocketProtocol</span>
+     <span coords="89,189,329,215">\ref AddressableBSDSocketProtocol</span>
+     <span coords="282,481,444,507">\ref TCPv4SocketProtocol</span>
+     </div>
+     \htmlonly <img src="Protocols.png" border="0" alt="Protocols" usemap="#Protocols"> \endhtmlonly
 
     The socket handle classes and templates only implement the most important socket API methods
     using the policy framework. To access the complete API, the protocol interface is
diff --git a/Utils/Externals.dox b/Utils/Externals.dox
new file mode 100644 (file)
index 0000000..f517454
--- /dev/null
@@ -0,0 +1,16 @@
+/**\defgroup externals External objects referenced from within SENF */
+///\addtogroup externals
+///\{
+namespace boost { class array {}; }
+namespace boost { class base_from_member {}; }
+namespace boost { class enable_if {}; }
+namespace boost { class equality_comparable {}; }
+namespace boost { class false_type {}; }
+namespace boost { class iterator_facade {}; }
+namespace boost { class noncopyable {}; }
+namespace boost { class singleton_pool {}; }
+namespace boost { class totally_ordered {}; }
+namespace boost { class true_type {}; }
+namespace std { class exception {}; }
+namespace std { class string {}; }
+///\}
index fab9b0a..ddf11b9 100644 (file)
@@ -1325,14 +1325,14 @@ CALLER_GRAPH           = NO
 # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
 # will graphical hierarchy of all classes instead of a textual one.
 
-GRAPHICAL_HIERARCHY    = YES
+GRAPHICAL_HIERARCHY    = NO
 
 # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
 # then doxygen will show the dependencies a directory has on other directories 
 # in a graphical way. The dependency relations are determined by the #include
 # relations between the files in the directories.
 
-DIRECTORY_GRAPH        = YES
+DIRECTORY_GRAPH        = NO
 
 # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
 # generated by dot. Possible values are png, jpg, or gif
@@ -1369,7 +1369,7 @@ DOT_GRAPH_MAX_NODES    = 10
 # code bases. Also note that the size of a graph can be further restricted by 
 # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
 
-MAX_DOT_GRAPH_DEPTH    = 3
+MAX_DOT_GRAPH_DEPTH    = 5
 
 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
 # background. This is enabled by default, which results in a transparent 
index ba31692..d0ccf86 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 topdir="`dirname "$0"`"; topdir="`cd "$topdir/.."; pwd`"
+sed -i -e 's/rankdir=LR/rankdir=TB/' "$1"
 "$topdir/doclib/dot-munge.pl" "$1"
 
 case "$2" in
index dd0d8f9..6214e48 100755 (executable)
@@ -5,7 +5,7 @@ s/fontsize=10/fontsize=8/g;
 s/fontname="FreeSans.ttf"/fontname="Verdana"/g;
 
 # Wrap long labels (templates and pathnames)
-if (/label=\"([^"]*)\"/) {                                  #"])){ # To make emacs happy ...
+if (/label=\"([^"]{48,})\"/) {                              #"])){ # To make emacs happy ...
     $pre=$`; 
     $post=$';                                               #';    # To make emacs happy ...
     $label=$1;
index dd192c8..6a022e2 100755 (executable)
@@ -1,14 +1,21 @@
 #!/usr/bin/perl -n
 
+BEGIN {
+    ($topdir=$0) =~ s{doclib/.*$}{};
+                     print $topdir,"\n";
+}
+
 s/\s*$//;
 while (s/\t/' 'x(8-length($`)%8)/e) {}
 
 if (/^\s*\\code$/ .. /\\endcode/ && !/^$/) {
     $i=length($1) if /^(\s*)\\code$/;
     print substr($_,$i),"\n";
-} elsif (s/^(\s*)<pre>$/$1<pre class="fragment">/ .. /<\/pre>/ && !/^$/) {
+} 
+elsif (s/^(\s*)<pre>$/$1<pre class="fragment">/ .. /<\/pre>/ && !/^$/) {
     $i=length($1) if /^(\s*)<pre class="fragment">$/;
     print substr($_,$i),"\n";
-} else {
+} 
+else {
     print $_,"\n";
 }
index 4579003..734ca8b 100644 (file)
       <xsl:apply-templates/>\r
     </xsl:copy>\r
   </xsl:template>\r
+  \r
+  <!-- Build dia image-map from special div/span elements -->\r
+  <xsl:template match="div[@class='diamap']">\r
+    <xsl:element name="map">\r
+      <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>\r
+      <xsl:for-each select="span">\r
+        <xsl:if test="a">\r
+          <xsl:variable name="name" select="string(a[1])"/>\r
+          <xsl:element name="area">\r
+            <xsl:attribute name="shape">rect</xsl:attribute>\r
+            <xsl:attribute name="alt"><xsl:value-of select="$name"/></xsl:attribute>\r
+            <xsl:attribute name="title"><xsl:value-of select="$name"/></xsl:attribute>\r
+            <xsl:attribute name="href"><xsl:value-of select="a[1]/@href"/></xsl:attribute>\r
+            <xsl:attribute name="coords"><xsl:value-of select="@coords"/></xsl:attribute>\r
+          </xsl:element>\r
+        </xsl:if>\r
+      </xsl:for-each>\r
+    </xsl:element>\r
+  </xsl:template>\r
 \r
   <!-- Remove the automatically inserted search form (we build our own) -->\r
   <xsl:template match="li[form]"> \r
   </xsl:template>\r
+\r
+  <xsl:template match="table[preceding-sibling::*[1][self::div][@class='qindex']]">\r
+    <xsl:call-template name="add-class">\r
+      <xsl:with-param name="class">qindextable</xsl:with-param>\r
+    </xsl:call-template>\r
+  </xsl:template>\r
   \r
   <xsl:template match="dl[dt/b/a/text()='Bug:']">\r
     <xsl:call-template name="add-class">\r
     </xsl:call-template>\r
   </xsl:template>\r
 \r
-  <xsl:template match="dl[dt/b/text()='Parameters:']">\r
+  <xsl:template match="dl[dt/b/text()='Parameters:']|dl[dt/b/text()='Template Parameters:']">\r
     <xsl:call-template name="add-class">\r
       <xsl:with-param name="class">parameters</xsl:with-param>\r
     </xsl:call-template>\r
diff --git a/doclib/makeDiaImageMap.py b/doclib/makeDiaImageMap.py
new file mode 100755 (executable)
index 0000000..db9a9ce
--- /dev/null
@@ -0,0 +1,81 @@
+#!/usr/bin/python
+
+import sys, os, gzip
+import Ft.Xml.Xslt.Processor
+import Ft.Xml.Domlette
+from Ft.Xml.InputSource import DefaultFactory as InputFactory
+import cStringIO
+
+stylesheet=u"""
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet 
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:dia="http://www.lysator.liu.se/~alla/dia/"
+  version="1.0">
+
+  <xsl:output method="text"/>
+
+  <xsl:template match="text()"/>
+
+  <xsl:template match="dia:object[@type='UML - Class']">
+    <xsl:value-of select="dia:attribute[@name='name']/dia:string"/>
+    <xsl:text> </xsl:text>
+    <xsl:value-of select="dia:attribute[@name='obj_bb']/dia:rectangle/@val"/>
+    <xsl:text>&#x0a;</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="dia:attribute[@name='obj_bb']/dia:rectangle">
+    <xsl:text>## </xsl:text>
+    <xsl:value-of select="@val"/>
+    <xsl:text>&#x0a;</xsl:text>
+  </xsl:template>
+
+</xsl:stylesheet>
+""".strip().encode('utf-8')
+
+def xsltproc(source, stylesheet):
+    processor = Ft.Xml.Xslt.Processor.Processor()
+    processor.setDocumentReader(Ft.Xml.Domlette.NonvalidatingReader)
+    processor.appendStylesheet(stylesheet)
+    output = cStringIO.StringIO()
+    processor.run(source, outputStream = output)
+    return output.getvalue()
+
+minx = miny = maxx = maxy = None
+classes = {}
+
+basename = sys.argv[1].rsplit('.',1)[0]
+png = os.popen("pngtopnm %s.png 2>/dev/null" % basename)
+png.readline()
+size = map(int, png.readline().strip().split(' '))
+png.read()
+
+for line in xsltproc(InputFactory.fromStream(gzip.open(sys.argv[1]), sys.argv[1]),
+                     InputFactory.fromString(stylesheet, '<string>')).strip().split("\n"):
+    name,box = line.rsplit(' ',1)
+    tlx, tly, brx, bry = (float(val)
+                          for point in box.split(';')
+                          for val in point.split(','))
+    name = name[1:-1]
+    if minx is None or tlx<minx : minx = tlx
+    if maxx is None or tlx>maxx : maxx = tlx
+    if minx is None or brx<minx : minx = brx
+    if maxx is None or brx>maxx : maxx = brx
+    if miny is None or tly<miny : miny = tly
+    if maxy is None or tly>maxy : maxy = tly
+    if miny is None or bry<miny : miny = bry
+    if maxy is None or bry>maxy : maxy = bry 
+    if name:
+        classes[name] = (tlx, tly, brx, bry)
+
+print '<div class="diamap" name="%s">' % basename
+for name,box in classes.iteritems():
+    print '<span coords="%d,%d,%d,%d">\\ref %s</span>' % (
+        (box[0]-minx)*size[0]/(maxx-minx),
+        (box[1]-miny)*size[1]/(maxy-miny),
+        (box[2]-minx)*size[0]/(maxx-minx),
+        (box[3]-miny)*size[1]/(maxy-miny),
+        name)
+print '</div>'
+print '\\htmlonly <img src="%s.png" border="0" alt="%s" usemap="#%s"> \\endhtmlonly' % (
+    basename,basename,basename)
index 1e4697d..c11bc75 100644 (file)
@@ -430,7 +430,7 @@ div.ah {
         margin-right: 10px;
 }
 
-div.nav {
+div.nav, div.navpath {
         width: auto;
         background-color: white;
         border: none;
@@ -449,6 +449,14 @@ div.qindex {
         line-height: 140%;
 }
 
+table.qindextable {
+        font-size: 90%;
+}
+
+table.qindextable td {
+        width: 33%;
+}
+
 dl.parameters dd table {
         width: auto;
 }