summaryrefslogtreecommitdiffstats
path: root/src/dot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dot.cpp')
-rw-r--r--src/dot.cpp77
1 files changed, 47 insertions, 30 deletions
diff --git a/src/dot.cpp b/src/dot.cpp
index 4847d08..58a8a84 100644
--- a/src/dot.cpp
+++ b/src/dot.cpp
@@ -136,7 +136,7 @@ static bool convertMapFile(FTextStream &t,const char *mapName,
QFile f(mapName);
if (!f.open(IO_ReadOnly))
{
- err("Error opening map file %s for inclusion in the docs!\n"
+ err("error: problems opening map file %s for inclusion in the docs!\n"
"If you installed Graphviz/dot after a previous failing run, \n"
"try deleting the output directory and rerun doxygen.\n",mapName);
return FALSE;
@@ -158,7 +158,7 @@ static bool convertMapFile(FTextStream &t,const char *mapName,
QCString result;
if (urlOnly) // for user defined dot graphs
{
- if (link.left(5)=="\\ref ") // \ref url
+ if (link.left(5)=="\\ref " || link.left(5)=="@ref ") // \ref url
{
result="href=\"";
// fake ref node to resolve the url
@@ -390,7 +390,7 @@ static void checkDotResult(const QCString &imgName)
{
if (!(data[1]=='P' && data[2]=='N' && data[3]=='G'))
{
- err("Error! Image `%s' produced by dot is not a valid PNG!\n"
+ err("error: 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()
@@ -399,12 +399,12 @@ static void checkDotResult(const QCString &imgName)
}
else
{
- err("Error: Could not read image `%s' generated by dot!\n",imgName.data());
+ err("error: Could not read image `%s' generated by dot!\n",imgName.data());
}
}
else
{
- err("Error: Could not open image `%s' generated by dot!\n",imgName.data());
+ err("error: Could not open image `%s' generated by dot!\n",imgName.data());
}
}
}
@@ -429,6 +429,17 @@ static bool insertMapFile(FTextStream &out,const QCString &mapFile,
return FALSE; // no map file yet, need to generate it
}
+static void removeDotGraph(const QCString &dotName)
+{
+ static bool dotCleanUp = Config_getBool("DOT_CLEANUP");
+ if (dotCleanUp)
+ {
+ QDir d;
+ d.remove(dotName);
+ }
+}
+
+
/*! Checks if a file "baseName".md5 exists. If so the contents
* are compared with \a md5. If equal FALSE is returned. If the .md5
@@ -550,7 +561,7 @@ bool DotRunner::run()
}
if (!m_postCmd.isEmpty() && portable_system(m_postCmd,m_postArgs)!=0)
{
- err("Error: Problems running '%s' as a post-processing step for dot output\n",m_postCmd.data());
+ err("error: Problems running '%s' as a post-processing step for dot output\n",m_postCmd.data());
return FALSE;
}
if (m_checkResult) checkDotResult(m_imageName);
@@ -613,13 +624,13 @@ bool DotMapConverter::run()
QFile fo(m_patchFile);
if (!fi.open(IO_ReadOnly))
{
- err("Error opening file %s for patching!\n",tmpName.data());
+ err("error: problem opening file %s for patching!\n",tmpName.data());
QDir::current().rename(tmpName,m_patchFile);
return FALSE;
}
if (!fo.open(IO_WriteOnly))
{
- err("Error opening file %s for patching!\n",m_patchFile.data());
+ err("error: problem opening file %s for patching!\n",m_patchFile.data());
QDir::current().rename(tmpName,m_patchFile);
return FALSE;
}
@@ -1525,7 +1536,7 @@ void DotGfxHierarchyTable::writeGraph(FTextStream &out,
// store the original directory
if (!d.exists())
{
- err("Error: Output dir %s does not exist!\n",path); exit(1);
+ err("error: Output dir %s does not exist!\n",path); exit(1);
}
// put each connected subgraph of the hierarchy in a row of the HTML output
@@ -1575,7 +1586,7 @@ void DotGfxHierarchyTable::writeGraph(FTextStream &out,
MD5SigToString(md5_sig,sigStr.data(),33);
bool regenerate=FALSE;
if (checkAndUpdateMd5Signature(absBaseName,sigStr) ||
- !checkDeliverables(absMapName))
+ !checkDeliverables(absImgName,absMapName))
{
regenerate=TRUE;
// image was new or has changed
@@ -1591,7 +1602,10 @@ void DotGfxHierarchyTable::writeGraph(FTextStream &out,
dotRun->addJob(imgExt,absImgName);
dotRun->addJob(MAP_CMD,absMapName);
DotManager::instance()->addRun(dotRun);
-
+ }
+ else
+ {
+ removeDotGraph(absBaseName+".dot");
}
Doxygen::indexList.addImageFile(imgName);
// write image and map in a table row
@@ -2253,18 +2267,13 @@ static bool updateDotGraph(DotNode *root,
// TODO: write graph to theGraph, then compute md5 checksum
QCString md5 = computeMd5Signature(
root,gt,format,lrRank,renderParents,backArrows,theGraph);
- if (checkAndUpdateMd5Signature(baseName,md5)) // graph needs to be regenerated
+ QFile f(baseName+".dot");
+ if (f.open(IO_WriteOnly))
{
- QFile f;
- f.setName(baseName+".dot");
- if (f.open(IO_WriteOnly))
- {
- FTextStream t(&f);
- t << theGraph;
- }
- return TRUE;
+ FTextStream t(&f);
+ t << theGraph;
}
- return FALSE;
+ return checkAndUpdateMd5Signature(baseName,md5); // graph needs to be regenerated
}
QCString DotClassGraph::diskName() const
@@ -2300,7 +2309,7 @@ QCString DotClassGraph::writeGraph(FTextStream &out,
// store the original directory
if (!d.exists())
{
- err("Error: Output dir %s does not exist!\n",path); exit(1);
+ err("error: Output dir %s does not exist!\n",path); exit(1);
}
static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
@@ -2408,6 +2417,7 @@ QCString DotClassGraph::writeGraph(FTextStream &out,
out << endl << "% FIG " << figId << endl;
}
}
+ if (!regenerate) removeDotGraph(absDotName);
return baseName;
}
@@ -2610,7 +2620,7 @@ QCString DotInclDepGraph::writeGraph(FTextStream &out,
// store the original directory
if (!d.exists())
{
- err("Error: Output dir %s does not exist!\n",path); exit(1);
+ err("error: Output dir %s does not exist!\n",path); exit(1);
}
static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
@@ -2694,6 +2704,7 @@ QCString DotInclDepGraph::writeGraph(FTextStream &out,
out << endl << "% FIG " << figId << endl;
}
}
+ if (!regenerate) removeDotGraph(absDotName);
return baseName;
}
@@ -2885,7 +2896,7 @@ QCString DotCallGraph::writeGraph(FTextStream &out, GraphOutputFormat format,
// store the original directory
if (!d.exists())
{
- err("Error: Output dir %s does not exist!\n",path); exit(1);
+ err("error: Output dir %s does not exist!\n",path); exit(1);
}
static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
@@ -2967,6 +2978,7 @@ QCString DotCallGraph::writeGraph(FTextStream &out, GraphOutputFormat format,
out << endl << "% FIG " << figId << endl;
}
}
+ if (!regenerate) removeDotGraph(absDotName);
return baseName;
}
@@ -3004,7 +3016,7 @@ QCString DotDirDeps::writeGraph(FTextStream &out,
// store the original directory
if (!d.exists())
{
- err("Error: Output dir %s does not exist!\n",path); exit(1);
+ err("error: Output dir %s does not exist!\n",path); exit(1);
}
static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
@@ -3094,6 +3106,7 @@ QCString DotDirDeps::writeGraph(FTextStream &out,
out << endl << "% FIG " << figId << endl;
}
}
+ if (!regenerate) removeDotGraph(absDotName);
return baseName;
}
@@ -3111,7 +3124,7 @@ void generateGraphLegend(const char *path)
// store the original directory
if (!d.exists())
{
- err("Error: Output dir %s does not exist!\n",path); exit(1);
+ err("error: Output dir %s does not exist!\n",path); exit(1);
}
QGString theGraph;
@@ -3165,6 +3178,10 @@ void generateGraphLegend(const char *path)
dotRun->addJob(imgExt,absImgName);
DotManager::instance()->addRun(dotRun);
}
+ else
+ {
+ removeDotGraph(absDotName);
+ }
}
@@ -3174,7 +3191,7 @@ void writeDotGraphFromFile(const char *inFile,const char *outDir,
QDir d(outDir);
if (!d.exists())
{
- err("Error: Output dir %s does not exist!\n",outDir); exit(1);
+ err("error: Output dir %s does not exist!\n",outDir); exit(1);
}
QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
@@ -3214,7 +3231,6 @@ void writeDotGraphFromFile(const char *inFile,const char *outDir,
* dotfiles to generate image maps.
* \param inFile just the basename part of the filename
* \param outDir output directory
- * \param fileName file name in which the map will be embedded
* \param relPath relative path the to root of the output dir
* \param context the scope in which this graph is found (for resolving links)
* \returns a string which is the HTML image map (without the \<map\>\</map\>)
@@ -3227,7 +3243,7 @@ QCString getDotImageMapFromFile(const QCString& inFile, const QCString& outDir,
QDir d(outDir);
if (!d.exists())
{
- err("Error: Output dir %s does not exist!\n",outDir.data()); exit(1);
+ err("error: Output dir %s does not exist!\n",outDir.data()); exit(1);
}
QCString absInFile = QCString(d.absPath())+"/"+inFile;
@@ -3469,7 +3485,7 @@ QCString DotGroupCollaboration::writeGraph( FTextStream &t, GraphOutputFormat fo
// store the original directory
if (!d.exists())
{
- err("Error: Output dir %s does not exist!\n",path); exit(1);
+ err("error: Output dir %s does not exist!\n",path); exit(1);
}
static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
@@ -3581,6 +3597,7 @@ QCString DotGroupCollaboration::writeGraph( FTextStream &t, GraphOutputFormat fo
t << endl << "% FIG " << figId << endl;
}
}
+ if (!regenerate) removeDotGraph(absDotName);
return baseName;
}