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 <qdict.h>
25 #include <qcstring.h>
26 #include "layout.h"
27 #include "arguments.h"
28 #include "entry.h"
29 
30 class Entry;
31 class ClassDef;
32 class MemberList;
33 class MemberDef;
34 class FTextStream;
35 class OutputList;
36 class Definition;
37 class GroupDef;
38 class FileDef;
39 class NamespaceDef;
40 struct Argument;
41 
42 /** Class for generating documentation specific for VHDL */
43 class VhdlDocGen
44 {
45  public:
46 
47  enum VhdlClasses // Overlays: Protection
48  {
49  ENTITYCLASS, // Overlays: Public
50  PACKBODYCLASS, // Overlays: Protected
51  ARCHITECTURECLASS, // Overlays: Private
52  PACKAGECLASS // Overlays: Package
53  };
54 
56  {
71  USE,
84  };
85 
86  VhdlDocGen();
87  virtual ~VhdlDocGen();
88  static void init();
90  // --- used by vhdlscanner.l -----------
91 
92  static bool isSubClass(ClassDef* cd,ClassDef *scd, bool followInstances,int level);
93 
94  static QCString getIndexWord(const char* ,int index);
95  static bool deleteCharRev(QCString &s,char c);
96  static void deleteAllChars(QCString &s,char c);
97  static void parseFuncProto(const char* text,
98  QList<Argument>& ,
99  QCString& name,
100  QCString& ret,
101  bool doc=false);
102  // -----------------------------------
103 
104  static void computeVhdlComponentRelations();
105 
106  static QCString* findKeyWord(const QCString& word);
107 
108  static ClassDef* getPackageName(const QCString& name);
109  static MemberDef* findMember(const QCString& className,
110  const QCString& memName);
111  static void findAllPackages(ClassDef*);
112  static MemberDef* findMemberDef(ClassDef* cd,
113  const QCString& key,
115  static ClassDef *getClass(const char *name);
116  static MemberDef* findFunction(const QList<Argument> &ql,
117  const QCString& name,
118  const QCString& package, bool type);
119  static QCString getClassTitle(const ClassDef*);
120  static void writeInlineClassLink(const ClassDef*,
121  OutputList &ol);
122  static void writeTagFile(MemberDef *mdef,FTextStream &tagFile);
123 
124  static bool isConstraint(const MemberDef *mdef);
125  static bool isConfig(const MemberDef *mdef);
126  static bool isAlias(const MemberDef *mdef);
127  static bool isLibrary(const MemberDef *mdef);
128  static bool isGeneric(const MemberDef *mdef);
129  static bool isPort(const MemberDef *mdef);
130  static bool isComponent(const MemberDef *mdef);
131  static bool isPackage(const MemberDef *mdef);
132  static bool isEntity(const MemberDef *mdef);
133  static bool isConstant(const MemberDef *mdef);
134  static bool isVType(const MemberDef *mdef);
135  static bool isSubType(const MemberDef *mdef);
136  static bool isVhdlFunction(const MemberDef *mdef);
137  static bool isProcess(const MemberDef *mdef);
138  static bool isSignal(const MemberDef *mdef);
139  static bool isAttribute(const MemberDef *mdef);
140  static bool isSignals(const MemberDef *mdef);
141  static bool isProcedure(const MemberDef *mdef);
142  static bool isRecord(const MemberDef *mdef);
143  static bool isArchitecture(const MemberDef *mdef);
144  static bool isUnit(const MemberDef *mdef);
145  static bool isPackageBody(const MemberDef *mdef);
146  static bool isVariable(const MemberDef *mdef);
147  static bool isFile(const MemberDef *mdef);
148  static bool isGroup(const MemberDef *mdef);
149  static bool isCompInst(const MemberDef *mdef);
150  static bool isMisc(const MemberDef *mdef);
151 
152  //-----------------------------------------------------
153  // translatable items
154 
156  static QCString trVhdlType(uint64 type,bool sing=true);
157 
158  // trClassHierarchy.
160 
161  // trCompoundList
162  static QCString trDesignUnitList();
163 
164  // trCompoundMembers.
165  static QCString trDesignUnitMembers();
166 
167  // trCompoundListDescription
169 
170  // trCompounds
171  static QCString trDesignUnits();
172 
173  // trCompoundIndex
174  static QCString trDesignUnitIndex();
175 
176  // trFunctions
177  static QCString trFunctionAndProc();
178 
179  //-----------------------------------------------------
180 
181  static void prepareComment(QCString&);
182  static void formatString(const QCString&,OutputList& ol,const MemberDef*);
183 
184  static void writeFormatString(const QCString&,OutputList& ol,const MemberDef*);
185  static void writeFunctionProto(OutputList& ol,const ArgumentList *al,const MemberDef*);
186  static void writeProcessProto(OutputList& ol,const ArgumentList *al,const MemberDef*);
187  static void writeProcedureProto(OutputList& ol, const ArgumentList *al,const MemberDef*);
188  static bool writeFuncProcDocu(const MemberDef *mdef, OutputList& ol,const ArgumentList* al,bool type=false);
189  static void writeRecordProto(const MemberDef *mdef, OutputList& ol,const ArgumentList *al);
190 
191  static bool writeVHDLTypeDocumentation(const MemberDef* mdef, const Definition* d, OutputList &ol);
192 
194 
195  static void writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
196  ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
197  bool inGroup);
198 
200  ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,int specifier);
201 
202  static void writeVHDLDeclarations(MemberList* ml,OutputList &ol,
203  ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
204  const char *title,const char *subtitle,bool showEnumValues,int type);
205 
206  static bool writeClassType(ClassDef *&,OutputList &ol ,QCString & cname);
207 
208  static QCString convertArgumentListToString(const ArgumentList* al,bool f);
209  static QCString getProcessNumber();
210  static QCString getRecordNumber();
211 
212  static QCString getClassName(const ClassDef*);
213  static bool isNumber(const QCString& s);
214  static QCString getProtectionName(int prot);
215 
216  static void parseUCF(const char* input,Entry* entity,QCString f,bool vendor);
217  static bool findConstraintFile( LayoutNavEntry *lne);
218 
219  static ClassDef* findArchitecture(const ClassDef *cd);
220  static ClassDef* findArchitecture(QCString identifier, QCString entity_name);
221 
222 
223  static void writeSource(MemberDef *mdef,OutputList& ol,QCString & cname);
224  static void writeAlphbeticalClass(OutputList& ol,const ClassDef* cd,const QCString &);
225 
226  static QCString parseForConfig(QCString & entity,QCString & arch);
227  static QCString parseForBinding(QCString & entity,QCString & arch);
228  static void addBaseClass(ClassDef* cd,ClassDef *ent);
229  static ClassDef* findVhdlClass(const char *className );
230 
231  static void writeOverview(OutputList &ol);
232  static void writeOverview();
233 
234  // flowcharts
235  static void createFlowChart(const MemberDef*);
236  //static void addFlowImage(const FTextStream &,const QCString &);
237 
238  static void setFlowMember( const MemberDef *flowMember);
239  static const MemberDef *getFlowMember();
240 
241  static bool isVhdlClass (const Entry *cu)
242  {
243  return cu->spec==VhdlDocGen::ENTITY ||
244  cu->spec==VhdlDocGen::PACKAGE ||
247  }
248 
249  static void resetCodeVhdlParserState();
250 
251  private:
252  static void findAllArchitectures(QList<QCString>& ql,const ClassDef *cd);
254  static void writeVhdlLink(const ClassDef* cdd ,OutputList& ol,QCString& type,QCString& name,QCString& beh);
255  static void writeStringLink(const MemberDef *mdef,QCString mem,OutputList& ol);
256  static void writeRecUnitDocu( const MemberDef *md, OutputList& ol,QCString largs);
257  static void writeRecorUnit(QCString & largs,OutputList& ol ,const MemberDef *mdef);
258 };
259 
260 //-------------------------------------------------------------------------------------------------------------------
261 //-------------- VHDL Flowcharts -------------------------------------------------------------------------------
262 //-------------------------------------------------------------------------------------------------------------------
263 
264 
265 //#define DEBUGFLOW
266 
268 {
269  public:
270  enum nodeTypes {
271  IF_NO = 1<<1,
272  ELSIF_NO = 1<<2,
273  ELSE_NO = 1<<3,
274  CASE_NO = 1<<4,
275  WHEN_NO = 1<<5,
276  EXIT_NO = 1<<6,
277  END_NO = 1<<7,
278  TEXT_NO = 1<<8,
279  START_NO = 1<<9,
280  ENDIF_NO = 1<<10,
281  FOR_NO = 1<<11,
282  WHILE_NO = 1<<12,
283  END_LOOP = 1<<13,
284  END_CASE = 1<<14,
285  VARIABLE_NO = 1<<15,
286  RETURN_NO = 1<<16,
287  LOOP_NO = 1<<17,
288  NEXT_NO = 1<<18,
289  EMPTY_NO = 1<<19,
290  COMMENT_NO = 1<<20,
291  BEGIN_NO = 1<<21
292  };
293 
294  //---------- create svg -------------------------------------------------------------
295  static void createSVG();
296  static void startDot(FTextStream &t);
297  static void endDot(FTextStream &t);
298  static void codify(FTextStream &t,const char *str);
299  static void writeShape(FTextStream &t,const FlowChart* fl);
300  static void writeEdge(FTextStream &t,int fl_from,int fl_to,int i,bool bFrom=FALSE,bool bTo=FALSE);
301  static void writeEdge(FTextStream &t,const FlowChart* fl_from,const FlowChart* fl_to,int i);
302  static void writeFlowLinks(FTextStream &t);
303 
304  static QCString getNodeName(int n);
305  static void colTextNodes();
306 
307  static int getNextTextLink(const FlowChart* fl,uint index);
308  static int getNextIfLink(const FlowChart*,uint);
309  static int getNextNode(int,int);
310  static int findNode(int index,int stamp,int type);
311  static int findNode(int index,int type);
312  static int findNextLoop(int j,int stamp);
313  static int findPrevLoop(int j,int stamp,bool endif=FALSE);
314  static int findLabel(int j,QCString &);
315  static void delFlowList();
316  static const char* getNodeType(int c);
317 
318  static void addFlowChart(int type,const char* text,const char* exp,const char * label=NULL);
319  static void moveToPrevLevel();
320  static int getTimeStamp();
321  static void writeFlowChart();
322  static void alignFuncProc(QCString & q,const ArgumentList* al,bool isFunc);
323  static QCString convertNameToFileName();
324  static void printNode(const FlowChart* n);
325  static void printFlowTree();
326  static void buildCommentNodes(FTextStream &t);
327  static void alignCommentNode(FTextStream &t,QCString com);
328 
329  static void printUmlTree();
330  static QCString printPlantUmlNode(const FlowChart *flo,bool,bool);
331 
333 
334  FlowChart(int typ,const char* t,const char* ex,const char* label=0);
335  ~FlowChart();
336 
337 private:
338  int id;
339  int stamp;
340  int type;
341 
342  int line;
343 
347 };
348 
349 #endif
static QCString name
Definition: declinfo.cpp:673
static void init()
Definition: vhdldocgen.cpp:570
static bool isSubType(const MemberDef *mdef)
static QCString getIndexWord(const char *, int index)
This class represents an function or template argument list.
Definition: arguments.h:82
uint64 spec
class/member specifiers
Definition: entry.h:243
static bool isConfig(const MemberDef *mdef)
static void writeFormatString(const QCString &, OutputList &ol, const MemberDef *)
static bool isNumber(const QCString &s)
static bool isVType(const MemberDef *mdef)
static void writeRecordProto(const MemberDef *mdef, OutputList &ol, const ArgumentList *al)
static QCString trVhdlType(uint64 type, bool sing=true)
static void deleteAllChars(QCString &s, char c)
static bool isConstraint(const MemberDef *mdef)
QCString label
Definition: vhdldocgen.h:344
static void writeVHDLDeclaration(MemberDef *mdef, OutputList &ol, ClassDef *cd, NamespaceDef *nd, FileDef *fd, GroupDef *gd, bool inGroup)
static bool isFile(const MemberDef *mdef)
static void writeProcessProto(OutputList &ol, const ArgumentList *al, const MemberDef *)
static bool isCompInst(const MemberDef *mdef)
Definition: entry.h:63
static void writeAlphbeticalClass(OutputList &ol, const ClassDef *cd, const QCString &)
static bool isLibrary(const MemberDef *mdef)
static QCString trFunctionAndProc()
static bool isSignals(const MemberDef *mdef)
static QCString parseForBinding(QCString &entity, QCString &arch)
static void formatString(const QCString &, OutputList &ol, const MemberDef *)
static void endDot(FTextStream &t)
Definition: vhdldocgen.cpp:270
static bool writeClassType(ClassDef *&, OutputList &ol, QCString &cname)
static bool isEntity(const MemberDef *mdef)
static QCString trDesignUnitList()
const bool FALSE
Definition: qglobal.h:370
static QCString convertArgumentListToString(const ArgumentList *al, bool f)
static QCString trDesignUnits()
static bool isComponent(const MemberDef *mdef)
QCString exp
Definition: vhdldocgen.h:346
static const MemberDef * getFlowMember()
Definition: vhdldocgen.cpp:95
static QCString className
Definition: declinfo.cpp:669
static QCString getClassName(const ClassDef *)
Definition: vhdldocgen.cpp:977
static bool compareArgList(ArgumentList *, ArgumentList *)
static QCString trDesignUnitIndex()
static QCString parseForConfig(QCString &entity, QCString &arch)
Simplified and optimized version of QTextStream.
Definition: ftextstream.h:11
static bool isMisc(const MemberDef *mdef)
static bool isPort(const MemberDef *mdef)
static ClassDef * getPackageName(const QCString &name)
Definition: vhdldocgen.cpp:705
static bool isAttribute(const MemberDef *mdef)
static bool isRecord(const MemberDef *mdef)
static QCString getRecordNumber()
static ClassDef * getClass(const char *name)
Definition: vhdldocgen.cpp:693
static bool isProcedure(const MemberDef *mdef)
static void resetCodeVhdlParserState()
Base class for the layout of a navigation item at the top of the HTML pages.
Definition: layout.h:118
static QCString trDesignUnitHierarchy()
static const MemberDef * flowMember
Definition: vhdldocgen.cpp:88
static bool isGeneric(const MemberDef *mdef)
This class contains the information about the argument of a function or template. ...
Definition: arguments.h:28
static void addBaseClass(ClassDef *cd, ClassDef *ent)
static void setFlowMember(const MemberDef *flowMember)
Definition: vhdldocgen.cpp:90
static bool isVhdlClass(const Entry *cu)
Definition: vhdldocgen.h:241
static int input(void)
Definition: code.cpp:15695
static void findAllArchitectures(QList< QCString > &ql, const ClassDef *cd)
def key(type, name=None)
Definition: graph.py:13
static bool isArchitecture(const MemberDef *mdef)
static void writeVhdlLink(const ClassDef *cdd, OutputList &ol, QCString &type, QCString &name, QCString &beh)
static void writeVhdlDeclarations(MemberList *, OutputList &, GroupDef *, ClassDef *, FileDef *, NamespaceDef *)
std::void_t< T > n
static QCString trDesignUnitMembers()
static bool writeVHDLTypeDocumentation(const MemberDef *mdef, const Definition *d, OutputList &ol)
static void writeOverview()
Definition: vhdldocgen.cpp:179
static void writeFunctionProto(OutputList &ol, const ArgumentList *al, const MemberDef *)
static void writeStringLink(const MemberDef *mdef, QCString mem, OutputList &ol)
static bool isPackage(const MemberDef *mdef)
static QCString convertFileNameToClassName(QCString name)
static bool isAlias(const MemberDef *mdef)
static bool isVhdlFunction(const MemberDef *mdef)
static QCString trDesignUnitListDescription()
static void parseUCF(const char *input, Entry *entity, QCString f, bool vendor)
static void prepareComment(QCString &)
static QCString * findKeyWord(const QCString &word)
Definition: vhdldocgen.cpp:667
virtual ~VhdlDocGen()
Definition: vhdldocgen.cpp:566
static void writeVHDLDeclarations(MemberList *ml, OutputList &ol, ClassDef *cd, NamespaceDef *nd, FileDef *fd, GroupDef *gd, const char *title, const char *subtitle, bool showEnumValues, int type)
static void startDot(FTextStream &t)
Definition: vhdldocgen.cpp:262
static void codify(const char *text)
Definition: pycode.cpp:1580
static QCString getClassTitle(const ClassDef *)
Definition: vhdldocgen.cpp:963
static QCString getProtectionName(int prot)
static ClassDef * findVhdlClass(const char *className)
static bool isConstant(const MemberDef *mdef)
static bool isSignal(const MemberDef *mdef)
static MemberDef * findMemberDef(ClassDef *cd, const QCString &key, MemberListType type)
Definition: vhdldocgen.cpp:815
static bool isProcess(const MemberDef *mdef)
static void writeTagFile(MemberDef *mdef, FTextStream &tagFile)
static void writeRecUnitDocu(const MemberDef *md, OutputList &ol, QCString largs)
static bool isSubClass(ClassDef *cd, ClassDef *scd, bool followInstances, int level)
static bool isGroup(const MemberDef *mdef)
static void writeInlineClassLink(const ClassDef *, OutputList &ol)
Definition: vhdldocgen.cpp:996
static bool deleteCharRev(QCString &s, char c)
static void writePlainVHDLDeclarations(MemberList *ml, OutputList &ol, ClassDef *cd, NamespaceDef *nd, FileDef *fd, GroupDef *gd, int specifier)
static bool isPackageBody(const MemberDef *mdef)
QCString doc
static bool findConstraintFile(LayoutNavEntry *lne)
static bool isUnit(const MemberDef *mdef)
static void createSVG()
Definition: vhdldocgen.cpp:163
QCString text
Definition: vhdldocgen.h:345
static MemberDef * findMember(const QCString &className, const QCString &memName)
Definition: vhdldocgen.cpp:717
static void computeVhdlComponentRelations()
static void findAllPackages(ClassDef *)
Definition: vhdldocgen.cpp:870
static ClassDef * findArchitecture(const ClassDef *cd)
MemberListType
Definition: types.h:104
static void parseFuncProto(const char *text, QList< Argument > &, QCString &name, QCString &ret, bool doc=false)
static QCString getProcessNumber()
static QList< FlowChart > flowList
Definition: vhdldocgen.h:332
static void writeSource(MemberDef *mdef, OutputList &ol, QCString &cname)
static bool isVariable(const MemberDef *mdef)
static void createFlowChart(const MemberDef *)
unsigned long long uint64
Definition: qglobal.h:361
static MemberDef * findFunction(const QList< Argument > &ql, const QCString &name, const QCString &package, bool type)
Definition: vhdldocgen.cpp:901
static void writeProcedureProto(OutputList &ol, const ArgumentList *al, const MemberDef *)
unsigned uint
Definition: qglobal.h:351
static QCString * s
Definition: config.cpp:1042
union ptb::content::word::word word
static QCString str
static bool writeFuncProcDocu(const MemberDef *mdef, OutputList &ol, const ArgumentList *al, bool type=false)
static void writeRecorUnit(QCString &largs, OutputList &ol, const MemberDef *mdef)
static QCString trTypeString(uint64 type)