Skip to main content

The FlowChart Class Reference

Declaration

class FlowChart { ... }

Included Headers

#include <src/vhdldocgen.h>

Enumerations Index

enumnodeTypes { ... }

Public Constructors Index

FlowChart (int typ, const QCString &t, const QCString &ex, const QCString &label=QCString())

Private Member Attributes Index

intid = 0
intstamp = 0
inttype = 0
intline = 0
QCStringlabel
QCStringtext
QCStringexp

Public Static Functions Index

static voidcreateSVG ()
static voidstartDot (TextStream &t)
static voidendDot (TextStream &t)
static voidcodify (TextStream &t, const QCString &str)
static voidwriteShape (TextStream &t, const FlowChart &fl)
static voidwriteEdge (TextStream &t, int fl_from, int fl_to, int i, bool bFrom=FALSE, bool bTo=FALSE)
static voidwriteEdge (TextStream &t, const FlowChart &fl_from, const FlowChart &fl_to, int i)
static voidwriteFlowLinks (TextStream &t)
static QCStringgetNodeName (int n)
static voidcolTextNodes ()
static size_tgetNextIfLink (const FlowChart &, size_t)
static size_tgetNextNode (size_t index, int stamp)
static size_tfindNode (size_t index, int stamp, int type)
static size_tfindNode (size_t index, int type)
static size_tfindNextLoop (size_t j, int stamp)
static size_tfindPrevLoop (size_t j, int stamp, bool endif=FALSE)
static size_tfindLabel (size_t j, const QCString &)
static voiddelFlowList ()
static const char *getNodeType (int c)
static voidaddFlowChart (int type, const QCString &text, const QCString &exp, const QCString &label=QCString())
static voidmoveToPrevLevel ()
static intgetTimeStamp ()
static voidwriteFlowChart ()
static voidalignFuncProc (QCString &q, const ArgumentList &al, bool isFunc)
static QCStringconvertNameToFileName ()
static voidprintNode (const FlowChart &n)
static voidprintFlowTree ()
static voidbuildCommentNodes (TextStream &t)
static voidalignCommentNode (TextStream &t, QCString com)
static voidprintUmlTree ()
static QCStringprintPlantUmlNode (const FlowChart &flo, bool, bool)

Definition at line 238 of file vhdldocgen.h.

Enumerations

nodeTypes

enum FlowChart::nodeTypes
Enumeration values
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)

Definition at line 241 of file vhdldocgen.h.

241 enum nodeTypes {
242 IF_NO = 1<<1,
243 ELSIF_NO = 1<<2,
244 ELSE_NO = 1<<3,
245 CASE_NO = 1<<4,
246 WHEN_NO = 1<<5,
247 EXIT_NO = 1<<6,
248 END_NO = 1<<7,
249 TEXT_NO = 1<<8,
250 START_NO = 1<<9,
251 ENDIF_NO = 1<<10,
252 FOR_NO = 1<<11,
253 WHILE_NO = 1<<12,
254 END_LOOP = 1<<13,
255 END_CASE = 1<<14,
256 VARIABLE_NO = 1<<15,
257 RETURN_NO = 1<<16,
258 LOOP_NO = 1<<17,
259 NEXT_NO = 1<<18,
260 EMPTY_NO = 1<<19,
261 COMMENT_NO = 1<<20,
262 BEGIN_NO = 1<<21
263 };

Public Constructors

FlowChart()

FlowChart::FlowChart (int typ, const QCString & t, const QCString & ex, const QCString & label=QCString())

Declaration at line 302 of file vhdldocgen.h, definition at line 2864 of file vhdldocgen.cpp.

2864FlowChart::FlowChart(int typ,const QCString &t,const QCString &ex,const QCString &lab)
2865{
2867
2868 if (typ & STARTL)
2869 {
2870 ifcounter++;
2871 }
2872
2873 text=t;
2874 exp=ex;
2875 type=typ;
2876 label=lab;
2877
2878 if (typ & (ELSE_NO | ELSIF_NO))
2879 {
2880 stamp--;
2881 }
2882
2883 if (typ & (START_NO | END_NO | VARIABLE_NO))
2884 {
2885 stamp=0;
2886 }
2887
2888 id=nodeCounter++;
2889}

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

Referenced by addFlowChart, buildCommentNodes, colTextNodes, findLabel, findNextLoop, findNode, findPrevLoop, getNextIfLink, getNextNode, getTimeStamp, printNode, printPlantUmlNode, printUmlTree, writeEdge, writeFlowLinks and writeShape.

Private Member Attributes

exp

QCString FlowChart::exp

id

int FlowChart::id = 0

Definition at line 305 of file vhdldocgen.h.

305 int id = 0;

Referenced by buildCommentNodes, printNode, writeEdge and writeShape.

label

QCString FlowChart::label

line

int FlowChart::line = 0

Definition at line 309 of file vhdldocgen.h.

309 int line = 0;

Referenced by buildCommentNodes.

stamp

int FlowChart::stamp = 0

text

QCString FlowChart::text

type

Public Static Functions

addFlowChart()

void FlowChart::addFlowChart (int type, const QCString & text, const QCString & exp, const QCString & label=QCString())
static

Declaration at line 288 of file vhdldocgen.h, definition at line 2891 of file vhdldocgen.cpp.

2892{
2893 if (!VhdlDocGen::getFlowMember()) return;
2894
2895 QCString typeString(text);
2896 QCString expression(exp);
2897
2898
2899 if (!text.isEmpty())
2900 {
2901 typeString=substitute(typeString,";","\n");
2902 }
2903
2904 if (!exp.isEmpty())
2905 {
2906 expression=substitute(expression,"\"","\\\"");
2907 }
2908
2909 if (type & VARIABLE_NO)
2910 {
2911 // Ignore the empty section of the VHDL variable definition.
2912 // This is section between `process` and `begin` keywords, where any source text is missing, probably a bug in the VHDL source parser.
2913 if(text.isEmpty()) return;
2914
2915 flowList.insert(flowList.begin(),FlowChart(type,typeString,expression,label));
2916 flowList.front().line=1; // TODO: use getLine(); of the parser
2917 }
2918 else if (type & START_NO)
2919 {
2920 flowList.insert(flowList.begin(),FlowChart(type,typeString,expression,label));
2921 flowList.front().line=1; // TODO: use getLine(); of the parser
2922 }
2923 else
2924 {
2925 flowList.emplace_back(type,typeString,expression,label);
2926 flowList.back().line=1; // TODO: use getLine(); of the parser
2927 }
2928}

References exp, FlowChart, flowList, VhdlDocGen::getFlowMember, label, START_NO, substitute, text, type and VARIABLE_NO.

Referenced by VHDLOutlineParser::createFlow and VHDLOutlineParser::handleFlowComment.

alignCommentNode()

void FlowChart::alignCommentNode (TextStream & t, QCString com)
static

Declaration at line 297 of file vhdldocgen.h, definition at line 2721 of file vhdldocgen.cpp.

2722{
2723 size_t max=0;
2724 QCString s;
2725 StringVector ql=split(com.str(),"\n");
2726 for (size_t j=0;j<ql.size();j++)
2727 {
2728 s=ql[j];
2729 if (max<s.length()) max=s.length();
2730 }
2731
2732 s=ql.back();
2733 int diff=static_cast<int>(max-s.length());
2734
2735 QCString n;
2736 if (diff>0)
2737 {
2738 n.fill(' ',2*diff);
2739 n.append(".");
2740 s+=n;
2741 ql.pop_back();
2742 ql.push_back(s.str());
2743 }
2744
2745 for (size_t j=0;j<ql.size();j++)
2746 {
2747 s=ql[j];
2748 if (j<ql.size()-1)
2749 {
2750 s+="\n";
2751 }
2753 }
2754}

References QCString::append, codify, QCString::fill, QCString::length, split and QCString::str.

Referenced by buildCommentNodes and writeShape.

alignFuncProc()

void FlowChart::alignFuncProc (QCString & q, const ArgumentList & al, bool isFunc)
static

Declaration at line 292 of file vhdldocgen.h, definition at line 3279 of file vhdldocgen.cpp.

3279void FlowChart::alignFuncProc( QCString & q,const ArgumentList &al,bool isFunc)
3280{
3281 size_t index=al.size();
3282 if (index==0) return;
3283
3284 size_t len=q.length()+VhdlDocGen::getFlowMember()->name().length();
3285 QCString prev,temp;
3286 prev.fill(' ',static_cast<int>(len)+1);
3287
3288 q+="\n";
3289 for (const Argument &arg : al)
3290 {
3291 QCString attl=arg.defval+" ";
3292 attl+=arg.name+" ";
3293
3294 if (!isFunc)
3295 {
3296 attl+=arg.attrib+" ";
3297 }
3298 else
3299 {
3300 attl+=" in ";
3301 }
3302 attl+=arg.type;
3303 if (--index) attl+=",\n"; else attl+="\n";
3304
3305 attl.prepend(prev);
3306 temp+=attl;
3307 }
3308
3309 q+=temp;
3310}

References QCString::fill, VhdlDocGen::getFlowMember, QCString::length, Definition::name, QCString::prepend and ArgumentList::size.

Referenced by VHDLOutlineParser::createFlow.

buildCommentNodes()

void FlowChart::buildCommentNodes (TextStream & t)
static

Declaration at line 296 of file vhdldocgen.h, definition at line 2757 of file vhdldocgen.cpp.

2758{
2759 size_t size=flowList.size();
2760 bool begin=false;
2761
2762 if (size>0)
2763 {
2764 for (uint32_t j=0;j < size-1 ;j++)
2765 {
2766 FlowChart &fll = flowList[j];
2767 if (fll.type & COMMENT_NO)
2768 {
2769 FlowChart &to=flowList[j+1];
2770 if (to.type & COMMENT_NO)
2771 {
2772 to.label = fll.label+"\n"+to.label;
2773 flowList.erase(flowList.begin()+j);
2774 if (size>0) size--;
2775 if (j>0) j--;
2776 }
2777 }
2778 }// for
2779 }
2780
2781 for (size_t j=0;j <flowList.size() ;j++)
2782 {
2783 const FlowChart &fll=flowList[j];
2784
2785 if (fll.type & BEGIN_NO)
2786 {
2787 begin = true;
2788 continue;
2789 }
2790
2791 if (fll.type & COMMENT_NO)
2792 {
2793 const FlowChart *to = nullptr;
2794 if (!begin)
2795 {
2796 // comment between function/process .. begin is linked to start node
2797 to = &flowList[0];
2798 }
2799 else if (j>0 && flowList[j-1].line==fll.line)
2800 {
2801 to = &flowList[j-1];
2802 }
2803 else
2804 {
2805 to = &flowList[j+1];
2806 }
2807 t << getNodeName(fll.id);
2808 t << "[shape=none, label=<\n";
2809 t << "<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"2\" >\n ";
2810 t << "<TR><TD BGCOLOR=\"";
2811 t << flowCol.comment;
2812 t << "\" > ";
2813
2815 t << " </TD></TR></TABLE>>];";
2816 writeEdge(t,fll.id,to->id,2);
2817 }
2818 }// for
2819
2820 // delete comment nodes;
2821 size=flowList.size();
2822 for (size_t j=0; j<size; j++)
2823 {
2824 FlowChart &fll=flowList[j];
2825 if (fll.type & (COMMENT_NO | BEGIN_NO))
2826 {
2827 size_t diff=FLOWLEN-(j+1);
2828
2829 if ((fll.type & COMMENT_NO) && diff > 1)
2830 {
2831 flowList[j+1].label = fll.label;
2832 }
2833
2834 flowList.erase(flowList.begin()+j);
2835
2836 if (size>0) size--;
2837 if (j>0) j--;
2838 }
2839 }// for;
2840}

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

Referenced by writeFlowChart.

codify()

void FlowChart::codify (TextStream & t, const QCString & str)
static

Declaration at line 269 of file vhdldocgen.h, definition at line 2842 of file vhdldocgen.cpp.

2843{
2844 if (!str.isEmpty())
2845 {
2846 const char *p=str.data();
2847 while (*p)
2848 {
2849 char c=*p++;
2850 switch(c)
2851 {
2852 case '<': t << "&lt;"; break;
2853 case '>': t << "&gt;"; break;
2854 case '&': t << "&amp;"; break;
2855 case '\'': t << "&#39;"; break;
2856 case '"': t << "&quot;"; break;
2857 case '\n': t <<"<BR ALIGN=\"LEFT\"/>"; break;
2858 default: t << c; break;
2859 }
2860 }
2861 }
2862}//codify

References QCString::data and QCString::isEmpty.

Referenced by alignCommentNode.

colTextNodes()

void FlowChart::colTextNodes ()
static

Declaration at line 276 of file vhdldocgen.h, definition at line 2657 of file vhdldocgen.cpp.

2658{
2659 FlowChart *flno = nullptr;
2660 bool found=FALSE;
2661 for (size_t j=0;j<flowList.size();j++)
2662 {
2663 FlowChart &flo = flowList[j];
2664 if (flo.type&TEXT_NO)
2665 {
2666 if (!found)
2667 {
2668 flno=&flo;
2669 }
2670 else
2671 {
2672 flno->text+=flo.text;
2673 flowList.erase(flowList.begin()+j);
2674 if (j>0) j=j-1;
2675 }
2676 found=TRUE;
2677 }
2678 else
2679 {
2680 found=FALSE;
2681 }
2682 }
2683
2684 // find if..endif without text
2685 // if..elseif without text
2686 if (!flowList.empty())
2687 {
2688 for (size_t j=0;j<flowList.size()-1;j++)
2689 {
2690 const FlowChart &flo = flowList[j];
2691 int kind = flo.type;
2692 if ( (kind & IFF) || (flo.type & ELSE_NO))
2693 {
2694 const FlowChart &ftemp = flowList[j+1];
2695 if (ftemp.type & EMPTY)
2696 {
2697 FlowChart fc(TEXT_NO,"empty ",QCString());
2698 fc.stamp = flo.stamp;
2699 flowList.insert(flowList.begin()+j+1,fc);
2700 }
2701 }
2702 }
2703 }
2704
2705}// colTextNode

References ELSE_NO, EMPTY, FALSE, FlowChart, flowList, IFF, stamp, text, TEXT_NO, TRUE and type.

Referenced by writeFlowChart.

convertNameToFileName()

QCString FlowChart::convertNameToFileName ()
static

Declaration at line 293 of file vhdldocgen.h, definition at line 3016 of file vhdldocgen.cpp.

References VhdlDocGen::getFlowMember and Definition::name.

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

createSVG()

void FlowChart::createSVG ()
static

Declaration at line 266 of file vhdldocgen.h, definition at line 3050 of file vhdldocgen.cpp.

3051{
3052 QCString qcs("/");
3053 QCString ov = Config_getString(HTML_OUTPUT);
3054
3056
3057 //const MemberDef *m=VhdlDocGen::getFlowMember();
3058 //if (m)
3059 // fprintf(stderr,"\n creating flowchart : %s %s in file %s \n",theTranslator->trVhdlType(m->getMemberSpecifiers(),TRUE),qPrint(m->name()),qPrint(m->getFileDef()->name()));
3060
3061 QCString dir=" -o \""+ov+qcs+"\"";
3062 ov+="/flow_design.dot";
3063
3064 QCString vlargs="-Tsvg \""+ov+"\" "+dir ;
3065
3067 {
3068 err("could not create dot file\n");
3069 }
3070}

References Config_getString, convertNameToFileName, err, Portable::system and Doxygen::verifiedDotPath.

Referenced by writeFlowChart.

delFlowList()

void FlowChart::delFlowList ()
static

Declaration at line 285 of file vhdldocgen.h, definition at line 2714 of file vhdldocgen.cpp.

2715{
2716 ifcounter=0;
2717 nodeCounter=0;
2718 flowList.clear();
2719}

References flowList, ifcounter and nodeCounter.

Referenced by writeFlowChart.

endDot()

void FlowChart::endDot (TextStream & t)
static

Declaration at line 268 of file vhdldocgen.h, definition at line 3080 of file vhdldocgen.cpp.

3081{
3082 t << " } \n";
3083}

Referenced by writeFlowChart.

findLabel()

size_t FlowChart::findLabel (size_t j, const QCString & label)
static

Declaration at line 284 of file vhdldocgen.h, definition at line 3352 of file vhdldocgen.cpp.

3352size_t FlowChart::findLabel(size_t index,const QCString &label)
3353{
3354 for (size_t j=index;j>0;j--)
3355 {
3356 const FlowChart &flo = flowList[j];
3357 if ((flo.type & LOOP) && !flo.label.isEmpty() && qstricmp(flo.label,label)==0)
3358 {
3359 return j;
3360 }
3361 }
3362 err("could not find label: '{}'\n",label);
3363 return 0;
3364}

References err, FlowChart, flowList, QCString::isEmpty, label, LOOP, qstricmp and type.

Referenced by writeFlowLinks.

findNextLoop()

size_t FlowChart::findNextLoop (size_t j, int stamp)
static

Declaration at line 282 of file vhdldocgen.h, definition at line 3312 of file vhdldocgen.cpp.

3312size_t FlowChart::findNextLoop(size_t index,int stamp)
3313{
3314 for (size_t j=index+1; j<flowList.size(); j++)
3315 {
3316 const FlowChart &flo = flowList[j];
3317 if (flo.stamp==stamp)
3318 {
3319 continue;
3320 }
3321 if (flo.type&END_LOOP)
3322 {
3323 return j;
3324 }
3325 }
3326 return flowList.size()-1;
3327}

References END_LOOP, FlowChart, flowList, stamp and type.

Referenced by writeFlowLinks.

findNode()

size_t FlowChart::findNode (size_t index, int stamp, int type)
static

Declaration at line 280 of file vhdldocgen.h, definition at line 3366 of file vhdldocgen.cpp.

3366size_t FlowChart::findNode(size_t index,int stamp,int type)
3367{
3368 for (size_t j=index+1; j<flowList.size(); j++)
3369 {
3370 const FlowChart &flo = flowList[j];
3371 if (flo.type==type && flo.stamp==stamp)
3372 {
3373 return j;
3374 }
3375 }
3376 return 0;
3377}// findNode

References FlowChart, flowList, stamp and type.

Referenced by getNextIfLink, getNextNode and writeFlowLinks.

findNode()

size_t FlowChart::findNode (size_t index, int type)
static

Definition at line 281 of file vhdldocgen.h.

References exp, FALSE, label, stamp, text and type.

findPrevLoop()

size_t FlowChart::findPrevLoop (size_t j, int stamp, bool endif=FALSE)
static

Declaration at line 283 of file vhdldocgen.h, definition at line 3329 of file vhdldocgen.cpp.

3329size_t FlowChart::findPrevLoop(size_t index,int stamp,bool endif)
3330{
3331 for (size_t j=index;j>0;j--)
3332 {
3333 const FlowChart &flo = flowList[j];
3334 if (flo.type & LOOP)
3335 {
3336 if (flo.stamp==stamp && endif)
3337 {
3338 return j;
3339 }
3340 else
3341 {
3342 if (flo.stamp<stamp)
3343 {
3344 return j;
3345 }
3346 }
3347 }
3348 }
3349 return flowList.size()-1;
3350}

References FlowChart, flowList, LOOP, stamp and type.

Referenced by writeFlowLinks.

getNextIfLink()

size_t FlowChart::getNextIfLink (const FlowChart & fl, size_t index)
static

Declaration at line 278 of file vhdldocgen.h, definition at line 3420 of file vhdldocgen.cpp.

3420size_t FlowChart::getNextIfLink(const FlowChart &fl,size_t index)
3421{
3422 int stamp=fl.stamp;
3423 size_t start = index+1;
3424 size_t endifNode = findNode(start,stamp,ENDIF_NO);
3425 size_t elseifNode = findNode(start,stamp,ELSIF_NO);
3426 size_t elseNode = findNode(start,stamp,ELSE_NO);
3427
3428 if (elseifNode>0 && elseifNode<endifNode)
3429 {
3430 return elseifNode;
3431 }
3432
3433 if (elseNode>0 && elseNode<endifNode)
3434 {
3435 return elseNode+1;
3436 }
3437
3438 stamp=flowList[endifNode].stamp;
3439 return getNextNode(endifNode,stamp);
3440}

References ELSE_NO, ELSIF_NO, ENDIF_NO, findNode, FlowChart, flowList, getNextNode and stamp.

Referenced by writeFlowLinks.

getNextNode()

size_t FlowChart::getNextNode (size_t index, int stamp)
static

Declaration at line 279 of file vhdldocgen.h, definition at line 3379 of file vhdldocgen.cpp.

3379size_t FlowChart::getNextNode(size_t index,int stamp)
3380{
3381 for (size_t j=index+1; j<flowList.size(); j++)
3382 {
3383 const FlowChart &flo = flowList[j];
3384 int kind = flo.type;
3385 int s = flo.stamp;
3386 if (s>stamp)
3387 {
3388 continue;
3389 }
3390 if (kind & ENDIF_NO)
3391 {
3392 if (s<stamp && stamp>0)
3393 {
3394 stamp--;
3395 continue;
3396 }
3397 }
3398 if (kind & (ELSE_NO | ELSIF_NO))
3399 {
3400 if (s<stamp && stamp>0)
3401 {
3402 stamp--;
3403 }
3405 continue;
3406 }
3407 if (kind & WHEN_NO)
3408 {
3409 if (s<stamp && stamp>0)
3410 {
3411 stamp--;
3412 }
3413 return findNode(j,stamp-1,END_CASE);
3414 }
3415 return j;
3416 }
3417 return FLOWLEN;
3418}

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

Referenced by getNextIfLink and writeFlowLinks.

getNodeName()

QCString FlowChart::getNodeName (int n)
static

Declaration at line 275 of file vhdldocgen.h, definition at line 2707 of file vhdldocgen.cpp.

2708{
2709 QCString node;
2710 node.setNum(n);
2711 return node.prepend("node");
2712}

References QCString::prepend and QCString::setNum.

Referenced by buildCommentNodes, writeEdge, writeEdge and writeShape.

getNodeType()

const char * FlowChart::getNodeType (int c)
static

Declaration at line 286 of file vhdldocgen.h, definition at line 3021 of file vhdldocgen.cpp.

3021const char* FlowChart::getNodeType(int c)
3022{
3023 switch(c)
3024 {
3025 case IF_NO: return "if ";
3026 case ELSIF_NO: return "elsif ";
3027 case ELSE_NO: return "else ";
3028 case CASE_NO: return "case ";
3029 case WHEN_NO: return "when ";
3030 case EXIT_NO: return "exit ";
3031 case END_NO: return "end ";
3032 case TEXT_NO: return "text ";
3033 case START_NO: return "start ";
3034 case ENDIF_NO: return "endif ";
3035 case FOR_NO: return "for ";
3036 case WHILE_NO: return "while ";
3037 case END_LOOP: return "end_loop ";
3038 case END_CASE: return "end_case ";
3039 case VARIABLE_NO: return "variable_decl ";
3040 case RETURN_NO: return "return ";
3041 case LOOP_NO: return "infinite loop ";
3042 case NEXT_NO: return "next ";
3043 case COMMENT_NO: return "comment ";
3044 case EMPTY_NO: return "empty ";
3045 case BEGIN_NO: return "<begin> ";
3046 default: return "--failure--";
3047 }
3048}

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.

getTimeStamp()

int FlowChart::getTimeStamp ()
static

Definition at line 290 of file vhdldocgen.h.

References FlowChart and label.

moveToPrevLevel()

void FlowChart::moveToPrevLevel ()
static

Declaration at line 289 of file vhdldocgen.h, definition at line 2930 of file vhdldocgen.cpp.

2931{
2932 if (!VhdlDocGen::getFlowMember()) return;
2933 ifcounter--;
2934}

References VhdlDocGen::getFlowMember and ifcounter.

printFlowTree()

void FlowChart::printFlowTree ()
static

Declaration at line 295 of file vhdldocgen.h, definition at line 2649 of file vhdldocgen.cpp.

2650{
2651 for (const auto &flowChart : flowList)
2652 {
2653 printNode(flowChart);
2654 }
2655}

References flowList and printNode.

Referenced by writeFlowChart.

printNode()

void FlowChart::printNode (const FlowChart & n)
static

Declaration at line 294 of file vhdldocgen.h, definition at line 2589 of file vhdldocgen.cpp.

2590{
2591 QCString ui="-";
2592 std::string q;
2593 std::string t;
2594
2595 ui.fill('-',255);
2596
2597 if (flo.type & STARTL)
2598 {
2599 if (flo.stamp>0)
2600 {
2601 q=ui.left(2*flo.stamp).str();
2602 }
2603 else
2604 {
2605 q=" ";
2606 }
2608 printf("\nYES: %s%s[%d,%d]",qPrint(q),qPrint(nn),flo.stamp,flo.id);
2609 }
2610 else
2611 {
2612 if (flo.type & COMMENT_NO)
2613 {
2614 t=flo.label.str();
2615 }
2616 else
2617 {
2618 t=flo.text.str();
2619 }
2620 static const reg::Ex ep(R"(\s)");
2621 t = reg::replace(t,ep,std::string());
2622 if (t.empty())
2623 {
2624 t=" ";
2625 }
2626 if (flo.stamp>0)
2627 {
2628 q=ui.left(2*flo.stamp).str();
2629 }
2630 else
2631 {
2632 q=" ";
2633 }
2634 if (flo.type & EMPTNODE)
2635 {
2636 printf("\n NO: %s%s[%d,%d]",q.c_str(),FlowChart::getNodeType(flo.type),flo.stamp,flo.id);
2637 }
2638 else if (flo.type & COMMENT_NO)
2639 {
2640 printf("\n NO: %s%s[%d,%d]",t.c_str(),FlowChart::getNodeType(flo.type),flo.stamp,flo.id);
2641 }
2642 else
2643 {
2644 printf("\n NO: %s[%d,%d]",t.c_str(),flo.stamp,flo.id);
2645 }
2646 }
2647}

References COMMENT_NO, EMPTNODE, exp, QCString::fill, FlowChart, getNodeType, id, label, QCString::left, qPrint, reg::replace, stamp, STARTL, QCString::str, QCString::stripWhiteSpace, text and type.

Referenced by printFlowTree.

printPlantUmlNode()

QCString FlowChart::printPlantUmlNode (const FlowChart & flo, bool ca, bool endL)
static

Declaration at line 300 of file vhdldocgen.h, definition at line 2936 of file vhdldocgen.cpp.

2937{
2938 QCString t;
2941 switch (flo.type)
2942 {
2943 case START_NO: t=":"+text+"|"; break;
2944 case IF_NO : t="\nif ("+exp+") then (yes)"; break;
2945 case ELSIF_NO: t="\nelseif ("+exp+") then (yes)"; break;
2946 case ELSE_NO: t="\nelse"; break;
2947 case CASE_NO: t="\n:"+exp+";"; break;
2948 case WHEN_NO: t="\n";
2949 if (!ca) t+="else";
2950 t+="if ("+exp+") then (yes)";
2951 break;
2952 case EXIT_NO: break;
2953 case END_NO: if (text.contains(" function")==0) t="\n:"+text+";";
2954 break;
2955 case TEXT_NO: t="\n:"+text+"]"; break;
2956 case ENDIF_NO: t="\nendif"; break;
2957 case FOR_NO: t="\nwhile ("+exp+") is (yes)"; break;
2958 case WHILE_NO: t="\nwhile ("+exp+") is (yes)"; break;
2959 case END_LOOP: t="\nendwhile"; break;
2960 case END_CASE: t="\nendif\n:end case;"; break;
2961 case VARIABLE_NO:t="\n:"+text+";"; break;
2962 case RETURN_NO: t="\n:"+text+";";
2963 if (!endL) t+="\nstop";
2964 break;
2965 case LOOP_NO: t="\nwhile (infinite loop)"; break;
2966 case NEXT_NO: break;
2967 case EMPTY_NO: break;
2968 case COMMENT_NO: t="\n note left \n "+flo.label+"\nend note \n"; break;
2969 case BEGIN_NO: t="\n:begin;"; break;
2970 default: assert(false); break;
2971 }
2972 return t;
2973}

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

Referenced by printUmlTree.

printUmlTree()

void FlowChart::printUmlTree ()
static

Declaration at line 299 of file vhdldocgen.h, definition at line 2975 of file vhdldocgen.cpp.

2976{
2977 int caseCounter = 0;
2978 int whenCounter = 0;
2979
2980 QCString qcs;
2981 size_t size=flowList.size();
2982 for (size_t j=0;j<size;j++)
2983 {
2984 bool endList = j==FLOWLEN;
2985 const FlowChart &flo = flowList[j];
2986 if (flo.type==CASE_NO)
2987 {
2988 caseCounter++;
2989 whenCounter=0;
2990 }
2991
2992 if (flo.type==END_CASE)
2993 {
2994 caseCounter--;
2995 }
2996
2997 bool ca = (caseCounter>0 && whenCounter==0);
2998
2999 qcs+=printPlantUmlNode(flo,ca,endList);
3000
3001 if (flo.type==WHEN_NO)
3002 {
3003 whenCounter++;
3004 }
3005
3006 }
3007 qcs+="\n";
3008
3009 QCString htmlOutDir = Config_getString(HTML_OUTPUT);
3010
3014}

References CASE_NO, Config_getString, convertNameToFileName, END_CASE, FlowChart, FLOWLEN, flowList, PlantumlManager::generatePlantUMLOutput, PlantumlManager::instance, printPlantUmlNode, PlantumlManager::PUML_SVG, type, WHEN_NO and PlantumlManager::writePlantUMLSource.

Referenced by writeFlowChart.

startDot()

void FlowChart::startDot (TextStream & t)
static

Declaration at line 267 of file vhdldocgen.h, definition at line 3072 of file vhdldocgen.cpp.

3073{
3074 t << " digraph G { \n";
3075 t << "rankdir=TB \n";
3076 t << "concentrate=true\n";
3077 t << "stylesheet=\"doxygen.css\"\n";
3078}

Referenced by writeFlowChart.

writeEdge()

void FlowChart::writeEdge (TextStream & t, int fl_from, int fl_to, int i, bool bFrom=FALSE, bool bTo=FALSE)
static

Declaration at line 271 of file vhdldocgen.h, definition at line 3250 of file vhdldocgen.cpp.

3250void FlowChart::writeEdge(TextStream &t,int fl_from,int fl_to,int i,bool bFrom,bool bTo)
3251{
3252 QCString label,col;
3253
3254 if (i==0)
3255 {
3256 col=flowCol.yesNodeLink;
3257 label="yes";
3258 }
3259 else if (i==1)
3260 {
3261 col=flowCol.noNodeLink;
3262 label="no";
3263 }
3264 else
3265 {
3266 col=flowCol.textNodeLink;
3267 label="";
3268 }
3269
3270 t << "edge [color=\""+col+"\",label=\""+label+"\"]\n";
3271 t << getNodeName(fl_from);
3272 if (bFrom) t << ":s";
3273 t << "->";
3274 t << getNodeName(fl_to);
3275 if (bTo) t << ":n";
3276 t << "\n";
3277}

References flowCol, getNodeName and label.

Referenced by buildCommentNodes, writeEdge and writeFlowLinks.

writeEdge()

void FlowChart::writeEdge (TextStream & t, const FlowChart & fl_from, const FlowChart & fl_to, int i)
static

Declaration at line 272 of file vhdldocgen.h, definition at line 3232 of file vhdldocgen.cpp.

3232void FlowChart::writeEdge(TextStream &t,const FlowChart &fl_from,const FlowChart &fl_to,int i)
3233{
3234 bool b=fl_from.type & STARTL;
3235 bool c=fl_to.type & STARTL;
3236
3237#ifdef DEBUGFLOW
3238 QCString s1(getNodeName(fl_from.id));
3239 QCString s2(getNodeName(fl_to.id));
3240 auto it = g_keyMap.find(s1.str());
3241 auto it1 = g_keyMap.find(s2.str());
3242 // checks if the link is connected to a valid node
3243 assert(it!=g_keyMap.end());
3244 assert(it1!=g_keyMap.end());
3245#endif
3246
3247 writeEdge(t,fl_from.id,fl_to.id,i,b,c);
3248}

References FlowChart, getNodeName, id, STARTL, QCString::str, type and writeEdge.

writeFlowChart()

void FlowChart::writeFlowChart ()
static

Declaration at line 291 of file vhdldocgen.h, definition at line 3085 of file vhdldocgen.cpp.

3086{
3087 // assert(VhdlDocGen::flowMember);
3088
3089 QCString ov = Config_getString(HTML_OUTPUT);
3090 QCString fileName = ov+"/flow_design.dot";
3091 std::ofstream f = Portable::openOutputStream(fileName);
3092 if (!f.is_open())
3093 {
3094 err("Cannot open file {} for writing\n",fileName);
3095 return;
3096 }
3097 TextStream t(&f);
3098
3099 colTextNodes();
3100 // buildCommentNodes(t);
3101
3102#ifdef DEBUGFLOW
3104#endif
3105
3106 if (!Config_getString(PLANTUML_JAR_PATH).isEmpty())
3107 {
3108 printUmlTree();
3109 delFlowList();
3110 t.flush();
3111 f.close();
3112 return;
3113 }
3114
3115 startDot(t);
3117 for (const auto &fll : flowList)
3118 {
3119 writeShape(t,fll);
3120 }
3122
3124 delFlowList();
3125 t.flush();
3126 f.close();
3128}// writeFlowChart

References buildCommentNodes, colTextNodes, Config_getString, createSVG, delFlowList, endDot, err, flowList, TextStream::flush, Portable::openOutputStream, printFlowTree, printUmlTree, startDot, writeFlowLinks and writeShape.

Referenced by VHDLOutlineParser::createFlow.

writeFlowLinks()

void FlowChart::writeFlowLinks (TextStream & t)
static

Declaration at line 273 of file vhdldocgen.h, definition at line 3442 of file vhdldocgen.cpp.

3443{
3444 size_t size=flowList.size();
3445 if (size<2) return;
3446
3447 // write start link
3448 writeEdge(t,flowList[0],flowList[1],2);
3449
3450 for (size_t j=0;j<size;j++)
3451 {
3452 const FlowChart &fll = flowList[j];
3453 int kind = fll.type;
3454 int stamp = fll.stamp;
3455 if (kind & EEND)
3456 {
3457 continue;
3458 }
3459
3460 if (kind & IFF)
3461 {
3462 writeEdge(t,fll,flowList[j+1],0);
3463 size_t z=getNextIfLink(fll,j);
3464 // assert(z>-1);
3465 writeEdge(t,fll,flowList[z],1);
3466 }
3467 else if (kind & LOOP_NO)
3468 {
3469 writeEdge(t,fll,flowList[j+1],2);
3470 continue;
3471 }
3472 else if (kind & (CASE_NO | FOR_NO | WHILE_NO))
3473 {
3474 if (kind & CASE_NO)
3475 {
3476 writeEdge(t,fll,flowList[j+1],2);
3477 continue;
3478 }
3479 else
3480 {
3481 writeEdge(t,fll,flowList[j+1],0);
3482 }
3483
3484 kind=END_LOOP;
3485 size_t z=findNode(j+1,fll.stamp,kind);
3486 z=getNextNode(z,flowList[z].stamp);
3487
3488 // assert(z>-1);
3489 writeEdge(t,fll,flowList[z],1);
3490 continue;
3491 }
3492 else if (kind & (TEXT_NO | VARIABLE_NO))
3493 {
3494 size_t z=getNextNode(j,stamp);
3495 writeEdge(t,fll,flowList[z],2);
3496 }
3497 else if (kind & WHEN_NO)
3498 {
3499 // default value
3500 if (qstricmp(fll.text.simplifyWhiteSpace(),"others")==0)
3501 {
3502 writeEdge(t,fll,flowList[j+1],2);
3503 continue;
3504 }
3505
3506
3507 writeEdge(t,fll,flowList[j+1],0);
3508 size_t u=findNode(j,stamp,WHEN_NO);
3509 size_t v=findNode(j,stamp-1,END_CASE);
3510
3511 if (u>0 && u<v)
3512 {
3513 writeEdge(t,fll,flowList[u],1);
3514 }
3515 else
3516 {
3517 writeEdge(t,fll,flowList[v],1);
3518 }
3519 }
3520 else if (kind & END_CASE)
3521 {
3522 size_t z=FlowChart::getNextNode(j,fll.stamp);
3523 writeEdge(t,fll,flowList[z],2);
3524 }
3525 else if (kind & END_LOOP)
3526 {
3527 size_t z=findPrevLoop(j,fll.stamp,true);
3528 writeEdge(t,fll,flowList[z],2);
3529 }
3530 else if (kind & RETURN_NO)
3531 {
3532 writeEdge(t,fll,flowList[size-1],2);
3533 }
3534 else if (kind & (EXIT_NO | NEXT_NO))
3535 {
3536 size_t z = 0;
3537 bool b = kind==NEXT_NO;
3538 if (!fll.exp.isEmpty())
3539 {
3540 writeEdge(t,fll,flowList[j+1],1);
3541 }
3542 if (!fll.label.isEmpty())
3543 {
3544 z=findLabel(j,fll.label);
3545 if (b)
3546 {
3547 writeEdge(t,fll,flowList[z],0);
3548 }
3549 else
3550 {
3552 z=getNextNode(z,flowList[z].stamp);
3553 writeEdge(t,fll,flowList[z],0);
3554 }
3555 continue;
3556 }
3557 else
3558 {
3559 if (b)
3560 {
3561 z=findPrevLoop(j,fll.stamp);
3562 writeEdge(t,fll,flowList[z],0);
3563 continue;
3564 }
3565 else
3566 {
3567 z =findNextLoop(j,fll.stamp-1);
3568 }
3569 z=getNextNode(z,flowList[z].stamp);
3570 }
3571 writeEdge(t,fll,flowList[z],0);
3572 }
3573 } //for
3574} //writeFlowLinks

References CASE_NO, EEND, END_CASE, END_LOOP, EXIT_NO, exp, findLabel, findNextLoop, findNode, findPrevLoop, FlowChart, flowList, FOR_NO, getNextIfLink, getNextNode, IFF, QCString::isEmpty, label, LOOP_NO, NEXT_NO, qstricmp, RETURN_NO, QCString::simplifyWhiteSpace, stamp, text, TEXT_NO, type, VARIABLE_NO, WHEN_NO, WHILE_NO and writeEdge.

Referenced by writeFlowChart.

writeShape()

void FlowChart::writeShape (TextStream & t, const FlowChart & fl)
static

Declaration at line 270 of file vhdldocgen.h, definition at line 3130 of file vhdldocgen.cpp.

3131{
3132 if (fl.type & EEND) return;
3133 QCString var;
3134 if (fl.type & LOOP)
3135 {
3136 var=" loop";
3137 }
3138 else if (fl.type & IFF)
3139 {
3140 var=" then";
3141 }
3142 else
3143 {
3144 var="";
3145 }
3146
3147 t << getNodeName(fl.id);
3148
3149#ifdef DEBUGFLOW
3150 QCString qq(getNodeName(fl.id));
3151 g_keyMap.emplace(qq.str(),fl.id);
3152#endif
3153
3154 bool dec=(fl.type & DECLN);
3155 bool exit=(fl.type & EXITNEXT);
3156 if (exit && !fl.exp.isEmpty())
3157 {
3158 dec=TRUE;
3159 }
3160 if (dec)
3161 {
3162 QCString exp=fl.exp;
3163 alignText(exp);
3164
3165 t << " [shape=diamond,style=filled,color=\"";
3166 t << flowCol.decisionNode;
3167 t << "\",label=\" ";
3168 QCString kl;
3169 if (exit) kl=fl.text+" ";
3170
3171 if (!fl.label.isEmpty())
3172 {
3173 kl+=fl.label+":"+exp+var;
3174 }
3175 else
3176 {
3177 kl+=exp+var;
3178 }
3179
3181 t << "\"]\n";
3182 }
3183 else if (fl.type & ENDCL)
3184 {
3185 QCString val=fl.text;
3186 t << " [shape=ellipse ,label=\""+val+"\"]\n";
3187 }
3188 else if (fl.type & STARTFIN)
3189 {
3190 QCString val=fl.text;
3191 t << "[shape=box , style=rounded label=<\n";
3192 t << "<TABLE BORDER=\"0\" CELLBORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\" >\n ";
3193 t << "<TR><TD BGCOLOR=\"";
3194 t<< flowCol.startEndNode;
3195 t<< "\"> ";
3197 t << " </TD></TR></TABLE>>];";
3198 }
3199 else
3200 {
3201 if (fl.text.isEmpty()) return;
3202 bool isVar=(fl.type & FlowChart::VARIABLE_NO);
3203 QCString q=fl.text;
3204
3205 if (exit)
3206 {
3207 q+=" "+fl.label;
3208 }
3209
3210 int z=q.findRev("\n");
3211
3212 if (z==static_cast<int>(q.length())-1)
3213 {
3214 q=q.remove(z,2);
3215 }
3216 t << "[shape=none margin=0.1, label=<\n";
3217 t << "<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"2\" >\n ";
3218 if (isVar)
3219 {
3220 t << "<TR><TD BGCOLOR=\"" << flowCol.varNode << "\" > ";
3221 }
3222 else
3223 {
3224 t << "<TR><TD BGCOLOR=\"" << flowCol.textNode << "\" > ";
3225 }
3227 t << " </TD></TR></TABLE>>];";
3228 }
3229}

References alignCommentNode, alignText, DECLN, EEND, ENDCL, EXITNEXT, exp, QCString::findRev, FlowChart, flowCol, getNodeName, id, IFF, QCString::isEmpty, label, QCString::length, LOOP, QCString::remove, STARTFIN, QCString::str, text, TRUE, type and VARIABLE_NO.

Referenced by writeFlowChart.


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


Generated via doxygen2docusaurus by Doxygen 1.14.0.