Skip to content

Commit 99f9fc7

Browse files
committed
issue #8193: Better warning in case of error in dot / msc / dia image
1 parent e593b17 commit 99f9fc7

22 files changed

+321
-249
lines changed

src/dia.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
static const int maxCmdLine = 40960;
2525

2626
void writeDiaGraphFromFile(const QCString &inFile,const QCString &outDir,
27-
const QCString &outFile,DiaOutputFormat format)
27+
const QCString &outFile,DiaOutputFormat format,
28+
const QCString &srcFile,int srcLine)
2829
{
2930
QCString absOutFile = outDir;
3031
absOutFile+=Portable::pathSeparator();
@@ -63,7 +64,7 @@ void writeDiaGraphFromFile(const QCString &inFile,const QCString &outDir,
6364
Portable::sysTimerStart();
6465
if ((exitCode=Portable::system(diaExe,diaArgs,FALSE))!=0)
6566
{
66-
err("Problems running %s. Check your installation or look typos in you dia file %s\n",
67+
err_full(srcFile,srcLine,"Problems running %s. Check your installation or look typos in you dia file %s\n",
6768
qPrint(diaExe),qPrint(inFile));
6869
Portable::sysTimerStop();
6970
goto error;

src/dia.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ class QCString;
2323
enum DiaOutputFormat { DIA_BITMAP , DIA_EPS };
2424

2525
void writeDiaGraphFromFile(const QCString &inFile,const QCString &outDir,
26-
const QCString &outFile,DiaOutputFormat format);
26+
const QCString &outFile,DiaOutputFormat format,
27+
const QCString &srcFile,int srcLine);
2728

2829
#endif
2930

src/docbookvisitor.cpp

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ DB_VIS_C
400400
case DocVerbatim::PlantUML:
401401
{
402402
static QCString docbookOutput = Config_getString(DOCBOOK_OUTPUT);
403-
QCString baseName = PlantumlManager::instance().writePlantUMLSource(docbookOutput,s->exampleFile(),s->text(),PlantumlManager::PUML_BITMAP,s->engine());
403+
QCString baseName = PlantumlManager::instance().writePlantUMLSource(docbookOutput,s->exampleFile(),s->text(),PlantumlManager::PUML_BITMAP,s->engine(),s->srcFile(),s->srcLine());
404404
QCString shortName = baseName;
405405
int i;
406406
if ((i=shortName.findRev('/'))!=-1)
@@ -1269,7 +1269,7 @@ void DocbookDocVisitor::visitPre(DocDotFile *df)
12691269
{
12701270
DB_VIS_C
12711271
if (m_hide) return;
1272-
startDotFile(df->file(),df->width(),df->height(),df->hasCaption(),df->children());
1272+
startDotFile(df->file(),df->width(),df->height(),df->hasCaption(),df->children(),df->srcFile(),df->srcLine());
12731273
}
12741274

12751275
void DocbookDocVisitor::visitPost(DocDotFile *df)
@@ -1283,7 +1283,7 @@ void DocbookDocVisitor::visitPre(DocMscFile *df)
12831283
{
12841284
DB_VIS_C
12851285
if (m_hide) return;
1286-
startMscFile(df->file(),df->width(),df->height(),df->hasCaption(),df->children());
1286+
startMscFile(df->file(),df->width(),df->height(),df->hasCaption(),df->children(),df->srcFile(),df->srcLine());
12871287
}
12881288

12891289
void DocbookDocVisitor::visitPost(DocMscFile *df)
@@ -1296,7 +1296,7 @@ void DocbookDocVisitor::visitPre(DocDiaFile *df)
12961296
{
12971297
DB_VIS_C
12981298
if (m_hide) return;
1299-
startDiaFile(df->file(),df->width(),df->height(),df->hasCaption(),df->children());
1299+
startDiaFile(df->file(),df->width(),df->height(),df->hasCaption(),df->children(),df->srcFile(),df->srcLine());
13001300
}
13011301

13021302
void DocbookDocVisitor::visitPost(DocDiaFile *df)
@@ -1634,7 +1634,7 @@ DB_VIS_C
16341634
shortName=shortName.right((int)shortName.length()-i-1);
16351635
}
16361636
QCString outDir = Config_getString(DOCBOOK_OUTPUT);
1637-
writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_BITMAP);
1637+
writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_BITMAP,s->srcFile(),s->srcLine());
16381638
visitPreStart(m_t, s->children(), s->hasCaption(), s->relPath() + shortName + ".png", s->width(), s->height());
16391639
visitCaption(s->children());
16401640
visitPostEnd(m_t, s->hasCaption());
@@ -1660,7 +1660,9 @@ void DocbookDocVisitor::startMscFile(const QCString &fileName,
16601660
const QCString &width,
16611661
const QCString &height,
16621662
bool hasCaption,
1663-
const DocNodeList &children
1663+
const DocNodeList &children,
1664+
const QCString &srcFile,
1665+
int srcLine
16641666
)
16651667
{
16661668
DB_VIS_C
@@ -1676,7 +1678,7 @@ DB_VIS_C
16761678
}
16771679
baseName.prepend("msc_");
16781680
QCString outDir = Config_getString(DOCBOOK_OUTPUT);
1679-
writeMscGraphFromFile(fileName,outDir,baseName,MSC_BITMAP);
1681+
writeMscGraphFromFile(fileName,outDir,baseName,MSC_BITMAP,srcFile,srcLine);
16801682
m_t << "<para>\n";
16811683
visitPreStart(m_t, children, hasCaption, baseName + ".png", width, height);
16821684
}
@@ -1699,7 +1701,7 @@ DB_VIS_C
16991701
shortName=shortName.right((int)shortName.length()-i-1);
17001702
}
17011703
QCString outDir = Config_getString(DOCBOOK_OUTPUT);
1702-
writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_BITMAP);
1704+
writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_BITMAP,s->srcFile(),s->srcLine());
17031705
visitPreStart(m_t, s->children(), s->hasCaption(), shortName, s->width(),s->height());
17041706
visitCaption(s->children());
17051707
visitPostEnd(m_t, s->hasCaption());
@@ -1709,7 +1711,9 @@ void DocbookDocVisitor::startDiaFile(const QCString &fileName,
17091711
const QCString &width,
17101712
const QCString &height,
17111713
bool hasCaption,
1712-
const DocNodeList &children
1714+
const DocNodeList &children,
1715+
const QCString &srcFile,
1716+
int srcLine
17131717
)
17141718
{
17151719
DB_VIS_C
@@ -1725,7 +1729,7 @@ DB_VIS_C
17251729
}
17261730
baseName.prepend("dia_");
17271731
QCString outDir = Config_getString(DOCBOOK_OUTPUT);
1728-
writeDiaGraphFromFile(fileName,outDir,baseName,DIA_BITMAP);
1732+
writeDiaGraphFromFile(fileName,outDir,baseName,DIA_BITMAP,srcFile,srcLine);
17291733
m_t << "<para>\n";
17301734
visitPreStart(m_t, children, hasCaption, baseName + ".png", width, height);
17311735
}
@@ -1748,7 +1752,7 @@ DB_VIS_C
17481752
shortName=shortName.right((int)shortName.length()-i-1);
17491753
}
17501754
QCString outDir = Config_getString(DOCBOOK_OUTPUT);
1751-
writeDotGraphFromFile(baseName+".dot",outDir,shortName,GOF_BITMAP);
1755+
writeDotGraphFromFile(baseName+".dot",outDir,shortName,GOF_BITMAP,s->srcFile(),s->srcLine());
17521756
visitPreStart(m_t, s->children(), s->hasCaption(), s->relPath() + shortName + "." + getDotImageExtension(), s->width(),s->height());
17531757
visitCaption(s->children());
17541758
visitPostEnd(m_t, s->hasCaption());
@@ -1758,7 +1762,9 @@ void DocbookDocVisitor::startDotFile(const QCString &fileName,
17581762
const QCString &width,
17591763
const QCString &height,
17601764
bool hasCaption,
1761-
const DocNodeList &children
1765+
const DocNodeList &children,
1766+
const QCString &srcFile,
1767+
int srcLine
17621768
)
17631769
{
17641770
DB_VIS_C
@@ -1775,7 +1781,7 @@ DB_VIS_C
17751781
baseName.prepend("dot_");
17761782
QCString outDir = Config_getString(DOCBOOK_OUTPUT);
17771783
QCString imgExt = getDotImageExtension();
1778-
writeDotGraphFromFile(fileName,outDir,baseName,GOF_BITMAP);
1784+
writeDotGraphFromFile(fileName,outDir,baseName,GOF_BITMAP,srcFile,srcLine);
17791785
m_t << "<para>\n";
17801786
visitPreStart(m_t, children, hasCaption, baseName + "." + imgExt, width, height);
17811787
}

src/docbookvisitor.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,18 @@ class DocbookDocVisitor : public DocVisitor
144144
const QCString &anchor);
145145
void endLink();
146146
void startMscFile(const QCString &fileName,const QCString &width,
147-
const QCString &height, bool hasCaption,const DocNodeList &children);
147+
const QCString &height, bool hasCaption,const DocNodeList &children,
148+
const QCString &srcFile, int srcLine);
148149
void endMscFile(bool hasCaption);
149150
void writeMscFile(const QCString &fileName, DocVerbatim *s);
150151
void startDiaFile(const QCString &fileName,const QCString &width,
151-
const QCString &height, bool hasCaption,const DocNodeList &children);
152+
const QCString &height, bool hasCaption,const DocNodeList &children,
153+
const QCString &srcFile, int srcLine);
152154
void endDiaFile(bool hasCaption);
153155
void writeDiaFile(const QCString &fileName, DocVerbatim *s);
154156
void startDotFile(const QCString &fileName,const QCString &width,
155-
const QCString &height, bool hasCaption,const DocNodeList &children);
157+
const QCString &height, bool hasCaption,const DocNodeList &children,
158+
const QCString &srcFile, int srcLine);
156159
void endDotFile(bool hasCaption);
157160
void writeDotFile(const QCString &fileName, DocVerbatim *s);
158161
void writePlantUMLFile(const QCString &fileName, DocVerbatim *s);

src/docparser.cpp

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2720,9 +2720,11 @@ QCString DocLink::parse(bool isJavaLink,bool isXmlLink)
27202720

27212721
//---------------------------------------------------------------------------
27222722

2723-
DocDotFile::DocDotFile(DocNode *parent,const QCString &name,const QCString &context) :
2724-
m_name(name), m_relPath(g_relPath), m_context(context)
2723+
DocDotFile::DocDotFile(DocNode *parent,const QCString &name,const QCString &context,
2724+
const QCString &srcFile,int srcLine) :
2725+
DocDiagramFileBase(name,context,srcFile,srcLine)
27252726
{
2727+
m_relPath = g_relPath;
27262728
m_parent = parent;
27272729
}
27282730

@@ -2757,9 +2759,11 @@ bool DocDotFile::parse()
27572759
return ok;
27582760
}
27592761

2760-
DocMscFile::DocMscFile(DocNode *parent,const QCString &name,const QCString &context) :
2761-
m_name(name), m_relPath(g_relPath), m_context(context)
2762+
DocMscFile::DocMscFile(DocNode *parent,const QCString &name,const QCString &context,
2763+
const QCString &srcFile, int srcLine) :
2764+
DocDiagramFileBase(name,context,srcFile,srcLine)
27622765
{
2766+
m_relPath = g_relPath;
27632767
m_parent = parent;
27642768
}
27652769

@@ -2796,9 +2800,11 @@ bool DocMscFile::parse()
27962800

27972801
//---------------------------------------------------------------------------
27982802

2799-
DocDiaFile::DocDiaFile(DocNode *parent,const QCString &name,const QCString &context) :
2800-
m_name(name), m_relPath(g_relPath), m_context(context)
2803+
DocDiaFile::DocDiaFile(DocNode *parent,const QCString &name,const QCString &context,
2804+
const QCString &srcFile,int srcLine) :
2805+
DocDiagramFileBase(name,context,srcFile,srcLine)
28012806
{
2807+
m_relPath = g_relPath;
28022808
m_parent = parent;
28032809
}
28042810

@@ -5016,7 +5022,7 @@ void DocPara::handleFile(const QCString &cmdName)
50165022
return;
50175023
}
50185024
QCString name = g_token->name;
5019-
T *df = new T(this,name,g_context);
5025+
T *df = new T(this,name,g_context,g_fileName,getDoctokinizerLineNr());
50205026
if (df->parse())
50215027
{
50225028
m_children.push_back(std::unique_ptr<T>(df));
@@ -5550,6 +5556,7 @@ int DocPara::handleCommand(const QCString &cmdName, const int tok)
55505556
dv->setText(g_token->verb);
55515557
dv->setWidth(width);
55525558
dv->setHeight(height);
5559+
dv->setLocation(g_fileName,getDoctokinizerLineNr());
55535560
m_children.push_back(std::unique_ptr<DocVerbatim>(dv));
55545561
if (retval==0) warn_doc_error(g_fileName,getDoctokinizerLineNr(),"dot section ended without end marker");
55555562
doctokenizerYYsetStatePara();
@@ -5566,6 +5573,7 @@ int DocPara::handleCommand(const QCString &cmdName, const int tok)
55665573
dv->setText(g_token->verb);
55675574
dv->setWidth(width);
55685575
dv->setHeight(height);
5576+
dv->setLocation(g_fileName,getDoctokinizerLineNr());
55695577
m_children.push_back(std::unique_ptr<DocVerbatim>(dv));
55705578
if (retval==0) warn_doc_error(g_fileName,getDoctokinizerLineNr(),"msc section ended without end marker");
55715579
doctokenizerYYsetStatePara();
@@ -5642,6 +5650,7 @@ int DocPara::handleCommand(const QCString &cmdName, const int tok)
56425650
dv->setText(stripLeadingAndTrailingEmptyLines(g_token->verb,line));
56435651
dv->setWidth(width);
56445652
dv->setHeight(height);
5653+
dv->setLocation(g_fileName,getDoctokinizerLineNr());
56455654
if (jarPath.isEmpty())
56465655
{
56475656
warn_doc_error(g_fileName,getDoctokinizerLineNr(),"ignoring \\startuml command because PLANTUML_JAR_PATH is not set");

0 commit comments

Comments
 (0)