summaryrefslogtreecommitdiffstats
path: root/addon
diff options
context:
space:
mode:
Diffstat (limited to 'addon')
-rw-r--r--addon/configgen/config_templ.l89
-rw-r--r--addon/configgen/configgen.cpp20
-rw-r--r--addon/xmlgen/Makefile.in12
-rw-r--r--addon/xmlgen/doxygen.dtd117
-rw-r--r--addon/xmlgen/main.cpp40
-rw-r--r--addon/xmlgen/xml.cpp519
-rw-r--r--addon/xmlgen/xml.h26
-rw-r--r--addon/xmlgen/xml_dtd.h117
-rw-r--r--addon/xmlgen/xmlgen.pro.in20
-rw-r--r--addon/xmlgen/xmlgen.t20
10 files changed, 881 insertions, 99 deletions
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