summaryrefslogtreecommitdiff
path: root/src/vhdldocgen.h
blob: bb62f3fc7829546f6c73be022b3e182e33939d5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
/******************************************************************************
 *
 * Copyright (C) 1997-2012 by Dimitri van Heesch.
 *
 * Permission to use, copy, modify, and distribute this software and its
 * documentation under the terms of the GNU General Public License is hereby 
 * granted. No representations are made about the suitability of this software 
 * for any purpose. It is provided "as is" without express or implied warranty.
 * See the GNU General Public License for more details.
 *
 * Documents produced by Doxygen are derivative works derived from the
 * input used in their production; they are not affected by this license.
 *
 */

#ifndef VHDLDOCGEN_H
#define VHDLDOCGEN_H

/** 
 * This class implements functions for parsing and generating 
 * vhdl documents
 */

#include <qdict.h>
#include <qcstring.h>
#include "layout.h"
#include "memberlist.h"

class Entry;
class ClassDef;
class MemberDef;
struct Argument;

/** Class for generating documentation specific for VHDL */
class VhdlDocGen  
{
  public:

    enum VhdlClasses       // Overlays: Protection
    {
      ENTITYCLASS,         // Overlays: Public
      PACKBODYCLASS,       // Overlays: Protected
      ARCHITECTURECLASS,   // Overlays: Private
      PACKAGECLASS         // Overlays: Package
    };

    enum VhdlKeyWords
    {
      LIBRARY=1,
      ENTITY,
      PACKAGE_BODY,
      ARCHITECTURE,
      PACKAGE,
      ATTRIBUTE,
      SIGNAL,
      COMPONENT,
      CONSTANT,
      TYPE,
      SUBTYPE,
      FUNCTION,
      RECORD,
      PROCEDURE,
      USE,
      PROCESS,
      PORT,
      UNITS,	  
      GENERIC,
      INSTANTIATION,
      GROUP,
      VFILE,   
      SHAREDVARIABLE,
      CONFIG,
      ALIAS,
      MISCELLANEOUS,
      UCF_CONST
    };

    VhdlDocGen();
    virtual ~VhdlDocGen();
    static void init();
    static QCString convertFileNameToClassName(QCString name);
    // --- used by vhdlscanner.l -----------
    
    static bool isSubClass(ClassDef* cd,ClassDef *scd, bool followInstances,int level);

    static QCString getIndexWord(const char* ,int index);
    static  bool    foundInsertedComponent(const QCString& name,Entry* root);
    static bool     deleteCharRev(QCString &s,char c);
    static void     deleteAllChars(QCString &s,char c);
    static void     parseFuncProto(const char* text,
                                   QList<Argument>& , 
                                   QCString& name,
                                   QCString& ret,
                                   bool doc=false);
    // -----------------------------------

    static void computeVhdlComponentRelations();

    static QCString* findKeyWord(const QCString& word);

    static ClassDef* getPackageName(const QCString& name);
    static MemberDef* findMember(const QCString& className, 
                                 const QCString& memName);
    static void findAllPackages(const QCString& className,
                                QDict<QCString>&);
    static MemberDef* findMemberDef(ClassDef* cd,
                                const QCString& key,
                                MemberList::ListType type);
    static ClassDef *getClass(const char *name);
    static MemberDef* findFunction(const QList<Argument> &ql,
                                   const QCString& name,
                                   const QCString& package, bool type);
    static bool compareString(const QCString& s1,
                              const QCString& s2);
    static QCString getClassTitle(const ClassDef*);
    static void writeInlineClassLink(const ClassDef*,
                                     OutputList &ol);

    static bool isConstraint(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::UCF_CONST; }   
    static bool isConfig(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::CONFIG; }
    static bool isAlias(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::ALIAS; }
    static bool isLibrary(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::LIBRARY; }
    static bool isGeneric(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::GENERIC; }
    static bool isPort(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::PORT; }
    static bool isComponent(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::COMPONENT; }
    static bool isPackage(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::USE; }
    static bool isEntity(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::ENTITY; }
    static bool isConstant(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::CONSTANT; }
    static bool isVType(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::TYPE; }
    static bool isSubType(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::SUBTYPE; }
    static bool isVhdlFunction(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::FUNCTION; }
    static bool isProcess(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::PROCESS; }
    static bool isSignal(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::SIGNAL; }
    static bool isAttribute(const MemberDef *mdef)
    { return mdef->getMemberSpecifiers()==VhdlDocGen::ATTRIBUTE; }
    static bool isSignals(const MemberDef *mdef)
    { return mdef->getMemberSpecifiers()==VhdlDocGen::SIGNAL; }
    static bool isProcedure(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::PROCEDURE; }
    static bool isRecord(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::RECORD; }
    static bool isArchitecture(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::ARCHITECTURE; }
    static bool isUnit(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::UNITS; }
    static bool isPackageBody(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::PACKAGE_BODY; }
    static bool isVariable(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::SHAREDVARIABLE; }
    static bool isFile(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::VFILE; }
    static bool isGroup(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::GROUP; }
    static bool isCompInst(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::INSTANTIATION; }
    static bool isMisc(const MemberDef *mdef) 
    { return mdef->getMemberSpecifiers()==VhdlDocGen::MISCELLANEOUS; }

    //-----------------------------------------------------
    // translatable items
    
    static QCString trTypeString(int type);
    static QCString trVhdlType(int type,bool sing=true);

    // trClassHierarchy.
    static QCString trDesignUnitHierarchy();

    // trCompoundList
    static QCString trDesignUnitList();

    // trCompoundMembers.
    static QCString trDesignUnitMembers();

    // trCompoundListDescription
    static QCString trDesignUnitListDescription();

    // trCompounds
    static QCString trDesignUnits();

    // trCompoundIndex
    static QCString trDesignUnitIndex();

    // trFunctions
    static QCString trFunctionAndProc();

    //-----------------------------------------------------

    static void prepareComment(QCString&);
    static void formatString(const QCString&,OutputList& ol,const MemberDef*);

    static void writeFormatString(const QCString&,OutputList& ol,const MemberDef*);
    static void writeFunctionProto(OutputList& ol,const ArgumentList *al,const MemberDef*);
    static void writeProcessProto(OutputList& ol,const ArgumentList *al,const MemberDef*);
    static void writeProcedureProto(OutputList& ol, const ArgumentList *al,const MemberDef*);
    static void writeFuncProcDocu(const MemberDef *mdef, OutputList& ol,const ArgumentList* al,bool type=false);
    static void writeRecordProto(const MemberDef *mdef, OutputList& ol,const ArgumentList *al);

    static void writeVHDLTypeDocumentation(const MemberDef* mdef, const Definition* d, OutputList &ol);

    static void writeVhdlDeclarations(MemberList*,OutputList&,GroupDef*,ClassDef*,FileDef*,NamespaceDef*);

    static void writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
        ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
        bool inGroup);

    static void writePlainVHDLDeclarations(MemberList* ml,OutputList &ol,
        ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,int specifier);

    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 bool writeClassType(ClassDef *&,OutputList &ol ,QCString & cname);
   

    static QCString convertArgumentListToString(const ArgumentList* al,bool f);
    static QCString getProcessNumber();
    static QCString getRecordNumber();
   
    static QCString getClassName(const ClassDef*);
    // obsolete
    // static void adjustRecordMember(MemberDef *mdef);

    static void writeLink(const MemberDef* mdef,OutputList &ol);
    static void adjustMemberName(QCString& nn);
    static bool membersHaveSpecificType(MemberList *ml,int type);
    static void startFonts(const QCString& q, const char *keyword,OutputList& ol);
    static bool isNumber(const QCString& s);
    static QCString getProtectionName(int prot);
    static QCString splitString(QCString & str,  char c);
    static void parseUCF(const char*  input,Entry* entity,QCString f,bool vendor);
	
    static bool findConstraintFile( LayoutNavEntry *lne);

    static ClassDef*  findArchitecture(const ClassDef *cd);
    static ClassDef*  findArchitecture(QCString identifier, QCString entity_name);

    static void writeCodeFragment( MemberDef *mdef,OutputList& ol);
    static void writeCodeFragment (OutputList& ol,int start, QCString & codeFragment,const MemberDef* mdef);

    static void writeSource(MemberDef *mdef,OutputList& ol,QCString & cname);
    static void writeAlphbeticalClass(OutputList& ol,const ClassDef* cd,const QCString &);

    static QCString  parseForConfig(QCString & entity,QCString & arch);
    static QCString  parseForBinding(QCString & entity,QCString & arch);
    static void addBaseClass(ClassDef* cd,ClassDef *ent);

    static void writeOverview(OutputList &ol);
    static void writeOverview();

  private:
    static void findAllArchitectures(QList<QCString>& ql,const ClassDef *cd);
    static bool compareArgList(ArgumentList*,ArgumentList*);
    static void writeVhdlLink(const ClassDef* cdd ,OutputList& ol,QCString& type,QCString& name,QCString& beh);
    static void writeStringLink(const MemberDef *mdef,QCString mem,OutputList& ol);
    static void writeRecUnitDocu( const MemberDef *md, OutputList& ol,QCString largs);
    static void  writeRecorUnit(QCString & largs,OutputList& ol ,const MemberDef *mdef);
};

#endif