00001 /****************************************************************************** 00002 * 00003 * $Id: vhdlscanner.h,v 1.9 2001/03/19 19:27:39 root Exp $ 00004 * 00005 * Copyright (C) 1997-2008 by Dimitri van Heesch. 00006 * 00007 * Permission to use, copy, modify, and distribute this software and its 00008 * documentation under the terms of the GNU General Public License is hereby 00009 * granted. No representations are made about the suitability of this software 00010 * for any purpose. It is provided "as is" without express or implied warranty. 00011 * See the GNU General Public License for more details. 00012 * 00013 * Documents produced by Doxygen are derivative works derived from the 00014 * input used in their production; they are not affected by this license. 00015 * 00016 */ 00017 00018 #ifndef VHDLDOCGEN_H 00019 #define VHDLDOCGEN_H 00020 00026 #include <qdict.h> 00027 #include <qcstring.h> 00028 00029 #include "memberlist.h" 00030 00031 class QStringList; 00032 class Entry; 00033 class ClassSDict; 00034 class FileStorage; 00035 class EntryNav; 00036 class ClassDef; 00037 class MemberDef; 00038 00039 class VhdlDocGen 00040 { 00041 public: 00042 00043 enum VhdlClasses // Overlays: Protection 00044 { 00045 ENTITYCLASS, // Overlays: Public 00046 PACKBODYCLASS, // Overlays: Protected 00047 ARCHITECTURECLASS, // Overlays: Private 00048 PACKAGECLASS // Overlays: Package 00049 }; 00050 enum VhdlKeyWords 00051 { 00052 LIBRARY=1, 00053 ENTITY, 00054 PACKAGE_BODY, 00055 ARCHITECTURE, 00056 PACKAGE, 00057 ATTRIBUTE, 00058 SIGNAL, 00059 COMPONENT, 00060 CONSTANT, 00061 TYPE, 00062 SUBTYPE, 00063 FUNCTION, 00064 RECORD, 00065 PROCEDURE, 00066 USE, 00067 PROCESS, 00068 PORT, 00069 DOCUMENT, //18 0x12 00070 UNITS, 00071 GENERIC, 00072 PORTMAP 00073 }; 00074 00075 VhdlDocGen(); 00076 virtual ~VhdlDocGen(); 00077 static void init(); 00078 00079 // --- used by vhdlscanner.l ----------- 00080 static Entry* getEntryAtLine(const Entry* e,int line); 00081 static QCString getIndexWord(const char* ,int index); 00082 static bool foundInsertedComponent(const QCString& name,Entry* root); 00083 static bool deleteCharRev(QCString &s,char c); 00084 static bool isFunctionProto(QCString& ss); 00085 static Entry* findFunction(Entry* func); 00086 static void deleteAllChars(QCString &s,char c); 00087 static bool getSigName(QList<QCString>& ql, 00088 const char* str, 00089 QCString& buffer); 00090 static bool getSigTypeName(QList<QCString>& ql, 00091 const char* str, 00092 QCString& buffer); 00093 static void parseFuncProto(const char* text, 00094 QList<Argument>& , 00095 QCString& name, 00096 QCString& ret, 00097 bool doc=false); 00098 // ----------------------------------- 00099 00100 static void debugClassName(ClassSDict*); 00101 //static void MergeFuncDoc(Entry* p,Entry* root); 00102 00103 static void computeVhdlComponentRelations(const QDict<EntryNav>&,FileStorage*); 00104 00105 //static void addVariableToComponents(EntryNav *rootNav,ClassDef *cd, MemberDef::MemberType mtype, const QCString &name, bool fromAnnScope,MemberDef *fromAnnMemb,Protection prot,bool related); 00106 00107 static QCString* findKeyWord(const QCString& word); 00108 static void addFuncDoc(EntryNav* root); 00109 00110 //static void MapArchitecturesToEntity(Entry* cur_root); 00111 00112 //static void MapComponentToEntity(const ClassSDict*); 00113 00114 static ClassDef* findComponent(int type); 00115 static ClassDef* getPackageName(const QCString& name); 00116 static MemberDef* findMember(const QCString& className, 00117 const QCString& memName); 00118 static void findAllPackages(const QCString& className, 00119 QDict<QCString>&); 00120 static MemberDef* findMemberDef(ClassDef* cd, 00121 const QCString& key, 00122 MemberList::ListType type); 00123 static ClassDef *getClass(const char *name); 00124 static Entry* findFunction(Entry* root,Entry* func); 00125 static MemberDef* findFunction(const QList<Argument> &ql, 00126 const QCString& name, 00127 const QCString& package, bool type); 00128 static bool compareString(const QCString& s1, 00129 const QCString& s2); 00130 static QCString getClassTitle(const ClassDef*); 00131 static void writeInlineClassLink(const ClassDef*, 00132 OutputList &ol); 00133 00134 //static void writeVhdlComponentList(OutputList &ol,int type); 00135 00136 static bool isLibrary(const MemberDef *mdef) 00137 { return mdef->getMemberSpecifiers()==VhdlDocGen::LIBRARY; } 00138 static bool isGeneric(const MemberDef *mdef) 00139 { return mdef->getMemberSpecifiers()==VhdlDocGen::GENERIC; } 00140 static bool isPort(const MemberDef *mdef) 00141 { return mdef->getMemberSpecifiers()==VhdlDocGen::PORT; } 00142 static bool isComponent(const MemberDef *mdef) 00143 { return mdef->getMemberSpecifiers()==VhdlDocGen::COMPONENT; } 00144 static bool isPackage(const MemberDef *mdef) 00145 { return mdef->getMemberSpecifiers()==VhdlDocGen::USE; } 00146 static bool isEntity(const MemberDef *mdef) 00147 { return mdef->getMemberSpecifiers()==VhdlDocGen::ENTITY; } 00148 static bool isConstant(const MemberDef *mdef) 00149 { return mdef->getMemberSpecifiers()==VhdlDocGen::CONSTANT; } 00150 static bool isVType(const MemberDef *mdef) 00151 { return mdef->getMemberSpecifiers()==VhdlDocGen::TYPE; } 00152 static bool isSubType(const MemberDef *mdef) 00153 { return mdef->getMemberSpecifiers()==VhdlDocGen::SUBTYPE; } 00154 static bool isVhdlFunction(const MemberDef *mdef) 00155 { return mdef->getMemberSpecifiers()==VhdlDocGen::FUNCTION; } 00156 static bool isProcess(const MemberDef *mdef) 00157 { return mdef->getMemberSpecifiers()==VhdlDocGen::PROCESS; } 00158 static bool isSignal(const MemberDef *mdef) 00159 { return mdef->getMemberSpecifiers()==VhdlDocGen::SIGNAL; } 00160 static bool isAttribute(const MemberDef *mdef) 00161 { return mdef->getMemberSpecifiers()==VhdlDocGen::ATTRIBUTE; } 00162 static bool isSignals(const MemberDef *mdef) 00163 { return mdef->getMemberSpecifiers()==VhdlDocGen::SIGNAL; } 00164 static bool isProcedure(const MemberDef *mdef) 00165 { return mdef->getMemberSpecifiers()==VhdlDocGen::PROCEDURE; } 00166 static bool isRecord(const MemberDef *mdef) 00167 { return mdef->getMemberSpecifiers()==VhdlDocGen::RECORD; } 00168 static bool isArchitecture(const MemberDef *mdef) 00169 { return mdef->getMemberSpecifiers()==VhdlDocGen::ARCHITECTURE; } 00170 static bool isUnit(const MemberDef *mdef) 00171 { return mdef->getMemberSpecifiers()==VhdlDocGen::UNITS; } 00172 static bool isPackageBody(const MemberDef *mdef) 00173 { return mdef->getMemberSpecifiers()==VhdlDocGen::PACKAGE_BODY; } 00174 00175 //----------------------------------------------------- 00176 // translatable items 00177 00178 static QCString trTypeString(int type); 00179 static QCString trVhdlType(int type,bool sing=true); 00180 00181 // trClassHierarchy. 00182 static QCString trDesignUnitHierarchy(); 00183 00184 // trCompoundList 00185 static QCString trDesignUnitList(); 00186 00187 // trCompoundMembers. 00188 static QCString trDesignUnitMembers(); 00189 00190 // trCompoundListDescription 00191 static QCString trDesignUnitListDescription(); 00192 00193 // trCompounds 00194 static QCString trDesignUnits(); 00195 00196 // trCompoundIndex 00197 static QCString trDesignUnitIndex(); 00198 00199 // trFunctions 00200 static QCString trFunctionAndProc(); 00201 00202 00203 //----------------------------------------------------- 00204 00205 static void prepareComment(QCString&); 00206 static QCString getpackname(const char* text, 00207 const char* word, 00208 const char* patter); 00209 static void parseProcessProto(const char* text, 00210 QCString&, 00211 QStringList&); 00212 static void formatString(QCString&,OutputList& ol,const MemberDef*); 00213 00214 static void writeFormatString(QCString&,OutputList& ol,const MemberDef*); 00215 static void writeFunctionProto(OutputList& ol,const ArgumentList *al,const MemberDef*); 00216 static void writeProcessProto(OutputList& ol,const ArgumentList *al,const MemberDef*); 00217 static void writeProcedureProto(OutputList& ol, const ArgumentList *al,const MemberDef*); 00218 static void writeFuncProcDocu(const MemberDef *mdef, OutputList& ol,const ArgumentList* al,bool type=false); 00219 static void writeRecordProto(const MemberDef *mdef, OutputList& ol,const ArgumentList *al); 00220 00221 static QCString convertArgumentListToString(const ArgumentList* al,bool f); 00222 static QCString getProcessNumber(); 00223 static QCString getRecordNumber(); 00224 00225 static void writeVHDLTypeDocumentation(const MemberDef* mdef, const Definition* d, OutputList &ol); 00226 00227 static void writeVhdlDeclarations(MemberList*,OutputList&,GroupDef*,ClassDef*); 00228 00229 static void writeVHDLDeclaration(MemberDef* mdef,OutputList &ol, 00230 ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, 00231 bool inGroup); 00232 00233 static void writePlainVHDLDeclarations(MemberList* ml,OutputList &ol, 00234 ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,int specifier); 00235 00236 static void writeVHDLDeclarations(MemberList* ml,OutputList &ol, 00237 ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, 00238 const char *title,const char *subtitle,bool showEnumValues,int type); 00239 00240 static QCString getClassName(const ClassDef*); 00241 static bool writeClassType(ClassDef *&,OutputList &ol ,QCString & cname); 00242 static void adjustRecordMember(MemberDef *mdef); 00243 static bool writeDoc(EntryNav* rootNav); 00244 00245 private: 00246 static void getFuncParams(QList<Argument>&, const char* str); 00247 static bool isNumber(const QCString& s); 00248 static void startFonts(const QCString& q, char *keyword,OutputList& ol); 00249 static bool compareArgList(ArgumentList*,ArgumentList*); 00250 static void writeVhdlLink(const ClassDef* cdd ,OutputList& ol,QCString& type,QCString& name,QCString& beh); 00251 static void findAllArchitectures(QList<QCString>& ql,const ClassDef *cd); 00252 static void writeLink(const MemberDef* mdef,OutputList &ol); 00253 static void writeStringLink(const MemberDef *mdef,QCString mem,OutputList& ol); 00254 }; 00255 00256 #endif