diff options
Diffstat (limited to 'src')
43 files changed, 2893 insertions, 733 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp index 0a9ae3e..86e4ba3 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -21,7 +21,6 @@ #include "classdef.h" #include "classlist.h" #include "entry.h" -#include "doc.h" #include "doxygen.h" #include "membername.h" #include "message.h" @@ -160,24 +159,24 @@ void ClassDef::insertSubClass(ClassDef *cd,Protection p, void ClassDef::addMembersToMemberGroup() { ::addMembersToMemberGroup(&pubTypes,memberGroupSDict,this); - ::addMembersToMemberGroup(&pubMembers,memberGroupSDict,this); + ::addMembersToMemberGroup(&pubMethods,memberGroupSDict,this); ::addMembersToMemberGroup(&pubAttribs,memberGroupSDict,this); ::addMembersToMemberGroup(&pubSlots,memberGroupSDict,this); ::addMembersToMemberGroup(&signals,memberGroupSDict,this); ::addMembersToMemberGroup(&dcopMethods,memberGroupSDict,this); - ::addMembersToMemberGroup(&pubStaticMembers,memberGroupSDict,this); + ::addMembersToMemberGroup(&pubStaticMethods,memberGroupSDict,this); ::addMembersToMemberGroup(&pubStaticAttribs,memberGroupSDict,this); ::addMembersToMemberGroup(&proTypes,memberGroupSDict,this); - ::addMembersToMemberGroup(&proMembers,memberGroupSDict,this); + ::addMembersToMemberGroup(&proMethods,memberGroupSDict,this); ::addMembersToMemberGroup(&proAttribs,memberGroupSDict,this); ::addMembersToMemberGroup(&proSlots,memberGroupSDict,this); - ::addMembersToMemberGroup(&proStaticMembers,memberGroupSDict,this); + ::addMembersToMemberGroup(&proStaticMethods,memberGroupSDict,this); ::addMembersToMemberGroup(&proStaticAttribs,memberGroupSDict,this); ::addMembersToMemberGroup(&priTypes,memberGroupSDict,this); - ::addMembersToMemberGroup(&priMembers,memberGroupSDict,this); + ::addMembersToMemberGroup(&priMethods,memberGroupSDict,this); ::addMembersToMemberGroup(&priAttribs,memberGroupSDict,this); ::addMembersToMemberGroup(&priSlots,memberGroupSDict,this); - ::addMembersToMemberGroup(&priStaticMembers,memberGroupSDict,this); + ::addMembersToMemberGroup(&priStaticMethods,memberGroupSDict,this); ::addMembersToMemberGroup(&priStaticAttribs,memberGroupSDict,this); ::addMembersToMemberGroup(&friends,memberGroupSDict,this); ::addMembersToMemberGroup(&related,memberGroupSDict,this); @@ -278,16 +277,16 @@ void ClassDef::internalInsertMember(MemberDef *md, switch (prot) { case Protected: - proStaticMembers.append(md); - md->setSectionList(this,&proStaticMembers); + proStaticMethods.append(md); + md->setSectionList(this,&proStaticMethods); break; case Public: - pubStaticMembers.append(md); - md->setSectionList(this,&pubStaticMembers); + pubStaticMethods.append(md); + md->setSectionList(this,&pubStaticMethods); break; case Private: - priStaticMembers.append(md); - md->setSectionList(this,&priStaticMembers); + priStaticMethods.append(md); + md->setSectionList(this,&priStaticMethods); break; } } @@ -335,16 +334,16 @@ void ClassDef::internalInsertMember(MemberDef *md, switch (prot) { case Protected: - proMembers.append(md); - md->setSectionList(this,&proMembers); + proMethods.append(md); + md->setSectionList(this,&proMethods); break; case Public: - pubMembers.append(md); - md->setSectionList(this,&pubMembers); + pubMethods.append(md); + md->setSectionList(this,&pubMethods); break; case Private: - priMembers.append(md); - md->setSectionList(this,&priMembers); + priMethods.append(md); + md->setSectionList(this,&priMethods); break; } } @@ -500,12 +499,12 @@ void ClassDef::insertMember(MemberDef *md) void ClassDef::computeAnchors() { ClassDef *context = Config_getBool("INLINE_INHERITED_MEMB") ? this : 0; - setAnchors(context,'a',&pubMembers); - setAnchors(context,'b',&proMembers); - setAnchors(context,'c',&priMembers); - setAnchors(context,'d',&pubStaticMembers); - setAnchors(context,'e',&proStaticMembers); - setAnchors(context,'f',&priStaticMembers); + setAnchors(context,'a',&pubMethods); + setAnchors(context,'b',&proMethods); + setAnchors(context,'c',&priMethods); + setAnchors(context,'d',&pubStaticMethods); + setAnchors(context,'e',&proStaticMethods); + setAnchors(context,'f',&priStaticMethods); setAnchors(context,'g',&pubSlots); setAnchors(context,'h',&proSlots); setAnchors(context,'i',&priSlots); @@ -687,7 +686,7 @@ static void writeTemplateSpec(OutputList &ol,Definition *d, } // write the detailed description for this class -void ClassDef::writeDetailedDescription(OutputList &ol, OutputList &briefOutput, const QCString &pageType, bool exampleFlag) +void ClassDef::writeDetailedDescription(OutputList &ol, const QCString &pageType, bool exampleFlag) { if ((!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) || !documentation().isEmpty() || @@ -701,7 +700,7 @@ void ClassDef::writeDetailedDescription(OutputList &ol, OutputList &briefOutput, ol.writeAnchor(0,"_details"); ol.popGeneratorState(); ol.startGroupHeader(); - parseText(ol,theTranslator->trDetailedDescription()); + ol.parseText(theTranslator->trDetailedDescription()); ol.endGroupHeader(); ol.startTextBlock(); @@ -710,7 +709,7 @@ void ClassDef::writeDetailedDescription(OutputList &ol, OutputList &briefOutput, // repeat brief description if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) { - ol+=briefOutput; + ol.parseDoc(briefFile(),briefLine(),name(),0,briefDescription(),FALSE); } if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF") && !documentation().isEmpty()) @@ -724,7 +723,7 @@ void ClassDef::writeDetailedDescription(OutputList &ol, OutputList &briefOutput, ol.disableAllBut(OutputGenerator::RTF); ol.newParagraph(); ol.popGeneratorState(); - parseDoc(ol,docFile(),docLine(),name(),0,documentation()+"\n"); + ol.parseDoc(docFile(),docLine(),name(),0,documentation()+"\n",FALSE); } // write examples if (exampleFlag) @@ -759,7 +758,7 @@ void ClassDef::writeDocumentation(OutputList &ol) if (m_tempArgs) pageTitle.prepend(" Template"); startFile(ol,getOutputFileBase(),name(),pageTitle); startTitle(ol,getOutputFileBase()); - parseText(ol,theTranslator->trCompoundReference(displayName(),m_compType,m_tempArgs!=0)); + ol.parseText(theTranslator->trCompoundReference(displayName(),m_compType,m_tempArgs!=0)); addGroupListToTitle(ol,this); endTitle(ol,getOutputFileBase(),name()); @@ -769,13 +768,11 @@ void ClassDef::writeDocumentation(OutputList &ol) bool exampleFlag=hasExamples(); // write brief description - OutputList briefOutput(&ol); if (!briefDescription().isEmpty()) { - parseDoc(briefOutput,briefFile(),briefLine(),name(),0,briefDescription()); if (!Config_getBool("DETAILS_AT_TOP")) { - ol+=briefOutput; + ol.parseDoc(briefFile(),briefLine(),name(),0,briefDescription(),FALSE); ol.writeString(" \n"); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); @@ -786,7 +783,7 @@ void ClassDef::writeDocumentation(OutputList &ol) exampleFlag ) { - parseText(ol,theTranslator->trMore()); + ol.parseText(theTranslator->trMore()); } ol.endTextLink(); ol.popGeneratorState(); @@ -878,7 +875,7 @@ void ClassDef::writeDocumentation(OutputList &ol) // now replace all markers in inheritLine with links to the classes while ((newIndex=marker.match(inheritLine,index,&matchLen))!=-1) { - parseText(ol,inheritLine.mid(index,newIndex-index)); + ol.parseText(inheritLine.mid(index,newIndex-index)); bool ok; uint entryIndex = inheritLine.mid(newIndex+1,matchLen-1).toUInt(&ok); BaseClassDef *bcd=m_inherits->at(entryIndex); @@ -917,7 +914,7 @@ void ClassDef::writeDocumentation(OutputList &ol) } index=newIndex+matchLen; } - parseText(ol,inheritLine.right(inheritLine.length()-index)); + ol.parseText(inheritLine.right(inheritLine.length()-index)); ol.newParagraph(); } @@ -930,7 +927,7 @@ void ClassDef::writeDocumentation(OutputList &ol) // now replace all markers in inheritLine with links to the classes while ((newIndex=marker.match(inheritLine,index,&matchLen))!=-1) { - parseText(ol,inheritLine.mid(index,newIndex-index)); + ol.parseText(inheritLine.mid(index,newIndex-index)); bool ok; uint entryIndex = inheritLine.mid(newIndex+1,matchLen-1).toUInt(&ok); BaseClassDef *bcd=m_inheritedBy->at(entryIndex); @@ -949,7 +946,7 @@ void ClassDef::writeDocumentation(OutputList &ol) } index=newIndex+matchLen; } - parseText(ol,inheritLine.right(inheritLine.length()-index)); + ol.parseText(inheritLine.right(inheritLine.length()-index)); ol.newParagraph(); } @@ -983,7 +980,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); ol.startDotGraph(); - parseText(ol,theTranslator->trClassDiagram(displayName())); + ol.parseText(theTranslator->trClassDiagram(displayName())); ol.endDotGraph(inheritanceGraph); if (Config_getBool("GENERATE_LEGEND")) { @@ -1005,7 +1002,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ClassDiagram diagram(this); // create a diagram of this class. ol.startClassDiagram(); ol.disable(OutputGenerator::Man); - parseText(ol,theTranslator->trClassDiagram(displayName())); + ol.parseText(theTranslator->trClassDiagram(displayName())); ol.enable(OutputGenerator::Man); ol.endClassDiagram(diagram,getOutputFileBase(),displayName()); } @@ -1018,7 +1015,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); ol.startDotGraph(); - parseText(ol,theTranslator->trCollaborationDiagram(displayName())); + ol.parseText(theTranslator->trCollaborationDiagram(displayName())); ol.endDotGraph(usageImplGraph); if (Config_getBool("GENERATE_LEGEND")) { @@ -1043,7 +1040,7 @@ void ClassDef::writeDocumentation(OutputList &ol) { ol.disableAllBut(OutputGenerator::Html); ol.startTextLink(m_memListFileName,0); - parseText(ol,theTranslator->trListOfAllMembers()); + ol.parseText(theTranslator->trListOfAllMembers()); ol.endTextLink(); ol.enableAll(); } @@ -1052,7 +1049,7 @@ void ClassDef::writeDocumentation(OutputList &ol) // write detailed description if the user wants it near the top if (Config_getBool("DETAILS_AT_TOP")) { - writeDetailedDescription(ol,briefOutput,pageType,exampleFlag); + writeDetailedDescription(ol,pageType,exampleFlag); } // write member groups @@ -1082,8 +1079,8 @@ void ClassDef::writeDocumentation(OutputList &ol) signals.writeDeclarations(ol,this,0,0,0,theTranslator->trSignals(),0); dcopMethods.writeDeclarations(ol,this,0,0,0,theTranslator->trDCOPMethods(),0); properties.writeDeclarations(ol,this,0,0,0,theTranslator->trProperties(),0); - pubMembers.writeDeclarations(ol,this,0,0,0,theTranslator->trPublicMembers(),0); - pubStaticMembers.writeDeclarations(ol,this,0,0,0,theTranslator->trStaticPublicMembers(),0); + pubMethods.writeDeclarations(ol,this,0,0,0,theTranslator->trPublicMembers(),0); + pubStaticMethods.writeDeclarations(ol,this,0,0,0,theTranslator->trStaticPublicMembers(),0); // public attribs pubAttribs.writeDeclarations(ol,this,0,0,0,theTranslator->trPublicAttribs(),0); @@ -1094,8 +1091,8 @@ void ClassDef::writeDocumentation(OutputList &ol) // protected methods proSlots.writeDeclarations(ol,this,0,0,0,theTranslator->trProtectedSlots(),0); - proMembers.writeDeclarations(ol,this,0,0,0,theTranslator->trProtectedMembers(),0); - proStaticMembers.writeDeclarations(ol,this,0,0,0,theTranslator->trStaticProtectedMembers(),0); + proMethods.writeDeclarations(ol,this,0,0,0,theTranslator->trProtectedMembers(),0); + proStaticMethods.writeDeclarations(ol,this,0,0,0,theTranslator->trStaticProtectedMembers(),0); // protected attribs proAttribs.writeDeclarations(ol,this,0,0,0,theTranslator->trProtectedAttribs(),0); @@ -1108,8 +1105,8 @@ void ClassDef::writeDocumentation(OutputList &ol) // private members priSlots.writeDeclarations(ol,this,0,0,0,theTranslator->trPrivateSlots(),0); - priMembers.writeDeclarations(ol,this,0,0,0,theTranslator->trPrivateMembers(),0); - priStaticMembers.writeDeclarations(ol,this,0,0,0,theTranslator->trStaticPrivateMembers(),0); + priMethods.writeDeclarations(ol,this,0,0,0,theTranslator->trPrivateMembers(),0); + priStaticMethods.writeDeclarations(ol,this,0,0,0,theTranslator->trStaticPrivateMembers(),0); // private attribs priAttribs.writeDeclarations(ol,this,0,0,0,theTranslator->trPrivateAttribs(),0); @@ -1128,7 +1125,7 @@ void ClassDef::writeDocumentation(OutputList &ol) // write detailed description if (!Config_getBool("DETAILS_AT_TOP")) { - writeDetailedDescription(ol,briefOutput,pageType,exampleFlag); + writeDetailedDescription(ol,pageType,exampleFlag); } @@ -1162,7 +1159,7 @@ void ClassDef::writeDocumentation(OutputList &ol) { ol.disable(OutputGenerator::Man); ol.writeRuler(); - parseText(ol,theTranslator->trGeneratedFromFiles(m_compType,m_files.count()==1)); + ol.parseText(theTranslator->trGeneratedFromFiles(m_compType,m_files.count()==1)); bool first=TRUE; const char *file = m_files.first(); @@ -1230,9 +1227,9 @@ void ClassDef::writeDocumentation(OutputList &ol) ol.disableAllBut(OutputGenerator::Man); ol.writeString("\n"); ol.startGroupHeader(); - parseText(ol,theTranslator->trAuthor(TRUE,TRUE)); + ol.parseText(theTranslator->trAuthor(TRUE,TRUE)); ol.endGroupHeader(); - parseText(ol,theTranslator->trGeneratedAutomatically(Config_getString("PROJECT_NAME"))); + ol.parseText(theTranslator->trGeneratedAutomatically(Config_getString("PROJECT_NAME"))); ol.popGeneratorState(); ol.endTextBlock(); @@ -1282,11 +1279,11 @@ void ClassDef::writeMemberList(OutputList &ol) startFile(ol,m_memListFileName,m_memListFileName, theTranslator->trMemberList()); startTitle(ol,0); - parseText(ol,displayName()+" "+theTranslator->trMemberList()); + ol.parseText(displayName()+" "+theTranslator->trMemberList()); endTitle(ol,0,0); - parseText(ol,theTranslator->trThisIsTheListOfAllMembers()); + ol.parseText(theTranslator->trThisIsTheListOfAllMembers()); ol.writeObjectLink(getReference(),getOutputFileBase(),0,displayName()); - parseText(ol,theTranslator->trIncludingInheritedMembers()); + ol.parseText(theTranslator->trIncludingInheritedMembers()); //ol.startItemList(); ol.writeString("<table>\n"); @@ -1326,9 +1323,9 @@ void ClassDef::writeMemberList(OutputList &ol) (md->isFriend() && md->argsString())) ol.docify(md->argsString()); else if (md->isEnumerate()) - parseText(ol," "+theTranslator->trEnumName()); + ol.parseText(" "+theTranslator->trEnumName()); else if (md->isEnumValue()) - parseText(ol," "+theTranslator->trEnumValue()); + ol.parseText(" "+theTranslator->trEnumValue()); else if (md->isTypedef()) ol.docify(" typedef"); else if (md->isFriend() && !strcmp(md->typeString(),"friend class")) @@ -1350,13 +1347,13 @@ void ClassDef::writeMemberList(OutputList &ol) if ( md->isFunction() || md->isSignal() || md->isSlot() ) ol.docify(md->argsString()); else if (md->isEnumerate()) - parseText(ol," "+theTranslator->trEnumName()); + ol.parseText(" "+theTranslator->trEnumName()); else if (md->isEnumValue()) - parseText(ol," "+theTranslator->trEnumValue()); + ol.parseText(" "+theTranslator->trEnumValue()); else if (md->isTypedef()) ol.docify(" typedef"); ol.writeString(" ("); - parseText(ol,theTranslator->trDefinedIn()+" "); + ol.parseText(theTranslator->trDefinedIn()+" "); if (cd->isLinkable()) { ol.writeObjectLink(cd->getReference(),cd->getOutputFileBase(),0,cd->displayName()); @@ -1547,8 +1544,8 @@ void ClassDef::writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup) pubTypes.setInGroup(inGroup); pubTypes.writePlainDeclarations(ol,this,0,0,0); - pubMembers.setInGroup(inGroup); - pubMembers.writePlainDeclarations(ol,this,0,0,0); + pubMethods.setInGroup(inGroup); + pubMethods.writePlainDeclarations(ol,this,0,0,0); pubAttribs.setInGroup(inGroup); pubAttribs.writePlainDeclarations(ol,this,0,0,0); pubSlots.setInGroup(inGroup); @@ -1559,34 +1556,34 @@ void ClassDef::writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup) dcopMethods.writePlainDeclarations(ol,this,0,0,0); properties.setInGroup(inGroup); properties.writePlainDeclarations(ol,this,0,0,0); - pubStaticMembers.setInGroup(inGroup); - pubStaticMembers.writePlainDeclarations(ol,this,0,0,0); + pubStaticMethods.setInGroup(inGroup); + pubStaticMethods.writePlainDeclarations(ol,this,0,0,0); pubStaticAttribs.setInGroup(inGroup); pubStaticAttribs.writePlainDeclarations(ol,this,0,0,0); proTypes.setInGroup(inGroup); proTypes.writePlainDeclarations(ol,this,0,0,0); - proMembers.setInGroup(inGroup); - proMembers.writePlainDeclarations(ol,this,0,0,0); + proMethods.setInGroup(inGroup); + proMethods.writePlainDeclarations(ol,this,0,0,0); proAttribs.setInGroup(inGroup); proAttribs.writePlainDeclarations(ol,this,0,0,0); proSlots.setInGroup(inGroup); proSlots.writePlainDeclarations(ol,this,0,0,0); - proStaticMembers.setInGroup(inGroup); - proStaticMembers.writePlainDeclarations(ol,this,0,0,0); + proStaticMethods.setInGroup(inGroup); + proStaticMethods.writePlainDeclarations(ol,this,0,0,0); proStaticAttribs.setInGroup(inGroup); proStaticAttribs.writePlainDeclarations(ol,this,0,0,0); if (Config_getBool("EXTRACT_PRIVATE")) { priTypes.setInGroup(inGroup); priTypes.writePlainDeclarations(ol,this,0,0,0); - priMembers.setInGroup(inGroup); - priMembers.writePlainDeclarations(ol,this,0,0,0); + priMethods.setInGroup(inGroup); + priMethods.writePlainDeclarations(ol,this,0,0,0); priAttribs.setInGroup(inGroup); priAttribs.writePlainDeclarations(ol,this,0,0,0); priSlots.setInGroup(inGroup); priSlots.writePlainDeclarations(ol,this,0,0,0); - priStaticMembers.setInGroup(inGroup); - priStaticMembers.writePlainDeclarations(ol,this,0,0,0); + priStaticMethods.setInGroup(inGroup); + priStaticMethods.writePlainDeclarations(ol,this,0,0,0); priStaticAttribs.setInGroup(inGroup); priStaticAttribs.writePlainDeclarations(ol,this,0,0,0); } diff --git a/src/classdef.h b/src/classdef.h index 1c5ce25..8250b18 100644 --- a/src/classdef.h +++ b/src/classdef.h @@ -102,7 +102,7 @@ class ClassDef : public Definition void writeDocumentationForInnerClasses(OutputList &ol); void writeMemberList(OutputList &ol); void writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup); - void writeDetailedDescription(OutputList &ol,OutputList &briefOutput,const QCString &pageType,bool exampleFlag); + void writeDetailedDescription(OutputList &ol,const QCString &pageType,bool exampleFlag); /*! Return the protection level (Public,Protected,Private) in which * this compound was found. @@ -203,12 +203,12 @@ class ClassDef : public Definition QCString className() const; /* member lists by protection */ - MemberList pubMembers; - MemberList proMembers; - MemberList priMembers; - MemberList pubStaticMembers; - MemberList proStaticMembers; - MemberList priStaticMembers; + MemberList pubMethods; + MemberList proMethods; + MemberList priMethods; + MemberList pubStaticMethods; + MemberList proStaticMethods; + MemberList priStaticMethods; MemberList pubSlots; MemberList proSlots; MemberList priSlots; diff --git a/src/classlist.cpp b/src/classlist.cpp index fcda558..7adacd8 100644 --- a/src/classlist.cpp +++ b/src/classlist.cpp @@ -20,7 +20,6 @@ #include "util.h" #include "outputlist.h" #include "language.h" -#include "doc.h" #include "doxygen.h" ClassList::ClassList() : QList<ClassDef>() @@ -79,11 +78,11 @@ void ClassSDict::writeDeclaration(OutputList &ol,const ClassDef::CompoundType *f ol.startMemberHeader(); if (header) { - parseText(ol,header); + ol.parseText(header); } else { - parseText(ol,theTranslator->trCompounds()); + ol.parseText(theTranslator->trCompounds()); } ol.endMemberHeader(); ol.startMemberList(); @@ -117,7 +116,8 @@ void ClassSDict::writeDeclaration(OutputList &ol,const ClassDef::CompoundType *f if (!cd->briefDescription().isEmpty()) { ol.startMemberDescription(); - parseDoc(ol,cd->briefFile(),cd->briefLine(),cd->name(),0,cd->briefDescription()); + ol.parseDoc(cd->briefFile(),cd->briefLine(),cd->name(),0, + cd->briefDescription(),FALSE); if ((!cd->briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) || !cd->documentation().isEmpty()) { @@ -126,7 +126,7 @@ void ClassSDict::writeDeclaration(OutputList &ol,const ClassDef::CompoundType *f ol.endEmphasis(); ol.docify(" "); ol.startTextLink(cd->getOutputFileBase(),"_details"); - parseText(ol,theTranslator->trMore()); + ol.parseText(theTranslator->trMore()); ol.endTextLink(); ol.startEmphasis(); ol.popGeneratorState(); diff --git a/src/config.l b/src/config.l index 68515a6..30b674c 100644 --- a/src/config.l +++ b/src/config.l @@ -2191,6 +2191,18 @@ void Config::create() FALSE ); //----------------------------------------------------------------------------------------------- + addInfo( "Perl","configuration options related to the Perl output"); + //----------------------------------------------------------------------------------------------- + cb = addBool( + "GENERATE_PERLMOD", + "If the GENERATE_PERLMOD tag is set to YES Doxygen will \n" + "generate a Perl module file that captures the structure of \n" + "the code including all documentation. Note that this \n" + "feature is still experimental and incomplete at the \n" + "moment. \n", + FALSE + ); + //----------------------------------------------------------------------------------------------- addInfo( "Preprocessor","Configuration options related to the preprocessor "); //----------------------------------------------------------------------------------------------- cb = addBool( diff --git a/src/defgen.cpp b/src/defgen.cpp index c0cfa23..5ca16ce 100644 --- a/src/defgen.cpp +++ b/src/defgen.cpp @@ -27,7 +27,6 @@ #include "util.h" #include "defargs.h" #include "outputgen.h" -#include "doc.h" #include "dot.h" #include "code.h" @@ -407,36 +406,36 @@ void generateDEFForClass(ClassDef *cd,QTextStream &t) } int numMembers = - cd->pubTypes.count()+cd->pubMembers.count()+cd->pubAttribs.count()+ + cd->pubTypes.count()+cd->pubMethods.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->pubStaticMethods.count()+ + cd->pubStaticAttribs.count()+cd->proTypes.count()+cd->proMethods.count()+ + cd->proAttribs.count()+cd->proSlots.count()+cd->proStaticMethods.count()+ + cd->proStaticAttribs.count()+cd->priTypes.count()+cd->priMethods.count()+ + cd->priAttribs.count()+cd->priSlots.count()+cd->priStaticMethods.count()+ cd->priStaticAttribs.count()+cd->friends.count()+cd->related.count(); if (numMembers>0) { generateDEFClassSection(cd,t,&cd->pubTypes,"public-type"); - generateDEFClassSection(cd,t,&cd->pubMembers,"public-func"); + generateDEFClassSection(cd,t,&cd->pubMethods,"public-func"); generateDEFClassSection(cd,t,&cd->pubAttribs,"public-attrib"); generateDEFClassSection(cd,t,&cd->pubSlots,"public-slot"); generateDEFClassSection(cd,t,&cd->signals,"signal"); generateDEFClassSection(cd,t,&cd->dcopMethods,"dcop-func"); generateDEFClassSection(cd,t,&cd->properties,"property"); - generateDEFClassSection(cd,t,&cd->pubStaticMembers,"public-static-func"); + generateDEFClassSection(cd,t,&cd->pubStaticMethods,"public-static-func"); generateDEFClassSection(cd,t,&cd->pubStaticAttribs,"public-static-attrib"); generateDEFClassSection(cd,t,&cd->proTypes,"protected-type"); - generateDEFClassSection(cd,t,&cd->proMembers,"protected-func"); + generateDEFClassSection(cd,t,&cd->proMethods,"protected-func"); generateDEFClassSection(cd,t,&cd->proAttribs,"protected-attrib"); generateDEFClassSection(cd,t,&cd->proSlots,"protected-slot"); - generateDEFClassSection(cd,t,&cd->proStaticMembers,"protected-static-func"); + generateDEFClassSection(cd,t,&cd->proStaticMethods,"protected-static-func"); generateDEFClassSection(cd,t,&cd->proStaticAttribs,"protected-static-attrib"); generateDEFClassSection(cd,t,&cd->priTypes,"private-type"); - generateDEFClassSection(cd,t,&cd->priMembers,"private-func"); + generateDEFClassSection(cd,t,&cd->priMethods,"private-func"); generateDEFClassSection(cd,t,&cd->priAttribs,"private-attrib"); generateDEFClassSection(cd,t,&cd->priSlots,"private-slot"); - generateDEFClassSection(cd,t,&cd->priStaticMembers,"private-static-func"); + generateDEFClassSection(cd,t,&cd->priStaticMethods,"private-static-func"); generateDEFClassSection(cd,t,&cd->priStaticAttribs,"private-static-attrib"); generateDEFClassSection(cd,t,&cd->friends,"signal"); generateDEFClassSection(cd,t,&cd->related,"related"); diff --git a/src/definition.cpp b/src/definition.cpp index 75de348..6fa80dd 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -24,7 +24,6 @@ #include "language.h" #include "message.h" #include "outputlist.h" -#include "doc.h" #include "code.h" #include "util.h" #include "groupdef.h" @@ -55,6 +54,9 @@ Definition::Definition(const char *df,int dl, m_partOfGroups=0; m_specialListItems=0; m_briefLine=1; + m_briefFile=(QCString)"<"+name+">"; + m_docLine=1; + m_docFile=(QCString)"<"+name+">"; } Definition::~Definition() @@ -69,6 +71,7 @@ Definition::~Definition() void Definition::addSectionsToDefinition(QList<QCString> *anchorList) { if (!anchorList) return; + //printf("%s: addSectionsToDefinition(%d)\n",name().data(),anchorList->count()); QCString *s=anchorList->first(); while (s) { @@ -87,6 +90,10 @@ void Definition::addSectionsToDefinition(QList<QCString> *anchorList) } si->definition = this; } + else + { + //printf("Section `%s' not found!\n",s->data()); + } s=anchorList->next(); } } @@ -95,12 +102,14 @@ void Definition::writeDocAnchorsToTagFile() { if (!Config_getString("GENERATE_TAGFILE").isEmpty() && m_sectionDict) { + //printf("%s: writeDocAnchors(%d)\n",name().data(),m_sectionDict->count()); QDictIterator<SectionInfo> sdi(*m_sectionDict); SectionInfo *si; for (;(si=sdi.current());++sdi) { if (!si->generated) { + //printf("write an entry!\n"); if (definitionType()==TypeMember) Doxygen::tagFile << " "; Doxygen::tagFile << " <docanchor>" << si->label << "</docanchor>" << endl; } @@ -265,7 +274,7 @@ void Definition::writeSourceDef(OutputList &ol,const char *) if (lineMarkerPos<fileMarkerPos) // line marker before file marker { // write text left from linePos marker - parseText(ol,refText.left(lineMarkerPos)); + ol.parseText(refText.left(lineMarkerPos)); ol.disableAllBut(OutputGenerator::Html); // write line link (HTML only) ol.writeObjectLink(0,m_bodyDef->getSourceFileBase(), @@ -277,7 +286,7 @@ void Definition::writeSourceDef(OutputList &ol,const char *) ol.enableAll(); // write text between markers - parseText(ol,refText.mid(lineMarkerPos+2, + ol.parseText(refText.mid(lineMarkerPos+2, fileMarkerPos-lineMarkerPos-2)); ol.disableAllBut(OutputGenerator::Html); @@ -291,13 +300,13 @@ void Definition::writeSourceDef(OutputList &ol,const char *) ol.enableAll(); // write text right from file marker - parseText(ol,refText.right( + ol.parseText(refText.right( refText.length()-fileMarkerPos-2)); } else // file marker before line marker { // write text left from file marker - parseText(ol,refText.left(fileMarkerPos)); + ol.parseText(refText.left(fileMarkerPos)); ol.disableAllBut(OutputGenerator::Html); // write file link (HTML only) ol.writeObjectLink(0,m_bodyDef->getSourceFileBase(), @@ -309,7 +318,7 @@ void Definition::writeSourceDef(OutputList &ol,const char *) ol.enableAll(); // write text between markers - parseText(ol,refText.mid(fileMarkerPos+2, + ol.parseText(refText.mid(fileMarkerPos+2, lineMarkerPos-fileMarkerPos-2)); ol.disableAllBut(OutputGenerator::Html); @@ -323,7 +332,7 @@ void Definition::writeSourceDef(OutputList &ol,const char *) ol.enableAll(); // write text right from linePos marker - parseText(ol,refText.right( + ol.parseText(refText.right( refText.length()-lineMarkerPos-2)); } } @@ -377,7 +386,7 @@ void Definition::writeSourceRefList(OutputList &ol,const char *scopeName, if (Config_getBool("SOURCE_BROWSER") && members) { ol.newParagraph(); - parseText(ol,text); + ol.parseText(text); ol.docify(" "); QCString ldefLine=theTranslator->trWriteList(members->count()); @@ -388,7 +397,7 @@ void Definition::writeSourceRefList(OutputList &ol,const char *scopeName, while ((newIndex=marker.match(ldefLine,index,&matchLen))!=-1) { bool ok; - parseText(ol,ldefLine.mid(index,newIndex-index)); + ol.parseText(ldefLine.mid(index,newIndex-index)); uint entryIndex = ldefLine.mid(newIndex+1,matchLen-1).toUInt(&ok); MemberDef *md=members->at(entryIndex); if (ok && md) @@ -452,7 +461,7 @@ void Definition::writeSourceRefList(OutputList &ol,const char *scopeName, } index=newIndex+matchLen; } - parseText(ol,ldefLine.right(ldefLine.length()-index)); + ol.parseText(ldefLine.right(ldefLine.length()-index)); ol.writeString("."); } ol.popGeneratorState(); @@ -347,7 +347,7 @@ static void includeFile(OutputDocInterface &od,const char *fileName,bool quiet) FileDef *fd; if ((fd=findFileDef(Doxygen::exampleNameDict,fileName,ambig))) { - currentIncludeFile=fileToString(fd->absFilePath()); + currentIncludeFile=fileToString(fd->absFilePath(),Config_getBool("FILTER_SOURCE_FILES")); includeFileOffset=0; includeFileLength=currentIncludeFile.length(); OutputDocInterface *codeFrag = od.clone(); @@ -384,7 +384,7 @@ static void verbIncludeFile(OutputDocInterface &od,const char *name) if ((fd=findFileDef(Doxygen::exampleNameDict,name,ambig))) { od.startCodeFragment(); - od.codify(fileToString(fd->absFilePath())+"\n"); + od.codify(fileToString(fd->absFilePath(),Config_getBool("FILTER_SOURCE_FILES"))+"\n"); od.endCodeFragment(); } else if (ambig) @@ -2959,7 +2959,7 @@ void parseDoc(OutputDocInterface &od,const char *fileName,int startLine, if (Debug::isFlagSet(Debug::Validate)) { - od.parseDoc(fileName,startLine,clName,md,docStr); + od.parseDoc(fileName,startLine,clName,md,docStr,FALSE); } else { @@ -3029,15 +3029,22 @@ void parseDoc(OutputDocInterface &od,const char *fileName,int startLine, void parseText(OutputDocInterface &od,const QCString &txtString) { if (txtString.isEmpty()) return; - inputString = txtString; - outDoc = od.clone(); - inputPosition = 0; - docYYrestart( docYYin ); - BEGIN( Text ); - docYYlex(); - od.append(outDoc); - delete outDoc; outDoc=0; - return; + if (Debug::isFlagSet(Debug::Validate)) + { + od.parseText(txtString); + } + else + { + inputString = txtString; + outDoc = od.clone(); + inputPosition = 0; + docYYrestart( docYYin ); + BEGIN( Text ); + docYYlex(); + od.append(outDoc); + delete outDoc; outDoc=0; + return; + } } //---------------------------------------------------------------------------- @@ -3045,12 +3052,19 @@ void parseText(OutputDocInterface &od,const QCString &txtString) void parseExample(OutputDocInterface &od,const QCString &docString, const char *fileName) { - initParser(); - initParseCodeContext(); - exampleDoc=TRUE; // cross reference with member docs - exampleName=fileName; - strcpy(yyFileName,fileName); - parseDocument(od,docString); + if (Debug::isFlagSet(Debug::Validate)) + { + od.parseDoc(fileName,/*startLine*/1,/*clName*/0,/*md*/0,docString,TRUE); + } + else + { + initParser(); + initParseCodeContext(); + exampleDoc=TRUE; // cross reference with member docs + exampleName=fileName; + strcpy(yyFileName,fileName); + parseDocument(od,docString); + } } //---------------------------------------------------------------------------- diff --git a/src/docparser.cpp b/src/docparser.cpp index f8c0e19..6ee62e4 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -41,11 +41,16 @@ #define DBG(x) do {} while(0) //#define DBG(x) printf x +#define INTERNAL_ASSERT(x) do {} while(0) +//#define INTERNAL_ASSERT(x) if (!(x)) DBG(("INTERNAL_ASSERT(%s) failed retval=0x%x: file=%s line=%d\n",#x,retval,__FILE__,__LINE__)); + //--------------------------------------------------------------------------- +// global variables during a call to validatingParseDoc static bool g_hasParamCommand; static MemberDef * g_memberDef; static QDict<void> g_paramsFound; +static bool g_isExample; // include file state static QString g_includeFileText; @@ -426,7 +431,7 @@ static int handleStyleArgument(DocNode *parent,QList<DocNode> &children, break; default: warn(g_fileName,doctokenizerYYlineno,"Error: Unexpected token %s", - tokenName.data()); + tokToString(tok)); break; } } @@ -601,7 +606,7 @@ static bool defaultHandleToken(DocNode *parent,int tok, QList<DocNode> &children { doctokenizerYYsetStateHtmlOnly(); int retval = doctokenizerYYlex(); - children.append(new DocVerbatim(parent,g_context,g_token->verb,DocVerbatim::HtmlOnly)); + children.append(new DocVerbatim(parent,g_context,g_token->verb,DocVerbatim::HtmlOnly,g_isExample,g_fileName)); if (retval==0) warn(g_fileName,doctokenizerYYlineno,"Error: htmlonly section ended without end marker"); doctokenizerYYsetStatePara(); } @@ -610,7 +615,7 @@ static bool defaultHandleToken(DocNode *parent,int tok, QList<DocNode> &children { doctokenizerYYsetStateLatexOnly(); int retval = doctokenizerYYlex(); - children.append(new DocVerbatim(parent,g_context,g_token->verb,DocVerbatim::LatexOnly)); + children.append(new DocVerbatim(parent,g_context,g_token->verb,DocVerbatim::LatexOnly,g_isExample,g_fileName)); if (retval==0) warn(g_fileName,doctokenizerYYlineno,"Error: latexonly section ended without end marker",doctokenizerYYlineno); doctokenizerYYsetStatePara(); } @@ -896,7 +901,7 @@ static void readTextFileByName(const QString &file,QString &text) FileDef *fd; if ((fd=findFileDef(Doxygen::exampleNameDict,file,ambig))) { - text = fileToString(fd->absFilePath()); + text = fileToString(fd->absFilePath(),Config_getBool("FILTER_SOURCE_FILES")); } else if (ambig) { @@ -1209,7 +1214,7 @@ void DocSecRefItem::parse() break; default: warn(g_fileName,doctokenizerYYlineno,"Error: Unexpected token %s", - g_token->name.data()); + tokToString(tok)); break; } } @@ -1251,7 +1256,7 @@ void DocSecRefList::parse() int tok=doctokenizerYYlex(); // skip white space - while (tok==TK_WHITESPACE) tok=doctokenizerYYlex(); + while (tok==TK_WHITESPACE || tok==TK_NEWPARA) tok=doctokenizerYYlex(); // handle items while (tok) { @@ -1346,7 +1351,7 @@ void DocInternalRef::parse() break; default: warn(g_fileName,doctokenizerYYlineno,"Error: Unexpected token %s", - g_token->name.data()); + tokToString(tok)); break; } } @@ -1431,7 +1436,7 @@ void DocRef::parse() break; default: warn(g_fileName,doctokenizerYYlineno,"Error: Unexpected token %s", - g_token->name.data()); + tokToString(tok)); break; } } @@ -1531,7 +1536,7 @@ QString DocLink::parse(bool isJavaLink) break; default: warn(g_fileName,doctokenizerYYlineno,"Error: Unexpected token %s", - g_token->name.data()); + tokToString(tok)); break; } } @@ -1576,7 +1581,7 @@ void DocDotFile::parse() break; default: warn(g_fileName,doctokenizerYYlineno,"Error: Unexpected token %s", - g_token->name.data()); + tokToString(tok)); break; } } @@ -1653,7 +1658,7 @@ void DocImage::parse() break; default: warn(g_fileName,doctokenizerYYlineno,"Error: Unexpected token %s", - g_token->name.data()); + tokToString(tok)); break; } } @@ -1748,7 +1753,7 @@ int DocHtmlHeader::parse() break; default: warn(g_fileName,doctokenizerYYlineno,"Error: Unexpected token %s", - g_token->name.data()); + tokToString(tok)); break; } } @@ -1805,7 +1810,7 @@ int DocHRef::parse() break; default: warn(g_fileName,doctokenizerYYlineno,"Error: Unexpected token %s", - g_token->name.data(),doctokenizerYYlineno); + tokToString(tok),doctokenizerYYlineno); break; } } @@ -1947,7 +1952,7 @@ int DocIndexEntry::parse() break; default: warn(g_fileName,doctokenizerYYlineno,"Error: Unexpected token %s", - g_token->name.data()); + tokToString(tok)); break; } } @@ -1998,7 +2003,7 @@ int DocHtmlCaption::parse() break; default: warn(g_fileName,doctokenizerYYlineno,"Error: Unexpected token %s", - g_token->name.data()); + tokToString(tok)); break; } } @@ -2058,7 +2063,7 @@ int DocHtmlRow::parse() // get next token int tok=doctokenizerYYlex(); // skip whitespace - while (tok==TK_WHITESPACE) tok=doctokenizerYYlex(); + while (tok==TK_WHITESPACE || tok==TK_NEWPARA) tok=doctokenizerYYlex(); // should find a html tag now if (tok==TK_HTMLTAG) { @@ -2122,7 +2127,7 @@ getrow: // get next token int tok=doctokenizerYYlex(); // skip whitespace - while (tok==TK_WHITESPACE) tok=doctokenizerYYlex(); + while (tok==TK_WHITESPACE || tok==TK_NEWPARA) tok=doctokenizerYYlex(); // should find a html tag now if (tok==TK_HTMLTAG) { @@ -2224,7 +2229,7 @@ int DocHtmlDescTitle::parse() break; default: warn(g_fileName,doctokenizerYYlineno,"Error: Unexpected token %s", - g_token->name.data()); + tokToString(tok)); break; } } @@ -2397,12 +2402,13 @@ int DocHtmlList::parse() { DBG(("DocHtmlList::parse() start\n")); int retval=RetVal_OK; + int num=1; g_nodeStack.push(this); // get next token int tok=doctokenizerYYlex(); - // skip whitespace - while (tok==TK_WHITESPACE) tok=doctokenizerYYlex(); + // skip whitespace and paragraph breaks + while (tok==TK_WHITESPACE || tok==TK_NEWPARA) tok=doctokenizerYYlex(); // should find a html tag now if (tok==TK_HTMLTAG) { @@ -2433,7 +2439,7 @@ int DocHtmlList::parse() do { - DocHtmlListItem *li=new DocHtmlListItem(this,g_token->attribs); + DocHtmlListItem *li=new DocHtmlListItem(this,g_token->attribs,num++); m_children.append(li); retval=li->parse(); } while (retval==RetVal_ListItem); @@ -2500,11 +2506,12 @@ int DocAutoListItem::parse() int DocAutoList::parse() { int retval = RetVal_OK; + int num=1; g_nodeStack.push(this); // first item or sub list => create new list do { - DocAutoListItem *li = new DocAutoListItem(this); + DocAutoListItem *li = new DocAutoListItem(this,num++); m_children.append(li); retval=li->parse(); } @@ -2542,7 +2549,7 @@ void DocTitle::parse() break; default: warn(g_fileName,doctokenizerYYlineno,"Error: Unexpected token %s", - g_token->name.data()); + tokToString(tok)); break; } } @@ -2671,6 +2678,17 @@ int DocParamSect::parse(const QString &cmdName) g_nodeStack.push(this); DocParamList *pl = new DocParamList(this,m_type); + if (m_children.isEmpty()) + { + pl->markFirst(); + pl->markLast(); + } + else + { + ASSERT(m_children.last()->kind()==DocNode::Kind_ParamList); + ((DocParamList *)m_children.last())->markLast(FALSE); + pl->markLast(); + } m_children.append(pl); retval = pl->parse(cmdName); @@ -2705,7 +2723,6 @@ int DocPara::handleSimpleSection(DocSimpleSect::Type t) int DocPara::handleParamSection(const QString &cmdName,DocParamSect::Type t) { DocParamSect *ps=0; - if (!m_children.isEmpty() && // previous element m_children.last()->kind()==Kind_ParamSect && // was a param sect ((DocParamSect *)m_children.last())->type()==t) // of same type @@ -2762,7 +2779,7 @@ void DocPara::handleIncludeOperator(const QString &cmdName,DocIncOperator::Type tokToString(tok),cmdName.data()); return; } - DocIncOperator *op = new DocIncOperator(this,t,g_token->name,g_context); + DocIncOperator *op = new DocIncOperator(this,t,g_token->name,g_context,g_isExample,g_fileName); DocNode *n1 = m_children.last(); DocNode *n2 = n1!=0 ? m_children.prev() : 0; bool isFirst = n1==0 || // no last node @@ -2981,7 +2998,7 @@ void DocPara::handleInclude(const QString &cmdName,DocInclude::Type t) tokToString(tok),cmdName.data()); return; } - DocInclude *inc = new DocInclude(this,g_token->name,g_context,t); + DocInclude *inc = new DocInclude(this,g_token->name,g_context,t,g_isExample,g_fileName); m_children.append(inc); inc->parse(); } @@ -3119,7 +3136,7 @@ int DocPara::handleCommand(const QString &cmdName) { doctokenizerYYsetStateCode(); retval = doctokenizerYYlex(); - m_children.append(new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::Code)); + m_children.append(new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::Code,g_isExample,g_fileName)); if (retval==0) warn(g_fileName,doctokenizerYYlineno,"Error: code section ended without end marker"); doctokenizerYYsetStatePara(); } @@ -3128,7 +3145,7 @@ int DocPara::handleCommand(const QString &cmdName) { doctokenizerYYsetStateHtmlOnly(); retval = doctokenizerYYlex(); - m_children.append(new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::HtmlOnly)); + m_children.append(new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::HtmlOnly,g_isExample,g_fileName)); if (retval==0) warn(g_fileName,doctokenizerYYlineno,"Error: htmlonly section ended without end marker"); doctokenizerYYsetStatePara(); } @@ -3137,7 +3154,7 @@ int DocPara::handleCommand(const QString &cmdName) { doctokenizerYYsetStateLatexOnly(); retval = doctokenizerYYlex(); - m_children.append(new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::LatexOnly)); + m_children.append(new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::LatexOnly,g_isExample,g_fileName)); if (retval==0) warn(g_fileName,doctokenizerYYlineno,"Error: latexonly section ended without end marker"); doctokenizerYYsetStatePara(); } @@ -3146,7 +3163,7 @@ int DocPara::handleCommand(const QString &cmdName) { doctokenizerYYsetStateVerbatim(); retval = doctokenizerYYlex(); - m_children.append(new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::Verbatim)); + m_children.append(new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::Verbatim,g_isExample,g_fileName)); if (retval==0) warn(g_fileName,doctokenizerYYlineno,"Error: verbatim section ended without end marker"); doctokenizerYYsetStatePara(); } @@ -3317,7 +3334,7 @@ int DocPara::handleCommand(const QString &cmdName) ASSERT(0); break; } - ASSERT(retval==0 || retval==RetVal_OK || retval==RetVal_SimpleSec || + INTERNAL_ASSERT(retval==0 || retval==RetVal_OK || retval==RetVal_SimpleSec || retval==TK_LISTITEM || retval==TK_ENDLIST || retval==TK_NEWPARA || retval==RetVal_Section || retval==RetVal_EndList || retval==RetVal_Internal || retval==RetVal_SwitchLang @@ -3670,20 +3687,30 @@ reparsetoken: m_children.append(new DocURL(this,g_token->name)); break; case TK_WHITESPACE: - // prevent leading whitespace and collapse multiple whitespace areas - if (insidePRE(this) || // all whitespace is relavant - ( // keep only whitespace after words, URL or symbols - !m_children.isEmpty() /* && - ( - m_children.last()->kind()==DocNode::Kind_Word || - m_children.last()->kind()==DocNode::Kind_URL || - m_children.last()->kind()==DocNode::Kind_Symbol - )*/ - ) - ) - { - m_children.append(new DocWhiteSpace(this,g_token->chars)); - } + { + // prevent leading whitespace and collapse multiple whitespace areas + DocNode::Kind k; + if (insidePRE(this) || // all whitespace is relavant + ( + // remove leading whitespace + !m_children.isEmpty() && + // and whitespace after certain constructs + (k=m_children.last()->kind())!=DocNode::Kind_HtmlDescList && + k!=DocNode::Kind_HtmlTable && + k!=DocNode::Kind_HtmlList && + k!=DocNode::Kind_SimpleSect && + k!=DocNode::Kind_AutoList && + k!=DocNode::Kind_SimpleList && + k!=DocNode::Kind_Verbatim && + k!=DocNode::Kind_HtmlHeader && + k!=DocNode::Kind_ParamSect && + k!=DocNode::Kind_XRefItem + ) + ) + { + m_children.append(new DocWhiteSpace(this,g_token->chars)); + } + } break; case TK_LISTITEM: { @@ -3875,13 +3902,10 @@ endparagraph: DocNode *n = g_nodeStack.pop(); ASSERT(n==this); DBG(("DocPara::parse() end retval=%x\n",retval)); - ASSERT(retval==0 || retval==TK_NEWPARA || retval==TK_LISTITEM || + INTERNAL_ASSERT(retval==0 || retval==TK_NEWPARA || retval==TK_LISTITEM || retval==TK_ENDLIST || retval>RetVal_OK ); - if (!(retval==0 || retval==TK_NEWPARA || retval==TK_LISTITEM || - retval==TK_ENDLIST || retval>RetVal_OK - )) warn(g_fileName,doctokenizerYYlineno,"DocPara::parse: Error retval=%x unexpected",retval); return retval; } @@ -3962,7 +3986,7 @@ int DocSection::parse() retval = s->parse(); } } - ASSERT(retval==0 || retval==RetVal_Section || retval==RetVal_Internal); + INTERNAL_ASSERT(retval==0 || retval==RetVal_Section || retval==RetVal_Internal); DBG(("DocSection::parse() end\n")); DocNode *n = g_nodeStack.pop(); @@ -3972,6 +3996,84 @@ int DocSection::parse() //-------------------------------------------------------------------------- +void DocText::parse() +{ + g_nodeStack.push(this); + doctokenizerYYsetStateText(); + + int tok; + while ((tok=doctokenizerYYlex())) // get the next token + { + switch(tok) + { + case TK_WORD: + m_children.append(new DocWord(this,g_token->name)); + break; + case TK_WHITESPACE: + m_children.append(new DocWhiteSpace(this,g_token->chars)); + break; + case TK_SYMBOL: + { + char letter='\0'; + DocSymbol::SymType s = DocSymbol::decodeSymbol(g_token->name,&letter); + if (s!=DocSymbol::Unknown) + { + m_children.append(new DocSymbol(this,s,letter)); + } + else + { + warn(g_fileName,doctokenizerYYlineno,"Error: Unsupported symbol %s found", + g_token->name.data()); + } + } + break; + case TK_COMMAND: + switch (CmdMapper::map(g_token->name)) + { + case CMD_BSLASH: + m_children.append(new DocSymbol(this,DocSymbol::BSlash)); + break; + case CMD_AT: + m_children.append(new DocSymbol(this,DocSymbol::At)); + break; + case CMD_LESS: + m_children.append(new DocSymbol(this,DocSymbol::Less)); + break; + case CMD_GREATER: + m_children.append(new DocSymbol(this,DocSymbol::Greater)); + break; + case CMD_AMP: + m_children.append(new DocSymbol(this,DocSymbol::Amp)); + break; + case CMD_DOLLAR: + m_children.append(new DocSymbol(this,DocSymbol::Dollar)); + break; + case CMD_HASH: + m_children.append(new DocSymbol(this,DocSymbol::Hash)); + break; + case CMD_PERCENT: + m_children.append(new DocSymbol(this,DocSymbol::Percent)); + break; + default: + warn(g_fileName,doctokenizerYYlineno,"Error: Unexpected command `%s' found", + g_token->name.data()); + break; + } + break; + default: + warn(g_fileName,doctokenizerYYlineno,"Error: Unexpected token %s", + tokToString(tok)); + break; + } + } + + DocNode *n = g_nodeStack.pop(); + ASSERT(n==this); +} + + +//-------------------------------------------------------------------------- + void DocRoot::parse() { g_nodeStack.push(this); @@ -4037,11 +4139,11 @@ void DocRoot::parse() DocNode *validatingParseDoc(const char *fileName,int startLine, const char *context,MemberDef *md, - const char *input) + const char *input,bool isExample) { - printf("========== validating %s at line %d\n",fileName,startLine); - printf("---------------- input --------------------\n%s\n----------- end input -------------------\n",input); + //printf("========== validating %s at line %d\n",fileName,startLine); + //printf("---------------- input --------------------\n%s\n----------- end input -------------------\n",input); g_token = new TokenInfo; g_context = context; @@ -4054,6 +4156,7 @@ DocNode *validatingParseDoc(const char *fileName,int startLine, g_includeFileText = ""; g_includeFileOffset = 0; g_includeFileLength = 0; + g_isExample = isExample; g_hasParamCommand = FALSE; g_paramsFound.setAutoDelete(FALSE); g_paramsFound.clear(); @@ -4084,3 +4187,36 @@ DocNode *validatingParseDoc(const char *fileName,int startLine, return root; } +DocNode *validatingParseText(const char *input) +{ + //printf("------------ input ---------\n%s\n" + // "------------ end input -----\n",input); + + g_token = new TokenInfo; + g_context = ""; + g_fileName = "<parseText>"; + g_memberDef = 0; + g_nodeStack.clear(); + g_styleStack.clear(); + g_inSeeBlock = FALSE; + g_insideHtmlLink = FALSE; + g_includeFileText = ""; + g_includeFileOffset = 0; + g_includeFileLength = 0; + g_isExample = FALSE; + g_hasParamCommand = FALSE; + g_paramsFound.setAutoDelete(FALSE); + g_paramsFound.clear(); + + doctokenizerYYlineno=1; + doctokenizerYYinit(input,g_fileName); + + // build abstract syntax tree + DocText *txt = new DocText; + txt->parse(); + + delete g_token; + + return txt; +} + diff --git a/src/docparser.h b/src/docparser.h index 493e9e3..ba3e3fe 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -34,17 +34,26 @@ class MemberDef; //--------------------------------------------------------------------------- /*! Main entry point for the documentation parser. - * @param fileName File in which the documentation block is found. + * @param fileName File in which the documentation block is found (or the + * name of the example file in case isExample is TRUE). * @param startLine Line at which the documentation block is found. * @param context Class or namespace in which of the item to which this * block belongs. + * @param md Member definition to which the documentation belongs. + * Can be 0. * @param input String representation of the documentation block. + * @param isExample TRUE if the documentation belongs to an example. * @returns Root node of the abstract syntax tree. Ownership of the * pointer is handed over to the caller. */ DocNode *validatingParseDoc(const char *fileName,int startLine, const char *context, MemberDef *md, - const char *input); + const char *input,bool isExample); + +/*! Main entry point for parsing simple text fragments. These + * fragments are limited to words, whitespace and symbols. + */ +DocNode *validatingParseText(const char *input); //--------------------------------------------------------------------------- @@ -100,7 +109,8 @@ class DocNode Kind_ParamSect = 44, Kind_ParamList = 45, Kind_InternalRef = 46, - Kind_Copy = 47 + Kind_Copy = 47, + Kind_Text = 48 }; /*! Destructor. */ virtual ~DocNode() {} @@ -306,20 +316,26 @@ class DocVerbatim : public DocNode public: enum Type { Code, HtmlOnly, LatexOnly, Verbatim }; DocVerbatim(DocNode *parent,const QString &context, - const QString &text, Type t) : - m_parent(parent), m_context(context), m_text(text), m_type(t) {} + const QString &text, Type t,bool isExample, + const QString &exampleFile) : + m_parent(parent), m_context(context), m_text(text), m_type(t), + m_isExample(isExample), m_exampleFile(exampleFile) {} Kind kind() const { return Kind_Verbatim; } Type type() const { return m_type; } QString text() const { return m_text; } QString context() const { return m_context; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { v->visit(this); } + bool isExample() const { return m_isExample; } + QString exampleFile() const { return m_exampleFile; } private: DocNode *m_parent; QString m_context; QString m_text; Type m_type; + bool m_isExample; + QString m_exampleFile; }; /*! @brief Node representing an included text block from file */ @@ -328,15 +344,19 @@ class DocInclude : public DocNode public: enum Type { Include, DontInclude, VerbInclude, HtmlInclude }; DocInclude(DocNode *parent,const QString &file, - const QString context, Type t) : - m_parent(parent), m_file(file), m_context(context), m_type(t) {} - Kind kind() const { return Kind_Include; } - QString file() const { return m_file; } - Type type() const { return m_type; } - QString text() const { return m_text; } - QString context() const { return m_context; } - DocNode *parent() const { return m_parent; } - void accept(DocVisitor *v) { v->visit(this); } + const QString context, Type t, + bool isExample,const QString exampleFile) : + m_parent(parent), m_file(file), m_context(context), m_type(t), + m_isExample(isExample), m_exampleFile(exampleFile) {} + Kind kind() const { return Kind_Include; } + QString file() const { return m_file; } + Type type() const { return m_type; } + QString text() const { return m_text; } + QString context() const { return m_context; } + DocNode *parent() const { return m_parent; } + bool isExample() const { return m_isExample; } + QString exampleFile() const { return m_exampleFile; } + void accept(DocVisitor *v) { v->visit(this); } void parse(); private: @@ -345,6 +365,8 @@ class DocInclude : public DocNode QString m_context; QString m_text; Type m_type; + bool m_isExample; + QString m_exampleFile; }; /*! @brief Node representing a include/dontinclude operator block */ @@ -353,21 +375,24 @@ class DocIncOperator : public DocNode public: enum Type { Line, SkipLine, Skip, Until }; DocIncOperator(DocNode *parent,Type t,const QString &pat, - const QString &context) : + const QString &context,bool isExample,const QString &exampleFile) : m_parent(parent), m_type(t), m_pattern(pat), m_context(context), - m_isFirst(FALSE), m_isLast(FALSE) {} - Kind kind() const { return Kind_IncOperator; } - Type type() const { return m_type; } - QString text() const { return m_text; } - QString pattern() const { return m_pattern; } - QString context() const { return m_context; } - DocNode *parent() const { return m_parent; } - void accept(DocVisitor *v) { v->visit(this); } - void parse(); - bool isFirst() const { return m_isFirst; } - bool isLast() const { return m_isLast; } + m_isFirst(FALSE), m_isLast(FALSE), + m_isExample(isExample), m_exampleFile(exampleFile) {} + Kind kind() const { return Kind_IncOperator; } + Type type() const { return m_type; } + QString text() const { return m_text; } + QString pattern() const { return m_pattern; } + QString context() const { return m_context; } + DocNode *parent() const { return m_parent; } + void accept(DocVisitor *v) { v->visit(this); } + bool isFirst() const { return m_isFirst; } + bool isLast() const { return m_isLast; } void markFirst(bool v=TRUE) { m_isFirst = v; } void markLast(bool v=TRUE) { m_isLast = v; } + bool isExample() const { return m_isExample; } + QString exampleFile() const { return m_exampleFile; } + void parse(); private: DocNode *m_parent; @@ -377,6 +402,8 @@ class DocIncOperator : public DocNode QString m_context; bool m_isFirst; bool m_isLast; + bool m_isExample; + QString m_exampleFile; }; /*! @brief Node representing an item of a cross-referenced list */ @@ -886,7 +913,7 @@ class DocParamList : public DocNode { public: DocParamList(DocNode *parent,DocParamSect::Type t) - : m_parent(parent) , m_type(t) + : m_parent(parent) , m_type(t), m_isFirst(TRUE), m_isLast(TRUE) { m_paragraph=new DocPara(this); } virtual ~DocParamList() { delete m_paragraph; } @@ -895,6 +922,10 @@ class DocParamList : public DocNode DocNode *parent() const { return m_parent; } const QStrList ¶meters() { return m_params; } DocParamSect::Type type() const { return m_type; } + void markFirst(bool b=TRUE) { m_isFirst=b; } + void markLast(bool b=TRUE) { m_isLast=b; } + bool isFirst() const { return m_isFirst; } + bool isLast() const { return m_isLast; } void accept(DocVisitor *v) { v->visitPre(this); @@ -907,18 +938,21 @@ class DocParamList : public DocNode DocPara * m_paragraph; QStrList m_params; DocParamSect::Type m_type; + bool m_isFirst; + bool m_isLast; }; /*! @brief Node representing an item of a auto list */ class DocAutoListItem : public DocNode { public: - DocAutoListItem(DocNode *parent) : m_parent(parent) + DocAutoListItem(DocNode *parent,int num) : m_parent(parent), m_itemNum(num) { m_paragraph=new DocPara(this); } virtual ~DocAutoListItem() { delete m_paragraph; } int parse(); Kind kind() const { return Kind_AutoListItem; } DocNode *parent() const { return m_parent; } + int itemNumber() const { return m_itemNum; } void accept(DocVisitor *v) { v->visitPre(this); @@ -928,6 +962,7 @@ class DocAutoListItem : public DocNode private: DocNode *m_parent; DocPara *m_paragraph; + int m_itemNum; }; /*! @brief Node representing a simple list item */ @@ -956,17 +991,19 @@ class DocSimpleListItem : public DocNode class DocHtmlListItem : public CompAccept<DocHtmlListItem>, public DocNode { public: - DocHtmlListItem(DocNode *parent,const HtmlAttribList &attribs) : - m_parent(parent), m_attribs(attribs) {} + DocHtmlListItem(DocNode *parent,const HtmlAttribList &attribs,int num) : + m_parent(parent), m_attribs(attribs), m_itemNum(num) {} int parse(); Kind kind() const { return Kind_HtmlListItem; } + int itemNumber() const { return m_itemNum; } const HtmlAttribList &attribs() const { return m_attribs; } DocNode *parent() const { return m_parent; } void accept(DocVisitor *v) { CompAccept<DocHtmlListItem>::accept(this,v); } private: - DocNode * m_parent; + DocNode * m_parent; HtmlAttribList m_attribs; + int m_itemNum; }; /*! @brief Node representing a Html description data */ @@ -1107,6 +1144,16 @@ class DocHtmlTable : public CompAccept<DocHtmlTable>, public DocNode HtmlAttribList m_attribs; }; +/*! @brief Root node of a text fragment */ +class DocText : public CompAccept<DocText>, public DocNode +{ + public: + DocText() {} + void parse(); + Kind kind() const { return Kind_Text; } + DocNode *parent() const { return 0; } + void accept(DocVisitor *v) { CompAccept<DocText>::accept(this,v); } +}; /*! @brief Root node of documentation tree */ class DocRoot : public CompAccept<DocRoot>, public DocNode diff --git a/src/doctokenizer.h b/src/doctokenizer.h index b4cea48..cb0a823 100644 --- a/src/doctokenizer.h +++ b/src/doctokenizer.h @@ -118,5 +118,6 @@ void doctokenizerYYsetStatePattern(); void doctokenizerYYsetStateLink(); void doctokenizerYYsetStateRef(); void doctokenizerYYsetStateInternalRef(); +void doctokenizerYYsetStateText(); #endif diff --git a/src/doctokenizer.l b/src/doctokenizer.l index f26f979..4ab99b0 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -264,6 +264,7 @@ HTMLTAG "<"(("/")?){ID}({WS}+{ATTRIB})*">" %x St_Ref %x St_Ref2 %x St_IntRef +%x St_Text %% <St_Para>\r /* skip carriage return */ @@ -349,17 +350,17 @@ HTMLTAG "<"(("/")?){ID}({WS}+{ATTRIB})*">" g_token->endTag = startNamePos==2; return TK_HTMLTAG; } -<St_Para>"&"{ID}";" { /* special symbol */ +<St_Para,St_Text>"&"{ID}";" { /* special symbol */ g_token->name = yytext; return TK_SYMBOL; } -<St_Para>{LNKWORD1} | +<St_Para>{LNKWORD1}/[^a-z_A-Z0-9] | <St_Para>{LNKWORD2} { g_token->name = yytext; return TK_LNKWORD; } -<St_Para>{WORD1} | -<St_Para>{WORD2} { /* function call */ +<St_Para,St_Text>{WORD1} | +<St_Para,St_Text>{WORD2} { /* function call */ g_token->name = yytext; return TK_WORD; @@ -369,11 +370,15 @@ HTMLTAG "<"(("/")?){ID}({WS}+{ATTRIB})*">" */ goto find_rule; } -<St_Para>{BLANK}+ | -<St_Para>{BLANK}*\n{BLANK}* { /* white space */ +<St_Para,St_Text>{BLANK}+ | +<St_Para,St_Text>{BLANK}*\n{BLANK}* { /* white space */ g_token->chars=yytext; return TK_WHITESPACE; } +<St_Text>[\\@<>&$#%~] { + g_token->name = yytext; + return TK_COMMAND; + } <St_Para>({BLANK}*\n)+{BLANK}*\n { /* start of a new paragraph */ return TK_NEWPARA; @@ -588,6 +593,11 @@ HTMLTAG "<"(("/")?){ID}({WS}+{ATTRIB})*">" <*>\n { warn(g_fileName,yylineno,"Error: Unexpected new line character"); } +<*>[\\@<>&$#%~] { /* unescaped special character */ + warn(g_fileName,yylineno,"Warning: Unexpected character `%s', assuming command \\%s was meant.",yytext,yytext); + g_token->name = yytext; + return TK_COMMAND; + } <*>. { warn(g_fileName,yylineno,"Error: Unexpected character `%s'",yytext); } @@ -672,6 +682,11 @@ void doctokenizerYYsetStateInternalRef() BEGIN(St_IntRef); } +void doctokenizerYYsetStateText() +{ + BEGIN(St_Text); +} + void doctokenizerYYcleanup() { yy_delete_buffer( YY_CURRENT_BUFFER ); diff --git a/src/docvisitor.h b/src/docvisitor.h index 3373f16..e9cc03a 100644 --- a/src/docvisitor.h +++ b/src/docvisitor.h @@ -68,6 +68,7 @@ class DocParamSect; class DocParamList; class DocInternalRef; class DocCopy; +class DocText; /*! @brief Abstract visitor that participates in the visitor pattern. */ @@ -164,6 +165,8 @@ class DocVisitor virtual void visitPost(DocInternalRef *) = 0; virtual void visitPre(DocCopy *) = 0; virtual void visitPost(DocCopy *) = 0; + virtual void visitPre(DocText *) = 0; + virtual void visitPost(DocText *) = 0; /*! @} */ }; diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 9164ed6..14ff70f 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -30,7 +30,6 @@ #include "version.h" #include "doxygen.h" #include "scanner.h" -#include "doc.h" #include "entry.h" #include "index.h" #include "logos.h" @@ -56,6 +55,7 @@ #include "rtfgen.h" #include "xmlgen.h" #include "defgen.h" +#include "perlmodgen.h" #include "reflist.h" #include "page.h" //#include "packagedef.h" @@ -1112,6 +1112,7 @@ static void findUsingDeclarations(Entry *root) "<generated>",1, root->name,ClassDef::Class); Doxygen::hiddenClasses.append(root->name,usingCd); + usingCd->setClassIsArtificial(); } // add the namespace the correct scope @@ -6020,7 +6021,7 @@ static void generatePageDocs() { scName=pi->context->name(); } - parseDoc(*outputList,pi->defFileName,pi->defLine,scName,0,pi->doc); + outputList->parseDoc(pi->defFileName,pi->defLine,scName,0,pi->doc,FALSE); outputList->endTextBlock(); endFile(*outputList); //outputList->enable(OutputGenerator::Man); @@ -6091,7 +6092,13 @@ static void generateExampleDocs() startTitle(*outputList,n); outputList->docify(pi->name); endTitle(*outputList,n,0); - parseExample(*outputList,pi->doc+"\n\\include "+pi->name,pi->name); + outputList->parseDoc(pi->name, // file + pi->defLine, // startLine + pi->context?pi->context->name().data():0, // context + 0, // memberDef + pi->doc+"\n\\include "+pi->name, // docs + TRUE // is example + ); endFile(*outputList); } outputList->enable(OutputGenerator::Man); @@ -7809,13 +7816,13 @@ void generateOutput() msg("Generating style sheet...\n"); outputList->writeStyleInfo(0); // write first part outputList->disableAllBut(OutputGenerator::Latex); - parseText(*outputList, + outputList->parseText( theTranslator->trGeneratedAt(dateToString(TRUE),Config_getString("PROJECT_NAME")) ); outputList->writeStyleInfo(1); // write second part //parseText(*outputList,theTranslator->trWrittenBy()); outputList->writeStyleInfo(2); // write third part - parseText(*outputList, + outputList->parseText( theTranslator->trGeneratedAt(dateToString(TRUE),Config_getString("PROJECT_NAME")) ); outputList->writeStyleInfo(3); // write fourth part @@ -7879,6 +7886,11 @@ void generateOutput() msg("Generating AutoGen DEF output...\n"); generateDEF(); } + if (Config_getBool("GENERATE_PERLMOD")) + { + msg("Generating PerlMod output...\n"); + generatePerlMod(); + } if (Config_getBool("GENERATE_HTMLHELP") && !Config_getString("HHC_LOCATION").isEmpty()) { msg("Running html help compiler...\n"); diff --git a/src/filedef.cpp b/src/filedef.cpp index a2e5e7c..02716ee 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -19,7 +19,6 @@ #include "memberlist.h" #include "classlist.h" #include "filedef.h" -#include "doc.h" #include "doxygen.h" #include "memberdef.h" #include "classdef.h" @@ -114,11 +113,11 @@ void FileDef::writeDetailedDocumentation(OutputList &ol) //if (latexOn) ol.enable(OutputGenerator::Latex); ol.popGeneratorState(); ol.startGroupHeader(); - parseText(ol,theTranslator->trDetailedDescription()); + ol.parseText(theTranslator->trDetailedDescription()); ol.endGroupHeader(); if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) { - parseDoc(ol,briefFile(),briefLine(),0,0,briefDescription()); + ol.parseDoc(briefFile(),briefLine(),0,0,briefDescription(),FALSE); } if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF") && !documentation().isEmpty()) @@ -129,7 +128,7 @@ void FileDef::writeDetailedDocumentation(OutputList &ol) { //if (doc.at(dl-1)!='.' && doc.at(dl-1)!='!' && doc.at(dl-1)!='?') // doc+='.'; - parseDoc(ol,docFile(),docLine(),0,0,documentation()+"\n"); + ol.parseDoc(docFile(),docLine(),0,0,documentation()+"\n",FALSE); } //printf("Writing source ref for file %s\n",name().data()); if (Config_getBool("SOURCE_BROWSER")) @@ -139,10 +138,10 @@ void FileDef::writeDetailedDocumentation(OutputList &ol) int fileMarkerPos = refText.find("@0"); if (fileMarkerPos!=-1) // should always pass this. { - parseText(ol,refText.left(fileMarkerPos)); //text left from marker 1 + ol.parseText(refText.left(fileMarkerPos)); //text left from marker 1 ol.writeObjectLink(0,getSourceFileBase(), 0,name()); - parseText(ol,refText.right( + ol.parseText(refText.right( refText.length()-fileMarkerPos-2)); // text right from marker 2 } } @@ -167,7 +166,7 @@ void FileDef::writeDocumentation(OutputList &ol) QCString pageTitle=name()+" File Reference"; startFile(ol,getOutputFileBase(),name(),pageTitle); startTitle(ol,getOutputFileBase()); - parseText(ol,theTranslator->trFileReference(docname)); + ol.parseText(theTranslator->trFileReference(docname)); addGroupListToTitle(ol,this); endTitle(ol,getOutputFileBase(),docName()); //ol.newParagraph(); @@ -190,11 +189,11 @@ void FileDef::writeDocumentation(OutputList &ol) } else if (briefDescription()) { - parseDoc(ol,briefFile(),briefLine(),0,0,briefDescription()); + ol.parseDoc(briefFile(),briefLine(),0,0,briefDescription(),FALSE); ol.writeString(" \n"); ol.disableAllBut(OutputGenerator::Html); ol.startTextLink(0,"_details"); - parseText(ol,theTranslator->trMore()); + ol.parseText(theTranslator->trMore()); ol.endTextLink(); ol.enableAll(); ol.disable(OutputGenerator::Man); @@ -288,7 +287,7 @@ void FileDef::writeDocumentation(OutputList &ol) ol.disable(OutputGenerator::Man); ol.newParagraph(); ol.startInclDepGraph(); - parseText(ol,theTranslator->trInclDepGraph(name())); + ol.parseText(theTranslator->trInclDepGraph(name())); ol.endInclDepGraph(incDepGraph); ol.enableAll(); } @@ -304,7 +303,7 @@ void FileDef::writeDocumentation(OutputList &ol) ol.disable(OutputGenerator::Man); ol.newParagraph(); ol.startInclDepGraph(); - parseText(ol,theTranslator->trInclByDepGraph()); + ol.parseText(theTranslator->trInclByDepGraph()); ol.endInclDepGraph(incDepGraph); ol.enableAll(); } @@ -317,7 +316,7 @@ void FileDef::writeDocumentation(OutputList &ol) ol.disableAllBut(OutputGenerator::Html); ol.newParagraph(); ol.startTextLink(includeName(),0); - parseText(ol,theTranslator->trGotoSourceCode()); + ol.parseText(theTranslator->trGotoSourceCode()); ol.endTextLink(); ol.enableAll(); } @@ -338,7 +337,7 @@ void FileDef::writeDocumentation(OutputList &ol) if (!found) { ol.startMemberHeader(); - parseText(ol,theTranslator->trNamespaces()); + ol.parseText(theTranslator->trNamespaces()); ol.endMemberHeader(); ol.startMemberList(); found=TRUE; @@ -418,9 +417,9 @@ void FileDef::writeDocumentation(OutputList &ol) // write Author section (Man only) ol.disableAllBut(OutputGenerator::Man); ol.startGroupHeader(); - parseText(ol,theTranslator->trAuthor(TRUE,TRUE)); + ol.parseText(theTranslator->trAuthor(TRUE,TRUE)); ol.endGroupHeader(); - parseText(ol,theTranslator->trGeneratedAutomatically(Config_getString("PROJECT_NAME"))); + ol.parseText(theTranslator->trGeneratedAutomatically(Config_getString("PROJECT_NAME"))); ol.enableAll(); if (!Config_getString("GENERATE_TAGFILE").isEmpty()) @@ -438,13 +437,13 @@ void FileDef::writeSource(OutputList &ol) ol.disableAllBut(OutputGenerator::Html); startFile(ol,getSourceFileBase(),0,docname+" Source File"); startTitle(ol,0); - parseText(ol,docname); + ol.parseText(docname); endTitle(ol,0,0); if (isLinkable()) { ol.startTextLink(getOutputFileBase(),0); - parseText(ol,theTranslator->trGotoDocumentation()); + ol.parseText(theTranslator->trGotoDocumentation()); ol.endTextLink(); } diff --git a/src/formula.cpp b/src/formula.cpp index a9541c8..3965bdf 100644 --- a/src/formula.cpp +++ b/src/formula.cpp @@ -171,7 +171,7 @@ void FormulaList::generateBitmaps(const char *path) // Then we run ghostscript to convert the postscript to a pixmap // The pixmap is a truecolor image, where only black and white are // used. -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__CYGWIN__) char gsArgs[256]; sprintf(gsArgs,"-q -g%dx%d -r%dx%dx -sDEVICE=ppmraw " "-sOutputFile=%s.pnm -dNOPAUSE -dBATCH -- %s.ps", diff --git a/src/groupdef.cpp b/src/groupdef.cpp index ff2e09c..804d948 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -22,7 +22,6 @@ #include "filedef.h" #include "classlist.h" #include "outputlist.h" -#include "doc.h" #include "namespacedef.h" #include "language.h" #include "util.h" @@ -359,13 +358,13 @@ void GroupDef::writeDetailedDocumentation(OutputList &ol) ol.writeAnchor(0,"_details"); ol.popGeneratorState(); ol.startGroupHeader(); - parseText(ol,theTranslator->trDetailedDescription()); + ol.parseText(theTranslator->trDetailedDescription()); ol.endGroupHeader(); // repeat brief description if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) { - parseDoc(ol,briefFile(),briefLine(),name(),0,briefDescription()); + ol.parseDoc(briefFile(),briefLine(),name(),0,briefDescription(),FALSE); ol.newParagraph(); } } @@ -373,7 +372,7 @@ void GroupDef::writeDetailedDocumentation(OutputList &ol) // write documentation if (!documentation().isEmpty()) { - parseDoc(ol,docFile(),docLine(),name(),0,documentation()+"\n"); + ol.parseDoc(docFile(),docLine(),name(),0,documentation()+"\n",FALSE); } } } @@ -396,13 +395,13 @@ void GroupDef::writeDocumentation(OutputList &ol) } else if (!briefDescription().isEmpty()) { - parseDoc(ol,briefFile(),briefLine(),name(),0,briefDescription()); + ol.parseDoc(briefFile(),briefLine(),name(),0,briefDescription(),FALSE); ol.writeString(" \n"); ol.pushGeneratorState(); ol.disable(OutputGenerator::Latex); ol.disable(OutputGenerator::RTF); ol.startTextLink(0,"_details"); - parseText(ol,theTranslator->trMore()); + ol.parseText(theTranslator->trMore()); ol.endTextLink(); //ol.enable(OutputGenerator::Latex); ol.popGeneratorState(); @@ -422,7 +421,7 @@ void GroupDef::writeDocumentation(OutputList &ol) if (fileList->count()>0) { ol.startMemberHeader(); - parseText(ol,theTranslator->trFile(TRUE,FALSE)); + ol.parseText(theTranslator->trFile(TRUE,FALSE)); ol.endMemberHeader(); ol.startMemberList(); FileDef *fd=fileList->first(); @@ -440,7 +439,7 @@ void GroupDef::writeDocumentation(OutputList &ol) if (!fd->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC")) { ol.startMemberDescription(); - parseDoc(ol,briefFile(),briefLine(),0,0,fd->briefDescription()); + ol.parseDoc(briefFile(),briefLine(),0,0,fd->briefDescription(),FALSE); ol.endMemberDescription(); ol.newParagraph(); } @@ -453,7 +452,7 @@ void GroupDef::writeDocumentation(OutputList &ol) if (namespaceList->count()>0) { ol.startMemberHeader(); - parseText(ol,theTranslator->trNamespaces()); + ol.parseText(theTranslator->trNamespaces()); ol.endMemberHeader(); ol.startMemberList(); NamespaceDef *nd=namespaceList->first(); @@ -471,7 +470,7 @@ void GroupDef::writeDocumentation(OutputList &ol) if (!nd->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC")) { ol.startMemberDescription(); - parseDoc(ol,briefFile(),briefLine(),0,0,nd->briefDescription()); + ol.parseDoc(briefFile(),briefLine(),0,0,nd->briefDescription(),FALSE); ol.endMemberDescription(); ol.newParagraph(); } @@ -484,7 +483,7 @@ void GroupDef::writeDocumentation(OutputList &ol) if (groupList->count()>0) { ol.startMemberHeader(); - parseText(ol,theTranslator->trModules()); + ol.parseText(theTranslator->trModules()); ol.endMemberHeader(); ol.startMemberList(); GroupDef *gd=groupList->first(); @@ -501,7 +500,7 @@ void GroupDef::writeDocumentation(OutputList &ol) if (!gd->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC")) { ol.startMemberDescription(); - parseDoc(ol,briefFile(),briefLine(),0,0,gd->briefDescription()); + ol.parseDoc(briefFile(),briefLine(),0,0,gd->briefDescription(),FALSE); ol.endMemberDescription(); ol.newParagraph(); } @@ -561,7 +560,7 @@ void GroupDef::writeDocumentation(OutputList &ol) ol.endSection(si->label,SectionInfo::Subsection); } ol.startTextBlock(); - parseDoc(ol,pi->defFileName,pi->defLine,0,0,pi->doc); + ol.parseDoc(pi->defFileName,pi->defLine,0,0,pi->doc,FALSE); ol.endTextBlock(); } } diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 0d31529..43cabdb 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -32,8 +32,6 @@ static QString htmlAttribsToString(const HtmlAttribList &attribs) HtmlAttrib *att; for (li.toFirst();(att=li.current());++li) { - printf("Found attion name=`%s' value=`%s'\n", - att->name.data(),att->value.data()); result+=" "; result+=att->name; if (!att->value.isEmpty()) result+="=\""+att->value+"\""; @@ -165,7 +163,7 @@ void HtmlDocVisitor::visit(DocVerbatim *s) { case DocVerbatim::Code: // fall though m_t << "<div class=\"fragment\"><pre>"; - parseCode(m_ci,s->context(),s->text().latin1(),FALSE,0); + parseCode(m_ci,s->context(),s->text().latin1(),s->isExample(),s->exampleFile()); m_t << "</pre></div>"; break; case DocVerbatim::Verbatim: @@ -195,7 +193,7 @@ void HtmlDocVisitor::visit(DocInclude *inc) { case DocInclude::Include: m_t << "<div class=\"fragment\"><pre>"; - parseCode(m_ci,inc->context(),inc->text().latin1(),FALSE,0); + parseCode(m_ci,inc->context(),inc->text().latin1(),inc->isExample(),inc->exampleFile()); m_t << "</pre></div>"; break; case DocInclude::DontInclude: @@ -222,7 +220,7 @@ void HtmlDocVisitor::visit(DocIncOperator *op) } if (op->type()!=DocIncOperator::Skip) { - parseCode(m_ci,op->context(),op->text().latin1(),FALSE,0); + parseCode(m_ci,op->context(),op->text().latin1(),op->isExample(),op->exampleFile()); } if (op->isLast()) { @@ -786,6 +784,14 @@ void HtmlDocVisitor::visitPost(DocCopy *) { } +void HtmlDocVisitor::visitPre(DocText *) +{ +} + +void HtmlDocVisitor::visitPost(DocText *) +{ +} + void HtmlDocVisitor::filter(const char *str) { if (str==0) return; diff --git a/src/htmldocvisitor.h b/src/htmldocvisitor.h index 9c944b9..0c49685 100644 --- a/src/htmldocvisitor.h +++ b/src/htmldocvisitor.h @@ -122,6 +122,8 @@ class HtmlDocVisitor : public DocVisitor void visitPost(DocInternalRef *); void visitPre(DocCopy *); void visitPost(DocCopy *); + void visitPre(DocText *); + void visitPost(DocText *); private: diff --git a/src/index.cpp b/src/index.cpp index 69a19ae..bc75138 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -24,7 +24,6 @@ #include "message.h" #include "index.h" #include "doxygen.h" -#include "doc.h" #include "code.h" #include "config.h" #include "filedef.h" @@ -187,7 +186,7 @@ void writeQuickLinks(OutputList &ol,bool compact ,bool ext=FALSE) { ol.startQuickIndexItem(extLink,"index"+Doxygen::htmlFileExtension); } - parseText(ol,theTranslator->trMainPage()); + ol.parseText(theTranslator->trMainPage()); ol.endQuickIndexItem(); //if (documentedPackages>0) @@ -201,7 +200,7 @@ void writeQuickLinks(OutputList &ol,bool compact ,bool ext=FALSE) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,"modules"+Doxygen::htmlFileExtension); - parseText(ol,theTranslator->trModules()); + ol.parseText(theTranslator->trModules()); ol.endQuickIndexItem(); } if (documentedNamespaces>0) @@ -210,11 +209,11 @@ void writeQuickLinks(OutputList &ol,bool compact ,bool ext=FALSE) ol.startQuickIndexItem(extLink,"namespaces"+Doxygen::htmlFileExtension); if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) { - parseText(ol,theTranslator->trPackages()); + ol.parseText(theTranslator->trPackages()); } else { - parseText(ol,theTranslator->trNamespaceList()); + ol.parseText(theTranslator->trNamespaceList()); } ol.endQuickIndexItem(); } @@ -222,7 +221,7 @@ void writeQuickLinks(OutputList &ol,bool compact ,bool ext=FALSE) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,"hierarchy"+Doxygen::htmlFileExtension); - parseText(ol,theTranslator->trClassHierarchy()); + ol.parseText(theTranslator->trClassHierarchy()); ol.endQuickIndexItem(); } if (annotatedClasses>0) @@ -231,19 +230,19 @@ void writeQuickLinks(OutputList &ol,bool compact ,bool ext=FALSE) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,"classes"+Doxygen::htmlFileExtension); - parseText(ol,theTranslator->trAlphabeticalList()); + ol.parseText(theTranslator->trAlphabeticalList()); ol.endQuickIndexItem(); } if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,"annotated"+Doxygen::htmlFileExtension); - parseText(ol,theTranslator->trCompoundList()); + ol.parseText(theTranslator->trCompoundList()); ol.endQuickIndexItem(); } if (documentedHtmlFiles>0) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,"files"+Doxygen::htmlFileExtension); - parseText(ol,theTranslator->trFileList()); + ol.parseText(theTranslator->trFileList()); ol.endQuickIndexItem(); } //if (documentedIncludeFiles>0 && Config_getBool("VERBATIM_HEADERS")) @@ -264,42 +263,42 @@ void writeQuickLinks(OutputList &ol,bool compact ,bool ext=FALSE) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,"namespacemembers"+Doxygen::htmlFileExtension); - parseText(ol,theTranslator->trNamespaceMembers()); + ol.parseText(theTranslator->trNamespaceMembers()); ol.endQuickIndexItem(); } if (documentedMembers>0) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,"functions"+Doxygen::htmlFileExtension); - parseText(ol,theTranslator->trCompoundMembers()); + ol.parseText(theTranslator->trCompoundMembers()); ol.endQuickIndexItem(); } if (documentedFunctions>0) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,"globals"+Doxygen::htmlFileExtension); - parseText(ol,theTranslator->trFileMembers()); + ol.parseText(theTranslator->trFileMembers()); ol.endQuickIndexItem(); } if (indexedPages>0) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,"pages"+Doxygen::htmlFileExtension); - parseText(ol,theTranslator->trRelatedPages()); + ol.parseText(theTranslator->trRelatedPages()); ol.endQuickIndexItem(); } if (Doxygen::exampleSDict->count()>0) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem(extLink,"examples"+Doxygen::htmlFileExtension); - parseText(ol,theTranslator->trExamples()); + ol.parseText(theTranslator->trExamples()); ol.endQuickIndexItem(); } if (Config_getBool("SEARCHENGINE")) { if (!compact) ol.writeListItem(); ol.startQuickIndexItem("_cgi",""); - parseText(ol,theTranslator->trSearch()); + ol.parseText(theTranslator->trSearch()); ol.endQuickIndexItem(); } if (compact) @@ -341,7 +340,7 @@ void endFile(OutputList &ol,bool external) ol.writeFooter(0,external); // write the footer if (Config_getString("HTML_FOOTER").isEmpty()) { - parseText(ol,theTranslator->trGeneratedAt( + ol.parseText(theTranslator->trGeneratedAt( dateToString(TRUE), Config_getString("PROJECT_NAME") )); @@ -714,7 +713,7 @@ void writeHierarchicalIndex(OutputList &ol) { title.prepend(Config_getString("PROJECT_NAME")+" "); } - parseText(ol,title); + ol.parseText(title); endTitle(ol,0,0); ol.startTextBlock(); HtmlHelp *htmlHelp = 0; @@ -737,13 +736,13 @@ void writeHierarchicalIndex(OutputList &ol) ol.disable(OutputGenerator::Latex); ol.disable(OutputGenerator::RTF); ol.startTextLink("inherits",0); - parseText(ol,theTranslator->trGotoGraphicalHierarchy()); + ol.parseText(theTranslator->trGotoGraphicalHierarchy()); ol.endTextLink(); ol.newParagraph(); ol.enable(OutputGenerator::Latex); ol.enable(OutputGenerator::RTF); } - parseText(ol,theTranslator->trClassHierarchyDescription()); + ol.parseText(theTranslator->trClassHierarchyDescription()); ol.endTextBlock(); writeClassHierarchy(ol); endFile(ol); @@ -762,7 +761,7 @@ void writeGraphicalClassHierarchy(OutputList &ol) QCString htmlHelpTitle = title; QCString ftvHelpTitle = title; if (!Config_getString("PROJECT_NAME").isEmpty()) title.prepend(Config_getString("PROJECT_NAME")+" "); - parseText(ol,title); + ol.parseText(title); endTitle(ol,0,0); ol.startTextBlock(); HtmlHelp *htmlHelp = 0; @@ -781,7 +780,7 @@ void writeGraphicalClassHierarchy(OutputList &ol) ftvHelp->addContentsItem(FALSE,0,"inherits",0,ftvHelpTitle); } ol.startTextLink("hierarchy",0); - parseText(ol,theTranslator->trGotoTextualHierarchy()); + ol.parseText(theTranslator->trGotoTextualHierarchy()); ol.endTextLink(); ol.newParagraph(); //parseText(ol,theTranslator->trClassHierarchyDescription()); @@ -841,7 +840,7 @@ void writeFileIndex(OutputList &ol) QCString htmlHelpTitle = title; QCString ftvHelpTitle = title; if (!Config_getString("PROJECT_NAME").isEmpty()) title.prepend(Config_getString("PROJECT_NAME")+" "); - parseText(ol,title); + ol.parseText(title); endTitle(ol,0,0); ol.startTextBlock(); HtmlHelp *htmlHelp = 0; @@ -862,7 +861,7 @@ void writeFileIndex(OutputList &ol) ftvHelp->incContentsDepth(); } //ol.newParagraph(); - parseText(ol,theTranslator->trFileListDescription(Config_getBool("EXTRACT_ALL"))); + ol.parseText(theTranslator->trFileListDescription(Config_getBool("EXTRACT_ALL"))); //ol.newParagraph(); ol.endTextBlock(); @@ -1000,7 +999,7 @@ void writeFileIndex(OutputList &ol) ol.docify(" "); ol.startTextLink(fd->includeName(),0); ol.docify("["); - parseText(ol,theTranslator->trCode()); + ol.parseText(theTranslator->trCode()); ol.docify("]"); ol.endTextLink(); ol.popGeneratorState(); @@ -1011,10 +1010,12 @@ void writeFileIndex(OutputList &ol) if (hasBrief) { //ol.docify(" ("); - parseDoc(ol, + ol.parseDoc( fd->briefFile(),fd->briefLine(), 0,0, - abbreviate(fd->briefDescription(),fd->name())); + abbreviate(fd->briefDescription(),fd->name()), + FALSE + ); //ol.docify(")"); } ol.endIndexValue(fd->getOutputFileBase(),hasBrief); @@ -1080,7 +1081,7 @@ void writeNamespaceIndex(OutputList &ol) QCString htmlHelpTitle = title; QCString ftvHelpTitle = title; if (!Config_getString("PROJECT_NAME").isEmpty()) title.prepend(Config_getString("PROJECT_NAME")+" "); - parseText(ol,title); + ol.parseText(title); endTitle(ol,0,0); ol.startTextBlock(); HtmlHelp *htmlHelp = 0; @@ -1103,11 +1104,11 @@ void writeNamespaceIndex(OutputList &ol) //ol.newParagraph(); if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) { - parseText(ol,theTranslator->trPackageListDescription()); + ol.parseText(theTranslator->trPackageListDescription()); } else { - parseText(ol,theTranslator->trNamespaceListDescription(Config_getBool("EXTRACT_ALL"))); + ol.parseText(theTranslator->trNamespaceListDescription(Config_getBool("EXTRACT_ALL"))); } //ol.newParagraph(); ol.endTextBlock(); @@ -1134,10 +1135,12 @@ void writeNamespaceIndex(OutputList &ol) if (hasBrief) { //ol.docify(" ("); - parseDoc(ol, + ol.parseDoc( nd->briefFile(),nd->briefLine(), nd->name(),0, - abbreviate(nd->briefDescription(),nd->displayName())); + abbreviate(nd->briefDescription(),nd->displayName()), + FALSE + ); //ol.docify(")"); } ol.endIndexValue(nd->getOutputFileBase(),hasBrief); @@ -1209,12 +1212,12 @@ void writeAnnotatedClassList(OutputList &ol) ol.startIndexValue(hasBrief); if (hasBrief) { - //ol.docify(" ("); - parseDoc(ol, + ol.parseDoc( cd->briefFile(),cd->briefLine(), cd->name(),0, - abbreviate(cd->briefDescription(),cd->name())); - //ol.docify(")"); + abbreviate(cd->briefDescription(),cd->name()), + FALSE + ); } ol.endIndexValue(cd->getOutputFileBase(),hasBrief); //ol.writeEndAnnoItem(cd->getOutputFileBase()); @@ -1432,7 +1435,7 @@ void writeAlphabeticalIndex(OutputList &ol) ol.disableAllBut(OutputGenerator::Html); startFile(ol,"classes"+Doxygen::htmlFileExtension,0,"Alphabetical index"); startTitle(ol,0); - parseText(ol,Config_getString("PROJECT_NAME")+" "+theTranslator->trCompoundIndex()); + ol.parseText(Config_getString("PROJECT_NAME")+" "+theTranslator->trCompoundIndex()); endTitle(ol,0,0); writeAlphabeticalClassList(ol); endFile(ol); @@ -1457,7 +1460,7 @@ void writeAnnotatedIndex(OutputList &ol) QCString htmlHelpTitle = title; QCString ftvHelpTitle = title; if (!Config_getString("PROJECT_NAME").isEmpty()) title.prepend(Config_getString("PROJECT_NAME")+" "); - parseText(ol,title); + ol.parseText(title); endTitle(ol,0,0); ol.startTextBlock(); HtmlHelp *htmlHelp = 0; @@ -1474,7 +1477,7 @@ void writeAnnotatedIndex(OutputList &ol) ftvHelp->addContentsItem(TRUE,0,"annotated",0,ftvHelpTitle); ftvHelp->incContentsDepth(); } - parseText(ol,theTranslator->trCompoundListDescription()); + ol.parseText(theTranslator->trCompoundListDescription()); ol.endTextBlock(); writeAnnotatedClassList(ol); if (hasHtmlHelp) @@ -1701,7 +1704,7 @@ void writeMemberIndex(OutputList &ol) QCString ftvHelpTitle = title; if (!Config_getString("PROJECT_NAME").isEmpty()) title.prepend(Config_getString("PROJECT_NAME")+" "); startTitle(ol,0); - parseText(ol,title); + ol.parseText(title); endTitle(ol,0,0); bool quickIndex = documentedMembers>maxItemsBeforeQuickIndex; if (quickIndex) @@ -1721,7 +1724,7 @@ void writeMemberIndex(OutputList &ol) FTVHelp *ftvHelp = FTVHelp::getInstance(); ftvHelp->addContentsItem(FALSE,0,"functions",0,ftvHelpTitle); } - parseText(ol,theTranslator->trCompoundMembersDescription(Config_getBool("EXTRACT_ALL"))); + ol.parseText(theTranslator->trCompoundMembersDescription(Config_getBool("EXTRACT_ALL"))); writeMemberList(ol,quickIndex); endFile(ol); ol.popGeneratorState(); @@ -1958,7 +1961,7 @@ void writeFileMemberIndex(OutputList &ol) QCString ftvHelpTitle = title; if (!Config_getString("PROJECT_NAME").isEmpty()) title.prepend(Config_getString("PROJECT_NAME")+" "); startTitle(ol,0); - parseText(ol,title); + ol.parseText(title); endTitle(ol,0,0); bool quickIndex = documentedMembers>maxItemsBeforeQuickIndex; if (quickIndex) @@ -1978,7 +1981,7 @@ void writeFileMemberIndex(OutputList &ol) FTVHelp *ftvHelp = FTVHelp::getInstance(); ftvHelp->addContentsItem(FALSE,0,"globals",0,ftvHelpTitle); } - parseText(ol,theTranslator->trFileMembersDescription(Config_getBool("EXTRACT_ALL"))); + ol.parseText(theTranslator->trFileMembersDescription(Config_getBool("EXTRACT_ALL"))); writeFileMemberList(ol,quickIndex); endFile(ol); ol.popGeneratorState(); @@ -1997,7 +2000,7 @@ void writeNamespaceMemberIndex(OutputList &ol) QCString ftvHelpTitle = title; if (!Config_getString("PROJECT_NAME").isEmpty()) title.prepend(Config_getString("PROJECT_NAME")+" "); startTitle(ol,0); - parseText(ol,title); + ol.parseText(title); endTitle(ol,0,0); bool quickIndex = documentedMembers>maxItemsBeforeQuickIndex; if (quickIndex) @@ -2017,7 +2020,7 @@ void writeNamespaceMemberIndex(OutputList &ol) FTVHelp *ftvHelp = FTVHelp::getInstance(); ftvHelp->addContentsItem(FALSE,0,"namespacemembers",0,ftvHelpTitle); } - parseText(ol,theTranslator->trNamespaceMemberDescription(Config_getBool("EXTRACT_ALL"))); + ol.parseText(theTranslator->trNamespaceMemberDescription(Config_getBool("EXTRACT_ALL"))); writeNamespaceMemberList(ol,quickIndex); endFile(ol); ol.popGeneratorState(); @@ -2036,7 +2039,7 @@ void writeExampleIndex(OutputList &ol) QCString htmlHelpTitle = title; QCString ftvHelpTitle = title; if (!Config_getString("PROJECT_NAME").isEmpty()) title.prepend(Config_getString("PROJECT_NAME")+" "); - parseText(ol,title); + ol.parseText(title); endTitle(ol,0,0); ol.startTextBlock(); HtmlHelp *htmlHelp = 0; @@ -2056,7 +2059,7 @@ void writeExampleIndex(OutputList &ol) ftvHelp->addContentsItem(TRUE,0,"examples",0,ftvHelpTitle); ftvHelp->incContentsDepth(); } - parseText(ol,theTranslator->trExamplesDescription()); + ol.parseText(theTranslator->trExamplesDescription()); //ol.newParagraph(); ol.endTextBlock(); ol.startItemList(); @@ -2140,7 +2143,7 @@ void writePageIndex(OutputList &ol) QCString htmlHelpTitle = title; QCString ftvHelpTitle = title; if (!Config_getString("PROJECT_NAME").isEmpty()) title.prepend(Config_getString("PROJECT_NAME")+" "); - parseText(ol,title); + ol.parseText(title); endTitle(ol,0,0); ol.startTextBlock(); HtmlHelp *htmlHelp = 0; @@ -2160,7 +2163,7 @@ void writePageIndex(OutputList &ol) ftvHelp->addContentsItem(TRUE,0,"pages",0,ftvHelpTitle); ftvHelp->incContentsDepth(); } - parseText(ol,theTranslator->trRelatedPagesDescription()); + ol.parseText(theTranslator->trRelatedPagesDescription()); ol.endTextBlock(); startIndexHierarchy(ol,0); PageSDict::Iterator pdi(*Doxygen::pageSDict); @@ -2235,12 +2238,12 @@ void writeGraphInfo(OutputList &ol) generateGraphLegend(Config_getString("HTML_OUTPUT")); startFile(ol,"graph_legend",0,"Graph Legend"); startTitle(ol,0); - parseText(ol,theTranslator->trLegendTitle()); + ol.parseText(theTranslator->trLegendTitle()); endTitle(ol,0,0); bool oldStripCommentsState = Config_getBool("STRIP_CODE_COMMENTS"); // temporarily disable the stripping of comments for our own code example! Config_getBool("STRIP_CODE_COMMENTS") = FALSE; - parseDoc(ol,"graph_legend",1,0,0,theTranslator->trLegendDocs()); + ol.parseDoc("graph_legend",1,0,0,theTranslator->trLegendDocs(),FALSE); Config_getBool("STRIP_CODE_COMMENTS") = oldStripCommentsState; endFile(ol); ol.popGeneratorState(); @@ -2631,7 +2634,7 @@ void writeGroupIndex(OutputList &ol) QCString htmlHelpTitle = title; QCString ftvHelpTitle = title; if (!Config_getString("PROJECT_NAME").isEmpty()) title.prepend(Config_getString("PROJECT_NAME")+" "); - parseText(ol,title); + ol.parseText(title); endTitle(ol,0,0); ol.startTextBlock(); HtmlHelp *htmlHelp = 0; @@ -2651,7 +2654,7 @@ void writeGroupIndex(OutputList &ol) ftvHelp->addContentsItem(TRUE,0,"modules",0,ftvHelpTitle); ftvHelp->incContentsDepth(); } - parseText(ol,theTranslator->trModulesDescription()); + ol.parseText(theTranslator->trModulesDescription()); ol.endTextBlock(); writeGroupHierarchy(ol); if (hasHtmlHelp) @@ -2719,25 +2722,25 @@ void writeIndex(OutputList &ol) ol.startTitleHead(0); if (Doxygen::mainPage && !Doxygen::mainPage->title.isEmpty()) { - parseDoc(ol,defFileName,defLine,0,0,Doxygen::mainPage->title); + ol.parseDoc(defFileName,defLine,0,0,Doxygen::mainPage->title,FALSE); } else { - parseText(ol,projPrefix+theTranslator->trDocumentation()); + ol.parseText(projPrefix+theTranslator->trDocumentation()); } ol.endTitleHead(0,0); ol.newParagraph(); if (!Config_getString("PROJECT_NUMBER").isEmpty()) { ol.startProjectNumber(); - parseDoc(ol,defFileName,defLine,0,0,Config_getString("PROJECT_NUMBER")); + ol.parseDoc(defFileName,defLine,0,0,Config_getString("PROJECT_NUMBER"),FALSE); ol.endProjectNumber(); } if (Config_getBool("DISABLE_INDEX") && Doxygen::mainPage==0) writeQuickLinks(ol,FALSE); if (Doxygen::mainPage) { - parseDoc(ol,defFileName,defLine,0,0,Doxygen::mainPage->doc); + ol.parseDoc(defFileName,defLine,0,0,Doxygen::mainPage->doc,FALSE); if (!Config_getString("GENERATE_TAGFILE").isEmpty()) { @@ -2776,16 +2779,16 @@ void writeIndex(OutputList &ol) ol.disable(OutputGenerator::Latex); } - parseText(ol,projPrefix+theTranslator->trReferenceManual()); + ol.parseText(projPrefix+theTranslator->trReferenceManual()); if (!Config_getString("PROJECT_NUMBER").isEmpty()) { ol.startProjectNumber(); - parseDoc(ol,defFileName,defLine,0,0,Config_getString("PROJECT_NUMBER")); + ol.parseDoc(defFileName,defLine,0,0,Config_getString("PROJECT_NUMBER"),FALSE); ol.endProjectNumber(); } ol.endIndexSection(isTitlePageStart); ol.startIndexSection(isTitlePageAuthor); - parseText(ol,theTranslator->trGeneratedBy()); + ol.parseText(theTranslator->trGeneratedBy()); ol.endIndexSection(isTitlePageAuthor); ol.enable(OutputGenerator::Latex); @@ -2794,11 +2797,11 @@ void writeIndex(OutputList &ol) ol.startIndexSection(isMainPage); if (!Doxygen::mainPage->title.isEmpty()) { - parseDoc(ol,defFileName,defLine,0,0,Doxygen::mainPage->title); + ol.parseDoc(defFileName,defLine,0,0,Doxygen::mainPage->title,FALSE); } else { - parseText(ol,projPrefix+theTranslator->trMainPage()); + ol.parseText(projPrefix+theTranslator->trMainPage()); } ol.endIndexSection(isMainPage); } @@ -2813,37 +2816,37 @@ void writeIndex(OutputList &ol) if (documentedGroups>0) { ol.startIndexSection(isModuleIndex); - parseText(ol,projPrefix+theTranslator->trModuleIndex()); + ol.parseText(projPrefix+theTranslator->trModuleIndex()); ol.endIndexSection(isModuleIndex); } if (documentedNamespaces>0) { ol.startIndexSection(isNamespaceIndex); - parseText(ol,projPrefix+theTranslator->trNamespaceIndex()); + ol.parseText(projPrefix+theTranslator->trNamespaceIndex()); ol.endIndexSection(isNamespaceIndex); } if (hierarchyClasses>0) { ol.startIndexSection(isClassHierarchyIndex); - parseText(ol,projPrefix+theTranslator->trHierarchicalIndex()); + ol.parseText(projPrefix+theTranslator->trHierarchicalIndex()); ol.endIndexSection(isClassHierarchyIndex); } if (annotatedClasses>0) { ol.startIndexSection(isCompoundIndex); - parseText(ol,projPrefix+theTranslator->trCompoundIndex()); + ol.parseText(projPrefix+theTranslator->trCompoundIndex()); ol.endIndexSection(isCompoundIndex); } if (documentedFiles>0) { ol.startIndexSection(isFileIndex); - parseText(ol,projPrefix+theTranslator->trFileIndex()); + ol.parseText(projPrefix+theTranslator->trFileIndex()); ol.endIndexSection(isFileIndex); } if (indexedPages>0) { ol.startIndexSection(isPageIndex); - parseText(ol,projPrefix+theTranslator->trPageIndex()); + ol.parseText(projPrefix+theTranslator->trPageIndex()); ol.endIndexSection(isPageIndex); } ol.lastIndexPage(); @@ -2856,37 +2859,37 @@ void writeIndex(OutputList &ol) if (documentedGroups>0) { ol.startIndexSection(isModuleDocumentation); - parseText(ol,projPrefix+theTranslator->trModuleDocumentation()); + ol.parseText(projPrefix+theTranslator->trModuleDocumentation()); ol.endIndexSection(isModuleDocumentation); } if (documentedNamespaces>0) { ol.startIndexSection(isNamespaceDocumentation); - parseText(ol,projPrefix+theTranslator->trNamespaceDocumentation()); + ol.parseText(projPrefix+theTranslator->trNamespaceDocumentation()); ol.endIndexSection(isNamespaceDocumentation); } if (annotatedClasses>0) { ol.startIndexSection(isClassDocumentation); - parseText(ol,projPrefix+theTranslator->trClassDocumentation()); + ol.parseText(projPrefix+theTranslator->trClassDocumentation()); ol.endIndexSection(isClassDocumentation); } if (documentedFiles>0) { ol.startIndexSection(isFileDocumentation); - parseText(ol,projPrefix+theTranslator->trFileDocumentation()); + ol.parseText(projPrefix+theTranslator->trFileDocumentation()); ol.endIndexSection(isFileDocumentation); } if (Doxygen::exampleSDict->count()>0) { ol.startIndexSection(isExampleDocumentation); - parseText(ol,projPrefix+theTranslator->trExampleDocumentation()); + ol.parseText(projPrefix+theTranslator->trExampleDocumentation()); ol.endIndexSection(isExampleDocumentation); } if (documentedPages>0) { ol.startIndexSection(isPageDocumentation); - parseText(ol,projPrefix+theTranslator->trPageDocumentation()); + ol.parseText(projPrefix+theTranslator->trPageDocumentation()); ol.endIndexSection(isPageDocumentation); } ol.endIndexSection(isEndIndex); @@ -2905,7 +2908,7 @@ void writeIndex(OutputList &ol) // ol.endSection(si->label,FALSE); //} ol.startTextBlock(); - parseDoc(ol,defFileName,defLine,0,0,Doxygen::mainPage->doc); + ol.parseDoc(defFileName,defLine,0,0,Doxygen::mainPage->doc,FALSE); ol.endTextBlock(); endFile(ol); ol.enable(OutputGenerator::Man); diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index fd66059..57f21ef 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -211,7 +211,7 @@ void LatexDocVisitor::visit(DocVerbatim *s) { case DocVerbatim::Code: // fall though m_t << "\n\n\\footnotesize\\begin{verbatim}"; - parseCode(m_ci,s->context(),s->text().latin1(),FALSE,0); + parseCode(m_ci,s->context(),s->text().latin1(),s->isExample(),s->exampleFile()); m_t << "\\end{verbatim}\\normalsize" << endl; break; case DocVerbatim::Verbatim: @@ -246,7 +246,7 @@ void LatexDocVisitor::visit(DocInclude *inc) { case DocInclude::Include: m_t << "\n\n\\footnotesize\\begin{verbatim}"; - parseCode(m_ci,inc->context(),inc->text().latin1(),FALSE,0); + parseCode(m_ci,inc->context(),inc->text().latin1(),inc->isExample(),inc->exampleFile()); m_t << "\\end{verbatim}\\normalsize" << endl; break; case DocInclude::DontInclude: @@ -272,7 +272,7 @@ void LatexDocVisitor::visit(DocIncOperator *op) } if (op->type()!=DocIncOperator::Skip) { - parseCode(m_ci,op->context(),op->text().latin1(),FALSE,0); + parseCode(m_ci,op->context(),op->text().latin1(),op->isExample(),op->exampleFile()); } if (op->isLast()) { @@ -878,6 +878,14 @@ void LatexDocVisitor::visitPost(DocCopy *) { } +void LatexDocVisitor::visitPre(DocText *) +{ +} + +void LatexDocVisitor::visitPost(DocText *) +{ +} + void LatexDocVisitor::filter(const char *str) { filterLatexString(m_t,str,FALSE,m_insidePre); diff --git a/src/latexdocvisitor.h b/src/latexdocvisitor.h index 70a6b27..3ca3bfc 100644 --- a/src/latexdocvisitor.h +++ b/src/latexdocvisitor.h @@ -122,6 +122,8 @@ class LatexDocVisitor : public DocVisitor void visitPost(DocInternalRef *); void visitPre(DocCopy *); void visitPost(DocCopy *); + void visitPre(DocText *); + void visitPost(DocText *); private: diff --git a/src/libdoxygen.pro.in b/src/libdoxygen.pro.in index aac6366..b323aa7 100644 --- a/src/libdoxygen.pro.in +++ b/src/libdoxygen.pro.in @@ -32,7 +32,6 @@ HEADERS = bufstr.h \ define.h \ definition.h \ diagram.h \ - doc.h \ docparser.h \ doctokenizer.h \ docvisitor.h \ @@ -66,8 +65,8 @@ HEADERS = bufstr.h \ namespacedef.h \ outputgen.h \ outputlist.h \ - packagedef.h \ page.h \ + perlmodgen.h \ pngenc.h \ pre.h \ printdocvisitor.h \ @@ -133,7 +132,6 @@ SOURCES = ce_lex.cpp \ define.cpp \ definition.cpp \ diagram.cpp \ - doc.cpp \ docparser.cpp \ doctokenizer.cpp \ dot.cpp \ @@ -164,7 +162,7 @@ SOURCES = ce_lex.cpp \ namespacedef.cpp \ outputgen.cpp \ outputlist.cpp \ - packagedef.cpp \ + perlmodgen.cpp \ pngenc.cpp \ pre.cpp \ reflist.cpp \ diff --git a/src/mandocvisitor.cpp b/src/mandocvisitor.cpp index e29765e..edc7ede 100644 --- a/src/mandocvisitor.cpp +++ b/src/mandocvisitor.cpp @@ -27,7 +27,8 @@ #include "message.h" ManDocVisitor::ManDocVisitor(QTextStream &t,BaseCodeDocInterface &ci) - : m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE) + : m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE), m_firstCol(TRUE), + m_indent(0) { } @@ -39,6 +40,7 @@ void ManDocVisitor::visit(DocWord *w) { if (m_hide) return; filter(w->word()); + m_firstCol=FALSE; } void ManDocVisitor::visit(DocLinkedWord *w) @@ -47,6 +49,7 @@ void ManDocVisitor::visit(DocLinkedWord *w) m_t << "\\fB"; filter(w->word()); m_t << "\\fP"; + m_firstCol=FALSE; } void ManDocVisitor::visit(DocWhiteSpace *w) @@ -55,10 +58,12 @@ void ManDocVisitor::visit(DocWhiteSpace *w) if (m_insidePre) { m_t << w->chars(); + m_firstCol=w->chars().at(w->chars().length()-1)=='\n'; } else { m_t << " "; + m_firstCol=FALSE; } } @@ -67,71 +72,52 @@ void ManDocVisitor::visit(DocSymbol *s) if (m_hide) return; switch(s->symbol()) { - case DocSymbol::BSlash: m_t << "$\\backslash$"; break; + case DocSymbol::BSlash: m_t << "\\\\"; break; case DocSymbol::At: m_t << "@"; break; - case DocSymbol::Less: m_t << "$<$"; break; - case DocSymbol::Greater: m_t << "$>$"; break; - case DocSymbol::Amp: m_t << "\\&"; break; - case DocSymbol::Dollar: m_t << "\\$"; break; - case DocSymbol::Hash: m_t << "\\#"; break; - case DocSymbol::Percent: m_t << "\\%"; break; - case DocSymbol::Copy: m_t << "\\copyright"; break; + case DocSymbol::Less: m_t << "<"; break; + case DocSymbol::Greater: m_t << ">"; break; + case DocSymbol::Amp: m_t << "&"; break; + case DocSymbol::Dollar: m_t << "$"; break; + case DocSymbol::Hash: m_t << "#"; break; + case DocSymbol::Percent: m_t << "%"; break; + case DocSymbol::Copy: m_t << "(c)"; break; case DocSymbol::Apos: m_t << "'"; break; case DocSymbol::Quot: m_t << "''"; break; - case DocSymbol::Uml: - if (s->letter()=='i') - m_t << "\\\"{\\i}"; - else - m_t << "\\\"{" << s->letter() << "}"; - break; - case DocSymbol::Acute: - if (s->letter()=='i') - m_t << "\\'{\\i}"; - else - m_t << "\\'{" << s->letter() << "}"; - break; - case DocSymbol::Grave: - if (s->letter()=='i') - m_t << "\\`{\\i}"; - else - m_t << "\\`{" << s->letter() << "}"; - break; - case DocSymbol::Circ: - if (s->letter()=='i') - m_t << "\\^{\\i}"; - else - m_t << "\\^{" << s->letter() << "}"; - break; - case DocSymbol::Tilde: m_t << "\\~{" << s->letter() << "}"; break; - case DocSymbol::Szlig: m_t << "\"s"; break; - case DocSymbol::Cedil: m_t << "\\c{" << s->letter() << "}"; break; - case DocSymbol::Ring: m_t << "\\" << s->letter() << s->letter(); break; - case DocSymbol::Nbsp: m_t << "\\ "; break; + case DocSymbol::Uml: m_t << s->letter() << "\\*(4"; break; + case DocSymbol::Acute: m_t << s->letter() << "\\*(`"; break; + case DocSymbol::Grave: m_t << s->letter() << "\\*:"; break; + case DocSymbol::Circ: m_t << s->letter() << "\\*^"; break; + case DocSymbol::Tilde: m_t << s->letter() << "\\*~"; break; + case DocSymbol::Szlig: m_t << "s\\*:"; break; + case DocSymbol::Cedil: m_t << s->letter() << "\\*,"; break; + case DocSymbol::Ring: m_t << s->letter() << "\\*o"; break; + case DocSymbol::Nbsp: m_t << " "; break; default: err("Error: unknown symbol found\n"); } + m_firstCol=FALSE; } void ManDocVisitor::visit(DocURL *u) { if (m_hide) return; - if (Config_getBool("PDF_HYPERLINKS")) - { - m_t << "\\href{" << u->url() << "}"; - } - m_t << "{\\tt " << u->url() << "}"; + m_t << u->url(); + m_firstCol=FALSE; } void ManDocVisitor::visit(DocLineBreak *) { if (m_hide) return; - m_t << "\\par\n"; + m_t << endl << ".br" << endl; + m_firstCol=TRUE; } void ManDocVisitor::visit(DocHorRuler *) { if (m_hide) return; - m_t << "\n\n"; + if (!m_firstCol) m_t << endl; + m_t << ".PP" << endl; + m_firstCol=TRUE; } void ManDocVisitor::visit(DocStyleChange *s) @@ -140,25 +126,30 @@ void ManDocVisitor::visit(DocStyleChange *s) switch (s->style()) { case DocStyleChange::Bold: - if (s->enable()) m_t << "{\\bf "; else m_t << "} "; + if (s->enable()) m_t << "\\fB"; else m_t << "\\fP"; + m_firstCol=FALSE; break; case DocStyleChange::Italic: - if (s->enable()) m_t << "{\\em "; else m_t << "} "; + if (s->enable()) m_t << "\\fI"; else m_t << "\\fP"; + m_firstCol=FALSE; break; case DocStyleChange::Code: - if (s->enable()) m_t << "{\\tt "; else m_t << "} "; + if (s->enable()) m_t << "\\fC"; else m_t << "\\fP"; + m_firstCol=FALSE; break; case DocStyleChange::Subscript: - if (s->enable()) m_t << "$_{\\mbox{"; else m_t << "}}$ "; + if (s->enable()) m_t << "\\*<"; else m_t << "\\*> "; + m_firstCol=FALSE; break; case DocStyleChange::Superscript: - if (s->enable()) m_t << "$^{\\mbox{"; else m_t << "}}$ "; + if (s->enable()) m_t << "\\*{"; else m_t << "\\*} "; + m_firstCol=FALSE; break; case DocStyleChange::Center: - if (s->enable()) m_t << "\\begin{center}"; else m_t << "\\end{center} "; + /* not supported */ break; case DocStyleChange::Small: - if (s->enable()) m_t << "\\footnotesize "; else m_t << "\\normalsize "; + /* not supported */ break; } } @@ -169,14 +160,22 @@ void ManDocVisitor::visit(DocVerbatim *s) switch(s->type()) { case DocVerbatim::Code: // fall though - m_t << "\n\n\\footnotesize\\begin{verbatim}"; - parseCode(m_ci,s->context(),s->text().latin1(),FALSE,0); - m_t << "\\end{verbatim}\\normalsize" << endl; + if (!m_firstCol) m_t << endl; + m_t << ".PP" << endl; + m_t << ".nf" << endl; + parseCode(m_ci,s->context(),s->text().latin1(),s->isExample(),s->exampleFile()); + if (!m_firstCol) m_t << endl; + m_t << ".PP" << endl; + m_firstCol=TRUE; break; case DocVerbatim::Verbatim: - m_t << "\n\n\\footnotesize\\begin{verbatim}"; + if (!m_firstCol) m_t << endl; + m_t << ".PP" << endl; + m_t << ".nf" << endl; m_t << s->text(); - m_t << "\\end{verbatim}\\normalsize" << endl; + if (!m_firstCol) m_t << endl; + m_t << ".PP" << endl; + m_firstCol=TRUE; break; case DocVerbatim::HtmlOnly: /* nothing */ @@ -187,15 +186,9 @@ void ManDocVisitor::visit(DocVerbatim *s) } } -void ManDocVisitor::visit(DocAnchor *anc) +void ManDocVisitor::visit(DocAnchor *) { - if (m_hide) return; - m_t << "\\label{" << anc->anchor() << "}" << endl; - if (!anc->file().isEmpty() && Config_getBool("PDF_HYPERLINKS")) - { - m_t << "\\hypertarget{" << anc->file() << "_" << anc->anchor() - << "}{}" << endl; - } + /* no support for anchors in man pages */ } void ManDocVisitor::visit(DocInclude *inc) @@ -204,18 +197,26 @@ void ManDocVisitor::visit(DocInclude *inc) switch(inc->type()) { case DocInclude::Include: - m_t << "\n\n\\footnotesize\\begin{verbatim}"; - parseCode(m_ci,inc->context(),inc->text().latin1(),FALSE,0); - m_t << "\\end{verbatim}\\normalsize" << endl; + if (!m_firstCol) m_t << endl; + m_t << ".PP" << endl; + m_t << ".nf" << endl; + parseCode(m_ci,inc->context(),inc->text().latin1(),inc->isExample(),inc->exampleFile()); + if (!m_firstCol) m_t << endl; + m_t << ".PP" << endl; + m_firstCol=TRUE; break; case DocInclude::DontInclude: break; case DocInclude::HtmlInclude: break; case DocInclude::VerbInclude: - m_t << "\n\n\\footnotesize\\begin{verbatim}"; + if (!m_firstCol) m_t << endl; + m_t << ".PP" << endl; + m_t << ".nf" << endl; m_t << inc->text(); - m_t << "\\end{verbatim}\\normalsize" << endl; + if (!m_firstCol) m_t << endl; + m_t << ".PP" << endl; + m_firstCol=TRUE; break; } } @@ -226,17 +227,21 @@ void ManDocVisitor::visit(DocIncOperator *op) // op->type(),op->isFirst(),op->isLast(),op->text().data()); if (op->isFirst()) { - m_t << "\n\n\\footnotesize\\begin{verbatim}"; + if (!m_firstCol) m_t << endl; + m_t << ".PP" << endl; + m_t << ".nf" << endl; m_hide = TRUE; } if (op->type()!=DocIncOperator::Skip) { - parseCode(m_ci,op->context(),op->text().latin1(),FALSE,0); + parseCode(m_ci,op->context(),op->text().latin1(),op->isExample(),op->exampleFile()); } if (op->isLast()) { m_hide = FALSE; - m_t << "\\end{verbatim}\\normalsize" << endl; + if (!m_firstCol) m_t << endl; + m_t << ".PP" << endl; + m_firstCol=TRUE; } else { @@ -250,47 +255,47 @@ void ManDocVisitor::visit(DocFormula *f) m_t << f->text(); } -void ManDocVisitor::visit(DocIndexEntry *i) +void ManDocVisitor::visit(DocIndexEntry *) { - m_t << "\\index{" << i->entry() << "@{"; - m_t << "}}"; } //-------------------------------------- // visitor functions for compound nodes //-------------------------------------- -void ManDocVisitor::visitPre(DocAutoList *l) +void ManDocVisitor::visitPre(DocAutoList *) { - if (l->isEnumList()) - { - m_t << "\\begin{enumerate}" << endl; - } - else - { - m_t << "\\begin{itemize}" << endl; - } + m_indent+=2; +} + +void ManDocVisitor::visitPost(DocAutoList *) +{ + m_indent-=2; + m_t << ".PP" << endl; } -void ManDocVisitor::visitPost(DocAutoList *l) +void ManDocVisitor::visitPre(DocAutoListItem *li) { - if (l->isEnumList()) + QCString ws; + ws.fill(' ',m_indent-2); + if (!m_firstCol) m_t << endl; + m_t << ".IP \"" << ws; + if (((DocAutoList *)li->parent())->isEnumList()) { - m_t << "\\end{enumerate}" << endl; + m_t << li->itemNumber() << ".\" " << m_indent+2; } - else + else // bullet list { - m_t << "\\end{itemize}" << endl; + m_t << "\\(bu\" " << m_indent; } -} - -void ManDocVisitor::visitPre(DocAutoListItem *) -{ - m_t << "\\item "; + m_t << endl; + m_firstCol=TRUE; } void ManDocVisitor::visitPost(DocAutoListItem *) { + m_t << endl; + m_firstCol=TRUE; } void ManDocVisitor::visitPre(DocPara *) @@ -303,7 +308,12 @@ void ManDocVisitor::visitPost(DocPara *p) !(p->parent() && // and for parameter sections p->parent()->kind()==DocNode::Kind_ParamSect ) - ) m_t << endl << endl; + ) + { + if (!m_firstCol) m_t << endl; + m_t << ".PP" << endl; + m_firstCol=TRUE; + } } void ManDocVisitor::visitPre(DocRoot *) @@ -316,7 +326,12 @@ void ManDocVisitor::visitPost(DocRoot *) void ManDocVisitor::visitPre(DocSimpleSect *s) { - m_t << "\\begin{Desc}\n\\item["; + if (!m_firstCol) + { + m_t << endl; + m_t << ".PP" << endl; + } + m_t << "\\fB"; switch(s->type()) { case DocSimpleSect::See: @@ -354,13 +369,17 @@ void ManDocVisitor::visitPre(DocSimpleSect *s) // special case 1: user defined title if (s->type()!=DocSimpleSect::User) { - m_t << ":]"; + m_t << ":\\fP" << endl; + m_t << ".RS 4" << endl; } } void ManDocVisitor::visitPost(DocSimpleSect *) { - m_t << "\\end{Desc}" << endl; + if (!m_firstCol) m_t << endl; + m_t << ".RE" << endl; + m_t << ".PP" << endl; + m_firstCol=TRUE; } void ManDocVisitor::visitPre(DocTitle *) @@ -369,117 +388,124 @@ void ManDocVisitor::visitPre(DocTitle *) void ManDocVisitor::visitPost(DocTitle *) { - m_t << "]"; + m_t << "\\fP"; + m_t << ".RS 4" << endl; } void ManDocVisitor::visitPre(DocSimpleList *) { - m_t << "\\begin{itemize}" << endl; + m_indent+=2; } void ManDocVisitor::visitPost(DocSimpleList *) { - m_t << "\\end{itemize}" << endl; + m_indent-=2; + m_t << ".PP" << endl; } void ManDocVisitor::visitPre(DocSimpleListItem *) { - m_t << "\\item "; + QCString ws; + ws.fill(' ',m_indent-2); + if (!m_firstCol) m_t << endl; + m_t << ".IP \"" << ws << "\\(bu\" " << m_indent << endl; + m_firstCol=TRUE; } void ManDocVisitor::visitPost(DocSimpleListItem *) { + m_t << endl; + m_firstCol=TRUE; } void ManDocVisitor::visitPre(DocSection *s) { - if (Config_getBool("PDF_HYPERLINKS")) - { - m_t << "\\hypertarget{" << s->file() << "_" << s->anchor() << "}{}"; - } - if (Config_getBool("COMPACT_LATEX")) - { - switch(s->level()) - { - case 1: m_t << "\\subsubsection{"; break; - case 2: m_t << "\\paragraph{"; break; - case 3: m_t << "\\subparagraph{"; break; - case 4: m_t << "\\subparagraph{"; break; - } - } - else - { - switch(s->level()) - { - case 1: m_t << "\\subsection{"; break; - case 2: m_t << "\\subsubsection{"; break; - case 3: m_t << "\\paragraph{"; break; - case 4: m_t << "\\subparagraph{"; break; - } - } + if (!m_firstCol) m_t << endl; + if (s->level()==1) m_t << ".SH"; else m_t << ".SS"; + m_t << " \""; filter(s->title()); - m_t << "}\\label{" << s->anchor() << "}" << endl; + m_t << "\"" << endl; + if (s->level()==1) m_t << ".PP" << endl; + m_firstCol=TRUE; } void ManDocVisitor::visitPost(DocSection *) { } -void ManDocVisitor::visitPre(DocHtmlList *s) +void ManDocVisitor::visitPre(DocHtmlList *) { - if (s->type()==DocHtmlList::Ordered) - m_t << "\\begin{enumerate}" << endl; - else - m_t << "\\begin{itemize}" << endl; + m_indent+=2; } -void ManDocVisitor::visitPost(DocHtmlList *s) +void ManDocVisitor::visitPost(DocHtmlList *) { - if (s->type()==DocHtmlList::Ordered) - m_t << "\\end{enumerate}" << endl; - else - m_t << "\\end{itemize}" << endl; + m_indent-=2; + m_t << ".PP" << endl; } -void ManDocVisitor::visitPre(DocHtmlListItem *) +void ManDocVisitor::visitPre(DocHtmlListItem *li) { - m_t << "\\item "; + QCString ws; + ws.fill(' ',m_indent-2); + if (!m_firstCol) m_t << endl; + m_t << ".IP \"" << ws; + if (((DocHtmlList *)li->parent())->type()==DocHtmlList::Ordered) + { + m_t << li->itemNumber() << ".\" " << m_indent+2; + } + else // bullet list + { + m_t << "\\(bu\" " << m_indent; + } + m_t << endl; + m_firstCol=TRUE; } void ManDocVisitor::visitPost(DocHtmlListItem *) { + m_t << endl; + m_firstCol=TRUE; } void ManDocVisitor::visitPre(DocHtmlPre *) { - m_t << "\\small\\begin{alltt}"; + if (!m_firstCol) m_t << endl; + m_t << ".PP" << endl; + m_t << ".nf" << endl; m_insidePre=TRUE; } void ManDocVisitor::visitPost(DocHtmlPre *) { m_insidePre=FALSE; - m_t << "\\end{alltt}\\normalsize " << endl; + if (!m_firstCol) m_t << endl; + m_t << ".PP" << endl; + m_firstCol=TRUE; } void ManDocVisitor::visitPre(DocHtmlDescList *) { - m_t << "\\begin{description}" << endl; } void ManDocVisitor::visitPost(DocHtmlDescList *) { - m_t << "\\end{description}" << endl; + if (!m_firstCol) m_t << endl; + m_t << ".PP" << endl; + m_firstCol=TRUE; } void ManDocVisitor::visitPre(DocHtmlDescTitle *) { - m_t << "\\item["; + if (!m_firstCol) m_t << endl; + m_t << ".IP \"\\fB"; + m_firstCol=FALSE; } void ManDocVisitor::visitPost(DocHtmlDescTitle *) { - m_t << "]"; + m_t << "\\fP\" 1c" << endl; + m_firstCol=TRUE; } void ManDocVisitor::visitPre(DocHtmlDescData *) @@ -490,35 +516,20 @@ void ManDocVisitor::visitPost(DocHtmlDescData *) { } -void ManDocVisitor::visitPre(DocHtmlTable *t) +void ManDocVisitor::visitPre(DocHtmlTable *) { - if (t->hasCaption()) - { - m_t << "\\begin{table}[h]"; - } - m_t << "\\begin{TabularC}{" << t->numCols() << "}\n\\hline\n"; } -void ManDocVisitor::visitPost(DocHtmlTable *t) +void ManDocVisitor::visitPost(DocHtmlTable *) { - if (t->hasCaption()) - { - m_t << "\\end{table}\n"; - } - else - { - m_t << "\\\\\\hline\n\\end{TabularC}\n"; - } } void ManDocVisitor::visitPre(DocHtmlCaption *) { - m_t << "\\\\\\hline\n\\end{TabularC}\n\\centering\n\\caption{"; } void ManDocVisitor::visitPost(DocHtmlCaption *) { - m_t << "}\n"; } void ManDocVisitor::visitPre(DocHtmlRow *) @@ -527,221 +538,117 @@ void ManDocVisitor::visitPre(DocHtmlRow *) void ManDocVisitor::visitPost(DocHtmlRow *) { - m_t << "\\\\\\hline\n"; } void ManDocVisitor::visitPre(DocHtmlCell *) { } -void ManDocVisitor::visitPost(DocHtmlCell *c) +void ManDocVisitor::visitPost(DocHtmlCell *) { - if (!c->isLast()) m_t << "&"; } void ManDocVisitor::visitPre(DocInternal *) { - m_t << "\\begin{Desc}" << endl - << "\\item[" << theTranslator->trForInternalUseOnly() << "]" << endl; + if (!m_firstCol) m_t << endl; + m_t << ".PP" << endl; + m_t << "\\fB" << theTranslator->trForInternalUseOnly() << "\\fP" << endl; + m_t << ".RS 4" << endl; } void ManDocVisitor::visitPost(DocInternal *) { - m_t << "\\end{Desc}" << endl; + if (!m_firstCol) m_t << endl; + m_t << ".RE" << endl; + m_t << ".PP" << endl; + m_firstCol=TRUE; } -void ManDocVisitor::visitPre(DocHRef *href) +void ManDocVisitor::visitPre(DocHRef *) { - if (Config_getBool("PDF_HYPERLINKS")) - { - m_t << "\\href{"; - m_t << href->url(); - m_t << "}"; - } - m_t << "{\\tt "; + m_t << "\\fC"; } void ManDocVisitor::visitPost(DocHRef *) { - m_t << "}"; + m_t << "\\fP"; } void ManDocVisitor::visitPre(DocHtmlHeader *header) { - if (Config_getBool("COMPACT_LATEX")) - { - switch(header->level()) - { - case 1: m_t << "\\subsection*{"; break; - case 2: m_t << "\\subsubsection*{"; break; - case 3: m_t << "\\paragraph*{"; break; - } - } - else - { - switch(header->level()) - { - case 1: m_t << "\\section*{"; break; - case 2: m_t << "\\subsection*{"; break; - case 3: m_t << "\\subsubsection*{"; break; - } - } + if (!m_firstCol) m_t << endl; + if (header->level()==1) m_t << ".SH"; else m_t << ".SS"; + m_t << " \""; } -void ManDocVisitor::visitPost(DocHtmlHeader *) +void ManDocVisitor::visitPost(DocHtmlHeader *header) { - m_t << "}"; + m_t << "\"" << endl; + if (header->level()==1) m_t << ".PP" << endl; + m_firstCol=TRUE; } -void ManDocVisitor::visitPre(DocImage *img) +void ManDocVisitor::visitPre(DocImage *) { - if (img->type()==DocImage::Latex) - { - if (img->hasCaption()) - { - m_t << "\\begin{figure}[H]" << endl; - m_t << "\\begin{center}" << endl; - } - else - { - m_t << "\\mbox{"; - } - QString gfxName = img->name(); - if (gfxName.right(4)==".eps" || gfxName.right(4)==".pdf") - { - gfxName=gfxName.left(gfxName.length()-4); - } - m_t << "\\includegraphics"; - if (!img->width().isEmpty()) - { - m_t << "[width=" << img->width() << "]"; - } - else if (!img->height().isEmpty()) - { - m_t << "[height=" << img->height() << "]"; - } - m_t << "{" << gfxName << "}"; - if (img->hasCaption()) - { - m_t << "\\caption{"; - } - } - else // other format -> skip - { - m_hide=TRUE; - } } -void ManDocVisitor::visitPost(DocImage *img) +void ManDocVisitor::visitPost(DocImage *) { - if (img->type()==DocImage::Latex) - { - m_t << "}" << endl; // end mbox or caption - if (img->hasCaption()) - { - m_t << "\\end{center}" << endl; - m_t << "\\end{figure}" << endl; - } - } - else // other format - { - m_hide=FALSE; - } } -void ManDocVisitor::visitPre(DocDotFile *df) +void ManDocVisitor::visitPre(DocDotFile *) { - QString baseName=df->file(); - int i; - if ((i=baseName.findRev('/'))!=-1) - { - baseName=baseName.right(baseName.length()-i-1); - } - if (baseName.right(4)==".eps" || baseName.right(4)==".pdf") - { - baseName=baseName.left(baseName.length()-4); - } - QString outDir = Config_getString("LATEX_OUTPUT"); - writeDotGraphFromFile(df->file(),outDir,baseName,EPS); - if (df->hasCaption()) - { - m_t << "\\begin{figure}[H]" << endl; - m_t << "\\begin{center}" << endl; - } - else - { - m_t << "\\mbox{"; - } - m_t << "\\includegraphics"; - if (!df->width().isEmpty()) - { - m_t << "[width=" << df->width() << "]"; - } - else if (!df->height().isEmpty()) - { - m_t << "[height=" << df->height() << "]"; - } - m_t << "{" << baseName << "}"; - - if (df->hasCaption()) - { - m_t << "\\caption{"; - } } -void ManDocVisitor::visitPost(DocDotFile *df) +void ManDocVisitor::visitPost(DocDotFile *) { - m_t << "}" << endl; // end mbox or caption - if (df->hasCaption()) - { - m_t << "\\end{center}" << endl; - m_t << "\\end{figure}" << endl; - } } void ManDocVisitor::visitPre(DocLink *) { - m_t << "\\fB "; + m_t << "\\fB"; } void ManDocVisitor::visitPost(DocLink *) { - m_t << "\\fP "; + m_t << "\\fP"; } void ManDocVisitor::visitPre(DocRef *ref) { - m_t << "\\fB "; + m_t << "\\fB"; if (!ref->hasLinkText()) filter(ref->targetTitle()); } void ManDocVisitor::visitPost(DocRef *) { - m_t << "\\fP "; + m_t << "\\fP"; } void ManDocVisitor::visitPre(DocSecRefItem *) { - m_t << "\\item \\contentsline{section}{"; + QCString ws; + ws.fill(' ',m_indent-2); + if (!m_firstCol) m_t << endl; + m_t << ".IP \"" << ws << "\\(bu\" " << m_indent << endl; + m_firstCol=TRUE; } -void ManDocVisitor::visitPost(DocSecRefItem *ref) +void ManDocVisitor::visitPost(DocSecRefItem *) { - m_t << "}{\\ref{" << ref->anchor() << "}}{}" << endl; + m_t << endl; + m_firstCol=TRUE; } void ManDocVisitor::visitPre(DocSecRefList *) { - m_t << "\\footnotesize" << endl; - m_t << "\\begin{multicols}{2}" << endl; - m_t << "\\begin{CompactList}" << endl; + m_indent+=2; } void ManDocVisitor::visitPost(DocSecRefList *) { - m_t << "\\end{CompactList}" << endl; - m_t << "\\end{multicols}" << endl; - m_t << "\\normalsize" << endl; + m_indent-=2; + m_t << ".PP" << endl; } void ManDocVisitor::visitPre(DocLanguage *) @@ -754,8 +661,12 @@ void ManDocVisitor::visitPost(DocLanguage *) void ManDocVisitor::visitPre(DocParamSect *s) { - m_t << "\\begin{Desc}" << endl; - m_t << "\\item["; + if (!m_firstCol) + { + m_t << endl; + m_t << ".PP" << endl; + } + m_t << "\\fB"; switch(s->type()) { case DocParamSect::Param: @@ -767,19 +678,21 @@ void ManDocVisitor::visitPre(DocParamSect *s) default: ASSERT(0); } - m_t << ":]" << endl; - m_t << "\\begin{description}" << endl; + m_t << ":\\fP" << endl; + m_t << ".RS 4" << endl; } void ManDocVisitor::visitPost(DocParamSect *) { - m_t << "\\end{description}" << endl; - m_t << "\\end{Desc}" << endl; + if (!m_firstCol) m_t << endl; + m_t << ".RE" << endl; + m_t << ".PP" << endl; + m_firstCol=TRUE; } void ManDocVisitor::visitPre(DocParamList *pl) { - m_t << "\\item[{\\em "; + m_t << "\\fI"; QStrListIterator li(pl->parameters()); const char *s; bool first=TRUE; @@ -788,42 +701,47 @@ void ManDocVisitor::visitPre(DocParamList *pl) if (!first) m_t << ","; else first=FALSE; m_t << s; } - m_t << "}]"; + m_t << "\\fP "; } -void ManDocVisitor::visitPost(DocParamList *) +void ManDocVisitor::visitPost(DocParamList *pl) { + if (!pl->isLast()) + { + if (!m_firstCol) m_t << endl; + m_t << ".br" << endl; + } } void ManDocVisitor::visitPre(DocXRefItem *x) { - m_t << "\\begin{Desc}" << endl; - m_t << "\\item["; - if (Config_getBool("PDF_HYPERLINKS")) - { - m_t << "\\hyperlink{" << x->file() << "_" << x->anchor() << "}{"; - } - else - { - m_t << "{\\bf "; + if (!m_firstCol) + { + m_t << endl; + m_t << ".PP" << endl; } + m_t << "\\fB"; filter(x->title()); - m_t << "}]"; + m_t << "\\fP" << endl; + m_t << ".RS 4" << endl; } void ManDocVisitor::visitPost(DocXRefItem *) { - m_t << "\\end{Desc}" << endl; + if (!m_firstCol) m_t << endl; + m_t << ".RE" << endl; + m_t << ".PP" << endl; + m_firstCol=TRUE; } void ManDocVisitor::visitPre(DocInternalRef *) { - m_t << "\\fB "; + m_t << "\\fB"; } void ManDocVisitor::visitPost(DocInternalRef *) { - m_t << "\\fP "; + m_t << "\\fP"; } void ManDocVisitor::visitPre(DocCopy *) @@ -834,6 +752,14 @@ void ManDocVisitor::visitPost(DocCopy *) { } +void ManDocVisitor::visitPre(DocText *) +{ +} + +void ManDocVisitor::visitPost(DocText *) +{ +} + void ManDocVisitor::filter(const char *str) { if (str) diff --git a/src/mandocvisitor.h b/src/mandocvisitor.h index 8dd75f6..2b61abf 100644 --- a/src/mandocvisitor.h +++ b/src/mandocvisitor.h @@ -122,6 +122,8 @@ class ManDocVisitor : public DocVisitor void visitPost(DocInternalRef *); void visitPre(DocCopy *); void visitPost(DocCopy *); + void visitPre(DocText *); + void visitPost(DocText *); private: @@ -139,6 +141,8 @@ class ManDocVisitor : public DocVisitor BaseCodeDocInterface &m_ci; bool m_insidePre; bool m_hide; + bool m_firstCol; + int m_indent; }; #endif diff --git a/src/mangen.cpp b/src/mangen.cpp index bf99072..a048b5e 100644 --- a/src/mangen.cpp +++ b/src/mangen.cpp @@ -619,5 +619,6 @@ void ManGenerator::printDoc(DocNode *n) ManDocVisitor *visitor = new ManDocVisitor(t,*this); n->accept(visitor); delete visitor; + t << endl; } diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 659cde8..d829fd8 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -28,7 +28,6 @@ #include "outputlist.h" #include "example.h" #include "membergroup.h" -#include "doc.h" #include "groupdef.h" #include "defargs.h" //#include "xml.h" @@ -904,7 +903,7 @@ void MemberDef::writeDeclaration(OutputList &ol, !annMemb) { ol.startMemberDescription(); - parseDoc(ol,briefFile(),briefLine(),cname,this,briefDescription()); + ol.parseDoc(briefFile(),briefLine(),cname,this,briefDescription(),FALSE); if (detailsVisible) { ol.pushGeneratorState(); @@ -1225,9 +1224,9 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, //printf("md=%s initLines=%d init=`%s'\n",name().data(),initLines,init.data()); ol.startBold(); if (mtype==Define) - parseText(ol,theTranslator->trDefineValue()); + ol.parseText(theTranslator->trDefineValue()); else - parseText(ol,theTranslator->trInitialValue()); + ol.parseText(theTranslator->trInitialValue()); ol.endBold(); initParseCodeContext(); ol.startCodeFragment(); @@ -1249,14 +1248,14 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ) ) { - parseDoc(ol,briefFile(),briefLine(),scopeName,this,brief); + ol.parseDoc(briefFile(),briefLine(),scopeName,this,brief,FALSE); ol.newParagraph(); } /* write detailed description */ if (!detailed.isEmpty()) { - parseDoc(ol,docFile(),docLine(),scopeName,this,detailed+"\n"); + ol.parseDoc(docFile(),docLine(),scopeName,this,detailed+"\n",FALSE); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::RTF); ol.newParagraph(); @@ -1282,7 +1281,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ol.docify(a->name); ol.endDescTableTitle(); ol.startDescTableData(); - parseDoc(ol,docFile(),docLine(),scopeName,this,a->docs+"\n"); + ol.parseDoc(docFile(),docLine(),scopeName,this,a->docs+"\n",FALSE); ol.endDescTableData(); } } @@ -1333,7 +1332,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, if (!fmd->briefDescription().isEmpty()) { - parseDoc(ol,fmd->briefFile(),fmd->briefLine(),scopeName,fmd,fmd->briefDescription()); + ol.parseDoc(fmd->briefFile(),fmd->briefLine(),scopeName,fmd,fmd->briefDescription(),FALSE); //ol.newParagraph(); } if (!fmd->briefDescription().isEmpty() && @@ -1343,7 +1342,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, } if (!fmd->documentation().isEmpty()) { - parseDoc(ol,fmd->docFile(),fmd->docLine(),scopeName,fmd,fmd->documentation()+"\n"); + ol.parseDoc(fmd->docFile(),fmd->docLine(),scopeName,fmd,fmd->documentation()+"\n",FALSE); } ol.endDescTableData(); } @@ -1380,7 +1379,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, int markerPos = reimplFromLine.find("@0"); if (markerPos!=-1) // should always pass this. { - parseText(ol,reimplFromLine.left(markerPos)); //text left from marker + ol.parseText(reimplFromLine.left(markerPos)); //text left from marker if (bmd->isLinkable()) // replace marker with link { Definition *bd=bmd->group; @@ -1404,7 +1403,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, writePageRef(ol,bcd->getOutputFileBase(),0); } } - parseText(ol,reimplFromLine.right( + ol.parseText(reimplFromLine.right( reimplFromLine.length()-markerPos-2)); // text right from marker ol.disableAllBut(OutputGenerator::RTF); @@ -1456,7 +1455,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, // now replace all markers in reimplInLine with links to the classes while ((newIndex=marker.match(reimplInLine,index,&matchLen))!=-1) { - parseText(ol,reimplInLine.mid(index,newIndex-index)); + ol.parseText(reimplInLine.mid(index,newIndex-index)); bool ok; uint entryIndex = reimplInLine.mid(newIndex+1,matchLen-1).toUInt(&ok); //bmd=bml->at(entryIndex); @@ -1490,7 +1489,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ++mli; index=newIndex+matchLen; } - parseText(ol,reimplInLine.right(reimplInLine.length()-index)); + ol.parseText(reimplInLine.right(reimplInLine.length()-index)); ol.disableAllBut(OutputGenerator::RTF); ol.newParagraph(); ol.enableAll(); diff --git a/src/memberlist.cpp b/src/memberlist.cpp index 71c5feb..6c718e7 100644 --- a/src/memberlist.cpp +++ b/src/memberlist.cpp @@ -24,7 +24,6 @@ #include "language.h" #include "doxygen.h" #include "outputlist.h" -#include "doc.h" #include "groupdef.h" MemberList::MemberList() : QList<MemberDef>() @@ -285,7 +284,7 @@ void MemberList::writePlainDeclarations(OutputList &ol, if (fmd->hasOneLineInitializer()) // enum value has initializer { typeDecl.writeString(" = "); - parseText(typeDecl,fmd->initializer()); + typeDecl.parseText(fmd->initializer()); } } @@ -341,10 +340,11 @@ void MemberList::writePlainDeclarations(OutputList &ol, if (!md->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC")) { ol.startMemberDescription(); - parseDoc(ol, + ol.parseDoc( md->briefFile(),md->briefLine(), cd?cd->name().data():0,md, - md->briefDescription() + md->briefDescription(), + FALSE ); if (md->isDetailedSectionLinkable()) { @@ -360,7 +360,7 @@ void MemberList::writePlainDeclarations(OutputList &ol, { ol.startTextLink(0,md->anchor()); } - parseText(ol,theTranslator->trMore()); + ol.parseText(theTranslator->trMore()); ol.endTextLink(); ol.startEmphasis(); ol.enableAll(); @@ -418,14 +418,14 @@ void MemberList::writeDeclarations(OutputList &ol, if (title) { ol.startMemberHeader(); - parseText(ol,title); + ol.parseText(title); ol.endMemberHeader(); } if (subtitle && subtitle[0]!=0) { //printf("subtitle=`%s'\n",subtitle); ol.startMemberSubtitle(); - parseDoc(ol,"<generated>",1,0,0,subtitle); + ol.parseDoc("<generated>",1,0,0,subtitle,FALSE); ol.endMemberSubtitle(); } @@ -442,14 +442,14 @@ void MemberList::writeDeclarations(OutputList &ol, ol.startMemberGroupHeader(hasHeader); if (hasHeader) { - parseText(ol,mg->header()); + ol.parseText(mg->header()); } ol.endMemberGroupHeader(); if (!mg->documentation().isEmpty()) { //printf("Member group has docs!\n"); ol.startMemberGroupDocs(); - parseDoc(ol,"<generated>",1,0,0,mg->documentation()+"\n"); + ol.parseDoc("<generated>",1,0,0,mg->documentation()+"\n",FALSE); ol.endMemberGroupDocs(); } ol.startMemberGroup(); @@ -476,7 +476,7 @@ void MemberList::writeDocumentation(OutputList &ol, { ol.writeRuler(); ol.startGroupHeader(); - parseText(ol,title); + ol.parseText(title); ol.endGroupHeader(); } diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 893ff96..0f32a94 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -19,7 +19,6 @@ #include "namespacedef.h" #include "outputlist.h" #include "util.h" -#include "doc.h" #include "language.h" #include "classdef.h" #include "classlist.h" @@ -198,12 +197,12 @@ void NamespaceDef::writeDetailedDocumentation(OutputList &ol) //if (latexOn) ol.enable(OutputGenerator::Latex); ol.popGeneratorState(); ol.startGroupHeader(); - parseText(ol,theTranslator->trDetailedDescription()); + ol.parseText(theTranslator->trDetailedDescription()); ol.endGroupHeader(); ol.startTextBlock(); if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) { - parseDoc(ol,briefFile(),briefLine(),name(),0,briefDescription()); + ol.parseDoc(briefFile(),briefLine(),name(),0,briefDescription(),FALSE); } if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF") && !documentation().isEmpty()) @@ -212,7 +211,7 @@ void NamespaceDef::writeDetailedDocumentation(OutputList &ol) } if (!documentation().isEmpty()) { - parseDoc(ol,docFile(),docLine(),name(),0,documentation()+"\n"); + ol.parseDoc(docFile(),docLine(),name(),0,documentation()+"\n",FALSE); ol.newParagraph(); } ol.endTextBlock(); @@ -227,11 +226,11 @@ void NamespaceDef::writeDocumentation(OutputList &ol) //ol.docify(pageTitle); if (Config_getBool("OPTIMIZE_OUTPUT_JAVA")) { - parseText(ol,theTranslator->trPackage(displayName())); + ol.parseText(theTranslator->trPackage(displayName())); } else { - parseText(ol,theTranslator->trNamespaceReference(displayName())); + ol.parseText(theTranslator->trNamespaceReference(displayName())); } addGroupListToTitle(ol,this); endTitle(ol,getOutputFileBase(),displayName()); @@ -252,12 +251,12 @@ void NamespaceDef::writeDocumentation(OutputList &ol) } else if (!briefDescription().isEmpty()) { - parseDoc(ol,briefFile(),briefLine(),name(),0,briefDescription()); + ol.parseDoc(briefFile(),briefLine(),name(),0,briefDescription(),FALSE); ol.writeString(" \n"); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); ol.startTextLink(0,"_details"); - parseText(ol,theTranslator->trMore()); + ol.parseText(theTranslator->trMore()); ol.endTextLink(); ol.popGeneratorState(); } @@ -315,9 +314,9 @@ void NamespaceDef::writeDocumentation(OutputList &ol) ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Man); ol.startGroupHeader(); - parseText(ol,theTranslator->trAuthor(TRUE,TRUE)); + ol.parseText(theTranslator->trAuthor(TRUE,TRUE)); ol.endGroupHeader(); - parseText(ol,theTranslator->trGeneratedAutomatically(Config_getString("PROJECT_NAME"))); + ol.parseText(theTranslator->trGeneratedAutomatically(Config_getString("PROJECT_NAME"))); if (!Config_getString("GENERATE_TAGFILE").isEmpty()) { diff --git a/src/outputgen.h b/src/outputgen.h index 5613bc1..bd432ca 100644 --- a/src/outputgen.h +++ b/src/outputgen.h @@ -86,8 +86,8 @@ class BaseOutputDocInterface : public BaseCodeDocInterface }; virtual void parseDoc(const char *,int, const char *,MemberDef *, - const QCString &) - {} + const QCString &,bool) {} + virtual void parseText(const QCString &) {} /*! Start of a bullet list: e.g. \c <ul> in html. writeListItem() is * Used for the bullet items. @@ -297,7 +297,7 @@ class BaseOutputDocInterface : public BaseCodeDocInterface class OutputGenerator : public BaseOutputDocInterface { public: - enum OutputType { Html, Latex, Man, RTF, XML, DEF }; + enum OutputType { Html, Latex, Man, RTF, XML, DEF, Perl }; OutputGenerator(); virtual ~OutputGenerator(); diff --git a/src/outputlist.cpp b/src/outputlist.cpp index f9aadd5..8b9781b 100644 --- a/src/outputlist.cpp +++ b/src/outputlist.cpp @@ -193,7 +193,7 @@ void OutputList::popGeneratorState() void OutputList::parseDoc(const char *fileName,int startLine, const char * clName,MemberDef * md, - const QCString &docStr) + const QCString &docStr,bool isExample) { int count=0; OutputGenerator *og=outputs->first(); @@ -204,7 +204,31 @@ void OutputList::parseDoc(const char *fileName,int startLine, } if (count==0) return; // no output formats enabled. - DocNode *root = validatingParseDoc(fileName,startLine,clName,md,docStr); + DocNode *root = validatingParseDoc(fileName,startLine, + clName,md,docStr,isExample); + + og=outputs->first(); + while (og) + { + if (og->isEnabled()) og->printDoc(root); + og=outputs->next(); + } + + delete root; +} + +void OutputList::parseText(const QCString &textStr) +{ + int count=0; + OutputGenerator *og=outputs->first(); + while (og) + { + if (og->isEnabled()) count++; + og=outputs->next(); + } + if (count==0) return; // no output formats enabled. + + DocNode *root = validatingParseText(textStr); og=outputs->first(); while (og) diff --git a/src/outputlist.h b/src/outputlist.h index 918d373..ced3fb4 100644 --- a/src/outputlist.h +++ b/src/outputlist.h @@ -64,7 +64,9 @@ class OutputList : public OutputDocInterface ////////////////////////////////////////////////// void parseDoc(const char *fileName,int startLine, - const char *clName,MemberDef *md,const QCString &docStr); + const char *clName,MemberDef *md,const QCString &docStr, + bool isExample); + void parseText(const QCString &textStr); OutputDocInterface *clone() { diff --git a/src/packagedef.cpp b/src/packagedef.cpp index 8e1c3ae..5f87030 100644 --- a/src/packagedef.cpp +++ b/src/packagedef.cpp @@ -23,7 +23,6 @@ #include "outputlist.h" #include "util.h" #include "config.h" -#include "doc.h" #include "language.h" #include "doxygen.h" @@ -58,17 +57,15 @@ void PackageDef::writeDocumentation(OutputList &ol) ol.docify(title); endTitle(ol,getOutputFileBase(),title); - OutputList briefOutput(&ol); if (!briefDescription().isEmpty()) { - parseDoc(briefOutput,briefFile(),briefLine(),name(),0,briefDescription()); - ol+=briefOutput; + ol.parseDoc(briefFile(),briefLine(),name(),0,briefDescription(),FALSE); ol.writeString(" \n"); ol.pushGeneratorState(); ol.disable(OutputGenerator::Latex); ol.disable(OutputGenerator::RTF); ol.startTextLink(0,"_details"); - parseText(ol,theTranslator->trMore()); + ol.parseText(theTranslator->trMore()); ol.endTextLink(); ol.popGeneratorState(); } @@ -101,20 +98,20 @@ void PackageDef::writeDocumentation(OutputList &ol) ol.writeAnchor(0,"_details"); ol.popGeneratorState(); ol.startGroupHeader(); - parseText(ol,theTranslator->trDetailedDescription()); + ol.parseText(theTranslator->trDetailedDescription()); ol.endGroupHeader(); // repeat brief description if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) { - ol+=briefOutput; + ol.parseDoc(briefFile(),briefLine(),name(),0,briefDescription(),FALSE); ol.newParagraph(); } // write documentation if (!documentation().isEmpty()) { - parseDoc(ol,docFile(),docLine(),name(),0,documentation()+"\n"); + ol.parseDoc(docFile(),docLine(),name(),0,documentation()+"\n",FALSE); } } @@ -85,7 +85,10 @@ class PageInfo SectionInfo *si; for (;(si=sdi.current());++sdi) { - Doxygen::tagFile << " <docanchor>" << si->label << "</docanchor>" << endl; + if (!si->generated) + { + Doxygen::tagFile << " <docanchor>" << si->label << "</docanchor>" << endl; + } } } } diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp new file mode 100644 index 0000000..e322595 --- /dev/null +++ b/src/perlmodgen.cpp @@ -0,0 +1,1876 @@ +/****************************************************************************** + * + * + * + * + * Copyright (C) 1997-2002 by Dimitri van Heesch. + * Authors: Dimitri van Heesch, Miguel Lobo. + * + * 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 <stdlib.h> + +#include "perlmodgen.h" +#include "docparser.h" +#include "message.h" +#include "doxygen.h" +#include "page.h" + +#include <qdir.h> +#include <qstack.h> +#include <qdict.h> +#include <qfile.h> +#include <qtextstream.h> + +#define PERLOUTPUT_MAX_INDENTATION 40 + +class PerlModOutputStream +{ +public: + + QString m_s; + QTextStream *m_t; + + PerlModOutputStream(QTextStream *t = 0) : m_t(t) { } + + void add(char c); + void add(const char *s); + void add(QCString &s); + void add(QString &s); + void add(int n); + void add(unsigned int n); +}; + +void PerlModOutputStream::add(char c) +{ + if (m_t != 0) + (*m_t) << c; + else + m_s += c; +} + +void PerlModOutputStream::add(const char *s) +{ + if (m_t != 0) + (*m_t) << s; + else + m_s += s; +} + +void PerlModOutputStream::add(QCString &s) +{ + if (m_t != 0) + (*m_t) << s; + else + m_s += s; +} + +void PerlModOutputStream::add(QString &s) +{ + if (m_t != 0) + (*m_t) << s; + else + m_s += s; +} + +void PerlModOutputStream::add(int n) +{ + if (m_t != 0) + (*m_t) << n; + else + m_s += n; +} + +void PerlModOutputStream::add(unsigned int n) +{ + if (m_t != 0) + (*m_t) << n; + else + m_s += n; +} + +class PerlModOutput +{ +public: + + PerlModOutput(PerlModOutputStream *os) : m_stream(os), m_indentation(0) { m_spaces[0] = 0; } + virtual ~PerlModOutput() { } + + inline PerlModOutput &openSave() { iopenSave(); return *this; } + inline PerlModOutput &closeSave(QString &s) { icloseSave(s); return *this; } + + inline PerlModOutput &add(char c) { m_stream->add(c); return *this; } + inline PerlModOutput &add(const char *s) { m_stream->add(s); return *this; } + inline PerlModOutput &add(QCString &s) { m_stream->add(s); return *this; } + inline PerlModOutput &add(QString &s) { m_stream->add(s); return *this; } + inline PerlModOutput &add(int n) { m_stream->add(n); return *this; } + inline PerlModOutput &add(unsigned int n) { m_stream->add(n); return *this; } + + PerlModOutput &addQuoted(const char *s) { iaddQuoted(s); return *this; } + inline PerlModOutput &indent() { m_stream->add(m_spaces); return *this; } + + inline PerlModOutput &open(char c, const char *s = 0) { iopen(c, s); return *this; } + inline PerlModOutput &close(char c = 0) { iclose(c); return *this; } + + inline PerlModOutput &addField(const char *s) { iaddField(s); return *this; } + inline PerlModOutput &addFieldQuoted(const char *field, const char *content) + { + iaddFieldQuoted(field, content); return *this; + } + inline PerlModOutput &openList(const char *s = 0) { open('[', s); return *this; } + inline PerlModOutput &closeList() { close(']'); return *this; } + inline PerlModOutput &openHash(const char *s = 0 ) { open('{', s); return *this; } + inline PerlModOutput &closeHash() { close('}'); return *this; } + +protected: + + void iopenSave(); + void icloseSave(QString &); + + void incIndent(); + void decIndent(); + + void iaddQuoted(const char *); + void iaddFieldQuoted(const char *, const char *); + void iaddField(const char *); + + void iopen(char, const char *); + void iclose(char); + +private: + + PerlModOutputStream *m_stream; + int m_indentation; + + QStack<PerlModOutputStream> m_saved; + char m_spaces[PERLOUTPUT_MAX_INDENTATION * 2 + 2]; +}; + +void PerlModOutput::iopenSave() +{ + m_saved.push(m_stream); + m_stream = new PerlModOutputStream(); +} + +void PerlModOutput::icloseSave(QString &s) +{ + s = m_stream->m_s; + delete m_stream; + m_stream = m_saved.pop(); +} + +void PerlModOutput::incIndent() +{ + if (m_indentation < PERLOUTPUT_MAX_INDENTATION) + { + char *s = &m_spaces[m_indentation * 2]; + *s++ = ' '; *s++ = ' '; *s = 0; + } + m_indentation++; +} + +void PerlModOutput::decIndent() +{ + m_indentation--; + if (m_indentation < PERLOUTPUT_MAX_INDENTATION) + m_spaces[m_indentation * 2] = 0; +} + +void PerlModOutput::iaddQuoted(const char *s) +{ + char c; + while ((c = *s++) != 0) { + if (c == '\'') + m_stream->add('\\'); + m_stream->add(c); + } +} + +inline void PerlModOutput::iaddField(const char *s) +{ + indent(); + m_stream->add(s); + m_stream->add(" => "); +} + +void PerlModOutput::iaddFieldQuoted(const char *field, const char *content) +{ + iaddField(field); + m_stream->add('\''); + iaddQuoted(content); + m_stream->add("',\n"); +} + +void PerlModOutput::iopen(char c, const char *s) +{ + if (s != 0) + iaddField(s); + else + indent(); + m_stream->add(c); + m_stream->add('\n'); + incIndent(); +} + +void PerlModOutput::iclose(char c) +{ + decIndent(); + indent(); + if (c != 0) + m_stream->add(c); + m_stream->add(",\n"); +} + +/*! @brief Concrete visitor implementation for Perl output. */ +class PerlModDocVisitor : public DocVisitor +{ +public: + PerlModDocVisitor(PerlModOutput &); + virtual ~PerlModDocVisitor() {} + + void finish(); + + //-------------------------------------- + // visitor functions for leaf nodes + //-------------------------------------- + + void visit(DocWord *); + void visit(DocLinkedWord *); + void visit(DocWhiteSpace *); + void visit(DocSymbol *); + void visit(DocURL *); + void visit(DocLineBreak *); + void visit(DocHorRuler *); + void visit(DocStyleChange *); + void visit(DocVerbatim *); + void visit(DocAnchor *); + void visit(DocInclude *); + void visit(DocIncOperator *); + void visit(DocFormula *); + void visit(DocIndexEntry *); + + //-------------------------------------- + // visitor functions for compound nodes + //-------------------------------------- + + void visitPre(DocAutoList *); + void visitPost(DocAutoList *); + void visitPre(DocAutoListItem *); + void visitPost(DocAutoListItem *); + void visitPre(DocPara *) ; + void visitPost(DocPara *); + void visitPre(DocRoot *); + void visitPost(DocRoot *); + void visitPre(DocSimpleSect *); + void visitPost(DocSimpleSect *); + void visitPre(DocTitle *); + void visitPost(DocTitle *); + void visitPre(DocSimpleList *); + void visitPost(DocSimpleList *); + void visitPre(DocSimpleListItem *); + void visitPost(DocSimpleListItem *); + void visitPre(DocSection *); + void visitPost(DocSection *); + void visitPre(DocHtmlList *); + void visitPost(DocHtmlList *) ; + void visitPre(DocHtmlListItem *); + void visitPost(DocHtmlListItem *); + void visitPre(DocHtmlPre *); + void visitPost(DocHtmlPre *); + void visitPre(DocHtmlDescList *); + void visitPost(DocHtmlDescList *); + void visitPre(DocHtmlDescTitle *); + void visitPost(DocHtmlDescTitle *); + void visitPre(DocHtmlDescData *); + void visitPost(DocHtmlDescData *); + void visitPre(DocHtmlTable *); + void visitPost(DocHtmlTable *); + void visitPre(DocHtmlRow *); + void visitPost(DocHtmlRow *) ; + void visitPre(DocHtmlCell *); + void visitPost(DocHtmlCell *); + void visitPre(DocHtmlCaption *); + void visitPost(DocHtmlCaption *); + void visitPre(DocInternal *); + void visitPost(DocInternal *); + void visitPre(DocHRef *); + void visitPost(DocHRef *); + void visitPre(DocHtmlHeader *); + void visitPost(DocHtmlHeader *); + void visitPre(DocImage *); + void visitPost(DocImage *); + void visitPre(DocDotFile *); + void visitPost(DocDotFile *); + void visitPre(DocLink *); + void visitPost(DocLink *); + void visitPre(DocRef *); + void visitPost(DocRef *); + void visitPre(DocSecRefItem *); + void visitPost(DocSecRefItem *); + void visitPre(DocSecRefList *); + void visitPost(DocSecRefList *); + void visitPre(DocLanguage *); + void visitPost(DocLanguage *); + void visitPre(DocParamSect *); + void visitPost(DocParamSect *); + void visitPre(DocParamList *); + void visitPost(DocParamList *); + void visitPre(DocXRefItem *); + void visitPost(DocXRefItem *); + void visitPre(DocInternalRef *); + void visitPost(DocInternalRef *); + void visitPre(DocCopy *); + void visitPost(DocCopy *); + void visitPre(DocText *); + void visitPost(DocText *); + +private: + + //-------------------------------------- + // helper functions + //-------------------------------------- + + void addLink(const QString &ref,const QString &file, + const QString &anchor); + + void enterText(); + void leaveText(); + + void openItem(const char *); + void closeItem(); + void singleItem(const char *); + void openSubBlock(const char * = 0); + void closeSubBlock(); + + //-------------------------------------- + // state variables + //-------------------------------------- + + PerlModOutput &m_output; + bool m_textmode; + QString m_other; +}; + +PerlModDocVisitor::PerlModDocVisitor(PerlModOutput &output) + : m_output(output), m_textmode(false) +{ + m_output.openList("doc"); +} + +void PerlModDocVisitor::finish() +{ + leaveText(); + m_output.closeList() + .add(m_other); +} + +void PerlModDocVisitor::addLink(const QString &,const QString &file,const QString &anchor) +{ + QString link = file; + if (!anchor.isEmpty()) + (link += "_1") += anchor; + m_output.addFieldQuoted("link", link); +} + +void PerlModDocVisitor::openItem(const char *name) +{ + leaveText(); + m_output.openHash().addFieldQuoted("type", name); +} + +void PerlModDocVisitor::closeItem() +{ + m_output.closeHash(); +} + +void PerlModDocVisitor::enterText() +{ + if (m_textmode) + return; + openItem("text"); + m_output.addField("content").add('\''); + m_textmode = true; +} + +void PerlModDocVisitor::leaveText() +{ + if (!m_textmode) + return; + m_output.add("\'\n"); + closeItem(); + m_textmode = false; +} + +void PerlModDocVisitor::singleItem(const char *name) +{ + openItem(name); + closeItem(); +} + +void PerlModDocVisitor::openSubBlock(const char *s) +{ + m_output.openList(s); +} + +void PerlModDocVisitor::closeSubBlock() +{ + leaveText(); + m_output.closeList(); +} + +void PerlModDocVisitor::visit(DocWord *w) +{ + enterText(); + m_output.addQuoted(w->word()); +} + +void PerlModDocVisitor::visit(DocLinkedWord *w) +{ + openItem("url"); + addLink(w->ref(), w->file(), w->anchor()); + m_output.addFieldQuoted("content", w->word()); + closeItem(); +} + +void PerlModDocVisitor::visit(DocWhiteSpace *) +{ + enterText(); + m_output.add(' '); +} + +void PerlModDocVisitor::visit(DocSymbol *sy) +{ + char c = 0; + const char *s = 0; + switch(sy->symbol()) + { + case DocSymbol::At: c = '@'; break; + case DocSymbol::Less: c = '<'; break; + case DocSymbol::Greater: c = '>'; break; + case DocSymbol::Amp: c = '&'; break; + case DocSymbol::Dollar: c = '$'; break; + case DocSymbol::Hash: c = '#'; break; + case DocSymbol::Percent: c = '%'; break; + case DocSymbol::Quot: c = '"'; break; + case DocSymbol::Szlig: c = 'ß'; break; + case DocSymbol::Nbsp: c = ' '; break; + case DocSymbol::Uml: c = sy->letter(); break; + case DocSymbol::Acute: c = sy->letter(); break; + case DocSymbol::Grave: c = sy->letter(); break; + case DocSymbol::Circ: c = sy->letter(); break; + case DocSymbol::Tilde: c = sy->letter(); break; + case DocSymbol::Cedil: c = sy->letter(); break; + case DocSymbol::Ring: c = sy->letter(); break; + case DocSymbol::BSlash: s = "\\\\"; break; + case DocSymbol::Copy: s = "(c)"; break; + case DocSymbol::Apos: s = "\\\'"; break; + default: + err("Error: unknown symbol found\n"); + } + enterText(); + if (c != 0) + m_output.add(c); + else + m_output.add(s); +} + +void PerlModDocVisitor::visit(DocURL *u) +{ + openItem("url"); + m_output.addQuoted(u->url()); + closeItem(); +} + +void PerlModDocVisitor::visit(DocLineBreak *) { singleItem("linebreak"); } +void PerlModDocVisitor::visit(DocHorRuler *) { singleItem("hruler"); } +void PerlModDocVisitor::visit(DocStyleChange *s) +{ + switch (s->style()) + { + case DocStyleChange::Bold: break; // bold + case DocStyleChange::Italic: break; // italic + case DocStyleChange::Code: break; // code + case DocStyleChange::Subscript: break; // subscript + case DocStyleChange::Superscript: break; // superscript + case DocStyleChange::Center: break; // center + case DocStyleChange::Small: break; // small + default: + err("Error: unknown style found.\n"); + } +} + +void PerlModDocVisitor::visit(DocVerbatim *s) +{ + const char *type = 0; + switch(s->type()) + { + case DocVerbatim::Code: +#if 0 + m_output.add("<programlisting>"); + parseCode(m_ci,s->context(),s->text(),FALSE,0); + m_output.add("</programlisting>"); +#endif + return; + case DocVerbatim::Verbatim: type = "preformatted"; break; + case DocVerbatim::HtmlOnly: type = "htmlonly"; break; + case DocVerbatim::LatexOnly: type = "latexonly"; break; + } + openItem(type); + m_output.addFieldQuoted("content", s->text()); + closeItem(); +} + +void PerlModDocVisitor::visit(DocAnchor *anc) +{ + QString anchor = anc->file() + "_1" + anc->anchor(); + openItem("anchor"); + m_output.addFieldQuoted("id", anchor); + closeItem(); +} + +void PerlModDocVisitor::visit(DocInclude *inc) +{ + const char *type = 0; + switch(inc->type()) + { + case DocInclude::Include: +#if 0 + m_output.add("<programlisting>"); + parseCode(m_ci,inc->context(),inc->text(),FALSE,0); + m_output.add("</programlisting>"); +#endif + return; + case DocInclude::DontInclude: return; + case DocInclude::HtmlInclude: type = "htmlonly"; break; + case DocInclude::VerbInclude: type = "preformatted"; break; + } + openItem(type); + m_output.addFieldQuoted("content", inc->text()); + closeItem(); +} + +void PerlModDocVisitor::visit(DocIncOperator *) +{ +#if 0 + //printf("DocIncOperator: type=%d first=%d, last=%d text=`%s'\n", + // op->type(),op->isFirst(),op->isLast(),op->text().data()); + if (op->isFirst()) + { + m_output.add("<programlisting>"); + } + if (op->type()!=DocIncOperator::Skip) + { + parseCode(m_ci,op->context(),op->text(),FALSE,0); + } + if (op->isLast()) + { + m_output.add("</programlisting>"); + } + else + { + m_output.add('\n'); + } +#endif +} + +void PerlModDocVisitor::visit(DocFormula *f) +{ + openItem("formula"); + QString id; + id += f->id(); + m_output.addFieldQuoted("id", id).addFieldQuoted("content", f->text()); + closeItem(); +} + +void PerlModDocVisitor::visit(DocIndexEntry *) +{ +#if 0 + m_output.add("<indexentry>" + "<primaryie>"); + m_output.addQuoted(ie->entry()); + m_output.add("</primaryie>" + "<secondaryie></secondaryie>" + "</indexentry>"); +#endif +} + +//-------------------------------------- +// visitor functions for compound nodes +//-------------------------------------- + +void PerlModDocVisitor::visitPre(DocAutoList *l) +{ + openItem(l->isEnumList() ? "ordered_list" : "itemized_list"); + openSubBlock("content"); +} +void PerlModDocVisitor::visitPost(DocAutoList *) { closeSubBlock(); } + +void PerlModDocVisitor::visitPre(DocAutoListItem *) { openSubBlock(); } +void PerlModDocVisitor::visitPost(DocAutoListItem *) { closeSubBlock(); } +void PerlModDocVisitor::visitPre(DocPara *) +{ + openItem("para"); + openSubBlock("content"); +} +void PerlModDocVisitor::visitPost(DocPara *) +{ + closeSubBlock(); + closeItem(); +} + +void PerlModDocVisitor::visitPre(DocRoot *) +{ +} + +void PerlModDocVisitor::visitPost(DocRoot *) +{ +} + +void PerlModDocVisitor::visitPre(DocSimpleSect *s) +{ + leaveText(); + const char *type; + switch (s->type()) + { + case DocSimpleSect::See: type = "see"; break; + case DocSimpleSect::Return: type = "return"; break; + case DocSimpleSect::Author: type = "author"; break; + case DocSimpleSect::Authors: type = "authors"; break; + case DocSimpleSect::Version: type = "version"; break; + case DocSimpleSect::Since: type = "since"; break; + case DocSimpleSect::Date: type = "date"; break; + case DocSimpleSect::Note: type = "bug"; break; + case DocSimpleSect::Warning: type = "warning"; break; + case DocSimpleSect::Pre: type = "pre"; break; + case DocSimpleSect::Post: type = "post"; break; + case DocSimpleSect::Invar: type = "invariant"; break; + case DocSimpleSect::Remark: type = "remark"; break; + case DocSimpleSect::Attention: type = "attention"; break; + case DocSimpleSect::User: type = "par"; break; + default: type = "illegal"; break; + } + m_output.openSave().openList(type); +} + +void PerlModDocVisitor::visitPost(DocSimpleSect *) +{ + QString content; + leaveText(); + m_output.closeList().closeSave(content); + m_other += content; +} + +void PerlModDocVisitor::visitPre(DocTitle *) +{ + openItem("title"); + openSubBlock("content"); +} + +void PerlModDocVisitor::visitPost(DocTitle *) +{ + closeSubBlock(); + closeItem(); +} + +void PerlModDocVisitor::visitPre(DocSimpleList *) +{ + openItem("itemized_list"); + openSubBlock("content"); +} +void PerlModDocVisitor::visitPost(DocSimpleList *) { closeSubBlock(); } +void PerlModDocVisitor::visitPre(DocSimpleListItem *) { openSubBlock(); } +void PerlModDocVisitor::visitPost(DocSimpleListItem *) { closeSubBlock(); } + +void PerlModDocVisitor::visitPre(DocSection *s) +{ + QString sect = "sect" + (s->level() + 1); + openItem(sect); + openSubBlock("content"); +} +void PerlModDocVisitor::visitPost(DocSection *) { closeSubBlock(); } + +void PerlModDocVisitor::visitPre(DocHtmlList *l) +{ + openItem((l->type() == DocHtmlList::Ordered) ? "ordered_list" : "itemized_list"); + openSubBlock("content"); +} +void PerlModDocVisitor::visitPost(DocHtmlList *) { closeSubBlock(); } +void PerlModDocVisitor::visitPre(DocHtmlListItem *) { openSubBlock(); } +void PerlModDocVisitor::visitPost(DocHtmlListItem *) { closeSubBlock(); } + +void PerlModDocVisitor::visitPre(DocHtmlPre *) +{ + openItem("preformatted"); + openSubBlock("content"); + //m_insidePre=TRUE; +} + +void PerlModDocVisitor::visitPost(DocHtmlPre *) +{ + //m_insidePre=FALSE; + closeSubBlock(); + closeItem(); +} + +void PerlModDocVisitor::visitPre(DocHtmlDescList *) +{ +#if 0 + m_output.add("<variablelist>\n"); +#endif +} + +void PerlModDocVisitor::visitPost(DocHtmlDescList *) +{ +#if 0 + m_output.add("</variablelist>\n"); +#endif +} + +void PerlModDocVisitor::visitPre(DocHtmlDescTitle *) +{ +#if 0 + m_output.add("<varlistentry><term>"); +#endif +} + +void PerlModDocVisitor::visitPost(DocHtmlDescTitle *) +{ +#if 0 + m_output.add("</term></varlistentry>\n"); +#endif +} + +void PerlModDocVisitor::visitPre(DocHtmlDescData *) +{ +#if 0 + m_output.add("<listitem>"); +#endif +} + +void PerlModDocVisitor::visitPost(DocHtmlDescData *) +{ +#if 0 + m_output.add("</listitem>\n"); +#endif +} + +void PerlModDocVisitor::visitPre(DocHtmlTable *) +{ +#if 0 + m_output.add("<table rows=\""); m_output.add(t->numRows()); + m_output.add("\" cols=\""); m_output.add(t->numCols()); m_output.add("\">"); +#endif +} + +void PerlModDocVisitor::visitPost(DocHtmlTable *) +{ +#if 0 + m_output.add("</table>\n"); +#endif +} + +void PerlModDocVisitor::visitPre(DocHtmlRow *) +{ +#if 0 + m_output.add("<row>\n"); +#endif +} + +void PerlModDocVisitor::visitPost(DocHtmlRow *) +{ +#if 0 + m_output.add("</row>\n"); +#endif +} + +void PerlModDocVisitor::visitPre(DocHtmlCell *) +{ +#if 0 + if (c->isHeading()) m_output.add("<entry thead=\"yes\">"); else m_output.add("<entry thead=\"no\">"); +#endif +} + +void PerlModDocVisitor::visitPost(DocHtmlCell *) +{ +#if 0 + m_output.add("</entry>"); +#endif +} + +void PerlModDocVisitor::visitPre(DocHtmlCaption *) +{ +#if 0 + m_output.add("<caption>"); +#endif +} + +void PerlModDocVisitor::visitPost(DocHtmlCaption *) +{ +#if 0 + m_output.add("</caption>\n"); +#endif +} + +void PerlModDocVisitor::visitPre(DocInternal *) +{ +#if 0 + m_output.add("<internal>"); +#endif +} + +void PerlModDocVisitor::visitPost(DocInternal *) +{ +#if 0 + m_output.add("</internal>"); +#endif +} + +void PerlModDocVisitor::visitPre(DocHRef *) +{ +#if 0 + m_output.add("<ulink url=\""); m_output.add(href->url()); m_output.add("\">"); +#endif +} + +void PerlModDocVisitor::visitPost(DocHRef *) +{ +#if 0 + m_output.add("</ulink>"); +#endif +} + +void PerlModDocVisitor::visitPre(DocHtmlHeader *) +{ +#if 0 + m_output.add("<sect"); m_output.add(header->level()); m_output.add(">"); +#endif +} + +void PerlModDocVisitor::visitPost(DocHtmlHeader *) +{ +#if 0 + m_output.add("</sect"); m_output.add(header->level()); m_output.add(">\n"); +#endif +} + +void PerlModDocVisitor::visitPre(DocImage *) +{ +#if 0 + m_output.add("<image type=\""); + switch(img->type()) + { + case DocImage::Html: m_output.add("html"); break; + case DocImage::Latex: m_output.add("latex"); break; + case DocImage::Rtf: m_output.add("rtf"); break; + } + m_output.add("\""); + + QCString baseName=img->name(); + int i; + if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1) + { + baseName=baseName.right(baseName.length()-i-1); + } + m_output.add(" name=\""); m_output.add(baseName); m_output.add("\""); + if (!img->width().isEmpty()) + { + m_output.add(" width=\""); + m_output.addQuoted(img->width()); + m_output.add("\""); + } + else if (!img->height().isEmpty()) + { + m_output.add(" height=\""); + m_output.addQuoted(img->height()); + m_output.add("\""); + } + m_output.add(">"); +#endif +} + +void PerlModDocVisitor::visitPost(DocImage *) +{ +#if 0 + m_output.add("</image>"); +#endif +} + +void PerlModDocVisitor::visitPre(DocDotFile *) +{ +#if 0 + m_output.add("<dotfile name=\""); m_output.add(df->file()); m_output.add("\">"); +#endif +} + +void PerlModDocVisitor::visitPost(DocDotFile *) +{ +#if 0 + m_output.add("</dotfile>"); +#endif +} + +void PerlModDocVisitor::visitPre(DocLink *lnk) +{ + openItem("link"); + addLink(lnk->ref(), lnk->file(), lnk->anchor()); +} + +void PerlModDocVisitor::visitPost(DocLink *) +{ + closeItem(); +} + +void PerlModDocVisitor::visitPre(DocRef *ref) +{ + openItem("ref"); + if (!ref->hasLinkText()) + m_output.addFieldQuoted("text", ref->targetTitle()); +} + +void PerlModDocVisitor::visitPost(DocRef *) +{ + closeItem(); +} + +void PerlModDocVisitor::visitPre(DocSecRefItem *) +{ +#if 0 + m_output.add("<tocitem id=\""); m_output.add(ref->file()); m_output.add("_1"); m_output.add(ref->anchor()); m_output.add("\">"); +#endif +} + +void PerlModDocVisitor::visitPost(DocSecRefItem *) +{ +#if 0 + m_output.add("</tocitem>"); +#endif +} + +void PerlModDocVisitor::visitPre(DocSecRefList *) +{ +#if 0 + m_output.add("<toclist>"); +#endif +} + +void PerlModDocVisitor::visitPost(DocSecRefList *) +{ +#if 0 + m_output.add("</toclist>"); +#endif +} + +void PerlModDocVisitor::visitPre(DocLanguage *l) +{ + openItem("language"); + m_output.addFieldQuoted("id", l->id()); +} + +void PerlModDocVisitor::visitPost(DocLanguage *) +{ + closeItem(); +} + +void PerlModDocVisitor::visitPre(DocParamSect *s) +{ + leaveText(); + const char *type = 0; + switch(s->type()) + { + case DocParamSect::Param: type = "params"; break; + case DocParamSect::RetVal: type = "retvals"; break; + case DocParamSect::Exception: type = "exceptions"; break; + default: ASSERT(0); + } + m_output.openSave().openList(type); +} + +void PerlModDocVisitor::visitPost(DocParamSect *) +{ + leaveText(); + QString content; + m_output.closeList().closeSave(content); + m_other += content; +} + +void PerlModDocVisitor::visitPre(DocParamList *pl) +{ + leaveText(); + m_output.openHash() + .openList("parameters"); + QStrListIterator li(pl->parameters()); + const char *s; + for (li.toFirst();(s=li.current());++li) + { + m_output.openHash() + .addFieldQuoted("name", s) + .closeHash(); + } + m_output.closeList() + .openList("doc"); +} + +void PerlModDocVisitor::visitPost(DocParamList *) +{ + leaveText(); + m_output.closeList() + .closeHash(); +} + +void PerlModDocVisitor::visitPre(DocXRefItem *) +{ +#if 0 + m_output.add("<xrefsect id=\""); + m_output.add(x->file()); m_output.add("_1"); m_output.add(x->anchor()); + m_output.add("\">"); + m_output.add("<xreftitle>"); + m_output.addQuoted(x->title()); + m_output.add("</xreftitle>"); + m_output.add("<xrefdescription>"); +#endif +} + +void PerlModDocVisitor::visitPost(DocXRefItem *) +{ +#if 0 + m_output.add("</xrefdescription>"); + m_output.add("</xrefsect>"); +#endif +} + +void PerlModDocVisitor::visitPre(DocInternalRef *ref) +{ + openItem("ref"); + addLink(0,ref->file(),ref->anchor()); +} + +void PerlModDocVisitor::visitPost(DocInternalRef *) +{ + closeItem(); +} + +void PerlModDocVisitor::visitPre(DocCopy *) +{ +} + +void PerlModDocVisitor::visitPost(DocCopy *) +{ +} + +void PerlModDocVisitor::visitPre(DocText *) +{ +} + +void PerlModDocVisitor::visitPost(DocText *) +{ +} + +static void addTemplateArgumentList(ArgumentList *al, + PerlModOutput &output,const char * /*name*/) +{ + QCString indentStr; + if (!al) + return; + output.openList("template_parameters"); + ArgumentListIterator ali(*al); + Argument *a; + for (ali.toFirst();(a=ali.current());++ali) + { + output.openHash(); + if (!a->type.isEmpty()) + output.addFieldQuoted("type", a->type); + if (!a->name.isEmpty()) + output.addFieldQuoted("declaration_name", a->name) + .addFieldQuoted("definition_name", a->name); + if (!a->defval.isEmpty()) + output.addFieldQuoted("default", a->defval); + output.closeHash(); + } + output.closeList(); +} + +/* +static void addMemberTemplateLists(MemberDef *md,PerlModOutput &output) +{ + ClassDef *cd = md->getClassDef(); + const char *cname = cd ? cd->name().data() : 0; + if (md->templateArguments()) // function template prefix + addTemplateArgumentList(md->templateArguments(),output,cname); +} +*/ + +static void addTemplateList(ClassDef *cd,PerlModOutput &output) +{ + addTemplateArgumentList(cd->templateArguments(),output,cd->name()); +} + +static void addPerlModDocBlock(PerlModOutput &output, + const char *name, + const QCString &fileName, + int lineNr, + const QCString &scope, + MemberDef *md, + const QCString &text) +{ + QCString stext = text.stripWhiteSpace(); + if (stext.isEmpty()) + { + output.addField(name).add("{},\n"); + } + else + { + DocNode *root = validatingParseDoc(fileName,lineNr,scope,md,stext,FALSE); + output.openHash(name); + PerlModDocVisitor *visitor = new PerlModDocVisitor(output); + root->accept(visitor); + visitor->finish(); + output.closeHash(); + delete visitor; + delete root; + } +} + +static const char *getProtectionName(Protection prot) +{ + switch (prot) + { + case Public: return "public"; + case Protected: return "protected"; + case Private: return "private"; + } + return 0; +} + +static const char *getVirtualnessName(Specifier virt) +{ + switch(virt) + { + case Normal: return "non_virtual"; + case Virtual: return "virtual"; + case Pure: return "pure_virtual"; + } + return 0; +} + +static void generatePerlForMember(MemberDef *md,PerlModOutput &output,Definition *) +{ + + // + declaration/definition arg lists + // + reimplements + // + reimplementedBy + // + exceptions + // + const/volatile specifiers + // - examples + // - source definition + // - source references + // - source referenced by + // - body code + // - template arguments + // (templateArguments(), definitionTemplateParameterLists()) + + QCString memType; + bool isFunc=FALSE; + switch (md->memberType()) + { + case MemberDef::Define: memType="define"; break; + case MemberDef::EnumValue: ASSERT(0); break; + case MemberDef::Property: memType="property"; break; + case MemberDef::Variable: memType="variable"; break; + case MemberDef::Typedef: memType="typedef"; break; + case MemberDef::Enumeration: memType="enum"; break; + case MemberDef::Function: memType="function"; isFunc=TRUE; break; + case MemberDef::Signal: memType="signal"; isFunc=TRUE; break; + case MemberDef::Prototype: memType="prototype"; isFunc=TRUE; break; + case MemberDef::Friend: memType="friend"; isFunc=TRUE; break; + case MemberDef::DCOP: memType="dcop"; isFunc=TRUE; break; + case MemberDef::Slot: memType="slot"; isFunc=TRUE; break; + } + + QCString scopeName; + if (md->getClassDef()) + scopeName=md->getClassDef()->name(); + else if (md->getNamespaceDef()) + scopeName=md->getNamespaceDef()->name(); + + output.openHash() + .addFieldQuoted("kind", memType) + .addFieldQuoted("name", md->name()) + .addFieldQuoted("virtualness", getVirtualnessName(md->virtualness())) + .addFieldQuoted("protection", getProtectionName(md->protection())); + + addPerlModDocBlock(output,"brief",md->getDefFileName(),md->getDefLine(),scopeName,md,md->briefDescription()); + addPerlModDocBlock(output,"detailed",md->getDefFileName(),md->getDefLine(),scopeName,md,md->documentation()); + if (md->memberType()!=MemberDef::Define && + md->memberType()!=MemberDef::Enumeration) + output.addFieldQuoted("type", md->typeString()); + + if (isFunc) //function + { + ArgumentList *al = md->argumentList(); + output.addFieldQuoted("const", (al && al->constSpecifier) ? "yes" : "no") + .addFieldQuoted("volatile", (al && al->volatileSpecifier) ? "yes" : "no"); + + output.openList("parameters"); + ArgumentList *declAl = md->declArgumentList(); + ArgumentList *defAl = md->argumentList(); + if (declAl && declAl->count()>0) + { + ArgumentListIterator declAli(*declAl); + ArgumentListIterator defAli(*defAl); + Argument *a; + for (declAli.toFirst();(a=declAli.current());++declAli) + { + Argument *defArg = defAli.current(); + output.openHash(); + + if (!a->name.isEmpty()) + output.addFieldQuoted("declaration_name", a->name); + + if (defArg && !defArg->name.isEmpty() && defArg->name!=a->name) + output.addFieldQuoted("definition_name", defArg->name); + + if (!a->type.isEmpty()) + output.addFieldQuoted("type", a->type); + + if (!a->array.isEmpty()) + output.addFieldQuoted("array", a->array); + + if (!a->defval.isEmpty()) + output.addFieldQuoted("default_value", a->defval); + + if (!a->attrib.isEmpty()) + output.addFieldQuoted("attributes", a->attrib); + + output.closeHash(); + if (defArg) ++defAli; + } + } + output.closeList(); + } + else if (md->memberType()==MemberDef::Define && + md->argsString()!=0) // define + { + output.openList("parameters"); + ArgumentListIterator ali(*md->argumentList()); + Argument *a; + for (ali.toFirst();(a=ali.current());++ali) + { + output.openHash() + .addFieldQuoted("name", a->type) + .closeHash(); + } + output.closeList(); + } + if (!md->initializer().isEmpty()) + output.addFieldQuoted("initializer", md->initializer()); + + if (md->excpString()) + output.addFieldQuoted("exceptions", md->excpString()); + + if (md->memberType()==MemberDef::Enumeration) // enum + { + if (md->enumFieldList()) + { + output.openList("values"); + MemberListIterator emli(*md->enumFieldList()); + MemberDef *emd; + for (emli.toFirst();(emd=emli.current());++emli) + { + output.openHash() + .addFieldQuoted("name", emd->name()); + + if (!emd->initializer().isEmpty()) + output.addFieldQuoted("initializer", emd->initializer()); + + addPerlModDocBlock(output,"brief",emd->getDefFileName(),emd->getDefLine(),scopeName,emd,emd->briefDescription()); + + addPerlModDocBlock(output,"detailed",emd->getDefFileName(),emd->getDefLine(),scopeName,emd,emd->documentation()); + + output.closeHash(); + } + output.closeList(); + } + } + + MemberDef *rmd = md->reimplements(); + if (rmd) + output.openHash("reimplements") + .addFieldQuoted("name", rmd->name()) + .closeHash(); + + MemberList *rbml = md->reimplementedBy(); + if (rbml) + { + MemberListIterator mli(*rbml); + output.openList("reimplemented_by"); + for (mli.toFirst();(rmd=mli.current());++mli) + output.openHash() + .addFieldQuoted("name", rmd->name()) + .closeHash(); + output.closeList(); + } + + output.closeHash(); +} + +static void generatePerlSection(Definition *d,PerlModOutput &output, + MemberList *ml,const char *name,const char *header=0) +{ + if (ml->count()==0) return; // empty list + + output.openHash(name); + + if (header) + output.addFieldQuoted("header", header); + + output.openList("members"); + MemberListIterator mli(*ml); + MemberDef *md; + for (mli.toFirst();(md=mli.current());++mli) + { + generatePerlForMember(md,output,d); + } + output.closeList() + .closeHash(); +} + +static void addListOfAllMembers(ClassDef *cd, PerlModOutput &output) +{ + output.openList("all_members"); + MemberNameInfoSDict::Iterator mnii(*cd->memberNameInfoSDict()); + MemberNameInfo *mni; + for (mnii.toFirst();(mni=mnii.current());++mnii) + { + MemberNameInfoIterator mii(*mni); + MemberInfo *mi; + for (mii.toFirst();(mi=mii.current());++mii) + { + MemberDef *md=mi->memberDef; + ClassDef *cd=md->getClassDef(); + Definition *d=md->getGroupDef(); + if (d==0) d = cd; + + output.openHash() + .addFieldQuoted("name", md->name()) + .addFieldQuoted("virtualness", getVirtualnessName(md->virtualness())) + .addFieldQuoted("protection", getProtectionName(mi->prot)); + + if (!mi->ambiguityResolutionScope.isEmpty()) + output.addFieldQuoted("ambiguity_scope", mi->ambiguityResolutionScope); + + output.addFieldQuoted("scope", cd->name()) + .closeHash(); + } + } + output.closeList(); +} + +static void generatePerlForClass(ClassDef *cd, PerlModOutput &output) +{ + // + brief description + // + detailed description + // + template argument list(s) + // - include file + // + member groups + // + inheritance diagram + // + list of direct super classes + // + list of direct sub classes + // + list of inner classes + // + collaboration diagram + // + list of all members + // + user defined member sections + // + standard member sections + // + detailed member documentation + // - examples using the class + + if (cd->isReference()) return; // skip external references. + if (cd->name().find('@')!=-1) return; // skip anonymous compounds. + if (cd->templateMaster()!=0) return; // skip generated template instances. + + output.openHash() + .addFieldQuoted("name", cd->name()); + + if (cd->baseClasses()->count()>0) + { + output.openList("base"); + BaseClassListIterator bcli(*cd->baseClasses()); + BaseClassDef *bcd; + for (bcli.toFirst();(bcd=bcli.current());++bcli) + output.openHash() + .addFieldQuoted("name", bcd->classDef->displayName()) + .addFieldQuoted("virtualness", getVirtualnessName(bcd->virt)) + .addFieldQuoted("protection", getProtectionName(bcd->prot)) + .closeHash(); + output.closeList(); + } + + if (cd->subClasses()->count()>0) + { + output.openList("derived"); + BaseClassListIterator bcli(*cd->baseClasses()); + BaseClassDef *bcd; + for (bcli.toFirst();(bcd=bcli.current());++bcli) + output.openHash() + .addFieldQuoted("name", bcd->classDef->displayName()) + .addFieldQuoted("virtualness", getVirtualnessName(bcd->virt)) + .addFieldQuoted("protection", getProtectionName(bcd->prot)) + .closeHash(); + output.closeList(); + } + + ClassSDict *cl = cd->getInnerClasses(); + if (cl) + { + output.openList("inner"); + ClassSDict::Iterator cli(*cl); + ClassDef *cd; + for (cli.toFirst();(cd=cli.current());++cli) + output.openHash() + .addFieldQuoted("name", cd->name()) + .closeHash(); + output.closeList(); + } + + IncludeInfo *ii=cd->includeInfo(); + if (ii) + { + QCString nm = ii->includeName; + if (nm.isEmpty() && ii->fileDef) nm = ii->fileDef->docName(); + if (!nm.isEmpty()) + { + output.openHash("includes"); +#if 0 + if (ii->fileDef && !ii->fileDef->isReference()) // TODO: support external references + t << " id=\"" << ii->fileDef->getOutputFileBase() << "\""; +#endif + output.addFieldQuoted("local", ii->local ? "yes" : "no") + .addFieldQuoted("name", nm) + .closeHash(); + } + } + + addTemplateList(cd,output); + addListOfAllMembers(cd,output); + MemberGroupSDict::Iterator mgli(*cd->memberGroupSDict); + MemberGroup *mg; + for (;(mg=mgli.current());++mgli) + generatePerlSection(cd,output,mg->members(),"user_defined",mg->header()); + + generatePerlSection(cd,output,&cd->pubTypes,"public_typedefs"); + generatePerlSection(cd,output,&cd->pubMethods,"public_methods"); + generatePerlSection(cd,output,&cd->pubAttribs,"public_members"); + generatePerlSection(cd,output,&cd->pubSlots,"public_slots"); + generatePerlSection(cd,output,&cd->signals,"signals"); + generatePerlSection(cd,output,&cd->dcopMethods,"dcop_methods"); + generatePerlSection(cd,output,&cd->properties,"properties"); + generatePerlSection(cd,output,&cd->pubStaticMethods,"public_static_methods"); + generatePerlSection(cd,output,&cd->pubStaticAttribs,"public_static_members"); + generatePerlSection(cd,output,&cd->proTypes,"protected_typedefs"); + generatePerlSection(cd,output,&cd->proMethods,"protected_methods"); + generatePerlSection(cd,output,&cd->proAttribs,"protected_members"); + generatePerlSection(cd,output,&cd->proSlots,"protected_slots"); + generatePerlSection(cd,output,&cd->proStaticMethods,"protected_static_methods"); + generatePerlSection(cd,output,&cd->proStaticAttribs,"protected_static_members"); + generatePerlSection(cd,output,&cd->priTypes,"private_typedefs"); + generatePerlSection(cd,output,&cd->priMethods,"private_methods"); + generatePerlSection(cd,output,&cd->priAttribs,"private_members"); + generatePerlSection(cd,output,&cd->priSlots,"private_slots"); + generatePerlSection(cd,output,&cd->priStaticMethods,"private_static_methods"); + generatePerlSection(cd,output,&cd->priStaticAttribs,"private_static_members"); + generatePerlSection(cd,output,&cd->friends,"friend_methods"); + generatePerlSection(cd,output,&cd->related,"related_methods"); + + addPerlModDocBlock(output,"brief",cd->getDefFileName(),cd->getDefLine(),cd->name(),0,cd->briefDescription()); + addPerlModDocBlock(output,"detailed",cd->getDefFileName(),cd->getDefLine(),cd->name(),0,cd->documentation()); + +#if 0 + DotClassGraph inheritanceGraph(cd,DotClassGraph::Inheritance); + if (!inheritanceGraph.isTrivial()) + { + t << " <inheritancegraph>" << endl; + inheritanceGraph.writePerl(t); + t << " </inheritancegraph>" << endl; + } + DotClassGraph collaborationGraph(cd,DotClassGraph::Implementation); + if (!collaborationGraph.isTrivial()) + { + t << " <collaborationgraph>" << endl; + collaborationGraph.writePerl(t); + t << " </collaborationgraph>" << endl; + } + t << " <location file=\"" + << cd->getDefFileName() << "\" line=\"" + << cd->getDefLine() << "\""; + if (cd->getStartBodyLine()!=-1) + { + t << " bodystart=\"" << cd->getStartBodyLine() << "\" bodyend=\"" + << cd->getEndBodyLine() << "\""; + } + t << "/>" << endl; +#endif + + output.closeHash(); +} + +static void generatePerlForNamespace(NamespaceDef *nd, PerlModOutput &output) +{ + // + contained class definitions + // + contained namespace definitions + // + member groups + // + normal members + // + brief desc + // + detailed desc + // + location + // - files containing (parts of) the namespace definition + + if (nd->isReference()) return; // skip external references + + output.openHash() + .addFieldQuoted("name", nd->name()); + + ClassSDict *cl = nd->classSDict; + if (cl) + { + output.openList("classes"); + ClassSDict::Iterator cli(*cl); + ClassDef *cd; + for (cli.toFirst();(cd=cli.current());++cli) + output.openHash() + .addFieldQuoted("name", cd->name()) + .closeHash(); + output.closeList(); + } + + NamespaceSDict *nl = nd->namespaceSDict; + if (nl) + { + output.openList("namespaces"); + NamespaceSDict::Iterator nli(*nl); + NamespaceDef *nd; + for (nli.toFirst();(nd=nli.current());++nli) + output.openHash() + .addFieldQuoted("name", nd->name()) + .closeHash(); + output.closeList(); + } + + MemberGroupSDict::Iterator mgli(*nd->memberGroupSDict); + MemberGroup *mg; + for (;(mg=mgli.current());++mgli) + generatePerlSection(nd,output,mg->members(),"user-defined",mg->header()); + + generatePerlSection(nd,output,&nd->decDefineMembers,"defines"); + generatePerlSection(nd,output,&nd->decProtoMembers,"prototypes"); + generatePerlSection(nd,output,&nd->decTypedefMembers,"typedefs"); + generatePerlSection(nd,output,&nd->decEnumMembers,"enums"); + generatePerlSection(nd,output,&nd->decFuncMembers,"functions"); + generatePerlSection(nd,output,&nd->decVarMembers,"variables"); + + addPerlModDocBlock(output,"brief",nd->getDefFileName(),nd->getDefLine(),0,0,nd->briefDescription()); + addPerlModDocBlock(output,"detailed",nd->getDefFileName(),nd->getDefLine(),0,0,nd->documentation()); + + output.closeHash(); +} + +static void generatePerlForFile(FileDef *fd, PerlModOutput &output) +{ + // + includes files + // + includedby files + // - include graph + // - included by graph + // - contained class definitions + // - contained namespace definitions + // - member groups + // + normal members + // + brief desc + // + detailed desc + // - source code + // - location + // - number of lines + + if (fd->isReference()) return; + + output.openHash() + .addFieldQuoted("name", fd->name()); + + QListIterator<IncludeInfo> ili1(*fd->includeFileList()); + IncludeInfo *inc; + output.openList("includes"); + for (ili1.toFirst();(inc=ili1.current());++ili1) + { + output.openHash() + .addFieldQuoted("name", inc->includeName); + if (inc->fileDef && !inc->fileDef->isReference()) + { + output.addFieldQuoted("ref", inc->fileDef->getOutputFileBase()); + } + output.closeHash(); + } + output.closeList(); + + QListIterator<IncludeInfo> ili2(*fd->includedByFileList()); + output.openList("included_by"); + for (ili2.toFirst();(inc=ili2.current());++ili2) + { + output.openHash() + .addFieldQuoted("name => ", inc->includeName); + if (inc->fileDef && !inc->fileDef->isReference()) + { + output.addFieldQuoted("ref", inc->fileDef->getOutputFileBase()); + } + output.closeHash(); + } + output.closeList(); + + generatePerlSection(fd,output,&fd->decDefineMembers,"defines"); + generatePerlSection(fd,output,&fd->decProtoMembers,"prototypes"); + generatePerlSection(fd,output,&fd->decTypedefMembers,"typedefs"); + generatePerlSection(fd,output,&fd->decEnumMembers,"enums"); + generatePerlSection(fd,output,&fd->decFuncMembers,"functions"); + generatePerlSection(fd,output,&fd->decVarMembers,"variables"); + + addPerlModDocBlock(output,"brief",fd->getDefFileName(),fd->getDefLine(),0,0,fd->briefDescription()); + addPerlModDocBlock(output,"detailed",fd->getDefFileName(),fd->getDefLine(),0,0,fd->documentation()); + + output.closeHash(); +} + +static void generatePerlForGroup(GroupDef *gd, PerlModOutput &output) +{ + // + members + // + member groups + // + files + // + classes + // + namespaces + // - packages + // + pages + // + child groups + // - examples + // + brief description + // + detailed description + + if (gd->isReference()) return; // skip external references + + output.openHash() + .addFieldQuoted("name", gd->name()) + .addFieldQuoted("title", gd->groupTitle()); + + FileList *fl = gd->getFiles(); + if (fl) + { + output.openList("files"); + QListIterator<FileDef> fli(*fl); + FileDef *fd = fl->first(); + for (fli.toFirst();(fd=fli.current());++fli) + output.openHash() + .addFieldQuoted("name", fd->name()) + .closeHash(); + output.closeList(); + } + + ClassSDict *cl = gd->getClasses(); + if (cl) + { + output.openList("classes"); + ClassSDict::Iterator cli(*cl); + ClassDef *cd; + for (cli.toFirst();(cd=cli.current());++cli) + output.openHash() + .addFieldQuoted("name", cd->name()) + .closeHash(); + output.closeList(); + } + + NamespaceList *nl = gd->getNamespaces(); + if (nl) + { + output.openList("namespaces"); + NamespaceListIterator nli(*nl); + NamespaceDef *nd; + for (nli.toFirst();(nd=nli.current());++nli) + output.openHash() + .addFieldQuoted("name", nd->name()) + .closeHash(); + output.closeList(); + } + + PageSDict *pl = gd->getPages(); + if (pl) + { + output.openList("pages"); + PageSDict::Iterator pli(*pl); + PageInfo *pi; + for (pli.toFirst();(pi=pli.current());++pli) + output.openHash() + .addFieldQuoted("title", pi->title) + .closeHash(); + output.closeList(); + } + + GroupList *gl = gd->getSubGroups(); + if (gl) + { + output.openList("groups"); + GroupListIterator gli(*gl); + GroupDef *sgd; + for (gli.toFirst();(sgd=gli.current());++gli) + output.openHash() + .addFieldQuoted("title", gd->groupTitle()) + .closeHash(); + output.closeList(); + } + + MemberGroupSDict::Iterator mgli(*gd->memberGroupSDict); + MemberGroup *mg; + for (;(mg=mgli.current());++mgli) + generatePerlSection(gd,output,mg->members(),"user-defined",mg->header()); + + generatePerlSection(gd,output,&gd->decDefineMembers,"defines"); + generatePerlSection(gd,output,&gd->decProtoMembers,"prototypes"); + generatePerlSection(gd,output,&gd->decTypedefMembers,"typedefs"); + generatePerlSection(gd,output,&gd->decEnumMembers,"enums"); + generatePerlSection(gd,output,&gd->decFuncMembers,"functions"); + generatePerlSection(gd,output,&gd->decVarMembers,"variables"); + + addPerlModDocBlock(output,"brief",gd->getDefFileName(),gd->getDefLine(),0,0,gd->briefDescription()); + addPerlModDocBlock(output,"detailed",gd->getDefFileName(),gd->getDefLine(),0,0,gd->documentation()); + + output.closeHash(); +} + +static void generatePerlForPage(PageInfo *pi, PerlModOutput &output) +{ + // + name + // + title + // + documentation + + if (pi->isReference()) return; + + output.openHash() + .addFieldQuoted("name", pi->name); + + SectionInfo *si = Doxygen::sectionDict.find(pi->name); + if (si) + output.addFieldQuoted("title", si->title); + + addPerlModDocBlock(output,"detailed",pi->defFileName,pi->defLine,0,0,pi->doc); +} + +void generatePerlMod() +{ + // + classes + // + namespaces + // + files + // - packages + // + groups + // + related pages + // - examples + + QCString outputDirectory = Config_getString("OUTPUT_DIRECTORY"); + if (outputDirectory.isEmpty()) + { + outputDirectory=QDir::currentDirPath(); + } + else + { + QDir dir(outputDirectory); + if (!dir.exists()) + { + dir.setPath(QDir::currentDirPath()); + if (!dir.mkdir(outputDirectory)) + { + err("Error: tag OUTPUT_DIRECTORY: Output directory `%s' does not " + "exist and cannot be created\n",outputDirectory.data()); + exit(1); + } + else if (!Config_getBool("QUIET")) + { + err("Notice: Output directory `%s' does not exist. " + "I have created it for you.\n", outputDirectory.data()); + } + dir.cd(outputDirectory); + } + outputDirectory=dir.absPath(); + } + + QDir dir(outputDirectory); + if (!dir.exists()) + { + dir.setPath(QDir::currentDirPath()); + if (!dir.mkdir(outputDirectory)) + { + err("Cannot create directory %s\n",outputDirectory.data()); + return; + } + } + + QCString fileName=outputDirectory+"/DoxyDocs.pm"; + QFile f(fileName); + if (!f.open(IO_WriteOnly)) + { + err("Cannot open file %s for writing!\n",fileName.data()); + return; + } + + QTextStream t(&f); + PerlModOutputStream os(&t); + PerlModOutput output(&os); + output.add("$doxydocs =\n").openHash(); + + output.openList("classes"); + ClassSDict::Iterator cli(Doxygen::classSDict); + ClassDef *cd; + for (cli.toFirst();(cd=cli.current());++cli) + generatePerlForClass(cd,output); + output.closeList(); + + output.openList("namespaces"); + NamespaceSDict::Iterator nli(Doxygen::namespaceSDict); + NamespaceDef *nd; + for (nli.toFirst();(nd=nli.current());++nli) + generatePerlForNamespace(nd,output); + output.closeList(); + + output.openList("files"); + FileNameListIterator fnli(Doxygen::inputNameList); + FileName *fn; + for (;(fn=fnli.current());++fnli) + { + FileNameIterator fni(*fn); + FileDef *fd; + for (;(fd=fni.current());++fni) + generatePerlForFile(fd,output); + } + output.closeList(); + + output.openList("groups"); + GroupSDict::Iterator gli(Doxygen::groupSDict); + GroupDef *gd; + for (;(gd=gli.current());++gli) + generatePerlForGroup(gd,output); + output.closeList(); + + output.openList("pages"); + PageSDict::Iterator pdi(*Doxygen::pageSDict); + PageInfo *pi=0; + for (pdi.toFirst();(pi=pdi.current());++pdi) + generatePerlForPage(pi,output); + if (Doxygen::mainPage) + generatePerlForPage(Doxygen::mainPage,output); + output.closeList(); + + output.closeHash().add(";\n1;\n"); +} + +// Local Variables: +// c-basic-offset: 2 +// End: diff --git a/src/perlmodgen.h b/src/perlmodgen.h new file mode 100644 index 0000000..a60042b --- /dev/null +++ b/src/perlmodgen.h @@ -0,0 +1,20 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 1997-2002 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 PERLMODGEN_H +#define PERLMODGEN_H + +void generatePerlMod(); + +#endif diff --git a/src/printdocvisitor.h b/src/printdocvisitor.h index 55a55ad..7d7c102 100644 --- a/src/printdocvisitor.h +++ b/src/printdocvisitor.h @@ -592,6 +592,16 @@ class PrintDocVisitor : public DocVisitor indent_post(); printf("</copy>\n"); } + void visitPre(DocText *) + { + indent_pre(); + printf("<text>\n"); + } + void visitPost(DocText *) + { + indent_post(); + printf("</text>\n"); + } private: // helper functions diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index d9b16a4..a072318 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -271,7 +271,7 @@ void RTFDocVisitor::visit(DocVerbatim *s) m_t << "{" << endl; m_t << "\\par" << endl; m_t << rtf_Style_Reset << getStyle("CodeExample"); - parseCode(m_ci,s->context(),s->text().latin1(),FALSE,0); + parseCode(m_ci,s->context(),s->text().latin1(),s->isExample(),s->exampleFile()); m_t << "\\par" << endl; m_t << "}" << endl; break; @@ -321,7 +321,7 @@ void RTFDocVisitor::visit(DocInclude *inc) m_t << "{" << endl; m_t << "\\par" << endl; m_t << rtf_Style_Reset << getStyle("CodeExample"); - parseCode(m_ci,inc->context(),inc->text().latin1(),FALSE,0); + parseCode(m_ci,inc->context(),inc->text().latin1(),inc->isExample(),inc->exampleFile()); m_t << "\\par" << endl; m_t << "}" << endl; break; @@ -353,7 +353,7 @@ void RTFDocVisitor::visit(DocIncOperator *op) } if (op->type()!=DocIncOperator::Skip) { - parseCode(m_ci,op->context(),op->text().latin1(),FALSE,0); + parseCode(m_ci,op->context(),op->text().latin1(),op->isExample(),op->exampleFile()); } if (op->isLast()) { @@ -989,6 +989,14 @@ void RTFDocVisitor::visitPost(DocCopy *) { } +void RTFDocVisitor::visitPre(DocText *) +{ +} + +void RTFDocVisitor::visitPost(DocText *) +{ +} + static char* getMultiByte(int c) { static char s[10]; diff --git a/src/rtfdocvisitor.h b/src/rtfdocvisitor.h index f0b2b20..119eff9 100644 --- a/src/rtfdocvisitor.h +++ b/src/rtfdocvisitor.h @@ -122,6 +122,8 @@ class RTFDocVisitor : public DocVisitor void visitPost(DocInternalRef *); void visitPre(DocCopy *); void visitPost(DocCopy *); + void visitPre(DocText *); + void visitPost(DocText *); private: diff --git a/src/scanner.l b/src/scanner.l index 5a5d9c0..59c656c 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -2298,6 +2298,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) BEGIN( ReadFuncArgType ); } <CopyArgCommentLine>[^\\\@\n]+ { fullArgString+=yytext; } +<CopyArgCommentLine>. { fullArgString+=*yytext; } <CopyArgComment>\n { fullArgString+=*yytext; yyLineNr++; } <CopyArgComment>. { fullArgString+=*yytext; } <ReadTempArgs>"<" { @@ -3969,6 +3970,8 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) } <ClassDoc,Doc>{B}*{CMD}("brief"|"short") { lastBriefContext=YY_START; + current->briefFile = yyFileName; + current->briefLine = yyLineNr; BEGIN( ClassDocBrief ); } <ClassDoc>{B}*"\\inherit"{B}+ { BEGIN( DocBaseClass ); } @@ -4306,6 +4309,12 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) } } } +<Doc,ClassDoc,PageDoc,ExampleDoc,AfterDoc,CopyArgComment>{CMD}{CMD}[a-z_A-Z][a-z_A-Z0-9]* { /* escaped command */ + if (YY_START==CopyArgComment) + fullArgString+=yytext; + else + current->doc+=yytext; + } <Doc,ClassDoc,PageDoc,ExampleDoc,AfterDoc,CopyArgComment>{CMD}[a-z_A-Z][a-z_A-Z0-9]* { bool handled=FALSE; if ( useOverrideCommands) @@ -4370,6 +4379,12 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) current->brief+=yytext; } <LineDoc,AfterDocLine,CopyArgCommentLine>{CMD}("brief"|"short") {} +<JavaDoc,LineDoc,ClassDocBrief,AfterDocBrief,AfterDocLine,CopyArgCommentLine>{CMD}{CMD}[a-z_A-Z][a-z_A-Z0-9]* { /* escaped command */ + if (YY_START==CopyArgCommentLine) + fullArgString+=yytext; + else + current->brief+=yytext; + } <JavaDoc,LineDoc,ClassDocBrief,AfterDocBrief,AfterDocLine,CopyArgCommentLine>{CMD}[a-z_A-Z][a-z_A-Z0-9]* { QCString *pValue=Doxygen::aliasDict[yytext+1]; if (pValue) diff --git a/src/util.cpp b/src/util.cpp index 979911a..242b566 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -31,7 +31,6 @@ #include "classdef.h" #include "filedef.h" #include "doxygen.h" -#include "doc.h" #include "outputlist.h" #include "defargs.h" #include "language.h" @@ -853,7 +852,7 @@ void writeExample(OutputList &ol,ExampleSDict *ed) while ((newIndex=marker.match(exampleLine,index,&matchLen))!=-1) { bool ok; - parseText(ol,exampleLine.mid(index,newIndex-index)); + ol.parseText(exampleLine.mid(index,newIndex-index)); uint entryIndex = exampleLine.mid(newIndex+1,matchLen-1).toUInt(&ok); Example *e=ed->at(entryIndex); if (ok && e) @@ -879,7 +878,7 @@ void writeExample(OutputList &ol,ExampleSDict *ed) } index=newIndex+matchLen; } - parseText(ol,exampleLine.right(exampleLine.length()-index)); + ol.parseText(exampleLine.right(exampleLine.length()-index)); ol.writeString("."); } @@ -2292,6 +2291,8 @@ bool resolveRef(/* in */ const char *scName, QCString tsName = name; bool memberScopeFirst = tsName.find('#')!=-1; QCString fullName = substitute(tsName,"#","::"); + fullName = substitute(fullName,".","::"); + int scopePos=fullName.findRev("::"); int bracePos=fullName.findRev('('); // reverse is needed for operator()(...) @@ -2309,10 +2310,10 @@ bool resolveRef(/* in */ const char *scName, return FALSE; } - //printf("scName=%s tmpName=%s\n",scName,tmpName.data()); + //printf("scName=%s name=%s\n",scName,fullName.data()); // check if this is a class or namespace reference - if (scName!=fullName && getScopeDefs(scName,name,cd,nd)) + if (scName!=fullName && getScopeDefs(scName,fullName,cd,nd)) { if (cd) // scope matches that of a class { @@ -2425,6 +2426,7 @@ bool generateRef(OutputDocInterface &od,const char *scName, if (linkText.isEmpty()) { linkText=substitute(name,"#","::"); + linkText=substitute(linkText,".","::"); // strip :: prefix if present if (linkText.at(0)==':' && linkText.at(1)==':') { @@ -2550,6 +2552,7 @@ bool generateLink(OutputDocInterface &od,const char *clName, if (linkText.isEmpty()) { linkText=substitute(lr,"#","::"); + linkText=substitute(linkText,".","::"); // strip :: prefix if present if (linkText.at(0)==':' && linkText.at(1)==':') { diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index 43fda0b..e6cbd64 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -148,7 +148,7 @@ void XmlDocVisitor::visit(DocVerbatim *s) { case DocVerbatim::Code: // fall though m_t << "<programlisting>"; - parseCode(m_ci,s->context(),s->text().latin1(),FALSE,0); + parseCode(m_ci,s->context(),s->text().latin1(),s->isExample(),s->exampleFile()); m_t << "</programlisting>"; break; case DocVerbatim::Verbatim: @@ -182,7 +182,7 @@ void XmlDocVisitor::visit(DocInclude *inc) { case DocInclude::Include: m_t << "<programlisting>"; - parseCode(m_ci,inc->context(),inc->text().latin1(),FALSE,0); + parseCode(m_ci,inc->context(),inc->text().latin1(),inc->isExample(),inc->exampleFile()); m_t << "</programlisting>"; break; case DocInclude::DontInclude: @@ -211,7 +211,7 @@ void XmlDocVisitor::visit(DocIncOperator *op) } if (op->type()!=DocIncOperator::Skip) { - parseCode(m_ci,op->context(),op->text().latin1(),FALSE,0); + parseCode(m_ci,op->context(),op->text().latin1(),op->isExample(),op->exampleFile()); } if (op->isLast()) { @@ -302,7 +302,7 @@ void XmlDocVisitor::visitPost(DocRoot *) void XmlDocVisitor::visitPre(DocSimpleSect *s) { - m_t << "<simplesect kind=\">"; + m_t << "<simplesect kind=\""; switch(s->type()) { case DocSimpleSect::See: @@ -701,6 +701,14 @@ void XmlDocVisitor::visitPost(DocCopy *) { } +void XmlDocVisitor::visitPre(DocText *) +{ +} + +void XmlDocVisitor::visitPost(DocText *) +{ +} + void XmlDocVisitor::filter(const char *str) { if (str==0) return; diff --git a/src/xmldocvisitor.h b/src/xmldocvisitor.h index 83db6c3..045f868 100644 --- a/src/xmldocvisitor.h +++ b/src/xmldocvisitor.h @@ -122,6 +122,8 @@ class XmlDocVisitor : public DocVisitor void visitPost(DocInternalRef *); void visitPre(DocCopy *); void visitPost(DocCopy *); + void visitPre(DocText *); + void visitPost(DocText *); private: diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index cabc130..081e671 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -27,7 +27,6 @@ #include "util.h" #include "defargs.h" #include "outputgen.h" -#include "doc.h" #include "dot.h" #include "code.h" #include "page.h" @@ -1201,7 +1200,7 @@ static void writeXMLDocBlock(QTextStream &t, QCString stext = text.stripWhiteSpace(); if (stext.isEmpty()) return; // convert the documentation string into an abstract syntax tree - DocNode *root = validatingParseDoc(fileName,lineNr,scope,md,stext); + DocNode *root = validatingParseDoc(fileName,lineNr,scope,md,stext,FALSE); // create a code generator XMLCodeGenerator *xmlCodeGen = new XMLCodeGenerator(t); // create a parse tree visitor for XML @@ -1739,25 +1738,25 @@ static void generateXMLForClass(ClassDef *cd,QTextStream &ti) } generateXMLSection(cd,ti,t,&cd->pubTypes,"public-type"); - generateXMLSection(cd,ti,t,&cd->pubMembers,"public-func"); + generateXMLSection(cd,ti,t,&cd->pubMethods,"public-func"); generateXMLSection(cd,ti,t,&cd->pubAttribs,"public-attrib"); generateXMLSection(cd,ti,t,&cd->pubSlots,"public-slot"); generateXMLSection(cd,ti,t,&cd->signals,"signal"); generateXMLSection(cd,ti,t,&cd->dcopMethods,"dcop-func"); generateXMLSection(cd,ti,t,&cd->properties,"property"); - generateXMLSection(cd,ti,t,&cd->pubStaticMembers,"public-static-func"); + generateXMLSection(cd,ti,t,&cd->pubStaticMethods,"public-static-func"); generateXMLSection(cd,ti,t,&cd->pubStaticAttribs,"public-static-attrib"); generateXMLSection(cd,ti,t,&cd->proTypes,"protected-type"); - generateXMLSection(cd,ti,t,&cd->proMembers,"protected-func"); + generateXMLSection(cd,ti,t,&cd->proMethods,"protected-func"); generateXMLSection(cd,ti,t,&cd->proAttribs,"protected-attrib"); generateXMLSection(cd,ti,t,&cd->proSlots,"protected-slot"); - generateXMLSection(cd,ti,t,&cd->proStaticMembers,"protected-static-func"); + generateXMLSection(cd,ti,t,&cd->proStaticMethods,"protected-static-func"); generateXMLSection(cd,ti,t,&cd->proStaticAttribs,"protected-static-attrib"); generateXMLSection(cd,ti,t,&cd->priTypes,"private-type"); - generateXMLSection(cd,ti,t,&cd->priMembers,"private-func"); + generateXMLSection(cd,ti,t,&cd->priMethods,"private-func"); generateXMLSection(cd,ti,t,&cd->priAttribs,"private-attrib"); generateXMLSection(cd,ti,t,&cd->priSlots,"private-slot"); - generateXMLSection(cd,ti,t,&cd->priStaticMembers,"private-static-func"); + generateXMLSection(cd,ti,t,&cd->priStaticMethods,"private-static-func"); generateXMLSection(cd,ti,t,&cd->priStaticAttribs,"private-static-attrib"); generateXMLSection(cd,ti,t,&cd->friends,"friend"); generateXMLSection(cd,ti,t,&cd->related,"related"); |