Blame src/vhdldocgen.h

Packit Service 50c9f2
/******************************************************************************
Packit Service 50c9f2
 *
Packit Service 50c9f2
 * Copyright (C) 1997-2015 by Dimitri van Heesch.
Packit Service 50c9f2
 *
Packit Service 50c9f2
 * Permission to use, copy, modify, and distribute this software and its
Packit Service 50c9f2
 * documentation under the terms of the GNU General Public License is hereby 
Packit Service 50c9f2
 * granted. No representations are made about the suitability of this software 
Packit Service 50c9f2
 * for any purpose. It is provided "as is" without express or implied warranty.
Packit Service 50c9f2
 * See the GNU General Public License for more details.
Packit Service 50c9f2
 *
Packit Service 50c9f2
 * Documents produced by Doxygen are derivative works derived from the
Packit Service 50c9f2
 * input used in their production; they are not affected by this license.
Packit Service 50c9f2
 *
Packit Service 50c9f2
 */
Packit Service 50c9f2
Packit Service 50c9f2
#ifndef VHDLDOCGEN_H
Packit Service 50c9f2
#define VHDLDOCGEN_H
Packit Service 50c9f2
Packit Service 50c9f2
/** 
Packit Service 50c9f2
 * This class implements functions for parsing and generating 
Packit Service 50c9f2
 * vhdl documents
Packit Service 50c9f2
 */
Packit Service 50c9f2
Packit Service 50c9f2
#include <qdict.h>
Packit Service 50c9f2
#include <qcstring.h>
Packit Service 50c9f2
#include "layout.h"
Packit Service 50c9f2
#include "arguments.h"
Packit Service 50c9f2
#include "entry.h"
Packit Service 50c9f2
Packit Service 50c9f2
class Entry;
Packit Service 50c9f2
class ClassDef;
Packit Service 50c9f2
class MemberList;
Packit Service 50c9f2
class MemberDef;
Packit Service 50c9f2
class FTextStream;
Packit Service 50c9f2
class OutputList;
Packit Service 50c9f2
class Definition;
Packit Service 50c9f2
class GroupDef;
Packit Service 50c9f2
class FileDef;
Packit Service 50c9f2
class NamespaceDef;
Packit Service 50c9f2
struct Argument;
Packit Service 50c9f2
Packit Service 50c9f2
/** Class for generating documentation specific for VHDL */
Packit Service 50c9f2
class VhdlDocGen  
Packit Service 50c9f2
{
Packit Service 50c9f2
  public:
Packit Service 50c9f2
Packit Service 50c9f2
    enum VhdlClasses       // Overlays: Protection
Packit Service 50c9f2
    {
Packit Service 50c9f2
      ENTITYCLASS,         // Overlays: Public
Packit Service 50c9f2
      PACKBODYCLASS,       // Overlays: Protected
Packit Service 50c9f2
      ARCHITECTURECLASS,   // Overlays: Private
Packit Service 50c9f2
      PACKAGECLASS         // Overlays: Package
Packit Service 50c9f2
    };
Packit Service 50c9f2
Packit Service 50c9f2
    enum VhdlKeyWords
Packit Service 50c9f2
    {
Packit Service 50c9f2
      LIBRARY=1,
Packit Service 50c9f2
      ENTITY,
Packit Service 50c9f2
      PACKAGE_BODY,
Packit Service 50c9f2
      ARCHITECTURE,
Packit Service 50c9f2
      PACKAGE,
Packit Service 50c9f2
      ATTRIBUTE,
Packit Service 50c9f2
      SIGNAL,
Packit Service 50c9f2
      COMPONENT,
Packit Service 50c9f2
      CONSTANT,
Packit Service 50c9f2
      TYPE,
Packit Service 50c9f2
      SUBTYPE,
Packit Service 50c9f2
      FUNCTION,
Packit Service 50c9f2
      RECORD,
Packit Service 50c9f2
      PROCEDURE,
Packit Service 50c9f2
      USE,
Packit Service 50c9f2
      PROCESS,
Packit Service 50c9f2
      PORT,
Packit Service 50c9f2
      UNITS,	  
Packit Service 50c9f2
      GENERIC,
Packit Service 50c9f2
      INSTANTIATION,
Packit Service 50c9f2
      GROUP,
Packit Service 50c9f2
      VFILE,   
Packit Service 50c9f2
      SHAREDVARIABLE,
Packit Service 50c9f2
      CONFIG,
Packit Service 50c9f2
      ALIAS,
Packit Service 50c9f2
      MISCELLANEOUS,
Packit Service 50c9f2
      UCF_CONST
Packit Service 50c9f2
    };
Packit Service 50c9f2
Packit Service 50c9f2
    VhdlDocGen();
Packit Service 50c9f2
    virtual ~VhdlDocGen();
Packit Service 50c9f2
    static void init();
Packit Service 50c9f2
    static QCString convertFileNameToClassName(QCString name);
Packit Service 50c9f2
    // --- used by vhdlscanner.l -----------
Packit Service 50c9f2
    
Packit Service 50c9f2
    static bool isSubClass(ClassDef* cd,ClassDef *scd, bool followInstances,int level);
Packit Service 50c9f2
Packit Service 50c9f2
    static QCString getIndexWord(const char* ,int index);
Packit Service 50c9f2
    static bool     deleteCharRev(QCString &s,char c);
Packit Service 50c9f2
    static void     deleteAllChars(QCString &s,char c);
Packit Service 50c9f2
    static void     parseFuncProto(const char* text,
Packit Service 50c9f2
                                   QList<Argument>& , 
Packit Service 50c9f2
                                   QCString& name,
Packit Service 50c9f2
                                   QCString& ret,
Packit Service 50c9f2
                                   bool doc=false);
Packit Service 50c9f2
    // -----------------------------------
Packit Service 50c9f2
Packit Service 50c9f2
    static void computeVhdlComponentRelations();
Packit Service 50c9f2
Packit Service 50c9f2
    static QCString* findKeyWord(const QCString& word);
Packit Service 50c9f2
Packit Service 50c9f2
    static ClassDef* getPackageName(const QCString& name);
Packit Service 50c9f2
    static MemberDef* findMember(const QCString& className, 
Packit Service 50c9f2
                                 const QCString& memName);
Packit Service 50c9f2
    static void findAllPackages(ClassDef*);
Packit Service 50c9f2
    static MemberDef* findMemberDef(ClassDef* cd,
Packit Service 50c9f2
                                const QCString& key,
Packit Service 50c9f2
                                MemberListType type);
Packit Service 50c9f2
    static ClassDef *getClass(const char *name);
Packit Service 50c9f2
    static MemberDef* findFunction(const QList<Argument> &ql,
Packit Service 50c9f2
                                   const QCString& name,
Packit Service 50c9f2
                                   const QCString& package, bool type);
Packit Service 50c9f2
    static QCString getClassTitle(const ClassDef*);
Packit Service 50c9f2
    static void writeInlineClassLink(const ClassDef*,
Packit Service 50c9f2
                                     OutputList &ol);
Packit Service 50c9f2
    static void writeTagFile(MemberDef *mdef,FTextStream &tagFile);
Packit Service 50c9f2
Packit Service 50c9f2
    static bool isConstraint(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isConfig(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isAlias(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isLibrary(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isGeneric(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isPort(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isComponent(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isPackage(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isEntity(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isConstant(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isVType(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isSubType(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isVhdlFunction(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isProcess(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isSignal(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isAttribute(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isSignals(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isProcedure(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isRecord(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isArchitecture(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isUnit(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isPackageBody(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isVariable(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isFile(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isGroup(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isCompInst(const MemberDef *mdef);
Packit Service 50c9f2
    static bool isMisc(const MemberDef *mdef);
Packit Service 50c9f2
Packit Service 50c9f2
    //-----------------------------------------------------
Packit Service 50c9f2
    // translatable items
Packit Service 50c9f2
    
Packit Service 50c9f2
    static QCString trTypeString(uint64 type);
Packit Service 50c9f2
    static QCString trVhdlType(uint64 type,bool sing=true);
Packit Service 50c9f2
Packit Service 50c9f2
    // trClassHierarchy.
Packit Service 50c9f2
    static QCString trDesignUnitHierarchy();
Packit Service 50c9f2
Packit Service 50c9f2
    // trCompoundList
Packit Service 50c9f2
    static QCString trDesignUnitList();
Packit Service 50c9f2
Packit Service 50c9f2
    // trCompoundMembers.
Packit Service 50c9f2
    static QCString trDesignUnitMembers();
Packit Service 50c9f2
Packit Service 50c9f2
    // trCompoundListDescription
Packit Service 50c9f2
    static QCString trDesignUnitListDescription();
Packit Service 50c9f2
Packit Service 50c9f2
    // trCompounds
Packit Service 50c9f2
    static QCString trDesignUnits();
Packit Service 50c9f2
Packit Service 50c9f2
    // trCompoundIndex
Packit Service 50c9f2
    static QCString trDesignUnitIndex();
Packit Service 50c9f2
Packit Service 50c9f2
    // trFunctions
Packit Service 50c9f2
    static QCString trFunctionAndProc();
Packit Service 50c9f2
Packit Service 50c9f2
    //-----------------------------------------------------
Packit Service 50c9f2
Packit Service 50c9f2
    static void prepareComment(QCString&);
Packit Service 50c9f2
    static void formatString(const QCString&,OutputList& ol,const MemberDef*);
Packit Service 50c9f2
Packit Service 50c9f2
    static void writeFormatString(const QCString&,OutputList& ol,const MemberDef*);
Packit Service 50c9f2
    static void writeFunctionProto(OutputList& ol,const ArgumentList *al,const MemberDef*);
Packit Service 50c9f2
    static void writeProcessProto(OutputList& ol,const ArgumentList *al,const MemberDef*);
Packit Service 50c9f2
    static void writeProcedureProto(OutputList& ol, const ArgumentList *al,const MemberDef*);
Packit Service 50c9f2
    static bool writeFuncProcDocu(const MemberDef *mdef, OutputList& ol,const ArgumentList* al,bool type=false);
Packit Service 50c9f2
    static void writeRecordProto(const MemberDef *mdef, OutputList& ol,const ArgumentList *al);
Packit Service 50c9f2
Packit Service 50c9f2
    static bool writeVHDLTypeDocumentation(const MemberDef* mdef, const Definition* d, OutputList &ol);
Packit Service 50c9f2
Packit Service 50c9f2
    static void writeVhdlDeclarations(MemberList*,OutputList&,GroupDef*,ClassDef*,FileDef*,NamespaceDef*);
Packit Service 50c9f2
Packit Service 50c9f2
    static void writeVHDLDeclaration(MemberDef* mdef,OutputList &ol,
Packit Service 50c9f2
        ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
Packit Service 50c9f2
        bool inGroup);
Packit Service 50c9f2
Packit Service 50c9f2
    static void writePlainVHDLDeclarations(MemberList* ml,OutputList &ol,
Packit Service 50c9f2
        ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,int specifier);
Packit Service 50c9f2
Packit Service 50c9f2
    static void writeVHDLDeclarations(MemberList* ml,OutputList &ol,
Packit Service 50c9f2
        ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
Packit Service 50c9f2
        const char *title,const char *subtitle,bool showEnumValues,int type);
Packit Service 50c9f2
Packit Service 50c9f2
    static bool writeClassType(ClassDef *&,OutputList &ol ,QCString & cname);
Packit Service 50c9f2
Packit Service 50c9f2
    static QCString convertArgumentListToString(const ArgumentList* al,bool f);
Packit Service 50c9f2
    static QCString getProcessNumber();
Packit Service 50c9f2
    static QCString getRecordNumber();
Packit Service 50c9f2
   
Packit Service 50c9f2
    static QCString getClassName(const ClassDef*);
Packit Service 50c9f2
    static bool isNumber(const QCString& s);
Packit Service 50c9f2
    static QCString getProtectionName(int prot);
Packit Service 50c9f2
Packit Service 50c9f2
    static void parseUCF(const char*  input,Entry* entity,QCString f,bool vendor);
Packit Service 50c9f2
    static bool findConstraintFile( LayoutNavEntry *lne);
Packit Service 50c9f2
Packit Service 50c9f2
    static ClassDef*  findArchitecture(const ClassDef *cd);
Packit Service 50c9f2
    static ClassDef*  findArchitecture(QCString identifier, QCString entity_name);
Packit Service 50c9f2
Packit Service 50c9f2
    
Packit Service 50c9f2
    static void writeSource(MemberDef *mdef,OutputList& ol,QCString & cname);
Packit Service 50c9f2
    static void writeAlphbeticalClass(OutputList& ol,const ClassDef* cd,const QCString &);
Packit Service 50c9f2
Packit Service 50c9f2
    static QCString  parseForConfig(QCString & entity,QCString & arch);
Packit Service 50c9f2
    static QCString  parseForBinding(QCString & entity,QCString & arch);
Packit Service 50c9f2
    static void addBaseClass(ClassDef* cd,ClassDef *ent);
Packit Service 50c9f2
    static ClassDef* findVhdlClass(const char *className );
Packit Service 50c9f2
Packit Service 50c9f2
    static void writeOverview(OutputList &ol);
Packit Service 50c9f2
    static void writeOverview();
Packit Service 50c9f2
 
Packit Service 50c9f2
 // flowcharts
Packit Service 50c9f2
    static void createFlowChart(const MemberDef*);
Packit Service 50c9f2
    //static void addFlowImage(const FTextStream &,const QCString &);
Packit Service 50c9f2
    
Packit Service 50c9f2
    static void setFlowMember( const MemberDef *flowMember);
Packit Service 50c9f2
    static const MemberDef *getFlowMember();
Packit Service 50c9f2
Packit Service 50c9f2
    static  bool isVhdlClass (const Entry *cu) 
Packit Service 50c9f2
    {
Packit Service 50c9f2
      return cu->spec==VhdlDocGen::ENTITY       ||
Packit Service 50c9f2
             cu->spec==VhdlDocGen::PACKAGE      ||
Packit Service 50c9f2
             cu->spec==VhdlDocGen::ARCHITECTURE ||
Packit Service 50c9f2
             cu->spec==VhdlDocGen::PACKAGE_BODY;
Packit Service 50c9f2
    }
Packit Service 50c9f2
Packit Service 50c9f2
  static void resetCodeVhdlParserState();
Packit Service 50c9f2
Packit Service 50c9f2
  private:
Packit Service 50c9f2
    static void findAllArchitectures(QList<QCString>& ql,const ClassDef *cd);
Packit Service 50c9f2
    static bool compareArgList(ArgumentList*,ArgumentList*);
Packit Service 50c9f2
    static void writeVhdlLink(const ClassDef* cdd ,OutputList& ol,QCString& type,QCString& name,QCString& beh);
Packit Service 50c9f2
    static void writeStringLink(const MemberDef *mdef,QCString mem,OutputList& ol);
Packit Service 50c9f2
    static void writeRecUnitDocu( const MemberDef *md, OutputList& ol,QCString largs);
Packit Service 50c9f2
    static void  writeRecorUnit(QCString & largs,OutputList& ol ,const MemberDef *mdef);
Packit Service 50c9f2
};
Packit Service 50c9f2
Packit Service 50c9f2
//-------------------------------------------------------------------------------------------------------------------
Packit Service 50c9f2
//-------------- VHDL Flowcharts -------------------------------------------------------------------------------
Packit Service 50c9f2
//-------------------------------------------------------------------------------------------------------------------
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
//#define DEBUGFLOW
Packit Service 50c9f2
Packit Service 50c9f2
class FlowChart
Packit Service 50c9f2
{
Packit Service 50c9f2
  public:
Packit Service 50c9f2
    enum nodeTypes {
Packit Service 50c9f2
      IF_NO        = 1<<1,
Packit Service 50c9f2
      ELSIF_NO     = 1<<2,
Packit Service 50c9f2
      ELSE_NO      = 1<<3,
Packit Service 50c9f2
      CASE_NO      = 1<<4,
Packit Service 50c9f2
      WHEN_NO      = 1<<5,
Packit Service 50c9f2
      EXIT_NO      = 1<<6,
Packit Service 50c9f2
      END_NO       = 1<<7,
Packit Service 50c9f2
      TEXT_NO      = 1<<8,
Packit Service 50c9f2
      START_NO     = 1<<9,
Packit Service 50c9f2
      ENDIF_NO     = 1<<10,
Packit Service 50c9f2
      FOR_NO       = 1<<11,
Packit Service 50c9f2
      WHILE_NO     = 1<<12,
Packit Service 50c9f2
      END_LOOP     = 1<<13,
Packit Service 50c9f2
      END_CASE     = 1<<14,
Packit Service 50c9f2
      VARIABLE_NO  = 1<<15,
Packit Service 50c9f2
      RETURN_NO    = 1<<16,
Packit Service 50c9f2
      LOOP_NO      = 1<<17,
Packit Service 50c9f2
      NEXT_NO      = 1<<18,
Packit Service 50c9f2
      EMPTY_NO     = 1<<19,
Packit Service 50c9f2
      COMMENT_NO   = 1<<20,
Packit Service 50c9f2
      BEGIN_NO     = 1<<21
Packit Service 50c9f2
    };
Packit Service 50c9f2
Packit Service 50c9f2
    //---------- create svg ------------------------------------------------------------- 
Packit Service 50c9f2
    static void createSVG();
Packit Service 50c9f2
    static void startDot(FTextStream &t);
Packit Service 50c9f2
    static void endDot(FTextStream &t);
Packit Service 50c9f2
    static void codify(FTextStream &t,const char *str);
Packit Service 50c9f2
    static void writeShape(FTextStream &t,const FlowChart* fl);
Packit Service 50c9f2
    static void writeEdge(FTextStream &t,int fl_from,int fl_to,int i,bool bFrom=FALSE,bool bTo=FALSE);
Packit Service 50c9f2
    static void writeEdge(FTextStream &t,const FlowChart* fl_from,const FlowChart* fl_to,int i);
Packit Service 50c9f2
    static void writeFlowLinks(FTextStream &t);
Packit Service 50c9f2
Packit Service 50c9f2
    static QCString getNodeName(int n);
Packit Service 50c9f2
    static void colTextNodes();
Packit Service 50c9f2
Packit Service 50c9f2
    static int getNextTextLink(const FlowChart* fl,uint index);
Packit Service 50c9f2
    static int getNextIfLink(const FlowChart*,uint);
Packit Service 50c9f2
    static int getNextNode(int,int);
Packit Service 50c9f2
    static int findNode(int index,int stamp,int type);
Packit Service 50c9f2
    static int findNode(int index,int type);
Packit Service 50c9f2
    static int findNextLoop(int j,int stamp);
Packit Service 50c9f2
    static int findPrevLoop(int j,int stamp,bool endif=FALSE);
Packit Service 50c9f2
    static int findLabel(int j,QCString &);
Packit Service 50c9f2
    static void delFlowList();
Packit Service 50c9f2
    static const char* getNodeType(int c);
Packit Service 50c9f2
Packit Service 50c9f2
    static void addFlowChart(int type,const char* text,const char* exp,const char * label=0);
Packit Service 50c9f2
    static void moveToPrevLevel();
Packit Service 50c9f2
    static int getTimeStamp();
Packit Service 50c9f2
    static void writeFlowChart();
Packit Service 50c9f2
    static void alignFuncProc(QCString & q,const ArgumentList*  al,bool isFunc);
Packit Service 50c9f2
    static QCString convertNameToFileName();
Packit Service 50c9f2
    static void printNode(const FlowChart* n);
Packit Service 50c9f2
    static void printFlowTree();
Packit Service 50c9f2
    static void buildCommentNodes(FTextStream &t);
Packit Service 50c9f2
    static void alignCommentNode(FTextStream &t,QCString com);
Packit Service 50c9f2
Packit Service 50c9f2
    static void  printUmlTree();
Packit Service 50c9f2
    static QCString printPlantUmlNode(const FlowChart *flo,bool,bool);
Packit Service 50c9f2
Packit Service 50c9f2
    static QList<FlowChart> flowList;
Packit Service 50c9f2
Packit Service 50c9f2
    FlowChart(int typ,const char*  t,const char* ex,const char* label=0);
Packit Service 50c9f2
    ~FlowChart();
Packit Service 50c9f2
Packit Service 50c9f2
private:
Packit Service 50c9f2
    int id;
Packit Service 50c9f2
    int stamp;
Packit Service 50c9f2
    int type;
Packit Service 50c9f2
Packit Service 50c9f2
    int line;
Packit Service 50c9f2
Packit Service 50c9f2
    QCString label;
Packit Service 50c9f2
    QCString text;
Packit Service 50c9f2
    QCString exp;
Packit Service 50c9f2
};
Packit Service 50c9f2
Packit Service 50c9f2
#endif