My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | List of all members
FlowChart Class Reference

#include <vhdldocgen.h>

Public Types

enum  nodeTypes {
  IF_NO = 1<<1, ELSIF_NO = 1<<2, ELSE_NO = 1<<3, CASE_NO = 1<<4,
  WHEN_NO = 1<<5, EXIT_NO = 1<<6, END_NO = 1<<7, TEXT_NO = 1<<8,
  START_NO = 1<<9, ENDIF_NO = 1<<10, FOR_NO = 1<<11, WHILE_NO = 1<<12,
  END_LOOP = 1<<13, END_CASE = 1<<14, VARIABLE_NO = 1<<15, RETURN_NO = 1<<16,
  LOOP_NO = 1<<17, NEXT_NO = 1<<18, EMPTY_NO = 1<<19, COMMENT_NO = 1<<20,
  BEGIN_NO = 1<<21
}
 

Public Member Functions

 FlowChart (int typ, const char *t, const char *ex, const char *label=0)
 
 ~FlowChart ()
 

Static Public Member Functions

static void createSVG ()
 
static void startDot (FTextStream &t)
 
static void endDot (FTextStream &t)
 
static void codify (FTextStream &t, const char *str)
 
static void writeShape (FTextStream &t, const FlowChart *fl)
 
static void writeEdge (FTextStream &t, int fl_from, int fl_to, int i, bool bFrom=FALSE, bool bTo=FALSE)
 
static void writeEdge (FTextStream &t, const FlowChart *fl_from, const FlowChart *fl_to, int i)
 
static void writeFlowLinks (FTextStream &t)
 
static QCString getNodeName (int n)
 
static void colTextNodes ()
 
static int getNextTextLink (const FlowChart *fl, uint index)
 
static int getNextIfLink (const FlowChart *, uint)
 
static int getNextNode (int, int)
 
static int findNode (int index, int stamp, int type)
 
static int findNode (int index, int type)
 
static int findNextLoop (int j, int stamp)
 
static int findPrevLoop (int j, int stamp, bool endif=FALSE)
 
static int findLabel (int j, QCString &)
 
static void delFlowList ()
 
static const char * getNodeType (int c)
 
static void addFlowChart (int type, const char *text, const char *exp, const char *label=NULL)
 
static void moveToPrevLevel ()
 
static int getTimeStamp ()
 
static void writeFlowChart ()
 
static void alignFuncProc (QCString &q, const ArgumentList *al, bool isFunc)
 
static QCString convertNameToFileName ()
 
static void printNode (const FlowChart *n)
 
static void printFlowTree ()
 
static void buildCommentNodes (FTextStream &t)
 
static void alignCommentNode (FTextStream &t, QCString com)
 
static void printUmlTree ()
 
static QCString printPlantUmlNode (const FlowChart *flo, bool, bool)
 

Static Public Attributes

static QList< FlowChartflowList
 

Private Attributes

int id
 
int stamp
 
int type
 
int line
 
QCString label
 
QCString text
 
QCString exp
 

Detailed Description

Definition at line 267 of file vhdldocgen.h.

Member Enumeration Documentation

Enumerator
IF_NO 
ELSIF_NO 
ELSE_NO 
CASE_NO 
WHEN_NO 
EXIT_NO 
END_NO 
TEXT_NO 
START_NO 
ENDIF_NO 
FOR_NO 
WHILE_NO 
END_LOOP 
END_CASE 
VARIABLE_NO 
RETURN_NO 
LOOP_NO 
NEXT_NO 
EMPTY_NO 
COMMENT_NO 
BEGIN_NO 

Definition at line 270 of file vhdldocgen.h.

{
IF_NO = 1<<1,
ELSIF_NO = 1<<2,
ELSE_NO = 1<<3,
CASE_NO = 1<<4,
WHEN_NO = 1<<5,
EXIT_NO = 1<<6,
END_NO = 1<<7,
TEXT_NO = 1<<8,
START_NO = 1<<9,
ENDIF_NO = 1<<10,
FOR_NO = 1<<11,
WHILE_NO = 1<<12,
END_LOOP = 1<<13,
END_CASE = 1<<14,
VARIABLE_NO = 1<<15,
RETURN_NO = 1<<16,
LOOP_NO = 1<<17,
NEXT_NO = 1<<18,
EMPTY_NO = 1<<19,
COMMENT_NO = 1<<20,
BEGIN_NO = 1<<21
};

Constructor & Destructor Documentation

FlowChart::FlowChart ( int  typ,
const char *  t,
const char *  ex,
const char *  label = 0 
)

Definition at line 3787 of file vhdldocgen.cpp.

References ELSE_NO, ELSIF_NO, END_NO, exp, ifcounter, label, nodeCounter, stamp, START_NO, STARTL, text, type, and VARIABLE_NO.

Referenced by addFlowChart(), and colTextNodes().

{
if (typ & STARTL)
{
}
text=t;
exp=ex;
type=typ;
label=lab;
if (typ & (ELSE_NO | ELSIF_NO))
{
stamp--;
}
if (typ & (START_NO | END_NO | VARIABLE_NO))
{
stamp=0;
}
}
FlowChart::~FlowChart ( )

Definition at line 3783 of file vhdldocgen.cpp.

{
}

Member Function Documentation

void FlowChart::addFlowChart ( int  type,
const char *  text,
const char *  exp,
const char *  label = NULL 
)
static

Definition at line 3814 of file vhdldocgen.cpp.

References FlowChart(), flowList, VhdlDocGen::getFlowMember(), label, line, START_NO, MemberDef::typeString(), and VARIABLE_NO.

{
static QRegExp reg("[;]");
static QRegExp reg1("[\"]");
if (!VhdlDocGen::getFlowMember()) return;
QCString typeString(text);
QCString expression(exp);
if (text)
{
typeString=typeString.replace(reg,"\n");
}
if (exp)
{
expression=expression.replace(reg1,"\\\"");
}
FlowChart *fl=new FlowChart(type,typeString.data(),expression.data(),label);
fl->line=vhdl::parser::VhdlParser::getLine();
{
flowList.prepend(fl);
}
else
{
flowList.append(fl);
}
}
void FlowChart::alignCommentNode ( FTextStream t,
QCString  com 
)
static

Definition at line 3642 of file vhdldocgen.cpp.

References codify(), and split().

Referenced by buildCommentNodes(), and writeShape().

{
uint max=0;
QCString s;
QStringList ql=QStringList::split("\n",com);
for (uint j=0;j<ql.count();j++)
{
s=(QCString)ql[j].utf8();
if (max<s.length()) max=s.length();
}
s=ql.last().utf8();
int diff=max-s.length();
QCString n(1);
if (diff>0)
{
n.fill(' ',2*diff);
n.append(".");
s+=n;
ql.remove(ql.last());
ql.append(s);
}
for (uint j=0;j<ql.count();j++)
{
s=(QCString)ql[j].utf8();
if (j<ql.count()-1)
{
s+="\n";
}
FlowChart::codify(t,s.data());
}
}
void FlowChart::alignFuncProc ( QCString &  q,
const ArgumentList al,
bool  isFunc 
)
static

Definition at line 4219 of file vhdldocgen.cpp.

References Argument::attrib, Argument::defval, VhdlDocGen::getFlowMember(), Argument::name, Definition::name(), and Argument::type.

{
if (al==0) return;
int index=ali.count();
if (index==0) return;
int len=q.length()+VhdlDocGen::getFlowMember()->name().length();
QCString prev,temp;
prev.fill(' ',len+1);
Argument *arg;
q+="\n";
for (;(arg=ali.current());++ali)
{
QCString attl=arg->defval+" ";
attl+=arg->name+" ";
if (!isFunc)
{
attl+=arg->attrib+" ";
}
else
{
attl+=" in ";
}
attl+=arg->type;
if (--index) attl+=",\n"; else attl+="\n";
attl.prepend(prev.data());
temp+=attl;
}
q+=temp;
}
void FlowChart::buildCommentNodes ( FTextStream t)
static

Definition at line 3678 of file vhdldocgen.cpp.

References alignCommentNode(), BEGIN_NO, COMMENT_NO, flowCol, FLOWLEN, flowList, getNodeName(), id, label, line, type, and writeEdge().

Referenced by writeFlowChart().

{
uint size=flowList.count();
bool begin=false;
for (uint j=0;j < size-1 ;j++)
{
FlowChart *fll=flowList.at(j);
if (fll->type & COMMENT_NO)
{
FlowChart* to=flowList.at(j+1);
if (to->type & COMMENT_NO)
{
fll->label+="\n";
QCString temp=fll->label+to->label;
to->label=temp;
flowList.remove(j);
size--;
if (j>0) j--;
}
}
}// for
for (uint j=0;j <flowList.count() ;j++)
{
FlowChart *fll=flowList.at(j);
if (fll->type & BEGIN_NO)
{
begin = true;
continue;
}
if (fll->type & COMMENT_NO)
{
FlowChart* to;
if (!begin)
{
// comment between function/process .. begin is linked to start node
to=flowList.at(0);
}
else
{
if (j>0 && flowList.at(j-1)->line==fll->line)
to=flowList.at(j-1);
else
to=flowList.at(j+1);
}
t << getNodeName(fll->id);
t << "[shape=none, label=<\n";
t << "<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"2\" >\n ";
t << "<TR><TD BGCOLOR=\"";
t << flowCol.comment;
t << "\" > ";
t << " </TD></TR></TABLE>>];";
writeEdge(t,fll->id,to->id,2);
}
}// for
// delete comment nodes;
size=flowList.count();
for (uint j=0;j < size;j++)
{
FlowChart *fll=flowList.at(j);
if (fll->type & (COMMENT_NO | BEGIN_NO))
{
int diff=FLOWLEN-(j+1);
flowList.remove(j);
if ((fll->type & COMMENT_NO) && diff > 1)
flowList.at(j+1)->label=fll->label;
delete fll;
fll=0;
size--;
if (j>0) j--;
}
}// for;
}
void FlowChart::codify ( FTextStream t,
const char *  str 
)
static

Definition at line 3760 of file vhdldocgen.cpp.

Referenced by alignCommentNode().

{
if (str)
{
const char *p=str;
char c;
while (*p)
{
c=*p++;
switch(c)
{
case '<': t << "&lt;"; break;
case '>': t << "&gt;"; break;
case '&': t << "&amp;"; break;
case '\'': t << "&#39;"; break;
case '"': t << "&quot;"; break;
case '\n': t <<"<BR ALIGN=\"LEFT\"/>"; break;
default: t << c; break;
}
}
}
}//codify
void FlowChart::colTextNodes ( )
static

Definition at line 3574 of file vhdldocgen.cpp.

References ELSE_NO, EMPTY, FlowChart(), flowList, IFF, stamp, text, TEXT_NO, and type.

Referenced by writeFlowChart().

{
QCString text;
FlowChart *flno;
bool found=FALSE;
for (uint j=0;j<flowList.count();j++)
{
FlowChart *flo=flowList.at(j);
if (flo->type&TEXT_NO)
{
text+=flo->text+'\n';
if (!found)
{
flno=flo;
}
if (found)
{
flno->text+=flo->text;
flowList.remove(flo);
if (j>0) j=j-1;
}
found=TRUE;
}
else
found=FALSE;
}
// find if..endif without text
// if..elseif without text
for (uint j=0;j<flowList.count()-1;j++)
{
FlowChart *flo=flowList.at(j);
int kind=flo->type;
if ( (kind & IFF) || (flo->type & ELSE_NO))
{
FlowChart *ftemp=flowList.at(j+1);
if (ftemp->type & EMPTY)
{
FlowChart *fNew = new FlowChart(TEXT_NO,"empty ",0);
fNew->stamp=flo->stamp;
flowList.insert(j+1,fNew);
}
}
}
}// colTextNode
QCString FlowChart::convertNameToFileName ( )
static

Definition at line 3937 of file vhdldocgen.cpp.

References exp, VhdlDocGen::getFlowMember(), and Definition::name().

Referenced by createSVG(), printUmlTree(), and HtmlDocVisitor::visitPre().

{
static QRegExp exp ("[^][a-z_A-Z0-9]");
QCString temp,qcs;
// temp.sprintf("%p",md);
qcs=md->name();
#if 0
if (qcs.find(exp,0)>=0)
{
qcs.prepend("Z");
qcs=qcs.replace(exp,"_");
}
#endif
//QCString tt= qcs;VhdlDocGen::getRecordNumber();
return qcs;
}
void FlowChart::createSVG ( )
static

Definition at line 3987 of file vhdldocgen.cpp.

References Config_getString, convertNameToFileName(), err(), and portable_system().

Referenced by writeFlowChart().

{
QCString qcs("/");
QCString ov = Config_getString(HTML_OUTPUT);
//const MemberDef *m=VhdlDocGen::getFlowMember();
//if (m)
// fprintf(stderr,"\n creating flowchart : %s %s in file %s \n",VhdlDocGen::trTypeString(m->getMemberSpecifiers()),m->name().data(),m->getFileDef()->name().data());
QCString dir=" -o "+ov+qcs;
ov+="/flow_design.dot";
QCString vlargs="-Tsvg "+ov+dir ;
if (portable_system("dot",vlargs)!=0)
{
err("could not create dot file");
}
}
void FlowChart::delFlowList ( )
static

Definition at line 3628 of file vhdldocgen.cpp.

References flowList, ifcounter, and nodeCounter.

Referenced by writeFlowChart().

{
uint size=flowList.count();
for (uint j=0;j <size ;j++)
{
FlowChart *fll=flowList.at(j);
delete fll;
}
flowList.clear();
}
void FlowChart::endDot ( FTextStream t)
static

Definition at line 4017 of file vhdldocgen.cpp.

Referenced by writeFlowChart().

{
t << " } \n";
}
int FlowChart::findLabel ( int  j,
QCString &  label 
)
static

Definition at line 4296 of file vhdldocgen.cpp.

References err(), flowList, label, LOOP, and type.

Referenced by writeFlowLinks().

{
for (uint j=index;j>0;j--)
{
FlowChart *flo=flowList.at(j);
if ((flo->type & LOOP) && !flo->label.isEmpty() && qstricmp(flo->label,label)==0)
{
return j;
}
}
err("could not find label: ",label.data());
return 0;
}
int FlowChart::findNextLoop ( int  j,
int  stamp 
)
static

Definition at line 4256 of file vhdldocgen.cpp.

References END_LOOP, flowList, stamp, and type.

Referenced by writeFlowLinks().

{
for (uint j=index+1;j<flowList.count();j++)
{
FlowChart *flo=flowList.at(j);
if (flo->stamp==stamp)
{
continue;
}
if (flo->type&END_LOOP)
{
return j;
}
}
return flowList.count()-1;
}
int FlowChart::findNode ( int  index,
int  stamp,
int  type 
)
static

Definition at line 4310 of file vhdldocgen.cpp.

References flowList, stamp, and type.

Referenced by getNextIfLink(), getNextNode(), and writeFlowLinks().

{
for (uint j=index+1;j<flowList.count();j++)
{
FlowChart *flo=flowList.at(j);
if (flo->type==type && flo->stamp==stamp)
{
return j;
}
}
return 0;
}// findNode
static int FlowChart::findNode ( int  index,
int  type 
)
static
int FlowChart::findPrevLoop ( int  j,
int  stamp,
bool  endif = FALSE 
)
static

Definition at line 4273 of file vhdldocgen.cpp.

References flowList, LOOP, stamp, and type.

Referenced by writeFlowLinks().

{
for (uint j=index;j>0;j--)
{
FlowChart *flo=flowList.at(j);
if (flo->type & LOOP)
{
if (flo->stamp==stamp && endif)
{
return j;
}
else
{
if (flo->stamp<stamp)
{
return j;
}
}
}
}
return flowList.count()-1;
}
int FlowChart::getNextIfLink ( const FlowChart fl,
uint  index 
)
static

Definition at line 4364 of file vhdldocgen.cpp.

References ELSE_NO, ELSIF_NO, ENDIF_NO, findNode(), flowList, getNextNode(), and stamp.

Referenced by writeFlowLinks().

{
int stamp=fl->stamp;
uint start = index+1;
int endifNode = findNode(start,stamp,ENDIF_NO);
int elseifNode = findNode(start,stamp,ELSIF_NO);
int elseNode = findNode(start,stamp,ELSE_NO);
assert(endifNode>-1);
if (elseifNode>0 && elseifNode<endifNode)
{
return elseifNode;
}
if (elseNode>0 && elseNode<endifNode)
{
return elseNode+1;
}
stamp=flowList.at(endifNode)->stamp;
return getNextNode(endifNode,stamp);
}
int FlowChart::getNextNode ( int  index,
int  stamp 
)
static

Definition at line 4323 of file vhdldocgen.cpp.

References ELSE_NO, ELSIF_NO, END_CASE, ENDIF_NO, findNode(), FLOWLEN, flowList, stamp, type, and WHEN_NO.

Referenced by getNextIfLink(), and writeFlowLinks().

{
for (uint j=index+1;j<flowList.count();j++)
{
FlowChart *flo=flowList.at(j);
int kind=flo->type;
int s=flo->stamp;
if (s>stamp)
{
continue;
}
if (kind & ENDIF_NO)
{
if (s<stamp && stamp>0)
{
stamp--;
continue;
}
}
if (kind & (ELSE_NO | ELSIF_NO))
{
if (s<stamp && stamp>0)
{
stamp--;
}
j=findNode(j,stamp,ENDIF_NO);
continue;
}
if (kind & WHEN_NO)
{
if (s<stamp && stamp>0)
{
stamp--;
}
return findNode(j,stamp-1,END_CASE);
}
return j;
}
return FLOWLEN;
}
static int FlowChart::getNextTextLink ( const FlowChart fl,
uint  index 
)
static
QCString FlowChart::getNodeName ( int  n)
static

Definition at line 3621 of file vhdldocgen.cpp.

Referenced by buildCommentNodes(), writeEdge(), and writeShape().

{
QCString node;
node.setNum(n);
return node.prepend("node");
}
const char * FlowChart::getNodeType ( int  c)
static

Definition at line 3958 of file vhdldocgen.cpp.

References BEGIN_NO, CASE_NO, COMMENT_NO, ELSE_NO, ELSIF_NO, EMPTY_NO, END_CASE, END_LOOP, END_NO, ENDIF_NO, EXIT_NO, FOR_NO, IF_NO, LOOP_NO, NEXT_NO, RETURN_NO, START_NO, TEXT_NO, VARIABLE_NO, WHEN_NO, and WHILE_NO.

Referenced by printNode().

{
switch(c)
{
case IF_NO: return "if ";
case ELSIF_NO: return "elsif ";
case ELSE_NO: return "else ";
case CASE_NO: return "case ";
case WHEN_NO: return "when ";
case EXIT_NO: return "exit ";
case END_NO: return "end ";
case TEXT_NO: return "text ";
case START_NO: return "start ";
case ENDIF_NO: return "endif ";
case FOR_NO: return "for ";
case WHILE_NO: return "while ";
case END_LOOP: return "end_loop ";
case END_CASE: return "end_case ";
case VARIABLE_NO: return "variable_decl ";
case RETURN_NO: return "return ";
case LOOP_NO: return "infinite loop ";
case NEXT_NO: return "next ";
case COMMENT_NO: return "comment ";
case EMPTY_NO: return "empty ";
case BEGIN_NO: return "<begin> ";
default: return "--failure--";
}
}
static int FlowChart::getTimeStamp ( )
static
void FlowChart::moveToPrevLevel ( )
static

Definition at line 3849 of file vhdldocgen.cpp.

References VhdlDocGen::getFlowMember(), and ifcounter.

{
if (!VhdlDocGen::getFlowMember()) return;
}
void FlowChart::printFlowTree ( )
static

Definition at line 3565 of file vhdldocgen.cpp.

References flowList, and printNode().

Referenced by writeFlowChart().

{
uint size=flowList.count();
for (uint j=0;j<size;j++)
{
}
}
void FlowChart::printNode ( const FlowChart n)
static

Definition at line 3505 of file vhdldocgen.cpp.

References COMMENT_NO, EMPTNODE, exp, getNodeType(), id, label, stamp, STARTL, text, and type.

Referenced by printFlowTree().

{
if (flo==0) return;
QCString ui="-";
QCString q,t;
QRegExp ep("[\t\n\r]");
ui.fill('-',255);
if (flo->type & STARTL)
{
if (flo->stamp>0)
{
q=ui.left(2*flo->stamp);
}
else
{
q=" ";
}
QCString nn=flo->exp.stripWhiteSpace();
printf("\nYES: %s%s[%d,%d]",q.data(),nn.data(),flo->stamp,flo->id);
}
else
{
if (flo->type & COMMENT_NO)
{
t=flo->label;
}
else
{
t=flo->text;
}
t=t.replace(ep,"");
if (t.isEmpty())
{
t=" ";
}
if (flo->stamp>0)
{
q=ui.left(2*flo->stamp);
}
else
{
q=" ";
}
if (flo->type & EMPTNODE)
{
printf("\n NO: %s%s[%d,%d]",q.data(),FlowChart::getNodeType(flo->type),flo->stamp,flo->id);
}
else if (flo->type & COMMENT_NO)
{
printf("\n NO: %s%s[%d,%d]",t.data(),FlowChart::getNodeType(flo->type),flo->stamp,flo->id);
}
else
{
printf("\n NO: %s[%d,%d]",t.data(),flo->stamp,flo->id);
}
}
}
QCString FlowChart::printPlantUmlNode ( const FlowChart flo,
bool  ca,
bool  endL 
)
static

Definition at line 3855 of file vhdldocgen.cpp.

References BEGIN_NO, CASE_NO, COMMENT_NO, ELSE_NO, ELSIF_NO, EMPTY_NO, END_CASE, END_LOOP, END_NO, ENDIF_NO, EXIT_NO, exp, FOR_NO, IF_NO, label, LOOP_NO, NEXT_NO, RETURN_NO, START_NO, text, TEXT_NO, type, VARIABLE_NO, WHEN_NO, and WHILE_NO.

Referenced by printUmlTree().

{
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 ( )
static

Definition at line 3894 of file vhdldocgen.cpp.

References CASE_NO, Config_getString, convertNameToFileName(), END_CASE, FLOWLEN, flowList, generatePlantUMLOutput(), printPlantUmlNode(), PUML_SVG, languages::tmp, type, WHEN_NO, and writePlantUMLSource().

Referenced by writeFlowChart().

{
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);
}
void FlowChart::startDot ( FTextStream t)
static

Definition at line 4009 of file vhdldocgen.cpp.

Referenced by writeFlowChart().

{
t << " digraph G { \n";
t << "rankdir=TB \n";
t << "concentrate=true\n";
t << "stylesheet=\"doxygen.css\"\n";
}
void FlowChart::writeEdge ( FTextStream t,
int  fl_from,
int  fl_to,
int  i,
bool  bFrom = FALSE,
bool  bTo = FALSE 
)
static

Definition at line 4190 of file vhdldocgen.cpp.

References flowCol, getNodeName(), and label.

Referenced by buildCommentNodes(), writeEdge(), and writeFlowLinks().

{
QCString label,col;
if (i==0)
{
col=flowCol.yesNodeLink;
label="yes";
}
else if (i==1)
{
col=flowCol.noNodeLink;
label="no";
}
else
{
col=flowCol.textNodeLink;
label="";
}
t << "edge [color=\""+col+"\",label=\""+label+"\"]\n";
t << getNodeName(fl_from).data();
if (bFrom) t << ":s";
t << "->";
t << getNodeName(fl_to).data();
if (bTo) t << ":n";
t << "\n";
}
void FlowChart::writeEdge ( FTextStream t,
const FlowChart fl_from,
const FlowChart fl_to,
int  i 
)
static

Definition at line 4172 of file vhdldocgen.cpp.

References getNodeName(), id, STARTL, type, and writeEdge().

{
bool b=fl_from->type & STARTL;
bool c=fl_to->type & STARTL;
#ifdef DEBUGFLOW
QCString s1(getNodeName(fl_from->id).data());
QCString s2(getNodeName(fl_to->id).data());
QMap<QCString, int>::Iterator it = keyMap.find(s1);
QMap<QCString, int>::Iterator it1 = keyMap.find(s2);
// checks if the link is connected to a valid node
assert(it.key());
assert(it1.key());
#endif
writeEdge(t,fl_from->id,fl_to->id,i,b,c);
}
void FlowChart::writeFlowChart ( )
static

Definition at line 4022 of file vhdldocgen.cpp.

References buildCommentNodes(), colTextNodes(), Config_getString, createSVG(), delFlowList(), endDot(), err(), flowList, VhdlDocGen::getFlowMember(), MemberDef::isStatic(), printFlowTree(), printUmlTree(), startDot(), writeFlowLinks(), and writeShape().

{
// assert(VhdlDocGen::flowMember);
QCString ov = Config_getString(HTML_OUTPUT);
QCString fileName = ov+"/flow_design.dot";
QFile f(fileName);
FTextStream t(&f);
if (!f.open(IO_WriteOnly))
{
err("Cannot open file %s for writing\n",fileName.data());
return;
}
// buildCommentNodes(t);
#ifdef DEBUGFLOW
#endif
if (p->isStatic())
{
f.close();
return;
}
uint size=flowList.count();
for (uint j=0;j <size ;j++)
{
FlowChart *fll=flowList.at(j);
writeShape(t,fll);
}
f.close();
}// writeFlowChart
void FlowChart::writeFlowLinks ( FTextStream t)
static

Definition at line 4388 of file vhdldocgen.cpp.

References CASE_NO, EEND, END_CASE, END_LOOP, EXIT_NO, exp, findLabel(), findNextLoop(), findNode(), findPrevLoop(), flowList, FOR_NO, getNextIfLink(), getNextNode(), IFF, label, LOOP_NO, NEXT_NO, RETURN_NO, stamp, text, TEXT_NO, type, VARIABLE_NO, WHEN_NO, WHILE_NO, and writeEdge().

Referenced by writeFlowChart().

{
uint size=flowList.count();
if (size<2) return;
// write start link
writeEdge(t,flowList.at(0),flowList.at(1),2);
for (uint j=0;j<size;j++)
{
FlowChart *fll=flowList.at(j);
int kind=fll->type;
int stamp=fll->stamp;
if (kind & EEND)
{
continue;
}
if (kind & IFF)
{
writeEdge(t,fll,flowList.at(j+1),0);
int z=getNextIfLink(fll,j);
// assert(z>-1);
writeEdge(t,fll,flowList.at(z),1);
}
else if (kind & LOOP_NO)
{
writeEdge(t,fll,flowList.at(j+1),2);
continue;
}
else if (kind & (CASE_NO | FOR_NO | WHILE_NO))
{
if (kind & CASE_NO)
{
writeEdge(t,fll,flowList.at(j+1),2);
continue;
}
else
{
writeEdge(t,fll,flowList.at(j+1),0);
}
kind=END_LOOP;
int z=findNode(j+1,fll->stamp,kind);
z=getNextNode(z,flowList.at(z)->stamp);
// assert(z>-1);
writeEdge(t,fll,flowList.at(z),1);
continue;
}
else if (kind & (TEXT_NO | VARIABLE_NO))
{
int z=getNextNode(j,stamp);
writeEdge(t,fll,flowList.at(z),2);
}
else if (kind & WHEN_NO)
{
// default value
if (qstricmp(fll->text.simplifyWhiteSpace().data(),"others")==0)
{
writeEdge(t,fll,flowList.at(j+1),2);
continue;
}
writeEdge(t,fll,flowList.at(j+1),0);
int u=findNode(j,stamp,WHEN_NO);
int v=findNode(j,stamp-1,END_CASE);
if (u>0 && u<v)
{
writeEdge(t,fll,flowList.at(u),1);
}
else
{
writeEdge(t,fll,flowList.at(v),1);
}
}
else if (kind & END_CASE)
{
writeEdge(t,fll,flowList.at(z),2);
}
else if (kind & END_LOOP)
{
int z=findPrevLoop(j,fll->stamp,true);
writeEdge(t,fll,flowList.at(z),2);
}
else if (kind & RETURN_NO)
{
writeEdge(t,fll,FlowChart::flowList.at(size-1),2);
}
else if (kind & (EXIT_NO | NEXT_NO))
{
int z;
bool b = kind==NEXT_NO;
if (fll->exp)
{
writeEdge(t,fll,flowList.at(j+1),1);
}
if (!fll->label.isEmpty())
{
z=findLabel(j,fll->label);
if (b)
{
writeEdge(t,fll,flowList.at(z),0);
}
else
{
z=findNode(z,flowList.at(z)->stamp,END_LOOP);
z=getNextNode(z,flowList.at(z)->stamp);
writeEdge(t,fll,flowList.at(z),0);
}
continue;
}
else
{
if (b)
{
z=findPrevLoop(j,fll->stamp);
writeEdge(t,fll,flowList.at(z),0);
continue;
}
else
{
z =findNextLoop(j,fll->stamp-1);
}
z=getNextNode(z,flowList.at(z)->stamp);
}
writeEdge(t,fll,flowList.at(z),0);
}
} //for
} //writeFlowLinks
void FlowChart::writeShape ( FTextStream t,
const FlowChart fl 
)
static

Definition at line 4070 of file vhdldocgen.cpp.

References alignCommentNode(), alignText(), DECLN, EEND, ENDCL, EXITNEXT, exp, flowCol, getNodeName(), id, IFF, label, LOOP, STARTFIN, text, type, and VARIABLE_NO.

Referenced by writeFlowChart().

{
if (fl->type & EEND) return;
QCString var;
if (fl->type & LOOP)
{
var=" loop";
}
else if (fl->type & IFF)
{
var=" then";
}
else
{
var="";
}
t<<getNodeName(fl->id).data();
#ifdef DEBUGFLOW
QCString qq(getNodeName(fl->id).data());
keyMap.insert(qq,fl->id);
#endif
bool dec=(fl->type & DECLN);
bool exit=(fl->type & EXITNEXT);
if (exit && !fl->exp.isEmpty())
{
dec=TRUE;
}
if (dec)
{
QCString exp=fl->exp;
alignText(exp);
t << " [shape=diamond,style=filled,color=\"";
t << flowCol.decisionNode;
t << "\",label=\" ";
QCString kl;
if (exit) kl=fl->text+" ";
if (fl->label)
{
kl+=fl->label+":"+exp+var;
}
else
{
kl+=exp+var;
}
t << "\"]\n";
}
else if (fl->type & ENDCL)
{
QCString val=fl->text;
t << " [shape=ellipse ,label=\""+val+"\"]\n";
}
else if (fl->type & STARTFIN)
{
QCString val=fl->text;
t << "[shape=box , style=rounded label=<\n";
t << "<TABLE BORDER=\"0\" CELLBORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\" >\n ";
t << "<TR><TD BGCOLOR=\"";
t<< flowCol.startEndNode;
t<< "\"> ";
t << " </TD></TR></TABLE>>];";
}
else
{
if (fl->text.isEmpty()) return;
bool var=(fl->type & FlowChart::VARIABLE_NO);
QCString q=fl->text;
if (exit)
{
q+=" "+fl->label;
}
int z=q.findRev("\n");
if (z==(int)q.length()-1)
{
q=q.remove(z,2);
}
t << "[shape=none margin=0.1, label=<\n";
t << "<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"2\" >\n ";
if (var)
{
t << "<TR><TD BGCOLOR=\"" << flowCol.varNode << "\" > ";
}
else
{
t << "<TR><TD BGCOLOR=\"" << flowCol.textNode << "\" > ";
}
t << " </TD></TR></TABLE>>];";
}
}

Member Data Documentation

QCString FlowChart::exp
private
QList< FlowChart > FlowChart::flowList
static
int FlowChart::id
private

Definition at line 338 of file vhdldocgen.h.

Referenced by buildCommentNodes(), printNode(), writeEdge(), and writeShape().

QCString FlowChart::label
private
int FlowChart::line
private

Definition at line 342 of file vhdldocgen.h.

Referenced by addFlowChart(), and buildCommentNodes().

int FlowChart::stamp
private
QCString FlowChart::text
private
int FlowChart::type
private

The documentation for this class was generated from the following files: