Doxygen
Loading...
Searching...
No Matches
vhdldocgen.cpp
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Copyright (C) 1997-2015 by Dimitri van Heesch.
4 *
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation under the terms of the GNU General Public License is hereby
7 * granted. No representations are made about the suitability of this software
8 * for any purpose. It is provided "as is" without express or implied warranty.
9 * See the GNU General Public License for more details.
10 *
11 * Documents produced by Doxygen are derivative works derived from the
12 * input used in their production; they are not affected by this license.
13 *
14 */
15/******************************************************************************
16 * Parser for VHDL subset
17 * written by M. Kreis
18 * supports VHDL-87/93/2008
19 * does not support VHDL-AMS
20 ******************************************************************************/
21
22// global includes
23#include <stdio.h>
24#include <stdlib.h>
25#include <assert.h>
26#include <string.h>
27#include <map>
28#include <algorithm>
29#include <unordered_set>
30#include <mutex>
31
32/* --------------------------------------------------------------- */
33
34// local includes
35#include "qcstring.h"
36#include "vhdldocgen.h"
37#include "message.h"
38#include "config.h"
39#include "doxygen.h"
40#include "util.h"
41#include "language.h"
42#include "commentscan.h"
43#include "definition.h"
44#include "searchindex.h"
45#include "outputlist.h"
46#include "parserintf.h"
47#include "layout.h"
48#include "arguments.h"
49#include "portable.h"
50#include "memberlist.h"
51#include "memberdef.h"
52#include "groupdef.h"
53#include "classlist.h"
54#include "namespacedef.h"
55#include "filename.h"
56#include "membergroup.h"
57#include "memberdef.h"
58#include "membername.h"
59#include "plantuml.h"
60#include "vhdljjparser.h"
61#include "VhdlParser.h"
62#include "regex.h"
63#include "plantuml.h"
64#include "textstream.h"
65#include "moduledef.h"
66
67//#define DEBUGFLOW
68#define theTranslator_vhdlType theTranslator->trVhdlType
69
70static void initUCF(Entry* root,const QCString &type,QCString &qcs,int line,const QCString & fileName,QCString & brief);
71static void writeUCFLink(const MemberDef* mdef,OutputList &ol);
72static void addInstance(ClassDefMutable* entity, ClassDefMutable* arch, ClassDefMutable *inst,
73 const std::shared_ptr<Entry> &cur);
74
75static const MemberDef *flowMember=nullptr;
76
78{
79 flowMember=mem;
80}
81
83{
84 return flowMember;
85}
86
87//--------------------------------------------------------------------------------------------------
88
89static void writeLink(const MemberDef* mdef,OutputList &ol)
90{
92 mdef->getOutputFileBase(),
93 mdef->anchor(),
94 mdef->name());
95}
96
97static void startFonts(const QCString& q, const char *keyword,OutputList& ol)
98{
99 auto &codeOL = ol.codeGenerators();
100 codeOL.startFontClass(keyword);
101 codeOL.codify(q);
102 codeOL.endFontClass();
103}
104
105static QCString splitString(QCString& str,char c)
106{
107 QCString n=str;
108 int i=str.find(c);
109 if (i>0)
110 {
111 n=str.left(i);
112 str=str.remove(0,i+1);
113 }
114 return n;
115}
116
117static int compareString(const QCString& s1,const QCString& s2)
118{
119 return qstricmp(s1.stripWhiteSpace(),s2.stripWhiteSpace());
120}
121
122//--------------------------------------------------------------------------------------------------
123
124 // vhdl keywords included VHDL 2008
125static const std::unordered_set< std::string > g_vhdlKeyWordSet0 =
126{
127 "abs","access","after","alias","all","and","architecture","array","assert","assume","assume_guarantee","attribute",
128 "begin","block","body","buffer","bus",
129 "case","component","configuration","constant","context","cover",
130 "default","disconnect","downto",
131 "else","elsif","end","entity","exit",
132 "fairness","file","for","force","function",
133 "generate","generic","group","guarded",
134 "if","impure","in","inertial","inout","is",
135 "label","library","linkage","literal","loop",
136 "map","mod",
137 "nand","new","next","nor","not","null",
138 "of","on","open","or","others","out",
139 "package","parameter","port","postponed","procedure","process","property","protected","pure",
140 "range","record","register","reject","release","restrict","restrict_guarantee","rem","report","rol","ror","return",
141 "select","sequence","severity","signal","shared","sla","sll","sra","srl","strong","subtype",
142 "then","to","transport","type",
143 "unaffected","units","until","use",
144 "variable","vmode","vprop","vunit",
145 "wait","when","while","with",
146 "xor","xnor"
147};
148
149
150// type
151static const std::unordered_set< std::string> g_vhdlKeyWordSet1 =
152{
153 "natural","unsigned","signed","string","boolean", "bit","bit_vector","character",
154 "std_ulogic","std_ulogic_vector","std_logic","std_logic_vector","integer",
155 "real","float","ufixed","sfixed","time","positive"
156};
157
158// logic
159static const std::unordered_set< std::string > g_vhdlKeyWordSet2 =
160{
161 "abs","and","or","not","mod","xor","rem","xnor","ror","rol","sla","sll"
162};
163
164// predefined attributes
165static const std::unordered_set< std::string > g_vhdlKeyWordSet3 =
166{
167 "base","left","right","high","low","ascending",
168 "image","value","pos","val","succ","pred","leftof","rightof","left","right","high","low",
169 "range","reverse_range","length","ascending","delayed","stable","quiet","transaction","event",
170 "active","last_event","last_active","last_value","driving","driving_value","simple_name","instance_name","path_name"
171};
172
174{
175}
176
177/*!
178 * returns the color of a keyword
179 */
180const char* VhdlDocGen::findKeyWord(const QCString& kw)
181{
182 std::string word=kw.lower().str();
183
184 if (word.empty()) return nullptr;
185
186 if (g_vhdlKeyWordSet0.find(word)!=g_vhdlKeyWordSet0.end())
187 return "keywordflow";
188
189 if (g_vhdlKeyWordSet1.find(word)!=g_vhdlKeyWordSet1.end())
190 return "keywordtype";
191
192 if (g_vhdlKeyWordSet2.find(word)!=g_vhdlKeyWordSet2.end())
193 return "vhdllogic";
194
195 if (g_vhdlKeyWordSet3.find(word)!=g_vhdlKeyWordSet3.end())
196 return "vhdlkeyword";
197
198 return nullptr;
199}
200
202{
203 if (name.isEmpty()) return nullptr;
205}
206
208{
209 return getClass(name);
210}
211
212static std::recursive_mutex g_vhdlMutex;
213static std::map<std::string,const MemberDef*> g_varMap;
214static std::vector<ClassDef*> g_classList;
215static std::map<ClassDef*,std::vector<ClassDef*> > g_packages;
216
217const MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& memName)
218{
219 std::lock_guard lock(g_vhdlMutex);
220 ClassDef *ecd=nullptr;
221 const MemberDef *mdef=nullptr;
222
223 ClassDef *cd=getClass(className);
224 //printf("VhdlDocGen::findMember(%s,%s)=%p\n",qPrint(className),qPrint(memName),cd);
225 if (cd==nullptr) return nullptr;
226
227 mdef=VhdlDocGen::findMemberDef(cd,memName,MemberListType::VariableMembers());
228 if (mdef) return mdef;
229 mdef=VhdlDocGen::findMemberDef(cd,memName,MemberListType::PubMethods());
230 if (mdef) return mdef;
231
232 // nothing found so far
233 // if we are an architecture or package body search in entity
234
237 {
238 Definition *d = cd->getOuterScope();
239 // searching upper/lower case names
240
241 QCString tt=d->name();
242 ecd =getClass(tt);
243 if (!ecd)
244 {
245 tt=tt.upper();
246 ecd =getClass(tt);
247 }
248 if (!ecd)
249 {
250 tt=tt.lower();
251 ecd =getClass(tt);
252 }
253
254 if (ecd) //d && d->definitionType()==Definition::TypeClass)
255 {
256 //ClassDef *ecd = (ClassDef*)d;
257 mdef=VhdlDocGen::findMemberDef(ecd,memName,MemberListType::VariableMembers());
258 if (mdef) return mdef;
259 mdef=VhdlDocGen::findMemberDef(cd,memName,MemberListType::PubMethods());
260 if (mdef) return mdef;
261 }
262 }
263
264
267 {
268 Definition *d = cd->getOuterScope();
269
270 QCString tt=d->name();
271 ClassDef *acd =getClass(tt);
272 if (!acd)
273 {
274 tt=tt.upper();
275 acd =getClass(tt);
276 }
277 if (!acd)
278 {
279 tt=tt.lower();
280 acd =getClass(tt);
281 }
282 if (acd) //d && d->definitionType()==Definition::TypeClass)
283 {
284 if(g_packages.find(acd)==g_packages.end())
285 {
287 }
288 }
289 }
290 else
291 {
292 ecd=cd;
293 if (g_packages.find(ecd)==g_packages.end()) VhdlDocGen::findAllPackages(ecd);
294 }
295
296 if (ecd)
297 {
298 auto cList_it = g_packages.find(ecd);
299 if (cList_it!=g_packages.end())
300 {
301 for (const auto &cdp : cList_it->second)
302 {
303 mdef=VhdlDocGen::findMemberDef(cdp,memName,MemberListType::VariableMembers());
304 if (mdef) return mdef;
305 mdef=VhdlDocGen::findMemberDef(cdp,memName,MemberListType::PubMethods());
306 if (mdef) return mdef;
307 }
308 }
309 }
310 return nullptr;
311
312}//findMember
313
314/**
315 * This function returns the entity|package
316 * in which the key (type) is found
317 */
319{
320 std::lock_guard lock(g_vhdlMutex);
321 QCString keyType=cd->symbolName()+"@"+key;
322 //printf("\n %s | %s | %s",qPrint(cd->symbolName()),key.data(,),qPrint(keyType));
323
324 auto it = g_varMap.find(keyType.str());
325 if (it!=g_varMap.end())
326 {
327 return it->second;
328 }
329 if (std::find(g_classList.begin(),g_classList.end(),cd)!=g_classList.end())
330 {
331 return nullptr;
332 }
333 const MemberList *ml=cd->getMemberList(type);
334 g_classList.push_back(cd);
335 if (!ml)
336 {
337 return nullptr;
338 }
339 //int l=ml->count();
340 // fprintf(stderr,"\n loading entity %s %s: %d",qPrint(cd->symbolName()),qPrint(keyType),l);
341
342 for (const auto &md : *ml)
343 {
344 QCString tkey=cd->symbolName()+"@"+md->name();
345 if (g_varMap.find(tkey.str())==g_varMap.end())
346 {
347 g_varMap.emplace(tkey.str(),md);
348 }
349 }
350 it=g_varMap.find(keyType.str());
351 if (it!=g_varMap.end())
352 {
353 return it->second;
354 }
355 return nullptr;
356}//findMemberDef
357
358/*!
359 * finds all included packages of an Entity or Package
360 */
361
363{
364 std::lock_guard lock(g_vhdlMutex);
365 if (g_packages.find(cdef)!=g_packages.end()) return;
366 std::vector<ClassDef*> cList;
367 MemberList *mem=cdef->getMemberList(MemberListType::VariableMembers());
368 if (mem)
369 {
370 for (const auto &md : *mem)
371 {
372 if (VhdlDocGen::isPackage(md))
373 {
374 ClassDef* cd=VhdlDocGen::getPackageName(md->name());
375 if (cd)
376 {
377 cList.push_back(cd);
379 g_packages.emplace(cdef,cList);
380 }
381 }
382 }//for
383 }
384
385}// findAllPackages
386
387/*!
388 * returns the function with the matching argument list
389 * is called in vhdlcode.l
390 */
391
392const MemberDef* VhdlDocGen::findFunction(const QCString& funcname, const QCString& package)
393{
394 ClassDef *cdef=getClass(package);
395 if (cdef==nullptr) return nullptr;
396
397 MemberList *mem=cdef->getMemberList(MemberListType::PubMethods());
398 if (mem)
399 {
400 for (const auto &mdef : *mem)
401 {
402 QCString mname=mdef->name();
403 if ((VhdlDocGen::isProcedure(mdef) || VhdlDocGen::isVhdlFunction(mdef)) && (compareString(funcname,mname)==0))
404 {
405 return mdef;
406 }//if
407 }//for
408 }//if
409 return nullptr;
410} //findFunction
411
412
413
429
430/*!
431 * returns the class title+ref
432 */
433
435{
436 QCString pageTitle;
437 if (cd==nullptr) return "";
438 pageTitle=VhdlDocGen::getClassName(cd);
439 pageTitle+=" ";
441 return pageTitle;
442} // getClassTitle
443
444/* returns the class name without their prefixes */
445
447{
448 QCString temp;
449 if (cd==nullptr) return "";
450
452 {
453 temp=cd->name();
454 temp.stripPrefix("_");
455 return temp;
456 }
457
458 return substitute(cd->className(),"::",".");
459}
460
461/*!
462 * writes an inline link form entity|package to architecture|package body and vice verca
463 */
464
466{
467 std::vector<QCString> ql;
468 QCString nn=cd->className();
470
472
473 //type=type.lower();
474 type+=" >> ";
477
479 {
480 nn.stripPrefix("_");
481 cd=getClass(nn);
482 }
483 else if (ii==VhdlDocGen::PACKAGECLASS)
484 {
485 nn.prepend("_");
486 cd=getClass(nn);
487 }
489 {
490 StringVector qlist=split(nn.str(),"-");
491 if (qlist.size()>1)
492 {
493 nn=qlist[1];
495 }
496 }
497
498 QCString opp;
500 {
502 for (const auto &s : ql)
503 {
504 StringVector qlist=split(s.str(),"-");
505 if (qlist.size()>2)
506 {
507 QCString s1(qlist[0]);
508 QCString s2(qlist[1]);
509 s1.stripPrefix("_");
510 if (ql.size()==1) s1.clear();
511 ClassDef *cc = getClass(s);
512 if (cc)
513 {
514 VhdlDocGen::writeVhdlLink(cc,ol,type,s2,s1);
515 }
516 }
517 }
518 }
519 else
520 {
521 VhdlDocGen::writeVhdlLink(cd,ol,type,nn,opp);
522 }
523
526
527}// write
528
529/*
530 * finds all architectures which belongs to an entity
531 */
532void VhdlDocGen::findAllArchitectures(std::vector<QCString>& qll,const ClassDef *cd)
533{
534 for (const auto &citer : *Doxygen::classLinkedMap)
535 {
536 QCString className=citer->className();
537 int pos = -1;
538 if (cd != citer.get() && (pos=className.find('-'))!=-1)
539 {
540 QCString postfix=className.mid(pos+1);
541 if (qstricmp(cd->className(),postfix)==0)
542 {
543 qll.push_back(className);
544 }
545 }
546 }// for
547}//findAllArchitectures
548
550{
551 QCString nn=cd->name();
552 for (const auto &citer : *Doxygen::classLinkedMap)
553 {
554 QCString jj=citer->name();
555 StringVector ql=split(jj.str(),":");
556 if (ql.size()>1)
557 {
558 if (ql[0]==nn)
559 {
560 return citer.get();
561 }
562 }
563 }
564 return nullptr;
565}
566/*
567 * writes the link entity >> .... or architecture >> ...
568 */
569
571{
572 if (ccd==nullptr) return;
573 ol.startBold();
574 ol.docify(type);
575 ol.endBold();
576 nn.stripPrefix("_");
578
579 if (!behav.isEmpty())
580 {
581 behav.prepend(" ");
582 ol.startBold();
583 ol.docify(behav);
584 ol.endBold();
585 }
586
587 ol.lineBreak();
588}
589
590
591/*!
592 * strips the "--!" prefixes of vhdl comments
593 */
595{
596 qcs=qcs.stripWhiteSpace();
597 if (qcs.isEmpty()) return;
598
599 const char* sc="--!";
600 if (qcs.startsWith(sc)) qcs = qcs.mid(qstrlen(sc));
601 static const reg::Ex re(R"(\n[ \t]*--!)");
602 std::string s = qcs.str();
603 reg::Iterator iter(s,re);
605 std::string result;
606 size_t p=0;
607 size_t sl=s.length();
608 for ( ; iter!=end ; ++iter)
609 {
610 const auto &match = *iter;
611 size_t i = match.position();
612 result+="\n";
613 result+=s.substr(p,i-p);
614 p = match.position()+match.length();
615 }
616 if (p<sl)
617 {
618 result+="\n";
619 result+=s.substr(p);
620 }
621
622 qcs = result;
623 qcs=qcs.stripWhiteSpace();
624}
625
626
627/*!
628 * parses a function proto
629 * @param text function string
630 * @param name points to the function name
631 * @param ret Stores the return type
632 * @param doc ???
633 */
634void VhdlDocGen::parseFuncProto(const QCString &text,QCString& name,QCString& ret,bool doc)
635{
636 QCString s1(text);
637 QCString temp;
638
639 int index=s1.find("(");
640 if (index<0) index=0;
641 int end=s1.findRev(")");
642
643 if ((end-index)>0)
644 {
645 temp=s1.mid(index+1,(end-index-1));
646 //getFuncParams(qlist,temp);
647 }
648 if (doc)
649 {
650 name=s1.left(index);
651 name=name.stripWhiteSpace();
652 if ((end-index)>0)
653 {
654 ret="function";
655 }
656 return;
657 }
658 else
659 {
660 s1=s1.stripWhiteSpace();
661 int i=s1.find('(');
662 int s=s1.find(' ');
663 if (s==-1) s=s1.find('\t');
664 if (i==-1 || i<s)
666 else // s<i, s=start of name, i=end of name
667 s1=s1.mid(s,(i-s));
668
669 name=s1.stripWhiteSpace();
670 }
671 index=s1.findRev("return",-1,FALSE);
672 if (index !=-1)
673 {
674 ret=s1.mid(index+6,s1.length());
675 ret=ret.stripWhiteSpace();
677 }
678}
679
680/*
681 * returns the n'th word of a string
682 */
683
685{
686 static const reg::Ex reg(R"([\s:|])");
687 auto ql=split(c.str(),reg);
688
689 if (index < static_cast<int>(ql.size()))
690 {
691 return ql[index];
692 }
693
694 return "";
695}
696
697
699{
700 if (prot==VhdlDocGen::ENTITYCLASS)
701 return "entity";
702 else if (prot==VhdlDocGen::ARCHITECTURECLASS)
703 return "architecture";
704 else if (prot==VhdlDocGen::PACKAGECLASS)
705 return "package";
706 else if (prot==VhdlDocGen::PACKBODYCLASS)
707 return "package body";
708
709 return "";
710}
711
712/*!
713 * deletes a char backwards in a string
714 */
715
717{
718 int index=s.findRev(c,-1,FALSE);
719 if (index > -1)
720 {
721 s = s.remove(index,1);
722 return TRUE;
723 }
724 return FALSE;
725}
726
728{
729 int index=s.findRev(c,-1,FALSE);
730 while (index > -1)
731 {
732 s = s.remove(index,1);
733 index=s.findRev(c,-1,FALSE);
734 }
735}
736
737
738static int recordCounter=0;
739
740/*!
741 * returns the next number of a record|unit member
742 */
743
745{
746 char buf[12];
747 qsnprintf(buf,12,"%d",recordCounter++);
748 QCString qcs(&buf[0]);
749 return qcs;
750}
751
752/*!
753 * returns the next number of an anonymous process
754 */
755
757{
758 static int stringCounter;
759 QCString qcs("PROCESS_");
760 char buf[8];
761 qsnprintf(buf,8,"%d",stringCounter++);
762 qcs.append(&buf[0]);
763 return qcs;
764}
765
766/*!
767 * writes a colored and formatted string
768 */
769
771{
772 static const reg::Ex reg(R"([\‍[\‍]./<>:\s,;'+*|&=()\"-])");
773 QCString qcs = s;
774 qcs+=QCString(" ");// parsing the last sign
775 QCString find=qcs;
776 QCString temp=qcs;
777 char buf[2];
778 buf[1]='\0';
779
780 int j = findIndex(temp.str(),reg);
781
782 ol.startBold();
783 if (j>=0)
784 {
785 while (j>=0)
786 {
787 find=find.left(j);
788 buf[0]=temp[j];
789 const char *ss=VhdlDocGen::findKeyWord(find);
790 bool k=isNumber(find.str()); // is this a number
791 if (k)
792 {
793 ol.docify(" ");
794 startFonts(find,"vhdldigit",ol);
795 ol.docify(" ");
796 }
797 else if (j != 0 && ss)
798 {
799 startFonts(find,ss,ol);
800 }
801 else
802 {
803 if (j>0)
804 {
805 VhdlDocGen::writeStringLink(mdef,find,ol);
806 }
807 }
808 startFonts(&buf[0],"vhdlchar",ol);
809
810 QCString st=temp.remove(0,j+1);
811 find=st;
812 if (!find.isEmpty() && find.at(0)=='"')
813 {
814 int ii=find.find('"',2);
815 if (ii>1)
816 {
817 QCString com=find.left(ii+1);
818 startFonts(com,"keyword",ol);
819 temp=find.remove(0,ii+1);
820 }
821 }
822 else
823 {
824 temp=st;
825 }
826 j = findIndex(temp.str(),reg);
827 }//while
828 }//if
829 else
830 {
831 startFonts(find,"vhdlchar",ol);
832 }
833 ol.endBold();
834}// writeFormatString
835
836/*!
837 * returns TRUE if this string is a number
838 */
839bool VhdlDocGen::isNumber(const std::string& s)
840{
841 static const reg::Ex regg(R"([0-9][0-9eEfFbBcCdDaA_.#+?xXzZ-]*)");
842 return reg::match(s,regg);
843}// isNumber
844
845
846/*!
847 * inserts white spaces for better readings
848 * and writes a colored string to the output
849 */
850
852{
853 QCString qcs = s;
854 QCString temp;
855 qcs.stripPrefix(":");
856 qcs.stripPrefix("is");
857 qcs.stripPrefix("IS");
858 qcs.stripPrefix("of");
859 qcs.stripPrefix("OF");
860
861 size_t len = qcs.length();
862 size_t index=1;
863
864 for (size_t j=0;j<len;j++)
865 {
866 char c=qcs[j];
867 char b=c;
868 if (j>0) b=qcs[j-1];
869 if (c=='"' || c==',' || c=='\''|| c=='(' || c==')' || c==':' || c=='[' || c==']' ) // || (c==':' && b!='=')) // || (c=='=' && b!='>'))
870 {
871 if (temp.length()>=index && temp.at(index-1) != ' ')
872 {
873 temp+=" ";
874 }
875 temp+=c;
876 temp+=" ";
877 }
878 else if (c=='=')
879 {
880 if (b==':') // := operator
881 {
882 temp.replace(index-1,1,"=");
883 temp+=" ";
884 }
885 else // = operator
886 {
887 temp+=" ";
888 temp+=c;
889 temp+=" ";
890 }
891 }
892 else
893 {
894 temp+=c;
895 }
896
897 index=temp.length();
898 }// for
899 temp=temp.stripWhiteSpace();
900 // printf("\n [%s]",qPrint(qcs));
901 VhdlDocGen::writeFormatString(temp,ol,mdef);
902}
903
904/*!
905 * writes a procedure prototype to the output
906 */
907
909{
910 bool sem=FALSE;
911 size_t len=al.size();
912 ol.docify("( ");
913 if (len > 2)
914 {
915 ol.lineBreak();
916 }
917 for (const Argument &arg : al)
918 {
919 ol.startBold();
920 if (sem && len <3)
921 ol.writeChar(',');
922
923 QCString nn=arg.name;
924 nn+=": ";
925
926 QCString defval = arg.defval;
927 const char *str=VhdlDocGen::findKeyWord(defval);
928 defval+=" ";
929 if (str)
930 {
931 startFonts(defval,str,ol);
932 }
933 else
934 {
935 startFonts(defval,"vhdlchar",ol); // write type (variable,constant etc.)
936 }
937
938 startFonts(nn,"vhdlchar",ol); // write name
939 if (qstricmp(arg.attrib,arg.type) != 0)
940 {
941 startFonts(arg.attrib.lower(),"stringliteral",ol); // write in|out
942 }
943 ol.docify(" ");
944 VhdlDocGen::formatString(arg.type,ol,mdef);
945 sem=TRUE;
946 ol.endBold();
947 if (len > 2)
948 {
949 ol.lineBreak();
950 ol.docify(" ");
951 }
952 }//for
953
954 ol.docify(" )");
955
956
957}
958
959/*!
960 * writes a function prototype to the output
961 */
962
964{
965 if (!al.hasParameters()) return;
966 bool sem=FALSE;
967 size_t len=al.size();
968 ol.startBold();
969 ol.docify(" ( ");
970 ol.endBold();
971 if (len>2)
972 {
973 ol.lineBreak();
974 }
975 for (const Argument &arg : al)
976 {
977 ol.startBold();
978 QCString att=arg.defval;
979 bool bGen=att.stripPrefix("generic");
980
981 if (sem && len < 3)
982 {
983 ol.docify(" , ");
984 }
985
986 if (bGen)
987 {
988 VhdlDocGen::formatString(QCString("generic "),ol,mdef);
989 }
990 if (!att.isEmpty())
991 {
992 const char *str=VhdlDocGen::findKeyWord(att);
993 att+=" ";
994 if (str)
995 VhdlDocGen::formatString(att,ol,mdef);
996 else
997 startFonts(att,"vhdlchar",ol);
998 }
999
1000 QCString nn=arg.name;
1001 nn+=": ";
1002 QCString ss=arg.type.stripWhiteSpace(); //.lower();
1003 QCString w=ss.stripWhiteSpace();//.upper();
1004 startFonts(nn,"vhdlchar",ol);
1005 startFonts("in ","stringliteral",ol);
1006 const char *str=VhdlDocGen::findKeyWord(ss);
1007 if (str)
1008 VhdlDocGen::formatString(w,ol,mdef);
1009 else
1010 startFonts(w,"vhdlchar",ol);
1011
1012 if (!arg.attrib.isEmpty())
1013 startFonts(arg.attrib,"vhdlchar",ol);
1014
1015 sem=TRUE;
1016 ol.endBold();
1017 if (len > 2)
1018 {
1019 ol.lineBreak();
1020 }
1021 }
1022 ol.startBold();
1023 ol.docify(" )");
1024 QCString exp=mdef->excpString();
1025 if (!exp.isEmpty())
1026 {
1027 ol.insertMemberAlign();
1028 ol.startBold();
1029 ol.docify("[ ");
1030 ol.docify(exp);
1031 ol.docify(" ]");
1032 ol.endBold();
1033 }
1034 ol.endBold();
1035}
1036
1037/*!
1038 * writes a process prototype to the output
1039 */
1040
1042{
1043 if (!al.hasParameters()) return;
1044 bool sem=FALSE;
1045 ol.startBold();
1046 ol.docify(" ( ");
1047 for (const Argument &arg : al)
1048 {
1049 if (sem)
1050 {
1051 ol.docify(" , ");
1052 }
1053 QCString nn=arg.name;
1054 // startFonts(nn,"vhdlchar",ol);
1056 sem=TRUE;
1057 }
1058 ol.docify(" )");
1059 ol.endBold();
1060}
1061
1062
1063/*!
1064 * writes a function|procedure documentation to the output
1065 */
1066
1068 const MemberDef *md,
1069 OutputList& ol,
1070 const ArgumentList &al,
1071 bool /*type*/)
1072{
1073 //bool sem=FALSE;
1074 ol.enableAll();
1075
1076 size_t index=al.size();
1077 if (index==0)
1078 {
1079 ol.docify(" ( ) ");
1080 return FALSE;
1081 }
1082 ol.endMemberDocName();
1084 //ol.startParameterName(FALSE);
1085 bool first=TRUE;
1086 for (const Argument &arg : al)
1087 {
1088 ol.startParameterType(first,"");
1089 // if (first) ol.writeChar('(');
1090 QCString attl=arg.defval;
1091
1092 //bool bGen=attl.stripPrefix("generic");
1093 //if (bGen)
1094 // VhdlDocGen::writeFormatString(QCString("generic "),ol,md);
1095
1096
1098 {
1099 startFonts(arg.defval,"keywordtype",ol);
1100 ol.docify(" ");
1101 }
1102 ol.endParameterType();
1103
1105 VhdlDocGen::writeFormatString(arg.name,ol,md);
1106
1108 {
1109 startFonts(arg.attrib,"stringliteral",ol);
1110 }
1111 else if (VhdlDocGen::isVhdlFunction(md))
1112 {
1113 startFonts(QCString("in"),"stringliteral",ol);
1114 }
1115
1116 ol.docify(" ");
1118 ol.startEmphasis();
1120 if (!VhdlDocGen::isProcess(md))
1121 {
1122 // startFonts(arg.type,"vhdlkeyword",ol);
1123 VhdlDocGen::writeFormatString(arg.type,ol,md);
1124 }
1126 ol.endEmphasis();
1128
1129 if (--index)
1130 {
1131 ol.docify(" , ");
1132 }
1133 else
1134 {
1135 // ol.docify(" ) ");
1136 ol.endParameterName();
1138 ol.endParameterExtra(true,false,true);
1139 break;
1140 }
1141 ol.endParameterName();
1143 ol.endParameterExtra(false,false,false);
1144
1145 //sem=TRUE;
1146 first=FALSE;
1147 }
1148 //ol.endParameterList();
1149 return TRUE;
1150
1151} // writeDocFunProc
1152
1153
1154
1155
1157{
1158 QCString argString;
1159 bool sem=FALSE;
1160
1161 for (const Argument &arg : al)
1162 {
1163 if (sem) argString.append(", ");
1164 if (func)
1165 {
1166 argString+=arg.name;
1167 argString+=":";
1168 argString+=arg.type;
1169 }
1170 else
1171 {
1172 argString+=arg.defval+" ";
1173 argString+=arg.name+" :";
1174 argString+=arg.attrib+" ";
1175 argString+=arg.type;
1176 }
1177 sem=TRUE;
1178 }
1179 return argString;
1180}
1181
1182
1184 OutputList& ol,const GroupDef* gd,const ClassDef* cd,const FileDef *fd,const NamespaceDef* nd,const ModuleDef *mod)
1185{
1207
1208 // configurations must be added to global file definitions.
1211
1212}
1213
1215{
1216 if (md->argsString()=="package")
1217 {
1219 }
1220 else if (md->argsString()=="configuration")
1221 {
1223 }
1224 else if (md->typeString()=="library")
1225 {
1227 }
1228 else if (md->typeString()=="use")
1229 {
1231 }
1232 else if (md->typeString().lower()=="misc")
1233 {
1235 }
1236 else if (md->typeString().lower()=="ucf_const")
1237 {
1239 }
1240
1242 {
1243 int mm=md->name().findRev('_');
1244 if (mm>0)
1245 {
1246 md->setName(md->name().left(mm));
1247 }
1248 }
1249 else if (md->getVhdlSpecifiers()==VhdlSpecifier::TYPE)
1250 {
1251 QCString largs=md->argsString();
1252 bool bRec=largs.stripPrefix("record") ;
1253 bool bUnit=largs.stripPrefix("units") ;
1254 if (bRec || bUnit)
1255 {
1256 md->setType("");
1257 }
1258 }
1259}
1260
1261/* writes a vhdl type documentation */
1263{
1264 const ClassDef *cd=toClassDef(d);
1265 bool hasParams = FALSE;
1266
1267 if (cd==nullptr) return hasParams;
1268
1269 QCString ttype=mdef->typeString();
1270 QCString largs=mdef->argsString();
1271
1273 {
1274 QCString nn=mdef->typeString();
1275 nn=nn.stripWhiteSpace();
1276 QCString na=cd->name();
1277 const MemberDef* memdef=VhdlDocGen::findMember(na,nn);
1278 if (memdef && memdef->isLinkable())
1279 {
1280 ol.docify(" ");
1281
1282 ol.startBold();
1283 writeLink(memdef,ol);
1284 ol.endBold();
1285 ol.docify(" ");
1286 }
1287 else
1288 {
1289 ol.docify(" ");
1290 VhdlDocGen::formatString(ttype,ol,mdef);
1291 ol.docify(" ");
1292 }
1293 ol.docify(mdef->name());
1294 hasParams = VhdlDocGen::writeFuncProcDocu(mdef,ol, mdef->argumentList());
1295 }
1296
1297
1298 if (mdef->isVariable())
1299 {
1300 if (VhdlDocGen::isConstraint(mdef))
1301 {
1302 writeLink(mdef,ol);
1303 ol.docify(" ");
1304
1305 largs=substitute(largs,"#"," ");
1306 VhdlDocGen::formatString(largs,ol,mdef);
1307 return hasParams;
1308 }
1309 else
1310 {
1311 writeLink(mdef,ol);
1313 {
1314 return hasParams;
1315 }
1316 ol.docify(" ");
1317 }
1318
1319 // QCString largs=mdef->argsString();
1320
1321 bool c=largs=="context";
1322 bool brec=largs.stripPrefix("record") ;
1323
1324 if (!brec && !c)
1325 VhdlDocGen::formatString(ttype,ol,mdef);
1326
1327 if (c || brec || largs.stripPrefix("units"))
1328 {
1329 if (c)
1330 largs=ttype;
1331 VhdlDocGen::writeRecUnitDocu(mdef,ol,largs);
1332 return hasParams;
1333 }
1334
1335 ol.docify(" ");
1336 if (VhdlDocGen::isPort(mdef) || VhdlDocGen::isGeneric(mdef))
1337 {
1338 // QCString largs=mdef->argsString();
1339 VhdlDocGen::formatString(largs,ol,mdef);
1340 ol.docify(" ");
1341 }
1342 }
1343 return hasParams;
1344}
1345
1347{
1348 tagFile << " <member kind=\"";
1349 if (VhdlDocGen::isGeneric(mdef)) tagFile << "generic";
1350 if (VhdlDocGen::isPort(mdef)) tagFile << "port";
1351 if (VhdlDocGen::isEntity(mdef)) tagFile << "entity";
1352 if (VhdlDocGen::isComponent(mdef)) tagFile << "component";
1353 if (VhdlDocGen::isVType(mdef)) tagFile << "type";
1354 if (VhdlDocGen::isConstant(mdef)) tagFile << "constant";
1355 if (VhdlDocGen::isSubType(mdef)) tagFile << "subtype";
1356 if (VhdlDocGen::isVhdlFunction(mdef)) tagFile << "function";
1357 if (VhdlDocGen::isProcedure(mdef)) tagFile << "procedure";
1358 if (VhdlDocGen::isProcess(mdef)) tagFile << "process";
1359 if (VhdlDocGen::isSignals(mdef)) tagFile << "signal";
1360 if (VhdlDocGen::isAttribute(mdef)) tagFile << "attribute";
1361 if (VhdlDocGen::isRecord(mdef)) tagFile << "record";
1362 if (VhdlDocGen::isLibrary(mdef)) tagFile << "library";
1363 if (VhdlDocGen::isPackage(mdef)) tagFile << "package";
1364 if (VhdlDocGen::isVariable(mdef)) tagFile << "shared variable";
1365 if (VhdlDocGen::isFile(mdef)) tagFile << "file";
1366 if (VhdlDocGen::isGroup(mdef)) tagFile << "group";
1367 if (VhdlDocGen::isCompInst(mdef)) tagFile << "instantiation";
1368 if (VhdlDocGen::isAlias(mdef)) tagFile << "alias";
1369 if (VhdlDocGen::isCompInst(mdef)) tagFile << "configuration";
1370
1371 QCString fn = mdef->getOutputFileBase();
1373 tagFile << "\">\n";
1374 tagFile << " <type>" << convertToXML(mdef->typeString()) << "</type>\n";
1375 tagFile << " <name>" << convertToXML(mdef->name()) << "</name>\n";
1376 tagFile << " <anchorfile>" << convertToXML(fn) << "</anchorfile>\n";
1377 tagFile << " <anchor>" << convertToXML(mdef->anchor()) << "</anchor>\n";
1378
1380 tagFile << " <arglist>" << convertToXML(VhdlDocGen::convertArgumentListToString(mdef->argumentList(),TRUE)) << "</arglist>\n";
1381 else if (VhdlDocGen::isProcedure(mdef))
1382 tagFile << " <arglist>" << convertToXML(VhdlDocGen::convertArgumentListToString(mdef->argumentList(),FALSE)) << "</arglist>\n";
1383 else
1384 tagFile << " <arglist>" << convertToXML(mdef->argsString()) << "</arglist>\n";
1385
1386 mdef->writeDocAnchorsToTagFile(tagFile);
1387 tagFile << " </member>\n";
1388}
1389
1390/* writes a vhdl type declaration */
1391
1393 const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod,
1394 bool /*inGroup*/)
1395{
1396 const Definition *d=nullptr;
1397
1398 ASSERT(cd!=nullptr || nd!=nullptr || fd!=nullptr || gd!=nullptr || mod!=nullptr ||
1401 ); // member should belong to something
1402 if (cd) d=cd;
1403 else if (nd) d=nd;
1404 else if (fd) d=fd;
1405 else if (mod) d=mod;
1406 else if (gd) d=gd;
1407 else d=mdef;
1408
1409 // write search index info
1410 if (Doxygen::searchIndex.enabled())
1411 {
1412 Doxygen::searchIndex.setCurrentDoc(mdef,mdef->anchor(),FALSE);
1413 Doxygen::searchIndex.addWord(mdef->localName(),TRUE);
1414 Doxygen::searchIndex.addWord(mdef->qualifiedName(),FALSE);
1415 }
1416
1417 QCString cname = d->name();
1418 QCString cfname = d->getOutputFileBase();
1419
1420 //HtmlHelp *htmlHelp=nullptr;
1421 // bool hasHtmlHelp = Config_getBool(GENERATE_HTML) && Config_getBool(GENERATE_HTMLHELP);
1422 // if (hasHtmlHelp) htmlHelp = HtmlHelp::getInstance();
1423
1424 // search for the last anonymous scope in the member type
1425 ClassDef *annoClassDef=mdef->getClassDefOfAnonymousType();
1426
1427 // start a new member declaration
1430 ///printf("startMemberItem for %s\n",qPrint(name()));
1434
1435 ol.startMemberItem( mdef->anchor(), memType );
1436
1437 // If there is no detailed description we need to write the anchor here.
1438 bool detailsVisible = mdef->hasDetailedDescription();
1439 if (!detailsVisible)
1440 {
1441 QCString doxyName=mdef->name();
1442 if (!cname.isEmpty()) doxyName.prepend(cname+"::");
1443 QCString doxyArgs=mdef->argsString();
1444 ol.startDoxyAnchor(cfname,cname,mdef->anchor(),doxyName,doxyArgs);
1445 ol.addLabel(cfname,mdef->anchor());
1446
1447 ol.pushGeneratorState();
1450 ol.docify("\n");
1451 ol.popGeneratorState();
1452
1453 }
1454 // *** write type
1455 /*VHDL CHANGE */
1456
1457 QCString ltype(mdef->typeString());
1458 QCString largs(mdef->argsString());
1459
1460 ClassDef *kl=nullptr;
1461 const ArgumentList &al = mdef->argumentList();
1462 QCString nn;
1463 //VhdlDocGen::adjustRecordMember(mdef);
1464 if (gd) gd=nullptr;
1465 switch (mm)
1466 {
1468 VhdlDocGen::writeSource(mdef,ol,nn);
1469 break;
1472 ol.startBold();
1473 VhdlDocGen::formatString(ltype,ol,mdef);
1474 ol.endBold();
1475 ol.insertMemberAlign();
1476 ol.docify(" ");
1477
1478 writeLink(mdef,ol);
1479 if (al.hasParameters() && mm==VhdlSpecifier::FUNCTION)
1481
1484
1485 break;
1486 case VhdlSpecifier::USE:
1487 kl=VhdlDocGen::getClass(mdef->name());
1488 if (kl && (VhdlDocGen::convert(kl->protection())==VhdlDocGen::ENTITYCLASS)) break;
1489 writeLink(mdef,ol);
1490 ol.insertMemberAlign();
1491 ol.docify(" ");
1492
1493 if (kl)
1494 {
1495 nn=kl->getOutputFileBase();
1496 ol.pushGeneratorState();
1498 ol.docify(" ");
1500 ol.startBold();
1501 ol.docify(name);
1502 name.clear();
1503 ol.endBold();
1504 name+=" <"+mdef->name()+">";
1505 ol.startEmphasis();
1507 ol.popGeneratorState();
1508 }
1509 break;
1511 writeLink(mdef,ol);
1512 ol.insertMemberAlign();
1513 if (largs=="context")
1514 {
1515 VhdlDocGen::writeRecordUnit(ltype,largs,ol,mdef);
1516 }
1517
1518 break;
1519
1523
1524 writeLink(mdef,ol);
1525 ol.docify(" ");
1526 if (mm==VhdlSpecifier::GENERIC)
1527 {
1528 ol.insertMemberAlign();
1529 ol.startBold();
1530 VhdlDocGen::formatString(largs,ol,mdef);
1531 ol.endBold();
1532 }
1533 else
1534 {
1535 ol.insertMemberAlignLeft(memType, false);
1536 ol.docify(" ");
1537 ol.startBold();
1538 VhdlDocGen::formatString(ltype,ol,mdef);
1539 ol.endBold();
1540 ol.insertMemberAlign();
1541 ol.docify(" ");
1542 VhdlDocGen::formatString(largs,ol,mdef);
1543 }
1544 break;
1546 writeLink(mdef,ol);
1547 ol.insertMemberAlign();
1549 break;
1555 if (VhdlDocGen::isCompInst(mdef) )
1556 {
1557 nn=largs;
1558 if(nn.stripPrefix("function") || nn.stripPrefix("package"))
1559 {
1560 VhdlDocGen::formatString(largs,ol,mdef);
1561 ol.insertMemberAlign();
1562 writeLink(mdef,ol);
1563 ol.docify(" ");
1564 VhdlDocGen::formatString(ltype,ol,mdef);
1565 break;
1566 }
1567
1568 largs.prepend("::");
1569 largs.prepend(mdef->name());
1570 ol.writeObjectLink(mdef->getReference(),
1571 cfname,
1572 mdef->anchor(),
1573 mdef->name());
1574 }
1575 else
1576 writeLink(mdef,ol);
1577
1578 ol.insertMemberAlign();
1579 ol.docify(" ");
1580 ol.startBold();
1581 ol.docify(ltype);
1582 ol.endBold();
1583 ol.docify(" ");
1584 if (VhdlDocGen::isComponent(mdef) ||
1585 VhdlDocGen::isConfig(mdef) ||
1587 {
1589 {
1590 nn=ltype;
1591 }
1592 else
1593 {
1594 nn=mdef->name();
1595 }
1596 kl=getClass(nn);
1597 if (kl)
1598 {
1599 nn=kl->getOutputFileBase();
1600 ol.pushGeneratorState();
1602 ol.startEmphasis();
1603 QCString name("<Entity ");
1605 {
1606 name+=ltype+">";
1607 }
1608 else
1609 {
1610 name+=mdef->name()+"> ";
1611 }
1613 ol.endEmphasis();
1614 ol.popGeneratorState();
1615 }
1616 }
1617 break;
1619 writeUCFLink(mdef,ol);
1620 break;
1629 writeLink(mdef,ol);
1630 ol.docify(" ");
1631 ol.insertMemberAlign();
1632 VhdlDocGen::formatString(ltype,ol,mdef);
1633 break;
1636 writeRecordUnit(largs,ltype,ol,mdef);
1637 break;
1638
1639 default: break;
1640 }
1641
1642 bool htmlOn = ol.isEnabled(OutputType::Html);
1643 if (htmlOn && /*Config_getBool(HTML_ALIGN_MEMBERS) &&*/ !ltype.isEmpty())
1644 {
1646 }
1647 if (!ltype.isEmpty()) ol.docify(" ");
1648
1649 if (htmlOn)
1650 {
1652 }
1653
1654 if (!detailsVisible)
1655 {
1656 ol.endDoxyAnchor(cfname,mdef->anchor());
1657 }
1658
1659 ol.endMemberItem(memType);
1660 if (!mdef->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC) /* && !annMemb */)
1661 {
1662 QCString s=mdef->briefDescription();
1664 ol.generateDoc(mdef->briefFile(),
1665 mdef->briefLine(),
1666 mdef->getOuterScope()?mdef->getOuterScope():d,
1667 mdef,
1668 s,
1669 DocOptions()
1670 .setIndexWords(true)
1671 .setSingleLine(true));
1672 if (detailsVisible)
1673 {
1674 ol.pushGeneratorState();
1676 ol.docify(" ");
1677 if (mdef->getGroupDef()!=nullptr && gd==nullptr) // forward link to the group
1678 {
1679 ol.startTextLink(mdef->getOutputFileBase(),mdef->anchor());
1680 }
1681 else // local link
1682 {
1683 ol.startTextLink(QCString(),mdef->anchor());
1684 }
1685 ol.endTextLink();
1686 ol.popGeneratorState();
1687 }
1689 }
1690 mdef->warnIfUndocumented();
1691
1692}// end writeVhdlDeclaration
1693
1694
1696 const MemberList* mlist,OutputList &ol,
1697 const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod,
1698 VhdlSpecifier specifier)
1699{
1700
1701 StringSet pack;
1702
1703 bool first=TRUE;
1704 for (const auto &imd : *mlist)
1705 {
1707 if (md)
1708 {
1710 if (md->isBriefSectionVisible() && (mems==specifier) && (mems!=VhdlSpecifier::LIBRARY) )
1711 {
1712 if (first) { ol.startMemberList();first=FALSE; }
1713 VhdlDocGen::writeVHDLDeclaration(md,ol,cd,nd,fd,gd,mod,FALSE);
1714 } //if
1715 else if (md->isBriefSectionVisible() && (mems==specifier))
1716 {
1717 if (pack.find(md->name().str())==pack.end())
1718 {
1719 if (first) ol.startMemberList(),first=FALSE;
1720 VhdlDocGen::writeVHDLDeclaration(md,ol,cd,nd,fd,gd,mod,FALSE);
1721 pack.insert(md->name().str());
1722 }
1723 } //if
1724 } //if
1725 } //for
1726 if (!first) ol.endMemberList();
1727}//plainDeclaration
1728
1730{
1731 if (ml==nullptr) return FALSE;
1732 for (const auto &mdd : *ml)
1733 {
1734 if (mdd->getVhdlSpecifiers()==type) //is type in class
1735 {
1736 return TRUE;
1737 }
1738 }
1739 for (const auto &mg : ml->getMemberGroupList())
1740 {
1741 if (!mg->members().empty())
1742 {
1743 if (membersHaveSpecificType(&mg->members(),type)) return TRUE;
1744 }
1745 }
1746 return FALSE;
1747}
1748
1750 const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod,
1751 const QCString &title,const QCString &subtitle,bool /*showEnumValues*/,VhdlSpecifier type)
1752{
1753 if (!membersHaveSpecificType(ml,type)) return;
1754
1755 if (!title.isEmpty())
1756 {
1757 ol.startMemberHeader(convertToId(title),type == VhdlSpecifier::PORT ? 3 : 2);
1758 ol.parseText(title);
1759 ol.endMemberHeader();
1760 ol.docify(" ");
1761 }
1762 if (!subtitle.isEmpty())
1763 {
1765 ol.generateDoc("[generated]",
1766 -1,
1767 nullptr,
1768 nullptr,
1769 subtitle,
1770 DocOptions()
1771 .setSingleLine(true));
1772 ol.endMemberSubtitle();
1773 } //printf("memberGroupList=%p\n",memberGroupList);
1774
1775 VhdlDocGen::writePlainVHDLDeclarations(ml,ol,cd,nd,fd,gd,mod,type);
1776
1777 int groupId=0;
1778 for (const auto &mg : ml->getMemberGroupList())
1779 {
1780 if (membersHaveSpecificType(&mg->members(),type))
1781 {
1782 //printf("mg->header=%s\n",qPrint(mg->header()));
1783 bool hasHeader=!mg->header().isEmpty();
1784 QCString groupAnchor = QCString(ml->listType().toLabel())+"-"+QCString().setNum(groupId++);
1785 ol.startMemberGroupHeader(groupAnchor,hasHeader);
1786 if (hasHeader)
1787 {
1788 ol.parseText(mg->header());
1789 }
1791 if (!mg->documentation().isEmpty())
1792 {
1793 //printf("Member group has docs!\n");
1795 ol.generateDoc("[generated]",
1796 -1,
1797 nullptr,
1798 nullptr,
1799 mg->documentation()+"\n",
1800 DocOptions());
1801 ol.endMemberGroupDocs();
1802 }
1803 ol.startMemberGroup();
1804 //printf("--- mg->writePlainDeclarations ---\n");
1805 VhdlDocGen::writePlainVHDLDeclarations(&mg->members(),ol,cd,nd,fd,gd,mod,type);
1806 ol.endMemberGroup(hasHeader);
1807 }
1808 }
1809}// writeVHDLDeclarations
1810
1811
1813 OutputList &ol ,QCString & cname)
1814{
1816 cname=VhdlDocGen::getClassName(cd);
1817 ol.startBold();
1818 ol.writeString(qcs);
1819 ol.writeString(" ");
1820 ol.endBold();
1821 //ol.insertMemberAlign();
1822 return FALSE;
1823}// writeClassLink
1824
1825
1826/*! writes a link if the string is linkable else a formatted string */
1827
1829{
1830 if (mdef)
1831 {
1832 const ClassDef *cd=mdef->getClassDef();
1833 if (cd)
1834 {
1835 QCString n=cd->name();
1836 const MemberDef* memdef=VhdlDocGen::findMember(n,mem);
1837 if (memdef && memdef->isLinkable())
1838 {
1839 ol.startBold();
1840 writeLink(memdef,ol);
1841 ol.endBold();
1842 ol.docify(" ");
1843 return;
1844 }
1845 }
1846 }
1847 startFonts(mem,"vhdlchar",ol);
1848}// found component
1849
1850
1851
1852void VhdlDocGen::writeSource(const MemberDef* mdef,OutputList& ol,const QCString &cname)
1853{
1854 auto intf = Doxygen::parserManager->getCodeParser(".vhd");
1855 // pIntf->resetCodeParserState();
1856
1857 QCString codeFragment=mdef->documentation();
1858
1859 if (cname.isEmpty())
1860 {
1861 writeLink(mdef,ol);
1862 int fi=0;
1863 int j=0;
1864 do
1865 {
1866 fi=codeFragment.find("\n",++fi);
1867 } while(fi>=0 && j++ <3);
1868
1869 // show only the first four lines
1870 if (j==4)
1871 {
1872 codeFragment=codeFragment.left(fi);
1873 codeFragment.append("\n .... ");
1874 }
1875 }
1876
1877 codeFragment.prepend("\n");
1878 ol.pushGeneratorState();
1879 auto &codeOL = ol.codeGenerators();
1880 codeOL.startCodeFragment("DoxyCode");
1881 intf->parseCode( codeOL, // codeOutIntf
1882 QCString(), // scope
1883 codeFragment, // input
1884 SrcLangExt::VHDL, // lang
1885 Config_getBool(STRIP_CODE_COMMENTS),
1886 FALSE, // isExample
1887 QCString(), // exampleName
1888 mdef->getFileDef(), // fileDef
1889 mdef->getStartBodyLine(), // startLine
1890 mdef->getEndBodyLine(), // endLine
1891 TRUE, // inlineFragment
1892 mdef, // memberDef
1893 TRUE // show line numbers
1894 );
1895
1896 codeOL.endCodeFragment("DoxyCode");
1897 ol.popGeneratorState();
1898
1899 if (cname.isEmpty()) return;
1900
1901 MemberDefMutable *mdm = toMemberDefMutable(const_cast<MemberDef*>(mdef));
1902 if (mdm)
1903 {
1904 mdm->writeSourceDef(ol);
1905 if (mdef->hasReferencesRelation()) mdm->writeSourceRefs(ol,cname);
1906 if (mdef->hasReferencedByRelation()) mdm->writeSourceReffedBy(ol,cname);
1907 }
1908}
1909
1910
1911
1913{
1914
1915 QCString n=name;
1916 n=n.remove(0,6);
1917
1918 int i=0;
1919
1920 while((i=n.find("__"))>0)
1921 {
1922 n=n.remove(i,1);
1923 }
1924
1925 while((i=n.find("_1"))>0)
1926 {
1927 n=n.replace(i,2,":");
1928 }
1929
1930 return n;
1931}
1932
1933void VhdlDocGen::parseUCF(const QCString &input,Entry* entity,const QCString &fileName,bool altera)
1934{
1935 QCString ucFile(input);
1936 int lineNo=0;
1937 QCString comment("#!");
1938 QCString brief;
1939
1940 while (!ucFile.isEmpty())
1941 {
1942 int i=ucFile.find("\n");
1943 if (i<0) break;
1944 lineNo++;
1945 QCString temp=ucFile.left(i);
1946 temp=temp.stripWhiteSpace();
1947 bool bb=temp.stripPrefix("//");
1948
1949 if (!temp.isEmpty())
1950 {
1951 if (temp.stripPrefix(comment) )
1952 {
1953 brief+=temp;
1954 brief.append("\\n");
1955 }
1956 else if (!temp.stripPrefix("#") && !bb)
1957 {
1958 if (altera)
1959 {
1960 int in=temp.find("-name");
1961 if (in>0)
1962 {
1963 temp=temp.remove(0,in+5);
1964 }
1965
1966 temp.stripPrefix("set_location_assignment");
1967
1968 initUCF(entity,QCString(),temp,lineNo,fileName,brief);
1969 }
1970 else
1971 {
1972 static const reg::Ex ee(R"([\s=])");
1973 int in=findIndex(temp.str(),ee);
1974 if (in<0) in=0;
1975 QCString ff=temp.left(in);
1976 temp.stripPrefix(ff);
1977 ff.append("#");
1978 if (!temp.isEmpty())
1979 {
1980 initUCF(entity,ff,temp,lineNo,fileName,brief);
1981 }
1982 }
1983 }
1984 }//temp
1985
1986 ucFile=ucFile.remove(0,i+1);
1987 }// while
1988}
1989
1990static void initUCF(Entry* root,const QCString &type,QCString &qcs,
1991 int line,const QCString &fileName,QCString & brief)
1992{
1993 if (qcs.isEmpty())return;
1994 QCString n;
1995
1997 qcs=qcs.stripWhiteSpace();
1998
1999 static const reg::Ex reg(R"([\s=])");
2000 int i = findIndex(qcs.str(),reg);
2001 if (i<0) return;
2002 if (i==0)
2003 {
2004 n=type;
2006 }
2007 else
2008 {
2009 n=qcs.left(i);
2010 }
2011 qcs=qcs.remove(0,i+1);
2012 // qcs.prepend("|");
2013
2014 qcs.stripPrefix("=");
2015
2016 std::shared_ptr<Entry> current = std::make_shared<Entry>();
2017 current->vhdlSpec=VhdlSpecifier::UCF_CONST;
2018 current->section=EntryType::makeVariable();
2019 current->bodyLine=line;
2020 current->fileName=fileName;
2021 current->type="ucf_const";
2022 current->args+=qcs;
2023 current->lang= SrcLangExt::VHDL ;
2024
2025 // adding dummy name for constraints like VOLTAGE=5,TEMPERATURE=20 C
2026 if (n.isEmpty())
2027 {
2028 n="dummy";
2030 }
2031
2032 current->name= n+"_";
2033 current->name.append(VhdlDocGen::getRecordNumber());
2034
2035 if (!brief.isEmpty())
2036 {
2037 current->brief=brief;
2038 current->briefLine=line;
2039 current->briefFile=fileName;
2040 brief.clear();
2041 }
2042
2043 root->moveToSubEntryAndKeep(current);
2044}
2045
2046
2047static void writeUCFLink(const MemberDef* mdef,OutputList &ol)
2048{
2049
2050 QCString largs(mdef->argsString());
2051 QCString n= splitString(largs, '#');
2052 // VhdlDocGen::adjustRecordMember(mdef);
2053 bool equ=(n.length()==largs.length());
2054
2055 if (!equ)
2056 {
2057 ol.writeString(n);
2058 ol.docify(" ");
2059 ol.insertMemberAlign();
2060 }
2061
2062 if (mdef->name().contains("dummy")==0)
2063 {
2064 writeLink(mdef,ol);
2065 }
2066 if (equ)
2067 {
2068 ol.insertMemberAlign();
2069 }
2070 ol.docify(" ");
2071 VhdlDocGen::formatString(largs,ol,mdef);
2072}
2073
2074// for cell_inst : [entity] work.proto [ (label|expr) ]
2076{
2077 if (!entity.contains(":")) return "";
2078
2079 static const reg::Ex exp(R"([:()\s])");
2080 auto ql=split(entity.str(),exp);
2081 if (ql.size()<2)
2082 {
2083 return "";
2084 }
2085 QCString label(ql[0]);
2086 entity = ql[1];
2087 int index = entity.findRev(".");
2088 if (index!=-1)
2089 {
2090 entity.remove(0,index+1);
2091 }
2092
2093 if (ql.size()==3)
2094 {
2095 arch = ql[2];
2096 ql=split(arch.str(),exp);
2097 if (ql.size()>1) // expression
2098 {
2099 arch="";
2100 }
2101 }
2102 return label; // label
2103}
2104
2105// use (configuration|entity|open) work.test [(cellfor)];
2106
2108{
2109 static const reg::Ex exp(R"([()\s])");
2110
2111 auto ql = split(entity.str(),exp);
2112
2113 if (findIndex(ql,"open")!=-1)
2114 {
2115 return "open";
2116 }
2117
2118 if (ql.size()<2)
2119 {
2120 return "";
2121 }
2122
2123 std::string label=ql[0];
2124 entity = ql[1];
2125 int index=entity.findRev(".");
2126 if (index!=-1)
2127 {
2128 entity.remove(0,index+1);
2129 }
2130
2131 if (ql.size()==3)
2132 {
2133 arch=ql[2];
2134 }
2135 return label;
2136}
2137
2138
2139
2140// find class with upper/lower letters
2142{
2143 for (const auto &cd : *Doxygen::classLinkedMap)
2144 {
2145 if (qstricmp(className.data(),qPrint(cd->name()))==0)
2146 {
2147 return cd.get();
2148 }
2149 }
2150 return nullptr;
2151}
2152
2153
2154/*
2155
2156// file foo.vhd
2157// entity foo
2158// .....
2159// end entity
2160
2161// file foo_arch.vhd
2162// architecture xxx of foo is
2163// ........
2164// end architecture
2165
2166*/
2168{
2169
2170 QCString entity,arch,inst;
2171
2172 for (const auto &cur : getVhdlInstList())
2173 {
2174 if (cur->isStatic ) // was bind
2175 {
2176 continue;
2177 }
2178
2179 if (cur->includeName=="entity" || cur->includeName=="component" )
2180 {
2181 entity=cur->includeName+" "+cur->type;
2182 QCString rr=VhdlDocGen::parseForBinding(entity,arch);
2183 }
2184 else if (cur->includeName.isEmpty())
2185 {
2186 entity=cur->type;
2187 }
2188
2190 inst=VhdlDocGen::getIndexWord(cur->args,0);
2193
2194 if (cd==nullptr)
2195 {
2196 continue;
2197 }
2198
2199 addInstance(classEntity,ar,cd,cur);
2200 }
2201
2202}
2203
2204static void addInstance(ClassDefMutable* classEntity, ClassDefMutable* ar,
2205 ClassDefMutable *cd , const std::shared_ptr<Entry> &cur)
2206{
2207
2208 QCString bName,n1;
2209 if (ar==nullptr) return;
2210
2211 if (classEntity==nullptr)
2212 {
2213 //add component inst
2214 n1=cur->type;
2215 goto ferr;
2216 }
2217
2218 if (classEntity==cd) return;
2219
2220 bName=classEntity->name();
2221 // fprintf(stderr,"\naddInstance %s to %s %s %s\n",qPrint( classEntity->name()),qPrint(cd->name()),qPrint(ar->name()),cur->name);
2222 n1=classEntity->name();
2223
2224 if (!cd->isBaseClass(classEntity, true))
2225 {
2226 cd->insertBaseClass(classEntity,n1,Protection::Public,Specifier::Normal,QCString());
2227 }
2228 else
2229 {
2230 VhdlDocGen::addBaseClass(cd,classEntity);
2231 }
2232
2233 if (!VhdlDocGen::isSubClass(classEntity,cd,true,0))
2234 {
2235 classEntity->insertSubClass(cd,Protection::Public,Specifier::Normal,QCString());
2236 classEntity->setLanguage(SrcLangExt::VHDL);
2237 }
2238
2239ferr:
2240 QCString uu=cur->name;
2241 auto md = createMemberDef(
2242 ar->getDefFileName(), cur->startLine,cur->startColumn,
2243 n1,uu,uu, QCString(),
2244 Protection::Public,
2245 Specifier::Normal,
2246 cur->isStatic,
2247 Relationship::Member,
2249 ArgumentList(),
2250 ArgumentList(),
2251 "");
2252 auto mmd = toMemberDefMutable(md.get());
2253
2254 if (!ar->getOutputFileBase().isEmpty())
2255 {
2256 TagInfo tg;
2257 tg.anchor = nullptr;
2258 tg.fileName = ar->getOutputFileBase();
2259 tg.tagName = nullptr;
2260 mmd->setTagInfo(&tg);
2261 }
2262
2263 //fprintf(stderr,"\n%s%s%s\n",qPrint(md->name()),qPrint(cur->brief),qPrint(cur->doc));
2264
2265 mmd->setLanguage(SrcLangExt::VHDL);
2266 mmd->setVhdlSpecifiers(VhdlSpecifier::INSTANTIATION);
2267 mmd->setBriefDescription(cur->brief,cur->briefFile,cur->briefLine);
2268 mmd->setBodySegment(cur->startLine,cur->startLine,-1) ;
2269 mmd->setDocumentation(cur->doc,cur->docFile,cur->docLine);
2270 FileDef *fd=ar->getFileDef();
2271 mmd->setBodyDef(fd);
2272 ar->insertMember(md.get());
2274 mn->push_back(std::move(md));
2275
2276}
2277
2278
2280{
2281 int i=mdef->name().find('~');
2282 if (i>0)
2283 {
2284 //sets the real record member name
2285 mdef->setName(mdef->name().left(i));
2286 }
2287
2288 writeLink(mdef,ol);
2289 ol.startBold();
2290 ol.insertMemberAlign();
2291 if (!ltype.isEmpty())
2292 {
2293 VhdlDocGen::formatString(ltype,ol,mdef);
2294 }
2295 ol.endBold();
2296}
2297
2298
2300 const MemberDef *md,
2301 OutputList& ol,
2302 QCString largs)
2303{
2304
2305 StringVector ql=split(largs.str(),"#");
2306 size_t len=ql.size();
2308 bool first=TRUE;
2309
2310 for(size_t i=0;i<len;i++)
2311 {
2312 QCString n = ql[i];
2313 ol.startParameterType(first,"");
2314 ol.endParameterType();
2316 VhdlDocGen::formatString(n,ol,md);
2317 ol.endParameterName();
2319 if ((len-i)>1)
2320 {
2321 ol.endParameterExtra(false,false,false);
2322 }
2323 else
2324 {
2325 ol.endParameterExtra(true,false,true);
2326 }
2327
2328 first=FALSE;
2329 }
2330
2331}//#
2332
2333
2334
2335bool VhdlDocGen::isSubClass(ClassDef* cd,ClassDef *scd, bool followInstances,int level)
2336{
2337 bool found=FALSE;
2338 //printf("isBaseClass(cd=%s) looking for %s\n",qPrint(name()),qPrint(bcd->name()));
2339 if (level>255)
2340 {
2341 err("Possible recursive class relation while inside {} and looking for {}\n",cd->name(),scd->name());
2342 abort();
2343 }
2344
2345 for (const auto &bcd :cd->subClasses())
2346 {
2347 const ClassDef *ccd=bcd.classDef;
2348 if (!followInstances && ccd->templateMaster()) ccd=ccd->templateMaster();
2349 //printf("isSubClass() subclass %s\n",qPrint(ccd->name()));
2350 if (ccd==scd)
2351 {
2352 found=true;
2353 }
2354 else
2355 {
2356 if (level <256)
2357 {
2358 level = ccd->isBaseClass(scd,followInstances);
2359 if (level>0)
2360 {
2361 found=true;
2362 }
2363 }
2364 }
2365 }
2366 return found;
2367}
2368
2370{
2371 BaseClassList bcl = cd->baseClasses();
2372 for (auto &bcd : bcl)
2373 {
2374 ClassDef *ccd = bcd.classDef;
2375 if (ccd==ent)
2376 {
2377 QCString n = bcd.usedName;
2378 int i = n.find('(');
2379 if(i<0)
2380 {
2381 bcd.usedName.append("(2)");
2382 return;
2383 }
2384 static const reg::Ex reg(R"(\d+)");
2385 QCString s=n.left(i);
2386 QCString r=n.right(n.length()-i);
2387 std::string t=r.str();
2390 r.setNum(r.toInt()+1);
2391 reg::replace(t, reg, r.str());
2392 s.append(t);
2393 bcd.usedName=s;
2394 bcd.templSpecifiers=t;
2395 }
2396 }
2397 cd->updateBaseClasses(bcl);
2398}
2399
2400
2401static std::vector<const MemberDef*> mdList;
2402
2403static const MemberDef* findMemFlow(const MemberDef* mdef)
2404{
2405 for (const auto &md : mdList)
2406 {
2407 if (md->name()==mdef->name() && md->getStartBodyLine()==mdef->getStartBodyLine())
2408 {
2409 return md;
2410 }
2411 }
2412 return nullptr;
2413}
2414
2416{
2417 if (mdef==nullptr) return;
2418
2419 QCString codeFragment;
2420 const MemberDef* mm=nullptr;
2421 if ((mm=findMemFlow(mdef))!=nullptr)
2422 {
2423 // don't create the same flowchart twice
2425 return;
2426 }
2427 else
2428 {
2429 mdList.push_back(mdef);
2430 }
2431
2432 //fprintf(stderr,"\n create flow mem %s %p\n",qPrint(mdef->name()),mdef);
2433
2434 int actualStart= mdef->getStartBodyLine();
2435 int actualEnd=mdef->getEndBodyLine();
2436 const FileDef* fd=mdef->getFileDef();
2437 bool b=readCodeFragment( fd->absFilePath(), false, actualStart, actualEnd, codeFragment);
2438 if (!b) return;
2439
2440 auto parser { Doxygen::parserManager->getOutlineParser(".vhd") };
2442 std::shared_ptr<Entry> root = std::make_shared<Entry>();
2443 StringVector filesInSameTu;
2444 parser->parseInput("",codeFragment.data(),root,nullptr);
2445}
2446
2448{
2449 std::lock_guard lock(g_vhdlMutex);
2450 g_varMap.clear();
2451 g_classList.clear();
2452 g_packages.clear();
2453}
2454
2460{ return mdef->getVhdlSpecifiers()==VhdlSpecifier::ALIAS; }
2466{ return mdef->getVhdlSpecifiers()==VhdlSpecifier::PORT; }
2470{ return mdef->getVhdlSpecifiers()==VhdlSpecifier::USE; }
2476{ return mdef->getVhdlSpecifiers()==VhdlSpecifier::TYPE; }
2496{ return mdef->getVhdlSpecifiers()==VhdlSpecifier::UNITS; }
2502{ return mdef->getVhdlSpecifiers()==VhdlSpecifier::VFILE; }
2504{ return mdef->getVhdlSpecifiers()==VhdlSpecifier::GROUP; }
2509
2510
2511
2512//############################## Flowcharts #################################################
2513
2514#define STARTL (FlowChart::WHILE_NO | FlowChart::IF_NO | \
2515 FlowChart::FOR_NO | FlowChart::CASE_NO | \
2516 FlowChart::LOOP_NO | WHEN_NO)
2517#define DECLN (FlowChart::WHEN_NO | \
2518 FlowChart::ELSIF_NO | FlowChart::IF_NO | \
2519 FlowChart::FOR_NO | FlowChart::WHILE_NO | \
2520 FlowChart::CASE_NO | FlowChart::LOOP_NO )
2521#define STARTFIN (FlowChart::START_NO | FlowChart::END_NO)
2522#define LOOP (FlowChart::FOR_NO | FlowChart::WHILE_NO | \
2523 FlowChart::LOOP_NO )
2524#define ENDCL (FlowChart::END_CASE | FlowChart::END_LOOP)
2525#define EEND (FlowChart::ENDIF_NO | FlowChart::ELSE_NO )
2526#define IFF (FlowChart::ELSIF_NO | FlowChart::IF_NO)
2527#define EXITNEXT (FlowChart::EXIT_NO | FlowChart::NEXT_NO )
2528#define EMPTY (EEND | FlowChart::ELSIF_NO)
2529#define EE (FlowChart::ELSE_NO | FlowChart::ELSIF_NO)
2530#define EMPTNODE (ENDCL | EEND | FlowChart::ELSIF_NO)
2531#define FLOWLEN (flowList.size()-1)
2532
2533static int ifcounter=0;
2534static int nodeCounter=0;
2535
2536static struct
2537{
2538 // link colors
2539 const char *textNodeLink;
2540 const char *yesNodeLink;
2541 const char *noNodeLink;
2542
2543 // node colors
2544 const char* comment;
2545 const char* decisionNode;
2546 const char* varNode;
2547 const char *startEndNode;
2548 const char* textNode;
2549} flowCol =
2550{ "green", // textNodeLink
2551 "red", // yesNodeLink
2552 "black", // noNodeLink
2553 "khaki", // comment
2554 "0.7 0.3 1.0", // decisionNode
2555 "lightyellow", // varNode
2556 "white", // startEndNode
2557 "lightcyan" // textNode
2559
2560std::vector<FlowChart> flowList;
2561
2562#ifdef DEBUGFLOW
2563static std::map<std::string,int> g_keyMap;
2564#endif
2565
2567{
2568 if (q.length()<=80) return;
2569
2570 if (q.length()>200)
2571 {
2572 q.resize(200);
2573 }
2574
2575 q.append(" ...");
2576
2577 QCString str(q);
2578 QCString temp;
2579
2580 while (str.length()>80)
2581 {
2582 int j=std::max(str.findRev(' ',80),str.findRev('|',80));
2583 if (j<=0)
2584 {
2585 temp+=str;
2586 q=temp;
2587 return;
2588 }
2589 else
2590 {
2591 QCString qcs=str.left(j);
2592 temp+=qcs+"\\";
2593 temp+="n";
2594 str.remove(0,j);
2595 }
2596 }//while
2597
2598 q=temp+str;
2599// #endif
2600}
2601
2603{
2604 QCString ui="-";
2605 std::string q;
2606 std::string t;
2607
2608 ui.fill('-',255);
2609
2610 if (flo.type & STARTL)
2611 {
2612 if (flo.stamp>0)
2613 {
2614 q=ui.left(2*flo.stamp).str();
2615 }
2616 else
2617 {
2618 q=" ";
2619 }
2620 QCString nn=flo.exp.stripWhiteSpace();
2621 printf("\nYES: %s%s[%d,%d]",qPrint(q),qPrint(nn),flo.stamp,flo.id);
2622 }
2623 else
2624 {
2625 if (flo.type & COMMENT_NO)
2626 {
2627 t=flo.label.str();
2628 }
2629 else
2630 {
2631 t=flo.text.str();
2632 }
2633 static const reg::Ex ep(R"(\s)");
2634 t = reg::replace(t,ep,std::string());
2635 if (t.empty())
2636 {
2637 t=" ";
2638 }
2639 if (flo.stamp>0)
2640 {
2641 q=ui.left(2*flo.stamp).str();
2642 }
2643 else
2644 {
2645 q=" ";
2646 }
2647 if (flo.type & EMPTNODE)
2648 {
2649 printf("\n NO: %s%s[%d,%d]",qPrint(q),FlowChart::getNodeType(flo.type),flo.stamp,flo.id);
2650 }
2651 else if (flo.type & COMMENT_NO)
2652 {
2653 printf("\n NO: %s%s[%d,%d]",qPrint(t),FlowChart::getNodeType(flo.type),flo.stamp,flo.id);
2654 }
2655 else
2656 {
2657 printf("\n NO: %s[%d,%d]",qPrint(t),flo.stamp,flo.id);
2658 }
2659 }
2660}
2661
2663{
2664 for (const auto &flowChart : flowList)
2665 {
2666 printNode(flowChart);
2667 }
2668}
2669
2671{
2672 FlowChart *flno = nullptr;
2673 bool found=FALSE;
2674 for (size_t j=0;j<flowList.size();j++)
2675 {
2676 FlowChart &flo = flowList[j];
2677 if (flo.type&TEXT_NO)
2678 {
2679 if (!found)
2680 {
2681 flno=&flo;
2682 }
2683 else
2684 {
2685 flno->text+=flo.text;
2686 flowList.erase(flowList.begin()+j);
2687 if (j>0) j=j-1;
2688 }
2689 found=TRUE;
2690 }
2691 else
2692 {
2693 found=FALSE;
2694 }
2695 }
2696
2697 // find if..endif without text
2698 // if..elseif without text
2699 if (!flowList.empty())
2700 {
2701 for (size_t j=0;j<flowList.size()-1;j++)
2702 {
2703 const FlowChart &flo = flowList[j];
2704 int kind = flo.type;
2705 if ( (kind & IFF) || (flo.type & ELSE_NO))
2706 {
2707 const FlowChart &ftemp = flowList[j+1];
2708 if (ftemp.type & EMPTY)
2709 {
2710 FlowChart fc(TEXT_NO,"empty ",QCString());
2711 fc.stamp = flo.stamp;
2712 flowList.insert(flowList.begin()+j+1,fc);
2713 }
2714 }
2715 }
2716 }
2717
2718}// colTextNode
2719
2721{
2722 QCString node;
2723 node.setNum(n);
2724 return node.prepend("node");
2725}
2726
2728{
2729 ifcounter=0;
2730 nodeCounter=0;
2731 flowList.clear();
2732}
2733
2735{
2736 size_t max=0;
2737 QCString s;
2738 StringVector ql=split(com.str(),"\n");
2739 for (size_t j=0;j<ql.size();j++)
2740 {
2741 s=ql[j];
2742 if (max<s.length()) max=s.length();
2743 }
2744
2745 s=ql.back();
2746 int diff=static_cast<int>(max-s.length());
2747
2748 QCString n;
2749 if (diff>0)
2750 {
2751 n.fill(' ',2*diff);
2752 n.append(".");
2753 s+=n;
2754 ql.pop_back();
2755 ql.push_back(s.str());
2756 }
2757
2758 for (size_t j=0;j<ql.size();j++)
2759 {
2760 s=ql[j];
2761 if (j<ql.size()-1)
2762 {
2763 s+="\n";
2764 }
2765 FlowChart::codify(t,s);
2766 }
2767}
2768
2769
2771{
2772 size_t size=flowList.size();
2773 bool begin=false;
2774
2775 if (size>0)
2776 {
2777 for (uint32_t j=0;j < size-1 ;j++)
2778 {
2779 FlowChart &fll = flowList[j];
2780 if (fll.type & COMMENT_NO)
2781 {
2782 FlowChart &to=flowList[j+1];
2783 if (to.type & COMMENT_NO)
2784 {
2785 to.label = fll.label+"\n"+to.label;
2786 flowList.erase(flowList.begin()+j);
2787 if (size>0) size--;
2788 if (j>0) j--;
2789 }
2790 }
2791 }// for
2792 }
2793
2794 for (size_t j=0;j <flowList.size() ;j++)
2795 {
2796 const FlowChart &fll=flowList[j];
2797
2798 if (fll.type & BEGIN_NO)
2799 {
2800 begin = true;
2801 continue;
2802 }
2803
2804 if (fll.type & COMMENT_NO)
2805 {
2806 const FlowChart *to = nullptr;
2807 if (!begin)
2808 {
2809 // comment between function/process .. begin is linked to start node
2810 to = &flowList[0];
2811 }
2812 else if (j>0 && flowList[j-1].line==fll.line)
2813 {
2814 to = &flowList[j-1];
2815 }
2816 else
2817 {
2818 to = &flowList[j+1];
2819 }
2820 t << getNodeName(fll.id);
2821 t << "[shape=none, label=<\n";
2822 t << "<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"2\" >\n ";
2823 t << "<TR><TD BGCOLOR=\"";
2824 t << flowCol.comment;
2825 t << "\" > ";
2826
2828 t << " </TD></TR></TABLE>>];";
2829 writeEdge(t,fll.id,to->id,2);
2830 }
2831 }// for
2832
2833 // delete comment nodes;
2834 size=flowList.size();
2835 for (size_t j=0; j<size; j++)
2836 {
2837 FlowChart &fll=flowList[j];
2838 if (fll.type & (COMMENT_NO | BEGIN_NO))
2839 {
2840 size_t diff=FLOWLEN-(j+1);
2841
2842 if ((fll.type & COMMENT_NO) && diff > 1)
2843 {
2844 flowList[j+1].label = fll.label;
2845 }
2846
2847 flowList.erase(flowList.begin()+j);
2848
2849 if (size>0) size--;
2850 if (j>0) j--;
2851 }
2852 }// for;
2853}
2854
2856{
2857 if (!str.isEmpty())
2858 {
2859 const char *p=str.data();
2860 while (*p)
2861 {
2862 char c=*p++;
2863 switch(c)
2864 {
2865 case '<': t << "&lt;"; break;
2866 case '>': t << "&gt;"; break;
2867 case '&': t << "&amp;"; break;
2868 case '\'': t << "&#39;"; break;
2869 case '"': t << "&quot;"; break;
2870 case '\n': t <<"<BR ALIGN=\"LEFT\"/>"; break;
2871 default: t << c; break;
2872 }
2873 }
2874 }
2875}//codify
2876
2877FlowChart::FlowChart(int typ,const QCString &t,const QCString &ex,const QCString &lab)
2878{
2880
2881 if (typ & STARTL)
2882 {
2883 ifcounter++;
2884 }
2885
2886 text=t;
2887 exp=ex;
2888 type=typ;
2889 label=lab;
2890
2891 if (typ & (ELSE_NO | ELSIF_NO))
2892 {
2893 stamp--;
2894 }
2895
2896 if (typ & (START_NO | END_NO | VARIABLE_NO))
2897 {
2898 stamp=0;
2899 }
2900
2901 id=nodeCounter++;
2902}
2903
2905{
2906 if (!VhdlDocGen::getFlowMember()) return;
2907
2908 QCString typeString(text);
2909 QCString expression(exp);
2910
2911
2912 if (!text.isEmpty())
2913 {
2914 typeString=substitute(typeString,";","\n");
2915 }
2916
2917 if (!exp.isEmpty())
2918 {
2919 expression=substitute(expression,"\"","\\\"");
2920 }
2921
2922 if (type & VARIABLE_NO)
2923 {
2924 // Ignore the empty section of the VHDL variable definition.
2925 // This is section between `process` and `begin` keywords, where any source text is missing, probably a bug in the VHDL source parser.
2926 if(text.isEmpty()) return;
2927
2928 flowList.insert(flowList.begin(),FlowChart(type,typeString,expression,label));
2929 flowList.front().line=1; // TODO: use getLine(); of the parser
2930 }
2931 else if (type & START_NO)
2932 {
2933 flowList.insert(flowList.begin(),FlowChart(type,typeString,expression,label));
2934 flowList.front().line=1; // TODO: use getLine(); of the parser
2935 }
2936 else
2937 {
2938 flowList.emplace_back(type,typeString,expression,label);
2939 flowList.back().line=1; // TODO: use getLine(); of the parser
2940 }
2941}
2942
2944{
2945 if (!VhdlDocGen::getFlowMember()) return;
2946 ifcounter--;
2947}
2948
2950{
2951 QCString t;
2954 switch (flo.type)
2955 {
2956 case START_NO: t=":"+text+"|"; break;
2957 case IF_NO : t="\nif ("+exp+") then (yes)"; break;
2958 case ELSIF_NO: t="\nelseif ("+exp+") then (yes)"; break;
2959 case ELSE_NO: t="\nelse"; break;
2960 case CASE_NO: t="\n:"+exp+";"; break;
2961 case WHEN_NO: t="\n";
2962 if (!ca) t+="else";
2963 t+="if ("+exp+") then (yes)";
2964 break;
2965 case EXIT_NO: break;
2966 case END_NO: if (text.contains(" function")==0) t="\n:"+text+";";
2967 break;
2968 case TEXT_NO: t="\n:"+text+"]"; break;
2969 case ENDIF_NO: t="\nendif"; break;
2970 case FOR_NO: t="\nwhile ("+exp+") is (yes)"; break;
2971 case WHILE_NO: t="\nwhile ("+exp+") is (yes)"; break;
2972 case END_LOOP: t="\nendwhile"; break;
2973 case END_CASE: t="\nendif\n:end case;"; break;
2974 case VARIABLE_NO:t="\n:"+text+";"; break;
2975 case RETURN_NO: t="\n:"+text+";";
2976 if (!endL) t+="\nstop";
2977 break;
2978 case LOOP_NO: t="\nwhile (infinite loop)"; break;
2979 case NEXT_NO: break;
2980 case EMPTY_NO: break;
2981 case COMMENT_NO: t="\n note left \n "+flo.label+"\nend note \n"; break;
2982 case BEGIN_NO: t="\n:begin;"; break;
2983 default: assert(false); break;
2984 }
2985 return t;
2986}
2987
2989{
2990 int caseCounter = 0;
2991 int whenCounter = 0;
2992
2993 QCString qcs;
2994 size_t size=flowList.size();
2995 for (size_t j=0;j<size;j++)
2996 {
2997 bool endList = j==FLOWLEN;
2998 const FlowChart &flo = flowList[j];
2999 if (flo.type==CASE_NO)
3000 {
3001 caseCounter++;
3002 whenCounter=0;
3003 }
3004
3005 if (flo.type==END_CASE)
3006 {
3007 caseCounter--;
3008 }
3009
3010 bool ca = (caseCounter>0 && whenCounter==0);
3011
3012 qcs+=printPlantUmlNode(flo,ca,endList);
3013
3014 if (flo.type==WHEN_NO)
3015 {
3016 whenCounter++;
3017 }
3018
3019 }
3020 qcs+="\n";
3021
3022 QCString htmlOutDir = Config_getString(HTML_OUTPUT);
3023
3025 auto baseNameVector=PlantumlManager::instance().writePlantUMLSource(htmlOutDir,n,qcs,PlantumlManager::PUML_SVG,"uml",n,1,true);
3026 for (const auto &baseName: baseNameVector)
3027 {
3029 }
3030}
3031
3036
3037const char* FlowChart::getNodeType(int c)
3038{
3039 switch(c)
3040 {
3041 case IF_NO: return "if ";
3042 case ELSIF_NO: return "elsif ";
3043 case ELSE_NO: return "else ";
3044 case CASE_NO: return "case ";
3045 case WHEN_NO: return "when ";
3046 case EXIT_NO: return "exit ";
3047 case END_NO: return "end ";
3048 case TEXT_NO: return "text ";
3049 case START_NO: return "start ";
3050 case ENDIF_NO: return "endif ";
3051 case FOR_NO: return "for ";
3052 case WHILE_NO: return "while ";
3053 case END_LOOP: return "end_loop ";
3054 case END_CASE: return "end_case ";
3055 case VARIABLE_NO: return "variable_decl ";
3056 case RETURN_NO: return "return ";
3057 case LOOP_NO: return "infinite loop ";
3058 case NEXT_NO: return "next ";
3059 case COMMENT_NO: return "comment ";
3060 case EMPTY_NO: return "empty ";
3061 case BEGIN_NO: return "<begin> ";
3062 default: return "--failure--";
3063 }
3064}
3065
3067{
3068 QCString qcs("/");
3069 QCString ov = Config_getString(HTML_OUTPUT);
3070
3072
3073 //const MemberDef *m=VhdlDocGen::getFlowMember();
3074 //if (m)
3075 // fprintf(stderr,"\n creating flowchart : %s %s in file %s \n",theTranslator->trVhdlType(m->getMemberSpecifiers(),TRUE),qPrint(m->name()),qPrint(m->getFileDef()->name()));
3076
3077 QCString dir=" -o \""+ov+qcs+"\"";
3078 ov+="/flow_design.dot";
3079
3080 QCString vlargs="-Tsvg \""+ov+"\" "+dir ;
3081
3083 {
3084 err("could not create dot file\n");
3085 }
3086}
3087
3089{
3090 t << " digraph G { \n";
3091 t << "rankdir=TB \n";
3092 t << "concentrate=true\n";
3093 t << "stylesheet=\"doxygen.css\"\n";
3094}
3095
3097{
3098 t << " } \n";
3099}
3100
3102{
3103 // assert(VhdlDocGen::flowMember);
3104
3105 QCString ov = Config_getString(HTML_OUTPUT);
3106 QCString fileName = ov+"/flow_design.dot";
3107 std::ofstream f = Portable::openOutputStream(fileName);
3108 if (!f.is_open())
3109 {
3110 err("Cannot open file {} for writing\n",fileName);
3111 return;
3112 }
3113 TextStream t(&f);
3114
3115 colTextNodes();
3116 // buildCommentNodes(t);
3117
3118#ifdef DEBUGFLOW
3119 printFlowTree();
3120#endif
3121
3122 if (!Config_getString(PLANTUML_JAR_PATH).isEmpty())
3123 {
3124 printUmlTree();
3125 delFlowList();
3126 t.flush();
3127 f.close();
3128 return;
3129 }
3130
3131 startDot(t);
3133 for (const auto &fll : flowList)
3134 {
3135 writeShape(t,fll);
3136 }
3137 writeFlowLinks(t);
3138
3140 delFlowList();
3141 t.flush();
3142 f.close();
3144}// writeFlowChart
3145
3147{
3148 if (fl.type & EEND) return;
3149 QCString var;
3150 if (fl.type & LOOP)
3151 {
3152 var=" loop";
3153 }
3154 else if (fl.type & IFF)
3155 {
3156 var=" then";
3157 }
3158 else
3159 {
3160 var="";
3161 }
3162
3163 t << getNodeName(fl.id);
3164
3165#ifdef DEBUGFLOW
3166 QCString qq(getNodeName(fl.id));
3167 g_keyMap.emplace(qq.str(),fl.id);
3168#endif
3169
3170 bool dec=(fl.type & DECLN);
3171 bool exit=(fl.type & EXITNEXT);
3172 if (exit && !fl.exp.isEmpty())
3173 {
3174 dec=TRUE;
3175 }
3176 if (dec)
3177 {
3178 QCString exp=fl.exp;
3179 alignText(exp);
3180
3181 t << " [shape=diamond,style=filled,color=\"";
3182 t << flowCol.decisionNode;
3183 t << "\",label=\" ";
3184 QCString kl;
3185 if (exit) kl=fl.text+" ";
3186
3187 if (!fl.label.isEmpty())
3188 {
3189 kl+=fl.label+":"+exp+var;
3190 }
3191 else
3192 {
3193 kl+=exp+var;
3194 }
3195
3197 t << "\"]\n";
3198 }
3199 else if (fl.type & ENDCL)
3200 {
3201 QCString val=fl.text;
3202 t << " [shape=ellipse ,label=\""+val+"\"]\n";
3203 }
3204 else if (fl.type & STARTFIN)
3205 {
3206 QCString val=fl.text;
3207 t << "[shape=box , style=rounded label=<\n";
3208 t << "<TABLE BORDER=\"0\" CELLBORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\" >\n ";
3209 t << "<TR><TD BGCOLOR=\"";
3210 t<< flowCol.startEndNode;
3211 t<< "\"> ";
3213 t << " </TD></TR></TABLE>>];";
3214 }
3215 else
3216 {
3217 if (fl.text.isEmpty()) return;
3218 bool isVar=(fl.type & FlowChart::VARIABLE_NO);
3219 QCString q=fl.text;
3220
3221 if (exit)
3222 {
3223 q+=" "+fl.label;
3224 }
3225
3226 int z=q.findRev("\n");
3227
3228 if (z==static_cast<int>(q.length())-1)
3229 {
3230 q=q.remove(z,2);
3231 }
3232 t << "[shape=none margin=0.1, label=<\n";
3233 t << "<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"2\" >\n ";
3234 if (isVar)
3235 {
3236 t << "<TR><TD BGCOLOR=\"" << flowCol.varNode << "\" > ";
3237 }
3238 else
3239 {
3240 t << "<TR><TD BGCOLOR=\"" << flowCol.textNode << "\" > ";
3241 }
3243 t << " </TD></TR></TABLE>>];";
3244 }
3245}
3246
3247
3248void FlowChart::writeEdge(TextStream &t,const FlowChart &fl_from,const FlowChart &fl_to,int i)
3249{
3250 bool b=fl_from.type & STARTL;
3251 bool c=fl_to.type & STARTL;
3252
3253#ifdef DEBUGFLOW
3254 QCString s1(getNodeName(fl_from.id));
3255 QCString s2(getNodeName(fl_to.id));
3256 auto it = g_keyMap.find(s1.str());
3257 auto it1 = g_keyMap.find(s2.str());
3258 // checks if the link is connected to a valid node
3259 assert(it!=g_keyMap.end());
3260 assert(it1!=g_keyMap.end());
3261#endif
3262
3263 writeEdge(t,fl_from.id,fl_to.id,i,b,c);
3264}
3265
3266void FlowChart::writeEdge(TextStream &t,int fl_from,int fl_to,int i,bool bFrom,bool bTo)
3267{
3268 QCString label,col;
3269
3270 if (i==0)
3271 {
3272 col=flowCol.yesNodeLink;
3273 label="yes";
3274 }
3275 else if (i==1)
3276 {
3277 col=flowCol.noNodeLink;
3278 label="no";
3279 }
3280 else
3281 {
3282 col=flowCol.textNodeLink;
3283 label="";
3284 }
3285
3286 t << "edge [color=\""+col+"\",label=\""+label+"\"]\n";
3287 t << getNodeName(fl_from);
3288 if (bFrom) t << ":s";
3289 t << "->";
3290 t << getNodeName(fl_to);
3291 if (bTo) t << ":n";
3292 t << "\n";
3293}
3294
3295void FlowChart::alignFuncProc( QCString & q,const ArgumentList &al,bool isFunc)
3296{
3297 size_t index=al.size();
3298 if (index==0) return;
3299
3300 size_t len=q.length()+VhdlDocGen::getFlowMember()->name().length();
3301 QCString prev,temp;
3302 prev.fill(' ',static_cast<int>(len)+1);
3303
3304 q+="\n";
3305 for (const Argument &arg : al)
3306 {
3307 QCString attl=arg.defval+" ";
3308 attl+=arg.name+" ";
3309
3310 if (!isFunc)
3311 {
3312 attl+=arg.attrib+" ";
3313 }
3314 else
3315 {
3316 attl+=" in ";
3317 }
3318 attl+=arg.type;
3319 if (--index) attl+=",\n"; else attl+="\n";
3320
3321 attl.prepend(prev);
3322 temp+=attl;
3323 }
3324
3325 q+=temp;
3326}
3327
3328size_t FlowChart::findNextLoop(size_t index,int stamp)
3329{
3330 for (size_t j=index+1; j<flowList.size(); j++)
3331 {
3332 const FlowChart &flo = flowList[j];
3333 if (flo.stamp==stamp)
3334 {
3335 continue;
3336 }
3337 if (flo.type&END_LOOP)
3338 {
3339 return j;
3340 }
3341 }
3342 return flowList.size()-1;
3343}
3344
3345size_t FlowChart::findPrevLoop(size_t index,int stamp,bool endif)
3346{
3347 for (size_t j=index;j>0;j--)
3348 {
3349 const FlowChart &flo = flowList[j];
3350 if (flo.type & LOOP)
3351 {
3352 if (flo.stamp==stamp && endif)
3353 {
3354 return j;
3355 }
3356 else
3357 {
3358 if (flo.stamp<stamp)
3359 {
3360 return j;
3361 }
3362 }
3363 }
3364 }
3365 return flowList.size()-1;
3366}
3367
3368size_t FlowChart::findLabel(size_t index,const QCString &label)
3369{
3370 for (size_t j=index;j>0;j--)
3371 {
3372 const FlowChart &flo = flowList[j];
3373 if ((flo.type & LOOP) && !flo.label.isEmpty() && qstricmp(flo.label,label)==0)
3374 {
3375 return j;
3376 }
3377 }
3378 err("could not find label: '{}'\n",label);
3379 return 0;
3380}
3381
3382size_t FlowChart::findNode(size_t index,int stamp,int type)
3383{
3384 for (size_t j=index+1; j<flowList.size(); j++)
3385 {
3386 const FlowChart &flo = flowList[j];
3387 if (flo.type==type && flo.stamp==stamp)
3388 {
3389 return j;
3390 }
3391 }
3392 return 0;
3393}// findNode
3394
3395size_t FlowChart::getNextNode(size_t index,int stamp)
3396{
3397 for (size_t j=index+1; j<flowList.size(); j++)
3398 {
3399 const FlowChart &flo = flowList[j];
3400 int kind = flo.type;
3401 int s = flo.stamp;
3402 if (s>stamp)
3403 {
3404 continue;
3405 }
3406 if (kind & ENDIF_NO)
3407 {
3408 if (s<stamp && stamp>0)
3409 {
3410 stamp--;
3411 continue;
3412 }
3413 }
3414 if (kind & (ELSE_NO | ELSIF_NO))
3415 {
3416 if (s<stamp && stamp>0)
3417 {
3418 stamp--;
3419 }
3420 j=findNode(j,stamp,ENDIF_NO);
3421 continue;
3422 }
3423 if (kind & WHEN_NO)
3424 {
3425 if (s<stamp && stamp>0)
3426 {
3427 stamp--;
3428 }
3429 return findNode(j,stamp-1,END_CASE);
3430 }
3431 return j;
3432 }
3433 return FLOWLEN;
3434}
3435
3436size_t FlowChart::getNextIfLink(const FlowChart &fl,size_t index)
3437{
3438 int stamp=fl.stamp;
3439 size_t start = index+1;
3440 size_t endifNode = findNode(start,stamp,ENDIF_NO);
3441 size_t elseifNode = findNode(start,stamp,ELSIF_NO);
3442 size_t elseNode = findNode(start,stamp,ELSE_NO);
3443
3444 if (elseifNode>0 && elseifNode<endifNode)
3445 {
3446 return elseifNode;
3447 }
3448
3449 if (elseNode>0 && elseNode<endifNode)
3450 {
3451 return elseNode+1;
3452 }
3453
3454 stamp=flowList[endifNode].stamp;
3455 return getNextNode(endifNode,stamp);
3456}
3457
3459{
3460 size_t size=flowList.size();
3461 if (size<2) return;
3462
3463 // write start link
3464 writeEdge(t,flowList[0],flowList[1],2);
3465
3466 for (size_t j=0;j<size;j++)
3467 {
3468 const FlowChart &fll = flowList[j];
3469 int kind = fll.type;
3470 int stamp = fll.stamp;
3471 if (kind & EEND)
3472 {
3473 continue;
3474 }
3475
3476 if (kind & IFF)
3477 {
3478 writeEdge(t,fll,flowList[j+1],0);
3479 size_t z=getNextIfLink(fll,j);
3480 // assert(z>-1);
3481 writeEdge(t,fll,flowList[z],1);
3482 }
3483 else if (kind & LOOP_NO)
3484 {
3485 writeEdge(t,fll,flowList[j+1],2);
3486 continue;
3487 }
3488 else if (kind & (CASE_NO | FOR_NO | WHILE_NO))
3489 {
3490 if (kind & CASE_NO)
3491 {
3492 writeEdge(t,fll,flowList[j+1],2);
3493 continue;
3494 }
3495 else
3496 {
3497 writeEdge(t,fll,flowList[j+1],0);
3498 }
3499
3500 kind=END_LOOP;
3501 size_t z=findNode(j+1,fll.stamp,kind);
3502 z=getNextNode(z,flowList[z].stamp);
3503
3504 // assert(z>-1);
3505 writeEdge(t,fll,flowList[z],1);
3506 continue;
3507 }
3508 else if (kind & (TEXT_NO | VARIABLE_NO))
3509 {
3510 size_t z=getNextNode(j,stamp);
3511 writeEdge(t,fll,flowList[z],2);
3512 }
3513 else if (kind & WHEN_NO)
3514 {
3515 // default value
3516 if (qstricmp(fll.text.simplifyWhiteSpace(),"others")==0)
3517 {
3518 writeEdge(t,fll,flowList[j+1],2);
3519 continue;
3520 }
3521
3522
3523 writeEdge(t,fll,flowList[j+1],0);
3524 size_t u=findNode(j,stamp,WHEN_NO);
3525 size_t v=findNode(j,stamp-1,END_CASE);
3526
3527 if (u>0 && u<v)
3528 {
3529 writeEdge(t,fll,flowList[u],1);
3530 }
3531 else
3532 {
3533 writeEdge(t,fll,flowList[v],1);
3534 }
3535 }
3536 else if (kind & END_CASE)
3537 {
3538 size_t z=FlowChart::getNextNode(j,fll.stamp);
3539 writeEdge(t,fll,flowList[z],2);
3540 }
3541 else if (kind & END_LOOP)
3542 {
3543 size_t z=findPrevLoop(j,fll.stamp,true);
3544 writeEdge(t,fll,flowList[z],2);
3545 }
3546 else if (kind & RETURN_NO)
3547 {
3548 writeEdge(t,fll,flowList[size-1],2);
3549 }
3550 else if (kind & (EXIT_NO | NEXT_NO))
3551 {
3552 size_t z = 0;
3553 bool b = kind==NEXT_NO;
3554 if (!fll.exp.isEmpty())
3555 {
3556 writeEdge(t,fll,flowList[j+1],1);
3557 }
3558 if (!fll.label.isEmpty())
3559 {
3560 z=findLabel(j,fll.label);
3561 if (b)
3562 {
3563 writeEdge(t,fll,flowList[z],0);
3564 }
3565 else
3566 {
3568 z=getNextNode(z,flowList[z].stamp);
3569 writeEdge(t,fll,flowList[z],0);
3570 }
3571 continue;
3572 }
3573 else
3574 {
3575 if (b)
3576 {
3577 z=findPrevLoop(j,fll.stamp);
3578 writeEdge(t,fll,flowList[z],0);
3579 continue;
3580 }
3581 else
3582 {
3583 z =findNextLoop(j,fll.stamp-1);
3584 }
3585 z=getNextNode(z,flowList[z].stamp);
3586 }
3587 writeEdge(t,fll,flowList[z],0);
3588 }
3589 } //for
3590} //writeFlowLinks
This class represents an function or template argument list.
Definition arguments.h:65
bool hasParameters() const
Definition arguments.h:76
size_t size() const
Definition arguments.h:100
A abstract class representing of a compound symbol.
Definition classdef.h:104
virtual void updateBaseClasses(const BaseClassList &bcd)=0
Update the list of base classes to the one passed.
virtual QCString className() const =0
Returns the name of the class including outer classes, but not including namespaces.
virtual const BaseClassList & baseClasses() const =0
Returns the list of base classes from which this class directly inherits.
virtual int isBaseClass(const ClassDef *bcd, bool followInstances, const QCString &templSpec=QCString()) const =0
Returns TRUE iff bcd is a direct or indirect base class of this class.
virtual Protection protection() const =0
Return the protection level (Public,Protected,Private) in which this compound was found.
virtual MemberList * getMemberList(MemberListType lt) const =0
Returns the members in the list identified by lt.
virtual const ClassDef * templateMaster() const =0
Returns the template master of which this class is an instance.
virtual FileDef * getFileDef() const =0
Returns the namespace this compound is in, or 0 if it has a global scope.
virtual const BaseClassList & subClasses() const =0
Returns the list of sub classes that directly derive from this class.
virtual void insertBaseClass(ClassDef *, const QCString &name, Protection p, Specifier s, const QCString &t=QCString())=0
virtual void insertSubClass(ClassDef *, Protection p, Specifier s, const QCString &t=QCString())=0
virtual void insertMember(MemberDef *)=0
The common base class of all entity definitions found in the sources.
Definition definition.h:76
virtual const QCString & localName() const =0
virtual int getEndBodyLine() const =0
virtual QCString getDefFileName() const =0
virtual bool isLinkable() const =0
virtual QCString anchor() const =0
virtual int briefLine() const =0
virtual QCString symbolName() const =0
virtual QCString briefDescription(bool abbreviate=FALSE) const =0
virtual QCString getReference() const =0
virtual QCString documentation() const =0
virtual QCString qualifiedName() const =0
virtual QCString briefFile() const =0
virtual QCString getOutputFileBase() const =0
virtual Definition * getOuterScope() const =0
virtual int getStartBodyLine() const =0
virtual const QCString & name() const =0
virtual void setName(const QCString &name)=0
virtual void writeSourceRefs(OutputList &ol, const QCString &scopeName) const =0
virtual void writeSourceDef(OutputList &ol) const =0
virtual void setLanguage(SrcLangExt lang)=0
virtual void writeSourceReffedBy(OutputList &ol, const QCString &scopeName) const =0
virtual void writeDocAnchorsToTagFile(TextStream &) const =0
virtual void setBodyDef(const FileDef *fd)=0
static ParserManager * parserManager
Definition doxygen.h:131
static ClassLinkedMap * classLinkedMap
Definition doxygen.h:96
static MemberNameLinkedMap * functionNameLinkedMap
Definition doxygen.h:112
static QCString verifiedDotPath
Definition doxygen.h:139
static SearchIndexIntf searchIndex
Definition doxygen.h:124
Represents an unstructured piece of information, about an entity found in the sources.
Definition entry.h:116
void moveToSubEntryAndKeep(Entry *e)
Definition entry.cpp:144
A model of a file symbol.
Definition filedef.h:99
virtual QCString absFilePath() const =0
static size_t findPrevLoop(size_t j, int stamp, bool endif=FALSE)
QCString label
Definition vhdldocgen.h:311
QCString text
Definition vhdldocgen.h:312
static void writeEdge(TextStream &t, int fl_from, int fl_to, int i, bool bFrom=FALSE, bool bTo=FALSE)
static void printFlowTree()
static void alignFuncProc(QCString &q, const ArgumentList &al, bool isFunc)
static void startDot(TextStream &t)
static const char * getNodeType(int c)
static void codify(TextStream &t, const QCString &str)
static size_t findLabel(size_t j, const QCString &)
static void addFlowChart(int type, const QCString &text, const QCString &exp, const QCString &label=QCString())
static void delFlowList()
static size_t getNextNode(size_t index, int stamp)
static void writeFlowChart()
static void colTextNodes()
static void createSVG()
static size_t findNextLoop(size_t j, int stamp)
static void writeShape(TextStream &t, const FlowChart &fl)
static size_t getNextIfLink(const FlowChart &, size_t)
static void printNode(const FlowChart &n)
static void moveToPrevLevel()
static QCString getNodeName(int n)
static QCString convertNameToFileName()
static void alignCommentNode(TextStream &t, QCString com)
static size_t findNode(size_t index, int stamp, int type)
static void buildCommentNodes(TextStream &t)
static void printUmlTree()
static void writeFlowLinks(TextStream &t)
FlowChart(int typ, const QCString &t, const QCString &ex, const QCString &label=QCString())
static void endDot(TextStream &t)
static QCString printPlantUmlNode(const FlowChart &flo, bool, bool)
QCString exp
Definition vhdldocgen.h:313
A model of a group of symbols.
Definition groupdef.h:52
A model of a class/file/namespace member symbol.
Definition memberdef.h:48
virtual QCString typeString() const =0
virtual bool hasDetailedDescription() const =0
virtual void warnIfUndocumented() const =0
virtual QCString excpString() const =0
virtual const ClassDef * getClassDef() const =0
virtual bool hasReferencesRelation() const =0
virtual GroupDef * getGroupDef()=0
virtual const FileDef * getFileDef() const =0
virtual const ArgumentList & argumentList() const =0
virtual VhdlSpecifier getVhdlSpecifiers() const =0
virtual ClassDef * getClassDefOfAnonymousType() const =0
virtual bool hasReferencedByRelation() const =0
virtual bool isBriefSectionVisible() const =0
virtual bool isVariable() const =0
virtual QCString argsString() const =0
virtual void setVhdlSpecifiers(VhdlSpecifier s)=0
virtual void setType(const QCString &t)=0
A list of MemberDef objects as shown in documentation sections.
Definition memberlist.h:125
MemberListType listType() const
Definition memberlist.h:130
const MemberGroupRefList & getMemberGroupList() const
Definition memberlist.h:165
Wrapper class for the MemberListType type.
Definition types.h:346
constexpr const char * toLabel() const
Definition types.h:402
void push_back(Ptr &&p)
Definition membername.h:54
An abstract interface of a namespace symbol.
void startFontClass(const QCString &c)
Definition outputlist.h:270
void startCodeFragment(const QCString &style)
Definition outputlist.h:279
Class representing a list of output generators that are written to in parallel.
Definition outputlist.h:315
bool isEnabled(OutputType o)
void writeString(const QCString &text)
Definition outputlist.h:411
void endParameterExtra(bool last, bool one, bool bracket)
Definition outputlist.h:694
void writeChar(char c)
Definition outputlist.h:529
void disable(OutputType o)
void endMemberDocName()
Definition outputlist.h:682
void insertMemberAlignLeft(OutputGenerator::MemberItemType typ=OutputGenerator::MemberItemType::Normal, bool templ=FALSE)
Definition outputlist.h:519
void startParameterExtra()
Definition outputlist.h:692
const OutputCodeList & codeGenerators() const
Definition outputlist.h:358
void startParameterList(bool openBracket)
Definition outputlist.h:700
void enable(OutputType o)
void endMemberDescription()
Definition outputlist.h:567
void endMemberGroupDocs()
Definition outputlist.h:511
void writeObjectLink(const QCString &ref, const QCString &file, const QCString &anchor, const QCString &name)
Definition outputlist.h:439
void startMemberDescription(const QCString &anchor, const QCString &inheritId=QCString(), bool typ=false)
Definition outputlist.h:565
void endDoxyAnchor(const QCString &fn, const QCString &anchor)
Definition outputlist.h:541
void docify(const QCString &s)
Definition outputlist.h:437
void endEmphasis()
Definition outputlist.h:527
void generateDoc(const QCString &fileName, int startLine, const Definition *ctx, const MemberDef *md, const QCString &docStr, const DocOptions &options)
void startMemberGroup()
Definition outputlist.h:513
void startMemberList()
Definition outputlist.h:481
void endTextLink()
Definition outputlist.h:444
void startBold()
Definition outputlist.h:561
void endMemberItem(OutputGenerator::MemberItemType type)
Definition outputlist.h:495
void endMemberList()
Definition outputlist.h:483
void addLabel(const QCString &fName, const QCString &anchor)
Definition outputlist.h:543
void pushGeneratorState()
void insertMemberAlign(bool templ=FALSE)
Definition outputlist.h:517
void startParameterType(bool first, const QCString &key)
Definition outputlist.h:684
void disableAllBut(OutputType o)
void endParameterName()
Definition outputlist.h:690
void popGeneratorState()
void endBold()
Definition outputlist.h:563
void startDoxyAnchor(const QCString &fName, const QCString &manName, const QCString &anchor, const QCString &name, const QCString &args)
Definition outputlist.h:537
void startEmphasis()
Definition outputlist.h:525
void endMemberGroupHeader()
Definition outputlist.h:507
void endMemberGroup(bool last)
Definition outputlist.h:515
void startMemberGroupDocs()
Definition outputlist.h:509
void endParameterType()
Definition outputlist.h:686
void startParameterName(bool one)
Definition outputlist.h:688
void enableAll()
void endMemberHeader()
Definition outputlist.h:471
void endMemberSubtitle()
Definition outputlist.h:475
void startMemberItem(const QCString &anchor, OutputGenerator::MemberItemType type, const QCString &id=QCString())
Definition outputlist.h:493
void startMemberSubtitle()
Definition outputlist.h:473
void lineBreak(const QCString &style=QCString())
Definition outputlist.h:559
void parseText(const QCString &textStr)
void startMemberGroupHeader(const QCString &id, bool b)
Definition outputlist.h:505
void startTextLink(const QCString &file, const QCString &anchor)
Definition outputlist.h:442
void startMemberHeader(const QCString &anchor, int typ=2)
Definition outputlist.h:469
StringVector writePlantUMLSource(const QCString &outDirArg, const QCString &fileName, const QCString &content, OutputFormat format, const QCString &engine, const QCString &srcFile, int srcLine, bool inlineCode)
Write a PlantUML compatible file.
Definition plantuml.cpp:31
static PlantumlManager & instance()
Definition plantuml.cpp:231
void generatePlantUMLOutput(const QCString &baseName, const QCString &outDir, OutputFormat format)
Convert a PlantUML file to an image.
Definition plantuml.cpp:202
This is an alternative implementation of QCString.
Definition qcstring.h:101
int find(char c, int index=0, bool cs=TRUE) const
Definition qcstring.cpp:43
QCString & prepend(const char *s)
Definition qcstring.h:422
int toInt(bool *ok=nullptr, int base=10) const
Definition qcstring.cpp:254
QCString upper() const
Definition qcstring.h:254
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:166
bool startsWith(const char *s) const
Definition qcstring.h:507
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:241
QCString lower() const
Definition qcstring.h:249
char & at(size_t i)
Returns a reference to the character at index i.
Definition qcstring.h:593
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:163
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition qcstring.h:260
QCString & remove(size_t index, size_t len)
Definition qcstring.h:442
void resize(size_t newlen)
Definition qcstring.h:180
QCString fill(char c, int len=-1)
Fills a string with a predefined character.
Definition qcstring.h:193
const std::string & str() const
Definition qcstring.h:552
QCString & setNum(short n)
Definition qcstring.h:459
QCString simplifyWhiteSpace() const
return a copy of this string with leading and trailing whitespace removed and multiple whitespace cha...
Definition qcstring.cpp:190
QCString & append(char c)
Definition qcstring.h:396
QCString right(size_t len) const
Definition qcstring.h:234
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition qcstring.cpp:96
QCString & replace(size_t index, size_t len, const char *s)
Definition qcstring.cpp:217
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:172
QCString left(size_t len) const
Definition qcstring.h:229
int contains(char c, bool cs=TRUE) const
Definition qcstring.cpp:148
bool stripPrefix(const QCString &prefix)
Definition qcstring.h:213
void clear()
Definition qcstring.h:182
Text streaming class that buffers data.
Definition textstream.h:36
void flush()
Flushes the buffer.
Definition textstream.h:209
static void findAllPackages(ClassDef *)
@ ARCHITECTURECLASS
Definition vhdldocgen.h:77
static bool writeVHDLTypeDocumentation(const MemberDef *mdef, const Definition *d, OutputList &ol)
static bool isArchitecture(const MemberDef *mdef)
static bool isGroup(const MemberDef *mdef)
static bool isSignal(const MemberDef *mdef)
static void correctMemberProperties(MemberDefMutable *md)
static bool writeClassType(const ClassDef *, OutputList &ol, QCString &cname)
static void writeFormatString(const QCString &, OutputList &ol, const MemberDef *)
static const MemberDef * getFlowMember()
static QCString convertArgumentListToString(const ArgumentList &al, bool f)
static void writeSource(const MemberDef *mdef, OutputList &ol, const QCString &cname)
static bool isProcess(const MemberDef *mdef)
static void writeVHDLDeclarations(const MemberList *ml, OutputList &ol, const ClassDef *cd, const NamespaceDef *nd, const FileDef *fd, const GroupDef *gd, const ModuleDef *mod, const QCString &title, const QCString &subtitle, bool showEnumValues, VhdlSpecifier type)
static bool isConstant(const MemberDef *mdef)
static QCString getClassName(const ClassDef *)
static bool isAttribute(const MemberDef *mdef)
static void createFlowChart(const MemberDef *)
static QCString getRecordNumber()
static void writeProcessProto(OutputList &ol, const ArgumentList &al, const MemberDef *)
static ClassDef * findVhdlClass(const QCString &className)
static const MemberDef * findMemberDef(ClassDef *cd, const QCString &key, MemberListType type)
This function returns the entity|package in which the key (type) is found.
static bool isLibrary(const MemberDef *mdef)
static QCString parseForBinding(QCString &entity, QCString &arch)
static QCString getProtectionName(int prot)
static QCString parseForConfig(QCString &entity, QCString &arch)
static bool isUnit(const MemberDef *mdef)
static void addBaseClass(ClassDef *cd, ClassDef *ent)
static void writeProcedureProto(OutputList &ol, const ArgumentList &al, const MemberDef *)
static bool isMisc(const MemberDef *mdef)
static bool isConfig(const MemberDef *mdef)
static void resetCodeVhdlParserState()
static bool isEntity(const MemberDef *mdef)
static QCString getProcessNumber()
static void writeInlineClassLink(const ClassDef *, OutputList &ol)
static bool isNumber(const std::string &s)
static void writeVhdlLink(const ClassDef *cdd, OutputList &ol, QCString &type, QCString &name, QCString &beh)
static bool isPort(const MemberDef *mdef)
static const MemberDef * findFunction(const QCString &name, const QCString &package)
static void writeTagFile(MemberDefMutable *mdef, TextStream &tagFile)
static void setFlowMember(const MemberDef *flowMember)
static bool isFile(const MemberDef *mdef)
static bool isSignals(const MemberDef *mdef)
static void prepareComment(QCString &)
static void writeRecUnitDocu(const MemberDef *md, OutputList &ol, QCString largs)
static bool deleteCharRev(QCString &s, char c)
static bool isVariable(const MemberDef *mdef)
static bool isVhdlFunction(const MemberDef *mdef)
static bool isVType(const MemberDef *mdef)
static void init()
static void writeVHDLDeclaration(MemberDefMutable *mdef, OutputList &ol, const ClassDef *cd, const NamespaceDef *nd, const FileDef *fd, const GroupDef *gd, const ModuleDef *mod, bool inGroup)
static void writeFunctionProto(OutputList &ol, const ArgumentList &al, const MemberDef *)
static void findAllArchitectures(std::vector< QCString > &ql, const ClassDef *cd)
static void parseFuncProto(const QCString &text, QCString &name, QCString &ret, bool doc=false)
static ClassDef * getClass(const QCString &name)
static void writeVhdlDeclarations(const MemberList *, OutputList &, const GroupDef *, const ClassDef *, const FileDef *, const NamespaceDef *, const ModuleDef *)
static void formatString(const QCString &, OutputList &ol, const MemberDef *)
static const ClassDef * findArchitecture(const ClassDef *cd)
static VhdlClasses convert(Protection prot)
Definition vhdldocgen.h:80
static bool isSubType(const MemberDef *mdef)
static const MemberDef * findMember(const QCString &className, const QCString &memName)
static bool isPackageBody(const MemberDef *mdef)
static void computeVhdlComponentRelations()
static bool isCompInst(const MemberDef *mdef)
static void writeStringLink(const MemberDef *mdef, QCString mem, OutputList &ol)
static bool isRecord(const MemberDef *mdef)
static void parseUCF(const QCString &input, Entry *entity, const QCString &f, bool vendor)
static bool isSubClass(ClassDef *cd, ClassDef *scd, bool followInstances, int level)
static bool isPackage(const MemberDef *mdef)
static void writeRecordUnit(QCString &largs, QCString &ltype, OutputList &ol, MemberDefMutable *mdef)
static QCString convertFileNameToClassName(const QCString &name)
static bool isComponent(const MemberDef *mdef)
static QCString getClassTitle(const ClassDef *)
static ClassDef * getPackageName(const QCString &name)
static bool isConstraint(const MemberDef *mdef)
static QCString getIndexWord(const QCString &, int index)
static bool isGeneric(const MemberDef *mdef)
static void deleteAllChars(QCString &s, char c)
static bool isProcedure(const MemberDef *mdef)
static bool writeFuncProcDocu(const MemberDef *mdef, OutputList &ol, const ArgumentList &al, bool type=false)
static bool isAlias(const MemberDef *mdef)
static const char * findKeyWord(const QCString &word)
static void writePlainVHDLDeclarations(const MemberList *ml, OutputList &ol, const ClassDef *cd, const NamespaceDef *nd, const FileDef *fd, const GroupDef *gd, const ModuleDef *mod, VhdlSpecifier specifier)
ClassDefMutable * toClassDefMutable(Definition *d)
ClassDef * toClassDef(Definition *d)
std::vector< BaseClassDef > BaseClassList
Definition classdef.h:81
Class representing a regular expression.
Definition regex.h:39
Class to iterate through matches.
Definition regex.h:232
Interface for the comment block scanner.
#define Config_getBool(name)
Definition config.h:33
#define Config_getString(name)
Definition config.h:32
std::set< std::string > StringSet
Definition containers.h:31
std::vector< std::string > StringVector
Definition containers.h:33
bool readCodeFragment(const QCString &fileName, bool isMacro, int &startLine, int &endLine, QCString &result)
Reads a fragment from file fileName starting with line startLine and ending with line endLine.
DirIterator begin(DirIterator it) noexcept
Definition dir.cpp:170
DirIterator end(const DirIterator &) noexcept
Definition dir.cpp:175
Translator * theTranslator
Definition language.cpp:71
MemberDefMutable * toMemberDefMutable(Definition *d)
std::unique_ptr< MemberDef > createMemberDef(const QCString &defFileName, int defLine, int defColumn, const QCString &type, const QCString &name, const QCString &args, const QCString &excp, Protection prot, Specifier virt, bool stat, Relationship related, MemberType t, const ArgumentList &tal, const ArgumentList &al, const QCString &metaData)
Factory method to create a new instance of a MemberDef.
#define err(fmt,...)
Definition message.h:127
std::ofstream openOutputStream(const QCString &name, bool append=false)
Definition portable.cpp:649
int system(const QCString &command, const QCString &args, bool commandHasConsole=true)
Definition portable.cpp:106
Namespace for the regular expression functions.
Definition regex.cpp:31
std::string replace(std::string_view str, const Ex &re, std::string_view replacement)
Searching in a given input string for parts that match regular expression re and replaces those parts...
Definition regex.cpp:770
bool match(std::string_view str, Match &match, const Ex &re)
Matches a given string str for a match against regular expression re.
Definition regex.cpp:759
Portable versions of functions that are platform dependent.
int qstricmp(const char *s1, const char *s2)
Definition qcstring.cpp:447
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition qcstring.cpp:482
#define qsnprintf
Definition qcstring.h:49
const char * qPrint(const char *s)
Definition qcstring.h:687
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
uint32_t qstrlen(const char *str)
Returns the length of string str, or 0 if a null pointer is passed.
Definition qcstring.h:58
#define ASSERT(x)
Definition qcstring.h:39
Web server based search engine.
std::string_view stripWhiteSpace(std::string_view s)
Given a string view s, returns a new, narrower view on that string, skipping over any leading or trai...
Definition stringutil.h:72
This class contains the information about the argument of a function or template.
Definition arguments.h:27
This struct is used to capture the tag file information for an Entry.
Definition entry.h:103
QCString anchor
Definition entry.h:106
QCString fileName
Definition entry.h:105
QCString tagName
Definition entry.h:104
@ Variable
Definition types.h:555
VhdlSpecifier
Definition types.h:710
@ INSTANTIATION
Definition types.h:731
@ MISCELLANEOUS
Definition types.h:737
@ SHAREDVARIABLE
Definition types.h:734
QCString convertToXML(const QCString &s, bool keepEntities)
Definition util.cpp:3833
int findIndex(const StringVector &sv, const std::string &s)
find the index of a string in a vector of strings, returns -1 if the string could not be found
Definition util.cpp:6564
StringVector split(const std::string &s, const std::string &delimiter)
split input string s by string delimiter delimiter.
Definition util.cpp:6528
QCString convertToId(const QCString &s)
Definition util.cpp:3793
void addHtmlExtensionIfMissing(QCString &fName)
Definition util.cpp:4823
A bunch of utility functions.
static std::vector< ClassDef * > g_classList
static void initUCF(Entry *root, const QCString &type, QCString &qcs, int line, const QCString &fileName, QCString &brief)
static const MemberDef * findMemFlow(const MemberDef *mdef)
const char * noNodeLink
static void writeUCFLink(const MemberDef *mdef, OutputList &ol)
#define FLOWLEN
#define IFF
#define EMPTY
static const std::unordered_set< std::string > g_vhdlKeyWordSet0
static std::vector< const MemberDef * > mdList
static int nodeCounter
static std::map< std::string, const MemberDef * > g_varMap
static void startFonts(const QCString &q, const char *keyword, OutputList &ol)
const char * decisionNode
static std::map< ClassDef *, std::vector< ClassDef * > > g_packages
#define ENDCL
static const MemberDef * flowMember
static int recordCounter
std::vector< FlowChart > flowList
#define theTranslator_vhdlType
static void writeLink(const MemberDef *mdef, OutputList &ol)
static struct @262143045100337216022015277174266365223104043217 flowCol
static QCString splitString(QCString &str, char c)
const char * yesNodeLink
#define EMPTNODE
#define LOOP
static bool membersHaveSpecificType(const MemberList *ml, VhdlSpecifier type)
const char * textNodeLink
static const std::unordered_set< std::string > g_vhdlKeyWordSet2
#define DECLN
static int ifcounter
static VhdlSpecifier getSpecifierTypeFromClass(const ClassDef *cd)
static void addInstance(ClassDefMutable *entity, ClassDefMutable *arch, ClassDefMutable *inst, const std::shared_ptr< Entry > &cur)
const char * varNode
void alignText(QCString &q)
#define STARTFIN
const char * textNode
static int compareString(const QCString &s1, const QCString &s2)
static const std::unordered_set< std::string > g_vhdlKeyWordSet3
#define EEND
const char * startEndNode
const char * comment
static std::recursive_mutex g_vhdlMutex
#define EXITNEXT
static const std::unordered_set< std::string > g_vhdlKeyWordSet1
#define STARTL
std::vector< FlowChart > flowList
const EntryList & getVhdlInstList()