Doxygen
Loading...
Searching...
No Matches
vhdldocgen.h
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#ifndef VHDLDOCGEN_H
17#define VHDLDOCGEN_H
18
19/**
20 * This class implements functions for parsing and generating
21 * vhdl documents
22 */
23
24#include "qcstring.h"
25#include "layout.h"
26#include "arguments.h"
27#include "entry.h"
28
29class Entry;
30class ClassDef;
31class MemberList;
32class MemberDef;
33class ModuleDef;
35class OutputList;
36class Definition;
37class GroupDef;
38class FileDef;
39class NamespaceDef;
40class TextStream;
41struct Argument;
42
44{
45 VhdlConfNode(const QCString &a,const QCString &b,const QCString &config,const QCString &cs,bool leaf)
46 {
47 arch=a; // architecture e.g. for iobuffer
48 arch=arch.lower();
49 binding=b; // binding e.g. use entity work.xxx(bev)
50 binding=binding.lower();
51 confVhdl=config; // configuration foo is bar
52 compSpec=cs;
53 isInlineConf=false; // primary configuration?
54 isLeaf=leaf;
55 };
56
57 QCString confVhdl;
58 QCString arch;
59 QCString binding;
60 QCString compSpec;
61 int level = 0;
62 bool isLeaf = false;
63 bool isInlineConf = false;
64
65};
66
67
68/** Class for generating documentation specific for VHDL */
70{
71 public:
72
73 enum VhdlClasses // Overlays: Protection
74 {
75 ENTITYCLASS, // Overlays: Public
76 PACKBODYCLASS, // Overlays: Protected
77 ARCHITECTURECLASS, // Overlays: Private
78 PACKAGECLASS // Overlays: Package
79 };
81 {
82 switch (prot)
83 {
88 }
89 return ENTITYCLASS;
90 }
91
92 static void init();
93 static QCString convertFileNameToClassName(const QCString &name);
94 // --- used by vhdlscanner.l -----------
95
96 static bool isSubClass(ClassDef* cd,ClassDef *scd, bool followInstances,int level);
97
98 static QCString getIndexWord(const QCString &,int index);
99 static bool deleteCharRev(QCString &s,char c);
100 static void deleteAllChars(QCString &s,char c);
101 static void parseFuncProto(const QCString &text,
102 QCString& name,
103 QCString& ret,
104 bool doc=false);
105 // -----------------------------------
106
107 static void computeVhdlComponentRelations();
108
109 static const char* findKeyWord(const QCString& word);
110
111 static ClassDef* getPackageName(const QCString& name);
112 static const MemberDef* findMember(const QCString& className,
113 const QCString& memName);
114 static void findAllPackages(ClassDef*);
115 static const MemberDef* findMemberDef(ClassDef* cd,
116 const QCString& key,
117 MemberListType type);
118 static ClassDef *getClass(const QCString &name);
119 static const MemberDef* findFunction(const QCString& name,
120 const QCString& package);
121 static QCString getClassTitle(const ClassDef*);
122 static void writeInlineClassLink(const ClassDef*,
123 OutputList &ol);
124 static void writeTagFile(MemberDefMutable *mdef,TextStream &tagFile);
125
126 static bool isConstraint(const MemberDef *mdef);
127 static bool isConfig(const MemberDef *mdef);
128 static bool isAlias(const MemberDef *mdef);
129 static bool isLibrary(const MemberDef *mdef);
130 static bool isGeneric(const MemberDef *mdef);
131 static bool isPort(const MemberDef *mdef);
132 static bool isComponent(const MemberDef *mdef);
133 static bool isPackage(const MemberDef *mdef);
134 static bool isEntity(const MemberDef *mdef);
135 static bool isConstant(const MemberDef *mdef);
136 static bool isVType(const MemberDef *mdef);
137 static bool isSubType(const MemberDef *mdef);
138 static bool isVhdlFunction(const MemberDef *mdef);
139 static bool isProcess(const MemberDef *mdef);
140 static bool isSignal(const MemberDef *mdef);
141 static bool isAttribute(const MemberDef *mdef);
142 static bool isSignals(const MemberDef *mdef);
143 static bool isProcedure(const MemberDef *mdef);
144 static bool isRecord(const MemberDef *mdef);
145 static bool isArchitecture(const MemberDef *mdef);
146 static bool isUnit(const MemberDef *mdef);
147 static bool isPackageBody(const MemberDef *mdef);
148 static bool isVariable(const MemberDef *mdef);
149 static bool isFile(const MemberDef *mdef);
150 static bool isGroup(const MemberDef *mdef);
151 static bool isCompInst(const MemberDef *mdef);
152 static bool isMisc(const MemberDef *mdef);
153
154 //-----------------------------------------------------
155
156 static void prepareComment(QCString&);
157 static void formatString(const QCString&,OutputList& ol,const MemberDef*);
158
159 static void writeFormatString(const QCString&,OutputList& ol,const MemberDef*);
160 static void writeFunctionProto(OutputList& ol,const ArgumentList &al,const MemberDef*);
161 static void writeProcessProto(OutputList& ol,const ArgumentList &al,const MemberDef*);
162 static void writeProcedureProto(OutputList& ol, const ArgumentList &al,const MemberDef*);
163 static bool writeFuncProcDocu(const MemberDef *mdef, OutputList& ol,const ArgumentList &al,bool type=false);
164 static void writeRecordProto(const MemberDef *mdef, OutputList& ol,const ArgumentList &al);
165
166 static bool writeVHDLTypeDocumentation(const MemberDef* mdef, const Definition* d, OutputList &ol);
167
168 static void writeVhdlDeclarations(const MemberList*,OutputList&,const GroupDef*,const ClassDef*,const FileDef*,const NamespaceDef*,const ModuleDef *);
169
170 static void writeVHDLDeclaration(MemberDefMutable* mdef,OutputList &ol,
171 const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod,
172 bool inGroup);
173
174 static void writePlainVHDLDeclarations(const MemberList* ml,OutputList &ol,
175 const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod,
176 VhdlSpecifier specifier);
177
178 static void writeVHDLDeclarations(const MemberList* ml,OutputList &ol,
179 const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,const ModuleDef *mod,
180 const QCString &title,const QCString &subtitle,bool showEnumValues,VhdlSpecifier type);
181
182 static bool writeClassType(const ClassDef *,OutputList &ol ,QCString & cname);
183
184 static QCString convertArgumentListToString(const ArgumentList &al,bool f);
185 static QCString getProcessNumber();
186 static QCString getRecordNumber();
187
188 static QCString getClassName(const ClassDef*);
189 static bool isNumber(const std::string& s);
190 static QCString getProtectionName(int prot);
191
192 static void parseUCF(const QCString &input,Entry* entity,const QCString &f,bool vendor);
193
194 static const ClassDef* findArchitecture(const ClassDef *cd);
195
196 static void correctMemberProperties(MemberDefMutable *md);
197
198 static void writeSource(const MemberDef *mdef,OutputList& ol,const QCString & cname);
199
200 static QCString parseForConfig(QCString & entity,QCString & arch);
201 static QCString parseForBinding(QCString & entity,QCString & arch);
202 static void addBaseClass(ClassDef* cd,ClassDef *ent);
203 static ClassDef* findVhdlClass(const QCString &className );
204
205 // flowcharts
206 static void createFlowChart(const MemberDef*);
207 //static void addFlowImage(const TextStream &,const QCString &);
208
209 static void setFlowMember( const MemberDef *flowMember);
210 static const MemberDef *getFlowMember();
211
212 static bool isVhdlClass (const Entry *cu)
213 {
214 return cu->vhdlSpec==VhdlSpecifier::ENTITY ||
218 }
219
220 static void resetCodeVhdlParserState();
221
222 private:
223 static void findAllArchitectures(std::vector<QCString>& ql,const ClassDef *cd);
224 static bool compareArgList(const ArgumentList &,const ArgumentList &);
225 static void writeVhdlLink(const ClassDef* cdd ,OutputList& ol,QCString& type,QCString& name,QCString& beh);
226 static void writeStringLink(const MemberDef *mdef,QCString mem,OutputList& ol);
227 static void writeRecUnitDocu( const MemberDef *md, OutputList& ol,QCString largs);
228 static void writeRecordUnit(QCString & largs,QCString & ltype,OutputList& ol,MemberDefMutable *mdef);
229};
230
231//-------------------------------------------------------------------------------------------------------------------
232//-------------- VHDL Flowcharts -------------------------------------------------------------------------------
233//-------------------------------------------------------------------------------------------------------------------
234
235
236//#define DEBUGFLOW
237
239{
240 public:
242 IF_NO = 1<<1,
243 ELSIF_NO = 1<<2,
244 ELSE_NO = 1<<3,
245 CASE_NO = 1<<4,
246 WHEN_NO = 1<<5,
247 EXIT_NO = 1<<6,
248 END_NO = 1<<7,
249 TEXT_NO = 1<<8,
250 START_NO = 1<<9,
251 ENDIF_NO = 1<<10,
252 FOR_NO = 1<<11,
253 WHILE_NO = 1<<12,
254 END_LOOP = 1<<13,
255 END_CASE = 1<<14,
256 VARIABLE_NO = 1<<15,
257 RETURN_NO = 1<<16,
258 LOOP_NO = 1<<17,
259 NEXT_NO = 1<<18,
260 EMPTY_NO = 1<<19,
261 COMMENT_NO = 1<<20,
262 BEGIN_NO = 1<<21
263 };
264
265 //---------- create svg -------------------------------------------------------------
266 static void createSVG();
267 static void startDot(TextStream &t);
268 static void endDot(TextStream &t);
269 static void codify(TextStream &t,const QCString &str);
270 static void writeShape(TextStream &t,const FlowChart &fl);
271 static void writeEdge(TextStream &t,int fl_from,int fl_to,int i,bool bFrom=FALSE,bool bTo=FALSE);
272 static void writeEdge(TextStream &t,const FlowChart &fl_from,const FlowChart &fl_to,int i);
273 static void writeFlowLinks(TextStream &t);
274
275 static QCString getNodeName(int n);
276 static void colTextNodes();
277
278 static size_t getNextIfLink(const FlowChart&,size_t);
279 static size_t getNextNode(size_t index,int stamp);
280 static size_t findNode(size_t index,int stamp,int type);
281 static size_t findNode(size_t index,int type);
282 static size_t findNextLoop(size_t j,int stamp);
283 static size_t findPrevLoop(size_t j,int stamp,bool endif=FALSE);
284 static size_t findLabel(size_t j,const QCString &);
285 static void delFlowList();
286 static const char* getNodeType(int c);
287
288 static void addFlowChart(int type,const QCString &text,const QCString &exp,const QCString &label=QCString());
289 static void moveToPrevLevel();
290 static int getTimeStamp();
291 static void writeFlowChart();
292 static void alignFuncProc(QCString & q,const ArgumentList &al,bool isFunc);
293 static QCString convertNameToFileName();
294 static void printNode(const FlowChart& n);
295 static void printFlowTree();
296 static void buildCommentNodes(TextStream &t);
297 static void alignCommentNode(TextStream &t,QCString com);
298
299 static void printUmlTree();
300 static QCString printPlantUmlNode(const FlowChart &flo,bool,bool);
301
302 FlowChart(int typ,const QCString &t,const QCString &ex,const QCString &label=QCString());
303
304private:
305 int id = 0;
306 int stamp = 0;
307 int type = 0;
308
309 int line = 0;
310
311 QCString label;
312 QCString text;
313 QCString exp;
314};
315
316extern std::vector<FlowChart> flowList;
317
318#endif
A abstract class representing of a compound symbol.
Definition classdef.h:104
The common base class of all entity definitions found in the sources.
Definition definition.h:76
Represents an unstructured piece of information, about an entity found in the sources.
Definition entry.h:116
VhdlSpecifier vhdlSpec
VHDL specifiers.
Definition entry.h:183
A model of a file symbol.
Definition filedef.h:99
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 size_t findNode(size_t index, int type)
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 int getTimeStamp()
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
A list of MemberDef objects as shown in documentation sections.
Definition memberlist.h:108
An abstract interface of a namespace symbol.
Class representing a list of output generators that are written to in parallel.
Definition outputlist.h:314
Text streaming class that buffers data.
Definition textstream.h:36
Class for generating documentation specific for VHDL.
Definition vhdldocgen.h:70
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 bool compareArgList(const ArgumentList &, const ArgumentList &)
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 setFlowMember(const MemberDef *flowMember)
static bool isFile(const MemberDef *mdef)
static bool isVhdlClass(const Entry *cu)
Definition vhdldocgen.h:212
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 void writeRecordProto(const MemberDef *mdef, OutputList &ol, const ArgumentList &al)
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)
static void writeTagFile()
#define FALSE
Definition qcstring.h:34
This class contains the information about the argument of a function or template.
Definition arguments.h:27
QCString binding
Definition vhdldocgen.h:59
QCString arch
Definition vhdldocgen.h:58
QCString confVhdl
Definition vhdldocgen.h:57
bool isInlineConf
Definition vhdldocgen.h:63
QCString compSpec
Definition vhdldocgen.h:60
VhdlConfNode(const QCString &a, const QCString &b, const QCString &config, const QCString &cs, bool leaf)
Definition vhdldocgen.h:45
Protection
Protection level of members.
Definition types.h:26
@ Package
Definition types.h:26
@ Public
Definition types.h:26
@ Private
Definition types.h:26
@ Protected
Definition types.h:26
VhdlSpecifier
Definition types.h:548
std::string_view word
Definition util.cpp:980
static const MemberDef * flowMember
std::vector< FlowChart > flowList