From 41e1827f53fa1b9ef018b378f8aca4e4fec6750a Mon Sep 17 00:00:00 2001
From: Dimitri van Heesch <dimitri@stack.nl>
Date: Sun, 21 Jan 2001 19:05:35 +0000
Subject: Release-1.2.4-20010121

---
 Doxyfile                       | 175 ++++++++
 INSTALL                        |   4 +-
 Makefile.in                    |  20 +-
 Makefile.win_make.in           |   5 +-
 Makefile.win_nmake.in          |   5 +-
 README                         |   4 +-
 VERSION                        |   2 +-
 addon/configgen/config_templ.l |  89 -----
 addon/configgen/configgen.cpp  |  20 +-
 addon/xmlgen/Makefile.in       |  12 +
 addon/xmlgen/doxygen.dtd       | 117 ++++++
 addon/xmlgen/main.cpp          |  40 ++
 addon/xmlgen/xml.cpp           | 519 ++++++++++++++++++++++++
 addon/xmlgen/xml.h             |  26 ++
 addon/xmlgen/xml_dtd.h         | 117 ++++++
 addon/xmlgen/xmlgen.pro.in     |  20 +
 addon/xmlgen/xmlgen.t          |  20 +
 configure                      |  26 +-
 doc/features.doc               |   2 +-
 doc/htmlcmds.doc               |   4 +-
 doc/index.doc                  |   2 +-
 doc/trouble.doc                |  37 +-
 make.bat                       |   1 +
 packages/rpm/doxygen.spec      |   2 +-
 qtools/qtools.pro.in           |   1 +
 src/Makefile.in                |  12 +-
 src/classdef.cpp               | 157 +-------
 src/classdef.h                 |  33 +-
 src/classlist.cpp              |  21 +-
 src/code.h                     |   4 +-
 src/code.l                     |  61 +--
 src/config.h                   |   2 +-
 src/config.l                   |  91 +----
 src/declinfo.l                 |   2 +-
 src/defargs.l                  |   3 +-
 src/definition.cpp             |  69 ++--
 src/definition.h               |   5 +-
 src/diagram.cpp                |   6 +-
 src/doc.h                      |   8 +-
 src/doc.l                      | 155 ++++----
 src/dot.cpp                    |   8 +-
 src/doxygen.cpp                | 883 +++++++++++++++++++++--------------------
 src/doxygen.dtd                | 117 ------
 src/doxygen.h                  |  99 +++--
 src/doxygen.pro.in             |  50 +--
 src/doxygen.t                  |  83 ----
 src/doxytag.pro.in             |   8 +-
 src/filedef.cpp                |  60 +--
 src/filedef.h                  |  13 +-
 src/ftvhelp.cpp                |   2 +-
 src/groupdef.cpp               |  35 +-
 src/htmlgen.cpp                |  64 +--
 src/htmlgen.h                  |  13 +-
 src/index.cpp                  | 389 ++++++++++++++----
 src/index.h                    |  31 +-
 src/latexgen.cpp               |  99 ++---
 src/latexgen.h                 |  12 +-
 src/libdoxygen.pro.in          |  48 +++
 src/libdoxygen.t               |  80 ++++
 src/main.cpp                   |  20 +
 src/mangen.h                   |  12 +-
 src/memberdef.cpp              | 241 ++---------
 src/memberdef.h                |   2 +-
 src/memberlist.cpp             |  32 +-
 src/namespacedef.cpp           |  13 +-
 src/outputgen.h                | 405 +++++++++++++------
 src/outputlist.h               |  40 +-
 src/packagedef.cpp             |   5 +-
 src/page.h                     |  49 ++-
 src/pre.l                      |  12 +-
 src/rtfgen.cpp                 |  81 ++--
 src/rtfgen.h                   |  12 +-
 src/scanner.l                  |  36 +-
 src/section.h                  |  11 +-
 src/tagreader.cpp              |  55 ++-
 src/util.cpp                   | 443 ++++++---------------
 src/util.h                     |  45 +--
 src/xml.cpp                    | 126 ------
 src/xml.h                      |  26 --
 src/xml_dtd.h                  | 117 ------
 80 files changed, 3219 insertions(+), 2557 deletions(-)
 create mode 100644 Doxyfile
 create mode 100644 addon/xmlgen/Makefile.in
 create mode 100644 addon/xmlgen/doxygen.dtd
 create mode 100644 addon/xmlgen/main.cpp
 create mode 100644 addon/xmlgen/xml.cpp
 create mode 100644 addon/xmlgen/xml.h
 create mode 100644 addon/xmlgen/xml_dtd.h
 create mode 100644 addon/xmlgen/xmlgen.pro.in
 create mode 100644 addon/xmlgen/xmlgen.t
 delete mode 100644 src/doxygen.dtd
 delete mode 100644 src/doxygen.t
 create mode 100644 src/libdoxygen.pro.in
 create mode 100644 src/libdoxygen.t
 create mode 100644 src/main.cpp
 delete mode 100644 src/xml.cpp
 delete mode 100644 src/xml.h
 delete mode 100644 src/xml_dtd.h

diff --git a/Doxyfile b/Doxyfile
new file mode 100644
index 0000000..3dd5db4
--- /dev/null
+++ b/Doxyfile
@@ -0,0 +1,175 @@
+# Doxyfile 1.2.3-20001126
+
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = Doxygen
+PROJECT_NUMBER         = 
+OUTPUT_DIRECTORY       = doxygen_docs
+OUTPUT_LANGUAGE        = English
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = YES
+EXTRACT_STATIC         = YES
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ALWAYS_DETAILED_SEC    = NO
+FULL_PATH_NAMES        = YES
+STRIP_FROM_PATH        = $(PWD)/
+INTERNAL_DOCS          = NO
+CLASS_DIAGRAMS         = YES
+SOURCE_BROWSER         = YES
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+CASE_SENSE_NAMES       = NO
+HIDE_SCOPE_NAMES       = NO
+VERBATIM_HEADERS       = YES
+SHOW_INCLUDE_FILES     = YES
+JAVADOC_AUTOBRIEF      = YES
+INHERIT_DOCS           = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 8
+ENABLED_SECTIONS       = 
+GENERATE_TODOLIST      = YES
+GENERATE_TESTLIST      = YES
+ALIASES                = 
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = src \
+                         qtools \
+                         $(QTDIR)/src/doc/qarray.doc \
+                         $(QTDIR)/src/doc/qdict.doc \
+                         $(QTDIR)/src/doc/qintdict.doc \
+                         $(QTDIR)/src/doc/qlist.doc \
+                         $(QTDIR)/src/doc/qptrdict.doc \
+                         $(QTDIR)/src/doc/qsortedlist.doc \
+                         $(QTDIR)/src/doc/qstack.doc \
+                         $(QTDIR)/src/doc/qstrlist.doc \
+                         $(QTDIR)/src/doc/qvector.doc \
+                         $(QTDIR)/src/doc/qvaluelist.doc \
+                         $(QTDIR)/src/doc/qtl.doc
+FILE_PATTERNS          = *.h \
+                         *.cpp \
+                         q*.doc
+RECURSIVE              = NO
+EXCLUDE                = src/code.cpp \
+                         src/config.cpp \
+                         src/ce_lex.cpp \
+                         src/ce_parse.cpp \
+                         src/declinfo.cpp \
+                         src/defargs.cpp \
+                         src/doxytag.cpp \
+                         src/pre.cpp \
+                         src/scanner.cpp \
+                         src/tag.cpp \
+                         src/doc.cpp \
+                         src/logos.cpp
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = YES
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = YES
+HTML_OUTPUT            = 
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = NO
+DISABLE_INDEX          = NO
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = YES
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = 
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = NO
+RTF_OUTPUT             = 
+COMPACT_RTF            = NO
+RTF_HYPERLINKS         = NO
+RTF_STYLESHEET_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = 
+MAN_EXTENSION          = .3
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = YES
+EXPAND_ONLY_PREDEF     = YES
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = 
+EXPAND_AS_DEFINED      = 
+#---------------------------------------------------------------------------
+# Configuration::addtions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+HAVE_DOT               = YES
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = NO
+GRAPHICAL_HIERARCHY    = YES
+DOT_PATH               = 
+MAX_DOT_GRAPH_WIDTH    = 2048
+MAX_DOT_GRAPH_HEIGHT   = 2048
+GENERATE_LEGEND        = YES
+#---------------------------------------------------------------------------
+# Configuration::addtions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
+CGI_NAME               = search.cgi
+CGI_URL                = 
+DOC_URL                = 
+DOC_ABSPATH            = 
+BIN_ABSPATH            = /usr/local/bin/
+EXT_DOC_PATHS          = 
diff --git a/INSTALL b/INSTALL
index deffb53..716ee94 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,6 +1,6 @@
-DOXYGEN Version 1.2.4-20010107
+DOXYGEN Version 1.2.4-20010121
 
 Please read the installation section of the manual for instructions.
 
 --------
-Dimitri van Heesch (07 January 2001)
+Dimitri van Heesch (21 January 2001)
diff --git a/Makefile.in b/Makefile.in
index 886fcd4..2117bf2 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,7 +1,7 @@
 
-all: src/version.cpp configgen doxywizard
-	cd qtools ; $(MAKE)
-	cd src ; $(MAKE)
+#all: src/version.cpp configgen doxywizard 
+#	cd qtools ; $(MAKE)
+#	cd src ; $(MAKE)
 
 clean: FORCE
 	cd examples ; $(MAKE) clean
@@ -11,6 +11,7 @@ clean: FORCE
 	cd addon/configgen ; $(MAKE) clean
 	cd addon/doxywizard ; $(MAKE) clean
 	cd addon/xmlread ; $(MAKE) clean
+	cd addon/xmlgen ; $(MAKE) clean
 	-rm -f bin/doxy*
 	-rm -f objects/*.o
 
@@ -18,13 +19,17 @@ distclean: clean
 	cd src ; $(MAKE) distclean
 	cd addon/configgen ; $(MAKE) distclean
 	cd addon/doxywizard ; $(MAKE) distclean
+	cd addon/xmlread ; $(MAKE) distclean
+	cd addon/xmlgen ; $(MAKE) distclean
+	-rm -f lib/lib*
 	-rm -f bin/doxy*
 	-rm -f html
 	-rm -f objects/*.o
-	-rm -f src/Makefile.doxygen src/Makefile.doxytag src/Makefile.doxysearch qtools/Makefile.qtools
+	-rm -f src/Makefile.doxygen src/Makefile.libdoxygen src/Makefile.doxytag 
+	-rm -f src/Makefile.doxysearch qtools/Makefile.qtools
 	-rm -f Makefile qtools/Makefile src/Makefile examples/Makefile doc/Makefile 
 	-rm -f .makeconfig .tmakeconfig
-	-rm -f src/doxygen.pro src/doxytag.pro src/doxysearch.pro qtools/qtools.pro
+	-rm -f src/doxygen.pro src/libdoxygen.pro src/doxytag.pro src/doxysearch.pro qtools/qtools.pro
 	-rm -f src/version.cpp
 	-rm -r addon/configgen/Makefile addon/doxywizard/Makefile
 	-rm -f addon/configgen/Makefile.configgen 
@@ -36,6 +41,9 @@ distclean: clean
 	-rm -f addon/xmlread/xmlread.pro 
 	-rm -f addon/xmlread/Makefile addon/xmlread/Makefile.xmlread
 	-rm -f addon/xmlread/*.o
+	-rm -f addon/xmlgen/xmlgen.pro
+	-rm -f addon/xmlgen/Makefile addon/xmlgen/Makefile.xmlgen
+	-rm -f addon/xmlgen/*.o
 
 install: doxywizard_install
 	$(INSTTOOL) -d $(INSTALL)/bin
@@ -68,7 +76,7 @@ pdf: docs
 	cd latex ; $(MAKE)
 
 archive: clean
-	tar zcvf dx`date +%y%m%d`.tgz addon tmake doc wintools examples bin objects \
+	tar zcvf dx`date +%y%m%d`.tgz Doxyfile addon tmake doc wintools examples bin lib objects \
 	       qtools src configure configure.bin Makefile.in Makefile.win_nmake.in \
                Makefile.win_make.in INSTALL make.bat LANGUAGE.HOWTO LICENSE PLATFORMS \
                VERSION packages
diff --git a/Makefile.win_make.in b/Makefile.win_make.in
index a578819..40f2c45 100644
--- a/Makefile.win_make.in
+++ b/Makefile.win_make.in
@@ -10,11 +10,12 @@ clean:
 	-del objects\*.o
 
 distclean: clean
-	-del src\Makefile.doxygen \
+	-del src\Makefile.libdoxygen \
+	     src\Makefile.doxygen \
 	     src\Makefile.doxytag \
 	     src\Makefile.doxysearch
 	-del Makefile src\Makefile examples\Makefile doc\Makefile
-	-del src\doxygen.pro src\doxytag.pro src\doxysearch.pro
+	-del src\libdoxygen.pro src\doxygen.pro src\doxytag.pro src\doxysearch.pro
 	-del src\version.cpp
 
 docs:
diff --git a/Makefile.win_nmake.in b/Makefile.win_nmake.in
index 4ca50ec..4d9f65a 100644
--- a/Makefile.win_nmake.in
+++ b/Makefile.win_nmake.in
@@ -20,11 +20,12 @@ clean: FORCE
 	-del objects\*.o
 
 distclean: clean
-	-del src\Makefile.doxygen \
+	-del src\Makefile.libdoxygen \
+	     src\Makefile.doxygen \
 	     src\Makefile.doxytag \
 	     src\Makefile.doxysearch
 	-del Makefile src\Makefile examples\Makefile doc\Makefile
-	-del src\doxygen.pro src\doxytag.pro src\doxysearch.pro
+	-del src\libdoxygen.pro src\doxygen.pro src\doxytag.pro src\doxysearch.pro
 	-del src\version.cpp
 
 docs: FORCE
diff --git a/README b/README
index 941d958..fe0f899 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-DOXYGEN Version 1.2.4-20010107
+DOXYGEN Version 1.2.4-20010121
 
 Please read INSTALL for compilation instructions.
 
@@ -7,4 +7,4 @@ The latest version of doxygen can be obtained at
 
 Enjoy,
 
-Dimitri van Heesch (07 January 2001)
+Dimitri van Heesch (21 January 2001)
diff --git a/VERSION b/VERSION
index d8b8c4e..06669b5 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.2.4-20010107
+1.2.4-20010121
diff --git a/addon/configgen/config_templ.l b/addon/configgen/config_templ.l
index 770ad3d..aa1446b 100644
--- a/addon/configgen/config_templ.l
+++ b/addon/configgen/config_templ.l
@@ -695,95 +695,6 @@ void checkConfig()
 #endif
   }
   
-  // Test to see if output directory is valid
-  if (Config::outputDir.isEmpty()) 
-    Config::outputDir=QDir::currentDirPath();
-  else
-  {
-    QDir dir(Config::outputDir);
-    if (!dir.exists())
-    {
-      dir.setPath(QDir::currentDirPath());
-      if (!dir.mkdir(Config::outputDir))
-      {
-        err("Error: tag OUTPUT_DIRECTORY: Output directory `%s' does not "
-	    "exist and cannot be created\n",Config::outputDir.data());
-        exit(1);
-      }
-      else if (!Config::quietFlag)
-      {
-	err("Notice: Output directory `%s' does not exist. "
-	    "I have created it for you.\n", Config::outputDir.data());
-      }
-      dir.cd(Config::outputDir);
-    }
-    Config::outputDir=dir.absPath();
-  }
-
-  if (Config::htmlOutputDir.isEmpty() && Config::generateHtml)
-  {
-    Config::htmlOutputDir=Config::outputDir+"/html";
-  }
-  else if (Config::htmlOutputDir && Config::htmlOutputDir[0]!='/')
-  {
-    Config::htmlOutputDir.prepend(Config::outputDir+'/');
-  }
-  QDir htmlDir(Config::htmlOutputDir);
-  if (Config::generateHtml && !htmlDir.exists() && 
-      !htmlDir.mkdir(Config::htmlOutputDir))
-  {
-    err("Could not create output directory %s\n",Config::htmlOutputDir.data());
-    exit(1);
-  }
-  
-  if (Config::latexOutputDir.isEmpty() && Config::generateLatex)
-  {
-    Config::latexOutputDir=Config::outputDir+"/latex";
-  }
-  else if (Config::latexOutputDir && Config::latexOutputDir[0]!='/')
-  {
-    Config::latexOutputDir.prepend(Config::outputDir+'/');
-  }
-  QDir latexDir(Config::latexOutputDir);
-  if (Config::generateLatex && !latexDir.exists() && 
-      !latexDir.mkdir(Config::latexOutputDir))
-  {
-    err("Could not create output directory %s\n",Config::latexOutputDir.data());
-    exit(1);
-  }
-  
-  if (Config::rtfOutputDir.isEmpty() && Config::generateRTF)
-  {
-    Config::rtfOutputDir=Config::outputDir+"/rtf";
-  }
-  else if (Config::rtfOutputDir && Config::rtfOutputDir[0]!='/')
-  {
-    Config::rtfOutputDir.prepend(Config::outputDir+'/');
-  }
-  QDir rtfDir(Config::rtfOutputDir);
-  if (Config::generateRTF && !rtfDir.exists() && 
-      !rtfDir.mkdir(Config::rtfOutputDir))
-  {
-    err("Could not create output directory %s\n",Config::rtfOutputDir.data());
-    exit(1);
-  }
-
-  if (Config::manOutputDir.isEmpty() && Config::generateMan)
-  {
-    Config::manOutputDir=Config::outputDir+"/man";
-  }
-  else if (Config::manOutputDir && Config::manOutputDir[0]!='/')
-  {
-    Config::manOutputDir.prepend(Config::outputDir+'/');
-  }
-  QDir manDir(Config::manOutputDir);
-  if (Config::generateMan && !manDir.exists() && 
-      !manDir.mkdir(Config::manOutputDir))
-  {
-    err("Could not create output directory %s\n",Config::manOutputDir.data());
-    exit(1);
-  }
-
   // expand the relative stripFromPath values
   char *sfp = Config::stripFromPath.first();
   while (sfp)
diff --git a/addon/configgen/configgen.cpp b/addon/configgen/configgen.cpp
index c7b4ab8..e1c6a2e 100644
--- a/addon/configgen/configgen.cpp
+++ b/addon/configgen/configgen.cpp
@@ -1509,17 +1509,17 @@ void init()
                    );
   addDependency("manExtension","generateMan");
   //-----------------------------------------------------------------------------------------------
-  ConfigInfo::add(  "XML","configuration options related to the XML output");
+  //ConfigInfo::add(  "XML","configuration options related to the XML output");
   //-----------------------------------------------------------------------------------------------
-  ConfigBool::add(  "generateXML",
-                    "GENERATE_XML",
-                    "FALSE",
-                    "generate XML output",
-                    "If the GENERATE_XML tag is set to YES Doxygen will \n"
-                    "generate an XML file that captures the structure of \n"
-                    "the code including all documentation. Warning: This feature \n"
-                    "is still experimental and very incomplete.\n"
-                 );
+  //ConfigBool::add(  "generateXML",
+  //                  "GENERATE_XML",
+  //                  "FALSE",
+  //                  "generate XML output",
+  //                  "If the GENERATE_XML tag is set to YES Doxygen will \n"
+  //                  "generate an XML file that captures the structure of \n"
+  //                  "the code including all documentation. Warning: This feature \n"
+  //                  "is still experimental and very incomplete.\n"
+  //               );
   //-----------------------------------------------------------------------------------------------
   ConfigInfo::add(  "Preprocessor","Configuration options related to the preprocessor   ");
   //-----------------------------------------------------------------------------------------------
diff --git a/addon/xmlgen/Makefile.in b/addon/xmlgen/Makefile.in
new file mode 100644
index 0000000..89d4796
--- /dev/null
+++ b/addon/xmlgen/Makefile.in
@@ -0,0 +1,12 @@
+all clean depend: Makefile.xmlgen 
+	$(MAKE) -f Makefile.xmlgen $@
+
+distclean: clean
+	$(RM) -f Makefile.xmlgen
+
+tmake:
+	export TMAKEPATH=$(TMAKEPATH) ; $(PERL) $(TMAKE) xmlgen.pro >Makefile.xmlgen
+
+Makefile.xmlgen: xmlgen.pro
+	export TMAKEPATH=$(TMAKEPATH) ; $(PERL) $(TMAKE) xmlgen.pro >Makefile.xmlgen
+
diff --git a/addon/xmlgen/doxygen.dtd b/addon/xmlgen/doxygen.dtd
new file mode 100644
index 0000000..62727b8
--- /dev/null
+++ b/addon/xmlgen/doxygen.dtd
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!-- DTD describing the grammar used in doxygen's XML output -->
+
+<!-- standard character entities -->
+<!ENTITY lt     "&#38;#60;"> 
+<!ENTITY gt     "&#62;"> 
+<!ENTITY amp    "&#38;#38;"> 
+<!ENTITY apos   "&#39;"> 
+<!ENTITY quot   "&#34;"> 
+
+<!-- required attributes for compounds -->
+<!ENTITY % compound-req.att 
+                       'id      ID                           #REQUIRED
+                        type    (group|file|namespace|
+                                 class|struct|union|
+                                 interface|dispinterface|
+                                 valuetype|library)          #REQUIRED'
+>
+<!-- required attributes for references -->
+<!ENTITY % ref-req.att   'idref IDREF                        #REQUIRED'
+>
+<!-- required attributes for inheritance relations -->
+<!ENTITY % inheritcompref-req.att
+                         '%ref-req.att;
+                          prot (public|protected|private)    #REQUIRED
+                          virt (non-virtual|virtual)         #REQUIRED'
+>
+
+<!-- required attributes for member sections -->
+<!ENTITY % sec-req.att  'type   (user
+                                |public-type
+                                |public-func
+                                |public-attrib
+                                |public-slot
+                                |public-static-func
+                                |public-static-attrib
+                                |protected-type
+                                |protected-func
+                                |protected-attrib
+                                |protected-slot
+                                |protected-static-func
+                                |protected-static-attrib
+                                |private-type
+                                |private-func
+                                |private-attrib
+                                |private-slot
+                                |private-static-func
+                                |private-static-attrib
+                                |signal
+                                |friend
+                                |related
+				|define|prototype|typedef|enum|func|var
+	                        |dcop-func
+                                |property
+                                )                            #REQUIRED
+                        '
+>
+<!-- required attributes for members -->
+<!ENTITY % mem-req.att  'id     ID                           #REQUIRED'>
+
+<!-- optional attributes for function -->
+<!ENTITY % func-opt.att 'virt   (virtual|pure-virtual)       #IMPLIED'>
+
+<!-- elements -->
+<!ELEMENT doxygen (compoundlist?)>
+<!ELEMENT compoundlist (compounddef)+>
+<!ELEMENT compounddef (compoundname,
+                       basecompoundlist?,  
+                       derivedcompoundlist?, 
+                       sectionlist?        
+                      )
+>
+<!ATTLIST compounddef %compound-req.att;>
+<!ELEMENT basecompoundlist (basecompoundref)+>
+<!ELEMENT derivedcompoundlist (derivedcompoundref)+>
+<!ELEMENT compoundref (#PCDATA)>
+<!ATTLIST compoundref %ref-req.att;>
+<!ELEMENT memberref   (#PCDATA)>
+<!ATTLIST memberref   %ref-req.att;>
+<!ELEMENT basecompoundref EMPTY>
+<!ATTLIST basecompoundref %inheritcompref-req.att;>
+<!ELEMENT derivedcompoundref EMPTY>
+<!ATTLIST derivedcompoundref %inheritcompref-req.att;>
+<!ELEMENT sectionlist (sectiondef)+>
+<!ELEMENT sectiondef  (memberlist)>
+<!ATTLIST sectiondef  %sec-req.att;>
+<!ELEMENT memberlist  (functiondef|variabledef|typedef|definedef|enumdef)+>
+<!ELEMENT functiondef (type?,name,paramlist)>
+<!ATTLIST functiondef %mem-req.att; %func-opt.att;>
+<!ELEMENT variabledef (type,name,array?,initializer?)>
+<!ATTLIST variabledef %mem-req.att;>
+<!ELEMENT typedef     (type,name)>
+<!ATTLIST typedef     %mem-req.att;>
+<!ELEMENT definedef   (name,defparamlist?,initializer?)>
+<!ATTLIST definedef   %mem-req.att;>
+<!ELEMENT enumdef     (name,enumvaluelist)>
+<!ATTLIST enumdef     %mem-req.att;>
+<!ELEMENT slotdef     (type,name,paramlist)>
+<!ATTLIST slotdef     %mem-req.att;>
+<!ELEMENT signaldef   (type,name,paramlist)>
+<!ATTLIST signaldef   %mem-req.att;>
+<!ELEMENT paramlist (param)*>
+<!ELEMENT param (attributes?,type,declname?,defname?,array?,defval?)>
+<!ELEMENT defparamlist (defarg)*>
+<!ELEMENT defarg (#PCDATA)>
+<!ELEMENT enumvaluelist (enumvalue)*>
+<!ELEMENT enumvalue (name,initializer?)>
+<!ELEMENT name (#PCDATA)>
+<!ELEMENT compoundname (#PCDATA)>
+<!ELEMENT declname (#PCDATA)>
+<!ELEMENT defname (#PCDATA)>
+<!ELEMENT type (#PCDATA|memberref|compoundref|compounddef)*>
+<!ELEMENT defval (#PCDATA|memberref|compoundref)*>
+<!ELEMENT initializer (#PCDATA|memberref|compoundref)*>
+<!ELEMENT array (#PCDATA)>
+<!ELEMENT attributes (#PCDATA)>
+
diff --git a/addon/xmlgen/main.cpp b/addon/xmlgen/main.cpp
new file mode 100644
index 0000000..30f9071
--- /dev/null
+++ b/addon/xmlgen/main.cpp
@@ -0,0 +1,40 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ *
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby 
+ * granted. No representations are made about the suitability of this software 
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ * Documents produced by Doxygen are derivative works derived from the
+ * input used in their production; they are not affected by this license.
+ *
+ */
+
+#include "doxygen.h"
+#include "message.h"
+#include "xml.h"
+
+/*! \file
+ *  \brief main entry point for doxygen's XML generator
+ *
+ *  This file contains main()
+ */
+
+/*! Main that generate XML output
+ *  
+ */
+int main(int argc,char **argv)
+{
+  initDoxygen();
+  readConfiguration(argc,argv);
+  parseInput();
+  msg("Generating XML output\n");
+  generateXML();
+  return 0;
+}
diff --git a/addon/xmlgen/xml.cpp b/addon/xmlgen/xml.cpp
new file mode 100644
index 0000000..7717cbe
--- /dev/null
+++ b/addon/xmlgen/xml.cpp
@@ -0,0 +1,519 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ *
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby 
+ * granted. No representations are made about the suitability of this software 
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ * Documents produced by Doxygen are derivative works derived from the
+ * input used in their production; they are not affected by this license.
+ *
+ */
+
+#include "qtbc.h"
+#include "xml.h"
+#include "doxygen.h"
+#include "message.h"
+#include "config.h"
+#include "classlist.h"
+#include "util.h"
+#include "defargs.h"
+
+#include <qdir.h>
+#include <qfile.h>
+#include <qtextstream.h>
+
+const char dtd_data[]=
+#include "xml_dtd.h"
+;
+
+class TextGeneratorXMLImpl : public TextGeneratorIntf
+{
+  public:
+    TextGeneratorXMLImpl(QTextStream &t): m_t(t) {}
+    void writeString(const char *s) const
+    {
+      writeXMLString(m_t,s); 
+    }
+    void writeBreak() const {}
+    void writeLink(const char *extRef,const char *file,
+                   const char *anchor,const char *text
+                  ) const
+    {
+      if (extRef==0) 
+      { writeXMLLink(m_t,file,anchor,text); } 
+      else // external references are not supported for XML
+      { writeXMLString(m_t,text); }
+    }
+  private:
+    QTextStream &m_t;
+};
+
+
+void generateDTD()
+{
+  QCString fileName=Config::outputDir+"/xml/doxygen.dtd";
+  QFile f(fileName);
+  if (!f.open(IO_WriteOnly))
+  {
+    err("Cannot open file %s for writing!\n",fileName.data());
+    return;
+  }
+  QTextStream t(&f);
+  t << dtd_data;
+}
+
+void writeXMLString(QTextStream &t,const char *s)
+{
+  t << convertToXML(s);
+}
+
+void writeXMLLink(QTextStream &t,const char *compoundId,const char *memId,
+                  const char *text)
+{
+  if (memId==0)
+  {
+    t << "<compoundref idref=\"" << compoundId << "\">";
+    writeXMLString(t,text);
+    t << "</compoundref>";
+  }
+  else
+  {
+    t << "<memberref idref=\"" << compoundId << ":" << memId << "\">";
+    writeXMLString(t,text);
+    t << "</memberref>";
+  }
+}
+
+void generateXMLForMember(MemberDef *md,QTextStream &t,Definition *def)
+{
+  if (md->memberType()==MemberDef::EnumValue) return;
+
+  QCString scopeName;
+  if (md->getClassDef()) 
+    scopeName=md->getClassDef()->name();
+  else if (md->getNamespaceDef()) 
+    scopeName=md->getNamespaceDef()->name();
+    
+  t << "            <";
+  enum { define_t,variable_t,typedef_t,enum_t,function_t } xmlType = function_t;
+  switch (md->memberType())
+  {
+    case MemberDef::Define:      t << "definedef";   xmlType=define_t;   break;
+    case MemberDef::EnumValue:   // fall through
+    case MemberDef::Property:    // fall through
+    case MemberDef::Variable:    t << "variabledef"; xmlType=variable_t; break;
+    case MemberDef::Typedef:     t << "typedef";     xmlType=typedef_t;  break;
+    case MemberDef::Enumeration: t << "enumdef";     xmlType=enum_t;     break;
+    case MemberDef::Function:    // fall through
+    case MemberDef::Signal:      // fall through
+    case MemberDef::Prototype:   // fall through
+    case MemberDef::Friend:      // fall through
+    case MemberDef::DCOP:        // fall through
+    case MemberDef::Slot:        t << "functiondef"; xmlType=function_t; break;
+  }
+  t << " id=\"";
+  t << def->getOutputFileBase()
+    << "__"      // can we change this to a non ID char? 
+                 // : do not seem allowed for some parsers!
+    << md->anchor();
+  t << "\"";
+  if (xmlType==function_t && md->virtualness()!=Normal) 
+    // functions has an extra "virt" attribute
+  {
+    t << " virt=\"";
+    switch (md->virtualness())
+    {
+      case Virtual: t << "virtual";      break;
+      case Pure:    t << "pure-virtual"; break;
+      default: ASSERT(0);
+    }
+    t << "\"";
+  }
+  t << ">" << endl;
+  
+  if (xmlType!=define_t && xmlType!=enum_t &&    // These don't have types.
+      (xmlType!=function_t || md->typeString()!=0) // Type is optional here.
+     )
+  {
+    QCString typeStr = replaceAnonymousScopes(md->typeString());
+    if (xmlType==typedef_t && typeStr.left(8)=="typedef ") 
+      typeStr=typeStr.right(typeStr.length()-8);
+    if (xmlType==function_t && typeStr.left(8)=="virtual ") 
+      typeStr=typeStr.right(typeStr.length()-8);
+    t << "              <type>";
+    linkifyText(TextGeneratorXMLImpl(t),scopeName,md->name(),typeStr);
+    t << "</type>" << endl;
+  }
+
+  t << "              <name>";
+  writeXMLString(t,md->name());
+  t << "</name>" << endl;
+  if (xmlType==function_t) //function
+  {
+    t << "              <paramlist>" << endl;
+    ArgumentList *declAl = new ArgumentList;
+    ArgumentList *defAl = md->argumentList();
+    stringToArgumentList(md->argsString(),declAl);
+    if (declAl->count()>0)
+    {
+      ArgumentListIterator declAli(*declAl);
+      ArgumentListIterator defAli(*defAl);
+      Argument *a;
+      for (declAli.toFirst();(a=declAli.current());++declAli)
+      {
+        Argument *defArg = defAli.current();
+        t << "                <param>" << endl;
+        if (!a->attrib.isEmpty())
+        {
+          t << "                  <attributes>";
+          writeXMLString(t,a->attrib);
+          t << "</attributes>" << endl;
+        }
+        if (!a->type.isEmpty())
+        {
+          t << "                  <type>";
+          linkifyText(TextGeneratorXMLImpl(t),scopeName,md->name(),a->type);
+          t << "</type>" << endl;
+        }
+        if (!a->name.isEmpty())
+        {
+          t << "                  <declname>";
+          writeXMLString(t,a->name); 
+          t << "</declname>" << endl;
+        }
+        if (defArg && !defArg->name.isEmpty() && defArg->name!=a->name)
+        {
+          t << "                  <defname>";
+          writeXMLString(t,defArg->name);
+          t << "</defname>" << endl;
+        }
+        if (!a->array.isEmpty())
+        {
+          t << "                  <array>"; 
+          writeXMLString(t,a->array); 
+          t << "</array>" << endl;
+        }
+        if (!a->defval.isEmpty())
+        {
+          t << "                  <defval>";
+          linkifyText(TextGeneratorXMLImpl(t),scopeName,md->name(),a->defval);
+          t << "</defval>" << endl;
+        }
+        t << "                </param>" << endl;
+        if (defArg) ++defAli;
+      }
+    }
+    delete declAl;
+    t << "              </paramlist>" << endl;
+  }
+  else if (xmlType==define_t && md->argsString()!=0) // define
+  {
+    t << "              <defparamlist>" << endl;
+    ArgumentListIterator ali(*md->argumentList());
+    Argument *a;
+    for (ali.toFirst();(a=ali.current());++ali)
+    {
+      t << "                <defarg>" << a->type << "</defarg>" << endl;
+    }
+    t << "              </defparamlist>" << endl;
+    if (!md->initializer().isEmpty())
+    {
+      t << "             <initializer>";
+      linkifyText(TextGeneratorXMLImpl(t),scopeName,md->name(),md->initializer());
+      t << "</initializer>" << endl;
+    }
+  }
+  else if (xmlType==enum_t) // enum
+  {
+    t << "              <enumvaluelist>" << endl;
+    if (md->enumFieldList())
+    {
+      MemberListIterator emli(*md->enumFieldList());
+      MemberDef *emd;
+      for (emli.toFirst();(emd=emli.current());++emli)
+      {
+        t << "                <enumvalue>" << endl;
+        t << "                  <name>";
+        writeXMLString(t,emd->name());
+        t << "</name>" << endl;
+        if (!emd->initializer().isEmpty())
+        {
+          t << "                  <initializer>";
+          writeXMLString(t,emd->initializer());
+          t << "</initializer>" << endl;
+        }
+        t << "                </enumvalue>" << endl;
+      }
+    }
+    t << "              </enumvaluelist>" << endl;
+  }
+  t << "            </";
+  switch (md->memberType())
+  {
+    case MemberDef::Define:      t << "definedef";   break;
+    case MemberDef::EnumValue:   // fall through
+    case MemberDef::Property:    // fall through
+    case MemberDef::Variable:    t << "variabledef"; break;
+    case MemberDef::Typedef:     t << "typedef";     break;
+    case MemberDef::Enumeration: t << "enumdef";     break;
+    case MemberDef::Function:    // fall through
+    case MemberDef::Signal:      // fall through
+    case MemberDef::Prototype:   // fall through
+    case MemberDef::Friend:      // fall through
+    case MemberDef::DCOP:        // fall through
+    case MemberDef::Slot:        t << "functiondef"; break;
+  }
+  t << ">" << endl;
+}
+
+
+void generateXMLClassSection(ClassDef *cd,QTextStream &t,MemberList *ml,const char *type)
+{
+  if (ml->count()>0)
+  {
+    t << "        <sectiondef type=\"" << type << "\">" << endl;
+    t << "          <memberlist>" << endl;
+    MemberListIterator mli(*ml);
+    MemberDef *md;
+    for (mli.toFirst();(md=mli.current());++mli)
+    {
+      generateXMLForMember(md,t,cd);
+    }
+    t << "          </memberlist>" << endl;
+    t << "        </sectiondef>" << endl;
+  }
+}
+
+void generateXMLForClass(ClassDef *cd,QTextStream &t)
+{
+  if (cd->name().find('@')!=-1) return; // skip anonymous compounds
+  t << "    <compounddef id=\"" 
+    << cd->getOutputFileBase() << "\" type=\"" 
+    << cd->compoundTypeString() << "\">" << endl;
+  t << "      <compoundname>"; 
+  writeXMLString(t,cd->name()); 
+  t << "</compoundname>" << endl;
+  if (cd->baseClasses()->count()>0)
+  {
+    t << "      <basecompoundlist>" << endl;
+    BaseClassListIterator bcli(*cd->baseClasses());
+    BaseClassDef *bcd;
+    for (bcli.toFirst();(bcd=bcli.current());++bcli)
+    {
+      t << "        <basecompoundref idref=\"" 
+        << bcd->classDef->getOutputFileBase()
+        << "\" prot=\"";
+      switch (bcd->prot)
+      {
+        case Public:    t << "public";    break;
+        case Protected: t << "protected"; break;
+        case Private:   t << "private";   break;
+      }
+      t << "\" virt=\"";
+      switch(bcd->virt)
+      {
+        case Normal:  t << "non-virtual";  break;
+        case Virtual: t << "virtual";      break;
+        case Pure:    t <<"pure-virtual"; break;
+      }
+      t << "\"/>" << endl;
+    }
+    t << "      </basecompoundlist>" << endl;
+  }
+  if (cd->superClasses()->count()>0)
+  {
+    t << "      <derivedcompoundlist>" << endl;
+    BaseClassListIterator bcli(*cd->superClasses());
+    BaseClassDef *bcd;
+    for (bcli.toFirst();(bcd=bcli.current());++bcli)
+    {
+      t << "        <derivedcompoundref idref=\"" 
+        << bcd->classDef->getOutputFileBase()
+        << "\" prot=\"";
+      switch (bcd->prot)
+      {
+        case Public:    t << "public";    break;
+        case Protected: t << "protected"; break;
+        case Private:   t << "private";   break;
+      }
+      t << "\" virt=\"";
+      switch(bcd->virt)
+      {
+        case Normal:  t << "non-virtual";  break;
+        case Virtual: t << "virtual";      break;
+        case Pure:    t << "pure-virtual"; break;
+      }
+      t << "\"/>" << endl;
+    }
+    t << "      </derivedcompoundlist>" << endl;
+  }
+  int numMembers = 
+    cd->pubTypes.count()+cd->pubMembers.count()+cd->pubAttribs.count()+
+    cd->pubSlots.count()+cd->signals.count()+cd->dcopMethods.count()+
+    cd->pubStaticMembers.count()+
+    cd->pubStaticAttribs.count()+cd->proTypes.count()+cd->proMembers.count()+
+    cd->proAttribs.count()+cd->proSlots.count()+cd->proStaticMembers.count()+
+    cd->proStaticAttribs.count()+cd->priTypes.count()+cd->priMembers.count()+
+    cd->priAttribs.count()+cd->priSlots.count()+cd->priStaticMembers.count()+
+    cd->priStaticAttribs.count()+cd->friends.count()+cd->related.count();
+  if (numMembers>0)
+  {
+    t << "      <sectionlist>" << endl;
+    generateXMLClassSection(cd,t,&cd->pubTypes,"public-type");
+    generateXMLClassSection(cd,t,&cd->pubMembers,"public-func");
+    generateXMLClassSection(cd,t,&cd->pubAttribs,"public-attrib");
+    generateXMLClassSection(cd,t,&cd->pubSlots,"public-slot");
+    generateXMLClassSection(cd,t,&cd->signals,"signal");
+    generateXMLClassSection(cd,t,&cd->dcopMethods,"dcop-func");
+    generateXMLClassSection(cd,t,&cd->properties,"property");
+    generateXMLClassSection(cd,t,&cd->pubStaticMembers,"public-static-func");
+    generateXMLClassSection(cd,t,&cd->pubStaticAttribs,"public-static-attrib");
+    generateXMLClassSection(cd,t,&cd->proTypes,"protected-type");
+    generateXMLClassSection(cd,t,&cd->proMembers,"protected-func");
+    generateXMLClassSection(cd,t,&cd->proAttribs,"protected-attrib");
+    generateXMLClassSection(cd,t,&cd->proSlots,"protected-slot");
+    generateXMLClassSection(cd,t,&cd->proStaticMembers,"protected-static-func");
+    generateXMLClassSection(cd,t,&cd->proStaticAttribs,"protected-static-attrib");
+    generateXMLClassSection(cd,t,&cd->priTypes,"private-type");
+    generateXMLClassSection(cd,t,&cd->priMembers,"private-func");
+    generateXMLClassSection(cd,t,&cd->priAttribs,"private-attrib");
+    generateXMLClassSection(cd,t,&cd->priSlots,"private-slot");
+    generateXMLClassSection(cd,t,&cd->priStaticMembers,"private-static-func");
+    generateXMLClassSection(cd,t,&cd->priStaticAttribs,"private-static-attrib");
+    generateXMLClassSection(cd,t,&cd->friends,"signal");
+    generateXMLClassSection(cd,t,&cd->related,"related");
+    t << "      </sectionlist>" << endl;
+  }
+  t << "    </compounddef>" << endl;
+}
+
+void generateXMLFileSection(FileDef *fd,QTextStream &t,MemberList *ml,const char *type)
+{
+  if (ml->count()>0)
+  {
+    t << "        <sectiondef type=\"" << type << "\">" << endl;
+    t << "          <memberlist>" << endl;
+    MemberListIterator mli(*ml);
+    MemberDef *md;
+    for (mli.toFirst();(md=mli.current());++mli)
+    {
+      generateXMLForMember(md,t,fd);
+    }
+    t << "          </memberlist>" << endl;
+    t << "        </sectiondef>" << endl;
+  }
+}
+
+void generateXMLForFile(FileDef *fd,QTextStream &t)
+{
+  t << "    <compounddef id=\"" 
+    << fd->getOutputFileBase() << "\" type=\"file\">" << endl;
+  t << "      <compoundname>";
+  writeXMLString(t,fd->name());
+  t << "</compoundname>" << endl;
+  int numMembers = fd->defineMembers.count()+fd->protoMembers.count()+
+                   fd->typedefMembers.count()+fd->enumMembers.count()+
+                   fd->funcMembers.count()+fd->varMembers.count();
+  if (numMembers>0)
+  {
+    t << "      <sectionlist>" << endl;
+    generateXMLFileSection(fd,t,&fd->defineMembers,"define");
+    generateXMLFileSection(fd,t,&fd->protoMembers,"prototype");
+    generateXMLFileSection(fd,t,&fd->typedefMembers,"typedef");
+    generateXMLFileSection(fd,t,&fd->enumMembers,"enum");
+    generateXMLFileSection(fd,t,&fd->funcMembers,"func");
+    generateXMLFileSection(fd,t,&fd->varMembers,"var");
+    t << "      </sectionlist>" << endl;
+  }
+  t << "    </compounddef>" << endl;
+}
+
+
+void generateXML()
+{
+  if (Config::outputDir.isEmpty())
+    Config::outputDir=QDir::currentDirPath();
+  else
+  {
+    QDir dir(Config::outputDir);
+    if (!dir.exists())
+    {
+      dir.setPath(QDir::currentDirPath());
+      if (!dir.mkdir(Config::outputDir))
+      {
+        err("Error: tag OUTPUT_DIRECTORY: Output directory `%s' does not "
+            "exist and cannot be created\n",Config::outputDir.data());
+        exit(1);
+      }
+      else if (!Config::quietFlag)
+      {
+        err("Notice: Output directory `%s' does not exist. "
+            "I have created it for you.\n", Config::outputDir.data());
+      }
+      dir.cd(Config::outputDir);
+    }
+    Config::outputDir=dir.absPath();
+  }
+
+  QDir dir(Config::outputDir);
+  if (!dir.exists())
+  {
+    dir.setPath(QDir::currentDirPath());
+    if (!dir.mkdir(Config::outputDir))
+    {
+      err("Cannot create directory %s\n",Config::outputDir.data());
+      return;
+    }
+  }
+  QDir xmlDir(Config::outputDir+"/xml");
+  if (!xmlDir.exists() && !xmlDir.mkdir(Config::outputDir+"/xml"))
+  {
+    err("Could not create xml directory in %s\n",Config::outputDir.data());
+    return;
+  }
+  generateDTD();
+  
+  QCString fileName=Config::outputDir+"/xml/doxygen.xml";
+  QFile f(fileName);
+  if (!f.open(IO_WriteOnly))
+  {
+    err("Cannot open file %s for writing!\n",fileName.data());
+    return;
+  }
+  QTextStream t(&f);
+  t << "<?xml version='1.0' encoding='ISO-8859-1' standalone='no'?>" << endl;
+  t << "<!DOCTYPE doxygen SYSTEM \"doxygen.dtd\">" << endl;
+  t << "<doxygen>" << endl;
+  if (Doxygen::classList.count()+Doxygen::inputNameList.count()>0)
+  {
+    t << "  <compoundlist>" << endl;
+    ClassListIterator cli(Doxygen::classList);
+    ClassDef *cd;
+    for (cli.toFirst();(cd=cli.current());++cli)
+    {
+      generateXMLForClass(cd,t);
+    }
+    FileNameListIterator fnli(Doxygen::inputNameList);
+    FileName *fn;
+    for (;(fn=fnli.current());++fnli)
+    {
+      FileNameIterator fni(*fn);
+      FileDef *fd;
+      for (;(fd=fni.current());++fni)
+      {
+        generateXMLForFile(fd,t);
+      }
+    }
+    t << "  </compoundlist>" << endl;
+  }
+  t << "</doxygen>" << endl;
+}
+
+
diff --git a/addon/xmlgen/xml.h b/addon/xmlgen/xml.h
new file mode 100644
index 0000000..6a249db
--- /dev/null
+++ b/addon/xmlgen/xml.h
@@ -0,0 +1,26 @@
+/******************************************************************************
+ *
+ * $Id$
+ *
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby 
+ * granted. No representations are made about the suitability of this software 
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+
+#ifndef XML_H
+#define XML_H
+
+class QTextStream;
+
+void generateXML();
+void writeXMLString(QTextStream &t,const char *s);
+void writeXMLString(QTextStream &t,const char *s);
+void writeXMLLink(QTextStream &t,const char *compoundRef,const char *memAnchor,
+                                 const char *text);
+
+#endif
diff --git a/addon/xmlgen/xml_dtd.h b/addon/xmlgen/xml_dtd.h
new file mode 100644
index 0000000..010a465
--- /dev/null
+++ b/addon/xmlgen/xml_dtd.h
@@ -0,0 +1,117 @@
+"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
+"<!-- DTD describing the grammar used in doxygen's XML output -->\n"
+"\n"
+"<!-- standard character entities -->\n"
+"<!ENTITY lt     \"&#38;#60;\"> \n"
+"<!ENTITY gt     \"&#62;\"> \n"
+"<!ENTITY amp    \"&#38;#38;\"> \n"
+"<!ENTITY apos   \"&#39;\"> \n"
+"<!ENTITY quot   \"&#34;\"> \n"
+"\n"
+"<!-- required attributes for compounds -->\n"
+"<!ENTITY % compound-req.att \n"
+"                       'id      ID                           #REQUIRED\n"
+"                        type    (group|file|namespace|\n"
+"                                 class|struct|union|\n"
+"                                 interface|dispinterface|\n"
+"                                 valuetype|library)          #REQUIRED'\n"
+">\n"
+"<!-- required attributes for references -->\n"
+"<!ENTITY % ref-req.att   'idref IDREF                        #REQUIRED'\n"
+">\n"
+"<!-- required attributes for inheritance relations -->\n"
+"<!ENTITY % inheritcompref-req.att\n"
+"                         '%ref-req.att;\n"
+"                          prot (public|protected|private)    #REQUIRED\n"
+"                          virt (non-virtual|virtual)         #REQUIRED'\n"
+">\n"
+"\n"
+"<!-- required attributes for member sections -->\n"
+"<!ENTITY % sec-req.att  'type   (user\n"
+"                                |public-type\n"
+"                                |public-func\n"
+"                                |public-attrib\n"
+"                                |public-slot\n"
+"                                |public-static-func\n"
+"                                |public-static-attrib\n"
+"                                |protected-type\n"
+"                                |protected-func\n"
+"                                |protected-attrib\n"
+"                                |protected-slot\n"
+"                                |protected-static-func\n"
+"                                |protected-static-attrib\n"
+"                                |private-type\n"
+"                                |private-func\n"
+"                                |private-attrib\n"
+"                                |private-slot\n"
+"                                |private-static-func\n"
+"                                |private-static-attrib\n"
+"                                |signal\n"
+"                                |friend\n"
+"                                |related\n"
+"				|define|prototype|typedef|enum|func|var\n"
+"	                        |dcop-func\n"
+"                                |property\n"
+"                                )                            #REQUIRED\n"
+"                        '\n"
+">\n"
+"<!-- required attributes for members -->\n"
+"<!ENTITY % mem-req.att  'id     ID                           #REQUIRED'>\n"
+"\n"
+"<!-- optional attributes for function -->\n"
+"<!ENTITY % func-opt.att 'virt   (virtual|pure-virtual)       #IMPLIED'>\n"
+"\n"
+"<!-- elements -->\n"
+"<!ELEMENT doxygen (compoundlist?)>\n"
+"<!ELEMENT compoundlist (compounddef)+>\n"
+"<!ELEMENT compounddef (compoundname,\n"
+"                       basecompoundlist?,  \n"
+"                       derivedcompoundlist?, \n"
+"                       sectionlist?        \n"
+"                      )\n"
+">\n"
+"<!ATTLIST compounddef %compound-req.att;>\n"
+"<!ELEMENT basecompoundlist (basecompoundref)+>\n"
+"<!ELEMENT derivedcompoundlist (derivedcompoundref)+>\n"
+"<!ELEMENT compoundref (#PCDATA)>\n"
+"<!ATTLIST compoundref %ref-req.att;>\n"
+"<!ELEMENT memberref   (#PCDATA)>\n"
+"<!ATTLIST memberref   %ref-req.att;>\n"
+"<!ELEMENT basecompoundref EMPTY>\n"
+"<!ATTLIST basecompoundref %inheritcompref-req.att;>\n"
+"<!ELEMENT derivedcompoundref EMPTY>\n"
+"<!ATTLIST derivedcompoundref %inheritcompref-req.att;>\n"
+"<!ELEMENT sectionlist (sectiondef)+>\n"
+"<!ELEMENT sectiondef  (memberlist)>\n"
+"<!ATTLIST sectiondef  %sec-req.att;>\n"
+"<!ELEMENT memberlist  (functiondef|variabledef|typedef|definedef|enumdef)+>\n"
+"<!ELEMENT functiondef (type?,name,paramlist)>\n"
+"<!ATTLIST functiondef %mem-req.att; %func-opt.att;>\n"
+"<!ELEMENT variabledef (type,name,array?,initializer?)>\n"
+"<!ATTLIST variabledef %mem-req.att;>\n"
+"<!ELEMENT typedef     (type,name)>\n"
+"<!ATTLIST typedef     %mem-req.att;>\n"
+"<!ELEMENT definedef   (name,defparamlist?,initializer?)>\n"
+"<!ATTLIST definedef   %mem-req.att;>\n"
+"<!ELEMENT enumdef     (name,enumvaluelist)>\n"
+"<!ATTLIST enumdef     %mem-req.att;>\n"
+"<!ELEMENT slotdef     (type,name,paramlist)>\n"
+"<!ATTLIST slotdef     %mem-req.att;>\n"
+"<!ELEMENT signaldef   (type,name,paramlist)>\n"
+"<!ATTLIST signaldef   %mem-req.att;>\n"
+"<!ELEMENT paramlist (param)*>\n"
+"<!ELEMENT param (attributes?,type,declname?,defname?,array?,defval?)>\n"
+"<!ELEMENT defparamlist (defarg)*>\n"
+"<!ELEMENT defarg (#PCDATA)>\n"
+"<!ELEMENT enumvaluelist (enumvalue)*>\n"
+"<!ELEMENT enumvalue (name,initializer?)>\n"
+"<!ELEMENT name (#PCDATA)>\n"
+"<!ELEMENT compoundname (#PCDATA)>\n"
+"<!ELEMENT declname (#PCDATA)>\n"
+"<!ELEMENT defname (#PCDATA)>\n"
+"<!ELEMENT type (#PCDATA|memberref|compoundref|compounddef)*>\n"
+"<!ELEMENT defval (#PCDATA|memberref|compoundref)*>\n"
+"<!ELEMENT initializer (#PCDATA|memberref|compoundref)*>\n"
+"<!ELEMENT array (#PCDATA)>\n"
+"<!ELEMENT attributes (#PCDATA)>\n"
+"\n"
diff --git a/addon/xmlgen/xmlgen.pro.in b/addon/xmlgen/xmlgen.pro.in
new file mode 100644
index 0000000..c16db47
--- /dev/null
+++ b/addon/xmlgen/xmlgen.pro.in
@@ -0,0 +1,20 @@
+TEMPLATE     =	xmlgen.t
+CONFIG       =	console warn_on $extraopt
+HEADERS      =	xml.h xml_dtd.h
+SOURCES      =	main.cpp xml.cpp
+DEPENDPATH   = ../../src
+unix:LIBS                  += -L../../lib -ldoxygen -lqtools 
+win32:INCLUDEPATH          += .
+win32-mingw:LIBS           += -L../../lib -ldoxygen -lqtools 
+win32-msvc:LIBS            += qtools.lib doxygen.lib shell32.lib 
+win32-msvc:TMAKE_LFLAGS    += /LIBPATH:..\..\lib
+win32-borland:LIBS         += qtools.lib doxygen.lib shell32.lib
+win32-borland:TMAKE_LFLAGS += -L..\..\lib
+win32:TMAKE_CXXFLAGS       += -DQT_NODLL
+INCLUDEPATH                += ../../qtools ../../src
+DESTDIR                    =  ../../bin
+TARGET                     =  doxygen_xml
+unix:TARGETDEPS            =  ../../lib/libdoxygen.a
+win32:TARGETDEPS           =  ..\..\lib\doxygen.lib
+OBJECTS_DIR                =  obj
+
diff --git a/addon/xmlgen/xmlgen.t b/addon/xmlgen/xmlgen.t
new file mode 100644
index 0000000..5c3ab67
--- /dev/null
+++ b/addon/xmlgen/xmlgen.t
@@ -0,0 +1,20 @@
+#
+# $Id$
+#
+# Copyright (C) 1997-2001 by Dimitri van Heesch.
+#
+# Permission to use, copy, modify, and distribute this software and its
+# documentation under the terms of the GNU General Public License is hereby 
+# granted. No representations are made about the suitability of this software 
+# for any purpose. It is provided "as is" without express or implied warranty.
+# See the GNU General Public License for more details.
+#
+# Documents produced by Doxygen are derivative works derived from the
+# input used in their production; they are not affected by this license.
+#!
+#! doxygen.t: This is a custom template for building Doxygen
+#!
+#$ IncludeTemplate("app.t");
+
+xml_dtd.h: doxygen.dtd
+	cat doxygen.dtd | sed -e "s/\"/\\\\\"/g" -e "s/^/\"/g" -e "s/$$/\\\\n\"/g" >xml_dtd.h 
diff --git a/configure b/configure
index 4770f3d..ff0a2e6 100755
--- a/configure
+++ b/configure
@@ -28,6 +28,7 @@ f_insttool=install
 f_english=NO
 f_configgen=NO
 f_wizard=NO
+f_xmlgen=NO
 
 while test -n "$1";  do
   case $1 in
@@ -70,6 +71,9 @@ while test -n "$1";  do
     --with-doxywizard)
        f_wizard=YES
        ;;
+    --with-xmlgen)
+       f_xmlgen=YES
+       ;;
     -h | -help | --help)
        f_help=y
        ;;
@@ -87,7 +91,7 @@ if test "$f_help" = y; then
 Usage: $0 [--help] [--shared] [--static] [--release] [--debug] 
           [--perl name] [--make name] [--dot name] [--platform target] 
           [--prefix dir] [--install name] [--english-only] 
-          [--with-configgen] [--with-doxywizard]
+          [--with-configgen] [--with-doxywizard] [--with-xmlgen]
 
 Options: 
 
@@ -127,6 +131,9 @@ Options:
   --with-doxywizard     Build the GUI frontend for doxygen. This
                         requires Qt 2.x.x
 
+  --with-xmlgen         Builds a separate doxygen executable that 
+                        generates XML output.
+
 EOF
   test "$f_error" = y && exit 1
   exit 0;
@@ -373,7 +380,7 @@ TMAKE_CXXFLAGS += -DENGLISH_ONLY
 EOF
 fi
 
-f_inmakefiles="Makefile.in qtools/Makefile.in src/Makefile.in examples/Makefile.in doc/Makefile.in addon/configgen/Makefile.in addon/doxywizard/Makefile.in addon/xmlread/Makefile.in"
+f_inmakefiles="Makefile.in addon/xmlgen/Makefile.in qtools/Makefile.in src/Makefile.in examples/Makefile.in doc/Makefile.in addon/configgen/Makefile.in addon/doxywizard/Makefile.in addon/xmlread/Makefile.in"
 
 for i in $f_inmakefiles ; do
      SRC=$i
@@ -385,25 +392,32 @@ for i in $f_inmakefiles ; do
 #
 
 EOF
-     cat .makeconfig $SRC >> $DST
+     cat .makeconfig >> $DST
      if test $i = Makefile.in; then
-       echo "configgen:" >> $DST
+       echo "" >> $DST
+       echo "all: src/version.cpp " >> $DST
+       echo "	\$(MAKE) -C qtools" >> $DST
+       echo "	\$(MAKE) -C src" >> $DST
        if test $f_configgen = YES; then
          echo "	\$(MAKE) -C addon/configgen" >> $DST
        fi
-       echo "doxywizard:" >> $DST
        if test $f_wizard = YES; then
          echo "	\$(MAKE) -C addon/doxywizard" >> $DST
        fi
+       if test $f_xmlgen = YES; then
+         echo "	\$(MAKE) -C addon/xmlgen" >> $DST
+       fi
+       echo "" >> $DST
        echo "doxywizard_install:" >> $DST
        if test $f_wizard = YES; then
          echo "	\$(MAKE) -C addon/doxywizard install" >> $DST
        fi
      fi
+     cat $SRC >> $DST
      echo "  Created $DST from $SRC..."
 done
 
-f_inprofiles="qtools/qtools.pro.in src/doxygen.pro.in src/doxytag.pro.in src/doxysearch.pro.in addon/configgen/configgen.pro.in addon/doxywizard/doxywizard.pro.in addon/xmlread/xmlread.pro.in" 
+f_inprofiles="qtools/qtools.pro.in src/libdoxygen.pro.in src/doxygen.pro.in src/doxytag.pro.in src/doxysearch.pro.in addon/configgen/configgen.pro.in addon/doxywizard/doxywizard.pro.in addon/xmlread/xmlread.pro.in addon/xmlgen/xmlgen.pro.in" 
 
 for i in $f_inprofiles ; do
      SRC=$i
diff --git a/doc/features.doc b/doc/features.doc
index 3c035a0..68d54f0 100644
--- a/doc/features.doc
+++ b/doc/features.doc
@@ -23,7 +23,7 @@
 <li>Requires very little overhead from the writer of the documentation. 
     Plain text will do, but for more fancy or structured output HTML tags 
     and/or some of doxygen's special commands can be used.
-<li>Supports C++, (Corba, Microsoft, and KDE-DCOP) IDL and C sources.
+<li>Supports C++, (Corba, Microsoft, and KDE-DCOP) Java, IDL and C sources.
 <li>Supports documentation of files, namespaces, classes, structs, unions, 
     templates, variables, functions, typedefs, enums and defines. 
 <li>JavaDoc (1.1), Qt-Doc, and KDOC compatible.
diff --git a/doc/htmlcmds.doc b/doc/htmlcmds.doc
index 3a5177b..8c9c28c 100644
--- a/doc/htmlcmds.doc
+++ b/doc/htmlcmds.doc
@@ -49,8 +49,8 @@ documentation. Note that all attributes of a HTML tag are ignored
 <li>\c </H1>   Ends an unnumberd section.
 <li>\c <H2>    Starts an unnumbered subsection.
 <li>\c </H2>   Ends an unnumbered subsection.
-<li>\c <H?>    Where ? is one of {3,4,5,6}, starts an unnumbered subsubsection.
-<li>\c </H?>   Where ? is one of {3,4,5,6}, ends an unnumbered subsubsection.
+<li>\c <H?>    Where ? is one of {3,4,5,6}, starts an unnumbered subsubsection using \c <H3> in HTML.
+<li>\c </H?>   Where ? is one of {3,4,5,6}, ends an unnumbered subsubsection using \c <H3> in HTML.
 <li>\c <I>     Starts a piece of text displayed in an italic font.
 <li>\c <INPUT> Does not generated any output.
 <li>\c </I>    Ends a \c <I> section.
diff --git a/doc/index.doc b/doc/index.doc
index e116ab9..5687c32 100644
--- a/doc/index.doc
+++ b/doc/index.doc
@@ -45,7 +45,7 @@ Documents produced by Doxygen are derivative works derived from the
 input used in their production; they are not affected by this license.
 
 <h2>Introduction</h2>
-Doxygen is a documentation system for C++, IDL 
+Doxygen is a documentation system for C++, Java, IDL 
 (Corba, Microsoft and KDE-DCOP flavors) and C. 
 
 It can help you in three ways:
diff --git a/doc/trouble.doc b/doc/trouble.doc
index 9aaf44b..f03eb99 100644
--- a/doc/trouble.doc
+++ b/doc/trouble.doc
@@ -78,26 +78,31 @@ If you are trying Doxygen let me know what you think of it (do you
 miss certain features?). Even if you decide not to use it, please let me
 know why. 
 
-Furthermore, I would appreciate a mail if you have found
-a bug, or if you have ideas (or even better some code or a patch) 
-how to fix existing bugs and limitations. For patches please use
-"diff -u"
-
 <h2>How to report a bug</h2>
 
-If you think you have found a bug in doxygen, please report it so I can
-fix it.
+I would appreciate an e-mail if you have found
+a bug, or if you have ideas (or even better some code or a patch) 
+how to fix existing bugs and limitations. For patches please use
+"diff -u" or include the files you modified. If you send more than
+one file please tar or zip everything, so I only have to save and download
+one file.
 
-Always include the following information in your bug report: 
-- The version of doxygen you are using.
-- The name and version number of your operating system 
+Always try to include the following information in your bug report: 
+- The version of doxygen you are using (for instance 1.2.4).
+- The name and version number of your operating system (for instance 
+  SuSE Linux 6.4)
+- It is usually a good idea to send along the configuation file as well, 
+  but please use doxygen with the <code>-s</code> flag while generating it
+  to keep it small. 
+- The easiest way for me to solve bugs is if you can send me a small example
+  demonstrating the problem you have. Please make sure the example is valid
+  source code (could potentially compile) and that the problem is really 
+  captured by the example (I often get examples that do not trigger the 
+  actual bug!).
 
-The easiest way for me to solve bugs is if you can send me a small example
-demonstrating the problem you have. Please make sure the example is valid
-source code (try compiling it) and if the problem is really captured by
-the example.
-It is usually a good idea to send along the configuation file as well, 
-but please use doxygen with the <code>-s</code> flag while generating it. 
+If you send only a (vague) description of a bug, you are usually not very 
+helpful and will costs me much more time to figure out what you mean. 
+In the worst-case your bug report may even be completely ignored by me! 
 
 My e-mail address: <a href="mailto:dimitri@stack.nl">dimitri@stack.nl</a> 
 */
diff --git a/make.bat b/make.bat
index 880d8d5..b4ece82 100644
--- a/make.bat
+++ b/make.bat
@@ -29,6 +29,7 @@ type doc\Makefile.win_%MAKE%.in >>doc\Makefile
 
 REM build in release or debug mode 
 type qtools\qtools.pro.in | sed "s/\$extraopts/%MODE%/g" >qtools\qtools.pro
+type src\libdoxygen.pro.in | sed "s/\$extraopts/%MODE%/g" >src\libdoxygen.pro
 type src\doxygen.pro.in | sed "s/\$extraopts/%MODE%/g" >src\doxygen.pro
 type src\doxytag.pro.in | sed "s/\$extraopts/%MODE%/g" >src\doxytag.pro
 type src\doxysearch.pro.in | sed "s/\$extraopts/%MODE%/g" >src\doxysearch.pro
diff --git a/packages/rpm/doxygen.spec b/packages/rpm/doxygen.spec
index 1d211ad..1c7fcbe 100644
--- a/packages/rpm/doxygen.spec
+++ b/packages/rpm/doxygen.spec
@@ -1,5 +1,5 @@
 Name: doxygen
-Version: 1.2.4-20010107
+Version: 1.2.4-20010121
 Summary: documentation system for C, C++ and IDL
 Release: 1
 Source0: doxygen-%{version}.src.tar.gz
diff --git a/qtools/qtools.pro.in b/qtools/qtools.pro.in
index 156ad09..f74d7db 100644
--- a/qtools/qtools.pro.in
+++ b/qtools/qtools.pro.in
@@ -75,3 +75,4 @@ INCLUDEPATH = .
 TMAKE_CXXFLAGS = -DQT_NO_CODECS -DQT_LITE_UNICODE
 win32:TMAKE_CXXFLAGS += -DQT_NODLL
 OBJECTS_DIR = ../objects
+DESTDIR = ../lib
diff --git a/src/Makefile.in b/src/Makefile.in
index aadd7ad..5d724a1 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -14,12 +14,16 @@
 # input used in their production; they are not affected by this license.
 # 
 
-all: Makefile.doxygen Makefile.doxytag Makefile.doxysearch Makefile
+all: Makefile.libdoxygen Makefile.doxygen Makefile.doxytag Makefile.doxysearch Makefile
+	$(MAKE) -f Makefile.libdoxygen $@
 	$(MAKE) -f Makefile.doxygen    $@
 	$(MAKE) -f Makefile.doxytag    $@
 	$(MAKE) -f Makefile.doxysearch $@
 
-Makefile.doxygen: doxygen.pro doxygen.t 
+Makefile.libdoxygen: libdoxygen.pro libdoxygen.t 
+	$(ENV) $(PERL) $(TMAKE) libdoxygen.pro >Makefile.libdoxygen
+
+Makefile.doxygen: doxygen.pro 
 	$(ENV) $(PERL) $(TMAKE) doxygen.pro >Makefile.doxygen
 
 Makefile.doxytag: doxytag.pro doxytag.t 
@@ -29,11 +33,13 @@ Makefile.doxysearch: doxysearch.pro
 	$(ENV) $(PERL) $(TMAKE) doxysearch.pro >Makefile.doxysearch
 
 tmake: 
+	$(ENV) $(PERL) $(TMAKE) libdoxygen.pro >Makefile.libdoxygen
 	$(ENV) $(PERL) $(TMAKE) doxygen.pro >Makefile.doxygen
 	$(ENV) $(PERL) $(TMAKE) doxytag.pro >Makefile.doxytag
 	$(ENV) $(PERL) $(TMAKE) doxysearch.pro >Makefile.doxysearch
 
-clean: Makefile.doxygen Makefile.doxytag Makefile.doxysearch
+clean: Makefile.libdoxygen Makefile.doxygen Makefile.doxytag Makefile.doxysearch
+	$(MAKE) -f Makefile.libdoxygen clean 
 	$(MAKE) -f Makefile.doxygen    clean 
 	$(MAKE) -f Makefile.doxytag    clean
 	$(MAKE) -f Makefile.doxysearch clean
diff --git a/src/classdef.cpp b/src/classdef.cpp
index 93a7921..b781c25 100644
--- a/src/classdef.cpp
+++ b/src/classdef.cpp
@@ -33,7 +33,7 @@
 #include "example.h"
 #include "outputlist.h"
 #include "dot.h"
-#include "xml.h"
+//#include "xml.h"
 
 static QCString stripExtension(const char *fName)
 {
@@ -155,8 +155,8 @@ void ClassDef::addMemberListToGroup(MemberList *ml)
     int groupId=md->getMemberGroupId();
     if (groupId!=-1)
     {
-      QCString *pGrpHeader = memberHeaderDict[groupId];
-      QCString *pDocs      = memberDocDict[groupId];
+      QCString *pGrpHeader = Doxygen::memberHeaderDict[groupId];
+      QCString *pDocs      = Doxygen::memberDocDict[groupId];
       if (pGrpHeader)
       {
         MemberGroup *mg = memberGroupDict->find(groupId);
@@ -721,10 +721,10 @@ void ClassDef::writeDocumentation(OutputList &ol)
 
   if (!Config::genTagFile.isEmpty()) 
   {
-    tagFile << "  <compound kind=\"" << compoundTypeString();
-    tagFile << "\">" << endl;
-    tagFile << "    <name>" << convertToXML(name()) << "</name>" << endl;
-    tagFile << "    <filename>" << convertToXML(fileName) << ".html</filename>" << endl;
+    Doxygen::tagFile << "  <compound kind=\"" << compoundTypeString();
+    Doxygen::tagFile << "\">" << endl;
+    Doxygen::tagFile << "    <name>" << convertToXML(name()) << "</name>" << endl;
+    Doxygen::tagFile << "    <filename>" << convertToXML(fileName) << ".html</filename>" << endl;
   }
 
   
@@ -754,20 +754,20 @@ void ClassDef::writeDocumentation(OutputList &ol)
         {
           if (!Config::genTagFile.isEmpty()) 
           {
-            tagFile << "    <base";
+            Doxygen::tagFile << "    <base";
             if (bcd->prot==Protected)
             {
-              tagFile << " protection=\"protected\"";
+              Doxygen::tagFile << " protection=\"protected\"";
             }
             else if (bcd->prot==Private)
             {
-              tagFile << " protection=\"private\"";
+              Doxygen::tagFile << " protection=\"private\"";
             }
             if (bcd->virt==Virtual)
             {
-              tagFile << " virtualness=\"virtual\"";
+              Doxygen::tagFile << " virtualness=\"virtual\"";
             }
-            tagFile << ">" << convertToXML(cd->name()) << "</base>" << endl;
+            Doxygen::tagFile << ">" << convertToXML(cd->name()) << "</base>" << endl;
           }
           ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,cd->name()+bcd->templSpecifiers);
         }
@@ -1121,7 +1121,7 @@ void ClassDef::writeDocumentation(OutputList &ol)
   while (file)
   {
     bool ambig;
-    FileDef *fd=findFileDef(inputNameDict,file,ambig);
+    FileDef *fd=findFileDef(Doxygen::inputNameDict,file,ambig);
     if (fd)
     {
       if (first)
@@ -1169,7 +1169,8 @@ void ClassDef::writeDocumentation(OutputList &ol)
 
   if (!Config::genTagFile.isEmpty()) 
   {
-    tagFile << "  </compound>" << endl;
+    writeDocAnchorsToTagFile();
+    Doxygen::tagFile << "  </compound>" << endl;
   }
  
   endFile(ol);
@@ -1254,7 +1255,9 @@ void ClassDef::writeMemberList(OutputList &ol)
                                   // generate link to the class instead.
         {
           ol.writeListItem();
-          ol.writeBoldString(md->name());
+          ol.startBold();
+          ol.docify(md->name());
+          ol.endBold();
           if ( md->isFunction() || md->isSignal() || md->isSlot() ) 
             ol.docify(md->argsString());
           else if (md->isEnumerate())
@@ -1271,7 +1274,9 @@ void ClassDef::writeMemberList(OutputList &ol)
           }
           else
           {
-            ol.writeBoldString(cd->name());
+            ol.startBold();
+            ol.docify(cd->name());
+            ol.endBold();
           }
           ol.writeString(")");
           memberWritten=TRUE;
@@ -1851,126 +1856,6 @@ void ClassDef::determineIntfUsageRelation()
 }
 #endif
 
-void ClassDef::generateXMLSection(QTextStream &t,MemberList *ml,const char *type)
-{
-  if (ml->count()>0)
-  {
-    t << "        <sectiondef type=\"" << type << "\">" << endl;
-    t << "          <memberlist>" << endl;
-    MemberListIterator mli(*ml);
-    MemberDef *md;
-    for (mli.toFirst();(md=mli.current());++mli)
-    {
-      md->generateXML(t,this);
-    }
-    t << "          </memberlist>" << endl;
-    t << "        </sectiondef>" << endl;
-  }
-}
-
-void ClassDef::generateXML(QTextStream &t)
-{
-  if (name().find('@')!=-1) return; // skip anonymous compounds
-  t << "    <compounddef id=\"" 
-    << getOutputFileBase() << "\" type=\"" 
-    << compoundTypeString() << "\">" << endl;
-  t << "      <compoundname>"; 
-  writeXMLString(t,name()); 
-  t << "</compoundname>" << endl;
-  if (inherits->count()>0)
-  {
-    t << "      <basecompoundlist>" << endl;
-    BaseClassListIterator bcli(*inherits);
-    BaseClassDef *bcd;
-    for (bcli.toFirst();(bcd=bcli.current());++bcli)
-    {
-      t << "        <basecompoundref idref=\"" 
-        << bcd->classDef->getOutputFileBase()
-        << "\" prot=\"";
-      switch (bcd->prot)
-      {
-        case Public:    t << "public";    break;
-        case Protected: t << "protected"; break;
-        case Private:   t << "private";   break;
-      }
-      t << "\" virt=\"";
-      switch(bcd->virt)
-      {
-        case Normal:  t << "non-virtual";  break;
-        case Virtual: t << "virtual";      break;
-        case Pure:    t <<"pure-virtual"; break;
-      }
-      t << "\"/>" << endl;
-    }
-    t << "      </basecompoundlist>" << endl;
-  }
-  if (inheritedBy->count()>0)
-  {
-    t << "      <derivedcompoundlist>" << endl;
-    BaseClassListIterator bcli(*inheritedBy);
-    BaseClassDef *bcd;
-    for (bcli.toFirst();(bcd=bcli.current());++bcli)
-    {
-      t << "        <derivedcompoundref idref=\"" 
-        << bcd->classDef->getOutputFileBase()
-        << "\" prot=\"";
-      switch (bcd->prot)
-      {
-        case Public:    t << "public";    break;
-        case Protected: t << "protected"; break;
-        case Private:   t << "private";   break;
-      }
-      t << "\" virt=\"";
-      switch(bcd->virt)
-      {
-        case Normal:  t << "non-virtual";  break;
-        case Virtual: t << "virtual";      break;
-        case Pure:    t << "pure-virtual"; break;
-      }
-      t << "\"/>" << endl;
-    }
-    t << "      </derivedcompoundlist>" << endl;
-  }
-  int numMembers = 
-    pubTypes.count()+pubMembers.count()+pubAttribs.count()+
-    pubSlots.count()+signals.count()+dcopMethods.count()+
-    pubStaticMembers.count()+
-    pubStaticAttribs.count()+proTypes.count()+proMembers.count()+
-    proAttribs.count()+proSlots.count()+proStaticMembers.count()+
-    proStaticAttribs.count()+priTypes.count()+priMembers.count()+
-    priAttribs.count()+priSlots.count()+priStaticMembers.count()+
-    priStaticAttribs.count()+friends.count()+related.count();
-  if (numMembers>0)
-  {
-    t << "      <sectionlist>" << endl;
-    generateXMLSection(t,&pubTypes,"public-type");
-    generateXMLSection(t,&pubMembers,"public-func");
-    generateXMLSection(t,&pubAttribs,"public-attrib");
-    generateXMLSection(t,&pubSlots,"public-slot");
-    generateXMLSection(t,&signals,"signal");
-    generateXMLSection(t,&dcopMethods,"dcop-func");
-    generateXMLSection(t,&properties,"property");
-    generateXMLSection(t,&pubStaticMembers,"public-static-func");
-    generateXMLSection(t,&pubStaticAttribs,"public-static-attrib");
-    generateXMLSection(t,&proTypes,"protected-type");
-    generateXMLSection(t,&proMembers,"protected-func");
-    generateXMLSection(t,&proAttribs,"protected-attrib");
-    generateXMLSection(t,&proSlots,"protected-slot");
-    generateXMLSection(t,&proStaticMembers,"protected-static-func");
-    generateXMLSection(t,&proStaticAttribs,"protected-static-attrib");
-    generateXMLSection(t,&priTypes,"private-type");
-    generateXMLSection(t,&priMembers,"private-func");
-    generateXMLSection(t,&priAttribs,"private-attrib");
-    generateXMLSection(t,&priSlots,"private-slot");
-    generateXMLSection(t,&priStaticMembers,"private-static-func");
-    generateXMLSection(t,&priStaticAttribs,"private-static-attrib");
-    generateXMLSection(t,&friends,"signal");
-    generateXMLSection(t,&related,"related");
-    t << "      </sectionlist>" << endl;
-  }
-  t << "    </compounddef>" << endl;
-}
-
 PackageDef *ClassDef::packageDef() const
 {
   return fileDef ? fileDef->packageDef() : 0;
diff --git a/src/classdef.h b/src/classdef.h
index 329e47b..6ffa451 100644
--- a/src/classdef.h
+++ b/src/classdef.h
@@ -126,25 +126,11 @@ class ClassDef : public Definition
     void addMembersToMemberGroup();
     void distributeMemberGroupDocumentation();
 
-    void generateXML(QTextStream &t);
-    void generateXMLSection(QTextStream &t,MemberList *ml,const char *type);
+    //void generateXML(QTextStream &t);
+    //void generateXMLSection(QTextStream &t,MemberList *ml,const char *type);
 
     PackageDef *packageDef() const;
    
-  protected:
-    void addUsedInterfaceClasses(MemberDef *md,const char *typeStr);
-    void addMemberListToGroup(MemberList *);
-
-  private: 
-    QCString fileName;                   // HTML containing the class docs
-    IncludeInfo *incInfo;                // header file to refer to
-    QCString incName;                    // alternative include file name
-    QCString memListFileName;            
-    QCString scopelessName;              // name without any scopes
-    BaseClassList *inherits;
-    BaseClassList *inheritedBy;
-    NamespaceDef  *nspace;              // the namespace this class is in
-
     /* member lists by protection */
     MemberList pubMembers;
     MemberList proMembers;
@@ -180,6 +166,21 @@ class ClassDef : public Definition
     MemberList variableMembers;
     MemberList propertyMembers;
 
+  protected:
+    void addUsedInterfaceClasses(MemberDef *md,const char *typeStr);
+    void addMemberListToGroup(MemberList *);
+
+  private: 
+    QCString fileName;                   // HTML containing the class docs
+    IncludeInfo *incInfo;                // header file to refer to
+    QCString incName;                    // alternative include file name
+    QCString memListFileName;            
+    QCString scopelessName;              // name without any scopes
+    BaseClassList *inherits;
+    BaseClassList *inheritedBy;
+    NamespaceDef  *nspace;              // the namespace this class is in
+
+
     /* user defined member groups */
     MemberGroupList    *memberGroupList;
     MemberGroupDict    *memberGroupDict;
diff --git a/src/classlist.cpp b/src/classlist.cpp
index 6061d47..a8a8533 100644
--- a/src/classlist.cpp
+++ b/src/classlist.cpp
@@ -80,7 +80,7 @@ void ClassList::writeDeclaration(OutputList &ol,const ClassDef::CompoundType *fi
           }
           if (!Config::genTagFile.isEmpty()) 
           {
-            tagFile << "    <class kind=\"" << cd->compoundTypeString() 
+            Doxygen::tagFile << "    <class kind=\"" << cd->compoundTypeString() 
                     << "\">" << convertToXML(cd->name()) << "</class>" << endl;
           }
           ol.startMemberItem(FALSE);
@@ -102,6 +102,25 @@ void ClassList::writeDeclaration(OutputList &ol,const ClassDef::CompoundType *fi
             ol.endBold();
           }
           ol.endMemberItem(FALSE);
+          if (!cd->briefDescription().isEmpty())
+          {
+            ol.startMemberDescription();
+            parseDoc(ol,cd->getDefFileName(),cd->getDefLine(),cd->name(),0,cd->briefDescription());
+            if ((!cd->briefDescription().isEmpty() && Config::repeatBriefFlag) ||
+                !cd->documentation().isEmpty())
+            {
+              ol.pushGeneratorState();
+              ol.disableAllBut(OutputGenerator::Html);
+              ol.endEmphasis();
+              ol.docify(" ");
+              ol.startTextLink(cd->getOutputFileBase(),"_details");
+              parseText(ol,theTranslator->trMore());
+              ol.endTextLink();
+              ol.startEmphasis();
+              ol.popGeneratorState();
+            }
+            ol.endMemberDescription();
+          }
         }
       }
       cd=next();
diff --git a/src/code.h b/src/code.h
index 8773d01..a5a0ea4 100644
--- a/src/code.h
+++ b/src/code.h
@@ -21,10 +21,10 @@
 #include "qtbc.h"
 #include <stdio.h>
 
-class OutputList;
+class OutputDocInterface;
 class FileDef;
 
-extern void parseCode(OutputList &,const char *,const QCString &, 
+extern void parseCode(OutputDocInterface &,const char *,const QCString &, 
             bool ,const char *,FileDef *fd=0,
             int startLine=-1,int endLine=-1,bool inlineFragment=FALSE);
 extern void initParseCodeContext();
diff --git a/src/code.l b/src/code.l
index 22415cc..0c8484d 100644
--- a/src/code.l
+++ b/src/code.l
@@ -85,6 +85,7 @@ typedef QList<CodeVarDef>   CodeVarList;
  *	statics
  */
   
+static OutputDocInterface * g_code;
 static CodeClassList g_codeClassList;
 static CodeClassDict g_codeClassDict(1009);
 static CodeVarList   g_codeVarList;
@@ -109,7 +110,6 @@ static bool          g_inClass;
 static QCString      g_classScope;
 static QCString      g_realScope;
 static QStack<void>  g_scopeStack;      // 1 if bracket starts a scope, 2 for internal blocks 
-static OutputList *  g_code;
 static CodeClassDef  g_ccd;
 static CodeVarDef    g_cvd;
 static bool          g_exampleBlock;
@@ -268,7 +268,7 @@ static void codifyLines(char *text)
  * line numbers for each line. If \a text contains newlines, the link will be 
  * split into multiple links with the same destination, one for each line.
  */
-static void writeMultiLineCodeLink(OutputList &ol,
+static void writeMultiLineCodeLink(OutputDocInterface &ol,
                   const char *ref,const char *file,
                   const char *anchor,const char *text)
 {
@@ -379,7 +379,7 @@ static void addParameter()
   }
 }
 
-static void generateClassLink(OutputList &ol,char *clName,int *clNameLen=0)
+static void generateClassLink(OutputDocInterface &ol,char *clName,int *clNameLen=0)
 {
   int i=0;
   QCString className=clName;
@@ -450,7 +450,7 @@ static ClassDef *stripClassName(const char *s)
 }
 
 static bool getLink(const char *className,
-                    const char *memberName,OutputList &result,
+                    const char *memberName,OutputDocInterface &result,
 		    const char *text=0)
 {
   MemberDef    *md;
@@ -505,10 +505,10 @@ static bool getLink(const char *className,
   return FALSE;
 }
 
-static bool generateClassMemberLink(OutputList &ol,ClassDef *mcd,const char *memName)
+static bool generateClassMemberLink(OutputDocInterface &ol,ClassDef *mcd,const char *memName)
 {
   //printf("generateClassMemberLink(%s,%s)\n",mcd->name().data(),memName);
-  MemberName *mmn=memberNameDict[memName];
+  MemberName *mmn=Doxygen::memberNameDict[memName];
   if (mmn)
   {
     MemberNameIterator mmni(*mmn);
@@ -548,7 +548,7 @@ static bool generateClassMemberLink(OutputList &ol,ClassDef *mcd,const char *mem
   return FALSE;
 }
 
-static void generateMemberLink(OutputList &ol,const char *varName,
+static void generateMemberLink(OutputDocInterface &ol,const char *varName,
             char *memName)
 {
   //printf("generateMemberLink(object=%s,mem=%s) classScope=%s\n",
@@ -567,21 +567,23 @@ static void generateMemberLink(OutputList &ol,const char *varName,
     if (ccd)
     {
       //printf("Class found!\n");
-      OutputList result(&ol);
-      if (getLink(ccd->name,memName,result)) 
+      OutputDocInterface *result = ol.clone();
+      if (getLink(ccd->name,memName,*result)) 
       {
         //printf("Found result!\n");
-        ol+=result;
+        ol.append(result);
+	delete result;
         return;
       }
       char *s=ccd->bases.first();
       while (s)
       {
-	OutputList result(&ol);
-	if (getLink(s,memName,result)) 
+	OutputDocInterface *result = ol.clone();
+	if (getLink(s,memName,*result)) 
 	{
 	  //printf("Found result!\n");
-	  ol+=result;
+	  ol.append(result);
+	  delete result;
 	  return;
 	}
 	s=ccd->bases.next();
@@ -590,16 +592,17 @@ static void generateMemberLink(OutputList &ol,const char *varName,
     else 
     {
       //printf("Class not found!\n");
-      OutputList result(&ol);
+      OutputDocInterface *result = ol.clone();
       //printf("cvd->type=`%s'\n",cvd->type.data());
-      if (getLink(cvd->type,memName,result))
+      if (getLink(cvd->type,memName,*result))
       {
-        ol+=result;
+        ol.append(result);
       }
       else
       {
         codifyLines(memName);
       }
+      delete result;
       return;
     }
   }
@@ -609,7 +612,7 @@ static void generateMemberLink(OutputList &ol,const char *varName,
     if (vcd && vcd->isLinkable())
     {
       //printf("Found class %s for variable `%s'\n",g_classScope.data(),varName);
-      MemberName *vmn=memberNameDict[varName];
+      MemberName *vmn=Doxygen::memberNameDict[varName];
       if (vmn==0)
       {
 	int vi;
@@ -619,7 +622,7 @@ static void generateMemberLink(OutputList &ol,const char *varName,
 	{
 	  ClassDef *jcd = getClass(vn.left(vi));
 	  vn=vn.right(vn.length()-vi-2);
-	  vmn=memberNameDict[vn];
+	  vmn=Doxygen::memberNameDict[vn];
 	  //printf("Trying name `%s' scope=%s\n",vn.data(),scope.data());
 	  if (vmn)
 	  {
@@ -666,9 +669,9 @@ static void generateMemberLink(OutputList &ol,const char *varName,
   return;
 }
 
-static void generateFunctionLink(OutputList &ol,char *funcName)
+static void generateFunctionLink(OutputDocInterface &ol,char *funcName)
 {
-  OutputList result(&ol);
+  OutputDocInterface *result = ol.clone();
   CodeClassDef *ccd=0;
   QCString locScope=g_classScope.copy();
   QCString locFunc=removeRedundantWhiteSpace(funcName);
@@ -693,22 +696,24 @@ static void generateFunctionLink(OutputList &ol,char *funcName)
     char *s=ccd->bases.first();
     while (s)
     {
-      if (getLink(s,locFunc,result,funcName)) 
+      if (getLink(s,locFunc,*result,funcName)) 
       {
-	ol+=result;
+	ol.append(result);
+	delete result;
 	return;
       }
       s=ccd->bases.next();
     }
   }
-  if (getLink(locScope,locFunc,result,funcName))
+  if (getLink(locScope,locFunc,*result,funcName))
   {
-    ol+=result;
+    ol.append(result);
   }
   else
   {
     codifyLines(funcName);
   }
+  delete result;
   return;
 }
 
@@ -808,7 +813,7 @@ TYPEKW  ("bool"|"char"|"double"|"float"|"int"|"long"|"short"|"signed"|"unsigned"
 					  //FileInfo *f;
 					  bool ambig;
                                           FileDef *fd;
-					  if ((fd=findFileDef(inputNameDict,yytext,ambig)) &&
+					  if ((fd=findFileDef(Doxygen::inputNameDict,yytext,ambig)) &&
 					      fd->isLinkable())
 					  {
 					    g_code->writeCodeLink(fd->getReference(),fd->getOutputFileBase(),0,yytext);
@@ -1561,12 +1566,12 @@ void initParseCodeContext()
   g_anchorCount = 0;
 }
 
-void parseCode(OutputList &ol,const char *className,const QCString &s, 
+void parseCode(OutputDocInterface &od,const char *className,const QCString &s, 
                   bool exBlock, const char *exName,FileDef *fd,
 		  int startLine,int endLine,bool inlineFragment)
 {
   if (s.isEmpty()) return;
-  g_code = new OutputList(&ol);
+  g_code = od.clone();
   g_inputString   = s;
   g_inputPosition = 0;
   g_currentFontClass = 0;
@@ -1606,7 +1611,7 @@ void parseCode(OutputList &ol,const char *className,const QCString &s,
   BEGIN( Body );
   codeYYlex();
   endFontClass();
-  ol+=*g_code;
+  od.append(g_code);
   delete g_code;
   return;
 }
diff --git a/src/config.h b/src/config.h
index 0ceec45..2d6786c 100644
--- a/src/config.h
+++ b/src/config.h
@@ -1,4 +1,4 @@
-/* This file was generated by configgen on Sun Dec 3 18:27:54 2000
+/* This file was generated by configgen on Sun Jan 14 14:24:47 2001
  * from config_templ.h
  *
  * DO NOT EDIT!
diff --git a/src/config.l b/src/config.l
index df0d591..1bbd0c1 100644
--- a/src/config.l
+++ b/src/config.l
@@ -1,4 +1,4 @@
-/* This file was generated by configgen on Fri Dec 15 14:00:31 2000
+/* This file was generated by configgen on Sun Jan 14 14:24:47 2001
  * from config_templ.l
  *
  * DO NOT EDIT!
@@ -2657,95 +2657,6 @@ void checkConfig()
 #endif
   }
   
-  // Test to see if output directory is valid
-  if (Config::outputDir.isEmpty()) 
-    Config::outputDir=QDir::currentDirPath();
-  else
-  {
-    QDir dir(Config::outputDir);
-    if (!dir.exists())
-    {
-      dir.setPath(QDir::currentDirPath());
-      if (!dir.mkdir(Config::outputDir))
-      {
-        err("Error: tag OUTPUT_DIRECTORY: Output directory `%s' does not "
-	    "exist and cannot be created\n",Config::outputDir.data());
-        exit(1);
-      }
-      else if (!Config::quietFlag)
-      {
-	err("Notice: Output directory `%s' does not exist. "
-	    "I have created it for you.\n", Config::outputDir.data());
-      }
-      dir.cd(Config::outputDir);
-    }
-    Config::outputDir=dir.absPath();
-  }
-
-  if (Config::htmlOutputDir.isEmpty() && Config::generateHtml)
-  {
-    Config::htmlOutputDir=Config::outputDir+"/html";
-  }
-  else if (Config::htmlOutputDir && Config::htmlOutputDir[0]!='/')
-  {
-    Config::htmlOutputDir.prepend(Config::outputDir+'/');
-  }
-  QDir htmlDir(Config::htmlOutputDir);
-  if (Config::generateHtml && !htmlDir.exists() && 
-      !htmlDir.mkdir(Config::htmlOutputDir))
-  {
-    err("Could not create output directory %s\n",Config::htmlOutputDir.data());
-    exit(1);
-  }
-  
-  if (Config::latexOutputDir.isEmpty() && Config::generateLatex)
-  {
-    Config::latexOutputDir=Config::outputDir+"/latex";
-  }
-  else if (Config::latexOutputDir && Config::latexOutputDir[0]!='/')
-  {
-    Config::latexOutputDir.prepend(Config::outputDir+'/');
-  }
-  QDir latexDir(Config::latexOutputDir);
-  if (Config::generateLatex && !latexDir.exists() && 
-      !latexDir.mkdir(Config::latexOutputDir))
-  {
-    err("Could not create output directory %s\n",Config::latexOutputDir.data());
-    exit(1);
-  }
-  
-  if (Config::rtfOutputDir.isEmpty() && Config::generateRTF)
-  {
-    Config::rtfOutputDir=Config::outputDir+"/rtf";
-  }
-  else if (Config::rtfOutputDir && Config::rtfOutputDir[0]!='/')
-  {
-    Config::rtfOutputDir.prepend(Config::outputDir+'/');
-  }
-  QDir rtfDir(Config::rtfOutputDir);
-  if (Config::generateRTF && !rtfDir.exists() && 
-      !rtfDir.mkdir(Config::rtfOutputDir))
-  {
-    err("Could not create output directory %s\n",Config::rtfOutputDir.data());
-    exit(1);
-  }
-
-  if (Config::manOutputDir.isEmpty() && Config::generateMan)
-  {
-    Config::manOutputDir=Config::outputDir+"/man";
-  }
-  else if (Config::manOutputDir && Config::manOutputDir[0]!='/')
-  {
-    Config::manOutputDir.prepend(Config::outputDir+'/');
-  }
-  QDir manDir(Config::manOutputDir);
-  if (Config::generateMan && !manDir.exists() && 
-      !manDir.mkdir(Config::manOutputDir))
-  {
-    err("Could not create output directory %s\n",Config::manOutputDir.data());
-    exit(1);
-  }
-
   // expand the relative stripFromPath values
   char *sfp = Config::stripFromPath.first();
   while (sfp)
diff --git a/src/declinfo.l b/src/declinfo.l
index bfa599e..6a689c0 100644
--- a/src/declinfo.l
+++ b/src/declinfo.l
@@ -229,7 +229,7 @@ void parseFuncDecl(const QCString &decl,QCString &cl,QCString &ctl,QCString &t,
   //        type.data(),scope.data(),name.data(),args.data());
 
   int nb = name.findRev('[');
-  if (nb!=-1) // correct for [] in name ambigity (due to Java return type allowing [])
+  if (nb!=-1 && args.isEmpty()) // correct for [] in name ambigity (due to Java return type allowing [])
   {
     args.prepend(name.right(name.length()-nb));
     name=name.left(nb);
diff --git a/src/defargs.l b/src/defargs.l
index 58af23d..68eaa91 100644
--- a/src/defargs.l
+++ b/src/defargs.l
@@ -249,8 +249,7 @@ ID	[a-z_A-Z][a-z_A-Z0-9]*
 					    BEGIN( ReadDocBlock );
   					}
 <ReadFuncArgType,ReadFuncArgDef>[,)>]	{
-					  g_curArgTypeName=removeRedundantWhiteSpace(
-					                   g_curArgTypeName.simplifyWhiteSpace());
+					  g_curArgTypeName=removeRedundantWhiteSpace(g_curArgTypeName);
 					  g_curArgDefValue=g_curArgDefValue.stripWhiteSpace();
 					  int l=g_curArgTypeName.length();
 					  if (l>0)
diff --git a/src/definition.cpp b/src/definition.cpp
index 4805638..eb8b905 100644
--- a/src/definition.cpp
+++ b/src/definition.cpp
@@ -35,7 +35,7 @@ Definition::Definition(const char *df,int dl,
   n=name; 
   brief=b; 
   doc=d; 
-  sectionList=0, 
+  sectionDict=0, 
   startBodyLine=endBodyLine=-1, 
   bodyDef=0;
   sourceRefList=0;
@@ -46,7 +46,7 @@ Definition::Definition(const char *df,int dl,
 
 Definition::~Definition()
 {
-  delete sectionList;
+  delete sectionDict;
   delete sourceRefList;
   delete sourceRefDict;
 }
@@ -90,18 +90,39 @@ void Definition::addSectionsToDefinition(QList<QCString> *anchorList)
   while (s)
   {
     SectionInfo *si=0;
-    if (!s->isEmpty() && (si=sectionDict[*s]))
+    if (!s->isEmpty() && (si=Doxygen::sectionDict[*s]))
     {
       //printf("Add section `%s' to definition `%s'\n",
       //    si->label.data(),n.data());
-      if (sectionList==0) sectionList = new SectionList;
-      sectionList->append(si);
+      if (sectionDict==0) 
+      {
+        sectionDict = new SectionDict(17);
+      }
+      if (sectionDict->find(*s)==0)
+      {
+        sectionDict->insert(*s,si);
+      }
       si->definition = this;
     }
     s=anchorList->next();
   }
 }
 
+void Definition::writeDocAnchorsToTagFile()
+{
+  if (!Config::genTagFile.isEmpty() && sectionDict)
+  {
+    QDictIterator<SectionInfo> sdi(*sectionDict);
+    SectionInfo *si;
+    for (;(si=sdi.current());++sdi)
+    {
+      if (definitionType()==TypeMember) Doxygen::tagFile << "  ";
+      Doxygen::tagFile << "    <docanchor>" << si->label << "</docanchor>" << endl;
+    }
+  }
+}
+
+
 void Definition::setBriefDescription(const char *b) 
 { 
   brief=QCString(b).stripWhiteSpace(); 
@@ -177,32 +198,34 @@ static bool readCodeFragment(const char *fileName,
       }
       if (found) 
       {
-        // full the line with spaces until the right column
-        int i;
-        for (i=0;i<col;i++) result+=' ';
+        // fill the line with spaces until the right column
+        QCString spaces;
+        spaces.fill(' ',col);
+        result+=spaces;
         // copy until end of line
         result+=c;
         if (c==':') result+=cn;
         startLine=lineNr;
         const int maxLineLength=4096;
         char lineStr[maxLineLength];
-        char *p=lineStr;
-        while ((c=f.getch())!='\n' && c!=-1) *p++=c;
-        //printf("First line str=`%s' atEnd=%d lineNr=%d endLine=%d\n",lineStr.data(),f.atEnd(),lineNr,endLine);
-        *p++='\n';
-        *p++='\0';
-        while (lineNr<endLine && !f.atEnd())
+        do 
         {
-          //printf("adding line=`%s' lineNr=%d\n",lineStr.data(),lineNr);
-          result+=lineStr;  
-          f.readLine(lineStr,maxLineLength);
+          int size_read;
+          do {
+            // read up to maxLineLength-1 bytes, the last byte being zero
+            size_read = f.readLine(lineStr, maxLineLength);
+            result+=lineStr;
+          } while (size_read == (maxLineLength-1));
+
           lineNr++; 
+        } while (lineNr<endLine && !f.atEnd());
+
+        int charIndex = result.findRev('}');
+        if (charIndex > 0) 
+        {
+          result.truncate(charIndex+1);
+          result+='\n';
         }
-        p=lineStr+strlen(lineStr);
-        while (--p>=lineStr && *p!='}') /* skip */;
-        *(++p)='\n';
-        *(++p)='\0';
-        result+=lineStr;
         endLine=lineNr;
         return TRUE;
       }
@@ -395,8 +418,6 @@ void Definition::writeSourceRefs(OutputList &ol,const char *scopeName)
   ol.popGeneratorState();
 }
 
-
-
 bool Definition::hasDocumentation() 
 { 
   return !doc.isEmpty() ||             // has detailed docs
diff --git a/src/definition.h b/src/definition.h
index e92292e..fbf5ebd 100644
--- a/src/definition.h
+++ b/src/definition.h
@@ -23,7 +23,7 @@
 
 class FileDef;
 class OutputList;
-class SectionList;
+class SectionDict;
 class MemberList;
 class MemberDict;
 class MemberDef;
@@ -93,6 +93,7 @@ class Definition
      * documentation.
      */
     void addSectionsToDefinition(QList<QCString> *anchorList);
+    void writeDocAnchorsToTagFile();
 
     // source references
     void setBodySegment(int bls,int ble) 
@@ -136,7 +137,7 @@ class Definition
     QCString brief; // brief description
     QCString doc;   // detailed description
     QCString ref;   // reference to external documentation
-    SectionList *sectionList; // list of all sections
+    SectionDict *sectionDict;  // dictionary of all sections
     MemberList  *sourceRefList;  // list of entities that refer to this
                                  // entity in their definition 
     MemberDict *sourceRefDict;
diff --git a/src/diagram.cpp b/src/diagram.cpp
index b74abc8..a499097 100644
--- a/src/diagram.cpp
+++ b/src/diagram.cpp
@@ -158,13 +158,13 @@ static void writeMapArea(QTextStream &t,ClassDef *cd,int x,int y,int w,int h)
     if (!ref.isEmpty()) 
     {
       t << "doxygen=\"" << ref << ":";
-      if ((dest=tagDestinationDict[ref])) t << *dest << "/";
+      if ((dest=Doxygen::tagDestinationDict[ref])) t << *dest << "/";
       t << "\" ";
     }
     t << "href=\"";
     if (!ref.isEmpty())
     {
-      if ((dest=tagDestinationDict[ref])) t << *dest << "/";
+      if ((dest=Doxygen::tagDestinationDict[ref])) t << *dest << "/";
     }
     t << cd->getOutputFileBase() << ".html\" ";
     t << "alt=\"" << cd->name(); 
@@ -916,7 +916,7 @@ void TreeDiagram::drawConnectors(QTextStream &t,Image *image,
 
 void clearVisitFlags()
 {
-  ClassListIterator cli(classList);
+  ClassListIterator cli(Doxygen::classList);
   ClassDef *cd;
   for (;(cd=cli.current());++cli)
   {
diff --git a/src/doc.h b/src/doc.h
index 6c5ad54..91b16fa 100644
--- a/src/doc.h
+++ b/src/doc.h
@@ -20,14 +20,14 @@
 
 #include "qtbc.h"
 
-class OutputList;
+class OutputDocInterface;
 
-extern void parseDoc(OutputList &ol,
+extern void parseDoc(OutputDocInterface &ol,
                      const char *fileName,int startLine,
                      const char *clName, const char *memName,
                      const QCString &docString);
-extern void parseExample(OutputList &ol,const QCString &docString, 
+extern void parseExample(OutputDocInterface &ol,const QCString &docString, 
                            const char *fileName);
-extern void parseText(OutputList &ol,const QCString &txtString);
+extern void parseText(OutputDocInterface &ol,const QCString &txtString);
 
 #endif
diff --git a/src/doc.l b/src/doc.l
index 41c2ba6..b66a960 100644
--- a/src/doc.l
+++ b/src/doc.l
@@ -51,10 +51,10 @@
  *
  * scanner's state variables
  */
+static OutputDocInterface * outDoc;
 static bool             insideArgumentList;
 static QCString         className;
 static QCString         memberName;
-static OutputList *     outDoc;
 static QCString         linkRef;
 static QCString         linkText;
 static QCString         codeBlock;
@@ -150,10 +150,10 @@ class TableElem
    ~TableElem();
     int getRow() { return row; }
     int getCol() { return col; }
-    OutputList *outputList() { return ol; }
+    OutputDocInterface *outputDocInterface() { return od; }
    
   private:
-    OutputList *ol;
+    OutputDocInterface *od;
     int row;
     int col;
 };
@@ -161,8 +161,8 @@ class TableElem
 TableElem::TableElem(int r,int c)
 {
   //printf("TableElem::TableElem(%d,%d)\n",r,c);
-  ol=new OutputList(outDoc);
-  outDoc=ol;
+  od=outDoc->clone();
+  outDoc=od;
   row=r;
   col=c;
 }
@@ -170,7 +170,7 @@ TableElem::TableElem(int r,int c)
 TableElem::~TableElem()
 {
   //printf("TableElem::~TableElem(%d,%d)\n",row,col);
-  delete ol; ol=0;
+  delete od; od=0;
 }
 
 class Table
@@ -182,7 +182,7 @@ class Table
     void newElem();
     
   private:
-    OutputList *parentDoc;
+    OutputDocInterface *parentDoc;
     QList<TableElem> *elemList;
     int curRow;
     int curCol;
@@ -219,7 +219,7 @@ Table::~Table()
 	{
 	  parentDoc->nextTableColumn();
 	}
-	*parentDoc+=*e->outputList();
+	parentDoc->append(e->outputDocInterface());
 	parentDoc->endTableColumn();
       }
       e=elemList->next();
@@ -286,30 +286,31 @@ static void endArgumentList()
   }
 }
 
-static void includeFile(OutputList &ol,const char *fileName,bool quiet)
+static void includeFile(OutputDocInterface &od,const char *fileName,bool quiet)
 {
   bool ambig;
   FileDef *fd;
-  if ((fd=findFileDef(exampleNameDict,fileName,ambig)))
+  if ((fd=findFileDef(Doxygen::exampleNameDict,fileName,ambig)))
   {
     currentIncludeFile=fileToString(fd->absFilePath());
     includeFileOffset=0;
     includeFileLength=currentIncludeFile.length();
-    OutputList codeFrag(&ol);
-    parseCode(codeFrag,0,currentIncludeFile,exampleDoc,exampleName);
+    OutputDocInterface *codeFrag = od.clone();
+    parseCode(*codeFrag,0,currentIncludeFile,exampleDoc,exampleName);
     if (!quiet)
     {
-      ol.startCodeFragment();
-      ol+=codeFrag;
-      ol.endCodeFragment();
+      od.startCodeFragment();
+      od.append(codeFrag);
+      od.endCodeFragment();
     }
+    delete codeFrag;
   }
   else if (ambig)
   {
     QCString text;
     text.sprintf("Include file name %s is ambigious.\n",fileName);
     text+="Possible candidates:\n";
-    text+=showFileDefMatches(exampleNameDict,fileName);
+    text+=showFileDefMatches(Doxygen::exampleNameDict,fileName);
     warn(yyFileName,yyLineNr,text);
   }
   else
@@ -321,22 +322,22 @@ static void includeFile(OutputList &ol,const char *fileName,bool quiet)
   }
 }
 
-static void verbIncludeFile(OutputList &ol,const char *name)
+static void verbIncludeFile(OutputDocInterface &od,const char *name)
 {
   bool ambig;
   FileDef *fd;
-  if ((fd=findFileDef(exampleNameDict,name,ambig)))
+  if ((fd=findFileDef(Doxygen::exampleNameDict,name,ambig)))
   {
-    ol.startCodeFragment();
-    ol.codify(fileToString(fd->absFilePath()));
-    ol.endCodeFragment();
+    od.startCodeFragment();
+    od.codify(fileToString(fd->absFilePath()));
+    od.endCodeFragment();
   }
   else if (ambig)
   {
     QCString text;
     text.sprintf("Include file name %s is ambigious.\n",name);
     text+=("Possible candidates:\n");
-    text+=showFileDefMatches(exampleNameDict,name);
+    text+=showFileDefMatches(Doxygen::exampleNameDict,name);
     warn(yyFileName,yyLineNr,text);
   }
   else
@@ -369,7 +370,7 @@ static QCString stripKnownExtensions(const char *text)
   return result;
 }
 
-static void skipLine(OutputList &ol,const char *key)
+static void skipLine(OutputDocInterface &od,const char *key)
 {
   bool found=FALSE;
   while (!found)
@@ -382,9 +383,9 @@ static void skipLine(OutputList &ol,const char *key)
     if (s.find(key)!=-1)
     {
       found=TRUE;
-      ol.writeString("    ");
-      parseCode(ol,className,s,exampleDoc,exampleName);
-      ol.writeString("\n");
+      od.writeString("    ");
+      parseCode(od,className,s,exampleDoc,exampleName);
+      od.writeString("\n");
     }
     else if (includeFileOffset==includeFileLength) found=TRUE;
   }
@@ -412,7 +413,7 @@ static void skipUntil(const char *key)
   }
 }
 
-static void showLine(OutputList &ol,const char *key)
+static void showLine(OutputDocInterface &od,const char *key)
 {
   QCString s;
   char c;
@@ -427,13 +428,13 @@ static void showLine(OutputList &ol,const char *key)
   }
   if (s.find(key)!=-1)
   {
-    ol.writeString("    ");
-    parseCode(ol,className,s,exampleDoc,exampleName);
-    ol.writeString("\n");
+    od.writeString("    ");
+    parseCode(od,className,s,exampleDoc,exampleName);
+    od.writeString("\n");
   }
 }
 
-static void showUntil(OutputList &ol,const char *key)
+static void showUntil(OutputDocInterface &od,const char *key)
 {
   bool found=FALSE;
   while (!found)
@@ -445,9 +446,9 @@ static void showUntil(OutputList &ol,const char *key)
 	  ) s+=c;
     if (!s.stripWhiteSpace().isEmpty())
     {
-      ol.writeString("    ");
-      parseCode(ol,className,s,exampleDoc,exampleName);
-      ol.writeString("\n");
+      od.writeString("    ");
+      parseCode(od,className,s,exampleDoc,exampleName);
+      od.writeString("\n");
       if (s.find(key)!=-1) found=TRUE; 
     }
     if (includeFileOffset==includeFileLength) found=TRUE;
@@ -630,7 +631,7 @@ static QCString findAndCopyImage(const char *fileName,ImageTypes type)
   bool ambig;
   FileDef *fd;
   //printf("Search for %s\n",fileName);
-  if ((fd=findFileDef(imageNameDict,fileName,ambig)))
+  if ((fd=findFileDef(Doxygen::imageNameDict,fileName,ambig)))
   {
     QFile inImage(QString(fd->absFilePath().data()));
     if (inImage.open(IO_ReadOnly))
@@ -678,7 +679,7 @@ static QCString findAndCopyImage(const char *fileName,ImageTypes type)
     QCString text;
     text.sprintf("Warning: image file name %s is ambigious.\n",fileName);
     text+="Possible candidates:\n";
-    text+=showFileDefMatches(imageNameDict,fileName);
+    text+=showFileDefMatches(Doxygen::imageNameDict,fileName);
     warn(yyFileName,yyLineNr,text);
   }
   else
@@ -806,6 +807,12 @@ UL	  [uU][lL]
 VAR	  [vV][aA][rR]
 BLOCKQUOTE [bB][lL][oO][cC][kK][qQ][uU][oO][tT][eE]
 DOCPARAM  ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"")
+OPNEW     {B}+"new"({B}*"[]")?
+OPDEL     {B}+"delete"({B}*"[]")?
+OPARG     "("[a-z_A-Z0-9,\<\> \t\*\&]*")"
+OPNORM    {OPNEW}|{OPDEL}|"+"|"-"|"*"|"/"|"%"|"^"|"&"|"|"|"~"|"!"|"="|"<"|">"|"+="|"-="|"*="|"/="|"%="|"^="|"&="|"|="|"<<"|">>"|"<<="|">>="|"=="|"!="|"<="|">="|"&&"|"||"|"++"|"--"|","|"->*"|"->"|"[]"|"()"
+OPCAST    {B}+[^(\r\n.,]+
+OPMASK    ({B}*{OPNORM}({OPARG}?))|({OPCAST}{OPARG})
 
 %option noyywrap
 
@@ -885,23 +892,20 @@ DOCPARAM  ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"")
 					  outDoc->docify(getenv(envvar));
 					}
 <DocScan>{CMD}"htmlonly"/[^a-z_A-Z0-9]	{
-  				          outDoc->pushGeneratorState(); /*storeOutputListState();*/
+  				          outDoc->pushGeneratorState(); 
   					  outDoc->disableAllBut(OutputGenerator::Html); 
 					  BEGIN(DocHtmlScan);
   					}
 <DocHtmlScan>{CMD}"endhtmlonly"/[^a-z_A-Z0-9] {
-  					  /*restoreOutputListState();*/
   					  outDoc->popGeneratorState();
 					  BEGIN(DocScan);
   					}
 <DocScan>{CMD}"latexonly"/[^a-z_A-Z0-9]	{
-  				          /*storeOutputListState();*/
   					  outDoc->pushGeneratorState();
   					  outDoc->disableAllBut(OutputGenerator::Latex);
 					  BEGIN(DocLatexScan);
   					}
 <DocLatexScan>{CMD}"endlatexonly"/[^a-z_A-Z0-9] {
-  					  /*restoreOutputListState();*/
   					  outDoc->popGeneratorState();
 					  BEGIN(DocScan);
   					}
@@ -914,17 +918,17 @@ DOCPARAM  ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"")
   					  outDoc->writeString(c);
   					}
 <DocScan>"\\postheader"/{BN}
-<DocScan>"\\functionindex"/{BN}		{ writeMemberList(*outDoc,FALSE); }
-<DocScan>"\\classhierarchy"/{BN}	{ writeClassHierarchy(*outDoc); }
-<DocScan>"\\annotatedclasslist"/{BN}	{ writeAnnotatedClassList(*outDoc); }
-<DocScan>"\\headerfilelist"/{BN}	{ /*TODO: fix this writeHeaderFileList(*outDoc); */ }
+<DocScan>"\\functionindex"/{BN}		{ /* writeMemberList(*outDoc,FALSE);*/ }
+<DocScan>"\\classhierarchy"/{BN}	{ /* writeClassHierarchy(*outDoc); */ }
+<DocScan>"\\annotatedclasslist"/{BN}	{ /* writeAnnotatedClassList(*outDoc); */ }
+<DocScan>"\\headerfilelist"/{BN}	{ /* writeHeaderFileList(*outDoc); */ }
 <DocScan>"\\header"/{BN}                { BEGIN( DocSkipWord ); }
 <DocScan>"\\define"/{BN}	        { BEGIN( DocSkipWord ); }
 <DocScan>{CMD}"verbinclude"/{BN}	{ BEGIN( DocVerbInc ); }
 <DocVerbInc>{FILE}			{
   					  verbIncludeFile(*outDoc,stripQuotes(yytext));
 					  BEGIN( DocScan ); 
-  					}
+					}
 <DocScan>{CMD}"verbatim"/[^a-z_A-Z0-9]	{
   					  outDoc->startCodeFragment();
 					  insideVerbatim=TRUE;
@@ -1000,7 +1004,7 @@ DOCPARAM  ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"")
   					  BEGIN(DocIndexWord);
   					}
 <DocScan>"\\form#"[0-9]+		{
-  					  Formula *formula=formulaNameDict[yytext];
+  					  Formula *formula=Doxygen::formulaNameDict[yytext];
 					  if (formula)
 					  {
 					    QCString formName;
@@ -1501,7 +1505,7 @@ DOCPARAM  ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"")
 					  secName=secName.left(secName.length()-1); // remove \n
 					  //printf("SectionName %s found\n",secName.data());
 					  SectionInfo *sec;
-					  if ((sec=sectionDict[secName]))
+					  if ((sec=Doxygen::sectionDict[secName]))
 					  {
 					    //printf("Title %s\n",sec->title.data());
 					    outDoc->startSection(sec->label,sec->title,
@@ -1515,7 +1519,7 @@ DOCPARAM  ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"")
   					  QCString secName=&yytext[8];
 					  secName=secName.left(secName.length()-1);
 					  SectionInfo *sec;
-					  if ((sec=sectionDict[secName]))
+					  if ((sec=Doxygen::sectionDict[secName]))
 					  {
 					    //printf("writeAnchor %s_%s\n",sec->fileName.data(),sec->label.data());
 					    outDoc->writeAnchor(sec->fileName,sec->label);
@@ -1576,7 +1580,7 @@ DOCPARAM  ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"")
 <DocRefName>{SCOPENAME}|{FILE}		{
   					  QCString ref=yytext;
 					  SectionInfo *sec;
-					  if ((sec=sectionDict[ref]))
+					  if ((sec=Doxygen::sectionDict[ref]))
 					  {
 					    QCString text;
 					    if (sec->title.isEmpty()) 
@@ -1585,19 +1589,21 @@ DOCPARAM  ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"")
 					      text=sec->title;
 					    if (sec->type==SectionInfo::Anchor)
 					    {
-					      outDoc->writeObjectLink(0,sec->fileName,sec->label,text);
-					      writePageRef(*outDoc,sec->label,0);
+					      outDoc->writeObjectLink(sec->ref,sec->fileName,sec->label,text);
+					      if (sec->ref.isEmpty())
+					      {
+					        writePageRef(*outDoc,sec->label,0);
+					      }
 					    }
 					    else
 					    {
 					      //printf("  ref sec=%p sec->fileName=%s text=%s\n",sec,sec->fileName.data(),text.data());
-					      outDoc->writeSectionRef(sec->fileName,sec->label,text);
+					      outDoc->writeSectionRef(sec->fileName,sec->label,text,sec->ref);
 					    }
 					  }
 					  else if (!generateLink(*outDoc,className,yytext,TRUE,0))
 					  {
 					    warn(yyFileName,yyLineNr,"Warning: reference to unknown section %s in the documentation of this entity!",yytext);
-					    //outDoc->writeBoldString(" unknown reference! ");
 					  }
 					  BEGIN(DocScan);
   					}
@@ -1613,24 +1619,27 @@ DOCPARAM  ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"")
   					  yytext[yyleng-1]='\0';
 					  QCString text=substitute(yytext,"\\\\","\\");
 					  SectionInfo *sec;
-					  if ((sec=sectionDict[sectionRef]))
+					  if ((sec=Doxygen::sectionDict[sectionRef]))
 					  {
 					    if (sec->type==SectionInfo::Anchor)
 					    {
-					      //outDoc->writeSectionRefAnchor(sec->fileName,sec->label,text);
-					      outDoc->writeObjectLink(0,sec->fileName,sec->label,text);
-					      //printf("Writing page ref `%s'\n",sec->label.data());
-					      writePageRef(*outDoc,sec->label,0);
+					      outDoc->writeObjectLink(sec->ref,sec->fileName,sec->label,text);
+					      if (sec->ref.isEmpty())
+					      {
+					        writePageRef(*outDoc,sec->label,0);
+					      }
 					    }
 					    else
 					    {
-					      outDoc->writeSectionRef(sec->fileName,sec->label,text);
+					      outDoc->writeSectionRef(sec->fileName,sec->label,text,sec->ref);
 					    }
 					  }
 					  else if (!generateLink(*outDoc,className,sectionRef,TRUE,text))
 					  {
 					    warn(yyFileName,yyLineNr,"Warning: reference to unknown section %s in the documentation of this entity!",sectionRef.data());
-					    outDoc->writeBoldString(" unknown reference! ");
+					    outDoc->startBold();
+					    outDoc->writeString(" unknown reference! ");
+					    outDoc->endBold();
 					  }
 					  BEGIN(DocScan);
   					}
@@ -1641,14 +1650,16 @@ DOCPARAM  ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"")
 <DocRefItemName>.*/"\n"			{
 					  SectionInfo *sec;
 					  QCString text=yytext;
-					  if ((sec=sectionDict[sectionRef]))
+					  if ((sec=Doxygen::sectionDict[sectionRef]))
 					  {
 					    outDoc->writeSectionRefItem(sec->fileName,sec->label,text.stripWhiteSpace());
 					  }
 					  else
 					  {
 					    warn(yyFileName,yyLineNr,"Warning: reference to unknown section %s in the documentation of this entity!",sectionRef.data());
-					    outDoc->writeBoldString(" unknown reference! ");
+					    outDoc->startBold();
+					    outDoc->writeString(" unknown reference! ");
+					    outDoc->endBold();
 					  }
 					  BEGIN(DocScan);
   					}
@@ -2212,12 +2223,12 @@ void internalParseDocument(const char *s)
 
 //----------------------------------------------------------------------------
 
-void parseDocument(OutputList &ol,const QCString &docString)
+void parseDocument(OutputDocInterface &od,const QCString &docString)
 {
   //inParamBlock=inSeeBlock=inReturnBlock=FALSE;
   curTable = 0;
   depthIf = 0;
-  outDoc = new OutputList(&ol);
+  outDoc = od.clone();
   currentIncludeFile.resize(0);
   includeFileOffset=0;
   includeFileLength=0;
@@ -2268,14 +2279,14 @@ void parseDocument(OutputList &ol,const QCString &docString)
          "Warning: file ended inside a \\verbatim block!"
         );
   }
-  ol+=*outDoc;
+  od.append(outDoc);
   delete outDoc; outDoc=0;
   return;
 }
 
 //----------------------------------------------------------------------------
 
-void parseDoc(OutputList &ol,const char *fileName,int startLine,
+void parseDoc(OutputDocInterface &od,const char *fileName,int startLine,
               const char *clName,const char *memName,const QCString &docString)
 {
   //printf("parseDoc(file=`%s',line=%d)\n",fileName,startLine);
@@ -2286,29 +2297,29 @@ void parseDoc(OutputList &ol,const char *fileName,int startLine,
   memberName=memName;
   strcpy(yyFileName,fileName);
   yyLineNr = startLine;
-  parseDocument(ol,docString);
+  parseDocument(od,docString);
 
 }
 
 //----------------------------------------------------------------------------
 
-void parseText(OutputList &ol,const QCString &txtString)
+void parseText(OutputDocInterface &od,const QCString &txtString)
 {
   if (txtString.isEmpty()) return;
   inputString = txtString;
-  outDoc = new OutputList(&ol);
+  outDoc = od.clone();
   inputPosition = 0;
   docYYrestart( docYYin ); 
   BEGIN( Text );
   docYYlex();
-  ol+=*outDoc;
+  od.append(outDoc);
   delete outDoc; outDoc=0;
   return;
 }
 
 //----------------------------------------------------------------------------
 
-void parseExample(OutputList &ol,const QCString &docString, 
+void parseExample(OutputDocInterface &od,const QCString &docString, 
                   const char *fileName)
 {
   initParser();
@@ -2316,7 +2327,7 @@ void parseExample(OutputList &ol,const QCString &docString,
   exampleDoc=TRUE;            // cross reference with member docs
   exampleName=fileName;
   strcpy(yyFileName,fileName);
-  parseDocument(ol,docString); 
+  parseDocument(od,docString); 
 }
 
 //----------------------------------------------------------------------------
diff --git a/src/dot.cpp b/src/dot.cpp
index 6e9f823..7e067e5 100644
--- a/src/dot.cpp
+++ b/src/dot.cpp
@@ -87,13 +87,13 @@ static bool convertMapFile(QTextStream &t,const char *mapName)
         if (*refPtr!='\0')
         {
           t << "doxygen=\"" << refPtr << ":";
-          if ((dest=tagDestinationDict[refPtr])) t << *dest << "/";
+          if ((dest=Doxygen::tagDestinationDict[refPtr])) t << *dest << "/";
           t << "\" ";
         }
         t << "href=\""; 
         if (*refPtr!='\0')
         {
-          if ((dest=tagDestinationDict[refPtr])) t << *dest << "/";
+          if ((dest=Doxygen::tagDestinationDict[refPtr])) t << *dest << "/";
         }
         t << urlPtr << "\" shape=\"rect\" coords=\"" 
           << x1 << "," << y1 << "," << x2 << "," << y2 << "\">" << endl;
@@ -693,8 +693,8 @@ DotGfxHierarchyTable::DotGfxHierarchyTable()
   
   // build a graph with each class as a node and the inheritance relations
   // as edges
-  initClassHierarchy(&classList);
-  ClassListIterator cli(classList);
+  initClassHierarchy(&Doxygen::classList);
+  ClassListIterator cli(Doxygen::classList);
   ClassDef *cd;
   for (cli.toLast();(cd=cli.current());--cli)
   {
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index 1b31b6f..bac4406 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -54,7 +54,7 @@
 #include "ftvhelp.h"
 #include "defargs.h"
 #include "rtfgen.h"
-#include "xml.h"
+//#include "xml.h"
 #include "reflist.h"
 #include "page.h"
 #include "packagedef.h"
@@ -65,140 +65,131 @@
 #define pclose _pclose
 #endif
 
-// lists
-ClassList      classList;          // all documented classes
-NamespaceList  namespaceList;      // all namespaces
-MemberNameList memberNameList;     // class member + related functions
-MemberNameList functionNameList;   // all unrelated functions
-FileNameList   inputNameList;      // all input files
-StringList     inputFiles;         
-GroupList      groupList;          // all groups
-FormulaList    formulaList;        // all formulas
-
-// dictionaries
-PageSDict      *pageSDict = new PageSDict(1009);          // all doc pages
-PageSDict      *exampleSDict = new PageSDict(1009);       // all examples
-ClassDict      classDict(1009);         // all documented classes
-NamespaceDict  namespaceDict(257);      // all documented namespaces
-MemberNameDict memberNameDict(10007);   // all class member names
-MemberNameDict functionNameDict(10007); // all functions
-//StringDict     substituteDict(1009);  // class name substitutes
-SectionDict    sectionDict(257);        // all page sections
-StringDict     excludeNameDict(1009);   // sections
-StringDict     aliasDict(257);          // aliases
-FileNameDict   *inputNameDict;          // sections
-FileNameDict   *includeNameDict;        // include names
-FileNameDict   *exampleNameDict;        // examples
-FileNameDict   *imageNameDict;          // images
-StringDict     typedefDict(1009);       // all typedefs
-StringDict     namespaceAliasDict(257); // all namespace aliases
-GroupDict      groupDict(257);          // all groups
-FormulaDict    formulaDict(1009);       // all formulas
-FormulaDict    formulaNameDict(1009);   // the label name of all formulas
-StringDict     tagDestinationDict(257); // all tag locations
+ClassList      Doxygen::classList;               // all documented classes
+ClassDict      Doxygen::classDict(1009);         
+
+NamespaceList  Doxygen::namespaceList;           // all namespaces
+NamespaceDict  Doxygen::namespaceDict(257);      
+
+MemberNameList Doxygen::memberNameList;          // class member + related functions
+MemberNameDict Doxygen::memberNameDict(10007);   
+
+MemberNameList Doxygen::functionNameList;        // all global function/namespace members
+MemberNameDict Doxygen::functionNameDict(10007); 
+
+FileNameList   Doxygen::inputNameList;           // all input files
+FileNameDict  *Doxygen::inputNameDict;          
+
+GroupList      Doxygen::groupList;               // all groups
+GroupDict      Doxygen::groupDict(257);          
+
+FormulaList    Doxygen::formulaList;             // all formulas
+FormulaDict    Doxygen::formulaDict(1009);       // all formulas
+FormulaDict    Doxygen::formulaNameDict(1009);   // the label name of all formulas
+
+PackageSDict   Doxygen::packageDict(257);         // java packages
+
+PageSDict      *Doxygen::pageSDict = new PageSDict(1009);          // all doc pages
+PageSDict      *Doxygen::exampleSDict = new PageSDict(1009);       // all examples
+SectionDict    Doxygen::sectionDict(257);        // all page sections
+StringDict     Doxygen::aliasDict(257);          // aliases
+FileNameDict   *Doxygen::includeNameDict;        // include names
+FileNameDict   *Doxygen::exampleNameDict;        // examples
+FileNameDict   *Doxygen::imageNameDict;          // images
+StringDict     Doxygen::typedefDict(1009);       // all typedefs
+StringDict     Doxygen::namespaceAliasDict(257); // all namespace aliases
+StringDict     Doxygen::tagDestinationDict(257); // all tag locations
                                         // a member group
-QDict<void>    compoundKeywordDict(7);  // keywords recognised as compounds
-QDict<void>    expandAsDefinedDict(257); // all macros that should be expanded
-OutputList     *outputList = 0;         // list of output generating objects
+QDict<void>    Doxygen::expandAsDefinedDict(257); // all macros that should be expanded
 
-PageInfo       *mainPage = 0;
-QIntDict<QCString> memberHeaderDict(1009); // dictionary of the member groups heading
-QIntDict<QCString> memberDocDict(1009);    // dictionary of the member groups heading
+QIntDict<QCString> Doxygen::memberHeaderDict(1009); // dictionary of the member groups heading
+QIntDict<QCString> Doxygen::memberDocDict(1009);    // dictionary of the member groups heading
 
-PackageSDict   packageDict(257);         // java packages
+PageInfo      *Doxygen::mainPage = 0;           
+QTextStream    Doxygen::tagFile;
   
+static StringList     inputFiles;         
+static StringDict     excludeNameDict(1009);   // sections
+static QDict<void>    compoundKeywordDict(7);  // keywords recognised as compounds
+static OutputList     *outputList = 0;         // list of output generating objects
 
 void clearAll()
 {
-  classList.clear();       
-  namespaceList.clear();   
-  pageSDict->clear();         
-  exampleSDict->clear();      
-  memberNameList.clear();  
-  functionNameList.clear();
-  inputNameList.clear();   
   inputFiles.clear();      
-  groupList.clear();       
-  formulaList.clear();     
-  classDict.clear();        
-  namespaceDict.clear();     
-  memberNameDict.clear();  
-  functionNameDict.clear();
-  sectionDict.clear();       
-  inputNameDict->clear();    
   excludeNameDict.clear();  
-  includeNameDict->clear();  
-  exampleNameDict->clear();  
-  imageNameDict->clear();     
-  typedefDict.clear();      
-  groupDict.clear();         
-  formulaDict.clear();      
-  formulaNameDict.clear();  
-  tagDestinationDict.clear();
   delete outputList; outputList=0;
-  delete mainPage; mainPage=0;
+
+  Doxygen::classList.clear();       
+  Doxygen::namespaceList.clear();   
+  Doxygen::pageSDict->clear();         
+  Doxygen::exampleSDict->clear();      
+  Doxygen::memberNameList.clear();  
+  Doxygen::functionNameList.clear();
+  Doxygen::inputNameList.clear();   
+  Doxygen::groupList.clear();       
+  Doxygen::formulaList.clear();     
+  Doxygen::classDict.clear();        
+  Doxygen::namespaceDict.clear();     
+  Doxygen::memberNameDict.clear();  
+  Doxygen::functionNameDict.clear();
+  Doxygen::sectionDict.clear();       
+  Doxygen::inputNameDict->clear();    
+  Doxygen::includeNameDict->clear();  
+  Doxygen::exampleNameDict->clear();  
+  Doxygen::imageNameDict->clear();     
+  Doxygen::typedefDict.clear();      
+  Doxygen::groupDict.clear();         
+  Doxygen::formulaDict.clear();      
+  Doxygen::formulaNameDict.clear();  
+  Doxygen::tagDestinationDict.clear();
+  delete Doxygen::mainPage; Doxygen::mainPage=0;
 }
 
 void statistics()
 {
   fprintf(stderr,"--- inputNameDict stats ----\n");
-  inputNameDict->statistics();
+  Doxygen::inputNameDict->statistics();
   fprintf(stderr,"--- includeNameDict stats ----\n");
-  includeNameDict->statistics();
+  Doxygen::includeNameDict->statistics();
   fprintf(stderr,"--- exampleNameDict stats ----\n");
-  exampleNameDict->statistics();
+  Doxygen::exampleNameDict->statistics();
   fprintf(stderr,"--- imageNameDict stats ----\n");
-  imageNameDict->statistics();
+  Doxygen::imageNameDict->statistics();
   fprintf(stderr,"--- classDict stats ----\n");
-  classDict.statistics();
+  Doxygen::classDict.statistics();
   fprintf(stderr,"--- namespaceDict stats ----\n");
-  namespaceDict.statistics();
+  Doxygen::namespaceDict.statistics();
   fprintf(stderr,"--- memberNameDict stats ----\n");
-  memberNameDict.statistics();
+  Doxygen::memberNameDict.statistics();
   fprintf(stderr,"--- functionNameDict stats ----\n");
-  functionNameDict.statistics();
-  fprintf(stderr,"--- sectionDict stats ----\n");
-  sectionDict.statistics();
+  Doxygen::functionNameDict.statistics();
   fprintf(stderr,"--- excludeNameDict stats ----\n");
   excludeNameDict.statistics();
   fprintf(stderr,"--- aliasDict stats ----\n");
-  aliasDict.statistics();
+  Doxygen::aliasDict.statistics();
   fprintf(stderr,"--- typedefDict stats ----\n");
-  typedefDict.statistics();
+  Doxygen::typedefDict.statistics();
   fprintf(stderr,"--- namespaceAliasDict stats ----\n");
-  namespaceAliasDict.statistics();
+  Doxygen::namespaceAliasDict.statistics();
   fprintf(stderr,"--- groupDict stats ----\n");
-  groupDict.statistics();
+  Doxygen::groupDict.statistics();
   fprintf(stderr,"--- formulaDict stats ----\n");
-  formulaDict.statistics();
+  Doxygen::formulaDict.statistics();
   fprintf(stderr,"--- formulaNameDict stats ----\n");
-  formulaNameDict.statistics();
+  Doxygen::formulaNameDict.statistics();
   fprintf(stderr,"--- tagDestinationDict stats ----\n");
-  tagDestinationDict.statistics();
+  Doxygen::tagDestinationDict.statistics();
   fprintf(stderr,"--- compoundKeywordDict stats ----\n");
   compoundKeywordDict.statistics();
   fprintf(stderr,"--- expandAsDefinedDict stats ----\n");
-  expandAsDefinedDict.statistics();
+  Doxygen::expandAsDefinedDict.statistics();
   fprintf(stderr,"--- memberHeaderDict stats ----\n");
-  memberHeaderDict.statistics();
+  Doxygen::memberHeaderDict.statistics();
   fprintf(stderr,"--- memberDocDict stats ----\n");
-  memberDocDict.statistics();
+  Doxygen::memberDocDict.statistics();
 }
 
-int annotatedClasses;
-int hierarchyClasses;
-int documentedFunctions;
-int documentedMembers;
-int documentedHtmlFiles;
-int documentedFiles;
-int documentedGroups;
-int documentedNamespaces;
-int documentedNamespaceMembers;
-int documentedIncludeFiles;
-int documentedPages;
-int documentedPackages;
-
-QTextStream tagFile;
+
 
 static void addMemberDocs(Entry *root,MemberDef *md, const char *funcDecl,
                    ArgumentList *al,bool over_load,NamespaceList *nl=0);
@@ -206,27 +197,17 @@ static void addMemberDocs(Entry *root,MemberDef *md, const char *funcDecl,
 const char idMask[] = "[A-Za-z_][A-Za-z_0-9]*";
 QCString spaces;
 
-//----------------------------------------------------------------------
-// Returns the standard string that is generated when the \overload
-// command is used.
-
-const char *getOverloadDocs()
-{
-  return "This is an overloaded member function, "
-         "provided for convenience. It differs from the above "
-         "function only in what argument(s) it accepts.";
-}
-      
 //----------------------------------------------------------------------------
 
 static void addRelatedPage(const char *name,const QCString &ptitle,
                            const QCString &doc,QList<QCString> *anchors,
                            const char *fileName,int startLine,
-                           int todoId,int testId,GroupDef *gd=0
+                           int todoId,int testId,GroupDef *gd=0,
+                           TagInfo *tagInfo=0
                           )
 {
   PageInfo *pi=0;
-  if ((pi=pageSDict->find(name)))
+  if ((pi=Doxygen::pageSDict->find(name)))
   {
     // append documentation block to the page.
     pi->doc+="\n\n"+doc;
@@ -238,19 +219,26 @@ static void addRelatedPage(const char *name,const QCString &ptitle,
       baseName=baseName.left(baseName.length()-4);
     else if (baseName.right(5)==".html")
       baseName=baseName.left(baseName.length()-5);
-
+    
     QCString title=ptitle.stripWhiteSpace();
     pi=new PageInfo(fileName,startLine,baseName,doc,title);
     pi->todoId=todoId;
     pi->testId=testId;
+    if (tagInfo)
+    {
+      pi->reference = tagInfo->tagName;
+    }
+
     QCString pageName;
     if (Config::caseSensitiveNames)
       pageName=pi->name.copy();
     else
       pageName=pi->name.lower();
-    setFileNameForSections(anchors,pageName);
+    //setFileNameForSections(anchors,pageName,pi);
+    pi->fileName = pageName;
+    pi->addSections(anchors);
 
-    pageSDict->append(baseName,pi);
+    Doxygen::pageSDict->append(baseName,pi);
 
     if (gd) gd->addPage(pi);
     
@@ -260,7 +248,7 @@ static void addRelatedPage(const char *name,const QCString &ptitle,
 
       // a page name is a label as well!
       SectionInfo *si=new SectionInfo(
-          pi->name,pi->title,SectionInfo::Section);
+          pi->name,pi->title,SectionInfo::Section,pi->reference);
       if (gd)
       {
         si->fileName=gd->getOutputFileBase();
@@ -271,7 +259,7 @@ static void addRelatedPage(const char *name,const QCString &ptitle,
       }
       //printf("  SectionInfo: sec=%p sec->fileName=%s\n",si,si->fileName.data());
       //printf("Adding section info %s\n",pi->name.data());
-      sectionDict.insert(pageName,si);
+      Doxygen::sectionDict.insert(pageName,si);
     }
   }
 }
@@ -283,10 +271,10 @@ static void addRelatedPage(Entry *root)
   QCString *s;
   for (;(s=sli.current());++sli)
   {
-    if (!s->isEmpty() && (gd=groupDict[*s])) break;
+    if (!s->isEmpty() && (gd=Doxygen::groupDict[*s])) break;
   }
   addRelatedPage(root->name,root->args,root->doc,root->anchors,
-      root->fileName,root->startLine,root->todoId,root->testId,gd
+      root->fileName,root->startLine,root->todoId,root->testId,gd,root->tagInfo
      );
 }
 
@@ -322,6 +310,7 @@ static void addRefItem(int todoId,int testId,const char *prefix,
     doc += "</dt>\n<dd>";
     doc += item->text;
     doc += "</dd></dl>\n";
+    //printf("Todo page: %s\n",doc.data());
     addRelatedPage("todo",theTranslator->trTodoList(),doc,0,"generated",1,0,0);
 
     item->written=TRUE;
@@ -368,7 +357,7 @@ static void buildGroupList(Entry *root)
     
     GroupDef *gd;
     
-    if ((gd=groupDict[root->name]))
+    if ((gd=Doxygen::groupDict[root->name]))
     {
       warn(root->fileName,root->startLine,
            "Warning: group %s already documented. "
@@ -385,8 +374,8 @@ static void buildGroupList(Entry *root)
       gd->setBriefDescription(root->brief);
       gd->setDocumentation(root->doc);
       gd->addSectionsToDefinition(root->anchors);
-      groupList.append(gd);
-      groupDict.insert(root->name,gd);
+      Doxygen::groupList.append(gd);
+      Doxygen::groupDict.insert(root->name,gd);
       addGroupToGroups(root,gd);
       gd->setRefItems(root->todoId,root->testId);
     }
@@ -401,37 +390,6 @@ static void buildGroupList(Entry *root)
 
 //----------------------------------------------------------------------
 
-//void computeGroupRelations(Entry *root)
-//{
-//  if (root->section==Entry::GROUPDOC_SEC && !root->name.isEmpty())
-//  {
-//    GroupDef *gd;
-//    
-//    if ((gd=groupDict[root->name]))
-//    {
-//      QListIterator<QCString> sli(*root->groups);
-//      QCString *s;
-//      for (;(s=sli.current());++sli)
-//      {
-//        GroupDef *pgd;
-//        if (!s->isEmpty() && (pgd=groupDict[*s]))
-//        {
-//          pgd->addGroup(gd);
-//          printf("Group %s: in group %s\n",gd->groupName(),s->data());
-//        }
-//      }
-//    }
-//  }
-//  EntryListIterator eli(*root->sublist);
-//  Entry *e;
-//  for (;(e=eli.current());++eli)
-//  {
-//    computeGroupRelations(e);
-//  }
-//}
-
-//----------------------------------------------------------------------
-
 static void buildFileList(Entry *root)
 {
   if (((root->section==Entry::FILEDOC_SEC) ||
@@ -440,7 +398,7 @@ static void buildFileList(Entry *root)
      )
   {
     bool ambig;
-    FileDef *fd=findFileDef(inputNameDict,root->name,ambig);
+    FileDef *fd=findFileDef(Doxygen::inputNameDict,root->name,ambig);
     if (fd && !ambig)
     {
       if ((!root->doc.isEmpty() && !fd->documentation().isEmpty()) ||
@@ -467,7 +425,7 @@ static void buildFileList(Entry *root)
         for (;(s=sli.current());++sli)
         {
           GroupDef *gd=0;
-          if (!s->isEmpty() && (gd=groupDict[*s]))
+          if (!s->isEmpty() && (gd=Doxygen::groupDict[*s]))
           {
             gd->addFile(fd);
             //printf("File %s: in group %s\n",fd->name().data(),s->data());
@@ -486,7 +444,7 @@ static void buildFileList(Entry *root)
       if (ambig) // name is ambigious
       {
         text+="matches the following input files:\n";
-        text+=showFileDefMatches(inputNameDict,root->name);
+        text+=showFileDefMatches(Doxygen::inputNameDict,root->name);
         text+="Please use a more specific name by "
               "including a (larger) part of the path!";
       }
@@ -521,7 +479,7 @@ static void addIncludeFile(ClassDef *cd,FileDef *ifd,Entry *root)
     // see if we need to include a verbatim copy of the header file
     //printf("root->includeFile=%s\n",root->includeFile.data());
     if (!root->includeFile.isEmpty() && 
-        (fd=findFileDef(inputNameDict,root->includeFile,ambig))==0
+        (fd=findFileDef(Doxygen::inputNameDict,root->includeFile,ambig))==0
        )
     { // explicit request
       QCString text;
@@ -532,7 +490,7 @@ static void addIncludeFile(ClassDef *cd,FileDef *ifd,Entry *root)
       if (ambig) // name is ambigious
       {
         text+="matches the following input files:\n";
-        text+=showFileDefMatches(inputNameDict,root->includeFile);
+        text+=showFileDefMatches(Doxygen::inputNameDict,root->includeFile);
         text+="Please use a more specific name by "
             "including a (larger) part of the path!";
       }
@@ -635,7 +593,7 @@ static void buildClassList(Entry *root)
       bool ambig;
       ClassDef *cd;
       //printf("findFileDef(%s)\n",root->fileName.data());
-      FileDef *fd=findFileDef(inputNameDict,root->fileName,ambig);
+      FileDef *fd=findFileDef(Doxygen::inputNameDict,root->fileName,ambig);
 
       if ((cd=getClass(fullName))) 
       {
@@ -679,7 +637,7 @@ static void buildClassList(Entry *root)
           if (root->bodyLine!=-1 && cd->getStartBodyLine()==-1)
           {
             cd->setBodySegment(root->bodyLine,root->endBodyLine);
-            cd->setBodyDef(findFileDef(inputNameDict,root->fileName,ambig));
+            cd->setBodyDef(findFileDef(Doxygen::inputNameDict,root->fileName,ambig));
           }
           cd->addSectionsToDefinition(root->anchors);
           cd->setName(fullName); // change name to match docs
@@ -790,10 +748,10 @@ static void buildClassList(Entry *root)
 
         
         // add class to the list
-        classList.inSort(cd);
+        Doxygen::classList.inSort(cd);
         //printf("ClassDict.insert(%s)\n",resolveDefines(fullName).data());
         //classDict.insert(resolveDefines(fullName),cd);
-        classDict.insert(fullName,cd);
+        Doxygen::classDict.insert(fullName,cd);
       }
     }
   }
@@ -822,7 +780,7 @@ static void buildNamespaceList(Entry *root)
       //printf("Found namespace %s in %s at line %d\n",root->name.data(),
       //        root->fileName.data(), root->startLine);
       NamespaceDef *nd;
-      if ((nd=namespaceDict[fullName])) 
+      if ((nd=Doxygen::namespaceDict[fullName])) 
       {
         if (!root->doc.isEmpty() || !root->brief.isEmpty()) // block contains docs
         { 
@@ -857,7 +815,7 @@ static void buildNamespaceList(Entry *root)
 
         bool ambig;
         // file definition containing the namespace nd
-        FileDef *fd=findFileDef(inputNameDict,root->fileName,ambig);
+        FileDef *fd=findFileDef(Doxygen::inputNameDict,root->fileName,ambig);
         // insert the namespace in the file definition
         if (fd) fd->insertNamespace(nd);
         addNamespaceToGroups(root,nd);
@@ -885,7 +843,7 @@ static void buildNamespaceList(Entry *root)
 
         bool ambig;
         // file definition containing the namespace nd
-        FileDef *fd=findFileDef(inputNameDict,root->fileName,ambig);
+        FileDef *fd=findFileDef(Doxygen::inputNameDict,root->fileName,ambig);
         // insert the namespace in the file definition
         if (fd) fd->insertNamespace(nd);
 
@@ -895,8 +853,8 @@ static void buildNamespaceList(Entry *root)
         nd->setBodySegment(root->bodyLine,root->endBodyLine);
         nd->setBodyDef(fd);
         // add class to the list
-        namespaceList.inSort(nd);
-        namespaceDict.insert(fullName,nd);
+        Doxygen::namespaceList.inSort(nd);
+        Doxygen::namespaceDict.insert(fullName,nd);
 
       }
     }
@@ -922,7 +880,7 @@ static void findUsingDirectives(Entry *root)
     {
       NamespaceDef *usingNd = 0;
       NamespaceDef *nd = 0;
-      FileDef      *fd = findFileDef(inputNameDict,root->fileName,ambig);
+      FileDef      *fd = findFileDef(Doxygen::inputNameDict,root->fileName,ambig);
       QCString nsName;
 
       // see if the using statement was found inside a namespace or inside
@@ -986,13 +944,13 @@ static void findUsingDirectives(Entry *root)
         for (;(s=sli.current());++sli)
         {
           GroupDef *gd=0;
-          if (!s->isEmpty() && (gd=groupDict[*s]))
+          if (!s->isEmpty() && (gd=Doxygen::groupDict[*s]))
             gd->addNamespace(nd);
         }
 
         bool ambig;
         // file definition containing the namespace nd
-        FileDef *fd=findFileDef(inputNameDict,root->fileName,ambig);
+        FileDef *fd=findFileDef(Doxygen::inputNameDict,root->fileName,ambig);
         // insert the namespace in the file definition
         if (fd) 
         {
@@ -1004,8 +962,8 @@ static void findUsingDirectives(Entry *root)
         nd->setBriefDescription(root->brief);
         nd->insertUsedFile(root->fileName);
         // add class to the list
-        namespaceList.inSort(nd);
-        namespaceDict.insert(root->name,nd);
+        Doxygen::namespaceList.inSort(nd);
+        Doxygen::namespaceDict.insert(root->name,nd);
         nd->setRefItems(root->todoId,root->testId);
       }
     }
@@ -1031,7 +989,7 @@ static void findUsingDeclarations(Entry *root)
     {
       ClassDef *usingCd = 0;
       NamespaceDef *nd = 0;
-      FileDef      *fd = findFileDef(inputNameDict,root->fileName,ambig);
+      FileDef      *fd = findFileDef(Doxygen::inputNameDict,root->fileName,ambig);
       QCString scName;
 
       // see if the using statement was found inside a namespace or inside
@@ -1160,7 +1118,7 @@ static MemberDef *addVariableToClass(
   // see if the member is already found in the same scope
   // (this may be the case for a static member that is initialized
   //  outside the class)
-  MemberName *mn=memberNameDict[name];
+  MemberName *mn=Doxygen::memberNameDict[name];
   if (mn)
   {
     MemberNameIterator mni(*mn);
@@ -1207,7 +1165,7 @@ static MemberDef *addVariableToClass(
   //  md->setMemberGroup(memberGroupDict[root->mGrpId]);
   //
   bool ambig;
-  md->setBodyDef(findFileDef(inputNameDict,root->fileName,ambig));
+  md->setBodyDef(findFileDef(Doxygen::inputNameDict,root->fileName,ambig));
 
   // add the member to the global list
   if (mn)
@@ -1219,8 +1177,8 @@ static MemberDef *addVariableToClass(
     mn = new MemberName(name);
     mn->append(md);
     //printf("Adding memberName=%s\n",mn->memberName());
-    memberNameDict.insert(name,mn);
-    memberNameList.append(mn);
+    Doxygen::memberNameDict.insert(name,mn);
+    Doxygen::memberNameList.append(mn);
     // add the member to the class
   }
   cd->insertMember(md);
@@ -1253,7 +1211,7 @@ static MemberDef *addVariableToFile(
               );
 
   bool ambig;
-  FileDef *fd = findFileDef(inputNameDict,root->fileName,ambig);
+  FileDef *fd = findFileDef(Doxygen::inputNameDict,root->fileName,ambig);
 
   // see if the function is inside a namespace
   NamespaceDef *nd = 0;
@@ -1297,7 +1255,7 @@ static MemberDef *addVariableToFile(
   }
   if (def.left(7)=="static ") def=def.right(def.length()-7);
 
-  MemberName *mn=functionNameDict[name];
+  MemberName *mn=Doxygen::functionNameDict[name];
   if (mn)
   {
     QCString nscope=removeAnonymousScopes(scope);
@@ -1325,7 +1283,7 @@ static MemberDef *addVariableToFile(
         // merge ingroup specifiers
         if (md->getGroupDef()==0 && root->groups->first())
         {
-          GroupDef *gd=groupDict[root->groups->first()->data()];
+          GroupDef *gd=Doxygen::groupDict[root->groups->first()->data()];
           md->setGroupDef(gd);
         }
         else if (md->getGroupDef()!=0 && root->groups->count()==0)
@@ -1391,8 +1349,8 @@ static MemberDef *addVariableToFile(
   {
     mn = new MemberName(name);
     mn->append(md);
-    functionNameDict.insert(name,mn);
-    functionNameList.append(mn);
+    Doxygen::functionNameDict.insert(name,mn);
+    Doxygen::functionNameList.append(mn);
   }
   return md;
 }
@@ -1699,7 +1657,7 @@ static void buildMemberList(Entry *root)
         md->setMemberSpecifiers(root->memSpec);
         md->setMemberGroupId(root->mGrpId);
         bool ambig;
-        md->setBodyDef(findFileDef(inputNameDict,root->fileName,ambig));
+        md->setBodyDef(findFileDef(Doxygen::inputNameDict,root->fileName,ambig));
         //md->setScopeTemplateArguments(root->tArgList);
         md->addSectionsToDefinition(root->anchors);
         QCString def;
@@ -1770,7 +1728,7 @@ static void buildMemberList(Entry *root)
 
         // add member to the global list of all members
         MemberName *mn;
-        if ((mn=memberNameDict[name]))
+        if ((mn=Doxygen::memberNameDict[name]))
         {
           mn->append(md);
         }
@@ -1779,8 +1737,8 @@ static void buildMemberList(Entry *root)
           mn = new MemberName(name);
           mn->append(md);
           //printf("Adding memberName=%s\n",mn->memberName());
-          memberNameDict.insert(name,mn);
-          memberNameList.append(mn);
+          Doxygen::memberNameDict.insert(name,mn);
+          Doxygen::memberNameList.append(mn);
         }
 
         // add member to the class cd
@@ -1806,7 +1764,7 @@ static void buildMemberList(Entry *root)
         bool found=FALSE;
         MemberName *mn;
         //MemberDef *fmd;
-        if ((mn=functionNameDict[rname]))
+        if ((mn=Doxygen::functionNameDict[rname]))
         {
           //printf("--> function %s already found!\n",rname.data());
           MemberNameIterator mni(*mn);
@@ -1854,14 +1812,14 @@ static void buildMemberList(Entry *root)
               {
                 md->setBodySegment(root->bodyLine,root->endBodyLine);
                 bool ambig;
-                md->setBodyDef(findFileDef(inputNameDict,root->fileName,ambig));
+                md->setBodyDef(findFileDef(Doxygen::inputNameDict,root->fileName,ambig));
               } 
               md->addSectionsToDefinition(root->anchors);
 
               // merge ingroup specifiers
               if (md->getGroupDef()==0 && root->groups->first())
               {
-                GroupDef *gd=groupDict[root->groups->first()->data()];
+                GroupDef *gd=Doxygen::groupDict[root->groups->first()->data()];
                 md->setGroupDef(gd);
               }
               else if (md->getGroupDef()!=0 && root->groups->count()==0)
@@ -1896,7 +1854,7 @@ static void buildMemberList(Entry *root)
           //md->setBody(root->body);
           md->setBodySegment(root->bodyLine,root->endBodyLine);
           bool ambig;
-          FileDef *fd=findFileDef(inputNameDict,root->fileName,ambig);
+          FileDef *fd=findFileDef(Doxygen::inputNameDict,root->fileName,ambig);
           md->setBodyDef(fd);
           md->addSectionsToDefinition(root->anchors);
           md->setMemberSpecifiers(root->memSpec);
@@ -1969,7 +1927,7 @@ static void buildMemberList(Entry *root)
 
           // add member to the list of file members
           MemberName *mn;
-          if ((mn=functionNameDict[name]))
+          if ((mn=Doxygen::functionNameDict[name]))
           {
             mn->append(md);
           }
@@ -1977,8 +1935,8 @@ static void buildMemberList(Entry *root)
           {
             mn = new MemberName(name);
             mn->append(md);
-            functionNameDict.insert(name,mn);
-            functionNameList.append(mn);
+            Doxygen::functionNameDict.insert(name,mn);
+            Doxygen::functionNameList.append(mn);
           }
           addMemberToGroups(root,md);
         }
@@ -2011,13 +1969,13 @@ static void buildMemberList(Entry *root)
 static void findFriends()
 {
   //printf("findFriends()\n");
-  MemberNameListIterator fnli(functionNameList);
+  MemberNameListIterator fnli(Doxygen::functionNameList);
   MemberName *fn;
   for (;(fn=fnli.current());++fnli) // for each global function name
   {
     //printf("Function name=`%s'\n",fn->memberName());
     MemberName *mn;
-    if ((mn=memberNameDict[fn->memberName()]))
+    if ((mn=Doxygen::memberNameDict[fn->memberName()]))
     { // there are members with the same name
       //printf("Function name is also a member name\n");
       MemberNameIterator fni(*fn);
@@ -2074,7 +2032,7 @@ static void transferFunctionDocumentation()
   //printf("transferFunctionDocumentation()\n");
 
   // find matching function declaration and definitions.
-  MemberNameListIterator mnli(functionNameList);
+  MemberNameListIterator mnli(Doxygen::functionNameList);
   MemberName *mn;
   for (;(mn=mnli.current());++mnli)
   {
@@ -2153,7 +2111,7 @@ static void transferRelatedFunctionDocumentation()
 {
   // find match between function declaration and definition for 
   // related functions
-  MemberNameListIterator mnli(functionNameList);
+  MemberNameListIterator mnli(Doxygen::functionNameList);
   MemberName *mn;
   for (mnli.toFirst();(mn=mnli.current());++mnli)
   {
@@ -2164,7 +2122,7 @@ static void transferRelatedFunctionDocumentation()
     {
       //printf("  Function `%s'\n",md->name().data());
       MemberName *rmn;
-      if ((rmn=memberNameDict[md->name()])) // check if there is a member with the same name
+      if ((rmn=Doxygen::memberNameDict[md->name()])) // check if there is a member with the same name
       {
         //printf("  Member name found\n");
         MemberDef *rmd;
@@ -2191,7 +2149,7 @@ static void replaceNamespaceAliases(QCString &scope,int i)
   //printf("replaceNamespaceAliases(%s,%d)\n",scope.data(),i);
   while (i>0)
   {
-    QCString *s = namespaceAliasDict[scope.left(i)];
+    QCString *s = Doxygen::namespaceAliasDict[scope.left(i)];
     if (s)
     {
       scope=*s+scope.right(scope.length()-i);
@@ -2396,10 +2354,10 @@ static bool findBaseClassRelation(Entry *root,ClassDef *cd,
           baseClass->insertUsedFile(root->fileName);
           // add class to the list
           //classList.inSort(baseClass);
-          classList.inSort(baseClass);
+          Doxygen::classList.inSort(baseClass);
           //printf("ClassDict.insert(%s)\n",resolveDefines(fullName).data());
           //classDict.insert(resolveDefines(bi->name),baseClass);
-          classDict.insert(baseClassName,baseClass);
+          Doxygen::classDict.insert(baseClassName,baseClass);
           return TRUE;
         }
         else
@@ -2503,13 +2461,13 @@ static void computeClassRelations(Entry *root)
 
 static void computeMemberReferences()
 {
-  ClassDef *cd=classList.first();
+  ClassDef *cd=Doxygen::classList.first();
   while (cd)
   {
     cd->computeAnchors();
-    cd=classList.next();
+    cd=Doxygen::classList.next();
   } 
-  FileName *fn=inputNameList.first();
+  FileName *fn=Doxygen::inputNameList.first();
   while (fn)
   {
     FileDef *fd=fn->first();
@@ -2518,19 +2476,19 @@ static void computeMemberReferences()
       fd->computeAnchors();
       fd=fn->next();
     }
-    fn=inputNameList.next();
+    fn=Doxygen::inputNameList.next();
   }
-  NamespaceDef *nd=namespaceList.first();
+  NamespaceDef *nd=Doxygen::namespaceList.first();
   while (nd)
   {
     nd->computeAnchors();
-    nd=namespaceList.next();
+    nd=Doxygen::namespaceList.next();
   }
-  GroupDef *gd=groupList.first();
+  GroupDef *gd=Doxygen::groupList.first();
   while (gd)
   {
     gd->computeAnchors();
-    gd=groupList.next();
+    gd=Doxygen::groupList.next();
   }
 }
 
@@ -2538,13 +2496,13 @@ static void computeMemberReferences()
 
 static void addTodoTestReferences()
 {
-  ClassDef *cd=classList.first();
+  ClassDef *cd=Doxygen::classList.first();
   while (cd)
   {
     addRefItem(cd->todoId(),cd->testId(),"class",cd->getOutputFileBase(),cd->name());
-    cd=classList.next();
+    cd=Doxygen::classList.next();
   } 
-  FileName *fn=inputNameList.first();
+  FileName *fn=Doxygen::inputNameList.first();
   while (fn)
   {
     FileDef *fd=fn->first();
@@ -2553,27 +2511,27 @@ static void addTodoTestReferences()
       addRefItem(fd->todoId(),fd->testId(),"file",fd->getOutputFileBase(),fd->name());
       fd=fn->next();
     }
-    fn=inputNameList.next();
+    fn=Doxygen::inputNameList.next();
   }
-  NamespaceDef *nd=namespaceList.first();
+  NamespaceDef *nd=Doxygen::namespaceList.first();
   while (nd)
   {
     addRefItem(nd->todoId(),nd->testId(),"namespace",nd->getOutputFileBase(),nd->name());
-    nd=namespaceList.next();
+    nd=Doxygen::namespaceList.next();
   }
-  GroupDef *gd=groupList.first();
+  GroupDef *gd=Doxygen::groupList.first();
   while (gd)
   {
     addRefItem(gd->todoId(),gd->testId(),"group",gd->getOutputFileBase(),gd->name());
-    gd=groupList.next();
+    gd=Doxygen::groupList.next();
   }
-  PageSDictIterator pdi(*pageSDict);
+  PageSDictIterator pdi(*Doxygen::pageSDict);
   PageInfo *pi=0;
   for (pdi.toFirst();(pi=pdi.current());++pdi)
   {
     addRefItem(pi->todoId,pi->testId,"page",pi->name,pi->title);
   }
-  MemberNameListIterator mnli(memberNameList);
+  MemberNameListIterator mnli(Doxygen::memberNameList);
   MemberName *mn=0;
   for (mnli.toFirst();(mn=mnli.current());++mnli)
   {
@@ -2592,7 +2550,7 @@ static void addTodoTestReferences()
       }
     }
   }
-  MemberNameListIterator fnli(functionNameList);
+  MemberNameListIterator fnli(Doxygen::functionNameList);
   for (fnli.toFirst();(mn=fnli.current());++fnli)
   {
     MemberNameIterator mni(*mn);
@@ -2706,7 +2664,7 @@ static void addMemberDocs(Entry *root,
     //  md->setBody(root->body);
     //}
     bool ambig;
-    FileDef *fd=findFileDef(inputNameDict,root->fileName,ambig);
+    FileDef *fd=findFileDef(Doxygen::inputNameDict,root->fileName,ambig);
     if (fd)
     {
 
@@ -2854,10 +2812,10 @@ static bool findUnrelatedFunction(Entry *root,
   Debug::print(Debug::FindMembers,0,
        "2. findUnrelatedFunction(namespace=%s,name=%s,tempArg=%s,decl=%s)\n",
           namespaceName.data(),name,tempArg,decl);
-  MemberName *mn=functionNameDict[n+tempArg]; // look in function dictionary
+  MemberName *mn=Doxygen::functionNameDict[n+tempArg]; // look in function dictionary
   if (mn==0)
   {
-    mn=functionNameDict[n]; // try without template arguments
+    mn=Doxygen::functionNameDict[n]; // try without template arguments
   }
   if (mn) // function name defined
   {
@@ -2872,7 +2830,7 @@ static bool findUnrelatedFunction(Entry *root,
       NamespaceDef *nd=md->getNamespaceDef();
       //printf("Namespace namespaceName=%s nd=%s\n",
       //    namespaceName.data(),nd ? nd->name().data() : "<none>");
-      FileDef *fd=findFileDef(inputNameDict,root->fileName,ambig);
+      FileDef *fd=findFileDef(Doxygen::inputNameDict,root->fileName,ambig);
       //printf("File %s\n",fd ? fd->name().data() : "<none>");
       NamespaceList *nl = fd ? fd->getUsedNamespaces() : 0;
       //printf("NamespaceList %p\n",nl);
@@ -3355,11 +3313,11 @@ static void findMember(Entry *root,QCString funcDecl,QCString related,bool overl
                  "1. funcName=`%s'\n",funcName.data());
     if (!funcTempList.isEmpty()) // try with member specialization
     {
-      mn=memberNameDict[funcName+funcTempList];
+      mn=Doxygen::memberNameDict[funcName+funcTempList];
     }
     if (mn==0) // try without specialization
     {
-      mn=memberNameDict[funcName];
+      mn=Doxygen::memberNameDict[funcName];
     }
     if (!isRelated && mn) // function name already found
     {
@@ -3379,7 +3337,7 @@ static void findMember(Entry *root,QCString funcDecl,QCString related,bool overl
           ClassDef *tcd=0;
           
           bool ambig;
-          FileDef *fd=findFileDef(inputNameDict,root->fileName,ambig);
+          FileDef *fd=findFileDef(Doxygen::inputNameDict,root->fileName,ambig);
           NamespaceDef *nd=0;
           if (!namespaceName.isEmpty()) nd=getResolvedNamespace(namespaceName);
           tcd = findClassDefinition(fd,nd,scopeName,classTempList);
@@ -3463,7 +3421,7 @@ static void findMember(Entry *root,QCString funcDecl,QCString related,bool overl
             // TODO: match loop for all possible scopes
 
             bool ambig;
-            FileDef *fd=findFileDef(inputNameDict,root->fileName,ambig);
+            FileDef *fd=findFileDef(Doxygen::inputNameDict,root->fileName,ambig);
             // list of namespaces using in the file that this member definition is part of
             NamespaceList *nl = fd ? fd->getUsedNamespaces() : 0;
             
@@ -3580,7 +3538,7 @@ static void findMember(Entry *root,QCString funcDecl,QCString related,bool overl
           md->addSectionsToDefinition(root->anchors);
           md->setBodySegment(root->bodyLine,root->endBodyLine);
           bool ambig;
-          FileDef *fd=findFileDef(inputNameDict,root->fileName,ambig);
+          FileDef *fd=findFileDef(Doxygen::inputNameDict,root->fileName,ambig);
           md->setBodyDef(fd);
           md->setMemberSpecifiers(root->memSpec);
           md->setMemberGroupId(root->mGrpId);
@@ -3609,7 +3567,7 @@ static void findMember(Entry *root,QCString funcDecl,QCString related,bool overl
       {
         bool newMember=TRUE; // assume we have a new member
         bool newMemberName=FALSE; 
-        if ((mn=memberNameDict[funcName])==0)
+        if ((mn=Doxygen::memberNameDict[funcName])==0)
         {
           mn=new MemberName(funcName);
           newMemberName=TRUE; // we create a new member name
@@ -3662,7 +3620,7 @@ static void findMember(Entry *root,QCString funcDecl,QCString related,bool overl
           bool found=FALSE;
           if (root->bodyLine==-1)
           {
-            MemberName *rmn=functionNameDict[funcName];
+            MemberName *rmn=Doxygen::functionNameDict[funcName];
             if (rmn)
             {
               MemberDef *rmd=rmn->first();
@@ -3691,7 +3649,7 @@ static void findMember(Entry *root,QCString funcDecl,QCString related,bool overl
           {
             md->setBodySegment(root->bodyLine,root->endBodyLine);
             bool ambig;
-            FileDef *fd=findFileDef(inputNameDict,root->fileName,ambig);
+            FileDef *fd=findFileDef(Doxygen::inputNameDict,root->fileName,ambig);
             md->setBodyDef(fd);
           }
 
@@ -3715,8 +3673,8 @@ static void findMember(Entry *root,QCString funcDecl,QCString related,bool overl
           if (newMemberName)
           {
             //printf("Adding memberName=%s\n",mn->memberName());
-            memberNameList.append(mn);
-            memberNameDict.insert(funcName,mn);
+            Doxygen::memberNameList.append(mn);
+            Doxygen::memberNameDict.insert(funcName,mn);
           }
         }
       }
@@ -3896,22 +3854,22 @@ static void findEnums(Entry *root)
     {
       //printf("Enum `%s'::`%s'\n",cd->name(),name.data());
       fd=0;
-      mnd=&memberNameDict;
-      mnl=&memberNameList;
+      mnd=&Doxygen::memberNameDict;
+      mnl=&Doxygen::memberNameList;
       isGlobal=FALSE;
     }
     else if (nd && !nd->name().isEmpty() && nd->name().at(0)!='@') // found enum inside namespace
     {
-      mnd=&functionNameDict;
-      mnl=&functionNameList;
+      mnd=&Doxygen::functionNameDict;
+      mnl=&Doxygen::functionNameList;
       isGlobal=TRUE;
     }
     else // found a global enum
     {
       bool ambig;
-      fd=findFileDef(inputNameDict,root->fileName,ambig);
-      mnd=&functionNameDict;
-      mnl=&functionNameList;
+      fd=findFileDef(Doxygen::inputNameDict,root->fileName,ambig);
+      mnd=&Doxygen::functionNameDict;
+      mnl=&Doxygen::functionNameList;
       isGlobal=TRUE;
     }
     if (!name.isEmpty())
@@ -3931,7 +3889,7 @@ static void findEnums(Entry *root)
       //md->setDefLine(root->startLine);
       md->setBodySegment(root->bodyLine,root->endBodyLine);
       bool ambig;
-      md->setBodyDef(findFileDef(inputNameDict,root->fileName,ambig));
+      md->setBodyDef(findFileDef(Doxygen::inputNameDict,root->fileName,ambig));
       //printf("Enum %s definition at line %d of %s: protection=%d\n",
       //    root->name.data(),root->bodyLine,root->fileName.data(),root->protection);
       md->addSectionsToDefinition(root->anchors);
@@ -3961,7 +3919,7 @@ static void findEnums(Entry *root)
         {
           bool ambig;
           QCString filePathName = root->parent->fileName;
-          fd=findFileDef(inputNameDict,filePathName,ambig);
+          fd=findFileDef(Doxygen::inputNameDict,filePathName,ambig);
         }
         if (fd) 
         {
@@ -4098,7 +4056,7 @@ static void findEnumDocumentation(Entry *root)
       {
         //printf("Enum: scope=`%s' name=`%s'\n",cd->name(),name.data());
         QCString className=cd->name().copy();
-        MemberName *mn=memberNameDict[name];
+        MemberName *mn=Doxygen::memberNameDict[name];
         if (mn)
         {
           MemberNameIterator mni(*mn);
@@ -4139,7 +4097,7 @@ static void findEnumDocumentation(Entry *root)
       else // enum outside class 
       {
         MemberDef  *md;
-        MemberName *mn=functionNameDict[name];
+        MemberName *mn=Doxygen::functionNameDict[name];
         if (mn && (md=mn->getFirst()))
         {
           md->setDocumentation(root->doc);
@@ -4205,8 +4163,8 @@ static void findDEV(const MemberNameList &mnl)
 // values.
 static void findDocumentedEnumValues()
 {
-  findDEV(memberNameList);
-  findDEV(functionNameList); 
+  findDEV(Doxygen::memberNameList);
+  findDEV(Doxygen::functionNameList); 
 }
 
 
@@ -4217,7 +4175,7 @@ static void findDocumentedEnumValues()
 
 static void computeMemberRelations()
 {
-  MemberNameListIterator mnli(memberNameList);
+  MemberNameListIterator mnli(Doxygen::memberNameList);
   MemberName *mn;
   for ( ; (mn=mnli.current()) ; ++mnli ) // for each member name
   {
@@ -4270,7 +4228,7 @@ static void computeMemberRelations()
 static void computeClassImplUsageRelations()
 {
   ClassDef *cd;
-  ClassListIterator cli(classList);
+  ClassListIterator cli(Doxygen::classList);
   for (;(cd=cli.current());++cli)
   {
     cd->determineImplUsageRelation();
@@ -4285,7 +4243,7 @@ static void buildCompleteMemberLists()
 {
   ClassDef *cd;
   // merge the member list of base classes into the inherited classes.
-  ClassListIterator cli(classList);
+  ClassListIterator cli(Doxygen::classList);
   for (cli.toFirst();(cd=cli.current());++cli)
   {
     if (!cd->isReference() && // not an external class
@@ -4308,9 +4266,9 @@ static void generateFileSources()
 {
   if (documentedHtmlFiles==0) return;
   
-  if (inputNameList.count()>0)
+  if (Doxygen::inputNameList.count()>0)
   {
-    FileNameListIterator fnli(inputNameList); 
+    FileNameListIterator fnli(Doxygen::inputNameList); 
     FileName *fn;
     for (;(fn=fnli.current());++fnli)
     {
@@ -4334,9 +4292,9 @@ static void generateFileDocs()
 {
   if (documentedHtmlFiles==0) return;
   
-  if (inputNameList.count()>0)
+  if (Doxygen::inputNameList.count()>0)
   {
-    FileNameListIterator fnli(inputNameList);
+    FileNameListIterator fnli(Doxygen::inputNameList);
     FileName *fn;
     for (fnli.toFirst();(fn=fnli.current());++fnli)
     {
@@ -4361,7 +4319,7 @@ static void generateFileDocs()
 static void addSourceReferences()
 {
   // add source references for class definitions
-  ClassListIterator cli(classList);
+  ClassListIterator cli(Doxygen::classList);
   ClassDef *cd=0;
   for (cli.toFirst();(cd=cli.current());++cli)
   {
@@ -4372,7 +4330,7 @@ static void addSourceReferences()
     }
   }
   // add source references for namespace definitions
-  NamespaceListIterator nli(namespaceList);
+  NamespaceListIterator nli(Doxygen::namespaceList);
   NamespaceDef *nd=0;
   for (nli.toFirst();(nd=nli.current());++nli)
   {
@@ -4384,7 +4342,7 @@ static void addSourceReferences()
   }
   
   // add source references for member names
-  MemberNameListIterator mnli(memberNameList);
+  MemberNameListIterator mnli(Doxygen::memberNameList);
   MemberName *mn=0;
   for (mnli.toFirst();(mn=mnli.current());++mnli)
   {
@@ -4404,7 +4362,7 @@ static void addSourceReferences()
       }
     }
   }
-  MemberNameListIterator fnli(functionNameList);
+  MemberNameListIterator fnli(Doxygen::functionNameList);
   for (fnli.toFirst();(mn=fnli.current());++fnli)
   {
     MemberNameIterator mni(*mn);
@@ -4456,12 +4414,12 @@ static void generateClassDocs()
   msg("Generating member index...\n");
   writeMemberIndex(*outputList);
 
-  if (exampleSDict->count()>0)
+  if (Doxygen::exampleSDict->count()>0)
   {
     msg("Generating example index...\n");
   }
 
-  ClassListIterator cli(classList);
+  ClassListIterator cli(Doxygen::classList);
   for ( ; cli.current() ; ++cli )
   {
     ClassDef *cd=cli.current();
@@ -4480,7 +4438,7 @@ static void generateClassDocs()
 
 static void inheritDocumentation()
 {
-  MemberNameListIterator mnli(memberNameList);
+  MemberNameListIterator mnli(Doxygen::memberNameList);
   MemberName *mn;
   //int count=0;
   for (;(mn=mnli.current());++mnli)
@@ -4514,14 +4472,14 @@ static void inheritDocumentation()
 static void addMembersToMemberGroup()
 {
   // for each class
-  ClassListIterator cli(classList);
+  ClassListIterator cli(Doxygen::classList);
   ClassDef *cd;
   for ( ; (cd=cli.current()) ; ++cli )
   {
     cd->addMembersToMemberGroup();
   }
   // for each file
-  FileName *fn=inputNameList.first();
+  FileName *fn=Doxygen::inputNameList.first();
   while (fn)
   {
     FileDef *fd=fn->first();
@@ -4530,21 +4488,21 @@ static void addMembersToMemberGroup()
       fd->addMembersToMemberGroup();
       fd=fn->next();
     }
-    fn=inputNameList.next();
+    fn=Doxygen::inputNameList.next();
   }
   // for each namespace
-  NamespaceDef *nd=namespaceList.first();
+  NamespaceDef *nd=Doxygen::namespaceList.first();
   while (nd)
   {
     nd->addMembersToMemberGroup();
-    nd=namespaceList.next();
+    nd=Doxygen::namespaceList.next();
   }
   // for each group
-  GroupDef *gd=groupList.first();
+  GroupDef *gd=Doxygen::groupList.first();
   while (gd)
   {
     gd->addMembersToMemberGroup();
-    gd=groupList.next();
+    gd=Doxygen::groupList.next();
   }
 }
 
@@ -4553,14 +4511,14 @@ static void addMembersToMemberGroup()
 static void distributeMemberGroupDocumentation()
 {
   // for each class
-  ClassListIterator cli(classList);
+  ClassListIterator cli(Doxygen::classList);
   ClassDef *cd;
   for ( ; (cd=cli.current()) ; ++cli )
   {
     cd->distributeMemberGroupDocumentation();
   }
   // for each file
-  FileName *fn=inputNameList.first();
+  FileName *fn=Doxygen::inputNameList.first();
   while (fn)
   {
     FileDef *fd=fn->first();
@@ -4569,21 +4527,21 @@ static void distributeMemberGroupDocumentation()
       fd->distributeMemberGroupDocumentation();
       fd=fn->next();
     }
-    fn=inputNameList.next();
+    fn=Doxygen::inputNameList.next();
   }
   // for each namespace
-  NamespaceDef *nd=namespaceList.first();
+  NamespaceDef *nd=Doxygen::namespaceList.first();
   while (nd)
   {
     nd->distributeMemberGroupDocumentation();
-    nd=namespaceList.next();
+    nd=Doxygen::namespaceList.next();
   }
   // for each group
-  GroupDef *gd=groupList.first();
+  GroupDef *gd=Doxygen::groupList.first();
   while (gd)
   {
     gd->distributeMemberGroupDocumentation();
-    gd=groupList.next();
+    gd=Doxygen::groupList.next();
   }
 }
 
@@ -4607,11 +4565,11 @@ static void findDefineDocumentation(Entry *root)
       md->setReference(root->tagInfo->tagName);
       bool ambig;
       QCString filePathName = root->parent->fileName;
-      FileDef *fd=findFileDef(inputNameDict,filePathName,ambig);
+      FileDef *fd=findFileDef(Doxygen::inputNameDict,filePathName,ambig);
       //printf("Searching for `%s' fd=%p\n",filePathName.data(),fd);
       md->setFileDef(fd);
       MemberName *mn;
-      if ((mn=functionNameDict[root->name]))
+      if ((mn=Doxygen::functionNameDict[root->name]))
       {
         mn->append(md);
       }
@@ -4619,11 +4577,11 @@ static void findDefineDocumentation(Entry *root)
       {
         mn = new MemberName(root->name);
         mn->append(md);
-        functionNameDict.insert(root->name,mn);
-        functionNameList.append(mn);
+        Doxygen::functionNameDict.insert(root->name,mn);
+        Doxygen::functionNameList.append(mn);
       }
     }
-    MemberName *mn=functionNameDict[root->name];
+    MemberName *mn=Doxygen::functionNameDict[root->name];
     if (mn)
     {
       int count=0;
@@ -4646,7 +4604,7 @@ static void findDefineDocumentation(Entry *root)
               md->setBriefDescription(root->brief);
             md->setBodySegment(root->bodyLine,root->endBodyLine);
             bool ambig;
-            md->setBodyDef(findFileDef(inputNameDict,root->fileName,ambig));
+            md->setBodyDef(findFileDef(Doxygen::inputNameDict,root->fileName,ambig));
             md->addSectionsToDefinition(root->anchors);
             md->setMaxInitLines(root->initLines);
             if (root->mGrpId!=-1) md->setMemberGroupId(root->mGrpId);
@@ -4679,7 +4637,7 @@ static void findDefineDocumentation(Entry *root)
                 md->setBriefDescription(root->brief);
               md->setBodySegment(root->bodyLine,root->endBodyLine);
               bool ambig;
-              md->setBodyDef(findFileDef(inputNameDict,root->fileName,ambig));
+              md->setBodyDef(findFileDef(Doxygen::inputNameDict,root->fileName,ambig));
               md->addSectionsToDefinition(root->anchors);
               if (root->mGrpId!=-1) md->setMemberGroupId(root->mGrpId);
               addMemberToGroups(root,md);
@@ -4739,19 +4697,21 @@ static void findMainPage(Entry *root)
 {
   if (root->section == Entry::MAINPAGEDOC_SEC)
   {
-    if (mainPage==0)
+    if (Doxygen::mainPage==0)
     {
       //printf("Found main page! \n======\n%s\n=======\n",root->doc.data());
       QCString title=root->args.stripWhiteSpace();
-      mainPage = new PageInfo(root->fileName,root->startLine,
+      Doxygen::mainPage = new PageInfo(root->fileName,root->startLine,
                               "index", root->doc,title);
-      setFileNameForSections(root->anchors,"index");
+      //setFileNameForSections(root->anchors,"index",Doxygen::mainPage);
+      Doxygen::mainPage->fileName = "index";
+      Doxygen::mainPage->addSections(root->anchors);
           
       // a page name is a label as well!
       SectionInfo *si=new SectionInfo(
-          mainPage->name,mainPage->title,SectionInfo::Section);
+          Doxygen::mainPage->name,Doxygen::mainPage->title,SectionInfo::Section);
       si->fileName="index";
-      sectionDict.insert("index",si);
+      Doxygen::sectionDict.insert("index",si);
     }
     else
     {
@@ -4778,15 +4738,15 @@ static void buildPackageList(Entry *root)
   if (root->section == Entry::PACKAGE_SEC)
   {
     PackageDef *pd=0;
-    if (!root->name.isEmpty() && (pd=packageDict.find(root->name))==0)
+    if (!root->name.isEmpty() && (pd=Doxygen::packageDict.find(root->name))==0)
     {
       pd = new PackageDef(root->fileName,root->startLine,root->name);
-      packageDict.inSort(root->name,pd);
+      Doxygen::packageDict.inSort(root->name,pd);
     } 
     if (pd)
     {
       bool ambig;
-      FileDef *fd=findFileDef(inputNameDict,root->fileName,ambig);
+      FileDef *fd=findFileDef(Doxygen::inputNameDict,root->fileName,ambig);
       if (fd)
       {
         fd->setPackageDef(pd);
@@ -4807,7 +4767,7 @@ static void buildPackageList(Entry *root)
 static void addClassesToPackages()
 {
   ClassDef *cd;
-  ClassListIterator cli(classList);
+  ClassListIterator cli(Doxygen::classList);
   for (;(cd=cli.current());++cli)
   {
     PackageDef *pd = cd->packageDef();
@@ -4819,7 +4779,7 @@ static void addClassesToPackages()
 
 static void resolveUserReferences()
 {
-  QDictIterator<SectionInfo> sdi(sectionDict);
+  QDictIterator<SectionInfo> sdi(Doxygen::sectionDict);
   SectionInfo *si;
   for (;(si=sdi.current());++sdi)
   {
@@ -4846,29 +4806,11 @@ static void resolveUserReferences()
 //----------------------------------------------------------------------------
 // generate all separate documentation pages
 
-//void generateMainPageDocs()
-//{
-//  if (mainPage)
-//  {
-//    msg("Generating docs for the main page\n",mainPage->name.data());
-//    outputList->disable(OutputGenerator::Man);
-//   startFile(*outputList,mainPage->name,mainPage->title);
-//    SectionInfo *si=0;
-//    if (!mainPage->title.isEmpty() && !mainPage->name.isEmpty() &&
-//        (si=sectionDict[mainPage->name])!=0)
-//    {
-//      outputList->writeSection(si->label,si->title,FALSE);
-//    }
-//    parseDoc(*outputList,0,0,mainPage->doc);
-//    endFile(*outputList);
-//    outputList->enable(OutputGenerator::Man);
-//  }
-//}
 
 static void generatePageDocs()
 {
   if (documentedPages==0) return;
-  PageSDictIterator pdi(*pageSDict);
+  PageSDictIterator pdi(*Doxygen::pageSDict);
   PageInfo *pi=0;
   for (pdi.toFirst();(pi=pdi.current());++pdi)
   {
@@ -4885,7 +4827,7 @@ static void generatePageDocs()
       startFile(*outputList,pageName,pi->title);
       SectionInfo *si=0;
       if (!pi->title.isEmpty() && !pi->name.isEmpty() &&
-          (si=sectionDict[pi->name])!=0)
+          (si=Doxygen::sectionDict.find(pi->name))!=0)
       {
         outputList->startSection(si->label,si->title,FALSE);
         outputList->docify(si->title);
@@ -4899,11 +4841,12 @@ static void generatePageDocs()
 
       if (!Config::genTagFile.isEmpty())
       {
-        tagFile << "  <compound kind=\"page\">" << endl;
-        tagFile << "    <name>" << pi->name << "</name>" << endl;
-        tagFile << "    <title>" << pi->title << "</title>" << endl;
-        tagFile << "    <filename>" << pi->name << "</filename>" << endl;
-        tagFile << "  </compound>" << endl;
+        Doxygen::tagFile << "  <compound kind=\"page\">" << endl;
+        Doxygen::tagFile << "    <name>" << pi->name << "</name>" << endl;
+        Doxygen::tagFile << "    <title>" << pi->title << "</title>" << endl;
+        Doxygen::tagFile << "    <filename>" << pi->name << "</filename>" << endl;
+        pi->writeDocAnchorsToTagFile();
+        Doxygen::tagFile << "  </compound>" << endl;
       }
     }
   }
@@ -4918,7 +4861,7 @@ static void buildExampleList(Entry *root)
   {
     if (!root->name.isEmpty()) 
     {
-      if (exampleSDict->find(root->name))
+      if (Doxygen::exampleSDict->find(root->name))
       {
         warn(root->fileName,root->startLine,
              "Warning: Example %s was already documented. Ignoring "
@@ -4930,10 +4873,14 @@ static void buildExampleList(Entry *root)
       {
         PageInfo *pi=new PageInfo(root->fileName,root->startLine,
                                   root->name,root->doc,root->args);
-        setFileNameForSections(root->anchors,
-                               convertFileName(pi->name)+"-example"
-                              );
-        exampleSDict->inSort(root->name,pi);
+        //setFileNameForSections(root->anchors,
+        //                       convertFileName(pi->name)+"-example",
+        //                       pi
+        //                      );
+        pi->fileName = convertFileName(pi->name)+"-example";
+        pi->addSections(root->anchors);
+        
+        Doxygen::exampleSDict->inSort(root->name,pi);
         addExampleToGroups(root,pi);
       }
     }
@@ -4959,7 +4906,7 @@ static void buildExampleList(Entry *root)
 static void generateExampleDocs()
 {
   outputList->disable(OutputGenerator::Man);
-  PageSDictIterator pdi(*exampleSDict);
+  PageSDictIterator pdi(*Doxygen::exampleSDict);
   PageInfo *pi=0;
   for (pdi.toFirst();(pi=pdi.current());++pdi)
   {
@@ -4980,7 +4927,7 @@ static void generateExampleDocs()
 
 static void generateGroupDocs()
 {
-  GroupListIterator gli(groupList);
+  GroupListIterator gli(Doxygen::groupList);
   GroupDef *gd;
   for (;(gd=gli.current());++gli)
   {
@@ -4997,9 +4944,9 @@ static void generatePackageDocs()
 {
   writePackageIndex(*outputList);
   
-  if (packageDict.count()>0)
+  if (Doxygen::packageDict.count()>0)
   {
-    PackageSDict::Iterator pdi(packageDict);
+    PackageSDict::Iterator pdi(Doxygen::packageDict);
     PackageDef *pd;
     for (pdi.toFirst();(pd=pdi.current());++pdi)
     {
@@ -5015,7 +4962,7 @@ static void generateNamespaceDocs()
 {
   writeNamespaceIndex(*outputList);
   
-  NamespaceListIterator nli(namespaceList);
+  NamespaceListIterator nli(Doxygen::namespaceList);
   NamespaceDef *nd;
   for (;(nd=nli.current());++nli)
   {
@@ -5243,7 +5190,7 @@ static void readTagFile(Entry *root,const char *tl)
     fileName = tagLine.left(eqPos).stripWhiteSpace();
     destName = tagLine.right(tagLine.length()-eqPos-1).stripWhiteSpace();
     QFileInfo fi(fileName);
-    tagDestinationDict.insert(fi.fileName(),new QCString(destName));
+    Doxygen::tagDestinationDict.insert(fi.fileName(),new QCString(destName));
     //printf("insert tagDestination %s->%s\n",fi.fileName().data(),destName.data());
   }
   else
@@ -5627,9 +5574,9 @@ static void readFormulaRepository()
         QCString formName = line.left(se);
         QCString formText = line.right(line.length()-se-1); 
         Formula *f=new Formula(formText);
-        formulaList.append(f);
-        formulaDict.insert(formText,f);
-        formulaNameDict.insert(formName,f);
+        Doxygen::formulaList.append(f);
+        Doxygen::formulaDict.insert(formText,f);
+        Doxygen::formulaNameDict.insert(formName,f);
       }
     }
   }
@@ -5676,19 +5623,21 @@ static const char *getArg(int argc,char **argv,int &optind)
 
 //----------------------------------------------------------------------------
 
-int main(int argc,char **argv)
+void initDoxygen()
 {
 #if QT_VERSION >= 200
   setlocale(LC_ALL,"");
 #endif
   
   initPreprocessor();
+}
 
+void readConfiguration(int argc, char **argv)
+{
   /**************************************************************************
    *             Handle arguments                                           *
    **************************************************************************/
 
-  char *s;
   int optind=1;
   const char *configName=0;
   const char *debugLabel;
@@ -5894,19 +5843,22 @@ int main(int argc,char **argv)
   
   substituteEnvironmentVars();
   checkConfig();
+}
 
-  inputNameDict = new FileNameDict(1009);
-  includeNameDict = new FileNameDict(1009);
-  exampleNameDict = new FileNameDict(1009);
-  imageNameDict = new FileNameDict(257);
+void parseInput()
+{
+  Doxygen::inputNameDict = new FileNameDict(1009);
+  Doxygen::includeNameDict = new FileNameDict(1009);
+  Doxygen::exampleNameDict = new FileNameDict(1009);
+  Doxygen::imageNameDict = new FileNameDict(257);
 
   if (!Config::docURL.isEmpty())
   {
-    tagDestinationDict.insert("_doc",new QCString(Config::docURL));
+    Doxygen::tagDestinationDict.insert("_doc",new QCString(Config::docURL));
   }
   if (!Config::cgiURL.isEmpty())
   {
-    tagDestinationDict.insert("_cgi",new QCString(Config::cgiURL+"/"+Config::cgiName));
+    Doxygen::tagDestinationDict.insert("_cgi",new QCString(Config::cgiURL+"/"+Config::cgiName));
   }
 
   /**************************************************************************
@@ -5924,46 +5876,17 @@ int main(int argc,char **argv)
   compoundKeywordDict.insert("exception",(void *)8);
   
   /**************************************************************************
-   *            Initialize output generators                                *
-   **************************************************************************/
-
-  outputList = new OutputList(TRUE);
-  if (Config::generateHtml)  
-  {
-    outputList->add(new HtmlGenerator);
-    HtmlGenerator::init();
-    if (Config::htmlHelpFlag) HtmlHelp::getInstance()->initialize();
-    if (Config::ftvHelpFlag) FTVHelp::getInstance()->initialize();
-    copyStyleSheet();
-  }
-  if (Config::generateLatex) 
-  {
-    outputList->add(new LatexGenerator);
-    LatexGenerator::init();
-  }
-  if (Config::generateMan)
-  {
-    outputList->add(new ManGenerator);
-    ManGenerator::init();
-  }
-  if (Config::generateRTF)
-  {
-    outputList->add(new RTFGenerator);
-    RTFGenerator::init();
-  }
-  
-  /**************************************************************************
    *             Read and preprocess input                                  *
    **************************************************************************/
 
   // gather names of all files in the include path
   msg("Searching for include files...\n");
-  s=Config::includePath.first();
+  char *s=Config::includePath.first();
   while (s)
   {
     QStrList *pl = &Config::includeFilePatternList;
     if (pl->count()==0) pl = &Config::filePatternList;
-    readFileOrDirectory(s,0,includeNameDict,0,pl,
+    readFileOrDirectory(s,0,Doxygen::includeNameDict,0,pl,
                         &Config::excludePatternList,0,0);
     s=Config::includePath.next(); 
   }
@@ -5972,7 +5895,7 @@ int main(int argc,char **argv)
   s=Config::examplePath.first();
   while (s)
   {
-    readFileOrDirectory(s,0,exampleNameDict,0,&Config::examplePatternList,
+    readFileOrDirectory(s,0,Doxygen::exampleNameDict,0,&Config::examplePatternList,
                         0,0,0);
     s=Config::examplePath.next(); 
   }
@@ -5981,7 +5904,7 @@ int main(int argc,char **argv)
   s=Config::imagePath.first();
   while (s)
   {
-    readFileOrDirectory(s,0,imageNameDict,0,0,
+    readFileOrDirectory(s,0,Doxygen::imageNameDict,0,0,
                         0,0,0);
     s=Config::imagePath.next(); 
   }
@@ -6000,8 +5923,8 @@ int main(int argc,char **argv)
   s=Config::inputSources.first();
   while (s)
   {
-    inputSize+=readFileOrDirectory(s,&inputNameList,
-                                   inputNameDict,&excludeNameDict,
+    inputSize+=readFileOrDirectory(s,&Doxygen::inputNameList,
+        Doxygen::inputNameDict,&excludeNameDict,
                                    &Config::filePatternList,
                                    &Config::excludePatternList,
                                    &inputFiles,0);
@@ -6012,19 +5935,19 @@ int main(int argc,char **argv)
   s=Config::expandAsDefinedList.first();
   while (s)
   {
-    if (expandAsDefinedDict[s]==0)
+    if (Doxygen::expandAsDefinedDict[s]==0)
     {
-      expandAsDefinedDict.insert(s,(void *)666);
+      Doxygen::expandAsDefinedDict.insert(s,(void *)666);
     }
     s=Config::expandAsDefinedList.next();
   }
 
   // add aliases to a dictionary
-  aliasDict.setAutoDelete(TRUE);
+  Doxygen::aliasDict.setAutoDelete(TRUE);
   s=Config::aliasList.first();
   while (s)
   {
-    if (aliasDict[s]==0)
+    if (Doxygen::aliasDict[s]==0)
     {
       QCString alias=s;
       int i=alias.find('=');
@@ -6058,10 +5981,10 @@ int main(int argc,char **argv)
         //printf("Alias: found name=`%s' value=`%s'\n",name.data(),value.data()); 
         if (!name.isEmpty())
         {
-          QCString *dn=aliasDict[name];
+          QCString *dn=Doxygen::aliasDict[name];
           if (dn==0) // insert new alias
           {
-            aliasDict.insert(name,new QCString(value));
+            Doxygen::aliasDict.insert(name,new QCString(value));
           }
           else // overwrite previous alias
           {
@@ -6113,20 +6036,6 @@ int main(int argc,char **argv)
     s=Config::tagFileList.next();
   }
   
-  QFile *tag=0;
-  if (!Config::genTagFile.isEmpty())
-  {
-    tag=new QFile(Config::genTagFile);
-    if (!tag->open(IO_WriteOnly))
-    {
-      err("Error: cannot open tag file %s for writing\n",
-          Config::genTagFile.data()
-         );
-      exit(1);
-    }
-    tagFile.setDevice(tag);
-    tagFile << "<tagfile>" << endl;
-  }
   
   /**************************************************************************
    *             Gather information                                         * 
@@ -6145,9 +6054,6 @@ int main(int argc,char **argv)
   buildNamespaceList(root);
   findUsingDirectives(root);
   
-  //msg("Computing group relations...\n");
-  //computeGroupRelations(root); 
-  
   msg("Building file list...\n");
   buildFileList(root);
   
@@ -6192,8 +6098,8 @@ int main(int argc,char **argv)
   findMainPage(root);
 
   msg("Sorting member lists...\n");
-  memberNameList.sort();
-  functionNameList.sort();
+  Doxygen::memberNameList.sort();
+  Doxygen::functionNameList.sort();
   
   msg("Freeing entry tree\n");
   delete root;
@@ -6228,33 +6134,161 @@ int main(int argc,char **argv)
   msg("Building full member lists recursively...\n");
   buildCompleteMemberLists();
   
-  //msg("Computing class interface usage relations...\n");
-  //computeClassIntfUsageRelations();
-
-  //msg("Determining member group documentation...\n");
-  //computeMemberGroupDocumentation();
-
-  //unrelatedFunctionsUsed=hasUnrelatedFunctions();
-
   if (Config::inheritDocsFlag)
   {
     msg("Inheriting documentation...\n");
     inheritDocumentation();
   }
 
-  //msg("Computing member groups...\n");
-  //computeMemberGroups();
-
   msg("Adding source references...\n");
   addSourceReferences();
 
   msg("Adding todo/test references...\n");
   addTodoTestReferences();
   
+}
+
+void generateOutput()
+{
+  /**************************************************************************
+   *            Check/create output directorties                            *
+   **************************************************************************/
+  if (Config::outputDir.isEmpty()) 
+    Config::outputDir=QDir::currentDirPath();
+  else
+  {
+    QDir dir(Config::outputDir);
+    if (!dir.exists())
+    {
+      dir.setPath(QDir::currentDirPath());
+      if (!dir.mkdir(Config::outputDir))
+      {
+        err("Error: tag OUTPUT_DIRECTORY: Output directory `%s' does not "
+	    "exist and cannot be created\n",Config::outputDir.data());
+        exit(1);
+      }
+      else if (!Config::quietFlag)
+      {
+	err("Notice: Output directory `%s' does not exist. "
+	    "I have created it for you.\n", Config::outputDir.data());
+      }
+      dir.cd(Config::outputDir);
+    }
+    Config::outputDir=dir.absPath();
+  }
+
+  if (Config::htmlOutputDir.isEmpty() && Config::generateHtml)
+  {
+    Config::htmlOutputDir=Config::outputDir+"/html";
+  }
+  else if (Config::htmlOutputDir && Config::htmlOutputDir[0]!='/')
+  {
+    Config::htmlOutputDir.prepend(Config::outputDir+'/');
+  }
+  QDir htmlDir(Config::htmlOutputDir);
+  if (Config::generateHtml && !htmlDir.exists() && 
+      !htmlDir.mkdir(Config::htmlOutputDir))
+  {
+    err("Could not create output directory %s\n",Config::htmlOutputDir.data());
+    exit(1);
+  }
+  
+  if (Config::latexOutputDir.isEmpty() && Config::generateLatex)
+  {
+    Config::latexOutputDir=Config::outputDir+"/latex";
+  }
+  else if (Config::latexOutputDir && Config::latexOutputDir[0]!='/')
+  {
+    Config::latexOutputDir.prepend(Config::outputDir+'/');
+  }
+  QDir latexDir(Config::latexOutputDir);
+  if (Config::generateLatex && !latexDir.exists() && 
+      !latexDir.mkdir(Config::latexOutputDir))
+  {
+    err("Could not create output directory %s\n",Config::latexOutputDir.data());
+    exit(1);
+  }
+  
+  if (Config::rtfOutputDir.isEmpty() && Config::generateRTF)
+  {
+    Config::rtfOutputDir=Config::outputDir+"/rtf";
+  }
+  else if (Config::rtfOutputDir && Config::rtfOutputDir[0]!='/')
+  {
+    Config::rtfOutputDir.prepend(Config::outputDir+'/');
+  }
+  QDir rtfDir(Config::rtfOutputDir);
+  if (Config::generateRTF && !rtfDir.exists() && 
+      !rtfDir.mkdir(Config::rtfOutputDir))
+  {
+    err("Could not create output directory %s\n",Config::rtfOutputDir.data());
+    exit(1);
+  }
+
+  if (Config::manOutputDir.isEmpty() && Config::generateMan)
+  {
+    Config::manOutputDir=Config::outputDir+"/man";
+  }
+  else if (Config::manOutputDir && Config::manOutputDir[0]!='/')
+  {
+    Config::manOutputDir.prepend(Config::outputDir+'/');
+  }
+  QDir manDir(Config::manOutputDir);
+  if (Config::generateMan && !manDir.exists() && 
+      !manDir.mkdir(Config::manOutputDir))
+  {
+    err("Could not create output directory %s\n",Config::manOutputDir.data());
+    exit(1);
+  }
+
+  /**************************************************************************
+   *            Initialize output generators                                *
+   **************************************************************************/
+
+  outputList = new OutputList(TRUE);
+  if (Config::generateHtml)  
+  {
+    outputList->add(new HtmlGenerator);
+    HtmlGenerator::init();
+    if (Config::htmlHelpFlag) HtmlHelp::getInstance()->initialize();
+    if (Config::ftvHelpFlag) FTVHelp::getInstance()->initialize();
+    copyStyleSheet();
+  }
+  if (Config::generateLatex) 
+  {
+    outputList->add(new LatexGenerator);
+    LatexGenerator::init();
+  }
+  if (Config::generateMan)
+  {
+    outputList->add(new ManGenerator);
+    ManGenerator::init();
+  }
+  if (Config::generateRTF)
+  {
+    outputList->add(new RTFGenerator);
+    RTFGenerator::init();
+  }
+  
   /**************************************************************************
    *                        Generate documentation                          *
    **************************************************************************/
 
+  QFile *tag=0;
+  if (!Config::genTagFile.isEmpty())
+  {
+    tag=new QFile(Config::genTagFile);
+    if (!tag->open(IO_WriteOnly))
+    {
+      err("Error: cannot open tag file %s for writing\n",
+          Config::genTagFile.data()
+         );
+      exit(1);
+    }
+    Doxygen::tagFile.setDevice(tag);
+    Doxygen::tagFile << "<tagfile>" << endl;
+  }
+
   if (Config::generateHtml) writeDoxFont(Config::htmlOutputDir);
   if (Config::generateRTF)  writeDoxFont(Config::rtfOutputDir);
 
@@ -6264,21 +6298,12 @@ int main(int argc,char **argv)
   // If the result is 0 we do not generate the lists and omit the 
   // corresponding links in the index.
   msg("Counting data structures...\n");
-  annotatedClasses           = countAnnotatedClasses();
-  hierarchyClasses           = countClassHierarchy();
-  documentedMembers          = countClassMembers();
-  documentedFunctions        = countFileMembers();
-  countFiles(documentedHtmlFiles,documentedFiles);
-  documentedGroups           = countGroups();
-  documentedNamespaces       = countNamespaces();
-  documentedNamespaceMembers = countNamespaceMembers();
-  documentedPages            = countRelatedPages();
-  documentedPackages         = countPackages();
+  countDataStructures();
  
   // compute the shortest possible names of all files
   // without loosing the uniqueness of the file names.
   msg("Generating disk names...\n");
-  inputNameList.generateDiskNames();
+  Doxygen::inputNameList.generateDiskNames();
   
   msg("Resolving user defined references...\n");
   resolveUserReferences();
@@ -6369,16 +6394,16 @@ int main(int argc,char **argv)
     writeGraphicalClassHierarchy(*outputList);
   }
 
-  if (Config::generateXML) 
-  {
-    msg("Generating XML output\n");
-    generateXML();
-  }
+  //if (Config::generateXML) 
+  //{
+  //  msg("Generating XML output\n");
+  //  generateXML();
+  //}
 
-  if (formulaList.count()>0 && Config::generateHtml)
+  if (Doxygen::formulaList.count()>0 && Config::generateHtml)
   {
     msg("Generating bitmaps for formulas in HTML...\n");
-    formulaList.generateBitmaps(Config::htmlOutputDir);
+    Doxygen::formulaList.generateBitmaps(Config::htmlOutputDir);
   }
   
   if (Config::searchEngineFlag || Config::tagFileList.count()>0)
@@ -6399,14 +6424,12 @@ int main(int argc,char **argv)
   }
   if (!Config::genTagFile.isEmpty())
   {
-    tagFile << "</tagfile>" << endl;
+    Doxygen::tagFile << "</tagfile>" << endl;
     delete tag;
   }
 
 
   if (Config::generateHtml) removeDoxFont(Config::htmlOutputDir);
   if (Config::generateRTF)  removeDoxFont(Config::rtfOutputDir);
-
-
-  return 0;
 }
+
diff --git a/src/doxygen.dtd b/src/doxygen.dtd
deleted file mode 100644
index 62727b8..0000000
--- a/src/doxygen.dtd
+++ /dev/null
@@ -1,117 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!-- DTD describing the grammar used in doxygen's XML output -->
-
-<!-- standard character entities -->
-<!ENTITY lt     "&#38;#60;"> 
-<!ENTITY gt     "&#62;"> 
-<!ENTITY amp    "&#38;#38;"> 
-<!ENTITY apos   "&#39;"> 
-<!ENTITY quot   "&#34;"> 
-
-<!-- required attributes for compounds -->
-<!ENTITY % compound-req.att 
-                       'id      ID                           #REQUIRED
-                        type    (group|file|namespace|
-                                 class|struct|union|
-                                 interface|dispinterface|
-                                 valuetype|library)          #REQUIRED'
->
-<!-- required attributes for references -->
-<!ENTITY % ref-req.att   'idref IDREF                        #REQUIRED'
->
-<!-- required attributes for inheritance relations -->
-<!ENTITY % inheritcompref-req.att
-                         '%ref-req.att;
-                          prot (public|protected|private)    #REQUIRED
-                          virt (non-virtual|virtual)         #REQUIRED'
->
-
-<!-- required attributes for member sections -->
-<!ENTITY % sec-req.att  'type   (user
-                                |public-type
-                                |public-func
-                                |public-attrib
-                                |public-slot
-                                |public-static-func
-                                |public-static-attrib
-                                |protected-type
-                                |protected-func
-                                |protected-attrib
-                                |protected-slot
-                                |protected-static-func
-                                |protected-static-attrib
-                                |private-type
-                                |private-func
-                                |private-attrib
-                                |private-slot
-                                |private-static-func
-                                |private-static-attrib
-                                |signal
-                                |friend
-                                |related
-				|define|prototype|typedef|enum|func|var
-	                        |dcop-func
-                                |property
-                                )                            #REQUIRED
-                        '
->
-<!-- required attributes for members -->
-<!ENTITY % mem-req.att  'id     ID                           #REQUIRED'>
-
-<!-- optional attributes for function -->
-<!ENTITY % func-opt.att 'virt   (virtual|pure-virtual)       #IMPLIED'>
-
-<!-- elements -->
-<!ELEMENT doxygen (compoundlist?)>
-<!ELEMENT compoundlist (compounddef)+>
-<!ELEMENT compounddef (compoundname,
-                       basecompoundlist?,  
-                       derivedcompoundlist?, 
-                       sectionlist?        
-                      )
->
-<!ATTLIST compounddef %compound-req.att;>
-<!ELEMENT basecompoundlist (basecompoundref)+>
-<!ELEMENT derivedcompoundlist (derivedcompoundref)+>
-<!ELEMENT compoundref (#PCDATA)>
-<!ATTLIST compoundref %ref-req.att;>
-<!ELEMENT memberref   (#PCDATA)>
-<!ATTLIST memberref   %ref-req.att;>
-<!ELEMENT basecompoundref EMPTY>
-<!ATTLIST basecompoundref %inheritcompref-req.att;>
-<!ELEMENT derivedcompoundref EMPTY>
-<!ATTLIST derivedcompoundref %inheritcompref-req.att;>
-<!ELEMENT sectionlist (sectiondef)+>
-<!ELEMENT sectiondef  (memberlist)>
-<!ATTLIST sectiondef  %sec-req.att;>
-<!ELEMENT memberlist  (functiondef|variabledef|typedef|definedef|enumdef)+>
-<!ELEMENT functiondef (type?,name,paramlist)>
-<!ATTLIST functiondef %mem-req.att; %func-opt.att;>
-<!ELEMENT variabledef (type,name,array?,initializer?)>
-<!ATTLIST variabledef %mem-req.att;>
-<!ELEMENT typedef     (type,name)>
-<!ATTLIST typedef     %mem-req.att;>
-<!ELEMENT definedef   (name,defparamlist?,initializer?)>
-<!ATTLIST definedef   %mem-req.att;>
-<!ELEMENT enumdef     (name,enumvaluelist)>
-<!ATTLIST enumdef     %mem-req.att;>
-<!ELEMENT slotdef     (type,name,paramlist)>
-<!ATTLIST slotdef     %mem-req.att;>
-<!ELEMENT signaldef   (type,name,paramlist)>
-<!ATTLIST signaldef   %mem-req.att;>
-<!ELEMENT paramlist (param)*>
-<!ELEMENT param (attributes?,type,declname?,defname?,array?,defval?)>
-<!ELEMENT defparamlist (defarg)*>
-<!ELEMENT defarg (#PCDATA)>
-<!ELEMENT enumvaluelist (enumvalue)*>
-<!ELEMENT enumvalue (name,initializer?)>
-<!ELEMENT name (#PCDATA)>
-<!ELEMENT compoundname (#PCDATA)>
-<!ELEMENT declname (#PCDATA)>
-<!ELEMENT defname (#PCDATA)>
-<!ELEMENT type (#PCDATA|memberref|compoundref|compounddef)*>
-<!ELEMENT defval (#PCDATA|memberref|compoundref)*>
-<!ELEMENT initializer (#PCDATA|memberref|compoundref)*>
-<!ELEMENT array (#PCDATA)>
-<!ELEMENT attributes (#PCDATA)>
-
diff --git a/src/doxygen.h b/src/doxygen.h
index 00b339c..ed661c4 100644
--- a/src/doxygen.h
+++ b/src/doxygen.h
@@ -38,63 +38,60 @@ class PageSList;
 class PageSDict;
 class PageInfo;
 
-extern PageSDict *exampleSDict;
-extern PageSDict *pageSDict;
-extern PageInfo *mainPage;
-extern FileNameDict *includeNameDict;
-extern FileNameDict *exampleNameDict;
-extern FileNameDict *inputNameDict;
-extern FileNameDict *imageNameDict;
-
 typedef QList<QCString>    StringList;
 typedef QDict<FileDef>     FileDict;
 typedef QDict<QCString>    StringDict;
 typedef QDict<GroupDef>    GroupDict;
 
-extern ClassList classList;
-extern ClassDict classDict;
-extern QStrList tagfileList;
-extern MemberNameList memberNameList;
-extern MemberNameList functionNameList;
-extern MemberNameDict memberNameDict;
-extern MemberNameDict functionNameDict;
-extern FileList fileList;
-extern FileDict fileDict;
-extern ClassDef unrelatedClass; 
-extern QTextStream tagFile;
-extern SectionDict sectionDict;
-extern FileNameList inputNameList;
-extern StringDict typedefDict;
-extern StringDict namespaceAliasDict;
-extern GroupList groupList;
-extern GroupDict groupDict;
-extern NamespaceList namespaceList;
-extern NamespaceDict namespaceDict;
-extern FormulaList formulaList;
-extern FormulaDict formulaDict;
-extern FormulaDict formulaNameDict;
-extern StringDict tagDestinationDict; 
-extern StringDict aliasDict; 
-extern QIntDict<QCString> memberHeaderDict; // dictionary of the member groups heading
-extern QIntDict<QCString> memberDocDict;    // dictionary of the member groups heading
-extern QDict<void> expandAsDefinedDict;
-extern PackageSDict packageDict;
-
-extern int annotatedClasses;
-extern int hierarchyClasses;
-extern int documentedFunctions;
-extern int documentedMembers;
-extern int documentedDefines;
-extern int documentedFiles;
-extern int documentedHtmlFiles;
-extern int documentedGroups;
-extern int documentedNamespaces;
-extern int documentedNamespaceMembers;
-extern int documentedIncludeFiles;
-extern int documentedPages;
-extern int documentedPackages;
 extern QCString spaces;
 
-extern const char * getOverloadDocs();
+/*! \brief This class serves as a namespace for global variables used by doxygen.
+ *
+ *  All fields in this class are public and static, so they can be used directly.
+ */
+class Doxygen
+{
+  public:
+    static ClassList classList;
+    static ClassDict classDict;
+    static PageSDict *exampleSDict;
+    static PageSDict *pageSDict;
+    static PageInfo  *mainPage;
+    static FileNameDict *includeNameDict;
+    static FileNameDict *exampleNameDict;
+    static FileNameDict *inputNameDict;
+    static FileNameDict *imageNameDict;
+    static QStrList tagfileList;
+    static MemberNameList memberNameList;
+    static MemberNameList functionNameList;
+    static MemberNameDict memberNameDict;
+    static MemberNameDict functionNameDict;
+    static FileList fileList;
+    static FileDict fileDict;
+    static ClassDef unrelatedClass; 
+    static QTextStream tagFile;
+    static SectionDict sectionDict;
+    static FileNameList inputNameList;
+    static StringDict typedefDict;
+    static StringDict namespaceAliasDict;
+    static GroupList groupList;
+    static GroupDict groupDict;
+    static NamespaceList namespaceList;
+    static NamespaceDict namespaceDict;
+    static FormulaList formulaList;
+    static FormulaDict formulaDict;
+    static FormulaDict formulaNameDict;
+    static StringDict tagDestinationDict; 
+    static StringDict aliasDict; 
+    static QIntDict<QCString> memberHeaderDict; // dictionary of the member groups heading
+    static QIntDict<QCString> memberDocDict;    // dictionary of the member groups heading
+    static QDict<void> expandAsDefinedDict;
+    static PackageSDict packageDict;
+};
+
+void initDoxygen();
+void readConfiguration(int argc, char **argv);
+void parseInput();
+void generateOutput();
 
 #endif
diff --git a/src/doxygen.pro.in b/src/doxygen.pro.in
index b08a714..4275ce4 100644
--- a/src/doxygen.pro.in
+++ b/src/doxygen.pro.in
@@ -14,40 +14,22 @@
 #
 # TMake project file for doxygen
 
-TEMPLATE     =	doxygen.t
-CONFIG       =	console warn_on $extraopts
-HEADERS      =	doxygen.h scanner.h doc.h classdef.h classlist.h memberdef.h \
-                membername.h index.h memberlist.h definition.h \
-                entry.h logos.h instdox.h message.h code.h \
-                filedef.h util.h cppvalue.h constexp.h \
-		outputgen.h outputlist.h htmlgen.h latexgen.h \
-	        filename.h defargs.h groupdef.h gifenc.h diagram.h image.h \
-		namespacedef.h version.h language.h translator.h \
-		translator_nl.h translator_se.h translator_cz.h translator_fr.h \
-		translator_it.h formula.h debug.h membergroup.h htmlhelp.h \
-                translator_ru.h translator_pl.h dot.h rtfgen.h xml.h xml_dtd.h \
-                reflist.h page.h sortdict.h translator_hu.h translator_kr.h \
-                translator_ro.h translator_si.h translator_cn.h ftvhelp.h \
-                treeview.h tagreader.h packagedef.h
-SOURCES      =	doxygen.cpp scanner.cpp doc.cpp classdef.cpp classlist.cpp \
-                memberdef.cpp membername.cpp index.cpp memberlist.cpp \
-		entry.cpp logos.cpp instdox.cpp message.cpp code.cpp \
-                config.cpp filedef.cpp util.cpp groupdef.cpp \
-                outputgen.cpp outputlist.cpp htmlgen.cpp latexgen.cpp mangen.cpp \
-	        cppvalue.cpp ce_lex.cpp ce_parse.cpp pre.cpp \
-		filename.cpp declinfo.cpp defargs.cpp define.cpp \
-		diagram.cpp gifenc.cpp image.cpp namespacedef.cpp \
-		version.cpp language.cpp definition.cpp formula.cpp debug.cpp \
-		membergroup.cpp htmlhelp.cpp dot.cpp rtfgen.cpp xml.cpp \
-                reflist.cpp ftvhelp.cpp tagreader.cpp packagedef.cpp
-unix:LIBS                  += -L../qtools -lqtools
+TEMPLATE     =	app.t
+CONFIG       =	console warn_on $extraopt
+HEADERS      =	doxygen.h 
+SOURCES      =	main.cpp 
+unix:LIBS                  += -L../lib -ldoxygen -lqtools 
 win32:INCLUDEPATH          += .
-win32-mingw:LIBS           += -L../qtools -lqtools
-win32-msvc:LIBS            += qtools.lib shell32.lib 
-win32-msvc:TMAKE_LFLAGS    += /LIBPATH:..\qtools
-win32-borland:LIBS         += qtools.lib shell32.lib
-win32-borland:TMAKE_LFLAGS += -L..\qtools
+win32-mingw:LIBS           += -L../lib -ldoxygen -lqtools 
+win32-msvc:LIBS            += qtools.lib doxygen.lib shell32.lib 
+win32-msvc:TMAKE_LFLAGS    += /LIBPATH:..\lib
+win32-borland:LIBS         += qtools.lib doxygen.lib shell32.lib
+win32-borland:TMAKE_LFLAGS += -L..\lib
 win32:TMAKE_CXXFLAGS       += -DQT_NODLL
-INCLUDEPATH                += ../qtools
-TARGET                     =  ../bin/doxygen
+INCLUDEPATH                += ../qtools .
+DESTDIR                    =  ../bin
+TARGET                     =  doxygen
+unix:TARGETDEPS            =  ../lib/libdoxygen.a
+win32:TARGETDEPS           =  ..\lib\doxygen.lib
 OBJECTS_DIR                =  ../objects
+
diff --git a/src/doxygen.t b/src/doxygen.t
deleted file mode 100644
index 0608894..0000000
--- a/src/doxygen.t
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# 
-#
-# Copyright (C) 1997-2001 by Dimitri van Heesch.
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation under the terms of the GNU General Public License is hereby 
-# granted. No representations are made about the suitability of this software 
-# for any purpose. It is provided "as is" without express or implied warranty.
-# See the GNU General Public License for more details.
-#
-# Documents produced by Doxygen are derivative works derived from the
-# input used in their production; they are not affected by this license.
-#!
-#! doxygen.t: This is a custom template for building Doxygen
-#!
-#$ IncludeTemplate("app.t");
-
-LEX     =   flex
-YACC    =   bison
-
-#${
-sub GenerateDep {
-    my($obj,$src,$dep) = @_;
-    my(@objv,$srcv,$i,$s,$o,$d,$c);
-    @objv = split(/\s+/,$obj);
-    @srcv = split(/\s+/,$src);
-    for $i ( 0..$#objv ) {
-        $s = $srcv[$i];
-        $o = $objv[$i];
-        next if $s eq "";
-        $text .= $o . ": " . $s;
-	$text .= " ${linebreak}\n\t\t" . $dep if $dep ne "";
-        if ( $moc_output{$s} ne "" ) {
-            $text .= " ${linebreak}\n\t\t" . $moc_output{$s};
-        }
-        $d = &make_depend($s);
-        $text .= " ${linebreak}\n\t\t" . $d if $d ne "";
-	$text .= "\n";
-    }
-    chop $text;
-}
-#$} 
-
-####################
-
-#$ GenerateDep("scanner.cpp","scanner.l");
-	$(LEX) -PscanYY -t scanner.l >scanner.cpp
-
-#$ GenerateDep("code.cpp","code.l");
-	$(LEX) -PcodeYY -t code.l >code.cpp
-
-#$ GenerateDep("pre.cpp","pre.l");
-	$(LEX) -PpreYY -t pre.l >pre.cpp 
-
-#$ GenerateDep("config.cpp","config.l");
-	$(LEX) -PconfigYY -t config.l >config.cpp 
-
-#$ GenerateDep("declinfo.cpp","declinfo.l");
-	$(LEX) -PdeclinfoYY -t declinfo.l >declinfo.cpp
-
-#$ GenerateDep("defargs.cpp","defargs.l");
-	$(LEX) -PdefargsYY -t defargs.l >defargs.cpp
-
-#$ GenerateDep("doc.cpp","doc.l");
-	$(LEX) -PdocYY -t doc.l >doc.cpp
-
-#$ GenerateDep("ce_lex.cpp","constexp.l","ce_parse.h");
-	$(LEX) -PcppExpYY -t constexp.l >ce_lex.cpp 
-
-#$ GenerateDep("ce_parse.cpp","constexp.y");
-	$(YACC) -l -p cppExpYY constexp.y -o ce_parse.cpp 
-
-#$ GenerateDep("ce_parse.h","constexp.y");
-	$(YACC) -l -d -p cppExpYY constexp.y -o ce_parse.c 
-	-rm ce_parse.c	
-
-xml_dtd.h: doxygen.dtd
-	cat doxygen.dtd | sed -e "s/\"/\\\\\"/g" -e "s/^/\"/g" -e "s/$$/\\\\n\"/g" >xml_dtd.h 
-
-treeview.h: treeview.js
-	cat treeview.js | sed -e "s/\\\\/\\\\\\\\/g" -e "s/\"/\\\\\"/g" -e "s/^/\"/g" -e "s/$$/\\\\n\"/g" >treeview.h 
-
diff --git a/src/doxytag.pro.in b/src/doxytag.pro.in
index 58b2e95..0eab64b 100644
--- a/src/doxytag.pro.in
+++ b/src/doxytag.pro.in
@@ -19,13 +19,13 @@ CONFIG       =	console warn_on $extraopts
 HEADERS      =  suffixtree.h searchindex.h logos.h version.h
 SOURCES      =	doxytag.cpp suffixtree.cpp searchindex.cpp \
 		logos.cpp version.cpp 
-unix:LIBS                  += -L../qtools -lqtools
+unix:LIBS                  += -L../lib -lqtools
 win32:INCLUDEPATH          += .
-win32-mingw:LIBS           += -L../qtools -lqtools
+win32-mingw:LIBS           += -L../lib -lqtools
 win32-msvc:LIBS            += qtools.lib shell32.lib 
-win32-msvc:TMAKE_LFLAGS    += /LIBPATH:..\qtools
+win32-msvc:TMAKE_LFLAGS    += /LIBPATH:..\lib
 win32-borland:LIBS         += qtools.lib shell32.lib
-win32-borland:TMAKE_LFLAGS += -L..\qtools
+win32-borland:TMAKE_LFLAGS += -L..\lib
 win32:TMAKE_CXXFLAGS       += -DQT_NODLL
 INCLUDEPATH                += ../qtools
 OBJECTS_DIR                =  ../objects
diff --git a/src/filedef.cpp b/src/filedef.cpp
index 6402df3..f737fb6 100644
--- a/src/filedef.cpp
+++ b/src/filedef.cpp
@@ -30,7 +30,7 @@
 #include "dot.h"
 #include "message.h"
 #include "code.h"
-#include "xml.h"
+//#include "xml.h"
 
 /*! create a new file definition, where \a p is the file path, 
     \a the file name, and \a ref is an HTML anchor name if the
@@ -125,10 +125,10 @@ void FileDef::writeDocumentation(OutputList &ol)
   
   if (!Config::genTagFile.isEmpty()) 
   {
-    tagFile << "  <compound kind=\"file\">" << endl;
-    tagFile << "    <name>" << convertToXML(name()) << "</name>" << endl;
-    tagFile << "    <path>" << convertToXML(getPath()) << "</path>" << endl;
-    tagFile << "    <filename>" << convertToXML(diskname) << ".html</filename>" << endl;
+    Doxygen::tagFile << "  <compound kind=\"file\">" << endl;
+    Doxygen::tagFile << "    <name>" << convertToXML(name()) << "</name>" << endl;
+    Doxygen::tagFile << "    <path>" << convertToXML(getPath()) << "</path>" << endl;
+    Doxygen::tagFile << "    <filename>" << convertToXML(diskname) << ".html</filename>" << endl;
   }
   
   ol.startTextBlock();
@@ -282,7 +282,7 @@ void FileDef::writeDocumentation(OutputList &ol)
           );
           if (!Config::genTagFile.isEmpty()) 
           {
-             tagFile << "    <namespace>" << convertToXML(nd->name()) << "</namespace>" << endl;
+            Doxygen::tagFile << "    <namespace>" << convertToXML(nd->name()) << "</namespace>" << endl;
           }
         }
         else
@@ -436,7 +436,8 @@ void FileDef::writeDocumentation(OutputList &ol)
 
   if (!Config::genTagFile.isEmpty()) 
   {
-    tagFile << "  </compound>" << endl;
+    writeDocAnchorsToTagFile();
+    Doxygen::tagFile << "  </compound>" << endl;
   }
 
   endFile(ol);
@@ -481,8 +482,8 @@ void FileDef::addMemberListToGroup(MemberList *ml,
     int groupId=md->getMemberGroupId();
     if ((md->*func)() && groupId!=-1)
     {
-      QCString *pGrpHeader = memberHeaderDict[groupId];
-      QCString *pDocs      = memberDocDict[groupId];
+      QCString *pGrpHeader = Doxygen::memberHeaderDict[groupId];
+      QCString *pDocs      = Doxygen::memberDocDict[groupId];
       //printf("Member `%s' pGrpHeader=%p\n",md->name().data(),pGrpHeader);
       if (pGrpHeader)
       {
@@ -665,47 +666,6 @@ void FileDef::addIncludedByDependency(FileDef *fd,const char *incName,bool local
   }
 }
 
-void FileDef::generateXMLSection(QTextStream &t,MemberList *ml,const char *type)
-{
-  if (ml->count()>0)
-  {
-    t << "        <sectiondef type=\"" << type << "\">" << endl;
-    t << "          <memberlist>" << endl;
-    MemberListIterator mli(*ml);
-    MemberDef *md;
-    for (mli.toFirst();(md=mli.current());++mli)
-    {
-      md->generateXML(t,this);
-    }
-    t << "          </memberlist>" << endl;
-    t << "        </sectiondef>" << endl;
-  }
-}
-
-void FileDef::generateXML(QTextStream &t)
-{
-  t << "    <compounddef id=\"" 
-    << getOutputFileBase() << "\" type=\"file\">" << endl;
-  t << "      <compoundname>";
-  writeXMLString(t,name());
-  t << "</compoundname>" << endl;
-  int numMembers = defineMembers.count()+protoMembers.count()+
-                   typedefMembers.count()+enumMembers.count()+
-                   funcMembers.count()+varMembers.count();
-  if (numMembers>0)
-  {
-    t << "      <sectionlist>" << endl;
-    generateXMLSection(t,&defineMembers,"define");
-    generateXMLSection(t,&protoMembers,"prototype");
-    generateXMLSection(t,&typedefMembers,"typedef");
-    generateXMLSection(t,&enumMembers,"enum");
-    generateXMLSection(t,&funcMembers,"func");
-    generateXMLSection(t,&varMembers,"var");
-    t << "      </sectionlist>" << endl;
-  }
-  t << "    </compounddef>" << endl;
-}
-
 bool FileDef::generateSourceFile() const 
 { 
   return !isReference() && 
diff --git a/src/filedef.h b/src/filedef.h
index 6d0f71c..1b6395d 100644
--- a/src/filedef.h
+++ b/src/filedef.h
@@ -135,13 +135,9 @@ class FileDef : public Definition
     void addMembersToMemberGroup();
     void distributeMemberGroupDocumentation();
 
-    void generateXML(QTextStream &t);
-    void generateXMLSection(QTextStream &t,MemberList *ml,const char *type);
+    //void generateXML(QTextStream &t);
+    //void generateXMLSection(QTextStream &t,MemberList *ml,const char *type);
 
-  protected:
-    void addMemberListToGroup(MemberList *,bool (MemberDef::*)() const);
-
-  private: 
     MemberList allMemberList;
     MemberList defineMembers;
     MemberList protoMembers;
@@ -149,6 +145,11 @@ class FileDef : public Definition
     MemberList enumMembers;
     MemberList funcMembers;
     MemberList varMembers;
+
+  protected:
+    void addMemberListToGroup(MemberList *,bool (MemberDef::*)() const);
+
+  private: 
     
     ClassList  *classList;
     QDict<IncludeInfo> *includeDict;
diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp
index c9e315d..71a053b 100644
--- a/src/ftvhelp.cpp
+++ b/src/ftvhelp.cpp
@@ -433,7 +433,7 @@ void FTVHelp::addContentsItem(bool isDir,
   if (ref)
   {
     tagName += ":";
-    QCString *s = tagDestinationDict[ref];
+    QCString *s = Doxygen::tagDestinationDict[ref];
     if (s)
     {
       tagDir = *s + "/";
diff --git a/src/groupdef.cpp b/src/groupdef.cpp
index faccc93..4bf262a 100644
--- a/src/groupdef.cpp
+++ b/src/groupdef.cpp
@@ -128,8 +128,8 @@ void GroupDef::addMemberListToGroup(MemberList *ml,
     int groupId=md->getMemberGroupId();
     if ((md->*func)() && groupId!=-1)
     {
-      QCString *pGrpHeader = memberHeaderDict[groupId];
-      QCString *pDocs      = memberDocDict[groupId];
+      QCString *pGrpHeader = Doxygen::memberHeaderDict[groupId];
+      QCString *pDocs      = Doxygen::memberDocDict[groupId];
       if (pGrpHeader)
       {
         MemberGroup *mg = memberGroupDict->find(groupId);
@@ -271,10 +271,10 @@ void GroupDef::writeDocumentation(OutputList &ol)
 
   if (!Config::genTagFile.isEmpty()) 
   {
-    tagFile << "  <compound kind=\"group\">" << endl;
-    tagFile << "    <name>" << convertToXML(name()) << "</name>" << endl;
-    tagFile << "    <title>" << convertToXML(title) << "</title>" << endl;
-    tagFile << "    <filename>" << convertToXML(fileName) << ".html</filename>" << endl;
+    Doxygen::tagFile << "  <compound kind=\"group\">" << endl;
+    Doxygen::tagFile << "    <name>" << convertToXML(name()) << "</name>" << endl;
+    Doxygen::tagFile << "    <title>" << convertToXML(title) << "</title>" << endl;
+    Doxygen::tagFile << "    <filename>" << convertToXML(fileName) << ".html</filename>" << endl;
   }
   
   ol.startMemberSections();
@@ -293,7 +293,7 @@ void GroupDef::writeDocumentation(OutputList &ol)
       ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,fd->name());
       if (!Config::genTagFile.isEmpty()) 
       {
-        tagFile << "    <file>" << convertToXML(fd->name()) << "</file>" << endl;
+        Doxygen::tagFile << "    <file>" << convertToXML(fd->name()) << "</file>" << endl;
       }
       ol.endMemberItem(FALSE);
       if (!fd->briefDescription().isEmpty() && Config::briefMemDescFlag)
@@ -322,7 +322,7 @@ void GroupDef::writeDocumentation(OutputList &ol)
       ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(),0,nd->name());
       if (!Config::genTagFile.isEmpty()) 
       {
-        tagFile << "    <namespace>" << convertToXML(nd->name()) << "</namespace>" << endl;
+        Doxygen::tagFile << "    <namespace>" << convertToXML(nd->name()) << "</namespace>" << endl;
       }
       ol.endMemberItem(FALSE);
       if (!nd->briefDescription().isEmpty() && Config::briefMemDescFlag)
@@ -350,7 +350,7 @@ void GroupDef::writeDocumentation(OutputList &ol)
       ol.writeObjectLink(gd->getReference(),gd->getOutputFileBase(),0,gd->groupTitle());
       if (!Config::genTagFile.isEmpty()) 
       {
-        tagFile << "    <subgroup>" << convertToXML(gd->name()) << "</subgroup>" << endl;
+        Doxygen::tagFile << "    <subgroup>" << convertToXML(gd->name()) << "</subgroup>" << endl;
       }
       ol.endMemberItem(FALSE);
       if (!gd->briefDescription().isEmpty() && Config::briefMemDescFlag)
@@ -421,12 +421,12 @@ void GroupDef::writeDocumentation(OutputList &ol)
 
       if (!Config::genTagFile.isEmpty()) 
       {
-        tagFile << "    <page>" << convertToXML(pageName) << "</page>" << endl;
+        Doxygen::tagFile << "    <page>" << convertToXML(pageName) << "</page>" << endl;
       }
 
       SectionInfo *si=0;
       if (!pi->title.isEmpty() && !pi->name.isEmpty() &&
-          (si=sectionDict[pi->name])!=0)
+          (si=Doxygen::sectionDict[pi->name])!=0)
       {
         ol.startSection(si->label,si->title,TRUE);
         ol.docify(si->title);
@@ -500,7 +500,8 @@ void GroupDef::writeDocumentation(OutputList &ol)
 
   if (!Config::genTagFile.isEmpty()) 
   {
-    tagFile << "  </compound>" << endl;
+    writeDocAnchorsToTagFile();
+    Doxygen::tagFile << "  </compound>" << endl;
   }
 
   endFile(ol); 
@@ -516,7 +517,7 @@ void addClassToGroups(Entry *root,ClassDef *cd)
   for (;(s=sli.current());++sli)
   {
     GroupDef *gd=0;
-    if (!s->isEmpty() && (gd=groupDict[*s]))
+    if (!s->isEmpty() && (gd=Doxygen::groupDict[*s]))
     {
       gd->addClass(cd);
       //printf("Compound %s: in group %s\n",cd->name().data(),s->data());
@@ -533,7 +534,7 @@ void addNamespaceToGroups(Entry *root,NamespaceDef *nd)
   {
     GroupDef *gd=0;
     //printf("group `%s'\n",s->data());
-    if (!s->isEmpty() && (gd=groupDict[*s]))
+    if (!s->isEmpty() && (gd=Doxygen::groupDict[*s]))
     {
       gd->addNamespace(nd);
       //printf("Namespace %s: in group %s\n",nd->name().data(),s->data());
@@ -548,7 +549,7 @@ void addGroupToGroups(Entry *root,GroupDef *subGroup)
   for (;(s=sli.current());++sli)
   {
     GroupDef *gd=0;
-    if (!s->isEmpty() && (gd=groupDict[*s]))
+    if (!s->isEmpty() && (gd=Doxygen::groupDict[*s]))
     {
       gd->addGroup(subGroup);
     }
@@ -563,7 +564,7 @@ void addMemberToGroups(Entry *root,MemberDef *md)
   for (;(s=sli.current());++sli)
   {
     GroupDef *gd=0;
-    if (!s->isEmpty() && (gd=groupDict[*s]))
+    if (!s->isEmpty() && (gd=Doxygen::groupDict[*s]))
     {
       GroupDef *mgd = md->getGroupDef();
       if (mgd==0)
@@ -592,7 +593,7 @@ void addExampleToGroups(Entry *root,PageInfo *eg)
   for (;(s=sli.current());++sli)
   {
     GroupDef *gd=0;
-    if (!s->isEmpty() && (gd=groupDict[*s]))
+    if (!s->isEmpty() && (gd=Doxygen::groupDict[*s]))
     {
       gd->addExample(eg);
       //printf("Example %s: in group %s\n",eg->name().data(),s->data());
diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp
index fdd71e4..1d6abc9 100644
--- a/src/htmlgen.cpp
+++ b/src/htmlgen.cpp
@@ -181,7 +181,7 @@ void HtmlGenerator::startQuickIndexItem(const char *s,const char *l)
   {
     t << "<a class=\"qindexRef\" ";
     t << "doxygen=\"" << s << ":";
-    if ((dest=tagDestinationDict[s])) t << *dest;
+    if ((dest=Doxygen::tagDestinationDict[s])) t << *dest;
     if (strcmp(s,"_cgi")!=0) t << "/"; // small hack to get the cgi binary link right
     t << "\" ";
   }
@@ -192,7 +192,7 @@ void HtmlGenerator::startQuickIndexItem(const char *s,const char *l)
   t << "href=\""; 
   if (s)
   {
-    if ((dest=tagDestinationDict[s])) t << *dest;
+    if ((dest=Doxygen::tagDestinationDict[s])) t << *dest;
     if (strcmp(s,"_cgi")!=0) t << "/";
   }
   t << l << "\">";
@@ -313,7 +313,7 @@ void HtmlGenerator::writeIndexItem(const char *ref,const char *f,
     {
       t << "<a class=\"elRef\" ";
       t << "doxygen=\"" << ref << ":";
-      if ((dest=tagDestinationDict[ref])) t << *dest << "/";
+      if ((dest=Doxygen::tagDestinationDict[ref])) t << *dest << "/";
       t << "\" ";
     }
     else
@@ -323,7 +323,7 @@ void HtmlGenerator::writeIndexItem(const char *ref,const char *f,
     t << "href=\"";
     if (ref)
     {
-      if ((dest=tagDestinationDict[ref])) t << *dest << "/";
+      if ((dest=Doxygen::tagDestinationDict[ref])) t << *dest << "/";
     }
     if (f) t << f << ".html\">";
   }
@@ -368,7 +368,7 @@ void HtmlGenerator::writeObjectLink(const char *ref,const char *f,
   {
     t << "<a class=\"elRef\" ";
     t << "doxygen=\"" << ref << ":";
-    if ((dest=tagDestinationDict[ref])) t << *dest << "/";
+    if ((dest=Doxygen::tagDestinationDict[ref])) t << *dest << "/";
     t << "\" ";
   }
   else
@@ -378,7 +378,7 @@ void HtmlGenerator::writeObjectLink(const char *ref,const char *f,
   t << "href=\"";
   if (ref)
   {
-    if ((dest=tagDestinationDict[ref])) t << *dest << "/";
+    if ((dest=Doxygen::tagDestinationDict[ref])) t << *dest << "/";
   }
   if (f) t << f << ".html";
   if (anchor) t << "#" << anchor;
@@ -395,7 +395,7 @@ void HtmlGenerator::writeCodeLink(const char *ref,const char *f,
   {
     t << "<a class=\"codeRef\" ";
     t << "doxygen=\"" << ref << ":";
-    if ((dest=tagDestinationDict[ref])) t << *dest << "/";
+    if ((dest=Doxygen::tagDestinationDict[ref])) t << *dest << "/";
     t << "\" ";
   }
   else
@@ -405,7 +405,7 @@ void HtmlGenerator::writeCodeLink(const char *ref,const char *f,
   t << "href=\"";
   if (ref)
   {
-    if ((dest=tagDestinationDict[ref])) t << *dest << "/";
+    if ((dest=Doxygen::tagDestinationDict[ref])) t << *dest << "/";
   }
   if (f) t << f << ".html";
   if (anchor) t << "#" << anchor;
@@ -468,12 +468,26 @@ void HtmlGenerator::endSection(const char *,bool sub)
   t << "</a>" << endl;
 }
 
-void HtmlGenerator::writeSectionRef(const char *name,const char *lab,
-                                    const char *title)
+void HtmlGenerator::writeSectionRef(const char *ref,const char *name,
+                                    const char *anchor,const char *title)
 {
+  QCString *dest;
+  //printf("writeSectionRef(%s,%s,%s,%s)\n",ref,name,anchor,title);
   QCString refName=name;
   if (refName.right(5)!=".html") refName+=".html";
-  t << "<a href=\"" << refName << "#" << lab << "\">";
+  t << "<a "; 
+  if (ref) 
+  {
+    t << "doxygen=\"" << ref << ":";
+    if ((dest=Doxygen::tagDestinationDict[ref])) t << *dest << "/";
+    t << "\" ";
+  }
+  t << "href=\""; 
+  if (ref)
+  {
+    if ((dest=Doxygen::tagDestinationDict[ref])) t << *dest << "/";
+  }
+  t << refName << "#" << anchor << "\">";
   docify(title);
   t << "</a>";
 }
@@ -488,12 +502,6 @@ void HtmlGenerator::writeSectionRefItem(const char *name,const char *lab,
   t << "</a>";
 }
 
-void HtmlGenerator::writeSectionRefAnchor(const char *name,const char *lab,
-                                          const char *title)
-{
-  writeSectionRef(name,lab,title);
-}
-
 void HtmlGenerator::docify(const char *str)
 {
   if (str)
@@ -591,17 +599,17 @@ void HtmlGenerator::endClassDiagram(ClassDiagram &d,
   d.writeImage(t,dir,fileName);
 }
 
-void HtmlGenerator::startColorFont(uchar red,uchar green,uchar blue)
-{
-  QCString colorString;
-  colorString.sprintf("%02x%02x%02x",red,green,blue);
-  t << "<font color=\"#" << colorString << "\">";
-}
-
-void HtmlGenerator::endColorFont()
-{
-  t << "</font>";
-}
+//void HtmlGenerator::startColorFont(uchar red,uchar green,uchar blue)
+//{
+//  QCString colorString;
+//  colorString.sprintf("%02x%02x%02x",red,green,blue);
+//  t << "<font color=\"#" << colorString << "\">";
+//}
+//
+//void HtmlGenerator::endColorFont()
+//{
+//  t << "</font>";
+//}
 
 void HtmlGenerator::writeFormula(const char *n,const char *text)
 {
diff --git a/src/htmlgen.h b/src/htmlgen.h
index 4d7fa4f..f48ee88 100644
--- a/src/htmlgen.h
+++ b/src/htmlgen.h
@@ -44,7 +44,6 @@ class HtmlGenerator : public OutputGenerator
     bool isEnabled(OutputType o) { return (o==Html && active); } 
     OutputGenerator *get(OutputType o) { return (o==Html) ? this : 0; }
     
-    
     //void generateExternalIndex();
     void startFile(const char *name,const char *title,bool external);
     void writeFooter(int,bool);
@@ -127,8 +126,8 @@ class HtmlGenerator : public OutputGenerator
     void endPreFragment()   { t << "</pre>"; }
     void startCodeLine() { col=0; }
     void endCodeLine()   { codify("\n"); }
-    void writeBoldString(const char *text) 
-                         { t << "<b>"; docify(text); t << "</b>"; }
+    //void writeBoldString(const char *text) 
+    //                     { t << "<b>"; docify(text); t << "</b>"; }
     void startEmphasis() { t << "<em>";  }
     void endEmphasis()   { t << "</em>"; }
     void startBold()     { t << "<b>"; }
@@ -185,17 +184,17 @@ class HtmlGenerator : public OutputGenerator
     void endDescList()        { t << "</dl>"; }
     void startSection(const char *,const char *,bool);
     void endSection(const char *,bool);
-    void writeSectionRef(const char *,const char *,const char *);
+    void writeSectionRef(const char *,const char *,const char *,const char *);
     void writeSectionRefItem(const char *,const char *,const char *);
-    void writeSectionRefAnchor(const char *,const char *,const char *);
+    //void writeSectionRefAnchor(const char *,const char *,const char *);
     void addIndexItem(const char *,const char *) {}
     void startIndent();
     void endIndent();
     void writeSynopsis() {}
     void startClassDiagram();
     void endClassDiagram(ClassDiagram &,const char *,const char *);
-    void startColorFont(uchar r,uchar g,uchar b);
-    void endColorFont();
+    //void startColorFont(uchar r,uchar g,uchar b);
+    //void endColorFont();
     void startPageRef() {}
     void endPageRef(const char *,const char *) {}
     void startQuickIndexItem(const char *,const char *);
diff --git a/src/index.cpp b/src/index.cpp
index 15cc2d4..00b2514 100644
--- a/src/index.cpp
+++ b/src/index.cpp
@@ -38,6 +38,45 @@
 #include "page.h"
 #include "packagedef.h"
 
+int annotatedClasses;
+int hierarchyClasses;
+int documentedFunctions;
+int documentedMembers;
+int documentedHtmlFiles;
+int documentedFiles;
+int documentedGroups;
+int documentedNamespaces;
+int documentedNamespaceMembers;
+int documentedIncludeFiles;
+int documentedPages;
+int documentedPackages;
+
+int countClassHierarchy();
+int countClassMembers();
+int countFileMembers();
+void countFiles(int &htmlFiles,int &files);
+int countGroups();
+int countNamespaces();
+int countAnnotatedClasses();
+int countNamespaceMembers();
+int countIncludeFiles();
+int countRelatedPages();
+int countPackages();
+
+void countDataStructures()
+{
+  annotatedClasses           = countAnnotatedClasses();
+  hierarchyClasses           = countClassHierarchy();
+  documentedMembers          = countClassMembers();
+  documentedFunctions        = countFileMembers();
+  countFiles(documentedHtmlFiles,documentedFiles);
+  documentedGroups           = countGroups();
+  documentedNamespaces       = countNamespaces();
+  documentedNamespaceMembers = countNamespaceMembers();
+  documentedPages            = countRelatedPages();
+  documentedPackages         = countPackages();
+}
+
 //----------------------------------------------------------------------------
 
 static bool g_memberIndexLetterUsed[256];
@@ -102,6 +141,194 @@ QCString abbreviate(const char *s,const char *name)
 
 //----------------------------------------------------------------------------
 
+void writeQuickLinks(OutputList &ol,bool compact ,bool ext=FALSE)
+{
+  ol.pushGeneratorState();
+  //bool manEnabled = ol.isEnabled(OutputGenerator::Man);
+  //bool texEnabled = ol.isEnabled(OutputGenerator::Latex);
+  ol.disableAllBut(OutputGenerator::Html);
+  QCString extLink;
+  if (ext) { extLink="_doc"; }
+  //if (manEnabled) ol.disable(OutputGenerator::Man);
+  //if (texEnabled) ol.disable(OutputGenerator::Latex);
+  if (compact) ol.startCenter(); else ol.startItemList();
+
+  if (!compact) ol.writeListItem();
+  if (Config::ftvHelpFlag)
+  {
+    ol.startQuickIndexItem(extLink,"main.html");
+  }
+  else
+  {
+    ol.startQuickIndexItem(extLink,"index.html");
+  }
+  parseText(ol,theTranslator->trMainPage());
+  ol.endQuickIndexItem();
+
+  if (documentedPackages>0)
+  {
+    if (!compact) ol.writeListItem();
+    ol.startQuickIndexItem(extLink,"packages.html");
+    parseText(ol,theTranslator->trPackages());
+    ol.endQuickIndexItem();
+  }
+  if (documentedGroups>0)
+  {
+    if (!compact) ol.writeListItem();
+    ol.startQuickIndexItem(extLink,"modules.html");
+    parseText(ol,theTranslator->trModules());
+    ol.endQuickIndexItem();
+  } 
+  if (documentedNamespaces>0)
+  {
+    if (!compact) ol.writeListItem();
+    ol.startQuickIndexItem(extLink,"namespaces.html");
+    parseText(ol,theTranslator->trNamespaceList());
+    ol.endQuickIndexItem();
+  }
+  if (hierarchyClasses>0)
+  {
+    if (!compact) ol.writeListItem();
+    ol.startQuickIndexItem(extLink,"hierarchy.html");
+    parseText(ol,theTranslator->trClassHierarchy());
+    ol.endQuickIndexItem();
+  } 
+  if (annotatedClasses>0)
+  {
+    if (Config::alphaIndexFlag)
+    {
+      if (!compact) ol.writeListItem();
+      ol.startQuickIndexItem(extLink,"classes.html");
+      parseText(ol,theTranslator->trAlphabeticalList());
+      ol.endQuickIndexItem();
+    }
+    if (!compact) ol.writeListItem();
+    ol.startQuickIndexItem(extLink,"annotated.html");
+    parseText(ol,theTranslator->trCompoundList());
+    ol.endQuickIndexItem();
+  } 
+  if (documentedHtmlFiles>0)
+  {
+    if (!compact) ol.writeListItem();
+    ol.startQuickIndexItem(extLink,"files.html");
+    parseText(ol,theTranslator->trFileList());
+    ol.endQuickIndexItem();
+  } 
+  //if (documentedIncludeFiles>0 && Config::verbatimHeaderFlag)
+  //{
+  //  if (!compact) ol.writeListItem();
+  //  ol.startQuickIndexItem(extLink,"headers.html");
+  //  parseText(ol,theTranslator->trHeaderFiles());
+  //  ol.endQuickIndexItem();
+  //}
+  //if (Config::sourceBrowseFlag) 
+  //{
+  //  if (!compact) ol.writeListItem();
+  //  ol.startQuickIndexItem(extLink,"sources.html");
+  //  parseText(ol,theTranslator->trSources());
+  //  ol.endQuickIndexItem();
+  //}
+  if (documentedNamespaceMembers>0)
+  {
+    if (!compact) ol.writeListItem();
+    ol.startQuickIndexItem(extLink,"namespacemembers.html");
+    parseText(ol,theTranslator->trNamespaceMembers());
+    ol.endQuickIndexItem();
+  }
+  if (documentedMembers>0)
+  {
+    if (!compact) ol.writeListItem();
+    ol.startQuickIndexItem(extLink,"functions.html");
+    parseText(ol,theTranslator->trCompoundMembers());
+    ol.endQuickIndexItem();
+  } 
+  if (documentedFunctions>0)
+  {
+    if (!compact) ol.writeListItem();
+    ol.startQuickIndexItem(extLink,"globals.html");
+    parseText(ol,theTranslator->trFileMembers());
+    ol.endQuickIndexItem();
+  } 
+  if (documentedPages>0)
+  {
+    if (!compact) ol.writeListItem();
+    ol.startQuickIndexItem(extLink,"pages.html");
+    parseText(ol,theTranslator->trRelatedPages());
+    ol.endQuickIndexItem();
+  } 
+  if (Doxygen::exampleSDict->count()>0)
+  {
+    if (!compact) ol.writeListItem();
+    ol.startQuickIndexItem(extLink,"examples.html");
+    parseText(ol,theTranslator->trExamples());
+    ol.endQuickIndexItem();
+  } 
+  if (Config::searchEngineFlag)
+  {
+    if (!compact) ol.writeListItem();
+    ol.startQuickIndexItem("_cgi","");
+    parseText(ol,theTranslator->trSearch());
+    ol.endQuickIndexItem();
+  } 
+  if (compact) 
+  {
+    ol.endCenter(); 
+    ol.writeRuler();
+  }
+  else 
+  {
+    ol.endItemList();
+  }
+  //if (manEnabled) ol.enable(OutputGenerator::Man);
+  //if (texEnabled) ol.enable(OutputGenerator::Latex);
+  ol.popGeneratorState();
+}
+
+static bool manIsEnabled;
+
+void startTitle(OutputList &ol,const char *fileName)
+{
+  ol.startTitleHead(fileName);
+  manIsEnabled=ol.isEnabled(OutputGenerator::Man);
+  if (manIsEnabled) ol.disable(OutputGenerator::Man);
+}
+
+void endTitle(OutputList &ol,const char *fileName,const char *name)
+{
+  if (manIsEnabled) ol.enable(OutputGenerator::Man); 
+  ol.endTitleHead(fileName,name);
+}
+
+void startFile(OutputList &ol,const char *name,const char *title,bool external)
+{
+  ol.startFile(name,title,external);
+  if (!Config::noIndexFlag) writeQuickLinks(ol,TRUE,external);
+}
+
+void endFile(OutputList &ol,bool external)
+{
+  ol.pushGeneratorState();
+  ol.disableAllBut(OutputGenerator::Html);
+  ol.writeFooter(0,external); // write the footer
+  if (Config::footerFile.isEmpty())
+  {
+    parseText(ol,theTranslator->trGeneratedAt(
+              dateToString(TRUE),
+              Config::projectName
+             ));
+  }
+  ol.writeFooter(1,external); // write the link to the picture
+  if (Config::footerFile.isEmpty())
+  {
+    parseText(ol,theTranslator->trWrittenBy());
+  }
+  ol.writeFooter(2,external); // end the footer
+  ol.popGeneratorState();
+  ol.endFile();
+}
+
+//----------------------------------------------------------------------------
+
 void writeClassTree(OutputList &ol,BaseClassList *bcl,bool hideSuper)
 {
   HtmlHelp *htmlHelp=0;
@@ -291,7 +518,7 @@ void writeClassTree(ClassList *cl)
 
 void writeClassHierarchy(OutputList &ol)
 {
-  initClassHierarchy(&classList);
+  initClassHierarchy(&Doxygen::classList);
 
   HtmlHelp *htmlHelp=0;
   FTVHelp  *ftvHelp=0;
@@ -307,7 +534,7 @@ void writeClassHierarchy(OutputList &ol)
   }
 
   bool started=FALSE;
-  ClassListIterator cli(classList);
+  ClassListIterator cli(Doxygen::classList);
   for (;cli.current(); ++cli)
   {
     ClassDef *cd=cli.current();
@@ -379,9 +606,9 @@ void writeClassHierarchy(OutputList &ol)
 // TODO: let this function return the real number of items in the hierarchy.
 int countClassHierarchy()
 {
-  initClassHierarchy(&classList);
+  initClassHierarchy(&Doxygen::classList);
   int count=0;
-  ClassListIterator cli(classList);
+  ClassListIterator cli(Doxygen::classList);
   for ( ; cli.current(); ++cli)
   {
     if (cli.current()->superClasses()->count()>0) count++;
@@ -484,7 +711,7 @@ void countFiles(int &htmlFiles,int &files)
 {
   htmlFiles=0;
   files=0;
-  FileNameListIterator fnli(inputNameList);
+  FileNameListIterator fnli(Doxygen::inputNameList);
   FileName *fn;
   for (;(fn=fnli.current());++fnli)
   {
@@ -554,7 +781,7 @@ void writeFileIndex(OutputList &ol)
   outputNameList.setAutoDelete(TRUE);
   
   // re-sort input files in (dir,file) output order instead of (file,dir) input order 
-  FileName *fn=inputNameList.first();
+  FileName *fn=Doxygen::inputNameList.first();
   while (fn)
   {
     FileDef *fd=fn->first();
@@ -578,7 +805,7 @@ void writeFileIndex(OutputList &ol)
       }
       fd=fn->next();
     }
-    fn=inputNameList.next();
+    fn=Doxygen::inputNameList.next();
   }
   
   ol.startIndexList();
@@ -703,7 +930,7 @@ void writeFileIndex(OutputList &ol)
 int countNamespaces()
 {
   int count=0;
-  NamespaceListIterator nli(namespaceList);
+  NamespaceListIterator nli(Doxygen::namespaceList);
   NamespaceDef *nd;
   for (;(nd=nli.current());++nli)
   {
@@ -750,7 +977,7 @@ void writeNamespaceIndex(OutputList &ol)
   ol.endTextBlock();
 
   bool first=TRUE;
-  NamespaceDef *nd=namespaceList.first();
+  NamespaceDef *nd=Doxygen::namespaceList.first();
   while (nd)
   {
     if (nd->isLinkableInProject())
@@ -782,7 +1009,7 @@ void writeNamespaceIndex(OutputList &ol)
         ftvHelp->addContentsItem(FALSE,nd->getReference(),nd->getOutputFileBase(),0,nd->name());
       }
     }
-    nd=namespaceList.next();
+    nd=Doxygen::namespaceList.next();
   }
   if (!first) ol.endIndexList();
   if (hasHtmlHelp)
@@ -803,8 +1030,8 @@ void writeNamespaceIndex(OutputList &ol)
 int countAnnotatedClasses()
 {
   int count=0;
-  //ClassDef *cd=classList.first();
-  ClassListIterator cli(classList);
+  //ClassDef *cd=Doxygen::classList.first();
+  ClassListIterator cli(Doxygen::classList);
   ClassDef *cd;
   for (;(cd=cli.current());++cli)
   {
@@ -824,9 +1051,9 @@ void writeAnnotatedClassList(OutputList &ol)
   bool hasHtmlHelp = Config::generateHtml && Config::htmlHelpFlag /*&& !Config::htmlHelpGroupsOnly*/;
   bool hasFtvHelp =  Config::generateHtml && Config::ftvHelpFlag  /*&& !Config::htmlHelpGroupsOnly*/;
   ol.startIndexList(); 
-  //ClassDef *cd=classList.first();
+  //ClassDef *cd=Doxygen::classList.first();
   //while (cd)
-  ClassListIterator cli(classList);
+  ClassListIterator cli(Doxygen::classList);
   ClassDef *cd;
   for (;(cd=cli.current());++cli)
   {
@@ -866,30 +1093,33 @@ void writePackageList(OutputList &ol)
   bool hasHtmlHelp = Config::generateHtml && Config::htmlHelpFlag /*&& !Config::htmlHelpGroupsOnly*/;
   bool hasFtvHelp =  Config::generateHtml && Config::ftvHelpFlag  /*&& !Config::htmlHelpGroupsOnly*/;
   ol.startIndexList(); 
-  PackageSDict::Iterator pdi(packageDict);
+  PackageSDict::Iterator pdi(Doxygen::packageDict);
   PackageDef *pd;
   for (;(pd=pdi.current());++pdi)
   {
-    ol.writeStartAnnoItem("package",pd->getOutputFileBase(),0,pd->name());
-    if (!pd->briefDescription().isEmpty())
+    if (!pd->isReference())
     {
-      ol.docify(" (");
-      OutputList briefOutput(&ol);
-      parseDoc(briefOutput,
-          pd->getDefFileName(),pd->getDefLine(),
-          pd->name(),0,
-          abbreviate(pd->briefDescription(),pd->name()));
-      ol+=briefOutput;
-      ol.docify(")");
-    }
-    ol.writeEndAnnoItem(pd->getOutputFileBase());
-    if (hasHtmlHelp)
-    {
-      HtmlHelp::getInstance()->addContentsItem(FALSE,pd->name(),pd->getOutputFileBase());
-    }
-    if (hasFtvHelp)
-    {
-      FTVHelp::getInstance()->addContentsItem(FALSE,pd->getReference(),pd->getOutputFileBase(),0,pd->name());
+      ol.writeStartAnnoItem("package",pd->getOutputFileBase(),0,pd->name());
+      if (!pd->briefDescription().isEmpty())
+      {
+        ol.docify(" (");
+        OutputList briefOutput(&ol);
+        parseDoc(briefOutput,
+            pd->getDefFileName(),pd->getDefLine(),
+            pd->name(),0,
+            abbreviate(pd->briefDescription(),pd->name()));
+        ol+=briefOutput;
+        ol.docify(")");
+      }
+      ol.writeEndAnnoItem(pd->getOutputFileBase());
+      if (hasHtmlHelp)
+      {
+        HtmlHelp::getInstance()->addContentsItem(FALSE,pd->name(),pd->getOutputFileBase());
+      }
+      if (hasFtvHelp)
+      {
+        FTVHelp::getInstance()->addContentsItem(FALSE,pd->getReference(),pd->getOutputFileBase(),0,pd->name());
+      }
     }
   }
   ol.endIndexList();
@@ -903,7 +1133,7 @@ void writeAlphabeticalClassList(OutputList &ol)
   ol.startAlphabeticalIndexList(); 
 
   // first count the number of headers
-  ClassListIterator cli(classList);
+  ClassListIterator cli(Doxygen::classList);
   ClassDef *cd;
   char startLetter=0;
   int headerItems=0;
@@ -1170,7 +1400,7 @@ void writeMemberList(OutputList &ol,bool useSections)
 {
   bool first = TRUE;
   char lastChar = 0;
-  MemberName *mn=memberNameList.first();
+  MemberName *mn=Doxygen::memberNameList.first();
   while (mn)
   {
     MemberDef *md=mn->first();
@@ -1243,7 +1473,7 @@ void writeMemberList(OutputList &ol,bool useSections)
         md=mn->prev();
       }
     }
-    mn=memberNameList.next();
+    mn=Doxygen::memberNameList.next();
   }
   ol.endItemList();
 }
@@ -1254,7 +1484,7 @@ int countClassMembers()
 {
   int i=0;for (i=0;i<256;i++) g_memberIndexLetterUsed[i]=FALSE;
   int count=0;
-  MemberName *mn=memberNameList.first();
+  MemberName *mn=Doxygen::memberNameList.first();
   while (mn)
   {
     MemberDef *md=mn->first();
@@ -1278,7 +1508,7 @@ int countClassMembers()
       if (!n.isEmpty()) g_memberIndexLetterUsed[tolower(n.at(0))]=TRUE;
       count++;
     }
-    mn=memberNameList.next();
+    mn=Doxygen::memberNameList.next();
   }
   return count;
 }
@@ -1354,7 +1584,7 @@ void writeFileMemberList(OutputList &ol,bool useSections)
 {
   char lastChar=0;
   bool first=TRUE;
-  MemberName *mn=functionNameList.first();
+  MemberName *mn=Doxygen::functionNameList.first();
   while (mn)
   {
     MemberDef *md=mn->first();
@@ -1425,7 +1655,7 @@ void writeFileMemberList(OutputList &ol,bool useSections)
         md=mn->prev();
       }
     }
-    mn=functionNameList.next();
+    mn=Doxygen::functionNameList.next();
   }
   ol.endItemList();
 }
@@ -1436,7 +1666,7 @@ void writeNamespaceMemberList(OutputList &ol,bool useSections)
 {
   char lastChar=0;
   bool first=TRUE;
-  MemberName *mn=functionNameList.first();
+  MemberName *mn=Doxygen::functionNameList.first();
   while (mn)
   {
     MemberDef *md=mn->first();
@@ -1500,7 +1730,7 @@ void writeNamespaceMemberList(OutputList &ol,bool useSections)
         md=mn->prev();
       }
     }
-    mn=functionNameList.next();
+    mn=Doxygen::functionNameList.next();
   }
   if (!first) ol.endItemList();
 }
@@ -1511,7 +1741,7 @@ int countNamespaceMembers()
 {
   int i=0;for (i=0;i<256;i++) g_namespaceIndexLetterUsed[i]=FALSE;
   int count=0;
-  MemberName *mn=functionNameList.first();
+  MemberName *mn=Doxygen::functionNameList.first();
   while (mn)
   {
     MemberDef *md=mn->first();
@@ -1529,7 +1759,7 @@ int countNamespaceMembers()
         md=mn->next();
     }
     if (found) count++;
-    mn=functionNameList.next();
+    mn=Doxygen::functionNameList.next();
   }
   return count;
 }
@@ -1540,7 +1770,7 @@ int countFileMembers()
 {
   int i=0;for (i=0;i<256;i++) g_fileIndexLetterUsed[i]=FALSE;
   int count=0;
-  MemberName *mn=functionNameList.first();
+  MemberName *mn=Doxygen::functionNameList.first();
   while (mn)
   {
     MemberDef *md=mn->first();
@@ -1561,7 +1791,7 @@ int countFileMembers()
         md=mn->next();
     }
     if (found) count++;
-    mn=functionNameList.next();
+    mn=Doxygen::functionNameList.next();
   }
   return count;
 }
@@ -1646,7 +1876,7 @@ void writeNamespaceMemberIndex(OutputList &ol)
 
 void writeExampleIndex(OutputList &ol)
 {
-  if (exampleSDict->count()==0) return;
+  if (Doxygen::exampleSDict->count()==0) return;
   ol.pushGeneratorState();
   ol.disable(OutputGenerator::Man);
   startFile(ol,"examples","Example Index");
@@ -1678,7 +1908,7 @@ void writeExampleIndex(OutputList &ol)
   //ol.newParagraph();
   ol.endTextBlock();
   ol.startIndexList();
-  PageSDictIterator pdi(*exampleSDict);
+  PageSDictIterator pdi(*Doxygen::exampleSDict);
   PageInfo *pi=0;
   for (pdi.toFirst();(pi=pdi.current());++pdi)
   {
@@ -1717,11 +1947,11 @@ void writeExampleIndex(OutputList &ol)
 int countRelatedPages()
 {
   int count=0;
-  PageSDictIterator pdi(*pageSDict);
+  PageSDictIterator pdi(*Doxygen::pageSDict);
   PageInfo *pi=0;
   for (pdi.toFirst();(pi=pdi.current());++pdi)
   {
-    if (!pi->inGroup) count++;
+    if (!pi->inGroup && !pi->isReference()) count++;
   }
   return count;
 }
@@ -1731,11 +1961,14 @@ int countRelatedPages()
 int countPackages()
 {
   int count=0;
-  PackageSDict::Iterator pdi(packageDict);
+  PackageSDict::Iterator pdi(Doxygen::packageDict);
   PackageDef *pd=0;
   for (pdi.toFirst();(pd=pdi.current());++pdi)
   {
-    count++;
+    if (!pd->isReference())
+    {
+      count++;
+    }
   }
   return count;
 }
@@ -1776,11 +2009,11 @@ void writePageIndex(OutputList &ol)
   //ol.newParagraph();
   ol.endTextBlock();
   ol.startIndexList();
-  PageSDictIterator pdi(*pageSDict);
+  PageSDictIterator pdi(*Doxygen::pageSDict);
   PageInfo *pi=0;
   for (pdi.toFirst();(pi=pdi.current());++pdi)
   {
-    if (!pi->inGroup)
+    if (!pi->inGroup && !pi->isReference())
     {
       QCString pageName,pageTitle;
 
@@ -1822,7 +2055,7 @@ void writePageIndex(OutputList &ol)
 int countGroups()
 {
   int count=0;
-  GroupListIterator gli(groupList);
+  GroupListIterator gli(Doxygen::groupList);
   GroupDef *gd;
   for (;(gd=gli.current());++gli)
   {
@@ -1921,7 +2154,7 @@ void writeGroupTreeNode(OutputList &ol, GroupDef *gd)
     for (pli.toFirst();(pi=pli.current());++pli)
     {
       SectionInfo *si=0;
-      if (!pi->name.isEmpty()) si=sectionDict[pi->name];
+      if (!pi->name.isEmpty()) si=Doxygen::sectionDict[pi->name];
       if(htmlHelp) htmlHelp->addContentsItem(FALSE,
                                    convertToHtml(pi->title),
                                    gd->getOutputFileBase(),
@@ -2032,7 +2265,7 @@ void writeGroupTreeNode(OutputList &ol, GroupDef *gd)
 void writeGroupHierarchy(OutputList &ol)
 {
   ol.startIndexList();
-  GroupListIterator gli(groupList);
+  GroupListIterator gli(Doxygen::groupList);
   GroupDef *gd;
   for (;(gd=gli.current());++gli)
   {
@@ -2053,7 +2286,7 @@ void writeGroupList(OutputList &ol)
   if (hasHtmlHelp) htmlHelp = HtmlHelp::getInstance();
   if (hasFtvHelp) ftvHelp = FTVHelp::getInstance();
   ol.startDescription();
-  GroupListIterator gli(groupList);
+  GroupListIterator gli(Doxygen::groupList);
   GroupDef *gd;
   for (;(gd=gli.current());++gli)
   {
@@ -2171,18 +2404,18 @@ void writeIndex(OutputList &ol)
   ol.disableAllBut(OutputGenerator::Html);
 
   QCString defFileName = 
-    mainPage ? mainPage->defFileName.data() : "<generated>";
+    Doxygen::mainPage ? Doxygen::mainPage->defFileName.data() : "<generated>";
   int defLine =
-    mainPage ? mainPage->defLine : 1;
+    Doxygen::mainPage ? Doxygen::mainPage->defLine : 1;
 
   QCString title;
-  if (!mainPage || mainPage->title.isEmpty())
+  if (!Doxygen::mainPage || Doxygen::mainPage->title.isEmpty())
   {
     title = theTranslator->trMainPage();
   }
   else 
   {
-    title = substitute(mainPage->title,"%","");
+    title = substitute(Doxygen::mainPage->title,"%","");
   }
 
   QCString indexName="index";
@@ -2200,9 +2433,9 @@ void writeIndex(OutputList &ol)
 
   if (!Config::noIndexFlag) writeQuickLinks(ol,TRUE);
   ol.startTitleHead(0);
-  if (mainPage && !mainPage->title.isEmpty())
+  if (Doxygen::mainPage && !Doxygen::mainPage->title.isEmpty())
   {
-    parseDoc(ol,defFileName,defLine,0,0,mainPage->title);
+    parseDoc(ol,defFileName,defLine,0,0,Doxygen::mainPage->title);
   }
   else
   {
@@ -2216,11 +2449,11 @@ void writeIndex(OutputList &ol)
     parseDoc(ol,defFileName,defLine,0,0,Config::projectNumber);
     ol.endProjectNumber();
   }
-  if (Config::noIndexFlag && mainPage==0) writeQuickLinks(ol,FALSE);
+  if (Config::noIndexFlag && Doxygen::mainPage==0) writeQuickLinks(ol,FALSE);
 
-  if (mainPage)
+  if (Doxygen::mainPage)
   {
-    parseDoc(ol,defFileName,defLine,0,0,mainPage->doc);
+    parseDoc(ol,defFileName,defLine,0,0,Doxygen::mainPage->doc);
   }
   
   endFile(ol);
@@ -2250,12 +2483,12 @@ void writeIndex(OutputList &ol)
   ol.startIndexSection(isTitlePageAuthor);
   parseText(ol,theTranslator->trGeneratedBy());
   ol.endIndexSection(isTitlePageAuthor);
-  if (mainPage)
+  if (Doxygen::mainPage)
   {
     ol.startIndexSection(isMainPage);
-    if (!mainPage->title.isEmpty())
+    if (!Doxygen::mainPage->title.isEmpty())
     {
-      parseDoc(ol,defFileName,defLine,0,0,mainPage->title);
+      parseDoc(ol,defFileName,defLine,0,0,Doxygen::mainPage->title);
     }
     else
     {
@@ -2339,13 +2572,13 @@ void writeIndex(OutputList &ol)
     parseText(ol,projPrefix+theTranslator->trFileDocumentation());
     ol.endIndexSection(isFileDocumentation);
   }
-  if (exampleSDict->count()>0)
+  if (Doxygen::exampleSDict->count()>0)
   {
     ol.startIndexSection(isExampleDocumentation);
     parseText(ol,projPrefix+theTranslator->trExampleDocumentation());
     ol.endIndexSection(isExampleDocumentation);
   }
-  if (pageSDict->count()>0)
+  if (Doxygen::pageSDict->count()>0)
   {
     ol.startIndexSection(isPageDocumentation);
     parseText(ol,projPrefix+theTranslator->trPageDocumentation());
@@ -2354,20 +2587,20 @@ void writeIndex(OutputList &ol)
   ol.endIndexSection(isEndIndex);
   endFile(ol);
 
-  if (mainPage)
+  if (Doxygen::mainPage)
   {
     ol.disable(OutputGenerator::Man);
-    startFile(ol,mainPage->name,mainPage->title);
+    startFile(ol,Doxygen::mainPage->name,Doxygen::mainPage->title);
     //SectionInfo *si=0;
-    //if (!mainPage->title.isEmpty() && !mainPage->name.isEmpty() &&
-    //    (si=sectionDict[mainPage->name])!=0)
+    //if (!Doxygen::mainPage->title.isEmpty() && !Doxygen::mainPage->name.isEmpty() &&
+    //    (si=Doxygen::sectionDict[Doxygen::mainPage->name])!=0)
     //{
     //  ol.startSection(si->label,si->title,FALSE);
     //  ol.docify(si->title);
     //  ol.endSection(si->label,FALSE);
     //}
     ol.startTextBlock();
-    parseDoc(ol,defFileName,defLine,0,0,mainPage->doc);
+    parseDoc(ol,defFileName,defLine,0,0,Doxygen::mainPage->doc);
     ol.endTextBlock();
     endFile(ol);
     ol.enable(OutputGenerator::Man);
diff --git a/src/index.h b/src/index.h
index 0cb4b9d..a81ccf5 100644
--- a/src/index.h
+++ b/src/index.h
@@ -67,16 +67,25 @@ void writeGraphicalClassHierarchy(OutputList &ol);
 void writeGraphInfo(OutputList &ol);
 void writePackageIndex(OutputList &ol);
 
-int countClassHierarchy();
-int countClassMembers();
-int countFileMembers();
-void countFiles(int &htmlFiles,int &files);
-int countGroups();
-int countNamespaces();
-int countAnnotatedClasses();
-int countNamespaceMembers();
-int countIncludeFiles();
-int countRelatedPages();
-int countPackages();
+void countDataStructures();
+
+extern int annotatedClasses;
+extern int hierarchyClasses;
+extern int documentedFunctions;
+extern int documentedMembers;
+extern int documentedDefines;
+extern int documentedFiles;
+extern int documentedHtmlFiles;
+extern int documentedGroups;
+extern int documentedNamespaces;
+extern int documentedNamespaceMembers;
+extern int documentedIncludeFiles;
+extern int documentedPages;
+extern int documentedPackages;
+
+void startTitle(OutputList &ol,const char *fileName);
+void endTitle(OutputList &ol,const char *fileName,const char *name);
+void startFile(OutputList &ol,const char *name,const char *title,bool external=FALSE);
+void endFile(OutputList &ol,bool external=FALSE);
 
 #endif
diff --git a/src/latexgen.cpp b/src/latexgen.cpp
index 1d15252..7e8cf22 100644
--- a/src/latexgen.cpp
+++ b/src/latexgen.cpp
@@ -494,7 +494,7 @@ void LatexGenerator::startIndexSection(IndexSections is)
       break;
     case isPackageDocumentation:
       {
-        PackageSDict::Iterator pdi(packageDict);
+        PackageSDict::Iterator pdi(Doxygen::packageDict);
         PackageDef *pd=pdi.toFirst();
         bool found=FALSE;
         while (pd && !found)
@@ -509,7 +509,7 @@ void LatexGenerator::startIndexSection(IndexSections is)
       break;
     case isModuleDocumentation:
       {
-        GroupDef *gd=groupList.first();
+        GroupDef *gd=Doxygen::groupList.first();
         bool found=FALSE;
         while (gd && !found)
         {
@@ -519,13 +519,13 @@ void LatexGenerator::startIndexSection(IndexSections is)
             t << "{"; //Module Documentation}\n";
             found=TRUE;
           }
-          gd=groupList.next();
+          gd=Doxygen::groupList.next();
         }
       }
       break;
     case isNamespaceDocumentation:
       {
-        NamespaceDef *nd=namespaceList.first();
+        NamespaceDef *nd=Doxygen::namespaceList.first();
         bool found=FALSE;
         while (nd && !found)
         {
@@ -535,13 +535,13 @@ void LatexGenerator::startIndexSection(IndexSections is)
             t << "{"; // Namespace Documentation}\n":
             found=TRUE;
           }
-          nd=namespaceList.next();
+          nd=Doxygen::namespaceList.next();
         } 
       }
       break;
     case isClassDocumentation:
       {
-        ClassDef *cd=classList.first();
+        ClassDef *cd=Doxygen::classList.first();
         bool found=FALSE;
         while (cd && !found)
         {
@@ -551,14 +551,14 @@ void LatexGenerator::startIndexSection(IndexSections is)
             t << "{"; //Compound Documentation}\n";
             found=TRUE;
           }
-          cd=classList.next();
+          cd=Doxygen::classList.next();
         }
       }
       break;
     case isFileDocumentation:
       {
         bool isFirst=TRUE;
-        FileName *fn=inputNameList.first();
+        FileName *fn=Doxygen::inputNameList.first();
         while (fn)
         {
           FileDef *fd=fn->first();
@@ -576,7 +576,7 @@ void LatexGenerator::startIndexSection(IndexSections is)
             }
             fd=fn->next();
           }
-          fn=inputNameList.next();
+          fn=Doxygen::inputNameList.next();
         }
       }
       break;
@@ -637,7 +637,7 @@ void LatexGenerator::endIndexSection(IndexSections is)
       break;
     case isPackageDocumentation:
       {
-        PackageSDict::Iterator pdi(packageDict);
+        PackageSDict::Iterator pdi(Doxygen::packageDict);
         PackageDef *pd=pdi.toFirst();
         bool found=FALSE;
         while (pd && !found)
@@ -658,7 +658,7 @@ void LatexGenerator::endIndexSection(IndexSections is)
       break;
     case isModuleDocumentation:
       {
-        GroupDef *gd=groupList.first();
+        GroupDef *gd=Doxygen::groupList.first();
         bool found=FALSE;
         while (gd && !found)
         {
@@ -667,7 +667,7 @@ void LatexGenerator::endIndexSection(IndexSections is)
             t << "}\n\\input{" << gd->getOutputFileBase() << "}\n";
             found=TRUE;
           }
-          gd=groupList.next();
+          gd=Doxygen::groupList.next();
         }
         while (gd)
         {
@@ -676,13 +676,13 @@ void LatexGenerator::endIndexSection(IndexSections is)
             if (Config::compactLatexFlag) t << "\\input"; else t << "\\include";
             t << "{" << gd->getOutputFileBase() << "}\n";
           }
-          gd=groupList.next();
+          gd=Doxygen::groupList.next();
         }
       }
       break;
     case isNamespaceDocumentation:
       {
-        NamespaceDef *nd=namespaceList.first();
+        NamespaceDef *nd=Doxygen::namespaceList.first();
         bool found=FALSE;
         while (nd && !found)
         {
@@ -691,7 +691,7 @@ void LatexGenerator::endIndexSection(IndexSections is)
             t << "}\n\\input{" << nd->getOutputFileBase() << "}\n";
             found=TRUE;
           }
-          nd=namespaceList.next();
+          nd=Doxygen::namespaceList.next();
         }
         while (nd)
         {
@@ -700,13 +700,13 @@ void LatexGenerator::endIndexSection(IndexSections is)
             if (Config::compactLatexFlag) t << "\\input"; else t << "\\include";
             t << "{" << nd->getOutputFileBase() << "}\n";
           }
-          nd=namespaceList.next();
+          nd=Doxygen::namespaceList.next();
         }
       }
       break;
     case isClassDocumentation:
       {
-        ClassDef *cd=classList.first();
+        ClassDef *cd=Doxygen::classList.first();
         bool found=FALSE;
         while (cd && !found)
         {
@@ -715,7 +715,7 @@ void LatexGenerator::endIndexSection(IndexSections is)
             t << "}\n\\input{" << cd->getOutputFileBase() << "}\n";
             found=TRUE;
           }
-          cd=classList.next();
+          cd=Doxygen::classList.next();
         }
         while (cd)
         {
@@ -724,14 +724,14 @@ void LatexGenerator::endIndexSection(IndexSections is)
             if (Config::compactLatexFlag) t << "\\input"; else t << "\\include";
             t << "{" << cd->getOutputFileBase() << "}\n";
           } 
-          cd=classList.next();
+          cd=Doxygen::classList.next();
         }
       }
       break;
     case isFileDocumentation:
       {
         bool isFirst=TRUE;
-        FileName *fn=inputNameList.first();
+        FileName *fn=Doxygen::inputNameList.first();
         while (fn)
         {
           FileDef *fd=fn->first();
@@ -752,14 +752,14 @@ void LatexGenerator::endIndexSection(IndexSections is)
             }
             fd=fn->next();
           }
-          fn=inputNameList.next();
+          fn=Doxygen::inputNameList.next();
         }
       }
       break;
     case isExampleDocumentation:
       {
         t << "}\n";
-        PageSDictIterator pdi(*exampleSDict);
+        PageSDictIterator pdi(*Doxygen::exampleSDict);
         PageInfo *pi=pdi.toFirst();
         if (pi)
         {
@@ -775,12 +775,12 @@ void LatexGenerator::endIndexSection(IndexSections is)
     case isPageDocumentation:
       {
         t << "}\n";
-        PageSDictIterator pdi(*pageSDict);
+        PageSDictIterator pdi(*Doxygen::pageSDict);
         PageInfo *pi=pdi.toFirst();
         bool first=TRUE;
         for (pdi.toFirst();(pi=pdi.current());++pdi)
         {
-          if (!pi->inGroup)
+          if (!pi->inGroup && !pi->isReference())
           {
             QCString pageName;
             if (Config::caseSensitiveNames)
@@ -1135,30 +1135,37 @@ void LatexGenerator::endSection(const char *lab,bool)
   t << "}\\label{" << lab << "}" << endl;
 }
 
-void LatexGenerator::writeSectionRef(const char *,const char *lab,
-                                     const char *text)
+void LatexGenerator::writeSectionRef(const char *ref,const char *,
+                                     const char *lab,const char *text)
 {
-  if (text && Config::pdfHyperFlag)
+  if (ref) // external reference
   {
-    t << "\\hyperlink{";
-    if (lab) t << lab; 
-    t << "}{";
     docify(text);
-    t << "}";
-    //t << " {\\rm (p.\\,\\pageref{" << lab << "})}";
   }
-  else
+  else // local reference
   {
-    if (strcmp(lab,text)!=0) // lab!=text
+    if (text && Config::pdfHyperFlag)
     {
-      // todo: don't hardcode p. here!
-      t << "{\\bf ";
+      t << "\\hyperlink{";
+      if (lab) t << lab; 
+      t << "}{";
       docify(text);
-      t << "} {\\rm (p.\\,\\pageref{" << lab << "})}";
+      t << "}";
+      //t << " {\\rm (p.\\,\\pageref{" << lab << "})}";
     }
     else
     {
-      t << "\\ref{" << lab << "}";
+      if (strcmp(lab,text)!=0) // lab!=text
+      {
+        // todo: don't hardcode p. here!
+        t << "{\\bf ";
+        docify(text);
+        t << "} {\\rm (p.\\,\\pageref{" << lab << "})}";
+      }
+      else
+      {
+        t << "\\ref{" << lab << "}";
+      }
     }
   }
 }
@@ -1172,14 +1179,14 @@ void LatexGenerator::writeSectionRefItem(const char *,const char *lab,
 }
 
 // TODO: remove this function
-void LatexGenerator::writeSectionRefAnchor(const char *,const char *lab,
-                                     const char *title)
-{
-  startBold();
-  docify(title);
-  endBold();
-  t << " (p.\\,\\pageref{" << lab << "})" << endl;
-}
+//void LatexGenerator::writeSectionRefAnchor(const char *,const char *lab,
+//                                     const char *title)
+//{
+//  startBold();
+//  docify(title);
+//  endBold();
+//  t << " (p.\\,\\pageref{" << lab << "})" << endl;
+//}
 
 //void LatexGenerator::docify(const char *str)
 //{
diff --git a/src/latexgen.h b/src/latexgen.h
index f298953..4b264ce 100644
--- a/src/latexgen.h
+++ b/src/latexgen.h
@@ -114,8 +114,8 @@ class LatexGenerator : public OutputGenerator
     void endPreFragment()    { t << "\\end{alltt}\\normalsize " << endl; }
     void startCodeLine() { col=0; }
     void endCodeLine() { codify("\n"); }
-    void writeBoldString(const char *text) 
-                         { t << "{\\bf "; docify(text); t << "}"; }
+    //void writeBoldString(const char *text) 
+    //                     { t << "{\\bf "; docify(text); t << "}"; }
     void startEmphasis() { t << "{\\em ";  }
     void endEmphasis()   { t << "}"; }
     void startBold()     { t << "{\\bf "; }
@@ -182,9 +182,9 @@ class LatexGenerator : public OutputGenerator
     void endDescList()       { t << "\\end{Desc}" << endl; }
     void startSection(const char *,const char *,bool);
     void endSection(const char *,bool);
-    void writeSectionRef(const char *,const char *,const char *);
+    void writeSectionRef(const char *,const char *,const char *,const char *);
     void writeSectionRefItem(const char *,const char *,const char *);
-    void writeSectionRefAnchor(const char *,const char *,const char *);
+    //void writeSectionRefAnchor(const char *,const char *,const char *);
     void addIndexItem(const char *,const char *);
     void startIndent()       {}
     void endIndent()         {}
@@ -192,8 +192,8 @@ class LatexGenerator : public OutputGenerator
     //void generateExternalIndex() {}
     void startClassDiagram();
     void endClassDiagram(ClassDiagram &,const char *,const char *);
-    void startColorFont(uchar,uchar,uchar) {}
-    void endColorFont()   {}
+    //void startColorFont(uchar,uchar,uchar) {}
+    //void endColorFont()   {}
     void startPageRef();
     void endPageRef(const char *,const char *);
     void startQuickIndexItem(const char *,const char *) {}
diff --git a/src/libdoxygen.pro.in b/src/libdoxygen.pro.in
new file mode 100644
index 0000000..9f2dece
--- /dev/null
+++ b/src/libdoxygen.pro.in
@@ -0,0 +1,48 @@
+#
+# 
+#
+# Copyright (C) 1997-2001 by Dimitri van Heesch.
+#
+# Permission to use, copy, modify, and distribute this software and its
+# documentation under the terms of the GNU General Public License is hereby 
+# granted. No representations are made about the suitability of this software 
+# for any purpose. It is provided "as is" without express or implied warranty.
+# See the GNU General Public License for more details.
+#
+# Documents produced by Doxygen are derivative works derived from the
+# input used in their production; they are not affected by this license.
+#
+# TMake project file for doxygen
+
+TEMPLATE     =	libdoxygen.t
+CONFIG       =	console warn_on staticlib
+HEADERS      =	doxygen.h scanner.h doc.h classdef.h classlist.h memberdef.h \
+                membername.h index.h memberlist.h definition.h \
+                entry.h logos.h instdox.h message.h code.h \
+                filedef.h util.h cppvalue.h constexp.h \
+		outputgen.h outputlist.h htmlgen.h latexgen.h \
+	        filename.h defargs.h groupdef.h gifenc.h diagram.h image.h \
+		namespacedef.h version.h language.h translator.h \
+		translator_nl.h translator_se.h translator_cz.h translator_fr.h \
+		translator_it.h formula.h debug.h membergroup.h htmlhelp.h \
+                translator_ru.h translator_pl.h dot.h rtfgen.h \
+                reflist.h page.h sortdict.h translator_hu.h translator_kr.h \
+                translator_ro.h translator_si.h translator_cn.h ftvhelp.h \
+                treeview.h tagreader.h packagedef.h
+SOURCES      =	doxygen.cpp scanner.cpp doc.cpp classdef.cpp classlist.cpp \
+                memberdef.cpp membername.cpp index.cpp memberlist.cpp \
+		entry.cpp logos.cpp instdox.cpp message.cpp code.cpp \
+                config.cpp filedef.cpp util.cpp groupdef.cpp \
+                outputgen.cpp outputlist.cpp htmlgen.cpp latexgen.cpp mangen.cpp \
+	        cppvalue.cpp ce_lex.cpp ce_parse.cpp pre.cpp \
+		filename.cpp declinfo.cpp defargs.cpp define.cpp \
+		diagram.cpp gifenc.cpp image.cpp namespacedef.cpp \
+		version.cpp language.cpp definition.cpp formula.cpp debug.cpp \
+		membergroup.cpp htmlhelp.cpp dot.cpp rtfgen.cpp \
+                reflist.cpp ftvhelp.cpp tagreader.cpp packagedef.cpp
+win32:TMAKE_CXXFLAGS       += -DQT_NODLL
+INCLUDEPATH                += ../qtools
+win32:INCLUDEPATH          += .
+DESTDIR                    =  ../lib
+TARGET                     =  doxygen
+OBJECTS_DIR                =  ../objects
diff --git a/src/libdoxygen.t b/src/libdoxygen.t
new file mode 100644
index 0000000..3c819c0
--- /dev/null
+++ b/src/libdoxygen.t
@@ -0,0 +1,80 @@
+#
+# 
+#
+# Copyright (C) 1997-2001 by Dimitri van Heesch.
+#
+# Permission to use, copy, modify, and distribute this software and its
+# documentation under the terms of the GNU General Public License is hereby 
+# granted. No representations are made about the suitability of this software 
+# for any purpose. It is provided "as is" without express or implied warranty.
+# See the GNU General Public License for more details.
+#
+# Documents produced by Doxygen are derivative works derived from the
+# input used in their production; they are not affected by this license.
+#!
+#! doxygen.t: This is a custom template for building Doxygen
+#!
+#$ IncludeTemplate("lib.t");
+
+LEX     =   flex
+YACC    =   bison
+
+#${
+sub GenerateDep {
+    my($obj,$src,$dep) = @_;
+    my(@objv,$srcv,$i,$s,$o,$d,$c);
+    @objv = split(/\s+/,$obj);
+    @srcv = split(/\s+/,$src);
+    for $i ( 0..$#objv ) {
+        $s = $srcv[$i];
+        $o = $objv[$i];
+        next if $s eq "";
+        $text .= $o . ": " . $s;
+	$text .= " ${linebreak}\n\t\t" . $dep if $dep ne "";
+        if ( $moc_output{$s} ne "" ) {
+            $text .= " ${linebreak}\n\t\t" . $moc_output{$s};
+        }
+        $d = &make_depend($s);
+        $text .= " ${linebreak}\n\t\t" . $d if $d ne "";
+	$text .= "\n";
+    }
+    chop $text;
+}
+#$} 
+
+####################
+
+#$ GenerateDep("scanner.cpp","scanner.l");
+	$(LEX) -PscanYY -t scanner.l >scanner.cpp
+
+#$ GenerateDep("code.cpp","code.l");
+	$(LEX) -PcodeYY -t code.l >code.cpp
+
+#$ GenerateDep("pre.cpp","pre.l");
+	$(LEX) -PpreYY -t pre.l >pre.cpp 
+
+#$ GenerateDep("config.cpp","config.l");
+	$(LEX) -PconfigYY -t config.l >config.cpp 
+
+#$ GenerateDep("declinfo.cpp","declinfo.l");
+	$(LEX) -PdeclinfoYY -t declinfo.l >declinfo.cpp
+
+#$ GenerateDep("defargs.cpp","defargs.l");
+	$(LEX) -PdefargsYY -t defargs.l >defargs.cpp
+
+#$ GenerateDep("doc.cpp","doc.l");
+	$(LEX) -PdocYY -t doc.l >doc.cpp
+
+#$ GenerateDep("ce_lex.cpp","constexp.l","ce_parse.h");
+	$(LEX) -PcppExpYY -t constexp.l >ce_lex.cpp 
+
+#$ GenerateDep("ce_parse.cpp","constexp.y");
+	$(YACC) -l -p cppExpYY constexp.y -o ce_parse.cpp 
+
+#$ GenerateDep("ce_parse.h","constexp.y");
+	$(YACC) -l -d -p cppExpYY constexp.y -o ce_parse.c 
+	-rm ce_parse.c	
+
+treeview.h: treeview.js
+	cat treeview.js | sed -e "s/\\\\/\\\\\\\\/g" -e "s/\"/\\\\\"/g" -e "s/^/\"/g" -e "s/$$/\\\\n\"/g" >treeview.h 
+
diff --git a/src/main.cpp b/src/main.cpp
new file mode 100644
index 0000000..7ae98c7
--- /dev/null
+++ b/src/main.cpp
@@ -0,0 +1,20 @@
+#include "doxygen.h"
+
+/*! \file
+ *  \brief main entry point for doxygen
+ *
+ *  This file contains main()
+ */
+
+/*! Default main. The idea of separating this from the rest of doxygen,
+ *  is to make it possible to write your own main, with a different 
+ *  generateOutput() function for instance.
+ */
+int main(int argc,char **argv)
+{
+  initDoxygen();
+  readConfiguration(argc,argv);
+  parseInput();
+  generateOutput();
+  return 0;
+}
diff --git a/src/mangen.h b/src/mangen.h
index f342069..3826518 100644
--- a/src/mangen.h
+++ b/src/mangen.h
@@ -110,8 +110,8 @@ class ManGenerator : public OutputGenerator
     void endPreFragment() { endCodeFragment(); }
     void startCodeLine() {}
     void endCodeLine() { codify("\n"); col=0; }
-    void writeBoldString(const char *text) 
-                         { t << "\\fB"; docify(text); t << "\\fR"; firstCol=FALSE; }
+    //void writeBoldString(const char *text) 
+    //                     { t << "\\fB"; docify(text); t << "\\fR"; firstCol=FALSE; }
     void startEmphasis() { t << "\\fI"; firstCol=FALSE; }
     void endEmphasis()   { t << "\\fR"; firstCol=FALSE; }
     void startBold()     { t << "\\fB"; firstCol=FALSE; }
@@ -172,9 +172,9 @@ class ManGenerator : public OutputGenerator
     void endDescList()        {}
     void startSection(const char *,const char *,bool) {}
     void endSection(const char *,bool) {}
-    void writeSectionRef(const char *,const char *,const char *) {}
+    void writeSectionRef(const char *,const char *,const char *,const char *) {}
     void writeSectionRefItem(const char *,const char *,const char *) {}
-    void writeSectionRefAnchor(const char *,const char *,const char *) {}
+    //void writeSectionRefAnchor(const char *,const char *,const char *) {}
     void addIndexItem(const char *,const char *) {}
     void startIndent()        {}
     void endIndent()          {}
@@ -182,8 +182,8 @@ class ManGenerator : public OutputGenerator
     //void generateExternalIndex() {}
     void startClassDiagram() {}
     void endClassDiagram(ClassDiagram &,const char *,const char *) {}
-    void startColorFont(uchar,uchar,uchar) {}
-    void endColorFont()   {}
+    //void startColorFont(uchar,uchar,uchar) {}
+    //void endColorFont()   {}
     void startPageRef() {}
     void endPageRef(const char *,const char *) {}
     void startQuickIndexItem(const char *,const char *) {}
diff --git a/src/memberdef.cpp b/src/memberdef.cpp
index 0d87093..24f7e43 100644
--- a/src/memberdef.cpp
+++ b/src/memberdef.cpp
@@ -31,7 +31,7 @@
 #include "doc.h"
 #include "groupdef.h"
 #include "defargs.h"
-#include "xml.h"
+//#include "xml.h"
 
 //-----------------------------------------------------------------------------
 
@@ -509,43 +509,44 @@ void MemberDef::writeDeclaration(OutputList &ol,
     
     if (!Config::genTagFile.isEmpty())
     {
-      tagFile << "    <member kind=\"";
+      Doxygen::tagFile << "    <member kind=\"";
       switch (mtype)
       {
-        case Define:      tagFile << "define";      break;
-        case EnumValue:   tagFile << "enumvalue";   break;
-        case Property:    tagFile << "property";    break;
-        case Variable:    tagFile << "variable";    break;
-        case Typedef:     tagFile << "typedef";     break;
-        case Enumeration: tagFile << "enumeration"; break;
-        case Function:    tagFile << "function";    break;
-        case Signal:      tagFile << "signal";      break;
-        case Prototype:   tagFile << "prototype";   break;
-        case Friend:      tagFile << "friend";      break;
-        case DCOP:        tagFile << "dcop";        break;
-        case Slot:        tagFile << "slot";        break;
+        case Define:      Doxygen::tagFile << "define";      break;
+        case EnumValue:   Doxygen::tagFile << "enumvalue";   break;
+        case Property:    Doxygen::tagFile << "property";    break;
+        case Variable:    Doxygen::tagFile << "variable";    break;
+        case Typedef:     Doxygen::tagFile << "typedef";     break;
+        case Enumeration: Doxygen::tagFile << "enumeration"; break;
+        case Function:    Doxygen::tagFile << "function";    break;
+        case Signal:      Doxygen::tagFile << "signal";      break;
+        case Prototype:   Doxygen::tagFile << "prototype";   break;
+        case Friend:      Doxygen::tagFile << "friend";      break;
+        case DCOP:        Doxygen::tagFile << "dcop";        break;
+        case Slot:        Doxygen::tagFile << "slot";        break;
       }
       if (prot!=Public)
       {
-        tagFile << "\" protection=\"";
-        if (prot==Protected) tagFile << "public";
-        else /* Private */   tagFile << "protected"; 
+        Doxygen::tagFile << "\" protection=\"";
+        if (prot==Protected) Doxygen::tagFile << "public";
+        else /* Private */   Doxygen::tagFile << "protected"; 
       }
       if (virt!=Normal)
       {
-        tagFile << "\" virtualness=\"";
-        if (virt==Virtual) tagFile << "virtual";
-        else /* Pure */    tagFile << "pure"; 
+        Doxygen::tagFile << "\" virtualness=\"";
+        if (virt==Virtual) Doxygen::tagFile << "virtual";
+        else /* Pure */    Doxygen::tagFile << "pure"; 
       }
       if (isStatic())
       {
-        tagFile << "\" static=\"yes";
+        Doxygen::tagFile << "\" static=\"yes";
       }
-      tagFile << "\">" << endl;
-      tagFile << "      <name>" << convertToXML(name()) << "</name>" << endl;
-      tagFile << "      <anchor>" << convertToXML(anchor()) << "</anchor>" << endl;
-      tagFile << "      <arglist>" << convertToXML(argsString()) << "</arglist>" << endl;
-      tagFile << "    </member>" << endl;
+      Doxygen::tagFile << "\">" << endl;
+      Doxygen::tagFile << "      <name>" << convertToXML(name()) << "</name>" << endl;
+      Doxygen::tagFile << "      <anchor>" << convertToXML(anchor()) << "</anchor>" << endl;
+      Doxygen::tagFile << "      <arglist>" << convertToXML(argsString()) << "</arglist>" << endl;
+      writeDocAnchorsToTagFile();
+      Doxygen::tagFile << "    </member>" << endl;
     }
       
     Definition *d=0;
@@ -761,7 +762,9 @@ void MemberDef::writeDeclaration(OutputList &ol,
         // descriptions are enabled or there is no detailed description.
       {
         if (annMemb) annMemb->annUsed=annUsed=TRUE;
-        ol.writeBoldString(name());
+        ol.startBold();
+        ol.docify(name());
+        ol.endBold();
       }
     }
 
@@ -819,6 +822,7 @@ void MemberDef::writeDeclaration(OutputList &ol,
       parseDoc(ol,defFileName,defLine,cname,name(),briefDescription());
       if (/*!documentation().isEmpty()*/ detailsAreVisible()) 
       {
+        ol.pushGeneratorState();
         ol.disableAllBut(OutputGenerator::Html);
         ol.endEmphasis();
         ol.docify(" ");
@@ -833,7 +837,7 @@ void MemberDef::writeDeclaration(OutputList &ol,
         parseText(ol,theTranslator->trMore());
         ol.endTextLink();
         ol.startEmphasis();
-        ol.enableAll();
+        ol.popGeneratorState();
       }
       //ol.newParagraph();
       ol.endMemberDescription();
@@ -1449,187 +1453,6 @@ QCString MemberDef::getScopeString() const
   return result;
 }
 
-void MemberDef::generateXML(QTextStream &t,Definition *def)
-{
-  if (mtype==EnumValue) return;
-
-  QCString scopeName;
-  if (getClassDef()) 
-    scopeName=getClassDef()->name();
-  else if (getNamespaceDef()) 
-    scopeName=getNamespaceDef()->name();
-    
-  t << "            <";
-  enum { define_t,variable_t,typedef_t,enum_t,function_t } xmlType = function_t;
-  switch (mtype)
-  {
-    case Define:      t << "definedef";   xmlType=define_t;   break;
-    case EnumValue:   // fall through
-    case Property:    // fall through
-    case Variable:    t << "variabledef"; xmlType=variable_t; break;
-    case Typedef:     t << "typedef";     xmlType=typedef_t;  break;
-    case Enumeration: t << "enumdef";     xmlType=enum_t;     break;
-    case Function:    // fall through
-    case Signal:      // fall through
-    case Prototype:   // fall through
-    case Friend:      // fall through
-    case DCOP:        // fall through
-    case Slot:        t << "functiondef"; xmlType=function_t; break;
-  }
-  t << " id=\"";
-  t << def->getOutputFileBase()
-    << "__"      // can we change this to a non ID char? 
-                 // : do not seem allowed for some parsers!
-    << anchor();
-  t << "\"";
-  if (xmlType==function_t && virtualness()!=Normal) 
-    // functions has an extra "virt" attribute
-  {
-    t << " virt=\"";
-    switch (virtualness())
-    {
-      case Virtual: t << "virtual";      break;
-      case Pure:    t << "pure-virtual"; break;
-      default: ASSERT(0);
-    }
-    t << "\"";
-  }
-  t << ">" << endl;
-  
-  if (xmlType!=define_t && xmlType!=enum_t &&    // These don't have types.
-      (xmlType!=function_t || !type.isEmpty()) // Type is optional here.
-     )
-  {
-    QCString typeStr = replaceAnonymousScopes(type);
-    if (xmlType==typedef_t && typeStr.left(8)=="typedef ") 
-      typeStr=typeStr.right(typeStr.length()-8);
-    if (xmlType==function_t && typeStr.left(8)=="virtual ") 
-      typeStr=typeStr.right(typeStr.length()-8);
-    t << "              <type>";
-    linkifyText(TextGeneratorXMLImpl(t),scopeName,name(),typeStr);
-    t << "</type>" << endl;
-  }
-
-  t << "              <name>";
-  writeXMLString(t,name());
-  t << "</name>" << endl;
-  if (xmlType==function_t) //function
-  {
-    t << "              <paramlist>" << endl;
-    ArgumentList *declAl = new ArgumentList;
-    ArgumentList *defAl = argList;
-    stringToArgumentList(args,declAl);
-    if (declAl->count()>0)
-    {
-      ArgumentListIterator declAli(*declAl);
-      ArgumentListIterator defAli(*defAl);
-      Argument *a;
-      for (declAli.toFirst();(a=declAli.current());++declAli)
-      {
-        Argument *defArg = defAli.current();
-        t << "                <param>" << endl;
-        if (!a->attrib.isEmpty())
-        {
-          t << "                  <attributes>";
-          writeXMLString(t,a->attrib);
-          t << "</attributes>" << endl;
-        }
-        if (!a->type.isEmpty())
-        {
-          t << "                  <type>";
-          linkifyText(TextGeneratorXMLImpl(t),scopeName,name(),a->type);
-          t << "</type>" << endl;
-        }
-        if (!a->name.isEmpty())
-        {
-          t << "                  <declname>";
-          writeXMLString(t,a->name); 
-          t << "</declname>" << endl;
-        }
-        if (defArg && !defArg->name.isEmpty() && defArg->name!=a->name)
-        {
-          t << "                  <defname>";
-          writeXMLString(t,defArg->name);
-          t << "</defname>" << endl;
-        }
-        if (!a->array.isEmpty())
-        {
-          t << "                  <array>"; 
-          writeXMLString(t,a->array); 
-          t << "</array>" << endl;
-        }
-        if (!a->defval.isEmpty())
-        {
-          t << "                  <defval>";
-          linkifyText(TextGeneratorXMLImpl(t),scopeName,name(),a->defval);
-          t << "</defval>" << endl;
-        }
-        t << "                </param>" << endl;
-        if (defArg) ++defAli;
-      }
-    }
-    delete declAl;
-    t << "              </paramlist>" << endl;
-  }
-  else if (xmlType==define_t && !args.isEmpty()) // define
-  {
-    t << "              <defparamlist>" << endl;
-    ArgumentListIterator ali(*argList);
-    Argument *a;
-    for (ali.toFirst();(a=ali.current());++ali)
-    {
-      t << "                <defarg>" << a->type << "</defarg>" << endl;
-    }
-    t << "              </defparamlist>" << endl;
-    if (!init.isEmpty())
-    {
-      t << "             <initializer>";
-      linkifyText(TextGeneratorXMLImpl(t),scopeName,name(),init);
-      t << "</initializer>" << endl;
-    }
-  }
-  else if (xmlType==enum_t) // enum
-  {
-    t << "              <enumvaluelist>" << endl;
-    if (enumFields)
-    {
-      MemberListIterator emli(*enumFields);
-      MemberDef *emd;
-      for (emli.toFirst();(emd=emli.current());++emli)
-      {
-        t << "                <enumvalue>" << endl;
-        t << "                  <name>";
-        writeXMLString(t,emd->name());
-        t << "</name>" << endl;
-        if (!emd->init.isEmpty())
-        {
-          t << "                  <initializer>";
-          writeXMLString(t,emd->init);
-          t << "</initializer>" << endl;
-        }
-        t << "                </enumvalue>" << endl;
-      }
-    }
-    t << "              </enumvaluelist>" << endl;
-  }
-  t << "            </";
-  switch (mtype)
-  {
-    case Define:      t << "definedef";   break;
-    case EnumValue:   // fall through
-    case Property:    // fall through
-    case Variable:    t << "variabledef"; break;
-    case Typedef:     t << "typedef";     break;
-    case Enumeration: t << "enumdef";     break;
-    case Function:    // fall through
-    case Signal:      // fall through
-    case Prototype:   // fall through
-    case Friend:      // fall through
-    case DCOP:        // fall through
-    case Slot:        t << "functiondef"; break;
-  }
-  t << ">" << endl;
-}
 
 Definition *MemberDef::getCompoundDef() const
 {
diff --git a/src/memberdef.h b/src/memberdef.h
index 36b3c45..a230e6d 100644
--- a/src/memberdef.h
+++ b/src/memberdef.h
@@ -220,7 +220,7 @@ class MemberDef : public Definition
 
     QCString getScopeString() const;
     
-    void generateXML(QTextStream &t,Definition *def);
+    //void generateXML(QTextStream &t,Definition *def);
     
   private:
     ClassDef   *classDef;     // member of or related to 
diff --git a/src/memberlist.cpp b/src/memberlist.cpp
index 142e2f2..2a72173 100644
--- a/src/memberlist.cpp
+++ b/src/memberlist.cpp
@@ -292,17 +292,19 @@ void MemberList::writePlainDeclarations(OutputList &ol,
             {
               if (!Config::genTagFile.isEmpty())
               {
-                tagFile << "    <member kind=\"enumeration\">" << endl;
-                tagFile << "      <name>" << convertToXML(md->name()) << "</name>" << endl; 
-                tagFile << "      <anchor>" << convertToXML(md->anchor()) << "</anchor>" << endl; 
-                tagFile << "      <arglist>" << convertToXML(md->argsString()) << "</arglist>" << endl; 
-                tagFile << "    </member>" << endl;
+                Doxygen::tagFile << "    <member kind=\"enumeration\">" << endl;
+                Doxygen::tagFile << "      <name>" << convertToXML(md->name()) << "</name>" << endl; 
+                Doxygen::tagFile << "      <anchor>" << convertToXML(md->anchor()) << "</anchor>" << endl; 
+                Doxygen::tagFile << "      <arglist>" << convertToXML(md->argsString()) << "</arglist>" << endl; 
+                Doxygen::tagFile << "    </member>" << endl;
               }
               md->writeLink(typeDecl,cd,nd,fd,gd);
             }
             else
             {
-              typeDecl.writeBoldString(name);
+              typeDecl.startBold();
+              typeDecl.docify(name);
+              typeDecl.endBold();
             }
             typeDecl.writeChar(' ');
           }
@@ -332,17 +334,19 @@ void MemberList::writePlainDeclarations(OutputList &ol,
               {
               if (!Config::genTagFile.isEmpty())
               {
-                tagFile << "    <member kind=\"enumvalue\">" << endl;
-                tagFile << "      <name>" << convertToXML(fmd->name()) << "</name>" << endl; 
-                tagFile << "      <anchor>" << convertToXML(fmd->anchor()) << "</anchor>" << endl; 
-                tagFile << "      <arglist>" << convertToXML(fmd->argsString()) << "</arglist>" << endl; 
-                tagFile << "    </member>" << endl;
+                Doxygen::tagFile << "    <member kind=\"enumvalue\">" << endl;
+                Doxygen::tagFile << "      <name>" << convertToXML(fmd->name()) << "</name>" << endl; 
+                Doxygen::tagFile << "      <anchor>" << convertToXML(fmd->anchor()) << "</anchor>" << endl; 
+                Doxygen::tagFile << "      <arglist>" << convertToXML(fmd->argsString()) << "</arglist>" << endl; 
+                Doxygen::tagFile << "    </member>" << endl;
               }
                 fmd->writeLink(typeDecl,cd,nd,fd,gd);
               }
               else // no docs for this enum value
               {
-                typeDecl.writeBoldString(fmd->name());
+                typeDecl.startBold();
+                typeDecl.docify(fmd->name());
+                typeDecl.endBold();
               }
               if (!fmd->initializer().isEmpty()) // enum value has initializer
               {
@@ -485,7 +489,9 @@ void MemberList::writePlainDeclarations(OutputList &ol,
             ol.startMemberItem(0);
             ol.docify("class ");
             ol.insertMemberAlign();
-            ol.writeBoldString(md->name());
+            ol.startBold();
+            ol.docify(md->name());
+            ol.endBold();
             ol.endMemberItem(FALSE);
           }
         }
diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp
index 9fe1a01..7dc3023 100644
--- a/src/namespacedef.cpp
+++ b/src/namespacedef.cpp
@@ -97,8 +97,8 @@ void NamespaceDef::addMemberListToGroup(MemberList *ml,
     int groupId=md->getMemberGroupId();
     if ((md->*func)() && groupId!=-1)
     {
-      QCString *pGrpHeader = memberHeaderDict[groupId];
-      QCString *pDocs      = memberDocDict[groupId];
+      QCString *pGrpHeader = Doxygen::memberHeaderDict[groupId];
+      QCString *pDocs      = Doxygen::memberDocDict[groupId];
       if (pGrpHeader)
       {
         MemberGroup *mg = memberGroupDict->find(groupId);
@@ -200,9 +200,9 @@ void NamespaceDef::writeDocumentation(OutputList &ol)
   
   if (!Config::genTagFile.isEmpty())
   {
-    tagFile << "  <compound kind=\"namespace\">" << endl;
-    tagFile << "    <name>" << convertToXML(name()) << "</name>" << endl;
-    tagFile << "    <filename>" << convertToXML(fileName) << ".html</filename>" << endl;
+    Doxygen::tagFile << "  <compound kind=\"namespace\">" << endl;
+    Doxygen::tagFile << "    <name>" << convertToXML(name()) << "</name>" << endl;
+    Doxygen::tagFile << "    <filename>" << convertToXML(fileName) << ".html</filename>" << endl;
   }
   
   ol.startTextBlock();
@@ -354,7 +354,8 @@ void NamespaceDef::writeDocumentation(OutputList &ol)
 
   if (!Config::genTagFile.isEmpty()) 
   {
-    tagFile << "  </compound>" << endl;
+    writeDocAnchorsToTagFile();
+    Doxygen::tagFile << "  </compound>" << endl;
   }
 
   ol.popGeneratorState();
diff --git a/src/outputgen.h b/src/outputgen.h
index 49bd734..12e4291 100644
--- a/src/outputgen.h
+++ b/src/outputgen.h
@@ -30,112 +30,150 @@ class DotClassGraph;
 class DotInclDepGraph;
 class DotGfxHierarchyTable;
 
-class OutputGenerator
+/*! \brief Base Interface used for generating documentation.
+ *
+ *  This abstract class is used by the documentation block
+ *  parser to generate the output for a specific format,
+ *  or a list of formats (see OutputList). This interface
+ *  contains functions that generate output.
+ */
+class BaseOutputDocInterface
 {
   public:
-    enum OutputType { Html, Latex, Man, RTF, XML };
 
-    OutputGenerator();
-    virtual ~OutputGenerator();
+    /*! Start of a bullet list: e.g. \c <ul> in html. writeListItem() is
+     *  Used for the bullet items.
+     */
+    virtual void startItemList()  = 0;
 
-    virtual OutputGenerator *copy() = 0;
-    virtual void append(const OutputGenerator *) = 0;
-    virtual void enable() = 0;
-    virtual void disable() = 0;
-    virtual void enableIf(OutputType o) = 0;
-    virtual void disableIf(OutputType o) = 0;
-    virtual void disableIfNot(OutputType o) = 0;
-    virtual bool isEnabled(OutputType o) = 0;
-    virtual OutputGenerator *get(OutputType o) = 0;
+    /*! Writes a list item for a bullet or enumerated 
+     *  list: e.g. \c <li> in html 
+     */
+    virtual void writeListItem()  = 0;
 
-    virtual void startFile(const char *name,const char *title,bool ext) = 0;
-    virtual void writeFooter(int,bool) = 0;
-    virtual void endFile() = 0;
-    virtual void startIndexSection(IndexSections) = 0;
-    virtual void endIndexSection(IndexSections) = 0;
-    virtual void startProjectNumber() = 0;
-    virtual void endProjectNumber() = 0;
-    virtual void writeStyleInfo(int part) = 0;
-    virtual void startTitleHead(const char *) = 0;
-    virtual void endTitleHead(const char *fileName,const char *name) = 0;
-    virtual void startTitle() = 0;
-    virtual void endTitle()   = 0;
-    virtual void newParagraph()   = 0;
-    virtual void writeString(const char *text) = 0;
-    virtual void startIndexList() = 0;
-    virtual void endIndexList()   = 0;
-    virtual void startItemList()  = 0;
+    /*! Ends a bullet list: e.g. \c </ul> in html */
     virtual void endItemList()    = 0;
+
+    /*! Writes an ASCII string to the output. Converts characters that have
+     *  A special meaning, like \c & in html. 
+     */
+    virtual void docify(const char *s) = 0;
+
+    /*! Writes a single ASCII character to the output. Converts characters
+     *  that have a special meaning.
+     */
+    virtual void writeChar(char c) = 0;
+
+    /*! Writes an ASCII string to the output, \e without converting 
+     *  special characters. 
+     */
+    virtual void writeString(const char *text) = 0;
+
+    /*! Starts a new paragraph */
+    virtual void newParagraph()   = 0;
+
+    /*! Starts a enumeration list: e.g. \c <ol> in html. 
+     *  writeListItem() is used for the items. 
+     */
     virtual void startEnumList()  = 0;
+
+    /*! Ends an enumeration list: e.g. \c </ol> in html. 
+     */
     virtual void endEnumList()    = 0;
-    virtual void startBold()      = 0;
-    virtual void endBold()        = 0;
-    virtual void startAlphabeticalIndexList() = 0;
-    virtual void endAlphabeticalIndexList() = 0;
-    virtual void writeIndexHeading(const char *s) = 0;
-    virtual void writeIndexItem(const char *ref,const char *file,
-                                const char *text) = 0;
-    virtual void docify(const char *s) = 0;
-    virtual void codify(const char *s) = 0;
+
+    /*! Writes a link to an object in the documentation.
+     *  \param ref    If this is non-zero, the object is to be found in
+     *                an external documentation file.
+     *  \param file   The file in which the object is located.
+     *  \param anchor The anchor uniquely identifying the object within 
+     *                the file. 
+     *  \param text   The text to display as a placeholder for the link.
+     */
     virtual void writeObjectLink(const char *ref,const char *file,
                                  const char *anchor, const char *text) = 0;
+
+    /*! Writes a link to an object in a code fragment.
+     *  \param ref    If this is non-zero, the object is to be found in
+     *                an external documentation file.
+     *  \param file   The file in which the object is located.
+     *  \param anchor The anchor uniquely identifying the object within 
+     *                the file. 
+     *  \param text   The text to display as a placeholder for the link.
+     */
     virtual void writeCodeLink(const char *ref,const char *file,
                                const char *anchor,const char *text) = 0;
-    virtual void startTextLink(const char *file,const char *anchor) = 0;
-    virtual void endTextLink() = 0;
+
+    /*! Writes a (link to an) URL found in the documentation.
+     *  \param url    To URL to link to.
+     *  \param text   The text to display as a placeholder for the link.
+     */
     virtual void writeHtmlLink(const char *url,const char *text) = 0;
+
+    /*! Writes a (link to an) email address found in the documentation.
+     *  \param url    To email address, this is also used for the link text.
+     */
     virtual void writeMailLink(const char *url) = 0;
+    
+    /*! Changes the text font to bold face. The bold section ends with
+     *  endBold()
+     */
+    virtual void startBold()      = 0;
+
+    /*! End a section of text displayed in bold face. */
+    virtual void endBold()        = 0;
+
+    /*! Changes the text font to fixed size. The section ends with
+     *  endTypewriter()
+     */
     virtual void startTypewriter() = 0;
+
+    /*! End a section of text displayed in typewriter style. */
     virtual void endTypewriter() = 0;
-    virtual void startGroupHeader() = 0;
-    virtual void endGroupHeader() = 0;
-    virtual void writeListItem() = 0;
 
-    virtual void startMemberSections() = 0;
-    virtual void endMemberSections() = 0;
-    virtual void startMemberHeader() = 0;
-    virtual void endMemberHeader() = 0;
-    virtual void startMemberSubtitle() = 0;
-    virtual void endMemberSubtitle() = 0;
-    virtual void startMemberList()  = 0;
-    virtual void endMemberList()    = 0;
-    virtual void startMemberItem(int) = 0;
-    virtual void endMemberItem(bool) = 0;
-    virtual void startMemberGroupHeader(bool) = 0;
-    virtual void endMemberGroupHeader() = 0;
-    virtual void startMemberGroupDocs() = 0;
-    virtual void endMemberGroupDocs() = 0;
-    virtual void startMemberGroup() = 0;
-    virtual void endMemberGroup(bool) = 0;
-    virtual void insertMemberAlign() = 0;
+    /*! Changes the text font to italic. The italic section ends with
+     *  endEmphasis()
+     */
+    virtual void startEmphasis() = 0;
 
-    virtual void writeRuler() = 0;
-    virtual void writeAnchor(const char *fileName,const char *name) = 0;
+    /*! Ends a section of text displayed in italic. */
+    virtual void endEmphasis() = 0;
+
+    /*! Starts a source code fragment. The fragment will be
+     *  fed to the code parser (see code.h) for syntax highlighting
+     *  and cross-referencing. The fragment ends by a call to
+     *  endCodeFragment()
+     */
     virtual void startCodeFragment() = 0;
+
+    /*! Ends a source code fragment
+     */
     virtual void endCodeFragment() = 0;
+
+    /*! Starts a fragment of preformatted text. This means that
+     *  spacing, tabs and newlines should be kept in the output
+     */
+
     virtual void startPreFragment() = 0;
+    /*! Ens a preformatted text fragment. */
+
     virtual void endPreFragment() = 0;
-    virtual void startCodeLine() = 0;
-    virtual void endCodeLine() = 0;
-    virtual void writeBoldString(const char *text) = 0;
-    virtual void startEmphasis() = 0;
-    virtual void endEmphasis() = 0;
-    virtual void writeChar(char c) = 0;
-    virtual void startMemberDoc(const char *,const char *,
-                                const char *,const char *) = 0;
-    virtual void endMemberDoc() = 0;
-    virtual void startDoxyAnchor(const char *fName,const char *anchor,
-                                 const char *name) = 0;
-    virtual void endDoxyAnchor(const char *fileName,const char *anchor) = 0;
-    virtual void startCodeAnchor(const char *label) = 0;
-    virtual void endCodeAnchor() = 0;
-    virtual void writeLatexSpacing() = 0;
-    virtual void writeStartAnnoItem(const char *type,const char *file,
-                                    const char *path,const char *name) = 0;
-    virtual void writeEndAnnoItem(const char *name) = 0;
+    /*! Writes a horizontal ruler to the output */
+    virtual void writeRuler() = 0;
+    
+    /*! Starts a description list: e.g. \c <dl> in HTML 
+     *  Items are surrounded by startDescItem() and endDescItem()
+     */
     virtual void startDescription() = 0;
+
+    /*! Ends a description list: e.g. \c </dl> in HTML */
     virtual void endDescription() = 0;
+
+    /*! Starts an item of a description list: e.g. \c <dt> in HTML. */
     virtual void startDescItem() = 0;
+
+    /*! Ends an item of a description list and starts the 
+     *  description itself: e.g. \c <dd> in HTML. 
+     */
     virtual void endDescItem() = 0;
     virtual void startSubsection() = 0;
     virtual void endSubsection() = 0;
@@ -164,52 +202,150 @@ class OutputGenerator
     virtual void writeTilde(char) = 0;
     virtual void writeRing(char) = 0;
     virtual void writeSharpS() = 0;
-    virtual void startMemberDescription() = 0;
-    virtual void endMemberDescription() = 0;
     virtual void startDescList() = 0;
+    virtual void endDescList() = 0;
     virtual void endDescTitle() = 0;
     virtual void writeDescItem() = 0;
-    virtual void endDescList() = 0;
+    virtual void startTitle() = 0;
+    virtual void endTitle()   = 0;
+    virtual void writeAnchor(const char *fileName,const char *name) = 0;
     virtual void startSection(const char *,const char *,bool) = 0;
     virtual void endSection(const char *,bool) = 0;
-    virtual void writeSectionRef(const char *,const char *,const char *) = 0;
+    virtual void writeSectionRef(const char *,const char *,
+                                 const char *,const char *) = 0;
     virtual void writeSectionRefItem(const char *,const char *,const char *) = 0;
-    virtual void writeSectionRefAnchor(const char *,const char *,const char *) = 0;
     virtual void lineBreak() = 0;
     virtual void addIndexItem(const char *s1,const char *s2) = 0;
-    virtual void startIndent() = 0;
-    virtual void endIndent() = 0;
-    virtual void writeSynopsis() = 0;
-    virtual void startClassDiagram() = 0;
-    virtual void endClassDiagram(ClassDiagram &,const char *,const char *) = 0;
-    virtual void startColorFont(uchar r,uchar g,uchar b) = 0;
-    virtual void endColorFont() = 0;
-    virtual void startPageRef() = 0;
-    virtual void endPageRef(const char *,const char *) = 0;
-    virtual void startQuickIndexItem(const char *s,const char *l) = 0;
-    virtual void endQuickIndexItem() = 0;
     virtual void writeFormula(const char *,const char *) = 0;
     virtual void writeNonBreakableSpace() = 0;
     virtual void startImage(const char *,const char *,bool) = 0;
     virtual void endImage(bool) = 0;
-    
     virtual void startDescTable() = 0;
     virtual void endDescTable() = 0;
     virtual void startDescTableTitle() = 0;
     virtual void endDescTableTitle() = 0;
     virtual void startDescTableData() = 0;
     virtual void endDescTableData() = 0;
+    virtual void startTextLink(const char *file,const char *anchor) = 0;
+    virtual void endTextLink() = 0;
+    virtual void startPageRef() = 0;
+    virtual void endPageRef(const char *,const char *) = 0;
+
+
+    virtual void startCodeLine() = 0;
+    virtual void endCodeLine() = 0;
+    virtual void startCodeAnchor(const char *label) = 0;
+    virtual void endCodeAnchor() = 0;
+    virtual void startFontClass(const char *) = 0;
+    virtual void endFontClass() = 0;
+
+    /*! Writes an ASCII string to the output. This function should keep 
+     *  spaces visible, should break lines at a newline and should convert 
+     *  tabs to the right number of spaces.
+     */
+    virtual void codify(const char *s) = 0;
+    
+};
 
+/*! \brief Abstract output generator.
+ *
+ *  Subclass this class to add support for a new output format
+ */
+class OutputGenerator : public BaseOutputDocInterface
+{
+  public:
+    enum OutputType { Html, Latex, Man, RTF, XML };
+
+    OutputGenerator();
+    virtual ~OutputGenerator();
+
+    ///////////////////////////////////////////////////////////////
+    // generic generator methods
+    ///////////////////////////////////////////////////////////////
+    virtual OutputGenerator *copy() = 0;
+    virtual void append(const OutputGenerator *) = 0;
+    virtual void enable() = 0;
+    virtual void disable() = 0;
+    virtual void enableIf(OutputType o) = 0;
+    virtual void disableIf(OutputType o) = 0;
+    virtual void disableIfNot(OutputType o) = 0;
+    virtual bool isEnabled(OutputType o) = 0;
+    virtual OutputGenerator *get(OutputType o) = 0;
+    void clear() { b.close(); a.resize(0); b.setBuffer(a); 
+                   b.open(IO_WriteOnly); t.setDevice(&b); }
+    void startPlainFile(const char *name);
+    void endPlainFile();
+    QCString getContents() const;
+    bool isEnabled() const { return active; }
+    void pushGeneratorState();
+    void popGeneratorState();
+
+    ///////////////////////////////////////////////////////////////
+    // structural output interface
+    ///////////////////////////////////////////////////////////////
+    virtual void startFile(const char *name,const char *title,bool ext) = 0;
+    virtual void writeFooter(int,bool) = 0;
+    virtual void endFile() = 0;
+    virtual void startIndexSection(IndexSections) = 0;
+    virtual void endIndexSection(IndexSections) = 0;
+    virtual void startProjectNumber() = 0;
+    virtual void endProjectNumber() = 0;
+    virtual void writeStyleInfo(int part) = 0;
+    virtual void startTitleHead(const char *) = 0;
+    virtual void endTitleHead(const char *fileName,const char *name) = 0;
+    virtual void startIndexList() = 0;
+    virtual void endIndexList()   = 0;
+    virtual void startAlphabeticalIndexList() = 0;
+    virtual void endAlphabeticalIndexList() = 0;
+    virtual void writeIndexHeading(const char *s) = 0;
+    virtual void writeIndexItem(const char *ref,const char *file,
+                                const char *text) = 0;
+    virtual void startGroupHeader() = 0;
+    virtual void endGroupHeader() = 0;
+    virtual void startMemberSections() = 0;
+    virtual void endMemberSections() = 0;
+    virtual void startMemberHeader() = 0;
+    virtual void endMemberHeader() = 0;
+    virtual void startMemberSubtitle() = 0;
+    virtual void endMemberSubtitle() = 0;
+    virtual void startMemberList()  = 0;
+    virtual void endMemberList()    = 0;
+    virtual void startMemberItem(int) = 0;
+    virtual void endMemberItem(bool) = 0;
+    virtual void startMemberGroupHeader(bool) = 0;
+    virtual void endMemberGroupHeader() = 0;
+    virtual void startMemberGroupDocs() = 0;
+    virtual void endMemberGroupDocs() = 0;
+    virtual void startMemberGroup() = 0;
+    virtual void endMemberGroup(bool) = 0;
+    virtual void insertMemberAlign() = 0;
+    virtual void startMemberDoc(const char *,const char *,
+                                const char *,const char *) = 0;
+    virtual void endMemberDoc() = 0;
+    virtual void startDoxyAnchor(const char *fName,const char *anchor,
+                                 const char *name) = 0;
+    virtual void endDoxyAnchor(const char *fileName,const char *anchor) = 0;
+    virtual void writeLatexSpacing() = 0;
+    virtual void writeStartAnnoItem(const char *type,const char *file,
+                                    const char *path,const char *name) = 0;
+    virtual void writeEndAnnoItem(const char *name) = 0;
+    virtual void startMemberDescription() = 0;
+    virtual void endMemberDescription() = 0;
+    virtual void startIndent() = 0;
+    virtual void endIndent() = 0;
+    virtual void writeSynopsis() = 0;
+    virtual void startClassDiagram() = 0;
+    virtual void endClassDiagram(ClassDiagram &,const char *,const char *) = 0;
     virtual void startDotGraph() = 0;
     virtual void endDotGraph(DotClassGraph &g) = 0;
     virtual void startInclDepGraph() = 0;
     virtual void endInclDepGraph(DotInclDepGraph &g) = 0;
     virtual void writeGraphicalHierarchy(DotGfxHierarchyTable &g) = 0;
-
+    virtual void startQuickIndexItem(const char *s,const char *l) = 0;
+    virtual void endQuickIndexItem() = 0;
     virtual void startTextBlock(bool) = 0;
     virtual void endTextBlock() = 0;
     virtual void lastIndexPage() = 0;
-
     virtual void startMemberDocPrefixItem() = 0;
     virtual void endMemberDocPrefixItem() = 0;
     virtual void startMemberDocName() = 0;
@@ -217,18 +353,6 @@ class OutputGenerator
     virtual void startParameter(bool) = 0;
     virtual void endParameter(bool) = 0;
 
-    virtual void startFontClass(const char *) = 0;
-    virtual void endFontClass() = 0;
-
-    
-    void clear() { b.close(); a.resize(0); b.setBuffer(a); 
-                   b.open(IO_WriteOnly); t.setDevice(&b); }
-    void startPlainFile(const char *name);
-    void endPlainFile();
-    QCString getContents() const;
-    bool isEnabled() const { return active; }
-    void pushGeneratorState();
-    void popGeneratorState();
   protected:
     QTextStream fs;
     QByteArray a;
@@ -244,4 +368,61 @@ class OutputGenerator
     QStack<bool> *genStack;
 };
 
+/*! \brief Base Interface used for generating documentation.
+ *
+ *  This abstract class is used by the documentation block
+ *  parser to generate the output for a specific format. 
+ *  This interface contains some state saving and changing
+ *  functions for dealing with format specific output.
+ */
+class OutputDocInterface : public BaseOutputDocInterface
+{
+  public:
+    /*! Create a new output generator. This can later by appended
+     *  to the current one using append().
+     */
+    virtual OutputDocInterface *clone() = 0;
+
+    /*! Disables all output formats except format \a o 
+     *  (useful for OutputList only) 
+     */
+    virtual void disableAllBut(OutputGenerator::OutputType o) = 0;
+
+    /*! Enables all output formats as far as they have been enabled in
+     *  the config file. (useful for OutputList only) 
+     */
+    virtual void enableAll() = 0;
+
+    /*! Disables all output formats (useful for OutputList only) */
+    virtual void disableAll()= 0;
+
+    /*! Disables a specific output format (useful for OutputList only) */
+    virtual void disable(OutputGenerator::OutputType o) = 0;
+
+    /*! Enables a specific output format (useful for OutputList only) */
+    virtual void enable(OutputGenerator::OutputType o) = 0;
+
+    /*! Check whether a specific output format is currenly enabled 
+     *  (useful for OutputList only) 
+     */
+    virtual bool isEnabled(OutputGenerator::OutputType o) = 0;
+
+    /*! Appends the output generated by generator \a g to this
+     *  generator.
+     */ 
+    virtual void append(const OutputDocInterface *g) = 0;
+
+    /*! Pushes the state of the current generator (or list of 
+     *  generators) on a stack.
+     */
+    virtual void pushGeneratorState() = 0;
+
+    /*! Pops the state of the current generator (or list of 
+     *  generators) on a stack. Should be preceded by a call
+     *  the pushGeneratorState().
+     */
+    virtual void popGeneratorState() = 0;
+};
+
+
 #endif
diff --git a/src/outputlist.h b/src/outputlist.h
index 2d57034..5b1899c 100644
--- a/src/outputlist.h
+++ b/src/outputlist.h
@@ -37,11 +37,11 @@ class DotClassGraph;
 class DotInclDepGraph;
 class DotGfxHierarchyTable;
 
-class OutputList
+class OutputList : public OutputDocInterface
 {
   public:
     OutputList(bool);
-   ~OutputList();
+    virtual ~OutputList();
     OutputList(const OutputList *ol);
     OutputList &operator=(const OutputList &ol);
     OutputList &operator+=(const OutputList &ol);
@@ -56,7 +56,20 @@ class OutputList
     bool isEnabled(OutputGenerator::OutputType o);
     void pushGeneratorState();
     void popGeneratorState();
-    
+
+    //////////////////////////////////////////////////
+    // OutputDocInterface implementation
+    //////////////////////////////////////////////////
+
+    OutputDocInterface *clone()
+    {
+      return new OutputList(this);
+    }
+    void append(const OutputDocInterface *g)
+    {
+      operator+=(*(OutputList *)g);
+    }
+
     //void writeIndex() 
     //{ forall(&OutputGenerator::writeIndex); }
     void startIndexSection(IndexSections is)
@@ -190,8 +203,8 @@ class OutputList
     { forall(&OutputGenerator::startCodeLine); }
     void endCodeLine() 
     { forall(&OutputGenerator::endCodeLine); }
-    void writeBoldString(const char *text)
-    { forall(&OutputGenerator::writeBoldString,text); }
+    //void writeBoldString(const char *text)
+    //{ forall(&OutputGenerator::writeBoldString,text); }
     void startEmphasis() 
     { forall(&OutputGenerator::startEmphasis); }
     void endEmphasis() 
@@ -303,12 +316,13 @@ class OutputList
     { forall(&OutputGenerator::startSection,lab,title,sub); }
     void endSection(const char *lab,bool sub)
     { forall(&OutputGenerator::endSection,lab,sub); }
-    void writeSectionRef(const char *page,const char *lab, const char *title)
-    { forall(&OutputGenerator::writeSectionRef,page,lab,title); }
+    void writeSectionRef(const char *ref,const char *file,
+                         const char *anchor, const char *title)
+    { forall(&OutputGenerator::writeSectionRef,ref,file,anchor,title); }
     void writeSectionRefItem(const char *page,const char *lab, const char *title)
     { forall(&OutputGenerator::writeSectionRefItem,page,lab,title); }
-    void writeSectionRefAnchor(const char *page,const char *lab, const char *title)
-    { forall(&OutputGenerator::writeSectionRefAnchor,page,lab,title); }
+    //void writeSectionRefAnchor(const char *page,const char *lab, const char *title)
+    //{ forall(&OutputGenerator::writeSectionRefAnchor,page,lab,title); }
     void addIndexItem(const char *s1,const char *s2)
     { forall(&OutputGenerator::addIndexItem,s1,s2); }
     void writeSynopsis() 
@@ -317,10 +331,10 @@ class OutputList
     { forall(&OutputGenerator::startClassDiagram); }
     void endClassDiagram(ClassDiagram &d,const char *f,const char *n)
     { forall(&OutputGenerator::endClassDiagram,d,f,n); }
-    void startColorFont(uchar r,uchar g,uchar b)
-    { forall(&OutputGenerator::startColorFont,r,g,b); }
-    void endColorFont()
-    { forall(&OutputGenerator::endColorFont); }
+    //void startColorFont(uchar r,uchar g,uchar b)
+    //{ forall(&OutputGenerator::startColorFont,r,g,b); }
+    //void endColorFont()
+    //{ forall(&OutputGenerator::endColorFont); }
     void startPageRef()
     { forall(&OutputGenerator::startPageRef); }
     void endPageRef(const char *c,const char *a)
diff --git a/src/packagedef.cpp b/src/packagedef.cpp
index 308f1f1..4bdedbb 100644
--- a/src/packagedef.cpp
+++ b/src/packagedef.cpp
@@ -74,7 +74,7 @@ void PackageDef::writeDocumentation(OutputList &ol)
 
   if (!Config::genTagFile.isEmpty())
   {
-    tagFile << "  <compound kind=\"package\">" << endl;
+    Doxygen::tagFile << "  <compound kind=\"package\">" << endl;
   }
   
   ol.startMemberSections();
@@ -87,7 +87,8 @@ void PackageDef::writeDocumentation(OutputList &ol)
 
   if (!Config::genTagFile.isEmpty())
   {
-    tagFile << "  </compound>" << endl;
+    writeDocAnchorsToTagFile();
+    Doxygen::tagFile << "  </compound>" << endl;
   }
   
   if (!briefDescription().isEmpty() || !documentation().isEmpty())
diff --git a/src/page.h b/src/page.h
index dac8d19..1b67ca5 100644
--- a/src/page.h
+++ b/src/page.h
@@ -18,12 +18,14 @@
 #include "sortdict.h"
 #include "config.h"
 
+#include "section.h"
+
 class PageInfo
 {
   public:
     PageInfo(const char *f, int l,const char *n,const char *d,const char *t) :
       defFileName(f), defLine(l), name(n), 
-      doc(d), title(t), todoId(0), testId(0),inGroup(0) {}
+      doc(d), title(t), todoId(0), testId(0),inGroup(0), sectionDict(0) {}
 
     // where the page definition was found
     QCString defFileName;
@@ -36,19 +38,62 @@ class PageInfo
 
     // external reference? if so then this is the tag file name
     QCString reference;
+    QCString fileName;
 
     // functions to get a uniform interface with Definitions
     QCString getOutputFileBase() const 
-    { if (Config::caseSensitiveNames) return name; else return name.lower(); }
+    { return fileName; }
     bool isReference() const { return !reference.isEmpty(); }
     QCString getReference() const { return reference; }
     
+    void addSections(QList<QCString> *anchorList)
+    {
+      if (anchorList)
+      {
+        QCString *s=anchorList->first();
+        while (s)
+        {
+          SectionInfo *si=0;
+          if (!s->isEmpty() && (si=Doxygen::sectionDict[*s]))
+          {
+            //printf("Add section `%s' to definition `%s'\n",
+            //    si->label.data(),n.data());
+            if (sectionDict==0) 
+            {
+              sectionDict = new SectionDict(17);
+            }
+            if (sectionDict->find(*s)==0)
+            {
+              sectionDict->insert(*s,si);
+            }
+            si->pageRef = this;
+            si->fileName = fileName;
+          }
+          s=anchorList->next();
+        }
+      }
+    }
+    
+    void writeDocAnchorsToTagFile()
+    {
+      if (!Config::genTagFile.isEmpty() && sectionDict)
+      {
+        QDictIterator<SectionInfo> sdi(*sectionDict);
+        SectionInfo *si;
+        for (;(si=sdi.current());++sdi)
+        {
+          Doxygen::tagFile << "    <docanchor>" << si->label << "</docanchor>" << endl;
+        }
+      }
+    }
+
     // ids
     int todoId;
     int testId;
 
     // is this page part of a group
     GroupDef *inGroup;
+    SectionDict *sectionDict;
 };
 
 class PageSDict : public SDict<PageInfo>
diff --git a/src/pre.l b/src/pre.l
index 3b29529..4cb163b 100644
--- a/src/pre.l
+++ b/src/pre.l
@@ -99,7 +99,7 @@ static void setFileName(const char *name)
 {
   bool ambig;
   g_yyFileName=name;
-  g_yyFileDef=findFileDef(inputNameDict,g_yyFileName,ambig);
+  g_yyFileDef=findFileDef(Doxygen::inputNameDict,g_yyFileName,ambig);
 }
 
 static void incrLevel()
@@ -799,7 +799,7 @@ Define *newDefine()
   def->lineNr = g_yyLineNr;
   def->varArgs = g_defVarArgs;
   //printf("newDefine: `%s'->`%s'\n",def->name.data(),def->definition.data());
-  if (!def->name.isEmpty() && expandAsDefinedDict[def->name])
+  if (!def->name.isEmpty() && Doxygen::expandAsDefinedDict[def->name])
   {
     def->isPredefined=TRUE;
   }
@@ -828,12 +828,12 @@ void addDefine()
   md->setFileDef(g_yyFileDef);
   md->setDefinition("#define "+g_defName);
 
-  MemberName *mn=functionNameDict[g_defName];
+  MemberName *mn=Doxygen::functionNameDict[g_defName];
   if (mn==0)
   {
     mn = new MemberName(g_defName);
-    functionNameList.append(mn);
-    functionNameDict.insert(g_defName,mn);
+    Doxygen::functionNameList.append(mn);
+    Doxygen::functionNameDict.insert(g_defName,mn);
   }
   mn->append(md);
   if (g_yyFileDef) g_yyFileDef->insertMember(md);
@@ -912,7 +912,7 @@ static void readIncludeFile(const QCString &inc)
       if (oldFileDef) 
       {
 	bool ambig;
-	FileDef *fd = findFileDef(inputNameDict,incFileName,ambig);
+	FileDef *fd = findFileDef(Doxygen::inputNameDict,incFileName,ambig);
 	// add include dependency to the file in which the #include was found
 	oldFileDef->addIncludeDependency(fd,incFileName,localInclude);
 	// add included by dependency
diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp
index b8d48ad..181f1a8 100644
--- a/src/rtfgen.cpp
+++ b/src/rtfgen.cpp
@@ -810,7 +810,7 @@ void RTFGenerator::startIndexSection(IndexSections is)
     case isPackageDocumentation:
       {
         //Package Documentation
-        PackageSDict::Iterator pdi(packageDict);
+        PackageSDict::Iterator pdi(Doxygen::packageDict);
         PackageDef *pd=pdi.toFirst();
         bool found=FALSE;
         while (pd && !found)
@@ -825,7 +825,7 @@ void RTFGenerator::startIndexSection(IndexSections is)
     case isModuleDocumentation:
       {
         //Module Documentation
-        GroupDef *gd=groupList.first();
+        GroupDef *gd=Doxygen::groupList.first();
         bool found=FALSE;
         while (gd && !found)
         {
@@ -834,14 +834,14 @@ void RTFGenerator::startIndexSection(IndexSections is)
             beginRTFChapter();
             found=TRUE;
           }
-          gd=groupList.next();
+          gd=Doxygen::groupList.next();
         }
       }
       break;
     case isNamespaceDocumentation:
       {
         // Namespace Documentation
-        NamespaceDef *nd=namespaceList.first();
+        NamespaceDef *nd=Doxygen::namespaceList.first();
         bool found=FALSE;
         while (nd && !found)
         {
@@ -850,14 +850,14 @@ void RTFGenerator::startIndexSection(IndexSections is)
             beginRTFChapter();
             found=TRUE;
           }
-          nd=namespaceList.next();
+          nd=Doxygen::namespaceList.next();
         } 
       }
       break;
     case isClassDocumentation:
       {
         //Compound Documentation
-        ClassDef *cd=classList.first();
+        ClassDef *cd=Doxygen::classList.first();
         bool found=FALSE;
         while (cd && !found)
         {
@@ -866,7 +866,7 @@ void RTFGenerator::startIndexSection(IndexSections is)
             beginRTFChapter();
             found=TRUE;
           }
-          cd=classList.next();
+          cd=Doxygen::classList.next();
         }
       }
       break;
@@ -874,7 +874,7 @@ void RTFGenerator::startIndexSection(IndexSections is)
       {
         //File Documentation
         bool isFirst=TRUE;
-        FileName *fn=inputNameList.first();
+        FileName *fn=Doxygen::inputNameList.first();
         while (fn)
         {
           FileDef *fd=fn->first();
@@ -891,7 +891,7 @@ void RTFGenerator::startIndexSection(IndexSections is)
             }
             fd=fn->next();
           }
-          fn=inputNameList.next();
+          fn=Doxygen::inputNameList.next();
         }
       }
       break;
@@ -988,7 +988,7 @@ void RTFGenerator::endIndexSection(IndexSections is)
       break;
     case isPackageDocumentation:
       {
-        PackageSDict::Iterator pdi(packageDict);
+        PackageSDict::Iterator pdi(Doxygen::packageDict);
         PackageDef *pd=pdi.toFirst();
         t << "{\\tc \\v " << theTranslator->trPackageDocumentation() << "}"<< endl;
         while (pd)
@@ -1004,7 +1004,7 @@ void RTFGenerator::endIndexSection(IndexSections is)
       break;
     case isModuleDocumentation:
       {
-        GroupDef *gd=groupList.first();
+        GroupDef *gd=Doxygen::groupList.first();
         t << "{\\tc \\v " << theTranslator->trModuleDocumentation() << "}"<< endl;
         while (gd)
         {
@@ -1015,13 +1015,13 @@ void RTFGenerator::endIndexSection(IndexSections is)
             t << gd->getOutputFileBase();
             t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
           }
-          gd=groupList.next();
+          gd=Doxygen::groupList.next();
         }
       }
       break;
     case isNamespaceDocumentation:
       {
-        NamespaceDef *nd=namespaceList.first();
+        NamespaceDef *nd=Doxygen::namespaceList.first();
         bool found=FALSE;
         while (nd && !found)
         {
@@ -1033,7 +1033,7 @@ void RTFGenerator::endIndexSection(IndexSections is)
             t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
             found=TRUE;
           }
-          nd=namespaceList.next();
+          nd=Doxygen::namespaceList.next();
         }
         while (nd)
         {
@@ -1045,13 +1045,13 @@ void RTFGenerator::endIndexSection(IndexSections is)
             t << nd->getOutputFileBase();
             t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
           }
-          nd=namespaceList.next();
+          nd=Doxygen::namespaceList.next();
         }
       }
       break;
     case isClassDocumentation:
       {
-        ClassDef *cd=classList.first();
+        ClassDef *cd=Doxygen::classList.first();
         bool found=FALSE;
 
         t << "{\\tc \\v " << theTranslator->trClassDocumentation() << "}"<< endl;
@@ -1065,7 +1065,7 @@ void RTFGenerator::endIndexSection(IndexSections is)
             t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
             found=TRUE;
           }
-          cd=classList.next();
+          cd=Doxygen::classList.next();
         }
         while (cd)
         {
@@ -1077,14 +1077,14 @@ void RTFGenerator::endIndexSection(IndexSections is)
             t << cd->getOutputFileBase();
             t << ".rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n";
           } 
-          cd=classList.next();
+          cd=Doxygen::classList.next();
         }
       }
       break;
     case isFileDocumentation:
       {
         bool isFirst=TRUE;
-        FileName *fn=inputNameList.first();
+        FileName *fn=Doxygen::inputNameList.first();
 
         t << "{\\tc \\v " << theTranslator->trFileDocumentation() << "}"<< endl;
         while (fn)
@@ -1113,7 +1113,7 @@ void RTFGenerator::endIndexSection(IndexSections is)
             }
             fd=fn->next();
           }
-          fn=inputNameList.next();
+          fn=Doxygen::inputNameList.next();
         }
       }
       break;
@@ -1121,7 +1121,7 @@ void RTFGenerator::endIndexSection(IndexSections is)
       {
         //t << "}\n";
         t << "{\\tc \\v " << theTranslator->trExampleDocumentation() << "}"<< endl;
-        PageSDictIterator pdi(*exampleSDict);
+        PageSDictIterator pdi(*Doxygen::exampleSDict);
         PageInfo *pi=pdi.toFirst();
         if (pi)
         {
@@ -1143,12 +1143,12 @@ void RTFGenerator::endIndexSection(IndexSections is)
     case isPageDocumentation:
       {
         t << "{\\tc \\v " << theTranslator->trPageDocumentation() << "}"<< endl;
-        PageSDictIterator pdi(*pageSDict);
+        PageSDictIterator pdi(*Doxygen::pageSDict);
         PageInfo *pi=pdi.toFirst();
         bool first=TRUE;
         for (pdi.toFirst();(pi=pdi.current());++pdi)
         {
-          if (!pi->inGroup)
+          if (!pi->inGroup && !pi->isReference())
           {
             QCString pageName;
             if (Config::caseSensitiveNames)
@@ -1809,16 +1809,23 @@ void RTFGenerator::endSection(const char *lab,bool)
   t << "}";
 }
 
-void RTFGenerator::writeSectionRef(const char *,const char *lab,
-    const char *title)
+void RTFGenerator::writeSectionRef(const char *ref,const char *,
+                                   const char *lab,const char *title)
 {
-  startBold();
-  docify(title);
-  endBold();
-  t << " (";
-  docify(theTranslator->trPageAbbreviation());
-  WriteRTFReference(lab);
-  t << ")" << endl;
+  if (ref)
+  {
+    docify(title);
+  }
+  else
+  {
+    startBold();
+    docify(title);
+    endBold();
+    t << " (";
+    docify(theTranslator->trPageAbbreviation());
+    WriteRTFReference(lab);
+    t << ")" << endl;
+  }
 }
 
 void RTFGenerator::writeSectionRefItem(const char *,const char *lab,
@@ -1830,11 +1837,11 @@ void RTFGenerator::writeSectionRefItem(const char *,const char *lab,
   t << endl;
 }
 
-void RTFGenerator::writeSectionRefAnchor(const char *name,const char *lab,
-    const char *title)
-{
-  writeSectionRef(name,lab,title);
-}
+//void RTFGenerator::writeSectionRefAnchor(const char *name,const char *lab,
+//    const char *title)
+//{
+//  writeSectionRef(name,lab,title);
+//}
 
 void RTFGenerator::docify(const char *str)
 {
diff --git a/src/rtfgen.h b/src/rtfgen.h
index 491b483..0179dd5 100644
--- a/src/rtfgen.h
+++ b/src/rtfgen.h
@@ -109,8 +109,8 @@ class RTFGenerator : public OutputGenerator
     void endPreFragment() { endCodeFragment(); }
     void startCodeLine() { col=0; }
     void endCodeLine() { lineBreak(); }
-    void writeBoldString(const char *text) 
-                         { t << "{\\b "; docify(text); t << "}"; }
+    //void writeBoldString(const char *text) 
+    //                     { t << "{\\b "; docify(text); t << "}"; }
     void startEmphasis() { t << "{\\i ";  }
     void endEmphasis()   { t << "}"; }
     void startBold()     { t << "{\\b "; }
@@ -168,9 +168,9 @@ class RTFGenerator : public OutputGenerator
     void endDescList();
     void startSection(const char *,const char *,bool);
     void endSection(const char *,bool);
-    void writeSectionRef(const char *,const char *,const char *);
+    void writeSectionRef(const char *,const char *,const char *,const char *);
     void writeSectionRefItem(const char *,const char *,const char *);
-    void writeSectionRefAnchor(const char *,const char *,const char *);
+    //void writeSectionRefAnchor(const char *,const char *,const char *);
     void addIndexItem(const char *,const char *);
     void startIndent();
     void endIndent();
@@ -178,8 +178,8 @@ class RTFGenerator : public OutputGenerator
     //void generateExternalIndex() {}
     void startClassDiagram();
     void endClassDiagram(ClassDiagram &,const char *filename,const char *name);
-    void startColorFont(uchar,uchar,uchar) {}
-    void endColorFont()   {}
+    //void startColorFont(uchar,uchar,uchar) {}
+    //void endColorFont()   {}
     void startPageRef();
     void endPageRef(const char *,const char *);
     void startQuickIndexItem(const char *,const char *) {}
diff --git a/src/scanner.l b/src/scanner.l
index c831a9c..2243676 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -30,6 +30,7 @@
 #include <qarray.h>
 #include <qstack.h>
 #include <qregexp.h>
+#include <unistd.h>
   
 #include "scanner.h"
 #include "entry.h"
@@ -45,9 +46,6 @@
 #include "reflist.h"
 #include "code.h"
 
-#ifndef WIN32
-#include <unistd.h>
-#endif
   
 #define YY_NEVER_INTERACTIVE 1
   
@@ -263,11 +261,11 @@ static void addSection()
   //printf("New section pageName=%s label=%s title=%s\n",
   //    current->name.data(),sectionLabel.data(),sectionTitle.data());
   if (sectionLabel.isEmpty()) return;
-  if (sectionDict[sectionLabel]==0)
+  if (Doxygen::sectionDict.find(sectionLabel)==0)
   {
     SectionInfo *si=new SectionInfo(sectionLabel,sectionTitle,sectionType);
     //printf("Adding section addr=%p label=`%s' sectionTitle=`%s' fileName=%s\n",si,sectionLabel.data(),sectionTitle.data(),si->fileName.data());
-    sectionDict.insert(sectionLabel,si);
+    Doxygen::sectionDict.insert(sectionLabel,si);
     current->anchors->append(new QCString(sectionLabel));
   }
   else
@@ -284,13 +282,13 @@ static QCString addFormula()
   QCString formLabel;
   QCString fText=formulaText.simplifyWhiteSpace();
   Formula *f=0;
-  if ((f=formulaDict[fText])==0)
+  if ((f=Doxygen::formulaDict[fText])==0)
   {
     f = new Formula(fText);
-    formulaList.append(f);
-    formulaDict.insert(fText,f);
+    Doxygen::formulaList.append(f);
+    Doxygen::formulaDict.insert(fText,f);
     formLabel.sprintf("\\form#%d",f->getId());
-    formulaNameDict.insert(formLabel,f);
+    Doxygen::formulaNameDict.insert(formLabel,f);
   }
   else
   {
@@ -888,11 +886,11 @@ TITLE     [tT][iI][tT][lL][eE]
   					  //printf("Inserting namespace alias %s::%s->%s\n",current_root->name.data(),aliasName.data(),yytext);
 					  if (current_root->name.isEmpty())
 					  {
-					    namespaceAliasDict.insert(aliasName,new QCString(yytext));
+                                            Doxygen::namespaceAliasDict.insert(aliasName,new QCString(yytext));
 					  }
 					  else
 					  {
-					    namespaceAliasDict.insert(current_root->name+"::"+aliasName,
+                                            Doxygen::namespaceAliasDict.insert(current_root->name+"::"+aliasName,
 						new QCString(current_root->name+"::"+yytext));
 					  }
   					}
@@ -1370,10 +1368,10 @@ TITLE     [tT][iI][tT][lL][eE]
 					  {
 					    // add typedef to dictionary
 					    QCString dest = extractName(current->type.right(current->type.length()-8));
-					    if (typedefDict[current->name]==0 && !dest.isEmpty())
+					    if (Doxygen::typedefDict[current->name]==0 && !dest.isEmpty())
 					    {		
 					      //printf("1>>>>>>>>>> adding %s->%s\n",current->name.data(),dest.data());
-					      typedefDict.insert(current->name, new QCString(dest));
+                                              Doxygen::typedefDict.insert(current->name, new QCString(dest));
 					    }
 					  }
 					  current->section = Entry::VARIABLE_SEC ;
@@ -1629,7 +1627,7 @@ TITLE     [tT][iI][tT][lL][eE]
 					      if (!current->name.isEmpty() && current->name.at(0)!='@')
 					      {
 						//printf("2>>>>>>>>>> adding %s->%s\n",msName.data(),current->name.data());
-						typedefDict.insert(msName,new QCString(current->name));
+                                                Doxygen::typedefDict.insert(msName,new QCString(current->name));
 					      }
 					    }
 					    varEntry->type+=current->name+msType;
@@ -2284,7 +2282,7 @@ TITLE     [tT][iI][tT][lL][eE]
 					    {
 					      //QCString dest = extractName(current->name);
 				   	      //printf("3>>>>>>>>>> adding %s->%s\n",yytext,current->name.data());
-					      typedefDict.insert(yytext,new QCString(current->name));
+                                              Doxygen::typedefDict.insert(yytext,new QCString(current->name));
 					      //current->extends->append(
 					      //   new BaseInfo(yytext,Public,Normal)
 					      //		      );
@@ -3518,7 +3516,7 @@ TITLE     [tT][iI][tT][lL][eE]
   					  current->doc+=yytext;
   					}
 <Doc,ClassDoc,PageDoc,ExampleDoc,AfterDoc>{CMD}[a-z_A-Z][a-z_A-Z0-9]* 	{
-  					  QCString *pValue=aliasDict[yytext+1];
+  					  QCString *pValue=Doxygen::aliasDict[yytext+1];
 					  if (pValue)
 					  {
 					    int i,l=pValue->length();
@@ -3536,7 +3534,7 @@ TITLE     [tT][iI][tT][lL][eE]
   					  current->brief+=yytext;
   					}
 <JavaDoc,LineDoc,ClassDocBrief,AfterDocBrief,AfterDocLine>{CMD}[a-z_A-Z][a-z_A-Z0-9]* 	{
-  					  QCString *pValue=aliasDict[yytext+1];
+  					  QCString *pValue=Doxygen::aliasDict[yytext+1];
 					  if (pValue)
 					  {
 					    int i,l=pValue->length();
@@ -3612,10 +3610,10 @@ static void endGroup()
   }
   else if (memberGroupId!=NOGROUP) // end of member group
   {
-    memberHeaderDict.insert(memberGroupId,
+    Doxygen::memberHeaderDict.insert(memberGroupId,
 	new QCString(memberGroupHeader.stripWhiteSpace())
 			   );
-    memberDocDict.insert(memberGroupId,
+    Doxygen::memberDocDict.insert(memberGroupId,
 	new QCString(memberGroupDocs)
 			);
     memberGroupId=NOGROUP;
diff --git a/src/section.h b/src/section.h
index 206237c..58605fa 100644
--- a/src/section.h
+++ b/src/section.h
@@ -22,26 +22,25 @@
 #include "qtbc.h"
 #include <qlist.h>
 #include <qdict.h>
+#include "sortdict.h"
 
 class Definition;
 
 struct SectionInfo
 {
   enum SectionType { Section, Subsection, Anchor };
-  SectionInfo(const char *l,const char *t,SectionType st)
-    { label=l; title=t; type=st; definition=0; }
+  SectionInfo(const char *l,const char *t,SectionType st,const char *r=0)
+    { label=l; title=t; type=st; ref=r; definition=0; pageRef=0; }
  ~SectionInfo() {}
   QCString label; 
   QCString title;
+  QCString ref;
   SectionType type;
   Definition *definition;
+  PageInfo *pageRef;
   QCString fileName;
 };
 
-class SectionList : public QList<SectionInfo>
-{
-};
-
 class SectionDict : public QDict<SectionInfo>
 {
   public:
diff --git a/src/tagreader.cpp b/src/tagreader.cpp
index cfe7bb0..997f171 100644
--- a/src/tagreader.cpp
+++ b/src/tagreader.cpp
@@ -42,6 +42,7 @@ class TagMemberInfo
     QString anchor;
     QString arglist;
     QString kind;
+    QStrList docAnchors;
     Protection prot;
     Specifier virt;
     bool isStatic; 
@@ -56,6 +57,7 @@ class TagClassInfo
    ~TagClassInfo() { delete bases; }
     QString name;
     QString filename;
+    QStrList docAnchors;
     QList<BaseInfo> *bases;
     QList<TagMemberInfo> members;
     Kind kind;
@@ -68,6 +70,7 @@ class TagNamespaceInfo
     TagNamespaceInfo() { members.setAutoDelete(TRUE); }
     QString name;
     QString filename;
+    QStrList docAnchors;
     QList<TagMemberInfo> members;
     QStringList classList;
 };
@@ -80,6 +83,7 @@ class TagFileInfo
     QString name;
     QString path;
     QString filename;
+    QStrList docAnchors;
     QList<TagMemberInfo> members;
     QStringList classList;
     QStringList namespaceList;
@@ -93,6 +97,7 @@ class TagGroupInfo
     QString name;
     QString title;
     QString filename;
+    QStrList docAnchors;
     QList<TagMemberInfo> members;
     QStringList subgroupList;
     QStringList classList;
@@ -108,6 +113,7 @@ class TagPageInfo
     QString name;
     QString title;
     QString filename;
+    QStrList docAnchors;
 };
 
 
@@ -274,6 +280,19 @@ class TagFileParser : public QXmlDefaultHandler
         default:   err("Error: Unexpected tag `member' found\n"); break; 
       }
     }
+    void endDocAnchor()
+    {
+      switch(m_state)
+      {
+        case InClass:     m_curClass->docAnchors.append(m_curString); break;
+        case InFile:      m_curFile->docAnchors.append(m_curString); break;
+        case InNamespace: m_curNamespace->docAnchors.append(m_curString); break;
+        case InGroup:     m_curGroup->docAnchors.append(m_curString); break;
+        case InPage:      m_curPage->docAnchors.append(m_curString); break;
+        case InMember:    m_curMember->docAnchors.append(m_curString); break;
+        default:   err("Error: Unexpected tag `member' found\n"); break; 
+      }
+    }
     void endClass()
     {
       switch(m_state)
@@ -463,6 +482,7 @@ class TagFileParser : public QXmlDefaultHandler
       m_startElementHandlers.insert("namespace", new StartElementHandler(this,&TagFileParser::startStringValue));
       m_startElementHandlers.insert("file",      new StartElementHandler(this,&TagFileParser::startStringValue));
       m_startElementHandlers.insert("page",      new StartElementHandler(this,&TagFileParser::startStringValue));
+      m_startElementHandlers.insert("docanchor", new StartElementHandler(this,&TagFileParser::startStringValue));
       m_startElementHandlers.insert("tagfile",   new StartElementHandler(this,&TagFileParser::startIgnoreElement));
       m_endElementHandlers.insert("compound",    new EndElementHandler(this,&TagFileParser::endCompound));
       m_endElementHandlers.insert("member",      new EndElementHandler(this,&TagFileParser::endMember));
@@ -478,6 +498,7 @@ class TagFileParser : public QXmlDefaultHandler
       m_endElementHandlers.insert("namespace",   new EndElementHandler(this,&TagFileParser::endNamespace));
       m_endElementHandlers.insert("file",        new EndElementHandler(this,&TagFileParser::endFile));
       m_endElementHandlers.insert("page",        new EndElementHandler(this,&TagFileParser::endPage));
+      m_endElementHandlers.insert("docanchor",   new EndElementHandler(this,&TagFileParser::endDocAnchor));
       m_endElementHandlers.insert("tagfile",     new EndElementHandler(this,&TagFileParser::endIgnoreElement));
       return TRUE;
     }
@@ -520,6 +541,7 @@ class TagFileParser : public QXmlDefaultHandler
     
   private:
     void buildMemberList(Entry *ce,QList<TagMemberInfo> &members);
+    void addDocAnchors(Entry *e,QStrList &l);
     QList<TagClassInfo>        m_tagFileClasses;
     QList<TagFileInfo>         m_tagFileFiles;
     QList<TagNamespaceInfo>    m_tagFileNamespaces;
@@ -712,6 +734,27 @@ void TagFileParser::dump()
   }
 }
 
+void TagFileParser::addDocAnchors(Entry *e,QStrList &l)
+{
+  char *s=l.first();
+  while (s)
+  {
+    QCString *anchorName = new QCString(s);
+    if (Doxygen::sectionDict.find(*anchorName)==0)
+    {
+      SectionInfo *si=new SectionInfo(*anchorName,*anchorName,
+                                      SectionInfo::Anchor,m_tagName);
+      Doxygen::sectionDict.insert(*anchorName,si);
+      e->anchors->append(anchorName);
+    }
+    else
+    {
+      err("Duplicate anchor %s found\n",anchorName->data());
+    }
+    s=l.next();
+  }
+}
+
 void TagFileParser::buildMemberList(Entry *ce,QList<TagMemberInfo> &members)
 {
   QListIterator<TagMemberInfo> mii(members);
@@ -725,6 +768,7 @@ void TagFileParser::buildMemberList(Entry *ce,QList<TagMemberInfo> &members)
     me->virt       = tmi->virt;
     me->stat       = tmi->isStatic;
     me->fileName   = ce->fileName;
+    addDocAnchors(me,tmi->docAnchors);
     TagInfo *ti    = new TagInfo;
     ti->tagName    = m_tagName;
     ti->anchor     = tmi->anchor;
@@ -809,6 +853,7 @@ void TagFileParser::buildLists(Entry *root)
       case TagClassInfo::Exception: ce->section = Entry::EXCEPTION_SEC; break;
     }
     ce->name     = tci->name;
+    addDocAnchors(ce,tci->docAnchors);
     TagInfo *ti  = new TagInfo;
     ti->tagName  = m_tagName;
     ti->fileName = tci->filename;
@@ -831,6 +876,7 @@ void TagFileParser::buildLists(Entry *root)
     Entry *fe = new Entry;
     fe->section = guessSection(tfi->name);
     fe->name     = tfi->name;
+    addDocAnchors(fe,tfi->docAnchors);
     TagInfo *ti  = new TagInfo;
     ti->tagName  = m_tagName;
     ti->fileName = tfi->filename;
@@ -840,7 +886,7 @@ void TagFileParser::buildLists(Entry *root)
     fe->fileName = fullName;
     FileDef *fd = new FileDef(m_tagName+":"+tfi->path,tfi->name,m_tagName);
     FileName *mn;
-    if ((mn=inputNameDict->find(tfi->name)))
+    if ((mn=Doxygen::inputNameDict->find(tfi->name)))
     {
       mn->append(fd);
     }
@@ -848,8 +894,8 @@ void TagFileParser::buildLists(Entry *root)
     {
       mn = new FileName(fullName,tfi->name);
       mn->append(fd);
-      inputNameList.inSort(mn);
-      inputNameDict->insert(tfi->name,mn);
+      Doxygen::inputNameList.inSort(mn);
+      Doxygen::inputNameDict->insert(tfi->name,mn);
     }
     buildMemberList(fe,tfi->members);
     root->addSubEntry(fe);
@@ -863,6 +909,7 @@ void TagFileParser::buildLists(Entry *root)
     Entry *ne    = new Entry;
     ne->section  = Entry::NAMESPACE_SEC;
     ne->name     = tni->name;
+    addDocAnchors(ne,tni->docAnchors);
     TagInfo *ti  = new TagInfo;
     ti->tagName  = m_tagName;
     ti->fileName = tni->filename;
@@ -881,6 +928,7 @@ void TagFileParser::buildLists(Entry *root)
     ge->section  = Entry::GROUPDOC_SEC;
     ge->name     = tgi->name;
     ge->type     = tgi->title;
+    addDocAnchors(ge,tgi->docAnchors);
     TagInfo *ti  = new TagInfo;
     ti->tagName  = m_tagName;
     ti->fileName = tgi->filename;
@@ -899,6 +947,7 @@ void TagFileParser::buildLists(Entry *root)
     pe->section  = Entry::PAGEDOC_SEC;
     pe->name     = tpi->name;
     pe->args     = tpi->title;
+    addDocAnchors(pe,tpi->docAnchors);
     TagInfo *ti  = new TagInfo;
     ti->tagName  = m_tagName;
     ti->fileName = tpi->filename;
diff --git a/src/util.cpp b/src/util.cpp
index 56820e7..b1ba148 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -39,7 +39,7 @@
 #include "example.h"
 #include "version.h"
 #include "groupdef.h"
-#include "xml.h"
+//#include "xml.h"
 #include "page.h"
 
 #ifndef _WIN32
@@ -60,53 +60,28 @@ extern char **environ;
 // TextGeneratorOLImpl implementation
 //------------------------------------------------------------------------
 
-TextGeneratorOLImpl::TextGeneratorOLImpl(OutputList &ol) : m_ol(ol) {}
+TextGeneratorOLImpl::TextGeneratorOLImpl(OutputDocInterface &od) : m_od(od) 
+{
+}
 
 void TextGeneratorOLImpl::writeString(const char *s) const
 { 
-  m_ol.docify(s); 
+  m_od.docify(s); 
 }
 
 void TextGeneratorOLImpl::writeBreak() const
 { 
-  m_ol.pushGeneratorState();
-  m_ol.disableAllBut(OutputGenerator::Html);
-  m_ol.lineBreak();
-  m_ol.popGeneratorState();
+  m_od.pushGeneratorState();
+  m_od.disableAllBut(OutputGenerator::Html);
+  m_od.lineBreak();
+  m_od.popGeneratorState();
 }
 
 void TextGeneratorOLImpl::writeLink(const char *extRef,const char *file,
                                     const char *anchor,const char *text
                                    ) const
 {
-  m_ol.writeObjectLink(extRef,file,anchor,text);
-}
-
-//------------------------------------------------------------------------
-// TextGeneratorXMLImpl implementation
-//------------------------------------------------------------------------
-
-TextGeneratorXMLImpl::TextGeneratorXMLImpl(QTextStream &t) : m_t(t) 
-{
-}
-
-void TextGeneratorXMLImpl::writeString(const char *s) const
-{ 
-  writeXMLString(m_t,s); 
-}
-
-void TextGeneratorXMLImpl::writeBreak() const 
-{
-}
-
-void TextGeneratorXMLImpl::writeLink(const char *extRef,const char *file,
-                                     const char *anchor,const char *text
-                                    ) const
-{
-  if (extRef==0) 
-  { writeXMLLink(m_t,file,anchor,text); } 
-  else // external references are not supported for XML
-  { writeXMLString(m_t,text); }
+  m_od.writeObjectLink(extRef,file,anchor,text);
 }
 
 //------------------------------------------------------------------------
@@ -284,7 +259,7 @@ QCString stripAnnonymousNamespaceScope(const QCString &s)
   int oi=0,i=0,p=0;
   if (s.isEmpty()) return s;
   while (s.at(p)=='@' && (i=s.find("::",p))!=-1 && 
-         namespaceDict[s.left(i)]!=0) { oi=i; p=i+2; }
+         Doxygen::namespaceDict[s.left(i)]!=0) { oi=i; p=i+2; }
   if (oi==0) 
   {
     //printf("stripAnnonymousNamespaceScope(`%s')=`%s'\n",s.data(),s.data());
@@ -297,19 +272,19 @@ QCString stripAnnonymousNamespaceScope(const QCString &s)
   }
 }
 
-void writePageRef(OutputList &ol,const char *cn,const char *mn)
+void writePageRef(OutputDocInterface &od,const char *cn,const char *mn)
 {
-  ol.pushGeneratorState();
+  od.pushGeneratorState();
   
-  ol.disable(OutputGenerator::Html);
-  ol.disable(OutputGenerator::Man);
-  if (Config::pdfHyperFlag) ol.disable(OutputGenerator::Latex);
-  if (Config::rtfHyperFlag) ol.disable(OutputGenerator::RTF);
-  ol.startPageRef();
-  ol.docify(theTranslator->trPageAbbreviation());
-  ol.endPageRef(cn,mn);
-
-  ol.popGeneratorState();
+  od.disable(OutputGenerator::Html);
+  od.disable(OutputGenerator::Man);
+  if (Config::pdfHyperFlag) od.disable(OutputGenerator::Latex);
+  if (Config::rtfHyperFlag) od.disable(OutputGenerator::RTF);
+  od.startPageRef();
+  od.docify(theTranslator->trPageAbbreviation());
+  od.endPageRef(cn,mn);
+
+  od.popGeneratorState();
 }
 
 /*! Generate a place holder for a position in a list. Used for
@@ -374,18 +349,18 @@ int guessSection(const char *name)
 ClassDef *getClass(const char *name)
 {
   if (name==0 || name[0]=='\0') return 0;
-  return classDict[name];
+  return Doxygen::classDict[name];
 }
 
 NamespaceDef *getResolvedNamespace(const char *name)
 {
   if (name==0 || name[0]=='\0') return 0;
-  QCString *subst = namespaceAliasDict[name];
+  QCString *subst = Doxygen::namespaceAliasDict[name];
   if (subst)
   {
     int count=0; // recursion detection guard
     QCString *newSubst;
-    while ((newSubst=namespaceAliasDict[*subst]) && count<10)
+    while ((newSubst=Doxygen::namespaceAliasDict[*subst]) && count<10)
     {
       subst=newSubst;
       count++;
@@ -394,46 +369,46 @@ NamespaceDef *getResolvedNamespace(const char *name)
     {
       warn_cont("Warning: possible recursive namespace alias detected for %s!\n",name);
     }
-    return namespaceDict[subst->data()];
+    return Doxygen::namespaceDict[subst->data()];
   }
   else
   {
-    return namespaceDict[name];
+    return Doxygen::namespaceDict[name];
   }
 }
 
 ClassDef *getResolvedClass(const char *name)
 {
   if (name==0 || name[0]=='\0') return 0;
-  QCString *subst = typedefDict[name];
+  QCString *subst = Doxygen::typedefDict[name];
   if (subst) // there is a typedef with this name
   {
     //printf("getResolvedClass `%s'->`%s'\n",name,subst->data());
     if (*subst==name) // avoid resolving typedef struct foo foo; 
     {
-      return classDict[name];
+      return Doxygen::classDict[name];
     }
     int count=0; // recursion detection guard
     QCString *newSubst;
-    while ((newSubst=typedefDict[*subst]) && count<10)
+    while ((newSubst=Doxygen::typedefDict[*subst]) && count<10)
     {
-      if (*subst==*newSubst) return classDict[subst->data()]; // for breaking typedef struct A A; 
+      if (*subst==*newSubst) return Doxygen::classDict[subst->data()]; // for breaking typedef struct A A; 
       subst=newSubst;
       count++;
     }
     if (count==10)
     {
       warn_cont("Warning: possible recursive typedef dependency detected for %s!\n",name);
-      return classDict[name];
+      return Doxygen::classDict[name];
     }
     else
     {
       //printf("getClass: subst %s->%s\n",name,subst->data());
       int i;
-      ClassDef *cd = classDict[subst->data()];
+      ClassDef *cd = Doxygen::classDict[subst->data()];
       if (cd==0 && (i=subst->find('<'))>0) // try unspecialized version as well
       {
-        return classDict[subst->left(i)];
+        return Doxygen::classDict[subst->left(i)];
       }
       else
       {
@@ -443,7 +418,7 @@ ClassDef *getResolvedClass(const char *name)
   }
   else
   {
-    return classDict[name];
+    return Doxygen::classDict[name];
   }
 }
 
@@ -484,6 +459,10 @@ QCString removeRedundantWhiteSpace(const QCString &s)
     {
       result+=" >"; // insert extra space for layouting (nested) templates
     }
+    else if (i>0 && i<l-1 && c==',' && isId(s.at(i-1)) && isId(s.at(i+1)))
+    {
+      result+=", ";
+    }
     else if (i>0 && isId(s.at(i)) && s.at(i-1)==')')
     {
       result+=' ';
@@ -491,7 +470,7 @@ QCString removeRedundantWhiteSpace(const QCString &s)
     }
     else if (c!=' ' ||
 	      ( i!=0 && i!=l-1 && 
-                (isId(s.at(i-1)) || s.at(i-1)==')' || s.at(i-1)==',') && 
+                (isId(s.at(i-1)) || s.at(i-1)==')' || s.at(i-1)==',' || s.at(i-1)=='>' || s.at(i-1)==']') && 
                 isId(s.at(i+1))
               ) 
             )
@@ -730,7 +709,7 @@ QCString argListToString(ArgumentList *al)
       result+="="+a->defval;
     }
     a = al->next();
-    if (a) result+=","; 
+    if (a) result+=", "; 
   }
   result+=")";
   if (al->constSpecifier) result+=" const";
@@ -766,197 +745,6 @@ QCString tempArgListToString(ArgumentList *al)
   return result;
 }
 
-static bool manIsEnabled;
-
-void startTitle(OutputList &ol,const char *fileName)
-{
-  ol.startTitleHead(fileName);
-  manIsEnabled=ol.isEnabled(OutputGenerator::Man);
-  if (manIsEnabled) ol.disable(OutputGenerator::Man);
-}
-
-void endTitle(OutputList &ol,const char *fileName,const char *name)
-{
-  if (manIsEnabled) ol.enable(OutputGenerator::Man); 
-  ol.endTitleHead(fileName,name);
-}
-
-void writeQuickLinks(OutputList &ol,bool compact,bool ext)
-{
-  ol.pushGeneratorState();
-  //bool manEnabled = ol.isEnabled(OutputGenerator::Man);
-  //bool texEnabled = ol.isEnabled(OutputGenerator::Latex);
-  ol.disableAllBut(OutputGenerator::Html);
-  QCString extLink;
-  if (ext) { extLink="_doc"; }
-  //if (manEnabled) ol.disable(OutputGenerator::Man);
-  //if (texEnabled) ol.disable(OutputGenerator::Latex);
-  if (compact) ol.startCenter(); else ol.startItemList();
-
-  if (!compact) ol.writeListItem();
-  if (Config::ftvHelpFlag)
-  {
-    ol.startQuickIndexItem(extLink,"main.html");
-  }
-  else
-  {
-    ol.startQuickIndexItem(extLink,"index.html");
-  }
-  parseText(ol,theTranslator->trMainPage());
-  ol.endQuickIndexItem();
-
-  if (documentedPackages>0)
-  {
-    if (!compact) ol.writeListItem();
-    ol.startQuickIndexItem(extLink,"packages.html");
-    parseText(ol,theTranslator->trPackages());
-    ol.endQuickIndexItem();
-  }
-  if (documentedGroups>0)
-  {
-    if (!compact) ol.writeListItem();
-    ol.startQuickIndexItem(extLink,"modules.html");
-    parseText(ol,theTranslator->trModules());
-    ol.endQuickIndexItem();
-  } 
-  if (documentedNamespaces>0)
-  {
-    if (!compact) ol.writeListItem();
-    ol.startQuickIndexItem(extLink,"namespaces.html");
-    parseText(ol,theTranslator->trNamespaceList());
-    ol.endQuickIndexItem();
-  }
-  if (hierarchyClasses>0)
-  {
-    if (!compact) ol.writeListItem();
-    ol.startQuickIndexItem(extLink,"hierarchy.html");
-    parseText(ol,theTranslator->trClassHierarchy());
-    ol.endQuickIndexItem();
-  } 
-  if (annotatedClasses>0)
-  {
-    if (Config::alphaIndexFlag)
-    {
-      if (!compact) ol.writeListItem();
-      ol.startQuickIndexItem(extLink,"classes.html");
-      parseText(ol,theTranslator->trAlphabeticalList());
-      ol.endQuickIndexItem();
-    }
-    if (!compact) ol.writeListItem();
-    ol.startQuickIndexItem(extLink,"annotated.html");
-    parseText(ol,theTranslator->trCompoundList());
-    ol.endQuickIndexItem();
-  } 
-  if (documentedHtmlFiles>0)
-  {
-    if (!compact) ol.writeListItem();
-    ol.startQuickIndexItem(extLink,"files.html");
-    parseText(ol,theTranslator->trFileList());
-    ol.endQuickIndexItem();
-  } 
-  //if (documentedIncludeFiles>0 && Config::verbatimHeaderFlag)
-  //{
-  //  if (!compact) ol.writeListItem();
-  //  ol.startQuickIndexItem(extLink,"headers.html");
-  //  parseText(ol,theTranslator->trHeaderFiles());
-  //  ol.endQuickIndexItem();
-  //}
-  //if (Config::sourceBrowseFlag) 
-  //{
-  //  if (!compact) ol.writeListItem();
-  //  ol.startQuickIndexItem(extLink,"sources.html");
-  //  parseText(ol,theTranslator->trSources());
-  //  ol.endQuickIndexItem();
-  //}
-  if (documentedNamespaceMembers>0)
-  {
-    if (!compact) ol.writeListItem();
-    ol.startQuickIndexItem(extLink,"namespacemembers.html");
-    parseText(ol,theTranslator->trNamespaceMembers());
-    ol.endQuickIndexItem();
-  }
-  if (documentedMembers>0)
-  {
-    if (!compact) ol.writeListItem();
-    ol.startQuickIndexItem(extLink,"functions.html");
-    parseText(ol,theTranslator->trCompoundMembers());
-    ol.endQuickIndexItem();
-  } 
-  if (documentedFunctions>0)
-  {
-    if (!compact) ol.writeListItem();
-    ol.startQuickIndexItem(extLink,"globals.html");
-    parseText(ol,theTranslator->trFileMembers());
-    ol.endQuickIndexItem();
-  } 
-  if (documentedPages>0)
-  {
-    if (!compact) ol.writeListItem();
-    ol.startQuickIndexItem(extLink,"pages.html");
-    parseText(ol,theTranslator->trRelatedPages());
-    ol.endQuickIndexItem();
-  } 
-  if (exampleSDict->count()>0)
-  {
-    if (!compact) ol.writeListItem();
-    ol.startQuickIndexItem(extLink,"examples.html");
-    parseText(ol,theTranslator->trExamples());
-    ol.endQuickIndexItem();
-  } 
-  if (Config::searchEngineFlag)
-  {
-    if (!compact) ol.writeListItem();
-    ol.startQuickIndexItem("_cgi","");
-    parseText(ol,theTranslator->trSearch());
-    ol.endQuickIndexItem();
-  } 
-  if (compact) 
-  {
-    ol.endCenter(); 
-    ol.writeRuler();
-  }
-  else 
-  {
-    ol.endItemList();
-  }
-  //if (manEnabled) ol.enable(OutputGenerator::Man);
-  //if (texEnabled) ol.enable(OutputGenerator::Latex);
-  ol.popGeneratorState();
-}
-
-void startFile(OutputList &ol,const char *name,const char *title,bool external)
-{
-  ol.startFile(name,title,external);
-  if (!Config::noIndexFlag) writeQuickLinks(ol,TRUE,external);
-}
-
-void endFile(OutputList &ol,bool external)
-{
-  //bool latexEnabled = ol.isEnabled(OutputGenerator::Latex);
-  //bool manEnabled   = ol.isEnabled(OutputGenerator::Man);
-  //if (latexEnabled) ol.disable(OutputGenerator::Latex);
-  //if (manEnabled)   ol.disable(OutputGenerator::Man);
-  ol.pushGeneratorState();
-  ol.disableAllBut(OutputGenerator::Html);
-  ol.writeFooter(0,external); // write the footer
-  if (Config::footerFile.isEmpty())
-  {
-    parseText(ol,theTranslator->trGeneratedAt(
-              dateToString(TRUE),
-              Config::projectName
-             ));
-  }
-  ol.writeFooter(1,external); // write the link to the picture
-  if (Config::footerFile.isEmpty())
-  {
-    parseText(ol,theTranslator->trWrittenBy());
-  }
-  ol.writeFooter(2,external); // end the footer
-  //if (latexEnabled) ol.enable(OutputGenerator::Latex);
-  //if (manEnabled)   ol.enable(OutputGenerator::Man);
-  ol.popGeneratorState();
-  ol.endFile();
-}
 
 // compute the HTML anchors for a list of members
 void setAnchors(char id,MemberList *ml,int groupId)
@@ -1236,7 +1024,7 @@ static void trimNamespaceScope(QCString &t1,QCString &t2)
     if (i1!=-1 && i2==-1) // only t1 has a scope
     {
       QCString scope=t1.left(i1);
-      if (!scope.isEmpty() && namespaceDict[scope]!=0) // scope is a namespace
+      if (!scope.isEmpty() && Doxygen::namespaceDict[scope]!=0) // scope is a namespace
       {
         t1 = t1.right(t1.length()-i1-2);
         return;
@@ -1245,7 +1033,7 @@ static void trimNamespaceScope(QCString &t1,QCString &t2)
     else if (i1==-1 && i2!=-1) // only t2 has a scope
     {
       QCString scope=t2.left(i2);
-      if (!scope.isEmpty() && namespaceDict[scope]!=0) // scope is a namespace
+      if (!scope.isEmpty() && Doxygen::namespaceDict[scope]!=0) // scope is a namespace
       {
         t2 = t2.right(t2.length()-i2-2);
         return;
@@ -1904,7 +1692,7 @@ bool getDefs(const QCString &scName,const QCString &memberName,
 
   //printf("mScope=`%s' mName=`%s'\n",mScope.data(),mName.data());
   
-  MemberName *mn = memberNameDict[mName];
+  MemberName *mn = Doxygen::memberNameDict[mName];
   if (!forceEmptyScope && mn && !(scopeName.isEmpty() && mScope.isEmpty()))
   {
     //printf("  >member name found\n");
@@ -2014,7 +1802,7 @@ bool getDefs(const QCString &scName,const QCString &memberName,
   // maybe an namespace, file or group member ?
   //printf("Testing for global function scopeName=`%s' mScope=`%s' :: mName=`%s'\n",
   //              scopeName.data(),mScope.data(),mName.data());
-  if ((mn=functionNameDict[mName])) // name is known
+  if ((mn=Doxygen::functionNameDict[mName])) // name is known
   {
     //printf("  >function name found\n");
     NamespaceDef *fnd=0;
@@ -2031,7 +1819,7 @@ bool getDefs(const QCString &scName,const QCString &memberName,
         namespaceName=mScope.copy();
       }
       if (!namespaceName.isEmpty() && 
-          (fnd=namespaceDict[namespaceName]) &&
+          (fnd=Doxygen::namespaceDict[namespaceName]) &&
           fnd->isLinkable()
          )
       {
@@ -2219,7 +2007,7 @@ bool getScopeDefs(const char *docScope,const char *scope,
     {
       return TRUE; // class link written => quit 
     }
-    else if ((nd=namespaceDict[fullName]) && nd->isLinkable())
+    else if ((nd=Doxygen::namespaceDict[fullName]) && nd->isLinkable())
     {
       return TRUE; // namespace link written => quit 
     }
@@ -2255,7 +2043,7 @@ bool getScopeDefs(const char *docScope,const char *scope,
  * instead of :: the # symbol may also be used.
  */
 
-bool generateRef(OutputList &ol,const char *scName,
+bool generateRef(OutputDocInterface &od,const char *scName,
                  const char *name,bool inSeeBlock,const char *rt)
 {
   //printf("generateRef(scName=%s,name=%s,rt=%s)\n",scName,name,rt);
@@ -2276,20 +2064,20 @@ bool generateRef(OutputList &ol,const char *scName,
     {
       if (cd) // scope matches that of a class
       {
-        ol.writeObjectLink(cd->getReference(),
+        od.writeObjectLink(cd->getReference(),
             cd->getOutputFileBase(),0,linkText);
         if (!cd->isReference() /*&& !Config::pdfHyperFlag*/) 
         {
-          writePageRef(ol,cd->getOutputFileBase(),0);
+          writePageRef(od,cd->getOutputFileBase(),0);
         }
       }
       else // scope matches that of a namespace
       {
-        ol.writeObjectLink(nd->getReference(),
+        od.writeObjectLink(nd->getReference(),
             nd->getOutputFileBase(),0,linkText);
         if (!nd->getReference() /*&& !Config::pdfHyperFlag*/) 
         {
-          writePageRef(ol,nd->getOutputFileBase(),0);
+          writePageRef(od,nd->getOutputFileBase(),0);
         }
       }
       // link has been written, stop now.
@@ -2297,7 +2085,7 @@ bool generateRef(OutputList &ol,const char *scName,
     }
     else if (scName==tmpName || (!inSeeBlock && scopePos==-1)) // nothing to link => output plain text
     {
-      ol.docify(linkText);
+      od.docify(linkText);
       // text has been written, stop now.
       return FALSE;
     }
@@ -2358,7 +2146,7 @@ bool generateRef(OutputList &ol,const char *scName,
     {
       //printf("addObjectLink(%s,%s,%s,%s)\n",cd->getReference(),
       //      cd->getOutputFileBase(),anchor.data(),resultName.stripWhiteSpace().data());
-      ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),
+      od.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),
           anchor,linkText.stripWhiteSpace());
       cName=cd->getOutputFileBase();
       aName=md->anchor();
@@ -2366,7 +2154,7 @@ bool generateRef(OutputList &ol,const char *scName,
     else if (nd) // nameStr is a member of nd
     {
       //printf("writing namespace link\n");
-      ol.writeObjectLink(nd->getReference(),nd->getOutputFileBase(),
+      od.writeObjectLink(nd->getReference(),nd->getOutputFileBase(),
           anchor,linkText.stripWhiteSpace());
       cName=nd->getOutputFileBase();
       aName=md->anchor();
@@ -2375,7 +2163,7 @@ bool generateRef(OutputList &ol,const char *scName,
     {
       //printf("addFileLink(%s,%s,%s)\n",fd->getOutputFileBase(),anchor.data(),
       //        resultName.stripWhiteSpace().data());
-      ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),
+      od.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),
           anchor,linkText.stripWhiteSpace());
       cName=fd->getOutputFileBase();
       aName=md->anchor();
@@ -2384,7 +2172,7 @@ bool generateRef(OutputList &ol,const char *scName,
     {
       //printf("addGroupLink(%s,%s,%s)\n",fd->getOutputFileBase().data(),anchor.data(),
       //        gd->name().data());
-      ol.writeObjectLink(gd->getReference(),gd->getOutputFileBase(),
+      od.writeObjectLink(gd->getReference(),gd->getOutputFileBase(),
           anchor,linkText.stripWhiteSpace());
       cName=gd->getOutputFileBase();
       aName=md->anchor();
@@ -2392,46 +2180,48 @@ bool generateRef(OutputList &ol,const char *scName,
     else // should not be reached
     {
       //printf("add no link fd=cd=0\n");
-      ol.docify(linkText);
+      od.docify(linkText);
     }
 
     // for functions we add the arguments if explicitly specified or else "()"
     if (!rt && (md->isFunction() || md->isPrototype() || md->isSignal() || md->isSlot() || md->isDefine())) 
     {
       if (argsStr.isEmpty() && (!md->isDefine() || md->argsString()!=0))
-      //  ol.writeString("()")
+      //  od.writeString("()")
         ;
       else
-        ol.docify(argsStr);
+        od.docify(argsStr);
     }
 
     // generate the page reference (for LaTeX)
-    if (!cName.isEmpty() || !aName.isEmpty())
+    if ((!cName.isEmpty() || !aName.isEmpty()) && md->isLinkableInProject())
     {
-      writePageRef(ol,cName,aName);
+      writePageRef(od,cName,aName);
     }
     return TRUE;
   }
-  else if (inSeeBlock && !nameStr.isEmpty() && (gd=groupDict[nameStr]))
+  else if (inSeeBlock && !nameStr.isEmpty() && (gd=Doxygen::groupDict[nameStr]))
   { // group link
-    ol.startTextLink(gd->getOutputFileBase(),0);
+    od.startTextLink(gd->getOutputFileBase(),0);
     if (rt) // explict link text
-      ol.docify(rt);
+    {
+      od.docify(rt);
+    }
     else // use group title as the default link text
     {
-      ol.docify(gd->groupTitle());
+      od.docify(gd->groupTitle());
     }
-    ol.endTextLink();
+    od.endTextLink();
     return TRUE;
   }
 
   // nothing found
   if (rt) 
-    ol.docify(rt); 
+    od.docify(rt); 
   else 
   {
-    ol.docify(linkText);
-    if (!argsStr.isEmpty()) ol.docify(argsStr);
+    od.docify(linkText);
+    if (!argsStr.isEmpty()) od.docify(argsStr);
   }
   return FALSE;
 }
@@ -2443,7 +2233,7 @@ bool generateRef(OutputList &ol,const char *scName,
 // basis for the link's text.
 // returns TRUE if a link could be generated.
 
-bool generateLink(OutputList &ol,const char *clName,
+bool generateLink(OutputDocInterface &od,const char *clName,
                      const char *lr,bool inSeeBlock,const char *lt)
 {
   //printf("generateLink clName=`%s' lr=`%s' lt=`%s'\n",clName,lr,lt);
@@ -2454,69 +2244,84 @@ bool generateLink(OutputList &ol,const char *clName,
   bool ambig;
   if (linkRef.isEmpty()) // no reference name!
   {
-    ol.docify(lt);
+    od.docify(lt);
     return FALSE;
   }
-  else if ((pi=pageSDict->find(linkRef))) // link to a page
+  else if ((pi=Doxygen::pageSDict->find(linkRef))) // link to a page
   {
     GroupDef *gd = pi->inGroup;
     if (gd)
     {
       SectionInfo *si=0;
-      if (!pi->name.isEmpty()) si=sectionDict[pi->name];
-      ol.writeObjectLink(gd->getReference(),gd->getOutputFileBase(),si ? si->label.data() : 0,lt);  
-      writePageRef(ol,gd->getOutputFileBase(),si ? si->label.data() : 0);
+      if (!pi->name.isEmpty()) si=Doxygen::sectionDict[pi->name];
+      od.writeObjectLink(gd->getReference(),gd->getOutputFileBase(),si ? si->label.data() : 0,lt);  
+      if (gd->isLinkableInProject())
+      {
+        writePageRef(od,gd->getOutputFileBase(),si ? si->label.data() : 0);
+      }
     }
     else
     {
-      ol.writeObjectLink(pi->getReference(),pi->getOutputFileBase(),0,lt);  
-      writePageRef(ol,pi->name,0);
+      od.writeObjectLink(pi->getReference(),pi->getOutputFileBase(),0,lt);  
+      if (!pi->isReference())
+      {
+        writePageRef(od,pi->name,0);
+      }
     }
     return TRUE;
   }
-  else if ((pi=exampleSDict->find(linkRef))) // link to an example
+  else if ((pi=Doxygen::exampleSDict->find(linkRef))) // link to an example
   {
-    ol.writeObjectLink(0,convertFileName(pi->name)+"-example",0,lt);
-    writePageRef(ol,convertFileName(pi->name)+"-example",0);
+    od.writeObjectLink(0,convertFileName(pi->name)+"-example",0,lt);
+    if (!pi->isReference())
+    {
+      writePageRef(od,convertFileName(pi->name)+"-example",0);
+    }
     return TRUE;
   }
-  else if ((gd=groupDict[linkRef])) // link to a group
+  else if ((gd=Doxygen::groupDict[linkRef])) // link to a group
   {
-    ol.startTextLink(gd->getOutputFileBase(),0);
+    od.startTextLink(gd->getOutputFileBase(),0);
     if (lt)
-      ol.docify(lt);
+      od.docify(lt);
     else
-      ol.docify(gd->groupTitle());
-    ol.endTextLink();
-    writePageRef(ol,gd->getOutputFileBase(),0);
+      od.docify(gd->groupTitle());
+    od.endTextLink();
+    if (gd->isLinkableInProject())
+    {
+      writePageRef(od,gd->getOutputFileBase(),0);
+    }
     return TRUE;
   }
-  else if ((fd=findFileDef(inputNameDict,linkRef,ambig))
+  else if ((fd=findFileDef(Doxygen::inputNameDict,linkRef,ambig))
        && fd->isLinkable())
   {
         // link to documented input file
-    ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,lt);
-    writePageRef(ol,fd->getOutputFileBase(),0);
+    od.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,lt);
+    if (fd->isLinkableInProject())
+    {
+      writePageRef(od,fd->getOutputFileBase(),0);
+    }
     return TRUE;
   }
   else // probably a class or member reference
   {
-    return generateRef(ol,clName,lr,inSeeBlock,lt);
+    return generateRef(od,clName,lr,inSeeBlock,lt);
   }
 }
 
-void generateFileRef(OutputList &ol,const char *name,const char *text)
+void generateFileRef(OutputDocInterface &od,const char *name,const char *text)
 {
   QCString linkText = text ? text : name;
   //FileInfo *fi;
   FileDef *fd;
   bool ambig;
-  if ((fd=findFileDef(inputNameDict,name,ambig)) && 
+  if ((fd=findFileDef(Doxygen::inputNameDict,name,ambig)) && 
       fd->isLinkable()) 
     // link to documented input file
-    ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,linkText);
+    od.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,linkText);
   else
-    ol.docify(linkText); 
+    od.docify(linkText); 
 }
 
 //----------------------------------------------------------------------
@@ -2668,20 +2473,6 @@ QCString showFileDefMatches(const FileNameDict *fnDict,const char *n)
 
 //----------------------------------------------------------------------
 
-void setFileNameForSections(QList<QCString> *anchorList,const char *fileName)
-{
-  if (!anchorList) return;
-  QCString *s=anchorList->first();
-  while (s)
-  {
-    SectionInfo *si=0;
-    if (!s->isEmpty() && (si=sectionDict[*s])) si->fileName=fileName;
-    s=anchorList->next();
-  }
-}
-
-//----------------------------------------------------------------------
-
 QCString substituteKeywords(const QCString &s,const char *title)
 {
   QCString result = s.copy();
@@ -2902,3 +2693,13 @@ QCString convertToHtml(const char *s)
   return convertToXML(s);
 }
 
+/*! Returns the standard string that is generated when the \\overload
+ * command is used.
+ */
+const char *getOverloadDocs()
+{
+  return "This is an overloaded member function, "
+         "provided for convenience. It differs from the above "
+         "function only in what argument(s) it accepts.";
+}
+      
diff --git a/src/util.h b/src/util.h
index 9f2df2a..510b553 100644
--- a/src/util.h
+++ b/src/util.h
@@ -31,13 +31,13 @@ class NamespaceDef;
 class FileNameDict;
 class ArgumentList;
 class OutputList;
+class OutputDocInterface;
 class MemberDef;
 class ExampleList;
 class ClassList;
 class BaseClassList;
 class GroupDef;
 class NamespaceList;
-class OutputList;
 
 //--------------------------------------------------------------------
 
@@ -54,27 +54,14 @@ class TextGeneratorIntf
 class TextGeneratorOLImpl : public TextGeneratorIntf
 {
   public:
-    TextGeneratorOLImpl(OutputList &ol);
+    TextGeneratorOLImpl(OutputDocInterface &od);
     void writeString(const char *s) const;
     void writeBreak() const;
     void writeLink(const char *extRef,const char *file,
                    const char *anchor,const char *text
                   ) const;
   private:
-    OutputList &m_ol;
-};
-
-class TextGeneratorXMLImpl : public TextGeneratorIntf
-{
-  public:
-    TextGeneratorXMLImpl(QTextStream &t);
-    void writeString(const char *s) const;
-    void writeBreak() const;
-    void writeLink(const char *extRef,const char *file,
-                   const char *anchor,const char *text
-                  ) const;
-  private:
-    QTextStream &m_t;
+    OutputDocInterface &m_od;
 };
 
 //--------------------------------------------------------------------
@@ -96,12 +83,15 @@ extern bool getDefs(const QCString &scopeName,
                     bool forceEmptyScope=FALSE,
                     FileDef *currentFile=0
                    );
-extern bool generateRef(OutputList &ol,const char *,
+
+extern bool generateRef(OutputDocInterface &od,const char *,
                         const char *,bool inSeeBlock,const char * =0);
-extern bool generateLink(OutputList &ol,const char *,
+extern bool generateLink(OutputDocInterface &od,const char *,
                          const char *,bool inSeeBlock,const char *);
-extern void generateFileRef(OutputList &ol,const char *,
+extern void generateFileRef(OutputDocInterface &od,const char *,
                              const char *linkTxt=0);
+void writePageRef(OutputDocInterface &od,const char *cn,const char *mn);
+
 extern bool matchArguments(ArgumentList *,ArgumentList *,
                            const char *cl=0,const char *ns=0,bool checkCV=TRUE,
                            NamespaceList *usingList=0);
@@ -119,23 +109,23 @@ extern QCString showFileDefMatches(const FileNameDict *fnDict,const char *n);
 extern int guessSection(const char *name);
 extern bool isId(char c);
 extern QCString removeRedundantWhiteSpace(const QCString &s);
-extern void startTitle(OutputList &ol,const char *fileName);
-extern void endTitle(OutputList &ol,const char *fileName,const char *name);
-void startFile(OutputList &ol,const char *name,
-               const char *title,bool external=FALSE);
-void endFile(OutputList &ol,bool external=FALSE);
-void writeQuickLinks(OutputList &ol,bool compact,bool external=FALSE);
+//extern void startTitle(OutputList &ol,const char *fileName);
+//extern void endTitle(OutputList &ol,const char *fileName,const char *name);
+//void startFile(OutputList &ol,const char *name,
+//               const char *title,bool external=FALSE);
+//void endFile(OutputList &ol,bool external=FALSE);
+//void writeQuickLinks(OutputList &ol,bool compact,bool external=FALSE);
 QCString argListToString(ArgumentList *al);
 QCString tempArgListToString(ArgumentList *al);
 QCString generateMarker(int id);
 void writeExample(OutputList &ol,ExampleList *el);
-void setFileNameForSections(QList<QCString> *anchorList,const char *fileName);
+//void setFileNameForSections(QList<QCString> *anchorList,const char *fileName,
+//                            PageInfo *pi=0);
 QCString stripAnnonymousScope(const QCString &s);
 QCString stripAnnonymousNamespaceScope(const QCString &s);
 QCString stripFromPath(const QCString &path);
 bool rightScopeMatch(const QCString &scope, const QCString &name);
 bool leftScopeMatch(const QCString &scope, const QCString &name);
-void writePageRef(OutputList &ol,const char *cn,const char *mn);
 QCString substituteKeywords(const QCString &s,const char *title);
 int getPrefixIndex(const QCString &name);
 QCString removeAnonymousScopes(const QCString &s);
@@ -151,6 +141,7 @@ QCString stripScope(const char *name);
 int iSystem(const char *command,const char *args,bool isBatchFile=FALSE);
 QCString convertToHtml(const char *s);
 QCString convertToXML(const char *s);
+const char * getOverloadDocs();
 
 #endif
 
diff --git a/src/xml.cpp b/src/xml.cpp
deleted file mode 100644
index 4fba201..0000000
--- a/src/xml.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/******************************************************************************
- *
- * 
- *
- *
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby 
- * granted. No representations are made about the suitability of this software 
- * for any purpose. It is provided "as is" without express or implied warranty.
- * See the GNU General Public License for more details.
- *
- * Documents produced by Doxygen are derivative works derived from the
- * input used in their production; they are not affected by this license.
- *
- */
-
-#include "qtbc.h"
-#include "xml.h"
-#include "doxygen.h"
-#include "message.h"
-#include "config.h"
-#include "classlist.h"
-#include "util.h"
-
-#include <qdir.h>
-#include <qfile.h>
-#include <qtextstream.h>
-
-const char dtd_data[]=
-#include "xml_dtd.h"
-;
-
-void generateDTD()
-{
-  QCString fileName=Config::outputDir+"/xml/doxygen.dtd";
-  QFile f(fileName);
-  if (!f.open(IO_WriteOnly))
-  {
-    err("Cannot open file %s for writing!\n",fileName.data());
-    return;
-  }
-  QTextStream t(&f);
-  t << dtd_data;
-}
-
-void writeXMLString(QTextStream &t,const char *s)
-{
-  t << convertToXML(s);
-}
-
-void writeXMLLink(QTextStream &t,const char *compoundId,const char *memId,
-                  const char *text)
-{
-  if (memId==0)
-  {
-    t << "<compoundref idref=\"" << compoundId << "\">";
-    writeXMLString(t,text);
-    t << "</compoundref>";
-  }
-  else
-  {
-    t << "<memberref idref=\"" << compoundId << ":" << memId << "\">";
-    writeXMLString(t,text);
-    t << "</memberref>";
-  }
-}
-
-void generateXML()
-{
-  QDir dir(Config::outputDir);
-  if (!dir.exists())
-  {
-    dir.setPath(QDir::currentDirPath());
-    if (!dir.mkdir(Config::outputDir))
-    {
-      err("Cannot create directory %s\n",Config::outputDir.data());
-      return;
-    }
-  }
-  QDir xmlDir(Config::outputDir+"/xml");
-  if (!xmlDir.exists() && !xmlDir.mkdir(Config::outputDir+"/xml"))
-  {
-    err("Could not create xml directory in %s\n",Config::outputDir.data());
-    return;
-  }
-  generateDTD();
-  
-  QCString fileName=Config::outputDir+"/xml/doxygen.xml";
-  QFile f(fileName);
-  if (!f.open(IO_WriteOnly))
-  {
-    err("Cannot open file %s for writing!\n",fileName.data());
-    return;
-  }
-  QTextStream t(&f);
-  t << "<?xml version='1.0' encoding='ISO-8859-1' standalone='no'?>" << endl;
-  t << "<!DOCTYPE doxygen SYSTEM \"doxygen.dtd\">" << endl;
-  t << "<doxygen>" << endl;
-  if (classList.count()+inputNameList.count()>0)
-  {
-    t << "  <compoundlist>" << endl;
-    ClassListIterator cli(classList);
-    ClassDef *cd;
-    for (cli.toFirst();(cd=cli.current());++cli)
-    {
-      cd->generateXML(t);
-    }
-    FileNameListIterator fnli(inputNameList);
-    FileName *fn;
-    for (;(fn=fnli.current());++fnli)
-    {
-      FileNameIterator fni(*fn);
-      FileDef *fd;
-      for (;(fd=fni.current());++fni)
-      {
-        fd->generateXML(t);
-      }
-    }
-    t << "  </compoundlist>" << endl;
-  }
-  t << "</doxygen>" << endl;
-}
-
-
diff --git a/src/xml.h b/src/xml.h
deleted file mode 100644
index b56efa4..0000000
--- a/src/xml.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/******************************************************************************
- *
- * 
- *
- * Copyright (C) 1997-2001 by Dimitri van Heesch.
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby 
- * granted. No representations are made about the suitability of this software 
- * for any purpose. It is provided "as is" without express or implied warranty.
- * See the GNU General Public License for more details.
- *
- */
-
-#ifndef XML_H
-#define XML_H
-
-class QTextStream;
-
-void generateXML();
-void writeXMLString(QTextStream &t,const char *s);
-void writeXMLString(QTextStream &t,const char *s);
-void writeXMLLink(QTextStream &t,const char *compoundRef,const char *memAnchor,
-                                 const char *text);
-
-#endif
diff --git a/src/xml_dtd.h b/src/xml_dtd.h
deleted file mode 100644
index 010a465..0000000
--- a/src/xml_dtd.h
+++ /dev/null
@@ -1,117 +0,0 @@
-"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
-"<!-- DTD describing the grammar used in doxygen's XML output -->\n"
-"\n"
-"<!-- standard character entities -->\n"
-"<!ENTITY lt     \"&#38;#60;\"> \n"
-"<!ENTITY gt     \"&#62;\"> \n"
-"<!ENTITY amp    \"&#38;#38;\"> \n"
-"<!ENTITY apos   \"&#39;\"> \n"
-"<!ENTITY quot   \"&#34;\"> \n"
-"\n"
-"<!-- required attributes for compounds -->\n"
-"<!ENTITY % compound-req.att \n"
-"                       'id      ID                           #REQUIRED\n"
-"                        type    (group|file|namespace|\n"
-"                                 class|struct|union|\n"
-"                                 interface|dispinterface|\n"
-"                                 valuetype|library)          #REQUIRED'\n"
-">\n"
-"<!-- required attributes for references -->\n"
-"<!ENTITY % ref-req.att   'idref IDREF                        #REQUIRED'\n"
-">\n"
-"<!-- required attributes for inheritance relations -->\n"
-"<!ENTITY % inheritcompref-req.att\n"
-"                         '%ref-req.att;\n"
-"                          prot (public|protected|private)    #REQUIRED\n"
-"                          virt (non-virtual|virtual)         #REQUIRED'\n"
-">\n"
-"\n"
-"<!-- required attributes for member sections -->\n"
-"<!ENTITY % sec-req.att  'type   (user\n"
-"                                |public-type\n"
-"                                |public-func\n"
-"                                |public-attrib\n"
-"                                |public-slot\n"
-"                                |public-static-func\n"
-"                                |public-static-attrib\n"
-"                                |protected-type\n"
-"                                |protected-func\n"
-"                                |protected-attrib\n"
-"                                |protected-slot\n"
-"                                |protected-static-func\n"
-"                                |protected-static-attrib\n"
-"                                |private-type\n"
-"                                |private-func\n"
-"                                |private-attrib\n"
-"                                |private-slot\n"
-"                                |private-static-func\n"
-"                                |private-static-attrib\n"
-"                                |signal\n"
-"                                |friend\n"
-"                                |related\n"
-"				|define|prototype|typedef|enum|func|var\n"
-"	                        |dcop-func\n"
-"                                |property\n"
-"                                )                            #REQUIRED\n"
-"                        '\n"
-">\n"
-"<!-- required attributes for members -->\n"
-"<!ENTITY % mem-req.att  'id     ID                           #REQUIRED'>\n"
-"\n"
-"<!-- optional attributes for function -->\n"
-"<!ENTITY % func-opt.att 'virt   (virtual|pure-virtual)       #IMPLIED'>\n"
-"\n"
-"<!-- elements -->\n"
-"<!ELEMENT doxygen (compoundlist?)>\n"
-"<!ELEMENT compoundlist (compounddef)+>\n"
-"<!ELEMENT compounddef (compoundname,\n"
-"                       basecompoundlist?,  \n"
-"                       derivedcompoundlist?, \n"
-"                       sectionlist?        \n"
-"                      )\n"
-">\n"
-"<!ATTLIST compounddef %compound-req.att;>\n"
-"<!ELEMENT basecompoundlist (basecompoundref)+>\n"
-"<!ELEMENT derivedcompoundlist (derivedcompoundref)+>\n"
-"<!ELEMENT compoundref (#PCDATA)>\n"
-"<!ATTLIST compoundref %ref-req.att;>\n"
-"<!ELEMENT memberref   (#PCDATA)>\n"
-"<!ATTLIST memberref   %ref-req.att;>\n"
-"<!ELEMENT basecompoundref EMPTY>\n"
-"<!ATTLIST basecompoundref %inheritcompref-req.att;>\n"
-"<!ELEMENT derivedcompoundref EMPTY>\n"
-"<!ATTLIST derivedcompoundref %inheritcompref-req.att;>\n"
-"<!ELEMENT sectionlist (sectiondef)+>\n"
-"<!ELEMENT sectiondef  (memberlist)>\n"
-"<!ATTLIST sectiondef  %sec-req.att;>\n"
-"<!ELEMENT memberlist  (functiondef|variabledef|typedef|definedef|enumdef)+>\n"
-"<!ELEMENT functiondef (type?,name,paramlist)>\n"
-"<!ATTLIST functiondef %mem-req.att; %func-opt.att;>\n"
-"<!ELEMENT variabledef (type,name,array?,initializer?)>\n"
-"<!ATTLIST variabledef %mem-req.att;>\n"
-"<!ELEMENT typedef     (type,name)>\n"
-"<!ATTLIST typedef     %mem-req.att;>\n"
-"<!ELEMENT definedef   (name,defparamlist?,initializer?)>\n"
-"<!ATTLIST definedef   %mem-req.att;>\n"
-"<!ELEMENT enumdef     (name,enumvaluelist)>\n"
-"<!ATTLIST enumdef     %mem-req.att;>\n"
-"<!ELEMENT slotdef     (type,name,paramlist)>\n"
-"<!ATTLIST slotdef     %mem-req.att;>\n"
-"<!ELEMENT signaldef   (type,name,paramlist)>\n"
-"<!ATTLIST signaldef   %mem-req.att;>\n"
-"<!ELEMENT paramlist (param)*>\n"
-"<!ELEMENT param (attributes?,type,declname?,defname?,array?,defval?)>\n"
-"<!ELEMENT defparamlist (defarg)*>\n"
-"<!ELEMENT defarg (#PCDATA)>\n"
-"<!ELEMENT enumvaluelist (enumvalue)*>\n"
-"<!ELEMENT enumvalue (name,initializer?)>\n"
-"<!ELEMENT name (#PCDATA)>\n"
-"<!ELEMENT compoundname (#PCDATA)>\n"
-"<!ELEMENT declname (#PCDATA)>\n"
-"<!ELEMENT defname (#PCDATA)>\n"
-"<!ELEMENT type (#PCDATA|memberref|compoundref|compounddef)*>\n"
-"<!ELEMENT defval (#PCDATA|memberref|compoundref)*>\n"
-"<!ELEMENT initializer (#PCDATA|memberref|compoundref)*>\n"
-"<!ELEMENT array (#PCDATA)>\n"
-"<!ELEMENT attributes (#PCDATA)>\n"
-"\n"
-- 
cgit v0.12