Orb/Doxygen/src/vhdldocgen.h
changeset 0 42188c7ea2d9
child 4 468f4c8d3d5b
equal deleted inserted replaced
-1:000000000000 0:42188c7ea2d9
       
     1 /******************************************************************************
       
     2  *
       
     3  * 
       
     4  *
       
     5  * Copyright (C) 1997-2008 by Dimitri van Heesch.
       
     6  *
       
     7  * Permission to use, copy, modify, and distribute this software and its
       
     8  * documentation under the terms of the GNU General Public License is hereby 
       
     9  * granted. No representations are made about the suitability of this software 
       
    10  * for any purpose. It is provided "as is" without express or implied warranty.
       
    11  * See the GNU General Public License for more details.
       
    12  *
       
    13  * Documents produced by Doxygen are derivative works derived from the
       
    14  * input used in their production; they are not affected by this license.
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef VHDLDOCGEN_H
       
    19 #define VHDLDOCGEN_H
       
    20 
       
    21 /** 
       
    22  * This class implements functions for parsing and generating 
       
    23  * vhdl documents
       
    24  */
       
    25 
       
    26 #include <qdict.h>
       
    27 #include <qcstring.h>
       
    28 
       
    29 #include "memberlist.h"
       
    30 
       
    31 class QStringList;
       
    32 class Entry;
       
    33 class ClassSDict;
       
    34 class FileStorage;
       
    35 class EntryNav;
       
    36 class ClassDef;
       
    37 class MemberDef;
       
    38 
       
    39 class VhdlDocGen  
       
    40 {
       
    41   public:
       
    42 
       
    43     enum VhdlClasses       // Overlays: Protection
       
    44     {
       
    45       ENTITYCLASS,         // Overlays: Public
       
    46       PACKBODYCLASS,       // Overlays: Protected
       
    47       ARCHITECTURECLASS,   // Overlays: Private
       
    48       PACKAGECLASS         // Overlays: Package
       
    49     };
       
    50     enum VhdlKeyWords
       
    51     {
       
    52       LIBRARY=1,
       
    53       ENTITY,
       
    54       PACKAGE_BODY,
       
    55       ARCHITECTURE,
       
    56       PACKAGE,
       
    57       ATTRIBUTE,
       
    58       SIGNAL,
       
    59       COMPONENT,
       
    60       CONSTANT,
       
    61       TYPE,
       
    62       SUBTYPE,
       
    63       FUNCTION,
       
    64       RECORD,
       
    65       PROCEDURE,
       
    66       USE,
       
    67       PROCESS,
       
    68       PORT,
       
    69       DOCUMENT, //18 0x12
       
    70       UNITS,	  
       
    71       GENERIC,
       
    72       PORTMAP, // obsolete
       
    73       COMPONENT_INST,
       
    74       GROUP,
       
    75       VFILE,   
       
    76       SHAREDVARIABLE,
       
    77       CONFIG,
       
    78       ALIAS
       
    79     };
       
    80 
       
    81     VhdlDocGen();
       
    82     virtual ~VhdlDocGen();
       
    83     static void init();
       
    84 
       
    85     // --- used by vhdlscanner.l -----------
       
    86     static QCString getIndexWord(const char* ,int index);
       
    87     static  bool    foundInsertedComponent(const QCString& name,Entry* root);
       
    88     static bool     deleteCharRev(QCString &s,char c);
       
    89     static bool     isFunctionProto(QCString& ss);
       
    90     static Entry*   findFunction(Entry* func);
       
    91     static void     deleteAllChars(QCString &s,char c);
       
    92     static bool     getSigName(QList<QCString>& ql, 
       
    93                                const char* str,
       
    94                                QCString& buffer);
       
    95     static bool     getSigTypeName(QList<QCString>& ql, 
       
    96                                    const char* str,
       
    97                                    QCString& buffer);
       
    98     static void     parseFuncProto(const char* text,
       
    99                                    QList<Argument>& , 
       
   100                                    QCString& name,
       
   101                                    QCString& ret,
       
   102                                    bool doc=false);
       
   103     // -----------------------------------
       
   104 
       
   105     static void debugClassName(ClassSDict*);
       
   106     //static void MergeFuncDoc(Entry* p,Entry* root);
       
   107 
       
   108     static void computeVhdlComponentRelations();
       
   109 
       
   110     //static void  addVariableToComponents(EntryNav *rootNav,ClassDef *cd, MemberDef::MemberType mtype, const QCString &name, bool fromAnnScope,MemberDef *fromAnnMemb,Protection prot,bool related);
       
   111 
       
   112     static QCString* findKeyWord(const QCString& word);
       
   113     static void addFuncDoc(EntryNav* root);
       
   114 
       
   115     //static void MapArchitecturesToEntity(Entry* cur_root);
       
   116 
       
   117     //static void MapComponentToEntity(const ClassSDict*);
       
   118 
       
   119     static ClassDef* findComponent(int type);
       
   120     static ClassDef* getPackageName(const QCString& name);
       
   121     static MemberDef* findMember(const QCString& className, 
       
   122                                  const QCString& memName);
       
   123     static void findAllPackages(const QCString& className,
       
   124                                 QDict<QCString>&);
       
   125     static MemberDef* findMemberDef(ClassDef* cd,
       
   126                                 const QCString& key,
       
   127                                 MemberList::ListType type);
       
   128     static ClassDef *getClass(const char *name);
       
   129     static Entry* findFunction(Entry* root,Entry* func);
       
   130     static MemberDef* findFunction(const QList<Argument> &ql,
       
   131                                    const QCString& name,
       
   132                                    const QCString& package, bool type);
       
   133     static bool compareString(const QCString& s1,
       
   134                               const QCString& s2);
       
   135     static QCString getClassTitle(const ClassDef*);
       
   136     static void writeInlineClassLink(const ClassDef*,
       
   137                                      OutputList &ol);
       
   138 
       
   139     //static void writeVhdlComponentList(OutputList &ol,int type);
       
   140 
       
   141     static bool isConfig(const MemberDef *mdef) 
       
   142     { return mdef->getMemberSpecifiers()==VhdlDocGen::CONFIG; }
       
   143     static bool isAlias(const MemberDef *mdef) 
       
   144     { return mdef->getMemberSpecifiers()==VhdlDocGen::ALIAS; }
       
   145     static bool isLibrary(const MemberDef *mdef) 
       
   146     { return mdef->getMemberSpecifiers()==VhdlDocGen::LIBRARY; }
       
   147     static bool isGeneric(const MemberDef *mdef) 
       
   148     { return mdef->getMemberSpecifiers()==VhdlDocGen::GENERIC; }
       
   149     static bool isPort(const MemberDef *mdef) 
       
   150     { return mdef->getMemberSpecifiers()==VhdlDocGen::PORT; }
       
   151     static bool isComponent(const MemberDef *mdef) 
       
   152     { return mdef->getMemberSpecifiers()==VhdlDocGen::COMPONENT; }
       
   153     static bool isPackage(const MemberDef *mdef) 
       
   154     { return mdef->getMemberSpecifiers()==VhdlDocGen::USE; }
       
   155     static bool isEntity(const MemberDef *mdef) 
       
   156     { return mdef->getMemberSpecifiers()==VhdlDocGen::ENTITY; }
       
   157     static bool isConstant(const MemberDef *mdef) 
       
   158     { return mdef->getMemberSpecifiers()==VhdlDocGen::CONSTANT; }
       
   159     static bool isVType(const MemberDef *mdef) 
       
   160     { return mdef->getMemberSpecifiers()==VhdlDocGen::TYPE; }
       
   161     static bool isSubType(const MemberDef *mdef) 
       
   162     { return mdef->getMemberSpecifiers()==VhdlDocGen::SUBTYPE; }
       
   163     static bool isVhdlFunction(const MemberDef *mdef) 
       
   164     { return mdef->getMemberSpecifiers()==VhdlDocGen::FUNCTION; }
       
   165     static bool isProcess(const MemberDef *mdef) 
       
   166     { return mdef->getMemberSpecifiers()==VhdlDocGen::PROCESS; }
       
   167     static bool isSignal(const MemberDef *mdef) 
       
   168     { return mdef->getMemberSpecifiers()==VhdlDocGen::SIGNAL; }
       
   169     static bool isAttribute(const MemberDef *mdef)
       
   170     { return mdef->getMemberSpecifiers()==VhdlDocGen::ATTRIBUTE; }
       
   171     static bool isSignals(const MemberDef *mdef)
       
   172     { return mdef->getMemberSpecifiers()==VhdlDocGen::SIGNAL; }
       
   173     static bool isProcedure(const MemberDef *mdef) 
       
   174     { return mdef->getMemberSpecifiers()==VhdlDocGen::PROCEDURE; }
       
   175     static bool isRecord(const MemberDef *mdef) 
       
   176     { return mdef->getMemberSpecifiers()==VhdlDocGen::RECORD; }
       
   177     static bool isArchitecture(const MemberDef *mdef) 
       
   178     { return mdef->getMemberSpecifiers()==VhdlDocGen::ARCHITECTURE; }
       
   179     static bool isUnit(const MemberDef *mdef) 
       
   180     { return mdef->getMemberSpecifiers()==VhdlDocGen::UNITS; }
       
   181     static bool isPackageBody(const MemberDef *mdef) 
       
   182     { return mdef->getMemberSpecifiers()==VhdlDocGen::PACKAGE_BODY; }
       
   183     static bool isVariable(const MemberDef *mdef) 
       
   184     { return mdef->getMemberSpecifiers()==VhdlDocGen::SHAREDVARIABLE; }
       
   185     static bool isFile(const MemberDef *mdef) 
       
   186     { return mdef->getMemberSpecifiers()==VhdlDocGen::VFILE; }
       
   187     static bool isGroup(const MemberDef *mdef) 
       
   188     { return mdef->getMemberSpecifiers()==VhdlDocGen::GROUP; }
       
   189     static bool isCompInst(const MemberDef *mdef) 
       
   190     { return mdef->getMemberSpecifiers()==VhdlDocGen::COMPONENT_INST; }
       
   191 
       
   192     //-----------------------------------------------------
       
   193     // translatable items
       
   194     
       
   195     static QCString trTypeString(int type);
       
   196     static QCString trVhdlType(int type,bool sing=true);
       
   197 
       
   198     // trClassHierarchy.
       
   199     static QCString trDesignUnitHierarchy();
       
   200 
       
   201     // trCompoundList
       
   202     static QCString trDesignUnitList();
       
   203 
       
   204     // trCompoundMembers.
       
   205     static QCString trDesignUnitMembers();
       
   206 
       
   207     // trCompoundListDescription
       
   208     static QCString trDesignUnitListDescription();
       
   209 
       
   210     // trCompounds
       
   211     static QCString trDesignUnits();
       
   212 
       
   213     // trCompoundIndex
       
   214     static QCString trDesignUnitIndex();
       
   215 
       
   216     // trFunctions
       
   217     static QCString trFunctionAndProc();
       
   218 
       
   219 
       
   220     //-----------------------------------------------------
       
   221 
       
   222     static void prepareComment(QCString&);
       
   223     static QCString getpackname(const char* text,
       
   224                                 const char* word,
       
   225                                 const char* patter);
       
   226     static void parseProcessProto(const char* text,
       
   227                                   QCString&,
       
   228                                   QStringList&);
       
   229     static void formatString(QCString&,OutputList& ol,const MemberDef*);
       
   230 
       
   231     static void writeFormatString(QCString&,OutputList& ol,const MemberDef*);
       
   232     static void writeFunctionProto(OutputList& ol,const ArgumentList *al,const MemberDef*);
       
   233     static void writeProcessProto(OutputList& ol,const ArgumentList *al,const MemberDef*);
       
   234     static void writeProcedureProto(OutputList& ol, const ArgumentList *al,const MemberDef*);
       
   235     static void writeFuncProcDocu(const MemberDef *mdef, OutputList& ol,const ArgumentList* al,bool type=false);
       
   236     static void writeRecordProto(const MemberDef *mdef, OutputList& ol,const ArgumentList *al);
       
   237 
       
   238     static QCString convertArgumentListToString(const ArgumentList* al,bool f);
       
   239     static QCString getProcessNumber();
       
   240     static QCString getRecordNumber();
       
   241 
       
   242     static void writeVHDLTypeDocumentation(const MemberDef* mdef, const Definition* d, OutputList &ol);
       
   243 
       
   244     static void writeVhdlDeclarations(MemberList*,OutputList&,GroupDef*,ClassDef*,FileDef*);
       
   245 
       
   246     static void writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
       
   247         ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
       
   248         bool inGroup);
       
   249 
       
   250     static void writePlainVHDLDeclarations(MemberList* ml,OutputList &ol,
       
   251         ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,int specifier);
       
   252 
       
   253     static void writeVHDLDeclarations(MemberList* ml,OutputList &ol,
       
   254         ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
       
   255         const char *title,const char *subtitle,bool showEnumValues,int type);
       
   256 
       
   257     static QCString getClassName(const ClassDef*);
       
   258     static bool writeClassType(ClassDef *&,OutputList &ol ,QCString & cname);
       
   259     static void adjustRecordMember(MemberDef *mdef);
       
   260     static bool writeDoc(EntryNav* rootNav);
       
   261 
       
   262     static void writeLink(const MemberDef* mdef,OutputList &ol);
       
   263     static void adjustMemberName(QCString& nn);
       
   264     static bool membersHaveSpecificType(MemberList *ml,int type);
       
   265     static void startFonts(const QCString& q, const char *keyword,OutputList& ol);
       
   266     static bool isNumber(const QCString& s);
       
   267 
       
   268   private:
       
   269     static void getFuncParams(QList<Argument>&, const char* str);
       
   270     static bool compareArgList(ArgumentList*,ArgumentList*);
       
   271     static void writeVhdlLink(const ClassDef* cdd ,OutputList& ol,QCString& type,QCString& name,QCString& beh);
       
   272     static void findAllArchitectures(QList<QCString>& ql,const ClassDef *cd);
       
   273     static void writeStringLink(const MemberDef *mdef,QCString mem,OutputList& ol);
       
   274 };
       
   275 
       
   276 #endif