summaryrefslogtreecommitdiffstats
path: root/src/vhdldocgen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/vhdldocgen.cpp')
-rw-r--r--src/vhdldocgen.cpp160
1 files changed, 130 insertions, 30 deletions
diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp
index 3ea9b18..d09de09 100644
--- a/src/vhdldocgen.cpp
+++ b/src/vhdldocgen.cpp
@@ -27,10 +27,7 @@
#include <qcstring.h>
#include <qfileinfo.h>
#include <qstringlist.h>
-
-//#ifdef DEBUGFLOW
#include <qmap.h>
-//#endif
/* --------------------------------------------------------------- */
@@ -47,7 +44,6 @@
#include "searchindex.h"
#include "outputlist.h"
#include "parserintf.h"
-
#include "layout.h"
#include "arguments.h"
#include "portable.h"
@@ -59,11 +55,12 @@
#include "filename.h"
#include "membergroup.h"
#include "memberdef.h"
-
+#include "plantuml.h"
#include "vhdljjparser.h"
#include "VhdlParser.h"
-
#include "vhdlcode.h"
+#include "plantuml.h"
+//#define DEBUGFLOW
#define theTranslator_vhdlType VhdlDocGen::trVhdlType
static QDict<QCString> g_vhdlKeyDict0(17,FALSE);
@@ -95,7 +92,7 @@ void VhdlDocGen::setFlowMember( const MemberDef* mem)
flowMember=mem;
}
-const MemberDef* VhdlDocGen::getFlowMember()
+ const MemberDef* VhdlDocGen::getFlowMember()
{
return flowMember;
}
@@ -165,7 +162,7 @@ static int compareString(const QCString& s1,const QCString& s2)
static void createSVG()
{
- QCString ov =Config_getString("HTML_OUTPUT");
+ QCString ov =Config_getString(HTML_OUTPUT);
QCString dir="-o \""+ov+"/vhdl_design_overview.html\"";
ov+="/vhdl_design.dot";
@@ -195,7 +192,7 @@ void VhdlDocGen::writeOverview()
if (!found) return;
- QCString ov =Config_getString("HTML_OUTPUT");
+ QCString ov =Config_getString(HTML_OUTPUT);
QCString fileName=ov+"/vhdl_design.dot";
QFile f(fileName);
FTextStream t(&f);
@@ -573,7 +570,7 @@ VhdlDocGen::~VhdlDocGen()
void VhdlDocGen::init()
{
- // vhdl keywords inlcuded VHDL 2008
+ // vhdl keywords included VHDL 2008
const char* g_vhdlKeyWordMap0[] =
{
"abs","access","after","alias","all","and","architecture","array","assert","assume","assume_guarantee","attribute",
@@ -843,7 +840,7 @@ MemberDef* VhdlDocGen::findMemberDef(ClassDef* cd,const QCString& key,MemberList
}
MemberListIterator fmni(*ml);
//int l=ml->count();
- // fprintf(stderr,"\n loading enity %s %s: %d",cd->symbolName().data(),keyType.data(),l);
+ // fprintf(stderr,"\n loading entity %s %s: %d",cd->symbolName().data(),keyType.data(),l);
for (fmni.toFirst();(md=fmni.current());++fmni)
{
@@ -1068,7 +1065,7 @@ void VhdlDocGen::writeInlineClassLink(const ClassDef* cd ,OutputList& ol)
}// write
/*
- * finds all architectures which belongs to an entiy
+ * finds all architectures which belongs to an entity
*/
void VhdlDocGen::findAllArchitectures(QList<QCString>& qll,const ClassDef *cd)
{
@@ -1992,7 +1989,7 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
QCString cfname = d->getOutputFileBase();
//HtmlHelp *htmlHelp=0;
- // bool hasHtmlHelp = Config_getBool("GENERATE_HTML") && Config_getBool("GENERATE_HTMLHELP");
+ // bool hasHtmlHelp = Config_getBool(GENERATE_HTML) && Config_getBool(GENERATE_HTMLHELP);
// if (hasHtmlHelp) htmlHelp = HtmlHelp::getInstance();
// search for the last anonymous scope in the member type
@@ -2245,7 +2242,7 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
}
bool htmlOn = ol.isEnabled(OutputGenerator::Html);
- if (htmlOn && /*Config_getBool("HTML_ALIGN_MEMBERS") &&*/ !ltype.isEmpty())
+ if (htmlOn && /*Config_getBool(HTML_ALIGN_MEMBERS) &&*/ !ltype.isEmpty())
{
ol.disable(OutputGenerator::Html);
}
@@ -2264,12 +2261,13 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
// name().data(),annoClassDef,annEnumType);
// if(mm!=VhdlDocGen::MISCELLANEOUS)
ol.endMemberItem();
- if (!mdef->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC") /* && !annMemb */)
+ if (!mdef->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC) /* && !annMemb */)
{
- ol.startMemberDescription(mdef->anchor());
+ QCString s=mdef->briefDescription();
+ ol.startMemberDescription(mdef->anchor());
ol.generateDoc(mdef->briefFile(),mdef->briefLine(),
mdef->getOuterScope()?mdef->getOuterScope():d,
- mdef,mdef->briefDescription(),TRUE,FALSE,0,TRUE,FALSE);
+ mdef,s.data(),TRUE,FALSE,0,TRUE,FALSE);
if (detailsVisible)
{
ol.pushGeneratorState();
@@ -2610,7 +2608,7 @@ void VhdlDocGen::writeSource(MemberDef *mdef,OutputList& ol,QCString & cname)
codeFragment, // input
SrcLangExt_VHDL, // lang
FALSE, // isExample
- 0, // exampleName
+ 0, // exampleName
mdef->getFileDef(), // fileDef
mdef->getStartBodyLine(), // startLine
mdef->getEndBodyLine(), // endLine
@@ -2804,7 +2802,7 @@ bool VhdlDocGen::findConstraintFile(LayoutNavEntry *lne)
QCString co("Constraints");
QCString imgExt = getDotImageExtension();
- if (Config_getBool("HAVE_DOT") && imgExt=="svg")
+ if (Config_getBool(HAVE_DOT) && imgExt=="svg")
{
QCString ov = theTranslator->trDesignOverview();
QCString ofile("vhdl_design_overview");
@@ -3559,7 +3557,7 @@ void FlowChart::printNode(const FlowChart* flo)
}
else
{
- printf("\n NO: %s%s[%d,%d]",q.data(),t.data(),flo->stamp,flo->id);
+ printf("\n NO: %s[%d,%d]",t.data(),flo->stamp,flo->id);
}
}
}
@@ -3745,8 +3743,13 @@ void FlowChart::buildCommentNodes(FTextStream & t)
FlowChart *fll=flowList.at(j);
if (fll->type & (COMMENT_NO | BEGIN_NO))
{
+ int diff=FLOWLEN-(j+1);
flowList.remove(j);
- delete fll;
+
+ if ((fll->type & COMMENT_NO) && diff > 1)
+ flowList.at(j+1)->label=fll->label;
+
+ delete fll;
fll=0;
size--;
if (j>0) j--;
@@ -3841,7 +3844,6 @@ void FlowChart::addFlowChart(int type,const char* text,const char* exp, const ch
{
flowList.append(fl);
}
-
}
void FlowChart::moveToPrevLevel()
@@ -3850,6 +3852,87 @@ void FlowChart::moveToPrevLevel()
ifcounter--;
}
+QCString FlowChart::printPlantUmlNode(const FlowChart *flo,bool ca,bool endL)
+{
+ QCString t;
+ QCString exp=flo->exp.stripWhiteSpace();
+ QCString text=flo->text.stripWhiteSpace();
+ switch (flo->type)
+ {
+ case START_NO: t=":"+text+"|"; break;
+ case IF_NO : t="\nif ("+exp+") then (yes)"; break;
+ case ELSIF_NO: t="\nelseif ("+exp+") then (yes)"; break;
+ case ELSE_NO: t="\nelse"; break;
+ case CASE_NO: t="\n:"+exp+";"; break;
+ case WHEN_NO: t="\n";
+ if (!ca) t+="else";
+ t+="if ("+exp+") then (yes)";
+ break;
+ case EXIT_NO: break;
+ case END_NO: if (text.contains(" function")==0) t="\n:"+text+";";
+ break;
+ case TEXT_NO: t="\n:"+text+"]"; break;
+ case ENDIF_NO: t="\nendif"; break;
+ case FOR_NO: t="\nwhile ("+exp+") is (yes)"; break;
+ case WHILE_NO: t="\nwhile ("+exp+") is (yes)"; break;
+ case END_LOOP: t="\nendwhile"; break;
+ case END_CASE: t="\nendif\n:end case;"; break;
+ case VARIABLE_NO:t="\n:"+text+";"; break;
+ case RETURN_NO: t="\n:"+text+";";
+ if (!endL) t+="\nstop";
+ break;
+ case LOOP_NO: t="\nwhile (infinite loop)"; break;
+ case NEXT_NO: break;
+ case EMPTY_NO: break;
+ case COMMENT_NO: t="\n note left \n "+flo->label+"\nend note \n"; break;
+ case BEGIN_NO: t="\n:begin;"; break;
+ default: assert(false); break;
+ }
+ return t;
+}
+
+void FlowChart::printUmlTree()
+{
+ int caseCounter = 0;
+ int whenCounter = 0;
+
+ QCString qcs;
+ uint size=flowList.count();
+ bool endList;
+ for (uint j=0;j<size;j++)
+ {
+ endList=j==FLOWLEN;
+ FlowChart *flo=flowList.at(j);
+ if (flo->type==CASE_NO)
+ {
+ caseCounter++;
+ whenCounter=0;
+ }
+
+ if (flo->type==END_CASE)
+ {
+ caseCounter--;
+ }
+
+ bool ca = (caseCounter>0 && whenCounter==0);
+
+ qcs+=printPlantUmlNode(flo,ca,endList);
+
+ if (flo->type==WHEN_NO)
+ {
+ whenCounter++;
+ }
+
+ }
+ qcs+="\n";
+
+ QCString & htmlOutDir = Config_getString(HTML_OUTPUT);
+
+ QCString n=convertNameToFileName();
+ QCString tmp=htmlOutDir;
+ n=writePlantUMLSource(tmp,n,qcs);
+ generatePlantUMLOutput(n.data(),tmp.data(),PUML_SVG);
+}
QCString FlowChart::convertNameToFileName()
{
@@ -3857,16 +3940,19 @@ QCString FlowChart::convertNameToFileName()
QCString temp,qcs;
const MemberDef* md=VhdlDocGen::getFlowMember();
- temp.sprintf("%p",md);
+ // temp.sprintf("%p",md);
qcs=md->name();
+ #if 0
if (qcs.find(exp,0)>=0)
{
qcs.prepend("Z");
qcs=qcs.replace(exp,"_");
}
+ #endif
- return qcs+temp;
+ //QCString tt= qcs;VhdlDocGen::getRecordNumber();
+ return qcs;
}
const char* FlowChart::getNodeType(int c)
@@ -3889,7 +3975,7 @@ const char* FlowChart::getNodeType(int c)
case END_CASE: return "end_case ";
case VARIABLE_NO: return "variable_decl ";
case RETURN_NO: return "return ";
- case LOOP_NO: return "infinte loop ";
+ case LOOP_NO: return "infinite loop ";
case NEXT_NO: return "next ";
case COMMENT_NO: return "comment ";
case EMPTY_NO: return "empty ";
@@ -3901,7 +3987,7 @@ const char* FlowChart::getNodeType(int c)
void FlowChart::createSVG()
{
QCString qcs("/");
- QCString ov = Config_getString("HTML_OUTPUT");
+ QCString ov = Config_getString(HTML_OUTPUT);
qcs+=FlowChart::convertNameToFileName()+".svg";
@@ -3937,7 +4023,7 @@ void FlowChart::writeFlowChart()
{
// assert(VhdlDocGen::flowMember);
- QCString ov = Config_getString("HTML_OUTPUT");
+ QCString ov = Config_getString(HTML_OUTPUT);
QCString fileName = ov+"/flow_design.dot";
QFile f(fileName);
FTextStream t(&f);
@@ -3949,14 +4035,23 @@ void FlowChart::writeFlowChart()
}
colTextNodes();
+ // buildCommentNodes(t);
#ifdef DEBUGFLOW
- printFlowTree();
+ printFlowTree();
#endif
+ const MemberDef *p=VhdlDocGen::getFlowMember();
+
+ if (p->isStatic())
+ {
+ printUmlTree();
+ delFlowList();
+ f.close();
+ return;
+ }
startDot(t);
buildCommentNodes(t);
-
uint size=flowList.count();
for (uint j=0;j <size ;j++)
@@ -4458,4 +4553,9 @@ parseVhdlCode(codeOutIntf,
);
-}
+
+
+
+
+
+}// class