summaryrefslogtreecommitdiff
path: root/src/dot.cpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-10-15 10:52:56 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-10-15 10:52:56 +0900
commitdcd93df0217323e30905987ff42937c10e512c1a (patch)
tree2d6f454acb7fd25f3605f4878f752241992efe36 /src/dot.cpp
parent0efe600d6f0659af7bae9047301dd60983e18a6e (diff)
downloaddoxygen-dcd93df0217323e30905987ff42937c10e512c1a.tar.gz
doxygen-dcd93df0217323e30905987ff42937c10e512c1a.tar.bz2
doxygen-dcd93df0217323e30905987ff42937c10e512c1a.zip
Imported Upstream version 1.8.11upstream/1.8.11
Diffstat (limited to 'src/dot.cpp')
-rw-r--r--src/dot.cpp113
1 files changed, 59 insertions, 54 deletions
diff --git a/src/dot.cpp b/src/dot.cpp
index 705aa27..0a4f136 100644
--- a/src/dot.cpp
+++ b/src/dot.cpp
@@ -659,10 +659,9 @@ static bool writeSVGFigureLink(FTextStream &out,const QCString &relPath,
// since dot silently reproduces the input file when it does not
// support the PNG format, we need to check the result.
-static void checkDotResult(const QCString &imgName)
+static void checkDotResult(const char *imgExt, const char *imgName)
{
- QCString imgExt = getDotImageExtension();
- if (imgExt=="png")
+ if (qstrcmp(imgExt,"png")==0)
{
FILE *f = portable_fopen(imgName,"rb");
if (f)
@@ -675,19 +674,19 @@ static void checkDotResult(const QCString &imgName)
err("Image `%s' produced by dot is not a valid PNG!\n"
"You should either select a different format "
"(DOT_IMAGE_FORMAT in the config file) or install a more "
- "recent version of graphviz (1.7+)\n",imgName.data()
+ "recent version of graphviz (1.7+)\n",imgName
);
}
}
else
{
- err("Could not read image `%s' generated by dot!\n",imgName.data());
+ err("Could not read image `%s' generated by dot!\n",imgName);
}
fclose(f);
}
else
{
- err("Could not open image `%s' generated by dot!\n",imgName.data());
+ err("Could not open image `%s' generated by dot!\n",imgName);
}
}
}
@@ -793,54 +792,46 @@ int DotNodeList::compareValues(const DotNode *n1,const DotNode *n2) const
DotRunner::DotRunner(const QCString &file,const QCString &path,
bool checkResult,const QCString &imageName)
- : m_file(file), m_path(path),
- m_checkResult(checkResult), m_imageName(imageName)
-{
- static bool dotCleanUp = Config_getBool("DOT_CLEANUP");
- m_cleanUp = dotCleanUp;
+ : 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");
+ m_cleanUp = dotCleanUp;
+ m_multiTargets = dotMultiTargets;
m_jobs.setAutoDelete(TRUE);
}
void DotRunner::addJob(const char *format,const char *output)
{
QCString args = QCString("-T")+format+" -o \""+output+"\"";
- m_jobs.append(new QCString(args));
+ m_jobs.append(new DotConstString(args));
}
void DotRunner::addPostProcessing(const char *cmd,const char *args)
{
- m_postCmd = cmd;
- m_postArgs = args;
+ m_postCmd.set(cmd);
+ m_postArgs.set(args);
}
bool DotRunner::run()
{
int exitCode=0;
- // we need to use data here to make a copy of the string, as Config_getString can be called by
- // multiple threads simulaneously and the reference counting is not thread safe.
- QCString dotExe = Config_getString("DOT_PATH").data();
- dotExe+="dot";
- bool multiTargets = Config_getBool("DOT_MULTI_TARGETS");
QCString dotArgs;
- QListIterator<QCString> li(m_jobs);
- QCString *s;
- QCString file = m_file;
- QCString path = m_path;
- QCString imageName = m_imageName;
- QCString postCmd = m_postCmd;
- QCString postArgs = m_postArgs;
- bool checkResult = m_checkResult;
- bool cleanUp = m_cleanUp;
- if (multiTargets)
- {
- dotArgs="\""+file+"\"";
+ QListIterator<DotConstString> li(m_jobs);
+ DotConstString *s;
+ if (m_multiTargets)
+ {
+ dotArgs=QCString("\"")+m_file.data()+"\"";
for (li.toFirst();(s=li.current());++li)
{
dotArgs+=' ';
- dotArgs+=*s;
+ dotArgs+=s->data();
}
- if ((exitCode=portable_system(dotExe,dotArgs,FALSE))!=0)
+ if ((exitCode=portable_system(m_dotExe.data(),dotArgs,FALSE))!=0)
{
goto error;
}
@@ -849,30 +840,33 @@ bool DotRunner::run()
{
for (li.toFirst();(s=li.current());++li)
{
- dotArgs="\""+file+"\" "+*s;
- if ((exitCode=portable_system(dotExe,dotArgs,FALSE))!=0)
+ dotArgs=QCString("\"")+m_file.data()+"\" "+s->data();
+ if ((exitCode=portable_system(m_dotExe.data(),dotArgs,FALSE))!=0)
{
goto error;
}
}
}
- if (!postCmd.isEmpty() && portable_system(postCmd,postArgs)!=0)
+ if (!m_postCmd.isEmpty() && portable_system(m_postCmd.data(),m_postArgs.data())!=0)
{
err("Problems running '%s' as a post-processing step for dot output\n",m_postCmd.data());
return FALSE;
}
- if (checkResult) checkDotResult(imageName);
- if (cleanUp)
+ if (m_checkResult)
+ {
+ checkDotResult(m_imgExt.data(),m_imageName.data());
+ }
+ if (m_cleanUp)
{
//printf("removing dot file %s\n",m_file.data());
//QDir(path).remove(file);
- m_cleanupItem.file = file;
- m_cleanupItem.path = path;
+ m_cleanupItem.file.set(m_file.data());
+ m_cleanupItem.path.set(m_path.data());
}
return TRUE;
error:
err("Problems running dot: exit code=%d, command='%s', arguments='%s'\n",
- exitCode,dotExe.data(),dotArgs.data());
+ exitCode,m_dotExe.data(),dotArgs.data());
return FALSE;
}
@@ -1202,7 +1196,7 @@ void DotWorkerThread::run()
while ((runner=m_queue->dequeue()))
{
runner->run();
- DotRunner::CleanupItem cleanup = runner->cleanup();
+ const DotRunner::CleanupItem &cleanup = runner->cleanup();
if (!cleanup.file.isEmpty())
{
m_cleanupItems.append(new DotRunner::CleanupItem(cleanup));
@@ -1216,7 +1210,7 @@ void DotWorkerThread::cleanup()
DotRunner::CleanupItem *ci;
for (;(ci=it.current());++it)
{
- QDir(ci->path).remove(ci->file);
+ QDir(ci->path.data()).remove(ci->file.data());
}
}
@@ -2600,7 +2594,12 @@ void DotClassGraph::addClass(ClassDef *cd,DotNode *n,int prot,
int edgeStyle = (label || prot==EdgeInfo::Orange || prot==EdgeInfo::Orange2) ? EdgeInfo::Dashed : EdgeInfo::Solid;
QCString className;
- if (usedName) // name is a typedef
+ if (cd->isAnonymous())
+ {
+ className="anonymous:";
+ className+=label;
+ }
+ else if (usedName) // name is a typedef
{
className=usedName;
}
@@ -2828,9 +2827,9 @@ void DotClassGraph::buildGraph(ClassDef *cd,DotNode *n,bool base,int distance)
if (m_graphType == DotNode::Collaboration)
{
// ---- Add usage relations
-
- UsesClassDict *dict =
- base ? cd->usedImplementationClasses() :
+
+ UsesClassDict *dict =
+ base ? cd->usedImplementationClasses() :
cd->usedByImplementationClasses()
;
if (dict)
@@ -3965,6 +3964,7 @@ bool DotCallGraph::isTooBig() const
}
//-------------------------------------------------------------
+static void writeDotDirDepGraph(FTextStream &t,DirDef *dd,bool linkRelations);
DotDirDeps::DotDirDeps(DirDef *dir) : m_dir(dir)
{
@@ -3981,7 +3981,8 @@ QCString DotDirDeps::writeGraph(FTextStream &out,
const char *fileName,
const char *relPath,
bool generateImageMap,
- int graphId) const
+ int graphId,
+ bool linkRelations) const
{
QDir d(path);
// store the original directory
@@ -4006,7 +4007,8 @@ QCString DotDirDeps::writeGraph(FTextStream &out,
// compute md5 checksum of the graph were are about to generate
QGString theGraph;
FTextStream md5stream(&theGraph);
- m_dir->writeDepGraph(md5stream);
+ //m_dir->writeDepGraph(md5stream);
+ writeDotDirDepGraph(md5stream,m_dir,linkRelations);
uchar md5_sig[16];
QCString sigStr(33);
MD5Buffer((const unsigned char *)theGraph.data(),theGraph.length(),md5_sig);
@@ -4234,7 +4236,7 @@ void writeDotGraphFromFile(const char *inFile,const char *outDir,
return;
}
- if (format==GOF_BITMAP) checkDotResult(absImgName);
+ if (format==GOF_BITMAP) checkDotResult(getDotImageExtension(),absImgName);
Doxygen::indexList->addImageFile(imgName);
@@ -4764,7 +4766,7 @@ void DotGroupCollaboration::writeGraphHeader(FTextStream &t,
t << " rankdir=LR;\n";
}
-void writeDotDirDepGraph(FTextStream &t,DirDef *dd)
+void writeDotDirDepGraph(FTextStream &t,DirDef *dd,bool linkRelations)
{
t << "digraph \"" << dd->displayName() << "\" {\n";
if (Config_getBool("DOT_TRANSPARENT"))
@@ -4896,11 +4898,14 @@ void writeDotDirDepGraph(FTextStream &t,DirDef *dd)
new DirRelation(relationName,dir,udir));
}
int nrefs = udir->filePairs().count();
- t << " " << dir->getOutputFileBase() << "->"
+ t << " " << dir->getOutputFileBase() << "->"
<< usedDir->getOutputFileBase();
t << " [headlabel=\"" << nrefs << "\", labeldistance=1.5";
- t << " headhref=\"" << relationName << Doxygen::htmlFileExtension
- << "\"];\n";
+ if (linkRelations)
+ {
+ t << " headhref=\"" << relationName << Doxygen::htmlFileExtension << "\"";
+ }
+ t << "];\n";
}
}
}