summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/clangparser.cpp7
-rw-r--r--src/classdef.cpp2
-rw-r--r--src/code.l6
-rw-r--r--src/filedef.cpp2
-rw-r--r--src/fortrancode.l7
-rw-r--r--src/fortranscanner.l59
-rw-r--r--src/groupdef.cpp2
-rw-r--r--src/memberdef.cpp42
-rw-r--r--src/memberdef.h1
-rw-r--r--src/membergroup.cpp2
-rw-r--r--src/memberlist.cpp18
-rw-r--r--src/memberlist.h5
-rw-r--r--src/namespacedef.cpp2
-rw-r--r--src/pycode.l9
-rw-r--r--src/util.cpp58
-rw-r--r--src/util.h4
-rw-r--r--src/vhdlcode.l4
-rw-r--r--src/vhdldocgen.cpp127
-rw-r--r--src/vhdldocgen.h2
19 files changed, 160 insertions, 199 deletions
diff --git a/src/clangparser.cpp b/src/clangparser.cpp
index 76ee426..6f32576 100644
--- a/src/clangparser.cpp
+++ b/src/clangparser.cpp
@@ -25,7 +25,8 @@
//--------------------------------------------------------------------------
-std::mutex g_clangMutex;
+static std::mutex g_clangMutex;
+static std::mutex g_docCrossReferenceMutex;
ClangParser *ClangParser::instance()
{
@@ -133,7 +134,6 @@ class ClangTUParser::Private
CXToken *tokens = 0;
uint numTokens = 0;
StringVector filesInSameTU;
- TooltipManager tooltipManager;
// state while parsing sources
MemberDef *currentMemberDef=0;
@@ -573,7 +573,7 @@ void ClangTUParser::writeMultiLineCodeLink(CodeOutputInterface &ol,
const char *text)
{
static bool sourceTooltips = Config_getBool(SOURCE_TOOLTIPS);
- p->tooltipManager.addTooltip(ol,d);
+ TooltipManager::instance().addTooltip(ol,d);
QCString ref = d->getReference();
QCString file = d->getOutputFileBase();
QCString anchor = d->anchor();
@@ -696,6 +696,7 @@ void ClangTUParser::linkIdentifier(CodeOutputInterface &ol,FileDef *fd,
p->currentMemberDef && d->definitionType()==Definition::TypeMember &&
(p->currentMemberDef!=d || p->currentLine<line)) // avoid self-reference
{
+ std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
addDocCrossReference(toMemberDefMutable(p->currentMemberDef),toMemberDefMutable(d));
}
writeMultiLineCodeLink(ol,fd,line,column,d,text);
diff --git a/src/classdef.cpp b/src/classdef.cpp
index 572b550..98cfc86 100644
--- a/src/classdef.cpp
+++ b/src/classdef.cpp
@@ -1144,7 +1144,7 @@ void ClassDefImpl::computeAnchors()
{
if ((ml->listType()&MemberListType_detailedLists)==0)
{
- setAnchors(ml);
+ ml->setAnchors();
}
}
diff --git a/src/code.l b/src/code.l
index 1b6cf42..df4dd53 100644
--- a/src/code.l
+++ b/src/code.l
@@ -244,6 +244,8 @@ static void addVariable(yyscan_t yyscanner,QCString type,QCString name);
static std::mutex g_searchIndexMutex;
static std::mutex g_docCrossReferenceMutex;
+static std::mutex g_addExampleMutex;
+static std::mutex g_countFlowKeywordsMutex;
/* -----------------------------------------------------------------
*/
@@ -2447,6 +2449,7 @@ static void codifyLines(yyscan_t yyscanner,const char *text)
static void incrementFlowKeyWordCount(yyscan_t yyscanner)
{
+ std::lock_guard<std::mutex> lock(g_countFlowKeywordsMutex);
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
{
@@ -2733,6 +2736,7 @@ static bool getLinkInScope(yyscan_t yyscanner,
//printf("found it %s!\n",md->qualifiedName().data());
if (yyextra->exampleBlock)
{
+ std::lock_guard<std::mutex> lock(g_addExampleMutex);
QCString anchor;
anchor.sprintf("a%d",yyextra->anchorCount);
//printf("addExampleFile(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(),
@@ -2899,6 +2903,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
DBG_CTX((stderr,"is linkable class %s\n",clName));
if (yyextra->exampleBlock)
{
+ std::lock_guard<std::mutex> lock(g_addExampleMutex);
QCString anchor;
anchor.sprintf("_a%d",yyextra->anchorCount);
//printf("addExampleClass(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(),
@@ -2989,6 +2994,7 @@ static bool generateClassMemberLink(yyscan_t yyscanner,
if (yyextra->exampleBlock)
{
+ std::lock_guard<std::mutex> lock(g_addExampleMutex);
QCString anchor;
anchor.sprintf("a%d",yyextra->anchorCount);
//printf("addExampleFile(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(),
diff --git a/src/filedef.cpp b/src/filedef.cpp
index c2020e1..0fdcdd3 100644
--- a/src/filedef.cpp
+++ b/src/filedef.cpp
@@ -288,7 +288,7 @@ void FileDefImpl::setDiskName(const QCString &name)
void FileDefImpl::computeAnchors()
{
MemberList *ml = getMemberList(MemberListType_allMembersList);
- if (ml) setAnchors(ml);
+ if (ml) ml->setAnchors();
}
void FileDefImpl::distributeMemberGroupDocumentation()
diff --git a/src/fortrancode.l b/src/fortrancode.l
index a3795e4..1c1287d 100644
--- a/src/fortrancode.l
+++ b/src/fortrancode.l
@@ -213,6 +213,11 @@ static MemberDef *getFortranDefs(yyscan_t yyscanner,const QCString &memberName,
static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size);
+//-------------------------------------------------------------------
+
+static std::mutex g_docCrossReferenceMutex;
+static std::mutex g_countFlowKeywordsMutex;
+
/* -----------------------------------------------------------------*/
#undef YY_INPUT
#define YY_INPUT(buf,result,max_size) result=yyread(yyscanner,buf,max_size);
@@ -296,6 +301,7 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?")
}
if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
{
+ std::lock_guard<std::mutex> lock(g_countFlowKeywordsMutex);
MemberDefMutable *mdm = toMemberDefMutable(yyextra->currentMemberDef);
if (mdm)
{
@@ -1236,6 +1242,7 @@ static bool getLink(yyscan_t yyscanner,UseSDict *usedict, // dictionary with use
if (yyextra->currentDefinition && yyextra->currentMemberDef &&
md!=yyextra->currentMemberDef && yyextra->insideBody && yyextra->collectXRefs)
{
+ std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(md));
}
writeMultiLineCodeLink(yyscanner,ol,md,text ? text : memberText);
diff --git a/src/fortranscanner.l b/src/fortranscanner.l
index 6b581d2..99e1f9a 100644
--- a/src/fortranscanner.l
+++ b/src/fortranscanner.l
@@ -48,6 +48,8 @@
%{
+#include <map>
+
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
@@ -202,7 +204,7 @@ struct fortranscannerYY_state
//! Accumulated modifiers of current statement, eg variable declaration.
SymbolModifiers currentModifiers;
//! Holds program scope->symbol name->symbol modifiers.
- QMap<Entry*,QMap<QCString,SymbolModifiers> > modifiers;
+ std::map<Entry*,std::map<std::string,SymbolModifiers> > modifiers;
int anonCount = 0 ;
};
@@ -712,7 +714,7 @@ private {
}
{ID} {
QCString name = yytext;
- yyextra->modifiers[yyextra->current_root][name.lower()] |= yyextra->currentModifiers;
+ yyextra->modifiers[yyextra->current_root][name.lower().str()] |= yyextra->currentModifiers;
yyextra->current->section = Entry::FUNCTION_SEC;
yyextra->current->name = name;
yyextra->current->fileName = yyextra->fileName;
@@ -872,7 +874,7 @@ private {
QCString name=yytext;
name = name.lower();
/* remember attributes for the symbol */
- yyextra->modifiers[yyextra->current_root][name.lower()] |= yyextra->currentModifiers;
+ yyextra->modifiers[yyextra->current_root][name.lower().str()] |= yyextra->currentModifiers;
yyextra->argName= name;
yyextra->vtype= V_IGNORE;
@@ -913,12 +915,12 @@ private {
// save, it may be function return type
if (parameter)
{
- yyextra->modifiers[yyextra->current_root][name.lower()].type = yyextra->argType;
+ yyextra->modifiers[yyextra->current_root][name.lower().str()].type = yyextra->argType;
}
else
{
if ((yyextra->current_root->name.lower() == yyextra->argName.lower()) ||
- (yyextra->modifiers[yyextra->current_root->parent()][yyextra->current_root->name.lower()].returnName.lower() == yyextra->argName.lower()))
+ (yyextra->modifiers[yyextra->current_root->parent()][yyextra->current_root->name.lower().str()].returnName.lower() == yyextra->argName.lower()))
{
int strt = yyextra->current_root->type.find("function");
QCString lft;
@@ -956,11 +958,11 @@ private {
yyextra->current_root->type += " " + yyextra->argType.stripWhiteSpace();
}
yyextra->current_root->type = yyextra->current_root->type.stripWhiteSpace();
- yyextra->modifiers[yyextra->current_root][name.lower()].type = yyextra->current_root->type;
+ yyextra->modifiers[yyextra->current_root][name.lower().str()].type = yyextra->current_root->type;
}
else
{
- yyextra->modifiers[yyextra->current_root][name.lower()].type = yyextra->argType;
+ yyextra->modifiers[yyextra->current_root][name.lower().str()].type = yyextra->argType;
}
}
// any accumulated doc for argument should be emptied,
@@ -974,7 +976,7 @@ private {
QCString name(yyextra->argName);
QCString attr("dimension");
attr += yytext;
- yyextra->modifiers[yyextra->current_root][name.lower()] |= attr;
+ yyextra->modifiers[yyextra->current_root][name.lower().str()] |= attr;
}
<Variable>{COMMA} { //printf("COMMA: %d<=..<=%d\n", yyextra->colNr-(int)yyleng, yyextra->colNr);
// locate !< comment
@@ -1148,7 +1150,7 @@ private {
<Subprog>{BS} { /* ignore white space */ }
<Subprog>{ID} { yyextra->current->name = yytext;
//cout << "1a==========> got " << yyextra->current->type << " " << yytext << " " << yyextra->lineNr << endl;
- yyextra->modifiers[yyextra->current_root][yyextra->current->name.lower()].returnName = yyextra->current->name.lower();
+ yyextra->modifiers[yyextra->current_root][yyextra->current->name.lower().str()].returnName = yyextra->current->name.lower();
if (yyextra->ifType == IF_ABSTRACT || yyextra->ifType == IF_SPECIFIC)
{
@@ -1197,7 +1199,7 @@ private {
QCString result= yytext;
result= result.right(result.length()-result.find("(")-1);
result= result.stripWhiteSpace();
- yyextra->modifiers[yyextra->current_root->parent()][yyextra->current_root->name.lower()].returnName = result;
+ yyextra->modifiers[yyextra->current_root->parent()][yyextra->current_root->name.lower().str()].returnName = result;
}
//cout << "=====> got result " << result << endl;
}
@@ -2019,7 +2021,7 @@ static Argument *findArgument(Entry* subprog, QCString name, bool byTypeName = F
/*! Apply yyextra->modifiers stored in \a mdfs to the \a typeName string. */
-static QCString applyModifiers(QCString typeName, SymbolModifiers& mdfs)
+static QCString applyModifiers(QCString typeName, const SymbolModifiers& mdfs)
{
if (!mdfs.dimension.isNull())
{
@@ -2136,14 +2138,14 @@ static QCString applyModifiers(QCString typeName, SymbolModifiers& mdfs)
}
/*! Apply yyextra->modifiers stored in \a mdfs to the \a arg argument. */
-static void applyModifiers(Argument *arg, SymbolModifiers& mdfs)
+static void applyModifiers(Argument *arg, const SymbolModifiers& mdfs)
{
QCString tmp = arg->type;
arg->type = applyModifiers(tmp, mdfs);
}
/*! Apply yyextra->modifiers stored in \a mdfs to the \a ent entry. */
-static void applyModifiers(Entry *ent, SymbolModifiers& mdfs)
+static void applyModifiers(Entry *ent, const SymbolModifiers& mdfs)
{
QCString tmp = ent->type;
ent->type = applyModifiers(tmp, mdfs);
@@ -2164,8 +2166,7 @@ static void startScope(yyscan_t yyscanner,Entry *scope)
//cout<<"start scope: "<<scope->name<<endl;
yyextra->current_root= scope; /* start substructure */
- QMap<QCString,SymbolModifiers> mdfMap;
- yyextra->modifiers.insert(scope, mdfMap);
+ yyextra->modifiers.insert(std::make_pair(scope, std::map<std::string,SymbolModifiers>()));
}
/*! Ends scope in fortran program: may update subprogram arguments or module variable attributes.
@@ -2196,32 +2197,32 @@ static bool endScope(yyscan_t yyscanner,Entry *scope, bool isGlobalRoot)
}
// update variables or subprogram arguments with yyextra->modifiers
- QMap<QCString,SymbolModifiers>& mdfsMap = yyextra->modifiers[scope];
+ std::map<std::string,SymbolModifiers>& mdfsMap = yyextra->modifiers[scope];
if (scope->section == Entry::FUNCTION_SEC)
{
// iterate all symbol yyextra->modifiers of the scope
- for (QMap<QCString,SymbolModifiers>::Iterator it=mdfsMap.begin(); it!=mdfsMap.end(); it++)
+ for (const auto &kv : mdfsMap)
{
//cout<<it.key()<<": "<<it.data()<<endl;
- Argument *arg = findArgument(scope, it.key());
+ Argument *arg = findArgument(scope, kv.first);
if (arg)
{
- applyModifiers(arg, it.data());
+ applyModifiers(arg, kv.second);
}
}
// find return type for function
//cout<<"RETURN NAME "<<yyextra->modifiers[yyextra->current_root][scope->name.lower()].returnName<<endl;
- QCString returnName = yyextra->modifiers[yyextra->current_root][scope->name.lower()].returnName.lower();
- if (yyextra->modifiers[scope].contains(returnName))
+ QCString returnName = yyextra->modifiers[yyextra->current_root][scope->name.lower().str()].returnName.lower();
+ if (yyextra->modifiers[scope].find(returnName.str())!=yyextra->modifiers[scope].end())
{
- scope->type = yyextra->modifiers[scope][returnName].type; // returning type works
- applyModifiers(scope, yyextra->modifiers[scope][returnName]); // returning array works
+ scope->type = yyextra->modifiers[scope][returnName.str()].type; // returning type works
+ applyModifiers(scope, yyextra->modifiers[scope][returnName.str()]); // returning array works
}
- }
+ }
if (scope->section == Entry::CLASS_SEC)
{ // was INTERFACE_SEC
if (scope->parent()->section == Entry::FUNCTION_SEC)
@@ -2249,7 +2250,7 @@ static bool endScope(yyscan_t yyscanner,Entry *scope, bool isGlobalRoot)
if ((count == 1) && found)
{
// clear all yyextra->modifiers of the scope
- yyextra->modifiers.remove(scope);
+ yyextra->modifiers.erase(scope);
scope->parent()->removeSubEntry(scope);
scope = 0;
return TRUE;
@@ -2265,13 +2266,13 @@ static bool endScope(yyscan_t yyscanner,Entry *scope, bool isGlobalRoot)
continue;
//cout<<ce->name<<", "<<mdfsMap.contains(ce->name.lower())<<mdfsMap.count()<<endl;
- if (mdfsMap.contains(ce->name.lower()))
- applyModifiers(ce.get(), mdfsMap[ce->name.lower()]);
+ if (mdfsMap.find(ce->name.lower().str())!=mdfsMap.end())
+ applyModifiers(ce.get(), mdfsMap[ce->name.lower().str()]);
}
}
// clear all yyextra->modifiers of the scope
- yyextra->modifiers.remove(scope);
+ yyextra->modifiers.erase(scope);
return TRUE;
}
@@ -2522,7 +2523,7 @@ static void subrHandleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool b
loc_doc.stripWhiteSpace();
// direction as defined with the declaration of the parameter
- int dir1 = yyextra->modifiers[yyextra->current_root][yyextra->argName.lower()].direction;
+ int dir1 = yyextra->modifiers[yyextra->current_root][yyextra->argName.lower().str()].direction;
// in description [in] is specified
if (loc_doc.lower().find(directionParam[SymbolModifiers::IN]) == 0)
{
diff --git a/src/groupdef.cpp b/src/groupdef.cpp
index 2e01d64..bad8526 100644
--- a/src/groupdef.cpp
+++ b/src/groupdef.cpp
@@ -665,7 +665,7 @@ int GroupDefImpl::numDocMembers() const
void GroupDefImpl::computeAnchors()
{
//printf("GroupDefImpl::computeAnchors()\n");
- setAnchors(m_allMemberList);
+ m_allMemberList->setAnchors();
}
void GroupDefImpl::writeTagFile(FTextStream &tagFile)
diff --git a/src/memberdef.cpp b/src/memberdef.cpp
index 7fe95db..be57ad9 100644
--- a/src/memberdef.cpp
+++ b/src/memberdef.cpp
@@ -6099,6 +6099,48 @@ bool MemberDefImpl::isReference() const
(m_impl->templateMaster && m_impl->templateMaster->isReference());
}
+//-------------------------------------------------------------------------------
+// Helpers
+
+void addDocCrossReference(MemberDefMutable *src,MemberDefMutable *dst)
+{
+ if (src==0 || dst==0) return;
+ //printf("--> addDocCrossReference src=%s,dst=%s\n",src->name().data(),dst->name().data());
+ if (dst->isTypedef() || dst->isEnumerate()) return; // don't add types
+ if ((dst->hasReferencedByRelation() || dst->hasCallerGraph()) &&
+ src->showInCallGraph()
+ )
+ {
+ dst->addSourceReferencedBy(src);
+ MemberDefMutable *mdDef = toMemberDefMutable(dst->memberDefinition());
+ if (mdDef)
+ {
+ mdDef->addSourceReferencedBy(src);
+ }
+ MemberDefMutable *mdDecl = toMemberDefMutable(dst->memberDeclaration());
+ if (mdDecl)
+ {
+ mdDecl->addSourceReferencedBy(src);
+ }
+ }
+ if ((src->hasReferencesRelation() || src->hasCallGraph()) &&
+ src->showInCallGraph()
+ )
+ {
+ src->addSourceReferences(dst);
+ MemberDefMutable *mdDef = toMemberDefMutable(src->memberDefinition());
+ if (mdDef)
+ {
+ mdDef->addSourceReferences(dst);
+ }
+ MemberDefMutable *mdDecl = toMemberDefMutable(src->memberDeclaration());
+ if (mdDecl)
+ {
+ mdDecl->addSourceReferences(dst);
+ }
+ }
+}
+
// --- Cast functions
//
MemberDef *toMemberDef(Definition *d)
diff --git a/src/memberdef.h b/src/memberdef.h
index d2dd699..11d403c 100644
--- a/src/memberdef.h
+++ b/src/memberdef.h
@@ -448,5 +448,6 @@ MemberDefMutable *createMemberDef(const char *defFileName,int defLine,int defCol
MemberDef *createMemberDefAlias(const Definition *newScope,const MemberDef *aliasMd);
void combineDeclarationAndDefinition(MemberDefMutable *mdec,MemberDefMutable *mdef);
+void addDocCrossReference(MemberDefMutable *src,MemberDefMutable *dst);
#endif
diff --git a/src/membergroup.cpp b/src/membergroup.cpp
index d8d6193..bd3bf0c 100644
--- a/src/membergroup.cpp
+++ b/src/membergroup.cpp
@@ -86,7 +86,7 @@ void MemberGroup::insertMember(MemberDef *md)
void MemberGroup::setAnchors()
{
- ::setAnchors(memberList);
+ memberList->setAnchors();
}
void MemberGroup::writeDeclarations(OutputList &ol,
diff --git a/src/memberlist.cpp b/src/memberlist.cpp
index ed10bed..d8700d4 100644
--- a/src/memberlist.cpp
+++ b/src/memberlist.cpp
@@ -1143,6 +1143,24 @@ void MemberList::writeTagFile(FTextStream &tagFile)
}
}
+// compute the HTML anchors for a list of members
+void MemberList::setAnchors()
+{
+ //int count=0;
+ MemberListIterator mli(*this);
+ MemberDef *md;
+ for (;(md=mli.current());++mli)
+ {
+ MemberDefMutable *mdm = toMemberDefMutable(md);
+ if (mdm && !md->isReference())
+ {
+ mdm->setAnchor();
+ }
+ }
+}
+
+
+
//--------------------------------------------------------------------------
int MemberSDict::compareValues(const MemberDef *c1, const MemberDef *c2) const
diff --git a/src/memberlist.h b/src/memberlist.h
index 7ee8925..e62655b 100644
--- a/src/memberlist.h
+++ b/src/memberlist.h
@@ -1,8 +1,6 @@
/******************************************************************************
*
- *
- *
- * Copyright (C) 1997-2015 by Dimitri van Heesch.
+ * Copyright (C) 1997-2020 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
@@ -92,6 +90,7 @@ class MemberList : private QList<MemberDef>
void setNeedsSorting(bool b);
MemberGroupList *getMemberGroupList() const { return memberGroupList; }
void setAnonymousEnumType();
+ void setAnchors();
private:
int compareValues(const MemberDef *item1,const MemberDef *item2) const;
diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp
index cef836a..0c55573 100644
--- a/src/namespacedef.cpp
+++ b/src/namespacedef.cpp
@@ -559,7 +559,7 @@ void NamespaceDefImpl::insertMember(MemberDef *md)
void NamespaceDefImpl::computeAnchors()
{
MemberList *allMemberList = getMemberList(MemberListType_allMembersList);
- if (allMemberList) setAnchors(allMemberList);
+ if (allMemberList) allMemberList->setAnchors();
}
bool NamespaceDefImpl::hasDetailedDescription() const
diff --git a/src/pycode.l b/src/pycode.l
index 970ac91..b7f3b66 100644
--- a/src/pycode.l
+++ b/src/pycode.l
@@ -149,6 +149,8 @@ static void addVariable(yyscan_t yyscanner, QCString type, QCString name);
//-------------------------------------------------------------------
static std::mutex g_searchIndexMutex;
+static std::mutex g_docCrossReferenceMutex;
+static std::mutex g_countFlowKeywordsMutex;
//-------------------------------------------------------------------
@@ -487,6 +489,7 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBU
{FLOWKW} {
if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
{
+ std::lock_guard<std::mutex> lock(g_countFlowKeywordsMutex);
MemberDefMutable *mdm = toMemberDefMutable(yyextra->currentMemberDef);
if (mdm)
{
@@ -532,6 +535,7 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBU
{FLOWKW} {
if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
{
+ std::lock_guard<std::mutex> lock(g_countFlowKeywordsMutex);
MemberDefMutable *mdm = toMemberDefMutable(yyextra->currentMemberDef);
if (mdm)
{
@@ -1224,6 +1228,7 @@ static bool getLinkInScope(yyscan_t yyscanner,
if (yyextra->currentDefinition && yyextra->currentMemberDef &&
md!=yyextra->currentMemberDef && yyextra->collectXRefs)
{
+ std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(md));
}
//printf("d->getReference()='%s' d->getOutputBase()='%s' name='%s' member name='%s'\n",d->getReference().data(),d->getOutputFileBase().data(),d->name().data(),md->name().data());
@@ -1334,6 +1339,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
if (d && d->isLinkable() && md->isLinkable() &&
yyextra->currentMemberDef && yyextra->collectXRefs)
{
+ std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(md));
}
}
@@ -1361,6 +1367,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
if (d && d->isLinkable() && mmd->isLinkable() &&
yyextra->currentMemberDef && yyextra->collectXRefs)
{
+ std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(mmd));
}
return;
@@ -1384,6 +1391,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
if (d && d->isLinkable() && mmd->isLinkable() &&
yyextra->currentMemberDef && yyextra->collectXRefs)
{
+ std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(mmd));
}
return;
@@ -1470,6 +1478,7 @@ static bool findMemberLink(yyscan_t yyscanner,
{
if (yyextra->currentMemberDef && yyextra->collectXRefs)
{
+ std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(toMemberDef(sym)));
}
}
diff --git a/src/util.cpp b/src/util.cpp
index 0d94138..74e5226 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -1229,24 +1229,6 @@ QCString tempArgListToString(const ArgumentList &al,SrcLangExt lang,bool include
}
-// compute the HTML anchors for a list of members
-// TODO: make member of MemberList
-void setAnchors(MemberList *ml)
-{
- //int count=0;
- if (ml==0) return;
- MemberListIterator mli(*ml);
- MemberDef *md;
- for (;(md=mli.current());++mli)
- {
- MemberDefMutable *mdm = toMemberDefMutable(md);
- if (mdm && !md->isReference())
- {
- mdm->setAnchor();
- }
- }
-}
-
//----------------------------------------------------------------------------
/*! takes the \a buf of the given length \a len and converts CR LF (DOS)
@@ -6520,7 +6502,6 @@ QCString replaceColorMarkers(const char *str)
QCString s=str;
if (s.isEmpty()) return result;
static QRegExp re("##[0-9A-Fa-f][0-9A-Fa-f]");
- static const char hex[] = "0123456789ABCDEF";
static int hue = Config_getInt(HTML_COLORSTYLE_HUE);
static int sat = Config_getInt(HTML_COLORSTYLE_SAT);
static int gamma = Config_getInt(HTML_COLORSTYLE_GAMMA);
@@ -6862,45 +6843,6 @@ bool fileVisibleInIndex(const FileDef *fd,bool &genSourceFile)
);
}
-void addDocCrossReference(MemberDefMutable *src,MemberDefMutable *dst)
-{
- if (src==0 || dst==0) return;
- //printf("--> addDocCrossReference src=%s,dst=%s\n",src->name().data(),dst->name().data());
- if (dst->isTypedef() || dst->isEnumerate()) return; // don't add types
- if ((dst->hasReferencedByRelation() || dst->hasCallerGraph()) &&
- src->showInCallGraph()
- )
- {
- dst->addSourceReferencedBy(src);
- MemberDefMutable *mdDef = toMemberDefMutable(dst->memberDefinition());
- if (mdDef)
- {
- mdDef->addSourceReferencedBy(src);
- }
- MemberDefMutable *mdDecl = toMemberDefMutable(dst->memberDeclaration());
- if (mdDecl)
- {
- mdDecl->addSourceReferencedBy(src);
- }
- }
- if ((src->hasReferencesRelation() || src->hasCallGraph()) &&
- src->showInCallGraph()
- )
- {
- src->addSourceReferences(dst);
- MemberDefMutable *mdDef = toMemberDefMutable(src->memberDefinition());
- if (mdDef)
- {
- mdDef->addSourceReferences(dst);
- }
- MemberDefMutable *mdDecl = toMemberDefMutable(src->memberDeclaration());
- if (mdDecl)
- {
- mdDecl->addSourceReferences(dst);
- }
- }
-}
-
//--------------------------------------------------------------------------------------
/*! @brief Get one unicode character as an unsigned integer from utf-8 string
diff --git a/src/util.h b/src/util.h
index 19c30c8..2c088c4 100644
--- a/src/util.h
+++ b/src/util.h
@@ -137,8 +137,6 @@ void linkifyText(const TextGeneratorIntf &ol,
int indentLevel=0
);
-void setAnchors(MemberList *ml);
-
QCString fileToString(const char *name,bool filter=FALSE,bool isSourceCode=FALSE);
QCString dateToString(bool);
@@ -462,8 +460,6 @@ QCString getDotImageExtension();
bool fileVisibleInIndex(const FileDef *fd,bool &genSourceFile);
-void addDocCrossReference(MemberDefMutable *src,MemberDefMutable *dst);
-
uint getUtf8Code( const QCString& s, int idx );
uint getUtf8CodeToLower( const QCString& s, int idx );
uint getUtf8CodeToUpper( const QCString& s, int idx );
diff --git a/src/vhdlcode.l b/src/vhdlcode.l
index 480e2e2..efb367b 100644
--- a/src/vhdlcode.l
+++ b/src/vhdlcode.l
@@ -1532,10 +1532,10 @@ static void writeProcessProto(yyscan_t yyscanner)
static bool writeColoredWord(yyscan_t yyscanner,QCString& word )
{
QCString qcs=word.lower();
- QCString *ss=VhdlDocGen::findKeyWord(qcs);
+ const char *ss=VhdlDocGen::findKeyWord(qcs);
if (ss)
{
- writeFont(yyscanner,ss->data(),word.data());
+ writeFont(yyscanner,ss,word.data());
return true;
}
return false;
diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp
index d4af49e..93afb4b 100644
--- a/src/vhdldocgen.cpp
+++ b/src/vhdldocgen.cpp
@@ -64,11 +64,6 @@
//#define DEBUGFLOW
#define theTranslator_vhdlType theTranslator->trVhdlType
-static QDict<QCString> g_vhdlKeyDict0(17,FALSE);
-static QDict<QCString> g_vhdlKeyDict1(17,FALSE);
-static QDict<QCString> g_vhdlKeyDict2(17,FALSE);
-static QDict<QCString> g_vhdlKeyDict3(17,FALSE);
-
static void initUCF(Entry* root,const char* type,QCString & qcs,int line,QCString & fileName,QCString & brief);
static void writeUCFLink(const MemberDef* mdef,OutputList &ol);
static void addInstance(ClassDefMutable* entity, ClassDefMutable* arch, ClassDefMutable *inst,
@@ -562,11 +557,8 @@ VhdlDocGen::~VhdlDocGen()
{
}
-void VhdlDocGen::init()
-{
-
// vhdl keywords included VHDL 2008
-const char* g_vhdlKeyWordMap0[] =
+static const std::set< std::string > g_vhdlKeyWordSet0 =
{
"abs","access","after","alias","all","and","architecture","array","assert","assume","assume_guarantee","attribute",
"begin","block","body","buffer","bus",
@@ -587,100 +579,57 @@ const char* g_vhdlKeyWordMap0[] =
"unaffected","units","until","use",
"variable","vmode","vprop","vunit",
"wait","when","while","with",
- "xor","xnor",
- 0
+ "xor","xnor"
};
// type
-const char* g_vhdlKeyWordMap1[] =
+static const std::set< std::string> g_vhdlKeyWordSet1 =
{
"natural","unsigned","signed","string","boolean", "bit","bit_vector","character",
"std_ulogic","std_ulogic_vector","std_logic","std_logic_vector","integer",
- "real","float","ufixed","sfixed","time","positive",0
+ "real","float","ufixed","sfixed","time","positive"
};
// logic
-const char* g_vhdlKeyWordMap2[] =
+static const std::set< std::string > g_vhdlKeyWordSet2 =
{
- "abs","and","or","not","mod", "xor","rem","xnor","ror","rol","sla",
- "sll",0
+ "abs","and","or","not","mod","xor","rem","xnor","ror","rol","sla","sll"
};
// predefined attributes
-const char* g_vhdlKeyWordMap3[] =
+static const std::set< std::string > g_vhdlKeyWordSet3 =
{
-"base","left","right","high","low","ascending",
-"image","value","pos","val","succ","pred","leftof","rightof","left","right","high","low",
-"range","reverse_range","length","ascending","delayed","stable","quiet","transaction","event",
-"active","last_event","last_active","last_value","driving","driving_value","simple_name","instance_name","path_name",0
+ "base","left","right","high","low","ascending",
+ "image","value","pos","val","succ","pred","leftof","rightof","left","right","high","low",
+ "range","reverse_range","length","ascending","delayed","stable","quiet","transaction","event",
+ "active","last_event","last_active","last_value","driving","driving_value","simple_name","instance_name","path_name"
};
- int j=0;
- g_vhdlKeyDict0.setAutoDelete(TRUE);
- g_vhdlKeyDict1.setAutoDelete(TRUE);
- g_vhdlKeyDict2.setAutoDelete(TRUE);
- g_vhdlKeyDict3.setAutoDelete(TRUE);
-
- while (g_vhdlKeyWordMap0[j])
- {
- g_vhdlKeyDict0.insert(g_vhdlKeyWordMap0[j],
- new QCString(g_vhdlKeyWordMap0[j]));
- j++;
- }
-
- j=0;
- while (g_vhdlKeyWordMap1[j])
- {
- g_vhdlKeyDict1.insert(g_vhdlKeyWordMap1[j],
- new QCString(g_vhdlKeyWordMap1[j]));
- j++;
- }
-
- j=0;
- while (g_vhdlKeyWordMap2[j])
- {
- g_vhdlKeyDict2.insert(g_vhdlKeyWordMap2[j],
- new QCString(g_vhdlKeyWordMap2[j]));
- j++;
- }
-
- j=0;
- while (g_vhdlKeyWordMap3[j])
- {
- g_vhdlKeyDict3.insert(g_vhdlKeyWordMap3[j],
- new QCString(g_vhdlKeyWordMap3[j]));
- j++;
- }
-
-}// buildKeyMap
+void VhdlDocGen::init()
+{
+}
/*!
* returns the color of a keyword
*/
-
-QCString* VhdlDocGen::findKeyWord(const QCString& tmp)
+const char* VhdlDocGen::findKeyWord(const QCString& kw)
{
- static QCString vhdlkeyword("vhdlkeyword");
- static QCString vhdltype("keywordtype");
- static QCString vhdllogic("vhdllogic");
- static QCString preprocessor("keywordflow");
-
- QCString word=tmp.lower();
+ std::string word=kw.lower().str();
- if (word.isEmpty() || word.at(0)=='\0') return 0;
+ if (word.empty()) return 0;
- if (g_vhdlKeyDict0.find(word))
- return &preprocessor;
+ if (g_vhdlKeyWordSet0.find(word)!=g_vhdlKeyWordSet0.end())
+ return "keywordflow";
- if (g_vhdlKeyDict1.find(word))
- return &vhdltype;
+ if (g_vhdlKeyWordSet1.find(word)!=g_vhdlKeyWordSet1.end())
+ return "keywordtype";
- if (g_vhdlKeyDict2.find(word))
- return &vhdllogic;
+ if (g_vhdlKeyWordSet2.find(word)!=g_vhdlKeyWordSet2.end())
+ return "vhdllogic";
- if (g_vhdlKeyDict3.find(word))
- return &vhdlkeyword;
+ if (g_vhdlKeyWordSet3.find(word)!=g_vhdlKeyWordSet3.end())
+ return "vhdlkeyword";
return 0;
}
@@ -688,21 +637,12 @@ QCString* VhdlDocGen::findKeyWord(const QCString& tmp)
ClassDef *VhdlDocGen::getClass(const char *name)
{
if (name==0 || name[0]=='\0') return 0;
-
- ClassDef *cd=0;
- QCString temp(name);
- //temp=temp.lower();
- temp=temp.stripWhiteSpace();
- cd= Doxygen::classSDict->find(temp.data());
- return cd;
+ return Doxygen::classSDict->find(QCString(name).stripWhiteSpace());
}
ClassDef* VhdlDocGen::getPackageName(const QCString & name)
{
- ClassDef* cd=0;
- cd=getClass(name);
-
- return cd;
+ return getClass(name);
}
static QMap<QCString,MemberDef*> varMap;
@@ -1267,7 +1207,6 @@ void VhdlDocGen::writeFormatString(const QCString& s,OutputList&ol,const MemberD
QRegExp reg("[\\[\\]\\.\\/\\:\\<\\>\\:\\s\\,\\;\\'\\+\\-\\*\\|\\&\\=\\(\\)\"]");
QCString qcs = s;
qcs+=QCString(" ");// parsing the last sign
- QCString *ss;
QCString find=qcs;
QCString temp=qcs;
char buf[2];
@@ -1284,7 +1223,7 @@ void VhdlDocGen::writeFormatString(const QCString& s,OutputList&ol,const MemberD
{
find=find.left(j);
buf[0]=temp[j];
- ss=VhdlDocGen::findKeyWord(find);
+ const char *ss=VhdlDocGen::findKeyWord(find);
bool k=isNumber(find); // is this a number
if (k)
{
@@ -1294,7 +1233,7 @@ void VhdlDocGen::writeFormatString(const QCString& s,OutputList&ol,const MemberD
}
else if (j != 0 && ss)
{
- startFonts(find,ss->data(),ol);
+ startFonts(find,ss,ol);
}
else
{
@@ -1430,11 +1369,11 @@ void VhdlDocGen::writeProcedureProto(OutputList& ol,const ArgumentList &al,const
nn+=": ";
QCString defval = arg.defval;
- QCString *str=VhdlDocGen::findKeyWord(defval);
+ const char *str=VhdlDocGen::findKeyWord(defval);
defval+=" ";
if (str)
{
- startFonts(defval,str->data(),ol);
+ startFonts(defval,str,ol);
}
else
{
@@ -1495,7 +1434,7 @@ void VhdlDocGen::writeFunctionProto(OutputList& ol,const ArgumentList &al,const
}
if (!att.isEmpty())
{
- QCString *str=VhdlDocGen::findKeyWord(att);
+ const char *str=VhdlDocGen::findKeyWord(att);
att+=" ";
if (str)
VhdlDocGen::formatString(att,ol,mdef);
@@ -1509,7 +1448,7 @@ void VhdlDocGen::writeFunctionProto(OutputList& ol,const ArgumentList &al,const
QCString w=ss.stripWhiteSpace();//.upper();
startFonts(nn,"vhdlchar",ol);
startFonts("in ","stringliteral",ol);
- QCString *str=VhdlDocGen::findKeyWord(ss);
+ const char *str=VhdlDocGen::findKeyWord(ss);
if (str)
VhdlDocGen::formatString(w,ol,mdef);
else
diff --git a/src/vhdldocgen.h b/src/vhdldocgen.h
index ec25380..b98ea44 100644
--- a/src/vhdldocgen.h
+++ b/src/vhdldocgen.h
@@ -130,7 +130,7 @@ class VhdlDocGen
static void computeVhdlComponentRelations();
- static QCString* findKeyWord(const QCString& word);
+ static const char* findKeyWord(const QCString& word);
static ClassDef* getPackageName(const QCString& name);
static MemberDef* findMember(const QCString& className,