summaryrefslogtreecommitdiff
path: root/src/dot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dot.cpp')
-rw-r--r--src/dot.cpp367
1 files changed, 163 insertions, 204 deletions
diff --git a/src/dot.cpp b/src/dot.cpp
index 0a4f136..4189748 100644
--- a/src/dot.cpp
+++ b/src/dot.cpp
@@ -232,7 +232,7 @@ static EdgeProperties umlEdgeProps =
static QCString getDotFontName()
{
- static QCString dotFontName = Config_getString("DOT_FONTNAME");
+ static QCString dotFontName = Config_getString(DOT_FONTNAME);
if (dotFontName.isEmpty())
{
//dotFontName="FreeSans.ttf";
@@ -243,14 +243,14 @@ static QCString getDotFontName()
static int getDotFontSize()
{
- static int dotFontSize = Config_getInt("DOT_FONTSIZE");
+ static int dotFontSize = Config_getInt(DOT_FONTSIZE);
if (dotFontSize<4) dotFontSize=4;
return dotFontSize;
}
static void writeGraphHeader(FTextStream &t,const QCString &title=QCString())
{
- static bool interactiveSVG = Config_getBool("INTERACTIVE_SVG");
+ static bool interactiveSVG = Config_getBool(INTERACTIVE_SVG);
t << "digraph ";
if (title.isEmpty())
{
@@ -266,7 +266,7 @@ static void writeGraphHeader(FTextStream &t,const QCString &title=QCString())
{
t << " // INTERACTIVE_SVG=YES\n";
}
- if (Config_getBool("DOT_TRANSPARENT"))
+ if (Config_getBool(DOT_TRANSPARENT))
{
t << " bgcolor=\"transparent\";" << endl;
}
@@ -397,55 +397,13 @@ static bool convertMapFile(FTextStream &t,const char *mapName,
return TRUE;
}
-static QArray<int> s_newNumber;
-static int s_max_newNumber=0;
-
-inline int reNumberNode(int number, bool doReNumbering)
-{
- if (!doReNumbering)
- {
- return number;
- }
- else
- {
- int s = s_newNumber.size();
- if (number>=s)
- {
- int ns=0;
- ns = s * 3 / 2 + 5; // new size
- if (number>=ns) // number still doesn't fit
- {
- ns = number * 3 / 2 + 5;
- }
- s_newNumber.resize(ns);
- for (int i=s;i<ns;i++) // clear new part of the array
- {
- s_newNumber.at(i)=0;
- }
- }
- int i = s_newNumber.at(number);
- if (i == 0) // not yet mapped
- {
- i = ++s_max_newNumber; // start from 1
- s_newNumber.at(number) = i;
- }
- return i;
- }
-}
-
-static void resetReNumbering()
-{
- s_max_newNumber=0;
- s_newNumber.resize(s_max_newNumber);
-}
-
static QCString g_dotFontPath;
static void setDotFontPath(const char *path)
{
ASSERT(g_dotFontPath.isEmpty());
g_dotFontPath = portable_getenv("DOTFONTPATH");
- QCString newFontPath = Config_getString("DOT_FONTPATH");
+ QCString newFontPath = Config_getString(DOT_FONTPATH);
QCString spath = path;
if (!newFontPath.isEmpty() && !spath.isEmpty())
{
@@ -519,7 +477,7 @@ static bool writeVecGfxFigure(FTextStream &out,const QCString &baseName,
const QCString &figureName)
{
int width=400,height=550;
- static bool usePdfLatex = Config_getBool("USE_PDFLATEX");
+ static bool usePdfLatex = Config_getBool(USE_PDFLATEX);
if (usePdfLatex)
{
if (!readBoundingBox(figureName+".pdf",&width,&height,FALSE))
@@ -713,7 +671,7 @@ static bool insertMapFile(FTextStream &out,const QCString &mapFile,
static void removeDotGraph(const QCString &dotName)
{
- static bool dotCleanUp = Config_getBool("DOT_CLEANUP");
+ static bool dotCleanUp = Config_getBool(DOT_CLEANUP);
if (dotCleanUp)
{
QDir d;
@@ -792,13 +750,13 @@ int DotNodeList::compareValues(const DotNode *n1,const DotNode *n2) const
DotRunner::DotRunner(const QCString &file,const QCString &path,
bool checkResult,const QCString &imageName)
- : m_dotExe(Config_getString("DOT_PATH")+"dot"),
+ : m_dotExe(Config_getString(DOT_PATH)+"dot"),
m_file(file), m_path(path),
m_checkResult(checkResult), m_imageName(imageName),
m_imgExt(getDotImageExtension())
{
- static bool dotCleanUp = Config_getBool("DOT_CLEANUP");
- static bool dotMultiTargets = Config_getBool("DOT_MULTI_TARGETS");
+ static bool dotCleanUp = Config_getBool(DOT_CLEANUP);
+ static bool dotMultiTargets = Config_getBool(DOT_MULTI_TARGETS);
m_cleanUp = dotCleanUp;
m_multiTargets = dotMultiTargets;
m_jobs.setAutoDelete(TRUE);
@@ -946,7 +904,7 @@ int DotFilePatcher::addSVGObject(const QCString &baseName,
bool DotFilePatcher::run()
{
//printf("DotFilePatcher::run(): %s\n",m_patchFile.data());
- static bool interactiveSVG = Config_getBool("INTERACTIVE_SVG");
+ static bool interactiveSVG = Config_getBool(INTERACTIVE_SVG);
bool isSVGFile = m_patchFile.right(4)==".svg";
int graphId = -1;
QCString relPath;
@@ -1233,7 +1191,7 @@ DotManager::DotManager() : m_dotMaps(1009)
m_dotMaps.setAutoDelete(TRUE);
m_queue = new DotRunnerQueue;
int i;
- int numThreads = QMIN(32,Config_getInt("DOT_NUM_THREADS"));
+ int numThreads = QMIN(32,Config_getInt(DOT_NUM_THREADS));
if (numThreads!=1)
{
if (numThreads==0) numThreads = QMAX(2,QThread::idealThreadCount()+1);
@@ -1333,19 +1291,19 @@ bool DotManager::run()
QListIterator<DotRunner> li(m_dotRuns);
bool setPath=FALSE;
- if (Config_getBool("GENERATE_HTML"))
+ if (Config_getBool(GENERATE_HTML))
{
- setDotFontPath(Config_getString("HTML_OUTPUT"));
+ setDotFontPath(Config_getString(HTML_OUTPUT));
setPath=TRUE;
}
- else if (Config_getBool("GENERATE_LATEX"))
+ else if (Config_getBool(GENERATE_LATEX))
{
- setDotFontPath(Config_getString("LATEX_OUTPUT"));
+ setDotFontPath(Config_getString(LATEX_OUTPUT));
setPath=TRUE;
}
- else if (Config_getBool("GENERATE_RTF"))
+ else if (Config_getBool(GENERATE_RTF))
{
- setDotFontPath(Config_getString("RTF_OUTPUT"));
+ setDotFontPath(Config_getString(RTF_OUTPUT));
setPath=TRUE;
}
portable_sysTimerStart();
@@ -1673,7 +1631,7 @@ static void writeBoxMemberList(FTextStream &t,
if (mma->getClassDef() == scope &&
(skipNames==0 || skipNames->find(mma->name())==0))
{
- static int limit = Config_getInt("UML_LIMIT_NUM_FIELDS");
+ static int limit = Config_getInt(UML_LIMIT_NUM_FIELDS);
if (limit>0 && (totalCount>limit*3/2 && count>=limit))
{
t << theTranslator->trAndMore(QCString().sprintf("%d",totalCount-count)) << "\\l";
@@ -1722,16 +1680,16 @@ static QCString stripProtectionPrefix(const QCString &s)
void DotNode::writeBox(FTextStream &t,
GraphType gt,
GraphOutputFormat /*format*/,
- bool hasNonReachableChildren,
- bool reNumber)
+ bool hasNonReachableChildren
+ )
{
const char *labCol =
m_url.isEmpty() ? "grey75" : // non link
(
(hasNonReachableChildren) ? "red" : "black"
);
- t << " Node" << reNumberNode(m_number,reNumber) << " [label=\"";
- static bool umlLook = Config_getBool("UML_LOOK");
+ t << " Node" << m_number << " [label=\"";
+ static bool umlLook = Config_getBool(UML_LOOK);
if (m_classDef && umlLook && (gt==Inheritance || gt==Collaboration))
{
@@ -1763,7 +1721,7 @@ void DotNode::writeBox(FTextStream &t,
}
//printf("DotNode::writeBox for %s\n",m_classDef->name().data());
- static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE");
+ static bool extractPrivate = Config_getBool(EXTRACT_PRIVATE);
t << "{" << convertLabel(m_label);
t << "\\n|";
writeBoxMemberList(t,'+',m_classDef->getMemberList(MemberListType_pubAttribs),m_classDef,FALSE,&arrowNames);
@@ -1819,7 +1777,7 @@ void DotNode::writeBox(FTextStream &t,
}
else
{
- static bool dotTransparent = Config_getBool("DOT_TRANSPARENT");
+ static bool dotTransparent = Config_getBool(DOT_TRANSPARENT);
if (!dotTransparent)
{
t << ",color=\"" << labCol << "\", fillcolor=\"";
@@ -1856,24 +1814,23 @@ void DotNode::writeArrow(FTextStream &t,
GraphOutputFormat format,
DotNode *cn,
EdgeInfo *ei,
- bool topDown,
- bool pointBack,
- bool reNumber
+ bool topDown,
+ bool pointBack
)
{
t << " Node";
- if (topDown)
- t << reNumberNode(cn->number(),reNumber);
- else
- t << reNumberNode(m_number,reNumber);
+ if (topDown)
+ t << cn->number();
+ else
+ t << m_number;
t << " -> Node";
- if (topDown)
- t << reNumberNode(m_number,reNumber);
- else
- t << reNumberNode(cn->number(),reNumber);
+ if (topDown)
+ t << m_number;
+ else
+ t << cn->number();
t << " [";
- static bool umlLook = Config_getBool("UML_LOOK");
+ static bool umlLook = Config_getBool(UML_LOOK);
const EdgeProperties *eProps = umlLook ? &umlEdgeProps : &normalEdgeProps;
QCString aStyle = eProps->arrowStyleMap[ei->m_color];
bool umlUseArrow = aStyle=="odiamond";
@@ -1908,14 +1865,13 @@ void DotNode::write(FTextStream &t,
GraphOutputFormat format,
bool topDown,
bool toChildren,
- bool backArrows,
- bool reNumber
+ bool backArrows
)
{
//printf("DotNode::write(%d) name=%s this=%p written=%d visible=%d\n",m_distance,m_label.data(),this,m_written,m_visible);
if (m_written) return; // node already written to the output
if (!m_visible) return; // node is not visible
- writeBox(t,gt,format,m_truncated==Truncated,reNumber);
+ writeBox(t,gt,format,m_truncated==Truncated);
m_written=TRUE;
QList<DotNode> *nl = toChildren ? m_children : m_parents;
if (nl)
@@ -1930,9 +1886,9 @@ void DotNode::write(FTextStream &t,
if (cn->isVisible())
{
//printf("write arrow %s%s%s\n",label().data(),backArrows?"<-":"->",cn->label().data());
- writeArrow(t,gt,format,cn,dnli2.current(),topDown,backArrows,reNumber);
+ writeArrow(t,gt,format,cn,dnli2.current(),topDown,backArrows);
}
- cn->write(t,gt,format,topDown,toChildren,backArrows,reNumber);
+ cn->write(t,gt,format,topDown,toChildren,backArrows);
}
}
else // render parents
@@ -1950,11 +1906,10 @@ void DotNode::write(FTextStream &t,
pn,
pn->m_edgeInfo->at(pn->m_children->findRef(this)),
FALSE,
- backArrows,
- reNumber
+ backArrows
);
}
- pn->write(t,gt,format,TRUE,FALSE,backArrows,reNumber);
+ pn->write(t,gt,format,TRUE,FALSE,backArrows);
}
}
}
@@ -2229,6 +2184,20 @@ void DotNode::colorConnectedNodes(int curColor)
}
}
+void DotNode::renumberNodes(int &number)
+{
+ m_number = number++;
+ if (m_children)
+ {
+ QListIterator<DotNode> dnlic(*m_children);
+ DotNode *cn;
+ for (dnlic.toFirst();(cn=dnlic.current());++dnlic)
+ {
+ cn->renumberNodes(number);
+ }
+ }
+}
+
const DotNode *DotNode::findDocNode() const
{
if (!m_url.isEmpty()) return this;
@@ -2266,15 +2235,13 @@ const DotNode *DotNode::findDocNode() const
//--------------------------------------------------------------------
-int DotGfxHierarchyTable::m_curNodeNumber;
-
void DotGfxHierarchyTable::createGraph(DotNode *n,FTextStream &out,
const char *path,const char *fileName,int id) const
{
QDir d(path);
QCString baseName;
QCString imgExt = getDotImageExtension();
- QCString imgFmt = Config_getEnum("DOT_IMAGE_FORMAT");
+ QCString imgFmt = Config_getEnum(DOT_IMAGE_FORMAT);
baseName.sprintf("inherit_graph_%d",id);
QCString imgName = baseName+"."+ imgExt;
QCString mapName = baseName+".map";
@@ -2300,11 +2267,10 @@ void DotGfxHierarchyTable::createGraph(DotNode *n,FTextStream &out,
{
if (node->m_subgraphId==n->m_subgraphId)
{
- node->write(md5stream,DotNode::Hierarchy,GOF_BITMAP,FALSE,TRUE,TRUE,TRUE);
+ node->write(md5stream,DotNode::Hierarchy,GOF_BITMAP,FALSE,TRUE,TRUE);
}
}
writeGraphFooter(md5stream);
- resetReNumbering();
uchar md5_sig[16];
QCString sigStr(33);
MD5Buffer((const unsigned char *)theGraph.data(),theGraph.length(),md5_sig);
@@ -2321,7 +2287,6 @@ void DotGfxHierarchyTable::createGraph(DotNode *n,FTextStream &out,
FTextStream t(&f);
t << theGraph;
f.close();
- resetReNumbering();
DotRunner *dotRun = new DotRunner(dotName,d.absPath().data(),TRUE,absImgName);
dotRun->addJob(imgFmt,absImgName);
@@ -2512,9 +2477,8 @@ void DotGfxHierarchyTable::addClassList(ClassSDict *cl)
}
}
-DotGfxHierarchyTable::DotGfxHierarchyTable()
+DotGfxHierarchyTable::DotGfxHierarchyTable() : m_curNodeNumber(0)
{
- m_curNodeNumber=0;
m_rootNodes = new QList<DotNode>;
m_usedNodes = new QDict<DotNode>(1009);
m_usedNodes->setAutoDelete(TRUE);
@@ -2556,15 +2520,17 @@ DotGfxHierarchyTable::DotGfxHierarchyTable()
}
//printf("Number of independent subgraphs: %d\n",curColor);
- //QListIterator<DotNode> dnli2(*m_rootSubgraphs);
- //DotNode *n;
- //for (dnli2.toFirst();(n=dnli2.current());++dnli2)
- //{
- // printf("Node %s color=%d (c=%d,p=%d)\n",
- // n->m_label.data(),n->m_subgraphId,
- // n->m_children?n->m_children->count():0,
- // n->m_parents?n->m_parents->count():0);
- //}
+ QListIterator<DotNode> dnli2(*m_rootSubgraphs);
+ DotNode *n;
+ for (dnli2.toFirst();(n=dnli2.current());++dnli2)
+ {
+ //printf("Node %s color=%d (c=%d,p=%d)\n",
+ // n->m_label.data(),n->m_subgraphId,
+ // n->m_children?n->m_children->count():0,
+ // n->m_parents?n->m_parents->count():0);
+ int number=0;
+ n->renumberNodes(number);
+ }
}
DotGfxHierarchyTable::~DotGfxHierarchyTable()
@@ -2585,12 +2551,10 @@ DotGfxHierarchyTable::~DotGfxHierarchyTable()
//--------------------------------------------------------------------
-int DotClassGraph::m_curNodeNumber = 0;
-
void DotClassGraph::addClass(ClassDef *cd,DotNode *n,int prot,
const char *label,const char *usedName,const char *templSpec,bool base,int distance)
{
- if (Config_getBool("HIDE_UNDOC_CLASSES") && !cd->isLinkable()) return;
+ if (Config_getBool(HIDE_UNDOC_CLASSES) && !cd->isLinkable()) return;
int edgeStyle = (label || prot==EdgeInfo::Orange || prot==EdgeInfo::Orange2) ? EdgeInfo::Dashed : EdgeInfo::Solid;
QCString className;
@@ -2632,7 +2596,7 @@ void DotClassGraph::addClass(ClassDef *cd,DotNode *n,int prot,
else // new class
{
QCString displayName=className;
- if (Config_getBool("HIDE_SCOPE_NAMES")) displayName=stripScope(displayName);
+ if (Config_getBool(HIDE_SCOPE_NAMES)) displayName=stripScope(displayName);
QCString tmp_url;
if (cd->isLinkable() && !cd->isHidden())
{
@@ -2719,7 +2683,7 @@ bool DotClassGraph::determineVisibleNodes(DotNode *rootNode,
// despite being marked visible in the child loop
while ((childQueue.count()>0 || parentQueue.count()>0) && maxNodes>0)
{
- static int maxDistance = Config_getInt("MAX_DOT_GRAPH_DEPTH");
+ static int maxDistance = Config_getInt(MAX_DOT_GRAPH_DEPTH);
if (childQueue.count()>0)
{
DotNode *n = childQueue.take(0);
@@ -2782,7 +2746,7 @@ bool DotClassGraph::determineVisibleNodes(DotNode *rootNode,
}
}
}
- if (Config_getBool("UML_LOOK")) return FALSE; // UML graph are always top to bottom
+ if (Config_getBool(UML_LOOK)) return FALSE; // UML graph are always top to bottom
int maxWidth=0;
int maxHeight=(int)QMAX(childTreeWidth.size(),parentTreeWidth.size());
uint i;
@@ -2803,7 +2767,7 @@ bool DotClassGraph::determineVisibleNodes(DotNode *rootNode,
void DotClassGraph::buildGraph(ClassDef *cd,DotNode *n,bool base,int distance)
{
- static bool templateRelations = Config_getBool("TEMPLATE_RELATIONS");
+ static bool templateRelations = Config_getBool(TEMPLATE_RELATIONS);
//printf("DocClassGraph::buildGraph(%s,distance=%d,base=%d)\n",
// cd->name().data(),distance,base);
// ---- Add inheritance relations
@@ -2936,6 +2900,13 @@ void DotClassGraph::buildGraph(ClassDef *cd,DotNode *n,bool base,int distance)
}
}
+int DotClassGraph::m_curNodeNumber = 0;
+
+void DotClassGraph::resetNumbering()
+{
+ m_curNodeNumber = 0;
+}
+
DotClassGraph::DotClassGraph(ClassDef *cd,DotNode::GraphType t)
{
//printf("--------------- DotClassGraph::DotClassGraph `%s'\n",cd->displayName().data());
@@ -2969,7 +2940,7 @@ DotClassGraph::DotClassGraph(ClassDef *cd,DotNode::GraphType t)
if (t==DotNode::Inheritance) buildGraph(cd,m_startNode,FALSE,1);
//}
- static int maxNodes = Config_getInt("DOT_GRAPH_MAX_NODES");
+ static int maxNodes = Config_getInt(DOT_GRAPH_MAX_NODES);
//int directChildNodes = 1;
//if (m_startNode->m_children!=0)
// directChildNodes+=m_startNode->m_children->count();
@@ -2982,12 +2953,13 @@ DotClassGraph::DotClassGraph(ClassDef *cd,DotNode::GraphType t)
openNodeQueue.append(m_startNode);
determineTruncatedNodes(openNodeQueue,t==DotNode::Inheritance);
- m_diskName = cd->getFileBase().copy();
+ m_collabFileName = cd->collaborationGraphFileName();
+ m_inheritFileName = cd->inheritanceGraphFileName();
}
bool DotClassGraph::isTrivial() const
{
- static bool umlLook = Config_getBool("UML_LOOK");
+ static bool umlLook = Config_getBool(UML_LOOK);
if (m_graphType==DotNode::Inheritance)
return m_startNode->m_children==0 && m_startNode->m_parents==0;
else
@@ -2996,7 +2968,7 @@ bool DotClassGraph::isTrivial() const
bool DotClassGraph::isTooBig() const
{
- static int maxNodes = Config_getInt("DOT_GRAPH_MAX_NODES");
+ static int maxNodes = Config_getInt(DOT_GRAPH_MAX_NODES);
int numNodes = 0;
numNodes+= m_startNode->m_children ? m_startNode->m_children->count() : 0;
if (m_graphType==DotNode::Inheritance)
@@ -3025,8 +2997,6 @@ QCString computeMd5Signature(DotNode *root,
QCString &graphStr
)
{
- bool reNumber=TRUE;
-
//printf("computeMd5Signature\n");
QGString buf;
FTextStream md5stream(&buf);
@@ -3041,8 +3011,7 @@ QCString computeMd5Signature(DotNode *root,
format,
gt!=DotNode::CallGraph && gt!=DotNode::Dependency,
TRUE,
- backArrows,
- reNumber);
+ backArrows);
if (renderParents && root->m_parents)
{
QListIterator<DotNode> dnli(*root->m_parents);
@@ -3057,8 +3026,7 @@ QCString computeMd5Signature(DotNode *root,
pn, // child node
pn->m_edgeInfo->at(pn->m_children->findRef(root)), // edge info
FALSE, // topDown?
- backArrows, // point back?
- reNumber // renumber nodes
+ backArrows // point back?
);
}
pn->write(md5stream, // stream
@@ -3066,8 +3034,7 @@ QCString computeMd5Signature(DotNode *root,
format, // output format
TRUE, // topDown?
FALSE, // toChildren?
- backArrows, // backward pointing arrows?
- reNumber // renumber nodes?
+ backArrows // backward pointing arrows?
);
}
}
@@ -3076,10 +3043,6 @@ QCString computeMd5Signature(DotNode *root,
QCString sigStr(33);
MD5Buffer((const unsigned char *)buf.data(),buf.length(),md5_sig);
MD5SigToString(md5_sig,sigStr.rawData(),33);
- if (reNumber)
- {
- resetReNumbering();
- }
graphStr=buf.data();
//printf("md5: %s | file: %s\n",sigStr,baseName.data());
return sigStr;
@@ -3109,27 +3072,6 @@ static bool updateDotGraph(DotNode *root,
return checkAndUpdateMd5Signature(baseName,md5); // graph needs to be regenerated
}
-QCString DotClassGraph::diskName() const
-{
- QCString result=m_diskName.copy();
- switch (m_graphType)
- {
- case DotNode::Collaboration:
- result+="_coll_graph";
- break;
- //case Interface:
- // result+="_intf_graph";
- // break;
- case DotNode::Inheritance:
- result+="_inherit_graph";
- break;
- default:
- ASSERT(0);
- break;
- }
- return result;
-}
-
QCString DotClassGraph::writeGraph(FTextStream &out,
GraphOutputFormat graphFormat,
EmbeddedOutputFormat textFormat,
@@ -3146,7 +3088,7 @@ QCString DotClassGraph::writeGraph(FTextStream &out,
{
err("Output dir %s does not exist!\n",path); exit(1);
}
- static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
+ static bool usePDFLatex = Config_getBool(USE_PDFLATEX);
QCString baseName;
QCString mapName;
@@ -3154,22 +3096,20 @@ QCString DotClassGraph::writeGraph(FTextStream &out,
{
case DotNode::Collaboration:
mapName="coll_map";
+ baseName=m_collabFileName;
break;
- //case Interface:
- // mapName="intf_map";
- // break;
case DotNode::Inheritance:
mapName="inherit_map";
+ baseName=m_inheritFileName;
break;
default:
ASSERT(0);
break;
}
- baseName = convertNameToFile(diskName());
// derive target file names from baseName
QCString imgExt = getDotImageExtension();
- QCString imgFmt = Config_getEnum("DOT_IMAGE_FORMAT");
+ QCString imgFmt = Config_getEnum(DOT_IMAGE_FORMAT);
QCString absBaseName = d.absPath().utf8()+"/"+baseName;
QCString absDotName = absBaseName+".dot";
QCString absMapName = absBaseName+".map";
@@ -3339,8 +3279,6 @@ void DotClassGraph::writeDEF(FTextStream &t)
//--------------------------------------------------------------------
-int DotInclDepGraph::m_curNodeNumber = 0;
-
void DotInclDepGraph::buildGraph(DotNode *n,FileDef *fd,int distance)
{
QList<IncludeInfo> *includeFiles =
@@ -3361,7 +3299,7 @@ void DotInclDepGraph::buildGraph(DotNode *n,FileDef *fd,int distance)
doc = bfd->isLinkable() && !bfd->isHidden();
src = bfd->generateSourceFile();
}
- if (doc || src || !Config_getBool("HIDE_UNDOC_RELATIONS"))
+ if (doc || src || !Config_getBool(HIDE_UNDOC_RELATIONS))
{
QCString url="";
if (bfd) url=bfd->getOutputFileBase().copy();
@@ -3409,7 +3347,7 @@ void DotInclDepGraph::determineVisibleNodes(QList<DotNode> &queue, int &maxNodes
{
while (queue.count()>0 && maxNodes>0)
{
- static int maxDistance = Config_getInt("MAX_DOT_GRAPH_DEPTH");
+ static int maxDistance = Config_getInt(MAX_DOT_GRAPH_DEPTH);
DotNode *n = queue.take(0);
if (!n->isVisible() && n->distance()<=maxDistance) // not yet processed
{
@@ -3454,13 +3392,20 @@ void DotInclDepGraph::determineTruncatedNodes(QList<DotNode> &queue)
}
}
+int DotInclDepGraph::m_curNodeNumber = 0;
+
+void DotInclDepGraph::resetNumbering()
+{
+ m_curNodeNumber = 0;
+}
DotInclDepGraph::DotInclDepGraph(FileDef *fd,bool inverse)
{
m_inverse = inverse;
ASSERT(fd!=0);
- m_diskName = fd->getFileBase().copy();
- QCString tmp_url=fd->getReference()+"$"+fd->getFileBase();
+ m_inclDepFileName = fd->includeDependencyGraphFileName();
+ m_inclByDepFileName = fd->includedByDependencyGraphFileName();
+ QCString tmp_url=fd->getReference()+"$"+fd->getOutputFileBase();
m_startNode = new DotNode(m_curNodeNumber++,
fd->docName(),
"",
@@ -3472,7 +3417,7 @@ DotInclDepGraph::DotInclDepGraph(FileDef *fd,bool inverse)
m_usedNodes->insert(fd->absFilePath(),m_startNode);
buildGraph(m_startNode,fd,1);
- static int nodes = Config_getInt("DOT_GRAPH_MAX_NODES");
+ static int nodes = Config_getInt(DOT_GRAPH_MAX_NODES);
int maxNodes = nodes;
//int directChildNodes = 1;
//if (m_startNode->m_children!=0)
@@ -3492,14 +3437,6 @@ DotInclDepGraph::~DotInclDepGraph()
delete m_usedNodes;
}
-QCString DotInclDepGraph::diskName() const
-{
- QCString result=m_diskName.copy();
- if (m_inverse) result+="_dep";
- result+="_incl";
- return convertNameToFile(result);
-}
-
QCString DotInclDepGraph::writeGraph(FTextStream &out,
GraphOutputFormat graphFormat,
EmbeddedOutputFormat textFormat,
@@ -3516,17 +3453,22 @@ QCString DotInclDepGraph::writeGraph(FTextStream &out,
{
err("Output dir %s does not exist!\n",path); exit(1);
}
- static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
+ static bool usePDFLatex = Config_getBool(USE_PDFLATEX);
- QCString baseName=m_diskName;
- if (m_inverse) baseName+="_dep";
- baseName+="_incl";
- baseName=convertNameToFile(baseName);
+ QCString baseName;
+ if (m_inverse)
+ {
+ baseName=m_inclByDepFileName;
+ }
+ else
+ {
+ baseName=m_inclDepFileName;
+ }
QCString mapName=escapeCharsInString(m_startNode->m_label,FALSE);
if (m_inverse) mapName+="dep";
QCString imgExt = getDotImageExtension();
- QCString imgFmt = Config_getEnum("DOT_IMAGE_FORMAT");
+ QCString imgFmt = Config_getEnum(DOT_IMAGE_FORMAT);
QCString absBaseName = d.absPath().utf8()+"/"+baseName;
QCString absDotName = absBaseName+".dot";
QCString absMapName = absBaseName+".map";
@@ -3640,7 +3582,7 @@ bool DotInclDepGraph::isTrivial() const
bool DotInclDepGraph::isTooBig() const
{
- static int maxNodes = Config_getInt("DOT_GRAPH_MAX_NODES");
+ static int maxNodes = Config_getInt(DOT_GRAPH_MAX_NODES);
int numNodes = m_startNode->m_children ? m_startNode->m_children->count() : 0;
return numNodes>=maxNodes;
}
@@ -3667,8 +3609,6 @@ void DotInclDepGraph::writeDocbook(FTextStream &t)
//-------------------------------------------------------------
-int DotCallGraph::m_curNodeNumber = 0;
-
void DotCallGraph::buildGraph(DotNode *n,MemberDef *md,int distance)
{
MemberSDict *refs = m_inverse ? md->getReferencedByMembers() : md->getReferencesMembers();
@@ -3693,7 +3633,7 @@ void DotCallGraph::buildGraph(DotNode *n,MemberDef *md,int distance)
else
{
QCString name;
- if (Config_getBool("HIDE_SCOPE_NAMES"))
+ if (Config_getBool(HIDE_SCOPE_NAMES))
{
name = rmd->getOuterScope()==m_scope ?
rmd->name() : rmd->qualifiedName();
@@ -3726,7 +3666,7 @@ void DotCallGraph::determineVisibleNodes(QList<DotNode> &queue, int &maxNodes)
{
while (queue.count()>0 && maxNodes>0)
{
- static int maxDistance = Config_getInt("MAX_DOT_GRAPH_DEPTH");
+ static int maxDistance = Config_getInt(MAX_DOT_GRAPH_DEPTH);
DotNode *n = queue.take(0);
if (!n->isVisible() && n->distance()<=maxDistance) // not yet processed
{
@@ -3771,7 +3711,12 @@ void DotCallGraph::determineTruncatedNodes(QList<DotNode> &queue)
}
}
+int DotCallGraph::m_curNodeNumber = 0;
+void DotCallGraph::resetNumbering()
+{
+ m_curNodeNumber = 0;
+}
DotCallGraph::DotCallGraph(MemberDef *md,bool inverse)
{
@@ -3782,7 +3727,7 @@ DotCallGraph::DotCallGraph(MemberDef *md,bool inverse)
uniqueId = md->getReference()+"$"+
md->getOutputFileBase()+"#"+md->anchor();
QCString name;
- if (Config_getBool("HIDE_SCOPE_NAMES"))
+ if (Config_getBool(HIDE_SCOPE_NAMES))
{
name = md->name();
}
@@ -3801,7 +3746,7 @@ DotCallGraph::DotCallGraph(MemberDef *md,bool inverse)
m_usedNodes->insert(uniqueId,m_startNode);
buildGraph(m_startNode,md,1);
- static int nodes = Config_getInt("DOT_GRAPH_MAX_NODES");
+ static int nodes = Config_getInt(DOT_GRAPH_MAX_NODES);
int maxNodes = nodes;
//int directChildNodes = 1;
//if (m_startNode->m_children!=0)
@@ -3833,13 +3778,13 @@ QCString DotCallGraph::writeGraph(FTextStream &out, GraphOutputFormat graphForma
{
err("Output dir %s does not exist!\n",path); exit(1);
}
- static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
+ static bool usePDFLatex = Config_getBool(USE_PDFLATEX);
QCString baseName = m_diskName + (m_inverse ? "_icgraph" : "_cgraph");
QCString mapName = baseName;
QCString imgExt = getDotImageExtension();
- QCString imgFmt = Config_getEnum("DOT_IMAGE_FORMAT");
+ QCString imgFmt = Config_getEnum(DOT_IMAGE_FORMAT);
QCString absBaseName = d.absPath().utf8()+"/"+baseName;
QCString absDotName = absBaseName+".dot";
QCString absMapName = absBaseName+".map";
@@ -3958,7 +3903,7 @@ bool DotCallGraph::isTrivial() const
bool DotCallGraph::isTooBig() const
{
- static int maxNodes = Config_getInt("DOT_GRAPH_MAX_NODES");
+ static int maxNodes = Config_getInt(DOT_GRAPH_MAX_NODES);
int numNodes = m_startNode->m_children ? m_startNode->m_children->count() : 0;
return numNodes>=maxNodes;
}
@@ -3990,13 +3935,13 @@ QCString DotDirDeps::writeGraph(FTextStream &out,
{
err("Output dir %s does not exist!\n",path); exit(1);
}
- static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
+ static bool usePDFLatex = Config_getBool(USE_PDFLATEX);
QCString baseName=m_dir->getOutputFileBase()+"_dep";
QCString mapName=escapeCharsInString(baseName,FALSE);
QCString imgExt = getDotImageExtension();
- QCString imgFmt = Config_getEnum("DOT_IMAGE_FORMAT");
+ QCString imgFmt = Config_getEnum(DOT_IMAGE_FORMAT);
QCString absBaseName = d.absPath().utf8()+"/"+baseName;
QCString absDotName = absBaseName+".dot";
QCString absMapName = absBaseName+".map";
@@ -4161,7 +4106,7 @@ void generateGraphLegend(const char *path)
QCString absBaseName = (QCString)path+"/graph_legend";
QCString absDotName = absBaseName+".dot";
QCString imgExt = getDotImageExtension();
- QCString imgFmt = Config_getEnum("DOT_IMAGE_FORMAT");
+ QCString imgFmt = Config_getEnum(DOT_IMAGE_FORMAT);
QCString imgName = "graph_legend."+imgExt;
QCString absImgName = absBaseName+"."+imgExt;
if (checkAndUpdateMd5Signature(absBaseName,sigStr) ||
@@ -4193,7 +4138,7 @@ void generateGraphLegend(const char *path)
if (imgExt=="svg")
{
DotManager::instance()->addSVGObject(
- absBaseName+Config_getString("HTML_FILE_EXTENSION"),
+ absBaseName+Config_getString(HTML_FILE_EXTENSION),
"graph_legend",
absImgName,QCString());
}
@@ -4210,7 +4155,7 @@ void writeDotGraphFromFile(const char *inFile,const char *outDir,
}
QCString imgExt = getDotImageExtension();
- QCString imgFmt = Config_getEnum("DOT_IMAGE_FORMAT");
+ QCString imgFmt = Config_getEnum(DOT_IMAGE_FORMAT);
QCString imgName = (QCString)outFile+"."+imgExt;
QCString absImgName = d.absPath().utf8()+"/"+imgName;
QCString absOutFile = d.absPath().utf8()+"/"+outFile;
@@ -4220,7 +4165,7 @@ void writeDotGraphFromFile(const char *inFile,const char *outDir,
dotRun.addJob(imgFmt,absImgName);
else // format==GOF_EPS
{
- if (Config_getBool("USE_PDFLATEX"))
+ if (Config_getBool(USE_PDFLATEX))
{
dotRun.addJob("pdf",absOutFile+".pdf");
}
@@ -4266,7 +4211,7 @@ void writeDotImageMapFromFile(FTextStream &t,
QCString mapName = baseName+".map";
QCString imgExt = getDotImageExtension();
- QCString imgFmt = Config_getEnum("DOT_IMAGE_FORMAT");
+ QCString imgFmt = Config_getEnum(DOT_IMAGE_FORMAT);
QCString imgName = baseName+"."+imgExt;
QCString absOutFile = d.absPath().utf8()+"/"+mapName;
@@ -4303,12 +4248,18 @@ void writeDotImageMapFromFile(FTextStream &t,
//-------------------------------------------------------------
+int DotGroupCollaboration::m_curNodeNumber = 0;
+
+void DotGroupCollaboration::resetNumbering()
+{
+ m_curNodeNumber = 0;
+}
+
DotGroupCollaboration::DotGroupCollaboration(GroupDef* gd)
{
- m_curNodeId = 0;
QCString tmp_url = gd->getReference()+"$"+gd->getOutputFileBase();
m_usedNodes = new QDict<DotNode>(1009);
- m_rootNode = new DotNode(m_curNodeId++, gd->groupTitle(), "", tmp_url, TRUE );
+ m_rootNode = new DotNode(m_curNodeNumber++, gd->groupTitle(), "", tmp_url, TRUE );
m_rootNode->markAsVisible();
m_usedNodes->insert(gd->name(), m_rootNode );
m_edges.setAutoDelete(TRUE);
@@ -4342,7 +4293,7 @@ void DotGroupCollaboration::buildGraph(GroupDef* gd)
{ // add node
tmp_url = d->getReference()+"$"+d->getOutputFileBase();
QCString tooltip = d->briefDescriptionAsTooltip();
- nnode = new DotNode(m_curNodeId++, d->groupTitle(), tooltip, tmp_url );
+ nnode = new DotNode(m_curNodeNumber++, d->groupTitle(), tooltip, tmp_url );
nnode->markAsVisible();
m_usedNodes->insert(d->name(), nnode );
}
@@ -4363,7 +4314,7 @@ void DotGroupCollaboration::buildGraph(GroupDef* gd)
{ // add node
tmp_url = def->getReference()+"$"+def->getOutputFileBase();
QCString tooltip = def->briefDescriptionAsTooltip();
- nnode = new DotNode(m_curNodeId++, def->groupTitle(), tooltip, tmp_url );
+ nnode = new DotNode(m_curNodeNumber++, def->groupTitle(), tooltip, tmp_url );
nnode->markAsVisible();
m_usedNodes->insert(def->name(), nnode );
}
@@ -4505,7 +4456,7 @@ void DotGroupCollaboration::addCollaborationMember(
{ // add node
tmp_str = d->getReference()+"$"+d->getOutputFileBase();
QCString tooltip = d->briefDescriptionAsTooltip();
- nnode = new DotNode(m_curNodeId++, d->groupTitle(), tooltip, tmp_str );
+ nnode = new DotNode(m_curNodeNumber++, d->groupTitle(), tooltip, tmp_str );
nnode->markAsVisible();
m_usedNodes->insert(d->name(), nnode );
}
@@ -4527,7 +4478,7 @@ QCString DotGroupCollaboration::writeGraph( FTextStream &t,
{
err("Output dir %s does not exist!\n",path); exit(1);
}
- static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
+ static bool usePDFLatex = Config_getBool(USE_PDFLATEX);
QGString theGraph;
FTextStream md5stream(&theGraph);
@@ -4544,7 +4495,7 @@ QCString DotGroupCollaboration::writeGraph( FTextStream &t,
// write other nodes.
for (dni.toFirst();(pn=dni.current());++dni)
{
- pn->write(md5stream,DotNode::Inheritance,graphFormat,TRUE,FALSE,FALSE,FALSE);
+ pn->write(md5stream,DotNode::Inheritance,graphFormat,TRUE,FALSE,FALSE);
}
// write edges
@@ -4556,13 +4507,12 @@ QCString DotGroupCollaboration::writeGraph( FTextStream &t,
}
writeGraphFooter(md5stream);
- resetReNumbering();
uchar md5_sig[16];
QCString sigStr(33);
MD5Buffer((const unsigned char *)theGraph.data(),theGraph.length(),md5_sig);
MD5SigToString(md5_sig,sigStr.rawData(),33);
QCString imgExt = getDotImageExtension();
- QCString imgFmt = Config_getEnum("DOT_IMAGE_FORMAT");
+ QCString imgFmt = Config_getEnum(DOT_IMAGE_FORMAT);
QCString baseName = m_diskName;
QCString imgName = baseName+"."+imgExt;
QCString absPath = d.absPath().data();
@@ -4756,7 +4706,7 @@ void DotGroupCollaboration::writeGraphHeader(FTextStream &t,
}
t << endl;
t << "{" << endl;
- if (Config_getBool("DOT_TRANSPARENT"))
+ if (Config_getBool(DOT_TRANSPARENT))
{
t << " bgcolor=\"transparent\";" << endl;
}
@@ -4769,7 +4719,7 @@ void DotGroupCollaboration::writeGraphHeader(FTextStream &t,
void writeDotDirDepGraph(FTextStream &t,DirDef *dd,bool linkRelations)
{
t << "digraph \"" << dd->displayName() << "\" {\n";
- if (Config_getBool("DOT_TRANSPARENT"))
+ if (Config_getBool(DOT_TRANSPARENT))
{
t << " bgcolor=transparent;\n";
}
@@ -4859,7 +4809,7 @@ void writeDotDirDepGraph(FTextStream &t,DirDef *dd,bool linkRelations)
<< usedDir->shortName() << "\"";
if (usedDir->isCluster())
{
- if (!Config_getBool("DOT_TRANSPARENT"))
+ if (!Config_getBool(DOT_TRANSPARENT))
{
t << " fillcolor=\"white\" style=\"filled\"";
}
@@ -4912,3 +4862,12 @@ void writeDotDirDepGraph(FTextStream &t,DirDef *dd,bool linkRelations)
t << "}\n";
}
+
+void resetDotNodeNumbering()
+{
+ DotClassGraph::resetNumbering();
+ DotInclDepGraph::resetNumbering();
+ DotCallGraph::resetNumbering();
+ DotGroupCollaboration::resetNumbering();
+}
+