diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2000-05-28 19:46:08 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2000-05-28 19:46:08 (GMT) |
commit | 832e08dcc70203d84f75249583a95fa172492aa2 (patch) | |
tree | 1f7723f69aa2917d2408894c68e7150f7b7ff3d5 /src | |
parent | f38608d4bec002a5051c860a599dd4d5229a9671 (diff) | |
download | Doxygen-832e08dcc70203d84f75249583a95fa172492aa2.zip Doxygen-832e08dcc70203d84f75249583a95fa172492aa2.tar.gz Doxygen-832e08dcc70203d84f75249583a95fa172492aa2.tar.bz2 |
Release-1.1.3-20000528
Diffstat (limited to 'src')
-rw-r--r-- | src/classdef.cpp | 4 | ||||
-rw-r--r-- | src/code.l | 4 | ||||
-rw-r--r-- | src/config.l | 17 | ||||
-rw-r--r-- | src/dot.cpp | 254 | ||||
-rw-r--r-- | src/dot.h | 26 | ||||
-rw-r--r-- | src/doxygen.cpp | 181 | ||||
-rw-r--r-- | src/entry.h | 3 | ||||
-rw-r--r-- | src/filedef.cpp | 25 | ||||
-rw-r--r-- | src/filedef.h | 7 | ||||
-rw-r--r-- | src/filename.cpp | 2 | ||||
-rw-r--r-- | src/groupdef.cpp | 2 | ||||
-rw-r--r-- | src/htmlgen.cpp | 17 | ||||
-rw-r--r-- | src/htmlgen.h | 6 | ||||
-rw-r--r-- | src/latexgen.cpp | 40 | ||||
-rw-r--r-- | src/latexgen.h | 10 | ||||
-rw-r--r-- | src/mangen.h | 2 | ||||
-rw-r--r-- | src/memberdef.cpp | 2 | ||||
-rw-r--r-- | src/message.cpp | 23 | ||||
-rw-r--r-- | src/namespacedef.cpp | 23 | ||||
-rw-r--r-- | src/namespacedef.h | 9 | ||||
-rw-r--r-- | src/outputgen.h | 2 | ||||
-rw-r--r-- | src/outputlist.h | 4 | ||||
-rw-r--r-- | src/pre.l | 3 | ||||
-rw-r--r-- | src/rtfgen.cpp | 28 | ||||
-rw-r--r-- | src/rtfgen.h | 2 | ||||
-rw-r--r-- | src/scanner.l | 88 | ||||
-rw-r--r-- | src/translator.h | 12 | ||||
-rw-r--r-- | src/util.cpp | 10 |
28 files changed, 602 insertions, 204 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp index eeae69e..7d35be4 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -710,7 +710,6 @@ void ClassDef::writeDocumentation(OutputList &ol) if (!inheritanceGraph.isTrivial()) { ol.pushGeneratorState(); - ol.disable(OutputGenerator::Latex); ol.disable(OutputGenerator::Man); ol.startDotGraph(); parseText(ol,theTranslator->trClassDiagram(name())); @@ -735,7 +734,6 @@ void ClassDef::writeDocumentation(OutputList &ol) if (!usageImplGraph.isTrivial()) { ol.pushGeneratorState(); - ol.disable(OutputGenerator::Latex); ol.disable(OutputGenerator::Man); ol.startDotGraph(); parseText(ol,theTranslator->trCollaborationDiagram(name())); @@ -822,7 +820,7 @@ void ClassDef::writeDocumentation(OutputList &ol) ol.pushGeneratorState(); ol.disable(OutputGenerator::Latex); ol.disable(OutputGenerator::RTF); - ol.writeAnchor("_details"); + ol.writeAnchor(0,"_details"); ol.popGeneratorState(); ol.startGroupHeader(); parseText(ol,theTranslator->trDetailedDescription()); @@ -304,7 +304,7 @@ static void generateClassLink(OutputList &ol,char *clName,int *clNameLen=0) //if (latexOn) ol.disable(OutputGenerator::Latex); ol.disable(OutputGenerator::Latex); ol.disable(OutputGenerator::RTF); - ol.writeAnchor(anchor); + ol.writeAnchor(0,anchor); //if (latexOn) ol.enable(OutputGenerator::Latex); ol.popGeneratorState(); g_anchorCount++; @@ -347,7 +347,7 @@ static bool getLink(const char *className, result.pushGeneratorState(); //if (latexEnabled) result.disable(OutputGenerator::Latex); result.disable(OutputGenerator::Latex); - result.writeAnchor(anchor); + result.writeAnchor(0,anchor); result.popGeneratorState(); //if (latexEnabled) result.enable(OutputGenerator::Latex); g_anchorCount++; diff --git a/src/config.l b/src/config.l index 4e13bf0..4a3804d 100644 --- a/src/config.l +++ b/src/config.l @@ -47,6 +47,9 @@ void warn_cont(const char *fmt, ...) vfprintf(stderr, fmt, args); va_end(args); } +void initWarningFormat() +{ +} #else #include "doxygen.h" #include "message.h" @@ -1842,7 +1845,7 @@ void configStrToVal() static void substEnvVarsInString(QCString &s) { - QRegExp re("\\$([a-z_A-Z0-9]+)"); + static QRegExp re("\\$\\([a-z_A-Z0-9]+\\)"); int p=0; int i,l; //printf("substEnvVarInString(%s) start\n",s.data()); @@ -2206,19 +2209,19 @@ void checkConfig() } // add default pattern if needed - if (Config::filePatternList.count()==0) + if (Config::filePatternList.isEmpty()) { - Config::filePatternList.append("*"); + Config::filePatternList="*"; } // add default pattern if needed - if (Config::examplePatternList.count()==0) + if (Config::examplePatternList.isEmpty()) { - Config::examplePatternList.append("*"); + Config::examplePatternList="*"; } // add default pattern if needed - //if (Config::imagePatternList.count()==0) + //if (Config::imagePatternList.isEmpty()) //{ // Config::imagePatternList.append("*"); //} @@ -2247,7 +2250,7 @@ void checkConfig() // check documentation URL if (Config::docURL.isEmpty()) { - Config::docURL = Config::outputDir.copy().prepend("file://").append("html"); + Config::docURL = Config::outputDir.copy().prepend("file://")+"html"; } else if (Config::docURL.left(7)!="http://" && Config::docURL.left(7)!="file://") { diff --git a/src/dot.cpp b/src/dot.cpp index 8587866..83ac1b8 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -101,7 +101,7 @@ static bool convertMapFile(QTextStream &t,const char *mapName) return TRUE; } -static bool readBoundingBox(const char *fileName,int *width,int *height) +static bool readBoundingBoxDot(const char *fileName,int *width,int *height) { QFile f(fileName); if (!f.open(IO_ReadOnly)) return FALSE; @@ -113,13 +113,34 @@ static bool readBoundingBox(const char *fileName,int *width,int *height) buf[numBytes-1]='\0'; if (strncmp(buf,"\tgraph [bb",10)==0) { - int x,y,w,h; - if (sscanf(buf,"\tgraph [bb= \"%d,%d,%d,%d\"];",&x,&y,&w,&h)!=4) + int x,y; + if (sscanf(buf,"\tgraph [bb= \"%d,%d,%d,%d\"];",&x,&y,width,height)!=4) + { + return FALSE; + } + return TRUE; + } + } + return FALSE; +} + +static bool readBoundingBoxEPS(const char *fileName,int *width,int *height) +{ + QFile f(fileName); + if (!f.open(IO_ReadOnly)) return FALSE; + const int maxLineLen=1024; + char buf[maxLineLen]; + while (!f.atEnd()) + { + int numBytes = f.readLine(buf,maxLineLen); + buf[numBytes-1]='\0'; + if (strncmp(buf,"%%BoundingBox: ",15)==0) + { + int x,y; + if (sscanf(buf,"%%%%BoundingBox: %d %d %d %d",&x,&y,width,height)!=4) { return FALSE; } - *width = w*96/72; // 96 pixels/inch, 72 points/inch - *height = h*96/72; // 96 pixels/inch, 72 points/inch return TRUE; } } @@ -290,7 +311,9 @@ static QCString convertLabel(const QCString &l) return result; } -void DotNode::writeBox(QTextStream &t,bool hasNonReachableChildren) +void DotNode::writeBox(QTextStream &t, + GraphOutputFormat format, + bool hasNonReachableChildren) { const char *labCol = m_url.isEmpty() ? "grey" : // non link @@ -299,7 +322,8 @@ void DotNode::writeBox(QTextStream &t,bool hasNonReachableChildren) ); t << " Node" << m_number << " [shape=\"box\",label=\"" << convertLabel(m_label) - << "\",fontsize=10,height=0.2,width=0.4,fontname=\"doxfont\""; + << "\",fontsize=10,height=0.2,width=0.4"; + if (format==GIF) t << ",fontname=\"doxfont\""; t << ",color=\"" << labCol << "\""; if (m_isRoot) { @@ -312,8 +336,13 @@ void DotNode::writeBox(QTextStream &t,bool hasNonReachableChildren) t << "];" << endl; } -void DotNode::writeArrow(QTextStream &t,DotNode *cn,EdgeInfo *ei,bool topDown, - bool pointBack) +void DotNode::writeArrow(QTextStream &t, + GraphOutputFormat format, + DotNode *cn, + EdgeInfo *ei, + bool topDown, + bool pointBack + ) { t << " Node"; if (topDown) t << cn->number(); else t << m_number; @@ -327,11 +356,16 @@ void DotNode::writeArrow(QTextStream &t,DotNode *cn,EdgeInfo *ei,bool topDown, { t << ",label=\"" << ei->m_label << "\""; } - t << ",fontname=\"doxfont\""; + if (format==GIF) t << ",fontname=\"doxfont\""; t << "];" << endl; } -void DotNode::write(QTextStream &t,bool topDown,bool toChildren,int distance) +void DotNode::write(QTextStream &t, + GraphOutputFormat format, + bool topDown, + bool toChildren, + int distance + ) { //printf("DotNode::write(%d) name=%s\n",distance,m_label.data()); if (m_written) return; // node already written to the output @@ -347,7 +381,7 @@ void DotNode::write(QTextStream &t,bool topDown,bool toChildren,int distance) if (cn->m_distance>distance) hasNonReachableChildren=TRUE; } } - writeBox(t,hasNonReachableChildren); + writeBox(t,format,hasNonReachableChildren); m_written=TRUE; if (nl) { @@ -360,9 +394,9 @@ void DotNode::write(QTextStream &t,bool topDown,bool toChildren,int distance) { if (cn->m_distance<=distance) { - writeArrow(t,cn,dnli2.current(),topDown); + writeArrow(t,format,cn,dnli2.current(),topDown); } - cn->write(t,topDown,toChildren,distance); + cn->write(t,format,topDown,toChildren,distance); } } else // render parents @@ -374,12 +408,13 @@ void DotNode::write(QTextStream &t,bool topDown,bool toChildren,int distance) if (pn->m_distance<=distance) { writeArrow(t, + format, pn, pn->m_edgeInfo->at(pn->m_children->findRef(this)), FALSE ); } - pn->write(t,TRUE,FALSE,distance); + pn->write(t,format,TRUE,FALSE,distance); } } } @@ -535,13 +570,13 @@ void DotGfxHierarchyTable::writeGraph(QTextStream &out,const char *path) DotNode *node; for (;(node=dnli2.current());++dnli2) { - if (node->m_subgraphId==n->m_subgraphId) node->write(t,FALSE,TRUE); + if (node->m_subgraphId==n->m_subgraphId) node->write(t,GIF,FALSE,TRUE); } t << "}" << endl; f.close(); QCString dotCmd; - dotCmd.sprintf("dot -Tgif %s -o %s",dotName.data(),gifName.data()); + dotCmd.sprintf("dot -Tgif \"%s\" -o \"%s\"",dotName.data(),gifName.data()); //printf("Running: dot -Tgif %s -o %s\n",dotName.data(),gifName.data()); if (system(dotCmd)!=0) { @@ -549,7 +584,7 @@ void DotGfxHierarchyTable::writeGraph(QTextStream &out,const char *path) out << "</table>" << endl; return; } - dotCmd.sprintf("dot -Timap %s -o %s",dotName.data(),mapName.data()); + dotCmd.sprintf("dot -Timap \"%s\" -o \"%s\"",dotName.data(),mapName.data()); //printf("Running: dot -Timap %s -o %s\n",dotName.data(),mapName.data()); if (system(dotCmd)!=0) { @@ -871,8 +906,13 @@ DotClassGraph::~DotClassGraph() delete m_usedNodes; } -void writeDotGraph(DotNode *root,const QCString &baseName, - bool lrRank,bool renderParents,int distance) +void writeDotGraph(DotNode *root, + GraphOutputFormat format, + const QCString &baseName, + bool lrRank, + bool renderParents, + int distance + ) { // generate the graph description for dot //printf("writeDotGraph(%s,%d)\n",baseName.data(),renderParents); @@ -888,7 +928,7 @@ void writeDotGraph(DotNode *root,const QCString &baseName, t << " rankdir=LR;" << endl; } root->clearWriteFlag(); - root->write(t,TRUE,TRUE,distance); + root->write(t,format,TRUE,TRUE,distance); if (renderParents && root->m_parents) { //printf("rendering parents!\n"); @@ -899,12 +939,13 @@ void writeDotGraph(DotNode *root,const QCString &baseName, if (pn->m_distance<=distance) { root->writeArrow(t, + format, pn, pn->m_edgeInfo->at(pn->m_children->findRef(root)), FALSE ); } - pn->write(t,TRUE,FALSE,distance); + pn->write(t,format,TRUE,FALSE,distance); } } t << "}" << endl; @@ -912,9 +953,11 @@ void writeDotGraph(DotNode *root,const QCString &baseName, } } -static void findMaximalDotGraph(DotNode *root,int maxDist, +static void findMaximalDotGraph(DotNode *root, + int maxDist, const QCString &baseName, QDir &thisDir, + GraphOutputFormat format, bool lrRank=FALSE, bool renderParents=FALSE ) @@ -930,11 +973,11 @@ static void findMaximalDotGraph(DotNode *root,int maxDist, // sized image (dimensions: maxImageWidth, maxImageHeight) do { - writeDotGraph(root,baseName,lrRank,renderParents,curDistance); + writeDotGraph(root,format,baseName,lrRank,renderParents,curDistance); QCString dotCmd; // create annotated dot file - dotCmd.sprintf("dot -Tdot %s.dot -o %s_tmp.dot",baseName.data(),baseName.data()); + dotCmd.sprintf("dot -Tdot \"%s.dot\" -o \"%s_tmp.dot\"",baseName.data(),baseName.data()); if (system(dotCmd)!=0) { err("Problems running dot. Check your installation!\n"); @@ -942,7 +985,9 @@ static void findMaximalDotGraph(DotNode *root,int maxDist, } // extract bounding box from the result - readBoundingBox(baseName+"_tmp.dot",&width,&height); + readBoundingBoxDot(baseName+"_tmp.dot",&width,&height); + width = width *96/72; // 96 pixels/inch, 72 points/inch + height = height*96/72; // 96 pixels/inch, 72 points/inch //printf("Found bounding box (%d,%d)\n",width,height); lastFit=(width<maxImageWidth && height<maxImageHeight); @@ -968,6 +1013,7 @@ static void findMaximalDotGraph(DotNode *root,int maxDist, { //printf("Using last fit %d\n",minDistance); writeDotGraph(root, + format, baseName, lrRank || (curDistance==1 && width>maxImageWidth), renderParents, @@ -982,8 +1028,9 @@ QCString DotClassGraph::diskName() const } void DotClassGraph::writeGraph(QTextStream &out, - const char *path, - bool isTBRank) + GraphOutputFormat format, + const char *path, + bool isTBRank) { QDir d(path); // store the original directory @@ -1014,38 +1061,58 @@ void DotClassGraph::writeGraph(QTextStream &out, break; } - // TODO: make sure curDistance>0 - findMaximalDotGraph(m_startNode,m_maxDistance,baseName, - thisDir,!isTBRank,m_graphType==Inheritance); + thisDir,format,!isTBRank,m_graphType==Inheritance); - // run dot to create a .gif image - QCString dotCmd; - dotCmd.sprintf("dot -Tgif %s.dot -o %s.gif",baseName.data(),baseName.data()); - if (system(dotCmd)!=0) + if (format==GIF) // run dot to create a .gif image { - err("Problems running dot. Check your installation!\n"); - return; + QCString dotCmd; + dotCmd.sprintf("dot -Tgif \"%s.dot\" -o \"%s.gif\"",baseName.data(),baseName.data()); + if (system(dotCmd)!=0) + { + err("Error: Problems running dot. Check your installation!\n"); + return; + } + // run dot again to create an image map + dotCmd.sprintf("dot -Timap \"%s.dot\" -o \"%s.map\"",baseName.data(),baseName.data()); + if (system(dotCmd)!=0) + { + err("Error: Problems running dot. Check your installation!\n"); + return; + } + out << "<p><center><img src=\"" << baseName << ".gif\" border=\"0\" usemap=\"#" + << m_startNode->m_label << "_" << mapName << "\"></center>" << endl; + out << "<map name=\"" << m_startNode->m_label << "_" << mapName << "\">" << endl; + convertMapFile(out,baseName+".map"); + out << "</map><p>" << endl; + thisDir.remove(baseName+".map"); } - //printf("dot -Tgif %s.dot -o %s.gif",baseName.data(),baseName.data()); - - // run dot again to create an image map - dotCmd.sprintf("dot -Timap %s.dot -o %s.map",baseName.data(),baseName.data()); - if (system(dotCmd)!=0) + else if (format==EPS) // run dot to create a .eps image { - err("Problems running dot. Check your installation!\n"); - return; + QCString dotCmd; + dotCmd.sprintf("dot -Tps \"%s.dot\" -o \"%s.eps\"",baseName.data(),baseName.data()); + if (system(dotCmd)!=0) + { + err("Error: Problems running dot. Check your installation!\n"); + return; + } + int width,height; + if (!readBoundingBoxEPS(baseName+".eps",&width,&height)) + { + err("Error: Could not extract bounding box from .eps!\n"); + return; + } + int maxWidth = 420; /* approx. page width in points */ + + out << "\\begin{figure}[H]\n" + "\\begin{center}\n" + "\\leavevmode\n" + "\\setlength{\\epsfxsize}{" << QMIN(width/2,maxWidth) << "pt}\n" + "\\epsfbox{" << baseName << ".eps}\n" + "\\end{center}\n" + "\\end{figure}\n"; } - //printf("dot -Timap %s.dot -o %s.map\n",baseName.data(),baseName.data()); - - out << "<p><center><img src=\"" << baseName << ".gif\" border=\"0\" usemap=\"#" - << m_startNode->m_label << "_" << mapName << "\"></center>" << endl; - out << "<map name=\"" << m_startNode->m_label << "_" << mapName << "\">" << endl; - convertMapFile(out,baseName+".map"); - out << "</map><p>" << endl; - - //thisDir.remove(baseName+".dot"); - thisDir.remove(baseName+".map"); + thisDir.remove(baseName+".dot"); QDir::setCurrent(oldDir); } @@ -1130,7 +1197,10 @@ QCString DotInclDepGraph::diskName() const return m_diskName + "_incldep"; } -void DotInclDepGraph::writeGraph(QTextStream &out,const char *path) +void DotInclDepGraph::writeGraph(QTextStream &out, + GraphOutputFormat format, + const char *path + ) { QDir d(path); // store the original directory @@ -1144,35 +1214,65 @@ void DotInclDepGraph::writeGraph(QTextStream &out,const char *path) QDir thisDir; QCString baseName=m_diskName+"_incldep"; - - findMaximalDotGraph(m_startNode,m_maxDistance,baseName,thisDir); - // run dot to create a .gif image - QCString dotCmd; - dotCmd.sprintf("dot -Tgif %s.dot -o %s.gif",baseName.data(),baseName.data()); - if (system(dotCmd)!=0) - { - err("Problems running dot. Check your installation!\n"); - return; - } - //printf("dot -Tgif %s.dot -o %s.gif",baseName.data(),baseName.data()); + findMaximalDotGraph(m_startNode,m_maxDistance,baseName,thisDir,format); - // run dot again to create an image map - dotCmd.sprintf("dot -Timap %s.dot -o %s.map",baseName.data(),baseName.data()); - if (system(dotCmd)!=0) + if (format==GIF) { - err("Problems running dot. Check your installation!\n"); - return; - } + // run dot to create a .gif image + QCString dotCmd; + dotCmd.sprintf("dot -Tgif \"%s.dot\" -o \"%s.gif\"",baseName.data(),baseName.data()); + if (system(dotCmd)!=0) + { + err("Problems running dot. Check your installation!\n"); + return; + } + //printf("dot -Tgif %s.dot -o %s.gif",baseName.data(),baseName.data()); - out << "<p><center><img src=\"" << baseName << ".gif\" border=\"0\" usemap=\"#" + // run dot again to create an image map + dotCmd.sprintf("dot -Timap \"%s.dot\" -o \"%s.map\"",baseName.data(),baseName.data()); + if (system(dotCmd)!=0) + { + err("Problems running dot. Check your installation!\n"); + return; + } + + out << "<p><center><img src=\"" << baseName << ".gif\" border=\"0\" usemap=\"#" << m_startNode->m_label << "_map\"></center>" << endl; - out << "<map name=\"" << m_startNode->m_label << "_map\">" << endl; - convertMapFile(out,baseName+".map"); - out << "</map><p>" << endl; + out << "<map name=\"" << m_startNode->m_label << "_map\">" << endl; + convertMapFile(out,baseName+".map"); + out << "</map><p>" << endl; + thisDir.remove(baseName+".map"); + } + else if (format==EPS) + { + // run dot to create a .eps image + QCString dotCmd; + + dotCmd.sprintf("dot -Tps \"%s.dot\" -o \"%s.eps\"",baseName.data(),baseName.data()); + if (system(dotCmd)!=0) + { + err("Problems running dot. Check your installation!\n"); + return; + } + int width,height; + if (!readBoundingBoxEPS(baseName+".eps",&width,&height)) + { + err("Error: Could not extract bounding box from .eps!\n"); + return; + } + int maxWidth = 420; /* approx. page width in points */ + + out << "\\begin{figure}[H]\n" + "\\begin{center}\n" + "\\leavevmode\n" + "\\setlength{\\epsfxsize}{" << QMIN(width/2,maxWidth) << "pt}\n" + "\\epsfbox{" << baseName << ".eps}\n" + "\\end{center}\n" + "\\end{figure}\n"; + } thisDir.remove(baseName+".dot"); - thisDir.remove(baseName+".map"); QDir::setCurrent(oldDir); } @@ -25,6 +25,8 @@ class FileDef; class QTextStream; class DotNodeList; +enum GraphOutputFormat { GIF , EPS }; + struct EdgeInfo { enum Colors { Blue=0, Green=1, Red=2, Black=3, Grey=4 }; @@ -44,8 +46,13 @@ class DotNode friend class DotClassGraph; friend class DotInclDepGraph; friend class DotNodeList; - friend void writeDotGraph(DotNode *root,const QCString &baseName, - bool lrRank,bool renderParents,int distance); + friend void writeDotGraph( + DotNode *root, + GraphOutputFormat f, + const QCString &baseName, + bool lrRank, + bool renderParents, + int distance); public: DotNode(int n,const char *lab,const char *url,int distance = 0,bool rootNode=FALSE); ~DotNode(); @@ -62,15 +69,17 @@ class DotNode void removeChild(DotNode *n); void removeParent(DotNode *n); int number() const { return m_number; } - void write(QTextStream &t,bool topDown,bool toChildren,int maxDistance=1000); + void write(QTextStream &t,GraphOutputFormat f,bool topDown,bool toChildren, + int maxDistance=1000); int m_subgraphId; void clearWriteFlag(); private: void colorConnectedNodes(int curColor); - void writeBox(QTextStream &t,bool hasNonReachableChildren); - void writeArrow(QTextStream &t,DotNode *cn,EdgeInfo *ei,bool topDown, - bool pointBack=TRUE); + void writeBox(QTextStream &t,GraphOutputFormat f, + bool hasNonReachableChildren); + void writeArrow(QTextStream &t,GraphOutputFormat f,DotNode *cn, + EdgeInfo *ei,bool topDown, bool pointBack=TRUE); const DotNode *findDocNode() const; // only works for acyclic graphs! int m_number; QCString m_label; //!< label text @@ -108,7 +117,8 @@ class DotClassGraph DotClassGraph(ClassDef *cd,GraphType t,int maxRecusionDepth=1000); ~DotClassGraph(); bool isTrivial() const; - void writeGraph(QTextStream &t,const char *path,bool TBRank=TRUE); + void writeGraph(QTextStream &t,GraphOutputFormat f,const char *path, + bool TBRank=TRUE); QCString diskName() const; private: @@ -129,7 +139,7 @@ class DotInclDepGraph public: DotInclDepGraph(FileDef *fd); ~DotInclDepGraph(); - void writeGraph(QTextStream &t, const char *path); + void writeGraph(QTextStream &t, GraphOutputFormat f,const char *path); bool isTrivial() const; QCString diskName() const; diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 13fdbbe..482e4bd 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -696,6 +696,8 @@ void buildNamespaceList(Entry *root) } } +//---------------------------------------------------------------------- + void findUsingDirectives(Entry *root) { if (root->section==Entry::USINGDIR_SEC) @@ -804,6 +806,83 @@ void findUsingDirectives(Entry *root) //---------------------------------------------------------------------- +void findUsingDeclarations(Entry *root) +{ + if (root->section==Entry::USINGDECL_SEC) + { + //printf("Found using declaration %s at line %d of %s\n", + // root->name.data(),root->startLine,root->fileName.data()); + bool ambig; + if (!root->name.isEmpty()) + { + ClassDef *usingCd = 0; + NamespaceDef *nd = 0; + FileDef *fd = findFileDef(&inputNameDict,root->fileName,ambig); + QCString scName; + + // see if the using statement was found inside a namespace or inside + // the global file scope. + if (root->parent->section == Entry::NAMESPACE_SEC) + { + scName=root->parent->name.copy(); + if (!scName.isEmpty()) + { + nd = namespaceDict[scName]; + } + } + + // Assume the using statement was used to import a class. + // Find the scope in which the `using' namespace is defined by prepending + // the possible scopes in which the using statement was found, starting + // with the most inner scope and going to the most outer scope (i.e. + // file scope). + int scopeOffset = scName.length(); + do + { + QCString scope=scopeOffset>0 ? + scName.left(scopeOffset)+"::" : QCString(); + //printf("Trying with scope=`%s'\n",scope.data()); + usingCd = getClass(scope+root->name); + if (scopeOffset==0) + { + scopeOffset=-1; + } + else if ((scopeOffset=scName.findRev("::",scopeOffset-1))==-1) + { + scopeOffset=0; + } + } while (scopeOffset>=0 && usingCd==0); + + //printf("%s -> %p\n",root->name.data(),usingCd); + + // add the namespace the correct scope + if (usingCd) + { + if (nd) + { + //printf("Inside namespace %s\n",nd->name().data()); + nd->addUsingDeclaration(usingCd); + } + else if (fd) + { + //printf("Inside file %s\n",fd->name().data()); + fd->addUsingDeclaration(usingCd); + } + } + } + } + EntryListIterator eli(*root->sublist); + Entry *e; + for (;(e=eli.current());++eli) + { + findUsingDeclarations(e); + } +} + + + +//---------------------------------------------------------------------- + static MemberDef *addVariableToClass( Entry *root, ClassDef *cd, @@ -2131,7 +2210,7 @@ void addMemberDocs(Entry *root, // find a class definition given the scope name and (optionally) a // template list specifier -static ClassDef *findClassDefinition(const char *scopeName,const char *classTempList) +static ClassDef *findSimpleClassDefinition(const char *scopeName,const char *classTempList) { ClassDef *tcd=0; if (classTempList) // try to find the correct specialization @@ -2150,6 +2229,68 @@ static ClassDef *findClassDefinition(const char *scopeName,const char *classTemp return tcd; } +static ClassDef *findClassDefinition(FileDef *fd,NamespaceDef *nd, + const char *scopeName,const char *classTempList) +{ + ClassDef *tcd = findSimpleClassDefinition(scopeName,classTempList); + if (tcd==0) // try using declaration + { + ClassList *cl = 0; + if (nd) + { + cl=nd->getUsedClasses(); + } + else + { + cl=fd->getUsedClasses(); + } + if (cl) + { + ClassListIterator cli(*cl); + ClassDef *cd; + for (;(cd=cli.current()) && tcd==0;++cli) + { + QCString scName = scopeName; + int scopeOffset = scName.length(); + do + { + QCString scope=scName.left(scopeOffset); + //printf("`%s'<->`%s' `%s'\n",cd->name().data(),scope.data(),scopeName); + if (rightScopeMatch(cd->name(),scope)) + { + //printf("Trying to find `%s'\n",(cd->name()+scName.right(scName.length()-scopeOffset)).data()); + tcd = findSimpleClassDefinition(cd->name()+scName.right(scName.length()-scopeOffset),classTempList); + } + scopeOffset=scName.findRev("::",scopeOffset-1); + } while (scopeOffset>=0 && tcd==0); + } + } + } + if (tcd==0) // try using directive + { + NamespaceList *nl = 0; + if (nd) + { + nl=nd->getUsedNamespaces(); + } + else if (fd) + { + nl=fd->getUsedNamespaces(); + } + if (nl) + { + NamespaceListIterator nli(*nl); + NamespaceDef *nd; + for (;(nd=nli.current()) && tcd==0;++nli) + { + //printf("Trying with scope=%s\n",nd->name().data()); + tcd = findSimpleClassDefinition(nd->name()+"::"+scopeName,classTempList); + } + } + } + return tcd; +} + //---------------------------------------------------------------------- // Adds the documentation contained in `root' to a global function @@ -2659,33 +2800,11 @@ void findMember(Entry *root,QCString funcDecl,QCString related,bool overloaded, //printf("Member %s (member scopeName=%s) (this scopeName=%s) classTempList=%s\n",md->name().data(),cd->name().data(),scopeName.data(),classTempList.data()); ClassDef *tcd=0; - tcd = findClassDefinition(scopeName,classTempList); - - if (tcd==0) - { - bool ambig; - NamespaceDef *nd = 0; - FileDef *fd = 0; - NamespaceList *nl = 0; - if (!namespaceName.isEmpty() && (nd=namespaceDict[namespaceName])) - { - nl=nd->getUsedNamespaces(); - } - else if ((fd=findFileDef(&inputNameDict,root->fileName,ambig))) - { - nl=fd->getUsedNamespaces(); - } - if (nl) - { - NamespaceListIterator nli(*nl); - NamespaceDef *nd; - for (;(nd=nli.current()) && tcd==0;++nli) - { - //printf("Trying with scope=%s\n",nd->name().data()); - tcd = findClassDefinition(nd->name()+"::"+scopeName,classTempList); - } - } - } + bool ambig; + FileDef *fd=findFileDef(&inputNameDict,root->fileName,ambig); + NamespaceDef *nd=0; + if (!namespaceName.isEmpty()) nd=namespaceDict[namespaceName]; + tcd = findClassDefinition(fd,nd,scopeName,classTempList); if (cd && tcd==cd) // member's classes match { @@ -4969,7 +5088,10 @@ int main(int argc,char **argv) * Initialize some global constants **************************************************************************/ - spaces.fill(' ',Config::tabSize); + spaces.resize(Config::tabSize+1); + int sp;for (sp=0;sp<Config::tabSize;sp++) spaces.at(sp)=' '; + spaces.at(Config::tabSize)='\0'; + compoundKeywordDict.insert("class",(void *)8); compoundKeywordDict.insert("struct",(void *)8); compoundKeywordDict.insert("union",(void *)8); @@ -5134,6 +5256,7 @@ int main(int argc,char **argv) msg("Building class list...\n"); buildClassList(root); + findUsingDeclarations(root); msg("Building example list...\n"); buildExampleList(root); diff --git a/src/entry.h b/src/entry.h index 74eea8f..d35d80e 100644 --- a/src/entry.h +++ b/src/entry.h @@ -141,7 +141,8 @@ class Entry GROUPDOC_SEC = 0x01000000, USINGDIR_SEC = 0x01100000, MAINPAGEDOC_SEC = 0x01200000, - MEMBERGRP_SEC = 0x01300000 + MEMBERGRP_SEC = 0x01300000, + USINGDECL_SEC = 0x01400000 }; Entry(); diff --git a/src/filedef.cpp b/src/filedef.cpp index f7853a7..2d4e60d 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -50,7 +50,8 @@ FileDef::FileDef(const char *p,const char *nm,const char *ref) namespaceDict = new NamespaceDict(7); srcDefDict = 0; srcAnchorDict = 0; - usingList = 0; + usingDirList = 0; + usingDeclList = 0; isSource = FALSE; docname = nm; if (Config::fullPathNameFlag) @@ -72,7 +73,8 @@ FileDef::~FileDef() delete namespaceDict; delete srcDefDict; delete srcAnchorDict; - delete usingList; + delete usingDirList; + delete usingDeclList; delete memberGroupList; delete memberGroupDict; } @@ -189,7 +191,7 @@ void FileDef::writeDocumentation(OutputList &ol) DotInclDepGraph incDepGraph(this); if (!incDepGraph.isTrivial()) { - ol.disableAllBut(OutputGenerator::Html); + ol.disable(OutputGenerator::Man); ol.newParagraph(); ol.startInclDepGraph(); parseText(ol,theTranslator->trInclDepGraph(name())); @@ -287,7 +289,7 @@ void FileDef::writeDocumentation(OutputList &ol) //if (latexOn) ol.disable(OutputGenerator::Latex); ol.disable(OutputGenerator::Latex); ol.disable(OutputGenerator::RTF); - ol.writeAnchor("_details"); + ol.writeAnchor(0,"_details"); //if (latexOn) ol.enable(OutputGenerator::Latex); ol.popGeneratorState(); ol.startGroupHeader(); @@ -533,11 +535,20 @@ QCString FileDef::getSourceAnchor(int lineNr) void FileDef::addUsingDirective(NamespaceDef *nd) { - if (usingList==0) + if (usingDirList==0) + { + usingDirList = new NamespaceList; + } + usingDirList->append(nd); +} + +void FileDef::addUsingDeclaration(ClassDef *cd) +{ + if (usingDeclList==0) { - usingList = new NamespaceList; + usingDeclList = new ClassList; } - usingList->append(nd); + usingDeclList->append(cd); } void FileDef::addIncludeDependency(FileDef *fd,const char *incName,bool local) diff --git a/src/filedef.h b/src/filedef.h index 3791473..01e59d6 100644 --- a/src/filedef.h +++ b/src/filedef.h @@ -117,7 +117,9 @@ class FileDef : public Definition void computeAnchors(); void addUsingDirective(NamespaceDef *nd); - NamespaceList *getUsedNamespaces() const { return usingList; } + NamespaceList *getUsedNamespaces() const { return usingDirList; } + void addUsingDeclaration(ClassDef *cd); + ClassList *getUsedClasses() const { return usingDeclList; } void setGenerateSource(bool b) { isSource=b; } bool generateSource() const { return isSource; } @@ -142,7 +144,8 @@ class FileDef : public Definition QList<IncludeInfo> *includeList; NamespaceDict *namespaceDict; NamespaceList *namespaceList; - NamespaceList *usingList; + NamespaceList *usingDirList; + ClassList *usingDeclList; //DefineList *defineList; QCString path; QCString filepath; diff --git a/src/filename.cpp b/src/filename.cpp index 6e1fa0a..86db34f 100644 --- a/src/filename.cpp +++ b/src/filename.cpp @@ -38,7 +38,7 @@ FileName::~FileName() void FileName::generateDiskNames() { - QCString commonPrefix; + //QCString commonPrefix; FileDef *fd=first(); int count=0; while (fd) { if (!fd->isReference()) count++; fd=next(); } diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 0bbe773..66e7c53 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -280,7 +280,7 @@ void GroupDef::writeDocumentation(OutputList &ol) ol.pushGeneratorState(); ol.disable(OutputGenerator::Latex); ol.disable(OutputGenerator::RTF); - ol.writeAnchor("_details"); + ol.writeAnchor(0,"_details"); ol.popGeneratorState(); ol.startGroupHeader(); parseText(ol,theTranslator->trDetailedDescription()); diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 1c76c27..f4d6799 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -173,7 +173,7 @@ void HtmlGenerator::endFile() void HtmlGenerator::startProjectNumber() { - t << "<h3 align=center>"; + t << "<h3 align=\"center\">"; } void HtmlGenerator::endProjectNumber() @@ -230,12 +230,11 @@ void HtmlGenerator::writeStyleInfo(int part) void HtmlGenerator::startDoxyAnchor(const char *,const char *, const char *anchor, const char *name) { - t << "<a name=\"" << anchor << "\" doxytag=\"" << name << "\">"; + t << "<a name=\"" << anchor << "\" doxytag=\"" << name << "\"></a>"; } void HtmlGenerator::endDoxyAnchor() { - t << "</a>" << endl; } void HtmlGenerator::newParagraph() @@ -752,10 +751,10 @@ void HtmlGenerator::startMemberDoc(const char *,const char *,const char *,const { DBG_HTML(t << "<!-- startMemberDoc -->" << endl;) t << "<p>" << endl; - t << "<table width=100% cellpadding=2 cellspacing=0 border=0>" << endl; + t << "<table width=\"100%\" cellpadding=\"2\" cellspacing=\"0\" border=\"0\">" << endl; t << " <tr>" << endl; t << " <td class=\"md\"><b>" << endl; - t << " <table cellspadding=0 cellspacing=0 border=0>" << endl; + t << " <table cellspadding=\"0\" cellspacing=\"0\" border=\"0\">" << endl; } void HtmlGenerator::startMemberDocPrefixItem() @@ -837,7 +836,7 @@ void HtmlGenerator::startDotGraph() void HtmlGenerator::endDotGraph(DotClassGraph &g) { - g.writeGraph(t,Config::htmlOutputDir); + g.writeGraph(t,GIF,Config::htmlOutputDir); } void HtmlGenerator::startInclDepGraph() @@ -846,7 +845,7 @@ void HtmlGenerator::startInclDepGraph() void HtmlGenerator::endInclDepGraph(DotInclDepGraph &g) { - g.writeGraph(t,Config::htmlOutputDir); + g.writeGraph(t,GIF,Config::htmlOutputDir); } void HtmlGenerator::writeGraphicalHierarchy(DotGfxHierarchyTable &g) @@ -865,7 +864,7 @@ void HtmlGenerator::startMemberGroupHeader() //t << " <td class=\"groupLine\"><img src=\"null.gif\" width=1></td>" << endl; //t << " <td><div class=\"groupHeader\"> "; - t << "<tr><td colspan=2><div class=\"groupHeader\">"; + t << "<tr><td colspan=\"2\"><div class=\"groupHeader\">"; } void HtmlGenerator::endMemberGroupHeader() @@ -885,7 +884,7 @@ void HtmlGenerator::endMemberGroupHeader() void HtmlGenerator::startMemberGroupDocs() { //t << "<tr><td colspan=2><img src=\"null.gif\" height=4></td></tr>" << endl; - t << "<tr><td colspan=2><div class=\"groupText\">"; + t << "<tr><td colspan=\"2\"><div class=\"groupText\">"; } void HtmlGenerator::endMemberGroupDocs() diff --git a/src/htmlgen.h b/src/htmlgen.h index 7dc63e0..e9f6cf5 100644 --- a/src/htmlgen.h +++ b/src/htmlgen.h @@ -111,7 +111,7 @@ class HtmlGenerator : public OutputGenerator void endMemberDescription(); void writeRuler() { t << "<hr>"; } - void writeAnchor(const char *name) + void writeAnchor(const char *,const char *name) { t << "<a name=\"" << name <<"\"></a>"; } void startCodeFragment() { t << "<div class=\"fragment\"><pre>"; } void endCodeFragment() { t << "</div></pre>"; } // <- I know this is @@ -142,8 +142,8 @@ class HtmlGenerator : public OutputGenerator void startDoxyAnchor(const char *fName,const char *clName, const char *anchor,const char *name); void endDoxyAnchor(); - void startCodeAnchor(const char *label) { t << "<a name=\"" << label << "\">"; } - void endCodeAnchor() { t << "</a>"; } + void startCodeAnchor(const char *label) { t << "<a name=\"" << label << "\"></a>"; } + void endCodeAnchor() { } void writeLatexSpacing() {} //void writeLatexLabel(const char *,const char *) {} void writeStartAnnoItem(const char *type,const char *file, diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 671d377..fecebd8 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -27,6 +27,7 @@ #include "diagram.h" #include "language.h" #include "version.h" +#include "dot.h" static QCString filterTitle(const char *s) { @@ -549,7 +550,7 @@ void LatexGenerator::writeStyleInfo(int part) { case 0: { - QCString pname=Config::projectName.stripWhiteSpace(); + //QCString pname=Config::projectName.stripWhiteSpace(); startPlainFile("doxygen.sty"); t << "\\NeedsTeXFormat{LaTeX2e}\n"; t << "\\ProvidesPackage{doxygen}\n"; @@ -765,7 +766,8 @@ void LatexGenerator::writeObjectLink(const char *ref, const char *f, { t << "\\hyperlink{"; if (f) t << f; - if (anchor) t << "_" << anchor; + if (f && anchor) t << "_"; + if (anchor) t << anchor; t << "}{"; docify(text); t << "}"; @@ -910,6 +912,15 @@ void LatexGenerator::endDoxyAnchor() } } +void LatexGenerator::writeAnchor(const char *fName,const char *name) +{ + t << "\\label{" << name << "}" << endl; + if (fName && Config::pdfHyperFlag) + { + t << "\\hypertarget{" << fName << "_" << name << "}{}" << endl; + } +} + //void LatexGenerator::writeLatexLabel(const char *clName,const char *anchor) //{ @@ -939,6 +950,10 @@ void LatexGenerator::writeSection(const char *lab,const char *title,bool sub) if (sub) t << "subsection{"; else t << "section{"; docify(title); t << "}\\label{" << lab << "}" << endl; + if (Config::pdfHyperFlag) + { + t << "\\hypertarget{" << lab << "}{}"; + } } void LatexGenerator::writeSectionRef(const char *,const char *lab, @@ -955,6 +970,7 @@ void LatexGenerator::writeSectionRefItem(const char *,const char *lab, t << "}{\\ref{" << lab << "}}{}" << endl; } +// TODO: remove this function void LatexGenerator::writeSectionRefAnchor(const char *,const char *lab, const char *title) { @@ -1277,3 +1293,23 @@ void LatexGenerator::endMemberGroup(bool) { t << "\\end{Indent}" << endl; } + +void LatexGenerator::startDotGraph() +{ +} + +void LatexGenerator::endDotGraph(DotClassGraph &g) +{ + g.writeGraph(t,EPS,Config::latexOutputDir); +} + +void LatexGenerator::startInclDepGraph() +{ +} + +void LatexGenerator::endInclDepGraph(DotInclDepGraph &g) +{ + g.writeGraph(t,EPS,Config::latexOutputDir); +} + + diff --git a/src/latexgen.h b/src/latexgen.h index a3e10c3..933cb43 100644 --- a/src/latexgen.h +++ b/src/latexgen.h @@ -105,7 +105,7 @@ class LatexGenerator : public OutputGenerator void insertMemberAlign() {} void writeRuler() { t << endl << endl; /*t << "\\vspace{0.4cm}\\hrule\\vspace{0.2cm}" << endl; */ } - void writeAnchor(const char *name) { t << "\\label{" << name << "}" << endl; } + void writeAnchor(const char *fileName,const char *name); void startCodeFragment() { t << "\\small\\begin{verbatim}"; } void endCodeFragment() { t << "\\end{verbatim}\\normalsize " << endl; } void startCodeLine() { col=0; } @@ -211,10 +211,10 @@ class LatexGenerator : public OutputGenerator //static void docifyStatic(QTextStream &t,const char *str); - void startDotGraph() {} - void endDotGraph(DotClassGraph &) {} - void startInclDepGraph() {} - void endInclDepGraph(DotInclDepGraph &) {} + void startDotGraph(); + void endDotGraph(DotClassGraph &); + void startInclDepGraph(); + void endInclDepGraph(DotInclDepGraph &); void writeGraphicalHierarchy(DotGfxHierarchyTable &) {} void startTextBlock(bool) {} diff --git a/src/mangen.h b/src/mangen.h index cb3b0a4..fc435a4 100644 --- a/src/mangen.h +++ b/src/mangen.h @@ -103,7 +103,7 @@ class ManGenerator : public OutputGenerator void endMemberGroup(bool); void writeRuler() {} - void writeAnchor(const char *) {} + void writeAnchor(const char *,const char *) {} void startCodeFragment(); void endCodeFragment(); void startCodeLine() {} diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 30f371f..cde0c2a 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -250,7 +250,7 @@ MemberDef::MemberDef(const char *df,int dl, membTAL=0; type=substituteClassNames(t); args=substituteClassNames(a); - if (type.isNull()) decl=name()+args; else decl=type+" "+name()+args; + if (type.isEmpty()) decl=name()+args; else decl=type+" "+name()+args; declLine=0; memberGroup=0; virt=v; diff --git a/src/message.cpp b/src/message.cpp index 678a80a..9554c02 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -18,7 +18,7 @@ #include <stdarg.h> #include <stdio.h> #include "config.h" -#include <qregexp.h> +#include "util.h" static QCString outputFormat; static int warnFormatOrder; // 1 = $file,$line,$text @@ -62,11 +62,22 @@ void initWarningFormat() { warnFormatOrder = 6; } - outputFormat = Config::warnFormat. - replace(QRegExp("\\$file"),"%s"). - replace(QRegExp("\\$text"),"%s"). - replace(QRegExp("\\$line"),"%d")+ - '\n'; + outputFormat = + substitute( + substitute( + substitute( + Config::warnFormat, + "$file","%s" + ), + "$text","%s" + ), + "$line","%d" + )+'\n'; + + // replace(QRegExp("\\$file"),"%s"). + // replace(QRegExp("\\$text"),"%s"). + // replace(QRegExp("\\$line"),"%d")+ + // '\n'; } diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index 7c145ec..a3cbaa2 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -35,7 +35,8 @@ NamespaceDef::NamespaceDef(const char *df,int dl, classList = new ClassList; classDict = new ClassDict(1009); //memList = new MemberList; - usingList = 0; + usingDirList = 0; + usingDeclList = 0; setReference(ref); memberGroupList = new MemberGroupList; memberGroupList->setAutoDelete(TRUE); @@ -48,7 +49,8 @@ NamespaceDef::~NamespaceDef() { delete classList; delete classDict; - delete usingList; + delete usingDirList; + delete usingDeclList; delete memberGroupList; delete memberGroupDict; } @@ -182,7 +184,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) ol.disableAllBut(OutputGenerator::Html); //bool latexOn = ol.isEnabled(OutputGenerator::Latex); //if (latexOn) ol.disable(OutputGenerator::Latex); - ol.writeAnchor("_details"); + ol.writeAnchor(0,"_details"); //if (latexOn) ol.enable(OutputGenerator::Latex); ol.popGeneratorState(); ol.startGroupHeader(); @@ -293,9 +295,18 @@ int NamespaceDef::countMembers() void NamespaceDef::addUsingDirective(NamespaceDef *nd) { - if (usingList==0) + if (usingDirList==0) { - usingList = new NamespaceList; + usingDirList = new NamespaceList; } - usingList->append(nd); + usingDirList->append(nd); +} + +void NamespaceDef::addUsingDeclaration(ClassDef *cd) +{ + if (usingDeclList==0) + { + usingDeclList = new ClassList; + } + usingDeclList->append(cd); } diff --git a/src/namespacedef.h b/src/namespacedef.h index d6f4b59..ffcc8d2 100644 --- a/src/namespacedef.h +++ b/src/namespacedef.h @@ -49,7 +49,11 @@ class NamespaceDef : public Definition void computeAnchors(); int countMembers(); void addUsingDirective(NamespaceDef *nd); - NamespaceList *getUsedNamespaces() const { return usingList; } + NamespaceList *getUsedNamespaces() const { return usingDirList; } + void addUsingDeclaration(ClassDef *cd); + ClassList *getUsedClasses() const { return usingDeclList; } + + //const char *getReference() { return reference; } //bool isVisible() //{ @@ -81,7 +85,8 @@ class NamespaceDef : public Definition QStrList files; ClassList *classList; ClassDict *classDict; - NamespaceList *usingList; + NamespaceList *usingDirList; + ClassList *usingDeclList; MemberList allMemberList; MemberList defineMembers; diff --git a/src/outputgen.h b/src/outputgen.h index d7d30a1..bde5dcc 100644 --- a/src/outputgen.h +++ b/src/outputgen.h @@ -112,7 +112,7 @@ class OutputGenerator virtual void insertMemberAlign() = 0; virtual void writeRuler() = 0; - virtual void writeAnchor(const char *name) = 0; + virtual void writeAnchor(const char *fileName,const char *name) = 0; virtual void startCodeFragment() = 0; virtual void endCodeFragment() = 0; virtual void startCodeLine() = 0; diff --git a/src/outputlist.h b/src/outputlist.h index d59320c..435a2a2 100644 --- a/src/outputlist.h +++ b/src/outputlist.h @@ -180,8 +180,8 @@ class OutputList { forall(&OutputGenerator::insertMemberAlign); } void writeRuler() { forall(&OutputGenerator::writeRuler); } - void writeAnchor(const char *name) - { forall(&OutputGenerator::writeAnchor,name); } + void writeAnchor(const char *fileName,const char *name) + { forall(&OutputGenerator::writeAnchor,fileName,name); } void startCodeFragment() { forall(&OutputGenerator::startCodeFragment); } void endCodeFragment() @@ -35,6 +35,7 @@ #include <qregexp.h> #include <qfileinfo.h> +#include "pre.h" #include "constexp.h" #include "define.h" #include "doxygen.h" @@ -1459,7 +1460,7 @@ BN [ \t\r\n] if (!g_quoteArg) g_defText+=' '; g_defText+='@'; QCString numStr; - numStr.setNum(*n); + numStr.sprintf("%d",*n); g_defText+=numStr; if (!g_quoteArg) g_defText+=' '; } diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index 55a3a11..86ff8c2 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -358,7 +358,7 @@ void RTFGenerator::endProjectNumber() void RTFGenerator::startIndexSection(IndexSections is) { - QCString paperName; + //QCString paperName; m_listLevel = 0; @@ -1148,14 +1148,16 @@ void RTFGenerator::endTitleHead(const char *fileName,const char *name) // make an index entry addToIndex(name,NULL); - // make a bookmark for referencing - writeAnchor(name); if (fileName) { // doxygen expects different anchors for pdf and if "FULL PATHS" - if (strcmp(name,fileName) != 0) - writeAnchor(fileName); + writeAnchor(fileName,0); + } + else + { + // make a bookmark for referencing + writeAnchor(0,name); } } } @@ -1408,7 +1410,7 @@ void RTFGenerator::writeSection(const char *lab,const char *title,bool sub) newParagraph(); // make bookmark - writeAnchor(lab); + writeAnchor(0,lab); t << "}"; } @@ -1547,9 +1549,13 @@ void RTFGenerator::endMemberItem(bool) newParagraph(); } -void RTFGenerator::writeAnchor(const char *name) +void RTFGenerator::writeAnchor(const char *fileName,const char *name) { - t << "{\\bkmkstart " << formatBmkStr(name) << "}" << endl; + t << "{\\bkmkstart "; + if (fileName) t << formatBmkStr(fileName); + if (fileName && name) t << "_"; + if (name) t << formatBmkStr(name); + t << "}" << endl; t << "{\\bkmkend " << formatBmkStr(name) << "}" << endl; } @@ -1936,7 +1942,7 @@ void RTFGenerator::endDotGraph(DotClassGraph &g) newParagraph(); t <<"{\\comment This would be an image map..." << endl; - g.writeGraph(t,Config::rtfOutputDir); + g.writeGraph(t,GIF,Config::rtfOutputDir); t << "}" << endl; @@ -1958,11 +1964,11 @@ void RTFGenerator::endInclDepGraph(DotInclDepGraph &g) newParagraph(); t <<"{\\comment This would be an image map..." << endl; - g.writeGraph(t,Config::rtfOutputDir); + g.writeGraph(t,GIF,Config::rtfOutputDir); t << "}" << endl; - QCString diskName = g.diskName(); + //QCString diskName = g.diskName(); // display the file t << "{" << endl; diff --git a/src/rtfgen.h b/src/rtfgen.h index 634cfd3..cc7f54a 100644 --- a/src/rtfgen.h +++ b/src/rtfgen.h @@ -101,7 +101,7 @@ class RTFGenerator : public OutputGenerator void writeRuler(){RtfwriteRuler_thin();}; - void writeAnchor(const char *name); + void writeAnchor(const char *fileName,const char *name); void startCodeFragment(); void endCodeFragment(); void startCodeLine() { col=0; } diff --git a/src/scanner.l b/src/scanner.l index a976a68..056caef 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -92,6 +92,9 @@ static int roundCount = 0 ; static int curlyCount = 0 ; static int squareCount = 0 ; static int ifCount = 0 ; +static int todoAnchor = 0 ; +static int todoStartContext = 0; +static QCString todoString = 0; static Entry* current_root = 0 ; static Entry* global_root = 0 ; static Entry* current = 0 ; @@ -889,7 +892,7 @@ ID [a-z_A-Z][a-z_A-Z0-9]* SCOPEID {ID}({ID}*{BN}*"::"{BN}*)*({ID}?) SCOPENAME (({ID}?{BN}*"::"{BN}*)*)((~{BN}*)?{ID}) SCOPEMASK {ID}?(("::"|"#")?(~)?{ID})+ -URLMASK [a-z_A-Z0-9\~\:\?\@\#\.\-\+\/]+ +URLMASK [a-z_A-Z0-9\~\:\?\@\#\.\-\+\/\=]+ NONTERM [\{\}\[\]\`\~\@\|\-\+\#\$\/\\\!\%\^\&\*()a-z_A-Z<>0-9] WORD ({NONTERM}+([^\n\t ]*{NONTERM}+)?)|("\""[^\n\"]"\"") ATTR ({B}+[^>\n]*)? @@ -933,7 +936,7 @@ TR [tT][rR] TT [tT][tT] UL [uU][lL] VAR [vV][aA][rR] -DOCPARAM ([a-z_A-Z0-9:\.\-]+)|("\"".*"\"") +DOCPARAM ([a-z_A-Z0-9:\<\>\=\.\-]+)|("\"".*"\"") %option noyywrap @@ -1067,6 +1070,7 @@ DOCPARAM ([a-z_A-Z0-9:\.\-]+)|("\"".*"\"") %x DocHtmlImageName %x DocLatexImageName %x DocLatexImageWidth +%x TodoParam %x SectionLabel %x SectionTitle %x SkipTemplate @@ -1583,7 +1587,7 @@ DOCPARAM ([a-z_A-Z0-9:\.\-]+)|("\"".*"\"") <DocParam>({DOCPARAM}{BN}*","{BN}*)*{DOCPARAM} { outDoc->startDescTableTitle(); outDoc->startEmphasis(); - outDoc->docify(yytext); + outDoc->docify(substitute(yytext,"\"","")); outDoc->endEmphasis(); outDoc->endDescTableTitle(); outDoc->startDescTableData(); @@ -1616,7 +1620,8 @@ DOCPARAM ([a-z_A-Z0-9:\.\-]+)|("\"".*"\"") SectionInfo *sec; if ((sec=sectionDict[secName])) { - outDoc->writeAnchor(sec->label); + //printf("writeAnchor %s_%s\n",sec->fileName.data(),sec->label.data()); + outDoc->writeAnchor(sec->fileName,sec->label); } } <DocScan>{CMD}"ref" { @@ -1662,7 +1667,10 @@ DOCPARAM ([a-z_A-Z0-9:\.\-]+)|("\"".*"\"") text=sec->title; if (sec->type==SectionInfo::Anchor) { - outDoc->writeSectionRefAnchor(sec->fileName,sec->label,text); + //outDoc->writeSectionRefAnchor(sec->fileName,sec->label,text); + outDoc->writeObjectLink(0,sec->fileName,sec->label,text); + //printf("Writing page ref `%s'\n",sec->label.data()); + writePageRef(*outDoc,sec->label,0); } else { @@ -1693,7 +1701,10 @@ DOCPARAM ([a-z_A-Z0-9:\.\-]+)|("\"".*"\"") { if (sec->type==SectionInfo::Anchor) { - outDoc->writeSectionRefAnchor(sec->fileName,sec->label,text); + //outDoc->writeSectionRefAnchor(sec->fileName,sec->label,text); + outDoc->writeObjectLink(0,sec->fileName,sec->label,text); + //printf("Writing page ref `%s'\n",sec->label.data()); + writePageRef(*outDoc,sec->label,0); } else { @@ -2028,7 +2039,7 @@ DOCPARAM ([a-z_A-Z0-9:\.\-]+)|("\"".*"\"") <DocScan>"<"{H3}{ATTR}">" { outDoc->startSubsubsection(); } <DocScan>"</"{H3}{ATTR}">" { outDoc->endSubsubsection(); } <DocHtmlLink>{NAME}{BN}*"="{BN}*("\""?) { BEGIN(DocHtmlAnchor); } -<DocHtmlAnchor>[a-z_A-Z0-9.\-\+\/]+ { outDoc->writeAnchor(yytext); } +<DocHtmlAnchor>[a-z_A-Z0-9.\-\+\/]+ { outDoc->writeAnchor(0,yytext); } <DocHtmlLink>{HREF}{BN}*"="{BN}*("\""?) { htmlUrl.resize(0); htmlText.resize(0); @@ -2434,7 +2445,21 @@ DOCPARAM ([a-z_A-Z0-9:\.\-]+)|("\"".*"\"") BEGIN(Using); } <Using>"namespace"{BN}+ { lineCount(); BEGIN(UsingDirective); } -<Using>";" { BEGIN(FindMembers); } +<Using>{ID}{BN}*"::"{BN}*{ID}({BN}*"::"{BN}*{ID})* { + current->name=yytext; + current->fileName = yyFileName; + current->section=Entry::USINGDECL_SEC; + //printf("Found using declaration %s\n",yytext); + current_root->addSubEntry(current); + current = new Entry ; + current->protection = protection ; + current->sig = sig; + current->virt = virt; + current->stat = gstat; + current->slot = slot; + current->mGrpId = memberGroupId; + BEGIN(Using); + } <UsingDirective>{SCOPENAME} { current->name=yytext; current->fileName = yyFileName; current->section=Entry::USINGDIR_SEC; @@ -2449,6 +2474,7 @@ DOCPARAM ([a-z_A-Z0-9:\.\-]+)|("\"".*"\"") current->mGrpId = memberGroupId; BEGIN(Using); } +<Using>";" { BEGIN(FindMembers); } <FindMembers>{SCOPENAME}{BN}*"<>" { // guided template decl QCString n=yytext; addType( current ); @@ -3775,7 +3801,7 @@ DOCPARAM ([a-z_A-Z0-9:\.\-]+)|("\"".*"\"") { if (isTypedef) { - QCString dest = extractName(current->name); + //QCString dest = extractName(current->name); typedefDict.insert(yytext,new QCString(current->name)); //current->extends->append( // new BaseInfo(yytext,Public,Normal) @@ -4171,6 +4197,50 @@ DOCPARAM ([a-z_A-Z0-9:\.\-]+)|("\"".*"\"") memberGroupDocs.resize(0); BEGIN(GroupHeader); } +<LineDoc,Doc,JavaDoc,ClassDoc,PageDoc>{CMD}"todo"{B}+ { + todoStartContext = YY_START; + todoString.resize(0); + BEGIN(TodoParam); + } +<TodoParam>[^*/\n]+ { + todoString+=yytext; + } +<TodoParam>. { + todoString+=*yytext; + } +<TodoParam>"\n"|"*/" { + char anchorLabel[12]; + sprintf(anchorLabel,"_todo%06d",todoAnchor++); + QCString todoItemNum; + todoItemNum.sprintf("%d",todoAnchor); + sectionType=SectionInfo::Anchor; + sectionLabel=anchorLabel; + addSection(); + current->doc += "\\anchor "+sectionLabel+"\n"; + current->doc += "<p><b>\\link todo "; + current->doc += theTranslator->trTodo(); + current->doc += ":\\endlink </b>"; + current->doc += todoString + "<p>"; + Entry *page = new Entry; + page->section = Entry::PAGEDOC_SEC; + page->fileName = yyFileName; + page->startLine = yyLineNr; + page->name = "todo"; + page->args = theTranslator->trTodoList(); + page->doc += "\\ref "; + page->doc += anchorLabel; + page->doc += " \""+todoItemNum+"\"\n"+todoString+"<p>"; + global_root->addSubEntry(page); + if (*yytext=='*') + { + unput('/');unput('*'); + } + else + { + unput('\n'); + } + BEGIN(todoStartContext); + } <ExampleDocArg1>{FILE} { current->name = stripQuotes(yytext); BEGIN( ExampleDoc ); diff --git a/src/translator.h b/src/translator.h index 89ef47b..9598da3 100644 --- a/src/translator.h +++ b/src/translator.h @@ -863,9 +863,19 @@ class Translator } ////////////////////////////////////////////////////////////////////////// -// new since 1.1.1 +// new since 1.1.3 ////////////////////////////////////////////////////////////////////////// + /*! Used as a marker that is put before a todo item */ + virtual QCString trTodo() + { + return "Todo"; + } + /*! Used as the header of the todo list */ + virtual QCString trTodoList() + { + return "Todo List"; + } }; #endif diff --git a/src/util.cpp b/src/util.cpp index 275b754..bc5067f 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1070,8 +1070,8 @@ bool matchArguments(ArgumentList *srcAl,ArgumentList *dstAl, // (assuming a using statement was used) trimNamespaceScope(srcAType,dstAType); - QCString srcScope; - QCString dstScope; + //QCString srcScope; + //QCString dstScope; // strip redundant scope specifiers if (!className.isEmpty()) @@ -1400,7 +1400,7 @@ bool getDefs(const QCString &scName,const QCString &memberName, QCString className = scopeName.left(scopeOffset); if (!className.isEmpty() && !mScope.isEmpty()) { - className.append("::"+mScope); + className+="::"+mScope; } else if (!mScope.isEmpty()) { @@ -1507,7 +1507,7 @@ bool getDefs(const QCString &scName,const QCString &memberName, QCString namespaceName = scopeName.left(scopeOffset); if (!namespaceName.isEmpty() && !mScope.isEmpty()) { - namespaceName.append("::"+mScope); + namespaceName+="::"+mScope; } else if (!mScope.isEmpty()) { @@ -2247,7 +2247,7 @@ void extractNamespaceName(const QCString &scopeName, QCString &className,QCString &namespaceName) { QCString clName=scopeName.copy(); - QCString nsName; + //QCString nsName; if (!clName.isEmpty() && namespaceDict[clName] && getClass(clName)==0) { // the whole name is a namespace (and not a class) namespaceName=clName.copy(); |