27
27
#include < qcstring.h>
28
28
#include < qfileinfo.h>
29
29
#include < qstringlist.h>
30
-
31
- // #ifdef DEBUGFLOW
32
30
#include < qmap.h>
33
- // #endif
34
31
35
32
/* --------------------------------------------------------------- */
36
33
47
44
#include " searchindex.h"
48
45
#include " outputlist.h"
49
46
#include " parserintf.h"
50
-
51
47
#include " layout.h"
52
48
#include " arguments.h"
53
49
#include " portable.h"
59
55
#include " filename.h"
60
56
#include " membergroup.h"
61
57
#include " memberdef.h"
62
-
58
+ # include " plantuml.h "
63
59
#include " vhdljjparser.h"
64
60
#include " VhdlParser.h"
65
-
66
61
#include " vhdlcode.h"
62
+ #include " plantuml.h"
63
+ // #define DEBUGFLOW
67
64
#define theTranslator_vhdlType VhdlDocGen::trVhdlType
68
65
69
66
static QDict<QCString> g_vhdlKeyDict0 (17 ,FALSE );
@@ -95,7 +92,7 @@ void VhdlDocGen::setFlowMember( const MemberDef* mem)
95
92
flowMember=mem;
96
93
}
97
94
98
- const MemberDef* VhdlDocGen::getFlowMember ()
95
+ const MemberDef* VhdlDocGen::getFlowMember ()
99
96
{
100
97
return flowMember;
101
98
}
@@ -2266,10 +2263,11 @@ void VhdlDocGen::writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
2266
2263
ol.endMemberItem ();
2267
2264
if (!mdef->briefDescription ().isEmpty () && Config_getBool (" BRIEF_MEMBER_DESC" ) /* && !annMemb */ )
2268
2265
{
2269
- ol.startMemberDescription (mdef->anchor ());
2266
+ QCString s=mdef->briefDescription ();
2267
+ ol.startMemberDescription (mdef->anchor ());
2270
2268
ol.generateDoc (mdef->briefFile (),mdef->briefLine (),
2271
2269
mdef->getOuterScope ()?mdef->getOuterScope ():d,
2272
- mdef,mdef-> briefDescription (),TRUE ,FALSE ,0 ,TRUE ,FALSE );
2270
+ mdef,s. data (),TRUE ,FALSE ,0 ,TRUE ,FALSE );
2273
2271
if (detailsVisible)
2274
2272
{
2275
2273
ol.pushGeneratorState ();
@@ -2610,7 +2608,7 @@ void VhdlDocGen::writeSource(MemberDef *mdef,OutputList& ol,QCString & cname)
2610
2608
codeFragment, // input
2611
2609
SrcLangExt_VHDL, // lang
2612
2610
FALSE , // isExample
2613
- 0 , // exampleName
2611
+ 0 , // exampleName
2614
2612
mdef->getFileDef (), // fileDef
2615
2613
mdef->getStartBodyLine (), // startLine
2616
2614
mdef->getEndBodyLine (), // endLine
@@ -3559,7 +3557,7 @@ void FlowChart::printNode(const FlowChart* flo)
3559
3557
}
3560
3558
else
3561
3559
{
3562
- printf (" \n NO: %s%s [%d,%d]" ,q. data () ,t.data (),flo->stamp ,flo->id );
3560
+ printf (" \n NO: %s[%d,%d]" ,t.data (),flo->stamp ,flo->id );
3563
3561
}
3564
3562
}
3565
3563
}
@@ -3745,8 +3743,13 @@ void FlowChart::buildCommentNodes(FTextStream & t)
3745
3743
FlowChart *fll=flowList.at (j);
3746
3744
if (fll->type & (COMMENT_NO | BEGIN_NO))
3747
3745
{
3746
+ int diff=FLOWLEN-(j+1 );
3748
3747
flowList.remove (j);
3749
- delete fll;
3748
+
3749
+ if ((fll->type & COMMENT_NO) && diff > 1 )
3750
+ flowList.at (j+1 )->label =fll->label ;
3751
+
3752
+ delete fll;
3750
3753
fll=0 ;
3751
3754
size--;
3752
3755
if (j>0 ) j--;
@@ -3841,7 +3844,6 @@ void FlowChart::addFlowChart(int type,const char* text,const char* exp, const ch
3841
3844
{
3842
3845
flowList.append (fl);
3843
3846
}
3844
-
3845
3847
}
3846
3848
3847
3849
void FlowChart::moveToPrevLevel ()
@@ -3850,23 +3852,108 @@ void FlowChart::moveToPrevLevel()
3850
3852
ifcounter--;
3851
3853
}
3852
3854
3855
+ QCString FlowChart::printPlantUmlNode (const FlowChart *flo,bool ca,bool endL)
3856
+ {
3857
+ QCString t;
3858
+ QCString exp =flo->exp .stripWhiteSpace ();
3859
+ QCString text=flo->text .stripWhiteSpace ();
3860
+ switch (flo->type )
3861
+ {
3862
+ case START_NO: t=" :" +text+" |" ; break ;
3863
+ case IF_NO : t=" \n if (" +exp +" ) then (yes)" ; break ;
3864
+ case ELSIF_NO: t=" \n elseif (" +exp +" ) then (yes)" ; break ;
3865
+ case ELSE_NO: t=" \n else" ; break ;
3866
+ case CASE_NO: t=" \n :" +exp +" ;" ; break ;
3867
+ case WHEN_NO: t=" \n " ;
3868
+ if (!ca) t+=" else" ;
3869
+ t+=" if (" +exp +" ) then (yes)" ;
3870
+ break ;
3871
+ case EXIT_NO: break ;
3872
+ case END_NO: if (text.contains (" function" )==0 ) t=" \n :" +text+" ;" ;
3873
+ break ;
3874
+ case TEXT_NO: t=" \n :" +text+" ]" ; break ;
3875
+ case ENDIF_NO: t=" \n endif" ; break ;
3876
+ case FOR_NO: t=" \n while (" +exp +" ) is (yes)" ; break ;
3877
+ case WHILE_NO: t=" \n while (" +exp +" ) is (yes)" ; break ;
3878
+ case END_LOOP: t=" \n endwhile" ; break ;
3879
+ case END_CASE: t=" \n endif\n :end case;" ; break ;
3880
+ case VARIABLE_NO:t=" \n :" +text+" ;" ; break ;
3881
+ case RETURN_NO: t=" \n :" +text+" ;" ;
3882
+ if (!endL) t+=" \n stop" ;
3883
+ break ;
3884
+ case LOOP_NO: t=" \n while (infinite loop)" ; break ;
3885
+ case NEXT_NO: break ;
3886
+ case EMPTY_NO: break ;
3887
+ case COMMENT_NO: t=" \n note left \n " +flo->label +" \n end note \n " ; break ;
3888
+ case BEGIN_NO: t=" \n :begin;" ; break ;
3889
+ default : assert (false ); break ;
3890
+ }
3891
+ return t;
3892
+ }
3893
+
3894
+ void FlowChart::printUmlTree ()
3895
+ {
3896
+ int caseCounter = 0 ;
3897
+ int whenCounter = 0 ;
3898
+
3899
+ QCString qcs;
3900
+ uint size=flowList.count ();
3901
+ bool endList;
3902
+ for (uint j=0 ;j<size;j++)
3903
+ {
3904
+ endList=j==FLOWLEN;
3905
+ FlowChart *flo=flowList.at (j);
3906
+ if (flo->type ==CASE_NO)
3907
+ {
3908
+ caseCounter++;
3909
+ whenCounter=0 ;
3910
+ }
3911
+
3912
+ if (flo->type ==END_CASE)
3913
+ {
3914
+ caseCounter--;
3915
+ }
3916
+
3917
+ bool ca = (caseCounter>0 && whenCounter==0 );
3918
+
3919
+ qcs+=printPlantUmlNode (flo,ca,endList);
3920
+
3921
+ if (flo->type ==WHEN_NO)
3922
+ {
3923
+ whenCounter++;
3924
+ }
3925
+
3926
+ }
3927
+ qcs+=" \n " ;
3928
+
3929
+ QCString & outDir = Config_getString (" OUTPUT_DIRECTORY" );
3930
+ QCString & htmlOutDir = Config_getString (" HTML_OUTPUT" );
3931
+
3932
+ QCString n=convertNameToFileName ();
3933
+ QCString tmp=htmlOutDir;
3934
+ n=writePlantUMLSource (tmp,n,qcs);
3935
+ generatePlantUMLOutput (n.data (),tmp.data (),PUML_SVG);
3936
+ }
3853
3937
3854
3938
QCString FlowChart::convertNameToFileName ()
3855
3939
{
3856
3940
static QRegExp exp (" [^][a-z_A-Z0-9]" );
3857
3941
QCString temp,qcs;
3858
3942
const MemberDef* md=VhdlDocGen::getFlowMember ();
3859
3943
3860
- temp.sprintf (" %p" ,md);
3944
+ // temp.sprintf("%p",md);
3861
3945
qcs=md->name ();
3862
3946
3947
+ #if 0
3863
3948
if (qcs.find(exp,0)>=0)
3864
3949
{
3865
3950
qcs.prepend("Z");
3866
3951
qcs=qcs.replace(exp,"_");
3867
3952
}
3953
+ #endif
3868
3954
3869
- return qcs+temp;
3955
+ // QCString tt= qcs;VhdlDocGen::getRecordNumber();
3956
+ return qcs;
3870
3957
}
3871
3958
3872
3959
const char * FlowChart::getNodeType (int c)
@@ -3889,7 +3976,7 @@ const char* FlowChart::getNodeType(int c)
3889
3976
case END_CASE: return " end_case " ;
3890
3977
case VARIABLE_NO: return " variable_decl " ;
3891
3978
case RETURN_NO: return " return " ;
3892
- case LOOP_NO: return " infinte loop " ;
3979
+ case LOOP_NO: return " infinite loop " ;
3893
3980
case NEXT_NO: return " next " ;
3894
3981
case COMMENT_NO: return " comment " ;
3895
3982
case EMPTY_NO: return " empty " ;
@@ -3949,14 +4036,23 @@ void FlowChart::writeFlowChart()
3949
4036
}
3950
4037
3951
4038
colTextNodes ();
4039
+ // buildCommentNodes(t);
3952
4040
3953
4041
#ifdef DEBUGFLOW
3954
- printFlowTree ();
4042
+ printFlowTree ();
3955
4043
#endif
4044
+ const MemberDef *p=VhdlDocGen::getFlowMember ();
4045
+
4046
+ if (p->isStatic ())
4047
+ {
4048
+ printUmlTree ();
4049
+ delFlowList ();
4050
+ f.close ();
4051
+ return ;
4052
+ }
3956
4053
3957
4054
startDot (t);
3958
4055
buildCommentNodes (t);
3959
-
3960
4056
uint size=flowList.count ();
3961
4057
3962
4058
for (uint j=0 ;j <size ;j++)
@@ -4458,4 +4554,9 @@ parseVhdlCode(codeOutIntf,
4458
4554
4459
4555
);
4460
4556
4461
- }
4557
+
4558
+
4559
+
4560
+
4561
+
4562
+ }// class
0 commit comments