diff options
Diffstat (limited to 'src')
110 files changed, 2505 insertions, 6647 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 23460d0..0a7a3ef 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -107,7 +107,6 @@ set(LEX_FILES scanner fortranscanner fortrancode vhdlcode - tclscanner pre declinfo defargs @@ -148,13 +147,6 @@ add_library(doxycfg STATIC ) add_library(_doxygen STATIC - # custom generated files - ${GENERATED_SRC}/lang_cfg.h - ${GENERATED_SRC}/settings.h - ${GENERATED_SRC}/layout_default.xml.h - ${GENERATED_SRC}/ce_parse.h - ${GENERATED_SRC}/configvalues.h - ${GENERATED_SRC}/resources.cpp # generated for/by flex/bison #${LEX_FILES_H} #unfortunately doesn't work in older versions of CMake (like 3.6.2) #${LEX_FILES_CPP} #unfortunately doesn't work in older versions of CMake (like 3.6.2) @@ -173,7 +165,6 @@ add_library(_doxygen STATIC ${GENERATED_SRC}/pyscanner.l.h ${GENERATED_SRC}/scanner.l.h ${GENERATED_SRC}/sqlcode.l.h - ${GENERATED_SRC}/tclscanner.l.h ${GENERATED_SRC}/vhdlcode.l.h ${GENERATED_SRC}/xmlcode.l.h ${GENERATED_SRC}/code.cpp @@ -191,11 +182,17 @@ add_library(_doxygen STATIC ${GENERATED_SRC}/pyscanner.cpp ${GENERATED_SRC}/scanner.cpp ${GENERATED_SRC}/sqlcode.cpp - ${GENERATED_SRC}/tclscanner.cpp ${GENERATED_SRC}/vhdlcode.cpp ${GENERATED_SRC}/xmlcode.cpp # ${GENERATED_SRC}/ce_parse.cpp + # custom generated files + ${GENERATED_SRC}/lang_cfg.h + ${GENERATED_SRC}/settings.h + ${GENERATED_SRC}/layout_default.xml.h + ${GENERATED_SRC}/ce_parse.h + ${GENERATED_SRC}/configvalues.h + ${GENERATED_SRC}/resources.cpp # arguments.cpp cite.cpp @@ -262,7 +259,6 @@ add_library(_doxygen STATIC message.cpp msc.cpp namespacedef.cpp - objcache.cpp outputgen.cpp outputlist.cpp pagedef.cpp @@ -330,5 +326,8 @@ target_link_libraries(doxygen ${EXTRA_LIBS} ${CLANG_LIBS} ) +set_project_warnings(doxycfg) +set_project_warnings(_doxygen) +set_project_warnings(doxygen) install(TARGETS doxygen DESTINATION bin) diff --git a/src/bufstr.h b/src/bufstr.h index 331def2..e64a049 100644 --- a/src/bufstr.h +++ b/src/bufstr.h @@ -30,7 +30,7 @@ class BufStr { public: - BufStr(int size) + BufStr(uint size) : m_size(size), m_writeOffset(0), m_spareRoom(10240), m_buf(0) { m_buf = (char *)calloc(size,1); @@ -44,7 +44,7 @@ class BufStr makeRoomFor(1); m_buf[m_writeOffset++]=c; } - void addArray(const char *a,int len) + void addArray(const char *a,uint len) { makeRoomFor(len); memcpy(m_buf+m_writeOffset,a,len); @@ -74,7 +74,7 @@ class BufStr memset(m_buf+oldsize,0,m_size-oldsize); } } - int size() const + uint size() const { return m_size; } @@ -115,7 +115,7 @@ class BufStr } uint m_size; uint m_writeOffset; - const int m_spareRoom; // 10Kb extra room to avoid frequent resizing + const uint m_spareRoom; // 10Kb extra room to avoid frequent resizing char *m_buf; }; diff --git a/src/cite.cpp b/src/cite.cpp index 612ddc1..dac2bcd 100644 --- a/src/cite.cpp +++ b/src/cite.cpp @@ -94,7 +94,7 @@ void CitationManager::clear() bool CitationManager::isEmpty() const { - int numFiles = Config_getList(CITE_BIB_FILES).count(); + uint numFiles = Config_getList(CITE_BIB_FILES).count(); return (numFiles==0 || p->entries.empty()); } @@ -135,15 +135,15 @@ void CitationManager::generatePage() err("could not open file %s for reading\n",bibFile.data()); } QCString doc; - QFileInfo fi(bibFile); QCString input(fi.size()+1); f.readBlock(input.rawData(),fi.size()); f.close(); input.at(fi.size())='\0'; - int pos=0,s; + int pos=0; + int s; while ((s=input.find('\n',pos))!=-1) { - QCString line = input.mid(pos,s-pos); + QCString line = input.mid((uint)pos,(uint)(s-pos)); pos=s+1; int i; @@ -153,7 +153,7 @@ void CitationManager::generatePage() int k=line.find("}",i); if (j!=-1 && k!=-1) { - QCString label = line.mid(j+1,k-j-1); + QCString label = line.mid((uint)(j+1),(uint)(k-j-1)); if (p->entries.find(label.data())==p->entries.end()) // not found yet { insert(label); @@ -246,25 +246,25 @@ void CitationManager::generatePage() { err("could not open file %s for reading\n",citeListFile.data()); } - bool insideBib=FALSE; - + QCString doc; QFileInfo fi(citeListFile); QCString input(fi.size()+1); f.readBlock(input.rawData(),fi.size()); f.close(); input.at(fi.size())='\0'; + + bool insideBib=FALSE; int pos=0,s; //printf("input=[%s]\n",input.data()); while ((s=input.find('\n',pos))!=-1) { - QCString line = input.mid(pos,s-pos); + QCString line = input.mid((uint)pos,(uint)(s-pos)); //printf("pos=%d s=%d line=[%s]\n",pos,s,line.data()); pos=s+1; if (line.find("<!-- BEGIN BIBLIOGRAPHY")!=-1) insideBib=TRUE; else if (line.find("<!-- END BIBLIOGRAPH")!=-1) insideBib=FALSE; - int i; // determine text to use at the location of the @cite command if (insideBib && (i=line.find("name=\"CITEREF_"))!=-1) { @@ -272,10 +272,13 @@ void CitationManager::generatePage() int k=line.find("]</a>"); if (j!=-1 && k!=-1) { - QCString label = line.mid(i+14,j-i-14); - QCString number = line.mid(j+2,k-j-1); + uint ui=(uint)i; + uint uj=(uint)j; + uint uk=(uint)k; + QCString label = line.mid(ui+14,uj-ui-14); + QCString number = line.mid(uj+2,uk-uj-1); label = substitute(substitute(label,"–","--"),"—","---"); - line = line.left(i+14) + label + line.right(line.length()-j); + line = line.left(ui+14) + label + line.right(line.length()-uj); auto it = p->entries.find(label.data()); //printf("label='%s' number='%s' => %p\n",label.data(),number.data(),it->second.get()); if (it!=p->entries.end()) @@ -296,15 +299,14 @@ void CitationManager::generatePage() if (Config_getBool(GENERATE_LATEX)) { // copy bib files to the latex output dir - const QStrList &citeDataList = Config_getList(CITE_BIB_FILES); QCString latexOutputDir = Config_getString(LATEX_OUTPUT)+"/"; - int i = 0; + i = 0; for (li.toFirst() ; (bibdata = li.current()) ; ++li) { QCString bibFile = bibdata; // Note: file can now have multiple dots if (!bibFile.isEmpty() && bibFile.right(4)!=".bib") bibFile+=".bib"; - QFileInfo fi(bibFile); + fi.setFile(bibFile); if (fi.exists()) { if (!bibFile.isEmpty()) diff --git a/src/classdef.cpp b/src/classdef.cpp index 2124817..95f01c1 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -106,7 +106,7 @@ class ClassDefImpl : public DefinitionImpl, public ClassDef virtual Definition *findInnerCompound(const char *name) const; virtual std::vector<ArgumentList> getTemplateParameterLists() const; virtual QCString qualifiedNameWithTemplateParameters( - const std::vector<ArgumentList> *actualParams=0,int *actualParamIndex=0) const; + const std::vector<ArgumentList> *actualParams=0,uint *actualParamIndex=0) const; virtual bool isAbstract() const; virtual bool isObjectiveC() const; virtual bool isFortran() const; @@ -368,7 +368,7 @@ class ClassDefAliasImpl : public DefinitionAliasImpl, public ClassDef virtual std::vector<ArgumentList> getTemplateParameterLists() const { return getCdAlias()->getTemplateParameterLists(); } virtual QCString qualifiedNameWithTemplateParameters( - const std::vector<ArgumentList> *actualParams=0,int *actualParamIndex=0) const + const std::vector<ArgumentList> *actualParams=0,uint *actualParamIndex=0) const { return getCdAlias()->qualifiedNameWithTemplateParameters(actualParams,actualParamIndex); } virtual bool isAbstract() const { return getCdAlias()->isAbstract(); } @@ -448,37 +448,37 @@ class ClassDefAliasImpl : public DefinitionAliasImpl, public ClassDef const QCString &templSpec,bool &freshInstance) const { return getCdAlias()->insertTemplateInstance(fileName,startLine,startColumn,templSpec,freshInstance); } - virtual void insertBaseClass(ClassDef *,const char *name,Protection p,Specifier s,const char *t=0) { } - virtual void insertSubClass(ClassDef *,Protection p,Specifier s,const char *t=0) { } - virtual void setIncludeFile(FileDef *fd,const char *incName,bool local,bool force) {} + virtual void insertBaseClass(ClassDef *,const char *,Protection,Specifier,const char *) { } + virtual void insertSubClass(ClassDef *,Protection,Specifier,const char *) { } + virtual void setIncludeFile(FileDef *,const char *,bool,bool) {} virtual void insertMember(MemberDef *) {} virtual void insertUsedFile(FileDef *) {} - virtual bool addExample(const char *anchor,const char *name, const char *file) { return FALSE; } - virtual void mergeCategory(ClassDef *category) {} - virtual void setNamespace(NamespaceDef *nd) {} - virtual void setFileDef(FileDef *fd) {} - virtual void setSubGrouping(bool enabled) {} - virtual void setProtection(Protection p) {} - virtual void setGroupDefForAllMembers(GroupDef *g,Grouping::GroupPri_t pri,const QCString &fileName,int startLine,bool hasDocs) {} - virtual void addInnerCompound(const Definition *d) {} - virtual void addUsedClass(ClassDef *cd,const char *accessName,Protection prot) {} - virtual void addUsedByClass(ClassDef *cd,const char *accessName,Protection prot) {} - virtual void setIsStatic(bool b) {} - virtual void setCompoundType(CompoundType t) {} - virtual void setClassName(const char *name) {} - virtual void setClassSpecifier(uint64 spec) {} - virtual void setTemplateArguments(const ArgumentList &al) {} - virtual void setTemplateBaseClassNames(QDict<int> *templateNames) {} - virtual void setTemplateMaster(const ClassDef *tm) {} - virtual void setTypeConstraints(const ArgumentList &al) {} - virtual void addMembersToTemplateInstance(const ClassDef *cd,const char *templSpec) {} - virtual void makeTemplateArgument(bool b=TRUE) {} - virtual void setCategoryOf(ClassDef *cd) {} - virtual void setUsedOnly(bool b) {} - virtual void addTaggedInnerClass(ClassDef *cd) {} - virtual void setTagLessReference(ClassDef *cd) {} - virtual void setName(const char *name) {} - virtual void setMetaData(const char *md) {} + virtual bool addExample(const char *,const char *, const char *) { return FALSE; } + virtual void mergeCategory(ClassDef *) {} + virtual void setNamespace(NamespaceDef *) {} + virtual void setFileDef(FileDef *) {} + virtual void setSubGrouping(bool) {} + virtual void setProtection(Protection) {} + virtual void setGroupDefForAllMembers(GroupDef *,Grouping::GroupPri_t,const QCString &,int,bool) {} + virtual void addInnerCompound(const Definition *) {} + virtual void addUsedClass(ClassDef *,const char *,Protection) {} + virtual void addUsedByClass(ClassDef *,const char *,Protection) {} + virtual void setIsStatic(bool) {} + virtual void setCompoundType(CompoundType) {} + virtual void setClassName(const char *) {} + virtual void setClassSpecifier(uint64) {} + virtual void setTemplateArguments(const ArgumentList &) {} + virtual void setTemplateBaseClassNames(QDict<int> *) {} + virtual void setTemplateMaster(const ClassDef *) {} + virtual void setTypeConstraints(const ArgumentList &) {} + virtual void addMembersToTemplateInstance(const ClassDef *,const char *) {} + virtual void makeTemplateArgument(bool=TRUE) {} + virtual void setCategoryOf(ClassDef *) {} + virtual void setUsedOnly(bool) {} + virtual void addTaggedInnerClass(ClassDef *) {} + virtual void setTagLessReference(ClassDef *) {} + virtual void setName(const char *) {} + virtual void setMetaData(const char *) {} virtual void findSectionsInDocumentation() {} virtual void addMembersToMemberGroup() {} virtual void addListReferences() {} @@ -487,24 +487,24 @@ class ClassDefAliasImpl : public DefinitionAliasImpl, public ClassDef virtual void mergeMembers() {} virtual void sortMemberLists() {} virtual void distributeMemberGroupDocumentation() {} - virtual void writeDocumentation(OutputList &ol) const {} - virtual void writeDocumentationForInnerClasses(OutputList &ol) const {} - virtual void writeMemberPages(OutputList &ol) const {} - virtual void writeMemberList(OutputList &ol) const {} - virtual void writeDeclaration(OutputList &ol,const MemberDef *md,bool inGroup, - const ClassDef *inheritedFrom,const char *inheritId) const {} - virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *md) const {} - virtual void writeSummaryLinks(OutputList &ol) const {} - virtual void reclassifyMember(MemberDef *md,MemberType t) {} - virtual void writeInlineDocumentation(OutputList &ol) const {} + virtual void writeDocumentation(OutputList &) const {} + virtual void writeDocumentationForInnerClasses(OutputList &) const {} + virtual void writeMemberPages(OutputList &) const {} + virtual void writeMemberList(OutputList &) const {} + virtual void writeDeclaration(OutputList &,const MemberDef *,bool, + const ClassDef *,const char *) const {} + virtual void writeQuickMemberLinks(OutputList &,const MemberDef *) const {} + virtual void writeSummaryLinks(OutputList &) const {} + virtual void reclassifyMember(MemberDef *,MemberType) {} + virtual void writeInlineDocumentation(OutputList &) const {} virtual void writeDeclarationLink(OutputList &ol,bool &found, const char *header,bool localNames) const { getCdAlias()->writeDeclarationLink(ol,found,header,localNames); } - virtual void removeMemberFromLists(MemberDef *md) {} + virtual void removeMemberFromLists(MemberDef *) {} virtual void setAnonymousEnumType() {} virtual void countMembers() {} - virtual void addGroupedInheritedMembers(OutputList &ol,MemberListType lt, - const ClassDef *inheritedFrom,const QCString &inheritId) const {} + virtual void addGroupedInheritedMembers(OutputList &,MemberListType, + const ClassDef *,const QCString &) const {} virtual void writeTagFile(FTextStream &) {} virtual void setVisited(bool visited) const { m_visited = visited; } @@ -516,10 +516,8 @@ class ClassDefAliasImpl : public DefinitionAliasImpl, public ClassDef virtual int countMemberDeclarations(MemberListType lt,const ClassDef *inheritedFrom, int lt2,bool invert,bool showAlways,QPtrDict<void> *visitedClasses) const { return getCdAlias()->countMemberDeclarations(lt,inheritedFrom,lt2,invert,showAlways,visitedClasses); } - virtual void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title, - const char *subTitle=0,bool showInline=FALSE,const ClassDef *inheritedFrom=0, - int lt2=-1,bool invert=FALSE,bool showAlways=FALSE, - QPtrDict<void> *visitedClasses=0) const {} + virtual void writeMemberDeclarations(OutputList &,MemberListType,const QCString &, + const char *,bool,const ClassDef *, int,bool,bool, QPtrDict<void> *) const {} private: mutable bool m_visited = false; @@ -1743,7 +1741,7 @@ void ClassDefImpl::writeInheritanceGraph(OutputList &ol) const ol.startParagraph(); //parseText(ol,theTranslator->trInherits()+" "); - QCString inheritLine = theTranslator->trInheritsList(m_impl->inherits->count()); + QCString inheritLine = theTranslator->trInheritsList((int)m_impl->inherits->count()); QRegExp marker("@[0-9]+"); int index=0,newIndex,matchLen; // now replace all markers in inheritLine with links to the classes @@ -1780,7 +1778,7 @@ void ClassDefImpl::writeInheritanceGraph(OutputList &ol) const } index=newIndex+matchLen; } - ol.parseText(inheritLine.right(inheritLine.length()-index)); + ol.parseText(inheritLine.right(inheritLine.length()-(uint)index)); ol.endParagraph(); } @@ -1788,7 +1786,7 @@ void ClassDefImpl::writeInheritanceGraph(OutputList &ol) const if (m_impl->inheritedBy && m_impl->inheritedBy->count()>0) { ol.startParagraph(); - QCString inheritLine = theTranslator->trInheritedByList(m_impl->inheritedBy->count()); + QCString inheritLine = theTranslator->trInheritedByList((int)m_impl->inheritedBy->count()); QRegExp marker("@[0-9]+"); int index=0,newIndex,matchLen; // now replace all markers in inheritLine with links to the classes @@ -1813,7 +1811,7 @@ void ClassDefImpl::writeInheritanceGraph(OutputList &ol) const } index=newIndex+matchLen; } - ol.parseText(inheritLine.right(inheritLine.length()-index)); + ol.parseText(inheritLine.right(inheritLine.length()-(uint)index)); ol.endParagraph(); } @@ -3301,7 +3299,9 @@ bool ClassDefImpl::hasExamples() const { bool result=FALSE; if (m_impl->exampleSDict) - result = m_impl->exampleSDict->count()>0; + { + result = m_impl->exampleSDict->count()>0; + } return result; } @@ -3354,7 +3354,7 @@ void ClassDefImpl::addTypeConstraints() addTypeConstraint(typeConstraint,a.type); p=i+1; } - typeConstraint = a.typeConstraint.right(a.typeConstraint.length()-p).stripWhiteSpace(); + typeConstraint = a.typeConstraint.right(a.typeConstraint.length()-(uint)p).stripWhiteSpace(); addTypeConstraint(typeConstraint,a.type); } } @@ -3606,7 +3606,7 @@ void ClassDefImpl::mergeMembers() //static bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); SrcLangExt lang = getLanguage(); QCString sep=getLanguageSpecificSeparator(lang,TRUE); - int sepLen = sep.length(); + uint sepLen = sep.length(); m_impl->membersMerged=TRUE; //printf(" mergeMembers for %s\n",name().data()); @@ -3683,7 +3683,7 @@ void ClassDefImpl::mergeMembers() // dstMd->name().data(), // dstMi->scopePath.left(dstMi->scopePath.find("::")+2).data()); - QCString scope=dstMi->scopePath.left(dstMi->scopePath.find(sep)+sepLen); + QCString scope=dstMi->scopePath.left((uint)dstMi->scopePath.find(sep)+sepLen); if (scope!=dstMi->ambiguityResolutionScope.left(scope.length())) dstMi->ambiguityResolutionScope.prepend(scope); ambiguous=TRUE; @@ -3710,7 +3710,7 @@ void ClassDefImpl::mergeMembers() // dstMd->name().data(), // dstMi->scopePath.left(dstMi->scopePath.find("::")+2).data()); - QCString scope=dstMi->scopePath.left(dstMi->scopePath.find(sep)+sepLen); + QCString scope=dstMi->scopePath.left((uint)dstMi->scopePath.find(sep)+sepLen); if (scope!=dstMi->ambiguityResolutionScope.left(scope.length())) { dstMi->ambiguityResolutionScope.prepend(scope); @@ -4344,7 +4344,7 @@ std::vector<ArgumentList> ClassDefImpl::getTemplateParameterLists() const } QCString ClassDefImpl::qualifiedNameWithTemplateParameters( - const std::vector<ArgumentList> *actualParams,int *actualParamIndex) const + const std::vector<ArgumentList> *actualParams,uint *actualParamIndex) const { //static bool optimizeOutputJava = Config_getBool(OPTIMIZE_OUTPUT_JAVA); static bool hideScopeNames = Config_getBool(HIDE_SCOPE_NAMES); @@ -4380,7 +4380,7 @@ QCString ClassDefImpl::qualifiedNameWithTemplateParameters( scName+=clName; if (!templateArguments().empty()) { - if (actualParams && *actualParamIndex<(int)actualParams->size()) + if (actualParams && *actualParamIndex<actualParams->size()) { const ArgumentList &al = actualParams->at(*actualParamIndex); if (!isSpecialization) @@ -4411,7 +4411,7 @@ QCString ClassDefImpl::className() const { return m_impl->className; } -}; +} void ClassDefImpl::setClassName(const char *name) { diff --git a/src/classdef.h b/src/classdef.h index 3158c50..72ee92d 100644 --- a/src/classdef.h +++ b/src/classdef.h @@ -232,7 +232,7 @@ class ClassDef : virtual public Definition virtual std::vector<ArgumentList> getTemplateParameterLists() const = 0; virtual QCString qualifiedNameWithTemplateParameters( - const std::vector<ArgumentList> *actualParams=0,int *actualParamIndex=0) const = 0; + const std::vector<ArgumentList> *actualParams=0,uint *actualParamIndex=0) const = 0; /** Returns TRUE if there is at least one pure virtual member in this * class. @@ -465,7 +465,7 @@ struct UsesClassDef class UsesClassDict : public QDict<UsesClassDef> { public: - UsesClassDict(int size) : QDict<UsesClassDef>(size) {} + UsesClassDict(uint size) : QDict<UsesClassDef>(size) {} ~UsesClassDict() {} }; @@ -575,7 +575,7 @@ struct ConstraintClassDef class ConstraintClassDict : public QDict<ConstraintClassDef> { public: - ConstraintClassDict(int size) : QDict<ConstraintClassDef>(size) {} + ConstraintClassDict(uint size) : QDict<ConstraintClassDef>(size) {} ~ConstraintClassDict() {} }; diff --git a/src/classlist.h b/src/classlist.h index 11c8305..6e4281f 100644 --- a/src/classlist.h +++ b/src/classlist.h @@ -48,7 +48,7 @@ class ClassListIterator : public QListIterator<ClassDef> class ClassDict : public QDict<ClassDef> { public: - ClassDict(int size) : QDict<ClassDef>(size) {} + ClassDict(uint size) : QDict<ClassDef>(size) {} ~ClassDict() {} }; @@ -56,7 +56,7 @@ class ClassDict : public QDict<ClassDef> class ClassSDict : public SDict<ClassDef> { public: - ClassSDict(int size=17) : SDict<ClassDef>(size) {} + ClassSDict(uint size=17) : SDict<ClassDef>(size) {} ~ClassSDict() {} void writeDeclaration(OutputList &ol,const ClassDef::CompoundType *filter=0, const char *header=0,bool localNames=FALSE) const; @@ -60,6 +60,8 @@ #define SCOPEBLOCK (int *)8 #define INNERBLOCK (int *)12 +#define USE_STATE2STRING 0 + /* ----------------------------------------------------------------- * statics */ @@ -137,7 +139,7 @@ class VariableContext void addVariable(yyscan_t yyscanner,const QCString &type,const QCString &name); ClassDef *findVariable(const QCString &name); - int count() const { return m_scopes.count(); } + uint count() const { return m_scopes.count(); } private: Scope m_globalScope; @@ -224,7 +226,7 @@ struct codeYY_state QCString parmName; const char * inputString = 0; //!< the code fragment as text - int inputPosition = 0; //!< read offset during parsing + yy_size_t inputPosition = 0; //!< read offset during parsing int inputLines = 0; //!< number of line in the code fragment int yyLineNr = 0; //!< current line number int yyColNr = 0; //!< current column number @@ -306,10 +308,12 @@ struct codeYY_state static bool isCastKeyword(const QCString &s); //------------------------------------------------------------------- +#if USE_STATE2STRING +static const char *stateToString(yyscan_t yyscanner,int state); +#endif static void saveObjCContext(yyscan_t yyscanner); static void restoreObjCContext(yyscan_t yyscanner); -static const char *stateToString(yyscan_t yyscanner,int state); static void addUsingDirective(yyscan_t yyscanner,const char *name); static void pushScope(yyscan_t yyscanner,const char *s); static void popScope(yyscan_t yyscanner); @@ -359,7 +363,7 @@ static QCString escapeObject(yyscan_t yyscanner,const char *s); static QCString escapeWord(yyscan_t yyscanner,const char *s); static QCString escapeComment(yyscan_t yyscanner,const char *s); static bool skipLanguageSpecificKeyword(yyscan_t yyscanner,const QCString &kw); -static int yyread(yyscan_t yyscanner,char *buf,int max_size); +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); /* ----------------------------------------------------------------- @@ -601,7 +605,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" { yyextra->code->codify(yytext); } - char c=yyinput(yyscanner); + char c=(char)yyinput(yyscanner); QCString text; text+=c; yyextra->code->codify(text); @@ -1195,10 +1199,10 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); yyextra->name+=yytext; } -<Body>"("{B}*("*"{B}*)+{SCOPENAME}*{B}*")"/{B}* { // (*p)->func() but not "if (p) ..." +<Body>"("{B}*("*"{B}*)+{SCOPENAME}+{B}*")"/{B}* { // (*p)->func() but not "if (p) ..." yyextra->code->codify(yytext); - int s=0;while (s<(int)yyleng && !isId(yytext[s])) s++; - int e=(int)yyleng-1;while (e>=0 && !isId(yytext[e])) e--; + uint s=0;while (s<(uint)yyleng && !isId(yytext[s])) s++; + uint e=(uint)yyleng-1;while (e>1 && !isId(yytext[e])) e--; QCString varname = ((QCString)yytext).mid(s,e-s+1); addType(yyscanner); yyextra->name=varname; @@ -1218,7 +1222,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" } <FuncCall,Body,MemberCall,MemberCall2,SkipInits,InlineInit>{RAWBEGIN} { QCString text=yytext; - int i=text.find('R'); + uint i=(uint)text.find('R'); yyextra->code->codify(text.left(i+1)); startFontClass(yyscanner,"stringliteral"); yyextra->code->codify(yytext+i+1); @@ -1767,7 +1771,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" DBG_CTX((stderr,"yyextra->name=%s\n",yyextra->name.data())); if (index!=-1) { - QCString scope = yyextra->name.left(index); + QCString scope = yyextra->name.left((uint)index); if (!yyextra->classScope.isEmpty()) scope.prepend(yyextra->classScope+"::"); const ClassDef *cd=getResolvedClass(Doxygen::globalScope,yyextra->sourceFileDef,scope); if (cd) @@ -1892,10 +1896,10 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" generateClassOrGlobalLink(yyscanner,*yyextra->code,yytext); BEGIN( MemberCall2 ); } -<FuncCall,MemberCall2>("("{B}*("*"{B}*)+{ID}*{B}*")"{B}*)/("."|"->") { +<FuncCall,MemberCall2>("("{B}*("*"{B}*)+{ID}+{B}*")"{B}*)/("."|"->") { yyextra->code->codify(yytext); - int s=0;while (!isId(yytext[s])) s++; - int e=(int)yyleng-1;while (!isId(yytext[e])) e--; + uint s=0;while (!isId(yytext[s])) s++; + uint e=(uint)yyleng-1;while (e>1 && !isId(yytext[e])) e--; yyextra->name=((QCString)yytext).mid(s,e-s+1); BEGIN( MemberCall2 ); } @@ -2107,8 +2111,8 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" } <*>"/*[tag:"[^\]\n]*"]*/"{B}* { // special pattern /*[tag:filename]*/ to force linking to a tag file yyextra->forceTagReference=yytext; - int s=yyextra->forceTagReference.find(':'); - int e=yyextra->forceTagReference.findRev(']'); + uint s=(uint)yyextra->forceTagReference.find(':'); + uint e=(uint)yyextra->forceTagReference.findRev(']'); yyextra->forceTagReference = yyextra->forceTagReference.mid(s+1,e-s-1); } <*>\n{B}*"/*"[!*]/[^/*] { @@ -3726,7 +3730,7 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx) } else // illegal marker { - ASSERT(!"invalid escape sequence"); + ASSERT("invalid escape sequence"==0); } } } @@ -3800,12 +3804,12 @@ static bool isCastKeyword(const QCString &s) return kw=="const_cast" || kw=="static_cast" || kw=="dynamic_cast" || kw=="reinterpret_cast"; } -static int yyread(yyscan_t yyscanner,char *buf,int max_size) +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - int inputPosition = yyextra->inputPosition; - const char *s = yyextra->inputString + yyextra->inputPosition; - int c=0; + yy_size_t inputPosition = yyextra->inputPosition; + const char *s = yyextra->inputString + inputPosition; + yy_size_t c=0; while( c < max_size && *s ) { *buf++ = *s++; @@ -4007,4 +4011,6 @@ void CCodeParser::parseCode(CodeOutputInterface &od,const char *className,const return; } +#if USE_STATE2STRING #include "code.l.h" +#endif diff --git a/src/commentcnv.l b/src/commentcnv.l index 279f428..59d1a8b 100644 --- a/src/commentcnv.l +++ b/src/commentcnv.l @@ -48,6 +48,8 @@ #define ADDCHAR(c) yyextra->outBuf->addChar(c) #define ADDARRAY(a,s) yyextra->outBuf->addArray(a,s) + +#define USE_STATE2STRING 0 struct CondCtx { @@ -102,7 +104,9 @@ struct commentcnvYY_state bool isFixedForm = FALSE; // For Fortran }; +#if USE_STATE2STRING static const char *stateToString(int state); +#endif static inline int computeIndent(const char *s); static void replaceCommentMarker(yyscan_t yyscanner,const char *s,int len); @@ -111,7 +115,7 @@ static void startCondSection(yyscan_t yyscanner,const char *sectId); static void endCondSection(yyscan_t yyscanner); static void handleCondSectionId(yyscan_t yyscanner,const char *expression); static void replaceAliases(yyscan_t yyscanner,const char *s); -static int yyread(yyscan_t yyscanner,char *buf,int max_size); +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); static void replaceComment(yyscan_t yyscanner,int offset); @@ -287,7 +291,7 @@ MAILADR ("mailto:")?[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z copyToOutput(yyscanner,yytext,(int)yyleng); } <Scan>"/*"[*!]? { /* start of a C comment */ - if ((yyextra->lang==SrcLangExt_Python) || (yyextra->lang==SrcLangExt_Tcl)) + if (yyextra->lang==SrcLangExt_Python) { REJECT; } @@ -576,7 +580,6 @@ MAILADR ("mailto:")?[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z } <CComment>"/"+"*" { /* nested C comment */ if (yyextra->lang==SrcLangExt_Python || - yyextra->lang==SrcLangExt_Tcl || yyextra->lang==SrcLangExt_Markdown) { REJECT; @@ -587,7 +590,6 @@ MAILADR ("mailto:")?[a-z_A-Z0-9.+-]+"@"[a-z_A-Z0-9-]+("."[a-z_A-Z0-9\-]+)+[a-z } <CComment>"*"+"/" { /* end of C comment */ if (yyextra->lang==SrcLangExt_Python || - yyextra->lang==SrcLangExt_Tcl || yyextra->lang==SrcLangExt_Markdown) { REJECT; @@ -1036,11 +1038,11 @@ static void replaceAliases(yyscan_t yyscanner,const char *s) } -static int yyread(yyscan_t yyscanner,char *buf,int max_size) +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - int bytesInBuf = yyextra->inBuf->curPos()-yyextra->inBufPos; - int bytesToCopy = QMIN(max_size,bytesInBuf); + yy_size_t bytesInBuf = yyextra->inBuf->curPos()-yyextra->inBufPos; + yy_size_t bytesToCopy = QMIN(max_size,bytesInBuf); memcpy(buf,yyextra->inBuf->data()+yyextra->inBufPos,bytesToCopy); yyextra->inBufPos+=bytesToCopy; return bytesToCopy; @@ -1064,7 +1066,7 @@ static void replaceComment(yyscan_t yyscanner,int offset) else { copyToOutput(yyscanner," */",3); - int i;for (i=(int)yyleng-1;i>=0;i--) unput(yytext[i]); + for (i=(int)yyleng-1;i>=0;i--) unput(yytext[i]); yyextra->inSpecialComment=FALSE; BEGIN(Scan); } @@ -1200,4 +1202,6 @@ void convertCppComments(BufStr *inBuf,BufStr *outBuf,const char *fileName) //---------------------------------------------------------------------------- +#if USE_STATE2STRING #include "commentcnv.l.h" +#endif diff --git a/src/commentscan.l b/src/commentscan.l index 13ea0c1..309a334 100644 --- a/src/commentscan.l +++ b/src/commentscan.l @@ -56,6 +56,8 @@ #include "util.h" #include "reflist.h" +#define USE_STATE2STRING 0 + // forward declarations static bool handleBrief(yyscan_t yyscanner,const QCString &, const QCStringList &); static bool handleFn(yyscan_t yyscanner,const QCString &, const QCStringList &); @@ -136,7 +138,9 @@ static bool handleEndParBlock(yyscan_t yyscanner,const QCString &, const QCStrin static bool handleParam(yyscan_t yyscanner,const QCString &, const QCStringList &); static bool handleRetval(yyscan_t yyscanner,const QCString &, const QCStringList &); +#if USE_STATE2STRING static const char *stateToString(int state); +#endif typedef bool (*DocCmdFunc)(yyscan_t yyscanner,const QCString &name, const QCStringList &optList); @@ -296,6 +300,7 @@ static const std::map< std::string, DocCmdMap > docCmdMap = #define YY_NO_UNISTD_H 1 #define YY_NEVER_INTERACTIVE 1 + enum XRefKind { XRef_Item, @@ -405,7 +410,6 @@ static void stripTrailingWhiteSpace(QCString &s); static void initParser(yyscan_t yyscanner); static bool makeStructuralIndicator(yyscan_t yyscanner,Entry::Sections s); static void lineCount(yyscan_t yyscanner); -static QCString stripQuotes(yyscan_t yyscanner,const char *s); static void addXRefItem(yyscan_t yyscanner, const char *listName,const char *itemTitle, const char *listTitle,bool append); @@ -418,7 +422,7 @@ static inline void addOutput(yyscan_t yyscanner,const char *s); static inline void addOutput(yyscan_t yyscanner,char c); static void endBrief(yyscan_t yyscanner,bool addToOutput=TRUE); static void handleGuard(yyscan_t yyscanner,const QCString &expr); -static int yyread(yyscan_t yyscanner,char *buf,int max_size); +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); static void addCite(yyscan_t yyscanner); //----------------------------------------------------------------------------- @@ -818,8 +822,8 @@ RCSTAG "$"{ID}":"[^\n$]+"$" { // see bug 613024, we need to put the newlines after ending the XRef section. if (!yyextra->insideParBlock) setOutput(yyscanner,OutputDoc); - int i; - for (i=0;i<yyleng;) + yy_size_t i; + for (i=0;i<(yy_size_t)yyleng;) { if (yytext[i]=='\n') addOutput(yyscanner,'\n'),i++; else if (strcmp(yytext+i,"\\_linebr")==0) addOutput(yyscanner,'\n'),i+=8; @@ -828,8 +832,8 @@ RCSTAG "$"{ID}":"[^\n$]+"$" } else if (yyextra->inContext!=OutputBrief) { - int i; - for (i=0;i<yyleng;) + yy_size_t i; + for (i=0;i<(yy_size_t)yyleng;) { if (yytext[i]=='\n') addOutput(yyscanner,'\n'),i++; else if (strcmp(yytext+i,"\\_linebr")==0) addOutput(yyscanner,'\n'),i+=8; @@ -2503,7 +2507,6 @@ static bool handleInternal(yyscan_t yyscanner,const QCString &, const QCStringLi static bool handleLineBr(yyscan_t yyscanner,const QCString &, const QCStringList &) { - struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; addOutput(yyscanner,'\n'); return FALSE; } @@ -2910,7 +2913,7 @@ static void addCite(yyscan_t yyscanner) if (yytext[0] =='"') { name=yytext+1; - name=name.left(yyleng-2); + name=name.left((int)yyleng-2); } CitationManager::instance().insert(name.data()); } @@ -3104,18 +3107,18 @@ static void endBrief(yyscan_t yyscanner,bool addToOutput) } } -static int yyread(yyscan_t yyscanner,char *buf,int max_size) +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - yyextra->prevPosition=yyextra->inputPosition; - int c=0; - while( c < max_size && yyextra->inputString[yyextra->inputPosition] ) - { - *buf = yyextra->inputString[yyextra->inputPosition++] ; - //printf("%d (%c)\n",*buf,*buf); - c++; buf++; - } - return c; + yyextra->prevPosition=yyextra->inputPosition; + yy_size_t c=0; + while( c < max_size && yyextra->inputString[yyextra->inputPosition] ) + { + *buf = yyextra->inputString[yyextra->inputPosition++] ; + //printf("%d (%c)\n",*buf,*buf); + c++; buf++; + } + return c; } //---------------------------------------------------------------------------- @@ -3348,4 +3351,6 @@ void CommentScanner::close(Entry *e,const char *fileName,int lineNr,bool foundIn yyextra->docGroup.close(e,fileName,lineNr,foundInline,implicit); } +#if USE_STATE2STRING #include "commentscan.l.h" +#endif diff --git a/src/condparser.cpp b/src/condparser.cpp index 9d7ac45..e76b164 100644 --- a/src/condparser.cpp +++ b/src/condparser.cpp @@ -102,8 +102,7 @@ static bool isAlpha(const char c) static bool isAlphaNumSpec(const char c) { - return isAlpha(c) || (c>='0' && c<='9') || c=='-' || c=='.' || - (((unsigned char)c)>=0x80 && ((unsigned char)c)<=0xFF); + return isAlpha(c) || (c>='0' && c<='9') || c=='-' || c=='.' || (((unsigned char)c)>=0x80); } /** diff --git a/src/config.xml b/src/config.xml index 8258415..5b29b66 100644 --- a/src/config.xml +++ b/src/config.xml @@ -585,16 +585,6 @@ Go to the <a href="commands.html">next</a> section or return to the ]]> </docs> </option> - <option type='list' id='TCL_SUBST' format='string'> - <docs> -<![CDATA[ - This tag can be used to specify a number of word-keyword mappings (TCL only). - A mapping has the form <code>"name=value"</code>. For example adding - <code>"class=itcl::class"</code> will allow you to use the command class in the - <code>itcl::class</code> meaning. -]]> - </docs> - </option> <option type='bool' id='OPTIMIZE_OUTPUT_FOR_C' defval='0'> <docs> <![CDATA[ @@ -649,10 +639,10 @@ Go to the <a href="commands.html">next</a> section or return to the Doxygen has a built-in mapping, but you can override or extend it using this tag. The format is <code>ext=language</code>, where \c ext is a file extension, and language is one of the parsers supported by doxygen: IDL, Java, JavaScript, Csharp (C#), C, C++, D, PHP, - md (Markdown), Objective-C, Python, Slice, Fortran (fixed format Fortran: FortranFixed, + md (Markdown), Objective-C, Python, Slice, VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: Fortran. In the later case the parser tries to guess whether the code is fixed or free - formatted code, this is the default for Fortran type files), VHDL, tcl. + formatted code, this is the default for Fortran type files). For instance to make doxygen treat <code>.inc</code> files as Fortran files (default is PHP), and <code>.f</code> files as C (default is Fortran), @@ -1416,7 +1406,6 @@ FILE_VERSION_FILTER = "cleartool desc -fmt \%Vn" <value name='*.f18'/> <value name='*.f'/> <value name='*.for'/> - <value name='*.tcl'/> <value name='*.vhd'/> <value name='*.vhdl'/> <value name='*.ucf'/> @@ -3656,5 +3645,6 @@ remove the intermediate dot files that are used to generate the various graphs. <option type='obsolete' id='XML_DTD'/> <option type='obsolete' id='PERL_PATH'/> <option type='obsolete' id='MSCGEN_PATH'/> + <option type='obsolete' id='TCL_SUBST'/> </group> </doxygenconfig> diff --git a/src/configimpl.l b/src/configimpl.l index 4ea877b..d07e25c 100644 --- a/src/configimpl.l +++ b/src/configimpl.l @@ -33,8 +33,8 @@ #include <qregexp.h> #include <qstack.h> #include <qglobal.h> -#include <qthread.h> - +#include <thread> + #include "configimpl.h" #include "version.h" #include "portable.h" @@ -47,7 +47,11 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 +#define USE_STATE2STRING 0 + +#if USE_STATE2STRING static const char *stateToString(int state); +#endif static const char *warning_str = "warning: "; static const char *error_str = "error: "; @@ -96,20 +100,27 @@ static QCString convertToComment(const QCString &s, const QCString &u) QCString tmp=s.stripWhiteSpace(); const char *p=tmp.data(); char c; - result+="#"; - if (*p && *p!='\n') - result+=" "; - while ((c=*p++)) + if (p) { - if (c=='\n') + result+="#"; + if (*p && *p!='\n') + { + result+=" "; + } + while ((c=*p++)) { - result+="\n#"; - if (*p && *p!='\n') - result+=" "; + if (c=='\n') + { + result+="\n#"; + if (*p && *p!='\n') + { + result+=" "; + } + } + else result+=c; } - else result+=c; + result+='\n'; } - result+='\n'; } if (!u.isEmpty()) { @@ -134,7 +145,7 @@ void ConfigOption::writeStringValue(FTextStream &t,QCString &s) { char c; bool needsEscaping=FALSE; - // convert the string back to it original encoding + // convert the string back to it original g_encoding QCString se = configStringRecode(s,"UTF-8",m_encoding); const char *p=se.data(); if (p) @@ -530,47 +541,47 @@ struct ConfigFileState QCString fileName; }; -static const char *inputString; -static int inputPosition; -static int yyLineNr; -static QCString yyFileName; -static QCString tmpString; -static QCString *s=0; -static bool *b=0; -static QStrList *l=0; -static int lastState; -static QCString elemStr; -static QStrList includePathList; -static QStack<ConfigFileState> includeStack; -static int includeDepth; -static bool config_upd = FALSE; -static QCString encoding; -static ConfigImpl *config; +static const char *g_inputString; +static int g_inputPosition; +static int g_yyLineNr; +static QCString g_yyFileName; +static QCString g_tmpString; +static QCString *g_string=0; +static bool *g_bool=0; +static QStrList *g_list=0; +static int g_lastState; +static QCString g_elemStr; +static QStrList g_includePathList; +static QStack<ConfigFileState> g_includeStack; +static int g_includeDepth; +static bool g_configUpdate = FALSE; +static QCString g_encoding; +static ConfigImpl *g_config; /* ----------------------------------------------------------------- */ #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); -static int yyread(char *buf,int max_size) +static yy_size_t yyread(char *buf,yy_size_t max_size) { - // no file included - if (includeStack.isEmpty()) - { - int c=0; - if (inputString==0) return c; - while( c < max_size && inputString[inputPosition] ) - { - *buf = inputString[inputPosition++] ; - c++; buf++; - } - return c; - } - else + // no file included + if (g_includeStack.isEmpty()) + { + yy_size_t c=0; + if (g_inputString==0) return c; + while( c < max_size && g_inputString[g_inputPosition] ) { - //assert(includeStack.current()->newState==YY_CURRENT_BUFFER); - return (int)fread(buf,1,max_size,includeStack.current()->filePtr); + *buf = g_inputString[g_inputPosition++] ; + c++; buf++; } + return c; + } + else + { + //assert(g_includeStack.current()->newState==YY_CURRENT_BUFFER); + return (yy_size_t)fread(buf,1,max_size,g_includeStack.current()->filePtr); + } } @@ -613,8 +624,8 @@ static QCString configStringRecode( static void checkEncoding() { - ConfigString *option = (ConfigString*)config->get("DOXYFILE_ENCODING"); - encoding = *option->valueRef(); + ConfigString *option = (ConfigString*)g_config->get("DOXYFILE_ENCODING"); + g_encoding = *option->valueRef(); } static FILE *tryPath(const char *path,const char *fileName) @@ -643,21 +654,21 @@ static FILE *findFile(const char *fileName) { return tryPath(NULL, fileName); } - substEnvVarsInStrList(includePathList); - char *s=includePathList.first(); + substEnvVarsInStrList(g_includePathList); + char *s=g_includePathList.first(); while (s) // try each of the include paths { FILE *f = tryPath(s,fileName); if (f) return f; - s=includePathList.next(); + s=g_includePathList.next(); } - // try cwd if includePathList fails + // try cwd if g_includePathList fails return tryPath(".",fileName); } static void readIncludeFile(const char *incName) { - if (includeDepth==MAX_INCLUDE_DEPTH) { + if (g_includeDepth==MAX_INCLUDE_DEPTH) { config_term("maximum include depth (%d) reached, %s is not included. Aborting...\n", MAX_INCLUDE_DEPTH,incName); } @@ -677,23 +688,23 @@ static void readIncludeFile(const char *incName) { // For debugging #if SHOW_INCLUDES - for (i=0;i<includeStack.count();i++) msg(" "); + for (i=0;i<g_includeStack.count();i++) msg(" "); msg("@INCLUDE = %s: parsing...\n",inc.data()); #endif // store the state of the old file ConfigFileState *fs=new ConfigFileState; fs->oldState=YY_CURRENT_BUFFER; - fs->lineNr=yyLineNr; - fs->fileName=yyFileName; + fs->lineNr=g_yyLineNr; + fs->fileName=g_yyFileName; fs->filePtr=f; // push the state on the stack - includeStack.push(fs); + g_includeStack.push(fs); // set the scanner to the include file yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE)); fs->newState=YY_CURRENT_BUFFER; - yyFileName=inc; - includeDepth++; + g_yyFileName=inc; + g_includeDepth++; } else { @@ -721,26 +732,26 @@ static void readIncludeFile(const char *incName) %% <*>\0x0d -<PreStart>"##".*"\n" { config->appendStartComment(yytext);yyLineNr++;} +<PreStart>"##".*"\n" { g_config->appendStartComment(yytext);g_yyLineNr++;} <PreStart>. { BEGIN(Start); unput(*yytext); } -<Start,GetString,GetStrList,GetStrList1,GetBool,SkipInvalid>"##".*"\n" { config->appendUserComment(yytext);yyLineNr++;} +<Start,GetString,GetStrList,GetStrList1,GetBool,SkipInvalid>"##".*"\n" { g_config->appendUserComment(yytext);g_yyLineNr++;} <Start,GetString,GetStrList,GetStrList1,GetBool,SkipInvalid>"#" { BEGIN(SkipComment); } <Start>[a-z_A-Z][a-z_A-Z0-9]*[ \t]*"=" { QCString cmd=yytext; cmd=cmd.left(cmd.length()-1).stripWhiteSpace(); - ConfigOption *option = config->get(cmd); + ConfigOption *option = g_config->get(cmd); if (option==0) // oops not known { config_warn("ignoring unsupported tag '%s' at line %d, file %s\n", - cmd.data(),yyLineNr,yyFileName.data()); + cmd.data(),g_yyLineNr,g_yyFileName.data()); BEGIN(SkipInvalid); } else // known tag { - option->setUserComment(config->takeUserComment()); - option->setEncoding(encoding); + option->setUserComment(g_config->takeUserComment()); + option->setEncoding(g_encoding); switch(option->kind()) { case ConfigOption::O_Info: @@ -748,9 +759,9 @@ static void readIncludeFile(const char *incName) BEGIN(SkipInvalid); break; case ConfigOption::O_List: - l = ((ConfigList *)option)->valueRef(); - l->clear(); - elemStr=""; + g_list = ((ConfigList *)option)->valueRef(); + g_list->clear(); + g_elemStr=""; if (cmd == "PREDEFINED") { BEGIN(GetStrList1); @@ -761,50 +772,50 @@ static void readIncludeFile(const char *incName) } break; case ConfigOption::O_Enum: - s = ((ConfigEnum *)option)->valueRef(); - s->resize(0); + g_string = ((ConfigEnum *)option)->valueRef(); + g_string->resize(0); BEGIN(GetString); break; case ConfigOption::O_String: - s = ((ConfigString *)option)->valueRef(); - s->resize(0); + g_string = ((ConfigString *)option)->valueRef(); + g_string->resize(0); BEGIN(GetString); break; case ConfigOption::O_Int: - s = ((ConfigInt *)option)->valueStringRef(); - s->resize(0); + g_string = ((ConfigInt *)option)->valueStringRef(); + g_string->resize(0); BEGIN(GetString); break; case ConfigOption::O_Bool: - s = ((ConfigBool *)option)->valueStringRef(); - s->resize(0); + g_string = ((ConfigBool *)option)->valueStringRef(); + g_string->resize(0); BEGIN(GetString); break; case ConfigOption::O_Obsolete: - if (config_upd) + if (g_configUpdate) { config_warn("Tag '%s' at line %d of file '%s' has become obsolete.\n" - " This tag has been removed.\n", cmd.data(),yyLineNr,yyFileName.data()); + " This tag has been removed.\n", cmd.data(),g_yyLineNr,g_yyFileName.data()); } else { config_warn("Tag '%s' at line %d of file '%s' has become obsolete.\n" " To avoid this warning please remove this line from your configuration " - "file or upgrade it using \"doxygen -u\"\n", cmd.data(),yyLineNr,yyFileName.data()); + "file or upgrade it using \"doxygen -u\"\n", cmd.data(),g_yyLineNr,g_yyFileName.data()); } BEGIN(SkipInvalid); break; case ConfigOption::O_Disabled: - if (config_upd) + if (g_configUpdate) { config_warn("Tag '%s' at line %d of file '%s' belongs to an option that was not enabled at compile time.\n" - " This tag has been removed.\n", cmd.data(),yyLineNr,yyFileName.data()); + " This tag has been removed.\n", cmd.data(),g_yyLineNr,g_yyFileName.data()); } else { config_warn("Tag '%s' at line %d of file '%s' belongs to an option that was not enabled at compile time.\n" " To avoid this warning please remove this line from your configuration " - "file or upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", cmd.data(),yyLineNr,yyFileName.data()); + "file or upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", cmd.data(),g_yyLineNr,g_yyFileName.data()); } BEGIN(SkipInvalid); break; @@ -813,16 +824,16 @@ static void readIncludeFile(const char *incName) } <Start>[a-z_A-Z][a-z_A-Z0-9]*[ \t]*"+=" { QCString cmd=yytext; cmd=cmd.left(cmd.length()-2).stripWhiteSpace(); - ConfigOption *option = config->get(cmd); + ConfigOption *option = g_config->get(cmd); if (option==0) // oops not known { config_warn("ignoring unsupported tag '%s' at line %d, file %s\n", - cmd.data(),yyLineNr,yyFileName.data()); + cmd.data(),g_yyLineNr,g_yyFileName.data()); BEGIN(SkipInvalid); } else // known tag { - option->setUserComment(config->takeUserComment()); + option->setUserComment(g_config->takeUserComment()); switch(option->kind()) { case ConfigOption::O_Info: @@ -830,8 +841,8 @@ static void readIncludeFile(const char *incName) BEGIN(SkipInvalid); break; case ConfigOption::O_List: - l = ((ConfigList *)option)->valueRef(); - elemStr=""; + g_list = ((ConfigList *)option)->valueRef(); + g_elemStr=""; if (cmd == "PREDEFINED") { BEGIN(GetStrList1); @@ -846,137 +857,137 @@ static void readIncludeFile(const char *incName) case ConfigOption::O_Int: case ConfigOption::O_Bool: config_warn("operator += not supported for '%s'. Ignoring line at line %d, file %s\n", - yytext,yyLineNr,yyFileName.data()); + yytext,g_yyLineNr,g_yyFileName.data()); BEGIN(SkipInvalid); break; case ConfigOption::O_Obsolete: config_warn("Tag '%s' at line %d of file %s has become obsolete.\n" "To avoid this warning please update your configuration " - "file using \"doxygen -u\"\n", cmd.data(),yyLineNr,yyFileName.data()); + "file using \"doxygen -u\"\n", cmd.data(),g_yyLineNr,g_yyFileName.data()); BEGIN(SkipInvalid); break; case ConfigOption::O_Disabled: config_warn("Tag '%s' at line %d of file %s belongs to an option that was not enabled at compile time.\n" "To avoid this warning please remove this line from your configuration " - "file, upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", cmd.data(),yyLineNr,yyFileName.data()); + "file, upgrade it using \"doxygen -u\", or recompile doxygen with this feature enabled.\n", cmd.data(),g_yyLineNr,g_yyFileName.data()); BEGIN(SkipInvalid); break; } } } -<Start>"@INCLUDE_PATH"[ \t]*"=" { BEGIN(GetStrList); l=&includePathList; l->clear(); elemStr=""; } - /* include a config file */ +<Start>"@INCLUDE_PATH"[ \t]*"=" { BEGIN(GetStrList); g_list=&g_includePathList; g_list->clear(); g_elemStr=""; } + /* include a g_config file */ <Start>"@INCLUDE"[ \t]*"=" { BEGIN(Include);} <Include>([^ \"\t\r\n]+)|("\""[^\n\"]+"\"") { - readIncludeFile(configStringRecode(yytext,encoding,"UTF-8")); + readIncludeFile(configStringRecode(yytext,g_encoding,"UTF-8")); BEGIN(Start); } <<EOF>> { //printf("End of include file\n"); //printf("Include stack depth=%d\n",g_includeStack.count()); - if (includeStack.isEmpty()) + if (g_includeStack.isEmpty()) { //printf("Terminating scanner!\n"); yyterminate(); } else { - ConfigFileState *fs=includeStack.pop(); + ConfigFileState *fs=g_includeStack.pop(); fclose(fs->filePtr); YY_BUFFER_STATE oldBuf = YY_CURRENT_BUFFER; yy_switch_to_buffer( fs->oldState ); yy_delete_buffer( oldBuf ); - yyLineNr=fs->lineNr; - yyFileName=fs->fileName; + g_yyLineNr=fs->lineNr; + g_yyFileName=fs->fileName; delete fs; fs=0; - includeDepth--; + g_includeDepth--; } } -<Start>[a-z_A-Z0-9]+ { config_warn("ignoring unknown tag '%s' at line %d, file %s\n",yytext,yyLineNr,yyFileName.data()); } -<GetString,GetBool,SkipInvalid>\n { yyLineNr++; BEGIN(Start); } +<Start>[a-z_A-Z0-9]+ { config_warn("ignoring unknown tag '%s' at line %d, file %s\n",yytext,g_yyLineNr,g_yyFileName.data()); } +<GetString,GetBool,SkipInvalid>\n { g_yyLineNr++; BEGIN(Start); } <GetStrList,GetStrList1>\n { - yyLineNr++; - if (!elemStr.isEmpty()) + g_yyLineNr++; + if (!g_elemStr.isEmpty()) { - //printf("elemStr1='%s'\n",elemStr.data()); - l->append(elemStr); + //printf("elemStr1='%s'\n",g_elemStr.data()); + g_list->append(g_elemStr); } BEGIN(Start); } <GetStrList1>[ \t]+ { - if (!elemStr.isEmpty()) + if (!g_elemStr.isEmpty()) { - //printf("elemStr2='%s'\n",elemStr.data()); - l->append(elemStr); + //printf("elemStr2='%s'\n",g_elemStr.data()); + g_list->append(g_elemStr); } - elemStr.resize(0); + g_elemStr.resize(0); } <GetStrList>[ \t,]+ { - if (!elemStr.isEmpty()) + if (!g_elemStr.isEmpty()) { - //printf("elemStr2='%s'\n",elemStr.data()); - l->append(elemStr); + //printf("elemStr2='%s'\n",g_elemStr.data()); + g_list->append(g_elemStr); } - elemStr.resize(0); + g_elemStr.resize(0); } -<GetString>[^ \"\t\r\n]+ { (*s)+=configStringRecode(yytext,encoding,"UTF-8"); +<GetString>[^ \"\t\r\n]+ { (*g_string)+=configStringRecode(yytext,g_encoding,"UTF-8"); checkEncoding(); } -<GetString,GetStrList,GetStrList1,SkipInvalid>"\"" { lastState=YY_START; +<GetString,GetStrList,GetStrList1,SkipInvalid>"\"" { g_lastState=YY_START; BEGIN(GetQuotedString); - tmpString.resize(0); + g_tmpString.resize(0); } <GetQuotedString>"\""|"\n" { // we add a bogus space to signal that the string was quoted. This space will be stripped later on. - tmpString+=" "; - //printf("Quoted String = '%s'\n",tmpString.data()); - if (lastState==GetString) + g_tmpString+=" "; + //printf("Quoted String = '%s'\n",g_tmpString.data()); + if (g_lastState==GetString) { - (*s)+=configStringRecode(tmpString,encoding,"UTF-8"); + (*g_string)+=configStringRecode(g_tmpString,g_encoding,"UTF-8"); checkEncoding(); } else { - elemStr+=configStringRecode(tmpString,encoding,"UTF-8"); + g_elemStr+=configStringRecode(g_tmpString,g_encoding,"UTF-8"); } if (*yytext=='\n') { - config_warn("Missing end quote (\") on line %d, file %s\n",yyLineNr,yyFileName.data()); - yyLineNr++; + config_warn("Missing end quote (\") on line %d, file %s\n",g_yyLineNr,g_yyFileName.data()); + g_yyLineNr++; } - BEGIN(lastState); + BEGIN(g_lastState); } <GetQuotedString>"\\\"" { - tmpString+='"'; + g_tmpString+='"'; } -<GetQuotedString>. { tmpString+=*yytext; } +<GetQuotedString>. { g_tmpString+=*yytext; } <GetBool>[a-zA-Z]+ { QCString bs=yytext; bs=bs.upper(); if (bs=="YES" || bs=="1") - *b=TRUE; + *g_bool=TRUE; else if (bs=="NO" || bs=="0") - *b=FALSE; + *g_bool=FALSE; else { - *b=FALSE; + *g_bool=FALSE; config_warn("Invalid value '%s' for " "boolean tag in line %d, file %s; use YES or NO\n", - bs.data(),yyLineNr,yyFileName.data()); + bs.data(),g_yyLineNr,g_yyFileName.data()); } } <GetStrList1>[^ \#\"\t\r\n]+ { - elemStr+=configStringRecode(yytext,encoding,"UTF-8"); + g_elemStr+=configStringRecode(yytext,g_encoding,"UTF-8"); } <GetStrList>[^ \#\"\t\r\n,]+ { - elemStr+=configStringRecode(yytext,encoding,"UTF-8"); + g_elemStr+=configStringRecode(yytext,g_encoding,"UTF-8"); } -<SkipComment>\n { yyLineNr++; BEGIN(Start); } -<SkipComment>\\[ \r\t]*\n { yyLineNr++; BEGIN(Start); } -<*>\\[ \r\t]*\n { yyLineNr++; } +<SkipComment>\n { g_yyLineNr++; BEGIN(Start); } +<SkipComment>\\[ \r\t]*\n { g_yyLineNr++; BEGIN(Start); } +<*>\\[ \r\t]*\n { g_yyLineNr++; } <*>. -<*>\n { yyLineNr++ ; } +<*>\n { g_yyLineNr++ ; } %% @@ -990,7 +1001,7 @@ void ConfigImpl::writeTemplate(FTextStream &t,bool sl,bool upd) { t << takeStartComment() << endl; } - t << "# Doxyfile " << getVersion() << endl << endl; + t << "# Doxyfile " << getDoxygenVersion() << endl << endl; if (!sl) { t << convertToComment(m_header,""); @@ -1011,11 +1022,7 @@ void ConfigImpl::writeTemplate(FTextStream &t,bool sl,bool upd) void ConfigImpl::compareDoxyfile(FTextStream &t) { - t << "# Difference with default Doxyfile " << getVersion(); - if (strlen(getGitVersion())) - { - t << " (" << getGitVersion() << ")"; - } + t << "# Difference with default Doxyfile " << getFullVersion(); t << endl; QListIterator<ConfigOption> it = iterator(); ConfigOption *option; @@ -1279,27 +1286,27 @@ static QCString configFileToString(const char *name) bool ConfigImpl::parseString(const char *fn,const char *str,bool update) { - config = ConfigImpl::instance(); - inputString = str; - inputPosition = 0; - yyFileName = fn; - yyLineNr = 1; - includeStack.setAutoDelete(TRUE); - includeStack.clear(); - includeDepth = 0; + g_config = ConfigImpl::instance(); + g_inputString = str; + g_inputPosition = 0; + g_yyFileName = fn; + g_yyLineNr = 1; + g_includeStack.setAutoDelete(TRUE); + g_includeStack.clear(); + g_includeDepth = 0; configimplYYrestart( configimplYYin ); BEGIN( PreStart ); - config_upd = update; + g_configUpdate = update; configimplYYlex(); - config_upd = FALSE; - inputString = 0; + g_configUpdate = FALSE; + g_inputString = 0; return TRUE; } bool ConfigImpl::parse(const char *fn,bool update) { int retval; - encoding = "UTF-8"; + g_encoding = "UTF-8"; printlex(yy_flex_debug, TRUE, __FILE__, fn); retval = parseString(fn,configFileToString(fn), update); printlex(yy_flex_debug, FALSE, __FILE__, fn); @@ -1332,13 +1339,13 @@ static void cleanUpPaths(QStrList &str) if (fi.exists() && fi.isDir()) { int i = str.at(); - QCString p = fi.absFilePath().utf8(); - if (p[p.length()-1]!='/') p+='/'; + QCString path_str = fi.absFilePath().utf8(); + if (path_str[path_str.length()-1]!='/') path_str+='/'; str.remove(); if (str.at()==i) // did not remove last item - str.insert(i,p); + str.insert(i,path_str); else - str.append(p); + str.append(path_str); } } sfp = str.next(); @@ -1607,9 +1614,6 @@ void Config::checkAndCorrect() checkList(Config_getList(EXTRA_SEARCH_MAPPINGS),"EXTRA_SEARCH_MAPPING",TRUE,TRUE); } - // check TCL_SUBST - checkList(Config_getList(TCL_SUBST),"TCL_SUBST",TRUE,TRUE); - // check if GENERATE_TREEVIEW and GENERATE_HTMLHELP are both enabled if (Config_getBool(GENERATE_TREEVIEW) && Config_getBool(GENERATE_HTMLHELP)) { @@ -1674,7 +1678,7 @@ void Config::checkAndCorrect() } else if (dotNumThreads<=0) { - dotNumThreads=QMAX(2,QThread::idealThreadCount()+1); + dotNumThreads=QMAX(2,std::thread::hardware_concurrency()+1); } // check dot path @@ -2003,7 +2007,7 @@ void Config::postProcess(bool clearHeaderAndFooter, bool compare) if (!compare)ConfigImpl::instance()->emptyValueToDefault(); ConfigImpl::instance()->convertStrToVal(); - // avoid bootstrapping issues when the config file already + // avoid bootstrapping issues when the g_config file already // refers to the files that we are supposed to parse. if (clearHeaderAndFooter) { @@ -2019,4 +2023,6 @@ void Config::deinit() ConfigImpl::instance()->deleteInstance(); } +#if USE_STATE2STRING #include "configimpl.l.h" +#endif diff --git a/src/constexp.l b/src/constexp.l index 1c1678e..a14f8d3 100644 --- a/src/constexp.l +++ b/src/constexp.l @@ -35,8 +35,13 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 +#define USE_STATE2STRING 0 + +#if USE_STATE2STRING static const char *stateToString(int state); -static int yyread(char *buf,int max_size,yyscan_t yyscanner); +#endif + +static yy_size_t yyread(char *buf,yy_size_t max_size,yyscan_t yyscanner); #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size,yyscanner); @@ -96,10 +101,10 @@ CONSTSUFFIX ([uU][lL]?[lL]?)|([lL][lL]?[uU]?) %% -static int yyread(char *buf,int max_size,yyscan_t yyscanner) +static yy_size_t yyread(char *buf,yy_size_t max_size,yyscan_t yyscanner) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - int c=0; + yy_size_t c=0; while( c < max_size && yyextra->inputString[yyextra->inputPosition] ) { *buf = yyextra->inputString[yyextra->inputPosition++] ; @@ -156,4 +161,7 @@ bool ConstExpressionParser::parse(const char *fileName,int lineNr,const QCString extern "C" { int constexpYYwrap(yyscan_t yyscanner) { return 1; } } + +#if USE_STATE2STRING #include "constexp.l.h" +#endif diff --git a/src/context.cpp b/src/context.cpp index 5ee89cd..badcf22 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -180,14 +180,14 @@ class GenericNodeListContext : public TemplateListIntf } // TemplateListIntf methods - int count() const + uint count() const { - return (int)m_children.count(); + return m_children.count(); } - TemplateVariant at(int index) const + TemplateVariant at(uint index) const { TemplateVariant result; - if (index>=0 && index<count()) + if (index<count()) { result = *m_children.at(index); } @@ -380,7 +380,7 @@ class DoxygenContext::Private public: TemplateVariant version() const { - return getVersion(); + return getDoxygenVersion(); } TemplateVariant date() const { @@ -1397,6 +1397,7 @@ class DefinitionContext { assert(d!=0); } + virtual ~DefinitionContext() {} void addBaseProperties(PropertyMapper<T> &inst) { //%% string name: the name of the symbol @@ -1544,7 +1545,6 @@ class DefinitionContext case SrcLangExt_VHDL: result="vhdl"; break; case SrcLangExt_XML: result="xml"; break; case SrcLangExt_SQL: result="sql"; break; - case SrcLangExt_Tcl: result="tcl"; break; case SrcLangExt_Markdown: result="markdown"; break; case SrcLangExt_Slice: result="slice"; break; } @@ -1794,12 +1794,12 @@ IncludeInfoListContext::~IncludeInfoListContext() } // TemplateListIntf -int IncludeInfoListContext::count() const +uint IncludeInfoListContext::count() const { return p->count(); } -TemplateVariant IncludeInfoListContext::at(int index) const +TemplateVariant IncludeInfoListContext::at(uint index) const { return p->at(index); } @@ -2007,7 +2007,6 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> { case ContextOutputFormat_Html: { - QGString result; FTextStream tt(&result); QCString name = convertToHtml(m_classDef->displayName()); @@ -2136,7 +2135,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> return cache.inheritedByList.get(); } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, - MemberListType type,const char *title,bool detailed=FALSE) const + MemberListType type,const char *title,bool=FALSE) const { if (!list) { @@ -2834,7 +2833,7 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri return cache.constantgroups.get(); } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, - MemberListType type,const char *title,bool detailed=FALSE) const + MemberListType type,const char *title,bool=FALSE) const { if (!list) { @@ -3293,7 +3292,7 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> return cache.constantgroups.get(); } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, - MemberListType type,const char *title,bool detailed=FALSE) const + MemberListType type,const char *title,bool=FALSE) const { if (!list) { @@ -5564,7 +5563,7 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, - MemberListType type,const char *title,bool detailed=FALSE) const + MemberListType type,const char *title,bool=FALSE) const { if (!list) { @@ -5852,12 +5851,12 @@ ClassListContext::~ClassListContext() } // TemplateListIntf -int ClassListContext::count() const +uint ClassListContext::count() const { return p->count(); } -TemplateVariant ClassListContext::at(int index) const +TemplateVariant ClassListContext::at(uint index) const { return p->at(index); } @@ -6760,12 +6759,12 @@ NestingContext::~NestingContext() } // TemplateListIntf -int NestingContext::count() const +uint NestingContext::count() const { return p->count(); } -TemplateVariant NestingContext::at(int index) const +TemplateVariant NestingContext::at(uint index) const { return p->at(index); } @@ -6987,12 +6986,12 @@ NamespaceListContext::~NamespaceListContext() } // TemplateListIntf -int NamespaceListContext::count() const +uint NamespaceListContext::count() const { return p->count(); } -TemplateVariant NamespaceListContext::at(int index) const +TemplateVariant NamespaceListContext::at(uint index) const { return p->at(index); } @@ -7166,12 +7165,12 @@ FileListContext::~FileListContext() } // TemplateListIntf -int FileListContext::count() const +uint FileListContext::count() const { return p->count(); } -TemplateVariant FileListContext::at(int index) const +TemplateVariant FileListContext::at(uint index) const { return p->at(index); } @@ -7209,12 +7208,12 @@ DirListContext::~DirListContext() } // TemplateListIntf -int DirListContext::count() const +uint DirListContext::count() const { return p->count(); } -TemplateVariant DirListContext::at(int index) const +TemplateVariant DirListContext::at(uint index) const { return p->at(index); } @@ -7257,12 +7256,12 @@ UsedFilesContext::~UsedFilesContext() } // TemplateListIntf -int UsedFilesContext::count() const +uint UsedFilesContext::count() const { return p->count(); } -TemplateVariant UsedFilesContext::at(int index) const +TemplateVariant UsedFilesContext::at(uint index) const { return p->at(index); } @@ -7532,12 +7531,12 @@ PageListContext::~PageListContext() } // TemplateListIntf -int PageListContext::count() const +uint PageListContext::count() const { return p->count(); } -TemplateVariant PageListContext::at(int index) const +TemplateVariant PageListContext::at(uint index) const { return p->at(index); } @@ -7581,12 +7580,12 @@ ExampleListContext::~ExampleListContext() } // TemplateListIntf -int ExampleListContext::count() const +uint ExampleListContext::count() const { return p->count(); } -TemplateVariant ExampleListContext::at(int index) const +TemplateVariant ExampleListContext::at(uint index) const { return p->at(index); } @@ -7628,12 +7627,12 @@ ModuleListContext::~ModuleListContext() } // TemplateListIntf -int ModuleListContext::count() const +uint ModuleListContext::count() const { return p->count(); } -TemplateVariant ModuleListContext::at(int index) const +TemplateVariant ModuleListContext::at(uint index) const { return p->at(index); } @@ -8594,12 +8593,12 @@ InheritanceListContext::~InheritanceListContext() } // TemplateListIntf -int InheritanceListContext::count() const +uint InheritanceListContext::count() const { return p->count(); } -TemplateVariant InheritanceListContext::at(int index) const +TemplateVariant InheritanceListContext::at(uint index) const { return p->at(index); } @@ -8670,12 +8669,12 @@ MemberListContext::~MemberListContext() } // TemplateListIntf -int MemberListContext::count() const +uint MemberListContext::count() const { return p->count(); } -TemplateVariant MemberListContext::at(int index) const +TemplateVariant MemberListContext::at(uint index) const { return p->at(index); } @@ -8831,12 +8830,12 @@ AllMembersListContext::~AllMembersListContext() } // TemplateListIntf -int AllMembersListContext::count() const +uint AllMembersListContext::count() const { return p->count(); } -TemplateVariant AllMembersListContext::at(int index) const +TemplateVariant AllMembersListContext::at(uint index) const { return p->at(index); } @@ -9013,12 +9012,12 @@ MemberGroupListContext::~MemberGroupListContext() } // TemplateListIntf -int MemberGroupListContext::count() const +uint MemberGroupListContext::count() const { return p->count(); } -TemplateVariant MemberGroupListContext::at(int index) const +TemplateVariant MemberGroupListContext::at(uint index) const { return p->at(index); } @@ -9376,12 +9375,12 @@ InheritedMemberInfoListContext::~InheritedMemberInfoListContext() } // TemplateListIntf -int InheritedMemberInfoListContext::count() const +uint InheritedMemberInfoListContext::count() const { return p->count(); } -TemplateVariant InheritedMemberInfoListContext::at(int index) const +TemplateVariant InheritedMemberInfoListContext::at(uint index) const { return p->at(index); } @@ -9458,7 +9457,7 @@ class ArgumentContext::Private TemplateVariant namePart() const { QCString result = m_argument.attrib; - int l = result.length(); + uint l = result.length(); if (l>2 && result.at(0)=='[' && result.at(l-1)==']') { result = result.mid(1,l-2); @@ -9529,12 +9528,12 @@ ArgumentListContext::~ArgumentListContext() } // TemplateListIntf -int ArgumentListContext::count() const +uint ArgumentListContext::count() const { return p->count(); } -TemplateVariant ArgumentListContext::at(int index) const +TemplateVariant ArgumentListContext::at(uint index) const { return p->at(index); } @@ -9723,12 +9722,12 @@ SymbolListContext::~SymbolListContext() } // TemplateListIntf -int SymbolListContext::count() const +uint SymbolListContext::count() const { return p->count(); } -TemplateVariant SymbolListContext::at(int index) const +TemplateVariant SymbolListContext::at(uint index) const { return p->at(index); } @@ -9834,12 +9833,12 @@ SymbolGroupListContext::~SymbolGroupListContext() } // TemplateListIntf -int SymbolGroupListContext::count() const +uint SymbolGroupListContext::count() const { return p->count(); } -TemplateVariant SymbolGroupListContext::at(int index) const +TemplateVariant SymbolGroupListContext::at(uint index) const { return p->at(index); } @@ -9946,12 +9945,12 @@ SymbolIndicesContext::~SymbolIndicesContext() } // TemplateListIntf -int SymbolIndicesContext::count() const +uint SymbolIndicesContext::count() const { return p->count(); } -TemplateVariant SymbolIndicesContext::at(int index) const +TemplateVariant SymbolIndicesContext::at(uint index) const { return p->at(index); } @@ -10055,12 +10054,12 @@ SearchIndicesContext::~SearchIndicesContext() } // TemplateListIntf -int SearchIndicesContext::count() const +uint SearchIndicesContext::count() const { return p->count(); } -TemplateVariant SearchIndicesContext::at(int index) const +TemplateVariant SearchIndicesContext::at(uint index) const { return p->at(index); } diff --git a/src/context.h b/src/context.h index fc1278b..278cf05 100644 --- a/src/context.h +++ b/src/context.h @@ -189,8 +189,8 @@ class UsedFilesContext : public RefCountedContext, public TemplateListIntf static UsedFilesContext *alloc(const ClassDef *cd) { return new UsedFilesContext(cd); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -234,8 +234,8 @@ class IncludeInfoListContext : public RefCountedContext, public TemplateListIntf { return new IncludeInfoListContext(list,lang); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -390,8 +390,8 @@ class ClassListContext : public RefCountedContext, public TemplateListIntf static ClassListContext *alloc() { return new ClassListContext; } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -472,8 +472,8 @@ class ClassInheritanceContext : public RefCountedContext, public TemplateListInt static ClassInheritanceContext *alloc() { return new ClassInheritanceContext; } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -537,8 +537,8 @@ class NestingContext : public RefCountedContext, public TemplateListIntf { return new NestingContext(parent,level); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -589,8 +589,8 @@ class NamespaceListContext : public RefCountedContext, public TemplateListIntf static NamespaceListContext *alloc() { return new NamespaceListContext; } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -629,8 +629,8 @@ class DirListContext : public RefCountedContext, public TemplateListIntf static DirListContext *alloc() { return new DirListContext; } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -650,8 +650,8 @@ class FileListContext : public RefCountedContext, public TemplateListIntf static FileListContext *alloc() { return new FileListContext; } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -690,8 +690,8 @@ class PageListContext : public RefCountedContext, public TemplateListIntf static PageListContext *alloc(const PageSDict *pages) { return new PageListContext(pages); } // TemplateListIntf methods - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -751,8 +751,8 @@ class ModuleListContext : public RefCountedContext, public TemplateListIntf static ModuleListContext *alloc() { return new ModuleListContext(); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -794,8 +794,8 @@ class ExampleListContext : public RefCountedContext, public TemplateListIntf static ExampleListContext *alloc() { return new ExampleListContext; } // TemplateListIntf methods - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -933,8 +933,8 @@ class InheritanceListContext : public RefCountedContext, public TemplateListIntf { return new InheritanceListContext(list,baseClasses); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -959,8 +959,8 @@ class MemberListContext : public RefCountedContext, public TemplateListIntf { return new MemberListContext(ml,doSort); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1007,8 +1007,8 @@ class MemberGroupListContext : public RefCountedContext, public TemplateListIntf { return new MemberGroupListContext(def,relPath,dict,subGrouping); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1095,8 +1095,8 @@ class InheritedMemberInfoListContext : public RefCountedContext, public Template void addMemberList(const ClassDef *cd,MemberListType lt,const QCString &title,bool additionalList=TRUE); // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1119,8 +1119,8 @@ class AllMembersListContext : public RefCountedContext, public TemplateListIntf { return new AllMembersListContext(ml); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1163,8 +1163,8 @@ class ArgumentListContext : public RefCountedContext, public TemplateListIntf { return new ArgumentListContext(al,def,relPath); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1206,8 +1206,8 @@ class SymbolListContext : public RefCountedContext, public TemplateListIntf { return new SymbolListContext(sdl); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1248,8 +1248,8 @@ class SymbolGroupListContext : public RefCountedContext, public TemplateListIntf { return new SymbolGroupListContext(sil); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1290,8 +1290,8 @@ class SymbolIndicesContext : public RefCountedContext, public TemplateListIntf { return new SymbolIndicesContext(info); } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } @@ -1331,8 +1331,8 @@ class SearchIndicesContext : public RefCountedContext, public TemplateListIntf static SearchIndicesContext *alloc() { return new SearchIndicesContext; } // TemplateListIntf - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } diff --git a/src/declinfo.l b/src/declinfo.l index 1660033..2f497f9 100644 --- a/src/declinfo.l +++ b/src/declinfo.l @@ -42,7 +42,9 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 #define YY_NEVER_INTERACTIVE 1 - + +#define USE_STATE2STRING 0 + /* ----------------------------------------------------------------- * * statics @@ -66,10 +68,13 @@ struct declinfoYY_state bool insidePHP; }; +#if USE_STATE2STRING static const char *stateToString(int state); +#endif + static void addType(yyscan_t yyscanner); static void addTypeName(yyscan_t yyscanner); -static int yyread(char *buf,int max_size, yyscan_t yyscanner); +static yy_size_t yyread(char *buf,yy_size_t max_size, yyscan_t yyscanner); /* ----------------------------------------------------------------- */ @@ -237,16 +242,16 @@ static void addTypeName(yyscan_t yyscanner) yyextra->name.resize(0); } -static int yyread(char *buf,int max_size, yyscan_t yyscanner) +static yy_size_t yyread(char *buf,yy_size_t max_size, yyscan_t yyscanner) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - int c=0; - while( c < max_size && yyextra->inputString[yyextra->inputPosition] ) - { - *buf = yyextra->inputString[yyextra->inputPosition++] ; - c++; buf++; - } - return c; + yy_size_t c=0; + while( c < max_size && yyextra->inputString[yyextra->inputPosition] ) + { + *buf = yyextra->inputString[yyextra->inputPosition++] ; + c++; buf++; + } + return c; } /*@ public interface------------------------------------------------------------ @@ -383,5 +388,6 @@ int main() } #endif - +#if USE_STATE2STRING #include "declinfo.l.h" +#endif diff --git a/src/defargs.l b/src/defargs.l index e6f74c1..2541a43 100644 --- a/src/defargs.l +++ b/src/defargs.l @@ -67,6 +67,8 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 + +#define USE_STATE2STRING 0 /* ----------------------------------------------------------------- * state variables @@ -98,8 +100,11 @@ struct defargsYY_state QCString delimiter; }; +#if USE_STATE2STRING static const char *stateToString(int state); -static int yyread(yyscan_t yyscanner,char *buf,int max_size); +#endif + +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); static bool nameIsActuallyPartOfType(QCString &name); /* ----------------------------------------------------------------- @@ -420,7 +425,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" if (alen>2 && a.array.at(0)=='(' && a.array.at(alen-1)==')') // fix-up for int *(a[10]) { - int i=a.array.find('[')-1; + i=a.array.find('[')-1; a.array = a.array.mid(1,alen-2); if (i>0 && a.name.isEmpty()) { @@ -572,10 +577,10 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" /* ---------------------------------------------------------------------------- */ -static int yyread(yyscan_t yyscanner,char *buf,int max_size) +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - int c=0; + yy_size_t c=0; while( c < max_size && yyextra->inputString[yyextra->inputPosition] ) { *buf = yyextra->inputString[yyextra->inputPosition++] ; @@ -637,13 +642,13 @@ void class KeywordHash { private: - static inline unsigned int hash (const char *str, size_t len); + static inline unsigned int hash (const char *str, unsigned int len); public: - static const char *find (const char *str, size_t len); + static const char *find (const char *str, unsigned int len); }; inline unsigned int -KeywordHash::hash (const char *str, size_t len) +KeywordHash::hash (const char *str, unsigned int len) { static const unsigned char asso_values[] = { @@ -691,7 +696,7 @@ KeywordHash::hash (const char *str, size_t len) } const char * -KeywordHash::find (const char *str, size_t len) +KeywordHash::find (const char *str, unsigned int len) { static const char * const wordlist[] = { @@ -789,4 +794,6 @@ void stringToArgumentList(SrcLangExt lang, const char *argsString,ArgumentList& defargsYYlex_destroy(yyscanner); } +#if USE_STATE2STRING #include "defargs.l.h" +#endif diff --git a/src/definition.cpp b/src/definition.cpp index 28b552b..22a1435 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -122,8 +122,8 @@ void DefinitionImpl::IMPL::setDefFileName(const QCString &df) void DefinitionImpl::IMPL::init(const char *df, const char *n) { setDefFileName(df); - QCString name = n; - if (name!="<globalScope>") + QCString lname = n; + if (lname!="<globalScope>") { //extractNamespaceName(m_name,m_localName,ns); localName=stripScope(n); @@ -175,15 +175,16 @@ static bool matchExcludedSymbols(const char *name) if (pattern.find('*')!=-1) // wildcard mode { QRegExp re(substitute(pattern,"*",".*"),TRUE); - int i,pl; - i = re.match(symName,0,&pl); + int pl; + int i = re.match(symName,0,&pl); //printf(" %d = re.match(%s) pattern=%s\n",i,symName.data(),pattern.data()); if (i!=-1) // wildcard match { - int sl=symName.length(); + uint ui=(uint)i; + uint sl=symName.length(); // check if it is a whole word match - if ((i==0 || pattern.at(0)=='*' || (!isId(symName.at(i-1)) && !forceStart)) && - (i+pl==sl || pattern.at(i+pl)=='*' || (!isId(symName.at(i+pl)) && !forceEnd)) + if ((ui==0 || pattern.at(0)=='*' || (!isId(symName.at(ui-1)) && !forceStart)) && + (ui+pl==sl || pattern.at(ui+pl)=='*' || (!isId(symName.at(ui+pl)) && !forceEnd)) ) { //printf("--> name=%s pattern=%s match at %d\n",symName.data(),pattern.data(),i); @@ -196,11 +197,12 @@ static bool matchExcludedSymbols(const char *name) int i = symName.find(pattern); if (i!=-1) // we have a match! { - int pl=pattern.length(); - int sl=symName.length(); + uint ui=(uint)i; + uint pl=pattern.length(); + uint sl=symName.length(); // check if it is a whole word match - if ((i==0 || (!isId(symName.at(i-1)) && !forceStart)) && - (i+pl==sl || (!isId(symName.at(i+pl)) && !forceEnd)) + if ((ui==0 || (!isId(symName.at(ui-1)) && !forceStart)) && + (ui+pl==sl || (!isId(symName.at(ui+pl)) && !forceEnd)) ) { //printf("--> name=%s pattern=%s match at %d\n",symName.data(),pattern.data(),i); @@ -597,10 +599,10 @@ void DefinitionImpl::setDocumentation(const char *d,const char *docFile,int docL // if that is a multibyte one. static bool lastCharIsMultibyte(const QCString &s) { - int l = s.length(); + uint l = s.length(); int p = 0; int pp = -1; - while ((p=nextUtf8CharPosition(s,l,p))<l) pp=p; + while ((p=nextUtf8CharPosition(s,l,(uint)p))<(int)l) pp=p; if (pp==-1 || ((uchar)s[pp])<0x80) return FALSE; return TRUE; } @@ -614,7 +616,7 @@ void DefinitionImpl::_setBriefDescription(const char *b,const char *briefFile,in QCString brief = b; brief = brief.stripWhiteSpace(); if (brief.isEmpty()) return; - int bl = brief.length(); + uint bl = brief.length(); if (bl>0 && needsDot) // add punctuation if needed { int c = brief.at(bl-1); @@ -734,7 +736,7 @@ class FilterCache if (numBytes!=item->fileSize) { err("Failed to read %d bytes from position %d in filter database file %s: got %d bytes\n", - (int)item->fileSize,(int)item->filePos,qPrint(Doxygen::filterDBFileName),numBytes); + (int)item->fileSize,(int)item->filePos,qPrint(Doxygen::filterDBFileName),(int)numBytes); success=FALSE; } } @@ -756,7 +758,7 @@ class FilterCache Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",qPrint(cmd)); f = Portable::popen(cmd,"r"); FILE *bf = Portable::fopen(Doxygen::filterDBFileName,"a+b"); - FilterCacheItem *item = new FilterCacheItem; + item = new FilterCacheItem; item->filePos = m_endPos; if (bf==0) { @@ -785,7 +787,7 @@ class FilterCache return FALSE; } size+=bytesWritten; - str.addArray(buf,static_cast<int>(bytesWritten)); + str.addArray(buf,static_cast<uint>(bytesWritten)); } str.addChar('\0'); item->fileSize = size; @@ -806,7 +808,7 @@ class FilterCache while (!feof(f)) { size_t bytesRead = fread(buf,1,blockSize,f); - str.addArray(buf,static_cast<int>(bytesRead)); + str.addArray(buf,static_cast<uint>(bytesRead)); } str.addChar('\0'); fclose(f); @@ -848,14 +850,13 @@ bool readCodeFragment(const char *fileName, g_filterCache.getFileContents(fileName,str); bool found = lang==SrcLangExt_VHDL || - lang==SrcLangExt_Tcl || lang==SrcLangExt_Python || lang==SrcLangExt_Fortran; - // for VHDL, TCL, Python, and Fortran no bracket search is possible + // for VHDL, Python, and Fortran no bracket search is possible char *p=str.data(); if (p) { - int c=0; + char c=0; int col=0; int lineNr=1; // skip until the startLine has reached @@ -958,7 +959,7 @@ bool readCodeFragment(const char *fileName, int braceIndex = result.findRev('}'); if (braceIndex > newLineIndex) { - result.truncate(braceIndex+1); + result.truncate((uint)braceIndex+1); } endLine=lineNr-1; } @@ -997,11 +998,11 @@ QCString DefinitionImpl::getSourceAnchor() const { if (Htags::useHtags) { - qsnprintf(anchorStr,maxAnchorStrLen,"L%d",m_impl->body->startLine); + qsnprintf(anchorStr,maxAnchorStrLen,"L%d",m_impl->body->defLine); } else { - qsnprintf(anchorStr,maxAnchorStrLen,"l%05d",m_impl->body->startLine); + qsnprintf(anchorStr,maxAnchorStrLen,"l%05d",m_impl->body->defLine); } } return anchorStr; @@ -1024,7 +1025,7 @@ void DefinitionImpl::writeSourceDef(OutputList &ol,const char *) const if (lineMarkerPos!=-1 && fileMarkerPos!=-1) // should always pass this. { QCString lineStr; - lineStr.sprintf("%d",m_impl->body->startLine); + lineStr.sprintf("%d",m_impl->body->defLine); QCString anchorStr = getSourceAnchor(); ol.startParagraph("definition"); if (lineMarkerPos<fileMarkerPos) // line marker before file marker @@ -1102,10 +1103,9 @@ void DefinitionImpl::writeSourceDef(OutputList &ol,const char *) const // write normal text (Man, Latex optionally, RTF optionally) ol.docify(m_impl->body->fileDef->name()); ol.popGeneratorState(); - + // write text right from file marker - ol.parseText(refText.right( - refText.length()-fileMarkerPos-2)); + ol.parseText(refText.right(refText.length()-(uint)fileMarkerPos-2)); } else // file marker before line marker { @@ -1185,8 +1185,7 @@ void DefinitionImpl::writeSourceDef(OutputList &ol,const char *) const ol.popGeneratorState(); // write text right from linePos marker - ol.parseText(refText.right( - refText.length()-lineMarkerPos-2)); + ol.parseText(refText.right(refText.length()-(uint)lineMarkerPos-2)); } ol.endParagraph(); } @@ -1198,12 +1197,13 @@ void DefinitionImpl::writeSourceDef(OutputList &ol,const char *) const ol.popGeneratorState(); } -void DefinitionImpl::setBodySegment(int bls,int ble) +void DefinitionImpl::setBodySegment(int defLine, int bls,int ble) { //printf("setBodySegment(%d,%d) for %s\n",bls,ble,name().data()); if (m_impl->body==0) m_impl->body = new BodyInfo; - m_impl->body->startLine=bls; - m_impl->body->endLine=ble; + m_impl->body->defLine = defLine; + m_impl->body->startLine = bls; + m_impl->body->endLine = ble; } void DefinitionImpl::setBodyDef(FileDef *fd) @@ -1282,15 +1282,17 @@ void DefinitionImpl::_writeSourceRefList(OutputList &ol,const char *scopeName, ol.parseText(text); ol.docify(" "); - QCString ldefLine=theTranslator->trWriteList(members->count()); + QCString ldefLine=theTranslator->trWriteList((int)members->count()); QRegExp marker("@[0-9]+"); - int index=0,newIndex,matchLen; + uint index=0; + int matchLen; + int newIndex; // now replace all markers in inheritLine with links to the classes while ((newIndex=marker.match(ldefLine,index,&matchLen))!=-1) { bool ok; - ol.parseText(ldefLine.mid(index,newIndex-index)); + ol.parseText(ldefLine.mid(index,(uint)newIndex-index)); uint entryIndex = ldefLine.mid(newIndex+1,matchLen-1).toUInt(&ok); MemberDef *md=members->at(entryIndex); if (ok && md) @@ -1408,7 +1410,7 @@ void DefinitionImpl::_writeSourceRefList(OutputList &ol,const char *scopeName, ol.docify(name); } } - index=newIndex+matchLen; + index=(uint)newIndex+matchLen; } ol.parseText(ldefLine.right(ldefLine.length()-index)); ol.writeString("."); @@ -1747,7 +1749,7 @@ void DefinitionImpl::writeToc(OutputList &ol, const LocalToc &localToc) const int level=1,l; char cs[2]; cs[1]='\0'; - bool inLi[5]={ FALSE, FALSE, FALSE, FALSE, FALSE }; + std::vector<bool> inLi(maxLevel+1,false); for (const SectionInfo *si : m_impl->sectionRefs) { SectionType type = si->type(); @@ -1767,11 +1769,11 @@ void DefinitionImpl::writeToc(OutputList &ol, const LocalToc &localToc) const for (l=level;l>nextLevel;l--) { if (l <= maxLevel && inLi[l]) ol.writeString("</li>\n"); - inLi[l]=FALSE; + inLi[l]=false; if (l <= maxLevel) ol.writeString("</ul>\n"); } } - cs[0]='0'+nextLevel; + cs[0]=(char)('0'+nextLevel); if (nextLevel <= maxLevel && inLi[nextLevel]) { ol.writeString("</li>\n"); @@ -1783,7 +1785,7 @@ void DefinitionImpl::writeToc(OutputList &ol, const LocalToc &localToc) const "<a href=\"#"+si->label()+"\">"+ (si->title().isEmpty()?si->label():titleDoc)+"</a>"); } - inLi[nextLevel]=TRUE; + inLi[nextLevel]=true; level = nextLevel; } } @@ -1799,7 +1801,7 @@ void DefinitionImpl::writeToc(OutputList &ol, const LocalToc &localToc) const level--; } if (level <= maxLevel && inLi[level]) ol.writeString("</li>\n"); - inLi[level]=FALSE; + inLi[level]=false; ol.writeString("</ul>\n"); ol.writeString("</div>\n"); ol.popGeneratorState(); @@ -1812,8 +1814,8 @@ void DefinitionImpl::writeToc(OutputList &ol, const LocalToc &localToc) const ol.writeString(" <toc>\n"); ol.writeString(" <title>" + theTranslator->trRTFTableOfContents() + "</title>\n"); int level=1,l; - bool inLi[5]={ FALSE, FALSE, FALSE, FALSE, FALSE }; int maxLevel = localToc.docbookLevel(); + std::vector<bool> inLi(maxLevel+1,false); for (const SectionInfo *si : m_impl->sectionRefs) { SectionType type = si->type(); @@ -1932,17 +1934,17 @@ QCString abbreviate(const char *s,const char *name) const char *p = briefDescAbbrev.first(); while (p) { - QCString s = p; - s.replace(QRegExp("\\$name"), scopelessName); // replace $name with entity name - s += " "; - stripWord(result,s); + QCString str = p; + str.replace(QRegExp("\\$name"), scopelessName); // replace $name with entity name + str += " "; + stripWord(result,str); p = briefDescAbbrev.next(); } // capitalize first word if (!result.isEmpty()) { - int c=result[0]; + char c=result[0]; if (c>='a' && c<='z') c+='A'-'a'; result[0]=c; } @@ -2055,6 +2057,11 @@ bool DefinitionImpl::isReference() const return !m_impl->ref.isEmpty(); } +int DefinitionImpl::getStartDefLine() const +{ + return m_impl->body ? m_impl->body->defLine : -1; +} + int DefinitionImpl::getStartBodyLine() const { return m_impl->body ? m_impl->body->startLine : -1; @@ -2161,7 +2168,7 @@ QCString DefinitionImpl::externalReference(const QCString &relPath) const if (dest) { QCString result = *dest; - int l = result.length(); + uint l = result.length(); if (!relPath.isEmpty() && l>0 && result.at(0)=='.') { // relative path -> prepend relPath. result.prepend(relPath); diff --git a/src/definition.h b/src/definition.h index f28b47f..318a35b 100644 --- a/src/definition.h +++ b/src/definition.h @@ -62,8 +62,9 @@ struct BriefInfo /** Data associated with description found in the body. */ struct BodyInfo { - int startLine; //!< line number of the start of the definition - int endLine; //!< line number of the end of the definition + int defLine; //!< line number of the start of the definition + int startLine; //!< line number of the start of the definition's body + int endLine; //!< line number of the end of the definition's body FileDef *fileDef; //!< file definition containing the function body }; @@ -188,7 +189,7 @@ class Definition : public DefinitionIntf /*! returns the extension of the file in which this definition was found */ virtual QCString getDefFileExtension() const = 0; - /*! returns the line number at which the definition was found */ + /*! returns the line number at which the definition was found (can be the declaration) */ virtual int getDefLine() const = 0; /*! returns the column number at which the definition was found */ @@ -242,6 +243,9 @@ class Definition : public DefinitionIntf /*! Convenience method to return a resolved external link */ virtual QCString externalReference(const QCString &relPath) const = 0; + /*! Returns the first line of the implementation of this item. See also getDefLine() */ + virtual int getStartDefLine() const = 0; + /*! Returns the first line of the body of this item (applicable to classes and * functions). */ @@ -316,7 +320,7 @@ class Definition : public DefinitionIntf virtual void setReference(const char *r) = 0; // source references - virtual void setBodySegment(int bls,int ble) = 0; + virtual void setBodySegment(int defLine, int bls,int ble) = 0; virtual void setBodyDef(FileDef *fd) = 0; virtual void setRefItems(const std::vector<RefItem*> &sli) = 0; diff --git a/src/definitionimpl.h b/src/definitionimpl.h index d66ac93..28d60b6 100644 --- a/src/definitionimpl.h +++ b/src/definitionimpl.h @@ -61,6 +61,7 @@ class DefinitionImpl : virtual public Definition virtual QCString getReference() const; virtual bool isReference() const; virtual QCString externalReference(const QCString &relPath) const; + virtual int getStartDefLine() const; virtual int getStartBodyLine() const; virtual int getEndBodyLine() const; virtual FileDef *getBodyDef() const; @@ -85,7 +86,7 @@ class DefinitionImpl : virtual public Definition virtual void setInbodyDocumentation(const char *d,const char *docFile,int docLine); virtual void setReference(const char *r); virtual void addSectionsToDefinition(const std::vector<const SectionInfo*> &anchorList); - virtual void setBodySegment(int bls,int ble); + virtual void setBodySegment(int defLine,int bls,int ble); virtual void setBodyDef(FileDef *fd); virtual void addSourceReferencedBy(const MemberDef *d); virtual void addSourceReferences(const MemberDef *d); @@ -201,6 +202,8 @@ class DefinitionAliasImpl : virtual public Definition { return m_def->isReference(); } virtual QCString externalReference(const QCString &relPath) const { return m_def->externalReference(relPath); } + virtual int getStartDefLine() const + { return m_def->getStartDefLine(); } virtual int getStartBodyLine() const { return m_def->getStartBodyLine(); } virtual int getEndBodyLine() const @@ -237,37 +240,37 @@ class DefinitionAliasImpl : virtual public Definition { return m_def->navigationPathAsString(); } virtual QCString pathFragment() const { return m_def->pathFragment(); } - virtual void setName(const char *name) { } - virtual void setId(const char *name) { } - virtual void setDefFile(const QCString& df,int defLine,int defColumn) {} - virtual void setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace=TRUE) {} - virtual void setBriefDescription(const char *b,const char *briefFile,int briefLine) {} - virtual void setInbodyDocumentation(const char *d,const char *docFile,int docLine) {} - virtual void setReference(const char *r) {} - virtual void addSectionsToDefinition(const std::vector<const SectionInfo*> &anchorList) {} - virtual void setBodySegment(int bls,int ble) {} - virtual void setBodyDef(FileDef *fd) {} - virtual void addSourceReferencedBy(const MemberDef *d) {} - virtual void addSourceReferences(const MemberDef *d) {} - virtual void setRefItems(const std::vector<RefItem*> &sli) {} - virtual void mergeRefItems(Definition *d) {} - virtual void addInnerCompound(const Definition *d) {} - virtual void setOuterScope(Definition *d) {} - virtual void setHidden(bool b) {} - virtual void setArtificial(bool b) {} - virtual void setLanguage(SrcLangExt lang) {} - virtual void writeSourceDef(OutputList &ol,const char *scopeName) const {} - virtual void writeInlineCode(OutputList &ol,const char *scopeName) const {} - virtual void writeSourceRefs(OutputList &ol,const char *scopeName) const {} - virtual void writeSourceReffedBy(OutputList &ol,const char *scopeName) const {} - virtual void makePartOfGroup(GroupDef *gd) {} - virtual void writeNavigationPath(OutputList &ol) const {} + virtual void setName(const char *) { } + virtual void setId(const char *) { } + virtual void setDefFile(const QCString&,int,int) {} + virtual void setDocumentation(const char *,const char *,int,bool=TRUE) {} + virtual void setBriefDescription(const char *,const char *,int) {} + virtual void setInbodyDocumentation(const char *,const char *,int) {} + virtual void setReference(const char *) {} + virtual void addSectionsToDefinition(const std::vector<const SectionInfo*> &) {} + virtual void setBodySegment(int,int,int) {} + virtual void setBodyDef(FileDef *) {} + virtual void addSourceReferencedBy(const MemberDef *) {} + virtual void addSourceReferences(const MemberDef *) {} + virtual void setRefItems(const std::vector<RefItem*> &) {} + virtual void mergeRefItems(Definition *) {} + virtual void addInnerCompound(const Definition *) {} + virtual void setOuterScope(Definition *) {} + virtual void setHidden(bool) {} + virtual void setArtificial(bool) {} + virtual void setLanguage(SrcLangExt) {} + virtual void writeSourceDef(OutputList &,const char *) const {} + virtual void writeInlineCode(OutputList &,const char *) const {} + virtual void writeSourceRefs(OutputList &,const char *) const {} + virtual void writeSourceReffedBy(OutputList &,const char *) const {} + virtual void makePartOfGroup(GroupDef *) {} + virtual void writeNavigationPath(OutputList &) const {} virtual void writeQuickMemberLinks(OutputList &,const MemberDef *) const {} virtual void writeSummaryLinks(OutputList &) const {} virtual void writeDocAnchorsToTagFile(FTextStream &) const {} - virtual void setLocalName(const QCString name) {} + virtual void setLocalName(const QCString) {} virtual void addSectionsToIndex() {} - virtual void writeToc(OutputList &ol, const LocalToc <) const {} + virtual void writeToc(OutputList &, const LocalToc &) const {} virtual void setCookie(Cookie *cookie) const { delete m_cookie; m_cookie = cookie; } virtual Cookie *cookie() const { return m_cookie; } protected: diff --git a/src/diagram.cpp b/src/diagram.cpp index 25b2c06..d0b7a08 100644 --- a/src/diagram.cpp +++ b/src/diagram.cpp @@ -42,20 +42,20 @@ class DiagramItemList; class DiagramItem { public: - DiagramItem(DiagramItem *p,int number,const ClassDef *cd, + DiagramItem(DiagramItem *p,uint number,const ClassDef *cd, Protection prot,Specifier virt,const char *ts); ~DiagramItem(); QCString label() const; QCString fileName() const; DiagramItem *parentItem() { return parent; } DiagramItemList *getChildren() { return children; } - void move(int dx,int dy) { x+=dx; y+=dy; } - int xPos() const { return x; } - int yPos() const { return y; } - int avgChildPos() const; - int numChildren() const; + void move(int dx,int dy) { x+=(uint)dx; y+=(uint)dy; } + uint xPos() const { return x; } + uint yPos() const { return y; } + uint avgChildPos() const; + uint numChildren() const; void addChild(DiagramItem *di); - int number() const { return num; } + uint number() const { return num; } Protection protection() const { return prot; } Specifier virtualness() const { return virt; } void putInList() { inList=TRUE; } @@ -64,8 +64,8 @@ class DiagramItem private: DiagramItemList *children; DiagramItem *parent; - int x,y; - int num; + uint x,y; + uint num; Protection prot; Specifier virt; QCString templSpec; @@ -85,8 +85,8 @@ class DiagramItemList : public QList<DiagramItem> class DiagramRow : public QList<DiagramItem> { public: - DiagramRow(TreeDiagram *d,int l) : QList<DiagramItem>() - { + DiagramRow(TreeDiagram *d,uint l) : QList<DiagramItem>() + { diagram=d; level=l; setAutoDelete(TRUE); @@ -129,7 +129,7 @@ class TreeDiagram : public QList<DiagramRow> uint baseRows,uint superRows, uint cellWidth,uint cellheight); private: - bool layoutTree(DiagramItem *root,int row); + bool layoutTree(DiagramItem *root,uint row); TreeDiagram &operator=(const TreeDiagram &); TreeDiagram(const TreeDiagram &); }; @@ -139,8 +139,8 @@ class TreeDiagram : public QList<DiagramRow> //----------------------------------------------------------------------------- const uint maxTreeWidth = 8; -const int gridWidth = 100; -const int gridHeight = 100; +const uint gridWidth = 100; +const uint gridHeight = 100; const uint labelHorSpacing = 10; // horizontal distance between labels const uint labelVertSpacing = 32; // vertical distance between labels @@ -171,7 +171,7 @@ static uint protToMask(Protection p) return 0; } -static uint protToColor(Protection p) +static uchar protToColor(Protection p) { switch(p) { @@ -225,21 +225,23 @@ static Protection getMinProtectionLevel(DiagramItemList *dil) } static void writeBitmapBox(DiagramItem *di,Image *image, - int x,int y,int w,int h,bool firstRow, + uint x,uint y,uint w,uint h,bool firstRow, bool hasDocs,bool children=FALSE) { - int colFill = hasDocs ? (firstRow ? 0 : 2) : 7; - int colBorder = (firstRow || !hasDocs) ? 1 : 3; - int l = Image::stringLength(di->label()); + uchar colFill = hasDocs ? (firstRow ? 0 : 2) : 7; + uchar colBorder = (firstRow || !hasDocs) ? 1 : 3; + uint l = Image::stringLength(di->label()); uint mask=virtToMask(di->virtualness()); image->fillRect(x+1,y+1,w-2,h-2,colFill,mask); image->drawRect(x,y,w,h,colBorder,mask); image->writeString(x+(w-l)/2, y+(h-fontHeight)/2, di->label(),1); if (children) { - int i; + uint i; for (i=0;i<5;i++) + { image->drawHorzLine(y+h+i-6,x+w-2-i,x+w-2,firstRow?1:3,0xffffffff); + } } } @@ -253,7 +255,7 @@ static void writeVectorBox(FTextStream &t,DiagramItem *di, } static void writeMapArea(FTextStream &t,const ClassDef *cd,QCString relPath, - int x,int y,int w,int h) + uint x,uint y,uint w,uint h) { if (cd->isLinkable()) { @@ -283,12 +285,11 @@ static void writeMapArea(FTextStream &t,const ClassDef *cd,QCString relPath, } //----------------------------------------------------------------------------- -DiagramItem::DiagramItem(DiagramItem *p,int number,const ClassDef *cd, +DiagramItem::DiagramItem(DiagramItem *p,uint number,const ClassDef *cd, Protection pr,Specifier vi,const char *ts) -{ - parent=p; - x=y=0; - //name=n; +{ + parent=p; + x=y=0; num=number; children = new DiagramItemList; prot=pr; @@ -297,9 +298,9 @@ DiagramItem::DiagramItem(DiagramItem *p,int number,const ClassDef *cd, classDef=cd; templSpec=ts; } - + DiagramItem::~DiagramItem() -{ +{ delete children; } @@ -330,10 +331,10 @@ QCString DiagramItem::fileName() const return classDef->getOutputFileBase(); } -int DiagramItem::avgChildPos() const +uint DiagramItem::avgChildPos() const { DiagramItem *di; - int c=children->count(); + uint c=children->count(); if (c==0) // no children -> don't move return xPos(); if ((di=children->getFirst())->isInList()) // children should be in a list @@ -344,7 +345,7 @@ int DiagramItem::avgChildPos() const return (children->at(c/2-1)->xPos()+children->at(c/2)->xPos())/2; } -int DiagramItem::numChildren() const +uint DiagramItem::numChildren() const { return children->count(); } @@ -363,7 +364,7 @@ void DiagramRow::insertClass(DiagramItem *parent,const ClassDef *cd,bool doBases cd,prot,virt,ts); //cd->visited=TRUE; if (parent) parent->addChild(di); - di->move(count()*gridWidth,level*gridHeight); + di->move((int)(count()*gridWidth),(int)(level*gridHeight)); append(di); BaseClassList *bcl=doBases ? cd->baseClasses() : cd->subClasses(); int count=0; @@ -431,7 +432,7 @@ void TreeDiagram::moveChildren(DiagramItem *root,int dx) } } -bool TreeDiagram::layoutTree(DiagramItem *root,int r) +bool TreeDiagram::layoutTree(DiagramItem *root,uint r) { bool moved=FALSE; //printf("layoutTree(%s,%d)\n",root->label().data(),r); @@ -440,15 +441,15 @@ bool TreeDiagram::layoutTree(DiagramItem *root,int r) if (dil->count()>0) { uint k; - int pPos=root->xPos(); - int cPos=root->avgChildPos(); + uint pPos=root->xPos(); + uint cPos=root->avgChildPos(); if (pPos>cPos) // move children { DiagramRow *row=at(r+1); //printf("Moving children %d-%d in row %d\n", // dil->getFirst()->number(),row->count()-1,r+1); for (k=dil->getFirst()->number();k<row->count();k++) - row->at(k)->move(pPos-cPos,0); + row->at(k)->move((int)(pPos-cPos),0); moved=TRUE; } else if (pPos<cPos) // move parent @@ -457,7 +458,7 @@ bool TreeDiagram::layoutTree(DiagramItem *root,int r) //printf("Moving parents %d-%d in row %d\n", // root->number(),row->count()-1,r); for (k=root->number();k<row->count();k++) - row->at(k)->move(cPos-pPos,0); + row->at(k)->move((int)(cPos-pPos),0); moved=TRUE; } @@ -525,7 +526,7 @@ void TreeDiagram::computeLayout() uint TreeDiagram::computeRows() { //printf("TreeDiagram::computeRows()=%d\n",count()); - int count=0; + uint count=0; QListIterator<DiagramRow> it(*this); DiagramRow *row; for (;(row=it.current()) && !row->getFirst()->isInList();++it) @@ -535,8 +536,8 @@ uint TreeDiagram::computeRows() //printf("count=%d row=%p\n",count,row); if (row) { - int maxListLen=0; - int curListLen=0; + uint maxListLen=0; + uint curListLen=0; DiagramItem *opi=0; QListIterator<DiagramItem> rit(*row); DiagramItem *di; @@ -587,7 +588,7 @@ void TreeDiagram::drawBoxes(FTextStream &t,Image *image, bool firstRow = doBase; for (;(dr=it.current()) && !done;++it) { - int x=0,y=0; + uint x=0,y=0; float xf=0.0f,yf=0.0f; QListIterator<DiagramItem> rit(*dr); DiagramItem *di = rit.current(); @@ -617,7 +618,7 @@ void TreeDiagram::drawBoxes(FTextStream &t,Image *image, x = di->xPos()*(cellWidth+labelHorSpacing)/gridWidth; if (doBase) { - y = image->getHeight()- + y = image->height()- superRows*cellHeight- (superRows-1)*labelVertSpacing- di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; @@ -669,7 +670,7 @@ void TreeDiagram::drawBoxes(FTextStream &t,Image *image, x = di->xPos()*(cellWidth+labelHorSpacing)/gridWidth; if (doBase) { - y = image->getHeight()- + y = image->height()- superRows*cellHeight- (superRows-1)*labelVertSpacing- di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; @@ -717,7 +718,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, DiagramItem *di = rit.current(); if (di->isInList()) // row consists of list connectors { - int x=0,y=0,ys=0; + uint x=0,y=0,ys=0; float xf=0.0f,yf=0.0f,ysf=0.0f; for (;(di=rit.current());++rit) { @@ -731,7 +732,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, x = di->xPos()*(cellWidth+labelHorSpacing)/gridWidth + cellWidth/2; if (doBase) // base classes { - y = image->getHeight()- + y = image->height()- (superRows-1)*(cellHeight+labelVertSpacing)- di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; image->drawVertArrow(x,y,y+labelVertSpacing/2, @@ -759,7 +760,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, else { t << "0 " << (di->xPos()/(float)gridWidth) << " " - << ((float)superRows-0.25-di->yPos()/(float)gridHeight) + << ((float)superRows-0.25f-di->yPos()/(float)gridHeight) << " in\n"; } } @@ -772,7 +773,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, (cellWidth+labelHorSpacing)/gridWidth+cellWidth/2; if (doBase) // base classes { - ys = image->getHeight()- + ys = image->height()- (superRows-1)*(cellHeight+labelVertSpacing)- di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; y = ys - cellHeight/2; @@ -873,7 +874,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, } else { - t << xf << " " << (ysf + 0.25) << " " << yf << " vedge\n"; + t << xf << " " << (ysf + 0.25f) << " " << yf << " vedge\n"; } } } @@ -884,7 +885,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, { for (;(di=rit.current());++rit) { - int x=0,y=0; + uint x=0,y=0; DiagramItemList *dil = di->getChildren(); DiagramItem *parent = di->parentItem(); if (parent) // item has a parent -> connect to it @@ -894,7 +895,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, x = di->xPos()*(cellWidth+labelHorSpacing)/gridWidth + cellWidth/2; if (doBase) // base classes { - y = image->getHeight()- + y = image->height()- (superRows-1)*(cellHeight+labelVertSpacing)- di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; /* write input line */ @@ -924,7 +925,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, else { t << "0 " << di->xPos()/(float)gridWidth << " " - << ((float)superRows-0.25-di->yPos()/(float)gridHeight) + << ((float)superRows-0.25f-di->yPos()/(float)gridHeight) << " in\n"; } } @@ -933,13 +934,13 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, { Protection p=getMinProtectionLevel(dil); uint mask=protToMask(p); - uint col=protToColor(p); + uchar col=protToColor(p); if (bitmap) { x = di->xPos()*(cellWidth+labelHorSpacing)/gridWidth + cellWidth/2; if (doBase) // base classes { - y = image->getHeight()- + y = image->height()- (superRows-1)*(cellHeight+labelVertSpacing)- cellHeight-labelVertSpacing/2- di->yPos()*(cellHeight+labelVertSpacing)/gridHeight; @@ -964,7 +965,7 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, else { t << "1 " << di->xPos()/(float)gridWidth << " " - << ((float)superRows-1.75-di->yPos()/(float)gridHeight) + << ((float)superRows-1.75f-di->yPos()/(float)gridHeight) << " out\n"; } } @@ -975,9 +976,9 @@ void TreeDiagram::drawConnectors(FTextStream &t,Image *image, { if (bitmap) { - int xs = first->xPos()*(cellWidth+labelHorSpacing)/gridWidth + uint xs = first->xPos()*(cellWidth+labelHorSpacing)/gridWidth + cellWidth/2; - int xe = last->xPos()*(cellWidth+labelHorSpacing)/gridWidth + uint xe = last->xPos()*(cellWidth+labelHorSpacing)/gridWidth + cellWidth/2; if (doBase) // base classes { @@ -1034,17 +1035,17 @@ ClassDiagram::ClassDiagram(const ClassDef *root) super->computeLayout(); DiagramItem *baseItem = base->getFirst()->getFirst(); DiagramItem *superItem = super->getFirst()->getFirst(); - int xbase = baseItem->xPos(); - int xsuper = superItem->xPos(); + uint xbase = baseItem->xPos(); + uint xsuper = superItem->xPos(); if (xbase>xsuper) { - superItem->move(xbase-xsuper,0); - super->moveChildren(superItem,xbase-xsuper); + superItem->move((int)(xbase-xsuper),0); + super->moveChildren(superItem,(int)(xbase-xsuper)); } else if (xbase<xsuper) { - baseItem->move(xsuper-xbase,0); - base->moveChildren(baseItem,xsuper-xbase); + baseItem->move((int)(xsuper-xbase),0); + base->moveChildren(baseItem,(int)(xsuper-xbase)); } } @@ -1116,7 +1117,7 @@ void ClassDiagram::writeFigure(FTextStream &output,const char *path, t << "%%For: \n"; t << "%Magnification: 1.00\n"; t << "%%Orientation: Portrait\n"; - t << "%%BoundingBox: 0 0 500 " << estHeight*500.0/(float)estWidth << "\n"; + t << "%%BoundingBox: 0 0 500 " << estHeight*500.0f/(float)estWidth << "\n"; t << "%%Pages: 0\n"; t << "%%BeginSetup\n"; t << "%%EndSetup\n"; diff --git a/src/dirdef.cpp b/src/dirdef.cpp index ba792e1..81245e3 100644 --- a/src/dirdef.cpp +++ b/src/dirdef.cpp @@ -373,9 +373,7 @@ void DirDefImpl::writeFileList(OutputList &ol) ol.parseText(theTranslator->trFile(TRUE,FALSE)); ol.endMemberHeader(); ol.startMemberList(); - QListIterator<FileDef> it(*m_fileList); - FileDef *fd; - for (;(fd=it.current());++it) + for (it.toFirst();(fd=it.current());++it) { if (fd->hasDocumentation()) { @@ -935,7 +933,7 @@ static void computeCommonDirPrefix() sdi.toFirst(); dir=sdi.current(); path=dir->name(); - int i=path.findRev('/',path.length()-2); + int i=path.findRev('/',(int)path.length()-2); path=path.left(i+1); bool done=FALSE; if (i==-1) @@ -946,8 +944,8 @@ static void computeCommonDirPrefix() { while (!done) { - int l = path.length(); - int count=0; + uint l = path.length(); + uint count=0; for (sdi.toFirst();(dir=sdi.current());++sdi) { QCString dirName = dir->name(); @@ -955,7 +953,7 @@ static void computeCommonDirPrefix() { if (qstrncmp(dirName,path,l)!=0) // dirName does not start with path { - int i=path.findRev('/',l-2); + i=path.findRev('/',(int)l-2); if (i==-1) // no unique prefix -> stop { path=""; @@ -972,7 +970,7 @@ static void computeCommonDirPrefix() { path=dir->name(); l=path.length(); - int i=path.findRev('/',l-2); + i=path.findRev('/',(int)l-2); if (i==-1) // no unique prefix -> stop { path=""; @@ -1037,7 +1035,7 @@ void buildDirectories() for (sdi.toFirst();(dir=sdi.current());++sdi) { QCString name = dir->name(); - int i=name.findRev('/',name.length()-2); + int i=name.findRev('/',(int)name.length()-2); if (i>0) { DirDef *parent = Doxygen::directories->find(name.left(i+1)); diff --git a/src/dirdef.h b/src/dirdef.h index 2ea54af..692cd90 100644 --- a/src/dirdef.h +++ b/src/dirdef.h @@ -97,7 +97,7 @@ class FilePair class FilePairDict : public SDict<FilePair> { public: - FilePairDict(int size) : SDict<FilePair>(size) {} + FilePairDict(uint size) : SDict<FilePair>(size) {} private: int compareValues(const FilePair *item1,const FilePair *item2) const; }; @@ -147,7 +147,7 @@ inline int DirList::compareValues(const DirDef *item1,const DirDef *item2) const class DirSDict : public SDict<DirDef> { public: - DirSDict(int size) : SDict<DirDef>(size) {} + DirSDict(uint size) : SDict<DirDef>(size) {} int compareValues(const DirDef *item1,const DirDef *item2) const { return qstricmp(item1->shortName(),item2->shortName()); diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp index 1799ed9..1b32787 100644 --- a/src/docbookgen.cpp +++ b/src/docbookgen.cpp @@ -132,15 +132,13 @@ void writeDocbookLink(FTextStream &t,const char * /*extRef*/,const char *compoun t << "</link>"; } -DocbookCodeGenerator::DocbookCodeGenerator(FTextStream &t) : m_lineNumber(-1), m_col(0), - m_insideCodeLine(FALSE), m_insideSpecialHL(FALSE) +DocbookCodeGenerator::DocbookCodeGenerator(FTextStream &t) { m_prettyCode=Config_getBool(DOCBOOK_PROGRAMLISTING); setTextStream(t); } -DocbookCodeGenerator::DocbookCodeGenerator() : m_lineNumber(-1), m_col(0), - m_insideCodeLine(FALSE), m_insideSpecialHL(FALSE), m_streamSet(FALSE) +DocbookCodeGenerator::DocbookCodeGenerator() { m_prettyCode=Config_getBool(DOCBOOK_PROGRAMLISTING); } @@ -160,9 +158,9 @@ void DocbookCodeGenerator::writeCodeLink(const char *ref,const char *file, writeDocbookLink(m_t,ref,file,anchor,name,tooltip); m_col+=(int)strlen(name); } -void DocbookCodeGenerator::writeCodeLinkLine(const char *ref,const char *file, - const char *anchor,const char *name, - const char *tooltip) +void DocbookCodeGenerator::writeCodeLinkLine(const char *,const char *file, + const char *,const char *name, + const char *) { Docbook_DB(("(writeCodeLinkLine)\n")); m_t << "<anchor xml:id=\"_" << stripExtensionGeneral(stripPath(file),".xml"); @@ -274,8 +272,8 @@ DB_GEN_C m_descTable = FALSE; m_inLevel = -1; m_firstMember = FALSE; - for (int i = 0 ; i < sizeof(m_inListItem) / sizeof(*m_inListItem) ; i++) m_inListItem[i] = FALSE; - for (int i = 0 ; i < sizeof(m_inSimpleSect) / sizeof(*m_inSimpleSect) ; i++) m_inSimpleSect[i] = FALSE; + for (size_t i = 0 ; i < sizeof(m_inListItem) / sizeof(*m_inListItem) ; i++) m_inListItem[i] = FALSE; + for (size_t i = 0 ; i < sizeof(m_inSimpleSect) / sizeof(*m_inSimpleSect) ; i++) m_inSimpleSect[i] = FALSE; } DocbookGenerator::~DocbookGenerator() @@ -655,7 +653,8 @@ DB_GEN_C } } } -void DocbookGenerator::writeDoc(DocNode *n,const Definition *ctx,const MemberDef *) + +void DocbookGenerator::writeDoc(DocNode *n,const Definition *,const MemberDef *) { DB_GEN_C DocbookDocVisitor *visitor = @@ -680,7 +679,7 @@ void DocbookGenerator::writeString(const char *text) DB_GEN_C t << text; } -void DocbookGenerator::startMemberHeader(const char *name,int) +void DocbookGenerator::startMemberHeader(const char *,int) { DB_GEN_C t << "<simplesect>" << endl; @@ -698,7 +697,7 @@ void DocbookGenerator::docify(const char *str) DB_GEN_C t << convertToDocBook(str); } -void DocbookGenerator::writeObjectLink(const char *ref, const char *f, +void DocbookGenerator::writeObjectLink(const char *, const char *f, const char *anchor, const char *text) { DB_GEN_C @@ -813,7 +812,7 @@ DB_GEN_C t << "<programlisting>"; } } -void DocbookGenerator::endTextBlock(bool dense) +void DocbookGenerator::endTextBlock(bool) { DB_GEN_C if (m_denseText) @@ -822,8 +821,8 @@ DB_GEN_C t << "</programlisting>"; } } -void DocbookGenerator::startMemberDoc(const char *clname, const char *memname, const char *anchor, const char *title, - int memCount, int memTotal, bool showInline) +void DocbookGenerator::startMemberDoc(const char *clname, const char *memname, const char *, const char *title, + int memCount, int memTotal, bool) { DB_GEN_C2("m_inLevel " << m_inLevel) t << " <section>" << endl; @@ -849,15 +848,15 @@ void DocbookGenerator::startTitleHead(const char *) DB_GEN_C t << "<title>"; } -void DocbookGenerator::endTitleHead(const char *fileName,const char *name) +void DocbookGenerator::endTitleHead(const char *,const char *name) { DB_GEN_C t << "</title>" << endl; if (name) addIndexTerm(t, name); } -void DocbookGenerator::startDoxyAnchor(const char *fName,const char *manName, - const char *anchor,const char *name, - const char *args) +void DocbookGenerator::startDoxyAnchor(const char *fName,const char *, + const char *anchor,const char *, + const char *) { DB_GEN_C if (!m_inListItem[m_levelListItem] && !m_descTable) @@ -870,7 +869,7 @@ DB_GEN_C t << "<anchor xml:id=\"_" << stripPath(fName) << "_1" << anchor << "\"/>"; } } -void DocbookGenerator::endDoxyAnchor(const char *fileName,const char *anchor) +void DocbookGenerator::endDoxyAnchor(const char *,const char *) { DB_GEN_C } @@ -883,7 +882,7 @@ void DocbookGenerator::endMemberDocName() { DB_GEN_C } -void DocbookGenerator::startMemberGroupHeader(bool hasHeader) +void DocbookGenerator::startMemberGroupHeader(bool) { DB_GEN_C t << "<simplesect><title>"; @@ -1025,13 +1024,13 @@ DB_GEN_C t << "</para>"; t << "<para>"; } -void DocbookGenerator::startSection(const char *lab,const char *,SectionType type) +void DocbookGenerator::startSection(const char *lab,const char *,SectionType) { DB_GEN_C t << " <section xml:id=\"_" << stripPath(lab) << "\">"; t << "<title>"; } -void DocbookGenerator::endSection(const char *lab,SectionType) +void DocbookGenerator::endSection(const char *,SectionType) { DB_GEN_C t << "</title>"; diff --git a/src/docbookgen.h b/src/docbookgen.h index d993312..bed2f5f 100644 --- a/src/docbookgen.h +++ b/src/docbookgen.h @@ -57,16 +57,16 @@ class DocbookCodeGenerator : public CodeOutputInterface private: FTextStream m_t; - bool m_streamSet; + bool m_streamSet = FALSE; QCString m_refId; QCString m_external; - int m_lineNumber; - int m_col; - bool m_insideCodeLine; - bool m_insideSpecialHL; + int m_lineNumber = -1; + int m_col = 0; + bool m_insideCodeLine = FALSE; + bool m_insideSpecialHL = FALSE; QCString m_relPath; QCString m_sourceFileName; - bool m_prettyCode; + bool m_prettyCode = FALSE; }; @@ -145,14 +145,14 @@ class DocbookGenerator : public OutputGenerator void startFile(const char *name,const char *manName, const char *title); void writeSearchInfo(){DB_GEN_EMPTY}; - void writeFooter(const char *navPath){DB_GEN_NEW}; + void writeFooter(const char *){DB_GEN_NEW}; void endFile(); void startIndexSection(IndexSections); void endIndexSection(IndexSections); void writePageLink(const char *,bool); void startProjectNumber(){DB_GEN_NEW}; void endProjectNumber(){DB_GEN_NEW}; - void writeStyleInfo(int part){DB_GEN_EMPTY}; + void writeStyleInfo(int){DB_GEN_EMPTY}; void startTitleHead(const char *); void endTitleHead(const char *fileName,const char *name); void startIndexListItem(){DB_GEN_NEW}; @@ -166,8 +166,8 @@ class DocbookGenerator : public OutputGenerator void startItemList() {DB_GEN_EMPTY}; void endItemList() {DB_GEN_EMPTY}; - void startIndexItem(const char *ref,const char *file){DB_GEN_NEW}; - void endIndexItem(const char *ref,const char *file){DB_GEN_NEW}; + void startIndexItem(const char *,const char *){DB_GEN_NEW}; + void endIndexItem(const char *,const char *){DB_GEN_NEW}; void startItemListItem() {DB_GEN_EMPTY}; void endItemListItem() {DB_GEN_EMPTY}; void docify(const char *text); @@ -258,23 +258,23 @@ class DocbookGenerator : public OutputGenerator void insertMemberAlign(bool){DB_GEN_EMPTY}; void insertMemberAlignLeft(int,bool){DB_GEN_EMPTY}; void startMemberDoc(const char *,const char *, - const char *,const char *,int,int,bool); + const char *,const char *,int,int,bool); void endMemberDoc(bool); void startDoxyAnchor(const char *fName,const char *manName, - const char *anchor,const char *name, - const char *args); + const char *anchor,const char *name, + const char *args); void endDoxyAnchor(const char *fileName,const char *anchor); void writeLatexSpacing(){DB_GEN_EMPTY} - void writeStartAnnoItem(const char *type,const char *file, - const char *path,const char *name){DB_GEN_NEW}; - void writeEndAnnoItem(const char *name){DB_GEN_NEW}; - void startMemberDescription(const char *anchor,const char *inheritId, bool typ){DB_GEN_EMPTY}; + void writeStartAnnoItem(const char *,const char *, + const char *,const char *){DB_GEN_NEW}; + void writeEndAnnoItem(const char *){DB_GEN_NEW}; + void startMemberDescription(const char *,const char *,bool){DB_GEN_EMPTY}; void endMemberDescription(){DB_GEN_EMPTY}; void startMemberDeclaration(){DB_GEN_EMPTY}; - void endMemberDeclaration(const char *anchor,const char *inheritId){DB_GEN_EMPTY}; - void writeInheritedSectionTitle(const char *id,const char *ref, - const char *file,const char *anchor, - const char *title,const char *name){DB_GEN_NEW}; + void endMemberDeclaration(const char *,const char *){DB_GEN_EMPTY}; + void writeInheritedSectionTitle(const char *,const char *, + const char *,const char *, + const char *,const char *){DB_GEN_NEW}; void startIndent(){DB_GEN_EMPTY}; void endIndent(){DB_GEN_EMPTY}; void writeSynopsis(){DB_GEN_EMPTY}; @@ -290,17 +290,17 @@ class DocbookGenerator : public OutputGenerator void endCallGraph(DotCallGraph &g); void startDirDepGraph(); void endDirDepGraph(DotDirDeps &g); - void writeGraphicalHierarchy(DotGfxHierarchyTable &g){DB_GEN_NEW}; + void writeGraphicalHierarchy(DotGfxHierarchyTable &){DB_GEN_NEW}; void startQuickIndices(){DB_GEN_EMPTY}; void endQuickIndices(){DB_GEN_EMPTY}; void writeSplitBar(const char *){DB_GEN_EMPTY}; void writeNavigationPath(const char *){DB_GEN_NEW}; void writeLogo(){DB_GEN_NEW}; - void writeQuickLinks(bool compact,HighlightedItem hli,const char *file){DB_GEN_EMPTY}; - void writeSummaryLink(const char *file,const char *anchor,const char *title,bool first){DB_GEN_EMPTY}; + void writeQuickLinks(bool,HighlightedItem,const char *){DB_GEN_EMPTY}; + void writeSummaryLink(const char *,const char *,const char *,bool){DB_GEN_EMPTY}; void startContents(){DB_GEN_EMPTY}; void endContents(){DB_GEN_EMPTY}; - void startPageDoc(const char *pageTitle){DB_GEN_EMPTY} + void startPageDoc(const char *){DB_GEN_EMPTY} void endPageDoc() {DB_GEN_EMPTY} void startTextBlock(bool); void endTextBlock(bool); @@ -309,7 +309,7 @@ class DocbookGenerator : public OutputGenerator void endMemberDocPrefixItem(); void startMemberDocName(bool); void endMemberDocName(); - void startParameterType(bool,const char *key){DB_GEN_EMPTY}; + void startParameterType(bool,const char *){DB_GEN_EMPTY}; void endParameterType(){DB_GEN_EMPTY}; void startParameterName(bool); void endParameterName(bool,bool,bool); diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index 9ae1c8f..b9bd6aa 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -53,7 +53,7 @@ static QCString filterId(const char *s) static GrowBuf growBuf; growBuf.clear(); if (s==0) return ""; - const unsigned char *p=(const unsigned char *)s; + const char *p=s; char c; while ((c=*p++)) { @@ -396,7 +396,7 @@ DB_VIS_C int i; if ((i=shortName.findRev('/'))!=-1) { - shortName=shortName.right(shortName.length()-i-1); + shortName=shortName.right((int)shortName.length()-i-1); } m_t << "<para>" << endl; writePlantUMLFile(baseName,s); @@ -1128,14 +1128,14 @@ DB_VIS_C m_t << ">"; } -void DocbookDocVisitor::visitPost(DocHtmlCell *c) +void DocbookDocVisitor::visitPost(DocHtmlCell *) { DB_VIS_C if (m_hide) return; m_t << "</entry>"; } -void DocbookDocVisitor::visitPre(DocHtmlCaption *c) +void DocbookDocVisitor::visitPre(DocHtmlCaption *) { DB_VIS_C if (m_hide) return; @@ -1202,7 +1202,7 @@ DB_VIS_C int i; if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1) { - baseName=baseName.right(baseName.length()-i-1); + baseName=baseName.right((int)baseName.length()-i-1); } visitPreStart(m_t, img->children(), img->hasCaption(), img->relPath() + baseName, img->width(), img->height(), img->isInlineImage()); } @@ -1225,7 +1225,7 @@ DB_VIS_C int i; if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1) { - baseName=baseName.right(baseName.length()-i-1); + baseName=baseName.right((int)baseName.length()-i-1); } QCString m_file; bool ambig; @@ -1332,7 +1332,7 @@ DB_VIS_C if (!ref->file().isEmpty()) endLink(); } -void DocbookDocVisitor::visitPre(DocSecRefItem *ref) +void DocbookDocVisitor::visitPre(DocSecRefItem *) { DB_VIS_C if (m_hide) return; @@ -1415,11 +1415,9 @@ DB_VIS_C if (m_hide) return; m_t << " <row>" << endl; - DocParamSect::Type parentType = DocParamSect::Unknown; DocParamSect *sect = 0; if (pl->parent() && pl->parent()->kind()==DocNode::Kind_ParamSect) { - parentType = ((DocParamSect*)pl->parent())->type(); sect=(DocParamSect*)pl->parent(); } @@ -1639,7 +1637,7 @@ DB_VIS_C int i; if ((i=shortName.findRev('/'))!=-1) { - shortName=shortName.right(shortName.length()-i-1); + shortName=shortName.right((int)shortName.length()-i-1); } QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_BITMAP); @@ -1655,7 +1653,7 @@ DB_VIS_C int i; if ((i=shortName.findRev('/'))!=-1) { - shortName=shortName.right(shortName.length()-i-1); + shortName=shortName.right((int)shortName.length()-i-1); } QCString outDir = Config_getString(DOCBOOK_OUTPUT); PlantumlManager::instance()->generatePlantUMLOutput(baseName,outDir,PlantumlManager::PUML_BITMAP); @@ -1676,7 +1674,7 @@ DB_VIS_C int i; if ((i=baseName.findRev('/'))!=-1) { - baseName=baseName.right(baseName.length()-i-1); + baseName=baseName.right((int)baseName.length()-i-1); } if ((i=baseName.find('.'))!=-1) { @@ -1704,7 +1702,7 @@ DB_VIS_C int i; if ((i=shortName.findRev('/'))!=-1) { - shortName=shortName.right(shortName.length()-i-1); + shortName=shortName.right((int)shortName.length()-i-1); } QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_BITMAP); @@ -1725,7 +1723,7 @@ DB_VIS_C int i; if ((i=baseName.findRev('/'))!=-1) { - baseName=baseName.right(baseName.length()-i-1); + baseName=baseName.right((int)baseName.length()-i-1); } if ((i=baseName.find('.'))!=-1) { @@ -1753,7 +1751,7 @@ DB_VIS_C int i; if ((i=shortName.findRev('/'))!=-1) { - shortName=shortName.right(shortName.length()-i-1); + shortName=shortName.right((int)shortName.length()-i-1); } QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeDotGraphFromFile(baseName+".dot",outDir,shortName,GOF_BITMAP); @@ -1774,7 +1772,7 @@ DB_VIS_C int i; if ((i=baseName.findRev('/'))!=-1) { - baseName=baseName.right(baseName.length()-i-1); + baseName=baseName.right((int)baseName.length()-i-1); } if ((i=baseName.find('.'))!=-1) { diff --git a/src/docparser.cpp b/src/docparser.cpp index e26c2ac..a9be280 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -1,13 +1,13 @@ /****************************************************************************** * - * + * * * * Copyright (C) 1997-2015 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 + * 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. * @@ -70,11 +70,11 @@ //#define DBG(x) myprintf x #define INTERNAL_ASSERT(x) do {} while(0) -//#define INTERNAL_ASSERT(x) if (!(x)) DBG(("INTERNAL_ASSERT(%s) failed retval=0x%x: file=%s line=%d\n",#x,retval,__FILE__,__LINE__)); +//#define INTERNAL_ASSERT(x) if (!(x)) DBG(("INTERNAL_ASSERT(%s) failed retval=0x%x: file=%s line=%d\n",#x,retval,__FILE__,__LINE__)); //--------------------------------------------------------------------------- -static const char *sectionLevelToName[] = +static const char *sectionLevelToName[] = { "page", "section", @@ -112,11 +112,11 @@ static QCString g_includeFileName; static QCString g_includeFileText; static uint g_includeFileOffset; static uint g_includeFileLength; -static uint g_includeFileLine; +static int g_includeFileLine; static bool g_includeFileShowLineNo; -/** Parser's context to store all global variables. +/** Parser's context to store all global variables. */ struct DocParserContext { @@ -145,7 +145,7 @@ struct DocParserContext QCString includeFileText; uint includeFileOffset; uint includeFileLength; - uint includeFileLine; + int includeFileLine; bool includeFileLineNo; TokenInfo *token; @@ -196,7 +196,7 @@ static void docParserPushContext(bool saveParamInfo=TRUE) ctx->includeFileLength = g_includeFileLength; ctx->includeFileLine = g_includeFileLine; ctx->includeFileLineNo = g_includeFileShowLineNo; - + ctx->token = g_token; g_token = new TokenInfo; @@ -291,7 +291,7 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type, bool text.sprintf("image file name %s is ambiguous.\n",qPrint(fileName)); text+="Possible candidates:\n"; text+=showFileDefMatches(Doxygen::imageNameDict,fileName); - warn_doc_error(g_fileName,doctokenizerYYlineno,text); + warn_doc_error(g_fileName,doctokenizerYYlineno,"%s", text.data()); } QCString inputFile = fd->absFilePath(); @@ -302,7 +302,7 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type, bool int i; if ((i=result.findRev('/'))!=-1 || (i=result.findRev('\\'))!=-1) { - result = result.right(result.length()-i-1); + result = result.right((int)result.length()-i-1); } //printf("fileName=%s result=%s\n",fileName,result.data()); QCString outputDir; @@ -364,7 +364,7 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type, bool "could not open image %s",qPrint(fileName)); } - if (type==DocImage::Latex && Config_getBool(USE_PDFLATEX) && + if (type==DocImage::Latex && Config_getBool(USE_PDFLATEX) && fd->name().right(4)==".eps" ) { // we have an .eps image in pdflatex mode => convert it to a pdf. @@ -389,7 +389,7 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type, bool if (result.left(5)!="http:" && result.left(6)!="https:" && dowarn) { warn_doc_error(g_fileName,doctokenizerYYlineno, - "image file %s is not found in IMAGE_PATH: " + "image file %s is not found in IMAGE_PATH: " "assuming external image.",qPrint(fileName) ); } @@ -404,7 +404,7 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type, bool * are disabled altogether). */ static void checkArgumentName(const QCString &name) -{ +{ if (!Config_getBool(WARN_IF_DOC_ERROR)) return; if (g_memberDef==0) return; // not a member const ArgumentList &al=g_memberDef->isDocsForDefinition() ? @@ -474,9 +474,10 @@ static void checkRetvalName(const QCString &name) { warn_doc_error(g_memberDef->getDefFileName(), g_memberDef->getDefLine(), - "return value '" + name + "' of " + + "%s", + ("return value '" + name + "' of " + QCString(g_memberDef->qualifiedName()) + - " has multiple documentation sections"); + " has multiple documentation sections").data()); } g_retvalsFound.insert(name,(void *)(0x8)); } @@ -510,7 +511,7 @@ static void checkUnOrMultipleDocumentedParams() { // allow undocumented self / cls parameter for Python } - else if (!argName.isEmpty() && g_paramsFound.find(argName)==0 && a.docs.isEmpty()) + else if (!argName.isEmpty() && g_paramsFound.find(argName)==0 && a.docs.isEmpty()) { notArgCnt++; } @@ -527,10 +528,11 @@ static void checkUnOrMultipleDocumentedParams() { warn_doc_error(g_memberDef->getDefFileName(), g_memberDef->getDefLine(), - "argument '" + aName + + "%s", + ("argument '" + aName + "' from the argument list of " + QCString(g_memberDef->qualifiedName()) + - " has multiple @param documentation sections"); + " has multiple @param documentation sections").data()); } } if (notArgCnt>0) @@ -540,7 +542,7 @@ static void checkUnOrMultipleDocumentedParams() "The following parameter"; errMsg+= (notArgCnt>1 ? "s" : ""); errMsg+=" of "+ - QCString(g_memberDef->qualifiedName()) + + QCString(g_memberDef->qualifiedName()) + QCString(argListToString(al)) + (notArgCnt>1 ? " are" : " is") + " not documented:\n"; for (const Argument &a : al) @@ -567,7 +569,8 @@ static void checkUnOrMultipleDocumentedParams() } warn_doc_error(g_memberDef->getDefFileName(), g_memberDef->getDefLine(), - substitute(errMsg,"%","%%")); + "%s", + substitute(errMsg,"%","%%").data()); } } } @@ -584,7 +587,7 @@ static QCString stripKnownExtensions(const char *text) result=result.left(result.length()-4); } else if (result.right(Doxygen::htmlFileExtension.length())== - QCString(Doxygen::htmlFileExtension)) + QCString(Doxygen::htmlFileExtension)) { result=result.left(result.length()-Doxygen::htmlFileExtension.length()); } @@ -625,7 +628,7 @@ static bool insideUL(DocNode *n) { while (n) { - if (n->kind()==DocNode::Kind_HtmlList && + if (n->kind()==DocNode::Kind_HtmlList && ((DocHtmlList *)n)->type()==DocHtmlList::Unordered) return TRUE; n=n->parent(); } @@ -639,7 +642,7 @@ static bool insideOL(DocNode *n) { while (n) { - if (n->kind()==DocNode::Kind_HtmlList && + if (n->kind()==DocNode::Kind_HtmlList && ((DocHtmlList *)n)->type()==DocHtmlList::Ordered) return TRUE; n=n->parent(); } @@ -679,11 +682,11 @@ static bool findDocsForMemberOrCompound(const char *commandName, QCString cmdArg=substitute(commandName,"#","::"); cmdArg = replaceScopeSeparator(cmdArg); - int l=cmdArg.length(); + int l=(int)cmdArg.length(); if (l==0) return FALSE; int funcStart=cmdArg.find('('); - if (funcStart==-1) + if (funcStart==-1) { funcStart=l; } @@ -693,9 +696,9 @@ static bool findDocsForMemberOrCompound(const char *commandName, // beware of scenarios like operator()((foo)bar) int secondParen = cmdArg.find('(', funcStart+1); int leftParen = cmdArg.find(')', funcStart+1); - if (leftParen!=-1 && secondParen!=-1) + if (leftParen!=-1 && secondParen!=-1) { - if (leftParen<secondParen) + if (leftParen<secondParen) { funcStart=secondParen; } @@ -726,7 +729,7 @@ static bool findDocsForMemberOrCompound(const char *commandName, } - int scopeOffset=g_context.length(); + int scopeOffset=(int)g_context.length(); do // for each scope { QCString fullName=cmdArg; @@ -738,7 +741,7 @@ static bool findDocsForMemberOrCompound(const char *commandName, // try class, namespace, group, page, file reference cd = Doxygen::classSDict->find(fullName); - if (cd) // class + if (cd) // class { *pDoc=cd->documentation(); *pBrief=cd->briefDescription(); @@ -790,7 +793,7 @@ static bool findDocsForMemberOrCompound(const char *commandName, } } while (scopeOffset>=0); - + return FALSE; } //--------------------------------------------------------------------------- @@ -821,7 +824,7 @@ inline void errorHandleDefaultToken(DocNode *parent,int tok, //--------------------------------------------------------------------------- // forward declaration -static bool defaultHandleToken(DocNode *parent,int tok, +static bool defaultHandleToken(DocNode *parent,int tok, QList<DocNode> &children,bool handleWord=TRUE); @@ -837,15 +840,15 @@ static int handleStyleArgument(DocNode *parent,QList<DocNode> &children, qPrint(saveCmdName)); return tok; } - while ((tok=doctokenizerYYlex()) && - tok!=TK_WHITESPACE && + while ((tok=doctokenizerYYlex()) && + tok!=TK_WHITESPACE && tok!=TK_NEWPARA && - tok!=TK_LISTITEM && + tok!=TK_LISTITEM && tok!=TK_ENDLIST ) { static QRegExp specialChar("[.,|()\\[\\]:;\\?]"); - if (tok==TK_WORD && g_token->name.length()==1 && + if (tok==TK_WORD && g_token->name.length()==1 && g_token->name.find(specialChar)!=-1) { // special character that ends the markup command @@ -858,7 +861,7 @@ static int handleStyleArgument(DocNode *parent,QList<DocNode> &children, case TK_HTMLTAG: if (insideLI(parent) && Mappers::htmlTagMapper->map(g_token->name) && g_token->endTag) { // ignore </li> as the end of a style command - continue; + continue; } return tok; break; @@ -871,7 +874,7 @@ static int handleStyleArgument(DocNode *parent,QList<DocNode> &children, } DBG(("handleStyleArgument(%s) end tok=%x\n",qPrint(saveCmdName),tok)); return (tok==TK_NEWPARA || tok==TK_LISTITEM || tok==TK_ENDLIST - ) ? tok : RetVal_OK; + ) ? tok : RetVal_OK; } /*! Called when a style change starts. For instance a \<b\> command is @@ -938,7 +941,7 @@ static void handlePendingStyleCommands(DocNode *parent,QList<DocNode> &children) if (!g_styleStack.isEmpty()) { DocStyleChange *sc = g_styleStack.top(); - while (sc && sc->position()>=g_nodeStack.count()) + while (sc && sc->position()>=g_nodeStack.count()) { // there are unclosed style modifiers in the paragraph children.append(new DocStyleChange(parent,g_nodeStack.count(),sc->style(),sc->tagName(),FALSE)); g_initialStyleStack.push(sc); @@ -961,7 +964,7 @@ static int handleAHref(DocNode *parent,QList<DocNode> &children,const HtmlAttrib { HtmlAttribListIterator li(tagHtmlAttribs); HtmlAttrib *opt; - int index=0; + uint index=0; int retval = RetVal_OK; for (li.toFirst();(opt=li.current());++li,++index) { @@ -1054,12 +1057,12 @@ static void handleLinkedWord(DocNode *parent,QList<DocNode> &children,bool ignor const Definition *compound=0; const MemberDef *member=0; - int len = g_token->name.length(); + uint len = g_token->name.length(); ClassDef *cd=0; bool ambig; FileDef *fd = findFileDef(Doxygen::inputNameDict,g_fileName,ambig); //printf("handleLinkedWord(%s) g_context=%s\n",g_token->name.data(),g_context.data()); - if (!g_insideHtmlLink && + if (!g_insideHtmlLink && (resolveRef(g_context,g_token->name,g_inSeeBlock,&compound,&member,TRUE,fd,TRUE) || (!g_context.isEmpty() && // also try with global scope resolveRef("",g_token->name,g_inSeeBlock,&compound,&member,FALSE,0,TRUE)) @@ -1069,12 +1072,12 @@ static void handleLinkedWord(DocNode *parent,QList<DocNode> &children,bool ignor //printf("resolveRef %s = %p (linkable?=%d)\n",qPrint(g_token->name),member,member ? member->isLinkable() : FALSE); if (member && member->isLinkable()) // member link { - if (member->isObjCMethod()) + if (member->isObjCMethod()) { bool localLink = g_memberDef ? member->getClassDef()==g_memberDef->getClassDef() : FALSE; name = member->objCMethodName(localLink,g_inSeeBlock); } - children.append(new + children.append(new DocLinkedWord(parent,name, member->getReference(), member->getOutputFileBase(), @@ -1094,7 +1097,7 @@ static void handleLinkedWord(DocNode *parent,QList<DocNode> &children,bool ignor { name=(dynamic_cast<const GroupDef*>(compound))->groupTitle(); } - children.append(new + children.append(new DocLinkedWord(parent,name, compound->getReference(), compound->getOutputFileBase(), @@ -1107,7 +1110,7 @@ static void handleLinkedWord(DocNode *parent,QList<DocNode> &children,bool ignor (dynamic_cast<const FileDef*>(compound))->generateSourceFile() ) // undocumented file that has source code we can link to { - children.append(new + children.append(new DocLinkedWord(parent,g_token->name, compound->getReference(), compound->getSourceFileBase(), @@ -1123,7 +1126,7 @@ static void handleLinkedWord(DocNode *parent,QList<DocNode> &children,bool ignor } else if (!g_insideHtmlLink && len>1 && g_token->name.at(len-1)==':') { - // special case, where matching Foo: fails to be an Obj-C reference, + // special case, where matching Foo: fails to be an Obj-C reference, // but Foo itself might be linkable. g_token->name=g_token->name.left(len-1); handleLinkedWord(parent,children,ignoreAutoLinkFlag); @@ -1133,7 +1136,7 @@ static void handleLinkedWord(DocNode *parent,QList<DocNode> &children,bool ignor { // special case 2, where the token name is not a class, but could // be a Obj-C protocol - children.append(new + children.append(new DocLinkedWord(parent,name, cd->getReference(), cd->getOutputFileBase(), @@ -1145,7 +1148,7 @@ static void handleLinkedWord(DocNode *parent,QList<DocNode> &children,bool ignor // { // // special case 3, where the token name is not a class, but could // // be a C# generic -// children.append(new +// children.append(new // DocLinkedWord(parent,name, // cd->getReference(), // cd->getOutputFileBase(), @@ -1397,7 +1400,7 @@ reparsetoken: children.append(new DocStyleChange(parent,g_nodeStack.count(),DocStyleChange::Italic,tokenName,FALSE)); if (tok!=TK_WORD) children.append(new DocWhiteSpace(parent," ")); if (tok==TK_NEWPARA) goto handlepara; - else if (tok==TK_WORD || tok==TK_HTMLTAG) + else if (tok==TK_WORD || tok==TK_HTMLTAG) { DBG(("CMD_EMPHASIS: reparsing command %s\n",qPrint(g_token->name))); goto reparsetoken; @@ -1411,7 +1414,7 @@ reparsetoken: children.append(new DocStyleChange(parent,g_nodeStack.count(),DocStyleChange::Bold,tokenName,FALSE)); if (tok!=TK_WORD) children.append(new DocWhiteSpace(parent," ")); if (tok==TK_NEWPARA) goto handlepara; - else if (tok==TK_WORD || tok==TK_HTMLTAG) + else if (tok==TK_WORD || tok==TK_HTMLTAG) { DBG(("CMD_BOLD: reparsing command %s\n",qPrint(g_token->name))); goto reparsetoken; @@ -1425,7 +1428,7 @@ reparsetoken: children.append(new DocStyleChange(parent,g_nodeStack.count(),DocStyleChange::Code,tokenName,FALSE)); if (tok!=TK_WORD) children.append(new DocWhiteSpace(parent," ")); if (tok==TK_NEWPARA) goto handlepara; - else if (tok==TK_WORD || tok==TK_HTMLTAG) + else if (tok==TK_WORD || tok==TK_HTMLTAG) { DBG(("CMD_CODE: reparsing command %s\n",qPrint(g_token->name))); goto reparsetoken; @@ -1464,7 +1467,7 @@ reparsetoken: doctokenizerYYsetStateLatexOnly(); tok = doctokenizerYYlex(); children.append(new DocVerbatim(parent,g_context,g_token->verb,DocVerbatim::LatexOnly,g_isExample,g_exampleName)); - if (tok==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"latexonly section ended without end marker",doctokenizerYYlineno); + if (tok==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"latexonly section ended without end marker"); doctokenizerYYsetStatePara(); } break; @@ -1473,7 +1476,7 @@ reparsetoken: doctokenizerYYsetStateXmlOnly(); tok = doctokenizerYYlex(); children.append(new DocVerbatim(parent,g_context,g_token->verb,DocVerbatim::XmlOnly,g_isExample,g_exampleName)); - if (tok==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"xmlonly section ended without end marker",doctokenizerYYlineno); + if (tok==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"xmlonly section ended without end marker"); doctokenizerYYsetStatePara(); } break; @@ -1482,7 +1485,7 @@ reparsetoken: doctokenizerYYsetStateDbOnly(); tok = doctokenizerYYlex(); children.append(new DocVerbatim(parent,g_context,g_token->verb,DocVerbatim::DocbookOnly,g_isExample,g_exampleName)); - if (tok==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"docbookonly section ended without end marker",doctokenizerYYlineno); + if (tok==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"docbookonly section ended without end marker"); doctokenizerYYsetStatePara(); } break; @@ -1670,7 +1673,7 @@ reparsetoken: } } break; - case TK_SYMBOL: + case TK_SYMBOL: { DocSymbol::SymType s = DocSymbol::decodeSymbol(tokenName); if (s!=DocSymbol::Sym_Unknown) @@ -1683,15 +1686,15 @@ reparsetoken: } } break; - case TK_WHITESPACE: - case TK_NEWPARA: + case TK_WHITESPACE: + case TK_NEWPARA: handlepara: if (insidePRE(parent) || !children.isEmpty()) { children.append(new DocWhiteSpace(parent,g_token->chars)); } break; - case TK_LNKWORD: + case TK_LNKWORD: if (handleWord) { handleLinkedWord(parent,children); @@ -1699,7 +1702,7 @@ handlepara: else return FALSE; break; - case TK_WORD: + case TK_WORD: if (handleWord) { children.append(new DocWord(parent,g_token->name)); @@ -1730,7 +1733,7 @@ static void handleImg(DocNode *parent,QList<DocNode> &children,const HtmlAttribL HtmlAttribListIterator li(tagHtmlAttribs); HtmlAttrib *opt; bool found=FALSE; - int index=0; + uint index=0; for (li.toFirst();(opt=li.current());++li,++index) { //printf("option name=%s value=%s\n",opt->name.data(),opt->value.data()); @@ -1768,7 +1771,7 @@ DocEmoji::DocEmoji(DocNode *parent,const QCString &symName) : { m_parent = parent; QCString locSymName = symName; - int len=locSymName.length(); + uint len=locSymName.length(); if (len>0) { if (locSymName.at(len-1)!=':') locSymName.append(":"); @@ -1806,7 +1809,7 @@ static int internalValidatingParseDoc(DocNode *parent,QList<DocNode> &children, DocPara *par = new DocPara(parent); if (isFirst) { par->markFirst(); isFirst=FALSE; } retval=par->parse(); - if (!par->isEmpty()) + if (!par->isEmpty()) { children.append(par); if (lastPar) lastPar->markLast(FALSE); @@ -1849,7 +1852,7 @@ static void readTextFileByName(const QCString &file,QCString &text) text = fileToString(absFileName,Config_getBool(FILTER_SOURCE_FILES)); return; } - s=examplePathList.next(); + s=examplePathList.next(); } // as a fallback we also look in the exampleNameDict @@ -1875,10 +1878,10 @@ static void readTextFileByName(const QCString &file,QCString &text) //--------------------------------------------------------------------------- -DocWord::DocWord(DocNode *parent,const QCString &word) : - m_word(word) +DocWord::DocWord(DocNode *parent,const QCString &word) : + m_word(word) { - m_parent = parent; + m_parent = parent; //printf("new word %s url=%s\n",word.data(),g_searchUrl.data()); if (Doxygen::searchIndex && !g_searchUrl.isEmpty()) { @@ -1890,12 +1893,12 @@ DocWord::DocWord(DocNode *parent,const QCString &word) : DocLinkedWord::DocLinkedWord(DocNode *parent,const QCString &word, const QCString &ref,const QCString &file, - const QCString &anchor,const QCString &tooltip) : - m_word(word), m_ref(ref), + const QCString &anchor,const QCString &tooltip) : + m_word(word), m_ref(ref), m_file(file), m_relPath(g_relPath), m_anchor(anchor), m_tooltip(tooltip) { - m_parent = parent; + m_parent = parent; //printf("DocLinkedWord: new word %s url=%s tooltip='%s'\n", // word.data(),g_searchUrl.data(),tooltip.data()); if (Doxygen::searchIndex && !g_searchUrl.isEmpty()) @@ -1908,7 +1911,7 @@ DocLinkedWord::DocLinkedWord(DocNode *parent,const QCString &word, DocAnchor::DocAnchor(DocNode *parent,const QCString &id,bool newAnchor) { - m_parent = parent; + m_parent = parent; if (id.isEmpty()) { warn_doc_error(g_fileName,doctokenizerYYlineno,"Empty anchor label"); @@ -1925,7 +1928,7 @@ DocAnchor::DocAnchor(DocNode *parent,const QCString &id,bool newAnchor) m_file = convertNameToFile(ct.fileName(),FALSE,TRUE); m_anchor = id; } - else + else { warn_doc_error(g_fileName,doctokenizerYYlineno,"Invalid cite anchor id '%s'",qPrint(id)); m_anchor = "invalid"; @@ -1990,7 +1993,7 @@ void DocInclude::parse() g_includeFileShowLineNo = (m_type == DontIncWithLines || m_type == IncWithLines); //printf("g_includeFile=<<%s>>\n",g_includeFileText.data()); break; - case VerbInclude: + case VerbInclude: // fall through case HtmlInclude: case LatexInclude: @@ -2012,8 +2015,8 @@ void DocInclude::parse() m_blockId.data(),m_file.data(),count); } break; - case DocInclude::SnippetDoc: - case DocInclude::IncludeDoc: + case DocInclude::SnippetDoc: + case DocInclude::IncludeDoc: err("Internal inconsistency: found switch SnippetDoc / IncludeDoc in file: %s" "Please create a bug report\n",__FILE__); break; @@ -2035,7 +2038,7 @@ void DocIncOperator::parse() const char *p = g_includeFileText; uint l = g_includeFileLength; uint o = g_includeFileOffset; - uint il = g_includeFileLine; + int il = g_includeFileLine; DBG(("DocIncOperator::parse() text=%s off=%d len=%d\n",qPrint(p),o,l)); uint so = o,bo; bool nonEmpty = FALSE; @@ -2045,7 +2048,7 @@ void DocIncOperator::parse() while (o<l) { char c = p[o]; - if (c=='\n') + if (c=='\n') { g_includeFileLine++; if (nonEmpty) break; // we have a pattern to match @@ -2162,10 +2165,10 @@ void DocIncOperator::parse() //--------------------------------------------------------------------------- -DocXRefItem::DocXRefItem(DocNode *parent,int id,const char *key) : +DocXRefItem::DocXRefItem(DocNode *parent,int id,const char *key) : m_id(id), m_key(key), m_relPath(g_relPath) { - m_parent = parent; + m_parent = parent; } bool DocXRefItem::parse() @@ -2280,7 +2283,7 @@ void DocSecRefItem::parse() const SectionInfo *sec=0; if (!m_target.isEmpty()) { - const SectionInfo *sec = SectionManager::instance().find(m_target); + sec = SectionManager::instance().find(m_target); if (sec) { m_file = sec->fileName(); @@ -2322,7 +2325,7 @@ void DocSecRefList::parse() { case CMD_SECREFITEM: { - int tok=doctokenizerYYlex(); + tok=doctokenizerYYlex(); if (tok!=TK_WHITESPACE) { warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after \\refitem command"); @@ -2370,14 +2373,14 @@ endsecreflist: //--------------------------------------------------------------------------- -DocInternalRef::DocInternalRef(DocNode *parent,const QCString &ref) +DocInternalRef::DocInternalRef(DocNode *parent,const QCString &ref) : m_relPath(g_relPath) { - m_parent = parent; + m_parent = parent; int i=ref.find('#'); if (i!=-1) { - m_anchor = ref.right(ref.length()-i-1); + m_anchor = ref.right((int)ref.length()-i-1); m_file = ref.left(i); } else @@ -2408,10 +2411,10 @@ void DocInternalRef::parse() //--------------------------------------------------------------------------- -DocRef::DocRef(DocNode *parent,const QCString &target,const QCString &context) : +DocRef::DocRef(DocNode *parent,const QCString &target,const QCString &context) : m_refType(Unknown), m_isSubPage(FALSE) { - m_parent = parent; + m_parent = parent; const Definition *compound = 0; QCString anchor; //printf("DocRef::DocRef(target=%s,context=%s)\n",target.data(),context.data()); @@ -2455,9 +2458,9 @@ DocRef::DocRef(DocNode *parent,const QCString &target,const QCString &context) : } else if (resolveLink(context,target,TRUE,&compound,anchor)) { - bool isFile = compound ? + bool isFile = compound ? (compound->definitionType()==Definition::TypeFile || - compound->definitionType()==Definition::TypePage ? TRUE : FALSE) : + compound->definitionType()==Definition::TypePage ? TRUE : FALSE) : FALSE; m_text = linkToText(compound?compound->getLanguage():SrcLangExt_Unknown,target,isFile); m_anchor = anchor; @@ -2496,7 +2499,7 @@ DocRef::DocRef(DocNode *parent,const QCString &target,const QCString &context) : } m_text = target; warn_doc_error(g_fileName,doctokenizerYYlineno,"unable to resolve reference to '%s' for \\ref command", - qPrint(target)); + qPrint(target)); } static void flattenParagraphs(DocNode *root,QList<DocNode> &children) @@ -2560,7 +2563,7 @@ void DocRef::parse() } handlePendingStyleCommands(this,m_children); - + DocNode *n=g_nodeStack.pop(); ASSERT(n==this); } @@ -2606,7 +2609,7 @@ DocCite::DocCite(DocNode *parent,const QCString &target,const QCString &) //cont //--------------------------------------------------------------------------- -DocLink::DocLink(DocNode *parent,const QCString &target) +DocLink::DocLink(DocNode *parent,const QCString &target) { m_parent = parent; const Definition *compound = 0; @@ -2638,7 +2641,7 @@ DocLink::DocLink(DocNode *parent,const QCString &target) // bogus link target warn_doc_error(g_fileName,doctokenizerYYlineno,"unable to resolve link to '%s' for \\link command", - qPrint(target)); + qPrint(target)); } @@ -2674,7 +2677,7 @@ QCString DocLink::parse(bool isJavaLink,bool isXmlLink) break; } break; - case TK_SYMBOL: + case TK_SYMBOL: warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found as part of a \\link", qPrint(g_token->name)); break; @@ -2685,8 +2688,8 @@ QCString DocLink::parse(bool isJavaLink,bool isXmlLink) qPrint(g_token->name)); } goto endlink; - case TK_LNKWORD: - case TK_WORD: + case TK_LNKWORD: + case TK_WORD: if (isJavaLink) // special case to detect closing } { QCString w = g_token->name; @@ -2701,7 +2704,7 @@ QCString DocLink::parse(bool isJavaLink,bool isXmlLink) m_children.append(new DocWord(this,w.left(p))); if ((uint)p<l-1) // something left after the } (for instance a .) { - result=w.right(l-p-1); + result=w.right((int)l-p-1); } goto endlink; } @@ -2718,7 +2721,7 @@ QCString DocLink::parse(bool isJavaLink,bool isXmlLink) if (tok==0) { warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected end of comment while inside" - " link command\n"); + " link command\n"); } endlink: @@ -2737,10 +2740,10 @@ endlink: //--------------------------------------------------------------------------- -DocDotFile::DocDotFile(DocNode *parent,const QCString &name,const QCString &context) : +DocDotFile::DocDotFile(DocNode *parent,const QCString &name,const QCString &context) : m_name(name), m_relPath(g_relPath), m_context(context) { - m_parent = parent; + m_parent = parent; } bool DocDotFile::parse() @@ -2774,10 +2777,10 @@ bool DocDotFile::parse() return ok; } -DocMscFile::DocMscFile(DocNode *parent,const QCString &name,const QCString &context) : +DocMscFile::DocMscFile(DocNode *parent,const QCString &name,const QCString &context) : m_name(name), m_relPath(g_relPath), m_context(context) { - m_parent = parent; + m_parent = parent; } bool DocMscFile::parse() @@ -2897,7 +2900,7 @@ DocImage::DocImage(DocNode *parent,const HtmlAttribList &attribs,const QCString bool DocImage::isSVG() const { QCString locName = m_url.isEmpty() ? m_name : m_url; - int len = locName.length(); + int len = (int)locName.length(); int fnd = locName.find('?'); // ignore part from ? until end if (fnd==-1) fnd=len; return fnd>=4 && locName.mid(fnd-4,4)==".svg"; @@ -2932,7 +2935,7 @@ int DocHtmlHeader::parse() if (m_level!=1) { warn_doc_error(g_fileName,doctokenizerYYlineno,"<h%d> ended with </h1>", - m_level); + m_level); } goto endheader; } @@ -2941,7 +2944,7 @@ int DocHtmlHeader::parse() if (m_level!=2) { warn_doc_error(g_fileName,doctokenizerYYlineno,"<h%d> ended with </h2>", - m_level); + m_level); } goto endheader; } @@ -2950,7 +2953,7 @@ int DocHtmlHeader::parse() if (m_level!=3) { warn_doc_error(g_fileName,doctokenizerYYlineno,"<h%d> ended with </h3>", - m_level); + m_level); } goto endheader; } @@ -2959,7 +2962,7 @@ int DocHtmlHeader::parse() if (m_level!=4) { warn_doc_error(g_fileName,doctokenizerYYlineno,"<h%d> ended with </h4>", - m_level); + m_level); } goto endheader; } @@ -2968,7 +2971,7 @@ int DocHtmlHeader::parse() if (m_level!=5) { warn_doc_error(g_fileName,doctokenizerYYlineno,"<h%d> ended with </h5>", - m_level); + m_level); } goto endheader; } @@ -2977,7 +2980,7 @@ int DocHtmlHeader::parse() if (m_level!=6) { warn_doc_error(g_fileName,doctokenizerYYlineno,"<h%d> ended with </h6>", - m_level); + m_level); } goto endheader; } @@ -3010,7 +3013,7 @@ int DocHtmlHeader::parse() if (tok==0) { warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected end of comment while inside" - " <h%d> tag\n",m_level); + " <h%d> tag\n",m_level); } endheader: handlePendingStyleCommands(this,m_children); @@ -3045,7 +3048,7 @@ int DocHRef::parse() else { warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected html tag <%s%s> found within <a href=...> context", - g_token->endTag?"/":"",qPrint(g_token->name),doctokenizerYYlineno); + g_token->endTag?"/":"",qPrint(g_token->name)); } } break; @@ -3058,7 +3061,7 @@ int DocHRef::parse() if (tok==0) { warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected end of comment while inside" - " <a href=...> tag",doctokenizerYYlineno); + " <a href=...> tag"); } endhref: handlePendingStyleCommands(this,m_children); @@ -3084,7 +3087,7 @@ int DocInternal::parse(int level) DocPara *par = new DocPara(this); if (isFirst) { par->markFirst(); isFirst=FALSE; } retval=par->parse(); - if (!par->isEmpty()) + if (!par->isEmpty()) { m_children.append(par); lastPar=par; @@ -3095,9 +3098,9 @@ int DocInternal::parse(int level) } if (retval==TK_LISTITEM) { - warn_doc_error(g_fileName,doctokenizerYYlineno,"Invalid list item found",doctokenizerYYlineno); + warn_doc_error(g_fileName,doctokenizerYYlineno,"Invalid list item found"); } - } while (retval!=0 && + } while (retval!=0 && retval!=RetVal_Section && retval!=RetVal_Subsection && retval!=RetVal_Subsubsection && @@ -3107,7 +3110,7 @@ int DocInternal::parse(int level) if (lastPar) lastPar->markLast(); // then parse any number of level-n sections - while ((level==1 && retval==RetVal_Section) || + while ((level==1 && retval==RetVal_Section) || (level==2 && retval==RetVal_Subsection) || (level==3 && retval==RetVal_Subsubsection) || (level==4 && retval==RetVal_Paragraph) @@ -3152,8 +3155,8 @@ int DocIndexEntry::parse() case TK_WHITESPACE: m_entry+=" "; break; - case TK_WORD: - case TK_LNKWORD: + case TK_WORD: + case TK_LNKWORD: m_entry+=g_token->name; break; case TK_SYMBOL: @@ -3293,7 +3296,7 @@ int DocHtmlCaption::parse() if (tok==0) { warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected end of comment while inside" - " <caption> tag",doctokenizerYYlineno); + " <caption> tag"); } endcaption: handlePendingStyleCommands(this,m_children); @@ -3379,32 +3382,32 @@ int DocHtmlCell::parseXml() return retval; } -int DocHtmlCell::rowSpan() const +uint DocHtmlCell::rowSpan() const { - int retval = 0; + uint retval = 0; HtmlAttribList attrs = attribs(); uint i; - for (i=0; i<attrs.count(); ++i) + for (i=0; i<attrs.count(); ++i) { if (attrs.at(i)->name.lower()=="rowspan") { - retval = attrs.at(i)->value.toInt(); + retval = attrs.at(i)->value.toUInt(); break; } } return retval; } -int DocHtmlCell::colSpan() const +uint DocHtmlCell::colSpan() const { - int retval = 1; + uint retval = 1; HtmlAttribList attrs = attribs(); uint i; - for (i=0; i<attrs.count(); ++i) + for (i=0; i<attrs.count(); ++i) { if (attrs.at(i)->name.lower()=="colspan") { - retval = QMAX(1,attrs.at(i)->value.toInt()); + retval = QMAX(1,attrs.at(i)->value.toUInt()); break; } } @@ -3587,7 +3590,7 @@ int DocHtmlTable::parse() int retval=RetVal_OK; g_nodeStack.push(this); DBG(("DocHtmlTable::parse() start\n")); - + getrow: // get next token int tok=doctokenizerYYlex(); @@ -3635,14 +3638,14 @@ getrow: warn_doc_error(g_fileName,doctokenizerYYlineno,"expected <tr> tag but found %s token instead!", tokToString(tok)); } - + // parse one or more rows while (retval==RetVal_TableRow) { DocHtmlRow *tr=new DocHtmlRow(this,g_token->attribs); m_children.append(tr); retval=tr->parse(); - } + } computeTableGrid(); @@ -3657,7 +3660,7 @@ int DocHtmlTable::parseXml() int retval=RetVal_OK; g_nodeStack.push(this); DBG(("DocHtmlTable::parseXml() start\n")); - + // get next token int tok=doctokenizerYYlex(); // skip whitespace @@ -3686,7 +3689,7 @@ int DocHtmlTable::parseXml() m_children.append(tr); retval=tr->parseXml(isHeader); isHeader=FALSE; - } + } computeTableGrid(); @@ -3700,9 +3703,9 @@ int DocHtmlTable::parseXml() /** Helper class to compute the grid for an HTML style table */ struct ActiveRowSpan { - ActiveRowSpan(int rows,int col) : rowsLeft(rows), column(col) {} - int rowsLeft; - int column; + ActiveRowSpan(uint rows,uint col) : rowsLeft(rows), column(col) {} + uint rowsLeft; + uint column; }; /** List of ActiveRowSpan classes. */ @@ -3717,14 +3720,14 @@ void DocHtmlTable::computeTableGrid() //printf("computeTableGrid()\n"); RowSpanList rowSpans; rowSpans.setAutoDelete(TRUE); - int maxCols=0; - int rowIdx=1; + uint maxCols=0; + uint rowIdx=1; QListIterator<DocNode> li(children()); DocNode *rowNode; for (li.toFirst();(rowNode=li.current());++li) { - int colIdx=1; - int cells=0; + uint colIdx=1; + uint cells=0; if (rowNode->kind()==DocNode::Kind_HtmlRow) { uint i; @@ -3736,13 +3739,13 @@ void DocHtmlTable::computeTableGrid() if (cellNode->kind()==DocNode::Kind_HtmlCell) { DocHtmlCell *cell = (DocHtmlCell*)cellNode; - int rs = cell->rowSpan(); - int cs = cell->colSpan(); + uint rs = cell->rowSpan(); + uint cs = cell->colSpan(); for (i=0;i<rowSpans.count();i++) { - if (rowSpans.at(i)->rowsLeft>0 && - rowSpans.at(i)->column==colIdx) + if (rowSpans.at(i)->rowsLeft>0 && + rowSpans.at(i)->column==colIdx) { colIdx=rowSpans.at(i)->column+1; cells++; @@ -3752,7 +3755,7 @@ void DocHtmlTable::computeTableGrid() //printf("found cell at (%d,%d)\n",rowIdx,colIdx); cell->setRowIndex(rowIdx); cell->setColumnIndex(colIdx); - colIdx+=cs; + colIdx+=cs; cells++; } } @@ -3769,9 +3772,9 @@ void DocHtmlTable::computeTableGrid() m_numCols = maxCols; } -void DocHtmlTable::accept(DocVisitor *v) -{ - v->visitPre(this); +void DocHtmlTable::accept(DocVisitor *v) +{ + v->visitPre(this); // for HTML output we put the caption first //if (m_caption && v->id()==DocVisitor_Html) m_caption->accept(v); // doxygen 1.8.11: always put the caption first @@ -3781,7 +3784,7 @@ void DocHtmlTable::accept(DocVisitor *v) for (cli.toFirst();(n=cli.current());++cli) n->accept(v); // for other output formats we put the caption last //if (m_caption && v->id()!=DocVisitor_Html) m_caption->accept(v); - v->visitPost(this); + v->visitPost(this); } //--------------------------------------------------------------------------- @@ -3811,7 +3814,7 @@ int DocHtmlDescTitle::parse() { case CMD_REF: { - int tok=doctokenizerYYlex(); + tok=doctokenizerYYlex(); if (tok!=TK_WHITESPACE) { warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after \\%s command", @@ -3841,7 +3844,7 @@ int DocHtmlDescTitle::parse() // fall through case CMD_LINK: { - int tok=doctokenizerYYlex(); + tok=doctokenizerYYlex(); if (tok!=TK_WHITESPACE) { warn_doc_error(g_fileName,doctokenizerYYlineno,"expected whitespace after \\%s command", @@ -3877,7 +3880,7 @@ int DocHtmlDescTitle::parse() } } break; - case TK_SYMBOL: + case TK_SYMBOL: warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol \\%s found as part of a <dt> tag", qPrint(g_token->name)); break; @@ -3928,7 +3931,7 @@ int DocHtmlDescTitle::parse() if (tok==0) { warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected end of comment while inside" - " <dt> tag"); + " <dt> tag"); } endtitle: handlePendingStyleCommands(this,m_children); @@ -3958,7 +3961,7 @@ int DocHtmlDescData::parse() } while (retval==TK_NEWPARA); if (par) par->markLast(); - + DBG(("DocHtmlDescData::parse() end\n")); DocNode *n=g_nodeStack.pop(); ASSERT(n==this); @@ -4163,7 +4166,7 @@ int DocHtmlList::parse() m_children.append(li); retval=li->parse(); } while (retval==RetVal_ListItem); - + if (retval==0) { warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected end of comment while inside <%cl> block", @@ -4226,7 +4229,7 @@ int DocHtmlList::parseXml() if (retval==0) break; //printf("retval=%x g_token->name=%s\n",retval,qPrint(g_token->name)); } while (retval==RetVal_ListItem); - + if (retval==0) { warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected end of comment while inside <list type=\"%s\"> block", @@ -4237,8 +4240,8 @@ endlist: DBG(("DocHtmlList::parseXml() end retval=%x\n",retval)); DocNode *n=g_nodeStack.pop(); ASSERT(n==this); - return retval==RetVal_EndList || - (retval==RetVal_CloseXml || g_token->name=="list") ? + return retval==RetVal_EndList || + (retval==RetVal_CloseXml || g_token->name=="list") ? RetVal_OK : retval; } @@ -4250,7 +4253,7 @@ int DocHtmlBlockQuote::parse() int retval=0; g_nodeStack.push(this); - // parse one or more paragraphs + // parse one or more paragraphs bool isFirst=TRUE; DocPara *par=0; do @@ -4277,7 +4280,7 @@ int DocParBlock::parse() int retval=0; g_nodeStack.push(this); - // parse one or more paragraphs + // parse one or more paragraphs bool isFirst=TRUE; DocPara *par=0; do @@ -4328,17 +4331,17 @@ int DocSimpleList::parse() //-------------------------------------------------------------------------- -DocAutoListItem::DocAutoListItem(DocNode *parent,int indent,int num) +DocAutoListItem::DocAutoListItem(DocNode *parent,int indent,int num) : m_indent(indent), m_itemNum(num) -{ - m_parent = parent; +{ + m_parent = parent; } int DocAutoListItem::parse() { int retval = RetVal_OK; g_nodeStack.push(this); - + // first parse any number of paragraphs bool isFirst=TRUE; DocPara *lastPar=0; @@ -4347,7 +4350,7 @@ int DocAutoListItem::parse() DocPara *par = new DocPara(this); if (isFirst) { par->markFirst(); isFirst=FALSE; } retval=par->parse(); - if (!par->isEmpty()) + if (!par->isEmpty()) { m_children.append(par); if (lastPar) lastPar->markLast(FALSE); @@ -4371,11 +4374,11 @@ int DocAutoListItem::parse() //-------------------------------------------------------------------------- DocAutoList::DocAutoList(DocNode *parent,int indent,bool isEnumList, - int depth) : + int depth) : m_indent(indent), m_isEnumList(isEnumList), m_depth(depth) -{ - m_parent = parent; +{ + m_parent = parent; } int DocAutoList::parse() @@ -4395,11 +4398,11 @@ int DocAutoList::parse() m_children.append(li); retval=li->parse(); //printf("DocAutoList::parse(): retval=0x%x g_token->indent=%d m_indent=%d " - // "m_isEnumList=%d g_token->isEnumList=%d g_token->name=%s\n", + // "m_isEnumList=%d g_token->isEnumList=%d g_token->name=%s\n", // retval,g_token->indent,m_indent,m_isEnumList,g_token->isEnumList, // g_token->name.data()); //printf("num=%d g_token->id=%d\n",num,g_token->id); - } + } while (retval==TK_LISTITEM && // new list item m_indent==g_token->indent && // at same indent level m_isEnumList==g_token->isEnumList && // of the same kind @@ -4441,16 +4444,16 @@ void DocTitle::parseFromString(const QCString &text) //-------------------------------------------------------------------------- -DocSimpleSect::DocSimpleSect(DocNode *parent,Type t) : +DocSimpleSect::DocSimpleSect(DocNode *parent,Type t) : m_type(t) -{ - m_parent = parent; - m_title=0; +{ + m_parent = parent; + m_title=0; } DocSimpleSect::~DocSimpleSect() -{ - delete m_title; +{ + delete m_title; } void DocSimpleSect::accept(DocVisitor *v) @@ -4474,10 +4477,10 @@ int DocSimpleSect::parse(bool userTitle,bool needsSeparator) m_title = new DocTitle(this); m_title->parse(); } - + // add new paragraph as child DocPara *par = new DocPara(this); - if (m_children.isEmpty()) + if (m_children.isEmpty()) { par->markFirst(); } @@ -4489,7 +4492,7 @@ int DocSimpleSect::parse(bool userTitle,bool needsSeparator) par->markLast(); if (needsSeparator) m_children.append(new DocSimpleSectSep(this)); m_children.append(par); - + // parse the contents of the paragraph int retval = par->parse(); @@ -4515,7 +4518,7 @@ int DocSimpleSect::parseRcs() DBG(("DocSimpleSect::parseRcs()\n")); DocNode *n=g_nodeStack.pop(); ASSERT(n==this); - return RetVal_OK; + return RetVal_OK; } int DocSimpleSect::parseXml() @@ -4524,11 +4527,11 @@ int DocSimpleSect::parseXml() g_nodeStack.push(this); int retval = RetVal_OK; - for (;;) + for (;;) { // add new paragraph as child DocPara *par = new DocPara(this); - if (m_children.isEmpty()) + if (m_children.isEmpty()) { par->markFirst(); } @@ -4543,17 +4546,17 @@ int DocSimpleSect::parseXml() // parse the contents of the paragraph retval = par->parse(); if (retval == 0) break; - if (retval == RetVal_CloseXml) + if (retval == RetVal_CloseXml) { retval = RetVal_OK; break; } } - + DBG(("DocSimpleSect::parseXml() end retval=%d\n",retval)); DocNode *n=g_nodeStack.pop(); ASSERT(n==this); - return retval; + return retval; } void DocSimpleSect::appendLinkWord(const QCString &word) @@ -4567,12 +4570,12 @@ void DocSimpleSect::appendLinkWord(const QCString &word) else { p = (DocPara *)m_children.getLast(); - + // Comma-separate <seealso> links. p->injectToken(TK_WORD,","); p->injectToken(TK_WHITESPACE," "); } - + g_inSeeBlock=TRUE; p->injectToken(TK_LNKWORD,word); g_inSeeBlock=FALSE; @@ -4698,7 +4701,7 @@ int DocParamList::parseXml(const QCString ¶mName) g_hasReturnCommand=TRUE; checkRetvalName(g_token->name); } - + handleLinkedWord(this,m_params); do @@ -4727,11 +4730,11 @@ int DocParamList::parseXml(const QCString ¶mName) if (retval == 0) break; - } while (retval==RetVal_CloseXml && + } while (retval==RetVal_CloseXml && Mappers::htmlTagMapper->map(g_token->name)!=XML_PARAM && Mappers::htmlTagMapper->map(g_token->name)!=XML_TYPEPARAM && Mappers::htmlTagMapper->map(g_token->name)!=XML_EXCEPTION); - + if (retval==0) /* premature end of comment block */ { @@ -4787,7 +4790,7 @@ int DocParamSect::parse(const QCString &cmdName,bool xmlContext, Direction d) { retval = RetVal_OK; } - + DBG(("DocParamSect::parse() end retval=%d\n",retval)); DocNode *n=g_nodeStack.pop(); ASSERT(n==this); @@ -4922,7 +4925,7 @@ int DocPara::handleXRefItem() { m_children.append(ref); } - else + else { delete ref; } @@ -5316,7 +5319,7 @@ int DocPara::handleHtmlHeader(const HtmlAttribList &tagHtmlAttribs,int level) // For XML tags whose content is stored in attributes rather than // contained within the element, we need a way to inject the attribute // text into the current paragraph. -bool DocPara::injectToken(int tok,const QCString &tokText) +bool DocPara::injectToken(int tok,const QCString &tokText) { g_token->name = tokText; return defaultHandleToken(this,tok,m_children); @@ -5389,19 +5392,19 @@ int DocPara::handleCommand(const QCString &cmdName, const int tok) break; case CMD_EMPHASIS: m_children.append(new DocStyleChange(this,g_nodeStack.count(),DocStyleChange::Italic,cmdName,TRUE)); - retval=handleStyleArgument(this,m_children,cmdName); + retval=handleStyleArgument(this,m_children,cmdName); m_children.append(new DocStyleChange(this,g_nodeStack.count(),DocStyleChange::Italic,cmdName,FALSE)); if (retval!=TK_WORD) m_children.append(new DocWhiteSpace(this," ")); break; case CMD_BOLD: m_children.append(new DocStyleChange(this,g_nodeStack.count(),DocStyleChange::Bold,cmdName,TRUE)); - retval=handleStyleArgument(this,m_children,cmdName); + retval=handleStyleArgument(this,m_children,cmdName); m_children.append(new DocStyleChange(this,g_nodeStack.count(),DocStyleChange::Bold,cmdName,FALSE)); if (retval!=TK_WORD) m_children.append(new DocWhiteSpace(this," ")); break; case CMD_CODE: m_children.append(new DocStyleChange(this,g_nodeStack.count(),DocStyleChange::Code,cmdName,TRUE)); - retval=handleStyleArgument(this,m_children,cmdName); + retval=handleStyleArgument(this,m_children,cmdName); m_children.append(new DocStyleChange(this,g_nodeStack.count(),DocStyleChange::Code,cmdName,FALSE)); if (retval!=TK_WORD) m_children.append(new DocWhiteSpace(this," ")); break; @@ -5597,7 +5600,7 @@ int DocPara::handleCommand(const QCString &cmdName, const int tok) doctokenizerYYsetStateDbOnly(); retval = doctokenizerYYlex(); m_children.append(new DocVerbatim(this,g_context,g_token->verb,DocVerbatim::DocbookOnly,g_isExample,g_exampleName)); - if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"docbookonly section ended without end marker",doctokenizerYYlineno); + if (retval==0) warn_doc_error(g_fileName,doctokenizerYYlineno,"docbookonly section ended without end marker"); doctokenizerYYsetStatePara(); } break; @@ -5687,7 +5690,7 @@ int DocPara::handleCommand(const QCString &cmdName, const int tok) case CMD_ENDMSC: case CMD_ENDUML: warn_doc_error(g_fileName,doctokenizerYYlineno,"unexpected command %s",qPrint(g_token->name)); - break; + break; case CMD_PARAM: retval = handleParamSection(cmdName,DocParamSect::Param,FALSE,g_token->paramDir); break; @@ -5873,26 +5876,26 @@ int DocPara::handleCommand(const QCString &cmdName, const int tok) ASSERT(0); break; } - INTERNAL_ASSERT(retval==0 || retval==RetVal_OK || retval==RetVal_SimpleSec || + INTERNAL_ASSERT(retval==0 || retval==RetVal_OK || retval==RetVal_SimpleSec || retval==TK_LISTITEM || retval==TK_ENDLIST || retval==TK_NEWPARA || - retval==RetVal_Section || retval==RetVal_EndList || - retval==RetVal_Internal || retval==RetVal_SwitchLang || + retval==RetVal_Section || retval==RetVal_EndList || + retval==RetVal_Internal || retval==RetVal_SwitchLang || retval==RetVal_EndInternal ); DBG(("handleCommand(%s) end retval=%x\n",qPrint(cmdName),retval)); return retval; } -static bool findAttribute(const HtmlAttribList &tagHtmlAttribs, - const char *attrName, - QCString *result) +static bool findAttribute(const HtmlAttribList &tagHtmlAttribs, + const char *attrName, + QCString *result) { HtmlAttribListIterator li(tagHtmlAttribs); HtmlAttrib *opt; for (li.toFirst();(opt=li.current());++li) { - if (opt->name==attrName) + if (opt->name==attrName) { *result = opt->value; return TRUE; @@ -5906,7 +5909,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta DBG(("handleHtmlStartTag(%s,%d)\n",qPrint(tagName),tagHtmlAttribs.count())); int retval=RetVal_OK; int tagId = Mappers::htmlTagMapper->map(tagName); - if (g_token->emptyTag && !(tagId&XML_CmdMask) && + if (g_token->emptyTag && !(tagId&XML_CmdMask) && tagId!=HTML_UNKNOWN && tagId!=HTML_IMG && tagId!=HTML_BR && tagId!=HTML_HR && tagId!=HTML_P) { warn_doc_error(g_fileName,doctokenizerYYlineno,"HTML tag ('<%s/>') may not use the 'empty tag' XHTML syntax.", @@ -5914,7 +5917,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta } switch (tagId) { - case HTML_UL: + case HTML_UL: if (!g_token->emptyTag) { DocHtmlList *list = new DocHtmlList(this,tagHtmlAttribs,DocHtmlList::Unordered); @@ -5922,7 +5925,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta retval=list->parse(); } break; - case HTML_OL: + case HTML_OL: if (!g_token->emptyTag) { DocHtmlList *list = new DocHtmlList(this,tagHtmlAttribs,DocHtmlList::Ordered); @@ -5961,8 +5964,8 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta break; case HTML_CODE: if (g_token->emptyTag) break; - if (/*getLanguageFromFileName(g_fileName)==SrcLangExt_CSharp ||*/ g_xmlComment) - // for C# source or inside a <summary> or <remark> section we + if (/*getLanguageFromFileName(g_fileName)==SrcLangExt_CSharp ||*/ g_xmlComment) + // for C# source or inside a <summary> or <remark> section we // treat <code> as an XML tag (so similar to @code) { doctokenizerYYsetStateXmlCode(); @@ -6140,7 +6143,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta { //printf("paramName=%s\n",paramName.data()); m_children.append(new DocStyleChange(this,g_nodeStack.count(),DocStyleChange::Italic,tagName,TRUE)); - m_children.append(new DocWord(this,paramName)); + m_children.append(new DocWord(this,paramName)); m_children.append(new DocStyleChange(this,g_nodeStack.count(),DocStyleChange::Italic,tagName,FALSE)); if (retval!=TK_WORD) m_children.append(new DocWhiteSpace(this," ")); } @@ -6195,7 +6198,7 @@ int DocPara::handleHtmlStartTag(const QCString &tagName,const HtmlAttribList &ta case XML_SEE: // I'm not sure if <see> is the same as <seealso> or if it // should you link a member without producing a section. The - // C# specification is extremely vague about this (but what else + // C# specification is extremely vague about this (but what else // can we expect from Microsoft...) { QCString cref; @@ -6327,7 +6330,7 @@ int DocPara::handleHtmlEndTag(const QCString &tagName) int retval=RetVal_OK; switch (tagId) { - case HTML_UL: + case HTML_UL: if (!insideUL(this)) { warn_doc_error(g_fileName,doctokenizerYYlineno,"found </ul> tag without matching <ul>"); @@ -6337,7 +6340,7 @@ int DocPara::handleHtmlEndTag(const QCString &tagName) retval=RetVal_EndList; } break; - case HTML_OL: + case HTML_OL: if (!insideOL(this)) { warn_doc_error(g_fileName,doctokenizerYYlineno,"found </ol> tag without matching <ol>"); @@ -6555,8 +6558,8 @@ reparsetoken: DocNode::Kind k; if (insidePRE(this) || // all whitespace is relevant ( - // remove leading whitespace - !m_children.isEmpty() && + // remove leading whitespace + !m_children.isEmpty() && // and whitespace after certain constructs (k=m_children.getLast()->kind())!=DocNode::Kind_HtmlDescList && k!=DocNode::Kind_HtmlTable && @@ -6585,7 +6588,7 @@ reparsetoken: { DocAutoList *al = (DocAutoList *)n; DBG(("previous list item at %d\n",al->indent())); - if (al->indent()>=g_token->indent) + if (al->indent()>=g_token->indent) // new item at the same or lower indent level { retval=TK_LISTITEM; @@ -6596,9 +6599,9 @@ reparsetoken: // determine list depth int depth = 0; n=parent(); - while(n) + while(n) { - if (n->kind() == DocNode::Kind_AutoList && + if (n->kind() == DocNode::Kind_AutoList && ((DocAutoList*)n)->isEnumList()) depth++; n=n->parent(); } @@ -6651,7 +6654,7 @@ reparsetoken: } } break; - case TK_ENDLIST: + case TK_ENDLIST: DBG(("Found end of list inside of paragraph at line %d\n",doctokenizerYYlineno)); if (parent()->kind()==DocNode::Kind_AutoListItem) { @@ -6682,10 +6685,10 @@ reparsetoken: // see if we have to start a simple section int cmd = Mappers::cmdMapper->map(g_token->name); DocNode *n=parent(); - while (n && - n->kind()!=DocNode::Kind_SimpleSect && + while (n && + n->kind()!=DocNode::Kind_SimpleSect && n->kind()!=DocNode::Kind_ParamSect - ) + ) { n=n->parent(); } @@ -6736,25 +6739,25 @@ reparsetoken: DBG(("reparsing command %s\n",qPrint(g_token->name))); goto reparsetoken; } - else if (retval==RetVal_OK) + else if (retval==RetVal_OK) { // the command ended normally, keep scanning for new tokens. retval = 0; } else if (retval>0 && retval<RetVal_OK) - { + { // the command ended with a new command, reparse this token tok = retval; goto reparsetoken; } - else // end of file, end of paragraph, start or end of section + else // end of file, end of paragraph, start or end of section // or some auto list marker { goto endparagraph; } } break; - case TK_HTMLTAG: + case TK_HTMLTAG: { if (!g_token->endTag) // found a start tag { @@ -6764,7 +6767,7 @@ reparsetoken: { retval = handleHtmlEndTag(g_token->name); } - if (retval==RetVal_OK) + if (retval==RetVal_OK) { // the command ended normally, keep scanner for new tokens. retval = 0; @@ -6775,7 +6778,7 @@ reparsetoken: } } break; - case TK_SYMBOL: + case TK_SYMBOL: { DocSymbol::SymType s = DocSymbol::decodeSymbol(g_token->name); if (s!=DocSymbol::Sym_Unknown) @@ -6789,16 +6792,16 @@ reparsetoken: } break; } - case TK_NEWPARA: + case TK_NEWPARA: retval=TK_NEWPARA; goto endparagraph; case TK_RCSTAG: { DocNode *n=parent(); - while (n && - n->kind()!=DocNode::Kind_SimpleSect && + while (n && + n->kind()!=DocNode::Kind_SimpleSect && n->kind()!=DocNode::Kind_ParamSect - ) + ) { n=n->parent(); } @@ -6835,11 +6838,11 @@ endparagraph: { ((DocPara *)n)->setAttribs(g_token->attribs); } - INTERNAL_ASSERT(retval==0 || retval==TK_NEWPARA || retval==TK_LISTITEM || - retval==TK_ENDLIST || retval>RetVal_OK + INTERNAL_ASSERT(retval==0 || retval==TK_NEWPARA || retval==TK_LISTITEM || + retval==TK_ENDLIST || retval>RetVal_OK ); - return retval; + return retval; } //-------------------------------------------------------------------------- @@ -6870,7 +6873,7 @@ int DocSection::parse() DocPara *par = new DocPara(this); if (isFirst) { par->markFirst(); isFirst=FALSE; } retval=par->parse(); - if (!par->isEmpty()) + if (!par->isEmpty()) { m_children.append(par); lastPar=par; @@ -6893,7 +6896,7 @@ int DocSection::parse() retval=RetVal_OK; } } - } while (retval!=0 && + } while (retval!=0 && retval!=RetVal_Section && retval!=RetVal_Subsection && retval!=RetVal_Subsubsection && @@ -6945,7 +6948,7 @@ int DocSection::parse() m_children.append(s); retval = s->parse(); } - if (!(m_level<Doxygen::subpageNestingLevel+3 && (retval == RetVal_Subsection || retval == RetVal_Subsubsection))) break; + if (!(m_level<Doxygen::subpageNestingLevel+3 && (retval == RetVal_Subsection || retval == RetVal_Subsubsection))) break; } else { @@ -6953,11 +6956,11 @@ int DocSection::parse() } } - INTERNAL_ASSERT(retval==0 || - retval==RetVal_Section || - retval==RetVal_Subsection || - retval==RetVal_Subsubsection || - retval==RetVal_Paragraph || + INTERNAL_ASSERT(retval==0 || + retval==RetVal_Section || + retval==RetVal_Subsection || + retval==RetVal_Subsubsection || + retval==RetVal_Paragraph || retval==RetVal_Internal || retval==RetVal_EndInternal ); @@ -6975,19 +6978,19 @@ void DocText::parse() DBG(("DocText::parse() start\n")); g_nodeStack.push(this); doctokenizerYYsetStateText(); - + int tok; while ((tok=doctokenizerYYlex())) // get the next token { switch(tok) { - case TK_WORD: + case TK_WORD: m_children.append(new DocWord(this,g_token->name)); break; - case TK_WHITESPACE: + case TK_WHITESPACE: m_children.append(new DocWhiteSpace(this,g_token->chars)); break; - case TK_SYMBOL: + case TK_SYMBOL: { DocSymbol::SymType s = DocSymbol::decodeSymbol(g_token->name); if (s!=DocSymbol::Sym_Unknown) @@ -7262,7 +7265,7 @@ static QCString extractCopyDocId(const char *data, uint &j, uint len) case '\'': insideSQuote=TRUE; break; case ' ': // fall through case '\t': // fall through - case '\n': + case '\n': found=(round==0); break; } @@ -7581,10 +7584,10 @@ DocRoot *validatingParseDoc(const char *fileName,int startLine, docParserPushContext(); if (ctx && ctx!=Doxygen::globalScope && - (ctx->definitionType()==Definition::TypeClass || + (ctx->definitionType()==Definition::TypeClass || ctx->definitionType()==Definition::TypeNamespace - ) - ) + ) + ) { g_context = ctx->name(); } @@ -7622,7 +7625,7 @@ DocRoot *validatingParseDoc(const char *fileName,int startLine, { g_searchUrl=md->getOutputFileBase(); Doxygen::searchIndex->setCurrentDoc( - (md->getLanguage()==SrcLangExt_Fortran ? + (md->getLanguage()==SrcLangExt_Fortran ? theTranslator->trSubprogram(TRUE,TRUE): theTranslator->trMember(TRUE,TRUE))+" "+md->qualifiedName(), g_searchUrl, @@ -7702,8 +7705,8 @@ DocRoot *validatingParseDoc(const char *fileName,int startLine, } g_fileName = fileName; - g_relPath = (!linkFromIndex && ctx) ? - QCString(relativePathToRoot(ctx->getOutputFileBase())) : + g_relPath = (!linkFromIndex && ctx) ? + QCString(relativePathToRoot(ctx->getOutputFileBase())) : QCString(""); //printf("ctx->name=%s relPath=%s\n",ctx->name().data(),g_relPath.data()); g_memberDef = md; @@ -7724,7 +7727,7 @@ DocRoot *validatingParseDoc(const char *fileName,int startLine, g_retvalsFound.clear(); g_paramsFound.setAutoDelete(FALSE); g_paramsFound.clear(); - + //printf("Starting comment block at %s:%d\n",g_fileName.data(),startLine); doctokenizerYYlineno=startLine; uint inpLen=qstrlen(input); @@ -7762,7 +7765,7 @@ DocRoot *validatingParseDoc(const char *fileName,int startLine, //printf(">>>>>> end validatingParseDoc(%s,%s)\n",ctx?ctx->name().data():"<none>", // md?md->name().data():"<none>"); - + return root; } @@ -7827,4 +7830,3 @@ void docFindSections(const char *input, { doctokenizerYYFindSections(input,d,fileName); } - diff --git a/src/docparser.h b/src/docparser.h index b414d9b..d05dea9 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -196,20 +196,20 @@ template<class T> class CompAccept : public DocNode } const QList<DocNode> &children() const { return m_children; } QList<DocNode> &children() { return m_children; } - QString::Direction getTextDir(int nodeIndex) const + QString::Direction getTextDir(uint nodeIndex) const { unsigned char resultDir = QString::DirNeutral; for (uint i = nodeIndex; i < m_children.count(); i++) { DocNode* node = m_children.at(i); QString::Direction nodeDir = node->getTextDir(); - resultDir |= nodeDir; + resultDir |= (unsigned char)nodeDir; if (resultDir == QString::DirMixed) return QString::DirMixed; } return static_cast<QString::Direction>(resultDir); } - QString::Direction getTextBasicDir(int nodeIndex) const + QString::Direction getTextBasicDir(uint nodeIndex) const { for (uint i = nodeIndex; i < m_children.count(); i++) { @@ -529,7 +529,7 @@ class DocSeparator : public DocNode m_chars(chars) { m_parent = parent; } Kind kind() const { return Kind_Sep; } QCString chars() const { return m_chars; } - void accept(DocVisitor *v) { } + void accept(DocVisitor *) { } private: QCString m_chars; }; @@ -586,17 +586,17 @@ class DocInclude : public DocNode DocInclude(DocNode *parent,const QCString &file, const QCString context, Type t, bool isExample,const QCString exampleFile, - const QCString blockId, bool isBlock) : + const QCString blockId, bool isBlock) : m_file(file), m_context(context), m_type(t), - m_isExample(isExample), m_exampleFile(exampleFile), - m_blockId(blockId), m_isBlock(isBlock) { m_parent = parent; } + m_isExample(isExample), m_isBlock(isBlock), + m_exampleFile(exampleFile), m_blockId(blockId) { m_parent = parent; } Kind kind() const { return Kind_Include; } QCString file() const { return m_file; } - QCString extension() const { int i=m_file.findRev('.'); - if (i!=-1) - return m_file.right(m_file.length()-i); - else - return ""; + QCString extension() const { int i=m_file.findRev('.'); + if (i!=-1) + return m_file.right(m_file.length()-(uint)i); + else + return ""; } Type type() const { return m_type; } QCString text() const { return m_text; } @@ -612,9 +612,9 @@ class DocInclude : public DocNode QCString m_file; QCString m_context; QCString m_text; - Type m_type = Include; - bool m_isExample = false; - bool m_isBlock = false; + Type m_type; + bool m_isExample; + bool m_isBlock; QCString m_exampleFile; QCString m_blockId; }; @@ -1336,9 +1336,7 @@ class DocHtmlCell : public CompAccept<DocHtmlCell> public: enum Alignment { Left, Right, Center }; DocHtmlCell(DocNode *parent,const HtmlAttribList &attribs,bool isHeading) : - m_isHeading(isHeading), - m_isFirst(FALSE), m_isLast(FALSE), m_attribs(attribs), - m_rowIdx(-1), m_colIdx(-1) { m_parent = parent; } + m_isHeading(isHeading), m_attribs(attribs) { m_parent = parent; } bool isHeading() const { return m_isHeading; } bool isFirst() const { return m_isFirst; } bool isLast() const { return m_isLast; } @@ -1348,21 +1346,21 @@ class DocHtmlCell : public CompAccept<DocHtmlCell> const HtmlAttribList &attribs() const { return m_attribs; } int parse(); int parseXml(); - int rowIndex() const { return m_rowIdx; } - int columnIndex() const { return m_colIdx; } - int rowSpan() const; - int colSpan() const; + uint rowIndex() const { return m_rowIdx; } + uint columnIndex() const { return m_colIdx; } + uint rowSpan() const; + uint colSpan() const; Alignment alignment() const; private: - void setRowIndex(int idx) { m_rowIdx = idx; } - void setColumnIndex(int idx) { m_colIdx = idx; } + void setRowIndex(uint idx) { m_rowIdx = idx; } + void setColumnIndex(uint idx) { m_colIdx = idx; } bool m_isHeading = false; bool m_isFirst = false; bool m_isLast = false; HtmlAttribList m_attribs; - int m_rowIdx = -1; - int m_colIdx = -1; + uint m_rowIdx = (uint)-1; + uint m_colIdx = (uint)-1; }; /** Node representing a HTML table caption */ @@ -1390,7 +1388,7 @@ class DocHtmlRow : public CompAccept<DocHtmlRow> friend class DocHtmlTable; public: DocHtmlRow(DocNode *parent,const HtmlAttribList &attribs) : - m_attribs(attribs), m_visibleCells(-1), m_rowIdx(-1) { m_parent = parent; } + m_attribs(attribs) { m_parent = parent; } Kind kind() const { return Kind_HtmlRow; } uint numCells() const { return m_children.count(); } const HtmlAttribList &attribs() const { return m_attribs; } @@ -1409,15 +1407,15 @@ class DocHtmlRow : public CompAccept<DocHtmlRow> } return m_children.count()>0 && heading; } - void setVisibleCells(int n) { m_visibleCells = n; } - int visibleCells() const { return m_visibleCells; } - int rowIndex() const { return m_rowIdx; } + void setVisibleCells(uint n) { m_visibleCells = n; } + uint visibleCells() const { return m_visibleCells; } + uint rowIndex() const { return m_rowIdx; } private: - void setRowIndex(int idx) { m_rowIdx = idx; } + void setRowIndex(uint idx) { m_rowIdx = idx; } HtmlAttribList m_attribs; - int m_visibleCells = -1; - int m_rowIdx = -1; + uint m_visibleCells = 0; + uint m_rowIdx = (uint)-1; }; /** Node representing a HTML table */ @@ -1446,7 +1444,7 @@ class DocHtmlTable : public CompAccept<DocHtmlTable> void computeTableGrid(); DocHtmlCaption *m_caption = 0; HtmlAttribList m_attribs; - int m_numCols = 0; + uint m_numCols = 0; }; /** Node representing an HTML blockquote */ diff --git a/src/docsets.cpp b/src/docsets.cpp index a838923..d92e4f3 100644 --- a/src/docsets.cpp +++ b/src/docsets.cpp @@ -328,7 +328,6 @@ void DocSets::addIndexItem(const Definition *context,const MemberDef *md, case SrcLangExt_VHDL: lang="vhdl"; break; // VHDL case SrcLangExt_XML: lang="xml"; break; // DBUS XML case SrcLangExt_SQL: lang="sql"; break; // Sql - case SrcLangExt_Tcl: lang="tcl"; break; // Tcl case SrcLangExt_Markdown:lang="markdown"; break; // Markdown case SrcLangExt_Slice: lang="slice"; break; // Slice case SrcLangExt_Unknown: lang="unknown"; break; // should not happen! diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 5b10e5c..cfabd31 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -46,6 +46,8 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 +#define USE_STATE2STRING 0 + #define TK_COMMAND_SEL() (yytext[0] == '@' ? TK_COMMAND_AT : TK_COMMAND_BS) //-------------------------------------------------------------------------- @@ -79,7 +81,9 @@ struct DocLexerContext static QStack<DocLexerContext> g_lexerStack; +#if USE_STATE2STRING static const char *stateToString(int state); +#endif //-------------------------------------------------------------------------- void doctokenizerYYpushContext() @@ -323,9 +327,9 @@ static QCString stripEmptyLines(const QCString &s) #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); -static int yyread(char *buf,int max_size) +static yy_size_t yyread(char *buf,yy_size_t max_size) { - int c=0; + yy_size_t c=0; const char *src=g_inputString+g_inputPos; while ( c < max_size && *src ) *buf++ = *src++, c++; g_inputPos+=c; @@ -1631,4 +1635,6 @@ void doctokenizerYYendAutoList() // return retval; //} +#if USE_STATE2STRING #include "doctokenizer.l.h" +#endif diff --git a/src/dot.cpp b/src/dot.cpp index f26bee4..acf4db9 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -83,10 +83,8 @@ DotManager *DotManager::instance() return m_theInstance; } -DotManager::DotManager() : m_runners(1009), m_filePatchers(1009) +DotManager::DotManager() : m_runners(), m_filePatchers() { - m_runners.setAutoDelete(TRUE); - m_filePatchers.setAutoDelete(TRUE); m_queue = new DotRunnerQueue; int i; int dotNumThreads = Config_getInt(DOT_NUM_THREADS); @@ -114,40 +112,44 @@ DotManager::~DotManager() delete m_queue; } -DotRunner* DotManager::createRunner(const QCString& absDotName, const QCString& md5Hash) +DotRunner* DotManager::createRunner(const std::string &absDotName, const std::string& md5Hash) { - DotRunner * run = m_runners.find(absDotName); - if (run == 0) + DotRunner* rv = nullptr; + auto const runit = m_runners.find(absDotName); + if (runit == m_runners.end()) { - run = new DotRunner(absDotName, md5Hash); - m_runners.insert(absDotName, run); + auto insobj = std::make_unique<DotRunner>(absDotName, md5Hash); + rv = insobj.get(); + m_runners.emplace(absDotName, std::move(insobj)); } else { // we have a match - if (md5Hash != QCString(run->getMd5Hash().data())) + if (md5Hash != runit->second->getMd5Hash()) { err("md5 hash does not match for two different runs of %s !\n", absDotName.data()); } + rv = runit->second.get(); } - return run; + assert(rv); + return rv; } -DotFilePatcher *DotManager::createFilePatcher(const QCString &fileName) +DotFilePatcher *DotManager::createFilePatcher(const std::string &fileName) { - DotFilePatcher *patcher = m_filePatchers.find(fileName); - if (patcher==0) - { - patcher = new DotFilePatcher(fileName); - m_filePatchers.append(fileName,patcher); - } - return patcher; + auto patcher = m_filePatchers.find(fileName); + + if (patcher != m_filePatchers.end()) return &(patcher->second); + + auto rv = m_filePatchers.emplace(fileName, fileName.c_str()); + assert(rv.second); + return &(rv.first->second); } bool DotManager::run() const { - uint numDotRuns = m_runners.count(); - uint numFilePatchers = m_filePatchers.count(); + uint numDotRuns = m_runners.size(); + uint numFilePatchers = m_filePatchers.size(); if (numDotRuns+numFilePatchers>1) { if (m_workers.count()==0) @@ -160,7 +162,6 @@ bool DotManager::run() const } } int i=1; - QDictIterator<DotRunner> li(m_runners); bool setPath=FALSE; if (Config_getBool(GENERATE_HTML)) @@ -185,22 +186,21 @@ bool DotManager::run() const } Portable::sysTimerStart(); // fill work queue with dot operations - DotRunner *dr; int prev=1; if (m_workers.count()==0) // no threads to work with { - for (li.toFirst();(dr=li.current());++li) + for (auto & dr : m_runners) { msg("Running dot for graph %d/%d\n",prev,numDotRuns); - dr->run(); + dr.second->run(); prev++; } } else // use multiple threads to run instances of dot in parallel { - for (li.toFirst();(dr=li.current());++li) + for (auto & dr: m_runners) { - m_queue->enqueue(dr); + m_queue->enqueue(dr.second.get()); } // wait for the queue to become empty while ((i=m_queue->count())>0) @@ -237,27 +237,25 @@ bool DotManager::run() const // patch the output file and insert the maps and figures i=1; - SDict<DotFilePatcher>::Iterator di(m_filePatchers); - const DotFilePatcher *fp; // since patching the svg files may involve patching the header of the SVG // (for zoomable SVGs), and patching the .html files requires reading that // header after the SVG is patched, we first process the .svg files and // then the other files. - for (di.toFirst();(fp=di.current());++di) + for (auto & fp : m_filePatchers) { - if (fp->isSVGFile()) + if (fp.second.isSVGFile()) { msg("Patching output file %d/%d\n",i,numFilePatchers); - if (!fp->run()) return FALSE; + if (!fp.second.run()) return FALSE; i++; } } - for (di.toFirst();(fp=di.current());++di) + for (auto& fp : m_filePatchers) { - if (!fp->isSVGFile()) + if (!fp.second.isSVGFile()) { msg("Patching output file %d/%d\n",i,numFilePatchers); - if (!fp->run()) return FALSE; + if (!fp.second.run()) return FALSE; i++; } } @@ -280,7 +278,7 @@ void writeDotGraphFromFile(const char *inFile,const char *outDir, QCString absImgName = d.absPath().utf8()+"/"+imgName; QCString absOutFile = d.absPath().utf8()+"/"+outFile; - DotRunner dotRun(inFile, QCString()); + DotRunner dotRun(inFile); if (format==GOF_BITMAP) { dotRun.addJob(Config_getEnum(DOT_IMAGE_FORMAT),absImgName); @@ -333,7 +331,7 @@ void writeDotImageMapFromFile(FTextStream &t, QCString imgName = baseName+"."+imgExt; QCString absOutFile = d.absPath().utf8()+"/"+mapName; - DotRunner dotRun(inFile, QCString()); + DotRunner dotRun(inFile.data()); dotRun.addJob(MAP_CMD,absOutFile); dotRun.preventCleanUp(); if (!dotRun.run()) @@ -17,8 +17,8 @@ #define DOT_H #include <qlist.h> -#include <qdict.h> #include <qcstring.h> +#include <map> #include "sortdict.h" @@ -35,16 +35,16 @@ class DotManager { public: static DotManager *instance(); - DotRunner* createRunner(const QCString& absDotName, const QCString& md5Hash); - DotFilePatcher *createFilePatcher(const QCString &fileName); + DotRunner* createRunner(const std::string& absDotName, const std::string& md5Hash); + DotFilePatcher *createFilePatcher(const std::string &fileName); bool run() const; private: DotManager(); virtual ~DotManager(); - QDict<DotRunner> m_runners; - SDict<DotFilePatcher> m_filePatchers; + std::map<std::string, std::unique_ptr<DotRunner>> m_runners; + std::map<std::string, DotFilePatcher> m_filePatchers; static DotManager *m_theInstance; DotRunnerQueue *m_queue; QList<DotWorkerThread> m_workers; diff --git a/src/dotclassgraph.cpp b/src/dotclassgraph.cpp index da272b4..eb6c179 100644 --- a/src/dotclassgraph.cpp +++ b/src/dotclassgraph.cpp @@ -13,6 +13,8 @@ * */ +#include <vector> + #include "dotclassgraph.h" #include "dotnode.h" @@ -149,8 +151,8 @@ bool DotClassGraph::determineVisibleNodes(DotNode *rootNode, { QList<DotNode> childQueue; QList<DotNode> parentQueue; - QArray<int> childTreeWidth; - QArray<int> parentTreeWidth; + std::vector<int> childTreeWidth; + std::vector<int> parentTreeWidth; childQueue.append(rootNode); if (includeParents) parentQueue.append(rootNode); bool firstNode=TRUE; // flag to force reprocessing rootNode in the parent loop diff --git a/src/dotdirdeps.cpp b/src/dotdirdeps.cpp index c70128c..66a68df 100644 --- a/src/dotdirdeps.cpp +++ b/src/dotdirdeps.cpp @@ -90,50 +90,52 @@ void writeDotDirDepGraph(FTextStream &t,const DirDef *dd,bool linkRelations) } // add nodes for other used directories - QDictIterator<UsedDir> udi(*dd->usedDirs()); - UsedDir *udir; - //printf("*** For dir %s\n",shortName().data()); - for (udi.toFirst();(udir=udi.current());++udi) - // for each used dir (=directly used or a parent of a directly used dir) { - const DirDef *usedDir=udir->dir(); - const DirDef *dir=dd; - while (dir) + QDictIterator<UsedDir> udi(*dd->usedDirs()); + UsedDir *udir; + //printf("*** For dir %s\n",shortName().data()); + for (udi.toFirst();(udir=udi.current());++udi) + // for each used dir (=directly used or a parent of a directly used dir) { - //printf("*** check relation %s->%s same_parent=%d !%s->isParentOf(%s)=%d\n", - // dir->shortName().data(),usedDir->shortName().data(), - // dir->parent()==usedDir->parent(), - // usedDir->shortName().data(), - // shortName().data(), - // !usedDir->isParentOf(this) - // ); - if (dir!=usedDir && dir->parent()==usedDir->parent() && - !usedDir->isParentOf(dd)) - // include if both have the same parent (or no parent) + const DirDef *usedDir=udir->dir(); + const DirDef *dir=dd; + while (dir) { - t << " " << usedDir->getOutputFileBase() << " [shape=box label=\"" - << usedDir->shortName() << "\""; - if (usedDir->isCluster()) + //printf("*** check relation %s->%s same_parent=%d !%s->isParentOf(%s)=%d\n", + // dir->shortName().data(),usedDir->shortName().data(), + // dir->parent()==usedDir->parent(), + // usedDir->shortName().data(), + // shortName().data(), + // !usedDir->isParentOf(this) + // ); + if (dir!=usedDir && dir->parent()==usedDir->parent() && + !usedDir->isParentOf(dd)) + // include if both have the same parent (or no parent) { - if (!Config_getBool(DOT_TRANSPARENT)) + t << " " << usedDir->getOutputFileBase() << " [shape=box label=\"" + << usedDir->shortName() << "\""; + if (usedDir->isCluster()) { - t << " fillcolor=\"white\" style=\"filled\""; + if (!Config_getBool(DOT_TRANSPARENT)) + { + t << " fillcolor=\"white\" style=\"filled\""; + } + t << " color=\"red\""; } - t << " color=\"red\""; + t << " URL=\"" << usedDir->getOutputFileBase() + << Doxygen::htmlFileExtension << "\"];\n"; + dirsInGraph.insert(usedDir->getOutputFileBase(),usedDir); + break; } - t << " URL=\"" << usedDir->getOutputFileBase() - << Doxygen::htmlFileExtension << "\"];\n"; - dirsInGraph.insert(usedDir->getOutputFileBase(),usedDir); - break; + dir=dir->parent(); } - dir=dir->parent(); } } // add relations between all selected directories const DirDef *dir; QDictIterator<DirDef> di(dirsInGraph); - for (di.toFirst();(dir=di.current());++di) // foreach dir in the graph + for (;(dir=di.current());++di) // foreach dir in the graph { QDictIterator<UsedDir> udi(*dir->usedDirs()); UsedDir *udir; diff --git a/src/dotfilepatcher.cpp b/src/dotfilepatcher.cpp index 7a65d89..e386af9 100644 --- a/src/dotfilepatcher.cpp +++ b/src/dotfilepatcher.cpp @@ -506,8 +506,8 @@ bool DotFilePatcher::run() const fo.close(); // keep original SVG file so we can refer to it, we do need to replace // dummy link by real ones - QFile fi(tmpName); - QFile fo(orgName); + fi.setName(tmpName); + fo.setName(orgName); if (!fi.open(IO_ReadOnly)) { err("problem opening file %s for reading!\n",tmpName.data()); @@ -518,7 +518,7 @@ bool DotFilePatcher::run() const err("problem opening file %s for writing!\n",orgName.data()); return FALSE; } - FTextStream t(&fo); + FTextStream to(&fo); while (!fi.atEnd()) // foreach line { QCString line(maxLineLen); @@ -529,7 +529,7 @@ bool DotFilePatcher::run() const } line.resize(numBytes+1); Map *map = m_maps.at(0); // there is only one 'map' for a SVG file - t << replaceRef(line,map->relPath,map->urlOnly,map->context,"_top"); + to << replaceRef(line,map->relPath,map->urlOnly,map->context,"_top"); } fi.close(); fo.close(); diff --git a/src/dotgraph.cpp b/src/dotgraph.cpp index 0bfa712..e622dd4 100644 --- a/src/dotgraph.cpp +++ b/src/dotgraph.cpp @@ -186,14 +186,14 @@ bool DotGraph::prepareDotFile() if (m_graphFormat == GOF_BITMAP) { // run dot to create a bitmap image - DotRunner * dotRun = DotManager::instance()->createRunner(absDotName(), sigStr); + DotRunner * dotRun = DotManager::instance()->createRunner(absDotName().data(), sigStr.data()); dotRun->addJob(Config_getEnum(DOT_IMAGE_FORMAT), absImgName()); if (m_generateImageMap) dotRun->addJob(MAP_CMD, absMapName()); } else if (m_graphFormat == GOF_EPS) { // run dot to create a .eps image - DotRunner *dotRun = DotManager::instance()->createRunner(absDotName(), sigStr); + DotRunner *dotRun = DotManager::instance()->createRunner(absDotName().data(), sigStr.data()); if (Config_getBool(USE_PDFLATEX)) { dotRun->addJob("pdf",absImgName()); @@ -233,11 +233,11 @@ void DotGraph::generateCode(FTextStream &t) if (m_regenerate) { DotManager::instance()-> - createFilePatcher(absImgName())-> + createFilePatcher(absImgName().data())-> addSVGConversion(m_relPath,FALSE,QCString(),m_zoomable,m_graphId); } int mapId = DotManager::instance()-> - createFilePatcher(m_fileName)-> + createFilePatcher(m_fileName.data())-> addSVGObject(m_baseName,absImgName(),m_relPath); t << "<!-- SVG " << mapId << " -->" << endl; } @@ -252,7 +252,7 @@ void DotGraph::generateCode(FTextStream &t) if (m_regenerate || !insertMapFile(t, absMapName(), m_relPath, getMapLabel())) { int mapId = DotManager::instance()-> - createFilePatcher(m_fileName)-> + createFilePatcher(m_fileName.data())-> addMap(absMapName(), m_relPath, m_urlOnly, QCString(), getMapLabel()); t << "<!-- MAP " << mapId << " -->" << endl; } @@ -263,7 +263,7 @@ void DotGraph::generateCode(FTextStream &t) if (m_regenerate || !DotFilePatcher::writeVecGfxFigure(t,m_baseName,absBaseName())) { int figId = DotManager::instance()-> - createFilePatcher(m_fileName)-> + createFilePatcher(m_fileName.data())-> addFigure(m_baseName,absBaseName(),FALSE /*TRUE*/); t << endl << "% FIG " << figId << endl; } diff --git a/src/dotgraph.h b/src/dotgraph.h index edba009..b90d980 100644 --- a/src/dotgraph.h +++ b/src/dotgraph.h @@ -31,7 +31,8 @@ enum GraphType { Dependency, Inheritance, Collaboration, Hierarchy, C class DotGraph { public: - DotGraph() : m_curNodeNumber(0), m_doNotAddImageToIndex(FALSE), m_noDivTag(FALSE), m_zoomable(TRUE), m_urlOnly(FALSE) {} + DotGraph() : m_doNotAddImageToIndex(FALSE), m_noDivTag(FALSE), + m_zoomable(TRUE), m_urlOnly(FALSE) {} virtual ~DotGraph() {} protected: @@ -98,7 +99,7 @@ class DotGraph bool prepareDotFile(); void generateCode(FTextStream &t); - int m_curNodeNumber; + int m_curNodeNumber = 0; }; #endif diff --git a/src/dotlegendgraph.cpp b/src/dotlegendgraph.cpp index 98e1f88..b17a293 100644 --- a/src/dotlegendgraph.cpp +++ b/src/dotlegendgraph.cpp @@ -29,7 +29,7 @@ void DotLegendGraph::writeGraph(const char *path) if (getDotImageExtension()=="svg") { DotManager::instance()-> - createFilePatcher(absBaseName()+Config_getString(HTML_FILE_EXTENSION))-> + createFilePatcher((absBaseName()+Config_getString(HTML_FILE_EXTENSION)).data())-> addSVGObject("graph_legend", absImgName(),QCString()); } } diff --git a/src/dotnode.cpp b/src/dotnode.cpp index 9eccdde..86ae43a 100644 --- a/src/dotnode.cpp +++ b/src/dotnode.cpp @@ -258,23 +258,12 @@ static QCString stripProtectionPrefix(const QCString &s) DotNode::DotNode(int n,const char *lab,const char *tip, const char *url, bool isRoot,const ClassDef *cd) - : m_subgraphId(-1) - , m_number(n) + : m_number(n) , m_label(lab) , m_tooltip(tip) , m_url(url) - , m_parents(0) - , m_children(0) - , m_edgeInfo(0) - , m_deleted(FALSE) - , m_written(FALSE) - , m_hasDoc(FALSE) , m_isRoot(isRoot) , m_classDef(cd) - , m_visible(FALSE) - , m_truncated(Unknown) - , m_distance(1000) - , m_renumbered(false) { } @@ -408,14 +397,14 @@ void DotNode::writeBox(FTextStream &t, { if (!ei->label().isEmpty()) // labels joined by \n { - int li=ei->label().find('\n'); + int i=ei->label().find('\n'); int p=0; QCString lab; - while ((li=ei->label().find('\n',p))!=-1) + while ((i=ei->label().find('\n',p))!=-1) { - lab = stripProtectionPrefix(ei->label().mid(p,li-p)); + lab = stripProtectionPrefix(ei->label().mid(p,i-p)); arrowNames.insert(lab,(void*)0x8); - p=li+1; + p=i+1; } lab = stripProtectionPrefix(ei->label().right(ei->label().length()-p)); arrowNames.insert(lab,(void*)0x8); diff --git a/src/dotnode.h b/src/dotnode.h index 334fdef..92f268e 100644 --- a/src/dotnode.h +++ b/src/dotnode.h @@ -107,22 +107,22 @@ class DotNode private: int m_number; - QCString m_label; //!< label text - QCString m_tooltip; //!< node's tooltip - QCString m_url; //!< url of the node (format: remote$local) - QList<DotNode> *m_parents; //!< list of parent nodes (incoming arrows) - QList<DotNode> *m_children; //!< list of child nodes (outgoing arrows) - QList<EdgeInfo> *m_edgeInfo; //!< edge info for each child - bool m_deleted; //!< used to mark a node as deleted - mutable bool m_written; //!< used to mark a node as written - bool m_hasDoc; //!< used to mark a node as documented - bool m_isRoot; //!< indicates if this is a root node - const ClassDef * m_classDef; //!< class representing this node (can be 0) - bool m_visible; //!< is the node visible in the output - TruncState m_truncated; //!< does the node have non-visible children/parents - int m_distance; //!< shortest path to the root node - bool m_renumbered;//!< indicates if the node has been renumbered (to prevent endless loops) - int m_subgraphId; + QCString m_label; //!< label text + QCString m_tooltip; //!< node's tooltip + QCString m_url; //!< url of the node (format: remote$local) + QList<DotNode> *m_parents = 0; //!< list of parent nodes (incoming arrows) + QList<DotNode> *m_children = 0; //!< list of child nodes (outgoing arrows) + QList<EdgeInfo> *m_edgeInfo = 0; //!< edge info for each child + bool m_deleted = false; //!< used to mark a node as deleted + mutable bool m_written = false; //!< used to mark a node as written + bool m_hasDoc = false; //!< used to mark a node as documented + bool m_isRoot; //!< indicates if this is a root node + const ClassDef * m_classDef; //!< class representing this node (can be 0) + bool m_visible = false; //!< is the node visible in the output + TruncState m_truncated = Unknown; //!< does the node have non-visible children/parents + int m_distance = 1000; //!< shortest path to the root node + bool m_renumbered = false; //!< indicates if the node has been renumbered (to prevent endless loops) + int m_subgraphId = -1; }; /** Class representing a list of DotNode objects. */ diff --git a/src/dotrunner.cpp b/src/dotrunner.cpp index 22a113a..cb6bd73 100644 --- a/src/dotrunner.cpp +++ b/src/dotrunner.cpp @@ -15,6 +15,7 @@ #include "dotrunner.h" +#include "qstring.h" #include "util.h" #include "portable.h" #include "dot.h" @@ -145,29 +146,31 @@ bool DotRunner::readBoundingBox(const char *fileName,int *width,int *height,bool //--------------------------------------------------------------------------------- -DotRunner::DotRunner(const QCString& absDotName, const QCString& md5Hash) - : m_file(absDotName), m_md5Hash(md5Hash), m_cleanUp(Config_getBool(DOT_CLEANUP)), - m_dotExe(Config_getString(DOT_PATH)+"dot") +DotRunner::DotRunner(const std::string& absDotName, const std::string& md5Hash) + : m_file(absDotName.data()) + , m_md5Hash(md5Hash.data()) + , m_dotExe(Config_getString(DOT_PATH)+"dot") + , m_cleanUp(Config_getBool(DOT_CLEANUP)) + , m_jobs() { - m_jobs.setAutoDelete(TRUE); } -void DotRunner::addJob(const char *format,const char *output) + +void DotRunner::addJob(const char *format, const char *output) { - QListIterator<DotJob> li(m_jobs); - DotJob *s; - for (li.toFirst(); (s = li.current()); ++li) + + for (auto& s: m_jobs) { - if (qstrcmp(s->format.data(), format) != 0) continue; - if (qstrcmp(s->output.data(), output) != 0) continue; + if (s.format != format) continue; + if (s.output != output) continue; // we have this job already return; } - QCString args = QCString("-T")+format+" -o \""+output+"\""; - m_jobs.append(new DotJob(format, output, args)); + auto args = std::string ("-T") + format + " -o \"" + output + "\""; + m_jobs.emplace_back(format, output, args); } -QCString getBaseNameOfOutput(QCString const& output) +QCString getBaseNameOfOutput(const QCString &output) { int index = output.findRev('.'); if (index < 0) return output; @@ -179,48 +182,46 @@ bool DotRunner::run() int exitCode=0; QCString dotArgs; - QListIterator<DotJob> li(m_jobs); - DotJob *s; // create output if (Config_getBool(DOT_MULTI_TARGETS)) { dotArgs=QCString("\"")+m_file.data()+"\""; - for (li.toFirst();(s=li.current());++li) + for (auto& s: m_jobs) { dotArgs+=' '; - dotArgs+=s->args.data(); + dotArgs+=s.args.data(); } if ((exitCode=Portable::system(m_dotExe.data(),dotArgs,FALSE))!=0) goto error; } else { - for (li.toFirst();(s=li.current());++li) + for (auto& s : m_jobs) { - dotArgs=QCString("\"")+m_file.data()+"\" "+s->args.data(); + dotArgs=QCString("\"")+m_file.data()+"\" "+s.args.data(); if ((exitCode=Portable::system(m_dotExe.data(),dotArgs,FALSE))!=0) goto error; } } // check output // As there should be only one pdf file be generated, we don't need code for regenerating multiple pdf files in one call - for (li.toFirst();(s=li.current());++li) + for (auto& s : m_jobs) { - if (qstrncmp(s->format.data(), "pdf", 3) == 0) + if (s.format.compare(0, 3, "pdf") == 0) { int width=0,height=0; - if (!readBoundingBox(s->output.data(),&width,&height,FALSE)) goto error; + if (!readBoundingBox(s.output.data(),&width,&height,FALSE)) goto error; if ((width > MAX_LATEX_GRAPH_SIZE) || (height > MAX_LATEX_GRAPH_SIZE)) { - if (!resetPDFSize(width,height,getBaseNameOfOutput(s->output.data()))) goto error; - dotArgs=QCString("\"")+m_file.data()+"\" "+s->args.data(); + if (!resetPDFSize(width,height,getBaseNameOfOutput(s.output.data()))) goto error; + dotArgs=QCString("\"")+m_file.data()+"\" "+s.args.data(); if ((exitCode=Portable::system(m_dotExe.data(),dotArgs,FALSE))!=0) goto error; } } - if (qstrncmp(s->format.data(), "png", 3) == 0) + if (s.format.compare(0, 3, "png") == 0) { - checkPngResult(s->output.data()); + checkPngResult(s.output.data()); } } @@ -232,7 +233,7 @@ bool DotRunner::run() } // create checksum file - if (!m_md5Hash.isEmpty()) + if (!m_md5Hash.empty()) { QCString md5Name = getBaseNameOfOutput(m_file.data()) + ".md5"; FILE *f = Portable::fopen(md5Name,"w"); @@ -254,27 +255,27 @@ error: void DotRunnerQueue::enqueue(DotRunner *runner) { - QMutexLocker locker(&m_mutex); - m_queue.enqueue(runner); - m_bufferNotEmpty.wakeAll(); + std::lock_guard<std::mutex> locker(m_mutex); + m_queue.push(runner); + m_bufferNotEmpty.notify_all(); } DotRunner *DotRunnerQueue::dequeue() { - QMutexLocker locker(&m_mutex); - while (m_queue.isEmpty()) - { - // wait until something is added to the queue - m_bufferNotEmpty.wait(&m_mutex); - } - DotRunner *result = m_queue.dequeue(); + std::unique_lock<std::mutex> locker(m_mutex); + + // wait until something is added to the queue + m_bufferNotEmpty.wait(locker, [this]() { return !m_queue.empty(); }); + + DotRunner *result = m_queue.front(); + m_queue.pop(); return result; } uint DotRunnerQueue::count() const { - QMutexLocker locker(&m_mutex); - return m_queue.count(); + std::lock_guard<std::mutex> locker(m_mutex); + return m_queue.size(); } //-------------------------------------------------------------------- @@ -292,3 +293,9 @@ void DotWorkerThread::run() runner->run(); } } + +void DotWorkerThread::start() +{ + assert(!m_thread); + m_thread = std::make_unique<std::thread>(&DotWorkerThread::run, this); +} diff --git a/src/dotrunner.h b/src/dotrunner.h index 1b68c18..555ea78 100644 --- a/src/dotrunner.h +++ b/src/dotrunner.h @@ -16,70 +16,30 @@ #ifndef DOTRUNNER_H #define DOTRUNNER_H -#include "qcstring.h" -#include "qlist.h" -#include "qwaitcondition.h" -#include "qthread.h" -#include "qqueue.h" -#include "qmutex.h" - -/** Minimal constant string class that is thread safe, once initialized. */ -class DotConstString -{ - public: - DotConstString() { m_str=0;} - ~DotConstString() { delete[] m_str;} - DotConstString(char const* s) : m_str(0) { set(s); } - DotConstString(const QCString &s) : m_str(0) { set(s); } - DotConstString(const DotConstString &s) : m_str(0) { set(s.data()); } - const char *data() const { return m_str; } - bool isEmpty() const { return m_str==0 || m_str[0]=='\0'; } - - private: - void set(char const* s) - { - delete[] m_str; - m_str=0; - if (s) - { - m_str=new char[strlen(s) + 1]; - qstrcpy(m_str,s); - } - } - - void set(const QCString &s) - { - delete[] m_str; - m_str=0; - if (!s.isEmpty()) - { - m_str=new char[s.length()+1]; - qstrcpy(m_str,s.data()); - } - } - - DotConstString &operator=(const DotConstString &); - - char *m_str; -}; +#include <qglobal.h> //uint +#include <string> +#include <thread> +#include <list> +#include <queue> +#include <mutex> +#include <condition_variable> +#include <memory> /** Helper class to run dot from doxygen from multiple threads. */ class DotRunner { - public: struct DotJob { - DotJob(const DotConstString & format, - const DotConstString & output, - const DotConstString & args) - : format(format), output(output), args(args) {} - DotConstString format; - DotConstString output; - DotConstString args; + DotJob(std::string f, std::string o, std::string a) + : format(f), output(o), args(a) {} + std::string format; + std::string output; + std::string args; }; + public: /** Creates a runner for a dot \a file. */ - DotRunner(const QCString& absDotName, const QCString& md5Hash); + DotRunner(const std::string& absDotName, const std::string& md5Hash = std::string()); /** Adds an additional job to the run. * Performing multiple jobs one file can be faster. @@ -87,22 +47,22 @@ class DotRunner void addJob(const char *format,const char *output); /** Prevent cleanup of the dot file (for user provided dot files) */ - void preventCleanUp() { m_cleanUp = FALSE; } + void preventCleanUp() { m_cleanUp = false; } /** Runs dot for all jobs added. */ bool run(); // DotConstString const& getFileName() { return m_file; } - DotConstString const& getMd5Hash() { return m_md5Hash; } + std::string const & getMd5Hash() { return m_md5Hash; } static bool readBoundingBox(const char* fileName, int* width, int* height, bool isEps); private: - DotConstString m_file; - DotConstString m_md5Hash; - DotConstString m_dotExe; - bool m_cleanUp; - QList<DotJob> m_jobs; + std::string m_file; + std::string m_md5Hash; + std::string m_dotExe; + bool m_cleanUp; + std::vector<DotJob> m_jobs; }; /** Queue of dot jobs to run. */ @@ -114,18 +74,22 @@ class DotRunnerQueue DotRunner *dequeue(); uint count() const; private: - QWaitCondition m_bufferNotEmpty; - QQueue<DotRunner> m_queue; - mutable QMutex m_mutex; + std::condition_variable m_bufferNotEmpty; + std::queue<DotRunner *> m_queue; + mutable std::mutex m_mutex; }; /** Worker thread to execute a dot run */ -class DotWorkerThread : public QThread +class DotWorkerThread { public: DotWorkerThread(DotRunnerQueue *queue); void run(); + void start(); + bool isRunning() { return m_thread && m_thread->joinable(); } + void wait() { m_thread->join(); } private: + std::unique_ptr<std::thread> m_thread; DotRunnerQueue *m_queue; }; diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 6a0f228..f79509f 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -81,9 +81,7 @@ #include "fortranscanner.h" #include "xmlcode.h" #include "sqlcode.h" -#include "tclscanner.h" #include "code.h" -#include "objcache.h" #include "portable.h" #include "vhdljjparser.h" #include "vhdldocgen.h" @@ -210,7 +208,7 @@ class Statistics Statistics() { stats.setAutoDelete(TRUE); } void begin(const char *name) { - msg(name); + msg("%s", name); stat *entry= new stat(name,0); stats.append(entry); time.restart(); @@ -558,7 +556,7 @@ static void buildFileList(const Entry *root) { text+="is not an input file"; } - warn(fn,root->startLine,text); + warn(fn,root->startLine,"%s", text.data()); } } for (const auto &e : root->children()) buildFileList(e.get()); @@ -612,7 +610,7 @@ static void addIncludeFile(ClassDef *cd,FileDef *ifd,const Entry *root) { text+="is not an input file"; } - warn(root->fileName,root->startLine,text); + warn(root->fileName,root->startLine, "%s", text.data()); } else if (includeFile.isEmpty() && ifd && // see if the file extension makes sense @@ -998,7 +996,7 @@ static void addClassToContext(const Entry *root) if (root->bodyLine!=-1 && cd->getStartBodyLine()==-1) { - cd->setBodySegment(root->bodyLine,root->endBodyLine); + cd->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine); cd->setBodyDef(fd); } //cd->setName(fullName); // change name to match docs @@ -1075,7 +1073,7 @@ static void addClassToContext(const Entry *root) cd->setIsStatic(root->stat); // file definition containing the class cd - cd->setBodySegment(root->bodyLine,root->endBodyLine); + cd->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine); cd->setBodyDef(fd); cd->setMetaData(root->metaData); @@ -1281,7 +1279,7 @@ static ClassDef *createTagLessInstance(ClassDef *rootCd,ClassDef *templ,const QC cd->setDocumentation(templ->documentation(),templ->docFile(),templ->docLine()); // copy docs to definition cd->setBriefDescription(templ->briefDescription(),templ->briefFile(),templ->briefLine()); cd->setLanguage(templ->getLanguage()); - cd->setBodySegment(templ->getStartBodyLine(),templ->getEndBodyLine()); + cd->setBodySegment(templ->getDefLine(),templ->getStartBodyLine(),templ->getEndBodyLine()); cd->setBodyDef(templ->getBodyDef()); cd->setOuterScope(rootCd->getOuterScope()); @@ -1511,7 +1509,7 @@ static void buildNamespaceList(const Entry *root) tagFileName = tagInfo->fileName; } //printf("++ new namespace %s lang=%s tagName=%s\n",fullName.data(),langToString(root->lang).data(),tagName.data()); - NamespaceDef *nd=createNamespaceDef(tagInfo?tagName:root->fileName,root->startLine, + nd=createNamespaceDef(tagInfo?tagName:root->fileName,root->startLine, root->startColumn,fullName,tagName,tagFileName, root->type,root->spec&Entry::Published); nd->setDocumentation(root->doc,root->docFile,root->docLine); // copy docs to definition @@ -1536,7 +1534,7 @@ static void buildNamespaceList(const Entry *root) // the empty string test is needed for extract all case nd->setBriefDescription(root->brief,root->briefFile,root->briefLine); nd->insertUsedFile(fd); - nd->setBodySegment(root->bodyLine,root->endBodyLine); + nd->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine); nd->setBodyDef(fd); // add class to the list Doxygen::namespaceSDict->inSort(fullName,nd); @@ -1547,7 +1545,7 @@ static void buildNamespaceList(const Entry *root) if (d==0) // we didn't find anything, create the scope artificially // anyway, so we can at least relate scopes properly. { - Definition *d = buildScopeFromQualifiedName(fullName,fullName.contains("::"),nd->getLanguage(),tagInfo); + d = buildScopeFromQualifiedName(fullName,fullName.contains("::"),nd->getLanguage(),tagInfo); d->addInnerCompound(nd); nd->setOuterScope(d); // TODO: Due to the order in which the tag file is written @@ -1703,7 +1701,7 @@ static void findUsingDirectives(const Entry *root) else // unknown namespace, but add it anyway. { //printf("++ new unknown namespace %s lang=%s\n",name.data(),langToString(root->lang).data()); - NamespaceDef *nd=createNamespaceDef(root->fileName,root->startLine,root->startColumn,name); + nd=createNamespaceDef(root->fileName,root->startLine,root->startColumn,name); nd->setDocumentation(root->doc,root->docFile,root->docLine); // copy docs to definition nd->setBriefDescription(root->brief,root->briefFile,root->briefLine); nd->addSectionsToDefinition(root->anchors); @@ -1928,7 +1926,7 @@ static void findUsingDeclImports(const Entry *root) newMd->enableReferencesRelation(root->referencesRelation); newMd->setBitfields(md->bitfieldString()); newMd->addSectionsToDefinition(root->anchors); - newMd->setBodySegment(md->getStartBodyLine(),md->getEndBodyLine()); + newMd->setBodySegment(md->getDefLine(),md->getStartBodyLine(),md->getEndBodyLine()); newMd->setBodyDef(md->getBodyDef()); newMd->setInitializer(md->initializer()); newMd->setMaxInitLines(md->initializerLines()); @@ -2113,7 +2111,7 @@ static MemberDef *addVariableToClass( md->setFromAnonymousScope(fromAnnScope); md->setFromAnonymousMember(fromAnnMemb); //md->setIndentDepth(indentDepth); - md->setBodySegment(root->bodyLine,root->endBodyLine); + md->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine); md->setInitializer(root->initializer); md->setMaxInitLines(root->initLines); md->setMemberGroupId(root->mGrpId); @@ -2382,7 +2380,7 @@ static MemberDef *addVariableToFile( //md->setOuterScope(fd); if (!root->explicitExternal) { - md->setBodySegment(root->bodyLine,root->endBodyLine); + md->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine); md->setBodyDef(fd); } addMemberToGroups(root,md); @@ -2899,7 +2897,7 @@ static void addInterfaceOrServiceToServiceOrSingleton( md->setDocsForDefinition(false); md->setBriefDescription(root->brief,root->briefFile,root->briefLine); md->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine); - md->setBodySegment(root->bodyLine,root->endBodyLine); + md->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine); md->setMemberSpecifiers(root->spec); md->setMemberGroupId(root->mGrpId); md->setTypeConstraints(root->typeConstr); @@ -3088,7 +3086,7 @@ static void addMethodToClass(const Entry *root,ClassDef *cd, md->setDocsForDefinition(!root->proto); md->setBriefDescription(root->brief,root->briefFile,root->briefLine); md->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine); - md->setBodySegment(root->bodyLine,root->endBodyLine); + md->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine); md->setMemberSpecifiers(spec); md->setMemberGroupId(root->mGrpId); md->setTypeConstraints(root->typeConstr); @@ -3394,7 +3392,7 @@ static void buildFunctionList(const Entry *root) md->setDocsForDefinition(!root->proto); if (md->getStartBodyLine()==-1 && root->bodyLine!=-1) { - md->setBodySegment(root->bodyLine,root->endBodyLine); + md->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine); md->setBodyDef(rfd); } @@ -3470,7 +3468,7 @@ static void buildFunctionList(const Entry *root) md->setDocsForDefinition(!root->proto); md->setTypeConstraints(root->typeConstr); //md->setBody(root->body); - md->setBodySegment(root->bodyLine,root->endBodyLine); + md->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine); FileDef *fd=root->fileDef(); md->setBodyDef(fd); md->addSectionsToDefinition(root->anchors); @@ -3547,7 +3545,6 @@ static void buildFunctionList(const Entry *root) // add member to the list of file members //printf("Adding member=%s\n",md->name().data()); - MemberName *mn; if ((mn=Doxygen::functionNameSDict->find(name))) { mn->append(md); @@ -3661,13 +3658,13 @@ static void findFriends() //printf("body mmd %d fmd %d\n",mmd->getStartBodyLine(),fmd->getStartBodyLine()); if (mmd->getStartBodyLine()==-1 && fmd->getStartBodyLine()!=-1) { - mmd->setBodySegment(fmd->getStartBodyLine(),fmd->getEndBodyLine()); + mmd->setBodySegment(fmd->getDefLine(),fmd->getStartBodyLine(),fmd->getEndBodyLine()); mmd->setBodyDef(fmd->getBodyDef()); //mmd->setBodyMember(fmd); } else if (mmd->getStartBodyLine()!=-1 && fmd->getStartBodyLine()==-1) { - fmd->setBodySegment(mmd->getStartBodyLine(),mmd->getEndBodyLine()); + fmd->setBodySegment(mmd->getDefLine(),mmd->getStartBodyLine(),mmd->getEndBodyLine()); fmd->setBodyDef(mmd->getBodyDef()); //fmd->setBodyMember(mmd); } @@ -4010,7 +4007,6 @@ static void findUsedClassesForClass(const Entry *root, BaseInfo bi(usedName,Public,Normal); findClassRelation(root,context,instanceCd,&bi,templateNames,TemplateInstances,isArtificial); - int count=0; for (const Argument &arg : masterCd->templateArguments()) { if (arg.name==usedName) // type is a template argument @@ -4598,7 +4594,7 @@ static bool findClassRelation( Doxygen::classSDict->append(baseClassName,baseClass); if (isArtificial) baseClass->setArtificial(TRUE); baseClass->setLanguage(root->lang); - int si = baseClassName.findRev("::"); + si = baseClassName.findRev("::"); if (si!=-1) // class is nested { Definition *sd = findScopeFromQualifiedName(Doxygen::globalScope,baseClassName.left(si),0,root->tagInfo()); @@ -5096,7 +5092,7 @@ static void addMemberDocs(const Entry *root, ) { //printf("Setting new body segment [%d,%d]\n",root->bodyLine,root->endBodyLine); - md->setBodySegment(root->bodyLine,root->endBodyLine); + md->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine); md->setBodyDef(rfd); } @@ -5288,7 +5284,7 @@ static bool findGlobalMember(const Entry *root, " of file "+md->getDefFileName()+"\n"; } } - warn(root->fileName,root->startLine,warnMsg); + warn(root->fileName,root->startLine, "%s", warnMsg.data()); } } else // got docs for an undefined member! @@ -5683,7 +5679,7 @@ static void findMember(const Entry *root, { if (funcSpec.isEmpty()) { - int argListIndex=0; + uint argListIndex=0; tempScopeName=cd->qualifiedNameWithTemplateParameters(&root->tArgLists,&argListIndex); } else @@ -5804,7 +5800,7 @@ static void findMember(const Entry *root, bool memFound=FALSE; for (mni.toFirst();!memFound && (md=mni.current());++mni) { - ClassDef *cd=md->getClassDef(); + cd=md->getClassDef(); Debug::print(Debug::FindMembers,0, "3. member definition found, " "scope needed='%s' scope='%s' args='%s' fileName=%s\n", @@ -6056,7 +6052,7 @@ static void findMember(const Entry *root, warnMsg+="Possible candidates:\n"; for (mni.toFirst();(md=mni.current());++mni) { - const ClassDef *cd=md->getClassDef(); + cd=md->getClassDef(); if (cd!=0 && rightScopeMatch(cd->name(),className)) { const ArgumentList &templAl = md->templateArguments(); @@ -6134,7 +6130,7 @@ static void findMember(const Entry *root, md->setDocsForDefinition(!root->proto); md->setPrototype(root->proto,root->fileName,root->startLine,root->startColumn); md->addSectionsToDefinition(root->anchors); - md->setBodySegment(root->bodyLine,root->endBodyLine); + md->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine); FileDef *fd=root->fileDef(); md->setBodyDef(fd); md->setMemberSpecifiers(spec); @@ -6157,15 +6153,15 @@ static void findMember(const Entry *root, MemberNameIterator mni(*mn); MemberDef *md=mni.toFirst(); ASSERT(md); - ClassDef *cd=md->getClassDef(); + cd=md->getClassDef(); ASSERT(cd); - QCString className=cd->name().copy(); + className=cd->name(); ++mni; bool unique=TRUE; for (;(md=mni.current());++mni) { - const ClassDef *cd=md->getClassDef(); - if (className!=cd->name()) unique=FALSE; + const ClassDef *lcd=md->getClassDef(); + if (className!=lcd->name()) unique=FALSE; } if (unique) { @@ -6179,7 +6175,7 @@ static void findMember(const Entry *root, ArgumentList tArgList = getTemplateArgumentsFromName(cd->name()+"::"+funcName,root->tArgLists); //printf("new related member %s args='%s'\n",md->name().data(),funcArgs.data()); - MemberDef *md=createMemberDef( + md=createMemberDef( root->fileName,root->startLine,root->startColumn, funcType,funcName,funcArgs,exceptions, root->protection,root->virt,root->stat,Related, @@ -6203,7 +6199,7 @@ static void findMember(const Entry *root, md->setDocsForDefinition(!root->proto); md->setPrototype(root->proto,root->fileName,root->startLine,root->startColumn); md->addSectionsToDefinition(root->anchors); - md->setBodySegment(root->bodyLine,root->endBodyLine); + md->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine); FileDef *fd=root->fileDef(); md->setBodyDef(fd); md->setMemberSpecifiers(spec); @@ -6232,7 +6228,6 @@ static void findMember(const Entry *root, Debug::print(Debug::FindMembers,0,"2. related function\n" " scopeName=%s className=%s\n",qPrint(scopeName),qPrint(className)); if (className.isEmpty()) className=relates; - ClassDef *cd; //printf("scopeName='%s' className='%s'\n",scopeName.data(),className.data()); if ((cd=getClass(scopeName))) { @@ -6241,7 +6236,7 @@ static void findMember(const Entry *root, MemberDef *mdDefine=0; bool isDefine=FALSE; { - MemberName *mn = Doxygen::functionNameSDict->find(funcName); + mn = Doxygen::functionNameSDict->find(funcName); if (mn) { MemberNameIterator mni(*mn); @@ -6377,7 +6372,7 @@ static void findMember(const Entry *root, } if (rmd) // member found -> copy line number info { - md->setBodySegment(rmd->getStartBodyLine(),rmd->getEndBodyLine()); + md->setBodySegment(rmd->getDefLine(),rmd->getStartBodyLine(),rmd->getEndBodyLine()); md->setBodyDef(rmd->getBodyDef()); //md->setBodyMember(rmd); } @@ -6386,7 +6381,7 @@ static void findMember(const Entry *root, if (!found) // line number could not be found or is available in this // entry { - md->setBodySegment(root->bodyLine,root->endBodyLine); + md->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine); md->setBodyDef(fd); } @@ -6453,7 +6448,6 @@ static void findMember(const Entry *root, else if (root->parent() && root->parent()->section==Entry::OBJCIMPL_SEC) { localObjCMethod: - ClassDef *cd; //printf("scopeName='%s' className='%s'\n",scopeName.data(),className.data()); if (Config_getBool(EXTRACT_LOCAL_METHODS) && (cd=getClass(scopeName))) { @@ -6481,7 +6475,7 @@ localObjCMethod: md->setDocsForDefinition(!root->proto); md->setPrototype(root->proto,root->fileName,root->startLine,root->startColumn); md->addSectionsToDefinition(root->anchors); - md->setBodySegment(root->bodyLine,root->endBodyLine); + md->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine); FileDef *fd=root->fileDef(); md->setBodyDef(fd); md->setMemberSpecifiers(spec); @@ -6824,7 +6818,7 @@ static void findEnums(const Entry *root) md->setLanguage(root->lang); md->setId(root->id); if (!isGlobal) md->setMemberClass(cd); else md->setFileDef(fd); - md->setBodySegment(root->bodyLine,root->endBodyLine); + md->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine); md->setBodyDef(root->fileDef()); md->setMemberSpecifiers(root->spec); md->setEnumBaseType(root->args); @@ -7054,7 +7048,7 @@ static void addEnumValuesToEnums(const Entry *root) fmd->setAnchor(); md->insertEnumField(fmd); fmd->setEnumScope(md,TRUE); - MemberName *mn=mnsd->find(e->name); + mn=mnsd->find(e->name); if (mn) { mn->append(fmd); @@ -7187,7 +7181,7 @@ static void findEnumDocumentation(const Entry *root) MemberDef *md; for (mni.toFirst();(md=mni.current()) && !found;++mni) { - const ClassDef *cd=md->getClassDef(); + cd=md->getClassDef(); if (cd && cd->name()==className && md->isEnumerate()) { // documentation outside a compound overrides the documentation inside it @@ -7727,9 +7721,9 @@ static void addSourceReferences() for (cli.toFirst();(cd=cli.current());++cli) { FileDef *fd=cd->getBodyDef(); - if (fd && cd->isLinkableInProject() && cd->getStartBodyLine()!=-1) + if (fd && cd->isLinkableInProject() && cd->getStartDefLine()!=-1) { - fd->addSourceRef(cd->getStartBodyLine(),cd,0); + fd->addSourceRef(cd->getStartDefLine(),cd,0); } } // add source references for namespace definitions @@ -7738,9 +7732,9 @@ static void addSourceReferences() for (nli.toFirst();(nd=nli.current());++nli) { FileDef *fd=nd->getBodyDef(); - if (fd && nd->isLinkableInProject() && nd->getStartBodyLine()!=-1) + if (fd && nd->isLinkableInProject() && nd->getStartDefLine()!=-1) { - fd->addSourceRef(nd->getStartBodyLine(),nd,0); + fd->addSourceRef(nd->getStartDefLine(),nd,0); } } @@ -7759,14 +7753,14 @@ static void addSourceReferences() // md->getStartBodyLine(),md->isLinkableInProject()); FileDef *fd=md->getBodyDef(); if (fd && - md->getStartBodyLine()!=-1 && + md->getStartDefLine()!=-1 && md->isLinkableInProject() && (fd->generateSourceFile() || Doxygen::parseSourcesNeeded) ) { //printf("Found member '%s' in file '%s' at line '%d' def=%s\n", // md->name().data(),fd->name().data(),md->getStartBodyLine(),md->getOuterScope()->name().data()); - fd->addSourceRef(md->getStartBodyLine(),md->getOuterScope(),md); + fd->addSourceRef(md->getStartDefLine(),md->getOuterScope(),md); } } } @@ -7784,14 +7778,14 @@ static void addSourceReferences() // md->isLinkableInProject(), // Doxygen::parseSourcesNeeded); if (fd && - md->getStartBodyLine()!=-1 && + md->getStartDefLine()!=-1 && md->isLinkableInProject() && (fd->generateSourceFile() || Doxygen::parseSourcesNeeded) ) { //printf("Found member '%s' in file '%s' at line '%d' def=%s\n", // md->name().data(),fd->name().data(),md->getStartBodyLine(),md->getOuterScope()->name().data()); - fd->addSourceRef(md->getStartBodyLine(),md->getOuterScope(),md); + fd->addSourceRef(md->getStartDefLine(),md->getOuterScope(),md); } } } @@ -8311,7 +8305,7 @@ static void findDefineDocumentation(Entry *root) { md->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine); } - md->setBodySegment(root->bodyLine,root->endBodyLine); + md->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine); md->setBodyDef(root->fileDef()); md->addSectionsToDefinition(root->anchors); md->setMaxInitLines(root->initLines); @@ -8355,7 +8349,7 @@ static void findDefineDocumentation(Entry *root) { md->setInbodyDocumentation(root->inbodyDocs,root->inbodyFile,root->inbodyLine); } - md->setBodySegment(root->bodyLine,root->endBodyLine); + md->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine); md->setBodyDef(root->fileDef()); md->addSectionsToDefinition(root->anchors); md->setRefItems(root->sli); @@ -8384,7 +8378,7 @@ static void findDefineDocumentation(Entry *root) else { warn(root->fileName,root->startLine, - "found documented #define but ignoring it because " + "found documented #define %s but ignoring it because " "ENABLE_PREPROCESSING is NO.\n", root->name.data() ); @@ -9016,9 +9010,9 @@ static void copyLatexStyleSheet() else { QCString destFileName = Config_getString(LATEX_OUTPUT)+"/"+fi.fileName().data(); - if (!checkExtension(fi.fileName().data(), latexStyleExtension)) + if (!checkExtension(fi.fileName().data(), LATEX_STYLE_EXTENSION)) { - destFileName += latexStyleExtension; + destFileName += LATEX_STYLE_EXTENSION; } copyFile(fileName, destFileName); } @@ -9815,8 +9809,6 @@ void initDoxygen() std::make_unique<XMLCodeParser>()); Doxygen::parserManager->registerParser("sql", std::make_unique<NullOutlineParser>(), std::make_unique<SQLCodeParser>()); - Doxygen::parserManager->registerParser("tcl", std::make_unique<TclOutlineParser>(), - std::make_unique<TclCodeParser>()); Doxygen::parserManager->registerParser("md", std::make_unique<MarkdownOutlineParser>(), std::make_unique<FileCodeParser>()); @@ -9954,15 +9946,7 @@ static int computeIdealCacheParam(uint v) void readConfiguration(int argc, char **argv) { - QCString versionString; - if (strlen(getGitVersion())>0) - { - versionString = QCString(getVersion())+" ("+getGitVersion()+")"; - } - else - { - versionString = getVersion(); - } + QCString versionString = getFullVersion(); /************************************************************************** * Handle arguments * @@ -10777,6 +10761,10 @@ void parseInput() { atexit(exitDoxygen); + // we would like to show the versionString earlier, but we first have to handle the configuration file + // to know the value of the QUIET setting. + QCString versionString = getFullVersion(); + msg("Doxygen version used: %s\n",versionString.data()); /************************************************************************** * Make sure the output directory exists @@ -11655,4 +11643,3 @@ void generateOutput() // delete Doxygen::symbolStorage; g_successfulRun=TRUE; } - diff --git a/src/doxygen.h b/src/doxygen.h index 635ac1d..f549261 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -34,7 +34,6 @@ class PageSDict; class PageDef; class SearchIndexIntf; class ParserManager; -class ObjCache; class Store; class QFileInfo; class BufStr; diff --git a/src/doxygen.md b/src/doxygen.md index c124e09..d8db231 100644 --- a/src/doxygen.md +++ b/src/doxygen.md @@ -223,7 +223,6 @@ Topics TODO - Python - Fortran - VHDL - - TCL - Tag files - Marshaling to/from disk - Portability functions diff --git a/src/entry.cpp b/src/entry.cpp index 706488b..305487e 100644 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -95,6 +95,7 @@ Entry::Entry(const Entry &e) exception = e.exception; typeConstr = e.typeConstr; bodyLine = e.bodyLine; + bodyColumn = e.bodyColumn; endBodyLine = e.endBodyLine; mGrpId = e.mGrpId; anchors = e.anchors; @@ -213,6 +214,7 @@ void Entry::reset() startLine = 1; startColumn = 1; bodyLine = -1; + bodyColumn = 1; endBodyLine = -1; mGrpId = -1; callGraph = entryCallGraph; diff --git a/src/entry.h b/src/entry.h index abd0a89..71c555c 100644 --- a/src/entry.h +++ b/src/entry.h @@ -203,7 +203,7 @@ class Entry const std::vector< std::shared_ptr<Entry> > &children() const { return m_sublist; } /*! @name add entry as a child and pass ownership. - * @note This makes the entry passed invalid! (TODO: tclscanner.l still has use after move!) + * @note This makes the entry passed invalid! * @{ */ void moveToSubEntryAndKeep(Entry* e); @@ -278,7 +278,8 @@ class Entry QCString inside; //!< name of the class in which documents are found QCString exception; //!< throw specification ArgumentList typeConstr; //!< where clause (C#) for type constraints - int bodyLine; //!< line number of the definition in the source + int bodyLine; //!< line number of the body in the source + int bodyColumn; //!< column of the body in the source int endBodyLine; //!< line number where the definition ends int mGrpId; //!< member group id std::vector<BaseInfo> extends; //!< list of base classes diff --git a/src/example.h b/src/example.h index 321982b..2af06ba 100644 --- a/src/example.h +++ b/src/example.h @@ -36,7 +36,7 @@ struct Example class ExampleSDict : public SDict<Example> { public: - ExampleSDict(int size=17) : SDict<Example>(size) { setAutoDelete(TRUE); } + ExampleSDict(uint size=17) : SDict<Example>(size) { setAutoDelete(TRUE); } ~ExampleSDict() {} private: int compareValues(const Example *item1,const Example *item2) const diff --git a/src/filedef.h b/src/filedef.h index b66d7be..2ca33db 100644 --- a/src/filedef.h +++ b/src/filedef.h @@ -217,7 +217,7 @@ class OutputNameList : public QList<FileList> class OutputNameDict : public QDict<FileList> { public: - OutputNameDict(int size) : QDict<FileList>(size) {} + OutputNameDict(uint size) : QDict<FileList>(size) {} ~OutputNameDict() {} }; diff --git a/src/formula.cpp b/src/formula.cpp index 3130122..ac25cfb 100644 --- a/src/formula.cpp +++ b/src/formula.cpp @@ -73,7 +73,7 @@ void FormulaManager::readFormulas(const char *dir,bool doCompare) QFile f(QCString(dir)+"/formula.repository"); if (f.open(IO_ReadOnly)) // open repository { - int formulaCount=0; + uint formulaCount=0; msg("Reading formula repository...\n"); QTextStream t(&f); QCString line; @@ -274,8 +274,8 @@ void FormulaManager::generateImages(const char *path,Format format,HighDPI hd) c if (zoomFactor<8 || zoomFactor>50) zoomFactor=10; scaleFactor *= zoomFactor/10.0; - int width = (int)((x2-x1)*scaleFactor+0.5f); - int height = (int)((y2-y1)*scaleFactor+0.5f); + int width = (int)((x2-x1)*scaleFactor+0.5); + int height = (int)((y2-y1)*scaleFactor+0.5); p->storeDisplaySize(pageNum,width,height); if (format==Format::Vector) diff --git a/src/fortrancode.l b/src/fortrancode.l index bf6c22e..81bf9f6 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -26,6 +26,7 @@ %option never-interactive %option case-insensitive %option prefix="fortrancodeYY" +%option noyy_top_state %top{ #include <stdint.h> } @@ -68,6 +69,8 @@ const int fixedCommentAfter = 72; #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 +#define USE_STATE2STRING 0 + /* * For fixed formatted code position 6 is of importance (continuation character). * The following variables and macros keep track of the column number @@ -130,7 +133,7 @@ static UseEntry *useEntry = 0; //!< current use statement info static QList<Scope> scopeStack; static bool g_isExternal = false; // static QCStringList *currentUseNames= new QCStringList; //! contains names of used modules of current program unit -static QCString str=""; //!> contents of fortran string +static QCString g_str=""; //!> contents of fortran string static CodeOutputInterface * g_code; @@ -171,7 +174,9 @@ static int inTypeDecl = 0; static bool g_endComment; +#if USE_STATE2STRING static const char *stateToString(int state); +#endif static void endFontClass() { @@ -456,58 +461,58 @@ static bool getFortranDefs(const QCString &memberName, const QCString &moduleNam if (mn) // name is known { - MemberNameIterator mli(*mn); - for (mli.toFirst();(md=mli.current());++mli) // all found functions with given name - { - const FileDef *fd=md->getFileDef(); - const GroupDef *gd=md->getGroupDef(); - const ClassDef *cd=md->getClassDef(); - - //cout << "found link with same name: " << fd->fileName() << " " << memberName; - //if (md->getNamespaceDef() != 0) cout << " in namespace " << md->getNamespaceDef()->name();cout << endl; + MemberNameIterator mli(*mn); + for (mli.toFirst();(md=mli.current());++mli) // all found functions with given name + { + const FileDef *fd=md->getFileDef(); + const GroupDef *gd=md->getGroupDef(); + const ClassDef *cd=md->getClassDef(); - if ((gd && gd->isLinkable()) || (fd && fd->isLinkable())) - { - const NamespaceDef *nspace= md->getNamespaceDef(); + //cout << "found link with same name: " << fd->fileName() << " " << memberName; + //if (md->getNamespaceDef() != 0) cout << " in namespace " << md->getNamespaceDef()->name();cout << endl; - if (nspace == 0) - { // found function in global scope - if(cd == 0) { // Skip if bound to type - return TRUE; + if ((gd && gd->isLinkable()) || (fd && fd->isLinkable())) + { + const NamespaceDef *nspace= md->getNamespaceDef(); + + if (nspace == 0) + { // found function in global scope + if(cd == 0) { // Skip if bound to type + return TRUE; + } + } + else if (moduleName == nspace->name()) + { // found in local scope + return TRUE; + } + else + { // else search in used modules + QCString usedModuleName= nspace->name(); + UseEntry *ue= usedict->find(usedModuleName); + if (ue) + { + // check if only-list exists and if current entry exists is this list + QCStringList &only= ue->onlyNames; + if (only.isEmpty()) + { + //cout << " found in module " << usedModuleName << " entry " << memberName << endl; + return TRUE; // whole module used + } + else + { + for ( QCStringList::Iterator lit = only.begin(); lit != only.end(); ++lit) + { + //cout << " search in only: " << usedModuleName << ":: " << memberName << "==" << (*it)<< endl; + if (memberName == *lit) + { + return TRUE; // found in ONLY-part of use list + } } - } - else if (moduleName == nspace->name()) - { // found in local scope - return TRUE; - } - else - { // else search in used modules - QCString moduleName= nspace->name(); - UseEntry *ue= usedict->find(moduleName); - if (ue) - { - // check if only-list exists and if current entry exists is this list - QCStringList &only= ue->onlyNames; - if (only.isEmpty()) - { - //cout << " found in module " << moduleName << " entry " << memberName << endl; - return TRUE; // whole module used - } - else - { - for ( QCStringList::Iterator it = only.begin(); it != only.end(); ++it) - { - //cout << " search in only: " << moduleName << ":: " << memberName << "==" << (*it)<< endl; - if (memberName == *it) - { - return TRUE; // found in ONLY-part of use list - } - } - } - } - } - } // if linkable - } // for + } + } + } + } // if linkable + } // for } return FALSE; } @@ -669,15 +674,15 @@ static void addLocalVar(const QCString &varName) #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); -static int yyread(char *buf,int max_size) +static yy_size_t yyread(char *buf,yy_size_t max_size) { - int c=0; - while( c < max_size && g_inputString[g_inputPosition] ) - { - *buf = g_inputString[g_inputPosition++] ; - c++; buf++; - } - return c; + yy_size_t c=0; + while( c < max_size && g_inputString[g_inputPosition] ) + { + *buf = g_inputString[g_inputPosition++] ; + c++; buf++; + } + return c; } %} @@ -1220,22 +1225,22 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?") /*------ strings --------------------------------------------------*/ <String>\n { // string with \n inside g_contLineNr++; - str+=yytext; + g_str+=yytext; startFontClass("stringliteral"); - codifyLines(str); + codifyLines(g_str); endFontClass(); - str = ""; + g_str = ""; YY_FTN_RESET } <String>\"|\' { // string ends with next quote without previous backspace if(yytext[0]!=stringStartSymbol) YY_FTN_REJECT; // single vs double quote - str+=yytext; + g_str+=yytext; startFontClass("stringliteral"); - codifyLines(str); + codifyLines(g_str); endFontClass(); yy_pop_state(); } -<String>. {str+=yytext;} +<String>. {g_str+=yytext;} <*>\"|\' { /* string starts */ /* if(YY_START == StrIgnore) YY_FTN_REJECT; // ignore in simple comments */ @@ -1243,7 +1248,7 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?") yy_push_state(YY_START); stringStartSymbol=yytext[0]; // single or double quote BEGIN(String); - str=yytext; + g_str=yytext; } /*-----------------------------------------------------------------------------*/ @@ -1306,7 +1311,6 @@ const char* prepassFixedForm(const char* contents, int *hasContLine); /* prototy static void checkContLines(const char *s) { int numLines = 0; - int curLine = 0; int i = 0; const char *p = s; @@ -1430,4 +1434,6 @@ void FortranCodeParser::resetCodeParserState() //--------------------------------------------------------- +#if USE_STATE2STRING #include "fortrancode.l.h" +#endif diff --git a/src/fortranscanner.l b/src/fortranscanner.l index 0265fc3..852c4d9 100644 --- a/src/fortranscanner.l +++ b/src/fortranscanner.l @@ -144,7 +144,7 @@ struct CommentInPrepass { int column; QCString str; - CommentInPrepass(int column, QCString str) : column(column), str(str) {} + CommentInPrepass(int col, QCString s) : column(col), str(s) {} }; /* ----------------------------------------------------------------- @@ -213,7 +213,7 @@ static QCString extractFromParens(const QCString name); static QCString extractBind(const QCString name); -static int yyread(yyscan_t yyscanner,char *buf,int max_size); +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); static void startCommentBlock(yyscan_t yyscanner,bool); static void handleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief); static void subrHandleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief); @@ -1496,7 +1496,6 @@ void truncatePrepass(yyscan_t yyscanner,int index) } // simplified way to know if this is fixed form -// duplicate in fortrancode.l bool recognizeFixedForm(const char* contents, FortranFormat format) { int column=0; @@ -1532,7 +1531,7 @@ bool recognizeFixedForm(const char* contents, FortranFormat format) break; default: if (skipLine) break; - if (column==7) return TRUE; + if (column>=7) return TRUE; return FALSE; } } @@ -2316,10 +2315,10 @@ static bool endScope(yyscan_t yyscanner,Entry *scope, bool isGlobalRoot) return TRUE; } -static int yyread(yyscan_t yyscanner,char *buf,int max_size) +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - int c=0; + yy_size_t c=0; while ( c < max_size && yyextra->inputString[yyextra->inputPosition] ) { *buf = yyextra->inputString[yyextra->inputPosition++] ; @@ -2581,8 +2580,8 @@ static void subrHandleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool b else { // something different specified, give warning and leave error. - warn(yyextra->fileName,yyextra->lineNr, "Routine: " + yyextra->current->name + yyextra->current->args + - " inconsistency between intent attribute and documentation for parameter: " + yyextra->argName); + warn(yyextra->fileName,yyextra->lineNr, "%s", ("Routine: " + yyextra->current->name + yyextra->current->args + + " inconsistency between intent attribute and documentation for parameter: " + yyextra->argName).data()); handleCommentBlock(yyscanner,QCString("\n\n@param ") + directionParam[dir1] + " " + yyextra->argName + " " + loc_doc,brief); } @@ -2605,8 +2604,8 @@ static void subrHandleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool b } else { - warn(yyextra->fileName,yyextra->lineNr, "Routine: " + yyextra->current->name + yyextra->current->args + - " inconsistency between intent attribute and documentation for parameter: " + yyextra->argName); + warn(yyextra->fileName,yyextra->lineNr, "%s", ("Routine: " + yyextra->current->name + yyextra->current->args + + " inconsistency between intent attribute and documentation for parameter: " + yyextra->argName).data()); handleCommentBlock(yyscanner,QCString("\n\n@param ") + directionParam[dir1] + " " + yyextra->argName + " " + loc_doc,brief); } @@ -2627,8 +2626,8 @@ static void subrHandleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool b } else { - warn(yyextra->fileName,yyextra->lineNr, "Routine: " + yyextra->current->name + yyextra->current->args + - " inconsistency between intent attribute and documentation for parameter: " + yyextra->argName); + warn(yyextra->fileName,yyextra->lineNr, "%s", ("Routine: " + yyextra->current->name + yyextra->current->args + + " inconsistency between intent attribute and documentation for parameter: " + yyextra->argName).data()); handleCommentBlock(yyscanner,QCString("\n\n@param ") + directionParam[dir1] + " " + yyextra->argName + " " + loc_doc,brief); } diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp index 149f43c..d231dad 100644 --- a/src/ftvhelp.cpp +++ b/src/ftvhelp.cpp @@ -451,6 +451,10 @@ void FTVHelp::generateTree(FTextStream &t, const QList<FTVNode> &nl,int level,in char icon=compoundIcon(dynamic_cast<const ClassDef*>(n->def)); t << "<span class=\"icona\"><span class=\"icon\">" << icon << "</span></span>"; } + else if (n->def && n->def->definitionType()==Definition::TypeDir) + { + t << "<span class=\"iconfclosed\"></span>"; + } else { t << "<span class=\"icondoc\"></span>"; @@ -689,7 +693,7 @@ static void generateJSNavTree(const QList<FTVNode> &nodeList) tsidx << "{" << endl; QListIterator<NavIndexEntry> li(navIndex); NavIndexEntry *e; - bool first=TRUE; + first=TRUE; for (li.toFirst();(e=li.current());) // for each entry { if (elemCount==0) @@ -781,8 +785,7 @@ void FTVHelp::generateTreeViewInline(FTextStream &t) t << "<div class=\"levels\">["; t << theTranslator->trDetailLevel(); t << " "; - int i; - for (i=1;i<=depth;i++) + for (int i=1;i<=depth;i++) { t << "<span onclick=\"javascript:toggleLevel(" << i << ");\">" << i << "</span>"; } @@ -794,9 +797,7 @@ void FTVHelp::generateTreeViewInline(FTextStream &t) for (int i=1;i<=depth;i++) { int num=0; - QListIterator<FTVNode> li(m_indentNodes[0]); - FTVNode *n; - for (;(n=li.current());++li) + for (li.toFirst();(n=li.current());++li) { num+=n->numNodesAtLevel(0,i); } diff --git a/src/ftvhelp.h b/src/ftvhelp.h index 9bcaa5b..5f39b6a 100644 --- a/src/ftvhelp.h +++ b/src/ftvhelp.h @@ -3,8 +3,8 @@ * Copyright (C) 1997-2015 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 + * 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. * @@ -72,22 +72,32 @@ class FTVHelp : public IndexIntf bool m_topLevelIndex; }; -#define JAVASCRIPT_LICENSE_TEXT \ - "/*\n@licstart The following is the entire license notice for the\n" \ - "JavaScript code in this file.\n\nCopyright (C) 1997-2019 by Dimitri van Heesch\n\n" \ - "This program is free software; you can redistribute it and/or modify\n" \ - "it under the terms of version 2 of the GNU General Public License as published by\n" \ - "the Free Software Foundation\n\n" \ - "This program is distributed in the hope that it will be useful,\n" \ - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" \ - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" \ - "GNU General Public License for more details.\n\n" \ - "You should have received a copy of the GNU General Public License along\n" \ - "with this program; if not, write to the Free Software Foundation, Inc.,\n" \ - "51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n\n" \ - "@licend The above is the entire license notice\n" \ - "for the JavaScript code in this file\n" \ - "*/\n" +static const char *JAVASCRIPT_LICENSE_TEXT = R"LIC(/* + @licstart The following is the entire license notice for the JavaScript code in this file. + + The MIT License (MIT) + + Copyright (C) 1997-2020 by Dimitri van Heesch + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file +*/ +)LIC"; + #endif /* FTVHELP_H */ diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 960252d..5af1525 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -54,10 +54,10 @@ class GroupDefImpl : public DefinitionImpl, public GroupDef virtual DefType definitionType() const { return TypeGroup; } virtual QCString getOutputFileBase() const; virtual QCString anchor() const { return QCString(); } - virtual QCString displayName(bool=TRUE) const { return hasGroupTitle() ? title : DefinitionImpl::name(); } - virtual const char *groupTitle() const { return title; } + virtual QCString displayName(bool=TRUE) const { return hasGroupTitle() ? m_title : DefinitionImpl::name(); } + virtual const char *groupTitle() const { return m_title; } virtual void setGroupTitle( const char *newtitle ); - virtual bool hasGroupTitle( ) const { return titleSet; } + virtual bool hasGroupTitle( ) const { return m_titleSet; } virtual void addFile(const FileDef *def); virtual bool addClass(const ClassDef *def); virtual bool addNamespace(const NamespaceDef *def); @@ -87,22 +87,22 @@ class GroupDefImpl : public DefinitionImpl, public GroupDef virtual void sortMemberLists(); virtual bool subGrouping() const { return m_subGrouping; } - virtual void setGroupScope(Definition *d) { groupScope = d; } - virtual Definition *getGroupScope() const { return groupScope; } + virtual void setGroupScope(Definition *d) { m_groupScope = d; } + virtual Definition *getGroupScope() const { return m_groupScope; } virtual MemberList *getMemberList(MemberListType lt) const; virtual const QList<MemberList> &getMemberLists() const { return m_memberLists; } /* user defined member groups */ - virtual MemberGroupSDict *getMemberGroupSDict() const { return memberGroupSDict; } - - virtual FileList * getFiles() const { return fileList; } - virtual ClassSDict * getClasses() const { return classSDict; } - virtual NamespaceSDict * getNamespaces() const { return namespaceSDict; } - virtual GroupList * getSubGroups() const { return groupList; } - virtual PageSDict * getPages() const { return pageDict; } - virtual DirList * getDirs() const { return dirList; } - virtual PageSDict * getExamples() const { return exampleDict; } + virtual MemberGroupSDict *getMemberGroupSDict() const { return m_memberGroupSDict; } + + virtual FileList * getFiles() const { return m_fileList; } + virtual ClassSDict * getClasses() const { return m_classSDict; } + virtual NamespaceSDict * getNamespaces() const { return m_namespaceSDict; } + virtual GroupList * getSubGroups() const { return m_groupList; } + virtual PageSDict * getPages() const { return m_pageDict; } + virtual DirList * getDirs() const { return m_dirList; } + virtual PageSDict * getExamples() const { return m_exampleDict; } virtual bool hasDetailedDescription() const; virtual void sortSubGroups(); @@ -132,25 +132,22 @@ class GroupDefImpl : public DefinitionImpl, public GroupDef void writeSummaryLinks(OutputList &ol) const; void updateLanguage(const Definition *); - QCString title; // title of the group - bool titleSet; // true if title is not the same as the name - QCString fileName; // base name of the generated file - FileList *fileList; // list of files in the group - ClassSDict *classSDict; // list of classes in the group - NamespaceSDict *namespaceSDict; // list of namespaces in the group - GroupList *groupList; // list of sub groups. - PageSDict *pageDict; // list of pages in the group - PageSDict *exampleDict; // list of examples in the group - DirList *dirList; // list of directories in the group - - MemberList *allMemberList; - MemberNameInfoSDict *allMemberNameInfoSDict; - - Definition *groupScope; - - QList<MemberList> m_memberLists; - MemberGroupSDict *memberGroupSDict; - bool m_subGrouping; + QCString m_title; // title of the group + bool m_titleSet; // true if title is not the same as the name + QCString m_fileName; // base name of the generated file + FileList * m_fileList; // list of files in the group + ClassSDict * m_classSDict; // list of classes in the group + NamespaceSDict * m_namespaceSDict; // list of namespaces in the group + GroupList * m_groupList; // list of sub groups. + PageSDict * m_pageDict; // list of pages in the group + PageSDict * m_exampleDict; // list of examples in the group + DirList * m_dirList; // list of directories in the group + MemberList * m_allMemberList; + MemberNameInfoSDict *m_allMemberNameInfoSDict; + Definition * m_groupScope; + QList<MemberList> m_memberLists; + MemberGroupSDict * m_memberGroupSDict; + bool m_subGrouping; }; @@ -166,67 +163,67 @@ GroupDef *createGroupDef(const char *fileName,int line,const char *name, GroupDefImpl::GroupDefImpl(const char *df,int dl,const char *na,const char *t, const char *refFileName) : DefinitionImpl(df,dl,1,na) { - fileList = new FileList; - classSDict = new ClassSDict(17); - groupList = new GroupList; - namespaceSDict = new NamespaceSDict(17); - pageDict = new PageSDict(17); - exampleDict = new PageSDict(17); - dirList = new DirList; - allMemberNameInfoSDict = new MemberNameInfoSDict(17); - allMemberNameInfoSDict->setAutoDelete(TRUE); + m_fileList = new FileList; + m_classSDict = new ClassSDict(17); + m_groupList = new GroupList; + m_namespaceSDict = new NamespaceSDict(17); + m_pageDict = new PageSDict(17); + m_exampleDict = new PageSDict(17); + m_dirList = new DirList; + m_allMemberNameInfoSDict = new MemberNameInfoSDict(17); + m_allMemberNameInfoSDict->setAutoDelete(TRUE); if (refFileName) { - fileName=stripExtension(refFileName); + m_fileName=stripExtension(refFileName); } else { - fileName = convertNameToFile(QCString("group_")+na); + m_fileName = convertNameToFile(QCString("group_")+na); } setGroupTitle( t ); - memberGroupSDict = new MemberGroupSDict; - memberGroupSDict->setAutoDelete(TRUE); + m_memberGroupSDict = new MemberGroupSDict; + m_memberGroupSDict->setAutoDelete(TRUE); - allMemberList = new MemberList(MemberListType_allMembersList); + m_allMemberList = new MemberList(MemberListType_allMembersList); //visited = 0; - groupScope = 0; + m_groupScope = 0; m_subGrouping=Config_getBool(SUBGROUPING); } GroupDefImpl::~GroupDefImpl() { - delete fileList; - delete classSDict; - delete groupList; - delete namespaceSDict; - delete pageDict; - delete exampleDict; - delete allMemberList; - delete allMemberNameInfoSDict; - delete memberGroupSDict; - delete dirList; + delete m_fileList; + delete m_classSDict; + delete m_groupList; + delete m_namespaceSDict; + delete m_pageDict; + delete m_exampleDict; + delete m_allMemberList; + delete m_allMemberNameInfoSDict; + delete m_memberGroupSDict; + delete m_dirList; } void GroupDefImpl::setGroupTitle( const char *t ) { - if ( t && qstrlen(t) ) + if ( t && *t ) { - title = t; - titleSet = TRUE; + m_title = t; + m_titleSet = TRUE; } else { - title = name(); - title.at(0)=toupper(title.at(0)); - titleSet = FALSE; + m_title = name(); + m_title[0]=(char)toupper(m_title[0]); + m_titleSet = FALSE; } } void GroupDefImpl::distributeMemberGroupDocumentation() { - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -237,7 +234,7 @@ void GroupDefImpl::distributeMemberGroupDocumentation() void GroupDefImpl::findSectionsInDocumentation() { docFindSections(documentation(),this,docFile()); - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -261,9 +258,9 @@ void GroupDefImpl::addFile(const FileDef *def) if (def->isHidden()) return; updateLanguage(def); if (sortBriefDocs) - fileList->inSort(def); + m_fileList->inSort(def); else - fileList->append(def); + m_fileList->append(def); } bool GroupDefImpl::addClass(const ClassDef *cd) @@ -272,12 +269,12 @@ bool GroupDefImpl::addClass(const ClassDef *cd) if (cd->isHidden()) return FALSE; updateLanguage(cd); QCString qn = cd->name(); - if (classSDict->find(qn)==0) + if (m_classSDict->find(qn)==0) { //printf("--- addClass %s sort=%d\n",qn.data(),sortBriefDocs); if (sortBriefDocs) { - classSDict->inSort(qn,cd); + m_classSDict->inSort(qn,cd); } else { @@ -290,23 +287,23 @@ bool GroupDefImpl::addClass(const ClassDef *cd) // add nested classes (e.g. A::B, A::C) after their parent (A) in // order of insertion QCString scope = qn.left(i); - int j=classSDict->findAt(scope); + int j=m_classSDict->findAt(scope); if (j!=-1) { - while (j<(int)classSDict->count() && - classSDict->at(j)->qualifiedName().left(i)==scope) + while (j<(int)m_classSDict->count() && + m_classSDict->at(j)->qualifiedName().left(i)==scope) { //printf("skipping over %s\n",classSDict->at(j)->qualifiedName().data()); j++; } //printf("Found scope at index %d\n",j); - classSDict->insertAt(j,qn,cd); + m_classSDict->insertAt(j,qn,cd); found=TRUE; } } if (!found) // no insertion point found -> just append { - classSDict->append(qn,cd); + m_classSDict->append(qn,cd); } } return TRUE; @@ -319,12 +316,12 @@ bool GroupDefImpl::addNamespace(const NamespaceDef *def) static bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS); if (def->isHidden()) return FALSE; updateLanguage(def); - if (namespaceSDict->find(def->name())==0) + if (m_namespaceSDict->find(def->name())==0) { if (sortBriefDocs) - namespaceSDict->inSort(def->name(),def); + m_namespaceSDict->inSort(def->name(),def); else - namespaceSDict->append(def->name(),def); + m_namespaceSDict->append(def->name(),def); return TRUE; } return FALSE; @@ -334,23 +331,23 @@ void GroupDefImpl::addDir(const DirDef *def) { if (def->isHidden()) return; if (Config_getBool(SORT_BRIEF_DOCS)) - dirList->inSort(def); + m_dirList->inSort(def); else - dirList->append(def); + m_dirList->append(def); } void GroupDefImpl::addPage(PageDef *def) { if (def->isHidden()) return; //printf("Making page %s part of a group\n",def->name.data()); - pageDict->append(def->name(),def); + m_pageDict->append(def->name(),def); def->makePartOfGroup(this); } void GroupDefImpl::addExample(const PageDef *def) { if (def->isHidden()) return; - exampleDict->append(def->name(),def); + m_exampleDict->append(def->name(),def); } @@ -362,12 +359,12 @@ void GroupDefImpl::addMembersToMemberGroup() { if (ml->listType()&MemberListType_declarationLists) { - ::addMembersToMemberGroup(ml,&memberGroupSDict,this); + ::addMembersToMemberGroup(ml,&m_memberGroupSDict,this); } } //printf("GroupDefImpl::addMembersToMemberGroup() memberGroupList=%d\n",memberGroupList->count()); - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -382,7 +379,7 @@ bool GroupDefImpl::insertMember(MemberDef *md,bool docOnly) updateLanguage(md); //printf("GroupDef(%s)::insertMember(%s)\n", title.data(), md->name().data()); MemberNameInfo *mni=0; - if ((mni=(*allMemberNameInfoSDict)[md->name()])) + if ((mni=(*m_allMemberNameInfoSDict)[md->name()])) { // member with this name already found MemberNameInfoIterator srcMnii(*mni); const MemberInfo *srcMi; @@ -427,10 +424,10 @@ bool GroupDefImpl::insertMember(MemberDef *md,bool docOnly) { mni = new MemberNameInfo(md->name()); mni->append(new MemberInfo(md,md->protection(),md->virtualness(),FALSE)); - allMemberNameInfoSDict->append(mni->memberName(),mni); + m_allMemberNameInfoSDict->append(mni->memberName(),mni); } //printf("Added member!\n"); - allMemberList->append(md); + m_allMemberList->append(md); switch(md->memberType()) { case MemberType_Variable: @@ -542,7 +539,7 @@ bool GroupDefImpl::insertMember(MemberDef *md,bool docOnly) void GroupDefImpl::removeMember(MemberDef *md) { // fprintf(stderr, "GroupDef(%s)::removeMember( %s )\n", title.data(), md->name().data()); - MemberNameInfo *mni = allMemberNameInfoSDict->find(md->name()); + MemberNameInfo *mni = m_allMemberNameInfoSDict->find(md->name()); if (mni) { MemberNameInfoIterator mnii(*mni); @@ -557,7 +554,7 @@ void GroupDefImpl::removeMember(MemberDef *md) } if( mni->isEmpty() ) { - allMemberNameInfoSDict->remove(md->name()); + m_allMemberNameInfoSDict->remove(md->name()); } removeMemberFromList(MemberListType_allMembersList,md); @@ -632,9 +629,9 @@ bool GroupDefImpl::findGroup(const GroupDef *def) const { return TRUE; } - else if (groupList) + else if (m_groupList) { - GroupListIterator it(*groupList); + GroupListIterator it(*m_groupList); GroupDef *gd; for (;(gd=it.current());++it) { @@ -653,7 +650,7 @@ void GroupDefImpl::addGroup(const GroupDef *def) //if (Config_getBool(SORT_MEMBER_DOCS)) // groupList->inSort(def); //else - groupList->append(def); + m_groupList->append(def); } bool GroupDefImpl::isASubGroup() const @@ -671,9 +668,9 @@ void GroupDefImpl::countMembers() ml->countDecMembers(); ml->countDocMembers(); } - if (memberGroupSDict) + if (m_memberGroupSDict) { - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -685,27 +682,27 @@ void GroupDefImpl::countMembers() int GroupDefImpl::numDocMembers() const { - return fileList->count()+ - classSDict->count()+ - namespaceSDict->count()+ - groupList->count()+ - allMemberList->count()+ - pageDict->count()+ - exampleDict->count(); + return m_fileList->count()+ + m_classSDict->count()+ + m_namespaceSDict->count()+ + m_groupList->count()+ + m_allMemberList->count()+ + m_pageDict->count()+ + m_exampleDict->count(); } /*! Compute the HTML anchor names for all members in the group */ void GroupDefImpl::computeAnchors() { //printf("GroupDefImpl::computeAnchors()\n"); - setAnchors(allMemberList); + setAnchors(m_allMemberList); } void GroupDefImpl::writeTagFile(FTextStream &tagFile) { tagFile << " <compound kind=\"group\">" << endl; tagFile << " <name>" << convertToXML(name()) << "</name>" << endl; - tagFile << " <title>" << convertToXML(title) << "</title>" << endl; + tagFile << " <title>" << convertToXML(m_title) << "</title>" << endl; tagFile << " <filename>" << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "</filename>" << endl; QListIterator<LayoutDocEntry> eli( LayoutDocManager::instance().docEntries(LayoutDocManager::Group)); @@ -716,9 +713,9 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) { case LayoutDocEntry::GroupClasses: { - if (classSDict) + if (m_classSDict) { - SDict<ClassDef>::Iterator ci(*classSDict); + SDict<ClassDef>::Iterator ci(*m_classSDict); ClassDef *cd; for (ci.toFirst();(cd=ci.current());++ci) { @@ -733,9 +730,9 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) break; case LayoutDocEntry::GroupNamespaces: { - if (namespaceSDict) + if (m_namespaceSDict) { - SDict<NamespaceDef>::Iterator ni(*namespaceSDict); + SDict<NamespaceDef>::Iterator ni(*m_namespaceSDict); NamespaceDef *nd; for (ni.toFirst();(nd=ni.current());++ni) { @@ -750,9 +747,9 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) break; case LayoutDocEntry::GroupFiles: { - if (fileList) + if (m_fileList) { - QListIterator<FileDef> it(*fileList); + QListIterator<FileDef> it(*m_fileList); FileDef *fd; for (;(fd=it.current());++it) { @@ -766,9 +763,9 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) break; case LayoutDocEntry::GroupPageDocs: { - if (pageDict) + if (m_pageDict) { - PageSDict::Iterator pdi(*pageDict); + PageSDict::Iterator pdi(*m_pageDict); PageDef *pd=0; for (pdi.toFirst();(pd=pdi.current());++pdi) { @@ -783,9 +780,9 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) break; case LayoutDocEntry::GroupDirs: { - if (dirList) + if (m_dirList) { - QListIterator<DirDef> it(*dirList); + QListIterator<DirDef> it(*m_dirList); DirDef *dd; for (;(dd=it.current());++it) { @@ -799,9 +796,9 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) break; case LayoutDocEntry::GroupNestedGroups: { - if (groupList) + if (m_groupList) { - QListIterator<GroupDef> it(*groupList); + QListIterator<GroupDef> it(*m_groupList); GroupDef *gd; for (;(gd=it.current());++it) { @@ -825,9 +822,9 @@ void GroupDefImpl::writeTagFile(FTextStream &tagFile) break; case LayoutDocEntry::MemberGroups: { - if (memberGroupSDict) + if (m_memberGroupSDict) { - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -851,7 +848,7 @@ void GroupDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title ) { ol.pushGeneratorState(); - if (pageDict->count()!=numDocMembers()) // not only pages -> classical layout + if (m_pageDict->count()!=(uint)numDocMembers()) // not only pages -> classical layout { ol.pushGeneratorState(); ol.disable(OutputGenerator::Html); @@ -953,7 +950,7 @@ void GroupDefImpl::writeGroupGraph(OutputList &ol) ol.disable(OutputGenerator::Man); //ol.startParagraph(); ol.startGroupCollaboration(); - ol.parseText(theTranslator->trCollaborationDiagram(title)); + ol.parseText(theTranslator->trCollaborationDiagram(m_title)); ol.endGroupCollaboration(graph); //ol.endParagraph(); ol.popGeneratorState(); @@ -964,13 +961,13 @@ void GroupDefImpl::writeGroupGraph(OutputList &ol) void GroupDefImpl::writeFiles(OutputList &ol,const QCString &title) { // write list of files - if (fileList->count()>0) + if (m_fileList->count()>0) { ol.startMemberHeader("files"); ol.parseText(title); ol.endMemberHeader(); ol.startMemberList(); - QListIterator<FileDef> it(*fileList); + QListIterator<FileDef> it(*m_fileList); FileDef *fd; for (;(fd=it.current());++it) { @@ -996,16 +993,16 @@ void GroupDefImpl::writeFiles(OutputList &ol,const QCString &title) void GroupDefImpl::writeNamespaces(OutputList &ol,const QCString &title) { // write list of namespaces - namespaceSDict->writeDeclaration(ol,title); + m_namespaceSDict->writeDeclaration(ol,title); } void GroupDefImpl::writeNestedGroups(OutputList &ol,const QCString &title) { // write list of groups int count=0; - if (groupList->count()>0) + if (m_groupList->count()>0) { - QListIterator<GroupDef> it(*groupList); + QListIterator<GroupDef> it(*m_groupList); GroupDef *gd; for (;(gd=it.current());++it) { @@ -1020,9 +1017,9 @@ void GroupDefImpl::writeNestedGroups(OutputList &ol,const QCString &title) ol.startMemberList(); if (Config_getBool(SORT_GROUP_NAMES)) { - groupList->sort(); + m_groupList->sort(); } - QListIterator<GroupDef> it(*groupList); + QListIterator<GroupDef> it(*m_groupList); GroupDef *gd; for (;(gd=it.current());++it) { @@ -1052,13 +1049,13 @@ void GroupDefImpl::writeNestedGroups(OutputList &ol,const QCString &title) void GroupDefImpl::writeDirs(OutputList &ol,const QCString &title) { // write list of directories - if (dirList->count()>0) + if (m_dirList->count()>0) { ol.startMemberHeader("dirs"); ol.parseText(title); ol.endMemberHeader(); ol.startMemberList(); - QListIterator<DirDef> it(*dirList); + QListIterator<DirDef> it(*m_dirList); DirDef *dd; for (;(dd=it.current());++it) { @@ -1085,18 +1082,18 @@ void GroupDefImpl::writeDirs(OutputList &ol,const QCString &title) void GroupDefImpl::writeClasses(OutputList &ol,const QCString &title) { // write list of classes - classSDict->writeDeclaration(ol,0,title,FALSE); + m_classSDict->writeDeclaration(ol,0,title,FALSE); } void GroupDefImpl::writeInlineClasses(OutputList &ol) { - classSDict->writeDocumentation(ol); + m_classSDict->writeDocumentation(ol); } void GroupDefImpl::writePageDocumentation(OutputList &ol) { PageDef *pd=0; - PageSDict::Iterator pdi(*pageDict); + PageSDict::Iterator pdi(*m_pageDict); for (pdi.toFirst();(pd=pdi.current());++pdi) { if (!pd->isReference()) @@ -1119,11 +1116,11 @@ void GroupDefImpl::writePageDocumentation(OutputList &ol) void GroupDefImpl::writeMemberGroups(OutputList &ol) { /* write user defined member groups */ - if (memberGroupSDict) + if (m_memberGroupSDict) { - memberGroupSDict->sort(); + m_memberGroupSDict->sort(); /* write user defined member groups */ - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -1186,11 +1183,11 @@ void GroupDefImpl::writeSummaryLinks(OutputList &ol) const SrcLangExt lang = getLanguage(); for (eli.toFirst();(lde=eli.current());++eli) { - if ((lde->kind()==LayoutDocEntry::GroupClasses && classSDict->declVisible()) || - (lde->kind()==LayoutDocEntry::GroupNamespaces && namespaceSDict->declVisible()) || - (lde->kind()==LayoutDocEntry::GroupFiles && fileList->count()>0) || - (lde->kind()==LayoutDocEntry::GroupNestedGroups && groupList->count()>0) || - (lde->kind()==LayoutDocEntry::GroupDirs && dirList->count()>0) + if ((lde->kind()==LayoutDocEntry::GroupClasses && m_classSDict->declVisible()) || + (lde->kind()==LayoutDocEntry::GroupNamespaces && m_namespaceSDict->declVisible()) || + (lde->kind()==LayoutDocEntry::GroupFiles && m_fileList->count()>0) || + (lde->kind()==LayoutDocEntry::GroupNestedGroups && m_groupList->count()>0) || + (lde->kind()==LayoutDocEntry::GroupDirs && m_dirList->count()>0) ) { LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; @@ -1224,19 +1221,19 @@ void GroupDefImpl::writeDocumentation(OutputList &ol) { //static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); ol.pushGeneratorState(); - startFile(ol,getOutputFileBase(),name(),title,HLI_Modules); + startFile(ol,getOutputFileBase(),name(),m_title,HLI_Modules); ol.startHeaderSection(); writeSummaryLinks(ol); ol.startTitleHead(getOutputFileBase()); ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); - ol.parseText(title); + ol.parseText(m_title); ol.popGeneratorState(); addGroupListToTitle(ol,this); ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); - ol.endTitleHead(getOutputFileBase(),title); + ol.endTitleHead(getOutputFileBase(),m_title); ol.popGeneratorState(); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Man); @@ -1250,14 +1247,14 @@ void GroupDefImpl::writeDocumentation(OutputList &ol) Doxygen::searchIndex->setCurrentDoc(this,anchor(),FALSE); static QRegExp we("[a-zA-Z_][-a-zA-Z_0-9]*"); int i=0,p=0,l=0; - while ((i=we.match(title,p,&l))!=-1) // foreach word in the title + while ((i=we.match(m_title,p,&l))!=-1) // foreach word in the title { - Doxygen::searchIndex->addWord(title.mid(i,l),TRUE); + Doxygen::searchIndex->addWord(m_title.mid(i,l),TRUE); p=i+l; } } - Doxygen::indexList->addIndexItem(this,0,0,title); + Doxygen::indexList->addIndexItem(this,0,0,m_title); //---------------------------------------- start flexible part ------------------------------- @@ -1391,7 +1388,7 @@ void GroupDefImpl::writeDocumentation(OutputList &ol) if (Config_getBool(SEPARATE_MEMBER_PAGES)) { - allMemberList->sort(); + m_allMemberList->sort(); writeMemberPages(ol); } @@ -1422,7 +1419,7 @@ void GroupDefImpl::writeQuickMemberLinks(OutputList &ol,const MemberDef *current ol.writeString(" <div class=\"navtab\">\n"); ol.writeString(" <table>\n"); - MemberListIterator mli(*allMemberList); + MemberListIterator mli(*m_allMemberList); MemberDef *md; for (mli.toFirst();(md=mli.current());++mli) { @@ -1653,7 +1650,7 @@ void addExampleToGroups(const Entry *root,PageDef *eg) QCString GroupDefImpl::getOutputFileBase() const { - return fileName; + return m_fileName; } void GroupDefImpl::addListReferences() @@ -1668,7 +1665,7 @@ void GroupDefImpl::addListReferences() 0 ); } - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -1763,13 +1760,13 @@ void GroupDefImpl::writeMemberDocumentation(OutputList &ol,MemberListType lt,con void GroupDefImpl::removeMemberFromList(MemberListType lt,MemberDef *md) { - MemberList *ml = getMemberList(lt); - if (ml) ml->remove(md); + MemberList *ml = getMemberList(lt); + if (ml) ml->remove(md); } void GroupDefImpl::sortSubGroups() { - groupList->sort(); + m_groupList->sort(); } bool GroupDefImpl::isLinkableInProject() const diff --git a/src/growbuf.h b/src/growbuf.h index 2d0d503..cd6a67b 100644 --- a/src/growbuf.h +++ b/src/growbuf.h @@ -10,49 +10,49 @@ class GrowBuf { public: - GrowBuf() : str(0), pos(0), len(0) {} - GrowBuf(int initialSize) : pos(0), len(initialSize) { str=(char*)malloc(len); } - ~GrowBuf() { free(str); str=0; pos=0; len=0; } - void clear() { pos=0; } - void addChar(char c) { if (pos>=len) { len+=GROW_AMOUNT; str = (char*)realloc(str,len); } - str[pos++]=c; + GrowBuf() : m_str(0), m_pos(0), m_len(0) {} + GrowBuf(uint initialSize) : m_pos(0), m_len(initialSize) { m_str=(char*)malloc(m_len); } + ~GrowBuf() { free(m_str); } + void clear() { m_pos=0; } + void addChar(char c) { if (m_pos>=m_len) { m_len+=GROW_AMOUNT; m_str = (char*)realloc(m_str,m_len); } + m_str[m_pos++]=c; } void addStr(const QCString &s) { if (!s.isEmpty()) { - int l=s.length(); - if (pos+l>=len) { len+=l+GROW_AMOUNT; str = (char*)realloc(str,len); } - strcpy(&str[pos],s.data()); - pos+=l; + uint l=s.length(); + if (m_pos+l>=m_len) { m_len+=l+GROW_AMOUNT; m_str = (char*)realloc(m_str,m_len); } + strcpy(&m_str[m_pos],s.data()); + m_pos+=l; } } void addStr(const char *s) { if (s) { - int l=(int)strlen(s); - if (pos+l>=len) { len+=l+GROW_AMOUNT; str = (char*)realloc(str,len); } - strcpy(&str[pos],s); - pos+=l; + uint l=(uint)strlen(s); + if (m_pos+l>=m_len) { m_len+=l+GROW_AMOUNT; m_str = (char*)realloc(m_str,m_len); } + strcpy(&m_str[m_pos],s); + m_pos+=l; } } - void addStr(const char *s,int n) { + void addStr(const char *s,uint n) { if (s) { - int l=(int)strlen(s); + uint l=(uint)strlen(s); if (n<l) l=n; - if (pos+l>=len) { len+=l+GROW_AMOUNT; str = (char*)realloc(str,len); } - strncpy(&str[pos],s,n); - pos+=l; + if (m_pos+l>=m_len) { m_len+=l+GROW_AMOUNT; m_str = (char*)realloc(m_str,m_len); } + strncpy(&m_str[m_pos],s,n); + m_pos+=l; } } - const char *get() { return str; } - int getPos() const { return pos; } - void setPos(const int newPos) { pos = newPos; } - char at(int i) const { return str[i]; } + const char *get() { return m_str; } + uint getPos() const { return m_pos; } + void setPos(uint newPos) { m_pos = newPos; } + char at(uint i) const { return m_str[i]; } private: - char *str; - int pos; - int len; + char *m_str; + uint m_pos; + uint m_len; }; #endif diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index f220646..6e100fb 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -2461,7 +2461,7 @@ void HtmlDocVisitor::forceEndParagraph(DocNode *n) nodeIndex--; } if (nodeIndex<0) return; // first visible node in paragraph - DocNode *n = para->children().at(nodeIndex); + n = para->children().at(nodeIndex); if (mustBeOutsideParagraph(n)) return; // previous node already outside paragraph context nodeIndex--; bool styleOutsideParagraph=insideStyleChangeThatIsOutsideParagraph(para,nodeIndex); @@ -2498,7 +2498,7 @@ void HtmlDocVisitor::forceStartParagraph(DocNode *n) } if (nodeIndex<numNodes) { - DocNode *n = para->children().at(nodeIndex); + n = para->children().at(nodeIndex); if (mustBeOutsideParagraph(n)) return; // next element also outside paragraph } else diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 05486d8..ac42a6a 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -408,7 +408,7 @@ static QCString removeEmptyLines(const QCString &s) return out.data(); } -static QCString substituteHtmlKeywords(const QCString &s, +static QCString substituteHtmlKeywords(const QCString &str, const QCString &title, const QCString &relPath, const QCString &navPath=QCString()) @@ -576,7 +576,7 @@ static QCString substituteHtmlKeywords(const QCString &s, } // first substitute generic keywords - QCString result = substituteKeywords(s,title, + QCString result = substituteKeywords(str,title, convertToHtml(Config_getString(PROJECT_NAME)), convertToHtml(Config_getString(PROJECT_NUMBER)), convertToHtml(Config_getString(PROJECT_BRIEF))); @@ -1070,7 +1070,7 @@ void HtmlGenerator::writeSearchData(const char *dir) { searchCss = mgr.getAsString("search.css"); } - searchCss = substitute(replaceColorMarkers(searchCss),"$doxygenversion",getVersion()); + searchCss = substitute(replaceColorMarkers(searchCss),"$doxygenversion",getDoxygenVersion()); t << searchCss; Doxygen::indexList->addStyleSheetFile("search/search.css"); } @@ -1079,20 +1079,20 @@ void HtmlGenerator::writeSearchData(const char *dir) void HtmlGenerator::writeStyleSheetFile(QFile &file) { FTextStream t(&file); - t << replaceColorMarkers(substitute(ResourceMgr::instance().getAsString("doxygen.css"),"$doxygenversion",getVersion())); + t << replaceColorMarkers(substitute(ResourceMgr::instance().getAsString("doxygen.css"),"$doxygenversion",getDoxygenVersion())); } void HtmlGenerator::writeHeaderFile(QFile &file, const char * /*cssname*/) { FTextStream t(&file); - t << "<!-- HTML header for doxygen " << getVersion() << "-->" << endl; + t << "<!-- HTML header for doxygen " << getDoxygenVersion() << "-->" << endl; t << ResourceMgr::instance().getAsString("header.html"); } void HtmlGenerator::writeFooterFile(QFile &file) { FTextStream t(&file); - t << "<!-- HTML footer for doxygen " << getVersion() << "-->" << endl; + t << "<!-- HTML footer for doxygen " << getDoxygenVersion() << "-->" << endl; t << ResourceMgr::instance().getAsString("footer.html"); } @@ -1113,7 +1113,7 @@ void HtmlGenerator::startFile(const char *name,const char *, t << substituteHtmlKeywords(g_header,convertToHtml(filterTitle(title)),m_relPath); t << "<!-- " << theTranslator->trGeneratedBy() << " Doxygen " - << getVersion() << " -->" << endl; + << getDoxygenVersion() << " -->" << endl; //static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); static bool searchEngine = Config_getBool(SEARCHENGINE); if (searchEngine /*&& !generateTreeView*/) @@ -1177,7 +1177,7 @@ QCString HtmlGenerator::writeLogoAsString(const char *path) "<img class=\"footer\" src=\""; result += path; result += "doxygen.png\" alt=\"doxygen\"/></a> "; - result += getVersion(); + result += getDoxygenVersion(); result += " "; return result; } @@ -1230,7 +1230,7 @@ void HtmlGenerator::writeStyleInfo(int part) //t << "H1 { text-align: center; border-width: thin none thin none;" << endl; //t << " border-style : double; border-color : blue; padding-left : 1em; padding-right : 1em }" << endl; - t << replaceColorMarkers(substitute(ResourceMgr::instance().getAsString("doxygen.css"),"$doxygenversion",getVersion())); + t << replaceColorMarkers(substitute(ResourceMgr::instance().getAsString("doxygen.css"),"$doxygenversion",getDoxygenVersion())); endPlainFile(); Doxygen::indexList->addStyleSheetFile("doxygen.css"); } @@ -2648,7 +2648,7 @@ void HtmlGenerator::writeSearchPage() t << substituteHtmlKeywords(g_header,"Search",""); t << "<!-- " << theTranslator->trGeneratedBy() << " Doxygen " - << getVersion() << " -->" << endl; + << getDoxygenVersion() << " -->" << endl; t << "<script type=\"text/javascript\">\n"; t << "/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */\n"; t << "var searchBox = new SearchBox(\"searchBox\", \"" @@ -2693,7 +2693,6 @@ void HtmlGenerator::writeSearchPage() void HtmlGenerator::writeExternalSearchPage() { static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); - static bool disableIndex = Config_getBool(DISABLE_INDEX); QCString fileName = Config_getString(HTML_OUTPUT)+"/search"+Doxygen::htmlFileExtension; QFile f(fileName); if (f.open(IO_WriteOnly)) @@ -2702,7 +2701,7 @@ void HtmlGenerator::writeExternalSearchPage() t << substituteHtmlKeywords(g_header,"Search",""); t << "<!-- " << theTranslator->trGeneratedBy() << " Doxygen " - << getVersion() << " -->" << endl; + << getDoxygenVersion() << " -->" << endl; t << "<script type=\"text/javascript\">\n"; t << "/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */\n"; t << "var searchBox = new SearchBox(\"searchBox\", \"" diff --git a/src/image.cpp b/src/image.cpp index afc67ef..2a8108b 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -207,7 +207,7 @@ static Color palette3[] = }; -Image::Image(int w,int h) +Image::Image(uint w,uint h) { static int hue = Config_getInt(HTML_COLORSTYLE_HUE); static int sat = Config_getInt(HTML_COLORSTYLE_SAT); @@ -236,49 +236,49 @@ Image::Image(int w,int h) palette[3].green = (int)(green2 * 255.0); palette[3].blue = (int)(blue2 * 255.0); - data = new uchar[w*h]; - memset(data,0,w*h); - width = w; - height = h; + m_data = new uchar[w*h]; + memset(m_data,0,w*h); + m_width = w; + m_height = h; } Image::~Image() { - delete[] data; + delete[] m_data; } -void Image::setPixel(int x,int y,uchar val) +void Image::setPixel(uint x,uint y,uchar val) { - if (x>=0 && x<width && y>=0 && y<height) - data[y*width+x] = val; + if (x<m_width && y<m_height) + m_data[y*m_width+x] = val; } -uchar Image::getPixel(int x,int y) const +uchar Image::getPixel(uint x,uint y) const { - if (x>=0 && x<width && y>=0 && y<height) - return data[y*width+x]; + if (x<m_width && y<m_height) + return m_data[y*m_width+x]; else return 0; } -void Image::writeChar(int x,int y,char c,uchar fg) +void Image::writeChar(uint x,uint y,char c,uchar fg) { if (c>=' ') { - int xf,yf,ci=c-' '; - int rowOffset=0; - int cw = charWidth[ci]; - int cp = charPos[ci]; + uint xf,yf,ci=c-' '; + uint rowOffset=0; + uint cw = charWidth[ci]; + uint cp = charPos[ci]; for (yf=0;yf<charHeight;yf++) { unsigned short bitPattern=0; - int bitsLeft=cw; - int byteOffset = rowOffset+(cp>>3); - int bitOffset = cp&7; + uint bitsLeft=cw; + uint byteOffset = rowOffset+(cp>>3); + uint bitOffset = cp&7; // get the bit pattern for row yf of the character from the font data while (bitsLeft>0) { - int bits=8-bitOffset; + uint bits=8-bitOffset; if (bits>bitsLeft) bits=bitsLeft; bitPattern<<=bits; bitPattern|=((fontRaw[byteOffset]<<bitOffset)&0xff)>>(8-bits); @@ -286,7 +286,7 @@ void Image::writeChar(int x,int y,char c,uchar fg) bitOffset=0; byteOffset++; } - int mask=1<<(cw-1); + uint mask=1<<(cw-1); // draw character row yf for (xf=0;xf<cw;xf++) { @@ -298,7 +298,7 @@ void Image::writeChar(int x,int y,char c,uchar fg) } } -void Image::writeString(int x,int y,const char *s,uchar fg) +void Image::writeString(uint x,uint y,const char *s,uchar fg) { if (s) { @@ -313,7 +313,7 @@ void Image::writeString(int x,int y,const char *s,uchar fg) uint Image::stringLength(const char *s) { - int w=0; + uint w=0; if (s) { char c; @@ -322,9 +322,9 @@ uint Image::stringLength(const char *s) return w; } -void Image::drawHorzLine(int y,int xs,int xe,uchar colIndex,uint mask) +void Image::drawHorzLine(uint y,uint xs,uint xe,uchar colIndex,uint mask) { - int x,i=0,j=0; + uint x,i=0,j=0; for (x=xs;x<=xe;x++,j++) { if (j&1) i++; @@ -332,38 +332,38 @@ void Image::drawHorzLine(int y,int xs,int xe,uchar colIndex,uint mask) } } -void Image::drawHorzArrow(int y,int xs,int xe,uchar colIndex,uint mask) +void Image::drawHorzArrow(uint y,uint xs,uint xe,uchar colIndex,uint mask) { drawHorzLine(y,xs,xe,colIndex,mask); - int i; + uint i; for (i=0;i<6;i++) { - int h=i>>1; + uint h=i>>1; drawVertLine(xe-i,y-h,y+h,colIndex,0xffffffff); } } -void Image::drawVertLine(int x,int ys,int ye,uchar colIndex,uint mask) +void Image::drawVertLine(uint x,uint ys,uint ye,uchar colIndex,uint mask) { - int y,i=0; + uint y,i=0; for (y=ys;y<=ye;y++,i++) { if (mask&(1<<(i&0x1f))) setPixel(x,y,colIndex); } } -void Image::drawVertArrow(int x,int ys,int ye,uchar colIndex,uint mask) +void Image::drawVertArrow(uint x,uint ys,uint ye,uchar colIndex,uint mask) { drawVertLine(x,ys,ye,colIndex,mask); - int i; + uint i; for (i=0;i<6;i++) { - int h=i>>1; + uint h=i>>1; drawHorzLine(ys+i,x-h,x+h,colIndex,0xffffffff); } } -void Image::drawRect(int x,int y,int w,int h,uchar colIndex,uint mask) +void Image::drawRect(uint x,uint y,uint w,uint h,uchar colIndex,uint mask) { drawHorzLine(y,x,x+w-1,colIndex,mask); drawHorzLine(y+h-1,x,x+w-1,colIndex,mask); @@ -371,44 +371,27 @@ void Image::drawRect(int x,int y,int w,int h,uchar colIndex,uint mask) drawVertLine(x+w-1,y,y+h-1,colIndex,mask); } -void Image::fillRect(int x,int y,int lwidth,int lheight,uchar colIndex,uint mask) +void Image::fillRect(uint x,uint y,uint width,uint height,uchar colIndex,uint mask) { - int xp,yp,xi,yi; - for (yp=y,yi=0;yp<y+lheight;yp++,yi++) - for (xp=x,xi=0;xp<x+lwidth;xp++,xi++) + uint xp,yp,xi,yi; + for (yp=y,yi=0;yp<y+height;yp++,yi++) + for (xp=x,xi=0;xp<x+width;xp++,xi++) if (mask&(1<<((xi+yi)&0x1f))) setPixel(xp,yp,colIndex); } bool Image::save(const char *fileName,int mode) { -#if 0 - GifEncoder gifenc(data, - mode==0 ? palette : palette2, - width,height, - mode==0 ? 3 : 4, - 0); - QFile file(fileName); - if (file.open(IO_WriteOnly)) - { - gifenc.writeGIF(file); - return TRUE; - } - else - { - return FALSE; - } -#endif static bool useTransparency = Config_getBool(FORMULA_TRANSPARENT); uchar* buffer; size_t bufferSize; LodePNG_Encoder encoder; LodePNG_Encoder_init(&encoder); - int numCols = mode==0 ? 8 : 16; + uint numCols = mode==0 ? 8 : 16; Color *pPal = mode==0 ? palette : useTransparency ? palette2 : palette3 ; - int i; + uint i; for (i=0;i<numCols;i++,pPal++) { LodePNG_InfoColor_addPalette(&encoder.infoPng.color, @@ -416,7 +399,7 @@ bool Image::save(const char *fileName,int mode) } encoder.infoPng.color.colorType = 3; encoder.infoRaw.color.colorType = 3; - LodePNG_encode(&encoder, &buffer, &bufferSize, data, width, height); + LodePNG_encode(&encoder, &buffer, &bufferSize, m_data, m_width, m_height); LodePNG_saveFile(buffer, bufferSize, fileName); free(buffer); LodePNG_Encoder_cleanup(&encoder); @@ -489,7 +472,7 @@ void ColoredImage::hsl2rgb(double h,double s,double l, *pBlue = b; } -ColoredImage::ColoredImage(int width,int height, +ColoredImage::ColoredImage(uint width,uint height, const uchar *greyLevels,const uchar *alphaLevels, int saturation,int hue,int gamma) { @@ -497,7 +480,7 @@ ColoredImage::ColoredImage(int width,int height, m_width = width; m_height = height; m_data = (uchar*)malloc(width*height*4); - int i; + uint i; for (i=0;i<width*height;i++) { uchar r,g,b,a; diff --git a/src/image.h b/src/image.h index 35e6ae3..435321a 100644 --- a/src/image.h +++ b/src/image.h @@ -24,37 +24,37 @@ class Image { public: - Image(int w,int h); + Image(uint w,uint h); ~Image(); - void setPixel(int x,int y,uchar val); - uchar getPixel(int x,int y) const; - void writeChar(int x,int y,char c,uchar fg); - void writeString(int x,int y,const char *s,uchar fg); - void drawHorzLine(int y,int xs,int xe,uchar colIndex,uint mask); - void drawHorzArrow(int y,int xs,int xe,uchar colIndex,uint mask); - void drawVertLine(int x,int ys,int ye,uchar colIndex,uint mask); - void drawVertArrow(int x,int ys,int ye,uchar colIndex,uint mask); - void drawRect(int x,int y,int width,int height,uchar colIndex,uint mask); - void fillRect(int x,int y,int width,int height,uchar colIndex,uint mask); + void setPixel(uint x,uint y,uchar val); + uchar getPixel(uint x,uint y) const; + void writeChar(uint x,uint y,char c,uchar fg); + void writeString(uint x,uint y,const char *s,uchar fg); + void drawHorzLine(uint y,uint xs,uint xe,uchar colIndex,uint mask); + void drawHorzArrow(uint y,uint xs,uint xe,uchar colIndex,uint mask); + void drawVertLine(uint x,uint ys,uint ye,uchar colIndex,uint mask); + void drawVertArrow(uint x,uint ys,uint ye,uchar colIndex,uint mask); + void drawRect(uint x,uint y,uint width,uint height,uchar colIndex,uint mask); + void fillRect(uint x,uint y,uint width,uint height,uchar colIndex,uint mask); bool save(const char *fileName,int mode=0); friend uint stringLength(const char *s); - uint getWidth() const { return width; } - uint getHeight() const { return height; } - uchar *getData() const { return data; } + uint width() const { return m_width; } + uint height() const { return m_height; } + uchar *data() const { return m_data; } static uint stringLength(const char *s); private: - int width; - int height; - uchar *data; + uint m_width; + uint m_height; + uchar *m_data; }; /** Class representing a bitmap image colored based on hue/sat/gamma settings. */ class ColoredImage { public: - ColoredImage(int width,int height, + ColoredImage(uint width,uint height, const uchar *greyLevels,const uchar *alphaLevels, int saturation,int hue,int gamma); ~ColoredImage(); @@ -62,8 +62,8 @@ class ColoredImage static void hsl2rgb(double h,double s,double l, double *pRed,double *pGreen,double *pBlue); private: - int m_width; - int m_height; + uint m_width; + uint m_height; uchar *m_data; bool m_hasAlpha; }; diff --git a/src/index.cpp b/src/index.cpp index 5552ff0..70475a2 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -2008,20 +2008,20 @@ class PrefixIgnoreClassList : public ClassList class AlphaIndexTableCell { public: - AlphaIndexTableCell(int row,int col,uint letter,ClassDef *cd) : + AlphaIndexTableCell(int row,int col,uint letter,const ClassDef *cd) : m_letter(letter), m_class(cd), m_row(row), m_col(col) { //printf("AlphaIndexTableCell(%d,%d,%c,%s)\n",row,col,letter!=0 ? letter: '-', // cd!=(ClassDef*)0x8 ? cd->name().data() : "<null>"); } - ClassDef *classDef() const { return m_class; } + const ClassDef *classDef() const { return m_class; } uint letter() const { return m_letter; } int row() const { return m_row; } int column() const { return m_col; } private: uint m_letter; - ClassDef *m_class; + const ClassDef *m_class; int m_row; int m_col; }; @@ -2190,7 +2190,7 @@ static void writeAlphabeticalClassList(OutputList &ol, ClassDef::CompoundType ct row++; ClassListIterator cit(*cl); cit.toFirst(); - ClassDef *cd = cit.current(); + cd = cit.current(); ++cit; tableRows->append(new AlphaIndexTableCell(row,col,0,cd)); row++; @@ -4059,7 +4059,7 @@ static void writeGroupTreeNode(OutputList &ol, GroupDef *gd, int level, FTVHelp* for (mi.toFirst();(md=mi.current());++mi) { const MemberList *enumList = md->enumFieldList(); - bool isDir = enumList!=0 && md->isEnumerate(); + isDir = enumList!=0 && md->isEnumerate(); if (md->isVisible() && !md->isAnonymous()) { Doxygen::indexList->addContentsItem(isDir, @@ -4162,7 +4162,7 @@ static void writeGroupTreeNode(OutputList &ol, GroupDef *gd, int level, FTVHelp* { const SectionInfo *si=0; if (!pd->name().isEmpty()) si=SectionManager::instance().find(pd->name()); - bool hasSubPages = pd->hasSubPages(); + hasSubPages = pd->hasSubPages(); bool hasSections = pd->hasSections(); Doxygen::indexList->addContentsItem( hasSubPages || hasSections, @@ -4638,7 +4638,7 @@ static void writeIndex(OutputList &ol) ol.pushGeneratorState(); ol.disable(OutputGenerator::Latex); } - QCString title = pd->title(); + title = pd->title(); if (title.isEmpty()) title=pd->name(); ol.disable(OutputGenerator::Docbook); diff --git a/src/language.cpp b/src/language.cpp index 7457676..299c452 100644 --- a/src/language.cpp +++ b/src/language.cpp @@ -417,6 +417,6 @@ bool setTranslator(const char *langName) } QCString msg = theTranslator->updateNeededMessage(); - if (!msg.isEmpty()) warn_uncond(msg); + if (!msg.isEmpty()) warn_uncond("%s", msg.data()); return TRUE; } diff --git a/src/latexgen.cpp b/src/latexgen.cpp index 392e839..f00e6cf 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.cpp @@ -80,12 +80,12 @@ void LatexCodeGenerator::codify(const char *str) { if (str) { - const char *p=str; - char c; + const signed char *p=(const signed char*)str; + signed char c; //char cs[5]; int spacesToNextTabStop; static int tabSize = Config_getInt(TAB_SIZE); - static char *result = NULL; + static signed char *result = NULL; static int lresult = 0; int i; while ((c=*p)) @@ -119,7 +119,7 @@ void LatexCodeGenerator::codify(const char *str) if (lresult < (i + 5)) \ { \ lresult += 512; \ - result = (char *)realloc(result, lresult); \ + result = (signed char *)realloc(result, lresult); \ } \ result[i++]=c; p++; \ if (c<0) /* multibyte utf-8 character */ \ @@ -151,7 +151,7 @@ void LatexCodeGenerator::codify(const char *str) result[i]=0; // add terminator //if (m_prettyCode) //{ - filterLatexString(m_t,result,FALSE,TRUE); + filterLatexString(m_t,(const char *)result,FALSE,TRUE); //} //else //{ @@ -520,10 +520,10 @@ static void writeDefaultHeaderPart1(FTextStream &t) QFileInfo fi(fileName); if (fi.exists()) { - if (checkExtension(fi.fileName().data(), latexStyleExtension)) + if (checkExtension(fi.fileName().data(), LATEX_STYLE_EXTENSION)) { // strip the extension, it will be added by the usepackage in the tex conversion process - t << "\\usepackage{" << stripExtensionGeneral(fi.fileName().data(), latexStyleExtension) << "}\n"; + t << "\\usepackage{" << stripExtensionGeneral(fi.fileName().data(), LATEX_STYLE_EXTENSION) << "}\n"; } else { @@ -791,7 +791,7 @@ static void writeDefaultHeaderPart3(FTextStream &t) { // part 3 // Finalize project number - t << " Doxygen " << getVersion() << "}\\\\\n"; + t << " Doxygen " << getDoxygenVersion() << "}\\\\\n"; if (Config_getBool(LATEX_TIMESTAMP)) t << "\\vspace*{0.5cm}\n" "{\\small " << dateToString(TRUE) << "}\\\\\n"; @@ -860,7 +860,7 @@ static void writeDefaultFooter(FTextStream &t) void LatexGenerator::writeHeaderFile(QFile &f) { FTextStream t(&f); - t << "% Latex header for doxygen " << getVersion() << endl; + t << "% Latex header for doxygen " << getDoxygenVersion() << endl; writeDefaultHeaderPart1(t); t << "Your title here"; writeDefaultHeaderPart2(t); @@ -871,14 +871,14 @@ void LatexGenerator::writeHeaderFile(QFile &f) void LatexGenerator::writeFooterFile(QFile &f) { FTextStream t(&f); - t << "% Latex footer for doxygen " << getVersion() << endl; + t << "% Latex footer for doxygen " << getDoxygenVersion() << endl; writeDefaultFooter(t); } void LatexGenerator::writeStyleSheetFile(QFile &f) { FTextStream t(&f); - t << "% stylesheet for doxygen " << getVersion() << endl; + t << "% stylesheet for doxygen " << getDoxygenVersion() << endl; writeDefaultStyleSheet(t); } diff --git a/src/latexgen.h b/src/latexgen.h index 6bd1e17..2c32388 100644 --- a/src/latexgen.h +++ b/src/latexgen.h @@ -22,7 +22,7 @@ class QFile; -static const char *latexStyleExtension = ".sty"; +#define LATEX_STYLE_EXTENSION ".sty" class LatexCodeGenerator : public CodeOutputInterface { diff --git a/src/layout.cpp b/src/layout.cpp index 946b612..f84fec0 100644 --- a/src/layout.cpp +++ b/src/layout.cpp @@ -1424,15 +1424,15 @@ class LayoutParser : public QXmlDefaultHandler } private: - LayoutParser() : m_sHandler(163), m_eHandler(17), m_invalidEntry(FALSE), m_part(0), m_rootNav(NULL) { } + LayoutParser() : m_sHandler(163), m_eHandler(17) { } ~LayoutParser() { delete m_rootNav; } QDict<StartElementHandler> m_sHandler; QDict<EndElementHandler> m_eHandler; QCString m_scope; - int m_part; - LayoutNavEntry *m_rootNav; - bool m_invalidEntry; + int m_part = 0; + LayoutNavEntry *m_rootNav = 0; + bool m_invalidEntry = false; static int m_userGroupCount; }; @@ -1562,7 +1562,7 @@ void writeDefaultLayoutFile(const char *fileName) } QTextStream t(&f); t.setEncoding(QTextStream::UnicodeUTF8); - t << substitute(layout_default,"$doxygenversion",getVersion()); + t << substitute(layout_default,"$doxygenversion",getDoxygenVersion()); } //---------------------------------------------------------------------------------- diff --git a/src/markdown.cpp b/src/markdown.cpp index b9b92c3..b99db00 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -109,7 +109,7 @@ static Entry *g_current; static QCString g_fileName; static int g_lineNr; static int g_indentLevel=0; // 0 is outside markdown, -1=page level -static const char g_utf8_nbsp[3] = {'\xc2', '\xa0', '\0'}; // UTF-8 nbsp +static const uchar g_utf8_nbsp[3] = { 0xc2, 0xa0, 0}; // UTF-8 nbsp static const char *g_doxy_nsbp = "&_doxy_nbsp;"; // doxygen escape command for UTF-8 nbsp //---------- @@ -868,13 +868,11 @@ static int processLink(GrowBuf &out,const char *data,int,int size) } if (isToc) // special case for [TOC] { - int level = Config_getInt(TOC_INCLUDE_HEADINGS); - if (level > 0 && level <=5) + int toc_level = Config_getInt(TOC_INCLUDE_HEADINGS); + if (toc_level > 0 && toc_level <=5) { - char levStr[10]; - sprintf(levStr,"%d",level); out.addStr("@tableofcontents{html:"); - out.addStr(levStr); + out.addStr(QCString().setNum(toc_level)); out.addStr("}"); } } @@ -1038,7 +1036,7 @@ static void addStrEscapeUtf8Nbsp(GrowBuf &out,const char *s,int len) } else // escape needed -> slow { - out.addStr(substitute(QCString(s).left(len),g_doxy_nsbp,g_utf8_nbsp)); + out.addStr(substitute(QCString(s).left(len),g_doxy_nsbp,(const char *)g_utf8_nbsp)); } } @@ -1802,7 +1800,7 @@ static int writeTableBlock(GrowBuf &out,const char *data,int size) int rowNum = 1; while (i<size) { - int ret = findTableColumns(data+i,size-i,start,end,cc); + ret = findTableColumns(data+i,size-i,start,end,cc); if (cc!=columns) break; // end of table j=start+i; @@ -1957,20 +1955,15 @@ void writeOneLineHeaderOrRuler(GrowBuf &out,const char *data,int size) QCString hTag; if (level<5 && !id.isEmpty()) { - SectionType type = SectionType::Anchor; switch(level) { case 1: out.addStr("@section "); - type=SectionType::Section; break; case 2: out.addStr("@subsection "); - type=SectionType::Subsection; break; case 3: out.addStr("@subsubsection "); - type=SectionType::Subsubsection; break; default: out.addStr("@paragraph "); - type=SectionType::Paragraph; break; } out.addStr(id); @@ -2299,7 +2292,7 @@ static QCString processBlocks(const QCString &s,int indent) { //printf("Found header at %d-%d\n",i,end); while (pi<size && data[pi]==' ') pi++; - QCString header,id; + QCString header; convertStringFragment(header,data+pi,i-pi-1); id = extractTitleId(header, level); //printf("header='%s' is='%s'\n",header.data(),id.data()); @@ -2472,7 +2465,7 @@ static QCString detab(const QCString &s,int &refIndent) int minIndent=maxIndent; while (i<size) { - char c = data[i++]; + signed char c = (signed char)data[i++]; switch(c) { case '\t': // expand tab @@ -2494,8 +2487,8 @@ static QCString detab(const QCString &s,int &refIndent) default: // non-whitespace => update minIndent if (c<0 && i<size) // multibyte sequence { - // special handling of the UTF-8 nbsp character 0xc2 0xa0 - if (c == '\xc2' && data[i] == '\xa0') + // special handling of the UTF-8 nbsp character 0xC2 0xA0 + if ((uchar)c == 0xC2 && (uchar)(data[i]) == 0xA0) { out.addStr(g_doxy_nsbp); i++; diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 1d2a54e..6d98311 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -36,7 +36,6 @@ #include "dotcallgraph.h" #include "searchindex.h" #include "parserintf.h" -#include "objcache.h" #include "vhdldocgen.h" #include "arguments.h" @@ -944,30 +943,6 @@ static bool writeDefArgumentList(OutputList &ol,const Definition *scope,const Me return FALSE; // member has no function like argument list } - // simple argument list for tcl - if (md->getLanguage()==SrcLangExt_Tcl) - { - if (defArgList.empty()) return FALSE; - ol.endMemberDocName(); - ol.startParameterList(FALSE); - ol.startParameterType(TRUE,0); - ol.endParameterType(); - ol.startParameterName(FALSE); - for (const Argument &a : defArgList) - { - if (a.defval.isEmpty()) - { - ol.docify(a.name+" "); - } - else - { - ol.docify("?"+a.name+"? "); - } - } - ol.endParameterName(TRUE,FALSE,FALSE); - return TRUE; - } - if (!md->isDefine()) ol.docify(" "); //printf("writeDefArgList(%d)\n",defArgList->count()); @@ -1438,7 +1413,7 @@ MemberDefImpl::IMPL::~IMPL() delete classSectionSDict; } -void MemberDefImpl::IMPL::init(Definition *def, +void MemberDefImpl::IMPL::init(Definition *d, const char *t,const char *a,const char *e, Protection p,Specifier v,bool s,Relationship r, MemberType mt,const ArgumentList &tal, @@ -1473,7 +1448,7 @@ void MemberDefImpl::IMPL::init(Definition *def, type=removeRedundantWhiteSpace(type); args=a; args=removeRedundantWhiteSpace(args); - if (type.isEmpty()) decl=def->name()+args; else decl=type+" "+def->name()+args; + if (type.isEmpty()) decl=d->name()+args; else decl=type+" "+d->name()+args; memberGroup=0; virt=v; @@ -1503,7 +1478,7 @@ void MemberDefImpl::IMPL::init(Definition *def, // convert function declaration arguments (if any) if (!args.isEmpty()) { - stringToArgumentList(def->getLanguage(),args,declArgList,&extraTypeChars); + stringToArgumentList(d->getLanguage(),args,declArgList,&extraTypeChars); //printf("setDeclArgList %s to %s const=%d\n",args.data(), // argListToString(declArgList).data(),declArgList->constSpecifier); } @@ -1519,7 +1494,7 @@ void MemberDefImpl::IMPL::init(Definition *def, hasDocumentedParams = FALSE; hasDocumentedReturnType = FALSE; docProvider = 0; - isDMember = def->getDefFileName().right(2).lower()==".d"; + isDMember = d->getDefFileName().right(2).lower()==".d"; } @@ -2640,7 +2615,6 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, ol.writeDoc(rootNode,getOuterScope()?getOuterScope():d,this); if (detailsVisible) { - static bool separateMemberPages = Config_getBool(SEPARATE_MEMBER_PAGES); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); //ol.endEmphasis(); @@ -3337,8 +3311,6 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, { // if this member is in a group find the real scope name. bool hasParameterList = FALSE; - bool inFile = container->definitionType()==Definition::TypeFile; - bool hasDocs = isDetailedSectionVisible(inGroup,inFile); //printf("MemberDefImpl::writeDocumentation(): name='%s' hasDocs='%d' containerType=%d inGroup=%d sectionLinkable=%d\n", // name().data(),hasDocs,container->definitionType(),inGroup,isDetailedSectionLinkable()); @@ -3494,7 +3466,6 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, if (!Config_getBool(HIDE_SCOPE_NAMES)) { bool first=TRUE; - SrcLangExt lang = getLanguage(); if (!m_impl->defTmpArgLists.empty() && lang==SrcLangExt_Cpp) // definition has explicit template parameter declarations { @@ -3567,9 +3538,9 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, { ldef=ldef.left(dp+1); } - int l=ldef.length(); + int dl=ldef.length(); //printf("start >%s<\n",ldef.data()); - int i=l-1; + i=dl-1; while (i>=0 && (isId(ldef.at(i)) || ldef.at(i)==':')) i--; while (i>=0 && isspace((uchar)ldef.at(i))) i--; if (i>0) @@ -4392,7 +4363,7 @@ MemberDef *MemberDefImpl::createTemplateInstanceMember( imd->setArgumentList(actualArgList); imd->setDefinition(substituteTemplateArgumentsInString(m_impl->def,formalArgs,actualArgs)); imd->setBodyDef(getBodyDef()); - imd->setBodySegment(getStartBodyLine(),getEndBodyLine()); + imd->setBodySegment(getDefLine(),getStartBodyLine(),getEndBodyLine()); //imd->setBodyMember(this); // TODO: init other member variables (if needed). @@ -4490,7 +4461,7 @@ const MemberList *MemberDefImpl::getSectionList() const { const Definition *d= resolveAlias()->getOuterScope(); char key[20]; - sprintf(key,"%p",d); + sprintf(key,"%p",(void*)d); return (d!=0 && m_impl->classSectionSDict) ? m_impl->classSectionSDict->find(key) : 0; } @@ -4499,7 +4470,7 @@ void MemberDefImpl::setSectionList(MemberList *sl) //printf("MemberDefImpl::setSectionList(%p,%p) name=%s\n",d,sl,name().data()); const Definition *d= resolveAlias()->getOuterScope(); char key[20]; - sprintf(key,"%p",d); + sprintf(key,"%p",(void*)d); if (m_impl->classSectionSDict==0) { m_impl->classSectionSDict = new SDict<MemberList>(7); @@ -4594,7 +4565,7 @@ void MemberDefImpl::writeTagFile(FTextStream &tagFile) const { tagFile << " <enumvalue file=\"" << convertToXML(getOutputFileBase()+Doxygen::htmlFileExtension); tagFile << "\" anchor=\"" << convertToXML(fmd->anchor()); - QCString idStr = fmd->id(); + idStr = fmd->id(); if (!idStr.isEmpty()) { tagFile << "\" clangid=\"" << convertToXML(idStr); @@ -4629,11 +4600,6 @@ void MemberDefImpl::_computeIsConstructor() m_isConstructorCached = 2; // TRUE return; } - else if (getLanguage()==SrcLangExt_Tcl) // for Tcl - { - m_isConstructorCached = name()=="constructor" ? 2 : 1; - return; - } else // for other languages { QCString locName = getClassDef()->localName(); @@ -4674,10 +4640,6 @@ void MemberDefImpl::_computeIsDestructor() { isDestructor = name()=="__destruct"; } - else if (getLanguage()==SrcLangExt_Tcl) // for Tcl - { - isDestructor = name()=="destructor"; - } else if (name()=="__del__" && getLanguage()==SrcLangExt_Python) // for Python { @@ -6055,14 +6017,14 @@ void combineDeclarationAndDefinition(MemberDef *mdec,MemberDef *mdef) if (mdec->getStartBodyLine()!=-1 && mdef->getStartBodyLine()==-1) { //printf("body mdec->mdef %d-%d\n",mdec->getStartBodyLine(),mdef->getEndBodyLine()); - mdef->setBodySegment(mdec->getStartBodyLine(),mdec->getEndBodyLine()); + mdef->setBodySegment(mdec->getDefLine(),mdec->getStartBodyLine(),mdec->getEndBodyLine()); mdef->setBodyDef(mdec->getBodyDef()); //mdef->setBodyMember(mdec); } else if (mdef->getStartBodyLine()!=-1 && mdec->getStartBodyLine()==-1) { //printf("body mdef->mdec %d-%d\n",mdef->getStartBodyLine(),mdec->getEndBodyLine()); - mdec->setBodySegment(mdef->getStartBodyLine(),mdef->getEndBodyLine()); + mdec->setBodySegment(mdef->getDefLine(),mdef->getStartBodyLine(),mdef->getEndBodyLine()); mdec->setBodyDef(mdef->getBodyDef()); //mdec->setBodyMember(mdef); } diff --git a/src/membergroup.cpp b/src/membergroup.cpp index ee46ced..930426b 100644 --- a/src/membergroup.cpp +++ b/src/membergroup.cpp @@ -152,10 +152,10 @@ void MemberGroup::addGroupedInheritedMembers(OutputList &ol,const ClassDef *cd, const MemberList *ml = md->getSectionList(); if (ml && lt==ml->listType()) { - MemberList ml(lt); - ml.append(md); - ml.countDecMembers(); - ml.writePlainDeclarations(ol,cd,0,0,0,inheritedFrom,inheritId); + MemberList mml(lt); + mml.append(md); + mml.countDecMembers(); + mml.writePlainDeclarations(ol,cd,0,0,0,inheritedFrom,inheritId); } } } diff --git a/src/membergroup.h b/src/membergroup.h index dee998b..c1433cf 100644 --- a/src/membergroup.h +++ b/src/membergroup.h @@ -98,7 +98,6 @@ class MemberGroup bool inSameSection = 0; int m_numDecMembers = 0; int m_numDocMembers = 0; - const Definition *m_parent = 0; QCString m_docFile; int m_docLine = 0; std::vector<RefItem*> m_xrefListItems; diff --git a/src/memberlist.cpp b/src/memberlist.cpp index edd164b..8a76a1d 100644 --- a/src/memberlist.cpp +++ b/src/memberlist.cpp @@ -419,7 +419,6 @@ void MemberList::writePlainDeclarations(OutputList &ol, ) const { //printf("----- writePlainDeclaration() ----\n"); - static bool hideUndocMembers = Config_getBool(HIDE_UNDOC_MEMBERS); if (numDecMembers()==-1) { err("MemberList::numDecMembers()==-1, so the members of this list have not been counted. Please report as a bug.\n"); @@ -558,8 +557,7 @@ void MemberList::writePlainDeclarations(OutputList &ol, // no variables of the anonymous compound type exist. if (cd) { - MemberListIterator mli(*this); - for ( ; (md=mli.current()) ; ++mli ) + for ( mli.toFirst(); (md=mli.current()) ; ++mli ) { if (md->fromAnonymousScope() && !md->anonymousDeclShown()) { diff --git a/src/memberlist.h b/src/memberlist.h index 422c162..4038453 100644 --- a/src/memberlist.h +++ b/src/memberlist.h @@ -131,7 +131,7 @@ class MemberListIterator : public QListIterator<MemberDef> class MemberDict : public QDict<MemberDef> { public: - MemberDict(int size) : QDict<MemberDef>(size) {} + MemberDict(uint size) : QDict<MemberDef>(size) {} virtual ~MemberDict() {} }; @@ -139,7 +139,7 @@ class MemberDict : public QDict<MemberDef> class MemberSDict : public SDict<MemberDef> { public: - MemberSDict(int size=17) : SDict<MemberDef>(size) {} + MemberSDict(uint size=17) : SDict<MemberDef>(size) {} virtual ~MemberSDict() {} private: int compareValues(const MemberDef *item1,const MemberDef *item2) const; diff --git a/src/membername.h b/src/membername.h index 143dca1..04ceda0 100644 --- a/src/membername.h +++ b/src/membername.h @@ -46,7 +46,7 @@ class MemberNameIterator : public QListIterator<MemberDef> class MemberNameSDict : public SDict<MemberName> { public: - MemberNameSDict(int size) : SDict<MemberName>(size) {} + MemberNameSDict(uint size) : SDict<MemberName>(size) {} ~MemberNameSDict() {} private: @@ -92,7 +92,7 @@ class MemberNameInfoIterator : public QListIterator<MemberInfo> class MemberNameInfoSDict : public SDict<MemberNameInfo> { public: - MemberNameInfoSDict(int size) : SDict<MemberNameInfo>(size) {} + MemberNameInfoSDict(uint size) : SDict<MemberNameInfo>(size) {} ~MemberNameInfoSDict() {} private: int compareValues(const MemberNameInfo *item1,const MemberNameInfo *item2) const diff --git a/src/message.h b/src/message.h index 7b12ba8..5f8c9db 100644 --- a/src/message.h +++ b/src/message.h @@ -21,17 +21,26 @@ #include <stdio.h> #include <stdarg.h> -extern void msg(const char *fmt, ...); -extern void warn(const char *file,int line,const char *fmt, ...); -extern void va_warn(const char *file,int line,const char *fmt, va_list args); +#ifdef __GNUC__ +#define PRINTFLIKE(FORMAT, PARAM ) __attribute__((format(printf, FORMAT, PARAM))) +#else +#define PRINTFLIKE(FORMAT, PARAM ) +#endif + +extern void msg(const char *fmt, ...) PRINTFLIKE(1,2); +extern void warn(const char *file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); +extern void va_warn(const char* file, int line, const char* fmt, va_list args); extern void warn_simple(const char *file,int line,const char *text); -extern void warn_undoc(const char *file,int line,const char *fmt, ...); -extern void warn_doc_error(const char *file,int line,const char *fmt, ...); -extern void warn_uncond(const char *fmt, ...); -extern void err(const char *fmt, ...); -extern void err_full(const char *file,int line,const char *fmt, ...); -extern void term(const char *fmt, ...); +extern void warn_undoc(const char *file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); +extern void warn_doc_error(const char *file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); +extern void warn_uncond(const char *fmt, ...) PRINTFLIKE(1, 2); +extern void err(const char *fmt, ...) PRINTFLIKE(1, 2); +extern void err_full(const char *file,int line,const char *fmt, ...) PRINTFLIKE(3, 4); +extern void term(const char *fmt, ...) PRINTFLIKE(1, 2); void initWarningFormat(); extern void printlex(int dbg, bool enter, const char *lexName, const char *fileName); + +#undef PRINTFLIKE + #endif diff --git a/src/namespacedef.h b/src/namespacedef.h index 3be54f2..a35f0b1 100644 --- a/src/namespacedef.h +++ b/src/namespacedef.h @@ -146,7 +146,7 @@ class NamespaceListIterator : public QListIterator<NamespaceDef> class NamespaceDict : public QDict<NamespaceDef> { public: - NamespaceDict(int size) : QDict<NamespaceDef>(size) {} + NamespaceDict(uint size) : QDict<NamespaceDef>(size) {} ~NamespaceDict() {} }; @@ -154,7 +154,7 @@ class NamespaceDict : public QDict<NamespaceDef> class NamespaceSDict : public SDict<NamespaceDef> { public: - NamespaceSDict(int size=17) : SDict<NamespaceDef>(size) {} + NamespaceSDict(uint size=17) : SDict<NamespaceDef>(size) {} ~NamespaceSDict() {} void writeDeclaration(OutputList &ol,const char *title, bool isConstantGroup=false, bool localName=FALSE); diff --git a/src/objcache.cpp b/src/objcache.cpp deleted file mode 100644 index a5180d6..0000000 --- a/src/objcache.cpp +++ /dev/null @@ -1,329 +0,0 @@ -/****************************************************************************** - * - * - * - * Copyright (C) 1997-2015 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. - * - */ - -#include <stdio.h> -#include <assert.h> -#include <qglobal.h> -#include "objcache.h" -#if !defined(_OS_WIN32_) || defined(__MINGW32__) -#include <stdint.h> -#endif - -//---------------------------------------------------------------------- - -ObjCache::ObjCache(unsigned int logSize) - : m_head(-1), m_tail(-1), //m_numEntries(0), - m_size(1<<logSize), m_count(0), m_freeHashNodes(0), m_freeCacheNodes(0), - m_lastHandle(-1) -{ - int i; - m_cache = new CacheNode[m_size]; - m_hash = new HashNode[m_size]; - // add all items to list of free buckets - for (i=0;i<m_size-1;i++) - { - m_hash[i].nextHash = i+1; - m_cache[i].next = i+1; - } - m_misses = 0; - m_hits = 0; -} - -ObjCache::~ObjCache() -{ - delete[] m_cache; - delete[] m_hash; -} - -int ObjCache::add(void *obj,void **victim) -{ - *victim=0; - - HashNode *hnode = hashFind(obj); - //printf("hnode=%p\n",hnode); - if (hnode) // move object to the front of the LRU list, since it is used - // most recently - { - //printf("moveToFront=%d\n",hnode->index); - moveToFront(hnode->index); - m_hits++; - } - else // object not in the cache. - { - void *lruObj=0; - if (m_freeCacheNodes!=-1) // cache not full -> add element to the cache - { - // remove element from free list - int index = m_freeCacheNodes; - m_freeCacheNodes = m_cache[index].next; - - // add to head of the list - if (m_tail==-1) - { - m_tail = index; - } - m_cache[index].prev = -1; - m_cache[index].next = m_head; - if (m_head!=-1) - { - m_cache[m_head].prev = index; - } - m_head = index; - m_count++; - } - else // cache full -> replace element in the cache - { - //printf("Cache full!\n"); - lruObj = m_cache[m_tail].obj; - hashRemove(lruObj); - moveToFront(m_tail); // m_tail indexes the emptied element, which becomes m_head - } - //printf("numEntries=%d size=%d\n",m_numEntries,m_size); - m_cache[m_head].obj = obj; - hnode = hashInsert(obj); - hnode->index = m_head; - *victim = lruObj; - m_misses++; - } - return m_head; -} - -void ObjCache::del(int index) -{ - assert(index!=-1); - assert(m_cache[index].obj!=0); - hashRemove(m_cache[index].obj); - moveToFront(index); - m_head = m_cache[index].next; - if (m_head==-1) - m_tail=-1; - else - m_cache[m_head].prev=-1; - m_cache[index].obj=0; - m_cache[index].prev=-1; - m_cache[index].next = m_freeCacheNodes; - m_freeCacheNodes = index; - m_count--; -} - -#ifdef CACHE_DEBUG -#define cache_debug_printf printf -void ObjCache::printLRU() -{ - cache_debug_printf("MRU->LRU: "); - int index = m_head; - while (index!=-1) - { - cache_debug_printf("%d=%p ",index,m_cache[index].obj); - index = m_cache[index].next; - } - cache_debug_printf("\n"); - - cache_debug_printf("LRU->MRU: "); - index = m_tail; - while (index!=-1) - { - cache_debug_printf("%d=%p ",index,m_cache[index].obj); - index = m_cache[index].prev; - } - cache_debug_printf("\n"); -} -#endif - -#ifdef CACHE_STATS -#define cache_stats_printf printf -void ObjCache::printStats() -{ - cache_stats_printf("ObjCache: hits=%d misses=%d hit ratio=%f\n",m_hits,m_misses,m_hits*100.0/(m_hits+m_misses)); -} -#endif - -void ObjCache::moveToFront(int index) -{ - int prev,next; - if (m_head!=index) - { - next = m_cache[index].next; - prev = m_cache[index].prev; - - // de-chain node at index - m_cache[prev].next = next; - if (next!=-1) m_cache[next].prev = prev; else m_tail = prev; - - // add to head - m_cache[index].prev = -1; - m_cache[index].next = m_head; - m_cache[m_head].prev = index; - m_head = index; - } -} - -unsigned int ObjCache::hash(void *addr) -{ - static bool isPtr64 = sizeof(addr)==8; - if (isPtr64) - { - uint64 key = (uint64)addr; - // Thomas Wang's 64 bit Mix Function - key += ~(key << 32); - key ^= (key >> 22); - key += ~(key << 13); - key ^= (key >> 8); - key += (key << 3); - key ^= (key >> 15); - key += ~(key << 27); - key ^= (key >> 31); - return (unsigned int)(key & (m_size-1)); - } - else - { - // Thomas Wang's 32 bit Mix Function - uintptr_t key = (uintptr_t)addr; - key += ~(key << 15); - key ^= (key >> 10); - key += (key << 3); - key ^= (key >> 6); - key += ~(key << 11); - key ^= (key >> 16); - return (unsigned int)(key & (m_size-1)); - } -} - -ObjCache::HashNode *ObjCache::hashFind(void *obj) -{ - HashNode *node = 0; - int index = m_hash[hash(obj)].head; - //printf("hashFind: obj=%p index=%d\n",obj,index); - while (index!=-1 && - m_hash[index].obj!=obj - ) // search for right object in the list - { - index = m_hash[index].nextHash; - } - // found the obj at index, so it is in the cache! - if (index!=-1) - { - node = &m_hash[index]; - } - return node; -} - -ObjCache::HashNode *ObjCache::hashInsert(void *obj) -{ - int index = hash(obj); - //printf("Inserting %p index=%d\n",obj,index); - - // remove element from empty list - int newElement = m_freeHashNodes; - assert(newElement!=-1); - m_freeHashNodes = m_hash[m_freeHashNodes].nextHash; - - if (m_hash[index].head!=-1) // hash collision -> goto end of the list - { - index = m_hash[index].head; - while (m_hash[index].nextHash!=-1) - { - index = m_hash[index].nextHash; - } - // add to end of the list - m_hash[index].nextHash = newElement; - } - else // first element in the hash list - { - m_hash[index].head = newElement; - } - // add to the end of the list - m_hash[newElement].nextHash = -1; - m_hash[newElement].obj = obj; - return &m_hash[newElement]; -} - -void ObjCache::hashRemove(void *obj) -{ - int index = hash(obj); - - // find element - int curIndex = m_hash[index].head; - int prevIndex=-1; - while (m_hash[curIndex].obj!=obj) - { - prevIndex = curIndex; - curIndex = m_hash[curIndex].nextHash; - } - - if (prevIndex==-1) // remove from start - { - m_hash[index].head = m_hash[curIndex].nextHash; - } - else // remove in the middle - { - m_hash[prevIndex].nextHash = m_hash[curIndex].nextHash; - } - - // add curIndex element to empty list - m_hash[curIndex].nextHash = m_freeHashNodes; - m_hash[curIndex].index = -1; - m_hash[curIndex].obj = 0; - m_freeHashNodes = curIndex; -} - -#ifdef CACHE_TEST -int main() -{ - int i; - struct obj - { - obj() : handle(-1) {} - int handle; - }; - obj *objs = new obj[100]; - ObjCache c(3); - for (i=0;i<32;i++) - { - int objId=(i%3)+(i>>2)*4; - printf("------- use(%d=%p)--------\n",objId,&objs[objId]); -#ifdef CACHE_DEBUG - c.printLRU(); -#endif - obj *victim=0; - if (objs[objId].handle==-1) - { - objs[objId].handle = c.add(&objs[objId],(void**)&victim); - if (victim) victim->handle=-1; - } - else - { - c.use(objs[objId].handle); - } - printf("i=%d objId=%d using %p victim=%p\n",i,objId,&objs[objId],victim); - } - for (i=0;i<100;i++) - { - if (objs[i].handle!=-1) - { - printf("------ del objId=%d handle=%d ------\n",i,objs[i].handle); - c.del(objs[i].handle); - objs[i].handle=-1; -#ifdef CACHE_DEBUG - c.printLRU(); -#endif - } - } - c.printStats(); - return 0; -} -#endif diff --git a/src/objcache.h b/src/objcache.h deleted file mode 100644 index 224b34b..0000000 --- a/src/objcache.h +++ /dev/null @@ -1,127 +0,0 @@ -/****************************************************************************** - * - * - * - * Copyright (C) 1997-2015 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 OBJCACHE_H -#define OBJCACHE_H - -//#define CACHE_TEST -//#define CACHE_DEBUG -#define CACHE_STATS - -/** @brief Cache for objects. - * - * This cache is used to decide which objects should remain in - * memory. It uses a least recently used policy (LRU) to decide - * which object should make room for a new object when the cache - * is full. An object should be added using add(), and then use() - * should be called when the object is used. - */ -class ObjCache -{ - private: - struct CacheNode - { - CacheNode() : next(-1), prev(-1), obj(0) {} - int next; - int prev; - void *obj; - }; - struct HashNode - { - HashNode() : head(-1), nextHash(-1), index(-1), obj(0) {} - int head; - int nextHash; - int index; - void *obj; - }; - - public: - /*! Creates the cache. The number of elements in the cache is 2 to - * the power of \a logSize. - */ - ObjCache(unsigned int logSize); - - /*! Deletes the cache and free all internal data-structures used. */ - ~ObjCache(); - - /*! Adds \a obj to the cache. When victim is not null, this object is - * removed from the cache to make room for \a obj. - * Returns a handle to the object, which can be used by the use() - * function, each time the object is used. - */ - int add(void *obj,void **victim); - - /*! Indicates that this object is used. This will move the object - * to the front of the internal LRU list to make sure it is removed last. - * The parameter \a handle is returned when called add(). - */ - void use(int handle) - { - if (handle==m_lastHandle) return; - m_lastHandle = handle; - m_hits++; - moveToFront(handle); - } - - /*! Removes the item identified by \a handle from the cache. - * @see add() - */ - void del(int handle); - - /*! Debug function. Prints the LRU list */ - void printLRU(); - /*! Print miss/hits statistics */ - void printStats(); - - /*! total size of the cache */ - int size() const { return m_size; } - - /*! number of elements in the cache */ - int count() const { return m_count; } - - int hits() const - { - return m_hits; - } - int misses() const - { - return m_misses; - } - - - private: - void moveToFront(int index); - unsigned int hash(void *addr); - HashNode *hashFind(void *obj); - HashNode *hashInsert(void *obj); - void hashRemove(void *obj); - - CacheNode *m_cache; - HashNode *m_hash; - int m_head; - int m_tail; - int m_size; - int m_count; - int m_freeHashNodes; - int m_freeCacheNodes; - int m_lastHandle; - int m_misses; - int m_hits; -}; - -#endif // OBJCACHE_H - diff --git a/src/outputgen.h b/src/outputgen.h index 2b4da98..009225f 100644 --- a/src/outputgen.h +++ b/src/outputgen.h @@ -150,7 +150,7 @@ class BaseOutputDocInterface : public CodeOutputInterface Examples }; - virtual void parseText(const QCString &s) {} + virtual void parseText(const QCString &) {} /*! Start of a bullet list: e.g. \c \<ul\> in html. startItemListItem() is * Used for the bullet items. @@ -447,8 +447,8 @@ class OutputGenerator : public BaseOutputDocInterface virtual void writeSummaryLink(const char *file,const char *anchor,const char *title,bool first) = 0; virtual void startContents() = 0; virtual void endContents() = 0; - virtual void startPageDoc(const char *pageTitle) {}; - virtual void endPageDoc() {}; + virtual void startPageDoc(const char *) {} + virtual void endPageDoc() {} virtual void startTextBlock(bool) = 0; virtual void endTextBlock(bool) = 0; virtual void lastIndexPage() = 0; diff --git a/src/pagedef.cpp b/src/pagedef.cpp index 3f96a4b..15d6ca8 100644 --- a/src/pagedef.cpp +++ b/src/pagedef.cpp @@ -47,7 +47,7 @@ class PageDefImpl : public DefinitionImpl, public PageDef virtual QCString title() const { return m_title; } virtual GroupDef * getGroupDef() const; virtual PageSDict * getSubPages() const { return m_subPageDict; } - virtual void addInnerCompound(Definition *d); + virtual void addInnerCompound(const Definition *d); virtual bool visibleInIndex() const; virtual bool documentedPage() const; virtual bool hasSubPages() const; @@ -121,10 +121,11 @@ void PageDefImpl::setFileName(const char *name) m_fileName = name; } -void PageDefImpl::addInnerCompound(Definition *def) +void PageDefImpl::addInnerCompound(const Definition *const_def) { - if (def->definitionType()==Definition::TypePage) + if (const_def->definitionType()==Definition::TypePage) { + Definition *def = const_cast<Definition*>(const_def); // uck: fix me PageDef *pd = dynamic_cast<PageDef*>(def); m_subPageDict->append(pd->name(),pd); def->setOuterScope(this); diff --git a/src/pagedef.h b/src/pagedef.h index f0b68d1..e4d0268 100644 --- a/src/pagedef.h +++ b/src/pagedef.h @@ -46,22 +46,22 @@ class PageDef : virtual public Definition virtual QCString title() const = 0; virtual GroupDef * getGroupDef() const = 0; virtual PageSDict * getSubPages() const = 0; - virtual void addInnerCompound(Definition *d) = 0; + virtual void addInnerCompound(const Definition *) = 0; virtual bool visibleInIndex() const = 0; virtual bool documentedPage() const = 0; virtual bool hasSubPages() const = 0; virtual bool hasParentPage() const = 0; virtual bool hasTitle() const = 0; virtual LocalToc localToc() const = 0; - virtual void setPageScope(Definition *d) = 0; + virtual void setPageScope(Definition *) = 0; virtual Definition *getPageScope() const = 0; virtual QCString displayName(bool=TRUE) const = 0; virtual bool showLineNo() const = 0; - virtual void writeDocumentation(OutputList &ol) = 0; + virtual void writeDocumentation(OutputList &) = 0; virtual void writeTagFile(FTextStream &) = 0; - virtual void setNestingLevel(int l) = 0; - virtual void writePageDocumentation(OutputList &ol) = 0; + virtual void setNestingLevel(int) = 0; + virtual void writePageDocumentation(OutputList &) = 0; }; @@ -70,7 +70,7 @@ PageDef *createPageDef(const char *f,int l,const char *n,const char *d,const cha class PageSDict : public SDict<PageDef> { public: - PageSDict(int size) : SDict<PageDef>(size) {} + PageSDict(uint size) : SDict<PageDef>(size) {} virtual ~PageSDict() {} private: int compareValues(const PageDef *i1,const PageDef *i2) const diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp index c19d7c4..0183cdc 100644 --- a/src/perlmodgen.cpp +++ b/src/perlmodgen.cpp @@ -92,7 +92,7 @@ void PerlModOutputStream::add(int n) if (m_t != 0) (*m_t) << n; else - m_s += n; + m_s += QCString().setNum(n); } void PerlModOutputStream::add(unsigned int n) @@ -100,7 +100,7 @@ void PerlModOutputStream::add(unsigned int n) if (m_t != 0) (*m_t) << n; else - m_s += n; + m_s += QCString().setNum(n); } class PerlModOutput @@ -779,7 +779,7 @@ void PerlModDocVisitor::visit(DocFormula *f) { openItem("formula"); QCString id; - id += f->id(); + id += QCString().setNum(f->id()); m_output.addFieldQuotedString("id", id).addFieldQuotedString("content", f->text()); closeItem(); } @@ -1761,9 +1761,9 @@ void PerlModGenerator::addListOfAllMembers(const ClassDef *cd) for (mii.toFirst();(mi=mii.current());++mii) { const MemberDef *md=mi->memberDef; - const ClassDef *cd=md->getClassDef(); + const ClassDef *mcd=md->getClassDef(); const Definition *d=md->getGroupDef(); - if (d==0) d = cd; + if (d==0) d = mcd; m_output.openHash() .addFieldQuotedString("name", md->name()) @@ -1773,7 +1773,7 @@ void PerlModGenerator::addListOfAllMembers(const ClassDef *cd) if (!mi->ambiguityResolutionScope.isEmpty()) m_output.addFieldQuotedString("ambiguity_scope", mi->ambiguityResolutionScope); - m_output.addFieldQuotedString("scope", cd->name()) + m_output.addFieldQuotedString("scope", mcd->name()) .closeHash(); } } @@ -1871,10 +1871,10 @@ void PerlModGenerator::generatePerlModForClass(const ClassDef *cd) { m_output.openList("inner"); ClassSDict::Iterator cli(*cl); - const ClassDef *cd; - for (cli.toFirst();(cd=cli.current());++cli) + const ClassDef *icd; + for (cli.toFirst();(icd=cli.current());++cli) m_output.openHash() - .addFieldQuotedString("name", cd->name()) + .addFieldQuotedString("name", icd->name()) .closeHash(); m_output.closeList(); } @@ -1991,10 +1991,10 @@ void PerlModGenerator::generatePerlModForNamespace(const NamespaceDef *nd) { m_output.openList("namespaces"); NamespaceSDict::Iterator nli(*nl); - const NamespaceDef *nd; - for (nli.toFirst();(nd=nli.current());++nli) + const NamespaceDef *ind; + for (nli.toFirst();(ind=nli.current());++nli) m_output.openHash() - .addFieldQuotedString("name", nd->name()) + .addFieldQuotedString("name", ind->name()) .closeHash(); m_output.closeList(); } diff --git a/src/plantuml.cpp b/src/plantuml.cpp index 7d60e32..7995883 100644 --- a/src/plantuml.cpp +++ b/src/plantuml.cpp @@ -299,12 +299,12 @@ static void runPlantumlContent(const QDict< QList <QCString> > &plantumlFiles, if (list) { QListIterator<QCString> li(*list); - QCString *nb; - for (li.toFirst();(nb=li.current());++li) + QCString *str_p; + for (li.toFirst();(str_p=li.current());++li) { const int maxCmdLine = 40960; QCString epstopdfArgs(maxCmdLine); - epstopdfArgs.sprintf("\"%s%s.eps\" --outfile=\"%s%s.pdf\"",qPrint(pumlOutDir),qPrint(*nb),qPrint(pumlOutDir),qPrint(*nb)); + epstopdfArgs.sprintf("\"%s%s.eps\" --outfile=\"%s%s.pdf\"",qPrint(pumlOutDir),qPrint(*str_p),qPrint(pumlOutDir),qPrint(*str_p)); Portable::sysTimerStart(); if ((exitCode=Portable::system("epstopdf",epstopdfArgs))!=0) { diff --git a/src/portable.cpp b/src/portable.cpp index 8c941b6..d3799c7 100644 --- a/src/portable.cpp +++ b/src/portable.cpp @@ -207,11 +207,6 @@ unsigned int Portable::pid(void) return pid; } -#if defined(_WIN32) && !defined(__CYGWIN__) -#else - static char **last_environ; -#endif - #if !defined(_WIN32) || defined(__CYGWIN__) void loadEnvironment() { @@ -261,9 +256,6 @@ void Portable::unsetenv(const char *variable) SetEnvironmentVariable(variable,0); #else /* Some systems don't have unsetenv(), so we do it ourselves */ - size_t len; - char **ep; - if (variable == NULL || *variable == '\0' || strchr (variable, '=') != NULL) { return; // not properly formatted @@ -348,7 +340,7 @@ char Portable::pathListSeparator(void) #endif } -static const bool ExistsOnPath(const char *fileName) +static bool ExistsOnPath(const char *fileName) { QFileInfo fi1(fileName); if (fi1.exists()) return true; @@ -380,7 +372,7 @@ static const bool ExistsOnPath(const char *fileName) return false; } -const bool Portable::checkForExecutable(const char *fileName) +bool Portable::checkForExecutable(const char *fileName) { #if defined(_WIN32) && !defined(__CYGWIN__) char *extensions[] = {".bat",".com",".exe"}; diff --git a/src/portable.h b/src/portable.h index 6c215a8..bf6cfea 100644 --- a/src/portable.h +++ b/src/portable.h @@ -44,7 +44,7 @@ namespace Portable void setShortDir(void); const char * strnstr(const char *haystack, const char *needle, size_t haystack_len); const char * devNull(); - const bool checkForExecutable(const char *fileName); + bool checkForExecutable(const char *fileName); } @@ -63,11 +63,15 @@ #define YY_NO_UNISTD_H 1 +#define USE_STATE2STRING 0 + // Toggle for some debugging info //#define DBG_CTX(x) fprintf x #define DBG_CTX(x) do { } while(0) +#if USE_STATE2STRING static const char *stateToString(int state); +#endif struct CondCtx { @@ -86,7 +90,7 @@ struct FileState int curlyCount; BufStr fileBuf; BufStr *oldFileBuf; - int oldFileBufPos; + yy_size_t oldFileBufPos; YY_BUFFER_STATE bufState; QCString fileName; }; @@ -350,9 +354,9 @@ struct preYY_state int level; int lastCContext; int lastCPPContext; - QArray<int> levelGuard; + QArray<bool> levelGuard; BufStr *inputBuf = 0; - int inputBufPos; + yy_size_t inputBufPos; BufStr *outputBuf = 0; int roundCount; bool quoteArg; @@ -379,7 +383,7 @@ struct preYY_state bool insideFtn; bool isSource; - int fenceSize = 0; + yy_size_t fenceSize = 0; bool ccomment; QCString delimiter; QDict<void> allIncludes; @@ -408,7 +412,7 @@ static void endCondSection(yyscan_t yyscanner); static void addDefine(yyscan_t yyscanner); static Define * newDefine(yyscan_t yyscanner); static void setFileName(yyscan_t yyscanner,const char *name); -static int yyread(yyscan_t yyscanner,char *buf,int max_size); +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); /* ----------------------------------------------------------------- */ @@ -1393,14 +1397,14 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) } <SkipVerbatim>^({B}*"*"+)?{B}{0,3}"~~~"[~]* { outputArray(yyscanner,yytext,(int)yyleng); - if (yyextra->fenceSize==yyleng) + if (yyextra->fenceSize==(yy_size_t)yyleng) { BEGIN(SkipCComment); } } <SkipVerbatim>^({B}*"*"+)?{B}{0,3}"```"[`]* { outputArray(yyscanner,yytext,(int)yyleng); - if (yyextra->fenceSize==yyleng) + if (yyextra->fenceSize==(yy_size_t)yyleng) { BEGIN(SkipCComment); } @@ -1632,7 +1636,7 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) //preYYin = fs->oldYYin; yyextra->inputBuf = fs->oldFileBuf; yyextra->inputBufPos = fs->oldFileBufPos; - yyextra->curlyCount = fs->curlyCount; + yyextra->curlyCount = fs->curlyCount; setFileName(yyscanner,fs->fileName); DBG_CTX((stderr,"######## FileName %s\n",yyextra->yyFileName.data())); @@ -1686,11 +1690,11 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'")) ///////////////////////////////////////////////////////////////////////////////////// -static int yyread(yyscan_t yyscanner,char *buf,int max_size) +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size) { YY_EXTRA_TYPE state = preYYget_extra(yyscanner); - int bytesInBuf = state->inputBuf->curPos()-state->inputBufPos; - int bytesToCopy = QMIN(max_size,bytesInBuf); + yy_size_t bytesInBuf = state->inputBuf->curPos()-state->inputBufPos; + yy_size_t bytesToCopy = QMIN(max_size,bytesInBuf); memcpy(buf,state->inputBuf->data()+state->inputBufPos,bytesToCopy); state->inputBufPos+=bytesToCopy; return bytesToCopy; @@ -1994,7 +1998,7 @@ static QCString stringize(const QCString &s) pc=0; while (i<s.length() && inString) { - char c=s.at(i++); + c=s.at(i++); if (c=='"') { result+="\\\""; @@ -2087,7 +2091,7 @@ static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCStrin } if (cc!='(') { - unputChar(yyscanner,expr,rest,j,cc); + unputChar(yyscanner,expr,rest,j,(char)cc); return FALSE; } getNextChar(yyscanner,expr,rest,j); // eat the '(' character @@ -2116,12 +2120,12 @@ static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCStrin char c=(char)cc; if (c=='(') // argument is a function => search for matching ) { - int level=1; + int lvl=1; arg+=c; //char term='\0'; while ((cc=getNextChar(yyscanner,expr,rest,j))!=EOF && cc!=0) { - char c=(char)cc; + c=(char)cc; //printf("processing %c: term=%c (%d)\n",c,term,term); if (c=='\'' || c=='\"') // skip ('s and )'s inside strings { @@ -2130,13 +2134,13 @@ static bool replaceFunctionMacro(yyscan_t yyscanner,const QCString &expr,QCStrin } if (c==')') { - level--; + lvl--; arg+=c; - if (level==0) break; + if (lvl==0) break; } else if (c=='(') { - level++; + lvl++; arg+=c; } else @@ -2673,7 +2677,7 @@ static QCString removeIdsAndMarkers(const char *s) { nextChar: result+=c; - char lc=tolower(c); + char lc=(char)tolower(c); if (!isId(lc) && lc!='.' /*&& lc!='-' && lc!='+'*/) inNum=FALSE; p++; } @@ -2926,23 +2930,23 @@ static void readIncludeFile(yyscan_t yyscanner,const QCString &inc) else if (searchIncludes) // search in INCLUDE_PATH as well { QStrList &includePath = Config_getList(INCLUDE_PATH); - char *s=includePath.first(); - while (s) + char *incPath=includePath.first(); + while (incPath) { - QFileInfo fi(s); - if (fi.exists() && fi.isDir()) + QFileInfo fi3(incPath); + if (fi3.exists() && fi3.isDir()) { - QCString absName = QCString(fi.absFilePath().utf8())+"/"+incFileName; + absName = QCString(fi3.absFilePath().utf8())+"/"+incFileName; //printf("trying absName=%s\n",absName.data()); - QFileInfo fi2(absName); - if (fi2.exists()) + QFileInfo fi4(absName); + if (fi4.exists()) { - absIncFileName=fi2.absFilePath().utf8(); + absIncFileName=fi4.absFilePath().utf8(); break; } //printf( "absIncFileName = %s\n", absIncFileName.data() ); } - s=includePath.next(); + incPath=includePath.next(); } } //printf( "absIncFileName = %s\n", absIncFileName.data() ); @@ -3172,8 +3176,7 @@ static int getCurrentChar(yyscan_t yyscanner,const QCString &expr,QCString *rest else { int cc=yyinput(yyscanner); - returnCharToStream(yyscanner,cc); - //unput((char)cc); + returnCharToStream(yyscanner,(char)cc); //printf("%c=yyinput()\n",cc); return cc; } @@ -3299,14 +3302,14 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output QRegExp reId("[a-z_A-Z\x80-\xFF][a-z_A-Z0-9\x80-\xFF]*"); // regexp matching an id QDict<int> argDict(17); argDict.setAutoDelete(TRUE); - int i=i_obrace+1,p,l,count=0; + int i=i_obrace+1,pi,l,count=0; // gather the formal arguments in a dictionary - while (i<i_cbrace && (p=reId.match(ds,i,&l))) + while (i<i_cbrace && (pi=reId.match(ds,i,&l))) { if (l>0) // see bug375037 { - argDict.insert(ds.mid(p,l),new int(count++)); - i=p+l; + argDict.insert(ds.mid(pi,l),new int(count++)); + i=pi+l; } else { @@ -3319,11 +3322,11 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output i=0; // substitute all occurrences of formal arguments by their // corresponding markers - while ((p=reId.match(tmp,i,&l))!=-1) + while ((pi=reId.match(tmp,i,&l))!=-1) { - if (p>i) definition+=tmp.mid(i,p-i); + if (pi>i) definition+=tmp.mid(i,pi-i); int *argIndex; - if ((argIndex=argDict[tmp.mid(p,l)])!=0) + if ((argIndex=argDict[tmp.mid(pi,l)])!=0) { QCString marker; marker.sprintf(" @%d ",*argIndex); @@ -3331,9 +3334,9 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output } else { - definition+=tmp.mid(p,l); + definition+=tmp.mid(pi,l); } - i=p+l; + i=pi+l; } if (i<(int)tmp.length()) definition+=tmp.mid(i,tmp.length()-i); @@ -3468,5 +3471,6 @@ void Preprocessor::processFile(const char *fileName,BufStr &input,BufStr &output printlex(yy_flex_debug, FALSE, __FILE__, fileName); } - +#if USE_STATE2STRING #include "pre.l.h" +#endif diff --git a/src/pycode.l b/src/pycode.l index 970c221..8cb85a3 100644 --- a/src/pycode.l +++ b/src/pycode.l @@ -23,6 +23,7 @@ %option never-interactive %option prefix="pycodeYY" +%option noyy_top_state %top{ #include <stdint.h> } @@ -56,6 +57,8 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 +#define USE_STATE2STRING 0 + static ClassSDict g_codeClassSDict(17); static QCString g_curClassName; static QStrList g_curClassBases; @@ -100,7 +103,10 @@ static bool g_endComment; static void endFontClass(); static void adjustScopesAndSuites(unsigned indentLength); + +#if USE_STATE2STRING static const char *stateToString(int state); +#endif /*! Represents a stack of variable to class mappings as found in the @@ -688,19 +694,19 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName, DBG_CTX((stderr,"scope=%s locName=%s mcd=%p\n",scope.data(),locName.data(),mcd)); if (mcd) { - MemberDef *md = mcd->getMemberByName(locName); - if (md) + MemberDef *mmd = mcd->getMemberByName(locName); + if (mmd) { - g_theCallContext.setClass(stripClassName(md->typeString(),md->getOuterScope())); - writeMultiLineCodeLink(ol,md,clName); + g_theCallContext.setClass(stripClassName(mmd->typeString(),mmd->getOuterScope())); + writeMultiLineCodeLink(ol,mmd,clName); addToSearchIndex(className); - const Definition *d = md->getOuterScope()==Doxygen::globalScope ? - md->getBodyDef() : md->getOuterScope(); - if (md->getGroupDef()) d = md->getGroupDef(); - if (d && d->isLinkable() && md->isLinkable() && + const Definition *d = mmd->getOuterScope()==Doxygen::globalScope ? + mmd->getBodyDef() : mmd->getOuterScope(); + if (mmd->getGroupDef()) d = mmd->getGroupDef(); + if (d && d->isLinkable() && mmd->isLinkable() && g_currentMemberDef && g_collectXRefs) { - addDocCrossReference(g_currentMemberDef,md); + addDocCrossReference(g_currentMemberDef,mmd); } return; } @@ -710,20 +716,20 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,char *clName, const NamespaceDef *mnd = getResolvedNamespace(scope); if (mnd) { - MemberDef *md=mnd->getMemberByName(locName); - if (md) + MemberDef *mmd=mnd->getMemberByName(locName); + if (mmd) { //printf("name=%s scope=%s\n",locName.data(),scope.data()); - g_theCallContext.setClass(stripClassName(md->typeString(),md->getOuterScope())); - writeMultiLineCodeLink(ol,md,clName); + g_theCallContext.setClass(stripClassName(mmd->typeString(),mmd->getOuterScope())); + writeMultiLineCodeLink(ol,mmd,clName); addToSearchIndex(className); - const Definition *d = md->getOuterScope()==Doxygen::globalScope ? - md->getBodyDef() : md->getOuterScope(); - if (md->getGroupDef()) d = md->getGroupDef(); - if (d && d->isLinkable() && md->isLinkable() && + const Definition *d = mmd->getOuterScope()==Doxygen::globalScope ? + mmd->getBodyDef() : mmd->getOuterScope(); + if (mmd->getGroupDef()) d = mmd->getGroupDef(); + if (d && d->isLinkable() && mmd->isLinkable() && g_currentMemberDef && g_collectXRefs) { - addDocCrossReference(g_currentMemberDef,md); + addDocCrossReference(g_currentMemberDef,mmd); } return; } @@ -846,9 +852,9 @@ static void findMemberLink(CodeOutputInterface &ol,char *symName) #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); -static int yyread(char *buf,int max_size) +static yy_size_t yyread(char *buf,yy_size_t max_size) { - int c=0; + yy_size_t c=0; while( c < max_size && g_inputString[g_inputPosition] ) { *buf = g_inputString[g_inputPosition++] ; @@ -1669,5 +1675,6 @@ void PythonCodeParser::resetCodeParserState() ::resetPythonCodeParserState(); } - +#if USE_STATE2STRING #include "pycode.l.h" +#endif diff --git a/src/pyscanner.l b/src/pyscanner.l index 0abaae1..15e1040 100644 --- a/src/pyscanner.l +++ b/src/pyscanner.l @@ -64,6 +64,8 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 +#define USE_STATE2STRING 0 + /* ----------------------------------------------------------------- */ struct pyscannerYY_state @@ -72,7 +74,7 @@ struct pyscannerYY_state CommentScanner commentScanner; OutlineParserInterface *thisParser = 0; const char * inputString = 0; - int inputPosition = 0; + yy_size_t inputPosition = 0; Protection protection = Public; std::shared_ptr<Entry> current_root; std::shared_ptr<Entry> current; @@ -113,7 +115,9 @@ struct pyscannerYY_state }; //----------------------------------------------------------------------------- +#if USE_STATE2STRING static const char *stateToString(int state); +#endif static inline int computeIndent(const char *s); @@ -136,7 +140,8 @@ static void initSpecialBlock(yyscan_t yyscanner); static void searchFoundDef(yyscan_t yyscanner); static void searchFoundClass(yyscan_t yyscanner); static QCString findPackageScope(yyscan_t yyscanner,const char *fileName); -static int yyread(yyscan_t yyscanner,char *buf,int max_size); + +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); //----------------------------------------------------------------------------- /* ----------------------------------------------------------------- */ @@ -1437,10 +1442,10 @@ STARTDOCSYMS "##" //---------------------------------------------------------------------------- -static int yyread(yyscan_t yyscanner,char *buf,int max_size) +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - int c=0; + yy_size_t c=0; const char *p = yyextra->inputString + yyextra->inputPosition; while ( c < max_size && *p ) { *buf++ = *p++; c++; } yyextra->inputPosition+=c; @@ -1740,7 +1745,7 @@ static void parseCompounds(yyscan_t yyscanner,std::shared_ptr<Entry> rt) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; //printf("parseCompounds(%s)\n",rt->name.data()); - for (int i=0; i<rt->children().size(); ++i) + for (size_t i=0; i<rt->children().size(); ++i) { std::shared_ptr<Entry> ce = rt->children()[i]; if (!ce->program.isEmpty()) @@ -1865,7 +1870,7 @@ static void parsePrototype(yyscan_t yyscanner,const QCString &text) yyextra->packageCommentAllowed = FALSE; const char *orgInputString; - int orgInputPosition; + yy_size_t orgInputPosition; YY_BUFFER_STATE orgState; // save scanner state @@ -1951,4 +1956,6 @@ void PythonOutlineParser::parsePrototype(const char *text) //---------------------------------------------------------------------------- +#if USE_STATE2STRING #include "pyscanner.l.h" +#endif diff --git a/src/resourcemgr.cpp b/src/resourcemgr.cpp index 8cb831e..4ba3388 100644 --- a/src/resourcemgr.cpp +++ b/src/resourcemgr.cpp @@ -97,14 +97,14 @@ bool ResourceMgr::copyResourceAs(const char *name,const char *targetDir,const ch { QCString n = name; n = n.left(n.length()-4)+".png"; // replace .lum by .png - uchar *p = (uchar*)res->data; - int width = (p[0]<<8)+p[1]; - int height = (p[2]<<8)+p[3]; + uchar *data = (uchar*)res->data; + ushort width = (data[0]<<8)+data[1]; + ushort height = (data[2]<<8)+data[3]; ColoredImgDataItem images[2]; images[0].name = n; images[0].width = width; images[0].height = height; - images[0].content = &p[4]; + images[0].content = &data[4]; images[0].alpha = 0; images[1].name = 0; // terminator writeColoredImgData(targetDir,images); @@ -115,15 +115,15 @@ bool ResourceMgr::copyResourceAs(const char *name,const char *targetDir,const ch { QCString n = name; n = n.left(n.length()-5)+".png"; // replace .luma by .png - uchar *p = (uchar*)res->data; - int width = (p[0]<<8)+p[1]; - int height = (p[2]<<8)+p[3]; + uchar *data = (uchar*)res->data; + ushort width = (data[0]<<8)+data[1]; + ushort height = (data[2]<<8)+data[3]; ColoredImgDataItem images[2]; images[0].name = n; images[0].width = width; images[0].height = height; - images[0].content = &p[4]; - images[0].alpha = &p[4+width*height]; + images[0].content = &data[4]; + images[0].alpha = &data[4+width*height]; images[1].name = 0; // terminator writeColoredImgData(targetDir,images); return TRUE; @@ -144,7 +144,7 @@ bool ResourceMgr::copyResourceAs(const char *name,const char *targetDir,const ch } else { - t << substitute(buf,"$doxygenversion",getVersion()); + t << substitute(buf,"$doxygenversion",getDoxygenVersion()); } return TRUE; } diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index e1a9e31..f9b30f7 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -1107,14 +1107,30 @@ void RTFDocVisitor::visitPre(DocHRef *href) DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocHRef)}\n"); if (Config_getBool(RTF_HYPERLINKS)) { - m_t << "{\\field " - "{\\*\\fldinst " - "{ HYPERLINK \"" << href->url() << "\" " - "}{}" - "}" - "{\\fldrslt " - "{\\cs37\\ul\\cf2 "; - + if (href->url().startsWith("#CITEREF")) + { + // when starting with #CITEREF it is a doxygen generated "url"a + // so a local link + QCString cite; + cite = "citelist_" + href->url().right(href->url().length()-1); + m_t << "{\\field " + "{\\*\\fldinst " + "{ HYPERLINK \\\\l \"" << rtfFormatBmkStr(cite) << "\" " + "}{}" + "}" + "{\\fldrslt " + "{\\cs37\\ul\\cf2 "; + } + else + { + m_t << "{\\field " + "{\\*\\fldinst " + "{ HYPERLINK \"" << href->url() << "\" " + "}{}" + "}" + "{\\fldrslt " + "{\\cs37\\ul\\cf2 "; + } } else { @@ -1621,7 +1637,7 @@ void RTFDocVisitor::visitPre(DocXRefItem *x) m_t << "{\\field " "{\\*\\fldinst " - "{ HYPERLINK \\\\l \"" << refName << "\" " + "{ HYPERLINK \\\\l \"" << rtfFormatBmkStr(refName) << "\" " "}{}" "}" "{\\fldrslt " diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index 39741dc..1a11989 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -79,10 +79,20 @@ RTFGenerator::~RTFGenerator() { } +void RTFGenerator::setRelativePath(const QCString &path) +{ + m_relPath = path; +} + +void RTFGenerator::setSourceFileName(const QCString &name) +{ + m_sourceFileName = name; +} + void RTFGenerator::writeStyleSheetFile(QFile &file) { FTextStream t(&file); - t << "# Generated by doxygen " << getVersion() << "\n\n"; + t << "# Generated by doxygen " << getDoxygenVersion() << "\n\n"; t << "# This file describes styles used for generating RTF output.\n"; t << "# All text after a hash (#) is considered a comment and will be ignored.\n"; t << "# Remove a hash to activate a line.\n\n"; @@ -99,7 +109,7 @@ void RTFGenerator::writeStyleSheetFile(QFile &file) void RTFGenerator::writeExtensionsFile(QFile &file) { FTextStream t(&file); - t << "# Generated by doxygen " << getVersion() << "\n\n"; + t << "# Generated by doxygen " << getDoxygenVersion() << "\n\n"; t << "# This file describes extensions used for generating RTF output.\n"; t << "# All text after a hash (#) is considered a comment and will be ignored.\n"; t << "# Remove a hash to activate a line.\n\n"; @@ -273,15 +283,14 @@ void RTFGenerator::beginRTFDocument() // sort styles ascending by \s-number via an intermediate QArray QDictIterator<StyleData> iter(rtf_Style); - const StyleData* style; + const StyleData* style = 0; unsigned maxIndex = 0; for(; (style = iter.current()); ++iter) { unsigned index = style->index; if (maxIndex < index) maxIndex = index; } - QArray<const StyleData*> array(maxIndex + 1); - array.fill(0); + std::vector<const StyleData*> array(maxIndex + 1, 0); ASSERT(maxIndex < array.size()); iter.toFirst(); @@ -297,10 +306,10 @@ void RTFGenerator::beginRTFDocument() } // write array elements - unsigned size = array.size(); - for(unsigned i = 0; i < size; i++) + size_t size = array.size(); + for(size_t i = 0; i < size; i++) { - const StyleData* style = array.at(i); + style = array.at(i); if (style != 0) t <<"{" << style->reference << style->definition << ";}\n"; } @@ -359,6 +368,8 @@ void RTFGenerator::startFile(const char *name,const char *,const char *) if (fileName.right(4)!=".rtf" ) fileName+=".rtf"; startPlainFile(fileName); + setRelativePath(m_relPath); + setSourceFileName(stripPath(fileName)); beginRTFDocument(); } @@ -368,6 +379,7 @@ void RTFGenerator::endFile() t << "}"; endPlainFile(); + setSourceFileName(""); } void RTFGenerator::startProjectNumber() @@ -576,7 +588,7 @@ void RTFGenerator::endIndexSection(IndexSections is) break; case isTitlePageAuthor: { - t << " doxygen.}\n"; + t << " doxygen" << getDoxygenVersion() << ".}\n"; t << "{\\creatim " << dateToRTFDateString() << "}\n}"; DBG_RTF(t << "{\\comment end of infoblock}\n"); // setup for this section @@ -2463,7 +2475,7 @@ static bool preProcessFile(QDir &d,QCString &infName, FTextStream &t, bool bIncl { // null terminate at the last '}' //char *str = strrchr(buffer,'}'); - int pos = lineBuf.findRev('}'); + pos = lineBuf.findRev('}'); if (pos != -1) lineBuf.at(pos) = '\0'; @@ -3025,12 +3037,33 @@ void RTFGenerator::endInlineMemberDoc() t << "\\cell }{\\row }" << endl; } -void RTFGenerator::writeLineNumber(const char *,const char *,const char *,int l) +void RTFGenerator::writeLineNumber(const char *ref,const char *fileName,const char *anchor,int l) { + static bool rtfHyperlinks = Config_getBool(RTF_HYPERLINKS); + DoxyCodeLineOpen = TRUE; QCString lineNumber; lineNumber.sprintf("%05d",l); - t << lineNumber << " "; + if (m_prettyCode) + { + if (fileName && !m_sourceFileName.isEmpty() && rtfHyperlinks) + { + QCString lineAnchor; + lineAnchor.sprintf("_l%05d",l); + lineAnchor.prepend(stripExtensionGeneral(m_sourceFileName, ".rtf")); + t << "{\\bkmkstart "; + t << rtfFormatBmkStr(lineAnchor); + t << "}"; + t << "{\\bkmkend "; + t << rtfFormatBmkStr(lineAnchor); + t << "}" << endl; + } + t << lineNumber << " "; + } + else + { + t << l << " "; + } m_col=0; } void RTFGenerator::startCodeLine(bool) diff --git a/src/rtfgen.h b/src/rtfgen.h index 1750a7b..9330b13 100644 --- a/src/rtfgen.h +++ b/src/rtfgen.h @@ -32,6 +32,8 @@ class RTFGenerator : public OutputGenerator static void writeStyleSheetFile(QFile &f); static void writeExtensionsFile(QFile &file); + void setRelativePath(const QCString &path); + void setSourceFileName(const QCString &sourceFileName); void enable() { if (m_genStack->top()) m_active=*m_genStack->top(); else m_active=TRUE; } void disable() { m_active=FALSE; } @@ -279,6 +281,7 @@ class RTFGenerator : public OutputGenerator const char *rtf_Code_DepthStyle(); void incrementIndentLevel(); void decrementIndentLevel(); + QCString m_sourceFileName; int m_col; bool m_prettyCode; diff --git a/src/rtfstyle.cpp b/src/rtfstyle.cpp index 47a8166..163d5b8 100644 --- a/src/rtfstyle.cpp +++ b/src/rtfstyle.cpp @@ -228,17 +228,20 @@ const QRegExp StyleData::s_clause("\\\\s[0-9]+\\s*"); StyleData::StyleData(const char* reference, const char* definition) { - int start = s_clause.match(reference); ASSERT(start >= 0); - reference += start; - index = (int)atol(reference + 2); ASSERT(index > 0); + const char *ref = reference; + const char *def = definition; - ASSERT(reference != 0); - size_t size = 1 + strlen(reference); - memcpy(this->reference = new char[size], reference, size); + int start = s_clause.match(ref); ASSERT(start >= 0); + ref += start; + index = (int)atol(ref + 2); ASSERT(index > 0); - ASSERT(definition != 0); - size = 1 + strlen(definition); - memcpy(this->definition = new char[size], definition, size); + ASSERT(ref != 0); + size_t size = 1 + strlen(ref); + memcpy(this->reference = new char[size], ref, size); + + ASSERT(def != 0); + size = 1 + strlen(def); + memcpy(this->definition = new char[size], def, size); } StyleData::~StyleData() diff --git a/src/scanner.l b/src/scanner.l index 2342795..25109bc 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -59,6 +59,8 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 +#define USE_STATE2STRING 0 + struct scannerYY_state { OutlineParserInterface *thisParser; @@ -190,12 +192,14 @@ struct scannerYY_state int column = 0; - int fencedSize = 0; + uint fencedSize = 0; bool nestedComment = false; std::vector< std::pair<Entry*,std::shared_ptr<Entry> > > outerScopeEntries; }; +#if USE_STATE2STRING static const char *stateToString(int state); +#endif //----------------------------------------------------------------------------- // forward declarations for stateless functions @@ -218,7 +222,7 @@ static bool checkForKnRstyleC(yyscan_t yyscanner); static void splitKnRArg(yyscan_t yyscanner,QCString &oldStyleArgPtr,QCString &oldStyleArgName); static void addKnRArgInfo(yyscan_t yyscanner,const QCString &type,const QCString &name, const QCString &brief,const QCString &docs); -static int yyread(yyscan_t yyscanner,char *buf,int max_size); +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size); /* ----------------------------------------------------------------- */ @@ -623,6 +627,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) lineCount(yyscanner) ; yyextra->current->mtype = yyextra->mtype = Event; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->curlyCount=0; BEGIN( CliPropertyType ); } @@ -631,6 +636,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) lineCount(yyscanner) ; yyextra->current->mtype = Event; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; } else { @@ -644,6 +650,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) lineCount(yyscanner) ; yyextra->current->mtype = yyextra->mtype = Property; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->curlyCount=0; BEGIN( CliPropertyType ); } @@ -737,6 +744,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->current->section = Entry::FUNCTION_SEC; yyextra->current->protection = yyextra->protection = Public ; yyextra->language = yyextra->current->lang = SrcLangExt_ObjC; @@ -873,6 +881,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { lineCount(yyscanner); yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->current->fileName = yyextra->yyFileName ; yyextra->current->startLine = yyextra->yyLineNr ; yyextra->current->startColumn = yyextra->yyColNr; @@ -889,6 +898,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { lineCount(yyscanner); yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->current->fileName = yyextra->yyFileName ; yyextra->current->startLine = yyextra->yyLineNr ; yyextra->current->startColumn = yyextra->yyColNr; @@ -1002,6 +1012,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; lineCount(yyscanner); } <PackageName>";" { @@ -1120,6 +1131,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; lineCount(yyscanner); if (yyextra->insidePHP) { @@ -1141,6 +1153,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; BEGIN( CompoundName ); } else if (yyextra->insideD) @@ -1165,6 +1178,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; BEGIN( CompoundName ); } else @@ -1184,6 +1198,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; BEGIN( CompoundName ); } else @@ -1206,6 +1221,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->fileName = yyextra->yyFileName; yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; BEGIN( CompoundName ); } else // TODO is addType right? just copy/pasted @@ -1227,6 +1243,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->fileName = yyextra->yyFileName; yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; BEGIN( CompoundName ); } else // TODO is addType right? just copy/pasted @@ -1250,6 +1267,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; BEGIN( CompoundName ); } else @@ -1270,6 +1288,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->fileName = yyextra->yyFileName; yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; BEGIN( CompoundName ); } <FindMembers>{B}*"@interface"{BN}+ { // Objective-C class interface, or Java attribute @@ -1289,6 +1308,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; BEGIN( CompoundName ); } <FindMembers>{B}*"@protocol"{BN}+ { // Objective-C protocol definition @@ -1305,6 +1325,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; BEGIN( CompoundName ); } <FindMembers>{B}*"exception"{BN}+ { // Corba IDL/Slice exception @@ -1320,6 +1341,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; lineCount(yyscanner); BEGIN( CompoundName ); } @@ -1355,6 +1377,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; if (yytext[0]=='@') { yyextra->language = yyextra->current->lang = SrcLangExt_ObjC; @@ -1375,6 +1398,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; lineCount(yyscanner) ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; @@ -1390,6 +1414,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; lineCount(yyscanner) ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; @@ -1405,6 +1430,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; lineCount(yyscanner) ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; @@ -1420,6 +1446,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; lineCount(yyscanner) ; BEGIN( CompoundName ) ; } @@ -1459,6 +1486,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; lineCount(yyscanner) ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; @@ -1474,6 +1502,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; lineCount(yyscanner) ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; @@ -1489,6 +1518,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; lineCount(yyscanner) ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; @@ -1504,6 +1534,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; lineCount(yyscanner) ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; @@ -1532,6 +1563,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; lineCount(yyscanner) ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; @@ -1560,6 +1592,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->startLine = yyextra->yyLineNr; yyextra->current->startColumn = yyextra->yyColNr; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; lineCount(yyscanner) ; if (yytext[yyleng-1]=='{') unput('{'); BEGIN( CompoundName ) ; @@ -1740,6 +1773,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->previous->args.resize(0); yyextra->previous->name=yyextra->previous->name.stripWhiteSpace(); yyextra->previous->bodyLine = yyextra->yyLineNr; + yyextra->previous->bodyColumn = yyextra->yyColNr; yyextra->previous->spec |= Entry::Alias; BEGIN(FindMembers); } @@ -1874,6 +1908,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) if (yyextra->roundCount==0 && --yyextra->sharpCount<=0) { yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->current->args = "("; yyextra->currentArgumentContext = FuncQual; yyextra->fullArgString = yyextra->current->args.copy(); @@ -1913,6 +1948,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) if (yyextra->insidePHP) { yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; BEGIN( DefinePHP ); } else @@ -2247,6 +2283,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) if (yyextra->insidePHP) REJECT; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->lastDefineContext = YY_START; BEGIN( Define ); } @@ -2299,6 +2336,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->name = yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace(); yyextra->current->args = "("; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->currentArgumentContext = DefineEnd; yyextra->fullArgString=yyextra->current->args.copy(); yyextra->copyArgString=&yyextra->current->args; @@ -2321,6 +2359,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->id = ClangParser::instance()->lookup(yyextra->yyLineNr,yytext); } yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->current->name = yytext; BEGIN(DefineEnd); } @@ -2377,6 +2416,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->name = yyextra->current->name.left(yyextra->current->name.length()-1).stripWhiteSpace(); yyextra->current->name = yyextra->current->name.left(yyextra->current->name.length()-1); yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->lastRoundContext = DefinePHPEnd; yyextra->pCopyRoundGString = &yyextra->current->initializer; yyextra->roundCount = 0; @@ -2402,6 +2442,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) if (yyextra->current->bodyLine==-1) { yyextra->current->bodyLine=yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; } yyextra->docBlockContext = YY_START; yyextra->docBlockInBody = FALSE; @@ -2465,6 +2506,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) if (yyextra->current->bodyLine==-1) { yyextra->current->bodyLine=yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; } yyextra->docBlockContext = YY_START; yyextra->docBlockInBody = FALSE; @@ -2547,6 +2589,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } <FindMembers>"=" { // in PHP code this could also be due to "<?=" yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->current->initializer = yytext; yyextra->lastInitializerContext = YY_START; yyextra->initBracketCount=0; @@ -3118,6 +3161,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) if (yyextra->current->bodyLine==-1) { yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; } if ( yyextra->insidePHP && yyextra->current->type.left(3) == "var" ) { @@ -3430,6 +3474,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->id = ClangParser::instance()->lookup(yyextra->yyLineNr,yytext); } yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->current->name = yytext; } <FindFields>"(" { @@ -3955,6 +4000,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) else { yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; lineCount(yyscanner); addType(yyscanner); yyextra->funcPtrType=yytext; @@ -4022,6 +4068,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) //yyextra->roundCount=0; //BEGIN( FuncFunc ); yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->currentArgumentContext = FuncFuncEnd; yyextra->fullArgString=yyextra->current->args.copy(); yyextra->copyArgString=&yyextra->current->args; @@ -4086,12 +4133,14 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) // the bodyLine check is to prevent this guard to be true more than once { yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; BEGIN( GetCallType ); } else if (!yyextra->current->name.isEmpty()) // normal function { yyextra->current->args = yytext; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->currentArgumentContext = FuncQual; yyextra->fullArgString=yyextra->current->args.copy(); yyextra->copyArgString=&yyextra->current->args; @@ -4112,6 +4161,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) { yyextra->current->args = yytext; yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->currentArgumentContext = FuncQual; yyextra->fullArgString=yyextra->current->args.copy(); yyextra->copyArgString=&yyextra->current->args; @@ -5584,8 +5634,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } <CompoundName,ClassVar>{B}*"{"{B}* { yyextra->current->fileName = yyextra->yyFileName ; - yyextra->current->startLine = yyextra->yyLineNr ; - yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->current->name = removeRedundantWhiteSpace(yyextra->current->name); if (yyextra->current->name.isEmpty() && !yyextra->isTypedef) // anonymous compound { @@ -5835,8 +5885,8 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } } <Bases>{B}*"{"{B}* { yyextra->current->fileName = yyextra->yyFileName ; - yyextra->current->startLine = yyextra->yyLineNr ; - yyextra->current->startColumn = yyextra->yyColNr; + yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->current->name = removeRedundantWhiteSpace(yyextra->current->name); if (!yyextra->baseName.isEmpty()) yyextra->current->extends.push_back( @@ -6035,6 +6085,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) yyextra->current->mtype = yyextra->mtype = Property; } yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->curlyCount=0; BEGIN( CSAccessorDecl ); } @@ -6078,6 +6129,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) // C++11 style initializer list yyextra->current->bodyLine = yyextra->yyLineNr; + yyextra->current->bodyColumn = yyextra->yyColNr; yyextra->current->initializer = yytext; yyextra->lastInitializerContext = YY_START; yyextra->initBracketCount=1; @@ -6594,10 +6646,10 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) %% //---------------------------------------------------------------------------- -static int yyread(yyscan_t yyscanner,char *buf,int max_size) +static yy_size_t yyread(yyscan_t yyscanner,char *buf,yy_size_t max_size) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - int c=0; + yy_size_t c=0; while( c < max_size && yyextra->inputString[yyextra->inputPosition] ) { *buf = yyextra->inputString[yyextra->inputPosition++] ; @@ -6830,7 +6882,6 @@ static void splitKnRArg(yyscan_t yyscanner,QCString &oldStyleArgPtr,QCString &ol else // normal "int *var" { int l=si,i=l-1,j; - char c; // look for start of name in "type *name" while (i>=0 && isId(yyextra->current->args.at(i))) i--; j=i+1; @@ -7092,8 +7143,8 @@ static void parseCompounds(yyscan_t yyscanner,const std::shared_ptr<Entry> &rt) yyextra->current_root = ce; yyextra->yyFileName = ce->fileName; //setContext(); - yyextra->yyLineNr = ce->startLine ; - yyextra->yyColNr = ce->startColumn ; + yyextra->yyLineNr = ce->bodyLine; + yyextra->yyColNr = ce->bodyColumn; yyextra->insideObjC = ce->lang==SrcLangExt_ObjC; //printf("---> Inner block starts at line %d objC=%d\n",yyextra->yyLineNr,yyextra->insideObjC); yyextra->current = std::make_shared<Entry>(); @@ -7405,4 +7456,6 @@ void COutlineParser::parsePrototype(const char *text) //---------------------------------------------------------------------------- +#if USE_STATE2STRING #include "scanner.l.h" +#endif diff --git a/src/searchindex.cpp b/src/searchindex.cpp index 329b123..25d1576 100644 --- a/src/searchindex.cpp +++ b/src/searchindex.cpp @@ -394,8 +394,6 @@ void SearchIndex::write(const char *fileName) } } // write urls - QIntDictIterator<URL> udi(m_urls); - URL *url; for (udi.toFirst();(url=udi.current());++udi) { writeString(f,url->name); @@ -833,9 +831,9 @@ void createJavaScriptSearchIndex() } // index files - FileNameListIterator fnli(*Doxygen::inputNameList); + FileNameListIterator inli(*Doxygen::inputNameList); FileName *fn; - for (;(fn=fnli.current());++fnli) + for (;(fn=inli.current());++inli) { FileNameIterator fni(*fn); FileDef *fd; @@ -984,7 +982,7 @@ void writeJavaScriptSearchIndex() " \"https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" << endl; t << "<html><head><title></title>" << endl; t << "<meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>" << endl; - t << "<meta name=\"generator\" content=\"Doxygen " << getVersion() << "\"/>" << endl; + t << "<meta name=\"generator\" content=\"Doxygen " << getDoxygenVersion() << "\"/>" << endl; t << "<link rel=\"stylesheet\" type=\"text/css\" href=\"search.css\"/>" << endl; t << "<script type=\"text/javascript\" src=\"" << baseName << ".js\"></script>" << endl; t << "<script type=\"text/javascript\" src=\"search.js\"></script>" << endl; @@ -1009,6 +1007,12 @@ void writeJavaScriptSearchIndex() t << "document.getElementById(\"NoMatches\").style.display=\"none\";" << endl; t << "var searchResults = new SearchResults(\"searchResults\");" << endl; t << "searchResults.Search();" << endl; + t << "window.addEventListener(\"message\", function(event) {" << endl; + t << " if (event.data == \"take_focus\") {" << endl; + t << " var elem = searchResults.NavNext(0);" << endl; + t << " if (elem) elem.focus();" << endl; + t << " }" << endl; + t << "});" << endl; t << "/* @license-end */\n"; t << "--></script>" << endl; t << "</div>" << endl; // SRIndex @@ -1036,7 +1040,7 @@ void writeJavaScriptSearchIndex() int itemCount=0; for (li.toFirst();(dl=li.current());++li) { - Definition *d = dl->getFirst(); + const Definition *d = dl->getFirst(); if (!firstEntry) { @@ -1048,7 +1052,7 @@ void writeJavaScriptSearchIndex() if (dl->count()==1) // item with a unique name { - MemberDef *md = dynamic_cast<MemberDef*>(d); + const MemberDef *md = dynamic_cast<const MemberDef*>(d); QCString anchor = d->anchor(); ti << "'" << externalRef("../",d->getReference(),TRUE) @@ -1092,15 +1096,15 @@ void writeJavaScriptSearchIndex() { QListIterator<Definition> di(*dl); bool overloadedFunction = FALSE; - Definition *prevScope = 0; + const Definition *prevScope = 0; int childCount=0; for (di.toFirst();(d=di.current());) { ++di; - Definition *scope = d->getOuterScope(); - Definition *next = di.current(); - Definition *nextScope = 0; - MemberDef *md = dynamic_cast<MemberDef*>(d); + const Definition *scope = d->getOuterScope(); + const Definition *next = di.current(); + const Definition *nextScope = 0; + const MemberDef *md = dynamic_cast<const MemberDef*>(d); if (next) nextScope = next->getOuterScope(); QCString anchor = d->anchor(); @@ -1144,12 +1148,12 @@ void writeJavaScriptSearchIndex() QCString name; if (d->definitionType()==Definition::TypeClass) { - name = convertToXML((dynamic_cast<ClassDef*>(d))->displayName()); + name = convertToXML((dynamic_cast<const ClassDef*>(d))->displayName()); found = TRUE; } else if (d->definitionType()==Definition::TypeNamespace) { - name = convertToXML((dynamic_cast<NamespaceDef*>(d))->displayName()); + name = convertToXML((dynamic_cast<const NamespaceDef*>(d))->displayName()); found = TRUE; } else if (scope==0 || scope==Doxygen::globalScope) // in global scope diff --git a/src/sortdict.h b/src/sortdict.h index 203ae5e..15282ec 100644 --- a/src/sortdict.h +++ b/src/sortdict.h @@ -99,7 +99,7 @@ class SDict private: SList<T> *m_list; QDict<T> *m_dict; - int m_sizeIndex; + uint m_sizeIndex; public: /*! Create an ordered dictionary. @@ -108,7 +108,7 @@ class SDict * \param caseSensitive indicated whether the keys should be sorted * in a case sensitive way. */ - SDict(int size=17,bool caseSensitive=TRUE) : m_sizeIndex(0) + SDict(uint size=17,bool caseSensitive=TRUE) : m_sizeIndex(0) { m_list = new SList<T>(this); #if AUTORESIZE @@ -277,7 +277,7 @@ class SDict /*! Returns the number of items stored in the dictionary */ - int count() const + uint count() const { return m_list->count(); } diff --git a/src/sqlcode.l b/src/sqlcode.l index e73fe4c..58a2fce 100644 --- a/src/sqlcode.l +++ b/src/sqlcode.l @@ -44,6 +44,8 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 +#define USE_STATE2STRING 0 + struct sqlcodeYY_state { CodeOutputInterface * code; @@ -65,8 +67,10 @@ struct sqlcodeYY_state const char *currentFontClass; }; -static void codify(const char* text); +#if USE_STATE2STRING static const char *stateToString(int state); +#endif + static void setCurrentDoc(const QCString &anchor,yyscan_t yyscanner); static void startCodeLine(yyscan_t yyscanner); static void endFontClass(yyscan_t yyscanner); @@ -75,7 +79,7 @@ static void nextCodeLine(yyscan_t yyscanner); static void codifyLines(char *text,yyscan_t yyscanner); static void startFontClass(const char *s,yyscan_t yyscanner); static int countLines(yyscan_t yyscanner); -static int yyread(char *buf,int max_size,yyscan_t yyscanner); +static yy_size_t yyread(char *buf,yy_size_t max_size,yyscan_t yyscanner); #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size,yyscanner); @@ -193,12 +197,6 @@ commentclose "\*/" %% -static void codify(const char* text, yyscan_t yyscanner) -{ - struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - yyextra->code->codify(text); -} - static void setCurrentDoc(const QCString &anchor, yyscan_t yyscanner) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; @@ -348,10 +346,10 @@ static int countLines(yyscan_t yyscanner) return count; } -static int yyread(char *buf,int max_size,yyscan_t yyscanner) +static yy_size_t yyread(char *buf,yy_size_t max_size,yyscan_t yyscanner) { struct yyguts_t *yyg = (struct yyguts_t*)yyscanner; - int c=0; + yy_size_t c=0; while( c < max_size && yyextra->inputString[yyextra->inputPosition] ) { *buf = yyextra->inputString[yyextra->inputPosition++] ; @@ -487,4 +485,6 @@ void SQLCodeParser::resetCodeParserState() //--------------------------------------------------------------------------------- +#if USE_STATE2STRING #include "sqlcode.l.h" +#endif diff --git a/src/tagreader.cpp b/src/tagreader.cpp index 3640f0e..275d66a 100644 --- a/src/tagreader.cpp +++ b/src/tagreader.cpp @@ -1,13 +1,13 @@ /****************************************************************************** * - * + * * * * Copyright (C) 1997-2015 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 + * 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. * @@ -50,7 +50,7 @@ class TagAnchorInfo public: TagAnchorInfo(const QCString &f, const QCString &l, - const QCString &t=QCString()) + const QCString &t=QCString()) : label(l), fileName(f), title(t) {} QCString label; QCString fileName; @@ -60,7 +60,7 @@ class TagAnchorInfo /** List of TagAnchorInfo objects. */ class TagAnchorInfoList : public QList<TagAnchorInfo> { - public: + public: TagAnchorInfoList() : QList<TagAnchorInfo>() { setAutoDelete(TRUE); } virtual ~TagAnchorInfoList() {} }; @@ -79,7 +79,7 @@ class TagEnumValueInfo class TagMemberInfo { public: - TagMemberInfo() : prot(Public), virt(Normal), isStatic(FALSE) + TagMemberInfo() : prot(Public), virt(Normal), isStatic(FALSE) { enumValues.setAutoDelete(TRUE); } QCString type; QCString name; @@ -91,7 +91,7 @@ class TagMemberInfo TagAnchorInfoList docAnchors; Protection prot; Specifier virt; - bool isStatic; + bool isStatic; QList<TagEnumValueInfo> enumValues; }; @@ -207,10 +207,10 @@ class TagDirInfo TagAnchorInfoList docAnchors; }; -/** Tag file parser. +/** Tag file parser. * * Reads an XML-structured tagfile and builds up the structure in - * memory. The method buildLists() is used to transfer/translate + * memory. The method buildLists() is used to transfer/translate * the structures to the doxygen engine. */ class TagFileParser : public QXmlDefaultHandler @@ -229,7 +229,7 @@ class TagFileParser : public QXmlDefaultHandler }; class StartElementHandler { - typedef void (TagFileParser::*Handler)(const QXmlAttributes &attrib); + typedef void (TagFileParser::*Handler)(const QXmlAttributes &attrib); public: StartElementHandler(TagFileParser *parent, Handler h) : m_parent(parent), m_handler(h) {} void operator()(const QXmlAttributes &attrib) { (m_parent->*m_handler)(attrib); } @@ -240,7 +240,7 @@ class TagFileParser : public QXmlDefaultHandler class EndElementHandler { - typedef void (TagFileParser::*Handler)(); + typedef void (TagFileParser::*Handler)(); public: EndElementHandler(TagFileParser *parent, Handler h) : m_parent(parent), m_handler(h) {} void operator()() { (m_parent->*m_handler)(); } @@ -282,7 +282,7 @@ class TagFileParser : public QXmlDefaultHandler void warn(const char *fmt) { - ::warn(m_inputFileName,m_locator->lineNumber(),fmt); + ::warn(m_inputFileName,m_locator->lineNumber(),"%s", fmt); } void warn(const char *fmt,const char *s) { @@ -391,7 +391,7 @@ class TagFileParser : public QXmlDefaultHandler } if (isObjC=="yes" && m_curClass) { - m_curClass->isObjC = TRUE; + m_curClass->isObjC = TRUE; } } @@ -399,20 +399,20 @@ class TagFileParser : public QXmlDefaultHandler { switch (m_state) { - case InClass: m_tagFileClasses.append(m_curClass); - m_curClass=0; break; - case InFile: m_tagFileFiles.append(m_curFile); - m_curFile=0; break; - case InNamespace: m_tagFileNamespaces.append(m_curNamespace); - m_curNamespace=0; break; - case InGroup: m_tagFileGroups.append(m_curGroup); - m_curGroup=0; break; - case InPage: m_tagFilePages.append(m_curPage); - m_curPage=0; break; + case InClass: m_tagFileClasses.append(m_curClass); + m_curClass=0; break; + case InFile: m_tagFileFiles.append(m_curFile); + m_curFile=0; break; + case InNamespace: m_tagFileNamespaces.append(m_curNamespace); + m_curNamespace=0; break; + case InGroup: m_tagFileGroups.append(m_curGroup); + m_curGroup=0; break; + case InPage: m_tagFilePages.append(m_curPage); + m_curPage=0; break; case InDir: m_tagFileDirs.append(m_curDir); m_curDir=0; break; - case InPackage: m_tagFilePackages.append(m_curPackage); - m_curPackage=0; break; + case InPackage: m_tagFilePackages.append(m_curPackage); + m_curPackage=0; break; default: warn("tag 'compound' was not expected!"); } @@ -460,7 +460,7 @@ class TagFileParser : public QXmlDefaultHandler case InNamespace: m_curNamespace->members.append(m_curMember); break; case InGroup: m_curGroup->members.append(m_curMember); break; case InPackage: m_curPackage->members.append(m_curMember); break; - default: warn("Unexpected tag 'member' found"); break; + default: warn("Unexpected tag 'member' found"); break; } } @@ -484,7 +484,7 @@ class TagFileParser : public QXmlDefaultHandler void endEnumValue() { - m_curEnumValue->name = m_curString.stripWhiteSpace(); + m_curEnumValue->name = m_curString.stripWhiteSpace(); m_state = *m_stateStack.top(); m_stateStack.remove(); if (m_state==InMember) @@ -536,7 +536,7 @@ class TagFileParser : public QXmlDefaultHandler case InNamespace: m_curNamespace->classList.append(m_curString); break; case InGroup: m_curGroup->classList.append(m_curString); break; case InPackage: m_curPackage->classList.append(m_curString); break; - default: warn("Unexpected tag 'class' found"); break; + default: warn("Unexpected tag 'class' found"); break; } } @@ -547,7 +547,7 @@ class TagFileParser : public QXmlDefaultHandler case InNamespace: m_curNamespace->classList.append(m_curString); break; case InFile: m_curFile->namespaceList.append(m_curString); break; case InGroup: m_curGroup->namespaceList.append(m_curString); break; - default: warn("Unexpected tag 'namespace' found"); break; + default: warn("Unexpected tag 'namespace' found"); break; } } @@ -557,7 +557,7 @@ class TagFileParser : public QXmlDefaultHandler { case InGroup: m_curGroup->fileList.append(m_curString); break; case InDir: m_curDir->fileList.append(m_curString); break; - default: warn("Unexpected tag 'file' found"); break; + default: warn("Unexpected tag 'file' found"); break; } } @@ -566,7 +566,7 @@ class TagFileParser : public QXmlDefaultHandler switch(m_state) { case InGroup: m_curGroup->fileList.append(m_curString); break; - default: warn("Unexpected tag 'page' found"); break; + default: warn("Unexpected tag 'page' found"); break; } } @@ -575,7 +575,7 @@ class TagFileParser : public QXmlDefaultHandler switch(m_state) { case InDir: m_curDir->subdirList.append(m_curString); break; - default: warn("Unexpected tag 'dir' found"); break; + default: warn("Unexpected tag 'dir' found"); break; } } @@ -595,7 +595,7 @@ class TagFileParser : public QXmlDefaultHandler { if (m_state==InMember) { - m_curMember->type = m_curString; + m_curMember->type = m_curString; } else { @@ -615,7 +615,7 @@ class TagFileParser : public QXmlDefaultHandler case InDir: m_curDir->name = m_curString; break; case InMember: m_curMember->name = m_curString; break; case InPackage: m_curPackage->name = m_curString; break; - default: warn("Unexpected tag 'name' found"); break; + default: warn("Unexpected tag 'name' found"); break; } } @@ -687,7 +687,7 @@ class TagFileParser : public QXmlDefaultHandler { if (m_state==InClass && m_curClass) { - if (m_curClass->templateArguments==0) + if (m_curClass->templateArguments==0) { m_curClass->templateArguments = new QList<QCString>; m_curClass->templateArguments->setAutoDelete(TRUE); @@ -711,7 +711,7 @@ class TagFileParser : public QXmlDefaultHandler case InPage: m_curPage->filename = m_curString; break; case InPackage: m_curPackage->filename = m_curString; break; case InDir: m_curDir->filename = m_curString; break; - default: warn("Unexpected tag 'filename' found"); break; + default: warn("Unexpected tag 'filename' found"); break; } } @@ -721,19 +721,19 @@ class TagFileParser : public QXmlDefaultHandler { case InFile: m_curFile->path = m_curString; break; case InDir: m_curDir->path = m_curString; break; - default: warn("Unexpected tag 'path' found"); break; + default: warn("Unexpected tag 'path' found"); break; } } - + void endAnchor() { if (m_state==InMember) { - m_curMember->anchor = m_curString; + m_curMember->anchor = m_curString; } else if (m_state==InClass) { - m_curClass->anchor = m_curString; + m_curClass->anchor = m_curString; } else { @@ -745,7 +745,7 @@ class TagFileParser : public QXmlDefaultHandler { if (m_state==InMember) { - m_curMember->clangId = m_curString; + m_curMember->clangId = m_curString; } else if (m_state==InClass) { @@ -762,24 +762,24 @@ class TagFileParser : public QXmlDefaultHandler } - + void endAnchorFile() { if (m_state==InMember) { - m_curMember->anchorFile = m_curString; + m_curMember->anchorFile = m_curString; } else { warn("Unexpected tag 'anchorfile' found"); } } - + void endArglist() { if (m_state==InMember) { - m_curMember->arglist = m_curString; + m_curMember->arglist = m_curString; } else { @@ -792,7 +792,7 @@ class TagFileParser : public QXmlDefaultHandler { case InGroup: m_curGroup->title = m_curString; break; case InPage: m_curPage->title = m_curString; break; - default: warn("Unexpected tag 'title' found"); break; + default: warn("Unexpected tag 'title' found"); break; } } @@ -888,7 +888,7 @@ class TagFileParser : public QXmlDefaultHandler return TRUE; } - bool startElement( const QString&, const QString&, + bool startElement( const QString&, const QString&, const QString&name, const QXmlAttributes& attrib ) { //printf("startElement '%s'\n",name.data()); @@ -897,7 +897,7 @@ class TagFileParser : public QXmlDefaultHandler { (*handler)(attrib); } - else + else { warn("Unknown tag '%s' found!",name.data()); } @@ -912,14 +912,14 @@ class TagFileParser : public QXmlDefaultHandler { (*handler)(); } - else + else { warn("Unknown tag '%s' found!",name.data()); } return TRUE; } - bool characters ( const QString & ch ) + bool characters ( const QString & ch ) { m_curString+=ch.utf8(); return TRUE; @@ -928,7 +928,7 @@ class TagFileParser : public QXmlDefaultHandler void dump(); void buildLists(const std::shared_ptr<Entry> &root); void addIncludes(); - + private: void buildMemberList(const std::shared_ptr<Entry> &ce,QList<TagMemberInfo> &members); void addDocAnchors(const std::shared_ptr<Entry> &e,const TagAnchorInfoList &l); @@ -961,7 +961,7 @@ class TagFileParser : public QXmlDefaultHandler QCString m_inputFileName; }; -/** Error handler for the XML tag file parser. +/** Error handler for the XML tag file parser. * * Basically dumps all fatal error to stderr using err(). */ @@ -1026,8 +1026,8 @@ void TagFileParser::dump() msg("namespace '%s'\n",nd->name.data()); msg(" filename '%s'\n",nd->filename.data()); QCStringList::Iterator it; - for ( it = nd->classList.begin(); - it != nd->classList.end(); ++it ) + for ( it = nd->classList.begin(); + it != nd->classList.end(); ++it ) { msg( " class: %s \n", (*it).data() ); } @@ -1051,13 +1051,13 @@ void TagFileParser::dump() msg("file '%s'\n",fd->name.data()); msg(" filename '%s'\n",fd->filename.data()); QCStringList::Iterator it; - for ( it = fd->namespaceList.begin(); - it != fd->namespaceList.end(); ++it ) + for ( it = fd->namespaceList.begin(); + it != fd->namespaceList.end(); ++it ) { msg( " namespace: %s \n", (*it).data() ); } - for ( it = fd->classList.begin(); - it != fd->classList.end(); ++it ) + for ( it = fd->classList.begin(); + it != fd->classList.end(); ++it ) { msg( " class: %s \n", (*it).data() ); } @@ -1089,28 +1089,28 @@ void TagFileParser::dump() msg("group '%s'\n",gd->name.data()); msg(" filename '%s'\n",gd->filename.data()); QCStringList::Iterator it; - for ( it = gd->namespaceList.begin(); - it != gd->namespaceList.end(); ++it ) + for ( it = gd->namespaceList.begin(); + it != gd->namespaceList.end(); ++it ) { msg( " namespace: %s \n", (*it).data() ); } - for ( it = gd->classList.begin(); - it != gd->classList.end(); ++it ) + for ( it = gd->classList.begin(); + it != gd->classList.end(); ++it ) { msg( " class: %s \n", (*it).data() ); } - for ( it = gd->fileList.begin(); - it != gd->fileList.end(); ++it ) + for ( it = gd->fileList.begin(); + it != gd->fileList.end(); ++it ) { msg( " file: %s \n", (*it).data() ); } - for ( it = gd->subgroupList.begin(); - it != gd->subgroupList.end(); ++it ) + for ( it = gd->subgroupList.begin(); + it != gd->subgroupList.end(); ++it ) { msg( " subgroup: %s \n", (*it).data() ); } - for ( it = gd->pageList.begin(); - it != gd->pageList.end(); ++it ) + for ( it = gd->pageList.begin(); + it != gd->pageList.end(); ++it ) { msg( " page: %s \n", (*it).data() ); } @@ -1143,13 +1143,13 @@ void TagFileParser::dump() msg("dir '%s'\n",dd->name.data()); msg(" path '%s'\n",dd->path.data()); QCStringList::Iterator it; - for ( it = dd->fileList.begin(); - it != dd->fileList.end(); ++it ) + for ( it = dd->fileList.begin(); + it != dd->fileList.end(); ++it ) { msg( " file: %s \n", (*it).data() ); } - for ( it = dd->subdirList.begin(); - it != dd->subdirList.end(); ++it ) + for ( it = dd->subdirList.begin(); + it != dd->subdirList.end(); ++it ) { msg( " subdir: %s \n", (*it).data() ); } @@ -1310,7 +1310,7 @@ static QCString stripPath(const QCString &s) } /*! Injects the info gathered by the XML parser into the Entry tree. - * This tree contains the information extracted from the input in a + * This tree contains the information extracted from the input in a * "unrelated" form. */ void TagFileParser::buildLists(const std::shared_ptr<Entry> &root) @@ -1561,5 +1561,3 @@ void parseTagFile(const std::shared_ptr<Entry> &root,const char *fullName) handler.addIncludes(); //handler.dump(); } - - diff --git a/src/tclscanner.h b/src/tclscanner.h deleted file mode 100644 index cdd56d8..0000000 --- a/src/tclscanner.h +++ /dev/null @@ -1,63 +0,0 @@ -/****************************************************************************** - * - * - * - * Copyright (C) 1997-2015 by Dimitri van Heesch. - * Copyright (C) 2010-2011 by Rene Zaumseil - * - * 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 SCANNER_TCL_H -#define SCANNER_TCL_H - -#include "parserintf.h" - -/** \brief Tcl language parser using state-based lexical scanning. - * - * This is the Tcl language parser for doxygen. - */ -class TclOutlineParser : public OutlineParserInterface -{ - public: - void startTranslationUnit(const char *) {} - void finishTranslationUnit() {} - void parseInput(const char *fileName, - const char *fileBuf, - const std::shared_ptr<Entry> &root, - bool sameTranslationUnit, - QStrList &filesInSameTranslationUnit); - bool needsPreprocessing(const QCString &extension) const; - void parsePrototype(const char *text); -}; - -class TclCodeParser : public CodeParserInterface -{ - public: - void parseCode(CodeOutputInterface &codeOutIntf, - const char *scopeName, - const QCString &input, - SrcLangExt lang, - bool isExampleBlock, - const char *exampleName=0, - FileDef *fileDef=0, - int startLine=-1, - int endLine=-1, - bool inlineFragment=FALSE, - const MemberDef *memberDef=0, - bool showLineNumbers=TRUE, - const Definition *searchCtx=0, - bool collectXRefs=TRUE - ); - void resetCodeParserState(); -}; - -#endif diff --git a/src/tclscanner.l b/src/tclscanner.l deleted file mode 100644 index 7f776ca..0000000 --- a/src/tclscanner.l +++ /dev/null @@ -1,3150 +0,0 @@ -/***************************************************************************** - * Parser for Tcl subset - * - * Copyright (C) 2010 by Rene Zaumseil - * based on the work of 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. - * - */ -%option never-interactive -%option case-insensitive -%option prefix="tclscannerYY" -%top{ -#include <stdint.h> -} - -%{ -#include <stdio.h> -#include <stdlib.h> -#include <assert.h> -#include <ctype.h> - -#include <qstring.h> -#include <qcstringlist.h> -#include <qlist.h> -#include <qmap.h> -#include <qarray.h> -#include <qstack.h> -#include <qregexp.h> -#include <qfile.h> -#include <qdict.h> - -#include "entry.h" -#include "message.h" -#include "config.h" -#include "doxygen.h" -#include "util.h" -#include "defargs.h" -#include "language.h" -#include "commentscan.h" -#include "pre.h" -#include "tclscanner.h" -#include "outputlist.h" -#include "membername.h" -#include "searchindex.h" -#include "commentcnv.h" -#include "bufstr.h" -#include "portable.h" -#include "arguments.h" -#include "namespacedef.h" -#include "filedef.h" -#include "markdown.h" - -#define YY_NO_INPUT 1 -#define YY_NO_UNISTD_H 1 - -#define MAX_INCLUDE_DEPTH 10 - -static const char *stateToString(int state); - -//! Application error. -#define tcl_err \ - printf("Error %d %s() at line %d! ",__LINE__,tcl.file_name.data(),yylineno); \ - yy_push_state(ERROR); \ - yyless(0); \ - printf - -//! Application warning. -#define tcl_war \ - printf("Warning %d %s() at line %d: ",__LINE__,tcl.file_name.data(),yylineno); \ - printf - -//! Application message. -#define tcl_inf \ - if (0) printf("--- %.4d %d@%d: ",__LINE__,yylineno,yy_start_stack_ptr) && printf - -//! Debug message. -#define D\ - if (0) printf("--- %.4d %d@%d: %s\n",__LINE__,yylineno,yy_start_stack_ptr,yytext); - -// BEGIN of copy from tclUtil.c -// - Tcl_Interp removed -// - changes are marked with RZ -// #define's to adapt the code: -#define CONST const -#define UCHAR (unsigned char) -#define TCL_ERROR 1 -#define TCL_OK 0 -#define ckalloc malloc -#define ckfree free -#define TclCopyAndCollapse(size,src,dest) memcpy(dest,src,size); *(dest+size)=0 -int TclFindElement( - CONST char *list, /* Points to the first byte of a string - * containing a Tcl list with zero or more - * elements (possibly in braces). */ - int listLength, /* Number of bytes in the list's string. */ - CONST char **elementPtr, /* Where to put address of first significant - * character in first element of list. */ - CONST char **nextPtr, /* Fill in with location of character just - * after all white space following end of - * argument (next arg or end of list). */ - int *sizePtr, /* If non-zero, fill in with size of - * element. */ - int *bracePtr) /* If non-zero, fill in with non-zero/zero to - * indicate that arg was/wasn't in braces. */ -{ - CONST char *p = list; - CONST char *elemStart; /* Points to first byte of first element. */ - CONST char *limit; /* Points just after list's last byte. */ - int openBraces = 0; /* Brace nesting level during parse. */ - int inQuotes = 0; - int size = 0; /* lint. */ - //RZ int numChars; - - /* - * Skim off leading white space and check for an opening brace or quote. - * We treat embedded NULLs in the list as bytes belonging to a list - * element. - */ - - limit = (list + listLength); - while ((p < limit) && (isspace(UCHAR(*p)))) - { /* INTL: ISO space. */ - p++; - } - if (p == limit) - { /* no element found */ - elemStart = limit; - goto done; - } - - if (*p == '{') /* } to keep vi happy */ - { - openBraces = 1; - p++; - } - else if (*p == '"') - { - inQuotes = 1; - p++; - } - elemStart = p; - if (bracePtr != 0) - { - *bracePtr = openBraces; - } - - /* - * Find element's end (a space, close brace, or the end of the string). - */ - - while (p < limit) - { - switch (*p) - { - /* - * Open brace: don't treat specially unless the element is in - * braces. In this case, keep a nesting count. - */ - - case '{': - if (openBraces != 0) - { - openBraces++; - } - break; - - /* - * Close brace: if element is in braces, keep nesting count and - * quit when the last close brace is seen. - */ - - case '}': - if (openBraces > 1) - { - openBraces--; - } - else if (openBraces == 1) - { - size = (int)(p - elemStart); - p++; - if ((p >= limit) || isspace(UCHAR(*p))) - { /* INTL: ISO space. */ - goto done; - } - - /* - * Garbage after the closing brace; return an error. - */ - - return TCL_ERROR; - } - break; - - /* - * Backslash: skip over everything up to the end of the backslash - * sequence. - */ - - case '\\': - //RZ Tcl_UtfBackslash(p, &numChars, NULL); - //RZ p += (numChars - 1); - p++; //RZ - break; - - /* - * Space: ignore if element is in braces or quotes; otherwise - * terminate element. - */ - - case ' ': - case '\f': - case '\n': - case '\r': - case '\t': - case '\v': - if ((openBraces == 0) && !inQuotes) - { - size = (int)(p - elemStart); - goto done; - } - break; - - /* - * Double-quote: if element is in quotes then terminate it. - */ - - case '"': - if (inQuotes) - { - size = (int)(p - elemStart); - p++; - if ((p >= limit) || isspace(UCHAR(*p))) - { /* INTL: ISO space */ - goto done; - } - - /* - * Garbage after the closing quote; return an error. - */ - return TCL_ERROR; - } - break; - } - p++; - } - - /* - * End of list: terminate element. - */ - - if (p == limit) - { - if (openBraces != 0) - { - return TCL_ERROR; - } - else if (inQuotes) - { - return TCL_ERROR; - } - size = (int)(p - elemStart); - } - -done: - while ((p < limit) && (isspace(UCHAR(*p)))) - { /* INTL: ISO space. */ - p++; - } - *elementPtr = elemStart; - *nextPtr = p; - if (sizePtr != 0) - { - *sizePtr = size; - } - return TCL_OK; -} - -int Tcl_SplitList( - CONST char *list, /* Pointer to string with list structure. */ - int *argcPtr, /* Pointer to location to fill in with the - * number of elements in the list. */ - CONST char ***argvPtr) /* Pointer to place to store pointer to array - * of pointers to list elements. */ -{ - CONST char **argv, *l, *element; - char *p; - int length, size, i, result, elSize, brace; - - /* - * Figure out how much space to allocate. There must be enough space for - * both the array of pointers and also for a copy of the list. To estimate - * the number of pointers needed, count the number of space characters in - * the list. - */ - - for (size = 2, l = list; *l != 0; l++) - { - if (isspace(UCHAR(*l))) - { /* INTL: ISO space. */ - size++; - - /* - * Consecutive space can only count as a single list delimiter. - */ - - while (1) - { - char next = *(l + 1); - - if (next == '\0') - { - break; - } - ++l; - if (isspace(UCHAR(next))) - { /* INTL: ISO space. */ - continue; - } - break; - } - } - } - length = (int)(l - list); - argv = (CONST char **) ckalloc((unsigned) - ((size * sizeof(char *)) + length + 1)); - for (i = 0, p = ((char *) argv) + size*sizeof(char *); - *list != 0; i++) - { - CONST char *prevList = list; - - result = TclFindElement(list, length, &element, &list, - &elSize, &brace); - length -= (int)(list - prevList); - if (result != TCL_OK) - { - ckfree((char *) argv); - return result; - } - if (*element == 0) - { - break; - } - if (i >= size) - { - ckfree((char *) argv); - return TCL_ERROR; - } - argv[i] = p; - if (brace) - { - memcpy(p, element, (size_t) elSize); - p += elSize; - *p = 0; - p++; - } - else - { - TclCopyAndCollapse(elSize, element, p); - p += elSize+1; - } - } - - argv[i] = NULL; - *argvPtr = argv; - *argcPtr = i; - return TCL_OK; -} -// END of tclUtil.c - -void tcl_split_list(QCString &str, QCStringList &list) -{ - int argc; - const char **argv; - - list.clear(); - if (str.left(1)=="{" && str.right(1)=="}") - { - str=str.mid(1,str.length()-2); - } - else if (str.left(1)=="\"" && str.right(1)=="\"") - { - str=str.mid(1,str.length()-2); - } - if (!str.isEmpty()) - { - if (Tcl_SplitList(str,&argc,&argv) != TCL_OK) - { - list.append(str); - } - else - { - for (int i = 0; i < argc; i++) - { - list.append(argv[i]); - } - ckfree((char *) argv); - } - } -} - -//! Structure containing information about current scan context. -typedef struct -{ - char type[2]; // type of scan context: "\"" "{" "[" "?" " " - int line0; // start line of scan context - int line1; // end line of scan context - YY_BUFFER_STATE buffer_state; // value of scan context - QCString ns; // current namespace - Entry *entry_fn; // if set contains the current proc/method/constructor/destructor - Entry *entry_cl; // if set contain the current class - Entry *entry_scan; // current scan entry - Protection protection; // current protections state - QCStringList after; // option/value list (options: NULL comment keyword script) -} tcl_scan; - -//* Structure containing all internal global variables. -struct tcl_struct -{ - CodeOutputInterface * code; // if set then we are codifying the file - int code_line; // current line of code - int code_linenumbers; // if true create line numbers in code - const char *code_font; // used font to codify - bool config_autobrief; // value of configuration option - QMap<QCString,QCString> config_subst; // map of configuration option values - QCString input_string; // file contents - int input_position; // position in file - QCString file_name; // name of used file - OutlineParserInterface *this_parser; // myself - CommentScanner commentScanner; - int command; // true if command was found - int comment; // set true if comment was scanned - int brace_level; // bookkeeping of braces - int bracket_level; // bookkeeping of brackets - int bracket_quote; // bookkeeping of quotes (toggles) - char word_is; // type of current word: "\"" "{" "[" "?" " " - int line_comment; // line number of comment - int line_commentline; // line number of comment after command - int line_command; // line number of command - int line_body0; // start line of body - int line_body1; // end line of body - QCString string_command; // contain current command - QCString string_commentline; // contain current comment after command - QCString string_commentcodify; // current comment string used in codifying - QCString string_comment; // contain current comment - QCString string_last; // contain last read word or part of word - QCString string; // temporary string value - Entry* entry_main; // top level entry - Entry* entry_file; // entry of current file - Entry* entry_current; // currently used entry - Entry* entry_inside; // contain entry of current scan context - QCStringList list_commandwords; // list of command words - QList<tcl_scan> scan; // stack of scan contexts - QAsciiDict<Entry> ns; // all read namespace entries - QAsciiDict<Entry> cl; // all read class entries - QAsciiDict<Entry> fn; // all read function entries - QList<Entry> entry; // list of all created entries, will be deleted after codifying - Protection protection; // current protections state - const MemberDef *memberdef; // contain current MemberDef when codifying - bool collectXRefs; -}; - -static tcl_struct tcl; - -// scanner functions -static int yyread(char *buf,int max_size); -static tcl_scan *tcl_scan_start(char type, QCString content, QCString ns, Entry *entry_cls, Entry *entry_fn); -static void tcl_scan_end(); -static void tcl_comment(int what,const char *text); -static void tcl_word(int what,const char *text); -static void tcl_command(int what,const char *text); - -// helper functions - -//! Create new entry. -// @return new initialised entry -Entry* tcl_entry_new() -{ - Entry *myEntry = new Entry; - myEntry->section = Entry::EMPTY_SEC; - myEntry->name = ""; -// myEntry->type = ""; - myEntry->brief = ""; -// myEntry->doc = ""; - myEntry->protection = Public; -// myEntry->mtype = Method; -// myEntry->virt = Normal; -// myEntry->stat = FALSE; - myEntry->docFile = tcl.file_name; - myEntry->inbodyFile = tcl.file_name; - myEntry->fileName = tcl.file_name; - myEntry->lang = SrcLangExt_Tcl; - tcl.commentScanner.initGroupInfo(myEntry); - // collect entries - if (!tcl.code) - { - tcl.entry.insert(0,myEntry); - } - return myEntry; -} - -//! Set protection level. -void tcl_protection(Entry *entry) -{ - if (entry->protection!=Public&&entry->protection!=Protected&&entry->protection!=Private) - { - entry->protection = tcl.protection; - } - if (entry->protection!=Protected&&entry->protection!=Private) - { - entry->protection = Public; - } -} - -//! Check name. -// @return 'ns' and 'name' of given current 'ns0' and 'name0' -static void tcl_name(const QCString &ns0, const QCString &name0, QCString &ns, QCString &name) -{ - QCString myNm; - int myStart; - - if (qstrncmp(name0.data(),"::",2)==0) - { - myNm = name0.mid(2); - } - else if (ns0.length() && ns0 != " ") - { - myNm = ns0 + "::" + name0; - } - else - { - myNm = name0; - } - myStart = myNm.findRev("::"); - if (myStart == -1) - { - ns = ""; - name = myNm; - } - else if (myNm.length()-myStart == 2) - { - // ending with :: so get name equal to last component - ns = myNm.mid(0,myStart); - myStart = ns.findRev("::"); - name = myNm.mid(myStart+2); - } - else - { - ns = myNm.mid(0,myStart); - name = myNm.mid(myStart+2); - } -} - -//! Check name. Strip namespace qualifiers from name0 if inside inlined code segment. -// @return 'ns' and 'name' of given current 'ns0' and 'name0' -static void tcl_name_SnippetAware(const QCString &ns0, const QCString &name0, QCString &ns, QCString &name) -{ - // If we are inside an inlined code snippet then ns0 - // already contains the complete namespace path. - // Any namespace qualifiers in name0 are redundant. - int i = name0.findRev("::"); - if (i>=0 && tcl.memberdef) - { - tcl_name(ns0, name0.mid(i+2), ns, name); - } - else - { - tcl_name(ns0, name0, ns, name); - } -} - -// Check and return namespace entry. -// @return namespace entry -Entry* tcl_entry_namespace(const QCString ns) -{ - Entry *myEntry; - if (ns.length()) - { - myEntry = tcl.ns.find(ns); - } - else - { - myEntry = tcl.ns.find("::"); - } - if (myEntry == NULL) - { - myEntry = tcl_entry_new(); - myEntry->section = Entry::NAMESPACE_SEC; - myEntry->name = ns; - tcl.entry_main->moveToSubEntryAndKeep(myEntry); - tcl.ns.insert(ns,myEntry); - } - return myEntry; -} - -// Check and return class entry. -// @return class entry -Entry* tcl_entry_class(const QCString cl) -{ - Entry *myEntry; - if (!cl.length()) return(NULL); - - myEntry = tcl.cl.find(cl); - if (myEntry == NULL) - { - myEntry = tcl_entry_new(); - myEntry->section = Entry::CLASS_SEC; - myEntry->name = cl; - tcl.entry_main->moveToSubEntryAndKeep(myEntry); - tcl.cl.insert(cl,myEntry); - } - return myEntry; -} - -//! Check for keywords. -// @return 1 if keyword and 0 otherwise -static int tcl_keyword(QCString str) -{ - static QCStringList myList; - static int myInit=1; - if (myInit) - { - // tcl keywords - myList <<"append"<<"apply"<<"array"<<"auto_execok"<<"auto_import"<<"auto_load"<<"auto_mkindex"<<"auto_qualify"<<"auto_reset"; - myList <<"binary"; - myList <<"catch"<<"cd"<<"close"<<"clock"<<"concat"; - myList <<"eof"<<"eval"<<"exec"<<"exit"<<"expr"; - myList <<"fblocked"<<"fconfigure"<<"file"<<"fileevent"<<"flush"<<"for"<<"foreach"<<"format"; - myList <<"gets"<<"global"; - myList <<"http"; - myList <<"if"<<"incr"<<"info"<<"interp"; - myList <<"join"; - myList <<"lappend"<<"lassign"<<"lindex"<<"linsert"<<"llength"<<"load"<<"lrange"<<"lrepeat"<<"lreplace"<<"lreverse"<<"lset"; - myList <<"namespace"; - myList <<"package"<<"parray"<<"pid"<<"pkg_mkIndex"<<"proc"<<"puts"<<"pwd"; - myList <<"registry"<<"rename"<<"return"; - myList <<"scan"<<"set"<<"split"<<"string"<<"switch"; - myList <<"tclLog"<<"tcl_endOfWord"<<"tcl_findLibrary"<<"tcl_startOfNextWord"<<"tcl_startOfPreviousWord"<<"tcl_wordBreakAfter"<<"tcl_wordBreakBefore"<<"tell"<<"time"; - myList <<"unknown"<<"upvar"; - myList <<"variable"<<"vwait"; -// tk keywords - myList <<"bell"<<"bind"<<"bindtags"; - myList <<"clipboard"<<"console"<<"consoleinterp"; - myList <<"destroy"; - myList <<"event"; - myList <<"focus"; - myList <<"grid"; - myList <<"lower"; - myList <<"option"; - myList <<"pack"<<"place"; - myList <<"raise"; - myList <<"send"; - myList <<"tkerror"<<"tkwait"<<"tk_bisque"<<"tk_focusNext"<<"tk_focusPrev"<<"tk_focusFollowsMouse"<<"tk_popup"<<"tk_setPalette"<<"tk_textCut"<<"tk_TextCopy"<<"tk_textPaste"<<"chooseColor"<<"tk_chooseColor"<<"tk_chooseDirectory"<<"tk_dialog"<<"tk_getOpenFile"<<"tkDialog"<<"tk_getSaveFile"<<"tk_messageBox"; - myList <<"winfo"<<"wm"; - myList <<"button"<<"canvas"<<"checkbutton"<<"entry"<<"frame"<<"image"<<"label"<<"labelframe"<<"listbox"<<"menu"<<"menubutton"<<"message"<<"panedwindow"<<"radiobutton"<<"scale"<<"scrollbar"<<"spinbox"<<"toplevel"; - //myList.sort(); - myInit=0; - } - str=str.stripWhiteSpace(); - if (str.left(2)=="::") {str=str.mid(2);} - if (myList.findIndex(str) != -1) return(1); - return 0; -} - -//! End codifying with special font class. -static void tcl_font_end() -{ - if (!tcl.code) return; - if (tcl.code_font) - { - tcl.code->endFontClass(); - tcl.code_font=NULL; - } -} - -//! Codify 'str' with special font class 's'. -static void tcl_codify(const char *s,const char *str) -{ - if (!tcl.code || !str) return; - if (s && qstrcmp(s,"NULL")!=0) - { - tcl_font_end(); - tcl.code->startFontClass(s); - tcl.code_font=s; - } - char *tmp = (char *) malloc(strlen(str)+1); - strcpy(tmp, str); - char *p=tmp,*sp=p; - char c; - bool done=FALSE; - while (!done) - { - sp=p; - while ((c=*p++) && c!='\n') {} - if (c=='\n') - { - tcl.code_line++; - *(p-1)='\0'; // Dimitri: is this really needed? - // wtschueller: As far as I can see: yes. - // Deletes that \n that would produce ugly source listings otherwise. - // However, there may exist more sophisticated solutions. - tcl.code->codify(sp); - if (tcl.code_font) - { - tcl.code->endFontClass(); - } - tcl.code->endCodeLine(); - tcl.code->startCodeLine(tcl.code_linenumbers); - if (tcl.code_linenumbers) - { - tcl.code->writeLineNumber(0,0,0,tcl.code_line); - } - if (tcl.code_font) - { - tcl.code->startFontClass(tcl.code_font); - } - } - else - { - if (*(p-2)==0x1A) *(p-2) = '\0'; // remove ^Z - tcl.code->codify(sp); - done=TRUE; - } - } - free(tmp); - tcl_font_end(); -} - -#if 0 -//! Codify 'str' with special font class 's'. -static void tcl_codify(const char *s,const char *str) -{ - if (tcl.code==NULL) return; - char *tmp= (char *) malloc(strlen(str)+1); - strcpy(tmp, str); - tcl_codify(s,tmp); - free(tmp); -} - -//! Codify 'str' with special font class 's'. -static void tcl_codify(const char *s,const QCString &str) -{ - if (tcl.code==NULL) return; - tcl_codify(s,str); -} - -//! Codify 'str' with special font class 's'. -static void tcl_codify(const char *s,const QCString &str) -{ - if (!tcl.code) return; - tcl_codify(s,str.data()); -} -#endif - -static void tcl_codify_cmd(const char *s,int i) -{ - tcl_codify(s,(*tcl.list_commandwords.at(i))); -} -//! codify a string token -// -// codifies string according to type. -// Starts a new scan context if needed (*myScan==0 and type == "script"). -// Returns NULL or the created scan context. -// -static tcl_scan *tcl_codify_token(tcl_scan *myScan, const QCString type, const QCString string) -{ - if (myScan != NULL) - { - if (type != NULL) - { - myScan->after << type << string; - } - else - { - myScan->after << "NULL" << string; - } - } - else - { - if (qstrcmp(type, "script") == 0) - { - myScan = tcl.scan.at(0); - myScan = tcl_scan_start('?', string, - myScan->ns, myScan->entry_cl, myScan->entry_fn); - } - else - { - tcl_codify((const char*)type, string); - } - } - return myScan; -} - -//----------------------------------------------------------------------------- -#undef YY_INPUT -#define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); -//----------------------------------------------------------------------------- -%} -ws ([ \t]|\\\n) - -%option yylineno -%option noyywrap -%option stack - -%x ERROR -%x TOP -%x COMMAND -%x WORD -%x COMMENT -%x COMMENT_NL -%x COMMENT_CODE -%x COMMENT_VERB -%x COMMENTLINE -%x COMMENTLINE_NL -%% -<ERROR>. { -D - yyterminate(); -} -<<EOF>> { -D - if (tcl.scan.count()<1) - {// error -D - tcl_err("Tcl parser stack empty! Parser error in file '%s'.\n",tcl.file_name.data()); - yyterminate(); - } - else if (tcl.scan.count()==1) - {// exit, check on input? -D - yyterminate(); - } - else - {// continue -D - tcl_command(-1,""); - tcl_scan_end(); - } -} -<TOP>"#" { -D - yyless(0); - tcl.line_comment=yylineno; - tcl_comment(0,""); -} -<TOP>({ws}|[\;\n])+ { -D - tcl_codify(NULL,yytext); -} -<TOP>. { -D - yyless(0); - tcl.line_command=yylineno; - tcl_command(0,""); -} - -<COMMENT>[ \t]* { -D - tcl_codify("comment",yytext); -} -<COMMENT>"###".*\n { -D - tcl_codify("comment",yytext); - tcl_comment(2,yytext+1); -} -<COMMENT>"##".*\\\n { -D - tcl_codify("comment",yytext); - QCString t=yytext; - t = t.mid(2,t.length()-3); - t.append("\n"); - tcl_comment(1,t.data()); - yy_push_state(COMMENT_NL); -} -<COMMENT>"##".*\n { -D - tcl_codify("comment",yytext); - tcl_comment(1,yytext+2); -} -<COMMENT>"#"[@\\]"code"\n[ \t]*[^#] { -D - QCString t=yytext; - tcl_codify("comment",t.left(7)); - tcl_comment(2,"\n@code\n"); - yyless(7); - yy_push_state(COMMENT_CODE); -} -<COMMENT>"#"[@\\]"verbatim"\n[ \t]*[^#] { -D - QCString t=yytext; - tcl_codify("comment",t.left(11)); - tcl_comment(2,"\n@verbatim\n"); - yyless(11); - yy_push_state(COMMENT_VERB); -} -<COMMENT>"#".*\\\n { -D - tcl_codify("comment",yytext); - QCString t=yytext; - t = t.mid(1,t.length()-3); - t.append("\n"); - tcl_comment(2,t.data()); - yy_push_state(COMMENT_NL); -} -<COMMENT>"#".*\n { -D - tcl_codify("comment",yytext); - tcl_comment(2,yytext+1); -} -<COMMENT>"#".*\x1A { -D - QCString t=yytext; - t = t.mid(0,t.length()-1); - tcl_codify("comment",t.data()); - t = t.mid(1,t.length()); - tcl_comment(-2,t.data()); - unput(0x1A); -} -<COMMENT>\x1A { -D - tcl_comment(-2,""); - unput(0x1A); -} -<COMMENT>.|\n { -D - tcl_comment(-2,yytext); - yyless(0); -} - -<COMMENT_CODE>"#"[@\\]"endcode"\n { -D - QCString t=yytext; - t = t.left(t.length()-10); - tcl_comment(2,t.data()); - tcl_comment(2,"\n@endcode\n"); - yy_pop_state(); - yyless(0); -} -<COMMENT_CODE>.*\n { -D - yymore(); -} -<COMMENT_CODE>.*\x1A { -D - yy_pop_state(); - yyless(0); -} - -<COMMENT_VERB>"#"[@\\]"endverbatim"\n { -D - QCString t=yytext; - t = t.left(t.length()-14); - tcl_comment(2,t.data()); - tcl_comment(2,"\n@endverbatim\n"); - yy_pop_state(); - yyless(0); -} -<COMMENT_VERB>.*\n { -D - yymore(); -} -<COMMENT_VERB>.*\x1A { -D - yy_pop_state(); - yyless(0); -} - -<COMMENT_NL>.*\\\n { -D - tcl_codify("comment",yytext); - tcl_comment(2,yytext); -} -<COMMENT_NL>.*\n { -D - tcl_codify("comment",yytext); - tcl_comment(2,yytext); - yy_pop_state(); -} -<COMMENT_NL>.*\x1A { -D - yy_pop_state(); - yyless(0); -} - -<COMMENTLINE>.*\x1A { -D - yy_pop_state(); - yyless(0); -} -<COMMENTLINE>[ \t]* { -D - tcl.string_commentcodify += yytext; -} -<COMMENTLINE>"#<".*\\\n { -D - tcl.string_commentcodify += yytext; - QCString t=yytext; - t = t.mid(2,t.length()-4); - t.append("\n"); - tcl.string_commentline += t; - yy_push_state(COMMENTLINE_NL); -} -<COMMENTLINE>"#<".*\n { -D - tcl.string_commentcodify += yytext; - tcl.string_commentline += (yytext+2); -} -<COMMENTLINE>.|\n { -D - yy_pop_state(); - if (tcl.string_commentline.length()) - { - tcl.entry_current->brief = tcl.string_commentline; - tcl.entry_current->briefLine = tcl.line_commentline; - tcl.entry_current->briefFile = tcl.file_name; - } - yyless(0); - tcl_command(-1,tcl.string_commentcodify.data()); - tcl.string_commentline=""; - tcl.string_commentcodify=""; -} - -<COMMENTLINE_NL>.*\\\n { -D - tcl.string_commentcodify += yytext; - QCString t=yytext; - t = t.left(t.length()-3); - t.append("\n"); - tcl.string_commentline += t; -} -<COMMENTLINE_NL>.*\n { -D - tcl.string_commentcodify += yytext; - tcl.string_commentline += yytext; - yy_pop_state(); -} -<COMMENTLINE_NL>.*\x1A { -D - QCString t=yytext; - t = t.left(t.length()-1); - tcl.string_commentcodify += t; - tcl.string_commentline += t; - yy_pop_state(); - unput(0x1A); -} - -<COMMAND>{ws}*[\;]{ws}*"#<" { -D - tcl.string_commentcodify = yytext; - tcl.string_commentcodify = tcl.string_commentcodify.left(tcl.string_commentcodify.length()-2); - tcl.string_commentline = ""; - tcl.line_commentline = yylineno; - tcl.line_body1=yylineno; - unput('<'); - unput('#'); - yy_push_state(COMMENTLINE); -} -<COMMAND>{ws}*\x1A { -D - tcl.string_commentcodify = ""; - tcl.string_commentline = ""; - tcl.line_body1=yylineno; - tcl_command(-1,yytext); -} -<COMMAND>{ws}*; { -D - tcl.string_commentcodify = ""; - tcl.string_commentline = ""; - tcl.line_body1=yylineno; - tcl_command(-1,yytext); -} -<COMMAND>{ws}*\n { -D - tcl.string_commentcodify = ""; - tcl.string_commentline = ""; - tcl.line_body1=yylineno-1; - tcl_command(-1,yytext); -} -<COMMAND>{ws}+ { -D - tcl_command(1,yytext); -} -<COMMAND>"{*}". { -D - tcl.word_is = ' '; - tcl.string_last = "{*}"; - tcl_word(0,&yytext[3]); -} -<COMMAND>"\\"[\{\}\[\]\;\" \t] { -D - tcl.word_is=' '; - tcl.string_last = ""; - tcl_word(0,yytext); -} -<COMMAND>. { -D - tcl.word_is=' '; - if (yytext[0]=='{'||yytext[0]=='['||yytext[0]=='"') tcl.word_is = yytext[0]; - tcl.string_last = ""; - tcl_word(0,yytext); -} - -<WORD>"\\\\" | -<WORD>"\\"[\{\}\[\]\;\" \t] { - tcl_word(1,yytext); -} -<WORD>"\\\n" { - tcl_word(2,yytext); -} -<WORD>"{" { - tcl_word(3,yytext); -} -<WORD>"}" { - tcl_word(4,yytext); -} -<WORD>"[" { - tcl_word(5,yytext); -} -<WORD>"]" { - tcl_word(6,yytext); -} -<WORD>"\"" { - tcl_word(7,yytext); -} -<WORD>" " { - tcl_word(8,yytext); -} -<WORD>"\t" { - tcl_word(9,yytext); -} -<WORD>";" { - tcl_word(10,yytext); -} -<WORD>"\n" { - tcl_word(11,yytext); -} -<WORD>\x1A { - tcl_word(12,yytext); -} -<WORD>. { - tcl_word(1,yytext); -} -%% - -//! Start new scan context for given 'content'. -// @return created new scan context. -static tcl_scan *tcl_scan_start(char type, QCString content, QCString ns, Entry *entry_cl, Entry *entry_fn) -{ - tcl_scan *myScan=tcl.scan.at(0); -tcl_inf("line=%d type=%d '%s'\n",tcl.line_body0,type,content.data()); - - myScan->line1=yylineno; - yy_push_state(TOP); - - myScan=new tcl_scan; - myScan->type[0] =' '; - myScan->type[1] = '\0'; - switch (type) { - case '"': - case '{': - case '[': - myScan->type[0] = type; - break; - case '?': - if (content[0]=='"' && content[content.length()-1]=='"') myScan->type[0]='"'; - if (content[0]=='{' && content[content.length()-1]=='}') myScan->type[0]='{'; - if (content[0]=='[' && content[content.length()-1]==']') myScan->type[0]='['; - } - if (myScan->type[0]!=' ') - { - tcl_codify(NULL,&myScan->type[0]); - content = content.mid(1,content.length()-2); - } - content += (char)0x1A;// for detection end of scan context - myScan->ns = ns; - myScan->entry_cl = entry_cl; - myScan->entry_fn = entry_fn; - myScan->entry_scan = tcl.entry_current; - myScan->buffer_state=yy_scan_string(content.data()); - myScan->line0=tcl.line_body0; - myScan->line1=tcl.line_body1; - myScan->after.clear(); - yylineno=myScan->line0; - myScan->protection = tcl.protection; - - tcl.entry_inside = myScan->entry_scan; - tcl.entry_current = tcl_entry_new(); - tcl.scan.insert(0,myScan); - yy_switch_to_buffer(myScan->buffer_state); - return (myScan); -} - -//! Close current scan context. -static void tcl_scan_end() -{ - tcl_scan *myScan=tcl.scan.at(0); - tcl_scan *myScan1=tcl.scan.at(1); -tcl_inf("line=%d\n",myScan->line1); - - if (myScan->type[0]=='{') myScan->type[0]='}'; - if (myScan->type[0]=='[') myScan->type[0]=']'; - if (myScan->type[0]!=' ') tcl_codify(NULL,&myScan->type[0]); - int myStart=-1; - for (unsigned int i=0;i<myScan->after.count();i=i+2) - { - if (myScan->after[i]=="script") { - myStart=i; - break; - } - tcl_codify(myScan->after[i],myScan->after[i+1]); - } - yy_delete_buffer(myScan->buffer_state); - yy_pop_state(); - tcl.entry_inside = myScan1->entry_scan; - yy_switch_to_buffer(myScan1->buffer_state); - yylineno=myScan1->line1; - tcl.protection = myScan1->protection; - if (myStart>=0) - { - myScan1 = tcl_scan_start('?', myScan->after[myStart+1], myScan->ns, myScan->entry_cl, myScan->entry_fn); - for (unsigned int i=myStart+2;i<myScan->after.count();i++) - { - myScan1->after.append(myScan->after[i]); - } - tcl.scan.remove(1); - } - else - { - tcl.scan.removeFirst(); - } -} - -//! Handling of word parsing. -static void tcl_word(int what,const char *text) -{ - static char myList[1024]="";// nesting level list - static int myLevel=0;// number of current nesting level - static int myWhite=0;// set true when next char should be whitespace - static char myWord;// internal state - - switch (what) - { - case 0:// start - yy_push_state(WORD); - switch (text[0]) - { - case '{': - case '[': - case '"': myWord = text[0]; break; - default: myWord = '.'; - } - myList[0]=myWord; - myLevel=1; - myWhite=0; - break; - case 1:// all other chars - if (myWhite) - {// {x}y "x"y - tcl_err("expected word separator: %s\n",text); - return; - } - if (myLevel==0) - { - myWord='.'; - myList[0]=myWord; - myLevel=1; - } - break; - case 2:// \\\n - if (myLevel==0) - { - myWord=' '; - yy_pop_state(); - yyless(0); -tcl_inf("(\\\n) ?%s?\n",tcl.string_last.data()); - return; - } - switch (myList[myLevel-1]) - { - case '{': - case '[': - case '"': - break; - case '.': - if (myLevel==1) - { - myWord=' '; - yy_pop_state(); - yyless(0); -tcl_inf("(\\\n) ?%s?\n",tcl.string_last.data()); - return; - } - break; - } - myWhite=0; - break; - case 3:// { - if (myWhite) - {// {x}{ "x"{ - tcl_err("expected word separator: %s\n",text); - return; - } - switch (myList[myLevel-1]) - { - case '{': - case '[': - myList[myLevel++]='{'; - break; - case '"': - case '.': - break; - } - myWhite=0; - break; - case 4:// } - if (myWhite) - {// {x}{ "x"{ - tcl_err("expected word separator: %s\n",text); - return; - } - switch (myList[myLevel-1]) - { - case '{':// {{x}} - myLevel--; - if (myLevel==0 && !tcl.code) - { - myWhite=1; - } - break; - case '[': - case '"': - case '.': - break; - } - break; - case 5:// [ - if (myWhite) - {// {x}[ - tcl_err("expected word separator: %s\n",text); - return; - } - switch (myList[myLevel-1]) - { - case '{': - break; - case '[': - case '"': - case '.': - myList[myLevel++]='['; - break; - } - myWhite=0; - break; - case 6:// ] - if (myWhite) - {// {x}] - tcl_err("expected word separator: %s\n",text); - return; - } - switch (myList[myLevel-1]) - { - case '{': - break; - case '[': - myLevel--; - break; - case '"': - case '.': - break; - } - myWhite=0; - break; - case 7:// " - if (myWhite) - {// {x}" - tcl_err("expected word separator: %s\n",text); - return; - } - switch (myList[myLevel-1]) - { - case '{': - break; - case '[': - myList[myLevel++]='"'; - break; - case '"': - myLevel--; - case '.': - break; - } - break; - case 8:// ' ' - case 9:// \t - case 10:// ; - case 11:// \n - if (myLevel==0) - { - myWord=' '; - yy_pop_state(); - yyless(0); -tcl_inf("(%d) ?%s?\n",what,tcl.string_last.data()); - return; - } - switch (myList[myLevel-1]) - { - case '{': - case '[': - case '"': - break; - case '.': - if (myLevel==1) - { - myWord=' '; - yy_pop_state(); - yyless(0); -tcl_inf("(.%d) ?%s?\n",what,tcl.string_last.data()); - return; - } - else - { - myLevel--; - } - break; - } - myWhite=0; - break; - case 12:// \x1A - if (myLevel==0) - { - myWord=' '; - yy_pop_state(); - yyless(0); -tcl_inf("(%d) ?%s?\n",what,tcl.string_last.data()); - return; - } - if (myLevel!=1 || myList[0] != '.') - { - tcl_war("level=%d expected=%c\n",myLevel,myList[myLevel-1]); - } - myWord=' '; - yy_pop_state(); - yyless(0); -tcl_inf("(.%d) ?%s?\n",what,tcl.string_last.data()); - return; - break; - default: - tcl_err("wrong state: %d\n",what); - return; - } - tcl.string_last += text; -} - -//! Handling of comment parsing. -static void tcl_comment(int what,const char *text) -{ - if (what==0) - { // begin of comment - if (tcl.comment) - { - tcl_err("comment in comment\n"); - return; - } - yy_push_state(COMMENT); -tcl_inf("<- %s\n",text); - tcl.string_comment=""; - tcl.comment=0; - } - else if (what==1) - { // start new comment - if (tcl.comment) - { - tcl_comment(99,""); // inbody - } - tcl.string_comment=text; - tcl.comment=1; - } - else if (what==2) - { // add to comment - if (tcl.comment) - { - tcl.string_comment+=text; - } - } - else if (what==-1 || what == -2) - { // end of comment without/with command - if (tcl.comment) - { - tcl.string_last=tcl.string_comment; - tcl_comment(100+what,""); - } - else - { - tcl.string_last = ""; -tcl_inf("-> %s\n",(const char *)tcl.string_comment); - } - yy_pop_state(); - tcl.string_comment=""; - tcl.comment=0; - } - else if (what==98 || what==99) - { // 98=new 99=inbody - if (tcl.this_parser && tcl.string_comment.length()) - { -tcl_inf("-> %s\n",(const char *)tcl.string_comment); - int myPos=0; - bool myNew=false; - int myLine=tcl.line_comment; - BufStr myI(1024); - BufStr myO(1024); - Protection myProt=tcl.protection; - - // resolve ALIASES - myI.addArray("/*!",3); - myI.addArray(tcl.string_comment.data(),tcl.string_comment.length()); - myI.addArray("*/",2); - convertCppComments(&myI,&myO,tcl.file_name); - myO.dropFromStart(3); - myO.shrink(myO.curPos()-2); - myO.addChar('\0'); - QCString myDoc = myO.data(); - QCString processedDoc; - if (what==99) - { // inbody comment file or namespace or class or proc/method - int myPos0; - int myLine0; - Entry myEntry0; // used to test parsing - Entry *myEntry; - - Entry *myEntry1=NULL; - if (tcl.scan.at(0)->entry_fn) - { - myEntry1=tcl.scan.at(0)->entry_fn; - } - else if (tcl.scan.at(0)->entry_cl) - { - myEntry1=tcl.scan.at(0)->entry_cl; - } - - myPos0=myPos; - myLine0=myLine; - processedDoc = processMarkdownForCommentBlock(myDoc,tcl.file_name,myLine); - while (tcl.commentScanner.parseCommentBlock(tcl.this_parser, &myEntry0, processedDoc, tcl.file_name, - myLine, FALSE, tcl.config_autobrief, FALSE, myProt, myPos, myNew)) - { - if (myNew) - { // we need a new entry in this case - myNew=0; - myEntry = tcl_entry_new(); - processedDoc = processMarkdownForCommentBlock(myDoc,tcl.file_name,myLine0); - tcl.commentScanner.parseCommentBlock(tcl.this_parser, myEntry, processedDoc, tcl.file_name, - myLine0, FALSE, tcl.config_autobrief, FALSE, myProt, myPos0, myNew); - tcl.entry_inside->moveToSubEntryAndRefresh(myEntry); - } - else - { // we can add to current entry in this case - if (!myEntry1) - { - myEntry1=tcl_entry_namespace(tcl.scan.at(0)->ns); - } - processedDoc = processMarkdownForCommentBlock(myDoc,tcl.file_name,myLine0); - tcl.commentScanner.parseCommentBlock(tcl.this_parser, myEntry1, processedDoc, tcl.file_name, - myLine0, FALSE, tcl.config_autobrief, FALSE, myProt, myPos0, myNew); - } - myPos0=myPos; - myLine0=myLine; - } - if (myNew) - { // we need a new entry - myNew=0; - myEntry = tcl_entry_new(); - processedDoc = processMarkdownForCommentBlock(myDoc,tcl.file_name,myLine0); - tcl.commentScanner.parseCommentBlock(tcl.this_parser, myEntry, processedDoc, tcl.file_name, - myLine0, FALSE, tcl.config_autobrief, FALSE, myProt, myPos0, myNew); - tcl.entry_inside->moveToSubEntryAndKeep(myEntry); - } - else - { // we can add to current entry - if (!myEntry1) - { - myEntry1=tcl_entry_namespace(tcl.scan.at(0)->ns); - } - processedDoc = processMarkdownForCommentBlock(myDoc,tcl.file_name,myLine0); - tcl.commentScanner.parseCommentBlock(tcl.this_parser, myEntry1, processedDoc, tcl.file_name, - myLine0, FALSE, tcl.config_autobrief, FALSE, myProt, myPos0, myNew); - } - } - else - { // new entry - tcl.entry_current = tcl_entry_new(); - processedDoc = processMarkdownForCommentBlock(myDoc,tcl.file_name,myLine); - while (tcl.commentScanner.parseCommentBlock(tcl.this_parser, tcl.entry_current, processedDoc, - tcl.file_name, myLine, FALSE, tcl.config_autobrief, FALSE, - myProt, myPos, myNew)) - { - if (myNew) - { - tcl.entry_inside->moveToSubEntryAndKeep(tcl.entry_current); - tcl.entry_current = tcl_entry_new(); - } - else - { - tcl.entry_current->section = tcl.entry_inside->section; - tcl.entry_current->name = tcl.entry_inside->name; - } - } - if (myNew) - { - tcl.entry_inside->moveToSubEntryAndKeep(tcl.entry_current); - tcl.entry_current = tcl_entry_new(); - } - else - { - tcl.entry_current->section = tcl.entry_inside->section; - tcl.entry_current->name = tcl.entry_inside->name; - } - } - if (tcl.protection != myProt) - { - tcl.scan.at(0)->protection = tcl.protection = myProt; - } - } - } - else - { - tcl_err("what %d\n",what); - return; - } -} - -//! Parse given \c arglist . -static void tcl_command_ARGLIST(QCString &arglist) -{ -D - QCStringList myArgs; - QCString myArglist=""; - - tcl_split_list(arglist,myArgs); - for (uint i=0;i<myArgs.count();i++) - { - QCStringList myArgs1; - Argument myArg; - - tcl_split_list(*myArgs.at(i),myArgs1); - if (myArgs1.count()==2) - { - myArg.name= (*myArgs1.at(0)); - myArg.defval= (*myArgs1.at(1)); - if (myArg.defval.isEmpty()) - { - myArg.defval = " "; - } - myArglist += "?" + QCString(myArg.name) + "? "; - } - else - { - myArg.name= (*myArgs.at(i)); - myArglist += myArg.name + " "; - } - tcl.entry_current->argList.push_back(myArg); - } - arglist = myArglist; - tcl.entry_current->args = arglist; -} - -//! Create link. -static void tcl_codify_link(QCString name) -{ - if (tcl.code == NULL || name.isEmpty()) return; - static int init=0; - static QAsciiDict<MemberDef> fn; - if (init==0) - { - init=1; - MemberNameSDict::Iterator mni(*Doxygen::memberNameSDict); - MemberNameSDict::Iterator fni(*Doxygen::functionNameSDict); - MemberName *mn=0; - MemberDef *md; - for (mni.toFirst();(mn=mni.current());++mni) - { - MemberNameIterator mi(*mn); - for (mi.toFirst();(md=mi.current());++mi) - { - fn.insert(md->qualifiedName(),md); - } - } - for (fni.toFirst();(mn=fni.current());++fni) - { - MemberNameIterator fi(*mn); - for (fi.toFirst();(md=fi.current());++fi) - { - fn.insert(md->qualifiedName(),md); - } - } - } - MemberDef *myDef; - QCString myName=name; - if (name.mid(0,2)=="::") // fully qualified global command - { - myName = myName.mid(2); - myDef = fn.find(myName); - } - else // not qualified name - { - QCString myName1=myName; - myDef = NULL; - myName1 = tcl.scan.at(0)->ns; - if (myName1 == " " || myName1 == "") - { - myName1 = myName; - } - else - { - myName1 = myName1 + "::" + myName; - } - myDef = fn.find(myName1); // search namespace command - if (myDef == NULL) - { - myDef = fn.find(myName); // search global command - } - } - if (myDef != NULL) // documented command - { - tcl.code->writeCodeLink(myDef->getReference().data(), - myDef->getOutputFileBase().data(), - myDef->anchor().data(), - name, - myDef->qualifiedName().data()); - if (tcl.memberdef) - { - myDef->addSourceReferencedBy(tcl.memberdef); - //tcl.memberdef->addSourceReferences(myDef); - } else { - Entry* callerEntry; - unsigned int i; - // walk the stack of scan contexts and find the enclosing method or proc - for (i=0;i<tcl.scan.count();i++) - { - callerEntry=tcl.scan.at(i)->entry_scan; - if (callerEntry->mtype==Method && !callerEntry->name.isEmpty()) - { - break; - } - } - if (i<tcl.scan.count()) - { - // enclosing method found - QCString callerName = callerEntry->name; - if (callerName.mid(0,2)=="::") // fully qualified global command - { - callerName = callerName.mid(2); - } - else - { - if (!(tcl.scan.at(0)->ns.stripWhiteSpace().isEmpty())) - { - callerName = tcl.scan.at(0)->ns + "::" + callerEntry->name; - } - } - MemberDef *callerDef=NULL; - callerDef = fn.find(callerName); - if (callerDef!=NULL && myDef!= NULL && tcl.collectXRefs) - { - addDocCrossReference(callerDef,myDef); - } - } - } - } - else if (tcl_keyword(myName)) // check keyword - { - tcl_codify("keyword",name); - } - else - { - tcl_codify(NULL,name); // something else - } - -} - -//! scan general argument for brackets -// -// parses (*tcl.list_commandwords.at(i)) and checks for brackets. -// Starts a new scan context if needed (*myScan==0 and brackets found). -// Returns NULL or the created scan context. -// -static tcl_scan *tcl_command_ARG(tcl_scan *myScan, unsigned int i, bool ignoreOutermostBraces) -{ - QCString myName; - bool insideQuotes=false; - unsigned int insideBrackets=0; - unsigned int insideBraces=0; - myName = (*tcl.list_commandwords.at(i)); - if (i%2 != 0) - { - // handle white space - myScan = tcl_codify_token(myScan, "NULL", myName); - } - else - { - QCString myStr = ""; - unsigned int j; - for (j=0;j<myName.length();j++) - { - QChar c = myName[j]; - bool backslashed = false; - if (j>0) - { - backslashed = myName[j-1]=='\\'; - } - // this is a state machine - // input is c - // internal state is myScan and insideXXX - // these are the transitions: - if (c=='[' && !backslashed && insideBraces==0) - { - insideBrackets++; - } - if (c==']' && !backslashed && insideBraces==0 && insideBrackets>0) - { - insideBrackets--; - } - if (c=='{' && !backslashed && !insideQuotes && !(ignoreOutermostBraces && j==0)) - { - insideBraces++; - } - if (c=='}' && !backslashed && !insideQuotes && insideBraces>0) - { - insideBraces--; - } - if (c=='"' && !backslashed && insideBraces==0) - { - insideQuotes=!insideQuotes; - } - // all output, depending on state and input - if (c=='[' && !backslashed && insideBrackets==1 && insideBraces==0) - { - // the first opening bracket, output what we have so far - myStr+=c; - myScan = tcl_codify_token(myScan, "NULL", myStr); - myStr=""; - } - else if (c==']' && !backslashed && insideBrackets==0 && insideBraces==0) - { - // the last closing bracket, start recursion, switch to deferred - myScan = tcl_codify_token(myScan, "script", myStr); - myStr=""; - myStr+=c; - } - else - { - myStr+=c; - } - } - if (i == 0 && myScan == NULL) - { - tcl_codify_link(myStr); - } - else - { - myScan = tcl_codify_token(myScan, "NULL", myStr); - } - } - return (myScan); -} - -//! Handle internal tcl commands. -// "eval arg ?arg ...?" -static void tcl_command_EVAL() -{ -D - tcl_codify_cmd("keyword", 0); - tcl_scan *myScan = tcl.scan.at(0); - QCString myString = ""; - // we simply rescan the line without the eval - // we include leading whitespace because tcl_scan_start will examine - // the first char. If it finds a bracket it will assume one expression in brackets. - // Example: eval [list set] [list NotInvoked] [Invoked NotInvoked] - for (unsigned int i = 1; i < tcl.list_commandwords.count(); i++) - { - myString += (*tcl.list_commandwords.at(i)); - } - myScan = tcl_scan_start('?', myString, - myScan->ns, myScan->entry_cl, myScan->entry_fn); -} - -//! Handle internal tcl commands. -// switch ?options? string pattern body ?pattern body ...? -// switch ?options? string {pattern body ?pattern body ...?} -static void tcl_command_SWITCH() -{ -D - tcl_codify_cmd("keyword",0); - tcl_codify_cmd(NULL,1); - tcl_scan *myScan=NULL; - unsigned int i; - QCString token; - // first: find the last option token - unsigned int lastOptionIndex = 0; - for (i = 2; i<tcl.list_commandwords.count(); i += 2) - { - token = (*tcl.list_commandwords.at(i)); - if (token == "--") - { - lastOptionIndex = i; - break; - } - if (token[0] == '-' && i - lastOptionIndex == 2) - { - // options start with dash and should form a continuous chain - lastOptionIndex = i; - } - } - // second: eat up options - for (i = 2; i <= lastOptionIndex; i++) - { - myScan = tcl_command_ARG(myScan, i, false); - } - // third: how many tokens are left? - if (tcl.list_commandwords.count() - lastOptionIndex == 5) - { - //printf("syntax: switch ?options? string {pattern body ?pattern body ...?}\n"); - myScan = tcl_command_ARG(myScan, lastOptionIndex + 1, false); - myScan = tcl_command_ARG(myScan, lastOptionIndex + 2, false); - myScan = tcl_command_ARG(myScan, lastOptionIndex + 3, false); - // walk trough the list step by step - // this way we can preserve whitespace - bool inBraces = false; - bool nextIsPattern = true; - int size; - const char *elem; - const char *next; - token = (*tcl.list_commandwords.at(lastOptionIndex + 4)); - if (token[0] == '{') - { - inBraces = true; - token = token.mid(1, token.length() - 2); - myScan = tcl_codify_token(myScan, "NULL", QCString("{")); - } - // ToDo: check if multibyte chars are handled correctly - while (token.length() > 0) - { - TclFindElement((const char*)token, token.length(), &elem, &next, &size, NULL); - //printf("%s\nstart=%d, elem=%d, next=%d, size=%d, brace=%d\n", - // (const char*) token, (const char*) token, elem, next, size, brace); - // - // handle leading whitespace/opening brace/double quotes - if (elem - token > 0) - { - myScan = tcl_codify_token(myScan, "NULL", token.left(elem - token)); - } - // handle actual element without braces/double quotes - if (nextIsPattern) - { - myScan = tcl_codify_token(myScan, "NULL", token.mid(elem - token,size)); - //printf("pattern=%s\n",(const char*) token.mid(elem - token, size)); - } - else { - myScan = tcl_codify_token(myScan, "script", token.mid(elem - token, size)); - //printf("script =%s\n", (const char*) token.mid(elem - token, size)); - } - // handle trailing whitespace/closing brace/double quotes - if (next - elem - size > 0) - { - myScan = tcl_codify_token(myScan, "NULL", token.mid(elem - token + size, next - elem - size)); - } - nextIsPattern = !nextIsPattern; - token = token.mid(next - token); - } - if (inBraces) - { - myScan = tcl_codify_token(myScan, "NULL", QCString("}")); - } - if (!nextIsPattern) - { - tcl_war("Invalid switch syntax: last token is not a list of even elements.\n"); - //tcl_war("%s\n", tcl.list_commandwords.join(" ").ascii()); - } - } - else if ((tcl.list_commandwords.count() - lastOptionIndex > 6) && - ((tcl.list_commandwords.count() - lastOptionIndex-3) % 4 == 0)) - { - //printf("detected: switch ?options? string pattern body ?pattern body ...?\n"); - myScan = tcl_command_ARG(myScan, lastOptionIndex + 1, false); - myScan = tcl_command_ARG(myScan, lastOptionIndex + 2, false); - //printf("value=%s\n",(const char*) (*tcl.list_commandwords.at(lastOptionIndex + 2))); - for (i = lastOptionIndex + 3; i < tcl.list_commandwords.count(); i += 4) - { - myScan = tcl_command_ARG(myScan, i + 0, false); // whitespace - myScan = tcl_command_ARG(myScan, i + 1, false); // pattern - myScan = tcl_command_ARG(myScan, i + 2, false); // whitespace - myScan = tcl_codify_token(myScan, "script", (*tcl.list_commandwords.at(i+3))); // script - //printf("pattern=%s\n",(const char*) (*tcl.list_commandwords.at(i+1)))); - //printf("script=%s\n",(const char*) (*tcl.list_commandwords.at(i+3))); - } - } - else - { - // not properly detected syntax - tcl_war("Invalid switch syntax: %d options followed by %d tokens.\n", - lastOptionIndex / 2, (tcl.list_commandwords.count() - 1) / 2 - lastOptionIndex / 2); - for (i = lastOptionIndex + 1; i <= tcl.list_commandwords.count(); i++) - { - myScan = tcl_command_ARG(myScan, i, false); - } - } -} - -//! Handle internal tcl commands. -// "catch script ?resultVarName? ?optionsVarName?" -static void tcl_command_CATCH() -{ -D - tcl_codify_cmd("keyword", 0); - tcl_codify_cmd(NULL, 1); - tcl_scan *myScan = tcl.scan.at(0); - myScan = tcl_scan_start('?', *tcl.list_commandwords.at(2), - myScan->ns, myScan->entry_cl, myScan->entry_fn); - for (unsigned int i = 3; i < tcl.list_commandwords.count(); i++) - { - myScan = tcl_command_ARG(myScan, i, false); - } -} - -//! Handle internal tcl commands. -// "if expr1 ?then? body1 elseif expr2 ?then? body2 elseif ... ?else? ?bodyN?" -static void tcl_command_IF(QCStringList type) -{ -D - tcl_codify_cmd("keyword",0); - tcl_codify_cmd(NULL,1); - tcl_scan *myScan = NULL; - myScan = tcl_command_ARG(myScan, 2, true); - for (unsigned int i = 3;i<tcl.list_commandwords.count();i++) - { - if (type[i] == "expr") - { - myScan = tcl_command_ARG(myScan, i, true); - } - else - { - if (myScan!=0) - { - myScan->after << type[i] << tcl.list_commandwords[i]; - } - else - { - myScan=tcl.scan.at(0); - myScan = tcl_scan_start('?',*tcl.list_commandwords.at(i), - myScan->ns,myScan->entry_cl,myScan->entry_fn); - } - } - } -} -//! Handle internal tcl commands. -// "for start test next body" -static void tcl_command_FOR() -{ -D - tcl_codify_cmd("keyword",0); - tcl_codify_cmd(NULL,1); - tcl_scan *myScan=tcl.scan.at(0); - myScan = tcl_scan_start('?',*tcl.list_commandwords.at(2), - myScan->ns,myScan->entry_cl,myScan->entry_fn); - myScan->after << "NULL" << tcl.list_commandwords[3]; - myScan = tcl_command_ARG(myScan, 4, true); - myScan->after << "NULL" << tcl.list_commandwords[5]; - myScan->after << "script" << tcl.list_commandwords[6]; - myScan->after << "NULL" << tcl.list_commandwords[7]; - myScan->after << "script" << tcl.list_commandwords[8]; -} - -///! Handle internal tcl commands. -// "foreach varname list body" and -// "foreach varlist1 list1 ?varlist2 list2 ...? body" -static void tcl_command_FOREACH() -{ -D - unsigned int i; - tcl_scan *myScan=NULL; - tcl_codify_cmd("keyword",0); - for (i = 1;i<tcl.list_commandwords.count()-1;i++) - { - myScan = tcl_command_ARG(myScan, i, false); - } - if (myScan!=0) - { - myScan->after << "script" << tcl.list_commandwords[tcl.list_commandwords.count()-1]; - } - else - { - myScan=tcl.scan.at(0); - myScan = tcl_scan_start('?',*tcl.list_commandwords.at(tcl.list_commandwords.count()-1), - myScan->ns,myScan->entry_cl,myScan->entry_fn); - } -} - -///! Handle internal tcl commands. -// "while test body" -static void tcl_command_WHILE() -{ -D - tcl_codify_cmd("keyword",0); - tcl_codify_cmd(NULL,1); - tcl_scan *myScan = NULL; - myScan = tcl_command_ARG(myScan, 2, true); - myScan = tcl_command_ARG(myScan, 3, false); - if (myScan!=0) - { - myScan->after << "script" << tcl.list_commandwords[4]; - } - else - { - myScan=tcl.scan.at(0); - myScan = tcl_scan_start('?',*tcl.list_commandwords.at(4), - myScan->ns,myScan->entry_cl,myScan->entry_fn); - } -} - -//! Handle all other commands. -// Create links of first command word or first command word inside []. -static void tcl_command_OTHER() -{ - tcl_scan *myScan=NULL; - for (unsigned int i=0; i< tcl.list_commandwords.count(); i++) - { - myScan = tcl_command_ARG(myScan, i, false); - } -} - -//! Handle \c proc statements. -static void tcl_command_PROC() -{ -D - QCString myNs, myName; - Entry *myEntryNs; - Entry *myEntry; - tcl_scan *myScan = tcl.scan.at(0); - - tcl_codify_cmd("keyword",0); - tcl_codify_cmd(NULL,1); - tcl_codify_cmd(NULL,2); - tcl_codify_cmd(NULL,3); - tcl_codify_cmd(NULL,4); - tcl_codify_cmd(NULL,5); - tcl_name_SnippetAware(myScan->ns,(*tcl.list_commandwords.at(2)),myNs,myName); - if (myNs.length()) - { - myEntryNs = tcl_entry_namespace(myNs); - } - else - { - myEntryNs = tcl_entry_namespace(myScan->ns); - } - //why not needed here? tcl.fn.remove(myName); - tcl.entry_current->section = Entry::FUNCTION_SEC; - tcl.entry_current->mtype = Method; - tcl.entry_current->name = myName; - tcl.entry_current->startLine = tcl.line_command; - tcl.entry_current->docLine = tcl.line_comment; - tcl.entry_current->inbodyLine = tcl.line_comment; - tcl.entry_current->bodyLine = tcl.line_body0; - tcl.entry_current->endBodyLine = tcl.line_body1; - tcl_protection(tcl.entry_current); - tcl_command_ARGLIST(*tcl.list_commandwords.at(4)); - myEntryNs->moveToSubEntryAndKeep(tcl.entry_current); - myEntry = tcl.entry_current; - tcl.fn.insert(myName,myEntry); - myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(6), - myEntryNs->name,NULL,myEntry); -} - -//! Handle \c itcl::body statements and \c oo::define method and method inside \c itcl::class statements. -static void tcl_command_METHOD() -{ -D - QCString myNs, myName; - Entry *myEntryCl, *myEntry; - tcl_scan *myScan = tcl.scan.at(0); - - tcl_codify_cmd("keyword",0); - tcl_codify_cmd(NULL,1); - tcl_codify_cmd(NULL,2); - tcl_codify_cmd(NULL,3); - tcl_codify_cmd(NULL,4); - tcl_codify_cmd(NULL,5); - tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)),myNs,myName); - if (myNs.length()) - { - myEntryCl = tcl_entry_class(myNs); - } - else - { - myNs = myScan->ns; - myEntryCl = myScan->entry_cl; - } - // needed in case of more then one definition p.e. itcl::method and itcl::body - // see also bug # - tcl.fn.remove(myName); - tcl.entry_current->section = Entry::FUNCTION_SEC; - tcl.entry_current->mtype = Method; - tcl.entry_current->name = myName; - tcl.entry_current->startLine = tcl.line_command; - tcl.entry_current->docLine = tcl.line_comment; - tcl.entry_current->inbodyLine = tcl.line_comment; - tcl.entry_current->bodyLine = tcl.line_body0; - tcl.entry_current->endBodyLine = tcl.line_body1; - tcl_protection(tcl.entry_current); - tcl_command_ARGLIST(*tcl.list_commandwords.at(4)); - myEntryCl->moveToSubEntryAndKeep(tcl.entry_current); - tcl.fn.insert(myName,tcl.entry_current); - myEntry = tcl.entry_current; - myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(6), - myNs, myEntryCl, myEntry); -} - -//! Handle \c constructor statements inside class definitions. -static void tcl_command_CONSTRUCTOR() -{ -D - QCString myNs, myName; - Entry *myEntryCl, *myEntry; - tcl_scan *myScan = tcl.scan.at(0); - - tcl_codify_cmd("keyword",0); - tcl_codify_cmd(NULL,1); - tcl_codify_cmd(NULL,2); - tcl_codify_cmd(NULL,3); - tcl_name(myScan->ns,(*tcl.list_commandwords.at(0)),myNs,myName); - if (myNs.length()) - { - myEntryCl = tcl_entry_class(myNs); - } - else - { - myNs = myScan->ns; - myEntryCl = myScan->entry_cl; - } - tcl.entry_current->section = Entry::FUNCTION_SEC; - tcl.entry_current->mtype = Method; - tcl.entry_current->name = myName; - tcl.entry_current->startLine = tcl.line_command; - tcl.entry_current->docLine = tcl.line_comment; - tcl.entry_current->inbodyLine = tcl.line_comment; - tcl.entry_current->bodyLine = tcl.line_body0; - tcl.entry_current->endBodyLine = tcl.line_body1; - tcl_protection(tcl.entry_current); - tcl_command_ARGLIST(*tcl.list_commandwords.at(2)); - if (myEntryCl) myEntryCl->moveToSubEntryAndKeep(tcl.entry_current); - myEntry = tcl.entry_current; - tcl.fn.insert(myName,myEntry); - myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(4), - myNs, myEntryCl, myEntry); -} - -//! Handle \c destructor statements inside class definitions. -static void tcl_command_DESTRUCTOR() -{ -D - QCString myNs, myName; - Entry *myEntryCl, *myEntry; - tcl_scan *myScan = tcl.scan.at(0); - - tcl_codify_cmd("keyword",0); - tcl_codify_cmd(NULL,1); - tcl_name(myScan->ns,(*tcl.list_commandwords.at(0)),myNs,myName); - if (myNs.length()) - { - myEntryCl = tcl_entry_class(myNs); - } - else - { - myNs = myScan->ns; - myEntryCl = myScan->entry_cl; - } - tcl.entry_current->section = Entry::FUNCTION_SEC; - tcl.entry_current->mtype = Method; - tcl.entry_current->name = myName; - tcl.entry_current->startLine = tcl.line_command; - tcl.entry_current->docLine = tcl.line_comment; - tcl.entry_current->inbodyLine = tcl.line_comment; - tcl.entry_current->bodyLine = tcl.line_body0; - tcl.entry_current->endBodyLine = tcl.line_body1; - tcl_protection(tcl.entry_current); - myEntryCl->moveToSubEntryAndKeep(tcl.entry_current); - myEntry = tcl.entry_current; - tcl.fn.insert(myName,myEntry); - myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(2), - myNs, myEntryCl, myEntry); -} - -//! Handle \c namespace statements. -static bool tcl_command_NAMESPACE() -{ -D - QCString myNs, myName, myStr; - //Entry *myEntryNs=NULL; - tcl_scan *myScan = tcl.scan.at(0); - - tcl_name(myScan->ns,(*tcl.list_commandwords.at(4)),myNs,myName); - if (myName.isEmpty()) return false; // not a namespace - tcl_codify_cmd("keyword",0); - tcl_codify_cmd(NULL,1); - tcl_codify_cmd("keyword",2); - tcl_codify_cmd(NULL,3); - tcl_codify_cmd(NULL,4); - tcl_codify_cmd(NULL,5); - if (!myNs.isEmpty()) - { - myName = myNs+"::"+myName; - } - tcl.entry_current->section = Entry::NAMESPACE_SEC; - tcl.entry_current->name = myName; - tcl.entry_current->startLine = tcl.line_command; - tcl.entry_current->docLine = tcl.line_comment; - tcl.entry_current->inbodyLine = tcl.line_comment; - tcl.entry_current->bodyLine = tcl.line_body0; - tcl.entry_current->endBodyLine = tcl.line_body1; - tcl.entry_main->moveToSubEntryAndKeep(tcl.entry_current); - tcl.ns.insert(myName,tcl.entry_current); - //myEntryNs = tcl.entry_current; - myStr = (*tcl.list_commandwords.at(6)); - if (tcl.list_commandwords.count() > 7) - { - for (uint i=7;i<tcl.list_commandwords.count();i++) - { - myStr.append((*tcl.list_commandwords.at(i))); - } - tcl.word_is=' '; - } - myScan = tcl_scan_start(tcl.word_is,myStr, myName, NULL, NULL); - return true; -} - -//! Handle \c itcl::class statements. -static void tcl_command_ITCL_CLASS() -{ -D - QCString myNs, myName; - Entry *myEntryCl; - tcl_scan *myScan = tcl.scan.at(0); - - tcl_codify_cmd("keyword",0); - tcl_codify_cmd(NULL,1); - tcl_codify_cmd("NULL",2); - tcl_codify_cmd("NULL",3); - tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)),myNs,myName); - if (myNs.length()) - { - myName = myNs+"::"+myName; - } - tcl.entry_current->section = Entry::CLASS_SEC; - tcl.entry_current->name = myName; - tcl.entry_current->startLine = tcl.line_command; - tcl.entry_current->docLine = tcl.line_comment; - tcl.entry_current->inbodyLine = tcl.line_comment; - tcl.entry_current->bodyLine = tcl.line_body0; - tcl.entry_current->endBodyLine = tcl.line_body1; - tcl.entry_main->moveToSubEntryAndKeep(tcl.entry_current); - tcl.cl.insert(myName,tcl.entry_current); - myEntryCl = tcl.entry_current; - myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(4), - myName, myEntryCl, NULL); -} - -//! Handle \c oo::class statements. -static void tcl_command_OO_CLASS() -{ -D - QCString myNs, myName; - //Entry *myEntryNs; - Entry *myEntryCl; - tcl_scan *myScan = tcl.scan.at(0); - - tcl_codify_cmd("keyword",0); - tcl_codify_cmd(NULL,1); - tcl_codify_cmd("NULL",2); - tcl_codify_cmd("NULL",3); - tcl_codify_cmd("NULL",4); - tcl_codify_cmd("NULL",5); - tcl_name(myScan->ns,(*tcl.list_commandwords.at(4)),myNs,myName); - if (myNs.length()) - { - myName = myNs+"::"+myName; - } - tcl.entry_current->section = Entry::CLASS_SEC; - tcl.entry_current->name = myName; - tcl.entry_current->startLine = tcl.line_command; - tcl.entry_current->docLine = tcl.line_comment; - tcl.entry_current->inbodyLine = tcl.line_comment; - tcl.entry_current->bodyLine = tcl.line_body0; - tcl.entry_current->endBodyLine = tcl.line_body1; - tcl.entry_main->moveToSubEntryAndKeep(tcl.entry_current); - //myEntryNs = tcl_entry_namespace(myName); - tcl.cl.insert(myName,tcl.entry_current); - myEntryCl = tcl.entry_current; - myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(6), - myName, myEntryCl, NULL); -} - -//! Handle \c oo::define statements. -static void tcl_command_OO_DEFINE() -{ -D - QCString myNs, myName, myStr; - Entry *myEntryCl; - tcl_scan *myScan = tcl.scan.at(0); - - tcl_codify_cmd("keyword",0); - tcl_codify_cmd(NULL,1); - tcl_codify_cmd("NULL",2); - tcl_codify_cmd("NULL",3); - tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)),myNs,myName); - if (myNs.length()) - { - myName = myNs+"::"+myName; - } - myEntryCl = tcl_entry_class(myName); - myStr = (*tcl.list_commandwords.at(4)); - // - // special cases first - // oo::define classname method methodname args script - // oo::define classname constructor argList bodyScript - // oo::define classname destructor bodyScript - unsigned int n =tcl.list_commandwords.count(); - if ((myStr == "method" && n == 11) || - (myStr == "constructor" && n == 9) || - (myStr == "destructor" && n == 7)) - { - for (unsigned int i = 4; i < n-1; i++) - { - tcl_codify_cmd("NULL",i); - } - Entry *myEntry; - QCString myMethod; - tcl_name(myScan->ns,(*tcl.list_commandwords.at(n==11?6:4)),myNs,myMethod); - // code snippet taken from tcl_command_METHOD()/tcl_command_CONSTRUCTOR - tcl.fn.remove(myMethod); - tcl.entry_current->section = Entry::FUNCTION_SEC; - tcl.entry_current->mtype = Method; - tcl.entry_current->name = myMethod; - tcl.entry_current->startLine = tcl.line_command; - tcl.entry_current->docLine = tcl.line_comment; - tcl.entry_current->inbodyLine = tcl.line_comment; - tcl.entry_current->bodyLine = tcl.line_body0; - tcl.entry_current->endBodyLine = tcl.line_body1; - tcl_protection(tcl.entry_current); - if (n==11) - { - tcl_command_ARGLIST(*tcl.list_commandwords.at(8)); - } - else if (n==9) - { - tcl_command_ARGLIST(*tcl.list_commandwords.at(6)); - } - if (myEntryCl) myEntryCl->moveToSubEntryAndKeep(tcl.entry_current); - tcl.fn.insert(myMethod,tcl.entry_current); - myEntry = tcl.entry_current; - myScan = tcl_scan_start('?',*tcl.list_commandwords.at(n-1), - myNs, myEntryCl, myEntry); - } - else - { - // The general case - // Simply concat all arguments into a script. - // Note: all documentation collected just before the - // oo::define command is lost - if (tcl.list_commandwords.count() > 5) - { - for (uint i=5;i<tcl.list_commandwords.count();i++) - { - myStr.append((*tcl.list_commandwords.at(i))); - } - tcl.word_is=' '; - } - myScan = tcl_scan_start(tcl.word_is,myStr,myName,myEntryCl,NULL); - } -} - -//! Handle \c variable statements. -static void tcl_command_VARIABLE(int inclass) -{ -D - QCString myNs, myName; - Entry *myEntry; - tcl_scan *myScan = tcl.scan.at(0); - - tcl_codify_cmd("keyword",0); - for (unsigned int i=1; i< tcl.list_commandwords.count(); i++) - { - tcl_codify_cmd(NULL,i); - } - tcl_name(myScan->ns,(*tcl.list_commandwords.at(2)),myNs,myName); - if (myNs.length()) - {// qualified variables go into namespace - myEntry = tcl_entry_namespace(myNs); - tcl.entry_current->stat = true; - } - else - { - if (inclass) - { - myEntry = myScan->entry_cl; - tcl.entry_current->stat = false; - } - else - { - myEntry = tcl_entry_namespace(myScan->ns); - tcl.entry_current->stat = true; - } - } - tcl.entry_current->section = Entry::VARIABLE_SEC; - tcl.entry_current->name = myName; - tcl.entry_current->startLine = tcl.line_command; - tcl.entry_current->docLine = tcl.line_comment; - tcl.entry_current->inbodyLine = tcl.line_comment; - tcl.entry_current->bodyLine = tcl.line_body0; - tcl.entry_current->endBodyLine = tcl.line_body1; - tcl_protection(tcl.entry_current); - myEntry->moveToSubEntryAndKeep(tcl.entry_current); - tcl.entry_current = tcl_entry_new(); -} - -//! Handling of command parsing. -//! what=0 -> ... -//! what=1 -> ... -//! what=-1 -> ... -static void tcl_command(int what,const char *text) -{ - int myLine=0; - if (what==0) - { - tcl.scan.at(0)->line1=yylineno;// current line in scan context - tcl.line_body0=yylineno;// start line of command -tcl_inf("<- %s\n",text); - yy_push_state(COMMAND); - tcl.list_commandwords.clear(); - tcl.string_command=""; - tcl.string_last=""; - tcl.command=1; - return; - } - else if (what==1) - { - if (tcl.string_last.length()) - { - tcl.list_commandwords.append(tcl.string_last); - tcl.string_last=""; - } - if (text) - { - tcl.list_commandwords.append(text); - } - return; - } - else if (what!=-1) - {// should not happen - tcl_err("what %d\n",what); - return; - } - QCString myText = text; -tcl_inf("->\n"); - if (tcl.command==0) - { - return; //TODO check on inside comment - } - if (tcl.string_last != "") - {// get last word - tcl.list_commandwords.append(tcl.string_last); - tcl.string_last=""; - } - yy_pop_state(); - - // check command - QCString myStr = (*tcl.list_commandwords.at(0)); - tcl_scan *myScanBackup=tcl.scan.at(0); - int myLevel = 0; - Protection myProt = tcl.protection; - - if (tcl.list_commandwords.count() < 3) - { - tcl_command_OTHER(); - goto command_end; - } - // remove leading "::" and apply TCL_SUBST - if (myStr.left(2)=="::") myStr = myStr.mid(2); - if (tcl.config_subst.contains(myStr)) - { - myStr=tcl.config_subst[myStr]; - } - if (myStr=="private") - { - tcl.protection = Private; - myLevel = 1; - } - else if (myStr=="protected") - { - tcl.protection = Protected; - myLevel = 1; - } - else if (myStr=="public") - { - tcl.protection = Public; - myLevel = 1; - } - if (myLevel) - { - tcl_codify_cmd("keyword",0); - tcl_codify_cmd(NULL,1); - tcl.list_commandwords.remove(tcl.list_commandwords.at(1)); - tcl.list_commandwords.remove(tcl.list_commandwords.at(0)); - if (tcl.list_commandwords.count()==1) - { - tcl_scan *myScan = tcl.scan.at(0); - myScan = tcl_scan_start(tcl.word_is,*tcl.list_commandwords.at(0), - myScan->ns,myScan->entry_cl,myScan->entry_fn); - myProt = tcl.protection; - goto command_end; - } - myStr = (*tcl.list_commandwords.at(0)); - // remove leading "::" and apply TCL_SUBST - if (myStr.left(2)=="::") myStr = myStr.mid(2); - if (tcl.config_subst.contains(myStr)) - { - myStr=tcl.config_subst[myStr]; - } - } - if (myStr=="proc") - { - if (tcl.list_commandwords.count() == 5) - {// itcl::proc - tcl.list_commandwords.append(""); - tcl.list_commandwords.append(""); - } - if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;} - tcl_command_PROC(); - goto command_end; - } - if (myStr=="method") - { - if (tcl.list_commandwords.count() == 5) - {// itcl::method - tcl.list_commandwords.append(""); - tcl.list_commandwords.append(""); - } - if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;} - tcl_command_METHOD(); - goto command_end; - } - if (myStr=="constructor") - { - if (tcl.list_commandwords.count() != 5) {myLine=__LINE__;goto command_warn;} - tcl_command_CONSTRUCTOR(); - goto command_end; - } - if (myStr=="destructor") - { - if (tcl.list_commandwords.count() != 3) {myLine=__LINE__;goto command_warn;} - tcl_command_DESTRUCTOR(); - goto command_end; - } - if (myStr=="namespace") - { - if ((*tcl.list_commandwords.at(2))=="eval") - { - if (tcl.list_commandwords.count() < 7) {myLine=__LINE__;goto command_warn;} - if (tcl_command_NAMESPACE()) - { - goto command_end; - } - } - else - { - tcl_command_OTHER(); - goto command_end; - } - } - if (myStr=="itcl::class") - { - if (tcl.list_commandwords.count() != 5) {myLine=__LINE__;goto command_warn;} - tcl_command_ITCL_CLASS(); - goto command_end; - } - if (myStr=="itcl::body") - { - if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;} - tcl_command_METHOD(); - goto command_end; - } - if (myStr=="oo::class") - { - if ((*tcl.list_commandwords.at(2))=="create") - { - if (tcl.list_commandwords.count() != 7) {myLine=__LINE__;goto command_warn;} - tcl_command_OO_CLASS(); - goto command_end; - } - tcl_command_OTHER(); - goto command_end; - } - if (myStr=="oo::define") - { - if (tcl.list_commandwords.count() < 5) {myLine=__LINE__;goto command_warn;} - tcl_command_OO_DEFINE(); - goto command_end; - } - if (myStr=="variable") - { - if (tcl.list_commandwords.count() < 3) {myLine=__LINE__;goto command_warn;} - if (tcl.scan.at(0)->entry_fn == NULL) - {// only parsed outside functions - tcl_command_VARIABLE(tcl.scan.at(0)->entry_cl && tcl.scan.at(0)->entry_cl->name!=""); - goto command_end; - } - } - if (myStr=="common") - { - if (tcl.list_commandwords.count() < 3) {myLine=__LINE__;goto command_warn;} - if (tcl.scan.at(0)->entry_fn == NULL) - {// only parsed outside functions - tcl_command_VARIABLE(0); - goto command_end; - } - } - if (myStr=="inherit" || myStr=="superclass") - { - if (tcl.list_commandwords.count() < 3) {myLine=__LINE__;goto command_warn;} - if (tcl.scan.at(0)->entry_cl && tcl.scan.at(0)->entry_cl->name!="") - { - for (unsigned int i = 2; i < tcl.list_commandwords.count(); i = i + 2) - { - tcl.scan.at(0)->entry_cl->extends.push_back(BaseInfo((*tcl.list_commandwords.at(i)),Public,Normal)); - } - } - goto command_end; - } - /* - * Start of internal tcl keywords - * Ready: switch, eval, catch, if, for, foreach, while - */ - if (myStr=="switch") - { - if (tcl.list_commandwords.count() < 5) {myLine=__LINE__;goto command_warn;} - tcl_command_SWITCH(); - goto command_end; - } - if (myStr=="eval") - { - if (tcl.list_commandwords.count() < 3) {myLine=__LINE__;goto command_warn;} - tcl_command_EVAL(); - goto command_end; - } - if (myStr=="catch") - { - if (tcl.list_commandwords.count() < 3) {myLine=__LINE__;goto command_warn;} - tcl_command_CATCH(); - goto command_end; - } - if (myStr=="for") - { - if (tcl.list_commandwords.count() != 9) {myLine=__LINE__;goto command_warn;} - tcl_command_FOR(); - goto command_end; - } - if (myStr=="foreach") - { - if (tcl.list_commandwords.count() < 7 || tcl.list_commandwords.count()%2==0) {myLine=__LINE__;goto command_warn;} - tcl_command_FOREACH(); - goto command_end; - } - /* -if expr1 ?then? body1 elseif expr2 ?then? body2 elseif ... ?else? ?bodyN? - */ - if (myStr=="if" && tcl.list_commandwords.count() > 4) - { - QCStringList myType; - myType << "keyword" << "NULL" << "expr" << "NULL"; - char myState='x';// last word: e'x'pr 't'hen 'b'ody 'e'lse else'i'f.. - for (unsigned int i = 4; i < tcl.list_commandwords.count(); i = i + 2) - { - QCString myStr=(*tcl.list_commandwords.at(i)); - if (myState=='x') - { - if (myStr=="then") - { - myState='t'; - myType << "keyword" << "NULL"; - } - else - { - myState='b'; - myType << "script" << "NULL"; - } - } - else if (myState=='t') - { - myState='b'; - myType << "script" << "NULL"; - } - else if (myState=='b') - { - if (myStr=="elseif") { - myState='i'; - myType << "keyword" << "NULL"; - } - else if (myStr=="else" && i==tcl.list_commandwords.count()-3) - { - myState = 'b'; - myType << "keyword" << "NULL" << "script"; - i = tcl.list_commandwords.count(); - } - else if (i==tcl.list_commandwords.count()-1) - { - myState = 'b'; - myType << "script"; - i = tcl.list_commandwords.count(); - } - else - { - myLine=__LINE__;goto command_warn; - } - } - else if (myState=='i') - { - myState='x'; - myType << "expr" << "NULL"; - } - } - if (myState != 'b') {myLine=__LINE__;goto command_warn;} - tcl_command_IF(myType); - goto command_end; - } - if (myStr=="while") - { - if (tcl.list_commandwords.count() != 5) {myLine=__LINE__;goto command_warn;} - tcl_command_WHILE(); - goto command_end; - } - tcl_command_OTHER(); - goto command_end; - command_warn:// print warning message because of wrong used syntax - tcl_war("%d count=%d: %s\n",myLine,tcl.list_commandwords.count(),tcl.list_commandwords.join(" ").data()); - tcl_command_OTHER(); - command_end:// add remaining text to current context - if (!myText.isEmpty()) - { - if(myScanBackup==tcl.scan.at(0)) - { - tcl_codify("comment",myText); - } - else - { - tcl.scan.at(0)->after << "comment" << myText; - } - } - tcl.list_commandwords.clear(); - tcl.command = 0; - tcl.protection = myProt; -} - -//---------------------------------------------------------------------------- -//! Common initializations. -static void tcl_init() -{ - // Get values from option TCL_SUBST - tcl.config_subst.clear(); - QStrList myStrList = Config_getList(TCL_SUBST); - const char *s=myStrList.first(); - while (s) - { - QCString myStr=s; - int i=myStr.find('='); - if (i>0) - { - QCString myName=myStr.left(i).stripWhiteSpace(); - QCString myValue=myStr.right(myStr.length()-i-1).stripWhiteSpace(); - if (!myName.isEmpty() && !myValue.isEmpty()) - tcl_inf("TCL_SUBST: use '%s'\n",s); - tcl.config_subst[myName] = myValue; - } - s = myStrList.next(); - } - - if (tcl.input_string.at(tcl.input_string.length()-1) == 0x1A) - { - } - else if (tcl.input_string.at(tcl.input_string.length()-1) == '\n') - { - tcl.input_string[tcl.input_string.length()-1] = 0x1A; - } - else - { - tcl.input_string += 0x1A; - } - - tcl.code = NULL; - tcl.code_font=NULL; - tcl.code_line=1; - tcl.code_linenumbers=1; - tcl.config_autobrief = Config_getBool(JAVADOC_AUTOBRIEF); - tcl.input_position = 0; - tcl.file_name = NULL; - tcl.this_parser = NULL; - tcl.command=0; - tcl.comment=0; - tcl.brace_level=0; - tcl.bracket_level=0; - tcl.bracket_quote=0; - tcl.word_is=' '; - tcl.string_command=""; - tcl.string_commentline=""; - tcl.string_commentcodify=""; - tcl.string_comment = ""; - tcl.string_last = ""; - tcl.entry_main = NULL; - tcl.entry_file = NULL; - tcl.entry_current = NULL; - tcl.entry_inside = NULL; - tcl.list_commandwords.clear(); - tcl.scan.clear(); - tcl.ns.clear(); - tcl.cl.clear(); - tcl.fn.clear(); - yylineno = 1; - tcl.protection = Public; - tcl.memberdef = NULL; -} - -//! Start parsing. -static void tcl_parse(const QCString ns, const QCString cls) -{ - tcl_scan *myScan; - - tcl.entry_file = tcl_entry_new(); - tcl.entry_file->name = tcl.file_name; - tcl.entry_file->section = Entry::SOURCE_SEC; - tcl.entry_file->protection = Public; - tcl.entry_main->moveToSubEntryAndKeep(tcl.entry_file); - Entry *myEntry=tcl_entry_new(); - myEntry->name=""; - tcl.entry_main->moveToSubEntryAndKeep(myEntry); - tcl.ns.insert("::",myEntry); - tcl.entry_current = tcl_entry_new(); - - tclscannerYYrestart( tclscannerYYin ); - BEGIN( TOP ); - yylineno=1; - myScan = new tcl_scan; - myScan->type[0]=' ';myScan->type[1]='\n'; - myScan->after.clear(); - myScan->line0=yylineno; - myScan->line1=yylineno; - myScan->buffer_state=YY_CURRENT_BUFFER; - myScan->ns=ns; - myScan->entry_cl=tcl_entry_class(cls); - myScan->entry_fn=NULL; - tcl.entry_inside = tcl.entry_file; - myScan->entry_scan = tcl.entry_inside; - tcl.scan.insert(0,myScan); - tclscannerYYlex(); - tcl.scan.clear(); - tcl.ns.clear(); - tcl.cl.clear(); - tcl.fn.clear(); - tcl.entry.clear(); -} - -//! Parse text file and build up entry tree. -void TclOutlineParser::parseInput(const char *fileName, - const char *input, - const std::shared_ptr<Entry> &root, - bool /*sameTranslationUnit*/, - QStrList & /*filesInSameTranslationUnit*/) -{ - QFile myFile; -tcl_inf("%s\n",fileName); - myFile.setName(fileName); - if (!myFile.open(IO_ReadOnly)) return; - if (strlen(input)<1) return; - - tcl.input_string = input; - if (tcl.input_string.length()<1) return; - printlex(yy_flex_debug, TRUE, __FILE__, fileName); - - msg("Parsing %s...\n",fileName); - tcl.commentScanner.enterFile(fileName,yylineno); - - tcl_init(); - tcl.code = NULL; - tcl.file_name = fileName; - tcl.this_parser = this; - tcl.entry_main = root.get(); /* toplevel entry */ - tcl_parse("",""); - tcl.commentScanner.leaveFile(tcl.file_name,yylineno); - root->program.resize(0); - myFile.close(); - printlex(yy_flex_debug, FALSE, __FILE__, fileName); -} - - -bool TclOutlineParser::needsPreprocessing(const QCString &extension) const -{ - (void)extension; - return FALSE; -} - -void TclOutlineParser::parsePrototype(const char *text) -{ - (void)text; -} - -static int yyread(char *buf,int max_size) -{ - int c=0; - - *buf = '\0'; - while ( c < max_size && tcl.input_string.at(tcl.input_position) ) - { - *buf = tcl.input_string.at(tcl.input_position++) ; - c++; buf++; - } - //printf("Read from=%d size=%d max=%d c=%d\n",tcl.input_position,strlen(&tcl.input_string[tcl.input_position]),max_size,c); - return c; -} - -//---------------------------------------------------------------------------- - -void TclCodeParser::resetCodeParserState() -{ -} - -//! Parse file and codify. -void TclCodeParser::parseCode(CodeOutputInterface & codeOutIntf, - const char * scopeName, - const QCString & input, - SrcLangExt lang, - bool isExampleBlock, - const char * exampleName, - FileDef * fileDef, - int startLine, - int endLine, - bool inlineFragment, - const MemberDef *memberDef, - bool showLineNumbers, - const Definition *searchCtx, - bool collectXRefs - ) -{ - (void)scopeName; - (void)lang; - (void)exampleName; - (void)fileDef; - (void)endLine; - (void)inlineFragment; - (void)searchCtx; - (void)collectXRefs; - - if (input.length()<1) return; - printlex(yy_flex_debug, TRUE, __FILE__, fileDef ? fileDef->fileName().data(): NULL); - tcl.input_string = input; - - QCString myNs=""; - QCString myCls=""; - if (memberDef) - { - if (memberDef->getClassDef()) - { - myCls = memberDef->getClassDef()->displayName(); - myNs = myCls; - } - else if (memberDef->getNamespaceDef()) - { - myNs = memberDef->getNamespaceDef()->displayName(); - } - } - - QCString myStr="Codifying.."; - if (scopeName) - { - myStr +=" scope="; - myStr+=scopeName; - } - if (exampleName) - { - myStr+=" example="; - myStr+=exampleName; - } - if (memberDef) - { - myStr+=" member="; - myStr+=memberDef->memberTypeName(); - myStr+=" "; - myStr+=memberDef->qualifiedName(); - } - if (fileDef) - { - myStr+=" file="; - myStr+=fileDef->fileName(); - } -tcl_inf("%s (%d,%d) %d %d\n",myStr.data(),startLine,endLine,isExampleBlock,inlineFragment); -//tcl_inf("%s\n"input.data()); - tcl_init(); - tcl.collectXRefs = collectXRefs; - tcl.memberdef = memberDef; - tcl.code = &codeOutIntf; - if (startLine<0) - { - startLine=1; - } - yylineno=startLine; - tcl.code_linenumbers = showLineNumbers; - tcl.code_line=yylineno; - tcl.code->startCodeLine(tcl.code_linenumbers); - if (tcl.code_linenumbers) - { - tcl.code->writeLineNumber(0,0,0,tcl.code_line); - } - tcl.file_name = ""; - tcl.this_parser = NULL; - if (isExampleBlock) - { - tcl_codify(NULL,input); - } - else - { - tcl.entry_main = tcl_entry_new(); - tcl_parse(myNs,myCls); - } - tcl.code->endCodeLine(); - tcl.scan.clear(); - tcl.ns.clear(); - tcl.cl.clear(); - tcl.fn.clear(); - tcl.entry.clear(); - printlex(yy_flex_debug, FALSE, __FILE__, fileDef ? fileDef->fileName().data(): NULL); -} -//---------------------------------------------------------------------------- - -// to avoid a warning -void tclDummy() -{ - yy_top_state(); -} - -#include "tclscanner.l.h" diff --git a/src/template.cpp b/src/template.cpp index ca28c73..1763eec 100644 --- a/src/template.cpp +++ b/src/template.cpp @@ -336,7 +336,7 @@ int TemplateList::release() return count; } -int TemplateList::count() const +uint TemplateList::count() const { return p->elems.count(); } @@ -406,9 +406,9 @@ TemplateListIntf::ConstIterator *TemplateList::createIterator() const return new TemplateListConstIterator(*this); } -TemplateVariant TemplateList::at(int index) const +TemplateVariant TemplateList::at(uint index) const { - if (index>=0 && index<(int)p->elems.count()) + if (index<p->elems.count()) { return p->elems[index]; } @@ -780,7 +780,7 @@ class FilterLength } if (v.type()==TemplateVariant::List) { - return TemplateVariant(v.toList()->count()); + return TemplateVariant((int)v.toList()->count()); } else if (v.type()==TemplateVariant::String) { @@ -1125,7 +1125,7 @@ class FilterAlphaIndex { int i=0; if (startLetter>='0' && startLetter<='9') s[i++] = 'x'; - s[i++]=tolower((char)startLetter); + s[i++]=(char)tolower((char)startLetter); s[i++]=0; } else @@ -2268,7 +2268,6 @@ class ExpressionParser if (p==q) // still no valid token found -> error { m_curToken.type = ExprToken::Unknown; - char s[2]; s[0]=c; s[1]=0; warn(m_parser->templateName(),m_line,"Found unknown token '%s' (%d) while parsing %s",s,c,m_tokenStream); @@ -2877,19 +2876,21 @@ class TemplateNodeIf : public TemplateNodeCreator<TemplateNodeIf> stopAt.append("else"); // if 'nodes' - GuardedNodes *guardedNodes = new GuardedNodes; - ExpressionParser ex(parser,line); - guardedNodes->line = line; - guardedNodes->guardAst = ex.parse(data); - parser->parse(this,line,stopAt,guardedNodes->trueNodes); - m_ifGuardedNodes.append(guardedNodes); + { + GuardedNodes *guardedNodes = new GuardedNodes; + ExpressionParser ex(parser,line); + guardedNodes->line = line; + guardedNodes->guardAst = ex.parse(data); + parser->parse(this,line,stopAt,guardedNodes->trueNodes); + m_ifGuardedNodes.append(guardedNodes); + } TemplateToken *tok = parser->takeNextToken(); // elif 'nodes' while (tok && tok->data.left(5)=="elif ") { ExpressionParser ex(parser,line); - guardedNodes = new GuardedNodes; + GuardedNodes *guardedNodes = new GuardedNodes; guardedNodes->line = tok->line; guardedNodes->guardAst = ex.parse(tok->data.mid(5)); parser->parse(this,tok->line,stopAt,guardedNodes->trueNodes); @@ -3119,15 +3120,15 @@ class TemplateNodeRange : public TemplateNodeCreator<TemplateNodeRange> while (!done) { // set the forloop meta-data variable - TemplateAutoRef<TemplateStruct> s(TemplateStruct::alloc()); - s->set("counter0", (int)index); - s->set("counter", (int)(index+1)); - s->set("revcounter", (int)(l-index)); - s->set("revcounter0", (int)(l-index-1)); - s->set("first",index==0); - s->set("last", (int)index==l-1); - s->set("parentloop",parentLoop ? *parentLoop : TemplateVariant()); - c->set("forloop",s.get()); + TemplateAutoRef<TemplateStruct> ls(TemplateStruct::alloc()); + ls->set("counter0", (int)index); + ls->set("counter", (int)(index+1)); + ls->set("revcounter", (int)(l-index)); + ls->set("revcounter0", (int)(l-index-1)); + ls->set("first",index==0); + ls->set("last", (int)index==l-1); + ls->set("parentloop",parentLoop ? *parentLoop : TemplateVariant()); + c->set("forloop",ls.get()); // set the iterator variable c->set(m_var,i); @@ -3278,7 +3279,7 @@ class TemplateNodeFor : public TemplateNodeCreator<TemplateNodeFor> } c->push(); //int index = m_reversed ? list.count() : 0; - TemplateVariant v; + //TemplateVariant v; const TemplateVariant *parentLoop = c->getRef("forloop"); uint index = m_reversed ? listSize-1 : 0; TemplateListIntf::ConstIterator *it = list->createIterator(); @@ -3622,7 +3623,6 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate> : TemplateNodeCreator<TemplateNodeCreate>(parser,parent,line), m_templateExpr(0), m_fileExpr(0) { TRACE(("TemplateNodeCreate(%s)\n",data.data())); - ExpressionParser ep(parser,line); if (data.isEmpty()) { parser->warn(m_templateName,line,"create tag is missing arguments"); @@ -4979,7 +4979,7 @@ TemplateToken *TemplateParser::takeNextToken() const TemplateToken *TemplateParser::currentToken() const { return m_tokens.getFirst(); -}; +} void TemplateParser::removeNextToken() { diff --git a/src/template.h b/src/template.h index 4602c53..40bd43f 100644 --- a/src/template.h +++ b/src/template.h @@ -355,10 +355,10 @@ class TemplateListIntf virtual ~TemplateListIntf() {} /** Returns the number of elements in the list */ - virtual int count() const = 0; + virtual uint count() const = 0; /** Returns the element at index position \a index. */ - virtual TemplateVariant at(int index) const = 0; + virtual TemplateVariant at(uint index) const = 0; /** Creates a new iterator for this list. * @note the user should call delete on the returned pointer. @@ -377,8 +377,8 @@ class TemplateList : public TemplateListIntf { public: // TemplateListIntf methods - virtual int count() const; - virtual TemplateVariant at(int index) const; + virtual uint count() const; + virtual TemplateVariant at(uint index) const; virtual TemplateListIntf::ConstIterator *createIterator() const; virtual int addRef(); virtual int release(); @@ -457,6 +457,7 @@ class TemplateStruct : public TemplateStructIntf class TemplateEscapeIntf { public: + virtual ~TemplateEscapeIntf() {} /** Returns the \a input after escaping certain characters */ virtual QCString escape(const QCString &input) = 0; /** Setting tabbing mode on or off (for LaTeX) */ @@ -469,6 +470,7 @@ class TemplateEscapeIntf class TemplateSpacelessIntf { public: + virtual ~TemplateSpacelessIntf() {} /** Returns the \a input after removing redundant whitespace */ virtual QCString remove(const QCString &input) = 0; /** Reset filter state */ diff --git a/src/translator_dk.h b/src/translator_dk.h index 70e9032..df063ef 100644 --- a/src/translator_dk.h +++ b/src/translator_dk.h @@ -1775,7 +1775,7 @@ class TranslatorDanish : public TranslatorAdapter_1_8_0 const char* base, const char* plurSuffix) { QCString result(base); - if (first_capital) result.at(0) = toupper(result.at(0)); + if (first_capital) result[0] = (char)toupper(result[0]); if (!singular) result+=plurSuffix; return result; } diff --git a/src/types.h b/src/types.h index d503c58..d34444c 100644 --- a/src/types.h +++ b/src/types.h @@ -54,7 +54,7 @@ enum SrcLangExt SrcLangExt_Fortran = 0x01000, SrcLangExt_VHDL = 0x02000, SrcLangExt_XML = 0x04000, - SrcLangExt_Tcl = 0x08000, + //SrcLangExt_Tcl = 0x08000, // no longer supported SrcLangExt_Markdown = 0x10000, SrcLangExt_SQL = 0x20000, SrcLangExt_Slice = 0x40000 diff --git a/src/util.cpp b/src/util.cpp index df1b748..bcc32f3 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1,11 +1,11 @@ /***************************************************************************** - * + * * * Copyright (C) 1997-2015 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 + * 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. * @@ -19,6 +19,8 @@ #include <errno.h> #include <math.h> #include <limits.h> +#include <cinttypes> + #include "md5.h" @@ -84,7 +86,7 @@ #define ALGO_COUNT 1 #define ALGO_CRC16 2 #define ALGO_MD5 3 - + //#define MAP_ALGO ALGO_COUNT //#define MAP_ALGO ALGO_CRC16 #define MAP_ALGO ALGO_MD5 @@ -95,12 +97,12 @@ // TextGeneratorOLImpl implementation //------------------------------------------------------------------------ -TextGeneratorOLImpl::TextGeneratorOLImpl(OutputDocInterface &od) : m_od(od) +TextGeneratorOLImpl::TextGeneratorOLImpl(OutputDocInterface &od) : m_od(od) { } void TextGeneratorOLImpl::writeString(const char *s,bool keepSpaces) const -{ +{ if (s==0) return; //printf("TextGeneratorOlImpl::writeString('%s',%d)\n",s,keepSpaces); if (keepSpaces) @@ -113,19 +115,19 @@ void TextGeneratorOLImpl::writeString(const char *s,bool keepSpaces) const cs[1]='\0'; while ((c=*p++)) { - if (c==' ') m_od.writeNonBreakableSpace(1); + if (c==' ') m_od.writeNonBreakableSpace(1); else cs[0]=c,m_od.docify(cs); } } } else { - m_od.docify(s); + m_od.docify(s); } } void TextGeneratorOLImpl::writeBreak(int indent) const -{ +{ m_od.lineBreak("typebreak"); int i; for (i=0;i<indent;i++) @@ -146,9 +148,9 @@ void TextGeneratorOLImpl::writeLink(const char *extRef,const char *file, //------------------------------------------------------------------------ // an inheritance tree of depth of 100000 should be enough for everyone :-) -const int maxInheritanceDepth = 100000; +const int maxInheritanceDepth = 100000; -/*! +/*! Removes all anonymous scopes from string s Possible examples: \verbatim @@ -177,9 +179,9 @@ QCString removeAnonymousScopes(const QCString &s) while (c<i+l && s.at(c)!='@') if (s.at(c++)==':') b1=TRUE; c=i+l-1; while (c>=i && s.at(c)!='@') if (s.at(c--)==':') b2=TRUE; - if (b1 && b2) - { - result+="::"; + if (b1 && b2) + { + result+="::"; } p=i+l; } @@ -248,7 +250,7 @@ done: void writePageRef(OutputDocInterface &od,const char *cn,const char *mn) { od.pushGeneratorState(); - + od.disable(OutputGenerator::Html); od.disable(OutputGenerator::Man); od.disable(OutputGenerator::Docbook); @@ -275,7 +277,7 @@ QCString generateMarker(int id) static QCString stripFromPath(const QCString &path,QStrList &l) { - // look at all the strings in the list and strip the longest match + // look at all the strings in the list and strip the longest match const char *s=l.first(); QCString potential; unsigned int length = 0; @@ -311,7 +313,7 @@ QCString stripFromIncludePath(const QCString &path) } /*! try to determine if \a name is a source or a header file name by looking - * at the extension. A number of variations is allowed in both upper and + * at the extension. A number of variations is allowed in both upper and * lower case) If anyone knows or uses another extension please let me know :-) */ int guessSection(const char *name) @@ -331,7 +333,7 @@ int guessSection(const char *name) n.right(4)==".i++" || n.right(4)==".inl" || n.right(4)==".xml" || - n.right(4)==".sql" + n.right(4)==".sql" ) return Entry::SOURCE_SEC; if (n.right(2)==".h" || // header n.right(3)==".hh" || @@ -352,7 +354,7 @@ QCString resolveTypeDef(const Definition *context,const QCString &qualifiedName, //printf("<<resolveTypeDef(%s,%s)\n", // context ? context->name().data() : "<none>",qualifiedName.data()); QCString result; - if (qualifiedName.isEmpty()) + if (qualifiedName.isEmpty()) { //printf(" qualified name empty!\n"); return result; @@ -379,7 +381,7 @@ QCString resolveTypeDef(const Definition *context,const QCString &qualifiedName, { // step 1: get the right scope const Definition *resScope=mContext; - if (scopeIndex!=-1) + if (scopeIndex!=-1) { // split-off scope part QCString resScopeName = qualifiedName.left(scopeIndex); @@ -400,9 +402,9 @@ QCString resolveTypeDef(const Definition *context,const QCString &qualifiedName, } } //printf("resScope=%s\n",resScope?resScope->name().data():"<none>"); - + // step 2: get the member - if (resScope) // no scope or scope found in the current context + if (resScope) // no scope or scope found in the current context { //printf("scope found: %s, look for typedef %s\n", // resScope->qualifiedName().data(),resName.data()); @@ -424,7 +426,7 @@ QCString resolveTypeDef(const Definition *context,const QCString &qualifiedName, for (;(tmd=mni.current());++mni) { //printf("Found member %s resScope=%s outerScope=%s mContext=%p\n", - // tmd->name().data(), resScope->name().data(), + // tmd->name().data(), resScope->name().data(), // tmd->getOuterScope()->name().data(), mContext); if (tmd->isTypedef() /*&& tmd->getOuterScope()==resScope*/) { @@ -465,11 +467,11 @@ QCString resolveTypeDef(const Definition *context,const QCString &qualifiedName, // qualifiedName.data(),context ? context->name().data() : "<global>"); } return result; - + } -/*! Get a class definition given its name. +/*! Get a class definition given its name. * Returns 0 if the class is not found. */ ClassDef *getClass(const char *n) @@ -532,7 +534,7 @@ int isAccessibleFromWithExpScope(const Definition *scope,const FileDef *fileScop * within file \a fileScope. * * Example: typedef A T; will return the class representing A if it is a class. - * + * * Example: typedef int T; will return 0, since "int" is not a class. */ const ClassDef *newResolveTypedef(const FileDef *fileScope, @@ -560,7 +562,7 @@ const ClassDef *newResolveTypedef(const FileDef *fileScope, if (g_resolvedTypedefs.find(qname)) return 0; // typedef already done g_resolvedTypedefs.insert(qname,md); // put on the trace list - + const ClassDef *typeClass = md->getClassDef(); QCString type = md->typeString(); // get the "value" of the typedef if (typeClass && typeClass->isTemplate() && @@ -572,7 +574,7 @@ const ClassDef *newResolveTypedef(const FileDef *fileScope, QCString typedefValue = type; int tl=type.length(); int ip=tl-1; // remove * and & at the end - while (ip>=0 && (type.at(ip)=='*' || type.at(ip)=='&' || type.at(ip)==' ')) + while (ip>=0 && (type.at(ip)=='*' || type.at(ip)=='&' || type.at(ip)==' ')) { ip--; } @@ -587,7 +589,7 @@ const ClassDef *newResolveTypedef(const FileDef *fileScope, const ClassDef *result = getResolvedClassRec(md->getOuterScope(), fileScope,type,&memTypeDef,0,pResolvedType); // if type is a typedef then return what it resolves to. - if (memTypeDef && memTypeDef->isTypedef()) + if (memTypeDef && memTypeDef->isTypedef()) { result=newResolveTypedef(fileScope,memTypeDef,pMemType,pTemplSpec); goto done; @@ -647,8 +649,8 @@ done: } // remember computed value for next time - if (result && result->getDefFileName()!="<code>") - // this check is needed to prevent that temporary classes that are + if (result && result->getDefFileName()!="<code>") + // this check is needed to prevent that temporary classes that are // introduced while parsing code fragments are being cached here. { //printf("setting cached typedef %p in result %p\n",md,result); @@ -659,9 +661,9 @@ done: pResolvedType ? *pResolvedType : QCString() ); } - + g_resolvedTypedefs.remove(qname); // remove from the trace list - + return result; } @@ -696,11 +698,11 @@ static QCString substTypedef(const Definition *scope,const FileDef *fileScope,co { // test accessibility of typedef within scope. int distance = isAccessibleFromWithExpScope(scope,fileScope,d,""); - if (distance!=-1 && distance<minDistance) + if (distance!=-1 && distance<minDistance) // definition is accessible and a better match { minDistance=distance; - bestMatch = md; + bestMatch = md; } } } @@ -715,18 +717,18 @@ static QCString substTypedef(const Definition *scope,const FileDef *fileScope,co { // test accessibility of typedef within scope. int distance = isAccessibleFromWithExpScope(scope,fileScope,d,""); - if (distance!=-1) // definition is accessible + if (distance!=-1) // definition is accessible { - bestMatch = md; + bestMatch = md; } } } - if (bestMatch) + if (bestMatch) { result = bestMatch->typeString(); if (pTypeDef) *pTypeDef=bestMatch; } - + //printf("substTypedef(%s,%s)=%s\n",scope?scope->name().data():"<global>", // name.data(),result.data()); return result; @@ -750,8 +752,8 @@ static const Definition *endOfPathIsUsedClass(const SDict<Definition> *cl,const } /*! Starting with scope \a start, the string \a path is interpreted as - * a part of a qualified scope name (e.g. A::B::C), and the scope is - * searched. If found the scope definition is returned, otherwise 0 + * a part of a qualified scope name (e.g. A::B::C), and the scope is + * searched. If found the scope definition is returned, otherwise 0 * is returned. */ static const Definition *followPath(const Definition *start,const FileDef *fileScope,const QCString &path) @@ -782,7 +784,7 @@ static const Definition *followPath(const Definition *start,const FileDef *fileS // qualScopePart.data(), // current->name().data(), // next?next->name().data():"<null>"); - if (next==0) // failed to follow the path + if (next==0) // failed to follow the path { //printf("==> next==0!\n"); if (current->definitionType()==Definition::TypeNamespace) @@ -817,7 +819,7 @@ bool accessibleViaUsingClass(const SDict<Definition> *cl, ) { //printf("accessibleViaUsingClass(%p)\n",cl); - if (cl) // see if the class was imported via a using statement + if (cl) // see if the class was imported via a using statement { SDict<Definition>::Iterator cli(*cl); Definition *ucd; @@ -826,7 +828,7 @@ bool accessibleViaUsingClass(const SDict<Definition> *cl, { //printf("Trying via used class %s\n",ucd->name().data()); const Definition *sc = explicitScopePartEmpty ? ucd : followPath(ucd,fileScope,explicitScopePart); - if (sc && sc==item) return TRUE; + if (sc && sc==item) return TRUE; //printf("Try via used class done\n"); } } @@ -849,10 +851,10 @@ bool accessibleViaUsingNamespace(const NamespaceSDict *nl, //printf("[Trying via used namespace %s: count=%d/%d\n",und->name().data(), // count,nl->count()); const Definition *sc = explicitScopePart.isEmpty() ? und : followPath(und,fileScope,explicitScopePart); - if (sc && item->getOuterScope()==sc) + if (sc && item->getOuterScope()==sc) { //printf("] found it\n"); - return TRUE; + return TRUE; } if (item->getLanguage()==SrcLangExt_Cpp) { @@ -916,7 +918,7 @@ class AccessStack for (i=0;i<m_index;i++) { AccessElem *e = &m_elements[i]; - if (e->scope==scope && e->fileScope==fileScope && e->item==item) + if (e->scope==scope && e->fileScope==fileScope && e->item==item) { return TRUE; } @@ -929,7 +931,7 @@ class AccessStack for (i=0;i<m_index;i++) { AccessElem *e = &m_elements[i]; - if (e->scope==scope && e->fileScope==fileScope && e->item==item && e->expScope==expScope) + if (e->scope==scope && e->fileScope==fileScope && e->item==item && e->expScope==expScope) { return TRUE; } @@ -951,7 +953,7 @@ class AccessStack }; /* Returns the "distance" (=number of levels up) from item to scope, or -1 - * if item in not inside scope. + * if item in not inside scope. */ int isAccessibleFrom(const Definition *scope,const FileDef *fileScope,const Definition *item) { @@ -969,20 +971,20 @@ int isAccessibleFrom(const Definition *scope,const FileDef *fileScope,const Defi int i; Definition *itemScope=item->getOuterScope(); - bool memberAccessibleFromScope = + bool memberAccessibleFromScope = (item->definitionType()==Definition::TypeMember && // a member itemScope && itemScope->definitionType()==Definition::TypeClass && // of a class scope->definitionType()==Definition::TypeClass && // accessible (dynamic_cast<const ClassDef*>(scope))->isAccessibleMember(dynamic_cast<const MemberDef *>(item)) // from scope ); - bool nestedClassInsideBaseClass = + bool nestedClassInsideBaseClass = (item->definitionType()==Definition::TypeClass && // a nested class - itemScope && itemScope->definitionType()==Definition::TypeClass && // inside a base + itemScope && itemScope->definitionType()==Definition::TypeClass && // inside a base scope->definitionType()==Definition::TypeClass && // class of scope - (dynamic_cast<const ClassDef*>(scope))->isBaseClass(dynamic_cast<ClassDef*>(itemScope),TRUE) + (dynamic_cast<const ClassDef*>(scope))->isBaseClass(dynamic_cast<ClassDef*>(itemScope),TRUE) ); - if (itemScope==scope || memberAccessibleFromScope || nestedClassInsideBaseClass) + if (itemScope==scope || memberAccessibleFromScope || nestedClassInsideBaseClass) { //printf("> found it\n"); if (nestedClassInsideBaseClass) result++; // penalty for base class to prevent @@ -994,13 +996,13 @@ int isAccessibleFrom(const Definition *scope,const FileDef *fileScope,const Defi if (fileScope) { SDict<Definition> *cl = fileScope->getUsedClasses(); - if (accessibleViaUsingClass(cl,fileScope,item)) + if (accessibleViaUsingClass(cl,fileScope,item)) { //printf("> found via used class\n"); goto done; } NamespaceSDict *nl = fileScope->getUsedNamespaces(); - if (accessibleViaUsingNamespace(nl,fileScope,item)) + if (accessibleViaUsingNamespace(nl,fileScope,item)) { //printf("> found via used namespace\n"); goto done; @@ -1017,13 +1019,13 @@ int isAccessibleFrom(const Definition *scope,const FileDef *fileScope,const Defi const NamespaceDef *nscope = dynamic_cast<const NamespaceDef*>(scope); //printf(" %s is namespace with %d used classes\n",nscope->name().data(),nscope->getUsedClasses()); const SDict<Definition> *cl = nscope->getUsedClasses(); - if (accessibleViaUsingClass(cl,fileScope,item)) + if (accessibleViaUsingClass(cl,fileScope,item)) { //printf("> found via used class\n"); goto done; } const NamespaceSDict *nl = nscope->getUsedNamespaces(); - if (accessibleViaUsingNamespace(nl,fileScope,item)) + if (accessibleViaUsingNamespace(nl,fileScope,item)) { //printf("> found via used namespace\n"); goto done; @@ -1050,10 +1052,10 @@ done: * class B { public: class J {}; }; * * - Looking for item=='J' inside scope=='B' will return 0. - * - Looking for item=='I' inside scope=='B' will return -1 + * - Looking for item=='I' inside scope=='B' will return -1 * (as it is not found in B nor in the global scope). - * - Looking for item=='A::I' inside scope=='B', first the match B::A::I is tried but - * not found and then A::I is searched in the global scope, which matches and + * - Looking for item=='A::I' inside scope=='B', first the match B::A::I is tried but + * not found and then A::I is searched in the global scope, which matches and * thus the result is 1. */ int isAccessibleFromWithExpScope(const Definition *scope,const FileDef *fileScope, @@ -1097,7 +1099,7 @@ int isAccessibleFromWithExpScope(const Definition *scope,const FileDef *fileScop (dynamic_cast<const ClassDef*>(newScope))->isBaseClass(dynamic_cast<const ClassDef*>(itemScope),TRUE,0) ) { - // inheritance is also ok. Example: looking for B::I, where + // inheritance is also ok. Example: looking for B::I, where // class A { public: class I {} }; // class B : public A {} // but looking for B::I, where @@ -1172,7 +1174,7 @@ int isAccessibleFromWithExpScope(const Definition *scope,const FileDef *fileScop { const NamespaceDef *nscope = dynamic_cast<const NamespaceDef*>(scope); const NamespaceSDict *nl = nscope->getUsedNamespaces(); - if (accessibleViaUsingNamespace(nl,fileScope,item,explicitScopePart)) + if (accessibleViaUsingNamespace(nl,fileScope,item,explicitScopePart)) { //printf("> found in used namespace\n"); goto done; @@ -1183,7 +1185,7 @@ int isAccessibleFromWithExpScope(const Definition *scope,const FileDef *fileScop if (fileScope) { const NamespaceSDict *nl = fileScope->getUsedNamespaces(); - if (accessibleViaUsingNamespace(nl,fileScope,item,explicitScopePart)) + if (accessibleViaUsingNamespace(nl,fileScope,item,explicitScopePart)) { //printf("> found in used namespace\n"); goto done; @@ -1216,7 +1218,7 @@ int computeQualifiedIndex(const QCString &name) static void getResolvedSymbol(const Definition *scope, const FileDef *fileScope, - Definition *d, + Definition *d, const QCString &explicitScopePart, ArgumentList *actTemplParams, int &minDistance, @@ -1231,8 +1233,8 @@ static void getResolvedSymbol(const Definition *scope, // only look at classes and members that are enums or typedefs if (d->definitionType()==Definition::TypeClass || - (d->definitionType()==Definition::TypeMember && - ((dynamic_cast<MemberDef*>(d))->isTypedef() || (dynamic_cast<MemberDef*>(d))->isEnumerate()) + (d->definitionType()==Definition::TypeMember && + ((dynamic_cast<MemberDef*>(d))->isTypedef() || (dynamic_cast<MemberDef*>(d))->isEnumerate()) ) ) { @@ -1248,23 +1250,23 @@ static void getResolvedSymbol(const Definition *scope, ClassDef *cd = dynamic_cast<ClassDef *>(d); //printf("cd=%s\n",cd->name().data()); if (!cd->isTemplateArgument()) // skip classes that - // are only there to - // represent a template + // are only there to + // represent a template // argument { //printf("is not a templ arg\n"); if (distance<minDistance) // found a definition that is "closer" { minDistance=distance; - bestMatch = cd; + bestMatch = cd; bestTypedef = 0; bestTemplSpec.resize(0); bestResolvedType = cd->qualifiedName(); } else if (distance==minDistance && fileScope && bestMatch && - fileScope->getUsedNamespaces() && - d->getOuterScope()->definitionType()==Definition::TypeNamespace && + fileScope->getUsedNamespaces() && + d->getOuterScope()->definitionType()==Definition::TypeNamespace && bestMatch->getOuterScope()==Doxygen::globalScope ) { @@ -1277,7 +1279,7 @@ static void getResolvedSymbol(const Definition *scope, // Just a non-perfect heuristic but it could help in some situations // (kdecore code is an example). minDistance=distance; - bestMatch = cd; + bestMatch = cd; bestTypedef = 0; bestTemplSpec.resize(0); bestResolvedType = cd->qualifiedName(); @@ -1376,7 +1378,7 @@ static void getResolvedSymbol(const Definition *scope, /* Find the fully qualified class name referred to by the input class * or typedef name against the input scope. * Loops through scope and each of its parent scopes looking for a - * match against the input name. Can recursively call itself when + * match against the input name. Can recursively call itself when * resolving typedefs. */ static const ClassDef *getResolvedClassRec(const Definition *scope, @@ -1411,7 +1413,7 @@ static const ClassDef *getResolvedClassRec(const Definition *scope, name=name.mid(qualifierIndex+2); } - if (name.isEmpty()) + if (name.isEmpty()) { //printf("] empty name\n"); return 0; // empty name @@ -1419,9 +1421,9 @@ static const ClassDef *getResolvedClassRec(const Definition *scope, //printf("Looking for symbol %s\n",name.data()); DefinitionIntf *di = Doxygen::symbolMap->find(name); - // the -g (for C# generics) and -p (for ObjC protocols) are now already + // the -g (for C# generics) and -p (for ObjC protocols) are now already // stripped from the key used in the symbolMap, so that is not needed here. - if (di==0) + if (di==0) { //di = Doxygen::symbolMap->find(name+"-g"); //if (di==0) @@ -1436,11 +1438,11 @@ static const ClassDef *getResolvedClassRec(const Definition *scope, } //printf("found symbol!\n"); - bool hasUsingStatements = - (fileScope && ((fileScope->getUsedNamespaces() && + bool hasUsingStatements = + (fileScope && ((fileScope->getUsedNamespaces() && fileScope->getUsedNamespaces()->count()>0) || - (fileScope->getUsedClasses() && - fileScope->getUsedClasses()->count()>0)) + (fileScope->getUsedClasses() && + fileScope->getUsedClasses()->count()>0)) ); //printf("hasUsingStatements=%d\n",hasUsingStatements); // Since it is often the case that the same name is searched in the same @@ -1467,7 +1469,7 @@ static const ClassDef *getResolvedClassRec(const Definition *scope, // if a file scope is given and it contains using statements we should // also use the file part in the key (as a class name can be in - // two different namespaces and a using statement in a file can select + // two different namespaces and a using statement in a file can select // one of them). if (hasUsingStatements) { @@ -1483,19 +1485,19 @@ static const ClassDef *getResolvedClassRec(const Definition *scope, //printf("Searching for %s result=%p\n",key.data(),pval); if (pval) { - //printf("LookupInfo %p %p '%s' %p\n", - // pval->classDef, pval->typeDef, pval->templSpec.data(), - // pval->resolvedType.data()); + //printf("LookupInfo %p %p '%s' %p\n", + // pval->classDef, pval->typeDef, pval->templSpec.data(), + // pval->resolvedType.data()); if (pTemplSpec) *pTemplSpec=pval->templSpec; if (pTypeDef) *pTypeDef=pval->typeDef; if (pResolvedType) *pResolvedType=pval->resolvedType; //printf("] cachedMatch=%s\n", // pval->classDef?pval->classDef->name().data():"<none>"); - //if (pTemplSpec) + //if (pTemplSpec) // printf("templSpec=%s\n",pTemplSpec->data()); - return pval->classDef; + return pval->classDef; } - else // not found yet; we already add a 0 to avoid the possibility of + else // not found yet; we already add a 0 to avoid the possibility of // endless recursion. { Doxygen::lookupCache->insert(key,new LookupInfo); @@ -1529,7 +1531,7 @@ static const ClassDef *getResolvedClassRec(const Definition *scope, bestResolvedType); } - if (pTypeDef) + if (pTypeDef) { *pTypeDef = bestTypedef; } @@ -1558,7 +1560,7 @@ static const ClassDef *getResolvedClassRec(const Definition *scope, } //printf("] bestMatch=%s distance=%d\n", // bestMatch?bestMatch->name().data():"<none>",minDistance); - //if (pTemplSpec) + //if (pTemplSpec) // printf("templSpec=%s\n",pTemplSpec->data()); return bestMatch; } @@ -1566,7 +1568,7 @@ static const ClassDef *getResolvedClassRec(const Definition *scope, /* Find the fully qualified class name referred to by the input class * or typedef name against the input scope. * Loops through scope and each of its parent scopes looking for a - * match against the input name. + * match against the input name. */ const ClassDef *getResolvedClass(const Definition *scope, const FileDef *fileScope, @@ -1581,7 +1583,7 @@ const ClassDef *getResolvedClass(const Definition *scope, static bool optimizeOutputVhdl = Config_getBool(OPTIMIZE_OUTPUT_VHDL); g_resolvedTypedefs.clear(); if (scope==0 || - (scope->definitionType()!=Definition::TypeClass && + (scope->definitionType()!=Definition::TypeClass && scope->definitionType()!=Definition::TypeNamespace ) || (scope->getLanguage()==SrcLangExt_Java && QCString(n).find("::")!=-1) @@ -1610,7 +1612,7 @@ const ClassDef *getResolvedClass(const Definition *scope, { result = getClass(n); } - if (!mayBeUnlinkable && result && !result->isLinkable()) + if (!mayBeUnlinkable && result && !result->isLinkable()) { if (!mayBeHidden || !result->isHidden()) { @@ -1628,34 +1630,6 @@ const ClassDef *getResolvedClass(const Definition *scope, //------------------------------------------------------------------------- //------------------------------------------------------------------------- -static bool findOperator(const QCString &s,int i) -{ - int b = s.findRev("operator",i); - if (b==-1) return FALSE; // not found - b+=8; - while (b<i) // check if there are only spaces in between - // the operator and the > - { - if (!isspace((uchar)s.at(b))) return FALSE; - b++; - } - return TRUE; -} - -static bool findOperator2(const QCString &s,int i) -{ - int b = s.findRev("operator",i); - if (b==-1) return FALSE; // not found - b+=8; - while (b<i) // check if there are only non-ascii - // characters in front of the operator - { - if (isId((uchar)s.at(b))) return FALSE; - b++; - } - return TRUE; -} - static const char constScope[] = { 'c', 'o', 'n', 's', 't', ':' }; static const char virtualScope[] = { 'v', 'i', 'r', 't', 'u', 'a', 'l', ':' }; static const char operatorScope[] = { 'o', 'p', 'e', 'r', 'a', 't', 'o', 'r', '?', '?', '?' }; @@ -1664,30 +1638,30 @@ struct CharAroundSpace { CharAroundSpace() { - charMap['('].before=FALSE; - charMap['='].before=FALSE; - charMap['&'].before=FALSE; - charMap['*'].before=FALSE; - charMap['['].before=FALSE; - charMap['|'].before=FALSE; - charMap['+'].before=FALSE; - charMap[';'].before=FALSE; - charMap[':'].before=FALSE; - charMap['/'].before=FALSE; - - charMap['='].after=FALSE; - charMap[' '].after=FALSE; - charMap['['].after=FALSE; - charMap[']'].after=FALSE; - charMap['\t'].after=FALSE; - charMap['\n'].after=FALSE; - charMap[')'].after=FALSE; - charMap[','].after=FALSE; - charMap['<'].after=FALSE; - charMap['|'].after=FALSE; - charMap['+'].after=FALSE; - charMap['('].after=FALSE; - charMap['/'].after=FALSE; + charMap[static_cast<int>('(')].before=FALSE; + charMap[static_cast<int>('=')].before=FALSE; + charMap[static_cast<int>('&')].before=FALSE; + charMap[static_cast<int>('*')].before=FALSE; + charMap[static_cast<int>('[')].before=FALSE; + charMap[static_cast<int>('|')].before=FALSE; + charMap[static_cast<int>('+')].before=FALSE; + charMap[static_cast<int>(';')].before=FALSE; + charMap[static_cast<int>(':')].before=FALSE; + charMap[static_cast<int>('/')].before=FALSE; + + charMap[static_cast<int>('=')].after=FALSE; + charMap[static_cast<int>(' ')].after=FALSE; + charMap[static_cast<int>('[')].after=FALSE; + charMap[static_cast<int>(']')].after=FALSE; + charMap[static_cast<int>('\t')].after=FALSE; + charMap[static_cast<int>('\n')].after=FALSE; + charMap[static_cast<int>(')')].after=FALSE; + charMap[static_cast<int>(',')].after=FALSE; + charMap[static_cast<int>('<')].after=FALSE; + charMap[static_cast<int>('|')].after=FALSE; + charMap[static_cast<int>('+')].after=FALSE; + charMap[static_cast<int>('(')].after=FALSE; + charMap[static_cast<int>('/')].after=FALSE; } struct CharElem { @@ -1994,10 +1968,10 @@ bool rightScopeMatch(const QCString &scope, const QCString &name) { int sl=scope.length(); int nl=name.length(); - return (name==scope || // equal - (scope.right(nl)==name && // substring + return (name==scope || // equal + (scope.right(nl)==name && // substring sl-nl>1 && scope.at(sl-nl-1)==':' && scope.at(sl-nl-2)==':' // scope - ) + ) ); } @@ -2005,10 +1979,10 @@ bool leftScopeMatch(const QCString &scope, const QCString &name) { int sl=scope.length(); int nl=name.length(); - return (name==scope || // equal - (scope.left(nl)==name && // substring + return (name==scope || // equal + (scope.left(nl)==name && // substring sl>nl+1 && scope.at(nl)==':' && scope.at(nl+1)==':' // scope - ) + ) ); } @@ -2045,11 +2019,11 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope, } // add non-word part to the result - bool insideString=FALSE; + bool insideString=FALSE; int i; - for (i=index;i<newIndex;i++) - { - if (txtStr.at(i)=='"') insideString=!insideString; + for (i=index;i<newIndex;i++) + { + if (txtStr.at(i)=='"') insideString=!insideString; } //printf("floatingIndex=%d strlen=%d autoBreak=%d\n",floatingIndex,strLen,autoBreak); @@ -2069,16 +2043,16 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope, out.writeBreak(indentLevel==0 ? 0 : indentLevel+1); out.writeString(splitText.right(splitLength-i-offset),keepSpaces); floatingIndex=splitLength-i-offset+matchLen; - } + } else { - out.writeString(splitText,keepSpaces); + out.writeString(splitText,keepSpaces); } } else { - //ol.docify(txtStr.mid(skipIndex,newIndex-skipIndex)); - out.writeString(txtStr.mid(skipIndex,newIndex-skipIndex),keepSpaces); + //ol.docify(txtStr.mid(skipIndex,newIndex-skipIndex)); + out.writeString(txtStr.mid(skipIndex,newIndex-skipIndex),keepSpaces); } // get word from string QCString word=txtStr.mid(newIndex,matchLen); @@ -2112,7 +2086,7 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope, } } } - if (!found && (cd || (cd=getClass(matchWord)))) + if (!found && (cd || (cd=getClass(matchWord)))) { //printf("Found class %s\n",cd->name().data()); // add link to the result @@ -2156,10 +2130,10 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope, int m = matchWord.findRev("::"); QCString scopeName; - if (scope && - (scope->definitionType()==Definition::TypeClass || + if (scope && + (scope->definitionType()==Definition::TypeClass || scope->definitionType()==Definition::TypeNamespace - ) + ) ) { scopeName=scope->name(); @@ -2171,19 +2145,19 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope, } //printf("ScopeName=%s\n",scopeName.data()); - //if (!found) printf("Trying to link %s in %s\n",word.data(),scopeName.data()); - if (!found && - getDefs(scopeName,matchWord,0,md,cd,fd,nd,gd) && - //(md->isTypedef() || md->isEnumerate() || + //if (!found) printf("Trying to link %s in %s\n",word.data(),scopeName.data()); + if (!found && + getDefs(scopeName,matchWord,0,md,cd,fd,nd,gd) && + //(md->isTypedef() || md->isEnumerate() || // md->isReference() || md->isVariable() - //) && - (external ? md->isLinkable() : md->isLinkableInProject()) + //) && + (external ? md->isLinkable() : md->isLinkableInProject()) ) { //printf("Found ref scope=%s\n",d?d->name().data():"<global>"); //ol.writeObjectLink(d->getReference(),d->getOutputFileBase(), // md->anchor(),word); - if (md!=self && (self==0 || md->name()!=self->name())) + if (md!=self && (self==0 || md->name()!=self->name())) // name check is needed for overloaded members, where getDefs just returns one { /* in case of Fortran scop and the variable is a non Fortran variable: don't link, @@ -2230,7 +2204,7 @@ void writeExample(OutputList &ol,ExampleSDict *ed) ol.parseText(exampleLine.mid(index,newIndex-index)); uint entryIndex = exampleLine.mid(newIndex+1,matchLen-1).toUInt(&ok); Example *e=ed->at(entryIndex); - if (ok && e) + if (ok && e) { ol.pushGeneratorState(); //if (latexEnabled) ol.disable(OutputGenerator::Latex); @@ -2254,7 +2228,7 @@ void writeExample(OutputList &ol,ExampleSDict *ed) ol.popGeneratorState(); } index=newIndex+matchLen; - } + } ol.parseText(exampleLine.right(exampleLine.length()-index)); ol.writeString("."); } @@ -2404,7 +2378,7 @@ int filterCRLF(char *buf,int len) { c = '\n'; // each CR to LF if (src<len && buf[src] == '\n') - ++src; // skip LF just after CR (DOS) + ++src; // skip LF just after CR (DOS) } else if ( c == '\0' && src<len-1) // filter out internal \0 characters, as it will confuse the parser { @@ -2428,8 +2402,8 @@ static QCString getFilterFromList(const char *name,const QStrList &filterList,bo if (i_equals!=-1) { QCString filterPattern = fs.left(i_equals); - QRegExp fpat(filterPattern,Portable::fileSystemIsCaseSensitive(),TRUE); - if (fpat.match(name)!=-1) + QRegExp fpat(filterPattern,Portable::fileSystemIsCaseSensitive(),TRUE); + if (fpat.match(name)!=-1) { // found a match! QCString filterName = fs.mid(i_equals+1); @@ -2497,7 +2471,7 @@ QCString transcodeCharacterStringToUTF8(const QCString &input) int outputSize=inputSize*4+1; QCString output(outputSize); void *cd = portable_iconv_open(outputEncoding,inputEncoding); - if (cd==(void *)(-1)) + if (cd==(void *)(-1)) { err("unsupported character conversion: '%s'->'%s'\n", inputEncoding.data(),outputEncoding); @@ -2529,7 +2503,7 @@ QCString transcodeCharacterStringToUTF8(const QCString &input) /*! reads a file with name \a name and returns it as a string. If \a filter * is TRUE the file will be filtered by any user specified input filter. - * If \a name is "-" the string will be read from standard input. + * If \a name is "-" the string will be read from standard input. */ QCString fileToString(const char *name,bool filter,bool isSourceCode) { @@ -2579,7 +2553,7 @@ QCString fileToString(const char *name,bool filter,bool isSourceCode) return buf.data(); } } - if (!fileOpened) + if (!fileOpened) { err("cannot open file '%s' for reading\n",name); } @@ -2609,7 +2583,7 @@ static QDateTime getCurrentDateTime() static bool warnedOnce=FALSE; if (!warnedOnce) { - warn_uncond("Environment variable SOURCE_DATE_EPOCH must have a value smaller than or equal to %llu; actual value %llu\n",UINT_MAX,epoch); + warn_uncond("Environment variable SOURCE_DATE_EPOCH must have a value smaller than or equal to %d; actual value %" PRIu64 "\n",UINT_MAX, (uint64_t)epoch); warnedOnce=TRUE; } } @@ -2643,24 +2617,24 @@ QCString yearToString() } //---------------------------------------------------------------------- -// recursive function that returns the number of branches in the +// recursive function that returns the number of branches in the // inheritance tree that the base class 'bcd' is below the class 'cd' int minClassDistance(const ClassDef *cd,const ClassDef *bcd,int level) { - if (bcd->categoryOf()) // use class that is being extended in case of + if (bcd->categoryOf()) // use class that is being extended in case of // an Objective-C category { bcd=bcd->categoryOf(); } - if (cd==bcd) return level; + if (cd==bcd) return level; if (level==256) { warn_uncond("class %s seem to have a recursive " "inheritance relation!\n",cd->name().data()); return -1; } - int m=maxInheritanceDepth; + int m=maxInheritanceDepth; if (cd->baseClasses()) { BaseClassListIterator bcli(*cd->baseClasses()); @@ -2677,12 +2651,12 @@ int minClassDistance(const ClassDef *cd,const ClassDef *bcd,int level) Protection classInheritedProtectionLevel(const ClassDef *cd,const ClassDef *bcd,Protection prot,int level) { - if (bcd->categoryOf()) // use class that is being extended in case of + if (bcd->categoryOf()) // use class that is being extended in case of // an Objective-C category { bcd=bcd->categoryOf(); } - if (cd==bcd) + if (cd==bcd) { goto exit; } @@ -2707,165 +2681,6 @@ exit: return prot; } -#ifndef NEWMATCH -// strip any template specifiers that follow className in string s -static QCString trimTemplateSpecifiers( - const QCString &namespaceName, - const QCString &className, - const QCString &s - ) -{ - //printf("trimTemplateSpecifiers(%s,%s,%s)\n",namespaceName.data(),className.data(),s.data()); - QCString scopeName=mergeScopes(namespaceName,className); - ClassDef *cd=getClass(scopeName); - if (cd==0) return s; // should not happen, but guard anyway. - - QCString result=s; - - int i=className.length()-1; - if (i>=0 && className.at(i)=='>') // template specialization - { - // replace unspecialized occurrences in s, with their specialized versions. - int count=1; - int cl=i+1; - while (i>=0) - { - char c=className.at(i); - if (c=='>') count++,i--; - else if (c=='<') { count--; if (count==0) break; } - else i--; - } - QCString unspecClassName=className.left(i); - int l=i; - int p=0; - while ((i=result.find(unspecClassName,p))!=-1) - { - if (result.at(i+l)!='<') // unspecialized version - { - result=result.left(i)+className+result.right(result.length()-i-l); - l=cl; - } - p=i+l; - } - } - - //printf("result after specialization: %s\n",result.data()); - - QCString qualName=cd->qualifiedNameWithTemplateParameters(); - //printf("QualifiedName = %s\n",qualName.data()); - // We strip the template arguments following className (if any) - if (!qualName.isEmpty()) // there is a class name - { - int is,ps=0; - int p=0,l,i; - - while ((is=getScopeFragment(qualName,ps,&l))!=-1) - { - QCString qualNamePart = qualName.right(qualName.length()-is); - //printf("qualNamePart=%s\n",qualNamePart.data()); - while ((i=result.find(qualNamePart,p))!=-1) - { - int ql=qualNamePart.length(); - result=result.left(i)+cd->name()+result.right(result.length()-i-ql); - p=i+cd->name().length(); - } - ps=is+l; - } - } - //printf("result=%s\n",result.data()); - - return result.stripWhiteSpace(); -} - -/*! - * @param pattern pattern to look for - * @param s string to search in - * @param p position to start - * @param len resulting pattern length - * @returns position on which string is found, or -1 if not found - */ -static int findScopePattern(const QCString &pattern,const QCString &s, - int p,int *len) -{ - int sl=s.length(); - int pl=pattern.length(); - int sp=0; - *len=0; - while (p<sl) - { - sp=p; // start of match - int pp=0; // pattern position - while (p<sl && pp<pl) - { - if (s.at(p)=='<') // skip template arguments while matching - { - int bc=1; - //printf("skipping pos=%d c=%c\n",p,s.at(p)); - p++; - while (p<sl) - { - if (s.at(p)=='<') bc++; - else if (s.at(p)=='>') - { - bc--; - if (bc==0) - { - p++; - break; - } - } - //printf("skipping pos=%d c=%c\n",p,s.at(p)); - p++; - } - } - else if (s.at(p)==pattern.at(pp)) - { - //printf("match at position p=%d pp=%d c=%c\n",p,pp,s.at(p)); - p++; - pp++; - } - else // no match - { - //printf("restarting at %d c=%c pat=%s\n",p,s.at(p),pattern.data()); - p=sp+1; - break; - } - } - if (pp==pl) // whole pattern matches - { - *len=p-sp; - return sp; - } - } - return -1; -} - -static QCString trimScope(const QCString &name,const QCString &s) -{ - int scopeOffset=name.length(); - QCString result=s; - do // for each scope - { - QCString tmp; - QCString scope=name.left(scopeOffset)+"::"; - //printf("Trying with scope='%s'\n",scope.data()); - - int i,p=0,l; - while ((i=findScopePattern(scope,result,p,&l))!=-1) // for each occurrence - { - tmp+=result.mid(p,i-p); // add part before pattern - p=i+l; - } - tmp+=result.right(result.length()-p); // add trailing part - - scopeOffset=name.findRev("::",scopeOffset-1); - result = tmp; - } while (scopeOffset>0); - //printf("trimScope(name=%s,scope=%s)=%s\n",name.data(),s.data(),result.data()); - return result; -} -#endif - void trimBaseClassScope(BaseClassList *bcl,QCString &s,int level=0) { //printf("trimBaseClassScope level=%d '%s'\n",level,s.data()); @@ -2884,7 +2699,7 @@ void trimBaseClassScope(BaseClassList *bcl,QCString &s,int level=0) } //printf("base class '%s'\n",cd->name().data()); if (cd->baseClasses()) - trimBaseClassScope(cd->baseClasses(),s,level+1); + trimBaseClassScope(cd->baseClasses(),s,level+1); } } @@ -2982,7 +2797,7 @@ static void stripIrrelevantString(QCString &target,const QCString &str) if (i1==-1 && i2==-1) { // strip str from target at index i - target=target.left(i)+target.right(target.length()-i-l); + target=target.left(i)+target.right(target.length()-i-l); changed=TRUE; i-=l; } @@ -3011,8 +2826,8 @@ static void stripIrrelevantString(QCString &target,const QCString &str) \code const T param -> T param // not relevant - const T& param -> const T& param // const needed - T* const param -> T* param // not relevant + const T& param -> const T& param // const needed + T* const param -> T* param // not relevant const T* param -> const T* param // const needed \endcode */ @@ -3032,276 +2847,6 @@ void stripIrrelevantConstVolatile(QCString &s) //#define MATCH printf("Match at line %d\n",__LINE__); //#define NOMATCH printf("Nomatch at line %d\n",__LINE__); -#ifndef NEWMATCH -static bool matchArgument(const Argument *srcA,const Argument *dstA, - const QCString &className, - const QCString &namespaceName, - NamespaceSDict *usingNamespaces, - SDict<Definition> *usingClasses) -{ - //printf("match argument start '%s|%s' <-> '%s|%s' using nsp=%p class=%p\n", - // srcA->type.data(),srcA->name.data(), - // dstA->type.data(),dstA->name.data(), - // usingNamespaces, - // usingClasses); - - // TODO: resolve any typedefs names that are part of srcA->type - // before matching. This should use className and namespaceName - // and usingNamespaces and usingClass to determine which typedefs - // are in-scope, so it will not be very efficient :-( - - QCString srcAType=trimTemplateSpecifiers(namespaceName,className,srcA->type); - QCString dstAType=trimTemplateSpecifiers(namespaceName,className,dstA->type); - QCString srcAName=srcA->name.stripWhiteSpace(); - QCString dstAName=dstA->name.stripWhiteSpace(); - srcAType.stripPrefix("class "); - dstAType.stripPrefix("class "); - - // allow distinguishing "const A" from "const B" even though - // from a syntactic point of view they would be two names of the same - // type "const". This is not fool prove of course, but should at least - // catch the most common cases. - if ((srcAType=="const" || srcAType=="volatile") && !srcAName.isEmpty()) - { - srcAType+=" "; - srcAType+=srcAName; - } - if ((dstAType=="const" || dstAType=="volatile") && !dstAName.isEmpty()) - { - dstAType+=" "; - dstAType+=dstAName; - } - if (srcAName=="const" || srcAName=="volatile") - { - srcAType+=srcAName; - srcAName.resize(0); - } - else if (dstA->name=="const" || dstA->name=="volatile") - { - dstAType+=dstA->name; - dstAName.resize(0); - } - - stripIrrelevantConstVolatile(srcAType); - stripIrrelevantConstVolatile(dstAType); - - // strip typename keyword - if (qstrncmp(srcAType,"typename ",9)==0) - { - srcAType = srcAType.right(srcAType.length()-9); - } - if (qstrncmp(dstAType,"typename ",9)==0) - { - dstAType = dstAType.right(dstAType.length()-9); - } - - srcAType = removeRedundantWhiteSpace(srcAType); - dstAType = removeRedundantWhiteSpace(dstAType); - - //srcAType=stripTemplateSpecifiersFromScope(srcAType,FALSE); - //dstAType=stripTemplateSpecifiersFromScope(dstAType,FALSE); - - //printf("srcA='%s|%s' dstA='%s|%s'\n",srcAType.data(),srcAName.data(), - // dstAType.data(),dstAName.data()); - - if (srcA->array!=dstA->array) // nomatch for char[] against char - { - NOMATCH - return FALSE; - } - if (srcAType!=dstAType) // check if the argument only differs on name - { - - // remove a namespace scope that is only in one type - // (assuming a using statement was used) - //printf("Trimming %s<->%s: %s\n",srcAType.data(),dstAType.data(),namespaceName.data()); - //trimNamespaceScope(srcAType,dstAType,namespaceName); - //printf("After Trimming %s<->%s\n",srcAType.data(),dstAType.data()); - - //QCString srcScope; - //QCString dstScope; - - // strip redundant scope specifiers - if (!className.isEmpty()) - { - srcAType=trimScope(className,srcAType); - dstAType=trimScope(className,dstAType); - //printf("trimScope: '%s' <=> '%s'\n",srcAType.data(),dstAType.data()); - ClassDef *cd; - if (!namespaceName.isEmpty()) - cd=getClass(namespaceName+"::"+className); - else - cd=getClass(className); - if (cd && cd->baseClasses()) - { - trimBaseClassScope(cd->baseClasses(),srcAType); - trimBaseClassScope(cd->baseClasses(),dstAType); - } - //printf("trimBaseClassScope: '%s' <=> '%s'\n",srcAType.data(),dstAType.data()); - } - if (!namespaceName.isEmpty()) - { - srcAType=trimScope(namespaceName,srcAType); - dstAType=trimScope(namespaceName,dstAType); - } - //printf("#usingNamespace=%d\n",usingNamespaces->count()); - if (usingNamespaces && usingNamespaces->count()>0) - { - NamespaceSDict::Iterator nli(*usingNamespaces); - NamespaceDef *nd; - for (;(nd=nli.current());++nli) - { - srcAType=trimScope(nd->name(),srcAType); - dstAType=trimScope(nd->name(),dstAType); - } - } - //printf("#usingClasses=%d\n",usingClasses->count()); - if (usingClasses && usingClasses->count()>0) - { - SDict<Definition>::Iterator cli(*usingClasses); - Definition *cd; - for (;(cd=cli.current());++cli) - { - srcAType=trimScope(cd->name(),srcAType); - dstAType=trimScope(cd->name(),dstAType); - } - } - - //printf("2. srcA=%s|%s dstA=%s|%s\n",srcAType.data(),srcAName.data(), - // dstAType.data(),dstAName.data()); - - if (!srcAName.isEmpty() && !dstA->type.isEmpty() && - (srcAType+" "+srcAName)==dstAType) - { - MATCH - return TRUE; - } - else if (!dstAName.isEmpty() && !srcA->type.isEmpty() && - (dstAType+" "+dstAName)==srcAType) - { - MATCH - return TRUE; - } - - - uint srcPos=0,dstPos=0; - bool equal=TRUE; - while (srcPos<srcAType.length() && dstPos<dstAType.length() && equal) - { - equal=srcAType.at(srcPos)==dstAType.at(dstPos); - if (equal) srcPos++,dstPos++; - } - uint srcATypeLen=srcAType.length(); - uint dstATypeLen=dstAType.length(); - if (srcPos<srcATypeLen && dstPos<dstATypeLen) - { - // if nothing matches or the match ends in the middle or at the - // end of a string then there is no match - if (srcPos==0 || dstPos==0) - { - NOMATCH - return FALSE; - } - if (isId(srcAType.at(srcPos)) && isId(dstAType.at(dstPos))) - { - //printf("partial match srcPos=%d dstPos=%d!\n",srcPos,dstPos); - // check if a name if already found -> if no then there is no match - if (!srcAName.isEmpty() || !dstAName.isEmpty()) - { - NOMATCH - return FALSE; - } - // types only - while (srcPos<srcATypeLen && isId(srcAType.at(srcPos))) srcPos++; - while (dstPos<dstATypeLen && isId(dstAType.at(dstPos))) dstPos++; - if (srcPos<srcATypeLen || - dstPos<dstATypeLen || - (srcPos==srcATypeLen && dstPos==dstATypeLen) - ) - { - NOMATCH - return FALSE; - } - } - else - { - // otherwise we assume that a name starts at the current position. - while (srcPos<srcATypeLen && isId(srcAType.at(srcPos))) srcPos++; - while (dstPos<dstATypeLen && isId(dstAType.at(dstPos))) dstPos++; - - // if nothing more follows for both types then we assume we have - // found a match. Note that now 'signed int' and 'signed' match, but - // seeing that int is not a name can only be done by looking at the - // semantics. - - if (srcPos!=srcATypeLen || dstPos!=dstATypeLen) - { - NOMATCH - return FALSE; - } - } - } - else if (dstPos<dstAType.length()) - { - if (!isspace((uchar)dstAType.at(dstPos))) // maybe the names differ - { - if (!dstAName.isEmpty()) // dst has its name separated from its type - { - NOMATCH - return FALSE; - } - while (dstPos<dstAType.length() && isId(dstAType.at(dstPos))) dstPos++; - if (dstPos!=dstAType.length()) - { - NOMATCH - return FALSE; // more than a difference in name -> no match - } - } - else // maybe dst has a name while src has not - { - dstPos++; - while (dstPos<dstAType.length() && isId(dstAType.at(dstPos))) dstPos++; - if (dstPos!=dstAType.length() || !srcAName.isEmpty()) - { - NOMATCH - return FALSE; // nope not a name -> no match - } - } - } - else if (srcPos<srcAType.length()) - { - if (!isspace((uchar)srcAType.at(srcPos))) // maybe the names differ - { - if (!srcAName.isEmpty()) // src has its name separated from its type - { - NOMATCH - return FALSE; - } - while (srcPos<srcAType.length() && isId(srcAType.at(srcPos))) srcPos++; - if (srcPos!=srcAType.length()) - { - NOMATCH - return FALSE; // more than a difference in name -> no match - } - } - else // maybe src has a name while dst has not - { - srcPos++; - while (srcPos<srcAType.length() && isId(srcAType.at(srcPos))) srcPos++; - if (srcPos!=srcAType.length() || !dstAName.isEmpty()) - { - NOMATCH - return FALSE; // nope not a name -> no match - } - } - } - } - MATCH - return TRUE; -} - -#endif - static QCString stripDeclKeywords(const QCString &s) { int i=s.find(" class "); @@ -3320,11 +2865,11 @@ static QCString extractCanonicalType(const Definition *d,const FileDef *fs,QCStr QCString getCanonicalTemplateSpec(const Definition *d,const FileDef *fs,const QCString& spec) { - + QCString templSpec = spec.stripWhiteSpace(); // this part had been commented out before... but it is needed to match for instance // std::list<std::string> against list<string> so it is now back again! - if (!templSpec.isEmpty() && templSpec.at(0) == '<') + if (!templSpec.isEmpty() && templSpec.at(0) == '<') { templSpec = "< " + extractCanonicalType(d,fs,templSpec.right(templSpec.length()-1).stripWhiteSpace()); } @@ -3346,7 +2891,7 @@ static QCString getCanonicalTypeForIdentifier( QCString symName,result,templSpec,tmpName; //DefinitionList *defList=0; - if (tSpec && !tSpec->isEmpty()) + if (tSpec && !tSpec->isEmpty()) templSpec = stripDeclKeywords(getCanonicalTemplateSpec(d,fs,*tSpec)); if (word.findRev("::")!=-1 && !(tmpName=stripScope(word)).isEmpty()) @@ -3508,7 +3053,7 @@ static QCString extractCanonicalType(const Definition *d,const FileDef *fs,QCStr QCString ct = getCanonicalTypeForIdentifier(d,fs,word,&templSpec); // in case the ct is empty it means that "word" represents scope "d" - // and this does not need to be added to the canonical + // and this does not need to be added to the canonical // type (it is redundant), so/ we skip it. This solves problem 589616. if (ct.isEmpty() && type.mid(p,2)=="::") { @@ -3522,7 +3067,7 @@ static QCString extractCanonicalType(const Definition *d,const FileDef *fs,QCStr // word.data(),templSpec.data(),canType.data(),ct.data()); if (!templSpec.isEmpty()) // if we didn't use up the templSpec already // (i.e. type is not a template specialization) - // then resolve any identifiers inside. + // then resolve any identifiers inside. { static QRegExp re("[a-z_A-Z\\x80-\\xFF][a-z_A-Z0-9\\x80-\\xFF]*"); int tp=0,tl,ti; @@ -3550,11 +3095,11 @@ static QCString extractCanonicalArgType(const Definition *d,const FileDef *fs,co QCString type = arg.type.stripWhiteSpace(); QCString name = arg.name; //printf("----- extractCanonicalArgType(type=%s,name=%s)\n",type.data(),name.data()); - if ((type=="const" || type=="volatile") && !name.isEmpty()) + if ((type=="const" || type=="volatile") && !name.isEmpty()) { // name is part of type => correct type+=" "; type+=name; - } + } if (name=="const" || name=="volatile") { // name is part of type => correct if (!type.isEmpty()) type+=" "; @@ -3665,7 +3210,7 @@ bool matchArguments2(const Definition *srcScope,const FileDef *srcFileScope,cons if (checkCV) { - if (srcAl.constSpecifier != dstAl.constSpecifier) + if (srcAl.constSpecifier != dstAl.constSpecifier) { NOMATCH return FALSE; // one member is const, the other not -> no match @@ -3700,7 +3245,7 @@ bool matchArguments2(const Definition *srcScope,const FileDef *srcFileScope,cons } } MATCH - return TRUE; // all arguments match + return TRUE; // all arguments match } @@ -3862,14 +3407,13 @@ static void findMembersWithSpecificName(MemberName *mn, //printf(" md->name()='%s' md->args='%s' fd=%p gd=%p current=%p ref=%s\n", // md->name().data(),args,fd,gd,currentFile,md->getReference().data()); if ( - ((gd && gd->isLinkable()) || (fd && fd->isLinkable()) || md->isReference()) && + ((gd && gd->isLinkable()) || (fd && fd->isLinkable()) || md->isReference()) && md->getNamespaceDef()==0 && md->isLinkable() && - (!checkStatics || (!md->isStatic() && !md->isDefine()) || + (!checkStatics || (!md->isStatic() && !md->isDefine()) || currentFile==0 || fd==currentFile) // statics must appear in the same file - ) + ) { bool match=TRUE; - ArgumentList *argList=0; if (args && !md->isDefine() && qstrcmp(args,"()")!=0) { const ArgumentList &mdAl = md->argumentList(); @@ -3880,7 +3424,7 @@ static void findMembersWithSpecificName(MemberName *mn, Doxygen::globalScope,fd,argList, checkCV); } - if (match && (forceTagFile==0 || md->getReference()==forceTagFile)) + if (match && (forceTagFile==0 || md->getReference()==forceTagFile)) { //printf("Found match!\n"); members.append(md); @@ -3894,17 +3438,17 @@ static void findMembersWithSpecificName(MemberName *mn, * memberName may also include a (partial) scope to indicate the scope * in which the member is located. * - * The parameter 'scName' is a string representing the name of the scope in + * The parameter 'scName' is a string representing the name of the scope in * which the link was found. * - * In case of a function args contains a string representation of the - * argument list. Passing 0 means the member has no arguments. + * In case of a function args contains a string representation of the + * argument list. Passing 0 means the member has no arguments. * Passing "()" means any argument list will do, but "()" is preferred. * * The function returns TRUE if the member is known and documented or * FALSE if it is not. - * If TRUE is returned parameter 'md' contains a pointer to the member - * definition. Furthermore exactly one of the parameter 'cd', 'nd', or 'fd' + * If TRUE is returned parameter 'md' contains a pointer to the member + * definition. Furthermore exactly one of the parameter 'cd', 'nd', or 'fd' * will be non-zero: * - if 'cd' is non zero, the member was found in a class pointed to by cd. * - if 'nd' is non zero, the member was found in a namespace pointed to by nd. @@ -3912,12 +3456,12 @@ static void findMembersWithSpecificName(MemberName *mn, * file fd. */ bool getDefs(const QCString &scName, - const QCString &mbName, + const QCString &mbName, const char *args, - const MemberDef *&md, - const ClassDef *&cd, - const FileDef *&fd, - const NamespaceDef *&nd, + const MemberDef *&md, + const ClassDef *&cd, + const FileDef *&fd, + const NamespaceDef *&nd, const GroupDef *&gd, bool forceEmptyScope, const FileDef *currentFile, @@ -3937,12 +3481,12 @@ bool getDefs(const QCString &scName, int is,im=0,pm=0; // strip common part of the scope from the scopeName - while ((is=scopeName.findRev("::"))!=-1 && + while ((is=scopeName.findRev("::"))!=-1 && (im=memberName.find("::",pm))!=-1 && (scopeName.right(scopeName.length()-is-2)==memberName.mid(pm,im-pm)) ) { - scopeName=scopeName.left(is); + scopeName=scopeName.left(is); pm=im+2; } //printf("result after scope corrections scope=%s name=%s\n", @@ -3952,11 +3496,11 @@ bool getDefs(const QCString &scName, QCString mScope; if (memberName.left(9)!="operator " && // treat operator conversion methods // as a special case - (im=memberName.findRev("::"))!=-1 && + (im=memberName.findRev("::"))!=-1 && im<(int)memberName.length()-2 // not A:: ) { - mScope=memberName.left(im); + mScope=memberName.left(im); mName=memberName.right(memberName.length()-im-2); } @@ -3995,13 +3539,13 @@ bool getDefs(const QCString &scName, //printf("Trying class scope %s: fcd=%p tmd=%p\n",className.data(),fcd,tmd); // todo: fill in correct fileScope! if (fcd && // is it a documented class - fcd->isLinkable() + fcd->isLinkable() ) { //printf(" Found fcd=%p\n",fcd); MemberNameIterator mmli(*mn); MemberDef *mmd; - int mdist=maxInheritanceDepth; + int mdist=maxInheritanceDepth; ArgumentList argList; if (args) { @@ -4058,9 +3602,9 @@ bool getDefs(const QCString &scName, } } //printf(" >Success=%d\n",mdist<maxInheritanceDepth); - if (mdist<maxInheritanceDepth) + if (mdist<maxInheritanceDepth) { - if (!md->isLinkable() || md->isStrongEnumValue()) + if (!md->isLinkable() || md->isStrongEnumValue()) { md=0; // avoid returning things we cannot link to cd=0; @@ -4073,7 +3617,7 @@ bool getDefs(const QCString &scName, return TRUE; /* found match */ } } - } + } if (tmd && tmd->isEnumerate() && tmd->isStrong()) // scoped enum { //printf("Found scoped enum!\n"); @@ -4187,7 +3731,7 @@ bool getDefs(const QCString &scName, namespaceName=mScope.copy(); } //printf("Trying namespace %s\n",namespaceName.data()); - if (!namespaceName.isEmpty() && + if (!namespaceName.isEmpty() && (fnd=Doxygen::namespaceSDict->find(namespaceName)) && fnd->isLinkable() ) @@ -4205,7 +3749,7 @@ bool getDefs(const QCString &scName, if (emd && emd->isStrong()) { //printf("yes match %s<->%s!\n",mScope.data(),emd->localName().data()); - if (emd->getNamespaceDef()==fnd && + if (emd->getNamespaceDef()==fnd && rightScopeMatch(mScope,emd->localName())) { //printf("found it!\n"); @@ -4241,8 +3785,8 @@ bool getDefs(const QCString &scName, } } } - if (!found && args && !qstrcmp(args,"()")) - // no exact match found, but if args="()" an arbitrary + if (!found && args && !qstrcmp(args,"()")) + // no exact match found, but if args="()" an arbitrary // member will do { for (mmli.toFirst();((mmd=mmli.current()) && !found);++mmli) @@ -4257,7 +3801,7 @@ bool getDefs(const QCString &scName, } if (found) { - if (!md->isLinkable()) + if (!md->isLinkable()) { md=0; // avoid returning things we cannot link to nd=0; @@ -4351,7 +3895,7 @@ bool getDefs(const QCString &scName, QListIterator<MemberDef> mit(members); for (mit.toFirst();(md=mit.current());++mit) { - if (md->getFileDef() && md->getFileDef()->name() == currentFile->name()) + if (md->getFileDef() && md->getFileDef()->name() == currentFile->name()) { break; // found match in the current file } @@ -4366,7 +3910,7 @@ bool getDefs(const QCString &scName, md=members.getLast(); } } - if (md && (md->getEnumScope()==0 || !md->getEnumScope()->isStrong())) + if (md && (md->getEnumScope()==0 || !md->getEnumScope()->isStrong())) // found a matching global member, that is not a scoped enum value (or uniquely matches) { fd=md->getFileDef(); @@ -4384,14 +3928,14 @@ bool getDefs(const QCString &scName, /*! * Searches for a scope definition given its name as a string via parameter - * `scope`. + * `scope`. * - * The parameter `docScope` is a string representing the name of the scope in + * The parameter `docScope` is a string representing the name of the scope in * which the `scope` string was found. * * The function returns TRUE if the scope is known and documented or * FALSE if it is not. - * If TRUE is returned exactly one of the parameter `cd`, `nd` + * If TRUE is returned exactly one of the parameter `cd`, `nd` * will be non-zero: * - if `cd` is non zero, the scope was a class pointed to by cd. * - if `nd` is non zero, the scope was a namespace pointed to by nd. @@ -4408,7 +3952,7 @@ static bool getScopeDefs(const char *docScope,const char *scope, bool explicitGlobalScope=FALSE; if (scopeName.at(0)==':' && scopeName.at(1)==':') { - scopeName=scopeName.right(scopeName.length()-2); + scopeName=scopeName.right(scopeName.length()-2); explicitGlobalScope=TRUE; } if (scopeName.isEmpty()) @@ -4429,11 +3973,11 @@ static bool getScopeDefs(const char *docScope,const char *scope, //(cd=getClass(fullName+"-g")) // C# generic ) && cd->isLinkable()) { - return TRUE; // class link written => quit + return TRUE; // class link written => quit } else if ((nd=Doxygen::namespaceSDict->find(fullName)) && nd->isLinkable()) { - return TRUE; // namespace link written => quit + return TRUE; // namespace link written => quit } if (scopeOffset==0) { @@ -4454,10 +3998,10 @@ static bool isLowerCase(QCString &s) if (p==0) return TRUE; int c; while ((c=*p++)) if (!islower(c)) return FALSE; - return TRUE; + return TRUE; } -/*! Returns an object to reference to given its name and context +/*! Returns an object to reference to given its name and context * @post return value TRUE implies *resContext!=0 or *resMember!=0 */ bool resolveRef(/* in */ const char *scName, @@ -4501,10 +4045,10 @@ bool resolveRef(/* in */ const char *scName, ClassDef *cd=0; NamespaceDef *nd=0; - // the following if() was commented out for releases in the range + // the following if() was commented out for releases in the range // 1.5.2 to 1.6.1, but has been restored as a result of bug report 594787. if (!inSeeBlock && scopePos==-1 && isLowerCase(tsName)) - { // link to lower case only name => do not try to autolink + { // link to lower case only name => do not try to autolink return FALSE; } @@ -4524,7 +4068,7 @@ bool resolveRef(/* in */ const char *scName, } return TRUE; } - else if (scName==fullName || (!inSeeBlock && scopePos==-1)) + else if (scName==fullName || (!inSeeBlock && scopePos==-1)) // nothing to link => output plain text { //printf("found scName=%s fullName=%s scName==fullName=%d " @@ -4544,7 +4088,7 @@ bool resolveRef(/* in */ const char *scName, if (bracePos!=-1) argsStr=fullName.right(fullName.length()-bracePos); // strip template specifier - // TODO: match against the correct partial template instantiation + // TODO: match against the correct partial template instantiation int templPos=nameStr.find('<'); bool tryUnspecializedVersion = FALSE; if (templPos!=-1 && nameStr.find("operator")==-1) @@ -4584,11 +4128,11 @@ bool resolveRef(/* in */ const char *scName, ) { //printf("after getDefs checkScope=%d nameStr=%s cd=%p nd=%p\n",checkScope,nameStr.data(),cd,nd); - if (checkScope && md && md->getOuterScope()==Doxygen::globalScope && + if (checkScope && md && md->getOuterScope()==Doxygen::globalScope && !md->isStrongEnumValue() && (!scopeStr.isEmpty() || nameStr.find("::")>0)) { - // we did find a member, but it is a global one while we were explicitly + // we did find a member, but it is a global one while we were explicitly // looking for a scoped variable. See bug 616387 for an example why this check is needed. // note we do need to support autolinking to "::symbol" hence the >0 //printf("not global member!\n"); @@ -4667,20 +4211,20 @@ QCString linkToText(SrcLangExt lang,const char *link,bool isFileName) #if 0 /* * generate a reference to a class, namespace or member. - * 'scName' is the name of the scope that contains the documentation + * 'scName' is the name of the scope that contains the documentation * string that is returned. * 'name' is the name that we want to link to. * 'name' may have the following formats: * 1) "ScopeName" - * 2) "memberName()" one of the (overloaded) function or define + * 2) "memberName()" one of the (overloaded) function or define * with name memberName. - * 3) "memberName(...)" a specific (overloaded) function or define + * 3) "memberName(...)" a specific (overloaded) function or define * with name memberName * 4) "::name a global variable or define * 4) "\#memberName member variable, global variable or define - * 5) ("ScopeName::")+"memberName()" - * 6) ("ScopeName::")+"memberName(...)" - * 7) ("ScopeName::")+"memberName" + * 5) ("ScopeName::")+"memberName()" + * 6) ("ScopeName::")+"memberName(...)" + * 7) ("ScopeName::")+"memberName" * instead of :: the \# symbol may also be used. */ @@ -4760,7 +4304,7 @@ bool resolveLink(/* in */ const char *scName, } else if ((pd=Doxygen::pageSDict->find(linkRef))) // link to a page { - const GroupDef *gd = pd->getGroupDef(); + gd = pd->getGroupDef(); if (gd) { if (!pd->name().isEmpty()) si=SectionManager::instance().find(pd->name()); @@ -4842,7 +4386,7 @@ bool resolveLink(/* in */ const char *scName, //---------------------------------------------------------------------- // General function that generates the HTML code for a reference to some -// file, class or member from text 'lr' within the context of class 'clName'. +// file, class or member from text 'lr' within the context of class 'clName'. // This link has the text 'lt' (if not 0), otherwise 'lr' is used as a // basis for the link's text. // returns TRUE if a link could be generated. @@ -4860,14 +4404,14 @@ bool generateLink(OutputDocInterface &od,const char *clName, if (compound) // link to compound { if (lt==0 && anchor.isEmpty() && /* compound link */ - compound->definitionType()==Definition::TypeGroup /* is group */ + compound->definitionType()==Definition::TypeGroup /* is group */ ) { linkText=(dynamic_cast<const GroupDef *>(compound))->groupTitle(); // use group's title as link } else if (compound->definitionType()==Definition::TypeFile) { - linkText=linkToText(compound->getLanguage(),lt,TRUE); + linkText=linkToText(compound->getLanguage(),lt,TRUE); } od.writeObjectLink(compound->getReference(), compound->getOutputFileBase(),anchor,linkText); @@ -4896,12 +4440,12 @@ void generateFileRef(OutputDocInterface &od,const char *name,const char *text) //FileInfo *fi; FileDef *fd; bool ambig; - if ((fd=findFileDef(Doxygen::inputNameDict,name,ambig)) && - fd->isLinkable()) + if ((fd=findFileDef(Doxygen::inputNameDict,name,ambig)) && + fd->isLinkable()) // link to documented input file od.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,linkText); else - od.docify(linkText); + od.docify(linkText); } //---------------------------------------------------------------------- @@ -4951,7 +4495,7 @@ FileDef *findFileDef(const FileNameDict *fnDict,const char *n,bool &ambig) const int maxAddrSize = 20; char addr[maxAddrSize]; - qsnprintf(addr,maxAddrSize,"%p:",fnDict); + qsnprintf(addr,maxAddrSize,"%p:",(void*)fnDict); QCString key = addr; key+=n; @@ -4978,7 +4522,7 @@ FileDef *findFileDef(const FileNameDict *fnDict,const char *n,bool &ambig) if (slashPos!=-1) { path=name.left(slashPos+1); - name=name.right(name.length()-slashPos-1); + name=name.right(name.length()-slashPos-1); //printf("path=%s name=%s\n",path.data(),name.data()); } if (name.isEmpty()) goto exit; @@ -5011,10 +4555,10 @@ FileDef *findFileDef(const FileNameDict *fnDict,const char *n,bool &ambig) for (fni.toFirst();(fd=fni.current());++fni) { QCString fdStripPath = stripFromIncludePath(fd->getPath()); - if (path.isEmpty() || fdStripPath.right(pathStripped.length())==pathStripped) - { - count++; - lastMatch=fd; + if (path.isEmpty() || fdStripPath.right(pathStripped.length())==pathStripped) + { + count++; + lastMatch=fd; } } //printf(">1 ===> add to cache %p\n",fd); @@ -5048,7 +4592,7 @@ QCString showFileDefMatches(const FileNameDict *fnDict,const char *n) if (slashPos!=-1) { path=name.left(slashPos+1); - name=name.right(name.length()-slashPos-1); + name=name.right(name.length()-slashPos-1); } FileName *fn; if ((fn=(*fnDict)[name])) @@ -5188,7 +4732,7 @@ QCString substituteKeywords(const QCString &s,const char *title, result = substitute(result,"$datetime",dateToString(TRUE)); result = substitute(result,"$date",dateToString(FALSE)); result = substitute(result,"$year",yearToString()); - result = substitute(result,"$doxygenversion",getVersion()); + result = substitute(result,"$doxygenversion",getDoxygenVersion()); result = substitute(result,"$projectname",projName); result = substitute(result,"$projectnumber",projNum); result = substitute(result,"$projectbrief",projBrief); @@ -5201,7 +4745,7 @@ QCString substituteKeywords(const QCString &s,const char *title, /*! Returns the character index within \a name of the first prefix * in Config_getList(IGNORE_PREFIX) that matches \a name at the left hand side, * or zero if no match was found - */ + */ int getPrefixIndex(const QCString &name) { if (name.isEmpty()) return 0; @@ -5249,7 +4793,7 @@ bool classHasVisibleChildren(const ClassDef *cd) if (cd->baseClasses()==0) return FALSE; bcl=cd->baseClasses(); } - else + else { if (cd->subClasses()==0) return FALSE; bcl=cd->subClasses(); @@ -5307,8 +4851,8 @@ QCString escapeCharsInString(const char *name,bool allowDots,bool allowUnderscor static GrowBuf growBuf; growBuf.clear(); if (name==0) return ""; - char c; - const char *p=name; + signed char c; + const signed char *p=(const signed char*)name; while ((c=*p++)!=0) { switch(c) @@ -5340,7 +4884,7 @@ QCString escapeCharsInString(const char *name,bool allowDots,bool allowUnderscor case '@': growBuf.addStr("_0d"); break; case ']': growBuf.addStr("_0e"); break; case '[': growBuf.addStr("_0f"); break; - default: + default: if (c<0) { char ids[5]; @@ -5348,7 +4892,7 @@ QCString escapeCharsInString(const char *name,bool allowDots,bool allowUnderscor bool doEscape = TRUE; if (allowUnicodeNames && uc <= 0xf7) { - const char* pt = p; + const signed char* pt = p; ids[ 0 ] = c; int l = 0; if ((uc&0xE0)==0xC0) @@ -5402,7 +4946,7 @@ QCString escapeCharsInString(const char *name,bool allowDots,bool allowUnderscor else { growBuf.addChar('_'); - growBuf.addChar(tolower(c)); + growBuf.addChar((char)tolower(c)); } break; } @@ -5462,7 +5006,7 @@ QCString unescapeCharsInString(const char *s) default: if (!caseSenseNames && c>='a' && c<='z') // lower to upper case escape, _a -> 'A' { - result+=toupper(*p); + result+=(char)toupper(*p); p++; } else // unknown escape, pass underscore character as-is @@ -5482,7 +5026,7 @@ QCString unescapeCharsInString(const char *s) } /*! This function determines the file name on disk of an item - * given its name, which could be a class name with template + * given its name, which could be a class name with template * arguments, so special characters need to be escaped. */ QCString convertNameToFile(const char *name,bool allowDots,bool allowUnderscore) @@ -5508,7 +5052,7 @@ QCString convertNameToFile(const char *name,bool allowDots,bool allowUnderscore) { num = *value; } - result.sprintf("a%05d",num); + result.sprintf("a%05d",num); } else // long names { @@ -5521,17 +5065,17 @@ QCString convertNameToFile(const char *name,bool allowDots,bool allowUnderscore) QCString sigStr(33); MD5Buffer((const unsigned char *)result.data(),resultLen,md5_sig); MD5SigToString(md5_sig,sigStr.rawData(),33); - result=result.left(128-32)+sigStr; + result=result.left(128-32)+sigStr; } } if (createSubdirs) { int l1Dir=0,l2Dir=0; -#if MAP_ALGO==ALGO_COUNT +#if MAP_ALGO==ALGO_COUNT // old algorithm, has the problem that after regeneration the // output can be located in a different dir. - if (Doxygen::htmlDirMap==0) + if (Doxygen::htmlDirMap==0) { Doxygen::htmlDirMap=new QDict<int>(100003); Doxygen::htmlDirMap->setAutoDelete(TRUE); @@ -5540,7 +5084,7 @@ QCString convertNameToFile(const char *name,bool allowDots,bool allowUnderscore) int *dirNum = Doxygen::htmlDirMap->find(result); if (dirNum==0) // new name { - Doxygen::htmlDirMap->insert(result,new int(curDirNum)); + Doxygen::htmlDirMap->insert(result,new int(curDirNum)); l1Dir = (curDirNum)&0xf; // bits 0-3 l2Dir = (curDirNum>>4)&0xff; // bits 4-11 curDirNum++; @@ -5624,7 +5168,7 @@ void extractNamespaceName(const QCString &scopeName, goto done; } p=clName.length()-2; - while (p>=0 && (i=clName.findRev("::",p))!=-1) + while (p>=0 && (i=clName.findRev("::",p))!=-1) // see if the first part is a namespace (and not a class) { //printf("Trying %s\n",clName.left(i).data()); @@ -5634,7 +5178,7 @@ void extractNamespaceName(const QCString &scopeName, namespaceName=nd->name().copy(); className=clName.right(clName.length()-i-2); goto done; - } + } p=i-2; // try a smaller piece of the scope } //printf("not found!\n"); @@ -5671,12 +5215,12 @@ QCString insertTemplateSpecifierInScope(const QCString &scope,const QCString &te ((cd=getClass(scope.left(si)))==0 || cd->templateArguments().empty()) ) { - //printf("Tried '%s'\n",(scope.left(si)+templ).data()); - pi=si+2; + //printf("Tried '%s'\n",(scope.left(si)+templ).data()); + pi=si+2; } if (si==-1) // not nested => append template specifier { - result+=templ; + result+=templ; } else // nested => insert template specifier before after first class name { @@ -5705,7 +5249,7 @@ QCString stripScope(const char *name) char c=result.at(p); switch (c) { - case ':': + case ':': //printf("stripScope(%s)=%s\n",name,result.right(l-p-1).data()); return result.right(l-p-1); case '>': @@ -5720,7 +5264,7 @@ QCString stripScope(const char *name) { case '>': count++; break; case '<': count--; if (count<=0) done=TRUE; break; - default: + default: //printf("c=%c count=%d\n",c,count); break; } @@ -5754,7 +5298,7 @@ QCString stripScope(const char *name) char c=result.at(p); switch (c) { - case ':': + case ':': // only exit in the case of :: //printf("stripScope(%s)=%s\n",name,result.right(l-p-1).data()); if (p>0 && result.at(p-1)==':') return result.right(l-p-1); @@ -5781,10 +5325,10 @@ QCString stripScope(const char *name) c=result.at(p--); switch (c) { - case '>': - count++; + case '>': + count++; break; - case '<': + case '<': if (p>0) { if (result.at(p-1) == '<') // skip << operator @@ -5793,10 +5337,10 @@ QCString stripScope(const char *name) break; } } - count--; + count--; foundMatch = count==0; break; - default: + default: //printf("c=%c count=%d\n",c,count); break; } @@ -5886,7 +5430,7 @@ QCString convertToXML(const char *s, bool keepEntities) growBuf.addStr("&"); } break; - case '\'': growBuf.addStr("'"); break; + case '\'': growBuf.addStr("'"); break; case '"': growBuf.addStr("""); break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: @@ -5996,10 +5540,10 @@ QCString convertToHtml(const char *s,bool keepEntities) } else { - growBuf.addStr("&"); + growBuf.addStr("&"); } break; - case '\'': growBuf.addStr("'"); break; + case '\'': growBuf.addStr("'"); break; case '"': growBuf.addStr("""); break; default: growBuf.addChar(c); break; } @@ -6241,11 +5785,11 @@ int extractClassNameFromType(const QCString &type,int &pos,QCString &name,QCStri int brCount=1; while (te<typeLen && brCount!=0) { - if (type.at(te)=='<') + if (type.at(te)=='<') { if (te<typeLen-1 && type.at(te+1)=='<') te++; else brCount++; } - if (type.at(te)=='>') + if (type.at(te)=='>') { if (te<typeLen-1 && type.at(te+1)=='>') te++; else brCount--; } @@ -6253,7 +5797,7 @@ int extractClassNameFromType(const QCString &type,int &pos,QCString &name,QCStri } } name = type.mid(i,l); - if (te>ts) + if (te>ts) { templSpec = type.mid(ts,te-ts),tl+=te-ts; pos=i+l+tl; @@ -6347,7 +5891,6 @@ QCString substituteTemplateArgumentsInString( { result += name.mid(p,i-p); QCString n = name.mid(i,l); - auto formIt = formalArgs.begin(); auto actIt = actualArgs.begin(); // if n is a template argument, then we substitute it @@ -6384,23 +5927,23 @@ QCString substituteTemplateArgumentsInString( if (formArg.name==n && actIt!=actualArgs.end() && !actArg.type.isEmpty()) // base class is a template argument { // replace formal argument with the actual argument of the instance - if (!leftScopeMatch(actArg.type,n)) - // the scope guard is to prevent recursive lockup for - // template<class A> class C : public<A::T>, - // where A::T would become A::T::T here, + if (!leftScopeMatch(actArg.type,n)) + // the scope guard is to prevent recursive lockup for + // template<class A> class C : public<A::T>, + // where A::T would become A::T::T here, // since n==A and actArg->type==A::T // see bug595833 for an example { if (actArg.name.isEmpty()) { - result += actArg.type+" "; + result += actArg.type+" "; found=TRUE; } - else + else // for case where the actual arg is something like "unsigned int" // the "int" part is in actArg->name. { - result += actArg.type+" "+actArg.name+" "; + result += actArg.type+" "+actArg.name+" "; found=TRUE; } } @@ -6442,12 +5985,12 @@ QCString substituteTemplateArgumentsInString( } -/*! Strips template specifiers from scope \a fullName, except those - * that make up specialized classes. The switch \a parentOnly - * determines whether or not a template "at the end" of a scope - * should be considered, e.g. with \a parentOnly is \c TRUE, \c A<T>::B<S> will - * try to strip `<T>` and not `<S>`, while \a parentOnly is \c FALSE will - * strip both unless `A<T>` or `B<S>` are specialized template classes. +/*! Strips template specifiers from scope \a fullName, except those + * that make up specialized classes. The switch \a parentOnly + * determines whether or not a template "at the end" of a scope + * should be considered, e.g. with \a parentOnly is \c TRUE, \c A<T>::B<S> will + * try to strip `<T>` and not `<S>`, while \a parentOnly is \c FALSE will + * strip both unless `A<T>` or `B<S>` are specialized template classes. */ QCString stripTemplateSpecifiersFromScope(const QCString &fullName, bool parentOnly, @@ -6466,11 +6009,11 @@ QCString stripTemplateSpecifiersFromScope(const QCString &fullName, while (e<l && !done) { char c=fullName.at(e++); - if (c=='<') + if (c=='<') { count++; } - else if (c=='>') + else if (c=='>') { count--; done = count==0; @@ -6478,7 +6021,7 @@ QCString stripTemplateSpecifiersFromScope(const QCString &fullName, } int si= fullName.find("::",e); - if (parentOnly && si==-1) break; + if (parentOnly && si==-1) break; // we only do the parent scope, so we stop here if needed result+=fullName.mid(p,i-p); @@ -6505,10 +6048,10 @@ QCString stripTemplateSpecifiersFromScope(const QCString &fullName, * Example1: \c A::B and \c B::C will result in \c A::B::C <br> * Example2: \c A and \c B will be \c A::B <br> * Example3: \c A::B and B will be \c A::B - * + * * @param leftScope the left hand part of the scope. * @param rightScope the right hand part of the scope. - * @returns the merged scope. + * @returns the merged scope. */ QCString mergeScopes(const QCString &leftScope,const QCString &rightScope) { @@ -6570,7 +6113,7 @@ int getScopeFragment(const QCString &s,int p,int *l) while (sp<sl && !done) { // TODO: deal with << and >> operators! - char c=s.at(sp++); + c=s.at(sp++); switch(c) { case '<': count++; break; @@ -6617,7 +6160,7 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, else // new page { QCString baseName=name; - if (baseName.right(4)==".tex") + if (baseName.right(4)==".tex") baseName=baseName.left(baseName.length()-4); else if (baseName.right(Doxygen::htmlFileExtension.length())==Doxygen::htmlFileExtension) baseName=baseName.left(baseName.length()-Doxygen::htmlFileExtension.length()); @@ -6649,7 +6192,7 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, { file=gd->getOutputFileBase(); } - else + else { file=pd->getOutputFileBase(); } @@ -6683,7 +6226,7 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, //---------------------------------------------------------------------------- void addRefItem(const std::vector<RefItem*> &sli, - const char *key, + const char *key, const char *prefix, const char *name,const char *title,const char *args,const Definition *scope) { //printf("addRefItem(sli=%d,key=%s,prefix=%s,name=%s,title=%s,args=%s)\n",(int)sli.size(),key,prefix,name,title,args); @@ -6833,9 +6376,9 @@ void filterLatexString(FTextStream &t,const char *str, } break; case '*': t << "$\\ast$"; break; - case '_': if (!insideTabbing) t << "\\+"; - t << "\\_"; - if (!insideTabbing) t << "\\+"; + case '_': if (!insideTabbing) t << "\\+"; + t << "\\_"; + if (!insideTabbing) t << "\\+"; break; case '{': t << "\\{"; break; case '}': t << "\\}"; break; @@ -6843,8 +6386,8 @@ void filterLatexString(FTextStream &t,const char *str, case '>': t << "$>$"; break; case '|': t << "$\\vert$"; break; case '~': t << "$\\sim$"; break; - case '[': if (Config_getBool(PDF_HYPERLINKS) || insideItem) - t << "\\mbox{[}"; + case '[': if (Config_getBool(PDF_HYPERLINKS) || insideItem) + t << "\\mbox{[}"; else t << "["; break; @@ -6852,12 +6395,12 @@ void filterLatexString(FTextStream &t,const char *str, if (Config_getBool(PDF_HYPERLINKS) || insideItem) t << "\\mbox{]}"; else - t << "]"; + t << "]"; break; case '-': t << "-\\/"; break; case '\\': t << "\\textbackslash{}"; - break; + break; case '"': t << "\\char`\\\"{}"; break; case '`': t << "\\`{}"; @@ -6867,9 +6410,9 @@ void filterLatexString(FTextStream &t,const char *str, case ' ': if (keepSpaces) { if (insideTabbing) t << "\\>"; else t << '~'; } else t << ' '; break; - default: + default: //if (!insideTabbing && forceBreaks && c!=' ' && *p!=' ') - if (!insideTabbing && + if (!insideTabbing && ((c>='A' && c<='Z' && pc!=' ' && pc!='\0' && *p) || (c==':' && pc!=':') || (pc=='.' && isId(c))) ) { @@ -6903,7 +6446,7 @@ QCString latexEscapeLabelName(const char *s) case '}': t << "\\rcurly{}"; break; case '~': t << "````~"; break; // to get it a bit better in index together with other special characters // NOTE: adding a case here, means adding it to while below as well! - default: + default: i=0; // collect as long string as possible, before handing it to docify tmp[i++]=c; @@ -6942,7 +6485,7 @@ QCString latexEscapeIndexChars(const char *s) case '{': t << "\\lcurly{}"; break; case '}': t << "\\rcurly{}"; break; // NOTE: adding a case here, means adding it to while below as well! - default: + default: i=0; // collect as long string as possible, before handing it to docify tmp[i++]=c; @@ -7044,6 +6587,7 @@ QCString rtfFormatBmkStr(const char *name) } } + //printf("Name = %s RTF_tag = %s\n",name,(*tag).data()); return *tag; } @@ -7126,9 +6670,9 @@ bool findAndRemoveWord(QCString &s,const QCString &word) int p=0,i,l; while ((i=wordExp.match(s,p,&l))!=-1) { - if (s.mid(i,l)==word) + if (s.mid(i,l)==word) { - if (i>0 && isspace((uchar)s.at(i-1))) + if (i>0 && isspace((uchar)s.at(i-1))) i--,l++; else if (i+l<(int)s.length() && isspace((uchar)s.at(i+l))) l++; @@ -7212,7 +6756,7 @@ static struct Lang2ExtMap const char *langName; const char *parserName; SrcLangExt parserId; -} +} g_lang2extMap[] = { // language parser parser option @@ -7233,7 +6777,6 @@ g_lang2extMap[] = { "vhdl", "vhdl", SrcLangExt_VHDL }, { "xml", "xml", SrcLangExt_XML }, { "sql", "sql", SrcLangExt_SQL }, - { "tcl", "tcl", SrcLangExt_Tcl }, { "md", "md", SrcLangExt_Markdown }, { 0, 0, (SrcLangExt)0 } }; @@ -7327,7 +6870,6 @@ void initDefaultExtensionMapping() updateLanguageMapping(".f18", "fortran"); updateLanguageMapping(".vhd", "vhdl"); updateLanguageMapping(".vhdl", "vhdl"); - updateLanguageMapping(".tcl", "tcl"); updateLanguageMapping(".ucf", "vhdl"); updateLanguageMapping(".qsf", "vhdl"); updateLanguageMapping(".md", "md"); @@ -7368,7 +6910,7 @@ QCString getFileNameExtension(QCString fn) //-------------------------------------------------------------------------- -MemberDef *getMemberFromSymbol(const Definition *scope,const FileDef *fileScope, +MemberDef *getMemberFromSymbol(const Definition *scope,const FileDef *fileScope, const char *n) { if (scope==0 || @@ -7452,9 +6994,9 @@ bool checkIfTypedef(const Definition *scope,const FileDef *fileScope,const char const char *writeUtf8Char(FTextStream &t,const char *s) { - char c=*s++; - t << c; - if (c<0) // multibyte character + uchar c=(uchar)*s++; + t << (char)c; + if (c>=0x80) // multibyte character { if (((uchar)c&0xE0)==0xC0) { @@ -7480,12 +7022,12 @@ const char *writeUtf8Char(FTextStream &t,const char *s) return s; } -int nextUtf8CharPosition(const QCString &utf8Str,int len,int startPos) +int nextUtf8CharPosition(const QCString &utf8Str,uint len,uint startPos) { int bytes=1; if (startPos>=len) return len; - char c = utf8Str[startPos]; - if (c<0) // multibyte utf-8 character + uchar c = (uchar)utf8Str[startPos]; + if (c>=0x80) // multibyte utf-8 character { if (((uchar)c&0xE0)==0xC0) { @@ -7581,8 +7123,8 @@ struct Marker int size; // size of the marker }; -/** For a string \a s that starts with a command name, returns the character - * offset within that string representing the first character after the +/** For a string \a s that starts with a command name, returns the character + * offset within that string representing the first character after the * command. For an alias with argument, this is the offset to the * character just after the argument list. * @@ -7604,13 +7146,13 @@ static int findEndOfCommand(const char *s) QCString args = extractAliasArgs(p,0); i+=args.length(); } - i+=p-s; + i+=(int)(p-s); } return i; } -/** Replaces the markers in an alias definition \a aliasValue - * with the corresponding values found in the comma separated argument +/** Replaces the markers in an alias definition \a aliasValue + * with the corresponding values found in the comma separated argument * list \a argList and the returns the result after recursive alias expansion. */ static QCString replaceAliasArguments(const QCString &aliasValue,const QCString &argList) @@ -7625,7 +7167,7 @@ static QCString replaceAliasArguments(const QCString &aliasValue,const QCString for (i=0;i<l;i++) { char c = argList.at(i); - if (c==',' && (i==0 || argList.at(i-1)!='\\')) + if (c==',' && (i==0 || argList.at(i-1)!='\\')) { args.append(new QCString(argList.mid(s,i-s))); s=i+1; // start of next argument @@ -7753,8 +7295,8 @@ static QCString expandAliasRec(const QCString s,bool allowRecursion) cmd += QCString().sprintf("{%d}",numArgs); // alias name + {n} } QCString *aliasText=Doxygen::aliasDict.find(cmd); - if (numArgs>1 && aliasText==0) - { // in case there is no command with numArgs parameters, but there is a command with 1 parameter, + if (numArgs>1 && aliasText==0) + { // in case there is no command with numArgs parameters, but there is a command with 1 parameter, // we also accept all text as the argument of that command (so you don't have to escape commas) aliasText=Doxygen::aliasDict.find(cmdNoArgs+"{1}"); if (aliasText) @@ -7800,7 +7342,7 @@ int countAliasArguments(const QCString argList) int count=1; int l = argList.length(); int i; - for (i=0;i<l;i++) + for (i=0;i<l;i++) { char c = argList.at(i); if (c==',' && (i==0 || argList.at(i-1)!='\\')) count++; @@ -7834,7 +7376,7 @@ QCString extractAliasArgs(const QCString &args,int pos) prevChar=0; } - if (bc==0) + if (bc==0) { //printf("extractAliasArgs('%s')->'%s'\n",args.data(),args.mid(pos+1,i-pos-1).data()); return args.mid(pos+1,i-pos-1); @@ -7870,7 +7412,7 @@ QCString expandAlias(const QCString &aliasName,const QCString &aliasValue) void writeTypeConstraints(OutputList &ol,const Definition *d,const ArgumentList &al) { if (al.empty()) return; - ol.startConstraintList(theTranslator->trTypeConstraints()); + ol.startConstraintList(theTranslator->trTypeConstraints()); for (const Argument &a : al) { ol.startConstraintParam(); @@ -7896,7 +7438,7 @@ void stackTrace() static char cmd[40960]; char *p = cmd; p += sprintf(p,"/usr/bin/atos -p %d ", (int)getpid()); - for (int x = 0; x < frameCount; x++) + for (int x = 0; x < frameCount; x++) { p += sprintf(p,"%p ", backtraceFrames[x]); } @@ -7929,7 +7471,7 @@ static int transcodeCharacterBuffer(const char *fileName,BufStr &srcBuf,int size if (inputEncoding==0 || outputEncoding==0) return size; if (qstricmp(inputEncoding,outputEncoding)==0) return size; void *cd = portable_iconv_open(outputEncoding,inputEncoding); - if (cd==(void *)(-1)) + if (cd==(void *)(-1)) { term("unsupported character conversion: '%s'->'%s': %s\n" "Check the INPUT_ENCODING setting in the config file!\n", @@ -8182,7 +7724,7 @@ QCString externalRef(const QCString &relPath,const QCString &ref,bool href) return result; } -/** Writes the intensity only bitmap represented by \a data as an image to +/** Writes the intensity only bitmap represented by \a data as an image to * directory \a dir using the colors defined by HTML_COLORSTYLE_*. */ void writeColoredImgData(const char *dir,ColoredImgDataItem data[]) @@ -8211,8 +7753,8 @@ void writeColoredImgData(const char *dir,ColoredImgDataItem data[]) } /** Replaces any markers of the form \#\#AA in input string \a str - * by new markers of the form \#AABBCC, where \#AABBCC represents a - * valid color, based on the intensity represented by hex number AA + * by new markers of the form \#AABBCC, where \#AABBCC represents a + * valid color, based on the intensity represented by hex number AA * and the current HTML_COLORSTYLE_* settings. */ QCString replaceColorMarkers(const char *str) @@ -8233,7 +7775,7 @@ QCString replaceColorMarkers(const char *str) #define HEXTONUM(x) (((x)>='0' && (x)<='9') ? ((x)-'0') : \ ((x)>='a' && (x)<='f') ? ((x)-'a'+10) : \ ((x)>='A' && (x)<='F') ? ((x)-'A'+10) : 0) - + double r,g,b; int red,green,blue; int level = HEXTONUM(lumStr[0])*16+HEXTONUM(lumStr[1]); @@ -8259,7 +7801,7 @@ QCString replaceColorMarkers(const char *str) return result; } -/** Copies the contents of file with name \a src to the newly created +/** Copies the contents of file with name \a src to the newly created * file with name \a dest. Returns TRUE if successful. */ bool copyFile(const QCString &src,const QCString &dest) @@ -8291,7 +7833,7 @@ bool copyFile(const QCString &src,const QCString &dest) return TRUE; } -/** Returns the section of text, in between a pair of markers. +/** Returns the section of text, in between a pair of markers. * Full lines are returned, excluding the lines on which the markers appear. * \sa routine lineBlock */ @@ -8379,7 +7921,6 @@ QCString langToString(SrcLangExt lang) case SrcLangExt_VHDL: return "VHDL"; case SrcLangExt_XML: return "XML"; case SrcLangExt_SQL: return "SQL"; - case SrcLangExt_Tcl: return "Tcl"; case SrcLangExt_Markdown: return "Markdown"; case SrcLangExt_Slice: return "Slice"; } @@ -8411,7 +7952,7 @@ QCString replaceScopeSeparator(QCString str) bool isURL(const QCString &url) { QCString loc_url = url.stripWhiteSpace(); - return loc_url.left(5)=="http:" || loc_url.left(6)=="https:" || + return loc_url.left(5)=="http:" || loc_url.left(6)=="https:" || loc_url.left(4)=="ftp:" || loc_url.left(5)=="file:"; } /** Corrects URL \a url according to the relative path \a relPath. @@ -8434,8 +7975,8 @@ bool protectionLevelVisible(Protection prot) static bool extractPrivate = Config_getBool(EXTRACT_PRIVATE); static bool extractPackage = Config_getBool(EXTRACT_PACKAGE); - return (prot!=Private && prot!=Package) || - (prot==Private && extractPrivate) || + return (prot!=Private && prot!=Package) || + (prot==Private && extractPrivate) || (prot==Package && extractPackage); } @@ -8458,7 +7999,7 @@ QCString stripIndentation(const QCString &s) if (c=='\t') indent+=tabSize - (indent%tabSize); else if (c=='\n') indent=0,searchIndent=TRUE; else if (c==' ') indent++; - else if (searchIndent) + else if (searchIndent) { searchIndent=FALSE; if (indent<minIndent) minIndent=indent; @@ -8515,7 +8056,7 @@ bool fileVisibleInIndex(const FileDef *fd,bool &genSourceFile) genSourceFile = !isDocFile && fd->generateSourceFile(); return ( ((allExternals && fd->isLinkable()) || fd->isLinkableInProject() - ) && + ) && !isDocFile ); } @@ -8524,7 +8065,7 @@ void addDocCrossReference(MemberDef *src,MemberDef *dst) { //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()) && + if ((dst->hasReferencedByRelation() || dst->hasCallerGraph()) && src->showInCallGraph() ) { @@ -8540,7 +8081,7 @@ void addDocCrossReference(MemberDef *src,MemberDef *dst) mdDecl->addSourceReferencedBy(src); } } - if ((src->hasReferencesRelation() || src->hasCallGraph()) && + if ((src->hasReferencesRelation() || src->hasCallGraph()) && src->showInCallGraph() ) { @@ -8596,7 +8137,7 @@ uint getUtf8Code( const QCString& s, int idx ) } -/*! @brief Returns one unicode character as an unsigned integer +/*! @brief Returns one unicode character as an unsigned integer * from utf-8 string, making the character lower case if it was upper case. * * @param s utf-8 encoded string @@ -8611,7 +8152,7 @@ uint getUtf8CodeToLower( const QCString& s, int idx ) } -/*! @brief Returns one unicode character as an unsigned integer +/*! @brief Returns one unicode character as an unsigned integer * from utf-8 string, making the character upper case if it was lower case. * * @param s utf-8 encoded string @@ -8932,7 +8473,7 @@ bool openOutputFile(const char *outFile,QFile &f) if (backup.exists()) // remove existing backup dir.remove(backup.fileName()); dir.rename(fi.fileName(),fi.fileName()+".bak"); - } + } f.setName(outFile); fileOpened = f.open(IO_WriteOnly|IO_Translate); } @@ -8943,7 +8484,7 @@ void writeExtraLatexPackages(FTextStream &t) { // User-specified packages QStrList &extraPackages = Config_getList(EXTRA_PACKAGES); - if (!extraPackages.isEmpty()) + if (!extraPackages.isEmpty()) { t << "% Packages requested by user\n"; const char *pkgName=extraPackages.first(); @@ -8985,6 +8526,20 @@ void writeLatexSpecialFormulaChars(FTextStream &t) "\n"; } +QCString getFullVersion() +{ + QCString versionString; + if (strlen(getGitVersion())>0) + { + versionString = QCString(getDoxygenVersion())+" ("+getGitVersion()+")"; + } + else + { + versionString = getDoxygenVersion(); + } + return versionString; +} + //------------------------------------------------------ static int g_usedTableLevels = 0; @@ -9003,5 +8558,3 @@ int usedTableLevels() } //------------------------------------------------------ - - @@ -442,7 +442,7 @@ bool patternMatch(const QFileInfo &fi,const QStrList *patList); QCString externalLinkTarget(const bool parent = false); QCString externalRef(const QCString &relPath,const QCString &ref,bool href); -int nextUtf8CharPosition(const QCString &utf8Str,int len,int startPos); +int nextUtf8CharPosition(const QCString &utf8Str,uint len,uint startPos); const char *writeUtf8Char(FTextStream &t,const char *s); @@ -501,4 +501,5 @@ int usedTableLevels(); void incUsedTableLevels(); void decUsedTableLevels(); +QCString getFullVersion(); #endif diff --git a/src/vhdlcode.l b/src/vhdlcode.l index 7350bfe..808e5a2 100644 --- a/src/vhdlcode.l +++ b/src/vhdlcode.l @@ -53,6 +53,8 @@ #define YY_NO_INPUT 1 #define YY_NO_UNISTD_H 1 + +#define USE_STATE2STRING 0 // Toggle for some debugging info //#define DBG_CTX(x) fprintf x @@ -116,7 +118,10 @@ static bool writeColoredWord(QCString& word ); static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName, bool typeOnly=FALSE, const char *curr_class=0); static void endFontClass(); static void startFontClass(const char *s); + +#if USE_STATE2STRING static const char *stateToString(int state); +#endif //------------------------------------------------------------------- @@ -855,7 +860,7 @@ XILINX "INST"|"NET"|"PIN"|"BLKNM"|"BUFG"|"COLLAPSE"|"CPLD"|"COMPGRP"|"CONFI generateMemLink(*g_code,g_PortMapComp,s1); while (index++<t1.size()) { - char cc=t1.at(index); + cc=t1.at(index); if (cc==' ' || cc=='\t') { char c2[2]; @@ -1647,5 +1652,7 @@ void codeFreeVhdlScanner() #endif } +#if USE_STATE2STRING #include "vhdlcode.l.h" +#endif diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index dfd2aa1..3528627 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -70,7 +70,6 @@ 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 assignBinding(VhdlConfNode* conf); static void addInstance(ClassDef* entity, ClassDef* arch, ClassDef *inst, const std::shared_ptr<Entry> &cur); @@ -768,22 +767,22 @@ MemberDef* VhdlDocGen::findMember(const QCString& className, const QCString& mem Definition *d = cd->getOuterScope(); QCString tt=d->name(); - ClassDef *ecd =getClass(tt); - if (!ecd) + ClassDef *acd =getClass(tt); + if (!acd) { tt=tt.upper(); - ecd =getClass(tt); + acd =getClass(tt); } - if (!ecd) + if (!acd) { tt=tt.lower(); - ecd =getClass(tt); + acd =getClass(tt); } - if (ecd) //d && d->definitionType()==Definition::TypeClass) + if (acd) //d && d->definitionType()==Definition::TypeClass) { - if(!packages.contains(ecd)) + if(!packages.contains(acd)) { - VhdlDocGen::findAllPackages(ecd); + VhdlDocGen::findAllPackages(acd); } } } @@ -1154,7 +1153,6 @@ void VhdlDocGen::parseFuncProto(const char* text,QCString& name,QCString& ret,bo } else { - QCString s1(text); s1=s1.stripWhiteSpace(); int i=s1.find("(",0,FALSE); int s=s1.find(QRegExp("[ \\t]")); @@ -1959,7 +1957,7 @@ void VhdlDocGen::writeVHDLDeclaration(const MemberDef* mdef,OutputList &ol, QCString ltype(mdef->typeString()); QCString largs(mdef->argsString()); - + ClassDef *kl=0; const ArgumentList &al = mdef->argumentList(); QCString nn; @@ -2138,7 +2136,7 @@ void VhdlDocGen::writeVHDLDeclaration(const MemberDef* mdef,OutputList &ol, case VhdlDocGen::UNITS: writeRecordUnit(largs,ltype,ol,mdef); break; - + default: break; } @@ -2455,10 +2453,10 @@ void VhdlDocGen::parseUCF(const char* input, Entry* entity,QCString fileName,b { if (altera) { - int i=temp.find("-name"); - if (i>0) + int in=temp.find("-name"); + if (in>0) { - temp=temp.remove(0,i+5); + temp=temp.remove(0,in+5); } temp.stripPrefix("set_location_assignment"); @@ -2468,8 +2466,8 @@ void VhdlDocGen::parseUCF(const char* input, Entry* entity,QCString fileName,b else { QRegExp ee("[\\s=]"); - int i=temp.find(ee); - QCString ff=temp.left(i); + int in=temp.find(ee); + QCString ff=temp.left(in); temp.stripPrefix(ff.data()); ff.append("#"); if (!temp.isEmpty()) @@ -2684,111 +2682,6 @@ QCString VhdlDocGen::parseForBinding(QCString & entity,QCString & arch) } -//@param arch bit0:flipflop -//@param binding e.g entity work.foo(bar) -//@param label |label0|label1 -// label0:architecture name -//@param confVhdl of configuration file (identifier::entity_name) or -// the architecture if isInlineConf TRUE -//@param isInlineConf -//@param confN List of configurations - -void assignBinding(VhdlConfNode * conf) -{ - ClassDef *archClass=0,*entClass=0; - QCString archName; - QCString arcBind,entBind; - - bool others,all; - entBind=conf->binding; - QCString conf2=VhdlDocGen::parseForBinding(entBind,arcBind); - - if (conf2!="configuration") - { - QCString a,c,e; - if (conf->isInlineConf) - { - c=conf->confVhdl; - e=VhdlDocGen::getIndexWord(conf->confVhdl.data(),0); - } - else - { - a=VhdlDocGen::getIndexWord(conf->compSpec.data(),0); - e=VhdlDocGen::getIndexWord(conf->confVhdl.data(),1); - c=e+"::"+a; - } - archClass= VhdlDocGen::findVhdlClass(c.data());//Doxygen::classSDict->find(a.data()); - entClass= VhdlDocGen::findVhdlClass(e.data()); //Doxygen::classSDict->find(e.data()); - } - - QCString label=conf->compSpec.lower(); - //label.prepend("|"); - - if (!archClass) - { - // err("architecture %s not found ! ",conf->confVhdl.data()); - return; - } - - archName=archClass->name(); - QCString allOt=VhdlDocGen::getIndexWord(conf->arch.data(),0); - all=allOt.lower()=="all" ; - others= allOt.lower()=="others"; - - for (const auto &cur : getVhdlInstList()) - { - if (cur->exception.lower()==label || conf->isInlineConf) - { - QCString archy; - - if (all || others) - { - archy=VhdlDocGen::getIndexWord(conf->arch.data(),1); - } - else - { - archy=conf->arch; - } - - QCString inst1=VhdlDocGen::getIndexWord(archy.data(),0).lower(); - QCString comp=VhdlDocGen::getIndexWord(archy.data(),1).lower(); - - QCStringList ql=QCStringList::split(",",inst1); - - for (uint j=0;j<ql.count();j++) - { - QCString archy1,sign1; - if (all || others) - { - archy1=VhdlDocGen::getIndexWord(conf->arch.data(),1); - sign1=cur->type; - } - else - { - archy1=comp+":"+ql[j]; - sign1=cur->type+":"+cur->name; - } - - if (archy1==sign1.lower() && !cur->stat) - { - // fprintf(stderr," \n label [%s] [%s] [%s]",cur->exception.data(),cur->type.data(),cur->name.data()); - ClassDef *ent= VhdlDocGen::findVhdlClass(entBind.data());//Doxygen::classSDict->find(entBind.data()); - - if (entClass==0 || ent==0) - { - continue; - } - - addInstance(ent,archClass,entClass,cur); - cur->stat=TRUE; - break; - } - }// for - } - }//for each element in instList - -}//assignBinding - /* // file foo.vhd @@ -2902,7 +2795,7 @@ ferr: md->setLanguage(SrcLangExt_VHDL); md->setMemberSpecifiers(VhdlDocGen::INSTANTIATION); md->setBriefDescription(cur->brief,cur->briefFile,cur->briefLine); - md->setBodySegment(cur->startLine,-1) ; + md->setBodySegment(cur->startLine,cur->startLine,-1) ; md->setDocumentation(cur->doc.data(),cur->docFile.data(),cur->docLine); FileDef *fd=ar->getFileDef(); md->setBodyDef(fd); @@ -2921,20 +2814,20 @@ ferr: void VhdlDocGen::writeRecordUnit(QCString & largs,QCString & ltype,OutputList& ol ,const MemberDef *mdef) { - int i=mdef->name().find('~'); + int i=mdef->name().find('~'); if(i>0){ //sets the real record member name const_cast<MemberDef*>(mdef)->setName(mdef->name().left(i).data()); } - + writeLink(mdef,ol); ol.startBold(); ol.insertMemberAlign(); if (!ltype.isEmpty()){ VhdlDocGen::formatString(ltype,ol,mdef); - } + } ol.endBold(); - + } @@ -3880,7 +3773,7 @@ void FlowChart::writeShape(FTextStream &t,const FlowChart* fl) else { if (fl->text.isEmpty()) return; - bool var=(fl->type & FlowChart::VARIABLE_NO); + bool isVar=(fl->type & FlowChart::VARIABLE_NO); QCString q=fl->text; if (exit) @@ -3896,7 +3789,7 @@ void FlowChart::writeShape(FTextStream &t,const FlowChart* fl) } t << "[shape=none margin=0.1, label=<\n"; t << "<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"2\" >\n "; - if (var) + if (isVar) { t << "<TR><TD BGCOLOR=\"" << flowCol.varNode << "\" > "; } @@ -4040,7 +3933,7 @@ int FlowChart::findLabel(int index,QCString &label) return j; } } - err("could not find label: ",label.data()); + err("could not find label: %s",label.data()); return 0; } @@ -4255,5 +4148,3 @@ void FlowChart::writeFlowLinks(FTextStream &t) } } //for } //writeFlowLinks - - diff --git a/src/vhdljjparser.cpp b/src/vhdljjparser.cpp index 22e2e01..725349e 100644 --- a/src/vhdljjparser.cpp +++ b/src/vhdljjparser.cpp @@ -731,8 +731,8 @@ void VHDLOutlineParser::error_skipto(int kind) Token *op; do { - Token *t = p->vhdlParser->getNextToken();// step to next token - op=p->vhdlParser->getToken(1); // get first token + p->vhdlParser->getNextToken(); // step to next token + op=p->vhdlParser->getToken(1); // get first token if (op==0) break; //fprintf(stderr,"\n %s",t->image.data()); } while (op->kind != kind); diff --git a/src/xmlcode.l b/src/xmlcode.l index edc98d5..b583bf5 100644 --- a/src/xmlcode.l +++ b/src/xmlcode.l @@ -72,7 +72,9 @@ static MemberDef * g_currentMemberDef; static bool g_includeCodeFragment; static const char * g_currentFontClass; +#if USE_STATE2STRING static const char *stateToString(int state); +#endif static void codify(const char* text) { @@ -438,4 +440,6 @@ void XMLCodeParser::resetCodeParserState() resetXmlCodeParserState(); } +#if USE_STATE2STRING #include "xmlcode.l.h" +#endif diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index 21fa77e..33426a7 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -1,9 +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 @@ -1084,10 +1081,10 @@ void XmlDocVisitor::visitPre(DocParamList *pl) { if (pl->paramTypes().count()>0) { - QListIterator<DocNode> li(pl->paramTypes()); + QListIterator<DocNode> li2(pl->paramTypes()); DocNode *type; m_t << "<parametertype>"; - for (li.toFirst();(type=li.current());++li) + for (li2.toFirst();(type=li2.current());++li2) { if (type->kind()==DocNode::Kind_Word) { diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index d674ed8..284332e 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -154,7 +154,7 @@ static void writeXMLHeader(FTextStream &t) t << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>" << endl;; t << "<doxygen xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "; t << "xsi:noNamespaceSchemaLocation=\"compound.xsd\" "; - t << "version=\"" << getVersion() << "\">" << endl; + t << "version=\"" << getDoxygenVersion() << "\">" << endl; } static void writeCombineScript() @@ -1007,7 +1007,6 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream if (mdict) { MemberSDict::Iterator mdi(*mdict); - const MemberDef *rmd; for (mdi.toFirst();(rmd=mdi.current());++mdi) { writeMemberReference(t,def,rmd,"references"); @@ -1017,7 +1016,6 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream if (mdict) { MemberSDict::Iterator mdi(*mdict); - const MemberDef *rmd; for (mdi.toFirst();(rmd=mdi.current());++mdi) { writeMemberReference(t,def,rmd,"referencedby"); @@ -1970,7 +1968,7 @@ void generateXML() t << "<?xml version='1.0' encoding='UTF-8' standalone='no'?>" << endl;; t << "<doxygenindex xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "; t << "xsi:noNamespaceSchemaLocation=\"index.xsd\" "; - t << "version=\"" << getVersion() << "\">" << endl; + t << "version=\"" << getDoxygenVersion() << "\">" << endl; { ClassSDict::Iterator cli(*Doxygen::classSDict); |