From 90f251408ad985b386601698a39cf0ffceb23e89 Mon Sep 17 00:00:00 2001
From: g0dil <g0dil@wiback.org>
Date: Thu, 18 Jan 2007 13:44:09 +0000
Subject: [PATCH] Fix doc building again (grmpf)

---
 SConstruct             |  4 +-
 Scheduler/Scheduler.cc |  2 -
 doclib/Doxyfile.global |  2 +-
 doclib/senf.css        | 43 ++++++++++++++++++++++
 senfscons/Doxygen.py   |  2 +-
 senfscons/SENFSCons.py | 83 +++++++++++++++++++-----------------------
 6 files changed, 85 insertions(+), 51 deletions(-)

diff --git a/SConstruct b/SConstruct
index 3d8d8a1a2..c3cd8246e 100644
--- a/SConstruct
+++ b/SConstruct
@@ -13,6 +13,7 @@ env = SENFSCons.MakeEnvironment()
 env.Append(
    CPPPATH = [ '#' ],
    LIBS = [ 'iberty' ],
+   DOXY_XREF_TYPES = [ 'bug', 'fixme', 'todo', 'idea' ],
 )
 
 Export('env')
@@ -22,8 +23,7 @@ SConscript(glob.glob("*/SConscript"))
 SENFSCons.StandardTargets(env)
 SENFSCons.GlobalTargets(env)
 SENFSCons.Doxygen(env)
-SENFSCons.DoxyXRef(env,
-                   TYPES = ('bug','fixme','todo','idea'),
+SENFSCons.DoxyXRef(env, env.Alias('all_docs')[0].sources,
                    HTML_HEADER = '#/doclib/doxy-header-overview.html',
                    HTML_FOOTER = '#/doclib/doxy-footer.html')
 
diff --git a/Scheduler/Scheduler.cc b/Scheduler/Scheduler.cc
index 01e33c89b..3047ab4fb 100644
--- a/Scheduler/Scheduler.cc
+++ b/Scheduler/Scheduler.cc
@@ -29,8 +29,6 @@
     static member Scheduler::instance() must return a thread-local
     value (that is Scheduler::instance() must allocate one Scheduler
     instance per thread)
-
-    \fixme Test2
  */
 
 // Here a basic concept of how to add signal support to the scheduler:
diff --git a/doclib/Doxyfile.global b/doclib/Doxyfile.global
index 5b9b918cb..ac07ee1f8 100644
--- a/doclib/Doxyfile.global
+++ b/doclib/Doxyfile.global
@@ -4,7 +4,7 @@ FILE_PATTERNS          = *.c *.cc *.cci *.ct *.cti *.h *.hh *.ih *.mmc *.dox
 EXCLUDE_PATTERNS       = *.test.cc .*
 IMAGE_PATH             = .
 
-ALIASES                = "fixme=\xrefitem fixme \"Fixme\" \"Fixmes\"" \
+ALIASES                = "fixme=\xrefitem fixme \"Fix\" \"Fixmes\"" \
 			 "idea=\xrefitem idea \"Idea\" \"Ideas\""
 REPEAT_BRIEF           = YES
 ALWAYS_DETAILED_SEC    = YES
diff --git a/doclib/senf.css b/doclib/senf.css
index 19e5b111f..e2086c960 100644
--- a/doclib/senf.css
+++ b/doclib/senf.css
@@ -194,6 +194,17 @@ dl.bug {
 	padding: 0 10px;
 }
 
+dl:contains("Bug:") { 
+	border: 1px solid #CC8888;
+	padding: 5px;
+	background-color: #FFEEEE;
+	color: #666666;
+}
+
+dl:contains("Bug:") a { 
+	color: #6666FF;
+}
+
 dl.fixme { 
 	border: 1px solid #EEEE00;
 	border-left-width: 4px;
@@ -201,6 +212,17 @@ dl.fixme {
 	padding: 0 10px;
 }
 
+dl:contains("Fix:") { 
+	border: 1px solid #CCCC88;
+	padding: 5px;
+	background-color: #FFFFEE;
+	color: #666666;
+}
+
+dl:contains("Fix:") a { 
+	color: #6666FF;
+}
+
 dl.todo { 
 	border: 1px solid #00AA00;
 	border-left-width: 4px;
@@ -208,6 +230,17 @@ dl.todo {
 	padding: 0 10px;
 }
 
+dl:contains("Todo:") { 
+	border: 1px solid #88CC88;
+	padding: 5px;
+	background-color: #EEFFEE;
+	color: #666666;
+}
+
+dl:contains("Todo:") a { 
+	color: #6666FF;
+}
+
 dl.idea { 
 	border: 1px solid #AAAAAA;
 	border-left-width: 4px;
@@ -215,3 +248,13 @@ dl.idea {
 	padding: 0 10px;
 }
 
+dl:contains("Idea:") { 
+	border: 1px solid #CCCCCC;
+	padding: 5px;
+	background-color: #F8F8F8;
+	color: #666666;
+}
+
+dl:contains("Idea:") a { 
+	color: #6666FF;
+}
\ No newline at end of file
diff --git a/senfscons/Doxygen.py b/senfscons/Doxygen.py
index 705e22a44..bd493a341 100644
--- a/senfscons/Doxygen.py
+++ b/senfscons/Doxygen.py
@@ -179,7 +179,7 @@ def DoxyEmitter(source, target, env):
          # This is needed to silence the (wrong) 'Multiple ways to
          # build the same target' message
          dir.sources = source
-         node = env.File( os.path.join(dir.abspath, ".stamp" ) )
+         node = env.File( os.path.join(dir.abspath, k.lower()+".stamp" ) )
          targets.append(node)
          targets.append(dir)
 
diff --git a/senfscons/SENFSCons.py b/senfscons/SENFSCons.py
index 34604142a..91bac5b7a 100644
--- a/senfscons/SENFSCons.py
+++ b/senfscons/SENFSCons.py
@@ -9,7 +9,7 @@ SCONS_TOOLS = [
 opts = None
 finalizers = []
 
-basedir = os.path.split(__file__)[0]
+basedir = os.path.abspath(os.path.split(__file__)[0])
 
 def InitOpts():
     global opts
@@ -147,23 +147,44 @@ def Objects(env, sources, testSources = None, LIBS = []):
     return objects
 
 def Doxygen(env, doxyfile = "Doxyfile", extra_sources = []):
-    docs = env.Doxygen(doxyfile)
+    # ARGHHH !!! without the [:] we are changing the target list
+    #        ||| WITHIN THE DOXYGEN BUILDER
+    docs = env.Doxygen(doxyfile)[:]
+    xmlnode = None
+    tagnode = None
     for doc in docs:
         if isinstance(doc,SCons.Node.FS.Dir): continue
-        if os.path.basename(str(doc)) == '.stamp' : continue # file stamp
+        if doc.name == 'xml.stamp' : xmlnode = doc
+        if os.path.splitext(doc.name)[1] == '.stamp' : continue # file stamp
         # otherwise it must be the tag file
-        break
-    else:
-        doc = None
-    if doc:
+        tagnode = doc
+
+    if tagnode:
         # Postprocess the tag file to remove the (broken) namespace
         # references
         env.AddPostAction(
-            doc,
-            env.Action([ "xsltproc -o TARGET.temp %s TARGET"
-                         % os.path.join(basedir,"tagmunge.xsl"),
-                         "mv TARGET.temp TARGET" ]))
-        env.Clean(doc,"$TARGET.temp")
+            docs,
+            env.Action("xsltproc -o %(target)s.temp %(template)s %(target)s && mv %(target)s.temp %(target)s"
+                       % { 'target': tagnode.abspath,
+                           'template': os.path.join(basedir,"tagmunge.xsl") }))
+
+    if xmlnode:
+        xrefs = []
+        for type in env.get("DOXY_XREF_TYPES",[ "bug", "todo" ]):
+            xref = os.path.join(xmlnode.dir.abspath,type+".xml")
+            xref_pp = env.Command(xref+'i', [ xref, os.path.join(basedir,'xrefxtract.xslt'), xmlnode ],
+                                  [ "test -s $SOURCE && xsltproc -o $TARGET" +
+                                    " --stringparam module $MODULE" + 
+                                    " --stringparam type $TYPE" +
+                                    " ${SOURCES[1]} $SOURCE || touch $TARGET" ],
+                                  MODULE = xmlnode.dir.dir.dir.name,
+                                  TYPE = type)
+            env.SideEffect(xref, xmlnode)
+            env.AddPreAction(docs, "rm -f %s" % (xref,))
+            env.AddPostAction(docs, "test -r %s || touch %s" % (xref,xref))
+            xrefs.extend(xref_pp)
+        docs.extend(xrefs)
+
     env.Depends(docs,extra_sources)
     for doc in docs :
         env.Alias('all_docs', doc)
@@ -171,41 +192,13 @@ def Doxygen(env, doxyfile = "Doxyfile", extra_sources = []):
         env.Clean('all', doc)
     return docs
 
-def DoxyXRef(env, 
-             TYPES = ('bug','todo'),
+def DoxyXRef(env, docs=None,
              HTML_HEADER = None, HTML_FOOTER = None,
              TITLE = "Cross-reference of action points"):
-    # Hmm .. this looks a bit scary :-) ...
-    xrefis = []
-
-    # This iterates over all doc targets. These are all .stamp and .tag files
-    for node in env.Alias('all_docs')[0].sources:
-        # We are only interested in the xml targets. This is Doxyfile dependent :-(
-        if node.abspath.endswith('/xml/.stamp'):
-            # This is the list of xref categories
-            for type in TYPES:
-                # Here we construct the pathname of the xml file for the category
-                xref = os.path.join(node.dir.abspath,type+'.xml')
-                # And now apply the xrefxtract.xslt tempalte to it. However, we must
-                # only call xsltproc if the source xml file is not empty (therefore the
-                # 'test')
-                xrefi = env.Command(xref+'i', [ xref, '%s/xrefxtract.xslt' % basedir, node ],
-                                    [ "test -s $SOURCE && xsltproc -o $TARGET" +
-                                      " --stringparam module $MODULE" + 
-                                      " --stringparam type $TYPE" +
-                                      " ${SOURCES[1]} $SOURCE || touch $TARGET" ],
-                                    MODULE = node.dir.dir.dir.name,
-                                    TYPE = type)
-                # If the xref xml file does not exist we create it here as an empty
-                # file since doxygen will only create it if it is non-empty.
-                if not env.GetOption('clean') and not os.path.exists(xref):
-                    if not os.path.exists(node.dir.abspath):
-                        env.Execute(SCons.Defaults.Mkdir(node.dir.abspath))
-                    env.Execute(SCons.Defaults.Touch(xref))
-                xrefis.append(xrefi)
-
-    # And here we can now simply combine all the xrefi files
-    xref = env.Command("doc/html/xref.xml", xrefis,
+    if docs is None:
+        docs = env.Alias('all_docs')[0].sources
+    xrefs = [ doc for doc in docs if os.path.splitext(doc.name)[1] == ".xmli" ]
+    xref = env.Command("doc/html/xref.xml", xrefs,
                        [ "echo -e '<?xml version=\"1.0\"?>\\n<xref>' >$TARGET",
                          "cat $SOURCES >> $TARGET",
                          "echo '</xref>' >>$TARGET" ])
-- 
GitLab